@inkeep/open-knowledge 0.66.1 → 0.66.2
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/{acp-harness-probe-Bk3Dz297.mjs → acp-harness-probe-C-bmwKC0.mjs} +2 -2
- package/dist/cli.mjs +6 -6
- package/dist/constants-m3Xu5_Pm.mjs +2 -0
- package/dist/{git-handle-C9RPCwJN.mjs → git-handle-CehgIzoK.mjs} +2 -2
- package/dist/git-handle-DEJ8aYeH.mjs +1 -0
- package/dist/index.mjs +2 -2
- package/dist/init-CkmKaAE9.mjs +1 -0
- package/dist/{init-DNQN84w4.mjs → init-DwE-82L_.mjs} +3 -3
- package/dist/{launch-json-removal-CsfA7Q9t.mjs → launch-json-removal-C5njpRMR.mjs} +2 -2
- package/dist/{loader-DOE8T0bD.mjs → loader-Da9QChC_.mjs} +2 -2
- package/dist/loader-Dt_OoEGe.mjs +1 -0
- package/dist/md-manager-BZCd3Vha.mjs +2 -0
- package/dist/{open-browser-Bzfc84xQ.mjs → open-browser-DIMVmm0o.mjs} +2 -2
- package/dist/parse-worker.mjs +1 -1
- package/dist/{preview-Doha4cmP.mjs → preview-BBdR6vmw.mjs} +2 -2
- package/dist/preview-oAaqMEbf.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-xON2KhOz.js → ActivityModeContent-B37XJHxx.js} +1 -1
- package/dist/public/assets/{AddPropertiesButton-CC1Bimpt.js → AddPropertiesButton-eMa8eBGf.js} +1 -1
- package/dist/public/assets/{AgentDiffPane-BPGzdN_g.js → AgentDiffPane-DHlBPg3c.js} +1 -1
- package/dist/public/assets/{AgentThreadClientBinder-Sg80UfOQ.js → AgentThreadClientBinder-lpLw9XDN.js} +1 -1
- package/dist/public/assets/{BugReportHistory-BOcChnxP.js → BugReportHistory-CuN8iDlA.js} +1 -1
- package/dist/public/assets/{BugReportHistoryDialog-BgcEcCCO.js → BugReportHistoryDialog-DGj_pTZf.js} +1 -1
- package/dist/public/assets/{CodeMirrorPropInput-Dp0ghtC3.js → CodeMirrorPropInput-Be4UuxHJ.js} +1 -1
- package/dist/public/assets/{ConsentDialogBody-DQlUb8Vu.js → ConsentDialogBody-XPmv8PGk.js} +1 -1
- package/dist/public/assets/{DocumentContext-Ak51fAXi.js → DocumentContext-CZ1LyjXH.js} +1 -1
- package/dist/public/assets/{EditorModeToggle-DpkS50Z0.js → EditorModeToggle-jAYPDv4d.js} +1 -1
- package/dist/public/assets/{EnableSyncConfirmDialog-DyPeGiVT.js → EnableSyncConfirmDialog-DGwynRzU.js} +1 -1
- package/dist/public/assets/{ExcalidrawDocEditor-BKndnS9g.js → ExcalidrawDocEditor-BWNQPfhq.js} +1 -1
- package/dist/public/assets/FeedbackForm-BAO3lafp.js +1 -0
- package/dist/public/assets/{GraphPanel-BdWJsnt-.js → GraphPanel-DDKxNmOr.js} +1 -1
- package/dist/public/assets/{ImportSkillDialog-C5f6Lj0b.js → ImportSkillDialog-D_3ApyBv.js} +1 -1
- package/dist/public/assets/{LintConfigEditor-C21DnP0H.js → LintConfigEditor-B3Gj07cI.js} +1 -1
- package/dist/public/assets/ManagedArtifactProperties-CV1Prpoj.js +1 -0
- package/dist/public/assets/{ManagedArtifactProperties-Dd9YEu9g.js → ManagedArtifactProperties-DeYta-00.js} +1 -1
- package/dist/public/assets/{MermaidDocEditor-CftOutDD.js → MermaidDocEditor-CiHzMRN9.js} +1 -1
- package/dist/public/assets/{PropertyDisplayRow-B3tLCY9W.js → PropertyDisplayRow-sm9qwuBw.js} +1 -1
- package/dist/public/assets/{ReportBugDialogBody-DRDozPGc.js → ReportBugDialogBody-DZA9GXnC.js} +1 -1
- package/dist/public/assets/{ReportBugMenuTrigger-Sbn4B06b.js → ReportBugMenuTrigger-D4qlc7zz.js} +2 -2
- package/dist/public/assets/{SchemaConfigEditor-DXhpWbEp.js → SchemaConfigEditor-D17w4XxC.js} +1 -1
- package/dist/public/assets/{SessionsHost-CGbrz5ge.js → SessionsHost-Cl-gIFYH.js} +2 -2
- package/dist/public/assets/{SettingsDialogBody-GRqpQyOX.js → SettingsDialogBody-Cqc-yl4k.js} +1 -1
- package/dist/public/assets/{ShareBranchSwitchDialog-DgKD1FWp.js → ShareBranchSwitchDialog-Ct4sBRfQ.js} +1 -1
- package/dist/public/assets/{ShareReceiveDialog-BsGWPO5t.js → ShareReceiveDialog-B92aqQEx.js} +1 -1
- package/dist/public/assets/{ShareReceiveMissDialog-DX4YDzpC.js → ShareReceiveMissDialog-C9VJyG_D.js} +1 -1
- package/dist/public/assets/{SkillCostValue-B4D7Ysdc.js → SkillCostValue-DLUxO68c.js} +1 -1
- package/dist/public/assets/{SkillEditBanner-BruoXTh-.js → SkillEditBanner-b0gL75iO.js} +1 -1
- package/dist/public/assets/{SkillInstallMenu-QBcuRLjh.js → SkillInstallMenu-BwbbztKY.js} +1 -1
- package/dist/public/assets/{SkillOriginInline-Dshp1Rdi.js → SkillOriginInline-DpPKdpar.js} +1 -1
- package/dist/public/assets/{SkillToolbarControls-BCXxl3_M.js → SkillToolbarControls-Bap6lIv8.js} +1 -1
- package/dist/public/assets/{SlidesToolbarControls-CJxgVynH.js → SlidesToolbarControls-BNqlGZ8e.js} +1 -1
- package/dist/public/assets/{SourceEditor-D9_q6g5_.js → SourceEditor-RCKX4Ohe.js} +1 -1
- package/dist/public/assets/{TerminalPanel-Lt1-XHX1.js → TerminalPanel-Zo-UDi-u.js} +1 -1
- package/dist/public/assets/{TerminalWindowApp-VUZguLdJ.js → TerminalWindowApp-DjRpidld.js} +1 -1
- package/dist/public/assets/{TextDocEditor-Cb7BPpJA.js → TextDocEditor--IKVxg88.js} +1 -1
- package/dist/public/assets/{ThreadView-Bf53-ggV.js → ThreadView-CUArcRSL.js} +1 -1
- package/dist/public/assets/{TimelineDiffPane-B1HLCcW9.js → TimelineDiffPane-D8HcBg2n.js} +1 -1
- package/dist/public/assets/{agent-diff-store-XWhp_hqN.js → agent-diff-store-DgFkR0kV.js} +1 -1
- package/dist/public/assets/{auth-state-cache-D22yWCCz.js → auth-state-cache-DNrEadrI.js} +1 -1
- package/dist/public/assets/{bug-report-send-manager-BBNXam8A.js → bug-report-send-manager-5nrn8Psu.js} +1 -1
- package/dist/public/assets/{client-version-B_H8duw7.js → client-version-DewpIoVp.js} +1 -1
- package/dist/public/assets/{comment-chips-D0prCEAx.js → comment-chips-mYvhrkxj.js} +1 -1
- package/dist/public/assets/{config-provider-D-Y4Wg0x.js → config-provider-DWieljqa.js} +1 -1
- package/dist/public/assets/{dist-D1GzYuCD.js → dist-As2x8uCt.js} +1 -1
- package/dist/public/assets/{doc-paths-ByyIE836.js → doc-paths-BkNaaTOB.js} +1 -1
- package/dist/public/assets/{documents-events-DPqTvBXn.js → documents-events-2g_OBjKU.js} +1 -1
- package/dist/public/assets/{file-tree-adapter-Ccbih42A.js → file-tree-adapter-Q4uvZiQM.js} +1 -1
- package/dist/public/assets/{file-tree-utils-Jz2v-e9t.js → file-tree-utils-Cy2QEG_5.js} +1 -1
- package/dist/public/assets/{folder-config-api-BddKQIga.js → folder-config-api-DhiWnWlS.js} +1 -1
- package/dist/public/assets/i18n-CpxzRV_v.js +1 -0
- package/dist/public/assets/{index-nJnxhQRq.js → index-DrzqbmWI.js} +7 -7
- package/dist/public/assets/{launcher-selection-CUAKUPGW.js → launcher-selection-DTBWt8s2.js} +1 -1
- package/dist/public/assets/{lint-config-client-DeGP10La.js → lint-config-client-CQNYXMfG.js} +1 -1
- package/dist/public/assets/{markdownlint-rule-browser-Bir8KkrK.js → markdownlint-rule-browser-BTovNATK.js} +1 -1
- package/dist/public/assets/{page-list-cache-D2OX_WDU.js → page-list-cache-AR7XhC2q.js} +1 -1
- package/dist/public/assets/{pending-receive-nav-store-sErL2uzl.js → pending-receive-nav-store-DXWRYoc_.js} +1 -1
- package/dist/public/assets/{progress-DfDRMpm4.js → progress-YLRB2n7w.js} +1 -1
- package/dist/public/assets/{project-paths-DX_YsFET.js → project-paths-BmMTa57i.js} +1 -1
- package/dist/public/assets/{prop-types-NHOECtyl.js → prop-types-CTZ-Zcfm.js} +1 -1
- package/dist/public/assets/{receive-store-6Dih24L8.js → receive-store-RexqPtVU.js} +1 -1
- package/dist/public/assets/{selection-context-C95IJZrT.js → selection-context-BcWEVrAI.js} +1 -1
- package/dist/public/assets/{skill-scope-4RF9DbEf.js → skill-scope-CauFSzAn.js} +1 -1
- package/dist/public/assets/{skills-api-D5W0J2dk.js → skills-api-KE9J-94z.js} +1 -1
- package/dist/public/assets/{src-qGi8ucyG.js → src-B5LNuYlK.js} +1 -1
- package/dist/public/assets/{startup-marks-Bvho0uc6.js → startup-marks-CUyZjhyC.js} +1 -1
- package/dist/public/assets/{tag-pill-input-CtA1wFQO.js → tag-pill-input-CcAyDLGe.js} +1 -1
- package/dist/public/assets/{target-navigation-intent-BFUFQkcA.js → target-navigation-intent-D6pgYTG-.js} +1 -1
- package/dist/public/assets/{telemetry-startup-C_zn8gFF.js → telemetry-startup-BFCbpnFp.js} +1 -1
- package/dist/public/assets/{terminal-cli-display-ZGFW9kw3.js → terminal-cli-display-C2L3vHWw.js} +1 -1
- package/dist/public/assets/{typing-burst-detector-B0lg7vla.js → typing-burst-detector-BO09cycJ.js} +1 -1
- package/dist/public/assets/{uninstall-BkDWS7iv.js → uninstall-DJhzaTa1.js} +1 -1
- package/dist/public/assets/{use-activity-panel-CuqTH-mx.js → use-activity-panel-BCJavN8T.js} +1 -1
- package/dist/public/assets/{use-apply-config-color-theme-Ba8Smkdy.js → use-apply-config-color-theme-CwClEWrd.js} +1 -1
- package/dist/public/assets/{use-collab-url-DFpuF-wX.js → use-collab-url-DHOOSaDb.js} +1 -1
- package/dist/public/assets/{use-live-xterm-theme-c1fyCaal.js → use-live-xterm-theme-_zomIp7z.js} +1 -1
- package/dist/public/assets/{use-open-skill-DJmjKHgr.js → use-open-skill-DzG96lKz.js} +1 -1
- package/dist/public/assets/{use-settings-route-BQW0aTo0.js → use-settings-route-Dq3eM_ye.js} +1 -1
- package/dist/public/assets/{use-skill-origin-WyyVjfzt.js → use-skill-origin-uUY8unvE.js} +1 -1
- package/dist/public/assets/{use-skills-BOMFaoLg.js → use-skills-RpG-BeVz.js} +1 -1
- package/dist/public/assets/{use-terminal-enabled-T9hbZCmo.js → use-terminal-enabled-DIQ4qqYj.js} +1 -1
- package/dist/public/assets/{use-timeline-entry-diff-Blkn7mx5.js → use-timeline-entry-diff-_fLA4Pt0.js} +1 -1
- package/dist/public/assets/{use-workspace-BeSzHXgL.js → use-workspace-DRylP9vX.js} +1 -1
- package/dist/public/index.html +47 -47
- package/dist/public/uninstall.html +3 -3
- package/dist/{repair-launch-json-AsKV5LiF.mjs → repair-launch-json-DO_3ABvq.mjs} +2 -2
- package/dist/{repair-mcp-configs-BYASBYNt.mjs → repair-mcp-configs-Bmw9_91L.mjs} +2 -2
- package/dist/{repair-skills-AGXJVKE-.mjs → repair-skills-BftHPTbX.mjs} +2 -2
- package/dist/repair-skills-CPy4iDny.mjs +1 -0
- package/dist/{resolve-project-root-XrNPFGNY.mjs → resolve-project-root-BCdGoKNz.mjs} +2 -2
- package/dist/{server-lock-DaOXwt6C.mjs → server-lock-CBDjdfxH.mjs} +2 -2
- package/dist/server-lock-xg5Njzvf.mjs +1 -0
- package/dist/{skill-teardown-BEnDXQv2.mjs → skill-teardown-Bxy5NV-V.mjs} +2 -2
- package/dist/src-B13TeG7U.mjs +1 -0
- package/dist/{src-BUfAkcnU.mjs → src-CP2xsmg5.mjs} +2 -2
- package/dist/{src-Gpb82U0M.mjs → src-D4A03H49.mjs} +2 -2
- package/dist/{src-D79M3x9g.mjs → src-DXJo3hyx.mjs} +1 -1
- package/dist/{src-Dyk9iCzv.mjs → src-HFlqeGnA.mjs} +4 -4
- package/dist/{start-hZ8_kSuC.mjs → start-7t3OZSc5.mjs} +3 -3
- package/dist/start-C1hXUjiR.mjs +1 -0
- package/package.json +4 -4
- package/dist/constants-DXEhJ197.mjs +0 -2
- package/dist/git-handle-pDdbSsMj.mjs +0 -1
- package/dist/init-D9KKXAfB.mjs +0 -1
- package/dist/loader-hcc6a20d.mjs +0 -1
- package/dist/md-manager-BUn7RZOJ.mjs +0 -2
- package/dist/preview-CHdEIdwL.mjs +0 -1
- package/dist/public/assets/FeedbackForm-BNeQXmJD.js +0 -1
- package/dist/public/assets/ManagedArtifactProperties-AGHZbLhh.js +0 -1
- package/dist/public/assets/i18n-BFtoQNCd.js +0 -1
- package/dist/repair-skills-DUxV_xLI.mjs +0 -1
- package/dist/server-lock-VtTnds5h.mjs +0 -1
- package/dist/src-s7hpfSip.mjs +0 -1
- package/dist/start-ky9sRyOI.mjs +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-Cym3gapE.js";import{$t as c,Gi as l,Ki as u,On as d,Sn as f}from"./dist-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as o}from"./utils-CPqDy6Hr.js";import{t as s}from"./button-Cym3gapE.js";import{$t as c,Gi as l,Ki as u,On as d,Sn as f}from"./dist-As2x8uCt.js";import{n as p}from"./dist-CJhtNlOm2.js";import{r as m}from"./use-apply-config-theme-CBmHKD_B.js";import{t as h}from"./x-DbShSCr5.js";import{f as g,p as _,u as v}from"./doc-paths-BkNaaTOB.js";import{n as y}from"./page-list-cache-AR7XhC2q.js";import{f as b,h as x}from"./file-tree-adapter-Q4uvZiQM.js";import{t as ee}from"./use-live-xterm-theme-_zomIp7z.js";import{r as te}from"./terminal-command-events-D0gJ8NJs.js";import{t as S}from"./TerminalStartingNotice-DFapfn5h.js";var C=a(),w=2,T=1,ne=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(w,Math.floor(u/e.css.cell.width)),rows:Math.max(T,Math.floor(l/e.css.cell.height))}}},E=[[768,879],[1155,1158],[1160,1161],[1425,1469],[1471,1471],[1473,1474],[1476,1477],[1479,1479],[1536,1539],[1552,1557],[1611,1630],[1648,1648],[1750,1764],[1767,1768],[1770,1773],[1807,1807],[1809,1809],[1840,1866],[1958,1968],[2027,2035],[2305,2306],[2364,2364],[2369,2376],[2381,2381],[2385,2388],[2402,2403],[2433,2433],[2492,2492],[2497,2500],[2509,2509],[2530,2531],[2561,2562],[2620,2620],[2625,2626],[2631,2632],[2635,2637],[2672,2673],[2689,2690],[2748,2748],[2753,2757],[2759,2760],[2765,2765],[2786,2787],[2817,2817],[2876,2876],[2879,2879],[2881,2883],[2893,2893],[2902,2902],[2946,2946],[3008,3008],[3021,3021],[3134,3136],[3142,3144],[3146,3149],[3157,3158],[3260,3260],[3263,3263],[3270,3270],[3276,3277],[3298,3299],[3393,3395],[3405,3405],[3530,3530],[3538,3540],[3542,3542],[3633,3633],[3636,3642],[3655,3662],[3761,3761],[3764,3769],[3771,3772],[3784,3789],[3864,3865],[3893,3893],[3895,3895],[3897,3897],[3953,3966],[3968,3972],[3974,3975],[3984,3991],[3993,4028],[4038,4038],[4141,4144],[4146,4146],[4150,4151],[4153,4153],[4184,4185],[4448,4607],[4959,4959],[5906,5908],[5938,5940],[5970,5971],[6002,6003],[6068,6069],[6071,6077],[6086,6086],[6089,6099],[6109,6109],[6155,6157],[6313,6313],[6432,6434],[6439,6440],[6450,6450],[6457,6459],[6679,6680],[6912,6915],[6964,6964],[6966,6970],[6972,6972],[6978,6978],[7019,7027],[7616,7626],[7678,7679],[8203,8207],[8234,8238],[8288,8291],[8298,8303],[8400,8431],[12330,12335],[12441,12442],[43014,43014],[43019,43019],[43045,43046],[64286,64286],[65024,65039],[65056,65059],[65279,65279],[65529,65531]],D=[[68097,68099],[68101,68102],[68108,68111],[68152,68154],[68159,68159],[119143,119145],[119155,119170],[119173,119179],[119210,119213],[119362,119364],[917505,917505],[917536,917631],[917760,917999]],O;function re(e,t){let n=0,r=t.length-1,i;if(e<t[0][0]||e>t[r][1])return!1;for(;r>=n;)if(i=n+r>>1,e>t[i][1])n=i+1;else if(e<t[i][0])r=i-1;else return!0;return!1}var k=class{constructor(){if(this.version=`6`,!O){O=new Uint8Array(65536),O.fill(1),O[0]=0,O.fill(0,1,32),O.fill(0,127,160),O.fill(2,4352,4448),O[9001]=2,O[9002]=2,O.fill(2,11904,42192),O[12351]=1,O.fill(2,44032,55204),O.fill(2,63744,64256),O.fill(2,65040,65050),O.fill(2,65072,65136),O.fill(2,65280,65377),O.fill(2,65504,65511);for(let e=0;e<E.length;++e)O.fill(0,E[e][0],E[e][1]+1)}}wcwidth(e){return e<32?0:e<127?1:e<65536?O[e]:re(e,D)?0:e>=131072&&e<=196605||e>=196608&&e<=262141?2:1}charProperties(e,t){let n=this.wcwidth(e),r=n===0&&t!==0;if(r){let e=$e.extractWidth(t);e===0?r=!1:e>n&&(n=e)}return $e.createPropertyValue(0,n,r)}},A=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?M.isErrorNoTelemetry(e)?new M(e.message+`
|
|
2
2
|
|
|
3
3
|
`+e.stack):Error(e.message+`
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{n as a,t as o}from"./ReportBugMenuTrigger-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{n as r}from"./dist-PQ5KMVDh.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{n as a,t as o}from"./ReportBugMenuTrigger-D4qlc7zz.js";import{t as s}from"./config-provider-DWieljqa.js";import{t as c}from"./use-live-xterm-theme-_zomIp7z.js";import{SessionsHost as l}from"./SessionsHost-Cl-gIFYH.js";var u=i(),d=e(n(),1),f=t();function p(e){let t=(0,u.c)(8),{bridge:n}=e,r=n.config.collabUrl?n.config.collabUrl:null,i;t[0]===n?i=t[1]:(i=(0,f.jsx)(m,{bridge:n}),t[0]=n,t[1]=i);let a=r===null,c;t[2]===a?c=t[3]:(c=(0,f.jsx)(o,{systemWide:a}),t[2]=a,t[3]=c);let l;return t[4]!==r||t[5]!==i||t[6]!==c?(l=(0,f.jsxs)(s,{collabUrl:r,children:[i,c]}),t[4]=r,t[5]=i,t[6]=c,t[7]=l):l=t[7],l}function m(e){let t=(0,u.c)(9),{bridge:n}=e,{resolvedTheme:i}=r(),o=c(i),s=a(),[p,m]=(0,d.useState)(null),_;t[0]===o.background?_=t[1]:(_=(0,f.jsx)(`div`,{ref:m,className:`flex h-screen min-h-0 flex-col`,style:{backgroundColor:o.background}}),t[0]=o.background,t[1]=_);let v;t[2]!==n||t[3]!==p||t[4]!==s?(v=(0,f.jsx)(l,{bridge:n,surface:`terminal-window`,terminalCapable:!0,visible:!0,onVisibleChange:g,installedClis:s,container:p,isShowing:!0,onRequestEditorFocus:h}),t[2]=n,t[3]=p,t[4]=s,t[5]=v):v=t[5];let y;return t[6]!==_||t[7]!==v?(y=(0,f.jsxs)(f.Fragment,{children:[_,v]}),t[6]=_,t[7]=v,t[8]=y):y=t[8],y}function h(){}function g(e){e||window.close()}export{p as TerminalWindowApp};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{n as o}from"./CodeMirrorPropInput-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{t as n}from"./react-f2sANaYj.js";import{r}from"./dist-Nvb76hAm.js";import{n as i}from"./dist-PQ5KMVDh.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{n as o}from"./CodeMirrorPropInput-Be4UuxHJ.js";import{Ss as s,mr as c,us as l}from"./dist-As2x8uCt.js";import{g as u}from"./config-provider-DWieljqa.js";import{Dt as d,P as f,Z as p,kt as m}from"./dist-nQee1FU7.js";import{t as h}from"./cm-theme-MqTIJzgL.js";import{t as g}from"./dist-Drn6e5ml2.js";import{t as _}from"./text-viewer-languages-Cc4U6Lc5.js";import{t as v}from"./src-B5LNuYlK.js";var y=a(),b=e(n(),1),x=t(),S=h({dark:!0,background:`var(--background)`,gutterBackground:`var(--muted)`}),C=h({dark:!1,background:`var(--background)`,gutterBackground:`var(--muted)`});function w(e){let t=(0,y.c)(19),{docName:n,provider:a}=e,{_:h}=r(),w=n.slice(n.lastIndexOf(`/`)+1),T=(0,b.useRef)(null),{resolvedTheme:E}=i(),D;t[0]===a.document?D=t[1]:(D=a.document.getText(`source`),t[0]=a.document,t[1]=D);let O=D,k;t[2]===O?k=t[3]:(k=()=>new u(O),t[2]=O,t[3]=k);let[A]=(0,b.useState)(k),j;t[4]!==n||t[5]!==a.awareness||t[6]!==E||t[7]!==A||t[8]!==O?(j=()=>{let e=T.current;if(!e)return;let t=E===`dark`?S:C,r=new d,i=new d,u=(l[c(n)]??s(c(n)))!==null&&c(n)!==``,h=new p({state:m.create({doc:O.toString(),extensions:[g,v(O,a.awareness,{undoManager:A}),r.of([]),f(o),i.of(u?[]:p.lineWrapping),p.theme({"&":{height:`100%`}}),t]}),parent:e}),y=!1,b=c(n)||null;return b&&_(b,l[b]??s(b)).then(e=>{y||!e||h.dispatch({effects:r.reconfigure(e)})}),()=>{y=!0,h.destroy()}},t[4]=n,t[5]=a.awareness,t[6]=E,t[7]=A,t[8]=O,t[9]=j):j=t[9];let M;t[10]!==n||t[11]!==a||t[12]!==E||t[13]!==A||t[14]!==O?(M=[O,a,E,n,A],t[10]=n,t[11]=a,t[12]=E,t[13]=A,t[14]=O,t[15]=M):M=t[15],(0,b.useEffect)(j,M);let N=h({id:`xAlHfe`,values:{basename:w}}),P;t[16]===Symbol.for(`react.memo_cache_sentinel`)?(P=(0,x.jsx)(`div`,{ref:T,className:`min-h-0 flex-1 overflow-auto`}),t[16]=P):P=t[16];let F;return t[17]===N?F=t[18]:(F=(0,x.jsx)(`main`,{className:`flex h-full min-h-0 flex-col bg-background`,"aria-label":N,"data-text-doc-editor":``,children:P}),t[17]=N,t[18]=F),F}export{w as TextDocEditor};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./code-highlighter-impl-OjijFOBN.js","./lib-DmueaA5E.js","./html-void-elements-zEl0KGqf.js","./chunk-CYidjpOJ.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{Ar as r,Jr as i,Xn as a,dr as o,er as s,i as c,ir as l,k as u,nr as d,or as f,rr as p}from"./DocumentContext-Ak51fAXi.js";import{t as m}from"./react-f2sANaYj.js";import{n as h,r as g}from"./dist-Nvb76hAm.js";import{t as _}from"./compiler-runtime-BfE3aGVn.js";import{i as v,o as y}from"./local-menu-action-bus-BLEUyEvu.js";import{t as b}from"./utils-CPqDy6Hr.js";import{n as x,r as S}from"./clipboard-adapter-815RzzoI.js";import{t as C}from"./button-Cym3gapE.js";import{i as w,n as T,t as E}from"./tooltip-DttaCTqz.js";import{c as D,i as O,t as k}from"./dialog-CTNat3T_.js";import{Tt as A}from"./CodeMirrorPropInput-Dp0ghtC3.js";import{a as j,c as M,d as N,f as P,i as F,l as I,m as L,n as ee,o as R,p as te,r as z,t as B,u as ne}from"./dropdown-menu-CRvS0_4-.js";import{a as re,c as V,d as ie,f as ae,i as oe,l as H,n as se,o as ce,p as le,r as ue,s as de,t as U,u as W,v as G,y as K}from"./progress-DfDRMpm4.js";import{n as fe}from"./separator-C6x7j8mC.js";import{t as pe}from"./switch-iwBsEWej.js";import{b as me,d as q,t as he}from"./RegisteredAgentIcon-CDl1h-4U.js";import{Qr as ge,pt as _e}from"./dist-D1GzYuCD.js";import{n as ve}from"./dist-CJhtNlOm2.js";import{t as J}from"./dist-Cr4-nBVI.js";import{g as ye,p as be,r as xe}from"./launcher-selection-CUAKUPGW.js";import{n as Se}from"./use-workspace-BeSzHXgL.js";import{t as Ce}from"./createLucideIcon-BulbvLvN.js";import{c as we,d as Te,r as Ee}from"./Mermaid-B4Oa2diB.js";import{t as De}from"./check-Dut4Aov8.js";import{t as Oe}from"./chevron-down-DNO3PgI_.js";import{t as ke}from"./chevron-right-4mYNnAZZ.js";import{o as Ae,r as je,s as Me}from"./prop-types-NHOECtyl.js";import{n as Ne,t as Pe}from"./terminal-D4HSnHXf.js";import{t as Fe}from"./list-plus-nPRgk4Qi.js";import{t as Ie}from"./spinner-t7GahFcQ.js";import{c as Le,n as Re,o as ze,s as Be,t as Ve}from"./comment-chips-D0prCEAx.js";import{t as He}from"./square-pen-CBGVrQUa.js";import{t as Ue}from"./trash-2-DSqYvaPJ.js";import{t as We}from"./triangle-alert-GeclLtDN.js";import{t as Ge}from"./wrench-DcVBYiNl.js";import{t as Ke}from"./x-DbShSCr5.js";import{f as qe,s as Je}from"./doc-paths-ByyIE836.js";import{t as Ye}from"./external-link-B0bVg1hn.js";import{t as Xe}from"./badge-BWfmbBoh.js";import{t as Ze}from"./skeleton-BZIHOzZH.js";import{t as Qe}from"./textarea-BoMa_3jF.js";import{n as $e}from"./agent-presence-3JajMNAq.js";import{i as et,n as tt}from"./chunk-BO2N2NFS-DkbHWaGq.js";import{n as nt}from"./libesm-mBLacfDP.js";import{a as rt,d as it,f as at,m as ot,n as st,p as ct,r as lt,s as ut}from"./thread-client-C32zww5K.js";import{i as dt,n as ft}from"./launch-agent-thread-Cb_G0uH0.js";var pt=Ce(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),mt=Ce(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),ht=Ce(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),gt=Ce(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Y=_(),_t=new RegExp([`bypass`,`acceptedits`,`fullaccess`,`autoedit`,`yolo`,`danger`,`fullauto`,`autoaccept`,`autoapprove`,`autorun`,`skippermission`,`noconfirm`,`noprompt`,`unrestricted`,`allowall`].join(`|`)),vt=new Set([`auto`]);function yt(e){return e.toLowerCase().replace(/[^a-z]/g,``)}function bt(e){let t=yt(e.id),n=yt(e.name??``);return vt.has(t)||vt.has(n)?!0:_t.test(t)||_t.test(n)}var xt={"claude-acp":`asks`,"codex-acp":`self-managed`,cursor:`self-managed`,"pi-acp":`autonomous`};function St(e,t,n){let r=n??(t==null?null:t.availableModes.find(e=>e.id===t.currentModeId)??null),i=xt[e];return i===void 0?t!=null&&t.availableModes.length>0?`self-managed`:`unknown`:i===`asks`&&r!==null&&bt(r)?`self-managed`:i}var X=e(m(),1),Z=n();function Ct({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=wt(Tt(r,i),t);if(!n)return X.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!X.isValidElement(n))return null;let o=n.props,s={...wt(a,o),ref:Ot(a.ref,o.ref)};return X.cloneElement(n,s)}function wt(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];n===`className`?t[n]=[i,r].filter(Boolean).join(` `):n===`style`?t[n]={...i,...r}:n===`ref`?t[n]=Ot(i,r):Dt(n)&&typeof i==`function`&&typeof r==`function`?t[n]=Et(r,i):t[n]=r}}return t}function Tt(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function Et(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function Dt(e){return/^on[A-Z]/.test(e)}function Ot(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var kt=8,At=64,jt=0,Mt=.5,Nt=180,Pt=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),Ft={start:!1,end:!1},It={currentAnchorId:null,visibleMessageIds:[]};function Lt({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return Ft;let i=Yt({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function Rt({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return It;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of zt(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+Mt&&(u=e)}return l.length===0&&u===null?It:{currentAnchorId:u,visibleMessageIds:l}}function zt(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function Bt(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function Vt(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function Ht(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function Ut(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function Wt({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of zt(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function Gt({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=Kt(t,i),o=t.getBoundingClientRect().height,s=Qt(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function Kt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function qt(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function Jt({content:e,scrollTop:t,spacer:n,viewport:r}){let i=Yt({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function Yt({content:e,spacer:t,viewport:n}){let r=zt(e,t),i=Zt(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function Xt(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Zt(e){let t=window.getComputedStyle(e);return{end:en(t.paddingBlockEnd||t.paddingBottom),start:en(t.paddingBlockStart||t.paddingTop)}}function Qt(e){let t=e?.parentElement;return t?Zt(t):{end:0,start:0}}function $t(e){if(!e)return 0;let t=window.getComputedStyle(e);return en(t.rowGap===`normal`?t.gap:t.rowGap)}function en(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function tn({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,defaultScrollPositionAppliedRef:l,itemCountRef:u,messageElementsRef:d,modeRef:f,pendingScrollToMessageRef:p,prependRestoreRef:m,scrollMarginRef:h,scrollPreviousItemPeekRef:g,spacerGapRef:_,spacerHeightRef:v,spacerRef:y,viewportRef:b}=e,x=X.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},Nt))},[t]),S=X.useCallback(e=>{let t=y.current;if(!t)return;let n=Math.max(0,Math.ceil(e));v.current!==n&&(v.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-_.current}px`:``)},[]),C=X.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=b.current;if(!a)return;let o=Math.max(0,e);if(Math.abs(a.scrollTop-o)<=Mt){a.scrollTop=o,t();return}i&&x(!0),a.scrollTo({top:o,behavior:r}),n()},[t,n,x]),w=X.useCallback(({behavior:e=`auto`}={})=>b.current?(S(0),i.current=null,f.current=`free-scrolling`,C(0,{behavior:e}),r(),!0):!1,[r,C,S]),T=X.useCallback(({behavior:e=`auto`}={})=>{let t=b.current;return t?(S(0),i.current=null,f.current=a.current?`following-bottom`:`free-scrolling`,C(Xt(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,C,S]),E=X.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=h.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=b.current;if(!s||!l||!s.contains(e))return!1;let u=Gt({align:t,element:e,scrollMargin:o?a+g.current:a,spacer:y.current,viewport:l});return S(Jt({content:s,scrollTop:u,spacer:y.current,viewport:l})),m.current={element:e,viewportTop:qt(e,l)},f.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,C(u,{behavior:n}),r(),!0},[r,C,S]),D=X.useCallback(()=>{let e=i.current;return!e||!e.isConnected||f.current!==`anchored-to-message`?!1:E(e,{align:`start`},{keepPreviousPeek:!0})},[E]),O=X.useCallback((e,t)=>{let n=d.current.get(e);return n?(l.current=!0,E(n,t)?(p.current=null,!0):(p.current={messageId:e,options:t},!0)):u.current===0?(p.current={messageId:e,options:t},l.current=!0,!0):!1},[E]);return{flushPendingScrollToMessage:X.useCallback(()=>{let e=p.current;if(!e)return!1;let t=d.current.get(e.messageId);return!t||!E(t,e.options)?!1:(p.current=null,l.current=!0,!0)},[E]),reanchorToAnchoredMessage:D,scrollToElement:E,scrollToEnd:T,scrollToMessage:O,scrollToStart:w}}function nn(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function rn(e,t){return nn(e,t)}function an(){return nn(It,sn)}function on(e,t){return e.start===t.start&&e.end===t.end}function sn(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function cn({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let i=X.useRef(e),a=X.useRef(!1),o=X.useRef(null),s=X.useRef(!1),c=X.useRef(t),l=X.useRef(0),u=X.useRef(null),d=X.useRef(0),f=X.useRef(e?`following-bottom`:`free-scrolling`),p=X.useRef(new Map),m=X.useRef(null),h=X.useRef(null),g=X.useRef(null),_=X.useRef(r),v=X.useRef(!0),y=X.useRef(null),b=X.useRef(n),x=X.useRef(null),S=X.useRef(0),C=X.useRef(0),w=X.useRef(null),T=X.useRef(null),E=X.useRef(null),D=X.useRef(null),O=X.useRef(null),k=X.useRef(null),A=X.useRef(null),j=X.useRef(null),M=X.useRef(new Set),N=X.useRef(new WeakSet);return E.current===null&&(E.current=rn(Ft,on)),j.current===null&&(j.current=an()),i.current=e,c.current=t,b.current=n,_.current=r,{autoScrollRef:i,autoscrollingRef:a,autoscrollingTimeoutRef:D,streamingTurnRef:g,contentRef:o,defaultScrollPositionAppliedRef:s,firstItemRef:u,itemCountRef:l,lastScrollTopRef:d,messageElementsRef:p,modeRef:f,pendingScrollFrameRef:x,pendingScrollToMessageRef:m,prependRestoreRef:h,preserveScrollOnPrependRef:v,rootRef:y,scrollEdgeThresholdRef:c,scrollMarginRef:b,scrollPreviousItemPeekRef:_,spacerGapRef:S,spacerHeightRef:C,spacerRef:w,stateFrameRef:T,stateStore:E.current,viewportRef:O,visibilityFrameRef:k,visibilityObserverRef:A,visibilityStore:j.current,visibleMessageIdsRef:M,handledScrollAnchorsRef:N}}function ln(e,t){return X.useCallback(n=>{e.current=n,n&&t()},[e,t])}function un({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=kt,scrollPreviousItemPeek:r=At,scrollMargin:i=jt}){let a=cn({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:v,prependRestoreRef:y,preserveScrollOnPrependRef:b,rootRef:x,scrollEdgeThresholdRef:S,scrollMarginRef:C,scrollPreviousItemPeekRef:w,spacerGapRef:T,spacerHeightRef:E,spacerRef:D,stateFrameRef:O,stateStore:k,viewportRef:A,visibilityFrameRef:j,visibilityObserverRef:M,visibilityStore:N,visibleMessageIdsRef:P,handledScrollAnchorsRef:F}=a,I=X.useRef(t);I.current!==t&&(I.current=t,d.current=!1);let L=X.useCallback(e=>{let t=x.current,n=A.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),ee=X.useCallback(e=>{let t=A.current?.scrollTop??0,n=t<m.current-Mt;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),R=X.useCallback(()=>{let e=Lt({content:u.current,scrollEdgeThreshold:S.current,spacer:D.current,viewport:A.current});ee(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;L(t),k.setSnapshot(t)},[ee,k,L]),te=X.useCallback(()=>{O.current===null&&(O.current=window.requestAnimationFrame(()=>{O.current=null,R()}))},[R]),z=X.useCallback(()=>{N.hasListeners()&&j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null,N.hasListeners()&&N.setSnapshot(Rt({content:u.current,scrollMargin:C.current,scrollPreviousItemPeek:w.current,spacer:D.current,viewport:A.current,visibleMessageIds:P.current}))}))},[N]),{flushPendingScrollToMessage:B,reanchorToAnchoredMessage:ne,scrollToElement:re,scrollToEnd:V,scrollToMessage:ie,scrollToStart:ae}=tn({refs:a,commitScrollState:R,scheduleStateCommit:te,scheduleVisibilitySync:z}),oe=X.useCallback(()=>{let e=y.current,t=A.current;if(!e||!t||!e.element.isConnected)return!1;let n=qt(e.element,t)-e.viewportTop;return Math.abs(n)<=Mt?!1:(t.scrollTop+=n,e.viewportTop=qt(e.element,t),te(),z(),!0)},[te,z]),H=X.useCallback(()=>{let e=u.current,t=A.current;if(!e||!t){y.current=null;return}let n=Wt({content:e,spacer:D.current,viewport:t});y.current=n?{element:n,viewportTop:qt(n,t)}:null},[]),se=X.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,B()&&H()}))},[H,B]),ce=X.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=A.current,r=t&&n?Ut(zt(t,D.current)):null;if(!t||!n||!r)e=V({behavior:`auto`});else{let i=Kt(r,n);e=Yt({content:t,spacer:D.current,viewport:n})-i<=n.clientHeight?V({behavior:`auto`}):re(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?V({behavior:`auto`}):ae({behavior:`auto`});return e?(d.current=!0,!0):!1},[t,re,V,ae]),le=X.useCallback(()=>{let e=u.current;if(!e)return;let t=zt(e,D.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(B())return;if(n===0){if(ce()||t.length>0&&s.current&&V({behavior:`auto`}))return;R(),z();return}let e=r?t.indexOf(r):-1;if(b.current&&e>0){oe();return}if(t.length>n){let e=Bt(t,n);if(e){if(s.current&&g.current===`following-bottom`&&Ht(t,n)){V({behavior:`auto`});return}re(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}if(t.length===n){let e=Vt(t,F.current);if(e){re(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}g.current===`following-bottom`&&s.current?V({behavior:`auto`}):(R(),z())})(),H()},[ce,H,R,B,oe,z,re,V]),ue=X.useCallback(()=>{if(g.current===`following-bottom`&&s.current){V({behavior:`auto`});return}let e=E.current;if(ne()){s.current&&e>0&&E.current===0&&V({behavior:`auto`});return}te(),z()},[ne,te,z,V]),de=X.useCallback(()=>{let e=A.current;if(!(!e||!N.hasListeners())){if(typeof IntersectionObserver>`u`){z();return}M.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?P.current.add(e):P.current.delete(e))}z()},{root:e,rootMargin:`${-(C.current+w.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{M.current?.observe(e)}),z()}},[z,N]),U=X.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),M.current?.disconnect(),M.current=null,P.current.clear(),N.setSnapshot(It)},[N]),W=X.useCallback((e,t,n)=>{if(t){h.current.set(e,t),M.current?.observe(t),z(),v.current?.messageId===e&&se();return}n&&h.current.get(e)===n&&(h.current.delete(e),P.current.delete(e),M.current?.unobserve(n),z())},[se,z]),G=X.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),K=X.useCallback(()=>L(k.getSnapshot()),[k,L]),fe=ln(x,K),pe=ln(A,K),me=X.useCallback(e=>{u.current=e},[]),q=X.useCallback(e=>{D.current=e,T.current=$t(e?.parentElement??null)},[]),he=X.useCallback(()=>{R(),z(),H()},[H,R,z]),ge=X.useMemo(()=>({handleContentChange:le,handleResize:ue,observeVisibility:de,preserveScrollOnPrependRef:b,scrollToEnd:V,scrollToMessage:ie,scrollToStart:ae,setContentElement:me,setRootElement:fe,setSpacerElement:q,setViewportElement:pe,stateStore:k,syncAfterScroll:he,unobserveVisibility:U,userScrollIntent:G,viewportRef:A,visibilityStore:N}),[le,ue,de,V,ie,ae,me,fe,q,pe,k,he,U,G,N]);return X.useLayoutEffect(()=>{ce()},[ce]),X.useEffect(()=>()=>{O.current!==null&&(window.cancelAnimationFrame(O.current),O.current=null),j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),M.current?.disconnect(),M.current=null},[]),X.useLayoutEffect(()=>{if(e&&g.current===`following-bottom`&&p.current>0){V({behavior:`auto`});return}R()},[e,R,V]),{context:ge,registerMessage:W}}function dn(e){let t=X.useRef(e);return t.current=e,t}var fn=X.createContext(null),pn=X.createContext(null);function mn(){let e=X.useContext(fn);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function hn(){let e=X.useContext(pn);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function gn(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=mn();return X.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function _n({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=un({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,Z.jsx)(fn.Provider,{value:o,children:(0,Z.jsx)(pn.Provider,{value:s,children:t})})}function vn({children:e,...t}){let{setRootElement:n}=mn();return(0,Z.jsx)(`div`,{ref:n,...t,children:e})}function yn({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=mn();f.current=o;let _=X.useCallback(e=>{p(e),Ot(s)?.(e)},[s,p]);function v(e){m(),r?.(e)}function y(e){h(),a?.(e)}function b(e){h(),i?.(e)}function x(e){Pt.has(e.key)&&h(),n?.(e)}return X.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,Z.jsx)(`div`,{ref:_,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:x,onScroll:v,onTouchMove:b,onWheel:y,...u,children:t})}function bn({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=mn(),u=X.useRef(null),d=X.useCallback(e=>{u.current=e,c(e),Ot(n)?.(e)},[n,c]);return X.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),X.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,Z.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,Z.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function xn({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=hn(),a=X.useRef(null);return(0,Z.jsx)(`div`,{ref:X.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),Ot(t)?.(n)},[e,t,i]),"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function Sn({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=mn(),d=dn(r),f=X.useCallback(e=>u.subscribe(e),[u]),p=X.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=X.useSyncExternalStore(f,p,p),h=X.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return Ct({defaultTagName:`button`,props:wt({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,Z.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var Cn={Provider:_n,Root:vn,Viewport:yn,Content:bn,Item:xn,Button:Sn};function wn(e){let t=(0,Y.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Cn.Provider,{...e}),t[0]=e,t[1]=n),n}function Tn(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=b(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Cn.Root,{"data-slot":`message-scroller`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function En(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=b(`size-full min-h-0 min-w-0 scrollbar-thin overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Cn.Viewport,{"data-slot":`message-scroller-viewport`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Dn(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=b(`flex h-max min-h-full flex-col gap-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Cn.Content,{"data-slot":`message-scroller-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function On(e){let t=(0,Y.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scrollAnchor:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?!1:i,o;t[4]===n?o=t[5]:(o=b(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(Cn.Item,{"data-slot":`message-scroller-item`,scrollAnchor:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function kn(e){let t=(0,Y.c)(25),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({direction:o,className:r,children:n,render:a,variant:s,size:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?`end`:o,u=s===void 0?`secondary`:s,d=c===void 0?`icon-sm`:c,f;t[8]===r?f=t[9]:(f=b(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,r),t[8]=r,t[9]=f);let p;t[10]!==a||t[11]!==d||t[12]!==u?(p=a??(0,Z.jsx)(C,{variant:u,size:d}),t[10]=a,t[11]=d,t[12]=u,t[13]=p):p=t[13];let m;t[14]!==n||t[15]!==l?(m=n??(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:l===`end`?(0,Z.jsx)(h,{id:`EQXPXf`}):(0,Z.jsx)(h,{id:`b1FDss`})})]}),t[14]=n,t[15]=l,t[16]=m):m=t[16];let g;return t[17]!==l||t[18]!==i||t[19]!==d||t[20]!==f||t[21]!==p||t[22]!==m||t[23]!==u?(g=(0,Z.jsx)(Cn.Button,{"data-slot":`message-scroller-button`,"data-direction":l,"data-variant":u,"data-size":d,direction:l,className:f,render:p,...i,children:m}),t[17]=l,t[18]=i,t[19]=d,t[20]=f,t[21]=p,t[22]=m,t[23]=u,t[24]=g):g=t[24],g}var An=new Map,jn=0;function Mn(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function Nn(){let e=Mn();for(let[t,n]of An)t((e-n)/1e3);if(An.size===0){jn=0;return}jn=requestAnimationFrame(Nn)}function Pn(e){return An.set(e,Mn()),jn===0&&typeof requestAnimationFrame==`function`&&(jn=requestAnimationFrame(Nn)),()=>{An.delete(e),An.size===0&&jn!==0&&(cancelAnimationFrame(jn),jn=0)}}var Q=40,Fn=15,In=15,$=12.4,Ln={blobby:0,triangle:1,square:2,sparkle:3,pentagon:4,hexagon:5,dot:6,star5:7,clover:8,star6:9,scallop:10,comma:11,diamond:12,cloud:13},Rn=`M15.34 2.91C15.96 2.77 16.69 2.65 17.33 2.63C17.97 2.62 18.72 2.71 19.36 2.84C20.00 2.97 20.79 3.10 21.33 3.44C21.88 3.79 22.38 4.46 22.75 5.01C23.12 5.56 23.42 6.30 23.66 6.89C23.90 7.49 24.06 8.18 24.26 8.73C24.45 9.28 24.66 9.84 24.89 10.34C25.12 10.84 25.39 11.36 25.68 11.85C25.97 12.34 26.46 12.87 26.71 13.41C26.96 13.94 27.12 14.61 27.26 15.21C27.39 15.80 27.54 16.52 27.55 17.14C27.56 17.76 27.43 18.47 27.30 19.09C27.16 19.71 26.99 20.43 26.72 21.01C26.46 21.58 26.05 22.20 25.64 22.69C25.22 23.17 24.65 23.63 24.15 24.02C23.66 24.41 23.09 24.82 22.55 25.14C22.02 25.45 21.39 25.74 20.84 25.99C20.28 26.25 19.65 26.52 19.08 26.70C18.50 26.89 17.83 27.05 17.23 27.15C16.63 27.26 15.95 27.34 15.34 27.37C14.73 27.39 14.03 27.40 13.42 27.33C12.81 27.26 12.12 27.10 11.54 26.92C10.95 26.73 10.30 26.47 9.75 26.18C9.20 25.90 8.62 25.51 8.11 25.15C7.61 24.80 7.06 24.37 6.60 23.94C6.15 23.52 5.68 23.00 5.28 22.52C4.89 22.03 4.47 21.45 4.13 20.92C3.79 20.38 3.41 19.75 3.16 19.16C2.91 18.57 2.68 17.86 2.56 17.23C2.45 16.60 2.42 15.85 2.45 15.21C2.48 14.56 2.60 13.83 2.76 13.22C2.93 12.60 3.18 11.91 3.47 11.35C3.77 10.80 4.24 10.23 4.63 9.75C5.01 9.27 5.45 8.74 5.89 8.34C6.34 7.95 6.93 7.61 7.40 7.27C7.88 6.94 8.38 6.57 8.83 6.25C9.29 5.93 9.79 5.56 10.27 5.25C10.75 4.95 11.29 4.61 11.81 4.33C12.32 4.05 12.92 3.74 13.49 3.52C14.05 3.29 14.73 3.05 15.34 2.91Z`,zn=2.26,Bn=`M76.4805 11.041C99.1124 7.04848 118.186 8.33731 134.31 14.4102C150.369 20.4588 164.177 31.5065 175.929 48.1846L176.446 48.9199C187.179 64.5695 195.653 90.2797 191.323 112.539C186.344 138.13 169.219 160.474 150.105 178.107C131.113 195.629 111.037 207.691 101.728 212.842C98.3779 214.693 93.3915 217.316 88.0508 217.316C85.74 217.316 83.6583 216.814 81.7607 215.855L81.3838 215.658C75.1451 212.251 73.9381 205.91 73.376 198.68L73.2705 197.222C72.953 192.5 72.5095 188.039 71.1416 184.247C69.5395 179.806 66.852 176.673 63.1406 174.227L63.1377 174.225C41.2846 159.832 21.8495 144.226 13.3828 121.439L13.3818 121.438L13.0146 120.427C5.46004 99.1404 7.95139 74.5467 20.4404 52.7568L20.4414 52.7549C33.2945 30.3176 54.4303 14.925 76.4785 11.041H76.4805Z`;function Vn(e){let t=t=>{let n=e[(t-1+Q)%Q],r=e[(t+1)%Q];return[(r[0]-n[0])*.16,(r[1]-n[1])*.16]},n=`M${e[0][0].toFixed(2)} ${e[0][1].toFixed(2)}`;for(let r=0;r<Q;r++){let i=e[r],a=e[(r+1)%Q],o=t(r),s=t((r+1)%Q);n+=`C${(i[0]+o[0]).toFixed(2)} ${(i[1]+o[1]).toFixed(2)} ${(a[0]-s[0]).toFixed(2)} ${(a[1]-s[1]).toFixed(2)} ${a[0].toFixed(2)} ${a[1].toFixed(2)}`}return`${n}Z`}function Hn(e,t){let n=e.map(e=>e[0]),r=e.map(e=>e[1]),i=Math.min(...n),a=Math.max(...n),o=Math.min(...r),s=Math.max(...r),c=t*2/Math.max(a-i,s-o);return e.map(e=>[Fn+(e[0]-(i+a)/2)*c,In+(e[1]-(o+s)/2)*c])}function Un(e,t,n){let r=e;for(let e=0;e<t;e++){let e=r;r=e.map((t,r)=>{let i=e[(r-1+Q)%Q],a=e[(r+1)%Q];return[t[0]*(1-n)+(i[0]+a[0])/2*n,t[1]*(1-n)+(i[1]+a[1])/2*n]})}return r}function Wn(){if(typeof document>`u`)return null;let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`width`,`0`),e.setAttribute(`height`,`0`),e.style.position=`absolute`,e.style.visibility=`hidden`;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);if(e.appendChild(t),document.body.appendChild(e),typeof t.getTotalLength!=`function`||typeof t.getPointAtLength!=`function`)return e.remove(),null;try{t.setAttribute(`d`,`M0 0L1 0`),t.getPointAtLength(0)}catch{return e.remove(),null}return t}function Gn(e){function t(t,n){e.setAttribute(`d`,t);let r=e.getTotalLength(),i=[];for(let t=0;t<n;t++){let a=e.getPointAtLength(r*t/n);i.push([a.x,a.y])}return i}function n(e){let t=0,n=0;for(let r of e)t+=r[0],n+=r[1];t/=e.length,n/=e.length;let r=Array(Q).fill(0),i=Array(Q).fill(1/0);for(let a of e){let e=Math.atan2(a[1]-n,a[0]-t),o=Math.hypot(a[0]-t,a[1]-n),s=Math.round((e+Math.PI/2)/(2*Math.PI)*Q);s=(s%Q+Q)%Q,o>r[s]&&(r[s]=o),o<i[s]&&(i[s]=o)}return{cx:t,cy:n,hi:r,lo:i}}function r(e,t,n){return e.map((e,r)=>{let i=-Math.PI/2+r*2*Math.PI/Q;return[t+Math.cos(i)*e,n+Math.sin(i)*e]})}function i(e,i){let{cx:a,cy:o,hi:s,lo:c}=n(t(e,1080)),l=s.map((e,t)=>(e+c[t])/2),u=s.reduce((e,t,n)=>e+(t-c[n]),0)/Q,d=r(l,a,o),f=d.map(e=>e[0]),p=d.map(e=>e[1]),m=i*2/Math.max(Math.max(...f)-Math.min(...f),Math.max(...p)-Math.min(...p));return{path:Vn(Hn(d,i)),strokeWidth:u*m}}function a(e,i){let{cx:a,cy:o,hi:s}=n(t(e,1400));return Vn(Hn(r(s.map((e,t)=>s[t]*.86+(s[(t-1+Q)%Q]+s[(t+1)%Q])*.07),a,o),i))}function o(e,n){return Vn(Hn(t(e,Q),n))}function s(e,n,r){return Vn(Un(t(e,Q),n,r))}function c(e,n,r){return Vn(t(e,Q).map(e=>[Fn+(e[0]-Fn)*n,In+(e[1]-In)*r]))}function l(e,n,r=1){return Vn(t(e,Q).map((e,t)=>{let i=t*2*Math.PI/Q,a=1+r*(.035*Math.sin(i*3+n)+.025*Math.sin(i*5+n*2)+.018*Math.sin(i*2-n));return[Fn+(e[0]-Fn)*a,In+(e[1]-In)*a]}))}function u(e,t,n,r=0){let i=[];for(let n=0;n<e;n++){let a=-Math.PI/2+n*2*Math.PI/e+r;i.push([Fn+Math.cos(a)*t,In+Math.sin(a)*t])}let a=(e,t)=>{let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r);return[n/i,r/i]},o=``;for(let t=0;t<e;t++){let r=i[t],s=a(r,i[(t-1+e)%e]),c=a(r,i[(t+1)%e]),l=[r[0]+s[0]*n,r[1]+s[1]*n],u=[r[0]+c[0]*n,r[1]+c[1]*n];o+=`${t?`L`:`M`}${l[0].toFixed(2)} ${l[1].toFixed(2)}A${n} ${n} 0 0 1 ${u[0].toFixed(2)} ${u[1].toFixed(2)}`}return`${o}Z`}function d(e,n,r,i){let a=``;for(let t=0;t<e*2;t++){let i=-Math.PI/2+t*Math.PI/e,o=t%2?r:n;a+=`${t?`L`:`M`}${(Fn+Math.cos(i)*o).toFixed(2)} ${(In+Math.sin(i)*o).toFixed(2)}`}return Vn(Hn(Un(t(`${a}Z`,Q),i,.3),n))}function f(e,n,r){let i=t=>{let n=-Math.PI/2+t*Math.PI/2;return[Fn+Math.cos(n)*e,In+Math.sin(n)*e]},a=`M${i(0)[0].toFixed(2)} ${i(0)[1].toFixed(2)}`;for(let e=0;e<4;e++){let t=-Math.PI/2+(e+.5)*Math.PI/2,r=[Fn+Math.cos(t)*n,In+Math.sin(t)*n],o=i((e+1)%4);a+=`Q${r[0].toFixed(2)} ${r[1].toFixed(2)} ${o[0].toFixed(2)} ${o[1].toFixed(2)}`}return Vn(Hn(Un(t(`${a}Z`,Q),r,.34),e))}function p(e,t,n,r){let i=[];for(let a=0;a<Q;a++){let o=-Math.PI/2+a*2*Math.PI/Q,s=(1+Math.cos(e*(o+Math.PI/2)))/2,c=n+(t-n)*s**r;i.push([Fn+Math.cos(o)*c,In+Math.sin(o)*c])}return Vn(i)}function m(e){let t=[];for(let n=0;n<Q;n++){let r=-Math.PI/2+n*2*Math.PI/Q;t.push([Fn+Math.cos(r)*e,In+Math.sin(r)*e])}return Vn(t)}return{silhouette:i,hull:a,fit:o,soften:s,squeeze:c,wobble:l,poly:u,star:d,sparkle:f,lobed:p,dot:m,circle:(e,t,n)=>`M${e-n} ${t}a${n} ${n} 0 1 0 ${n*2} 0a${n} ${n} 0 1 0 ${-n*2} 0`}}function Kn(){let e=Wn();if(e===null)return null;try{let t=Gn(e),n=t.silhouette(S,12.55);return{paths:[n.path,t.wobble(t.poly(3,$*1.16,$*.5,.1),1.1),t.wobble(t.poly(4,$*1.02,$*.44),2.3),t.wobble(t.sparkle($*1.24,$*.1,3),3.7),t.wobble(t.poly(5,$*1,$*.38),4.9),t.wobble(t.poly(6,$*.98,$*.34),6.2),t.wobble(t.dot($*.34),2.8),t.wobble(t.star(5,$*1.14,$*.68,6),7.4),t.wobble(t.soften(t.lobed(4,$*1.16,$*.46,.5),3,.3),8.1),t.wobble(t.star(6,$*1.2,$*.42,4),9.3),t.wobble(t.lobed(8,$*1.06,$*.74,.6),10.5),t.wobble(t.soften(t.fit(Bn,$*1.12),3,.22),11.7,.3),t.wobble(t.squeeze(t.poly(4,$*1.3,$*.2),.84,1),12.9),t.wobble(t.hull(t.circle(10.2,16,4.3)+t.circle(15,12,5.5)+t.circle(20,15.4,4.4)+t.circle(15,17.4,5.2),12.4),13.6)],strokeWidth:n.strokeWidth}}finally{e.ownerSVGElement?.remove()}}var qn;function Jn(){return qn===void 0&&(qn=Kn()),qn}var Yn=/-?\d+(?:\.\d+)?/g;function Xn(e){return{fragments:e[0].split(Yn),numbers:e.map(e=>(e.match(Yn)??[]).map(Number))}}function Zn(e,t){let n=``;for(let r=0;r<t.length;r++)n+=e[r]+t[r].toFixed(2);return n+e[t.length]}function Qn(e){return e<.5?2*e*e:1-2*(1-e)**2}var $n=.58;function er(e,t,n,r){let i=t-1,a=n/i,o=e%n,s=Math.max(0,Math.min(i-1,Math.floor(o/a))),c=o%a/a;return{from:s,to:s+1,t:Qn(r?Math.min(1,c/$n):c)}}var tr=Ln,nr=[tr.blobby,tr.triangle,tr.square,tr.sparkle,tr.comma,tr.pentagon,tr.hexagon,tr.blobby],rr={[tr.comma]:-2.9},ir={leftCx:10.9,rightCx:18.1,cy:16,rx:1.25,ry:1.9},ar=20,or=8.4;function sr(e){let t=(0,Y.c)(22),{status:n,className:r,testId:i}=e,{_:a}=g(),o=(0,X.useRef)(null),s=(0,X.useRef)(null),c=Ee(),l,u;t[0]===c?(l=t[1],u=t[2]):(l=()=>{let e=o.current;if(e===null)return;if(c){e.setAttribute(`d`,Rn),e.setAttribute(`stroke-width`,String(zn)),s.current?.removeAttribute(`transform`);return}let t=Jn();if(t===null)return;e.setAttribute(`stroke-width`,t.strokeWidth.toFixed(2));let n=Xn(t.paths),r=NaN,i=``;return Pn(t=>{let{from:a,to:o,t:c}=er(t,nr.length,or,!0),l=n.numbers[nr[a]],u=n.numbers[nr[o]],d=l.map((e,t)=>e+(u[t]-e)*c),f=Zn(n.fragments,d);f!==i&&(i=f,e.setAttribute(`d`,f));let p=s.current;if(p===null)return;let m=rr[nr[a]]??0,h=m+((rr[nr[o]]??0)-m)*c;h!==r&&(r=h,p.setAttribute(`transform`,`translate(0 ${h.toFixed(2)})`))})},u=[c],t[0]=c,t[1]=l,t[2]=u),(0,X.useEffect)(l,u);let[d,f]=(0,X.useState)(``),p,m;t[3]===a?(p=t[4],m=t[5]):(p=()=>{f(a({id:`DCSSZt`}))},m=[a],t[3]=a,t[4]=p,t[5]=m),(0,X.useEffect)(p,m);let h;t[6]===r?h=t[7]:(h=b(`ok-working-enter flex items-center gap-2`,r),t[6]=r,t[7]=h);let _;t[8]===d?_=t[9]:(_=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,role:`status`,children:d}),t[8]=d,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(`path`,{ref:o,d:Rn,fill:`none`,stroke:`currentColor`,strokeWidth:zn,strokeLinejoin:`round`,strokeLinecap:`round`}),t[10]=v):v=t[10];let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`grid shrink-0 place-items-center text-muted-foreground/80`,children:(0,Z.jsx)(`svg`,{width:ar,height:ar,viewBox:`0 0 30 30`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`ok-working-pop ok-working-squint block shrink-0 overflow-visible`,children:(0,Z.jsxs)(`g`,{className:`ok-working-group`,children:[v,(0,Z.jsxs)(`g`,{ref:s,children:[(0,Z.jsx)(`ellipse`,{className:`ok-working-eye`,cx:ir.leftCx,cy:ir.cy,rx:ir.rx,ry:ir.ry,fill:`currentColor`}),(0,Z.jsx)(`ellipse`,{className:`ok-working-eye`,cx:ir.rightCx,cy:ir.cy,rx:ir.rx,ry:ir.ry,fill:`currentColor`})]})]})})}),t[11]=y):y=t[11];let x;t[12]===n?x=t[13]:(x=(0,Z.jsx)(`span`,{className:`shimmer`,children:n}),t[12]=n,t[13]=x);let S;t[14]!==n||t[15]!==x?(S=(0,Z.jsx)(`span`,{className:`ok-working-status text-sm`,children:x},n),t[14]=n,t[15]=x,t[16]=S):S=t[16];let C;return t[17]!==S||t[18]!==h||t[19]!==_||t[20]!==i?(C=(0,Z.jsxs)(`div`,{className:h,"data-testid":i,children:[_,y,S]}),t[17]=S,t[18]=h,t[19]=_,t[20]=i,t[21]=C):C=t[21],C}function cr(e){let t=[];for(let n of e.options)`value`in n?t.push(n):t.push(...n.options);return t}function lr(e){let t=cr(e),n=t.find(t=>t.value===e.currentValue);if(n===void 0||n.value!==`default`||!n.description)return null;let r=t.find(e=>e.value!==n.value&&e.description===n.description);return r===void 0?null:J._({id:`GK5Ft_`,values:{0:r.name}})}function ur(e,t,n){return e===`claude-acp`&&t===`effort`&&n===`default`?J._({id:`3SWNP8`}):e===`codex-acp`&&t===`collaboration_mode`&&n===`default`?J._({id:`R6ABfU`}):null}var dr=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),fr=700*1024;function pr(e){if(e.kind===`unsupported-type`)return e.mimeType.startsWith(`image/`)?`Only PNG, JPEG, GIF, and WebP images are supported (got ${e.mimeType}).`:`Unsupported file type: ${e.mimeType||`unknown`}.`;if(e.kind===`outside-workspace`)return`${e.name} is outside the workspace. Move it into your project first.`;if(e.kind===`unknown-path`)return`${e.name} has no resolvable path — the agent can only read files inside the workspace.`;let t=(e.limitBytes/(1024*1024)).toFixed(1);return`File is too large (${(e.sizeBytes/(1024*1024)).toFixed(1)} MB) — max ${t} MB per attachment.`}async function mr(e){let t=await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`FileReader failed`)),r.onload=()=>{let e=r.result;if(typeof e!=`string`){n(Error(`FileReader returned non-string result`));return}t(e)},r.readAsDataURL(e)}),n=t.indexOf(`,`);return{data:n>=0?t.slice(n+1):t,mimeType:e.type||`application/octet-stream`,name:e.name||`image`,sizeBytes:e.size}}async function hr(e){let t=e.type||``;if(!dr.has(t))return{ok:!1,error:{kind:`unsupported-type`,mimeType:t}};if(e.size>716800)return{ok:!1,error:{kind:`too-large`,sizeBytes:e.size,limitBytes:fr}};let n=await mr(e);return{ok:!0,part:{kind:`image`,data:n.data,mimeType:n.mimeType,name:n.name,sizeBytes:n.sizeBytes}}}function gr(e){return vr(e,e=>e.type.startsWith(`image/`))}function _r(e){return vr(e,e=>e.size>0)}function vr(e,t){if(e===null)return[];let n=[],r=e=>{e!==null&&t(e)&&n.push(e)},i=!1,a=e.items;if(a)for(let e=0;e<a.length;e+=1){let t=a[e];if(!t||t.kind!==`file`)continue;let n=t.getAsFile();n!==null&&(i=!0,r(n))}if(!i){let t=e.files;if(t)for(let e=0;e<t.length;e+=1)r(t[e]??null)}return n}function yr(e,t,n){let r=n===`\\`?e.toLowerCase():e,i=n===`\\`?t.toLowerCase():t,a=i.endsWith(n)?i:`${i}${n}`;if(r===i)return``;if(!r.startsWith(a))return null;let o=e.slice(a.length);return n===`\\`?o.replaceAll(`\\`,`/`):o}async function br(e,t={}){if((e.type||``).startsWith(`image/`))return hr(e);let n=t.absPathOf,r=t.workspaceContentDir,i=t.pathSeparator??`/`,a=e.name||`attachment`;if(n===void 0||r===void 0||r===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let o=n(e);if(o===null||o===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let s=yr(o,r,i);return s===null?{ok:!1,error:{kind:`outside-workspace`,name:a}}:{ok:!0,part:{kind:`file`,path:s,name:a}}}var xr=3,Sr=xr*2+2;function Cr(e){let t=e.split(`
|
|
2
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{Ar as r,Jr as i,Xn as a,dr as o,er as s,i as c,ir as l,k as u,nr as d,or as f,rr as p}from"./DocumentContext-CZ1LyjXH.js";import{t as m}from"./react-f2sANaYj.js";import{n as h,r as g}from"./dist-Nvb76hAm.js";import{t as _}from"./compiler-runtime-BfE3aGVn.js";import{i as v,o as y}from"./local-menu-action-bus-BLEUyEvu.js";import{t as b}from"./utils-CPqDy6Hr.js";import{n as x,r as S}from"./clipboard-adapter-815RzzoI.js";import{t as C}from"./button-Cym3gapE.js";import{i as w,n as T,t as E}from"./tooltip-DttaCTqz.js";import{c as D,i as O,t as k}from"./dialog-CTNat3T_.js";import{Tt as A}from"./CodeMirrorPropInput-Be4UuxHJ.js";import{a as j,c as M,d as N,f as P,i as F,l as I,m as L,n as ee,o as R,p as te,r as z,t as B,u as ne}from"./dropdown-menu-CRvS0_4-.js";import{a as re,c as V,d as ie,f as ae,i as oe,l as H,n as se,o as ce,p as le,r as ue,s as de,t as U,u as W,v as G,y as K}from"./progress-YLRB2n7w.js";import{n as fe}from"./separator-C6x7j8mC.js";import{t as pe}from"./switch-iwBsEWej.js";import{b as me,d as q,t as he}from"./RegisteredAgentIcon-CDl1h-4U.js";import{Qr as ge,pt as _e}from"./dist-As2x8uCt.js";import{n as ve}from"./dist-CJhtNlOm2.js";import{t as J}from"./dist-Cr4-nBVI.js";import{g as ye,p as be,r as xe}from"./launcher-selection-DTBWt8s2.js";import{n as Se}from"./use-workspace-DRylP9vX.js";import{t as Ce}from"./createLucideIcon-BulbvLvN.js";import{c as we,d as Te,r as Ee}from"./Mermaid-B4Oa2diB.js";import{t as De}from"./check-Dut4Aov8.js";import{t as Oe}from"./chevron-down-DNO3PgI_.js";import{t as ke}from"./chevron-right-4mYNnAZZ.js";import{o as Ae,r as je,s as Me}from"./prop-types-CTZ-Zcfm.js";import{n as Ne,t as Pe}from"./terminal-D4HSnHXf.js";import{t as Fe}from"./list-plus-nPRgk4Qi.js";import{t as Ie}from"./spinner-t7GahFcQ.js";import{c as Le,n as Re,o as ze,s as Be,t as Ve}from"./comment-chips-mYvhrkxj.js";import{t as He}from"./square-pen-CBGVrQUa.js";import{t as Ue}from"./trash-2-DSqYvaPJ.js";import{t as We}from"./triangle-alert-GeclLtDN.js";import{t as Ge}from"./wrench-DcVBYiNl.js";import{t as Ke}from"./x-DbShSCr5.js";import{f as qe,s as Je}from"./doc-paths-BkNaaTOB.js";import{t as Ye}from"./external-link-B0bVg1hn.js";import{t as Xe}from"./badge-BWfmbBoh.js";import{t as Ze}from"./skeleton-BZIHOzZH.js";import{t as Qe}from"./textarea-BoMa_3jF.js";import{n as $e}from"./agent-presence-3JajMNAq.js";import{i as et,n as tt}from"./chunk-BO2N2NFS-DkbHWaGq.js";import{n as nt}from"./libesm-mBLacfDP.js";import{a as rt,d as it,f as at,m as ot,n as st,p as ct,r as lt,s as ut}from"./thread-client-C32zww5K.js";import{i as dt,n as ft}from"./launch-agent-thread-Cb_G0uH0.js";var pt=Ce(`folder-input`,[[`path`,{d:`M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1`,key:`fm4g5t`}],[`path`,{d:`M2 13h10`,key:`pgb2dq`}],[`path`,{d:`m9 16 3-3-3-3`,key:`6m91ic`}]]),mt=Ce(`mouse-pointer-2`,[[`path`,{d:`M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z`,key:`edeuup`}]]),ht=Ce(`shuffle`,[[`path`,{d:`m18 14 4 4-4 4`,key:`10pe0f`}],[`path`,{d:`m18 2 4 4-4 4`,key:`pucp1d`}],[`path`,{d:`M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22`,key:`1ailkh`}],[`path`,{d:`M2 6h1.972a4 4 0 0 1 3.6 2.2`,key:`km57vx`}],[`path`,{d:`M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45`,key:`os18l9`}]]),gt=Ce(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),Y=_(),_t=new RegExp([`bypass`,`acceptedits`,`fullaccess`,`autoedit`,`yolo`,`danger`,`fullauto`,`autoaccept`,`autoapprove`,`autorun`,`skippermission`,`noconfirm`,`noprompt`,`unrestricted`,`allowall`].join(`|`)),vt=new Set([`auto`]);function yt(e){return e.toLowerCase().replace(/[^a-z]/g,``)}function bt(e){let t=yt(e.id),n=yt(e.name??``);return vt.has(t)||vt.has(n)?!0:_t.test(t)||_t.test(n)}var xt={"claude-acp":`asks`,"codex-acp":`self-managed`,cursor:`self-managed`,"pi-acp":`autonomous`};function St(e,t,n){let r=n??(t==null?null:t.availableModes.find(e=>e.id===t.currentModeId)??null),i=xt[e];return i===void 0?t!=null&&t.availableModes.length>0?`self-managed`:`unknown`:i===`asks`&&r!==null&&bt(r)?`self-managed`:i}var X=e(m(),1),Z=n();function Ct({defaultTagName:e,props:t,render:n,state:r={},stateAttributesMapping:i}){let a=wt(Tt(r,i),t);if(!n)return X.createElement(e,a);if(typeof n==`function`)return n(a,r);if(!X.isValidElement(n))return null;let o=n.props,s={...wt(a,o),ref:Ot(a.ref,o.ref)};return X.cloneElement(n,s)}function wt(...e){let t={};for(let n of e){if(!n)continue;let e=n;for(let n of Object.keys(e)){let r=e[n];if(r===void 0)continue;let i=t[n];n===`className`?t[n]=[i,r].filter(Boolean).join(` `):n===`style`?t[n]={...i,...r}:n===`ref`?t[n]=Ot(i,r):Dt(n)&&typeof i==`function`&&typeof r==`function`?t[n]=Et(r,i):t[n]=r}}return t}function Tt(e,t){let n={};for(let r of Object.keys(e)){let i=e[r],a=t?.[r]?.(i);if(a){Object.assign(n,a);continue}if(r===`slot`){n[`data-slot`]=i;continue}let o=`data-${String(r).replace(/[A-Z]/g,e=>`-${e.toLowerCase()}`)}`;typeof i==`boolean`?n[o]=i?``:void 0:i!=null&&(n[o]=String(i))}return n}function Et(e,t){return function(n){e(n),n.defaultPrevented||t(n)}}function Dt(e){return/^on[A-Z]/.test(e)}function Ot(...e){let t=e.filter(Boolean);if(t.length!==0)return e=>{for(let n of t)typeof n==`function`?n(e):n&&(n.current=e)}}var kt=8,At=64,jt=0,Mt=.5,Nt=180,Pt=new Set([`ArrowDown`,`ArrowUp`,`End`,`Home`,`PageDown`,`PageUp`,` `]),Ft={start:!1,end:!1},It={currentAnchorId:null,visibleMessageIds:[]};function Lt({content:e,scrollEdgeThreshold:t,spacer:n,viewport:r}){if(!r||!e)return Ft;let i=Yt({content:e,spacer:n,viewport:r});return{start:r.scrollTop>t,end:i-r.scrollTop-r.clientHeight>t}}function Rt({content:e,scrollMargin:t,scrollPreviousItemPeek:n,spacer:r,viewport:i,visibleMessageIds:a}){if(!e||!i)return It;let o=i.getBoundingClientRect(),s=o.top+t+n,c=typeof IntersectionObserver>`u`,l=[],u=null;for(let t of zt(e,r)){let e=t.dataset.messageId;if(!e)continue;let n=t.dataset.scrollAnchor===`true`,r=n||c?t.getBoundingClientRect():null;(c&&r?r.bottom>s&&r.top<o.bottom:a.has(e))&&l.push(e),n&&r&&r.top<=s+Mt&&(u=e)}return l.length===0&&u===null?It:{currentAnchorId:u,visibleMessageIds:l}}function zt(e,t){return Array.from(e.children).filter(e=>e instanceof HTMLElement&&e!==t)}function Bt(e,t){for(let n=t;n<e.length;n++){let t=e[n];if(t?.dataset.scrollAnchor===`true`)return t}return null}function Vt(e,t){for(let n of e)if(n.dataset.scrollAnchor===`true`&&!t.has(n))return n;return null}function Ht(e,t){let n=0;for(let r=t;r<e.length;r++)if(e[r]?.dataset.scrollAnchor===`true`&&(n+=1,n>1))return!0;return!1}function Ut(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.dataset.scrollAnchor===`true`)return n}return null}function Wt({content:e,spacer:t,viewport:n}){let r=n.getBoundingClientRect();for(let n of zt(e,t)){if(!n.dataset.messageId)continue;let e=n.getBoundingClientRect();if(e.bottom>r.top&&e.top<r.bottom)return n}return null}function Gt({align:e,element:t,scrollMargin:n,spacer:r,viewport:i}){let a=Kt(t,i),o=t.getBoundingClientRect().height,s=Qt(r);if(e===`center`){let e=Math.max(0,i.clientHeight-s.start-s.end);return a-s.start-(e-o)/2-n}if(e===`end`)return a-i.clientHeight+o+s.end+n;if(e===`nearest`){let e=a+o,t=i.scrollTop+s.start,r=i.scrollTop+i.clientHeight-s.end;return a>=t&&e<=r?i.scrollTop:a<t?a-s.start-n:e-i.clientHeight+s.end+n}return a-s.start-n}function Kt(e,t){let n=e.getBoundingClientRect(),r=t.getBoundingClientRect();return n.top-r.top+t.scrollTop}function qt(e,t){return e.getBoundingClientRect().top-t.getBoundingClientRect().top}function Jt({content:e,scrollTop:t,spacer:n,viewport:r}){let i=Yt({content:e,spacer:n,viewport:r});return t+r.clientHeight-i}function Yt({content:e,spacer:t,viewport:n}){let r=zt(e,t),i=Zt(e),a=n.getBoundingClientRect(),o=n.scrollTop,s=i.start+i.end;for(let e of r){let t=e.getBoundingClientRect();s=Math.max(s,t.bottom-a.top+o+i.end)}return s}function Xt(e){return Math.max(0,e.scrollHeight-e.clientHeight)}function Zt(e){let t=window.getComputedStyle(e);return{end:en(t.paddingBlockEnd||t.paddingBottom),start:en(t.paddingBlockStart||t.paddingTop)}}function Qt(e){let t=e?.parentElement;return t?Zt(t):{end:0,start:0}}function $t(e){if(!e)return 0;let t=window.getComputedStyle(e);return en(t.rowGap===`normal`?t.gap:t.rowGap)}function en(e){if(!e)return 0;let t=Number.parseFloat(e);return Number.isFinite(t)?t:0}function tn({refs:e,commitScrollState:t,scheduleStateCommit:n,scheduleVisibilitySync:r}){let{streamingTurnRef:i,autoScrollRef:a,autoscrollingRef:o,autoscrollingTimeoutRef:s,contentRef:c,defaultScrollPositionAppliedRef:l,itemCountRef:u,messageElementsRef:d,modeRef:f,pendingScrollToMessageRef:p,prependRestoreRef:m,scrollMarginRef:h,scrollPreviousItemPeekRef:g,spacerGapRef:_,spacerHeightRef:v,spacerRef:y,viewportRef:b}=e,x=X.useCallback(e=>{s.current!==null&&(window.clearTimeout(s.current),s.current=null),o.current!==e&&(o.current=e,t()),e&&(s.current=window.setTimeout(()=>{s.current=null,o.current=!1,t()},Nt))},[t]),S=X.useCallback(e=>{let t=y.current;if(!t)return;let n=Math.max(0,Math.ceil(e));v.current!==n&&(v.current=n,t.hidden=n===0,t.style.height=`${n}px`,t.style.marginTop=n>0?`${-_.current}px`:``)},[]),C=X.useCallback((e,{behavior:r=`auto`,autoscrolling:i=!1}={})=>{let a=b.current;if(!a)return;let o=Math.max(0,e);if(Math.abs(a.scrollTop-o)<=Mt){a.scrollTop=o,t();return}i&&x(!0),a.scrollTo({top:o,behavior:r}),n()},[t,n,x]),w=X.useCallback(({behavior:e=`auto`}={})=>b.current?(S(0),i.current=null,f.current=`free-scrolling`,C(0,{behavior:e}),r(),!0):!1,[r,C,S]),T=X.useCallback(({behavior:e=`auto`}={})=>{let t=b.current;return t?(S(0),i.current=null,f.current=a.current?`following-bottom`:`free-scrolling`,C(Xt(t),{autoscrolling:!0,behavior:e}),r(),!0):!1},[r,C,S]),E=X.useCallback((e,{align:t=`start`,behavior:n=`auto`,scrollMargin:a=h.current}={},{keepPreviousPeek:o=!1}={})=>{let s=c.current,l=b.current;if(!s||!l||!s.contains(e))return!1;let u=Gt({align:t,element:e,scrollMargin:o?a+g.current:a,spacer:y.current,viewport:l});return S(Jt({content:s,scrollTop:u,spacer:y.current,viewport:l})),m.current={element:e,viewportTop:qt(e,l)},f.current=o?`anchored-to-message`:`settling-jump`,i.current=o?e:null,C(u,{behavior:n}),r(),!0},[r,C,S]),D=X.useCallback(()=>{let e=i.current;return!e||!e.isConnected||f.current!==`anchored-to-message`?!1:E(e,{align:`start`},{keepPreviousPeek:!0})},[E]),O=X.useCallback((e,t)=>{let n=d.current.get(e);return n?(l.current=!0,E(n,t)?(p.current=null,!0):(p.current={messageId:e,options:t},!0)):u.current===0?(p.current={messageId:e,options:t},l.current=!0,!0):!1},[E]);return{flushPendingScrollToMessage:X.useCallback(()=>{let e=p.current;if(!e)return!1;let t=d.current.get(e.messageId);return!t||!E(t,e.options)?!1:(p.current=null,l.current=!0,!0)},[E]),reanchorToAnchoredMessage:D,scrollToElement:E,scrollToEnd:T,scrollToMessage:O,scrollToStart:w}}function nn(e,t){let n=e,r=new Set;return{getSnapshot:()=>n,hasListeners:()=>r.size>0,setSnapshot:e=>{t(n,e)||(n=e,r.forEach(e=>e()))},subscribe:(e,t,n)=>{let i=r.size===0;return r.add(e),i&&t?.(),()=>{r.delete(e),r.size===0&&n?.()}}}}function rn(e,t){return nn(e,t)}function an(){return nn(It,sn)}function on(e,t){return e.start===t.start&&e.end===t.end}function sn(e,t){return e.currentAnchorId!==t.currentAnchorId||e.visibleMessageIds.length!==t.visibleMessageIds.length?!1:e.visibleMessageIds.every((e,n)=>e===t.visibleMessageIds[n])}function cn({autoScroll:e,scrollEdgeThreshold:t,scrollMargin:n,scrollPreviousItemPeek:r}){let i=X.useRef(e),a=X.useRef(!1),o=X.useRef(null),s=X.useRef(!1),c=X.useRef(t),l=X.useRef(0),u=X.useRef(null),d=X.useRef(0),f=X.useRef(e?`following-bottom`:`free-scrolling`),p=X.useRef(new Map),m=X.useRef(null),h=X.useRef(null),g=X.useRef(null),_=X.useRef(r),v=X.useRef(!0),y=X.useRef(null),b=X.useRef(n),x=X.useRef(null),S=X.useRef(0),C=X.useRef(0),w=X.useRef(null),T=X.useRef(null),E=X.useRef(null),D=X.useRef(null),O=X.useRef(null),k=X.useRef(null),A=X.useRef(null),j=X.useRef(null),M=X.useRef(new Set),N=X.useRef(new WeakSet);return E.current===null&&(E.current=rn(Ft,on)),j.current===null&&(j.current=an()),i.current=e,c.current=t,b.current=n,_.current=r,{autoScrollRef:i,autoscrollingRef:a,autoscrollingTimeoutRef:D,streamingTurnRef:g,contentRef:o,defaultScrollPositionAppliedRef:s,firstItemRef:u,itemCountRef:l,lastScrollTopRef:d,messageElementsRef:p,modeRef:f,pendingScrollFrameRef:x,pendingScrollToMessageRef:m,prependRestoreRef:h,preserveScrollOnPrependRef:v,rootRef:y,scrollEdgeThresholdRef:c,scrollMarginRef:b,scrollPreviousItemPeekRef:_,spacerGapRef:S,spacerHeightRef:C,spacerRef:w,stateFrameRef:T,stateStore:E.current,viewportRef:O,visibilityFrameRef:k,visibilityObserverRef:A,visibilityStore:j.current,visibleMessageIdsRef:M,handledScrollAnchorsRef:N}}function ln(e,t){return X.useCallback(n=>{e.current=n,n&&t()},[e,t])}function un({autoScroll:e=!1,defaultScrollPosition:t=`end`,scrollEdgeThreshold:n=kt,scrollPreviousItemPeek:r=At,scrollMargin:i=jt}){let a=cn({autoScroll:e,scrollEdgeThreshold:n,scrollMargin:i,scrollPreviousItemPeek:r}),{streamingTurnRef:o,autoScrollRef:s,autoscrollingRef:c,autoscrollingTimeoutRef:l,contentRef:u,defaultScrollPositionAppliedRef:d,firstItemRef:f,itemCountRef:p,lastScrollTopRef:m,messageElementsRef:h,modeRef:g,pendingScrollFrameRef:_,pendingScrollToMessageRef:v,prependRestoreRef:y,preserveScrollOnPrependRef:b,rootRef:x,scrollEdgeThresholdRef:S,scrollMarginRef:C,scrollPreviousItemPeekRef:w,spacerGapRef:T,spacerHeightRef:E,spacerRef:D,stateFrameRef:O,stateStore:k,viewportRef:A,visibilityFrameRef:j,visibilityObserverRef:M,visibilityStore:N,visibleMessageIdsRef:P,handledScrollAnchorsRef:F}=a,I=X.useRef(t);I.current!==t&&(I.current=t,d.current=!1);let L=X.useCallback(e=>{let t=x.current,n=A.current,r=[e.start&&`start`,e.end&&`end`].filter(Boolean).join(` `),i=c.current;for(let e of[t,n])e&&(r?e.setAttribute(`data-scrollable`,r):e.removeAttribute(`data-scrollable`),e.toggleAttribute(`data-autoscrolling`,i))},[]),ee=X.useCallback(e=>{let t=A.current?.scrollTop??0,n=t<m.current-Mt;m.current=t,s.current&&!e.end&&g.current!==`settling-jump`&&g.current!==`anchored-to-message`?g.current=`following-bottom`:g.current===`following-bottom`&&e.end&&n&&!c.current&&(g.current=`free-scrolling`)},[]),R=X.useCallback(()=>{let e=Lt({content:u.current,scrollEdgeThreshold:S.current,spacer:D.current,viewport:A.current});ee(e);let t=g.current===`following-bottom`?{...e,end:!1}:e;L(t),k.setSnapshot(t)},[ee,k,L]),te=X.useCallback(()=>{O.current===null&&(O.current=window.requestAnimationFrame(()=>{O.current=null,R()}))},[R]),z=X.useCallback(()=>{N.hasListeners()&&j.current===null&&(j.current=window.requestAnimationFrame(()=>{j.current=null,N.hasListeners()&&N.setSnapshot(Rt({content:u.current,scrollMargin:C.current,scrollPreviousItemPeek:w.current,spacer:D.current,viewport:A.current,visibleMessageIds:P.current}))}))},[N]),{flushPendingScrollToMessage:B,reanchorToAnchoredMessage:ne,scrollToElement:re,scrollToEnd:V,scrollToMessage:ie,scrollToStart:ae}=tn({refs:a,commitScrollState:R,scheduleStateCommit:te,scheduleVisibilitySync:z}),oe=X.useCallback(()=>{let e=y.current,t=A.current;if(!e||!t||!e.element.isConnected)return!1;let n=qt(e.element,t)-e.viewportTop;return Math.abs(n)<=Mt?!1:(t.scrollTop+=n,e.viewportTop=qt(e.element,t),te(),z(),!0)},[te,z]),H=X.useCallback(()=>{let e=u.current,t=A.current;if(!e||!t){y.current=null;return}let n=Wt({content:e,spacer:D.current,viewport:t});y.current=n?{element:n,viewportTop:qt(n,t)}:null},[]),se=X.useCallback(()=>{_.current===null&&(_.current=window.requestAnimationFrame(()=>{_.current=null,B()&&H()}))},[H,B]),ce=X.useCallback(()=>{if(!t||d.current||p.current===0)return!1;let e=!1;if(t===`last-anchor`){let t=u.current,n=A.current,r=t&&n?Ut(zt(t,D.current)):null;if(!t||!n||!r)e=V({behavior:`auto`});else{let i=Kt(r,n);e=Yt({content:t,spacer:D.current,viewport:n})-i<=n.clientHeight?V({behavior:`auto`}):re(r,{align:`start`},{keepPreviousPeek:!0})}}else e=t===`end`?V({behavior:`auto`}):ae({behavior:`auto`});return e?(d.current=!0,!0):!1},[t,re,V,ae]),le=X.useCallback(()=>{let e=u.current;if(!e)return;let t=zt(e,D.current),n=p.current,r=f.current;p.current=t.length,f.current=t[0]??null,(()=>{if(B())return;if(n===0){if(ce()||t.length>0&&s.current&&V({behavior:`auto`}))return;R(),z();return}let e=r?t.indexOf(r):-1;if(b.current&&e>0){oe();return}if(t.length>n){let e=Bt(t,n);if(e){if(s.current&&g.current===`following-bottom`&&Ht(t,n)){V({behavior:`auto`});return}re(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}if(t.length===n){let e=Vt(t,F.current);if(e){re(e,{align:`start`},{keepPreviousPeek:!0}),F.current.add(e);return}}g.current===`following-bottom`&&s.current?V({behavior:`auto`}):(R(),z())})(),H()},[ce,H,R,B,oe,z,re,V]),ue=X.useCallback(()=>{if(g.current===`following-bottom`&&s.current){V({behavior:`auto`});return}let e=E.current;if(ne()){s.current&&e>0&&E.current===0&&V({behavior:`auto`});return}te(),z()},[ne,te,z,V]),de=X.useCallback(()=>{let e=A.current;if(!(!e||!N.hasListeners())){if(typeof IntersectionObserver>`u`){z();return}M.current||=new IntersectionObserver(e=>{for(let t of e){let e=t.target.dataset.messageId;e&&(t.isIntersecting?P.current.add(e):P.current.delete(e))}z()},{root:e,rootMargin:`${-(C.current+w.current)}px 0px 0px 0px`,threshold:[0,.01,.5,1]}),h.current.forEach(e=>{M.current?.observe(e)}),z()}},[z,N]),U=X.useCallback(()=>{j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),M.current?.disconnect(),M.current=null,P.current.clear(),N.setSnapshot(It)},[N]),W=X.useCallback((e,t,n)=>{if(t){h.current.set(e,t),M.current?.observe(t),z(),v.current?.messageId===e&&se();return}n&&h.current.get(e)===n&&(h.current.delete(e),P.current.delete(e),M.current?.unobserve(n),z())},[se,z]),G=X.useCallback(()=>{(g.current===`following-bottom`||g.current===`anchored-to-message`||g.current===`settling-jump`)&&(o.current=null,g.current=`free-scrolling`)},[]),K=X.useCallback(()=>L(k.getSnapshot()),[k,L]),fe=ln(x,K),pe=ln(A,K),me=X.useCallback(e=>{u.current=e},[]),q=X.useCallback(e=>{D.current=e,T.current=$t(e?.parentElement??null)},[]),he=X.useCallback(()=>{R(),z(),H()},[H,R,z]),ge=X.useMemo(()=>({handleContentChange:le,handleResize:ue,observeVisibility:de,preserveScrollOnPrependRef:b,scrollToEnd:V,scrollToMessage:ie,scrollToStart:ae,setContentElement:me,setRootElement:fe,setSpacerElement:q,setViewportElement:pe,stateStore:k,syncAfterScroll:he,unobserveVisibility:U,userScrollIntent:G,viewportRef:A,visibilityStore:N}),[le,ue,de,V,ie,ae,me,fe,q,pe,k,he,U,G,N]);return X.useLayoutEffect(()=>{ce()},[ce]),X.useEffect(()=>()=>{O.current!==null&&(window.cancelAnimationFrame(O.current),O.current=null),j.current!==null&&(window.cancelAnimationFrame(j.current),j.current=null),l.current!==null&&(window.clearTimeout(l.current),l.current=null),_.current!==null&&(window.cancelAnimationFrame(_.current),_.current=null),M.current?.disconnect(),M.current=null},[]),X.useLayoutEffect(()=>{if(e&&g.current===`following-bottom`&&p.current>0){V({behavior:`auto`});return}R()},[e,R,V]),{context:ge,registerMessage:W}}function dn(e){let t=X.useRef(e);return t.current=e,t}var fn=X.createContext(null),pn=X.createContext(null);function mn(){let e=X.useContext(fn);if(!e)throw Error(`useMessageScroller must be used within a MessageScroller.`);return e}function hn(){let e=X.useContext(pn);if(!e)throw Error(`MessageScrollerItem must be used within a MessageScroller.`);return e}function gn(){let{scrollToEnd:e,scrollToMessage:t,scrollToStart:n}=mn();return X.useMemo(()=>({scrollToEnd:e,scrollToMessage:t,scrollToStart:n}),[e,t,n])}function _n({autoScroll:e=!1,children:t,defaultScrollPosition:n=`end`,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a}){let{context:o,registerMessage:s}=un({autoScroll:e,defaultScrollPosition:n,scrollEdgeThreshold:r,scrollPreviousItemPeek:i,scrollMargin:a});return(0,Z.jsx)(fn.Provider,{value:o,children:(0,Z.jsx)(pn.Provider,{value:s,children:t})})}function vn({children:e,...t}){let{setRootElement:n}=mn();return(0,Z.jsx)(`div`,{ref:n,...t,children:e})}function yn({"aria-label":e,children:t,onKeyDown:n,onScroll:r,onTouchMove:i,onWheel:a,preserveScrollOnPrepend:o=!0,ref:s,role:c,tabIndex:l,...u}){let{handleResize:d,preserveScrollOnPrependRef:f,setViewportElement:p,syncAfterScroll:m,userScrollIntent:h,viewportRef:g}=mn();f.current=o;let _=X.useCallback(e=>{p(e),Ot(s)?.(e)},[s,p]);function v(e){m(),r?.(e)}function y(e){h(),a?.(e)}function b(e){h(),i?.(e)}function x(e){Pt.has(e.key)&&h(),n?.(e)}return X.useEffect(()=>{let e=g.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(d)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[d,g]),(0,Z.jsx)(`div`,{ref:_,role:c??`region`,"aria-label":e??`Messages`,tabIndex:l??0,onKeyDown:x,onScroll:v,onTouchMove:b,onWheel:y,...u,children:t})}function bn({"aria-relevant":e,children:t,ref:n,role:r,spacerClassName:i,...a}){let{handleContentChange:o,handleResize:s,setContentElement:c,setSpacerElement:l}=mn(),u=X.useRef(null),d=X.useCallback(e=>{u.current=e,c(e),Ot(n)?.(e)},[n,c]);return X.useLayoutEffect(()=>{let e=u.current;if(!e||(o(),typeof MutationObserver>`u`))return;let t=new MutationObserver(()=>{o()});return t.observe(e,{childList:!0}),()=>t.disconnect()},[o]),X.useEffect(()=>{let e=u.current;if(!e||typeof ResizeObserver>`u`)return;let t=0,n=new ResizeObserver(()=>{window.cancelAnimationFrame(t),t=window.requestAnimationFrame(s)});return n.observe(e),()=>{window.cancelAnimationFrame(t),n.disconnect()}},[s]),(0,Z.jsxs)(`div`,{ref:d,role:r??`log`,"aria-relevant":e??`additions`,...a,children:[t,(0,Z.jsx)(`div`,{ref:l,"aria-hidden":`true`,"data-message-scroller-spacer":``,hidden:!0,className:i})]})}function xn({messageId:e,ref:t,scrollAnchor:n=!1,...r}){let i=hn(),a=X.useRef(null);return(0,Z.jsx)(`div`,{ref:X.useCallback(n=>{let r=a.current;a.current=n,e&&i(e,n,r),Ot(t)?.(n)},[e,t,i]),"data-message-id":e,"data-scroll-anchor":n?`true`:`false`,...r})}function Sn({behavior:e=`smooth`,children:t,direction:n=`end`,onClick:r,render:i,tabIndex:a,type:o=`button`,...s}){let{scrollToEnd:c,scrollToStart:l,stateStore:u}=mn(),d=dn(r),f=X.useCallback(e=>u.subscribe(e),[u]),p=X.useCallback(()=>{let e=u.getSnapshot();return n===`start`?e.start:e.end},[n,u]),m=X.useSyncExternalStore(f,p,p),h=X.useCallback(t=>{m&&(d.current?.(t),t.defaultPrevented||(t.currentTarget.blur(),n===`start`?l({behavior:e}):c({behavior:e})))},[e,n,m,d,c,l]);return Ct({defaultTagName:`button`,props:wt({type:o,inert:!m,tabIndex:m?a:-1,children:t??(0,Z.jsxs)(`span`,{children:[`Scroll to `,n]}),onClick:h},s),render:i,state:{active:m,direction:n},stateAttributesMapping:{active:e=>({"data-active":e?`true`:`false`})}})}var Cn={Provider:_n,Root:vn,Viewport:yn,Content:bn,Item:xn,Button:Sn};function wn(e){let t=(0,Y.c)(2),n;return t[0]===e?n=t[1]:(n=(0,Z.jsx)(Cn.Provider,{...e}),t[0]=e,t[1]=n),n}function Tn(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=b(`group/message-scroller relative flex size-full min-h-0 flex-col overflow-hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Cn.Root,{"data-slot":`message-scroller`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function En(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=b(`size-full min-h-0 min-w-0 scrollbar-thin overflow-y-auto overscroll-contain contain-content data-autoscrolling:scrollbar-thumb-transparent data-autoscrolling:scrollbar-track-transparent`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Cn.Viewport,{"data-slot":`message-scroller-viewport`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function Dn(e){let t=(0,Y.c)(8),n,r;t[0]===e?(n=t[1],r=t[2]):({className:n,...r}=e,t[0]=e,t[1]=n,t[2]=r);let i;t[3]===n?i=t[4]:(i=b(`flex h-max min-h-full flex-col gap-6`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Cn.Content,{"data-slot":`message-scroller-content`,className:i,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function On(e){let t=(0,Y.c)(10),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:n,scrollAnchor:i,...r}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a=i===void 0?!1:i,o;t[4]===n?o=t[5]:(o=b(`min-w-0 shrink-0 [contain-intrinsic-size:auto_10rem] [content-visibility:auto]`,n),t[4]=n,t[5]=o);let s;return t[6]!==r||t[7]!==a||t[8]!==o?(s=(0,Z.jsx)(Cn.Item,{"data-slot":`message-scroller-item`,scrollAnchor:a,className:o,...r}),t[6]=r,t[7]=a,t[8]=o,t[9]=s):s=t[9],s}function kn(e){let t=(0,Y.c)(25),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({direction:o,className:r,children:n,render:a,variant:s,size:c,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?`end`:o,u=s===void 0?`secondary`:s,d=c===void 0?`icon-sm`:c,f;t[8]===r?f=t[9]:(f=b(`absolute inset-s-1/2 -translate-x-1/2 border-border bg-background text-foreground transition-[translate,scale,opacity] duration-200 hover:bg-muted hover:text-foreground data-[active=false]:pointer-events-none data-[active=false]:scale-95 data-[active=false]:opacity-0 data-[active=false]:duration-400 data-[active=false]:ease-[cubic-bezier(0.7,0,0.84,0)] data-[active=true]:translate-y-0 data-[active=true]:scale-100 data-[active=true]:opacity-100 data-[active=true]:ease-[cubic-bezier(0.23,1,0.32,1)] data-[direction=end]:bottom-4 data-[direction=end]:data-[active=false]:translate-y-full data-[direction=start]:top-4 data-[direction=start]:data-[active=false]:-translate-y-full rtl:translate-x-1/2 data-[direction=start]:[&_svg]:rotate-180`,r),t[8]=r,t[9]=f);let p;t[10]!==a||t[11]!==d||t[12]!==u?(p=a??(0,Z.jsx)(C,{variant:u,size:d}),t[10]=a,t[11]=d,t[12]=u,t[13]=p):p=t[13];let m;t[14]!==n||t[15]!==l?(m=n??(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Te,{"aria-hidden":`true`}),(0,Z.jsx)(`span`,{className:`sr-only`,children:l===`end`?(0,Z.jsx)(h,{id:`EQXPXf`}):(0,Z.jsx)(h,{id:`b1FDss`})})]}),t[14]=n,t[15]=l,t[16]=m):m=t[16];let g;return t[17]!==l||t[18]!==i||t[19]!==d||t[20]!==f||t[21]!==p||t[22]!==m||t[23]!==u?(g=(0,Z.jsx)(Cn.Button,{"data-slot":`message-scroller-button`,"data-direction":l,"data-variant":u,"data-size":d,direction:l,className:f,render:p,...i,children:m}),t[17]=l,t[18]=i,t[19]=d,t[20]=f,t[21]=p,t[22]=m,t[23]=u,t[24]=g):g=t[24],g}var An=new Map,jn=0;function Mn(){return typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now()}function Nn(){let e=Mn();for(let[t,n]of An)t((e-n)/1e3);if(An.size===0){jn=0;return}jn=requestAnimationFrame(Nn)}function Pn(e){return An.set(e,Mn()),jn===0&&typeof requestAnimationFrame==`function`&&(jn=requestAnimationFrame(Nn)),()=>{An.delete(e),An.size===0&&jn!==0&&(cancelAnimationFrame(jn),jn=0)}}var Q=40,Fn=15,In=15,$=12.4,Ln={blobby:0,triangle:1,square:2,sparkle:3,pentagon:4,hexagon:5,dot:6,star5:7,clover:8,star6:9,scallop:10,comma:11,diamond:12,cloud:13},Rn=`M15.34 2.91C15.96 2.77 16.69 2.65 17.33 2.63C17.97 2.62 18.72 2.71 19.36 2.84C20.00 2.97 20.79 3.10 21.33 3.44C21.88 3.79 22.38 4.46 22.75 5.01C23.12 5.56 23.42 6.30 23.66 6.89C23.90 7.49 24.06 8.18 24.26 8.73C24.45 9.28 24.66 9.84 24.89 10.34C25.12 10.84 25.39 11.36 25.68 11.85C25.97 12.34 26.46 12.87 26.71 13.41C26.96 13.94 27.12 14.61 27.26 15.21C27.39 15.80 27.54 16.52 27.55 17.14C27.56 17.76 27.43 18.47 27.30 19.09C27.16 19.71 26.99 20.43 26.72 21.01C26.46 21.58 26.05 22.20 25.64 22.69C25.22 23.17 24.65 23.63 24.15 24.02C23.66 24.41 23.09 24.82 22.55 25.14C22.02 25.45 21.39 25.74 20.84 25.99C20.28 26.25 19.65 26.52 19.08 26.70C18.50 26.89 17.83 27.05 17.23 27.15C16.63 27.26 15.95 27.34 15.34 27.37C14.73 27.39 14.03 27.40 13.42 27.33C12.81 27.26 12.12 27.10 11.54 26.92C10.95 26.73 10.30 26.47 9.75 26.18C9.20 25.90 8.62 25.51 8.11 25.15C7.61 24.80 7.06 24.37 6.60 23.94C6.15 23.52 5.68 23.00 5.28 22.52C4.89 22.03 4.47 21.45 4.13 20.92C3.79 20.38 3.41 19.75 3.16 19.16C2.91 18.57 2.68 17.86 2.56 17.23C2.45 16.60 2.42 15.85 2.45 15.21C2.48 14.56 2.60 13.83 2.76 13.22C2.93 12.60 3.18 11.91 3.47 11.35C3.77 10.80 4.24 10.23 4.63 9.75C5.01 9.27 5.45 8.74 5.89 8.34C6.34 7.95 6.93 7.61 7.40 7.27C7.88 6.94 8.38 6.57 8.83 6.25C9.29 5.93 9.79 5.56 10.27 5.25C10.75 4.95 11.29 4.61 11.81 4.33C12.32 4.05 12.92 3.74 13.49 3.52C14.05 3.29 14.73 3.05 15.34 2.91Z`,zn=2.26,Bn=`M76.4805 11.041C99.1124 7.04848 118.186 8.33731 134.31 14.4102C150.369 20.4588 164.177 31.5065 175.929 48.1846L176.446 48.9199C187.179 64.5695 195.653 90.2797 191.323 112.539C186.344 138.13 169.219 160.474 150.105 178.107C131.113 195.629 111.037 207.691 101.728 212.842C98.3779 214.693 93.3915 217.316 88.0508 217.316C85.74 217.316 83.6583 216.814 81.7607 215.855L81.3838 215.658C75.1451 212.251 73.9381 205.91 73.376 198.68L73.2705 197.222C72.953 192.5 72.5095 188.039 71.1416 184.247C69.5395 179.806 66.852 176.673 63.1406 174.227L63.1377 174.225C41.2846 159.832 21.8495 144.226 13.3828 121.439L13.3818 121.438L13.0146 120.427C5.46004 99.1404 7.95139 74.5467 20.4404 52.7568L20.4414 52.7549C33.2945 30.3176 54.4303 14.925 76.4785 11.041H76.4805Z`;function Vn(e){let t=t=>{let n=e[(t-1+Q)%Q],r=e[(t+1)%Q];return[(r[0]-n[0])*.16,(r[1]-n[1])*.16]},n=`M${e[0][0].toFixed(2)} ${e[0][1].toFixed(2)}`;for(let r=0;r<Q;r++){let i=e[r],a=e[(r+1)%Q],o=t(r),s=t((r+1)%Q);n+=`C${(i[0]+o[0]).toFixed(2)} ${(i[1]+o[1]).toFixed(2)} ${(a[0]-s[0]).toFixed(2)} ${(a[1]-s[1]).toFixed(2)} ${a[0].toFixed(2)} ${a[1].toFixed(2)}`}return`${n}Z`}function Hn(e,t){let n=e.map(e=>e[0]),r=e.map(e=>e[1]),i=Math.min(...n),a=Math.max(...n),o=Math.min(...r),s=Math.max(...r),c=t*2/Math.max(a-i,s-o);return e.map(e=>[Fn+(e[0]-(i+a)/2)*c,In+(e[1]-(o+s)/2)*c])}function Un(e,t,n){let r=e;for(let e=0;e<t;e++){let e=r;r=e.map((t,r)=>{let i=e[(r-1+Q)%Q],a=e[(r+1)%Q];return[t[0]*(1-n)+(i[0]+a[0])/2*n,t[1]*(1-n)+(i[1]+a[1])/2*n]})}return r}function Wn(){if(typeof document>`u`)return null;let e=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);e.setAttribute(`width`,`0`),e.setAttribute(`height`,`0`),e.style.position=`absolute`,e.style.visibility=`hidden`;let t=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);if(e.appendChild(t),document.body.appendChild(e),typeof t.getTotalLength!=`function`||typeof t.getPointAtLength!=`function`)return e.remove(),null;try{t.setAttribute(`d`,`M0 0L1 0`),t.getPointAtLength(0)}catch{return e.remove(),null}return t}function Gn(e){function t(t,n){e.setAttribute(`d`,t);let r=e.getTotalLength(),i=[];for(let t=0;t<n;t++){let a=e.getPointAtLength(r*t/n);i.push([a.x,a.y])}return i}function n(e){let t=0,n=0;for(let r of e)t+=r[0],n+=r[1];t/=e.length,n/=e.length;let r=Array(Q).fill(0),i=Array(Q).fill(1/0);for(let a of e){let e=Math.atan2(a[1]-n,a[0]-t),o=Math.hypot(a[0]-t,a[1]-n),s=Math.round((e+Math.PI/2)/(2*Math.PI)*Q);s=(s%Q+Q)%Q,o>r[s]&&(r[s]=o),o<i[s]&&(i[s]=o)}return{cx:t,cy:n,hi:r,lo:i}}function r(e,t,n){return e.map((e,r)=>{let i=-Math.PI/2+r*2*Math.PI/Q;return[t+Math.cos(i)*e,n+Math.sin(i)*e]})}function i(e,i){let{cx:a,cy:o,hi:s,lo:c}=n(t(e,1080)),l=s.map((e,t)=>(e+c[t])/2),u=s.reduce((e,t,n)=>e+(t-c[n]),0)/Q,d=r(l,a,o),f=d.map(e=>e[0]),p=d.map(e=>e[1]),m=i*2/Math.max(Math.max(...f)-Math.min(...f),Math.max(...p)-Math.min(...p));return{path:Vn(Hn(d,i)),strokeWidth:u*m}}function a(e,i){let{cx:a,cy:o,hi:s}=n(t(e,1400));return Vn(Hn(r(s.map((e,t)=>s[t]*.86+(s[(t-1+Q)%Q]+s[(t+1)%Q])*.07),a,o),i))}function o(e,n){return Vn(Hn(t(e,Q),n))}function s(e,n,r){return Vn(Un(t(e,Q),n,r))}function c(e,n,r){return Vn(t(e,Q).map(e=>[Fn+(e[0]-Fn)*n,In+(e[1]-In)*r]))}function l(e,n,r=1){return Vn(t(e,Q).map((e,t)=>{let i=t*2*Math.PI/Q,a=1+r*(.035*Math.sin(i*3+n)+.025*Math.sin(i*5+n*2)+.018*Math.sin(i*2-n));return[Fn+(e[0]-Fn)*a,In+(e[1]-In)*a]}))}function u(e,t,n,r=0){let i=[];for(let n=0;n<e;n++){let a=-Math.PI/2+n*2*Math.PI/e+r;i.push([Fn+Math.cos(a)*t,In+Math.sin(a)*t])}let a=(e,t)=>{let n=t[0]-e[0],r=t[1]-e[1],i=Math.hypot(n,r);return[n/i,r/i]},o=``;for(let t=0;t<e;t++){let r=i[t],s=a(r,i[(t-1+e)%e]),c=a(r,i[(t+1)%e]),l=[r[0]+s[0]*n,r[1]+s[1]*n],u=[r[0]+c[0]*n,r[1]+c[1]*n];o+=`${t?`L`:`M`}${l[0].toFixed(2)} ${l[1].toFixed(2)}A${n} ${n} 0 0 1 ${u[0].toFixed(2)} ${u[1].toFixed(2)}`}return`${o}Z`}function d(e,n,r,i){let a=``;for(let t=0;t<e*2;t++){let i=-Math.PI/2+t*Math.PI/e,o=t%2?r:n;a+=`${t?`L`:`M`}${(Fn+Math.cos(i)*o).toFixed(2)} ${(In+Math.sin(i)*o).toFixed(2)}`}return Vn(Hn(Un(t(`${a}Z`,Q),i,.3),n))}function f(e,n,r){let i=t=>{let n=-Math.PI/2+t*Math.PI/2;return[Fn+Math.cos(n)*e,In+Math.sin(n)*e]},a=`M${i(0)[0].toFixed(2)} ${i(0)[1].toFixed(2)}`;for(let e=0;e<4;e++){let t=-Math.PI/2+(e+.5)*Math.PI/2,r=[Fn+Math.cos(t)*n,In+Math.sin(t)*n],o=i((e+1)%4);a+=`Q${r[0].toFixed(2)} ${r[1].toFixed(2)} ${o[0].toFixed(2)} ${o[1].toFixed(2)}`}return Vn(Hn(Un(t(`${a}Z`,Q),r,.34),e))}function p(e,t,n,r){let i=[];for(let a=0;a<Q;a++){let o=-Math.PI/2+a*2*Math.PI/Q,s=(1+Math.cos(e*(o+Math.PI/2)))/2,c=n+(t-n)*s**r;i.push([Fn+Math.cos(o)*c,In+Math.sin(o)*c])}return Vn(i)}function m(e){let t=[];for(let n=0;n<Q;n++){let r=-Math.PI/2+n*2*Math.PI/Q;t.push([Fn+Math.cos(r)*e,In+Math.sin(r)*e])}return Vn(t)}return{silhouette:i,hull:a,fit:o,soften:s,squeeze:c,wobble:l,poly:u,star:d,sparkle:f,lobed:p,dot:m,circle:(e,t,n)=>`M${e-n} ${t}a${n} ${n} 0 1 0 ${n*2} 0a${n} ${n} 0 1 0 ${-n*2} 0`}}function Kn(){let e=Wn();if(e===null)return null;try{let t=Gn(e),n=t.silhouette(S,12.55);return{paths:[n.path,t.wobble(t.poly(3,$*1.16,$*.5,.1),1.1),t.wobble(t.poly(4,$*1.02,$*.44),2.3),t.wobble(t.sparkle($*1.24,$*.1,3),3.7),t.wobble(t.poly(5,$*1,$*.38),4.9),t.wobble(t.poly(6,$*.98,$*.34),6.2),t.wobble(t.dot($*.34),2.8),t.wobble(t.star(5,$*1.14,$*.68,6),7.4),t.wobble(t.soften(t.lobed(4,$*1.16,$*.46,.5),3,.3),8.1),t.wobble(t.star(6,$*1.2,$*.42,4),9.3),t.wobble(t.lobed(8,$*1.06,$*.74,.6),10.5),t.wobble(t.soften(t.fit(Bn,$*1.12),3,.22),11.7,.3),t.wobble(t.squeeze(t.poly(4,$*1.3,$*.2),.84,1),12.9),t.wobble(t.hull(t.circle(10.2,16,4.3)+t.circle(15,12,5.5)+t.circle(20,15.4,4.4)+t.circle(15,17.4,5.2),12.4),13.6)],strokeWidth:n.strokeWidth}}finally{e.ownerSVGElement?.remove()}}var qn;function Jn(){return qn===void 0&&(qn=Kn()),qn}var Yn=/-?\d+(?:\.\d+)?/g;function Xn(e){return{fragments:e[0].split(Yn),numbers:e.map(e=>(e.match(Yn)??[]).map(Number))}}function Zn(e,t){let n=``;for(let r=0;r<t.length;r++)n+=e[r]+t[r].toFixed(2);return n+e[t.length]}function Qn(e){return e<.5?2*e*e:1-2*(1-e)**2}var $n=.58;function er(e,t,n,r){let i=t-1,a=n/i,o=e%n,s=Math.max(0,Math.min(i-1,Math.floor(o/a))),c=o%a/a;return{from:s,to:s+1,t:Qn(r?Math.min(1,c/$n):c)}}var tr=Ln,nr=[tr.blobby,tr.triangle,tr.square,tr.sparkle,tr.comma,tr.pentagon,tr.hexagon,tr.blobby],rr={[tr.comma]:-2.9},ir={leftCx:10.9,rightCx:18.1,cy:16,rx:1.25,ry:1.9},ar=20,or=8.4;function sr(e){let t=(0,Y.c)(22),{status:n,className:r,testId:i}=e,{_:a}=g(),o=(0,X.useRef)(null),s=(0,X.useRef)(null),c=Ee(),l,u;t[0]===c?(l=t[1],u=t[2]):(l=()=>{let e=o.current;if(e===null)return;if(c){e.setAttribute(`d`,Rn),e.setAttribute(`stroke-width`,String(zn)),s.current?.removeAttribute(`transform`);return}let t=Jn();if(t===null)return;e.setAttribute(`stroke-width`,t.strokeWidth.toFixed(2));let n=Xn(t.paths),r=NaN,i=``;return Pn(t=>{let{from:a,to:o,t:c}=er(t,nr.length,or,!0),l=n.numbers[nr[a]],u=n.numbers[nr[o]],d=l.map((e,t)=>e+(u[t]-e)*c),f=Zn(n.fragments,d);f!==i&&(i=f,e.setAttribute(`d`,f));let p=s.current;if(p===null)return;let m=rr[nr[a]]??0,h=m+((rr[nr[o]]??0)-m)*c;h!==r&&(r=h,p.setAttribute(`transform`,`translate(0 ${h.toFixed(2)})`))})},u=[c],t[0]=c,t[1]=l,t[2]=u),(0,X.useEffect)(l,u);let[d,f]=(0,X.useState)(``),p,m;t[3]===a?(p=t[4],m=t[5]):(p=()=>{f(a({id:`DCSSZt`}))},m=[a],t[3]=a,t[4]=p,t[5]=m),(0,X.useEffect)(p,m);let h;t[6]===r?h=t[7]:(h=b(`ok-working-enter flex items-center gap-2`,r),t[6]=r,t[7]=h);let _;t[8]===d?_=t[9]:(_=(0,Z.jsx)(`span`,{"aria-live":`polite`,className:`sr-only`,role:`status`,children:d}),t[8]=d,t[9]=_);let v;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,Z.jsx)(`path`,{ref:o,d:Rn,fill:`none`,stroke:`currentColor`,strokeWidth:zn,strokeLinejoin:`round`,strokeLinecap:`round`}),t[10]=v):v=t[10];let y;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Z.jsx)(`span`,{className:`grid shrink-0 place-items-center text-muted-foreground/80`,children:(0,Z.jsx)(`svg`,{width:ar,height:ar,viewBox:`0 0 30 30`,xmlns:`http://www.w3.org/2000/svg`,"aria-hidden":`true`,className:`ok-working-pop ok-working-squint block shrink-0 overflow-visible`,children:(0,Z.jsxs)(`g`,{className:`ok-working-group`,children:[v,(0,Z.jsxs)(`g`,{ref:s,children:[(0,Z.jsx)(`ellipse`,{className:`ok-working-eye`,cx:ir.leftCx,cy:ir.cy,rx:ir.rx,ry:ir.ry,fill:`currentColor`}),(0,Z.jsx)(`ellipse`,{className:`ok-working-eye`,cx:ir.rightCx,cy:ir.cy,rx:ir.rx,ry:ir.ry,fill:`currentColor`})]})]})})}),t[11]=y):y=t[11];let x;t[12]===n?x=t[13]:(x=(0,Z.jsx)(`span`,{className:`shimmer`,children:n}),t[12]=n,t[13]=x);let S;t[14]!==n||t[15]!==x?(S=(0,Z.jsx)(`span`,{className:`ok-working-status text-sm`,children:x},n),t[14]=n,t[15]=x,t[16]=S):S=t[16];let C;return t[17]!==S||t[18]!==h||t[19]!==_||t[20]!==i?(C=(0,Z.jsxs)(`div`,{className:h,"data-testid":i,children:[_,y,S]}),t[17]=S,t[18]=h,t[19]=_,t[20]=i,t[21]=C):C=t[21],C}function cr(e){let t=[];for(let n of e.options)`value`in n?t.push(n):t.push(...n.options);return t}function lr(e){let t=cr(e),n=t.find(t=>t.value===e.currentValue);if(n===void 0||n.value!==`default`||!n.description)return null;let r=t.find(e=>e.value!==n.value&&e.description===n.description);return r===void 0?null:J._({id:`GK5Ft_`,values:{0:r.name}})}function ur(e,t,n){return e===`claude-acp`&&t===`effort`&&n===`default`?J._({id:`3SWNP8`}):e===`codex-acp`&&t===`collaboration_mode`&&n===`default`?J._({id:`R6ABfU`}):null}var dr=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`]),fr=700*1024;function pr(e){if(e.kind===`unsupported-type`)return e.mimeType.startsWith(`image/`)?`Only PNG, JPEG, GIF, and WebP images are supported (got ${e.mimeType}).`:`Unsupported file type: ${e.mimeType||`unknown`}.`;if(e.kind===`outside-workspace`)return`${e.name} is outside the workspace. Move it into your project first.`;if(e.kind===`unknown-path`)return`${e.name} has no resolvable path — the agent can only read files inside the workspace.`;let t=(e.limitBytes/(1024*1024)).toFixed(1);return`File is too large (${(e.sizeBytes/(1024*1024)).toFixed(1)} MB) — max ${t} MB per attachment.`}async function mr(e){let t=await new Promise((t,n)=>{let r=new FileReader;r.onerror=()=>n(r.error??Error(`FileReader failed`)),r.onload=()=>{let e=r.result;if(typeof e!=`string`){n(Error(`FileReader returned non-string result`));return}t(e)},r.readAsDataURL(e)}),n=t.indexOf(`,`);return{data:n>=0?t.slice(n+1):t,mimeType:e.type||`application/octet-stream`,name:e.name||`image`,sizeBytes:e.size}}async function hr(e){let t=e.type||``;if(!dr.has(t))return{ok:!1,error:{kind:`unsupported-type`,mimeType:t}};if(e.size>716800)return{ok:!1,error:{kind:`too-large`,sizeBytes:e.size,limitBytes:fr}};let n=await mr(e);return{ok:!0,part:{kind:`image`,data:n.data,mimeType:n.mimeType,name:n.name,sizeBytes:n.sizeBytes}}}function gr(e){return vr(e,e=>e.type.startsWith(`image/`))}function _r(e){return vr(e,e=>e.size>0)}function vr(e,t){if(e===null)return[];let n=[],r=e=>{e!==null&&t(e)&&n.push(e)},i=!1,a=e.items;if(a)for(let e=0;e<a.length;e+=1){let t=a[e];if(!t||t.kind!==`file`)continue;let n=t.getAsFile();n!==null&&(i=!0,r(n))}if(!i){let t=e.files;if(t)for(let e=0;e<t.length;e+=1)r(t[e]??null)}return n}function yr(e,t,n){let r=n===`\\`?e.toLowerCase():e,i=n===`\\`?t.toLowerCase():t,a=i.endsWith(n)?i:`${i}${n}`;if(r===i)return``;if(!r.startsWith(a))return null;let o=e.slice(a.length);return n===`\\`?o.replaceAll(`\\`,`/`):o}async function br(e,t={}){if((e.type||``).startsWith(`image/`))return hr(e);let n=t.absPathOf,r=t.workspaceContentDir,i=t.pathSeparator??`/`,a=e.name||`attachment`;if(n===void 0||r===void 0||r===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let o=n(e);if(o===null||o===``)return{ok:!1,error:{kind:`unknown-path`,name:a}};let s=yr(o,r,i);return s===null?{ok:!1,error:{kind:`outside-workspace`,name:a}}:{ok:!0,part:{kind:`file`,path:s,name:a}}}var xr=3,Sr=xr*2+2;function Cr(e){let t=e.split(`
|
|
3
3
|
`);return t[t.length-1]===``&&t.pop(),t}function wr(e,t){if(e===null)return Cr(t).map(e=>({type:`add`,text:e}));let n=[],r=nt(e,t);for(let[e,t]of r.entries()){let i=Cr(t.value);if(t.added){for(let e of i)n.push({type:`add`,text:e});continue}if(t.removed){for(let e of i)n.push({type:`del`,text:e});continue}if(i.length<=Sr){for(let e of i)n.push({type:`ctx`,text:e});continue}let a=e>0?i.slice(0,xr):[],o=e<r.length-1?i.slice(-xr):[];for(let e of a)n.push({type:`ctx`,text:e});n.push({type:`gap`,count:i.length-a.length-o.length});for(let e of o)n.push({type:`ctx`,text:e})}return n}var Tr=/^\[[^\]]{1,32}\]\s*/,Er=/\bhttps?:\/\/\S+/,Dr=/\b[A-Z0-9]{3,8}(?:-[A-Z0-9]{3,8})+\b/;function Or(e){try{let t=new URL(e);return`${t.host}${t.pathname===`/`?``:t.pathname}`}catch{return e}}function kr(e){let t,n,r=[];for(let i of e){let e=i.replace(Tr,``).trim();if(e===``)continue;let a=e.match(Er);if(n===void 0&&a!==null){n=a[0].replace(/[).,]+$/,``);let e=new URLSearchParams(n.split(`?`)[1]??``).get(`user_code`);e!==null&&e!==``&&(t=e)}if(t===void 0){let n=e.match(Dr);n!==null&&(t=n[0])}let o=t!==void 0&&e.includes(t),s=n!==void 0&&e.includes(n);!o&&!s&&r.push(e)}return{...t===void 0?{}:{code:t},...n===void 0?{}:{url:n},lines:r}}var Ar=/\x1b\[[0-9;?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-Z\\-_]/g;function jr(e){return e.replace(Ar,``)}function Mr(e){return jr(e).split(`
|
|
4
4
|
`).map(e=>{let t=e.replace(/\r+$/,``),n=t.lastIndexOf(`\r`);return n===-1?t:t.slice(n+1)}).join(`
|
|
5
5
|
`)}var Nr=new Set(_e),Pr=/^(?:open[-_ ]?knowledge|ok)$/,Fr=/^(?:mcp[^a-z0-9]+)?(?:open[-_ ]?knowledge|ok)[^a-z0-9]+([a-z_]+)$/;function Ir(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function Lr(e){return Fr.exec(e.trim().toLowerCase())?.[1]??null}function Rr(e,t){let n=H(Ir(t),`server`);if(n!==null&&!Pr.test(n.toLowerCase()))return null;let r=W(t),i=[Lr(e),r?.tool??null].find(e=>e!==null&&Nr.has(e));return i===void 0?null:{tool:i,args:r?.args??{}}}function zr(e){return typeof e==`string`?e.trim()===``?[]:[e.trim()]:Array.isArray(e)?e.flatMap(zr):typeof e==`object`&&e?zr(e.path):[]}var Br=[`document`,`documents`,`folder`,`file`,`template`,`asset`,`path`,`from`,`name`];function Vr(e){for(let t of Br){let n=zr(e[t]);if(n.length>0)return n}return[]}function Hr(e){return e.replace(/\.mdx?$/i,``)}var Ur=120;function Wr(e){if(typeof e!=`string`)return null;let t=e.replace(/\s+/g,` `).trim();return t===``?null:t.length>Ur?`${t.slice(0,Ur-1)}…`:t}function Gr(e,t){let n=Vr(t),r=n[0],i=n.length>1?J._({id:`C7waqI`,values:{0:n.length}}):r===void 0?null:Hr(r);switch(e){case`write`:return{glyph:`edit`,text:i===null?J._({id:`tLX6LY`}):J._({id:`MvWBwz`,values:{subject:i}})};case`edit`:return{glyph:`edit`,text:i===null?J._({id:`Fx9aOF`}):J._({id:`7aNk5D`,values:{subject:i}})};case`delete`:return{glyph:`delete`,text:i===null?J._({id:`DcFr-y`}):J._({id:`Gb_h4G`,values:{subject:i}})};case`move`:{let e=zr(t.to)[0];if(i===null||e===void 0)return{glyph:`move`,text:J._({id:`RGptDW`})};let n=Hr(e);return{glyph:`move`,text:J._({id:`pbyEp3`,values:{subject:i,destination:n}})}}case`search`:{let e=Wr(t.query);return{glyph:`search`,text:e===null?J._({id:`EvXKHE`}):J._({id:`yWfjqS`,values:{query:e}})}}case`exec`:{let e=Wr(t.command);return{glyph:`execute`,text:e===null?J._({id:`FS4Udk`}):J._({id:`a5gwRt`,values:{command:e}})}}case`lint`:case`audit`:return{glyph:`check`,text:i===null?J._({id:`7S7FNA`}):J._({id:`TEJiKw`,values:{subject:i}})};case`links`:return{glyph:`link`,text:i===null?J._({id:`vallqD`}):J._({id:`KDrbNG`,values:{subject:i}})};case`history`:return{glyph:`history`,text:i===null?J._({id:`Ug2xzC`}):J._({id:`90-wKT`,values:{subject:i}})};case`config`:{let e=Wr(t.key);return{glyph:`settings`,text:e===null?J._({id:`ZwpggY`}):J._({id:`-oHckY`,values:{key:e}})}}case`skills`:return{glyph:`read`,text:J._({id:`4mp6Tv`})};case`install`:return{glyph:`install`,text:i===null?J._({id:`4ErgAf`}):J._({id:`WbWtif`,values:{subject:i}})};case`import`:{let e=Wr(t.skill)??Wr(t.source);return{glyph:`install`,text:e===null?J._({id:`DhT_PK`}):J._({id:`hCattk`,values:{source:e}})}}case`palette`:return{glyph:`read`,text:J._({id:`7czmD1`})};case`preview_url`:return{glyph:`fetch`,text:J._({id:`UL-9ej`})};case`share_link`:return{glyph:`share`,text:i===null?J._({id:`ABq-cq`}):J._({id:`ibE3-O`,values:{subject:i}})};case`checkpoint`:return{glyph:`history`,text:J._({id:`5b3WD-`})};case`conflicts`:return{glyph:`check`,text:J._({id:`i94lQe`})};case`resolve_conflict`:return{glyph:`edit`,text:i===null?J._({id:`_YWqV2`}):J._({id:`AeLo3p`,values:{subject:i}})};case`restore_version`:return{glyph:`restore`,text:i===null?J._({id:`caiyaU`}):J._({id:`hS0wC4`,values:{subject:i}})};default:return{glyph:`other`,text:J._({id:`vhGTWU`,values:{tool:e}})}}}var Kr={read:`read`,edit:`edit`,delete:`delete`,move:`move`,search:`search`,execute:`execute`,think:`think`,fetch:`fetch`,switch_mode:`switch_mode`};function qr(e){let t=Rr(e.title,e.rawInput);return t===null?{text:e.title,glyph:Kr[e.toolKind]??`other`}:Gr(t.tool,t.args)}var Jr=new Map([{id:`shellscript`,aliases:[`bash`,`sh`,`shell`,`zsh`]},{id:`tsx`,aliases:[`typescript`,`ts`,`jsx`]},{id:`javascript`,aliases:[`js`]},{id:`json`,aliases:[`jsonc`]},{id:`python`,aliases:[`py`]},{id:`rust`,aliases:[`rs`]},{id:`go`,aliases:[]},{id:`css`,aliases:[]},{id:`html`,aliases:[]},{id:`markdown`,aliases:[`md`]},{id:`yaml`,aliases:[`yml`]},{id:`toml`,aliases:[]},{id:`sql`,aliases:[]},{id:`diff`,aliases:[]},{id:`dockerfile`,aliases:[`docker`]}].flatMap(e=>[[e.id,e.id],...e.aliases.map(t=>[t,e.id])])),Yr=[`github-light`,`github-dark`],Xr=400,Zr=new Map,Qr=new Map;function $r(e,t){return`${t}:${e.length}:${e.slice(0,100)}:${e.length>100?e.slice(-100):``}`}var ei={name:`shiki`,type:`code-highlighter`,getSupportedLanguages:()=>Array.from(Jr.keys()),supportsLanguage:e=>Jr.has(e),getThemes:()=>Yr,highlight(e,n){let r=Jr.get(e.language)??`text`,i=$r(e.code,r),a=Zr.get(i);if(a!==void 0)return a;if(n!==void 0){let e=Qr.get(i)??new Set;e.add(n),Qr.set(i,e)}return t(async()=>{let{tokenize:e}=await import(`./code-highlighter-impl-OjijFOBN.js`);return{tokenize:e}},__vite__mapDeps([0,1,2,3]),import.meta.url).then(async({tokenize:t})=>{let n=await t(e.code,r);if(Zr.size>=Xr){let e=Math.floor(Zr.size/2);for(let t of Zr.keys()){if(e===0)break;Zr.delete(t),--e}}Zr.set(i,n);let a=Qr.get(i);if(a!==void 0){Qr.delete(i);for(let e of a)e(n)}}).catch(e=>{Qr.delete(i),console.warn(`[code-highlighter] highlight failed, leaving plain text`,e)}),null}};function ti(){return e=>{ni(e)}}function ni(e){let t=e.children;if(t===void 0)return;let n=[];for(let e of t){if(e.type===`text`&&e.value!==void 0&&e.value.includes(`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActivityPanelDiffView-CgaFZtD7.js","./chunk-CYidjpOJ.js","./dist-Nvb76hAm.js","./jsx-runtime-BUgB2tll.js","./react-f2sANaYj.js","./compiler-runtime-BfE3aGVn.js","./ActivityPanelDiffView-legcy4jI.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as ee}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as te}from"./overlay-layers-Bj-TVfKw.js";import{t as o}from"./button-Cym3gapE.js";import{i as ne,n as re,t as ie}from"./tooltip-DttaCTqz.js";import{a as ae,c as oe,i as se,o as ce,s as le,t as ue}from"./dialog-CTNat3T_.js";import{l as de}from"./select-XEGYznMI.js";import{n as fe,t as pe}from"./toggle-group-C2_37kV5.js";import{wt as me}from"./dist-D1GzYuCD.js";import{n as he}from"./dist-CJhtNlOm2.js";import{t as ge}from"./chevron-down-DNO3PgI_.js";import{t as _e}from"./spinner-t7GahFcQ.js";import{n as ve,t as ye}from"./panel-right-open-2VYfauQI.js";import{t as be}from"./undo-2-XcI_wHcs.js";import{t as xe}from"./x-DbShSCr5.js";import{t as Se}from"./timeline-diff-store-ym5Oz1UF.js";import{t as s}from"./lru-string-cache-Cc7rikda.js";import{a as Ce,c as we,i as Te,l as Ee,n as De,o as Oe,r as ke,s as Ae,u as je}from"./use-timeline-entry-diff-Blkn7mx5.js";var Me=a(),c=e(r(),1),l=n(),Ne=(0,c.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-CgaFZtD7.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ActivityPanelDiffView}));function u(e){let t=(0,Me.c)(161),{view:n,isPanelCollapsed:r,onTogglePanel:a}=e,{_:s}=ee(),{docName:u,sha:Ie,parentSha:Le,laterEdits:d,authorName:Re,relativeTime:ze}=n,[Be]=(0,c.useState)(Fe),[f,Ve]=(0,c.useState)(`rendered`),[p,He]=(0,c.useState)(!1),[m,Ue]=(0,c.useState)(!1),We=(0,c.useRef)(null),Ge=(0,c.useRef)(null),[Ke,qe]=(0,c.useState)(0),[Je,Ye]=(0,c.useState)(!0),h=De(Ie,u,Be,`vs-parent`,Le),g,_,v,y,Xe,b;t[0]!==f||t[1]!==h.after||t[2]!==h.before||t[3]!==h.diff||t[4]!==h.properties||t[5]!==h.status?(y=h.status===`ready`?Ae(h.before,h.after):null,b=f===`rendered`&&y?.ok===!0,_=h.status===`ready`?h.properties:null,v=_?.changes.length??0,g=_!==null&&(_.changes.length>0||_.unparseable!==null),Xe=h.status===`ready`?b&&y?.ok?Ee(y):Ce(h.diff):0,t[0]=f,t[1]=h.after,t[2]=h.before,t[3]=h.diff,t[4]=h.properties,t[5]=h.status,t[6]=g,t[7]=_,t[8]=v,t[9]=y,t[10]=Xe,t[11]=b):(g=t[6],_=t[7],v=t[8],y=t[9],Xe=t[10],b=t[11]);let Ze=Xe+(_===null?0:_.unparseable===null?Je?Math.min(v,50):0:1),Qe;t[12]===b?Qe=t[13]:(Qe=function(e){let t=Ge.current;if(!t)return;let n=[...t.querySelectorAll(ke),...b?Array.from(t.querySelectorAll(we)):Te(t)];if(n.length===0)return;let r=(e+n.length)%n.length;qe(r),n[r]?.scrollIntoView({block:`center`,behavior:`smooth`})},t[12]=b,t[13]=Qe);let $e=Qe,et,tt;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>()=>We.current?.abort(),tt=[],t[14]=et,t[15]=tt):(et=t[14],tt=t[15]),(0,c.useEffect)(et,tt);let nt=h.status===`ready`?`${f}:${h.diff}`:``,rt,it;t[16]===nt?(rt=t[17],it=t[18]):(rt=()=>{let e=Ge.current;if(nt===``||!e)return;qe(0);let t=!1,n=null,r,i,ee=()=>{if(t)return;let r=e.querySelector(`[data-property-change]`)??e.querySelector(`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`)??Te(e)[0];if(!r)return;t=!0,n?.disconnect();let i=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView({block:`center`,behavior:i?`auto`:`smooth`})},a=()=>{t||(r!==void 0&&clearTimeout(r),r=setTimeout(()=>{i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=requestAnimationFrame(ee)})},120))};n=new MutationObserver(a),n.observe(e,{childList:!0,subtree:!0}),a();let te=setTimeout(()=>n?.disconnect(),5e3);return()=>{n?.disconnect(),r!==void 0&&clearTimeout(r),i!==void 0&&cancelAnimationFrame(i),clearTimeout(te)}},it=[nt],t[16]=nt,t[17]=rt,t[18]=it),(0,c.useEffect)(rt,it);let at,ot;t[19]===p?(at=t[20],ot=t[21]):(at=()=>{let e=e=>{e.key===`Escape`&&(p||te()||Se())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ot=[p],t[19]=p,t[20]=at,t[21]=ot),(0,c.useEffect)(at,ot);let st;t[22]!==s||t[23]!==u||t[24]!==Ie?(st=async function(){Ue(!0);let e=new AbortController;We.current=e;let t=function(){e.signal.aborted||Ue(!1),We.current===e&&(We.current=null)},n;try{n=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:u,commitSha:Ie}),signal:e.signal})}catch(n){let r=n;!e.signal.aborted&&!(r instanceof DOMException&&r.name===`AbortError`)&&he.error(s({id:`NkXEFS`}),{duration:4e3}),t();return}if(e.signal.aborted){t();return}if(n.ok){t(),He(!1),Se();return}let r=`HTTP ${n.status}`;try{let e=me.safeParse(await n.json());e.success&&(r=e.data.title)}catch{}he.error(s({id:`uM6jnS`}),{description:r,duration:6e3}),t()},t[22]=s,t[23]=u,t[24]=Ie,t[25]=st):st=t[25];let x=st,ct=h.status===`ready`&&(h.additions>0||h.deletions>0),S;t[26]===s?S=t[27]:(S=s({id:`b18t0_`}),t[26]=s,t[27]=S);let lt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,l.jsx)(xe,{className:`size-4`}),t[28]=lt):lt=t[28];let C;t[29]===S?C=t[30]:(C=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-close`,"aria-label":S,onClick:Pe,children:lt})}),t[29]=S,t[30]=C);let w;t[31]===s?w=t[32]:(w=s({id:`b18t0_`}),t[31]=s,t[32]=w);let T;t[33]===w?T=t[34]:(T=(0,l.jsx)(re,{side:`bottom`,children:w}),t[33]=w,t[34]=T);let E;t[35]!==C||t[36]!==T?(E=(0,l.jsxs)(ie,{children:[C,T]}),t[35]=C,t[36]=T,t[37]=E):E=t[37];let D;t[38]===u?D=t[39]:(D=(0,l.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:u}),t[38]=u,t[39]=D);let O;t[40]!==Re||t[41]!==ze?(O=(0,l.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[Re,` · `,ze]}),t[40]=Re,t[41]=ze,t[42]=O):O=t[42];let k;t[43]!==D||t[44]!==O?(k=(0,l.jsxs)(`div`,{className:`min-w-[8rem] flex-1`,children:[D,O]}),t[43]=D,t[44]=O,t[45]=k):k=t[45];let A;t[46]===v?A=t[47]:(A=v>0&&(0,l.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,"data-testid":`timeline-diff-property-stat`,children:(0,l.jsx)(i,{id:`UI0WPT`,values:{propertyCount:v}})}),t[46]=v,t[47]=A);let j;t[48]!==s||t[49]!==h.additions||t[50]!==h.deletions||t[51]!==h.status||t[52]!==ct?(j=ct&&h.status===`ready`&&(0,l.jsxs)(`span`,{role:`img`,className:`shrink-0 text-xs tabular-nums`,"data-testid":`timeline-diff-stat`,"aria-label":s({id:`8lwQlE`,values:{0:h.additions,1:h.deletions}}),children:[(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-emerald-600 dark:text-emerald-500`,children:[`+`,h.additions]}),` `,(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-red-600 dark:text-red-500`,children:[`−`,h.deletions]})]}),t[48]=s,t[49]=h.additions,t[50]=h.deletions,t[51]=h.status,t[52]=ct,t[53]=j):j=t[53];let ut;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ut=e=>{(e===`rendered`||e===`source`)&&Ve(e)},t[54]=ut):ut=t[54];let M;t[55]===s?M=t[56]:(M=s({id:`ZW3mlR`}),t[55]=s,t[56]=M);let dt;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,l.jsx)(fe,{value:`rendered`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-rendered`,children:(0,l.jsx)(i,{id:`4z_1j2`})}),t[57]=dt):dt=t[57];let ft;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,l.jsx)(fe,{value:`source`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-source`,children:(0,l.jsx)(i,{id:`wdxz7K`})}),t[58]=ft):ft=t[58];let N;t[59]!==f||t[60]!==M?(N=(0,l.jsxs)(pe,{type:`single`,value:f,onValueChange:ut,"aria-label":M,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 rounded-md bg-muted p-0.5 dark:bg-background`,children:[dt,ft]}),t[59]=f,t[60]=M,t[61]=N):N=t[61];let P;t[62]!==s||t[63]!==Ze||t[64]!==Ke||t[65]!==$e?(P=Ze>1&&(0,l.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 rounded-md border border-border bg-muted/40 p-0.5 dark:bg-background`,children:[(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`_azghp`}),"data-testid":`timeline-diff-prev`,onClick:()=>$e(Ke-1),children:(0,l.jsx)(de,{className:`size-3.5`})}),(0,l.jsxs)(`span`,{className:`px-0.5 text-xs tabular-nums text-muted-foreground`,"aria-live":`polite`,children:[Ke+1,` / `,Ze]}),(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`-bFGPF`}),"data-testid":`timeline-diff-next`,onClick:()=>$e(Ke+1),children:(0,l.jsx)(ge,{className:`size-3.5`})})]}),t[62]=s,t[63]=Ze,t[64]=Ke,t[65]=$e,t[66]=P):P=t[66];let pt;t[67]!==x||t[68]!==d?(pt=()=>d>0?He(!0):x(),t[67]=x,t[68]=d,t[69]=pt):pt=t[69];let F;t[70]===m?F=t[71]:(F=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-1.5 size-3.5`}):(0,l.jsx)(be,{className:`mr-1.5 size-3.5`}),t[70]=m,t[71]=F);let mt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,l.jsx)(i,{id:`yKu_3Y`}),t[72]=mt):mt=t[72];let I;t[73]!==m||t[74]!==pt||t[75]!==F?(I=(0,l.jsxs)(o,{variant:`outline`,size:`sm`,className:`h-7 shrink-0`,"data-testid":`timeline-diff-restore`,disabled:m,onClick:pt,children:[F,mt]}),t[73]=m,t[74]=pt,t[75]=F,t[76]=I):I=t[76];let L;t[77]!==s||t[78]!==r?(L=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[77]=s,t[78]=r,t[79]=L):L=t[79];let ht=!r,R;t[80]===r?R=t[81]:(R=r?(0,l.jsx)(ye,{className:`size-4`}):(0,l.jsx)(ve,{className:`size-4`}),t[80]=r,t[81]=R);let z;t[82]!==a||t[83]!==L||t[84]!==ht||t[85]!==R?(z=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-toggle-panel`,"aria-label":L,"aria-expanded":ht,onClick:a,children:R})}),t[82]=a,t[83]=L,t[84]=ht,t[85]=R,t[86]=z):z=t[86];let B;t[87]!==s||t[88]!==r?(B=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[87]=s,t[88]=r,t[89]=B):B=t[89];let V;t[90]===B?V=t[91]:(V=(0,l.jsx)(re,{side:`bottom`,children:B}),t[90]=B,t[91]=V);let H;t[92]!==z||t[93]!==V?(H=(0,l.jsxs)(ie,{children:[z,V]}),t[92]=z,t[93]=V,t[94]=H):H=t[94];let U;t[95]!==A||t[96]!==j||t[97]!==N||t[98]!==P||t[99]!==I||t[100]!==H?(U=(0,l.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-2`,children:[A,j,N,P,I,H]}),t[95]=A,t[96]=j,t[97]=N,t[98]=P,t[99]=I,t[100]=H,t[101]=U):U=t[101];let W;t[102]!==E||t[103]!==k||t[104]!==U?(W=(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 border-b border-border px-3 py-2`,children:[E,k,U]}),t[102]=E,t[103]=k,t[104]=U,t[105]=W):W=t[105];let G;t[106]===h.status?G=t[107]:(G=h.status===`loading`&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`38foVZ`})]}),t[106]=h.status,t[107]=G);let K;t[108]===h.status?K=t[109]:(K=h.status===`error`&&(0,l.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:(0,l.jsx)(i,{id:`vvWZnu`})}),t[108]=h.status,t[109]=K);let q;t[110]!==_||t[111]!==Je||t[112]!==h.status?(q=h.status===`ready`&&_!==null&&(0,l.jsx)(je,{delta:_,open:Je,onOpenChange:e=>{Ye(e),qe(0)}}),t[110]=_,t[111]=Je,t[112]=h.status,t[113]=q):q=t[113];let J;t[114]!==g||t[115]!==f||t[116]!==y||t[117]!==h.after||t[118]!==h.diff||t[119]!==h.status?(J=h.status===`ready`&&(f===`rendered`&&y?.ok?(0,l.jsx)(Oe,{diff:y}):h.diff===``?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`border-b border-border px-4 py-2 text-xs text-muted-foreground italic`,children:g?(0,l.jsx)(i,{id:`oCO0pe`}):(0,l.jsx)(i,{id:`3YWddZ`})}),(0,l.jsx)(`pre`,{className:`whitespace-pre-wrap px-4 py-3 font-mono text-xs text-foreground/90`,children:h.after})]}):(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`EDm3wJ`})]}),children:(0,l.jsx)(Ne,{diff:h.diff,viewType:`unified`})})),t[114]=g,t[115]=f,t[116]=y,t[117]=h.after,t[118]=h.diff,t[119]=h.status,t[120]=J):J=t[120];let Y;t[121]!==G||t[122]!==K||t[123]!==q||t[124]!==J?(Y=(0,l.jsxs)(`div`,{ref:Ge,className:`min-h-0 flex-1 overflow-auto subtle-scrollbar`,children:[G,K,q,J]}),t[121]=G,t[122]=K,t[123]=q,t[124]=J,t[125]=Y):Y=t[125];let X;t[126]===m?X=t[127]:(X=e=>{!e&&!m?He(!1):e&&He(!0)},t[126]=m,t[127]=X);let Z;t[128]===s?Z=t[129]:(Z=s({id:`n3wx1q`}),t[128]=s,t[129]=Z);let Q;t[130]===Z?Q=t[131]:(Q=(0,l.jsx)(oe,{children:Z}),t[130]=Z,t[131]=Q);let gt;t[132]===d?gt=t[133]:(gt=(0,l.jsx)(i,{id:`nfPccR`,values:{laterEdits:d}}),t[132]=d,t[133]=gt);let _t;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,l.jsx)(i,{id:`5ZbJFS`}),t[134]=_t):_t=t[134];let vt;t[135]===gt?vt=t[136]:(vt=(0,l.jsxs)(ae,{children:[gt,` `,_t]}),t[135]=gt,t[136]=vt);let yt;t[137]!==Q||t[138]!==vt?(yt=(0,l.jsxs)(le,{children:[Q,vt]}),t[137]=Q,t[138]=vt,t[139]=yt):yt=t[139];let bt;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,l.jsx)(o,{variant:`outline`,"data-testid":`timeline-diff-restore-cancel`,onClick:()=>He(!1),children:(0,l.jsx)(i,{id:`dEgA5A`})}),t[140]=bt):bt=t[140];let xt;t[141]===x?xt=t[142]:(xt=()=>x(),t[141]=x,t[142]=xt);let St;t[143]===m?St=t[144]:(St=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-2 size-4`}):null,t[143]=m,t[144]=St);let Ct;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,l.jsx)(i,{id:`yKu_3Y`}),t[145]=Ct):Ct=t[145];let wt;t[146]!==m||t[147]!==xt||t[148]!==St?(wt=(0,l.jsxs)(ce,{children:[bt,(0,l.jsxs)(o,{variant:`destructive`,"data-testid":`timeline-diff-restore-confirm`,disabled:m,onClick:xt,children:[St,Ct]})]}),t[146]=m,t[147]=xt,t[148]=St,t[149]=wt):wt=t[149];let Tt;t[150]!==yt||t[151]!==wt?(Tt=(0,l.jsxs)(se,{children:[yt,wt]}),t[150]=yt,t[151]=wt,t[152]=Tt):Tt=t[152];let $;t[153]!==p||t[154]!==X||t[155]!==Tt?($=(0,l.jsx)(ue,{open:p,onOpenChange:X,children:Tt}),t[153]=p,t[154]=X,t[155]=Tt,t[156]=$):$=t[156];let Et;return t[157]!==W||t[158]!==Y||t[159]!==$?(Et=(0,l.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col bg-background`,"data-testid":`timeline-diff-pane`,children:[W,Y,$]}),t[157]=W,t[158]=Y,t[159]=$,t[160]=Et):Et=t[160],Et}function Pe(){return Se()}function Fe(){return new s(32)}export{u as TimelineDiffPane};
|
|
2
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./preload-helper-Chd9yIcd.js";import{t as n}from"./jsx-runtime-BUgB2tll.js";import{t as r}from"./react-f2sANaYj.js";import{n as i,r as ee}from"./dist-Nvb76hAm.js";import{t as a}from"./compiler-runtime-BfE3aGVn.js";import{t as te}from"./overlay-layers-Bj-TVfKw.js";import{t as o}from"./button-Cym3gapE.js";import{i as ne,n as re,t as ie}from"./tooltip-DttaCTqz.js";import{a as ae,c as oe,i as se,o as ce,s as le,t as ue}from"./dialog-CTNat3T_.js";import{l as de}from"./select-XEGYznMI.js";import{n as fe,t as pe}from"./toggle-group-C2_37kV5.js";import{wt as me}from"./dist-As2x8uCt.js";import{n as he}from"./dist-CJhtNlOm2.js";import{t as ge}from"./chevron-down-DNO3PgI_.js";import{t as _e}from"./spinner-t7GahFcQ.js";import{n as ve,t as ye}from"./panel-right-open-2VYfauQI.js";import{t as be}from"./undo-2-XcI_wHcs.js";import{t as xe}from"./x-DbShSCr5.js";import{t as Se}from"./timeline-diff-store-ym5Oz1UF.js";import{t as s}from"./lru-string-cache-Cc7rikda.js";import{a as Ce,c as we,i as Te,l as Ee,n as De,o as Oe,r as ke,s as Ae,u as je}from"./use-timeline-entry-diff-_fLA4Pt0.js";var Me=a(),c=e(r(),1),l=n(),Ne=(0,c.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-CgaFZtD7.js`),__vite__mapDeps([0,1,2,3,4,5,6]),import.meta.url)).ActivityPanelDiffView}));function u(e){let t=(0,Me.c)(161),{view:n,isPanelCollapsed:r,onTogglePanel:a}=e,{_:s}=ee(),{docName:u,sha:Ie,parentSha:Le,laterEdits:d,authorName:Re,relativeTime:ze}=n,[Be]=(0,c.useState)(Fe),[f,Ve]=(0,c.useState)(`rendered`),[p,He]=(0,c.useState)(!1),[m,Ue]=(0,c.useState)(!1),We=(0,c.useRef)(null),Ge=(0,c.useRef)(null),[Ke,qe]=(0,c.useState)(0),[Je,Ye]=(0,c.useState)(!0),h=De(Ie,u,Be,`vs-parent`,Le),g,_,v,y,Xe,b;t[0]!==f||t[1]!==h.after||t[2]!==h.before||t[3]!==h.diff||t[4]!==h.properties||t[5]!==h.status?(y=h.status===`ready`?Ae(h.before,h.after):null,b=f===`rendered`&&y?.ok===!0,_=h.status===`ready`?h.properties:null,v=_?.changes.length??0,g=_!==null&&(_.changes.length>0||_.unparseable!==null),Xe=h.status===`ready`?b&&y?.ok?Ee(y):Ce(h.diff):0,t[0]=f,t[1]=h.after,t[2]=h.before,t[3]=h.diff,t[4]=h.properties,t[5]=h.status,t[6]=g,t[7]=_,t[8]=v,t[9]=y,t[10]=Xe,t[11]=b):(g=t[6],_=t[7],v=t[8],y=t[9],Xe=t[10],b=t[11]);let Ze=Xe+(_===null?0:_.unparseable===null?Je?Math.min(v,50):0:1),Qe;t[12]===b?Qe=t[13]:(Qe=function(e){let t=Ge.current;if(!t)return;let n=[...t.querySelectorAll(ke),...b?Array.from(t.querySelectorAll(we)):Te(t)];if(n.length===0)return;let r=(e+n.length)%n.length;qe(r),n[r]?.scrollIntoView({block:`center`,behavior:`smooth`})},t[12]=b,t[13]=Qe);let $e=Qe,et,tt;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(et=()=>()=>We.current?.abort(),tt=[],t[14]=et,t[15]=tt):(et=t[14],tt=t[15]),(0,c.useEffect)(et,tt);let nt=h.status===`ready`?`${f}:${h.diff}`:``,rt,it;t[16]===nt?(rt=t[17],it=t[18]):(rt=()=>{let e=Ge.current;if(nt===``||!e)return;qe(0);let t=!1,n=null,r,i,ee=()=>{if(t)return;let r=e.querySelector(`[data-property-change]`)??e.querySelector(`.ok-diff-ins, .ok-diff-ins-block, [data-diff-deleted]`)??Te(e)[0];if(!r)return;t=!0,n?.disconnect();let i=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;r.scrollIntoView({block:`center`,behavior:i?`auto`:`smooth`})},a=()=>{t||(r!==void 0&&clearTimeout(r),r=setTimeout(()=>{i!==void 0&&cancelAnimationFrame(i),i=requestAnimationFrame(()=>{i=requestAnimationFrame(ee)})},120))};n=new MutationObserver(a),n.observe(e,{childList:!0,subtree:!0}),a();let te=setTimeout(()=>n?.disconnect(),5e3);return()=>{n?.disconnect(),r!==void 0&&clearTimeout(r),i!==void 0&&cancelAnimationFrame(i),clearTimeout(te)}},it=[nt],t[16]=nt,t[17]=rt,t[18]=it),(0,c.useEffect)(rt,it);let at,ot;t[19]===p?(at=t[20],ot=t[21]):(at=()=>{let e=e=>{e.key===`Escape`&&(p||te()||Se())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},ot=[p],t[19]=p,t[20]=at,t[21]=ot),(0,c.useEffect)(at,ot);let st;t[22]!==s||t[23]!==u||t[24]!==Ie?(st=async function(){Ue(!0);let e=new AbortController;We.current=e;let t=function(){e.signal.aborted||Ue(!1),We.current===e&&(We.current=null)},n;try{n=await fetch(`/api/rollback`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({docName:u,commitSha:Ie}),signal:e.signal})}catch(n){let r=n;!e.signal.aborted&&!(r instanceof DOMException&&r.name===`AbortError`)&&he.error(s({id:`NkXEFS`}),{duration:4e3}),t();return}if(e.signal.aborted){t();return}if(n.ok){t(),He(!1),Se();return}let r=`HTTP ${n.status}`;try{let e=me.safeParse(await n.json());e.success&&(r=e.data.title)}catch{}he.error(s({id:`uM6jnS`}),{description:r,duration:6e3}),t()},t[22]=s,t[23]=u,t[24]=Ie,t[25]=st):st=t[25];let x=st,ct=h.status===`ready`&&(h.additions>0||h.deletions>0),S;t[26]===s?S=t[27]:(S=s({id:`b18t0_`}),t[26]=s,t[27]=S);let lt;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(lt=(0,l.jsx)(xe,{className:`size-4`}),t[28]=lt):lt=t[28];let C;t[29]===S?C=t[30]:(C=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-close`,"aria-label":S,onClick:Pe,children:lt})}),t[29]=S,t[30]=C);let w;t[31]===s?w=t[32]:(w=s({id:`b18t0_`}),t[31]=s,t[32]=w);let T;t[33]===w?T=t[34]:(T=(0,l.jsx)(re,{side:`bottom`,children:w}),t[33]=w,t[34]=T);let E;t[35]!==C||t[36]!==T?(E=(0,l.jsxs)(ie,{children:[C,T]}),t[35]=C,t[36]=T,t[37]=E):E=t[37];let D;t[38]===u?D=t[39]:(D=(0,l.jsx)(`div`,{className:`truncate text-sm font-medium text-foreground`,children:u}),t[38]=u,t[39]=D);let O;t[40]!==Re||t[41]!==ze?(O=(0,l.jsxs)(`div`,{className:`truncate text-xs text-muted-foreground`,children:[Re,` · `,ze]}),t[40]=Re,t[41]=ze,t[42]=O):O=t[42];let k;t[43]!==D||t[44]!==O?(k=(0,l.jsxs)(`div`,{className:`min-w-[8rem] flex-1`,children:[D,O]}),t[43]=D,t[44]=O,t[45]=k):k=t[45];let A;t[46]===v?A=t[47]:(A=v>0&&(0,l.jsx)(`span`,{className:`shrink-0 text-xs text-muted-foreground tabular-nums`,"data-testid":`timeline-diff-property-stat`,children:(0,l.jsx)(i,{id:`UI0WPT`,values:{propertyCount:v}})}),t[46]=v,t[47]=A);let j;t[48]!==s||t[49]!==h.additions||t[50]!==h.deletions||t[51]!==h.status||t[52]!==ct?(j=ct&&h.status===`ready`&&(0,l.jsxs)(`span`,{role:`img`,className:`shrink-0 text-xs tabular-nums`,"data-testid":`timeline-diff-stat`,"aria-label":s({id:`8lwQlE`,values:{0:h.additions,1:h.deletions}}),children:[(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-emerald-600 dark:text-emerald-500`,children:[`+`,h.additions]}),` `,(0,l.jsxs)(`span`,{"aria-hidden":`true`,className:`text-red-600 dark:text-red-500`,children:[`−`,h.deletions]})]}),t[48]=s,t[49]=h.additions,t[50]=h.deletions,t[51]=h.status,t[52]=ct,t[53]=j):j=t[53];let ut;t[54]===Symbol.for(`react.memo_cache_sentinel`)?(ut=e=>{(e===`rendered`||e===`source`)&&Ve(e)},t[54]=ut):ut=t[54];let M;t[55]===s?M=t[56]:(M=s({id:`ZW3mlR`}),t[55]=s,t[56]=M);let dt;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(dt=(0,l.jsx)(fe,{value:`rendered`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-rendered`,children:(0,l.jsx)(i,{id:`4z_1j2`})}),t[57]=dt):dt=t[57];let ft;t[58]===Symbol.for(`react.memo_cache_sentinel`)?(ft=(0,l.jsx)(fe,{value:`source`,className:`h-6 px-2 text-xs`,"data-testid":`timeline-diff-render-source`,children:(0,l.jsx)(i,{id:`wdxz7K`})}),t[58]=ft):ft=t[58];let N;t[59]!==f||t[60]!==M?(N=(0,l.jsxs)(pe,{type:`single`,value:f,onValueChange:ut,"aria-label":M,variant:`segmented`,size:`sm`,spacing:1,className:`shrink-0 rounded-md bg-muted p-0.5 dark:bg-background`,children:[dt,ft]}),t[59]=f,t[60]=M,t[61]=N):N=t[61];let P;t[62]!==s||t[63]!==Ze||t[64]!==Ke||t[65]!==$e?(P=Ze>1&&(0,l.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5 rounded-md border border-border bg-muted/40 p-0.5 dark:bg-background`,children:[(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`_azghp`}),"data-testid":`timeline-diff-prev`,onClick:()=>$e(Ke-1),children:(0,l.jsx)(de,{className:`size-3.5`})}),(0,l.jsxs)(`span`,{className:`px-0.5 text-xs tabular-nums text-muted-foreground`,"aria-live":`polite`,children:[Ke+1,` / `,Ze]}),(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-6`,"aria-label":s({id:`-bFGPF`}),"data-testid":`timeline-diff-next`,onClick:()=>$e(Ke+1),children:(0,l.jsx)(ge,{className:`size-3.5`})})]}),t[62]=s,t[63]=Ze,t[64]=Ke,t[65]=$e,t[66]=P):P=t[66];let pt;t[67]!==x||t[68]!==d?(pt=()=>d>0?He(!0):x(),t[67]=x,t[68]=d,t[69]=pt):pt=t[69];let F;t[70]===m?F=t[71]:(F=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-1.5 size-3.5`}):(0,l.jsx)(be,{className:`mr-1.5 size-3.5`}),t[70]=m,t[71]=F);let mt;t[72]===Symbol.for(`react.memo_cache_sentinel`)?(mt=(0,l.jsx)(i,{id:`yKu_3Y`}),t[72]=mt):mt=t[72];let I;t[73]!==m||t[74]!==pt||t[75]!==F?(I=(0,l.jsxs)(o,{variant:`outline`,size:`sm`,className:`h-7 shrink-0`,"data-testid":`timeline-diff-restore`,disabled:m,onClick:pt,children:[F,mt]}),t[73]=m,t[74]=pt,t[75]=F,t[76]=I):I=t[76];let L;t[77]!==s||t[78]!==r?(L=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[77]=s,t[78]=r,t[79]=L):L=t[79];let ht=!r,R;t[80]===r?R=t[81]:(R=r?(0,l.jsx)(ye,{className:`size-4`}):(0,l.jsx)(ve,{className:`size-4`}),t[80]=r,t[81]=R);let z;t[82]!==a||t[83]!==L||t[84]!==ht||t[85]!==R?(z=(0,l.jsx)(ne,{asChild:!0,children:(0,l.jsx)(o,{variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,"data-testid":`timeline-diff-toggle-panel`,"aria-label":L,"aria-expanded":ht,onClick:a,children:R})}),t[82]=a,t[83]=L,t[84]=ht,t[85]=R,t[86]=z):z=t[86];let B;t[87]!==s||t[88]!==r?(B=s(r?{id:`6iDEWA`}:{id:`170Js2`}),t[87]=s,t[88]=r,t[89]=B):B=t[89];let V;t[90]===B?V=t[91]:(V=(0,l.jsx)(re,{side:`bottom`,children:B}),t[90]=B,t[91]=V);let H;t[92]!==z||t[93]!==V?(H=(0,l.jsxs)(ie,{children:[z,V]}),t[92]=z,t[93]=V,t[94]=H):H=t[94];let U;t[95]!==A||t[96]!==j||t[97]!==N||t[98]!==P||t[99]!==I||t[100]!==H?(U=(0,l.jsxs)(`div`,{className:`ml-auto flex flex-wrap items-center justify-end gap-2`,children:[A,j,N,P,I,H]}),t[95]=A,t[96]=j,t[97]=N,t[98]=P,t[99]=I,t[100]=H,t[101]=U):U=t[101];let W;t[102]!==E||t[103]!==k||t[104]!==U?(W=(0,l.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1.5 border-b border-border px-3 py-2`,children:[E,k,U]}),t[102]=E,t[103]=k,t[104]=U,t[105]=W):W=t[105];let G;t[106]===h.status?G=t[107]:(G=h.status===`loading`&&(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`38foVZ`})]}),t[106]=h.status,t[107]=G);let K;t[108]===h.status?K=t[109]:(K=h.status===`error`&&(0,l.jsx)(`p`,{className:`px-4 py-3 text-xs text-destructive`,children:(0,l.jsx)(i,{id:`vvWZnu`})}),t[108]=h.status,t[109]=K);let q;t[110]!==_||t[111]!==Je||t[112]!==h.status?(q=h.status===`ready`&&_!==null&&(0,l.jsx)(je,{delta:_,open:Je,onOpenChange:e=>{Ye(e),qe(0)}}),t[110]=_,t[111]=Je,t[112]=h.status,t[113]=q):q=t[113];let J;t[114]!==g||t[115]!==f||t[116]!==y||t[117]!==h.after||t[118]!==h.diff||t[119]!==h.status?(J=h.status===`ready`&&(f===`rendered`&&y?.ok?(0,l.jsx)(Oe,{diff:y}):h.diff===``?(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(`p`,{className:`border-b border-border px-4 py-2 text-xs text-muted-foreground italic`,children:g?(0,l.jsx)(i,{id:`oCO0pe`}):(0,l.jsx)(i,{id:`3YWddZ`})}),(0,l.jsx)(`pre`,{className:`whitespace-pre-wrap px-4 py-3 font-mono text-xs text-foreground/90`,children:h.after})]}):(0,l.jsx)(c.Suspense,{fallback:(0,l.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-3 text-xs text-muted-foreground`,children:[(0,l.jsx)(_e,{"aria-hidden":`true`,className:`size-3`}),(0,l.jsx)(i,{id:`EDm3wJ`})]}),children:(0,l.jsx)(Ne,{diff:h.diff,viewType:`unified`})})),t[114]=g,t[115]=f,t[116]=y,t[117]=h.after,t[118]=h.diff,t[119]=h.status,t[120]=J):J=t[120];let Y;t[121]!==G||t[122]!==K||t[123]!==q||t[124]!==J?(Y=(0,l.jsxs)(`div`,{ref:Ge,className:`min-h-0 flex-1 overflow-auto subtle-scrollbar`,children:[G,K,q,J]}),t[121]=G,t[122]=K,t[123]=q,t[124]=J,t[125]=Y):Y=t[125];let X;t[126]===m?X=t[127]:(X=e=>{!e&&!m?He(!1):e&&He(!0)},t[126]=m,t[127]=X);let Z;t[128]===s?Z=t[129]:(Z=s({id:`n3wx1q`}),t[128]=s,t[129]=Z);let Q;t[130]===Z?Q=t[131]:(Q=(0,l.jsx)(oe,{children:Z}),t[130]=Z,t[131]=Q);let gt;t[132]===d?gt=t[133]:(gt=(0,l.jsx)(i,{id:`nfPccR`,values:{laterEdits:d}}),t[132]=d,t[133]=gt);let _t;t[134]===Symbol.for(`react.memo_cache_sentinel`)?(_t=(0,l.jsx)(i,{id:`5ZbJFS`}),t[134]=_t):_t=t[134];let vt;t[135]===gt?vt=t[136]:(vt=(0,l.jsxs)(ae,{children:[gt,` `,_t]}),t[135]=gt,t[136]=vt);let yt;t[137]!==Q||t[138]!==vt?(yt=(0,l.jsxs)(le,{children:[Q,vt]}),t[137]=Q,t[138]=vt,t[139]=yt):yt=t[139];let bt;t[140]===Symbol.for(`react.memo_cache_sentinel`)?(bt=(0,l.jsx)(o,{variant:`outline`,"data-testid":`timeline-diff-restore-cancel`,onClick:()=>He(!1),children:(0,l.jsx)(i,{id:`dEgA5A`})}),t[140]=bt):bt=t[140];let xt;t[141]===x?xt=t[142]:(xt=()=>x(),t[141]=x,t[142]=xt);let St;t[143]===m?St=t[144]:(St=m?(0,l.jsx)(_e,{"aria-hidden":`true`,className:`mr-2 size-4`}):null,t[143]=m,t[144]=St);let Ct;t[145]===Symbol.for(`react.memo_cache_sentinel`)?(Ct=(0,l.jsx)(i,{id:`yKu_3Y`}),t[145]=Ct):Ct=t[145];let wt;t[146]!==m||t[147]!==xt||t[148]!==St?(wt=(0,l.jsxs)(ce,{children:[bt,(0,l.jsxs)(o,{variant:`destructive`,"data-testid":`timeline-diff-restore-confirm`,disabled:m,onClick:xt,children:[St,Ct]})]}),t[146]=m,t[147]=xt,t[148]=St,t[149]=wt):wt=t[149];let Tt;t[150]!==yt||t[151]!==wt?(Tt=(0,l.jsxs)(se,{children:[yt,wt]}),t[150]=yt,t[151]=wt,t[152]=Tt):Tt=t[152];let $;t[153]!==p||t[154]!==X||t[155]!==Tt?($=(0,l.jsx)(ue,{open:p,onOpenChange:X,children:Tt}),t[153]=p,t[154]=X,t[155]=Tt,t[156]=$):$=t[156];let Et;return t[157]!==W||t[158]!==Y||t[159]!==$?(Et=(0,l.jsxs)(`div`,{className:`absolute inset-0 z-20 flex flex-col bg-background`,"data-testid":`timeline-diff-pane`,children:[W,Y,$]}),t[157]=W,t[158]=Y,t[159]=$,t[160]=Et):Et=t[160],Et}function Pe(){return Se()}function Fe(){return new s(32)}export{u as TimelineDiffPane};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{er as n}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{er as n}from"./DocumentContext-CZ1LyjXH.js";import{t as r}from"./react-f2sANaYj.js";import{t as i}from"./compiler-runtime-BfE3aGVn.js";import{i as a,r as o,t as s}from"./cursor-2VSK5BUh.js";import{t as c}from"./copilot-DMpTxujg.js";var l=i(),u=t();function d(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Cline icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M463.6,275.08l-29.26-58.75v-33.83c0-56.08-45.01-101.5-100.53-101.5h-50.01c3.62-7.43,5.61-15.79,5.61-24.61,0-31.17-25.08-56.39-56.07-56.39s-56.07,25.22-56.07,56.39c0,8.82,1.99,17.17,5.61,24.61h-50.01c-55.51,0-100.52,45.42-100.52,101.5v33.83l-29.87,58.59c-3.01,5.9-3.01,12.92,0,18.81l29.87,57.93v33.83c0,56.08,45.01,101.5,100.52,101.5h200.95c55.51,0,100.53-45.42,100.53-101.5v-33.83l29.21-58.13c2.9-5.79,2.9-12.61.05-18.46ZM202.75,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02ZM350.58,322.96c0,25.48-20.54,46.14-45.88,46.14s-45.88-20.66-45.88-46.14v-82.02c0-25.48,20.54-46.14,45.88-46.14s45.88,20.66,45.88,46.14v82.02Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Cline icon`,xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 466.73 487.04`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function f(e){let t=(0,l.c)(4),n,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,u.jsx)(`title`,{children:`Windsurf icon`}),r=(0,u.jsx)(`path`,{fill:`currentColor`,d:`M21.3192 4.9697H21.1203C20.0734 4.96806 19.2238 5.81589 19.2238 6.86264V11.0961C19.2238 11.9415 18.525 12.6263 17.6934 12.6263C17.1993 12.6263 16.706 12.3777 16.4133 11.9603L12.0896 5.78492C11.7308 5.27214 11.1471 4.96643 10.5152 4.96643C9.52943 4.96643 8.64234 5.80448 8.64234 6.83902V11.0969C8.64234 11.9423 7.94932 12.6271 7.11197 12.6271C6.61625 12.6271 6.12376 12.3785 5.83105 11.9611L0.992853 5.0504C0.883594 4.89387 0.638184 4.97133 0.638184 5.1621V8.85424C0.638184 9.04094 0.695264 9.22193 0.802059 9.37517L5.56362 16.175C5.84492 16.5769 6.25994 16.8753 6.73852 16.9837C7.93627 17.256 9.03861 16.334 9.03861 15.1592V10.9037C9.03861 10.0583 9.7235 9.37354 10.569 9.37354H10.5714C11.081 9.37354 11.5588 9.62219 11.8515 10.0396L16.1761 16.2141C16.5356 16.7277 17.0892 17.0326 17.7497 17.0326C18.7574 17.0326 19.6209 16.1937 19.6209 15.16V10.9029C19.6209 10.0575 20.3058 9.37273 21.1512 9.37273H21.32C21.426 9.37273 21.5116 9.28713 21.5116 9.18116V5.16127C21.5116 5.05531 21.426 4.9697 21.32 4.9697H21.3192Z`}),t[0]=n,t[1]=r):(n=t[0],r=t[1]);let i;return t[2]===e?i=t[3]:(i=(0,u.jsxs)(`svg`,{role:`img`,"aria-label":`Windsurf icon`,xmlns:`http://www.w3.org/2000/svg`,width:22,height:22,viewBox:`0 0 22 22`,fill:`none`,...e,children:[n,r]}),t[2]=e,t[3]=i),i}function p(e){let t=(0,l.c)(17),r,i;if(t[0]===e?(r=t[1],i=t[2]):({icon:r,...i}=e,t[0]=e,t[1]=r,t[2]=i),r===`claude`){let e;return t[3]===i?e=t[4]:(e=(0,u.jsx)(a,{...i}),t[3]=i,t[4]=e),e}if(r===`cursor`){let e;return t[5]===i?e=t[6]:(e=(0,u.jsx)(s,{...i}),t[5]=i,t[6]=e),e}if(r===`windsurf`){let e;return t[7]===i?e=t[8]:(e=(0,u.jsx)(f,{...i}),t[7]=i,t[8]=e),e}if(r===`openai`){let e;return t[9]===i?e=t[10]:(e=(0,u.jsx)(o,{...i}),t[9]=i,t[10]=e),e}if(r===`cline`){let e;return t[11]===i?e=t[12]:(e=(0,u.jsx)(d,{...i}),t[11]=i,t[12]=e),e}if(r===`github`){let e;return t[13]===i?e=t[14]:(e=(0,u.jsx)(c,{...i}),t[13]=i,t[14]=e),e}let p=i,m;return t[15]===p?m=t[16]:(m=(0,u.jsx)(n,{strokeWidth:1.5,...p}),t[15]=p,t[16]=m),m}var m=e(r(),1),h=null,g=new Set;function _(){for(let e of g)e()}function v(e){h=e,_()}function y(e){if(h===null)return;let t=Math.max(0,Math.min(e,h.maxVersions));t!==h.keptCount&&(h={...h,keptCount:t},_())}function b(e,t,n){if(h===null||h.agentId!==e||h.docName!==t||h.maxVersions===n)return;let r=h.keptCount===h.maxVersions?n:Math.min(h.keptCount,n);h={...h,maxVersions:n,keptCount:r},_()}function x(){h!==null&&(h=null,_())}function S(e){return g.add(e),()=>{g.delete(e)}}function C(){return h}function w(){return(0,m.useSyncExternalStore)(S,C,C)}export{w as a,b as i,v as n,p as o,y as r,x as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Sr as n,i as r,or as i,rr as a,vr as o,yr as s}from"./DocumentContext-
|
|
1
|
+
import{o as e}from"./chunk-CYidjpOJ.js";import{t}from"./jsx-runtime-BUgB2tll.js";import{Sr as n,i as r,or as i,rr as a,vr as o,yr as s}from"./DocumentContext-CZ1LyjXH.js";import{t as c}from"./react-f2sANaYj.js";import{n as l,r as u}from"./dist-Nvb76hAm.js";import{t as d}from"./compiler-runtime-BfE3aGVn.js";import{t as f}from"./utils-CPqDy6Hr.js";import{n as p,t as m}from"./clipboard-adapter-815RzzoI.js";import{C as h,S as g,_,a as v,h as y}from"./SkillInstallMenu-BwbbztKY.js";import{t as b}from"./button-Cym3gapE.js";import{t as x}from"./dist-BHv-mziD.js";import{i as S,n as C,t as w}from"./tooltip-DttaCTqz.js";import{n as T,r as E,t as D}from"./collapsible-DYySK8La.js";import{a as O,c as k,i as A,n as j,o as M,s as N,t as P}from"./dialog-CTNat3T_.js";import{t as F}from"./alert-dialog-D9BtoYXB.js";import{t as I}from"./checkbox-LVDa5cS9.js";import{a as L,m as R,r as z,t as B}from"./dropdown-menu-CRvS0_4-.js";import{t as ee}from"./label-D-K3fWtj.js";import{i as te,n as V,o as ne,s as H,t as U}from"./select-XEGYznMI.js";import{n as W,t as re}from"./radio-group-npdxiS6E.js";import{Gt as G,Kt as K,Ms as ie,Ut as ae,Wt as oe,Xo as se,Yt as ce,po as le,qo as ue,rn as q,wt as de}from"./dist-As2x8uCt.js";import{n as J}from"./dist-CJhtNlOm2.js";import{c as fe}from"./use-settings-route-Dq3eM_ye.js";import{t as Y}from"./dist-Cr4-nBVI.js";import{c as pe,v as me,x as he}from"./documents-events-2g_OBjKU.js";import{i as ge}from"./use-apply-config-theme-CBmHKD_B.js";import{t as _e}from"./parse-api-error-Dd8VI2eu.js";import{n as ve}from"./use-workspace-DRylP9vX.js";import{t as X}from"./createLucideIcon-BulbvLvN.js";import{h as ye,n as be,r as xe,t as Se}from"./EnableSyncConfirmDialog-DGwynRzU.js";import{c as Ce,d as we,l as Te}from"./Mermaid-B4Oa2diB.js";import{t as Ee}from"./arrow-up-right-BTi7mHwL.js";import{t as De}from"./check-Dut4Aov8.js";import{t as Oe}from"./chevron-right-4mYNnAZZ.js";import{s as ke}from"./prop-types-CTZ-Zcfm.js";import{n as Ae,t as je}from"./terminal-D4HSnHXf.js";import{a as Me,r as Ne,t as Pe}from"./folder-config-api-DhiWnWlS.js";import{t as Fe}from"./spinner-t7GahFcQ.js";import{t as Ie}from"./refresh-cw-BFSYd-XR.js";import{t as Le}from"./trash-2-DSqYvaPJ.js";import{t as Re}from"./triangle-alert-GeclLtDN.js";import{t as ze}from"./x-DbShSCr5.js";import{d as Be,f as Ve,n as He,u as Ue,v as We}from"./doc-paths-BkNaaTOB.js";import"./config-provider-DWieljqa.js";import{S as Ge,h as Ke,i as qe,p as Je,x as Ye}from"./skills-api-KE9J-94z.js";import{p as Xe,r as Ze,t as Qe}from"./skill-scope-CauFSzAn.js";import{t as $e}from"./input-DJ1c1x-M.js";import{a as et,i as tt,r as nt,t as rt}from"./popover-BE6X9rKr.js";import{t as it}from"./external-link-B0bVg1hn.js";import{t as at}from"./badge-BWfmbBoh.js";import{a as ot,i as st,n as ct,o as lt,r as ut,s as dt,t as ft}from"./field-Di3yPBdO.js";import{t as pt}from"./use-skills-RpG-BeVz.js";import{t as mt}from"./textarea-BoMa_3jF.js";import{t as ht}from"./terminal-command-events-D0gJ8NJs.js";var gt=X(`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`}]]),_t=X(`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`}]]),vt=X(`cloud`,[[`path`,{d:`M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z`,key:`p7xjir`}]]),yt=X(`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`}]]),bt=X(`move-up-right`,[[`path`,{d:`M13 5H19V11`,key:`1n1gyv`}],[`path`,{d:`M19 5L5 19`,key:`72u4yj`}]]),xt=X(`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`}]]);function St(e){return e===`eperm`?Y._({id:`XuQzrk`}):Y._({id:`BUyQnq`})}async function Ct(e){let t=await e.restartServer(e.config.projectPath);return t.ok?{ok:!0}:{ok:!1,message:St(t.reason)}}var Z=d(),Q=e(c(),1);function wt(e){let t=(0,Z.c)(12),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n={status:`idle`},t[0]=n):n=t[0];let[r,i]=(0,Q.useState)(n),[a,o]=(0,Q.useState)(0),s,c;t[1]===e?(s=t[2],c=t[3]):(s=()=>{if(e!==null)return he(()=>{o(Ot)})},c=[e],t[1]=e,t[2]=s,t[3]=c),(0,Q.useEffect)(s,c);let l;t[4]===e?l=t[5]:(l=()=>{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(Et).then(e=>{if(!t){if(!e||typeof e!=`object`||!e.folder){i({status:`error`,message:Y._({id:`_ci9Bj`})});return}i({status:`ready`,data:{folder:e.folder,frontmatterLocal:e.frontmatter_local??null}})}}).catch(e=>{t||i({status:`error`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!0}},t[4]=e,t[5]=l);let u;t[6]!==e||t[7]!==a?(u=[e,a],t[6]=e,t[7]=a,t[8]=u):u=t[8],(0,Q.useEffect)(l,u);let d;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(d=()=>o(Tt),t[9]=d):d=t[9];let f;return t[10]===r?f=t[11]:(f={state:r,refresh:d},t[10]=r,t[11]=f),f}function Tt(e){return e+1}async function Et(e){if(!e.ok){let t=await e.json().catch(Dt);throw Error(_e(t)??`HTTP ${e.status}`)}return e.json()}function Dt(){return null}function Ot(e){return e+1}function kt(){let e=(0,Z.c)(6),t;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t={status:`idle`},e[0]=t):t=e[0];let[n,r]=(0,Q.useState)(t),[i,a]=(0,Q.useState)(0),o,s;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=()=>he(()=>{a(Mt)}),s=[],e[1]=o,e[2]=s):(o=e[1],s=e[2]),(0,Q.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(At).then(t=>{if(e)return;let n=q.safeParse(t);if(!n.success){console.error(`[ok-templates] /api/templates response failed schema validation:`,n.error.issues),r({status:`error`,message:Y._({id:`RLNIgv`})});return}r({status:`ready`,data:n.data.templates})}).catch(t=>{e||r({status:`error`,message:t instanceof Error?t.message:String(t)})}),()=>{e=!0}},e[3]=c):c=e[3];let l;return e[4]===i?l=e[5]:(l=[i],e[4]=i,e[5]=l),(0,Q.useEffect)(c,l),n}async function At(e){if(!e.ok){let t=await e.json().catch(jt);throw Error(_e(t)??`HTTP ${e.status}`)}return e.json()}function jt(){return null}function Mt(e){return e+1}async function Nt(){try{let e=await fetch(`/api/semantic-status`);return e.ok?await e.json():(console.debug(`[semantic-status] probe returned`,e.status),null)}catch(e){return console.debug(`[semantic-status] probe failed`,e),null}}function Pt(e){let t=(0,Z.c)(16),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let r=n.enabled??!0,[i,a]=(0,Q.useState)(null),o;t[2]===r?o=t[3]:(o=function(){r&&Nt().then(e=>{e&&a(e)})},t[2]=r,t[3]=o);let s=o,c;t[4]===s?c=t[5]:(c=()=>{s()},t[4]=s,t[5]=c);let l;t[6]===r?l=t[7]:(l=[r],t[6]=r,t[7]=l),(0,Q.useEffect)(c,l);let u;t[8]!==r||t[9]!==s?(u=()=>{if(r)return me(e=>{e.includes(`files`)&&s()})},t[8]=r,t[9]=s,t[10]=u):u=t[10];let d;t[11]===r?d=t[12]:(d=[r],t[11]=r,t[12]=d),(0,Q.useEffect)(u,d);let f;return t[13]!==s||t[14]!==i?(f={status:i,refresh:s},t[13]=s,t[14]=i,t[15]=f):f=t[15],f}var $=t(),Ft=`github.com`,It=new Map;async function Lt(e){try{let t=await e.json(),n=de.safeParse(t);if(n.success)return n.data.title}catch{}}async function Rt(e,t){return fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t??{})})}async function zt(e){let t=e?.host??Ft,n=await Rt(`/api/local-op/auth/status`,e);if(!n.ok)return{authenticated:!1,host:t,error:await Lt(n)};let r=await n.json(),i=typeof r.host==`string`?r.host:t,a=r.ghAvailable===!0;if(r.authenticated===!0&&typeof r.login==`string`){let e=r.tier===`A`||r.tier===`B`||r.tier===`C`?r.tier:void 0;return{authenticated:!0,host:i,login:r.login,tier:e,name:typeof r.name==`string`?r.name:void 0,email:typeof r.email==`string`?r.email:void 0,ghAvailable:a}}return{authenticated:!1,host:i,error:typeof r.error==`string`?r.error:void 0,ghAvailable:a}}function Bt(e){let t=e?.host??Ft,n=It.get(t);if(n)return n;let r=zt(e).finally(()=>{It.delete(t)});return It.set(t,r),r}function Vt(e){let t=e.split(`
|
|
2
2
|
`);for(let e=t.length-1;e>=0;e--){let n=t[e]?.trim();if(n)try{let e=JSON.parse(n);if(e&&typeof e==`object`)return e}catch{}}return null}function Ht(){return{status:Bt,async repos(e){let t=e?.host??`github.com`,n=await Rt(`/api/local-op/auth/repos`,e);if(!n.ok)return{ok:!1,error:await Lt(n)??Y._({id:`sGZLfB`})};let r=Vt(await n.text());if(r&&r.type===`error`&&r.problem&&typeof r.problem==`object`){let e=r.problem;return{ok:!1,error:e.detail||e.title||Y._({id:`sGZLfB`})}}if(!r||!Array.isArray(r.repos))return{ok:!1,error:Y._({id:`sGZLfB`})};let i=[];for(let e of r.repos){let t=e;typeof t?.full_name==`string`&&typeof t.clone_url==`string`&&i.push({full_name:t.full_name,clone_url:t.clone_url,private:t.private===!0})}return{ok:!0,host:typeof r.host==`string`?r.host:t,repos:i}},async signout(e){let t=await Rt(`/api/local-op/auth/signout`,e);return t.ok?{ok:!0}:{ok:!1,error:await Lt(t)}}}}function Ut(e){return{status:t=>e.localOp.authStatus(t),repos:t=>e.localOp.authRepos(t)}}async function Wt(e,t){let n=e.getReader(),r=new TextDecoder,i=``;for(;;){let{done:e,value:a}=await n.read();if(e)return i+=r.decode(),!!(i.trim()&&t(i)===`terminal`);i+=r.decode(a,{stream:!0});let o=i.split(`
|
|
3
3
|
`);i=o.pop()??``;for(let e of o)if(e.trim()&&t(e)===`terminal`)return!0}}function Gt(e){let t=[],n=[],r=new AbortController,i=!1,a=()=>{for(let e of n.splice(0))e(null)};return e(e=>{i||(n.length>0?n.shift()?.(e):t.push(e),(e.type===`complete`||e.type===`error`)&&(i=!0,r.abort(),a()))},r.signal),{events:{[Symbol.asyncIterator](){return{async next(){if(t.length>0){let e=t.shift();return e===void 0?{value:void 0,done:!0}:{value:e,done:!1}}return i?{value:void 0,done:!0}:new Promise(e=>{n.push(t=>{e(t===null?{value:void 0,done:!0}:{value:t,done:!1})})})}}}},cancel:()=>{i||(i=!0,r.abort(),a())}}}var Kt=2e3,qt=1e4;function Jt(e,t){return new Promise(n=>{let r=setTimeout(()=>{t.removeEventListener(`abort`,i),n()},e);function i(){clearTimeout(r),n()}t.addEventListener(`abort`,i,{once:!0})})}function Yt(e){fetch(`/api/local-op/auth/cancel`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({channel:e})}).catch(e=>{console.warn(`[auth-transport] Cancel request failed (best-effort):`,e instanceof Error?e.message:e)})}async function Xt(e,t,n,r){let i=Ht(),a=Kt;for(;!t.aborted&&Date.now()<n;){try{let n=await i.status(r?{host:r}:void 0);if(t.aborted)return;if(n.authenticated){e({type:`complete`,host:n.host,login:n.login,name:n.name,email:n.email});return}}catch(e){console.warn(`[auth-transport] Recovery probe failed:`,e instanceof Error?e.message:e)}await Jt(a,t),a=Math.min(a*1.5,qt)}t.aborted||e({type:`error`,message:Y._({id:`ve8vEM`})})}function Zt(e,t,n){let r=!1,i=Gt((n,i)=>{let a=e=>{(e.type===`complete`||e.type===`error`)&&(r=!0),n(e)};(async()=>{let n=null;try{let r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:i});if(!r.ok){let e=Y._({id:`LnVIW4`});try{let t=de.safeParse(await r.json());t.success&&(e=t.data.title)}catch{}a({type:`error`,message:e});return}if(!r.body){a({type:`error`,message:Y._({id:`LnVIW4`})});return}if(await Wt(r.body,e=>{let t;try{t=JSON.parse(e)}catch{return console.warn(`[auth-transport] Dropped unparseable NDJSON line:`,e.slice(0,100)),`continue`}if(t&&typeof t==`object`&&t.type===`error`&&`problem`in t){let e=t.problem;return a({type:`error`,message:e?.detail||e?.title||Y._({id:`29VNqC`})}),`terminal`}if(t.type===`ping`)return`continue`;let r=t;return r.type===`verification`&&(n=Date.now()+r.expires_in*1e3),a(r),r.type===`complete`||r.type===`error`?`terminal`:`continue`})||i.aborted)return;if(n===null){a({type:`error`,message:Y._({id:`DskIkK`})});return}await Xt(a,i,n,t.host)}catch(e){if(e instanceof Error&&e.name===`AbortError`)return;if(n!==null){await Xt(a,i,n,t.host);return}a({type:`error`,message:Y._({id:`Q5fqMz`})})}})()});return{events:i.events,cancel:()=>{r||Yt(n),i.cancel()}}}function Qt(){return{start(){return Zt(`/api/local-op/auth/login`,{json:!0},`login`)},ghLogin(e){return Zt(`/api/local-op/auth/gh-login`,{host:e,json:!0},`gh-login`)},async pat(e,t){try{let n=await fetch(`/api/local-op/auth/pat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({host:e,token:t})});if(n.ok){let e=await n.json();return{ok:!0,login:typeof e.login==`string`?e.login:``}}let r=Y._({id:`sNeKjP`});try{let e=de.safeParse(await n.json());e.success&&(r=e.data.detail||e.data.title)}catch{}return{ok:!1,error:r}}catch{return{ok:!1,error:Y._({id:`Q5fqMz`})}}}}}function $t(e){return{start(){return e.localOp.auth.start()}}}async function en(e){try{await navigator.clipboard.writeText(e)}catch{}}function tn(e){let t=(0,Z.c)(25),{onSuccess:n,startFlow:r}=e,{_:i}=u(),[a,o]=(0,Q.useState)(null),[c,d]=(0,Q.useState)(`https://github.com/login/device`),[f,p]=(0,Q.useState)(!1),[m,h]=(0,Q.useState)(null),[g,_]=(0,Q.useState)(null),[v,y]=(0,Q.useState)(0),x=(0,Q.useRef)(null),S=(0,Q.useRef)(null),C;t[0]!==i||t[1]!==n||t[2]!==r?(C=async function(){h(null);try{let e=r();x.current=e.cancel;let t=e.events[Symbol.asyncIterator](),a=!1,s=await t.next();for(;!s.done;){let e=s.value;if(e.type===`verification`)o(e.user_code),d(e.verification_uri),_(Date.now()+e.expires_in*1e3),y(e.expires_in*1e3),en(e.user_code).then(()=>{p(!0),setTimeout(()=>p(!1),2e3)});else if(e.type===`complete`){a=!0,n({login:e.login,name:e.name,email:e.email,avatarUrl:e.avatarUrl});break}else if(e.type===`error`){a=!0,h(e.message);break}s=await t.next()}a||h(i({id:`DskIkK`}))}catch(e){let t=e;t instanceof Error&&t.name!==`AbortError`&&h(i({id:`Q5fqMz`}))}},t[0]=i,t[1]=n,t[2]=r,t[3]=C):C=t[3];let w=C,T;t[4]===w?T=t[5]:(T=()=>{let e=!1;return queueMicrotask(()=>{e||w()}),()=>{e=!0,x.current?.(),x.current=null,S.current&&clearInterval(S.current)}},t[4]=w,t[5]=T);let E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(E=[],t[6]=E):E=t[6],(0,Q.useEffect)(T,E);let D,O;t[7]!==i||t[8]!==g?(D=()=>{if(g!==null)return S.current=setInterval(()=>{let e=g-Date.now();e<=0?(y(0),S.current&&clearInterval(S.current),h(i({id:`ve8vEM`}))):y(e)},1e3),()=>{S.current&&clearInterval(S.current)}},O=[g,i],t[7]=i,t[8]=g,t[9]=D,t[10]=O):(D=t[9],O=t[10]),(0,Q.useEffect)(D,O);let k=Math.floor(v/6e4),A=Math.floor(v%6e4/1e3),j;t[11]===A?j=t[12]:(j=A.toString().padStart(2,`0`),t[11]=A,t[12]=j);let M=`${k}:${j}`,N;t[13]!==i||t[14]!==f||t[15]!==m||t[16]!==M||t[17]!==a||t[18]!==c?(N=a?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(l,{id:`eVPynQ`,values:{verificationUri:c},components:{0:(0,$.jsx)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,onClick:e=>it(e,c),onAuxClick:e=>it(e,c),className:`inline-flex items-center gap-0.5 text-foreground hover:text-primary hover:underline`}),1:(0,$.jsx)(`span`,{}),2:(0,$.jsx)(Ee,{className:`inline size-3.5`,"aria-hidden":!0})}})}),(0,$.jsxs)(b,{type:`button`,variant:`outline`,"aria-label":i({id:`nCzR-G`,values:{userCode:a}}),onClick:()=>void en(a).then(()=>{p(!0),setTimeout(()=>p(!1),2e3)}),className:`relative h-auto w-full justify-center rounded-md bg-muted px-12 py-3 hover:bg-muted/80`,children:[(0,$.jsx)(`code`,{className:`font-mono text-2xl font-bold tracking-widest`,children:a}),(0,$.jsx)(`span`,{className:`absolute right-3 text-muted-foreground`,"aria-hidden":`true`,children:f?(0,$.jsx)(De,{className:`size-4`}):(0,$.jsx)(s,{className:`size-4`})})]}),(0,$.jsx)(`span`,{role:`status`,"aria-live":`polite`,className:`sr-only`,children:f?(0,$.jsx)(l,{id:`80c4-P`}):null}),(0,$.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-muted-foreground`,children:[(0,$.jsxs)(`span`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`size-1.5 rounded-full bg-amber-500 animate-pulse`}),(0,$.jsx)(l,{id:`5y_9lO`})]}),(0,$.jsx)(`span`,{children:(0,$.jsx)(l,{id:`gYz2ep`,values:{timeLabel:M}})})]})]}):(0,$.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:m?null:(0,$.jsx)(l,{id:`aWlJai`})}),t[13]=i,t[14]=f,t[15]=m,t[16]=M,t[17]=a,t[18]=c,t[19]=N):N=t[19];let P;t[20]===m?P=t[21]:(P=m&&(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,children:m}),t[20]=m,t[21]=P);let F;return t[22]!==N||t[23]!==P?(F=(0,$.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[N,P]}),t[22]=N,t[23]=P,t[24]=F):F=t[24],F}function nn(e){let t=(0,Z.c)(30),{login:n,name:r,onNameChange:i,email:a,onEmailChange:o}=e,{_:s}=u(),c;t[0]===n?c=t[1]:(c=(0,$.jsx)(`p`,{className:`text-sm font-medium`,children:(0,$.jsx)(l,{id:`E_tNGD`,values:{login:n}})}),t[0]=n,t[1]=c);let d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(`p`,{className:`text-1sm text-muted-foreground`,children:(0,$.jsx)(l,{id:`gp3I7-`})}),t[2]=d):d=t[2];let f;t[3]===s?f=t[4]:(f=s({id:`6YtxFj`}),t[3]=s,t[4]=f);let p;t[5]!==s||t[6]!==n?(p=s({id:`J2Mv98`,values:{login:n}}),t[5]=s,t[6]=n,t[7]=p):p=t[7];let m;t[8]===i?m=t[9]:(m=e=>i(e.target.value),t[8]=i,t[9]=m);let h;t[10]!==r||t[11]!==f||t[12]!==p||t[13]!==m?(h=(0,$.jsx)($e,{"aria-label":f,placeholder:p,value:r,onChange:m}),t[10]=r,t[11]=f,t[12]=p,t[13]=m,t[14]=h):h=t[14];let g;t[15]===s?g=t[16]:(g=s({id:`O3oNi5`}),t[15]=s,t[16]=g);let _;t[17]===s?_=t[18]:(_=s({id:`O3oNi5`}),t[17]=s,t[18]=_);let v;t[19]===o?v=t[20]:(v=e=>o(e.target.value),t[19]=o,t[20]=v);let y;t[21]!==a||t[22]!==g||t[23]!==_||t[24]!==v?(y=(0,$.jsx)($e,{type:`email`,"aria-label":g,placeholder:_,value:a,onChange:v}),t[21]=a,t[22]=g,t[23]=_,t[24]=v,t[25]=y):y=t[25];let b;return t[26]!==c||t[27]!==y||t[28]!==h?(b=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[c,d,h,y]}),t[26]=c,t[27]=y,t[28]=h,t[29]=b):b=t[29],b}function rn(e){let t=(0,Z.c)(37),{host:n,token:r,onTokenChange:i,error:a,onSubmit:o,showGhOption:s,onGhSignIn:c}=e,{_:d}=u(),f=`https://${n}/settings/tokens/new?scopes=repo,read:user&description=OpenKnowledge`,p;t[0]!==n||t[1]!==c||t[2]!==s?(p=s?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(b,{type:`button`,onClick:c,children:(0,$.jsx)(l,{id:`_SDGzH`})}),(0,$.jsxs)(`div`,{className:`flex items-center gap-3 text-xs text-muted-foreground`,children:[(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`}),(0,$.jsx)(l,{id:`8L0EPw`}),(0,$.jsx)(`span`,{className:`h-px flex-1 bg-border`})]})]}):(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:(0,$.jsx)(l,{id:`8k6INX`,values:{host:n},components:{0:(0,$.jsx)(`span`,{className:`font-medium text-foreground`})}})}),t[0]=n,t[1]=c,t[2]=s,t[3]=p):p=t[3];let m,h;t[4]===f?(m=t[5],h=t[6]):(m=e=>it(e,f),h=e=>it(e,f),t[4]=f,t[5]=m,t[6]=h);let g;t[7]===n?g=t[8]:(g=(0,$.jsx)(l,{id:`6hYjww`,values:{host:n}}),t[7]=n,t[8]=g);let _;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=(0,$.jsx)(Ee,{className:`inline size-3.5`,"aria-hidden":!0}),t[9]=_):_=t[9];let v;t[10]!==f||t[11]!==m||t[12]!==h||t[13]!==g?(v=(0,$.jsxs)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,onClick:m,onAuxClick:h,className:`inline-flex w-fit items-center gap-0.5 text-sm text-foreground hover:text-primary hover:underline`,children:[g,_]}),t[10]=f,t[11]=m,t[12]=h,t[13]=g,t[14]=v):v=t[14];let y;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,$.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:(0,$.jsx)(l,{id:`Xg-Ntj`})}),t[15]=y):y=t[15];let x;t[16]===d?x=t[17]:(x=d({id:`p2LEhJ`}),t[16]=d,t[17]=x);let S;t[18]===i?S=t[19]:(S=e=>i(e.target.value),t[18]=i,t[19]=S);let C;t[20]===o?C=t[21]:(C=e=>{e.key===`Enter`&&o()},t[20]=o,t[21]=C);let w;t[22]!==C||t[23]!==x||t[24]!==S||t[25]!==r?(w=(0,$.jsx)($e,{type:`password`,"aria-label":x,placeholder:`ghp_`,value:r,onChange:S,onKeyDown:C}),t[22]=C,t[23]=x,t[24]=S,t[25]=r,t[26]=w):w=t[26];let T;t[27]===a?T=t[28]:(T=a&&(0,$.jsx)(`p`,{className:`text-1sm text-destructive`,children:a}),t[27]=a,t[28]=T);let E;t[29]===s?E=t[30]:(E=!s&&(0,$.jsxs)(`div`,{className:`mt-1 rounded-md border border-border/60 bg-muted/40 p-3 text-sm text-muted-foreground`,children:[(0,$.jsx)(`p`,{children:(0,$.jsx)(l,{id:`qX-ABr`})}),(0,$.jsxs)(`ol`,{className:`mt-1.5 list-decimal space-y-0.5 pl-5`,children:[(0,$.jsx)(`li`,{children:(0,$.jsx)(l,{id:`jxtXZI`})}),(0,$.jsx)(`li`,{children:(0,$.jsx)(l,{id:`9Vh9Jf`})})]})]}),t[29]=s,t[30]=E);let D;return t[31]!==p||t[32]!==w||t[33]!==T||t[34]!==E||t[35]!==v?(D=(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[p,v,y,w,T,E]}),t[31]=p,t[32]=w,t[33]=T,t[34]=E,t[35]=v,t[36]=D):D=t[36],D}var an=1e4;function on(e){let t=(0,Z.c)(92),{open:n,onOpenChange:r,onSuccess:i,identityPrompt:a,reauth:o,transport:s,queryTransport:c,host:d,ghAvailable:f}=e,{_:p}=u(),m;t[0]===s?m=t[1]:(m=s??Qt(),t[0]=s,t[1]=m);let h=m,g;t[2]===c?g=t[3]:(g=c??Ht(),t[2]=c,t[3]=g);let _=g,[v,y]=(0,Q.useState)(`auth`),[x,S]=(0,Q.useState)(null),[C,w]=(0,Q.useState)(``),[T,E]=(0,Q.useState)(``),[D,O]=(0,Q.useState)(``),[F,I]=(0,Q.useState)(null),[L,R]=(0,Q.useState)(!1),[z,B]=(0,Q.useState)(void 0),[ee,te]=(0,Q.useState)(void 0),V=d??z,ne=!!V&&V!==`github.com`&&!!(f??ee)&&typeof h.ghLogin==`function`,H=!a&&d===void 0,U,W;t[4]!==d||t[5]!==a||t[6]!==H||t[7]!==n?(U=()=>{n&&(S(null),w(``),E(``),O(``),I(null),R(!1),B(void 0),te(void 0),y(a||H?`checking`:d&&d!==`github.com`?`pat`:`auth`))},W=[n,a,d,H],t[4]=d,t[5]=a,t[6]=H,t[7]=n,t[8]=U,t[9]=W):(U=t[8],W=t[9]),(0,Q.useLayoutEffect)(U,W);let re;t[10]!==a||t[11]!==n||t[12]!==_?(re=()=>{if(!n||!a)return;let e=!1,t=t=>{e||(e=!0,y(t))},r=setTimeout(()=>t(`auth`),an);return _.status().then(n=>{e||(n.authenticated?(S({login:n.login,name:n.name,email:n.email}),w(n.name??``),E(n.email??``),t(`identity`)):t(`auth`))}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[10]=a,t[11]=n,t[12]=_,t[13]=re):re=t[13];let G;t[14]!==a||t[15]!==n?(G=[n,a],t[14]=a,t[15]=n,t[16]=G):G=t[16],(0,Q.useEffect)(re,G);let K;t[17]!==H||t[18]!==n||t[19]!==_?(K=()=>{if(!n||!H)return;let e=!1,t=t=>{e||(e=!0,y(t))},r=setTimeout(()=>t(`auth`),an);return _.status().then(n=>{if(e)return;let r=!!n.host&&n.host!==`github.com`;B(n.host),te(n.ghAvailable),t(r?`pat`:`auth`)}).catch(()=>{t(`auth`)}),()=>{e=!0,clearTimeout(r)}},t[17]=H,t[18]=n,t[19]=_,t[20]=K):K=t[20];let ie;t[21]!==H||t[22]!==n?(ie=[n,H],t[21]=H,t[22]=n,t[23]=ie):ie=t[23],(0,Q.useEffect)(K,ie);let ae;t[24]!==p||t[25]!==a||t[26]!==r||t[27]!==i?(ae=function(e){if(S(e),a)w(e.name??``),E(e.email??``),y(`identity`);else{y(`done`),i?.(e),r(!1);let t=e.login;J.success(p(t?{id:`E_tNGD`,values:{login:t}}:{id:`cgl-gn`}))}},t[24]=p,t[25]=a,t[26]=r,t[27]=i,t[28]=ae):ae=t[28];let oe=ae,se;t[29]!==p||t[30]!==V||t[31]!==oe||t[32]!==L||t[33]!==D||t[34]!==h?(se=async function(){let e=D.trim();if(!e||!V||L)return;if(!h.pat){I(p({id:`iMYFJM`}));return}R(!0),I(null);let t=await h.pat(V,e);R(!1),t.ok?oe({login:t.login??``}):I(t.error??p({id:`sNeKjP`}))},t[29]=p,t[30]=V,t[31]=oe,t[32]=L,t[33]=D,t[34]=h,t[35]=se):se=t[35];let ce=se,le;t[36]!==p||t[37]!==x||t[38]!==r||t[39]!==i?(le=function(e,t){fetch(`/api/local-op/auth/set-identity`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,email:t})}).catch(sn);let n={...x??{login:``},name:e,email:t};y(`done`),i?.(n),r(!1);let a=n.login;J.success(p(a?{id:`E_tNGD`,values:{login:a}}:{id:`cgl-gn`}))},t[36]=p,t[37]=x,t[38]=r,t[39]=i,t[40]=le):le=t[40];let ue=le,q;t[41]!==p||t[42]!==x||t[43]!==r||t[44]!==i?(q=function(){if(!x)return;y(`done`),i?.(x),r(!1);let e=x.login;J.success(p(e?{id:`E_tNGD`,values:{login:e}}:{id:`cgl-gn`}))},t[41]=p,t[42]=x,t[43]=r,t[44]=i,t[45]=q):q=t[45];let de=q,fe;t[46]===r?fe=t[47]:(fe=function(){r(!1)},t[46]=r,t[47]=fe);let Y=fe,pe;t[48]!==a||t[49]!==o||t[50]!==v?(pe=(0,$.jsx)(N,{children:(0,$.jsx)(k,{children:o&&(v===`pat`||v===`gh-device`)?(0,$.jsx)(l,{id:`DUWgfT`}):o?(0,$.jsx)(l,{id:`X8kjQX`}):v===`pat`||v===`gh-device`?(0,$.jsx)(l,{id:`tzZ6ha`}):a&&v!==`auth`?(0,$.jsx)(l,{id:`29XZXN`}):(0,$.jsx)(l,{id:`3jod3l`})})}),t[48]=a,t[49]=o,t[50]=v,t[51]=pe):pe=t[51];let me;t[52]===v?me=t[53]:(me=v===`checking`&&(0,$.jsx)(j,{children:(0,$.jsx)(`div`,{className:`flex items-center justify-center py-6 text-sm text-muted-foreground`,children:(0,$.jsx)(l,{id:`gBbxn_`})})}),t[52]=v,t[53]=me);let he;t[54]!==oe||t[55]!==Y||t[56]!==h||t[57]!==v?(he=v===`auth`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(j,{children:(0,$.jsx)(tn,{onSuccess:oe,startFlow:()=>h.start()})}),(0,$.jsx)(M,{children:(0,$.jsx)(b,{variant:`outline`,className:`font-mono uppercase`,onClick:Y,children:(0,$.jsx)(l,{id:`dEgA5A`})})})]}),t[54]=oe,t[55]=Y,t[56]=h,t[57]=v,t[58]=he):he=t[58];let ge;t[59]!==ne||t[60]!==V||t[61]!==Y||t[62]!==ce||t[63]!==F||t[64]!==L||t[65]!==D||t[66]!==v?(ge=v===`pat`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(j,{children:(0,$.jsx)(rn,{host:V??``,token:D,onTokenChange:O,error:F,onSubmit:ce,showGhOption:ne,onGhSignIn:()=>y(`gh-device`)})}),(0,$.jsxs)(M,{children:[(0,$.jsx)(b,{variant:`outline`,className:`font-mono uppercase`,onClick:Y,children:(0,$.jsx)(l,{id:`dEgA5A`})}),(0,$.jsx)(b,{onClick:ce,disabled:!D.trim()||L,children:L?(0,$.jsx)(l,{id:`9zb2WA`}):(0,$.jsx)(l,{id:`iSLIjg`})})]})]}),t[59]=ne,t[60]=V,t[61]=Y,t[62]=ce,t[63]=F,t[64]=L,t[65]=D,t[66]=v,t[67]=ge):ge=t[67];let _e;t[68]!==V||t[69]!==oe||t[70]!==Y||t[71]!==h||t[72]!==v?(_e=v===`gh-device`&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(j,{children:(0,$.jsx)(tn,{onSuccess:oe,startFlow:()=>h.ghLogin?.(V??``)??h.start()})}),(0,$.jsxs)(M,{children:[(0,$.jsx)(b,{variant:`ghost`,onClick:()=>y(`pat`),children:(0,$.jsx)(l,{id:`hLKfZe`})}),(0,$.jsx)(b,{variant:`outline`,className:`font-mono uppercase`,onClick:Y,children:(0,$.jsx)(l,{id:`dEgA5A`})})]})]}),t[68]=V,t[69]=oe,t[70]=Y,t[71]=h,t[72]=v,t[73]=_e):_e=t[73];let ve;t[74]!==x||t[75]!==ue||t[76]!==de||t[77]!==T||t[78]!==C||t[79]!==v?(ve=v===`identity`&&x&&(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(j,{children:(0,$.jsx)(nn,{login:x.login,name:C,onNameChange:w,email:T,onEmailChange:E})}),(0,$.jsxs)(M,{children:[(0,$.jsx)(b,{variant:`ghost`,onClick:de,children:(0,$.jsx)(l,{id:`6Uau97`})}),(0,$.jsx)(b,{onClick:()=>ue(C.trim(),T.trim()),disabled:!C.trim()||!T.trim(),children:(0,$.jsx)(l,{id:`tfDRzk`})})]})]}),t[74]=x,t[75]=ue,t[76]=de,t[77]=T,t[78]=C,t[79]=v,t[80]=ve):ve=t[80];let X;t[81]!==pe||t[82]!==me||t[83]!==he||t[84]!==ge||t[85]!==_e||t[86]!==ve?(X=(0,$.jsxs)(A,{className:`sm:max-w-md`,children:[pe,me,he,ge,_e,ve]}),t[81]=pe,t[82]=me,t[83]=he,t[84]=ge,t[85]=_e,t[86]=ve,t[87]=X):X=t[87];let ye;return t[88]!==r||t[89]!==n||t[90]!==X?(ye=(0,$.jsx)(P,{open:n,onOpenChange:r,children:X}),t[88]=r,t[89]=n,t[90]=X,t[91]=ye):ye=t[91],ye}function sn(){}function cn(e){let t=(0,Z.c)(16),{value:n,onChange:r,disabled:i,placeholder:a,rows:o}=e,s=i===void 0?!1:i,c=o===void 0?12:o,u=(0,Q.useId)(),d;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,$.jsx)(l,{id:`3o3tur`}),t[0]=d):d=t[0];let f;t[1]===u?f=t[2]:(f=(0,$.jsx)(lt,{htmlFor:u,children:d}),t[1]=u,t[2]=f);let p;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,$.jsx)(ut,{children:(0,$.jsx)(l,{id:`5gr_ev`,values:{dateToken:`{{date}}`,userToken:`{{user}}`},components:{0:(0,$.jsx)(`code`,{className:`font-mono`}),1:(0,$.jsx)(`code`,{className:`font-mono`})}})}),t[3]=p):p=t[3];let m;t[4]===r?m=t[5]:(m=e=>r(e.target.value),t[4]=r,t[5]=m);let h;t[6]!==s||t[7]!==u||t[8]!==a||t[9]!==c||t[10]!==m||t[11]!==n?(h=(0,$.jsx)(mt,{id:u,value:n,onChange:m,disabled:s,rows:c,spellCheck:!1,placeholder:a,className:`font-mono text-xs leading-relaxed min-h-72`}),t[6]=s,t[7]=u,t[8]=a,t[9]=c,t[10]=m,t[11]=n,t[12]=h):h=t[12];let g;return t[13]!==f||t[14]!==h?(g=(0,$.jsxs)(ft,{children:[f,p,h]}),t[13]=f,t[14]=h,t[15]=g):g=t[15],g}var ln=/^[A-Za-z0-9_-]+$/;function un(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function dn(e){let t={},n=e.title.trim();n&&(t.title=n);let r=e.description.trim();return r&&(t.description=r),t}var fn=0;function pn(){return fn+=1,`prop-${fn}`}function mn(e){let{frontmatter:t,body:n}=ue(e);if(t===``)return{type:``,properties:[],markdown:e};let r=[];for(let e of se(t).split(`
|
|
4
4
|
`)){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:pn(),key:e.key,value:e.value})}return{type:i,properties:a,markdown:n}}function hn(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(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ci as e,jn as t,qi as n}from"./dist-
|
|
1
|
+
import{ci as e,jn as t,qi as n}from"./dist-As2x8uCt.js";import{c as r,t as i}from"./trace-api-BP9dN1Hz.js";import{t as a}from"./propagation-api-DC5404fy.js";import{t as o}from"./createLucideIcon-BulbvLvN.js";var s=o(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),c=`support@inkeep.com`;function l(e){return`mailto:${c}?subject=${encodeURIComponent(e)}`}function u(e){return e.split(/[\\/]/).pop()??e}function d(e){return e>=1024*1024?`${(e/(1024*1024)).toFixed(1)} MB`:e>=1024?`${Math.max(1,Math.round(e/1024))} KB`:`${e} B`}var f=200,p=/^(?:#{1,6}|>)(?:[ \t]+|$)/;function m(r){if(typeof r==`string`)for(let i of r.split(/\r\n|\r|\n/)){let r=e(i);for(r=n(r).replace(/\s+/g,` `).trim();p.test(r);)r=r.replace(p,``).trim();if(r!==``)return t(r,f).trimEnd()}}var h=`open-knowledge-app`,g=`ok.bug-report.send.attempt`,_={traceparent:()=>void 0,end:()=>{}},v=_;function y(e={}){try{let t=i.getTracer(h).startSpan(g,{attributes:e});return t.isRecording()?b(t,i.setSpan(r,t)):(t.end(),v)}catch(e){return console.warn(`[bug-report-send-otel] span start failed:`,e instanceof Error?e:String(e)),v}}function b(e,t){let n=!1;return{traceparent(){try{let e={};return a.inject(t,e),e.traceparent}catch{return}},end(t,r){if(!n){n=!0;try{r&&e.setAttributes(r),e.setAttribute(`ok.bug_report.renderer_outcome`,t),e.end()}catch{}}}}}var x=200,S=3,C=.9;function w(e){if(e.kind===`history-row`){let{row:t}=e;return{zipPath:t.zipPath,zipSizeBytes:t.zipBytes,metadata:{level:t.bundleLevel===`unknown`?`standard`:t.bundleLevel,systemWide:t.systemWide,projectSlug:t.projectSlug,...t.note===void 0?{}:{note:t.note}}}}let{report:t,note:n,includeScreenshot:r}=e;return{zipPath:t.zipPath,zipSizeBytes:t.zipSizeBytes,metadata:{level:t.summary.level,systemWide:t.summary.systemWide,projectSlug:t.summary.projectSlug,note:n},includeScreenshot:r}}function T(e){let t=new Map,n=new Set,r=null;function i(){for(let e of n)try{e()}catch(e){console.warn(`[bug-report-send] subscriber threw:`,e)}}function a(e,t){e.state=t,r=null,i()}function o(e){return{operationId:e.operationId,zipPath:e.zipPath,zipSizeBytes:e.zipSizeBytes,requestSeq:e.requestSeq}}function s(e){e.fillTimer!==null&&(clearInterval(e.fillTimer),e.fillTimer=null)}function c(e){s(e);let t=Date.now();e.fillTimer=setInterval(()=>{if(e.state.status!==`sending`){s(e);return}let n=(Date.now()-t)/1e3,r=Math.min(C,1-Math.exp(-n/S)),i=Math.round(r*100);i!==e.state.fillPercent&&a(e,{...o(e),status:`sending`,fillPercent:i})},x)}function l(e,t){s(e),e.span.end(t.status===`email-draft`?`email-drafted`:t.status===`already-sending`?`joined`:t.status,{"ok.bug_report.request_seq":e.requestSeq}),a(e,{...o(e),...t})}function d(e,t){if(t.ok){l(e,{status:`sent`,reference:t.reference});return}if(t.reason===`email-draft`){l(e,{status:`email-draft`,mailtoUrl:t.fallback.mailtoUrl});return}if(t.reason===`send-in-flight`){l(e,{status:`already-sending`});return}l(e,{status:`failed`,mailtoUrl:t.fallback.mailtoUrl})}function f(e){e.span=y({"ok.bug_report.zip_bytes":e.input.zipSizeBytes,"ok.bug_report.include_screenshot":e.input.includeScreenshot===!0,"ok.bug_report.attempt":e.requestSeq}),a(e,{...o(e),status:`sending`,fillPercent:0}),c(e),m(e,e.input)}function p(e){return e.requestSeq+=1,e.state.status===`sending`?(a(e,{...o(e),status:`sending`,fillPercent:e.state.fillPercent}),e.state):(f(e),e.state)}async function m(t,n){try{let r=e();if(r===void 0){console.warn(`[bug-report-send] no desktop bridge; send cannot be dispatched`),l(t,{status:`failed`});return}let i=t.span.traceparent();d(t,await r.send({zipPath:n.zipPath,metadata:n.metadata,...n.includeScreenshot===void 0?{}:{includeScreenshot:n.includeScreenshot},...i===void 0?{}:{traceparent:i}}))}catch(e){console.warn(`[bug-report-send] IPC dispatch threw:`,e),l(t,{status:`failed`})}}return{startBugReportSend(e){let n=w(e),r=u(n.zipPath),i=t.get(r);if(i!==void 0)return i.input=n,p(i);let a={operationId:r,zipPath:n.zipPath,zipSizeBytes:n.zipSizeBytes,requestSeq:1},o={...a,input:n,fillTimer:null,state:{...a,status:`sending`,fillPercent:0},span:_};return t.set(r,o),f(o),o.state},retryBugReportSend(e){let n=t.get(e);n!==void 0&&p(n)},get(e){return t.get(e)?.state},getSnapshot(){return r??=[...t.values()].map(e=>e.state),r},subscribe(e){return n.add(e),()=>{n.delete(e)}}}}var E=T(()=>window.okDesktop?.bugReport);export{u as a,l as i,m as n,s as o,d as r,E as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fn as e,Pn as t}from"./dist-
|
|
1
|
+
import{Fn as e,Pn as t}from"./dist-As2x8uCt.js";var n={BASE_URL:`./`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_APP_VERSION:`0.64.0`}?.VITE_APP_VERSION??`0.0.0-unknown`;function r(){return t({kind:`web`,runtimeVersion:n})}function i(){return e({kind:`web`,runtimeVersion:n})}export{r as n,i as r,n as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{t as e}from"./jsx-runtime-BUgB2tll.js";import{Jn as t,Kn as n,Mn as r,Mr as i,Nr as a,ai as o,li as s,ni as c,zr as l}from"./DocumentContext-Ak51fAXi.js";import{n as u,r as d}from"./dist-Nvb76hAm.js";import{t as f}from"./compiler-runtime-BfE3aGVn.js";import{i as p}from"./local-menu-action-bus-BLEUyEvu.js";import{t as m}from"./utils-CPqDy6Hr.js";import{t as h}from"./button-Cym3gapE.js";import{i as g,n as _,t as v}from"./tooltip-DttaCTqz.js";import{xt as y}from"./CodeMirrorPropInput-Dp0ghtC3.js";import{Fi as b,Rn as x,er as S,tr as C,vr as w,zn as T}from"./dist-D1GzYuCD.js";import{n as E}from"./dist-CJhtNlOm2.js";import{t as D}from"./dist-Cr4-nBVI.js";import{t as O}from"./createLucideIcon-BulbvLvN.js";import{t as ee}from"./x-DbShSCr5.js";import{f as te}from"./doc-paths-ByyIE836.js";var k=O(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),A=f(),j=`var(--ok-comment-hue,37,99,235)`,ne=j,re={fill:.22,line:.7},ie={fill:.45,line:1},ae=.45;function oe(e,t){let n=ne,{fill:r,line:i}=t?ie:re;return[`border-radius:2px`,`padding-bottom:1px`,...e.id===null?[]:[`cursor:pointer`],`background-color:rgba(${n},${r})`,`box-shadow:inset 0 -2px 0 rgba(${n},${i})`,``].join(`;`)}function M(e){return e.map(e=>e.id??`·`).join(`|`)}function se(e){let t=null;for(let n of e)n.id!==null&&(t===null||n.to-n.from<t.to-t.from)&&(t=n);return t?.id??null}function N(e,t){return e.id===null||e.id===t}function ce(e,t=null){let n=[...e].filter(e=>e.from<e.to).sort((e,t)=>e.from-t.from||e.to-t.to||(e.id??``).localeCompare(t.id??``));if(n.length===0)return[];let r=[...new Set(n.flatMap(e=>[e.from,e.to]))].sort((e,t)=>e-t),i=[],a=null,o=()=>{if(a===null)return;let e=a.covering.find(e=>N(e,t));i.push({from:a.from,to:a.to,style:oe(e??a.covering[0],e!==void 0),threadId:se(a.covering)}),a=null};for(let e=0;e<r.length-1;e++){let t=r[e],i=r[e+1],s=n.filter(e=>e.from<=t&&e.to>=i);if(s.length===0){o();continue}if(a!==null&&a.to===t&&M(a.covering)===M(s)){a.to=i;continue}o(),a={from:t,to:i,covering:s}}return o(),i}var P=`data-comment-reveal`;function F(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e}function I(e){return e===``?null:document.querySelector(`[data-testid="property-row"][data-key="${F(e)}"]`)}function le(e){let t=I(e);if(t===null)return null;let n=t.getBoundingClientRect();return n.height===0&&n.width===0?null:n}function ue(e){I(e)?.scrollIntoView({block:`center`,behavior:`smooth`})}function L(e){if(e.quote===``)return!1;let t=e.path.length===0?e.key:e.path[e.path.length-1],n=Array.from(document.querySelectorAll(`[data-testid="property-row"][data-key="${F(String(t))}"]`)),r=Array.from(document.querySelectorAll(`[data-testid="property-row"]`));for(let t of[...n,...r]){let n=t.querySelector(`textarea, input`);if(n===null)continue;let r=R(n.value,e.quote,e.start,e.end);if(r!==null)return t.scrollIntoView({block:`center`,behavior:`smooth`}),n.focus(),n.setSelectionRange(r.start,r.end),de(n),!0}return!1}function R(e,t,n,r){if(n!==void 0&&r!==void 0&&e.slice(n,r)===t)return{start:n,end:r};let i=e.indexOf(t);return i<0?null:{start:i,end:i+t.length}}function de(e){e.style.setProperty(`--comment-reveal-fill`,`rgba(${j},${ae})`),e.setAttribute(P,`true`);let t=()=>{e.removeAttribute(P),e.style.removeProperty(`--comment-reveal-fill`)};e.addEventListener(`blur`,t,{once:!0}),e.addEventListener(`pointerdown`,t,{once:!0}),e.addEventListener(`keydown`,t,{once:!0})}function z(e,{includeBlockComponents:t=!1}={}){let n=``,r=[];return e.descendants((e,i)=>{if(e.isText&&e.text){for(let t=0;t<e.text.length;t++)n+=e.text[t],r.push(i+t);return!0}if(e.isBlock&&!t)return!0;let a=x(e);if(a.length>0){let t=i+e.nodeSize-1;for(let e=0;e<a.length;e++)n+=a[e],r.push(e===a.length-1?t:i)}return!0}),{text:n,positions:r}}function fe(e,t){let n=[];if(t===``)return n;let r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1);return n}function B(e,t,n){let r=n?.prefix??``,i=n?.suffix??``;if(r===``&&i===``)return null;let a=r===``?[0]:w(e,r,{syntaxIn:`needle`}).map(e=>e.end),o=i===``?[e.length]:w(e,i,{syntaxIn:`needle`}).map(e=>e.start);if(a.length!==1||o.length!==1)return null;let s=a[0],c=o[0];for(;s<c&&/\s/.test(e[s]??``);)s+=1;for(;c>s&&/\s/.test(e[c-1]??``);)--c;if(c<=s)return null;let l=b(t.length);return c-s>l?null:{start:s,end:c}}function V(e,t){let n=e.positions[t.start],r=e.positions[t.end-1];return n==null||r==null?null:{from:n,to:r+1}}function H(e,t,n){if(t.length===0)return null;let r=fe(e.text,t).map(e=>({start:e,end:e+t.length}));if(r.length===0&&(r=w(e.text,t,{syntaxIn:`needle`})),r.length===0){let r=B(e.text,t,n);return r===null?null:V(e,r)}let i=n?.prefix??``,a=n?.suffix??``,o=t=>e.text.includes(t)||w(e.text,t,{syntaxIn:`needle`}).length>0;if(i!==``&&a!==``&&!o(i+t+a)&&o(i+a))return null;let s=S({prefix:i,suffix:a},{syntaxInContext:!0}),c=t=>s===0||C(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`,syntaxInContext:!0})>=s;if(r.length===1){if(!c(r[0])){let r=B(e.text,t,n);return r===null?null:V(e,r)}return V(e,r[0])}let l=[],u=-1;for(let t of r){let n=C(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`,syntaxInContext:!0});n>u?(u=n,l=[t]):n===u&&l.push(t)}if(!c(l[0])){let r=B(e.text,t,n);return r===null?null:V(e,r)}return V(e,l[0])}var U=64;function pe(e,t,n){return{prefix:T(e,Math.max(0,t-U),t),suffix:T(e,n,Math.min(e.content.size,n+U))}}function W(e,t,n){return G(e)(t,n)}function G(e){let t=z(e),n=null;return(r,i)=>{let a=H(t,r,i);return a===null?(n??=z(e,{includeBlockComponents:!0}),H(n,r,i)):a}}var me=220,he=24;function ge(e){let t=e.viewTop+e.insetTop,n=e.viewBottom-me;return e.anchorTop>=t&&e.anchorBottom<=n?0:e.anchorTop-(t+he)}function K(e){let t=e?.parentElement??null;for(;t;){let e=getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)return t;t=t.parentElement}return null}function q(e){let t=Number.parseFloat(getComputedStyle(e).scrollPaddingTop);return Number.isFinite(t)?t:0}function J(e,t,n,i){let a=y(e);if(!a)return!1;let o=K(a.dom);if(!o)return r(n,`comment-reveal`,()=>e.commands.scrollIntoView());let s,c;try{s=a.coordsAtPos(t.from),c=a.coordsAtPos(t.to)}catch{return!1}let l=o.getBoundingClientRect(),u=ge({anchorTop:s.top,anchorBottom:Math.max(s.bottom,c.bottom),viewTop:l.top,viewBottom:l.bottom,insetTop:q(o)});if(u===0)return!0;let d=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;return r(n,`comment-reveal`,()=>o.scrollTo({top:o.scrollTop+u,behavior:i?.instant||d?`auto`:`smooth`}))}var _e=1e4,Y=80,ve=1500,X=[`wheel`,`touchstart`,`mousedown`,`keydown`];function ye(e){let r=!1,o=null,c=null,l=-1,u=()=>{let t=n(e.docName);if(!t||t.isDestroyed)return!1;if(r||(r=!0,i(e.threadId)),e.quote===``)return o===null&&(o=Date.now(),a(e.threadId)),!0;let s=t.state.doc.content.size;return(c===null||s!==l)&&(c=W(t.state.doc,e.quote,e.context),l=s),!c||!J(t,c,e.docName,{instant:!0})?!1:(o===null&&(o=Date.now(),a(e.threadId)),!0)};s(`comments`),u(),n(e.docName)===null&&window.location.assign(te(e.docName));let d=!1,f=()=>{if(!d){d=!0,h(),window.clearInterval(g),window.clearTimeout(_);for(let e of X)window.removeEventListener(e,p,!0)}},p=()=>f(),m=()=>{u()&&o!==null&&Date.now()-o>=ve&&f()},h=t(m),g=window.setInterval(m,Y),_=window.setTimeout(()=>{o===null&&E.error(r?D._({id:`KeXgA-`}):D._({id:`JDQ5I5`})),f()},_e);for(let e of X)window.addEventListener(e,p,!0);m()}var Z=e();function be(){return c().length}function xe(){let e=(0,A.c)(4),t=c(),n;if(e[0]!==t){n=new Map;for(let e of t){let t=l(e)?.docName;t!==void 0&&n.set(t,(n.get(t)??0)+1)}e[0]=t,e[1]=n}else n=e[1];let r;return e[2]===n?r=e[3]:(r=[...n].map(Se),e[2]=n,e[3]=r),r}function Se(e){let[t,n]=e;return{docName:t,count:n}}function Ce(e){let t=(0,A.c)(34),{count:n,docs:r,attached:i,onAttach:a,onDismiss:o}=e,s;t[0]===r?s=t[1]:(s=r===void 0?[]:r,t[0]=r,t[1]=s);let c=s,{_:l}=d();if(n===0)return null;if(!i){let e;t[2]===l?e=t[3]:(e=l({id:`UpOct_`}),t[2]=l,t[3]=e);let n,r,i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=m(`h-auto min-h-0 gap-1 rounded-md border border-dashed bg-transparent px-1.5 py-0.5`,`text-xs font-normal text-muted-foreground hover:bg-muted/60 hover:text-foreground`),r=(0,Z.jsx)(p,{className:`size-3`}),i=(0,Z.jsx)(u,{id:`VbyRUy`}),t[4]=n,t[5]=r,t[6]=i):(n=t[4],r=t[5],i=t[6]);let o;return t[7]!==a||t[8]!==e?(o=(0,Z.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-pressed":!1,"aria-label":e,onClick:a,"data-testid":`composer-context-chip-comments`,className:n,children:[r,i]}),t[7]=a,t[8]=e,t[9]=o):o=t[9],o}let f;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(f=m(`inline-flex items-center gap-1 rounded-md border bg-muted/60 py-0.5 pr-0.5 pl-1.5`,`text-xs text-muted-foreground`),t[10]=f):f=t[10];let y;t[11]===l?y=t[12]:(y=l({id:`2zvUIK`}),t[11]=l,t[12]=y);let b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(k,{className:`size-3`}),t[13]=b):b=t[13];let x;t[14]!==n||t[15]!==c.length?(x=c.length>1?(0,Z.jsx)(u,{id:`5TmrYN`,values:{0:c.length,count:n}}):(0,Z.jsx)(u,{id:`eiUA4k`,values:{count:n}}),t[14]=n,t[15]=c.length,t[16]=x):x=t[16];let S;t[17]!==y||t[18]!==x?(S=(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":y,onClick:Te,"data-testid":`composer-comments-open-panel`,className:`h-auto min-h-0 gap-1 px-0.5 py-0 text-xs font-normal text-muted-foreground hover:text-foreground`,children:[b,x]})}),t[17]=y,t[18]=x,t[19]=S):S=t[19];let C;t[20]===c?C=t[21]:(C=(0,Z.jsx)(_,{className:`max-w-64`,children:c.length>1?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:c.map(we)}):(0,Z.jsx)(u,{id:`2zvUIK`})}),t[20]=c,t[21]=C);let w;t[22]!==S||t[23]!==C?(w=(0,Z.jsxs)(v,{children:[S,C]}),t[22]=S,t[23]=C,t[24]=w):w=t[24];let T;t[25]===l?T=t[26]:(T=l({id:`pFRz_E`}),t[25]=l,t[26]=T);let E;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(ee,{className:`size-3`}),t[27]=E):E=t[27];let D;t[28]!==o||t[29]!==T?(D=(0,Z.jsx)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":T,onClick:o,className:`size-4 p-0 text-muted-foreground hover:text-foreground`,children:E}),t[28]=o,t[29]=T,t[30]=D):D=t[30];let O;return t[31]!==D||t[32]!==w?(O=(0,Z.jsxs)(`span`,{"data-testid":`composer-context-chip-comments`,className:f,children:[w,D]}),t[31]=D,t[32]=w,t[33]=O):O=t[33],O}function we(e){return(0,Z.jsxs)(`li`,{className:`flex items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:e.count}),(0,Z.jsx)(`span`,{className:`truncate`,children:Q(e.docName)})]},e.docName)}function Te(){return o()}function Q(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function Ee(e,t){let n=e;for(let e of t)n+=typeof e==`number`?`[${e}]`:`.${e}`;return n}function De(e){ye({docName:e.docName,quote:e.target.kind===`property`?``:e.anchor?.quote??``,threadId:e.id,context:e.anchor??void 0});let{target:t,anchor:n}=e;if(t.kind!==`property`||n===null)return;let r=0,i=()=>{L({key:t.key,path:t.path,quote:n.quote,start:n.start,end:n.end})||(r+=1,!(r>=Oe)&&requestAnimationFrame(i))};requestAnimationFrame(i)}var Oe=30;function ke(e){return{docName:e.docName,body:e.instruction,propertyKey:e.property,quote:e.passage?.exact??``,anchorLost:e.anchorLost,prefix:e.passage?.prefix??``,suffix:e.passage?.suffix??``,repeats:e.passageRepeats}}var $=48;function Ae(e){let t=e.replace(/\s+/g,` `).trimStart();return t.length>$?`…${t.slice(-$)}`:t}function je(e){let t=e.replace(/\s+/g,` `).trimEnd();return t.length>$?`${t.slice(0,$)}…`:t}function Me(e){if(!e.repeats)return null;let t=Ae(e.prefix),n=je(e.suffix);return t===``&&n===``?null:`(This text appears more than once in the file. The one meant is ${t===``?`at the start of the file, followed by "${n}"`:n===``?`at the end of the file, preceded by "${t}"`:`between "${t}" and "${n}"`} — match that context rather than the first occurrence.)`}function Ne(e,t,n){let r=t.trim(),i=[];if(i.push(r.length>0?r:`Address the following review comments by editing the documents directly.`),i.push(``),i.push(e.length===1?`The comment:`:`The ${e.length} comments:`),e.forEach((e,t)=>{if(i.push(``),e.propertyKey){let n=e.quote.trim();if(n===``)i.push(`${t+1}. In \`${e.docName}\`, on the \`${e.propertyKey}\` property (frontmatter):`),i.push(``),i.push(` ${e.body.trim()}`);else{i.push(`${t+1}. In \`${e.docName}\`, on this text within the \`${e.propertyKey}\` property (frontmatter):`),i.push(``);for(let e of n.split(`
|
|
1
|
+
import{t as e}from"./jsx-runtime-BUgB2tll.js";import{Jn as t,Kn as n,Mn as r,Mr as i,Nr as a,ai as o,li as s,ni as c,zr as l}from"./DocumentContext-CZ1LyjXH.js";import{n as u,r as d}from"./dist-Nvb76hAm.js";import{t as f}from"./compiler-runtime-BfE3aGVn.js";import{i as p}from"./local-menu-action-bus-BLEUyEvu.js";import{t as m}from"./utils-CPqDy6Hr.js";import{t as h}from"./button-Cym3gapE.js";import{i as g,n as _,t as v}from"./tooltip-DttaCTqz.js";import{xt as y}from"./CodeMirrorPropInput-Be4UuxHJ.js";import{Fi as b,Rn as x,er as S,tr as C,vr as w,zn as T}from"./dist-As2x8uCt.js";import{n as E}from"./dist-CJhtNlOm2.js";import{t as D}from"./dist-Cr4-nBVI.js";import{t as O}from"./createLucideIcon-BulbvLvN.js";import{t as ee}from"./x-DbShSCr5.js";import{f as te}from"./doc-paths-BkNaaTOB.js";var k=O(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),A=f(),j=`var(--ok-comment-hue,37,99,235)`,ne=j,re={fill:.22,line:.7},ie={fill:.45,line:1},ae=.45;function oe(e,t){let n=ne,{fill:r,line:i}=t?ie:re;return[`border-radius:2px`,`padding-bottom:1px`,...e.id===null?[]:[`cursor:pointer`],`background-color:rgba(${n},${r})`,`box-shadow:inset 0 -2px 0 rgba(${n},${i})`,``].join(`;`)}function M(e){return e.map(e=>e.id??`·`).join(`|`)}function se(e){let t=null;for(let n of e)n.id!==null&&(t===null||n.to-n.from<t.to-t.from)&&(t=n);return t?.id??null}function N(e,t){return e.id===null||e.id===t}function ce(e,t=null){let n=[...e].filter(e=>e.from<e.to).sort((e,t)=>e.from-t.from||e.to-t.to||(e.id??``).localeCompare(t.id??``));if(n.length===0)return[];let r=[...new Set(n.flatMap(e=>[e.from,e.to]))].sort((e,t)=>e-t),i=[],a=null,o=()=>{if(a===null)return;let e=a.covering.find(e=>N(e,t));i.push({from:a.from,to:a.to,style:oe(e??a.covering[0],e!==void 0),threadId:se(a.covering)}),a=null};for(let e=0;e<r.length-1;e++){let t=r[e],i=r[e+1],s=n.filter(e=>e.from<=t&&e.to>=i);if(s.length===0){o();continue}if(a!==null&&a.to===t&&M(a.covering)===M(s)){a.to=i;continue}o(),a={from:t,to:i,covering:s}}return o(),i}var P=`data-comment-reveal`;function F(e){return typeof CSS<`u`&&CSS.escape?CSS.escape(e):e}function I(e){return e===``?null:document.querySelector(`[data-testid="property-row"][data-key="${F(e)}"]`)}function le(e){let t=I(e);if(t===null)return null;let n=t.getBoundingClientRect();return n.height===0&&n.width===0?null:n}function ue(e){I(e)?.scrollIntoView({block:`center`,behavior:`smooth`})}function L(e){if(e.quote===``)return!1;let t=e.path.length===0?e.key:e.path[e.path.length-1],n=Array.from(document.querySelectorAll(`[data-testid="property-row"][data-key="${F(String(t))}"]`)),r=Array.from(document.querySelectorAll(`[data-testid="property-row"]`));for(let t of[...n,...r]){let n=t.querySelector(`textarea, input`);if(n===null)continue;let r=R(n.value,e.quote,e.start,e.end);if(r!==null)return t.scrollIntoView({block:`center`,behavior:`smooth`}),n.focus(),n.setSelectionRange(r.start,r.end),de(n),!0}return!1}function R(e,t,n,r){if(n!==void 0&&r!==void 0&&e.slice(n,r)===t)return{start:n,end:r};let i=e.indexOf(t);return i<0?null:{start:i,end:i+t.length}}function de(e){e.style.setProperty(`--comment-reveal-fill`,`rgba(${j},${ae})`),e.setAttribute(P,`true`);let t=()=>{e.removeAttribute(P),e.style.removeProperty(`--comment-reveal-fill`)};e.addEventListener(`blur`,t,{once:!0}),e.addEventListener(`pointerdown`,t,{once:!0}),e.addEventListener(`keydown`,t,{once:!0})}function z(e,{includeBlockComponents:t=!1}={}){let n=``,r=[];return e.descendants((e,i)=>{if(e.isText&&e.text){for(let t=0;t<e.text.length;t++)n+=e.text[t],r.push(i+t);return!0}if(e.isBlock&&!t)return!0;let a=x(e);if(a.length>0){let t=i+e.nodeSize-1;for(let e=0;e<a.length;e++)n+=a[e],r.push(e===a.length-1?t:i)}return!0}),{text:n,positions:r}}function fe(e,t){let n=[];if(t===``)return n;let r=e.indexOf(t);for(;r!==-1;)n.push(r),r=e.indexOf(t,r+1);return n}function B(e,t,n){let r=n?.prefix??``,i=n?.suffix??``;if(r===``&&i===``)return null;let a=r===``?[0]:w(e,r,{syntaxIn:`needle`}).map(e=>e.end),o=i===``?[e.length]:w(e,i,{syntaxIn:`needle`}).map(e=>e.start);if(a.length!==1||o.length!==1)return null;let s=a[0],c=o[0];for(;s<c&&/\s/.test(e[s]??``);)s+=1;for(;c>s&&/\s/.test(e[c-1]??``);)--c;if(c<=s)return null;let l=b(t.length);return c-s>l?null:{start:s,end:c}}function V(e,t){let n=e.positions[t.start],r=e.positions[t.end-1];return n==null||r==null?null:{from:n,to:r+1}}function H(e,t,n){if(t.length===0)return null;let r=fe(e.text,t).map(e=>({start:e,end:e+t.length}));if(r.length===0&&(r=w(e.text,t,{syntaxIn:`needle`})),r.length===0){let r=B(e.text,t,n);return r===null?null:V(e,r)}let i=n?.prefix??``,a=n?.suffix??``,o=t=>e.text.includes(t)||w(e.text,t,{syntaxIn:`needle`}).length>0;if(i!==``&&a!==``&&!o(i+t+a)&&o(i+a))return null;let s=S({prefix:i,suffix:a},{syntaxInContext:!0}),c=t=>s===0||C(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`,syntaxInContext:!0})>=s;if(r.length===1){if(!c(r[0])){let r=B(e.text,t,n);return r===null?null:V(e,r)}return V(e,r[0])}let l=[],u=-1;for(let t of r){let n=C(e.text,t,{prefix:i,suffix:a},{syntaxIn:`none`,syntaxInContext:!0});n>u?(u=n,l=[t]):n===u&&l.push(t)}if(!c(l[0])){let r=B(e.text,t,n);return r===null?null:V(e,r)}return V(e,l[0])}var U=64;function pe(e,t,n){return{prefix:T(e,Math.max(0,t-U),t),suffix:T(e,n,Math.min(e.content.size,n+U))}}function W(e,t,n){return G(e)(t,n)}function G(e){let t=z(e),n=null;return(r,i)=>{let a=H(t,r,i);return a===null?(n??=z(e,{includeBlockComponents:!0}),H(n,r,i)):a}}var me=220,he=24;function ge(e){let t=e.viewTop+e.insetTop,n=e.viewBottom-me;return e.anchorTop>=t&&e.anchorBottom<=n?0:e.anchorTop-(t+he)}function K(e){let t=e?.parentElement??null;for(;t;){let e=getComputedStyle(t).overflowY;if(e===`auto`||e===`scroll`)return t;t=t.parentElement}return null}function q(e){let t=Number.parseFloat(getComputedStyle(e).scrollPaddingTop);return Number.isFinite(t)?t:0}function J(e,t,n,i){let a=y(e);if(!a)return!1;let o=K(a.dom);if(!o)return r(n,`comment-reveal`,()=>e.commands.scrollIntoView());let s,c;try{s=a.coordsAtPos(t.from),c=a.coordsAtPos(t.to)}catch{return!1}let l=o.getBoundingClientRect(),u=ge({anchorTop:s.top,anchorBottom:Math.max(s.bottom,c.bottom),viewTop:l.top,viewBottom:l.bottom,insetTop:q(o)});if(u===0)return!0;let d=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;return r(n,`comment-reveal`,()=>o.scrollTo({top:o.scrollTop+u,behavior:i?.instant||d?`auto`:`smooth`}))}var _e=1e4,Y=80,ve=1500,X=[`wheel`,`touchstart`,`mousedown`,`keydown`];function ye(e){let r=!1,o=null,c=null,l=-1,u=()=>{let t=n(e.docName);if(!t||t.isDestroyed)return!1;if(r||(r=!0,i(e.threadId)),e.quote===``)return o===null&&(o=Date.now(),a(e.threadId)),!0;let s=t.state.doc.content.size;return(c===null||s!==l)&&(c=W(t.state.doc,e.quote,e.context),l=s),!c||!J(t,c,e.docName,{instant:!0})?!1:(o===null&&(o=Date.now(),a(e.threadId)),!0)};s(`comments`),u(),n(e.docName)===null&&window.location.assign(te(e.docName));let d=!1,f=()=>{if(!d){d=!0,h(),window.clearInterval(g),window.clearTimeout(_);for(let e of X)window.removeEventListener(e,p,!0)}},p=()=>f(),m=()=>{u()&&o!==null&&Date.now()-o>=ve&&f()},h=t(m),g=window.setInterval(m,Y),_=window.setTimeout(()=>{o===null&&E.error(r?D._({id:`KeXgA-`}):D._({id:`JDQ5I5`})),f()},_e);for(let e of X)window.addEventListener(e,p,!0);m()}var Z=e();function be(){return c().length}function xe(){let e=(0,A.c)(4),t=c(),n;if(e[0]!==t){n=new Map;for(let e of t){let t=l(e)?.docName;t!==void 0&&n.set(t,(n.get(t)??0)+1)}e[0]=t,e[1]=n}else n=e[1];let r;return e[2]===n?r=e[3]:(r=[...n].map(Se),e[2]=n,e[3]=r),r}function Se(e){let[t,n]=e;return{docName:t,count:n}}function Ce(e){let t=(0,A.c)(34),{count:n,docs:r,attached:i,onAttach:a,onDismiss:o}=e,s;t[0]===r?s=t[1]:(s=r===void 0?[]:r,t[0]=r,t[1]=s);let c=s,{_:l}=d();if(n===0)return null;if(!i){let e;t[2]===l?e=t[3]:(e=l({id:`UpOct_`}),t[2]=l,t[3]=e);let n,r,i;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(n=m(`h-auto min-h-0 gap-1 rounded-md border border-dashed bg-transparent px-1.5 py-0.5`,`text-xs font-normal text-muted-foreground hover:bg-muted/60 hover:text-foreground`),r=(0,Z.jsx)(p,{className:`size-3`}),i=(0,Z.jsx)(u,{id:`VbyRUy`}),t[4]=n,t[5]=r,t[6]=i):(n=t[4],r=t[5],i=t[6]);let o;return t[7]!==a||t[8]!==e?(o=(0,Z.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-pressed":!1,"aria-label":e,onClick:a,"data-testid":`composer-context-chip-comments`,className:n,children:[r,i]}),t[7]=a,t[8]=e,t[9]=o):o=t[9],o}let f;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(f=m(`inline-flex items-center gap-1 rounded-md border bg-muted/60 py-0.5 pr-0.5 pl-1.5`,`text-xs text-muted-foreground`),t[10]=f):f=t[10];let y;t[11]===l?y=t[12]:(y=l({id:`2zvUIK`}),t[11]=l,t[12]=y);let b;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Z.jsx)(k,{className:`size-3`}),t[13]=b):b=t[13];let x;t[14]!==n||t[15]!==c.length?(x=c.length>1?(0,Z.jsx)(u,{id:`5TmrYN`,values:{0:c.length,count:n}}):(0,Z.jsx)(u,{id:`eiUA4k`,values:{count:n}}),t[14]=n,t[15]=c.length,t[16]=x):x=t[16];let S;t[17]!==y||t[18]!==x?(S=(0,Z.jsx)(g,{asChild:!0,children:(0,Z.jsxs)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":y,onClick:Te,"data-testid":`composer-comments-open-panel`,className:`h-auto min-h-0 gap-1 px-0.5 py-0 text-xs font-normal text-muted-foreground hover:text-foreground`,children:[b,x]})}),t[17]=y,t[18]=x,t[19]=S):S=t[19];let C;t[20]===c?C=t[21]:(C=(0,Z.jsx)(_,{className:`max-w-64`,children:c.length>1?(0,Z.jsx)(`ul`,{className:`flex flex-col gap-0.5`,children:c.map(we)}):(0,Z.jsx)(u,{id:`2zvUIK`})}),t[20]=c,t[21]=C);let w;t[22]!==S||t[23]!==C?(w=(0,Z.jsxs)(v,{children:[S,C]}),t[22]=S,t[23]=C,t[24]=w):w=t[24];let T;t[25]===l?T=t[26]:(T=l({id:`pFRz_E`}),t[25]=l,t[26]=T);let E;t[27]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,Z.jsx)(ee,{className:`size-3`}),t[27]=E):E=t[27];let D;t[28]!==o||t[29]!==T?(D=(0,Z.jsx)(h,{type:`button`,size:`sm`,variant:`ghost`,"aria-label":T,onClick:o,className:`size-4 p-0 text-muted-foreground hover:text-foreground`,children:E}),t[28]=o,t[29]=T,t[30]=D):D=t[30];let O;return t[31]!==D||t[32]!==w?(O=(0,Z.jsxs)(`span`,{"data-testid":`composer-context-chip-comments`,className:f,children:[w,D]}),t[31]=D,t[32]=w,t[33]=O):O=t[33],O}function we(e){return(0,Z.jsxs)(`li`,{className:`flex items-baseline gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`tabular-nums`,children:e.count}),(0,Z.jsx)(`span`,{className:`truncate`,children:Q(e.docName)})]},e.docName)}function Te(){return o()}function Q(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(t+1):e}function Ee(e,t){let n=e;for(let e of t)n+=typeof e==`number`?`[${e}]`:`.${e}`;return n}function De(e){ye({docName:e.docName,quote:e.target.kind===`property`?``:e.anchor?.quote??``,threadId:e.id,context:e.anchor??void 0});let{target:t,anchor:n}=e;if(t.kind!==`property`||n===null)return;let r=0,i=()=>{L({key:t.key,path:t.path,quote:n.quote,start:n.start,end:n.end})||(r+=1,!(r>=Oe)&&requestAnimationFrame(i))};requestAnimationFrame(i)}var Oe=30;function ke(e){return{docName:e.docName,body:e.instruction,propertyKey:e.property,quote:e.passage?.exact??``,anchorLost:e.anchorLost,prefix:e.passage?.prefix??``,suffix:e.passage?.suffix??``,repeats:e.passageRepeats}}var $=48;function Ae(e){let t=e.replace(/\s+/g,` `).trimStart();return t.length>$?`…${t.slice(-$)}`:t}function je(e){let t=e.replace(/\s+/g,` `).trimEnd();return t.length>$?`${t.slice(0,$)}…`:t}function Me(e){if(!e.repeats)return null;let t=Ae(e.prefix),n=je(e.suffix);return t===``&&n===``?null:`(This text appears more than once in the file. The one meant is ${t===``?`at the start of the file, followed by "${n}"`:n===``?`at the end of the file, preceded by "${t}"`:`between "${t}" and "${n}"`} — match that context rather than the first occurrence.)`}function Ne(e,t,n){let r=t.trim(),i=[];if(i.push(r.length>0?r:`Address the following review comments by editing the documents directly.`),i.push(``),i.push(e.length===1?`The comment:`:`The ${e.length} comments:`),e.forEach((e,t)=>{if(i.push(``),e.propertyKey){let n=e.quote.trim();if(n===``)i.push(`${t+1}. In \`${e.docName}\`, on the \`${e.propertyKey}\` property (frontmatter):`),i.push(``),i.push(` ${e.body.trim()}`);else{i.push(`${t+1}. In \`${e.docName}\`, on this text within the \`${e.propertyKey}\` property (frontmatter):`),i.push(``);for(let e of n.split(`
|
|
2
2
|
`))i.push(` > ${e}`);i.push(``),i.push(` ${e.body.trim()}`)}e.anchorLost&&(i.push(``),i.push(n===``?` (Note: \`${e.propertyKey}\` is no longer in this document's frontmatter — it was renamed or removed since the comment was written. Do not apply this to a different property; if you cannot tell what it now refers to, say so instead of guessing.)`:` (Note: that text is no longer in \`${e.propertyKey}\` — the value was edited, reshaped, or removed since the comment was written. Do not apply this to a different property or a different part of the value; if you cannot tell what it now refers to, say so instead of guessing.)`));return}i.push(`${t+1}. In \`${e.docName}\`, on this passage:`),i.push(``);for(let t of e.quote.split(`
|
|
3
3
|
`))i.push(` > ${t}`);i.push(``),i.push(` ${e.body.trim()}`);let n=Me(e);n!==null&&(i.push(``),i.push(` ${n}`)),e.anchorLost&&(i.push(``),i.push(` (Note: this passage is no longer in the document — it was edited or removed since the comment was written. Do not apply this to a different passage; if you cannot tell what it now refers to, say so instead of guessing.)`))}),n&&n.markdown.trim().length>0){i.push(``),i.push(`Also in scope, selected in \`${n.docName}\` (not a comment):`),i.push(``);for(let e of n.markdown.trim().split(`
|
|
4
4
|
`))i.push(`> ${e}`)}return i.join(`
|