getborg 0.0.98 → 0.0.109

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/{BunPtyAdapter-BO6MRm-I.mjs → BunPtyAdapter-B8CZTUkK.mjs} +3 -3
  2. package/dist/{Config-gKAe02uc.mjs → Config-DFbx48ty.mjs} +2 -2
  3. package/dist/{FetchHttpClient-Dkvk_2gy.mjs → FetchHttpClient-DEMRQKIB.mjs} +3 -3
  4. package/dist/{FileSystem-CME3BFzu.mjs → FileSystem-41Cezpd1.mjs} +2 -2
  5. package/dist/{Mime-CECsj7CV.mjs → Mime-D2854Tqo.mjs} +5 -5
  6. package/dist/{NodeHttpIncomingMessage-0aW45tSl.mjs → NodeHttpIncomingMessage-BqU9AHA2.mjs} +4 -4
  7. package/dist/{NodeHttpServer-CdXvBNNA.mjs → NodeHttpServer-C-eqvdR4.mjs} +9 -9
  8. package/dist/{NodePtyAdapter-BWrlUEea.mjs → NodePtyAdapter-BdtcaYPg.mjs} +5 -5
  9. package/dist/{NodeServices-BHXunFtp.mjs → NodeServices-pD4zkANr.mjs} +6 -6
  10. package/dist/{NodeSqliteClient-BwW7kwrY.mjs → NodeSqliteClient-BIVa5aFu.mjs} +5 -5
  11. package/dist/{NodeStream-CWX36BNZ.mjs → NodeStream-BjNgA5_1.mjs} +3 -3
  12. package/dist/{Path-BdYWOglD.mjs → Path-D8BPsRhh.mjs} +2 -2
  13. package/dist/{PtyAdapter-DCErzU8T.mjs → PtyAdapter-B9zQDp9u.mjs} +2 -2
  14. package/dist/{Schema-D5D4He-Q.mjs → Schema-DkAVclKk.mjs} +153 -6
  15. package/dist/{SqlClient-CZnbSIGl.mjs → SqlClient-JflyUX7a.mjs} +3 -3
  16. package/dist/bin.mjs +7449 -3662
  17. package/dist/{borgTelemetryNode-B9H2lcK5.mjs → borgTelemetryNode-B0vVayda.mjs} +6 -6
  18. package/dist/client/.vite/manifest.json +316 -316
  19. package/dist/client/assets/{ArrowRight-B0WzqdPj.js → ArrowRight-BOicMyF9.js} +2 -2
  20. package/dist/client/assets/{ArrowSquareOut-8j4OKqbL.js → ArrowSquareOut-D7Y2Tt3L.js} +2 -2
  21. package/dist/client/assets/{ArrowsClockwise-DlJf49Z-.js → ArrowsClockwise-DycxhEkt.js} +2 -2
  22. package/dist/client/assets/{CaretLeft-Du0MA4fs.js → CaretLeft-CDMA3Uas.js} +2 -2
  23. package/dist/client/assets/{ChatMarkdown-DVGPcDDG.js → ChatMarkdown-Cl8M9HCx.js} +70 -70
  24. package/dist/client/assets/DesignWorkspace-DBL7AxwS.js +3 -0
  25. package/dist/client/assets/DiffPanel-BJ-Ix_7K.js +2 -0
  26. package/dist/client/assets/{DiffWorkerPoolProvider-EEE1VuzL.js → DiffWorkerPoolProvider-_R9JGgmp.js} +2 -2
  27. package/dist/client/assets/{DocxPreview-BbjPKR5c.js → DocxPreview-BFCC5VXn.js} +4 -4
  28. package/dist/client/assets/{FilePreviewPanel-BnW97AGU.js → FilePreviewPanel-CeAwd87I.js} +5 -5
  29. package/dist/client/assets/{HtmlPreview-C2OXgUpJ.js → HtmlPreview-BpBdu9_j.js} +2 -2
  30. package/dist/client/assets/{PdfPreview-CthschRx.js → PdfPreview-CeECoD5z.js} +3 -3
  31. package/dist/client/assets/{PptxPreview-M1wqnWv-.js → PptxPreview-u6gN3x3Z.js} +3 -3
  32. package/dist/client/assets/PreviewPanel-BVJp3UI5.js +2 -0
  33. package/dist/client/assets/PullRequestCodeTab-Bxx0Vkdn.js +6 -0
  34. package/dist/client/assets/{PullRequestReactions-DefnDwQq.js → PullRequestReactions-BWjOU4KY.js} +4 -4
  35. package/dist/client/assets/{RightPanelResizeHandle-CWbwOS4Y.js → RightPanelResizeHandle-DZdzK7y3.js} +2 -2
  36. package/dist/client/assets/{VirtualizedFile-DpXIpMCw.js → VirtualizedFile-CyAKSbzc.js} +2 -2
  37. package/dist/client/assets/{XlsxPreview-yPrELQ0F.js → XlsxPreview-CaykIFrZ.js} +3 -3
  38. package/dist/client/assets/{assetUrls-Cv1BQRgh.js → assetUrls-BBFxUocf.js} +2 -2
  39. package/dist/client/assets/browserHistoryStore-K9gWOOUq.js +2 -0
  40. package/dist/client/assets/{browserRecording-DYgu2qFY.js → browserRecording-DrMz1iOt.js} +2 -2
  41. package/dist/client/assets/{clientPersistenceStorage-TiUunQpN.js → clientPersistenceStorage-DSC61yLx.js} +2 -2
  42. package/dist/client/assets/{combobox-Cf7GvOtx.js → combobox-C4C8XR-w.js} +6 -6
  43. package/dist/client/assets/{composerMentionDrag-TlGe0rUC.js → composerMentionDrag-D06cCeGC.js} +2 -2
  44. package/dist/client/assets/designCanvas.logic-DuuhotDy.js +8 -0
  45. package/dist/client/assets/{designOpenFileContext-CUn4dNFv.js → designOpenFileContext-CCQs4ovB.js} +2 -2
  46. package/dist/client/assets/{diffFileContents-D8w_yRtq.js → diffFileContents-Bj3q_jc2.js} +3 -3
  47. package/dist/client/assets/{empty-a7hA2Ech.js → empty-DynqTxIR.js} +2 -2
  48. package/dist/client/assets/{entities-x8g8jint.js → entities-dwE_i4XM.js} +2 -2
  49. package/dist/client/assets/{index-B3D6JK2-.js → index-BKWzfr1Y.js} +3 -3
  50. package/dist/client/assets/{input-C5hbrs5d.js → input-Q4KA45-f.js} +2 -2
  51. package/dist/client/assets/{lib-xfuwsGna.js → lib-DyhHMOev.js} +2 -2
  52. package/dist/client/assets/main-CI0aXqkB.css +2 -0
  53. package/dist/client/assets/main-DFDCV-Ns.js +145 -0
  54. package/dist/client/assets/{pdf-Cr4HwsSN.js → pdf-C_AIVI51.js} +2 -2
  55. package/dist/client/assets/{popover-CFQuYACO.js → popover-CXGEm4M0.js} +2 -2
  56. package/dist/client/assets/{pptxDocument-Dxc3oYrP.js → pptxDocument-CHL8asXA.js} +2 -2
  57. package/dist/client/assets/{projectFilesQueryState-CtlKP2rG.js → projectFilesQueryState-7mFyaRdj.js} +2 -2
  58. package/dist/client/assets/queries-x5LGu_Fy.js +2 -0
  59. package/dist/client/assets/{scroll-area-DhT-7J-n.js → scroll-area-D8MfzXjN.js} +2 -2
  60. package/dist/client/assets/{session-BpEQOlGw.js → session-DIGL5_Nm.js} +4 -4
  61. package/dist/client/assets/{spinner-Bld_-IfK.js → spinner-CwxxMzkd.js} +2 -2
  62. package/dist/client/assets/textarea-DdNchuIO.js +5 -0
  63. package/dist/client/assets/{toggle-CoeRt1yA.js → toggle-CmeCFqd7.js} +2 -2
  64. package/dist/client/assets/{toggle-group-Cl-JZXj8.js → toggle-group-iEMUfMdW.js} +2 -2
  65. package/dist/client/assets/{useLocalStorage-B6HRw7FK.js → useLocalStorage-2W_I13tQ.js} +2 -2
  66. package/dist/client/assets/{useWorkspaceMutationRefresh-CdZvTsDX.js → useWorkspaceMutationRefresh-YuIxWftk.js} +2 -2
  67. package/dist/client/assets/{utils-CxdSByf6.js → utils-D0kLIGeh.js} +2 -2
  68. package/dist/client/assets/{xlsxDocument-yc7zPhIi.js → xlsxDocument-ANMZ6ewU.js} +2 -2
  69. package/dist/client/index.html +1 -1
  70. package/dist/service-launcher.mjs +1 -1
  71. package/package.json +1 -1
  72. package/dist/client/assets/DesignWorkspace-NVV8GBAk.js +0 -3
  73. package/dist/client/assets/DiffPanel-DEXl5JNm.js +0 -2
  74. package/dist/client/assets/PreviewPanel-T7-TNC-0.js +0 -2
  75. package/dist/client/assets/PullRequestCodeTab-DeLU7Brq.js +0 -6
  76. package/dist/client/assets/browserHistoryStore-Bvr08etl.js +0 -2
  77. package/dist/client/assets/designCanvas.logic-CR5c1cCe.js +0 -8
  78. package/dist/client/assets/main-C_wQnCSV.js +0 -145
  79. package/dist/client/assets/main-H0NXtw22.css +0 -2
  80. package/dist/client/assets/queries-D1aqiDAP.js +0 -2
  81. package/dist/client/assets/textarea-C37zxlv0.js +0 -5
