@inkeep/open-knowledge 0.86.22 → 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/THIRD_PARTY_NOTICES.md +3 -2
- package/dist/cli.mjs +6 -6
- package/dist/constants-Iymgoe5U.mjs +1 -0
- package/dist/dist-Ds1SZERP.mjs +2213 -0
- package/dist/{dist-0qA3xZU8.mjs → dist-nfglEvqM.mjs} +1 -1
- package/dist/index.mjs +218 -219
- package/dist/{init-DQY_k8Bb.mjs → init-BMQUc4ul.mjs} +2 -2
- package/dist/init-Dq5MuSis.mjs +1 -0
- package/dist/{launch-json-removal-BToQcc3e.mjs → launch-json-removal-DaL2BiQh.mjs} +1 -1
- package/dist/loader-D6muyenS.mjs +1 -0
- package/dist/{loader-BcKRvBDf.mjs → loader-DX_l-d9D.mjs} +1 -1
- package/dist/{md-manager-BGnqyqi1-BzZ_8EQ9.mjs → md-manager-BGnqyqi1-I7NmBKjQ.mjs} +108 -108
- package/dist/native/native-config.win32-arm64-msvc.node +0 -0
- package/dist/native/native-config.win32-x64-msvc.node +0 -0
- package/dist/{open-browser-DhYyRIyx.mjs → open-browser-BGyDP4ZD.mjs} +1 -1
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-BNlI5MHG.mjs → preview-DTwOZM1t.mjs} +1 -1
- package/dist/preview-DZgLv5oB.mjs +1 -0
- package/dist/public/assets/{AboutSection-LPELvEUl.js → AboutSection-Bddd4fs4.js} +1 -1
- package/dist/public/assets/{AccountSection-Dla17okM.js → AccountSection-ZhKVAZRz.js} +1 -1
- package/dist/public/assets/ActivityModeContent-Cu3J2wnZ.js +1 -0
- package/dist/public/assets/{AddPropertiesButton-C0bGsu-F.js → AddPropertiesButton-BiF-H17k.js} +2 -2
- package/dist/public/assets/AgentConnectionsSection-B9_oKPEW.js +1 -0
- package/dist/public/assets/{AgentDiffPane-BIzndumu.js → AgentDiffPane-h67Ihyuy.js} +1 -1
- package/dist/public/assets/{AppMenubar-ClplcAeM.js → AppMenubar-vPHVy2jk.js} +1 -1
- package/dist/public/assets/{AttachmentsSection-BjrHOhme.js → AttachmentsSection-6uV_ZVHZ.js} +1 -1
- package/dist/public/assets/AuthModal-YZGpNH__.js +3 -0
- package/dist/public/assets/{BugReportHistory-BM589t1t.js → BugReportHistory-CHujhV74.js} +1 -1
- package/dist/public/assets/{BugReportHistoryDialog-BfdDMBqN.js → BugReportHistoryDialog-CaE3cXFx.js} +1 -1
- package/dist/public/assets/{ChangedOutsideBadge-DhpGZlDx.js → ChangedOutsideBadge-BfH3veLO.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-C5fRuWf2.js → CodeMirrorPropInput-_HrEupqc.js} +3 -3
- package/dist/public/assets/{ConsentDialogBody-CaPp8huq.js → ConsentDialogBody-k0k7metW.js} +1 -1
- package/dist/public/assets/{ContentRulesSection-B5CAsULt.js → ContentRulesSection-Br4OQaTJ.js} +1 -1
- package/dist/public/assets/{DiffViewBoundary-Czp-0Arc.js → DiffViewBoundary-DFNHnF7f.js} +1 -1
- package/dist/public/assets/{DocumentContext-DDDUTQJi.js → DocumentContext-B6cmniqU.js} +5 -5
- package/dist/public/assets/{EditorModeToggle-Bd8FyUeG.js → EditorModeToggle-DaLqaw6f.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-4RZPPTS9.js → ExcalidrawDocEditor-Dtti2_8y.js} +1 -1
- package/dist/public/assets/FeedbackForm-Cy3p2I18.js +1 -0
- package/dist/public/assets/{GraphPanel-D1tkoAHM.js → GraphPanel-4ARXQVWm.js} +1 -1
- package/dist/public/assets/{HotkeysSection-C9sCf3j3.js → HotkeysSection-D1qQH68p.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-Be_RD2Gk.js → ImportSkillDialog-DooL2Y3J.js} +1 -1
- package/dist/public/assets/{IntegrationsSection-D3htSKMO.js → IntegrationsSection-r5E7Aje8.js} +1 -1
- package/dist/public/assets/{LinkPreviewsSection-D0uy1PxC.js → LinkPreviewsSection-BrZydaih.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-l01M8Bbg.js → LintConfigEditor-D5WZW3Kb.js} +1 -1
- package/dist/public/assets/{LintingSection-12fgbDnF.js → LintingSection-CU-sc0Ur.js} +1 -1
- package/dist/public/assets/{ManagedArtifactProperties-vcuTAbYr.js → ManagedArtifactProperties-BvSP1BV4.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-DXW12uSQ.js +1 -0
- package/dist/public/assets/McpConsentDialogBody-CVZcuVhW.js +1 -0
- package/dist/public/assets/{Mermaid-Dqzqybsn.js → Mermaid-DqNhHNi1.js} +2 -2
- package/dist/public/assets/{MermaidDocEditor-BCNSGhNo.js → MermaidDocEditor-DwEaCHNY.js} +1 -1
- package/dist/public/assets/{NetworkAccessSection-Cxln0QK5.js → NetworkAccessSection-Ci0dBnda.js} +1 -1
- package/dist/public/assets/{OkignoreSection-BudJQycp.js → OkignoreSection-DplnnxQb.js} +2 -2
- package/dist/public/assets/{ProjectTemplatesSection-DCliKsre.js → ProjectTemplatesSection-BEchYRnN.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-CGpmYjl6.js → PropertyDisplayRow-B6_pfxvN.js} +1 -1
- package/dist/public/assets/{PublishToGitHubDialog-BCeR1wkm.js → PublishToGitHubDialog-DdtYAP9Y.js} +1 -1
- package/dist/public/assets/{RegisteredAgentIcon-FmoZTlpS.js → RegisteredAgentIcon-B0qjAvei.js} +1 -1
- package/dist/public/assets/ReportBugDialogBody-jHepd9au.js +3 -0
- package/dist/public/assets/ReportBugMenuTrigger-KsljCE5p.js +1 -0
- package/dist/public/assets/SchemaConfigEditor-DlSrtrC2.js +1 -0
- package/dist/public/assets/{SearchSection-Bcm55yb6.js → SearchSection-DUCXR4Qf.js} +1 -1
- package/dist/public/assets/SessionsHost-CBIKgs04.js +2 -0
- package/dist/public/assets/{SettingsDialogBody-BZpyRgRK.js → SettingsDialogBody-CKjYKbWt.js} +2 -2
- package/dist/public/assets/{SettingsSectionHeader-DDNA1hrR.js → SettingsSectionHeader-BKhNIRp2.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-DVtBOlIm.js → ShareReceiveDialog-DJbtqR4t.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-NFqekHGn.js → ShareReceiveMissDialog-CDei4CzD.js} +1 -1
- package/dist/public/assets/{SharingSection-Y4AD8HPt.js → SharingSection-C-9tTPow.js} +1 -1
- package/dist/public/assets/SkillCostValue-DK-VfwfI.js +1 -0
- package/dist/public/assets/{SkillForkDialog-CPkWchji.js → SkillForkDialog-BHqkO5bK.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-DyKWxkEY.js → SkillInstallMenu-29VzNm-A.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-D6YyylB6.js → SkillOriginInline-Z5JCe0T2.js} +1 -1
- package/dist/public/assets/{SkillPluginBundleDialog-BmLQqQms.js → SkillPluginBundleDialog-BnQu_DSM.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-Bs8p51PI.js → SkillToolbarControls-BVFLkdZj.js} +1 -1
- package/dist/public/assets/{SkillsManagerSection-C0pgRzfs.js → SkillsManagerSection-D4YW1uOY.js} +1 -1
- package/dist/public/assets/{SlidesPluginSection-B8KiQkqa.js → SlidesPluginSection-BhUKklqb.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-DxIDubwo.js → SlidesToolbarControls-DXn_DkWH.js} +1 -1
- package/dist/public/assets/{SourceEditor-DP0HyTpn.js → SourceEditor-CJRzYB7x.js} +1 -1
- package/dist/public/assets/{SpellingSettings-CElN7mrA.js → SpellingSettings-C72xD-Zu.js} +1 -1
- package/dist/public/assets/{SyncSection-C1jLDoRh.js → SyncSection-DrCPevDV.js} +1 -1
- package/dist/public/assets/SyncStatusBadge-CF1z14DG.js +1 -0
- package/dist/public/assets/{TemplateRow-DsoFn6-i.js → TemplateRow-4LHta_yW.js} +2 -2
- package/dist/public/assets/{TerminalLaunchContext-DWUMDSpw.js → TerminalLaunchContext-DprnLNoQ.js} +1 -1
- package/dist/public/assets/{TerminalPanel-ByCiyPt3.js → TerminalPanel-D93jMQs_.js} +2 -2
- package/dist/public/assets/{TerminalSection-C8HHQC_K.js → TerminalSection-DjyjBYpU.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-D6hHsUKZ.js → TerminalWindowApp-CZN9GQ0B.js} +1 -1
- package/dist/public/assets/{TextDocEditor-BZCB5p1t.js → TextDocEditor-219p4L8n.js} +1 -1
- package/dist/public/assets/ThemePluginSection-BHfep7sw.js +6 -0
- package/dist/public/assets/ThreadView-HjOlpdvu.js +28 -0
- package/dist/public/assets/{TimelineDiffPane-BiVpBG0u.js → TimelineDiffPane-BNO514Vt.js} +1 -1
- package/dist/public/assets/agent-connections-D6YhmKlS.js +1 -0
- package/dist/public/assets/{agent-registry-DoeDgmSS.js → agent-registry-BdHe0AEQ.js} +1 -1
- package/dist/public/assets/badge-BIamhtRR.js +1 -0
- package/dist/public/assets/{bridge-BeevbgaB.js → bridge-BMIee44l.js} +1 -1
- package/dist/public/assets/{catalog-C1GEA-Va.js → catalog-CEXii1s5.js} +1 -1
- package/dist/public/assets/{client-version-CVbC_NDn.js → client-version-CCcGb1GY.js} +1 -1
- package/dist/public/assets/{comment-chips-bT3Pgeu8.js → comment-chips-Dlk_Uy8T.js} +1 -1
- package/dist/public/assets/{config-provider-4lMZjvv1.js → config-provider-DY_fun1v.js} +1 -1
- package/dist/public/assets/config-schema-zP71feeS.js +1 -0
- package/dist/public/assets/{css-color-to-hex-BRv_r6oZ.js → css-color-to-hex-Csde6-Qs.js} +1 -1
- package/dist/public/assets/{dist-BrKroYq_.js → dist-DjMGDcCv.js} +2 -2
- package/dist/public/assets/{doc-undo-manager-BKDHRnV-.js → doc-undo-manager-Dm2bBXP2.js} +1 -1
- package/dist/public/assets/field-controls-B49FSs4r.js +1 -0
- package/dist/public/assets/field-controls-DBnF9Har.js +6 -0
- package/dist/public/assets/globals-kLKgmkBv.css +1 -0
- package/dist/public/assets/{ime-composition-_BDVzXn4.js → ime-composition-DSJh5ynW.js} +1 -1
- package/dist/public/assets/index-kLtGZT70.js +2209 -0
- package/dist/public/assets/{lint-config-client-DRJNyM2s.js → lint-config-client-B249C1D2.js} +1 -1
- package/dist/public/assets/{lint-plugins-Dufc6pEn.js → lint-plugins-DH147HA7.js} +1 -1
- package/dist/public/assets/{markdown-lint-BuEapKhE.js → markdown-lint-BMeMGAz_.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-BQ4c4vDN.js → markdownlint-rule-browser-Bt2f856y.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-3JlvmWi7.js → pending-receive-nav-store-D2Wl34aG.js} +1 -1
- package/dist/public/assets/{preferred-session-events-Crz1K3Z-.js → preferred-session-events-C_8_bodB.js} +1 -1
- package/dist/public/assets/{progress-BK046Tty.js → progress-CdWJE0cw.js} +1 -1
- package/dist/public/assets/{reveal-editor-SLzwvD1I.js → reveal-editor-ChTC5Vss.js} +1 -1
- package/dist/public/assets/saved-themes-client-DFijgxrT.js +1 -0
- package/dist/public/assets/{schema-section-CalUQFIh.js → schema-section-BHt16UFk.js} +1 -1
- package/dist/public/assets/{schemas-api-CD98jV86.js → schemas-api-CL5ZXlEj.js} +4 -4
- package/dist/public/assets/{selection-context-BbfG0HO9.js → selection-context-DYlfZmRT.js} +1 -1
- package/dist/public/assets/{skills-api-zXSg3eSX.js → skills-api-CCijBzjo.js} +1 -1
- package/dist/public/assets/{src-D_7G4loI.js → src-Ca8kxD9e.js} +1 -1
- package/dist/public/assets/storage-scope-GPc8n3Ml.js +1 -0
- package/dist/public/assets/{tag-pill-input-D6mNhknm.js → tag-pill-input-qgfgpKpV.js} +1 -1
- package/dist/public/assets/{telemetry-impl-C8ZWEJkv.js → telemetry-impl-BHjyIgsL.js} +1 -1
- package/dist/public/assets/{telemetry-startup-DNrsQYjz.js → telemetry-startup-BBS84TAP.js} +1 -1
- package/dist/public/assets/{terminal-launch-events-BhFGIVo_.js → terminal-launch-events-3vnER_eI.js} +1 -1
- package/dist/public/assets/typing-burst-detector-DjSPAHC0.js +8 -0
- package/dist/public/assets/{uninstall-DFTOzPT_.js → uninstall-Is26Mh1k.js} +1 -1
- package/dist/public/assets/{use-activity-panel-D5VDwOQt.js → use-activity-panel-BNET4arK.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-hiddt1uL.js → use-apply-config-color-theme-Bpi7AD0s.js} +2 -2
- package/dist/public/assets/{use-conflicts-BAjZ5TAV.js → use-conflicts-CIjDyM9c.js} +1 -1
- package/dist/public/assets/use-installed-clis-BTrIR9--.js +2 -0
- package/dist/public/assets/{use-live-xterm-theme-C1wLG0Im.js → use-live-xterm-theme-BJbDRXxo.js} +1 -1
- package/dist/public/assets/{use-open-skill-CFZd4B8h.js → use-open-skill-DbYpOsHm.js} +1 -1
- package/dist/public/assets/{use-semantic-search-status-CRj98qO1.js → use-semantic-search-status-7_z6UOU1.js} +1 -1
- package/dist/public/assets/{use-skill-origin-BAc45a3e.js → use-skill-origin-B9YRoKsz.js} +1 -1
- package/dist/public/assets/{use-skill-targets-DIBQkXNG.js → use-skill-targets-DZmqRDS7.js} +1 -1
- package/dist/public/assets/{use-skills-B2fLFrq6.js → use-skills-CkvdjORj.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-B51ji6oG.js → use-terminal-enabled-BSpJ-tlQ.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-B6Z6EtU2.js → use-timeline-entry-diff-ndwvvpVg.js} +1 -1
- package/dist/public/assets/{use-workspace-Bgh-YT5K.js → use-workspace-h2j0Puyv.js} +1 -1
- package/dist/public/index.html +55 -55
- package/dist/public/uninstall.html +4 -4
- package/dist/{registry-probes-DPKKrRUM.mjs → registry-probes-vIdTG_Zj.mjs} +1 -1
- package/dist/{removal-file-path-Bxa6y1-K.mjs → removal-file-path-B4b_lrPp.mjs} +1 -1
- package/dist/{repair-launch-json-GQqTV6X4.mjs → repair-launch-json-N6361aUT.mjs} +1 -1
- package/dist/{repair-mcp-configs-CZ1wHZDY.mjs → repair-mcp-configs-B68Xkqv7.mjs} +1 -1
- package/dist/src-DDe9AS2s.mjs +1 -0
- package/dist/{src-DZwvkGg3.mjs → src-f-qHxbxU.mjs} +1 -1
- package/dist/{start-DGllIRmH.mjs → start-BoUYvOQO.mjs} +3 -3
- package/dist/start-tvNfnwWU.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-CKiX5Z0-.mjs +0 -1
- package/dist/dist-CJAnJkM1.mjs +0 -2213
- package/dist/init-BSBhjVTS.mjs +0 -1
- package/dist/loader-vXeyPd6b.mjs +0 -1
- package/dist/preview-Cvm5I8jO.mjs +0 -1
- package/dist/public/assets/ActivityModeContent-fbqWmmqu.js +0 -1
- package/dist/public/assets/AgentConnectionsSection-DhbJCdHu.js +0 -1
- package/dist/public/assets/AuthModal-DT32BOAJ.js +0 -3
- package/dist/public/assets/FeedbackForm-DTSn-xTq.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-BNV1pKhc.js +0 -1
- package/dist/public/assets/McpConsentDialogBody-BwguVGDQ.js +0 -1
- package/dist/public/assets/ReportBugDialogBody-J5o6Nxwn.js +0 -3
- package/dist/public/assets/ReportBugMenuTrigger-CAUKQKXn.js +0 -1
- package/dist/public/assets/SchemaConfigEditor-CHGUkiVe.js +0 -1
- package/dist/public/assets/SessionsHost-DQ1ys2Oj.js +0 -2
- package/dist/public/assets/SkillCostValue-DBT6aDG-.js +0 -1
- package/dist/public/assets/SyncStatusBadge-uu4Is4Gu.js +0 -1
- package/dist/public/assets/ThemePluginSection-McKmY5If.js +0 -6
- package/dist/public/assets/ThreadView-OBNSZb0r.js +0 -28
- package/dist/public/assets/agent-connections-DSKODCmO.js +0 -1
- package/dist/public/assets/badge-DmdA1C7r.js +0 -1
- package/dist/public/assets/config-schema-CIaXsCAX.js +0 -1
- package/dist/public/assets/field-controls-CCcf2ybM.js +0 -1
- package/dist/public/assets/field-controls-CKb1JSHS.js +0 -6
- package/dist/public/assets/globals-Cr0S8PDH.css +0 -1
- package/dist/public/assets/index-xygm6gU4.js +0 -2209
- package/dist/public/assets/saved-themes-client-D09wxYQm.js +0 -1
- package/dist/public/assets/storage-scope-ldi41iCU.js +0 -1
- package/dist/public/assets/typing-burst-detector-DQWG6VAz.js +0 -8
- package/dist/public/assets/use-installed-clis-BopBqnEZ.js +0 -2
- package/dist/src-DJMiqowA.mjs +0 -1
- package/dist/start-BAXRLMKN.mjs +0 -1
- /package/dist/public/assets/{globals-DHDe92Ga.js → globals-CcgTjZMO.js} +0 -0
|
@@ -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-uu4Is4Gu.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-4lMZjvv1.js";import{n as De}from"./use-git-sync-status-PkMYmN4D.js";import{t as Oe}from"./AuthModal-DT32BOAJ.js";import{t as v}from"./PublishToGitHubDialog-BCeR1wkm.js";import{t as ke}from"./skeleton-CrbF9ppq.js";import{n as Ae,t as je}from"./SettingsSectionHeader-DDNA1hrR.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};
|
|
@@ -0,0 +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-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,7 +1,7 @@
|
|
|
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{t as o}from"./alert-dialog-BA3e7-10.js";import{t as s}from"./button-DzgjsZzC.js";import{n as c}from"./dist-BGzUo_18.js";import{t as l}from"./dist-C_FzPxEX2.js";import{x as u}from"./documents-events-ddyuXdQl.js";import{$ as d,H as f,K as p,V as m,vt as h,yt as g}from"./schemas-api-
|
|
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{t as o}from"./alert-dialog-BA3e7-10.js";import{t as s}from"./button-DzgjsZzC.js";import{n as c}from"./dist-BGzUo_18.js";import{t as l}from"./dist-C_FzPxEX2.js";import{x as u}from"./documents-events-ddyuXdQl.js";import{$ as d,H as f,K as p,V as m,vt as h,yt as g}from"./schemas-api-CL5ZXlEj.js";import{t as _}from"./parse-api-error-CeEVOj25.js";import{a as v,h as y,r as b,t as x}from"./dropdown-menu-5XqyQTVx.js";import{n as S,t as ee}from"./file-plus-DKxOZh2k.js";import{n as C}from"./plus-zPnYzcqL.js";import{t as te}from"./trash-2-CchZ0T47.js";import{t as w}from"./x-DM2drskU.js";import{a as T,c as E,i as D,n as O,o as k,s as A,t as j}from"./dialog-BJEjKJjL.js";import{a as M,i as N,o as P,r as F,t as I}from"./field-DFJgKWGh.js";import{t as L}from"./input-BsFOyzfK.js";import{t as R}from"./textarea-DYYN2PV4.js";import{a as z,r as B,t as V}from"./folder-config-api-BDhEYA86.js";import{t as H}from"./DeleteConfirmationDialog-CUUTX6Ez.js";var U=a(),W=e(n(),1);function G(e){let t=(0,U.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,W.useState)(n),[a,o]=(0,W.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return u(()=>{o(J)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,W.useEffect)(s,c);let d;t[4]===e?d=t[5]:(d=()=>{if(e===null){i({status:`idle`});return}let t=!1;i({status:`loading`});let n=e?`?path=${encodeURIComponent(e)}`:``;return fetch(`/api/folder-config${n}`).then(q).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:l._({id:`_ci9Bj`})});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null,warnings:e.warnings??[],warningCodes:e.warningCodes??[]}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=d);let f;t[6]!==e||t[7]!==a?(f=[e,a],t[6]=e,t[7]=a,t[8]=f):f=t[8],(0,W.useEffect)(d,f);let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=()=>o(K),t[9]=p):p=t[9];let m;return t[10]===r?m=t[11]:(m={state:r,refresh:p},t[10]=r,t[11]=m),m}function K(e){return e+1}async function q(e){if(!e.ok){let t=await e.json().catch(ne);throw Error(_(t)??`HTTP ${e.status}`)}return e.json()}function ne(){return null}function J(e){return e+1}function Y(){let e=(0,U.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,W.useState)(t),[i,a]=(0,W.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>u(()=>{a(Z)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,W.useEffect)(o,s);let c;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(c=()=>{let e=!1;return r({status:`loading`}),fetch(`/api/templates`).then(re).then(t=>{if(e)return;let n=f.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:l._({id:`RLNIgv`})});return}r({status:`ready`,data:n.data})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let d;return e[4]===i?d=e[5]:(d=[i],e[4]=i,e[5]=d),(0,W.useEffect)(c,d),n}async function re(e){if(!e.ok){let t=await e.json().catch(X);throw Error(_(t)??`HTTP ${e.status}`)}return e.json()}function X(){return null}function Z(e){return e+1}var Q=t();function $(e){let t=(0,U.c)(16),{value:n,onChange:i,disabled:a,placeholder:o,rows:s}=e,c=a===void 0?!1:a,l=s===void 0?12:s,u=(0,W.useId)(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(r,{id:`3o3tur`}),t[0]=d):d=t[0];let f;t[1]===u?f=t[2]:(f=(0,Q.jsx)(P,{htmlFor:u,children:d}),t[1]=u,t[2]=f);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(F,{children:(0,Q.jsx)(r,{id:`5gr_ev`,values:{dateToken:`{{date}}`,userToken:`{{user}}`},components:{0:(0,Q.jsx)(`code`,{className:`font-mono`}),1:(0,Q.jsx)(`code`,{className:`font-mono`})}})}),t[3]=p):p=t[3];let m;t[4]===i?m=t[5]:(m=e=>i(e.target.value),t[4]=i,t[5]=m);let h;t[6]!==c||t[7]!==u||t[8]!==o||t[9]!==l||t[10]!==m||t[11]!==n?(h=(0,Q.jsx)(R,{id:u,value:n,onChange:m,disabled:c,rows:l,spellCheck:!1,placeholder:o,className:`font-mono text-xs leading-relaxed min-h-72`}),t[6]=c,t[7]=u,t[8]=o,t[9]=l,t[10]=m,t[11]=n,t[12]=h):h=t[12];let g;return t[13]!==f||t[14]!==h?(g=(0,Q.jsxs)(I,{children:[f,p,h]}),t[13]=f,t[14]=h,t[15]=g):g=t[15],g}function ie(e){return p(e).toLowerCase().replace(/(?:[^\p{L}\p{M}\p{N}]|\p{DI})+/gu,`-`).replace(/^-+|-+$/g,``)}function ae(e){let t={},n=e.title.trim();n&&(t.title=n);let r=e.description.trim();return r&&(t.description=r),t}var oe=0;function se(){return oe+=1,`prop-${oe}`}function ce(e){let{frontmatter:t,body:n}=h(e);if(t===``)return{type:``,properties:[],markdown:e};let r=[];for(let e of g(t).split(`
|
|
2
2
|
`)){if(e.trim()===``)continue;let t=e.indexOf(`:`);if((/^\s/.test(e)||t===-1)&&r.length>0){let t=r[r.length-1];t&&(t.value+=`\n${e}`);continue}t!==-1&&r.push({key:e.slice(0,t).trim(),value:e.slice(t+1).replace(/^ /,``)})}let i=``,a=[];for(let e of r){if(e.key===`type`&&i===``){i=e.value.trim();continue}a.push({id:se(),key:e.key,value:e.value})}return{type:i,properties:a,markdown:n}}function le(e){let t=[],n=e.type.trim();n&&t.push(`type: ${n}`);for(let n of e.properties){let e=n.key.trim();e===``||e===`type`||t.push(n.value===``?`${e}:`:`${e}: ${n.value}`)}if(t.length===0)return e.markdown.replace(/^\n+/,``);let r=e.markdown.startsWith(`
|
|
3
3
|
`)?e.markdown:`\n${e.markdown}`;return`---\n${t.join(`
|
|
4
|
-
`)}\n---\n${r}`}function ue(e){let t=(0,U.c)(55),{mode:n,folderPath:r,scope:i,initial:a,existingNames:o,onCommitted:s}=e,u=i===void 0?`local`:i,[f,h]=(0,W.useState)(a.title),[g,_]=(0,W.useState)(a.name),[v,y]=(0,W.useState)(a.description),b;t[0]===a.body?b=t[1]:(b=()=>ce(a.body),t[0]=a.body,t[1]=b);let x=(0,W.useState)(b)[0],[S,ee]=(0,W.useState)(x.type),[C,te]=(0,W.useState)(x.properties),[w,T]=(0,W.useState)(x.markdown),[E,D]=(0,W.useState)(!1),[O,k]=(0,W.useState)(!1),[A,j]=(0,W.useState)(!1),M;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e,t){te(n=>n.map(n=>n.id===e?{...n,...t}:n))},t[2]=M):M=t[2];let N=M,P;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(){te(de)},t[3]=P):P=t[3];let F=P,I;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){te(t=>t.filter(t=>t.id!==e))},t[4]=I):I=t[4];let L=I,R;t[5]!==n||t[6]!==O?(R=function(e){h(e),n===`create`&&!O&&_(ie(e))},t[5]=n,t[6]=O,t[7]=R):R=t[7];let V=R,H;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){_(e),k(!0)},t[8]=H):H=t[8];let G=H,K=n===`edit`&&u===`local`,q=n===`create`||K,ne;t[9]===f?ne=t[10]:(ne=f.trim(),t[9]=f,t[10]=ne);let J=ne,Y,re,X,Z;t[11]!==o||t[12]!==n||t[13]!==g||t[14]!==q||t[15]!==J?(Z=p(g.trim()),X=J===``,Y=q&&(Z===``||!m.test(Z)),re=n===`create`&&!Y&&(o?.has(Z)??!1),t[11]=o,t[12]=n,t[13]=g,t[14]=q,t[15]=J,t[16]=Y,t[17]=re,t[18]=X,t[19]=Z):(Y=t[16],re=t[17],X=t[18],Z=t[19]);let Q=re,$=!E&&!X&&!Y,oe;t[20]!==w||t[21]!==K||t[22]!==$||t[23]!==v||t[24]!==r||t[25]!==a.name||t[26]!==n||t[27]!==s||t[28]!==C||t[29]!==g||t[30]!==f||t[31]!==Z||t[32]!==J||t[33]!==S?(oe=async function(){if(!$){j(!0);return}D(!0);let e=ae({title:f,description:v}),t=le({type:S,properties:C,markdown:w}),i=K&&d(a.name,g)!==null,o=i?await B({fromFolder:r,fromName:a.name,toFolder:r,toName:Z,frontmatter:e,body:t}):await z({folder:r,name:n===`create`?Z:a.name,frontmatter:e,body:t});if(D(!1),!o.ok){let{error:e}=o;c.error(n===`create`?l._({id:`jdGUeI`,values:{error:e}}):l._({id:`rQAQus`,values:{error:e}}));return}i?c.success(l._({id:`YKLP_-`})):`warnings`in o&&o.warnings.length>0?c.warning(o.warnings.join(` `)):n===`create`?c.success(l._({id:`06SZfb`,values:{trimmedTitle:J}})):c.success(l._({id:`GamjcN`})),s(n===`create`||i?Z:a.name)},t[20]=w,t[21]=K,t[22]=$,t[23]=v,t[24]=r,t[25]=a.name,t[26]=n,t[27]=s,t[28]=C,t[29]=g,t[30]=f,t[31]=Z,t[32]=J,t[33]=S,t[34]=oe):oe=t[34];let se=oe,ue;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>j(!0),t[35]=ue):ue=t[35];let fe;return t[36]!==w||t[37]!==K||t[38]!==$||t[39]!==v||t[40]!==a.name||t[41]!==n||t[42]!==C||t[43]!==E||t[44]!==V||t[45]!==g||t[46]!==Y||t[47]!==Q||t[48]!==se||t[49]!==f||t[50]!==X||t[51]!==A||t[52]!==Z||t[53]!==S?(fe={mode:n,title:f,slug:g,description:v,type:S,properties:C,body:w,setTitle:V,setSlug:G,setDescription:y,setType:ee,setProperty:N,addProperty:F,removeProperty:L,setBody:T,markTitleTouched:ue,titleTouched:A,isSaving:E,canSubmit:$,titleInvalid:X,slugInvalid:Y,slugShadows:Q,trimmedSlug:Z,fixedName:a.name,canRename:K,submit:se},t[36]=w,t[37]=K,t[38]=$,t[39]=v,t[40]=a.name,t[41]=n,t[42]=C,t[43]=E,t[44]=V,t[45]=g,t[46]=Y,t[47]=Q,t[48]=se,t[49]=f,t[50]=X,t[51]=A,t[52]=Z,t[53]=S,t[54]=fe):fe=t[54],fe}function de(e){return[...e,{id:se(),key:``,value:``}]}function fe(e){let t=(0,U.c)(72),{form:n,bodyPlaceholder:a}=e,{_:o}=i(),s=(0,W.useId)(),c=(0,W.useId)(),l=(0,W.useId)(),u=n.titleTouched&&n.titleInvalid,{fixedName:d}=n,f,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(r,{id:`MHrjPM`}),p=(0,Q.jsx)(`span`,{className:`text-destructive`,children:`*`}),t[0]=f,t[1]=p):(f=t[0],p=t[1]);let m;t[2]===s?m=t[3]:(m=(0,Q.jsxs)(P,{htmlFor:s,children:[f,p]}),t[2]=s,t[3]=m);let h=n.title,g;t[4]===n?g=t[5]:(g=e=>n.setTitle(e.target.value),t[4]=n,t[5]=g);let _=n.markTitleTouched,v;t[6]===o?v=t[7]:(v=o({id:`KWL_Ih`}),t[6]=o,t[7]=v);let y;t[8]!==n.isSaving||t[9]!==n.markTitleTouched||t[10]!==n.title||t[11]!==s||t[12]!==u||t[13]!==g||t[14]!==v?(y=(0,Q.jsx)(L,{id:s,"data-testid":`template-name-input`,value:h,onChange:g,onBlur:_,placeholder:v,disabled:n.isSaving,"aria-invalid":u}),t[8]=n.isSaving,t[9]=n.markTitleTouched,t[10]=n.title,t[11]=s,t[12]=u,t[13]=g,t[14]=v,t[15]=y):y=t[15];let b;t[16]===u?b=t[17]:(b=u?(0,Q.jsx)(N,{children:(0,Q.jsx)(r,{id:`V_wltx`})}):null,t[16]=u,t[17]=b);let x;t[18]!==m||t[19]!==y||t[20]!==b?(x=(0,Q.jsxs)(I,{children:[m,y,b]}),t[18]=m,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]!==d||t[23]!==n?(S=n.mode===`create`?(0,Q.jsx)(me,{form:n}):n.canRename?(0,Q.jsx)(he,{form:n}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Q.jsx)(r,{id:`NjrIak`,values:{fixedName:d},components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Q.jsx)(r,{id:`jSO1X5`})})]}),t[22]=d,t[23]=n,t[24]=S):S=t[24];let ee;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(r,{id:`Nu4oKW`}),t[25]=ee):ee=t[25];let C;t[26]===c?C=t[27]:(C=(0,Q.jsx)(P,{htmlFor:c,children:ee}),t[26]=c,t[27]=C);let te=n.description,w;t[28]===n?w=t[29]:(w=e=>n.setDescription(e.target.value),t[28]=n,t[29]=w);let T;t[30]===o?T=t[31]:(T=o({id:`3FMvls`}),t[30]=o,t[31]=T);let E;t[32]!==c||t[33]!==n.description||t[34]!==n.isSaving||t[35]!==w||t[36]!==T?(E=(0,Q.jsx)(R,{id:c,value:te,onChange:w,placeholder:T,disabled:n.isSaving,rows:2}),t[32]=c,t[33]=n.description,t[34]=n.isSaving,t[35]=w,t[36]=T,t[37]=E):E=t[37];let D;t[38]!==C||t[39]!==E?(D=(0,Q.jsxs)(I,{children:[C,E]}),t[38]=C,t[39]=E,t[40]=D):D=t[40];let O;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(r,{id:`-zy2Nq`}),t[41]=O):O=t[41];let k;t[42]===l?k=t[43]:(k=(0,Q.jsx)(P,{htmlFor:l,children:O}),t[42]=l,t[43]=k);let A=n.type,j;t[44]===n?j=t[45]:(j=e=>n.setType(e.target.value),t[44]=n,t[45]=j);let z;t[46]===o?z=t[47]:(z=o({id:`o9CrsQ`}),t[46]=o,t[47]=z);let B;t[48]!==n.isSaving||t[49]!==n.type||t[50]!==j||t[51]!==z||t[52]!==l?(B=(0,Q.jsx)(L,{id:l,value:A,onChange:j,placeholder:z,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`font-mono`}),t[48]=n.isSaving,t[49]=n.type,t[50]=j,t[51]=z,t[52]=l,t[53]=B):B=t[53];let V;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(F,{children:(0,Q.jsx)(r,{id:`ipn17C`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`}),1:(0,Q.jsx)(`code`,{className:`font-mono`})}})}),t[54]=V):V=t[54];let H;t[55]!==k||t[56]!==B?(H=(0,Q.jsxs)(I,{children:[k,B,V]}),t[55]=k,t[56]=B,t[57]=H):H=t[57];let G;t[58]===n?G=t[59]:(G=(0,Q.jsx)(pe,{form:n}),t[58]=n,t[59]=G);let K;t[60]!==a||t[61]!==n.body||t[62]!==n.isSaving||t[63]!==n.setBody?(K=(0,Q.jsx)($,{value:n.body,onChange:n.setBody,disabled:n.isSaving,placeholder:a}),t[60]=a,t[61]=n.body,t[62]=n.isSaving,t[63]=n.setBody,t[64]=K):K=t[64];let q;return t[65]!==x||t[66]!==S||t[67]!==D||t[68]!==H||t[69]!==G||t[70]!==K?(q=(0,Q.jsxs)(M,{children:[x,S,D,H,G,K]}),t[65]=x,t[66]=S,t[67]=D,t[68]=H,t[69]=G,t[70]=K,t[71]=q):q=t[71],q}function pe(e){let t=(0,U.c)(12),{form:n}=e,{_:a}=i(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(P,{children:(0,Q.jsx)(r,{id:`-WFFG2`})}),t[0]=o):o=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(F,{children:(0,Q.jsx)(r,{id:`zrP8HX`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`}),1:(0,Q.jsx)(`code`,{className:`font-mono`})}})}),t[1]=c):c=t[1];let l;t[2]!==a||t[3]!==n?(l=n.properties.length>0?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.properties.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(L,{"aria-label":a({id:`56xUL1`}),value:e.key,onChange:t=>n.setProperty(e.id,{key:t.target.value}),placeholder:a({id:`Aq-O0x`}),disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`font-mono w-1/3`}),(0,Q.jsx)(L,{"aria-label":a({id:`iKZkk1`}),value:e.value,onChange:t=>n.setProperty(e.id,{value:t.target.value}),placeholder:a({id:`jEZ6Lf`}),disabled:n.isSaving,spellCheck:!1,className:`font-mono flex-1`}),(0,Q.jsx)(s,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a({id:`rNifQd`}),onClick:()=>n.removeProperty(e.id),disabled:n.isSaving,children:(0,Q.jsx)(w,{"aria-hidden":`true`})})]},e.id))}):null,t[2]=a,t[3]=n,t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(r,{id:`F-NRCj`}),t[5]=u):u=t[5];let d;t[6]!==n.addProperty||t[7]!==n.isSaving?(d=(0,Q.jsx)(s,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,onClick:n.addProperty,disabled:n.isSaving,children:u}),t[6]=n.addProperty,t[7]=n.isSaving,t[8]=d):d=t[8];let f;return t[9]!==l||t[10]!==d?(f=(0,Q.jsxs)(I,{children:[o,c,l,d]}),t[9]=l,t[10]=d,t[11]=f):f=t[11],f}function me(e){let t=(0,U.c)(34),{form:n}=e,{_:a}=i(),o=(0,W.useId)(),[c,l]=(0,W.useState)(!1),u=c||n.titleTouched&&(n.slugInvalid||n.slugShadows),{slug:d,trimmedSlug:f}=n;if(!u){if(f===``)return null;let e;t[0]===d?e=t[1]:(e={slug:d},t[0]=d,t[1]=e);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,Q.jsx)(`code`,{className:`font-mono`})},t[2]=i):i=t[2];let a;t[3]===e?a=t[4]:(a=(0,Q.jsx)(r,{id:`Pgu10b`,values:e,components:i}),t[3]=e,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>l(!0),t[5]=o):o=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(r,{id:`ePK91l`}),t[6]=c):c=t[6];let u;t[7]===n.isSaving?u=t[8]:(u=(0,Q.jsx)(s,{type:`button`,variant:`link`,className:`h-auto p-0 align-baseline text-xs font-mono uppercase`,onClick:o,disabled:n.isSaving,children:c}),t[7]=n.isSaving,t[8]=u);let p;return t[9]!==a||t[10]!==u?(p=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[a,` `,u]}),t[9]=a,t[10]=u,t[11]=p):p=t[11],p}let p;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(r,{id:`GN6L5F`}),t[12]=p):p=t[12];let m;t[13]===o?m=t[14]:(m=(0,Q.jsx)(P,{htmlFor:o,children:p}),t[13]=o,t[14]=m);let h;t[15]===n?h=t[16]:(h=e=>n.setSlug(e.target.value),t[15]=n,t[16]=h);let g;t[17]===a?g=t[18]:(g=a({id:`tjXez2`}),t[17]=a,t[18]=g);let _;t[19]!==n.isSaving||t[20]!==n.slugInvalid||t[21]!==d||t[22]!==o||t[23]!==h||t[24]!==g?(_=(0,Q.jsx)(L,{id:o,value:d,onChange:h,placeholder:g,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":n.slugInvalid,className:`font-mono`}),t[19]=n.isSaving,t[20]=n.slugInvalid,t[21]=d,t[22]=o,t[23]=h,t[24]=g,t[25]=_):_=t[25];let v;t[26]!==n.slugInvalid||t[27]!==n.slugShadows||t[28]!==f?(v=n.slugInvalid?(0,Q.jsx)(N,{children:(0,Q.jsx)(r,{id:`l_FAT6`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`}),1:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):n.slugShadows?(0,Q.jsx)(F,{className:`text-yellow-600 dark:text-yellow-500`,children:(0,Q.jsx)(r,{id:`jwnpdM`,values:{trimmedSlug:f},components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):(0,Q.jsx)(F,{children:(0,Q.jsx)(r,{id:`TsZmgr`})}),t[26]=n.slugInvalid,t[27]=n.slugShadows,t[28]=f,t[29]=v):v=t[29];let y;return t[30]!==m||t[31]!==_||t[32]!==v?(y=(0,Q.jsxs)(I,{children:[m,_,v]}),t[30]=m,t[31]=_,t[32]=v,t[33]=y):y=t[33],y}function he(e){let t=(0,U.c)(20),{form:n}=e,{_:a}=i(),o=(0,W.useId)(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(r,{id:`GN6L5F`}),t[0]=s):s=t[0];let c;t[1]===o?c=t[2]:(c=(0,Q.jsx)(P,{htmlFor:o,children:s}),t[1]=o,t[2]=c);let l=n.slug,u;t[3]===n?u=t[4]:(u=e=>n.setSlug(e.target.value),t[3]=n,t[4]=u);let d;t[5]===a?d=t[6]:(d=a({id:`tjXez2`}),t[5]=a,t[6]=d);let f;t[7]!==n.isSaving||t[8]!==n.slug||t[9]!==n.slugInvalid||t[10]!==o||t[11]!==u||t[12]!==d?(f=(0,Q.jsx)(L,{id:o,value:l,onChange:u,placeholder:d,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":n.slugInvalid,className:`font-mono`}),t[7]=n.isSaving,t[8]=n.slug,t[9]=n.slugInvalid,t[10]=o,t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]===n.slugInvalid?p=t[15]:(p=n.slugInvalid?(0,Q.jsx)(N,{children:(0,Q.jsx)(r,{id:`l_FAT6`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`}),1:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):(0,Q.jsx)(F,{children:(0,Q.jsx)(r,{id:`FvMSms`})}),t[14]=n.slugInvalid,t[15]=p);let m;return t[16]!==c||t[17]!==f||t[18]!==p?(m=(0,Q.jsxs)(I,{children:[c,f,p]}),t[16]=c,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}var ge={name:``,title:``,description:``,body:``},_e=`## Overview
|
|
4
|
+
`)}\n---\n${r}`}function ue(e){let t=(0,U.c)(55),{mode:n,folderPath:r,scope:i,initial:a,existingNames:o,onCommitted:s}=e,u=i===void 0?`local`:i,[f,h]=(0,W.useState)(a.title),[g,_]=(0,W.useState)(a.name),[v,y]=(0,W.useState)(a.description),b;t[0]===a.body?b=t[1]:(b=()=>ce(a.body),t[0]=a.body,t[1]=b);let x=(0,W.useState)(b)[0],[S,ee]=(0,W.useState)(x.type),[C,te]=(0,W.useState)(x.properties),[w,T]=(0,W.useState)(x.markdown),[E,D]=(0,W.useState)(!1),[O,k]=(0,W.useState)(!1),[A,j]=(0,W.useState)(!1),M;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e,t){te(n=>n.map(n=>n.id===e?{...n,...t}:n))},t[2]=M):M=t[2];let N=M,P;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(){te(de)},t[3]=P):P=t[3];let F=P,I;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(I=function(e){te(t=>t.filter(t=>t.id!==e))},t[4]=I):I=t[4];let L=I,R;t[5]!==n||t[6]!==O?(R=function(e){h(e),n===`create`&&!O&&_(ie(e))},t[5]=n,t[6]=O,t[7]=R):R=t[7];let V=R,H;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){_(e),k(!0)},t[8]=H):H=t[8];let G=H,K=n===`edit`&&u===`local`,q=n===`create`||K,ne;t[9]===f?ne=t[10]:(ne=f.trim(),t[9]=f,t[10]=ne);let J=ne,Y,re,X,Z;t[11]!==o||t[12]!==n||t[13]!==g||t[14]!==q||t[15]!==J?(Z=p(g.trim()),X=J===``,Y=q&&(Z===``||!m.test(Z)),re=n===`create`&&!Y&&(o?.has(Z)??!1),t[11]=o,t[12]=n,t[13]=g,t[14]=q,t[15]=J,t[16]=Y,t[17]=re,t[18]=X,t[19]=Z):(Y=t[16],re=t[17],X=t[18],Z=t[19]);let Q=re,$=!E&&!X&&!Y,oe;t[20]!==w||t[21]!==K||t[22]!==$||t[23]!==v||t[24]!==r||t[25]!==a.name||t[26]!==n||t[27]!==s||t[28]!==C||t[29]!==g||t[30]!==f||t[31]!==Z||t[32]!==J||t[33]!==S?(oe=async function(){if(!$){j(!0);return}D(!0);let e=ae({title:f,description:v}),t=le({type:S,properties:C,markdown:w}),i=K&&d(a.name,g)!==null,o=i?await B({fromFolder:r,fromName:a.name,toFolder:r,toName:Z,frontmatter:e,body:t}):await z({folder:r,name:n===`create`?Z:a.name,frontmatter:e,body:t});if(D(!1),!o.ok){let{error:e}=o;c.error(n===`create`?l._({id:`jdGUeI`,values:{error:e}}):l._({id:`rQAQus`,values:{error:e}}));return}i?c.success(l._({id:`YKLP_-`})):`warnings`in o&&o.warnings.length>0?c.warning(o.warnings.join(` `)):n===`create`?c.success(l._({id:`06SZfb`,values:{trimmedTitle:J}})):c.success(l._({id:`GamjcN`})),s(n===`create`||i?Z:a.name)},t[20]=w,t[21]=K,t[22]=$,t[23]=v,t[24]=r,t[25]=a.name,t[26]=n,t[27]=s,t[28]=C,t[29]=g,t[30]=f,t[31]=Z,t[32]=J,t[33]=S,t[34]=oe):oe=t[34];let se=oe,ue;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(ue=()=>j(!0),t[35]=ue):ue=t[35];let fe;return t[36]!==w||t[37]!==K||t[38]!==$||t[39]!==v||t[40]!==a.name||t[41]!==n||t[42]!==C||t[43]!==E||t[44]!==V||t[45]!==g||t[46]!==Y||t[47]!==Q||t[48]!==se||t[49]!==f||t[50]!==X||t[51]!==A||t[52]!==Z||t[53]!==S?(fe={mode:n,title:f,slug:g,description:v,type:S,properties:C,body:w,setTitle:V,setSlug:G,setDescription:y,setType:ee,setProperty:N,addProperty:F,removeProperty:L,setBody:T,markTitleTouched:ue,titleTouched:A,isSaving:E,canSubmit:$,titleInvalid:X,slugInvalid:Y,slugShadows:Q,trimmedSlug:Z,fixedName:a.name,canRename:K,submit:se},t[36]=w,t[37]=K,t[38]=$,t[39]=v,t[40]=a.name,t[41]=n,t[42]=C,t[43]=E,t[44]=V,t[45]=g,t[46]=Y,t[47]=Q,t[48]=se,t[49]=f,t[50]=X,t[51]=A,t[52]=Z,t[53]=S,t[54]=fe):fe=t[54],fe}function de(e){return[...e,{id:se(),key:``,value:``}]}function fe(e){let t=(0,U.c)(72),{form:n,bodyPlaceholder:a}=e,{_:o}=i(),s=(0,W.useId)(),c=(0,W.useId)(),l=(0,W.useId)(),u=n.titleTouched&&n.titleInvalid,{fixedName:d}=n,f,p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsx)(r,{id:`MHrjPM`}),p=(0,Q.jsx)(`span`,{className:`text-destructive`,children:`*`}),t[0]=f,t[1]=p):(f=t[0],p=t[1]);let m;t[2]===s?m=t[3]:(m=(0,Q.jsxs)(P,{htmlFor:s,children:[f,p]}),t[2]=s,t[3]=m);let h=n.title,g;t[4]===n?g=t[5]:(g=e=>n.setTitle(e.target.value),t[4]=n,t[5]=g);let _=n.markTitleTouched,v;t[6]===o?v=t[7]:(v=o({id:`KWL_Ih`}),t[6]=o,t[7]=v);let y;t[8]!==n.isSaving||t[9]!==n.markTitleTouched||t[10]!==n.title||t[11]!==s||t[12]!==u||t[13]!==g||t[14]!==v?(y=(0,Q.jsx)(L,{id:s,"data-testid":`template-name-input`,value:h,onChange:g,onBlur:_,placeholder:v,disabled:n.isSaving,"aria-invalid":u}),t[8]=n.isSaving,t[9]=n.markTitleTouched,t[10]=n.title,t[11]=s,t[12]=u,t[13]=g,t[14]=v,t[15]=y):y=t[15];let b;t[16]===u?b=t[17]:(b=u?(0,Q.jsx)(N,{children:(0,Q.jsx)(r,{id:`V_wltx`})}):null,t[16]=u,t[17]=b);let x;t[18]!==m||t[19]!==y||t[20]!==b?(x=(0,Q.jsxs)(I,{children:[m,y,b]}),t[18]=m,t[19]=y,t[20]=b,t[21]=x):x=t[21];let S;t[22]!==d||t[23]!==n?(S=n.mode===`create`?(0,Q.jsx)(me,{form:n}):n.canRename?(0,Q.jsx)(he,{form:n}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Q.jsx)(r,{id:`NjrIak`,values:{fixedName:d},components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}),(0,Q.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,Q.jsx)(r,{id:`jSO1X5`})})]}),t[22]=d,t[23]=n,t[24]=S):S=t[24];let ee;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(r,{id:`Nu4oKW`}),t[25]=ee):ee=t[25];let C;t[26]===c?C=t[27]:(C=(0,Q.jsx)(P,{htmlFor:c,children:ee}),t[26]=c,t[27]=C);let te=n.description,w;t[28]===n?w=t[29]:(w=e=>n.setDescription(e.target.value),t[28]=n,t[29]=w);let T;t[30]===o?T=t[31]:(T=o({id:`3FMvls`}),t[30]=o,t[31]=T);let E;t[32]!==c||t[33]!==n.description||t[34]!==n.isSaving||t[35]!==w||t[36]!==T?(E=(0,Q.jsx)(R,{id:c,value:te,onChange:w,placeholder:T,disabled:n.isSaving,rows:2}),t[32]=c,t[33]=n.description,t[34]=n.isSaving,t[35]=w,t[36]=T,t[37]=E):E=t[37];let D;t[38]!==C||t[39]!==E?(D=(0,Q.jsxs)(I,{children:[C,E]}),t[38]=C,t[39]=E,t[40]=D):D=t[40];let O;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,Q.jsx)(r,{id:`-zy2Nq`}),t[41]=O):O=t[41];let k;t[42]===l?k=t[43]:(k=(0,Q.jsx)(P,{htmlFor:l,children:O}),t[42]=l,t[43]=k);let A=n.type,j;t[44]===n?j=t[45]:(j=e=>n.setType(e.target.value),t[44]=n,t[45]=j);let z;t[46]===o?z=t[47]:(z=o({id:`o9CrsQ`}),t[46]=o,t[47]=z);let B;t[48]!==n.isSaving||t[49]!==n.type||t[50]!==j||t[51]!==z||t[52]!==l?(B=(0,Q.jsx)(L,{id:l,value:A,onChange:j,placeholder:z,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`font-mono`}),t[48]=n.isSaving,t[49]=n.type,t[50]=j,t[51]=z,t[52]=l,t[53]=B):B=t[53];let V;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(V=(0,Q.jsx)(F,{children:(0,Q.jsx)(r,{id:`ipn17C`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`}),1:(0,Q.jsx)(`code`,{className:`font-mono`})}})}),t[54]=V):V=t[54];let H;t[55]!==k||t[56]!==B?(H=(0,Q.jsxs)(I,{children:[k,B,V]}),t[55]=k,t[56]=B,t[57]=H):H=t[57];let G;t[58]===n?G=t[59]:(G=(0,Q.jsx)(pe,{form:n}),t[58]=n,t[59]=G);let K;t[60]!==a||t[61]!==n.body||t[62]!==n.isSaving||t[63]!==n.setBody?(K=(0,Q.jsx)($,{value:n.body,onChange:n.setBody,disabled:n.isSaving,placeholder:a}),t[60]=a,t[61]=n.body,t[62]=n.isSaving,t[63]=n.setBody,t[64]=K):K=t[64];let q;return t[65]!==x||t[66]!==S||t[67]!==D||t[68]!==H||t[69]!==G||t[70]!==K?(q=(0,Q.jsxs)(M,{children:[x,S,D,H,G,K]}),t[65]=x,t[66]=S,t[67]=D,t[68]=H,t[69]=G,t[70]=K,t[71]=q):q=t[71],q}function pe(e){let t=(0,U.c)(12),{form:n}=e,{_:a}=i(),o;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(P,{children:(0,Q.jsx)(r,{id:`-WFFG2`})}),t[0]=o):o=t[0];let c;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(F,{children:(0,Q.jsx)(r,{id:`zrP8HX`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`}),1:(0,Q.jsx)(`code`,{className:`font-mono`})}})}),t[1]=c):c=t[1];let l;t[2]!==a||t[3]!==n?(l=n.properties.length>0?(0,Q.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.properties.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(L,{"aria-label":a({id:`56xUL1`}),value:e.key,onChange:t=>n.setProperty(e.id,{key:t.target.value}),placeholder:a({id:`Aq-O0x`}),disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,className:`font-mono w-1/3`}),(0,Q.jsx)(L,{"aria-label":a({id:`iKZkk1`}),value:e.value,onChange:t=>n.setProperty(e.id,{value:t.target.value}),placeholder:a({id:`jEZ6Lf`}),disabled:n.isSaving,spellCheck:!1,className:`font-mono flex-1`}),(0,Q.jsx)(s,{type:`button`,variant:`ghost`,size:`icon`,"aria-label":a({id:`rNifQd`}),onClick:()=>n.removeProperty(e.id),disabled:n.isSaving,children:(0,Q.jsx)(w,{"aria-hidden":`true`})})]},e.id))}):null,t[2]=a,t[3]=n,t[4]=l):l=t[4];let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=(0,Q.jsx)(r,{id:`F-NRCj`}),t[5]=u):u=t[5];let d;t[6]!==n.addProperty||t[7]!==n.isSaving?(d=(0,Q.jsx)(s,{type:`button`,variant:`outline`,size:`sm`,className:`self-start`,onClick:n.addProperty,disabled:n.isSaving,children:u}),t[6]=n.addProperty,t[7]=n.isSaving,t[8]=d):d=t[8];let f;return t[9]!==l||t[10]!==d?(f=(0,Q.jsxs)(I,{children:[o,c,l,d]}),t[9]=l,t[10]=d,t[11]=f):f=t[11],f}function me(e){let t=(0,U.c)(34),{form:n}=e,{_:a}=i(),o=(0,W.useId)(),[c,l]=(0,W.useState)(!1),u=c||n.titleTouched&&(n.slugInvalid||n.slugShadows),{slug:d,trimmedSlug:f}=n;if(!u){if(f===``)return null;let e;t[0]===d?e=t[1]:(e={slug:d},t[0]=d,t[1]=e);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i={0:(0,Q.jsx)(`code`,{className:`font-mono`})},t[2]=i):i=t[2];let a;t[3]===e?a=t[4]:(a=(0,Q.jsx)(r,{id:`Pgu10b`,values:e,components:i}),t[3]=e,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>l(!0),t[5]=o):o=t[5];let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Q.jsx)(r,{id:`ePK91l`}),t[6]=c):c=t[6];let u;t[7]===n.isSaving?u=t[8]:(u=(0,Q.jsx)(s,{type:`button`,variant:`link`,className:`h-auto p-0 align-baseline text-xs font-mono uppercase`,onClick:o,disabled:n.isSaving,children:c}),t[7]=n.isSaving,t[8]=u);let p;return t[9]!==a||t[10]!==u?(p=(0,Q.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[a,` `,u]}),t[9]=a,t[10]=u,t[11]=p):p=t[11],p}let p;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsx)(r,{id:`GN6L5F`}),t[12]=p):p=t[12];let m;t[13]===o?m=t[14]:(m=(0,Q.jsx)(P,{htmlFor:o,children:p}),t[13]=o,t[14]=m);let h;t[15]===n?h=t[16]:(h=e=>n.setSlug(e.target.value),t[15]=n,t[16]=h);let g;t[17]===a?g=t[18]:(g=a({id:`tjXez2`}),t[17]=a,t[18]=g);let _;t[19]!==n.isSaving||t[20]!==n.slugInvalid||t[21]!==d||t[22]!==o||t[23]!==h||t[24]!==g?(_=(0,Q.jsx)(L,{id:o,value:d,onChange:h,placeholder:g,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":n.slugInvalid,className:`font-mono`}),t[19]=n.isSaving,t[20]=n.slugInvalid,t[21]=d,t[22]=o,t[23]=h,t[24]=g,t[25]=_):_=t[25];let v;t[26]!==n.slugInvalid||t[27]!==n.slugShadows||t[28]!==f?(v=n.slugInvalid?(0,Q.jsx)(N,{children:(0,Q.jsx)(r,{id:`l_FAT6`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`}),1:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):n.slugShadows?(0,Q.jsx)(F,{className:`text-warning`,children:(0,Q.jsx)(r,{id:`jwnpdM`,values:{trimmedSlug:f},components:{0:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):(0,Q.jsx)(F,{children:(0,Q.jsx)(r,{id:`TsZmgr`})}),t[26]=n.slugInvalid,t[27]=n.slugShadows,t[28]=f,t[29]=v):v=t[29];let y;return t[30]!==m||t[31]!==_||t[32]!==v?(y=(0,Q.jsxs)(I,{children:[m,_,v]}),t[30]=m,t[31]=_,t[32]=v,t[33]=y):y=t[33],y}function he(e){let t=(0,U.c)(20),{form:n}=e,{_:a}=i(),o=(0,W.useId)(),s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,Q.jsx)(r,{id:`GN6L5F`}),t[0]=s):s=t[0];let c;t[1]===o?c=t[2]:(c=(0,Q.jsx)(P,{htmlFor:o,children:s}),t[1]=o,t[2]=c);let l=n.slug,u;t[3]===n?u=t[4]:(u=e=>n.setSlug(e.target.value),t[3]=n,t[4]=u);let d;t[5]===a?d=t[6]:(d=a({id:`tjXez2`}),t[5]=a,t[6]=d);let f;t[7]!==n.isSaving||t[8]!==n.slug||t[9]!==n.slugInvalid||t[10]!==o||t[11]!==u||t[12]!==d?(f=(0,Q.jsx)(L,{id:o,value:l,onChange:u,placeholder:d,disabled:n.isSaving,spellCheck:!1,autoCapitalize:`off`,autoCorrect:`off`,"aria-invalid":n.slugInvalid,className:`font-mono`}),t[7]=n.isSaving,t[8]=n.slug,t[9]=n.slugInvalid,t[10]=o,t[11]=u,t[12]=d,t[13]=f):f=t[13];let p;t[14]===n.slugInvalid?p=t[15]:(p=n.slugInvalid?(0,Q.jsx)(N,{children:(0,Q.jsx)(r,{id:`l_FAT6`,components:{0:(0,Q.jsx)(`code`,{className:`font-mono`}),1:(0,Q.jsx)(`code`,{className:`font-mono`})}})}):(0,Q.jsx)(F,{children:(0,Q.jsx)(r,{id:`FvMSms`})}),t[14]=n.slugInvalid,t[15]=p);let m;return t[16]!==c||t[17]!==f||t[18]!==p?(m=(0,Q.jsxs)(I,{children:[c,f,p]}),t[16]=c,t[17]=f,t[18]=p,t[19]=m):m=t[19],m}var ge={name:``,title:``,description:``,body:``},_e=`## Overview
|
|
5
5
|
|
|
6
6
|
(Replace with the starting content for new documents.)
|
|
7
7
|
`;function ve(e){let t=(0,U.c)(12),{folderPath:n,existingNames:r,open:i,onOpenChange:a,onCreated:o}=e,s;t[0]!==r||t[1]!==n||t[2]!==o||t[3]!==a||t[4]!==i?(s=i?(0,Q.jsx)(ye,{folderPath:n,existingNames:r,onOpenChange:a,onCreated:o}):null,t[0]=r,t[1]=n,t[2]=o,t[3]=a,t[4]=i,t[5]=s):s=t[5];let c;t[6]===s?c=t[7]:(c=(0,Q.jsx)(D,{className:`sm:max-w-3xl max-h-[85vh] flex flex-col`,children:s}),t[6]=s,t[7]=c);let l;return t[8]!==a||t[9]!==i||t[10]!==c?(l=(0,Q.jsx)(j,{open:i,onOpenChange:a,children:c}),t[8]=a,t[9]=i,t[10]=c,t[11]=l):l=t[11],l}function ye(e){let t=(0,U.c)(31),{folderPath:n,existingNames:i,onOpenChange:a,onCreated:o}=e,c;t[0]!==o||t[1]!==a?(c=e=>{o(e),a(!1)},t[0]=o,t[1]=a,t[2]=c):c=t[2];let l;t[3]!==i||t[4]!==n||t[5]!==c?(l={mode:`create`,folderPath:n,initial:ge,existingNames:i,onCommitted:c},t[3]=i,t[4]=n,t[5]=c,t[6]=l):l=t[6];let u=ue(l),d;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,Q.jsx)(E,{children:(0,Q.jsx)(r,{id:`G1Gw0v`})}),t[7]=d):d=t[7];let f;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(f=(0,Q.jsxs)(A,{children:[d,(0,Q.jsx)(T,{children:(0,Q.jsx)(r,{id:`NUr4kz`})})]}),t[8]=f):f=t[8];let p;t[9]===u?p=t[10]:(p=(0,Q.jsx)(O,{children:(0,Q.jsx)(fe,{form:u,bodyPlaceholder:_e})}),t[9]=u,t[10]=p);let m;t[11]===a?m=t[12]:(m=()=>a(!1),t[11]=a,t[12]=m);let h;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(r,{id:`dEgA5A`}),t[13]=h):h=t[13];let g;t[14]!==u.isSaving||t[15]!==m?(g=(0,Q.jsx)(s,{variant:`outline`,onMouseDown:be,onClick:m,disabled:u.isSaving,children:h}),t[14]=u.isSaving,t[15]=m,t[16]=g):g=t[16];let _;t[17]===u?_=t[18]:(_=()=>void u.submit(),t[17]=u,t[18]=_);let v;t[19]===u.isSaving?v=t[20]:(v=u.isSaving?(0,Q.jsx)(r,{id:`E9bKSA`}):(0,Q.jsx)(r,{id:`A5hiCy`}),t[19]=u.isSaving,t[20]=v);let y;t[21]!==u.isSaving||t[22]!==v||t[23]!==_?(y=(0,Q.jsx)(s,{onClick:_,disabled:u.isSaving,children:v}),t[21]=u.isSaving,t[22]=v,t[23]=_,t[24]=y):y=t[24];let b;t[25]!==y||t[26]!==g?(b=(0,Q.jsxs)(k,{children:[g,y]}),t[25]=y,t[26]=g,t[27]=b):b=t[27];let x;return t[28]!==b||t[29]!==p?(x=(0,Q.jsxs)(Q.Fragment,{children:[f,p,b]}),t[28]=b,t[29]=p,t[30]=x):x=t[30],x}function be(e){return e.preventDefault()}function xe(e){let t=(0,U.c)(16),{template:n,onOpenChange:r,onDeleted:a}=e,{_:s}=i(),[l,u]=(0,W.useState)(!1),d;t[0]!==s||t[1]!==a||t[2]!==r?(d=async function(e){u(!0);let t=await V(e.source_folder,e.name);if(u(!1),!t.ok){let{error:e}=t;c.error(s({id:`36WXSC`,values:{error:e}}));return}let n=e.title??e.name;c.success(s({id:`ErRi6L`,values:{label:n}})),a(),r(!1)},t[0]=s,t[1]=a,t[2]=r,t[3]=d):d=t[3];let f=d,p=n!==null,m;t[4]!==l||t[5]!==r?(m=e=>{!e&&!l&&r(!1)},t[4]=l,t[5]=r,t[6]=m):m=t[6];let h;t[7]!==s||t[8]!==l||t[9]!==f||t[10]!==n?(h=n?(()=>{let{name:e,path:t,scope:r}=n,i=r===`inherited`?`\n\n${s({id:`8uAWix`})}`:``;return(0,Q.jsx)(H,{itemName:s({id:`XfzqjK`,values:{name:e}}),isSubmitting:l,onDelete:()=>f(n),customDescription:`${s({id:`5LXwX8`,values:{path:t}})}${i}`})})():null,t[7]=s,t[8]=l,t[9]=f,t[10]=n,t[11]=h):h=t[11];let g;return t[12]!==p||t[13]!==m||t[14]!==h?(g=(0,Q.jsx)(o,{open:p,onOpenChange:m,children:h}),t[12]=p,t[13]=m,t[14]=h,t[15]=g):g=t[15],g}function Se(e){let t=(0,U.c)(45),{template:n,onEdit:a,onDelete:o,onCreate:c,badge:l}=e,{_:u}=i(),d=n.title??n.name,f=!!(n.title&&n.title!==n.name),p;t[0]===d?p=t[1]:(p=(0,Q.jsx)(`span`,{className:`truncate font-medium`,children:d}),t[0]=d,t[1]=p);let m;t[2]!==f||t[3]!==n.name?(m=f?(0,Q.jsx)(`code`,{className:`shrink-0 font-mono text-xs text-muted-foreground`,children:n.name}):null,t[2]=f,t[3]=n.name,t[4]=m):m=t[4];let h;t[5]===l?h=t[6]:(h=l?(0,Q.jsx)(`span`,{className:`ml-auto shrink-0`,children:l}):null,t[5]=l,t[6]=h);let g;t[7]!==p||t[8]!==m||t[9]!==h?(g=(0,Q.jsxs)(`span`,{className:`flex w-full items-center gap-2`,children:[p,m,h]}),t[7]=p,t[8]=m,t[9]=h,t[10]=g):g=t[10];let _;t[11]===n.description?_=t[12]:(_=n.description?(0,Q.jsx)(`span`,{className:`w-full truncate text-sm text-muted-foreground`,children:n.description}):null,t[11]=n.description,t[12]=_);let w;t[13]!==a||t[14]!==g||t[15]!==_?(w=(0,Q.jsxs)(s,{type:`button`,variant:`ghost`,onClick:a,className:`h-auto min-w-0 flex-1 flex-col items-start gap-0.5 px-1.5 py-1 text-left font-normal hover:bg-transparent`,children:[g,_]}),t[13]=a,t[14]=g,t[15]=_,t[16]=w):w=t[16];let T;t[17]!==u||t[18]!==d||t[19]!==c?(T=c?(0,Q.jsxs)(s,{type:`button`,variant:`ghost`,size:`sm`,className:`shrink-0 font-mono uppercase opacity-0 group-hover:opacity-100 focus-visible:opacity-100`,onClick:c,"aria-label":u({id:`mZ1r4i`,values:{label:d}}),children:[(0,Q.jsx)(ee,{className:`size-3.5`,"aria-hidden":!0}),(0,Q.jsx)(r,{id:`hYgDIe`})]}):null,t[17]=u,t[18]=d,t[19]=c,t[20]=T):T=t[20];let E;t[21]!==u||t[22]!==d?(E=u({id:`Bx4EXG`,values:{label:d}}),t[21]=u,t[22]=d,t[23]=E):E=t[23];let D;t[24]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,Q.jsx)(S,{className:`size-4`,"aria-hidden":!0}),t[24]=D):D=t[24];let O;t[25]===E?O=t[26]:(O=(0,Q.jsx)(y,{asChild:!0,children:(0,Q.jsx)(s,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0 opacity-0 group-hover:opacity-100 focus-visible:opacity-100 data-[state=open]:opacity-100`,"aria-label":E,children:D})}),t[25]=E,t[26]=O);let k,A;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,Q.jsx)(C,{"aria-hidden":!0}),A=(0,Q.jsx)(r,{id:`ePK91l`}),t[27]=k,t[28]=A):(k=t[27],A=t[28]);let j;t[29]===a?j=t[30]:(j=(0,Q.jsxs)(v,{onSelect:a,children:[k,A]}),t[29]=a,t[30]=j);let M,N;t[31]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(te,{"aria-hidden":!0}),N=(0,Q.jsx)(r,{id:`cnGeoo`}),t[31]=M,t[32]=N):(M=t[31],N=t[32]);let P;t[33]===o?P=t[34]:(P=(0,Q.jsxs)(v,{variant:`destructive`,onSelect:o,children:[M,N]}),t[33]=o,t[34]=P);let F;t[35]!==j||t[36]!==P?(F=(0,Q.jsxs)(b,{align:`end`,className:`min-w-52`,children:[j,P]}),t[35]=j,t[36]=P,t[37]=F):F=t[37];let I;t[38]!==O||t[39]!==F?(I=(0,Q.jsxs)(x,{modal:!1,children:[O,F]}),t[38]=O,t[39]=F,t[40]=I):I=t[40];let L;return t[41]!==I||t[42]!==w||t[43]!==T?(L=(0,Q.jsxs)(`li`,{className:`group flex items-center gap-2 rounded-md px-2 py-1.5 text-sm hover:bg-muted/50`,children:[w,T,I]}),t[41]=I,t[42]=w,t[43]=T,t[44]=L):L=t[44],L}export{G as a,Y as i,xe as n,ve as r,Se as t};
|
package/dist/public/assets/{TerminalLaunchContext-DWUMDSpw.js → TerminalLaunchContext-DprnLNoQ.js}
RENAMED
|
@@ -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"./RegisteredAgentIcon-
|
|
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"./RegisteredAgentIcon-B0qjAvei.js";import{d as a,l as o}from"./agent-registry-BdHe0AEQ.js";import{f as s,g as c,m as l,r as u,s as d,t as ee}from"./agent-connections-D6YhmKlS.js";import{n as f,t as p}from"./bool-pref-CqB9j4bL.js";import{n as m}from"./storage-scope-GPc8n3Ml.js";var h=e(n(),1),g=i();async function _(e,t={}){let n=t.okDesktop??(typeof window<`u`?window.okDesktop:void 0);if(n?.shell?.recordHandoff)try{await n.shell.recordHandoff(e)}catch(e){(t.warn??(e=>console.warn(e)))(`[handoff] recordHandoff IPC rejected (telemetry skipped): ${e instanceof Error?e.message:String(e)}`)}}var v=t(),y=(0,h.createContext)(null),b=`ok-external-handoff-setup-dismissed-v1`,x=250,te=1e4;function S(e){return(e instanceof Error?e.message:typeof e==`string`?e:null)?.replace(/\s+/g,` `).trim().slice(0,240)||void 0}function C(e,t,n){let r=S(n);console.warn(`[handoff] external readiness check bypassed`,{target:e,cause:t,...r===void 0?{}:{detail:r}})}function w(e){let{check:t}=e;t.statusTimer!==null&&clearTimeout(t.statusTimer),t.deadlineTimer!==null&&clearTimeout(t.deadlineTimer),t.statusTimer=null,t.deadlineTimer=null,t.controller.abort()}function T(e,t){E(e.target,t),e.resolve({ok:!1,reason:t})}function E(e,t){_({target:e,host:typeof window<`u`&&window.okDesktop!=null?`electron`:`web`,outcome:`error`,reason:t,ts:new Date().toISOString()})}function D(e,t){if(t.unavailable===!0)return{kind:`unknown`,cause:`unavailable`,detail:t.error};if(!t.ok)return{kind:`unknown`,cause:`read-failed`,detail:t.error};if(t.snapshot===null)return{kind:`unknown`,cause:`missing-snapshot`};let n=u({agentId:e,mode:`external`,snapshot:t.snapshot,detected:!0});if(n===`connected`)return{kind:`ready`};if(n!==`not-connected`)return{kind:`unknown`,cause:`unknown-status`,detail:n};let r=s(t.snapshot,{forceDetected:[e]}).find(t=>t.id===e);return r===void 0?{kind:`unknown`,cause:`missing-row`}:{kind:`setup`,connection:r}}function O(){if(typeof document>`u`)return null;let e=document.activeElement;for(;e instanceof HTMLElement;){let t=e.shadowRoot?.activeElement;if(!(t instanceof HTMLElement))break;e=t}return e instanceof HTMLElement?e:null}function k(e,t){return`${m(b,t)}:${e}`}function A(e,t){return p(k(e,t))}function j(e,t,n){f(k(e,t),n)}function M(e){let t=(0,g.c)(31),{children:n,applyConnections:i}=e,s=i===void 0?ee:i,{_:u}=r(),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f={kind:`idle`},t[0]=f):f=t[0];let[p,m]=(0,h.useState)(f),[_,b]=(0,h.useState)(!1),S=(0,h.useRef)(null),k=(0,h.useRef)(0),M;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(M=function(e){return S.current?.id===e.id},t[1]=M):M=t[1];let N=M,P;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(P=function(e){return N(e)?(S.current=null,w(e),m({kind:`idle`}),!0):!1},t[2]=P):P=t[2];let F=P,I,L;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(I=()=>()=>{let e=S.current;e!==null&&(S.current=null,w(e),T(e,`superseded`))},L=[],t[3]=I,t[4]=L):(I=t[3],L=t[4]),(0,h.useEffect)(I,L);let R;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(R=function(e){F(e)&&T(e,`setup-canceled`)},t[5]=R):R=t[5];let z=R,B;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(B=function(e){F(e)&&Promise.resolve().then(e.rawDispatch).then(e.resolve,e.reject)},t[6]=B):B=t[6];let V=B,H;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(H=function(e){let t=O();if(t===null||t===document.body||!t.isConnected)return e;let n={...e,returnFocus:t};return S.current=n,n},t[7]=H):H=t[7];let U=H,W;if(t[8]!==s){let e=async function(e){let t=a(e.target);if(t===void 0){C(e.target,`unmapped-target`),V(e);return}let n;try{n=await s([],{webSignal:e.check.controller.signal})}catch(t){let n=t;if(!N(e))return;C(e.target,`read-threw`,n),V(e);return}if(!N(e))return;let r;try{r=D(t,n)}catch(t){let n=t;C(e.target,`derivation-threw`,n),V(e);return}if(r.kind!==`setup`){r.kind===`unknown`&&C(e.target,r.cause,r.detail),V(e);return}w(e),b(!1),m({kind:`setup`,pending:U(e),connection:r.connection})};W=function(t,n,r){let i=S.current;i!==null&&F(i)&&T(i,`superseded`);let a=k.current+=1;return r.installState.installed===!1?(E(t,`not-installed`),Promise.resolve({ok:!1,reason:`not-installed`})):new Promise((i,o)=>{let s=O(),c={id:a,target:t,projectDir:r.projectDir,rawDispatch:n,returnFocus:s?.tagName===`BODY`?null:s,restoreFocus:r.restoreFocus,resolve:i,reject:o,check:{controller:new AbortController,statusTimer:null,deadlineTimer:null}};if(S.current=c,A(t,r.projectDir)){V(c);return}m({kind:`checking`,id:a,target:t,visible:!1}),c.check.statusTimer=setTimeout(()=>{N(c)&&m(e=>e.kind===`checking`&&e.id===a?{...e,visible:!0}:e)},x),c.check.deadlineTimer=setTimeout(()=>{N(c)&&(C(c.target,`read-timeout`),V(c))},te),e(c).catch(e=>{N(c)&&(C(c.target,`check-threw`,e),V(c))})})},t[8]=s,t[9]=W}else W=t[9];let G=W,K=p.kind===`setup`?p:null,q=K?.connection.label??``,J;t[10]!==p.kind||t[11]!==p.target?(J=p.kind===`checking`?o.find(e=>e.id===p.target)?.displayName??p.target:``,t[10]=p.kind,t[11]=p.target,t[12]=J):J=t[12];let Y=J,X;t[13]===G?X=t[14]:(X={dispatch:G},t[13]=G,t[14]=X);let Z;t[15]!==u||t[16]!==Y||t[17]!==p.kind||t[18]!==p.visible?(Z=p.kind===`checking`&&p.visible?(0,v.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`pointer-events-none fixed left-1/2 top-4 z-50 -translate-x-1/2 rounded-full border border-border bg-background px-4 py-2 text-sm text-foreground shadow-md`,children:u({id:`jDejAI`,values:{checkingLabel:Y}})}):null,t[15]=u,t[16]=Y,t[17]=p.kind,t[18]=p.visible,t[19]=Z):Z=t[19];let Q;t[20]!==u||t[21]!==s||t[22]!==q||t[23]!==_||t[24]!==K?(Q=K===null?null:(0,v.jsx)(d,{connection:K.connection,paired:l(K.connection.id),open:!0,onOpenChange:e=>{e||z(K.pending)},onCloseAutoFocus:e=>{let t=K.pending.returnFocus;t?.isConnected===!0?(e.preventDefault(),t.focus()):K.pending.restoreFocus!==void 0&&(e.preventDefault(),K.pending.restoreFocus())},validateSave:e=>e.projectMcp||e.globalMcp?null:u({id:`Pur9o0`}),alternateAction:{label:u({id:`RcPztQ`,values:{handoffLabel:q}}),onClick:()=>{_&&j(K.pending.target,K.pending.projectDir,!0),V(K.pending)},preference:{checked:_,label:u({id:`IDXn2n`}),onCheckedChange:b}},onSave:async(e,t)=>{let n=await s(c(K.connection,e,t));if(!N(K.pending)||!n.ok)return n;let r;try{r=D(K.connection.id,n)}catch(e){let t=e;return C(K.pending.target,`derivation-threw`,t),{kind:`saved-not-ready`,message:u({id:`srbby-`,values:{handoffLabel:q}})}}return r.kind===`ready`?(V(K.pending),n):{kind:`saved-not-ready`,message:u({id:`srbby-`,values:{handoffLabel:q}})}}},K.pending.id),t[20]=u,t[21]=s,t[22]=q,t[23]=_,t[24]=K,t[25]=Q):Q=t[25];let $;return t[26]!==n||t[27]!==X||t[28]!==Z||t[29]!==Q?($=(0,v.jsxs)(y,{value:X,children:[n,Z,Q]}),t[26]=n,t[27]=X,t[28]=Z,t[29]=Q,t[30]=$):$=t[30],$}function N(){let e=(0,h.use)(y);if(e===null)throw Error(`useExternalHandoffGate must be used within <ExternalHandoffGateProvider />`);return e}var P=[...new Set(o.flatMap(e=>e.schemes))];function F(e,t){let n=t.now?.()??Date.now(),r={};for(let t of o){let i=t.schemes[0],a=i===void 0?void 0:e[i];if(!a){r[t.id]={installed:null};continue}r[t.id]={installed:a.installed,...a.displayName===void 0?{}:{displayName:a.displayName},lastChecked:n}}return r}function I(e){return F({},e)}async function L(e){let t=e.schemes??P,n=await Promise.all(t.map(async t=>{let n=t.replace(/:$/,``);try{return[t,await e.detectProtocol(n)]}catch{return[t,{installed:!1}]}}));return Object.fromEntries(n)}var R=Object.fromEntries(P.map(e=>[e,{installed:!1}]));async function z(e){let t;try{t=await e.fetch(`/api/installed-agents`,{signal:e.signal,headers:{Accept:`application/json`}})}catch(e){if(e.name===`AbortError`)throw e;return R}if(!t.ok)return R;let n;try{n=await t.json()}catch{return R}if(typeof n!=`object`||!n||Array.isArray(n))return R;let r=n,i={};for(let e of P)i[e]={installed:r[e.replace(/:$/,``)]===!0};return i}function B(e,t){let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n){let n=e[r],i=t[r];if(!n||!i||n.installed!==i.installed||n.displayName!==i.displayName)return!1}return!0}function V(e){let t=e.throttleMs??1e4,n=!1,r=null,i=null,a={},o=I({isElectronHost:e.isElectronHost(),now:e.now}),s=new Set,c=()=>{if(!n)for(let e of s)e(o)},l=()=>{o=F(a,{isElectronHost:e.isElectronHost(),now:e.now})};return{probe:async()=>{if(n)return;if(i)return i;if(r!==null&&e.now()-r<t)return;let o=(async()=>{try{let t=await e.probe();if(n)return;let i=!B(a,t);a=t,i&&(l(),c()),r=e.now()}catch{}finally{i=null}})();return i=o,o},getTargetStates:()=>o,subscribe:e=>(s.add(e),()=>{s.delete(e)}),cancel:()=>{n=!0,s.clear()}}}function H(e=typeof window<`u`?window:void 0){return e?.okDesktop!=null}function U(){let e=typeof window<`u`?window.okDesktop:void 0;if(e){let t=t=>e.shell.detectProtocol(t);return{probe:()=>L({detectProtocol:t}),isElectronHost:()=>!0,now:Date.now}}let t=globalThis.fetch.bind(globalThis);return{probe:()=>z({fetch:t}),isElectronHost:()=>!1,now:Date.now}}function W(){let e=(0,g.c)(5),[t,n]=(0,h.useState)(G),r=(0,h.useRef)(null),i,a;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=()=>{let e=V(U());r.current=e;let t=e.subscribe(n);e.probe();let i=()=>{e.probe()};return window.addEventListener(`focus`,i),()=>{window.removeEventListener(`focus`,i),t(),e.cancel(),r.current=null}},a=[],e[0]=i,e[1]=a):(i=e[0],a=e[1]),(0,h.useEffect)(i,a);let o;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>r.current?.probe()??Promise.resolve(),e[2]=o):o=e[2];let s;return e[3]===t?s=e[4]:(s={states:t,refresh:o},e[3]=t,e[4]=s),s}function G(){return I({isElectronHost:H(),now:Date.now})}var K=(0,h.createContext)(null);function q(e){let t=(0,g.c)(3),{value:n,children:r}=e,i;return t[0]!==r||t[1]!==n?(i=(0,v.jsx)(K,{value:n,children:r}),t[0]=r,t[1]=n,t[2]=i):i=t[2],i}function J(){return(0,h.use)(K)}export{j as a,_ as c,M as i,J as n,A as o,W as r,N as s,q as t};
|