@inkeep/open-knowledge 0.42.0-beta.6 → 0.42.0-beta.8

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 (60) hide show
  1. package/dist/{acp-harness-probe-BZ0o8z0h.mjs → acp-harness-probe-BLfn73i6.mjs} +2 -2
  2. package/dist/assets/skills/discovery/SKILL.md +1 -1
  3. package/dist/assets/skills/project/SKILL.md +1 -1
  4. package/dist/assets/skills/write-skill/SKILL.md +1 -1
  5. package/dist/cli.mjs +6 -6
  6. package/dist/constants-WSErvfZx.mjs +2 -0
  7. package/dist/index.mjs +1 -1
  8. package/dist/init-C8rkx5j9.mjs +1 -0
  9. package/dist/{init-CIcmWJHm.mjs → init-WcxdIpWm.mjs} +3 -3
  10. package/dist/{launch-json-removal-CMm87muK.mjs → launch-json-removal-DcIuSt6G.mjs} +2 -2
  11. package/dist/loader-BzBN0303.mjs +1 -0
  12. package/dist/{loader-C-Kifx5i.mjs → loader-DKjlOOL4.mjs} +2 -2
  13. package/dist/{preview-CqGqHfYb.mjs → preview-Cb6ctP_a.mjs} +2 -2
  14. package/dist/preview-DhJpRIag.mjs +1 -0
  15. package/dist/public/assets/{ActivityModeContent-BcKeq4GS.js → ActivityModeContent-BarAfjGw.js} +1 -1
  16. package/dist/public/assets/{AgentDiffPane-B1lhqYoG.js → AgentDiffPane-Bgwp1tZy.js} +1 -1
  17. package/dist/public/assets/{CodeMirrorPropInput-C-g_G-yI.js → CodeMirrorPropInput-L6IjOKBK.js} +1 -1
  18. package/dist/public/assets/{DocumentContext-B8Qoku71.js → DocumentContext-CpOTF1vT.js} +2 -2
  19. package/dist/public/assets/{EditorModeToggle-iEGu97y7.js → EditorModeToggle-DeKVTMB4.js} +1 -1
  20. package/dist/public/assets/{EnableSyncConfirmDialog-BQeXrhKR.js → EnableSyncConfirmDialog-BCmpMth-.js} +1 -1
  21. package/dist/public/assets/FeedbackForm-CeQduxl0.js +1 -0
  22. package/dist/public/assets/{LintConfigEditor-BxLAEyqV.js → LintConfigEditor-DXChjQ1V.js} +1 -1
  23. package/dist/public/assets/{ManagedArtifactProperties-DqMRN999.js → ManagedArtifactProperties-skq9H6rG.js} +1 -1
  24. package/dist/public/assets/{MermaidDocEditor-C4auOYmp.js → MermaidDocEditor-pNUP6YpL.js} +1 -1
  25. package/dist/public/assets/{PropertyPanel-CnMICYok.js → PropertyPanel-DX8x1BVg.js} +1 -1
  26. package/dist/public/assets/{SchemaConfigEditor-ClGpXOLw.js → SchemaConfigEditor-BKg4WPNk.js} +1 -1
  27. package/dist/public/assets/{SettingsDialogBody-B3ROt1pc.js → SettingsDialogBody-BPaBfLAb.js} +1 -1
  28. package/dist/public/assets/{ShareReceiveMissDialog-CYziYLGf.js → ShareReceiveMissDialog-Db_rUJdZ.js} +1 -1
  29. package/dist/public/assets/{SourceEditor-CjeWll93.js → SourceEditor-DKIoo25b.js} +1 -1
  30. package/dist/public/assets/{TerminalSessionsHost-C5nl_yCS.js → TerminalSessionsHost-DPgpO6i4.js} +2 -2
  31. package/dist/public/assets/{TerminalWindowApp-CXPQgo_F.js → TerminalWindowApp-DeHfBl6y.js} +1 -1
  32. package/dist/public/assets/{ThreadView-CNhxTZUD.js → ThreadView-DN1Ly5aA.js} +1 -1
  33. package/dist/public/assets/{TimelineDiffPane-0-oB0HJO.js → TimelineDiffPane-CQ7YSDnI.js} +1 -1
  34. package/dist/public/assets/{auth-state-cache-BUB32hpt.js → auth-state-cache-BMSP_iQ1.js} +1 -1
  35. package/dist/public/assets/{client-version-UZOTI_xc.js → client-version-CiCsKDVd.js} +1 -1
  36. package/dist/public/assets/{config-provider-psmEp7UZ.js → config-provider-Bd6kn_Wi.js} +1 -1
  37. package/dist/public/assets/index-BPmTXHv2.js +2014 -0
  38. package/dist/public/assets/{pending-receive-nav-store-uQRZ6j0p.js → pending-receive-nav-store-h6XBq4Wh.js} +1 -1
  39. package/dist/public/assets/{selection-context-CwFGy9Md.js → selection-context-BeZk6OlH.js} +1 -1
  40. package/dist/public/assets/{src-dGfXUun_.js → src-IvJo911P.js} +1 -1
  41. package/dist/public/assets/{telemetry-impl-DgkEb_cY.js → telemetry-impl-B0xfYfCD.js} +1 -1
  42. package/dist/public/assets/{telemetry-startup-CQTiYCrs.js → telemetry-startup-BYP0kNl2.js} +1 -1
  43. package/dist/public/assets/{typing-burst-detector-D7A5ERs3.js → typing-burst-detector-zU1P7TwH.js} +1 -1
  44. package/dist/public/assets/{use-activity-panel-gCh9MxRw.js → use-activity-panel-CfJPrmBg.js} +1 -1
  45. package/dist/public/assets/{use-terminal-enabled-Dxvf3ewA.js → use-terminal-enabled-skhgA3z3.js} +1 -1
  46. package/dist/public/assets/{use-timeline-entry-diff-CShGJR_t.js → use-timeline-entry-diff-D8H1ml6L.js} +1 -1
  47. package/dist/public/index.html +12 -12
  48. package/dist/{repair-launch-json-CcmcaUuj.mjs → repair-launch-json-Bgt1JPap.mjs} +2 -2
  49. package/dist/{repair-mcp-configs-CtpjEM_k.mjs → repair-mcp-configs-JOnTDbtQ.mjs} +2 -2
  50. package/dist/{src-BFng-ST-.mjs → src-BkLr-Kxa.mjs} +2 -2
  51. package/dist/start-CFsgb8aj.mjs +1 -0
  52. package/dist/{start-uUA5csNK.mjs → start-CrZJy3Yc.mjs} +2 -2
  53. package/package.json +4 -4
  54. package/dist/constants-Co6lMb8A.mjs +0 -2
  55. package/dist/init-CSCfjLot.mjs +0 -1
  56. package/dist/loader-BQ-vpXns.mjs +0 -1
  57. package/dist/preview-0WFzw7t-.mjs +0 -1
  58. package/dist/public/assets/FeedbackForm-Ktf4zBow.js +0 -1
  59. package/dist/public/assets/index-fJdl7nfi.js +0 -2014
  60. package/dist/start-DZWMlGrL.mjs +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{s as o,t as s}from"./createLucideIcon-DAkhoPjT.js";import{t as c}from"./button-Gol9BgNB.js";import{t as l}from"./label-DyipnO5I.js";import{a as u,i as d,n as f,o as p,r as m,t as h}from"./switch-DYic2V-1.js";import{t as g}from"./braces-DwnwFx_V.js";import{t as _}from"./case-sensitive-nl0tWMnZ.js";import{t as v}from"./hash-DNKDqZ18.js";import{t as y}from"./trash-2-BUuL4OCw.js";import{n as b}from"./dist-BLAMau9Z.js";import{t as x}from"./input-D0ZW0Opq.js";import{d as S,f as C,o as w,r as T,s as E}from"./lint-config-client-G_mrikOJ.js";import{n as D,r as ee,t as O}from"./EditorModeToggle-iEGu97y7.js";import{t as k}from"./tag-pill-input-B27HgfRy.js";import{t as te}from"./useLintConfigViewMode-BYm6FwC5.js";import{r as A,t as ne}from"./schema-fields-view-intent-Dz1ZzVCe.js";var j=s(`brackets`,[[`path`,{d:`M16 3h3a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1h-3`,key:`1kt8lf`}],[`path`,{d:`M8 21H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h3`,key:`gduv9`}]]),M=s(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),N=s(`toggle-left`,[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]),P=a(),re=e(n(),1),F=t(),I=[`string`,`number`,`boolean`,`array`,`object`],L=[`string`,`number`,`boolean`,`enum`,`array`,`object`],ie=[`string`,`number`,`boolean`,`enum`,`object`],R={string:{Icon:_,className:`text-green-500`},number:{Icon:v,className:`text-blue-500`},boolean:{Icon:N,className:`text-orange-500`},enum:{Icon:M,className:`text-yellow-500`},array:{Icon:j,className:`text-pink-500`},object:{Icon:g,className:`text-purple-500`}};function ae(e){let t=(0,P.c)(8),{option:n}=e,{Icon:r,className:i}=R[n],a;t[0]===i?a=t[1]:(a=o(`size-3.5 shrink-0`,i),t[0]=i,t[1]=a);let s;t[2]!==r||t[3]!==a?(s=(0,F.jsx)(r,{"aria-hidden":!0,className:a}),t[2]=r,t[3]=a,t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==s?(c=(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[s,n]}),t[5]=n,t[6]=s,t[7]=c):c=t[7],c}function oe(e){let t=(0,P.c)(5),{option:n}=e,{Icon:r,className:i}=R[n],a;t[0]===i?a=t[1]:(a=o(`size-4 shrink-0`,i),t[0]=i,t[1]=a);let s;return t[2]!==r||t[3]!==a?(s=(0,F.jsx)(r,{"aria-hidden":!0,className:a}),t[2]=r,t[3]=a,t[4]=s):s=t[4],s}var se=4,ce=new Set([`$schema`,`type`,`properties`,`required`]),z=new Set([`type`,`enum`,`pattern`,`format`,`items`,`description`,`properties`,`required`]);function B(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function le(e){return e===void 0?[]:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:null}function ue(e){if(Object.keys(e).some(e=>!z.has(e)))return!0;let t=e.items;if(t!==void 0){if(!B(t))return!0;let e=new Set([`enum`,`type`,`properties`,`required`,`description`]);if(Object.keys(t).some(t=>!e.has(t)))return!0}return!1}function de(e,t){return[...e.map(e=>typeof e==`string`?e:`[]`),t].join(`.`)}function fe(e){let t=(0,P.c)(28),{file:n}=e,{_:a}=i(),{data:o}=S(),s,c,l,u,d,f,p;if(t[0]!==a||t[1]!==o?.effective.plugins.frontmatter.schemas||t[2]!==n){let e=o?.effective.plugins.frontmatter.schemas.find(e=>e.file===n)?.schema,i=B(e)?Object.keys(e).filter(pe):[],m;t[10]!==a||t[11]!==n?(m={save:(e,t,r)=>{(async()=>{let i=await C(n,e,t,r);i.ok?T():b.error(i.errorDetail??a({id:`IQgeSn`}))})()},rename:(e,t,r)=>{(async()=>{let i=await E(n,e,t,r);i.ok?T():b.error(i.errorDetail??a({id:`kooyLJ`}))})()},remove:(e,t)=>{(async()=>{let r=await w(n,e,t);r.ok?T():b.error(r.errorDetail??a({id:`qC7PwZ`}))})()}},t[10]=a,t[11]=n,t[12]=m):m=t[12],c=m,u=`space-y-3`,d=`frontmatter-field-editor-${n}`,f=e===void 0&&(0,F.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,F.jsx)(r,{id:`ri6zS-`})}),t[13]!==n||t[14]!==i?(p=i.length>0&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`frontmatter-schema-root-preserved-${n}`,children:(0,F.jsx)(r,{id:`98FP1E`,values:{0:i.join(`, `)}})}),t[13]=n,t[14]=i,t[15]=p):p=t[15],s=me,l=B(e)?e:{},t[0]=a,t[1]=o?.effective.plugins.frontmatter.schemas,t[2]=n,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p}else s=t[3],c=t[4],l=t[5],u=t[6],d=t[7],f=t[8],p=t[9];let m;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(m=[],t[16]=m):m=t[16];let h=`frontmatter-add-field-${n}`,g;t[17]!==s||t[18]!==c||t[19]!==l||t[20]!==h?(g=(0,F.jsx)(s,{node:l,parentPath:m,depth:0,addInputId:h,ops:c}),t[17]=s,t[18]=c,t[19]=l,t[20]=h,t[21]=g):g=t[21];let _;return t[22]!==u||t[23]!==d||t[24]!==f||t[25]!==p||t[26]!==g?(_=(0,F.jsxs)(`div`,{className:u,"data-testid":d,children:[f,p,g]}),t[22]=u,t[23]=d,t[24]=f,t[25]=p,t[26]=g,t[27]=_):_=t[27],_}function pe(e){return!ce.has(e)}function me(e){let t=(0,P.c)(19),{node:n,parentPath:r,depth:i,addInputId:a,ops:o}=e,s;t[0]===n.properties?s=t[1]:(s=B(n.properties)?n.properties:{},t[0]=n.properties,t[1]=s);let c=s,l,u;if(t[2]!==i||t[3]!==n.required||t[4]!==o||t[5]!==r||t[6]!==c){let e=Array.isArray(n.required)?n.required.filter(he):[];l=`space-y-2`,u=Object.entries(c).map(t=>{let[n,a]=t;return(0,F.jsx)(V,{field:n,property:B(a)?a:{},isRequired:e.includes(n),parentPath:r,depth:i,ops:o},n)}),t[2]=i,t[3]=n.required,t[4]=o,t[5]=r,t[6]=c,t[7]=l,t[8]=u}else l=t[7],u=t[8];let d;t[9]!==o||t[10]!==r?(d=e=>o.save(e,{type:`string`},r),t[9]=o,t[10]=r,t[11]=d):d=t[11];let f;t[12]!==a||t[13]!==d?(f=(0,F.jsx)(ve,{inputId:a,onAdd:d}),t[12]=a,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==u||t[17]!==f?(p=(0,F.jsxs)(`div`,{className:l,children:[u,f]}),t[15]=l,t[16]=u,t[17]=f,t[18]=p):p=t[18],p}function he(e){return typeof e==`string`}function V(e){let t=(0,P.c)(172),{field:n,property:a,isRequired:o,parentPath:s,depth:d,ops:g}=e,{_}=i(),[v,b]=(0,re.useState)(!1),[x,S]=(0,re.useState)(!1),C;t[0]!==n||t[1]!==s?(C=de(s,n),t[0]=n,t[1]=s,t[2]=C):C=t[2];let w=C,T=typeof a.type==`string`&&I.includes(a.type)?a.type:void 0,E;t[3]===a.enum?E=t[4]:(E=le(a.enum),t[3]=a.enum,t[4]=E);let D=E,ee;t[5]===a.items?ee=t[6]:(ee=B(a.items)?a.items:{},t[5]=a.items,t[6]=ee);let O=ee,te;t[7]===O.enum?te=t[8]:(te=le(O.enum),t[7]=O.enum,t[8]=te);let A=te,ne=typeof a.pattern==`string`?a.pattern:``,j=typeof a.description==`string`?a.description:``,M;t[9]===a?M=t[10]:(M=ue(a),t[9]=a,t[10]=M);let N=M,R=T!==`array`&&D!==null&&(D.length>0||v),ae=T===`object`&&d<se,ce;t[11]===O.type?ce=t[12]:(ce=typeof O.type==`string`&&ie.includes(O.type)?O.type:void 0,t[11]=O.type,t[12]=ce);let z=ce,fe=z!==`object`&&A!==null&&(A.length>0||x),pe=T===`array`&&z===`object`&&d<se,he=`frontmatter-field-row-${w}`,V;t[13]!==R||t[14]!==T?(V=(R||T!==void 0)&&(0,F.jsx)(oe,{option:R?`enum`:T}),t[13]=R,t[14]=T,t[15]=V):V=t[15];let ve=`frontmatter-field-name-${w}`,H;t[16]===_?H=t[17]:(H=_({id:`nrXDdR`}),t[16]=_,t[17]=H);let U;t[18]!==n||t[19]!==g||t[20]!==s?(U=e=>{e!==``&&e!==n&&g.rename(n,e,s)},t[18]=n,t[19]=g,t[20]=s,t[21]=U):U=t[21];let W;t[22]!==n||t[23]!==H||t[24]!==U||t[25]!==ve?(W=(0,F.jsx)(ye,{id:ve,initial:n,ariaLabel:H,className:`h-7 w-36 shrink-0 font-mono text-sm font-medium`,onCommit:U}),t[22]=n,t[23]=H,t[24]=U,t[25]=ve,t[26]=W):W=t[26];let be=`frontmatter-field-description-${w}`,G;t[27]===_?G=t[28]:(G=_({id:`PGPGsL`}),t[27]=_,t[28]=G);let K;t[29]!==_||t[30]!==n?(K=_({id:`IFALcX`,values:{field:n}}),t[29]=_,t[30]=n,t[31]=K):K=t[31];let q;t[32]!==n||t[33]!==g||t[34]!==s?(q=e=>g.save(n,{description:e===``?null:e},s),t[32]=n,t[33]=g,t[34]=s,t[35]=q):q=t[35];let J;t[36]!==j||t[37]!==be||t[38]!==G||t[39]!==K||t[40]!==q?(J=(0,F.jsx)(ye,{id:be,initial:j,placeholder:G,ariaLabel:K,className:`h-7 min-w-0 flex-1`,onCommit:q}),t[36]=j,t[37]=be,t[38]=G,t[39]=K,t[40]=q,t[41]=J):J=t[41];let xe=`frontmatter-field-required-${w}`,Se;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,F.jsx)(r,{id:`TMLAx2`}),t[42]=Se):Se=t[42];let Y;t[43]===xe?Y=t[44]:(Y=(0,F.jsx)(l,{htmlFor:xe,className:`shrink-0 text-xs text-muted-foreground`,children:Se}),t[43]=xe,t[44]=Y);let Ce=`frontmatter-field-required-${w}`,X;t[45]!==n||t[46]!==g||t[47]!==s?(X=e=>g.save(n,{required:e},s),t[45]=n,t[46]=g,t[47]=s,t[48]=X):X=t[48];let we=`frontmatter-field-required-${w}`,Z;t[49]!==o||t[50]!==Ce||t[51]!==X||t[52]!==we?(Z=(0,F.jsx)(h,{id:Ce,checked:o,onCheckedChange:X,"data-testid":we}),t[49]=o,t[50]=Ce,t[51]=X,t[52]=we,t[53]=Z):Z=t[53];let Te;t[54]!==n||t[55]!==g||t[56]!==s?(Te=()=>g.remove(n,s),t[54]=n,t[55]=g,t[56]=s,t[57]=Te):Te=t[57];let Ee;t[58]!==_||t[59]!==n?(Ee=_({id:`bF22t6`,values:{field:n}}),t[58]=_,t[59]=n,t[60]=Ee):Ee=t[60];let De=`frontmatter-field-remove-${w}`,Oe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,F.jsx)(y,{"aria-hidden":!0,className:`size-4`}),t[61]=Oe):Oe=t[61];let ke;t[62]!==Te||t[63]!==Ee||t[64]!==De?(ke=(0,F.jsx)(c,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:Te,"aria-label":Ee,"data-testid":De,children:Oe}),t[62]=Te,t[63]=Ee,t[64]=De,t[65]=ke):ke=t[65];let Ae;t[66]!==W||t[67]!==J||t[68]!==Y||t[69]!==Z||t[70]!==ke||t[71]!==V?(Ae=(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[V,W,J,Y,Z,ke]}),t[66]=W,t[67]=J,t[68]=Y,t[69]=Z,t[70]=ke,t[71]=V,t[72]=Ae):Ae=t[72];let je;t[73]!==w||t[74]!==N?(je=N&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`frontmatter-field-preserved-${w}`,children:(0,F.jsx)(r,{id:`TdlVEN`})}),t[73]=w,t[74]=N,t[75]=je):je=t[75];let Me=`frontmatter-field-type-${w}`,Ne;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,F.jsx)(r,{id:`-zy2Nq`}),t[76]=Ne):Ne=t[76];let Pe;t[77]===Me?Pe=t[78]:(Pe=(0,F.jsx)(l,{className:`text-xs`,htmlFor:Me,children:Ne}),t[77]=Me,t[78]=Pe);let Fe=R?`enum`:T??``,Ie;t[79]!==D?.length||t[80]!==n||t[81]!==g||t[82]!==s||t[83]!==R||t[84]!==T?(Ie=e=>{if(e===`enum`){b(!0),T===void 0&&g.save(n,{type:`string`},s);return}b(!1);let t=R&&(D?.length??0)>0?{type:e,enum:null}:{type:e};g.save(n,t,s)},t[79]=D?.length,t[80]=n,t[81]=g,t[82]=s,t[83]=R,t[84]=T,t[85]=Ie):Ie=t[85];let Le=`frontmatter-field-type-${w}`,Re=`frontmatter-field-type-${w}`,Q;t[86]===_?Q=t[87]:(Q=_({id:`EkUnmS`}),t[86]=_,t[87]=Q);let ze;t[88]===Q?ze=t[89]:(ze=(0,F.jsx)(p,{placeholder:Q}),t[88]=Q,t[89]=ze);let Be;t[90]!==Le||t[91]!==Re||t[92]!==ze?(Be=(0,F.jsx)(u,{id:Le,"data-testid":Re,children:ze}),t[90]=Le,t[91]=Re,t[92]=ze,t[93]=Be):Be=t[93];let Ve;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,F.jsx)(m,{children:L.map(_e)}),t[94]=Ve):Ve=t[94];let He;t[95]!==Fe||t[96]!==Ie||t[97]!==Be?(He=(0,F.jsxs)(f,{value:Fe,onValueChange:Ie,children:[Be,Ve]}),t[95]=Fe,t[96]=Ie,t[97]=Be,t[98]=He):He=t[98];let Ue;t[99]!==Pe||t[100]!==He?(Ue=(0,F.jsxs)(`div`,{className:`space-y-1`,children:[Pe,He]}),t[99]=Pe,t[100]=He,t[101]=Ue):Ue=t[101];let We=`frontmatter-field-pattern-${w}`,Ge;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,F.jsx)(r,{id:`cstC0z`}),t[102]=Ge):Ge=t[102];let Ke;t[103]===We?Ke=t[104]:(Ke=(0,F.jsx)(l,{className:`text-xs`,htmlFor:We,children:Ge}),t[103]=We,t[104]=Ke);let qe=`frontmatter-field-pattern-${w}`,Je;t[105]!==n||t[106]!==g||t[107]!==s?(Je=e=>g.save(n,{pattern:e===``?null:e},s),t[105]=n,t[106]=g,t[107]=s,t[108]=Je):Je=t[108];let Ye;t[109]!==ne||t[110]!==qe||t[111]!==Je?(Ye=(0,F.jsx)(ye,{id:qe,initial:ne,onCommit:Je}),t[109]=ne,t[110]=qe,t[111]=Je,t[112]=Ye):Ye=t[112];let Xe;t[113]!==Ke||t[114]!==Ye?(Xe=(0,F.jsxs)(`div`,{className:`space-y-1`,children:[Ke,Ye]}),t[113]=Ke,t[114]=Ye,t[115]=Xe):Xe=t[115];let Ze;t[116]!==Ue||t[117]!==Xe?(Ze=(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[Ue,Xe]}),t[116]=Ue,t[117]=Xe,t[118]=Ze):Ze=t[118];let Qe;t[119]!==_||t[120]!==D||t[121]!==n||t[122]!==g||t[123]!==s||t[124]!==w||t[125]!==T?(Qe=T!==`array`&&T!==`object`&&D!==null&&(0,F.jsxs)(`div`,{className:`space-y-1`,children:[(0,F.jsx)(l,{className:`text-xs`,htmlFor:`frontmatter-field-enum-${w}`,children:(0,F.jsx)(r,{id:`UGeJuP`})}),(0,F.jsx)(k,{id:`frontmatter-field-enum-${w}`,value:D,grammar:`free-text`,onChange:e=>g.save(n,{enum:e.length===0?null:e},s),placeholder:_({id:`5tcmwY`}),"aria-label":_({id:`5qQr1u`,values:{field:n}})})]}),t[119]=_,t[120]=D,t[121]=n,t[122]=g,t[123]=s,t[124]=w,t[125]=T,t[126]=Qe):Qe=t[126];let $e;t[127]!==_||t[128]!==n||t[129]!==A?.length||t[130]!==z||t[131]!==g||t[132]!==s||t[133]!==w||t[134]!==fe||t[135]!==T?($e=T===`array`&&(0,F.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:(0,F.jsxs)(`div`,{className:`space-y-1`,children:[(0,F.jsx)(l,{className:`text-xs`,htmlFor:`frontmatter-field-items-type-${w}`,children:(0,F.jsx)(r,{id:`6pe_G5`})}),(0,F.jsxs)(f,{value:fe?`enum`:z??``,onValueChange:e=>{if(e===`enum`){S(!0),z===void 0&&g.save(n,{itemsType:`string`},s);return}S(!1);let t=fe&&(A?.length??0)>0?{itemsType:e,itemsEnum:null}:{itemsType:e};g.save(n,t,s)},children:[(0,F.jsx)(u,{id:`frontmatter-field-items-type-${w}`,"data-testid":`frontmatter-field-items-type-${w}`,children:(0,F.jsx)(p,{placeholder:_({id:`EkUnmS`})})}),(0,F.jsx)(m,{children:ie.map(ge)})]})]})}),t[127]=_,t[128]=n,t[129]=A?.length,t[130]=z,t[131]=g,t[132]=s,t[133]=w,t[134]=fe,t[135]=T,t[136]=$e):$e=t[136];let et;t[137]!==_||t[138]!==n||t[139]!==A||t[140]!==z||t[141]!==g||t[142]!==s||t[143]!==w||t[144]!==T?(et=T===`array`&&z!==`object`&&A!==null&&(0,F.jsxs)(`div`,{className:`space-y-1`,children:[(0,F.jsx)(l,{className:`text-xs`,htmlFor:`frontmatter-field-items-enum-${w}`,children:(0,F.jsx)(r,{id:`ezUmoU`})}),(0,F.jsx)(k,{id:`frontmatter-field-items-enum-${w}`,value:A,grammar:`free-text`,onChange:e=>g.save(n,{itemsEnum:e.length===0?null:e},s),placeholder:_({id:`5tcmwY`}),"aria-label":_({id:`e60wew`,values:{field:n}})})]}),t[137]=_,t[138]=n,t[139]=A,t[140]=z,t[141]=g,t[142]=s,t[143]=w,t[144]=T,t[145]=et):et=t[145];let tt;t[146]!==d||t[147]!==n||t[148]!==O||t[149]!==g||t[150]!==s||t[151]!==w||t[152]!==pe?(tt=pe&&(0,F.jsxs)(`div`,{className:`ml-2 space-y-1 border-l pl-3 pt-1`,"data-testid":`frontmatter-field-item-children-${w}`,children:[(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,F.jsx)(r,{id:`wU8WyK`})}),(0,F.jsx)(me,{node:O,parentPath:[...s,n,{items:!0}],depth:d+1,addInputId:`frontmatter-add-field-${w}.[]`,ops:g})]}),t[146]=d,t[147]=n,t[148]=O,t[149]=g,t[150]=s,t[151]=w,t[152]=pe,t[153]=tt):tt=t[153];let $;t[154]!==d||t[155]!==n||t[156]!==g||t[157]!==s||t[158]!==w||t[159]!==a||t[160]!==ae?($=ae&&(0,F.jsxs)(`div`,{className:`ml-2 space-y-1 border-l pl-3 pt-1`,"data-testid":`frontmatter-field-children-${w}`,children:[(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,F.jsx)(r,{id:`9nIrRp`})}),(0,F.jsx)(me,{node:a,parentPath:[...s,n],depth:d+1,addInputId:`frontmatter-add-field-${w}`,ops:g})]}),t[154]=d,t[155]=n,t[156]=g,t[157]=s,t[158]=w,t[159]=a,t[160]=ae,t[161]=$):$=t[161];let nt;return t[162]!==Ae||t[163]!==je||t[164]!==Ze||t[165]!==Qe||t[166]!==$e||t[167]!==et||t[168]!==tt||t[169]!==$||t[170]!==he?(nt=(0,F.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":he,children:[Ae,je,Ze,Qe,$e,et,tt,$]}),t[162]=Ae,t[163]=je,t[164]=Ze,t[165]=Qe,t[166]=$e,t[167]=et,t[168]=tt,t[169]=$,t[170]=he,t[171]=nt):nt=t[171],nt}function ge(e){return(0,F.jsx)(d,{value:e,children:(0,F.jsx)(ae,{option:e})},e)}function _e(e){return(0,F.jsx)(d,{value:e,children:(0,F.jsx)(ae,{option:e})},e)}function ve(e){let t=(0,P.c)(24),{inputId:n,onAdd:i}=e,[a,o]=(0,re.useState)(``),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(r,{id:`Va3xJe`}),t[0]=s):s=t[0];let u;t[1]===n?u=t[2]:(u=(0,F.jsx)(l,{htmlFor:n,className:`text-xs`,children:s}),t[1]=n,t[2]=u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>o(e.target.value),t[3]=d):d=t[3];let f=`${n}-input`,p;t[4]!==n||t[5]!==a||t[6]!==f?(p=(0,F.jsx)(x,{id:n,value:a,onChange:d,placeholder:`owner`,"data-testid":f}),t[4]=n,t[5]=a,t[6]=f,t[7]=p):p=t[7];let m;t[8]!==u||t[9]!==p?(m=(0,F.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[u,p]}),t[8]=u,t[9]=p,t[10]=m):m=t[10];let h;t[11]===a?h=t[12]:(h=a.trim(),t[11]=a,t[12]=h);let g=h===``,_;t[13]!==a||t[14]!==i?(_=()=>{i(a.trim()),o(``)},t[13]=a,t[14]=i,t[15]=_):_=t[15];let v=`${n}-save`,y;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,F.jsx)(r,{id:`m16xKo`}),t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==g||t[19]!==_?(b=(0,F.jsx)(c,{size:`sm`,variant:`outline`,disabled:g,onClick:_,"data-testid":v,children:y}),t[17]=v,t[18]=g,t[19]=_,t[20]=b):b=t[20];let S;return t[21]!==b||t[22]!==m?(S=(0,F.jsxs)(`div`,{className:`flex items-end gap-2`,children:[m,b]}),t[21]=b,t[22]=m,t[23]=S):S=t[23],S}function ye(e){let t=(0,P.c)(15),{id:n,initial:r,onCommit:i,placeholder:a,ariaLabel:o,className:s}=e,[c,l]=(0,re.useState)(r),u;t[0]!==c||t[1]!==r||t[2]!==i?(u=()=>{c.trim()!==r&&i(c.trim())},t[0]=c,t[1]=r,t[2]=i,t[3]=u):u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>l(e.target.value),t[4]=f):f=t[4];let p;t[5]===d?p=t[6]:(p=e=>{e.key===`Enter`&&d()},t[5]=d,t[6]=p);let m;return t[7]!==o||t[8]!==s||t[9]!==d||t[10]!==c||t[11]!==n||t[12]!==a||t[13]!==p?(m=(0,F.jsx)(x,{id:n,value:c,onChange:f,onBlur:d,onKeyDown:p,placeholder:a,"aria-label":o,className:s,"data-testid":n}),t[7]=o,t[8]=s,t[9]=d,t[10]=c,t[11]=n,t[12]=a,t[13]=p,t[14]=m):m=t[14],m}function H(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function U(e){let t=(0,P.c)(44),{assetPath:n}=e,{_:r}=i(),[a,o]=te(),s;t[0]===n?s=t[1]:(s=()=>ne(n)?`rules`:null,t[0]=n,t[1]=s);let[c,l]=(0,re.useState)(s),u=c??a,d;t[2]===o?d=t[3]:(d=e=>{l(e),o(e)},t[2]=o,t[3]=d);let f=d,{data:p}=S(),m;t[4]===p?.effective.plugins.frontmatter.schemas?m=t[5]:(m=p?.effective.plugins.frontmatter.schemas??[],t[4]=p?.effective.plugins.frontmatter.schemas,t[5]=m);let h;if(t[6]!==n||t[7]!==m){let e;t[9]===n?e=t[10]:(e=e=>e.file===n,t[9]=n,t[10]=e),h=m.some(e),t[6]=n,t[7]=m,t[8]=h}else h=t[8];let g=h,_=!g||u===`source`,v;t[11]===n?v=t[12]:(v=n.split(`/`).pop()??n,t[11]=n,t[12]=v);let y=v,b;t[13]===y?b=t[14]:(b=y.includes(`.`)?(y.split(`.`).pop()??``).toLowerCase():``,t[13]=y,t[14]=b);let x=b,C;t[15]===n?C=t[16]:(C=(0,F.jsx)(D,{entry:{kind:`asset`,path:n},className:`shrink-0 border-b bg-background px-3 py-1.5`}),t[15]=n,t[16]=C);let w;t[17]===f?w=t[18]:(w=e=>f(e===`source`?`source`:`rules`),t[17]=f,t[18]=w);let T=!g,E;t[19]===r?E=t[20]:(E=r({id:`vF68cg`}),t[19]=r,t[20]=E);let k;t[21]===r?k=t[22]:(k=r({id:`wdxz7K`}),t[21]=r,t[22]=k);let j;t[23]===r?j=t[24]:(j=r({id:`nc-ipN`}),t[23]=r,t[24]=j);let M;t[25]!==_||t[26]!==E||t[27]!==k||t[28]!==j||t[29]!==w||t[30]!==T?(M=(0,F.jsx)(O,{isSourceMode:_,onModeChange:w,wysiwygDisabled:T,wysiwygLabel:E,sourceLabel:k,wysiwygDisabledReason:j}),t[25]=_,t[26]=E,t[27]=k,t[28]=j,t[29]=w,t[30]=T,t[31]=M):M=t[31];let N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,F.jsx)(A,{className:`absolute left-3 top-1/2 -translate-y-1/2`}),t[32]=N):N=t[32];let I;t[33]===M?I=t[34]:(I=(0,F.jsxs)(`div`,{className:`relative flex shrink-0 items-center justify-center border-b bg-background py-2`,children:[M,N]}),t[33]=M,t[34]=I);let L;t[35]!==n||t[36]!==x||t[37]!==y||t[38]!==_?(L=_?(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,F.jsx)(ee,{src:H(n),fileName:y,extension:x},n)}):(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-6`,children:(0,F.jsx)(`div`,{className:`mx-auto w-full max-w-3xl`,children:(0,F.jsx)(fe,{file:n})})}),t[35]=n,t[36]=x,t[37]=y,t[38]=_,t[39]=L):L=t[39];let ie;return t[40]!==I||t[41]!==L||t[42]!==C?(ie=(0,F.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,"data-schema-config-editor":``,children:[C,I,L]}),t[40]=I,t[41]=L,t[42]=C,t[43]=ie):ie=t[43],ie}export{U as SchemaConfigEditor};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r,r as i}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{s as o,t as s}from"./createLucideIcon-DAkhoPjT.js";import{t as c}from"./button-Gol9BgNB.js";import{t as l}from"./label-DyipnO5I.js";import{a as u,i as d,n as f,o as p,r as m,t as h}from"./switch-DYic2V-1.js";import{t as g}from"./braces-DwnwFx_V.js";import{t as _}from"./case-sensitive-nl0tWMnZ.js";import{t as v}from"./hash-DNKDqZ18.js";import{t as y}from"./trash-2-BUuL4OCw.js";import{n as b}from"./dist-BLAMau9Z.js";import{t as x}from"./input-D0ZW0Opq.js";import{d as S,f as C,o as w,r as T,s as E}from"./lint-config-client-G_mrikOJ.js";import{n as D,r as ee,t as O}from"./EditorModeToggle-DeKVTMB4.js";import{t as k}from"./tag-pill-input-B27HgfRy.js";import{t as te}from"./useLintConfigViewMode-BYm6FwC5.js";import{r as A,t as ne}from"./schema-fields-view-intent-Dz1ZzVCe.js";var j=s(`brackets`,[[`path`,{d:`M16 3h3a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1h-3`,key:`1kt8lf`}],[`path`,{d:`M8 21H5a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h3`,key:`gduv9`}]]),M=s(`list-checks`,[[`path`,{d:`M13 5h8`,key:`a7qcls`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 19h8`,key:`c3s6r1`}],[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}]]),N=s(`toggle-left`,[[`circle`,{cx:`9`,cy:`12`,r:`3`,key:`u3jwor`}],[`rect`,{width:`20`,height:`14`,x:`2`,y:`5`,rx:`7`,key:`g7kal2`}]]),P=a(),re=e(n(),1),F=t(),I=[`string`,`number`,`boolean`,`array`,`object`],L=[`string`,`number`,`boolean`,`enum`,`array`,`object`],ie=[`string`,`number`,`boolean`,`enum`,`object`],R={string:{Icon:_,className:`text-green-500`},number:{Icon:v,className:`text-blue-500`},boolean:{Icon:N,className:`text-orange-500`},enum:{Icon:M,className:`text-yellow-500`},array:{Icon:j,className:`text-pink-500`},object:{Icon:g,className:`text-purple-500`}};function ae(e){let t=(0,P.c)(8),{option:n}=e,{Icon:r,className:i}=R[n],a;t[0]===i?a=t[1]:(a=o(`size-3.5 shrink-0`,i),t[0]=i,t[1]=a);let s;t[2]!==r||t[3]!==a?(s=(0,F.jsx)(r,{"aria-hidden":!0,className:a}),t[2]=r,t[3]=a,t[4]=s):s=t[4];let c;return t[5]!==n||t[6]!==s?(c=(0,F.jsxs)(`span`,{className:`flex items-center gap-2`,children:[s,n]}),t[5]=n,t[6]=s,t[7]=c):c=t[7],c}function oe(e){let t=(0,P.c)(5),{option:n}=e,{Icon:r,className:i}=R[n],a;t[0]===i?a=t[1]:(a=o(`size-4 shrink-0`,i),t[0]=i,t[1]=a);let s;return t[2]!==r||t[3]!==a?(s=(0,F.jsx)(r,{"aria-hidden":!0,className:a}),t[2]=r,t[3]=a,t[4]=s):s=t[4],s}var se=4,ce=new Set([`$schema`,`type`,`properties`,`required`]),z=new Set([`type`,`enum`,`pattern`,`format`,`items`,`description`,`properties`,`required`]);function B(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function le(e){return e===void 0?[]:Array.isArray(e)&&e.every(e=>typeof e==`string`)?e:null}function ue(e){if(Object.keys(e).some(e=>!z.has(e)))return!0;let t=e.items;if(t!==void 0){if(!B(t))return!0;let e=new Set([`enum`,`type`,`properties`,`required`,`description`]);if(Object.keys(t).some(t=>!e.has(t)))return!0}return!1}function de(e,t){return[...e.map(e=>typeof e==`string`?e:`[]`),t].join(`.`)}function fe(e){let t=(0,P.c)(28),{file:n}=e,{_:a}=i(),{data:o}=S(),s,c,l,u,d,f,p;if(t[0]!==a||t[1]!==o?.effective.plugins.frontmatter.schemas||t[2]!==n){let e=o?.effective.plugins.frontmatter.schemas.find(e=>e.file===n)?.schema,i=B(e)?Object.keys(e).filter(pe):[],m;t[10]!==a||t[11]!==n?(m={save:(e,t,r)=>{(async()=>{let i=await C(n,e,t,r);i.ok?T():b.error(i.errorDetail??a({id:`IQgeSn`}))})()},rename:(e,t,r)=>{(async()=>{let i=await E(n,e,t,r);i.ok?T():b.error(i.errorDetail??a({id:`kooyLJ`}))})()},remove:(e,t)=>{(async()=>{let r=await w(n,e,t);r.ok?T():b.error(r.errorDetail??a({id:`qC7PwZ`}))})()}},t[10]=a,t[11]=n,t[12]=m):m=t[12],c=m,u=`space-y-3`,d=`frontmatter-field-editor-${n}`,f=e===void 0&&(0,F.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,F.jsx)(r,{id:`ri6zS-`})}),t[13]!==n||t[14]!==i?(p=i.length>0&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`frontmatter-schema-root-preserved-${n}`,children:(0,F.jsx)(r,{id:`98FP1E`,values:{0:i.join(`, `)}})}),t[13]=n,t[14]=i,t[15]=p):p=t[15],s=me,l=B(e)?e:{},t[0]=a,t[1]=o?.effective.plugins.frontmatter.schemas,t[2]=n,t[3]=s,t[4]=c,t[5]=l,t[6]=u,t[7]=d,t[8]=f,t[9]=p}else s=t[3],c=t[4],l=t[5],u=t[6],d=t[7],f=t[8],p=t[9];let m;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(m=[],t[16]=m):m=t[16];let h=`frontmatter-add-field-${n}`,g;t[17]!==s||t[18]!==c||t[19]!==l||t[20]!==h?(g=(0,F.jsx)(s,{node:l,parentPath:m,depth:0,addInputId:h,ops:c}),t[17]=s,t[18]=c,t[19]=l,t[20]=h,t[21]=g):g=t[21];let _;return t[22]!==u||t[23]!==d||t[24]!==f||t[25]!==p||t[26]!==g?(_=(0,F.jsxs)(`div`,{className:u,"data-testid":d,children:[f,p,g]}),t[22]=u,t[23]=d,t[24]=f,t[25]=p,t[26]=g,t[27]=_):_=t[27],_}function pe(e){return!ce.has(e)}function me(e){let t=(0,P.c)(19),{node:n,parentPath:r,depth:i,addInputId:a,ops:o}=e,s;t[0]===n.properties?s=t[1]:(s=B(n.properties)?n.properties:{},t[0]=n.properties,t[1]=s);let c=s,l,u;if(t[2]!==i||t[3]!==n.required||t[4]!==o||t[5]!==r||t[6]!==c){let e=Array.isArray(n.required)?n.required.filter(he):[];l=`space-y-2`,u=Object.entries(c).map(t=>{let[n,a]=t;return(0,F.jsx)(V,{field:n,property:B(a)?a:{},isRequired:e.includes(n),parentPath:r,depth:i,ops:o},n)}),t[2]=i,t[3]=n.required,t[4]=o,t[5]=r,t[6]=c,t[7]=l,t[8]=u}else l=t[7],u=t[8];let d;t[9]!==o||t[10]!==r?(d=e=>o.save(e,{type:`string`},r),t[9]=o,t[10]=r,t[11]=d):d=t[11];let f;t[12]!==a||t[13]!==d?(f=(0,F.jsx)(ve,{inputId:a,onAdd:d}),t[12]=a,t[13]=d,t[14]=f):f=t[14];let p;return t[15]!==l||t[16]!==u||t[17]!==f?(p=(0,F.jsxs)(`div`,{className:l,children:[u,f]}),t[15]=l,t[16]=u,t[17]=f,t[18]=p):p=t[18],p}function he(e){return typeof e==`string`}function V(e){let t=(0,P.c)(172),{field:n,property:a,isRequired:o,parentPath:s,depth:d,ops:g}=e,{_}=i(),[v,b]=(0,re.useState)(!1),[x,S]=(0,re.useState)(!1),C;t[0]!==n||t[1]!==s?(C=de(s,n),t[0]=n,t[1]=s,t[2]=C):C=t[2];let w=C,T=typeof a.type==`string`&&I.includes(a.type)?a.type:void 0,E;t[3]===a.enum?E=t[4]:(E=le(a.enum),t[3]=a.enum,t[4]=E);let D=E,ee;t[5]===a.items?ee=t[6]:(ee=B(a.items)?a.items:{},t[5]=a.items,t[6]=ee);let O=ee,te;t[7]===O.enum?te=t[8]:(te=le(O.enum),t[7]=O.enum,t[8]=te);let A=te,ne=typeof a.pattern==`string`?a.pattern:``,j=typeof a.description==`string`?a.description:``,M;t[9]===a?M=t[10]:(M=ue(a),t[9]=a,t[10]=M);let N=M,R=T!==`array`&&D!==null&&(D.length>0||v),ae=T===`object`&&d<se,ce;t[11]===O.type?ce=t[12]:(ce=typeof O.type==`string`&&ie.includes(O.type)?O.type:void 0,t[11]=O.type,t[12]=ce);let z=ce,fe=z!==`object`&&A!==null&&(A.length>0||x),pe=T===`array`&&z===`object`&&d<se,he=`frontmatter-field-row-${w}`,V;t[13]!==R||t[14]!==T?(V=(R||T!==void 0)&&(0,F.jsx)(oe,{option:R?`enum`:T}),t[13]=R,t[14]=T,t[15]=V):V=t[15];let ve=`frontmatter-field-name-${w}`,H;t[16]===_?H=t[17]:(H=_({id:`nrXDdR`}),t[16]=_,t[17]=H);let U;t[18]!==n||t[19]!==g||t[20]!==s?(U=e=>{e!==``&&e!==n&&g.rename(n,e,s)},t[18]=n,t[19]=g,t[20]=s,t[21]=U):U=t[21];let W;t[22]!==n||t[23]!==H||t[24]!==U||t[25]!==ve?(W=(0,F.jsx)(ye,{id:ve,initial:n,ariaLabel:H,className:`h-7 w-36 shrink-0 font-mono text-sm font-medium`,onCommit:U}),t[22]=n,t[23]=H,t[24]=U,t[25]=ve,t[26]=W):W=t[26];let be=`frontmatter-field-description-${w}`,G;t[27]===_?G=t[28]:(G=_({id:`PGPGsL`}),t[27]=_,t[28]=G);let K;t[29]!==_||t[30]!==n?(K=_({id:`IFALcX`,values:{field:n}}),t[29]=_,t[30]=n,t[31]=K):K=t[31];let q;t[32]!==n||t[33]!==g||t[34]!==s?(q=e=>g.save(n,{description:e===``?null:e},s),t[32]=n,t[33]=g,t[34]=s,t[35]=q):q=t[35];let J;t[36]!==j||t[37]!==be||t[38]!==G||t[39]!==K||t[40]!==q?(J=(0,F.jsx)(ye,{id:be,initial:j,placeholder:G,ariaLabel:K,className:`h-7 min-w-0 flex-1`,onCommit:q}),t[36]=j,t[37]=be,t[38]=G,t[39]=K,t[40]=q,t[41]=J):J=t[41];let xe=`frontmatter-field-required-${w}`,Se;t[42]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,F.jsx)(r,{id:`TMLAx2`}),t[42]=Se):Se=t[42];let Y;t[43]===xe?Y=t[44]:(Y=(0,F.jsx)(l,{htmlFor:xe,className:`shrink-0 text-xs text-muted-foreground`,children:Se}),t[43]=xe,t[44]=Y);let Ce=`frontmatter-field-required-${w}`,X;t[45]!==n||t[46]!==g||t[47]!==s?(X=e=>g.save(n,{required:e},s),t[45]=n,t[46]=g,t[47]=s,t[48]=X):X=t[48];let we=`frontmatter-field-required-${w}`,Z;t[49]!==o||t[50]!==Ce||t[51]!==X||t[52]!==we?(Z=(0,F.jsx)(h,{id:Ce,checked:o,onCheckedChange:X,"data-testid":we}),t[49]=o,t[50]=Ce,t[51]=X,t[52]=we,t[53]=Z):Z=t[53];let Te;t[54]!==n||t[55]!==g||t[56]!==s?(Te=()=>g.remove(n,s),t[54]=n,t[55]=g,t[56]=s,t[57]=Te):Te=t[57];let Ee;t[58]!==_||t[59]!==n?(Ee=_({id:`bF22t6`,values:{field:n}}),t[58]=_,t[59]=n,t[60]=Ee):Ee=t[60];let De=`frontmatter-field-remove-${w}`,Oe;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Oe=(0,F.jsx)(y,{"aria-hidden":!0,className:`size-4`}),t[61]=Oe):Oe=t[61];let ke;t[62]!==Te||t[63]!==Ee||t[64]!==De?(ke=(0,F.jsx)(c,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:Te,"aria-label":Ee,"data-testid":De,children:Oe}),t[62]=Te,t[63]=Ee,t[64]=De,t[65]=ke):ke=t[65];let Ae;t[66]!==W||t[67]!==J||t[68]!==Y||t[69]!==Z||t[70]!==ke||t[71]!==V?(Ae=(0,F.jsxs)(`div`,{className:`flex items-center gap-2`,children:[V,W,J,Y,Z,ke]}),t[66]=W,t[67]=J,t[68]=Y,t[69]=Z,t[70]=ke,t[71]=V,t[72]=Ae):Ae=t[72];let je;t[73]!==w||t[74]!==N?(je=N&&(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`frontmatter-field-preserved-${w}`,children:(0,F.jsx)(r,{id:`TdlVEN`})}),t[73]=w,t[74]=N,t[75]=je):je=t[75];let Me=`frontmatter-field-type-${w}`,Ne;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(Ne=(0,F.jsx)(r,{id:`-zy2Nq`}),t[76]=Ne):Ne=t[76];let Pe;t[77]===Me?Pe=t[78]:(Pe=(0,F.jsx)(l,{className:`text-xs`,htmlFor:Me,children:Ne}),t[77]=Me,t[78]=Pe);let Fe=R?`enum`:T??``,Ie;t[79]!==D?.length||t[80]!==n||t[81]!==g||t[82]!==s||t[83]!==R||t[84]!==T?(Ie=e=>{if(e===`enum`){b(!0),T===void 0&&g.save(n,{type:`string`},s);return}b(!1);let t=R&&(D?.length??0)>0?{type:e,enum:null}:{type:e};g.save(n,t,s)},t[79]=D?.length,t[80]=n,t[81]=g,t[82]=s,t[83]=R,t[84]=T,t[85]=Ie):Ie=t[85];let Le=`frontmatter-field-type-${w}`,Re=`frontmatter-field-type-${w}`,Q;t[86]===_?Q=t[87]:(Q=_({id:`EkUnmS`}),t[86]=_,t[87]=Q);let ze;t[88]===Q?ze=t[89]:(ze=(0,F.jsx)(p,{placeholder:Q}),t[88]=Q,t[89]=ze);let Be;t[90]!==Le||t[91]!==Re||t[92]!==ze?(Be=(0,F.jsx)(u,{id:Le,"data-testid":Re,children:ze}),t[90]=Le,t[91]=Re,t[92]=ze,t[93]=Be):Be=t[93];let Ve;t[94]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,F.jsx)(m,{children:L.map(_e)}),t[94]=Ve):Ve=t[94];let He;t[95]!==Fe||t[96]!==Ie||t[97]!==Be?(He=(0,F.jsxs)(f,{value:Fe,onValueChange:Ie,children:[Be,Ve]}),t[95]=Fe,t[96]=Ie,t[97]=Be,t[98]=He):He=t[98];let Ue;t[99]!==Pe||t[100]!==He?(Ue=(0,F.jsxs)(`div`,{className:`space-y-1`,children:[Pe,He]}),t[99]=Pe,t[100]=He,t[101]=Ue):Ue=t[101];let We=`frontmatter-field-pattern-${w}`,Ge;t[102]===Symbol.for(`react.memo_cache_sentinel`)?(Ge=(0,F.jsx)(r,{id:`cstC0z`}),t[102]=Ge):Ge=t[102];let Ke;t[103]===We?Ke=t[104]:(Ke=(0,F.jsx)(l,{className:`text-xs`,htmlFor:We,children:Ge}),t[103]=We,t[104]=Ke);let qe=`frontmatter-field-pattern-${w}`,Je;t[105]!==n||t[106]!==g||t[107]!==s?(Je=e=>g.save(n,{pattern:e===``?null:e},s),t[105]=n,t[106]=g,t[107]=s,t[108]=Je):Je=t[108];let Ye;t[109]!==ne||t[110]!==qe||t[111]!==Je?(Ye=(0,F.jsx)(ye,{id:qe,initial:ne,onCommit:Je}),t[109]=ne,t[110]=qe,t[111]=Je,t[112]=Ye):Ye=t[112];let Xe;t[113]!==Ke||t[114]!==Ye?(Xe=(0,F.jsxs)(`div`,{className:`space-y-1`,children:[Ke,Ye]}),t[113]=Ke,t[114]=Ye,t[115]=Xe):Xe=t[115];let Ze;t[116]!==Ue||t[117]!==Xe?(Ze=(0,F.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[Ue,Xe]}),t[116]=Ue,t[117]=Xe,t[118]=Ze):Ze=t[118];let Qe;t[119]!==_||t[120]!==D||t[121]!==n||t[122]!==g||t[123]!==s||t[124]!==w||t[125]!==T?(Qe=T!==`array`&&T!==`object`&&D!==null&&(0,F.jsxs)(`div`,{className:`space-y-1`,children:[(0,F.jsx)(l,{className:`text-xs`,htmlFor:`frontmatter-field-enum-${w}`,children:(0,F.jsx)(r,{id:`UGeJuP`})}),(0,F.jsx)(k,{id:`frontmatter-field-enum-${w}`,value:D,grammar:`free-text`,onChange:e=>g.save(n,{enum:e.length===0?null:e},s),placeholder:_({id:`5tcmwY`}),"aria-label":_({id:`5qQr1u`,values:{field:n}})})]}),t[119]=_,t[120]=D,t[121]=n,t[122]=g,t[123]=s,t[124]=w,t[125]=T,t[126]=Qe):Qe=t[126];let $e;t[127]!==_||t[128]!==n||t[129]!==A?.length||t[130]!==z||t[131]!==g||t[132]!==s||t[133]!==w||t[134]!==fe||t[135]!==T?($e=T===`array`&&(0,F.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:(0,F.jsxs)(`div`,{className:`space-y-1`,children:[(0,F.jsx)(l,{className:`text-xs`,htmlFor:`frontmatter-field-items-type-${w}`,children:(0,F.jsx)(r,{id:`6pe_G5`})}),(0,F.jsxs)(f,{value:fe?`enum`:z??``,onValueChange:e=>{if(e===`enum`){S(!0),z===void 0&&g.save(n,{itemsType:`string`},s);return}S(!1);let t=fe&&(A?.length??0)>0?{itemsType:e,itemsEnum:null}:{itemsType:e};g.save(n,t,s)},children:[(0,F.jsx)(u,{id:`frontmatter-field-items-type-${w}`,"data-testid":`frontmatter-field-items-type-${w}`,children:(0,F.jsx)(p,{placeholder:_({id:`EkUnmS`})})}),(0,F.jsx)(m,{children:ie.map(ge)})]})]})}),t[127]=_,t[128]=n,t[129]=A?.length,t[130]=z,t[131]=g,t[132]=s,t[133]=w,t[134]=fe,t[135]=T,t[136]=$e):$e=t[136];let et;t[137]!==_||t[138]!==n||t[139]!==A||t[140]!==z||t[141]!==g||t[142]!==s||t[143]!==w||t[144]!==T?(et=T===`array`&&z!==`object`&&A!==null&&(0,F.jsxs)(`div`,{className:`space-y-1`,children:[(0,F.jsx)(l,{className:`text-xs`,htmlFor:`frontmatter-field-items-enum-${w}`,children:(0,F.jsx)(r,{id:`ezUmoU`})}),(0,F.jsx)(k,{id:`frontmatter-field-items-enum-${w}`,value:A,grammar:`free-text`,onChange:e=>g.save(n,{itemsEnum:e.length===0?null:e},s),placeholder:_({id:`5tcmwY`}),"aria-label":_({id:`e60wew`,values:{field:n}})})]}),t[137]=_,t[138]=n,t[139]=A,t[140]=z,t[141]=g,t[142]=s,t[143]=w,t[144]=T,t[145]=et):et=t[145];let tt;t[146]!==d||t[147]!==n||t[148]!==O||t[149]!==g||t[150]!==s||t[151]!==w||t[152]!==pe?(tt=pe&&(0,F.jsxs)(`div`,{className:`ml-2 space-y-1 border-l pl-3 pt-1`,"data-testid":`frontmatter-field-item-children-${w}`,children:[(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,F.jsx)(r,{id:`wU8WyK`})}),(0,F.jsx)(me,{node:O,parentPath:[...s,n,{items:!0}],depth:d+1,addInputId:`frontmatter-add-field-${w}.[]`,ops:g})]}),t[146]=d,t[147]=n,t[148]=O,t[149]=g,t[150]=s,t[151]=w,t[152]=pe,t[153]=tt):tt=t[153];let $;t[154]!==d||t[155]!==n||t[156]!==g||t[157]!==s||t[158]!==w||t[159]!==a||t[160]!==ae?($=ae&&(0,F.jsxs)(`div`,{className:`ml-2 space-y-1 border-l pl-3 pt-1`,"data-testid":`frontmatter-field-children-${w}`,children:[(0,F.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,F.jsx)(r,{id:`9nIrRp`})}),(0,F.jsx)(me,{node:a,parentPath:[...s,n],depth:d+1,addInputId:`frontmatter-add-field-${w}`,ops:g})]}),t[154]=d,t[155]=n,t[156]=g,t[157]=s,t[158]=w,t[159]=a,t[160]=ae,t[161]=$):$=t[161];let nt;return t[162]!==Ae||t[163]!==je||t[164]!==Ze||t[165]!==Qe||t[166]!==$e||t[167]!==et||t[168]!==tt||t[169]!==$||t[170]!==he?(nt=(0,F.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":he,children:[Ae,je,Ze,Qe,$e,et,tt,$]}),t[162]=Ae,t[163]=je,t[164]=Ze,t[165]=Qe,t[166]=$e,t[167]=et,t[168]=tt,t[169]=$,t[170]=he,t[171]=nt):nt=t[171],nt}function ge(e){return(0,F.jsx)(d,{value:e,children:(0,F.jsx)(ae,{option:e})},e)}function _e(e){return(0,F.jsx)(d,{value:e,children:(0,F.jsx)(ae,{option:e})},e)}function ve(e){let t=(0,P.c)(24),{inputId:n,onAdd:i}=e,[a,o]=(0,re.useState)(``),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,F.jsx)(r,{id:`Va3xJe`}),t[0]=s):s=t[0];let u;t[1]===n?u=t[2]:(u=(0,F.jsx)(l,{htmlFor:n,className:`text-xs`,children:s}),t[1]=n,t[2]=u);let d;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(d=e=>o(e.target.value),t[3]=d):d=t[3];let f=`${n}-input`,p;t[4]!==n||t[5]!==a||t[6]!==f?(p=(0,F.jsx)(x,{id:n,value:a,onChange:d,placeholder:`owner`,"data-testid":f}),t[4]=n,t[5]=a,t[6]=f,t[7]=p):p=t[7];let m;t[8]!==u||t[9]!==p?(m=(0,F.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[u,p]}),t[8]=u,t[9]=p,t[10]=m):m=t[10];let h;t[11]===a?h=t[12]:(h=a.trim(),t[11]=a,t[12]=h);let g=h===``,_;t[13]!==a||t[14]!==i?(_=()=>{i(a.trim()),o(``)},t[13]=a,t[14]=i,t[15]=_):_=t[15];let v=`${n}-save`,y;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,F.jsx)(r,{id:`m16xKo`}),t[16]=y):y=t[16];let b;t[17]!==v||t[18]!==g||t[19]!==_?(b=(0,F.jsx)(c,{size:`sm`,variant:`outline`,disabled:g,onClick:_,"data-testid":v,children:y}),t[17]=v,t[18]=g,t[19]=_,t[20]=b):b=t[20];let S;return t[21]!==b||t[22]!==m?(S=(0,F.jsxs)(`div`,{className:`flex items-end gap-2`,children:[m,b]}),t[21]=b,t[22]=m,t[23]=S):S=t[23],S}function ye(e){let t=(0,P.c)(15),{id:n,initial:r,onCommit:i,placeholder:a,ariaLabel:o,className:s}=e,[c,l]=(0,re.useState)(r),u;t[0]!==c||t[1]!==r||t[2]!==i?(u=()=>{c.trim()!==r&&i(c.trim())},t[0]=c,t[1]=r,t[2]=i,t[3]=u):u=t[3];let d=u,f;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(f=e=>l(e.target.value),t[4]=f):f=t[4];let p;t[5]===d?p=t[6]:(p=e=>{e.key===`Enter`&&d()},t[5]=d,t[6]=p);let m;return t[7]!==o||t[8]!==s||t[9]!==d||t[10]!==c||t[11]!==n||t[12]!==a||t[13]!==p?(m=(0,F.jsx)(x,{id:n,value:c,onChange:f,onBlur:d,onKeyDown:p,placeholder:a,"aria-label":o,className:s,"data-testid":n}),t[7]=o,t[8]=s,t[9]=d,t[10]=c,t[11]=n,t[12]=a,t[13]=p,t[14]=m):m=t[14],m}function H(e){return`/api/asset-text?path=${encodeURIComponent(e)}`}function U(e){let t=(0,P.c)(44),{assetPath:n}=e,{_:r}=i(),[a,o]=te(),s;t[0]===n?s=t[1]:(s=()=>ne(n)?`rules`:null,t[0]=n,t[1]=s);let[c,l]=(0,re.useState)(s),u=c??a,d;t[2]===o?d=t[3]:(d=e=>{l(e),o(e)},t[2]=o,t[3]=d);let f=d,{data:p}=S(),m;t[4]===p?.effective.plugins.frontmatter.schemas?m=t[5]:(m=p?.effective.plugins.frontmatter.schemas??[],t[4]=p?.effective.plugins.frontmatter.schemas,t[5]=m);let h;if(t[6]!==n||t[7]!==m){let e;t[9]===n?e=t[10]:(e=e=>e.file===n,t[9]=n,t[10]=e),h=m.some(e),t[6]=n,t[7]=m,t[8]=h}else h=t[8];let g=h,_=!g||u===`source`,v;t[11]===n?v=t[12]:(v=n.split(`/`).pop()??n,t[11]=n,t[12]=v);let y=v,b;t[13]===y?b=t[14]:(b=y.includes(`.`)?(y.split(`.`).pop()??``).toLowerCase():``,t[13]=y,t[14]=b);let x=b,C;t[15]===n?C=t[16]:(C=(0,F.jsx)(D,{entry:{kind:`asset`,path:n},className:`shrink-0 border-b bg-background px-3 py-1.5`}),t[15]=n,t[16]=C);let w;t[17]===f?w=t[18]:(w=e=>f(e===`source`?`source`:`rules`),t[17]=f,t[18]=w);let T=!g,E;t[19]===r?E=t[20]:(E=r({id:`vF68cg`}),t[19]=r,t[20]=E);let k;t[21]===r?k=t[22]:(k=r({id:`wdxz7K`}),t[21]=r,t[22]=k);let j;t[23]===r?j=t[24]:(j=r({id:`nc-ipN`}),t[23]=r,t[24]=j);let M;t[25]!==_||t[26]!==E||t[27]!==k||t[28]!==j||t[29]!==w||t[30]!==T?(M=(0,F.jsx)(O,{isSourceMode:_,onModeChange:w,wysiwygDisabled:T,wysiwygLabel:E,sourceLabel:k,wysiwygDisabledReason:j}),t[25]=_,t[26]=E,t[27]=k,t[28]=j,t[29]=w,t[30]=T,t[31]=M):M=t[31];let N;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,F.jsx)(A,{className:`absolute left-3 top-1/2 -translate-y-1/2`}),t[32]=N):N=t[32];let I;t[33]===M?I=t[34]:(I=(0,F.jsxs)(`div`,{className:`relative flex shrink-0 items-center justify-center border-b bg-background py-2`,children:[M,N]}),t[33]=M,t[34]=I);let L;t[35]!==n||t[36]!==x||t[37]!==y||t[38]!==_?(L=_?(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:(0,F.jsx)(ee,{src:H(n),fileName:y,extension:x},n)}):(0,F.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-6`,children:(0,F.jsx)(`div`,{className:`mx-auto w-full max-w-3xl`,children:(0,F.jsx)(fe,{file:n})})}),t[35]=n,t[36]=x,t[37]=y,t[38]=_,t[39]=L):L=t[39];let ie;return t[40]!==I||t[41]!==L||t[42]!==C?(ie=(0,F.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col bg-background`,"data-schema-config-editor":``,children:[C,I,L]}),t[40]=I,t[41]=L,t[42]=C,t[43]=ie):ie=t[43],ie}export{U as SchemaConfigEditor};