@@ -1,6 +1,6 @@
1
- import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{Du as t,Gt as n,Wt as r,Z as i,a,cd as o,ga as s,gd as c,td as l,uo as u,wu as d}from"./useLocalStorage-B6HRw7FK.js";import{$i as f,$r as p,Aa as m,Ba as h,Bi as g,Bo as _,Ca as v,Ci as y,Cn as b,Co as x,Ea as S,Ei as C,Er as w,Ga as ee,Gr as te,Hi as T,Ir as E,Ja as ne,Ji as re,Jn as D,Ki as O,Kr as k,Li as A,Lo as ie,Ni as ae,Oa as oe,Pi as se,Qa as ce,Qi as le,Qn as ue,Qr as de,Sa as fe,Sn as pe,Ta as me,Ti as he,Tn as j,Tr as ge,Ua as M,Un as _e,Va as ve,Wa as ye,Xa as be,Xi as xe,Xn as Se,Ya as Ce,Yr as N,Za as we,Zi as Te,Zn as Ee,Zr as De,_n as Oe,aa as P,ar as ke,bn as Ae,ci as je,ct as Me,dt as Ne,ea as Pe,er as Fe,fa as Ie,ft as Le,ga as Re,ho as ze,ia as Be,ii as Ve,jr as He,mn as Ue,na as We,nr as Ge,or as Ke,pa as qe,pt as Je,qa as Ye,qi as Xe,qn as Ze,rr as Qe,sr as $e,t as F,tr as et,ua as tt,vn as nt,wi as rt,wo as it,xn as at,yn as ot,za as st,zi as ct}from"./utils-CxdSByf6.js";import{Kn as lt,Xt as ut,a as dt,nn as ft,nr as pt,qn as mt}from"./textarea-C37zxlv0.js";import{Gt as ht,Kt as gt,Rn as _t,Vt as vt,jn as yt,t as bt}from"./scroll-area-DhT-7J-n.js";import{j as xt}from"./entities-x8g8jint.js";import{t as I}from"./input-C5hbrs5d.js";var L=e(a(),1),St=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),Ct=Object.defineProperty,wt=Object.defineProperties,Tt=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable,Dt=(e,t,n)=>t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ot=(e,t)=>{for(var n in t||={})z.call(t,n)&&Dt(e,n,t[n]);if(R)for(var n of R(t))Et.call(t,n)&&Dt(e,n,t[n]);return e},B=(e,t)=>wt(e,Tt(t)),kt=(0,L.forwardRef)((e,t)=>L.createElement(x,B(Ot({ref:t},e),{weights:St})));kt.displayName=`MagnifyingGlass`;var V={kind:`branch`,baseRef:null},At={kind:`unstaged`};function jt(e){return e?.trim()||null}var H=Je()(Le(e=>({byThreadKey:{},branchBaseRefByThreadKey:{},diffRenderMode:`stacked`,setDiffRenderMode:t=>e({diffRenderMode:t}),selectGitScope:(t,n)=>e(e=>{let r=ze(t),i=e.byThreadKey[r],a=i?.kind===`branch`?i.baseRef:e.branchBaseRefByThreadKey[r]??null;return{byThreadKey:{...e.byThreadKey,[r]:n===`branch`?{kind:`branch`,baseRef:a}:{kind:`unstaged`}},branchBaseRefByThreadKey:i?.kind===`branch`?{...e.branchBaseRefByThreadKey,[r]:i.baseRef}:e.branchBaseRefByThreadKey}}),selectBranchBaseRef:(t,n)=>e(e=>{let r=ze(t),i=jt(n);return{byThreadKey:{...e.byThreadKey,[r]:{kind:`branch`,baseRef:i}},branchBaseRefByThreadKey:{...e.branchBaseRefByThreadKey,[r]:i}}}),selectTurn:(t,n,r)=>e(e=>{let i=ze(t),a=e.byThreadKey[i];return{byThreadKey:{...e.byThreadKey,[i]:{kind:`turn`,turnId:n,filePath:r?.trim()||null,revealRequestId:a?.kind===`turn`?a.revealRequestId+1:1}}}}),reconcileTurnSelection:(t,n)=>e(e=>{let r=ze(t),i=e.byThreadKey[r],a=n[0];return i?.kind!==`turn`||a===void 0||n.includes(i.turnId)?e:{byThreadKey:{...e.byThreadKey,[r]:{...i,turnId:a}}}}),removeThread:t=>e(e=>{let n=ze(t);if(!(n in e.byThreadKey)&&!(n in e.branchBaseRefByThreadKey))return e;let{[n]:r,...i}=e.byThreadKey,{[n]:a,...o}=e.branchBaseRefByThreadKey;return{byThreadKey:i,branchBaseRefByThreadKey:o}})}),{name:`borgcode:diff-panel-state:v1`,version:1,storage:Ne(()=>Me(typeof window<`u`?window.localStorage:void 0)),partialize:e=>({byThreadKey:e.byThreadKey,branchBaseRefByThreadKey:e.branchBaseRefByThreadKey,diffRenderMode:e.diffRenderMode})}));function Mt(e,t,n=!1){return t?e[ze(t)]??(n?At:V):V}function Nt(e){if(e.startsWith(`/`)||lt(e)||/^[a-zA-Z]:/.test(e))return null;let t=e.replaceAll(`\\`,`/`).split(`/`).filter(e=>e.length>0&&e!==`.`);return t.length===0||t.includes(`..`)?null:t}function Pt(e,t){if(!e||!t)return null;let n=mt(e),r=mt(t);if(n===r)return[];let i=r.includes(`\\`)?`\\`:`/`,a=r.endsWith(i)?r:`${r}${i}`;return n.startsWith(a)?n.slice(a.length).split(/[\\/]+/).filter(Boolean):null}function Ft(e){let t=Nt(e.filePath);if(!t)return null;let n=Pt(e.workspaceRoot,e.repositoryRoot);if(!n||n.length===0)return t.join(`/`);let r=e.repositoryRoot?lt(e.repositoryRoot):!1;if(!n.every((e,n)=>{let i=t[n];return i===void 0?!1:r?i.toLowerCase()===e:i===e}))return null;let i=t.slice(n.length);return i.length>0?i.join(`/`):null}function It({threadRef:e,filePath:t,activeCwd:n,repositoryRoot:r,openInEditor:i}){let a=Ft({filePath:t,workspaceRoot:n,repositoryRoot:r});if(a){if(e){xt.getState().openFile(e,a);return}i(n?yt(a,n):a)}}function Lt(e,t,n){H.getState().selectTurn(e,t,n),xt.getState().open(e,`diff`)}var U=it(),W=new Set([`completed`,`failed`,`cancelled`,`interrupted`]);function G(e){return W.has(e)}function Rt(e){return e===`pending`||e===`running`||e===`waiting`}var zt=6,Bt=180,Vt=100;function Ht(e){return e.agentKind!==`agent`}function Ut(e){return e.length<=Bt?e:`${e.slice(0,Bt-1)}…`}function Wt(e,t,n){let r=Ut(n);if(e.length>0&&e[e.length-1]?.summary===r)return e;let i=[...e,{at:t,summary:r}];return i.length>zt?i.slice(-6):i}function K(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}function q(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0}function Gt(e){if(typeof e!=`object`||!e)return;let t=e,n=q(t.totalTokens);if(n===void 0)return;let r={totalTokens:n},i=q(t.inputTokens);i!==void 0&&(r.inputTokens=i);let a=q(t.cachedInputTokens);a!==void 0&&(r.cachedInputTokens=a);let o=q(t.outputTokens);o!==void 0&&(r.outputTokens=o);let s=q(t.reasoningOutputTokens);s!==void 0&&(r.reasoningOutputTokens=s);let c=q(t.toolUses);c!==void 0&&(r.toolUses=c);let l=q(t.durationMs);return l!==void 0&&(r.durationMs=l),r}function J(e,t){if(!t)return e;if(!e)return t;let n=(e,t)=>e===void 0?t:t===void 0?e:Math.max(e,t),r={totalTokens:Math.max(e.totalTokens,t.totalTokens)},i=n(e.inputTokens,t.inputTokens);i!==void 0&&(r.inputTokens=i);let a=n(e.cachedInputTokens,t.cachedInputTokens);a!==void 0&&(r.cachedInputTokens=a);let o=n(e.outputTokens,t.outputTokens);o!==void 0&&(r.outputTokens=o);let s=n(e.reasoningOutputTokens,t.reasoningOutputTokens);s!==void 0&&(r.reasoningOutputTokens=s);let c=n(e.toolUses,t.toolUses);c!==void 0&&(r.toolUses=c);let l=n(e.durationMs,t.durationMs);return l!==void 0&&(r.durationMs=l),r}function Kt(e,t){return K(e.taskType)===`local_workflow`?`workflow`:e.parentAgentId!==void 0||t.includes(`:wf:`)?`workflow_agent`:`subagent`}function qt(e,t,n,r){let i=e.get(t);if(i)return i;let a={id:t,kind:Kt(n,t),title:K(n.title)??K(n.detail)??t,role:K(n.role)??null,model:K(n.model)??null,effort:K(n.effort)??null,status:`pending`,activationCount:0,usage:null,progress:null,lastToolName:null,result:null,error:null,outputFile:null,parentAgentId:K(n.parentAgentId)??null,agentIndex:q(n.agentIndex)??null,phaseIndex:q(n.phaseIndex)??null,phaseTitle:K(n.phaseTitle)??null,attempt:q(n.attempt)??null,workflowName:K(n.workflowName)??null,phases:[],runHandles:null,recentActivity:[],firstSeenAt:r,startedAt:null,completedAt:null,updatedAt:r};return e.set(t,a),a}function Jt(e,t){let n=K(t.title);n&&(e.title=n);let r=K(t.role);r&&(e.role=r);let i=K(t.model);i&&(e.model=i);let a=K(t.effort);a&&(e.effort=a);let o=K(t.parentAgentId);o&&(e.parentAgentId=o,e.kind===`subagent`&&(e.kind=`workflow_agent`));let s=K(t.workflowName);s&&(e.workflowName=s),K(t.taskType)===`local_workflow`&&(e.kind=`workflow`);let c=q(t.agentIndex);c!==void 0&&(e.agentIndex=c);let l=q(t.phaseIndex);l!==void 0&&(e.phaseIndex=l);let u=K(t.phaseTitle);u&&(e.phaseTitle=u);let d=q(t.attempt);d!==void 0&&(e.attempt!==null&&d>e.attempt&&(e.result=null,e.error=null,e.completedAt=null),e.attempt=d);let f=K(t.outputFile);if(f&&(e.outputFile=f),Array.isArray(t.phases)){let n=[];for(let e of t.phases){if(typeof e!=`object`||!e)continue;let t=e,r=q(t.index),i=K(t.title);r!==void 0&&i&&n.push({index:r,title:i})}n.length>0&&(e.phases=n.slice().sort((e,t)=>e.index-t.index))}if(typeof t.runHandles==`object`&&t.runHandles!==null){let n=t.runHandles,r={},i=K(n.runId);i&&(r.runId=i);let a=K(n.scriptPath);a&&(r.scriptPath=a);let o=K(n.transcriptDir);o&&(r.transcriptDir=o);let s=K(n.sessionUrl);s&&/^https?:\/\//i.test(s)&&(r.sessionUrl=s),Object.keys(r).length>0&&(e.runHandles={...e.runHandles,...r})}}function Yt(e,t,n){let r=G(e.status),i=G(t);r&&i||((r||e.status===`idle`)&&(t===`running`||t===`pending`)&&(e.activationCount+=1,e.result=null,e.error=null,e.completedAt=null,t===`running`&&(e.startedAt=n)),t===`running`&&e.startedAt===null&&(e.startedAt=n),i&&e.completedAt===null&&(e.completedAt=n),e.status=t)}var Xt=new Map([[`completed`,`completed`],[`failed`,`failed`],[`stopped`,`interrupted`]]),Zt=new Set([`pending`,`running`,`waiting`,`idle`,`completed`,`failed`,`cancelled`,`interrupted`]);function Qt(e){return typeof e==`string`&&Zt.has(e)?e:void 0}function $t(e,t){let n=new Map;for(let t of e){if(typeof t.payload!=`object`||t.payload===null)continue;let e=t.payload,r=t.createdAt;switch(t.kind){case`task.started`:{let t=K(e.taskId);if(!t||Ht(e))break;let i=qt(n,t,e,r);Jt(i,e),i.activationCount===0&&!G(i.status)?(i.activationCount=1,i.startedAt=i.startedAt??r,i.status=`running`):i.status===`idle`&&Yt(i,`running`,r);let a=K(e.detail);a&&i.title===i.id&&(i.title=a),i.updatedAt=r;break}case`task.progress`:{let t=K(e.taskId);if(!t)break;let i=n.has(t);if(!i&&Ht(e))break;let a=qt(n,t,e,r);Jt(a,e),a.activationCount===0&&(a.activationCount=1);let o=Qt(e.status);o?Yt(a,o,r):(e.usageSnapshot!==!0||!i)&&!G(a.status)&&a.status!==`idle`&&Yt(a,`running`,r);let s=K(e.summary);s&&(a.progress=Ut(s),a.recentActivity=Wt(a.recentActivity,r,s));let c=K(e.lastToolName);c&&(a.lastToolName=c,s||(a.recentActivity=Wt(a.recentActivity,r,`▸ ${c}`)));let l=K(e.error);l&&(a.error=Ut(l)),a.usage=J(a.usage,Gt(e.typedUsage)),a.updatedAt=r;break}case`task.updated`:{let t=K(e.taskId);if(!t||!n.has(t)&&Ht(e))break;let i=qt(n,t,e,r);Jt(i,e),i.activationCount===0&&(i.activationCount=1);let a=G(i.status),o=Qt(e.status);o&&Yt(i,o,r);let s=K(e.error);s&&(i.error=Ut(s));let c=K(e.endedAt);c&&!a&&G(i.status)&&(i.completedAt=c),i.updatedAt=r;break}case`task.completed`:{let t=K(e.taskId);if(!t||!n.has(t)&&Ht(e))break;let i=qt(n,t,e,r);Jt(i,e),i.activationCount===0&&(i.activationCount=1);let a=K(e.summary)??K(e.detail);if(G(i.status)){a&&(i.status===`failed`?i.error=i.error??Ut(a):i.result=i.result??Ut(a)),i.usage=J(i.usage,Gt(e.typedUsage));break}let o=Xt.get(K(e.status)??``)??`completed`;Yt(i,o,r),a&&(o===`failed`?i.error=i.error??Ut(a):i.result=Ut(a)),i.usage=J(i.usage,Gt(e.typedUsage)),i.updatedAt=r;break}case`tool.progress`:{let t=K(e.taskId);if(!t)break;let i=n.get(t);if(!i)break;let a=K(e.toolName);a&&(i.lastToolName=a,i.recentActivity=Wt(i.recentActivity,r,`▸ ${a}`)),i.updatedAt=r;break}default:break}}for(let e of n.values())if(!(e.kind!==`workflow`||!G(e.status)))for(let t of n.values())t.parentAgentId===e.id&&(G(t.status)||t.status===`idle`||(t.status=e.status===`completed`?`completed`:`interrupted`,t.completedAt=t.completedAt??e.completedAt??e.updatedAt,t.updatedAt=e.updatedAt));if(t?.sessionLive===!1)for(let e of n.values())Rt(e.status)&&(e.status=`interrupted`,e.completedAt=e.completedAt??e.updatedAt);let r=Array.from(n.values());if(r.length>Vt){let e=e=>Rt(e.status)?0:e.status===`idle`?1:2;r=r.slice().sort((t,n)=>e(t)-e(n)||n.updatedAt.localeCompare(t.updatedAt)).slice(0,Vt)}return r.map(e=>({...e}))}var en={workflows:[],directAgents:[],runningCount:0,waitingCount:0,idleCount:0,settledCount:0,totalTokens:0,hasAgents:!1,liveCount:0};function tn(){return en}function nn({agents:e,v2Projection:t}){let n=t??e;if(n.length===0)return en;let r=n.filter(e=>e.kind===`workflow`).slice().sort((e,t)=>e.firstSeenAt.localeCompare(t.firstSeenAt)||e.id.localeCompare(t.id)),i=new Set(r.map(e=>e.id)),a=new Map,o=[];for(let e of n)if(e.kind!==`workflow`)if(e.parentAgentId!==null&&i.has(e.parentAgentId)){let t=a.get(e.parentAgentId)??[];t.push(e),a.set(e.parentAgentId,t)}else o.push(e);let s=r.map(e=>{let t=a.get(e.id)??[],n=e.phases.length>0?e.phases:(()=>{let e=new Map;for(let n of t)n.phaseIndex!==null&&!e.has(n.phaseIndex)&&e.set(n.phaseIndex,n.phaseTitle??`Phase ${n.phaseIndex+1}`);return Array.from(e.entries()).map(([e,t])=>({index:e,title:t})).slice().sort((e,t)=>e.index-t.index)})(),r=new Set(n.map(e=>e.index));return{workflow:e,phases:n.map(e=>{let n=t.filter(t=>t.phaseIndex===e.index).slice().sort((e,t)=>(e.agentIndex??0)-(t.agentIndex??0)),r=n.filter(e=>Rt(e.status)||e.status===`idle`).length,i=n.filter(e=>G(e.status)).length,a=n.length===0?`pending`:r>0?`running`:i===n.length?`done`:`pending`;return{index:e.index,title:e.title,members:n,state:a,activeCount:r,settledCount:i}}),unphasedMembers:t.filter(e=>e.phaseIndex===null||!r.has(e.phaseIndex)).slice().sort((e,t)=>(e.agentIndex??0)-(t.agentIndex??0))}}),c=0,l=0,u=0,d=0,f=0;for(let e of n)e.kind===`workflow`&&(a.get(e.id)??[]).length>0||(e.status===`running`||e.status===`pending`?c+=1:e.status===`waiting`?l+=1:e.status===`idle`?u+=1:d+=1,f+=e.usage?.totalTokens??0);return{workflows:s,directAgents:o.slice().sort((e,t)=>e.firstSeenAt.localeCompare(t.firstSeenAt)||e.id.localeCompare(t.id)),runningCount:c,waitingCount:l,idleCount:u,settledCount:d,totalTokens:f,hasAgents:!0,liveCount:c+l}}function rn(e,t){if(!e)return null;let n=e.replace(/^claude-/,``).replace(/-\d{8}$/,``).replace(/-latest$/,``);return t?`${n} · ${t}`:n}function an(e){if(e<1e3)return`${e}`;if(e<1e6){let t=e/1e3;return`${t>=100?Math.round(t):t.toFixed(1)}k`}return`${(e/1e6).toFixed(1)}M`}function on(e){let t=(e.length>8e3?e.slice(-8e3).replace(/^[^\n]*\n/u,``):e).split(/\r?\n/u),n=!1,r,i=``;for(let[e,a]of t.entries()){if(/^\s*```/u.test(a)){n=!n;continue}if(n)continue;let o=/^\s*\*\*([^*]+)\*\*\s*$/u.exec(a),s=e<t.length-1?/^\s*#{1,6}\s+(.+?)\s*#*\s*$/u.exec(a):null;o||s?r=(o??s)[1]:i+=`${a}\n`}return{heading:r,prose:i}}var sn=/.+?(?:[.!?](?=\s|$)|[。!?])/gu,cn=/^(?:okay|ok|so|alright|right|well|hmm+|now)(?=[\s,.!?…]|$)[,.!?…]*\s*/iu,ln=/^\s*(?:[-*+•]|\d{1,3}[.)])\s+/u;function un(e,t){let n=e?.replace(/\[([^\]]+)\]\([^)]*\)/gu,`$1`).replace(/[*_`]/gu,``).replace(/\s+/gu,` `).trim();if(!n)return;if(n.length<=t)return n;let r=n.slice(0,t-1),i=r.lastIndexOf(` `);return`${(i>t/2?r.slice(0,i):r).trimEnd()}…`}function dn(e,t=160){return un(on(e).heading,t)}function fn(e,t=160){return un(on(e).prose.match(sn)?.at(-1),t)}function pn(e,t=160){let n=e.length>4e3?e.slice(0,4e3):e,r=[],i=!1;for(let e of on(n).prose.split(`
2
- `)){let t=ln.exec(e)?.[0];e.trim().length===0?i=!1:i&&t===void 0?r[r.length-1].text+=` ${e.trim()}`:(r.push({text:e.slice(t?.length??0).trim(),item:t!==void 0}),i=!0)}for(let[e,n]of r.entries()){let i=n.item&&e<r.length-1?[n.text]:[];for(let e of n.text.match(sn)??i){let n=e.trim();for(;cn.test(n);)n=n.replace(cn,``);if(n)return un(n.charAt(0).toUpperCase()+n.slice(1),t)}}}function mn(e,t=160,n=!1){return dn(e,t)??(n?fn(e,t):void 0)??pn(e,t)}var hn=24;function gn(e){let t=e&&typeof e==`object`?e:{},n=e=>typeof e==`string`&&e.trim().length>0?e.trim():void 0,r=Array.isArray(t.sections)?t.sections.flatMap(e=>{let t=e&&typeof e==`object`?e:{},r=n(t.headline);return r?[{headline:r,summary:n(t.summary)??``}]:[]}).slice(0,hn):[];return{summary:n(t.summary),title:n(t.title),sections:r,summarySource:t.summarySource===`model`?`model`:void 0}}function _n(e){if(!Number.isFinite(e)||e<0)return`0ms`;if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4)return`${(e/1e3).toFixed(1)}s`;if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n===0?`${t}m`:n===60?`${t+1}m`:`${t}m ${n}s`}function vn(e){return _n(e).replace(/\.0s$/,`s`)}function yn(e){return e===`setup-script.requested`||e===`setup-script.started`}var bn=new Set([`read`,`edit`,`command`,`code-search`,`search`,`other`]);function xn(e){return typeof e==`string`&&bn.has(e)?e:void 0}var Sn={read:{kind:`read`,title:`Read a file`},list:{kind:`read`,title:`Listed a directory`},write:{kind:`edit`,title:`Wrote a file`},edit:{kind:`edit`,title:`Edited a file`},multiedit:{kind:`edit`,title:`Edited files`},patch:{kind:`edit`,title:`Edited files`},bash:{kind:`command`,title:`Ran a command`},glob:{kind:`code-search`,title:`Searched files`},grep:{kind:`code-search`,title:`Searched code`},webfetch:{kind:`search`,title:`Fetched a page`},websearch:{kind:`search`,title:`Searched the web`},todowrite:{kind:`other`,title:`Updated the plan`},todoread:{kind:`other`,title:`Read the plan`},task:{kind:`other`,title:`Ran a subagent`}};function Cn(e){let t=Sn[e?.trim().toLowerCase()??``];return t?{...t,keepsDetail:t.kind===`command`}:void 0}var wn=/^((?:Using|Used)\s+)?(?:mcp__borg-code__|borg-code(?:__|_|\s+·\s+))(?=[A-Za-z])/u;function Tn(e){return e.replace(wn,`$1`)}function En(e){if(typeof e!=`object`||!e||Array.isArray(e)||e.server!==`borg-code`)return e;let t={...e};return delete t.server,t}function Dn(e,t=160){return mn(e,t)}function On(e){let t=e.fields.summary||Dn(e.text);return(e.live?t:e.fields.title||t)||e.fallback}function kn(e){return e.hasAssistantText?{phase:`responding`,label:`Responding`,icon:`message-circle`}:e.hasCompletedWork?{phase:`continuing`,label:`Continuing`,icon:`arrow-right`}:e.hasStarted?{phase:`waiting`,label:`Processing`,icon:`zap`}:{phase:`starting`,label:`Starting`,icon:`zap`}}function An(e){return e.replace(/\s+(?:complete|completed)\s*$/i,``).trim()}function jn(e){return e.tone===`tool`||e.tone===`thinking`||e.tone===`error`||e.command!==void 0&&e.command.trim().length>0||e.requestKind!==void 0?!0:e.itemType!==void 0&&i(e.itemType)}function Mn(e){return e.itemType===`web_search`&&/\bgrep\b/i.test(An(e.toolTitle??e.label))}function Nn(e){return e.toolKind===void 0?e.requestKind===`file-read`||e.itemType===`image_view`||e.itemType===`dynamic_tool_call`&&e.toolTitle?.trim().toLowerCase()===`read file`?`read`:e.requestKind===`file-change`||e.itemType===`file_change`||(e.changedFiles?.length??0)>0?`edit`:e.requestKind===`command`||e.itemType===`command_execution`||e.command?`command`:Mn(e)?`code-search`:e.itemType===`web_search`?`search`:jn(e)?`other`:`update`:e.toolKind}function Pn(e){let t=e.detail?.trim();return Nn(e)===`read`&&t!==void 0&&!/[\r\n]/.test(t)&&vt(t)?t:null}var Fn=/^(?:file:|[\\/]|[a-z]:[\\/])/i,In=/(?:^|[\\/])(?:dev|userdata)[\\/]attachments[\\/]([a-z0-9_-]{1,128})\.[a-z0-9]{1,10}$/i;function Ln(e,t){let n=ht(e,t.workspaceRoot??`.`);if(n._tag!==`WorkspaceFile`)return null;let r=t.workspaceRoot==null&&n.path.startsWith(`./`)?n.path.slice(2):n.path,i=Fn.test(e)?In.exec(r)?.[1]??null:null;return{resource:i?{_tag:`attachment`,attachmentId:i}:{_tag:`workspace-file`,threadId:t.threadId,path:r},alt:r.split(/[\\/]/).at(-1)??`image`,srcFragment:gt(e)}}function Rn(e,t){if(e!==`edit`)return t.length;let n=new Set,r=0;for(let e of t){if(!e.changedFiles||e.changedFiles.length===0){r+=1;continue}for(let t of e.changedFiles)n.add(t)}return n.size+r}function zn(e,t){switch(e){case`read`:return`Read ${t} ${t===1?`file`:`files`}`;case`edit`:return`Changed ${t} ${t===1?`file`:`files`}`;case`command`:return`Ran ${t} ${t===1?`command`:`commands`}`;case`search`:return`Searched the web ${t} ${t===1?`time`:`times`}`;case`code-search`:return`Searched code ${t} ${t===1?`time`:`times`}`;case`other`:return`Used ${t} ${t===1?`tool`:`tools`}`;case`update`:return`Received ${t} ${t===1?`update`:`updates`}`}}function Bn(e){return Vn(e.filter(e=>e.toolLifecycleStatus===`completed`&&e.reasoning===void 0&&e.tone!==`error`&&(e.sourceActivityKind===`tool.completed`||e.toolKind!==void 0)))}function Vn(e){let t=Hn(e,e=>e),n=new Map;for(let e of t){if(Un(e))continue;let t=Nn(e),r=n.get(t);r?r.push(e):n.set(t,[e])}let r=[...n].map(([e,t])=>zn(e,Rn(e,t))),i=r.length>0?null:Wn(t),a=(i===null?r:[i,...r]).map((e,t)=>t===0?e:e.charAt(0).toLowerCase()+e.slice(1));return a.length<2?a[0]??``:a.length===2?a.join(` and `):`${a.slice(0,-1).join(`, `)}, and ${a.at(-1)}`}function Hn(e,t){let n=new Set,r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=t(a),s=An(o.toolTitle??o.label),c=[o.turnId??`no-turn`,o.itemType??``,s].join(``),l=o.sourceActivityKind;o.toolCallId===void 0&&o.toolLifecycleStatus===void 0&&(l===`tool.started`||l===`tool.updated`)&&n.has(c)||(r.push(a),(l===`tool.completed`||o.toolLifecycleStatus!==void 0&&o.toolLifecycleStatus!==`inProgress`)&&n.add(c))}return r.toReversed()}function Un(e){return e.reasoning!==void 0}function Wn(e){let t=e.filter(Un);if(t.length===0)return null;let n=t.reduce((e,t)=>e+(t.reasoning?.durationMs??0),0);return n>=1e3?`Thought for ${vn(n)}`:`Thought for a moment`}function Gn(e){let t=e.reasoning?.durationMs??null;if(!(t===null||t<1e3||e.label.startsWith(`Thought for`)))return vn(t)}function Kn(e){let t=e.filter(e=>!Un(e));if(t.length===0)return e.length>0?`reasoning`:`mixed`;let n=new Set(t.map(Nn));if(n.size!==1)return`mixed`;let r=n.values().next().value;if(r!==`other`)return r;let i=new Set(t.map(e=>e.itemType===`mcp_tool_call`?`other`:e.itemType===`dynamic_tool_call`?`dynamic-tool`:e.itemType===`collab_agent_tool_call`||e.taskId||e.tone===`thinking`?`agent-tool`:e.tone===`tool`?`tone-tool`:`other`));return i.size===1?i.values().next().value:`mixed`}var qn=2e3,Jn=24;function Yn(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function Xn(e){if(!Array.isArray(e)||e.length===0||e.length>Jn)return;let t=e.flatMap(e=>Array.isArray(e)&&e.length===2&&Number.isInteger(e[0])&&e[0]>=1&&e[0]<=1e4&&typeof e[1]==`number`&&Number.isFinite(e[1])?[[e[0],nr(e[1])]]:[]);return t.length===e.length?[...t].sort((e,t)=>e[0]-t[0]):void 0}function Zn(e){let t=Yn(e);if(t===void 0)return;let{attachmentId:n,title:r,height:i,heights:a}=t;if(typeof n!=`string`||n.length===0||n.length>256||typeof r!=`string`||typeof i!=`number`||!Number.isFinite(i))return;let o=Xn(a);return{attachmentId:n,title:r.trim().slice(0,200)||`HTML`,height:nr(i),...o===void 0?{}:{heights:o}}}function Qn(e){let t=Yn(e);if(t?.status===`completed`)return Zn(Yn(t.data)?.htmlRender)}function $n(e,t){return e.attachmentId===t.attachmentId&&e.title===t.title&&e.height===t.height&&(e.heights??[]).length===(t.heights??[]).length&&(e.heights??[]).every(([e,n],r)=>t.heights?.[r]?.[0]===e&&t.heights[r][1]===n)}function er(e,t){let n=e.heights;if(n===void 0||n.length===0)return e.height;let r=n.findIndex(([e])=>e>=t),i=r===-1?n.length-1:r,a=n[i][0]===t?i:Math.max(0,i-1),o=Math.max(n[a][1],n[i][1]);return nr(Math.min(e.height,o))}function tr(e){return`${e.replace(/[\\/:*?"<>|\p{Cc}]+/gu,` `).replace(/\s+/g,` `).trim().slice(0,120).trim()||`Page`}.html`}function nr(e){return Math.min(qn,Math.max(80,Math.round(e)))}var rr={sans:`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,mono:`"SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace`};ft(ut,`light`)??ut.colors,ft(ut,`dark`)??ut.colors;var ir={light:{success:`#10b981`,successForeground:`#047857`,info:`#3b82f6`,infoForeground:`#1d4ed8`,chart:[`#0d9488`,`#d97706`,`#9333ea`,`#e11d48`,`#65a30d`]},dark:{success:`#10b981`,successForeground:`#34d399`,info:`#3b82f6`,infoForeground:`#60a5fa`,chart:[`#2dd4bf`,`#fbbf24`,`#c084fc`,`#fb7185`,`#a3e635`]}};function ar(e,t,n=rr){let r=ir[t];return{appearance:t,variables:{"--background":e.canvas,"--foreground":e.text,"--muted":e.muted,"--muted-foreground":e.mutedForeground,"--card":e.surface,"--card-foreground":e.text,"--popover":e.surfaceOverlay,"--popover-foreground":e.text,"--secondary":e.secondary,"--secondary-foreground":e.secondaryForeground,"--border":e.border,"--input":e.input,"--ring":e.focus,"--primary":e.messageAction,"--primary-foreground":e.messageActionForeground,"--accent":e.accent,"--accent-foreground":e.accentForeground,"--accent-surface":e.accentSurface,"--accent-surface-foreground":e.accentSurfaceForeground,"--destructive":e.error,"--destructive-foreground":e.errorForeground,"--destructive-surface":e.errorSurface,"--warning":e.warning,"--warning-foreground":e.warningForeground,"--warning-surface":e.warningSurface,"--success":r.success,"--success-foreground":r.successForeground,"--info":r.info,"--info-foreground":r.infoForeground,"--code-background":e.codeBackground,"--code-foreground":e.codeForeground,"--chart-1":e.accent,...Object.fromEntries(r.chart.map((e,t)=>[`--chart-${t+2}`,e])),"--radius":`0.625rem`,"--font-sans":n.sans,"--font-mono":n.mono}}}[`Borg injects its active theme as CSS custom properties on :root, and they follow the user's theme and light/dark mode live:`,`--background (page background, identical to the thread around the frame), --foreground, --muted, --muted-foreground,`,`--card, --card-foreground, --popover, --popover-foreground, --secondary, --secondary-foreground, --border, --input, --ring,`,`--primary, --primary-foreground (solid buttons), --accent, --accent-foreground (brand accent), --accent-surface, --accent-surface-foreground,`,`--destructive, --destructive-foreground, --destructive-surface, --warning, --warning-foreground, --warning-surface,`,`--success, --success-foreground, --info, --info-foreground, --code-background, --code-foreground,`,`--chart-1 … --chart-6 (categorical series for charts), --radius, --font-sans, --font-mono.`,`The base stylesheet sets html background/color/font from these, body margin to 0, and hides the page's scrollbar; your own CSS overrides it.`].join(` `),[`The frame is borderless on the thread's background, as wide as the reply column (728px on desktop by default, wider if the reader widens chat, about 360px on phones), and its left edge lines up with your reply text.`,`Use a fluid width with no horizontal padding on the outermost element, and no outer card, border, or banner title: the page is part of your reply.`,`Give charts fixed pixel heights rather than heights that scale with width.`].join(` `);var or=`ui/notifications/host-context-changed`,sr=`ui/open-link`;function cr(e){let t=Yn(e);if(t===void 0)return;let{jsonrpc:n,id:r,method:i,params:a}=t;if(n!==`2.0`||i!==sr||typeof r!=`string`&&typeof r!=`number`)return;let o=Yn(a)?.url;return typeof o==`string`&&/^https?:\/\//i.test(o)?{id:r,url:o}:void 0}function lr(e){return{jsonrpc:`2.0`,id:e,result:{}}}var ur=`borg-theme`;function dr(e){return`#${ur}=${encodeURIComponent(JSON.stringify(e))}`}function fr(e){return{jsonrpc:`2.0`,method:or,params:{theme:e.appearance,styles:{variables:e.variables}}}}`${JSON.stringify(`html{background:var(--background);color:var(--foreground);font-family:var(--font-sans);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;scrollbar-width:none}html::-webkit-scrollbar{display:none}body{margin:0}code,kbd,pre,samp{font-family:var(--font-mono)}`)}${ur}${JSON.stringify(`html{padding:clamp(24px,5vw,64px)}`)}${JSON.stringify(or)}${JSON.stringify(sr)}`;var pr=Symbol(),mr=new WeakMap,hr=u(n),gr=u(r);function _r(e){return e.tone===`tool`||e.tone===`thinking`||e.tone===`error`||e.command!==void 0&&e.command.trim().length>0||e.requestKind!==void 0?!0:e.itemType!==void 0&&i(e.itemType)}function vr(e){let t=e.toLowerCase();return!!(t.includes(`file not found`)||t.includes(`no files found`)||t.includes(`enoent`)||t.includes(`no such file or directory`)||t.includes(`no such file`)||t.includes(`cannot find path`)&&t.includes(`because it does not exist`)||t.includes(`commandnotfoundexception`)||t.includes(`is not recognized as the name of a cmdlet`)||t.includes(`is not recognized`)&&t.includes(`the term '`)||t.includes(`a parameter cannot be found that matches parameter name`)||t.includes(`command not found`)||/<exited with exit code\s+[1-9]\d*\s*>/i.test(e)||/exit(?:ed)? with exit code\s+[1-9]\d*/i.test(e)||/exit code\s*[:\s]\s*[1-9]\d*\b/i.test(e))}function yr(e,t){if(e.tone===`error`)return!0;if(e.reasoning!==void 0)return!1;let n=e.toolLifecycleStatus;if(n===`failed`||n===`declined`)return!0;if(!_r(e))return!1;let r=[];e.detail&&r.push(e.detail),t&&e.command&&r.push(e.command);let i=r.join(`
3
- `);return i.length===0?!1:vr(i)}function br(e){return yr(e,!0)}function xr(e){return yr(e,!1)}function Sr(e){return e.sourceActivityKind===`runtime.error`||e.sourceActivityKind?.endsWith(`.failed`)===!0}function Cr(e){if(!_r(e)||br(e)||e.tone===`thinking`)return!1;let t=e.toolLifecycleStatus;return!(t===`failed`||t===`declined`||t===`inProgress`||t===`stopped`)}function wr(e){return!(e.agentSpawn!==void 0||e.reasoning!==void 0||!_r(e)||br(e)||Cr(e))}function Tr(e){if(!Number.isFinite(e)||e<0)return`0ms`;if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4){let t=Math.round(e/100)/10;return t>=10?`10s`:`${t.toFixed(1)}s`}if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n===0?`${t}m`:n===60?`${t+1}m`:`${t}m ${n}s`}function Er(e,t){return!e?.startedAt||!e.completedAt?!1:t?t.status!==`running`:!0}function Dr(e,t,n,r=null){let i=t?.status===`running`?t.activeTurnId:null;return i===null?Er(e,t)?n:e?.startedAt??n:e?.turnId===i?e.startedAt??n??r:n??r}function Or(e){switch(e){case`command_execution_approval`:case`exec_command_approval`:case`dynamic_tool_call`:return`command`;case`file_read_approval`:return`file-read`;case`file_change_approval`:case`apply_patch_approval`:return`file-change`;case`mcp_elicitation_approval`:return`mcp-elicitation`;case`mcp_tool_call_approval`:return`mcp-tool`;case`external_directory_approval`:return`workspace-access`;default:return typeof e==`string`&&e.length>0?`other`:null}}function kr(e){let t=e?.toLowerCase();return t?t.includes(`stale pending approval request`)||t.includes(`stale pending user-input request`)||t.includes(`unknown pending approval request`)||t.includes(`unknown pending permission request`)||t.includes(`unknown pending user-input request`)||t.includes(`unknown pending user input request`)||t.includes(`unknown pending codex user input request`):!1}var Ar=(e,t)=>{let n=e[t];return typeof n==`string`&&n.length>0?n:void 0};function jr(e){let t=new Map;for(let n of[...e].toSorted(Fi)){let e=n.payload&&typeof n.payload==`object`?n.payload:null,r=e?Ar(e,`requestId`):void 0;if(!e||!r)continue;if(n.kind===`approval.requested`){if(e.requestKind!==`app-connection`)continue;let i=Ar(e,`appSlug`),a=Ar(e,`connectUrl`);if(!i||!a)continue;let o=Ar(e,`appLogo`),c=Ar(e,`appDescription`);t.set(r,{requestId:s.make(r),createdAt:n.createdAt,name:Ar(e,`appName`)??i,slug:i,url:a,reauth:e.reauth===!0,...o?{logo:o}:{},...c?{description:c}:{},status:`pending`});continue}let i=t.get(r);if(i)if(n.kind===`approval.resolved`){let n=e.decision;t.set(r,{...i,status:n===`accept`?`connected`:n===`decline`?`skipped`:`not_connected`})}else i.status===`pending`&&n.kind===`provider.approval.respond.failed`&&kr(Ar(e,`detail`))&&t.set(r,{...i,status:`not_connected`})}return[...t.values()]}function Mr(e){let t=new Map,n=[...e].toSorted(Fi);for(let e of n){let n=e.payload&&typeof e.payload==`object`?e.payload:null,r=n&&typeof n.requestId==`string`?s.make(n.requestId):null,i=n&&hr(n.requestKind)?n.requestKind:n?Or(n.requestType):null,a=n&&typeof n.detail==`string`?n.detail:void 0,o=n&&typeof n.appName==`string`?n.appName:void 0,c=n&&typeof n.toolDescription==`string`?n.toolDescription:void 0,l=n?Ar(n,`toolTitle`):void 0,u=n?Ar(n,`appSlug`):void 0,d=n?Ar(n,`appLogo`):void 0,f=n&&typeof n.diff==`string`?n.diff:void 0,p=Array.isArray(n?.options)?n.options.filter(gr):void 0;if(i!==`app-connection`){if(e.kind===`approval.requested`&&r&&i){t.set(r,{requestId:r,requestKind:i,createdAt:e.createdAt,...a?{detail:a}:{},...o?{appName:o}:{},...l?{toolTitle:l}:{},...c?{toolDescription:c}:{},...u?{appSlug:u}:{},...d?{appLogo:d}:{},...f?{diff:f}:{},...p&&p.length>0?{options:p}:{}});continue}if(e.kind===`approval.resolved`&&r){t.delete(r);continue}if(e.kind===`provider.approval.respond.failed`&&r&&kr(a)){t.delete(r);continue}}}return[...t.values()].toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt))}function Nr(e){let t=e?.questions;if(!Array.isArray(t))return null;let n=t.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.id!=`string`||typeof t.header!=`string`||typeof t.question!=`string`||!Array.isArray(t.options))return null;let n=t.options.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;return typeof t.label!=`string`||typeof t.description!=`string`?null:{label:t.label,description:t.description}}).filter(e=>e!==null);return n.length===0?null:{id:t.id,header:t.header,question:t.question,options:n,multiSelect:t.multiSelect===!0}}).filter(e=>e!==null);return n.length>0?n:null}function Pr(e){let t=new Map,n=[...e].toSorted(Fi);for(let e of n){let n=e.payload&&typeof e.payload==`object`?e.payload:null,r=n&&typeof n.requestId==`string`?s.make(n.requestId):null,i=n&&typeof n.detail==`string`?n.detail:void 0;if(e.kind===`user-input.requested`&&r){let i=Nr(n);if(!i)continue;t.set(r,{requestId:r,createdAt:e.createdAt,questions:i});continue}if(e.kind===`user-input.resolved`&&r){t.delete(r);continue}e.kind===`provider.user-input.respond.failed`&&r&&kr(i)&&t.delete(r)}return[...t.values()].toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt))}function Fr(e){let t=e.payload&&typeof e.payload==`object`?e.payload:null,n=t?.plan;if(!Array.isArray(n))return null;let r=[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.step!=`string`)continue;let n=t.status===`completed`||t.status===`inProgress`?t.status:`pending`;r.push({step:t.step,status:n})}return r.length===0?null:{createdAt:e.createdAt,turnId:e.turnId,...t&&`explanation`in t?{explanation:t.explanation}:{},steps:r}}function Ir(e,t){let n=new Map,r,i=e=>{let t=new Map;return e.map(e=>{let n=t.get(e.step)??0;return t.set(e.step,n+1),{key:`${e.step}:${n}`,step:e}})};for(let e of t){let t=Fr(e),a=Date.parse(e.createdAt);if(!(!t||Number.isNaN(a))){r??=a;for(let{key:e,step:r}of i(t.steps)){let t=n.get(e)??{};r.status===`inProgress`&&t.startedAt===void 0&&(t.startedAt=a),r.status===`completed`&&t.completedAt===void 0&&(t.completedAt=a),n.set(e,t)}}}let a=new Map,o=r;for(let[e,t]of[...n.entries()].toSorted((e,t)=>(e[1].completedAt??1/0)-(t[1].completedAt??1/0))){let n=t.completedAt,r=t.startedAt??o;n!==void 0&&(r!==void 0&&n>r&&a.set(e,n-r),o=n)}return{...e,steps:i(e.steps).map(({key:e,step:t})=>{if(t.status!==`completed`)return t;let n=a.get(e);return n===void 0?t:{...t,durationMs:n}})}}function Lr(e,n){let r=[...e].toSorted(Fi).filter(e=>e.kind===`turn.plan.updated`),i=l([...n?d(r,e=>e.turnId===n):c(),t(r)]).pipe(o);if(!i)return null;let a=Fr(i);if(!a)return null;let s=r.filter(e=>e.turnId===i.turnId),u=s.findLastIndex(e=>Fr(e)===null);return Ir(a,s.slice(u+1))}function Rr(e,t){if(t){let n=[...e].filter(e=>e.turnId===t).toSorted((e,t)=>e.updatedAt.localeCompare(t.updatedAt)||e.id.localeCompare(t.id)).at(-1);if(n)return ii(n)}let n=[...e].toSorted((e,t)=>e.updatedAt.localeCompare(t.updatedAt)||e.id.localeCompare(t.id)).at(-1);return n?ii(n):null}function zr(e){return e!==null&&e.implementedAt===null}function Br(e){let t=e.payload&&typeof e.payload==`object`?e.payload:null;return!t||typeof t.taskId!=`string`?!1:!Ht(t)}function Vr(e){let t=e.payload&&typeof e.payload==`object`?e.payload:null;return t?e.kind===`task.started`||e.kind===`task.progress`||e.kind===`task.updated`||e.kind===`task.completed`?typeof t.agentId==`string`&&t.agentId.trim().length>0||t.timelineBypass===!0?!(e.kind!==`task.updated`&&typeof t.taskId==`string`&&!Ht(t)):!1:t.timelineBypass===!0?!0:typeof t.agentId==`string`&&t.agentId.trim().length>0:!1}var Hr=`request_app_connection`;function Ur(e){let t=new Set,n=new Set,r=new Set;for(let i of e){let e=Y(i.payload);if(i.kind===`approval.requested`&&e?.requestKind===`app-connection`){let t=X(e.requestId);t&&r.add(t);continue}if(!i.kind.startsWith(`tool.`))continue;let a=X(e?.toolCallId);if(!a)continue;(e?.status===`failed`||i.tone===`error`)&&n.add(a);let o=X(Y(e?.data)?.tool);o&&(o===Hr||o.endsWith(`_${Hr}`))&&t.add(a)}for(let e of n)t.delete(e);return{toolCallIds:t,requestIds:r}}function Wr(e){let t=new Map;for(let n of e){if(n.kind!==`tool.completed`||Vr(n))continue;let e=Qn(n.payload);if(e===void 0)continue;let r=X(Y(n.payload)?.toolCallId)??n.id,i=t.get(r);i&&Fi(i.activity,n)<=0||t.set(r,{activity:n,htmlRender:e})}return[...t.entries()].toSorted(([,e],[,t])=>Fi(e.activity,t.activity)).map(([e,{activity:t,htmlRender:n}])=>({id:`html-render:${e}`,createdAt:t.createdAt,turnId:t.turnId,htmlRender:n}))}function Gr(e){let t=new Set,n=new Set;for(let r of e){if(r.kind!==`tool.completed`||Qn(r.payload)===void 0)continue;let e=X(Y(r.payload)?.toolCallId);e?t.add(e):n.add(r.id)}return{toolCallIds:t,activityIds:n}}function Kr(e,t={}){let n=[...e].toSorted(Fi),r=[],i=Ur(n),a=t.htmlRendersInline===!1?{toolCallIds:new Set,activityIds:new Set}:Gr(n);for(let e of n){if(a.toolCallIds.size>0||a.activityIds.size>0){if(a.activityIds.has(e.id))continue;let t=X(Y(e.payload)?.toolCallId);if(t&&a.toolCallIds.has(t))continue}if(i.requestIds.size>0||i.toolCallIds.size>0){let t=Y(e.payload);if(t?.requestKind===`app-connection`)continue;let n=X(t?.requestId);if(n&&i.requestIds.has(n))continue;let r=X(t?.toolCallId);if(r&&i.toolCallIds.has(r))continue}e.tone!==`error`&&yn(e.kind)||e.kind===`tool.started`&&!X(Y(e.payload)?.toolCallId)||e.kind!==`reasoning.started`&&(e.kind===`task.started`&&!Br(e)||e.kind!==`task.updated`&&e.kind!==`tool.progress`&&e.kind!==`context-window.updated`&&e.kind!==`turn.plan.updated`&&e.summary!==`Checkpoint captured`&&(qr(e)||Vr(e)||r.push(Yr(e))))}return Qr(r)}function qr(e){return e.kind===`runtime.warning`&&e.summary.endsWith(`(no displayable text content)`)}function Jr(e){if(!e)return;let t=e.status;if(t===`inProgress`||t===`completed`||t===`failed`||t===`declined`||t===`stopped`)return t}function Yr(e){let t=mr.get(e);if(t)return t;let n=e.payload&&typeof e.payload==`object`?e.payload:null,r=_i(n),i=Pi(n),a=vi(n),o=e.kind===`task.started`||e.kind===`task.progress`||e.kind===`task.completed`,s=o&&typeof n?.summary==`string`&&n.summary.length>0?n.summary:null,c=o&&!s&&typeof n?.detail==`string`&&n.detail.length>0?n.detail:null,l=s||c,u=o?!c&&n&&typeof n.detail==`string`&&n.detail.length>0?ki(n.detail).output:null:Oi(n,a??e.summary),d=o?null:yi(n),f={id:e.id,createdAt:e.createdAt,turnId:e.turnId,label:l||Tn(e.summary),tone:e.kind===`task.progress`?`thinking`:e.tone===`approval`?`info`:e.tone,sourceActivityKind:e.kind};if(e.kind===`reasoning.completed`||e.kind===`reasoning.updated`){f.tone=`thinking`;let t=typeof n?.text==`string`?n.text:``,r=gn(n);f.reasoning={text:t,durationMs:e.kind===`reasoning.completed`&&typeof n?.durationMs==`number`?n.durationMs:null,...r.sections.length>0?{sections:r.sections}:{}};let i=e.kind===`reasoning.updated`;f.label=On({live:i,text:i?``:t,fields:r,fallback:i?`Thinking`:f.label})}e.kind===`tool.started`&&(f.label=f.label.replace(/ started$/u,``));let p=Ai(n),m=ji(n);u&&(f.detail=u),r.command&&(f.command=r.command),r.rawCommand&&(f.rawCommand=r.rawCommand),i.length>0&&(f.changedFiles=i),a&&(f.toolTitle=Tn(a));let h=Y(n?.data),g=Y(h?.diffStats);typeof g?.additions==`number`&&typeof g?.deletions==`number`&&(f.diffStats={additions:g.additions,deletions:g.deletions});let _=X(h?.diff);_&&(f.diff=_);let v=X(h?.output);v&&(f.output=v),typeof h?.exitCode==`number`&&(f.exitCode=h.exitCode);let y=xn(h?.kind);if(y)f.toolKind=y;else if(e.kind.startsWith(`tool.`)&&h?.item===void 0){let t=Cn(a??e.summary.replace(/ started$/u,``));t&&(f.toolKind=t.kind,f.toolTitle=t.title,f.label=t.title,t.keepsDetail||delete f.detail)}if(p===`mcp_tool_call`){let e=Y(n?.data);e?.item!==void 0&&(f.toolData=e.item)}p&&(f.itemType=p),m&&(f.requestKind=m),d&&(f.toolCallId=d);let b=Jr(n);!b&&(e.kind===`tool.started`||e.kind===`reasoning.updated`)&&(b=`inProgress`),!b&&(e.kind===`tool.completed`||e.kind===`reasoning.completed`)&&(b=`completed`),b&&(f.toolLifecycleStatus=b),o&&typeof n?.taskId==`string`&&n.taskId.length>0&&(f.taskId=n.taskId),o&&typeof n?.role==`string`&&n.role.length>0&&(f.agentRole=n.role),o&&(n?.taskType===`local_workflow`||typeof n?.workflowName==`string`&&n.workflowName.length>0)&&(f.isWorkflowCoordinator=!0),o&&n&&Ht(n)&&(f.isBackgroundTask=!0);let x=ni(f);return x&&(f[pr]=x),mr.set(e,f),f}function Xr(e){let t=e.taskId??``,n=t.indexOf(`:wf:`);return n===-1?e.agentSpawn?.workflowId?`wf:${e.agentSpawn.workflowId}`:e.isWorkflowCoordinator?`wf:${t}`:e.turnId?`direct:${e.turnId}`:`direct:task:${t}`:`wf:${t.slice(0,n)}`}function Zr(e){if(!(e.sourceActivityKind!==`tool.started`&&e.sourceActivityKind!==`tool.updated`&&e.sourceActivityKind!==`tool.completed`))return e.toolCallId?`tool:${e.turnId??`no-turn`}:${e.toolCallId}`:void 0}function Qr(e){let t=[],n=new Map,r=new Map,i=new Map;for(let a of e){if(a.taskId!==void 0&&!a.isBackgroundTask&&(a.sourceActivityKind===`task.started`||a.sourceActivityKind===`task.progress`||a.sourceActivityKind===`task.completed`)&&a.taskId!==void 0){let e=r.get(a.taskId),i=e??Xr(a);e===void 0&&r.set(a.taskId,i);let o=i.startsWith(`wf:`)?i.slice(3):null,s=n.get(i);if(s!==void 0){let e=t[s],n=e.agentSpawn?.agentTaskIds.includes(a.taskId)?e.agentSpawn.agentTaskIds:[...e.agentSpawn?.agentTaskIds??[],a.taskId];t[s]={...ei(e,a),id:e.id,createdAt:e.createdAt,turnId:e.turnId??null,...e.taskId===void 0?{}:{taskId:e.taskId},label:e.label,agentSpawn:{workflowId:o,agentTaskIds:n}};continue}n.set(i,t.length),t.push({...a,agentSpawn:{workflowId:o,agentTaskIds:[a.taskId]}});continue}let e=Zr(a);if(e!==void 0){let n=i.get(e),r=n===void 0?void 0:t[n];if(n!==void 0&&r&&$r(r,a)){t[n]=ei(r,a);continue}i.delete(e)}let o=t.at(-1);if(o&&$r(o,a)){let e=t.length-1,n=Zr(o);n!==void 0&&i.delete(n);let r=ei(o,a);t[e]=r;let s=Zr(r);s!==void 0&&i.set(s,e);continue}t.push(a),e!==void 0&&i.set(e,t.length-1)}return t}function $r(e,t){return e.sourceActivityKind!==`tool.started`&&e.sourceActivityKind!==`tool.updated`&&e.sourceActivityKind!==`tool.completed`||t.sourceActivityKind!==`tool.started`&&t.sourceActivityKind!==`tool.updated`&&t.sourceActivityKind!==`tool.completed`||e.turnId!==t.turnId||e.sourceActivityKind===`tool.completed`?!1:e[pr]!==void 0&&e[pr]===t[pr]?!0:e.toolCallId!==void 0&&t.toolCallId===void 0&&e.itemType===t.itemType&&ri(e.toolTitle??e.label)===ri(t.toolTitle??t.label)}function ei(e,t){let n=ti(e.changedFiles,t.changedFiles),r=t.detail??e.detail,i=t.command??e.command,a=t.rawCommand??e.rawCommand,o=t.toolTitle??e.toolTitle,s=t.itemType??e.itemType,c=t.requestKind??e.requestKind,l=t[pr]??e[pr],u=t.toolCallId??e.toolCallId,d=t.toolLifecycleStatus??e.toolLifecycleStatus,f=t.toolData??e.toolData,p=t.diffStats??e.diffStats,m=t.diff??e.diff,h=t.output??e.output,g=t.exitCode??e.exitCode;return{...e,...t,...p?{diffStats:p}:{},...m?{diff:m}:{},...h?{output:h}:{},...g===void 0?{}:{exitCode:g},...r?{detail:r}:{},...i?{command:i}:{},...a?{rawCommand:a}:{},...n.length>0?{changedFiles:n}:{},...o?{toolTitle:o}:{},...s?{itemType:s}:{},...c?{requestKind:c}:{},...l?{[pr]:l}:{},...u?{toolCallId:u}:{},...d===void 0?{}:{toolLifecycleStatus:d},...f===void 0?{}:{toolData:f}}}function ti(e,t){let n=[...e??[],...t??[]];return n.length===0?[]:[...new Set(n)]}function ni(e){if(e.taskId&&(e.sourceActivityKind===`task.progress`||e.sourceActivityKind===`task.completed`))return`task${e.taskId}`;if(e.sourceActivityKind!==`tool.started`&&e.sourceActivityKind!==`tool.updated`&&e.sourceActivityKind!==`tool.completed`)return;if(e.toolCallId)return`tool:${e.turnId??`no-turn`}:${e.toolCallId}`;let t=ri(e.toolTitle??e.label),n=e.detail?.trim()??``,r=e.itemType??``;if(!(t.length===0&&n.length===0&&r.length===0))return[r,t,n].join(``)}function ri(e){return e.replace(/\s+(?:complete|completed)\s*$/i,``).trim()}function ii(e){return{id:e.id,createdAt:e.createdAt,updatedAt:e.updatedAt,turnId:e.turnId,planMarkdown:e.planMarkdown,implementedAt:e.implementedAt,implementationThreadId:e.implementationThreadId}}function Y(e){return e&&typeof e==`object`?e:null}function X(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function ai(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function oi(e){let t=e.trim();if(t.startsWith(`'`)&&t.endsWith(`'`)||t.startsWith(`"`)&&t.endsWith(`"`)){let e=t.slice(1,-1).trim();return e.length>0?e:t}return t}function si(e){let t=oi(e);if(t.length===0)return null;let n=t.replace(/\\/g,`/`).split(`/`).at(-1)?.trim()??``;return n.length>0?n.toLowerCase():null}function ci(e){let t=e.trim();if(t.length===0)return null;if(t.startsWith(`"`)||t.startsWith(`'`)){let e=t.charAt(0),n=t.indexOf(e,1);return n<=0?null:{executable:t.slice(0,n+1),rest:t.slice(n+1).trim()}}let n=t.search(/\s/);return n<0?{executable:t,rest:``}:{executable:t.slice(0,n),rest:t.slice(n).trim()}}var li=[{executables:[`pwsh`,`pwsh.exe`,`powershell`,`powershell.exe`],wrapperFlagPattern:/(?:^|\s)-command\s+/i},{executables:[`cmd`,`cmd.exe`],wrapperFlagPattern:/(?:^|\s)\/c\s+/i},{executables:[`bash`,`sh`,`zsh`],wrapperFlagPattern:/(?:^|\s)-(?:l)?c\s+/i}];function ui(e){return li.find(t=>t.executables.includes(e))}function di(e,t){let n=t.exec(e);if(!n)return null;let r=e.slice(n.index+n[0].length).trim();if(r.length===0)return null;let i=oi(r);return i.length>0?i:null}function fi(e){let t=ci(e);if(!t||t.rest.length===0)return e;let n=si(t.executable);if(!n)return e;let r=ui(n);return r?di(t.rest,r.wrapperFlagPattern)??e:e}function pi(e){return/[\s"'`]/.test(e)?`"${e.replace(/"/g,`\\"`)}"`:e}function mi(e){let t=X(e);if(t)return t;if(!Array.isArray(e))return null;let n=[];for(let t of e){let e=X(t);e!==null&&n.push(e)}return n.length===0?null:n.map(e=>pi(e)).join(` `)}function hi(e){let t=mi(e);return t?fi(t):null}function gi(e,t){let n=mi(e);return!n||t===null||n===t?null:n}function _i(e){let t=Y(e?.data),n=Y(t?.item),r=Y(n?.result),i=Y(n?.input),a=X(e?.itemType),o=X(e?.detail),s=[n?.command,i?.command,r?.command,t?.command,a===`command_execution`&&o?ki(o).output:null];for(let e of s){let t=hi(e);if(t)return{command:t,rawCommand:gi(e,t)}}return{command:null,rawCommand:null}}function vi(e){return X(e?.title)}function yi(e){let t=Y(e?.data);return X(e?.toolCallId)??X(t?.toolCallId)}function bi(e){return e.replace(/\s+/g,` `).trim()}function xi(e,t=84){return e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`}function Si(e){let t=X(e);return t?ri(bi(t)).toLowerCase():null}function Ci(e){let t=[];for(let n of e.split(/\r?\n/u)){let e=bi(n);e.length>0&&t.push(e)}let n=t.find(e=>e!=="```");return n?xi(n):t.length>1?`${t.length.toLocaleString()} lines`:null}function wi(e){let t=Y(Y(e?.data)?.rawOutput);if(!t)return null;let n=ai(t.totalFiles);if(n!==null){let e=t.truncated===!0?`+`:``;return`${n.toLocaleString()} file${n===1?``:`s`}${e}`}let r=X(t.content);if(r)return Ci(r);let i=X(t.stdout);return i?Ci(i):null}function Ti(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){let e=Y(n);if(e?.type!==`content`)continue;let r=Y(e.content);if(r?.type!==`text`)continue;let i=X(r.text);i&&t.push(i)}return t.length>0?t.join(`
4
- `):null}function Ei(e){let t=Y(e?.data),n=Y(t?.item),r=Y(n?.result),i=Y(t?.rawOutput),a=[],o=X(i?.stdout),s=X(i?.stderr);o&&a.push(o),s&&a.push(s);let c=[n?.aggregatedOutput,r?.content,t?.rawOutput,i?.content,a.length>0?a.join(`
5
- `):null,i?.output,Ti(t?.content)];for(let e of c){let t=X(e);if(!t)continue;let n=ki(t).output;if(n)return n}return null}function Di(e,t){let n=X(Y(e?.data)?.kind)?.toLowerCase(),r=X(e?.title??t)?.toLowerCase();return Ai(e)===`command_execution`||n===`execute`||r===`terminal`||r===`ran command`}function Oi(e,t){let n=X(e?.detail),r=n?ki(n).output:null,i=Si(t),a=Si(r),o=Di(e,t),s=o?_i(e):{command:null,rawCommand:null},c=s.command,l=Si(c),u=Si(s.rawCommand);if(r&&i!==a&&(!o||l!==a&&u!==a))return r;if(o){if(!c)return null;let t=Ei(e),n=Si(t);return t&&n!==i&&n!==l?t:null}let d=wi(e);return d&&Si(d)!==i?d:null}function ki(e){let t=e.trim(),n=/^(?<output>[\s\S]*?)(?:\s*<exited with exit code (?<code>\d+)>)\s*$/i.exec(t);if(!n?.groups)return{output:t.length>0?t:null};let r=Number.parseInt(n.groups.code??``,10),i=n.groups.output?.trim()??``;return{output:i.length>0?i:null,...Number.isInteger(r)?{exitCode:r}:{}}}function Ai(e){if(typeof e?.itemType==`string`&&i(e.itemType))return e.itemType}function ji(e){return e?.requestKind===`command`||e?.requestKind===`file-read`||e?.requestKind===`file-change`?e.requestKind:Or(e?.requestType)??void 0}function Mi(e,t,n){let r=X(n);!r||t.has(r)||(t.add(r),e.push(r))}function Ni(e,t,n,r){if(r>4||t.length>=12)return;if(Array.isArray(e)){for(let i of e)if(Ni(i,t,n,r+1),t.length>=12)return;return}let i=Y(e);if(i){Mi(t,n,i.path),Mi(t,n,i.filePath),Mi(t,n,i.relativePath),Mi(t,n,i.filename),Mi(t,n,i.newPath),Mi(t,n,i.oldPath);for(let e of[`item`,`result`,`input`,`data`,`changes`,`files`,`edits`,`patch`,`patches`,`operations`])if(e in i&&(Ni(i[e],t,n,r+1),t.length>=12))return}}function Pi(e){let t=[],n=new Set;return Ni(Y(e?.data),t,n,0),t}function Fi(e,t){if(e.sequence!==void 0&&t.sequence!==void 0){if(e.sequence!==t.sequence)return e.sequence-t.sequence}else if(e.sequence!==void 0)return 1;else if(t.sequence!==void 0)return-1;let n=e.createdAt.localeCompare(t.createdAt);if(n!==0)return n;let r=Ii(e.kind)-Ii(t.kind);return r===0?e.id.localeCompare(t.id):r}function Ii(e){return e.endsWith(`.started`)||e===`tool.started`?0:e.endsWith(`.progress`)||e.endsWith(`.updated`)?1:e.endsWith(`.completed`)||e.endsWith(`.resolved`)?2:1}function Li(e,t,n,r=[],i=[]){let a=e.map(e=>({id:e.id,kind:`message`,createdAt:e.createdAt,message:e})),o=t.map(e=>({id:e.id,kind:`proposed-plan`,createdAt:e.createdAt,proposedPlan:e})),s=n.map(e=>({id:e.id,kind:`work`,createdAt:e.createdAt,entry:e})),c=r.map(e=>({id:`app-connection:${e.requestId}`,kind:`app-connection`,createdAt:e.createdAt,request:e})),l=i.map(e=>({id:e.id,kind:`html-render`,createdAt:e.createdAt,turnId:e.turnId,htmlRender:e.htmlRender}));return[...a,...o,...s,...c,...l].toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt))}function Ri(e){let t=[...e].toSorted((e,t)=>e.completedAt.localeCompare(t.completedAt)),n={};for(let e=0;e<t.length;e+=1){let r=t[e];r&&(n[r.turnId]=e+1)}return n}function zi(e){return!e||e.status===`stopped`||e.status===`interrupted`||e.status===`error`?`disconnected`:e.status===`starting`?`connecting`:e.status===`running`?`running`:`ready`}function Bi(e){let t=(0,U.c)(6),n;bb0:{if(!e){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],n=e;break bb0}n=e.checkpoints}let r=n,i;t[1]===r?i=t[2]:(i=Ri(r),t[1]=r,t[2]=i);let a=i,o;return t[3]!==a||t[4]!==r?(o={turnDiffSummaries:r,inferredCheckpointTurnCountByTurnId:a},t[3]=a,t[4]=r,t[5]=o):o=t[5],o}var Vi=1e3;function Hi(e){e.current&&dt.add({data:{tooltipStyle:!0},positionerProps:{anchor:e.current},timeout:Vi,title:`Copied!`})}function Ui(e,t){e.current&&dt.add({data:{tooltipStyle:!0},positionerProps:{anchor:e.current},timeout:Vi,title:`Failed to copy`,description:t.message})}var Wi=L.createContext(void 0),Gi=L.createContext(void 0),Ki=L.createContext(void 0),qi=L.createContext(``);function Ji(){let e=L.useContext(Wi);if(!e)throw Error(ce(22));return e}function Yi(){let e=L.useContext(Gi);if(!e)throw Error(ce(23));return e}function Xi(){let e=L.useContext(Ki);if(!e)throw Error(ce(24));return e}function Zi(){return L.useContext(qi)}var Qi=(e,t)=>Object.is(e,t);function $i(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function ea(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:$i(t,e,n))}function ta(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:$i(e,t,n))}function na(e,t,n){return e.filter(e=>!$i(t,e,n))}function ra(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var Z=_();function ia(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function aa(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(ia(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Q(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return ra(e)}function oa(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?ra(e.value):ra(e)}function sa(e,t,n){function r(){return Q(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=ia(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function ca(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Z.jsx)(L.Fragment,{children:sa(r,t,n)},i)),e),[])}var $={id:N(e=>e.id),labelId:N(e=>e.labelId),items:N(e=>e.items),selectedValue:N(e=>e.selectedValue),hasSelectionChips:N(e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0}),hasSelectedValue:N(e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0}),hasNullItemLabel:N((e,t)=>t?aa(e.items):!1),open:N(e=>e.open),mounted:N(e=>e.mounted),forceMounted:N(e=>e.forceMounted),inline:N(e=>e.inline),activeIndex:N(e=>e.activeIndex),selectedIndex:N(e=>e.selectedIndex),isActive:N((e,t)=>e.activeIndex===t),isSelected:N((e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>$i(t,e,n)):$i(t,r,n)}),transitionStatus:N(e=>e.transitionStatus),popupProps:N(e=>e.popupProps),inputProps:N(e=>e.inputProps),triggerProps:N(e=>e.triggerProps),itemProps:N(e=>e.itemProps),positionerElement:N(e=>e.positionerElement),listElement:N(e=>e.listElement),triggerElement:N(e=>e.triggerElement),inputElement:N(e=>e.inputElement),inputGroupElement:N(e=>e.inputGroupElement),popupSide:N(e=>e.popupSide),openMethod:N(e=>e.openMethod),inputInsidePopup:N(e=>e.inputInsidePopup),inputOwnsFormValue:N(e=>e.inputOwnsFormValue),selectionMode:N(e=>e.selectionMode),name:N(e=>e.name),form:N(e=>e.form),disabled:N(e=>e.disabled),readOnly:N(e=>e.readOnly),required:N(e=>e.required),grid:N(e=>e.grid),virtualized:N(e=>e.virtualized),itemToStringLabel:N(e=>e.itemToStringLabel),isItemEqualToValue:N(e=>e.isItemEqualToValue),modal:N(e=>e.modal),autoHighlight:N(e=>e.autoHighlight),submitOnItemClick:N(e=>e.submitOnItemClick)};function la(e,t){return(n,r)=>{if(n==null)return!1;let i=Q(n,t);return e.contains(i,r)}}function ua(e,t,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;let a=Q(r,t),o=n==null?``:Q(n,t);return o&&e.contains(o,i)&&o.length===i.length?!0:e.contains(a,i)}}var da=new Map;function fa(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${pa(e.locale)}|${JSON.stringify(t)}`,r=da.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=Q(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=Q(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=Q(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return da.set(n,a),a}function pa(e){return Array.isArray(e)?e.map(e=>pa(e)).join(`,`):e==null?``:String(e)}var ma=fa;function ha(e={}){let{multiple:t=!1,value:n,...r}=e,i=fa(r),a=L.useCallback((e,r,a)=>t?la(i,a)(e,r):ua(i,a,n)(e,r),[i,n,t]);return L.useMemo(()=>({contains:a,startsWith:i.startsWith,endsWith:i.endsWith}),[a,i])}var ga=Symbol(`none`),_a={value:ga,index:-1};function va(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:o,inputValue:s,open:c,defaultOpen:l=!1,selectionMode:u=`none`,onItemHighlighted:d,name:f,form:p,disabled:h=!1,readOnly:_=!1,required:b=!1,inputRef:x,grid:re=!1,items:A,filteredItems:ie,filter:oe,openOnInputClick:ce=!0,autoHighlight:le=!1,keepHighlight:ue=!1,highlightItemOnHover:fe=!0,loopFocus:he=!0,itemToStringLabel:j,itemToStringValue:ge,isItemEqualToValue:M=Qi,virtualized:_e=!1,inline:ve=!1,fillInputOnItemPress:ye=!0,modal:xe=!1,limit:N=-1,autoComplete:Te=`list`,formAutoComplete:Oe,locale:Ae,submitOnItemClick:je=!1}=e,{clearErrors:Me}=nt(),{setDirty:Ne,validityData:Pe,shouldValidateOnChange:Fe,setFilled:Ie,name:Le,disabled:Re,setTouched:ze,setFocused:Ve,validationMode:We,validation:Ge}=pe(),Ke=ke(),qe=Ue({id:t}),Je=ma({locale:Ae}),[Ze,Qe]=L.useState(!1),[$e,F]=L.useState(null),et=L.useRef([]),it=L.useRef([]),at=L.useRef(null),st=L.useRef(null),ct=L.useRef(null),lt=L.useRef(null),ut=L.useRef(null),dt=L.useRef(!0),ft=L.useRef(!1),pt=L.useRef(null),mt=L.useRef(null),ht=L.useRef(null),gt=L.useRef(_a),_t=L.useRef(null),vt=L.useRef([]),yt=L.useRef([]),bt=Re||h,xt=Le??f,I=u===`multiple`,St=u===`single`,Ct=s!==void 0||o!==void 0,wt=A!==void 0,Tt=ie!==void 0,R;R=le===`always`?`always`:le?`input-change`:!1;let[z,Et]=tt({controlled:i,default:I?r??Ye:r,name:`Combobox`,state:`selectedValue`}),Dt=L.useMemo(()=>oe===null?()=>!0:oe===void 0?St&&!Ze?ua(Je,j,z):la(Je,j):oe,[oe,St,z,Ze,Je,j]),Ot=we(()=>Ct?o??``:St?Q(z,j):``).current,[B,kt]=tt({controlled:s,default:Ot,name:`Combobox`,state:`inputValue`}),[V,At]=tt({controlled:c,default:l,name:`Combobox`,state:`open`}),jt=ia(A),H=$e??(B===``?``:String(B).trim()),Mt=St?Q(z,j):``,Nt=St&&!Ze&&H!==``&&Mt!==``&&Mt.length===H.length&&Je.contains(Mt,H),Pt=Nt?``:H,Ft=wt&&Tt&&Nt,It=L.useMemo(()=>A?jt?A.flatMap(e=>e.items):A:Ye,[A,jt]),Lt=L.useMemo(()=>{if(ie&&!Ft)return ie;if(!A)return Ye;if(jt){let e=A,t=[],n=0;for(let r of e){if(N>-1&&n>=N)break;let e=Pt===``?r.items:r.items.filter(e=>Dt(e,Pt,j));if(e.length===0)continue;let i=N>-1?N-n:1/0,a=e.slice(0,i);if(a.length>0){let e={...r,items:a};t.push(e),n+=a.length}}return t}if(Pt===``)return N>-1?It.slice(0,N):It;let e=[];for(let t of It){if(N>-1&&e.length>=N)break;Dt(t,Pt,j)&&e.push(t)}return e},[ie,Ft,A,jt,Pt,N,Dt,j,It]),U=L.useMemo(()=>jt?Lt.flatMap(e=>e.items):Lt,[Lt,jt]),W=we(()=>new te({id:qe,labelId:void 0,selectedValue:z,open:V,filter:Dt,query:H,items:A,selectionMode:u,listRef:et,labelsRef:it,popupRef:at,emptyRef:ut,inputRef:st,startDismissRef:ct,endDismissRef:lt,keyboardActiveRef:dt,chipsContainerRef:pt,clearRef:mt,valuesRef:vt,allValuesRef:yt,selectionEventRef:ht,name:xt,form:p,disabled:bt,readOnly:_,required:b,grid:re,isGrouped:jt,virtualized:_e,openOnInputClick:ce,itemToStringLabel:j,isItemEqualToValue:M,modal:xe,autoHighlight:R,submitOnItemClick:je,hasInputValue:Ct,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:ve,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},itemProps:ne,positionerElement:null,listElement:null,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:u===`none`,onOpenChangeComplete:n||Ce,setOpen:Ce,setInputValue:Ce,setSelectedValue:Ce,setIndices:Ce,onItemHighlighted:Ce,handleSelection:Ce,forceMount:Ce,requestSubmit:Ce})).current,G=u===`none`?B:z,Rt=L.useMemo(()=>u===`none`?G:Array.isArray(z)?z.map(e=>oa(e,ge)):oa(z,ge),[G,ge,u,z]),zt=P(d),Bt=P(n),Vt=k(W,$.activeIndex),Ht=k(W,$.selectedIndex),Ut=k(W,$.positionerElement),Wt=k(W,$.listElement),K=k(W,$.triggerElement),q=k(W,$.inputElement),Gt=k(W,$.inputGroupElement),J=k(W,$.inline),Kt=k(W,$.inputInsidePopup),qt=k(W,$.inputOwnsFormValue),Jt=C(K),{mounted:Yt,setMounted:Xt,transitionStatus:Zt}=T(V),{openMethod:Qt,triggerProps:$t}=D(V),en=P(()=>Rt);ot(Kt?Jt:st,qe,G,en);let tn=P(()=>{A?it.current=U.map(e=>Q(e,j)):W.set(`forceMounted`,!0)}),nn=L.useRef(z);Be(()=>{z!==nn.current&&tn()},[tn,z]);let rn=P(e=>{W.update(e);let t=e.type||`none`;if(e.activeIndex!==void 0)if(e.activeIndex===null)gt.current!==_a&&(gt.current=_a,zt(void 0,Xe(t,void 0,{index:-1})));else{let n=vt.current[e.activeIndex];gt.current={value:n,index:e.activeIndex},zt(n,Xe(t,void 0,{index:e.activeIndex}))}}),an=P((t,n)=>{if(ft.current=n.reason===v,e.onInputValueChange?.(t,n),!n.isCanceled){if(n.reason===`input-change`){let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&Qe(!0),_t.current={hasQuery:e},e&&R&&W.state.activeIndex==null&&W.set(`activeIndex`,0)}}kt(t)}}),on=P((t,n)=>{if(V!==t&&(n.reason===`escape-key`&&wt&&U.length===0&&!W.state.emptyRef.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&I&&Kt&&!J&&$e!==null&&(Qe(!1),F(null),B!==``&&an(``,O(v,n.event))),!t&&Ze&&(St?(J||F(H),H===``&&Qe(!1)):I&&(J||F(H),Kt&&rn({activeIndex:null}),(!Kt||J)&&an(``,O(v,n.event)))),At(t),!t&&Kt&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(ze(!0),Ve(!1),We===`onBlur`)))){let e=u===`none`?B:z;Ge.commit(e)}}),sn=P((e,t)=>{a?.(e,t),!t.isCanceled&&(Et(e),(u===`none`&&at.current&&ye||St&&!W.state.inputInsidePopup)&&an(Q(e,j),O(t.reason,t.event)),St&&e!=null&&t.reason!==`input-change`&&Ze&&!J&&F(H))}),cn=P((e,t)=>{let n=t;if(n===void 0){if(Vt===null)return;n=vt.current[Vt]}let r=se(e),i=ht.current??e;ht.current=null;let a=O(S,i),o=r?.closest(`a`)?.getAttribute(`href`);if(o){o.startsWith(`#`)&&on(!1,a);return}if(I){let e=Array.isArray(z)?z:[],t=ea(e,n,W.state.isItemEqualToValue)?na(e,n,W.state.isItemEqualToValue):[...e,n];if(sn(t,a),!(st.current&&st.current.value.trim()!==``))return;W.state.inputInsidePopup?an(``,O(v,a.event)):on(!1,a)}else sn(n,a),on(!1,a)}),ln=P(()=>{if(!W.state.submitOnItemClick)return;let e=Ge.inputRef.current?.form??W.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),un=P(()=>{if(Xt(!1),Bt?.(!1),Qe(!1),F(null),rn(u===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),I&&st.current&&st.current.value!==``&&!ft.current&&an(``,O(v)),St)if(W.state.inputInsidePopup)st.current&&st.current.value!==``&&an(``,O(v));else{let e=Q(z,j);st.current&&st.current.value!==e&&an(e,O(e===``?v:m))}}),dn=L.useMemo(()=>J&&Ut?{current:Ut.closest(`[role="dialog"]`)}:at,[J,Ut]);g({enabled:!e.actionsRef,open:V,ref:dn,onComplete(){V||un()}}),L.useImperativeHandle(e.actionsRef,()=>({unmount:un}),[un]),Be(function(){if(V||u===`none`)return;let e=A?It:yt.current;if(I){let t=Array.isArray(z)?z:[],n=t[t.length-1],r=ta(e,n,M);rn({selectedIndex:r===-1?null:r})}else{let t=ta(e,z,M);rn({selectedIndex:t===-1?null:t})}},[V,z,A,u,It,I,M,rn]),Be(()=>{A&&(vt.current=U,et.current.length=U.length)},[A,U]),Be(()=>{let e=_t.current;if(e&&(e.hasQuery?R&&W.set(`activeIndex`,0):R===`always`&&W.set(`activeIndex`,0),_t.current=null),!V&&!J)return;let t=wt||Tt?U:vt.current,n=W.state.activeIndex;if(n==null){if(R===`always`&&t.length>0){W.set(`activeIndex`,0);return}gt.current!==_a&&(gt.current=_a,W.state.onItemHighlighted(void 0,Xe(m,void 0,{index:-1})));return}if(n>=t.length){gt.current!==_a&&(gt.current=_a,W.state.onItemHighlighted(void 0,Xe(m,void 0,{index:-1}))),W.set(`activeIndex`,null);return}let r=t[n],i=gt.current.value,a=i!==ga&&$i(r,i,W.state.isItemEqualToValue);(gt.current.index!==n||!a)&&(gt.current={value:r,index:n},W.state.onItemHighlighted(r,Xe(m,void 0,{index:n})))},[Vt,R,Tt,wt,U,J,V,W]),Be(()=>{if(u===`none`){Ie(String(B)!==``);return}Ie(I?Array.isArray(z)&&z.length>0:z!=null)},[Ie,u,B,z,I]),L.useEffect(()=>{wt&&R&&U.length===0&&rn({activeIndex:null})},[wt,R,U.length,rn]),Se(H,()=>{!V||H===``||H===String(Ot)||Qe(!0)}),Se(z,()=>{if(u!==`none`&&(Me(xt),Ne(z!==Pe.initialValue),Fe()?Ge.commit(z):Ge.commit(z,!0),St&&!Ct&&!Kt)){let e=Q(z,j);B!==e&&an(e,O(m))}}),Se(B,()=>{u===`none`&&(Me(xt),Ne(B!==Pe.initialValue),Fe()?Ge.commit(B):Ge.commit(B,!0))}),Se(A,()=>{if(!St||Ct||Kt||Ze)return;let e=Q(z,j);B!==e&&an(e,O(m))});let fn=He({open:J?!0:V,onOpenChange:on,elements:{reference:Kt?K:q,floating:Ut}}),pn,mn;J||(pn=re?`grid`:`listbox`,mn=V?`true`:`false`);let hn=L.useMemo(()=>{let e=q?.tagName===`INPUT`,t=q==null||e,n=t||V,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=mn,r[`aria-haspopup`]=pn,r[`aria-controls`]=V?Wt?.id:void 0,r[`aria-autocomplete`]=Te),{reference:r,floating:{role:`presentation`}}},[q,V,mn,pn,Wt?.id,Te]),gn=de(fn,{enabled:!_&&!bt&&ce,event:`mousedown-only`,toggle:!1,touchOpenDelay:Kt?0:100,reason:me}),_n=De(fn,{enabled:!_&&!bt&&!J,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:J?!0:void 0,outsidePress(e){let t=se(e);return!ae(K,t)&&!ae(mt.current,t)&&!ae(pt.current,t)&&!ae(Gt,t)}}),vn=w(fn,{enabled:!_&&!bt,id:qe,listRef:et,activeIndex:Vt,selectedIndex:Ht,virtual:!0,loopFocus:he,allowEscape:he&&!R,focusItemOnOpen:Ze||u===`none`&&!R?!1:`auto`,focusItemOnHover:fe,resetOnPointerLeave:!ue,cols:re?2:1,orientation:re?`horizontal`:void 0,rtl:Ke===`rtl`,disabledIndices:Ye,onNavigate(e,t){!t&&!V||Zt===`ending`||rn(t?{activeIndex:e,type:dt.current?`keyboard`:`pointer`}:{activeIndex:e})}}),yn=L.useMemo(()=>ee(vn.reference,_n.reference,gn.reference,hn.reference),[vn.reference,_n.reference,gn.reference,hn.reference]),bn=L.useMemo(()=>ee(E,vn.floating,_n.floating,hn.floating),[vn.floating,_n.floating,hn.floating]),xn=L.useMemo(()=>{let e=vn.item;return e?{...e,onFocus:void 0}:ne},[vn.item]);Ee(()=>{W.update({inline:ve,popupProps:bn,inputProps:yn,triggerProps:$t,itemProps:xn,setOpen:on,setInputValue:an,setSelectedValue:sn,setIndices:rn,onItemHighlighted:zt,handleSelection:cn,forceMount:tn,requestSubmit:ln})}),Be(()=>{W.update({id:qe,selectedValue:z,open:V,mounted:Yt,transitionStatus:Zt,items:A,inline:ve,popupProps:bn,inputProps:yn,triggerProps:$t,openMethod:Qt,itemProps:xn,selectionMode:u,name:xt,form:p,disabled:bt,readOnly:_,required:b,grid:re,isGrouped:jt,virtualized:_e,onOpenChangeComplete:Bt,openOnInputClick:ce,itemToStringLabel:j,modal:xe,autoHighlight:R,isItemEqualToValue:M,submitOnItemClick:je,hasInputValue:Ct,requestSubmit:ln,inputOwnsFormValue:u===`none`&&(ve||!W.state.inputInsidePopup)})},[W,qe,z,V,Yt,Zt,A,bn,yn,xn,Qt,$t,u,xt,bt,_,b,Ge,re,jt,_e,Bt,ce,j,xe,M,je,Ct,ve,ln,R,p]);let Sn=be(x,Ge.inputRef),Cn=L.useMemo(()=>({query:H,hasItems:wt,filteredItems:Lt,flatFilteredItems:U}),[H,wt,Lt,U]),wn=L.useMemo(()=>Array.isArray(G)?``:oa(G,ge),[G,ge]),Tn=I&&Array.isArray(z)&&z.length>0,En=I||u===`none`&&qt?void 0:xt,Dn=L.useMemo(()=>!I||!Array.isArray(z)||!xt?null:z.map(e=>{let t=oa(e,ge);return(0,Z.jsx)(`input`,{type:`hidden`,form:p,name:xt,value:t},t)}),[I,z,p,xt,ge]),On=(0,Z.jsxs)(L.Fragment,{children:[e.children,(0,Z.jsx)(`input`,{...Ge.getInputValidationProps({onFocus(){if(Kt){K?.focus();return}(st.current||K)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||bt||_){e.preventBaseUIHandler?.();return}let t=e.currentTarget.value,n=O(m,e.nativeEvent);function r(){if(I)return;if(u===`none`){Ne(t!==Pe.initialValue),an(t,n),Fe()&&Ge.commit(t);return}let e=vt.current.find(e=>oa(e,ge).toLowerCase()===t.toLowerCase()||Q(e,j).toLowerCase()===t.toLowerCase());e!=null&&(Ne(e!==Pe.initialValue),sn?.(e,n),Fe()&&Ge.commit(e))}A?r():(tn(),queueMicrotask(r))}}),id:qe&&En==null?`${qe}-hidden-input`:void 0,form:p,name:En,autoComplete:Oe,disabled:bt,required:b&&!Tn,readOnly:_,value:wn,ref:Sn,style:En?rt:y,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Dn]});return(0,Z.jsx)(Wi.Provider,{value:W,children:(0,Z.jsx)(Gi.Provider,{value:fn,children:(0,Z.jsx)(Ki.Provider,{value:Cn,children:(0,Z.jsx)(qi.Provider,{value:B,children:On})})})})}function ya(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,Z.jsx)(va,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}function ba(e,t){return e??t}var xa={...h,...j,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":``}:null},Sa=L.createContext(void 0);function Ca(){return L.useContext(Sa)}var wa=L.createContext(void 0);function Ta(e){let t=L.useContext(wa);if(t===void 0&&!e)throw Error(ce(21));return t}var Ea=L.forwardRef(function(e,t){let n=Ji(),{buttonRef:r,getButtonProps:i}=We({native:!1}),a=be(t,r);function o(e){n.state.setOpen(!1,O(qe,e.nativeEvent,e.currentTarget))}return(0,Z.jsx)(`span`,{ref:a,...i({onClick:o}),"aria-label":`Dismiss`,tabIndex:void 0,style:rt})}),Da=L.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:o,...s}=e,{state:c,disabled:l,setTouched:u,setFocused:d,validationMode:p,validation:h}=pe(),{labelId:g}=Oe(),_=Ca(),y=!!Ta(!0),x=Ji(),{filteredItems:S}=Xi(),C=Zi(),w=ke(),ee=k(x,$.required),te=k(x,$.disabled),T=k(x,$.readOnly),E=k(x,$.name),ne=k(x,$.form),D=k(x,$.selectionMode),ie=k(x,$.autoHighlight),ae=k(x,$.inputProps),oe=k(x,$.triggerProps),se=k(x,$.open),ce=k(x,$.mounted),ue=k(x,$.selectedValue),de=k(x,$.popupSide),me=k(x,$.positionerElement),he=k(x,$.id),j=k(x,$.inline),ge=k(x,$.modal),M=!!ie,_e=ce&&me?de:null,ve=l||te||i,be=S.length===0,xe=y||j,Se=!xe||ge,Ce=re(a??(xe?void 0:he)),N=ba(g,void 0),we=y?b:c,[Te,Ee]=L.useState(null),De=L.useRef(!1),je=L.useRef(null),Me=L.useRef(!1),Ne=D===`none`&&!y,Pe=P(e=>{let t=y||x.state.inline;t&&!x.state.hasInputValue&&x.state.setInputValue(``,O(m)),x.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:Ne})}),Fe=y||!h?s:h.getValidationProps(s),Ie={...we,open:se,disabled:ve,readOnly:T,popupSide:_e,listEmpty:be};function Le(e){if(!_)return;let t,{highlightedChipIndex:n}=_,r=_.chipsRef.current.length,i=w===`rtl`,a=i?`ArrowRight`:`ArrowLeft`,o=i?`ArrowLeft`:`ArrowRight`;if(n!==void 0){if(e.key===a)e.preventDefault(),t=n>0?n-1:void 0;else if(e.key===o)e.preventDefault(),t=n<r-1?n+1:void 0;else if(e.key===`Backspace`||e.key===`Delete`){e.preventDefault();let r=n>=ue.length-1?ue.length-2:n;t=r>=0?r:void 0,x.state.setIndices({activeIndex:null,selectedIndex:null,type:`keyboard`})}return t}return e.key===a&&(e.currentTarget.selectionStart??0)===0&&ue.length>0?(e.preventDefault(),t=r>0?r-1:void 0):e.key===`Backspace`&&e.currentTarget.value===``&&ue.length>0&&(x.state.setIndices({activeIndex:null,selectedIndex:null,type:`keyboard`}),e.preventDefault()),t}let ze=ye(`input`,e,{state:Ie,ref:[t,x.state.inputRef,Pe],props:[ae,oe,{type:`text`,value:e.value??Te??C,"aria-readonly":T||void 0,"aria-required":ee||void 0,"aria-labelledby":N,disabled:ve,readOnly:T,required:D===`none`?ee:void 0,form:ne,...Ne&&E&&{name:E},id:Ce,onFocus(){if(d(!0),!j||!Me.current)return;Me.current=!1;let e=je.current;e==null||!Object.hasOwn(x.state.valuesRef.current,e)||x.state.setIndices({activeIndex:e})},onBlur(){u(!0),d(!1);let e=x.state.activeIndex;if(j&&e!==null&&ie!==`always`&&(je.current=e,Me.current=!0,x.state.setIndices({activeIndex:null})),p===`onBlur`){let e=D===`none`?C:ue;h.commit(e)}},onCompositionStart(e){le||(De.current=!0,Ee(e.currentTarget.value))},onCompositionEnd(e){De.current=!1;let t=e.currentTarget.value;Ee(null),x.state.setInputValue(t,O(fe,e.nativeEvent))},onChange(e){let t=e.nativeEvent.inputType,n=!t||t===`insertReplacementText`,r=De.current||!n;if(De.current){let t=e.currentTarget.value;Ee(t),t===``&&!x.state.openOnInputClick&&!x.state.inputInsidePopup&&x.state.setOpen(!1,O(v,e.nativeEvent));let n=t.trim(),i=M&&n!==``;!T&&!ve&&n&&r&&(x.state.setOpen(!0,O(fe,e.nativeEvent)),M||x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?`keyboard`:`pointer`})),se&&x.state.activeIndex!==null&&!i&&x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?`keyboard`:`pointer`});return}x.state.setInputValue(e.currentTarget.value,O(fe,e.nativeEvent));let i=e.currentTarget.value===``,a=O(v,e.nativeEvent);i&&!x.state.inputInsidePopup&&(D===`single`&&x.state.setSelectedValue(null,a),x.state.openOnInputClick||x.state.setOpen(!1,a));let o=e.currentTarget.value.trim();!T&&!ve&&o&&r&&(x.state.setOpen(!0,O(fe,e.nativeEvent)),M||x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?`keyboard`:`pointer`})),se&&x.state.activeIndex!==null&&!M&&x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?`keyboard`:`pointer`})},onKeyDown(e){if(ve||T||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;x.state.keyboardActiveRef.current=!0;let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=w===`rtl`;if(e.key===`Home`){A(e);let n=f&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){A(e);let i=f&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!ce&&e.key===`Escape`){let t=D===`multiple`&&Array.isArray(ue)?ue.length===0:ue===null,n=O(Re,e.nativeEvent),r=D===`multiple`?[]:null;x.state.setInputValue(``,n),x.state.setSelectedValue(r,n),!t&&!x.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(_&&e.key===`Backspace`&&t.value===``&&_.highlightedChipIndex===void 0&&Array.isArray(ue)&&ue.length>0){let t=_.chipsRef.current.length,n=t>0?t-1:ue.length-1,r=ue.filter((e,t)=>t!==n);x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?`keyboard`:`pointer`}),x.state.setSelectedValue(r,O(m,e.nativeEvent));return}let i=_?.highlightedChipIndex!==void 0,a=Le(e);if(_?.setHighlightedChipIndex(a),a===void 0?i&&x.state.inputRef.current?.focus():_?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&se){let t=x.state.activeIndex,n=e.nativeEvent;if(t===null){if(j)return;x.state.setOpen(!1,O(m,n));return}A(e);let r=x.state.listRef.current[t];r&&(x.state.selectionEventRef.current=n,r.click(),x.state.selectionEventRef.current=null)}},onPointerMove(){x.state.keyboardActiveRef.current=!1},onPointerDown(){x.state.keyboardActiveRef.current=!1}},Fe],stateAttributesMapping:xa}),Be=y?(0,Z.jsx)(at.Provider,{value:Ae,children:ze}):ze;return(0,Z.jsxs)(L.Fragment,{children:[se&&Se&&(0,Z.jsx)(Ea,{ref:x.state.startDismissRef}),Be]})}),Oa=2,ka=L.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:o,style:s,...c}=e,{state:l,disabled:u,setTouched:d,setFocused:f,validationMode:p,validation:m}=pe(),{labelId:h}=Oe(),g=Ji(),{filteredItems:_}=Xi(),v=k(g,$.selectionMode),y=k(g,$.disabled),b=k(g,$.readOnly),x=k(g,$.required),S=k(g,$.mounted),C=k(g,$.popupSide),w=k(g,$.positionerElement),ee=k(g,$.listElement),te=k(g,$.triggerProps),T=k(g,$.triggerElement),E=k(g,$.inputInsidePopup),ne=k(g,$.id),re=k(g,$.labelId),D=k(g,$.open),ie=k(g,$.selectedValue),ce=k(g,$.activeIndex),le=k(g,$.selectedIndex),ue=k(g,$.hasSelectedValue),fe=Yi(),me=Zi(),j=ct(),M=u||y||a,_e=_.length===0,ve=S&&w?C:null;Ue({id:E?o:void 0});let be=E?o??ne:o,xe=ba(h,re),Se=L.useRef(``);function Ce(e){Se.current=e.pointerType}let N=fe.useState(`domReferenceElement`);L.useEffect(()=>{E&&T&&T!==N&&fe.set(`domReferenceElement`,T)},[T,N,fe,E]);let{reference:we}=ge(fe,{enabled:!D&&!b&&!y&&v===`single`,listRef:g.state.labelsRef,activeIndex:ce,selectedIndex:le,onMatch(e){let t=g.state.valuesRef.current[e];t!==void 0&&g.state.setSelectedValue(t,O(`none`))}}),{reference:Te}=de(fe,{enabled:!b&&!y,event:`mousedown`}),{buttonRef:Ee,getButtonProps:De}=We({native:i,disabled:M}),ke={...l,open:D,disabled:M,popupSide:ve,listEmpty:_e,placeholder:v===`none`?!1:!ue};return ye(`button`,e,{ref:[t,Ee,P(e=>{g.set(`triggerElement`,e)})],state:ke,props:[te,Te,we,{id:be,tabIndex:E?0:-1,role:E?`combobox`:void 0,"aria-expanded":D?`true`:`false`,"aria-haspopup":E?`dialog`:`listbox`,"aria-controls":D?ee?.id:void 0,"aria-required":E&&x||void 0,"aria-labelledby":xe,onPointerDown:Ce,onPointerEnter:Ce,onFocus(){f(!0),!(M||b)&&j.start(0,g.state.forceMount)},onBlur(e){if(!ae(w,e.relatedTarget)&&(d(!0),f(!1),p===`onBlur`)){let e=v===`none`?me:ie;m.commit(e)}},onMouseDown(e){if(M||b||(E||fe.set(`domReferenceElement`,e.currentTarget),g.state.forceMount(),Se.current!==`touch`&&(g.state.inputRef.current?.focus(),E||e.preventDefault()),D))return;let t=he(e.currentTarget);function n(e){if(!T)return;let t=se(e),n=g.state.positionerElement,r=g.state.listElement;if(ae(T,t)||ae(n,t)||ae(r,t)||t===T)return;let i=Ze(T),a=e.clientX>=i.left-Oa&&e.clientX<=i.right+Oa,o=e.clientY>=i.top-Oa&&e.clientY<=i.bottom+Oa;a&&o||g.state.setOpen(!1,O(`cancel-open`,e))}E&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){M||b||(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(A(e),g.state.setOpen(!0,O(oe,e.nativeEvent)),g.state.inputRef.current?.focus())}},m?m.getValidationProps(c):c,De],stateAttributesMapping:xa})}),Aa=L.createContext(null);function ja(){return L.useContext(Aa)}function Ma(e){let{children:t,items:n}=e,r=L.useMemo(()=>({items:n}),[n]);return(0,Z.jsx)(Aa.Provider,{value:r,children:t})}function Na(e){let{children:t}=e,{filteredItems:n}=Xi(),r=ja(),i=r?r.items:n;return i?(0,Z.jsx)(L.Fragment,{children:i.map(t)}):null}var Pa=L.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=Ji(),l=Yi(),u=!!Ta(!0),{filteredItems:d,hasItems:f}=Xi(),p=k(c,$.selectionMode),m=k(c,$.grid),h=k(c,$.popupProps),g=k(c,$.virtualized),_=p===`multiple`,v=d.length===0,y=P(e=>{c.set(`positionerElement`,e)}),b=P(e=>{c.set(`listElement`,e)}),x=L.useMemo(()=>typeof o==`function`?n||=(0,Z.jsx)(Na,{children:o}):o,[o]),S={empty:v},C=l.useState(`floatingId`),w=ye(`div`,e,{state:S,ref:[t,b,u?null:y],props:[h,{children:x,tabIndex:-1,id:C,role:m?`grid`:`listbox`,"aria-multiselectable":_?`true`:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;A(e);let n=e.nativeEvent,r=c.state.listRef.current[t];r&&(c.state.selectionEventRef.current=n,r.click(),c.state.selectionEventRef.current=null)}},onKeyDownCapture(){c.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.state.keyboardActiveRef.current=!1}},s]});return g?w:(0,Z.jsx)(Ge,{elementsRef:c.state.listRef,labelsRef:f?void 0:c.state.labelsRef,children:w})}),Fa=`⁠`;function Ia(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function La(){let e=ct(),t=L.useRef(null);return L.useEffect(()=>{if(Pe)return;let n=t.current;if(n==null)return;let r=Ia(n);if(r==null)return;let i=r.nodeValue??``,a=`${i}${Fa}`;return r.nodeValue=a,e.start(200,()=>{r.nodeValue===a&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===a&&(r.nodeValue=i)}},[t,e]),t}var Ra=L.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e;return ye(`div`,e,{ref:[t,La()],props:[{children:a,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})}),za=L.createContext(void 0);function Ba(){let e=L.useContext(za);if(e===void 0)throw Error(ce(20));return e}var Va=L.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Ji(),a=k(i,$.mounted),o=k(i,$.forceMounted);return a||n||o?(0,Z.jsx)(za.Provider,{value:n,children:(0,Z.jsx)(Ve,{ref:t,...r})}):null}),Ha=L.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=je,style:g,..._}=e,v=Ji(),{filteredItems:y}=Xi(),b=Yi(),x=Ba(),S=k(v,$.modal),C=k(v,$.open),w=k(v,$.mounted),ee=k(v,$.openMethod),te=k(v,$.positionerElement),T=k(v,$.triggerElement),E=k(v,$.inputElement),ne=k(v,$.inputGroupElement),re=k(v,$.inputInsidePopup),D=k(v,$.transitionStatus),O=y.length===0,A=Qe({anchor:i??(re?T:ne??E),floatingRootContext:b,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:x,collisionAvoidance:h,lazyFlip:!0});ue(C&&S,ee===`touch`,te,T);let ie={open:C,side:A.side,align:A.align,anchorHidden:A.anchorHidden,empty:O};Be(()=>{v.set(`popupSide`,A.side)},[v,A.side]);let ae=P(e=>{v.set(`positionerElement`,e)}),oe=Fe(e,ie,{styles:A.positionerStyles,transitionStatus:D,props:_,refs:[t,ae],hidden:!w,inert:!C});return(0,Z.jsxs)(wa.Provider,{value:A,children:[w&&S&&(0,Z.jsx)(et,{inert:Ke(!C),cutout:ne??E??T}),oe]})}),Ua={...st,...M},Wa=L.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=Ji(),l=Ta(),u=Yi(),{filteredItems:d}=Xi(),f=k(c,$.mounted),m=k(c,$.open),h=k(c,$.openMethod),_=k(c,$.transitionStatus),v=k(c,$.inputInsidePopup),y=k(c,$.inputElement),b=k(c,$.modal),x=d.length===0;g({open:m,ref:c.state.popupRef,onComplete(){m&&c.state.onOpenChangeComplete(!0)}});let S=ye(`div`,e,{state:{open:m,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:_,empty:x},ref:[t,c.state.popupRef],props:[{role:v?`dialog`:`presentation`,tabIndex:-1,onFocus(e){let t=se(e.nativeEvent);h!==`touch`&&(ae(c.state.listElement,t)||t===e.currentTarget)&&c.state.inputRef.current?.focus()}},$e(_),s],stateAttributesMapping:Ua}),C=a===void 0?v?e=>e===`touch`?c.state.popupRef.current:y:!1:a,w;w=o??(v?void 0:!1);let ee=!v||b;return(0,Z.jsx)(p,{context:u,disabled:!f,modal:ee,openInteractionType:h,initialFocus:C,returnFocus:w,getInsideElements:()=>[c.state.startDismissRef.current,c.state.endDismissRef.current],children:(0,Z.jsxs)(L.Fragment,{children:[S,ee&&(0,Z.jsx)(Ea,{ref:c.state.endDismissRef})]})})}),Ga=L.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return ye(`span`,e,{ref:t,props:[{"aria-hidden":!0,children:`▼`},a]})}),Ka=e(ie()),qa=L.createContext(void 0),Ja=L.createContext(!1);function Ya(){return L.useContext(Ja)}var Xa=L.memo(L.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,index:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=L.useRef(!1),d=L.useRef(null),f=Te({index:o,textRef:d,indexGuessBehavior:xe.GuessFromOrder}),p=Ji(),m=Ya(),{flatFilteredItems:h,hasItems:g}=Xi(),_=k(p,$.open),v=k(p,$.selectionMode),y=k(p,$.readOnly),b=k(p,$.virtualized),x=k(p,$.isItemEqualToValue),S=v!==`none`,C=o??(b?ta(h,a,x):f.index),w=f.index!==-1,ee=k(p,$.id),te=k(p,$.isActive,C),T=k(p,$.isSelected,a),E=k(p,$.itemProps),ne=L.useRef(null),re=ee!=null&&w?`${ee}-${C}`:void 0,D=T&&S;Be(()=>{if(!(w&&(b||o!=null)))return;let e=p.state.listRef.current;return e[C]=ne.current,()=>{delete e[C]}},[w,b,C,o,p]),Be(()=>{if(!w||g)return;let e=p.state.valuesRef.current;return e[C]=a,v!==`none`&&p.state.allValuesRef.current.push(a),()=>{delete e[C]}},[w,g,C,a,p,v]),Be(()=>{if(!_){u.current=!1;return}if(!w||g)return;let e=p.state.selectedValue,t=Array.isArray(e)?e[e.length-1]:e;$i(a,t,x)&&p.set(`selectedIndex`,C)},[w,g,_,p,C,a,x]);let{getButtonProps:O,buttonRef:A}=We({disabled:s,focusableWhenDisabled:!0,native:c,composite:!0}),ie={disabled:s,selected:D,highlighted:te};function ae(e){function t(){p.state.handleSelection(e,a)}p.state.submitOnItemClick?(Ka.flushSync(t),p.state.requestSubmit()):t()}let oe={id:re,role:m?`gridcell`:`option`,"aria-selected":S?D:void 0,tabIndex:void 0,onPointerDownCapture(e){u.current=!0,e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){s||y||ae(e.nativeEvent)},onMouseUp(e){let t=u.current;u.current=!1,!(s||y||e.button!==0||t||!te)&&ae(e.nativeEvent)}},se=ye(`div`,e,{ref:[A,t,f.ref,ne],state:ie,props:[E,oe,l,O]}),ce=L.useMemo(()=>({selected:D,textRef:d}),[D,d]);return(0,Z.jsx)(qa.Provider,{value:ce,children:se})})),Za=L.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=Xi(),c=Ji(),l=La(),u=s.length===0?a:null;return ye(`div`,e,{ref:[t,c.state.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})}),Qa={...M,...ve},$a=L.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,keepMounted:o=!1,style:s,...c}=e,{disabled:l}=pe(),u=Ji(),d=k(u,$.selectionMode),f=k(u,$.disabled),p=k(u,$.readOnly),m=k(u,$.open),h=k(u,$.selectedValue),_=k(u,$.hasSelectionChips),v=Zi(),y=!1;y=d===`none`?v!==``:d===`single`?h!=null:_;let b=l||f||i,{buttonRef:x,getButtonProps:S}=We({native:a,disabled:b}),{mounted:C,transitionStatus:w,setMounted:ee}=T(y),te={disabled:b,visible:y,open:m,transitionStatus:w};g({open:y,ref:u.state.clearRef,onComplete(){y||ee(!1)}});let E=ye(`button`,e,{state:te,ref:[t,x,u.state.clearRef],props:[{tabIndex:-1,children:`x`,onMouseDown(e){e.preventDefault()},onClick(e){if(b||p)return;let t=u.state.keyboardActiveRef;u.state.setInputValue(``,O(Ie,e.nativeEvent)),d===`none`?u.state.setIndices({activeIndex:null,type:t.current?`keyboard`:`pointer`}):(u.state.setSelectedValue(Array.isArray(h)?[]:null,O(Ie,e.nativeEvent)),u.state.setIndices({activeIndex:null,selectedIndex:null,type:t.current?`keyboard`:`pointer`})),u.state.inputRef.current?.focus()}},c,S],stateAttributesMapping:Qa});return o||C?E:null}),eo=L.createContext({chipsRef:null,multiple:!1});function to(e){let t=(0,U.c)(7),n=L.useRef(null),r=!!e.multiple,i;t[0]===r?i=t[1]:(i={chipsRef:n,multiple:r},t[0]=r,t[1]=i);let a=i,o;t[2]===e?o=t[3]:(o=(0,Z.jsx)(ya,{...e}),t[2]=e,t[3]=o);let s;return t[4]!==o||t[5]!==a?(s=(0,Z.jsx)(eo,{value:a,children:o}),t[4]=o,t[5]=a,t[6]=s):s=t[6],s}function no(e){let t=(0,U.c)(36),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:n,inputClassName:r,showTrigger:s,showClear:c,startAddon:o,size:a,unstyled:l,...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,t[8]=l);let u=s===void 0?!0:s,d=c===void 0?!1:c,f=l===void 0?!1:l,p=a??`default`,m;t[9]===o?m=t[10]:(m=o&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`[&_svg]:-mx-0.5 pointer-events-none absolute inset-y-0 start-px z-10 flex items-center ps-[calc(--spacing(3)-1px)] opacity-80 has-[+[data-size=sm]]:ps-[calc(--spacing(2.5)-1px)] [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4`,"data-slot":`combobox-start-addon`,children:o}),t[9]=o,t[10]=m);let h=o&&`data-[size=sm]:*:data-[slot=combobox-input]:ps-[calc(--spacing(7.5)-1px)] *:data-[slot=combobox-input]:ps-[calc(--spacing(8.5)-1px)] sm:data-[size=sm]:*:data-[slot=combobox-input]:ps-[calc(--spacing(7)-1px)] sm:*:data-[slot=combobox-input]:ps-[calc(--spacing(8)-1px)]`,g=p===`sm`?`has-[+[data-slot=combobox-trigger],+[data-slot=combobox-clear]]:*:data-[slot=combobox-input]:pe-6.5`:`has-[+[data-slot=combobox-trigger],+[data-slot=combobox-clear]]:*:data-[slot=combobox-input]:pe-7`,_;t[11]!==n||t[12]!==h||t[13]!==g?(_=F(h,g,n),t[11]=n,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]===r?v=t[16]:(v=F(`has-disabled:opacity-100`,r),t[15]=r,t[16]=v);let y;t[17]!==p||t[18]!==v||t[19]!==f?(y=(0,Z.jsx)(I,{className:v,nativeInput:!0,size:p,unstyled:f}),t[17]=p,t[18]=v,t[19]=f,t[20]=y):y=t[20];let b;t[21]!==i||t[22]!==_||t[23]!==y?(b=(0,Z.jsx)(Da,{className:_,"data-slot":`combobox-input`,render:y,...i}),t[21]=i,t[22]=_,t[23]=y,t[24]=b):b=t[24];let x;t[25]!==u||t[26]!==p?(x=u&&(0,Z.jsx)(ro,{className:F(`-translate-y-1/2 absolute top-1/2 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-opacity pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 has-[+[data-slot=combobox-clear]]:hidden sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,p===`sm`?`end-0`:`end-0.5`),children:(0,Z.jsx)(Ga,{"data-slot":`combobox-icon`,children:(0,Z.jsx)(_t,{})})}),t[25]=u,t[26]=p,t[27]=x):x=t[27];let S;t[28]!==d||t[29]!==p?(S=d&&(0,Z.jsx)(uo,{className:F(`-translate-y-1/2 absolute top-1/2 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-opacity pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 has-[+[data-slot=combobox-clear]]:hidden sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,p===`sm`?`end-0`:`end-0.5`),children:(0,Z.jsx)(pt,{})}),t[28]=d,t[29]=p,t[30]=S):S=t[30];let C;return t[31]!==b||t[32]!==x||t[33]!==S||t[34]!==m?(C=(0,Z.jsxs)(`div`,{className:`relative not-has-[>*.w-full]:w-fit w-full text-foreground has-disabled:opacity-64`,children:[m,b,x,S]}),t[31]=b,t[32]=x,t[33]=S,t[34]=m,t[35]=C):C=t[35],C}function ro(e){let t=(0,U.c)(8),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;return t[4]!==n||t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(ka,{className:r,"data-slot":`combobox-trigger`,...i,children:n}),t[4]=n,t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function io(e){let t=(0,U.c)(24),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:a,children:i,side:s,sideOffset:c,alignOffset:n,align:l,anchor:r,...o}=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,t[8]=l);let u=s===void 0?`bottom`:s,d=c===void 0?4:c,f=l===void 0?`start`:l,{chipsRef:p}=L.use(eo),m=r??p,h;t[9]===a?h=t[10]:(h=F(`dropdown-glass relative flex max-h-full min-w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) rounded-lg shadow-[0_16px_40px_-18px_rgb(0_0_0/55%)] transition-[scale,opacity] dark:shadow-[0_18px_44px_-18px_rgb(0_0_0/80%)]`,a),t[9]=a,t[10]=h);let g;t[11]!==i||t[12]!==o?(g=(0,Z.jsx)(Wa,{className:`flex min-w-0 max-h-[min(var(--available-height),23rem)] flex-1 flex-col overflow-hidden text-foreground`,"data-slot":`combobox-popup`,...o,children:i}),t[11]=i,t[12]=o,t[13]=g):g=t[13];let _;t[14]!==h||t[15]!==g?(_=(0,Z.jsx)(`span`,{className:h,children:g}),t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;return t[17]!==f||t[18]!==n||t[19]!==m||t[20]!==u||t[21]!==d||t[22]!==_?(v=(0,Z.jsx)(Va,{children:(0,Z.jsx)(Ha,{align:f,alignOffset:n,anchor:m,className:`z-[130] select-none`,"data-slot":`combobox-positioner`,side:u,sideOffset:d,children:_})}),t[17]=f,t[18]=n,t[19]=m,t[20]=u,t[21]=d,t[22]=_,t[23]=v):v=t[23],v}function ao(e){let t=(0,U.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,contentClassName:i,children:n,hideIndicator:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=F(`flex min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-pointer items-center rounded-sm px-2 py-1 text-base outline-none hover:bg-accent data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-selected:bg-foreground/[0.08] data-selected:text-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground [&[data-highlighted][data-selected]]:bg-accent [&[data-highlighted][data-selected]]:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[6]=r,t[7]=s);let c;t[8]===i?c=t[9]:(c=F(`min-w-0 flex-1 [&_svg:not([class*='text-'])]:text-muted-foreground`,i),t[8]=i,t[9]=c);let l;t[10]!==n||t[11]!==c?(l=(0,Z.jsx)(`div`,{className:c,"data-slot":`combobox-item-content`,children:n}),t[10]=n,t[11]=c,t[12]=l):l=t[12];let u;return t[13]!==a||t[14]!==s||t[15]!==l?(u=(0,Z.jsx)(Xa,{className:s,"data-slot":`combobox-item`,...a,children:l}),t[13]=a,t[14]=s,t[15]=l,t[16]=u):u=t[16],u}function oo(e){let t=(0,U.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=F(`mx-2 my-1 h-px bg-border last:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_e,{className:i,"data-slot":`combobox-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function so(e){let t=(0,U.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=F(`not-empty:p-2 text-center text-base text-muted-foreground sm:text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Za,{className:i,"data-slot":`combobox-empty`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function co(e){let t=(0,U.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=F(`not-empty:scroll-py-1 not-empty:px-1 not-empty:py-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(bt,{scrollbarGutter:!0,scrollFade:!0,children:(0,Z.jsx)(Pa,{className:i,"data-slot":`combobox-list`,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function lo(e){let t=(0,U.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=F(`not-empty:px-1 not-empty:py-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Pa,{className:i,"data-slot":`combobox-list`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function uo(e){let t=(0,U.c)(6),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;return t[3]!==n||t[4]!==r?(i=(0,Z.jsx)($a,{className:n,"data-slot":`combobox-clear`,...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function fo(e){let t=(0,U.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=F(`px-3 py-2 font-medium text-muted-foreground text-xs empty:m-0 empty:p-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ra,{className:i,"data-slot":`combobox-status`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var po=ha;export{Sr as $,Qi as A,kt as At,jr as B,aa as C,$t as Ct,oa as D,Lt as Dt,Q as E,It as Et,Ui as F,Li as G,Mr as H,Hi as I,Tr as J,Kr as K,Bi as L,na as M,ea as N,ra as O,Mt as Ot,Vi as P,wr as Q,Lr as R,ma as S,tn as St,sa as T,an as Tt,Pr as U,Wr as V,zi as W,Er as X,zr as Y,xr as Z,Ma as _,Vn as _t,co as a,lr as at,ba as b,Pn as bt,oo as c,fr as ct,po as d,An as dt,_r as et,$a as f,Hn as ft,Na as g,Bn as gt,Pa as h,Ln as ht,ao as i,$n as it,ta as j,$i as k,H as kt,fo as l,cr as lt,Ga as m,Gn as mt,so as n,tr as nt,lo as o,ar as ot,Xa as p,En as pt,Rr as q,no as r,er as rt,io as s,dr as st,to as t,rr as tt,ro as u,kn as ut,ka as v,Nn as vt,ca as w,rn as wt,va as x,nn as xt,Da as y,Kn as yt,Dr as z};
6
- //# sourceMappingURL=combobox-Cf7GvOtx.js.map
1
+ import{o as e}from"./rolldown-runtime-DAXXjFlN.js";import{Du as t,Gt as n,Wt as r,Z as i,a,cd as o,ga as s,gd as c,td as l,uo as u,wu as d}from"./useLocalStorage-2W_I13tQ.js";import{$i as f,$r as p,Aa as m,Ba as h,Bi as g,Bo as _,Ca as v,Ci as y,Cn as b,Co as x,Ea as S,Ei as C,Er as w,Ga as ee,Gr as te,Hi as T,Ir as E,Ja as ne,Ji as re,Jn as D,Ki as O,Kr as k,Li as A,Lo as ie,Ni as ae,Oa as oe,Pi as se,Qa as ce,Qi as le,Qn as ue,Qr as de,Sa as fe,Sn as pe,Ta as me,Ti as he,Tn as j,Tr as ge,Ua as M,Un as _e,Va as ve,Wa as ye,Xa as be,Xi as xe,Xn as Se,Ya as Ce,Yr as N,Za as we,Zi as Te,Zn as Ee,Zr as De,_n as Oe,aa as P,ar as ke,bn as Ae,ci as je,ct as Me,dt as Ne,ea as Pe,er as Fe,fa as Ie,ft as Le,ga as Re,ho as ze,ia as Be,ii as Ve,jr as He,mn as Ue,na as We,nr as Ge,or as Ke,pa as qe,pt as Je,qa as Ye,qi as Xe,qn as Ze,rr as Qe,sr as $e,t as F,tr as et,ua as tt,vn as nt,wi as rt,wo as it,xn as at,yn as ot,za as st,zi as ct}from"./utils-D0kLIGeh.js";import{Xt as lt,a as ut,er as dt,nn as ft,tr as pt,ur as mt}from"./textarea-DdNchuIO.js";import{Gt as ht,Kt as gt,Rn as _t,Vt as vt,jn as yt,t as bt}from"./scroll-area-D8MfzXjN.js";import{j as xt}from"./entities-dwE_i4XM.js";import{t as I}from"./input-Q4KA45-f.js";var L=e(a(),1),St=new Map([[`bold`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M232.49,215.51,185,168a92.12,92.12,0,1,0-17,17l47.53,47.54a12,12,0,0,0,17-17ZM44,112a68,68,0,1,1,68,68A68.07,68.07,0,0,1,44,112Z`}))],[`duotone`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M192,112a80,80,0,1,1-80-80A80,80,0,0,1,192,112Z`,opacity:`0.2`}),L.createElement(`path`,{d:`M229.66,218.34,179.6,168.28a88.21,88.21,0,1,0-11.32,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`fill`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M168,112a56,56,0,1,1-56-56A56,56,0,0,1,168,112Zm61.66,117.66a8,8,0,0,1-11.32,0l-50.06-50.07a88,88,0,1,1,11.32-11.31l50.06,50.06A8,8,0,0,1,229.66,229.66ZM112,184a72,72,0,1,0-72-72A72.08,72.08,0,0,0,112,184Z`}))],[`light`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M228.24,219.76l-51.38-51.38a86.15,86.15,0,1,0-8.48,8.48l51.38,51.38a6,6,0,0,0,8.48-8.48ZM38,112a74,74,0,1,1,74,74A74.09,74.09,0,0,1,38,112Z`}))],[`regular`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M229.66,218.34l-50.07-50.06a88.11,88.11,0,1,0-11.31,11.31l50.06,50.07a8,8,0,0,0,11.32-11.32ZM40,112a72,72,0,1,1,72,72A72.08,72.08,0,0,1,40,112Z`}))],[`thin`,L.createElement(L.Fragment,null,L.createElement(`path`,{d:`M226.83,221.17l-52.7-52.7a84.1,84.1,0,1,0-5.66,5.66l52.7,52.7a4,4,0,0,0,5.66-5.66ZM36,112a76,76,0,1,1,76,76A76.08,76.08,0,0,1,36,112Z`}))]]),Ct=Object.defineProperty,wt=Object.defineProperties,Tt=Object.getOwnPropertyDescriptors,R=Object.getOwnPropertySymbols,z=Object.prototype.hasOwnProperty,Et=Object.prototype.propertyIsEnumerable,Dt=(e,t,n)=>t in e?Ct(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ot=(e,t)=>{for(var n in t||={})z.call(t,n)&&Dt(e,n,t[n]);if(R)for(var n of R(t))Et.call(t,n)&&Dt(e,n,t[n]);return e},B=(e,t)=>wt(e,Tt(t)),kt=(0,L.forwardRef)((e,t)=>L.createElement(x,B(Ot({ref:t},e),{weights:St})));kt.displayName=`MagnifyingGlass`;var V={kind:`branch`,baseRef:null},At={kind:`unstaged`};function jt(e){return e?.trim()||null}var H=Je()(Le(e=>({byThreadKey:{},branchBaseRefByThreadKey:{},diffRenderMode:`stacked`,setDiffRenderMode:t=>e({diffRenderMode:t}),selectGitScope:(t,n)=>e(e=>{let r=ze(t),i=e.byThreadKey[r],a=i?.kind===`branch`?i.baseRef:e.branchBaseRefByThreadKey[r]??null;return{byThreadKey:{...e.byThreadKey,[r]:n===`branch`?{kind:`branch`,baseRef:a}:{kind:`unstaged`}},branchBaseRefByThreadKey:i?.kind===`branch`?{...e.branchBaseRefByThreadKey,[r]:i.baseRef}:e.branchBaseRefByThreadKey}}),selectBranchBaseRef:(t,n)=>e(e=>{let r=ze(t),i=jt(n);return{byThreadKey:{...e.byThreadKey,[r]:{kind:`branch`,baseRef:i}},branchBaseRefByThreadKey:{...e.branchBaseRefByThreadKey,[r]:i}}}),selectTurn:(t,n,r)=>e(e=>{let i=ze(t),a=e.byThreadKey[i];return{byThreadKey:{...e.byThreadKey,[i]:{kind:`turn`,turnId:n,filePath:r?.trim()||null,revealRequestId:a?.kind===`turn`?a.revealRequestId+1:1}}}}),reconcileTurnSelection:(t,n)=>e(e=>{let r=ze(t),i=e.byThreadKey[r],a=n[0];return i?.kind!==`turn`||a===void 0||n.includes(i.turnId)?e:{byThreadKey:{...e.byThreadKey,[r]:{...i,turnId:a}}}}),removeThread:t=>e(e=>{let n=ze(t);if(!(n in e.byThreadKey)&&!(n in e.branchBaseRefByThreadKey))return e;let{[n]:r,...i}=e.byThreadKey,{[n]:a,...o}=e.branchBaseRefByThreadKey;return{byThreadKey:i,branchBaseRefByThreadKey:o}})}),{name:`borgcode:diff-panel-state:v1`,version:1,storage:Ne(()=>Me(typeof window<`u`?window.localStorage:void 0)),partialize:e=>({byThreadKey:e.byThreadKey,branchBaseRefByThreadKey:e.branchBaseRefByThreadKey,diffRenderMode:e.diffRenderMode})}));function Mt(e,t,n=!1){return t?e[ze(t)]??(n?At:V):V}function Nt(e){if(e.startsWith(`/`)||dt(e)||/^[a-zA-Z]:/.test(e))return null;let t=e.replaceAll(`\\`,`/`).split(`/`).filter(e=>e.length>0&&e!==`.`);return t.length===0||t.includes(`..`)?null:t}function Pt(e,t){if(!e||!t)return null;let n=pt(e),r=pt(t);if(n===r)return[];let i=r.includes(`\\`)?`\\`:`/`,a=r.endsWith(i)?r:`${r}${i}`;return n.startsWith(a)?n.slice(a.length).split(/[\\/]+/).filter(Boolean):null}function Ft(e){let t=Nt(e.filePath);if(!t)return null;let n=Pt(e.workspaceRoot,e.repositoryRoot);if(!n||n.length===0)return t.join(`/`);let r=e.repositoryRoot?dt(e.repositoryRoot):!1;if(!n.every((e,n)=>{let i=t[n];return i===void 0?!1:r?i.toLowerCase()===e:i===e}))return null;let i=t.slice(n.length);return i.length>0?i.join(`/`):null}function It({threadRef:e,filePath:t,activeCwd:n,repositoryRoot:r,openInEditor:i}){let a=Ft({filePath:t,workspaceRoot:n,repositoryRoot:r});if(a){if(e){xt.getState().openFile(e,a);return}i(n?yt(a,n):a)}}function Lt(e,t,n){H.getState().selectTurn(e,t,n),xt.getState().open(e,`diff`)}var U=it(),W=new Set([`completed`,`failed`,`cancelled`,`interrupted`]);function G(e){return W.has(e)}function Rt(e){return e===`pending`||e===`running`||e===`waiting`}var zt=6,Bt=180,Vt=100;function Ht(e){return e.agentKind!==`agent`}function Ut(e){return e.length<=Bt?e:`${e.slice(0,Bt-1)}…`}function Wt(e,t,n){let r=Ut(n);if(e.length>0&&e[e.length-1]?.summary===r)return e;let i=[...e,{at:t,summary:r}];return i.length>zt?i.slice(-6):i}function K(e){return typeof e==`string`&&e.trim().length>0?e.trim():void 0}function q(e){return typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0}function Gt(e){if(typeof e!=`object`||!e)return;let t=e,n=q(t.totalTokens);if(n===void 0)return;let r={totalTokens:n},i=q(t.inputTokens);i!==void 0&&(r.inputTokens=i);let a=q(t.cachedInputTokens);a!==void 0&&(r.cachedInputTokens=a);let o=q(t.outputTokens);o!==void 0&&(r.outputTokens=o);let s=q(t.reasoningOutputTokens);s!==void 0&&(r.reasoningOutputTokens=s);let c=q(t.toolUses);c!==void 0&&(r.toolUses=c);let l=q(t.durationMs);return l!==void 0&&(r.durationMs=l),r}function J(e,t){if(!t)return e;if(!e)return t;let n=(e,t)=>e===void 0?t:t===void 0?e:Math.max(e,t),r={totalTokens:Math.max(e.totalTokens,t.totalTokens)},i=n(e.inputTokens,t.inputTokens);i!==void 0&&(r.inputTokens=i);let a=n(e.cachedInputTokens,t.cachedInputTokens);a!==void 0&&(r.cachedInputTokens=a);let o=n(e.outputTokens,t.outputTokens);o!==void 0&&(r.outputTokens=o);let s=n(e.reasoningOutputTokens,t.reasoningOutputTokens);s!==void 0&&(r.reasoningOutputTokens=s);let c=n(e.toolUses,t.toolUses);c!==void 0&&(r.toolUses=c);let l=n(e.durationMs,t.durationMs);return l!==void 0&&(r.durationMs=l),r}function Kt(e,t){return K(e.taskType)===`local_workflow`?`workflow`:e.parentAgentId!==void 0||t.includes(`:wf:`)?`workflow_agent`:`subagent`}function qt(e,t,n,r){let i=e.get(t);if(i)return i;let a={id:t,kind:Kt(n,t),title:K(n.title)??K(n.detail)??t,role:K(n.role)??null,model:K(n.model)??null,effort:K(n.effort)??null,status:`pending`,activationCount:0,usage:null,progress:null,lastToolName:null,result:null,error:null,outputFile:null,parentAgentId:K(n.parentAgentId)??null,agentIndex:q(n.agentIndex)??null,phaseIndex:q(n.phaseIndex)??null,phaseTitle:K(n.phaseTitle)??null,attempt:q(n.attempt)??null,workflowName:K(n.workflowName)??null,phases:[],runHandles:null,recentActivity:[],firstSeenAt:r,startedAt:null,completedAt:null,updatedAt:r};return e.set(t,a),a}function Jt(e,t){let n=K(t.title);n&&(e.title=n);let r=K(t.role);r&&(e.role=r);let i=K(t.model);i&&(e.model=i);let a=K(t.effort);a&&(e.effort=a);let o=K(t.parentAgentId);o&&(e.parentAgentId=o,e.kind===`subagent`&&(e.kind=`workflow_agent`));let s=K(t.workflowName);s&&(e.workflowName=s),K(t.taskType)===`local_workflow`&&(e.kind=`workflow`);let c=q(t.agentIndex);c!==void 0&&(e.agentIndex=c);let l=q(t.phaseIndex);l!==void 0&&(e.phaseIndex=l);let u=K(t.phaseTitle);u&&(e.phaseTitle=u);let d=q(t.attempt);d!==void 0&&(e.attempt!==null&&d>e.attempt&&(e.result=null,e.error=null,e.completedAt=null),e.attempt=d);let f=K(t.outputFile);if(f&&(e.outputFile=f),Array.isArray(t.phases)){let n=[];for(let e of t.phases){if(typeof e!=`object`||!e)continue;let t=e,r=q(t.index),i=K(t.title);r!==void 0&&i&&n.push({index:r,title:i})}n.length>0&&(e.phases=n.slice().sort((e,t)=>e.index-t.index))}if(typeof t.runHandles==`object`&&t.runHandles!==null){let n=t.runHandles,r={},i=K(n.runId);i&&(r.runId=i);let a=K(n.scriptPath);a&&(r.scriptPath=a);let o=K(n.transcriptDir);o&&(r.transcriptDir=o);let s=K(n.sessionUrl);s&&/^https?:\/\//i.test(s)&&(r.sessionUrl=s),Object.keys(r).length>0&&(e.runHandles={...e.runHandles,...r})}}function Yt(e,t,n){let r=G(e.status),i=G(t);r&&i||((r||e.status===`idle`)&&(t===`running`||t===`pending`)&&(e.activationCount+=1,e.result=null,e.error=null,e.completedAt=null,t===`running`&&(e.startedAt=n)),t===`running`&&e.startedAt===null&&(e.startedAt=n),i&&e.completedAt===null&&(e.completedAt=n),e.status=t)}var Xt=new Map([[`completed`,`completed`],[`failed`,`failed`],[`stopped`,`interrupted`]]),Zt=new Set([`pending`,`running`,`waiting`,`idle`,`completed`,`failed`,`cancelled`,`interrupted`]);function Qt(e){return typeof e==`string`&&Zt.has(e)?e:void 0}function $t(e,t){let n=new Map;for(let t of e){if(typeof t.payload!=`object`||t.payload===null)continue;let e=t.payload,r=t.createdAt;switch(t.kind){case`task.started`:{let t=K(e.taskId);if(!t||Ht(e))break;let i=qt(n,t,e,r);Jt(i,e),i.activationCount===0&&!G(i.status)?(i.activationCount=1,i.startedAt=i.startedAt??r,i.status=`running`):i.status===`idle`&&Yt(i,`running`,r);let a=K(e.detail);a&&i.title===i.id&&(i.title=a),i.updatedAt=r;break}case`task.progress`:{let t=K(e.taskId);if(!t)break;let i=n.has(t);if(!i&&Ht(e))break;let a=qt(n,t,e,r);Jt(a,e),a.activationCount===0&&(a.activationCount=1);let o=Qt(e.status);o?Yt(a,o,r):(e.usageSnapshot!==!0||!i)&&!G(a.status)&&a.status!==`idle`&&Yt(a,`running`,r);let s=K(e.summary);s&&(a.progress=Ut(s),a.recentActivity=Wt(a.recentActivity,r,s));let c=K(e.lastToolName);c&&(a.lastToolName=c,s||(a.recentActivity=Wt(a.recentActivity,r,`▸ ${c}`)));let l=K(e.error);l&&(a.error=Ut(l)),a.usage=J(a.usage,Gt(e.typedUsage)),a.updatedAt=r;break}case`task.updated`:{let t=K(e.taskId);if(!t||!n.has(t)&&Ht(e))break;let i=qt(n,t,e,r);Jt(i,e),i.activationCount===0&&(i.activationCount=1);let a=G(i.status),o=Qt(e.status);o&&Yt(i,o,r);let s=K(e.error);s&&(i.error=Ut(s));let c=K(e.endedAt);c&&!a&&G(i.status)&&(i.completedAt=c),i.updatedAt=r;break}case`task.completed`:{let t=K(e.taskId);if(!t||!n.has(t)&&Ht(e))break;let i=qt(n,t,e,r);Jt(i,e),i.activationCount===0&&(i.activationCount=1);let a=K(e.summary)??K(e.detail);if(G(i.status)){a&&(i.status===`failed`?i.error=i.error??Ut(a):i.result=i.result??Ut(a)),i.usage=J(i.usage,Gt(e.typedUsage));break}let o=Xt.get(K(e.status)??``)??`completed`;Yt(i,o,r),a&&(o===`failed`?i.error=i.error??Ut(a):i.result=Ut(a)),i.usage=J(i.usage,Gt(e.typedUsage)),i.updatedAt=r;break}case`tool.progress`:{let t=K(e.taskId);if(!t)break;let i=n.get(t);if(!i)break;let a=K(e.toolName);a&&(i.lastToolName=a,i.recentActivity=Wt(i.recentActivity,r,`▸ ${a}`)),i.updatedAt=r;break}default:break}}for(let e of n.values())if(!(e.kind!==`workflow`||!G(e.status)))for(let t of n.values())t.parentAgentId===e.id&&(G(t.status)||t.status===`idle`||(t.status=e.status===`completed`?`completed`:`interrupted`,t.completedAt=t.completedAt??e.completedAt??e.updatedAt,t.updatedAt=e.updatedAt));if(t?.sessionLive===!1)for(let e of n.values())Rt(e.status)&&(e.status=`interrupted`,e.completedAt=e.completedAt??e.updatedAt);let r=Array.from(n.values());if(r.length>Vt){let e=e=>Rt(e.status)?0:e.status===`idle`?1:2;r=r.slice().sort((t,n)=>e(t)-e(n)||n.updatedAt.localeCompare(t.updatedAt)).slice(0,Vt)}return r.map(e=>({...e}))}var en={workflows:[],directAgents:[],runningCount:0,waitingCount:0,idleCount:0,settledCount:0,totalTokens:0,hasAgents:!1,liveCount:0};function tn(){return en}function nn({agents:e,v2Projection:t}){let n=t??e;if(n.length===0)return en;let r=n.filter(e=>e.kind===`workflow`).slice().sort((e,t)=>e.firstSeenAt.localeCompare(t.firstSeenAt)||e.id.localeCompare(t.id)),i=new Set(r.map(e=>e.id)),a=new Map,o=[];for(let e of n)if(e.kind!==`workflow`)if(e.parentAgentId!==null&&i.has(e.parentAgentId)){let t=a.get(e.parentAgentId)??[];t.push(e),a.set(e.parentAgentId,t)}else o.push(e);let s=r.map(e=>{let t=a.get(e.id)??[],n=e.phases.length>0?e.phases:(()=>{let e=new Map;for(let n of t)n.phaseIndex!==null&&!e.has(n.phaseIndex)&&e.set(n.phaseIndex,n.phaseTitle??`Phase ${n.phaseIndex+1}`);return Array.from(e.entries()).map(([e,t])=>({index:e,title:t})).slice().sort((e,t)=>e.index-t.index)})(),r=new Set(n.map(e=>e.index));return{workflow:e,phases:n.map(e=>{let n=t.filter(t=>t.phaseIndex===e.index).slice().sort((e,t)=>(e.agentIndex??0)-(t.agentIndex??0)),r=n.filter(e=>Rt(e.status)||e.status===`idle`).length,i=n.filter(e=>G(e.status)).length,a=n.length===0?`pending`:r>0?`running`:i===n.length?`done`:`pending`;return{index:e.index,title:e.title,members:n,state:a,activeCount:r,settledCount:i}}),unphasedMembers:t.filter(e=>e.phaseIndex===null||!r.has(e.phaseIndex)).slice().sort((e,t)=>(e.agentIndex??0)-(t.agentIndex??0))}}),c=0,l=0,u=0,d=0,f=0;for(let e of n)e.kind===`workflow`&&(a.get(e.id)??[]).length>0||(e.status===`running`||e.status===`pending`?c+=1:e.status===`waiting`?l+=1:e.status===`idle`?u+=1:d+=1,f+=e.usage?.totalTokens??0);return{workflows:s,directAgents:o.slice().sort((e,t)=>e.firstSeenAt.localeCompare(t.firstSeenAt)||e.id.localeCompare(t.id)),runningCount:c,waitingCount:l,idleCount:u,settledCount:d,totalTokens:f,hasAgents:!0,liveCount:c+l}}function rn(e,t){if(!e)return null;let n=e.replace(/^claude-/,``).replace(/-\d{8}$/,``).replace(/-latest$/,``);return t?`${n} · ${t}`:n}function an(e){if(e<1e3)return`${e}`;if(e<1e6){let t=e/1e3;return`${t>=100?Math.round(t):t.toFixed(1)}k`}return`${(e/1e6).toFixed(1)}M`}function on(e){let t=(e.length>8e3?e.slice(-8e3).replace(/^[^\n]*\n/u,``):e).split(/\r?\n/u),n=!1,r,i=``;for(let[e,a]of t.entries()){if(/^\s*```/u.test(a)){n=!n;continue}if(n)continue;let o=/^\s*\*\*([^*]+)\*\*\s*$/u.exec(a),s=e<t.length-1?/^\s*#{1,6}\s+(.+?)\s*#*\s*$/u.exec(a):null;o||s?r=(o??s)[1]:i+=`${a}\n`}return{heading:r,prose:i}}var sn=/.+?(?:[.!?](?=\s|$)|[。!?])/gu,cn=/^(?:okay|ok|so|alright|right|well|hmm+|now)(?=[\s,.!?…]|$)[,.!?…]*\s*/iu,ln=/^\s*(?:[-*+•]|\d{1,3}[.)])\s+/u;function un(e,t){let n=e?.replace(/\[([^\]]+)\]\([^)]*\)/gu,`$1`).replace(/[*_`]/gu,``).replace(/\s+/gu,` `).trim();if(!n)return;if(n.length<=t)return n;let r=n.slice(0,t-1),i=r.lastIndexOf(` `);return`${(i>t/2?r.slice(0,i):r).trimEnd()}…`}function dn(e,t=160){return un(on(e).heading,t)}function fn(e,t=160){return un(on(e).prose.match(sn)?.at(-1),t)}function pn(e,t=160){let n=e.length>4e3?e.slice(0,4e3):e,r=[],i=!1;for(let e of on(n).prose.split(`
2
+ `)){let t=ln.exec(e)?.[0];e.trim().length===0?i=!1:i&&t===void 0?r[r.length-1].text+=` ${e.trim()}`:(r.push({text:e.slice(t?.length??0).trim(),item:t!==void 0}),i=!0)}for(let[e,n]of r.entries()){let i=n.item&&e<r.length-1?[n.text]:[];for(let e of n.text.match(sn)??i){let n=e.trim();for(;cn.test(n);)n=n.replace(cn,``);if(n)return un(n.charAt(0).toUpperCase()+n.slice(1),t)}}}function mn(e,t=160,n=!1){return dn(e,t)??(n?fn(e,t):void 0)??pn(e,t)}var hn=24;function gn(e){let t=e&&typeof e==`object`?e:{},n=e=>typeof e==`string`&&e.trim().length>0?e.trim():void 0,r=Array.isArray(t.sections)?t.sections.flatMap(e=>{let t=e&&typeof e==`object`?e:{},r=n(t.headline);return r?[{headline:r,summary:n(t.summary)??``}]:[]}).slice(0,hn):[];return{summary:n(t.summary),title:n(t.title),sections:r,summarySource:t.summarySource===`model`?`model`:void 0}}function _n(e){if(!Number.isFinite(e)||e<0)return`0ms`;if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4)return`${(e/1e3).toFixed(1)}s`;if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n===0?`${t}m`:n===60?`${t+1}m`:`${t}m ${n}s`}function vn(e){return _n(e).replace(/\.0s$/,`s`)}function yn(e){return e===`setup-script.requested`||e===`setup-script.started`}var bn=new Set([`read`,`edit`,`command`,`code-search`,`search`,`other`]);function xn(e){return typeof e==`string`&&bn.has(e)?e:void 0}var Sn={read:{kind:`read`,title:`Read a file`},list:{kind:`read`,title:`Listed a directory`},write:{kind:`edit`,title:`Wrote a file`},edit:{kind:`edit`,title:`Edited a file`},multiedit:{kind:`edit`,title:`Edited files`},patch:{kind:`edit`,title:`Edited files`},bash:{kind:`command`,title:`Ran a command`},glob:{kind:`code-search`,title:`Searched files`},grep:{kind:`code-search`,title:`Searched code`},webfetch:{kind:`search`,title:`Fetched a page`},websearch:{kind:`search`,title:`Searched the web`},todowrite:{kind:`other`,title:`Updated the plan`},todoread:{kind:`other`,title:`Read the plan`},task:{kind:`other`,title:`Ran a subagent`}};function Cn(e){let t=Sn[e?.trim().toLowerCase()??``];return t?{...t,keepsDetail:t.kind===`command`}:void 0}var wn=/^((?:Using|Used)\s+)?(?:mcp__borg-code__|borg-code(?:__|_|\s+·\s+))(?=[A-Za-z])/u;function Tn(e){return e.replace(wn,`$1`)}function En(e){if(typeof e!=`object`||!e||Array.isArray(e)||e.server!==`borg-code`)return e;let t={...e};return delete t.server,t}function Dn(e,t=160){return mn(e,t)}function On(e){let t=e.fields.summary||Dn(e.text);return(e.live?t:e.fields.title||t)||e.fallback}function kn(e){return e.hasAssistantText?{phase:`responding`,label:`Responding`,icon:`message-circle`}:e.hasCompletedWork?{phase:`continuing`,label:`Continuing`,icon:`arrow-right`}:e.hasStarted?{phase:`waiting`,label:`Processing`,icon:`zap`}:{phase:`starting`,label:`Starting`,icon:`zap`}}var An=`provider.turn.interrupted-by-restart`;function jn(e){return e.sourceActivityKind===An}function Mn(e){return e.replace(/\s+(?:complete|completed)\s*$/i,``).trim()}function Nn(e){return e.tone===`tool`||e.tone===`thinking`||e.tone===`error`||e.command!==void 0&&e.command.trim().length>0||e.requestKind!==void 0?!0:e.itemType!==void 0&&i(e.itemType)}function Pn(e){return e.itemType===`web_search`&&/\bgrep\b/i.test(Mn(e.toolTitle??e.label))}function Fn(e){return e.toolKind===void 0?e.requestKind===`file-read`||e.itemType===`image_view`||e.itemType===`dynamic_tool_call`&&e.toolTitle?.trim().toLowerCase()===`read file`?`read`:e.requestKind===`file-change`||e.itemType===`file_change`||(e.changedFiles?.length??0)>0?`edit`:e.requestKind===`command`||e.itemType===`command_execution`||e.command?`command`:Pn(e)?`code-search`:e.itemType===`web_search`?`search`:Nn(e)?`other`:`update`:e.toolKind}function In(e){let t=e.detail?.trim();return Fn(e)===`read`&&t!==void 0&&!/[\r\n]/.test(t)&&vt(t)?t:null}var Ln=/^(?:file:|[\\/]|[a-z]:[\\/])/i,Rn=/(?:^|[\\/])(?:dev|userdata)[\\/]attachments[\\/]([a-z0-9_-]{1,128})\.[a-z0-9]{1,10}$/i;function zn(e,t){let n=ht(e,t.workspaceRoot??`.`);if(n._tag!==`WorkspaceFile`)return null;let r=t.workspaceRoot==null&&n.path.startsWith(`./`)?n.path.slice(2):n.path,i=Ln.test(e)?Rn.exec(r)?.[1]??null:null;return{resource:i?{_tag:`attachment`,attachmentId:i}:{_tag:`workspace-file`,threadId:t.threadId,path:r},alt:r.split(/[\\/]/).at(-1)??`image`,srcFragment:gt(e)}}function Bn(e,t){if(e!==`edit`)return t.length;let n=new Set,r=0;for(let e of t){if(!e.changedFiles||e.changedFiles.length===0){r+=1;continue}for(let t of e.changedFiles)n.add(t)}return n.size+r}function Vn(e,t){switch(e){case`read`:return`Read ${t} ${t===1?`file`:`files`}`;case`edit`:return`Changed ${t} ${t===1?`file`:`files`}`;case`command`:return`Ran ${t} ${t===1?`command`:`commands`}`;case`search`:return`Searched the web ${t} ${t===1?`time`:`times`}`;case`code-search`:return`Searched code ${t} ${t===1?`time`:`times`}`;case`other`:return`Used ${t} ${t===1?`tool`:`tools`}`;case`update`:return`Received ${t} ${t===1?`update`:`updates`}`}}function Hn(e){return Un(e.filter(e=>e.toolLifecycleStatus===`completed`&&e.reasoning===void 0&&e.tone!==`error`&&(e.sourceActivityKind===`tool.completed`||e.toolKind!==void 0)))}function Un(e){let t=Wn(e,e=>e),n=new Map;for(let e of t){if(Gn(e))continue;let t=Fn(e),r=n.get(t);r?r.push(e):n.set(t,[e])}let r=[...n].map(([e,t])=>Vn(e,Bn(e,t))),i=r.length>0?null:Kn(t),a=(i===null?r:[i,...r]).map((e,t)=>t===0?e:e.charAt(0).toLowerCase()+e.slice(1));return a.length<2?a[0]??``:a.length===2?a.join(` and `):`${a.slice(0,-1).join(`, `)}, and ${a.at(-1)}`}function Wn(e,t){let n=new Set,r=[];for(let i=e.length-1;i>=0;--i){let a=e[i],o=t(a),s=Mn(o.toolTitle??o.label),c=[o.turnId??`no-turn`,o.itemType??``,s].join(``),l=o.sourceActivityKind;o.toolCallId===void 0&&o.toolLifecycleStatus===void 0&&(l===`tool.started`||l===`tool.updated`)&&n.has(c)||(r.push(a),(l===`tool.completed`||o.toolLifecycleStatus!==void 0&&o.toolLifecycleStatus!==`inProgress`)&&n.add(c))}return r.toReversed()}function Gn(e){return e.reasoning!==void 0}function Kn(e){let t=e.filter(Gn);if(t.length===0)return null;let n=t.reduce((e,t)=>e+(t.reasoning?.durationMs??0),0);return n>=1e3?`Thought for ${vn(n)}`:`Thought for a moment`}function qn(e){let t=e.reasoning?.durationMs??null;if(!(t===null||t<1e3||e.label.startsWith(`Thought for`)))return vn(t)}function Jn(e){let t=e.filter(e=>!Gn(e));if(t.length===0)return e.length>0?`reasoning`:`mixed`;if(t.every(jn))return`notice`;let n=new Set(t.map(Fn));if(n.size!==1)return`mixed`;let r=n.values().next().value;if(r!==`other`)return r;let i=new Set(t.map(e=>e.itemType===`mcp_tool_call`?`other`:e.itemType===`dynamic_tool_call`?`dynamic-tool`:e.itemType===`collab_agent_tool_call`||e.taskId||e.tone===`thinking`?`agent-tool`:e.tone===`tool`?`tone-tool`:`other`));return i.size===1?i.values().next().value:`mixed`}var Yn=2e3,Xn=`default-src https: data: blob: 'unsafe-inline' 'unsafe-eval'`,Zn=24;function Qn(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function $n(e){if(!Array.isArray(e)||e.length===0||e.length>Zn)return;let t=e.flatMap(e=>Array.isArray(e)&&e.length===2&&Number.isInteger(e[0])&&e[0]>=1&&e[0]<=1e4&&typeof e[1]==`number`&&Number.isFinite(e[1])?[[e[0],ar(e[1])]]:[]);return t.length===e.length?[...t].sort((e,t)=>e[0]-t[0]):void 0}function er(e){let t=Qn(e);if(t===void 0)return;let{attachmentId:n,title:r,height:i,heights:a}=t;if(typeof n!=`string`||n.length===0||n.length>256||typeof r!=`string`||typeof i!=`number`||!Number.isFinite(i))return;let o=$n(a);return{attachmentId:n,title:r.trim().slice(0,200)||`HTML`,height:ar(i),...o===void 0?{}:{heights:o}}}function tr(e){let t=Qn(e);if(t?.status===`completed`)return er(Qn(t.data)?.htmlRender)}function nr(e,t){return e.attachmentId===t.attachmentId&&e.title===t.title&&e.height===t.height&&(e.heights??[]).length===(t.heights??[]).length&&(e.heights??[]).every(([e,n],r)=>t.heights?.[r]?.[0]===e&&t.heights[r][1]===n)}function rr(e,t){let n=e.heights;if(n===void 0||n.length===0)return e.height;let r=n.findIndex(([e])=>e>=t),i=r===-1?n.length-1:r,a=n[i][0]===t?i:Math.max(0,i-1),o=Math.max(n[a][1],n[i][1]);return ar(Math.min(e.height,o))}function ir(e){return`${e.replace(/[\\/:*?"<>|\p{Cc}]+/gu,` `).replace(/\s+/g,` `).trim().slice(0,120).trim()||`Page`}.html`}function ar(e){return Math.min(Yn,Math.max(80,Math.round(e)))}var or={sans:`-apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif`,mono:`"SF Mono", "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace`};ft(lt,`light`)??lt.colors,ft(lt,`dark`)??lt.colors;var sr={light:{success:`#10b981`,successForeground:`#047857`,info:`#3b82f6`,infoForeground:`#1d4ed8`,chart:[`#0d9488`,`#d97706`,`#9333ea`,`#e11d48`,`#65a30d`]},dark:{success:`#10b981`,successForeground:`#34d399`,info:`#3b82f6`,infoForeground:`#60a5fa`,chart:[`#2dd4bf`,`#fbbf24`,`#c084fc`,`#fb7185`,`#a3e635`]}};function cr(e,t,n=or){let r=sr[t];return{appearance:t,variables:{"--background":e.canvas,"--foreground":e.text,"--muted":e.muted,"--muted-foreground":e.mutedForeground,"--card":e.surface,"--card-foreground":e.text,"--popover":e.surfaceOverlay,"--popover-foreground":e.text,"--secondary":e.secondary,"--secondary-foreground":e.secondaryForeground,"--border":e.border,"--input":e.input,"--ring":e.focus,"--primary":e.messageAction,"--primary-foreground":e.messageActionForeground,"--accent":e.accent,"--accent-foreground":e.accentForeground,"--accent-surface":e.accentSurface,"--accent-surface-foreground":e.accentSurfaceForeground,"--destructive":e.error,"--destructive-foreground":e.errorForeground,"--destructive-surface":e.errorSurface,"--warning":e.warning,"--warning-foreground":e.warningForeground,"--warning-surface":e.warningSurface,"--success":r.success,"--success-foreground":r.successForeground,"--info":r.info,"--info-foreground":r.infoForeground,"--code-background":e.codeBackground,"--code-foreground":e.codeForeground,"--chart-1":e.accent,...Object.fromEntries(r.chart.map((e,t)=>[`--chart-${t+2}`,e])),"--radius":`0.625rem`,"--font-sans":n.sans,"--font-mono":n.mono}}}[`Borg injects its active theme as CSS custom properties on :root, and they follow the user's theme and light/dark mode live:`,`--background (page background, identical to the thread around the frame), --foreground, --muted, --muted-foreground,`,`--card, --card-foreground, --popover, --popover-foreground, --secondary, --secondary-foreground, --border, --input, --ring,`,`--primary, --primary-foreground (solid buttons), --accent, --accent-foreground (brand accent), --accent-surface, --accent-surface-foreground,`,`--destructive, --destructive-foreground, --destructive-surface, --warning, --warning-foreground, --warning-surface,`,`--success, --success-foreground, --info, --info-foreground, --code-background, --code-foreground,`,`--chart-1 … --chart-6 (categorical series for charts), --radius, --font-sans, --font-mono.`,`The base stylesheet sets html background/color/font from these, body margin to 0, and hides the page's scrollbar; your own CSS overrides it.`].join(` `),[`The frame is borderless on the thread's background, as wide as the reply column (728px on desktop by default, wider if the reader widens chat, about 360px on phones), and its left edge lines up with your reply text.`,`Use a fluid width with no horizontal padding on the outermost element, and no outer card, border, or banner title: the page is part of your reply.`,`Give charts fixed pixel heights rather than heights that scale with width.`].join(` `);var lr=`ui/notifications/host-context-changed`,ur=`ui/open-link`;function dr(e){let t=Qn(e);if(t===void 0)return;let{jsonrpc:n,id:r,method:i,params:a}=t;if(n!==`2.0`||i!==ur||typeof r!=`string`&&typeof r!=`number`)return;let o=Qn(a)?.url;return typeof o==`string`&&/^https?:\/\//i.test(o)?{id:r,url:o}:void 0}function fr(e){return{jsonrpc:`2.0`,id:e,result:{}}}var pr=`borg-theme`;function mr(e){return`#${pr}=${encodeURIComponent(JSON.stringify(e))}`}function hr(e){return{jsonrpc:`2.0`,method:lr,params:{theme:e.appearance,styles:{variables:e.variables}}}}`${JSON.stringify(`html{background:var(--background);color:var(--foreground);font-family:var(--font-sans);font-size:14px;line-height:1.5;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;scrollbar-width:none}html::-webkit-scrollbar{display:none}body{margin:0}code,kbd,pre,samp{font-family:var(--font-mono)}`)}${pr}${JSON.stringify(`html{padding:clamp(24px,5vw,64px)}`)}${JSON.stringify(lr)}${JSON.stringify(ur)}`;var gr=Symbol(),_r=new WeakMap,vr=u(n),yr=u(r);function br(e){return e.tone===`tool`||e.tone===`thinking`||e.tone===`error`||e.command!==void 0&&e.command.trim().length>0||e.requestKind!==void 0?!0:e.itemType!==void 0&&i(e.itemType)}function xr(e){let t=e.toLowerCase();return!!(t.includes(`file not found`)||t.includes(`no files found`)||t.includes(`enoent`)||t.includes(`no such file or directory`)||t.includes(`no such file`)||t.includes(`cannot find path`)&&t.includes(`because it does not exist`)||t.includes(`commandnotfoundexception`)||t.includes(`is not recognized as the name of a cmdlet`)||t.includes(`is not recognized`)&&t.includes(`the term '`)||t.includes(`a parameter cannot be found that matches parameter name`)||t.includes(`command not found`)||/<exited with exit code\s+[1-9]\d*\s*>/i.test(e)||/exit(?:ed)? with exit code\s+[1-9]\d*/i.test(e)||/exit code\s*[:\s]\s*[1-9]\d*\b/i.test(e))}function Sr(e,t){if(e.tone===`error`)return!0;if(e.reasoning!==void 0)return!1;let n=e.toolLifecycleStatus;if(n===`failed`||n===`declined`)return!0;if(!br(e))return!1;let r=[];e.detail&&r.push(e.detail),t&&e.command&&r.push(e.command);let i=r.join(`
3
+ `);return i.length===0?!1:xr(i)}function Cr(e){return Sr(e,!0)}function wr(e){return Sr(e,!1)}function Tr(e){return e.sourceActivityKind===`runtime.error`||e.sourceActivityKind?.endsWith(`.failed`)===!0}function Er(e){if(!br(e)||Cr(e)||e.tone===`thinking`)return!1;let t=e.toolLifecycleStatus;return!(t===`failed`||t===`declined`||t===`inProgress`||t===`stopped`)}function Dr(e){return!(e.agentSpawn!==void 0||e.reasoning!==void 0||!br(e)||Cr(e)||Er(e))}function Or(e){if(!Number.isFinite(e)||e<0)return`0ms`;if(e<1e3)return`${Math.max(1,Math.round(e))}ms`;if(e<1e4){let t=Math.round(e/100)/10;return t>=10?`10s`:`${t.toFixed(1)}s`}if(e<6e4)return`${Math.round(e/1e3)}s`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n===0?`${t}m`:n===60?`${t+1}m`:`${t}m ${n}s`}function kr(e,t){return!e?.startedAt||!e.completedAt?!1:t?t.status!==`running`:!0}function Ar(e,t,n,r=null){let i=t?.status===`running`?t.activeTurnId:null;return i===null?kr(e,t)?n:e?.startedAt??n:e?.turnId===i?e.startedAt??n??r:n??r}function jr(e){switch(e){case`command_execution_approval`:case`exec_command_approval`:case`dynamic_tool_call`:return`command`;case`file_read_approval`:return`file-read`;case`file_change_approval`:case`apply_patch_approval`:return`file-change`;case`mcp_elicitation_approval`:return`mcp-elicitation`;case`mcp_tool_call_approval`:return`mcp-tool`;case`external_directory_approval`:return`workspace-access`;default:return typeof e==`string`&&e.length>0?`other`:null}}function Mr(e){let t=e?.toLowerCase();return t?t.includes(`stale pending approval request`)||t.includes(`stale pending user-input request`)||t.includes(`unknown pending approval request`)||t.includes(`unknown pending permission request`)||t.includes(`unknown pending user-input request`)||t.includes(`unknown pending user input request`)||t.includes(`unknown pending codex user input request`):!1}var Nr=(e,t)=>{let n=e[t];return typeof n==`string`&&n.length>0?n:void 0};function Pr(e){let t=new Map;for(let n of[...e].toSorted(Ri)){let e=n.payload&&typeof n.payload==`object`?n.payload:null,r=e?Nr(e,`requestId`):void 0;if(!e||!r)continue;if(n.kind===`approval.requested`){if(e.requestKind!==`app-connection`)continue;let i=Nr(e,`appSlug`),a=Nr(e,`connectUrl`);if(!i||!a)continue;let o=Nr(e,`appLogo`),c=Nr(e,`appDescription`);t.set(r,{requestId:s.make(r),createdAt:n.createdAt,name:Nr(e,`appName`)??i,slug:i,url:a,reauth:e.reauth===!0,...o?{logo:o}:{},...c?{description:c}:{},status:`pending`});continue}let i=t.get(r);if(i)if(n.kind===`approval.resolved`){let n=e.decision;t.set(r,{...i,status:n===`accept`?`connected`:n===`decline`?`skipped`:`not_connected`})}else i.status===`pending`&&n.kind===`provider.approval.respond.failed`&&Mr(Nr(e,`detail`))&&t.set(r,{...i,status:`not_connected`})}return[...t.values()]}function Fr(e){let t=new Map,n=[...e].toSorted(Ri);for(let e of n){let n=e.payload&&typeof e.payload==`object`?e.payload:null,r=n&&typeof n.requestId==`string`?s.make(n.requestId):null,i=n&&vr(n.requestKind)?n.requestKind:n?jr(n.requestType):null,a=n&&typeof n.detail==`string`?n.detail:void 0,o=n&&typeof n.appName==`string`?n.appName:void 0,c=n&&typeof n.toolDescription==`string`?n.toolDescription:void 0,l=n?Nr(n,`toolTitle`):void 0,u=n?Nr(n,`appSlug`):void 0,d=n?Nr(n,`appLogo`):void 0,f=n&&typeof n.diff==`string`?n.diff:void 0,p=Array.isArray(n?.options)?n.options.filter(yr):void 0;if(i!==`app-connection`){if(e.kind===`approval.requested`&&r&&i){t.set(r,{requestId:r,requestKind:i,createdAt:e.createdAt,...a?{detail:a}:{},...o?{appName:o}:{},...l?{toolTitle:l}:{},...c?{toolDescription:c}:{},...u?{appSlug:u}:{},...d?{appLogo:d}:{},...f?{diff:f}:{},...p&&p.length>0?{options:p}:{}});continue}if(e.kind===`approval.resolved`&&r){t.delete(r);continue}if(e.kind===`provider.approval.respond.failed`&&r&&Mr(a)){t.delete(r);continue}}}return[...t.values()].toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt))}function Ir(e){let t=e?.questions;if(!Array.isArray(t))return null;let n=t.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.id!=`string`||typeof t.header!=`string`||typeof t.question!=`string`||!Array.isArray(t.options))return null;let n=t.options.map(e=>{if(!e||typeof e!=`object`)return null;let t=e;return typeof t.label!=`string`||typeof t.description!=`string`?null:{label:t.label,description:t.description}}).filter(e=>e!==null);return n.length===0?null:{id:t.id,header:t.header,question:t.question,options:n,multiSelect:t.multiSelect===!0}}).filter(e=>e!==null);return n.length>0?n:null}function Lr(e){let t=new Map,n=[...e].toSorted(Ri);for(let e of n){let n=e.payload&&typeof e.payload==`object`?e.payload:null,r=n&&typeof n.requestId==`string`?s.make(n.requestId):null,i=n&&typeof n.detail==`string`?n.detail:void 0;if(e.kind===`user-input.requested`&&r){let i=Ir(n);if(!i)continue;t.set(r,{requestId:r,createdAt:e.createdAt,questions:i});continue}if(e.kind===`user-input.resolved`&&r){t.delete(r);continue}e.kind===`provider.user-input.respond.failed`&&r&&Mr(i)&&t.delete(r)}return[...t.values()].toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt))}function Rr(e){let t=e.payload&&typeof e.payload==`object`?e.payload:null,n=t?.plan;if(!Array.isArray(n))return null;let r=[];for(let e of n){if(!e||typeof e!=`object`)continue;let t=e;if(typeof t.step!=`string`)continue;let n=t.status===`completed`||t.status===`inProgress`?t.status:`pending`;r.push({step:t.step,status:n})}return r.length===0?null:{createdAt:e.createdAt,turnId:e.turnId,...t&&`explanation`in t?{explanation:t.explanation}:{},steps:r}}function zr(e,t){let n=new Map,r,i=e=>{let t=new Map;return e.map(e=>{let n=t.get(e.step)??0;return t.set(e.step,n+1),{key:`${e.step}:${n}`,step:e}})};for(let e of t){let t=Rr(e),a=Date.parse(e.createdAt);if(!(!t||Number.isNaN(a))){r??=a;for(let{key:e,step:r}of i(t.steps)){let t=n.get(e)??{};r.status===`inProgress`&&t.startedAt===void 0&&(t.startedAt=a),r.status===`completed`&&t.completedAt===void 0&&(t.completedAt=a),n.set(e,t)}}}let a=new Map,o=r;for(let[e,t]of[...n.entries()].toSorted((e,t)=>(e[1].completedAt??1/0)-(t[1].completedAt??1/0))){let n=t.completedAt,r=t.startedAt??o;n!==void 0&&(r!==void 0&&n>r&&a.set(e,n-r),o=n)}return{...e,steps:i(e.steps).map(({key:e,step:t})=>{if(t.status!==`completed`)return t;let n=a.get(e);return n===void 0?t:{...t,durationMs:n}})}}function Br(e,n){let r=[...e].toSorted(Ri).filter(e=>e.kind===`turn.plan.updated`),i=l([...n?d(r,e=>e.turnId===n):c(),t(r)]).pipe(o);if(!i)return null;let a=Rr(i);if(!a)return null;let s=r.filter(e=>e.turnId===i.turnId),u=s.findLastIndex(e=>Rr(e)===null);return zr(a,s.slice(u+1))}function Vr(e,t){if(t){let n=[...e].filter(e=>e.turnId===t).toSorted((e,t)=>e.updatedAt.localeCompare(t.updatedAt)||e.id.localeCompare(t.id)).at(-1);if(n)return si(n)}let n=[...e].toSorted((e,t)=>e.updatedAt.localeCompare(t.updatedAt)||e.id.localeCompare(t.id)).at(-1);return n?si(n):null}function Hr(e){return e!==null&&e.implementedAt===null}function Ur(e){let t=e.payload&&typeof e.payload==`object`?e.payload:null;return!t||typeof t.taskId!=`string`?!1:!Ht(t)}function Wr(e){let t=e.payload&&typeof e.payload==`object`?e.payload:null;return t?e.kind===`task.started`||e.kind===`task.progress`||e.kind===`task.updated`||e.kind===`task.completed`?typeof t.agentId==`string`&&t.agentId.trim().length>0||t.timelineBypass===!0?!(e.kind!==`task.updated`&&typeof t.taskId==`string`&&!Ht(t)):!1:t.timelineBypass===!0?!0:typeof t.agentId==`string`&&t.agentId.trim().length>0:!1}var Gr=`request_app_connection`;function Kr(e){let t=new Set,n=new Set,r=new Set;for(let i of e){let e=Y(i.payload);if(i.kind===`approval.requested`&&e?.requestKind===`app-connection`){let t=X(e.requestId);t&&r.add(t);continue}if(!i.kind.startsWith(`tool.`))continue;let a=X(e?.toolCallId);if(!a)continue;(e?.status===`failed`||i.tone===`error`)&&n.add(a);let o=X(Y(e?.data)?.tool);o&&(o===Gr||o.endsWith(`_${Gr}`))&&t.add(a)}for(let e of n)t.delete(e);return{toolCallIds:t,requestIds:r}}function qr(e){let t=new Map;for(let n of e){if(n.kind!==`tool.completed`||Wr(n))continue;let e=tr(n.payload);if(e===void 0)continue;let r=X(Y(n.payload)?.toolCallId)??n.id,i=t.get(r);i&&Ri(i.activity,n)<=0||t.set(r,{activity:n,htmlRender:e})}return[...t.entries()].toSorted(([,e],[,t])=>Ri(e.activity,t.activity)).map(([e,{activity:t,htmlRender:n}])=>({id:`html-render:${e}`,createdAt:t.createdAt,turnId:t.turnId,htmlRender:n}))}function Jr(e){let t=new Set,n=new Set;for(let r of e){if(r.kind!==`tool.completed`||tr(r.payload)===void 0)continue;let e=X(Y(r.payload)?.toolCallId);e?t.add(e):n.add(r.id)}return{toolCallIds:t,activityIds:n}}function Yr(e,t={}){let n=[...e].toSorted(Ri),r=[],i=Kr(n),a=t.htmlRendersInline===!1?{toolCallIds:new Set,activityIds:new Set}:Jr(n);for(let e of n){if(a.toolCallIds.size>0||a.activityIds.size>0){if(a.activityIds.has(e.id))continue;let t=X(Y(e.payload)?.toolCallId);if(t&&a.toolCallIds.has(t))continue}if(i.requestIds.size>0||i.toolCallIds.size>0){let t=Y(e.payload);if(t?.requestKind===`app-connection`)continue;let n=X(t?.requestId);if(n&&i.requestIds.has(n))continue;let r=X(t?.toolCallId);if(r&&i.toolCallIds.has(r))continue}e.tone!==`error`&&yn(e.kind)||e.kind===`tool.started`&&!X(Y(e.payload)?.toolCallId)||e.kind!==`reasoning.started`&&(e.kind===`task.started`&&!Ur(e)||e.kind!==`task.updated`&&e.kind!==`tool.progress`&&e.kind!==`context-window.updated`&&e.kind!==`turn.plan.updated`&&e.summary!==`Checkpoint captured`&&(Xr(e)||Wr(e)||r.push(Qr(e))))}return ti(r)}function Xr(e){return e.kind===`runtime.warning`&&e.summary.endsWith(`(no displayable text content)`)}function Zr(e){if(!e)return;let t=e.status;if(t===`inProgress`||t===`completed`||t===`failed`||t===`declined`||t===`stopped`)return t}function Qr(e){let t=_r.get(e);if(t)return t;let n=e.payload&&typeof e.payload==`object`?e.payload:null,r=bi(n),i=Li(n),a=xi(n),o=e.kind===`task.started`||e.kind===`task.progress`||e.kind===`task.completed`,s=o&&typeof n?.summary==`string`&&n.summary.length>0?n.summary:null,c=o&&!s&&typeof n?.detail==`string`&&n.detail.length>0?n.detail:null,l=s||c,u=o?!c&&n&&typeof n.detail==`string`&&n.detail.length>0?Mi(n.detail).output:null:ji(n,a??e.summary),d=o?null:Si(n),f={id:e.id,createdAt:e.createdAt,turnId:e.turnId,label:l||Tn(e.summary),tone:e.kind===`task.progress`?`thinking`:e.tone===`approval`?`info`:e.tone,sourceActivityKind:e.kind};if(e.kind===`reasoning.completed`||e.kind===`reasoning.updated`){f.tone=`thinking`;let t=typeof n?.text==`string`?n.text:``,r=gn(n);f.reasoning={text:t,durationMs:e.kind===`reasoning.completed`&&typeof n?.durationMs==`number`?n.durationMs:null,...r.sections.length>0?{sections:r.sections}:{}};let i=e.kind===`reasoning.updated`;f.label=On({live:i,text:i?``:t,fields:r,fallback:i?`Thinking`:f.label})}e.kind===`tool.started`&&(f.label=f.label.replace(/ started$/u,``));let p=Ni(n),m=Pi(n);u&&(f.detail=u),r.command&&(f.command=r.command),r.rawCommand&&(f.rawCommand=r.rawCommand),i.length>0&&(f.changedFiles=i),a&&(f.toolTitle=Tn(a));let h=Y(n?.data),g=Y(h?.diffStats);typeof g?.additions==`number`&&typeof g?.deletions==`number`&&(f.diffStats={additions:g.additions,deletions:g.deletions});let _=X(h?.diff);_&&(f.diff=_);let v=X(h?.output);v&&(f.output=v),typeof h?.exitCode==`number`&&(f.exitCode=h.exitCode);let y=xn(h?.kind);if(y)f.toolKind=y;else if(e.kind.startsWith(`tool.`)&&h?.item===void 0){let t=Cn(a??e.summary.replace(/ started$/u,``));t&&(f.toolKind=t.kind,f.toolTitle=t.title,f.label=t.title,t.keepsDetail||delete f.detail)}if(p===`mcp_tool_call`){let e=Y(n?.data);e?.item!==void 0&&(f.toolData=e.item)}p&&(f.itemType=p),m&&(f.requestKind=m),d&&(f.toolCallId=d);let b=Zr(n);!b&&(e.kind===`tool.started`||e.kind===`reasoning.updated`)&&(b=`inProgress`),!b&&(e.kind===`tool.completed`||e.kind===`reasoning.completed`)&&(b=`completed`),b&&(f.toolLifecycleStatus=b),o&&typeof n?.taskId==`string`&&n.taskId.length>0&&(f.taskId=n.taskId),o&&typeof n?.role==`string`&&n.role.length>0&&(f.agentRole=n.role),o&&(n?.taskType===`local_workflow`||typeof n?.workflowName==`string`&&n.workflowName.length>0)&&(f.isWorkflowCoordinator=!0),o&&n&&Ht(n)&&(f.isBackgroundTask=!0);let x=ai(f);return x&&(f[gr]=x),_r.set(e,f),f}function $r(e){let t=e.taskId??``,n=t.indexOf(`:wf:`);return n===-1?e.agentSpawn?.workflowId?`wf:${e.agentSpawn.workflowId}`:e.isWorkflowCoordinator?`wf:${t}`:e.turnId?`direct:${e.turnId}`:`direct:task:${t}`:`wf:${t.slice(0,n)}`}function ei(e){if(!(e.sourceActivityKind!==`tool.started`&&e.sourceActivityKind!==`tool.updated`&&e.sourceActivityKind!==`tool.completed`))return e.toolCallId?`tool:${e.turnId??`no-turn`}:${e.toolCallId}`:void 0}function ti(e){let t=[],n=new Map,r=new Map,i=new Map;for(let a of e){if(a.taskId!==void 0&&!a.isBackgroundTask&&(a.sourceActivityKind===`task.started`||a.sourceActivityKind===`task.progress`||a.sourceActivityKind===`task.completed`)&&a.taskId!==void 0){let e=r.get(a.taskId),i=e??$r(a);e===void 0&&r.set(a.taskId,i);let o=i.startsWith(`wf:`)?i.slice(3):null,s=n.get(i);if(s!==void 0){let e=t[s],n=e.agentSpawn?.agentTaskIds.includes(a.taskId)?e.agentSpawn.agentTaskIds:[...e.agentSpawn?.agentTaskIds??[],a.taskId];t[s]={...ri(e,a),id:e.id,createdAt:e.createdAt,turnId:e.turnId??null,...e.taskId===void 0?{}:{taskId:e.taskId},label:e.label,agentSpawn:{workflowId:o,agentTaskIds:n}};continue}n.set(i,t.length),t.push({...a,agentSpawn:{workflowId:o,agentTaskIds:[a.taskId]}});continue}let e=ei(a);if(e!==void 0){let n=i.get(e),r=n===void 0?void 0:t[n];if(n!==void 0&&r&&ni(r,a)){t[n]=ri(r,a);continue}i.delete(e)}let o=t.at(-1);if(o&&ni(o,a)){let e=t.length-1,n=ei(o);n!==void 0&&i.delete(n);let r=ri(o,a);t[e]=r;let s=ei(r);s!==void 0&&i.set(s,e);continue}t.push(a),e!==void 0&&i.set(e,t.length-1)}return t}function ni(e,t){return e.sourceActivityKind!==`tool.started`&&e.sourceActivityKind!==`tool.updated`&&e.sourceActivityKind!==`tool.completed`||t.sourceActivityKind!==`tool.started`&&t.sourceActivityKind!==`tool.updated`&&t.sourceActivityKind!==`tool.completed`||e.turnId!==t.turnId||e.sourceActivityKind===`tool.completed`?!1:e[gr]!==void 0&&e[gr]===t[gr]?!0:e.toolCallId!==void 0&&t.toolCallId===void 0&&e.itemType===t.itemType&&oi(e.toolTitle??e.label)===oi(t.toolTitle??t.label)}function ri(e,t){let n=ii(e.changedFiles,t.changedFiles),r=t.detail??e.detail,i=t.command??e.command,a=t.rawCommand??e.rawCommand,o=t.toolTitle??e.toolTitle,s=t.itemType??e.itemType,c=t.requestKind??e.requestKind,l=t[gr]??e[gr],u=t.toolCallId??e.toolCallId,d=t.toolLifecycleStatus??e.toolLifecycleStatus,f=t.toolData??e.toolData,p=t.diffStats??e.diffStats,m=t.diff??e.diff,h=t.output??e.output,g=t.exitCode??e.exitCode;return{...e,...t,...p?{diffStats:p}:{},...m?{diff:m}:{},...h?{output:h}:{},...g===void 0?{}:{exitCode:g},...r?{detail:r}:{},...i?{command:i}:{},...a?{rawCommand:a}:{},...n.length>0?{changedFiles:n}:{},...o?{toolTitle:o}:{},...s?{itemType:s}:{},...c?{requestKind:c}:{},...l?{[gr]:l}:{},...u?{toolCallId:u}:{},...d===void 0?{}:{toolLifecycleStatus:d},...f===void 0?{}:{toolData:f}}}function ii(e,t){let n=[...e??[],...t??[]];return n.length===0?[]:[...new Set(n)]}function ai(e){if(e.taskId&&(e.sourceActivityKind===`task.progress`||e.sourceActivityKind===`task.completed`))return`task${e.taskId}`;if(e.sourceActivityKind!==`tool.started`&&e.sourceActivityKind!==`tool.updated`&&e.sourceActivityKind!==`tool.completed`)return;if(e.toolCallId)return`tool:${e.turnId??`no-turn`}:${e.toolCallId}`;let t=oi(e.toolTitle??e.label),n=e.detail?.trim()??``,r=e.itemType??``;if(!(t.length===0&&n.length===0&&r.length===0))return[r,t,n].join(``)}function oi(e){return e.replace(/\s+(?:complete|completed)\s*$/i,``).trim()}function si(e){return{id:e.id,createdAt:e.createdAt,updatedAt:e.updatedAt,turnId:e.turnId,planMarkdown:e.planMarkdown,implementedAt:e.implementedAt,implementationThreadId:e.implementationThreadId}}function Y(e){return e&&typeof e==`object`?e:null}function X(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function ci(e){return typeof e==`number`&&Number.isFinite(e)?e:null}function li(e){let t=e.trim();if(t.startsWith(`'`)&&t.endsWith(`'`)||t.startsWith(`"`)&&t.endsWith(`"`)){let e=t.slice(1,-1).trim();return e.length>0?e:t}return t}function ui(e){let t=li(e);if(t.length===0)return null;let n=t.replace(/\\/g,`/`).split(`/`).at(-1)?.trim()??``;return n.length>0?n.toLowerCase():null}function di(e){let t=e.trim();if(t.length===0)return null;if(t.startsWith(`"`)||t.startsWith(`'`)){let e=t.charAt(0),n=t.indexOf(e,1);return n<=0?null:{executable:t.slice(0,n+1),rest:t.slice(n+1).trim()}}let n=t.search(/\s/);return n<0?{executable:t,rest:``}:{executable:t.slice(0,n),rest:t.slice(n).trim()}}var fi=[{executables:[`pwsh`,`pwsh.exe`,`powershell`,`powershell.exe`],wrapperFlagPattern:/(?:^|\s)-command\s+/i},{executables:[`cmd`,`cmd.exe`],wrapperFlagPattern:/(?:^|\s)\/c\s+/i},{executables:[`bash`,`sh`,`zsh`],wrapperFlagPattern:/(?:^|\s)-(?:l)?c\s+/i}];function pi(e){return fi.find(t=>t.executables.includes(e))}function mi(e,t){let n=t.exec(e);if(!n)return null;let r=e.slice(n.index+n[0].length).trim();if(r.length===0)return null;let i=li(r);return i.length>0?i:null}function hi(e){let t=di(e);if(!t||t.rest.length===0)return e;let n=ui(t.executable);if(!n)return e;let r=pi(n);return r?mi(t.rest,r.wrapperFlagPattern)??e:e}function gi(e){return/[\s"'`]/.test(e)?`"${e.replace(/"/g,`\\"`)}"`:e}function _i(e){let t=X(e);if(t)return t;if(!Array.isArray(e))return null;let n=[];for(let t of e){let e=X(t);e!==null&&n.push(e)}return n.length===0?null:n.map(e=>gi(e)).join(` `)}function vi(e){let t=_i(e);return t?hi(t):null}function yi(e,t){let n=_i(e);return!n||t===null||n===t?null:n}function bi(e){let t=Y(e?.data),n=Y(t?.item),r=Y(n?.result),i=Y(n?.input),a=X(e?.itemType),o=X(e?.detail),s=[n?.command,i?.command,r?.command,t?.command,a===`command_execution`&&o?Mi(o).output:null];for(let e of s){let t=vi(e);if(t)return{command:t,rawCommand:yi(e,t)}}return{command:null,rawCommand:null}}function xi(e){return X(e?.title)}function Si(e){let t=Y(e?.data);return X(e?.toolCallId)??X(t?.toolCallId)}function Ci(e){return e.replace(/\s+/g,` `).trim()}function wi(e,t=84){return e.length<=t?e:`${e.slice(0,t-1).trimEnd()}…`}function Ti(e){let t=X(e);return t?oi(Ci(t)).toLowerCase():null}function Ei(e){let t=[];for(let n of e.split(/\r?\n/u)){let e=Ci(n);e.length>0&&t.push(e)}let n=t.find(e=>e!=="```");return n?wi(n):t.length>1?`${t.length.toLocaleString()} lines`:null}function Di(e){let t=Y(Y(e?.data)?.rawOutput);if(!t)return null;let n=ci(t.totalFiles);if(n!==null){let e=t.truncated===!0?`+`:``;return`${n.toLocaleString()} file${n===1?``:`s`}${e}`}let r=X(t.content);if(r)return Ei(r);let i=X(t.stdout);return i?Ei(i):null}function Oi(e){if(!Array.isArray(e))return null;let t=[];for(let n of e){let e=Y(n);if(e?.type!==`content`)continue;let r=Y(e.content);if(r?.type!==`text`)continue;let i=X(r.text);i&&t.push(i)}return t.length>0?t.join(`
4
+ `):null}function ki(e){let t=Y(e?.data),n=Y(t?.item),r=Y(n?.result),i=Y(t?.rawOutput),a=[],o=X(i?.stdout),s=X(i?.stderr);o&&a.push(o),s&&a.push(s);let c=[n?.aggregatedOutput,r?.content,t?.rawOutput,i?.content,a.length>0?a.join(`
5
+ `):null,i?.output,Oi(t?.content)];for(let e of c){let t=X(e);if(!t)continue;let n=Mi(t).output;if(n)return n}return null}function Ai(e,t){let n=X(Y(e?.data)?.kind)?.toLowerCase(),r=X(e?.title??t)?.toLowerCase();return Ni(e)===`command_execution`||n===`execute`||r===`terminal`||r===`ran command`}function ji(e,t){let n=X(e?.detail),r=n?Mi(n).output:null,i=Ti(t),a=Ti(r),o=Ai(e,t),s=o?bi(e):{command:null,rawCommand:null},c=s.command,l=Ti(c),u=Ti(s.rawCommand);if(r&&i!==a&&(!o||l!==a&&u!==a))return r;if(o){if(!c)return null;let t=ki(e),n=Ti(t);return t&&n!==i&&n!==l?t:null}let d=Di(e);return d&&Ti(d)!==i?d:null}function Mi(e){let t=e.trim(),n=/^(?<output>[\s\S]*?)(?:\s*<exited with exit code (?<code>\d+)>)\s*$/i.exec(t);if(!n?.groups)return{output:t.length>0?t:null};let r=Number.parseInt(n.groups.code??``,10),i=n.groups.output?.trim()??``;return{output:i.length>0?i:null,...Number.isInteger(r)?{exitCode:r}:{}}}function Ni(e){if(typeof e?.itemType==`string`&&i(e.itemType))return e.itemType}function Pi(e){return e?.requestKind===`command`||e?.requestKind===`file-read`||e?.requestKind===`file-change`?e.requestKind:jr(e?.requestType)??void 0}function Fi(e,t,n){let r=X(n);!r||t.has(r)||(t.add(r),e.push(r))}function Ii(e,t,n,r){if(r>4||t.length>=12)return;if(Array.isArray(e)){for(let i of e)if(Ii(i,t,n,r+1),t.length>=12)return;return}let i=Y(e);if(i){Fi(t,n,i.path),Fi(t,n,i.filePath),Fi(t,n,i.relativePath),Fi(t,n,i.filename),Fi(t,n,i.newPath),Fi(t,n,i.oldPath);for(let e of[`item`,`result`,`input`,`data`,`changes`,`files`,`edits`,`patch`,`patches`,`operations`])if(e in i&&(Ii(i[e],t,n,r+1),t.length>=12))return}}function Li(e){let t=[],n=new Set;return Ii(Y(e?.data),t,n,0),t}function Ri(e,t){if(e.sequence!==void 0&&t.sequence!==void 0){if(e.sequence!==t.sequence)return e.sequence-t.sequence}else if(e.sequence!==void 0)return 1;else if(t.sequence!==void 0)return-1;let n=e.createdAt.localeCompare(t.createdAt);if(n!==0)return n;let r=zi(e.kind)-zi(t.kind);return r===0?e.id.localeCompare(t.id):r}function zi(e){return e.endsWith(`.started`)||e===`tool.started`?0:e.endsWith(`.progress`)||e.endsWith(`.updated`)?1:e.endsWith(`.completed`)||e.endsWith(`.resolved`)?2:1}function Bi(e,t,n,r=[],i=[]){let a=e.map(e=>({id:e.id,kind:`message`,createdAt:e.createdAt,message:e})),o=t.map(e=>({id:e.id,kind:`proposed-plan`,createdAt:e.createdAt,proposedPlan:e})),s=n.map(e=>({id:e.id,kind:`work`,createdAt:e.createdAt,entry:e})),c=r.map(e=>({id:`app-connection:${e.requestId}`,kind:`app-connection`,createdAt:e.createdAt,request:e})),l=i.map(e=>({id:e.id,kind:`html-render`,createdAt:e.createdAt,turnId:e.turnId,htmlRender:e.htmlRender}));return[...a,...o,...s,...c,...l].toSorted((e,t)=>e.createdAt.localeCompare(t.createdAt))}function Vi(e){let t=[...e].toSorted((e,t)=>e.completedAt.localeCompare(t.completedAt)),n={};for(let e=0;e<t.length;e+=1){let r=t[e];r&&(n[r.turnId]=e+1)}return n}function Hi(e){return!e||e.status===`stopped`||e.status===`interrupted`||e.status===`error`?`disconnected`:e.status===`starting`?`connecting`:e.status===`running`?`running`:`ready`}function Ui(e){let t=(0,U.c)(6),n;bb0:{if(!e){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0],n=e;break bb0}n=e.checkpoints}let r=n,i;t[1]===r?i=t[2]:(i=Vi(r),t[1]=r,t[2]=i);let a=i,o;return t[3]!==a||t[4]!==r?(o={turnDiffSummaries:r,inferredCheckpointTurnCountByTurnId:a},t[3]=a,t[4]=r,t[5]=o):o=t[5],o}var Wi=1e3;function Gi(e){e.current&&ut.add({data:{tooltipStyle:!0},positionerProps:{anchor:e.current},timeout:Wi,title:`Copied!`})}function Ki(e,t){e.current&&ut.add({data:{tooltipStyle:!0},positionerProps:{anchor:e.current},timeout:Wi,title:`Failed to copy`,description:t.message})}var qi=L.createContext(void 0),Ji=L.createContext(void 0),Yi=L.createContext(void 0),Xi=L.createContext(``);function Zi(){let e=L.useContext(qi);if(!e)throw Error(ce(22));return e}function Qi(){let e=L.useContext(Ji);if(!e)throw Error(ce(23));return e}function $i(){let e=L.useContext(Yi);if(!e)throw Error(ce(24));return e}function ea(){return L.useContext(Xi)}var ta=(e,t)=>Object.is(e,t);function na(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function ra(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:na(t,e,n))}function ia(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:na(e,t,n))}function aa(e,t,n){return e.filter(e=>!na(t,e,n))}function oa(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}var Z=_();function sa(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function ca(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(sa(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Q(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return oa(e)}function la(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?oa(e.value):oa(e)}function ua(e,t,n){function r(){return Q(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=sa(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function da(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,Z.jsx)(L.Fragment,{children:ua(r,t,n)},i)),e),[])}var $={id:N(e=>e.id),labelId:N(e=>e.labelId),items:N(e=>e.items),selectedValue:N(e=>e.selectedValue),hasSelectionChips:N(e=>{let t=e.selectedValue;return Array.isArray(t)&&t.length>0}),hasSelectedValue:N(e=>{let{selectedValue:t,selectionMode:n}=e;return t==null?!1:n===`multiple`&&Array.isArray(t)?t.length>0:!0}),hasNullItemLabel:N((e,t)=>t?ca(e.items):!1),open:N(e=>e.open),mounted:N(e=>e.mounted),forceMounted:N(e=>e.forceMounted),inline:N(e=>e.inline),activeIndex:N(e=>e.activeIndex),selectedIndex:N(e=>e.selectedIndex),isActive:N((e,t)=>e.activeIndex===t),isSelected:N((e,t)=>{let n=e.isItemEqualToValue,r=e.selectedValue;return Array.isArray(r)?r.some(e=>na(t,e,n)):na(t,r,n)}),transitionStatus:N(e=>e.transitionStatus),popupProps:N(e=>e.popupProps),inputProps:N(e=>e.inputProps),triggerProps:N(e=>e.triggerProps),itemProps:N(e=>e.itemProps),positionerElement:N(e=>e.positionerElement),listElement:N(e=>e.listElement),triggerElement:N(e=>e.triggerElement),inputElement:N(e=>e.inputElement),inputGroupElement:N(e=>e.inputGroupElement),popupSide:N(e=>e.popupSide),openMethod:N(e=>e.openMethod),inputInsidePopup:N(e=>e.inputInsidePopup),inputOwnsFormValue:N(e=>e.inputOwnsFormValue),selectionMode:N(e=>e.selectionMode),name:N(e=>e.name),form:N(e=>e.form),disabled:N(e=>e.disabled),readOnly:N(e=>e.readOnly),required:N(e=>e.required),grid:N(e=>e.grid),virtualized:N(e=>e.virtualized),itemToStringLabel:N(e=>e.itemToStringLabel),isItemEqualToValue:N(e=>e.isItemEqualToValue),modal:N(e=>e.modal),autoHighlight:N(e=>e.autoHighlight),submitOnItemClick:N(e=>e.submitOnItemClick)};function fa(e,t){return(n,r)=>{if(n==null)return!1;let i=Q(n,t);return e.contains(i,r)}}function pa(e,t,n){return(r,i)=>{if(r==null)return!1;if(!i)return!0;let a=Q(r,t),o=n==null?``:Q(n,t);return o&&e.contains(o,i)&&o.length===i.length?!0:e.contains(a,i)}}var ma=new Map;function ha(e={}){let t={usage:`search`,sensitivity:`base`,ignorePunctuation:!0,...e},n=`${ga(e.locale)}|${JSON.stringify(t)}`,r=ma.get(n);if(r)return r;let i=new Intl.Collator(e.locale,t),a={contains(e,t,n){if(!t)return!0;let r=Q(e,n);for(let e=0;e<=r.length-t.length;e+=1)if(i.compare(r.slice(e,e+t.length),t)===0)return!0;return!1},startsWith(e,t,n){if(!t)return!0;let r=Q(e,n);return i.compare(r.slice(0,t.length),t)===0},endsWith(e,t,n){if(!t)return!0;let r=Q(e,n),a=t.length;return r.length>=a&&i.compare(r.slice(r.length-a),t)===0}};return ma.set(n,a),a}function ga(e){return Array.isArray(e)?e.map(e=>ga(e)).join(`,`):e==null?``:String(e)}var _a=ha;function va(e={}){let{multiple:t=!1,value:n,...r}=e,i=ha(r),a=L.useCallback((e,r,a)=>t?fa(i,a)(e,r):pa(i,a,n)(e,r),[i,n,t]);return L.useMemo(()=>({contains:a,startsWith:i.startsWith,endsWith:i.endsWith}),[a,i])}var ya=Symbol(`none`),ba={value:ya,index:-1};function xa(e){let{id:t,onOpenChangeComplete:n,defaultSelectedValue:r=null,selectedValue:i,onSelectedValueChange:a,defaultInputValue:o,inputValue:s,open:c,defaultOpen:l=!1,selectionMode:u=`none`,onItemHighlighted:d,name:f,form:p,disabled:h=!1,readOnly:_=!1,required:b=!1,inputRef:x,grid:re=!1,items:A,filteredItems:ie,filter:oe,openOnInputClick:ce=!0,autoHighlight:le=!1,keepHighlight:ue=!1,highlightItemOnHover:fe=!0,loopFocus:he=!0,itemToStringLabel:j,itemToStringValue:ge,isItemEqualToValue:M=ta,virtualized:_e=!1,inline:ve=!1,fillInputOnItemPress:ye=!0,modal:xe=!1,limit:N=-1,autoComplete:Te=`list`,formAutoComplete:Oe,locale:Ae,submitOnItemClick:je=!1}=e,{clearErrors:Me}=nt(),{setDirty:Ne,validityData:Pe,shouldValidateOnChange:Fe,setFilled:Ie,name:Le,disabled:Re,setTouched:ze,setFocused:Ve,validationMode:We,validation:Ge}=pe(),Ke=ke(),qe=Ue({id:t}),Je=_a({locale:Ae}),[Ze,Qe]=L.useState(!1),[$e,F]=L.useState(null),et=L.useRef([]),it=L.useRef([]),at=L.useRef(null),st=L.useRef(null),ct=L.useRef(null),lt=L.useRef(null),ut=L.useRef(null),dt=L.useRef(!0),ft=L.useRef(!1),pt=L.useRef(null),mt=L.useRef(null),ht=L.useRef(null),gt=L.useRef(ba),_t=L.useRef(null),vt=L.useRef([]),yt=L.useRef([]),bt=Re||h,xt=Le??f,I=u===`multiple`,St=u===`single`,Ct=s!==void 0||o!==void 0,wt=A!==void 0,Tt=ie!==void 0,R;R=le===`always`?`always`:le?`input-change`:!1;let[z,Et]=tt({controlled:i,default:I?r??Ye:r,name:`Combobox`,state:`selectedValue`}),Dt=L.useMemo(()=>oe===null?()=>!0:oe===void 0?St&&!Ze?pa(Je,j,z):fa(Je,j):oe,[oe,St,z,Ze,Je,j]),Ot=we(()=>Ct?o??``:St?Q(z,j):``).current,[B,kt]=tt({controlled:s,default:Ot,name:`Combobox`,state:`inputValue`}),[V,At]=tt({controlled:c,default:l,name:`Combobox`,state:`open`}),jt=sa(A),H=$e??(B===``?``:String(B).trim()),Mt=St?Q(z,j):``,Nt=St&&!Ze&&H!==``&&Mt!==``&&Mt.length===H.length&&Je.contains(Mt,H),Pt=Nt?``:H,Ft=wt&&Tt&&Nt,It=L.useMemo(()=>A?jt?A.flatMap(e=>e.items):A:Ye,[A,jt]),Lt=L.useMemo(()=>{if(ie&&!Ft)return ie;if(!A)return Ye;if(jt){let e=A,t=[],n=0;for(let r of e){if(N>-1&&n>=N)break;let e=Pt===``?r.items:r.items.filter(e=>Dt(e,Pt,j));if(e.length===0)continue;let i=N>-1?N-n:1/0,a=e.slice(0,i);if(a.length>0){let e={...r,items:a};t.push(e),n+=a.length}}return t}if(Pt===``)return N>-1?It.slice(0,N):It;let e=[];for(let t of It){if(N>-1&&e.length>=N)break;Dt(t,Pt,j)&&e.push(t)}return e},[ie,Ft,A,jt,Pt,N,Dt,j,It]),U=L.useMemo(()=>jt?Lt.flatMap(e=>e.items):Lt,[Lt,jt]),W=we(()=>new te({id:qe,labelId:void 0,selectedValue:z,open:V,filter:Dt,query:H,items:A,selectionMode:u,listRef:et,labelsRef:it,popupRef:at,emptyRef:ut,inputRef:st,startDismissRef:ct,endDismissRef:lt,keyboardActiveRef:dt,chipsContainerRef:pt,clearRef:mt,valuesRef:vt,allValuesRef:yt,selectionEventRef:ht,name:xt,form:p,disabled:bt,readOnly:_,required:b,grid:re,isGrouped:jt,virtualized:_e,openOnInputClick:ce,itemToStringLabel:j,isItemEqualToValue:M,modal:xe,autoHighlight:R,submitOnItemClick:je,hasInputValue:Ct,mounted:!1,forceMounted:!1,transitionStatus:`idle`,inline:ve,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},itemProps:ne,positionerElement:null,listElement:null,triggerElement:null,inputElement:null,inputGroupElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,inputOwnsFormValue:u===`none`,onOpenChangeComplete:n||Ce,setOpen:Ce,setInputValue:Ce,setSelectedValue:Ce,setIndices:Ce,onItemHighlighted:Ce,handleSelection:Ce,forceMount:Ce,requestSubmit:Ce})).current,G=u===`none`?B:z,Rt=L.useMemo(()=>u===`none`?G:Array.isArray(z)?z.map(e=>la(e,ge)):la(z,ge),[G,ge,u,z]),zt=P(d),Bt=P(n),Vt=k(W,$.activeIndex),Ht=k(W,$.selectedIndex),Ut=k(W,$.positionerElement),Wt=k(W,$.listElement),K=k(W,$.triggerElement),q=k(W,$.inputElement),Gt=k(W,$.inputGroupElement),J=k(W,$.inline),Kt=k(W,$.inputInsidePopup),qt=k(W,$.inputOwnsFormValue),Jt=C(K),{mounted:Yt,setMounted:Xt,transitionStatus:Zt}=T(V),{openMethod:Qt,triggerProps:$t}=D(V),en=P(()=>Rt);ot(Kt?Jt:st,qe,G,en);let tn=P(()=>{A?it.current=U.map(e=>Q(e,j)):W.set(`forceMounted`,!0)}),nn=L.useRef(z);Be(()=>{z!==nn.current&&tn()},[tn,z]);let rn=P(e=>{W.update(e);let t=e.type||`none`;if(e.activeIndex!==void 0)if(e.activeIndex===null)gt.current!==ba&&(gt.current=ba,zt(void 0,Xe(t,void 0,{index:-1})));else{let n=vt.current[e.activeIndex];gt.current={value:n,index:e.activeIndex},zt(n,Xe(t,void 0,{index:e.activeIndex}))}}),an=P((t,n)=>{if(ft.current=n.reason===v,e.onInputValueChange?.(t,n),!n.isCanceled){if(n.reason===`input-change`){let e=n.event,r=e.inputType;if(e.type===`compositionend`||r!=null&&r!==``&&r!==`insertReplacementText`){let e=t.trim()!==``;e&&Qe(!0),_t.current={hasQuery:e},e&&R&&W.state.activeIndex==null&&W.set(`activeIndex`,0)}}kt(t)}}),on=P((t,n)=>{if(V!==t&&(n.reason===`escape-key`&&wt&&U.length===0&&!W.state.emptyRef.current&&n.allowPropagation(),e.onOpenChange?.(t,n),!n.isCanceled&&(t&&I&&Kt&&!J&&$e!==null&&(Qe(!1),F(null),B!==``&&an(``,O(v,n.event))),!t&&Ze&&(St?(J||F(H),H===``&&Qe(!1)):I&&(J||F(H),Kt&&rn({activeIndex:null}),(!Kt||J)&&an(``,O(v,n.event)))),At(t),!t&&Kt&&(n.reason===`focus-out`||n.reason===`outside-press`)&&(ze(!0),Ve(!1),We===`onBlur`)))){let e=u===`none`?B:z;Ge.commit(e)}}),sn=P((e,t)=>{a?.(e,t),!t.isCanceled&&(Et(e),(u===`none`&&at.current&&ye||St&&!W.state.inputInsidePopup)&&an(Q(e,j),O(t.reason,t.event)),St&&e!=null&&t.reason!==`input-change`&&Ze&&!J&&F(H))}),cn=P((e,t)=>{let n=t;if(n===void 0){if(Vt===null)return;n=vt.current[Vt]}let r=se(e),i=ht.current??e;ht.current=null;let a=O(S,i),o=r?.closest(`a`)?.getAttribute(`href`);if(o){o.startsWith(`#`)&&on(!1,a);return}if(I){let e=Array.isArray(z)?z:[],t=ra(e,n,W.state.isItemEqualToValue)?aa(e,n,W.state.isItemEqualToValue):[...e,n];if(sn(t,a),!(st.current&&st.current.value.trim()!==``))return;W.state.inputInsidePopup?an(``,O(v,a.event)):on(!1,a)}else sn(n,a),on(!1,a)}),ln=P(()=>{if(!W.state.submitOnItemClick)return;let e=Ge.inputRef.current?.form??W.state.inputElement?.form;e&&typeof e.requestSubmit==`function`&&e.requestSubmit()}),un=P(()=>{if(Xt(!1),Bt?.(!1),Qe(!1),F(null),rn(u===`none`?{activeIndex:null,selectedIndex:null}:{activeIndex:null}),I&&st.current&&st.current.value!==``&&!ft.current&&an(``,O(v)),St)if(W.state.inputInsidePopup)st.current&&st.current.value!==``&&an(``,O(v));else{let e=Q(z,j);st.current&&st.current.value!==e&&an(e,O(e===``?v:m))}}),dn=L.useMemo(()=>J&&Ut?{current:Ut.closest(`[role="dialog"]`)}:at,[J,Ut]);g({enabled:!e.actionsRef,open:V,ref:dn,onComplete(){V||un()}}),L.useImperativeHandle(e.actionsRef,()=>({unmount:un}),[un]),Be(function(){if(V||u===`none`)return;let e=A?It:yt.current;if(I){let t=Array.isArray(z)?z:[],n=t[t.length-1],r=ia(e,n,M);rn({selectedIndex:r===-1?null:r})}else{let t=ia(e,z,M);rn({selectedIndex:t===-1?null:t})}},[V,z,A,u,It,I,M,rn]),Be(()=>{A&&(vt.current=U,et.current.length=U.length)},[A,U]),Be(()=>{let e=_t.current;if(e&&(e.hasQuery?R&&W.set(`activeIndex`,0):R===`always`&&W.set(`activeIndex`,0),_t.current=null),!V&&!J)return;let t=wt||Tt?U:vt.current,n=W.state.activeIndex;if(n==null){if(R===`always`&&t.length>0){W.set(`activeIndex`,0);return}gt.current!==ba&&(gt.current=ba,W.state.onItemHighlighted(void 0,Xe(m,void 0,{index:-1})));return}if(n>=t.length){gt.current!==ba&&(gt.current=ba,W.state.onItemHighlighted(void 0,Xe(m,void 0,{index:-1}))),W.set(`activeIndex`,null);return}let r=t[n],i=gt.current.value,a=i!==ya&&na(r,i,W.state.isItemEqualToValue);(gt.current.index!==n||!a)&&(gt.current={value:r,index:n},W.state.onItemHighlighted(r,Xe(m,void 0,{index:n})))},[Vt,R,Tt,wt,U,J,V,W]),Be(()=>{if(u===`none`){Ie(String(B)!==``);return}Ie(I?Array.isArray(z)&&z.length>0:z!=null)},[Ie,u,B,z,I]),L.useEffect(()=>{wt&&R&&U.length===0&&rn({activeIndex:null})},[wt,R,U.length,rn]),Se(H,()=>{!V||H===``||H===String(Ot)||Qe(!0)}),Se(z,()=>{if(u!==`none`&&(Me(xt),Ne(z!==Pe.initialValue),Fe()?Ge.commit(z):Ge.commit(z,!0),St&&!Ct&&!Kt)){let e=Q(z,j);B!==e&&an(e,O(m))}}),Se(B,()=>{u===`none`&&(Me(xt),Ne(B!==Pe.initialValue),Fe()?Ge.commit(B):Ge.commit(B,!0))}),Se(A,()=>{if(!St||Ct||Kt||Ze)return;let e=Q(z,j);B!==e&&an(e,O(m))});let fn=He({open:J?!0:V,onOpenChange:on,elements:{reference:Kt?K:q,floating:Ut}}),pn,mn;J||(pn=re?`grid`:`listbox`,mn=V?`true`:`false`);let hn=L.useMemo(()=>{let e=q?.tagName===`INPUT`,t=q==null||e,n=t||V,r=t?{autoComplete:`off`,spellCheck:`false`,autoCorrect:`off`,autoCapitalize:`none`}:{};return n&&(r.role=`combobox`,r[`aria-expanded`]=mn,r[`aria-haspopup`]=pn,r[`aria-controls`]=V?Wt?.id:void 0,r[`aria-autocomplete`]=Te),{reference:r,floating:{role:`presentation`}}},[q,V,mn,pn,Wt?.id,Te]),gn=de(fn,{enabled:!_&&!bt&&ce,event:`mousedown-only`,toggle:!1,touchOpenDelay:Kt?0:100,reason:me}),_n=De(fn,{enabled:!_&&!bt&&!J,outsidePressEvent:{mouse:`sloppy`,touch:`intentional`},bubbles:J?!0:void 0,outsidePress(e){let t=se(e);return!ae(K,t)&&!ae(mt.current,t)&&!ae(pt.current,t)&&!ae(Gt,t)}}),vn=w(fn,{enabled:!_&&!bt,id:qe,listRef:et,activeIndex:Vt,selectedIndex:Ht,virtual:!0,loopFocus:he,allowEscape:he&&!R,focusItemOnOpen:Ze||u===`none`&&!R?!1:`auto`,focusItemOnHover:fe,resetOnPointerLeave:!ue,cols:re?2:1,orientation:re?`horizontal`:void 0,rtl:Ke===`rtl`,disabledIndices:Ye,onNavigate(e,t){!t&&!V||Zt===`ending`||rn(t?{activeIndex:e,type:dt.current?`keyboard`:`pointer`}:{activeIndex:e})}}),yn=L.useMemo(()=>ee(vn.reference,_n.reference,gn.reference,hn.reference),[vn.reference,_n.reference,gn.reference,hn.reference]),bn=L.useMemo(()=>ee(E,vn.floating,_n.floating,hn.floating),[vn.floating,_n.floating,hn.floating]),xn=L.useMemo(()=>{let e=vn.item;return e?{...e,onFocus:void 0}:ne},[vn.item]);Ee(()=>{W.update({inline:ve,popupProps:bn,inputProps:yn,triggerProps:$t,itemProps:xn,setOpen:on,setInputValue:an,setSelectedValue:sn,setIndices:rn,onItemHighlighted:zt,handleSelection:cn,forceMount:tn,requestSubmit:ln})}),Be(()=>{W.update({id:qe,selectedValue:z,open:V,mounted:Yt,transitionStatus:Zt,items:A,inline:ve,popupProps:bn,inputProps:yn,triggerProps:$t,openMethod:Qt,itemProps:xn,selectionMode:u,name:xt,form:p,disabled:bt,readOnly:_,required:b,grid:re,isGrouped:jt,virtualized:_e,onOpenChangeComplete:Bt,openOnInputClick:ce,itemToStringLabel:j,modal:xe,autoHighlight:R,isItemEqualToValue:M,submitOnItemClick:je,hasInputValue:Ct,requestSubmit:ln,inputOwnsFormValue:u===`none`&&(ve||!W.state.inputInsidePopup)})},[W,qe,z,V,Yt,Zt,A,bn,yn,xn,Qt,$t,u,xt,bt,_,b,Ge,re,jt,_e,Bt,ce,j,xe,M,je,Ct,ve,ln,R,p]);let Sn=be(x,Ge.inputRef),Cn=L.useMemo(()=>({query:H,hasItems:wt,filteredItems:Lt,flatFilteredItems:U}),[H,wt,Lt,U]),wn=L.useMemo(()=>Array.isArray(G)?``:la(G,ge),[G,ge]),Tn=I&&Array.isArray(z)&&z.length>0,En=I||u===`none`&&qt?void 0:xt,Dn=L.useMemo(()=>!I||!Array.isArray(z)||!xt?null:z.map(e=>{let t=la(e,ge);return(0,Z.jsx)(`input`,{type:`hidden`,form:p,name:xt,value:t},t)}),[I,z,p,xt,ge]),On=(0,Z.jsxs)(L.Fragment,{children:[e.children,(0,Z.jsx)(`input`,{...Ge.getInputValidationProps({onFocus(){if(Kt){K?.focus();return}(st.current||K)?.focus()},onChange(e){if(e.nativeEvent.defaultPrevented||bt||_){e.preventBaseUIHandler?.();return}let t=e.currentTarget.value,n=O(m,e.nativeEvent);function r(){if(I)return;if(u===`none`){Ne(t!==Pe.initialValue),an(t,n),Fe()&&Ge.commit(t);return}let e=vt.current.find(e=>la(e,ge).toLowerCase()===t.toLowerCase()||Q(e,j).toLowerCase()===t.toLowerCase());e!=null&&(Ne(e!==Pe.initialValue),sn?.(e,n),Fe()&&Ge.commit(e))}A?r():(tn(),queueMicrotask(r))}}),id:qe&&En==null?`${qe}-hidden-input`:void 0,form:p,name:En,autoComplete:Oe,disabled:bt,required:b&&!Tn,readOnly:_,value:wn,ref:Sn,style:En?rt:y,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Dn]});return(0,Z.jsx)(qi.Provider,{value:W,children:(0,Z.jsx)(Ji.Provider,{value:fn,children:(0,Z.jsx)(Yi.Provider,{value:Cn,children:(0,Z.jsx)(Xi.Provider,{value:B,children:On})})})})}function Sa(e){let{multiple:t=!1,defaultValue:n,value:r,onValueChange:i,autoComplete:a,...o}=e;return(0,Z.jsx)(xa,{...o,selectionMode:t?`multiple`:`single`,selectedValue:r,defaultSelectedValue:n,onSelectedValueChange:i,formAutoComplete:a})}function Ca(e,t){return e??t}var wa={...h,...j,popupSide:e=>e?{"data-popup-side":e}:null,listEmpty:e=>e?{"data-list-empty":``}:null},Ta=L.createContext(void 0);function Ea(){return L.useContext(Ta)}var Da=L.createContext(void 0);function Oa(e){let t=L.useContext(Da);if(t===void 0&&!e)throw Error(ce(21));return t}var ka=L.forwardRef(function(e,t){let n=Zi(),{buttonRef:r,getButtonProps:i}=We({native:!1}),a=be(t,r);function o(e){n.state.setOpen(!1,O(qe,e.nativeEvent,e.currentTarget))}return(0,Z.jsx)(`span`,{ref:a,...i({onClick:o}),"aria-label":`Dismiss`,tabIndex:void 0,style:rt})}),Aa=L.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,id:a,style:o,...s}=e,{state:c,disabled:l,setTouched:u,setFocused:d,validationMode:p,validation:h}=pe(),{labelId:g}=Oe(),_=Ea(),y=!!Oa(!0),x=Zi(),{filteredItems:S}=$i(),C=ea(),w=ke(),ee=k(x,$.required),te=k(x,$.disabled),T=k(x,$.readOnly),E=k(x,$.name),ne=k(x,$.form),D=k(x,$.selectionMode),ie=k(x,$.autoHighlight),ae=k(x,$.inputProps),oe=k(x,$.triggerProps),se=k(x,$.open),ce=k(x,$.mounted),ue=k(x,$.selectedValue),de=k(x,$.popupSide),me=k(x,$.positionerElement),he=k(x,$.id),j=k(x,$.inline),ge=k(x,$.modal),M=!!ie,_e=ce&&me?de:null,ve=l||te||i,be=S.length===0,xe=y||j,Se=!xe||ge,Ce=re(a??(xe?void 0:he)),N=Ca(g,void 0),we=y?b:c,[Te,Ee]=L.useState(null),De=L.useRef(!1),je=L.useRef(null),Me=L.useRef(!1),Ne=D===`none`&&!y,Pe=P(e=>{let t=y||x.state.inline;t&&!x.state.hasInputValue&&x.state.setInputValue(``,O(m)),x.update({inputElement:e,inputInsidePopup:t,inputOwnsFormValue:Ne})}),Fe=y||!h?s:h.getValidationProps(s),Ie={...we,open:se,disabled:ve,readOnly:T,popupSide:_e,listEmpty:be};function Le(e){if(!_)return;let t,{highlightedChipIndex:n}=_,r=_.chipsRef.current.length,i=w===`rtl`,a=i?`ArrowRight`:`ArrowLeft`,o=i?`ArrowLeft`:`ArrowRight`;if(n!==void 0){if(e.key===a)e.preventDefault(),t=n>0?n-1:void 0;else if(e.key===o)e.preventDefault(),t=n<r-1?n+1:void 0;else if(e.key===`Backspace`||e.key===`Delete`){e.preventDefault();let r=n>=ue.length-1?ue.length-2:n;t=r>=0?r:void 0,x.state.setIndices({activeIndex:null,selectedIndex:null,type:`keyboard`})}return t}return e.key===a&&(e.currentTarget.selectionStart??0)===0&&ue.length>0?(e.preventDefault(),t=r>0?r-1:void 0):e.key===`Backspace`&&e.currentTarget.value===``&&ue.length>0&&(x.state.setIndices({activeIndex:null,selectedIndex:null,type:`keyboard`}),e.preventDefault()),t}let ze=ye(`input`,e,{state:Ie,ref:[t,x.state.inputRef,Pe],props:[ae,oe,{type:`text`,value:e.value??Te??C,"aria-readonly":T||void 0,"aria-required":ee||void 0,"aria-labelledby":N,disabled:ve,readOnly:T,required:D===`none`?ee:void 0,form:ne,...Ne&&E&&{name:E},id:Ce,onFocus(){if(d(!0),!j||!Me.current)return;Me.current=!1;let e=je.current;e==null||!Object.hasOwn(x.state.valuesRef.current,e)||x.state.setIndices({activeIndex:e})},onBlur(){u(!0),d(!1);let e=x.state.activeIndex;if(j&&e!==null&&ie!==`always`&&(je.current=e,Me.current=!0,x.state.setIndices({activeIndex:null})),p===`onBlur`){let e=D===`none`?C:ue;h.commit(e)}},onCompositionStart(e){le||(De.current=!0,Ee(e.currentTarget.value))},onCompositionEnd(e){De.current=!1;let t=e.currentTarget.value;Ee(null),x.state.setInputValue(t,O(fe,e.nativeEvent))},onChange(e){let t=e.nativeEvent.inputType,n=!t||t===`insertReplacementText`,r=De.current||!n;if(De.current){let t=e.currentTarget.value;Ee(t),t===``&&!x.state.openOnInputClick&&!x.state.inputInsidePopup&&x.state.setOpen(!1,O(v,e.nativeEvent));let n=t.trim(),i=M&&n!==``;!T&&!ve&&n&&r&&(x.state.setOpen(!0,O(fe,e.nativeEvent)),M||x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?`keyboard`:`pointer`})),se&&x.state.activeIndex!==null&&!i&&x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?`keyboard`:`pointer`});return}x.state.setInputValue(e.currentTarget.value,O(fe,e.nativeEvent));let i=e.currentTarget.value===``,a=O(v,e.nativeEvent);i&&!x.state.inputInsidePopup&&(D===`single`&&x.state.setSelectedValue(null,a),x.state.openOnInputClick||x.state.setOpen(!1,a));let o=e.currentTarget.value.trim();!T&&!ve&&o&&r&&(x.state.setOpen(!0,O(fe,e.nativeEvent)),M||x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?`keyboard`:`pointer`})),se&&x.state.activeIndex!==null&&!M&&x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?`keyboard`:`pointer`})},onKeyDown(e){if(ve||T||e.ctrlKey||e.shiftKey||e.altKey||e.metaKey)return;x.state.keyboardActiveRef.current=!0;let t=e.currentTarget,n=t.scrollWidth-t.clientWidth,r=w===`rtl`;if(e.key===`Home`){A(e);let n=f&&r?t.value.length:0;t.setSelectionRange(n,n),t.scrollLeft=0;return}if(e.key===`End`){A(e);let i=f&&r?0:t.value.length;t.setSelectionRange(i,i),t.scrollLeft=r?-n:n;return}if(!ce&&e.key===`Escape`){let t=D===`multiple`&&Array.isArray(ue)?ue.length===0:ue===null,n=O(Re,e.nativeEvent),r=D===`multiple`?[]:null;x.state.setInputValue(``,n),x.state.setSelectedValue(r,n),!t&&!x.state.inline&&!n.isPropagationAllowed&&e.stopPropagation();return}if(_&&e.key===`Backspace`&&t.value===``&&_.highlightedChipIndex===void 0&&Array.isArray(ue)&&ue.length>0){let t=_.chipsRef.current.length,n=t>0?t-1:ue.length-1,r=ue.filter((e,t)=>t!==n);x.state.setIndices({activeIndex:null,selectedIndex:null,type:x.state.keyboardActiveRef.current?`keyboard`:`pointer`}),x.state.setSelectedValue(r,O(m,e.nativeEvent));return}let i=_?.highlightedChipIndex!==void 0,a=Le(e);if(_?.setHighlightedChipIndex(a),a===void 0?i&&x.state.inputRef.current?.focus():_?.chipsRef.current[a]?.focus(),e.which!==229&&e.key===`Enter`&&se){let t=x.state.activeIndex,n=e.nativeEvent;if(t===null){if(j)return;x.state.setOpen(!1,O(m,n));return}A(e);let r=x.state.listRef.current[t];r&&(x.state.selectionEventRef.current=n,r.click(),x.state.selectionEventRef.current=null)}},onPointerMove(){x.state.keyboardActiveRef.current=!1},onPointerDown(){x.state.keyboardActiveRef.current=!1}},Fe],stateAttributesMapping:wa}),Be=y?(0,Z.jsx)(at.Provider,{value:Ae,children:ze}):ze;return(0,Z.jsxs)(L.Fragment,{children:[se&&Se&&(0,Z.jsx)(ka,{ref:x.state.startDismissRef}),Be]})}),ja=2,Ma=L.forwardRef(function(e,t){let{render:n,className:r,nativeButton:i=!0,disabled:a=!1,id:o,style:s,...c}=e,{state:l,disabled:u,setTouched:d,setFocused:f,validationMode:p,validation:m}=pe(),{labelId:h}=Oe(),g=Zi(),{filteredItems:_}=$i(),v=k(g,$.selectionMode),y=k(g,$.disabled),b=k(g,$.readOnly),x=k(g,$.required),S=k(g,$.mounted),C=k(g,$.popupSide),w=k(g,$.positionerElement),ee=k(g,$.listElement),te=k(g,$.triggerProps),T=k(g,$.triggerElement),E=k(g,$.inputInsidePopup),ne=k(g,$.id),re=k(g,$.labelId),D=k(g,$.open),ie=k(g,$.selectedValue),ce=k(g,$.activeIndex),le=k(g,$.selectedIndex),ue=k(g,$.hasSelectedValue),fe=Qi(),me=ea(),j=ct(),M=u||y||a,_e=_.length===0,ve=S&&w?C:null;Ue({id:E?o:void 0});let be=E?o??ne:o,xe=Ca(h,re),Se=L.useRef(``);function Ce(e){Se.current=e.pointerType}let N=fe.useState(`domReferenceElement`);L.useEffect(()=>{E&&T&&T!==N&&fe.set(`domReferenceElement`,T)},[T,N,fe,E]);let{reference:we}=ge(fe,{enabled:!D&&!b&&!y&&v===`single`,listRef:g.state.labelsRef,activeIndex:ce,selectedIndex:le,onMatch(e){let t=g.state.valuesRef.current[e];t!==void 0&&g.state.setSelectedValue(t,O(`none`))}}),{reference:Te}=de(fe,{enabled:!b&&!y,event:`mousedown`}),{buttonRef:Ee,getButtonProps:De}=We({native:i,disabled:M}),ke={...l,open:D,disabled:M,popupSide:ve,listEmpty:_e,placeholder:v===`none`?!1:!ue};return ye(`button`,e,{ref:[t,Ee,P(e=>{g.set(`triggerElement`,e)})],state:ke,props:[te,Te,we,{id:be,tabIndex:E?0:-1,role:E?`combobox`:void 0,"aria-expanded":D?`true`:`false`,"aria-haspopup":E?`dialog`:`listbox`,"aria-controls":D?ee?.id:void 0,"aria-required":E&&x||void 0,"aria-labelledby":xe,onPointerDown:Ce,onPointerEnter:Ce,onFocus(){f(!0),!(M||b)&&j.start(0,g.state.forceMount)},onBlur(e){if(!ae(w,e.relatedTarget)&&(d(!0),f(!1),p===`onBlur`)){let e=v===`none`?me:ie;m.commit(e)}},onMouseDown(e){if(M||b||(E||fe.set(`domReferenceElement`,e.currentTarget),g.state.forceMount(),Se.current!==`touch`&&(g.state.inputRef.current?.focus(),E||e.preventDefault()),D))return;let t=he(e.currentTarget);function n(e){if(!T)return;let t=se(e),n=g.state.positionerElement,r=g.state.listElement;if(ae(T,t)||ae(n,t)||ae(r,t)||t===T)return;let i=Ze(T),a=e.clientX>=i.left-ja&&e.clientX<=i.right+ja,o=e.clientY>=i.top-ja&&e.clientY<=i.bottom+ja;a&&o||g.state.setOpen(!1,O(`cancel-open`,e))}E&&t.addEventListener(`mouseup`,n,{once:!0})},onKeyDown(e){M||b||(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(A(e),g.state.setOpen(!0,O(oe,e.nativeEvent)),g.state.inputRef.current?.focus())}},m?m.getValidationProps(c):c,De],stateAttributesMapping:wa})}),Na=L.createContext(null);function Pa(){return L.useContext(Na)}function Fa(e){let{children:t,items:n}=e,r=L.useMemo(()=>({items:n}),[n]);return(0,Z.jsx)(Na.Provider,{value:r,children:t})}function Ia(e){let{children:t}=e,{filteredItems:n}=$i(),r=Pa(),i=r?r.items:n;return i?(0,Z.jsx)(L.Fragment,{children:i.map(t)}):null}var La=L.forwardRef(function(e,t){var n;let{render:r,className:i,style:a,children:o,...s}=e,c=Zi(),l=Qi(),u=!!Oa(!0),{filteredItems:d,hasItems:f}=$i(),p=k(c,$.selectionMode),m=k(c,$.grid),h=k(c,$.popupProps),g=k(c,$.virtualized),_=p===`multiple`,v=d.length===0,y=P(e=>{c.set(`positionerElement`,e)}),b=P(e=>{c.set(`listElement`,e)}),x=L.useMemo(()=>typeof o==`function`?n||=(0,Z.jsx)(Ia,{children:o}):o,[o]),S={empty:v},C=l.useState(`floatingId`),w=ye(`div`,e,{state:S,ref:[t,b,u?null:y],props:[h,{children:x,tabIndex:-1,id:C,role:m?`grid`:`listbox`,"aria-multiselectable":_?`true`:void 0,onKeyDown(e){if(!(c.state.disabled||c.state.readOnly)&&e.key===`Enter`){let t=c.state.activeIndex;if(t==null)return;A(e);let n=e.nativeEvent,r=c.state.listRef.current[t];r&&(c.state.selectionEventRef.current=n,r.click(),c.state.selectionEventRef.current=null)}},onKeyDownCapture(){c.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){c.state.keyboardActiveRef.current=!1}},s]});return g?w:(0,Z.jsx)(Ge,{elementsRef:c.state.listRef,labelsRef:f?void 0:c.state.labelsRef,children:w})}),Ra=`⁠`;function za(e){let t=e.ownerDocument.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=null;for(;t.nextNode();){let e=t.currentNode;e.nodeValue!==``&&(n=e)}return n}function Ba(){let e=ct(),t=L.useRef(null);return L.useEffect(()=>{if(Pe)return;let n=t.current;if(n==null)return;let r=za(n);if(r==null)return;let i=r.nodeValue??``,a=`${i}${Ra}`;return r.nodeValue=a,e.start(200,()=>{r.nodeValue===a&&(r.nodeValue=i)}),()=>{e.clear(),r.nodeValue===a&&(r.nodeValue=i)}},[t,e]),t}var Va=L.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e;return ye(`div`,e,{ref:[t,Ba()],props:[{children:a,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})}),Ha=L.createContext(void 0);function Ua(){let e=L.useContext(Ha);if(e===void 0)throw Error(ce(20));return e}var Wa=L.forwardRef(function(e,t){let{keepMounted:n=!1,...r}=e,i=Zi(),a=k(i,$.mounted),o=k(i,$.forceMounted);return a||n||o?(0,Z.jsx)(Ha.Provider,{value:n,children:(0,Z.jsx)(Ve,{ref:t,...r})}):null}),Ga=L.forwardRef(function(e,t){let{render:n,className:r,anchor:i,positionMethod:a=`absolute`,side:o=`bottom`,align:s=`center`,sideOffset:c=0,alignOffset:l=0,collisionBoundary:u=`clipping-ancestors`,collisionPadding:d=5,arrowPadding:f=5,sticky:p=!1,disableAnchorTracking:m=!1,collisionAvoidance:h=je,style:g,..._}=e,v=Zi(),{filteredItems:y}=$i(),b=Qi(),x=Ua(),S=k(v,$.modal),C=k(v,$.open),w=k(v,$.mounted),ee=k(v,$.openMethod),te=k(v,$.positionerElement),T=k(v,$.triggerElement),E=k(v,$.inputElement),ne=k(v,$.inputGroupElement),re=k(v,$.inputInsidePopup),D=k(v,$.transitionStatus),O=y.length===0,A=Qe({anchor:i??(re?T:ne??E),floatingRootContext:b,positionMethod:a,mounted:w,side:o,sideOffset:c,align:s,alignOffset:l,arrowPadding:f,collisionBoundary:u,collisionPadding:d,sticky:p,disableAnchorTracking:m,keepMounted:x,collisionAvoidance:h,lazyFlip:!0});ue(C&&S,ee===`touch`,te,T);let ie={open:C,side:A.side,align:A.align,anchorHidden:A.anchorHidden,empty:O};Be(()=>{v.set(`popupSide`,A.side)},[v,A.side]);let ae=P(e=>{v.set(`positionerElement`,e)}),oe=Fe(e,ie,{styles:A.positionerStyles,transitionStatus:D,props:_,refs:[t,ae],hidden:!w,inert:!C});return(0,Z.jsxs)(Da.Provider,{value:A,children:[w&&S&&(0,Z.jsx)(et,{inert:Ke(!C),cutout:ne??E??T}),oe]})}),Ka={...st,...M},qa=L.forwardRef(function(e,t){let{render:n,className:r,style:i,initialFocus:a,finalFocus:o,...s}=e,c=Zi(),l=Oa(),u=Qi(),{filteredItems:d}=$i(),f=k(c,$.mounted),m=k(c,$.open),h=k(c,$.openMethod),_=k(c,$.transitionStatus),v=k(c,$.inputInsidePopup),y=k(c,$.inputElement),b=k(c,$.modal),x=d.length===0;g({open:m,ref:c.state.popupRef,onComplete(){m&&c.state.onOpenChangeComplete(!0)}});let S=ye(`div`,e,{state:{open:m,side:l.side,align:l.align,anchorHidden:l.anchorHidden,transitionStatus:_,empty:x},ref:[t,c.state.popupRef],props:[{role:v?`dialog`:`presentation`,tabIndex:-1,onFocus(e){let t=se(e.nativeEvent);h!==`touch`&&(ae(c.state.listElement,t)||t===e.currentTarget)&&c.state.inputRef.current?.focus()}},$e(_),s],stateAttributesMapping:Ka}),C=a===void 0?v?e=>e===`touch`?c.state.popupRef.current:y:!1:a,w;w=o??(v?void 0:!1);let ee=!v||b;return(0,Z.jsx)(p,{context:u,disabled:!f,modal:ee,openInteractionType:h,initialFocus:C,returnFocus:w,getInsideElements:()=>[c.state.startDismissRef.current,c.state.endDismissRef.current],children:(0,Z.jsxs)(L.Fragment,{children:[S,ee&&(0,Z.jsx)(ka,{ref:c.state.endDismissRef})]})})}),Ja=L.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e;return ye(`span`,e,{ref:t,props:[{"aria-hidden":!0,children:`▼`},a]})}),Ya=e(ie()),Xa=L.createContext(void 0),Za=L.createContext(!1);function Qa(){return L.useContext(Za)}var $a=L.memo(L.forwardRef(function(e,t){let{render:n,className:r,style:i,value:a=null,index:o,disabled:s=!1,nativeButton:c=!1,...l}=e,u=L.useRef(!1),d=L.useRef(null),f=Te({index:o,textRef:d,indexGuessBehavior:xe.GuessFromOrder}),p=Zi(),m=Qa(),{flatFilteredItems:h,hasItems:g}=$i(),_=k(p,$.open),v=k(p,$.selectionMode),y=k(p,$.readOnly),b=k(p,$.virtualized),x=k(p,$.isItemEqualToValue),S=v!==`none`,C=o??(b?ia(h,a,x):f.index),w=f.index!==-1,ee=k(p,$.id),te=k(p,$.isActive,C),T=k(p,$.isSelected,a),E=k(p,$.itemProps),ne=L.useRef(null),re=ee!=null&&w?`${ee}-${C}`:void 0,D=T&&S;Be(()=>{if(!(w&&(b||o!=null)))return;let e=p.state.listRef.current;return e[C]=ne.current,()=>{delete e[C]}},[w,b,C,o,p]),Be(()=>{if(!w||g)return;let e=p.state.valuesRef.current;return e[C]=a,v!==`none`&&p.state.allValuesRef.current.push(a),()=>{delete e[C]}},[w,g,C,a,p,v]),Be(()=>{if(!_){u.current=!1;return}if(!w||g)return;let e=p.state.selectedValue,t=Array.isArray(e)?e[e.length-1]:e;na(a,t,x)&&p.set(`selectedIndex`,C)},[w,g,_,p,C,a,x]);let{getButtonProps:O,buttonRef:A}=We({disabled:s,focusableWhenDisabled:!0,native:c,composite:!0}),ie={disabled:s,selected:D,highlighted:te};function ae(e){function t(){p.state.handleSelection(e,a)}p.state.submitOnItemClick?(Ya.flushSync(t),p.state.requestSubmit()):t()}let oe={id:re,role:m?`gridcell`:`option`,"aria-selected":S?D:void 0,tabIndex:void 0,onPointerDownCapture(e){u.current=!0,e.preventDefault()},onMouseDown(e){e.preventDefault()},onClick(e){s||y||ae(e.nativeEvent)},onMouseUp(e){let t=u.current;u.current=!1,!(s||y||e.button!==0||t||!te)&&ae(e.nativeEvent)}},se=ye(`div`,e,{ref:[A,t,f.ref,ne],state:ie,props:[E,oe,l,O]}),ce=L.useMemo(()=>({selected:D,textRef:d}),[D,d]);return(0,Z.jsx)(Xa.Provider,{value:ce,children:se})})),eo=L.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,...o}=e,{filteredItems:s}=$i(),c=Zi(),l=Ba(),u=s.length===0?a:null;return ye(`div`,e,{ref:[t,c.state.emptyRef,l],props:[{children:u,role:`status`,"aria-live":`polite`,"aria-atomic":!0},o]})}),to={...M,...ve},no=L.forwardRef(function(e,t){let{render:n,className:r,disabled:i=!1,nativeButton:a=!0,keepMounted:o=!1,style:s,...c}=e,{disabled:l}=pe(),u=Zi(),d=k(u,$.selectionMode),f=k(u,$.disabled),p=k(u,$.readOnly),m=k(u,$.open),h=k(u,$.selectedValue),_=k(u,$.hasSelectionChips),v=ea(),y=!1;y=d===`none`?v!==``:d===`single`?h!=null:_;let b=l||f||i,{buttonRef:x,getButtonProps:S}=We({native:a,disabled:b}),{mounted:C,transitionStatus:w,setMounted:ee}=T(y),te={disabled:b,visible:y,open:m,transitionStatus:w};g({open:y,ref:u.state.clearRef,onComplete(){y||ee(!1)}});let E=ye(`button`,e,{state:te,ref:[t,x,u.state.clearRef],props:[{tabIndex:-1,children:`x`,onMouseDown(e){e.preventDefault()},onClick(e){if(b||p)return;let t=u.state.keyboardActiveRef;u.state.setInputValue(``,O(Ie,e.nativeEvent)),d===`none`?u.state.setIndices({activeIndex:null,type:t.current?`keyboard`:`pointer`}):(u.state.setSelectedValue(Array.isArray(h)?[]:null,O(Ie,e.nativeEvent)),u.state.setIndices({activeIndex:null,selectedIndex:null,type:t.current?`keyboard`:`pointer`})),u.state.inputRef.current?.focus()}},c,S],stateAttributesMapping:to});return o||C?E:null}),ro=L.createContext({chipsRef:null,multiple:!1});function io(e){let t=(0,U.c)(7),n=L.useRef(null),r=!!e.multiple,i;t[0]===r?i=t[1]:(i={chipsRef:n,multiple:r},t[0]=r,t[1]=i);let a=i,o;t[2]===e?o=t[3]:(o=(0,Z.jsx)(Sa,{...e}),t[2]=e,t[3]=o);let s;return t[4]!==o||t[5]!==a?(s=(0,Z.jsx)(ro,{value:a,children:o}),t[4]=o,t[5]=a,t[6]=s):s=t[6],s}function ao(e){let t=(0,U.c)(36),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:n,inputClassName:r,showTrigger:s,showClear:c,startAddon:o,size:a,unstyled:l,...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,t[8]=l);let u=s===void 0?!0:s,d=c===void 0?!1:c,f=l===void 0?!1:l,p=a??`default`,m;t[9]===o?m=t[10]:(m=o&&(0,Z.jsx)(`div`,{"aria-hidden":`true`,className:`[&_svg]:-mx-0.5 pointer-events-none absolute inset-y-0 start-px z-10 flex items-center ps-[calc(--spacing(3)-1px)] opacity-80 has-[+[data-size=sm]]:ps-[calc(--spacing(2.5)-1px)] [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4`,"data-slot":`combobox-start-addon`,children:o}),t[9]=o,t[10]=m);let h=o&&`data-[size=sm]:*:data-[slot=combobox-input]:ps-[calc(--spacing(7.5)-1px)] *:data-[slot=combobox-input]:ps-[calc(--spacing(8.5)-1px)] sm:data-[size=sm]:*:data-[slot=combobox-input]:ps-[calc(--spacing(7)-1px)] sm:*:data-[slot=combobox-input]:ps-[calc(--spacing(8)-1px)]`,g=p===`sm`?`has-[+[data-slot=combobox-trigger],+[data-slot=combobox-clear]]:*:data-[slot=combobox-input]:pe-6.5`:`has-[+[data-slot=combobox-trigger],+[data-slot=combobox-clear]]:*:data-[slot=combobox-input]:pe-7`,_;t[11]!==n||t[12]!==h||t[13]!==g?(_=F(h,g,n),t[11]=n,t[12]=h,t[13]=g,t[14]=_):_=t[14];let v;t[15]===r?v=t[16]:(v=F(`has-disabled:opacity-100`,r),t[15]=r,t[16]=v);let y;t[17]!==p||t[18]!==v||t[19]!==f?(y=(0,Z.jsx)(I,{className:v,nativeInput:!0,size:p,unstyled:f}),t[17]=p,t[18]=v,t[19]=f,t[20]=y):y=t[20];let b;t[21]!==i||t[22]!==_||t[23]!==y?(b=(0,Z.jsx)(Aa,{className:_,"data-slot":`combobox-input`,render:y,...i}),t[21]=i,t[22]=_,t[23]=y,t[24]=b):b=t[24];let x;t[25]!==u||t[26]!==p?(x=u&&(0,Z.jsx)(oo,{className:F(`-translate-y-1/2 absolute top-1/2 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-opacity pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 has-[+[data-slot=combobox-clear]]:hidden sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,p===`sm`?`end-0`:`end-0.5`),children:(0,Z.jsx)(Ja,{"data-slot":`combobox-icon`,children:(0,Z.jsx)(_t,{})})}),t[25]=u,t[26]=p,t[27]=x):x=t[27];let S;t[28]!==d||t[29]!==p?(S=d&&(0,Z.jsx)(mo,{className:F(`-translate-y-1/2 absolute top-1/2 inline-flex size-8 shrink-0 cursor-pointer items-center justify-center rounded-md border border-transparent opacity-80 outline-none transition-opacity pointer-coarse:after:absolute pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 hover:opacity-100 has-[+[data-slot=combobox-clear]]:hidden sm:size-7 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,p===`sm`?`end-0`:`end-0.5`),children:(0,Z.jsx)(mt,{})}),t[28]=d,t[29]=p,t[30]=S):S=t[30];let C;return t[31]!==b||t[32]!==x||t[33]!==S||t[34]!==m?(C=(0,Z.jsxs)(`div`,{className:`relative not-has-[>*.w-full]:w-fit w-full text-foreground has-disabled:opacity-64`,children:[m,b,x,S]}),t[31]=b,t[32]=x,t[33]=S,t[34]=m,t[35]=C):C=t[35],C}function oo(e){let t=(0,U.c)(8),n,r,i;t[0]===e?(n=t[1],r=t[2],i=t[3]):({className:r,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i);let a;return t[4]!==n||t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Ma,{className:r,"data-slot":`combobox-trigger`,...i,children:n}),t[4]=n,t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function so(e){let t=(0,U.c)(24),n,r,i,a,o,s,c,l;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7],l=t[8]):({className:a,children:i,side:s,sideOffset:c,alignOffset:n,align:l,anchor:r,...o}=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,t[8]=l);let u=s===void 0?`bottom`:s,d=c===void 0?4:c,f=l===void 0?`start`:l,{chipsRef:p}=L.use(ro),m=r??p,h;t[9]===a?h=t[10]:(h=F(`dropdown-glass relative flex max-h-full min-w-(--anchor-width) max-w-(--available-width) origin-(--transform-origin) rounded-lg shadow-[0_16px_40px_-18px_rgb(0_0_0/55%)] transition-[scale,opacity] dark:shadow-[0_18px_44px_-18px_rgb(0_0_0/80%)]`,a),t[9]=a,t[10]=h);let g;t[11]!==i||t[12]!==o?(g=(0,Z.jsx)(qa,{className:`flex min-w-0 max-h-[min(var(--available-height),23rem)] flex-1 flex-col overflow-hidden text-foreground`,"data-slot":`combobox-popup`,...o,children:i}),t[11]=i,t[12]=o,t[13]=g):g=t[13];let _;t[14]!==h||t[15]!==g?(_=(0,Z.jsx)(`span`,{className:h,children:g}),t[14]=h,t[15]=g,t[16]=_):_=t[16];let v;return t[17]!==f||t[18]!==n||t[19]!==m||t[20]!==u||t[21]!==d||t[22]!==_?(v=(0,Z.jsx)(Wa,{children:(0,Z.jsx)(Ga,{align:f,alignOffset:n,anchor:m,className:`z-[130] select-none`,"data-slot":`combobox-positioner`,side:u,sideOffset:d,children:_})}),t[17]=f,t[18]=n,t[19]=m,t[20]=u,t[21]=d,t[22]=_,t[23]=v):v=t[23],v}function co(e){let t=(0,U.c)(17),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,contentClassName:i,children:n,hideIndicator:o,...a}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s;t[6]===r?s=t[7]:(s=F(`flex min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-pointer items-center rounded-sm px-2 py-1 text-base outline-none hover:bg-accent data-disabled:pointer-events-none data-disabled:cursor-not-allowed data-selected:bg-foreground/[0.08] data-selected:text-foreground data-highlighted:bg-accent data-highlighted:text-accent-foreground [&[data-highlighted][data-selected]]:bg-accent [&[data-highlighted][data-selected]]:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0`,r),t[6]=r,t[7]=s);let c;t[8]===i?c=t[9]:(c=F(`min-w-0 flex-1 [&_svg:not([class*='text-'])]:text-muted-foreground`,i),t[8]=i,t[9]=c);let l;t[10]!==n||t[11]!==c?(l=(0,Z.jsx)(`div`,{className:c,"data-slot":`combobox-item-content`,children:n}),t[10]=n,t[11]=c,t[12]=l):l=t[12];let u;return t[13]!==a||t[14]!==s||t[15]!==l?(u=(0,Z.jsx)($a,{className:s,"data-slot":`combobox-item`,...a,children:l}),t[13]=a,t[14]=s,t[15]=l,t[16]=u):u=t[16],u}function lo(e){let t=(0,U.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=F(`mx-2 my-1 h-px bg-border last:hidden`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(_e,{className:i,"data-slot":`combobox-separator`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function uo(e){let t=(0,U.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=F(`not-empty:p-2 text-center text-base text-muted-foreground sm:text-sm`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(eo,{className:i,"data-slot":`combobox-empty`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function fo(e){let t=(0,U.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=F(`not-empty:scroll-py-1 not-empty:px-1 not-empty:py-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(bt,{scrollbarGutter:!0,scrollFade:!0,children:(0,Z.jsx)(La,{className:i,"data-slot":`combobox-list`,...r})}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function po(e){let t=(0,U.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=F(`not-empty:px-1 not-empty:py-1`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(La,{className:i,"data-slot":`combobox-list`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}function mo(e){let t=(0,U.c)(6),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;return t[3]!==n||t[4]!==r?(i=(0,Z.jsx)(no,{className:n,"data-slot":`combobox-clear`,...r}),t[3]=n,t[4]=r,t[5]=i):i=t[5],i}function ho(e){let t=(0,U.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=F(`px-3 py-2 font-medium text-muted-foreground text-xs empty:m-0 empty:p-0`,n),t[3]=n,t[4]=i);let a;return t[5]!==r||t[6]!==i?(a=(0,Z.jsx)(Va,{className:i,"data-slot":`combobox-status`,...r}),t[5]=r,t[6]=i,t[7]=a):a=t[7],a}var go=va;export{Tr as $,ta as A,Lt as At,Pr as B,ca as C,In as Ct,la as D,rn as Dt,Q as E,$t as Et,Ki as F,Bi as G,Fr as H,Gi as I,Or as J,Yr as K,Ui as L,aa as M,H as Mt,ra as N,kt as Nt,oa as O,an as Ot,Wi as P,Dr as Q,Br as R,_a as S,Jn as St,ua as T,tn as Tt,Lr as U,qr as V,Hi as W,kr as X,Hr as Y,wr as Z,Fa as _,qn as _t,fo as a,tr as at,Ca as b,Un as bt,lo as c,cr as ct,go as d,dr as dt,br as et,no as f,kn as ft,Ia as g,En as gt,La as h,Wn as ht,co as i,rr as it,ia as j,Mt as jt,na as k,It as kt,ho as l,mr as lt,Ja as m,Mn as mt,uo as n,Xn as nt,po as o,nr as ot,$a as p,jn as pt,Vr as q,ao as r,ir as rt,so as s,fr as st,io as t,or as tt,oo as u,hr as ut,Ma as v,zn as vt,da as w,nn as wt,xa as x,Fn as xt,Aa as y,Hn as yt,Ar as z};
6
+ //# sourceMappingURL=combobox-C4C8XR-w.js.map