@inkeep/open-knowledge 0.86.23-beta.0 → 0.86.23-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +6 -6
- package/dist/constants-Iymgoe5U.mjs +1 -0
- package/dist/index.mjs +1 -1
- package/dist/{init-Cm89v8Xi.mjs → init-BMQUc4ul.mjs} +2 -2
- package/dist/init-Dq5MuSis.mjs +1 -0
- package/dist/{launch-json-removal-fS0NXdND.mjs → launch-json-removal-DaL2BiQh.mjs} +1 -1
- package/dist/loader-D6muyenS.mjs +1 -0
- package/dist/{loader-C95tIva3.mjs → loader-DX_l-d9D.mjs} +1 -1
- package/dist/{preview-DZRElswd.mjs → preview-DTwOZM1t.mjs} +1 -1
- package/dist/preview-DZgLv5oB.mjs +1 -0
- package/dist/public/assets/{AccountSection-BVjZBoES.js → AccountSection-ZhKVAZRz.js} +1 -1
- package/dist/public/assets/{ActivityModeContent-CoHF_gnh.js → ActivityModeContent-Cu3J2wnZ.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-CYDU0_-q.js → AddPropertiesButton-BiF-H17k.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-Cl_3oYJE.js → AgentDiffPane-h67Ihyuy.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-IYSFEmCT.js → AttachmentsSection-6uV_ZVHZ.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-C4twOWg9.js → CodeMirrorPropInput-_HrEupqc.js} +1 -1
- package/dist/public/assets/{ContentRulesSection-Cy2iebbj.js → ContentRulesSection-Br4OQaTJ.js} +1 -1
- package/dist/public/assets/{DocumentContext-DvbRWp3l.js → DocumentContext-B6cmniqU.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-BPKJDvW2.js → EditorModeToggle-DaLqaw6f.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-AKrXbagc.js → ExcalidrawDocEditor-Dtti2_8y.js} +1 -1
- package/dist/public/assets/FeedbackForm-Cy3p2I18.js +1 -0
- package/dist/public/assets/{ImportSkillDialog-DA5V3vTp.js → ImportSkillDialog-DooL2Y3J.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-BK_VujeD.js → LinkPreviewsSection-BrZydaih.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-Br64-ZiC.js → LintConfigEditor-D5WZW3Kb.js} +1 -1
- package/dist/public/assets/{LintingSection-BZt9ON8F.js → LintingSection-CU-sc0Ur.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-C2PsrqWE.js → ManagedArtifactProperties-BvSP1BV4.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-DXW12uSQ.js +1 -0
- package/dist/public/assets/{MermaidDocEditor-BAvcjPw_.js → MermaidDocEditor-DwEaCHNY.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-BE_FE25E.js → NetworkAccessSection-Ci0dBnda.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-BOYcZEUU.js → PropertyDisplayRow-B6_pfxvN.js} +1 -1
- package/dist/public/assets/{PublishToGitHubDialog-18N1T5qL.js → PublishToGitHubDialog-DdtYAP9Y.js} +1 -1
- package/dist/public/assets/{SchemaConfigEditor-BHQHHYgU.js → SchemaConfigEditor-DlSrtrC2.js} +1 -1
- package/dist/public/assets/{SearchSection-CtemEd7d.js → SearchSection-DUCXR4Qf.js} +1 -1
- package/dist/public/assets/SessionsHost-CBIKgs04.js +2 -0
- package/dist/public/assets/{SettingsDialogBody-Bno3kKmn.js → SettingsDialogBody-CKjYKbWt.js} +2 -2
- package/dist/public/assets/{ShareReceiveMissDialog-U2EHS1uL.js → ShareReceiveMissDialog-CDei4CzD.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-C7fY-mJs.js → SkillToolbarControls-BVFLkdZj.js} +1 -1
- package/dist/public/assets/{SourceEditor-C-G5e44O.js → SourceEditor-CJRzYB7x.js} +1 -1
- package/dist/public/assets/{SyncSection-CZLVQSW3.js → SyncSection-DrCPevDV.js} +1 -1
- package/dist/public/assets/{SyncStatusBadge-DHRx1bqM.js → SyncStatusBadge-CF1z14DG.js} +1 -1
- package/dist/public/assets/{TerminalPanel-BKIxzbz3.js → TerminalPanel-D93jMQs_.js} +1 -1
- package/dist/public/assets/{TerminalSection-TLomVk80.js → TerminalSection-DjyjBYpU.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-CJSZN0dW.js → TerminalWindowApp-CZN9GQ0B.js} +1 -1
- package/dist/public/assets/{TextDocEditor-DqqSFRlb.js → TextDocEditor-219p4L8n.js} +1 -1
- package/dist/public/assets/{ThreadView-BomEeVEG.js → ThreadView-HjOlpdvu.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-DxSkLGZO.js → TimelineDiffPane-BNO514Vt.js} +1 -1
- package/dist/public/assets/{client-version-D7T2EsHi.js → client-version-CCcGb1GY.js} +1 -1
- package/dist/public/assets/{comment-chips-pHMesJY8.js → comment-chips-Dlk_Uy8T.js} +1 -1
- package/dist/public/assets/{config-provider-XgOiT52f.js → config-provider-DY_fun1v.js} +1 -1
- package/dist/public/assets/{doc-undo-manager-CBMYbYB_.js → doc-undo-manager-Dm2bBXP2.js} +1 -1
- package/dist/public/assets/index-kLtGZT70.js +2209 -0
- package/dist/public/assets/{lint-plugins-2r6I9zxf.js → lint-plugins-DH147HA7.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-BYOZNhry.js → pending-receive-nav-store-D2Wl34aG.js} +1 -1
- package/dist/public/assets/{preferred-session-events-DYXcUDcT.js → preferred-session-events-C_8_bodB.js} +1 -1
- package/dist/public/assets/{progress-DYv5uhkl.js → progress-CdWJE0cw.js} +1 -1
- package/dist/public/assets/{reveal-editor-SLzwvD1I.js → reveal-editor-ChTC5Vss.js} +1 -1
- package/dist/public/assets/{selection-context-DsOL83qw.js → selection-context-DYlfZmRT.js} +1 -1
- package/dist/public/assets/{src-BJwX3eee.js → src-Ca8kxD9e.js} +1 -1
- package/dist/public/assets/{telemetry-impl-BzeBx635.js → telemetry-impl-BHjyIgsL.js} +1 -1
- package/dist/public/assets/{telemetry-startup-CZ4d9lDQ.js → telemetry-startup-BBS84TAP.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-Bgsdpwz2.js → typing-burst-detector-DjSPAHC0.js} +1 -1
- package/dist/public/assets/{use-activity-panel-b2uO_q1d.js → use-activity-panel-BNET4arK.js} +1 -1
- package/dist/public/assets/{use-open-skill-DHZCUXJl.js → use-open-skill-DbYpOsHm.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-CKtacdLs.js → use-terminal-enabled-BSpJ-tlQ.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-CJ74dVx4.js → use-timeline-entry-diff-ndwvvpVg.js} +1 -1
- package/dist/public/index.html +20 -20
- package/dist/{registry-probes-Geo36jYd.mjs → registry-probes-vIdTG_Zj.mjs} +1 -1
- package/dist/{removal-file-path-DmLILHKq.mjs → removal-file-path-B4b_lrPp.mjs} +1 -1
- package/dist/{repair-launch-json-17c1P8Be.mjs → repair-launch-json-N6361aUT.mjs} +1 -1
- package/dist/{repair-mcp-configs-FaVp0WPm.mjs → repair-mcp-configs-B68Xkqv7.mjs} +1 -1
- package/dist/src-DDe9AS2s.mjs +1 -0
- package/dist/{src-BcR9UuZe.mjs → src-f-qHxbxU.mjs} +1 -1
- package/dist/{start-CqpDF2BZ.mjs → start-BoUYvOQO.mjs} +2 -2
- package/dist/start-tvNfnwWU.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-By4R8-uX.mjs +0 -1
- package/dist/init-BlaAYYwU.mjs +0 -1
- package/dist/loader-Cw-S1fW6.mjs +0 -1
- package/dist/preview-aa1rCKsw.mjs +0 -1
- package/dist/public/assets/FeedbackForm-CRGgaSe0.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-Cp4wmQq3.js +0 -1
- package/dist/public/assets/SessionsHost-DKxZ8pxJ.js +0 -2
- package/dist/public/assets/index-CgakiuU1.js +0 -2209
- package/dist/src-LBH_QDrh.mjs +0 -1
- package/dist/start-ERGYXvxq.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{At as n,Bt as r,Cn as i,Dt as a,Pt as o,Qn as s,Sn as c,an as l,kt as u,qn as ee,rn as te,st as ne,zt as d}from"./DocumentContext-DvbRWp3l.js";import{t as f}from"./react-f2sANaYj.js";import{n as p}from"./dist-PQ5KMVDh.js";import{t as m}from"./compiler-runtime-BfE3aGVn.js";import{ht as h}from"./schemas-api-CL5ZXlEj.js";import{i as g}from"./use-apply-config-theme-CYFG76sS.js";import{H as re,I as _,L as ie,N as ae,T as oe,b as v,c as se,n as y,o as b,r as ce,t as le,v as x,w as ue,z as de}from"./typing-burst-detector-Bgsdpwz2.js";import{Bn as fe,Hn as S,Q as C,a as pe,gt as w,i as me,mt as T,o as he,x as E}from"./CodeMirrorPropInput-C4twOWg9.js";import{a as D,i as O}from"./constants-skills-BLHVRW90.js";import{t as k}from"./diagnostic-breadcrumb-DPgUDxA8.js";import{n as A}from"./perf-CPPbaRwr.js";import{m as ge}from"./config-provider-XgOiT52f.js";import{$ as j,At as M,Ct as N,E as P,J as F,K as I,Mt as L,N as R,Nt as z,Tt as _e,X as B,at as V,b as H,et as U,ft as ve,g as W,l as G,lt as K,ot as q,pt as J,st as Y,tt as X,ut as Z,v as ye,wt as be}from"./dist-BosZaL03.js";import{i as xe,t as Se}from"./dist-DTvyxWzB.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-D2c3re7d.js";import{o as De,r as Oe}from"./selection-context-DsOL83qw.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-BMeMGAz_.js";import{l as Me}from"./lint-config-client-B249C1D2.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dist-CRnJUJYV.js";import{n as Be,t as Ve}from"./src-BJwX3eee.js";var Q=e(f(),1),He=m();function Ue(){let e=d();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=R(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);O.lastIndex=0;for(let e=O.exec(t);e!==null;e=O.exec(t)){let t=e[2];if(!D(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(I.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:o,to:s}of t)i.iterate({from:o,to:s,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),o=i.length-i.replace(/^`+/,``).length,s=i.length-i.replace(/`+$/,``).length,c=i.slice(o,i.length-s),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&D(l)&&n!=null)return r.push(I.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+o,t.to-s)),!1;let u=a.exec(c);if(u)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+o,t.to-s)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(r)}function Ge(e){let t=n(e);return t===null?[]:[B.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),F.domEventHandlers({mousedown(n){let i=n.target?.closest?.(`[data-skill-ref]`),a=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(a!==void 0){n.preventDefault();let e=d()?.get(a);return e===void 0?o():window.location.hash=r(a,e),!0}let s=n.target?.closest?.(`.cm-skill-path-link`),c=s instanceof HTMLElement?s.dataset.skillPath:void 0;return c===void 0?!1:(n.preventDefault(),window.location.hash=u(t,e,c),!0)}})]}var Ke=I.line({attributes:{dir:`auto`}});function qe(e){let t=new M;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ke),r=n.to+1}return t.finish()}var Je=B.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=[F.perLineTextDirection.of(!0),Je],Xe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ze=`cm-lint-local-target`;function Qe(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 $e(e,t){let n=W(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Xe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function et(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function tt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=$e(e,Qe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:et(i.severity),message:v(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=L.define();function rt(e){let t={findings:[]};return[Pe(e=>T()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),B.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=x(e,e=>{e.status===`loaded`&&r(e.findings)}),a=w(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await ke(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(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 at(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=ot(r);o&&(a.actions=[o]),n.push(a)}return n}function ot(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:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var st=[Z(),q(),Y(),ye(),U(),X(),_e.allowMultipleSelections.of(!0),P(),G(),Ee(),we(),J(),j(),V(),Ne(),K.of([...Ce,...Se,...Re,...H,...Te,...Le])],ct=I.mark({class:`cm-link-ref-broken`}),lt=/^\s{0,3}\[([^\]]+)\]:\s/,ut=/\[([^\]]*)\]\[([^\]]*)\]/g,dt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ft(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 pt(e){let t=[];return R(e).iterate({enter(e){if(dt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function mt(e){let t=new Set,n=[],r=e.doc,i=pt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ft(n.from,i))continue;let a=lt.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ft(t.from,i)&&!lt.test(t.text))for(ut.lastIndex=0;;){let e=ut.exec(t.text);if(!e)break;let r=t.from+e.index;if(ft(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(ct.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),I.set(a)}var ht=z.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>F.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=I.mark({class:`cm-del`}),vt=I.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=I.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function bt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function xt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!h.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(h.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=R(e),i=xt(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(_t.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=gt.exec(r.text),a=i?i[1].length:2,o=I.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=bt(r.text),a=I.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(vt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=B.fromClass(Ct,{decorations:e=>e.decorations});function Tt(){return[wt,ht]}function Et(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function Dt(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||Et(r,t.origin)||(a=!0)};return n.observe(s),{setSourceModeActive(e){if(!o&&e!==i){if(!e){i=!1,r.stopCapturing();return}a&&(r.clear(),A(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var Ot=new WeakMap;function kt(e){return B.define(t=>{let n=Dt(e);return Ot.set(t,n),{destroy(){n.destroy()}}})}function At(e,t){let n=Ot.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var jt=t(),Mt=L.define();function Nt(e,t){try{At(t.view,!1)}finally{try{i(t)}finally{S(e,t.view)}}}function Pt(e,t,n){let r=b(e.state.doc),i=r[t.index],a={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!i)return k(y,{...a,outcome:`no-target`}),!1;let o=s(n,`outline`,()=>{e.dispatch({selection:be.cursor(i.from),effects:F.scrollIntoView(i.from,{y:`start`})}),e.focus()});return k(y,{...a,outcome:o?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(i.from).number}),o}function Ft(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);s(r,`raw-mdx`,()=>{e.dispatch({selection:be.cursor(a),effects:F.scrollIntoView(a,{y:`center`})}),e.focus()})})}function It(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);return s(n,`problems-row`,()=>{e.dispatch({selection:be.cursor(o),effects:F.scrollIntoView(o,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:r,provider:i,placeholder:a,isSourceModeActive:o}=e,s=(0,Q.useRef)(null),u=(0,Q.useRef)(null),[d,f]=(0,Q.useState)(null);if(d)throw d;let{resolvedTheme:m}=p(),{merged:h}=g(),v=(0,Q.useRef)(o),b=h?.editor?.wordWrap??!0,{data:x}=Me(n),S;t[0]!==x?.effective||t[1]!==h?(S=x?.effective??(h?.contentRules?Ae(h.contentRules):je),t[0]=x?.effective,t[1]=h,t[2]=S):S=t[2];let C=S,w;t[3]===C?w=t[4]:(w=JSON.stringify(C),t[3]=C,t[4]=w);let T=w,E=(0,Q.useRef)(null),D;t[5]!==n||t[6]!==o||t[7]!==C||t[8]!==a||t[9]!==i||t[10]!==m||t[11]!==b||t[12]!==r?(D=()=>{let e=s.current;if(!e)return;let t=i.configuration.name??``,d,p=zt;try{d=c({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let o=null,s=new ge(r);try{let c=ne({ydoc:i.document,ytext:r,docName:t}),u=new N,d=new N,f=new N,h=new N,g=new F({state:_e.create({doc:r.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>ee(t,`find-match`)?F.scrollIntoView(e,{y:`start`}):Mt.of(null)}),K.of([xe]),Ve(r,i.awareness,{undoManager:s}),K.of(Be),kt({docName:t,ytext:r,undoManager:s}),...me({themeCompartment:u,resolvedTheme:m,ydoc:i.document,wordWrapCompartment:d,wordWrap:b,currentDocName:t}),Tt(),Ge(t),re(),h.of(it(C,n)),rt(n),c,F.updateListener.of(e=>{te(e)&&l(t)}),F.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,ue(t,`source`,oe(e.view)),Oe(t,`source`,De(e.view,t))},120))}),f.of(ve(a??``)),F.theme({"&":{height:`100%`}}),F.scrollMargins.of(Rt)]}),parent:e});ue(t,`source`,oe(g)),Oe(t,`source`,De(g,t));let _=g.contentDOM;return _.addEventListener(`keydown`,p),_.addEventListener(`paste`,p),_.addEventListener(`drop`,p),_.addEventListener(`cut`,p),{view:g,ydoc:i.document,ytext:r,provider:i,undoManager:s,themeCompartment:u,wordWrapCompartment:d,placeholderCompartment:f,lintCompartment:h}}catch(e){let t=e;throw s.destroy(),t}}}),E.current=d,u.current=d.view,At(d.view,o),fe(n,d.view,`sourceEditor`),le()&&d.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),E.current=null,u.current=null,f(t instanceof Error?t:Error(String(t)))}return()=>{let e=E.current;E.current=null,u.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=o,t[7]=C,t[8]=a,t[9]=i,t[10]=m,t[11]=b,t[12]=r,t[13]=D):D=t[13];let O;t[14]!==i||t[15]!==r?(O=[r,i],t[14]=i,t[15]=r,t[16]=O):O=t[16],(0,Q.useEffect)(D,O);let A,j;t[17]===o?(A=t[18],j=t[19]):(A=()=>{v.current=o;let e=u.current;e&&At(e,o)},j=[o],t[17]=o,t[18]=A,t[19]=j),(0,Q.useEffect)(A,j);let M,P;t[20]===n?(M=t[21],P=t[22]):(M=()=>{},P=[n],t[20]=n,t[21]=M,t[22]=P),(0,Q.useEffect)(M,P);let I,L;t[23]===m?(I=t[24],L=t[25]):(L=()=>{let e=E.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(m===`dark`?pe:he)})},I=[m],t[23]=m,t[24]=I,t[25]=L),(0,Q.useEffect)(L,I);let R,z;t[26]===b?(R=t[27],z=t[28]):(R=()=>{let e=E.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(b?F.lineWrapping:[])})},z=[b],t[26]=b,t[27]=R,t[28]=z),(0,Q.useEffect)(R,z);let B,V;t[29]===a?(B=t[30],V=t[31]):(B=()=>{let e=E.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(a??``))})},V=[a],t[29]=a,t[30]=B,t[31]=V),(0,Q.useEffect)(B,V);let H;t[32]!==n||t[33]!==C?(H=()=>{let e=E.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(C,n))})},t[32]=n,t[33]=C,t[34]=H):H=t[34];let U;t[35]===T?U=t[36]:(U=[T],t[35]=T,t[36]=U),(0,Q.useEffect)(H,U);let W,G;t[37]!==n||t[38]!==o?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!o)return;let r=u.current;if(!r){k(y,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n)&&t.onNavigated?.(r.contentDOM),_(n)};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},G=[n,o],t[37]=n,t[38]=o,t[39]=W,t[40]=G):(W=t[39],G=t[40]),(0,Q.useEffect)(W,G);let q,J;t[41]!==n||t[42]!==o?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!o)return;let r=u.current;r&&It(r,t,n)&&(_(n),t.onNavigated?.(r.contentDOM))};return window.addEventListener(se,e),()=>window.removeEventListener(se,e)},J=[n,o],t[41]=n,t[42]=o,t[43]=q,t[44]=J):(q=t[43],J=t[44]),(0,Q.useEffect)(q,J);let Y,X;t[45]!==n||t[46]!==o||t[47]!==i?(Y=()=>{if(!o)return;let e=u.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){ie(n),t.kind===`outline`?Pt(e,t.detail,n)&&t.detail.onNavigated?.(e.contentDOM):t.kind===`lint`?It(e,t.detail,n)&&t.detail.onNavigated?.(e.contentDOM):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>v.current,n);return}let r=!1,a=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(a=ae({view:e,docName:n,navigation:t,ydoc:i.document,transition:{from:`wysiwyg`,to:`source`}}),a&&ie(n))}),()=>{r=!0,a?.cancel(`mode-flip`)}},X=[n,o,i],t[45]=n,t[46]=o,t[47]=i,t[48]=Y,t[49]=X):(Y=t[48],X=t[49]),(0,Q.useEffect)(Y,X);let Z;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,jt.jsx)(`div`,{ref:s,className:`source-editor h-full pb-3`}),t[50]=Z):Z=t[50],Z}function Rt(){return{top:E()}}function zt(){return C()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{At as n,Bt as r,Cn as i,Dt as a,Pt as o,Qn as s,Sn as c,an as l,kt as u,qn as ee,rn as te,st as ne,zt as d}from"./DocumentContext-B6cmniqU.js";import{t as f}from"./react-f2sANaYj.js";import{n as p}from"./dist-PQ5KMVDh.js";import{t as m}from"./compiler-runtime-BfE3aGVn.js";import{ht as h}from"./schemas-api-CL5ZXlEj.js";import{i as g}from"./use-apply-config-theme-CYFG76sS.js";import{H as re,I as _,L as ie,N as ae,T as oe,b as v,c as se,n as y,o as b,r as ce,t as le,v as x,w as ue,z as de}from"./typing-burst-detector-DjSPAHC0.js";import{Bn as fe,Hn as S,Q as C,a as pe,gt as w,i as me,mt as T,o as he,x as E}from"./CodeMirrorPropInput-_HrEupqc.js";import{a as D,i as O}from"./constants-skills-BLHVRW90.js";import{t as k}from"./diagnostic-breadcrumb-DPgUDxA8.js";import{n as A}from"./perf-CPPbaRwr.js";import{m as ge}from"./config-provider-DY_fun1v.js";import{$ as j,At as M,Ct as N,E as P,J as F,K as I,Mt as L,N as R,Nt as z,Tt as _e,X as B,at as V,b as H,et as U,ft as ve,g as W,l as G,lt as K,ot as q,pt as J,st as Y,tt as X,ut as Z,v as ye,wt as be}from"./dist-BosZaL03.js";import{i as xe,t as Se}from"./dist-DTvyxWzB.js";import{i as Ce,n as we,o as Te,r as Ee}from"./dist-D2c3re7d.js";import{o as De,r as Oe}from"./selection-context-DYlfZmRT.js";import{C as ke,D as Ae,t as je}from"./markdown-lint-BMeMGAz_.js";import{l as Me}from"./lint-config-client-B249C1D2.js";import{a as Ne,i as Pe,n as Fe,o as Ie,r as Le,s as Re,t as ze}from"./dist-CRnJUJYV.js";import{n as Be,t as Ve}from"./src-Ca8kxD9e.js";var Q=e(f(),1),He=m();function Ue(){let e=d();return e===null?null:new Set(e.keys())}function We(e,t,n){let r=[],i=R(e);if(n!=null){let a=[];for(let{from:e,to:n}of t)i.iterate({from:e,to:n,enter(e){if(e.name===`InlineCode`||e.name===`FencedCode`)return a.push({from:e.from,to:e.to}),!1}});let o=(e,t)=>a.some(n=>e>=n.from&&t<=n.to);for(let{from:i,to:a}of t){let t=e.doc.sliceString(i,a);O.lastIndex=0;for(let e=O.exec(t);e!==null;e=O.exec(t)){let t=e[2];if(!D(t))continue;let a=i+(e.index??0)+e[1].length,s=a+t.length+1;o(a,s)||r.push(I.mark({class:n.has(t)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":t}}).range(a,s))}}}for(let{from:o,to:s}of t)i.iterate({from:o,to:s,enter(t){if(t.name!==`InlineCode`)return;let i=e.doc.sliceString(t.from,t.to),o=i.length-i.replace(/^`+/,``).length,s=i.length-i.replace(/`+$/,``).length,c=i.slice(o,i.length-s),l=/^\/([a-z0-9][a-z0-9-]{1,63})$/.exec(c)?.[1];if(l!==void 0&&D(l)&&n!=null)return r.push(I.mark({class:n.has(l)?`cm-skill-ref`:`cm-skill-ref cm-skill-ref-missing`,attributes:{"data-skill-ref":l}}).range(t.from+o,t.to-s)),!1;let u=a.exec(c);if(u)return r.push(I.mark({class:`cm-skill-path-link`,attributes:{"data-skill-path":u[1]}}).range(t.from+o,t.to-s)),!1}});return r.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(r)}function Ge(e){let t=n(e);return t===null?[]:[B.fromClass(class{decorations;constructor(e){this.decorations=We(e.state,e.visibleRanges,Ue())}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=We(e.view.state,e.view.visibleRanges,Ue()))}},{decorations:e=>e.decorations}),F.domEventHandlers({mousedown(n){let i=n.target?.closest?.(`[data-skill-ref]`),a=i instanceof HTMLElement?i.dataset.skillRef:void 0;if(a!==void 0){n.preventDefault();let e=d()?.get(a);return e===void 0?o():window.location.hash=r(a,e),!0}let s=n.target?.closest?.(`.cm-skill-path-link`),c=s instanceof HTMLElement?s.dataset.skillPath:void 0;return c===void 0?!1:(n.preventDefault(),window.location.hash=u(t,e,c),!0)}})]}var Ke=I.line({attributes:{dir:`auto`}});function qe(e){let t=new M;for(let n of e.visibleRanges)for(let r=n.from;r<=n.to;){let n=e.state.doc.lineAt(r);t.add(n.from,n.from,Ke),r=n.to+1}return t.finish()}var Je=B.fromClass(class{decorations;constructor(e){this.decorations=qe(e)}update(e){(e.docChanged||e.viewportChanged)&&(this.decorations=qe(e.view))}},{decorations:e=>e.decorations}),Ye=[F.perLineTextDirection.of(!0),Je],Xe=new Set([`Link`,`Image`,`HTMLTag`,`HTMLBlock`]),Ze=`cm-lint-local-target`;function Qe(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 $e(e,t){let n=W(e,t+1,100);if(n){let e=n.resolveInner(t,1);for(;e;){if(Xe.has(e.name))return{from:e.from,to:e.to};e=e.parent}}return{from:t,to:t}}function et(e){return e===`error`?`error`:e===`info`?`info`:`warning`}function tt(e,t){let n=e.doc,r=[];for(let i of t){if(i.source!==`links`)continue;let t=$e(e,Qe(n,i.range.start));r.push({from:t.from,to:Math.max(t.to,t.from),severity:et(i.severity),message:v(i),source:`${i.source}/${i.code}`,markClass:Ze})}return r}var nt=L.define();function rt(e){let t={findings:[]};return[Pe(e=>T()?tt(e.state,t.findings):[],{delay:300,needsRefresh:e=>e.transactions.some(e=>e.effects.some(e=>e.is(nt)))}),B.define(n=>{let r=e=>{t.findings=e,n.dispatch({effects:nt.of(null)}),ze(n)},i=x(e,e=>{e.status===`loaded`&&r(e.findings)}),a=w(()=>r(t.findings));return{destroy(){i(),a()}}})]}function it(e,t){return e.enabled?[Fe(),Pe(async n=>at(n.state.doc,await ke(n.state.doc.toString(),e,t)),{delay:600})]:[]}function $(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 at(e,t){let n=[];for(let r of t){let t=$(e,r.range.start),i=$(e,r.range.end),a={from:t,to:Math.max(i,t),severity:r.severity,message:r.message,source:`${r.source}/${r.code}`},o=ot(r);o&&(a.actions=[o]),n.push(a)}return n}function ot(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:$(n,e.range.start),to:$(n,e.range.end),insert:e.newText})),userEvent:`input.complete`})}}}var st=[Z(),q(),Y(),ye(),U(),X(),_e.allowMultipleSelections.of(!0),P(),G(),Ee(),we(),J(),j(),V(),Ne(),K.of([...Ce,...Se,...Re,...H,...Te,...Le])],ct=I.mark({class:`cm-link-ref-broken`}),lt=/^\s{0,3}\[([^\]]+)\]:\s/,ut=/\[([^\]]*)\]\[([^\]]*)\]/g,dt=new Set([`FencedCode`,`CodeBlock`,`InlineCode`]);function ft(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 pt(e){let t=[];return R(e).iterate({enter(e){if(dt.has(e.name))return t.push({from:e.from,to:e.to}),!1}}),t.sort((e,t)=>e.from-t.from),t}function mt(e){let t=new Set,n=[],r=e.doc,i=pt(e);for(let e=1;e<=r.lines;e++){let n=r.line(e);if(ft(n.from,i))continue;let a=lt.exec(n.text);a&&t.add(a[1].toLowerCase())}for(let e=1;e<=r.lines;e++){let t=r.line(e);if(!ft(t.from,i)&&!lt.test(t.text))for(ut.lastIndex=0;;){let e=ut.exec(t.text);if(!e)break;let r=t.from+e.index;if(ft(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(ct.range(e.from,e.to));return a.sort((e,t)=>e.from-t.from),I.set(a)}var ht=z.define({create(e){return mt(e)},update(e,t){return t.docChanged?mt(t.state):e},provide:e=>F.decorations.from(e)}),gt=/^(\s*(?:[-*+]|\d+[.)]) (?:\[[ x]\] )?)/,_t=I.mark({class:`cm-del`}),vt=I.line({class:`cm-table-header`,attributes:{style:`--list-hang: 2ch`}}),yt=I.line({class:`cm-table-row`,attributes:{style:`--list-hang: 2ch`}});function bt(e){let t=0;for(let n of e)if(n===` `)t++;else if(n===` `)t+=4;else break;return t}function xt(e){if(e.doc.lines<2)return null;let t=e.doc.line(1);if(!h.test(t.text))return null;for(let n=2;n<=e.doc.lines;n++){let r=e.doc.line(n);if(h.test(r.text))return{from:t.from,to:r.to}}return null}function St(e,t){let n=[],r=R(e),i=xt(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(_t.range(e,r)),!1}if(t.name===`ListItem`){let r=e.doc.lineAt(t.from),i=gt.exec(r.text),a=i?i[1].length:2,o=I.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=bt(r.text),a=I.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(vt.range(r.from)),!1}if(t.name===`TableRow`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}if(t.name===`TableDelimiter`&&t.node.parent?.name===`Table`){let r=e.doc.lineAt(t.from);return n.push(yt.range(r.from)),!1}}}});return n.sort((e,t)=>e.from-t.from||e.value.startSide-t.value.startSide),I.set(n)}var Ct=class{decorations;constructor(e){this.decorations=St(e.state,e.visibleRanges)}update(e){(e.docChanged||e.viewportChanged||R(e.startState)!==R(e.state))&&(this.decorations=St(e.view.state,e.view.visibleRanges))}},wt=B.fromClass(Ct,{decorations:e=>e.decorations});function Tt(){return[wt,ht]}function Et(e,t){let n=e.trackedOrigins;return n.has(t)?!0:t?n.has(t.constructor):!1}function Dt(e){let{docName:t,ytext:n,undoManager:r}=e,i=!1,a=!1,o=!1,s=(e,t)=>{i||Et(r,t.origin)||(a=!0)};return n.observe(s),{setSourceModeActive(e){if(!o&&e!==i){if(!e){i=!1,r.stopCapturing();return}a&&(r.clear(),A(`ok/source-undo/flip-clear`,{docName:t})),a=!1,i=!0}},destroy(){o||(o=!0,n.unobserve(s))}}}var Ot=new WeakMap;function kt(e){return B.define(t=>{let n=Dt(e);return Ot.set(t,n),{destroy(){n.destroy()}}})}function At(e,t){let n=Ot.get(e);if(!n)throw Error(`createSourceUndoFlipExtension is not installed on this EditorView`);n.setSourceModeActive(t)}var jt=t(),Mt=L.define();function Nt(e,t){try{At(t.view,!1)}finally{try{i(t)}finally{S(e,t.view)}}}function Pt(e,t,n){let r=b(e.state.doc),i=r[t.index],a={docName:n,mode:`source`,index:t.index,sourceHeadingCount:r.length};if(!i)return k(y,{...a,outcome:`no-target`}),!1;let o=s(n,`outline`,()=>{e.dispatch({selection:be.cursor(i.from),effects:F.scrollIntoView(i.from,{y:`start`})}),e.focus()});return k(y,{...a,outcome:o?`scrolled`:`declined`,targetLine:e.state.doc.lineAt(i.from).number}),o}function Ft(e,t,n,r){requestAnimationFrame(()=>{if(!n())return;let i=e.state.doc,a=Math.min(t.offset,i.length);s(r,`raw-mdx`,()=>{e.dispatch({selection:be.cursor(a),effects:F.scrollIntoView(a,{y:`center`})}),e.focus()})})}function It(e,t,n){let r=e.state.doc,i=Math.min(Math.max(t.line,1),r.lines),a=r.line(i),o=Math.min(a.from+Math.max(0,t.column-1),a.to);return s(n,`problems-row`,()=>{e.dispatch({selection:be.cursor(o),effects:F.scrollIntoView(o,{y:`start`})}),e.focus()})}function Lt(e){let t=(0,He.c)(51),{docName:n,ytext:r,provider:i,placeholder:a,isSourceModeActive:o}=e,s=(0,Q.useRef)(null),u=(0,Q.useRef)(null),[d,f]=(0,Q.useState)(null);if(d)throw d;let{resolvedTheme:m}=p(),{merged:h}=g(),v=(0,Q.useRef)(o),b=h?.editor?.wordWrap??!0,{data:x}=Me(n),S;t[0]!==x?.effective||t[1]!==h?(S=x?.effective??(h?.contentRules?Ae(h.contentRules):je),t[0]=x?.effective,t[1]=h,t[2]=S):S=t[2];let C=S,w;t[3]===C?w=t[4]:(w=JSON.stringify(C),t[3]=C,t[4]=w);let T=w,E=(0,Q.useRef)(null),D;t[5]!==n||t[6]!==o||t[7]!==C||t[8]!==a||t[9]!==i||t[10]!==m||t[11]!==b||t[12]!==r?(D=()=>{let e=s.current;if(!e)return;let t=i.configuration.name??``,d,p=zt;try{d=c({docName:t,container:e,sizeStats:{viewCount:0,bytes:r.length},factory:e=>{let o=null,s=new ge(r);try{let c=ne({ydoc:i.document,ytext:r,docName:t}),u=new N,d=new N,f=new N,h=new N,g=new F({state:_e.create({doc:r.toString(),extensions:[st,Ye,Ie({scrollToMatch:e=>ee(t,`find-match`)?F.scrollIntoView(e,{y:`start`}):Mt.of(null)}),K.of([xe]),Ve(r,i.awareness,{undoManager:s}),K.of(Be),kt({docName:t,ytext:r,undoManager:s}),...me({themeCompartment:u,resolvedTheme:m,ydoc:i.document,wordWrapCompartment:d,wordWrap:b,currentDocName:t}),Tt(),Ge(t),re(),h.of(it(C,n)),rt(n),c,F.updateListener.of(e=>{te(e)&&l(t)}),F.updateListener.of(e=>{!e.selectionSet&&!e.docChanged||(o!==null&&clearTimeout(o),o=setTimeout(()=>{o=null,ue(t,`source`,oe(e.view)),Oe(t,`source`,De(e.view,t))},120))}),f.of(ve(a??``)),F.theme({"&":{height:`100%`}}),F.scrollMargins.of(Rt)]}),parent:e});ue(t,`source`,oe(g)),Oe(t,`source`,De(g,t));let _=g.contentDOM;return _.addEventListener(`keydown`,p),_.addEventListener(`paste`,p),_.addEventListener(`drop`,p),_.addEventListener(`cut`,p),{view:g,ydoc:i.document,ytext:r,provider:i,undoManager:s,themeCompartment:u,wordWrapCompartment:d,placeholderCompartment:f,lintCompartment:h}}catch(e){let t=e;throw s.destroy(),t}}}),E.current=d,u.current=d.view,At(d.view,o),fe(n,d.view,`sourceEditor`),le()&&d.view.focus()}catch(e){let t=e;console.error(`[SourceEditor] mountCmEditor failed`,t),E.current=null,u.current=null,f(t instanceof Error?t:Error(String(t)))}return()=>{let e=E.current;E.current=null,u.current=null,e&&Nt(n,e)}},t[5]=n,t[6]=o,t[7]=C,t[8]=a,t[9]=i,t[10]=m,t[11]=b,t[12]=r,t[13]=D):D=t[13];let O;t[14]!==i||t[15]!==r?(O=[r,i],t[14]=i,t[15]=r,t[16]=O):O=t[16],(0,Q.useEffect)(D,O);let A,j;t[17]===o?(A=t[18],j=t[19]):(A=()=>{v.current=o;let e=u.current;e&&At(e,o)},j=[o],t[17]=o,t[18]=A,t[19]=j),(0,Q.useEffect)(A,j);let M,P;t[20]===n?(M=t[21],P=t[22]):(M=()=>{},P=[n],t[20]=n,t[21]=M,t[22]=P),(0,Q.useEffect)(M,P);let I,L;t[23]===m?(I=t[24],L=t[25]):(L=()=>{let e=E.current;e&&e.view.dispatch({effects:e.themeCompartment.reconfigure(m===`dark`?pe:he)})},I=[m],t[23]=m,t[24]=I,t[25]=L),(0,Q.useEffect)(L,I);let R,z;t[26]===b?(R=t[27],z=t[28]):(R=()=>{let e=E.current;e&&e.view.dispatch({effects:e.wordWrapCompartment.reconfigure(b?F.lineWrapping:[])})},z=[b],t[26]=b,t[27]=R,t[28]=z),(0,Q.useEffect)(R,z);let B,V;t[29]===a?(B=t[30],V=t[31]):(B=()=>{let e=E.current;e&&e.view.dispatch({effects:e.placeholderCompartment.reconfigure(ve(a??``))})},V=[a],t[29]=a,t[30]=B,t[31]=V),(0,Q.useEffect)(B,V);let H;t[32]!==n||t[33]!==C?(H=()=>{let e=E.current;e&&e.view.dispatch({effects:e.lintCompartment.reconfigure(it(C,n))})},t[32]=n,t[33]=C,t[34]=H):H=t[34];let U;t[35]===T?U=t[36]:(U=[T],t[35]=T,t[36]=U),(0,Q.useEffect)(H,U);let W,G;t[37]!==n||t[38]!==o?(W=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||t.mode!==`source`||!o)return;let r=u.current;if(!r){k(y,{docName:n,mode:`source`,index:t.index,outcome:`no-view`});return}Pt(r,t,n)&&t.onNavigated?.(r.contentDOM),_(n)};return window.addEventListener(ce,e),()=>window.removeEventListener(ce,e)},G=[n,o],t[37]=n,t[38]=o,t[39]=W,t[40]=G):(W=t[39],G=t[40]),(0,Q.useEffect)(W,G);let q,J;t[41]!==n||t[42]!==o?(q=()=>{let e=function(e){let t=e.detail;if(!t||t.docName!==n||!o)return;let r=u.current;r&&It(r,t,n)&&(_(n),t.onNavigated?.(r.contentDOM))};return window.addEventListener(se,e),()=>window.removeEventListener(se,e)},J=[n,o],t[41]=n,t[42]=o,t[43]=q,t[44]=J):(q=t[43],J=t[44]),(0,Q.useEffect)(q,J);let Y,X;t[45]!==n||t[46]!==o||t[47]!==i?(Y=()=>{if(!o)return;let e=u.current;if(!e)return;let t=de(n);if(!t)return;if(t.kind!==`selection-offset`){ie(n),t.kind===`outline`?Pt(e,t.detail,n)&&t.detail.onNavigated?.(e.contentDOM):t.kind===`lint`?It(e,t.detail,n)&&t.detail.onNavigated?.(e.contentDOM):t.kind===`raw-mdx`&&Ft(e,t.detail,()=>v.current,n);return}let r=!1,a=null;return queueMicrotask(()=>{if(r)return;let t=de(n);t?.kind===`selection-offset`&&(a=ae({view:e,docName:n,navigation:t,ydoc:i.document,transition:{from:`wysiwyg`,to:`source`}}),a&&ie(n))}),()=>{r=!0,a?.cancel(`mode-flip`)}},X=[n,o,i],t[45]=n,t[46]=o,t[47]=i,t[48]=Y,t[49]=X):(Y=t[48],X=t[49]),(0,Q.useEffect)(Y,X);let Z;return t[50]===Symbol.for(`react.memo_cache_sentinel`)?(Z=(0,jt.jsx)(`div`,{ref:s,className:`source-editor h-full pb-3`}),t[50]=Z):Z=t[50],Z}function Rt(){return{top:E()}}function zt(){return C()}export{Lt as SourceEditor,Ft as applyRawMdxNavigation};
|
|
@@ -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{i as o,n as s,t as c}from"./tooltip-Bz6z4_se.js";import{n as ee,r as te,t as ne}from"./collapsible-BKbszYZV.js";import{i as l,n as u,o as d,s as f,t as p}from"./select-pACXgFe2.js";import{n as m,t as h}from"./toggle-group-B7p69Qfd.js";import{t as g}from"./button-DzgjsZzC.js";import{n as _}from"./dist-BGzUo_18.js";import{d as re,f as ie,h as ae,m as oe,p as se}from"./share-D-LUU2aX-B7Yg0G_m.js";import{i as ce}from"./use-apply-config-theme-CYFG76sS.js";import{C as le,T as ue,a as de,c as fe,h as pe,l as me,m as he,n as ge,o as _e,p as ve,t as ye,u as be,v as xe,w as Se,x as Ce}from"./SyncStatusBadge-DHRx1bqM.js";import{t as we}from"./arrow-up-right-nJaICi16.js";import{t as Te}from"./chevron-right-Bofu4lib.js";import{t as Ee}from"./use-settings-route-Bj-m9X61.js";import"./config-provider-XgOiT52f.js";import{n as De}from"./use-git-sync-status-PkMYmN4D.js";import{t as Oe}from"./AuthModal-YZGpNH__.js";import{t as v}from"./PublishToGitHubDialog-18N1T5qL.js";import{t as ke}from"./skeleton-CrbF9ppq.js";import{n as Ae,t as je}from"./SettingsSectionHeader-BKhNIRp2.js";var Me=a(),y=e(n(),1),b=t(),x=`data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground data-[state=on]:hover:bg-primary/90`;function S(){let e=(0,Me.c)(4),[t,n]=(0,y.useState)(!1),r=(0,y.useRef)(null),i=(0,y.useRef)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,b.jsx)(C,{onPublish:()=>n(!0),setUpSyncingRef:r}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>(r.current??i.current)?.focus(),e[1]=o):o=e[1];let s;return e[2]===t?s=e[3]:(s=(0,b.jsxs)(`section`,{ref:i,"aria-labelledby":`settings-sync-title`,tabIndex:-1,"data-testid":`settings-sync-section`,children:[a,(0,b.jsx)(v,{open:t,onOpenChange:n,returnFocus:o})]}),e[2]=t,e[3]=s),s}function C(e){let t=(0,Me.c)(149),{onPublish:n,setUpSyncingRef:a}=e,{_:v}=i(),{status:S,fetchError:C}=De(),{projectConfig:Fe,projectLocalConfig:Ie,projectLocalSynced:Le,projectSynced:Re}=ce(),ze=ue(),Be=Ce(),Ve=le(),[He,Ue]=(0,y.useState)(!1),We,Ge;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(We=()=>{Ee()&&Ue(!0)},Ge=[],t[0]=We,t[1]=Ge):(We=t[0],Ge=t[1]),(0,y.useEffect)(We,Ge);let w=oe(Ie?.autoSync),Ke=w.pushIntervalSeconds<w.pullIntervalSeconds,qe=Ie?.autoSync,Je;t[2]===qe?Je=t[3]:(Je=ae(qe),t[2]=qe,t[3]=Je);let Ye=Je,Xe=Fe?.autoSync?.default,Ze;t[4]===Xe?Ze=t[5]:(Ze=se(Xe),t[4]=Xe,t[5]=Ze);let Qe=Ze,$e;t[6]!==Ye||t[7]!==S?($e=Ye??(S===null?`off`:xe(S)),t[6]=Ye,t[7]=S,t[8]=$e):$e=t[8];let T=$e,E=Le&&Ye===null&&Qe!==null,{confirmOpen:et,setConfirmOpen:tt,pendingMode:nt,onModeSelect:D,onTurnOff:rt,onKeepCurrent:it,onConfirm:at}=Se(ze,T),[ot,O]=(0,y.useState)(!1),k=!Le;if(S===null){let e=C!==null,n=e?`settings-sync-unavailable`:`settings-sync-loading`,i;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,b.jsx)(je,{titleId:`settings-sync-title`,title:(0,b.jsx)(r,{id:`Nu4DdT`}),scope:`project-local`,level:`block`}),t[9]=i):i=t[9];let a=!e,o;t[10]!==C||t[11]!==e?(o=e?(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:C===`network`?(0,b.jsx)(r,{id:`epGMvx`}):(0,b.jsx)(r,{id:`wLRCZ8`})}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`sr-only`,children:(0,b.jsx)(r,{id:`OgvwrM`})}),(0,b.jsx)(ke,{className:`h-24`})]}),t[10]=C,t[11]=e,t[12]=o):o=t[12];let s;t[13]!==a||t[14]!==o?(s=(0,b.jsx)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":a,children:o}),t[13]=a,t[14]=o,t[15]=s):s=t[15];let c;return t[16]!==s||t[17]!==n?(c=(0,b.jsxs)(`div`,{className:`space-y-3`,"data-testid":n,children:[i,s]}),t[16]=s,t[17]=n,t[18]=c):c=t[18],c}if(!S.hasRemote){let e=T!==`off`,i;t[19]!==rt||t[20]!==a?(i=()=>{rt()&&a.current?.focus()},t[19]=rt,t[20]=a,t[21]=i):i=t[21];let o=i,s;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,b.jsx)(r,{id:`Nu4DdT`}),t[22]=s):s=t[22];let c;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,b.jsx)(je,{titleId:`settings-sync-title`,title:s,scope:`project-local`,level:`block`,children:(0,b.jsx)(r,{id:`AiNMQ7`})}),t[23]=c):c=t[23];let l;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,b.jsx)(`div`,{className:`text-sm font-medium`,children:(0,b.jsx)(r,{id:`3_6U6f`})}),t[24]=l):l=t[24];let u;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,b.jsxs)(`div`,{className:`space-y-0.5`,children:[l,(0,b.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,b.jsx)(r,{id:`i92eAT`})})]}),t[25]=u):u=t[25];let d;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,b.jsx)(r,{id:`zkz0Fg`}),t[26]=d):d=t[26];let f;t[27]!==n||t[28]!==a?(f=(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[u,(0,b.jsx)(g,{ref:a,onClick:n,"data-testid":`settings-sync-setup`,children:d})]}),t[27]=n,t[28]=a,t[29]=f):f=t[29];let p;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,b.jsx)(te,{asChild:!0,children:(0,b.jsxs)(g,{variant:`ghost`,size:`sm`,className:`group gap-1 px-1.5 text-muted-foreground`,children:[(0,b.jsx)(Te,{className:`size-3.5 transition-transform group-data-[state=open]:rotate-90`,"aria-hidden":!0}),(0,b.jsx)(r,{id:`6caB2T`})]})}),t[30]=p):p=t[30];let m;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,b.jsxs)(ne,{children:[p,(0,b.jsx)(ee,{className:`px-1.5 pt-2 text-sm text-muted-foreground`,children:(0,b.jsx)(r,{id:`44DSl0`,components:{0:(0,b.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]}),t[31]=m):m=t[31];let h;t[32]!==e||t[33]!==k||t[34]!==o?(h=e?(0,b.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border p-3`,"data-testid":`settings-sync-no-remote-auto-on`,children:[(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,b.jsx)(r,{id:`9U-7Xv`})}),(0,b.jsx)(g,{variant:`outline`,size:`xs`,className:`self-start`,onClick:o,disabled:k,"data-testid":`settings-sync-no-remote-turn-off`,children:(0,b.jsx)(r,{id:`v6Glry`})})]}):null,t[32]=e,t[33]=k,t[34]=o,t[35]=h):h=t[35];let _;return t[36]!==f||t[37]!==h?(_=(0,b.jsxs)(`div`,{className:`space-y-4`,"data-testid":`settings-sync-empty`,children:[c,f,m,h]}),t[36]=f,t[37]=h,t[38]=_):_=t[38],_}let st=S.pushPermission?.checkStatus===`denied`||S.pausedReason===`no-push-permission`,ct;t[39]===S.pushPermission?ct=t[40]:(ct=ve(S.pushPermission),t[39]=S.pushPermission,t[40]=ct);let lt=ct,ut;t[41]===S?ut=t[42]:(ut=fe(S),t[41]=S,t[42]=ut);let dt=ut,ft=T===`full`&&st&<,A=T===`full`&&st&&!lt&&!dt,j=!A&&!ft&&st&&!dt,pt=S.pushPermission?.checkStatus===`denied`&&S.pushPermission.deniedReason!==`not-authenticated`&&!dt,mt;t[43]===S?mt=t[44]:(mt=be(S),t[43]=S,t[44]=mt);let M=mt,ht=st&&S.pausedReason!==`unsafe-incoming-symlinks`,gt;t[45]!==M||t[46]!==ht||t[47]!==S.pausedReason||t[48]!==S.remote?(gt=S.pausedReason?M?_e(`auth-not-found-as-identity`,me(S.remote)):ht?null:(0,b.jsx)(ye,{reason:S.pausedReason}):null,t[45]=M,t[46]=ht,t[47]=S.pausedReason,t[48]=S.remote,t[49]=gt):gt=t[49];let N=gt,_t;t[50]!==E||t[51]!==T||t[52]!==it||t[53]!==D?(_t=function(e){let t=e===``?T:e;if(ie(t)){if(t===T){E&&it();return}D(t)}},t[50]=E,t[51]=T,t[52]=it,t[53]=D,t[54]=_t):_t=t[54];let vt=_t,yt=Qe??`ask`,bt;t[55]!==v||t[56]!==Be?(bt=function(e){if(e!==`ask`&&!ie(e))return;if(Be===null){_.error(v({id:`fiMNLl`}));return}let t;bb163:switch(e){case`ask`:t=null;break bb163;case`off`:t=!1;break bb163;case`full`:t=!0;break bb163;case`follow`:t=`follow`;break bb163;default:throw Error(`unhandled committed default: ${String(e)}`)}let n=Be(t);if(!n.ok){let e=n.error;_.error(v({id:`oAFVKX`,values:{detail:e}}))}},t[55]=v,t[56]=Be,t[57]=bt):bt=t[57];let xt=bt,St;t[58]===v?St=t[59]:(St=function(e){switch(e){case 30:return v({id:`OqqecQ`});case 60:return v({id:`4mbrAq`});case 300:return v({id:`PEGxvo`});case 900:return v({id:`Cz-K13`});case 3600:return v({id:`vp5vfW`});default:return v({id:`U7Iesw`,values:{seconds:e}})}},t[58]=v,t[59]=St);let Ct=St,wt;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(wt=function(e){return re.includes(e)?[...re]:[...re,e].sort(Pe)},t[60]=wt):wt=t[60];let Tt=wt,Et=function(e,t){let n=Number(t);if(!Number.isFinite(n)||Ve===null)return;let r=Ve({pullIntervalSeconds:e===`pull`?n:w.pullIntervalSeconds,pushIntervalSeconds:e===`push`?n:w.pushIntervalSeconds});if(!r.ok){let e=r.error;_.error(v({id:`WOfp4H`,values:{detail:e}}))}},Dt;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=(0,b.jsx)(r,{id:`Nu4DdT`}),t[61]=Dt):Dt=t[61];let P;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,b.jsx)(je,{titleId:`settings-sync-title`,title:Dt,scope:`project-local`,level:`block`,children:(0,b.jsx)(r,{id:`qLXJTB`})}),t[62]=P):P=t[62];let Ot;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ot=(0,b.jsx)(`div`,{id:`settings-sync-mode-label`,className:`text-sm font-medium`,children:(0,b.jsx)(r,{id:`yZepkk`})}),t[63]=Ot):Ot=t[63];let F;t[64]===T?F=t[65]:(F=(0,b.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-sync-body`,children:T===`full`?(0,b.jsx)(r,{id:`zBiFZh`}):T===`follow`?(0,b.jsx)(r,{id:`PGRnbw`}):(0,b.jsx)(r,{id:`t5I7P_`})}),t[64]=T,t[65]=F);let I;t[66]===E?I=t[67]:(I=E?(0,b.jsx)(`p`,{id:`settings-sync-mode-default-note`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-sync-mode-from-default`,children:(0,b.jsx)(r,{id:`uNkJ8H`})}):null,t[66]=E,t[67]=I);let L;t[68]!==v||t[69]!==S.remote?(L=S.remote?(0,b.jsxs)(`p`,{className:`text-muted-foreground text-1sm truncate`,"data-testid":`settings-sync-remote`,children:[(0,b.jsx)(r,{id:`Q8A-U_`}),` `,S.remote.webUrl?(0,b.jsxs)(`a`,{href:S.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-foreground hover:text-primary hover:underline inline-flex items-center gap-0.5`,"aria-label":v({id:`1nke1r`,values:{0:S.remote.label}}),"data-testid":`settings-sync-remote-link`,children:[(0,b.jsx)(`span`,{children:S.remote.label}),(0,b.jsx)(we,{className:`inline size-3.5`,"aria-hidden":!0})]}):(0,b.jsx)(`span`,{className:`font-medium text-foreground`,"data-testid":`settings-sync-remote-label`,children:S.remote.label})]}):null,t[68]=v,t[69]=S.remote,t[70]=L):L=t[70];let R;t[71]!==F||t[72]!==I||t[73]!==L?(R=(0,b.jsxs)(`div`,{className:`min-w-0`,children:[Ot,F,I,L]}),t[71]=F,t[72]=I,t[73]=L,t[74]=R):R=t[74];let kt=E?`settings-sync-mode-default-note`:void 0,At;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(At=(0,b.jsx)(m,{value:`off`,className:x,"data-testid":`settings-sync-mode-off`,children:(0,b.jsx)(r,{id:`BWTzAb`})}),t[75]=At):At=t[75];let jt;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(jt=(0,b.jsx)(m,{value:`follow`,className:x,"data-testid":`settings-sync-mode-follow`,children:(0,b.jsx)(r,{id:`tlGXxX`})}),t[76]=jt):jt=t[76];let z;t[77]!==pt||t[78]!==j?(z=pt?(0,b.jsxs)(c,{children:[(0,b.jsx)(o,{asChild:!0,children:(0,b.jsx)(`span`,{className:`inline-flex`,children:(0,b.jsx)(m,{value:`full`,className:x,disabled:!0,"aria-describedby":j?`settings-sync-denied-hint-text`:void 0,"data-testid":`settings-sync-mode-full`,children:(0,b.jsx)(r,{id:`IXiG0B`})})})}),(0,b.jsx)(s,{"data-testid":`settings-sync-mode-full-tip`,children:(0,b.jsx)(r,{id:`EiVgl5`})})]}):(0,b.jsx)(m,{value:`full`,className:x,"data-testid":`settings-sync-mode-full`,children:(0,b.jsx)(r,{id:`IXiG0B`})}),t[77]=pt,t[78]=j,t[79]=z):z=t[79];let B;t[80]!==T||t[81]!==k||t[82]!==vt||t[83]!==kt||t[84]!==z?(B=(0,b.jsxs)(h,{type:`single`,variant:`outline`,spacing:2,value:T,onValueChange:vt,disabled:k,"aria-labelledby":`settings-sync-mode-label`,"aria-describedby":kt,"data-testid":`settings-sync-mode-toggle`,children:[At,jt,z]}),t[80]=T,t[81]=k,t[82]=vt,t[83]=kt,t[84]=z,t[85]=B):B=t[85];let V;t[86]!==R||t[87]!==B?(V=(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[R,B]}),t[86]=R,t[87]=B,t[88]=V):V=t[88];let H;t[89]!==O||t[90]!==ft?(H=ft&&(0,b.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-reconnect`,children:[(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,b.jsx)(r,{id:`tnG-m6`})}),(0,b.jsx)(g,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>O(!0),children:(0,b.jsx)(r,{id:`5lWFkC`})})]}),t[89]=O,t[90]=ft,t[91]=H):H=t[91];let U;t[92]!==D||t[93]!==A?(U=A&&(0,b.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-switch-follow`,children:[(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,b.jsx)(r,{id:`srdlOs`})}),(0,b.jsx)(g,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>D(`follow`),"data-testid":`settings-sync-switch-follow-action`,children:(0,b.jsx)(r,{id:`v16Pzh`})})]}),t[92]=D,t[93]=A,t[94]=U):U=t[94];let W;t[95]!==T||t[96]!==j?(W=j&&(0,b.jsx)(`p`,{id:`settings-sync-denied-hint-text`,className:`text-1sm text-muted-foreground mt-2`,"data-testid":`settings-sync-denied-hint`,children:T===`follow`?(0,b.jsx)(r,{id:`EiVgl5`}):(0,b.jsx)(r,{id:`eNOyTV`})}),t[95]=T,t[96]=j,t[97]=W):W=t[97];let G;t[98]===N?G=t[99]:(G=N!==null&&(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground mt-2`,"data-testid":`settings-sync-reason`,children:N}),t[98]=N,t[99]=G);let K;t[100]!==N||t[101]!==S.refusedSymlinkPaths?(K=N!==null&&(S.refusedSymlinkPaths?.length??0)>0&&(0,b.jsx)(`div`,{className:`mt-2`,children:(0,b.jsx)(ge,{paths:S.refusedSymlinkPaths})}),t[100]=N,t[101]=S.refusedSymlinkPaths,t[102]=K):K=t[102];let q;t[103]!==M||t[104]!==j||t[105]!==A||t[106]!==S.pushPermission?(q=S.pushPermission?.checkStatus===`denied`&&(M||A||j)?(0,b.jsx)(`div`,{className:`mt-2 space-y-1`,"data-testid":`settings-sync-identity`,children:de(S.pushPermission).map(Ne)}):null,t[103]=M,t[104]=j,t[105]=A,t[106]=S.pushPermission,t[107]=q):q=t[107];let J;t[108]!==O||t[109]!==S.pushPermission?(J=he(S.pushPermission)&&(0,b.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-signin-again`,children:[(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,b.jsx)(r,{id:`C_cPoW`})}),(0,b.jsx)(g,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>O(!0),children:(0,b.jsx)(r,{id:`5lWFkC`})})]}),t[108]=O,t[109]=S.pushPermission,t[110]=J):J=t[110];let Y;t[111]!==V||t[112]!==H||t[113]!==U||t[114]!==W||t[115]!==G||t[116]!==K||t[117]!==q||t[118]!==J?(Y=(0,b.jsxs)(`div`,{className:`rounded-md border p-3`,children:[V,H,U,W,G,K,q,J]}),t[111]=V,t[112]=H,t[113]=U,t[114]=W,t[115]=G,t[116]=K,t[117]=q,t[118]=J,t[119]=Y):Y=t[119];let Mt=T!==`off`&&(0,b.jsxs)(ne,{open:He,onOpenChange:Ue,children:[(0,b.jsx)(te,{asChild:!0,children:(0,b.jsxs)(g,{variant:`ghost`,size:`sm`,className:`group gap-1 px-1.5 text-muted-foreground`,"data-testid":`settings-sync-advanced-trigger`,children:[(0,b.jsx)(Te,{className:`size-3.5 transition-transform group-data-[state=open]:rotate-90`,"aria-hidden":!0}),(0,b.jsx)(r,{id:`sxkWRg`})]})}),(0,b.jsx)(ee,{className:`pt-2`,children:(0,b.jsxs)(`div`,{className:`rounded-md border p-3 space-y-3`,"data-testid":`settings-sync-intervals`,children:[(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`div`,{id:`settings-sync-pull-interval-label`,className:`text-sm font-medium`,children:(0,b.jsx)(r,{id:`Xs1kjx`})}),(0,b.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,b.jsx)(r,{id:`T1fMJ6`})})]}),(0,b.jsxs)(p,{value:String(w.pullIntervalSeconds),onValueChange:e=>Et(`pull`,e),disabled:!Le,children:[(0,b.jsx)(d,{size:`sm`,className:`w-40 shrink-0`,"aria-labelledby":`settings-sync-pull-interval-label`,"data-testid":`settings-sync-pull-interval`,children:(0,b.jsx)(f,{})}),(0,b.jsx)(u,{children:Tt(w.pullIntervalSeconds).map(e=>(0,b.jsx)(l,{value:String(e),children:Ct(e)},e))})]})]}),T===`full`&&(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-t pt-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`div`,{id:`settings-sync-push-interval-label`,className:`text-sm font-medium`,children:(0,b.jsx)(r,{id:`gyYvCN`})}),(0,b.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,b.jsx)(r,{id:`czQDKY`})})]}),(0,b.jsxs)(p,{value:String(w.pushIntervalSeconds),onValueChange:e=>Et(`push`,e),disabled:!Le,children:[(0,b.jsx)(d,{size:`sm`,className:`w-40 shrink-0`,"aria-labelledby":`settings-sync-push-interval-label`,"data-testid":`settings-sync-push-interval`,children:(0,b.jsx)(f,{})}),(0,b.jsx)(u,{children:Tt(w.pushIntervalSeconds).map(e=>(0,b.jsx)(l,{value:String(e),children:Ct(e)},e))})]})]}),T===`full`&&Ke&&(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-sync-push-outpaces-pull-hint`,children:(0,b.jsx)(r,{id:`x-E_vF`})})]})})]}),Nt;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`div`,{id:`settings-sync-default-label`,className:`text-sm font-medium`,children:(0,b.jsx)(r,{id:`j_Z6g7`})}),(0,b.jsx)(Ae,{scope:`project`})]}),t[120]=Nt):Nt=t[120];let Pt;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=(0,b.jsxs)(`div`,{className:`space-y-0.5`,children:[Nt,(0,b.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,b.jsx)(r,{id:`Zysl7r`})})]}),t[121]=Pt):Pt=t[121];let Ft=!Re,It;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(It=(0,b.jsx)(m,{value:`ask`,className:x,"data-testid":`settings-sync-default-ask`,children:(0,b.jsx)(r,{id:`EdQY6l`})}),t[122]=It):It=t[122];let Lt;t[123]===Symbol.for(`react.memo_cache_sentinel`)?(Lt=(0,b.jsx)(m,{value:`off`,className:x,"data-testid":`settings-sync-default-off`,children:(0,b.jsx)(r,{id:`BWTzAb`})}),t[123]=Lt):Lt=t[123];let Rt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=(0,b.jsx)(m,{value:`follow`,className:x,"data-testid":`settings-sync-default-follow`,children:(0,b.jsx)(r,{id:`tlGXxX`})}),t[124]=Rt):Rt=t[124];let zt;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(zt=(0,b.jsx)(m,{value:`full`,className:x,"data-testid":`settings-sync-default-full`,children:(0,b.jsx)(r,{id:`IXiG0B`})}),t[125]=zt):zt=t[125];let X;t[126]!==yt||t[127]!==xt||t[128]!==Ft?(X=(0,b.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2`,"data-testid":`settings-sync-default`,children:[Pt,(0,b.jsxs)(h,{type:`single`,variant:`outline`,spacing:2,value:yt,onValueChange:xt,disabled:Ft,"aria-labelledby":`settings-sync-default-label`,"data-testid":`settings-sync-default-toggle`,children:[It,Lt,Rt,zt]})]}),t[126]=yt,t[127]=xt,t[128]=Ft,t[129]=X):X=t[129];let Bt=nt??`full`,Vt=nt===`follow`?S.ahead??0:0,Z;t[130]!==et||t[131]!==at||t[132]!==tt||t[133]!==Bt||t[134]!==Vt?(Z=(0,b.jsx)(pe,{open:et,onOpenChange:tt,onConfirm:at,variant:Bt,strandedCommitCount:Vt}),t[130]=et,t[131]=at,t[132]=tt,t[133]=Bt,t[134]=Vt,t[135]=Z):Z=t[135];let Q;t[136]===O?Q=t[137]:(Q=()=>O(!1),t[136]=O,t[137]=Q);let $;t[138]!==ot||t[139]!==O||t[140]!==Q?($=(0,b.jsx)(Oe,{open:ot,onOpenChange:O,onSuccess:Q,reauth:!0}),t[138]=ot,t[139]=O,t[140]=Q,t[141]=$):$=t[141];let Ht;return t[142]!==P||t[143]!==Y||t[144]!==Mt||t[145]!==X||t[146]!==Z||t[147]!==$?(Ht=(0,b.jsxs)(`div`,{className:`space-y-3`,children:[P,Y,Mt,X,Z,$]}),t[142]=P,t[143]=Y,t[144]=Mt,t[145]=X,t[146]=Z,t[147]=$,t[148]=Ht):Ht=t[148],Ht}function Ne(e){return(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:e},e)}function Pe(e,t){return e-t}export{S as SyncSection};
|
|
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{i as o,n as s,t as c}from"./tooltip-Bz6z4_se.js";import{n as ee,r as te,t as ne}from"./collapsible-BKbszYZV.js";import{i as l,n as u,o as d,s as f,t as p}from"./select-pACXgFe2.js";import{n as m,t as h}from"./toggle-group-B7p69Qfd.js";import{t as g}from"./button-DzgjsZzC.js";import{n as _}from"./dist-BGzUo_18.js";import{d as re,f as ie,h as ae,m as oe,p as se}from"./share-D-LUU2aX-B7Yg0G_m.js";import{i as ce}from"./use-apply-config-theme-CYFG76sS.js";import{C as le,T as ue,a as de,c as fe,h as pe,l as me,m as he,n as ge,o as _e,p as ve,t as ye,u as be,v as xe,w as Se,x as Ce}from"./SyncStatusBadge-CF1z14DG.js";import{t as we}from"./arrow-up-right-nJaICi16.js";import{t as Te}from"./chevron-right-Bofu4lib.js";import{t as Ee}from"./use-settings-route-Bj-m9X61.js";import"./config-provider-DY_fun1v.js";import{n as De}from"./use-git-sync-status-PkMYmN4D.js";import{t as Oe}from"./AuthModal-YZGpNH__.js";import{t as v}from"./PublishToGitHubDialog-DdtYAP9Y.js";import{t as ke}from"./skeleton-CrbF9ppq.js";import{n as Ae,t as je}from"./SettingsSectionHeader-BKhNIRp2.js";var Me=a(),y=e(n(),1),b=t(),x=`data-[state=on]:border-primary data-[state=on]:bg-primary data-[state=on]:text-primary-foreground data-[state=on]:hover:bg-primary/90`;function S(){let e=(0,Me.c)(4),[t,n]=(0,y.useState)(!1),r=(0,y.useRef)(null),i=(0,y.useRef)(null),a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,b.jsx)(C,{onPublish:()=>n(!0),setUpSyncingRef:r}),e[0]=a):a=e[0];let o;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>(r.current??i.current)?.focus(),e[1]=o):o=e[1];let s;return e[2]===t?s=e[3]:(s=(0,b.jsxs)(`section`,{ref:i,"aria-labelledby":`settings-sync-title`,tabIndex:-1,"data-testid":`settings-sync-section`,children:[a,(0,b.jsx)(v,{open:t,onOpenChange:n,returnFocus:o})]}),e[2]=t,e[3]=s),s}function C(e){let t=(0,Me.c)(149),{onPublish:n,setUpSyncingRef:a}=e,{_:v}=i(),{status:S,fetchError:C}=De(),{projectConfig:Fe,projectLocalConfig:Ie,projectLocalSynced:Le,projectSynced:Re}=ce(),ze=ue(),Be=Ce(),Ve=le(),[He,Ue]=(0,y.useState)(!1),We,Ge;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(We=()=>{Ee()&&Ue(!0)},Ge=[],t[0]=We,t[1]=Ge):(We=t[0],Ge=t[1]),(0,y.useEffect)(We,Ge);let w=oe(Ie?.autoSync),Ke=w.pushIntervalSeconds<w.pullIntervalSeconds,qe=Ie?.autoSync,Je;t[2]===qe?Je=t[3]:(Je=ae(qe),t[2]=qe,t[3]=Je);let Ye=Je,Xe=Fe?.autoSync?.default,Ze;t[4]===Xe?Ze=t[5]:(Ze=se(Xe),t[4]=Xe,t[5]=Ze);let Qe=Ze,$e;t[6]!==Ye||t[7]!==S?($e=Ye??(S===null?`off`:xe(S)),t[6]=Ye,t[7]=S,t[8]=$e):$e=t[8];let T=$e,E=Le&&Ye===null&&Qe!==null,{confirmOpen:et,setConfirmOpen:tt,pendingMode:nt,onModeSelect:D,onTurnOff:rt,onKeepCurrent:it,onConfirm:at}=Se(ze,T),[ot,O]=(0,y.useState)(!1),k=!Le;if(S===null){let e=C!==null,n=e?`settings-sync-unavailable`:`settings-sync-loading`,i;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,b.jsx)(je,{titleId:`settings-sync-title`,title:(0,b.jsx)(r,{id:`Nu4DdT`}),scope:`project-local`,level:`block`}),t[9]=i):i=t[9];let a=!e,o;t[10]!==C||t[11]!==e?(o=e?(0,b.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:C===`network`?(0,b.jsx)(r,{id:`epGMvx`}):(0,b.jsx)(r,{id:`wLRCZ8`})}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(`span`,{className:`sr-only`,children:(0,b.jsx)(r,{id:`OgvwrM`})}),(0,b.jsx)(ke,{className:`h-24`})]}),t[10]=C,t[11]=e,t[12]=o):o=t[12];let s;t[13]!==a||t[14]!==o?(s=(0,b.jsx)(`div`,{role:`status`,"aria-live":`polite`,"aria-busy":a,children:o}),t[13]=a,t[14]=o,t[15]=s):s=t[15];let c;return t[16]!==s||t[17]!==n?(c=(0,b.jsxs)(`div`,{className:`space-y-3`,"data-testid":n,children:[i,s]}),t[16]=s,t[17]=n,t[18]=c):c=t[18],c}if(!S.hasRemote){let e=T!==`off`,i;t[19]!==rt||t[20]!==a?(i=()=>{rt()&&a.current?.focus()},t[19]=rt,t[20]=a,t[21]=i):i=t[21];let o=i,s;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,b.jsx)(r,{id:`Nu4DdT`}),t[22]=s):s=t[22];let c;t[23]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,b.jsx)(je,{titleId:`settings-sync-title`,title:s,scope:`project-local`,level:`block`,children:(0,b.jsx)(r,{id:`AiNMQ7`})}),t[23]=c):c=t[23];let l;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,b.jsx)(`div`,{className:`text-sm font-medium`,children:(0,b.jsx)(r,{id:`3_6U6f`})}),t[24]=l):l=t[24];let u;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,b.jsxs)(`div`,{className:`space-y-0.5`,children:[l,(0,b.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,b.jsx)(r,{id:`i92eAT`})})]}),t[25]=u):u=t[25];let d;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,b.jsx)(r,{id:`zkz0Fg`}),t[26]=d):d=t[26];let f;t[27]!==n||t[28]!==a?(f=(0,b.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[u,(0,b.jsx)(g,{ref:a,onClick:n,"data-testid":`settings-sync-setup`,children:d})]}),t[27]=n,t[28]=a,t[29]=f):f=t[29];let p;t[30]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,b.jsx)(te,{asChild:!0,children:(0,b.jsxs)(g,{variant:`ghost`,size:`sm`,className:`group gap-1 px-1.5 text-muted-foreground`,children:[(0,b.jsx)(Te,{className:`size-3.5 transition-transform group-data-[state=open]:rotate-90`,"aria-hidden":!0}),(0,b.jsx)(r,{id:`6caB2T`})]})}),t[30]=p):p=t[30];let m;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,b.jsxs)(ne,{children:[p,(0,b.jsx)(ee,{className:`px-1.5 pt-2 text-sm text-muted-foreground`,children:(0,b.jsx)(r,{id:`44DSl0`,components:{0:(0,b.jsx)(`code`,{className:`rounded bg-muted px-1 py-0.5 font-mono text-xs`})}})})]}),t[31]=m):m=t[31];let h;t[32]!==e||t[33]!==k||t[34]!==o?(h=e?(0,b.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border p-3`,"data-testid":`settings-sync-no-remote-auto-on`,children:[(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,b.jsx)(r,{id:`9U-7Xv`})}),(0,b.jsx)(g,{variant:`outline`,size:`xs`,className:`self-start`,onClick:o,disabled:k,"data-testid":`settings-sync-no-remote-turn-off`,children:(0,b.jsx)(r,{id:`v6Glry`})})]}):null,t[32]=e,t[33]=k,t[34]=o,t[35]=h):h=t[35];let _;return t[36]!==f||t[37]!==h?(_=(0,b.jsxs)(`div`,{className:`space-y-4`,"data-testid":`settings-sync-empty`,children:[c,f,m,h]}),t[36]=f,t[37]=h,t[38]=_):_=t[38],_}let st=S.pushPermission?.checkStatus===`denied`||S.pausedReason===`no-push-permission`,ct;t[39]===S.pushPermission?ct=t[40]:(ct=ve(S.pushPermission),t[39]=S.pushPermission,t[40]=ct);let lt=ct,ut;t[41]===S?ut=t[42]:(ut=fe(S),t[41]=S,t[42]=ut);let dt=ut,ft=T===`full`&&st&<,A=T===`full`&&st&&!lt&&!dt,j=!A&&!ft&&st&&!dt,pt=S.pushPermission?.checkStatus===`denied`&&S.pushPermission.deniedReason!==`not-authenticated`&&!dt,mt;t[43]===S?mt=t[44]:(mt=be(S),t[43]=S,t[44]=mt);let M=mt,ht=st&&S.pausedReason!==`unsafe-incoming-symlinks`,gt;t[45]!==M||t[46]!==ht||t[47]!==S.pausedReason||t[48]!==S.remote?(gt=S.pausedReason?M?_e(`auth-not-found-as-identity`,me(S.remote)):ht?null:(0,b.jsx)(ye,{reason:S.pausedReason}):null,t[45]=M,t[46]=ht,t[47]=S.pausedReason,t[48]=S.remote,t[49]=gt):gt=t[49];let N=gt,_t;t[50]!==E||t[51]!==T||t[52]!==it||t[53]!==D?(_t=function(e){let t=e===``?T:e;if(ie(t)){if(t===T){E&&it();return}D(t)}},t[50]=E,t[51]=T,t[52]=it,t[53]=D,t[54]=_t):_t=t[54];let vt=_t,yt=Qe??`ask`,bt;t[55]!==v||t[56]!==Be?(bt=function(e){if(e!==`ask`&&!ie(e))return;if(Be===null){_.error(v({id:`fiMNLl`}));return}let t;bb163:switch(e){case`ask`:t=null;break bb163;case`off`:t=!1;break bb163;case`full`:t=!0;break bb163;case`follow`:t=`follow`;break bb163;default:throw Error(`unhandled committed default: ${String(e)}`)}let n=Be(t);if(!n.ok){let e=n.error;_.error(v({id:`oAFVKX`,values:{detail:e}}))}},t[55]=v,t[56]=Be,t[57]=bt):bt=t[57];let xt=bt,St;t[58]===v?St=t[59]:(St=function(e){switch(e){case 30:return v({id:`OqqecQ`});case 60:return v({id:`4mbrAq`});case 300:return v({id:`PEGxvo`});case 900:return v({id:`Cz-K13`});case 3600:return v({id:`vp5vfW`});default:return v({id:`U7Iesw`,values:{seconds:e}})}},t[58]=v,t[59]=St);let Ct=St,wt;t[60]===Symbol.for(`react.memo_cache_sentinel`)?(wt=function(e){return re.includes(e)?[...re]:[...re,e].sort(Pe)},t[60]=wt):wt=t[60];let Tt=wt,Et=function(e,t){let n=Number(t);if(!Number.isFinite(n)||Ve===null)return;let r=Ve({pullIntervalSeconds:e===`pull`?n:w.pullIntervalSeconds,pushIntervalSeconds:e===`push`?n:w.pushIntervalSeconds});if(!r.ok){let e=r.error;_.error(v({id:`WOfp4H`,values:{detail:e}}))}},Dt;t[61]===Symbol.for(`react.memo_cache_sentinel`)?(Dt=(0,b.jsx)(r,{id:`Nu4DdT`}),t[61]=Dt):Dt=t[61];let P;t[62]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,b.jsx)(je,{titleId:`settings-sync-title`,title:Dt,scope:`project-local`,level:`block`,children:(0,b.jsx)(r,{id:`qLXJTB`})}),t[62]=P):P=t[62];let Ot;t[63]===Symbol.for(`react.memo_cache_sentinel`)?(Ot=(0,b.jsx)(`div`,{id:`settings-sync-mode-label`,className:`text-sm font-medium`,children:(0,b.jsx)(r,{id:`yZepkk`})}),t[63]=Ot):Ot=t[63];let F;t[64]===T?F=t[65]:(F=(0,b.jsx)(`p`,{className:`text-muted-foreground text-1sm`,"data-testid":`settings-sync-body`,children:T===`full`?(0,b.jsx)(r,{id:`zBiFZh`}):T===`follow`?(0,b.jsx)(r,{id:`PGRnbw`}):(0,b.jsx)(r,{id:`t5I7P_`})}),t[64]=T,t[65]=F);let I;t[66]===E?I=t[67]:(I=E?(0,b.jsx)(`p`,{id:`settings-sync-mode-default-note`,className:`text-muted-foreground text-1sm`,"data-testid":`settings-sync-mode-from-default`,children:(0,b.jsx)(r,{id:`uNkJ8H`})}):null,t[66]=E,t[67]=I);let L;t[68]!==v||t[69]!==S.remote?(L=S.remote?(0,b.jsxs)(`p`,{className:`text-muted-foreground text-1sm truncate`,"data-testid":`settings-sync-remote`,children:[(0,b.jsx)(r,{id:`Q8A-U_`}),` `,S.remote.webUrl?(0,b.jsxs)(`a`,{href:S.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`text-foreground hover:text-primary hover:underline inline-flex items-center gap-0.5`,"aria-label":v({id:`1nke1r`,values:{0:S.remote.label}}),"data-testid":`settings-sync-remote-link`,children:[(0,b.jsx)(`span`,{children:S.remote.label}),(0,b.jsx)(we,{className:`inline size-3.5`,"aria-hidden":!0})]}):(0,b.jsx)(`span`,{className:`font-medium text-foreground`,"data-testid":`settings-sync-remote-label`,children:S.remote.label})]}):null,t[68]=v,t[69]=S.remote,t[70]=L):L=t[70];let R;t[71]!==F||t[72]!==I||t[73]!==L?(R=(0,b.jsxs)(`div`,{className:`min-w-0`,children:[Ot,F,I,L]}),t[71]=F,t[72]=I,t[73]=L,t[74]=R):R=t[74];let kt=E?`settings-sync-mode-default-note`:void 0,At;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(At=(0,b.jsx)(m,{value:`off`,className:x,"data-testid":`settings-sync-mode-off`,children:(0,b.jsx)(r,{id:`BWTzAb`})}),t[75]=At):At=t[75];let jt;t[76]===Symbol.for(`react.memo_cache_sentinel`)?(jt=(0,b.jsx)(m,{value:`follow`,className:x,"data-testid":`settings-sync-mode-follow`,children:(0,b.jsx)(r,{id:`tlGXxX`})}),t[76]=jt):jt=t[76];let z;t[77]!==pt||t[78]!==j?(z=pt?(0,b.jsxs)(c,{children:[(0,b.jsx)(o,{asChild:!0,children:(0,b.jsx)(`span`,{className:`inline-flex`,children:(0,b.jsx)(m,{value:`full`,className:x,disabled:!0,"aria-describedby":j?`settings-sync-denied-hint-text`:void 0,"data-testid":`settings-sync-mode-full`,children:(0,b.jsx)(r,{id:`IXiG0B`})})})}),(0,b.jsx)(s,{"data-testid":`settings-sync-mode-full-tip`,children:(0,b.jsx)(r,{id:`EiVgl5`})})]}):(0,b.jsx)(m,{value:`full`,className:x,"data-testid":`settings-sync-mode-full`,children:(0,b.jsx)(r,{id:`IXiG0B`})}),t[77]=pt,t[78]=j,t[79]=z):z=t[79];let B;t[80]!==T||t[81]!==k||t[82]!==vt||t[83]!==kt||t[84]!==z?(B=(0,b.jsxs)(h,{type:`single`,variant:`outline`,spacing:2,value:T,onValueChange:vt,disabled:k,"aria-labelledby":`settings-sync-mode-label`,"aria-describedby":kt,"data-testid":`settings-sync-mode-toggle`,children:[At,jt,z]}),t[80]=T,t[81]=k,t[82]=vt,t[83]=kt,t[84]=z,t[85]=B):B=t[85];let V;t[86]!==R||t[87]!==B?(V=(0,b.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[R,B]}),t[86]=R,t[87]=B,t[88]=V):V=t[88];let H;t[89]!==O||t[90]!==ft?(H=ft&&(0,b.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-reconnect`,children:[(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,b.jsx)(r,{id:`tnG-m6`})}),(0,b.jsx)(g,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>O(!0),children:(0,b.jsx)(r,{id:`5lWFkC`})})]}),t[89]=O,t[90]=ft,t[91]=H):H=t[91];let U;t[92]!==D||t[93]!==A?(U=A&&(0,b.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-switch-follow`,children:[(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,b.jsx)(r,{id:`srdlOs`})}),(0,b.jsx)(g,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>D(`follow`),"data-testid":`settings-sync-switch-follow-action`,children:(0,b.jsx)(r,{id:`v16Pzh`})})]}),t[92]=D,t[93]=A,t[94]=U):U=t[94];let W;t[95]!==T||t[96]!==j?(W=j&&(0,b.jsx)(`p`,{id:`settings-sync-denied-hint-text`,className:`text-1sm text-muted-foreground mt-2`,"data-testid":`settings-sync-denied-hint`,children:T===`follow`?(0,b.jsx)(r,{id:`EiVgl5`}):(0,b.jsx)(r,{id:`eNOyTV`})}),t[95]=T,t[96]=j,t[97]=W):W=t[97];let G;t[98]===N?G=t[99]:(G=N!==null&&(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground mt-2`,"data-testid":`settings-sync-reason`,children:N}),t[98]=N,t[99]=G);let K;t[100]!==N||t[101]!==S.refusedSymlinkPaths?(K=N!==null&&(S.refusedSymlinkPaths?.length??0)>0&&(0,b.jsx)(`div`,{className:`mt-2`,children:(0,b.jsx)(ge,{paths:S.refusedSymlinkPaths})}),t[100]=N,t[101]=S.refusedSymlinkPaths,t[102]=K):K=t[102];let q;t[103]!==M||t[104]!==j||t[105]!==A||t[106]!==S.pushPermission?(q=S.pushPermission?.checkStatus===`denied`&&(M||A||j)?(0,b.jsx)(`div`,{className:`mt-2 space-y-1`,"data-testid":`settings-sync-identity`,children:de(S.pushPermission).map(Ne)}):null,t[103]=M,t[104]=j,t[105]=A,t[106]=S.pushPermission,t[107]=q):q=t[107];let J;t[108]!==O||t[109]!==S.pushPermission?(J=he(S.pushPermission)&&(0,b.jsxs)(`div`,{className:`mt-2 flex items-start gap-2`,"data-testid":`settings-sync-signin-again`,children:[(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground flex-1 min-w-0`,children:(0,b.jsx)(r,{id:`C_cPoW`})}),(0,b.jsx)(g,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>O(!0),children:(0,b.jsx)(r,{id:`5lWFkC`})})]}),t[108]=O,t[109]=S.pushPermission,t[110]=J):J=t[110];let Y;t[111]!==V||t[112]!==H||t[113]!==U||t[114]!==W||t[115]!==G||t[116]!==K||t[117]!==q||t[118]!==J?(Y=(0,b.jsxs)(`div`,{className:`rounded-md border p-3`,children:[V,H,U,W,G,K,q,J]}),t[111]=V,t[112]=H,t[113]=U,t[114]=W,t[115]=G,t[116]=K,t[117]=q,t[118]=J,t[119]=Y):Y=t[119];let Mt=T!==`off`&&(0,b.jsxs)(ne,{open:He,onOpenChange:Ue,children:[(0,b.jsx)(te,{asChild:!0,children:(0,b.jsxs)(g,{variant:`ghost`,size:`sm`,className:`group gap-1 px-1.5 text-muted-foreground`,"data-testid":`settings-sync-advanced-trigger`,children:[(0,b.jsx)(Te,{className:`size-3.5 transition-transform group-data-[state=open]:rotate-90`,"aria-hidden":!0}),(0,b.jsx)(r,{id:`sxkWRg`})]})}),(0,b.jsx)(ee,{className:`pt-2`,children:(0,b.jsxs)(`div`,{className:`rounded-md border p-3 space-y-3`,"data-testid":`settings-sync-intervals`,children:[(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`div`,{id:`settings-sync-pull-interval-label`,className:`text-sm font-medium`,children:(0,b.jsx)(r,{id:`Xs1kjx`})}),(0,b.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,b.jsx)(r,{id:`T1fMJ6`})})]}),(0,b.jsxs)(p,{value:String(w.pullIntervalSeconds),onValueChange:e=>Et(`pull`,e),disabled:!Le,children:[(0,b.jsx)(d,{size:`sm`,className:`w-40 shrink-0`,"aria-labelledby":`settings-sync-pull-interval-label`,"data-testid":`settings-sync-pull-interval`,children:(0,b.jsx)(f,{})}),(0,b.jsx)(u,{children:Tt(w.pullIntervalSeconds).map(e=>(0,b.jsx)(l,{value:String(e),children:Ct(e)},e))})]})]}),T===`full`&&(0,b.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-t pt-3`,children:[(0,b.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,b.jsx)(`div`,{id:`settings-sync-push-interval-label`,className:`text-sm font-medium`,children:(0,b.jsx)(r,{id:`gyYvCN`})}),(0,b.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,b.jsx)(r,{id:`czQDKY`})})]}),(0,b.jsxs)(p,{value:String(w.pushIntervalSeconds),onValueChange:e=>Et(`push`,e),disabled:!Le,children:[(0,b.jsx)(d,{size:`sm`,className:`w-40 shrink-0`,"aria-labelledby":`settings-sync-push-interval-label`,"data-testid":`settings-sync-push-interval`,children:(0,b.jsx)(f,{})}),(0,b.jsx)(u,{children:Tt(w.pushIntervalSeconds).map(e=>(0,b.jsx)(l,{value:String(e),children:Ct(e)},e))})]})]}),T===`full`&&Ke&&(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-sync-push-outpaces-pull-hint`,children:(0,b.jsx)(r,{id:`x-E_vF`})})]})})]}),Nt;t[120]===Symbol.for(`react.memo_cache_sentinel`)?(Nt=(0,b.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,b.jsx)(`div`,{id:`settings-sync-default-label`,className:`text-sm font-medium`,children:(0,b.jsx)(r,{id:`j_Z6g7`})}),(0,b.jsx)(Ae,{scope:`project`})]}),t[120]=Nt):Nt=t[120];let Pt;t[121]===Symbol.for(`react.memo_cache_sentinel`)?(Pt=(0,b.jsxs)(`div`,{className:`space-y-0.5`,children:[Nt,(0,b.jsx)(`p`,{className:`text-muted-foreground text-1sm`,children:(0,b.jsx)(r,{id:`Zysl7r`})})]}),t[121]=Pt):Pt=t[121];let Ft=!Re,It;t[122]===Symbol.for(`react.memo_cache_sentinel`)?(It=(0,b.jsx)(m,{value:`ask`,className:x,"data-testid":`settings-sync-default-ask`,children:(0,b.jsx)(r,{id:`EdQY6l`})}),t[122]=It):It=t[122];let Lt;t[123]===Symbol.for(`react.memo_cache_sentinel`)?(Lt=(0,b.jsx)(m,{value:`off`,className:x,"data-testid":`settings-sync-default-off`,children:(0,b.jsx)(r,{id:`BWTzAb`})}),t[123]=Lt):Lt=t[123];let Rt;t[124]===Symbol.for(`react.memo_cache_sentinel`)?(Rt=(0,b.jsx)(m,{value:`follow`,className:x,"data-testid":`settings-sync-default-follow`,children:(0,b.jsx)(r,{id:`tlGXxX`})}),t[124]=Rt):Rt=t[124];let zt;t[125]===Symbol.for(`react.memo_cache_sentinel`)?(zt=(0,b.jsx)(m,{value:`full`,className:x,"data-testid":`settings-sync-default-full`,children:(0,b.jsx)(r,{id:`IXiG0B`})}),t[125]=zt):zt=t[125];let X;t[126]!==yt||t[127]!==xt||t[128]!==Ft?(X=(0,b.jsxs)(`div`,{className:`rounded-md border p-3 space-y-2`,"data-testid":`settings-sync-default`,children:[Pt,(0,b.jsxs)(h,{type:`single`,variant:`outline`,spacing:2,value:yt,onValueChange:xt,disabled:Ft,"aria-labelledby":`settings-sync-default-label`,"data-testid":`settings-sync-default-toggle`,children:[It,Lt,Rt,zt]})]}),t[126]=yt,t[127]=xt,t[128]=Ft,t[129]=X):X=t[129];let Bt=nt??`full`,Vt=nt===`follow`?S.ahead??0:0,Z;t[130]!==et||t[131]!==at||t[132]!==tt||t[133]!==Bt||t[134]!==Vt?(Z=(0,b.jsx)(pe,{open:et,onOpenChange:tt,onConfirm:at,variant:Bt,strandedCommitCount:Vt}),t[130]=et,t[131]=at,t[132]=tt,t[133]=Bt,t[134]=Vt,t[135]=Z):Z=t[135];let Q;t[136]===O?Q=t[137]:(Q=()=>O(!1),t[136]=O,t[137]=Q);let $;t[138]!==ot||t[139]!==O||t[140]!==Q?($=(0,b.jsx)(Oe,{open:ot,onOpenChange:O,onSuccess:Q,reauth:!0}),t[138]=ot,t[139]=O,t[140]=Q,t[141]=$):$=t[141];let Ht;return t[142]!==P||t[143]!==Y||t[144]!==Mt||t[145]!==X||t[146]!==Z||t[147]!==$?(Ht=(0,b.jsxs)(`div`,{className:`space-y-3`,children:[P,Y,Mt,X,Z,$]}),t[142]=P,t[143]=Y,t[144]=Mt,t[145]=X,t[146]=Z,t[147]=$,t[148]=Ht):Ht=t[148],Ht}function Ne(e){return(0,b.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:e},e)}function Pe(e,t){return e-t}export{S as SyncSection};
|
|
@@ -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{i as o,n as s,t as c}from"./tooltip-Bz6z4_se.js";import{n as l,r as u,t as d}from"./collapsible-BKbszYZV.js";import{i as f,n as p,o as m,s as h,t as g}from"./select-pACXgFe2.js";import{t as _}from"./button-DzgjsZzC.js";import{n as v}from"./dist-BGzUo_18.js";import{t as y}from"./dist-C_FzPxEX2.js";import{n as b}from"./config-errors-DDAH9fqy.js";import{v as x}from"./documents-events-ddyuXdQl.js";import{f as S,h as C}from"./share-D-LUU2aX-B7Yg0G_m.js";import{i as w}from"./use-apply-config-theme-CYFG76sS.js";import{t as T}from"./createLucideIcon-DdBzwsHe.js";import{n as E,t as D}from"./arrow-up-BGHhPj4y.js";import{t as ee}from"./arrow-up-right-nJaICi16.js";import{t as O}from"./chevron-right-Bofu4lib.js";import{n as k,t as te}from"./settings-2-DoBlNQMk.js";import{t as A}from"./git-merge-VDBzSZBV.js";import{t as j}from"./spinner-Bx8xD6f8.js";import{t as M}from"./refresh-cw-CC7UZEnZ.js";import{t as N}from"./terminal-Cpb4l1oH.js";import{t as P}from"./triangle-alert-BXrUEeRU.js";import{t as F}from"./badge-BIamhtRR.js";import{a as I,c as ne,i as re,n as L,o as ie,r as ae,s as oe,t as se}from"./dialog-BJEjKJjL.js";import{a as ce,u as R}from"./use-settings-route-Bj-m9X61.js";import{c as le,h as ue,l as de}from"./doc-hash-BJkweiX9.js";import{a as fe,i as z,r as pe,t as me}from"./popover-Mb1GgB61.js";import{n as he}from"./use-conflicts-CIjDyM9c.js";import"./config-provider-XgOiT52f.js";import{n as ge}from"./use-git-sync-status-PkMYmN4D.js";import{t as _e}from"./reveal-editor-SLzwvD1I.js";import{n as B,t as ve}from"./DisclosureWarning-CYHeueUe.js";import{t as ye}from"./terminal-command-events-h-p66odT.js";var V=T(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),be=T(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),xe=T(`cloud-alert`,[[`path`,{d:`M12 12v4`,key:`tww15h`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.128 16.949A7 7 0 1 1 15.71 8h1.79a1 1 0 0 1 0 9h-1.642`,key:`1namsd`}]]),Se=T(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),H=T(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Ce=T(`git-commit-vertical`,[[`path`,{d:`M12 3v6`,key:`1holv5`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`M12 15v6`,key:`a9ows0`}]]),we=T(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),Te=T(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),Ee=T(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),U=a(),W=e(n(),1);function De(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=e?`full`:`off`,r=t.patch({autoSync:{mode:n,enabled:e}});return r.ok?{ok:!0}:{ok:!1,error:b(r.error)}},e[0]=t,e[1]=r),r}function Oe(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:{mode:e,enabled:null}});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function ke(){let e=(0,U.c)(2),{projectBinding:t,projectSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:{default:e}});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function Ae(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:e});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function je(e,t){let n=(0,U.c)(12),{_:r}=i(),[a,o]=(0,W.useState)(!1),s;n[0]!==r||n[1]!==e?(s=function(t){if(e===null)return v.info(r({id:`fiMNLl`}),{id:`sync-settings-not-ready`}),!1;let n=e(t);if(!n.ok){console.error(`[sync] toggle failed:`,n.error);let e=n.error;return v.error(r(t?{id:`04RA0-`,values:{detail:e}}:{id:`qjHMHf`,values:{detail:e}})),!1}return!0},n[0]=r,n[1]=e,n[2]=s):s=n[2];let c=s,l;n[3]===c?l=n[4]:(l=function(e){if(e){o(!0);return}c(!1)},n[3]=c,n[4]=l);let u=l,d;n[5]!==c||n[6]!==t?(d=function(){c(!0)&&(o(!1),t?.onEnabled?.())},n[5]=c,n[6]=t,n[7]=d):d=n[7];let f=d,p;return n[8]!==a||n[9]!==f||n[10]!==u?(p={confirmOpen:a,setConfirmOpen:o,onToggleRequest:u,onConfirm:f},n[8]=a,n[9]=f,n[10]=u,n[11]=p):p=n[11],p}function Me(e,t,n){let r=(0,U.c)(22),{_:a}=i(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(null),u;r[0]!==a||r[1]!==n||r[2]!==e?(u=function(t){if(e===null)return v.info(a({id:`fiMNLl`}),{id:`sync-settings-not-ready`}),!1;let r=e(t);if(!r.ok){console.error(`[sync] mode change failed:`,r.error);let e=r.error;return v.error(a({id:`nOEDQs`,values:{detail:e}})),!1}return n?.onApplied?.(t),!0},r[0]=a,r[1]=n,r[2]=e,r[3]=u):u=r[3];let d=u,f;r[4]!==d||r[5]!==t?(f=function(e){if(e!==t){if(e===`off`){d(`off`);return}l(e),s(!0)}},r[4]=d,r[5]=t,r[6]=f):f=r[6];let p=f,m;r[7]===d?m=r[8]:(m=function(){return d(`off`)},r[7]=d,r[8]=m);let h=m,g;r[9]!==d||r[10]!==t?(g=function(){return d(t)},r[9]=d,r[10]=t,r[11]=g):g=r[11];let _=g,y;r[12]!==d||r[13]!==c?(y=function(){c!==null&&d(c)&&s(!1)},r[12]=d,r[13]=c,r[14]=y):y=r[14];let b=y,x;return r[15]!==o||r[16]!==b||r[17]!==_||r[18]!==p||r[19]!==h||r[20]!==c?(x={confirmOpen:o,setConfirmOpen:s,pendingMode:c,onModeSelect:p,onTurnOff:h,onKeepCurrent:_,onConfirm:b},r[15]=o,r[16]=b,r[17]=_,r[18]=p,r[19]=h,r[20]=c,r[21]=x):x=r[21],x}function Ne(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:e});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function Pe(e,t,n){let r=(0,U.c)(19),{_:a}=i(),o=Ne(),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(null),d;r[0]!==e||r[1]!==t?(d=C(e)??t,r[0]=e,r[1]=t,r[2]=d):d=r[2];let f=d,p;r[3]!==a||r[4]!==o?(p=function(e){if(o===null)return v.info(a({id:`fiMNLl`}),{id:`sync-settings-not-ready`}),!1;let t=o(e);if(!t.ok){console.error(`[sync] badge control failed:`,t.error);let e=t.error;return v.error(a({id:`ZVOhXM`,values:{detail:e}})),!1}return!0},r[3]=a,r[4]=o,r[5]=p):p=r[5];let m=p,h;r[6]!==m||r[7]!==f?(h=function(e){if(e!==f){if(e===`off`){m({mode:`off`,enabled:null,resumeMode:null});return}u(e),c(!0)}},r[6]=m,r[7]=f,r[8]=h):h=r[8];let g=h,_;r[9]!==m||r[10]!==l?(_=function(){l!==null&&m({mode:l,enabled:null,resumeMode:null})&&(c(!1),u(null))},r[9]=m,r[10]=l,r[11]=_):_=r[11];let y=_,b=l===`follow`?n:0,x;return r[12]!==s||r[13]!==f||r[14]!==y||r[15]!==g||r[16]!==l||r[17]!==b?(x={mode:f,confirmOpen:s,setConfirmOpen:c,pendingMode:l,strandedCommitCount:b,onModeSelect:g,onConfirm:y},r[12]=s,r[13]=f,r[14]=y,r[15]=g,r[16]=l,r[17]=b,r[18]=x):x=r[18],x}async function Fe(e){let t=await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})});if(!t.ok)throw Error(`sync trigger failed: ${t.status}`)}var Ie=5e3,Le=15e3,Re=3e4,ze=0;function Be(){let e=Date.now();e-ze<Re||(ze=e,Fe(`fetch`).catch(()=>{ze===e&&(ze=0)}))}async function Ve(e){try{let t=await fetch(`/api/git/worktree-status`,{signal:e});if(!t.ok)return console.warn(`[sync] worktree status read failed: http`,t.status),{kind:`failed`,reason:`http`};let n=await t.json();return n.readable===!1?{kind:`unreadable`}:{kind:`ok`,status:n}}catch(t){return e.aborted?{kind:`failed`,reason:`aborted`}:(console.warn(`[sync] worktree status read failed: network`,t instanceof Error?t.message:t),{kind:`failed`,reason:`network`})}}var He={status:null,unreadable:!1,stale:!1,lastReadAt:null};function Ue(e){let t=(0,U.c)(9),[n,r]=(0,W.useState)(He),i,a;t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;let t=!1,n=!1,i=!1,a=null;function o(){if(n){i=!0;return}n=!0;let e=new AbortController;a=e;let s=setTimeout(()=>e.abort(),Le);Ve(e.signal).then(e=>{if(!t){if(e.kind===`ok`){r({status:e.status,unreadable:!1,stale:!1,lastReadAt:Date.now()});return}if(e.kind===`unreadable`){r(Ge);return}r(We)}}).finally(()=>{clearTimeout(s),a===e&&(a=null),n=!1,i&&!t&&(i=!1,o())})}o(),Be();let s=setInterval(o,Ie),c=x(e=>{e.includes(`sync-status`)&&o()});return()=>{t=!0,clearInterval(s),c(),a?.abort()}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,W.useEffect)(i,a);let o=e&&n.status===null&&!n.unreadable,s;return t[3]!==n.lastReadAt||t[4]!==n.stale||t[5]!==n.status||t[6]!==n.unreadable||t[7]!==o?(s={status:n.status,loading:o,unreadable:n.unreadable,stale:n.stale,lastReadAt:n.lastReadAt},t[3]=n.lastReadAt,t[4]=n.stale,t[5]=n.status,t[6]=n.unreadable,t[7]=o,t[8]=s):s=t[8],s}function We(e){return e.status===null?e.unreadable?e:{...e,unreadable:!0,stale:!1}:e.unreadable||e.stale?e:{...e,stale:!0}}function Ge(e){return{...e,unreadable:!0,stale:!1}}function Ke(e){return e.syncMode===void 0?e.syncEnabled?`full`:`off`:e.syncMode}var G=t();function K(e){let t=(0,U.c)(4),{variant:n}=e;if((n===void 0?`full`:n)===`follow`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(ne,{children:(0,G.jsx)(r,{id:`W7mERj`})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsxs)(G.Fragment,{children:[e,(0,G.jsx)(I,{children:(0,G.jsx)(r,{id:`KmVekT`})})]}),t[1]=n):n=t[1],n}let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsx)(ne,{children:(0,G.jsx)(r,{id:`Uo2Rj7`})}),t[2]=i):i=t[2];let a;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsxs)(G.Fragment,{children:[i,(0,G.jsx)(I,{children:(0,G.jsx)(r,{id:`n6hXUm`})})]}),t[3]=a):a=t[3],a}function q(e){let t=(0,U.c)(2),{variant:n}=e,r=n===void 0?`full`:n,i;return t[0]===r?i=t[1]:(i=(0,G.jsx)(ve,{children:r===`follow`?(0,G.jsx)(Je,{}):(0,G.jsx)(qe,{})}),t[0]=r,t[1]=i),i}function qe(){let e=(0,U.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(B,{icon:(0,G.jsx)(be,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`cdmk8A`}),body:(0,G.jsx)(r,{id:`YaeyFh`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(B,{icon:(0,G.jsx)(Ce,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`9i21pa`}),body:(0,G.jsx)(r,{id:`KIIamL`})}),e[1]=n):n=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsxs)(G.Fragment,{children:[t,n,(0,G.jsx)(B,{icon:(0,G.jsx)(k,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`8cpeU3`}),body:(0,G.jsx)(r,{id:`DELNQk`})})]}),e[2]=i):i=e[2],i}function Je(){let e=(0,U.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(B,{icon:(0,G.jsx)(V,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`0xnQ_X`}),body:(0,G.jsx)(r,{id:`aCoQfY`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(B,{icon:(0,G.jsx)(we,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`5rnB76`}),body:(0,G.jsx)(r,{id:`kXNv8P`})}),e[1]=n):n=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsxs)(G.Fragment,{children:[t,n,(0,G.jsx)(B,{icon:(0,G.jsx)(A,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`oBK5fD`}),body:(0,G.jsx)(r,{id:`8Wav8y`})})]}),e[2]=i):i=e[2],i}function Ye(e){let t=(0,U.c)(24),{open:n,onOpenChange:i,onConfirm:a,variant:o,strandedCommitCount:s}=e,c=o===void 0?`full`:o,l=s===void 0?0:s,u=c===`follow`&&l>0,d;t[0]===c?d=t[1]:(d=(0,G.jsx)(oe,{children:(0,G.jsx)(K,{variant:c})}),t[0]=c,t[1]=d);let f;t[2]===c?f=t[3]:(f=(0,G.jsx)(q,{variant:c}),t[2]=c,t[3]=f);let p;t[4]!==u||t[5]!==l?(p=u&&(0,G.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:(0,G.jsx)(r,{id:`caw8gO`,values:{strandedCommitCount:l}})}),t[4]=u,t[5]=l,t[6]=p):p=t[6];let m;t[7]!==f||t[8]!==p?(m=(0,G.jsxs)(L,{children:[f,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,G.jsx)(ae,{asChild:!0,children:(0,G.jsx)(_,{variant:`outline`,children:(0,G.jsx)(r,{id:`dEgA5A`})})}),t[10]=h):h=t[10];let g;t[11]===c?g=t[12]:(g=c===`follow`?(0,G.jsx)(r,{id:`jTUxaN`}):(0,G.jsx)(r,{id:`pPiV8s`}),t[11]=c,t[12]=g);let v;t[13]!==a||t[14]!==g?(v=(0,G.jsxs)(ie,{children:[h,(0,G.jsx)(_,{onClick:a,children:g})]}),t[13]=a,t[14]=g,t[15]=v):v=t[15];let y;t[16]!==d||t[17]!==m||t[18]!==v?(y=(0,G.jsxs)(re,{className:`sm:max-w-lg`,children:[d,m,v]}),t[16]=d,t[17]=m,t[18]=v,t[19]=y):y=t[19];let b;return t[20]!==i||t[21]!==n||t[22]!==y?(b=(0,G.jsx)(se,{open:n,onOpenChange:i,children:y}),t[20]=i,t[21]=n,t[22]=y,t[23]=b):b=t[23],b}async function Xe(e){let t=await fetch(`/api/sync/resolve-blocking`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:e})});if(!t.ok)throw Error(`sync resolve-blocking failed: ${t.status}`)}function Ze(){return typeof window<`u`&&window.okDesktop!=null}function Qe(e){let t=(0,U.c)(23),{paths:n}=e,[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(!1);if(n.length===0)return null;let c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=async function(e){a(e),s(!1);try{await Xe(e),a(null)}catch{s(!0),a(null)}},t[0]=c):c=t[0];let l=c,u=i!==null,d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,G.jsx)(`span`,{id:`sync-blocking-heading`,className:`text-xs font-medium text-foreground`,children:(0,G.jsx)(r,{id:`sdvHp3`})}),t[1]=d):d=t[1];let f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[d,(0,G.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`H4doZt`})})]}),t[2]=f):f=t[2];let p;t[3]===n?p=t[4]:(p=n.map(et),t[3]=n,t[4]=p);let m;t[5]===p?m=t[6]:(m=(0,G.jsx)(`ul`,{"aria-labelledby":`sync-blocking-heading`,className:`flex max-h-28 flex-col gap-1 overflow-y-auto overscroll-contain`,"data-testid":`sync-blocking-list`,children:p}),t[5]=p,t[6]=m);let h;t[7]===o?h=t[8]:(h=o&&(0,G.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,"data-testid":`sync-blocking-error`,children:(0,G.jsx)(r,{id:`FsEXax`})}),t[7]=o,t[8]=h);let g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>void l(`commit`),t[9]=g):g=t[9];let v;t[10]===i?v=t[11]:(v=i===`commit`&&(0,G.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}),t[10]=i,t[11]=v);let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,G.jsx)(r,{id:`N7Lau6`}),t[12]=y):y=t[12];let b;t[13]!==u||t[14]!==v?(b=(0,G.jsxs)(_,{size:`xs`,disabled:u,onClick:g,"data-testid":`sync-blocking-commit`,children:[v,y]}),t[13]=u,t[14]=v,t[15]=b):b=t[15];let x;t[16]===u?x=t[17]:(x=Ze()&&(0,G.jsxs)(_,{variant:`link-muted`,size:`xs`,className:`self-start p-0`,disabled:u,onClick:$e,"data-testid":`sync-blocking-terminal`,children:[(0,G.jsx)(N,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`6EoD0z`})]}),t[16]=u,t[17]=x);let S;return t[18]!==b||t[19]!==x||t[20]!==m||t[21]!==h?(S=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-t pt-3`,children:[f,m,h,b,x]}),t[18]=b,t[19]=x,t[20]=m,t[21]=h,t[22]=S):S=t[22],S}function $e(){return ye(`git-status`)}function et(e){return(0,G.jsx)(`li`,{title:e,className:`min-w-0 truncate font-mono text-2xs text-foreground`,children:e},e)}function J(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function tt(e){return e===``?[]:e.split(`/`)}function nt(e){if(e.length===0)return``;let t=tt(J(e[0]));for(let n of e.slice(1)){let e=tt(J(n)),r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];)r++;if(t=t.slice(0,r),t.length===0)break}return t.join(`/`)}function Y(e,t){return e===``?t:t.slice(e.length+1)}function rt(e,t=8){if(e.length===0)return{prefix:``,groups:[],loose:[]};if(e.length===1)return{prefix:``,groups:[],loose:[{entry:e[0],label:e[0].path}]};let n=nt(e.map(e=>e.path)),r=e.map(e=>{let t=Y(n,e.path);return{entry:e,rel:t,key:J(t)}}),i=()=>new Set(r.map(e=>e.key));for(;i().size>t;){let e=Math.max(...r.map(e=>tt(e.key).length));if(e===0)break;for(let t of r)tt(t.key).length===e&&(t.key=J(t.key))}let a=new Map;for(let{entry:e,rel:t,key:n}of r){let r=a.get(n)??[];r.push({entry:e,label:n===``?t:t.slice(n.length+1)}),a.set(n,r)}let o=[],s=[];for(let[e,t]of a)if(e===``||t.length===1)for(let e of t)s.push({entry:e.entry,label:Y(n,e.entry.path)});else o.push({dir:e,rows:t});return o.sort((e,t)=>t.rows.length-e.rows.length||e.dir.localeCompare(t.dir)),s.sort((e,t)=>e.entry.path.localeCompare(t.entry.path)),{prefix:n,groups:o,loose:s}}function it(e=`sync`,t){Fe(e).catch(e=>{console.warn(`[sync-badge] manual sync trigger failed`,e instanceof Error?e.message:e),t?.()})}function at(e){typeof window>`u`||(_e(),ue(window.location.hash,e)||(window.location.hash=e))}function ot(e){return e.kind===`doc`?de(e.docName):le(e.path)}var st=3e4;function X(e,t,n){let r=n-t;return r<6e4?e({id:`xOTzt5`}):r<36e5?e({id:`_rP3HI`,values:{minutes:Math.floor(r/6e4)}}):r<864e5?e({id:`nYeBmY`,values:{hours:Math.floor(r/36e5)}}):new Date(t).toLocaleDateString()}function Z(e,t){return X(e,new Date(t).getTime(),Date.now())}function ct(){let e=(0,U.c)(2),[t,n]=(0,W.useState)(lt),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=setInterval(()=>n(Date.now()),st);return()=>clearInterval(e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,W.useEffect)(r,i),t}function lt(){return Date.now()}function Q(e){return e.syncMode===`follow`}var ut=[`git-operation-in-progress`,`unsafe-incoming-symlinks`];function $(e){return ut.includes(e)}function dt(e){return e.state===`idle`&&e.conflictCount>0?`conflict`:(e.state===`idle`||e.state===`offline`)&&$(e.pausedReason)?`disabled`:e.state}function ft(e){let t=(0,U.c)(23),{status:n,size:r}=e,i=r===void 0?`size-3.5`:r;switch(dt(n)){case`dormant`:{let e=`${i} text-muted-foreground`,n;return t[0]===e?n=t[1]:(n=(0,G.jsx)(H,{className:e}),t[0]=e,t[1]=n),n}case`idle`:{if(n.ahead>0||n.behind>0){let e=`${i} text-muted-foreground`,n;return t[2]===e?n=t[3]:(n=(0,G.jsx)(M,{className:e}),t[2]=e,t[3]=n),n}let e=`${i} text-muted-foreground`,r;return t[4]===e?r=t[5]:(r=(0,G.jsx)(H,{className:e}),t[4]=e,t[5]=r),r}case`fetching`:case`pulling`:case`pushing`:{let e=`${i} text-muted-foreground`,n;return t[6]===e?n=t[7]:(n=(0,G.jsx)(j,{"aria-hidden":`true`,icon:M,className:e}),t[6]=e,t[7]=n),n}case`conflict`:{let e=`${i} text-warning`,n;return t[8]===e?n=t[9]:(n=(0,G.jsx)(P,{className:e}),t[8]=e,t[9]=n),n}case`offline`:{let e=`${i} text-muted-foreground`,n;return t[10]===e?n=t[11]:(n=(0,G.jsx)(Se,{className:e}),t[10]=e,t[11]=n),n}case`auth-error`:{let e;return t[12]!==i||t[13]!==n?(e=Ot(n)?(0,G.jsx)(xe,{className:`${i} text-destructive`}):(0,G.jsx)(Te,{className:`${i} text-destructive`}),t[12]=i,t[13]=n,t[14]=e):e=t[14],e}case`disabled`:{if(n.pausedReason){let e=`${i} text-warning`,n;return t[15]===e?n=t[16]:(n=(0,G.jsx)(P,{className:e}),t[15]=e,t[16]=n),n}if(n.ahead>0||n.behind>0){let e=`${i} text-muted-foreground`,n;return t[17]===e?n=t[18]:(n=(0,G.jsx)(M,{className:e}),t[17]=e,t[18]=n),n}let e=`${i} text-muted-foreground`,r;return t[19]===e?r=t[20]:(r=(0,G.jsx)(H,{className:e}),t[19]=e,t[20]=r),r}default:{let e=`${i} text-muted-foreground`,n;return t[21]===e?n=t[22]:(n=(0,G.jsx)(H,{className:e}),t[21]=e,t[22]=n),n}}}function pt(e){switch(dt(e)){case`idle`:return!Q(e)&&e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function mt(e){let t=Q(e),n=dt(e);switch(n){case`dormant`:return y._({id:`RmBY0A`});case`idle`:return t?y._({id:`j5CWO4`}):y._({id:`N2FcBE`});case`fetching`:return t?y._({id:`7IsvrP`}):y._({id:`Wgmlsw`});case`pulling`:return t?y._({id:`JL3si7`}):y._({id:`4uNLmk`});case`pushing`:return y._({id:`iycx_A`});case`conflict`:return y._({id:`IInnZo`});case`offline`:return y._({id:`6Aih4U`});case`auth-error`:return y._({id:`mHVPm5`});case`disabled`:return e.pausedReason?y._({id:`U6wmNc`}):y._({id:`BWTzAb`});default:return n}}var ht=[`git-index-locked`],gt={"git-index-locked":{id:`sOcMdy`},"git-operation-in-progress":{id:`mJTr6D`},"external-changes-pending":{id:`W9_Bub`},"dirty-tree":{id:`a5Gha5`},"non-content-merge-failure":{id:`sIxSSP`},"detached-head":{id:`uQNW00`},"diverged-local-commits":{id:`LQsCPn`},"auth-error":{id:`mHVPm5`},"protected-branch":{id:`8fc_3j`},"no-push-permission":{id:`EiVgl5`},"no-commits-yet":{id:`-ZVU5v`},"unsafe-incoming-symlinks":{id:`8qsUJv`}};function _t(e){return Object.hasOwn(gt,e)}function vt(e,t){return _t(t)?e(gt[t]):t}function yt(e){return ht.includes(e)}function bt(e){throw Error(`Unhandled node-rendered paused reason: ${String(e)}`)}function xt(e){let t=(0,U.c)(3),{reason:n}=e;switch(n){case`git-index-locked`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(r,{id:`Qca--K`,components:{0:(0,G.jsx)(`span`,{dir:`ltr`,className:`font-mono`})}}),t[0]=e):e=t[0],e}default:{let e;return t[1]===n?e=t[2]:(e=bt(n),t[1]=n,t[2]=e),e}}}function St(e){let t=(0,U.c)(4),{paths:n}=e;if(n===void 0||n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Ct),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,G.jsx)(`ul`,{className:`flex max-h-28 flex-col gap-1 overflow-y-auto overscroll-contain`,"data-testid":`sync-refused-symlinks`,children:r}),t[2]=r,t[3]=i),i}function Ct(e){return(0,G.jsx)(`li`,{title:e,dir:`ltr`,className:`min-w-0 truncate font-mono text-2xs text-foreground`,children:e},e)}function wt(e){let t=(0,U.c)(7),{reason:n}=e,{_:r}=i();if(yt(n)){let e;return t[0]===n?e=t[1]:(e=(0,G.jsx)(xt,{reason:n}),t[0]=n,t[1]=e),e}let a;t[2]!==r||t[3]!==n?(a=vt(r,n),t[2]=r,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,G.jsx)(G.Fragment,{children:a}),t[5]=a,t[6]=o),o}function Tt(e,t){let n=[];switch(e){case`not-authenticated`:n.push(y._({id:`ycIX5i`}));break;case`no-collaborator`:n.push(y._({id:`EiVgl5`}));break;case`private-no-access`:n.push(y._({id:`07gHun`}));break;case`repo-not-found`:n.push(y._({id:`uksqrP`}));break;default:n.push(y._({id:`EiVgl5`}))}return n.push(...Et(t)),n}function Et(e){let t=[];if(e?.resolvedLogin){let n=e.resolvedLogin;t.push(y._({id:`ZKVuLY`,values:{login:n}}))}return e?.declaredLogin&&t.push(Dt(e.declaredLogin,e.declaredSource)),t}function Dt(e,t){switch(t){case`remote-url`:return y._({id:`CMd-g-`,values:{declaredLogin:e}});case`credential-config`:return y._({id:`akOe4q`,values:{declaredLogin:e}});default:return y._({id:`GBEqoP`,values:{declaredLogin:e}})}}function Ot(e){return e.pushErrorCode===`auth-not-found-as-identity`||e.pullErrorCode===`auth-not-found-as-identity`}function kt(e){return e?.pausedReason===`auth-error`&&Ot(e)}function At(e){return e?.checkStatus===`denied`&&e.deniedReason===`not-authenticated`}function jt(e){return typeof e?.webUrl==`string`}function Mt(e){return e!=null&&!jt(e)}function Nt(e){return e?.transport===void 0||e.transport===`https`}function Pt(e,t){switch(e){case`auth-401`:return t?y._({id:`-Qw-1t`}):y._({id:`LVWA9A`});case`auth-scope-mismatch`:return t?y._({id:`Zue_jx`}):y._({id:`yLyiQV`});case`auth-no-credential`:return t?y._({id:`uCaIdy`}):y._({id:`xJ7qrb`});default:return null}}function Ft(e,t){let n=Pt(e,t);if(n!==null)return n;switch(e){case`auth-403`:return y._({id:`EiVgl5`});case`semantic-protected-branch`:return y._({id:`T0OVm7`});case`auth-not-found-as-identity`:return y._({id:`jRsjlF`});default:return y._({id:`1AumWo`})}}function It(e,t){let n=Pt(e,t);if(n!==null)return n;switch(e){case`auth-403`:return y._({id:`RgbKEe`});case`auth-not-found-as-identity`:return y._({id:`jRsjlF`});default:return y._({id:`jZ_E5M`})}}function Lt(e,t){let n=Pt(e,t);if(n!==null)return n;switch(e){case`auth-403`:return y._({id:`RgbKEe`});case`semantic-protected-branch`:return y._({id:`T0OVm7`});case`auth-not-found-as-identity`:return y._({id:`jRsjlF`});default:return y._({id:`cUk6TF`})}}function Rt(e){let t=jt(e.remote),n=e.pushErrorCode!=null||e.pushError!=null,r=e.pullErrorCode!=null||e.pullError!=null;if(n&&r&&(e.pushErrorCode==null?e.pullErrorCode==null&&e.pushError===e.pullError:e.pushErrorCode===e.pullErrorCode))return[{key:`sync`,direction:null,message:e.pushErrorCode==null?e.pushError:Lt(e.pushErrorCode,t)}];let i=n&&r,a=[];return n&&a.push({key:`push`,direction:i?`push`:null,message:e.pushErrorCode?Ft(e.pushErrorCode,t):e.pushError}),r&&a.push({key:`pull`,direction:i?`pull`:null,message:e.pullErrorCode?It(e.pullErrorCode,t):e.pullError}),a}function zt(e){return e?.checkStatus===`unknown`&&e.unknownError===`token-invalid`}function Bt(e){return dt(e)===`auth-error`&&Ot(e)?y._({id:`EkEFE3`}):mt(e)}function Vt(e){let t=Q(e),n=dt(e);if(n===`conflict`&&e.conflictCount>0){let{conflictCount:t}=e;return y._({id:`cUK8lW`,values:{conflictCount:t}})}if(n===`idle`){let{ahead:n,behind:r}=e;return t?r>0?y._({id:`9o1bIV`,values:{behind:r}}):y._({id:`j5CWO4`}):n>0&&r>0?y._({id:`5F5HYj`,values:{ahead:n,behind:r}}):n>0?y._({id:`PdA9NZ`,values:{ahead:n}}):r>0?y._({id:`9o1bIV`,values:{behind:r}}):y._({id:`N2FcBE`})}return Bt(e)}function Ht(e){let t=(0,U.c)(3),{children:n,id:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,G.jsx)(`span`,{id:r,className:`font-mono uppercase tracking-wide text-2xs text-muted-foreground`,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Ut(e){switch(e){case`M`:return y._({id:`tgWuMB`});case`A`:return y._({id:`hp8OtS`});case`D`:return y._({id:`vGjmyl`});case`R`:return y._({id:`QeREu8`});case`C`:return y._({id:`6V3Ea3`});case`U`:return y._({id:`cyoNqf`});case`T`:return y._({id:`zWZBPx`});case`?`:return y._({id:`C2abof`});case`!`:return y._({id:`xDKOFk`});default:return y._({id:`cNsIJf`})}}function Wt(e){switch(e){case`D`:return`destructive`;case`U`:return`warning`;default:return`gray`}}function Gt(e){let t=(0,U.c)(25),{entry:n,dimmed:r,label:i}=e,a;t[0]===n.code?a=t[1]:(a=Ut(n.code),t[0]=n.code,t[1]=a);let l=a,u=n.open,d=`truncate text-start font-mono text-2xs ${r?`text-muted-foreground/60`:`text-foreground`}`,f;t[2]===n.code?f=t[3]:(f=Wt(n.code),t[2]=n.code,t[3]=f);let p;t[4]===n.code?p=t[5]:(p=(0,G.jsx)(`span`,{"aria-hidden":!0,children:n.code}),t[4]=n.code,t[5]=p);let m;t[6]===l?m=t[7]:(m=(0,G.jsx)(`span`,{className:`sr-only`,children:l}),t[6]=l,t[7]=m);let h;t[8]!==f||t[9]!==p||t[10]!==m?(h=(0,G.jsx)(o,{asChild:!0,children:(0,G.jsxs)(F,{variant:f,className:`size-4 shrink-0 justify-center p-0 text-2xs leading-none`,children:[p,m]})}),t[8]=f,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===l?g=t[13]:(g=(0,G.jsx)(s,{children:l}),t[12]=l,t[13]=g);let v;t[14]!==h||t[15]!==g?(v=(0,G.jsxs)(c,{children:[h,g]}),t[14]=h,t[15]=g,t[16]=v):v=t[16];let y;t[17]!==n.path||t[18]!==i||t[19]!==u||t[20]!==d?(y=u?(0,G.jsxs)(c,{children:[(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(pe,{asChild:!0,children:(0,G.jsx)(_,{variant:`link-muted`,size:`xs`,className:`h-auto min-h-6 min-w-0 shrink justify-start overflow-hidden p-0 font-normal`,"aria-label":n.path,onClick:()=>at(ot(u)),"data-testid":`worktree-row-open`,children:(0,G.jsx)(`span`,{dir:`auto`,className:`min-w-0 ${d}`,children:i})})})}),(0,G.jsx)(s,{dir:`auto`,className:`font-mono text-2xs`,children:n.path})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(c,{children:[(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(`span`,{dir:`auto`,tabIndex:0,className:`min-w-0 rounded-xs focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 ${d}`,children:i})}),(0,G.jsx)(s,{dir:`auto`,className:`font-mono text-2xs`,children:n.path})]}),i!==n.path&&(0,G.jsx)(`span`,{className:`sr-only`,children:n.path})]}),t[17]=n.path,t[18]=i,t[19]=u,t[20]=d,t[21]=y):y=t[21];let b;return t[22]!==v||t[23]!==y?(b=(0,G.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[v,y]}),t[22]=v,t[23]=y,t[24]=b):b=t[24],b}function Kt(e){let t=(0,U.c)(15),{rows:n,dimmed:i}=e,[a,o]=(0,W.useState)(!1),s=n.length>6,c;t[0]!==n||t[1]!==a?(c=a?n:n.slice(0,6),t[0]=n,t[1]=a,t[2]=c):c=t[2];let l=c,u=n.length-6,d;if(t[3]!==i||t[4]!==l){let e;t[6]===i?e=t[7]:(e=e=>{let{entry:t,label:n}=e;return(0,G.jsx)(Gt,{entry:t,dimmed:i,label:n},`${t.code}:${t.path}`)},t[6]=i,t[7]=e),d=l.map(e),t[3]=i,t[4]=l,t[5]=d}else d=t[5];let f;t[8]!==s||t[9]!==u||t[10]!==a?(f=s&&(0,G.jsx)(`li`,{children:(0,G.jsx)(_,{variant:`link-muted`,size:`xs`,"aria-expanded":a,className:`h-auto min-h-6 justify-start p-0 text-2xs font-normal`,onClick:()=>o(qt),"data-testid":`worktree-rows-show-all`,children:a?(0,G.jsx)(r,{id:`H86f9p`}):(0,G.jsx)(r,{id:`B6Lac2`,values:{overflowCount:u}})})}),t[8]=s,t[9]=u,t[10]=a,t[11]=f):f=t[11];let p;return t[12]!==d||t[13]!==f?(p=(0,G.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14],p}function qt(e){return!e}function Jt(e){let t=(0,U.c)(25),{group:n,prefix:i,dimmed:a}=e,f=n.rows.length,[p,m]=(0,W.useState)(!1),h=i===``?n.dir:`${i}/${n.dir}`,g=`size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none ${p?`rotate-90`:``}`,v;t[0]===g?v=t[1]:(v=(0,G.jsx)(O,{className:g,"aria-hidden":!0}),t[0]=g,t[1]=v);let y;t[2]===n.dir?y=t[3]:(y=(0,G.jsx)(`span`,{dir:`auto`,className:`min-w-0 truncate text-start font-mono text-2xs text-muted-foreground`,children:n.dir}),t[2]=n.dir,t[3]=y);let b;t[4]===f?b=t[5]:(b=(0,G.jsx)(`span`,{"aria-hidden":!0,className:`ms-auto shrink-0 ps-1 text-2xs text-muted-foreground tabular-nums`,children:f}),t[4]=f,t[5]=b);let x;t[6]===f?x=t[7]:(x=(0,G.jsx)(`span`,{className:`sr-only`,children:(0,G.jsx)(r,{id:`u3BOHd`,values:{fileCount:f}})}),t[6]=f,t[7]=x);let S;t[8]!==v||t[9]!==y||t[10]!==b||t[11]!==x?(S=(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(u,{asChild:!0,children:(0,G.jsxs)(_,{variant:`ghost`,size:`xs`,className:`h-auto min-h-6 w-full justify-start gap-1 px-0 font-normal`,children:[v,y,b,x]})})}),t[8]=v,t[9]=y,t[10]=b,t[11]=x,t[12]=S):S=t[12];let C;t[13]===h?C=t[14]:(C=(0,G.jsx)(s,{dir:`auto`,className:`font-mono text-2xs`,children:h}),t[13]=h,t[14]=C);let w;t[15]!==S||t[16]!==C?(w=(0,G.jsxs)(c,{children:[S,C]}),t[15]=S,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==a||t[19]!==n.rows?(T=(0,G.jsx)(l,{className:`ps-4`,children:(0,G.jsx)(Kt,{rows:n.rows,dimmed:a})}),t[18]=a,t[19]=n.rows,t[20]=T):T=t[20];let E;return t[21]!==p||t[22]!==w||t[23]!==T?(E=(0,G.jsxs)(d,{open:p,onOpenChange:m,className:`flex flex-col gap-1`,children:[w,T]}),t[21]=p,t[22]=w,t[23]=T,t[24]=E):E=t[24],E}function Yt(e){let t=(0,U.c)(39),{title:n,note:i,entries:a,dimmed:o}=e,s=o===void 0?!1:o;if(a.length===0)return null;let c=a.length,f,p,m,h,g,v,y,b,x;if(t[0]!==s||t[1]!==a||t[2]!==c||t[3]!==i||t[4]!==n){let{prefix:e,groups:o,loose:S}=rt(a);m=S,p=d,b=`flex flex-col gap-1`;let C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,G.jsx)(O,{className:`size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-90`,"aria-hidden":!0}),t[14]=C):C=t[14];let w;t[15]===n?w=t[16]:(w=(0,G.jsx)(`span`,{className:`text-2xs font-medium text-muted-foreground`,children:n}),t[15]=n,t[16]=w);let T;t[17]===c?T=t[18]:(T=(0,G.jsx)(`span`,{className:`ms-auto shrink-0 ps-1 text-2xs text-muted-foreground tabular-nums`,children:(0,G.jsx)(r,{id:`u3BOHd`,values:{fileCount:c}})}),t[17]=c,t[18]=T),t[19]!==w||t[20]!==T?(x=(0,G.jsx)(u,{asChild:!0,children:(0,G.jsxs)(_,{variant:`ghost`,size:`xs`,className:`group h-auto min-h-6 w-full justify-start gap-1 px-0 font-normal data-[state=open]:bg-transparent`,children:[C,w,T]})}),t[19]=w,t[20]=T,t[21]=x):x=t[21],f=l,h=`flex flex-col gap-1 ps-3`,t[22]===i?g=t[23]:(g=i&&(0,G.jsx)(`span`,{className:`text-2xs text-muted-foreground/80`,children:i}),t[22]=i,t[23]=g),v=e!==``&&(0,G.jsxs)(`span`,{dir:`auto`,className:`break-all font-mono text-2xs text-muted-foreground`,children:[e,`/`]}),y=o.map(t=>(0,G.jsx)(Jt,{group:t,prefix:e,dimmed:s},e===``?t.dir:`${e}/${t.dir}`)),t[0]=s,t[1]=a,t[2]=c,t[3]=i,t[4]=n,t[5]=f,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=v,t[11]=y,t[12]=b,t[13]=x}else f=t[5],p=t[6],m=t[7],h=t[8],g=t[9],v=t[10],y=t[11],b=t[12],x=t[13];let S;t[24]!==s||t[25]!==m?(S=m.length>0&&(0,G.jsx)(Kt,{rows:m,dimmed:s}),t[24]=s,t[25]=m,t[26]=S):S=t[26];let C;t[27]!==f||t[28]!==h||t[29]!==g||t[30]!==v||t[31]!==y||t[32]!==S?(C=(0,G.jsxs)(f,{className:h,children:[g,v,y,S]}),t[27]=f,t[28]=h,t[29]=g,t[30]=v,t[31]=y,t[32]=S,t[33]=C):C=t[33];let w;return t[34]!==p||t[35]!==b||t[36]!==x||t[37]!==C?(w=(0,G.jsxs)(p,{className:b,children:[x,C]}),t[34]=p,t[35]=b,t[36]=x,t[37]=C,t[38]=w):w=t[38],w}function Xt(e){let t=(0,U.c)(9),{direction:n,count:r}=e,{_:a}=i();if(r<=0)return null;let o;t[0]===n?o=t[1]:(o=n===`behind`?(0,G.jsx)(E,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}):(0,G.jsx)(D,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]!==a||t[3]!==r||t[4]!==n?(s=a(n===`behind`?{id:`sKHiNR`,values:{count:r}}:{id:`9ZxzfT`,values:{count:r}}),t[2]=a,t[3]=r,t[4]=n,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,G.jsxs)(`span`,{className:`flex flex-1 items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs text-foreground`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Zt(e){let t=new Set,n=[],r=[];for(let i of[...e.staged,...e.notStaged,...e.untracked])t.has(i.path)||(t.add(i.path),(i.syncScoped?n:r).push(i));return{willPush:n,wontPush:r}}function Qt(e){let t=(0,U.c)(6),{lastReadAt:n}=e,{_:a}=i(),o=ct(),s;t[0]!==a||t[1]!==n||t[2]!==o?(s=X(a,n,o),t[0]=a,t[1]=n,t[2]=o,t[3]=s):s=t[3];let c=s,l;return t[4]===c?l=t[5]:(l=(0,G.jsx)(`p`,{className:`text-2xs text-muted-foreground`,"data-testid":`worktree-stale`,children:(0,G.jsx)(r,{id:`e-pP6g`,values:{staleRelative:c}})}),t[4]=c,t[5]=l),l}function $t(e){let t=(0,U.c)(36),{status:n,worktree:a,loading:o,unreadable:s,stale:c,lastReadAt:l}=e,u;t[0]===a?u=t[1]:(u=a?Zt(a):{willPush:[],wontPush:[]},t[0]=a,t[1]=u);let{willPush:d,wontPush:f}=u,p;t[2]===a?.incoming?p=t[3]:(p=a?.incoming??[],t[2]=a?.incoming,t[3]=p);let m=p,{_:h}=i(),g=c&&!s&&a!==null&&l!==null,_=a!==null&&d.length===0&&f.length===0&&m.length===0,v;t[4]!==h||t[5]!==g||t[6]!==s?(v=s?h({id:`L9ox9k`}):g?h({id:`_LK4d6`}):``,t[4]=h,t[5]=g,t[6]=s,t[7]=v):v=t[7];let y=v,b;t[8]===y?b=t[9]:(b=(0,G.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,"data-testid":`worktree-announcer`,children:y}),t[8]=y,t[9]=b);let x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,G.jsx)(Ht,{id:`worktree-status-label`,children:(0,G.jsx)(r,{id:`uAQUqI`})}),t[10]=x):x=t[10];let S;t[11]!==s||t[12]!==a?(S=!s&&a&&(a.branch||a.detached)&&(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono text-2xs text-muted-foreground`,"data-testid":`worktree-branch`,children:a.detached?(0,G.jsx)(r,{id:`OBdkpo`}):a.upstream?`${a.branch} → ${a.upstream}`:a.branch}),t[11]=s,t[12]=a,t[13]=S):S=t[13];let C;t[14]===S?C=t[15]:(C=(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[x,S]}),t[14]=S,t[15]=C);let w;t[16]!==n.ahead||t[17]!==n.behind?(w=(n.behind>0||n.ahead>0)&&(0,G.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[(0,G.jsx)(Xt,{direction:`behind`,count:n.behind}),(0,G.jsx)(Xt,{direction:`ahead`,count:n.ahead})]}),t[16]=n.ahead,t[17]=n.behind,t[18]=w):w=t[18];let T;t[19]!==_||t[20]!==m||t[21]!==o||t[22]!==s||t[23]!==d||t[24]!==f||t[25]!==a?(T=s?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`worktree-unreadable`,children:(0,G.jsx)(r,{id:`L9ox9k`})}):o?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`eolhcI`})}):_?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`WfcERq`})}):a&&(0,G.jsxs)(`section`,{className:`flex max-h-56 flex-col gap-2.5 overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,tabIndex:0,"aria-labelledby":`worktree-status-label`,"data-testid":`worktree-listing`,children:[(0,G.jsx)(Yt,{title:(0,G.jsx)(r,{id:`NcwbBM`}),entries:m}),(0,G.jsx)(Yt,{title:(0,G.jsx)(r,{id:`JOhCT9`}),entries:d}),(0,G.jsx)(Yt,{title:(0,G.jsx)(r,{id:`vsFXfP`}),note:(0,G.jsx)(r,{id:`PxZCNM`}),entries:f,dimmed:!0}),a.truncated&&(0,G.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`KvwJv8`})})]}),t[19]=_,t[20]=m,t[21]=o,t[22]=s,t[23]=d,t[24]=f,t[25]=a,t[26]=T):T=t[26];let E;t[27]!==l||t[28]!==g?(E=g&&l!==null&&(0,G.jsx)(Qt,{lastReadAt:l}),t[27]=l,t[28]=g,t[29]=E):E=t[29];let D;return t[30]!==E||t[31]!==b||t[32]!==C||t[33]!==w||t[34]!==T?(D=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5 border-t pt-3`,children:[b,C,w,T,E]}),t[30]=E,t[31]=b,t[32]=C,t[33]=w,t[34]=T,t[35]=D):D=t[35],D}function en(e){let t=(0,U.c)(19),{pulledAt:n,pushedAt:r,combinedAt:a}=e,{_:o}=i(),s,c,l;if(t[0]!==o||t[1]!==a||t[2]!==n||t[3]!==r){s=n===null?null:Z(o,n),c=r===null?null:Z(o,r);let e=a===null?null:Z(o,a);l=s!==null&&c!==null?o({id:`1TA-aJ`,values:{pulled:s,pushed:c}}):s===null?c===null?e===null?null:o({id:`irnKr_`,values:{updatedRelative:e}}):o({id:`lPkjpD`,values:{pushed:c}}):o({id:`xW5AUw`,values:{pulled:s}}),t[0]=o,t[1]=a,t[2]=n,t[3]=r,t[4]=s,t[5]=c,t[6]=l}else s=t[4],c=t[5],l=t[6];let u=l,d=s!==null||c!==null;if(u===null){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(`span`,{}),t[7]=e):e=t[7],e}let f;t[8]!==u||t[9]!==d?(f=d&&(0,G.jsx)(`span`,{className:`sr-only`,"data-testid":`sync-popover-last-sync-label`,children:u}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==u||t[12]!==s||t[13]!==c||t[14]!==d?(p=d?(0,G.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex items-center gap-1`,children:[s!==null&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,G.jsx)(E,{className:`size-3`}),s]}),s!==null&&c!==null&&(0,G.jsx)(`span`,{children:`·`}),c!==null&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,G.jsx)(D,{className:`size-3`}),c]})]}):(0,G.jsx)(`span`,{"aria-hidden":`true`,children:u}),t[11]=u,t[12]=s,t[13]=c,t[14]=d,t[15]=p):p=t[15];let m;return t[16]!==f||t[17]!==p?(m=(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-last-sync`,children:[f,p]}),t[16]=f,t[17]=p,t[18]=m):m=t[18],m}function tn(){let e=(0,U.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(pe,{asChild:!0,children:(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:nn,"data-testid":`sync-popover-add-host-token`,children:(0,G.jsx)(r,{id:`zXZJoN`})})}),e[0]=t):t=e[0],t}function nn(){return ce()}function rn(e){let t=(0,U.c)(154),{status:n,onSignIn:a,onSetIdentity:o}=e,{_:s}=i(),{conflictCount:c}=n,{projectLocalConfig:l,projectLocalSynced:u}=w(),d=l?.autoSync,v;t[0]===n?v=t[1]:(v=Ke(n),t[0]=n,t[1]=v);let{mode:y,confirmOpen:b,setConfirmOpen:x,pendingMode:C,strandedCommitCount:T,onModeSelect:O,onConfirm:k}=Pe(d,v,n.ahead),{status:A,loading:N,unreadable:P,stale:F,lastReadAt:I}=Ue(!0),ne=y===`follow`,re;t[2]===n?re=t[3]:(re=dt(n),t[2]=n,t[3]=re);let L=re,ie;t[4]===n?ie=t[5]:(ie=Ot(n),t[4]=n,t[5]=ie);let ae=ie,oe=n.lastPullOkUtc??null,se=n.lastPushOkUtc??null,ce=n.lastRunUtc??n.lastSyncUtc??null,R=n.pushPermission?.checkStatus===`denied`&&n.pushPermission.deniedReason!==`not-authenticated`&&!ae,le;t[6]===n.remote?le=t[7]:(le=jt(n.remote),t[6]=n.remote,t[7]=le);let ue=le,fe=!R,z=L===`fetching`||L===`pulling`||L===`pushing`,[me,ge]=(0,W.useState)(null),_e,B;t[8]===z?(_e=t[9],B=t[10]):(_e=()=>{z||ge(null)},B=[z],t[8]=z,t[9]=_e,t[10]=B),(0,W.useEffect)(_e,B);let ve;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>{ge(t=>t===e?null:t)},t[11]=ve):ve=t[11];let ye=ve,V=z?me??(L===`pushing`?`push`:`pull`):null,be;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(be=e=>{ge(e),it(e,()=>ye(e))},t[12]=be):be=t[12];let xe=be,Se=L===`dormant`||L===`auth-error`||n.state===`conflict`,H=Se||n.conflictCount>0,Ce;t[13]===n.blockingPaths?Ce=t[14]:(Ce=n.blockingPaths??[],t[13]=n.blockingPaths,t[14]=Ce);let we=Ce,{conflicts:Te}=he(),De;t[15]===Te?De=t[16]:(De=Te.find(ln)?.docName??null,t[15]=Te,t[16]=De);let Oe=De,ke;t[17]===n?ke=t[18]:(ke=(0,G.jsx)(ft,{status:n}),t[17]=n,t[18]=ke);let Ae;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,G.jsx)(`span`,{className:`text-1sm font-medium`,children:(0,G.jsx)(r,{id:`yZepkk`})}),t[19]=Ae):Ae=t[19];let je;t[20]===ke?je=t[21]:(je=(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[ke,Ae]}),t[20]=ke,t[21]=je);let Me;t[22]!==s||t[23]!==n.remote?(Me=n.remote&&(n.remote.webUrl?(0,G.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-0.5 text-xs text-foreground hover:text-primary hover:underline`,"aria-label":s({id:`1nke1r`,values:{0:n.remote.label}}),children:[(0,G.jsx)(`span`,{className:`truncate`,children:n.remote.label}),(0,G.jsx)(ee,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,G.jsx)(`span`,{className:`min-w-0 truncate text-xs text-foreground`,children:n.remote.label})),t[22]=s,t[23]=n.remote,t[24]=Me):Me=t[24];let Ne;t[25]!==je||t[26]!==Me?(Ne=(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[je,Me]}),t[25]=je,t[26]=Me,t[27]=Ne):Ne=t[27];let Fe=C??`full`,Ie;t[28]!==b||t[29]!==k||t[30]!==x||t[31]!==T||t[32]!==Fe?(Ie=(0,G.jsx)(Ye,{open:b,onOpenChange:x,onConfirm:k,variant:Fe,strandedCommitCount:T}),t[28]=b,t[29]=k,t[30]=x,t[31]=T,t[32]=Fe,t[33]=Ie):Ie=t[33];let Le;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,G.jsx)(Ht,{children:(0,G.jsx)(r,{id:`CnOGgs`})}),t[34]=Le):Le=t[34];let Re;t[35]===O?Re=t[36]:(Re=e=>{S(e)&&O(e)},t[35]=O,t[36]=Re);let ze=!u,Be;t[37]===s?Be=t[38]:(Be=s({id:`CnOGgs`}),t[37]=s,t[38]=Be);let Ve;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,G.jsx)(h,{}),t[39]=Ve):Ve=t[39];let He;t[40]===Be?He=t[41]:(He=(0,G.jsx)(m,{size:`sm`,className:`w-full text-xs`,"aria-label":Be,"data-testid":`sync-mode-select`,children:Ve}),t[40]=Be,t[41]=He);let We;t[42]===s?We=t[43]:(We=s({id:`BWTzAb`}),t[42]=s,t[43]=We);let Ge;t[44]===We?Ge=t[45]:(Ge=(0,G.jsx)(f,{value:`off`,className:`text-xs`,children:We}),t[44]=We,t[45]=Ge);let K;t[46]===s?K=t[47]:(K=s({id:`tlGXxX`}),t[46]=s,t[47]=K);let q;t[48]===K?q=t[49]:(q=(0,G.jsx)(f,{value:`follow`,className:`text-xs`,children:K}),t[48]=K,t[49]=q);let qe;t[50]===s?qe=t[51]:(qe=s({id:`IXiG0B`}),t[50]=s,t[51]=qe);let Je;t[52]!==R||t[53]!==qe?(Je=(0,G.jsx)(f,{value:`full`,className:`text-xs`,disabled:R,children:qe}),t[52]=R,t[53]=qe,t[54]=Je):Je=t[54];let Xe;t[55]!==Ge||t[56]!==q||t[57]!==Je?(Xe=(0,G.jsxs)(p,{children:[Ge,q,Je]}),t[55]=Ge,t[56]=q,t[57]=Je,t[58]=Xe):Xe=t[58];let Ze;t[59]!==y||t[60]!==Re||t[61]!==ze||t[62]!==He||t[63]!==Xe?(Ze=(0,G.jsxs)(g,{value:y,onValueChange:Re,disabled:ze,children:[He,Xe]}),t[59]=y,t[60]=Re,t[61]=ze,t[62]=He,t[63]=Xe,t[64]=Ze):Ze=t[64];let $e;t[65]===y?$e=t[66]:($e=(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-mode-line`,children:y===`off`?(0,G.jsx)(r,{id:`qD3krc`}):y===`follow`?(0,G.jsx)(r,{id:`PGRnbw`}):(0,G.jsx)(r,{id:`zBiFZh`})}),t[65]=y,t[66]=$e);let et;t[67]!==Ze||t[68]!==$e?(et=(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[Le,Ze,$e]}),t[67]=Ze,t[68]=$e,t[69]=et):et=t[69];let J;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,G.jsx)(Ht,{children:(0,G.jsx)(r,{id:`BWTzAb`})}),t[70]=J):J=t[70];let tt=z||Se,nt;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(nt=()=>xe(`pull`),t[71]=nt):nt=t[71];let Y;t[72]===V?Y=t[73]:(Y=V===`pull`?(0,G.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}):(0,G.jsx)(E,{"data-icon":`inline-start`}),t[72]=V,t[73]=Y);let rt;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,G.jsx)(r,{id:`e4GHWP`}),t[74]=rt):rt=t[74];let ot;t[75]!==tt||t[76]!==Y?(ot=(0,G.jsxs)(_,{variant:`outline`,size:`xs`,className:`flex-1`,disabled:tt,onClick:nt,"data-testid":`sync-popover-pull`,children:[Y,rt]}),t[75]=tt,t[76]=Y,t[77]=ot):ot=t[77];let st;t[78]!==z||t[79]!==fe||t[80]!==H||t[81]!==V?(st=fe&&(0,G.jsxs)(_,{variant:`outline`,size:`xs`,className:`flex-1`,disabled:z||H,onClick:()=>xe(`push`),"data-testid":`sync-popover-push`,children:[V===`push`?(0,G.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}):(0,G.jsx)(D,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`uO9WLl`})]}),t[78]=z,t[79]=fe,t[80]=H,t[81]=V,t[82]=st):st=t[82];let X;t[83]!==ot||t[84]!==st?(X=(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[ot,st]}),t[83]=ot,t[84]=st,t[85]=X):X=t[85];let Z;t[86]!==z||t[87]!==fe||t[88]!==H||t[89]!==V?(Z=fe&&(0,G.jsxs)(_,{size:`xs`,className:`w-full`,disabled:z||H,onClick:()=>xe(`sync`),"data-testid":`sync-popover-sync`,children:[V===`sync`?(0,G.jsx)(j,{"aria-hidden":`true`,icon:M,"data-icon":`inline-start`}):(0,G.jsx)(M,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`YEzhIr`})]}),t[86]=z,t[87]=fe,t[88]=H,t[89]=V,t[90]=Z):Z=t[90];let ct;t[91]!==X||t[92]!==Z?(ct=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-t pt-3`,children:[J,X,Z]}),t[91]=X,t[92]=Z,t[93]=ct):ct=t[93];let lt;if(t[94]!==s||t[95]!==n){let e;t[97]===s?e=t[98]:(e=e=>(0,G.jsx)(`p`,{className:`text-xs text-destructive`,children:e.direction===`push`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[s({id:`uO9WLl`}),`: `]}),e.message]}):e.direction===`pull`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[s({id:`e4GHWP`}),`: `]}),e.message]}):e.message},e.key),t[97]=s,t[98]=e),lt=Rt(n).map(e),t[94]=s,t[95]=n,t[96]=lt}else lt=t[96];let Q;t[99]===n?Q=t[100]:(Q=kt(n)&&n.pushPermission?.checkStatus===`denied`?Et(n.pushPermission).map(cn):null,t[99]=n,t[100]=Q);let ut;t[101]!==n.pausedReason||t[102]!==n.pushPermission?(ut=n.pausedReason===`no-push-permission`&&n.pushPermission?.checkStatus===`denied`?Et(n.pushPermission).map(sn):null,t[101]=n.pausedReason,t[102]=n.pushPermission,t[103]=ut):ut=t[103];let $;t[104]!==lt||t[105]!==Q||t[106]!==ut?($=(0,G.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex flex-col gap-3.5 empty:sr-only`,"data-testid":`sync-popover-status`,children:[lt,Q,ut]}),t[104]=lt,t[105]=Q,t[106]=ut,t[107]=$):$=t[107];let pt;t[108]!==we||t[109]!==ne||t[110]!==R||t[111]!==a||t[112]!==n?(pt=!ne&&At(n.pushPermission)?(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`ycIX5i`})}),a&&(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,G.jsx)(r,{id:`5lWFkC`})})]}):we.length>0?(0,G.jsx)(Qe,{paths:we}):kt(n)?null:n.pausedReason?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(wt,{reason:n.pausedReason})}),(0,G.jsx)(St,{paths:n.refusedSymlinkPaths})]}):!ne&&R&&n.pushPermission?.checkStatus===`denied`?Tt(n.pushPermission.deniedReason,n.pushPermission).map(on):zt(n.pushPermission)?(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`C_cPoW`})}),a&&(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,G.jsx)(r,{id:`5lWFkC`})})]}):null,t[108]=we,t[109]=ne,t[110]=R,t[111]=a,t[112]=n,t[113]=pt):pt=t[113];let mt;t[114]!==Oe||t[115]!==L?(mt=L===`conflict`&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-warning`,children:(0,G.jsx)(r,{id:`ko386X`})}),Oe!==null&&(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>at(de(Oe)),children:(0,G.jsx)(r,{id:`5k0NLb`})})]}),t[114]=Oe,t[115]=L,t[116]=mt):mt=t[116];let ht;t[117]!==ue||t[118]!==a||t[119]!==L||t[120]!==n?(ht=L===`auth-error`&&!kt(n)&&(ue?a&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-destructive`,children:(0,G.jsx)(r,{id:`Vl1H8I`})}),(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,G.jsx)(r,{id:`5lWFkC`})})]}):Nt(n.remote)?(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-destructive`,"data-testid":`sync-popover-auth-error-unverified`,children:(0,G.jsx)(r,{id:`FioJgb`})}),(0,G.jsx)(tn,{})]}):(0,G.jsx)(`p`,{className:`text-xs text-destructive`,"data-testid":`sync-popover-auth-error-no-token`,children:(0,G.jsx)(r,{id:`w-Wt3H`})})),t[117]=ue,t[118]=a,t[119]=L,t[120]=n,t[121]=ht):ht=t[121];let gt;t[122]===c?gt=t[123]:(gt=c>0&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`B4_ipX`,values:{conflictCount:c}})}),t[122]=c,t[123]=gt);let _t;t[124]!==n||t[125]!==A||t[126]!==I||t[127]!==N||t[128]!==F||t[129]!==P?(_t=(0,G.jsx)($t,{status:n,worktree:A,loading:N,unreadable:P,stale:F,lastReadAt:I}),t[124]=n,t[125]=A,t[126]=I,t[127]=N,t[128]=F,t[129]=P,t[130]=_t):_t=t[130];let vt;t[131]!==ce||t[132]!==oe||t[133]!==se?(vt=(0,G.jsx)(en,{pulledAt:oe,pushedAt:se,combinedAt:ce}),t[131]=ce,t[132]=oe,t[133]=se,t[134]=vt):vt=t[134];let yt;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,G.jsx)(pe,{asChild:!0,children:(0,G.jsxs)(_,{variant:`link`,size:`xs`,className:`h-auto p-0 text-xs text-muted-foreground hover:font-medium hover:text-foreground hover:no-underline`,onClick:an,"data-testid":`sync-popover-settings`,children:[(0,G.jsx)(te,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`VNgKZz`})]})}),t[135]=yt):yt=t[135];let bt;t[136]===vt?bt=t[137]:(bt=(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[vt,yt]}),t[136]=vt,t[137]=bt);let xt;t[138]!==o||t[139]!==n.identityUnresolved?(xt=n.identityUnresolved&&o&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,G.jsx)(Ee,{className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-snug text-muted-foreground`,children:(0,G.jsx)(r,{id:`nrGWJ7`})}),(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:o,children:(0,G.jsx)(r,{id:`keNFEd`})})]})]}),t[138]=o,t[139]=n.identityUnresolved,t[140]=xt):xt=t[140];let Ct;return t[141]!==Ne||t[142]!==Ie||t[143]!==et||t[144]!==ct||t[145]!==$||t[146]!==pt||t[147]!==mt||t[148]!==ht||t[149]!==gt||t[150]!==_t||t[151]!==bt||t[152]!==xt?(Ct=(0,G.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[Ne,Ie,et,ct,$,pt,mt,ht,gt,_t,bt,xt]}),t[141]=Ne,t[142]=Ie,t[143]=et,t[144]=ct,t[145]=$,t[146]=pt,t[147]=mt,t[148]=ht,t[149]=gt,t[150]=_t,t[151]=bt,t[152]=xt,t[153]=Ct):Ct=t[153],Ct}function an(){return R({advanced:!0})}function on(e){return(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function sn(e){return(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function cn(e){return(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function ln(e){return e.docName!==null}function un(e){let t=(0,U.c)(68),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:a,onSetIdentity:l}=n,{_:u}=i(),{status:d,fetchError:f}=ge();if(!d){if(f){let e;t[2]===u?e=t[3]:(e=u({id:`iqIDv4`}),t[2]=u,t[3]=e);let n;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(Se,{className:`size-3.5`}),t[4]=n):n=t[4];let i;t[5]===e?i=t[6]:(i=(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(_,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":e,disabled:!0,children:n})}),t[5]=e,t[6]=i);let a;t[7]===f?a=t[8]:(a=(0,G.jsx)(s,{children:f===`network`?(0,G.jsx)(r,{id:`I5AfhE`}):(0,G.jsx)(r,{id:`uKRYiW`})}),t[7]=f,t[8]=a);let l;return t[9]!==i||t[10]!==a?(l=(0,G.jsxs)(c,{children:[i,a]}),t[9]=i,t[10]=a,t[11]=l):l=t[11],l}return null}if(!d.hasRemote)return null;let p;t[12]===d?p=t[13]:(p=pt(d),t[12]=d,t[13]=p);let m=p,h,g,v,y,b,x,S,C,w,T,E,D;if(t[14]!==u||t[15]!==d){let e=Bt(d);x=!!d.identityUnresolved,b=me,y=c,v=o,D=!0,g=fe,E=!0,h=_,S=`ghost`,C=`icon-sm`,w=`text-muted-foreground relative`,T=u(x?{id:`DFfRbX`,values:{syncStateLabel:e}}:{id:`F4vEsL`,values:{syncStateLabel:e}}),t[14]=u,t[15]=d,t[16]=h,t[17]=g,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D}else h=t[16],g=t[17],v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27];let ee;t[28]===d?ee=t[29]:(ee=(0,G.jsx)(ft,{status:d,size:`size-4`}),t[28]=d,t[29]=ee);let O;t[30]===m?O=t[31]:(O=m&&(0,G.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:m}),t[30]=m,t[31]=O);let k;t[32]!==m||t[33]!==x?(k=!m&&x&&(0,G.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-warning ring-2 ring-background`,"aria-hidden":!0}),t[32]=m,t[33]=x,t[34]=k):k=t[34];let te;t[35]!==h||t[36]!==O||t[37]!==k||t[38]!==S||t[39]!==C||t[40]!==w||t[41]!==T||t[42]!==ee?(te=(0,G.jsxs)(h,{variant:S,size:C,className:w,"aria-label":T,children:[ee,O,k]}),t[35]=h,t[36]=O,t[37]=k,t[38]=S,t[39]=C,t[40]=w,t[41]=T,t[42]=ee,t[43]=te):te=t[43];let A;t[44]!==g||t[45]!==te||t[46]!==E?(A=(0,G.jsx)(g,{asChild:E,children:te}),t[44]=g,t[45]=te,t[46]=E,t[47]=A):A=t[47];let j;t[48]!==v||t[49]!==A||t[50]!==D?(j=(0,G.jsx)(v,{asChild:D,children:A}),t[48]=v,t[49]=A,t[50]=D,t[51]=j):j=t[51];let M;t[52]===d?M=t[53]:(M=Vt(d),t[52]=d,t[53]=M);let N;t[54]===M?N=t[55]:(N=(0,G.jsx)(s,{children:M}),t[54]=M,t[55]=N);let P;t[56]!==y||t[57]!==j||t[58]!==N?(P=(0,G.jsxs)(y,{children:[j,N]}),t[56]=y,t[57]=j,t[58]=N,t[59]=P):P=t[59];let F;t[60]!==l||t[61]!==a||t[62]!==d?(F=(0,G.jsx)(z,{align:`end`,className:`flex max-h-(--radix-popover-content-available-height) w-80 flex-col overflow-y-auto p-3`,children:(0,G.jsx)(rn,{status:d,onSignIn:a,onSetIdentity:l})}),t[60]=l,t[61]=a,t[62]=d,t[63]=F):F=t[63];let I;return t[64]!==b||t[65]!==P||t[66]!==F?(I=(0,G.jsxs)(b,{children:[P,F]}),t[64]=b,t[65]=P,t[66]=F,t[67]=I):I=t[67],I}export{Ae as C,V as D,H as E,De as S,Oe as T,q as _,Et as a,je as b,Ot as c,$ as d,Nt as f,K as g,Ye as h,dt as i,jt as l,zt as m,St as n,Lt as o,At as p,un as r,Mt as s,wt as t,kt as u,Ke as v,Me as w,ke as x,Fe as y};
|
|
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{i as o,n as s,t as c}from"./tooltip-Bz6z4_se.js";import{n as l,r as u,t as d}from"./collapsible-BKbszYZV.js";import{i as f,n as p,o as m,s as h,t as g}from"./select-pACXgFe2.js";import{t as _}from"./button-DzgjsZzC.js";import{n as v}from"./dist-BGzUo_18.js";import{t as y}from"./dist-C_FzPxEX2.js";import{n as b}from"./config-errors-DDAH9fqy.js";import{v as x}from"./documents-events-ddyuXdQl.js";import{f as S,h as C}from"./share-D-LUU2aX-B7Yg0G_m.js";import{i as w}from"./use-apply-config-theme-CYFG76sS.js";import{t as T}from"./createLucideIcon-DdBzwsHe.js";import{n as E,t as D}from"./arrow-up-BGHhPj4y.js";import{t as ee}from"./arrow-up-right-nJaICi16.js";import{t as O}from"./chevron-right-Bofu4lib.js";import{n as k,t as te}from"./settings-2-DoBlNQMk.js";import{t as A}from"./git-merge-VDBzSZBV.js";import{t as j}from"./spinner-Bx8xD6f8.js";import{t as M}from"./refresh-cw-CC7UZEnZ.js";import{t as N}from"./terminal-Cpb4l1oH.js";import{t as P}from"./triangle-alert-BXrUEeRU.js";import{t as F}from"./badge-BIamhtRR.js";import{a as I,c as ne,i as re,n as L,o as ie,r as ae,s as oe,t as se}from"./dialog-BJEjKJjL.js";import{a as ce,u as R}from"./use-settings-route-Bj-m9X61.js";import{c as le,h as ue,l as de}from"./doc-hash-BJkweiX9.js";import{a as fe,i as z,r as pe,t as me}from"./popover-Mb1GgB61.js";import{n as he}from"./use-conflicts-CIjDyM9c.js";import"./config-provider-DY_fun1v.js";import{n as ge}from"./use-git-sync-status-PkMYmN4D.js";import{t as _e}from"./reveal-editor-ChTC5Vss.js";import{n as B,t as ve}from"./DisclosureWarning-CYHeueUe.js";import{t as ye}from"./terminal-command-events-h-p66odT.js";var V=T(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),be=T(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),xe=T(`cloud-alert`,[[`path`,{d:`M12 12v4`,key:`tww15h`}],[`path`,{d:`M12 20h.01`,key:`zekei9`}],[`path`,{d:`M8.128 16.949A7 7 0 1 1 15.71 8h1.79a1 1 0 0 1 0 9h-1.642`,key:`1namsd`}]]),Se=T(`cloud-off`,[[`path`,{d:`M10.94 5.274A7 7 0 0 1 15.71 10h1.79a4.5 4.5 0 0 1 4.222 6.057`,key:`1uxyv8`}],[`path`,{d:`M18.796 18.81A4.5 4.5 0 0 1 17.5 19H9A7 7 0 0 1 5.79 5.78`,key:`99tcn7`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),H=T(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),Ce=T(`git-commit-vertical`,[[`path`,{d:`M12 3v6`,key:`1holv5`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`path`,{d:`M12 15v6`,key:`a9ows0`}]]),we=T(`laptop`,[[`path`,{d:`M18 5a2 2 0 0 1 2 2v8.526a2 2 0 0 0 .212.897l1.068 2.127a1 1 0 0 1-.9 1.45H3.62a1 1 0 0 1-.9-1.45l1.068-2.127A2 2 0 0 0 4 15.526V7a2 2 0 0 1 2-2z`,key:`1pdavp`}],[`path`,{d:`M20.054 15.987H3.946`,key:`14rxg9`}]]),Te=T(`log-in`,[[`path`,{d:`m10 17 5-5-5-5`,key:`1bsop3`}],[`path`,{d:`M15 12H3`,key:`6jk70r`}],[`path`,{d:`M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4`,key:`u53s6r`}]]),Ee=T(`user-cog`,[[`path`,{d:`M10 15H6a4 4 0 0 0-4 4v2`,key:`1nfge6`}],[`path`,{d:`m14.305 16.53.923-.382`,key:`1itpsq`}],[`path`,{d:`m15.228 13.852-.923-.383`,key:`eplpkm`}],[`path`,{d:`m16.852 12.228-.383-.923`,key:`13v3q0`}],[`path`,{d:`m16.852 17.772-.383.924`,key:`1i8mnm`}],[`path`,{d:`m19.148 12.228.383-.923`,key:`1q8j1v`}],[`path`,{d:`m19.53 18.696-.382-.924`,key:`vk1qj3`}],[`path`,{d:`m20.772 13.852.924-.383`,key:`n880s0`}],[`path`,{d:`m20.772 16.148.924.383`,key:`1g6xey`}],[`circle`,{cx:`18`,cy:`15`,r:`3`,key:`gjjjvw`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),U=a(),W=e(n(),1);function De(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=e?`full`:`off`,r=t.patch({autoSync:{mode:n,enabled:e}});return r.ok?{ok:!0}:{ok:!1,error:b(r.error)}},e[0]=t,e[1]=r),r}function Oe(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:{mode:e,enabled:null}});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function ke(){let e=(0,U.c)(2),{projectBinding:t,projectSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:{default:e}});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function Ae(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:e});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function je(e,t){let n=(0,U.c)(12),{_:r}=i(),[a,o]=(0,W.useState)(!1),s;n[0]!==r||n[1]!==e?(s=function(t){if(e===null)return v.info(r({id:`fiMNLl`}),{id:`sync-settings-not-ready`}),!1;let n=e(t);if(!n.ok){console.error(`[sync] toggle failed:`,n.error);let e=n.error;return v.error(r(t?{id:`04RA0-`,values:{detail:e}}:{id:`qjHMHf`,values:{detail:e}})),!1}return!0},n[0]=r,n[1]=e,n[2]=s):s=n[2];let c=s,l;n[3]===c?l=n[4]:(l=function(e){if(e){o(!0);return}c(!1)},n[3]=c,n[4]=l);let u=l,d;n[5]!==c||n[6]!==t?(d=function(){c(!0)&&(o(!1),t?.onEnabled?.())},n[5]=c,n[6]=t,n[7]=d):d=n[7];let f=d,p;return n[8]!==a||n[9]!==f||n[10]!==u?(p={confirmOpen:a,setConfirmOpen:o,onToggleRequest:u,onConfirm:f},n[8]=a,n[9]=f,n[10]=u,n[11]=p):p=n[11],p}function Me(e,t,n){let r=(0,U.c)(22),{_:a}=i(),[o,s]=(0,W.useState)(!1),[c,l]=(0,W.useState)(null),u;r[0]!==a||r[1]!==n||r[2]!==e?(u=function(t){if(e===null)return v.info(a({id:`fiMNLl`}),{id:`sync-settings-not-ready`}),!1;let r=e(t);if(!r.ok){console.error(`[sync] mode change failed:`,r.error);let e=r.error;return v.error(a({id:`nOEDQs`,values:{detail:e}})),!1}return n?.onApplied?.(t),!0},r[0]=a,r[1]=n,r[2]=e,r[3]=u):u=r[3];let d=u,f;r[4]!==d||r[5]!==t?(f=function(e){if(e!==t){if(e===`off`){d(`off`);return}l(e),s(!0)}},r[4]=d,r[5]=t,r[6]=f):f=r[6];let p=f,m;r[7]===d?m=r[8]:(m=function(){return d(`off`)},r[7]=d,r[8]=m);let h=m,g;r[9]!==d||r[10]!==t?(g=function(){return d(t)},r[9]=d,r[10]=t,r[11]=g):g=r[11];let _=g,y;r[12]!==d||r[13]!==c?(y=function(){c!==null&&d(c)&&s(!1)},r[12]=d,r[13]=c,r[14]=y):y=r[14];let b=y,x;return r[15]!==o||r[16]!==b||r[17]!==_||r[18]!==p||r[19]!==h||r[20]!==c?(x={confirmOpen:o,setConfirmOpen:s,pendingMode:c,onModeSelect:p,onTurnOff:h,onKeepCurrent:_,onConfirm:b},r[15]=o,r[16]=b,r[17]=_,r[18]=p,r[19]=h,r[20]=c,r[21]=x):x=r[21],x}function Ne(){let e=(0,U.c)(2),{projectLocalBinding:t,projectLocalSynced:n}=w();if(t===null||!n)return null;let r;return e[0]===t?r=e[1]:(r=e=>{let n=t.patch({autoSync:e});return n.ok?{ok:!0}:{ok:!1,error:b(n.error)}},e[0]=t,e[1]=r),r}function Pe(e,t,n){let r=(0,U.c)(19),{_:a}=i(),o=Ne(),[s,c]=(0,W.useState)(!1),[l,u]=(0,W.useState)(null),d;r[0]!==e||r[1]!==t?(d=C(e)??t,r[0]=e,r[1]=t,r[2]=d):d=r[2];let f=d,p;r[3]!==a||r[4]!==o?(p=function(e){if(o===null)return v.info(a({id:`fiMNLl`}),{id:`sync-settings-not-ready`}),!1;let t=o(e);if(!t.ok){console.error(`[sync] badge control failed:`,t.error);let e=t.error;return v.error(a({id:`ZVOhXM`,values:{detail:e}})),!1}return!0},r[3]=a,r[4]=o,r[5]=p):p=r[5];let m=p,h;r[6]!==m||r[7]!==f?(h=function(e){if(e!==f){if(e===`off`){m({mode:`off`,enabled:null,resumeMode:null});return}u(e),c(!0)}},r[6]=m,r[7]=f,r[8]=h):h=r[8];let g=h,_;r[9]!==m||r[10]!==l?(_=function(){l!==null&&m({mode:l,enabled:null,resumeMode:null})&&(c(!1),u(null))},r[9]=m,r[10]=l,r[11]=_):_=r[11];let y=_,b=l===`follow`?n:0,x;return r[12]!==s||r[13]!==f||r[14]!==y||r[15]!==g||r[16]!==l||r[17]!==b?(x={mode:f,confirmOpen:s,setConfirmOpen:c,pendingMode:l,strandedCommitCount:b,onModeSelect:g,onConfirm:y},r[12]=s,r[13]=f,r[14]=y,r[15]=g,r[16]=l,r[17]=b,r[18]=x):x=r[18],x}async function Fe(e){let t=await fetch(`/api/sync/trigger`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({op:e})});if(!t.ok)throw Error(`sync trigger failed: ${t.status}`)}var Ie=5e3,Le=15e3,Re=3e4,ze=0;function Be(){let e=Date.now();e-ze<Re||(ze=e,Fe(`fetch`).catch(()=>{ze===e&&(ze=0)}))}async function Ve(e){try{let t=await fetch(`/api/git/worktree-status`,{signal:e});if(!t.ok)return console.warn(`[sync] worktree status read failed: http`,t.status),{kind:`failed`,reason:`http`};let n=await t.json();return n.readable===!1?{kind:`unreadable`}:{kind:`ok`,status:n}}catch(t){return e.aborted?{kind:`failed`,reason:`aborted`}:(console.warn(`[sync] worktree status read failed: network`,t instanceof Error?t.message:t),{kind:`failed`,reason:`network`})}}var He={status:null,unreadable:!1,stale:!1,lastReadAt:null};function Ue(e){let t=(0,U.c)(9),[n,r]=(0,W.useState)(He),i,a;t[0]===e?(i=t[1],a=t[2]):(i=()=>{if(!e)return;let t=!1,n=!1,i=!1,a=null;function o(){if(n){i=!0;return}n=!0;let e=new AbortController;a=e;let s=setTimeout(()=>e.abort(),Le);Ve(e.signal).then(e=>{if(!t){if(e.kind===`ok`){r({status:e.status,unreadable:!1,stale:!1,lastReadAt:Date.now()});return}if(e.kind===`unreadable`){r(Ge);return}r(We)}}).finally(()=>{clearTimeout(s),a===e&&(a=null),n=!1,i&&!t&&(i=!1,o())})}o(),Be();let s=setInterval(o,Ie),c=x(e=>{e.includes(`sync-status`)&&o()});return()=>{t=!0,clearInterval(s),c(),a?.abort()}},a=[e],t[0]=e,t[1]=i,t[2]=a),(0,W.useEffect)(i,a);let o=e&&n.status===null&&!n.unreadable,s;return t[3]!==n.lastReadAt||t[4]!==n.stale||t[5]!==n.status||t[6]!==n.unreadable||t[7]!==o?(s={status:n.status,loading:o,unreadable:n.unreadable,stale:n.stale,lastReadAt:n.lastReadAt},t[3]=n.lastReadAt,t[4]=n.stale,t[5]=n.status,t[6]=n.unreadable,t[7]=o,t[8]=s):s=t[8],s}function We(e){return e.status===null?e.unreadable?e:{...e,unreadable:!0,stale:!1}:e.unreadable||e.stale?e:{...e,stale:!0}}function Ge(e){return{...e,unreadable:!0,stale:!1}}function Ke(e){return e.syncMode===void 0?e.syncEnabled?`full`:`off`:e.syncMode}var G=t();function K(e){let t=(0,U.c)(4),{variant:n}=e;if((n===void 0?`full`:n)===`follow`){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(ne,{children:(0,G.jsx)(r,{id:`W7mERj`})}),t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsxs)(G.Fragment,{children:[e,(0,G.jsx)(I,{children:(0,G.jsx)(r,{id:`KmVekT`})})]}),t[1]=n):n=t[1],n}let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsx)(ne,{children:(0,G.jsx)(r,{id:`Uo2Rj7`})}),t[2]=i):i=t[2];let a;return t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,G.jsxs)(G.Fragment,{children:[i,(0,G.jsx)(I,{children:(0,G.jsx)(r,{id:`n6hXUm`})})]}),t[3]=a):a=t[3],a}function q(e){let t=(0,U.c)(2),{variant:n}=e,r=n===void 0?`full`:n,i;return t[0]===r?i=t[1]:(i=(0,G.jsx)(ve,{children:r===`follow`?(0,G.jsx)(Je,{}):(0,G.jsx)(qe,{})}),t[0]=r,t[1]=i),i}function qe(){let e=(0,U.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(B,{icon:(0,G.jsx)(be,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`cdmk8A`}),body:(0,G.jsx)(r,{id:`YaeyFh`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(B,{icon:(0,G.jsx)(Ce,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`9i21pa`}),body:(0,G.jsx)(r,{id:`KIIamL`})}),e[1]=n):n=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsxs)(G.Fragment,{children:[t,n,(0,G.jsx)(B,{icon:(0,G.jsx)(k,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`8cpeU3`}),body:(0,G.jsx)(r,{id:`DELNQk`})})]}),e[2]=i):i=e[2],i}function Je(){let e=(0,U.c)(3),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(B,{icon:(0,G.jsx)(V,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`0xnQ_X`}),body:(0,G.jsx)(r,{id:`aCoQfY`})}),e[0]=t):t=e[0];let n;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(B,{icon:(0,G.jsx)(we,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`5rnB76`}),body:(0,G.jsx)(r,{id:`kXNv8P`})}),e[1]=n):n=e[1];let i;return e[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,G.jsxs)(G.Fragment,{children:[t,n,(0,G.jsx)(B,{icon:(0,G.jsx)(A,{"aria-hidden":`true`,className:`mt-0.5 size-4 shrink-0 text-muted-foreground`}),title:(0,G.jsx)(r,{id:`oBK5fD`}),body:(0,G.jsx)(r,{id:`8Wav8y`})})]}),e[2]=i):i=e[2],i}function Ye(e){let t=(0,U.c)(24),{open:n,onOpenChange:i,onConfirm:a,variant:o,strandedCommitCount:s}=e,c=o===void 0?`full`:o,l=s===void 0?0:s,u=c===`follow`&&l>0,d;t[0]===c?d=t[1]:(d=(0,G.jsx)(oe,{children:(0,G.jsx)(K,{variant:c})}),t[0]=c,t[1]=d);let f;t[2]===c?f=t[3]:(f=(0,G.jsx)(q,{variant:c}),t[2]=c,t[3]=f);let p;t[4]!==u||t[5]!==l?(p=u&&(0,G.jsx)(`p`,{className:`mt-4 text-sm text-muted-foreground`,children:(0,G.jsx)(r,{id:`caw8gO`,values:{strandedCommitCount:l}})}),t[4]=u,t[5]=l,t[6]=p):p=t[6];let m;t[7]!==f||t[8]!==p?(m=(0,G.jsxs)(L,{children:[f,p]}),t[7]=f,t[8]=p,t[9]=m):m=t[9];let h;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,G.jsx)(ae,{asChild:!0,children:(0,G.jsx)(_,{variant:`outline`,children:(0,G.jsx)(r,{id:`dEgA5A`})})}),t[10]=h):h=t[10];let g;t[11]===c?g=t[12]:(g=c===`follow`?(0,G.jsx)(r,{id:`jTUxaN`}):(0,G.jsx)(r,{id:`pPiV8s`}),t[11]=c,t[12]=g);let v;t[13]!==a||t[14]!==g?(v=(0,G.jsxs)(ie,{children:[h,(0,G.jsx)(_,{onClick:a,children:g})]}),t[13]=a,t[14]=g,t[15]=v):v=t[15];let y;t[16]!==d||t[17]!==m||t[18]!==v?(y=(0,G.jsxs)(re,{className:`sm:max-w-lg`,children:[d,m,v]}),t[16]=d,t[17]=m,t[18]=v,t[19]=y):y=t[19];let b;return t[20]!==i||t[21]!==n||t[22]!==y?(b=(0,G.jsx)(se,{open:n,onOpenChange:i,children:y}),t[20]=i,t[21]=n,t[22]=y,t[23]=b):b=t[23],b}async function Xe(e){let t=await fetch(`/api/sync/resolve-blocking`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:e})});if(!t.ok)throw Error(`sync resolve-blocking failed: ${t.status}`)}function Ze(){return typeof window<`u`&&window.okDesktop!=null}function Qe(e){let t=(0,U.c)(23),{paths:n}=e,[i,a]=(0,W.useState)(null),[o,s]=(0,W.useState)(!1);if(n.length===0)return null;let c;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(c=async function(e){a(e),s(!1);try{await Xe(e),a(null)}catch{s(!0),a(null)}},t[0]=c):c=t[0];let l=c,u=i!==null,d;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,G.jsx)(`span`,{id:`sync-blocking-heading`,className:`text-xs font-medium text-foreground`,children:(0,G.jsx)(r,{id:`sdvHp3`})}),t[1]=d):d=t[1];let f;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,G.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[d,(0,G.jsx)(`span`,{className:`text-2xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`H4doZt`})})]}),t[2]=f):f=t[2];let p;t[3]===n?p=t[4]:(p=n.map(et),t[3]=n,t[4]=p);let m;t[5]===p?m=t[6]:(m=(0,G.jsx)(`ul`,{"aria-labelledby":`sync-blocking-heading`,className:`flex max-h-28 flex-col gap-1 overflow-y-auto overscroll-contain`,"data-testid":`sync-blocking-list`,children:p}),t[5]=p,t[6]=m);let h;t[7]===o?h=t[8]:(h=o&&(0,G.jsx)(`p`,{role:`alert`,className:`text-xs text-destructive`,"data-testid":`sync-blocking-error`,children:(0,G.jsx)(r,{id:`FsEXax`})}),t[7]=o,t[8]=h);let g;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(g=()=>void l(`commit`),t[9]=g):g=t[9];let v;t[10]===i?v=t[11]:(v=i===`commit`&&(0,G.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}),t[10]=i,t[11]=v);let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,G.jsx)(r,{id:`N7Lau6`}),t[12]=y):y=t[12];let b;t[13]!==u||t[14]!==v?(b=(0,G.jsxs)(_,{size:`xs`,disabled:u,onClick:g,"data-testid":`sync-blocking-commit`,children:[v,y]}),t[13]=u,t[14]=v,t[15]=b):b=t[15];let x;t[16]===u?x=t[17]:(x=Ze()&&(0,G.jsxs)(_,{variant:`link-muted`,size:`xs`,className:`self-start p-0`,disabled:u,onClick:$e,"data-testid":`sync-blocking-terminal`,children:[(0,G.jsx)(N,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`6EoD0z`})]}),t[16]=u,t[17]=x);let S;return t[18]!==b||t[19]!==x||t[20]!==m||t[21]!==h?(S=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-t pt-3`,children:[f,m,h,b,x]}),t[18]=b,t[19]=x,t[20]=m,t[21]=h,t[22]=S):S=t[22],S}function $e(){return ye(`git-status`)}function et(e){return(0,G.jsx)(`li`,{title:e,className:`min-w-0 truncate font-mono text-2xs text-foreground`,children:e},e)}function J(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function tt(e){return e===``?[]:e.split(`/`)}function nt(e){if(e.length===0)return``;let t=tt(J(e[0]));for(let n of e.slice(1)){let e=tt(J(n)),r=0;for(;r<t.length&&r<e.length&&t[r]===e[r];)r++;if(t=t.slice(0,r),t.length===0)break}return t.join(`/`)}function Y(e,t){return e===``?t:t.slice(e.length+1)}function rt(e,t=8){if(e.length===0)return{prefix:``,groups:[],loose:[]};if(e.length===1)return{prefix:``,groups:[],loose:[{entry:e[0],label:e[0].path}]};let n=nt(e.map(e=>e.path)),r=e.map(e=>{let t=Y(n,e.path);return{entry:e,rel:t,key:J(t)}}),i=()=>new Set(r.map(e=>e.key));for(;i().size>t;){let e=Math.max(...r.map(e=>tt(e.key).length));if(e===0)break;for(let t of r)tt(t.key).length===e&&(t.key=J(t.key))}let a=new Map;for(let{entry:e,rel:t,key:n}of r){let r=a.get(n)??[];r.push({entry:e,label:n===``?t:t.slice(n.length+1)}),a.set(n,r)}let o=[],s=[];for(let[e,t]of a)if(e===``||t.length===1)for(let e of t)s.push({entry:e.entry,label:Y(n,e.entry.path)});else o.push({dir:e,rows:t});return o.sort((e,t)=>t.rows.length-e.rows.length||e.dir.localeCompare(t.dir)),s.sort((e,t)=>e.entry.path.localeCompare(t.entry.path)),{prefix:n,groups:o,loose:s}}function it(e=`sync`,t){Fe(e).catch(e=>{console.warn(`[sync-badge] manual sync trigger failed`,e instanceof Error?e.message:e),t?.()})}function at(e){typeof window>`u`||(_e(),ue(window.location.hash,e)||(window.location.hash=e))}function ot(e){return e.kind===`doc`?de(e.docName):le(e.path)}var st=3e4;function X(e,t,n){let r=n-t;return r<6e4?e({id:`xOTzt5`}):r<36e5?e({id:`_rP3HI`,values:{minutes:Math.floor(r/6e4)}}):r<864e5?e({id:`nYeBmY`,values:{hours:Math.floor(r/36e5)}}):new Date(t).toLocaleDateString()}function Z(e,t){return X(e,new Date(t).getTime(),Date.now())}function ct(){let e=(0,U.c)(2),[t,n]=(0,W.useState)(lt),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=setInterval(()=>n(Date.now()),st);return()=>clearInterval(e)},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,W.useEffect)(r,i),t}function lt(){return Date.now()}function Q(e){return e.syncMode===`follow`}var ut=[`git-operation-in-progress`,`unsafe-incoming-symlinks`];function $(e){return ut.includes(e)}function dt(e){return e.state===`idle`&&e.conflictCount>0?`conflict`:(e.state===`idle`||e.state===`offline`)&&$(e.pausedReason)?`disabled`:e.state}function ft(e){let t=(0,U.c)(23),{status:n,size:r}=e,i=r===void 0?`size-3.5`:r;switch(dt(n)){case`dormant`:{let e=`${i} text-muted-foreground`,n;return t[0]===e?n=t[1]:(n=(0,G.jsx)(H,{className:e}),t[0]=e,t[1]=n),n}case`idle`:{if(n.ahead>0||n.behind>0){let e=`${i} text-muted-foreground`,n;return t[2]===e?n=t[3]:(n=(0,G.jsx)(M,{className:e}),t[2]=e,t[3]=n),n}let e=`${i} text-muted-foreground`,r;return t[4]===e?r=t[5]:(r=(0,G.jsx)(H,{className:e}),t[4]=e,t[5]=r),r}case`fetching`:case`pulling`:case`pushing`:{let e=`${i} text-muted-foreground`,n;return t[6]===e?n=t[7]:(n=(0,G.jsx)(j,{"aria-hidden":`true`,icon:M,className:e}),t[6]=e,t[7]=n),n}case`conflict`:{let e=`${i} text-warning`,n;return t[8]===e?n=t[9]:(n=(0,G.jsx)(P,{className:e}),t[8]=e,t[9]=n),n}case`offline`:{let e=`${i} text-muted-foreground`,n;return t[10]===e?n=t[11]:(n=(0,G.jsx)(Se,{className:e}),t[10]=e,t[11]=n),n}case`auth-error`:{let e;return t[12]!==i||t[13]!==n?(e=Ot(n)?(0,G.jsx)(xe,{className:`${i} text-destructive`}):(0,G.jsx)(Te,{className:`${i} text-destructive`}),t[12]=i,t[13]=n,t[14]=e):e=t[14],e}case`disabled`:{if(n.pausedReason){let e=`${i} text-warning`,n;return t[15]===e?n=t[16]:(n=(0,G.jsx)(P,{className:e}),t[15]=e,t[16]=n),n}if(n.ahead>0||n.behind>0){let e=`${i} text-muted-foreground`,n;return t[17]===e?n=t[18]:(n=(0,G.jsx)(M,{className:e}),t[17]=e,t[18]=n),n}let e=`${i} text-muted-foreground`,r;return t[19]===e?r=t[20]:(r=(0,G.jsx)(H,{className:e}),t[19]=e,t[20]=r),r}default:{let e=`${i} text-muted-foreground`,n;return t[21]===e?n=t[22]:(n=(0,G.jsx)(H,{className:e}),t[21]=e,t[22]=n),n}}}function pt(e){switch(dt(e)){case`idle`:return!Q(e)&&e.ahead>0?`↑${e.ahead}`:e.behind>0?`↓${e.behind}`:``;case`fetching`:case`pulling`:case`pushing`:return``;case`conflict`:return e.conflictCount>0?`${e.conflictCount}`:``;case`offline`:return``;case`auth-error`:return``;default:return``}}function mt(e){let t=Q(e),n=dt(e);switch(n){case`dormant`:return y._({id:`RmBY0A`});case`idle`:return t?y._({id:`j5CWO4`}):y._({id:`N2FcBE`});case`fetching`:return t?y._({id:`7IsvrP`}):y._({id:`Wgmlsw`});case`pulling`:return t?y._({id:`JL3si7`}):y._({id:`4uNLmk`});case`pushing`:return y._({id:`iycx_A`});case`conflict`:return y._({id:`IInnZo`});case`offline`:return y._({id:`6Aih4U`});case`auth-error`:return y._({id:`mHVPm5`});case`disabled`:return e.pausedReason?y._({id:`U6wmNc`}):y._({id:`BWTzAb`});default:return n}}var ht=[`git-index-locked`],gt={"git-index-locked":{id:`sOcMdy`},"git-operation-in-progress":{id:`mJTr6D`},"external-changes-pending":{id:`W9_Bub`},"dirty-tree":{id:`a5Gha5`},"non-content-merge-failure":{id:`sIxSSP`},"detached-head":{id:`uQNW00`},"diverged-local-commits":{id:`LQsCPn`},"auth-error":{id:`mHVPm5`},"protected-branch":{id:`8fc_3j`},"no-push-permission":{id:`EiVgl5`},"no-commits-yet":{id:`-ZVU5v`},"unsafe-incoming-symlinks":{id:`8qsUJv`}};function _t(e){return Object.hasOwn(gt,e)}function vt(e,t){return _t(t)?e(gt[t]):t}function yt(e){return ht.includes(e)}function bt(e){throw Error(`Unhandled node-rendered paused reason: ${String(e)}`)}function xt(e){let t=(0,U.c)(3),{reason:n}=e;switch(n){case`git-index-locked`:{let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(r,{id:`Qca--K`,components:{0:(0,G.jsx)(`span`,{dir:`ltr`,className:`font-mono`})}}),t[0]=e):e=t[0],e}default:{let e;return t[1]===n?e=t[2]:(e=bt(n),t[1]=n,t[2]=e),e}}}function St(e){let t=(0,U.c)(4),{paths:n}=e;if(n===void 0||n.length===0)return null;let r;t[0]===n?r=t[1]:(r=n.map(Ct),t[0]=n,t[1]=r);let i;return t[2]===r?i=t[3]:(i=(0,G.jsx)(`ul`,{className:`flex max-h-28 flex-col gap-1 overflow-y-auto overscroll-contain`,"data-testid":`sync-refused-symlinks`,children:r}),t[2]=r,t[3]=i),i}function Ct(e){return(0,G.jsx)(`li`,{title:e,dir:`ltr`,className:`min-w-0 truncate font-mono text-2xs text-foreground`,children:e},e)}function wt(e){let t=(0,U.c)(7),{reason:n}=e,{_:r}=i();if(yt(n)){let e;return t[0]===n?e=t[1]:(e=(0,G.jsx)(xt,{reason:n}),t[0]=n,t[1]=e),e}let a;t[2]!==r||t[3]!==n?(a=vt(r,n),t[2]=r,t[3]=n,t[4]=a):a=t[4];let o;return t[5]===a?o=t[6]:(o=(0,G.jsx)(G.Fragment,{children:a}),t[5]=a,t[6]=o),o}function Tt(e,t){let n=[];switch(e){case`not-authenticated`:n.push(y._({id:`ycIX5i`}));break;case`no-collaborator`:n.push(y._({id:`EiVgl5`}));break;case`private-no-access`:n.push(y._({id:`07gHun`}));break;case`repo-not-found`:n.push(y._({id:`uksqrP`}));break;default:n.push(y._({id:`EiVgl5`}))}return n.push(...Et(t)),n}function Et(e){let t=[];if(e?.resolvedLogin){let n=e.resolvedLogin;t.push(y._({id:`ZKVuLY`,values:{login:n}}))}return e?.declaredLogin&&t.push(Dt(e.declaredLogin,e.declaredSource)),t}function Dt(e,t){switch(t){case`remote-url`:return y._({id:`CMd-g-`,values:{declaredLogin:e}});case`credential-config`:return y._({id:`akOe4q`,values:{declaredLogin:e}});default:return y._({id:`GBEqoP`,values:{declaredLogin:e}})}}function Ot(e){return e.pushErrorCode===`auth-not-found-as-identity`||e.pullErrorCode===`auth-not-found-as-identity`}function kt(e){return e?.pausedReason===`auth-error`&&Ot(e)}function At(e){return e?.checkStatus===`denied`&&e.deniedReason===`not-authenticated`}function jt(e){return typeof e?.webUrl==`string`}function Mt(e){return e!=null&&!jt(e)}function Nt(e){return e?.transport===void 0||e.transport===`https`}function Pt(e,t){switch(e){case`auth-401`:return t?y._({id:`-Qw-1t`}):y._({id:`LVWA9A`});case`auth-scope-mismatch`:return t?y._({id:`Zue_jx`}):y._({id:`yLyiQV`});case`auth-no-credential`:return t?y._({id:`uCaIdy`}):y._({id:`xJ7qrb`});default:return null}}function Ft(e,t){let n=Pt(e,t);if(n!==null)return n;switch(e){case`auth-403`:return y._({id:`EiVgl5`});case`semantic-protected-branch`:return y._({id:`T0OVm7`});case`auth-not-found-as-identity`:return y._({id:`jRsjlF`});default:return y._({id:`1AumWo`})}}function It(e,t){let n=Pt(e,t);if(n!==null)return n;switch(e){case`auth-403`:return y._({id:`RgbKEe`});case`auth-not-found-as-identity`:return y._({id:`jRsjlF`});default:return y._({id:`jZ_E5M`})}}function Lt(e,t){let n=Pt(e,t);if(n!==null)return n;switch(e){case`auth-403`:return y._({id:`RgbKEe`});case`semantic-protected-branch`:return y._({id:`T0OVm7`});case`auth-not-found-as-identity`:return y._({id:`jRsjlF`});default:return y._({id:`cUk6TF`})}}function Rt(e){let t=jt(e.remote),n=e.pushErrorCode!=null||e.pushError!=null,r=e.pullErrorCode!=null||e.pullError!=null;if(n&&r&&(e.pushErrorCode==null?e.pullErrorCode==null&&e.pushError===e.pullError:e.pushErrorCode===e.pullErrorCode))return[{key:`sync`,direction:null,message:e.pushErrorCode==null?e.pushError:Lt(e.pushErrorCode,t)}];let i=n&&r,a=[];return n&&a.push({key:`push`,direction:i?`push`:null,message:e.pushErrorCode?Ft(e.pushErrorCode,t):e.pushError}),r&&a.push({key:`pull`,direction:i?`pull`:null,message:e.pullErrorCode?It(e.pullErrorCode,t):e.pullError}),a}function zt(e){return e?.checkStatus===`unknown`&&e.unknownError===`token-invalid`}function Bt(e){return dt(e)===`auth-error`&&Ot(e)?y._({id:`EkEFE3`}):mt(e)}function Vt(e){let t=Q(e),n=dt(e);if(n===`conflict`&&e.conflictCount>0){let{conflictCount:t}=e;return y._({id:`cUK8lW`,values:{conflictCount:t}})}if(n===`idle`){let{ahead:n,behind:r}=e;return t?r>0?y._({id:`9o1bIV`,values:{behind:r}}):y._({id:`j5CWO4`}):n>0&&r>0?y._({id:`5F5HYj`,values:{ahead:n,behind:r}}):n>0?y._({id:`PdA9NZ`,values:{ahead:n}}):r>0?y._({id:`9o1bIV`,values:{behind:r}}):y._({id:`N2FcBE`})}return Bt(e)}function Ht(e){let t=(0,U.c)(3),{children:n,id:r}=e,i;return t[0]!==n||t[1]!==r?(i=(0,G.jsx)(`span`,{id:r,className:`font-mono uppercase tracking-wide text-2xs text-muted-foreground`,children:n}),t[0]=n,t[1]=r,t[2]=i):i=t[2],i}function Ut(e){switch(e){case`M`:return y._({id:`tgWuMB`});case`A`:return y._({id:`hp8OtS`});case`D`:return y._({id:`vGjmyl`});case`R`:return y._({id:`QeREu8`});case`C`:return y._({id:`6V3Ea3`});case`U`:return y._({id:`cyoNqf`});case`T`:return y._({id:`zWZBPx`});case`?`:return y._({id:`C2abof`});case`!`:return y._({id:`xDKOFk`});default:return y._({id:`cNsIJf`})}}function Wt(e){switch(e){case`D`:return`destructive`;case`U`:return`warning`;default:return`gray`}}function Gt(e){let t=(0,U.c)(25),{entry:n,dimmed:r,label:i}=e,a;t[0]===n.code?a=t[1]:(a=Ut(n.code),t[0]=n.code,t[1]=a);let l=a,u=n.open,d=`truncate text-start font-mono text-2xs ${r?`text-muted-foreground/60`:`text-foreground`}`,f;t[2]===n.code?f=t[3]:(f=Wt(n.code),t[2]=n.code,t[3]=f);let p;t[4]===n.code?p=t[5]:(p=(0,G.jsx)(`span`,{"aria-hidden":!0,children:n.code}),t[4]=n.code,t[5]=p);let m;t[6]===l?m=t[7]:(m=(0,G.jsx)(`span`,{className:`sr-only`,children:l}),t[6]=l,t[7]=m);let h;t[8]!==f||t[9]!==p||t[10]!==m?(h=(0,G.jsx)(o,{asChild:!0,children:(0,G.jsxs)(F,{variant:f,className:`size-4 shrink-0 justify-center p-0 text-2xs leading-none`,children:[p,m]})}),t[8]=f,t[9]=p,t[10]=m,t[11]=h):h=t[11];let g;t[12]===l?g=t[13]:(g=(0,G.jsx)(s,{children:l}),t[12]=l,t[13]=g);let v;t[14]!==h||t[15]!==g?(v=(0,G.jsxs)(c,{children:[h,g]}),t[14]=h,t[15]=g,t[16]=v):v=t[16];let y;t[17]!==n.path||t[18]!==i||t[19]!==u||t[20]!==d?(y=u?(0,G.jsxs)(c,{children:[(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(pe,{asChild:!0,children:(0,G.jsx)(_,{variant:`link-muted`,size:`xs`,className:`h-auto min-h-6 min-w-0 shrink justify-start overflow-hidden p-0 font-normal`,"aria-label":n.path,onClick:()=>at(ot(u)),"data-testid":`worktree-row-open`,children:(0,G.jsx)(`span`,{dir:`auto`,className:`min-w-0 ${d}`,children:i})})})}),(0,G.jsx)(s,{dir:`auto`,className:`font-mono text-2xs`,children:n.path})]}):(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(c,{children:[(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(`span`,{dir:`auto`,tabIndex:0,className:`min-w-0 rounded-xs focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50 ${d}`,children:i})}),(0,G.jsx)(s,{dir:`auto`,className:`font-mono text-2xs`,children:n.path})]}),i!==n.path&&(0,G.jsx)(`span`,{className:`sr-only`,children:n.path})]}),t[17]=n.path,t[18]=i,t[19]=u,t[20]=d,t[21]=y):y=t[21];let b;return t[22]!==v||t[23]!==y?(b=(0,G.jsxs)(`li`,{className:`flex min-w-0 items-center gap-2`,children:[v,y]}),t[22]=v,t[23]=y,t[24]=b):b=t[24],b}function Kt(e){let t=(0,U.c)(15),{rows:n,dimmed:i}=e,[a,o]=(0,W.useState)(!1),s=n.length>6,c;t[0]!==n||t[1]!==a?(c=a?n:n.slice(0,6),t[0]=n,t[1]=a,t[2]=c):c=t[2];let l=c,u=n.length-6,d;if(t[3]!==i||t[4]!==l){let e;t[6]===i?e=t[7]:(e=e=>{let{entry:t,label:n}=e;return(0,G.jsx)(Gt,{entry:t,dimmed:i,label:n},`${t.code}:${t.path}`)},t[6]=i,t[7]=e),d=l.map(e),t[3]=i,t[4]=l,t[5]=d}else d=t[5];let f;t[8]!==s||t[9]!==u||t[10]!==a?(f=s&&(0,G.jsx)(`li`,{children:(0,G.jsx)(_,{variant:`link-muted`,size:`xs`,"aria-expanded":a,className:`h-auto min-h-6 justify-start p-0 text-2xs font-normal`,onClick:()=>o(qt),"data-testid":`worktree-rows-show-all`,children:a?(0,G.jsx)(r,{id:`H86f9p`}):(0,G.jsx)(r,{id:`B6Lac2`,values:{overflowCount:u}})})}),t[8]=s,t[9]=u,t[10]=a,t[11]=f):f=t[11];let p;return t[12]!==d||t[13]!==f?(p=(0,G.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[d,f]}),t[12]=d,t[13]=f,t[14]=p):p=t[14],p}function qt(e){return!e}function Jt(e){let t=(0,U.c)(25),{group:n,prefix:i,dimmed:a}=e,f=n.rows.length,[p,m]=(0,W.useState)(!1),h=i===``?n.dir:`${i}/${n.dir}`,g=`size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none ${p?`rotate-90`:``}`,v;t[0]===g?v=t[1]:(v=(0,G.jsx)(O,{className:g,"aria-hidden":!0}),t[0]=g,t[1]=v);let y;t[2]===n.dir?y=t[3]:(y=(0,G.jsx)(`span`,{dir:`auto`,className:`min-w-0 truncate text-start font-mono text-2xs text-muted-foreground`,children:n.dir}),t[2]=n.dir,t[3]=y);let b;t[4]===f?b=t[5]:(b=(0,G.jsx)(`span`,{"aria-hidden":!0,className:`ms-auto shrink-0 ps-1 text-2xs text-muted-foreground tabular-nums`,children:f}),t[4]=f,t[5]=b);let x;t[6]===f?x=t[7]:(x=(0,G.jsx)(`span`,{className:`sr-only`,children:(0,G.jsx)(r,{id:`u3BOHd`,values:{fileCount:f}})}),t[6]=f,t[7]=x);let S;t[8]!==v||t[9]!==y||t[10]!==b||t[11]!==x?(S=(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(u,{asChild:!0,children:(0,G.jsxs)(_,{variant:`ghost`,size:`xs`,className:`h-auto min-h-6 w-full justify-start gap-1 px-0 font-normal`,children:[v,y,b,x]})})}),t[8]=v,t[9]=y,t[10]=b,t[11]=x,t[12]=S):S=t[12];let C;t[13]===h?C=t[14]:(C=(0,G.jsx)(s,{dir:`auto`,className:`font-mono text-2xs`,children:h}),t[13]=h,t[14]=C);let w;t[15]!==S||t[16]!==C?(w=(0,G.jsxs)(c,{children:[S,C]}),t[15]=S,t[16]=C,t[17]=w):w=t[17];let T;t[18]!==a||t[19]!==n.rows?(T=(0,G.jsx)(l,{className:`ps-4`,children:(0,G.jsx)(Kt,{rows:n.rows,dimmed:a})}),t[18]=a,t[19]=n.rows,t[20]=T):T=t[20];let E;return t[21]!==p||t[22]!==w||t[23]!==T?(E=(0,G.jsxs)(d,{open:p,onOpenChange:m,className:`flex flex-col gap-1`,children:[w,T]}),t[21]=p,t[22]=w,t[23]=T,t[24]=E):E=t[24],E}function Yt(e){let t=(0,U.c)(39),{title:n,note:i,entries:a,dimmed:o}=e,s=o===void 0?!1:o;if(a.length===0)return null;let c=a.length,f,p,m,h,g,v,y,b,x;if(t[0]!==s||t[1]!==a||t[2]!==c||t[3]!==i||t[4]!==n){let{prefix:e,groups:o,loose:S}=rt(a);m=S,p=d,b=`flex flex-col gap-1`;let C;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,G.jsx)(O,{className:`size-3 shrink-0 text-muted-foreground transition-transform motion-reduce:transition-none group-data-[state=open]:rotate-90`,"aria-hidden":!0}),t[14]=C):C=t[14];let w;t[15]===n?w=t[16]:(w=(0,G.jsx)(`span`,{className:`text-2xs font-medium text-muted-foreground`,children:n}),t[15]=n,t[16]=w);let T;t[17]===c?T=t[18]:(T=(0,G.jsx)(`span`,{className:`ms-auto shrink-0 ps-1 text-2xs text-muted-foreground tabular-nums`,children:(0,G.jsx)(r,{id:`u3BOHd`,values:{fileCount:c}})}),t[17]=c,t[18]=T),t[19]!==w||t[20]!==T?(x=(0,G.jsx)(u,{asChild:!0,children:(0,G.jsxs)(_,{variant:`ghost`,size:`xs`,className:`group h-auto min-h-6 w-full justify-start gap-1 px-0 font-normal data-[state=open]:bg-transparent`,children:[C,w,T]})}),t[19]=w,t[20]=T,t[21]=x):x=t[21],f=l,h=`flex flex-col gap-1 ps-3`,t[22]===i?g=t[23]:(g=i&&(0,G.jsx)(`span`,{className:`text-2xs text-muted-foreground/80`,children:i}),t[22]=i,t[23]=g),v=e!==``&&(0,G.jsxs)(`span`,{dir:`auto`,className:`break-all font-mono text-2xs text-muted-foreground`,children:[e,`/`]}),y=o.map(t=>(0,G.jsx)(Jt,{group:t,prefix:e,dimmed:s},e===``?t.dir:`${e}/${t.dir}`)),t[0]=s,t[1]=a,t[2]=c,t[3]=i,t[4]=n,t[5]=f,t[6]=p,t[7]=m,t[8]=h,t[9]=g,t[10]=v,t[11]=y,t[12]=b,t[13]=x}else f=t[5],p=t[6],m=t[7],h=t[8],g=t[9],v=t[10],y=t[11],b=t[12],x=t[13];let S;t[24]!==s||t[25]!==m?(S=m.length>0&&(0,G.jsx)(Kt,{rows:m,dimmed:s}),t[24]=s,t[25]=m,t[26]=S):S=t[26];let C;t[27]!==f||t[28]!==h||t[29]!==g||t[30]!==v||t[31]!==y||t[32]!==S?(C=(0,G.jsxs)(f,{className:h,children:[g,v,y,S]}),t[27]=f,t[28]=h,t[29]=g,t[30]=v,t[31]=y,t[32]=S,t[33]=C):C=t[33];let w;return t[34]!==p||t[35]!==b||t[36]!==x||t[37]!==C?(w=(0,G.jsxs)(p,{className:b,children:[x,C]}),t[34]=p,t[35]=b,t[36]=x,t[37]=C,t[38]=w):w=t[38],w}function Xt(e){let t=(0,U.c)(9),{direction:n,count:r}=e,{_:a}=i();if(r<=0)return null;let o;t[0]===n?o=t[1]:(o=n===`behind`?(0,G.jsx)(E,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}):(0,G.jsx)(D,{className:`size-3.5 shrink-0 text-muted-foreground`,"aria-hidden":!0}),t[0]=n,t[1]=o);let s;t[2]!==a||t[3]!==r||t[4]!==n?(s=a(n===`behind`?{id:`sKHiNR`,values:{count:r}}:{id:`9ZxzfT`,values:{count:r}}),t[2]=a,t[3]=r,t[4]=n,t[5]=s):s=t[5];let c;return t[6]!==o||t[7]!==s?(c=(0,G.jsxs)(`span`,{className:`flex flex-1 items-center gap-1.5 rounded-md bg-muted px-2 py-1 text-xs text-foreground`,children:[o,s]}),t[6]=o,t[7]=s,t[8]=c):c=t[8],c}function Zt(e){let t=new Set,n=[],r=[];for(let i of[...e.staged,...e.notStaged,...e.untracked])t.has(i.path)||(t.add(i.path),(i.syncScoped?n:r).push(i));return{willPush:n,wontPush:r}}function Qt(e){let t=(0,U.c)(6),{lastReadAt:n}=e,{_:a}=i(),o=ct(),s;t[0]!==a||t[1]!==n||t[2]!==o?(s=X(a,n,o),t[0]=a,t[1]=n,t[2]=o,t[3]=s):s=t[3];let c=s,l;return t[4]===c?l=t[5]:(l=(0,G.jsx)(`p`,{className:`text-2xs text-muted-foreground`,"data-testid":`worktree-stale`,children:(0,G.jsx)(r,{id:`e-pP6g`,values:{staleRelative:c}})}),t[4]=c,t[5]=l),l}function $t(e){let t=(0,U.c)(36),{status:n,worktree:a,loading:o,unreadable:s,stale:c,lastReadAt:l}=e,u;t[0]===a?u=t[1]:(u=a?Zt(a):{willPush:[],wontPush:[]},t[0]=a,t[1]=u);let{willPush:d,wontPush:f}=u,p;t[2]===a?.incoming?p=t[3]:(p=a?.incoming??[],t[2]=a?.incoming,t[3]=p);let m=p,{_:h}=i(),g=c&&!s&&a!==null&&l!==null,_=a!==null&&d.length===0&&f.length===0&&m.length===0,v;t[4]!==h||t[5]!==g||t[6]!==s?(v=s?h({id:`L9ox9k`}):g?h({id:`_LK4d6`}):``,t[4]=h,t[5]=g,t[6]=s,t[7]=v):v=t[7];let y=v,b;t[8]===y?b=t[9]:(b=(0,G.jsx)(`div`,{className:`sr-only`,role:`status`,"aria-live":`polite`,"data-testid":`worktree-announcer`,children:y}),t[8]=y,t[9]=b);let x;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,G.jsx)(Ht,{id:`worktree-status-label`,children:(0,G.jsx)(r,{id:`uAQUqI`})}),t[10]=x):x=t[10];let S;t[11]!==s||t[12]!==a?(S=!s&&a&&(a.branch||a.detached)&&(0,G.jsx)(`span`,{className:`min-w-0 truncate font-mono text-2xs text-muted-foreground`,"data-testid":`worktree-branch`,children:a.detached?(0,G.jsx)(r,{id:`OBdkpo`}):a.upstream?`${a.branch} → ${a.upstream}`:a.branch}),t[11]=s,t[12]=a,t[13]=S):S=t[13];let C;t[14]===S?C=t[15]:(C=(0,G.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[x,S]}),t[14]=S,t[15]=C);let w;t[16]!==n.ahead||t[17]!==n.behind?(w=(n.behind>0||n.ahead>0)&&(0,G.jsxs)(`div`,{className:`flex items-stretch gap-2`,children:[(0,G.jsx)(Xt,{direction:`behind`,count:n.behind}),(0,G.jsx)(Xt,{direction:`ahead`,count:n.ahead})]}),t[16]=n.ahead,t[17]=n.behind,t[18]=w):w=t[18];let T;t[19]!==_||t[20]!==m||t[21]!==o||t[22]!==s||t[23]!==d||t[24]!==f||t[25]!==a?(T=s?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`worktree-unreadable`,children:(0,G.jsx)(r,{id:`L9ox9k`})}):o?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`eolhcI`})}):_?(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`WfcERq`})}):a&&(0,G.jsxs)(`section`,{className:`flex max-h-56 flex-col gap-2.5 overflow-y-auto overscroll-contain focus-visible:outline-none focus-visible:ring-3 focus-visible:ring-ring/50`,tabIndex:0,"aria-labelledby":`worktree-status-label`,"data-testid":`worktree-listing`,children:[(0,G.jsx)(Yt,{title:(0,G.jsx)(r,{id:`NcwbBM`}),entries:m}),(0,G.jsx)(Yt,{title:(0,G.jsx)(r,{id:`JOhCT9`}),entries:d}),(0,G.jsx)(Yt,{title:(0,G.jsx)(r,{id:`vsFXfP`}),note:(0,G.jsx)(r,{id:`PxZCNM`}),entries:f,dimmed:!0}),a.truncated&&(0,G.jsx)(`p`,{className:`text-2xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`KvwJv8`})})]}),t[19]=_,t[20]=m,t[21]=o,t[22]=s,t[23]=d,t[24]=f,t[25]=a,t[26]=T):T=t[26];let E;t[27]!==l||t[28]!==g?(E=g&&l!==null&&(0,G.jsx)(Qt,{lastReadAt:l}),t[27]=l,t[28]=g,t[29]=E):E=t[29];let D;return t[30]!==E||t[31]!==b||t[32]!==C||t[33]!==w||t[34]!==T?(D=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2.5 border-t pt-3`,children:[b,C,w,T,E]}),t[30]=E,t[31]=b,t[32]=C,t[33]=w,t[34]=T,t[35]=D):D=t[35],D}function en(e){let t=(0,U.c)(19),{pulledAt:n,pushedAt:r,combinedAt:a}=e,{_:o}=i(),s,c,l;if(t[0]!==o||t[1]!==a||t[2]!==n||t[3]!==r){s=n===null?null:Z(o,n),c=r===null?null:Z(o,r);let e=a===null?null:Z(o,a);l=s!==null&&c!==null?o({id:`1TA-aJ`,values:{pulled:s,pushed:c}}):s===null?c===null?e===null?null:o({id:`irnKr_`,values:{updatedRelative:e}}):o({id:`lPkjpD`,values:{pushed:c}}):o({id:`xW5AUw`,values:{pulled:s}}),t[0]=o,t[1]=a,t[2]=n,t[3]=r,t[4]=s,t[5]=c,t[6]=l}else s=t[4],c=t[5],l=t[6];let u=l,d=s!==null||c!==null;if(u===null){let e;return t[7]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,G.jsx)(`span`,{}),t[7]=e):e=t[7],e}let f;t[8]!==u||t[9]!==d?(f=d&&(0,G.jsx)(`span`,{className:`sr-only`,"data-testid":`sync-popover-last-sync-label`,children:u}),t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==u||t[12]!==s||t[13]!==c||t[14]!==d?(p=d?(0,G.jsxs)(`span`,{"aria-hidden":`true`,className:`inline-flex items-center gap-1`,children:[s!==null&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,G.jsx)(E,{className:`size-3`}),s]}),s!==null&&c!==null&&(0,G.jsx)(`span`,{children:`·`}),c!==null&&(0,G.jsxs)(`span`,{className:`inline-flex items-center gap-0.5`,children:[(0,G.jsx)(D,{className:`size-3`}),c]})]}):(0,G.jsx)(`span`,{"aria-hidden":`true`,children:u}),t[11]=u,t[12]=s,t[13]=c,t[14]=d,t[15]=p):p=t[15];let m;return t[16]!==f||t[17]!==p?(m=(0,G.jsxs)(`span`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-last-sync`,children:[f,p]}),t[16]=f,t[17]=p,t[18]=m):m=t[18],m}function tn(){let e=(0,U.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,G.jsx)(pe,{asChild:!0,children:(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:nn,"data-testid":`sync-popover-add-host-token`,children:(0,G.jsx)(r,{id:`zXZJoN`})})}),e[0]=t):t=e[0],t}function nn(){return ce()}function rn(e){let t=(0,U.c)(154),{status:n,onSignIn:a,onSetIdentity:o}=e,{_:s}=i(),{conflictCount:c}=n,{projectLocalConfig:l,projectLocalSynced:u}=w(),d=l?.autoSync,v;t[0]===n?v=t[1]:(v=Ke(n),t[0]=n,t[1]=v);let{mode:y,confirmOpen:b,setConfirmOpen:x,pendingMode:C,strandedCommitCount:T,onModeSelect:O,onConfirm:k}=Pe(d,v,n.ahead),{status:A,loading:N,unreadable:P,stale:F,lastReadAt:I}=Ue(!0),ne=y===`follow`,re;t[2]===n?re=t[3]:(re=dt(n),t[2]=n,t[3]=re);let L=re,ie;t[4]===n?ie=t[5]:(ie=Ot(n),t[4]=n,t[5]=ie);let ae=ie,oe=n.lastPullOkUtc??null,se=n.lastPushOkUtc??null,ce=n.lastRunUtc??n.lastSyncUtc??null,R=n.pushPermission?.checkStatus===`denied`&&n.pushPermission.deniedReason!==`not-authenticated`&&!ae,le;t[6]===n.remote?le=t[7]:(le=jt(n.remote),t[6]=n.remote,t[7]=le);let ue=le,fe=!R,z=L===`fetching`||L===`pulling`||L===`pushing`,[me,ge]=(0,W.useState)(null),_e,B;t[8]===z?(_e=t[9],B=t[10]):(_e=()=>{z||ge(null)},B=[z],t[8]=z,t[9]=_e,t[10]=B),(0,W.useEffect)(_e,B);let ve;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(ve=e=>{ge(t=>t===e?null:t)},t[11]=ve):ve=t[11];let ye=ve,V=z?me??(L===`pushing`?`push`:`pull`):null,be;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(be=e=>{ge(e),it(e,()=>ye(e))},t[12]=be):be=t[12];let xe=be,Se=L===`dormant`||L===`auth-error`||n.state===`conflict`,H=Se||n.conflictCount>0,Ce;t[13]===n.blockingPaths?Ce=t[14]:(Ce=n.blockingPaths??[],t[13]=n.blockingPaths,t[14]=Ce);let we=Ce,{conflicts:Te}=he(),De;t[15]===Te?De=t[16]:(De=Te.find(ln)?.docName??null,t[15]=Te,t[16]=De);let Oe=De,ke;t[17]===n?ke=t[18]:(ke=(0,G.jsx)(ft,{status:n}),t[17]=n,t[18]=ke);let Ae;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(Ae=(0,G.jsx)(`span`,{className:`text-1sm font-medium`,children:(0,G.jsx)(r,{id:`yZepkk`})}),t[19]=Ae):Ae=t[19];let je;t[20]===ke?je=t[21]:(je=(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[ke,Ae]}),t[20]=ke,t[21]=je);let Me;t[22]!==s||t[23]!==n.remote?(Me=n.remote&&(n.remote.webUrl?(0,G.jsxs)(`a`,{href:n.remote.webUrl,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-w-0 items-center gap-0.5 text-xs text-foreground hover:text-primary hover:underline`,"aria-label":s({id:`1nke1r`,values:{0:n.remote.label}}),children:[(0,G.jsx)(`span`,{className:`truncate`,children:n.remote.label}),(0,G.jsx)(ee,{className:`size-3.5 shrink-0`,"aria-hidden":!0})]}):(0,G.jsx)(`span`,{className:`min-w-0 truncate text-xs text-foreground`,children:n.remote.label})),t[22]=s,t[23]=n.remote,t[24]=Me):Me=t[24];let Ne;t[25]!==je||t[26]!==Me?(Ne=(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[je,Me]}),t[25]=je,t[26]=Me,t[27]=Ne):Ne=t[27];let Fe=C??`full`,Ie;t[28]!==b||t[29]!==k||t[30]!==x||t[31]!==T||t[32]!==Fe?(Ie=(0,G.jsx)(Ye,{open:b,onOpenChange:x,onConfirm:k,variant:Fe,strandedCommitCount:T}),t[28]=b,t[29]=k,t[30]=x,t[31]=T,t[32]=Fe,t[33]=Ie):Ie=t[33];let Le;t[34]===Symbol.for(`react.memo_cache_sentinel`)?(Le=(0,G.jsx)(Ht,{children:(0,G.jsx)(r,{id:`CnOGgs`})}),t[34]=Le):Le=t[34];let Re;t[35]===O?Re=t[36]:(Re=e=>{S(e)&&O(e)},t[35]=O,t[36]=Re);let ze=!u,Be;t[37]===s?Be=t[38]:(Be=s({id:`CnOGgs`}),t[37]=s,t[38]=Be);let Ve;t[39]===Symbol.for(`react.memo_cache_sentinel`)?(Ve=(0,G.jsx)(h,{}),t[39]=Ve):Ve=t[39];let He;t[40]===Be?He=t[41]:(He=(0,G.jsx)(m,{size:`sm`,className:`w-full text-xs`,"aria-label":Be,"data-testid":`sync-mode-select`,children:Ve}),t[40]=Be,t[41]=He);let We;t[42]===s?We=t[43]:(We=s({id:`BWTzAb`}),t[42]=s,t[43]=We);let Ge;t[44]===We?Ge=t[45]:(Ge=(0,G.jsx)(f,{value:`off`,className:`text-xs`,children:We}),t[44]=We,t[45]=Ge);let K;t[46]===s?K=t[47]:(K=s({id:`tlGXxX`}),t[46]=s,t[47]=K);let q;t[48]===K?q=t[49]:(q=(0,G.jsx)(f,{value:`follow`,className:`text-xs`,children:K}),t[48]=K,t[49]=q);let qe;t[50]===s?qe=t[51]:(qe=s({id:`IXiG0B`}),t[50]=s,t[51]=qe);let Je;t[52]!==R||t[53]!==qe?(Je=(0,G.jsx)(f,{value:`full`,className:`text-xs`,disabled:R,children:qe}),t[52]=R,t[53]=qe,t[54]=Je):Je=t[54];let Xe;t[55]!==Ge||t[56]!==q||t[57]!==Je?(Xe=(0,G.jsxs)(p,{children:[Ge,q,Je]}),t[55]=Ge,t[56]=q,t[57]=Je,t[58]=Xe):Xe=t[58];let Ze;t[59]!==y||t[60]!==Re||t[61]!==ze||t[62]!==He||t[63]!==Xe?(Ze=(0,G.jsxs)(g,{value:y,onValueChange:Re,disabled:ze,children:[He,Xe]}),t[59]=y,t[60]=Re,t[61]=ze,t[62]=He,t[63]=Xe,t[64]=Ze):Ze=t[64];let $e;t[65]===y?$e=t[66]:($e=(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,"data-testid":`sync-popover-mode-line`,children:y===`off`?(0,G.jsx)(r,{id:`qD3krc`}):y===`follow`?(0,G.jsx)(r,{id:`PGRnbw`}):(0,G.jsx)(r,{id:`zBiFZh`})}),t[65]=y,t[66]=$e);let et;t[67]!==Ze||t[68]!==$e?(et=(0,G.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[Le,Ze,$e]}),t[67]=Ze,t[68]=$e,t[69]=et):et=t[69];let J;t[70]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,G.jsx)(Ht,{children:(0,G.jsx)(r,{id:`BWTzAb`})}),t[70]=J):J=t[70];let tt=z||Se,nt;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(nt=()=>xe(`pull`),t[71]=nt):nt=t[71];let Y;t[72]===V?Y=t[73]:(Y=V===`pull`?(0,G.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}):(0,G.jsx)(E,{"data-icon":`inline-start`}),t[72]=V,t[73]=Y);let rt;t[74]===Symbol.for(`react.memo_cache_sentinel`)?(rt=(0,G.jsx)(r,{id:`e4GHWP`}),t[74]=rt):rt=t[74];let ot;t[75]!==tt||t[76]!==Y?(ot=(0,G.jsxs)(_,{variant:`outline`,size:`xs`,className:`flex-1`,disabled:tt,onClick:nt,"data-testid":`sync-popover-pull`,children:[Y,rt]}),t[75]=tt,t[76]=Y,t[77]=ot):ot=t[77];let st;t[78]!==z||t[79]!==fe||t[80]!==H||t[81]!==V?(st=fe&&(0,G.jsxs)(_,{variant:`outline`,size:`xs`,className:`flex-1`,disabled:z||H,onClick:()=>xe(`push`),"data-testid":`sync-popover-push`,children:[V===`push`?(0,G.jsx)(j,{"aria-hidden":`true`,"data-icon":`inline-start`}):(0,G.jsx)(D,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`uO9WLl`})]}),t[78]=z,t[79]=fe,t[80]=H,t[81]=V,t[82]=st):st=t[82];let X;t[83]!==ot||t[84]!==st?(X=(0,G.jsxs)(`div`,{className:`flex gap-2`,children:[ot,st]}),t[83]=ot,t[84]=st,t[85]=X):X=t[85];let Z;t[86]!==z||t[87]!==fe||t[88]!==H||t[89]!==V?(Z=fe&&(0,G.jsxs)(_,{size:`xs`,className:`w-full`,disabled:z||H,onClick:()=>xe(`sync`),"data-testid":`sync-popover-sync`,children:[V===`sync`?(0,G.jsx)(j,{"aria-hidden":`true`,icon:M,"data-icon":`inline-start`}):(0,G.jsx)(M,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`YEzhIr`})]}),t[86]=z,t[87]=fe,t[88]=H,t[89]=V,t[90]=Z):Z=t[90];let ct;t[91]!==X||t[92]!==Z?(ct=(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 border-t pt-3`,children:[J,X,Z]}),t[91]=X,t[92]=Z,t[93]=ct):ct=t[93];let lt;if(t[94]!==s||t[95]!==n){let e;t[97]===s?e=t[98]:(e=e=>(0,G.jsx)(`p`,{className:`text-xs text-destructive`,children:e.direction===`push`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[s({id:`uO9WLl`}),`: `]}),e.message]}):e.direction===`pull`?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(`span`,{className:`font-medium`,children:[s({id:`e4GHWP`}),`: `]}),e.message]}):e.message},e.key),t[97]=s,t[98]=e),lt=Rt(n).map(e),t[94]=s,t[95]=n,t[96]=lt}else lt=t[96];let Q;t[99]===n?Q=t[100]:(Q=kt(n)&&n.pushPermission?.checkStatus===`denied`?Et(n.pushPermission).map(cn):null,t[99]=n,t[100]=Q);let ut;t[101]!==n.pausedReason||t[102]!==n.pushPermission?(ut=n.pausedReason===`no-push-permission`&&n.pushPermission?.checkStatus===`denied`?Et(n.pushPermission).map(sn):null,t[101]=n.pausedReason,t[102]=n.pushPermission,t[103]=ut):ut=t[103];let $;t[104]!==lt||t[105]!==Q||t[106]!==ut?($=(0,G.jsxs)(`div`,{role:`status`,"aria-live":`polite`,className:`flex flex-col gap-3.5 empty:sr-only`,"data-testid":`sync-popover-status`,children:[lt,Q,ut]}),t[104]=lt,t[105]=Q,t[106]=ut,t[107]=$):$=t[107];let pt;t[108]!==we||t[109]!==ne||t[110]!==R||t[111]!==a||t[112]!==n?(pt=!ne&&At(n.pushPermission)?(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`ycIX5i`})}),a&&(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,G.jsx)(r,{id:`5lWFkC`})})]}):we.length>0?(0,G.jsx)(Qe,{paths:we}):kt(n)?null:n.pausedReason?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(wt,{reason:n.pausedReason})}),(0,G.jsx)(St,{paths:n.refusedSymlinkPaths})]}):!ne&&R&&n.pushPermission?.checkStatus===`denied`?Tt(n.pushPermission.deniedReason,n.pushPermission).map(on):zt(n.pushPermission)?(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`C_cPoW`})}),a&&(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,G.jsx)(r,{id:`5lWFkC`})})]}):null,t[108]=we,t[109]=ne,t[110]=R,t[111]=a,t[112]=n,t[113]=pt):pt=t[113];let mt;t[114]!==Oe||t[115]!==L?(mt=L===`conflict`&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-warning`,children:(0,G.jsx)(r,{id:`ko386X`})}),Oe!==null&&(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:()=>at(de(Oe)),children:(0,G.jsx)(r,{id:`5k0NLb`})})]}),t[114]=Oe,t[115]=L,t[116]=mt):mt=t[116];let ht;t[117]!==ue||t[118]!==a||t[119]!==L||t[120]!==n?(ht=L===`auth-error`&&!kt(n)&&(ue?a&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-destructive`,children:(0,G.jsx)(r,{id:`Vl1H8I`})}),(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:a,children:(0,G.jsx)(r,{id:`5lWFkC`})})]}):Nt(n.remote)?(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(`p`,{className:`min-w-0 flex-1 text-xs text-destructive`,"data-testid":`sync-popover-auth-error-unverified`,children:(0,G.jsx)(r,{id:`FioJgb`})}),(0,G.jsx)(tn,{})]}):(0,G.jsx)(`p`,{className:`text-xs text-destructive`,"data-testid":`sync-popover-auth-error-no-token`,children:(0,G.jsx)(r,{id:`w-Wt3H`})})),t[117]=ue,t[118]=a,t[119]=L,t[120]=n,t[121]=ht):ht=t[121];let gt;t[122]===c?gt=t[123]:(gt=c>0&&(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,G.jsx)(r,{id:`B4_ipX`,values:{conflictCount:c}})}),t[122]=c,t[123]=gt);let _t;t[124]!==n||t[125]!==A||t[126]!==I||t[127]!==N||t[128]!==F||t[129]!==P?(_t=(0,G.jsx)($t,{status:n,worktree:A,loading:N,unreadable:P,stale:F,lastReadAt:I}),t[124]=n,t[125]=A,t[126]=I,t[127]=N,t[128]=F,t[129]=P,t[130]=_t):_t=t[130];let vt;t[131]!==ce||t[132]!==oe||t[133]!==se?(vt=(0,G.jsx)(en,{pulledAt:oe,pushedAt:se,combinedAt:ce}),t[131]=ce,t[132]=oe,t[133]=se,t[134]=vt):vt=t[134];let yt;t[135]===Symbol.for(`react.memo_cache_sentinel`)?(yt=(0,G.jsx)(pe,{asChild:!0,children:(0,G.jsxs)(_,{variant:`link`,size:`xs`,className:`h-auto p-0 text-xs text-muted-foreground hover:font-medium hover:text-foreground hover:no-underline`,onClick:an,"data-testid":`sync-popover-settings`,children:[(0,G.jsx)(te,{"data-icon":`inline-start`}),(0,G.jsx)(r,{id:`VNgKZz`})]})}),t[135]=yt):yt=t[135];let bt;t[136]===vt?bt=t[137]:(bt=(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[vt,yt]}),t[136]=vt,t[137]=bt);let xt;t[138]!==o||t[139]!==n.identityUnresolved?(xt=n.identityUnresolved&&o&&(0,G.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-dashed p-2`,children:[(0,G.jsx)(Ee,{className:`mt-0.5 size-3.5 shrink-0 text-muted-foreground`}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1.5`,children:[(0,G.jsx)(`p`,{className:`text-xs leading-snug text-muted-foreground`,children:(0,G.jsx)(r,{id:`nrGWJ7`})}),(0,G.jsx)(_,{variant:`outline`,size:`xs`,className:`self-start`,onClick:o,children:(0,G.jsx)(r,{id:`keNFEd`})})]})]}),t[138]=o,t[139]=n.identityUnresolved,t[140]=xt):xt=t[140];let Ct;return t[141]!==Ne||t[142]!==Ie||t[143]!==et||t[144]!==ct||t[145]!==$||t[146]!==pt||t[147]!==mt||t[148]!==ht||t[149]!==gt||t[150]!==_t||t[151]!==bt||t[152]!==xt?(Ct=(0,G.jsxs)(`div`,{className:`flex flex-col gap-3.5`,children:[Ne,Ie,et,ct,$,pt,mt,ht,gt,_t,bt,xt]}),t[141]=Ne,t[142]=Ie,t[143]=et,t[144]=ct,t[145]=$,t[146]=pt,t[147]=mt,t[148]=ht,t[149]=gt,t[150]=_t,t[151]=bt,t[152]=xt,t[153]=Ct):Ct=t[153],Ct}function an(){return R({advanced:!0})}function on(e){return(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function sn(e){return(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function cn(e){return(0,G.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:e},e)}function ln(e){return e.docName!==null}function un(e){let t=(0,U.c)(68),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{onSignIn:a,onSetIdentity:l}=n,{_:u}=i(),{status:d,fetchError:f}=ge();if(!d){if(f){let e;t[2]===u?e=t[3]:(e=u({id:`iqIDv4`}),t[2]=u,t[3]=e);let n;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,G.jsx)(Se,{className:`size-3.5`}),t[4]=n):n=t[4];let i;t[5]===e?i=t[6]:(i=(0,G.jsx)(o,{asChild:!0,children:(0,G.jsx)(_,{variant:`ghost`,size:`icon-sm`,className:`text-muted-foreground`,"aria-label":e,disabled:!0,children:n})}),t[5]=e,t[6]=i);let a;t[7]===f?a=t[8]:(a=(0,G.jsx)(s,{children:f===`network`?(0,G.jsx)(r,{id:`I5AfhE`}):(0,G.jsx)(r,{id:`uKRYiW`})}),t[7]=f,t[8]=a);let l;return t[9]!==i||t[10]!==a?(l=(0,G.jsxs)(c,{children:[i,a]}),t[9]=i,t[10]=a,t[11]=l):l=t[11],l}return null}if(!d.hasRemote)return null;let p;t[12]===d?p=t[13]:(p=pt(d),t[12]=d,t[13]=p);let m=p,h,g,v,y,b,x,S,C,w,T,E,D;if(t[14]!==u||t[15]!==d){let e=Bt(d);x=!!d.identityUnresolved,b=me,y=c,v=o,D=!0,g=fe,E=!0,h=_,S=`ghost`,C=`icon-sm`,w=`text-muted-foreground relative`,T=u(x?{id:`DFfRbX`,values:{syncStateLabel:e}}:{id:`F4vEsL`,values:{syncStateLabel:e}}),t[14]=u,t[15]=d,t[16]=h,t[17]=g,t[18]=v,t[19]=y,t[20]=b,t[21]=x,t[22]=S,t[23]=C,t[24]=w,t[25]=T,t[26]=E,t[27]=D}else h=t[16],g=t[17],v=t[18],y=t[19],b=t[20],x=t[21],S=t[22],C=t[23],w=t[24],T=t[25],E=t[26],D=t[27];let ee;t[28]===d?ee=t[29]:(ee=(0,G.jsx)(ft,{status:d,size:`size-4`}),t[28]=d,t[29]=ee);let O;t[30]===m?O=t[31]:(O=m&&(0,G.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 text-[9px] leading-none font-medium bg-background border rounded-full px-0.5`,children:m}),t[30]=m,t[31]=O);let k;t[32]!==m||t[33]!==x?(k=!m&&x&&(0,G.jsx)(`span`,{className:`absolute -top-0.5 -right-0.5 size-1.5 rounded-full bg-warning ring-2 ring-background`,"aria-hidden":!0}),t[32]=m,t[33]=x,t[34]=k):k=t[34];let te;t[35]!==h||t[36]!==O||t[37]!==k||t[38]!==S||t[39]!==C||t[40]!==w||t[41]!==T||t[42]!==ee?(te=(0,G.jsxs)(h,{variant:S,size:C,className:w,"aria-label":T,children:[ee,O,k]}),t[35]=h,t[36]=O,t[37]=k,t[38]=S,t[39]=C,t[40]=w,t[41]=T,t[42]=ee,t[43]=te):te=t[43];let A;t[44]!==g||t[45]!==te||t[46]!==E?(A=(0,G.jsx)(g,{asChild:E,children:te}),t[44]=g,t[45]=te,t[46]=E,t[47]=A):A=t[47];let j;t[48]!==v||t[49]!==A||t[50]!==D?(j=(0,G.jsx)(v,{asChild:D,children:A}),t[48]=v,t[49]=A,t[50]=D,t[51]=j):j=t[51];let M;t[52]===d?M=t[53]:(M=Vt(d),t[52]=d,t[53]=M);let N;t[54]===M?N=t[55]:(N=(0,G.jsx)(s,{children:M}),t[54]=M,t[55]=N);let P;t[56]!==y||t[57]!==j||t[58]!==N?(P=(0,G.jsxs)(y,{children:[j,N]}),t[56]=y,t[57]=j,t[58]=N,t[59]=P):P=t[59];let F;t[60]!==l||t[61]!==a||t[62]!==d?(F=(0,G.jsx)(z,{align:`end`,className:`flex max-h-(--radix-popover-content-available-height) w-80 flex-col overflow-y-auto p-3`,children:(0,G.jsx)(rn,{status:d,onSignIn:a,onSetIdentity:l})}),t[60]=l,t[61]=a,t[62]=d,t[63]=F):F=t[63];let I;return t[64]!==b||t[65]!==P||t[66]!==F?(I=(0,G.jsxs)(b,{children:[P,F]}),t[64]=b,t[65]=P,t[66]=F,t[67]=I):I=t[67],I}export{Ae as C,V as D,H as E,De as S,Oe as T,q as _,Et as a,je as b,Ot as c,$ as d,Nt as f,K as g,Ye as h,dt as i,jt as l,zt as m,St as n,Lt as o,At as p,un as r,Mt as s,wt as t,kt as u,Ke as v,Me as w,ke as x,Fe as y};
|
|
@@ -1,4 +1,4 @@
|
|
|
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{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-DzgjsZzC.js";import{C as c,D as l,E as u,O as d,S as f,T as p,b as m,w as h,y as g}from"./handoff-DzPPe6fp.js";import{r as _}from"./use-apply-config-theme-CYFG76sS.js";import{f as v,p as y}from"./agent-registry-BdHe0AEQ.js";import{t as b}from"./triangle-alert-BXrUEeRU.js";import{t as x}from"./x-DM2drskU.js";import{f as S,g as C,m as w,n as T,r as ee,s as E,t as te}from"./agent-connections-D6YhmKlS.js";import{l as D,s as ne,u as re}from"./doc-hash-BJkweiX9.js";import{t as ie}from"./reveal-editor-
|
|
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{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-DzgjsZzC.js";import{C as c,D as l,E as u,O as d,S as f,T as p,b as m,w as h,y as g}from"./handoff-DzPPe6fp.js";import{r as _}from"./use-apply-config-theme-CYFG76sS.js";import{f as v,p as y}from"./agent-registry-BdHe0AEQ.js";import{t as b}from"./triangle-alert-BXrUEeRU.js";import{t as x}from"./x-DM2drskU.js";import{f as S,g as C,m as w,n as T,r as ee,s as E,t as te}from"./agent-connections-D6YhmKlS.js";import{l as D,s as ne,u as re}from"./doc-hash-BJkweiX9.js";import{t as ie}from"./reveal-editor-ChTC5Vss.js";import{i as O,r as k}from"./terminal-command-events-h-p66odT.js";import{n as A}from"./page-list-cache-p7dO1d0k.js";import{n as ae,r as oe,t as se}from"./desktop-bridge-p6CFXLIz.js";import{f as ce,h as le}from"./file-tree-adapter-DC-yGI9s.js";import{t as ue}from"./use-live-xterm-theme-BJbDRXxo.js";import{r as de,t as fe}from"./TerminalStartingNotice-Dif8y9Zs.js";var pe=a(),me=2,he=1,ge=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(me,Math.floor(u/e.css.cell.width)),rows:Math.max(he,Math.floor(l/e.css.cell.height))}}},_e=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],ve=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],j;function M(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var ye=class{constructor(){if(this.version=`6`,!j){j=new Uint8Array(65536),j.fill(1),j[0]=0,j.fill(0,1,32),j.fill(0,127,160),j.fill(2,4352,4448),j[9001]=2,j[9002]=2,j.fill(2,11904,42192),j[12351]=1,j.fill(2,44032,55204),j.fill(2,63744,64256),j.fill(2,65040,65050),j.fill(2,65072,65136),j.fill(2,65280,65377),j.fill(2,65504,65511);for(let e=0;e<_e.length;++e)j.fill(0,_e[e][0],_e[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?j[e]:M(e,ve)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=_t.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return _t.createPropertyValue(0,n,r)}},be=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?we.isErrorNoTelemetry(e)?new we(e.message+`
|
|
2
2
|
|
|
3
3
|
`+e.stack):Error(e.message+`
|
|
4
4
|
|
|
@@ -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{r}from"./dist-Nvb76hAm.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./switch-BKZTXkzu.js";import{n as o}from"./dist-BGzUo_18.js";import{n as s}from"./config-errors-DDAH9fqy.js";import{i as c}from"./use-apply-config-theme-CYFG76sS.js";import"./config-provider-
|
|
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{r}from"./dist-Nvb76hAm.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./switch-BKZTXkzu.js";import{n as o}from"./dist-BGzUo_18.js";import{n as s}from"./config-errors-DDAH9fqy.js";import{i as c}from"./use-apply-config-theme-CYFG76sS.js";import"./config-provider-DY_fun1v.js";import{n as l,t as u}from"./use-terminal-enabled-BSpJ-tlQ.js";import{t as d}from"./channel-cli-copy-DOAEiMde.js";import{n as f,t as p}from"./SettingsSectionHeader-BKhNIRp2.js";var m=i(),h=e(n(),1),g=t();function _(){let e=(0,m.c)(51),{_:t}=r(),n=d(),{enabled:i,synced:_}=u(),y=l(),b=i!==!1,{userConfig:x,userBinding:S,userSynced:C}=c(),w=x?.agents?.autoApproveOkTools!==!1,[T,E]=(0,h.useState)(!1),D,O;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=()=>{let e=window.okDesktop;if(!e)return;let t=!1;return e.terminal.cliPreflight(`codex`).then(e=>{t||E(e.onPath===`present`&&e.okServerConfigured!==!0)}).catch(v),()=>{t=!0}},O=[],e[0]=D,e[1]=O):(D=e[0],O=e[1]),(0,h.useEffect)(D,O);let k;e[2]!==t||e[3]!==y?(k=function(e){if(y===null){o.error(t({id:`w6sBjd`}));return}let n=y(e);n.ok||o.error(t(e?{id:`jKd3AP`,values:{0:n.error}}:{id:`pajIrl`,values:{0:n.error}}))},e[2]=t,e[3]=y,e[4]=k):k=e[4];let A=k,j;e[5]!==t||e[6]!==S?(j=function(e){if(S===null){o.error(t({id:`fnlBN4`}));return}let n=S.patch({agents:{autoApproveOkTools:e}});if(!n.ok){let e=s(n.error);o.error(t({id:`habOU_`,values:{detail:e}}))}},e[5]=t,e[6]=S,e[7]=j):j=e[7];let M=j,N;e[8]===t?N=e[9]:(N=t({id:`ALhMYW`}),e[8]=t,e[9]=N);let P;e[10]===t?P=e[11]:(P=t({id:`FCAcjR`}),e[10]=t,e[11]=P);let F;e[12]!==N||e[13]!==P?(F=(0,g.jsx)(p,{titleId:`settings-terminal-title`,title:N,scope:`project-local`,level:`block`,children:P}),e[12]=N,e[13]=P,e[14]=F):F=e[14];let I;e[15]===t?I=e[16]:(I=t({id:`E4XYYH`}),e[15]=t,e[16]=I);let L;e[17]===I?L=e[18]:(L=(0,g.jsx)(`label`,{htmlFor:`settings-terminal-toggle`,className:`text-sm font-medium`,children:I}),e[17]=I,e[18]=L);let R;e[19]!==t||e[20]!==b?(R=t(b?{id:`6ASTuj`}:{id:`QpSqAP`}),e[19]=t,e[20]=b,e[21]=R):R=e[21];let z;e[22]===R?z=e[23]:(z=(0,g.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-body`,children:R}),e[22]=R,e[23]=z);let B;e[24]!==z||e[25]!==L?(B=(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[L,z]}),e[24]=z,e[25]=L,e[26]=B):B=e[26];let V=!_||y===null,H;e[27]===t?H=e[28]:(H=t({id:`E4XYYH`}),e[27]=t,e[28]=H);let U;e[29]!==A||e[30]!==b||e[31]!==V||e[32]!==H?(U=(0,g.jsx)(a,{id:`settings-terminal-toggle`,checked:b,onCheckedChange:A,disabled:V,"aria-label":H,"data-testid":`settings-terminal-toggle`}),e[29]=A,e[30]=b,e[31]=V,e[32]=H,e[33]=U):U=e[33];let W;e[34]!==B||e[35]!==U?(W=(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[B,U]}),e[34]=B,e[35]=U,e[36]=W):W=e[36];let G;e[37]===t?G=e[38]:(G=t({id:`ilodsp`}),e[37]=t,e[38]=G);let K;e[39]===G?K=e[40]:(K=(0,g.jsx)(`label`,{htmlFor:`settings-terminal-autoapprove-toggle`,className:`text-sm font-medium`,children:G}),e[39]=G,e[40]=K);let q;e[41]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,g.jsx)(f,{scope:`user`}),e[41]=q):q=e[41];let J;e[42]===K?J=e[43]:(J=(0,g.jsxs)(`div`,{className:`flex items-center gap-2`,children:[K,q]}),e[42]=K,e[43]=J);let Y=!C||S===null,X;e[44]===t?X=e[45]:(X=t({id:`ilodsp`}),e[44]=t,e[45]=X);let Z;return e[46]!==M||e[47]!==w||e[48]!==Y||e[49]!==X?(Z=(0,g.jsx)(a,{id:`settings-terminal-autoapprove-toggle`,checked:w,onCheckedChange:M,disabled:Y,"aria-label":X,"data-testid":`settings-terminal-autoapprove-toggle`}),e[46]=M,e[47]=w,e[48]=Y,e[49]=X,e[50]=Z):Z=e[50],(0,g.jsxs)(`section`,{"aria-labelledby":`settings-terminal-title`,className:`space-y-3`,"data-field":`section:terminal`,"data-testid":`settings-terminal`,children:[F,W,(0,g.jsxs)(`div`,{className:`flex items-center justify-between gap-3 rounded-md border p-3`,children:[(0,g.jsxs)(`div`,{className:`space-y-0.5`,children:[J,(0,g.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-autoapprove-body`,children:t({id:`Zmg5Ge`,values:{cliCommand:n}})}),w&&T?(0,g.jsx)(`p`,{className:`text-1sm text-muted-foreground`,"data-testid":`settings-terminal-autoapprove-codex-note`,children:t({id:`sTQjgr`,values:{cliCommand:n}})}):null]}),Z]})]})}function v(){}export{_ as TerminalSection};
|
|
@@ -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}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./use-installed-clis-BTrIR9--.js";import{t as o}from"./config-provider-
|
|
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}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{t as a}from"./use-installed-clis-BTrIR9--.js";import{t as o}from"./config-provider-DY_fun1v.js";import{t as s}from"./use-live-xterm-theme-BJbDRXxo.js";import{t as c}from"./ReportBugMenuTrigger-KsljCE5p.js";import{SessionsHost as l}from"./SessionsHost-CBIKgs04.js";var u=i(),d=e(n(),1),f=t();function p(e){let t=(0,u.c)(9),{bridge:n}=e,r=n.config.collabUrl?n.config.collabUrl:null,i=r===null,a;t[0]===n?a=t[1]:(a=(0,f.jsx)(m,{bridge:n}),t[0]=n,t[1]=a);let s=r===null,l;t[2]===s?l=t[3]:(l=(0,f.jsx)(c,{systemWide:s}),t[2]=s,t[3]=l);let d;return t[4]!==r||t[5]!==i||t[6]!==a||t[7]!==l?(d=(0,f.jsxs)(o,{collabUrl:r,collabTerminal:i,children:[a,l]}),t[4]=r,t[5]=i,t[6]=a,t[7]=l,t[8]=d):d=t[8],d}function m(e){let t=(0,u.c)(9),{bridge:n}=e,{resolvedTheme:i}=r(),o=s(i),c=a(),[p,m]=(0,d.useState)(null),_;t[0]===o.background?_=t[1]:(_=(0,f.jsx)(`div`,{ref:m,className:`flex h-screen min-h-0 flex-col`,style:{backgroundColor:o.background}}),t[0]=o.background,t[1]=_);let v;t[2]!==n||t[3]!==p||t[4]!==c?(v=(0,f.jsx)(l,{bridge:n,surface:`terminal-window`,terminalCapable:!0,visible:!0,onVisibleChange:g,installedClis:c,container:p,isShowing:!0,onRequestEditorFocus:h}),t[2]=n,t[3]=p,t[4]=c,t[5]=v):v=t[5];let y;return t[6]!==_||t[7]!==v?(y=(0,f.jsxs)(f.Fragment,{children:[_,v]}),t[6]=_,t[7]=v,t[8]=y):y=t[8],y}function h(){}function g(e){e||window.close()}export{p as TerminalWindowApp};
|
|
@@ -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{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{_ as o,v as s}from"./constants-upload-CVKO8P4d.js";import{Bn as c,Hn as l,Tn as u,n as d}from"./CodeMirrorPropInput-
|
|
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{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{_ as o,v as s}from"./constants-upload-CVKO8P4d.js";import{Bn as c,Hn as l,Tn as u,n as d}from"./CodeMirrorPropInput-_HrEupqc.js";import{Ct as f,J as p,M as m,Tt as h}from"./dist-BosZaL03.js";import{t as g}from"./cm-theme-Dml6DrPs.js";import{t as _}from"./dist-Bw3EnfRK.js";import{t as v}from"./text-viewer-languages-BpNCtJFb.js";import{t as y}from"./src-Ca8kxD9e.js";import{t as b}from"./doc-undo-manager-Dm2bBXP2.js";var x=a(),S=e(n(),1),C=t(),w=g({dark:!0,background:`var(--background)`,gutterBackground:`var(--muted)`}),T=g({dark:!1,background:`var(--background)`,gutterBackground:`var(--muted)`});function E(e){let t=(0,x.c)(18),{docName:n,provider:a}=e,{_:g}=r(),E=n.slice(n.lastIndexOf(`/`)+1),D=(0,S.useRef)(null),{resolvedTheme:O}=i(),k,A;t[0]===a?(k=t[1],A=t[2]):(A=a.document.getText(`source`),k=b(a,A),t[0]=a,t[1]=k,t[2]=A);let j=k,M;t[3]!==n||t[4]!==a.awareness||t[5]!==O||t[6]!==j||t[7]!==A?(M=()=>{let e=D.current;if(!e)return;let t=O===`dark`?w:T,r=new f,i=new f,g=(o[u(n)]??s(u(n)))!==null&&u(n)!==``,b=new p({state:h.create({doc:A.toString(),extensions:[_,y(A,a.awareness,{undoManager:j}),r.of([]),m(d),i.of(g?[]:p.lineWrapping),p.theme({"&":{height:`100%`}}),t]}),parent:e});c(n,b,`textDocEditor`);let x=!1,S=u(n)||null;return S&&v(S,o[S]??s(S)).then(e=>{x||!e||b.dispatch({effects:r.reconfigure(e)})}),()=>{x=!0,l(n,b),b.destroy()}},t[3]=n,t[4]=a.awareness,t[5]=O,t[6]=j,t[7]=A,t[8]=M):M=t[8];let N;t[9]!==n||t[10]!==a||t[11]!==O||t[12]!==j||t[13]!==A?(N=[A,a,O,n,j],t[9]=n,t[10]=a,t[11]=O,t[12]=j,t[13]=A,t[14]=N):N=t[14],(0,S.useEffect)(M,N);let P=g({id:`xAlHfe`,values:{basename:E}}),F;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,C.jsx)(`div`,{ref:D,className:`min-h-0 flex-1 overflow-auto`}),t[15]=F):F=t[15];let I;return t[16]===P?I=t[17]:(I=(0,C.jsx)(`section`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":P,"data-text-doc-editor":``,children:F}),t[16]=P,t[17]=I),I}export{E as TextDocEditor};
|