@@ -1,4 +1,4 @@
1
- import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{Tt as r,et as i,qt as a}from"./DocumentContext-B8Qoku71.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./useQuery-ZeEDLtxh.js";import{n as u}from"./dist-PQ5KMVDh.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{a as f,c as p,l as m,s as h}from"./terminal-input-events-C5UuEsAB.js";import{s as g,t as _}from"./createLucideIcon-DAkhoPjT.js";import{t as v}from"./button-Gol9BgNB.js";import{i as y,n as b,t as x}from"./tooltip-B4J7VHmA.js";import{n as S,r as C,t as w}from"./collapsible-B1mS1n9y.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./dialog-TkFkuYVg.js";import{t as N}from"./checkbox-DY-vIhnZ.js";import{m as P,r as F,t as I}from"./dropdown-menu-xw8WTdb-.js";import{t as L}from"./label-DyipnO5I.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./switch-DYic2V-1.js";import{i as W,n as G,r as K,t as ee}from"./radio-group-CGEdWasQ.js";import{t as q}from"./separator-DExEeoYE.js";import{n as te,t as ne}from"./toggle-group-CjXmmTGy.js";import{C as J,a as Y,b as re,c as ie,d as ae,f as oe,h as se,l as ce,n as le,o as ue,r as de,s as fe,t as pe,u as me,y as he}from"./agent-visibility-HpfSUFqP.js";import{i as ge}from"./terminal-telemetry-DxTZB2oZ.js";import{Aa as _e,F as ve,Fa as ye,Ft as be,Ga as xe,Ha as Se,Ia as Ce,Ma as we,Na as Te,Oa as Ee,P as De,Rt as Oe,Ta as ke,Ua as Ae,Wa as je,_a as Me,_t as Ne,b as Pe,ba as Fe,ei as Ie,et as Le,ii as Re,pr as ze,pt as Be,v as Ve,ya as He,za as Ue,zt as We}from"./dist-Cal4LUep.js";import{a as Ge,c as Ke,d as qe,s as Je,t as Ye}from"./EnableSyncConfirmDialog-BQeXrhKR.js";import{t as Xe}from"./arrow-up-right-obRIg3Sv.js";import{t as Ze}from"./RegisteredAgentIcon-8Tcfr3WP.js";import{t as Qe}from"./check-GqWaoTdV.js";import{t as $e}from"./chevron-right-C8oTR6gu.js";import{i as et}from"./prop-types-B-N3_i3c.js";import{C as tt,S as nt,b as rt,c as it,h as at,i as ot,l as st,o as ct,r as lt,t as ut,v as dt,y as ft}from"./skill-actions-C_5-d4BC.js";import{A as pt,F as mt,G as ht,I as gt,M as _t,N as vt,P as yt,S as bt,U as xt,V as St,_ as Ct,b as wt,c as Tt,d as Et,f as Dt,g as Ot,h as kt,i as At,k as jt,l as Mt,m as Nt,n as Pt,o as Ft,p as It,u as Lt,x as Rt,y as zt,z as Bt}from"./auth-state-cache-BUB32hpt.js";import{i as Vt,l as Ht,r as Ut,s as Wt}from"./workspace-paths-B-NChZS2.js";import{t as Gt}from"./square-pen-C1vIlMAW.js";import{c as Kt,n as qt,t as Jt}from"./open-managed-artifact-tab-DfGutPkc.js";import{t as Yt}from"./info-yKMseklR.js";import{t as Xt}from"./loader-circle-Cg5SU7AZ.js";import{c as Zt,i as Qt}from"./field-DVIFAnvR.js";import{t as $t}from"./sliders-horizontal-34K0eDW2.js";import{t as en}from"./trash-2-BUuL4OCw.js";import{t as tn}from"./triangle-alert-Clgvyc7B.js";import{t as nn}from"./x-DVkpYo5d.js";import{n as X}from"./dist-BLAMau9Z.js";import{t as rn}from"./ConfigSharingInfoTooltip-DMbsfWD9.js";import{t as an}from"./input-D0ZW0Opq.js";import{c as on,d as sn,i as cn,l as ln,m as un,o as dn,s as fn}from"./use-settings-route-CXFzIfYo.js";import{t as pn}from"./parse-api-error-C_gwkKmG.js";import{i as mn}from"./documents-events-1HWCdfoh.js";import{o as hn}from"./doc-hash-BSK-KaTu.js";import{t as gn}from"./badge-Dba4cvJR.js";import"./config-provider-psmEp7UZ.js";import{a as _n,c as vn,i as yn,n as bn,o as xn,s as Sn}from"./use-apply-config-color-theme-CK97Jvup.js";import{n as Cn,r as wn}from"./config-context-gd3BC-iY.js";import{t as Tn}from"./external-link-T4Nj1gcG.js";import{t as En}from"./use-workspace-3T40FR83.js";import{t as Dn}from"./lint-plugin-meta-B3N1DKgL.js";import{t as On}from"./skeleton-HLkcMp95.js";import{d as kn,n as An,r as jn,t as Mn,u as Nn}from"./lint-config-client-G_mrikOJ.js";import{a as Pn,d as Fn,f as In,i as Ln,l as Rn,m as zn,o as Bn,p as Vn,s as Hn,t as Un,u as Wn}from"./sortable.esm-B6whf_t-.js";import{t as Gn}from"./textarea-RSYJwPz9.js";import{a as Kn,f as qn,i as Jn,n as Yn,o as Xn,p as Zn,r as Qn,s as $n,t as er}from"./form-D-z6QdLf.js";import{t as tr}from"./tag-pill-input-B27HgfRy.js";import{t as nr}from"./markdownlint-rule-browser-rS3aDGOb.js";import{n as rr,r as ir}from"./schema-fields-view-intent-Dz1ZzVCe.js";import{n as ar,t as or}from"./use-terminal-enabled-Dxvf3ewA.js";var sr=_(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Z=d(),Q=e(o(),1),$=n(),cr=`settings-sharing-title`;function lr(){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)(ur,{}):(0,$.jsx)(dr,{}),e[0]=n):n=e[0],n}function ur(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`h3`,{id:cr,className:`text-base font-semibold`,children:(0,$.jsx)(s,{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":cr,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)(s,{id:`7YRrJ9`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{}),2:(0,$.jsx)(`code`,{})}})})]})}),e[1]=n):n=e[1],n}function dr(){let e=(0,Z.c)(39),{_:t}=c(),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(!1),[o,l]=(0,Q.useState)(null),u;e[0]===t?u=e[1]:(u=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(pr)}},e[0]=t,e[1]=u);let d=u,f;e[2]===d?f=e[3]:(f=()=>{d()},e[2]=d,e[3]=f);let p;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],e[4]=p):p=e[4],(0,Q.useEffect)(f,p);let m;e[5]!==t||e[6]!==i||e[7]!==d||e[8]!==n?(m=async function(e){let r=window.okDesktop?.sharing;if(!r||n===null||i||n.mode===e)return;a(!0),l(null);let o=null,s=null;try{o=await r.setMode(e)}catch(e){s=e}if(a(!1),s!==null){X.error(s instanceof Error?s.message:t({id:`qZv5ZR`}));return}o!==null&&(o.kind===`refused-tracked`?(l({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 d())},e[5]=t,e[6]=i,e[7]=d,e[8]=n,e[9]=m):m=e[9];let h=m,g;e[10]!==t||e[11]!==i||e[12]!==d||e[13]!==n?(g=async function(){let e=window.okDesktop?.sharing;if(!e||n===null||i)return;a(!0);let r=null,o=null;try{r=await e.setSkillsShared(!1)}catch(e){o=e}if(a(!1),o!==null){X.error(o instanceof Error?o.message:t({id:`onTlRk`}));return}if(r!==null){if(r.kind===`no-exclude`){let e=r.reason===`no-git`?t({id:`Xwump4`}):r.reason===`inaccessible`?t({id:`PlGC6r`}):t({id:`zcmYx4`});X.warning(t({id:`4h3e0H`,values:{detail:e}}));return}X.success(t({id:`pQf2Ux`})),await d()}},e[10]=t,e[11]=i,e[12]=d,e[13]=n,e[14]=g):g=e[14];let _=g;if(n===null){let t;return e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":cr,className:`space-y-3`,children:[(0,$.jsx)(`h3`,{id:cr,className:`text-base font-semibold`,children:(0,$.jsx)(s,{id:`cs4mps`})}),(0,$.jsx)(On,{className:`h-24`})]}),e[15]=t):t=e[15],t}let y=n.mode===`no-git`,b;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`h3`,{id:cr,className:`text-base font-semibold`,children:(0,$.jsx)(s,{id:`cs4mps`})}),(0,$.jsx)(rn,{})]}),e[16]=b):b=e[16];let x;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[b,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`N55YNr`})})]}),e[17]=x):x=e[17];let S;e[18]!==i||e[19]!==y||e[20]!==h||e[21]!==n.mode?(S=y?(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)(s,{id:`ju38ms`})}):(0,$.jsxs)(ee,{value:n.mode,onValueChange:e=>void h(e),disabled:i,className:`gap-2`,"aria-labelledby":cr,"data-testid":`settings-sharing-radiogroup`,children:[(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-shared`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(G,{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)(s,{id:`0Gd0NU`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`dJw2_7`})})]})]}),(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-local-only`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(G,{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)(s,{id:`OgyJSr`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`cZ_8zB`})})]})]})]}),e[18]=i,e[19]=y,e[20]=h,e[21]=n.mode,e[22]=S):S=e[22];let C;e[23]!==i||e[24]!==_||e[25]!==n.mode||e[26]!==n.skillsShared?(C=n.mode===`local-only`&&n.skillsShared?(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 rounded-md border border-muted-foreground/30 bg-muted/40 p-3 text-sm`,"data-testid":`settings-sharing-skills-exception`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(s,{id:`Kiytqd`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`K0FgsP`})})]}),(0,$.jsx)(v,{variant:`outline`,size:`sm`,disabled:i,onClick:()=>void _(),children:(0,$.jsx)(s,{id:`9uI_rE`})})]}):null,e[23]=i,e[24]=_,e[25]=n.mode,e[26]=n.skillsShared,e[27]=C):C=e[27];let w;e[28]===o?w=e[29]:(w=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)(s,{id:`Kgdbkt`})}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs leading-relaxed`,children:o.remediation}),(0,$.jsx)(v,{variant:`outline`,size:`sm`,onClick:()=>l(null),children:(0,$.jsx)(s,{id:`1QfxQT`})})]}),e[28]=o,e[29]=w);let T;e[30]!==o||e[31]!==n.mode||e[32]!==n.trackedUpstream?(T=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)(s,{id:`LhWYpm`})}),(0,$.jsx)(`ul`,{className:`list-disc pl-5 font-mono text-xs text-muted-foreground`,children:n.trackedUpstream.map(fr)}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`1XSMhZ`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]}):null,e[30]=o,e[31]=n.mode,e[32]=n.trackedUpstream,e[33]=T):T=e[33];let E;return e[34]!==T||e[35]!==S||e[36]!==C||e[37]!==w?(E=(0,$.jsxs)(`section`,{"aria-labelledby":cr,className:`space-y-4`,"data-testid":`settings-sharing`,children:[x,S,C,w,T]}),e[34]=T,e[35]=S,e[36]=C,e[37]=w,e[38]=E):E=e[38],E}function fr(e){return(0,$.jsx)(`li`,{children:e},e)}function pr(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[],skillsShared:!1}}function mr(e){let t=(0,Z.c)(35),{authQueryTransport:n,authTransport:r}=e,{_:i}=c(),a;t[0]===n?a=t[1]:(a=n??Bt(),t[0]=n,t[1]=a);let o=a,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l={phase:`loading`},t[2]=l):l=t[2];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),y=(0,Q.useRef)(!1),b;t[3]===o?b=t[4]:(b=async function(){d({phase:`loading`});try{let e=await o.status();d({phase:`loaded`,result:e}),Pt(e.authenticated)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),d({phase:`check-failed`})}},t[3]=o,t[4]=b);let x=b,S;t[5]===x?S=t[6]:(S=()=>{x()},t[5]=x,t[6]=S);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[7]=C):C=t[7],(0,Q.useEffect)(S,C);let w;t[8]!==i||t[9]!==x||t[10]!==o?(w=async function(){if(y.current)return;y.current=!0,p(!1),h(!0),_(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 x(),e&&_(e),h(!1),y.current=!1},t[8]=i,t[9]=x,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)(s,{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)(s,{id:`E6lrpp`})})]}),t[13]=D):D=t[13];let O;t[14]!==g||t[15]!==m||t[16]!==T||t[17]!==x||t[18]!==u.phase||t[19]!==u.result?(O=u.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)(s,{id:`IWGfGF`})}),(0,$.jsx)(On,{className:`h-4 w-40`}),(0,$.jsx)(On,{className:`h-8 w-32`})]}):u.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)(s,{id:`T_wG4n`})}),(0,$.jsx)(v,{variant:`outline`,size:`sm`,onClick:()=>void x(),children:(0,$.jsx)(s,{id:`KDw4GX`})})]}):u.result.authenticated?u.result.tier===`A`?(0,$.jsx)(gr,{login:u.result.login}):(0,$.jsx)(hr,{login:u.result.login,disconnecting:m,error:g,onDisconnect:()=>void T()}):(0,$.jsx)(_r,{onConnect:()=>p(!0)}),t[14]=g,t[15]=m,t[16]=T,t[17]=x,t[18]=u.phase,t[19]=u.result,t[20]=O):O=t[20];let k;t[21]===x?k=t[22]:(k=e=>{p(e),e||x()},t[21]=x,t[22]=k);let A=u.phase===`loaded`?u.result.host:void 0,j=u.phase===`loaded`?u.result.ghAvailable:void 0,M;t[23]===x?M=t[24]:(M=()=>{x()},t[23]=x,t[24]=M);let N;t[25]!==f||t[26]!==r||t[27]!==k||t[28]!==A||t[29]!==j||t[30]!==M?(N=(0,$.jsx)(gt,{open:f,onOpenChange:k,transport:r,host:A,ghAvailable:j,onSuccess:M}),t[25]=f,t[26]=r,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N):N=t[31];let P;return t[32]!==N||t[33]!==O?(P=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[D,O,N]}),t[32]=N,t[33]=O,t[34]=P):P=t[34],P}function hr(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)(s,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=o);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(s,{id:`nxlOpL`})}),t[2]=c):c=t[2];let l;t[3]===o?l=t[4]:(l=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[o,c]}),t[3]=o,t[4]=l);let u;t[5]===r?u=t[6]:(u=r?(0,$.jsx)(s,{id:`rppgXF`}):(0,$.jsx)(s,{id:`-K0AvT`}),t[5]=r,t[6]=u);let d;t[7]!==r||t[8]!==a||t[9]!==u?(d=(0,$.jsx)(v,{variant:`outline`,onClick:a,disabled:r,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:u}),t[7]=r,t[8]=a,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==l||t[12]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13];let p;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,$.jsx)(s,{id:`msOK6I`})}),t[14]=p):p=t[14];let m;t[15]===i?m=t[16]:(m=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]=m);let h;return t[17]!==f||t[18]!==m?(h=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[f,p,m]}),t[17]=f,t[18]=m,t[19]=h):h=t[19],h}function gr(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)(s,{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)(s,{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 _r(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)(s,{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)(s,{id:`EJuO7B`})})]}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(s,{id:`5lWFkC`}),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)(v,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=o),o}function vr(e){return e.kind===`editor`?`editor:${e.id}`:e.kind===`skill`?`skill:${e.id}`:`path`}function yr(e){let t=(0,Z.c)(11),{testId:n,children:r}=e,{_:i}=c(),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)(Yt,{className:`size-3.5`}),t[2]=o):o=t[2];let s;t[3]!==a||t[4]!==n?(s=(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(v,{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 l;t[6]===r?l=t[7]:(l=(0,$.jsx)(b,{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]=l);let u;return t[8]!==s||t[9]!==l?(u=(0,$.jsxs)(x,{children:[s,l]}),t[8]=s,t[9]=l,t[10]=u):u=t[10],u}function br(){let e=(0,Z.c)(38),{_:t}=c(),n=typeof window<`u`?window.okDesktop??null:null,[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{if(!n)return;let e=!1;return n.integrations.status().then(t=>{e||i(t)}).catch(()=>{e||o(!0)}),()=>{e=!0}},f=[n],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===t?p=e[3]:(p=async function(e,r){if(n){u(vr(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)}}))}u(null)}},e[2]=t,e[3]=p);let m=p,h;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`h3`,{id:`settings-ai-tools-title`,className:`text-base font-semibold`,children:(0,$.jsx)(s,{id:`_5qBNl`})}),e[4]=h):h=e[4];let g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[h,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`mLAjyL`})})]}),e[5]=g):g=e[5];let _=g;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:[_,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`ai-tools-unavailable`,children:(0,$.jsx)(s,{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:[_,(0,$.jsxs)(`div`,{className:`space-y-2`,"data-testid":`ai-tools-loading`,children:[(0,$.jsx)(On,{className:`h-10 w-full`}),(0,$.jsx)(On,{className:`h-10 w-full`}),(0,$.jsx)(On,{className:`h-10 w-full`})]})]}),e[7]=t):t=e[7],t}let v=l!==null||!r.available,y=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)(s,{id:`OplnBG`})}),e[8]=r.available,e[9]=b);let x;e[10]!==t||e[11]!==m||e[12]!==v||e[13]!==y||e[14]!==r.path.installed||e[15]!==r.path.rcFilesToTouch?(x=y&&(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)(s,{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)(L,{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)(N,{id:`ai-tools-path`,checked:r.path.installed,disabled:v,onCheckedChange:()=>void m({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)(s,{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)(yr,{testId:`ai-tools-path-info`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(s,{id:`f9lQNJ`})}),r.path.rcFilesToTouch.map(Sr),(0,$.jsx)(`p`,{className:`pt-1`,children:(0,$.jsx)(s,{id:`CWzc2T`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]})]})]}),e[10]=t,e[11]=m,e[12]=v,e[13]=y,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)(s,{id:`psfGPX`})}),e[17]=S):S=e[17];let C;if(e[18]!==t||e[19]!==m||e[20]!==v||e[21]!==r.editors){let n;e[23]!==t||e[24]!==m||e[25]!==v?(n=e=>{let n=e.state===`installed`||e.state===`foreign`,r=v||e.state===`unmanageable`,i=e.state===`not-installed`&&!e.detected,a=`https://openknowledge.ai/docs/integrations/${ve[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,c=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)(L,{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)(N,{id:`ai-tools-editor-${e.id}`,checked:n,disabled:r,onCheckedChange:()=>void m({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:c,"data-testid":`ai-tools-editor-status-${e.id}`,children:o})]})]}),i&&(0,$.jsxs)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Tn(e,a),onAuxClick:e=>Tn(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)(s,{id:`P_bX4O`}),(0,$.jsx)(Xe,{className:`size-3`,"aria-hidden":!0})]}),(0,$.jsxs)(yr,{testId:`ai-tools-editor-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(s,{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)(s,{id:`VIwCaD`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.entryLocator})})]})]},e.id)},e[23]=t,e[24]=m,e[25]=v,e[26]=n):n=e[26],C=r.editors.map(n),e[18]=t,e[19]=m,e[20]=v,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]!==m||e[30]!==v||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)(s,{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)(L,{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)(N,{id:`ai-tools-skill-${e.id}`,checked:e.installed,disabled:v,onCheckedChange:()=>void m({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)(s,{id:`0inVGS`}):(0,$.jsx)(s,{id:`FXk_zY`})})]})]}),(0,$.jsxs)(yr,{testId:`ai-tools-skill-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(s,{id:`HSh8u_`})}),e.paths.map(xr)]})]},e.id))})]}),e[29]=m,e[30]=v,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:[_,b,x,w,T]}),e[33]=T,e[34]=b,e[35]=x,e[36]=w,e[37]=E):E=e[37],E}function xr(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}function Sr(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}function Cr(e){return{chrome:e.sidebar,surface:e.background,bar:e.primary,line:e.border,dots:[e[`syntax-string`],e[`syntax-keyword`],e[`syntax-atom`]]}}function wr(e,t){return e.id===`custom`?Cr(we(xn(vn(t)))):e.base?Cr(we(e.base)):{chrome:`var(--sidebar)`,surface:`var(--background)`,bar:`var(--primary)`,line:`var(--border)`,dots:[`var(--chart-2)`,`var(--chart-4)`,`var(--chart-3)`]}}function Tr(e){let t=(0,Z.c)(35),{theme:n,customSeed:r}=e,i,a,o,s,c,l,u,d,f;t[0]!==r||t[1]!==n?(i=wr(n,r),l=!0,u=`aspect-[4/3] w-full overflow-hidden rounded-md border`,d={backgroundColor:i.surface,borderColor:i.line},f=(0,$.jsxs)(`div`,{className:`flex h-1/3 items-center gap-1 px-1.5`,style:{backgroundColor:i.chrome,borderBottom:`1px solid ${i.line}`},children:[(0,$.jsx)(`span`,{className:`h-1.5 w-5 rounded-full`,style:{backgroundColor:i.bar}}),(0,$.jsx)(`span`,{className:`h-1.5 flex-1 rounded-full opacity-50`,style:{backgroundColor:i.line}})]}),c=`flex h-2/3`,a=`flex w-1/4 flex-col items-center justify-center gap-1`,o={backgroundColor:i.chrome,borderRight:`1px solid ${i.line}`},s=i.dots.map(Er),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f):(i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10]);let p;t[11]!==a||t[12]!==o||t[13]!==s?(p=(0,$.jsx)(`div`,{className:a,style:o,children:s}),t[11]=a,t[12]=o,t[13]=s,t[14]=p):p=t[14];let m;t[15]===i.dots[1]?m=t[16]:(m=(0,$.jsx)(`span`,{className:`h-1.5 w-3/4 rounded-full`,style:{backgroundColor:i.dots[1]}}),t[15]=i.dots[1],t[16]=m);let h;t[17]===i.line?h=t[18]:(h=(0,$.jsx)(`span`,{className:`h-1.5 w-1/2 rounded-full opacity-60`,style:{backgroundColor:i.line}}),t[17]=i.line,t[18]=h);let g;t[19]===i.dots[0]?g=t[20]:(g=(0,$.jsx)(`span`,{className:`h-1.5 w-2/3 rounded-full`,style:{backgroundColor:i.dots[0]}}),t[19]=i.dots[0],t[20]=g);let _;t[21]!==m||t[22]!==h||t[23]!==g?(_=(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col justify-center gap-1 px-1.5`,children:[m,h,g]}),t[21]=m,t[22]=h,t[23]=g,t[24]=_):_=t[24];let v;t[25]!==_||t[26]!==c||t[27]!==p?(v=(0,$.jsxs)(`div`,{className:c,children:[p,_]}),t[25]=_,t[26]=c,t[27]=p,t[28]=v):v=t[28];let y;return t[29]!==v||t[30]!==l||t[31]!==u||t[32]!==d||t[33]!==f?(y=(0,$.jsxs)(`div`,{"aria-hidden":l,className:u,style:d,children:[f,v]}),t[29]=v,t[30]=l,t[31]=u,t[32]=d,t[33]=f,t[34]=y):y=t[34],y}function Er(e,t){return(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{backgroundColor:e}},t)}function Dr(e){let t=(0,Z.c)(10),{value:n,onSelect:r,customSeed:i,id:a,"aria-label":o,"aria-describedby":s}=e,{_:l}=c(),u=ke.some(e=>e.id===n)?n:`default`,d;t[0]!==l||t[1]!==i?(d=ke.map(e=>(0,$.jsxs)(K,{value:e.id,className:g(`group/tile flex flex-col gap-1.5 rounded-lg border-2 border-transparent p-1 text-left outline-none`,`hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40`,`data-checked:border-primary`),children:[(0,$.jsx)(Tr,{theme:e,customSeed:i}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-0.5`,children:[(0,$.jsx)(`span`,{className:`text-1sm font-medium text-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.id===`custom`?_n(vn(i))===`dark`?l({id:`pvnfJD`}):l({id:`1njn7W`}):e.kind===`system`?l({id:`R9Khdg`}):e.kind===`light`?l({id:`1njn7W`}):l({id:`pvnfJD`})})]})]},e.id)),t[0]=l,t[1]=i,t[2]=d):d=t[2];let f;return t[3]!==s||t[4]!==o||t[5]!==a||t[6]!==r||t[7]!==u||t[8]!==d?(f=(0,$.jsx)(W,{id:a,"aria-label":o,"aria-describedby":s,value:u,onValueChange:r,className:`grid w-full grid-cols-2 gap-2 sm:grid-cols-3`,children:d}),t[3]=s,t[4]=o,t[5]=a,t[6]=r,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function Or(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)]:Or(r,t)}}function kr(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 Ar(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 jr(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 Mr(e){if(!Ce(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 Nr(){let e=(0,Z.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(On,{className:`h-5 w-32`}),n=(0,$.jsx)(On,{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)(On,{className:`h-9 w-full`}),(0,$.jsx)(On,{className:`h-9 w-full`})]})]}),e[2]=r):r=e[2],r}function Pr({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let{_:i}=c(),a=Zn(),o=je(Me,e.path),l=o?Ar(o):void 0,u=o?kr(o):void 0,d=o?jr(o):void 0,f=o?Te(o):void 0,p=f?.scope===`project`&&t!==`project`||f?.scope===`user`&&t!==`user`,m=e.path.join(`.`),h=i(e.label),[_,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{C.current&&clearTimeout(C.current)},[]);let w=()=>{S(!0),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>S(!1),1200)},T=()=>{let e=n(m);return e&&w(),e},E=()=>a.getFieldState(m).isDirty?T():!0,D=()=>{let e=u===void 0?null:u;a.setValue(m,e,{shouldDirty:!1}),T()},O=g(`relative`,r&&`animate-settings-flash`);return(0,$.jsx)(Jn,{control:a.control,name:m,render:({field:n})=>{let r=!p&&(u!==void 0||n.value!==void 0);return(0,$.jsxs)(Kn,{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)(Xn,{className:`text-sm font-medium`,children:h}),r?(0,$.jsxs)(x,{children:[(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(v,{variant:`ghost`,size:`icon`,className:`h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100`,onClick:D,"aria-label":i({id:`lhjq3G`,values:{labelText:h}}),children:(0,$.jsx)(Zt,{className:`size-3.5`})})}),(0,$.jsx)(b,{children:(0,$.jsx)(s,{id:`L-rMC9`})})]}):null]}),e.description?(0,$.jsx)(Qn,{className:`text-muted-foreground text-1sm`,children:i(e.description)}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Yn,{children:(0,$.jsx)(Fr,{field:e,ctl:n,typeTag:l,enumOptions:d,onCommit:E})}),(0,$.jsx)(zr,{visible:_,srOnly:e.control===`theme-tiles`})]}),(0,$.jsx)($n,{"data-field-error":e.path.join(`.`)})]})}})}function Fr({field:e,ctl:t,typeTag:n,enumOptions:r,onCommit:i,...a}){"use no memo";let{_:o}=c(),{setTheme:s}=u(),l=wn()?.merged??null;if(e.control===`theme-tiles`){let{id:n,...r}=a,c=l?.appearance?.customTheme;return(0,$.jsx)(Dr,{...r,id:n,value:typeof t.value==`string`?t.value:`default`,customSeed:c,"aria-label":o(e.label),onSelect:e=>{if(bn(e,c),e===`custom`)s(_n(vn(c))===`dark`?`dark`:`light`);else{let t=_e(e);t&&s(t)}t.onChange(e),i()}})}if(n===`boolean`)return(0,$.jsx)(U,{...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)(ne,{...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)(te,{value:e,id:t===0?n:void 0,className:`text-1sm capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(Lr,{ctl:t,onCommit:i,...a}):n===`array`?(0,$.jsx)(Rr,{ctl:t,onCommit:i,...a}):(0,$.jsx)(Ir,{ctl:t,onCommit:i,...a})}function Ir({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(an,{...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 Lr({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)(an,{...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 Rr({ctl:e,onCommit:t,...n}){"use no memo";let r=Array.isArray(e.value)?e.value.join(`
1
+ import{o as e,t}from"./chunk-CYidjpOJ.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{Tt as r,et as i,qt as a}from"./DocumentContext-CpOTF1vT.js";import{t as o}from"./react-f2sANaYj.js";import{n as s,r as c}from"./dist-Nvb76hAm.js";import{t as l}from"./useQuery-ZeEDLtxh.js";import{n as u}from"./dist-PQ5KMVDh.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{a as f,c as p,l as m,s as h}from"./terminal-input-events-C5UuEsAB.js";import{s as g,t as _}from"./createLucideIcon-DAkhoPjT.js";import{t as v}from"./button-Gol9BgNB.js";import{i as y,n as b,t as x}from"./tooltip-B4J7VHmA.js";import{n as S,r as C,t as w}from"./collapsible-B1mS1n9y.js";import{a as T,c as E,i as D,n as O,o as k,r as A,s as j,t as M}from"./dialog-TkFkuYVg.js";import{t as N}from"./checkbox-DY-vIhnZ.js";import{m as P,r as F,t as I}from"./dropdown-menu-xw8WTdb-.js";import{t as L}from"./label-DyipnO5I.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./switch-DYic2V-1.js";import{i as W,n as G,r as K,t as ee}from"./radio-group-CGEdWasQ.js";import{t as q}from"./separator-DExEeoYE.js";import{n as te,t as ne}from"./toggle-group-CjXmmTGy.js";import{C as J,a as Y,b as re,c as ie,d as ae,f as oe,h as se,l as ce,n as le,o as ue,r as de,s as fe,t as pe,u as me,y as he}from"./agent-visibility-HpfSUFqP.js";import{i as ge}from"./terminal-telemetry-DxTZB2oZ.js";import{Aa as _e,F as ve,Fa as ye,Ft as be,Ga as xe,Ha as Se,Ia as Ce,Ma as we,Na as Te,Oa as Ee,P as De,Rt as Oe,Ta as ke,Ua as Ae,Wa as je,_a as Me,_t as Ne,b as Pe,ba as Fe,ei as Ie,et as Le,ii as Re,pr as ze,pt as Be,v as Ve,ya as He,za as Ue,zt as We}from"./dist-Cal4LUep.js";import{a as Ge,c as Ke,d as qe,s as Je,t as Ye}from"./EnableSyncConfirmDialog-BCmpMth-.js";import{t as Xe}from"./arrow-up-right-obRIg3Sv.js";import{t as Ze}from"./RegisteredAgentIcon-8Tcfr3WP.js";import{t as Qe}from"./check-GqWaoTdV.js";import{t as $e}from"./chevron-right-C8oTR6gu.js";import{i as et}from"./prop-types-B-N3_i3c.js";import{C as tt,S as nt,b as rt,c as it,h as at,i as ot,l as st,o as ct,r as lt,t as ut,v as dt,y as ft}from"./skill-actions-C_5-d4BC.js";import{A as pt,F as mt,G as ht,I as gt,M as _t,N as vt,P as yt,S as bt,U as xt,V as St,_ as Ct,b as wt,c as Tt,d as Et,f as Dt,g as Ot,h as kt,i as At,k as jt,l as Mt,m as Nt,n as Pt,o as Ft,p as It,u as Lt,x as Rt,y as zt,z as Bt}from"./auth-state-cache-BMSP_iQ1.js";import{i as Vt,l as Ht,r as Ut,s as Wt}from"./workspace-paths-B-NChZS2.js";import{t as Gt}from"./square-pen-C1vIlMAW.js";import{c as Kt,n as qt,t as Jt}from"./open-managed-artifact-tab-DfGutPkc.js";import{t as Yt}from"./info-yKMseklR.js";import{t as Xt}from"./loader-circle-Cg5SU7AZ.js";import{c as Zt,i as Qt}from"./field-DVIFAnvR.js";import{t as $t}from"./sliders-horizontal-34K0eDW2.js";import{t as en}from"./trash-2-BUuL4OCw.js";import{t as tn}from"./triangle-alert-Clgvyc7B.js";import{t as nn}from"./x-DVkpYo5d.js";import{n as X}from"./dist-BLAMau9Z.js";import{t as rn}from"./ConfigSharingInfoTooltip-DMbsfWD9.js";import{t as an}from"./input-D0ZW0Opq.js";import{c as on,d as sn,i as cn,l as ln,m as un,o as dn,s as fn}from"./use-settings-route-CXFzIfYo.js";import{t as pn}from"./parse-api-error-C_gwkKmG.js";import{i as mn}from"./documents-events-1HWCdfoh.js";import{o as hn}from"./doc-hash-BSK-KaTu.js";import{t as gn}from"./badge-Dba4cvJR.js";import"./config-provider-Bd6kn_Wi.js";import{a as _n,c as vn,i as yn,n as bn,o as xn,s as Sn}from"./use-apply-config-color-theme-CK97Jvup.js";import{n as Cn,r as wn}from"./config-context-gd3BC-iY.js";import{t as Tn}from"./external-link-T4Nj1gcG.js";import{t as En}from"./use-workspace-3T40FR83.js";import{t as Dn}from"./lint-plugin-meta-B3N1DKgL.js";import{t as On}from"./skeleton-HLkcMp95.js";import{d as kn,n as An,r as jn,t as Mn,u as Nn}from"./lint-config-client-G_mrikOJ.js";import{a as Pn,d as Fn,f as In,i as Ln,l as Rn,m as zn,o as Bn,p as Vn,s as Hn,t as Un,u as Wn}from"./sortable.esm-B6whf_t-.js";import{t as Gn}from"./textarea-RSYJwPz9.js";import{a as Kn,f as qn,i as Jn,n as Yn,o as Xn,p as Zn,r as Qn,s as $n,t as er}from"./form-D-z6QdLf.js";import{t as tr}from"./tag-pill-input-B27HgfRy.js";import{t as nr}from"./markdownlint-rule-browser-rS3aDGOb.js";import{n as rr,r as ir}from"./schema-fields-view-intent-Dz1ZzVCe.js";import{n as ar,t as or}from"./use-terminal-enabled-skhgA3z3.js";var sr=_(`wifi-off`,[[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.5 16.429a5 5 0 0 1 7 0`,key:`1bycff`}],[`path`,{d:`M5 12.859a10 10 0 0 1 5.17-2.69`,key:`1dl1wf`}],[`path`,{d:`M19 12.859a10 10 0 0 0-2.007-1.523`,key:`4k23kn`}],[`path`,{d:`M2 8.82a15 15 0 0 1 4.177-2.643`,key:`1grhjp`}],[`path`,{d:`M22 8.82a15 15 0 0 0-11.288-3.764`,key:`z3jwby`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),Z=d(),Q=e(o(),1),$=n(),cr=`settings-sharing-title`;function lr(){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)(ur,{}):(0,$.jsx)(dr,{}),e[0]=n):n=e[0],n}function ur(){let e=(0,Z.c)(2),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(`h3`,{id:cr,className:`text-base font-semibold`,children:(0,$.jsx)(s,{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":cr,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)(s,{id:`7YRrJ9`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{}),2:(0,$.jsx)(`code`,{})}})})]})}),e[1]=n):n=e[1],n}function dr(){let e=(0,Z.c)(39),{_:t}=c(),[n,r]=(0,Q.useState)(null),[i,a]=(0,Q.useState)(!1),[o,l]=(0,Q.useState)(null),u;e[0]===t?u=e[1]:(u=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(pr)}},e[0]=t,e[1]=u);let d=u,f;e[2]===d?f=e[3]:(f=()=>{d()},e[2]=d,e[3]=f);let p;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(p=[],e[4]=p):p=e[4],(0,Q.useEffect)(f,p);let m;e[5]!==t||e[6]!==i||e[7]!==d||e[8]!==n?(m=async function(e){let r=window.okDesktop?.sharing;if(!r||n===null||i||n.mode===e)return;a(!0),l(null);let o=null,s=null;try{o=await r.setMode(e)}catch(e){s=e}if(a(!1),s!==null){X.error(s instanceof Error?s.message:t({id:`qZv5ZR`}));return}o!==null&&(o.kind===`refused-tracked`?(l({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 d())},e[5]=t,e[6]=i,e[7]=d,e[8]=n,e[9]=m):m=e[9];let h=m,g;e[10]!==t||e[11]!==i||e[12]!==d||e[13]!==n?(g=async function(){let e=window.okDesktop?.sharing;if(!e||n===null||i)return;a(!0);let r=null,o=null;try{r=await e.setSkillsShared(!1)}catch(e){o=e}if(a(!1),o!==null){X.error(o instanceof Error?o.message:t({id:`onTlRk`}));return}if(r!==null){if(r.kind===`no-exclude`){let e=r.reason===`no-git`?t({id:`Xwump4`}):r.reason===`inaccessible`?t({id:`PlGC6r`}):t({id:`zcmYx4`});X.warning(t({id:`4h3e0H`,values:{detail:e}}));return}X.success(t({id:`pQf2Ux`})),await d()}},e[10]=t,e[11]=i,e[12]=d,e[13]=n,e[14]=g):g=e[14];let _=g;if(n===null){let t;return e[15]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsxs)(`section`,{"aria-labelledby":cr,className:`space-y-3`,children:[(0,$.jsx)(`h3`,{id:cr,className:`text-base font-semibold`,children:(0,$.jsx)(s,{id:`cs4mps`})}),(0,$.jsx)(On,{className:`h-24`})]}),e[15]=t):t=e[15],t}let y=n.mode===`no-git`,b;e[16]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,$.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`h3`,{id:cr,className:`text-base font-semibold`,children:(0,$.jsx)(s,{id:`cs4mps`})}),(0,$.jsx)(rn,{})]}),e[16]=b):b=e[16];let x;e[17]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[b,(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`N55YNr`})})]}),e[17]=x):x=e[17];let S;e[18]!==i||e[19]!==y||e[20]!==h||e[21]!==n.mode?(S=y?(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)(s,{id:`ju38ms`})}):(0,$.jsxs)(ee,{value:n.mode,onValueChange:e=>void h(e),disabled:i,className:`gap-2`,"aria-labelledby":cr,"data-testid":`settings-sharing-radiogroup`,children:[(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-shared`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(G,{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)(s,{id:`0Gd0NU`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`dJw2_7`})})]})]}),(0,$.jsxs)(`label`,{htmlFor:`settings-sharing-local-only`,className:`flex items-start gap-2 text-sm`,children:[(0,$.jsx)(G,{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)(s,{id:`OgyJSr`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`cZ_8zB`})})]})]})]}),e[18]=i,e[19]=y,e[20]=h,e[21]=n.mode,e[22]=S):S=e[22];let C;e[23]!==i||e[24]!==_||e[25]!==n.mode||e[26]!==n.skillsShared?(C=n.mode===`local-only`&&n.skillsShared?(0,$.jsxs)(`div`,{className:`flex items-start justify-between gap-2 rounded-md border border-muted-foreground/30 bg-muted/40 p-3 text-sm`,"data-testid":`settings-sharing-skills-exception`,children:[(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`font-medium`,children:(0,$.jsx)(s,{id:`Kiytqd`})}),(0,$.jsx)(`span`,{className:`block text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`K0FgsP`})})]}),(0,$.jsx)(v,{variant:`outline`,size:`sm`,disabled:i,onClick:()=>void _(),children:(0,$.jsx)(s,{id:`9uI_rE`})})]}):null,e[23]=i,e[24]=_,e[25]=n.mode,e[26]=n.skillsShared,e[27]=C):C=e[27];let w;e[28]===o?w=e[29]:(w=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)(s,{id:`Kgdbkt`})}),(0,$.jsx)(`pre`,{className:`whitespace-pre-wrap font-mono text-xs leading-relaxed`,children:o.remediation}),(0,$.jsx)(v,{variant:`outline`,size:`sm`,onClick:()=>l(null),children:(0,$.jsx)(s,{id:`1QfxQT`})})]}),e[28]=o,e[29]=w);let T;e[30]!==o||e[31]!==n.mode||e[32]!==n.trackedUpstream?(T=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)(s,{id:`LhWYpm`})}),(0,$.jsx)(`ul`,{className:`list-disc pl-5 font-mono text-xs text-muted-foreground`,children:n.trackedUpstream.map(fr)}),(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`1XSMhZ`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]}):null,e[30]=o,e[31]=n.mode,e[32]=n.trackedUpstream,e[33]=T):T=e[33];let E;return e[34]!==T||e[35]!==S||e[36]!==C||e[37]!==w?(E=(0,$.jsxs)(`section`,{"aria-labelledby":cr,className:`space-y-4`,"data-testid":`settings-sharing`,children:[x,S,C,w,T]}),e[34]=T,e[35]=S,e[36]=C,e[37]=w,e[38]=E):E=e[38],E}function fr(e){return(0,$.jsx)(`li`,{children:e},e)}function pr(e){return e??{kind:`status`,mode:`no-git`,excluded:[],trackedUpstream:[],skillsShared:!1}}function mr(e){let t=(0,Z.c)(35),{authQueryTransport:n,authTransport:r}=e,{_:i}=c(),a;t[0]===n?a=t[1]:(a=n??Bt(),t[0]=n,t[1]=a);let o=a,l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l={phase:`loading`},t[2]=l):l=t[2];let[u,d]=(0,Q.useState)(l),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(!1),[g,_]=(0,Q.useState)(null),y=(0,Q.useRef)(!1),b;t[3]===o?b=t[4]:(b=async function(){d({phase:`loading`});try{let e=await o.status();d({phase:`loaded`,result:e}),Pt(e.authenticated)}catch(e){console.warn(`[AccountSection] GitHub status check failed`,e),d({phase:`check-failed`})}},t[3]=o,t[4]=b);let x=b,S;t[5]===x?S=t[6]:(S=()=>{x()},t[5]=x,t[6]=S);let C;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(C=[],t[7]=C):C=t[7],(0,Q.useEffect)(S,C);let w;t[8]!==i||t[9]!==x||t[10]!==o?(w=async function(){if(y.current)return;y.current=!0,p(!1),h(!0),_(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 x(),e&&_(e),h(!1),y.current=!1},t[8]=i,t[9]=x,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)(s,{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)(s,{id:`E6lrpp`})})]}),t[13]=D):D=t[13];let O;t[14]!==g||t[15]!==m||t[16]!==T||t[17]!==x||t[18]!==u.phase||t[19]!==u.result?(O=u.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)(s,{id:`IWGfGF`})}),(0,$.jsx)(On,{className:`h-4 w-40`}),(0,$.jsx)(On,{className:`h-8 w-32`})]}):u.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)(s,{id:`T_wG4n`})}),(0,$.jsx)(v,{variant:`outline`,size:`sm`,onClick:()=>void x(),children:(0,$.jsx)(s,{id:`KDw4GX`})})]}):u.result.authenticated?u.result.tier===`A`?(0,$.jsx)(gr,{login:u.result.login}):(0,$.jsx)(hr,{login:u.result.login,disconnecting:m,error:g,onDisconnect:()=>void T()}):(0,$.jsx)(_r,{onConnect:()=>p(!0)}),t[14]=g,t[15]=m,t[16]=T,t[17]=x,t[18]=u.phase,t[19]=u.result,t[20]=O):O=t[20];let k;t[21]===x?k=t[22]:(k=e=>{p(e),e||x()},t[21]=x,t[22]=k);let A=u.phase===`loaded`?u.result.host:void 0,j=u.phase===`loaded`?u.result.ghAvailable:void 0,M;t[23]===x?M=t[24]:(M=()=>{x()},t[23]=x,t[24]=M);let N;t[25]!==f||t[26]!==r||t[27]!==k||t[28]!==A||t[29]!==j||t[30]!==M?(N=(0,$.jsx)(gt,{open:f,onOpenChange:k,transport:r,host:A,ghAvailable:j,onSuccess:M}),t[25]=f,t[26]=r,t[27]=k,t[28]=A,t[29]=j,t[30]=M,t[31]=N):N=t[31];let P;return t[32]!==N||t[33]!==O?(P=(0,$.jsxs)(`section`,{"aria-labelledby":`settings-account-title`,className:`space-y-3`,"data-testid":`settings-account`,children:[D,O,N]}),t[32]=N,t[33]=O,t[34]=P):P=t[34],P}function hr(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)(s,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=o);let c;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,$.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,$.jsx)(s,{id:`nxlOpL`})}),t[2]=c):c=t[2];let l;t[3]===o?l=t[4]:(l=(0,$.jsxs)(`div`,{className:`min-w-0`,children:[o,c]}),t[3]=o,t[4]=l);let u;t[5]===r?u=t[6]:(u=r?(0,$.jsx)(s,{id:`rppgXF`}):(0,$.jsx)(s,{id:`-K0AvT`}),t[5]=r,t[6]=u);let d;t[7]!==r||t[8]!==a||t[9]!==u?(d=(0,$.jsx)(v,{variant:`outline`,onClick:a,disabled:r,"aria-describedby":`settings-account-disconnect-caveat`,"data-testid":`settings-account-disconnect`,children:u}),t[7]=r,t[8]=a,t[9]=u,t[10]=d):d=t[10];let f;t[11]!==l||t[12]!==d?(f=(0,$.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13];let p;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(`p`,{id:`settings-account-disconnect-caveat`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-account-disconnect-caveat`,children:(0,$.jsx)(s,{id:`msOK6I`})}),t[14]=p):p=t[14];let m;t[15]===i?m=t[16]:(m=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]=m);let h;return t[17]!==f||t[18]!==m?(h=(0,$.jsxs)(`div`,{className:`space-y-2 rounded-md border p-3`,"data-testid":`settings-account-connected`,children:[f,p,m]}),t[17]=f,t[18]=m,t[19]=h):h=t[19],h}function gr(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)(s,{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)(s,{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 _r(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)(s,{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)(s,{id:`EJuO7B`})})]}),t[1]=i):i=t[1];let a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,$.jsx)(s,{id:`5lWFkC`}),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)(v,{onClick:n,"data-testid":`settings-account-connect`,children:a})]})}),t[3]=n,t[4]=o),o}function vr(e){return e.kind===`editor`?`editor:${e.id}`:e.kind===`skill`?`skill:${e.id}`:`path`}function yr(e){let t=(0,Z.c)(11),{testId:n,children:r}=e,{_:i}=c(),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)(Yt,{className:`size-3.5`}),t[2]=o):o=t[2];let s;t[3]!==a||t[4]!==n?(s=(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(v,{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 l;t[6]===r?l=t[7]:(l=(0,$.jsx)(b,{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]=l);let u;return t[8]!==s||t[9]!==l?(u=(0,$.jsxs)(x,{children:[s,l]}),t[8]=s,t[9]=l,t[10]=u):u=t[10],u}function br(){let e=(0,Z.c)(38),{_:t}=c(),n=typeof window<`u`?window.okDesktop??null:null,[r,i]=(0,Q.useState)(null),[a,o]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(null),d,f;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>{if(!n)return;let e=!1;return n.integrations.status().then(t=>{e||i(t)}).catch(()=>{e||o(!0)}),()=>{e=!0}},f=[n],e[0]=d,e[1]=f):(d=e[0],f=e[1]),(0,Q.useEffect)(d,f);let p;e[2]===t?p=e[3]:(p=async function(e,r){if(n){u(vr(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)}}))}u(null)}},e[2]=t,e[3]=p);let m=p,h;e[4]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,$.jsx)(`h3`,{id:`settings-ai-tools-title`,className:`text-base font-semibold`,children:(0,$.jsx)(s,{id:`_5qBNl`})}),e[4]=h):h=e[4];let g;e[5]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,$.jsxs)(`div`,{className:`space-y-1`,children:[h,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(s,{id:`mLAjyL`})})]}),e[5]=g):g=e[5];let _=g;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:[_,(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,"data-testid":`ai-tools-unavailable`,children:(0,$.jsx)(s,{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:[_,(0,$.jsxs)(`div`,{className:`space-y-2`,"data-testid":`ai-tools-loading`,children:[(0,$.jsx)(On,{className:`h-10 w-full`}),(0,$.jsx)(On,{className:`h-10 w-full`}),(0,$.jsx)(On,{className:`h-10 w-full`})]})]}),e[7]=t):t=e[7],t}let v=l!==null||!r.available,y=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)(s,{id:`OplnBG`})}),e[8]=r.available,e[9]=b);let x;e[10]!==t||e[11]!==m||e[12]!==v||e[13]!==y||e[14]!==r.path.installed||e[15]!==r.path.rcFilesToTouch?(x=y&&(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)(s,{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)(L,{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)(N,{id:`ai-tools-path`,checked:r.path.installed,disabled:v,onCheckedChange:()=>void m({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)(s,{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)(yr,{testId:`ai-tools-path-info`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(s,{id:`f9lQNJ`})}),r.path.rcFilesToTouch.map(Sr),(0,$.jsx)(`p`,{className:`pt-1`,children:(0,$.jsx)(s,{id:`CWzc2T`,components:{0:(0,$.jsx)(`code`,{}),1:(0,$.jsx)(`code`,{})}})})]})]})]}),e[10]=t,e[11]=m,e[12]=v,e[13]=y,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)(s,{id:`psfGPX`})}),e[17]=S):S=e[17];let C;if(e[18]!==t||e[19]!==m||e[20]!==v||e[21]!==r.editors){let n;e[23]!==t||e[24]!==m||e[25]!==v?(n=e=>{let n=e.state===`installed`||e.state===`foreign`,r=v||e.state===`unmanageable`,i=e.state===`not-installed`&&!e.detected,a=`https://openknowledge.ai/docs/integrations/${ve[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,c=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)(L,{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)(N,{id:`ai-tools-editor-${e.id}`,checked:n,disabled:r,onCheckedChange:()=>void m({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:c,"data-testid":`ai-tools-editor-status-${e.id}`,children:o})]})]}),i&&(0,$.jsxs)(`a`,{href:a,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>Tn(e,a),onAuxClick:e=>Tn(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)(s,{id:`P_bX4O`}),(0,$.jsx)(Xe,{className:`size-3`,"aria-hidden":!0})]}),(0,$.jsxs)(yr,{testId:`ai-tools-editor-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(s,{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)(s,{id:`VIwCaD`})}),(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e.entryLocator})})]})]},e.id)},e[23]=t,e[24]=m,e[25]=v,e[26]=n):n=e[26],C=r.editors.map(n),e[18]=t,e[19]=m,e[20]=v,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]!==m||e[30]!==v||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)(s,{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)(L,{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)(N,{id:`ai-tools-skill-${e.id}`,checked:e.installed,disabled:v,onCheckedChange:()=>void m({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)(s,{id:`0inVGS`}):(0,$.jsx)(s,{id:`FXk_zY`})})]})]}),(0,$.jsxs)(yr,{testId:`ai-tools-skill-info-${e.id}`,children:[(0,$.jsx)(`p`,{className:`opacity-70`,children:(0,$.jsx)(s,{id:`HSh8u_`})}),e.paths.map(xr)]})]},e.id))})]}),e[29]=m,e[30]=v,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:[_,b,x,w,T]}),e[33]=T,e[34]=b,e[35]=x,e[36]=w,e[37]=E):E=e[37],E}function xr(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}function Sr(e){return(0,$.jsx)(`p`,{children:(0,$.jsx)(`code`,{className:`break-all`,children:e})},e)}function Cr(e){return{chrome:e.sidebar,surface:e.background,bar:e.primary,line:e.border,dots:[e[`syntax-string`],e[`syntax-keyword`],e[`syntax-atom`]]}}function wr(e,t){return e.id===`custom`?Cr(we(xn(vn(t)))):e.base?Cr(we(e.base)):{chrome:`var(--sidebar)`,surface:`var(--background)`,bar:`var(--primary)`,line:`var(--border)`,dots:[`var(--chart-2)`,`var(--chart-4)`,`var(--chart-3)`]}}function Tr(e){let t=(0,Z.c)(35),{theme:n,customSeed:r}=e,i,a,o,s,c,l,u,d,f;t[0]!==r||t[1]!==n?(i=wr(n,r),l=!0,u=`aspect-[4/3] w-full overflow-hidden rounded-md border`,d={backgroundColor:i.surface,borderColor:i.line},f=(0,$.jsxs)(`div`,{className:`flex h-1/3 items-center gap-1 px-1.5`,style:{backgroundColor:i.chrome,borderBottom:`1px solid ${i.line}`},children:[(0,$.jsx)(`span`,{className:`h-1.5 w-5 rounded-full`,style:{backgroundColor:i.bar}}),(0,$.jsx)(`span`,{className:`h-1.5 flex-1 rounded-full opacity-50`,style:{backgroundColor:i.line}})]}),c=`flex h-2/3`,a=`flex w-1/4 flex-col items-center justify-center gap-1`,o={backgroundColor:i.chrome,borderRight:`1px solid ${i.line}`},s=i.dots.map(Er),t[0]=r,t[1]=n,t[2]=i,t[3]=a,t[4]=o,t[5]=s,t[6]=c,t[7]=l,t[8]=u,t[9]=d,t[10]=f):(i=t[2],a=t[3],o=t[4],s=t[5],c=t[6],l=t[7],u=t[8],d=t[9],f=t[10]);let p;t[11]!==a||t[12]!==o||t[13]!==s?(p=(0,$.jsx)(`div`,{className:a,style:o,children:s}),t[11]=a,t[12]=o,t[13]=s,t[14]=p):p=t[14];let m;t[15]===i.dots[1]?m=t[16]:(m=(0,$.jsx)(`span`,{className:`h-1.5 w-3/4 rounded-full`,style:{backgroundColor:i.dots[1]}}),t[15]=i.dots[1],t[16]=m);let h;t[17]===i.line?h=t[18]:(h=(0,$.jsx)(`span`,{className:`h-1.5 w-1/2 rounded-full opacity-60`,style:{backgroundColor:i.line}}),t[17]=i.line,t[18]=h);let g;t[19]===i.dots[0]?g=t[20]:(g=(0,$.jsx)(`span`,{className:`h-1.5 w-2/3 rounded-full`,style:{backgroundColor:i.dots[0]}}),t[19]=i.dots[0],t[20]=g);let _;t[21]!==m||t[22]!==h||t[23]!==g?(_=(0,$.jsxs)(`div`,{className:`flex flex-1 flex-col justify-center gap-1 px-1.5`,children:[m,h,g]}),t[21]=m,t[22]=h,t[23]=g,t[24]=_):_=t[24];let v;t[25]!==_||t[26]!==c||t[27]!==p?(v=(0,$.jsxs)(`div`,{className:c,children:[p,_]}),t[25]=_,t[26]=c,t[27]=p,t[28]=v):v=t[28];let y;return t[29]!==v||t[30]!==l||t[31]!==u||t[32]!==d||t[33]!==f?(y=(0,$.jsxs)(`div`,{"aria-hidden":l,className:u,style:d,children:[f,v]}),t[29]=v,t[30]=l,t[31]=u,t[32]=d,t[33]=f,t[34]=y):y=t[34],y}function Er(e,t){return(0,$.jsx)(`span`,{className:`size-1.5 rounded-full`,style:{backgroundColor:e}},t)}function Dr(e){let t=(0,Z.c)(10),{value:n,onSelect:r,customSeed:i,id:a,"aria-label":o,"aria-describedby":s}=e,{_:l}=c(),u=ke.some(e=>e.id===n)?n:`default`,d;t[0]!==l||t[1]!==i?(d=ke.map(e=>(0,$.jsxs)(K,{value:e.id,className:g(`group/tile flex flex-col gap-1.5 rounded-lg border-2 border-transparent p-1 text-left outline-none`,`hover:bg-accent/50 focus-visible:border-ring focus-visible:ring-2 focus-visible:ring-ring/40`,`data-checked:border-primary`),children:[(0,$.jsx)(Tr,{theme:e,customSeed:i}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between px-0.5`,children:[(0,$.jsx)(`span`,{className:`text-1sm font-medium text-foreground`,children:e.label}),(0,$.jsx)(`span`,{className:`text-[10px] font-medium uppercase tracking-wide text-muted-foreground`,children:e.id===`custom`?_n(vn(i))===`dark`?l({id:`pvnfJD`}):l({id:`1njn7W`}):e.kind===`system`?l({id:`R9Khdg`}):e.kind===`light`?l({id:`1njn7W`}):l({id:`pvnfJD`})})]})]},e.id)),t[0]=l,t[1]=i,t[2]=d):d=t[2];let f;return t[3]!==s||t[4]!==o||t[5]!==a||t[6]!==r||t[7]!==u||t[8]!==d?(f=(0,$.jsx)(W,{id:a,"aria-label":o,"aria-describedby":s,value:u,onValueChange:r,className:`grid w-full grid-cols-2 gap-2 sm:grid-cols-3`,children:d}),t[3]=s,t[4]=o,t[5]=a,t[6]=r,t[7]=u,t[8]=d,t[9]=f):f=t[9],f}function Or(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)]:Or(r,t)}}function kr(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 Ar(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 jr(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 Mr(e){if(!Ce(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 Nr(){let e=(0,Z.c)(3),t,n;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,$.jsx)(On,{className:`h-5 w-32`}),n=(0,$.jsx)(On,{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)(On,{className:`h-9 w-full`}),(0,$.jsx)(On,{className:`h-9 w-full`})]})]}),e[2]=r):r=e[2],r}function Pr({field:e,scope:t,commitField:n,isFlashed:r}){"use no memo";let{_:i}=c(),a=Zn(),o=je(Me,e.path),l=o?Ar(o):void 0,u=o?kr(o):void 0,d=o?jr(o):void 0,f=o?Te(o):void 0,p=f?.scope===`project`&&t!==`project`||f?.scope===`user`&&t!==`user`,m=e.path.join(`.`),h=i(e.label),[_,S]=(0,Q.useState)(!1),C=(0,Q.useRef)(null);(0,Q.useEffect)(()=>()=>{C.current&&clearTimeout(C.current)},[]);let w=()=>{S(!0),C.current&&clearTimeout(C.current),C.current=setTimeout(()=>S(!1),1200)},T=()=>{let e=n(m);return e&&w(),e},E=()=>a.getFieldState(m).isDirty?T():!0,D=()=>{let e=u===void 0?null:u;a.setValue(m,e,{shouldDirty:!1}),T()},O=g(`relative`,r&&`animate-settings-flash`);return(0,$.jsx)(Jn,{control:a.control,name:m,render:({field:n})=>{let r=!p&&(u!==void 0||n.value!==void 0);return(0,$.jsxs)(Kn,{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)(Xn,{className:`text-sm font-medium`,children:h}),r?(0,$.jsxs)(x,{children:[(0,$.jsx)(y,{asChild:!0,children:(0,$.jsx)(v,{variant:`ghost`,size:`icon`,className:`h-5 w-5 text-muted-foreground opacity-60 hover:opacity-100`,onClick:D,"aria-label":i({id:`lhjq3G`,values:{labelText:h}}),children:(0,$.jsx)(Zt,{className:`size-3.5`})})}),(0,$.jsx)(b,{children:(0,$.jsx)(s,{id:`L-rMC9`})})]}):null]}),e.description?(0,$.jsx)(Qn,{className:`text-muted-foreground text-1sm`,children:i(e.description)}):null,(0,$.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Yn,{children:(0,$.jsx)(Fr,{field:e,ctl:n,typeTag:l,enumOptions:d,onCommit:E})}),(0,$.jsx)(zr,{visible:_,srOnly:e.control===`theme-tiles`})]}),(0,$.jsx)($n,{"data-field-error":e.path.join(`.`)})]})}})}function Fr({field:e,ctl:t,typeTag:n,enumOptions:r,onCommit:i,...a}){"use no memo";let{_:o}=c(),{setTheme:s}=u(),l=wn()?.merged??null;if(e.control===`theme-tiles`){let{id:n,...r}=a,c=l?.appearance?.customTheme;return(0,$.jsx)(Dr,{...r,id:n,value:typeof t.value==`string`?t.value:`default`,customSeed:c,"aria-label":o(e.label),onSelect:e=>{if(bn(e,c),e===`custom`)s(_n(vn(c))===`dark`?`dark`:`light`);else{let t=_e(e);t&&s(t)}t.onChange(e),i()}})}if(n===`boolean`)return(0,$.jsx)(U,{...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)(ne,{...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)(te,{value:e,id:t===0?n:void 0,className:`text-1sm capitalize`,children:e},e))})}return n===`number`||n===`int`?(0,$.jsx)(Lr,{ctl:t,onCommit:i,...a}):n===`array`?(0,$.jsx)(Rr,{ctl:t,onCommit:i,...a}):(0,$.jsx)(Ir,{ctl:t,onCommit:i,...a})}function Ir({ctl:e,onCommit:t,...n}){"use no memo";return(0,$.jsx)(an,{...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 Lr({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)(an,{...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 Rr({ctl:e,onCommit:t,...n}){"use no memo";let r=Array.isArray(e.value)?e.value.join(`
2
2
  `):``,[i,a]=(0,Q.useState)(r),o=(0,Q.useRef)(r);(0,Q.useEffect)(()=>{let t=Array.isArray(e.value)?e.value.join(`
3
3
  `):``;t!==o.current&&(a(t),o.current=t)},[e.value]);let s=()=>{let n=i.split(`
4
4
  `).map(e=>e.trim()).filter(e=>e.length>0);e.onChange(n),t(),o.current=n.join(`
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-TkFkuYVg.js";import{a as l,i as u,n as d,r as f}from"./pending-receive-nav-store-uQRZ6j0p.js";import{t as p}from"./miss-dialog-store-Bx4JLuKB.js";import{c as m,s as h}from"./doc-hash-BSK-KaTu.js";var g=r(),_=e(n(),1),v=t();function y(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function b(){let e=(0,g.c)(2),t=(0,_.useSyncExternalStore)(p.subscribe,p.getSnapshot,x);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,v.jsx)(S,{nav:t},t.path),e[0]=t,e[1]=n),n}function x(){return null}function S(e){let t=(0,g.c)(29),{nav:n}=e,{state:r,refetch:_}=l(n),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(){p.dismiss()},t[0]=b):b=t[0];let x=b,S;t[1]===n.path?S=t[2]:(S=function(){window.location.hash=m(u(n.path)),x()},t[1]=n.path,t[2]=S);let C=S,w;t[3]!==n.branch||t[4]!==n.kind?(w=function(e){d.arm({kind:n.kind,path:e,branch:n.branch}),window.location.hash=n.kind===`folder`?m(e):h(e),x()},t[3]=n.branch,t[4]=n.kind,t[5]=w):w=t[5];let T=w,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||x()},t[6]=E):E=t[6];let D=r.phase,O=r.phase===`resolved`?r.resolution.verdict:void 0,k;t[7]===n.path?k=t[8]:(k=y(n.path),t[7]=n.path,t[8]=k);let A;t[9]===k?A=t[10]:(A=(0,v.jsx)(s,{children:(0,v.jsx)(i,{className:`truncate`,children:k})}),t[9]=k,t[10]=A);let j=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,M;t[11]!==n.path||t[12]!==T?(M=()=>T(n.path),t[11]=n.path,t[12]=T,t[13]=M):M=t[13];let N;t[14]!==C||t[15]!==n||t[16]!==T||t[17]!==_||t[18]!==r||t[19]!==M?(N=(0,v.jsx)(f,{nav:n,state:r,onBrowseFolder:C,onOpenRenamed:T,onEnableAutoSync:x,onSyncCompleted:_,onPullApplied:M}),t[14]=C,t[15]=n,t[16]=T,t[17]=_,t[18]=r,t[19]=M,t[20]=N):N=t[20];let P;t[21]!==N||t[22]!==j?(P=(0,v.jsx)(o,{className:j,children:N}),t[21]=N,t[22]=j,t[23]=P):P=t[23];let F;return t[24]!==r.phase||t[25]!==P||t[26]!==O||t[27]!==A?(F=(0,v.jsx)(c,{open:!0,onOpenChange:E,children:(0,v.jsxs)(a,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":D,"data-verdict":O,children:[A,P]})}),t[24]=r.phase,t[25]=P,t[26]=O,t[27]=A,t[28]=F):F=t[28],F}export{b as ShareReceiveMissDialog};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{t as r}from"./compiler-runtime-BfE3aGVn.js";import{c as i,i as a,n as o,s,t as c}from"./dialog-TkFkuYVg.js";import{a as l,i as u,n as d,r as f}from"./pending-receive-nav-store-h6XBq4Wh.js";import{t as p}from"./miss-dialog-store-Bx4JLuKB.js";import{c as m,s as h}from"./doc-hash-BSK-KaTu.js";var g=r(),_=e(n(),1),v=t();function y(e){let t=e.split(`/`).filter(Boolean);return t.length>0?t[t.length-1]:e}function b(){let e=(0,g.c)(2),t=(0,_.useSyncExternalStore)(p.subscribe,p.getSnapshot,x);if(t===null)return null;let n;return e[0]===t?n=e[1]:(n=(0,v.jsx)(S,{nav:t},t.path),e[0]=t,e[1]=n),n}function x(){return null}function S(e){let t=(0,g.c)(29),{nav:n}=e,{state:r,refetch:_}=l(n),b;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(){p.dismiss()},t[0]=b):b=t[0];let x=b,S;t[1]===n.path?S=t[2]:(S=function(){window.location.hash=m(u(n.path)),x()},t[1]=n.path,t[2]=S);let C=S,w;t[3]!==n.branch||t[4]!==n.kind?(w=function(e){d.arm({kind:n.kind,path:e,branch:n.branch}),window.location.hash=n.kind===`folder`?m(e):h(e),x()},t[3]=n.branch,t[4]=n.kind,t[5]=w):w=t[5];let T=w,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=e=>{e||x()},t[6]=E):E=t[6];let D=r.phase,O=r.phase===`resolved`?r.resolution.verdict:void 0,k;t[7]===n.path?k=t[8]:(k=y(n.path),t[7]=n.path,t[8]=k);let A;t[9]===k?A=t[10]:(A=(0,v.jsx)(s,{children:(0,v.jsx)(i,{className:`truncate`,children:k})}),t[9]=k,t[10]=A);let j=r.phase===`pending`?`flex flex-col items-center justify-center gap-3 py-6 text-center text-sm text-muted-foreground`:`flex flex-col items-center justify-center gap-6 py-2 text-center`,M;t[11]!==n.path||t[12]!==T?(M=()=>T(n.path),t[11]=n.path,t[12]=T,t[13]=M):M=t[13];let N;t[14]!==C||t[15]!==n||t[16]!==T||t[17]!==_||t[18]!==r||t[19]!==M?(N=(0,v.jsx)(f,{nav:n,state:r,onBrowseFolder:C,onOpenRenamed:T,onEnableAutoSync:x,onSyncCompleted:_,onPullApplied:M}),t[14]=C,t[15]=n,t[16]=T,t[17]=_,t[18]=r,t[19]=M,t[20]=N):N=t[20];let P;t[21]!==N||t[22]!==j?(P=(0,v.jsx)(o,{className:j,children:N}),t[21]=N,t[22]=j,t[23]=P):P=t[23];let F;return t[24]!==r.phase||t[25]!==P||t[26]!==O||t[27]!==A?(F=(0,v.jsx)(c,{open:!0,onOpenChange:E,children:(0,v.jsxs)(a,{className:`sm:max-w-md`,"data-testid":`share-receive-miss-dialog`,"data-phase":D,"data-verdict":O,children:[A,P]})}),t[24]=r.phase,t[25]=P,t[26]=O,t[27]=A,t[28]=F):F=t[28],F}export{b as ShareReceiveMissDialog};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{M as n,T as r,nt as i,rt as a}from"./DocumentContext-B8Qoku71.js";import{t as o}from"./react-f2sANaYj.js";import{n as s}from"./dist-PQ5KMVDh.js";import{t as c}from"./compiler-runtime-BfE3aGVn.js";import{E as l,a as u,i as ee,o as d}from"./CodeMirrorPropInput-C-g_G-yI.js";import{Dn as f,E as p,Hi as te,L as m,Tr as h,oi as g}from"./dist-Cal4LUep.js";import{g as ne}from"./use-settings-route-CXFzIfYo.js";import"./config-provider-psmEp7UZ.js";import{Dt as _,Et as v,It as y,J as b,Ot as re,P as x,Q as S,X as C,dt as ie,mt as ae}from"./dist-DNwOaDhC.js";import{o as oe}from"./esm-HV7Pxfbn.js";import{n as se}from"./config-context-gd3BC-iY.js";import{o as ce,r as le}from"./selection-context-CwFGy9Md.js";import{c as ue,g as de,n as fe,r as pe,v as me,y as he}from"./typing-burst-detector-D7A5ERs3.js";import{l as ge}from"./lint-config-client-G_mrikOJ.js";import{i as _e,n as w,r as T,t as ve}from"./dist-B1qkpf98.js";import{t as ye}from"./src-dGfXUun_.js";var E=e(o(),1),be=c();function xe(e,t){return e.enabled?[w(),T(async n=>O(n.state.doc,await h(n.state.doc.toString(),e,t)),{delay:600})]:[]}function D(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function O(e,t){let n=[];for(let r of t){let t=D(e,r.range.start),i=D(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=k(r);o&&(a.actions=[o]),n.push(a)}return n}function k(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:D(n,e.range.start),to:D(n,e.range.end),insert:e.newText}))})}}}var A=b.mark({class:`cm-link-ref-broken`}),j=/^\s{0,3}\[([^\]]+)\]:\s/,M=/\[([^\]]*)\]\[([^\]]*)\]/g,N=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function P(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function F(e){let t=[];return x(e).iterate({enter(e){if(N.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function I(e){let t=new Set,n=[],r=e.doc,i=F(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(P(n.from,i))continue;let a=j.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!P(t.from,i)&&!j.test(t.text))for(M.lastIndex=0;;){let e=M.exec(t.text);if(!e)break;let r=t.from+e.index;if(P(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(A.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),b.set(a)}var L=y.define({create(e){return I(e)},update(e,t){return t.docChanged?I(t.state):e},provide:e=>C.decorations.from(e)}),R=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,z=b.mark({class:`cm-del`}),B=b.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),V=b.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function H(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function U(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!m.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(m.test(r.text))return{from:t.from,to:r.to}}return null}function W(e,t){let n=[],r=x(e),i=U(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(z.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=R.exec(r.text),a=i?i[1].length:2,o=b.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=H(r.text),a=b.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(B.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(V.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(V.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),b.set(n)}var G=class{decorations;constructor(e){this.decorations=W(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||x(e.startState)!==x(e.state))&&(this.decorations=W(e.view.state,e.view.visibleRanges))}},K=S.fromClass(G,{decorations:e=>e.decorations});function Se(){return[K,L]}var Ce=t(),q=56;function we(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&m.test(n.line(1).text)){for(let e=2;e<=n.lines;e++)if(m.test(n.line(e).text)){r=e+1;break}}let i=f(),a=0;for(let o=r;o<=n.lines;o++){let r=n.line(o);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(a===t.index){e.dispatch({selection:_.cursor(r.from),effects:C.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function Te(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:_.cursor(r),effects:C.scrollIntoView(r,{y:`center`})}),e.focus()})}function Ee(e,t){let n=e.state.doc,r=Math.min(Math.max(t.line,1),n.lines),i=n.line(r),a=Math.min(i.from+Math.max(0,t.column-1),i.to);e.dispatch({selection:_.cursor(a),effects:C.scrollIntoView(a,{y:`start`})}),e.focus()}function J(e){let t=(0,be.c)(49),{docName:o,ytext:c,provider:l,placeholder:f,isSourceModeActive:m}=e,h=(0,E.useRef)(null),_=(0,E.useRef)(null),[y,b]=(0,E.useState)(null);if(y)throw y;let{resolvedTheme:x}=s(),{merged:S}=se(),w=(0,E.useRef)(m),T=S?.editor?.wordWrap??!0,{data:D}=ge(o),O;t[0]!==D?.effective||t[1]!==S?(O=D?.effective??(S?.contentRules?g(S.contentRules):p),t[0]=D?.effective,t[1]=S,t[2]=O):O=t[2];let k=O,A;t[3]===k?A=t[4]:(A=JSON.stringify(k),t[3]=k,t[4]=A);let j=A,M,N;t[5]===m?(M=t[6],N=t[7]):(M=()=>{w.current=m},N=[m],t[5]=m,t[6]=M,t[7]=N),(0,E.useEffect)(M,N);let P=(0,E.useRef)(null),F;t[8]!==o||t[9]!==k||t[10]!==f||t[11]!==l||t[12]!==x||t[13]!==T||t[14]!==c?(F=()=>{let e=h.current;if(!e)return;let t=l.configuration.name??``,s,u=ke;try{s=i({docName:t,container:e,sizeStats:{viewCount:0,bytes:c.length},factory:e=>{let i=null,a=r({ydoc:l.document,ytext:c}),s=new v,d=new v,p=new v,m=new v,h=new C({state:re.create({doc:c.toString(),extensions:[ve,_e({scrollToMatch:Oe}),ie.of([oe]),ye(c,l.awareness),...ee({themeCompartment:s,resolvedTheme:x,ydoc:l.document,wordWrapCompartment:d,wordWrap:T,currentDocName:t}),Se(),m.of(xe(k,o)),a,C.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(i!==null&&clearTimeout(i),i=setTimeout(()=>{i=null,fe(t,`source`,pe(e.view)),le(t,`source`,ce(e.view,t))},120))}),C.domEventHandlers({keydown:(e,t)=>!w.current||!te()||!ne(e,`edit-with-ai`)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),n(),!0)}),p.of(ae(f??``)),C.theme({"&":{height:`100%`}}),C.scrollMargins.of(De)]}),parent:e});fe(t,`source`,pe(h)),le(t,`source`,ce(h,t));let g=h.contentDOM;return g.addEventListener(`keydown`,u),g.addEventListener(`paste`,u),g.addEventListener(`drop`,u),g.addEventListener(`cut`,u),{view:h,ydoc:l.document,ytext:c,provider:l,themeCompartment:s,wordWrapCompartment:d,placeholderCompartment:p,lintCompartment:m}}}),P.current=s,_.current=s.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),P.current=null,_.current=null,b(t instanceof Error?t:Error(String(t)))}return()=>{let e=P.current;e&&a(e),P.current=null,_.current=null}},t[8]=o,t[9]=k,t[10]=f,t[11]=l,t[12]=x,t[13]=T,t[14]=c,t[15]=F):F=t[15];let I;t[16]!==l||t[17]!==c?(I=[c,l],t[16]=l,t[17]=c,t[18]=I):I=t[18],(0,E.useEffect)(F,I);let L,R;t[19]===o?(L=t[20],R=t[21]):(L=()=>{},R=[o],t[19]=o,t[20]=L,t[21]=R),(0,E.useEffect)(L,R);let z,B;t[22]===x?(z=t[23],B=t[24]):(B=()=>{let e=P.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(x===`dark`?u:d)})},z=[x],t[22]=x,t[23]=z,t[24]=B),(0,E.useEffect)(B,z);let V,H;t[25]===T?(V=t[26],H=t[27]):(V=()=>{let e=P.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(T?C.lineWrapping:[])})},H=[T],t[25]=T,t[26]=V,t[27]=H),(0,E.useEffect)(V,H);let U,W;t[28]===f?(U=t[29],W=t[30]):(U=()=>{let e=P.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ae(f??``))})},W=[f],t[28]=f,t[29]=U,t[30]=W),(0,E.useEffect)(U,W);let G;t[31]!==o||t[32]!==k?(G=()=>{let e=P.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(xe(k,o))})},t[31]=o,t[32]=k,t[33]=G):G=t[33];let K;t[34]===j?K=t[35]:(K=[j],t[34]=j,t[35]=K),(0,E.useEffect)(G,K);let q,J;t[36]!==o||t[37]!==m?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!m)return;let n=_.current;n&&(we(n,t),me(o))};return window.addEventListener(de,e),()=>window.removeEventListener(de,e)},J=[o,m],t[36]=o,t[37]=m,t[38]=q,t[39]=J):(q=t[38],J=t[39]),(0,E.useEffect)(q,J);let Y,X;t[40]!==o||t[41]!==m?(Y=()=>{let e=function(e){let t=e.detail;if(!t||!m)return;let n=_.current;n&&(Ee(n,t),me(o))};return window.addEventListener(ue,e),()=>window.removeEventListener(ue,e)},X=[o,m],t[40]=o,t[41]=m,t[42]=Y,t[43]=X):(Y=t[42],X=t[43]),(0,E.useEffect)(Y,X);let Z,Q;t[44]!==o||t[45]!==m?(Z=()=>{if(!m)return;let e=_.current;if(!e)return;let t=he(o);if(t){if(t.kind===`outline`){we(e,t.detail);return}if(t.kind===`lint`){Ee(e,t.detail);return}Te(e,t.detail)}},Q=[o,m],t[44]=o,t[45]=m,t[46]=Z,t[47]=Q):(Z=t[46],Q=t[47]),(0,E.useEffect)(Z,Q);let $;return t[48]===Symbol.for(`react.memo_cache_sentinel`)?($=(0,Ce.jsx)(`div`,{ref:h,className:`source-editor h-full pb-3`}),t[48]=$):$=t[48],$}function De(){return{top:q}}function Oe(e){return C.scrollIntoView(e,{y:`start`})}function ke(){return l()}export{J as SourceEditor};
1
+ import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{M as n,T as r,nt as i,rt as a}from"./DocumentContext-CpOTF1vT.js";import{t as o}from"./react-f2sANaYj.js";import{n as s}from"./dist-PQ5KMVDh.js";import{t as c}from"./compiler-runtime-BfE3aGVn.js";import{E as l,a as u,i as ee,o as d}from"./CodeMirrorPropInput-L6IjOKBK.js";import{Dn as f,E as p,Hi as te,L as m,Tr as h,oi as g}from"./dist-Cal4LUep.js";import{g as ne}from"./use-settings-route-CXFzIfYo.js";import"./config-provider-Bd6kn_Wi.js";import{Dt as _,Et as v,It as y,J as b,Ot as re,P as x,Q as S,X as C,dt as ie,mt as ae}from"./dist-DNwOaDhC.js";import{o as oe}from"./esm-HV7Pxfbn.js";import{n as se}from"./config-context-gd3BC-iY.js";import{o as ce,r as le}from"./selection-context-BeZk6OlH.js";import{c as ue,g as de,n as fe,r as pe,v as me,y as he}from"./typing-burst-detector-zU1P7TwH.js";import{l as ge}from"./lint-config-client-G_mrikOJ.js";import{i as _e,n as w,r as T,t as ve}from"./dist-B1qkpf98.js";import{t as ye}from"./src-IvJo911P.js";var E=e(o(),1),be=c();function xe(e,t){return e.enabled?[w(),T(async n=>O(n.state.doc,await h(n.state.doc.toString(),e,t)),{delay:600})]:[]}function D(e,t){let n=Math.min(Math.max(t.line+1,1),e.lines),r=e.line(n);return Math.min(r.from+Math.max(0,t.character),r.to)}function O(e,t){let n=[];for(let r of t){let t=D(e,r.range.start),i=D(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=k(r);o&&(a.actions=[o]),n.push(a)}return n}function k(e){let t=e.fixes;return!t||t.length===0?null:{name:`Fix`,apply(e){let n=e.state.doc;e.dispatch({changes:t.map(e=>({from:D(n,e.range.start),to:D(n,e.range.end),insert:e.newText}))})}}}var A=b.mark({class:`cm-link-ref-broken`}),j=/^\s{0,3}\[([^\]]+)\]:\s/,M=/\[([^\]]*)\]\[([^\]]*)\]/g,N=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function P(e,t){let n=0,r=t.length-1;for(;n<=r;){let i=n+r>>1,a=t[i];if(e<a.from)r=i-1;else if(e>=a.to)n=i+1;else return!0}return!1}function F(e){let t=[];return x(e).iterate({enter(e){if(N.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function I(e){let t=new Set,n=[],r=e.doc,i=F(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(P(n.from,i))continue;let a=j.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!P(t.from,i)&&!j.test(t.text))for(M.lastIndex=0;;){let e=M.exec(t.text);if(!e)break;let r=t.from+e.index;if(P(r,i))continue;let a=e[2]||e[1];n.push({from:r,to:r+e[0].length,label:a.toLowerCase()})}}let a=[];for(let e of n)t.has(e.label)||a.push(A.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),b.set(a)}var L=y.define({create(e){return I(e)},update(e,t){return t.docChanged?I(t.state):e},provide:e=>C.decorations.from(e)}),R=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,z=b.mark({class:`cm-del`}),B=b.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),V=b.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function H(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function U(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!m.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(m.test(r.text))return{from:t.from,to:r.to}}return null}function W(e,t){let n=[],r=x(e),i=U(e),a=e=>i!==null&&e>=i.from&&e<=i.to;for(let{from:i,to:o}of t)r.iterate({from:i,to:o,enter(t){if(!a(t.from)){if(t.name===`Strikethrough`){let e=t.from,r=t.to,i=t.node.cursor();if(i.firstChild())do i.name===`StrikethroughMark`&&(i.from===t.from?e=i.to:r=i.from);while(i.nextSibling());return e<r&&n.push(z.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=R.exec(r.text),a=i?i[1].length:2,o=b.line({class:`cm-list-item`,attributes:{style:`--list-hang: ${a}ch`}});n.push(o.range(r.from));return}if(t.name===`FencedCode`){let r=e.doc.lineAt(t.from),i=e.doc.lineAt(t.to);for(let t=r.number+1;t<i.number;t++){let r=e.doc.line(t),i=H(r.text),a=b.line({class:`cm-fenced-code-line`,attributes:{style:`--line-indent: ${i}`}});n.push(a.range(r.from))}return!1}if(t.name===`TableHeader`){let r=e.doc.lineAt(t.from);return n.push(B.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(V.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(V.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),b.set(n)}var G=class{decorations;constructor(e){this.decorations=W(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||x(e.startState)!==x(e.state))&&(this.decorations=W(e.view.state,e.view.visibleRanges))}},K=S.fromClass(G,{decorations:e=>e.decorations});function Se(){return[K,L]}var Ce=t(),q=56;function we(e,t){let n=e.state.doc,r=1;if(n.lines>=1&&m.test(n.line(1).text)){for(let e=2;e<=n.lines;e++)if(m.test(n.line(e).text)){r=e+1;break}}let i=f(),a=0;for(let o=r;o<=n.lines;o++){let r=n.line(o);if(!i(r.text)&&/^#{1,6}\s/.test(r.text)){if(a===t.index){e.dispatch({selection:_.cursor(r.from),effects:C.scrollIntoView(r.from,{y:`start`})}),e.focus();return}a++}}}function Te(e,t){requestAnimationFrame(()=>{let n=e.state.doc,r=Math.min(t.offset,n.length);e.dispatch({selection:_.cursor(r),effects:C.scrollIntoView(r,{y:`center`})}),e.focus()})}function Ee(e,t){let n=e.state.doc,r=Math.min(Math.max(t.line,1),n.lines),i=n.line(r),a=Math.min(i.from+Math.max(0,t.column-1),i.to);e.dispatch({selection:_.cursor(a),effects:C.scrollIntoView(a,{y:`start`})}),e.focus()}function J(e){let t=(0,be.c)(49),{docName:o,ytext:c,provider:l,placeholder:f,isSourceModeActive:m}=e,h=(0,E.useRef)(null),_=(0,E.useRef)(null),[y,b]=(0,E.useState)(null);if(y)throw y;let{resolvedTheme:x}=s(),{merged:S}=se(),w=(0,E.useRef)(m),T=S?.editor?.wordWrap??!0,{data:D}=ge(o),O;t[0]!==D?.effective||t[1]!==S?(O=D?.effective??(S?.contentRules?g(S.contentRules):p),t[0]=D?.effective,t[1]=S,t[2]=O):O=t[2];let k=O,A;t[3]===k?A=t[4]:(A=JSON.stringify(k),t[3]=k,t[4]=A);let j=A,M,N;t[5]===m?(M=t[6],N=t[7]):(M=()=>{w.current=m},N=[m],t[5]=m,t[6]=M,t[7]=N),(0,E.useEffect)(M,N);let P=(0,E.useRef)(null),F;t[8]!==o||t[9]!==k||t[10]!==f||t[11]!==l||t[12]!==x||t[13]!==T||t[14]!==c?(F=()=>{let e=h.current;if(!e)return;let t=l.configuration.name??``,s,u=ke;try{s=i({docName:t,container:e,sizeStats:{viewCount:0,bytes:c.length},factory:e=>{let i=null,a=r({ydoc:l.document,ytext:c}),s=new v,d=new v,p=new v,m=new v,h=new C({state:re.create({doc:c.toString(),extensions:[ve,_e({scrollToMatch:Oe}),ie.of([oe]),ye(c,l.awareness),...ee({themeCompartment:s,resolvedTheme:x,ydoc:l.document,wordWrapCompartment:d,wordWrap:T,currentDocName:t}),Se(),m.of(xe(k,o)),a,C.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(i!==null&&clearTimeout(i),i=setTimeout(()=>{i=null,fe(t,`source`,pe(e.view)),le(t,`source`,ce(e.view,t))},120))}),C.domEventHandlers({keydown:(e,t)=>!w.current||!te()||!ne(e,`edit-with-ai`)?!1:(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),n(),!0)}),p.of(ae(f??``)),C.theme({"&":{height:`100%`}}),C.scrollMargins.of(De)]}),parent:e});fe(t,`source`,pe(h)),le(t,`source`,ce(h,t));let g=h.contentDOM;return g.addEventListener(`keydown`,u),g.addEventListener(`paste`,u),g.addEventListener(`drop`,u),g.addEventListener(`cut`,u),{view:h,ydoc:l.document,ytext:c,provider:l,themeCompartment:s,wordWrapCompartment:d,placeholderCompartment:p,lintCompartment:m}}}),P.current=s,_.current=s.view}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),P.current=null,_.current=null,b(t instanceof Error?t:Error(String(t)))}return()=>{let e=P.current;e&&a(e),P.current=null,_.current=null}},t[8]=o,t[9]=k,t[10]=f,t[11]=l,t[12]=x,t[13]=T,t[14]=c,t[15]=F):F=t[15];let I;t[16]!==l||t[17]!==c?(I=[c,l],t[16]=l,t[17]=c,t[18]=I):I=t[18],(0,E.useEffect)(F,I);let L,R;t[19]===o?(L=t[20],R=t[21]):(L=()=>{},R=[o],t[19]=o,t[20]=L,t[21]=R),(0,E.useEffect)(L,R);let z,B;t[22]===x?(z=t[23],B=t[24]):(B=()=>{let e=P.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(x===`dark`?u:d)})},z=[x],t[22]=x,t[23]=z,t[24]=B),(0,E.useEffect)(B,z);let V,H;t[25]===T?(V=t[26],H=t[27]):(V=()=>{let e=P.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(T?C.lineWrapping:[])})},H=[T],t[25]=T,t[26]=V,t[27]=H),(0,E.useEffect)(V,H);let U,W;t[28]===f?(U=t[29],W=t[30]):(U=()=>{let e=P.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ae(f??``))})},W=[f],t[28]=f,t[29]=U,t[30]=W),(0,E.useEffect)(U,W);let G;t[31]!==o||t[32]!==k?(G=()=>{let e=P.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(xe(k,o))})},t[31]=o,t[32]=k,t[33]=G):G=t[33];let K;t[34]===j?K=t[35]:(K=[j],t[34]=j,t[35]=K),(0,E.useEffect)(G,K);let q,J;t[36]!==o||t[37]!==m?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.mode!==`source`||!m)return;let n=_.current;n&&(we(n,t),me(o))};return window.addEventListener(de,e),()=>window.removeEventListener(de,e)},J=[o,m],t[36]=o,t[37]=m,t[38]=q,t[39]=J):(q=t[38],J=t[39]),(0,E.useEffect)(q,J);let Y,X;t[40]!==o||t[41]!==m?(Y=()=>{let e=function(e){let t=e.detail;if(!t||!m)return;let n=_.current;n&&(Ee(n,t),me(o))};return window.addEventListener(ue,e),()=>window.removeEventListener(ue,e)},X=[o,m],t[40]=o,t[41]=m,t[42]=Y,t[43]=X):(Y=t[42],X=t[43]),(0,E.useEffect)(Y,X);let Z,Q;t[44]!==o||t[45]!==m?(Z=()=>{if(!m)return;let e=_.current;if(!e)return;let t=he(o);if(t){if(t.kind===`outline`){we(e,t.detail);return}if(t.kind===`lint`){Ee(e,t.detail);return}Te(e,t.detail)}},Q=[o,m],t[44]=o,t[45]=m,t[46]=Z,t[47]=Q):(Z=t[46],Q=t[47]),(0,E.useEffect)(Z,Q);let $;return t[48]===Symbol.for(`react.memo_cache_sentinel`)?($=(0,Ce.jsx)(`div`,{ref:h,className:`source-editor h-full pb-3`}),t[48]=$):$=t[48],$}function De(){return{top:q}}function Oe(e){return C.scrollIntoView(e,{y:`start`})}function ke(){return l()}export{J as SourceEditor};