frizz 0.7.2 → 0.7.3

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 (90) hide show
  1. package/README.md +4 -3
  2. package/dist/frizz.js +21 -10
  3. package/package.json +1 -1
  4. package/web-dist/assets/{TerminalPane-K-DhxpCR.js → TerminalPane-Cyao7kTi.js} +1 -1
  5. package/web-dist/assets/{abnfDiagram-VRR7QNED-D1qyMYic.js → abnfDiagram-VRR7QNED-D1U0Q_zY.js} +1 -1
  6. package/web-dist/assets/architecture-TIHT7OUA-BS8x9TQa.js +1 -0
  7. package/web-dist/assets/{architectureDiagram-ZJ3FMSHR-B7OHBGs-.js → architectureDiagram-ZJ3FMSHR-CtUBwBcU.js} +1 -1
  8. package/web-dist/assets/{blockDiagram-677ZJIJ3-BOkbWfnO.js → blockDiagram-677ZJIJ3-OzqrN18g.js} +1 -1
  9. package/web-dist/assets/{c4Diagram-LMCZKHZV-DcfWo37Z.js → c4Diagram-LMCZKHZV-DgYAtD7L.js} +1 -1
  10. package/web-dist/assets/channel-DHZV3ADN.js +1 -0
  11. package/web-dist/assets/{chunk-32BRIVSS-DG_MDBh7.js → chunk-32BRIVSS-CKwBruPa.js} +1 -1
  12. package/web-dist/assets/{chunk-52WLFC77-HgYoNFkS.js → chunk-52WLFC77-gvoNW_ar.js} +1 -1
  13. package/web-dist/assets/{chunk-C7G6YPKG-Dfpg508V.js → chunk-C7G6YPKG-EJ5BdmRQ.js} +1 -1
  14. package/web-dist/assets/{chunk-EX3LRPZG-zaEux9Wm.js → chunk-EX3LRPZG-DJQF-VwN.js} +1 -1
  15. package/web-dist/assets/{chunk-FWX5IMBZ-CpSICFGT.js → chunk-FWX5IMBZ-CXBLvjvR.js} +2 -2
  16. package/web-dist/assets/{chunk-HOUHSVGY-CSwYs-ck.js → chunk-HOUHSVGY-De3ULdBq.js} +1 -1
  17. package/web-dist/assets/{chunk-ICXQ74PX-CkRfiAJk.js → chunk-ICXQ74PX-aUbMdGsl.js} +1 -1
  18. package/web-dist/assets/{chunk-MOJQB5TN-DFtJBynx.js → chunk-MOJQB5TN-BLK44SUW.js} +1 -1
  19. package/web-dist/assets/{chunk-OGEWGWER-B1ST2fth.js → chunk-OGEWGWER-CQZ3zQ2q.js} +1 -1
  20. package/web-dist/assets/{chunk-PUDLZKDR-B7ABSn_A.js → chunk-PUDLZKDR-DcdN44K2.js} +1 -1
  21. package/web-dist/assets/{chunk-Q4XR5HBZ-CivO3j1P.js → chunk-Q4XR5HBZ-Db2ge7fW.js} +1 -1
  22. package/web-dist/assets/{chunk-V7JOEXUC-BaM6_dmG.js → chunk-V7JOEXUC-D80jxcmB.js} +1 -1
  23. package/web-dist/assets/{chunk-VAUOI2AC-BY3O_FOQ.js → chunk-VAUOI2AC-nDGsXZZE.js} +1 -1
  24. package/web-dist/assets/{chunk-VR4S4FIN-BIV_iEar.js → chunk-VR4S4FIN-BGXgLAsD.js} +1 -1
  25. package/web-dist/assets/{chunk-WYO6CB5R-CUi65Li4.js → chunk-WYO6CB5R-BbGEK50o.js} +1 -1
  26. package/web-dist/assets/{chunk-ZGVPDNZ5-Dg0vMfMN.js → chunk-ZGVPDNZ5-CjEI23Vu.js} +1 -1
  27. package/web-dist/assets/classDiagram-OUVF2IWQ-Dcx3TDdU.js +1 -0
  28. package/web-dist/assets/classDiagram-v2-EOCWNBFH-Dcx3TDdU.js +1 -0
  29. package/web-dist/assets/{cynefin-VYW2F7L2-DWJeaT_t.js → cynefin-VYW2F7L2-CR69iDgw.js} +1 -1
  30. package/web-dist/assets/{cynefinDiagram-TSTJHNR4-ClaGZDTr.js → cynefinDiagram-TSTJHNR4-Le_FSC65.js} +1 -1
  31. package/web-dist/assets/{dagre-VKFMJZFB-C0pp3Xyc.js → dagre-VKFMJZFB-CxAlFDI9.js} +1 -1
  32. package/web-dist/assets/{diagram-FQU43EPY-SSBAJs6v.js → diagram-FQU43EPY-BFMwv6Pj.js} +1 -1
  33. package/web-dist/assets/{diagram-G47NLZAW-3GFBBF81.js → diagram-G47NLZAW-mWAc5hJ0.js} +1 -1
  34. package/web-dist/assets/{diagram-NH7WQ7WH-DqYwuzE7.js → diagram-NH7WQ7WH-CC-QXuir.js} +1 -1
  35. package/web-dist/assets/{diagram-OA4YK3LP-K6M4KioM.js → diagram-OA4YK3LP-Cqs5o39q.js} +1 -1
  36. package/web-dist/assets/{diagram-WEI45ONY-ByTNMmJD.js → diagram-WEI45ONY-B9PF6IpG.js} +1 -1
  37. package/web-dist/assets/{ebnfDiagram-CCIWWBDH-Bl6rAFTA.js → ebnfDiagram-CCIWWBDH-C1DkTGUE.js} +1 -1
  38. package/web-dist/assets/{erDiagram-Q63AITRT-BGWlKkvA.js → erDiagram-Q63AITRT-CbCG5w3K.js} +1 -1
  39. package/web-dist/assets/eventmodeling-45OFAUF4-DAhP7KCX.js +1 -0
  40. package/web-dist/assets/flowDiagram-23GEKE2U-Be2iuqwq.js +1 -0
  41. package/web-dist/assets/{ganttDiagram-NO4QXBWP-C5eEoPLo.js → ganttDiagram-NO4QXBWP-CaywKz56.js} +1 -1
  42. package/web-dist/assets/{gitGraph-TEB2WS4Q-BNmphrH5.js → gitGraph-TEB2WS4Q-DhbijOBs.js} +1 -1
  43. package/web-dist/assets/{gitGraphDiagram-IHSO6WYX-zHU_D41b.js → gitGraphDiagram-IHSO6WYX-DHngf1QZ.js} +1 -1
  44. package/web-dist/assets/{index-Kzg-vTmI.js → index-CxwWndgM.js} +4 -4
  45. package/web-dist/assets/{info-DKCQHKI2-BfD-7Xcw.js → info-DKCQHKI2-D2uo8Yq_.js} +1 -1
  46. package/web-dist/assets/{infoDiagram-FWYZ7A6U-CR3bcaik.js → infoDiagram-FWYZ7A6U-Bixn1mvJ.js} +1 -1
  47. package/web-dist/assets/{ishikawaDiagram-FXEZZL3T-VtEgUbJP.js → ishikawaDiagram-FXEZZL3T-DG48ASOp.js} +1 -1
  48. package/web-dist/assets/{journeyDiagram-5HDEW3XC-DZ3fGB6L.js → journeyDiagram-5HDEW3XC-DpQOwYAS.js} +1 -1
  49. package/web-dist/assets/{kanban-definition-HUTT4EX6-ChfTvN7D.js → kanban-definition-HUTT4EX6-Dph0AMZo.js} +1 -1
  50. package/web-dist/assets/{line-B6kig2Co.js → line-hnYRfUMr.js} +1 -1
  51. package/web-dist/assets/{mermaid-parser.core-jyk1DbDV.js → mermaid-parser.core-DdD3ClpS.js} +3 -3
  52. package/web-dist/assets/{mermaid.core-C5yyeZnx.js → mermaid.core-C2DMq9ss.js} +3 -3
  53. package/web-dist/assets/{mindmap-definition-LN4V7U3C-BcXFy-N9.js → mindmap-definition-LN4V7U3C-CirJBG-x.js} +1 -1
  54. package/web-dist/assets/{packet-7NZHBO7P-BXfwnw74.js → packet-7NZHBO7P-kD-OtFAF.js} +1 -1
  55. package/web-dist/assets/{pegDiagram-2B236MQR-BCD3YN2p.js → pegDiagram-2B236MQR-DGmi8fl-.js} +1 -1
  56. package/web-dist/assets/{pie-RZYD4A2V-AinCQhe4.js → pie-RZYD4A2V-DpKplj-N.js} +1 -1
  57. package/web-dist/assets/{pieDiagram-ENE6RG2P-D91RCAtQ.js → pieDiagram-ENE6RG2P-CW-zVLyR.js} +1 -1
  58. package/web-dist/assets/{quadrantDiagram-ABIIQ3AL-CiOs81pa.js → quadrantDiagram-ABIIQ3AL-fxSaIvo2.js} +1 -1
  59. package/web-dist/assets/{radar-I7S5WNFK-PjwSEfhJ.js → radar-I7S5WNFK-BPu7ClHP.js} +1 -1
  60. package/web-dist/assets/{railroad-3IZDKUUU-De7aPcv6.js → railroad-3IZDKUUU-CoQXFYm6.js} +1 -1
  61. package/web-dist/assets/railroad-abnf-AHOZXSZD-BiqkuXNr.js +1 -0
  62. package/web-dist/assets/railroad-ebnf-EBAXGLYW-CDaukY4Z.js +1 -0
  63. package/web-dist/assets/railroad-peg-LSFZ7HO6-CsUPdvVL.js +1 -0
  64. package/web-dist/assets/{railroadDiagram-RFXS5EU6-Ba5vfAy2.js → railroadDiagram-RFXS5EU6-Bqnz_3Bc.js} +1 -1
  65. package/web-dist/assets/{requirementDiagram-TGXJPOKE-cl6D_V6r.js → requirementDiagram-TGXJPOKE-DJHMdBhh.js} +1 -1
  66. package/web-dist/assets/{sankeyDiagram-HTMAVEWB-BiL7lO9N.js → sankeyDiagram-HTMAVEWB-BlxzmT-W.js} +1 -1
  67. package/web-dist/assets/{sequenceDiagram-DBY2YBRQ-DWwMnGgF.js → sequenceDiagram-DBY2YBRQ-BT7Rn1Uo.js} +1 -1
  68. package/web-dist/assets/{stateDiagram-2N3HPSRC-DyDSg9bX.js → stateDiagram-2N3HPSRC-CDoiFcke.js} +1 -1
  69. package/web-dist/assets/stateDiagram-v2-6OUMAXLB-DiLnjG8k.js +1 -0
  70. package/web-dist/assets/{swimlanes-5IMT3BWC-DXcDUTKt.js → swimlanes-5IMT3BWC-DtzTgSSP.js} +1 -1
  71. package/web-dist/assets/swimlanesDiagram-G3AALYLV-BqvWOcR2.js +8 -0
  72. package/web-dist/assets/{timeline-definition-FHXFAJF6-BmhB--di.js → timeline-definition-FHXFAJF6-Dn63VmSO.js} +1 -1
  73. package/web-dist/assets/{treeView-QDETBFTQ-uZOu6XJp.js → treeView-QDETBFTQ-DIfJIc9R.js} +1 -1
  74. package/web-dist/assets/{treemap-6X3UGDF4-vvG-U9_8.js → treemap-6X3UGDF4-n9Fwqngl.js} +1 -1
  75. package/web-dist/assets/{vennDiagram-L72KCM5P-1w9D4erz.js → vennDiagram-L72KCM5P-C1thEMxE.js} +1 -1
  76. package/web-dist/assets/{wardley-OPB4EBWU-BJKEDRlS.js → wardley-OPB4EBWU-Dl6RiScD.js} +1 -1
  77. package/web-dist/assets/{wardleyDiagram-EHGQE667-BZuQjgMm.js → wardleyDiagram-EHGQE667-DBelgTwB.js} +1 -1
  78. package/web-dist/assets/{xychartDiagram-FW5EYKEG-BuCgSm0a.js → xychartDiagram-FW5EYKEG-DFGVnPLj.js} +1 -1
  79. package/web-dist/index.html +1 -1
  80. package/web-dist/assets/architecture-TIHT7OUA-DhCDPuB9.js +0 -1
  81. package/web-dist/assets/channel-C0ssx150.js +0 -1
  82. package/web-dist/assets/classDiagram-OUVF2IWQ-DGsI7bj0.js +0 -1
  83. package/web-dist/assets/classDiagram-v2-EOCWNBFH-DGsI7bj0.js +0 -1
  84. package/web-dist/assets/eventmodeling-45OFAUF4-CwE_bxam.js +0 -1
  85. package/web-dist/assets/flowDiagram-23GEKE2U-BY0J247Q.js +0 -1
  86. package/web-dist/assets/railroad-abnf-AHOZXSZD-BdaR6aMg.js +0 -1
  87. package/web-dist/assets/railroad-ebnf-EBAXGLYW-BQ1i-m_V.js +0 -1
  88. package/web-dist/assets/railroad-peg-LSFZ7HO6-Bz7gY9Z5.js +0 -1
  89. package/web-dist/assets/stateDiagram-v2-6OUMAXLB-DdKoRulX.js +0 -1
  90. package/web-dist/assets/swimlanesDiagram-G3AALYLV-e28nOYgP.js +0 -8
@@ -1,4 +1,4 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPane-K-DhxpCR.js","assets/rolldown-runtime-Bh1tDfsg.js","assets/mermaid.core-C5yyeZnx.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-C4XfhTaE.js","assets/chunk-WYO6CB5R-CUi65Li4.js","assets/chunk-ICXQ74PX-CkRfiAJk.js","assets/dist-DoH_9pyS.js","assets/chunk-VAUOI2AC-BY3O_FOQ.js","assets/chunk-HOUHSVGY-CSwYs-ck.js","assets/chunk-Q4XR5HBZ-CivO3j1P.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-OGEWGWER-B1ST2fth.js","assets/chunk-C7G6YPKG-Dfpg508V.js","assets/chunk-ZGVPDNZ5-Dg0vMfMN.js","assets/rough.esm-CSKSodPl.js","assets/chunk-52WLFC77-HgYoNFkS.js","assets/line-B6kig2Co.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-FWX5IMBZ-CpSICFGT.js","assets/chunk-ZIRB5QZD-C6fEPe3t.js"])))=>i.map(i=>d[i]);
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/TerminalPane-Cyao7kTi.js","assets/rolldown-runtime-Bh1tDfsg.js","assets/mermaid.core-C2DMq9ss.js","assets/chunk-Y2CYZVJY-DsF7k-Jl.js","assets/src-C4XfhTaE.js","assets/chunk-WYO6CB5R-BbGEK50o.js","assets/chunk-ICXQ74PX-aUbMdGsl.js","assets/dist-DoH_9pyS.js","assets/chunk-VAUOI2AC-nDGsXZZE.js","assets/chunk-HOUHSVGY-De3ULdBq.js","assets/chunk-Q4XR5HBZ-Db2ge7fW.js","assets/chunk-7BUUIJ7U-Bb538aSH.js","assets/chunk-OGEWGWER-CQZ3zQ2q.js","assets/chunk-C7G6YPKG-EJ5BdmRQ.js","assets/chunk-ZGVPDNZ5-CjEI23Vu.js","assets/rough.esm-CSKSodPl.js","assets/chunk-52WLFC77-gvoNW_ar.js","assets/line-hnYRfUMr.js","assets/path-BWPyau1x.js","assets/array-BifhSqXX.js","assets/chunk-FWX5IMBZ-CXBLvjvR.js","assets/chunk-ZIRB5QZD-C6fEPe3t.js"])))=>i.map(i=>d[i]);
2
2
  import{n as e,t}from"./rolldown-runtime-Bh1tDfsg.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),e.crossOrigin===`use-credentials`?t.credentials=`include`:e.crossOrigin===`anonymous`?t.credentials=`omit`:t.credentials=`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var n=`bippy-0.5.43`,r=Object.defineProperty,i=Object.prototype.hasOwnProperty,a=()=>{},o=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build`)})}catch{}},s=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e),c=!1,l,u=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>c?!0:(e&&typeof e.inject==`function`&&(l=e.inject.toString()),!!l?.includes(`(injected)`)),d=new Set,f=new Set,p=e=>{let t=new Map,i=0,s={_instrumentationIsActive:!1,_instrumentationSource:n,checkDCE:o,hasUnsupportedRendererAttached:!1,inject(e){let n=++i;return t.set(n,e),f.add(e),s._instrumentationIsActive||(s._instrumentationIsActive=!0,d.forEach(e=>e())),n},on:a,onCommitFiberRoot:a,onCommitFiberUnmount:a,onPostCommitFiberRoot:a,renderers:t,supportsFiber:!0,supportsFlight:!0};try{r(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get(){return s},set(t){if(t&&typeof t==`object`){let n=s.renderers;s=t,n.size>0&&(n.forEach((e,n)=>{f.add(e),t.renderers.set(n,e)}),m(e))}}});let t=window.hasOwnProperty,n=!1;r(window,`hasOwnProperty`,{configurable:!0,value:function(...e){try{if(!n&&e[0]===`__REACT_DEVTOOLS_GLOBAL_HOOK__`)return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,n=!0,-0}catch{}return t.apply(this,e)},writable:!0})}catch{m(e)}return s},m=e=>{e&&d.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=o,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=n,t._instrumentationIsActive=!1;let e=s(t);if(e||(t.on=a),t.renderers.size){t._instrumentationIsActive=!0,d.forEach(e=>e());return}let r=t.inject,i=u(t);i&&!e&&(c=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=e=>{let n=r(e);return f.add(e),i&&t.renderers.set(n,e),t._instrumentationIsActive=!0,d.forEach(e=>e()),n}}(t.renderers.size||t._instrumentationIsActive||u())&&e?.()}catch{}},h=()=>i.call(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),g=e=>h()?(m(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):p(e),_=()=>!!(typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`));(()=>{try{_()&&g()}catch{}})();var v=(e,t,n=!1)=>{if(!e)return null;if(t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=v(r,t,n);if(e)return e;r=n?null:r.sibling}return null},y=async(e,t,n=!1)=>{if(!e)return null;if(await t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=await y(r,t,n);if(e)return e;r=n?null:r.sibling}return null},b=e=>{let t=e;return typeof t==`function`?t:typeof t==`object`&&t?b(t.type||t.render):null},x=e=>{try{if(typeof e.version==`string`&&e.bundleType>0)return`development`}catch{}return`production`},S=e=>Object.prototype.toString.call(e)===`[object Object]`&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),C=(e,t=[])=>{if(!S(e))return[{path:t,value:e}];let n=[];for(let r in e){let i=e[r],a=t.concat(r);S(i)?n.push(...C(i,a)):n.push({path:a,value:i})}return n},w,T,E,D,O,k,A,j,M,N,P,ee,F,te,ne,re,ie={},ae=[],oe=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,se=Array.isArray;function ce(e,t){for(var n in t)e[n]=t[n];return e}function le(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function ue(e,t,n){var r,i,a,o={};for(a in t)a==`key`?r=t[a]:a==`ref`?i=t[a]:o[a]=t[a];if(arguments.length>2&&(o.children=arguments.length>3?w.call(arguments,2):n),typeof e==`function`&&e.defaultProps!=null)for(a in e.defaultProps)o[a]===void 0&&(o[a]=e.defaultProps[a]);return de(e,o,r,i,null)}function de(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++E,__i:-1,__u:0};return i==null&&T.vnode!=null&&T.vnode(a),a}function fe(e){return e.children}function pe(e,t){this.props=e,this.context=t}function me(e,t){if(t==null)return e.__?me(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type==`function`?me(e):null}function he(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,r=[],i=[],a=ce({},t);a.__v=t.__v+1,T.vnode&&T.vnode(a),De(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,r,n??me(t),!!(32&t.__u),i),a.__v=t.__v,a.__.__k[a.__i]=a,ke(r,a,i),t.__e=t.__=null,a.__e!=n&&ge(a)}}function ge(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),ge(e)}function _e(e){(!e.__d&&(e.__d=!0)&&O.push(e)&&!ve.__r++||k!=T.debounceRendering)&&((k=T.debounceRendering)||A)(ve)}function ve(){try{for(var e,t=1;O.length;)O.length>t&&O.sort(j),e=O.shift(),t=O.length,he(e)}finally{O.length=ve.__r=0}}function ye(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_,v=r&&r.__k||ae,y=t.length;for(c=be(n,t,v,c,y),d=0;d<y;d++)(p=n.__k[d])!=null&&(f=p.__i!=-1&&v[p.__i]||ie,p.__i=d,g=De(e,p,f,i,a,o,s,c,l,u),m=p.__e,p.ref&&f.ref!=p.ref&&(f.ref&&Me(f.ref,null,p),u.push(p.ref,p.__c||m,p)),h==null&&m!=null&&(h=m),(_=!!(4&p.__u))||f.__k===p.__k?(c=xe(p,c,e,_),_&&f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function be(e,t,n,r,i){var a,o,s,c,l,u=n.length,d=u,f=0;for(e.__k=Array(i),a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o==`string`||typeof o==`number`||typeof o==`bigint`||o.constructor==String?o=e.__k[a]=de(null,o,null,null,null):se(o)?o=e.__k[a]=de(fe,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?o=e.__k[a]=de(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):e.__k[a]=o,c=a+f,o.__=e,o.__b=e.__b+1,s=null,(l=o.__i=Ce(o,n,c,d))!=-1&&(d--,(s=n[l])&&(s.__u|=2)),s==null||s.__v==null?(l==-1&&(i>u?f--:i<u&&f++),typeof o.type!=`function`&&(o.__u|=4)):l!=c&&(l==c-1?f--:l==c+1?f++:(l>c?f--:f++,o.__u|=4))):e.__k[a]=null;if(d)for(a=0;a<u;a++)(s=n[a])!=null&&!(2&s.__u)&&(s.__e==r&&(r=me(s)),Ne(s,s));return r}function xe(e,t,n,r){var i,a;if(typeof e.type==`function`){for(i=e.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=e,t=xe(i[a],t,n,r));return t}e.__e!=t&&(r&&(t&&e.type&&!t.parentNode&&(t=me(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do t&&=t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Se(e,t){return t||=[],e==null||typeof e==`boolean`||(se(e)?e.some(function(e){Se(e,t)}):t.push(e)),t}function Ce(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l!=null&&(2&l.__u)==0;if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])!=null&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function we(e,t,n){t[0]==`-`?e.setProperty(t,n??``):e[t]=n==null?``:typeof n!=`number`||oe.test(t)?n:n+`px`}function Te(e,t,n,r,i){var a,o;n:if(t==`style`)if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||we(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||we(e.style,t,n[t])}else if(t[0]==`o`&&t[1]==`n`)a=t!=(t=t.replace(ee,`$1`)),o=t.toLowerCase(),t=o in e||t==`onFocusOut`||t==`onFocusIn`?o.slice(2):t.slice(2),e.l||={},e.l[t+a]=n,n?r?n[P]=r[P]:(n[P]=F,e.addEventListener(t,a?ne:te,a)):e.removeEventListener(t,a?ne:te,a);else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function Ee(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[N]==null)t[N]=F++;else if(t[N]<n[P])return;return n(T.event?T.event(t):t)}}}function De(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,E,D=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[s=t.__e=n.__e]),(u=T.__b)&&u(t);n:if(typeof D==`function`){d=o.length;try{if(v=t.props,y=D.prototype&&D.prototype.render,b=(u=D.contextType)&&r[u.__c],x=u?b?b.props.value:u.__:r,n.__c?_=(f=t.__c=n.__c).__=f.__E:(y?t.__c=f=new D(v,x):(t.__c=f=new pe(v,x),f.constructor=D,f.render=Pe),b&&b.sub(f),f.state||={},f.__n=r,p=f.__d=!0,f.__h=[],f._sb=[]),y&&f.__s==null&&(f.__s=f.state),y&&D.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=ce({},f.__s)),ce(f.__s,D.getDerivedStateFromProps(v,f.__s))),m=f.props,h=f.state,f.__v=t,p)y&&D.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),y&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(y&&D.getDerivedStateFromProps==null&&v!==m&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(v,x),t.__v==n.__v||!f.__e&&f.shouldComponentUpdate!=null&&!1===f.shouldComponentUpdate(v,f.__s,x)){t.__v!=n.__v&&(f.props=v,f.state=f.__s,f.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),ae.push.apply(f.__h,f._sb),f._sb=[],f.__h.length&&o.push(f);break n}f.componentWillUpdate!=null&&f.componentWillUpdate(v,f.__s,x),y&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(m,h,g)})}if(f.context=x,f.props=v,f.__P=e,f.__e=!1,S=T.__r,C=0,y)f.state=f.__s,f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),ae.push.apply(f.__h,f._sb),f._sb=[];else do f.__d=!1,S&&S(t),u=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++C<25);f.state=f.__s,f.getChildContext!=null&&(r=ce(ce({},r),f.getChildContext())),y&&!p&&f.getSnapshotBeforeUpdate!=null&&(g=f.getSnapshotBeforeUpdate(m,h)),w=u!=null&&u.type===fe&&u.key==null?Ae(u.props.children):u,s=ye(e,se(w)?w:[w],t,n,r,i,a,o,s,c,l),f.base=t.__e,t.__u&=-161,f.__h.length&&o.push(f),_&&(f.__E=f.__=null)}catch(e){if(o.length=d,t.__v=null,c||a!=null){if(e.then){for(t.__u|=c?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a!=null&&(a[a.indexOf(s)]=null),t.__e=s}else if(a!=null)for(E=a.length;E--;)le(a[E])}else t.__e=n.__e;t.__k??=n.__k||[],e.then||Oe(t),T.__e(e,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=je(n.__e,t,n,r,i,a,o,c,l);return(u=T.diffed)&&u(t),128&t.__u?void 0:s}function Oe(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(Oe))}function ke(e,t,n){for(var r=0;r<n.length;r++)Me(n[r],n[++r],n[++r]);T.__c&&T.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){T.__e(e,t.__v)}})}function Ae(e){return typeof e!=`object`||!e||e.__b>0?e:se(e)?e.map(Ae):e.constructor===void 0?ce({},e):null}function je(e,t,n,r,i,a,o,s,c){var l,u,d,f,p,m,h,g=n.props||ie,_=t.props,v=t.type;if(v==`svg`?i=`http://www.w3.org/2000/svg`:v==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a!=null){for(l=0;l<a.length;l++)if((p=a[l])&&`setAttribute`in p==!!v&&(v?p.localName==v:p.nodeType==3)){e=p,a[l]=null;break}}if(e==null){if(v==null)return document.createTextNode(_);e=document.createElementNS(i,v,_.is&&_),s&&=(T.__m&&T.__m(t,a),!1),a=null}if(v==null)g===_||s&&e.data==_||(e.data=_);else{if(a=v==`textarea`&&_.defaultValue!=null?null:a&&w.call(e.childNodes),!s&&a!=null)for(g={},l=0;l<e.attributes.length;l++)g[(p=e.attributes[l]).name]=p.value;for(l in g)p=g[l],l==`dangerouslySetInnerHTML`?d=p:l==`children`||l in _||l==`value`&&`defaultValue`in _||l==`checked`&&`defaultChecked`in _||Te(e,l,null,p,i);for(l in _)p=_[l],l==`children`?f=p:l==`dangerouslySetInnerHTML`?u=p:l==`value`?m=p:l==`checked`?h=p:s&&typeof p!=`function`||g[l]===p||Te(e,l,p,g[l],i);if(u)s||d&&(u.__html==d.__html||u.__html==e.innerHTML)||(e.innerHTML=u.__html),t.__k=[];else if(d&&(e.innerHTML=``),ye(t.type==`template`?e.content:e,se(f)?f:[f],t,n,r,v==`foreignObject`?`http://www.w3.org/1999/xhtml`:i,a,o,a?a[0]:n.__k&&me(n,0),s,c),a!=null)for(l=a.length;l--;)le(a[l]);s&&v!=`textarea`||(l=`value`,v==`progress`&&m==null?e.removeAttribute(`value`):m!=null&&(m!==e[l]||v==`progress`&&!m||v==`option`&&m!=g[l])&&Te(e,l,m,g[l],i),l=`checked`,h!=null&&h!=e[l]&&Te(e,l,h,g[l],i))}return e}function Me(e,t,n){try{if(typeof e==`function`){var r=typeof e.__u==`function`;r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(e){T.__e(e,n)}}function Ne(e,t,n){var r,i;if(T.unmount&&T.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Me(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){T.__e(e,t)}r.base=r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Ne(r[i],t,n||typeof e.type!=`function`);n||le(e.__e),e.__c=e.__=e.__e=void 0}function Pe(e,t,n){return this.constructor(e,n)}function Fe(e,t,n){var r,i,a,o;t==document&&(t=document.documentElement),T.__&&T.__(e,t),i=(r=typeof n==`function`)?null:n&&n.__k||t.__k,a=[],o=[],De(t,e=(!r&&n||t).__k=ue(fe,null,[e]),i||ie,ie,t.namespaceURI,!r&&n?[n]:i?null:t.firstChild?w.call(t.childNodes):null,a,!r&&n?n:i?i.__e:t.firstChild,r,o),ke(a,e,o),e.props.children=null}function Ie(e){function t(e){var n,r;return this.getChildContext||(n=new Set,(r={})[t.__c]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,_e(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c=`__cC`+re++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}w=ae.slice,T={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(e)),o=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(e,r||{}),o=i.__d),o)return i.__E=i}catch(t){e=t}throw e}},E=0,D=function(e){return e!=null&&e.constructor===void 0},pe.prototype.setState=function(e,t){var n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ce({},this.state);typeof e==`function`&&(e=e(ce({},n),this.props)),e&&ce(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),_e(this))},pe.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),_e(this))},pe.prototype.render=fe,O=[],A=typeof Promise==`function`?Promise.prototype.then.bind(Promise.resolve()):setTimeout,j=function(e,t){return e.__v.__b-t.__v.__b},ve.__r=0,M=Math.random().toString(8),N=`__d`+M,P=`__a`+M,ee=/(PointerCapture)$|Capture$/i,F=0,te=Ee(!1),ne=Ee(!0),re=0;var Le,Re,ze,Be,Ve=0,He=[],Ue=T,We=Ue.__b,Ge=Ue.__r,Ke=Ue.diffed,qe=Ue.__c,Je=Ue.unmount,Ye=Ue.__;function Xe(e,t){Ue.__h&&Ue.__h(Re,e,Ve||t),Ve=0;var n=Re.__H||={__:[],__h:[]};return e>=n.__.length&&n.__.push({}),n.__[e]}function Ze(e){return Ve=1,Qe(dt,e)}function Qe(e,t,n){var r=Xe(Le++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):dt(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);t!==n&&(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=Re,!Re.__f)){var i=function(e,t,n){if(!r.__c.__H)return!0;var i=!1,o=r.__c.props!==e;if(r.__c.__H.__.some(function(e){if(e.__N){i=!0;var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(o=!0)}}),a){var s=a.call(this,e,t,n);return i?s||o:s}return!i||o};Re.__f=!0;var a=Re.shouldComponentUpdate,o=Re.componentWillUpdate;Re.componentWillUpdate=function(e,t,n){if(this.__e){var r=a;a=void 0,i(e,t,n),a=r}o&&o.call(this,e,t,n)},Re.shouldComponentUpdate=i}return r.__N||r.__}function $e(e,t){var n=Xe(Le++,3);!Ue.__s&&ut(n.__H,t)&&(n.__=e,n.u=t,Re.__H.__h.push(n))}function et(e,t){var n=Xe(Le++,4);!Ue.__s&&ut(n.__H,t)&&(n.__=e,n.u=t,Re.__h.push(n))}function tt(e){return Ve=5,nt(function(){return{current:e}},[])}function nt(e,t){var n=Xe(Le++,7);return ut(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function rt(e,t){return Ve=8,nt(function(){return e},t)}function it(e){var t=Re.context[e.__c],n=Xe(Le++,9);return n.c=e,t?(n.__??(n.__=!0,t.sub(Re)),t.props.value):e.__}function at(){for(var e;e=He.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ct),t.__h.some(lt),t.__h=[]}catch(n){t.__h=[],Ue.__e(n,e.__v)}}}Ue.__b=function(e){Re=null,We&&We(e)},Ue.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ye&&Ye(e,t)},Ue.__r=function(e){Ge&&Ge(e),Le=0;var t=(Re=e.__c).__H;t&&(ze===Re?(t.__h=[],Re.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(ct),t.__h.some(lt),t.__h=[],Le=0)),ze=Re},Ue.diffed=function(e){Ke&&Ke(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(He.push(t)!==1&&Be===Ue.requestAnimationFrame||((Be=Ue.requestAnimationFrame)||st)(at)),t.__H.__.some(function(e){e.u&&=(e.__H=e.u,void 0)})),ze=Re=null},Ue.__c=function(e,t){t.some(function(e){try{e.__h.some(ct),e.__h=e.__h.filter(function(e){return!e.__||lt(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],Ue.__e(n,e.__v)}}),qe&&qe(e,t)},Ue.unmount=function(e){Je&&Je(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{ct(e)}catch(e){t=e}}),n.__H=void 0,t&&Ue.__e(t,n.__v))};var ot=typeof requestAnimationFrame==`function`;function st(e){var t,n=function(){clearTimeout(r),ot&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ot&&(t=requestAnimationFrame(n))}function ct(e){var t=Re,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),Re=t}function lt(e){var t=Re;e.__c=e.__(),Re=t}function ut(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function dt(e,t){return typeof t==`function`?t(e):t}var ft=Symbol.for(`preact-signals`);function pt(){if(yt>1)yt--;else{var e,t=!1;for((function(){var e=Ct;for(Ct=void 0;e!==void 0;){var t=e.S;if(t.v===e.v)for(var n=t.t;n!==void 0;n=n.x)n.i===e.i&&(n.i=t.i);e=e.o}})();vt!==void 0;){var n=vt;for(vt=void 0,bt++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Ot(n))try{n.c()}catch(n){t||=(e=n,!0)}n=r}}if(bt=0,yt--,t)throw e}}function mt(e){if(yt>0)return e();St=++xt,yt++;try{return e()}finally{pt()}}var ht,gt=void 0;function _t(e){var t=gt,n=ht;gt=void 0,ht=void 0;try{return e()}finally{gt=t,ht=n}}var vt=void 0,yt=0,bt=0,xt=0,St=0,Ct=void 0,wt=0;function Tt(e){if(gt!==void 0){var t=e.n;if(t===void 0||t.t!==gt)return t={i:0,S:e,p:gt.s,n:void 0,t:gt,e:void 0,x:void 0,r:t},gt.s!==void 0&&(gt.s.n=t),gt.s=t,e.n=t,32&gt.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=gt.s,t.n=void 0,gt.s.n=t,gt.s=t),t}}function Et(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=t?.watched,this.Z=t?.unwatched,this.name=t?.name}Et.prototype.brand=ft,Et.prototype.h=function(){return!0},Et.prototype.S=function(e){var t=this,n=this.t;n!==e&&e.e===void 0&&(e.x=n,this.t=e,n===void 0?_t(function(){var e;(e=t.W)==null||e.call(t)}):n.e=e)},Et.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&_t(function(){var e;(e=t.Z)==null||e.call(t)}))}},Et.prototype.subscribe=function(e){var t=this;return Lt(function(){var n=t.value;_t(function(){return e(n)})},{name:`sub`})},Et.prototype.valueOf=function(){return this.value},Et.prototype.toString=function(){return this.value+``},Et.prototype.toJSON=function(){return this.value},Et.prototype.peek=function(){var e=this;return _t(function(){return e.value})},Object.defineProperty(Et.prototype,"value",{get:function(){var e=Tt(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(bt>100)throw Error(`Cycle detected`);(function(e){yt!==0&&bt===0&&e.l!==St&&(e.l=St,Ct={S:e,v:e.v,i:e.i,o:Ct})})(this),this.v=e,this.i++,wt++,yt++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{pt()}}}});function Dt(e,t){return new Et(e,t)}function Ot(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function kt(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function At(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function jt(e,t){Et.call(this,void 0,t),this.x=e,this.s=void 0,this.g=wt-1,this.f=4}jt.prototype=new Et,jt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===wt))return!0;if(this.g=wt,this.f|=1,this.i>0&&!Ot(this))return this.f&=-2,!0;var e=gt;try{kt(this),gt=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return gt=e,At(this),this.f&=-2,!0},jt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}Et.prototype.S.call(this,e)},jt.prototype.U=function(e){if(this.t!==void 0&&(Et.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},jt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(jt.prototype,"value",{get:function(){if(1&this.f)throw Error(`Cycle detected`);var e=Tt(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Mt(e,t){return new jt(e,t)}function Nt(e){var t=e.m;if(e.m=void 0,typeof t==`function`){yt++;var n=gt;gt=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,Pt(e),t}finally{gt=n,pt()}}}function Pt(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Nt(e)}function Ft(e){if(gt!==this)throw Error(`Out-of-order effect`);At(this),gt=e,this.f&=-2,8&this.f&&Pt(this),pt()}function It(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,ht&&ht.push(this)}It.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t==`function`&&(this.m=t)}finally{e()}},It.prototype.S=function(){if(1&this.f)throw Error(`Cycle detected`);this.f|=1,this.f&=-9,Nt(this),kt(this),yt++;var e=gt;return gt=this,Ft.bind(this,e)},It.prototype.N=function(){2&this.f||(this.f|=2,this.u=vt,vt=this)},It.prototype.d=function(){this.f|=8,1&this.f||Pt(this)},It.prototype.dispose=function(){this.d()};function Lt(e,t){var n=new It(e,t);try{n.c()}catch(e){throw n.d(),e}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Rt,zt,Bt=typeof window<`u`&&!!window.__PREACT_SIGNALS_DEVTOOLS__,Vt=[],Ht=[];Lt(function(){Rt=this.N})();function Ut(e,t){T[e]=t.bind(null,T[e]||function(){})}function Wt(e){if(zt){var t=zt;zt=void 0,t()}zt=e&&e.S()}function Gt(e){var t=this,n=e.data,r=qt(n);r.name=`ReactiveDom`,r.value=n;var i=nt(function(){for(var e=t,n=t.__v;n=n.__;)if(n.__c){n.__c.__$f|=4;break}var i=Mt(function(){var e=r.value.value;return e===0?0:!0===e?``:e||``}),a=Mt(function(){return!Array.isArray(i.value)&&!D(i.value)}),o=Lt(function(){if(this.N=$t,a.value){var t=i.value;e.__v&&e.__v.__e&&e.__v.__e.nodeType===3&&(e.__v.__e.data=t)}}),s=t.__$u.d;return t.__$u.d=function(){o(),s.call(this)},[a,i]},[]),a=i[0],o=i[1];return a.value?o.peek():o.value}Gt.displayName=`ReactiveTextNode`,Object.defineProperties(Et.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:Gt},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}}),Ut(`__b`,function(e,t){if(typeof t.type==`string`){var n,r=t.props;for(var i in r)if(i!==`children`){var a=r[i];a instanceof Et&&(n||(t.__np=n={}),n[i]=a,r[i]=a.peek())}}e(t)}),Ut(`__r`,function(e,t){if(e(t),t.type!==fe){Wt();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(e,t){var n;return Lt(function(){n=this},{name:t}),n.c=e,n}(function(){var e;Bt&&((e=n.y)==null||e.call(n)),r.__$f|=1,r.setState({})},typeof t.type==`function`?t.type.displayName||t.type.name:``))),Wt(n)}}),Ut(`__e`,function(e,t,n,r){Wt(),e(t,n,r)}),Ut(`diffed`,function(e,t){Wt();var n;if(typeof t.type==`string`&&(n=t.__e)){var r=t.__np,i=t.props,a=n.U;if(a)for(var o in a){var s=a[o];s===void 0||r&&o in r||(s.d(),a[o]=void 0)}if(r)for(var c in a||(a={},n.U=a),r){var l=a[c],u=r[c];l===void 0?(l=Kt(n,c,u,i),a[c]=l):l.o(u,i)}}e(t)});function Kt(e,t,n,r){var i=t in e&&e.ownerSVGElement===void 0,a=Dt(n);return{o:function(e,t){a.value=e,r=t},d:Lt(function(){this.N=$t;var n=a.value.value;r[t]!==n&&(r[t]=n,i?e[t]=n:n!=null&&(!1!==n||t[4]===`-`)?e.setAttribute(t,n):e.removeAttribute(t))})}}Ut(`unmount`,function(e,t){if(typeof t.type==`string`){var n=t.__e;if(n){var r=n.U;if(r)for(var i in n.U=void 0,r){var a=r[i];a&&a.d()}}var o=t.__np;if(o){var s=t.props;for(var c in o)s[c]=o[c]}t.__np=void 0}else{var l=t.__c;if(l){var u=l.__$u;u&&(l.__$u=void 0,u.d())}}e(t)}),Ut(`__h`,function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)}),pe.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var i in t)return!0;if(this.__f||typeof this.u==`boolean`&&!0===this.u){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var o in e)if(o!==`__source`&&e[o]!==this.props[o])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function qt(e,t){return nt(function(){return Dt(e,t)},[])}var Jt=typeof requestAnimationFrame>`u`?setTimeout:function(e){var t=function(){clearTimeout(n),cancelAnimationFrame(r),e()},n=setTimeout(t,35),r=requestAnimationFrame(t)},Yt=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Xt(){mt(function(){for(var e;e=Vt.shift();)Rt.call(e)})}function Zt(){Vt.push(this)===1&&(T.requestAnimationFrame||Jt)(Xt)}function Qt(){mt(function(){for(var e;e=Ht.shift();)Rt.call(e)})}function $t(){Ht.push(this)===1&&(T.requestAnimationFrame||Yt)(Qt)}function en(e,t){var n=tt(e);n.current=e,$e(function(){return Lt(function(){return this.N=Zt,n.current()},t)},[])}function tn(e,t){for(var n in t)e[n]=t[n];return e}function nn(e,t){for(var n in e)if(n!==`__source`&&!(n in t))return!0;for(var r in t)if(r!==`__source`&&e[r]!==t[r])return!0;return!1}function rn(e,t){var n=t(),r=Ze({t:{__:n,u:t}}),i=r[0].t,a=r[1];return et(function(){i.__=n,i.u=t,an(i)&&a({t:i})},[e,n,t]),$e(function(){return an(i)&&a({t:i}),e(function(){an(i)&&a({t:i})})},[e]),n}function an(e){try{return!((t=e.__)===(n=e.u())&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}var t,n}function on(e,t){this.props=e,this.context=t}function sn(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&(typeof n==`function`?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:nn(this.props,e)}function r(t){return this.shouldComponentUpdate=n,ue(e,t)}return r.displayName=`Memo(`+(e.displayName||e.name)+`)`,r.__f=r.prototype.isReactComponent=!0,r.type=e,r}(on.prototype=new pe).isPureReactComponent=!0,on.prototype.shouldComponentUpdate=function(e,t){return nn(this.props,e)||nn(this.state,t)};var cn=T.__b;T.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),cn&&cn(e)};var ln=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.forward_ref`)||3911;function un(e){function t(t){var n=tn({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=ln,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName=`ForwardRef(`+(e.displayName||e.name)+`)`,t}var dn=T.__e;T.__e=function(e,t,n,r){if(e.then){for(var i,a=t;a=a.__;)if((i=a.__c)&&i.__c)return t.__e??(t.__e=n.__e,t.__k=n.__k||[]),i.__c(e,t)}dn(e,t,n,r)};var fn=T.unmount;function pn(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){typeof e.__c==`function`&&e.__c()}),e.__c.__H=null),(e=tn({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return pn(e,t,n)})),e}function mn(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return mn(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function hn(){this.__u=0,this.o=null,this.__b=null}function gn(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function _n(){this.i=null,this.l=null}T.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),fn&&fn(e)},(hn.prototype=new pe).__c=function(e,t){var n=t.__c,r=this;r.o??=[],r.o.push(n);var i=gn(r.__v),a=!1,o=function(){a||r.__z||(a=!0,n.__R=null,i?i(c):c())};n.__R=o;var s=n.__P;n.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var e=r.state.__a;r.__v.__k[0]=mn(e,e.__c.__P,e.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=s,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(o,o)},hn.prototype.componentWillUnmount=function(){this.o=[]},hn.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement(`div`),r=this.__v.__k[0].__c;this.__v.__k[0]=pn(this.__b,n,r.__O=r.__P)}this.__b=null}var i=t.__a&&ue(fe,null,e.fallback);return i&&(i.__u&=-33),[ue(fe,null,t.__a?null:e.children),i]};var vn=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!==`t`||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function yn(e){return this.getChildContext=function(){return e.context},e.children}function bn(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){Fe(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var r=t.__v;r!==null&&!r.__m&&r.__!==null;)r=r.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:r.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}Fe(ue(yn,{context:t.context},e.__v),t.v)}function xn(e,t){var n=ue(bn,{__v:e,h:t});return n.containerInfo=t,n}(_n.prototype=new pe).__a=function(e){var t=this,n=gn(t.__v),r=t.l.get(e);return r[0]++,function(i){var a=function(){t.props.revealOrder?(r.push(i),vn(t,e,r)):i()};n?n(a):a()}},_n.prototype.render=function(e){this.i=null,this.l=new Map;var t=Se(e.children);e.revealOrder&&e.revealOrder[0]===`b`&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},_n.prototype.componentDidUpdate=_n.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){vn(e,n,t)})};var Sn=typeof Symbol<`u`&&Symbol.for&&Symbol.for(`react.element`)||60103,Cn=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,wn=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Tn=/[A-Z0-9]/g,En=typeof document<`u`,Dn=function(e){return(typeof Symbol<`u`&&typeof Symbol()==`symbol`?/fil|che|rad/:/fil|che|ra/).test(e)};pe.prototype.isReactComponent=!0,[`componentWillMount`,`componentWillReceiveProps`,`componentWillUpdate`].forEach(function(e){Object.defineProperty(pe.prototype,e,{configurable:!0,get:function(){return this[`UNSAFE_`+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var On=T.event;T.event=function(e){return On&&(e=On(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var kn={configurable:!0,get:function(){return this.class}},An=T.vnode;T.vnode=function(e){typeof e.type==`string`&&function(e){var t=e.props,n=e.type,r={},i=n.indexOf(`-`)==-1;for(var a in t){var o=t[a];if(!(a===`value`&&`defaultValue`in t&&o==null||En&&a===`children`&&n===`noscript`||a===`class`||a===`className`)){var s=a.toLowerCase();a===`defaultValue`&&`value`in t&&t.value==null?a=`value`:a===`download`&&!0===o?o=``:s===`translate`&&o===`no`?o=!1:s[0]===`o`&&s[1]===`n`?s===`ondoubleclick`?a=`ondblclick`:s!==`onchange`||n!==`input`&&n!==`textarea`||Dn(t.type)?s===`onfocus`?a=`onfocusin`:s===`onblur`?a=`onfocusout`:wn.test(a)&&(a=s):s=a=`oninput`:i&&Cn.test(a)?a=a.replace(Tn,`-$&`).toLowerCase():o===null&&(o=void 0),s===`oninput`&&r[a=s]&&(a=`oninputCapture`),r[a]=o}}n==`select`&&(r.multiple&&Array.isArray(r.value)&&(r.value=Se(t.children).forEach(function(e){e.props.selected=r.value.indexOf(e.props.value)!=-1})),r.defaultValue!=null&&(r.value=Se(t.children).forEach(function(e){e.props.selected=r.multiple?r.defaultValue.indexOf(e.props.value)!=-1:r.defaultValue==e.props.value}))),t.class&&!t.className?(r.class=t.class,Object.defineProperty(r,"className",kn)):t.className&&(r.class=r.className=t.className),e.props=r}(e),e.$$typeof=Sn,An&&An(e)};var jn=T.__r;T.__r=function(e){jn&&jn(e),e.__c};var Mn=T.diffed;T.diffed=function(e){Mn&&Mn(e);var t=e.props,n=e.__e;n!=null&&e.type===`textarea`&&`value`in t&&t.value!==n.value&&(n.value=t.value==null?``:t.value)};var Nn=0;Array.isArray;function I(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Nn,__i:-1,__u:0,__source:i,__self:a};if(typeof e==`function`&&(o=e.defaultProps))for(s in o)c[s]===void 0&&(c[s]=o[s]);return T.vnode&&T.vnode(l),l}var Pn=null,Fn=(()=>{if(Pn!==null)return Pn;try{Pn=window.matchMedia(`(color-gamut: p3)`).matches}catch{Pn=!1}return Pn})(),In=e=>Fn?`color(display-p3 0.84 0.19 0.78 / ${e})`:`rgba(210, 57, 192, ${e})`,Ln=1e4;In(.4),In(.05),In(.5),In(.08),In(.15);var Rn=new Set([`script`,`style`,`template`,`noscript`]),zn=`data-react-grab-frozen`,Bn=`data-react-grab-same-origin-frame`;new Set(`display.position.top.right.bottom.left.z-index.overflow.overflow-x.overflow-y.width.height.min-width.min-height.max-width.max-height.margin-top.margin-right.margin-bottom.margin-left.padding-top.padding-right.padding-bottom.padding-left.flex-direction.flex-wrap.justify-content.align-items.align-self.align-content.flex-grow.flex-shrink.flex-basis.order.gap.row-gap.column-gap.grid-template-columns.grid-template-rows.grid-template-areas.font-family.font-size.font-weight.font-style.line-height.letter-spacing.text-align.text-decoration-line.text-decoration-style.text-transform.text-overflow.text-shadow.white-space.word-break.overflow-wrap.vertical-align.color.background-color.background-image.background-position.background-size.background-repeat.border-top-width.border-right-width.border-bottom-width.border-left-width.border-top-style.border-right-style.border-bottom-style.border-left-style.border-top-color.border-right-color.border-bottom-color.border-left-color.border-top-left-radius.border-top-right-radius.border-bottom-left-radius.border-bottom-right-radius.box-shadow.opacity.transform.filter.backdrop-filter.object-fit.object-position`.split(`.`));var Vn=e=>typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===Node.ELEMENT_NODE,Hn=e=>Vn(e)&&e.namespaceURI===`http://www.w3.org/1999/xhtml`,Un=e=>Hn(e)&&e.tagName===`IFRAME`,Wn=new WeakMap,Gn=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0},Kn=e=>{let t=performance.now(),n=Wn.get(e);if(n&&t-n.timestamp<16)return n.metrics;let r=e.ownerDocument.defaultView?.getComputedStyle(e),i;if(!r)i={contentOffsetX:e.clientLeft,contentOffsetY:e.clientTop,height:e.offsetHeight,width:e.offsetWidth};else{let t=Gn(r.borderLeftWidth),n=Gn(r.borderRightWidth),a=Gn(r.borderTopWidth),o=Gn(r.borderBottomWidth),s=Gn(r.paddingLeft),c=Gn(r.paddingRight),l=Gn(r.paddingTop),u=Gn(r.paddingBottom),d=Gn(r.width),f=Gn(r.height),p=t+n+s+c,m=a+o+l+u,h=r.boxSizing===`border-box`?d:d+p,g=r.boxSizing===`border-box`?f:f+m;i={contentOffsetX:t+s,contentOffsetY:a+l,height:g>0?g:e.offsetHeight,width:h>0?h:e.offsetWidth}}return Wn.set(e,{metrics:i,timestamp:t}),i},qn=(e,t)=>t>0?e/t:1,Jn=e=>{if(!e)return null;try{return e.frameElement}catch{return null}},Yn=(e,t,n)=>{let r=t,i=n,a=1,o=1,s=e;for(;s&&s!==window;){let e=Jn(s);if(!e||!Un(e))break;let t=e.getBoundingClientRect(),n=Kn(e),c=qn(t.width,n.width),l=qn(t.height,n.height);r=t.left+(n.contentOffsetX+r)*c,i=t.top+(n.contentOffsetY+i)*l,a*=c,o*=l,s=e.ownerDocument.defaultView}return{x:r,y:i,scaleX:a,scaleY:o}},Xn=e=>{let t=e.ownerDocument.defaultView;return t?t.getComputedStyle(e):window.getComputedStyle(e)},Zn=e=>Object.assign(e,{[Symbol.dispose]:e}),Qn=`bippy-0.6.1`,$n=Object.defineProperty,er=Object.prototype.hasOwnProperty,tr=()=>{},nr=e=>{try{Function.prototype.toString.call(e).indexOf(`^_^`)>-1&&setTimeout(()=>{throw Error(`React is running in production mode, but dead code elimination has not been applied. Read how to correctly configure React for production: https://reactjs.org/link/perf-use-production-build`)})}catch{}},rr=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>!!(e&&`getFiberRoots`in e),ir=!1,ar,or=(e=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__)=>ir?!0:(e&&typeof e.inject==`function`&&(ar=e.inject.toString()),!!ar?.includes(`(injected)`)),sr=new Set,cr=new Set,lr=e=>{e&&sr.add(e);let t=new Map,n=0,r={_instrumentationIsActive:!1,_instrumentationSource:Qn,checkDCE:nr,hasUnsupportedRendererAttached:!1,inject(e){let i=++n;return t.set(i,e),cr.add(e),r._instrumentationIsActive||(r._instrumentationIsActive=!0,sr.forEach(e=>e())),i},on:tr,onCommitFiberRoot:tr,onCommitFiberUnmount:tr,onPostCommitFiberRoot:tr,renderers:t,supportsFiber:!0,supportsFlight:!0};try{$n(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`,{configurable:!0,enumerable:!0,get(){return r},set(t){if(t&&typeof t==`object`){let n=r.renderers;r=t,n.size>0&&(n.forEach((e,n)=>{cr.add(e),t.renderers.set(n,e)}),ur(e))}}});let t=window.hasOwnProperty,n=!1;$n(window,`hasOwnProperty`,{configurable:!0,value:function(...e){try{if(!n&&e[0]===`__REACT_DEVTOOLS_GLOBAL_HOOK__`)return globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__=void 0,n=!0,-0}catch{}return t.apply(this,e)},writable:!0})}catch{ur(e)}return r},ur=e=>{e&&sr.add(e);try{let t=globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!t)return;if(!t._instrumentationSource){t.checkDCE=nr,t.supportsFiber=!0,t.supportsFlight=!0,t.hasUnsupportedRendererAttached=!1,t._instrumentationSource=Qn,t._instrumentationIsActive=!1;let e=rr(t);if(e||(t.on=tr),t.renderers.size){t._instrumentationIsActive=!0,sr.forEach(e=>e());return}let n=t.inject,r=or(t);r&&!e&&(ir=!0,t.inject({scheduleRefresh(){}})&&(t._instrumentationIsActive=!0)),t.inject=e=>{let i=n(e);return cr.add(e),r&&t.renderers.set(i,e),t._instrumentationIsActive=!0,sr.forEach(e=>e()),i}}(t.renderers.size||t._instrumentationIsActive||or())&&e?.()}catch{}},dr=()=>er.call(globalThis,`__REACT_DEVTOOLS_GLOBAL_HOOK__`),fr=e=>dr()?(ur(e),globalThis.__REACT_DEVTOOLS_GLOBAL_HOOK__):lr(e),pr=()=>!!(typeof window<`u`&&(window.document?.createElement||window.navigator?.product===`ReactNative`));(()=>{try{pr()&&fr()}catch{}})();var mr=e=>{let t=e.memoizedProps,n=e.alternate?.memoizedProps||{},r=e.flags??e.effectTag??0;switch(e.tag){case 1:case 9:case 11:case 0:case 14:case 15:return(r&1)==1;default:return e.alternate?n!==t||e.alternate.memoizedState!==e.memoizedState||e.alternate.ref!==e.ref:!0}},hr=e=>{switch(e.tag){case 18:return!0;case 7:case 6:case 23:case 22:return!0;case 3:return!1;default:{let t=typeof e.type==`object`&&e.type!==null?e.type.$$typeof:e.type;if(typeof t==`symbol`)return t.description===`react.concurrent_mode`||t.description===`react.async_mode`;switch(t){case 60111:case`Symbol(react.concurrent_mode)`:case`Symbol(react.async_mode)`:return!0;default:return!1}}}},gr=(e,t,n=!1)=>{if(!e)return null;if(t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=gr(r,t,n);if(e)return e;r=n?null:r.sibling}return null},_r=async(e,t,n=!1)=>{if(!e)return null;if(await t(e)===!0)return e;let r=n?e.return:e.child;for(;r;){let e=await _r(r,t,n);if(e)return e;r=n?null:r.sibling}return null},vr=e=>{let t=e;return typeof t==`function`?t:typeof t==`object`&&t?vr(t.type||t.render):null},yr=new Set,br=0,xr=new WeakMap,Sr=(e,t=br++)=>{xr.set(e,t)},Cr=e=>{let t=xr.get(e);return t===void 0&&e.alternate&&(t=xr.get(e.alternate)),t===void 0&&(t=br++,Sr(e,t)),t},wr=(e,t,n)=>{let r=t;for(;r!=null;){if(xr.has(r)||Cr(r),!hr(r)&&mr(r)&&e(r,`mount`),r.tag===13)if(r.memoizedState!==null){let t=r.child,n=t?t.sibling:null;if(n){let t=n.child;t!==null&&wr(e,t,!1)}}else{let t=null;r.child!==null&&(t=r.child.child),t!==null&&wr(e,t,!1)}else r.child!=null&&wr(e,r.child,!0);r=n?r.sibling:null}},Tr=(e,t,n,r)=>{if(xr.has(t)||Cr(t),!n)return;xr.has(n)||Cr(n);let i=t.tag===13,a=!hr(t);a&&mr(t)&&e(t,`update`);let o=i&&n.memoizedState!==null,s=i&&t.memoizedState!==null;if(o&&s){let r=t.child?.sibling??null,i=n.child?.sibling??null;r!==null&&i!==null&&Tr(e,r,i,t)}else if(o&&!s){let n=t.child;n!==null&&wr(e,n,!0)}else if(!o&&s){Dr(e,n);let r=t.child?.sibling??null;r!==null&&wr(e,r,!0)}else if(t.child!==n.child){let n=t.child;for(;n;){if(n.alternate){let i=n.alternate;Tr(e,n,i,a?t:r)}else wr(e,n,!1);n=n.sibling}}},Er=(e,t)=>{(t.tag===3||!hr(t))&&e(t,`unmount`)},Dr=(e,t)=>{let n=t.tag===13&&t.memoizedState!==null,r=t.child;for(n&&(r=(t.child?.sibling??null)?.child??null);r!==null;)r.return!==null&&(Er(e,r),Dr(e,r)),r=r.sibling},Or=e=>Object.prototype.toString.call(e)===`[object Object]`&&(Object.getPrototypeOf(e)===Object.prototype||Object.getPrototypeOf(e)===null),kr=(e,t=[])=>{if(!Or(e))return[{path:t,value:e}];let n=[];for(let r in e){let i=e[r],a=t.concat(r);Or(i)?n.push(...kr(i,a)):n.push({path:a,value:i})}return n},Ar=new Set,jr=new Set,Mr=new Set,Nr=new Set,Pr=new WeakMap,Fr=new WeakMap,Ir=e=>{let t=Pr.get(e)??{};if(Pr.set(e,t),!t.onCommitFiberRoot||e.onCommitFiberRoot!==t.onCommitFiberRoot){let n=e.onCommitFiberRoot,r=(t,i,a)=>{if(n?.(t,i,a),Pr.get(e)?.onCommitFiberRoot===r){yr.add(i),Fr.set(i,t);for(let e of Ar)e(t,i,a)}};t.onCommitFiberRoot=r,e.onCommitFiberRoot=r}if(!t.onCommitFiberUnmount||e.onCommitFiberUnmount!==t.onCommitFiberUnmount){let n=e.onCommitFiberUnmount,r=(t,i)=>{if(n?.(t,i),Pr.get(e)?.onCommitFiberUnmount===r)for(let e of jr)e(t,i)};t.onCommitFiberUnmount=r,e.onCommitFiberUnmount=r}if(!t.onPostCommitFiberRoot||e.onPostCommitFiberRoot!==t.onPostCommitFiberRoot){let n=e.onPostCommitFiberRoot,r=(t,i)=>{if(n?.(t,i),Pr.get(e)?.onPostCommitFiberRoot===r)for(let e of Mr)e(t,i)};t.onPostCommitFiberRoot=r,e.onPostCommitFiberRoot=r}if(!t.onScheduleFiberRoot||e.onScheduleFiberRoot!==t.onScheduleFiberRoot){let n=e.onScheduleFiberRoot,r=(t,i,a)=>{if(n?.(t,i,a),Pr.get(e)?.onScheduleFiberRoot===r)for(let e of Nr)e(t,i,a)};t.onScheduleFiberRoot=r,e.onScheduleFiberRoot=r}},Lr=e=>{let t=fr(e.onActive);t._instrumentationSource=e.name??Qn,Ir(t);let{onActive:n,onCommitFiberRoot:r,onCommitFiberUnmount:i,onPostCommitFiberRoot:a,onScheduleFiberRoot:o}=e;return r&&Ar.add(r),i&&jr.add(i),a&&Mr.add(a),o&&Nr.add(o),Zn(()=>{n&&sr.delete(n),r&&Ar.delete(r),i&&jr.delete(i),a&&Mr.delete(a),o&&Nr.delete(o)})},Rr=new WeakMap,zr=e=>Rr.get(e)??null,Br=e=>{let t=e.ownerDocument?.defaultView;return!!(t&&e instanceof t.ShadowRoot)},Vr=class extends Error{constructor(e,t){super(e,t),this.name=`ReactGrabError`}},Hr=class extends Vr{constructor(){super(`Can't generate CSS selector for non-element node type.`),this.name=`NonElementNodeError`}},Ur=class extends Vr{constructor(e){super(`Timeout: Can't find a unique selector after ${e}ms`),this.name=`SelectorTimeoutError`,this.timeoutMs=e}},Wr=class extends Vr{constructor(){super(`Selector was not found.`),this.name=`SelectorNotFoundError`}},Gr=e=>zr(e)?.getTagName()??(e.tagName||``).toLowerCase(),Kr=e=>typeof e==`object`&&!!e&&`nodeType`in e&&e.nodeType===9,qr=e=>{if(e.assignedSlot)return e.assignedSlot;if(e.parentElement)return e.parentElement;let t=e.getRootNode();return Br(t)?t.host:Kr(t)?Jn(t.defaultView):null},Jr=e=>!0,Yr=typeof window<`u`,Xr=e=>0,Zr=e=>{},Qr=Yr?(Object.getOwnPropertyDescriptor(Window.prototype,`requestAnimationFrame`)?.value??window.requestAnimationFrame).bind(window):Xr,$r=Yr?(Object.getOwnPropertyDescriptor(Window.prototype,`cancelAnimationFrame`)?.value??window.cancelAnimationFrame).bind(window):Zr,ei=e=>{try{return e.contentDocument}catch{return null}},ti=(e,t,n)=>{let r=e.getBoundingClientRect(),i=Kn(e),a=qn(r.width,i.width),o=qn(r.height,i.height);return{x:(t-r.left)/a-i.contentOffsetX,y:(n-r.top)/o-i.contentOffsetY}},ni=(e,t,n)=>{let r=e.elementFromPoint(t,n);for(;r;){let e=r.shadowRoot?.elementFromPoint(t,n);if(e&&e!==r){r=e;continue}if(Un(r)){let e=ei(r);if(!e)return r;let i=ti(r,t,n);return ni(e,i.x,i.y)??r}return r}return null},ri=e=>{let t=e;for(;t;){if(t.hasAttribute(`data-react-grab-ignore`))return!0;t=qr(t)}return!1},ii=typeof Element<`u`&&typeof Element.prototype.checkVisibility==`function`,ai={checkOpacity:!0,checkVisibilityCSS:!0,opacityProperty:!0,visibilityProperty:!0},oi={checkVisibilityCSS:!0,visibilityProperty:!0},si=(e,t)=>{if(ii&&!t)return e.checkVisibility(ai)?!0:e.checkVisibility(oi)?Xn(e).opacity!==`0`:!1;let n=t??Xn(e);return n.display!==`none`&&n.visibility!==`hidden`&&n.opacity!==`0`},ci=e=>{let t=Gr(e);return t===`html`||t===`body`},li=[`data-react-grab`,`data-react-grab-demo`],ui=e=>li.some(t=>e.hasAttribute(t)),di=e=>{if(ui(e))return!0;let t=e.getRootNode();return Br(t)&&ui(t.host)},fi=e=>{let t=parseInt(e.zIndex,10);return e.pointerEvents===`none`&&e.position===`fixed`&&!isNaN(t)&&t>=2147483600},pi=e=>{let t=e.backgroundColor;return t===`transparent`||t===`rgba(0, 0, 0, 0)`},mi=e=>{let t=e.position;if(t!==`fixed`&&t!==`absolute`)return!1;if(pi(e)||parseFloat(e.opacity)<.1)return!0;let n=parseInt(e.zIndex,10);return!isNaN(n)&&n>1e3},hi=new WeakMap,gi=e=>{let t=zr(e);if(t)return t.isConnected();if(ci(e)||di(e)||ri(e))return!1;let n=performance.now(),r=hi.get(e);if(r&&n-r.timestamp<50)return r.isVisible;if(!si(e))return hi.set(e,{isVisible:!1,timestamp:n}),!1;if(e.clientWidth/(e.ownerDocument.defaultView?.innerWidth??window.innerWidth)>=.9&&e.clientHeight/(e.ownerDocument.defaultView?.innerHeight??window.innerHeight)>=.9){let t=Xn(e);if(fi(t)||mi(t))return!1}return hi.set(e,{isVisible:!0,timestamp:n}),!0},_i=e=>{if(e===`transparent`)return!0;let t=e.lastIndexOf(`/`);if(t>=0)return Number.parseFloat(e.slice(t+1))===0;if(!e.startsWith(`rgba(`))return!1;let n=e.lastIndexOf(`,`);return n>=0&&Number.parseFloat(e.slice(n+1))===0},vi=e=>{let t=e.ownerDocument.defaultView?.getComputedStyle?.(e);if(!t)return!1;let n=t.backgroundClip!==`text`&&(t.backgroundImage!==`none`||!_i(t.backgroundColor)),r=t.borderTopStyle!==`none`&&t.borderTopWidth!==`0px`||t.borderRightStyle!==`none`&&t.borderRightWidth!==`0px`||t.borderBottomStyle!==`none`&&t.borderBottomWidth!==`0px`||t.borderLeftStyle!==`none`&&t.borderLeftWidth!==`0px`;return n||r||t.boxShadow!==`none`||t.outlineStyle!==`none`},yi=new Set([`A`,`AUDIO`,`BUTTON`,`CANVAS`,`DETAILS`,`EMBED`,`IFRAME`,`IMG`,`INPUT`,`METER`,`OBJECT`,`OPTION`,`PROGRESS`,`SELECT`,`SUMMARY`,`SVG`,`TEXTAREA`,`VIDEO`]),bi=new Set([`button`,`checkbox`,`combobox`,`gridcell`,`link`,`listbox`,`menuitem`,`menuitemcheckbox`,`menuitemradio`,`option`,`radio`,`scrollbar`,`searchbox`,`slider`,`spinbutton`,`switch`,`tab`,`textbox`,`treeitem`]),xi=new Set(`A.ABBR.B.BDI.BDO.BR.CITE.CODE.DATA.DEL.DFN.EM.I.INS.KBD.MARK.Q.S.SAMP.SMALL.SPAN.STRONG.SUB.SUP.TIME.U.VAR.WBR`.split(`.`)),Si=new WeakMap,Ci=new WeakMap,wi=(e,t,n)=>(Si.set(e,t),Ci.set(e,n),t),Ti=e=>yi.has(e.tagName)||bi.has(e.getAttribute(`role`)??``)||Hn(e)&&e.isContentEditable,Ei=e=>{let t=performance.now(),n=Ci.get(e);if(n!==void 0&&t-n<16)return Si.get(e)??null;if(Ti(e)||e.childNodes.length>64)return wi(e,null,t);let r=[],i=[],a=0;for(let t=e.childNodes.length-1;t>=0;--t)i.push(e.childNodes[t]);for(;i.length>0;){if(a+=1,a>64)return wi(e,null,t);let n=i.pop();if(n){if(n.nodeType===Node.TEXT_NODE){if(n.textContent?.trim()&&(r.push(n),r.length>32))return wi(e,null,t);continue}if(!Vn(n)||!xi.has(n.tagName)||a+i.length+n.childNodes.length>64)return wi(e,null,t);for(let e=n.childNodes.length-1;e>=0;--e)i.push(n.childNodes[e])}}if(r.length===0||vi(e))return wi(e,null,t);try{let n=e.ownerDocument.createRange(),i=Yn(e.ownerDocument.defaultView,0,0),a=[];for(let o of r){n.selectNodeContents(o);let r=n.getClientRects();if(a.length+r.length>64)return wi(e,null,t);for(let e=0;e<r.length;e+=1){let t=r[e],n=t.width*i.scaleX,o=t.height*i.scaleY;!Number.isFinite(t.left)||!Number.isFinite(t.top)||!Number.isFinite(n)||!Number.isFinite(o)||n<=0||o<=0||a.push({borderRadius:`0px`,height:o,width:n,x:i.x+t.left*i.scaleX,y:i.y+t.top*i.scaleY})}}return wi(e,a.length>0?a:null,t)}catch{return wi(e,null,t)}},Di=(e,t,n)=>{let r=Ei(e);if(!r)return!0;for(let e of r)if(t>=e.x&&t<=e.x+e.width&&n>=e.y&&n<=e.y+e.height)return!0;return!1},Oi=(e,t,n,r,i)=>{let a=!0;for(let o of e.elementsFromPoint(t,n)){if(ri(o)&&(a=!1),!Jr(o))continue;let s=o.shadowRoot;if(a&&s&&s!==e){let e=Oi(s,t,n,r,i);if(e)return e}if(a&&Un(o)){let e=ei(o);if(e){let a=ti(o,t,n),s=Oi(e,a.x,a.y,r,i);if(s)return s}}if(gi(o)&&Di(o,r,i))return o}return null},ki=(e,t,n,r)=>{let i=e.elementsFromPoint(t,n),a=!0;for(let o of i){if(ri(o)&&(a=!1),a&&o.shadowRoot&&o.shadowRoot!==e&&ki(o.shadowRoot,t,n,r),a&&Un(o)){let e=ei(o);if(e){let i=ti(o,t,n);ki(e,i.x,i.y,r)}}r.add(o)}};`${Bn}`;var Ai=(e,t)=>{if(e.length!==0)throw e.length===1?e[0]:AggregateError(e,t)},ji=new Set,Mi=new Set,Ni=(e,t)=>{if(Mi.has(e))try{e.unfreeze()}catch(e){t.push(e)}finally{Mi.delete(e)}},Pi=e=>(ji.add(e),()=>{let t=[];Ni(e,t),ji.delete(e),Ai(t,`Unregistering renderer freeze failed`)}),Fi=new WeakMap,Ii=new WeakMap,Li=new WeakMap,Ri=e=>typeof e==`object`&&!!e,zi=e=>typeof e==`object`&&!!e||typeof e==`function`,Bi=(e,t)=>typeof e[t]==`function`,Vi=e=>Ri(e)&&Bi(e,`clone`)&&Bi(e,`premultiply`),Hi=e=>Ri(e)&&e.isObject3D===!0&&typeof e.uuid==`string`&&typeof e.name==`string`&&typeof e.type==`string`&&typeof e.visible==`boolean`&&Vi(e.matrixWorld)&&Bi(e,`updateWorldMatrix`),Ui=e=>Ri(e)&&e.isCamera===!0,Wi=e=>Hi(e)&&e.isScene===!0&&Array.isArray(e.children),Gi=e=>Ri(e)&&typeof e.tagName==`string`&&e.tagName.toLowerCase()===`canvas`&&Bi(e,`getContext`),Ki=e=>Ri(e)&&Gi(e.domElement),qi=e=>Ri(e)&&Bi(e,`set`),Ji=e=>Ri(e)&&Bi(e,`setFromCamera`)&&Bi(e,`intersectObjects`),Yi=e=>Ri(e)&&Ki(e.gl)&&Wi(e.scene)&&Ui(e.camera)&&Ji(e.raycaster)&&qi(e.pointer),Xi=e=>e===`always`||e===`demand`||e===`never`,Zi=e=>Ri(e)&&typeof e.elapsedTime==`number`,Qi=(e,t)=>{let n=e.getState();if(typeof n.setFrameloop!=`function`)return;let r=Zi(n.clock)?n.clock.elapsedTime:null;n.setFrameloop(t);let i=e.getState().clock;r!==null&&Zi(i)&&(i.elapsedTime=r)},$i=e=>{if(Ii.has(e))return;let t=null,n=Pi({freeze:()=>{let n=Fi.get(e);if(!n)return;let r=n.getState();if(Xi(r.frameloop)&&typeof r.setFrameloop==`function`){let e=r.frameloop;Qi(n,`never`),t=()=>Qi(n,e)}},isConnected:()=>e.isConnected,unfreeze:()=>{t?.(),t=null}});Ii.set(e,n)},ea=e=>{let t=Ii.get(e);t&&(Ii.delete(e),t())},ta=e=>{let t=e.current.stateNode;if(!Ri(t)||!zi(t.containerInfo))return null;let n=t.containerInfo,r=Reflect.get(n,`getState`);if(typeof r!=`function`)return null;let i=Reflect.apply(r,n,[]);return Yi(i)?()=>{let e=Reflect.apply(r,n,[]);return Yi(e)?e:i}:null},na=e=>{let t=Li.get(e);t&&(Li.delete(e),Fi.get(t.canvas)===t.root&&(Fi.delete(t.canvas),ea(t.canvas)))},ra=e=>{let t=ta(e);if(!t){na(e);return}let n=t().gl.domElement;if(!n.isConnected||!e.current.child){na(e);return}let r=Li.get(e);r&&r.canvas!==n&&(na(e),r=void 0),r?(r.root.getState=t,r.root.selectableObjects=null):(r={canvas:n,root:{getState:t,selectableObjects:null}},Li.set(e,r)),Fi.set(n,r.root),$i(n)};Lr({name:`react-grab-three-selection`,onCommitFiberRoot:(e,t)=>ra(t)});var ia=null,aa=!1,oa=new Map,sa=new WeakSet,ca=new WeakSet,la=new WeakMap,ua=new Map,da=new Map,fa=e=>{if(ia===e&&(aa=!0),sa.has(e))return!0;if(ia===e){let t=(la.get(e)??0)+1;return la.set(e,t),t<4?!1:(sa.add(e),!0)}return!1};typeof window<`u`&&(window.requestAnimationFrame=e=>(fa(e),Qr(t=>{let n=ia,r=aa;ia=e,aa=!1;try{e(t)}finally{let t=aa;ia=n,aa=r,!t&&!ca.has(e)&&(sa.delete(e),la.delete(e))}})),window.cancelAnimationFrame=e=>{if(oa.has(e)){oa.delete(e);return}let t=da.get(e);if(t!==void 0){$r(t.nativeId),da.delete(e);return}let n=ua.get(e);if(n!==void 0){oa.delete(n),ua.delete(e);return}$r(e)}),`${zn}${zn}`;var pa=new WeakMap;Lr({name:`react-grab-freeze-updates`,onCommitFiberRoot:(e,t)=>{let n=fr().renderers.get(e);n&&pa.set(t,n)}});var ma=44,ha=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,ga=new Uint8Array(64),_a=new Uint8Array(128);for(let e=0;e<ha.length;e++){let t=ha.charCodeAt(e);ga[e]=t,_a[t]=e}function va(e,t){let n=0,r=0,i=0;do i=_a[e.next()],n|=(i&31)<<r,r+=5;while(i&32);let a=n&1;return n>>>=1,a&&(n=-2147483648|-n),t+n}function ya(e,t){return e.pos>=t?!1:e.peek()!==ma}var ba=class{constructor(e){this.pos=0,this.buffer=e}next(){return this.buffer.charCodeAt(this.pos++)}peek(){return this.buffer.charCodeAt(this.pos)}indexOf(e){let{buffer:t,pos:n}=this,r=t.indexOf(e,n);return r===-1?t.length:r}};function xa(e){e.sort(Sa)}function Sa(e,t){return e[0]-t[0]}var Ca=Symbol.for(`react.context`),wa=[],Ta=null,Ea=Error("Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render."),Da=()=>{let e=Ta;return e!==null&&(Ta=e.next),e},Oa=e=>e._currentValue,ka=(e,t,n,r=null)=>{wa.push({displayName:r,primitive:e,stackError:Error(),value:t,dispatcherHookName:n})},Aa=e=>{if(typeof e==`object`&&e){let t=e;if(typeof t.then==`function`){let e=t;switch(e.status){case`fulfilled`:return ka(`Promise`,e.value,`Use`),e.value;case`rejected`:throw e.reason}throw ka(`Unresolved`,e,`Use`),Ea}if(t.$$typeof===Ca&&`_currentValue`in t){let e=t,n=Oa(e);return ka(`Context (use)`,n,`Use`,e.displayName||`Context`),n}}throw Error(`An unsupported type was passed to use(): `+String(e))},ja=e=>{let t=Oa(e);return ka(`Context`,t,`Context`,e.displayName||null),t},Ma=e=>{let t=Da(),n=t===null?typeof e==`function`?e():e:t.memoizedState;return ka(`State`,n,`State`),[n,()=>{}]},Na=(e,t,n)=>{let r=Da(),i=r===null?n===void 0?t:n(t):r.memoizedState;return ka(`Reducer`,i,`Reducer`),[i,()=>{}]},Pa=e=>{let t=Da(),n=t===null?{current:e}:t.memoizedState;return ka(`Ref`,n.current,`Ref`),n},Fa=()=>{let e=Da();return ka(`CacheRefresh`,e===null?()=>{}:e.memoizedState,`CacheRefresh`),()=>{}},Ia=e=>{Da(),ka(`LayoutEffect`,e,`LayoutEffect`)},La=e=>{Da(),ka(`InsertionEffect`,e,`InsertionEffect`)},Ra=e=>{Da(),ka(`Effect`,e,`Effect`)},za=e=>{Da();let t;typeof e==`object`&&e&&`current`in e&&(t=e.current),ka(`ImperativeHandle`,t,`ImperativeHandle`)},Ba=(e,t)=>{ka(`DebugValue`,typeof t==`function`?t(e):e,`DebugValue`)},Va=e=>{let t=Da();return ka(`Callback`,t===null?e:t.memoizedState[0],`Callback`),e},Ha=e=>{let t=Da(),n=t===null?e():t.memoizedState[0];return ka(`Memo`,n,`Memo`),n},Ua=(e,t)=>{let n=Da();Da();let r=n===null?t():n.memoizedState;return ka(`SyncExternalStore`,r,`SyncExternalStore`),r},Wa=()=>{let e=Da();Da();let t=e===null?!1:e.memoizedState;return ka(`Transition`,t,`Transition`),[t,()=>{}]},Ga=e=>{let t=Da(),n=t===null?e:t.memoizedState;return ka(`DeferredValue`,n,`DeferredValue`),n},Ka=()=>{let e=Da(),t=e===null?``:e.memoizedState;return ka(`Id`,t,`Id`),t},qa=e=>[],Ja=e=>{let t=Da(),n=t===null?e:t.memoizedState;return ka(`Optimistic`,n,`Optimistic`),[n,()=>{}]},Ya=(e,t)=>{let n,r=null;if(e!==null){let t=e.memoizedState;if(typeof t==`object`&&t&&`then`in t&&typeof t.then==`function`){let e=t;switch(e.status){case`fulfilled`:n=e.value;break;case`rejected`:r=e.reason;break;default:r=Ea,n=e}}else n=t}else n=t;return{value:n,error:r}},Xa=e=>(t,n)=>{let r=Da();Da(),Da();let i=Error(),{value:a,error:o}=Ya(r,n);if(wa.push({displayName:null,primitive:e,stackError:i,value:a,dispatcherHookName:e}),o!==null)throw o;return[a,()=>{},!1]},Za=Xa(`ActionState`),Qa={readContext:Oa,use:Aa,useCallback:Va,useContext:ja,useEffect:Ra,useImperativeHandle:za,useLayoutEffect:Ia,useInsertionEffect:La,useMemo:Ha,useReducer:Na,useRef:Pa,useState:Ma,useDebugValue:Ba,useDeferredValue:Ga,useTransition:Wa,useSyncExternalStore:Ua,useId:Ka,useHostTransitionStatus:()=>{let e=Oa({_currentValue:null});return ka(`HostTransitionStatus`,e,`HostTransitionStatus`),e},useFormState:Xa(`FormState`),useActionState:Za,useOptimistic:Ja,useMemoCache:qa,useCacheRefresh:Fa,useEffectEvent:e=>(Da(),ka(`EffectEvent`,e,`EffectEvent`),e)};typeof Proxy>`u`||new Proxy(Qa,{get(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t];let n=Error(`Missing method in Dispatcher: `+t);throw n.name=`ReactDebugToolsUnsupportedHookError`,n}});var $a=new Set([`role`,`name`,`aria-label`,`rel`,`href`]),eo=e=>{if(!/^[a-z-]{3,}$/i.test(e))return!1;let t=e.split(/-|[A-Z]/);for(let e of t)if(e.length<=2||/[^aeiou]{4,}/i.test(e))return!1;return!0},to=(e,t)=>{let n=$a.has(e)||e.startsWith(`data-`)&&eo(e),r=eo(t)&&t.length<100||t.startsWith(`#`)&&eo(t.slice(1));return n&&r},no=e=>{let t=e[0].name;for(let n=1;n<e.length;n++)t=`${e[n].name} > ${t}`;return t},ro=e=>{let t=0;for(let n of e)t+=n.penalty;return t},io=(e,t)=>ro(e)-ro(t),ao=(e,t)=>{let n=e.parentNode;if(!n)return;let r=n.firstChild;if(!r)return;let i=0;for(;r&&(Vn(r)&&(t===void 0||r.tagName.toLowerCase()===t)&&i++,r!==e);)r=r.nextSibling;return i},oo=(e,t)=>e===`html`?`html`:`${e}:nth-child(${t})`,so=(e,t)=>e===`html`?`html`:`${e}:nth-of-type(${t})`,co=(e,t)=>{let n=[],r=e.getAttribute(`id`),i=e.tagName.toLowerCase();r&&eo(r)&&n.push({name:`#${CSS.escape(r)}`,penalty:0});for(let t of e.classList)eo(t)&&n.push({name:`.${CSS.escape(t)}`,penalty:1});for(let r of e.attributes)t(r.name,r.value)&&n.push({name:`[${CSS.escape(r.name)}="${CSS.escape(r.value)}"]`,penalty:2});n.push({name:i,penalty:5});let a=ao(e,i);a!==void 0&&n.push({name:so(i,a),penalty:10});let o=ao(e);return o!==void 0&&n.push({name:oo(i,o),penalty:50}),n},lo=(e,t=Ln,n=[])=>{if(t<=0)return[];if(e.length===0)return[n];let r=[];for(let i of e[0]){let a=t-r.length;if(a<=0)break;r.push(...lo(e.slice(1),a,[...n,i]))}return r},uo=(e,t)=>{let n=t.getRootNode();return Br(n)?n:Kr(e)?e:e.ownerDocument},fo=(e,t)=>t.querySelectorAll(no(e)).length===1,po=(e,t)=>{let n=e,r=[];for(;n&&n!==t;){let e=n.tagName.toLowerCase(),t=ao(n,e);if(t===void 0)return;r.push({name:so(e,t),penalty:10}),n=n.parentElement}return fo(r,t)?r:void 0},mo=(e,t,n,r)=>{if(e.nodeType!==Node.ELEMENT_NODE)throw new Hr;if(e.tagName.toLowerCase()===`html`)return`html`;let i=uo(t,e),a=Date.now(),o=[],s=e,c=0,l;for(;s&&s!==i&&!l;)if(o.push(co(s,r)),s=s.parentElement,c++,c>=3){let t=lo(o);t.sort(io);for(let r of t){if(Date.now()-a>n){let t=po(e,i);if(!t)throw new Ur(n);return no(t)}if(fo(r,i)){l=r;break}}}if(!l&&c<3){let e=lo(o);e.sort(io);for(let t of e){if(Date.now()-a>n)break;if(fo(t,i)){l=t;break}}}if(!l)throw new Wr;return no(l)},ho=/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i,go=/:r[a-z0-9]+:/i,_o=/_r_[a-z0-9]+_(?:$|-)/i,vo=/«r[a-z0-9]+»/i,yo=/^(?:downshift-\d+(?:-|$)|headlessui-[a-z-]+-\d+(?:-|$)|mui-\d+(?:-|$)|radix-\d+(?:-|$)|react-aria-\d+(?:-|$)|react-select-\d+(?:-|$))/i,bo=/^ember\d+$/i,xo=/^\d+$/,So=e=>e.length>0&&e.length<=120&&!go.test(e)&&!ho.test(e)&&!_o.test(e)&&!vo.test(e)&&!yo.test(e)&&!bo.test(e)&&!xo.test(e),Co=new Set([`data-testid`,`data-test-id`,`data-test`,`data-cy`,`data-qa`,`aria-label`,`href`,`src`,`role`,`name`,`title`,`alt`]),wo=new Set([`button`,`link`,`checkbox`,`radio`,`switch`,`tab`,`menuitem`,`option`,`textbox`,`combobox`,`slider`,`spinbutton`]),To=e=>e.ownerDocument.body??e.ownerDocument.documentElement,Eo=e=>e.length>0&&e.length<=120,Do=(e,t)=>Co.has(e)&&Eo(t)&&(e!==`role`||t.split(/\s+/).some(e=>wo.has(e))),Oo=(e,t)=>{try{let n=e.getRootNode(),r=(Br(n)?n:e.ownerDocument).querySelectorAll(t);return r.length===1&&r[0]===e}catch{return!1}},ko=e=>{let t=e.getAttribute(`id`),n=null;if(t){let r=`#${CSS.escape(t)}`;if(Oo(e,r)){if(So(t))return{selector:r,isSemantic:!0};n=r}}for(let t of Co){let n=e.getAttribute(t);if(!n||!Do(t,n))continue;let r=`[${t}=${JSON.stringify(n)}]`;if(Oo(e,r))return{selector:r,isSemantic:!0};let i=`${e.tagName.toLowerCase()}${r}`;if(Oo(e,i))return{selector:i,isSemantic:!0}}return n?{selector:n,isSemantic:!1}:null},Ao=e=>{let t=[],n=e.getRootNode(),r=Br(n)?n:To(e),i=e;for(;i;){let e=i.getAttribute(`id`);if(e){t.unshift(`#${CSS.escape(e)}`);break}let n=i.parentNode;if(!n){t.unshift(i.tagName.toLowerCase());break}let a=Array.from(n.children).indexOf(i)+1;if(t.unshift(`${i.tagName.toLowerCase()}:nth-child(${a})`),n===r){Vn(r)&&t.unshift(r.tagName.toLowerCase());break}i=Vn(n)?n:null}return t.join(` > `)},jo=e=>{let t=ko(e);if(t)return t;try{let t=mo(e,To(e),200,(e,t)=>to(e,t)||Do(e,t));if(t)return{selector:t,isSemantic:!1}}catch{}return{selector:Ao(e),isSemantic:!1}},Mo=e=>{let t=zr(e);if(t)return{selector:t.getSelector(),isSemantic:!0};let n=ko(e);if(!n?.isSemantic)return null;let r=e.getRootNode();if(Br(r)){let e=Mo(r.host);return e?{selector:`${e.selector} >>> ${n.selector}`,isSemantic:!0}:null}let i=Jn(e.ownerDocument.defaultView);if(!i)return n;let a=Mo(i);return a?{selector:`${a.selector} >>iframe>> ${n.selector}`,isSemantic:!0}:null},No=e=>{let t=zr(e);if(t)return{selector:t.getSelector(),isSemantic:!0};let n=jo(e),r=e.getRootNode();if(Br(r)){let e=No(r.host);return{selector:`${e.selector} >>> ${n.selector}`,isSemantic:e.isSemantic&&n.isSemantic}}let i=Jn(e.ownerDocument.defaultView);if(!i)return n;let a=No(i);return{selector:`${a.selector} >>iframe>> ${n.selector}`,isSemantic:a.isSemantic&&n.isSemantic}};[...Array.from(Co).filter(e=>e!==`role`).map(e=>`[${e}]`),...Array.from(wo).map(e=>`[role~="${e}"]`)].join(`,`),[`button`,`input`,`select`,`textarea`].join(`,`);var Po=e=>e.replace(/\s+/g,` `).trim(),Fo=e=>e.getAttribute(`aria-hidden`)===`true`||e.hasAttribute(`hidden`)?!0:Rn.has(e.tagName.toLowerCase()),Io=(e,t,n)=>{if(e.nodeType===Node.TEXT_NODE){let r=Po(e.textContent??``);return r?(t.push(r),n-r.length):n}if(!Vn(e)||Fo(e))return n;for(let r of e.childNodes)if(n=Io(r,t,n),n<=0)break;return n};new Set(`AppRouter.AppRouterAnnouncer.AppDevOverlay.AppDevOverlayErrorBoundary.ClientPageRoot.ClientSegmentRoot.DevRootHTTPAccessFallbackBoundary.ErrorBoundary.ErrorBoundaryHandler.GracefulDegradeBoundary.HTTPAccessErrorFallback.HTTPAccessFallbackBoundary.HTTPAccessFallbackErrorBoundary.HandleRedirect.Head.HistoryUpdater.HotReload.InnerLayoutRouter.InnerScrollAndFocusHandler.InnerScrollAndFocusHandlerOld.InnerScrollAndMaybeFocusHandler.InnerScrollHandlerNew.LinkComponent.LoadableComponent.LoadingBoundary.LoadingBoundaryProvider.NotAllowedRootHTTPFallbackError.OfflineProvider.OuterLayoutRouter.RedirectBoundary.RedirectErrorBoundary.RenderFromTemplateContext.RenderValidationBoundaryAtThisLevel.ReplaySsrOnlyErrors.RootErrorBoundary.RootLevelDevOverlayElement.Router.ScrollAndFocusHandler.ScrollAndMaybeFocusHandler.SegmentBoundaryTrigger.SegmentBoundaryTriggerNode.SegmentStateProvider.SegmentTrieNode.SegmentViewNode.SegmentViewStateNode.ServerRoot.body.html`.split(`.`)),new Map([`top`,`right`,`bottom`,`left`].flatMap(e=>[[`border-${e}-style`,e],[`border-${e}-color`,e]]));var Lo=Object.defineProperty,Ro=(e,t,n)=>t in e?Lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zo=(e,t,n)=>Ro(e,typeof t==`symbol`?t:t+``,n);Array.prototype.toSorted||Object.defineProperty(Array.prototype,"toSorted",{value:function(e){return[...this].sort(e)},writable:!0,configurable:!0});var Bo=typeof window<`u`,Vo=()=>Bo?(window.reactScanIdCounter===void 0&&(window.reactScanIdCounter=0),`${++window.reactScanIdCounter}`):`0`,Ho=e=>{let t=e.createOscillator(),n=e.createGain();t.connect(n),n.connect(e.destination);let r={type:`sine`,freq:[392,600],duration:.3,gain:.12},i=r.freq,a=r.duration/i.length;i.forEach((n,r)=>{t.frequency.setValueAtTime(n,e.currentTime+r*a)}),t.type=r.type,n.gain.setValueAtTime(r.gain,e.currentTime),n.gain.setTargetAtTime(0,e.currentTime+r.duration*.7,.05),t.start(),t.stop(e.currentTime+r.duration)},Uo=un(({size:e=15,name:t,fill:n=`currentColor`,stroke:r=`currentColor`,className:i,externalURL:a=``,style:o},s)=>{let c=Array.isArray(e)?e[0]:e,l=Array.isArray(e)?e[1]||e[0]:e,u=`${a}#${t}`;return I(`svg`,{ref:s,width:`${c}px`,height:`${l}px`,fill:n,stroke:r,className:i,style:{...o,minWidth:`${c}px`,maxWidth:`${c}px`,minHeight:`${l}px`,maxHeight:`${l}px`},children:[I(`title`,{children:t}),I(`use`,{href:u})]})}),Wo=24,Go={width:550,height:350,initialHeight:400},Ko=240,qo=`react-scan-widget-settings-v2`,Jo=`react-scan-widget-collapsed-v1`;function Yo(e){var t,n,r=``;if(typeof e==`string`||typeof e==`number`)r+=e;else if(typeof e==`object`)if(Array.isArray(e)){var i=e.length;for(t=0;t<i;t++)e[t]&&(n=Yo(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function Xo(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=Yo(e))&&(r&&(r+=` `),r+=t);return r}var Zo=(e,t)=>{let n=Array(e.length+t.length);for(let t=0;t<e.length;t++)n[t]=e[t];for(let r=0;r<t.length;r++)n[e.length+r]=t[r];return n},Qo=(e,t)=>({classGroupId:e,validator:t}),$o=(e=new Map,t=null,n)=>({nextPart:e,validators:t,classGroupId:n}),es=`-`,ts=[],ns=`arbitrary..`,rs=e=>{let t=os(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{if(e.startsWith(`[`)&&e.endsWith(`]`))return as(e);let n=e.split(es);return is(n,+(n[0]===``&&n.length>1),t)},getConflictingClassGroupIds:(e,t)=>{if(t){let t=r[e],i=n[e];return t?i?Zo(i,t):t:i||ts}return n[e]||ts}}},is=(e,t,n)=>{if(e.length-t===0)return n.classGroupId;let r=e[t],i=n.nextPart.get(r);if(i){let n=is(e,t+1,i);if(n)return n}let a=n.validators;if(a===null)return;let o=t===0?e.join(es):e.slice(t).join(es),s=a.length;for(let e=0;e<s;e++){let t=a[e];if(t.validator(o))return t.classGroupId}},as=e=>e.slice(1,-1).indexOf(`:`)===-1?void 0:(()=>{let t=e.slice(1,-1),n=t.indexOf(`:`),r=t.slice(0,n);return r?ns+r:void 0})(),os=e=>{let{theme:t,classGroups:n}=e;return ss(n,t)},ss=(e,t)=>{let n=$o();for(let r in e){let i=e[r];cs(i,n,r,t)}return n},cs=(e,t,n,r)=>{let i=e.length;for(let a=0;a<i;a++){let i=e[a];ls(i,t,n,r)}},ls=(e,t,n,r)=>{if(typeof e==`string`){us(e,t,n);return}if(typeof e==`function`){ds(e,t,n,r);return}fs(e,t,n,r)},us=(e,t,n)=>{let r=e===``?t:ps(t,e);r.classGroupId=n},ds=(e,t,n,r)=>{if(ms(e)){cs(e(r),t,n,r);return}t.validators===null&&(t.validators=[]),t.validators.push(Qo(n,e))},fs=(e,t,n,r)=>{let i=Object.entries(e),a=i.length;for(let e=0;e<a;e++){let[a,o]=i[e];cs(o,ps(t,a),n,r)}},ps=(e,t)=>{let n=e,r=t.split(es),i=r.length;for(let e=0;e<i;e++){let t=r[e],i=n.nextPart.get(t);i||(i=$o(),n.nextPart.set(t,i)),n=i}return n},ms=e=>`isThemeGetter`in e&&e.isThemeGetter===!0,hs=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=Object.create(null),r=Object.create(null),i=(i,a)=>{n[i]=a,t++,t>e&&(t=0,r=n,n=Object.create(null))};return{get(e){let t=n[e];if(t!==void 0)return t;if((t=r[e])!==void 0)return i(e,t),t},set(e,t){e in n?n[e]=t:i(e,t)}}},gs=`!`,_s=`:`,vs=[],ys=(e,t,n,r,i)=>({modifiers:e,hasImportantModifier:t,baseClassName:n,maybePostfixModifierPosition:r,isExternal:i}),bs=e=>{let{prefix:t,experimentalParseClassName:n}=e,r=e=>{let t=[],n=0,r=0,i=0,a,o=e.length;for(let s=0;s<o;s++){let o=e[s];if(n===0&&r===0){if(o===_s){t.push(e.slice(i,s)),i=s+1;continue}if(o===`/`){a=s;continue}}o===`[`?n++:o===`]`?n--:o===`(`?r++:o===`)`&&r--}let s=t.length===0?e:e.slice(i),c=s,l=!1;s.endsWith(gs)?(c=s.slice(0,-1),l=!0):s.startsWith(gs)&&(c=s.slice(1),l=!0);let u=a&&a>i?a-i:void 0;return ys(t,l,c,u)};if(t){let e=t+_s,n=r;r=t=>t.startsWith(e)?n(t.slice(e.length)):ys(vs,!1,t,void 0,!0)}if(n){let e=r;r=t=>n({className:t,parseClassName:e})}return r},xs=e=>{let t=new Map;return e.orderSensitiveModifiers.forEach((e,n)=>{t.set(e,1e6+n)}),e=>{let n=[],r=[];for(let i=0;i<e.length;i++){let a=e[i],o=a[0]===`[`,s=t.has(a);o||s?(r.length>0&&(r.sort(),n.push(...r),r=[]),n.push(a)):r.push(a)}return r.length>0&&(r.sort(),n.push(...r)),n}},Ss=e=>({cache:hs(e.cacheSize),parseClassName:bs(e),sortModifiers:xs(e),...rs(e)}),Cs=/\s+/,ws=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i,sortModifiers:a}=t,o=[],s=e.trim().split(Cs),c=``;for(let e=s.length-1;e>=0;--e){let t=s[e],{isExternal:l,modifiers:u,hasImportantModifier:d,baseClassName:f,maybePostfixModifierPosition:p}=n(t);if(l){c=t+(c.length>0?` `+c:c);continue}let m=!!p,h=r(m?f.substring(0,p):f);if(!h){if(!m){c=t+(c.length>0?` `+c:c);continue}if(h=r(f),!h){c=t+(c.length>0?` `+c:c);continue}m=!1}let g=u.length===0?``:u.length===1?u[0]:a(u).join(`:`),_=d?g+gs:g,v=_+h;if(o.indexOf(v)>-1)continue;o.push(v);let y=i(h,m);for(let e=0;e<y.length;++e){let t=y[e];o.push(_+t)}c=t+(c.length>0?` `+c:c)}return c},Ts=(...e)=>{let t=0,n,r,i=``;for(;t<e.length;)(n=e[t++])&&(r=Es(n))&&(i&&(i+=` `),i+=r);return i},Es=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=Es(e[r]))&&(n&&(n+=` `),n+=t);return n},Ds=(e,...t)=>{let n,r,i,a,o=o=>(n=Ss(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)),s=e=>{let t=r(e);if(t)return t;let a=ws(e,n);return i(e,a),a};return a=o,(...e)=>a(Ts(...e))},Os=[],ks=e=>{let t=t=>t[e]||Os;return t.isThemeGetter=!0,t},As=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,js=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Ms=/^\d+(?:\.\d+)?\/\d+(?:\.\d+)?$/,Ns=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ps=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,Fs=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Is=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ls=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Rs=e=>Ms.test(e),zs=e=>!!e&&!Number.isNaN(Number(e)),Bs=e=>!!e&&Number.isInteger(Number(e)),Vs=e=>e.endsWith(`%`)&&zs(e.slice(0,-1)),Hs=e=>Ns.test(e),Us=()=>!0,Ws=e=>Ps.test(e)&&!Fs.test(e),Gs=()=>!1,Ks=e=>Is.test(e),qs=e=>Ls.test(e),Js=e=>!L(e)&&!R(e),Ys=e=>uc(e,mc,Gs),L=e=>As.test(e),Xs=e=>uc(e,hc,Ws),Zs=e=>uc(e,gc,zs),Qs=e=>uc(e,vc,Us),$s=e=>uc(e,_c,Gs),ec=e=>uc(e,fc,Gs),tc=e=>uc(e,pc,qs),nc=e=>uc(e,yc,Ks),R=e=>js.test(e),rc=e=>dc(e,hc),ic=e=>dc(e,_c),ac=e=>dc(e,fc),oc=e=>dc(e,mc),sc=e=>dc(e,pc),cc=e=>dc(e,yc,!0),lc=e=>dc(e,vc,!0),uc=(e,t,n)=>{let r=As.exec(e);return r?r[1]?t(r[1]):n(r[2]):!1},dc=(e,t,n=!1)=>{let r=js.exec(e);return r?r[1]?t(r[1]):n:!1},fc=e=>e===`position`||e===`percentage`,pc=e=>e===`image`||e===`url`,mc=e=>e===`length`||e===`size`||e===`bg-size`,hc=e=>e===`length`,gc=e=>e===`number`,_c=e=>e===`family-name`,vc=e=>e===`number`||e===`weight`,yc=e=>e===`shadow`,bc=Ds(()=>{let e=ks(`color`),t=ks(`font`),n=ks(`text`),r=ks(`font-weight`),i=ks(`tracking`),a=ks(`leading`),o=ks(`breakpoint`),s=ks(`container`),c=ks(`spacing`),l=ks(`radius`),u=ks(`shadow`),d=ks(`inset-shadow`),f=ks(`text-shadow`),p=ks(`drop-shadow`),m=ks(`blur`),h=ks(`perspective`),g=ks(`aspect`),_=ks(`ease`),v=ks(`animate`),y=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],b=()=>[`center`,`top`,`bottom`,`left`,`right`,`top-left`,`left-top`,`top-right`,`right-top`,`bottom-right`,`right-bottom`,`bottom-left`,`left-bottom`],x=()=>[...b(),R,L],S=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],C=()=>[`auto`,`contain`,`none`],w=()=>[R,L,c],T=()=>[Rs,`full`,`auto`,...w()],E=()=>[Bs,`none`,`subgrid`,R,L],D=()=>[`auto`,{span:[`full`,Bs,R,L]},Bs,R,L],O=()=>[Bs,`auto`,R,L],k=()=>[`auto`,`min`,`max`,`fr`,R,L],A=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`,`baseline`,`center-safe`,`end-safe`],j=()=>[`start`,`end`,`center`,`stretch`,`center-safe`,`end-safe`],M=()=>[`auto`,...w()],N=()=>[Rs,`auto`,`full`,`dvw`,`dvh`,`lvw`,`lvh`,`svw`,`svh`,`min`,`max`,`fit`,...w()],P=()=>[Rs,`screen`,`full`,`dvw`,`lvw`,`svw`,`min`,`max`,`fit`,...w()],ee=()=>[Rs,`screen`,`full`,`lh`,`dvh`,`lvh`,`svh`,`min`,`max`,`fit`,...w()],F=()=>[e,R,L],te=()=>[...b(),ac,ec,{position:[R,L]}],ne=()=>[`no-repeat`,{repeat:[``,`x`,`y`,`space`,`round`]}],re=()=>[`auto`,`cover`,`contain`,oc,Ys,{size:[R,L]}],ie=()=>[Vs,rc,Xs],ae=()=>[``,`none`,`full`,l,R,L],oe=()=>[``,zs,rc,Xs],se=()=>[`solid`,`dashed`,`dotted`,`double`],ce=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],le=()=>[zs,Vs,ac,ec],ue=()=>[``,`none`,m,R,L],de=()=>[`none`,zs,R,L],fe=()=>[`none`,zs,R,L],pe=()=>[zs,R,L],me=()=>[Rs,`full`,...w()];return{cacheSize:500,theme:{animate:[`spin`,`ping`,`pulse`,`bounce`],aspect:[`video`],blur:[Hs],breakpoint:[Hs],color:[Us],container:[Hs],"drop-shadow":[Hs],ease:[`in`,`out`,`in-out`],font:[Js],"font-weight":[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`],"inset-shadow":[Hs],leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`],perspective:[`dramatic`,`near`,`normal`,`midrange`,`distant`,`none`],radius:[Hs],shadow:[Hs],spacing:[`px`,zs],text:[Hs],"text-shadow":[Hs],tracking:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`]},classGroups:{aspect:[{aspect:[`auto`,`square`,Rs,L,R,g]}],container:[`container`],columns:[{columns:[zs,L,R,s]}],"break-after":[{"break-after":y()}],"break-before":[{"break-before":y()}],"break-inside":[{"break-inside":[`auto`,`avoid`,`avoid-page`,`avoid-column`]}],"box-decoration":[{"box-decoration":[`slice`,`clone`]}],box:[{box:[`border`,`content`]}],display:[`block`,`inline-block`,`inline`,`flex`,`inline-flex`,`table`,`inline-table`,`table-caption`,`table-cell`,`table-column`,`table-column-group`,`table-footer-group`,`table-header-group`,`table-row-group`,`table-row`,`flow-root`,`grid`,`inline-grid`,`contents`,`list-item`,`hidden`],sr:[`sr-only`,`not-sr-only`],float:[{float:[`right`,`left`,`none`,`start`,`end`]}],clear:[{clear:[`left`,`right`,`both`,`none`,`start`,`end`]}],isolation:[`isolate`,`isolation-auto`],"object-fit":[{object:[`contain`,`cover`,`fill`,`none`,`scale-down`]}],"object-position":[{object:x()}],overflow:[{overflow:S()}],"overflow-x":[{"overflow-x":S()}],"overflow-y":[{"overflow-y":S()}],overscroll:[{overscroll:C()}],"overscroll-x":[{"overscroll-x":C()}],"overscroll-y":[{"overscroll-y":C()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:T()}],"inset-x":[{"inset-x":T()}],"inset-y":[{"inset-y":T()}],start:[{"inset-s":T(),start:T()}],end:[{"inset-e":T(),end:T()}],"inset-bs":[{"inset-bs":T()}],"inset-be":[{"inset-be":T()}],top:[{top:T()}],right:[{right:T()}],bottom:[{bottom:T()}],left:[{left:T()}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[Bs,`auto`,R,L]}],basis:[{basis:[Rs,`full`,`auto`,s,...w()]}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`nowrap`,`wrap`,`wrap-reverse`]}],flex:[{flex:[zs,Rs,`auto`,`initial`,`none`,L]}],grow:[{grow:[``,zs,R,L]}],shrink:[{shrink:[``,zs,R,L]}],order:[{order:[Bs,`first`,`last`,`none`,R,L]}],"grid-cols":[{"grid-cols":E()}],"col-start-end":[{col:D()}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":E()}],"row-start-end":[{row:D()}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":k()}],"auto-rows":[{"auto-rows":k()}],gap:[{gap:w()}],"gap-x":[{"gap-x":w()}],"gap-y":[{"gap-y":w()}],"justify-content":[{justify:[...A(),`normal`]}],"justify-items":[{"justify-items":[...j(),`normal`]}],"justify-self":[{"justify-self":[`auto`,...j()]}],"align-content":[{content:[`normal`,...A()]}],"align-items":[{items:[...j(),{baseline:[``,`last`]}]}],"align-self":[{self:[`auto`,...j(),{baseline:[``,`last`]}]}],"place-content":[{"place-content":A()}],"place-items":[{"place-items":[...j(),`baseline`]}],"place-self":[{"place-self":[`auto`,...j()]}],p:[{p:w()}],px:[{px:w()}],py:[{py:w()}],ps:[{ps:w()}],pe:[{pe:w()}],pbs:[{pbs:w()}],pbe:[{pbe:w()}],pt:[{pt:w()}],pr:[{pr:w()}],pb:[{pb:w()}],pl:[{pl:w()}],m:[{m:M()}],mx:[{mx:M()}],my:[{my:M()}],ms:[{ms:M()}],me:[{me:M()}],mbs:[{mbs:M()}],mbe:[{mbe:M()}],mt:[{mt:M()}],mr:[{mr:M()}],mb:[{mb:M()}],ml:[{ml:M()}],"space-x":[{"space-x":w()}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":w()}],"space-y-reverse":[`space-y-reverse`],size:[{size:N()}],"inline-size":[{inline:[`auto`,...P()]}],"min-inline-size":[{"min-inline":[`auto`,...P()]}],"max-inline-size":[{"max-inline":[`none`,...P()]}],"block-size":[{block:[`auto`,...ee()]}],"min-block-size":[{"min-block":[`auto`,...ee()]}],"max-block-size":[{"max-block":[`none`,...ee()]}],w:[{w:[s,`screen`,...N()]}],"min-w":[{"min-w":[s,`screen`,`none`,...N()]}],"max-w":[{"max-w":[s,`screen`,`none`,`prose`,{screen:[o]},...N()]}],h:[{h:[`screen`,`lh`,...N()]}],"min-h":[{"min-h":[`screen`,`lh`,`none`,...N()]}],"max-h":[{"max-h":[`screen`,`lh`,...N()]}],"font-size":[{text:[`base`,n,rc,Xs]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[r,lc,Qs]}],"font-stretch":[{"font-stretch":[`ultra-condensed`,`extra-condensed`,`condensed`,`semi-condensed`,`normal`,`semi-expanded`,`expanded`,`extra-expanded`,`ultra-expanded`,Vs,L]}],"font-family":[{font:[ic,$s,t]}],"font-features":[{"font-features":[L]}],"fvn-normal":[`normal-nums`],"fvn-ordinal":[`ordinal`],"fvn-slashed-zero":[`slashed-zero`],"fvn-figure":[`lining-nums`,`oldstyle-nums`],"fvn-spacing":[`proportional-nums`,`tabular-nums`],"fvn-fraction":[`diagonal-fractions`,`stacked-fractions`],tracking:[{tracking:[i,R,L]}],"line-clamp":[{"line-clamp":[zs,`none`,R,Zs]}],leading:[{leading:[a,...w()]}],"list-image":[{"list-image":[`none`,R,L]}],"list-style-position":[{list:[`inside`,`outside`]}],"list-style-type":[{list:[`disc`,`decimal`,`none`,R,L]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"placeholder-color":[{placeholder:F()}],"text-color":[{text:F()}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...se(),`wavy`]}],"text-decoration-thickness":[{decoration:[zs,`from-font`,`auto`,R,Xs]}],"text-decoration-color":[{decoration:F()}],"underline-offset":[{"underline-offset":[zs,`auto`,R,L]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:w()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,R,L]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],wrap:[{wrap:[`break-word`,`anywhere`,`normal`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,R,L]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:te()}],"bg-repeat":[{bg:ne()}],"bg-size":[{bg:re()}],"bg-image":[{bg:[`none`,{linear:[{to:[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Bs,R,L],radial:[``,R,L],conic:[Bs,R,L]},sc,tc]}],"bg-color":[{bg:F()}],"gradient-from-pos":[{from:ie()}],"gradient-via-pos":[{via:ie()}],"gradient-to-pos":[{to:ie()}],"gradient-from":[{from:F()}],"gradient-via":[{via:F()}],"gradient-to":[{to:F()}],rounded:[{rounded:ae()}],"rounded-s":[{"rounded-s":ae()}],"rounded-e":[{"rounded-e":ae()}],"rounded-t":[{"rounded-t":ae()}],"rounded-r":[{"rounded-r":ae()}],"rounded-b":[{"rounded-b":ae()}],"rounded-l":[{"rounded-l":ae()}],"rounded-ss":[{"rounded-ss":ae()}],"rounded-se":[{"rounded-se":ae()}],"rounded-ee":[{"rounded-ee":ae()}],"rounded-es":[{"rounded-es":ae()}],"rounded-tl":[{"rounded-tl":ae()}],"rounded-tr":[{"rounded-tr":ae()}],"rounded-br":[{"rounded-br":ae()}],"rounded-bl":[{"rounded-bl":ae()}],"border-w":[{border:oe()}],"border-w-x":[{"border-x":oe()}],"border-w-y":[{"border-y":oe()}],"border-w-s":[{"border-s":oe()}],"border-w-e":[{"border-e":oe()}],"border-w-bs":[{"border-bs":oe()}],"border-w-be":[{"border-be":oe()}],"border-w-t":[{"border-t":oe()}],"border-w-r":[{"border-r":oe()}],"border-w-b":[{"border-b":oe()}],"border-w-l":[{"border-l":oe()}],"divide-x":[{"divide-x":oe()}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":oe()}],"divide-y-reverse":[`divide-y-reverse`],"border-style":[{border:[...se(),`hidden`,`none`]}],"divide-style":[{divide:[...se(),`hidden`,`none`]}],"border-color":[{border:F()}],"border-color-x":[{"border-x":F()}],"border-color-y":[{"border-y":F()}],"border-color-s":[{"border-s":F()}],"border-color-e":[{"border-e":F()}],"border-color-bs":[{"border-bs":F()}],"border-color-be":[{"border-be":F()}],"border-color-t":[{"border-t":F()}],"border-color-r":[{"border-r":F()}],"border-color-b":[{"border-b":F()}],"border-color-l":[{"border-l":F()}],"divide-color":[{divide:F()}],"outline-style":[{outline:[...se(),`none`,`hidden`]}],"outline-offset":[{"outline-offset":[zs,R,L]}],"outline-w":[{outline:[``,zs,rc,Xs]}],"outline-color":[{outline:F()}],shadow:[{shadow:[``,`none`,u,cc,nc]}],"shadow-color":[{shadow:F()}],"inset-shadow":[{"inset-shadow":[`none`,d,cc,nc]}],"inset-shadow-color":[{"inset-shadow":F()}],"ring-w":[{ring:oe()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:F()}],"ring-offset-w":[{"ring-offset":[zs,Xs]}],"ring-offset-color":[{"ring-offset":F()}],"inset-ring-w":[{"inset-ring":oe()}],"inset-ring-color":[{"inset-ring":F()}],"text-shadow":[{"text-shadow":[`none`,f,cc,nc]}],"text-shadow-color":[{"text-shadow":F()}],opacity:[{opacity:[zs,R,L]}],"mix-blend":[{"mix-blend":[...ce(),`plus-darker`,`plus-lighter`]}],"bg-blend":[{"bg-blend":ce()}],"mask-clip":[{"mask-clip":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]},`mask-no-clip`],"mask-composite":[{mask:[`add`,`subtract`,`intersect`,`exclude`]}],"mask-image-linear-pos":[{"mask-linear":[zs]}],"mask-image-linear-from-pos":[{"mask-linear-from":le()}],"mask-image-linear-to-pos":[{"mask-linear-to":le()}],"mask-image-linear-from-color":[{"mask-linear-from":F()}],"mask-image-linear-to-color":[{"mask-linear-to":F()}],"mask-image-t-from-pos":[{"mask-t-from":le()}],"mask-image-t-to-pos":[{"mask-t-to":le()}],"mask-image-t-from-color":[{"mask-t-from":F()}],"mask-image-t-to-color":[{"mask-t-to":F()}],"mask-image-r-from-pos":[{"mask-r-from":le()}],"mask-image-r-to-pos":[{"mask-r-to":le()}],"mask-image-r-from-color":[{"mask-r-from":F()}],"mask-image-r-to-color":[{"mask-r-to":F()}],"mask-image-b-from-pos":[{"mask-b-from":le()}],"mask-image-b-to-pos":[{"mask-b-to":le()}],"mask-image-b-from-color":[{"mask-b-from":F()}],"mask-image-b-to-color":[{"mask-b-to":F()}],"mask-image-l-from-pos":[{"mask-l-from":le()}],"mask-image-l-to-pos":[{"mask-l-to":le()}],"mask-image-l-from-color":[{"mask-l-from":F()}],"mask-image-l-to-color":[{"mask-l-to":F()}],"mask-image-x-from-pos":[{"mask-x-from":le()}],"mask-image-x-to-pos":[{"mask-x-to":le()}],"mask-image-x-from-color":[{"mask-x-from":F()}],"mask-image-x-to-color":[{"mask-x-to":F()}],"mask-image-y-from-pos":[{"mask-y-from":le()}],"mask-image-y-to-pos":[{"mask-y-to":le()}],"mask-image-y-from-color":[{"mask-y-from":F()}],"mask-image-y-to-color":[{"mask-y-to":F()}],"mask-image-radial":[{"mask-radial":[R,L]}],"mask-image-radial-from-pos":[{"mask-radial-from":le()}],"mask-image-radial-to-pos":[{"mask-radial-to":le()}],"mask-image-radial-from-color":[{"mask-radial-from":F()}],"mask-image-radial-to-color":[{"mask-radial-to":F()}],"mask-image-radial-shape":[{"mask-radial":[`circle`,`ellipse`]}],"mask-image-radial-size":[{"mask-radial":[{closest:[`side`,`corner`],farthest:[`side`,`corner`]}]}],"mask-image-radial-pos":[{"mask-radial-at":b()}],"mask-image-conic-pos":[{"mask-conic":[zs]}],"mask-image-conic-from-pos":[{"mask-conic-from":le()}],"mask-image-conic-to-pos":[{"mask-conic-to":le()}],"mask-image-conic-from-color":[{"mask-conic-from":F()}],"mask-image-conic-to-color":[{"mask-conic-to":F()}],"mask-mode":[{mask:[`alpha`,`luminance`,`match`]}],"mask-origin":[{"mask-origin":[`border`,`padding`,`content`,`fill`,`stroke`,`view`]}],"mask-position":[{mask:te()}],"mask-repeat":[{mask:ne()}],"mask-size":[{mask:re()}],"mask-type":[{"mask-type":[`alpha`,`luminance`]}],"mask-image":[{mask:[`none`,R,L]}],filter:[{filter:[``,`none`,R,L]}],blur:[{blur:ue()}],brightness:[{brightness:[zs,R,L]}],contrast:[{contrast:[zs,R,L]}],"drop-shadow":[{"drop-shadow":[``,`none`,p,cc,nc]}],"drop-shadow-color":[{"drop-shadow":F()}],grayscale:[{grayscale:[``,zs,R,L]}],"hue-rotate":[{"hue-rotate":[zs,R,L]}],invert:[{invert:[``,zs,R,L]}],saturate:[{saturate:[zs,R,L]}],sepia:[{sepia:[``,zs,R,L]}],"backdrop-filter":[{"backdrop-filter":[``,`none`,R,L]}],"backdrop-blur":[{"backdrop-blur":ue()}],"backdrop-brightness":[{"backdrop-brightness":[zs,R,L]}],"backdrop-contrast":[{"backdrop-contrast":[zs,R,L]}],"backdrop-grayscale":[{"backdrop-grayscale":[``,zs,R,L]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[zs,R,L]}],"backdrop-invert":[{"backdrop-invert":[``,zs,R,L]}],"backdrop-opacity":[{"backdrop-opacity":[zs,R,L]}],"backdrop-saturate":[{"backdrop-saturate":[zs,R,L]}],"backdrop-sepia":[{"backdrop-sepia":[``,zs,R,L]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":w()}],"border-spacing-x":[{"border-spacing-x":w()}],"border-spacing-y":[{"border-spacing-y":w()}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[``,`all`,`colors`,`opacity`,`shadow`,`transform`,`none`,R,L]}],"transition-behavior":[{transition:[`normal`,`discrete`]}],duration:[{duration:[zs,`initial`,R,L]}],ease:[{ease:[`linear`,`initial`,_,R,L]}],delay:[{delay:[zs,R,L]}],animate:[{animate:[`none`,v,R,L]}],backface:[{backface:[`hidden`,`visible`]}],perspective:[{perspective:[h,R,L]}],"perspective-origin":[{"perspective-origin":x()}],rotate:[{rotate:de()}],"rotate-x":[{"rotate-x":de()}],"rotate-y":[{"rotate-y":de()}],"rotate-z":[{"rotate-z":de()}],scale:[{scale:fe()}],"scale-x":[{"scale-x":fe()}],"scale-y":[{"scale-y":fe()}],"scale-z":[{"scale-z":fe()}],"scale-3d":[`scale-3d`],skew:[{skew:pe()}],"skew-x":[{"skew-x":pe()}],"skew-y":[{"skew-y":pe()}],transform:[{transform:[R,L,``,`none`,`gpu`,`cpu`]}],"transform-origin":[{origin:x()}],"transform-style":[{transform:[`3d`,`flat`]}],translate:[{translate:me()}],"translate-x":[{"translate-x":me()}],"translate-y":[{"translate-y":me()}],"translate-z":[{"translate-z":me()}],"translate-none":[`translate-none`],accent:[{accent:F()}],appearance:[{appearance:[`none`,`auto`]}],"caret-color":[{caret:F()}],"color-scheme":[{scheme:[`normal`,`dark`,`light`,`light-dark`,`only-dark`,`only-light`]}],cursor:[{cursor:[`auto`,`default`,`pointer`,`wait`,`text`,`move`,`help`,`not-allowed`,`none`,`context-menu`,`progress`,`cell`,`crosshair`,`vertical-text`,`alias`,`copy`,`no-drop`,`grab`,`grabbing`,`all-scroll`,`col-resize`,`row-resize`,`n-resize`,`e-resize`,`s-resize`,`w-resize`,`ne-resize`,`nw-resize`,`se-resize`,`sw-resize`,`ew-resize`,`ns-resize`,`nesw-resize`,`nwse-resize`,`zoom-in`,`zoom-out`,R,L]}],"field-sizing":[{"field-sizing":[`fixed`,`content`]}],"pointer-events":[{"pointer-events":[`auto`,`none`]}],resize:[{resize:[`none`,``,`y`,`x`]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":w()}],"scroll-mx":[{"scroll-mx":w()}],"scroll-my":[{"scroll-my":w()}],"scroll-ms":[{"scroll-ms":w()}],"scroll-me":[{"scroll-me":w()}],"scroll-mbs":[{"scroll-mbs":w()}],"scroll-mbe":[{"scroll-mbe":w()}],"scroll-mt":[{"scroll-mt":w()}],"scroll-mr":[{"scroll-mr":w()}],"scroll-mb":[{"scroll-mb":w()}],"scroll-ml":[{"scroll-ml":w()}],"scroll-p":[{"scroll-p":w()}],"scroll-px":[{"scroll-px":w()}],"scroll-py":[{"scroll-py":w()}],"scroll-ps":[{"scroll-ps":w()}],"scroll-pe":[{"scroll-pe":w()}],"scroll-pbs":[{"scroll-pbs":w()}],"scroll-pbe":[{"scroll-pbe":w()}],"scroll-pt":[{"scroll-pt":w()}],"scroll-pr":[{"scroll-pr":w()}],"scroll-pb":[{"scroll-pb":w()}],"scroll-pl":[{"scroll-pl":w()}],"snap-align":[{snap:[`start`,`end`,`center`,`align-none`]}],"snap-stop":[{snap:[`normal`,`always`]}],"snap-type":[{snap:[`none`,`x`,`y`,`both`]}],"snap-strictness":[{snap:[`mandatory`,`proximity`]}],touch:[{touch:[`auto`,`none`,`manipulation`]}],"touch-x":[{"touch-pan":[`x`,`left`,`right`]}],"touch-y":[{"touch-pan":[`y`,`up`,`down`]}],"touch-pz":[`touch-pinch-zoom`],select:[{select:[`none`,`text`,`all`,`auto`]}],"will-change":[{"will-change":[`auto`,`scroll`,`contents`,`transform`,R,L]}],fill:[{fill:[`none`,...F()]}],"stroke-w":[{stroke:[zs,rc,Xs,Zs]}],stroke:[{stroke:[`none`,...F()]}],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`inset-bs`,`inset-be`,`start`,`end`,`top`,`right`,`bottom`,`left`],"inset-x":[`right`,`left`],"inset-y":[`top`,`bottom`],flex:[`basis`,`grow`,`shrink`],gap:[`gap-x`,`gap-y`],p:[`px`,`py`,`ps`,`pe`,`pbs`,`pbe`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`mbs`,`mbe`,`mt`,`mr`,`mb`,`ml`],mx:[`mr`,`ml`],my:[`mt`,`mb`],size:[`w`,`h`],"font-size":[`leading`],"fvn-normal":[`fvn-ordinal`,`fvn-slashed-zero`,`fvn-figure`,`fvn-spacing`,`fvn-fraction`],"fvn-ordinal":[`fvn-normal`],"fvn-slashed-zero":[`fvn-normal`],"fvn-figure":[`fvn-normal`],"fvn-spacing":[`fvn-normal`],"fvn-fraction":[`fvn-normal`],"line-clamp":[`display`,`overflow`],rounded:[`rounded-s`,`rounded-e`,`rounded-t`,`rounded-r`,`rounded-b`,`rounded-l`,`rounded-ss`,`rounded-se`,`rounded-ee`,`rounded-es`,`rounded-tl`,`rounded-tr`,`rounded-br`,`rounded-bl`],"rounded-s":[`rounded-ss`,`rounded-es`],"rounded-e":[`rounded-se`,`rounded-ee`],"rounded-t":[`rounded-tl`,`rounded-tr`],"rounded-r":[`rounded-tr`,`rounded-br`],"rounded-b":[`rounded-br`,`rounded-bl`],"rounded-l":[`rounded-tl`,`rounded-bl`],"border-spacing":[`border-spacing-x`,`border-spacing-y`],"border-w":[`border-w-x`,`border-w-y`,`border-w-s`,`border-w-e`,`border-w-bs`,`border-w-be`,`border-w-t`,`border-w-r`,`border-w-b`,`border-w-l`],"border-w-x":[`border-w-r`,`border-w-l`],"border-w-y":[`border-w-t`,`border-w-b`],"border-color":[`border-color-x`,`border-color-y`,`border-color-s`,`border-color-e`,`border-color-bs`,`border-color-be`,`border-color-t`,`border-color-r`,`border-color-b`,`border-color-l`],"border-color-x":[`border-color-r`,`border-color-l`],"border-color-y":[`border-color-t`,`border-color-b`],translate:[`translate-x`,`translate-y`,`translate-none`],"translate-none":[`translate`,`translate-x`,`translate-y`,`translate-z`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`scroll-mbs`,`scroll-mbe`,`scroll-mt`,`scroll-mr`,`scroll-mb`,`scroll-ml`],"scroll-mx":[`scroll-mr`,`scroll-ml`],"scroll-my":[`scroll-mt`,`scroll-mb`],"scroll-p":[`scroll-px`,`scroll-py`,`scroll-ps`,`scroll-pe`,`scroll-pbs`,`scroll-pbe`,`scroll-pt`,`scroll-pr`,`scroll-pb`,`scroll-pl`],"scroll-px":[`scroll-pr`,`scroll-pl`],"scroll-py":[`scroll-pt`,`scroll-pb`],touch:[`touch-x`,`touch-y`,`touch-pz`],"touch-x":[`touch`],"touch-y":[`touch`],"touch-pz":[`touch`]},conflictingClassGroupModifiers:{"font-size":[`leading`]},orderSensitiveModifiers:[`*`,`**`,`after`,`backdrop`,`before`,`details-content`,`file`,`first-letter`,`first-line`,`marker`,`placeholder`,`selection`]}}),z=(...e)=>bc(Xo(e));typeof navigator<`u`&&navigator.userAgent.includes(`Firefox`);var xc=(e,t)=>{let n=0;return r=>{let i=Date.now();if(i-n>=t)return n=i,e(r)}},Sc=e=>{if(!Bo)return null;try{let t=localStorage.getItem(e);return t?JSON.parse(t):null}catch{return null}},Cc=(e,t)=>{if(Bo)try{window.localStorage.setItem(e,JSON.stringify(t))}catch{}},wc=Dt(!1),Tc=()=>({corner:`bottom-right`,dimensions:{isFullWidth:!1,isFullHeight:!1,width:Go.width,height:Go.height,position:{x:Wo,y:Wo}},lastDimensions:{isFullWidth:!1,isFullHeight:!1,width:Go.width,height:Go.height,position:{x:Wo,y:Wo}},componentsTree:{width:Ko}});Tc(),Dt((()=>{let e=Tc(),t=Sc(qo);return t?{corner:t.corner??e.corner,dimensions:t.dimensions??e.dimensions,lastDimensions:t.lastDimensions??t.dimensions??e.lastDimensions,componentsTree:t.componentsTree??e.componentsTree}:(Cc(qo,{corner:e.corner,dimensions:e.dimensions,lastDimensions:e.lastDimensions,componentsTree:e.componentsTree}),e)})());var Ec=Dt({view:`none`});Sc(Jo);function Dc(){return!1}function Oc(e){function t(t){return this.shouldComponentUpdate=Dc,ue(e,t)}return t.displayName=`Memo(${e.displayName||e.name})`,t.prototype.isReactComponent=!0,t._forwarded=!0,t}var kc=Dt({updates:[],currentFiber:null,totalUpdates:0,windowOffset:0,currentIndex:0,isViewingHistory:!1,latestFiber:null,isVisible:!1,playbackSpeed:1});Dt(0),Dt({query:``,matches:[],currentMatchIndex:-1}),Dt({fiber:null,fiberProps:{current:[],changes:new Set},fiberState:{current:[],changes:new Set},fiberContext:{current:[],changes:new Set}}),sn(()=>{let e=tt(null),t=tt(null),n=tt(null),r=tt({isPropsChanged:!1,isStateChanged:!1,isContextChanged:!1});return $e(()=>{let i=xc(()=>{let r=[];e.current?.dataset.flash===`true`&&r.push(e.current),t.current?.dataset.flash===`true`&&r.push(t.current),n.current?.dataset.flash===`true`&&r.push(n.current);for(let e of r)e.classList.remove(`count-flash-white`),e.offsetWidth,e.classList.add(`count-flash-white`)},400);return kc.subscribe(a=>{if(!e.current||!t.current||!n.current)return;let{currentIndex:o,updates:s}=a,c=s[o];!c||o===0||(i(),r.current={isPropsChanged:(c.props?.changes?.size??0)>0,isStateChanged:(c.state?.changes?.size??0)>0,isContextChanged:(c.context?.changes?.size??0)>0},e.current.dataset.flash!==`true`&&(e.current.dataset.flash=r.current.isPropsChanged.toString()),t.current.dataset.flash!==`true`&&(t.current.dataset.flash=r.current.isStateChanged.toString()),n.current.dataset.flash!==`true`&&(n.current.dataset.flash=r.current.isContextChanged.toString()))})},[]),I(`button`,{type:`button`,className:z(`react-section-header`,`overflow-hidden`,`max-h-0`,`transition-[max-height]`),children:I(`div`,{className:z(`flex-1 react-scan-expandable`),children:I(`div`,{className:`overflow-hidden`,children:I(`div`,{className:`flex items-center whitespace-nowrap`,children:[I(`div`,{className:`flex items-center gap-x-2`,children:`What changed?`}),I(`div`,{className:z(`ml-auto`,`change-scope`,`transition-opacity duration-300 delay-150`),children:[I(`div`,{ref:e,children:`props`}),I(`div`,{ref:t,children:`state`}),I(`div`,{ref:n,children:`context`})]})]})})})})}),Mt(()=>z(`react-scan-inspector`,`flex-1`,`opacity-0`,`overflow-y-auto overflow-x-hidden`,`transition-opacity delay-0`,`pointer-events-none`,!wc.value&&`opacity-100 delay-300 pointer-events-auto`));var Ac=0,jc=performance.now(),Mc=0,Nc=!1,Pc=()=>{Mc++;let e=performance.now();e-jc>=1e3&&(Ac=Mc,Mc=0,jc=e),requestAnimationFrame(Pc)},Fc=()=>(Nc||(Nc=!0,Pc(),Ac=60),Ac);function Ic(e,t){let n=[];for(let t of e){let e=t.target;this.seenElements.has(e)||(this.seenElements.add(e),n.push(t))}n.length>0&&this.resolveNext&&(this.resolveNext(n),this.resolveNext=null),this.seenElements.size===this.uniqueElements.size&&(t.disconnect(),this.done=!0,this.resolveNext&&this.resolveNext([]))}var Lc=async function*(e){let t={uniqueElements:new Set(e),seenElements:new Set,resolveNext:null,done:!1},n=new IntersectionObserver(Ic.bind(t));for(let e of t.uniqueElements)n.observe(e);for(;!t.done;){let e=await new Promise(e=>{t.resolveNext=e});e.length>0&&(yield e)}};Mt(()=>z(`absolute inset-0 flex items-center gap-x-2`,`translate-y-0`,`transition-transform duration-300`,wc.value&&`-translate-y-[200%]`));var Rc=({className:e,...t})=>I(`div`,{className:z(`react-scan-toggle`,e),children:[I(`input`,{type:`checkbox`,...t}),I(`div`,{})]}),zc=({fps:e})=>I(`div`,{className:z(`flex items-center gap-x-1 px-2 w-full`,`h-6`,`rounded-md`,`font-mono leading-none`,`bg-[#141414]`,`ring-1 ring-white/[0.08]`),children:[I(`div`,{style:{color:(e=>e<30?`#EF4444`:e<50?`#F59E0B`:`rgb(214,132,245)`)(e)},className:`text-sm font-semibold tracking-wide transition-colors ease-in-out w-full flex justify-center items-center`,children:e}),I(`span`,{className:`text-white/30 text-[11px] font-medium tracking-wide ml-auto min-w-fit`,children:`FPS`})]}),Bc=()=>{let[e,t]=Ze(null);return $e(()=>{let e=setInterval(()=>{t(Fc())},200);return()=>clearInterval(e)},[]),I(`div`,{className:z(`flex items-center justify-end gap-x-2 px-1 ml-1 w-[72px]`,`whitespace-nowrap text-sm text-white`),children:e===null?I(fe,{children:`️`}):I(zc,{fps:e})})},Vc=e=>e(),Hc=class e extends Array{constructor(e=25){super(),zo(this,`capacity`,e)}push(...e){let t=super.push(...e);for(;this.length>this.capacity;)this.shift();return t}static fromArray(t,n){let r=new e(n);return r.push(...t),r}};new class{constructor(e){zo(this,`subscribers`,new Set),zo(this,`currentValue`),this.currentValue=e}subscribe(e){return this.subscribers.add(e),e(this.currentValue),()=>{this.subscribers.delete(e)}}setState(e){this.currentValue=e,this.subscribers.forEach(t=>t(e))}getCurrentState(){return this.currentValue}}(new Hc(150));var Uc=50;new class{constructor(){zo(this,`channels`,{})}publish(e,t,n=!0){let r=this.channels[t];if(!r){if(!n)return;this.channels[t]={callbacks:new Hc(Uc),state:new Hc(Uc)},this.channels[t].state.push(e);return}r.state.push(e),r.callbacks.forEach(t=>t(e))}getAvailableChannels(){return Hc.fromArray(Object.keys(this.channels),Uc)}subscribe(e,t,n=!1){let r=()=>(n||this.channels[e].state.forEach(e=>{t(e)}),()=>{let n=this.channels[e].callbacks.filter(e=>e!==t);this.channels[e].callbacks=Hc.fromArray(n,Uc)}),i=this.channels[e];return i?(i.callbacks.push(t),r()):(this.channels[e]={callbacks:new Hc(Uc),state:new Hc(Uc)},this.channels[e].callbacks.push(t),r())}updateChannelState(e,t,n=!0){let r=this.channels[e];if(!r){if(!n)return;let r=new Hc(Uc),i={callbacks:new Hc(Uc),state:r};this.channels[e]=i,i.state=t(r);return}r.state=t(r.state)}getChannelState(e){return this.channels[e].state??new Hc(Uc)}},new Hc(25);var Wc=e=>{let t,n=new Set,r=(e,r)=>{let i=typeof e==`function`?e(t):e;if(!Object.is(i,t)){let e=t;t=r??(typeof i!=`object`||!i)?i:Object.assign({},t,i),n.forEach(n=>n(t,e))}},i=()=>t,a={setState:r,getState:i,getInitialState:()=>o,subscribe:(e,r)=>{let i,a;r?(i=e,a=r):a=e;let o=i?i(t):void 0,s=(e,t)=>{if(i){let n=i(e),r=i(t);Object.is(o,n)||(o=n,a(n,r))}else a(e,t)};return n.add(s),()=>n.delete(s)}},o=t=e(r,i,a);return a},Gc=(e=>e?Wc(e):Wc);Gc()(e=>({state:{events:[]},actions:{addEvent:t=>{e(e=>({state:{events:[...e.state.events,t]}}))},clear:()=>{e({state:{events:[]}})}}}));var Kc=200,qc=Gc()((e,t)=>{let n=new Set;return{state:{events:new Hc(Kc)},actions:{addEvent:r=>{n.forEach(e=>e(r));let i=[...t().state.events,r],a=(e,t)=>{let n=i.find(t=>{if(t.kind!==`long-render`&&t.id!==e.id&&(e.data.startAt<=t.data.startAt&&e.data.endAt<=t.data.endAt&&e.data.endAt>=t.data.startAt||t.data.startAt<=e.data.startAt&&t.data.endAt>=e.data.startAt||e.data.startAt<=t.data.startAt&&e.data.endAt>=t.data.endAt))return!0});n&&t(n)},o=new Set;i.forEach(e=>{e.kind!==`interaction`&&a(e,()=>{o.add(e.id)})});let s=i.filter(e=>!o.has(e.id));e(()=>({state:{events:Hc.fromArray(s,Kc)}}))},addListener:e=>(n.add(e),()=>{n.delete(e)}),clear:()=>{e({state:{events:new Hc(Kc)}})}}}}),Jc=()=>rn(qc.subscribe,qc.getState),Yc=150,Xc=e=>{let t=e.filter(e=>e.length>2);return t.length===0?e.at(-1)??`Unknown`:t.at(-1)},Zc=e=>{switch(e.kind){case`interaction`:{let{renderTime:t,otherJSTime:n,framePreparation:r,frameConstruction:i,frameDraw:a}=e;return t+n+r+i+(a??0)}case`dropped-frames`:return e.otherTime+e.renderTime}},Qc=e=>e.wasFiberRenderMount||e.hasMemoCache?!1:e.changes.context.length===0&&e.changes.props.length===0&&e.changes.state.length===0,$c=e=>{let t=Zc(e.timing);switch(e.kind){case`interaction`:return t<200?`low`:t<500?`needs-improvement`:`high`;case`dropped-frames`:return t<50?`low`:t<Yc?`needs-improvement`:`high`}},el=()=>it(tl),tl=Ie(null),nl=({size:e=24,className:t})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:z([`lucide lucide-chevron-right`,t]),children:I(`path`,{d:`m9 18 6-6-6-6`})}),rl=({className:e=``,size:t=24,events:n=[]})=>{let r=n.includes(!0),i=n.filter(e=>e).length,a=i>99?`>99`:i,o=r?Math.max(t*.6,14):Math.max(t*.4,6);return I(`div`,{className:`relative`,children:[I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:`lucide lucide-bell ${e}`,children:[I(`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`}),I(`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`})]}),n.length>0&&i>0&&su.options.value.showNotificationCount&&I(`div`,{className:z([`absolute`,r?`-top-2.5 -right-2.5`:`-top-1 -right-1`,`rounded-full`,`flex items-center justify-center`,`text-[8px] font-medium text-white`,`aspect-square`,r?`bg-red-500/90`:`bg-purple-500/90`]),style:{width:`${o}px`,height:`${o}px`,padding:r?`0.5px`:`0`},children:r&&a})]})},il=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:e,children:[I(`path`,{d:`M18 6 6 18`}),I(`path`,{d:`m6 6 12 12`})]}),al=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:e,children:[I(`path`,{d:`M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z`}),I(`path`,{d:`M16 9a5 5 0 0 1 0 6`}),I(`path`,{d:`M19.364 18.364a9 9 0 0 0 0-12.728`})]}),ol=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:e,children:[I(`path`,{d:`M16 9a5 5 0 0 1 .95 2.293`}),I(`path`,{d:`M19.364 5.636a9 9 0 0 1 1.889 9.96`}),I(`path`,{d:`m2 2 20 20`}),I(`path`,{d:`m7 7-.587.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298V11`}),I(`path`,{d:`M9.828 4.172A.686.686 0 0 1 11 4.657v.686`})]}),sl=({size:e=24,className:t})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:z([`lucide lucide-arrow-left`,t]),children:[I(`path`,{d:`m12 19-7-7 7-7`}),I(`path`,{d:`M19 12H5`})]}),cl=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:e,children:[I(`path`,{d:`M14 4.1 12 6`}),I(`path`,{d:`m5.1 8-2.9-.8`}),I(`path`,{d:`m6 12-1.9 2`}),I(`path`,{d:`M7.2 2.2 8 5.1`}),I(`path`,{d:`M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z`})]}),ll=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:e,children:[I(`path`,{d:`M10 8h.01`}),I(`path`,{d:`M12 12h.01`}),I(`path`,{d:`M14 8h.01`}),I(`path`,{d:`M16 12h.01`}),I(`path`,{d:`M18 8h.01`}),I(`path`,{d:`M6 8h.01`}),I(`path`,{d:`M7 16h10`}),I(`path`,{d:`M8 12h.01`}),I(`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`})]}),ul=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,className:e,style:{transform:`rotate(180deg)`},children:[I(`circle`,{cx:`12`,cy:`12`,r:`10`}),I(`path`,{d:`m4.9 4.9 14.2 14.2`})]}),dl=({className:e=``,size:t=24})=>I(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,className:e,children:[I(`polyline`,{points:`22 17 13.5 8.5 8.5 13.5 2 7`}),I(`polyline`,{points:`16 17 22 17 22 11`})]}),fl=({children:e,triggerContent:t,wrapperProps:n})=>{let[r,i]=Ze(`closed`),[a,o]=Ze(null),[s,c]=Ze({width:window.innerWidth,height:window.innerHeight}),l=tt(null),u=tt(null),d=it(iu),f=tt(!1);$e(()=>{let e=()=>{c({width:window.innerWidth,height:window.innerHeight}),p()};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let p=()=>{if(l.current&&d){let e=l.current.getBoundingClientRect(),t=d.getBoundingClientRect(),n=e.left+e.width/2,r=e.top,i=new DOMRect(n-t.left,r-t.top,e.width,e.height);o(i)}};$e(()=>{p()},[l.current]),$e(()=>{if(r===`opening`){let e=setTimeout(()=>i(`open`),120);return()=>clearTimeout(e)}else if(r===`closing`){let e=setTimeout(()=>i(`closed`),120);return()=>clearTimeout(e)}},[r]),$e(()=>{let e=setInterval(()=>{!f.current&&r!==`closed`&&i(`closing`)},1e3);return()=>clearInterval(e)},[r]);let m=()=>{f.current=!0,p(),i(`opening`)},h=()=>{f.current=!1,p(),i(`closing`)},g=(()=>{if(!a||!d)return{top:0,left:0};let e=d.getBoundingClientRect(),t=u.current?.offsetHeight||40,n=a.x+e.left,r=a.y+e.top,i=n,o=r-4;return i-175/2<5?i=92.5:i+175/2>s.width-5&&(i=s.width-5-175/2),o-t<5&&(o=r+a.height+4),{top:o-e.top,left:i-e.left}})();return I(fe,{children:[d&&a&&r!==`closed`&&xn(I(`div`,{ref:u,className:z([`absolute z-100 bg-white text-black rounded-lg px-3 py-2 shadow-lg`,`transition-[opacity] duration-120 ease-out`,`after:content-[""] after:absolute after:top-[100%]`,`after:left-1/2 after:-translate-x-1/2`,`after:w-[10px] after:h-[6px]`,`after:border-l-[5px] after:border-l-transparent`,`after:border-r-[5px] after:border-r-transparent`,`after:border-t-[6px] after:border-t-white`,`pointer-events-none`,r===`opening`||r===`closing`?`opacity-0`:`opacity-100`]),style:{top:g.top+`px`,left:g.left+`px`,transform:`translate(-50%, calc(-100% - 4px)) scale(${r===`open`?1:.97})`,minWidth:`175px`,willChange:`opacity, transform`},children:e}),d),I(`div`,{ref:l,onMouseEnter:m,onMouseLeave:h,...n,children:t})]})},pl=({selectedEvent:e})=>{let{notificationState:t,setNotificationState:n,setRoute:r}=el();return I(`div`,{className:z([`flex w-full justify-between items-center px-3 py-2 text-xs`]),children:[I(`div`,{className:z([`bg-[#18181B] flex items-center gap-x-1 p-1 rounded-sm`]),children:[I(`button`,{onClick:()=>{r({route:`render-visualization`,routeMessage:null})},className:z([`w-1/2 flex items-center justify-center whitespace-nowrap py-[5px] px-1 gap-x-1`,t.route===`render-visualization`||t.route===`render-explanation`?`text-white bg-[#7521c8] rounded-sm`:`text-[#6E6E77] bg-[#18181B] rounded-sm`]),children:`Ranked`}),I(`button`,{onClick:()=>{r({route:`other-visualization`,routeMessage:null})},className:z([`w-1/2 flex items-center justify-center whitespace-nowrap py-[5px] px-1 gap-x-1`,t.route===`other-visualization`?`text-white bg-[#7521c8] rounded-sm`:`text-[#6E6E77] bg-[#18181B] rounded-sm`]),children:`Overview`}),I(`button`,{onClick:()=>{r({route:`optimize`,routeMessage:null})},className:z([`w-1/2 flex items-center justify-center whitespace-nowrap py-[5px] px-1 gap-x-1`,t.route===`optimize`?`text-white bg-[#7521c8] rounded-sm`:`text-[#6E6E77] bg-[#18181B] rounded-sm`]),children:I(`span`,{children:`Prompts`})})]}),I(fl,{triggerContent:I(`button`,{onClick:()=>{n(e=>{e.audioNotificationsOptions.enabled&&e.audioNotificationsOptions.audioContext.state!==`closed`&&e.audioNotificationsOptions.audioContext.close();let t=e.audioNotificationsOptions.enabled;localStorage.setItem(`react-scan-notifications-audio`,String(!t));let n=new AudioContext;return e.audioNotificationsOptions.enabled||Ho(n),t&&n.close(),{...e,audioNotificationsOptions:t?{audioContext:null,enabled:!1}:{audioContext:n,enabled:!0}}})},className:`ml-auto`,children:I(`div`,{className:z([`flex gap-x-2 justify-center items-center text-[#6E6E77]`]),children:[I(`span`,{children:`Alerts`}),t.audioNotificationsOptions.enabled?I(al,{size:16,className:`text-[#6E6E77]`}):I(ol,{size:16,className:`text-[#6E6E77]`})]})}),children:I(fe,{children:`Play a chime when a slowdown is recorded`})})]})},ml=e=>{let t=``;return e.toSorted((e,t)=>t.totalTime-e.totalTime).slice(0,30).filter(e=>e.totalTime>5).forEach(e=>{let n=``;n+=`Component Name:`,n+=e.name,n+=`
3
3
  `,n+=`Rendered: ${e.count} times
4
4
  `,n+=`Sum of self times for ${e.name} is ${e.totalTime.toFixed(0)}ms
@@ -316,7 +316,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
316
316
  `).map(e=>e.trim()).filter(Boolean),r=Bb.exec(n[0]??``);if(r)return{ref:r[3],omitted:0,items:[t(r[2],r[4],r[1]===`🤖`,r[5],r[6])]};let i=Vb.exec(n[0]??``);if(!i)return null;let a=[],o=0;for(let e of n.slice(1)){let n=Ub.exec(e);if(n){o=Number(n[1]);continue}let r=Hb.exec(e);r&&a.push(t(r[2],r[3],r[1]===`🤖`,r[4],r[5]))}return!a.length||a.length+o!==Number(i[2])?null:{ref:i[3],omitted:o,items:a}}var Gb=new RegExp(String.raw`^⏰ (${zb}) was (MERGED|CLOSED)\.$`),Kb=new RegExp(String.raw`^✅ CI PASSED on (${zb}) — (\d+) checks? green\.$`),qb=new RegExp(String.raw`^❌ CI FAILED on (${zb})(?:: (.+?))?\.$`);function Jb(e){for(let t of e.split(`
317
317
  `)){let e=t.trim();if(!e)continue;let n=Gb.exec(e);if(n)return{ref:n[1],kind:n[2]===`MERGED`?`merged`:`closed`};let r=Kb.exec(e);if(r)return{ref:r[1],kind:`ci`,verdict:`passing`,passed:Number(r[2]),failing:[]};let i=qb.exec(e);if(i)return{ref:i[1],kind:`ci`,verdict:`failing`,failing:i[2]?i[2].split(`, `):[]}}return null}J({installed:K(),inRepo:K(),nameWithOwner:G().nullable(),authed:K()});var Yb=J({ref:G(),kind:Y([`issue`,`pr`,`commit`]),repo:G(),url:G(),title:G(),body:G(),state:G(),stateReason:G().optional(),at:G().optional(),authorLogin:G().optional(),authorName:G().optional(),authorAvatar:G().optional(),labels:q(J({name:G(),color:G()})).default([]),additions:fv().int().nonnegative().optional(),deletions:fv().int().nonnegative().optional(),changedFiles:fv().int().nonnegative().optional(),comments:fv().int().nonnegative().optional(),fetchedAt:fv().int().nonnegative()});J({refs:q(G().min(3).max(120)).min(1).max(100),refresh:K().default(!1)}),J({cards:q(Yb),missing:q(G()),error:G().optional()});var Xb=J({kind:Y([`issue`,`pr`]),number:fv().int().positive(),title:G(),url:G(),reactions:fv().int().nonnegative(),updatedAt:G(),comments:fv().int().nonnegative().optional(),createdAt:G().optional(),author:G().optional(),labels:q(J({name:G(),color:G()})).default([]),state:G().optional(),isDraft:K().optional(),linkedPrs:J({count:fv().int().positive(),number:fv().int().positive(),url:G(),state:G(),isDraft:K().optional()}).optional()});J({kind:Y([`issues`,`prs`]),sort:Y([`recent`,`reactions`]),page:fv().int().min(1).default(1),perPage:fv().int().min(1).max(100).default(30)}),J({items:q(Xb),total:fv().int().nonnegative(),page:fv().int().positive(),pageCount:fv().int().positive()}),jb.extend({items:q(J({kind:Y([`issue`,`pr`]),number:fv().int().positive()})).min(1)}).strict(),J({dispatched:q(J({number:fv(),kind:G(),slug:_v})),failed:q(J({number:fv(),kind:G(),error:G()}))});var Zb=J({projectDir:G(),projectName:G(),projectLabel:G(),errors:q(G()),warnings:q(G()),errorItems:q(Sb).optional()});mv(`type`,[J({type:gv(`board`),board:Cb,seq:fv().optional(),bootId:G().optional()}),J({type:gv(`board-delta`),seq:fv(),bootId:G(),upserts:q(bb),removed:q(_v),meta:Zb.optional()}),J({type:gv(`notify`),slug:_v,kind:Y([`needs-decision`,`turn-done`,`exited`]),title:G(),body:G().optional()}),J({type:gv(`interactions-invalidated`),slug:Dv,sessionId:Ev,interactionId:Ev,lifecycle:$v,recordRevision:Ov}).strict()]);var Qb=J({file:G(),old:G(),new:G()}),$b=J({text:G(),status:Y([`pending`,`in_progress`,`completed`])}),ex=J({name:G(),detail:G().optional(),edit:Qb.optional(),desc:G().optional(),command:G().optional(),input:G().optional(),read:G().optional(),output:G().optional(),outputImage:G().optional(),status:Y([`pending`,`completed`,`failed`,`cancelled`]).optional(),backgroundState:Y([`background`,`unknown`]).optional(),shellId:G().optional(),exitCode:fv().int().optional(),cwd:G().optional(),sessionId:pv([G(),fv()]).optional(),durationMs:fv().nonnegative().optional(),prompt:G().optional(),subagentType:G().optional(),agentId:G().optional(),agentStatus:Y([`completed`,`failed`,`killed`]).optional(),agentElapsedMs:fv().optional(),agentCompletion:K().optional(),sendTo:G().optional(),sendSummary:G().optional(),sendBody:G().optional(),sendType:G().optional(),sendDispatchId:G().optional(),sendTargetLabel:G().optional(),sentImages:q(G()).optional(),sentFiles:q(G()).optional(),caption:G().optional(),todos:q($b).optional()}),tx=mv(`kind`,[J({kind:gv(`text`),text:G()}),J({kind:gv(`tools`),tools:q(ex)})]),nx=J({sourceId:G().min(1).max(768).optional(),pinnedFromSourceId:G().min(1).max(768).optional(),role:Y([`user`,`assistant`]),text:G(),displayText:G().optional(),tools:q(ex),at:G().optional(),kind:Y([`event`,`reasoning`]).optional(),durationMs:fv().nonnegative().optional(),boundary:Y([`wake`,`compaction`,`rest`]).optional(),parts:q(tx).default([]),queued:K().optional(),deliveryId:G().optional(),deliveryState:Y([`pending`,`enqueued`,`delivered`,`unconfirmed`]).optional(),wake:K().optional(),wakeSteer:Fb.optional(),peerFrom:G().optional(),peerDispatchId:G().optional(),peerUnnamed:gv(!0).optional(),peerSenderTaskId:G().optional(),fenceRefused:gv(!0).optional()}),rx=G().min(1).max(2048).regex(/^[A-Za-z0-9_-]+$/);J({messages:q(nx),beforeCursor:rx.nullable(),hasEarlier:K(),reachedTurnBoundary:K(),transcriptKey:G().min(1).max(256)}).strict(),J({slug:_v,cursor:rx}).strict();var ix=_v;mv(`t`,[J({t:gv(`sub`),topic:gv(`transcript`),slug:ix}).strict(),J({t:gv(`unsub`),topic:gv(`transcript`),slug:ix}).strict()]);var ax=J({id:G(),slug:G(),name:G(),path:G(),lastOpenedAt:G(),stale:K(),iconVersion:G().optional(),iconStatus:Y([`icon`,`none`,`unknown`]),iconIsCustom:K().optional()}),ox=[`png`,`svg`,`ico`,`webp`,`jpg`,`jpeg`,`gif`];mv(`kind`,[J({kind:gv(`picked`),project:ax}),J({kind:gv(`cancelled`)}),J({kind:gv(`unavailable`),reason:G()})]),J({projectSlug:G(),projectName:G()});var sx=`/_frizz`,cx=null;function lx(e){cx=e}function ux(){return cx?(cx(),!0):!1}var dx=new Map,fx=new Map;function px(e,t){t?dx.set(e,t):dx.delete(e)}function mx(e){let t=dx.get(e);return t?(t(),!0):!1}function hx(e,t){t?fx.set(e,t):fx.delete(e)}function gx(e){fx.get(e)?.()}function _x(){if(typeof document>`u`||!document.body)return typeof window>`u`?0:window.scrollY;let e=vx()?Number.parseFloat(document.body.style.top):NaN;return Number.isNaN(e)?window.scrollY:-e}function vx(){return typeof document<`u`&&document.body?.style.position===`fixed`}var yx=null;function bx(e){yx=e}function xx(){let e=yx;return yx=null,e}function Sx(e,t){if(!e)return{kind:`loading`};let n=e.threads.find(e=>e.id===t);return n?{kind:`found`,ownership:n.kind===`session`?n.foreign===!0?`foreign`:`owned`:`legacy`,thread:n}:{kind:`missing`}}var Cx=new Set([`thread`,`status`]);function wx(e){if(typeof e==`string`)return e;let t=typeof location>`u`?void 0:location.pathname;return typeof t==`string`?t:`/`}var Tx=`project`,Ex=`/${Tx}`;function Dx(e){let[,t,n]=wx(e).split(`/`);return t===Tx&&n?n:void 0}function Ox(e){return`${Ex}/${e}`}function kx(e){let t=Dx(e);return t?Ox(t):``}function Ax(e){let t=wx(e),n=kx(t);return n?t.slice(n.length)||`/`:t||`/`}function jx(e,t){let n=kx(wx(t));return n?`${n}${e===`/`?``:e}`||`/`:e}function Mx(e,t){if(!e||!e.startsWith(`/`)||e.startsWith(`//`))return null;let n=e.replace(/[?#].*$/u,``);if(Dx(n))return null;let r=n.split(`/`)[1]??``;if(!Cx.has(r))return null;let i=jx(e,t);return i===e?null:i}function Nx(e){let t=Dx(e);return t?`${sx}/${t}`:sx}function Px(e,t){return jx(`/thread/${encodeURIComponent(e)}/full`,t)}function Fx(e){let t=e.match(/^\/thread\/([^/]+)\/full$/);if(!t)return null;try{return decodeURIComponent(t[1])}catch{return null}}function Ix(e,t){let n=Dx(t);return n===void 0||e==null?!0:e===n}var Lx=`https://github.com`,Rx=null,zx=new Set;function Bx(e){let t=e??null;if(t!==Rx){Rx=t;for(let e of zx)e()}}function Vx(){return Rx}function Hx(e){return zx.add(e),()=>zx.delete(e)}var Ux=`[A-Za-z0-9][A-Za-z0-9._-]*`,Wx=RegExp(`^https://github\\.com/(${Ux})/(${Ux})/(?:(issues|pull)/([1-9]\\d{0,9})|commit/([0-9a-f]{7,40}))(?:[/?#].*)?$`,`i`);function Gx(e){if(!e)return null;let t=Wx.exec(e.trim());if(!t)return null;let[,n,r,,i,a]=t;return i?`${n}/${r}#${i}`:`${n}/${r}@${a.toLowerCase()}`}var Kx=RegExp(`(^|[^\\w#/&@-])(?:(${Ux}/${Ux})@([0-9a-f]{7,40})|(${Ux}/${Ux})?#([1-9]\\d{0,9})|([0-9a-f]{7,40}))(?![\\w-])`,`g`);function qx(e){return/\d/.test(e)&&/[a-f]/.test(e)}function Jx(e){return{type:`text`,raw:e,text:e}}function Yx(e,t,n){return{type:`link`,raw:e,href:t,title:n,text:e,tokens:[Jx(e)]}}function Xx(e){if(!Rx)return[];let t=[];Kx.lastIndex=0;for(let n=Kx.exec(e);n;n=Kx.exec(e)){let[e,r,i,a,o,s,c]=n,l=a??c;if(l&&!qx(l))continue;let u=s?`${Lx}/${o??Rx}/issues/${s}`:`${Lx}/${i??Rx}/commit/${l}`,d=s?`${o??Rx}#${s}`:`${i??Rx}@${l}`;t.push({start:n.index+r.length,text:e.slice(r.length),href:u,title:d})}return t}function Zx(e){let t=Xx(e);if(t.length===0)return null;let n=[],r=0;for(let{start:i,text:a,href:o,title:s}of t)i>r&&n.push(Jx(e.slice(r,i))),n.push(Yx(a,o,s)),r=i+a.length;return r<e.length&&n.push(Jx(e.slice(r))),n}var Qx=new Set([`code`,`codespan`,`html`,`link`,`image`]);function $x(e){let t=[],n=e;Array.isArray(n.tokens)&&t.push(n.tokens),Array.isArray(n.items)&&t.push(n.items);for(let e of n.header??[])Array.isArray(e.tokens)&&t.push(e.tokens);for(let e of n.rows??[])for(let n of e)Array.isArray(n.tokens)&&t.push(n.tokens);return t}function eS(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(Qx.has(n.type))continue;let r=$x(n);for(let e of r)eS(e);if(n.type!==`text`||r.length>0)continue;let i=Zx(n.text);i&&e.splice(t,1,...i)}}var tS=`frizz-boot-id`;function nS(e){try{return sessionStorage.getItem(e)}catch{return null}}function rS(e,t){try{sessionStorage.setItem(e,t)}catch{}}function iS(e){switch(fy(nS(tS),e)){case`noop`:return;case`record`:rS(tS,e);return;case`adopt`:rS(tS,e);return}}var aS={board:`query`,threadBody:`query`,threadTranscript:`query`,threadTranscriptEarlier:`query`,subAgentTranscript:`query`,subAgentSteer:`mutation`,subAgentStop:`mutation`,backgroundShellOutput:`query`,backgroundShellActivity:`query`,stopBackgroundOp:`mutation`,pendingInteractions:`query`,interactionGet:`query`,interactionResolve:`mutation`,interactionCancel:`mutation`,dispatch:`mutation`,adoptThread:`mutation`,followUp:`mutation`,unqueueFollowUp:`mutation`,deliverQueuedNow:`mutation`,setThreadPermission:`mutation`,threadProfileOptions:`query`,threadSkills:`query`,setThreadProfile:`mutation`,markRead:`mutation`,threadSeen:`mutation`,setThreadState:`mutation`,completeThread:`mutation`,setThreadSnooze:`mutation`,setThreadRecurringPrompt:`mutation`,setOwnThreadRecurringPrompt:`mutation`,addOwnPrWatch:`mutation`,dropOwnPrWatch:`mutation`,listOwnPrWatches:`mutation`,getOwnThreadRecurringPrompt:`mutation`,setOwnThreadStopHook:`mutation`,setOwnThreadHeartbeat:`mutation`,setThreadHeartbeat:`mutation`,setOwnThreadTimer:`mutation`,cancelOwnThreadTimer:`mutation`,listOwnThreadTimers:`mutation`,listOwnThreadActivity:`mutation`,reloadThreadPlugins:`mutation`,snoozeAwaitingBackground:`mutation`,forgetThread:`mutation`,threadTerminalCommand:`query`,openExternal:`mutation`,openLocalFile:`mutation`,localMarkdown:`query`,resolveLocalPaths:`query`,markComplete:`mutation`,setThreadStatus:`mutation`,dismissThread:`mutation`,repairThread:`mutation`,archiveThread:`mutation`,killAgent:`mutation`,renameThread:`mutation`,aiRenameThread:`mutation`,codexModels:`query`,quota:`query`,authStatus:`query`,accountLogout:`mutation`,accountLoginStart:`mutation`,accountLoginStatus:`query`,accountLoginCancel:`mutation`,threadLocate:`query`,projectsList:`query`,projectPick:`mutation`,projectAdd:`mutation`,projectsReorder:`mutation`,projectsQueueCounts:`query`,projectIconPick:`mutation`,projectIconSet:`mutation`,projectIconClear:`mutation`,settingsGet:`query`,settingsSet:`mutation`,settingsReset:`mutation`,dispatchPreferencesGet:`query`,dispatchPreferenceSet:`mutation`,githubPromptDefaults:`query`,githubStatus:`query`,githubList:`query`,githubDispatchBatch:`mutation`,githubRefPreview:`query`},oS=`Frizz is updating and restarting. Your draft is preserved; wait until it is ready before sending or changing settings.`;function sS(e){return e?.retryableRpc===!0}function cS(e){return Object.defineProperty(e,"retryableRpc",{value:!0,enumerable:!1}),e}function lS(e){if(e===`mutation`&&Z.controlPlaneState===`restarting`)throw cS(Error(oS))}async function uS(e,t){let n=await e.text(),r;try{r=JSON.parse(n)}catch{throw e.status===404||e.status===405?Error(`Frizz server restart required — this control is newer than the running server`):e.status===403?Error(`RPC ${t} was refused (403) — the page's origin does not match the server it is talking to. Reload from the URL frizz is actually serving.`):Error(`RPC ${t} returned a non-JSON response (HTTP ${e.status})`)}if(!e.ok){let e=Error(typeof r.error==`string`?r.error:`RPC ${t} failed`);throw r.retryable===!0?cS(e):e}return r.result}async function dS(e,t,n,r){if(lS(t),t===`query`){let t=new URL(`${Nx()}/rpc/${e}`,location.origin);n!==void 0&&t.searchParams.set(`input`,JSON.stringify(n));let i=await fetch(t.toString(),{signal:r?.signal});return iS(i.headers.get(`x-frizz-boot`)),uS(i,e)}let i=await fetch(`${Nx()}/rpc/${e}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(n??{}),signal:r?.signal});return iS(i.headers.get(`x-frizz-boot`)),uS(i,e)}var X=new Proxy({},{get(e,t){let n=aS[t];if(n)return(e,r)=>dS(t,n,e,r)}}),fS=6e4,pS=80,mS=100,hS={loading:!0},gS=new Map,_S=new Set,vS=new Set,yS;function bS(){for(let e of _S)e()}function cee(e){return _S.add(e),()=>_S.delete(e)}function xS(e){return gS.get(e)}function lee(e,t=Date.now()){return!e?.card||e.card.kind===`commit`?!1:t-e.card.fetchedAt>fS}var uee=/data-gh-ref="([^"]+)"/g;function dee(e){if(!e.includes(`data-gh-ref`))return[];let t=new Set;for(let n of e.matchAll(uee))t.add(n[1]);return[...t]}function SS(e){let t=!1;for(let n of e)gS.has(n)||vS.has(n)||(vS.add(n),t=!0);!t||yS!==void 0||(yS=setTimeout(()=>{yS=void 0,wS()},pS))}function CS(e,t){for(let e of t.cards)gS.set(e.ref,{card:e});for(let e of t.missing)gS.set(e,{missing:!0});for(let t of e)gS.get(t)===hS&&gS.delete(t);bS()}async function wS(){let e=[...vS].slice(0,mS);if(e.length!==0){for(let t of e)vS.delete(t),gS.set(t,hS);bS();try{CS(e,await X.githubRefPreview({refs:e}))}catch{CS(e,{cards:[],missing:[]})}vS.size>0&&yS===void 0&&(yS=setTimeout(()=>{yS=void 0,wS()},0))}}var TS=new Set;function fee(e){TS.has(e)||(TS.add(e),X.githubRefPreview({refs:[e],refresh:!0}).then(e=>{for(let t of e.cards)gS.set(t.ref,{card:t});bS()}).catch(()=>{}).finally(()=>TS.delete(e)))}function pee(){gS.clear(),vS.clear(),TS.clear(),yS!==void 0&&(clearTimeout(yS),yS=void 0),bS()}var ES={dir:``,home:``},DS=ES,OS=new Set;function kS(e,t){let n={dir:e??``,home:t??``};if(!(n.dir===DS.dir&&n.home===DS.home)){DS=n.dir||n.home?n:ES;for(let e of OS)e()}}function AS(){return DS}function jS(e){return OS.add(e),()=>OS.delete(e)}function MS(e){if(typeof document>`u`)return null;let t=document.querySelector(`[data-queue-card="${CSS.escape(e)}"]`);return t?t.querySelector(`[data-queue-card-root="${CSS.escape(e)}"]`)??t:null}function NS(e){let t=MS(e);if(!t)return null;let n=typeof window.matchMedia==`function`&&window.matchMedia(`(max-width: 800px)`).matches?40:0;return Math.max(0,_x()+t.getBoundingClientRect().top-12-n)}var Z=Rf({board:null,view:`todos`,connection:`connecting`,controlPlaneState:`ready`,controlPlaneMessage:null,controlPlaneRestartPending:!1,showSettings:!1,showPalette:!1,showNewThread:!1,showGithubPicker:!1,sidebarCollapsed:{active:!1,held:!0,inactive:!0,external:!0},drawers:[],notificationsEnabled:!1,socketTranscripts:!1,socketBoardFallback:null,socketTranscriptFallbacks:{},routeThreadSlug:null,toast:null});function PS(){Z.showNewThread=!0}function FS(){Z.showGithubPicker=!0}function IS(){Z.showGithubPicker=!1}var LS=0;function Q(e,t){Z.toast={id:++LS,text:e,...t}}var RS=0,zS=0;function BS(e,t){return e.kind===t.kind?e.kind===`markdown`?e.path===t.path:e.kind===`subagent`||e.kind===`shell`?e.subId===t.subId:e.slug===t.slug:!1}function VS(e,t){return t.kind===`markdown`?!0:t.kind===`subagent`||t.kind===`shell`?(e.kind===`thread`||e.kind===`doc`)&&e.slug===t.slug:t.kind===`doc`?e.kind===`thread`&&e.slug===t.slug:t.kind===`thread`?e.kind===`doc`&&e.slug===t.slug:!1}function HS(e){let t=Z.drawers.filter(t=>!t.closing&&!BS(t,e)&&!VS(t,e)).map(e=>e.id);t.length&&tC(t);let n=Z.drawers.filter(t=>BS(t,e));if(!n.length){Z.drawers.push({...e,id:++RS,openedAt:++zS});return}let r=[...n].reverse().find(e=>!e.closing)??n[n.length-1],{closing:i,...a}=r,o={...a,...e,openedAt:++zS};Z.drawers=[...Z.drawers.filter(t=>!BS(t,e)),o],queueMicrotask(()=>gx(r.id))}function US(e,t,n){HS({kind:e,slug:t,routed:n?.routed})}function WS(e,t,n){HS({kind:`subagent`,slug:e,subId:t,label:n.label,subagentType:n.subagentType,startedAt:n.startedAt})}function GS(e,t,n){HS({kind:`shell`,slug:e,subId:t,label:n.label,startedAt:n.startedAt})}function KS(e){let t=Z.board?.threads.find(t=>t.id===e);t?.needsYou&&JS(e)||US(t&&t.runtime===`none`?`doc`:`thread`,e)}function qS(){let e=Z.routeThreadSlug;if(!e||!Z.board)return;Z.routeThreadSlug=null;let t=Sx(Z.board,e);if(t.kind===`missing`){typeof location<`u`&&location.replace(Px(e));return}t.kind===`found`&&t.thread.needsYou&&JS(e)||US(`thread`,e,{routed:!0})}function JS(e){let t=MS(e);if(!t)return!1;let n=NS(e),r=Z.drawers.filter(e=>!e.closing).map(e=>e.id);return r.length&&tC(r),n!==null&&(vx()?bx(n):Math.abs(window.scrollY-n)>.5&&window.scrollTo({top:n,left:0,behavior:`auto`})),XS(e,t),!0}var YS=new Map;function XS(e,t){let n=YS.get(e);n!==void 0&&window.clearTimeout(n),t.removeAttribute(`data-queue-flash`),t.offsetWidth,t.setAttribute(`data-queue-flash`,``),YS.set(e,window.setTimeout(()=>{YS.delete(e),t.removeAttribute(`data-queue-flash`)},1100))}function ZS(e){HS({kind:`markdown`,slug:e,path:e,label:e.split(`/`).filter(Boolean).pop()||e})}function QS(){return Z.drawers[Z.drawers.length-1]}function $S(e){let t=Z.drawers.find(t=>t.id===e);t&&(t.closing=!0)}function eC(e){Z.drawers.find(t=>t.id===e)?.closing&&(Z.drawers=Z.drawers.filter(t=>t.id!==e))}function tC(e){let t=[];for(let n of e)mx(n)||t.push(n);if(t.length){let e=new Set(t);Z.drawers=Z.drawers.filter(t=>!e.has(t.id))}}function nC(){for(let e=Z.drawers.length-1;e>=0;e--){let t=Z.drawers[e];if(t.kind===`thread`&&!t.closing)return t.slug}return null}function rC(e){Ix(e.projectSlug)&&(Bx(e.githubRepo),kS(e.projectDir,e.homeDir),Z.board=e)}function iC(){Bx(null),kS(null),pee(),Z.board=null,Z.view=`todos`,Z.connection=`connecting`,Z.drawers=[],Z.routeThreadSlug=null,Z.socketBoardFallback=null,Z.socketTranscriptFallbacks={},Z.showSettings=!1,Z.showNewThread=!1,Z.showGithubPicker=!1}function aC(e){Ix(e.projectSlug)&&Z.board===null&&(Bx(e.githubRepo),kS(e.projectDir,e.homeDir),Z.board=e)}function oC(e){return Z.board===null?!1:(uy(Z.board,e),!0)}function sC(e,t){if(!(!e||!t))return e.threads.find(e=>e.id===t)}var cC=`fixed inset-0 bg-black/40 backdrop-blur-[1px] transition-opacity duration-200 ease-out motion-reduce:transition-none`,lC=`frizz-sheet-panel flex h-full flex-col border-l border-border bg-panel shadow-2xl shadow-black/50 transition-transform duration-200 ease-out motion-reduce:transition-none`;function uC(e,t=0){let n=Math.max(0,e-t);return`min(${720-n*28}px, ${80-n*4}vw)`}function dC(){return typeof window<`u`&&!!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches}function fC(e,t=!1){let[n,r]=(0,B.useState)(t),i=(0,B.useRef)(!1),a=Hf(Z);(0,B.useEffect)(()=>{if(t)return;let e=!1,n=()=>{e||i.current||(e=!0,r(!0))},a=requestAnimationFrame(n),o=window.setTimeout(n,120);return()=>{cancelAnimationFrame(a),window.clearTimeout(o)}},[t]);let o=(0,B.useCallback)(()=>{i.current||(i.current=!0,$S(e),r(!1),window.setTimeout(()=>eC(e),dC()?0:210))},[e]);return(0,B.useEffect)(()=>(px(e,o),()=>px(e,null)),[e,o]),(0,B.useEffect)(()=>{a.drawers.find(t=>t.id===e)?.closing||!i.current||(i.current=!1,r(!0))},[a.drawers,e]),{shown:n,close:o,closingRef:i}}var pC=`[data-radix-popper-content-wrapper],[role='menu'],[role='listbox'],[role='dialog']`;function mC(e){return document.body.style.pointerEvents===`none`||e.closest(pC)!==null}function hC(e,t,n,r){(0,B.useEffect)(()=>{function i(i){let a=i.target;if(!(a instanceof Element)||t.current?.contains(a)||mC(a))return;let o=Z.drawers.findIndex(t=>t.id===e);o===-1||o<Z.drawers.length-1||r&&a.closest(`[data-subagent-parent]`)?.getAttribute(`data-subagent-parent`)===r||n()}return window.addEventListener(`pointerdown`,i,!0),()=>window.removeEventListener(`pointerdown`,i,!0)},[e,t,n,r])}function gC({id:e,depth:t,widthDepth:n,widthOffset:r=0,subagentParent:i,children:a}){let{shown:o,close:s}=fC(e),c=(0,B.useRef)(null);return hC(e,c,s,i),(0,V.jsx)(`div`,{className:`${cC} pointer-events-none flex justify-end ${o?`opacity-100`:`opacity-0`}`,style:{zIndex:50+t*2},children:(0,V.jsx)(`div`,{ref:c,className:`${lC} pointer-events-auto ${o?`translate-x-0`:`translate-x-full`}`,style:{width:uC(n,r)},children:a(s)})})}var _C=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),vC=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,n)=>n?n.toUpperCase():t.toLowerCase()),yC=e=>{let t=vC(e);return t.charAt(0).toUpperCase()+t.slice(1)},bC=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),xC=e=>{for(let t in e)if(t.startsWith(`aria-`)||t===`role`||t===`title`)return!0},SC={xmlns:`http://www.w3.org/2000/svg`,width:24,height:24,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`},CC=(0,B.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,B.createElement)(`svg`,{ref:c,...SC,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:bC(`lucide`,i),...!a&&!xC(s)&&{"aria-hidden":`true`},...s},[...o.map(([e,t])=>(0,B.createElement)(e,t)),...Array.isArray(a)?a:[a]])),wC=(e,t)=>{let n=(0,B.forwardRef)(({className:n,...r},i)=>(0,B.createElement)(CC,{ref:i,iconNode:t,className:bC(`lucide-${_C(yC(e))}`,`lucide-${e}`,n),...r}));return n.displayName=yC(e),n},TC=wC(`alarm-clock`,[[`circle`,{cx:`12`,cy:`13`,r:`8`,key:`3y4lt7`}],[`path`,{d:`M12 9v4l2 2`,key:`1c63tq`}],[`path`,{d:`M5 3 2 6`,key:`18tl5t`}],[`path`,{d:`m22 6-3-3`,key:`1opdir`}],[`path`,{d:`M6.38 18.7 4 21`,key:`17xu3x`}],[`path`,{d:`M17.64 18.67 20 21`,key:`kv2oe2`}]]),EC=wC(`archive`,[[`rect`,{width:`20`,height:`5`,x:`2`,y:`3`,rx:`1`,key:`1wp1u1`}],[`path`,{d:`M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8`,key:`1s80jp`}],[`path`,{d:`M10 12h4`,key:`a56b0p`}]]),DC=wC(`arrow-down`,[[`path`,{d:`M12 5v14`,key:`s699le`}],[`path`,{d:`m19 12-7 7-7-7`,key:`1idqje`}]]),OC=wC(`arrow-left`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),kC=wC(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),AC=wC(`arrow-up`,[[`path`,{d:`m5 12 7-7 7 7`,key:`hav0vg`}],[`path`,{d:`M12 19V5`,key:`x0mq9r`}]]),jC=wC(`bell`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}]]),MC=wC(`bot`,[[`path`,{d:`M12 8V4H8`,key:`hb8ula`}],[`rect`,{width:`16`,height:`12`,x:`4`,y:`8`,rx:`2`,key:`enze0r`}],[`path`,{d:`M2 14h2`,key:`vft8re`}],[`path`,{d:`M20 14h2`,key:`4cs60a`}],[`path`,{d:`M15 13v2`,key:`1xurst`}],[`path`,{d:`M9 13v2`,key:`rq6x2g`}]]),NC=wC(`calendar-clock`,[[`path`,{d:`M16 14v2.2l1.6 1`,key:`fo4ql5`}],[`path`,{d:`M16 2v4`,key:`4m81vk`}],[`path`,{d:`M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5`,key:`1osxxc`}],[`path`,{d:`M3 10h5`,key:`r794hk`}],[`path`,{d:`M8 2v4`,key:`1cmpym`}],[`circle`,{cx:`16`,cy:`16`,r:`6`,key:`qoo3c4`}]]),PC=wC(`check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),FC=wC(`chevron-down`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),IC=wC(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),LC=wC(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),RC=wC(`chevrons-down-up`,[[`path`,{d:`m7 20 5-5 5 5`,key:`13a0gw`}],[`path`,{d:`m7 4 5 5 5-5`,key:`1kwcof`}]]),zC=wC(`chevrons-up-down`,[[`path`,{d:`m7 15 5 5 5-5`,key:`1hf1tw`}],[`path`,{d:`m7 9 5-5 5 5`,key:`sgt6xg`}]]),BC=wC(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),VC=wC(`circle-dashed`,[[`path`,{d:`M10.1 2.182a10 10 0 0 1 3.8 0`,key:`5ilxe3`}],[`path`,{d:`M13.9 21.818a10 10 0 0 1-3.8 0`,key:`11zvb9`}],[`path`,{d:`M17.609 3.721a10 10 0 0 1 2.69 2.7`,key:`1iw5b2`}],[`path`,{d:`M2.182 13.9a10 10 0 0 1 0-3.8`,key:`c0bmvh`}],[`path`,{d:`M20.279 17.609a10 10 0 0 1-2.7 2.69`,key:`1ruxm7`}],[`path`,{d:`M21.818 10.1a10 10 0 0 1 0 3.8`,key:`qkgqxc`}],[`path`,{d:`M3.721 6.391a10 10 0 0 1 2.7-2.69`,key:`1mcia2`}],[`path`,{d:`M6.391 20.279a10 10 0 0 1-2.69-2.7`,key:`1fvljs`}]]),HC=wC(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),UC=wC(`circle-question-mark`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3`,key:`1u773s`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),WC=wC(`circle-slash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),GC=wC(`circle-x`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]]),KC=wC(`clock`,[[`path`,{d:`M12 6v6l4 2`,key:`mmk7yg`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),qC=wC(`copy`,[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]),JC=wC(`ellipsis`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`19`,cy:`12`,r:`1`,key:`1wjl8i`}],[`circle`,{cx:`5`,cy:`12`,r:`1`,key:`1pcz8c`}]]),YC=wC(`external-link`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]),XC=wC(`file-text`,[[`path`,{d:`M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z`,key:`1rqfz7`}],[`path`,{d:`M14 2v4a2 2 0 0 0 2 2h4`,key:`tnqrlb`}],[`path`,{d:`M10 9H8`,key:`b1mrlr`}],[`path`,{d:`M16 13H8`,key:`t4e002`}],[`path`,{d:`M16 17H8`,key:`z1uh3a`}]]),ZC=wC(`git-branch`,[[`line`,{x1:`6`,x2:`6`,y1:`3`,y2:`15`,key:`17qcm7`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}],[`path`,{d:`M18 9a9 9 0 0 1-9 9`,key:`n2h4wq`}]]),QC=wC(`git-commit-horizontal`,[[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}],[`line`,{x1:`3`,x2:`9`,y1:`12`,y2:`12`,key:`1dyftd`}],[`line`,{x1:`15`,x2:`21`,y1:`12`,y2:`12`,key:`oup4p8`}]]),$C=wC(`git-merge`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 21V9a9 9 0 0 0 9 9`,key:`7kw0sc`}]]),ew=wC(`git-pull-request-closed`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`m21 3-6 6`,key:`16nqsk`}],[`path`,{d:`m21 9-6-6`,key:`9j17rh`}],[`path`,{d:`M18 11.5V15`,key:`65xf6f`}],[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}]]),tw=wC(`git-pull-request-draft`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M18 6V5`,key:`1oao2s`}],[`path`,{d:`M18 11v-1`,key:`11c8tz`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),nw=wC(`git-pull-request`,[[`circle`,{cx:`18`,cy:`18`,r:`3`,key:`1xkwt0`}],[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v7`,key:`1yeb86`}],[`line`,{x1:`6`,x2:`6`,y1:`9`,y2:`21`,key:`rroup`}]]),rw=wC(`github`,[[`path`,{d:`M15 22v-4a4.8 4.8 0 0 0-1-3.5c3 0 6-2 6-5.5.08-1.25-.27-2.48-1-3.5.28-1.15.28-2.35 0-3.5 0 0-1 0-3 1.5-2.64-.5-5.36-.5-8 0C6 2 5 2 5 2c-.3 1.15-.3 2.35 0 3.5A5.403 5.403 0 0 0 4 9c0 3.5 3 5.5 6 5.5-.39.49-.68 1.05-.85 1.65-.17.6-.22 1.23-.15 1.85v4`,key:`tonef`}],[`path`,{d:`M9 18c-4.51 2-5-2-7-2`,key:`9comsn`}]]),iw=wC(`hourglass`,[[`path`,{d:`M5 22h14`,key:`ehvnwv`}],[`path`,{d:`M5 2h14`,key:`pdyrp9`}],[`path`,{d:`M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22`,key:`1d314k`}],[`path`,{d:`M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2`,key:`1vvvr6`}]]),aw=wC(`house`,[[`path`,{d:`M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8`,key:`5wwlr5`}],[`path`,{d:`M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z`,key:`1d0kgt`}]]),ow=wC(`image-plus`,[[`path`,{d:`M16 5h6`,key:`1vod17`}],[`path`,{d:`M19 2v6`,key:`4bpg5p`}],[`path`,{d:`M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5`,key:`1ue2ih`}],[`path`,{d:`m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21`,key:`1xmnt7`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]),sw=wC(`inbox`,[[`polyline`,{points:`22 12 16 12 14 15 10 15 8 12 2 12`,key:`o97t9d`}],[`path`,{d:`M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z`,key:`oot6mr`}]]),cw=wC(`key-round`,[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]),lw=wC(`layout-template`,[[`rect`,{width:`18`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`f1a2em`}],[`rect`,{width:`9`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`jqznyg`}],[`rect`,{width:`5`,height:`7`,x:`16`,y:`14`,rx:`1`,key:`q5h2i8`}]]),uw=wC(`list-checks`,[[`path`,{d:`m3 17 2 2 4-4`,key:`1jhpwq`}],[`path`,{d:`m3 7 2 2 4-4`,key:`1obspn`}],[`path`,{d:`M13 6h8`,key:`15sg57`}],[`path`,{d:`M13 12h8`,key:`h98zly`}],[`path`,{d:`M13 18h8`,key:`oe0vm4`}]]),dw=wC(`loader-circle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),fw=wC(`message-square-code`,[[`path`,{d:`M10 7.5 8 10l2 2.5`,key:`xb17xw`}],[`path`,{d:`m14 7.5 2 2.5-2 2.5`,key:`5rap1v`}],[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),pw=wC(`message-square`,[[`path`,{d:`M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z`,key:`1lielz`}]]),mw=wC(`network`,[[`rect`,{x:`16`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`4q2zg0`}],[`rect`,{x:`2`,y:`16`,width:`6`,height:`6`,rx:`1`,key:`8cvhb9`}],[`rect`,{x:`9`,y:`2`,width:`6`,height:`6`,rx:`1`,key:`1egb70`}],[`path`,{d:`M5 16v-3a1 1 0 0 1 1-1h12a1 1 0 0 1 1 1v3`,key:`1jsf9p`}],[`path`,{d:`M12 12V8`,key:`2874zd`}]]),hw=wC(`package-check`,[[`path`,{d:`m16 16 2 2 4-4`,key:`gfu2re`}],[`path`,{d:`M21 10V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l2-1.14`,key:`e7tb2h`}],[`path`,{d:`m7.5 4.27 9 5.15`,key:`1c824w`}],[`polyline`,{points:`3.29 7 12 12 20.71 7`,key:`ousv84`}],[`line`,{x1:`12`,x2:`12`,y1:`22`,y2:`12`,key:`a4e8g8`}]]),gw=wC(`paperclip`,[[`path`,{d:`m16 6-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551`,key:`1miecu`}]]),_w=wC(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M9 8V2`,key:`14iosj`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M18 8v5a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V8Z`,key:`osxo6l`}]]),vw=wC(`plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),yw=wC(`radar`,[[`path`,{d:`M19.07 4.93A10 10 0 0 0 6.99 3.34`,key:`z3du51`}],[`path`,{d:`M4 6h.01`,key:`oypzma`}],[`path`,{d:`M2.29 9.62A10 10 0 1 0 21.31 8.35`,key:`qzzz0`}],[`path`,{d:`M16.24 7.76A6 6 0 1 0 8.23 16.67`,key:`1yjesh`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}],[`path`,{d:`M17.99 11.66A6 6 0 0 1 15.77 16.67`,key:`1u2y91`}],[`circle`,{cx:`12`,cy:`12`,r:`2`,key:`1c9p78`}],[`path`,{d:`m13.41 10.59 5.66-5.66`,key:`mhq4k0`}]]),bw=wC(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),xw=wC(`repeat`,[[`path`,{d:`m17 2 4 4-4 4`,key:`nntrym`}],[`path`,{d:`M3 11v-1a4 4 0 0 1 4-4h14`,key:`84bu3i`}],[`path`,{d:`m7 22-4-4 4-4`,key:`1wqhfi`}],[`path`,{d:`M21 13v1a4 4 0 0 1-4 4H3`,key:`1rx37r`}]]),Sw=wC(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),Cw=wC(`settings`,[[`path`,{d:`M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z`,key:`1qme2f`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),ww=wC(`shield-check`,[[`path`,{d:`M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z`,key:`oel41y`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),Tw=wC(`signpost`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M12 3v3`,key:`1n5kay`}],[`path`,{d:`M18 6a2 2 0 0 1 1.387.56l2.307 2.22a1 1 0 0 1 0 1.44l-2.307 2.22A2 2 0 0 1 18 13H6a2 2 0 0 1-1.387-.56l-2.306-2.22a1 1 0 0 1 0-1.44l2.306-2.22A2 2 0 0 1 6 6z`,key:`gqqp9m`}]]),Ew=wC(`sparkles`,[[`path`,{d:`M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z`,key:`4pj2yx`}],[`path`,{d:`M20 3v4`,key:`1olli1`}],[`path`,{d:`M22 5h-4`,key:`1gvqau`}],[`path`,{d:`M4 17v2`,key:`vumght`}],[`path`,{d:`M5 18H3`,key:`zchphs`}]]),Dw=wC(`square-check-big`,[[`path`,{d:`M21 10.656V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h12.344`,key:`2acyp4`}],[`path`,{d:`m9 11 3 3L22 4`,key:`1pflzl`}]]),Ow=wC(`square-dot`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),kw=wC(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),Aw=wC(`square`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}]]),jw=wC(`timer`,[[`line`,{x1:`10`,x2:`14`,y1:`2`,y2:`2`,key:`14vaq8`}],[`line`,{x1:`12`,x2:`15`,y1:`14`,y2:`11`,key:`17fdiu`}],[`circle`,{cx:`12`,cy:`14`,r:`8`,key:`1e1u0o`}]]),Mw=wC(`triangle-alert`,[[`path`,{d:`m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3`,key:`wmoenq`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),Nw=wC(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),Pw=wC(`x`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Fw({title:e,subtitle:t,icon:n,meta:r,actions:i,onClose:a,initialFocus:o}){return(0,V.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center gap-2.5 border-b border-border bg-panel px-4`,children:[n,(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col justify-center`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[13px] font-medium`,title:e,children:e}),r]}),t&&(0,V.jsx)(`span`,{className:`truncate text-[10px] text-muted/60`,children:t})]}),i,(0,V.jsx)(`button`,{type:`button`,"aria-label":`Close`,onClick:a,...o?{"data-dialog-initial-focus":``}:{},className:`rounded-md p-1.5 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,V.jsx)(Pw,{size:15})})]})}function Iw(e,t){return e===t?!0:!e||!t||e.length!==t.length?!1:e.every((e,n)=>Object.is(e,t[n]))}var Lw=class extends B.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}componentDidCatch(e,t){console.error(`[frizz] render error in ${this.props.label}:`,e,t.componentStack)}componentDidUpdate(e){!this.state.error||Iw(e.resetKeys,this.props.resetKeys)||this.setState({error:null})}retry=()=>this.setState({error:null});render(){let{error:e}=this.state;return e?this.props.fallback?this.props.fallback(e,this.retry):(0,V.jsx)(Bw,{label:this.props.label,error:e,onRetry:this.retry}):this.props.children}};function Rw(e){let t=e instanceof Error?`${e.name}: ${e.message}`:String(e);return t.length>300?`${t.slice(0,300)}…`:t}var zw=`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`;function Bw({label:e,error:t,onRetry:n,onClose:r}){return(0,V.jsxs)(`div`,{"data-error-panel":!0,className:`m-4 rounded-md border border-border-strong bg-panel-2 px-3.5 py-3 text-[12.5px]`,children:[(0,V.jsxs)(`p`,{className:`text-fg/90`,children:[`Something went wrong rendering `,e,`.`]}),(0,V.jsx)(`p`,{className:`font-mono-keep mt-1.5 break-words text-[11.5px] text-muted`,children:Rw(t)}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,className:zw,onClick:n,children:`Try again`}),r&&(0,V.jsx)(`button`,{type:`button`,className:zw,onClick:r,children:`Close`}),(0,V.jsx)(`button`,{type:`button`,className:zw,onClick:()=>window.location.reload(),children:`Reload frizz`})]})]})}function Vw({children:e}){return(0,V.jsx)(Lw,{label:`frizz`,fallback:(e,t)=>(0,V.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-bg p-6 text-fg`,children:(0,V.jsx)(`div`,{className:`w-full max-w-lg`,children:(0,V.jsx)(Bw,{label:`frizz`,error:e,onRetry:t})})}),children:e})}function Hw({id:e,depth:t,widthDepth:n,error:r,onRetry:i}){let a=()=>{Z.drawers=Z.drawers.filter(t=>t.id!==e)};return(0,V.jsx)(gC,{id:e,depth:t,widthDepth:n,children:e=>(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(Fw,{title:`This drawer could not be rendered`,onClose:()=>{e(),a()}}),(0,V.jsx)(`div`,{className:`flex-1 min-h-0 overflow-y-auto`,children:(0,V.jsx)(Bw,{label:`this drawer`,error:r,onRetry:i,onClose:a})})]})})}var Uw=/^(?:[a-z][a-z0-9+.-]*:|[\\/]{2})/i,Ww=/^[\\/]{2}/;function Gw(e,t){return t+e.replace(/\\/g,`/`)}var Kw=`popstate`;function qw(e){return typeof e==`object`&&!!e&&`pathname`in e&&`search`in e&&`hash`in e&&`state`in e&&`key`in e}function Jw(e={}){function t(e,t){let n=t.state?.masked,{pathname:r,search:i,hash:a}=n||e.location;return $w(``,{pathname:r,search:i,hash:a},t.state&&t.state.usr||null,t.state&&t.state.key||`default`,n?{pathname:e.location.pathname,search:e.location.search,hash:e.location.hash}:void 0)}function n(e,t){return typeof t==`string`?t:eT(t)}return nT(t,n,null,e)}function Yw(e,t){if(e===!1||e==null)throw Error(t)}function Xw(e,t){if(!e){typeof console<`u`&&console.warn(t);try{throw Error(t)}catch{}}}function Zw(){return Math.random().toString(36).substring(2,10)}function Qw(e,t){return{usr:e.state,key:e.key,idx:t,masked:e.mask?{pathname:e.pathname,search:e.search,hash:e.hash}:void 0}}function $w(e,t,n=null,r,i){return{pathname:typeof e==`string`?e:e.pathname,search:``,hash:``,...typeof t==`string`?tT(t):t,state:n,key:t&&t.key||r||Zw(),mask:i}}function eT({pathname:e=`/`,search:t=``,hash:n=``}){return t&&t!==`?`&&(e+=t.charAt(0)===`?`?t:`?`+t),n&&n!==`#`&&(e+=n.charAt(0)===`#`?n:`#`+n),e}function tT(e){let t={};if(e){let n=e.indexOf(`#`);n>=0&&(t.hash=e.substring(n),e=e.substring(0,n));let r=e.indexOf(`?`);r>=0&&(t.search=e.substring(r),e=e.substring(0,r)),e&&(t.pathname=e)}return t}function nT(e,t,n,r={}){let{window:i=document.defaultView,v5Compat:a=!1}=r,o=i.history,s=`POP`,c=null,l=u();l??(l=0,o.replaceState({...o.state,idx:l},``));function u(){return(o.state||{idx:null}).idx}function d(){s=`POP`;let e=u(),t=e==null?null:e-l;l=e,c&&c({action:s,location:h.location,delta:t})}function f(e,t){s=`PUSH`;let r=qw(e)?e:$w(h.location,e,t);n&&n(r,e),l=u()+1;let d=Qw(r,l),f=h.createHref(r.mask||r);try{o.pushState(d,``,f)}catch(e){if(e instanceof DOMException&&e.name===`DataCloneError`)throw e;i.location.assign(f)}a&&c&&c({action:s,location:h.location,delta:1})}function p(e,t){s=`REPLACE`;let r=qw(e)?e:$w(h.location,e,t);n&&n(r,e),l=u();let i=Qw(r,l),d=h.createHref(r.mask||r);o.replaceState(i,``,d),a&&c&&c({action:s,location:h.location,delta:0})}function m(e){return rT(i,e)}let h={get action(){return s},get location(){return e(i,o)},listen(e){if(c)throw Error(`A history only accepts one active listener`);return i.addEventListener(Kw,d),c=e,()=>{i.removeEventListener(Kw,d),c=null}},createHref(e){return t(i,e)},createURL:m,encodeLocation(e){let t=m(e);return{pathname:t.pathname,search:t.search,hash:t.hash}},push:f,replace:p,go(e){return o.go(e)}};return h}function rT(e,t,n=!1){let r=`http://localhost`;e&&(r=e.location.origin===`null`?e.location.href:e.location.origin),Yw(r,`No window.location.(origin|href) available to create URL`);let i=typeof t==`string`?t:eT(t);return i=i.replace(/ $/,`%20`),!n&&Ww.test(i)&&(i=r+i),new URL(i,r)}var iT=class{#e=new Map;constructor(e){if(e)for(let[t,n]of e)this.set(t,n)}get(e){if(this.#e.has(e))return this.#e.get(e);if(e.defaultValue!==void 0)return e.defaultValue;throw Error(`No value found for context`)}set(e,t){this.#e.set(e,t)}},aT=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`children`]);function oT(e){return aT.has(e)}var sT=new Set([`lazy`,`caseSensitive`,`path`,`id`,`index`,`middleware`,`children`]);function cT(e){return sT.has(e)}function lT(e){return e.index===!0}function uT(e){let t={};return e.Component&&Object.assign(t,{element:B.createElement(e.Component),Component:void 0}),e.HydrateFallback&&Object.assign(t,{hydrateFallbackElement:B.createElement(e.HydrateFallback),HydrateFallback:void 0}),e.ErrorBoundary&&Object.assign(t,{errorElement:B.createElement(e.ErrorBoundary),ErrorBoundary:void 0}),t}function dT(e,t=uT,n=[],r={},i=!1){return e.map((e,a)=>{let o=[...n,String(a)],s=typeof e.id==`string`?e.id:o.join(`-`);if(Yw(e.index!==!0||!e.children,`Cannot specify children on an index route`),Yw(i||!r[s],`Found a route id collision on id "${s}". Route id's must be globally unique within Data Router usages`),lT(e)){let n={...e,id:s};return r[s]=fT(n,t(n)),n}else{let n={...e,id:s,children:void 0};return r[s]=fT(n,t(n)),e.children&&(n.children=dT(e.children,t,o,r,i)),n}})}function fT(e,t){return Object.assign(e,{...t,...typeof t.lazy==`object`&&t.lazy!=null?{lazy:{...e.lazy,...t.lazy}}:{}})}function pT(e,t,n=`/`){return mT(e,t,n,!1)}function mT(e,t,n,r,i){let a=IT((typeof t==`string`?tT(t):t).pathname||`/`,n);if(a==null)return null;let o=i??gT(e),s=null,c=FT(a);for(let e=0;s==null&&e<o.length;++e)s=jT(o[e],c,r);return s}function hT(e,t){let{route:n,pathname:r,params:i}=e;return{id:n.id,pathname:r,params:i,loaderData:t[n.id],handle:n.handle}}function gT(e){let t=_T(e);return yT(t),t}function _T(e,t=[],n=[],r=``,i=!1){let a=(e,a,o=i,s)=>{let c={relativePath:s===void 0?e.path||``:s,caseSensitive:e.caseSensitive===!0,childrenIndex:a,route:e};if(c.relativePath.startsWith(`/`)){if(!c.relativePath.startsWith(r)&&o)return;Yw(c.relativePath.startsWith(r),`Absolute route path "${c.relativePath}" nested under path "${r}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),c.relativePath=c.relativePath.slice(r.length)}let l=KT([r,c.relativePath]),u=n.concat(c);e.children&&e.children.length>0&&(Yw(e.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${l}".`),_T(e.children,t,u,l,o)),!(e.path==null&&!e.index)&&t.push({path:l,score:kT(l,e.index),routesMeta:u.map((e,t)=>{let[n,r]=PT(e.relativePath,e.caseSensitive,t===u.length-1);return{...e,matcher:n,compiledParams:r}})})};return e.forEach((e,t)=>{if(e.path===``||!e.path?.includes(`?`))a(e,t);else for(let n of vT(e.path))a(e,t,!0,n)}),t}function vT(e){let t=e.split(`/`);if(t.length===0)return[];let[n,...r]=t,i=n.endsWith(`?`),a=n.replace(/\?$/,``);if(r.length===0)return i?[a,``]:[a];let o=vT(r.join(`/`)),s=[];return s.push(...o.map(e=>e===``?a:[a,e].join(`/`))),i&&s.push(...o),s.map(t=>e.startsWith(`/`)&&t===``?`/`:t)}function yT(e){e.sort((e,t)=>e.score===t.score?AT(e.routesMeta.map(e=>e.childrenIndex),t.routesMeta.map(e=>e.childrenIndex)):t.score-e.score)}var bT=/^:[\w-]+$/,xT=/^:[\w-]+/,ST=3.5,CT=3,wT=2,TT=1,ET=10,DT=-2,OT=e=>e===`*`;function kT(e,t){let n=e.split(`/`),r=n.length;return n.some(OT)&&(r+=DT),t&&(r+=wT),n.filter(e=>!OT(e)).reduce((e,t)=>e+(bT.test(t)?CT:xT.test(t)?ST:t===``?TT:ET),r)}function AT(e,t){return e.length===t.length&&e.slice(0,-1).every((e,n)=>e===t[n])?e[e.length-1]-t[t.length-1]:0}function jT(e,t,n=!1){let{routesMeta:r}=e,i={},a=`/`,o=[];for(let e=0;e<r.length;++e){let s=r[e],c=e===r.length-1,l=a===`/`?t:t.slice(a.length)||`/`,u={path:s.relativePath,caseSensitive:s.caseSensitive,end:c},d=s.matcher&&s.compiledParams?NT(u,l,s.matcher,s.compiledParams):MT(u,l),f=s.route;if(!d&&c&&n&&!r[r.length-1].route.index&&(d=MT({path:s.relativePath,caseSensitive:s.caseSensitive,end:!1},l)),!d)return null;Object.assign(i,d.params),o.push({params:i,pathname:KT([a,d.pathname]),pathnameBase:JT(KT([a,d.pathnameBase])),route:f}),d.pathnameBase!==`/`&&(a=KT([a,d.pathnameBase]))}return o}function MT(e,t){typeof e==`string`&&(e={path:e,caseSensitive:!1,end:!0});let[n,r]=PT(e.path,e.caseSensitive,e.end);return NT(e,t,n,r)}function NT(e,t,n,r){let i=t.match(n);if(!i)return null;let a=i[0],o=a.replace(/(.)\/+$/,`$1`),s=i.slice(1);return{params:r.reduce((e,{paramName:t,isOptional:n},r)=>{if(t===`*`){let e=s[r]||``;o=a.slice(0,a.length-e.length).replace(/(.)\/+$/,`$1`)}let i=s[r];return n&&!i?e[t]=void 0:e[t]=(i||``).replace(/%2F/g,`/`),e},{}),pathname:a,pathnameBase:o,pattern:e}}function PT(e,t=!1,n=!0){Xw(e===`*`||!e.endsWith(`*`)||e.endsWith(`/*`),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,`/*`)}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,`/*`)}".`);let r=[],i=`^`+e.replace(/\/*\*?$/,``).replace(/^\/*/,`/`).replace(/[\\.*+^${}|()[\]]/g,`\\$&`).replace(/\/:([\w-]+)(\?)?/g,(e,t,n,i,a)=>{if(r.push({paramName:t,isOptional:n!=null}),n){let t=a.charAt(i+e.length);return t&&t!==`/`?`/([^\\/]*)`:`(?:/([^\\/]*))?`}return`/([^\\/]+)`}).replace(/\/([\w-]+)\?(?=\/|$|\()/g,`(?:/$1)?`);return e.endsWith(`*`)?(r.push({paramName:`*`}),i+=e===`*`||e===`/*`?`(.*)$`:`(?:\\/(.+)|\\/*)$`):n?i+=`\\/*$`:e!==``&&e!==`/`&&(i+=`(?:(?=\\/|$))`),[new RegExp(i,t?void 0:`i`),r]}function FT(e){try{return e.split(`/`).map(e=>decodeURIComponent(e).replace(/\//g,`%2F`)).join(`/`)}catch(t){return Xw(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function IT(e,t){if(t===`/`)return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let n=t.endsWith(`/`)?t.length-1:t.length,r=e.charAt(n);return r&&r!==`/`?null:e.slice(n)||`/`}function LT({basename:e,pathname:t}){return t===`/`?e:KT([e,t])}var RT=e=>Uw.test(e);function zT(e,t=`/`){let{pathname:n,search:r=``,hash:i=``}=typeof e==`string`?tT(e):e,a;return n?(n=GT(n),a=n.startsWith(`/`)?BT(n.substring(1),`/`):BT(n,t)):a=t,{pathname:a,search:YT(r),hash:XT(i)}}function BT(e,t){let n=qT(t).split(`/`);return e.split(`/`).forEach(e=>{e===`..`?n.length>1&&n.pop():e!==`.`&&n.push(e)}),n.length>1?n.join(`/`):`/`}function VT(e,t,n,r){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(r)}]. Please separate it out to the \`to.${n}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function HT(e){return e.filter((e,t)=>t===0||e.route.path&&e.route.path.length>0)}function UT(e){let t=HT(e);return t.map((e,n)=>n===t.length-1?e.pathname:e.pathnameBase)}function WT(e,t,n,r=!1){let i;typeof e==`string`?i=tT(e):(i={...e},Yw(!i.pathname||!i.pathname.includes(`?`),VT(`?`,`pathname`,`search`,i)),Yw(!i.pathname||!i.pathname.includes(`#`),VT(`#`,`pathname`,`hash`,i)),Yw(!i.search||!i.search.includes(`#`),VT(`#`,`search`,`hash`,i)));let a=e===``||i.pathname===``,o=a?`/`:i.pathname,s;if(o==null)s=n;else{let e=t.length-1;if(!r&&o.startsWith(`..`)){let t=o.split(`/`);for(;t[0]===`..`;)t.shift(),--e;i.pathname=t.join(`/`)}s=e>=0?t[e]:`/`}let c=zT(i,s),l=o&&o!==`/`&&o.endsWith(`/`),u=(a||o===`.`)&&n.endsWith(`/`);return!c.pathname.endsWith(`/`)&&(l||u)&&(c.pathname+=`/`),c}var GT=e=>e.replace(/[\\/]{2,}/g,`/`),KT=e=>GT(e.join(`/`)),qT=e=>e.replace(/\/+$/,``),JT=e=>qT(e).replace(/^\/*/,`/`),YT=e=>!e||e===`?`?``:e.startsWith(`?`)?e:`?`+e,XT=e=>!e||e===`#`?``:e.startsWith(`#`)?e:`#`+e,ZT=[`EvalError`,`RangeError`,`ReferenceError`,`SyntaxError`,`TypeError`,`URIError`],QT=class{status;statusText;data;error;internal;constructor(e,t,n,r=!1){this.status=e,this.statusText=t||``,this.internal=r,n instanceof Error?(this.data=n.toString(),this.error=n):this.data=n}};function $T(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.internal==`boolean`&&`data`in e}function eE(e){return KT(e.map(e=>e.route.path).filter(Boolean))||`/`}function tE(e,t){let n=new URL(typeof e==`string`||e instanceof URL?e:e.url),r=typeof t==`string`?tT(t):t;if(n.pathname=r.pathname||`/`,r.search){let e=new URLSearchParams(r.search),t=e.getAll(`index`);e.delete(`index`);for(let n of t.filter(Boolean))e.append(`index`,n);let i=e.toString();n.search=i?`?${i}`:``}else n.search=``;return n.hash=r.hash||``,n}var nE=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;function rE(e,t){let n=e;if(typeof n!=`string`||!Uw.test(n))return{absoluteURL:void 0,isExternal:!1,to:n};let r=n,i=!1;if(nE)try{let e=new URL(window.location.href),r=Ww.test(n)?new URL(Gw(n,e.protocol)):new URL(n),a=IT(r.pathname,t);r.origin===e.origin&&a!=null?n=a+r.search+r.hash:i=!0}catch{Xw(!1,`<Link to="${n}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}return{absoluteURL:r,isExternal:i,to:n}}var iE=Symbol(`Uninstrumented`),aE=new WeakMap;function oE(e,t){let n={lazy:[],"lazy.loader":[],"lazy.action":[],"lazy.middleware":[],middleware:[],loader:[],action:[]};e.forEach(e=>e({id:t.id,index:t.index,path:t.path,instrument(e){e.lazy!=null&&n.lazy.push(e.lazy),e[`lazy.loader`]!=null&&n[`lazy.loader`].push(e[`lazy.loader`]),e[`lazy.action`]!=null&&n[`lazy.action`].push(e[`lazy.action`]),e[`lazy.middleware`]!=null&&n[`lazy.middleware`].push(e[`lazy.middleware`]),e.middleware!=null&&n.middleware.push(e.middleware),e.loader!=null&&n.loader.push(e.loader),e.action!=null&&n.action.push(e.action)}}));let r={};if(typeof t.lazy==`function`&&n.lazy.length>0){let e=t.lazy;r.lazy=async(...t)=>fE(await pE(n.lazy,void 0,()=>e(...t),mE))}if(typeof t.lazy==`object`){let e=t.lazy;if(typeof e.middleware==`function`&&n[`lazy.middleware`].length>0){let t=e.middleware;r.lazy=Object.assign(r.lazy||{},{middleware:async(...e)=>fE(await pE(n[`lazy.middleware`],void 0,()=>t(...e),mE))})}if(typeof e.loader==`function`&&n[`lazy.loader`].length>0){let t=e.loader;r.lazy=Object.assign(r.lazy||{},{loader:async(...e)=>fE(await pE(n[`lazy.loader`],void 0,()=>t(...e),mE))})}if(typeof e.action==`function`&&n[`lazy.action`].length>0){let t=e.action;r.lazy=Object.assign(r.lazy||{},{action:async(...e)=>fE(await pE(n[`lazy.action`],void 0,()=>t(...e),mE))})}}if(typeof t.loader==`function`&&n.loader.length>0){let e=cE(t.loader),i=async(...t)=>fE(await pE(n.loader,hE(t[0]),()=>e(...t),mE));e.hydrate===!0&&(i.hydrate=!0),lE(i,e),r.loader=i}if(typeof t.action==`function`&&n.action.length>0){let e=cE(t.action),i=async(...t)=>fE(await pE(n.action,hE(t[0]),()=>e(...t),mE));lE(i,e),r.action=i}return t.middleware&&t.middleware.length>0&&n.middleware.length>0&&(r.middleware=t.middleware.map(e=>{let t=cE(e),r=async(...e)=>fE(await pE(n.middleware,hE(e[0]),()=>t(...e),mE));return lE(r,t),r})),r}function sE(e,t){let n={navigate:[],fetch:[]};if(t.forEach(e=>e({instrument(e){e.navigate!=null&&n.navigate.push(e.navigate),e.fetch!=null&&n.fetch.push(e.fetch)}})),n.navigate.length>0){let t=cE(e.navigate),r=async(...r)=>{let[i,a]=r,o,s={to:typeof i==`number`||typeof i==`string`?i:i?eT(i):`.`,...gE(e,a??{})};return fE(await pE(n.navigate,s,async()=>{if(typeof i==`number`)return await t(...r);let n=uE(e,e=>{o=e});try{return await t(...r)}finally{n()}},e=>({...mE(e),meta:o})))};lE(r,t),e.navigate=r}if(n.fetch.length>0){let t=cE(e.fetch),r=async(...r)=>{let[i,a,o,s]=r,c;return fE(await pE(n.fetch,{href:o??`.`,fetcherKey:i,...gE(e,s??{})},async()=>{let n=uE(e,e=>{c=e});try{return await t(...r)}finally{n()}},e=>({...mE(e),meta:c})))};lE(r,t),e.fetch=r}return e}function cE(e){return e[iE]??e}function lE(e,t){e[iE]=t}function uE(e,t){return aE.set(e,t),()=>{aE.get(e)===t&&aE.delete(e)}}function dE(e){let t=aE.get(e);return aE.delete(e),t}function fE(e){if(e.type===`error`)throw e.value;return e.value}async function pE(e,t,n,r,i={result:null,innerResult:null},a=e.length-1){let o=e[a];if(o){let s,c=async()=>(s?console.error(`You cannot call instrumented handlers more than once`):s=pE(e,t,n,r,i,a-1),await s,Yw(i.innerResult,`Expected an inner result`),i.innerResult);try{await o(c,t)}catch(e){console.error(`An instrumentation function threw an error:`,e)}s||await c(),await s}else{try{i.result={type:`success`,value:await n()}}catch(e){i.result={type:`error`,value:e}}i.innerResult=r(i.result,t)}return i.result?i.result:(i.result={type:`error`,value:Error(`No result assigned in instrumentation chain.`)},i.innerResult=r(i.result,t),i.result)}function mE(e){return e.type===`error`&&e.value instanceof Error?{status:`error`,error:e.value}:{status:`success`,error:void 0}}function hE(e){let{request:t,context:n,params:r}=e;return{...e,request:_E(t),params:{...r},context:vE(n)}}function gE(e,t){return{currentUrl:eT(e.state.location),...`formMethod`in t?{formMethod:t.formMethod}:{},...`formEncType`in t?{formEncType:t.formEncType}:{},...`formData`in t?{formData:t.formData}:{},...`body`in t?{body:t.body}:{}}}function _E(e){return{method:e.method,url:e.url,headers:{get:(...t)=>e.headers.get(...t)}}}function vE(e){return{get:t=>e.get(t)}}var yE=[`POST`,`PUT`,`PATCH`,`DELETE`],bE=new Set(yE),xE=[`GET`,...yE],SE=new Set(xE),CE=new Set([301,302,303,307,308]),wE=new Set([307,308]),TE={state:`idle`,location:void 0,matches:void 0,historyAction:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},EE={state:`idle`,data:void 0,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0},DE={state:`unblocked`,proceed:void 0,reset:void 0,location:void 0},OE=`remix-router-transitions`,kE=Symbol(`ResetLoaderData`),AE=class{#e;#t;#n;#r;constructor(e){this.#e=e,this.#t=gT(e)}get stableRoutes(){return this.#e}get activeRoutes(){return this.#n??this.#e}get branches(){return this.#r??this.#t}get hasHMRRoutes(){return this.#n!=null}setRoutes(e){this.#e=e,this.#t=gT(e)}setHmrRoutes(e){this.#n=e,this.#r=gT(e)}commitHmrRoutes(){this.#n&&(this.#e=this.#n,this.#t=this.#r,this.#n=void 0,this.#r=void 0)}};function jE(e){let t=e.window?e.window:typeof window<`u`?window:void 0,n=t!==void 0&&t.document!==void 0&&t.document.createElement!==void 0;Yw(e.routes.length>0,`You must provide a non-empty routes array to createRouter`);let r=e.hydrationRouteProperties||[],i=e.mapRouteProperties,a=i||(()=>({}));if(e.instrumentations){let t=e.instrumentations;a=e=>({...i?.(e),...oE(t.map(e=>e.route).filter(Boolean),e)})}let o={},s=new AE(dT(e.routes,a,void 0,o)),c=e.basename||`/`;c.startsWith(`/`)||(c=`/${c}`);let l=e.dataStrategy||JE,u={...e.future},d=null,f=new Set,p=null,m=null,h=null,g=null,_=e.hydrationData!=null,v=mT(s.activeRoutes,e.history.location,c,!1,s.branches),y=!1,b=null,x,S;if(v==null&&!e.patchRoutesOnNavigation){let t=vD(404,{pathname:e.history.location.pathname}),{matches:n,route:r}=_D(s.activeRoutes);x=!0,S=!x,v=n,b={[r.id]:t}}else if(v&&!e.hydrationData&&Je(v,s.activeRoutes,e.history.location.pathname).active&&(v=null),!v){x=!1,S=!x,v=[];let t=Je(null,s.activeRoutes,e.history.location.pathname);t.active&&t.matches&&(y=!0,v=t.matches)}else if(v.some(e=>e.route.lazy))x=!1,S=!x;else if(!v.some(e=>IE(e.route)))x=!0,S=!x;else{let t=e.hydrationData?e.hydrationData.loaderData:null,n=e.hydrationData?e.hydrationData.errors:null,r=v;if(n){let e=v.findIndex(e=>n[e.route.id]!==void 0);r=r.slice(0,e+1)}S=!1,x=!0,r.forEach(e=>{let r=LE(e.route,t,n);S||=r.renderFallback,x&&=!r.shouldLoad})}let C,w={historyAction:e.history.action,location:e.history.location,matches:v,initialized:x,renderFallback:S,navigation:TE,restoreScrollPosition:e.hydrationData==null?null:!1,preventScrollReset:!1,revalidation:`idle`,loaderData:e.hydrationData&&e.hydrationData.loaderData||{},actionData:e.hydrationData&&e.hydrationData.actionData||null,errors:e.hydrationData&&e.hydrationData.errors||b,fetchers:new Map,blockers:new Map},T=`POP`,E=null,D=!1,O,k=!1,A=new Map,j=null,M=!1,N=!1,P=new Set,ee=new Map,F=0,te=-1,ne=new Map,re=new Set,ie=new Map,ae=new Map,oe=new Set,se=new Map,ce,le=null;function ue(){if(d=e.history.listen(({action:t,location:n,delta:r})=>{if(ce){ce(),ce=void 0;return}Xw(se.size===0||r!=null,"You are trying to use a blocker on a POP navigation to a location that was not created by @remix-run/router. This will fail silently in production. This can happen if you are navigating outside the router via `window.history.pushState`/`window.location.hash` instead of using router navigation APIs. This can also happen if you are using createHashRouter and the user manually changes the URL.");let i=He({currentLocation:w.location,nextLocation:n,historyAction:t});if(i&&r!=null){let t=new Promise(e=>{ce=e});e.history.go(r*-1),Ve(i,{state:`blocked`,location:n,proceed(){Ve(i,{state:`proceeding`,proceed:void 0,reset:void 0,location:n}),t.then(()=>e.history.go(r))},reset(){let e=new Map(w.blockers);e.set(i,DE),pe({blockers:e})}}),E?.resolve(),E=null;return}return _e(t,n)}),n){UD(t,A);let e=()=>WD(t,A);t.addEventListener(`pagehide`,e),j=()=>t.removeEventListener(`pagehide`,e)}return w.initialized||_e(`POP`,w.location,{initialHydration:!0}),C}function de(){d&&d(),j&&j(),f.clear(),O&&O.abort(),w.fetchers.forEach((e,t)=>Ne(w.fetchers,t)),w.blockers.forEach((e,t)=>Be(t))}function fe(e){if(f.add(e),p){let{newErrors:t}=p;p=null,e(w,{deletedFetchers:[],newErrors:t,viewTransitionOpts:void 0,flushSync:!1})}return()=>f.delete(e)}function pe(e,t={}){e.matches&&=e.matches.map(e=>{let t=o[e.route.id],n=e.route;return n.element!==t.element||n.errorElement!==t.errorElement||n.hydrateFallbackElement!==t.hydrateFallbackElement?{...e,route:t}:e}),w={...w,...e};let n=[],r=[];w.fetchers.forEach((e,t)=>{e.state===`idle`&&(oe.has(t)?n.push(t):r.push(t))}),oe.forEach(e=>{!w.fetchers.has(e)&&!ee.has(e)&&n.push(e)}),f.size===0&&(p={newErrors:e.errors??null}),[...f].forEach(r=>r(w,{deletedFetchers:n,newErrors:e.errors??null,viewTransitionOpts:t.viewTransitionOpts,flushSync:t.flushSync===!0})),n.forEach(e=>Ne(w.fetchers,e)),r.forEach(e=>w.fetchers.delete(e))}function me(t,n,{flushSync:r}={}){let i=w.actionData!=null&&w.navigation.formMethod!=null&&ND(w.navigation.formMethod)&&w.navigation.state===`loading`&&t.state?._isRedirect!==!0,a;a=n.actionData?Object.keys(n.actionData).length>0?n.actionData:null:i?w.actionData:null;let o=n.loaderData?mD(w.loaderData,n.loaderData,n.matches||[],n.errors):w.loaderData,c=w.blockers;c.size>0&&!M&&(c=new Map(c),c.forEach((e,t)=>c.set(t,DE)));let l=M?!1:qe(t,n.matches||w.matches),u=D===!0||w.navigation.formMethod!=null&&ND(w.navigation.formMethod)&&t.state?._isRedirect!==!0;s.commitHmrRoutes(),M||T===`POP`||(T===`PUSH`?e.history.push(t,t.state):T===`REPLACE`&&e.history.replace(t,t.state));let d;if(T===`POP`){let e=A.get(w.location.pathname);e&&e.has(t.pathname)?d={currentLocation:w.location,nextLocation:t}:A.has(t.pathname)&&(d={currentLocation:t,nextLocation:w.location})}else if(k){let e=A.get(w.location.pathname);e?e.add(t.pathname):(e=new Set([t.pathname]),A.set(w.location.pathname,e)),d={currentLocation:w.location,nextLocation:t}}pe({...n,actionData:a,loaderData:o,historyAction:T,location:t,initialized:!0,renderFallback:!1,navigation:TE,revalidation:`idle`,restoreScrollPosition:l,preventScrollReset:u,blockers:c},{viewTransitionOpts:d,flushSync:r===!0}),T=`POP`,D=!1,k=!1,M=!1,N=!1,E?.resolve(),E=null,le?.resolve(),le=null}async function he(t,n){if(E?.resolve(),E=null,typeof t==`number`){E||=GD();let n=E.promise;return e.history.go(t),n}let r=dE(C),{path:i,submission:a,error:o}=PE(!1,NE(w.location,w.matches,c,t,n?.fromRouteId,n?.relative),n),s;n?.mask&&(s={pathname:``,search:``,hash:``,...typeof n.mask==`string`?tT(n.mask):{...w.location.mask,...n.mask}});let l=w.location,u=$w(l,i,n&&n.state,void 0,s);u={...u,...e.history.encodeLocation(u)};let d=n&&n.replace!=null?n.replace:void 0,f=`PUSH`;d===!0?f=`REPLACE`:d===!1||a!=null&&ND(a.formMethod)&&a.formAction===w.location.pathname+w.location.search&&(f=`REPLACE`);let p=n&&`preventScrollReset`in n?n.preventScrollReset===!0:void 0,m=(n&&n.flushSync)===!0,h=He({currentLocation:l,nextLocation:u,historyAction:f});if(h){Ve(h,{state:`blocked`,location:u,proceed(){Ve(h,{state:`proceeding`,proceed:void 0,reset:void 0,location:u}),he(t,n)},reset(){let e=new Map(w.blockers);e.set(h,DE),pe({blockers:e})}});return}await _e(f,u,{submission:a,pendingError:o,preventScrollReset:p,replace:n&&n.replace,enableViewTransition:n&&n.viewTransition,flushSync:m,callSiteDefaultShouldRevalidate:n&&n.defaultShouldRevalidate,instrumentationNavigateMetaReceiver:r})}function ge(){le||=GD(),Oe(),pe({revalidation:`loading`});let e=le.promise;return w.navigation.state===`submitting`?e:w.navigation.state===`idle`?(_e(w.historyAction,w.location,{startUninterruptedRevalidation:!0}),e):(_e(T||w.historyAction,w.navigation.location,{overrideNavigation:w.navigation,enableViewTransition:k===!0}),e)}async function _e(t,n,r){O&&O.abort(),O=null,T=t,M=(r&&r.startUninterruptedRevalidation)===!0,Ke(w.location,w.matches),D=(r&&r.preventScrollReset)===!0,k=(r&&r.enableViewTransition)===!0;let i=s.activeRoutes,a=r?.initialHydration&&w.matches&&w.matches.length>0&&!y?w.matches:mT(i,n,c,!1,s.branches),o=(r&&r.flushSync)===!0;if(a&&w.initialized&&!N&&xD(w.location,n)&&!(r&&r.submission&&ND(r.submission.formMethod))){me(n,{matches:a},{flushSync:o});return}let l=Je(a,i,n.pathname);if(l.active&&l.matches&&(a=l.matches),r?.instrumentationNavigateMetaReceiver){let t=ID(e.history,n,a);r.instrumentationNavigateMetaReceiver(t)}if(!a){let{error:e,notFoundMatches:t,route:r}=Ue(n.pathname);me(n,{matches:t,loaderData:{},errors:{[r.id]:e}},{flushSync:o});return}let u=r&&r.overrideNavigation?{...r.overrideNavigation,matches:a,historyAction:t}:void 0;O=new AbortController;let d=lD(e.history,n,O.signal,r&&r.submission),f=e.getContext?await e.getContext():new iT,p;if(r&&r.pendingError)p=[gD(a).route.id,{type:`error`,error:r.pendingError}];else if(r&&r.submission&&ND(r.submission.formMethod)){let i=await ve(d,n,r.submission,a,t,f,l.active,r&&r.initialHydration===!0,{replace:r.replace,flushSync:o});if(i.shortCircuited)return;if(i.pendingActionResult){let[e,t]=i.pendingActionResult;if(ED(t)&&$T(t.error)&&t.error.status===404){O=null,me(n,{matches:i.matches,loaderData:{},errors:{[e]:t.error}});return}}a=i.matches||a,p=i.pendingActionResult,u=RD(n,a,t,r.submission),o=!1,l.active=!1,d=lD(e.history,d.url,d.signal)}let{shortCircuited:m,matches:h,loaderData:g,errors:_,workingFetchers:v}=await ye(d,n,a,t,f,l.active,u,r&&r.submission,r&&r.fetcherSubmission,r&&r.replace,r&&r.initialHydration===!0,o,p,r&&r.callSiteDefaultShouldRevalidate);m||(O=null,me(n,{matches:h||a,...hD(p),loaderData:g,errors:_,...v?{fetchers:v}:{}}))}async function ve(t,n,i,l,u,d,f,p,m={}){if(Oe(),pe({navigation:zD(n,l,u,i)},{flushSync:m.flushSync===!0}),f){let e=await Ye(l,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=_D(s.activeRoutes);return{matches:t,pendingActionResult:[n.id,{type:`error`,error:e.error}]}}let t=gD(e.partialMatches).route.id;return{matches:e.partialMatches,pendingActionResult:[t,{type:`error`,error:e.error}]}}else if(e.matches)l=e.matches;else{let{notFoundMatches:e,error:t,route:r}=Ue(n.pathname);return{matches:e,pendingActionResult:[r.id,{type:`error`,error:t}]}}}let h,g=FD(l,n);if(!g.route.action&&!g.route.lazy)h={type:`error`,error:vD(405,{method:t.method,pathname:n.pathname,routeId:g.route.id})};else{let e=await Ee(t,n,eD(a,o,t,n,l,g,p?[]:r,d),d,null);if(h=e[g.route.id],!h){for(let t of l)if(e[t.route.id]){h=e[t.route.id];break}}if(t.signal.aborted)return{shortCircuited:!0}}if(DD(h)){let n;return n=m&&m.replace!=null?m.replace:cD(h.response.headers.get(`Location`),new URL(t.url),c,e.history)===w.location.pathname+w.location.search,await Te(t,h,!0,{submission:i,replace:n}),{shortCircuited:!0}}if(ED(h)){let e=gD(l,g.route.id);return(m&&m.replace)!==!0&&(T=`PUSH`),{matches:l,pendingActionResult:[e.route.id,h,g.route.id]}}return{matches:l,pendingActionResult:[g.route.id,h]}}async function ye(t,n,i,l,u,d,f,p,m,h,g,_,v,y){let b=f||RD(n,i,l,p),x=p||m||LD(b),S=!M&&!g;if(d){if(S){let e=be(v);pe({navigation:b,...e===void 0?{}:{actionData:e}},{flushSync:_})}let e=await Ye(i,n.pathname,t.signal);if(e.type===`aborted`)return{shortCircuited:!0};if(e.type===`error`){if(e.partialMatches.length===0){let{matches:t,route:n}=_D(s.activeRoutes);return{matches:t,loaderData:{},errors:{[n.id]:e.error}}}let t=gD(e.partialMatches).route.id;return{matches:e.partialMatches,loaderData:{},errors:{[t]:e.error}}}else if(e.matches)i=e.matches;else{let{error:e,notFoundMatches:t,route:r}=Ue(n.pathname);return{matches:t,loaderData:{},errors:{[r.id]:e}}}}let C=s.activeRoutes,{dsMatches:T,revalidatingFetchers:E}=FE(t,u,a,o,e.history,w,i,x,n,g?[]:r,g===!0,N,P,oe,ie,re,C,c,e.patchRoutesOnNavigation!=null,s.branches,v,y);if(te=++F,!e.dataStrategy&&!T.some(e=>e.shouldLoad)&&!T.some(e=>e.route.middleware&&e.route.middleware.length>0)&&E.length===0){let e=new Map(w.fetchers),t=Le(e);return me(n,{matches:i,loaderData:{},errors:v&&ED(v[1])?{[v[0]]:v[1].error}:null,...hD(v),...t?{fetchers:e}:{}},{flushSync:_}),{shortCircuited:!0}}if(S){let e={};if(!d){e.navigation=b;let t=be(v);t!==void 0&&(e.actionData=t)}E.length>0&&(e.fetchers=xe(E)),pe(e,{flushSync:_})}E.forEach(e=>{Fe(e.key),e.controller&&ee.set(e.key,e.controller)});let D=()=>E.forEach(e=>Fe(e.key));O&&O.signal.addEventListener(`abort`,D);let{loaderResults:k,fetcherResults:A}=await De(T,E,t,n,u);if(t.signal.aborted)return{shortCircuited:!0};O&&O.signal.removeEventListener(`abort`,D),E.forEach(e=>ee.delete(e.key));let j=yD(k);if(j)return await Te(t,j.result,!0,{replace:h}),{shortCircuited:!0};if(j=yD(A),j)return re.add(j.key),await Te(t,j.result,!0,{replace:h}),{shortCircuited:!0};let ne=new Map(w.fetchers),{loaderData:ae,errors:se}=pD(w,i,k,v,E,A,ne);g&&w.errors&&(se={...w.errors,...se});let ce=Le(ne),le=Re(te,ne),ue=ce||le||E.length>0;return{matches:i,loaderData:ae,errors:se,...ue?{workingFetchers:ne}:{}}}function be(e){if(e&&!ED(e[1]))return{[e[0]]:e[1].data};if(w.actionData)return Object.keys(w.actionData).length===0?null:w.actionData}function xe(e){let t=new Map(w.fetchers);return e.forEach(e=>{let n=t.get(e.key),r=BD(void 0,n?n.data:void 0);t.set(e.key,r)}),t}async function Se(t,n,r,i){Fe(t);let a=(i&&i.flushSync)===!0,o=dE(C),l=s.activeRoutes,u=NE(w.location,w.matches,c,r,n,i?.relative),d=mT(l,u,c,!1,s.branches),f=Je(d,l,u);if(f.active&&f.matches&&(d=f.matches),o&&o(ID(e.history,u,d)),!d){Ae(t,n,vD(404,{pathname:u}),{flushSync:a});return}let{path:p,submission:m,error:h}=PE(!0,u,i);if(h){Ae(t,n,h,{flushSync:a});return}let g=e.getContext?await e.getContext():new iT,_=(i&&i.preventScrollReset)===!0;if(m&&ND(m.formMethod)){await Ce(t,n,p,d,g,f.active,a,_,m,i&&i.defaultShouldRevalidate);return}ie.set(t,{routeId:n,path:p}),await we(t,n,p,d,g,f.active,a,_,m)}async function Ce(t,n,i,l,u,d,f,p,m,h){Oe(),ie.delete(t),ke(t,VD(m,w.fetchers.get(t)),{flushSync:f});let g=new AbortController,_=lD(e.history,i,g.signal,m);if(d){let e=await Ye(l,new URL(_.url).pathname,_.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ae(t,n,e.error,{flushSync:f});return}else if(e.matches)l=e.matches;else{Ae(t,n,vD(404,{pathname:i}),{flushSync:f});return}}let v=FD(l,i);if(!v.route.action&&!v.route.lazy){Ae(t,n,vD(405,{method:m.formMethod,pathname:i,routeId:n}),{flushSync:f});return}ee.set(t,g);let y=F,b=eD(a,o,_,i,l,v,r,u),x=await Ee(_,i,b,u,t),S=x[v.route.id];if(!S){for(let e of b)if(x[e.route.id]){S=x[e.route.id];break}}if(_.signal.aborted){ee.get(t)===g&&ee.delete(t);return}if(oe.has(t)){if(DD(S)||ED(S)){ke(t,HD(void 0));return}}else{if(DD(S))if(ee.delete(t),te>y){ke(t,HD(void 0));return}else return re.add(t),ke(t,BD(m)),Te(_,S,!1,{fetcherSubmission:m,preventScrollReset:p});if(ED(S)){Ae(t,n,S.error);return}}let C=w.navigation.location||w.location,E=lD(e.history,C,g.signal),D=s.activeRoutes,k=w.navigation.state===`idle`?w.matches:mT(D,w.navigation.location,c,!1,s.branches);Yw(k,`Didn't find any matches after fetcher action`);let A=++F;ne.set(t,A);let{dsMatches:j,revalidatingFetchers:M}=FE(E,u,a,o,e.history,w,k,m,C,r,!1,N,P,oe,ie,re,D,c,e.patchRoutesOnNavigation!=null,s.branches,[v.route.id,S],h),ae=BD(m,S.data),se=new Map(w.fetchers);se.set(t,ae),M.filter(e=>e.key!==t).forEach(e=>{let t=e.key,n=se.get(t),r=BD(void 0,n?n.data:void 0);se.set(t,r),Fe(t),e.controller&&ee.set(t,e.controller)}),pe({fetchers:se});let ce=()=>M.forEach(e=>Fe(e.key));g.signal.addEventListener(`abort`,ce);let{loaderResults:le,fetcherResults:ue}=await De(j,M,E,C,u);if(g.signal.aborted)return;g.signal.removeEventListener(`abort`,ce),ne.delete(t),ee.delete(t),M.forEach(e=>ee.delete(e.key));let de=w.fetchers.has(t),fe=e=>{if(!de)return e;let n=new Map(e.fetchers);return n.set(t,HD(S.data)),{...e,fetchers:n}},he=yD(le);if(he)return w=fe(w),Te(E,he.result,!1,{preventScrollReset:p});if(he=yD(ue),he)return re.add(he.key),w=fe(w),Te(E,he.result,!1,{preventScrollReset:p});let ge=new Map(w.fetchers);de&&ge.set(t,HD(S.data));let{loaderData:_e,errors:ve}=pD(w,k,le,void 0,M,ue,ge);Re(A,ge),w.navigation.state===`loading`&&A>te?(Yw(T,`Expected pending action`),O&&O.abort(),me(w.navigation.location,{matches:k,loaderData:_e,errors:ve,fetchers:ge})):(pe({errors:ve,loaderData:mD(w.loaderData,_e,k,ve),fetchers:ge}),N=!1)}async function we(t,n,i,s,c,l,u,d,f){let p=w.fetchers.get(t);ke(t,BD(f,p?p.data:void 0),{flushSync:u});let m=new AbortController,h=lD(e.history,i,m.signal);if(l){let e=await Ye(s,new URL(h.url).pathname,h.signal,t);if(e.type===`aborted`)return;if(e.type===`error`){Ae(t,n,e.error,{flushSync:u});return}else if(e.matches)s=e.matches;else{Ae(t,n,vD(404,{pathname:i}),{flushSync:u});return}}let g=FD(s,i);ee.set(t,m);let _=F,v=await Ee(h,i,eD(a,o,h,i,s,g,r,c),c,t),y=v[g.route.id];if(!y){for(let e of s)if(v[e.route.id]){y=v[e.route.id];break}}if(ee.get(t)===m&&ee.delete(t),!h.signal.aborted){if(oe.has(t)){ke(t,HD(void 0));return}if(DD(y))if(te>_){ke(t,HD(void 0));return}else{re.add(t),await Te(h,y,!1,{preventScrollReset:d});return}if(ED(y)){Ae(t,n,y.error);return}ke(t,HD(y.data))}}async function Te(r,i,a,{submission:o,fetcherSubmission:s,preventScrollReset:l,replace:u}={}){a||(E?.resolve(),E=null),i.response.headers.has(`X-Remix-Revalidate`)&&(N=!0);let d=i.response.headers.get(`Location`);Yw(d,`Expected a Location header on the redirect Response`),d=cD(d,new URL(r.url),c,e.history);let f=$w(w.location,d,{_isRedirect:!0});if(n){let e=!1;if(i.response.headers.has(`X-Remix-Reload-Document`))e=!0;else if(RT(d)){let n=rT(t,d,!0);e=n.origin!==t.location.origin||IT(n.pathname,c)==null}if(e){u?t.location.replace(d):t.location.assign(d);return}}O=null;let p=u===!0||i.response.headers.has(`X-Remix-Replace`)?`REPLACE`:`PUSH`,{formMethod:m,formAction:h,formEncType:g}=w.navigation;!o&&!s&&m&&h&&g&&(o=LD(w.navigation));let _=o||s;wE.has(i.response.status)&&_&&ND(_.formMethod)?await _e(p,f,{submission:{..._,formAction:d},preventScrollReset:l||D,enableViewTransition:a?k:void 0}):await _e(p,f,{overrideNavigation:RD(f,[],p,o),fetcherSubmission:s,preventScrollReset:l||D,enableViewTransition:a?k:void 0})}async function Ee(e,t,n,r,i){let a,o={};try{a=await tD(l,e,t,n,i,r,!1)}catch(e){return n.filter(e=>e.shouldLoad).forEach(t=>{o[t.route.id]={type:`error`,error:e}}),o}if(e.signal.aborted)return o;if(!ND(e.method))for(let e of n){if(a[e.route.id]?.type===`error`)break;!a.hasOwnProperty(e.route.id)&&!w.loaderData.hasOwnProperty(e.route.id)&&(!w.errors||!w.errors.hasOwnProperty(e.route.id))&&e.shouldCallHandler()&&(a[e.route.id]={type:`error`,result:Error(`No result returned from dataStrategy for route ${e.route.id}`)})}for(let[t,r]of Object.entries(a))if(TD(r)){let i=r.result;o[t]={type:`redirect`,response:aD(i,e,t,n,c)}}else o[t]=await iD(r);return o}async function De(e,t,n,r,i){let a=Ee(n,r,e,i,null),o=Promise.all(t.map(async e=>{if(e.matches&&e.match&&e.request&&e.controller){let t=(await Ee(e.request,e.path,e.matches,i,e.key))[e.match.route.id];return{[e.key]:t}}else return Promise.resolve({[e.key]:{type:`error`,error:vD(404,{pathname:e.path})}})}));return{loaderResults:await a,fetcherResults:(await o).reduce((e,t)=>Object.assign(e,t),{})}}function Oe(){N=!0,ie.forEach((e,t)=>{ee.has(t)&&P.add(t),Fe(t)})}function ke(e,t,n={}){let r=new Map(w.fetchers);r.set(e,t),pe({fetchers:r},{flushSync:(n&&n.flushSync)===!0})}function Ae(e,t,n,r={}){let i=gD(w.matches,t),a=new Map(w.fetchers);Ne(a,e),pe({errors:{[i.route.id]:n},fetchers:a},{flushSync:(r&&r.flushSync)===!0})}function je(e){return ae.set(e,(ae.get(e)||0)+1),oe.has(e)&&oe.delete(e),w.fetchers.get(e)||EE}function Me(e,t){Fe(e,t?.reason),ke(e,HD(null))}function Ne(e,t){let n=w.fetchers.get(t);ee.has(t)&&!(n&&n.state===`loading`&&ne.has(t))&&Fe(t),ie.delete(t),ne.delete(t),re.delete(t),oe.delete(t),P.delete(t),e.delete(t)}function Pe(e){let t=(ae.get(e)||0)-1;t<=0?(ae.delete(e),oe.add(e)):ae.set(e,t),pe({fetchers:new Map(w.fetchers)})}function Fe(e,t){let n=ee.get(e);n&&(n.abort(t),ee.delete(e))}function Ie(e,t){for(let n of e){let e=t.get(n);Yw(e,`Expected fetcher: ${n}`);let r=HD(e.data);t.set(n,r)}}function Le(e){let t=[],n=!1;for(let r of re){let i=e.get(r);Yw(i,`Expected fetcher: ${r}`),i.state===`loading`&&(re.delete(r),t.push(r),n=!0)}return Ie(t,e),n}function Re(e,t){let n=[];for(let[r,i]of ne)if(i<e){let e=t.get(r);Yw(e,`Expected fetcher: ${r}`),e.state===`loading`&&(Fe(r),ne.delete(r),n.push(r))}return Ie(n,t),n.length>0}function ze(e,t){let n=w.blockers.get(e)||DE;return se.get(e)!==t&&se.set(e,t),n}function Be(e){w.blockers.delete(e),se.delete(e)}function Ve(e,t){let n=w.blockers.get(e)||DE;Yw(n.state===`unblocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`blocked`||n.state===`blocked`&&t.state===`proceeding`||n.state===`blocked`&&t.state===`unblocked`||n.state===`proceeding`&&t.state===`unblocked`,`Invalid blocker state transition: ${n.state} -> ${t.state}`);let r=new Map(w.blockers);r.set(e,t),pe({blockers:r})}function He({currentLocation:e,nextLocation:t,historyAction:n}){if(se.size===0)return;se.size>1&&Xw(!1,`A router only supports one blocker at a time`);let r=Array.from(se.entries()),[i,a]=r[r.length-1],o=w.blockers.get(i);if(!(o&&o.state===`proceeding`)&&a({currentLocation:e,nextLocation:t,historyAction:n}))return i}function Ue(e){let t=vD(404,{pathname:e}),n=s.activeRoutes,{matches:r,route:i}=_D(n);return{notFoundMatches:r,route:i,error:t}}function We(e,t,n){if(m=e,g=t,h=n||null,!_&&w.navigation===TE){_=!0;let e=qe(w.location,w.matches);e!=null&&pe({restoreScrollPosition:e})}return()=>{m=null,g=null,h=null}}function Ge(e,t){return h&&h(e,t.map(e=>hT(e,w.loaderData)))||e.key}function Ke(e,t){if(m&&g){let n=Ge(e,t);m[n]=g()}}function qe(e,t){if(m){let n=Ge(e,t),r=m[n];if(typeof r==`number`)return r}return null}function Je(t,n,r){if(e.patchRoutesOnNavigation){let e=s.branches;if(!t)return{active:!0,matches:mT(n,r,c,!0,e)||[]};if(Object.keys(t[0].params).length>0)return{active:!0,matches:mT(n,r,c,!0,e)}}return{active:!1,matches:null}}async function Ye(t,n,r,i){if(!e.patchRoutesOnNavigation)return{type:`success`,matches:t};let l=t;for(;;){let t=o;try{await e.patchRoutesOnNavigation({signal:r,path:n,matches:l,fetcherKey:i,patch:(e,n)=>{r.aborted||VE(e,n,s,t,a,!1)}})}catch(e){return{type:`error`,error:e,partialMatches:l}}if(r.aborted)return{type:`aborted`};let u=s.branches,d=mT(s.activeRoutes,n,c,!1,u),f=null;if(d&&(Object.keys(d[0].params).length===0||(f=mT(s.activeRoutes,n,c,!0,u),!(f&&l.length<f.length&&Xe(l,f.slice(0,l.length))))))return{type:`success`,matches:d};if(f||=mT(s.activeRoutes,n,c,!0,u),!f||Xe(l,f))return{type:`success`,matches:null};l=f}}function Xe(e,t){return e.length===t.length&&e.every((e,n)=>e.route.id===t[n].route.id)}function Ze(e){o={},s.setHmrRoutes(dT(e,a,void 0,o))}function Qe(e,t,n=!1){VE(e,t,s,o,a,n),s.hasHMRRoutes||pe({})}return C={get basename(){return c},get future(){return u},get state(){return w},get routes(){return s.stableRoutes},get branches(){return s.branches},get manifest(){return o},get window(){return t},initialize:ue,subscribe:fe,enableScrollRestoration:We,navigate:he,fetch:Se,revalidate:ge,createHref:t=>e.history.createHref(t),encodeLocation:t=>e.history.encodeLocation(t),getFetcher:je,resetFetcher:Me,deleteFetcher:Pe,dispose:de,getBlocker:ze,deleteBlocker:Be,patchRoutes:Qe,_internalFetchControllers:ee,_internalSetRoutes:Ze,_internalSetStateDoNotUseOrYouWillBreakYourApp(e){pe(e)}},e.instrumentations&&(C=sE(C,e.instrumentations.map(e=>e.router).filter(Boolean))),C}function ME(e){return e!=null&&(`formData`in e&&e.formData!=null||`body`in e&&e.body!==void 0)}function NE(e,t,n,r,i,a){let o,s;if(i){o=[];for(let e of t)if(o.push(e),e.route.id===i){s=e;break}}else o=t,s=t[t.length-1];let c=WT(r||`.`,UT(o),IT(e.pathname,n)||e.pathname,a===`path`);if(r??(c.search=e.search,c.hash=e.hash),(r==null||r===``||r===`.`)&&s){let e=PD(c.search);if(s.route.index&&!e)c.search=c.search?c.search.replace(/^\?/,`?index&`):`?index`;else if(!s.route.index&&e){let e=new URLSearchParams(c.search),t=e.getAll(`index`);e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();c.search=n?`?${n}`:``}}return n!==`/`&&(c.pathname=LT({basename:n,pathname:c.pathname})),eT(c)}function PE(e,t,n){if(!n||!ME(n))return{path:t};if(n.formMethod&&!MD(n.formMethod))return{path:t,error:vD(405,{method:n.formMethod})};let r=()=>({path:t,error:vD(400,{type:`invalid-body`})}),i=(n.formMethod||`get`).toUpperCase(),a=bD(t);if(n.body!==void 0){if(n.formEncType===`text/plain`){if(!ND(i))return r();let e=typeof n.body==`string`?n.body:n.body instanceof FormData||n.body instanceof URLSearchParams?Array.from(n.body.entries()).reduce((e,[t,n])=>`${e}${t}=${n}\n`,``):String(n.body);return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:void 0,text:e}}}else if(n.formEncType===`application/json`){if(!ND(i))return r();try{let e=typeof n.body==`string`?JSON.parse(n.body):n.body;return{path:t,submission:{formMethod:i,formAction:a,formEncType:n.formEncType,formData:void 0,json:e,text:void 0}}}catch{return r()}}}Yw(typeof FormData==`function`,`FormData is not available in this environment`);let o,s;if(n.formData)o=uD(n.formData),s=n.formData;else if(n.body instanceof FormData)o=uD(n.body),s=n.body;else if(n.body instanceof URLSearchParams)o=n.body,s=dD(o);else if(n.body==null)o=new URLSearchParams,s=new FormData;else try{o=new URLSearchParams(n.body),s=dD(o)}catch{return r()}let c={formMethod:i,formAction:a,formEncType:n&&n.formEncType||`application/x-www-form-urlencoded`,formData:s,json:void 0,text:void 0};if(ND(c.formMethod))return{path:t,submission:c};let l=tT(t);return e&&l.search&&PD(l.search)&&o.append(`index`,``),l.search=`?${o}`,{path:eT(l),submission:c}}function FE(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x){let S=b?ED(b[1])?b[1].error:b[1].data:void 0,C=i.createURL(a.location),w=i.createURL(c),T;if(u&&a.errors){let e=Object.keys(a.errors)[0];T=o.findIndex(t=>t.route.id===e)}else if(b&&ED(b[1])){let e=b[0];T=o.findIndex(t=>t.route.id===e)-1}let E=b?b[1].statusCode:void 0,D=E&&E>=400,O={currentUrl:C,currentParams:a.matches[0]?.params||{},nextUrl:w,nextParams:o[0].params,...s,actionResult:S,actionStatus:E},k=eE(o),A=o.map((i,o)=>{let{route:s}=i,f=null;if(T!=null&&o>T)f=!1;else if(s.lazy)f=!0;else if(!IE(s))f=!1;else if(u){let{shouldLoad:e}=LE(s,a.loaderData,a.errors);f=e}else RE(a.loaderData,a.matches[o],i)&&(f=!0);if(f!==null)return $E(n,r,e,c,k,i,l,t,f);let p=!1;typeof x==`boolean`?p=x:D?p=!1:d||C.pathname+C.search===w.pathname+w.search?p=!0:C.search===w.search?zE(a.matches[o],i)&&(p=!0):p=!0;let m={...O,defaultShouldRevalidate:p};return $E(n,r,e,c,k,i,l,t,BE(i,m),m,x)}),j=[];return m.forEach((e,s)=>{if(u||!o.some(t=>t.route.id===e.routeId)||p.has(s))return;let c=a.fetchers.get(s),m=c&&c.state!==`idle`&&c.data===void 0,b=mT(g,e.path,_??`/`,!1,y);if(!b){if(v&&m)return;j.push({key:s,routeId:e.routeId,path:e.path,matches:null,match:null,request:null,controller:null});return}if(h.has(s))return;let S=FD(b,e.path),C=new AbortController,w=lD(i,e.path,C.signal),T=null;if(f.has(s))f.delete(s),T=eD(n,r,w,e.path,b,S,l,t);else if(m)d&&(T=eD(n,r,w,e.path,b,S,l,t));else{let i;i=typeof x==`boolean`?x:D?!1:d;let a={...O,defaultShouldRevalidate:i};BE(S,a)&&(T=eD(n,r,w,e.path,b,S,l,t,a))}T&&j.push({key:s,routeId:e.routeId,path:e.path,matches:T,match:S,request:w,controller:C})}),{dsMatches:A,revalidatingFetchers:j}}function IE(e){return e.loader!=null||e.middleware!=null&&e.middleware.length>0}function LE(e,t,n){if(e.lazy)return{shouldLoad:!0,renderFallback:!0};if(!IE(e))return{shouldLoad:!1,renderFallback:!1};let r=t!=null&&e.id in t,i=n!=null&&n[e.id]!==void 0;if(!r&&i)return{shouldLoad:!1,renderFallback:!1};if(typeof e.loader==`function`&&e.loader.hydrate===!0)return{shouldLoad:!0,renderFallback:!r};let a=!r&&!i;return{shouldLoad:a,renderFallback:a}}function RE(e,t,n){let r=!t||n.route.id!==t.route.id,i=!e.hasOwnProperty(n.route.id);return r||i}function zE(e,t){let n=e.route.path;return e.pathname!==t.pathname||n!=null&&n.endsWith(`*`)&&e.params[`*`]!==t.params[`*`]}function BE(e,t){if(e.route.shouldRevalidate){let n=e.route.shouldRevalidate(t);if(typeof n==`boolean`)return n}return t.defaultShouldRevalidate}function VE(e,t,n,r,i,a){let o;if(e){let t=r[e];Yw(t,`No route found to patch children into: routeId = ${e}`),t.children||=[],o=t.children}else o=n.activeRoutes;let s=[],c=[];if(t.forEach(e=>{let t=o.find(t=>HE(e,t));t?c.push({existingRoute:t,newRoute:e}):s.push(e)}),s.length>0){let t=dT(s,i,[e||`_`,`patch`,String(o?.length||`0`)],r);o.push(...t)}if(a&&c.length>0)for(let e=0;e<c.length;e++){let{existingRoute:t,newRoute:n}=c[e],r=t,[a]=dT([n],i,[],{},!0);Object.assign(r,{element:a.element?a.element:r.element,errorElement:a.errorElement?a.errorElement:r.errorElement,hydrateFallbackElement:a.hydrateFallbackElement?a.hydrateFallbackElement:r.hydrateFallbackElement})}n.hasHMRRoutes||n.setRoutes([...n.activeRoutes])}function HE(e,t){return`id`in e&&`id`in t&&e.id===t.id?!0:e.index===t.index&&e.path===t.path&&e.caseSensitive===t.caseSensitive?(!e.children||e.children.length===0)&&(!t.children||t.children.length===0)?!0:e.children?.every((e,n)=>t.children?.some(t=>HE(e,t)))??!1:!1}var UE=new WeakMap,WE=({key:e,route:t,manifest:n,mapRouteProperties:r})=>{let i=n[t.id];if(Yw(i,`No route found in manifest`),!i.lazy||typeof i.lazy!=`object`)return;let a=i.lazy[e];if(!a)return;let o=UE.get(i);o||(o={},UE.set(i,o));let s=o[e];if(s)return s;let c=(async()=>{let t=oT(e),n=i[e]!==void 0;if(t)Xw(!t,`Route property `+e+` is not a supported lazy route property. This property will be ignored.`),o[e]=Promise.resolve();else if(n)Xw(!1,`Route "${i.id}" has a static property "${e}" defined. The lazy property will be ignored.`);else{let t=await a();t!=null&&(Object.assign(i,{[e]:t}),Object.assign(i,r(i)))}typeof i.lazy==`object`&&(i.lazy[e]=void 0,Object.values(i.lazy).every(e=>e===void 0)&&(i.lazy=void 0))})();return o[e]=c,c},GE=new WeakMap;function KE(e,t,n,r,i){let a=n[e.id];if(Yw(a,`No route found in manifest`),!e.lazy)return{lazyRoutePromise:void 0,lazyHandlerPromise:void 0};if(typeof e.lazy==`function`){let t=GE.get(a);if(t)return{lazyRoutePromise:t,lazyHandlerPromise:t};let n=(async()=>{Yw(typeof e.lazy==`function`,`No lazy route function found`);let t=await e.lazy(),n={};for(let e in t){let r=t[e];if(r===void 0)continue;let i=cT(e),o=a[e]!==void 0;i?Xw(!i,`Route property `+e+` is not a supported property to be returned from a lazy route function. This property will be ignored.`):o?Xw(!o,`Route "${a.id}" has a static property "${e}" defined but its lazy function is also returning a value for this property. The lazy route property "${e}" will be ignored.`):n[e]=r}Object.assign(a,n),Object.assign(a,{...r(a),lazy:void 0})})();return GE.set(a,n),n.catch(()=>{}),{lazyRoutePromise:n,lazyHandlerPromise:n}}let o=Object.keys(e.lazy),s=[],c;for(let a of o){if(i&&i.includes(a))continue;let o=WE({key:a,route:e,manifest:n,mapRouteProperties:r});o&&(s.push(o),a===t&&(c=o))}let l=s.length>0?Promise.all(s).then(()=>{}):void 0;return l?.catch(()=>{}),c?.catch(()=>{}),{lazyRoutePromise:l,lazyHandlerPromise:c}}async function qE(e){let t=e.matches.filter(e=>e.shouldLoad),n={};return(await Promise.all(t.map(e=>e.resolve()))).forEach((e,r)=>{n[t[r].route.id]=e}),n}async function JE(e){return e.matches.some(e=>e.route.middleware)?YE(e,()=>qE(e)):qE(e)}function YE(e,t){return XE(e,t,e=>{if(jD(e))throw e;return e},CD,n);async function n(t,n,r){if(r)return Object.assign(r.value,{[n]:{type:`error`,result:t}});{let{matches:r}=e,i=Math.min(Math.max(r.findIndex(e=>e.route.id===n),0),Math.max(r.findIndex(e=>e.shouldCallHandler()),0)),a=r[i].route.id;for(let e of r.slice(0,i+1))try{await e._lazyPromises?.route}catch{a=e.route.id;break}return{[gD(r,a).route.id]:{type:`error`,result:t}}}}}async function XE(e,t,n,r,i){let{matches:a,...o}=e;return await ZE(o,a.flatMap(e=>e.route.middleware?e.route.middleware.map(t=>[e.route.id,t]):[]),t,n,r,i)}async function ZE(e,t,n,r,i,a,o=0){let{request:s}=e;if(s.signal.aborted)throw s.signal.reason??Error(`Request aborted: ${s.method} ${s.url}`);let c=t[o];if(!c)return await n();let[l,u]=c,d,f=async()=>{if(d)throw Error("You may only call `next()` once per middleware");try{return d={value:await ZE(e,t,n,r,i,a,o+1)},d.value}catch(e){return d={value:await a(e,l,d)},d.value}};try{let t=await u(e,f),n=t==null?void 0:r(t);return i(n)?n:d?n??d.value:(d={value:await f()},d.value)}catch(e){return await a(e,l,d)}}function QE(e,t,n,r,i){let a=WE({key:`middleware`,route:r.route,manifest:t,mapRouteProperties:e}),o=KE(r.route,ND(n.method)?`action`:`loader`,t,e,i);return{middleware:a,route:o.lazyRoutePromise,handler:o.lazyHandlerPromise}}function $E(e,t,n,r,i,a,o,s,c,l=null,u){let d=!1,f=QE(e,t,n,a,o);return{...a,_lazyPromises:f,shouldLoad:c,shouldRevalidateArgs:l,shouldCallHandler(e){return d=!0,l?typeof u==`boolean`?BE(a,{...l,defaultShouldRevalidate:u}):typeof e==`boolean`?BE(a,{...l,defaultShouldRevalidate:e}):BE(a,l):c},resolve(e){let{lazy:t,loader:o,middleware:l}=a.route,u=d||c||e&&!ND(n.method)&&(t||o),p=l&&l.length>0&&!o&&!t;return u&&(ND(n.method)||!p)?nD({request:n,path:r,pattern:i,match:a,lazyHandlerPromise:f?.handler,lazyRoutePromise:f?.route,handlerOverride:e,scopedContext:s}):Promise.resolve({type:`data`,result:void 0})}}}function eD(e,t,n,r,i,a,o,s,c=null){return i.map(l=>l.route.id===a.route.id?$E(e,t,n,r,eE(i),l,o,s,!0,c):{...l,shouldLoad:!1,shouldRevalidateArgs:c,shouldCallHandler:()=>!1,_lazyPromises:QE(e,t,n,l,o),resolve:()=>Promise.resolve({type:`data`,result:void 0})})}async function tD(e,t,n,r,i,a,o){r.some(e=>e._lazyPromises?.middleware)&&await Promise.all(r.map(e=>e._lazyPromises?.middleware));let s={request:t,url:tE(t,n),pattern:eE(r),params:r[0].params,context:a,matches:r},c=o?()=>{throw Error("You cannot call `runClientMiddleware()` from a static handler `dataStrategy`. Middleware is run outside of `dataStrategy` during SSR in order to bubble up the Response. You can enable middleware via the `respond` API in `query`/`queryRoute`")}:e=>{let t=s;return YE(t,()=>e({...t,fetcherKey:i,runClientMiddleware:()=>{throw Error("Cannot call `runClientMiddleware()` from within an `runClientMiddleware` handler")}}))},l=await e({...s,fetcherKey:i,runClientMiddleware:c});try{await Promise.all(r.flatMap(e=>[e._lazyPromises?.handler,e._lazyPromises?.route]))}catch{}return l}async function nD({request:e,path:t,pattern:n,match:r,lazyHandlerPromise:i,lazyRoutePromise:a,handlerOverride:o,scopedContext:s}){let c,l,u=ND(e.method),d=u?`action`:`loader`,f=i=>{let a,c=new Promise((e,t)=>a=t);l=()=>a(),e.signal.addEventListener(`abort`,l);let u=a=>typeof i==`function`?i({request:e,url:tE(e,t),pattern:n,params:r.params,context:s},...a===void 0?[]:[a]):Promise.reject(Error(`You cannot call the handler for a route which defines a boolean "${d}" [routeId: ${r.route.id}]`)),f=(async()=>{try{return{type:`data`,result:await(o?o(e=>u(e)):u())}}catch(e){return{type:`error`,result:e}}})();return Promise.race([f,c])};try{let t=u?r.route.action:r.route.loader;if(i||a)if(t){let e,[n]=await Promise.all([f(t).catch(t=>{e=t}),i,a]);if(e!==void 0)throw e;c=n}else{await i;let t=u?r.route.action:r.route.loader;if(t)[c]=await Promise.all([f(t),a]);else if(d===`action`){let t=new URL(e.url),n=t.pathname+t.search;throw vD(405,{method:e.method,pathname:n,routeId:r.route.id})}else return{type:`data`,result:void 0}}else if(t)c=await f(t);else{let t=new URL(e.url);throw vD(404,{pathname:t.pathname+t.search})}}catch(e){return{type:`error`,result:e}}finally{l&&e.signal.removeEventListener(`abort`,l)}return c}async function rD(e){let t=e.headers.get(`Content-Type`);return t&&/\bapplication\/json\b/.test(t)?e.body==null?null:e.json():e.text()}async function iD(e){let{result:t,type:n}=e;if(kD(t)){let e;try{e=await rD(t)}catch(e){return{type:`error`,error:e}}return n===`error`?{type:`error`,error:new QT(t.status,t.statusText,e),statusCode:t.status,headers:t.headers}:{type:`data`,data:e,statusCode:t.status,headers:t.headers}}return n===`error`?OD(t)?t.data instanceof Error?{type:`error`,error:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:SD(t),statusCode:$T(t)?t.status:void 0,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`error`,error:t,statusCode:$T(t)?t.status:void 0}:OD(t)?{type:`data`,data:t.data,statusCode:t.init?.status,headers:t.init?.headers?new Headers(t.init.headers):void 0}:{type:`data`,data:t}}function aD(e,t,n,r,i){let a=e.headers.get(`Location`);if(Yw(a,`Redirects returned/thrown from loaders/actions must have a Location header`),!RT(a)){let o=r.slice(0,r.findIndex(e=>e.route.id===n)+1);a=NE(new URL(t.url),o,i,a),e.headers.set(`Location`,a)}return e}var oD=[`about:`,`blob:`,`chrome:`,`chrome-untrusted:`,`content:`,`data:`,`devtools:`,`file:`,`filesystem:`,`javascript:`];function sD(e){try{return oD.includes(new URL(e).protocol)}catch{return!1}}function cD(e,t,n,r){if(RT(e)){let r=e,i=Ww.test(r)?new URL(Gw(r,t.protocol)):new URL(r);if(sD(i.toString()))throw Error(`Invalid redirect location`);let a=IT(i.pathname,n)!=null;if(i.origin===t.origin&&a)return GT(i.pathname)+i.search+i.hash}try{if(sD(r.createURL(e).toString()))throw Error(`Invalid redirect location`)}catch{}return e}function lD(e,t,n,r){let i=e.createURL(bD(t)).toString(),a={signal:n};if(r&&ND(r.formMethod)){let{formMethod:e,formEncType:t}=r;a.method=e.toUpperCase(),t===`application/json`?(a.headers=new Headers({"Content-Type":t}),a.body=JSON.stringify(r.json)):t===`text/plain`?a.body=r.text:t===`application/x-www-form-urlencoded`&&r.formData?a.body=uD(r.formData):a.body=r.formData}return new Request(i,a)}function uD(e){let t=new URLSearchParams;for(let[n,r]of e.entries())t.append(n,typeof r==`string`?r:r.name);return t}function dD(e){let t=new FormData;for(let[n,r]of e.entries())t.append(n,r);return t}function fD(e,t,n,r=!1,i=!1){let a={},o=null,s,c=!1,l={},u=n&&ED(n[1])?n[1].error:void 0;return e.forEach(n=>{if(!(n.route.id in t))return;let d=n.route.id,f=t[d];if(Yw(!DD(f),`Cannot handle redirect results in processLoaderData`),ED(f)){let t=f.error;if(u!==void 0&&(t=u,u=void 0),o||={},i)o[d]=t;else{let n=gD(e,d);o[n.route.id]??(o[n.route.id]=t)}r||(a[d]=kE),c||(c=!0,s=$T(f.error)?f.error.status:500),f.headers&&(l[d]=f.headers)}else a[d]=f.data,f.statusCode&&f.statusCode!==200&&!c&&(s=f.statusCode),f.headers&&(l[d]=f.headers)}),u!==void 0&&n&&(o={[n[0]]:u},n[2]&&(a[n[2]]=void 0)),{loaderData:a,errors:o,statusCode:s||200,loaderHeaders:l}}function pD(e,t,n,r,i,a,o){let{loaderData:s,errors:c}=fD(t,n,r);return i.filter(e=>!e.matches||e.matches.some(e=>e.shouldLoad)).forEach(t=>{let{key:n,match:r,controller:i}=t;if(i&&i.signal.aborted)return;let s=a[n];if(Yw(s,`Did not find corresponding fetcher result`),ED(s)){let t=gD(e.matches,r?.route.id);c&&c[t.route.id]||(c={...c,[t.route.id]:s.error}),o.delete(n)}else if(DD(s))Yw(!1,`Unhandled fetcher revalidation redirect`);else{let e=HD(s.data);o.set(n,e)}}),{loaderData:s,errors:c}}function mD(e,t,n,r){let i=Object.entries(t).filter(([,e])=>e!==kE).reduce((e,[t,n])=>(e[t]=n,e),{});for(let a of n){let n=a.route.id;if(!t.hasOwnProperty(n)&&e.hasOwnProperty(n)&&a.route.loader&&(i[n]=e[n]),r&&r.hasOwnProperty(n))break}return i}function hD(e){return e?ED(e[1])?{actionData:{}}:{actionData:{[e[0]]:e[1].data}}:{}}function gD(e,t){return(t?e.slice(0,e.findIndex(e=>e.route.id===t)+1):[...e]).reverse().find(e=>e.route.ErrorBoundary!=null||e.route.errorElement!=null)||e[0]}function _D(e){let t=e.length===1?e[0]:e.find(e=>e.index||!e.path||e.path===`/`)||{id:`__shim-error-route__`};return{matches:[{params:{},pathname:``,pathnameBase:``,route:t}],route:t}}function vD(e,{pathname:t,routeId:n,method:r,type:i,message:a}={}){let o=`Unknown Server Error`,s=`Unknown @remix-run/router error`;return e===400?(o=`Bad Request`,r&&t&&n?s=`You made a ${r} request to "${t}" but did not provide a \`loader\` for route "${n}", so there is no way to handle the request.`:i===`invalid-body`&&(s=`Unable to encode submission body`)):e===403?(o=`Forbidden`,s=`Route "${n}" does not match URL "${t}"`):e===404?(o=`Not Found`,s=`No route matches URL "${t}"`):e===405&&(o=`Method Not Allowed`,r&&t&&n?s=`You made a ${r.toUpperCase()} request to "${t}" but did not provide an \`action\` for route "${n}", so there is no way to handle the request.`:r&&(s=`Invalid request method "${r.toUpperCase()}"`)),new QT(e||500,o,Error(s),!0)}function yD(e){let t=Object.entries(e);for(let e=t.length-1;e>=0;e--){let[n,r]=t[e];if(DD(r))return{key:n,result:r}}}function bD(e){return eT({...typeof e==`string`?tT(e):e,hash:``})}function xD(e,t){return e.pathname!==t.pathname||e.search!==t.search?!1:e.hash===``?t.hash!==``:e.hash===t.hash?!0:t.hash!==``}function SD(e){return new QT(e.init?.status??500,e.init?.statusText??`Internal Server Error`,e.data)}function CD(e){return typeof e==`object`&&!!e&&Object.entries(e).every(([e,t])=>typeof e==`string`&&wD(t))}function wD(e){return typeof e==`object`&&!!e&&`type`in e&&`result`in e&&(e.type===`data`||e.type===`error`)}function TD(e){return kD(e.result)&&CE.has(e.result.status)}function ED(e){return e.type===`error`}function DD(e){return(e&&e.type)===`redirect`}function OD(e){return typeof e==`object`&&!!e&&`type`in e&&`data`in e&&`init`in e&&e.type===`DataWithResponseInit`}function kD(e){return e!=null&&typeof e.status==`number`&&typeof e.statusText==`string`&&typeof e.headers==`object`&&e.body!==void 0}function AD(e){return CE.has(e)}function jD(e){return kD(e)&&AD(e.status)&&e.headers.has(`Location`)}function MD(e){return SE.has(e.toUpperCase())}function ND(e){return bE.has(e.toUpperCase())}function PD(e){return new URLSearchParams(e).getAll(`index`).some(e=>e===``)}function FD(e,t){let n=typeof t==`string`?tT(t).search:t.search;if(e[e.length-1].route.index&&PD(n||``))return e[e.length-1];let r=HT(e);return r[r.length-1]}function ID(e,t,n){return{url:tE(e.createURL(t),t),pattern:n?eE(n):``,params:n?.[0]?.params?{...n[0].params}:{}}}function LD(e){let{formMethod:t,formAction:n,formEncType:r,text:i,formData:a,json:o}=e;if(!(!t||!n||!r)){if(i!=null)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:void 0,text:i};if(a!=null)return{formMethod:t,formAction:n,formEncType:r,formData:a,json:void 0,text:void 0};if(o!==void 0)return{formMethod:t,formAction:n,formEncType:r,formData:void 0,json:o,text:void 0}}}function RD(e,t,n,r){return r?{state:`loading`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}:{state:`loading`,location:e,matches:t,historyAction:n,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0}}function zD(e,t,n,r){return{state:`submitting`,location:e,matches:t,historyAction:n,formMethod:r.formMethod,formAction:r.formAction,formEncType:r.formEncType,formData:r.formData,json:r.json,text:r.text}}function BD(e,t){return e?{state:`loading`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t}:{state:`loading`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:t}}function VD(e,t){return{state:`submitting`,formMethod:e.formMethod,formAction:e.formAction,formEncType:e.formEncType,formData:e.formData,json:e.json,text:e.text,data:t?t.data:void 0}}function HD(e){return{state:`idle`,formMethod:void 0,formAction:void 0,formEncType:void 0,formData:void 0,json:void 0,text:void 0,data:e}}function UD(e,t){try{let n=e.sessionStorage.getItem(OE);if(n){let e=JSON.parse(n);for(let[n,r]of Object.entries(e||{}))r&&Array.isArray(r)&&t.set(n,new Set(r||[]))}}catch{}}function WD(e,t){if(t.size>0){let n={};for(let[e,r]of t)n[e]=[...r];try{e.sessionStorage.setItem(OE,JSON.stringify(n))}catch(e){Xw(!1,`Failed to save applied view transitions in sessionStorage (${e}).`)}}}function GD(){let e,t,n=new Promise((r,i)=>{e=async e=>{r(e);try{await n}catch{}},t=async e=>{i(e);try{await n}catch{}}});return{promise:n,resolve:e,reject:t}}var KD=B.createContext(null);KD.displayName=`DataRouter`;var qD=B.createContext(null);qD.displayName=`DataRouterState`;var JD=B.createContext(!1);function YD(){return B.useContext(JD)}var XD=B.createContext({isTransitioning:!1});XD.displayName=`ViewTransition`;var ZD=B.createContext(new Map);ZD.displayName=`Fetchers`;var QD=B.createContext(null);QD.displayName=`Await`;var $D=B.createContext(null);$D.displayName=`Navigation`;var eO=B.createContext(null);eO.displayName=`Location`;var tO=B.createContext({outlet:null,matches:[],isDataRoute:!1});tO.displayName=`Route`;var nO=B.createContext(null);nO.displayName=`RouteError`;var rO=`REACT_ROUTER_ERROR`,iO=`REDIRECT`,aO=`ROUTE_ERROR_RESPONSE`;function oO(e){if(e.startsWith(`${rO}:${iO}:{`))try{let t=JSON.parse(e.slice(28));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`&&typeof t.location==`string`&&typeof t.reloadDocument==`boolean`&&typeof t.replace==`boolean`)return t}catch{}}function sO(e){if(e.startsWith(`${rO}:${aO}:{`))try{let t=JSON.parse(e.slice(40));if(typeof t==`object`&&t&&typeof t.status==`number`&&typeof t.statusText==`string`)return new QT(t.status,t.statusText,t.data)}catch{}}function cO(e,{relative:t}={}){Yw(lO(),`useHref() may be used only in the context of a <Router> component.`);let{basename:n,navigator:r}=B.useContext($D),{hash:i,pathname:a,search:o}=_O(e,{relative:t}),s=a;return n!==`/`&&(s=a===`/`?n:KT([n,a])),r.createHref({pathname:s,search:o,hash:i})}function lO(){return B.useContext(eO)!=null}function uO(){return Yw(lO(),`useLocation() may be used only in the context of a <Router> component.`),B.useContext(eO).location}var dO=`You should call navigate() in a React.useEffect(), not when your component is first rendered.`;function fO(){let{isDataRoute:e}=B.useContext(tO);return e?wee():pO()}function pO(){Yw(lO(),`useNavigate() may be used only in the context of a <Router> component.`);let e=B.useContext(KD),{basename:t,navigator:n}=B.useContext($D),{matches:r}=B.useContext(tO),{pathname:i}=uO(),a=JSON.stringify(UT(r)),o=B.useRef(!1);return B.useLayoutEffect(()=>{o.current=!0}),B.useCallback((r,s={})=>{if(Xw(o.current,dO),!o.current)return;if(typeof r==`number`){n.go(r);return}let c=WT(r,JSON.parse(a),i,s.relative===`path`);e==null&&t!==`/`&&(c.pathname=c.pathname===`/`?t:KT([t,c.pathname])),(s.replace?n.replace:n.push)(c,s.state,s)},[t,n,a,i,e])}var mO=B.createContext(null);function hO(e){let t=B.useContext(tO).outlet;return B.useMemo(()=>t&&B.createElement(mO.Provider,{value:e},t),[t,e])}function gO(){let{matches:e}=B.useContext(tO);return e[e.length-1]?.params??{}}function _O(e,{relative:t}={}){let{matches:n}=B.useContext(tO),{pathname:r}=uO(),i=JSON.stringify(UT(n));return B.useMemo(()=>WT(e,JSON.parse(i),r,t===`path`),[e,i,r,t])}function vO(e,t,n){Yw(lO(),`useRoutes() may be used only in the context of a <Router> component.`);let{navigator:r}=B.useContext($D),{matches:i}=B.useContext(tO),a=i[i.length-1],o=a?a.params:{};a&&a.pathname;let s=a?a.pathnameBase:`/`;a&&a.route;let c=uO(),l;if(t){let e=typeof t==`string`?tT(t):t;Yw(s===`/`||e.pathname?.startsWith(s),`When overriding the location using \`<Routes location>\` or \`useRoutes(routes, location)\`, the location pathname must begin with the portion of the URL pathname that was matched by all parent routes. The current pathname base is "${s}" but pathname "${e.pathname}" was given in the \`location\` prop.`),l=e}else l=c;let u=l.pathname||`/`,d=u;if(s!==`/`){let e=s.replace(/^\//,``).split(`/`);d=`/`+u.replace(/^\//,``).split(`/`).slice(e.length).join(`/`)}let f=n&&n.state.matches.length?n.state.matches.map(e=>Object.assign(e,{route:n.manifest[e.route.id]||e.route})):pT(e,{pathname:d}),p=vee(f&&f.map(e=>Object.assign({},e,{params:Object.assign({},o,e.params),pathname:KT([s,r.encodeLocation?r.encodeLocation(e.pathname.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathname]),pathnameBase:e.pathnameBase===`/`?s:KT([s,r.encodeLocation?r.encodeLocation(e.pathnameBase.replace(/%/g,`%25`).replace(/\?/g,`%3F`).replace(/#/g,`%23`)).pathname:e.pathnameBase])})),i,n);return t&&p?B.createElement(eO.Provider,{value:{location:{pathname:`/`,search:``,hash:``,state:null,key:`default`,mask:void 0,...l},navigationType:`POP`}},p):p}function yO(){let e=Cee(),t=$T(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),n=e instanceof Error?e.stack:null;return B.createElement(B.Fragment,null,B.createElement(`h2`,null,`Unexpected Application Error!`),B.createElement(`h3`,{style:{fontStyle:`italic`}},t),n?B.createElement(`pre`,{style:{padding:`0.5rem`,backgroundColor:`rgba(200,200,200, 0.5)`}},n):null,null)}var mee=B.createElement(yO,null),hee=class extends B.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static contextType=JD;static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!==`idle`&&e.revalidation===`idle`?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error===void 0?t.error:e.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){this.props.onError?this.props.onError(e,t):console.error(`React Router caught the following error during render`,e)}render(){let e=this.state.error;if(this.context&&typeof e==`object`&&e&&`digest`in e&&typeof e.digest==`string`){let t=sO(e.digest);t&&(e=t)}let t=e===void 0?this.props.children:B.createElement(tO.Provider,{value:this.props.routeContext},B.createElement(nO.Provider,{value:e,children:this.props.component}));return this.context?B.createElement(gee,{error:e},t):t}},bO=new WeakMap;function gee({children:e,error:t}){let{basename:n}=B.useContext($D);if(typeof t==`object`&&t&&`digest`in t&&typeof t.digest==`string`){let e=oO(t.digest);if(e){let r=bO.get(t);if(r)throw r;let i=rE(e.location,n),a=i.absoluteURL||i.to;if(sD(a))throw Error(`Invalid redirect location`);if(nE&&!bO.get(t))if(i.isExternal||e.reloadDocument)window.location.href=a;else{let n=Promise.resolve().then(()=>window.__reactRouterDataRouter.navigate(i.to,{replace:e.replace}));throw bO.set(t,n),n}return B.createElement(`meta`,{httpEquiv:`refresh`,content:`0;url=${a}`})}}return e}function _ee({routeContext:e,match:t,children:n}){let r=B.useContext(KD);return r&&r.static&&r.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(r.staticContext._deepestRenderedBoundaryId=t.route.id),B.createElement(tO.Provider,{value:e},n)}function vee(e,t=[],n){let r=n?.state;if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let i=e,a=r?.errors;if(a!=null){let e=i.findIndex(e=>e.route.id&&a?.[e.route.id]!==void 0);Yw(e>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(a).join(`,`)}`),i=i.slice(0,Math.min(i.length,e+1))}let o=!1,s=-1;if(n&&r){o=r.renderFallback;for(let e=0;e<i.length;e++){let t=i[e];if((t.route.HydrateFallback||t.route.hydrateFallbackElement)&&(s=e),t.route.id){let{loaderData:e,errors:a}=r,c=t.route.loader&&!e.hasOwnProperty(t.route.id)&&(!a||a[t.route.id]===void 0);if(t.route.lazy||c){n.isStatic&&(o=!0),i=s>=0?i.slice(0,s+1):[i[0]];break}}}}let c=n?.onError,l=r&&c?(e,t)=>{c(e,{location:r.location,params:r.matches?.[0]?.params??{},pattern:eE(r.matches),errorInfo:t})}:void 0;return i.reduceRight((e,n,c)=>{let u,d=!1,f=null,p=null;r&&(u=a&&n.route.id?a[n.route.id]:void 0,f=n.route.errorElement||mee,o&&(s<0&&c===0?(Tee(`route-fallback`,!1,"No `HydrateFallback` element provided to render during initial hydration"),d=!0,p=null):s===c&&(d=!0,p=n.route.hydrateFallbackElement||null)));let m=t.concat(i.slice(0,c+1)),h=()=>{let t;return t=u?f:d?p:n.route.Component?B.createElement(n.route.Component,null):n.route.element?n.route.element:e,B.createElement(_ee,{match:n,routeContext:{outlet:e,matches:m,isDataRoute:r!=null},children:t})};return r&&(n.route.ErrorBoundary||n.route.errorElement||c===0)?B.createElement(hee,{location:r.location,revalidation:r.revalidation,component:f,error:u,children:h(),routeContext:{outlet:null,matches:m,isDataRoute:!0},onError:l}):h()},null)}function xO(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function yee(e){let t=B.useContext(KD);return Yw(t,xO(e)),t}function SO(e){let t=B.useContext(qD);return Yw(t,xO(e)),t}function bee(e){let t=B.useContext(tO);return Yw(t,xO(e)),t}function CO(e){let t=bee(e),n=t.matches[t.matches.length-1];return Yw(n.route.id,`${e} can only be used on routes that contain a unique "id"`),n.route.id}function xee(){return CO(`useRouteId`)}function See(){let e=SO(`useNavigation`);return B.useMemo(()=>{let{matches:t,historyAction:n,...r}=e.navigation;return r},[e.navigation])}function wO(){let{matches:e,loaderData:t}=SO(`useMatches`);return B.useMemo(()=>e.map(e=>hT(e,t)),[e,t])}function Cee(){let e=B.useContext(nO),t=SO(`useRouteError`),n=CO(`useRouteError`);return e===void 0?t.errors?.[n]:e}function wee(){let{router:e}=yee(`useNavigate`),t=CO(`useNavigate`),n=B.useRef(!1);return B.useLayoutEffect(()=>{n.current=!0}),B.useCallback(async(r,i={})=>{Xw(n.current,dO),n.current&&(typeof r==`number`?await e.navigate(r):await e.navigate(r,{fromRouteId:t,...i}))},[e,t])}var TO={};function Tee(e,t,n){!t&&!TO[e]&&(TO[e]=!0,Xw(!1,n))}var EO={};function DO(e,t){!e&&!EO[t]&&(EO[t]=!0,console.warn(t))}var Eee=[`HydrateFallback`,`hydrateFallbackElement`],Dee=class{status=`pending`;promise;resolve;reject;constructor(){this.promise=new Promise((e,t)=>{this.resolve=t=>{this.status===`pending`&&(this.status=`resolved`,e(t))},this.reject=e=>{this.status===`pending`&&(this.status=`rejected`,t(e))}})}};function Oee({router:e,flushSync:t,onError:n,useTransitions:r}){r=YD()||r;let[i,a]=B.useState(e.state),[o,s]=(0,B.useOptimistic)(i),[c,l]=B.useState(),[u,d]=B.useState({isTransitioning:!1}),[f,p]=B.useState(),[m,h]=B.useState(),[g,_]=B.useState(),v=B.useRef(new Map),y=B.useCallback((i,{deletedFetchers:o,newErrors:c,flushSync:u,viewTransitionOpts:g})=>{c&&n&&Object.values(c).forEach(e=>n(e,{location:i.location,params:i.matches[0]?.params??{},pattern:eE(i.matches)})),i.fetchers.forEach((e,t)=>{e.data!==void 0&&v.current.set(t,e.data)}),o.forEach(e=>v.current.delete(e)),DO(u===!1||t!=null,'You provided the `flushSync` option to a router update, but you are not using the `<RouterProvider>` from `react-router/dom` so `ReactDOM.flushSync()` is unavailable. Please update your app to `import { RouterProvider } from "react-router/dom"` and ensure you have `react-dom` installed as a dependency to use the `flushSync` option.');let y=e.window!=null&&e.window.document!=null&&typeof e.window.document.startViewTransition==`function`;if(DO(g==null||y,"You provided the `viewTransition` option to a router update, but you do not appear to be running in a DOM environment as `window.startViewTransition` is not available."),!g||!y){t&&u?t(()=>a(i)):r===!1?a(i):B.startTransition(()=>{r===!0&&s(e=>OO(e,i)),a(i)});return}if(t&&u){t(()=>{m&&(f?.resolve(),m.skipTransition()),d({isTransitioning:!0,flushSync:!0,currentLocation:g.currentLocation,nextLocation:g.nextLocation})});let n=e.window.document.startViewTransition(()=>{t(()=>a(i))});n.finished.finally(()=>{t(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})})}),t(()=>h(n));return}m?(f?.resolve(),m.skipTransition(),_({state:i,currentLocation:g.currentLocation,nextLocation:g.nextLocation})):(l(i),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}))},[e.window,t,m,f,r,s,n]);B.useLayoutEffect(()=>e.subscribe(y),[e,y]),B.useEffect(()=>{u.isTransitioning&&!u.flushSync&&p(new Dee)},[u]),B.useEffect(()=>{if(f&&c&&e.window){let t=c,n=f.promise,i=e.window.document.startViewTransition(async()=>{r===!1?a(t):B.startTransition(()=>{r===!0&&s(e=>OO(e,t)),a(t)}),await n});i.finished.finally(()=>{p(void 0),h(void 0),l(void 0),d({isTransitioning:!1})}),h(i)}},[c,f,e.window,r,s]),B.useEffect(()=>{f&&c&&o.location.key===c.location.key&&f.resolve()},[f,m,o.location,c]),B.useEffect(()=>{!u.isTransitioning&&g&&(l(g.state),d({isTransitioning:!0,flushSync:!1,currentLocation:g.currentLocation,nextLocation:g.nextLocation}),_(void 0))},[u.isTransitioning,g]);let b=B.useMemo(()=>({createHref:e.createHref,encodeLocation:e.encodeLocation,go:t=>e.navigate(t),push:(t,n,r)=>e.navigate(t,{state:n,preventScrollReset:r?.preventScrollReset}),replace:(t,n,r)=>e.navigate(t,{replace:!0,state:n,preventScrollReset:r?.preventScrollReset})}),[e]),x=e.basename||`/`,S=B.useMemo(()=>({router:e,navigator:b,static:!1,basename:x,onError:n}),[e,b,x,n]);return B.createElement(B.Fragment,null,B.createElement(KD.Provider,{value:S},B.createElement(qD.Provider,{value:o},B.createElement(ZD.Provider,{value:v.current},B.createElement(XD.Provider,{value:u},B.createElement(kO,{basename:x,location:o.location,navigationType:o.historyAction,navigator:b,useTransitions:r},B.createElement(kee,{routes:e.routes,manifest:e.manifest,future:e.future,state:o,isStatic:!1,onError:n})))))),null)}function OO(e,t){return{...e,navigation:t.navigation.state===`idle`?e.navigation:t.navigation,revalidation:t.revalidation===`idle`?e.revalidation:t.revalidation,actionData:t.navigation.state===`submitting`?e.actionData:t.actionData,fetchers:t.fetchers}}var kee=B.memo(Aee);function Aee({routes:e,manifest:t,future:n,state:r,isStatic:i,onError:a}){return vO(e,void 0,{manifest:t,state:r,isStatic:i,onError:a,future:n})}function jee(e){return hO(e.context)}function kO({basename:e=`/`,children:t=null,location:n,navigationType:r=`POP`,navigator:i,static:a=!1,useTransitions:o}){Yw(!lO(),`You cannot render a <Router> inside another <Router>. You should never have more than one in your app.`);let s=e.replace(/^\/*/,`/`),c=B.useMemo(()=>({basename:s,navigator:i,static:a,useTransitions:o,future:{}}),[s,i,a,o]);typeof n==`string`&&(n=tT(n));let{pathname:l=`/`,search:u=``,hash:d=``,state:f=null,key:p=`default`,mask:m}=n,h=B.useMemo(()=>{let e=IT(l,s);return e==null?null:{location:{pathname:e,search:u,hash:d,state:f,key:p,mask:m},navigationType:r}},[s,l,u,d,f,p,r,m]);return Xw(h!=null,`<Router basename="${s}"> is not able to match the URL "${l}${u}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:B.createElement($D.Provider,{value:c},B.createElement(eO.Provider,{children:t,value:h}))}B.Component;var AO=`application/x-www-form-urlencoded`;function jO(e){return typeof HTMLElement<`u`&&e instanceof HTMLElement}function Mee(e){return jO(e)&&e.tagName.toLowerCase()===`button`}function Nee(e){return jO(e)&&e.tagName.toLowerCase()===`form`}function Pee(e){return jO(e)&&e.tagName.toLowerCase()===`input`}function Fee(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function Iee(e,t){return e.button===0&&(!t||t===`_self`)&&!Fee(e)}var MO=null;function Lee(){if(MO===null)try{new FormData(document.createElement(`form`),0),MO=!1}catch{MO=!0}return MO}var Ree=new Set([`application/x-www-form-urlencoded`,`multipart/form-data`,`text/plain`]);function NO(e){return e!=null&&!Ree.has(e)?(Xw(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${AO}"`),null):e}function PO(e,t){let n,r,i,a,o;if(Nee(e)){let o=e.getAttribute(`action`);r=o?IT(o,t):null,n=e.getAttribute(`method`)||`get`,i=NO(e.getAttribute(`enctype`))||AO,a=new FormData(e)}else if(Mee(e)||Pee(e)&&(e.type===`submit`||e.type===`image`)){let o=e.form;if(o==null)throw Error(`Cannot submit a <button> or <input type="submit"> without a <form>`);let s=e.getAttribute(`formaction`)||o.getAttribute(`action`);if(r=s?IT(s,t):null,n=e.getAttribute(`formmethod`)||o.getAttribute(`method`)||`get`,i=NO(e.getAttribute(`formenctype`))||NO(o.getAttribute(`enctype`))||AO,a=new FormData(o,e),!Lee()){let{name:t,type:n,value:r}=e;if(n===`image`){let e=t?`${t}.`:``;a.append(`${e}x`,`0`),a.append(`${e}y`,`0`)}else t&&a.append(t,r)}}else if(jO(e))throw Error(`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`);else n=`get`,r=null,i=AO,o=e;return a&&i===`text/plain`&&(o=a,a=void 0),{action:r,method:n.toLowerCase(),encType:i,formData:a,body:o}}function FO(e,t){if(e===!1||e==null)throw Error(t)}var IO={"&":`\\u0026`,">":`\\u003e`,"<":`\\u003c`,"\u2028":`\\u2028`,"\u2029":`\\u2029`},LO=/[&><\u2028\u2029]/g;function RO(e){return e.replace(LO,e=>IO[e])}function zO(e,t){let n=typeof e==`string`?new URL(e,typeof window>`u`?`server://singlefetch/`:window.location.origin):e;return n.pathname.endsWith(`/`)?n.pathname=`${n.pathname}_.${t}`:n.pathname=`${n.pathname}.${t}`,n}var BO=`modulepreload`,VO=function(e){return`/`+e},HO={},UO=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=VO(t,n),t=s(t),t in HO)return;HO[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:BO,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})};async function WO(e,t){if(e.id in t)return t[e.id];try{let n=await UO(()=>import(e.module),[]);return t[e.id]=n,n}catch(t){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(t),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function GO(e){return e!=null&&typeof e.page==`string`}function KO(e){return e==null?!1:e.href==null?e.rel===`preload`&&typeof e.imageSrcSet==`string`&&typeof e.imageSizes==`string`:typeof e.rel==`string`&&typeof e.href==`string`}async function qO(e,t,n){return QO((await Promise.all(e.map(async e=>{let r=t.routes[e.route.id];if(r){let e=await WO(r,n);return e.links?e.links():[]}return[]}))).flat(1).filter(KO).filter(e=>e.rel===`stylesheet`||e.rel===`preload`).map(e=>e.rel===`stylesheet`?{...e,rel:`prefetch`,as:`style`}:{...e,rel:`prefetch`}))}function JO(e,t,n,r,i,a){let o=(e,t)=>n[t]?e.route.id!==n[t].route.id:!0,s=(e,t)=>n[t].pathname!==e.pathname||n[t].route.path?.endsWith(`*`)&&n[t].params[`*`]!==e.params[`*`];return a===`assets`?t.filter((e,t)=>o(e,t)||s(e,t)):a===`data`?t.filter((t,a)=>{let c=r.routes[t.route.id];if(!c||!c.hasLoader)return!1;if(o(t,a)||s(t,a))return!0;if(t.route.shouldRevalidate){let r=t.route.shouldRevalidate({currentUrl:new URL(i.pathname+i.search+i.hash,window.origin),currentParams:n[0]?.params||{},nextUrl:new URL(e,window.origin),nextParams:t.params,defaultShouldRevalidate:!0});if(typeof r==`boolean`)return r}return!0}):[]}function YO(e,t,{includeHydrateFallback:n}={}){return XO(e.map(e=>{let r=t.routes[e.route.id];if(!r)return[];let i=[r.module];return r.clientActionModule&&(i=i.concat(r.clientActionModule)),r.clientLoaderModule&&(i=i.concat(r.clientLoaderModule)),n&&r.hydrateFallbackModule&&(i=i.concat(r.hydrateFallbackModule)),r.imports&&(i=i.concat(r.imports)),i}).flat(1))}function XO(e){return[...new Set(e)]}function ZO(e){let t={},n=Object.keys(e).sort();for(let r of n)t[r]=e[r];return t}function QO(e,t){let n=new Set,r=new Set(t);return e.reduce((e,i)=>{if(t&&!GO(i)&&i.as===`script`&&i.href&&r.has(i.href))return e;let a=JSON.stringify(ZO(i));return n.has(a)||(n.add(a),e.push({key:a,link:i})),e},[])}function $O(){let e=B.useContext(KD);return FO(e,`You must render this element inside a <DataRouterContext.Provider> element`),e}function ek(){let e=B.useContext(qD);return FO(e,`You must render this element inside a <DataRouterStateContext.Provider> element`),e}var tk=B.createContext(void 0);tk.displayName=`FrameworkContext`;function nk(){let e=B.useContext(tk);return FO(e,`You must render this element inside a <HydratedRouter> element`),e}function rk(e,t){let n=B.useContext(tk),[r,i]=B.useState(!1),[a,o]=B.useState(!1),{onFocus:s,onBlur:c,onMouseEnter:l,onMouseLeave:u,onTouchStart:d}=t,f=B.useRef(null);B.useEffect(()=>{if(e===`render`&&o(!0),e===`viewport`){let e=new IntersectionObserver(e=>{e.forEach(e=>{o(e.isIntersecting)})},{threshold:.5});return f.current&&e.observe(f.current),()=>{e.disconnect()}}},[e]),B.useEffect(()=>{if(r){let e=setTimeout(()=>{o(!0)},100);return()=>{clearTimeout(e)}}},[r]);let p=()=>{i(!0)},m=()=>{i(!1),o(!1)};return n?e===`intent`?[a,f,{onFocus:ik(s,p),onBlur:ik(c,m),onMouseEnter:ik(l,p),onMouseLeave:ik(u,m),onTouchStart:ik(d,p)}]:[a,f,{}]:[!1,f,{}]}function ik(e,t){return n=>{e&&e(n),n.defaultPrevented||t(n)}}function ak({page:e,...t}){let n=YD(),{nonce:r}=nk(),{router:i}=$O(),a=B.useMemo(()=>pT(i.routes,e,i.basename),[i.routes,e,i.basename]);return a?(t.nonce==null&&r&&(t={...t,nonce:r}),n?B.createElement(sk,{page:e,matches:a,...t}):B.createElement(ck,{page:e,matches:a,...t})):null}function ok(e){let{manifest:t,routeModules:n}=nk(),[r,i]=B.useState([]);return B.useEffect(()=>{let r=!1;return qO(e,t,n).then(e=>{r||i(e)}),()=>{r=!0}},[e,t,n]),r}function sk({page:e,matches:t,...n}){let r=uO(),i=B.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=zO(e,`rsc`),i=!1,a=[];for(let e of t)typeof e.route.shouldRevalidate==`function`?i=!0:a.push(e.route.id);return i&&a.length>0&&n.searchParams.set(`_routes`,a.join(`,`)),[n.pathname+n.search]},[e,r,t]);return B.createElement(B.Fragment,null,i.map(e=>B.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})))}function ck({page:e,matches:t,...n}){let r=uO(),{manifest:i,routeModules:a}=nk(),{loaderData:o,matches:s}=ek(),c=B.useMemo(()=>JO(e,t,s,i,r,`data`),[e,t,s,i,r]),l=B.useMemo(()=>JO(e,t,s,i,r,`assets`),[e,t,s,i,r]),u=B.useMemo(()=>{if(e===r.pathname+r.search+r.hash)return[];let n=new Set,s=!1;if(t.forEach(e=>{let t=i.routes[e.route.id];!t||!t.hasLoader||(!c.some(t=>t.route.id===e.route.id)&&e.route.id in o&&a[e.route.id]?.shouldRevalidate||t.hasClientLoader?s=!0:n.add(e.route.id))}),n.size===0)return[];let l=zO(e,`data`);return s&&n.size>0&&l.searchParams.set(`_routes`,t.filter(e=>n.has(e.route.id)).map(e=>e.route.id).join(`,`)),[l.pathname+l.search]},[o,r,i,c,t,e,a]),d=B.useMemo(()=>YO(l,i),[l,i]),f=ok(l);return B.createElement(B.Fragment,null,u.map(e=>B.createElement(`link`,{key:e,rel:`prefetch`,as:`fetch`,href:e,...n})),d.map(e=>B.createElement(`link`,{key:e,rel:`modulepreload`,href:e,...n})),f.map(({key:e,link:t})=>B.createElement(`link`,{key:e,nonce:n.nonce,...t,crossOrigin:t.crossOrigin??n.crossOrigin})))}function lk(...e){return t=>{e.forEach(e=>{typeof e==`function`?e(t):e!=null&&(e.current=t)})}}var uk=typeof window<`u`&&window.document!==void 0&&window.document.createElement!==void 0;try{uk&&(window.__reactRouterVersion=`8.3.0`)}catch{}function dk(e,t){return jE({basename:t?.basename,getContext:t?.getContext,future:t?.future,history:Jw({window:t?.window}),hydrationData:t?.hydrationData||fk(),routes:e,mapRouteProperties:uT,hydrationRouteProperties:Eee,dataStrategy:t?.dataStrategy,patchRoutesOnNavigation:t?.patchRoutesOnNavigation,window:t?.window,instrumentations:t?.instrumentations}).initialize()}function fk(){let e=window?.__staticRouterHydrationData;return e&&e.errors&&(e={...e,errors:pk(e.errors)}),e}function pk(e){if(!e)return null;let t=Object.entries(e),n={};for(let[e,r]of t)if(r&&r.__type===`RouteErrorResponse`)n[e]=new QT(r.status,r.statusText,r.data,r.internal===!0);else if(r&&r.__type===`Error`){if(typeof r.__subType==`string`&&ZT.includes(r.__subType)){let t=window[r.__subType];if(typeof t==`function`)try{let i=new t(r.message);i.stack=``,n[e]=i}catch{}}if(n[e]==null){let t=Error(r.message);t.stack=``,n[e]=t}}else n[e]=r;return n}function mk({basename:e,children:t,history:n,useTransitions:r}){let[i,a]=B.useState({action:n.action,location:n.location}),o=B.useCallback(e=>{r===!1?a(e):B.startTransition(()=>a(e))},[r]);return B.useLayoutEffect(()=>n.listen(o),[n,o]),B.createElement(kO,{basename:e,children:t,location:i.location,navigationType:i.action,navigator:n,useTransitions:r})}mk.displayName=`unstable_HistoryRouter`;var hk=B.forwardRef(function({onClick:e,discover:t=`render`,prefetch:n=`none`,relative:r,reloadDocument:i,replace:a,mask:o,state:s,target:c,to:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m){let{basename:h,navigator:g,useTransitions:_}=B.useContext($D),v=typeof l==`string`&&Uw.test(l),y=rE(l,h);l=y.to;let b=cO(l,{relative:r}),x=uO(),S=null;if(o){let e=WT(o,[],x.mask?x.mask.pathname:`/`,!0);h!==`/`&&(e.pathname=e.pathname===`/`?h:KT([h,e.pathname])),S=g.createHref(e)}let[C,w,T]=rk(n,p),E=Sk(l,{replace:a,mask:o,state:s,target:c,preventScrollReset:u,relative:r,viewTransition:d,defaultShouldRevalidate:f,useTransitions:_});function D(t){e&&e(t),t.defaultPrevented||E(t)}let O=!(y.isExternal||i),k=B.createElement(`a`,{...p,...T,href:(O?S:void 0)||y.absoluteURL||b,onClick:O?D:e,ref:lk(m,w),target:c,"data-discover":!v&&t===`render`?`true`:void 0});return C&&!v?B.createElement(B.Fragment,null,k,B.createElement(ak,{page:b})):k});hk.displayName=`Link`;var gk=B.forwardRef(function({"aria-current":e=`page`,caseSensitive:t=!1,className:n=``,end:r=!1,style:i,to:a,viewTransition:o,children:s,...c},l){let u=_O(a,{relative:c.relative}),d=uO(),f=B.useContext(qD),{navigator:p,basename:m}=B.useContext($D),h=f!=null&&Mk(u)&&o===!0,g=p.encodeLocation?p.encodeLocation(u).pathname:u.pathname,_=d.pathname,v=f&&f.navigation&&f.navigation.location?f.navigation.location.pathname:null;t||(_=_.toLowerCase(),v=v?v.toLowerCase():null,g=g.toLowerCase()),v&&m&&(v=IT(v,m)||v);let y=g!==`/`&&g.endsWith(`/`)?g.length-1:g.length,b=_===g||!r&&_.startsWith(g)&&_.charAt(y)===`/`,x=v!=null&&(v===g||!r&&v.startsWith(g)&&v.charAt(y)===`/`),S={isActive:b,isPending:x,isTransitioning:h},C=b?e:void 0,w;w=typeof n==`function`?n(S):[n,b?`active`:null,x?`pending`:null,h?`transitioning`:null].filter(Boolean).join(` `);let T=typeof i==`function`?i(S):i;return B.createElement(hk,{...c,"aria-current":C,className:w,ref:l,style:T,to:a,viewTransition:o},typeof s==`function`?s(S):s)});gk.displayName=`NavLink`;var _k=B.forwardRef(({discover:e=`render`,fetcherKey:t,navigate:n,reloadDocument:r,replace:i,state:a,method:o=`get`,action:s,onSubmit:c,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f,...p},m)=>{let{useTransitions:h}=B.useContext($D),g=Tk(),_=Ek(s,{relative:l}),v=o.toLowerCase()===`get`?`get`:`post`,y=typeof s==`string`&&Uw.test(s);return B.createElement(`form`,{ref:m,method:v,action:_,onSubmit:r?c:e=>{if(c&&c(e),e.defaultPrevented)return;e.preventDefault();let r=e.nativeEvent.submitter,s=r?.getAttribute(`formmethod`)||o,p=()=>g(r||e.currentTarget,{fetcherKey:t,method:s,navigate:n,replace:i,state:a,relative:l,preventScrollReset:u,viewTransition:d,defaultShouldRevalidate:f});h&&n!==!1?B.startTransition(()=>p()):p()},...p,"data-discover":!y&&e===`render`?`true`:void 0})});_k.displayName=`Form`;function vk({getKey:e,storageKey:t,...n}){let r=B.useContext(tk),{basename:i}=B.useContext($D),a=uO(),o=wO();Ak({getKey:e,storageKey:t});let s=B.useMemo(()=>{if(!r||!e)return null;let t=kk(a,o,i,e);return t===a.key?null:t},[]);if(!r||r.isSpaMode)return null;let c=((e,t)=>{if(!window.history.state||!window.history.state.key){let e=Math.random().toString(32).slice(2);window.history.replaceState({key:e},``)}try{let n=JSON.parse(sessionStorage.getItem(e)||`{}`)[t||window.history.state.key];typeof n==`number`&&window.scrollTo(0,n)}catch(t){console.error(t),sessionStorage.removeItem(e)}}).toString();return n.nonce==null&&r?.nonce&&(n.nonce=r.nonce),B.createElement(`script`,{...n,suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:`(${c})(${RO(JSON.stringify(t||Dk))}, ${RO(JSON.stringify(s))})`}})}vk.displayName=`ScrollRestoration`;function yk(e){return`${e} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`}function bk(e){let t=B.useContext(KD);return Yw(t,yk(e)),t}function xk(e){let t=B.useContext(qD);return Yw(t,yk(e)),t}function Sk(e,{target:t,replace:n,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c,useTransitions:l}={}){let u=fO(),d=uO(),f=_O(e,{relative:o});return B.useCallback(p=>{if(Iee(p,t)){p.preventDefault();let t=n===void 0?eT(d)===eT(f):n,m=()=>u(e,{replace:t,mask:r,state:i,preventScrollReset:a,relative:o,viewTransition:s,defaultShouldRevalidate:c});l?B.startTransition(()=>m()):m()}},[d,u,f,n,r,i,t,e,a,o,s,c,l])}var Ck=0,wk=()=>`__${String(++Ck)}__`;function Tk(){let{router:e}=bk(`useSubmit`),{basename:t}=B.useContext($D),n=xee(),r=e.fetch,i=e.navigate;return B.useCallback(async(e,a={})=>{let{action:o,method:s,encType:c,formData:l,body:u}=PO(e,t);a.navigate===!1?await r(a.fetcherKey||wk(),n,a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,flushSync:a.flushSync}):await i(a.action||o,{defaultShouldRevalidate:a.defaultShouldRevalidate,preventScrollReset:a.preventScrollReset,formData:l,body:u,formMethod:a.method||s,formEncType:a.encType||c,replace:a.replace,state:a.state,fromRouteId:n,flushSync:a.flushSync,viewTransition:a.viewTransition})},[r,i,t,n])}function Ek(e,{relative:t}={}){let{basename:n}=B.useContext($D),r=B.useContext(tO);Yw(r,`useFormAction must be used inside a RouteContext`);let[i]=r.matches.slice(-1),a={..._O(e||`.`,{relative:t})},o=uO();if(e==null){a.search=o.search;let e=new URLSearchParams(a.search),t=e.getAll(`index`);if(t.some(e=>e===``)){e.delete(`index`),t.filter(e=>e).forEach(t=>e.append(`index`,t));let n=e.toString();a.search=n?`?${n}`:``}}return(!e||e===`.`)&&i.route.index&&(a.search=a.search?a.search.replace(/^\?/,`?index&`):`?index`),n!==`/`&&(a.pathname=a.pathname===`/`?n:KT([n,a.pathname])),eT(a)}var Dk=`react-router-scroll-positions`,Ok={};function kk(e,t,n,r){let i=null;return r&&(i=r(n===`/`?e:{...e,pathname:IT(e.pathname,n)||e.pathname},t)),i??=e.key,i}function Ak({getKey:e,storageKey:t}={}){let{router:n}=bk(`useScrollRestoration`),{restoreScrollPosition:r,preventScrollReset:i}=xk(`useScrollRestoration`),{basename:a}=B.useContext($D),o=uO(),s=wO(),c=See();B.useEffect(()=>(window.history.scrollRestoration=`manual`,()=>{window.history.scrollRestoration=`auto`}),[]),jk(B.useCallback(()=>{if(c.state===`idle`){let t=kk(o,s,a,e);Ok[t]=window.scrollY}try{sessionStorage.setItem(t||Dk,JSON.stringify(Ok))}catch(e){Xw(!1,`Failed to save scroll positions in sessionStorage, <ScrollRestoration /> will not work properly (${e}).`)}window.history.scrollRestoration=`auto`},[c.state,e,a,o,s,t])),typeof document<`u`&&(B.useLayoutEffect(()=>{try{let e=sessionStorage.getItem(t||Dk);e&&(Ok=JSON.parse(e))}catch{}},[t]),B.useLayoutEffect(()=>{let t=n?.enableScrollRestoration(Ok,()=>window.scrollY,e?(t,n)=>kk(t,n,a,e):void 0);return()=>t&&t()},[n,a,e]),B.useLayoutEffect(()=>{if(r!==!1){if(typeof r==`number`){window.scrollTo(0,r);return}try{if(o.hash){let e=document.getElementById(decodeURIComponent(o.hash.slice(1)));if(e){e.scrollIntoView();return}}}catch{Xw(!1,`"${o.hash.slice(1)}" is not a decodable element ID. The view will not scroll to it.`)}i!==!0&&window.scrollTo(0,0)}},[o,r,i]))}function jk(e,t){let{capture:n}=t||{};B.useEffect(()=>{let t=n==null?void 0:{capture:n};return window.addEventListener(`pagehide`,e,t),()=>{window.removeEventListener(`pagehide`,e,t)}},[e,n])}function Mk(e,{relative:t}={}){let n=B.useContext(XD);Yw(n!=null,"`useViewTransitionState` must be used within `react-router/dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?");let{basename:r}=bk(`useViewTransitionState`),i=_O(e,{relative:t});if(!n.isTransitioning)return!1;let a=IT(n.currentLocation.pathname,r)||n.currentLocation.pathname,o=IT(n.nextLocation.pathname,r)||n.nextLocation.pathname;return MT(i.pathname,o)!=null||MT(i.pathname,a)!=null}var Nk=class{currentSeq=-1;resync;interactionsInvalidated;constructor(e,t=()=>{}){this.resync=e,this.interactionsInvalidated=t}reset(){this.currentSeq=-1}handle(e){switch(e.type){case`board`:iS(e.bootId),rC(e.board),this.currentSeq=typeof e.seq==`number`?e.seq:-1;break;case`board-delta`:switch(iS(e.bootId),dy(this.currentSeq,e.seq)){case`apply`:oC(e)?this.currentSeq=e.seq:this.resync();break;case`ignore`:break;case`resync`:this.resync();break}break;case`notify`:Pk(e);break;case`interactions-invalidated`:this.interactionsInvalidated(e);break}}};function Pk(e){if(!Z.notificationsEnabled||!document.hidden||typeof Notification>`u`||Notification.permission!==`granted`)return;let t=new Notification(e.title,{body:e.body,tag:`${kx()}/${e.slug}`}),n=Dx()??Z.board?.projectSlug;t.onclick=()=>{window.focus(),n===void 0||Dx()===n?KS(e.slug):location.assign(`${Ox(n)}/thread/${encodeURIComponent(e.slug)}`),t.close()}}var Fk=(e,t)=>[`interactions`,`pending`,e,t],Ik=(e,t,n)=>[`interactions`,`record`,e,t,n];function Lk(e,t){let n=Fk(t.owner.threadSlug,t.owner.sessionId);e.setQueryData(n,e=>e&&(t.lifecycle===`pending`?{interactions:e.interactions.map(e=>e.id===t.id?t:e)}:{interactions:e.interactions.filter(e=>e.id!==t.id)}))}function Rk(e,t){Lk(e,{...t,delivery:{effect:`reconnect-required`}})}async function zk(e,t){await Promise.all([e.invalidateQueries({queryKey:Fk(t.slug,t.sessionId),exact:!0}),e.invalidateQueries({queryKey:Ik(t.slug,t.sessionId,t.interactionId),exact:!0})])}var Bk=null,Vk=null,Hk=0,Uk=null,Wk=0,Gk=null,Kk=new Nk(()=>Xk(),e=>{Gk&&zk(Gk,e)}),qk=35e3;function Jk(){if(Bk)return;Z.connection!==`open`&&(Z.connection=`connecting`),Bk=new EventSource(`${Nx()}/events`);let e=Dx();if(Hk=Date.now(),Bk.onopen=()=>{Vk&&=(clearTimeout(Vk),null),Wk=0,Hk=Date.now(),Z.connection=`open`},Bk.addEventListener(`heartbeat`,()=>{Hk=Date.now()}),Bk.onmessage=t=>{if(e===Dx()){Hk=Date.now();try{Kk.handle(JSON.parse(t.data))}catch(e){console.error(`bad SSE event`,e)}}},Bk.onerror=()=>Yk(),!Uk){Uk=setInterval(()=>{Bk&&Date.now()-Hk>qk&&Yk()},1e4);let e=()=>{(!Bk||Date.now()-Hk>qk)&&Yk(!0)};window.addEventListener(`focus`,e),window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,()=>{document.hidden||e()})}}function Yk(e=!1){if(Bk?.close(),Bk=null,Kk.reset(),Wk++,Z.connection=Wk>3?`closed`:`connecting`,Vk){if(!e)return;clearTimeout(Vk),Vk=null}let t=e?0:Math.min(1e3*2**Math.min(Wk-1,4),15e3);Vk=setTimeout(()=>{Vk=null,Jk()},t)}function Xk(){Kk.reset(),Bk?.close(),Bk=null,Jk()}function Zk(){Kk.reset(),Bk?.close(),Bk=null,Z.connection=`connecting`,Jk()}function Qk(e){e&&(Gk=e),document.readyState===`complete`?Jk():window.addEventListener(`load`,Jk,{once:!0})}function $k(e,t){let n=new Set(e.filter(e=>e.role===`user`&&e.sourceId).map(e=>e.sourceId));return t.filter(e=>e.role===`user`&&e.sourceId&&!n.has(e.sourceId)).map(e=>e.text.trim())}function eA(e,t){let n=new Set;for(let r of t)for(let t=0;t<e.length;t++){if(n.has(t))continue;let i=e[t].text.trim();if(r===i){n.add(t);break}if(!r.startsWith(i))continue;let a=i.length;for(let i=t+1;i<e.length&&!n.has(i);i++){let o=e[i].text.trim();if(!r.startsWith(`
318
318
 
319
- `,a)||!r.startsWith(o,a+2))break;if(a+=2+o.length,a===r.length){for(let e=t;e<=i;e++)n.add(e);break}}if(n.has(t))break}return n}function tA(e,t){if(!e?.length)return t;let n=e.filter(e=>e.queued&&!e.sourceId&&e.role===`user`&&e.text.trim());if(!n.length)return t;let r=new Set(t.map(e=>e.deliveryId).filter(e=>!!e)),i=eA(n,$k(e,t)),a=n.filter((e,t)=>!i.has(t)&&!(e.deliveryId&&r.has(e.deliveryId)));if(!a.length)return t;let o=a.filter(n=>aA(n,iA(t),iA(e)));return o.length?[...t,...o]:t}var nA=6e4,rA=new WeakMap;function iA(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.queued&&!n.sourceId)continue;let r=n.at?Date.parse(n.at):NaN;if(Number.isFinite(r))return r}return NaN}function aA(e,t,n){if(!Number.isFinite(t))return!0;let r=rA.get(e);return r===void 0?(rA.set(e,Number.isFinite(n)?n:t),aA(e,t,n)):t-r<=nA?!0:(console.warn(`[frizz] retiring a stranded optimistic send: the transcript advanced past it without ever recording it`,{text:e.text.slice(0,120),advancedMs:t-r}),!1)}var oA=new WeakMap;function sA(e){let t=oA.get(e);return t===void 0&&(t=JSON.stringify(e),oA.set(e,t)),t}function cA(e,t){if(!e?.length||!t.length)return t;let n=new Map;for(let t of e)t.sourceId&&n.set(t.sourceId,t);if(!n.size)return t;let r=!1,i=t.map(e=>{if(e===n.get(e.sourceId??``))return e;let t=e.sourceId?n.get(e.sourceId):void 0;return t&&sA(t)===sA(e)?(r=!0,t):e});return r?i:t}function lA(e,t,n){if(!e)return!1;let r=Date.parse(e);if(!Number.isFinite(r))return!1;let i=t?Date.parse(t):0;return t&&!Number.isFinite(i)?!1:r-i>n}function uA(e){if(e)for(let t=e.length-1;t>=0;t--){let n=e[t].at;if(n)return n}}function dA(e,t){let n=Math.max(0,Math.min(e.length,t));for(let t=n-1;t>=0;t--)if(e[t].role===`user`)return t;return n>0?0:null}function fA(e,t,n){if(!t)return n;let r=e.findIndex(e=>e.sourceId===t);return r>=0?r:0}function pA(e,t){let n=new Map;e.forEach((e,t)=>{e.sourceId&&n.set(e.sourceId,t)});for(let e=0;e<t.length;e++){let r=t[e].sourceId,i=r?n.get(r):void 0;if(i!==void 0)return{previousIndex:i,incomingIndex:e}}}function mA(e,t){if(!e?.historyLoaded||e.transcriptKey!==t.transcriptKey)return t;let n=pA(e.messages,t.messages);return n?{...t,messages:[...e.messages.slice(0,n.previousIndex).filter(e=>!e.pinnedFromSourceId),...t.messages.slice(n.incomingIndex)],beforeCursor:e.beforeCursor,hasEarlier:e.hasEarlier,reachedTurnBoundary:e.reachedTurnBoundary,historyLoaded:!0}:t}function hA(e,t){if(!e)return{messages:[...t]};let n=pA(e.messages,t);return n?e.historyLoaded?{...e,messages:[...e.messages.slice(0,n.previousIndex).filter(e=>!e.pinnedFromSourceId),...t.slice(n.incomingIndex)]}:{...e,messages:[...t]}:{messages:[...t]}}function gA(e,t){if(e.transcriptKey!==t.transcriptKey)return e;let n=new Set(t.messages.map(e=>e.sourceId).filter(Boolean)),r=e.messages.filter(e=>!e.pinnedFromSourceId||!n.has(e.pinnedFromSourceId)),i=new Set(r.map(e=>e.sourceId).filter(Boolean)),a=t.messages.filter(e=>!e.sourceId||!i.has(e.sourceId));return{...e,messages:[...a,...r],beforeCursor:t.beforeCursor,hasEarlier:t.hasEarlier,reachedTurnBoundary:t.reachedTurnBoundary,historyLoaded:!0}}function _A(e,t=0){if(!e)return null;let n=[...e.querySelectorAll(`[data-transcript-source-id]`)].filter(e=>e.dataset.transcriptSticky!==`true`),r=n.find(e=>e.getBoundingClientRect().bottom>t)??n[0],i=r?.dataset.transcriptSourceId;return r&&i?{sourceId:i,top:r.getBoundingClientRect().top}:null}function vA(e,t){return t-e}function yA(e,t,n){if(!e||!t)return!1;let r=[...e.querySelectorAll(`[data-transcript-source-id]`)].find(e=>e.dataset.transcriptSourceId===t.sourceId);return r?(n(vA(t.top,r.getBoundingClientRect().top)),!0):!1}function bA(e){let{remaining:t,scrollY:n,maxScrollY:r,alreadyReserved:i}=e;return!(t>.5)||r<=0||i?`settle`:n>=r-1?`reserve`:`settle`}var xA=null,SA=null,CA=null,wA=null,TA=0,EA=0,DA=!1,OA=!1,kA=!1,AA=new Map,jA=new Nk(()=>HA(),e=>{SA&&zk(SA,e)}),MA=35e3;function NA(){return`${location.origin.replace(/^http/,`ws`)}${Nx()}/ws`}var PA,FA=!1;function IA(){PA=Dx(),FA=!0}function LA(e){return FA&&PA===e}function RA(){if(xA||kA)return;Z.connection!==`open`&&(Z.connection=`connecting`),IA();let e=new WebSocket(NA()),t=Dx();xA=e,DA=!1,EA=Date.now(),e.onopen=()=>{OA=!0,EA=Date.now(),Z.connection=`open`,Z.socketTranscripts=!0,CA&&=(clearTimeout(CA),null)},e.onmessage=n=>{if(!(xA!==e||t!==Dx())){EA=Date.now();try{let e=JSON.parse(n.data),t=KA(e);t&&(TA=0),t&&e.t===`event`&&e.event.type===`board`&&(DA=!0,JA())}catch(e){console.error(`bad /ws message`,e)}}},e.onerror=()=>{},e.onclose=()=>{xA===e&&(xA=null,BA())},UA()}function zA(){let e=xA;if(xA=null,DA=!1,e){e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}}function BA(){if(jA.reset(),!OA){GA();return}TA++,Z.connection=TA>3?`closed`:`connecting`,VA()}function VA(e=!1){if(CA){if(!e)return;clearTimeout(CA),CA=null}let t=e?0:Math.min(1e3*2**Math.min(TA-1,4),15e3);CA=setTimeout(()=>{CA=null,RA()},t)}function HA(){jA.reset(),zA(),RA()}function UA(){if(wA)return;wA=setInterval(()=>{xA&&Date.now()-EA>MA&&WA()},1e4);let e=()=>{kA||(!xA||Date.now()-EA>MA)&&WA(!0)};window.addEventListener(`focus`,e),window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,()=>{document.hidden||e()})}function WA(e=!1){if(!kA){if(zA(),jA.reset(),!OA){GA();return}TA++,Z.connection=TA>3?`closed`:`connecting`,VA(e)}}function GA(e){kA||(kA=!0,e&&(Z.socketBoardFallback=e,Z.socketTranscriptFallbacks={}),zA(),Z.socketTranscripts=!1,Qk(SA??void 0))}function KA(e){switch(e.t){case`event`:return jA.handle(e.event),e.event.type===`board`&&(Z.socketBoardFallback=null),!0;case`transcript`:return SA?.setQueryData([`transcript`,e.slug],t=>{let n=hA(t,e.messages);return{...n,messages:cA(t?.messages,tA(t?.messages,n.messages))}}),delete Z.socketTranscriptFallbacks[e.slug],!0;case`payload-too-large`:return e.channel===`board`?(Z.socketBoardFallback||console.warn(`[frizz] live board payload exceeded the socket limit; using SSE`,{actualBytes:e.actualBytes,maxBytes:e.maxBytes}),GA({actualBytes:e.actualBytes,maxBytes:e.maxBytes})):(Z.socketTranscriptFallbacks[e.slug]||console.warn(`[frizz] live transcript payload exceeded the socket limit; updates paused`,{slug:e.slug,actualBytes:e.actualBytes,maxBytes:e.maxBytes}),Z.socketTranscriptFallbacks[e.slug]={kind:`payload-too-large`,actualBytes:e.actualBytes,maxBytes:e.maxBytes}),!1;case`resource-limited`:return Z.socketTranscriptFallbacks[e.slug]||console.warn(`[frizz] live transcript read budget reached; updates paused`,{slug:e.slug,scope:e.scope,retryAfterMs:e.retryAfterMs}),Z.socketTranscriptFallbacks[e.slug]={kind:`read-budget`,scope:e.scope,retryAfterMs:e.retryAfterMs},!1;case`hb`:return!0}}function qA(e){DA&&xA&&xA.readyState===WebSocket.OPEN&&xA.send(JSON.stringify(e))}function JA(){for(let e of AA.keys())Z.socketTranscriptFallbacks[e]||qA({t:`sub`,topic:`transcript`,slug:e})}function YA(e){let t=(AA.get(e)??0)+1;AA.set(e,t),t===1&&!Z.socketTranscriptFallbacks[e]&&qA({t:`sub`,topic:`transcript`,slug:e})}function XA(e){let t=(AA.get(e)??0)-1;t<=0?(AA.delete(e),qA({t:`unsub`,topic:`transcript`,slug:e})):AA.set(e,t)}function ZA(e){Z.socketTranscriptFallbacks[e]&&(delete Z.socketTranscriptFallbacks[e],AA.has(e)&&qA({t:`sub`,topic:`transcript`,slug:e}))}function QA(){AA.clear(),jA.reset(),zA(),Z.connection=`connecting`,IA(),kA?Zk():RA()}function $A(e){SA=e,IA();let t=()=>RA();document.readyState===`complete`?t():window.addEventListener(`load`,t,{once:!0})}function ej(){return Hf(Z).board}function tj(){return Hf(Z).board?.projectDir}function nj(e){return e}function rj(e){if(!(!e||e.kind!==`session`||e.foreign||!e.sessionId))return{slug:e.id,sessionId:e.sessionId}}function ij(e){let t=rj(e);if(!(!t||e?.pendingInteraction===!1))return t}function aj(e,t=Date.now()){let n=1/0;for(let t of e){if(!t.expiresAt)continue;let e=Date.parse(t.expiresAt);Number.isFinite(e)&&(n=Math.min(n,e))}return Number.isFinite(n)?Math.max(250,n-t+50):!1}function oj(e){let t=ij(e);return qd({queryKey:t?Fk(t.slug,t.sessionId):[`interactions`,`pending`,`unowned`],queryFn:()=>X.pendingInteractions(t),enabled:t!==void 0,refetchInterval:e=>aj(e.state.data?.interactions??[]),refetchOnReconnect:!0,refetchOnWindowFocus:!0})}var sj=7e3,cj=5e3,lj=3;function uj(e,t){let n=Md(),r=Hf(Z),i=r.socketTranscripts,a=r.socketTranscriptFallbacks[e],o=qd({queryKey:[`transcript`,e],queryFn:async()=>{let t=await X.threadTranscript({slug:e}),r=n.getQueryData([`transcript`,e]),i=mA(r,t);return{...i,messages:cA(r?.messages,tA(r?.messages,i.messages))}},refetchInterval:t.poll&&!i&&!a?1500:!1,refetchOnWindowFocus:!a});return(0,B.useEffect)(()=>{if(!t.poll&&!i||a)return;let r=!1,s=0,c,l=setInterval(()=>{if(r)return;let t=sC(Z.board,e)?.lastActivityAt,a=uA(n.getQueryData([`transcript`,e])?.messages);if(!lA(t,a,cj)){s=0;return}if(a!==c&&(s=0),s>=lj)return;s++,c=a;let l=t?Date.parse(t)-(a?Date.parse(a):0):0;console.warn(`[frizz] transcript watchdog: stale view — self-healing`,{slug:e,lagMs:l,transport:i?`socket`:`poll`,attempt:s}),i&&(XA(e),YA(e)),r=!0,o.refetch().finally(()=>{r=!1})},sj);return()=>clearInterval(l)},[e,t.poll,i,a]),{...o,transportFallback:a?a.kind===`payload-too-large`?{kind:`payload-too-large`,actualBytes:a.actualBytes,maxBytes:a.maxBytes}:{kind:`read-budget`,scope:a.scope,retryAfterMs:a.retryAfterMs}:null,retryLiveUpdates:()=>ZA(e)}}function dj(e,t){return qd({queryKey:[`subAgentTranscript`,e,t],queryFn:()=>X.subAgentTranscript({slug:e,id:t}),refetchInterval:e=>e.state.data?.state===`running`?2500:!1})}function fj(e,t){return qd({queryKey:[`backgroundShellOutput`,e,t],queryFn:()=>X.backgroundShellOutput({slug:e,id:t}),refetchInterval:e=>e.state.data?.state===`running`?1500:!1})}function pj(e,t){let n=[...t].sort(),r=qd({queryKey:[`backgroundShellActivity`,e,n],queryFn:()=>X.backgroundShellActivity({slug:e,ids:n}),enabled:n.length>0,refetchInterval:e=>e.state.data&&!e.state.data.shells.some(e=>e.running)?!1:1500});return(0,B.useMemo)(()=>new Map((r.data?.shells??[]).flatMap(e=>e.lines===null?[]:[[e.id,e.lines]])),[r.data])}function mj(e,t,n,r={}){e.setQueryData([`transcript`,t],e=>{let t=e?.messages??[];return{...e,messages:[...t,{role:`user`,text:n,tools:[],parts:[],queued:!0,deliveryId:r.deliveryId}]}}),r.scrollToBottom!==!1&&typeof window<`u`&&requestAnimationFrame(()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:`smooth`}))}function hj(e,t,n,r){e.setQueryData([`transcript`,t],e=>{if(!e?.messages?.length)return e;let t=e.messages.findLastIndex(e=>e.queued&&e.role===`user`&&e.text===n&&(r===void 0||e.deliveryId===r));return t===-1?e:{...e,messages:e.messages.filter((e,n)=>n!==t)}})}function gj(){let e=nC();return e?`/thread/${encodeURIComponent(e)}`:Z.routeThreadSlug?`/thread/${encodeURIComponent(Z.routeThreadSlug)}`:Z.view.startsWith(`status:`)?`/status/${encodeURIComponent(Z.view.slice(7))}`:`/`}function _j(e){try{return decodeURIComponent(e)}catch{return null}}function vj(e,t=Z.board?.projectSlug){let n=jx(e);return n===`/`&&t?Ox(t):n}function yj(e){let t=e.match(/^\/thread\/([^/]+)$/);if(t){let e=_j(t[1]);if(e===null){Z.routeThreadSlug=null,tC(Z.drawers.map(e=>e.id)),Z.view=`todos`;return}Z.view=`todos`;let n=Z.drawers.findIndex(t=>t.kind===`thread`&&t.slug===e&&!t.closing);if(n!==-1){Z.routeThreadSlug=null,tC(Z.drawers.slice(n+1).map(e=>e.id));return}Z.routeThreadSlug=e;return}let n=e.match(/^\/status\/([^/]+)$/);if(n){Z.routeThreadSlug=null,tC(Z.drawers.map(e=>e.id));let e=_j(n[1]);Z.view=e===null?`todos`:`status:${e}`;return}Z.routeThreadSlug=null,tC(Z.drawers.map(e=>e.id)),Z.view=`todos`}function bj(e=location.pathname){yj(Ax(e))}function xj(e){return bj(),zf(Z,()=>{let t=vj(gj());t!==location.pathname&&e(t,{replace:!gj().startsWith(`/thread/`)})})}function Sj(e,t){if(!t)return e;let n=e.projectDir!==t.projectDir,r=t.threads.length>0;return{projectDir:t.projectDir,hasBeenVisible:n?r:e.hasBeenVisible||r}}var Cj=3600*1e3,wj=24*Cj,Tj=[{value:`1h`,label:`1 hour`,detail:`60 minutes`,kind:`duration`},{value:`tomorrow`,label:`tomorrow`,detail:`9am`,kind:`calendar`},{value:`1d`,label:`1 day`,detail:`24 hours`,kind:`duration`},{value:`3d`,label:`3 days`,detail:`72 hours`,kind:`duration`},{value:`1w`,label:`1 week`,detail:`7 days`,kind:`duration`}],Ej=new Set(Tj.map(e=>e.value));function Dj(e){return typeof e==`string`&&Ej.has(e)}function Oj(e){return kj(e).label}function kj(e){return Tj.find(t=>t.value===e)??Tj[2]}function Aj(e){let t=kj(e);return t.kind===`calendar`?`Snooze until ${t.label}`:`Snooze ${t.label}`}function jj(e,t=Date.now()){if(e===`tomorrow`){let e=new Date(t);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+1,9,0,0,0).toISOString()}return new Date(t+(e===`1h`?Cj:e===`1d`?wj:e===`3d`?3*wj:7*wj)).toISOString()}function Mj(e){return String(e).padStart(2,`0`)}function Nj(e){return`${e.getFullYear()}-${Mj(e.getMonth()+1)}-${Mj(e.getDate())}T${Mj(e.getHours())}:${Mj(e.getMinutes())}`}function Pj(e,t=Date.now()){let n=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(!n)return{ok:!1,message:`Choose a local date and time`};let[,r,i,a,o,s]=n,c=[r,i,a,o,s].map(Number),l=new Date(c[0],c[1]-1,c[2],c[3],c[4],0,0);return!Number.isFinite(l.getTime())||l.getFullYear()!==c[0]||l.getMonth()!==c[1]-1||l.getDate()!==c[2]||l.getHours()!==c[3]||l.getMinutes()!==c[4]?{ok:!1,message:`That local time does not exist`}:l.getTime()<=t?{ok:!1,message:`Choose a time in the future`}:{ok:!0,until:l.toISOString()}}function Fj(e,t=Date.now()){let n=new Date(e);if(!Number.isFinite(n.getTime()))return``;let r=new Date(t),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),a=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),o=Math.round((a-i)/wj),s=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);if(o===0)return`Today at ${s}`;if(o===1)return`Tomorrow at ${s}`;if(o>1&&o<7)return`${new Intl.DateTimeFormat(void 0,{weekday:`long`}).format(n)} at ${s}`;let c={month:`short`,day:`numeric`};return n.getFullYear()!==r.getFullYear()&&(c.year=`numeric`),`${new Intl.DateTimeFormat(void 0,c).format(n)} at ${s}`}function Ij(e,t){if(!Number.isFinite(Date.parse(e)))return null;let n=Fj(e,t);return n?n.replace(/^(Today|Tomorrow)/,e=>e.toLowerCase()):null}function Lj(e,t=Date.now()){let n=Ij(e,t);return n?`Snoozed until ${n}`:null}var Rj=120;function zj(e,t=Rj){let n=e.trim().replace(/\s+/g,` `);return n.length>t?`${n.slice(0,t-1)}…`:n}function Bj(e,t,n=Date.now()){let r=t?.trim();if(!r)return Lj(e,n);let i=Vj(e,n);return i?`${i} — then: ${zj(r)}`:null}function Vj(e,t=Date.now()){let n=Ij(e,t);return n?`Auto-snoozed until ${n}`:null}var Hj=`frizz.prefs.v1`;function Uj(e,t){return typeof e==`boolean`?e:e===`off`?!1:e===`compact`||e===`full`?!0:t}function Wj(e,t){return e===`fifo`||e===`lifo`?e:t}function Gj(e){let t={compactDiffs:!0,snoozePreset:`1d`,stickyUserMessage:!1,queueOrder:`fifo`,diffsRedefaulted:!0,stickyRedefaulted:!0};try{if(!e)return t;let n=JSON.parse(e);return n.diffsRedefaulted||=(n.compactDiffs=!0,!0),n.stickyRedefaulted||=(n.stickyUserMessage=!1,!0),{...t,...n,snoozePreset:Dj(n.snoozePreset)?n.snoozePreset:t.snoozePreset,stickyUserMessage:Uj(n.stickyUserMessage,t.stickyUserMessage),queueOrder:Wj(n.queueOrder,t.queueOrder)}}catch{return t}}function Kj(){try{return Gj(typeof localStorage>`u`?null:localStorage.getItem(Hj))}catch{return Gj(null)}}var qj=Rf(Kj());zf(qj,()=>{try{typeof localStorage<`u`&&localStorage.setItem(Hj,JSON.stringify(qj))}catch{}});function Jj(e){return e.kind===`session`&&e.foreign!==!0&&e.runtime===`exited`}var Yj=xy.options,Xj={planning:`text-sky-400 border-sky-400/40`,planned:`text-violet-400 border-violet-400/40`,active:`text-emerald-400 border-emerald-400/40`,"needs-human":`text-yellow-400 border-yellow-400/40`,blocked:`text-orange-400 border-orange-400/40`,done:`text-zinc-400 border-zinc-400/40`,dismissed:`text-rose-400 border-rose-400/40`,archived:`text-slate-500 border-slate-500/40`};function Zj(e){return iM(e)?eM:e.aiTitle?.trim()&&!Qj(e)?$j(e.aiTitle):e.backend===`codex`&&e.titleAuto===!0&&!e.aiTitle?.trim()?tM:e.titleAuto===!1&&e.title.trim()?e.title:e.title.trim()&&!(e.titleAuto===!0&&e.title.trim()===e.id)?e.titleAuto===!0?$j(e.title):e.title.trim():e.titleAuto===!0?tM:e.id}function Qj(e){return e.titleLocked??e.titleAuto===!1}function $j(e){let t=e.trim();if(!/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/i.test(t))return t;let n=t.split(/[-_]+/).filter(Boolean);if(n.length===0)return t;let r=n.join(` `).toLowerCase();return r.charAt(0).toUpperCase()+r.slice(1)}var eM=`Spinning up a thread…`,tM=`Untitled thread`,nM=6e4,rM=15e3;function iM(e){if(!e.titleAuto||e.aiTitle)return!1;if(e.backend===`codex`){if(e.runtime===`spawning`)return!0;let t=Date.parse(e.spawnedAt??``);return Number.isFinite(t)&&Date.now()-t<rM}let t=Date.parse(e.spawnedAt??``);return Number.isFinite(t)&&Date.now()-t<nM}function aM(e){return e.status===`done`||e.status===`dismissed`?!1:!!(e.runtime===`perm-prompt`||e.pendingAsk||e.humanBlocked&&e.runtime!==`none`&&e.runtime!==`running`&&e.runtime!==`spawning`||e.pendingQuestion&&e.runtime!==`running`&&e.runtime!==`spawning`||(e.status===`active`||e.status===`planning`)&&(e.runtime===`exited`||e.runtime===`none`)&&e.spawnedAt&&!e.archived)}function oM(e){let t=Date.parse(e.lastUserAt??``),n=Date.parse(e.spawnedAt??``),r=Math.max(Number.isFinite(t)?t:-1/0,Number.isFinite(n)?n:-1/0);return Number.isFinite(r)?r:0}function sM(e){if(yM(e))return oM(e);let t=Date.parse(e.lastAssistantAt??``);return Number.isFinite(t)?t:oM(e)}function cM(e){return yM(e)?e.lastActivityAt??e.spawnedAt:e.lastAssistantAt??e.lastActivityAt??e.spawnedAt}function lM(e){return[...e].sort((e,t)=>{let n=aM(e);if(n!==aM(t))return n?-1:1;let r=sM(t)-sM(e);return r===0?e.id.localeCompare(t.id):r})}function uM(e){return[...e].sort((e,t)=>{let n=sM(t)-sM(e);return n===0?e.id.localeCompare(t.id):n})}function dM(e,t=`fifo`){let n=t===`lifo`?-1:1;return[...e].sort((e,t)=>{let r=(sM(e)-sM(t))*n;return r===0?e.id.localeCompare(t.id):r})}function fM(e){return xb(e)}function pM(e){return e.filter(e=>e.kind===`session`&&e.foreign===!0)}function mM(e){return e.runtime===`turn-idle`||e.runtime===`exited`}function hM(e){return(e.subAgents??[]).some(e=>Oy(e)&&e.state===`running`)}function gM(e){return hM(e)||e.awaitingBackground===!0}function _M(e,t=Date.now()){let n=Date.parse(e.snoozedUntil??``);return Number.isFinite(n)&&n>t?e.snoozedUntil:void 0}function vM(e,t=Date.now()){let n=_M(e,t)!==void 0;if(e.state===`archived`||gM(e))return!1;if(n)return e.runtime!==`running`&&e.runtime!==`spawning`;if(e.needsYou||e.pendingAsk||e.runtime===`perm-prompt`||!mM(e))return!1;if(e.limitPause?.autoResume)return!0;let r=e.lastFence?.kind===`awaiting`;return n||r}function yM(e){return e.runtime===`running`||e.runtime===`spawning`?!0:e.runtime===`turn-idle`&&gM(e)}function bM(e){return e.needsYou===!0&&mM(e)}function xM(e){return e.runtime===`turn-idle`&&e.awaitingBackground===!0&&!hM(e)}function SM(e){return xM(e)?(e.bgShells??[]).some(e=>e.state===`running`)?!0:(e.watches??[]).some(e=>e.kind===`github`&&e.state===`armed`&&e.github?.checks===`running`&&e.github.state===`open`):!1}function CM(e){let t=yM(e);return e.state===`archived`&&!t?`archived`:e.actionableInteraction||e.pendingAsk||e.pendingQuestion||e.runtime===`perm-prompt`||e.humanBlocked||e.status===`needs-human`?`needs-input`:t&&!bM(e)&&!xM(e)?`working`:vM(e)?`held`:e.lastFence?.kind===`done`&&mM(e)?`done`:SM(e)?`background`:Jj(e)?`stalled`:`rest`}function wM(e){let t=CM(e);return t===`stalled`?!0:t===`held`&&e.foreign!==!0&&!!e.limitPause?.autoResume}function TM(e){return e.kind===`session`?e.state===`archived`&&!yM(e)?`inactive`:vM(e)?`held`:`active`:null}function EM(e,t=`fifo`){let n=e.filter(DM);return[...dM(e.filter(e=>!DM(e)),t),...uM(n)]}function DM(e){return e.needsYou!==!0}function OM(e){return{running:e.filter(DM),rested:e.filter(e=>!DM(e))}}function kM(e,t=`fifo`){let n={active:[],held:[],inactive:[]};for(let t of e){if(t.kind===`session`&&t.foreign===!0)continue;let e=TM(t);e&&n[e].push(t)}return n.active=EM(n.active,t),n.held=uM(n.held),n.inactive=uM(n.inactive),n}function AM(e,t){for(let n of[e,t])if(n&&Number.isFinite(Date.parse(n)))return n}function jM(e,t=Date.now()){let n=MM(e,t);return n&&`Last active ${n}`}function MM(e,t=Date.now()){let n=PM(e,t);return n===null||n===NM?n:`${n} ago`}var NM=`just now`;function PM(e,t=Date.now()){let n=e?Date.parse(e):NaN;if(!Number.isFinite(n)||!Number.isFinite(t))return null;let r=Math.max(0,Math.floor((t-n)/1e3));if(r===0)return NM;if(r<60)return`${r} ${r===1?`second`:`seconds`}`;let i=Math.floor(r/60);if(i<60)return`${i} ${i===1?`minute`:`minutes`}`;let a=Math.floor(i/60);if(a<24)return`${a} ${a===1?`hour`:`hours`}`;let o=Math.floor(a/24);if(o<7)return`${o} ${o===1?`day`:`days`}`;let s=Math.floor(o/7);if(s<5)return`${s} ${s===1?`week`:`weeks`}`;let c=Math.floor(o/30);if(c<12)return`${c} ${c===1?`month`:`months`}`;let l=Math.floor(o/365);return`${l} ${l===1?`year`:`years`}`}var FM=3e4,IM=new Set,LM=Date.now(),RM;function zM(){LM=Date.now();for(let e of IM)e();BM()}function BM(){if(IM.size===0)return;let e=FM-LM%FM;RM=setTimeout(zM,e||FM)}function VM(e){return IM.add(e),IM.size===1&&(LM=Date.now(),BM()),()=>{IM.delete(e),IM.size===0&&RM&&(clearTimeout(RM),RM=void 0)}}function HM(){return LM}function UM(){return(0,B.useSyncExternalStore)(VM,HM,HM)}function WM({size:e=15}){return(0,V.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 15 15`,"aria-hidden":!0,className:`text-muted/85`,children:[(0,V.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`14`,height:`14`,rx:`3.5`,fill:`none`,stroke:`currentColor`,strokeOpacity:`0.5`,strokeWidth:`1`}),(0,V.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`14`,height:`14`,rx:`3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`,strokeLinecap:`round`,strokeDasharray:`11 39`,children:(0,V.jsx)(`animate`,{attributeName:`stroke-dashoffset`,from:`50`,to:`0`,dur:`1.1s`,repeatCount:`indefinite`})})]})}function GM(e){return e===`running`}function KM(e,t){return e===`pending`&&t===`background`}var qM=2e3;function JM(e,t){return e===`pending`&&t===void 0}function YM(e,t,n,r){if(!JM(e,t))return!1;let i=n?Date.parse(n):NaN;return Number.isFinite(i)?r-i>=qM:!0}function XM(e){return e?.split(`
319
+ `,a)||!r.startsWith(o,a+2))break;if(a+=2+o.length,a===r.length){for(let e=t;e<=i;e++)n.add(e);break}}if(n.has(t))break}return n}function tA(e,t){if(!e?.length)return t;let n=e.filter(e=>e.queued&&!e.sourceId&&e.role===`user`&&e.text.trim());if(!n.length)return t;let r=new Set(t.map(e=>e.deliveryId).filter(e=>!!e)),i=eA(n,$k(e,t)),a=n.filter((e,t)=>!i.has(t)&&!(e.deliveryId&&r.has(e.deliveryId)));if(!a.length)return t;let o=a.filter(n=>aA(n,iA(t),iA(e)));return o.length?[...t,...o]:t}var nA=6e4,rA=new WeakMap;function iA(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.queued&&!n.sourceId)continue;let r=n.at?Date.parse(n.at):NaN;if(Number.isFinite(r))return r}return NaN}function aA(e,t,n){if(!Number.isFinite(t))return!0;let r=rA.get(e);return r===void 0?(rA.set(e,Number.isFinite(n)?n:t),aA(e,t,n)):t-r<=nA?!0:(console.warn(`[frizz] retiring a stranded optimistic send: the transcript advanced past it without ever recording it`,{text:e.text.slice(0,120),advancedMs:t-r}),!1)}var oA=new WeakMap;function sA(e){let t=oA.get(e);return t===void 0&&(t=JSON.stringify(e),oA.set(e,t)),t}function cA(e,t){if(!e?.length||!t.length)return t;let n=new Map;for(let t of e)t.sourceId&&n.set(t.sourceId,t);if(!n.size)return t;let r=!1,i=t.map(e=>{if(e===n.get(e.sourceId??``))return e;let t=e.sourceId?n.get(e.sourceId):void 0;return t&&sA(t)===sA(e)?(r=!0,t):e});return r?i:t}function lA(e,t,n){if(!e)return!1;let r=Date.parse(e);if(!Number.isFinite(r))return!1;let i=t?Date.parse(t):0;return t&&!Number.isFinite(i)?!1:r-i>n}function uA(e){if(e)for(let t=e.length-1;t>=0;t--){let n=e[t].at;if(n)return n}}function dA(e,t){let n=Math.max(0,Math.min(e.length,t));for(let t=n-1;t>=0;t--)if(e[t].role===`user`)return t;return n>0?0:null}function fA(e,t,n){if(!t)return n;let r=e.findIndex(e=>e.sourceId===t);return r>=0?r:0}function pA(e,t){let n=new Map;e.forEach((e,t)=>{e.sourceId&&n.set(e.sourceId,t)});for(let e=0;e<t.length;e++){let r=t[e].sourceId,i=r?n.get(r):void 0;if(i!==void 0)return{previousIndex:i,incomingIndex:e}}}function mA(e,t){if(!e?.historyLoaded||e.transcriptKey!==t.transcriptKey)return t;let n=pA(e.messages,t.messages);return n?{...t,messages:[...e.messages.slice(0,n.previousIndex).filter(e=>!e.pinnedFromSourceId),...t.messages.slice(n.incomingIndex)],beforeCursor:e.beforeCursor,hasEarlier:e.hasEarlier,reachedTurnBoundary:e.reachedTurnBoundary,historyLoaded:!0}:t}function hA(e,t){if(!e)return{messages:[...t]};let n=pA(e.messages,t);return n?e.historyLoaded?{...e,messages:[...e.messages.slice(0,n.previousIndex).filter(e=>!e.pinnedFromSourceId),...t.slice(n.incomingIndex)]}:{...e,messages:[...t]}:{messages:[...t]}}function gA(e,t){if(e.transcriptKey!==t.transcriptKey)return e;let n=new Set(t.messages.map(e=>e.sourceId).filter(Boolean)),r=e.messages.filter(e=>!e.pinnedFromSourceId||!n.has(e.pinnedFromSourceId)),i=new Set(r.map(e=>e.sourceId).filter(Boolean)),a=t.messages.filter(e=>!e.sourceId||!i.has(e.sourceId));return{...e,messages:[...a,...r],beforeCursor:t.beforeCursor,hasEarlier:t.hasEarlier,reachedTurnBoundary:t.reachedTurnBoundary,historyLoaded:!0}}function _A(e,t=0){if(!e)return null;let n=[...e.querySelectorAll(`[data-transcript-source-id]`)].filter(e=>e.dataset.transcriptSticky!==`true`),r=n.find(e=>e.getBoundingClientRect().bottom>t)??n[0],i=r?.dataset.transcriptSourceId;return r&&i?{sourceId:i,top:r.getBoundingClientRect().top}:null}function vA(e,t){return t-e}function yA(e,t,n){if(!e||!t)return!1;let r=[...e.querySelectorAll(`[data-transcript-source-id]`)].find(e=>e.dataset.transcriptSourceId===t.sourceId);return r?(n(vA(t.top,r.getBoundingClientRect().top)),!0):!1}function bA(e){let{remaining:t,scrollY:n,maxScrollY:r,alreadyReserved:i}=e;return!(t>.5)||r<=0||i?`settle`:n>=r-1?`reserve`:`settle`}var xA=null,SA=null,CA=null,wA=null,TA=0,EA=0,DA=!1,OA=!1,kA=!1,AA=new Map,jA=new Nk(()=>HA(),e=>{SA&&zk(SA,e)}),MA=35e3;function NA(){return`${location.origin.replace(/^http/,`ws`)}${Nx()}/ws`}var PA,FA=!1;function IA(){PA=Dx(),FA=!0}function LA(e){return FA&&PA===e}function RA(){if(xA||kA)return;Z.connection!==`open`&&(Z.connection=`connecting`),IA();let e=new WebSocket(NA()),t=Dx();xA=e,DA=!1,EA=Date.now(),e.onopen=()=>{OA=!0,EA=Date.now(),Z.connection=`open`,Z.socketTranscripts=!0,CA&&=(clearTimeout(CA),null)},e.onmessage=n=>{if(!(xA!==e||t!==Dx())){EA=Date.now();try{let e=JSON.parse(n.data),t=KA(e);t&&(TA=0),t&&e.t===`event`&&e.event.type===`board`&&(DA=!0,JA())}catch(e){console.error(`bad /ws message`,e)}}},e.onerror=()=>{},e.onclose=()=>{xA===e&&(xA=null,BA())},UA()}function zA(){let e=xA;if(xA=null,DA=!1,e){e.onopen=null,e.onmessage=null,e.onerror=null,e.onclose=null;try{e.close()}catch{}}}function BA(){if(jA.reset(),!OA){GA();return}TA++,Z.connection=TA>3?`closed`:`connecting`,VA()}function VA(e=!1){if(CA){if(!e)return;clearTimeout(CA),CA=null}let t=e?0:Math.min(1e3*2**Math.min(TA-1,4),15e3);CA=setTimeout(()=>{CA=null,RA()},t)}function HA(){jA.reset(),zA(),RA()}function UA(){if(wA)return;wA=setInterval(()=>{xA&&Date.now()-EA>MA&&WA()},1e4);let e=()=>{kA||(!xA||Date.now()-EA>MA)&&WA(!0)};window.addEventListener(`focus`,e),window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,()=>{document.hidden||e()})}function WA(e=!1){if(!kA){if(zA(),jA.reset(),!OA){GA();return}TA++,Z.connection=TA>3?`closed`:`connecting`,VA(e)}}function GA(e){kA||(kA=!0,e&&(Z.socketBoardFallback=e,Z.socketTranscriptFallbacks={}),zA(),Z.socketTranscripts=!1,Qk(SA??void 0))}function KA(e){switch(e.t){case`event`:return jA.handle(e.event),e.event.type===`board`&&(Z.socketBoardFallback=null),!0;case`transcript`:return SA?.setQueryData([`transcript`,e.slug],t=>{let n=hA(t,e.messages);return{...n,messages:cA(t?.messages,tA(t?.messages,n.messages))}}),delete Z.socketTranscriptFallbacks[e.slug],!0;case`payload-too-large`:return e.channel===`board`?(Z.socketBoardFallback||console.warn(`[frizz] live board payload exceeded the socket limit; using SSE`,{actualBytes:e.actualBytes,maxBytes:e.maxBytes}),GA({actualBytes:e.actualBytes,maxBytes:e.maxBytes})):(Z.socketTranscriptFallbacks[e.slug]||console.warn(`[frizz] live transcript payload exceeded the socket limit; updates paused`,{slug:e.slug,actualBytes:e.actualBytes,maxBytes:e.maxBytes}),Z.socketTranscriptFallbacks[e.slug]={kind:`payload-too-large`,actualBytes:e.actualBytes,maxBytes:e.maxBytes}),!1;case`resource-limited`:return Z.socketTranscriptFallbacks[e.slug]||console.warn(`[frizz] live transcript read budget reached; updates paused`,{slug:e.slug,scope:e.scope,retryAfterMs:e.retryAfterMs}),Z.socketTranscriptFallbacks[e.slug]={kind:`read-budget`,scope:e.scope,retryAfterMs:e.retryAfterMs},!1;case`hb`:return!0}}function qA(e){DA&&xA&&xA.readyState===WebSocket.OPEN&&xA.send(JSON.stringify(e))}function JA(){for(let e of AA.keys())Z.socketTranscriptFallbacks[e]||qA({t:`sub`,topic:`transcript`,slug:e})}function YA(e){let t=(AA.get(e)??0)+1;AA.set(e,t),t===1&&!Z.socketTranscriptFallbacks[e]&&qA({t:`sub`,topic:`transcript`,slug:e})}function XA(e){let t=(AA.get(e)??0)-1;t<=0?(AA.delete(e),qA({t:`unsub`,topic:`transcript`,slug:e})):AA.set(e,t)}function ZA(e){Z.socketTranscriptFallbacks[e]&&(delete Z.socketTranscriptFallbacks[e],AA.has(e)&&qA({t:`sub`,topic:`transcript`,slug:e}))}function QA(){AA.clear(),jA.reset(),zA(),Z.connection=`connecting`,IA(),kA?Zk():RA()}function $A(e){SA=e,IA();let t=()=>RA();document.readyState===`complete`?t():window.addEventListener(`load`,t,{once:!0})}function ej(){return Hf(Z).board}function tj(){return Hf(Z).board?.projectDir}function nj(e){return e}function rj(e){if(!(!e||e.kind!==`session`||e.foreign||!e.sessionId))return{slug:e.id,sessionId:e.sessionId}}function ij(e){let t=rj(e);if(!(!t||e?.pendingInteraction===!1))return t}function aj(e,t=Date.now()){let n=1/0;for(let t of e){if(!t.expiresAt)continue;let e=Date.parse(t.expiresAt);Number.isFinite(e)&&(n=Math.min(n,e))}return Number.isFinite(n)?Math.max(250,n-t+50):!1}function oj(e){let t=ij(e);return qd({queryKey:t?Fk(t.slug,t.sessionId):[`interactions`,`pending`,`unowned`],queryFn:()=>X.pendingInteractions(t),enabled:t!==void 0,refetchInterval:e=>aj(e.state.data?.interactions??[]),refetchOnReconnect:!0,refetchOnWindowFocus:!0})}var sj=7e3,cj=5e3,lj=3;function uj(e,t){let n=Md(),r=Hf(Z),i=r.socketTranscripts,a=r.socketTranscriptFallbacks[e],o=qd({queryKey:[`transcript`,e],queryFn:async()=>{let t=await X.threadTranscript({slug:e}),r=n.getQueryData([`transcript`,e]),i=mA(r,t);return{...i,messages:cA(r?.messages,tA(r?.messages,i.messages))}},refetchInterval:t.poll&&!i&&!a?1500:!1,refetchOnWindowFocus:!a});return(0,B.useEffect)(()=>{if(!t.poll&&!i||a)return;let r=!1,s=0,c,l=setInterval(()=>{if(r)return;let t=sC(Z.board,e)?.lastActivityAt,a=uA(n.getQueryData([`transcript`,e])?.messages);if(!lA(t,a,cj)){s=0;return}if(a!==c&&(s=0),s>=lj)return;s++,c=a;let l=t?Date.parse(t)-(a?Date.parse(a):0):0;console.warn(`[frizz] transcript watchdog: stale view — self-healing`,{slug:e,lagMs:l,transport:i?`socket`:`poll`,attempt:s}),i&&(XA(e),YA(e)),r=!0,o.refetch().finally(()=>{r=!1})},sj);return()=>clearInterval(l)},[e,t.poll,i,a]),{...o,transportFallback:a?a.kind===`payload-too-large`?{kind:`payload-too-large`,actualBytes:a.actualBytes,maxBytes:a.maxBytes}:{kind:`read-budget`,scope:a.scope,retryAfterMs:a.retryAfterMs}:null,retryLiveUpdates:()=>ZA(e)}}function dj(e,t){return qd({queryKey:[`subAgentTranscript`,e,t],queryFn:()=>X.subAgentTranscript({slug:e,id:t}),refetchInterval:e=>e.state.data?.state===`running`?2500:!1})}function fj(e,t){return qd({queryKey:[`backgroundShellOutput`,e,t],queryFn:()=>X.backgroundShellOutput({slug:e,id:t}),refetchInterval:e=>e.state.data?.state===`running`?1500:!1})}function pj(e,t){let n=[...t].sort(),r=qd({queryKey:[`backgroundShellActivity`,e,n],queryFn:()=>X.backgroundShellActivity({slug:e,ids:n}),enabled:n.length>0,refetchInterval:e=>e.state.data&&!e.state.data.shells.some(e=>e.running)?!1:1500});return(0,B.useMemo)(()=>new Map((r.data?.shells??[]).flatMap(e=>e.lines===null?[]:[[e.id,e.lines]])),[r.data])}function mj(e,t,n,r={}){e.setQueryData([`transcript`,t],e=>{let t=e?.messages??[];return{...e,messages:[...t,{role:`user`,text:n,tools:[],parts:[],queued:!0,deliveryId:r.deliveryId}]}}),r.scrollToBottom!==!1&&typeof window<`u`&&requestAnimationFrame(()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:`smooth`}))}function hj(e,t,n,r){e.setQueryData([`transcript`,t],e=>{if(!e?.messages?.length)return e;let t=e.messages.findLastIndex(e=>e.queued&&e.role===`user`&&e.text===n&&(r===void 0||e.deliveryId===r));return t===-1?e:{...e,messages:e.messages.filter((e,n)=>n!==t)}})}function gj(){let e=nC();return e?`/thread/${encodeURIComponent(e)}`:Z.routeThreadSlug?`/thread/${encodeURIComponent(Z.routeThreadSlug)}`:Z.view.startsWith(`status:`)?`/status/${encodeURIComponent(Z.view.slice(7))}`:`/`}function _j(e){try{return decodeURIComponent(e)}catch{return null}}function vj(e,t=Z.board?.projectSlug){let n=jx(e);return n===`/`&&t?Ox(t):n}function yj(e){let t=e.match(/^\/thread\/([^/]+)$/);if(t){let e=_j(t[1]);if(e===null){Z.routeThreadSlug=null,tC(Z.drawers.map(e=>e.id)),Z.view=`todos`;return}Z.view=`todos`;let n=Z.drawers.findIndex(t=>t.kind===`thread`&&t.slug===e&&!t.closing);if(n!==-1){Z.routeThreadSlug=null,tC(Z.drawers.slice(n+1).map(e=>e.id));return}Z.routeThreadSlug=e;return}let n=e.match(/^\/status\/([^/]+)$/);if(n){Z.routeThreadSlug=null,tC(Z.drawers.map(e=>e.id));let e=_j(n[1]);Z.view=e===null?`todos`:`status:${e}`;return}Z.routeThreadSlug=null,tC(Z.drawers.map(e=>e.id)),Z.view=`todos`}function bj(e=location.pathname){yj(Ax(e))}function xj(e){return bj(),zf(Z,()=>{let t=vj(gj());t!==location.pathname&&e(t,{replace:!gj().startsWith(`/thread/`)})})}function Sj(e,t){if(!t)return e;let n=e.projectDir!==t.projectDir,r=t.threads.length>0;return{projectDir:t.projectDir,hasBeenVisible:n?r:e.hasBeenVisible||r}}var Cj=3600*1e3,wj=24*Cj,Tj=[{value:`1h`,label:`1 hour`,detail:`60 minutes`,kind:`duration`},{value:`tomorrow`,label:`tomorrow`,detail:`9am`,kind:`calendar`},{value:`1d`,label:`1 day`,detail:`24 hours`,kind:`duration`},{value:`3d`,label:`3 days`,detail:`72 hours`,kind:`duration`},{value:`1w`,label:`1 week`,detail:`7 days`,kind:`duration`}],Ej=new Set(Tj.map(e=>e.value));function Dj(e){return typeof e==`string`&&Ej.has(e)}function Oj(e){return kj(e).label}function kj(e){return Tj.find(t=>t.value===e)??Tj[2]}function Aj(e){let t=kj(e);return t.kind===`calendar`?`Snooze until ${t.label}`:`Snooze ${t.label}`}function jj(e,t=Date.now()){if(e===`tomorrow`){let e=new Date(t);return new Date(e.getFullYear(),e.getMonth(),e.getDate()+1,9,0,0,0).toISOString()}return new Date(t+(e===`1h`?Cj:e===`1d`?wj:e===`3d`?3*wj:7*wj)).toISOString()}function Mj(e){return String(e).padStart(2,`0`)}function Nj(e){return`${e.getFullYear()}-${Mj(e.getMonth()+1)}-${Mj(e.getDate())}T${Mj(e.getHours())}:${Mj(e.getMinutes())}`}function Pj(e,t=Date.now()){let n=/^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})$/.exec(e);if(!n)return{ok:!1,message:`Choose a local date and time`};let[,r,i,a,o,s]=n,c=[r,i,a,o,s].map(Number),l=new Date(c[0],c[1]-1,c[2],c[3],c[4],0,0);return!Number.isFinite(l.getTime())||l.getFullYear()!==c[0]||l.getMonth()!==c[1]-1||l.getDate()!==c[2]||l.getHours()!==c[3]||l.getMinutes()!==c[4]?{ok:!1,message:`That local time does not exist`}:l.getTime()<=t?{ok:!1,message:`Choose a time in the future`}:{ok:!0,until:l.toISOString()}}function Fj(e,t=Date.now()){let n=new Date(e);if(!Number.isFinite(n.getTime()))return``;let r=new Date(t),i=new Date(r.getFullYear(),r.getMonth(),r.getDate()).getTime(),a=new Date(n.getFullYear(),n.getMonth(),n.getDate()).getTime(),o=Math.round((a-i)/wj),s=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);if(o===0)return`Today at ${s}`;if(o===1)return`Tomorrow at ${s}`;if(o>1&&o<7)return`${new Intl.DateTimeFormat(void 0,{weekday:`long`}).format(n)} at ${s}`;let c={month:`short`,day:`numeric`};return n.getFullYear()!==r.getFullYear()&&(c.year=`numeric`),`${new Intl.DateTimeFormat(void 0,c).format(n)} at ${s}`}function Ij(e,t){if(!Number.isFinite(Date.parse(e)))return null;let n=Fj(e,t);return n?n.replace(/^(Today|Tomorrow)/,e=>e.toLowerCase()):null}function Lj(e,t=Date.now()){let n=Ij(e,t);return n?`Snoozed until ${n}`:null}var Rj=120;function zj(e,t=Rj){let n=e.trim().replace(/\s+/g,` `);return n.length>t?`${n.slice(0,t-1)}…`:n}function Bj(e,t,n=Date.now()){let r=t?.trim();if(!r)return Lj(e,n);let i=Vj(e,n);return i?`${i} — then: ${zj(r)}`:null}function Vj(e,t=Date.now()){let n=Ij(e,t);return n?`Auto-snoozed until ${n}`:null}var Hj=`frizz.prefs.v1`;function Uj(e,t){return typeof e==`boolean`?e:e===`off`?!1:e===`compact`||e===`full`?!0:t}function Wj(e,t){return e===`fifo`||e===`lifo`?e:t}function Gj(e){let t={compactDiffs:!0,snoozePreset:`1d`,stickyUserMessage:!1,queueOrder:`fifo`,diffsRedefaulted:!0,stickyRedefaulted:!0};try{if(!e)return t;let n=JSON.parse(e);return n.diffsRedefaulted||=(n.compactDiffs=!0,!0),n.stickyRedefaulted||=(n.stickyUserMessage=!1,!0),{...t,...n,snoozePreset:Dj(n.snoozePreset)?n.snoozePreset:t.snoozePreset,stickyUserMessage:Uj(n.stickyUserMessage,t.stickyUserMessage),queueOrder:Wj(n.queueOrder,t.queueOrder)}}catch{return t}}function Kj(){try{return Gj(typeof localStorage>`u`?null:localStorage.getItem(Hj))}catch{return Gj(null)}}var qj=Rf(Kj());zf(qj,()=>{try{typeof localStorage<`u`&&localStorage.setItem(Hj,JSON.stringify(qj))}catch{}});function Jj(e){return e.kind===`session`&&e.foreign!==!0&&e.runtime===`exited`}var Yj=xy.options,Xj={planning:`text-sky-400 border-sky-400/40`,planned:`text-violet-400 border-violet-400/40`,active:`text-emerald-400 border-emerald-400/40`,"needs-human":`text-yellow-400 border-yellow-400/40`,blocked:`text-orange-400 border-orange-400/40`,done:`text-zinc-400 border-zinc-400/40`,dismissed:`text-rose-400 border-rose-400/40`,archived:`text-slate-500 border-slate-500/40`};function Zj(e){return e.foreign===!0&&e.title.trim()?e.title.trim():iM(e)?eM:e.aiTitle?.trim()&&!Qj(e)?$j(e.aiTitle):e.backend===`codex`&&e.titleAuto===!0&&!e.aiTitle?.trim()?tM:e.titleAuto===!1&&e.title.trim()?e.title:e.title.trim()&&!(e.titleAuto===!0&&e.title.trim()===e.id)?e.titleAuto===!0?$j(e.title):e.title.trim():e.titleAuto===!0?tM:e.id}function Qj(e){return e.titleLocked??e.titleAuto===!1}function $j(e){let t=e.trim();if(!/^[a-z0-9]+(?:[-_][a-z0-9]+)*$/i.test(t))return t;let n=t.split(/[-_]+/).filter(Boolean);if(n.length===0)return t;let r=n.join(` `).toLowerCase();return r.charAt(0).toUpperCase()+r.slice(1)}var eM=`Spinning up a thread…`,tM=`Untitled thread`,nM=6e4,rM=15e3;function iM(e){if(!e.titleAuto||e.aiTitle)return!1;if(e.backend===`codex`){if(e.runtime===`spawning`)return!0;let t=Date.parse(e.spawnedAt??``);return Number.isFinite(t)&&Date.now()-t<rM}let t=Date.parse(e.spawnedAt??``);return Number.isFinite(t)&&Date.now()-t<nM}function aM(e){return e.status===`done`||e.status===`dismissed`?!1:!!(e.runtime===`perm-prompt`||e.pendingAsk||e.humanBlocked&&e.runtime!==`none`&&e.runtime!==`running`&&e.runtime!==`spawning`||e.pendingQuestion&&e.runtime!==`running`&&e.runtime!==`spawning`||(e.status===`active`||e.status===`planning`)&&(e.runtime===`exited`||e.runtime===`none`)&&e.spawnedAt&&!e.archived)}function oM(e){let t=Date.parse(e.lastUserAt??``),n=Date.parse(e.spawnedAt??``),r=Math.max(Number.isFinite(t)?t:-1/0,Number.isFinite(n)?n:-1/0);return Number.isFinite(r)?r:0}function sM(e){if(yM(e))return oM(e);let t=Date.parse(e.lastAssistantAt??``);return Number.isFinite(t)?t:oM(e)}function cM(e){return yM(e)?e.lastActivityAt??e.spawnedAt:e.lastAssistantAt??e.lastActivityAt??e.spawnedAt}function lM(e){return[...e].sort((e,t)=>{let n=aM(e);if(n!==aM(t))return n?-1:1;let r=sM(t)-sM(e);return r===0?e.id.localeCompare(t.id):r})}function uM(e){return[...e].sort((e,t)=>{let n=sM(t)-sM(e);return n===0?e.id.localeCompare(t.id):n})}function dM(e,t=`fifo`){let n=t===`lifo`?-1:1;return[...e].sort((e,t)=>{let r=(sM(e)-sM(t))*n;return r===0?e.id.localeCompare(t.id):r})}function fM(e){return xb(e)}function pM(e){return e.filter(e=>e.kind===`session`&&e.foreign===!0)}function mM(e){return e.runtime===`turn-idle`||e.runtime===`exited`}function hM(e){return(e.subAgents??[]).some(e=>Oy(e)&&e.state===`running`)}function gM(e){return hM(e)||e.awaitingBackground===!0}function _M(e,t=Date.now()){let n=Date.parse(e.snoozedUntil??``);return Number.isFinite(n)&&n>t?e.snoozedUntil:void 0}function vM(e,t=Date.now()){let n=_M(e,t)!==void 0;if(e.state===`archived`||gM(e))return!1;if(n)return e.runtime!==`running`&&e.runtime!==`spawning`;if(e.needsYou||e.pendingAsk||e.runtime===`perm-prompt`||!mM(e))return!1;if(e.limitPause?.autoResume)return!0;let r=e.lastFence?.kind===`awaiting`;return n||r}function yM(e){return e.runtime===`running`||e.runtime===`spawning`?!0:e.runtime===`turn-idle`&&gM(e)}function bM(e){return e.needsYou===!0&&mM(e)}function xM(e){return e.runtime===`turn-idle`&&e.awaitingBackground===!0&&!hM(e)}function SM(e){return xM(e)?(e.bgShells??[]).some(e=>e.state===`running`)?!0:(e.watches??[]).some(e=>e.kind===`github`&&e.state===`armed`&&e.github?.checks===`running`&&e.github.state===`open`):!1}function CM(e){let t=yM(e);return e.state===`archived`&&!t?`archived`:e.actionableInteraction||e.pendingAsk||e.pendingQuestion||e.runtime===`perm-prompt`||e.humanBlocked||e.status===`needs-human`?`needs-input`:t&&!bM(e)&&!xM(e)?`working`:vM(e)?`held`:e.lastFence?.kind===`done`&&mM(e)?`done`:SM(e)?`background`:Jj(e)?`stalled`:`rest`}function wM(e){let t=CM(e);return t===`stalled`?!0:t===`held`&&e.foreign!==!0&&!!e.limitPause?.autoResume}function TM(e){return e.kind===`session`?e.state===`archived`&&!yM(e)?`inactive`:vM(e)?`held`:`active`:null}function EM(e,t=`fifo`){let n=e.filter(DM);return[...dM(e.filter(e=>!DM(e)),t),...uM(n)]}function DM(e){return e.needsYou!==!0}function OM(e){return{running:e.filter(DM),rested:e.filter(e=>!DM(e))}}function kM(e,t=`fifo`){let n={active:[],held:[],inactive:[]};for(let t of e){if(t.kind===`session`&&t.foreign===!0)continue;let e=TM(t);e&&n[e].push(t)}return n.active=EM(n.active,t),n.held=uM(n.held),n.inactive=uM(n.inactive),n}function AM(e,t){for(let n of[e,t])if(n&&Number.isFinite(Date.parse(n)))return n}function jM(e,t=Date.now()){let n=MM(e,t);return n&&`Last active ${n}`}function MM(e,t=Date.now()){let n=PM(e,t);return n===null||n===NM?n:`${n} ago`}var NM=`just now`;function PM(e,t=Date.now()){let n=e?Date.parse(e):NaN;if(!Number.isFinite(n)||!Number.isFinite(t))return null;let r=Math.max(0,Math.floor((t-n)/1e3));if(r===0)return NM;if(r<60)return`${r} ${r===1?`second`:`seconds`}`;let i=Math.floor(r/60);if(i<60)return`${i} ${i===1?`minute`:`minutes`}`;let a=Math.floor(i/60);if(a<24)return`${a} ${a===1?`hour`:`hours`}`;let o=Math.floor(a/24);if(o<7)return`${o} ${o===1?`day`:`days`}`;let s=Math.floor(o/7);if(s<5)return`${s} ${s===1?`week`:`weeks`}`;let c=Math.floor(o/30);if(c<12)return`${c} ${c===1?`month`:`months`}`;let l=Math.floor(o/365);return`${l} ${l===1?`year`:`years`}`}var FM=3e4,IM=new Set,LM=Date.now(),RM;function zM(){LM=Date.now();for(let e of IM)e();BM()}function BM(){if(IM.size===0)return;let e=FM-LM%FM;RM=setTimeout(zM,e||FM)}function VM(e){return IM.add(e),IM.size===1&&(LM=Date.now(),BM()),()=>{IM.delete(e),IM.size===0&&RM&&(clearTimeout(RM),RM=void 0)}}function HM(){return LM}function UM(){return(0,B.useSyncExternalStore)(VM,HM,HM)}function WM({size:e=15}){return(0,V.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 15 15`,"aria-hidden":!0,className:`text-muted/85`,children:[(0,V.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`14`,height:`14`,rx:`3.5`,fill:`none`,stroke:`currentColor`,strokeOpacity:`0.5`,strokeWidth:`1`}),(0,V.jsx)(`rect`,{x:`0.5`,y:`0.5`,width:`14`,height:`14`,rx:`3.5`,fill:`none`,stroke:`currentColor`,strokeWidth:`1`,strokeLinecap:`round`,strokeDasharray:`11 39`,children:(0,V.jsx)(`animate`,{attributeName:`stroke-dashoffset`,from:`50`,to:`0`,dur:`1.1s`,repeatCount:`indefinite`})})]})}function GM(e){return e===`running`}function KM(e,t){return e===`pending`&&t===`background`}var qM=2e3;function JM(e,t){return e===`pending`&&t===void 0}function YM(e,t,n,r){if(!JM(e,t))return!1;let i=n?Date.parse(n):NaN;return Number.isFinite(i)?r-i>=qM:!0}function XM(e){return e?.split(`
320
320
  `).find(e=>e.trim())?.trim().replace(/\s+/g,` `)||void 0}function ZM(e,t){if(e.name===`Interrupt process`||e.status===`cancelled`||e.backgroundState!==`background`)return;let n=new Set([XM(e.desc),XM(e.detail),XM(e.command)].filter(e=>!!e));if(n.size===0)return;let r=t.filter(e=>n.has(XM(e.label)??``));return r.some(e=>e.state===`running`)?`running`:r.some(e=>e.state===`stale`)?`stale`:void 0}function QM(e){if(e<1)return`<1 ms`;if(e<1e3)return`${Math.round(e)} ms`;if(e<6e4)return`${e<1e4?(e/1e3).toFixed(1):Math.round(e/1e3)} sec`;let t=Math.floor(e/6e4),n=Math.round(e%6e4/1e3);return n?`${t} min ${n} sec`:`${t} min`}function $M(e){return e<1?`just now`:e<60?`${e} min`:`${Math.floor(e/60)} hr ${e%60} min`}function eN(e){if(!Number.isFinite(e)||e<0)return``;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60),i=n%60;return i?`${r}hr ${i}m`:`${r}hr`}function tN(e){if(!Number.isFinite(e)||e<0)return``;let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60);if(n<60)return`${n}m`;let r=Math.floor(n/60);if(r<24)return n%60?`${r}h ${n%60}m`:`${r}h`;let i=Math.floor(r/24);if(i<7)return r%24?`${i}d ${r%24}h`:`${i}d`;let a=Math.floor(i/7);return i%7?`${a}w ${i%7}d`:`${a}w`}function nN(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);return Number.isFinite(n)?eN(t-n):``}function rN(e){if(!Number.isFinite(e)||e<0)return``;let t=Math.floor(e/6e4);return t<1?`<1 min`:$M(t)}function iN(e){if(!Number.isFinite(e)||e<=0)return`0s`;let t=e=>String(e).padStart(2,`0`),n=Math.ceil(e/1e3);if(n<60)return`${n}s`;let r=Math.floor(n/60);if(r<60)return`${r}m ${t(n%60)}s`;let i=Math.floor(r/60);if(i<24)return`${i}h ${t(r%60)}m`;let a=Math.floor(i/24);if(a<7)return i%24?`${a}d ${i%24}h`:`${a}d`;let o=Math.floor(a/7);return a%7?`${o}w ${a%7}d`:`${o}w`}function aN(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);return Number.isFinite(n)?$M(Math.floor((t-n)/6e4)):``}function oN(e,t=Date.now()){if(!e)return``;let n=Date.parse(e);if(!Number.isFinite(n))return``;let r=Math.floor((t-n)/6e4);return r<1?`just now`:`${$M(r)} ago`}var sN=`shrink-0 text-[11px] leading-none text-muted/45`,cN=`block h-1.5 w-1.5 rounded-full bg-muted/30`,lN=`stale — no recent output`,uN=`block h-1.5 w-1.5 rounded-full border border-muted/45`,dN=`rested — it stopped, but the work it launched is still running`,fN=`running — no recent output`,pN={AGENT:`Open sub-agent transcript`,SHELL:`Open background shell output`,GITHUB:`Open this pull request on GitHub`};function mN(e){if(!(typeof e!=`number`||!Number.isFinite(e)||e<0))return e===1?`1 line`:`${hN(e)??`0`} lines`}function hN(e){if(typeof e!=`number`||!Number.isFinite(e)||e<=0)return;let t=(e,t)=>`${e<100?e.toFixed(1).replace(/\.0$/,``):Math.round(e)}${t}`;return e<1e3?String(Math.round(e)):e<1e6?t(e/1e3,`k`):t(e/1e6,`M`)}var gN={running:`Stop — end this operation and everything it spawned, then clear the row`,settled:`Clear — stop tracking this finished operation`},_N={running:`Stop`,settled:`Clear`},vN={AGENT:`sub-agent`,SHELL:`background shell`,GITHUB:`PR watcher`};function yN(e,t){let n=new Map;for(let t of e){if(!t.parentId)continue;let e=n.get(t.parentId);e?e.push(t):n.set(t.parentId,[t])}let r=[],i=new Set([t]),a=(e,t)=>{for(let o of n.get(e)??[])o.id&&i.has(o.id)||(o.id&&i.add(o.id),r.push({...o,displayDepth:t}),o.id&&a(o.id,t+1))};return a(t,1),r}var bN=e=>e.state===`running`||e.state===`stale`||e.state===`rested`;function xN(e,t){return t===`card`?e.filter(bN):t===`rail`?e.filter(e=>!!e.id&&bN(e)):e}var SN=e=>{let t=e.launchId??e.id;return[...t?[`id:${t}`]:[],...e.command?[`cmd:${e.command}`]:[],`launch:${e.label}\u0000${e.startedAt??``}`]};function CN(e,t){let n=[...e],r=new Set(n.flatMap(SN));for(let e of t)SN(e).some(e=>r.has(e))||n.push(e);return n}function wN({kind:e,label:t,state:n,density:r,depth:i,startedAt:a,counter:o,counterTitle:s,parentSlug:c,onOpen:l,onDismiss:u,title:d}){let f=GM(n),p={AGENT:`frizz-live-dot--agent`,SHELL:`frizz-live-dot--shell`,GITHUB:`frizz-live-dot--github`},m={AGENT:`AGENT`,SHELL:`SHELL`,GITHUB:`WATCH`},h=!!l,g=r===`rail`,_=r===`sheet`,v=nN(a,UM()),y=Math.min(Math.max((i??1)-1,0),4)*13,b=f?`running`:`settled`,x=pN[e],S=d??(h?x:void 0),C=n===`rested`?(0,V.jsx)(`span`,{className:uN,title:dN}):(0,V.jsx)(`span`,{className:cN,title:lN}),w=g?(0,V.jsx)(`span`,{className:`flex w-3.5 shrink-0 items-center justify-center`,children:f?(0,V.jsx)(WM,{size:12}):C}):(0,V.jsx)(`span`,{className:`frizz-op-dot-slot flex w-[9px] shrink-0 justify-center`,children:f?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot ${p[e]}`,"data-running-indicator":r===`card`?`queue-subagent`:`operation`}):e===`SHELL`?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot-quiet frizz-live-dot-quiet--shell`,"data-running-indicator":`operation-quiet`,title:fN}):C}),T=o||v?(0,V.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 pl-1.5 text-muted/40`,children:[o&&(0,V.jsx)(`span`,{"data-child-op-counter":!0,title:s,children:o}),o&&v&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`text-muted/25`,children:`·`}),v&&(0,V.jsx)(`span`,{title:`Working for ${v}`,children:v})]}):null,E=(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":!0,className:sN,children:`⤷`}),w,_&&(0,V.jsx)(`span`,{className:`petite-caps shrink-0 text-[9.5px] text-muted/45`,children:m[e]}),(0,V.jsx)(`span`,{className:`min-w-0 truncate text-muted/70 ${g?`leading-[16px]`:h?`group-hover:text-fg/80 group-hover:underline`:``}`,children:t})]}),D=g?`group flex min-w-0 items-center gap-2 pl-[26px] text-left outline-none`:`group flex min-w-0 max-w-[60%] items-center gap-1.5 overflow-hidden text-left text-[11.5px] ${h?`cursor-pointer rounded-sm outline-none transition-colors focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`:``}`,O=g&&y>0?{paddingLeft:26+y}:void 0,k=h?(0,V.jsx)(`button`,{type:`button`,style:O,onClick:l,onMouseDown:_?e=>e.stopPropagation():void 0,title:S,"aria-label":`${x}: ${t}`,className:D,children:E}):(0,V.jsx)(`div`,{style:O,title:S,className:D,children:E});return(0,V.jsxs)(`div`,{className:g?`flex w-full min-w-0 items-center gap-1.5 rounded-md py-0.5 pr-1.5 text-[11.5px] transition-colors hover:bg-white/[0.04]`:`flex min-w-0 items-center gap-1.5 text-[11.5px]`,style:!g&&y>0?{marginLeft:y}:void 0,"data-op-row":u?``:void 0,"data-subagent-depth":i&&i>1?i:void 0,"data-subagent-parent":c,children:[k,u&&(0,V.jsx)(`button`,{type:`button`,onClick:u,onMouseDown:e=>e.stopPropagation(),title:gN[b],"aria-label":`${_N[b]} ${vN[e]}: ${t}`,className:`shrink-0 rounded-sm p-0.5 text-muted/45 outline-none transition-colors hover:text-fg focus-visible:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:(0,V.jsx)(Pw,{size:11})}),T]})}function TN(e,t,n=`AGENT`){let r=n===`SHELL`?`Background shell`:`Sub-agent`;X.stopBackgroundOp({slug:e,id:t}).then(({stopped:e,note:t,descendantsStopped:i})=>{if(e){if(t)return Q(`${r} stopped. ${t}`,{duration:7e3});if(n===`SHELL`)return Q(`Background shell stopped — the worker was told`);Q(i>0?`Sub-agent and ${i} descendant${i===1?``:`s`} stopped`:`Sub-agent stopped`)}}).catch(e=>{Q(`Couldn’t stop: ${(e instanceof Error?e.message:String(e)).slice(0,100)}`,{duration:7e3})})}function EN(e,t,n=`AGENT`){if(!t.id||!Oy(t)||t.state===`running`&&!t.stoppable)return;let r=t.id;return()=>TN(e,r,n)}typeof window<`u`&&window.document&&window.document.createElement;function DN(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function ON(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function kN(...e){return t=>{let n=!1,r=e.map(e=>{let r=ON(e,t);return!n&&typeof r==`function`&&(n=!0),r});if(n)return()=>{for(let t=0;t<r.length;t++){let n=r[t];typeof n==`function`?n():ON(e[t],null)}}}}function AN(...e){return B.useCallback(kN(...e),e)}function jN(e,t=[]){let n=[];function r(t,r){let i=B.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=B.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o){let s=o?.[e]?.[a]||i,c=B.useContext(s);if(c)return c;if(r!==void 0)return r;throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>B.createContext(e));return function(n){let r=n?.[e]||t;return B.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,MN(i,...t)]}function MN(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var NN=globalThis?.document?B.useLayoutEffect:()=>{},PN=B.useEffectEvent,FN=B.useInsertionEffect;function IN(e){if(typeof PN==`function`)return PN(e);let t=B.useRef(()=>{throw Error(`Cannot call an event handler while rendering.`)});return typeof FN==`function`?FN(()=>{t.current=e}):NN(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}var LN=B.useInsertionEffect||NN;function RN({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){let[i,a,o]=zN({defaultProp:t,onChange:n}),s=e!==void 0,c=s?e:i;{let t=B.useRef(e!==void 0);B.useEffect(()=>{let e=t.current;e!==s&&console.warn(`${r} is changing from ${e?`controlled`:`uncontrolled`} to ${s?`controlled`:`uncontrolled`}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),t.current=s},[s,r])}return[c,B.useCallback(t=>{if(s){let n=BN(t)?t(e):t;n!==e&&o.current?.(n)}else a(t)},[s,e,a,o])]}function zN({defaultProp:e,onChange:t}){let[n,r]=B.useState(e),i=B.useRef(n),a=B.useRef(t);return LN(()=>{a.current=t},[t]),B.useEffect(()=>{i.current!==n&&(a.current?.(n),i.current=n)},[n,i]),[n,r,a]}function BN(e){return typeof e==`function`}function VN(e){let t=B.forwardRef((t,n)=>{let{children:r,...i}=t,a=null,o=!1,s=[];YN(r)&&typeof $N==`function`&&(r=$N(r._payload)),B.Children.forEach(r,e=>{if(qN(e)){o=!0;let t=e,n=`child`in t.props?t.props.child:t.props.children;YN(n)&&typeof $N==`function`&&(n=$N(n._payload)),a=WN(t,n),s.push(a?.props?.children)}else s.push(e)}),a?a=B.cloneElement(a,void 0,s):!o&&B.Children.count(r)===1&&B.isValidElement(r)&&(a=r);let c=a?KN(a):void 0,l=AN(n,c);if(!a){if(r||r===0)throw Error(o?QN(e):ZN(e));return r}let u=GN(i,a.props??{});return a.type!==B.Fragment&&(u.ref=n?l:c),B.cloneElement(a,u)});return t.displayName=`${e}.Slot`,t}var HN=Symbol.for(`radix.slottable`);function UN(e){let t=e=>`child`in e?e.children(e.child):e.children;return t.displayName=`${e}.Slottable`,t.__radixId=HN,t}var WN=(e,t)=>{if(`child`in e.props){let t=e.props.child;return B.isValidElement(t)?B.cloneElement(t,void 0,e.props.children(t.props.children)):null}return B.isValidElement(t)?t:null};function GN(e,t){let n={...t};for(let r in t){let i=e[r],a=t[r];/^on[A-Z]/.test(r)?i&&a?n[r]=(...e)=>{let t=a(...e);return i(...e),t}:i&&(n[r]=i):r===`style`?n[r]={...i,...a}:r===`className`&&(n[r]=[i,a].filter(Boolean).join(` `))}return{...e,...n}}function KN(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function qN(e){return B.isValidElement(e)&&typeof e.type==`function`&&`__radixId`in e.type&&e.type.__radixId===HN}var JN=Symbol.for(`react.lazy`);function YN(e){return typeof e==`object`&&!!e&&`$$typeof`in e&&e.$$typeof===JN&&`_payload`in e&&XN(e._payload)}function XN(e){return typeof e==`object`&&!!e&&`then`in e}var ZN=e=>`${e} failed to slot onto its children. Expected a single React element child or \`Slottable\`.`,QN=e=>`${e} failed to slot onto its \`Slottable\`. Expected \`Slottable\` to receive a single React element child.`,$N=B.use,eP=[`a`,`button`,`div`,`form`,`h2`,`h3`,`img`,`input`,`label`,`li`,`nav`,`ol`,`p`,`select`,`span`,`svg`,`ul`].reduce((e,t)=>{let n=VN(`Primitive.${t}`),r=B.forwardRef((e,r)=>{let{asChild:i,...a}=e,o=i?n:t;return typeof window<`u`&&(window[Symbol.for(`radix-ui`)]=!0),(0,V.jsx)(o,{...a,ref:r})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function tP(e,t){e&&Xd.flushSync(()=>e.dispatchEvent(t))}function nP(e){let t=e+`CollectionProvider`,[n,r]=jN(t),[i,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),o=e=>{let{scope:t,children:n}=e,r=B.useRef(null),a=B.useRef(new Map).current;return(0,V.jsx)(i,{scope:t,itemMap:a,collectionRef:r,children:n})};o.displayName=t;let s=e+`CollectionSlot`,c=VN(s),l=B.forwardRef((e,t)=>{let{scope:n,children:r}=e,i=AN(t,a(s,n).collectionRef);return(0,V.jsx)(c,{ref:i,children:r})});l.displayName=s;let u=e+`CollectionItemSlot`,d=`data-radix-collection-item`,f=VN(u),p=B.forwardRef((e,t)=>{let{scope:n,children:r,...i}=e,o=B.useRef(null),s=AN(t,o),c=a(u,n);return B.useEffect(()=>(c.itemMap.set(o,{ref:o,...i}),()=>void c.itemMap.delete(o))),(0,V.jsx)(f,{[d]:``,ref:s,children:r})});p.displayName=u;function m(t){let n=a(e+`CollectionConsumer`,t);return B.useCallback(()=>{let e=n.collectionRef.current;if(!e)return[];let t=Array.from(e.querySelectorAll(`[${d}]`));return Array.from(n.itemMap.values()).sort((e,n)=>t.indexOf(e.ref.current)-t.indexOf(n.ref.current))},[n.collectionRef,n.itemMap])}return[{Provider:o,Slot:l,ItemSlot:p},m,r]}var rP=B.createContext(void 0);function iP(e){let t=B.useContext(rP);return e||t||`ltr`}function aP(e){let t=B.useRef(e);return B.useEffect(()=>{t.current=e}),B.useMemo(()=>((...e)=>t.current?.(...e)),[])}var oP=`DismissableLayer`,sP=`dismissableLayer.update`,cP=`dismissableLayer.pointerDownOutside`,lP=`dismissableLayer.focusOutside`,uP,dP=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),fP=B.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=B.useContext(dP),[d,f]=B.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=B.useState({}),h=AN(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=g.indexOf(_),y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=B.useRef(!1),C=gP(e=>{let t=e.target;if(!(t instanceof Node))return;let n=[...u.branches].some(e=>e.contains(t));!x||n||(a?.(e),s?.(e),e.defaultPrevented||c?.())},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces}),w=_P(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=IN(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return B.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T]),B.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(uP=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),vP(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=uP))}},[d,p,n,u]),B.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),vP())},[d,u]),B.useEffect(()=>{let e=()=>m({});return document.addEventListener(sP,e),()=>document.removeEventListener(sP,e)},[]),(0,V.jsx)(eP.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:DN(e.onFocusCapture,w.onFocusCapture),onBlurCapture:DN(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:DN(e.onPointerDownCapture,C.onPointerDownCapture)})});fP.displayName=oP;var pP=`DismissableLayerBranch`,mP=B.forwardRef((e,t)=>{let n=B.useContext(dP),r=B.useRef(null),i=AN(t,r);return B.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(eP.div,{...e,ref:i})});mP.displayName=pP;function hP(){let e=B.useContext(dP),[t,n]=B.useState(null);return B.useEffect(()=>{if(t)return e.dismissableSurfaces.add(t),()=>{e.dismissableSurfaces.delete(t)}},[t,e.dismissableSurfaces]),n}function gP(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a}=t,o=aP(e),s=B.useRef(!1),c=B.useRef(!1),l=B.useRef(new Map),u=B.useRef(()=>{});return B.useEffect(()=>{function e(){c.current=!1,i.current=!1,l.current.clear()}function t(){return Array.from(l.current.values()).some(Boolean)}function d(e){if(!c.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||l.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{c.current&&u.current()},0)}function f(e){c.current&&l.current.set(e.type,!1)}let p=a=>{if(a.target&&!s.current){let s=function(){n.removeEventListener(`click`,u.current);let r=t();e(),r||yP(cP,o,d,{discrete:!0})},d={originalEvent:a};c.current=!0,i.current=r&&a.button===0,l.current.clear(),!r||a.button!==0?s():(n.removeEventListener(`click`,u.current),u.current=s,n.addEventListener(`click`,u.current,{once:!0}))}else n.removeEventListener(`click`,u.current),e();s.current=!1},m=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of m)n.addEventListener(e,d,!0),n.addEventListener(e,f);let h=window.setTimeout(()=>{n.addEventListener(`pointerdown`,p)},0);return()=>{window.clearTimeout(h),n.removeEventListener(`pointerdown`,p),n.removeEventListener(`click`,u.current);for(let e of m)n.removeEventListener(e,d,!0),n.removeEventListener(e,f)}},[n,o,r,i,a]),{onPointerDownCapture:()=>s.current=!0}}function _P(e,t=globalThis?.document){let n=aP(e),r=B.useRef(!1);return B.useEffect(()=>{let e=e=>{e.target&&!r.current&&yP(lP,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function vP(){let e=new CustomEvent(sP);document.dispatchEvent(e)}function yP(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?tP(i,a):i.dispatchEvent(a)}var bP=0,xP=null;function SP(){B.useEffect(()=>{xP||={start:CP(),end:CP()};let{start:e,end:t}=xP;return document.body.firstElementChild!==e&&document.body.insertAdjacentElement(`afterbegin`,e),document.body.lastElementChild!==t&&document.body.insertAdjacentElement(`beforeend`,t),bP++,()=>{bP===1&&(xP?.start.remove(),xP?.end.remove(),xP=null),bP=Math.max(0,bP-1)}},[])}function CP(){let e=document.createElement(`span`);return e.setAttribute(`data-radix-focus-guard`,``),e.tabIndex=0,e.style.outline=`none`,e.style.opacity=`0`,e.style.position=`fixed`,e.style.pointerEvents=`none`,e}var wP=`focusScope.autoFocusOnMount`,TP=`focusScope.autoFocusOnUnmount`,EP={bubbles:!1,cancelable:!0},DP=`FocusScope`,OP=B.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=aP(i),u=aP(a),d=B.useRef(null),f=AN(t,c),p=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:FP(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||FP(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&FP(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),B.useEffect(()=>{if(s){IP.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(wP,EP);s.addEventListener(wP,l),s.dispatchEvent(t),t.defaultPrevented||(kP(zP(jP(s)),{select:!0}),document.activeElement===e&&FP(s))}return()=>{s.removeEventListener(wP,l),setTimeout(()=>{let t=new CustomEvent(TP,EP);s.addEventListener(TP,u),s.dispatchEvent(t),t.defaultPrevented||FP(e??document.body,{select:!0}),s.removeEventListener(TP,u),IP.remove(p)},0)}}},[s,l,u,p]);let m=B.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=AP(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&FP(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&FP(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(eP.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});OP.displayName=DP;function kP(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(FP(r,{select:t}),document.activeElement!==n)return}function AP(e){let t=jP(e);return[MP(t,e),MP(t.reverse(),e)]}function jP(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function MP(e,t){for(let n of e)if(!NP(n,{upTo:t}))return n}function NP(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function PP(e){return e instanceof HTMLInputElement&&`select`in e}function FP(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&PP(e)&&t&&e.select()}}var IP=LP();function LP(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=RP(e,t),e.unshift(t)},remove(t){e=RP(e,t),e[0]?.resume()}}}function RP(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function zP(e){return e.filter(e=>e.tagName!==`A`)}var BP=B.useId||(()=>void 0),VP=0;function HP(e){let[t,n]=B.useState(BP());return NN(()=>{e||n(e=>e??String(VP++))},[e]),e||(t?`radix-${t}`:``)}var UP=[`top`,`right`,`bottom`,`left`],WP=Math.min,GP=Math.max,KP=Math.round,qP=Math.floor,JP=e=>({x:e,y:e}),YP={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function XP(e,t,n){return GP(e,WP(t,n))}function ZP(e,t){return typeof e==`function`?e(t):e}function QP(e){return e.split(`-`)[0]}function $P(e){return e.split(`-`)[1]}function eF(e){return e===`x`?`y`:`x`}function tF(e){return e===`y`?`height`:`width`}function nF(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function rF(e){return eF(nF(e))}function iF(e,t,n){n===void 0&&(n=!1);let r=$P(e),i=rF(e),a=tF(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=pF(o)),[o,pF(o)]}function aF(e){let t=pF(e);return[oF(e),t,oF(t)]}function oF(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var sF=[`left`,`right`],cF=[`right`,`left`],lF=[`top`,`bottom`],uF=[`bottom`,`top`];function dF(e,t,n){switch(e){case`top`:case`bottom`:return n?t?cF:sF:t?sF:cF;case`left`:case`right`:return t?lF:uF;default:return[]}}function fF(e,t,n,r){let i=$P(e),a=dF(QP(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(oF)))),a}function pF(e){let t=QP(e);return YP[t]+e.slice(t.length)}function mF(e){return{top:0,right:0,bottom:0,left:0,...e}}function hF(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:mF(e)}function gF(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function _F(e,t,n){let{reference:r,floating:i}=e,a=nF(t),o=rF(t),s=tF(o),c=QP(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch($P(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function vF(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=ZP(t,e),p=hF(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=gF(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=gF(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var yF=50,bF=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:vF},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=_F(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<yF&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=_F(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},xF=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=ZP(e,t)||{};if(l==null)return{};let d=hF(u),f={x:n,y:r},p=rF(i),m=tF(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=WP(d[_],T),D=WP(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=XP(O,A,k),M=!c.arrow&&$P(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),SF=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=ZP(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=QP(r),_=nF(o),v=QP(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[pF(o)]:aF(o)),x=p!==`none`;!d&&x&&b.push(...fF(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=iF(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==nF(t))||T.every(e=>nF(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=nF(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function CF(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function wF(e){return UP.some(t=>e[t]>=0)}var TF=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=ZP(e,t);switch(i){case`referenceHidden`:{let e=CF(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:wF(e)}}}case`escaped`:{let e=CF(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:wF(e)}}}default:return{}}}}},EF=new Set([`left`,`top`]);async function DF(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=QP(n),s=$P(n),c=nF(n)===`y`,l=EF.has(o)?-1:1,u=a&&c?-1:1,d=ZP(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var OF=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await DF(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},kF=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=ZP(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=nF(QP(i)),p=eF(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=XP(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=XP(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},AF=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=ZP(e,t),u={x:n,y:r},d=nF(i),f=eF(d),p=u[f],m=u[d],h=ZP(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=EF.has(QP(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},jF=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=ZP(e,t),u=await o.detectOverflow(t,l),d=QP(i),f=$P(i),p=nF(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=WP(h-u[g],v),x=WP(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=GP(u.left,0),t=GP(u.right,0),n=GP(u.top,0),r=GP(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:GP(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:GP(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function MF(){return typeof window<`u`}function NF(e){return IF(e)?(e.nodeName||``).toLowerCase():`#document`}function PF(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function FF(e){return((IF(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function IF(e){return MF()?e instanceof Node||e instanceof PF(e).Node:!1}function LF(e){return MF()?e instanceof Element||e instanceof PF(e).Element:!1}function RF(e){return MF()?e instanceof HTMLElement||e instanceof PF(e).HTMLElement:!1}function zF(e){return!MF()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof PF(e).ShadowRoot}function BF(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=XF(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function zee(e){return/^(table|td|th)$/.test(NF(e))}function VF(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var HF=/transform|translate|scale|rotate|perspective|filter/,UF=/paint|layout|strict|content/,WF=e=>!!e&&e!==`none`,GF;function KF(e){let t=LF(e)?XF(e):e;return WF(t.transform)||WF(t.translate)||WF(t.scale)||WF(t.rotate)||WF(t.perspective)||!JF()&&(WF(t.backdropFilter)||WF(t.filter))||HF.test(t.willChange||``)||UF.test(t.contain||``)}function qF(e){let t=QF(e);for(;RF(t)&&!YF(t);){if(KF(t))return t;if(VF(t))return null;t=QF(t)}return null}function JF(){return GF??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),GF}function YF(e){return/^(html|body|#document)$/.test(NF(e))}function XF(e){return PF(e).getComputedStyle(e)}function ZF(e){return LF(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function QF(e){if(NF(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||zF(e)&&e.host||FF(e);return zF(t)?t.host:t}function $F(e){let t=QF(e);return YF(t)?e.ownerDocument?e.ownerDocument.body:e.body:RF(t)&&BF(t)?t:$F(t)}function eI(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=$F(e),i=r===e.ownerDocument?.body,a=PF(r);if(i){let e=tI(a);return t.concat(a,a.visualViewport||[],BF(r)?r:[],e&&n?eI(e):[])}else return t.concat(r,eI(r,[],n))}function tI(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function nI(e){let t=XF(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=RF(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=KP(n)!==a||KP(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function rI(e){return LF(e)?e:e.contextElement}function iI(e){let t=rI(e);if(!RF(t))return JP(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=nI(t),o=(a?KP(n.width):n.width)/r,s=(a?KP(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var aI=JP(0);function oI(e){let t=PF(e);return!JF()||!t.visualViewport?aI:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function sI(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==PF(e)?!1:t}function cI(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=rI(e),o=JP(1);t&&(r?LF(r)&&(o=iI(r)):o=iI(e));let s=sI(a,n,r)?oI(a):JP(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=PF(a),t=r&&LF(r)?PF(r):r,n=e,i=tI(n);for(;i&&r&&t!==n;){let e=iI(i),t=i.getBoundingClientRect(),r=XF(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=PF(i),i=tI(n)}}return gF({width:u,height:d,x:c,y:l})}function lI(e,t){let n=ZF(e).scrollLeft;return t?t.left+n:cI(FF(e)).left+n}function uI(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-lI(e,n),y:n.top+t.scrollTop}}function dI(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=FF(r),s=t?VF(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=JP(1),u=JP(0),d=RF(r);if((d||!d&&!a)&&((NF(r)!==`body`||BF(o))&&(c=ZF(r)),d)){let e=cI(r);l=iI(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?uI(o,c):JP(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function fI(e){return Array.from(e.getClientRects())}function pI(e){let t=FF(e),n=ZF(e),r=e.ownerDocument.body,i=GP(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=GP(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+lI(e),s=-n.scrollTop;return XF(r).direction===`rtl`&&(o+=GP(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var mI=25;function hI(e,t){let n=PF(e),r=FF(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=JF();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=lI(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=mI&&(a-=o)}else l<=mI&&(a+=l);return{width:a,height:o,x:s,y:c}}function gI(e,t){let n=cI(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=RF(e)?iI(e):JP(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function _I(e,t,n){let r;if(t===`viewport`)r=hI(e,n);else if(t===`document`)r=pI(FF(e));else if(LF(t))r=gI(t,n);else{let n=oI(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return gF(r)}function vI(e,t){let n=QF(e);return n===t||!LF(n)||YF(n)?!1:XF(n).position===`fixed`||vI(n,t)}function yI(e,t){let n=t.get(e);if(n)return n;let r=eI(e,[],!1).filter(e=>LF(e)&&NF(e)!==`body`),i=null,a=XF(e).position===`fixed`,o=a?QF(e):e;for(;LF(o)&&!YF(o);){let t=XF(o),n=KF(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||BF(o)&&!n&&vI(e,o))?r=r.filter(e=>e!==o):i=t,o=QF(o)}return t.set(e,r),r}function bI(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?VF(t)?[]:yI(t,this._c):[].concat(n),r],o=_I(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=_I(t,a[e],i);s=GP(n.top,s),c=WP(n.right,c),l=WP(n.bottom,l),u=GP(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function xI(e){let{width:t,height:n}=nI(e);return{width:t,height:n}}function SI(e,t,n){let r=RF(t),i=FF(t),a=n===`fixed`,o=cI(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=JP(0);function l(){c.x=lI(i)}if(r||!r&&!a)if((NF(t)!==`body`||BF(i))&&(s=ZF(t)),r){let e=cI(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?uI(i,s):JP(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function CI(e){return XF(e).position===`static`}function wI(e,t){if(!RF(e)||XF(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return FF(e)===n&&(n=n.ownerDocument.body),n}function TI(e,t){let n=PF(e);if(VF(e))return n;if(!RF(e)){let t=QF(e);for(;t&&!YF(t);){if(LF(t)&&!CI(t))return t;t=QF(t)}return n}let r=wI(e,t);for(;r&&zee(r)&&CI(r);)r=wI(r,t);return r&&YF(r)&&CI(r)&&!KF(r)?n:r||qF(e)||n}var EI=async function(e){let t=this.getOffsetParent||TI,n=this.getDimensions,r=await n(e.floating);return{reference:SI(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function DI(e){return XF(e).direction===`rtl`}var OI={convertOffsetParentRelativeRectToViewportRelativeRect:dI,getDocumentElement:FF,getClippingRect:bI,getOffsetParent:TI,getElementRects:EI,getClientRects:fI,getDimensions:xI,getScale:iI,isElement:LF,isRTL:DI};function kI(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function AI(e,t){let n=null,r,i=FF(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=qP(d),h=qP(i.clientWidth-(u+f)),g=qP(i.clientHeight-(d+p)),_=qP(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:GP(0,WP(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!kI(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function jI(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=rI(e),u=i||a?[...l?eI(l):[],...t?eI(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?AI(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?cI(e):null;c&&g();function g(){let t=cI(e);h&&!kI(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var MI=OF,NI=kF,PI=SF,FI=jF,II=TF,LI=xF,RI=AF,zI=(e,t,n)=>{let r=new Map,i={platform:OI,...n},a={...i.platform,_c:r};return bF(e,t,{...i,platform:a})},BI=typeof document<`u`?B.useLayoutEffect:function(){};function VI(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!VI(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!VI(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function HI(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function UI(e,t){let n=HI(e);return Math.round(t*n)/n}function WI(e){let t=B.useRef(e);return BI(()=>{t.current=e}),t}function GI(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=B.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=B.useState(r);VI(f,r)||p(r);let[m,h]=B.useState(null),[g,_]=B.useState(null),v=B.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=B.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=B.useRef(null),C=B.useRef(null),w=B.useRef(u),T=c!=null,E=WI(c),D=WI(i),O=WI(l),k=B.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),zI(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!VI(w.current,t)&&(w.current=t,Xd.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);BI(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=B.useRef(!1);BI(()=>(A.current=!0,()=>{A.current=!1}),[]),BI(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=B.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=B.useMemo(()=>({reference:b,floating:x}),[b,x]),N=B.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=UI(M.floating,u.x),r=UI(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...HI(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return B.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var KI=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:LI({element:r.current,padding:i}).fn(n):r?LI({element:r,padding:i}).fn(n):{}}}},qI=(e,t)=>{let n=MI(e);return{name:n.name,fn:n.fn,options:[e,t]}},JI=(e,t)=>{let n=NI(e);return{name:n.name,fn:n.fn,options:[e,t]}},YI=(e,t)=>({fn:RI(e).fn,options:[e,t]}),XI=(e,t)=>{let n=PI(e);return{name:n.name,fn:n.fn,options:[e,t]}},ZI=(e,t)=>{let n=FI(e);return{name:n.name,fn:n.fn,options:[e,t]}},QI=(e,t)=>{let n=II(e);return{name:n.name,fn:n.fn,options:[e,t]}},$I=(e,t)=>{let n=KI(e);return{name:n.name,fn:n.fn,options:[e,t]}},eL=`Arrow`,tL=B.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,V.jsx)(eP.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,V.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});tL.displayName=eL;var nL=tL;function rL(e){let[t,n]=B.useState(void 0);return NN(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var iL=`Popper`,[aL,oL]=jN(iL),[sL,cL]=aL(iL),lL=e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,V.jsx)(sL,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};lL.displayName=iL;var uL=`PopperAnchor`,dL=B.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=cL(uL,n),o=B.useRef(null),s=a.onAnchorChange,c=AN(t,B.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=B.useRef(null);B.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&xL(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,V.jsx)(eP.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});dL.displayName=uL;var fL=`PopperContent`,[pL,mL]=aL(fL),hL=B.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=cL(fL,n),[_,v]=B.useState(null),y=AN(t,v),[b,x]=B.useState(null),S=rL(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(yL),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=GI({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>jI(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[qI({mainAxis:i+w,alignmentAxis:o}),c&&JI({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?YI():void 0,...k}),c&&XI({...k}),ZI({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&$I({element:b,padding:s}),bL({arrowWidth:C,arrowHeight:w}),f&&QI({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),ee=g.setPlacementState;NN(()=>(ee(M),()=>{ee(void 0)}),[M,ee]);let[F,te]=xL(M),ne=aP(m);NN(()=>{N&&ne?.()},[N,ne]);let re=P.arrow?.x,ie=P.arrow?.y,ae=P.arrow?.centerOffset!==0,[oe,se]=B.useState();return NN(()=>{_&&se(window.getComputedStyle(_).zIndex)},[_]),(0,V.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(pL,{scope:n,placedSide:F,placedAlign:te,onArrowChange:x,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,V.jsx)(eP.div,{"data-side":F,"data-align":te,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});hL.displayName=fL;var gL=`PopperArrow`,_L={top:`bottom`,right:`left`,bottom:`top`,left:`right`},vL=B.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=mL(gL,n),a=_L[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(nL,{...r,ref:t,style:{...r.style,display:`block`}})})});vL.displayName=gL;function yL(e){return e!==null}var bL=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=xL(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function xL(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var SL=lL,CL=dL,wL=hL,TL=vL,EL=`Portal`,DL=B.forwardRef((e,t)=>{let{container:n,...r}=e,[i,a]=B.useState(!1);NN(()=>a(!0),[]);let o=n||i&&globalThis?.document?.body;return o?Xd.createPortal((0,V.jsx)(eP.div,{...r,ref:t}),o):null});DL.displayName=EL;function OL(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}var kL=e=>{let{present:t,children:n}=e,r=AL(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=ML(r.ref,PL(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null};kL.displayName=`Presence`;function AL(e){let[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),a=B.useRef(`none`),[o,s]=OL(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return B.useEffect(()=>{let e=NL(r.current);a.current=o===`mounted`?e:`none`},[o]),NN(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,o=NL(t);e?s(`MOUNT`):o===`none`||t?.display===`none`?s(`UNMOUNT`):s(n&&r!==o?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,s]),NN(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=NL(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(s(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},c=e=>{e.target===t&&(a.current=NL(r.current))};return t.addEventListener(`animationstart`,c),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,c),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else s(`ANIMATION_END`)},[t,s]),{isPresent:[`mounted`,`unmountSuspended`].includes(o),ref:B.useCallback(e=>{r.current=e?getComputedStyle(e):null,n(e)},[])}}function jL(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function ML(...e){let t=B.useRef(e);return t.current=e,B.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=jL(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():jL(n[e],null)}}},[])}function NL(e){return e?.animationName||`none`}function PL(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var FL=`rovingFocusGroup.onEntryFocus`,IL={bubbles:!1,cancelable:!0},LL=`RovingFocusGroup`,[RL,zL,BL]=nP(LL),[VL,HL]=jN(LL,[BL]),[UL,WL]=VL(LL),GL=B.forwardRef((e,t)=>(0,V.jsx)(RL.Provider,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(RL.Slot,{scope:e.__scopeRovingFocusGroup,children:(0,V.jsx)(KL,{...e,ref:t})})}));GL.displayName=LL;var KL=B.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,orientation:r,loop:i=!1,dir:a,currentTabStopId:o,defaultCurrentTabStopId:s,onCurrentTabStopIdChange:c,onEntryFocus:l,preventScrollOnEntryFocus:u=!1,...d}=e,f=B.useRef(null),p=AN(t,f),m=iP(a),[h,g]=RN({prop:o,defaultProp:s??null,onChange:c,caller:LL}),[_,v]=B.useState(!1),y=aP(l),b=zL(n),x=B.useRef(!1),[S,C]=B.useState(0);return B.useEffect(()=>{let e=f.current;if(e)return e.addEventListener(FL,y),()=>e.removeEventListener(FL,y)},[y]),(0,V.jsx)(UL,{scope:n,orientation:r,dir:m,loop:i,currentTabStopId:h,onItemFocus:B.useCallback(e=>g(e),[g]),onItemShiftTab:B.useCallback(()=>v(!0),[]),onFocusableItemAdd:B.useCallback(()=>C(e=>e+1),[]),onFocusableItemRemove:B.useCallback(()=>C(e=>e-1),[]),children:(0,V.jsx)(eP.div,{tabIndex:_||S===0?-1:0,"data-orientation":r,...d,ref:p,style:{outline:`none`,...e.style},onMouseDown:DN(e.onMouseDown,()=>{x.current=!0}),onFocus:DN(e.onFocus,e=>{let t=!x.current;if(e.target===e.currentTarget&&t&&!_){let t=new CustomEvent(FL,IL);if(e.currentTarget.dispatchEvent(t),!t.defaultPrevented){let e=b().filter(e=>e.focusable);QL([e.find(e=>e.active),e.find(e=>e.id===h),...e].filter(Boolean).map(e=>e.ref.current),u)}}x.current=!1}),onBlur:DN(e.onBlur,()=>v(!1))})})}),qL=`RovingFocusGroupItem`,JL=B.forwardRef((e,t)=>{let{__scopeRovingFocusGroup:n,focusable:r=!0,active:i=!1,tabStopId:a,children:o,...s}=e,c=HP(),l=a||c,u=WL(qL,n),d=u.currentTabStopId===l,f=zL(n),{onFocusableItemAdd:p,onFocusableItemRemove:m,currentTabStopId:h}=u;return B.useEffect(()=>{if(r)return p(),()=>m()},[r,p,m]),(0,V.jsx)(RL.ItemSlot,{scope:n,id:l,focusable:r,active:i,children:(0,V.jsx)(eP.span,{tabIndex:d?0:-1,"data-orientation":u.orientation,...s,ref:t,onMouseDown:DN(e.onMouseDown,e=>{r?u.onItemFocus(l):e.preventDefault()}),onFocus:DN(e.onFocus,()=>u.onItemFocus(l)),onKeyDown:DN(e.onKeyDown,e=>{if(e.key===`Tab`&&e.shiftKey){u.onItemShiftTab();return}if(e.target!==e.currentTarget)return;let t=ZL(e,u.orientation,u.dir);if(t!==void 0){if(e.metaKey||e.ctrlKey||e.altKey||e.shiftKey)return;e.preventDefault();let n=f().filter(e=>e.focusable).map(e=>e.ref.current);if(t===`last`)n.reverse();else if(t===`prev`||t===`next`){t===`prev`&&n.reverse();let r=n.indexOf(e.currentTarget);n=u.loop?$L(n,r+1):n.slice(r+1)}setTimeout(()=>QL(n))}}),children:typeof o==`function`?o({isCurrentTabStop:d,hasTabStop:h!=null}):o})})});JL.displayName=qL;var YL={ArrowLeft:`prev`,ArrowUp:`prev`,ArrowRight:`next`,ArrowDown:`next`,PageUp:`first`,Home:`first`,PageDown:`last`,End:`last`};function XL(e,t){return t===`rtl`?e===`ArrowLeft`?`ArrowRight`:e===`ArrowRight`?`ArrowLeft`:e:e}function ZL(e,t,n){let r=XL(e.key,n);if(!(t===`vertical`&&[`ArrowLeft`,`ArrowRight`].includes(r))&&!(t===`horizontal`&&[`ArrowUp`,`ArrowDown`].includes(r)))return YL[r]}function QL(e,t=!1){let n=document.activeElement;for(let r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function $L(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var eR=GL,tR=JL,nR=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},rR=new WeakMap,iR=new WeakMap,aR={},oR=0,sR=function(e){return e&&(e.host||sR(e.parentNode))},cR=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=sR(t);return n&&e.contains(n)?n:(console.error(`aria-hidden`,t,`in not contained inside`,e,`. Doing nothing`),null)}).filter(function(e){return!!e})},lR=function(e,t,n,r){var i=cR(t,Array.isArray(e)?e:[e]);aR[n]||(aR[n]=new WeakMap);var a=aR[n],o=[],s=new Set,c=new Set(i),l=function(e){!e||s.has(e)||(s.add(e),l(e.parentNode))};i.forEach(l);var u=function(e){!e||c.has(e)||Array.prototype.forEach.call(e.children,function(e){if(s.has(e))u(e);else try{var t=e.getAttribute(r),i=t!==null&&t!==`false`,c=(rR.get(e)||0)+1,l=(a.get(e)||0)+1;rR.set(e,c),a.set(e,l),o.push(e),c===1&&i&&iR.set(e,!0),l===1&&e.setAttribute(n,`true`),i||e.setAttribute(r,`true`)}catch(t){console.error(`aria-hidden: cannot operate on `,e,t)}})};return u(t),s.clear(),oR++,function(){o.forEach(function(e){var t=rR.get(e)-1,i=a.get(e)-1;rR.set(e,t),a.set(e,i),t||(iR.has(e)||e.removeAttribute(r),iR.delete(e)),i||e.removeAttribute(n)}),oR--,oR||(rR=new WeakMap,rR=new WeakMap,iR=new WeakMap,aR={})}},uR=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||nR(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),lR(r,i,n,`aria-hidden`)):function(){return null}},dR=function(){return dR=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},dR.apply(this,arguments)};function fR(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function pR(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var mR=`right-scroll-bar-position`,hR=`width-before-scroll-bar`,gR=`with-scroll-bars-hidden`,_R=`--removed-body-scroll-bar-size`;function vR(e,t){return typeof e==`function`?e(t):e&&(e.current=t),e}function yR(e,t){var n=(0,B.useState)(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(e){var t=n.value;t!==e&&(n.value=e,n.callback(e,t))}}}})[0];return n.callback=t,n.facade}var bR=typeof window<`u`?B.useLayoutEffect:B.useEffect,xR=new WeakMap;function SR(e,t){var n=yR(t||null,function(t){return e.forEach(function(e){return vR(e,t)})});return bR(function(){var t=xR.get(n);if(t){var r=new Set(t),i=new Set(e),a=n.current;r.forEach(function(e){i.has(e)||vR(e,null)}),i.forEach(function(e){r.has(e)||vR(e,a)})}xR.set(n,e)},[e]),n}function CR(e){return e}function wR(e,t){t===void 0&&(t=CR);var n=[],r=!1;return{read:function(){if(r)throw Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(e){var i=t(e,r);return n.push(i),function(){n=n.filter(function(e){return e!==i})}},assignSyncMedium:function(e){for(r=!0;n.length;){var t=n;n=[],t.forEach(e)}n={push:function(t){return e(t)},filter:function(){return n}}},assignMedium:function(e){r=!0;var t=[];if(n.length){var i=n;n=[],i.forEach(e),t=n}var a=function(){var n=t;t=[],n.forEach(e)},o=function(){return Promise.resolve().then(a)};o(),n={push:function(e){t.push(e),o()},filter:function(e){return t=t.filter(e),n}}}}}function TR(e){e===void 0&&(e={});var t=wR(null);return t.options=dR({async:!0,ssr:!1},e),t}var ER=function(e){var t=e.sideCar,n=fR(e,[`sideCar`]);if(!t)throw Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw Error(`Sidecar medium not found`);return B.createElement(r,dR({},n))};ER.isSideCarExport=!0;function DR(e,t){return e.useMedium(t),ER}var OR=TR(),kR=function(){},AR=B.forwardRef(function(e,t){var n=B.useRef(null),r=B.useState({onScrollCapture:kR,onWheelCapture:kR,onTouchMoveCapture:kR}),i=r[0],a=r[1],o=e.forwardProps,s=e.children,c=e.className,l=e.removeScrollBar,u=e.enabled,d=e.shards,f=e.sideCar,p=e.noRelative,m=e.noIsolation,h=e.inert,g=e.allowPinchZoom,_=e.as,v=_===void 0?`div`:_,y=e.gapMode,b=fR(e,[`forwardProps`,`children`,`className`,`removeScrollBar`,`enabled`,`shards`,`sideCar`,`noRelative`,`noIsolation`,`inert`,`allowPinchZoom`,`as`,`gapMode`]),x=f,S=SR([n,t]),C=dR(dR({},b),i);return B.createElement(B.Fragment,null,u&&B.createElement(x,{sideCar:OR,removeScrollBar:l,shards:d,noRelative:p,noIsolation:m,inert:h,setCallbacks:a,allowPinchZoom:!!g,lockRef:n,gapMode:y}),o?B.cloneElement(B.Children.only(s),dR(dR({},C),{ref:S})):B.createElement(v,dR({},C,{className:c,ref:S}),s))});AR.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},AR.classNames={fullWidth:hR,zeroRight:mR};var jR,MR=function(){if(jR)return jR;if(typeof __webpack_nonce__<`u`)return __webpack_nonce__};function NR(){if(!document)return null;var e=document.createElement(`style`);e.type=`text/css`;var t=MR();return t&&e.setAttribute(`nonce`,t),e}function PR(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function FR(e){(document.head||document.getElementsByTagName(`head`)[0]).appendChild(e)}var IR=function(){var e=0,t=null;return{add:function(n){e==0&&(t=NR())&&(PR(t,n),FR(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},LR=function(){var e=IR();return function(t,n){B.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},RR=function(){var e=LR();return function(t){var n=t.styles,r=t.dynamic;return e(n,r),null}},zR={left:0,top:0,right:0,gap:0},BR=function(e){return parseInt(e||``,10)||0},VR=function(e){var t=window.getComputedStyle(document.body),n=t[e===`padding`?`paddingLeft`:`marginLeft`],r=t[e===`padding`?`paddingTop`:`marginTop`],i=t[e===`padding`?`paddingRight`:`marginRight`];return[BR(n),BR(r),BR(i)]},HR=function(e){if(e===void 0&&(e=`margin`),typeof window>`u`)return zR;var t=VR(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},UR=RR(),WR=`data-scroll-locked`,GR=function(e,t,n,r){var i=e.left,a=e.top,o=e.right,s=e.gap;return n===void 0&&(n=`margin`),`
321
321
  .${gR} {
322
322
  overflow: hidden ${r};
@@ -366,7 +366,7 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
366
366
  `:``}${t.join(`
367
367
  `)}`:e}function vH(e,t){return t&&e.key===`Enter`&&!e.isComposing&&e.keyCode!==229&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey}function yH(e){return e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.isComposing&&e.keyCode!==229}function bH(e,t){return t&&e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&!e.isComposing&&e.keyCode!==229&&!e.altKey&&!e.shiftKey}function xH(e){return e.key===`Enter`&&e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.isComposing}function SH(e,t,n){return e===`queueComposer`&&t===`Enter`&&n}var CH=`gap-3`,wH=`-mx-1`,TH=`-mx-[3px]`,EH=`-mx-2`,DH=`-mx-[7px]`,OH=`right-2`,kH=`right-[71px]`,AH=`right-[44px]`,jH=`pr-[6.6875rem]`,MH=`pr-20`,NH=/^[a-zA-Z]:[\\/]/,PH=/^(?:cursor|vscode|vscode-insiders|windsurf):\/\/file\/(.*)$/i;function FH(e){try{return decodeURIComponent(e)}catch{return e}}function IH(e){if(e===`/`||e.startsWith(`/?`)||e.startsWith(`/#`))return!0;let t=e.replace(/[?#].*$/u,``);if(Dx(t))return!0;let n=Ax(t).split(`/`)[1]??``;return Cx.has(n)}function LH(e){let t=e?.trim();if(!t)return null;let n=FH(t);if(NH.test(n))return{display:n};if(n.startsWith(`/`)&&!n.startsWith(`//`)&&!IH(n)){let e=n;return{display:e,posixPath:e}}let r=PH.exec(t);if(r){let e=FH(r[1].replace(/[?#].*$/u,``)).replace(/^\/+/,``);if(!e)return null;if(NH.test(e))return{display:e};let t=`/${e}`;return{display:t,posixPath:t}}if(!/^file:/i.test(t))return null;try{let e=new URL(t);if(e.protocol!==`file:`)return null;if(e.hostname&&e.hostname!==`localhost`)return{display:t};let n=FH(e.pathname);return{display:n,posixPath:n}}catch{return{display:t}}}function RH(e){return`${Nx()}/local-image?path=${encodeURIComponent(e)}`}var zH=/\.(?:png|jpe?g|gif|webp)$/i;function BH(e){return e.posixPath&&zH.test(e.posixPath)?RH(e.posixPath):null}var VH=/\.(?:md|markdown)$/i;function HH(e){return VH.test(e.trim().replace(/:\d+(?::\d+)?$/,``))}function UH(e,t,n){let r=e?.trim();if(!r||/^[a-z][a-z0-9+.-]*:/i.test(r)||r.startsWith(`/`)||r.startsWith(`#`)||r.startsWith(`?`))return null;let i=FH(r.replace(/[?#].*$/u,``));if(!i)return null;let a=i===`~`||i.startsWith(`~/`);if(a&&!n?.startsWith(`/`))return null;let o=a?n:t;if(!o.startsWith(`/`))return null;let s=`${o}/${a?i.slice(1):i}`.split(`/`),c=[];for(let e of s)!e||e===`.`||(e===`..`?c.pop():c.push(e));return`/${c.join(`/`)}`}function WH(e){let t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):`/`}async function GH(e,t){let n=Nx(),r=await e.arrayBuffer(),i=``,a=new Uint8Array(r);for(let e=0;e<a.length;e+=32768)i+=String.fromCharCode(...a.subarray(e,e+32768));let o=await fetch(`${n}/attach`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:t,data:btoa(i)})});return o.ok?(await o.json()).path??null:null}function KH({value:e,onChange:t,onSubmit:n,surface:r,placeholder:i,id:a,minHeight:o=44,maxHeight:s=220,autoFocus:c,busy:l,footer:u,leftAction:d,slashSuggest:f,onInterruptSubmit:p}){let m=(0,B.useRef)(null),h=(0,B.useRef)(null),[g,_]=(0,B.useState)(!1),[v,y]=(0,B.useState)(!1),{prose:b,attachments:x}=(0,B.useMemo)(()=>gH(e),[e]),S=x.map(e=>e.path),C=(0,B.useRef)(e);C.current=e;let w=e=>t(_H(e,S)),T=e=>t(_H(b,e));async function E(e){if(!e)return;if(v){Q(`An upload is already in progress — try again in a moment`);return}let n=[...e].map(e=>{let t=e.type.startsWith(`image/`)?e.type.slice(6).toLowerCase():``,n=t===`jpeg`?`jpg`:t===`svg+xml`?`svg`:t;return{file:e,name:e.name||(n?`pasted.${n}`:``)}}).filter(({name:e})=>yy(e)?!0:(Q(`${e||`File`}: unsupported file type`),!1));if(!n.length)return;let r=n.filter(({file:e,name:t})=>e.size>gy?(Q(`${t} is too large (max ${Math.floor(gy/1e6)} MB)`),!1):!0);if(!r.length)return;let i=C.current;y(!0);let a=[];try{for(let{file:e,name:t}of r){let n=await GH(e,t);n?a.push(n):Q(`Could not attach ${t}`)}}finally{y(!1)}if(a.length&&i!==``&&C.current===``){Q(`Attachment discarded — the message was sent before the upload finished`),requestAnimationFrame(()=>m.current?.focus());return}if(a.length){let e=gH(C.current);t(_H(e.prose,[...e.attachments.map(e=>e.path),...a]))}requestAnimationFrame(()=>m.current?.focus())}(0,B.useLayoutEffect)(()=>{let e=!0,t=()=>{let t=m.current;!t||!e||(t.style.height=`auto`,t.style.height=`${Math.min(t.scrollHeight,s)}px`)};t();let n=requestAnimationFrame(t);document.fonts?.ready.then(t);let r=m.current,i=r?.clientWidth??0,a,o=r?new ResizeObserver(([e])=>{let n=Math.round(e.contentRect.width);n!==i&&(i=n,a!==void 0&&cancelAnimationFrame(a),a=requestAnimationFrame(t))}):void 0;return r&&o?.observe(r),()=>{e=!1,cancelAnimationFrame(n),a!==void 0&&cancelAnimationFrame(a),o?.disconnect()}},[e,s,!!u]);let D=(0,B.useRef)(!1);(0,B.useEffect)(()=>{let e=m.current;if(!e)return;let t=()=>{D.current=e.disabled};return e.addEventListener(`focusout`,t),()=>e.removeEventListener(`focusout`,t)},[]),(0,B.useEffect)(()=>{if(l||!D.current)return;D.current=!1;let e=m.current,t=document.activeElement;e&&(!t||t.contains(e))&&e.focus({preventScroll:!0})},[l]);let[O,k]=(0,B.useState)(null),[A,j]=(0,B.useState)(0),[M,N]=(0,B.useState)(null),P=!!f&&/^\/\S*$/.test(b);(0,B.useEffect)(()=>{if(!P||O!==null)return;let e=!0;return f().then(t=>{e&&k(t)},()=>{e&&k([])}),()=>{e=!1}},[P,O,f]);let ee=(0,B.useMemo)(()=>{if(!P||!O||M===b)return[];let e=b.slice(1).toLowerCase(),t=O.filter(t=>t.name.toLowerCase().startsWith(e)),n=O.filter(t=>!t.name.toLowerCase().startsWith(e)&&t.name.toLowerCase().includes(e));return[...t,...n]},[P,O,M,b]),F=ee.length>0;(0,B.useEffect)(()=>{j(0)},[b]);let te=(0,B.useRef)(null);(0,B.useEffect)(()=>{te.current?.querySelector(`[data-suggest-index="${A}"]`)?.scrollIntoView({block:`nearest`})},[A]);function ne(e){let t=`/${e.name} `;w(t),requestAnimationFrame(()=>m.current?.setSelectionRange(t.length,t.length))}let re=e.trim().length>0,ie=d??null;function ae(e){let t=e.currentTarget,i={key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing,keyCode:e.keyCode};if(F&&!e.nativeEvent.isComposing){if(e.key===`ArrowDown`||e.key===`ArrowUp`){e.preventDefault(),j(t=>(t+(e.key===`ArrowDown`?1:-1)+ee.length)%ee.length);return}if((e.key===`Enter`||e.key===`Tab`)&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey){e.preventDefault(),e.stopPropagation(),ne(ee[A]??ee[0]);return}if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),N(b);return}}if(SH(r,e.key,e.altKey)){e.preventDefault(),e.stopPropagation();let n=t.selectionStart??t.value.length,r=t.selectionEnd??n;w(t.value.slice(0,n)+`
368
368
  `+t.value.slice(r)),requestAnimationFrame(()=>t.setSelectionRange(n+1,n+1));return}if(vH(i,re&&!l&&!v)){e.preventDefault(),e.stopPropagation(),n();return}if(bH(i,!!p&&re&&!l&&!v)){e.preventDefault(),e.stopPropagation(),p();return}if(xH(i)){let e=t.value,n=t.selectionStart??e.length,r=t.selectionEnd??n;requestAnimationFrame(()=>{t.value===e&&(w(e.slice(0,n)+`
369
- `+e.slice(r)),requestAnimationFrame(()=>t.setSelectionRange(n+1,n+1)))})}e.key===`Escape`&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.stopPropagation(),t.blur())}return(0,V.jsxs)(`div`,{className:`group relative rounded-xl border bg-bg transition-colors focus-within:border-accent ${g?`border-dashed border-accent`:`border-border`}`,onDragOver:e=>{[...e.dataTransfer.items].some(e=>e.kind===`file`)&&(e.preventDefault(),_(!0))},onDragLeave:()=>_(!1),onDrop:e=>{e.preventDefault(),_(!1),E(e.dataTransfer.files)},children:[g&&(0,V.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-xl bg-bg/80 text-[12px] text-muted`,children:`Drop file to attach`}),F&&(0,V.jsx)(`div`,{ref:te,"data-slash-menu":!0,className:`absolute bottom-full left-0 right-0 z-20 mb-1.5 max-h-56 overflow-y-auto rounded-lg border border-border bg-bg py-1 shadow-lg`,children:ee.map((e,t)=>(0,V.jsxs)(`button`,{type:`button`,"data-suggest-index":t,onMouseDown:e=>e.preventDefault(),onClick:()=>ne(e),onMouseEnter:()=>j(t),className:`flex w-full items-baseline gap-2 px-3.5 py-1.5 text-left ${t===A?`bg-panel-2`:``}`,children:[(0,V.jsxs)(`span`,{className:`shrink-0 text-[12px] font-medium text-fg`,children:[`/`,e.name]}),e.description&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-muted`,children:e.description})]},e.name))}),(0,V.jsx)(`textarea`,{id:a,ref:m,"data-surface":r,value:b,autoFocus:c,disabled:l,onChange:e=>w(e.target.value),onKeyDown:ae,onPaste:e=>{let t=[...e.clipboardData.items].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(Boolean);t.length&&(e.preventDefault(),E(t))},placeholder:i,rows:1,spellCheck:!1,style:{minHeight:o,maxHeight:s},className:`block w-full resize-none bg-transparent px-3.5 ${u?`py-2.5 pb-3`:`py-2.5 ${ie?jH:MH}`} text-[13px] leading-relaxed text-fg outline-none placeholder:text-muted scrollbar-none disabled:opacity-60`}),x.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5 px-3 pb-2 ${ie?`pr-[6.6875rem]`:`pr-20`}`,children:x.map((e,t)=>(0,V.jsx)(qH,{attachment:e,disabled:l,onRemove:()=>T(S.filter((e,n)=>n!==t))},`${e.path}-${t}`))}),u&&(0,V.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1 pl-1.5 pb-1.5 ${ie?`pr-[6.6875rem]`:`pr-20`}`,children:u}),ie&&(0,V.jsx)(`div`,{className:`absolute bottom-2 right-[43px] flex items-center`,children:ie}),(0,V.jsx)(`input`,{ref:h,type:`file`,multiple:!0,accept:by,className:`hidden`,onChange:e=>{E(e.target.files),e.target.value=``}}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>h.current?.click(),disabled:l||v,title:`Attach files`,"aria-label":`Attach files`,className:`absolute bottom-2 ${ie?kH:AH} flex h-7 w-7 items-center justify-center rounded-lg text-muted transition-[color,background-color] enabled:hover:bg-panel-2/70 enabled:hover:text-fg disabled:opacity-50`,children:v?(0,V.jsx)(dw,{size:15,strokeWidth:2,className:`animate-spin`}):(0,V.jsx)(gw,{size:15,strokeWidth:2})}),(0,V.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:n,disabled:!re||l||v,title:`Send (Enter)`,"aria-label":`Send`,className:`absolute bottom-2 ${OH} flex h-7 w-7 items-center justify-center rounded-lg transition-all ${re&&!l&&!v?`bg-fg text-bg hover:opacity-90 active:scale-95`:`bg-panel-2 text-muted`}`,children:l?(0,V.jsx)(dw,{size:14,strokeWidth:2.5,className:`animate-spin`}):(0,V.jsx)(AC,{size:14,strokeWidth:2.5})})]})}function qH({attachment:e,disabled:t,onRemove:n}){let[r,i]=(0,B.useState)(!1),a=e.path.split(`/`).filter(Boolean).pop()||e.path,o=(a.includes(`.`)?a.split(`.`).pop():``).toUpperCase();return(0,V.jsxs)(`div`,{className:`group/att relative h-11 w-11`,title:a,children:[e.kind===`image`&&!r?(0,V.jsx)(`img`,{src:RH(e.path),alt:a,onError:()=>i(!0),className:`h-11 w-11 rounded-md border border-border object-cover`}):(0,V.jsxs)(`div`,{className:`flex h-11 w-11 flex-col items-center justify-center gap-0.5 rounded-md border border-border bg-panel-2 px-1`,children:[(0,V.jsx)(XC,{size:15,strokeWidth:2,className:`shrink-0 text-muted`}),o&&(0,V.jsx)(`span`,{className:`max-w-full truncate text-[8px] font-medium leading-none text-muted/80`,children:o})]}),(0,V.jsx)(`button`,{type:`button`,onClick:n,disabled:t,title:`Remove ${a}`,"aria-label":`Remove ${a}`,className:`absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full border border-border bg-bg text-muted opacity-0 transition-opacity hover:text-fg focus-visible:opacity-100 group-hover/att:opacity-100 disabled:hidden`,children:(0,V.jsx)(Pw,{size:10,strokeWidth:2.5})})]})}function JH(){return qd({queryKey:[`githubStatus`],queryFn:()=>X.githubStatus(),staleTime:3e4,refetchOnWindowFocus:!0,refetchInterval:e=>{let t=e.state.data;return t?.inRepo&&t.authed?!1:6e4}})}function YH(){let e=JH();return!!(e.data?.inRepo&&e.data.authed)}function XH({className:e=``}){return YH()?(0,V.jsx)(`button`,{type:`button`,onClick:FS,onMouseDown:e=>e.preventDefault(),title:`Investigate this issue and make recommendations`,"aria-label":`Investigate this issue and make recommendations`,className:`flex h-7 w-7 items-center justify-center rounded-lg text-muted outline-none transition-[color,background-color,box-shadow] enabled:hover:bg-panel-2/70 enabled:hover:text-fg enabled:focus-visible:bg-panel-2/70 enabled:focus-visible:text-muted enabled:focus-visible:ring-1 enabled:focus-visible:ring-muted/80 enabled:focus-visible:ring-offset-1 enabled:focus-visible:ring-offset-bg enabled:active:bg-elevated enabled:active:text-muted disabled:bg-transparent disabled:text-muted/35 ${e}`,children:(0,V.jsx)(rw,{size:15,strokeWidth:2})}):null}var ZH=`prompt-control-type petite-caps`,QH=ZH,$H=ZH,eU=`profile-grid-cell relative flex h-6 cursor-pointer select-none items-center justify-start rounded border border-transparent px-1 text-left text-muted outline-none transition-colors ${QH} data-[highlighted]:border-border data-[highlighted]:bg-panel-2 data-[highlighted]:text-fg data-[highlighted]:outline data-[highlighted]:outline-1 data-[highlighted]:outline-offset-1 data-[highlighted]:outline-fg/55 data-[state=checked]:border-accent/70 data-[state=checked]:bg-accent/10 data-[state=checked]:font-medium data-[state=checked]:text-fg data-[state=checked]:ring-1 data-[state=checked]:ring-inset data-[state=checked]:ring-accent/90`;function tU(e){return`minmax(6rem, 7rem) repeat(${Math.max(0,e)}, auto)`}var nU=[`ultra`,`ultracode`],rU=[`low`,`medium`,`high`,`xhigh`,`max`,...nU];function iU(e){return[...new Set(e.flatMap(e=>e.options.flatMap(e=>e.efforts)))].sort((e,t)=>{let n=rU.indexOf(e),r=rU.indexOf(t);return n===-1&&r===-1?e.localeCompare(t):n===-1?1:r===-1?-1:n-r})}function aU(e){let t=[];for(let n of iU(e)){let e=nU.includes(n)?t.find(e=>nU.includes(e[0])):void 0;e?e.push(n):t.push([n])}return t}function oU(e){return e.flatMap(e=>e.options.flatMap(t=>t.efforts.map(n=>({provider:e.id,model:t.model,effort:n}))))}function sU(e){return JSON.stringify([e.provider,e.model,e.effort])}function cU(e,t){return oU(e).find(e=>sU(e)===t)}function lU(e,t){return!t?.model||!t.effort?!1:e.some(e=>(!t.provider||e.id===t.provider)&&e.options.some(e=>e.model===t.model&&e.efforts.includes(t.effort)))}function uU(e,t,n=`Profile unknown`){if(!t?.model&&!t?.effort)return n;let r=e.flatMap(e=>e.options).find(e=>e.model===t.model)?.label??t.model??`Model unknown`;return t.effort?`${r} › ${t.effort}`:r}function dU(e,t,n){let r=aU(e),i=e=>r.findIndex(t=>t.includes(e)),a=e.flatMap(e=>e.options.map(t=>({provider:e.id,option:t}))),o=a.findIndex(e=>e.provider===t.provider&&e.option.model===t.model);if(o===-1)return null;let s=a[o],c=s.option.efforts.indexOf(t.effort);if(c===-1)return null;if(n===`Home`||n===`End`||n===`ArrowLeft`||n===`ArrowRight`){let e=n===`Home`?0:n===`End`?s.option.efforts.length-1:c+(n===`ArrowLeft`?-1:1),t=s.option.efforts[e];return t?{provider:s.provider,model:s.option.model,effort:t}:null}let l=a[o+(n===`ArrowUp`?-1:1)];if(!l)return null;let u=i(t.effort),d=l.option.efforts.reduce((e,t)=>e?Math.abs(i(t)-u)<Math.abs(i(e)-u)?t:e:t,void 0);return d?{provider:l.provider,model:l.option.model,effort:d}:null}var fU,pU=!1;function mU(){pU||typeof window>`u`||(pU=!0,window.addEventListener(`keydown`,e=>{e.key!==`Escape`||!fU||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),gU())},{capture:!0}))}function hU(e){mU();let t={dismiss:e};return fU=t,()=>{fU===t&&(fU=void 0)}}function gU(){let e=fU;return e?(fU=void 0,e.dismiss(),!0):!1}function _U(e){gU()&&e.preventDefault(),e.stopPropagation()}function vU(e){return e===`xhigh`?`X-high`:e.charAt(0).toUpperCase()+e.slice(1)}function yU({groups:e,value:t,pending:n,onValueChange:r,placeholder:i,ariaLabel:a,menuAriaLabel:o=`Choose model and effort`,title:s,disabled:c=!1,compact:l=!1,side:u=`bottom`,menuZClass:d=xV,className:f=``}){let[p,m]=(0,B.useState)(!1),h=(0,B.useRef)(p),g=(0,B.useRef)(c),_=(0,B.useRef)(void 0),v=(0,B.useRef)(new Map),y=(0,B.useRef)(void 0),b=(0,B.useMemo)(()=>aU(e),[e]),x=(0,B.useMemo)(()=>e.flatMap(e=>e.options.flatMap(t=>t.efforts.map(n=>({provider:e.id,model:t.model,effort:n})))),[e]),S=l?$H:QH,C=c?`cursor-not-allowed opacity-45`:`cursor-pointer transition-colors hover:border-border hover:bg-panel-2 hover:text-fg`,w=lU(e,t),T=w&&t?.provider&&t.model&&t.effort?sU(t):void 0,E=n?.model||n?.effort?uU(e,n,`Pending profile`):void 0;h.current=p,g.current=c;function D(){h.current=!1,_.current=void 0,m(!1)}(0,B.useLayoutEffect)(()=>{let e=e=>{e.key!==`Escape`||!h.current||g.current||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_.current?.(),D())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]),(0,B.useLayoutEffect)(()=>{!c||!p||(_.current?.(),D())},[c,p]),(0,B.useLayoutEffect)(()=>()=>_.current?.(),[]),(0,B.useLayoutEffect)(()=>{T===y.current&&(y.current=void 0)},[T]);function O(e){let t=sU(e);y.current!==t&&(y.current=t,r(e))}function k(t,n){if(![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(t.key))return;let r=dU(e,n,t.key);r&&(t.preventDefault(),t.stopPropagation(),v.current.get(sU(r))?.focus())}return(0,V.jsxs)(lV,{modal:!1,open:p,onOpenChange:e=>{_.current?.(),_.current=void 0,h.current=e,m(e),e&&(_.current=hU(D))},children:[(0,V.jsx)(uV,{asChild:!0,disabled:c,children:(0,V.jsxs)(`button`,{type:`button`,"aria-label":a,"aria-invalid":!w&&(t?.model||t?.effort)?!0:void 0,"aria-description":E?`Pending ${E}`:void 0,title:s,"data-profile-known":w?`true`:`false`,"data-profile-pending":E?`true`:void 0,className:`profile-grid-trigger group inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border border-border/50 bg-transparent px-2 py-1 text-left text-muted outline-none data-[state=open]:border-border data-[state=open]:bg-panel-2 ${C} ${f} ${S}`,children:[(0,V.jsx)(`span`,{className:`profile-grid-value relative -top-px min-w-0 flex-1 truncate text-left ${S}`,children:uU(e,t,i)}),E&&(0,V.jsx)(dw,{"aria-hidden":`true`,size:l?10:11,className:`shrink-0 animate-spin text-muted/65`}),(0,V.jsx)(FC,{"aria-hidden":`true`,size:l?11:13,className:`shrink-0 text-fg/65 transition-transform group-data-[state=open]:rotate-180`})]})}),(0,V.jsx)(dV,{children:(0,V.jsxs)(fV,{"aria-label":o,align:`start`,side:u,sideOffset:5,collisionPadding:8,onEscapeKeyDown:e=>e.stopPropagation(),className:`profile-grid-menu ${d} ${bV} max-h-[min(360px,var(--radix-dropdown-menu-content-available-height))] max-w-[calc(100vw-1rem)] overflow-auto rounded-lg p-1.5 ${S}`,children:[e.map(t=>(0,V.jsxs)(pV,{children:[t.label&&(0,V.jsx)(mV,{className:`px-1.5 pb-1 pt-1 text-left font-medium tracking-[0.07em] text-muted/55 first:pt-0.5`,children:t.label}),(0,V.jsx)(gV,{value:T,onValueChange:t=>{let n=cU(e,t);n&&O(n)},children:t.options.map(e=>(0,V.jsxs)(`div`,{"data-profile-grid-row":e.model,className:`grid w-max items-center gap-1 py-0.5`,style:{gridTemplateColumns:tU(b.length)},children:[(0,V.jsx)(`span`,{className:`profile-grid-model-label min-w-0 max-w-[9.5rem] truncate px-1.5 text-left text-muted ${S}`,title:e.label,children:e.label}),b.map(n=>{let r=n.find(t=>e.efforts.includes(t)),i=n.reduce((e,t)=>vU(t).length>vU(e).length?t:e);if(!r)return(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`invisible cursor-default border border-transparent px-1 text-left font-medium ${S}`,children:vU(i)},i);let a={provider:t.id,model:e.model,effort:r},o=sU(a);return(0,V.jsx)(_V,{value:o,ref:e=>{e?v.current.set(o,e):v.current.delete(o)},onKeyDown:e=>k(e,a),onSelect:e=>{e.preventDefault(),O(a),_.current?.(),D()},"aria-label":`${e.label}, ${vU(r)} effort`,title:`${e.label} › ${vU(r)}`,className:eU,children:(0,V.jsxs)(`span`,{className:`grid`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`invisible col-start-1 row-start-1 font-medium`,children:vU(r)}),(0,V.jsx)(`span`,{className:`col-start-1 row-start-1`,children:vU(r)})]})},r)})]},e.model))}),t!==e.at(-1)&&(0,V.jsx)(yV,{className:`my-1 h-px bg-border`})]},t.id)),x.length===0&&(0,V.jsx)(`div`,{className:`px-2 py-1.5 text-muted/60`,children:`No profiles available`})]})})]})}async function bU(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}if(!xU(e))throw Error(`the browser blocked clipboard access`)}function xU(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`0`,t.style.left=`0`,t.style.opacity=`0`,document.body.append(t);let n=document.getSelection(),r=n&&n.rangeCount>0?n.getRangeAt(0):null;t.select(),t.setSelectionRange(0,e.length);let i=!1;try{i=document.execCommand(`copy`)}catch{i=!1}return t.remove(),r&&n&&(n.removeAllRanges(),n.addRange(r)),i}var SU={claude:`claude auth login`,codex:`codex login`},CU={claude:`Claude`,codex:`Codex`};function wU(e){let t=e.trim();return t===`/login`?`login`:t===`/logout`?`logout`:null}var TU=(0,B.lazy)(()=>UO(()=>import(`./TerminalPane-K-DhxpCR.js`).then(e=>({default:e.TerminalPane})),__vite__mapDeps([0,1])));function EU({backend:e,onClose:t,onAuthed:n}){let r=Md(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(null),c=(0,B.useRef)(!1),l=SU[e],u=CU[e],d=Jd({mutationFn:()=>X.accountLoginStart({backend:e}),onSuccess:e=>{c.current=!1,s(e.attemptId)},onError:e=>Q(`Couldn't start the sign-in terminal: ${e.message.slice(0,80)} — use the command below instead`,{duration:7e3})}),f=qd({queryKey:[`accountLoginStatus`,o],queryFn:()=>X.accountLoginStatus({attemptId:o}),enabled:!!o,refetchInterval:2e3});(0,B.useEffect)(()=>{if(!o||c.current)return;let t=f.data;if(!(!t||t.state===`running`||t.state===`unknown`)){if(c.current=!0,t.auth!==`signed-out`){r.setQueryData([`authStatus`],n=>n&&{...n,[e]:t.auth}),Q(`Signed in to ${u}`),n();return}Q(`${u} sign-in didn't complete — try again or use the command below`,{duration:7e3}),s(null)}},[o,f.data,e,u]);function p(){o&&!c.current&&X.accountLoginCancel({attemptId:o}).catch(()=>{})}let m=(0,B.useRef)({attempt:null,settled:!1});m.current={attempt:o,settled:c.current},(0,B.useEffect)(()=>()=>{let{attempt:e,settled:t}=m.current;e&&!t&&X.accountLoginCancel({attemptId:e}).catch(()=>{})},[]);async function h(){try{await bU(l),a(!0),window.setTimeout(()=>a(!1),1500)}catch{Q(`Couldn't copy — select the command and copy it manually`,{duration:6e3})}}let g=Jd({mutationFn:()=>X.authStatus(),onSuccess:t=>{if(r.setQueryData([`authStatus`],t),t[e]===`signed-out`){Q(`Still signed out of ${u} — run the command, then retry`,{duration:6e3});return}n()},onError:()=>n()});return(0,V.jsx)(FV,{open:!0,onOpenChange:e=>{e||(p(),t())},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] ${o?`w-[680px]`:`w-[440px]`} max-w-[92vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,V.jsxs)(QV,{className:`mb-1 text-[14px] font-medium`,children:[`Signed out of `,u]}),o?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:`mb-3 text-[12.5px] leading-relaxed text-muted`,children:[`This terminal is running `,(0,V.jsx)(`code`,{className:`font-mono-keep text-fg/90`,children:l}),` — follow its prompts (it may open your browser). Frizz detects completion automatically.`]}),(0,V.jsx)(`div`,{className:`mb-4 h-[340px] overflow-hidden rounded-lg border border-border bg-[#0d0e10]`,children:(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-muted`,children:`Opening terminal…`}),children:(0,V.jsx)(TU,{slug:o})})}),(0,V.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>{p(),s(null)},className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:`Cancel sign-in`})})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:`mb-4 text-[12.5px] leading-relaxed text-muted`,children:[`Frizz can't start a `,u,` thread until you're signed in. Sign in here, or run the command in your own terminal and retry:`]}),(0,V.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg border border-border bg-panel-2 px-3 py-2`,children:[(0,V.jsx)(`code`,{className:`flex-1 select-all font-mono-keep text-[12.5px] text-fg`,children:l}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Copy command`,onClick:h,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel hover:text-fg`,children:i?(0,V.jsx)(PC,{size:14,strokeWidth:2,className:`text-green-400`}):(0,V.jsx)(qC,{size:14,strokeWidth:1.8})})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>g.mutate(),disabled:g.isPending,className:`flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-[12.5px] text-fg/90 outline-none transition-colors hover:bg-panel-2 disabled:opacity-60`,children:[g.isPending&&(0,V.jsx)(dw,{size:13,className:`animate-spin`}),`Retry`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>d.mutate(),disabled:d.isPending,className:`flex items-center gap-1.5 rounded-md bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white outline-none transition-opacity hover:opacity-90 disabled:opacity-60`,children:[d.isPending&&(0,V.jsx)(dw,{size:13,className:`animate-spin`}),`Sign in here`]})]})]})]})]})})}function DU({backend:e,onClose:t}){let n=Md(),r=CU[e],i=Jd({mutationFn:()=>X.accountLogout({backend:e}),onSuccess:i=>{n.setQueryData([`authStatus`],t=>t&&{...t,[e]:i.auth}),i.status===`done`?Q(`Signed out of ${r}`):i.status===`blocked`?Q(`Not signed out — ${i.activeThreads} active ${r} thread${i.activeThreads===1?``:`s`}. Let them finish (or complete them) first.`,{duration:7e3}):Q(`${r} sign-out failed: ${i.detail??`unknown error`}`,{duration:7e3}),t()},onError:e=>{Q(`${r} sign-out failed: ${e.message.slice(0,80)}`,{duration:7e3}),t()}});return(0,V.jsx)(FV,{open:!0,onOpenChange:e=>{!e&&!i.isPending&&t()},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] w-[420px] max-w-[86vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,V.jsxs)(QV,{className:`mb-1 text-[14px] font-medium`,children:[`Sign out of `,r,`?`]}),(0,V.jsxs)(`p`,{className:`mb-4 text-[12.5px] leading-relaxed text-muted`,children:[`New `,r,` threads will be blocked until you sign in again. Running `,r,` threads are left untouched — sign-out is refused while any are active.`]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:t,disabled:i.isPending,className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-60`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>i.mutate(),disabled:i.isPending,className:`flex items-center gap-1.5 rounded-md bg-red-500/90 px-3 py-1.5 text-[12.5px] font-medium text-white outline-none transition-opacity hover:opacity-90 disabled:opacity-60`,children:[i.isPending&&(0,V.jsx)(dw,{size:13,className:`animate-spin`}),`Sign out`]})]})]})]})})}var OU=Db.options,kU={auto:`Auto`,default:`Default`,acceptEdits:`Accept edits`,plan:`Plan`,bypassPermissions:`Bypass`},AU={auto:`auto — safe actions auto-approved, risky ones prompt`,default:`default — prompt for every permission`,acceptEdits:`accept edits — file edits auto-approved`,plan:`plan — read-only planning, approval before changes`,bypassPermissions:`bypass — never prompt (dangerous)`};OU.filter(e=>e!==`plan`).map(e=>({value:e,label:kU[e],title:AU[e]}));var jU=[`auto`,`bypassPermissions`].map(e=>({value:e,label:kU[e],title:AU[e]})),MU=[{value:`fable`,label:`Fable`},{value:`opus`,label:`Opus`},{value:`sonnet`,label:`Sonnet`},{value:`haiku`,label:`Haiku`}];new Set([{slug:`gpt-5.6-sol`,displayName:`GPT-5.6 Sol`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-terra`,displayName:`GPT-5.6 Terra`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-luna`,displayName:`GPT-5.6 Luna`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`]},{slug:`gpt-5.5`,displayName:`GPT-5.5`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`]}].map(e=>e.slug));function NU(e){return e===`plan`?`auto`:e}var PU=[`low`,`medium`,`high`,`xhigh`,`max`],FU=`ultracode`,IU=new Set([`fable`,`opus`,`sonnet`]);function LU(e){return e&&IU.has(e)?[...PU,FU]:[...PU]}var RU={low:`Low`,medium:`Medium`,high:`High`,xhigh:`X-high`,max:`Max`,ultra:`Ultra`,ultracode:`Ultracode`};function zU(e){return RU[e]??e.charAt(0).toUpperCase()+e.slice(1)}function BU(e,t){let n=LU(e).map(e=>({value:e,label:zU(e)}));return t.withDefault?[{value:``,label:`Default`},...n]:n}function VU(e,t){let n=(e?.efforts??[]).map(e=>({value:e,label:zU(e)}));return t.withDefault?[{value:``,label:`Default`},...n]:n}function HU(e,t){return t.field===`backend`?{...e,backend:t.value}:t.field===`profile`?{...e,backend:t.backend,[t.backend]:{...e[t.backend],model:t.model,effort:t.effort}}:{...e,...t.field===`model`?{backend:t.backend}:{},[t.backend]:{...e[t.backend],[t.field]:t.value}}}function UU(e){return[{id:`claude`,label:`Claude Code`,options:MU.map(e=>({model:e.value,label:e.label,defaultEffort:`high`,efforts:LU(e.value)}))},{id:`codex`,label:`Codex`,options:e.map(e=>({model:e.slug,label:e.displayName,defaultEffort:e.defaultEffort,efforts:e.efforts}))}]}function WU(e,t){let n=e.backend,r=e[n],i=r.model??(n===`claude`?`opus`:t[0]?.slug??``),a=n===`codex`?t.find(e=>e.slug===i):void 0,o=n===`claude`?MU.some(e=>e.value===i):t.some(e=>e.slug===i),s=n===`claude`?`high`:a?.defaultEffort??``,c=r.effort??s,l=n===`claude`?BU(i,{withDefault:!1}):VU(a,{withDefault:!1}),u=l.some(e=>e.value===c);return{backend:n,model:i,effort:c,codexModel:a,modelAvailable:o,effortAvailable:u,effortOptions:c&&!u?[{value:c,label:`${c} (unavailable)`,title:`Saved reasoning level is not available for this model`},...l]:l}}function GU(){let e=Md(),t=qd({queryKey:[`dispatchPreferencesGet`],queryFn:()=>X.dispatchPreferencesGet()}),n=qd({queryKey:[`codexModels`],queryFn:()=>X.codexModels()}),r=n.data??[],i=Jd({mutationFn:e=>X.dispatchPreferenceSet(e),scope:{id:`dispatch-preferences`},onMutate:t=>{let n=e.getQueryData([`dispatchPreferencesGet`]);n&&e.setQueryData([`dispatchPreferencesGet`],HU(n,t))},onError:t=>{e.invalidateQueries({queryKey:[`dispatchPreferencesGet`]}),Q(`Could not save new-thread preference: ${t.message.slice(0,80)}`)}}),a=!!t.data&&!!n.data;return{resolved:(0,B.useMemo)(()=>a?WU(t.data,r):void 0,[a,t.data,r]),codexList:r,loadError:t.isError||n.isError,saveProfile:i.mutate}}var KU=`frizz-drafts:v1`,qU=80,JU=512*1024,YU=2*1024*1024,XU=new TextEncoder;function ZU(e){return XU.encode(e).byteLength}function QU(){return{version:1,entries:{}}}function $U(e){if(!e)return QU();try{let t=JSON.parse(e);if(!t||typeof t!=`object`||t.version!==1)return QU();let n=t.entries;if(!n||typeof n!=`object`||Array.isArray(n))return QU();let r={};for(let[e,t]of Object.entries(n))typeof t?.value!=`string`||typeof t?.touchedAt!=`number`||!Number.isFinite(t.touchedAt)||e.length>512||ZU(t.value)>JU||(r[e]={value:t.value,touchedAt:t.touchedAt});return{version:1,entries:r}}catch{return QU()}}function eW(e){let t=Object.entries(e.entries).filter(([,e])=>e.value&&ZU(e.value)<=JU).sort((e,t)=>t[1].touchedAt-e[1].touchedAt),n={};for(let[e,r]of t){if(Object.keys(n).length>=qU)break;n[e]=r,ZU(JSON.stringify({version:1,entries:n}))>YU&&delete n[e]}return{version:1,entries:n}}var tW=new class{snapshot;listeners=new Set;storage;constructor(e=typeof sessionStorage>`u`?void 0:sessionStorage){this.storage=e;let t=null;try{t=e?.getItem(`frizz-drafts:v1`)??null}catch{}this.snapshot=eW($U(t))}getSnapshot=()=>this.snapshot;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));get(e){return this.snapshot.entries[e]?.value??``}set(e,t){let n={...this.snapshot.entries};t?n[e]={value:t,touchedAt:Date.now()}:delete n[e],this.commit({version:1,entries:n})}clear(e){this.snapshot.entries[e]&&this.commit({version:1,entries:Object.fromEntries(Object.entries(this.snapshot.entries).filter(([t])=>t!==e))})}commit(e){this.snapshot=e;try{this.storage?.setItem(KU,JSON.stringify(eW(e)))}catch{}for(let e of this.listeners)e()}};function nW(e){return encodeURIComponent(e||`unresolved-project`)}var rW={dispatch:e=>`dispatch:${nW(e)}:new`,followUp:(e,t,n)=>`followup:${nW(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n??`unowned`)}`,adopt:(e,t)=>`adopt:${nW(e)}:${encodeURIComponent(t)}`,answer:(e,t,n,r,i)=>`answer:${nW(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n??`unowned`)}:${encodeURIComponent(r)}:${i}`,interaction:(e,t,n,r,i,a,o)=>`interaction:${nW(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n)}:${encodeURIComponent(r)}:${i}:${encodeURIComponent(a)}:${encodeURIComponent(o)}`};function iW(){return Hf(Z).board?.projectDir}function aW(e){return Hf(Z).board?.threads.find(t=>t.id===e)?.sessionId}function oW(e){let t=(0,B.useCallback)(()=>tW.get(e),[e]);return[(0,B.useSyncExternalStore)(tW.subscribe,t,t),(0,B.useCallback)(t=>tW.set(e,t),[e]),(0,B.useCallback)(()=>tW.clear(e),[e])]}function sW(e){let t=(0,B.useCallback)(()=>JSON.stringify(Object.fromEntries(e.map(e=>[e,tW.get(e)]))),[e.join(`\0`)]),n=(0,B.useSyncExternalStore)(tW.subscribe,t,t);return(0,B.useMemo)(()=>new Map(Object.entries(JSON.parse(n))),[n])}function cW({autoFocus:e,onDispatched:t}){let{resolved:n,codexList:r,loadError:i,saveProfile:a}=GU(),o=YH(),s=iW(),[c,l,u]=oW(rW.dispatch(s)),d=rW.dispatch(s),f=(0,B.useRef)(``),[p,m]=(0,B.useState)(null),h=qd({queryKey:[`authStatus`],queryFn:()=>X.authStatus(),staleTime:3e4}),[g,_]=(0,B.useState)(null),[v,y]=(0,B.useState)(null),b=(0,B.useRef)(null),x=Jd({mutationFn:e=>X.dispatch(e),onMutate:()=>Q(`Starting thread…`,{spinner:!0,sticky:!0}),onSuccess:e=>{m(null),t?.(),Q(`Thread started`,{link:{label:`Open thread`,slug:e.slug}})},onError:(e,t)=>{tW.get(d)||l(f.current||t.prompt),m(null);let n=/^AUTH_REQUIRED:(claude|codex)$/.exec(e.message);if(n){b.current=t,_(n[1]),Q(`Signed out of ${n[1]===`claude`?`Claude`:`Codex`}`,{duration:3e3});return}Q(`Dispatch failed: ${e.message.slice(0,80)}`)}});function S(e){f.current=c,u(),m(e.prompt),x.mutate(e)}function C(){if(!c.trim()||!n)return;let e=wU(c);if(e){u(),e===`login`?(b.current=null,_(n.backend)):y(n.backend);return}if(!n.modelAvailable){Q(`Saved model is unavailable — choose a model before starting the thread`);return}if(!n.effortAvailable){Q(`Saved reasoning level is unavailable for this model — choose another level`);return}let t={prompt:c.trim(),model:n.model,backend:n.backend,effort:n.effort};if(h.data?.[n.backend]===`signed-out`){b.current=t,_(n.backend);return}S(t)}let w=(0,B.useMemo)(()=>n?(0,V.jsx)(yU,{groups:UU(r),value:{provider:n.backend,model:n.model,effort:n.effort},onValueChange:e=>a({field:`profile`,backend:e.provider,model:e.model,effort:e.effort}),ariaLabel:`Model and effort`,title:n.modelAvailable&&n.effortAvailable?`Model and reasoning effort`:`Saved model or reasoning effort unavailable — choose a supported pair`,className:`max-w-[min(21rem,72vw)]`}):(0,V.jsx)(yU,{groups:[],value:void 0,onValueChange:()=>{},placeholder:i?`Profile unavailable`:`Profile loading…`,ariaLabel:`Model and effort loading`,disabled:!0}),[n,r,i,a]);return(0,V.jsxs)(`div`,{className:`w-full flex flex-col gap-3`,children:[(0,V.jsx)(KH,{surface:`newComposer`,autoFocus:e,value:c,onChange:l,onSubmit:C,placeholder:`Describe the task…`,minHeight:96,maxHeight:340,busy:x.isPending,footer:w,leftAction:o?(0,V.jsx)(XH,{}):void 0}),x.isError&&(0,V.jsx)(`span`,{className:`px-0.5 text-[11px] text-red-400 truncate`,children:x.error.message}),p&&(0,V.jsxs)(`div`,{"data-pending-dispatch":!0,role:`status`,className:`rounded-lg border border-border bg-panel-2 px-3 py-2.5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted`,children:[(0,V.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-accent`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:`Starting thread…`})]}),(0,V.jsx)(`p`,{className:`mt-1 line-clamp-2 whitespace-pre-wrap text-[12px] leading-relaxed text-fg`,children:p})]}),g&&(0,V.jsx)(EU,{backend:g,onClose:()=>_(null),onAuthed:()=>{let e=b.current;b.current=null,_(null),e&&S(e)}}),v&&(0,V.jsx)(DU,{backend:v,onClose:()=>y(null)})]})}function lW({onClose:e}){let t=(0,B.useRef)(null),n=(0,B.useRef)(typeof document<`u`&&document.activeElement instanceof HTMLElement?document.activeElement:null);return(0,B.useEffect)(()=>()=>{let e=n.current;window.setTimeout(()=>{e?.isConnected&&e.focus({preventScroll:!0})},0)},[]),(0,V.jsx)(FV,{open:!0,onOpenChange:t=>{t||e()},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-50 bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{ref:t,"aria-modal":`true`,"aria-describedby":void 0,onEscapeKeyDown:_U,onCloseAutoFocus:e=>{e.preventDefault();let t=n.current;t?.isConnected&&t.focus({preventScroll:!0})},onOpenAutoFocus:e=>{e.preventDefault(),t.current?.querySelector(`textarea`)?.focus({preventScroll:!0})},className:`fixed left-1/2 top-1/2 z-50 w-[640px] max-w-[86vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none max-[700px]:top-[calc(env(safe-area-inset-top)+56px)] max-[700px]:w-[calc(100vw-24px)] max-[700px]:max-w-none max-[700px]:translate-y-0`,children:[(0,V.jsx)(QV,{className:`mb-1 text-[14px] font-medium`,children:`New thread`}),(0,V.jsx)(cW,{autoFocus:!0,onDispatched:e})]})]})})}function uW({children:e,onClose:t}){return(0,V.jsx)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center bg-black/30 backdrop-blur-md backdrop-saturate-150`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:e})}var dW=`-mx-1.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-fg/75 outline-none transition-colors hover:bg-elevated hover:text-fg focus-visible:ring-1 focus-visible:ring-border-strong disabled:opacity-55`,fW={claude:`size-[11px] translate-y-px`,codex:`size-[10px]`},pW={claude:{backend:`claude`,label:`Claude Code`},codex:{backend:`codex`,label:`OpenAI Codex`}};function mW(e){return e===`claude`||e===`codex`?pW[e]:void 0}function hW({backend:e,className:t}){let n=mW(e);return n?(0,V.jsx)(`span`,{role:`img`,"aria-label":n.label,className:`inline-flex shrink-0 text-muted/65 ${fW[n.backend]} ${t??``}`,children:n.backend===`codex`?(0,V.jsx)(gW,{}):(0,V.jsx)(_W,{})}):null}function gW(){return(0,V.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,className:`size-full`,fill:`currentColor`,children:(0,V.jsx)(`path`,{d:`M22.282 9.821a6 6 0 0 0-.516-4.91a6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9a6.05 6.05 0 0 0 .743 7.097a5.98 5.98 0 0 0 .51 4.911a6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206a6 6 0 0 0 3.997-2.9a6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081l4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085l4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354l-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023l-.141-.085l-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365l2.602-1.5l2.607 1.5v2.999l-2.597 1.5l-2.607-1.5Z`})})}function _W(){return(0,V.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,className:`size-full`,fill:`currentColor`,children:(0,V.jsx)(`path`,{d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`})})}typeof window<`u`&&window.document&&window.document.createElement;function vW(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}function yW(e,t=[]){let n=[];function r(t,r){let i=B.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=B.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=B.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>B.createContext(e));return function(n){let r=n?.[e]||t;return B.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,bW(i,...t)]}function bW(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var xW=`DismissableLayer`,SW=`dismissableLayer.update`,CW=`dismissableLayer.pointerDownOutside`,wW=`dismissableLayer.focusOutside`,TW,EW=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),DW=B.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=B.useContext(EW),[d,f]=B.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=B.useState({}),h=AN(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=B.useRef(!1),C=jW(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:B.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=MW(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=aP(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return B.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),B.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(TW=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),NW(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=TW))}},[d,p,n,u]),B.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),NW())},[d,u]),B.useEffect(()=>{let e=()=>m({});return document.addEventListener(SW,e),()=>document.removeEventListener(SW,e)},[]),(0,V.jsx)(eP.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:vW(e.onFocusCapture,w.onFocusCapture),onBlurCapture:vW(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:vW(e.onPointerDownCapture,C.onPointerDownCapture)})});DW.displayName=xW;var OW=`DismissableLayerBranch`,kW=B.forwardRef((e,t)=>{let n=B.useContext(EW),r=B.useRef(null),i=AN(t,r);return B.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(eP.div,{...e,ref:i})});kW.displayName=OW;var AW=()=>!0;function jW(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=AW}=t,s=aP(e),c=B.useRef(!1),l=B.useRef(!1),u=B.useRef(new Map),d=B.useRef(()=>{});return B.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}function p(e){l.current&&u.current.set(e.type,!1)}let m=a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||PW(CW,s,p,{discrete:!0})};if(!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:()=>c.current=!0}}function MW(e,t=globalThis?.document){let n=aP(e),r=B.useRef(!1);return B.useEffect(()=>{let e=e=>{e.target&&!r.current&&PW(wW,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function NW(){let e=new CustomEvent(SW);document.dispatchEvent(e)}function PW(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?tP(i,a):i.dispatchEvent(a)}var FW=`focusScope.autoFocusOnMount`,IW=`focusScope.autoFocusOnUnmount`,LW={bubbles:!1,cancelable:!0},RW=`FocusScope`,zW=B.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=aP(i),u=aP(a),d=B.useRef(null),f=AN(t,c),p=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:KW(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||KW(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&KW(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),B.useEffect(()=>{if(s){qW.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(FW,LW);s.addEventListener(FW,l),s.dispatchEvent(t),t.defaultPrevented||(BW(XW(HW(s)),{select:!0}),document.activeElement===e&&KW(s))}return()=>{s.removeEventListener(FW,l),setTimeout(()=>{let t=new CustomEvent(IW,LW);s.addEventListener(IW,u),s.dispatchEvent(t),t.defaultPrevented||KW(e??document.body,{select:!0}),s.removeEventListener(IW,u),qW.remove(p)},0)}}},[s,l,u,p]);let m=B.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=VW(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&KW(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&KW(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(eP.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});zW.displayName=RW;function BW(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(KW(r,{select:t}),document.activeElement!==n)return}function VW(e){let t=HW(e);return[UW(t,e),UW(t.reverse(),e)]}function HW(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function UW(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):WW(r,{upTo:t})))return r}function WW(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function GW(e){return e instanceof HTMLInputElement&&`select`in e}function KW(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&GW(e)&&t&&e.select()}}var qW=JW();function JW(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=YW(e,t),e.unshift(t)},remove(t){e=YW(e,t),e[0]?.resume()}}}function YW(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function XW(e){return e.filter(e=>e.tagName!==`A`)}var ZW=`Popper`,[QW,$W]=yW(ZW),[eG,tG]=QW(ZW),nG=e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,V.jsx)(eG,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};nG.displayName=ZW;var rG=`PopperAnchor`,iG=B.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=tG(rG,n),o=B.useRef(null),s=a.onAnchorChange,c=AN(t,B.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=B.useRef(null);B.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&mG(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,V.jsx)(eP.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});iG.displayName=rG;var aG=`PopperContent`,[oG,sG]=QW(aG),cG=B.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=tG(aG,n),[_,v]=B.useState(null),y=AN(t,v),[b,x]=B.useState(null),S=rL(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(fG),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=GI({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>jI(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[qI({mainAxis:i+w,alignmentAxis:o}),c&&JI({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?YI():void 0,...k}),c&&XI({...k}),ZI({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&$I({element:b,padding:s}),pG({arrowWidth:C,arrowHeight:w}),f&&QI({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),ee=g.setPlacementState;NN(()=>(ee(M),()=>{ee(void 0)}),[M,ee]);let[F,te]=mG(M),ne=aP(m);NN(()=>{N&&ne?.()},[N,ne]);let re=P.arrow?.x,ie=P.arrow?.y,ae=P.arrow?.centerOffset!==0,[oe,se]=B.useState();return NN(()=>{_&&se(window.getComputedStyle(_).zIndex)},[_]),(0,V.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(oG,{scope:n,placedSide:F,placedAlign:te,onArrowChange:x,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,V.jsx)(eP.div,{"data-side":F,"data-align":te,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});cG.displayName=aG;var lG=`PopperArrow`,uG={top:`bottom`,right:`left`,bottom:`top`,left:`right`},dG=B.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=sG(lG,n),a=uG[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(nL,{...r,ref:t,style:{...r.style,display:`block`}})})});dG.displayName=lG;function fG(e){return e!==null}var pG=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=mG(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function mG(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var hG=nG,gG=iG,_G=cG,vG=dG;function yG(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}var bG=e=>{let{present:t,children:n}=e,r=xG(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=CG(r.ref,TG(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null};bG.displayName=`Presence`;function xG(e){let[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),a=B.useRef(`none`),o=B.useRef(void 0),[s,c]=yG(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return B.useEffect(()=>{s===`mounted`?(a.current=o.current??wG(r.current),o.current=void 0):a.current=`none`},[s]),NN(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=wG(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),NN(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=wG(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=wG(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:B.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=wG(t)}else r.current=null;n(e)},[])}}function SG(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function CG(...e){let t=B.useRef(e);return t.current=e,B.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=SG(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():SG(n[e],null)}}},[])}function wG(e){return e?.animationName||`none`}function TG(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var EG=`Popover`,[DG,mte]=yW(EG,[$W]),OG=$W(),[kG,AG]=DG(EG),jG=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=OG(t),c=B.useRef(null),[l,u]=B.useState(!1),[d,f]=RN({prop:r,defaultProp:i??!1,onChange:a,caller:EG});return(0,V.jsx)(hG,{...s,children:(0,V.jsx)(kG,{scope:t,contentId:HP(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:B.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:B.useCallback(()=>u(!0),[]),onCustomAnchorRemove:B.useCallback(()=>u(!1),[]),modal:o,children:n})})};jG.displayName=EG;var MG=`PopoverAnchor`,NG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=AG(MG,n),a=OG(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return B.useEffect(()=>(o(),()=>s()),[o,s]),(0,V.jsx)(gG,{...a,...r,ref:t})});NG.displayName=MG;var PG=`PopoverTrigger`,FG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=AG(PG,n),a=OG(n),o=AN(t,i.triggerRef),s=(0,V.jsx)(eP.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":XG(i.open),...r,ref:o,onClick:vW(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,V.jsx)(gG,{asChild:!0,...a,children:s})});FG.displayName=PG;var IG=`PopoverPortal`,[LG,RG]=DG(IG,{forceMount:void 0}),zG=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=AG(IG,t);return(0,V.jsx)(LG,{scope:t,forceMount:n,children:(0,V.jsx)(bG,{present:n||a.open,children:(0,V.jsx)(DL,{asChild:!0,container:i,children:r})})})};zG.displayName=IG;var BG=`PopoverContent`,VG=B.forwardRef((e,t)=>{let n=RG(BG,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=AG(BG,e.__scopePopover);return(0,V.jsx)(bG,{present:r||a.open,children:a.modal?(0,V.jsx)(UG,{...i,ref:t}):(0,V.jsx)(WG,{...i,ref:t})})});VG.displayName=BG;var HG=VN(`PopoverContent.RemoveScroll`),UG=B.forwardRef((e,t)=>{let n=AG(BG,e.__scopePopover),r=B.useRef(null),i=AN(t,r),a=B.useRef(!1);return B.useEffect(()=>{let e=r.current;if(e)return uR(e)},[]),(0,V.jsx)(mz,{as:HG,allowPinchZoom:!0,children:(0,V.jsx)(GG,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:vW(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:vW(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:vW(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),WG=B.forwardRef((e,t)=>{let n=AG(BG,e.__scopePopover),r=B.useRef(!1),i=B.useRef(!1);return(0,V.jsx)(GG,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),GG=B.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=AG(BG,n),p=OG(n);return SP(),(0,V.jsx)(zW,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(DW,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,V.jsx)(_G,{"data-state":XG(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),KG=`PopoverClose`,qG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=AG(KG,n);return(0,V.jsx)(eP.button,{type:`button`,...r,ref:t,onClick:vW(e.onClick,()=>i.onOpenChange(!1))})});qG.displayName=KG;var JG=`PopoverArrow`,YG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=OG(n);return(0,V.jsx)(vG,{...i,...r,ref:t})});YG.displayName=JG;function XG(e){return e?`open`:`closed`}var ZG=jG,QG=NG,$G=FG,eK=zG,tK=VG;function nK({modal:e=!1,...t}){return(0,V.jsx)(ZG,{modal:e,...t})}var rK=$G,iK=QG;function aK({children:e,side:t=`top`,align:n=`center`,sideOffset:r=6,className:i=``,...a}){return(0,V.jsx)(eK,{children:(0,V.jsx)(tK,{side:t,align:n,sideOffset:r,avoidCollisions:!0,collisionPadding:12,onEscapeKeyDown:e=>e.stopPropagation(),className:`${bV} ${wV} rounded-lg outline-none ${i}`,...a,children:e})})}var oK=3e4,sK=45e3;function cK(e,t){return t?AbortSignal.any([t,AbortSignal.timeout(e)]):AbortSignal.timeout(e)}var lK=`text-[9px]`,uK={claude:`text-fg/75! size-[14px]! translate-y-0!`,codex:`text-fg/75! size-[12.75px]! translate-y-0!`};function dK(){let e=qd({queryKey:[`quota`],queryFn:()=>X.quota(),staleTime:1e4}),t=qd({queryKey:[`authStatus`],queryFn:()=>X.authStatus(),staleTime:3e4});return[`claude`,`codex`].some(n=>fK(e.data?.[n],t.data?.[n],e.isLoading))}function fK(e,t,n){return t===`signed-out`||!e&&n?!1:!!e&&e.status===`ok`&&e.windows.length>0}function pK(){let e=Md(),t=(0,B.useRef)(null),[n,r]=(0,B.useState)(!1),i=qd({queryKey:[`quota`],queryFn:({signal:e})=>X.quota(void 0,{signal:cK(oK,e)}),refetchInterval:e=>{let t=e.state.data;return!t||t.claude.status!==`ok`||t.codex.status!==`ok`?15e3:3e4},staleTime:1e4,refetchOnWindowFocus:!0}),a=qd({queryKey:[`authStatus`],queryFn:({signal:e})=>X.authStatus(void 0,{signal:cK(oK,e)}),refetchInterval:12e4,staleTime:3e4,refetchOnWindowFocus:!0}),o=n=>{if(t.current)return;r(!0);let i=Promise.all([X.quota({force:n===`claude`},{signal:cK(sK)}).then(t=>e.setQueryData([`quota`],t)),e.refetchQueries({queryKey:[`authStatus`]})]).then(()=>{}).catch(()=>{}).finally(()=>{t.current=null,r(!1)});t.current=i};return(0,V.jsxs)(`div`,{"data-quota-bar":!0,className:`flex shrink-0 items-center gap-3 ${lK}`,children:[(0,V.jsx)(mK,{backend:`claude`,quota:i.data?.claude,auth:a.data?.claude,email:a.data?.emails?.claude,loading:i.isLoading,fetching:i.isFetching||n,onRecheck:()=>o(`claude`)}),(0,V.jsx)(mK,{backend:`codex`,quota:i.data?.codex,auth:a.data?.codex,email:a.data?.emails?.codex,loading:i.isLoading,fetching:i.isFetching||n,onRecheck:()=>o(`codex`)})]})}function mK({backend:e,quota:t,auth:n,email:r,loading:i,fetching:a,onRecheck:o}){let s=CU[e];if(!fK(t,n,i))return null;let c=hK(100-_K(t.windows).usedPercent);return(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(nK,{onOpenChange:e=>{e&&o()},children:[(0,V.jsx)(rK,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,"aria-label":`${s} quota: ${c}% remaining`,className:`flex items-center gap-1.5 min-w-0 rounded outline-none transition-opacity hover:opacity-80 focus-visible:ring-1 focus-visible:ring-border-strong`,children:[(0,V.jsx)(hW,{backend:e,className:uK[e]}),(0,V.jsxs)(`span`,{className:`tabular-nums ${vK(c)}`,children:[c,`%`]})]})}),(0,V.jsxs)(aK,{side:`bottom`,align:`start`,className:`w-[min(15rem,calc(100vw-1.5rem))] p-3 text-[11px] leading-relaxed text-fg`,children:[(0,V.jsxs)(`div`,{className:`mb-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,V.jsx)(hW,{backend:e}),(0,V.jsx)(`span`,{children:s}),t?.planType&&(0,V.jsxs)(`span`,{className:`text-muted/70`,children:[`· `,yK(t.planType),` plan`]}),a&&(0,V.jsx)(dw,{size:11,className:`animate-spin text-muted/60`,"aria-label":`Rechecking`})]}),r&&(0,V.jsx)(`div`,{"data-quota-account":!0,className:`truncate text-muted/70 select-text`,title:r,children:r})]}),(0,V.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[t.windows.map(e=>{let t=hK(100-e.usedPercent),n=bK(e);return(0,V.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`span`,{className:`text-muted/80`,children:e.label}),(0,V.jsxs)(`span`,{className:`flex items-center gap-2 tabular-nums`,children:[(0,V.jsxs)(`span`,{className:vK(t),children:[t,`% left`]}),n&&(0,V.jsxs)(`span`,{className:`text-muted/55`,children:[`resets `,n]})]})]},e.key)}),t.detail&&(0,V.jsx)(`li`,{className:`pt-1 text-muted/55`,children:t.detail})]})]})]})})}function hK(e){return Math.max(0,Math.min(100,Math.round(e)))}var gK=25;function _K(e){return e.find(e=>e.key===`5h`)??e.reduce((e,t)=>t.usedPercent>e.usedPercent?t:e)}function vK(e){return e<=8?`text-red-400`:e<=gK?`text-accent`:`text-fg/70`}function yK(e){return e&&e[0].toUpperCase()+e.slice(1)}function bK(e){if(!e.resetsAt)return null;let t=e.resetsAt*1e3,n=new Date(t);if(Number.isNaN(n.getTime()))return null;let r=t-Date.now();if(r<=0)return null;if(r<24*36e5){let e=n.getHours(),t=n.getMinutes(),r=e>=12?`pm`:`am`;return e=e%12||12,t===0?`${e}${r}`:`${e}:${String(t).padStart(2,`0`)}${r}`}return n.toLocaleDateString(void 0,{weekday:`short`})}var xK=`frizz:supervisor-status-wake`;function SK(e){return e!==null}function CK(e){return e?.updateRestart===!0&&e.updateAvailable!==!1}function wK(e){return e?.dev===!0}async function TK(e=fetch){try{let t=await e(`/_frizz/control/status`,{headers:{"cache-control":`no-store`}});if(!t.ok||!t.headers.get(`content-type`)?.includes(`application/json`))return null;let n=await t.json();return n.protocol===1&&(n.state===`ready`||n.state===`restarting`||n.state===`failed`)?n:null}catch{return null}}async function EK(e,t){let n=await t(e,{method:`POST`,headers:{"cache-control":`no-store`}}),r;try{r=await n.json()}catch{}if(!n.headers.get(`content-type`)?.includes(`application/json`)||!r||r.protocol!==1||r.state!==`ready`&&r.state!==`restarting`&&r.state!==`failed`)throw Error(`Frizz restart controls are unavailable for this server`);if(!n.ok)throw Error(r.message??`Restart request failed (${n.status})`);if(r.state===`failed`)throw Error(r.message??`Frizz did not become ready`);return r}function DK(e=fetch){return EK(`/_frizz/control/restart`,e)}function OK(e=fetch){return EK(`/_frizz/control/update-restart`,e)}var kK=`Install the latest version of Frizz. Your running threads will not be affected.`,AK=`A newer version of Frizz is available. Your running threads will not be affected.`,jK=`Restart Frizz. Your running threads will not be affected.`,MK=`fixed left-3 right-3 top-12 z-50 w-auto text-left font-sans sm:absolute sm:right-auto sm:-left-1.5 sm:top-[calc(100%+0.65rem)]`,NK=`sm:w-[min(23rem,calc(100vw-1.5rem))]`,PK=`sm:w-[min(34rem,calc(100vw-1.5rem))]`,FK=`rounded-xl bg-elevated p-3.5 shadow-xl shadow-black/45`;function IK({open:e,update:t,version:n,updateVersion:r}){if(!e)return null;let i=t?`Update Frizz`:`Restart Frizz`,a=t?r:void 0;return(0,V.jsxs)(`div`,{id:`update-restart-popover`,role:`tooltip`,"aria-label":i,className:`${MK} ${NK} ${FK} border border-border-strong`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-1.5 left-1.5 h-3 w-3 rotate-45 border-l border-t border-border-strong bg-elevated`}),(0,V.jsxs)(`div`,{className:`relative flex items-center gap-2.5`,children:[(0,V.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-fg/10 text-fg`,children:(0,V.jsx)(bw,{"aria-hidden":`true`,size:14,strokeWidth:2.25})}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-fg`,children:i}),n&&(0,V.jsx)(`span`,{className:`font-mono text-[11px] leading-snug text-muted`,children:a?`${n} → ${a}`:n})]})]}),(0,V.jsx)(`p`,{className:`relative mt-2.5 text-[12px] leading-relaxed text-muted`,children:t?a?AK:kK:jK})]})}var LK=`Frizz kept running the previous version, and your threads are unaffected.`;function RK({update:e,message:t,onDismiss:n}){return(0,V.jsxs)(`div`,{role:`alert`,className:`${MK} ${PK} ${FK} border border-red-500/45`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-1.5 left-1.5 h-3 w-3 rotate-45 border-l border-t border-red-500/45 bg-elevated`}),(0,V.jsxs)(`div`,{className:`relative flex items-center gap-2.5`,children:[(0,V.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-red-500/15 text-red-300`,children:(0,V.jsx)(Mw,{"aria-hidden":`true`,size:14,strokeWidth:2.25})}),(0,V.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-fg`,children:e?`Update failed`:`Restart failed`}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Dismiss`,onClick:n,className:`-mr-1 ml-auto flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-border-strong`,children:(0,V.jsx)(Pw,{"aria-hidden":`true`,size:14,strokeWidth:2.25})})]}),(0,V.jsx)(`p`,{className:`relative mt-2.5 text-[12px] leading-relaxed text-muted`,children:LK}),(0,V.jsx)(`pre`,{className:`relative mt-2.5 max-h-64 overflow-y-auto whitespace-pre-wrap break-words rounded-md border border-border bg-panel px-2.5 py-2 font-mono text-[11px] leading-relaxed text-fg/70`,children:t})]})}function zK({update:e,busy:t,updateVersion:n,onFocus:r,onBlur:i,onClick:a}){return(0,V.jsxs)(`button`,{type:`button`,"aria-describedby":`update-restart-popover`,"aria-label":e?`Update Frizz`:`Restart Frizz`,disabled:t,"aria-busy":t||void 0,className:`relative ${dW}`,onFocus:r,onBlur:i,onClick:a,children:[(0,V.jsx)(bw,{size:14,"aria-hidden":`true`,className:t?`animate-spin`:void 0}),e&&!t&&n&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-[2px] top-[2px] h-[4px] w-[4px] rounded-full bg-accent`})]})}function BK(){let e=Hf(Z),[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(),[s,c]=(0,B.useState)(),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)({}),h=(0,B.useRef)(!1),g=(0,B.useRef)(null);if((0,B.useEffect)(()=>{let e=!0;return TK().then(t=>{e&&(u(SK(t)),f(CK(t)),m({version:t?.version,updateVersion:t?.updateVersion}))}),()=>{e=!1}},[]),l!==!0)return null;let _=h.current&&e.controlPlaneState===`failed`?e.controlPlaneMessage??`Frizz did not become ready`:void 0,v=a??_,y=v&&v!==s?v:void 0,b=async()=>{if(r)return;h.current=!0,n(!1),i(!0),o(void 0),c(void 0);let e=`${window.location.pathname}${window.location.search}${window.location.hash}`;d&&(Z.controlPlaneState=`restarting`,Z.controlPlaneMessage=null,Z.controlPlaneRestartPending=!0);try{d?await OK():await DK(),d?(sessionStorage.setItem(`frizz:reload-after-update-restart`,e),window.dispatchEvent(new Event(xK)),i(!1)):window.location.replace(e)}catch(e){d&&(Z.controlPlaneRestartPending=!1,Z.controlPlaneState=`ready`,Z.controlPlaneMessage=null);let t=e.message.slice(0,140);i(!1),o(t),Q(`${d?`Update & Restart`:`Restart Frizz`} failed`)}};return(0,V.jsxs)(`div`,{ref:g,className:`relative`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[(0,V.jsx)(zK,{update:d,busy:r,updateVersion:p.updateVersion,onFocus:()=>n(!0),onBlur:()=>n(!1),onClick:()=>void b()}),y&&(0,V.jsx)(RK,{update:d,message:y,onDismiss:()=>c(y)}),(0,V.jsx)(IK,{open:t&&!y,update:d,version:p.version,updateVersion:p.updateVersion})]})}function VK(){return(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`})}function HK({state:e,fallback:t}){let n={open:{cls:`bg-live`,word:`connected`},connecting:{cls:`bg-accent`,word:`connecting…`},closed:{cls:`bg-red-500`,word:`disconnected`}}[e],r=t?`connected · SSE fallback`:n.word;return(0,V.jsx)(`span`,{role:`img`,"aria-label":r,title:r,"data-board-sync-fallback":t||void 0,className:`h-1.5 w-1.5 shrink-0 rounded-full ${t?`bg-accent`:n.cls}`})}function UK(){let e=Hf(Z),t=rY(ej()),n=dK(),r=e.connection===`open`&&!!e.socketBoardFallback,i=t.state===`verified`?t.repo:t.state===`local`?t.name:null,a=t.state===`verified`?t.label:i??void 0,o=t.state===`verified`?`Project: ${t.label}`:t.state===`local`?`Project: ${t.name}; local repository with no git remote`:t.state===`loading`?`Project identity loading`:`Project identity unavailable`;return(0,V.jsxs)(`div`,{"data-status-row":!0,className:`mb-2.5 flex min-w-0 items-center gap-3 text-[12px]`,children:[(0,V.jsx)(`a`,{href:`/`,title:`All projects`,"aria-label":`All projects`,className:`${dW} -ml-px`,children:(0,V.jsx)(aw,{size:14,"aria-hidden":`true`})}),(0,V.jsx)(VK,{}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Settings`,title:`Settings`,className:dW,onClick:()=>Z.showSettings=!0,children:(0,V.jsx)(Cw,{size:14,"aria-hidden":`true`})}),(0,V.jsx)(BK,{}),n&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(VK,{}),(0,V.jsx)(pK,{})]}),(0,V.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-center gap-1.5`,"data-project-identity-state":t.state,"aria-label":o,"aria-busy":t.state===`loading`||void 0,children:[(0,V.jsx)(HK,{state:e.connection,fallback:r}),i?(0,V.jsx)(`span`,{className:`block min-w-0 truncate font-semibold text-fg/90`,title:a,children:i}):(0,V.jsx)(`span`,{className:`identity-placeholder w-24`,"aria-hidden":`true`})]})]})}var WK=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),GK=`VisuallyHidden`,KK=B.forwardRef((e,t)=>(0,V.jsx)(eP.span,{...e,ref:t,style:{...WK,...e.style}}));KK.displayName=GK;var qK=KK,[JK,hte]=jN(`Tooltip`,[oL]),YK=oL(),XK=`TooltipProvider`,ZK=700,QK=`tooltip.open`,[$K,eq]=JK(XK),tq=e=>{let{__scopeTooltip:t,delayDuration:n=ZK,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=B.useRef(!0),s=B.useRef(!1),c=B.useRef(0);return B.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,V.jsx)($K,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:B.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:B.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:B.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};tq.displayName=XK;var nq=`Tooltip`,[rq,iq]=JK(nq),aq=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=eq(nq,e.__scopeTooltip),l=YK(t),[u,d]=B.useState(null),f=HP(),p=B.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=B.useRef(!1),[_,v]=RN({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(QK))):c.onClose(),a?.(e)},caller:nq}),y=B.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=B.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=B.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=B.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return B.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,V.jsx)(SL,{...l,children:(0,V.jsx)(rq,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:B.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:B.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};aq.displayName=nq;var oq=`TooltipTrigger`,sq=B.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=iq(oq,n),a=eq(oq,n),o=YK(n),s=AN(t,B.useRef(null),i.onTriggerChange),c=B.useRef(!1),l=B.useRef(!1),u=B.useCallback(()=>c.current=!1,[]);return B.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,V.jsx)(CL,{asChild:!0,...o,children:(0,V.jsx)(eP.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:DN(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:DN(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:DN(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:DN(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:DN(e.onBlur,i.onClose),onClick:DN(e.onClick,i.onClose)})})});sq.displayName=oq;var cq=`TooltipPortal`,[lq,uq]=JK(cq,{forceMount:void 0}),dq=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=iq(cq,t);return(0,V.jsx)(lq,{scope:t,forceMount:n,children:(0,V.jsx)(kL,{present:n||a.open,children:(0,V.jsx)(DL,{asChild:!0,container:i,children:r})})})};dq.displayName=cq;var fq=`TooltipContent`,pq=B.forwardRef((e,t)=>{let n=uq(fq,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=iq(fq,e.__scopeTooltip);return(0,V.jsx)(kL,{present:r||o.open,children:o.disableHoverableContent?(0,V.jsx)(vq,{side:i,...a,ref:t}):(0,V.jsx)(mq,{side:i,...a,ref:t})})}),mq=B.forwardRef((e,t)=>{let n=iq(fq,e.__scopeTooltip),r=eq(fq,e.__scopeTooltip),i=B.useRef(null),a=AN(t,i),[o,s]=B.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=B.useCallback(()=>{s(null),d(!1)},[d]),p=B.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Sq(r,xq(r,n.getBoundingClientRect())),a=Cq(t.getBoundingClientRect()),o=Tq([...i,...a]);s(o),d(!0)},[d]);return B.useEffect(()=>()=>f(),[f]),B.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),B.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!wq(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,V.jsx)(vq,{...e,ref:a})}),[hq,gq]=JK(nq,{isInside:!1}),_q=UN(`TooltipContent`),vq=B.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=iq(fq,n),l=YK(n),{onClose:u}=c;return B.useEffect(()=>(document.addEventListener(QK,u),()=>document.removeEventListener(QK,u)),[u]),B.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,V.jsx)(fP,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,V.jsxs)(wL,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,V.jsx)(_q,{children:r}),(0,V.jsx)(hq,{scope:n,isInside:!0,children:(0,V.jsx)(qK,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});pq.displayName=fq;var yq=`TooltipArrow`,bq=B.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=YK(n);return gq(yq,n).isInside?null:(0,V.jsx)(TL,{...i,...r,ref:t})});bq.displayName=yq;function xq(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Sq(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Cq(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function wq(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Tq(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Eq(t)}function Eq(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Dq=tq,Oq=aq,kq=sq,Aq=dq,jq=pq,Mq=bq;function Nq({children:e}){return(0,V.jsx)(Dq,{delayDuration:0,skipDelayDuration:0,disableHoverableContent:!0,children:e})}function Pq({label:e,children:t,side:n=`top`,clickable:r=!1,multiline:i=!1,disabled:a=!1}){let o=i?`whitespace-pre-line`:`whitespace-normal`,[s,c]=(0,B.useState)(!1),l=(0,B.useId)(),u=r&&(0,B.isValidElement)(t)?t:null,d=u?(0,B.cloneElement)(u,{"aria-describedby":l}):t,f=(0,B.useRef)(null);if(u){let t=f.current?.getBoundingClientRect(),n=t?Math.min(Math.max(12,t.right+8),window.innerWidth-364):12,r=t?Math.min(Math.max(12,t.top-6),window.innerHeight-96):12;return(0,V.jsxs)(`span`,{ref:f,className:`inline-flex`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onFocus:()=>c(!0),onBlur:()=>c(!1),onClick:()=>c(e=>!e),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),c(!1))},children:[d,s&&(0,Xd.createPortal)((0,V.jsx)(`span`,{id:l,role:`tooltip`,className:`z-[250] max-w-[min(22rem,calc(100vw-1.5rem))] rounded-md border border-border bg-elevated px-3 py-2 text-[11px] leading-relaxed text-fg shadow-md shadow-black/40 break-words ${o}`,style:{position:`fixed`,left:n,top:r},children:e}),document.body)]})}return(0,V.jsxs)(Oq,{open:s&&!a,onOpenChange:c,children:[(0,V.jsx)(kq,{asChild:!0,children:d}),(0,V.jsx)(Aq,{children:(0,V.jsxs)(jq,{id:l,side:n,sideOffset:5,collisionPadding:12,className:`${wV} max-w-[min(22rem,calc(100vw-1.5rem))] select-none rounded-md border border-border bg-elevated px-3 py-2 text-[11px] leading-relaxed text-fg shadow-md shadow-black/40 break-words ${o}`,children:[e,(0,V.jsx)(Mq,{className:`fill-elevated`})]})})]})}var Fq=Rf({at:{}}),Iq=12e3,Lq=new Map;function Rq(e,t=Date.now()){Fq.at[e]=t;let n=Lq.get(e);n!==void 0&&clearTimeout(n),Lq.set(e,setTimeout(()=>{Lq.delete(e),delete Fq.at[e]},Iq))}function zq(e){let t=Lq.get(e);t!==void 0&&(clearTimeout(t),Lq.delete(e)),delete Fq.at[e]}function Bq(e,t,n=Date.now()){if(t===void 0||n-t>12e3)return!1;let r=e.lastActivityAt?Date.parse(e.lastActivityAt):NaN;return!(Number.isFinite(r)&&r>t)}function Vq(){return Hf(Fq).at}function Hq(e,t,n=Date.now()){return t===void 0||!Bq(e,t,n)?e:{...e,runtime:`running`,needsYou:!1,pendingAsk:void 0,pendingQuestion:!1,actionableInteraction:!1,lastUserAt:new Date(t).toISOString()}}function Uq(e){let t=Vq();return(0,B.useMemo)(()=>e.map(e=>Hq(e,t[e.id])),[e,t])}var Wq=0;function Gq(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():(Wq+=1,`browser-${Date.now()}-${Wq}`)}function Kq({optimistic:e,request:t,success:n,failure:r}){e(),t().then(()=>n?.(),e=>r(e instanceof Error?e:Error(String(e))))}var qq=new Map;function Jq(e,t){let n=(qq.get(e)??Promise.resolve()).then(t,t);return qq.set(e,n.then(()=>{},()=>{})),n}var Yq=[300,800,1800,3500],Xq=e=>new Promise(t=>{setTimeout(t,e)});async function Zq(e,t,n=Xq){for(let r=0;;r++){try{await e()}catch(e){if(r>=Yq.length||!sS(e))throw e;t(),await n(Yq[r]);continue}t();return}}function Qq(e,t,n,r,i){return Zq(()=>X.followUp({slug:e,sessionId:sC(Z.board,e)?.sessionId??``,message:t,deliveryId:n,freshProcess:r,interrupt:i}),()=>Rq(e))}function $q(e,t,n,r={}){let i=n.trim();if(!i)return!1;let a=Gq();return Kq({optimistic:()=>{r.onOptimistic?.(),mj(e,t,i,{scrollToBottom:r.scrollToBottom,deliveryId:a}),Rq(t),X.markRead({slug:t}).catch(()=>{})},request:()=>Jq(t,()=>Qq(t,i,a,r.freshProcess,r.interrupt)),success:()=>r.onSuccess?.(),failure:n=>{hj(e,t,i,a),zq(t),r.onRollback?.(),Q(r.failureToast?.(n.message)??`Steer failed — ${n.message.slice(0,90)}`)}}),!0}function eJ(e){let t=Md(),[n,r]=(0,B.useState)(0);return{submit:(0,B.useCallback)((n,i={})=>$q(t,e,n,{...i,onOptimistic:()=>{r(e=>e+1),i.onOptimistic?.()},onSuccess:()=>{r(e=>Math.max(0,e-1)),i.onSuccess?.()},onRollback:()=>{r(e=>Math.max(0,e-1)),i.onRollback?.()}}),[t,e]),pending:n>0}}function tJ(e,t){return new Promise(n=>{$q(e,t,`Continue exactly where you left off.`,{onSuccess:()=>{Q(`Retrying…`),n()},onRollback:()=>n(),failureToast:e=>`Retry failed: ${e.slice(0,80)}`})||n()})}function nJ(e){let t=/^([A-Za-z0-9][\w.-]*)\/([A-Za-z0-9][\w.-]*)#(\d+)$/.exec(e.trim());return t?`https://github.com/${t[1]}/${t[2]}/pull/${t[3]}`:null}var rJ=`Snooze`;function iJ(e,t=Date.now()){return null}function aJ(e){let t=new Set;return e.flatMap(e=>{if(e.kind!==`pr`)return[];let n=e.value.trim();return!n||t.has(n)?[]:(t.add(n),[{ref:n,url:nJ(n)}])})}function oJ(e){let t=(e.body??``).split(/\n\s*\n/).map(e=>e.trim()).find(Boolean);return t?lJ(sJ(t.replace(/\s*\n\s*/g,` `))):null}function sJ(e){if(e.length<=cJ)return e;let t=e.slice(0,cJ),n=t.lastIndexOf(` `);return`${(n>cJ/2?t.slice(0,n):t).replace(/[.,;:]$/,``)}…`}var cJ=240;function lJ(e){let t=(e.split(/\s/,1)[0]??``).replace(/[.,:;]+$/,``);return/[^a-zA-Z]/.test(t)||/[A-Z]/.test(t.slice(1))||uJ.has(t)?e:e.charAt(0).toUpperCase()+e.slice(1)}var uJ=new Set([`npm`,`npx`,`pnpm`,`nub`,`nubx`,`gh`,`git`,`node`,`bun`,`tsc`,`vite`,`curl`,`ssh`]);function dJ(e){return mJ(e)||`Waiting for an external update.`}function fJ(e){return e&&mJ(e)||null}var pJ=new Set([...Py,`shells`,`agents`,`timers`,`prs`,`for`]);function mJ(e){return e.split(`
369
+ `+e.slice(r)),requestAnimationFrame(()=>t.setSelectionRange(n+1,n+1)))})}e.key===`Escape`&&!e.nativeEvent.isComposing&&(e.preventDefault(),e.stopPropagation(),t.blur())}return(0,V.jsxs)(`div`,{className:`group relative rounded-xl border bg-bg transition-colors focus-within:border-accent ${g?`border-dashed border-accent`:`border-border`}`,onDragOver:e=>{[...e.dataTransfer.items].some(e=>e.kind===`file`)&&(e.preventDefault(),_(!0))},onDragLeave:()=>_(!1),onDrop:e=>{e.preventDefault(),_(!1),E(e.dataTransfer.files)},children:[g&&(0,V.jsx)(`div`,{className:`pointer-events-none absolute inset-0 z-10 flex items-center justify-center rounded-xl bg-bg/80 text-[12px] text-muted`,children:`Drop file to attach`}),F&&(0,V.jsx)(`div`,{ref:te,"data-slash-menu":!0,className:`absolute bottom-full left-0 right-0 z-20 mb-1.5 max-h-56 overflow-y-auto rounded-lg border border-border bg-bg py-1 shadow-lg`,children:ee.map((e,t)=>(0,V.jsxs)(`button`,{type:`button`,"data-suggest-index":t,onMouseDown:e=>e.preventDefault(),onClick:()=>ne(e),onMouseEnter:()=>j(t),className:`flex w-full items-baseline gap-2 px-3.5 py-1.5 text-left ${t===A?`bg-panel-2`:``}`,children:[(0,V.jsxs)(`span`,{className:`shrink-0 text-[12px] font-medium text-fg`,children:[`/`,e.name]}),e.description&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11px] text-muted`,children:e.description})]},e.name))}),(0,V.jsx)(`textarea`,{id:a,ref:m,"data-surface":r,value:b,autoFocus:c,disabled:l,onChange:e=>w(e.target.value),onKeyDown:ae,onPaste:e=>{let t=[...e.clipboardData.items].filter(e=>e.kind===`file`).map(e=>e.getAsFile()).filter(Boolean);t.length&&(e.preventDefault(),E(t))},placeholder:i,rows:1,spellCheck:!1,style:{minHeight:o,maxHeight:s},className:`block w-full resize-none bg-transparent px-3.5 ${u?`py-2.5 pb-3`:`py-2.5 ${ie?jH:MH}`} text-[13px] leading-relaxed text-fg outline-none placeholder:text-muted scrollbar-none disabled:opacity-60`}),x.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5 px-3 pb-2 ${ie?`pr-[6.6875rem]`:`pr-20`}`,children:x.map((e,t)=>(0,V.jsx)(qH,{attachment:e,disabled:l,onRemove:()=>T(S.filter((e,n)=>n!==t))},`${e.path}-${t}`))}),u&&(0,V.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-1 pl-1.5 pb-1.5 ${ie?`pr-[6.6875rem]`:`pr-20`}`,children:u}),ie&&(0,V.jsx)(`div`,{className:`absolute bottom-2 right-[43px] flex items-center`,children:ie}),(0,V.jsx)(`input`,{ref:h,type:`file`,multiple:!0,accept:by,className:`hidden`,onChange:e=>{E(e.target.files),e.target.value=``}}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>h.current?.click(),disabled:l||v,title:`Attach files`,"aria-label":`Attach files`,className:`absolute bottom-2 ${ie?kH:AH} flex h-7 w-7 items-center justify-center rounded-lg text-muted transition-[color,background-color] enabled:hover:bg-panel-2/70 enabled:hover:text-fg disabled:opacity-50`,children:v?(0,V.jsx)(dw,{size:15,strokeWidth:2,className:`animate-spin`}):(0,V.jsx)(gw,{size:15,strokeWidth:2})}),(0,V.jsx)(`button`,{type:`button`,onMouseDown:e=>e.preventDefault(),onClick:n,disabled:!re||l||v,title:`Send (Enter)`,"aria-label":`Send`,className:`absolute bottom-2 ${OH} flex h-7 w-7 items-center justify-center rounded-lg transition-all ${re&&!l&&!v?`bg-fg text-bg hover:opacity-90 active:scale-95`:`bg-panel-2 text-muted`}`,children:l?(0,V.jsx)(dw,{size:14,strokeWidth:2.5,className:`animate-spin`}):(0,V.jsx)(AC,{size:14,strokeWidth:2.5})})]})}function qH({attachment:e,disabled:t,onRemove:n}){let[r,i]=(0,B.useState)(!1),a=e.path.split(`/`).filter(Boolean).pop()||e.path,o=(a.includes(`.`)?a.split(`.`).pop():``).toUpperCase();return(0,V.jsxs)(`div`,{className:`group/att relative h-11 w-11`,title:a,children:[e.kind===`image`&&!r?(0,V.jsx)(`img`,{src:RH(e.path),alt:a,onError:()=>i(!0),className:`h-11 w-11 rounded-md border border-border object-cover`}):(0,V.jsxs)(`div`,{className:`flex h-11 w-11 flex-col items-center justify-center gap-0.5 rounded-md border border-border bg-panel-2 px-1`,children:[(0,V.jsx)(XC,{size:15,strokeWidth:2,className:`shrink-0 text-muted`}),o&&(0,V.jsx)(`span`,{className:`max-w-full truncate text-[8px] font-medium leading-none text-muted/80`,children:o})]}),(0,V.jsx)(`button`,{type:`button`,onClick:n,disabled:t,title:`Remove ${a}`,"aria-label":`Remove ${a}`,className:`absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full border border-border bg-bg text-muted opacity-0 transition-opacity hover:text-fg focus-visible:opacity-100 group-hover/att:opacity-100 disabled:hidden`,children:(0,V.jsx)(Pw,{size:10,strokeWidth:2.5})})]})}function JH(){return qd({queryKey:[`githubStatus`],queryFn:()=>X.githubStatus(),staleTime:3e4,refetchOnWindowFocus:!0,refetchInterval:e=>{let t=e.state.data;return t?.inRepo&&t.authed?!1:6e4}})}function YH(){let e=JH();return!!(e.data?.inRepo&&e.data.authed)}function XH({className:e=``}){return YH()?(0,V.jsx)(`button`,{type:`button`,onClick:FS,onMouseDown:e=>e.preventDefault(),title:`Investigate this issue and make recommendations`,"aria-label":`Investigate this issue and make recommendations`,className:`flex h-7 w-7 items-center justify-center rounded-lg text-muted outline-none transition-[color,background-color,box-shadow] enabled:hover:bg-panel-2/70 enabled:hover:text-fg enabled:focus-visible:bg-panel-2/70 enabled:focus-visible:text-muted enabled:focus-visible:ring-1 enabled:focus-visible:ring-muted/80 enabled:focus-visible:ring-offset-1 enabled:focus-visible:ring-offset-bg enabled:active:bg-elevated enabled:active:text-muted disabled:bg-transparent disabled:text-muted/35 ${e}`,children:(0,V.jsx)(rw,{size:15,strokeWidth:2})}):null}var ZH=`prompt-control-type petite-caps`,QH=ZH,$H=ZH,eU=`profile-grid-cell relative flex h-6 cursor-pointer select-none items-center justify-start rounded border border-transparent px-1 text-left text-muted outline-none transition-colors ${QH} data-[highlighted]:border-border data-[highlighted]:bg-panel-2 data-[highlighted]:text-fg data-[highlighted]:outline data-[highlighted]:outline-1 data-[highlighted]:outline-offset-1 data-[highlighted]:outline-fg/55 data-[state=checked]:border-accent/70 data-[state=checked]:bg-accent/10 data-[state=checked]:font-medium data-[state=checked]:text-fg data-[state=checked]:ring-1 data-[state=checked]:ring-inset data-[state=checked]:ring-accent/90`;function tU(e){return`minmax(6rem, 7rem) repeat(${Math.max(0,e)}, auto)`}var nU=[`ultra`,`ultracode`],rU=[`low`,`medium`,`high`,`xhigh`,`max`,...nU];function iU(e){return[...new Set(e.flatMap(e=>e.options.flatMap(e=>e.efforts)))].sort((e,t)=>{let n=rU.indexOf(e),r=rU.indexOf(t);return n===-1&&r===-1?e.localeCompare(t):n===-1?1:r===-1?-1:n-r})}function aU(e){let t=[];for(let n of iU(e)){let e=nU.includes(n)?t.find(e=>nU.includes(e[0])):void 0;e?e.push(n):t.push([n])}return t}function oU(e){return e.flatMap(e=>e.options.flatMap(t=>t.efforts.map(n=>({provider:e.id,model:t.model,effort:n}))))}function sU(e){return JSON.stringify([e.provider,e.model,e.effort])}function cU(e,t){return oU(e).find(e=>sU(e)===t)}function lU(e,t){return!t?.model||!t.effort?!1:e.some(e=>(!t.provider||e.id===t.provider)&&e.options.some(e=>e.model===t.model&&e.efforts.includes(t.effort)))}function uU(e,t,n=`Profile unknown`){if(!t?.model&&!t?.effort)return n;let r=e.flatMap(e=>e.options).find(e=>e.model===t.model)?.label??t.model??`Model unknown`;return t.effort?`${r} › ${t.effort}`:r}function dU(e,t,n){let r=aU(e),i=e=>r.findIndex(t=>t.includes(e)),a=e.flatMap(e=>e.options.map(t=>({provider:e.id,option:t}))),o=a.findIndex(e=>e.provider===t.provider&&e.option.model===t.model);if(o===-1)return null;let s=a[o],c=s.option.efforts.indexOf(t.effort);if(c===-1)return null;if(n===`Home`||n===`End`||n===`ArrowLeft`||n===`ArrowRight`){let e=n===`Home`?0:n===`End`?s.option.efforts.length-1:c+(n===`ArrowLeft`?-1:1),t=s.option.efforts[e];return t?{provider:s.provider,model:s.option.model,effort:t}:null}let l=a[o+(n===`ArrowUp`?-1:1)];if(!l)return null;let u=i(t.effort),d=l.option.efforts.reduce((e,t)=>e?Math.abs(i(t)-u)<Math.abs(i(e)-u)?t:e:t,void 0);return d?{provider:l.provider,model:l.option.model,effort:d}:null}var fU,pU=!1;function mU(){pU||typeof window>`u`||(pU=!0,window.addEventListener(`keydown`,e=>{e.key!==`Escape`||!fU||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),gU())},{capture:!0}))}function hU(e){mU();let t={dismiss:e};return fU=t,()=>{fU===t&&(fU=void 0)}}function gU(){let e=fU;return e?(fU=void 0,e.dismiss(),!0):!1}function _U(e){gU()&&e.preventDefault(),e.stopPropagation()}function vU(e){return e===`xhigh`?`X-high`:e.charAt(0).toUpperCase()+e.slice(1)}function yU({groups:e,value:t,pending:n,onValueChange:r,placeholder:i,ariaLabel:a,menuAriaLabel:o=`Choose model and effort`,title:s,disabled:c=!1,compact:l=!1,side:u=`bottom`,menuZClass:d=xV,className:f=``}){let[p,m]=(0,B.useState)(!1),h=(0,B.useRef)(p),g=(0,B.useRef)(c),_=(0,B.useRef)(void 0),v=(0,B.useRef)(new Map),y=(0,B.useRef)(void 0),b=(0,B.useMemo)(()=>aU(e),[e]),x=(0,B.useMemo)(()=>e.flatMap(e=>e.options.flatMap(t=>t.efforts.map(n=>({provider:e.id,model:t.model,effort:n})))),[e]),S=l?$H:QH,C=c?`cursor-not-allowed opacity-45`:`cursor-pointer transition-colors hover:border-border hover:bg-panel-2 hover:text-fg`,w=lU(e,t),T=w&&t?.provider&&t.model&&t.effort?sU(t):void 0,E=n?.model||n?.effort?uU(e,n,`Pending profile`):void 0;h.current=p,g.current=c;function D(){h.current=!1,_.current=void 0,m(!1)}(0,B.useLayoutEffect)(()=>{let e=e=>{e.key!==`Escape`||!h.current||g.current||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_.current?.(),D())};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]),(0,B.useLayoutEffect)(()=>{!c||!p||(_.current?.(),D())},[c,p]),(0,B.useLayoutEffect)(()=>()=>_.current?.(),[]),(0,B.useLayoutEffect)(()=>{T===y.current&&(y.current=void 0)},[T]);function O(e){let t=sU(e);y.current!==t&&(y.current=t,r(e))}function k(t,n){if(![`ArrowLeft`,`ArrowRight`,`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(t.key))return;let r=dU(e,n,t.key);r&&(t.preventDefault(),t.stopPropagation(),v.current.get(sU(r))?.focus())}return(0,V.jsxs)(lV,{modal:!1,open:p,onOpenChange:e=>{_.current?.(),_.current=void 0,h.current=e,m(e),e&&(_.current=hU(D))},children:[(0,V.jsx)(uV,{asChild:!0,disabled:c,children:(0,V.jsxs)(`button`,{type:`button`,"aria-label":a,"aria-invalid":!w&&(t?.model||t?.effort)?!0:void 0,"aria-description":E?`Pending ${E}`:void 0,title:s,"data-profile-known":w?`true`:`false`,"data-profile-pending":E?`true`:void 0,className:`profile-grid-trigger group inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border border-border/50 bg-transparent px-2 py-1 text-left text-muted outline-none data-[state=open]:border-border data-[state=open]:bg-panel-2 ${C} ${f} ${S}`,children:[(0,V.jsx)(`span`,{className:`profile-grid-value relative -top-px min-w-0 flex-1 truncate text-left ${S}`,children:uU(e,t,i)}),E&&(0,V.jsx)(dw,{"aria-hidden":`true`,size:l?10:11,className:`shrink-0 animate-spin text-muted/65`}),(0,V.jsx)(FC,{"aria-hidden":`true`,size:l?11:13,className:`shrink-0 text-fg/65 transition-transform group-data-[state=open]:rotate-180`})]})}),(0,V.jsx)(dV,{children:(0,V.jsxs)(fV,{"aria-label":o,align:`start`,side:u,sideOffset:5,collisionPadding:8,onEscapeKeyDown:e=>e.stopPropagation(),className:`profile-grid-menu ${d} ${bV} max-h-[min(360px,var(--radix-dropdown-menu-content-available-height))] max-w-[calc(100vw-1rem)] overflow-auto rounded-lg p-1.5 ${S}`,children:[e.map(t=>(0,V.jsxs)(pV,{children:[t.label&&(0,V.jsx)(mV,{className:`px-1.5 pb-1 pt-1 text-left font-medium tracking-[0.07em] text-muted/55 first:pt-0.5`,children:t.label}),(0,V.jsx)(gV,{value:T,onValueChange:t=>{let n=cU(e,t);n&&O(n)},children:t.options.map(e=>(0,V.jsxs)(`div`,{"data-profile-grid-row":e.model,className:`grid w-max items-center gap-1 py-0.5`,style:{gridTemplateColumns:tU(b.length)},children:[(0,V.jsx)(`span`,{className:`profile-grid-model-label min-w-0 max-w-[9.5rem] truncate px-1.5 text-left text-muted ${S}`,title:e.label,children:e.label}),b.map(n=>{let r=n.find(t=>e.efforts.includes(t)),i=n.reduce((e,t)=>vU(t).length>vU(e).length?t:e);if(!r)return(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`invisible cursor-default border border-transparent px-1 text-left font-medium ${S}`,children:vU(i)},i);let a={provider:t.id,model:e.model,effort:r},o=sU(a);return(0,V.jsx)(_V,{value:o,ref:e=>{e?v.current.set(o,e):v.current.delete(o)},onKeyDown:e=>k(e,a),onSelect:e=>{e.preventDefault(),O(a),_.current?.(),D()},"aria-label":`${e.label}, ${vU(r)} effort`,title:`${e.label} › ${vU(r)}`,className:eU,children:(0,V.jsxs)(`span`,{className:`grid`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`invisible col-start-1 row-start-1 font-medium`,children:vU(r)}),(0,V.jsx)(`span`,{className:`col-start-1 row-start-1`,children:vU(r)})]})},r)})]},e.model))}),t!==e.at(-1)&&(0,V.jsx)(yV,{className:`my-1 h-px bg-border`})]},t.id)),x.length===0&&(0,V.jsx)(`div`,{className:`px-2 py-1.5 text-muted/60`,children:`No profiles available`})]})})]})}async function bU(e){if(navigator.clipboard?.writeText)try{await navigator.clipboard.writeText(e);return}catch{}if(!xU(e))throw Error(`the browser blocked clipboard access`)}function xU(e){let t=document.createElement(`textarea`);t.value=e,t.setAttribute(`readonly`,``),t.style.position=`fixed`,t.style.top=`0`,t.style.left=`0`,t.style.opacity=`0`,document.body.append(t);let n=document.getSelection(),r=n&&n.rangeCount>0?n.getRangeAt(0):null;t.select(),t.setSelectionRange(0,e.length);let i=!1;try{i=document.execCommand(`copy`)}catch{i=!1}return t.remove(),r&&n&&(n.removeAllRanges(),n.addRange(r)),i}var SU={claude:`claude auth login`,codex:`codex login`},CU={claude:`Claude`,codex:`Codex`};function wU(e){let t=e.trim();return t===`/login`?`login`:t===`/logout`?`logout`:null}var TU=(0,B.lazy)(()=>UO(()=>import(`./TerminalPane-Cyao7kTi.js`).then(e=>({default:e.TerminalPane})),__vite__mapDeps([0,1])));function EU({backend:e,onClose:t,onAuthed:n}){let r=Md(),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(null),c=(0,B.useRef)(!1),l=SU[e],u=CU[e],d=Jd({mutationFn:()=>X.accountLoginStart({backend:e}),onSuccess:e=>{c.current=!1,s(e.attemptId)},onError:e=>Q(`Couldn't start the sign-in terminal: ${e.message.slice(0,80)} — use the command below instead`,{duration:7e3})}),f=qd({queryKey:[`accountLoginStatus`,o],queryFn:()=>X.accountLoginStatus({attemptId:o}),enabled:!!o,refetchInterval:2e3});(0,B.useEffect)(()=>{if(!o||c.current)return;let t=f.data;if(!(!t||t.state===`running`||t.state===`unknown`)){if(c.current=!0,t.auth!==`signed-out`){r.setQueryData([`authStatus`],n=>n&&{...n,[e]:t.auth}),Q(`Signed in to ${u}`),n();return}Q(`${u} sign-in didn't complete — try again or use the command below`,{duration:7e3}),s(null)}},[o,f.data,e,u]);function p(){o&&!c.current&&X.accountLoginCancel({attemptId:o}).catch(()=>{})}let m=(0,B.useRef)({attempt:null,settled:!1});m.current={attempt:o,settled:c.current},(0,B.useEffect)(()=>()=>{let{attempt:e,settled:t}=m.current;e&&!t&&X.accountLoginCancel({attemptId:e}).catch(()=>{})},[]);async function h(){try{await bU(l),a(!0),window.setTimeout(()=>a(!1),1500)}catch{Q(`Couldn't copy — select the command and copy it manually`,{duration:6e3})}}let g=Jd({mutationFn:()=>X.authStatus(),onSuccess:t=>{if(r.setQueryData([`authStatus`],t),t[e]===`signed-out`){Q(`Still signed out of ${u} — run the command, then retry`,{duration:6e3});return}n()},onError:()=>n()});return(0,V.jsx)(FV,{open:!0,onOpenChange:e=>{e||(p(),t())},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] ${o?`w-[680px]`:`w-[440px]`} max-w-[92vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,V.jsxs)(QV,{className:`mb-1 text-[14px] font-medium`,children:[`Signed out of `,u]}),o?(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:`mb-3 text-[12.5px] leading-relaxed text-muted`,children:[`This terminal is running `,(0,V.jsx)(`code`,{className:`font-mono-keep text-fg/90`,children:l}),` — follow its prompts (it may open your browser). Frizz detects completion automatically.`]}),(0,V.jsx)(`div`,{className:`mb-4 h-[340px] overflow-hidden rounded-lg border border-border bg-[#0d0e10]`,children:(0,V.jsx)(B.Suspense,{fallback:(0,V.jsx)(`div`,{className:`flex h-full items-center justify-center text-[12px] text-muted`,children:`Opening terminal…`}),children:(0,V.jsx)(TU,{slug:o})})}),(0,V.jsx)(`div`,{className:`flex items-center justify-end gap-2`,children:(0,V.jsx)(`button`,{type:`button`,onClick:()=>{p(),s(null)},className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:`Cancel sign-in`})})]}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`p`,{className:`mb-4 text-[12.5px] leading-relaxed text-muted`,children:[`Frizz can't start a `,u,` thread until you're signed in. Sign in here, or run the command in your own terminal and retry:`]}),(0,V.jsxs)(`div`,{className:`mb-4 flex items-center gap-2 rounded-lg border border-border bg-panel-2 px-3 py-2`,children:[(0,V.jsx)(`code`,{className:`flex-1 select-all font-mono-keep text-[12.5px] text-fg`,children:l}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Copy command`,onClick:h,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel hover:text-fg`,children:i?(0,V.jsx)(PC,{size:14,strokeWidth:2,className:`text-green-400`}):(0,V.jsx)(qC,{size:14,strokeWidth:1.8})})]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>g.mutate(),disabled:g.isPending,className:`flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-[12.5px] text-fg/90 outline-none transition-colors hover:bg-panel-2 disabled:opacity-60`,children:[g.isPending&&(0,V.jsx)(dw,{size:13,className:`animate-spin`}),`Retry`]}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>d.mutate(),disabled:d.isPending,className:`flex items-center gap-1.5 rounded-md bg-accent px-3 py-1.5 text-[12.5px] font-medium text-white outline-none transition-opacity hover:opacity-90 disabled:opacity-60`,children:[d.isPending&&(0,V.jsx)(dw,{size:13,className:`animate-spin`}),`Sign in here`]})]})]})]})]})})}function DU({backend:e,onClose:t}){let n=Md(),r=CU[e],i=Jd({mutationFn:()=>X.accountLogout({backend:e}),onSuccess:i=>{n.setQueryData([`authStatus`],t=>t&&{...t,[e]:i.auth}),i.status===`done`?Q(`Signed out of ${r}`):i.status===`blocked`?Q(`Not signed out — ${i.activeThreads} active ${r} thread${i.activeThreads===1?``:`s`}. Let them finish (or complete them) first.`,{duration:7e3}):Q(`${r} sign-out failed: ${i.detail??`unknown error`}`,{duration:7e3}),t()},onError:e=>{Q(`${r} sign-out failed: ${e.message.slice(0,80)}`,{duration:7e3}),t()}});return(0,V.jsx)(FV,{open:!0,onOpenChange:e=>{!e&&!i.isPending&&t()},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-[210] bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{"aria-modal":`true`,"aria-describedby":void 0,className:`fixed left-1/2 top-1/2 z-[210] w-[420px] max-w-[86vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none`,children:[(0,V.jsxs)(QV,{className:`mb-1 text-[14px] font-medium`,children:[`Sign out of `,r,`?`]}),(0,V.jsxs)(`p`,{className:`mb-4 text-[12.5px] leading-relaxed text-muted`,children:[`New `,r,` threads will be blocked until you sign in again. Running `,r,` threads are left untouched — sign-out is refused while any are active.`]}),(0,V.jsxs)(`div`,{className:`flex items-center justify-end gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:t,disabled:i.isPending,className:`rounded-md px-3 py-1.5 text-[12.5px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-60`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`button`,onClick:()=>i.mutate(),disabled:i.isPending,className:`flex items-center gap-1.5 rounded-md bg-red-500/90 px-3 py-1.5 text-[12.5px] font-medium text-white outline-none transition-opacity hover:opacity-90 disabled:opacity-60`,children:[i.isPending&&(0,V.jsx)(dw,{size:13,className:`animate-spin`}),`Sign out`]})]})]})]})})}var OU=Db.options,kU={auto:`Auto`,default:`Default`,acceptEdits:`Accept edits`,plan:`Plan`,bypassPermissions:`Bypass`},AU={auto:`auto — safe actions auto-approved, risky ones prompt`,default:`default — prompt for every permission`,acceptEdits:`accept edits — file edits auto-approved`,plan:`plan — read-only planning, approval before changes`,bypassPermissions:`bypass — never prompt (dangerous)`};OU.filter(e=>e!==`plan`).map(e=>({value:e,label:kU[e],title:AU[e]}));var jU=[`auto`,`bypassPermissions`].map(e=>({value:e,label:kU[e],title:AU[e]})),MU=[{value:`fable`,label:`Fable`},{value:`opus`,label:`Opus`},{value:`sonnet`,label:`Sonnet`},{value:`haiku`,label:`Haiku`}];new Set([{slug:`gpt-5.6-sol`,displayName:`GPT-5.6 Sol`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-terra`,displayName:`GPT-5.6 Terra`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`,`ultra`]},{slug:`gpt-5.6-luna`,displayName:`GPT-5.6 Luna`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`,`max`]},{slug:`gpt-5.5`,displayName:`GPT-5.5`,defaultEffort:`medium`,efforts:[`low`,`medium`,`high`,`xhigh`]}].map(e=>e.slug));function NU(e){return e===`plan`?`auto`:e}var PU=[`low`,`medium`,`high`,`xhigh`,`max`],FU=`ultracode`,IU=new Set([`fable`,`opus`,`sonnet`]);function LU(e){return e&&IU.has(e)?[...PU,FU]:[...PU]}var RU={low:`Low`,medium:`Medium`,high:`High`,xhigh:`X-high`,max:`Max`,ultra:`Ultra`,ultracode:`Ultracode`};function zU(e){return RU[e]??e.charAt(0).toUpperCase()+e.slice(1)}function BU(e,t){let n=LU(e).map(e=>({value:e,label:zU(e)}));return t.withDefault?[{value:``,label:`Default`},...n]:n}function VU(e,t){let n=(e?.efforts??[]).map(e=>({value:e,label:zU(e)}));return t.withDefault?[{value:``,label:`Default`},...n]:n}function HU(e,t){return t.field===`backend`?{...e,backend:t.value}:t.field===`profile`?{...e,backend:t.backend,[t.backend]:{...e[t.backend],model:t.model,effort:t.effort}}:{...e,...t.field===`model`?{backend:t.backend}:{},[t.backend]:{...e[t.backend],[t.field]:t.value}}}function UU(e){return[{id:`claude`,label:`Claude Code`,options:MU.map(e=>({model:e.value,label:e.label,defaultEffort:`high`,efforts:LU(e.value)}))},{id:`codex`,label:`Codex`,options:e.map(e=>({model:e.slug,label:e.displayName,defaultEffort:e.defaultEffort,efforts:e.efforts}))}]}function WU(e,t){let n=e.backend,r=e[n],i=r.model??(n===`claude`?`opus`:t[0]?.slug??``),a=n===`codex`?t.find(e=>e.slug===i):void 0,o=n===`claude`?MU.some(e=>e.value===i):t.some(e=>e.slug===i),s=n===`claude`?`high`:a?.defaultEffort??``,c=r.effort??s,l=n===`claude`?BU(i,{withDefault:!1}):VU(a,{withDefault:!1}),u=l.some(e=>e.value===c);return{backend:n,model:i,effort:c,codexModel:a,modelAvailable:o,effortAvailable:u,effortOptions:c&&!u?[{value:c,label:`${c} (unavailable)`,title:`Saved reasoning level is not available for this model`},...l]:l}}function GU(){let e=Md(),t=qd({queryKey:[`dispatchPreferencesGet`],queryFn:()=>X.dispatchPreferencesGet()}),n=qd({queryKey:[`codexModels`],queryFn:()=>X.codexModels()}),r=n.data??[],i=Jd({mutationFn:e=>X.dispatchPreferenceSet(e),scope:{id:`dispatch-preferences`},onMutate:t=>{let n=e.getQueryData([`dispatchPreferencesGet`]);n&&e.setQueryData([`dispatchPreferencesGet`],HU(n,t))},onError:t=>{e.invalidateQueries({queryKey:[`dispatchPreferencesGet`]}),Q(`Could not save new-thread preference: ${t.message.slice(0,80)}`)}}),a=!!t.data&&!!n.data;return{resolved:(0,B.useMemo)(()=>a?WU(t.data,r):void 0,[a,t.data,r]),codexList:r,loadError:t.isError||n.isError,saveProfile:i.mutate}}var KU=`frizz-drafts:v1`,qU=80,JU=512*1024,YU=2*1024*1024,XU=new TextEncoder;function ZU(e){return XU.encode(e).byteLength}function QU(){return{version:1,entries:{}}}function $U(e){if(!e)return QU();try{let t=JSON.parse(e);if(!t||typeof t!=`object`||t.version!==1)return QU();let n=t.entries;if(!n||typeof n!=`object`||Array.isArray(n))return QU();let r={};for(let[e,t]of Object.entries(n))typeof t?.value!=`string`||typeof t?.touchedAt!=`number`||!Number.isFinite(t.touchedAt)||e.length>512||ZU(t.value)>JU||(r[e]={value:t.value,touchedAt:t.touchedAt});return{version:1,entries:r}}catch{return QU()}}function eW(e){let t=Object.entries(e.entries).filter(([,e])=>e.value&&ZU(e.value)<=JU).sort((e,t)=>t[1].touchedAt-e[1].touchedAt),n={};for(let[e,r]of t){if(Object.keys(n).length>=qU)break;n[e]=r,ZU(JSON.stringify({version:1,entries:n}))>YU&&delete n[e]}return{version:1,entries:n}}var tW=new class{snapshot;listeners=new Set;storage;constructor(e=typeof sessionStorage>`u`?void 0:sessionStorage){this.storage=e;let t=null;try{t=e?.getItem(`frizz-drafts:v1`)??null}catch{}this.snapshot=eW($U(t))}getSnapshot=()=>this.snapshot;subscribe=e=>(this.listeners.add(e),()=>this.listeners.delete(e));get(e){return this.snapshot.entries[e]?.value??``}set(e,t){let n={...this.snapshot.entries};t?n[e]={value:t,touchedAt:Date.now()}:delete n[e],this.commit({version:1,entries:n})}clear(e){this.snapshot.entries[e]&&this.commit({version:1,entries:Object.fromEntries(Object.entries(this.snapshot.entries).filter(([t])=>t!==e))})}commit(e){this.snapshot=e;try{this.storage?.setItem(KU,JSON.stringify(eW(e)))}catch{}for(let e of this.listeners)e()}};function nW(e){return encodeURIComponent(e||`unresolved-project`)}var rW={dispatch:e=>`dispatch:${nW(e)}:new`,followUp:(e,t,n)=>`followup:${nW(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n??`unowned`)}`,adopt:(e,t)=>`adopt:${nW(e)}:${encodeURIComponent(t)}`,answer:(e,t,n,r,i)=>`answer:${nW(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n??`unowned`)}:${encodeURIComponent(r)}:${i}`,interaction:(e,t,n,r,i,a,o)=>`interaction:${nW(e)}:${encodeURIComponent(t)}:${encodeURIComponent(n)}:${encodeURIComponent(r)}:${i}:${encodeURIComponent(a)}:${encodeURIComponent(o)}`};function iW(){return Hf(Z).board?.projectDir}function aW(e){return Hf(Z).board?.threads.find(t=>t.id===e)?.sessionId}function oW(e){let t=(0,B.useCallback)(()=>tW.get(e),[e]);return[(0,B.useSyncExternalStore)(tW.subscribe,t,t),(0,B.useCallback)(t=>tW.set(e,t),[e]),(0,B.useCallback)(()=>tW.clear(e),[e])]}function sW(e){let t=(0,B.useCallback)(()=>JSON.stringify(Object.fromEntries(e.map(e=>[e,tW.get(e)]))),[e.join(`\0`)]),n=(0,B.useSyncExternalStore)(tW.subscribe,t,t);return(0,B.useMemo)(()=>new Map(Object.entries(JSON.parse(n))),[n])}function cW({autoFocus:e,onDispatched:t}){let{resolved:n,codexList:r,loadError:i,saveProfile:a}=GU(),o=YH(),s=iW(),[c,l,u]=oW(rW.dispatch(s)),d=rW.dispatch(s),f=(0,B.useRef)(``),[p,m]=(0,B.useState)(null),h=qd({queryKey:[`authStatus`],queryFn:()=>X.authStatus(),staleTime:3e4}),[g,_]=(0,B.useState)(null),[v,y]=(0,B.useState)(null),b=(0,B.useRef)(null),x=Jd({mutationFn:e=>X.dispatch(e),onMutate:()=>Q(`Starting thread…`,{spinner:!0,sticky:!0}),onSuccess:e=>{m(null),t?.(),Q(`Thread started`,{link:{label:`Open thread`,slug:e.slug}})},onError:(e,t)=>{tW.get(d)||l(f.current||t.prompt),m(null);let n=/^AUTH_REQUIRED:(claude|codex)$/.exec(e.message);if(n){b.current=t,_(n[1]),Q(`Signed out of ${n[1]===`claude`?`Claude`:`Codex`}`,{duration:3e3});return}Q(`Dispatch failed: ${e.message.slice(0,80)}`)}});function S(e){f.current=c,u(),m(e.prompt),x.mutate(e)}function C(){if(!c.trim()||!n)return;let e=wU(c);if(e){u(),e===`login`?(b.current=null,_(n.backend)):y(n.backend);return}if(!n.modelAvailable){Q(`Saved model is unavailable — choose a model before starting the thread`);return}if(!n.effortAvailable){Q(`Saved reasoning level is unavailable for this model — choose another level`);return}let t={prompt:c.trim(),model:n.model,backend:n.backend,effort:n.effort};if(h.data?.[n.backend]===`signed-out`){b.current=t,_(n.backend);return}S(t)}let w=(0,B.useMemo)(()=>n?(0,V.jsx)(yU,{groups:UU(r),value:{provider:n.backend,model:n.model,effort:n.effort},onValueChange:e=>a({field:`profile`,backend:e.provider,model:e.model,effort:e.effort}),ariaLabel:`Model and effort`,title:n.modelAvailable&&n.effortAvailable?`Model and reasoning effort`:`Saved model or reasoning effort unavailable — choose a supported pair`,className:`max-w-[min(21rem,72vw)]`}):(0,V.jsx)(yU,{groups:[],value:void 0,onValueChange:()=>{},placeholder:i?`Profile unavailable`:`Profile loading…`,ariaLabel:`Model and effort loading`,disabled:!0}),[n,r,i,a]);return(0,V.jsxs)(`div`,{className:`w-full flex flex-col gap-3`,children:[(0,V.jsx)(KH,{surface:`newComposer`,autoFocus:e,value:c,onChange:l,onSubmit:C,placeholder:`Describe the task…`,minHeight:96,maxHeight:340,busy:x.isPending,footer:w,leftAction:o?(0,V.jsx)(XH,{}):void 0}),x.isError&&(0,V.jsx)(`span`,{className:`px-0.5 text-[11px] text-red-400 truncate`,children:x.error.message}),p&&(0,V.jsxs)(`div`,{"data-pending-dispatch":!0,role:`status`,className:`rounded-lg border border-border bg-panel-2 px-3 py-2.5`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-2 text-[11px] text-muted`,children:[(0,V.jsx)(`span`,{className:`inline-block h-1.5 w-1.5 animate-pulse rounded-full bg-accent`,"aria-hidden":`true`}),(0,V.jsx)(`span`,{children:`Starting thread…`})]}),(0,V.jsx)(`p`,{className:`mt-1 line-clamp-2 whitespace-pre-wrap text-[12px] leading-relaxed text-fg`,children:p})]}),g&&(0,V.jsx)(EU,{backend:g,onClose:()=>_(null),onAuthed:()=>{let e=b.current;b.current=null,_(null),e&&S(e)}}),v&&(0,V.jsx)(DU,{backend:v,onClose:()=>y(null)})]})}function lW({onClose:e}){let t=(0,B.useRef)(null),n=(0,B.useRef)(typeof document<`u`&&document.activeElement instanceof HTMLElement?document.activeElement:null);return(0,B.useEffect)(()=>()=>{let e=n.current;window.setTimeout(()=>{e?.isConnected&&e.focus({preventScroll:!0})},0)},[]),(0,V.jsx)(FV,{open:!0,onOpenChange:t=>{t||e()},children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`fixed inset-0 z-50 bg-black/30 backdrop-blur-md backdrop-saturate-150`}),(0,V.jsxs)(qV,{ref:t,"aria-modal":`true`,"aria-describedby":void 0,onEscapeKeyDown:_U,onCloseAutoFocus:e=>{e.preventDefault();let t=n.current;t?.isConnected&&t.focus({preventScroll:!0})},onOpenAutoFocus:e=>{e.preventDefault(),t.current?.querySelector(`textarea`)?.focus({preventScroll:!0})},className:`fixed left-1/2 top-1/2 z-50 w-[640px] max-w-[86vw] -translate-x-1/2 -translate-y-1/2 rounded-xl border border-border bg-panel p-5 shadow-2xl shadow-black/50 outline-none max-[700px]:top-[calc(env(safe-area-inset-top)+56px)] max-[700px]:w-[calc(100vw-24px)] max-[700px]:max-w-none max-[700px]:translate-y-0`,children:[(0,V.jsx)(QV,{className:`mb-1 text-[14px] font-medium`,children:`New thread`}),(0,V.jsx)(cW,{autoFocus:!0,onDispatched:e})]})]})})}function uW({children:e,onClose:t}){return(0,V.jsx)(`div`,{className:`fixed inset-0 z-[200] flex items-center justify-center bg-black/30 backdrop-blur-md backdrop-saturate-150`,onMouseDown:e=>{e.target===e.currentTarget&&t()},children:e})}var dW=`-mx-1.5 inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-fg/75 outline-none transition-colors hover:bg-elevated hover:text-fg focus-visible:ring-1 focus-visible:ring-border-strong disabled:opacity-55`,fW={claude:`size-[11px] translate-y-px`,codex:`size-[10px]`},pW={claude:{backend:`claude`,label:`Claude Code`},codex:{backend:`codex`,label:`OpenAI Codex`}};function mW(e){return e===`claude`||e===`codex`?pW[e]:void 0}function hW({backend:e,className:t}){let n=mW(e);return n?(0,V.jsx)(`span`,{role:`img`,"aria-label":n.label,className:`inline-flex shrink-0 text-muted/65 ${fW[n.backend]} ${t??``}`,children:n.backend===`codex`?(0,V.jsx)(gW,{}):(0,V.jsx)(_W,{})}):null}function gW(){return(0,V.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,className:`size-full`,fill:`currentColor`,children:(0,V.jsx)(`path`,{d:`M22.282 9.821a6 6 0 0 0-.516-4.91a6.05 6.05 0 0 0-6.51-2.9A6.065 6.065 0 0 0 4.981 4.18a6 6 0 0 0-3.998 2.9a6.05 6.05 0 0 0 .743 7.097a5.98 5.98 0 0 0 .51 4.911a6.05 6.05 0 0 0 6.515 2.9A6 6 0 0 0 13.26 24a6.06 6.06 0 0 0 5.772-4.206a6 6 0 0 0 3.997-2.9a6.06 6.06 0 0 0-.747-7.073M13.26 22.43a4.48 4.48 0 0 1-2.876-1.04l.141-.081l4.779-2.758a.8.8 0 0 0 .392-.681v-6.737l2.02 1.168a.07.07 0 0 1 .038.052v5.583a4.504 4.504 0 0 1-4.494 4.494M3.6 18.304a4.47 4.47 0 0 1-.535-3.014l.142.085l4.783 2.759a.77.77 0 0 0 .78 0l5.843-3.369v2.332a.08.08 0 0 1-.033.062L9.74 19.95a4.5 4.5 0 0 1-6.14-1.646M2.34 7.896a4.5 4.5 0 0 1 2.366-1.973V11.6a.77.77 0 0 0 .388.677l5.815 3.354l-2.02 1.168a.08.08 0 0 1-.071 0l-4.83-2.786A4.504 4.504 0 0 1 2.34 7.872zm16.597 3.855l-5.833-3.387L15.119 7.2a.08.08 0 0 1 .071 0l4.83 2.791a4.494 4.494 0 0 1-.676 8.105v-5.678a.79.79 0 0 0-.407-.667m2.01-3.023l-.141-.085l-4.774-2.782a.78.78 0 0 0-.785 0L9.409 9.23V6.897a.07.07 0 0 1 .028-.061l4.83-2.787a4.5 4.5 0 0 1 6.68 4.66zm-12.64 4.135l-2.02-1.164a.08.08 0 0 1-.038-.057V6.075a4.5 4.5 0 0 1 7.375-3.453l-.142.08L8.704 5.46a.8.8 0 0 0-.393.681zm1.097-2.365l2.602-1.5l2.607 1.5v2.999l-2.597 1.5l-2.607-1.5Z`})})}function _W(){return(0,V.jsx)(`svg`,{"aria-hidden":`true`,focusable:`false`,viewBox:`0 0 24 24`,className:`size-full`,fill:`currentColor`,children:(0,V.jsx)(`path`,{d:`m4.7144 15.9555 4.7174-2.6471.079-.2307-.079-.1275h-.2307l-.7893-.0486-2.6956-.0729-2.3375-.0971-2.2646-.1214-.5707-.1215-.5343-.7042.0546-.3522.4797-.3218.686.0608 1.5179.1032 2.2767.1578 1.6514.0972 2.4468.255h.3886l.0546-.1579-.1336-.0971-.1032-.0972L6.973 9.8356l-2.55-1.6879-1.3356-.9714-.7225-.4918-.3643-.4614-.1578-1.0078.6557-.7225.8803.0607.2246.0607.8925.686 1.9064 1.4754 2.4893 1.8336.3643.3035.1457-.1032.0182-.0728-.164-.2733-1.3539-2.4467-1.445-2.4893-.6435-1.032-.17-.6194c-.0607-.255-.1032-.4674-.1032-.7285L6.287.1335 6.6997 0l.9957.1336.419.3642.6192 1.4147 1.0018 2.2282 1.5543 3.0296.4553.8985.2429.8318.091.255h.1579v-.1457l.1275-1.706.2368-2.0947.2307-2.6957.0789-.7589.3764-.9107.7468-.4918.5828.2793.4797.686-.0668.4433-.2853 1.8517-.5586 2.9021-.3643 1.9429h.2125l.2429-.2429.9835-1.3053 1.6514-2.0643.7286-.8196.85-.9046.5464-.4311h1.0321l.759 1.1293-.34 1.1657-1.0625 1.3478-.8804 1.1414-1.2628 1.7-.7893 1.36.0729.1093.1882-.0183 2.8535-.607 1.5421-.2794 1.8396-.3157.8318.3886.091.3946-.3278.8075-1.967.4857-2.3072.4614-3.4364.8136-.0425.0304.0486.0607 1.5482.1457.6618.0364h1.621l3.0175.2247.7892.522.4736.6376-.079.4857-1.2142.6193-1.6393-.3886-3.825-.9107-1.3113-.3279h-.1822v.1093l1.0929 1.0686 2.0035 1.8092 2.5075 2.3314.1275.5768-.3218.4554-.34-.0486-2.2039-1.6575-.85-.7468-1.9246-1.621h-.1275v.17l.4432.6496 2.3436 3.5214.1214 1.0807-.17.3521-.6071.2125-.6679-.1214-1.3721-1.9246L14.38 17.959l-1.1414-1.9428-.1397.079-.674 7.2552-.3156.3703-.7286.2793-.6071-.4614-.3218-.7468.3218-1.4753.3886-1.9246.3157-1.53.2853-1.9004.17-.6314-.0121-.0425-.1397.0182-1.4328 1.9672-2.1796 2.9446-1.7243 1.8456-.4128.164-.7164-.3704.0667-.6618.4008-.5889 2.386-3.0357 1.4389-1.882.929-1.0868-.0062-.1579h-.0546l-6.3385 4.1164-1.1293.1457-.4857-.4554.0608-.7467.2307-.2429 1.9064-1.3114Z`})})}typeof window<`u`&&window.document&&window.document.createElement;function vW(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r||!r.defaultPrevented)return t?.(r)}}function yW(e,t=[]){let n=[];function r(t,r){let i=B.createContext(r);i.displayName=t+`Context`;let a=n.length;n=[...n,r];let o=t=>{let{scope:n,children:r,...o}=t,s=n?.[e]?.[a]||i,c=B.useMemo(()=>o,Object.values(o));return(0,V.jsx)(s.Provider,{value:c,children:r})};o.displayName=t+`Provider`;function s(n,o,s={}){let{optional:c=!1}=s,l=o?.[e]?.[a]||i,u=B.useContext(l);if(u)return u;if(r!==void 0)return r;if(!c)throw Error(`\`${n}\` must be used within \`${t}\``)}return[o,s]}let i=()=>{let t=n.map(e=>B.createContext(e));return function(n){let r=n?.[e]||t;return B.useMemo(()=>({[`__scope${e}`]:{...n,[e]:r}}),[n,r])}};return i.scopeName=e,[r,bW(i,...t)]}function bW(...e){let t=e[0];if(e.length===1)return t;let n=()=>{let n=e.map(e=>({useScope:e(),scopeName:e.scopeName}));return function(e){let r=n.reduce((t,{useScope:n,scopeName:r})=>{let i=n(e)[`__scope${r}`];return{...t,...i}},{});return B.useMemo(()=>({[`__scope${t.scopeName}`]:r}),[r])}};return n.scopeName=t.scopeName,n}var xW=`DismissableLayer`,SW=`dismissableLayer.update`,CW=`dismissableLayer.pointerDownOutside`,wW=`dismissableLayer.focusOutside`,TW,EW=B.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set,dismissableSurfaces:new Set}),DW=B.forwardRef((e,t)=>{let{disableOutsidePointerEvents:n=!1,deferPointerDownOutside:r=!1,onEscapeKeyDown:i,onPointerDownOutside:a,onFocusOutside:o,onInteractOutside:s,onDismiss:c,...l}=e,u=B.useContext(EW),[d,f]=B.useState(null),p=d?.ownerDocument??globalThis?.document,[,m]=B.useState({}),h=AN(t,f),g=Array.from(u.layers),[_]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),v=_?g.indexOf(_):-1,y=d?g.indexOf(d):-1,b=u.layersWithOutsidePointerEventsDisabled.size>0,x=y>=v,S=B.useRef(!1),C=jW(e=>{a?.(e),s?.(e),e.defaultPrevented||c?.()},{ownerDocument:p,deferPointerDownOutside:r,isDeferredPointerDownOutsideRef:S,dismissableSurfaces:u.dismissableSurfaces,shouldHandlePointerDownOutside:B.useCallback(e=>{if(!(e instanceof Node))return!1;let t=[...u.branches].some(t=>t.contains(e));return x&&!t},[u.branches,x])}),w=MW(e=>{if(r&&S.current)return;let t=e.target;[...u.branches].some(e=>e.contains(t))||(o?.(e),s?.(e),e.defaultPrevented||c?.())},p),T=d?y===g.length-1:!1,E=aP(e=>{e.key===`Escape`&&(i?.(e),!e.defaultPrevented&&c&&(e.preventDefault(),c()))});return B.useEffect(()=>{if(T)return p.addEventListener(`keydown`,E,{capture:!0}),()=>p.removeEventListener(`keydown`,E,{capture:!0})},[p,T,E]),B.useEffect(()=>{if(d)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(TW=p.body.style.pointerEvents,p.body.style.pointerEvents=`none`),u.layersWithOutsidePointerEventsDisabled.add(d)),u.layers.add(d),NW(),()=>{n&&(u.layersWithOutsidePointerEventsDisabled.delete(d),u.layersWithOutsidePointerEventsDisabled.size===0&&(p.body.style.pointerEvents=TW))}},[d,p,n,u]),B.useEffect(()=>()=>{d&&(u.layers.delete(d),u.layersWithOutsidePointerEventsDisabled.delete(d),NW())},[d,u]),B.useEffect(()=>{let e=()=>m({});return document.addEventListener(SW,e),()=>document.removeEventListener(SW,e)},[]),(0,V.jsx)(eP.div,{...l,ref:h,style:{pointerEvents:b?x?`auto`:`none`:void 0,...e.style},onFocusCapture:vW(e.onFocusCapture,w.onFocusCapture),onBlurCapture:vW(e.onBlurCapture,w.onBlurCapture),onPointerDownCapture:vW(e.onPointerDownCapture,C.onPointerDownCapture)})});DW.displayName=xW;var OW=`DismissableLayerBranch`,kW=B.forwardRef((e,t)=>{let n=B.useContext(EW),r=B.useRef(null),i=AN(t,r);return B.useEffect(()=>{let e=r.current;if(e)return n.branches.add(e),()=>{n.branches.delete(e)}},[n.branches]),(0,V.jsx)(eP.div,{...e,ref:i})});kW.displayName=OW;var AW=()=>!0;function jW(e,t){let{ownerDocument:n=globalThis?.document,deferPointerDownOutside:r=!1,isDeferredPointerDownOutsideRef:i,dismissableSurfaces:a,shouldHandlePointerDownOutside:o=AW}=t,s=aP(e),c=B.useRef(!1),l=B.useRef(!1),u=B.useRef(new Map),d=B.useRef(()=>{});return B.useEffect(()=>{function e(){l.current=!1,i.current=!1,u.current.clear()}function t(){return Array.from(u.current.values()).some(Boolean)}function f(e){if(!l.current)return;let t=e.target;t instanceof Node&&[...a].some(e=>e.contains(t))||u.current.set(e.type,!0),e.type===`click`&&window.setTimeout(()=>{l.current&&d.current()},0)}function p(e){l.current&&u.current.set(e.type,!1)}let m=a=>{if(a.target&&!c.current){let f=function(){n.removeEventListener(`click`,d.current);let r=t();e(),r||PW(CW,s,p,{discrete:!0})};if(!o(a.target)){n.removeEventListener(`click`,d.current),e(),c.current=!1;return}let p={originalEvent:a};l.current=!0,i.current=r&&a.button===0,u.current.clear(),!r||a.button!==0?f():(n.removeEventListener(`click`,d.current),d.current=f,n.addEventListener(`click`,d.current,{once:!0}))}else n.removeEventListener(`click`,d.current),e();c.current=!1},h=[`pointerup`,`mousedown`,`mouseup`,`touchstart`,`touchend`,`click`];for(let e of h)n.addEventListener(e,f,!0),n.addEventListener(e,p);let g=window.setTimeout(()=>{n.addEventListener(`pointerdown`,m)},0);return()=>{window.clearTimeout(g),n.removeEventListener(`pointerdown`,m),n.removeEventListener(`click`,d.current);for(let e of h)n.removeEventListener(e,f,!0),n.removeEventListener(e,p)}},[n,s,r,i,a,o]),{onPointerDownCapture:()=>c.current=!0}}function MW(e,t=globalThis?.document){let n=aP(e),r=B.useRef(!1);return B.useEffect(()=>{let e=e=>{e.target&&!r.current&&PW(wW,n,{originalEvent:e},{discrete:!1})};return t.addEventListener(`focusin`,e),()=>t.removeEventListener(`focusin`,e)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function NW(){let e=new CustomEvent(SW);document.dispatchEvent(e)}function PW(e,t,n,{discrete:r}){let i=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&i.addEventListener(e,t,{once:!0}),r?tP(i,a):i.dispatchEvent(a)}var FW=`focusScope.autoFocusOnMount`,IW=`focusScope.autoFocusOnUnmount`,LW={bubbles:!1,cancelable:!0},RW=`FocusScope`,zW=B.forwardRef((e,t)=>{let{loop:n=!1,trapped:r=!1,onMountAutoFocus:i,onUnmountAutoFocus:a,...o}=e,[s,c]=B.useState(null),l=aP(i),u=aP(a),d=B.useRef(null),f=AN(t,c),p=B.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;B.useEffect(()=>{if(r){let e=function(e){if(p.paused||!s)return;let t=e.target;s.contains(t)?d.current=t:KW(d.current,{select:!0})},t=function(e){if(p.paused||!s)return;let t=e.relatedTarget;t!==null&&(s.contains(t)||KW(d.current,{select:!0}))},n=function(e){if(document.activeElement===document.body)for(let t of e)t.removedNodes.length>0&&KW(s)};document.addEventListener(`focusin`,e),document.addEventListener(`focusout`,t);let r=new MutationObserver(n);return s&&r.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener(`focusin`,e),document.removeEventListener(`focusout`,t),r.disconnect()}}},[r,s,p.paused]),B.useEffect(()=>{if(s){qW.add(p);let e=document.activeElement;if(!s.contains(e)){let t=new CustomEvent(FW,LW);s.addEventListener(FW,l),s.dispatchEvent(t),t.defaultPrevented||(BW(XW(HW(s)),{select:!0}),document.activeElement===e&&KW(s))}return()=>{s.removeEventListener(FW,l),setTimeout(()=>{let t=new CustomEvent(IW,LW);s.addEventListener(IW,u),s.dispatchEvent(t),t.defaultPrevented||KW(e??document.body,{select:!0}),s.removeEventListener(IW,u),qW.remove(p)},0)}}},[s,l,u,p]);let m=B.useCallback(e=>{if(!n&&!r||p.paused)return;let t=e.key===`Tab`&&!e.altKey&&!e.ctrlKey&&!e.metaKey,i=document.activeElement;if(t&&i){let t=e.currentTarget,[r,a]=VW(t);r&&a?!e.shiftKey&&i===a?(e.preventDefault(),n&&KW(r,{select:!0})):e.shiftKey&&i===r&&(e.preventDefault(),n&&KW(a,{select:!0})):i===t&&e.preventDefault()}},[n,r,p.paused]);return(0,V.jsx)(eP.div,{tabIndex:-1,...o,ref:f,onKeyDown:m})});zW.displayName=RW;function BW(e,{select:t=!1}={}){let n=document.activeElement;for(let r of e)if(KW(r,{select:t}),document.activeElement!==n)return}function VW(e){let t=HW(e);return[UW(t,e),UW(t.reverse(),e)]}function HW(e){let t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:e=>{let t=e.tagName===`INPUT`&&e.type===`hidden`;return e.disabled||e.hidden||t?NodeFilter.FILTER_SKIP:e.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function UW(e,t){let n=typeof t.checkVisibility==`function`&&t.checkVisibility({checkVisibilityCSS:!0});for(let r of e)if(!(n?!r.checkVisibility({checkVisibilityCSS:!0}):WW(r,{upTo:t})))return r}function WW(e,{upTo:t}){if(getComputedStyle(e).visibility===`hidden`)return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display===`none`)return!0;e=e.parentElement}return!1}function GW(e){return e instanceof HTMLInputElement&&`select`in e}function KW(e,{select:t=!1}={}){if(e&&e.focus){let n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&GW(e)&&t&&e.select()}}var qW=JW();function JW(){let e=[];return{add(t){let n=e[0];t!==n&&n?.pause(),e=YW(e,t),e.unshift(t)},remove(t){e=YW(e,t),e[0]?.resume()}}}function YW(e,t){let n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function XW(e){return e.filter(e=>e.tagName!==`A`)}var ZW=`Popper`,[QW,$W]=yW(ZW),[eG,tG]=QW(ZW),nG=e=>{let{__scopePopper:t,children:n}=e,[r,i]=B.useState(null),[a,o]=B.useState(void 0);return(0,V.jsx)(eG,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};nG.displayName=ZW;var rG=`PopperAnchor`,iG=B.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=tG(rG,n),o=B.useRef(null),s=a.onAnchorChange,c=AN(t,B.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=B.useRef(null);B.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&mG(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,V.jsx)(eP.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});iG.displayName=rG;var aG=`PopperContent`,[oG,sG]=QW(aG),cG=B.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:u=0,sticky:d=`partial`,hideWhenDetached:f=!1,updatePositionStrategy:p=`optimized`,onPlaced:m,...h}=e,g=tG(aG,n),[_,v]=B.useState(null),y=AN(t,v),[b,x]=B.useState(null),S=rL(b),C=S?.width??0,w=S?.height??0,T=r+(a===`center`?``:`-`+a),E=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},D=Array.isArray(l)?l:[l],O=D.length>0,k={padding:E,boundary:D.filter(fG),altBoundary:O},{refs:A,floatingStyles:j,placement:M,isPositioned:N,middlewareData:P}=GI({strategy:`fixed`,placement:T,whileElementsMounted:(...e)=>jI(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[qI({mainAxis:i+w,alignmentAxis:o}),c&&JI({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?YI():void 0,...k}),c&&XI({...k}),ZI({...k,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),b&&$I({element:b,padding:s}),pG({arrowWidth:C,arrowHeight:w}),f&&QI({strategy:`referenceHidden`,...k,boundary:O?k.boundary:void 0})]}),ee=g.setPlacementState;NN(()=>(ee(M),()=>{ee(void 0)}),[M,ee]);let[F,te]=mG(M),ne=aP(m);NN(()=>{N&&ne?.()},[N,ne]);let re=P.arrow?.x,ie=P.arrow?.y,ae=P.arrow?.centerOffset!==0,[oe,se]=B.useState();return NN(()=>{_&&se(window.getComputedStyle(_).zIndex)},[_]),(0,V.jsx)(`div`,{ref:A.setFloating,"data-radix-popper-content-wrapper":``,style:{...j,transform:N?j.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:oe,"--radix-popper-transform-origin":[P.transformOrigin?.x,P.transformOrigin?.y].join(` `),...P.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,V.jsx)(oG,{scope:n,placedSide:F,placedAlign:te,onArrowChange:x,arrowX:re,arrowY:ie,shouldHideArrow:ae,children:(0,V.jsx)(eP.div,{"data-side":F,"data-align":te,...h,ref:y,style:{...h.style,animation:N?void 0:`none`}})})})});cG.displayName=aG;var lG=`PopperArrow`,uG={top:`bottom`,right:`left`,bottom:`top`,left:`right`},dG=B.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=sG(lG,n),a=uG[i.placedSide];return(0,V.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,V.jsx)(nL,{...r,ref:t,style:{...r.style,display:`block`}})})});dG.displayName=lG;function fG(e){return e!==null}var pG=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=mG(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function mG(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var hG=nG,gG=iG,_G=cG,vG=dG;function yG(e,t){return B.useReducer((e,n)=>t[e][n]??e,e)}var bG=e=>{let{present:t,children:n}=e,r=xG(t),i=typeof n==`function`?n({present:r.isPresent}):B.Children.only(n),a=CG(r.ref,TG(i));return typeof n==`function`||r.isPresent?B.cloneElement(i,{ref:a}):null};bG.displayName=`Presence`;function xG(e){let[t,n]=B.useState(),r=B.useRef(null),i=B.useRef(e),a=B.useRef(`none`),o=B.useRef(void 0),[s,c]=yG(e?`mounted`:`unmounted`,{mounted:{UNMOUNT:`unmounted`,ANIMATION_OUT:`unmountSuspended`},unmountSuspended:{MOUNT:`mounted`,ANIMATION_END:`unmounted`},unmounted:{MOUNT:`mounted`}});return B.useEffect(()=>{s===`mounted`?(a.current=o.current??wG(r.current),o.current=void 0):a.current=`none`},[s]),NN(()=>{let t=r.current,n=i.current;if(n!==e){let r=a.current,s=wG(t);e?(o.current=s,c(`MOUNT`)):s===`none`||t?.display===`none`?c(`UNMOUNT`):c(n&&r!==s?`ANIMATION_OUT`:`UNMOUNT`),i.current=e}},[e,c]),NN(()=>{if(t){let e,n=t.ownerDocument.defaultView??window,o=a=>{let o=wG(r.current).includes(CSS.escape(a.animationName));if(a.target===t&&o&&(c(`ANIMATION_END`),!i.current)){let r=t.style.animationFillMode;t.style.animationFillMode=`forwards`,e=n.setTimeout(()=>{t.style.animationFillMode===`forwards`&&(t.style.animationFillMode=r)})}},s=e=>{e.target===t&&(a.current=wG(r.current))};return t.addEventListener(`animationstart`,s),t.addEventListener(`animationcancel`,o),t.addEventListener(`animationend`,o),()=>{n.clearTimeout(e),t.removeEventListener(`animationstart`,s),t.removeEventListener(`animationcancel`,o),t.removeEventListener(`animationend`,o)}}else c(`ANIMATION_END`)},[t,c]),{isPresent:[`mounted`,`unmountSuspended`].includes(s),ref:B.useCallback(e=>{if(e){let t=getComputedStyle(e);r.current=t,o.current=wG(t)}else r.current=null;n(e)},[])}}function SG(e,t){if(typeof e==`function`)return e(t);e!=null&&(e.current=t)}function CG(...e){let t=B.useRef(e);return t.current=e,B.useCallback(e=>{let n=t.current,r=!1,i=n.map(t=>{let n=SG(t,e);return!r&&typeof n==`function`&&(r=!0),n});if(r)return()=>{for(let e=0;e<i.length;e++){let t=i[e];typeof t==`function`?t():SG(n[e],null)}}},[])}function wG(e){return e?.animationName||`none`}function TG(e){let t=Object.getOwnPropertyDescriptor(e.props,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,`ref`)?.get,n=t&&`isReactWarning`in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var EG=`Popover`,[DG,mte]=yW(EG,[$W]),OG=$W(),[kG,AG]=DG(EG),jG=e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=OG(t),c=B.useRef(null),[l,u]=B.useState(!1),[d,f]=RN({prop:r,defaultProp:i??!1,onChange:a,caller:EG});return(0,V.jsx)(hG,{...s,children:(0,V.jsx)(kG,{scope:t,contentId:HP(),triggerRef:c,open:d,onOpenChange:f,onOpenToggle:B.useCallback(()=>f(e=>!e),[f]),hasCustomAnchor:l,onCustomAnchorAdd:B.useCallback(()=>u(!0),[]),onCustomAnchorRemove:B.useCallback(()=>u(!1),[]),modal:o,children:n})})};jG.displayName=EG;var MG=`PopoverAnchor`,NG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=AG(MG,n),a=OG(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return B.useEffect(()=>(o(),()=>s()),[o,s]),(0,V.jsx)(gG,{...a,...r,ref:t})});NG.displayName=MG;var PG=`PopoverTrigger`,FG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=AG(PG,n),a=OG(n),o=AN(t,i.triggerRef),s=(0,V.jsx)(eP.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":XG(i.open),...r,ref:o,onClick:vW(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,V.jsx)(gG,{asChild:!0,...a,children:s})});FG.displayName=PG;var IG=`PopoverPortal`,[LG,RG]=DG(IG,{forceMount:void 0}),zG=e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=AG(IG,t);return(0,V.jsx)(LG,{scope:t,forceMount:n,children:(0,V.jsx)(bG,{present:n||a.open,children:(0,V.jsx)(DL,{asChild:!0,container:i,children:r})})})};zG.displayName=IG;var BG=`PopoverContent`,VG=B.forwardRef((e,t)=>{let n=RG(BG,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=AG(BG,e.__scopePopover);return(0,V.jsx)(bG,{present:r||a.open,children:a.modal?(0,V.jsx)(UG,{...i,ref:t}):(0,V.jsx)(WG,{...i,ref:t})})});VG.displayName=BG;var HG=VN(`PopoverContent.RemoveScroll`),UG=B.forwardRef((e,t)=>{let n=AG(BG,e.__scopePopover),r=B.useRef(null),i=AN(t,r),a=B.useRef(!1);return B.useEffect(()=>{let e=r.current;if(e)return uR(e)},[]),(0,V.jsx)(mz,{as:HG,allowPinchZoom:!0,children:(0,V.jsx)(GG,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:vW(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:vW(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:vW(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),WG=B.forwardRef((e,t)=>{let n=AG(BG,e.__scopePopover),r=B.useRef(!1),i=B.useRef(!1);return(0,V.jsx)(GG,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})}),GG=B.forwardRef((e,t)=>{let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onInteractOutside:u,...d}=e,f=AG(BG,n),p=OG(n);return SP(),(0,V.jsx)(zW,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,V.jsx)(DW,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:l,onDismiss:()=>f.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,V.jsx)(_G,{"data-state":XG(f.open),role:`dialog`,id:f.contentId,...p,...d,ref:t,style:{...d.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})}),KG=`PopoverClose`,qG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=AG(KG,n);return(0,V.jsx)(eP.button,{type:`button`,...r,ref:t,onClick:vW(e.onClick,()=>i.onOpenChange(!1))})});qG.displayName=KG;var JG=`PopoverArrow`,YG=B.forwardRef((e,t)=>{let{__scopePopover:n,...r}=e,i=OG(n);return(0,V.jsx)(vG,{...i,...r,ref:t})});YG.displayName=JG;function XG(e){return e?`open`:`closed`}var ZG=jG,QG=NG,$G=FG,eK=zG,tK=VG;function nK({modal:e=!1,...t}){return(0,V.jsx)(ZG,{modal:e,...t})}var rK=$G,iK=QG;function aK({children:e,side:t=`top`,align:n=`center`,sideOffset:r=6,className:i=``,...a}){return(0,V.jsx)(eK,{children:(0,V.jsx)(tK,{side:t,align:n,sideOffset:r,avoidCollisions:!0,collisionPadding:12,onEscapeKeyDown:e=>e.stopPropagation(),className:`${bV} ${wV} rounded-lg outline-none ${i}`,...a,children:e})})}var oK=3e4,sK=45e3;function cK(e,t){return t?AbortSignal.any([t,AbortSignal.timeout(e)]):AbortSignal.timeout(e)}var lK=`text-[9px]`,uK={claude:`text-fg/75! size-[14px]! translate-y-0!`,codex:`text-fg/75! size-[12.75px]! translate-y-0!`};function dK(){let e=qd({queryKey:[`quota`],queryFn:()=>X.quota(),staleTime:1e4}),t=qd({queryKey:[`authStatus`],queryFn:()=>X.authStatus(),staleTime:3e4});return[`claude`,`codex`].some(n=>fK(e.data?.[n],t.data?.[n],e.isLoading))}function fK(e,t,n){return t===`signed-out`||!e&&n?!1:!!e&&e.status===`ok`&&e.windows.length>0}function pK(){let e=Md(),t=(0,B.useRef)(null),[n,r]=(0,B.useState)(!1),i=qd({queryKey:[`quota`],queryFn:({signal:e})=>X.quota(void 0,{signal:cK(oK,e)}),refetchInterval:e=>{let t=e.state.data;return!t||t.claude.status!==`ok`||t.codex.status!==`ok`?15e3:3e4},staleTime:1e4,refetchOnWindowFocus:!0}),a=qd({queryKey:[`authStatus`],queryFn:({signal:e})=>X.authStatus(void 0,{signal:cK(oK,e)}),refetchInterval:12e4,staleTime:3e4,refetchOnWindowFocus:!0}),o=n=>{if(t.current)return;r(!0);let i=Promise.all([X.quota({force:n===`claude`},{signal:cK(sK)}).then(t=>e.setQueryData([`quota`],t)),e.refetchQueries({queryKey:[`authStatus`]})]).then(()=>{}).catch(()=>{}).finally(()=>{t.current=null,r(!1)});t.current=i};return(0,V.jsxs)(`div`,{"data-quota-bar":!0,className:`flex shrink-0 items-center gap-3 ${lK}`,children:[(0,V.jsx)(mK,{backend:`claude`,quota:i.data?.claude,auth:a.data?.claude,email:a.data?.emails?.claude,loading:i.isLoading,fetching:i.isFetching||n,onRecheck:()=>o(`claude`)}),(0,V.jsx)(mK,{backend:`codex`,quota:i.data?.codex,auth:a.data?.codex,email:a.data?.emails?.codex,loading:i.isLoading,fetching:i.isFetching||n,onRecheck:()=>o(`codex`)})]})}function mK({backend:e,quota:t,auth:n,email:r,loading:i,fetching:a,onRecheck:o}){let s=CU[e];if(!fK(t,n,i))return null;let c=hK(100-_K(t.windows).usedPercent);return(0,V.jsx)(V.Fragment,{children:(0,V.jsxs)(nK,{onOpenChange:e=>{e&&o()},children:[(0,V.jsx)(rK,{asChild:!0,children:(0,V.jsxs)(`button`,{type:`button`,"aria-label":`${s} quota: ${c}% remaining`,className:`flex items-center gap-1.5 min-w-0 rounded outline-none transition-opacity hover:opacity-80 focus-visible:ring-1 focus-visible:ring-border-strong`,children:[(0,V.jsx)(hW,{backend:e,className:uK[e]}),(0,V.jsxs)(`span`,{className:`tabular-nums ${vK(c)}`,children:[c,`%`]})]})}),(0,V.jsxs)(aK,{side:`bottom`,align:`start`,className:`w-[min(15rem,calc(100vw-1.5rem))] p-3 text-[11px] leading-relaxed text-fg`,children:[(0,V.jsxs)(`div`,{className:`mb-2`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,V.jsx)(hW,{backend:e}),(0,V.jsx)(`span`,{children:s}),t?.planType&&(0,V.jsxs)(`span`,{className:`text-muted/70`,children:[`· `,yK(t.planType),` plan`]}),a&&(0,V.jsx)(dw,{size:11,className:`animate-spin text-muted/60`,"aria-label":`Rechecking`})]}),r&&(0,V.jsx)(`div`,{"data-quota-account":!0,className:`truncate text-muted/70 select-text`,title:r,children:r})]}),(0,V.jsxs)(`ul`,{className:`flex flex-col gap-1`,children:[t.windows.map(e=>{let t=hK(100-e.usedPercent),n=bK(e);return(0,V.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,V.jsx)(`span`,{className:`text-muted/80`,children:e.label}),(0,V.jsxs)(`span`,{className:`flex items-center gap-2 tabular-nums`,children:[(0,V.jsxs)(`span`,{className:vK(t),children:[t,`% left`]}),n&&(0,V.jsxs)(`span`,{className:`text-muted/55`,children:[`resets `,n]})]})]},e.key)}),t.detail&&(0,V.jsx)(`li`,{className:`pt-1 text-muted/55`,children:t.detail})]})]})]})})}function hK(e){return Math.max(0,Math.min(100,Math.round(e)))}var gK=25;function _K(e){return e.find(e=>e.key===`5h`)??e.reduce((e,t)=>t.usedPercent>e.usedPercent?t:e)}function vK(e){return e<=8?`text-red-400`:e<=gK?`text-accent`:`text-fg/70`}function yK(e){return e&&e[0].toUpperCase()+e.slice(1)}function bK(e){if(!e.resetsAt)return null;let t=e.resetsAt*1e3,n=new Date(t);if(Number.isNaN(n.getTime()))return null;let r=t-Date.now();if(r<=0)return null;if(r<24*36e5){let e=n.getHours(),t=n.getMinutes(),r=e>=12?`pm`:`am`;return e=e%12||12,t===0?`${e}${r}`:`${e}:${String(t).padStart(2,`0`)}${r}`}return n.toLocaleDateString(void 0,{weekday:`short`})}var xK=`frizz:supervisor-status-wake`;function SK(e){return e!==null}function CK(e){return e?.updateRestart===!0&&e.updateAvailable!==!1}function wK(e){return e?.dev===!0}async function TK(e=fetch){try{let t=await e(`/_frizz/control/status`,{headers:{"cache-control":`no-store`}});if(!t.ok||!t.headers.get(`content-type`)?.includes(`application/json`))return null;let n=await t.json();return n.protocol===1&&(n.state===`ready`||n.state===`restarting`||n.state===`failed`)?n:null}catch{return null}}async function EK(e,t){let n=await t(e,{method:`POST`,headers:{"cache-control":`no-store`}}),r;try{r=await n.json()}catch{}if(!n.headers.get(`content-type`)?.includes(`application/json`)||!r||r.protocol!==1||r.state!==`ready`&&r.state!==`restarting`&&r.state!==`failed`)throw Error(`Frizz restart controls are unavailable for this server`);if(!n.ok)throw Error(r.message??`Restart request failed (${n.status})`);if(r.state===`failed`)throw Error(r.message??`Frizz did not become ready`);return r}function DK(e=fetch){return EK(`/_frizz/control/restart`,e)}function OK(e=fetch){return EK(`/_frizz/control/update-restart`,e)}var kK=`Install the latest version of Frizz. Your running threads will not be affected.`,AK=`A newer version of Frizz is available. Your running threads will not be affected.`,jK=`Restart Frizz. Your running threads will not be affected.`,MK=`fixed left-3 right-3 top-12 z-50 w-auto text-left font-sans sm:absolute sm:right-auto sm:-left-1.5 sm:top-[calc(100%+0.65rem)]`,NK=`sm:w-[min(23rem,calc(100vw-1.5rem))]`,PK=`sm:w-[min(34rem,calc(100vw-1.5rem))]`,FK=`rounded-xl bg-elevated p-3.5 shadow-xl shadow-black/45`;function IK({open:e,update:t,version:n,updateVersion:r}){if(!e)return null;let i=t?`Update Frizz`:`Restart Frizz`,a=t?r:void 0;return(0,V.jsxs)(`div`,{id:`update-restart-popover`,role:`tooltip`,"aria-label":i,className:`${MK} ${NK} ${FK} border border-border-strong`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-1.5 left-1.5 h-3 w-3 rotate-45 border-l border-t border-border-strong bg-elevated`}),(0,V.jsxs)(`div`,{className:`relative flex items-center gap-2.5`,children:[(0,V.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-fg/10 text-fg`,children:(0,V.jsx)(bw,{"aria-hidden":`true`,size:14,strokeWidth:2.25})}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col`,children:[(0,V.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-fg`,children:i}),n&&(0,V.jsx)(`span`,{className:`font-mono text-[11px] leading-snug text-muted`,children:a?`${n} → ${a}`:n})]})]}),(0,V.jsx)(`p`,{className:`relative mt-2.5 text-[12px] leading-relaxed text-muted`,children:t?a?AK:kK:jK})]})}var LK=`Frizz kept running the previous version, and your threads are unaffected.`;function RK({update:e,message:t,onDismiss:n}){return(0,V.jsxs)(`div`,{role:`alert`,className:`${MK} ${PK} ${FK} border border-red-500/45`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`absolute -top-1.5 left-1.5 h-3 w-3 rotate-45 border-l border-t border-red-500/45 bg-elevated`}),(0,V.jsxs)(`div`,{className:`relative flex items-center gap-2.5`,children:[(0,V.jsx)(`span`,{className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-lg bg-red-500/15 text-red-300`,children:(0,V.jsx)(Mw,{"aria-hidden":`true`,size:14,strokeWidth:2.25})}),(0,V.jsx)(`span`,{className:`text-[13px] font-semibold tracking-[-0.01em] text-fg`,children:e?`Update failed`:`Restart failed`}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Dismiss`,onClick:n,className:`-mr-1 ml-auto flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-border-strong`,children:(0,V.jsx)(Pw,{"aria-hidden":`true`,size:14,strokeWidth:2.25})})]}),(0,V.jsx)(`p`,{className:`relative mt-2.5 text-[12px] leading-relaxed text-muted`,children:LK}),(0,V.jsx)(`pre`,{className:`relative mt-2.5 max-h-64 overflow-y-auto whitespace-pre-wrap break-words rounded-md border border-border bg-panel px-2.5 py-2 font-mono text-[11px] leading-relaxed text-fg/70`,children:t})]})}function zK({update:e,busy:t,updateVersion:n,onFocus:r,onBlur:i,onClick:a}){return(0,V.jsxs)(`button`,{type:`button`,"aria-describedby":`update-restart-popover`,"aria-label":e?`Update Frizz`:`Restart Frizz`,disabled:t,"aria-busy":t||void 0,className:`relative ${dW}`,onFocus:r,onBlur:i,onClick:a,children:[(0,V.jsx)(bw,{size:14,"aria-hidden":`true`,className:t?`animate-spin`:void 0}),e&&!t&&n&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-[2px] top-[2px] h-[4px] w-[4px] rounded-full bg-accent`})]})}function BK(){let e=Hf(Z),[t,n]=(0,B.useState)(!1),[r,i]=(0,B.useState)(!1),[a,o]=(0,B.useState)(),[s,c]=(0,B.useState)(),[l,u]=(0,B.useState)(null),[d,f]=(0,B.useState)(!1),[p,m]=(0,B.useState)({}),h=(0,B.useRef)(!1),g=(0,B.useRef)(null);if((0,B.useEffect)(()=>{let e=!0;return TK().then(t=>{e&&(u(SK(t)),f(CK(t)),m({version:t?.version,updateVersion:t?.updateVersion}))}),()=>{e=!1}},[]),l!==!0)return null;let _=h.current&&e.controlPlaneState===`failed`?e.controlPlaneMessage??`Frizz did not become ready`:void 0,v=a??_,y=v&&v!==s?v:void 0,b=async()=>{if(r)return;h.current=!0,n(!1),i(!0),o(void 0),c(void 0);let e=`${window.location.pathname}${window.location.search}${window.location.hash}`;d&&(Z.controlPlaneState=`restarting`,Z.controlPlaneMessage=null,Z.controlPlaneRestartPending=!0);try{d?await OK():await DK(),d?(sessionStorage.setItem(`frizz:reload-after-update-restart`,e),window.dispatchEvent(new Event(xK)),i(!1)):window.location.replace(e)}catch(e){d&&(Z.controlPlaneRestartPending=!1,Z.controlPlaneState=`ready`,Z.controlPlaneMessage=null);let t=e.message.slice(0,140);i(!1),o(t),Q(`${d?`Update & Restart`:`Restart Frizz`} failed`)}};return(0,V.jsxs)(`div`,{ref:g,className:`relative`,onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[(0,V.jsx)(zK,{update:d,busy:r,updateVersion:p.updateVersion,onFocus:()=>n(!0),onBlur:()=>n(!1),onClick:()=>void b()}),y&&(0,V.jsx)(RK,{update:d,message:y,onDismiss:()=>c(y)}),(0,V.jsx)(IK,{open:t&&!y,update:d,version:p.version,updateVersion:p.updateVersion})]})}function VK(){return(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`h-3 w-px shrink-0 bg-border`})}function HK({state:e,fallback:t}){let n={open:{cls:`bg-live`,word:`connected`},connecting:{cls:`bg-accent`,word:`connecting…`},closed:{cls:`bg-red-500`,word:`disconnected`}}[e],r=t?`connected · SSE fallback`:n.word;return(0,V.jsx)(`span`,{role:`img`,"aria-label":r,title:r,"data-board-sync-fallback":t||void 0,className:`h-1.5 w-1.5 shrink-0 rounded-full ${t?`bg-accent`:n.cls}`})}function UK(){let e=Hf(Z),t=rY(ej()),n=dK(),r=e.connection===`open`&&!!e.socketBoardFallback,i=t.state===`verified`?t.repo:t.state===`local`?t.name:null,a=t.state===`verified`?t.label:i??void 0,o=t.state===`verified`?`Project: ${t.label}`:t.state===`local`?`Project: ${t.name}; local repository with no git remote`:t.state===`loading`?`Project identity loading`:`Project identity unavailable`;return(0,V.jsxs)(`div`,{"data-status-row":!0,className:`mb-2.5 flex min-w-0 items-center gap-3 text-[12px]`,children:[(0,V.jsx)(`a`,{href:`/`,title:`All projects`,"aria-label":`All projects`,className:`${dW} -ml-px`,children:(0,V.jsx)(aw,{size:14,"aria-hidden":`true`})}),(0,V.jsx)(VK,{}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Settings`,title:`Settings`,className:dW,onClick:()=>Z.showSettings=!0,children:(0,V.jsx)(Cw,{size:14,"aria-hidden":`true`})}),(0,V.jsx)(BK,{}),n&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(VK,{}),(0,V.jsx)(pK,{})]}),(0,V.jsxs)(`span`,{className:`ml-auto flex min-w-0 items-center gap-1.5`,"data-project-identity-state":t.state,"aria-label":o,"aria-busy":t.state===`loading`||void 0,children:[(0,V.jsx)(HK,{state:e.connection,fallback:r}),i?(0,V.jsx)(`span`,{className:`block min-w-0 truncate font-semibold text-fg/90`,title:a,children:i}):(0,V.jsx)(`span`,{className:`identity-placeholder w-24`,"aria-hidden":`true`})]})]})}var WK=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),GK=`VisuallyHidden`,KK=B.forwardRef((e,t)=>(0,V.jsx)(eP.span,{...e,ref:t,style:{...WK,...e.style}}));KK.displayName=GK;var qK=KK,[JK,hte]=jN(`Tooltip`,[oL]),YK=oL(),XK=`TooltipProvider`,ZK=700,QK=`tooltip.open`,[$K,eq]=JK(XK),tq=e=>{let{__scopeTooltip:t,delayDuration:n=ZK,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=B.useRef(!0),s=B.useRef(!1),c=B.useRef(0);return B.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,V.jsx)($K,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:B.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:B.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:B.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};tq.displayName=XK;var nq=`Tooltip`,[rq,iq]=JK(nq),aq=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=eq(nq,e.__scopeTooltip),l=YK(t),[u,d]=B.useState(null),f=HP(),p=B.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=B.useRef(!1),[_,v]=RN({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(QK))):c.onClose(),a?.(e)},caller:nq}),y=B.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),b=B.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,v(!0)},[v]),x=B.useCallback(()=>{window.clearTimeout(p.current),p.current=0,v(!1)},[v]),S=B.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,v(!0),p.current=0},h)},[h,v]);return B.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,V.jsx)(SL,{...l,children:(0,V.jsx)(rq,{scope:t,contentId:f,open:_,stateAttribute:y,trigger:u,onTriggerChange:d,onTriggerEnter:B.useCallback(()=>{c.isOpenDelayedRef.current?S():b()},[c.isOpenDelayedRef,S,b]),onTriggerLeave:B.useCallback(()=>{m?x():(window.clearTimeout(p.current),p.current=0)},[x,m]),onOpen:b,onClose:x,disableHoverableContent:m,children:n})})};aq.displayName=nq;var oq=`TooltipTrigger`,sq=B.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=iq(oq,n),a=eq(oq,n),o=YK(n),s=AN(t,B.useRef(null),i.onTriggerChange),c=B.useRef(!1),l=B.useRef(!1),u=B.useCallback(()=>c.current=!1,[]);return B.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,V.jsx)(CL,{asChild:!0,...o,children:(0,V.jsx)(eP.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:DN(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:DN(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:DN(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:DN(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:DN(e.onBlur,i.onClose),onClick:DN(e.onClick,i.onClose)})})});sq.displayName=oq;var cq=`TooltipPortal`,[lq,uq]=JK(cq,{forceMount:void 0}),dq=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=iq(cq,t);return(0,V.jsx)(lq,{scope:t,forceMount:n,children:(0,V.jsx)(kL,{present:n||a.open,children:(0,V.jsx)(DL,{asChild:!0,container:i,children:r})})})};dq.displayName=cq;var fq=`TooltipContent`,pq=B.forwardRef((e,t)=>{let n=uq(fq,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=iq(fq,e.__scopeTooltip);return(0,V.jsx)(kL,{present:r||o.open,children:o.disableHoverableContent?(0,V.jsx)(vq,{side:i,...a,ref:t}):(0,V.jsx)(mq,{side:i,...a,ref:t})})}),mq=B.forwardRef((e,t)=>{let n=iq(fq,e.__scopeTooltip),r=eq(fq,e.__scopeTooltip),i=B.useRef(null),a=AN(t,i),[o,s]=B.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=B.useCallback(()=>{s(null),d(!1)},[d]),p=B.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Sq(r,xq(r,n.getBoundingClientRect())),a=Cq(t.getBoundingClientRect()),o=Tq([...i,...a]);s(o),d(!0)},[d]);return B.useEffect(()=>()=>f(),[f]),B.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),B.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!wq(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,V.jsx)(vq,{...e,ref:a})}),[hq,gq]=JK(nq,{isInside:!1}),_q=UN(`TooltipContent`),vq=B.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=iq(fq,n),l=YK(n),{onClose:u}=c;return B.useEffect(()=>(document.addEventListener(QK,u),()=>document.removeEventListener(QK,u)),[u]),B.useEffect(()=>{if(c.trigger){let e=e=>{e.target instanceof Node&&e.target.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,V.jsx)(fP,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,V.jsxs)(wL,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,V.jsx)(_q,{children:r}),(0,V.jsx)(hq,{scope:n,isInside:!0,children:(0,V.jsx)(qK,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});pq.displayName=fq;var yq=`TooltipArrow`,bq=B.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=YK(n);return gq(yq,n).isInside?null:(0,V.jsx)(TL,{...i,...r,ref:t})});bq.displayName=yq;function xq(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function Sq(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function Cq(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function wq(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function Tq(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),Eq(t)}function Eq(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Dq=tq,Oq=aq,kq=sq,Aq=dq,jq=pq,Mq=bq;function Nq({children:e}){return(0,V.jsx)(Dq,{delayDuration:0,skipDelayDuration:0,disableHoverableContent:!0,children:e})}function Pq({label:e,children:t,side:n=`top`,clickable:r=!1,multiline:i=!1,disabled:a=!1}){let o=i?`whitespace-pre-line`:`whitespace-normal`,[s,c]=(0,B.useState)(!1),l=(0,B.useId)(),u=r&&(0,B.isValidElement)(t)?t:null,d=u?(0,B.cloneElement)(u,{"aria-describedby":l}):t,f=(0,B.useRef)(null);if(u){let t=f.current?.getBoundingClientRect(),n=t?Math.min(Math.max(12,t.right+8),window.innerWidth-364):12,r=t?Math.min(Math.max(12,t.top-6),window.innerHeight-96):12;return(0,V.jsxs)(`span`,{ref:f,className:`inline-flex`,onMouseEnter:()=>c(!0),onMouseLeave:()=>c(!1),onFocus:()=>c(!0),onBlur:()=>c(!1),onClick:()=>c(e=>!e),onKeyDown:e=>{e.key===`Escape`&&(e.stopPropagation(),c(!1))},children:[d,s&&(0,Xd.createPortal)((0,V.jsx)(`span`,{id:l,role:`tooltip`,className:`z-[250] max-w-[min(22rem,calc(100vw-1.5rem))] rounded-md border border-border bg-elevated px-3 py-2 text-[11px] leading-relaxed text-fg shadow-md shadow-black/40 break-words ${o}`,style:{position:`fixed`,left:n,top:r},children:e}),document.body)]})}return(0,V.jsxs)(Oq,{open:s&&!a,onOpenChange:c,children:[(0,V.jsx)(kq,{asChild:!0,children:d}),(0,V.jsx)(Aq,{children:(0,V.jsxs)(jq,{id:l,side:n,sideOffset:5,collisionPadding:12,className:`${wV} max-w-[min(22rem,calc(100vw-1.5rem))] select-none rounded-md border border-border bg-elevated px-3 py-2 text-[11px] leading-relaxed text-fg shadow-md shadow-black/40 break-words ${o}`,children:[e,(0,V.jsx)(Mq,{className:`fill-elevated`})]})})]})}var Fq=Rf({at:{}}),Iq=12e3,Lq=new Map;function Rq(e,t=Date.now()){Fq.at[e]=t;let n=Lq.get(e);n!==void 0&&clearTimeout(n),Lq.set(e,setTimeout(()=>{Lq.delete(e),delete Fq.at[e]},Iq))}function zq(e){let t=Lq.get(e);t!==void 0&&(clearTimeout(t),Lq.delete(e)),delete Fq.at[e]}function Bq(e,t,n=Date.now()){if(t===void 0||n-t>12e3)return!1;let r=e.lastActivityAt?Date.parse(e.lastActivityAt):NaN;return!(Number.isFinite(r)&&r>t)}function Vq(){return Hf(Fq).at}function Hq(e,t,n=Date.now()){return t===void 0||!Bq(e,t,n)?e:{...e,runtime:`running`,needsYou:!1,pendingAsk:void 0,pendingQuestion:!1,actionableInteraction:!1,lastUserAt:new Date(t).toISOString()}}function Uq(e){let t=Vq();return(0,B.useMemo)(()=>e.map(e=>Hq(e,t[e.id])),[e,t])}var Wq=0;function Gq(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():(Wq+=1,`browser-${Date.now()}-${Wq}`)}function Kq({optimistic:e,request:t,success:n,failure:r}){e(),t().then(()=>n?.(),e=>r(e instanceof Error?e:Error(String(e))))}var qq=new Map;function Jq(e,t){let n=(qq.get(e)??Promise.resolve()).then(t,t);return qq.set(e,n.then(()=>{},()=>{})),n}var Yq=[300,800,1800,3500],Xq=e=>new Promise(t=>{setTimeout(t,e)});async function Zq(e,t,n=Xq){for(let r=0;;r++){try{await e()}catch(e){if(r>=Yq.length||!sS(e))throw e;t(),await n(Yq[r]);continue}t();return}}function Qq(e,t,n,r,i){return Zq(()=>X.followUp({slug:e,sessionId:sC(Z.board,e)?.sessionId??``,message:t,deliveryId:n,freshProcess:r,interrupt:i}),()=>Rq(e))}function $q(e,t,n,r={}){let i=n.trim();if(!i)return!1;let a=Gq();return Kq({optimistic:()=>{r.onOptimistic?.(),mj(e,t,i,{scrollToBottom:r.scrollToBottom,deliveryId:a}),Rq(t),X.markRead({slug:t}).catch(()=>{})},request:()=>Jq(t,()=>Qq(t,i,a,r.freshProcess,r.interrupt)),success:()=>r.onSuccess?.(),failure:n=>{hj(e,t,i,a),zq(t),r.onRollback?.(),Q(r.failureToast?.(n.message)??`Steer failed — ${n.message.slice(0,90)}`)}}),!0}function eJ(e){let t=Md(),[n,r]=(0,B.useState)(0);return{submit:(0,B.useCallback)((n,i={})=>$q(t,e,n,{...i,onOptimistic:()=>{r(e=>e+1),i.onOptimistic?.()},onSuccess:()=>{r(e=>Math.max(0,e-1)),i.onSuccess?.()},onRollback:()=>{r(e=>Math.max(0,e-1)),i.onRollback?.()}}),[t,e]),pending:n>0}}function tJ(e,t){return new Promise(n=>{$q(e,t,`Continue exactly where you left off.`,{onSuccess:()=>{Q(`Retrying…`),n()},onRollback:()=>n(),failureToast:e=>`Retry failed: ${e.slice(0,80)}`})||n()})}function nJ(e){let t=/^([A-Za-z0-9][\w.-]*)\/([A-Za-z0-9][\w.-]*)#(\d+)$/.exec(e.trim());return t?`https://github.com/${t[1]}/${t[2]}/pull/${t[3]}`:null}var rJ=`Snooze`;function iJ(e,t=Date.now()){return null}function aJ(e){let t=new Set;return e.flatMap(e=>{if(e.kind!==`pr`)return[];let n=e.value.trim();return!n||t.has(n)?[]:(t.add(n),[{ref:n,url:nJ(n)}])})}function oJ(e){let t=(e.body??``).split(/\n\s*\n/).map(e=>e.trim()).find(Boolean);return t?lJ(sJ(t.replace(/\s*\n\s*/g,` `))):null}function sJ(e){if(e.length<=cJ)return e;let t=e.slice(0,cJ),n=t.lastIndexOf(` `);return`${(n>cJ/2?t.slice(0,n):t).replace(/[.,;:]$/,``)}…`}var cJ=240;function lJ(e){let t=(e.split(/\s/,1)[0]??``).replace(/[.,:;]+$/,``);return/[^a-zA-Z]/.test(t)||/[A-Z]/.test(t.slice(1))||uJ.has(t)?e:e.charAt(0).toUpperCase()+e.slice(1)}var uJ=new Set([`npm`,`npx`,`pnpm`,`nub`,`nubx`,`gh`,`git`,`node`,`bun`,`tsc`,`vite`,`curl`,`ssh`]);function dJ(e){return mJ(e)||`Waiting for an external update.`}function fJ(e){return e&&mJ(e)||null}var pJ=new Set([...Py,`shells`,`agents`,`timers`,`prs`,`for`]);function mJ(e){return e.split(`
370
370
  `).filter(e=>{let t=/^\s*([a-z][a-z-]*):/i.exec(e)?.[1]?.toLowerCase();return!(t&&pJ.has(t))}).join(`
371
371
  `).trim()}function hJ(e){let t=[];for(let n of e){let e=n.value.trim();e&&(n.kind===`shell`?t.push(`shell ${e}`):n.kind===`agent`?t.push(`sub-agent ${e}`):n.kind===`timer`&&t.push(`a timer`))}return t}function gJ(e){let t=e.find(e=>e.kind===`for`)?.value.trim();return t?`for ${t}`:null}function _J(e){let t=t=>e.filter(e=>e.kind===t&&e.value.trim()).length,n=[...aJ(e).map(e=>e.ref),vJ(t(`shell`),`background shell`,`background shells`),vJ(t(`agent`),`sub-agent`,`sub-agents`),vJ(t(`timer`),`timer`,`timers`)].filter(e=>e!==null);return n.length>0?`waiting on ${yJ(n)}`:null}function vJ(e,t,n){return e<=0?null:e===1?`a ${t}`:`${e} ${n}`}function yJ(e){return e.length<=1?e.join(``):`${e.slice(0,-1).join(`, `)} and ${e[e.length-1]}`}function bJ(e){let t=e.find(e=>e.kind===`pr`);return t?`PR ${t.value}`:null}var xJ=Rf({at:{}}),SJ=12e3,CJ=new Map;function wJ(e,t=Date.now()){xJ.at[e]=t;let n=CJ.get(e);n!==void 0&&clearTimeout(n),CJ.set(e,setTimeout(()=>{CJ.delete(e),delete xJ.at[e]},SJ))}function TJ(e){let t=CJ.get(e);t!==void 0&&(clearTimeout(t),CJ.delete(e)),delete xJ.at[e]}function EJ(){return Hf(xJ).at}function DJ(e,t,n=Date.now()){return t===void 0||n-t>12e3||e.state===`archived`?e:{...e,state:`archived`,archived:!0,needsYou:!1,pendingAsk:void 0,pendingQuestion:!1,actionableInteraction:!1}}function OJ(e){let t=EJ();return(0,B.useMemo)(()=>e.map(e=>DJ(e,t[e.id])),[e,t])}var kJ=.5;function AJ(e,t,n=!1){let r=e.map(e=>({id:e.id,height:Math.max(0,e.bottom-e.top),visible:Math.min(e.bottom,t)-Math.max(e.top,0)})).filter(e=>e.visible>0);if(!r.length)return null;if(n)return r[r.length-1].id;let i=t*kJ,a=r[0];for(let e of r)if(e.visible>a.visible&&(a=e),e.visible>=Math.min(i,e.height)&&e.visible>=a.visible)return e.id;return a.id}function jJ(e,t,n,r){return!e||e.top<=r&&e.bottom>r?!0:Math.abs(t-n)>1}function MJ(e,t,n,r,i=8){return n<e+i?n-e-i:r>t-i?r-t+i:0}function NJ(){let e=Hf(Z),t=OJ(Uq(nj(ej()?.threads??[]))),n=kM(t,Hf(qj).queueOrder),r=uM(pM(t)),i=e.sidebarCollapsed,a=n.active,o=n.held,s=n.inactive,c=(0,B.useRef)(null),[l,u]=(0,B.useState)(null),d=(0,B.useRef)(null),f=(0,B.useCallback)(()=>{let e=[...document.querySelectorAll(`[data-queue-card][data-queue-leaving="false"]`)].map(e=>{let t=e.dataset.queueCard;if(!t)return null;let{top:n,bottom:r}=(e.querySelector(`[data-queue-card-root]`)??e).getBoundingClientRect();return{id:t,top:n,bottom:r}}).filter(e=>e!==null),t=d.current;if(t)if(jJ(e.find(e=>e.id===t.id),window.scrollY,t.landedY,12))d.current=null;else{u(t.id);return}let n=Math.max(0,document.documentElement.scrollHeight-window.innerHeight),r=n>0&&window.scrollY>=n-1,i=AJ(e,window.innerHeight,r);u(e=>e===i?e:i)},[]);(0,B.useEffect)(()=>{let e=0,t=()=>{cancelAnimationFrame(e),e=requestAnimationFrame(f)};t(),document.addEventListener(`scroll`,t,{capture:!0,passive:!0}),window.addEventListener(`resize`,t);let n=document.getElementById(`workpane`),r=n?new ResizeObserver(t):null,i=n?new MutationObserver(t):null;return n&&r?.observe(n),n&&i?.observe(n,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[`data-queue-card`,`data-queue-leaving`,`style`,`class`]}),()=>{cancelAnimationFrame(e),document.removeEventListener(`scroll`,t,!0),window.removeEventListener(`resize`,t),r?.disconnect(),i?.disconnect()}},[f,e.view,e.drawers.length]),(0,B.useLayoutEffect)(()=>{let e=c.current;if(!e||!l||window.matchMedia(`(max-width: 800px)`).matches)return;let t=e.querySelector(`[data-sidebar-item="${CSS.escape(l)}"]`);if(!t)return;let n=e.getBoundingClientRect(),r=t.getBoundingClientRect(),i=MJ(n.top,n.bottom,r.top,r.bottom);Math.abs(i)>.5&&(e.scrollTop+=i)},[l]);let p=(0,B.useCallback)(e=>{d.current={id:e,landedY:NS(e)??window.scrollY},u(e)},[]);return(0,V.jsx)(`aside`,{className:`sticky top-0 self-start h-screen w-[clamp(272px,34vw,680px)] shrink-0 flex flex-col justify-center max-[800px]:static max-[800px]:h-auto max-[800px]:w-full max-[800px]:justify-start max-[800px]:pt-16`,children:(0,V.jsxs)(`div`,{className:`flex max-h-[calc(100vh-32px)] min-h-0 min-w-0 w-full flex-col max-[800px]:max-h-none`,children:[(0,V.jsxs)(`div`,{className:`mb-5 shrink-0 px-0.5`,children:[(0,V.jsx)(UK,{}),(0,V.jsx)(cW,{})]}),(0,V.jsxs)(`div`,{ref:c,"data-sidebar-rail":!0,className:`min-h-0 min-w-0 overflow-y-auto overflow-x-hidden max-[800px]:overflow-y-visible`,children:[a.length>0?(()=>{let{running:e,rested:t}=OM(a),n=e=>t=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(RJ,{t,active:l===t.id,onQueueNavigate:p,restedAge:e}),(0,V.jsx)(VJ,{t})]},t.id);return(0,V.jsxs)(V.Fragment,{children:[t.map(n(!0)),e.length>0&&t.length>0&&(0,V.jsx)(`hr`,{className:`my-3 border-border/50`}),e.map(n(!1))]})})():(0,V.jsx)(`div`,{className:`py-1 pl-5 pr-1.5 text-[11.5px] text-muted/50`,children:`No open threads`}),o.length>0&&(0,V.jsxs)(`section`,{"aria-label":`Held`,children:[(0,V.jsx)(`hr`,{className:`my-3 border-border/50`}),(0,V.jsx)(PJ,{label:`Held`,count:o.length,collapsed:i.held,onToggle:()=>Z.sidebarCollapsed.held=!Z.sidebarCollapsed.held}),!i.held&&o.map(e=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(RJ,{t:e,active:l===e.id,onQueueNavigate:p}),(0,V.jsx)(VJ,{t:e})]},e.id))]}),s.length>0&&(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`hr`,{className:`my-3 border-border/50`}),(0,V.jsx)(PJ,{label:`Done`,count:s.length,collapsed:i.inactive,onToggle:()=>Z.sidebarCollapsed.inactive=!Z.sidebarCollapsed.inactive}),!i.inactive&&s.map(e=>(0,V.jsxs)(`div`,{children:[(0,V.jsx)(RJ,{t:e,active:l===e.id,onQueueNavigate:p}),(0,V.jsx)(VJ,{t:e})]},e.id))]}),r.length>0&&(0,V.jsxs)(`section`,{"aria-label":`External`,children:[(0,V.jsx)(`hr`,{className:`my-3 border-border/50`}),(0,V.jsx)(PJ,{label:`External`,count:r.length,collapsed:i.external,onToggle:()=>Z.sidebarCollapsed.external=!Z.sidebarCollapsed.external}),!i.external&&r.map(e=>(0,V.jsx)(RJ,{t:e,active:l===e.id,onQueueNavigate:p,restedAge:!0},e.id))]})]})]})})}function PJ({label:e,count:t,collapsed:n,onToggle:r}){let i=(0,V.jsxs)(V.Fragment,{children:[r?(0,V.jsx)(LC,{size:11,className:`transition-transform ${n?``:`rotate-90`}`}):(0,V.jsx)(`span`,{className:`w-[11px] shrink-0`,"aria-hidden":!0}),(0,V.jsx)(`span`,{children:e}),(0,V.jsx)(`span`,{className:`ml-1.5 tabular-nums text-muted/60`,children:t})]}),a=`flex w-full items-center gap-1 px-1.5 py-1 text-[11px] uppercase tracking-wide text-muted/70`;return r?(0,V.jsx)(`button`,{onClick:r,className:`${a} transition-colors hover:text-fg`,children:i}):(0,V.jsx)(`div`,{className:a,children:i})}var FJ=16,IJ=12;function LJ({title:e,children:t}){let n=e.trimEnd(),r=n.lastIndexOf(` `)+1,i=n.length-r<=FJ?r:n.length-IJ;return i>=n.length?(0,V.jsxs)(V.Fragment,{children:[e,t]}):(0,V.jsxs)(V.Fragment,{children:[n.slice(0,i),(0,V.jsxs)(`span`,{className:`whitespace-nowrap`,children:[n.slice(i),t]})]})}var RJ=(0,B.memo)(function({t:e,legacy:t,active:n=!1,onQueueNavigate:r,restedAge:i=!1}){let a=!t&&e.foreign===!0,o=!t&&vM(e),s=!t&&iM(e),c=!t&&wM(e);return(0,V.jsxs)(`div`,{"data-sidebar-item":e.id,className:`group relative flex min-w-0 items-start rounded-md transition-[color,background-color,opacity] hover:bg-white/[0.04] ${t?`opacity-80`:o?`opacity-65 hover:opacity-90 focus-within:opacity-90`:``}`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,"data-sidebar-marker-rail":!0,className:`pointer-events-none absolute inset-y-0 left-0 w-5`,children:n&&(0,V.jsx)(`span`,{"data-sidebar-scroll-marker":!0,className:`absolute inset-y-0 left-1 w-[2px] rounded-full bg-accent`})}),(0,V.jsxs)(`button`,{onClick:()=>{if(e.needsYou&&JS(e.id)){r?.(e.id);return}KS(e.id)},"aria-current":n?`location`:void 0,className:`min-w-0 flex-1 flex items-start gap-2 pb-1 pl-5 pr-1.5 pt-1 text-left`,children:[(0,V.jsx)(`span`,{className:`w-4 h-[19px] shrink-0 flex items-center justify-center`,children:(0,V.jsx)(KJ,{t:e,legacy:t})}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 flex flex-col`,children:(0,V.jsxs)(`span`,{className:`flex min-w-0 items-baseline gap-3`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 break-words text-[13px] leading-[19px] ${s?`text-fg/50`:o?`text-fg/75`:`text-fg/90`}`,children:(0,V.jsxs)(LJ,{title:Zj(e),children:[!t&&(0,V.jsx)(hW,{backend:e.backend,className:`ml-1`}),a&&(0,V.jsx)(`span`,{className:`petite-caps ml-1.5 inline-block rounded border border-border/60 px-1 align-[2px] text-[9.5px] leading-[14px] text-muted/55`,title:`Read-only — running in an external terminal`,children:`terminal`}),t&&(0,V.jsx)(HJ,{status:e.archived?`archived`:e.status})]})}),i&&(0,V.jsx)(zJ,{t:e,yieldsToRetry:c})]})})]}),t&&(0,V.jsx)(`div`,{className:`absolute right-1 top-1 hidden group-hover:flex items-stretch rounded-md bg-panel shadow-sm shadow-black/30`,children:(0,V.jsx)(AV,{slug:e.id,size:`sm`})}),c&&(0,V.jsx)(BJ,{slug:e.id})]})});function zJ({t:e,yieldsToRetry:t}){let n=UM(),r=cM(e),i=PM(r,n);return!r||!i?null:(0,V.jsx)(`time`,{dateTime:r,"data-rail-rested-age":!0,title:MM(r,n)??void 0,"aria-label":`Rested ${MM(r,n)??i}`,className:`shrink-0 tabular-nums text-[10.5px] leading-[19px] text-muted/55 ${t?`transition-opacity group-hover:opacity-0 group-focus-within:opacity-0`:``}`,children:i})}function BJ({slug:e}){let t=Md(),[n,r]=(0,B.useState)(!1);return(0,V.jsx)(Pq,{label:`Retry — resume this session where it left off`,children:(0,V.jsx)(`button`,{"data-sidebar-retry":e,"aria-label":`Retry exited session`,disabled:n,onMouseDown:e=>e.preventDefault(),onClick:n=>{n.stopPropagation(),r(!0),tJ(t,e).finally(()=>r(!1))},className:`absolute right-1.5 top-1 hidden h-[19px] w-[19px] items-center justify-center rounded bg-panel text-muted/70 outline-none transition-colors group-hover:flex group-focus-within:flex hover:bg-panel-2 hover:text-fg disabled:opacity-50`,children:n?(0,V.jsx)(dw,{size:13,className:`animate-spin`}):(0,V.jsx)(Sw,{size:13})})})}function VJ({t:e}){let t=xN(e.subAgents??[],`rail`);return t.length===0?null:(0,V.jsx)(`div`,{className:`flex flex-col`,children:t.map(t=>(0,V.jsx)(wN,{kind:`AGENT`,label:t.label,state:t.state,density:`rail`,depth:t.depth,startedAt:t.startedAt,parentSlug:e.id,onOpen:()=>WS(e.id,t.id,{label:t.label,subagentType:t.subagentType,startedAt:t.startedAt}),onDismiss:EN(e.id,t),title:t.subagentType?`[${t.subagentType}] ${t.label}`:t.label},t.id))})}function HJ({status:e}){let t=e===`archived`?`Done`:e;return(0,V.jsx)(`span`,{className:`petite-caps ml-1.5 inline-block rounded border px-1 align-[2px] leading-[14px] text-[9.5px] ${Xj[e]??`text-muted border-border`}`,children:t})}function UJ(e,t){return[[t,_J(e.lastFence?.kind===`awaiting`?e.lastFence.hints:[])].filter(e=>!!e).join(` — `),WJ(e)].filter(e=>!!e).join(`
372
372
 
@@ -477,7 +477,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),i=e,r=t),n===void 0&&(
477
477
  `)}`}function k0(e,t,n,r={}){let i=eJ(e),[a,o]=(0,B.useState)({}),s=(0,B.useMemo)(()=>E0(t),[t]),c=(0,B.useMemo)(()=>{for(let e=t.length-1;e>=0;e--)if(!(t[e].kind===`event`||t[e].kind===`reasoning`)&&t[e].role===`assistant`&&t[e].text.trim())return t[e]},[t]),l=(0,B.useMemo)(()=>D0(t)!==-1,[t]),u=iW(),d=aW(e),f=(0,B.useCallback)((t,n)=>rW.answer(u,e,d,t,n),[u,e,d]),p=(0,B.useMemo)(()=>s.flatMap(e=>e.blocks.map((t,n)=>f(e.identity,n))),[s,f]),m=sW(p),h=(0,B.useRef)(n);h.current=n;let g=(0,B.useCallback)((e,t)=>({...a[`${e}::${t}`]??{chosen:null,text:``},text:m.get(f(e,t))??``}),[a,m,f]),_=(0,B.useMemo)(()=>{let e=new Map;for(let t of s)e.set(t.identity,t);return e},[s]),v=(0,B.useCallback)((e,t,n)=>{let r=_.get(e)?.blocks[t],i=`${e}::${t}`;r?.kind!==`multi`&&tW.clear(f(e,t)),o(e=>{let t=e[i]??{chosen:null,text:``};if(r?.kind===`multi`){let r=new Set(t.chosenSet??[]);return r.has(n)?r.delete(n):r.add(n),{...e,[i]:{chosen:null,text:t.text,chosenSet:[...r].sort((e,t)=>e-t)}}}return{...e,[i]:{chosen:t.chosen===n?null:n,text:``}}})},[_,f]),y=(0,B.useCallback)((e,t,n)=>{let r=_.get(e)?.blocks[t];tW.set(f(e,t),n),o(i=>{let a=`${e}::${t}`,o=i[a]??{chosen:null,text:``};return r?.kind===`multi`?{...i,[a]:{chosen:null,text:n,chosenSet:o.chosenSet??[]}}:{...i,[a]:{chosen:null,text:n}}})},[_,f]),b=s.some(e=>e.blocks.some((t,n)=>T1(t,g(e.identity,n))!==``)),x=r.scrollToBottom!==!1,S=(0,B.useCallback)((e,t={})=>{i.submit(e,{...t,scrollToBottom:x})&&h.current?.()},[i,x]),C=(0,B.useCallback)(e=>{let t=typeof e==`string`?e:void 0,n=t?s.filter(e=>e.identity===t):s,r=t?n.flatMap(e=>e.blocks.map((t,n)=>f(e.identity,n))):p,i=n.flatMap(e=>e.blocks.map((t,n)=>`${e.identity}::${n}`)),c=(e,t)=>T1(e.blocks[t],g(e.identity,t)),l=n.flatMap(e=>e.blocks.map((t,n)=>({ask:e,bi:n,question:j0(t),answer:c(e,n)})).filter(e=>e.answer!==``));if(l.length===0)return;let u=n.find(e=>e.isLive),d=O0({answered:l.map(e=>({isLive:e.ask.isLive,question:e.question,answer:e.answer})),live:u&&{numbered:u.blocks.map((e,t)=>({n:t+1,a:c(u,t)})).filter(({a:e})=>e!==``)}}),m=a,h=r.map(e=>[e,tW.get(e)]);S(d,{onOptimistic:()=>{r.forEach(e=>tW.clear(e)),o(e=>{let t={...e};for(let e of i)delete t[e];return t})},onRollback:()=>{o(e=>{let t={...e};for(let e of i)m[e]?t[e]=m[e]:delete t[e];return t}),h.forEach(([e,t])=>{t&&!tW.get(e)&&tW.set(e,t)})}})},[a,s,g,S,p,f]),w=(0,B.useCallback)(e=>{let t=_.get(S0(e));if(t)return{answerFor:e=>g(t.identity,e),onChip:(e,n)=>v(t.identity,e,n),onText:(e,n)=>y(t.identity,e,n),onSubmit:()=>C(t.identity),anyAnswered:t.blocks.some((e,n)=>T1(e,g(t.identity,n))!==``),sending:i.pending}},[_,g,v,y,C,i.pending]);return{liveMsg:c,answering:(0,B.useMemo)(()=>c?w(c):void 0,[c,w]),answeringForMessage:w,answerable:l,anyAnswered:b,sending:i.pending,sendAnswers:C,sendMessage:S}}function A0(e){let t=e.split(`
478
478
  `).map(e=>e.trim()).find(e=>e.length>0)??``;return t.length>120?`${t.slice(0,117)}…`:t}function j0(e){return A0(e.contextMd)||A0(e.options.join(` / `))||`earlier question`}function M0(e){let t=2166136261;for(let n=0;n<e.length;n++)t=Math.imul(t^e.charCodeAt(n),16777619);return(t>>>0).toString(36)}function N0({raw:e,question:t,questionKind:n,danger:r,interactive:i,wrap:a}){let o=(0,B.useMemo)(()=>t??x1(e??``,n??`question`,r),[t,e,n,r]),s=o$(o.contextMd),c=e1(s),l=e1(o$(o.trailingMd??``)),u=o.recommendedIdx,d=e1(c$(o.recommendation??``)),f=o.kind===`multi`,p=o.danger,m=i?.answer.chosen??null,h=i?.answer.chosenSet??[],g=i?.answer.text??``,_=(0,B.useRef)(null);return(0,B.useLayoutEffect)(()=>{let e=_.current;e&&(e.style.height=`auto`,e.style.height=`${e.scrollHeight+e.offsetHeight-e.clientHeight}px`)},[g]),(0,V.jsxs)(J1,{tone:p?`danger`:`neutral`,icon:p?Mw:f?uw:UC,label:f?`Select multiple`:`Question`,children:[s&&(0,V.jsx)(`div`,{className:`text-fg`,children:(0,V.jsx)(`div`,{className:`md-body${a?` [overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`:``}`,dangerouslySetInnerHTML:c})}),(o.options.length>0||i)&&(0,V.jsxs)(`div`,{className:`mt-2 grid grid-cols-1 gap-1.5`,children:[o.options.map((e,t)=>(0,V.jsxs)(B.Fragment,{children:[o.optionHeadings?.[t]&&(0,V.jsx)(P0,{md:o.optionHeadings[t],wrap:a}),(0,V.jsx)(I0,{label:e,multi:f,recommended:u===t,recTitle:u===t?o.recommendedNote:void 0,selected:f?h.includes(t):m===t&&!g.trim(),disabled:!i,onClick:()=>{i?.onChip(t,e),!f&&_.current&&document.activeElement===_.current&&_.current.blur()}})]},t)),i&&(0,V.jsx)(`textarea`,{ref:_,rows:1,"data-surface":`questionAnswer`,value:g,onChange:e=>i.onText(e.target.value),onKeyDown:e=>{if(e.stopPropagation(),e.key===`Escape`){e.preventDefault(),e.currentTarget.blur();return}yH({key:e.key,altKey:e.altKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,shiftKey:e.shiftKey,isComposing:e.nativeEvent.isComposing,keyCode:e.nativeEvent.keyCode})&&(e.preventDefault(),i.onSubmit())},onFocus:()=>{!f&&m!==null&&i.onText(g)},placeholder:f?`Add a note…`:o.options.length?`${F0(o.options)} Something else…`:`Type your answer…`,className:`col-span-full w-full resize-none overflow-hidden rounded-md border px-3 py-1.5 text-[12px] leading-snug text-fg/90 outline-none placeholder:text-muted/80 transition-colors ${g.trim()?`border-accent bg-accent/10`:`border-border bg-transparent hover:bg-panel-2 focus:border-accent`}`})]}),o.trailingMd&&(0,V.jsx)(`div`,{className:`mt-2 md-body text-[12px] text-muted/70${a?` [overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`:``}`,dangerouslySetInnerHTML:l}),o.recommendation&&u===null&&(0,V.jsx)(`div`,{className:`md-inline mt-1.5 text-[11px] text-muted/70`,dangerouslySetInnerHTML:d})]})}function P0({md:e,wrap:t}){let n=e1(c$(e.split(`
479
479
  `).join(` `)));return(0,V.jsx)(`div`,{className:`mt-1 text-fg`,children:(0,V.jsx)(`div`,{className:`md-body${t?` ${B1}`:``}`,dangerouslySetInnerHTML:n})})}function F0(e){let t=e[e.length-1]?.match(/^\s*([A-Za-z]|\d+)([.)])\s/);if(!t)return`${String.fromCharCode(65+e.length)}.`;let[,n,r]=t;return/\d/.test(n)?`${Number(n)+1}${r}`:`${String.fromCharCode(n.toUpperCase().charCodeAt(0)+1)}${r}`}function I0({label:e,selected:t,disabled:n,multi:r,recommended:i,recTitle:a,onClick:o}){let s=e1(c$(e,{inertInteractive:!0}));return(0,V.jsxs)(`button`,{type:`button`,disabled:n,onClick:o,onMouseDown:e=>e.preventDefault(),title:a,className:`text-left rounded-md border px-3 py-1.5 text-[12px] leading-snug outline-none transition-colors flex items-start gap-2 ${t?`border-accent bg-accent/10 text-fg`:n?`cursor-default border-border text-muted/80`:`border-border text-fg/90 hover:bg-elevated hover:border-border-strong`}`,children:[r&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`mt-px flex h-3.5 w-3.5 shrink-0 items-center justify-center rounded-[3px] border ${t?`border-accent bg-accent text-bg`:`border-border-strong`}`,children:t&&(0,V.jsx)(PC,{size:10,strokeWidth:3})}),(0,V.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[i&&(0,V.jsx)(`span`,{className:`float-right ml-2 mt-px -translate-y-[2px] rounded-full border border-border-strong px-1.5 py-px text-[9.5px] uppercase tracking-wide text-muted`,children:`Recommended`}),(0,V.jsx)(`span`,{className:`md-inline`,dangerouslySetInnerHTML:s})]})]})}function L0({blocks:e,answering:t,onClose:n}){let[r,i]=(0,B.useState)(0),[a,o]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=requestAnimationFrame(()=>o(!0));return()=>cancelAnimationFrame(e)},[]),(0,B.useEffect)(()=>{let e=e=>{e.key===`Escape`&&(e.stopPropagation(),n())};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[n]);let s=e[Math.min(r,e.length-1)];if(!s)return null;let c=r>=e.length-1;return(0,Xd.createPortal)((0,V.jsxs)(`div`,{"data-mobile-answer-sheet":!0,className:`fixed inset-0 z-[80] flex flex-col justify-end`,children:[(0,V.jsx)(`button`,{"aria-label":`Close`,onClick:n,className:`absolute inset-0 bg-black/50 transition-opacity duration-200 ${a?`opacity-100`:`opacity-0`}`}),(0,V.jsxs)(`div`,{className:`relative flex max-h-[86%] flex-col overflow-hidden rounded-t-[14px] border-t border-border-strong bg-panel pb-[env(safe-area-inset-bottom)] shadow-[0_-20px_60px_-10px_rgba(0,0,0,0.8)] transition-transform duration-200 ease-out motion-reduce:transition-none ${a?`translate-y-0`:`translate-y-full`}`,children:[(0,V.jsx)(`div`,{className:`mx-auto mt-[6px] h-[5px] w-[36px] shrink-0 rounded-full bg-muted/35`}),(0,V.jsxs)(`div`,{className:`flex h-[48px] shrink-0 items-center gap-2 border-b border-border/70 px-3`,children:[(0,V.jsx)(`button`,{onClick:n,className:`flex h-[44px] items-center px-2 text-[16px] text-fg/85`,children:`Cancel`}),(0,V.jsx)(`span`,{className:`flex-1 text-center text-[15px] font-semibold tracking-[-0.01em] text-fg`,children:e.length>1?`Question ${r+1} of ${e.length}`:`Question`}),(0,V.jsx)(`span`,{className:`flex h-[44px] w-[44px] items-center justify-center`,children:(0,V.jsx)(Pw,{size:19,className:`opacity-0`,"aria-hidden":!0})})]}),(0,V.jsx)(`div`,{"data-mobile-answer-body":!0,className:`min-h-0 flex-1 overflow-y-auto px-3 py-3`,children:(0,V.jsx)(N0,{raw:s.raw,questionKind:s.kind,danger:s.danger,interactive:{answer:t.answerFor(s.bi),onChip:(e,n)=>t.onChip(s.bi,e,n),onText:e=>t.onText(s.bi,e),onSubmit:()=>c?l():i(e=>e+1)}},s.bi)}),(0,V.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-3 border-t border-border/70 px-4 pb-[30px] pt-3`,children:[e.length>1?(0,V.jsx)(`div`,{className:`flex items-center gap-1.5`,children:e.map((e,t)=>(0,V.jsx)(`span`,{className:`size-[6px] rounded-full ${t===r?`bg-accent`:`bg-muted/35`}`},e.bi))}):null,(0,V.jsxs)(`div`,{className:`flex w-full items-center gap-2`,children:[r>0?(0,V.jsx)(`button`,{onClick:()=>i(e=>e-1),className:`flex h-[50px] shrink-0 items-center justify-center rounded-[14px] border border-border-strong bg-elevated px-5 text-[17px] text-fg active:bg-panel-2`,children:`Back`}):null,(0,V.jsx)(`button`,{onClick:()=>c?l():i(e=>e+1),disabled:c?!t.anyAnswered||t.sending:!1,className:`flex h-[50px] flex-1 items-center justify-center rounded-[14px] bg-accent px-5 text-[17px] font-semibold text-bg transition-[filter,opacity] active:brightness-90 disabled:opacity-40`,children:c?t.sending?`Sending…`:`Send answers`:`Continue`})]})]})]})]}),document.body);function l(){t.onSubmit(),n()}}function R0(e){return(0,B.useSyncExternalStore)(e=>zf(Z,e),()=>e?z0(e)!==`codex`:!1,()=>!1)}function z0(e){return sC(Z.board,e)?.backend}function B0(e,t,n,r){let i=rW.followUp(e,t,n),a=tW.get(i),o=a?`${r}\n\n${a}`:r;return tW.set(i,o),i}function V0(e){if(!(typeof document>`u`)){for(let t=e;t;t=t.parentElement){let e=t.querySelector(`[data-thread-composer-box] textarea`);if(e){e.focus(),e.setSelectionRange(e.value.length,e.value.length);return}}document.getElementById(`followup-input`)?.focus()}}function H0(e){let t=Md(),n=iW(),[r,i]=(0,B.useState)(!1);return{unqueue:(0,B.useCallback)(a=>{if(!e||r)return;let o=sC(Z.board,e)?.sessionId;if(!o){Q(`This thread has no live session to unqueue from`);return}i(!0),X.unqueueFollowUp({slug:e,sessionId:o,deliveryId:a.deliveryId}).then(r=>{if(i(!1),!r.unqueued){Q(r.reason??`That message could not be taken back`);return}hj(t,e,a.rawText,a.deliveryId),B0(n,e,o,a.text),V0(a.from)},e=>{i(!1),Q(`Couldn't unqueue — ${(e instanceof Error?e.message:String(e)).slice(0,90)}`)})},[r,n,t,e]),pending:r}}function U0(e){return(0,B.useSyncExternalStore)(e=>zf(Z,e),()=>{if(!e)return!1;let t=sC(Z.board,e);return t?.backend!==`codex`&&t?.runtime===`running`},()=>!1)}function W0(e){let[t,n]=(0,B.useState)(!1);return{deliverNow:(0,B.useCallback)(()=>{if(!e||t)return;let r=sC(Z.board,e)?.sessionId;if(!r){Q(`This thread has no live session to interrupt`);return}n(!0),X.deliverQueuedNow({slug:e,sessionId:r}).then(e=>{n(!1),e.interrupted||Q(e.reason??`That message could not be pushed through`)},e=>{n(!1),Q(`Couldn't push it through — ${(e instanceof Error?e.message:String(e)).slice(0,90)}`)})},[t,e]),pending:t}}function G0(e){let t=e.trim();return!t||t.length>1024||/\s/.test(t)||/^[a-z][a-z0-9+.-]*:\/\//i.test(t)?!1:t===`~`||t.startsWith(`~/`)||t.startsWith(`/`)||t.includes(`/`)}var K0=new Map,q0=128;async function J0(e){let t=[...new Set(e)].filter(e=>!K0.has(e));if(!t.length)return!1;let n=[];for(let e=0;e<t.length;e+=q0)n.push(t.slice(e,e+q0));let r=await Promise.all(n.map(async e=>{try{return(await X.resolveLocalPaths({paths:e})).resolved}catch{return e.map(e=>({input:e,path:null}))}})),i=!1;for(let e of r)for(let t of e)K0.has(t.input)||(K0.set(t.input,t.path),i=!0);return i}function Y0(e,t){e.setAttribute(`data-local-path`,t),e.setAttribute(`title`,`Open ${t}`),e.classList.add(`local-file-code`)}function X0(e,t){let[n,r]=(0,B.useState)(0);(0,B.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let n=[];for(let e of t.querySelectorAll(`code`)){if(e.closest(`pre`))continue;let t=(e.textContent??``).trim();if(!G0(t))continue;let r=K0.get(t);r===void 0?n.push(t):r&&Y0(e,r)}n.length&&J0(n).then(e=>{e&&r(e=>e+1)})},[e,t,n])}function Z0(e){return e.displayText??e.text}function Q0(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.role===`user`&&!n.queued&&!n.peerFrom)return t}return-1}var $0=`icon-label-nudge`,e2=new Set([`planning`,`planned`,`active`,`needs-human`,`blocked`]);function t2(e){return!!(e&&e.kind===`legacy`&&!e.foreign&&e.runtime===`none`&&!e.sessionId&&!e.threadName&&!e.owner&&e.agents.length===0&&e.errors.length===0&&e2.has(e.status))}function n2(e,t){let n=e.trim();if(!(!n||n===t.trim()))return n}function r2(e,t){let n=e.trim();return!n||n===t||n===`Untitled thread`||n===`Spinning up a thread…`?``:n}function i2(e){return e.kind!==`session`||e.foreign||e.backend===`codex`?{show:!1,enabled:!1,label:``}:e.runtime===`turn-idle`?{show:!0,enabled:!0,label:`Rename with Claude`}:e.runtime===`perm-prompt`||e.pendingAsk?{show:!0,enabled:!1,label:`Resolve Claude's terminal prompt before renaming`}:e.runtime===`running`||e.runtime===`spawning`?{show:!0,enabled:!1,label:`Rename with Claude when the current turn finishes`}:{show:!0,enabled:!1,label:`Resume this Claude thread to use AI rename`}}var a2=`sticky top-0 z-10 flex min-w-0 shrink-0 items-center gap-2.5 border-b border-border bg-panel px-3 py-1.5 min-h-12 max-[640px]:flex-wrap max-[640px]:items-start max-[640px]:gap-y-2 max-[640px]:px-4 max-[640px]:py-2.5`,o2=`min-w-0 flex-1 pl-1 max-[640px]:basis-full`,s2=`flex shrink-0 items-center max-[640px]:w-full max-[640px]:justify-between`;function c2(e){return e?.trim()?{kind:`profile-error`,message:`Profile controls unavailable: ${e.trim().slice(0,160)}`}:null}function l2(e){if(e.foreign)return`Read-only external thread`;if(e.permissionChangePending||e.permissionPending)return`A permission change is already in progress`;if(e.profileChangePending)return`A model and effort change is already in progress`;if(e.runtimeControlPending)return`Another runtime control is already in progress`;if(e.pendingAsk||e.runtime===`perm-prompt`)return`Resolve the current terminal approval or question first`;if(e.backend===`codex`)return null;let t=[...e.subAgents??[],...e.bgShells??[]].filter(e=>e.state===`running`||e.state===`stale`).length;return t>0?`Wait for ${t} unresolved background operation${t===1?``:`s`}`:e.runtime===`running`||e.runtime===`spawning`?`Wait for the current turn to finish`:null}function u2(e){return e.permissionChangePending===!0||e.permissionPending!==void 0||e.profileChangePending===!0||e.runtimeControlPending===!0}function d2(e,t){let n=t===`codex`?`Sandbox`:`Permissions`;return e===`applied`?`${n} applied to the live session`:e===`next-turn`?t===`codex`?`${n} applied — takes effect on the next turn`:`${n} saved — the worker restarts on the next turn`:`${n} saved for the next resume`}function f2(e){return e===`right`?`pl-3 pr-7`:`pl-7 pr-3`}function p2(e,t,n,r){let i=(n?n.flatMap(e=>e.options):t??[]).find(t=>t.value===e);return i?{text:i.label,placeholder:!1}:e?{text:e,placeholder:!1}:{text:r??``,placeholder:!0}}var m2=`__frizz_empty_select_value__`,h2=e=>e===``?m2:e,g2=e=>e===m2?``:e,_2={ghost:`border-transparent bg-transparent hover:border-border hover:bg-panel-2 data-[state=open]:border-border data-[state=open]:bg-panel-2`,bordered:`w-full justify-between border-border bg-bg hover:bg-panel-2 data-[state=open]:bg-panel-2`,readout:`text-muted hover:text-fg border-border/50 bg-transparent hover:border-border hover:bg-panel-2 data-[state=open]:border-border data-[state=open]:bg-panel-2 [&_.select-caret]:text-fg/65 [&_.select-caret]:opacity-100`},v2={ghost:`border-transparent bg-transparent`,bordered:`w-full justify-between border-border bg-bg`,readout:`text-muted border-border/50 bg-transparent [&_.select-caret]:text-fg/65 [&_.select-caret]:opacity-100`};function y2({o:e,indicatorPosition:t,typography:n}){return(0,V.jsxs)(_V,{value:h2(e.value),title:e.title,className:`relative flex w-full min-w-0 cursor-pointer select-none items-center overflow-hidden rounded-md py-1.5 text-left text-[12px] text-muted outline-none data-[highlighted]:bg-panel-2 data-[highlighted]:text-fg data-[state=checked]:bg-panel-2 data-[state=checked]:font-medium data-[state=checked]:text-fg ${f2(t)} ${n??``}`,children:[(0,V.jsx)(vV,{className:`pointer-events-none absolute top-1/2 inline-flex -translate-y-1/2 items-center text-accent ${t===`right`?`right-2`:`left-2`}`,children:(0,V.jsx)(PC,{size:13})}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left`,children:e.label})]})}function b2({value:e,onValueChange:t,options:n,groups:r,placeholder:i,ariaLabel:a,title:o,disabled:s=!1,variant:c=`ghost`,indicatorPosition:l=`left`,side:u=`bottom`,className:d=``}){let f=p2(e,n,r,i),p=s?v2[c]:_2[c],m=c===`readout`?ZH:``,[h,g]=(0,B.useState)(!1),_=(0,B.useRef)(h),v=(0,B.useRef)(s),y=(0,B.useRef)(void 0);return _.current=h,v.current=s,(0,B.useLayoutEffect)(()=>{let e=e=>{e.key!==`Escape`||!_.current||v.current||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation(),_.current=!1,y.current?.(),y.current=void 0,g(!1))};return window.addEventListener(`keydown`,e,{capture:!0}),()=>window.removeEventListener(`keydown`,e,{capture:!0})},[]),(0,B.useLayoutEffect)(()=>{!s||!h||(_.current=!1,y.current?.(),y.current=void 0,g(!1))},[s,h]),(0,B.useLayoutEffect)(()=>()=>y.current?.(),[]),(0,V.jsxs)(lV,{modal:!1,open:h,onOpenChange:e=>{y.current?.(),y.current=void 0,_.current=e,g(e),e&&(y.current=hU(()=>{_.current=!1,y.current=void 0,g(!1)}))},children:[(0,V.jsx)(uV,{asChild:!0,disabled:s,children:(0,V.jsxs)(`button`,{type:`button`,"aria-label":a,title:o,className:`group inline-flex min-w-0 max-w-full items-center gap-1.5 rounded-md border px-2 py-1 text-left text-[12px] text-fg outline-none data-[placeholder]:text-muted ${s?`cursor-not-allowed opacity-45`:`cursor-pointer transition-colors`} ${p} ${c===`readout`?`select-trigger-readout`:``} ${m} ${d}`,children:[(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-left ${f.placeholder?`text-muted`:``}`,children:f.text}),(0,V.jsx)(FC,{className:`select-caret shrink-0 text-muted ${s?``:`transition-transform group-data-[state=open]:rotate-180`}`,size:13})]})}),(0,V.jsx)(dV,{children:(0,V.jsx)(fV,{align:`start`,side:u,sideOffset:5,onEscapeKeyDown:e=>e.stopPropagation(),className:`${SV} min-w-[var(--radix-dropdown-menu-trigger-width)] max-w-[calc(100vw-1rem)] overflow-hidden rounded-lg p-1 ${m}`,children:(0,V.jsx)(gV,{value:h2(e),onValueChange:e=>t(g2(e)),className:`max-h-[300px] min-w-0 overflow-y-auto`,children:r?r.map((e,t)=>(0,V.jsxs)(pV,{children:[e.label&&(0,V.jsx)(mV,{className:`${f2(l)} min-w-0 truncate pb-1 pt-2 text-left text-[10px] font-medium uppercase tracking-wide text-muted/60 first:pt-1`,children:e.label}),e.options.map(e=>(0,V.jsx)(y2,{o:e,indicatorPosition:l,typography:m},e.value))]},e.label||`g${t}`)):(n??[]).map(e=>(0,V.jsx)(y2,{o:e,indicatorPosition:l,typography:m},e.value))})})})]})}function x2(e,t,n,r){let i=e.find(e=>e.model===t),a=!!i,o=!!(i&&n&&i.efforts.includes(n)),s=a&&o;return{selectedProfile:i,modelKnown:a,effortKnown:o,profileKnown:s,modelSelectable:r||a,effortSelectable:!!i&&(r||s)}}function S2(e){let t=Hf(Z).board?.threads.find(t=>t.id===e),n=qd({queryKey:[`threadProfileOptions`,e],queryFn:()=>X.threadProfileOptions({slug:e}),enabled:!!(t&&!t.foreign&&t.kind===`session`),staleTime:5e3}),r=Jd({mutationFn:t=>X.setThreadProfile({slug:e,...t})}),i=Jd({mutationFn:t=>X.setThreadPermission({slug:e,permissionMode:t})}),a=r.isPending||i.isPending;if(!t||t.foreign||t.kind!==`session`)return{busy:a,footer:null,status:null};let o=a||u2(t),s=t.model?.trim(),c=t.effort?.trim(),l=t.backend===`codex`?`codex`:`claude`,u=r.isPending?r.variables:void 0,d=t.profilePendingModel??u?.model,f=t.profilePendingEffort??u?.effort,p=n.data?.options??[],{modelSelectable:m}=x2(p,s,c,t.runtime===`exited`),h=n.data!==void 0,g=[{id:l,label:l===`codex`?`Codex`:`Claude Code`,options:p}],_=c2(n.isError?n.error.message:void 0),v=t.permissionMode?NU(t.permissionMode):`auto`,y=jU.some(e=>e.value===v)?v:`auto`,b=i.isPending?i.variables:y,x=l2(t);function S(e){e!==y&&i.mutate(e,{onSuccess:e=>Q(d2(e.effect,`claude`)),onError:e=>Q(`Permission change failed: ${e.message.slice(0,120)}`)})}function C(e){r.mutate(e,{onSuccess:e=>Q(e.effect===`next-resume`?`Model and effort saved for the next resume`:`Model and effort applied`),onError:e=>Q(`Profile change failed: ${e.message.slice(0,120)}`)})}return{busy:o,footer:(0,V.jsxs)(`div`,{"data-thread-composer-controls":!0,className:`flex min-w-0 flex-1 flex-wrap items-center gap-x-1.5 gap-y-0.5`,children:[(0,V.jsx)(yU,{groups:g,value:{provider:l,model:s,effort:c},pending:d||f?{provider:l,model:d,effort:f}:void 0,onValueChange:({model:e,effort:t})=>C({model:e,effort:t}),placeholder:n.isPending?`Profile loading…`:`Profile unknown`,ariaLabel:`Thread model and effort`,menuAriaLabel:`Choose ${l===`codex`?`Codex`:`Claude Code`} model and effort`,title:m?t.runtime===`exited`?`Saved per thread and applied when this conversation resumes`:`Change this idle conversation's model and reasoning effort`:`The current live backend profile is unavailable; controls fail closed`,disabled:o||!h||!m||n.isError,compact:!0,side:`top`,className:`min-w-0 max-w-[min(72%,20rem)] px-1.5 py-0.5`}),l===`claude`&&(0,V.jsx)(b2,{variant:`readout`,side:`top`,value:b,onValueChange:e=>S(e),options:jU,ariaLabel:`Thread permission mode`,title:x?`${x} — changing permissions restarts this thread's worker process`:b===`bypassPermissions`?`Bypass: the worker never asks for approval. Changing this restarts the worker process; the conversation resumes from disk on the next turn.`:`Auto: risky actions raise an approval card here. Changing this restarts the worker process; the conversation resumes from disk on the next turn.`,disabled:o||x!==null,className:`shrink-0`}),d&&f&&(0,V.jsxs)(`span`,{className:`min-w-0 truncate text-[9px] text-muted/50`,children:[`→ `,d,` · `,f,` pending`]})]}),status:_?(0,V.jsx)(`div`,{"data-thread-control-error":``,className:`px-1 pt-1 text-[9.5px] leading-tight text-muted/65`,children:_.message}):null}}var C2=new Map;function w2(e){let t=C2.get(e);if(t)return t;let n=X.threadSkills({slug:e}).then(e=>e.skills,()=>(C2.delete(e),[]));return C2.set(e,n),n}function T2({slug:e,surface:t,placeholder:n,className:r,id:i,ops:a,submitOverride:o}){let s=Hf(Z).board?.threads.find(t=>t.id===e),c=iW(),l=rW.followUp(c,e,s?.sessionId),[u,d,f]=oW(l),p=S2(e),m=eJ(e),[h,g]=(0,B.useState)(null),_=(0,B.useMemo)(()=>()=>w2(e),[e]),[v,y]=(0,B.useState)(null),b=!o&&s?.runtime===`running`&&s.backend!==`codex`;function x(e=!1){let t=u.trim();if(!t)return;let n=wU(t);if(n){f();let e=s?.backend===`codex`?`codex`:`claude`;n===`login`?g(e):y(e);return}let r={onOptimistic:f,onRollback:()=>{tW.get(l)||d(u)}};o?o(t,r):m.submit(t,{...r,interrupt:e})}return(0,V.jsxs)(`div`,{"data-thread-composer-box":t,...t===`chatComposer`?{"data-thread-action-bar":``}:{},className:r,children:[(0,V.jsx)(KH,{id:i,surface:t,value:u,onChange:d,onSubmit:()=>x(),onInterruptSubmit:b?()=>x(!0):void 0,slashSuggest:_,placeholder:n,busy:p.busy,footer:p.footer}),p.status,(0,V.jsx)(`div`,{className:`ops-column-optical-inset empty:hidden`,children:a}),h&&(0,V.jsx)(EU,{backend:h,onClose:()=>g(null),onAuthed:()=>g(null)}),v&&(0,V.jsx)(DU,{backend:v,onClose:()=>y(null)})]})}function E2({slug:e,ops:t}){let n=Hf(Z).board?.threads.find(t=>t.id===e);return n?(0,V.jsx)(T2,{slug:e,surface:`chatComposer`,id:`followup-input`,placeholder:n.foreign?`Send a message to take over this session…`:`Follow up…`,className:`shrink-0 px-3 py-3`,ops:t}):null}function D2({thread:e,openHref:t,onDoc:n,onDone:r,onCollapse:i,collapsed:a,doneBusy:o,onStatusMutate:s,onStatusApplied:c,onStatusFailed:l}){let u=e.kind===`session`;return(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center gap-0.5`,children:[i&&(0,V.jsx)(A2,{label:a?`Expand`:`Collapse`,icon:a?zC:RC,size:13,onClick:i}),n&&(0,V.jsx)(A2,{label:`Frizz document`,icon:XC,size:14,onClick:n}),t&&(0,V.jsx)(j2,{label:`Open in new tab`,icon:kC,size:14,href:t}),u?wM(e)?(0,V.jsx)(O2,{slug:e.id}):null:(0,V.jsx)(`div`,{className:`ml-1`,children:(0,V.jsx)(AV,{slug:e.id,onDone:r,doneBusy:o,onMutateStart:s,onApplied:c,onFailed:l})})]})}function O2({slug:e}){let t=Md(),[n,r]=(0,B.useState)(!1);return(0,V.jsx)(Pq,{label:`Retry — resume this session where it left off`,children:(0,V.jsxs)(`button`,{onClick:()=>{r(!0),tJ(t,e).finally(()=>r(!1))},disabled:n,"aria-label":`Retry exited session`,onMouseDown:e=>e.preventDefault(),className:`ml-1 flex items-center gap-1.5 rounded-md border border-accent/45 bg-accent/10 px-2.5 py-1 text-[12px] font-medium text-accent outline-none transition-colors hover:border-accent/70 hover:bg-accent/15 disabled:opacity-50`,children:[n?(0,V.jsx)(dw,{size:12,className:`animate-spin`}):(0,V.jsx)(Sw,{size:12}),`Retry`]})})}var k2=`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:hover:bg-transparent disabled:hover:text-muted disabled:opacity-40`;function A2({label:e,icon:t,size:n,busy:r,...i}){return(0,V.jsx)(Pq,{label:e,children:(0,V.jsx)(`button`,{...i,"aria-label":e,onMouseDown:e=>e.preventDefault(),className:k2,children:r?(0,V.jsx)(dw,{size:n,strokeWidth:2,className:`animate-spin`}):(0,V.jsx)(t,{size:n,strokeWidth:2})})})}function j2({label:e,icon:t,size:n,href:r}){return(0,V.jsx)(Pq,{label:e,children:(0,V.jsx)(`a`,{href:r,target:`_blank`,rel:`noopener`,"aria-label":e,onMouseDown:e=>e.preventDefault(),className:k2,children:(0,V.jsx)(t,{size:n,strokeWidth:2})})})}function M2(e){let t=e.kind===`session`&&e.foreign!==!0,n=t&&(e.state===`archived`||e.archived===!0),r=t,i=t&&!n;return{footer:r,done:n,snooze:i,archive:i}}function N2(e){if(e.runtime===`perm-prompt`||e.pendingAsk)return!0;if(e.runtime===`running`||e.runtime===`spawning`)return!1;let t=e=>e.state===`running`||e.state===`stale`;return!(e.subAgents?.some(e=>Oy(e)&&t(e))||e.bgShells?.some(t))}function P2(e){let t={lead:`This thread is still running.`,groups:[],trailer:`Marking it done will stop its agent session, then move it to Done.`};if(!e)return t;let n=[F2(`agent`,`sub-agent`,e.subAgents,e.subAgentCount),F2(`shell`,`background shell`,e.bgShells,e.bgShellCount)].filter(e=>e!==null);return e.unobservable?{lead:`This session is live, but its transcript can’t be read right now — it may still be working.`,groups:n,trailer:`Marking it done will stop the session anyway, then move it to Done.`}:!e.turnInFlight&&n.length===0?t:{lead:e.turnInFlight?n.length>0?`The agent is mid-turn, and it still owns background work:`:`The agent is mid-turn — it’s executing right now.`:`The agent is resting, but the background work it launched is still running:`,groups:n,trailer:n.length>0?`Marking it done will stop the session and everything running under it, then move it to Done.`:`Marking it done will stop its agent session mid-turn, then move it to Done.`}}function F2(e,t,n,r){let i=Math.max(r,n.length);return i===0?null:{kind:e,heading:`${i} ${t}${i===1?``:`s`}`,items:n.map(e=>({label:e.label,stale:e.state===`stale`})),overflow:Math.max(0,i-n.length)}}function I2({open:e,onOpenChange:t,title:n,children:r,footer:i,className:a=`w-[640px] max-w-[92vw] max-h-[82vh]`}){return(0,V.jsx)(FV,{open:e,onOpenChange:t,children:(0,V.jsxs)(VV,{children:[(0,V.jsx)(UV,{className:`overlay-in fixed inset-0 z-[200] bg-black/55 backdrop-blur-[1px]`}),(0,V.jsxs)(qV,{"aria-modal":`true`,onEscapeKeyDown:_U,className:`pop-in fixed left-1/2 top-1/2 z-[200] flex -translate-x-1/2 -translate-y-1/2 flex-col overflow-hidden rounded-xl border border-border bg-panel shadow-2xl shadow-black/50 outline-none ${a}`,children:[(0,V.jsxs)(`header`,{className:`flex h-11 shrink-0 items-center gap-2 border-b border-border px-4`,children:[(0,V.jsx)(QV,{className:`min-w-0 flex-1 truncate text-[13px] font-medium`,children:n}),(0,V.jsx)(nH,{type:`button`,"aria-label":`Close`,className:`rounded-md p-1 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,V.jsx)(Pw,{size:15})})]}),(0,V.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:r}),i&&(0,V.jsx)(`footer`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-border px-4 py-3`,children:i})]})]})})}function L2({thread:e,onSnoozed:t}){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(``),f=(0,B.useId)(),p=(0,B.useId)(),m=(0,B.useId)(),h=_M(e),g=Hf(qj).snoozePreset,_=Oj(g),v=Aj(g),y=(0,B.useMemo)(()=>Nj(new Date(Date.now()+6e4)),[i]);async function b(n,i=null){r(!0);try{await X.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:n,prompt:n?i:null}),n?(Q(`${i?`Bump scheduled`:`Snoozed`} · ${Fj(n)}`),t?.()):Q(`Snooze cleared`),a(!1),d(``)}catch(e){let t=e instanceof Error?e.message:`Snooze failed`;Q(t.slice(0,100)),d(t)}finally{r(!1)}}function x(e){qj.snoozePreset=e,b(jj(e))}function S(){s(Nj(new Date(h??jj(g)))),l(e.snoozePrompt??``),d(``),a(!0)}function C(){let e=Pj(o);if(!e.ok){d(e.message);return}let t=c.trim();if(t.length>4e3){d(`Prompt is too long (${t.length}/${Vy})`);return}b(e.until,t||null)}return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`div`,{className:`inline-flex items-stretch rounded-md border border-border-strong bg-panel-2/60`,children:[(0,V.jsxs)(`button`,{type:`button`,disabled:n,"aria-label":h?`Wake thread now`:v,title:h?`Wake now · ${Fj(h)}`:v,onClick:()=>void b(h?null:jj(g)),className:`flex items-center gap-1.5 rounded-l-md px-2.5 py-1 text-[12px] font-medium text-fg/75 outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-not-allowed disabled:opacity-45`,children:[n&&(0,V.jsx)(dw,{size:12,className:`animate-spin`}),h?`Wake now`:v]}),(0,V.jsx)(`span`,{"aria-hidden":!0,className:`my-1 w-px bg-border`}),(0,V.jsxs)(TV,{children:[(0,V.jsx)(EV,{asChild:!0,children:(0,V.jsx)(`button`,{type:`button`,disabled:n,"aria-label":`Snooze options`,title:`Selected snooze: ${_}`,className:`flex min-w-0 items-center justify-center gap-1 rounded-r-md px-2 text-fg/75 outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-not-allowed disabled:opacity-45`,children:(0,V.jsx)(FC,{size:12})})}),(0,V.jsxs)(DV,{align:`end`,children:[Tj.map(e=>(0,V.jsx)(OV,{onSelect:()=>x(e.value),icon:(0,V.jsx)(KC,{size:12}),children:(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center justify-between gap-4`,children:[(0,V.jsx)(`span`,{children:e.label}),(0,V.jsx)(`span`,{className:`text-[10px] text-muted/55`,children:e.detail})]})},e.value)),(0,V.jsx)(kV,{}),(0,V.jsx)(OV,{onSelect:S,children:`Custom time & prompt…`}),h&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(kV,{}),(0,V.jsx)(OV,{onSelect:()=>void b(null),children:`Wake now`})]})]})]})]}),(0,V.jsx)(I2,{open:i,onOpenChange:e=>{n||a(e)},title:`Snooze thread`,className:`w-[360px] max-w-[92vw]`,footer:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,disabled:n,onClick:()=>a(!1),className:`rounded-md px-3 py-1.5 text-[12px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-45`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`submit`,form:m,disabled:n,className:`flex items-center gap-1.5 rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-opacity hover:opacity-90 disabled:opacity-45`,children:[n&&(0,V.jsx)(dw,{size:12,className:`animate-spin`}),c.trim()?`Snooze & bump`:`Snooze`]})]}),children:(0,V.jsxs)(`form`,{id:m,className:`flex flex-col gap-2.5 p-4`,onSubmit:e=>{e.preventDefault(),C()},children:[(0,V.jsx)(`label`,{htmlFor:f,className:`text-[11px] font-medium text-muted`,children:`Wake at this local time`}),(0,V.jsx)(`input`,{id:f,type:`datetime-local`,required:!0,min:y,value:o,onChange:e=>{s(e.target.value),d(``)},className:`w-full rounded-md border border-border bg-bg px-2.5 py-2 text-[13px] text-fg outline-none focus:border-accent`}),(0,V.jsx)(`p`,{className:`text-[10.5px] text-muted/65`,children:`Stored as an exact instant; shown here in your browser’s local time zone.`}),(0,V.jsxs)(`label`,{htmlFor:p,className:`mt-1 text-[11px] font-medium text-muted`,children:[`Then send this prompt `,(0,V.jsx)(`span`,{className:`font-normal text-muted/55`,children:`(optional)`})]}),(0,V.jsx)(`textarea`,{id:p,autoFocus:!0,rows:3,maxLength:Vy,placeholder:`e.g. Check whether CI went green and land it if so.`,value:c,onChange:e=>{l(e.target.value),d(``)},onKeyDown:e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),C())},className:`w-full resize-y rounded-md border border-border bg-bg px-2.5 py-2 text-[13px] leading-5 text-fg outline-none placeholder:text-muted/40 focus:border-accent`}),(0,V.jsx)(`p`,{className:`min-h-4 text-[10.5px] text-muted/65`,children:c.trim()?`frizz will resume this thread with the prompt at the wake time.`:`Leave empty to just bring the card back to your queue.`}),u&&(0,V.jsx)(`p`,{role:`alert`,className:`text-[11px] text-red-400`,children:u})]})})]})}function R2(e,t){return new Promise(n=>{$q(e,t,`Your worker process was restarted so it picks up frizz's current tooling (hooks and worker contract). Re-read whatever you left in your scratch directory, then continue exactly where you left off.`,{freshProcess:!0,onSuccess:()=>{Q(`Restarting worker…`),n()},onRollback:()=>n(),failureToast:e=>`Restart failed: ${e.slice(0,80)}`})||n()})}var z2=null,B2=null;function V2(){return z2===null?(B2??=TK().then(e=>e===null?!1:(z2=wK(e),z2)).catch(()=>!1).finally(()=>{B2=null}),B2):Promise.resolve(z2)}function H2(){let[e,t]=(0,B.useState)(z2===!0);return(0,B.useEffect)(()=>{if(z2!==null){t(z2);return}let e=!0;return V2().then(n=>{e&&t(n)}),()=>{e=!1}},[]),e}function U2({thread:e}){let t=Md(),[n,r]=(0,B.useState)(!1);return!H2()||e.kind!==`session`||e.foreign||e.backend===`codex`||e.runtime===`exited`?null:(0,V.jsx)(Pq,{label:`Restart worker — same conversation, fresh process on current tooling`,side:`top`,children:(0,V.jsx)(`button`,{type:`button`,disabled:n,"aria-label":`Restart worker`,onMouseDown:e=>e.preventDefault(),onClick:()=>{r(!0),R2(t,e.id).finally(()=>r(!1))},className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-fg/55 outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-not-allowed disabled:opacity-45 ${DH}`,children:n?(0,V.jsx)(dw,{size:12,className:`animate-spin`}):(0,V.jsx)(bw,{size:12})})})}function W2({thread:e}){let[t,n]=(0,B.useState)(!1);if(e.kind!==`session`||e.foreign||e.claudeRuntime!==`broker`||e.runtime===`exited`)return null;async function r(){n(!0);try{let t=await X.reloadThreadPlugins({slug:e.id,sessionId:e.sessionId??``}),n=[`${t.plugins} plugin${t.plugins===1?``:`s`}`,`${t.commands} skill${t.commands===1?``:`s`}`,`${t.agents} agent${t.agents===1?``:`s`}`],r=t.mcpServers.length?` · MCP: ${t.mcpServers.join(`, `)}`:``,i=t.errorCount?` · ${t.errorCount} load error${t.errorCount===1?``:`s`}`:``;Q(`Reloaded ${n.join(`, `)}${r}${i}`)}catch(e){Q((e instanceof Error?e.message:`Plugin reload failed`).slice(0,120))}finally{n(!1)}}return(0,V.jsx)(Pq,{label:`Reload plugins — hooks, skills, agents and MCP re-read from disk, same conversation`,side:`top`,children:(0,V.jsx)(`button`,{type:`button`,"data-reload-plugins":!0,disabled:t,"aria-label":`Reload plugins`,onMouseDown:e=>e.preventDefault(),onClick:()=>void r(),className:`flex size-6 items-center justify-center rounded-md text-fg/55 hover:bg-panel-2 hover:text-fg/80 disabled:opacity-50 ${EH}`,children:(0,V.jsx)(_w,{size:13})})})}var G2=1.25,K2=7.5-G2/2,q2=2*Math.PI*K2;function J2(e,t){return Math.max(0,Math.min(100,Math.floor(e/t*100)))}function Y2({thread:e}){let t=e.context;if(!t||t.window<=0)return null;let n=J2(t.tokens,t.window),r=Math.max(0,Math.min(1,t.tokens/t.window)),i=`Context ${n}% full\n${t.tokens.toLocaleString()} of ${t.window.toLocaleString()} tokens`;return(0,V.jsx)(Pq,{label:i,side:`top`,multiline:!0,children:(0,V.jsx)(`span`,{"data-context-meter":!0,"data-context-percent":n,"aria-label":i,className:`flex shrink-0 items-center text-muted/60`,children:(0,V.jsxs)(`svg`,{viewBox:`0 0 16 16`,className:`h-[1.05em] w-[1.05em]`,"aria-hidden":!0,style:{transform:`rotate(-90deg)`},children:[(0,V.jsx)(`circle`,{cx:`8`,cy:`8`,r:K2,fill:`none`,stroke:`currentColor`,strokeOpacity:.3,strokeWidth:G2}),(0,V.jsx)(`circle`,{cx:`8`,cy:`8`,r:K2,fill:`none`,stroke:`currentColor`,strokeWidth:G2,strokeDasharray:`${q2*r} ${q2}`})]})})})}var X2={sm:{track:`h-[16px] w-[28px]`,thumb:`size-[12px]`,travel:`translate-x-[12px]`,onCap:`translate-y-[calc(6px_-_0.5cap)]`},md:{track:`h-[20px] w-[34px]`,thumb:`size-[16px]`,travel:`translate-x-[14px]`,onCap:`translate-y-[calc(8px_-_0.5cap)]`}};function Z2({checked:e,onChange:t,disabled:n,label:r,size:i=`sm`,testId:a}){let o=X2[i];return(0,V.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-label":r,disabled:n,"data-switch":a,"data-state":e?`checked`:`unchecked`,onMouseDown:e=>e.preventDefault(),onClick:()=>t(!e),className:`inline-flex shrink-0 cursor-pointer items-center self-baseline rounded-full p-[2px] outline-none transition-colors focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-default disabled:opacity-45 ${o.track} ${o.onCap} ${e?`bg-fg`:`bg-border hover:bg-border-strong`}`,children:(0,V.jsx)(`span`,{className:`pointer-events-none block rounded-full transition-transform duration-150 ease-out ${o.thumb} ${e?`bg-bg ${o.travel}`:`translate-x-0 bg-muted/70`}`})})}function Q2({size:e=12,className:t=``}){return(0,V.jsxs)(`svg`,{width:e,height:e,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:2,strokeLinecap:`round`,strokeLinejoin:`round`,className:t,"aria-hidden":`true`,children:[(0,V.jsx)(`path`,{d:`M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0`}),(0,V.jsx)(`path`,{d:`M12 7a5 5 0 1 0 5 5`}),(0,V.jsx)(`path`,{d:`M13 3.055a9 9 0 1 0 7.941 7.945`}),(0,V.jsx)(`path`,{d:`M15 6v3h3l3 -3h-3v-3l-3 3`}),(0,V.jsx)(`path`,{d:`M15 9l-3 3`})]})}function $2({thread:e}){let[t,n]=(0,B.useState)(`closed`),r=(0,B.useRef)(null),i=(0,B.useRef)(void 0);(0,B.useEffect)(()=>()=>clearTimeout(i.current),[]);let a=e.recurringPrompt,o=a?.stopHook===!0||a?.heartbeat===!0||a?.postCompaction===!0;function s(){clearTimeout(i.current),i.current=setTimeout(()=>n(e=>e===`closed`?`preview`:e),e4)}function c(){clearTimeout(i.current),n(e=>e===`preview`?`closed`:e)}let l=e=>{r.current?.contains(e.detail.originalEvent.target)&&e.preventDefault()};return(0,V.jsxs)(nK,{open:t!==`closed`,onOpenChange:e=>{e||(clearTimeout(i.current),n(`closed`))},children:[(0,V.jsx)(iK,{asChild:!0,children:(0,V.jsx)(`button`,{ref:r,type:`button`,"data-recurring-prompt":!0,"data-recurring-prompt-on":o?`true`:`false`,"aria-label":o?`Goal (on)`:`Goal`,"aria-haspopup":`dialog`,"aria-expanded":t===`full`,onClick:()=>{clearTimeout(i.current),n(e=>e===`full`?`closed`:`full`)},onPointerEnter:e=>{e.pointerType===`mouse`&&s()},onPointerLeave:e=>{e.pointerType===`mouse`&&c()},onFocus:()=>n(e=>e===`closed`?`preview`:e),onBlur:c,className:`flex items-center rounded-md px-0.5 py-0.5 outline-none ${TH}`,children:(0,V.jsx)(Q2,{size:12,className:o?`text-amber-400/90`:`text-muted/60 hover:text-muted`})})}),t===`preview`?(0,V.jsx)(aK,{side:`top`,align:`start`,"data-recurring-preview":!0,onPointerDownOutside:l,className:`pointer-events-none max-w-[min(22rem,calc(100vw-1.5rem))] p-2.5 text-[11px] leading-snug text-fg`,onOpenAutoFocus:e=>e.preventDefault(),children:(0,V.jsx)(t4,{armed:a})}):(0,V.jsx)(aK,{side:`top`,align:`start`,className:`w-[min(46rem,calc(100vw-1.5rem))] p-3 text-[11px] leading-relaxed text-fg`,onPointerDownOutside:l,onOpenAutoFocus:e=>e.preventDefault(),children:(0,V.jsx)(u4,{thread:e,armed:a})})]})}var e4=260;function t4({armed:e}){let t=e?.prompt?.trim(),n=e?l4({stopHook:e.stopHook===!0,heartbeat:e.heartbeat===!0,postCompaction:e.postCompaction===!0,seconds:e.intervalSeconds??i4}):[];return(0,V.jsxs)(`div`,{"data-recurring-preview-body":!0,children:[(0,V.jsxs)(`div`,{className:`mb-1 flex items-baseline gap-2`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Goal`}),(0,V.jsx)(`span`,{className:`text-muted/70`,children:n.length>0?`sent ${n.join(`, `)}`:t?`no trigger is on`:`not set`})]}),(0,V.jsx)(`p`,{className:`line-clamp-4 whitespace-pre-wrap ${t?`text-fg/90`:`text-muted`}`,children:t||`Click to write what this thread is trying to achieve.`})]})}var n4=1,r4=1440,i4=600;function a4(e,t){if(e===String(Math.round(t/60)))return t;let n=Math.round(Number(e));return Number.isFinite(n)&&n>0?Math.min(r4,Math.max(n4,n))*60:t}var o4=null;function s4(e){return{prompt:e.text.trim(),stopHook:e.stopHook,heartbeat:e.heartbeat,postCompaction:e.postCompaction,seconds:e.seconds}}function c4(e,t){return!e.archived&&!t}function l4(e){return[e.stopHook?`at every rest`:null,e.heartbeat?`every ${Math.round(e.seconds/60)} min`:null,e.postCompaction?`after every compaction`:null].filter(e=>e!==null)}function u4({thread:e,armed:t}){let n=c4(e,t)?Ky:``,r=o4?.slug===e.id?o4.draft:null,[i,a]=(0,B.useState)(r?.text??t?.prompt??n),[o,s]=(0,B.useState)(r?.stopHook??t?.stopHook??!1),[c,l]=(0,B.useState)(r?.heartbeat??t?.heartbeat??!1),[u,d]=(0,B.useState)(r?.postCompaction??t?.postCompaction??!1),[f,p]=(0,B.useState)(r?.seconds??t?.intervalSeconds??i4),m=o||c||u,[h,g]=(0,B.useState)(String(Math.round((r?.seconds??t?.intervalSeconds??i4)/60))),_=(0,B.useRef)(null),v=(0,B.useRef)({prompt:t?.prompt??n,stopHook:t?.stopHook??!1,heartbeat:t?.heartbeat??!1,postCompaction:t?.postCompaction??!1,seconds:t?.intervalSeconds??i4}),y=e=>({text:i,stopHook:o,heartbeat:c,postCompaction:u,seconds:a4(h,f),...e}),b=(0,B.useRef)(y());b.current=y();let x=(0,B.useRef)(()=>Promise.resolve(!0));x.current=e=>C(e),(0,B.useEffect)(()=>()=>{x.current(b.current)},[]);let S=(0,B.useRef)(Promise.resolve(!0));function C(t){let n=S.current.catch(()=>!1).then(async()=>{let n=await w(t);return n?o4?.slug===e.id&&(o4=null):o4={slug:e.id,draft:t},n});return S.current=n,n}async function w(n){let r=n.text.trim()||null;if(r===(v.current.prompt||null)&&n.stopHook===v.current.stopHook&&n.heartbeat===v.current.heartbeat&&n.postCompaction===v.current.postCompaction&&n.seconds===v.current.seconds)return!0;if(r===null&&!t)return v.current={...s4(n),prompt:``},!0;try{await X.setThreadRecurringPrompt({slug:e.id,sessionId:e.sessionId??``,prompt:r,stopHook:n.stopHook,heartbeat:n.heartbeat,postCompaction:n.postCompaction,...r===null?{}:{intervalSeconds:n.seconds}}),v.current={...s4(n),prompt:r??``};let t=l4(n);Q(r===null?`Goal cleared`:t.length===0?`Goal saved — no trigger is on, so nothing is sent`:`Goal: sent ${t.join(`, `)}`)}catch(e){return Q((e instanceof Error?e.message:`Could not save the recurring prompt`).slice(0,100)),!1}return!0}let T=()=>void C(y());function E(){let e=a4(h,f);g(String(Math.round(e/60))),p(e),C(y({seconds:e}))}let D=[{at:t?.lastRestFiredAt,how:`at rest`},{at:t?.lastScheduleFiredAt,how:`on schedule`},{at:t?.lastCompactFiredAt,how:`after a compaction`}].filter(e=>e.at!==void 0),O=D.reduce((e,t)=>e&&Date.parse(e.at)>=Date.parse(t.at)?e:t,void 0),k=O===void 0?null:D.length>1?`Last sent ${oN(O.at)}`:`Last sent ${O.how} ${oN(O.at)}`;return(0,V.jsxs)(`section`,{"data-recurring-panel":!0,children:[(0,V.jsxs)(`div`,{className:`mb-2 flex items-center gap-3`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Goal`}),k&&(0,V.jsx)(`span`,{className:`ml-auto truncate text-muted/55`,children:k})]}),(0,V.jsx)(`textarea`,{ref:_,"data-recurring-text":!0,value:i,maxLength:Uy,onChange:e=>a(e.target.value),onBlur:T,onKeyDown:e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),T())},placeholder:`What is this thread trying to achieve?`,className:`field-sizing-content max-h-[28vh] min-h-[4rem] w-full resize-none overflow-y-auto rounded-md border border-border bg-bg px-2 py-1.5 text-[12px] leading-snug outline-none placeholder:text-muted/50 focus:border-border-strong ${m?`text-fg`:`text-muted`}`}),(0,V.jsxs)(`div`,{className:`mt-3 grid grid-cols-[auto_auto_1fr] items-baseline gap-x-2.5 gap-y-2`,children:[(0,V.jsx)(Z2,{testId:`stop-hook`,label:`Stop hook`,checked:o,onChange:e=>{s(e),C(y({stopHook:e})),e&&!i.trim()&&requestAnimationFrame(()=>_.current?.focus())}}),(0,V.jsx)(`span`,{className:`font-medium ${o?`text-fg`:`text-muted`}`,children:`Stop hook`}),(0,V.jsx)(`span`,{className:`text-muted`,children:`every rest — unless it signed off or parked on a wait`}),(0,V.jsx)(Z2,{testId:`heartbeat`,label:`Heartbeat`,checked:c,onChange:e=>{l(e),C(y({heartbeat:e})),e&&!i.trim()&&requestAnimationFrame(()=>_.current?.focus())}}),(0,V.jsx)(`span`,{className:`font-medium ${c?`text-fg`:`text-muted`}`,children:`Heartbeat`}),c?(0,V.jsxs)(`span`,{className:`flex items-center gap-1.5 text-muted`,children:[`every`,(0,V.jsx)(`input`,{type:`number`,"data-recurring-minutes":!0,inputMode:`numeric`,min:n4,max:r4,value:h,onChange:e=>g(e.target.value),onBlur:E,onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),E())},"aria-label":`Heartbeat interval in minutes`,className:`w-[4.5ch] rounded-md border border-border bg-bg px-1 py-[3px] text-center text-[11px] leading-none tabular-nums text-fg outline-none focus:border-border-strong disabled:opacity-45 [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none`}),`min, even mid-turn`]}):(0,V.jsx)(`span`,{className:`text-muted`,children:`on a clock, even mid-turn`}),(0,V.jsx)(Z2,{testId:`post-compaction`,label:`Compaction`,checked:u,onChange:e=>{d(e),C(y({postCompaction:e})),e&&!i.trim()&&requestAnimationFrame(()=>_.current?.focus())}}),(0,V.jsx)(`span`,{className:`font-medium ${u?`text-fg`:`text-muted`}`,children:`Compaction`}),(0,V.jsx)(`span`,{className:`text-muted`,children:`when the context is summarized away — link the doc to re-read`})]})]})}function d4({thread:e,sticky:t=!1,safeArea:n=!1,onArchived:r,onDismissCancel:i,onSnoozed:a}){let o=M2(e);return o.footer?(0,V.jsxs)(`footer`,{"aria-label":`Thread lifecycle actions`,"data-thread-lifecycle-footer":!0,className:`${t?`z-20`:U1} flex min-h-10 shrink-0 flex-wrap items-center justify-end ${CH} border-t border-border/70 bg-panel/95 px-3 pt-2 text-[12px] ${n?`pb-[max(0.5rem,env(safe-area-inset-bottom))]`:`pb-2`} backdrop-blur-sm`,children:[(0,V.jsxs)(`span`,{className:`mr-auto flex items-center ${CH}`,children:[(0,V.jsx)(Y2,{thread:e}),!o.done&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(W2,{thread:e}),(0,V.jsx)(U2,{thread:e})]}),(0,V.jsx)(p4,{thread:e}),(0,V.jsx)($2,{thread:e})]}),o.done?(0,V.jsx)(f4,{}):(0,V.jsxs)(V.Fragment,{children:[o.snooze&&(0,V.jsx)(L2,{thread:e,onSnoozed:a}),(0,V.jsx)(m4,{thread:e,onArchived:r,onDismissCancel:i})]})]}):null}function f4(){let e=`Marked done — send a message to reopen it`;return(0,V.jsx)(Pq,{label:e,side:`top`,children:(0,V.jsxs)(`span`,{"data-thread-done":!0,"aria-label":e,className:`flex items-center gap-1 rounded-md border border-transparent px-2.5 py-1 font-medium text-muted`,children:[(0,V.jsx)(PC,{size:12}),`Done`]})})}function p4({thread:e}){let t=_M(e);if(!t)return null;let n=e.snoozePrompt?.trim(),r=n?`Bumps ${Fj(t)}\n${n}`:`Snoozed until ${Fj(t)}`;return(0,V.jsx)(Pq,{label:r,side:`top`,multiline:!!n,children:(0,V.jsx)(`span`,{"data-pending-snooze":!0,"aria-label":r,className:`flex items-center px-0.5 text-muted/60 ${wH}`,children:(0,V.jsx)(iw,{size:12})})})}function m4({thread:e,onArchived:t,onDismissCancel:n,className:r=`rounded-md border border-border-strong bg-panel-2/60 px-2.5 py-1 text-[12px] text-fg/80 hover:bg-panel-2 hover:text-fg`,iconClassName:i=``}){let[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(!1),[l,u]=(0,B.useState)(void 0),d=(r,i)=>{o(!0),i&&t?.(),(r||N2(e))&&wJ(e.id),X.completeThread({slug:e.id,sessionId:e.sessionId??``,terminateLive:r}).then(r=>{if(r.needsConfirmation){TJ(e.id),i&&n?.(),u(r.hold),c(!0),o(!1);return}c(!1),Q(`Done`),i||t?.()}).catch(t=>{TJ(e.id),i&&n?.(),Q(`Couldn’t finish: ${t.message.slice(0,80)}`),o(!1)})},f=!!t&&!!n&&N2(e);return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>d(!1,f),disabled:a,"aria-label":`Mark as done`,title:`Mark as done`,onMouseDown:e=>e.preventDefault(),className:`flex items-center gap-1 font-medium outline-none transition-colors focus-visible:ring-1 focus-visible:ring-fg/60 disabled:opacity-45 ${r}`,children:[(0,V.jsx)(PC,{size:12,className:i}),`Mark as done`]}),(0,V.jsx)(I2,{open:s,onOpenChange:e=>{a||c(e)},title:`End this session?`,className:`w-[390px] max-w-[92vw]`,footer:(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>c(!1),className:`rounded-md px-3 py-1.5 text-[12px] text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg disabled:opacity-45`,children:`Cancel`}),(0,V.jsxs)(`button`,{type:`button`,disabled:a,onClick:()=>d(!0,!1),className:`flex items-center gap-1.5 rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-opacity hover:opacity-90 disabled:opacity-45`,children:[a&&(0,V.jsx)(dw,{size:12,className:`animate-spin`}),`End session & mark done`]})]}),children:(0,V.jsx)(h4,{hold:l})})]})}function h4({hold:e}){let t=P2(e);return(0,V.jsxs)(`div`,{"data-completion-hold":!0,className:`flex flex-col gap-2 p-4 text-[12px] leading-relaxed text-muted`,children:[(0,V.jsx)(`p`,{children:t.lead}),t.groups.map(e=>(0,V.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,V.jsx)(`div`,{className:`text-[11px] font-medium uppercase tracking-wide text-fg/70`,children:e.heading}),(0,V.jsxs)(`ul`,{className:`flex flex-col gap-0.5`,children:[e.items.map((e,t)=>(0,V.jsxs)(`li`,{className:`flex min-w-0 items-baseline gap-1.5`,children:[(0,V.jsx)(`span`,{"aria-hidden":!0,className:sN,children:`⤷`}),(0,V.jsx)(`span`,{className:`min-w-0 truncate text-fg/80`,children:e.label}),e.stale&&(0,V.jsx)(`span`,{className:`shrink-0 text-[11px] text-muted/60`,children:`no recent output`})]},`${e.label}-${t}`)),e.overflow>0&&(0,V.jsxs)(`li`,{className:`pl-[15px] text-muted/60`,children:[`+`,e.overflow,` more`]})]})]},e.kind)),(0,V.jsx)(`p`,{children:t.trailer})]})}function g4(e){if(e.kind!==void 0||e.role!==`assistant`||e.text.trim())return;let t=e.parts??[],n=t.length>0?t.length===1&&t[0].kind===`tools`?t[0].tools:[]:e.tools??[],r=n.length===1?n[0]:void 0;return r?.agentCompletion?r:void 0}var _4={completed:`finished`,killed:`stopped`,failed:`failed`};function v4(e){let t=_4[e.agentStatus??`completed`],n=e.agentElapsedMs===void 0?void 0:rN(e.agentElapsedMs);return{outcome:t,tail:`${t}${n?` · ${n}`:``}`}}var y4=e=>e===void 0?void 0:QM(e),b4=e=>{if(e!==void 0)return rN(e)||void 0};function x4(e){let{agentStatus:t,agentElapsedMs:n,liveState:r,liveElapsedMs:i,status:a,durationMs:o}=e;if(t){let e=t===`killed`,r=t===`failed`,i=y4(n);return{label:t===`completed`?void 0:_4[t],duration:b4(n),tone:r?`failed`:`muted`,title:`${e?`Stopped`:r?`Failed`:`Ran for`}${e||r?` after`:``} ${i??`an unknown time`}`}}if(r){let e=y4(i);return{label:void 0,duration:b4(i),tone:`muted`,title:r===`running`?`Working for ${e??`an unknown time`}`:`Dispatched ${e??`an unknown time`} ago`}}if(a===`pending`||a!==`failed`&&a!==`cancelled`)return null;let s=a===`failed`,c=a===`cancelled`,l=y4(o);return{label:c?_4.killed:s?_4.failed:void 0,duration:b4(o),tone:s?`failed`:`muted`,title:`${c?`Stopped after`:s?`Failed after`:`Ran for`} ${l??`an unknown time`}`}}var S4=`text-[14px] leading-5 text-muted`,C4=`size-[1em] shrink-0 self-baseline -mt-[calc(1em_-_1cap)] translate-y-[calc(0.5em_-_0.5cap)] text-muted/70 transition-transform group-hover:text-fg`;function w4(e){return`${C4} ${e?`-mx-[0.208em] rotate-90`:`-mx-[0.333em]`}`}var $=B.createElement;function T4({payload:e}){return e.kind===`command-approval`?$(B.Fragment,null,$(`div`,{className:`text-[12px] text-muted`},`Command`),$(`div`,{className:`mt-0.5 break-words text-[13px] font-medium text-fg`},e.command.summary),e.command.workingDirectoryLabel?$(`div`,{className:`mt-1 break-all text-[10.5px] text-muted/70`},`Working directory: `,e.command.workingDirectoryLabel):null,$(E4,{label:`Redacted command preview`,text:e.command.preview}),e.command.actions?$(D4,{actions:e.command.actions}):null,e.capabilities?$(k4,{capabilities:e.capabilities}):null):e.kind===`file-approval`?$(B.Fragment,null,$(`div`,{className:`text-[12px] text-muted`},N4(e.operation)),$(`div`,{className:`mt-0.5 break-all font-mono-keep text-[12px] text-fg`},e.pathLabel),e.destinationLabel?$(`div`,{className:`mt-1 break-all font-mono-keep text-[11px] text-muted`},`→ `,e.destinationLabel):null,e.grantRootLabel?$(`section`,{"aria-label":`Requested session write root`,className:`mt-2.5 min-w-0 rounded-md border border-amber-400/35 bg-amber-500/[0.06] px-2.5 py-2`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-amber-100/80`},`Requested session write root`),$(`div`,{className:`mt-1 min-w-0 break-all font-mono-keep text-[10.5px] text-fg/85`},e.grantRootLabel),e.scopeLabel?$(`div`,{className:`mt-1.5 whitespace-pre-wrap break-words text-[10.5px] leading-snug text-amber-100/75`},e.scopeLabel):null):null,e.diffPreview?$(E4,{label:`Plain-text diff preview`,text:e.diffPreview}):null,e.changes?$(O4,{changes:e.changes}):null):$(B.Fragment,null,e.preview?$(`pre`,{className:`max-h-64 max-w-full min-w-0 overflow-auto rounded-md border border-border/70 bg-bg/40 px-2.5 py-2 whitespace-pre-wrap break-words font-mono-keep text-[11.5px] leading-relaxed text-fg/90`},e.promptLabel?$(`span`,{className:`text-shell/90`},e.promptLabel):null,e.promptLabel?$(`span`,{className:`text-accent`},` ❯ `):null,e.preview):null,e.resourceLabel?$(`div`,{className:`mt-1 break-all text-[11px] text-muted`},`Resource: `,e.resourceLabel):null,e.workingDirectoryLabel?$(`div`,{className:`mt-1.5 break-all text-[10.5px] text-muted/70`},`Working directory: `,e.workingDirectoryLabel):null,e.scopeLabel?$(`div`,{className:`mt-2 whitespace-pre-wrap break-words text-[11px] leading-snug text-muted`},e.scopeLabel):null,e.capabilities?$(k4,{capabilities:e.capabilities}):null)}function E4({label:e,text:t}){return $(`details`,{className:`mt-2.5 min-w-0 rounded-md border border-border/70 bg-bg/35`,open:t.length<1200},$(`summary`,{className:`cursor-pointer px-2.5 py-2 text-[10.5px] text-muted outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/50`},e),$(`pre`,{className:`max-h-64 max-w-full min-w-0 overflow-auto border-t border-border/60 px-2.5 py-2 whitespace-pre-wrap break-words font-mono-keep text-[11px] leading-relaxed text-fg/80`},t))}function D4({actions:e}){return $(`section`,{"aria-label":`Parsed command actions`,className:`mt-3 min-w-0`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-muted/75`},`Parsed actions`),$(`ul`,{className:`mt-1.5 flex min-w-0 flex-col gap-2`},e.map((e,t)=>$(`li`,{key:t,className:`min-w-0 rounded-md border border-border/65 bg-bg/25 px-2.5 py-2`},$(`div`,{className:`text-[11px] font-medium text-fg/90`},M4(e.kind)),e.resourceLabel?$(`div`,{className:`mt-0.5 break-all font-mono-keep text-[10.5px] text-muted`},e.resourceLabel):null,e.queryLabel?$(`div`,{className:`mt-0.5 break-all text-[10.5px] text-muted`},`Query: `,e.queryLabel):null,$(E4,{label:`${M4(e.kind)} command detail`,text:e.commandPreview})))))}function O4({changes:e}){return $(`section`,{"aria-label":`Affected file changes`,className:`mt-3 min-w-0`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-muted/75`},`Affected changes`),$(`ol`,{className:`mt-1.5 flex min-w-0 flex-col gap-2`},e.map((e,t)=>$(`li`,{key:t,className:`min-w-0 rounded-md border border-border/65 bg-bg/25 px-2.5 py-2`},$(`div`,{className:`text-[11px] font-medium text-fg/90`},N4(e.operation)),$(`div`,{className:`mt-0.5 break-all font-mono-keep text-[10.5px] text-fg/80`},e.pathLabel),e.destinationLabel?$(`div`,{className:`mt-0.5 min-w-0 break-all font-mono-keep text-[10.5px] text-muted`},`→ `,e.destinationLabel):null,e.diffPreview?$(E4,{label:`${N4(e.operation)} plain-text diff`,text:e.diffPreview}):null))))}function k4({capabilities:e}){return $(`section`,{"aria-label":`Requested capabilities`,className:`mt-3 min-w-0`},$(`h4`,{className:`text-[10px] font-medium uppercase tracking-[0.07em] text-muted/75`},`Requested capabilities`),$(`ul`,{className:`mt-1.5 flex min-w-0 flex-col gap-2`},e.map((e,t)=>$(`li`,{key:t,className:`min-w-0 rounded-md border border-border/65 bg-bg/25 px-2.5 py-2`},$(A4,{capability:e})))))}function A4({capability:e}){if(e.kind===`network`){let t=e.enabled===!0?`Enable network access`:e.enabled===!1?`Disable network access`:`Network access request`;return $(B.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},t),e.hosts.length>0?$(j4,{label:`Hosts and protocols`,values:e.hosts}):null)}if(e.kind===`filesystem`){let t=e.access===`read`?`Read filesystem paths`:e.access===`write`?`Write filesystem paths`:`Deny filesystem paths`;return $(B.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},t),$(j4,{label:`Paths`,values:e.resources}))}return e.kind===`glob-scan`?$(B.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},`Filesystem glob scanning`),$(`div`,{className:`mt-0.5 text-[10.5px] text-muted`},`Maximum depth: `,String(e.depth))):e.kind===`exec-policy`?$(B.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},`Future command policy amendment`),$(j4,{label:`Command prefix tokens`,values:e.prefixes})):$(B.Fragment,null,$(`div`,{className:`text-[11px] font-medium text-fg/90`},e.access===`allow`?`Allow future network hosts`:`Deny future network hosts`),$(j4,{label:`Hosts`,values:e.hosts}))}function j4({label:e,values:t}){return $(`div`,{className:`mt-1 min-w-0`},$(`div`,{className:`sr-only`},e),$(`ul`,{"aria-label":e,className:`flex min-w-0 flex-col gap-0.5`},t.map((e,t)=>$(`li`,{key:t,className:`min-w-0 break-all font-mono-keep text-[10.5px] text-muted`},e))))}function M4(e){switch(e){case`read`:return`Read a file`;case`list-files`:return`List files`;case`search`:return`Search files`;case`unknown`:return`Unclassified command`}}function N4(e){switch(e){case`read`:return`Read file`;case`create`:return`Create file`;case`write`:return`Modify file`;case`move`:return`Move file`;case`delete`:return`Delete file`;case`execute`:return`Execute file`;case`other`:return`File operation`}}function P4(e){return e===`sending`?{actionsEnabled:!1,status:`Sending to runtime…`}:e===`reconnect-required`?{actionsEnabled:!1,status:`Runtime reconnect required before this request can be answered.`}:{actionsEnabled:!0}}var F4={semantic:`approve`,label:`Approve once`,order:10,tone:`primary`,durable:!1,scope:`Applies only to this request.`},I4={semantic:`approve`,label:`Approve for session`,order:20,tone:`primary`,durable:!0,scope:`Persists for later matching requests in this thread session.`},L4={semantic:`approve`,label:`Grant for turn`,order:10,tone:`primary`,durable:!1,scope:`Applies to this turn only.`},R4={semantic:`approve`,label:`Grant for session`,order:20,tone:`primary`,durable:!0,scope:`Persists until this thread session ends.`},z4={semantic:`deny`,label:`Deny`,order:70,tone:`danger`,durable:!1,scope:`Rejects this request.`},B4={semantic:`decline`,label:`Decline`,order:70,tone:`danger`,durable:!1,scope:`Declines this request.`},V4={semantic:`cancel`,label:`Cancel request`,order:80,tone:`neutral`,durable:!1,scope:`Cancels this pending request.`};function H4(e,t){let{id:n,semantic:r}=t;if(e.kind===`command-approval`||e.kind===`file-approval`)return(n===`accept`||n===`approve-once`)&&r===`approve`?F4:n===`acceptForSession`&&r===`approve`?I4:(n===`decline`||n===`deny`)&&r===`deny`?z4:n===`cancel`&&r===`cancel`?V4:void 0;if(e.kind===`permission-approval`)return n===`grant-turn`&&r===`approve`?L4:n===`grant-session`&&r===`approve`?R4:(n===`deny`||n===`decline`)&&r===`deny`?z4:n===`cancel`&&r===`cancel`?V4:void 0;if(e.kind===`mcp-elicitation-form`||e.kind===`mcp-elicitation-url`)return n===`accept`&&r===`accept`?{semantic:`accept`,label:e.kind===`mcp-elicitation-form`?`Submit`:`Continue`,order:10,tone:`primary`,durable:!1,scope:`Applies only to this request.`}:n===`decline`&&r===`decline`?B4:n===`cancel`&&r===`cancel`?V4:void 0;if(n===`answer`&&r===`answer`)return{semantic:`answer`,label:`Send answer`,order:10,tone:`primary`,durable:!1,scope:`Sends these answers to this request only.`};if(n===`decline`&&r===`decline`)return B4;if(n===`cancel`&&r===`cancel`)return V4}function U4(e){let t=t=>e.payload.kind===`mcp-elicitation-form`&&t===`accept`||e.payload.kind===`agent-question`&&t===`answer`;return e.allowedDecisions.flatMap(n=>{let r=H4(e.payload,n);return r?[{...r,id:n.id,semantic:n.semantic,requiresValues:t(n.semantic)}]:[]}).sort((e,t)=>e.order-t.order||e.id.localeCompare(t.id))}function W4(e){switch(e){case`claude`:return`Claude`;case`codex`:return`Codex`;case`frizz`:return`Frizz`}}function G4(e){switch(e){case`runtime`:return`Runtime`;case`agent`:return`Agent`;case`tool`:return`Tool`;case`mcp-server`:return`MCP server`;case`frizz`:return`Frizz`}}function K4(e,t){let n=e.options.findIndex(e=>JSON.stringify(e.value)===JSON.stringify(t));return n<0?``:String(n)}function q4(e){let t=Object.create(null);for(let n of e)if(n.input===`text`||n.input===`multiline`)t[n.id]=n.default??``;else if(n.input===`number`||n.input===`integer`)t[n.id]=n.default===void 0?``:String(n.default);else if(n.input===`boolean`)t[n.id]=n.default??!1;else if(n.input===`select`)t[n.id]=n.default===void 0?``:K4(n,n.default);else if(n.input===`multi-select`){let e=new Set(n.default??[]);t[n.id]=n.options.flatMap((t,n)=>e.has(t.value)?[String(n)]:[])}return t}function J4(e,t,n){let r=Object.create(null);for(let t of Object.keys(e))r[t]=e[t];return r[t]=n,r}function Y4(e,t){if(e.some(e=>e.secret))return{errors:{},formError:`Secret responses cannot be sent through this Frizz connection.`};let n=Object.create(null),r={};for(let i of e){let e=t[i.id],a;if(i.input===`text`||i.input===`multiline`){let t=typeof e==`string`?e:``;if(!i.required&&t===``)continue;i.required&&t===``?r[i.id]=`This field is required.`:a=t}else if(i.input===`number`||i.input===`integer`){let t=typeof e==`string`?e.trim():``;if(!i.required&&t===``)continue;if(t===``)r[i.id]=`This field is required.`;else{let e=Number(t);Number.isFinite(e)?a=e:r[i.id]=`Enter a valid number.`}}else if(i.input===`boolean`)a=e===!0;else if(i.input===`select`){let t=typeof e==`string`&&/^\d+$/.test(e)?Number(e):-1;if(t<0||t>=i.options.length)if(i.required)r[i.id]=`Choose an option.`;else continue;else a=i.options[t].value}else if(i.input===`multi-select`){let t=(Array.isArray(e)?e:[]).flatMap(e=>/^\d+$/.test(e)?[Number(e)]:[]);if(t.some(e=>e<0||e>=i.options.length))r[i.id]=`Choose only advertised options.`;else if(i.required&&t.length===0)r[i.id]=`Choose at least one option.`;else if(t.length>0)a=t.map(e=>i.options[e].value);else continue}if(a!==void 0&&!r[i.id]){let e=Hv(i,a);e?r[i.id]=`Value ${e}.`:n[i.id]=a}}if(Object.keys(r).length>0)return{errors:r};let i=ny.safeParse(n);return i.success?{errors:r,values:i.data}:{errors:r,formError:`The response is too large or contains invalid values.`}}function X4(e,t){return JSON.stringify([e,t??null])}function Z4(e,t){try{let n=new URL(e,t);return n.protocol===`http:`||n.protocol===`https:`?n.toString():null}catch{return null}}function Q4(e,t){let n=e.getAttribute(`href`);if(!n)return!1;let r=Z4(n,t);if(!r)return!1;let i;try{i=new URL(t)}catch{return!1}if(new URL(r).origin===i.origin)return!1;e.setAttribute(`target`,`_blank`);let a=new Set((e.getAttribute(`rel`)??``).split(/\s+/u).filter(Boolean));return a.add(`noopener`),a.add(`noreferrer`),e.setAttribute(`rel`,[...a].join(` `)),!0}function $4(e=()=>location.href){return t=>{if(t.defaultPrevented||t.button!==0)return;let n=t3(t);n&&Q4(n,e())}}function e3(){let e=$4();return document.addEventListener(`click`,e,!0),()=>document.removeEventListener(`click`,e,!0)}function t3(e){let t=typeof e.composedPath==`function`?e.composedPath():[];for(let e of t)if(n3(e))return e;let n=e.target?.closest?.(`a[href]`);return n3(n)?n:null}function n3(e){if(!e||typeof e!=`object`)return!1;let t=e;return t.tagName?.toLowerCase()===`a`&&typeof t.getAttribute==`function`&&typeof t.setAttribute==`function`&&typeof t.hasAttribute==`function`&&t.hasAttribute(`href`)}function r3(e){let t=e,n=``;do n=String.fromCharCode(65+t%26)+n,t=Math.floor(t/26)-1;while(t>=0);return`${n}.`}function i3(e,t){let n=e??t;if(!n)return null;let r=e&&(e.input===`select`||e.input===`multi-select`)?e.options:[];return{question:{kind:e?.input===`multi-select`?`multi`:`question`,danger:!1,contextMd:n.description??n.label,options:r.map((e,t)=>`${r3(t)} ${e.label}`),recommendedIdx:null},...e?{optionFieldId:e.id}:{},optionValues:r.map(e=>e.value),...t?{notesFieldId:t.id}:{}}}function a3(e){if(e.payload.kind!==`agent-question`)return null;let t=e.payload.fields,n=[];for(let e=0;e<t.length;e++){let r=t[e];if(r.secret)return null;if(r.id.endsWith(`_notes`))continue;let i=t[e+1],a=i&&i.id===`${r.id}_notes`?i:void 0;if(r.input===`select`||r.input===`multi-select`){let e=i3(r,a);if(!e)return null;n.push(e)}else if(r.input===`text`||r.input===`multiline`){let e=i3(void 0,r);if(!e)return null;n.push(e)}else return null}return n.length>0?n:null}function o3(e,t){let n={};return e.forEach((e,r)=>{let i=t[r];if(!i)return;let a=i.text.trim();if(e.question.kind===`multi`){let t=(i.chosenSet??[]).slice().sort((e,t)=>e-t).flatMap(t=>{let n=e.optionValues[t];return n===void 0?[]:[n]});e.optionFieldId&&t.length>0&&(n[e.optionFieldId]=t),e.notesFieldId&&a&&(n[e.notesFieldId]=a);return}if(a){e.notesFieldId&&(n[e.notesFieldId]=a);return}let o=i.chosen;e.optionFieldId&&o!==null&&e.optionValues[o]!==void 0&&(n[e.optionFieldId]=e.optionValues[o])}),Object.keys(n).length>0?n:void 0}function s3(e){let t=e instanceof Error?e.message:`The request could not be updated.`;return t.length>240?`${t.slice(0,239)}…`:t}function c3(){return typeof crypto<`u`&&typeof crypto.randomUUID==`function`?crypto.randomUUID():`frizz-response-${Date.now()}-${Math.random().toString(36).slice(2)}`}function l3({thread:e,className:t=``,autoFocusFirst:n=!1}){let r=ij(e),i=oj(e),a=(0,B.useMemo)(()=>[...i.data?.interactions??[]].sort((e,t)=>e.createdAt.localeCompare(t.createdAt)||e.id.localeCompare(t.id)),[i.data?.interactions]);return r?i.isError&&a.length===0?(0,V.jsxs)(`div`,{"data-interactions-error":!0,role:`alert`,className:`${V1} border border-amber-500/35 bg-amber-500/[0.07] p-4 text-[12px] text-amber-100 ${t}`,children:[(0,V.jsx)(`div`,{className:`font-medium`,children:`Pending requests could not be loaded.`}),(0,V.jsx)(`div`,{className:`mt-1 break-words text-amber-100/75`,children:s3(i.error)}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>void i.refetch(),className:`mt-2 rounded-md border border-amber-400/40 px-2 py-1 text-[11px] hover:bg-amber-500/10`,children:`Try again`})]}):a.length===0?null:(0,V.jsx)(`section`,{"data-typed-interactions":!0,"aria-label":`${a.length} pending request${a.length===1?``:`s`}`,className:`flex min-w-0 flex-col gap-3 ${t}`,children:a.map((e,t)=>(0,V.jsx)(d3,{record:e,autoFocus:n&&t===0},e.id))}):null}function u3({record:e,questions:t,autoFocus:n}){let r=Md(),i=(0,B.useRef)(null),a=(0,B.useRef)(new Map),o=iW(),s=P4(e.delivery?.effect),c=(0,B.useMemo)(()=>U4(e).find(e=>e.semantic===`answer`),[e]),l=sW(t.flatMap(t=>t.notesFieldId?[rW.interaction(o,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId)]:[])),[u,d]=(0,B.useState)(()=>t.map(()=>({chosen:null,chosenSet:[]}))),f=t.map((t,n)=>({chosen:u[n]?.chosen??null,chosenSet:u[n]?.chosenSet??[],text:t.notesFieldId?l.get(rW.interaction(o,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId))??``:``})),p=o3(t,f),[m,h]=(0,B.useState)(),[g,_]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(!n)return;let e=document.activeElement;e&&e!==document.body||requestAnimationFrame(()=>i.current?.focus())},[n,e.id]);let v=Jd({mutationFn:async t=>X.interactionResolve({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id,sessionEpoch:e.owner.sessionEpoch,capabilityRevision:e.owner.capabilityRevision,expectedRecordRevision:e.recordRevision,responseId:t.responseId,decisionId:t.decisionId,values:t.values}),onSuccess:t=>{_(!0),Lk(r,t.interaction),r.invalidateQueries({queryKey:Fk(e.owner.threadSlug,e.owner.sessionId)}),r.invalidateQueries({queryKey:Ik(e.owner.threadSlug,e.owner.sessionId,e.id)})},onError:t=>{Rk(r,e),h(s3(t))}}),y=()=>{if(!c||!p||v.isPending||g||!s.actionsEnabled)return;h(void 0);let e=X4(c.id,p),t=a.current.get(e)??c3();a.current.set(e,t),v.mutate({decisionId:c.id,values:p,responseId:t})},b=(t,n)=>{t.notesFieldId&&tW.set(rW.interaction(o,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.notesFieldId),n)};return(0,V.jsxs)(`article`,{ref:i,tabIndex:-1,"data-interaction-id":e.id,"data-interaction-kind":e.payload.kind,"data-interaction-question":`native`,"data-delivery-effect":e.delivery?.effect,className:`flex min-w-0 flex-col gap-2 outline-none`,children:[t.map((e,t)=>(0,V.jsx)(N0,{question:e.question,interactive:s.actionsEnabled&&!g?{answer:f[t],onChip:n=>d(r=>r.map((r,i)=>{if(i!==t)return r;if(e.question.kind===`multi`){let e=r.chosenSet.includes(n)?r.chosenSet.filter(e=>e!==n):[...r.chosenSet,n];return{...r,chosenSet:e}}return b(e,``),{...r,chosen:n}})),onText:t=>b(e,t),onSubmit:y}:void 0},e.optionFieldId??e.notesFieldId??t)),m&&(0,V.jsx)(`div`,{role:`alert`,className:`break-words text-[11px] leading-snug text-red-300`,children:m}),(s.status||v.isPending||g)&&(0,V.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`text-[11px] leading-snug text-muted`,children:s.status??(g?`Answer sent.`:`Sending…`)}),s.actionsEnabled&&!g&&(0,V.jsx)(`div`,{className:`flex justify-start`,children:(0,V.jsx)(`button`,{type:`button`,"data-send-answers":!0,disabled:!p||v.isPending,onClick:y,onMouseDown:e=>e.preventDefault(),className:`rounded-md bg-fg px-3 py-1.5 text-[12px] font-medium text-bg outline-none transition-all hover:opacity-90 active:scale-95 disabled:opacity-30 disabled:hover:opacity-30`,children:`Send answers`})})]})}function d3({record:e,autoFocus:t=!1}){let n=(0,B.useMemo)(()=>a3(e),[e]);return n?(0,V.jsx)(u3,{record:e,questions:n,autoFocus:t}):(0,V.jsx)(f3,{record:e,autoFocus:t})}function f3({record:e,autoFocus:t=!1}){let n=Md(),r=(0,B.useId)(),i=(0,B.useRef)(null),a=(0,B.useRef)(new Map),o=e.payload.kind===`mcp-elicitation-form`||e.payload.kind===`agent-question`?e.payload.fields:[],s=o.some(e=>e.secret),c=iW(),l=o.filter(e=>!e.secret&&(e.input===`text`||e.input===`multiline`)).map(t=>rW.interaction(c,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,t.id)),u=sW(l),[d,f]=(0,B.useState)(()=>q4(o)),p=(0,B.useMemo)(()=>{let t={...d};return o.forEach(n=>{if(!n.secret&&(n.input===`text`||n.input===`multiline`)){let r=rW.interaction(c,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,n.id);t[n.id]=u.get(r)??``}}),t},[o,d,u,c,e.id,e.owner]),[m,h]=(0,B.useState)({}),[g,_]=(0,B.useState)(),[v,y]=(0,B.useState)(),[b,x]=(0,B.useState)(!1),[S,C]=(0,B.useState)(),[w,T]=(0,B.useState)(!1),E=P4(e.delivery?.effect),D=(0,B.useMemo)(()=>U4(e),[e]).filter(e=>!(s&&e.requiresValues)),O=e.allowedDecisions.length-D.length,k=(0,B.useCallback)(t=>{for(let n of o)if(!n.secret&&(n.input===`text`||n.input===`multiline`)){let r=t[n.id];typeof r==`string`&&tW.set(rW.interaction(c,e.owner.projectId,e.owner.threadSlug,e.owner.sessionId,e.owner.sessionEpoch,e.id,n.id),r)}f(t)},[o,c,e.id,e.owner]);(0,B.useEffect)(()=>{if(!t)return;let e=document.activeElement;e&&e!==document.body||requestAnimationFrame(()=>i.current?.focus())},[t,e.id]),(0,B.useEffect)(()=>{E.actionsEnabled||(C(void 0),T(!1))},[E.actionsEnabled]);let A=Jd({mutationFn:async({decision:t,values:n,responseId:r})=>{if(t.semantic===`cancel`&&e.provider.kind===`frizz`){let t=await X.interactionCancel({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id,sessionEpoch:e.owner.sessionEpoch,capabilityRevision:e.owner.capabilityRevision,expectedRecordRevision:e.recordRevision});return{effect:t.effect,interaction:t.interaction,waitingForProvider:!1}}let i=await X.interactionResolve({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id,sessionEpoch:e.owner.sessionEpoch,capabilityRevision:e.owner.capabilityRevision,expectedRecordRevision:e.recordRevision,responseId:r,decisionId:t.id,...n===void 0?{}:{values:n}});return{effect:i.effect,interaction:i.interaction,waitingForProvider:i.interaction.delivery?.effect===`sending`||i.effect===`queued`||i.effect===`already-queued`}},onSuccess:(t,r)=>{t.waitingForProvider||a.current.delete(X4(r.decision.id,r.values)),_(void 0),C(void 0),T(!1),x(!0),l.forEach(e=>tW.clear(e)),y(t.waitingForProvider?`Response sent. Waiting for the provider to acknowledge it…`:`Request completed.`),Lk(n,t.interaction),n.setQueryData(Ik(e.owner.threadSlug,e.owner.sessionId,e.id),{interaction:t.interaction}),n.invalidateQueries({queryKey:Fk(e.owner.threadSlug,e.owner.sessionId),exact:!0}),t.waitingForProvider&&window.setTimeout(()=>{n.invalidateQueries({queryKey:Fk(e.owner.threadSlug,e.owner.sessionId),exact:!0})},1e3)},onError:t=>{y(void 0),_(s3(t)),Rk(n,e),X.interactionGet({slug:e.owner.threadSlug,sessionId:e.owner.sessionId,interactionId:e.id}).then(({interaction:t})=>{Lk(n,t),n.setQueryData(Ik(e.owner.threadSlug,e.owner.sessionId,e.id),{interaction:t}),t.delivery?.effect===`sending`?(_(void 0),y(void 0),x(!0)):t.delivery?.effect===`reconnect-required`?(_(void 0),y(void 0)):(t.lifecycle!==`pending`||t.recordRevision!==e.recordRevision)&&(_(void 0),y(t.lifecycle===`expired`?`This request expired.`:`This request changed in another client.`),n.invalidateQueries({queryKey:Fk(e.owner.threadSlug,e.owner.sessionId),exact:!0})),n.invalidateQueries({queryKey:Fk(e.owner.threadSlug,e.owner.sessionId),exact:!0})}).catch(()=>{})}});function j(e){if(!e.requiresValues){h({});return}let t=Y4(o,p);return h(t.errors),t.formError?(_(t.formError),null):t.values?t.values:null}function M(e,t=!1){if(!E.actionsEnabled||A.isPending||b)return;_(void 0);let n=j(e);if(n===null)return;if(e.durable&&!t){C(e),T(!1);return}let r=X4(e.id,n),i=a.current.get(r)??c3();a.current.set(r,i),A.mutate({decision:e,values:n,responseId:i})}let N=D.find(e=>e.requiresValues&&e.tone===`primary`);function P(e){e.preventDefault(),E.actionsEnabled&&N&&M(N)}return(0,V.jsxs)(`article`,{ref:i,tabIndex:-1,"aria-labelledby":r,"data-interaction-id":e.id,"data-interaction-kind":e.payload.kind,"data-delivery-effect":e.delivery?.effect,className:`min-w-0 ${V1} border border-accent/45 bg-accent/[0.065] shadow-sm shadow-black/15 outline-none focus-visible:ring-2 focus-visible:ring-accent/60`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3 border-b border-accent/20 px-4 py-3`,children:[(0,V.jsx)(ww,{"aria-hidden":`true`,size:16,className:`shrink-0 text-accent`}),(0,V.jsx)(`h3`,{id:r,className:`min-w-0 flex-1 break-words text-[14px] font-semibold leading-snug text-fg`,children:e.payload.title})]}),(0,V.jsx)(`form`,{onSubmit:P,className:`min-w-0 px-4 py-3.5`,noValidate:!0,children:(0,V.jsxs)(`fieldset`,{disabled:!E.actionsEnabled,className:`min-w-0 border-0 p-0`,children:[(0,V.jsx)(`legend`,{className:`sr-only`,children:`Interaction request`}),(0,V.jsx)(m3,{record:e,instanceId:r,draft:p,setDraft:k,errors:m,autoFocus:t}),s&&(0,V.jsxs)(`div`,{"data-secret-fallback":!0,className:`mt-3 rounded-md border border-amber-500/35 bg-amber-500/[0.07] p-3 text-[12px] leading-snug text-amber-100/90`,children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(cw,{"aria-hidden":`true`,size:14,className:`mt-0.5 shrink-0`}),(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`font-medium`,children:`Secret input is unavailable in this page.`}),(0,V.jsx)(`div`,{className:`mt-1 text-amber-100/70`,children:`Frizz will not persist or send secret values through the current RPC.`})]})]}),(0,V.jsx)(`div`,{className:`mt-2 font-medium`,children:`Use the provider's trusted secret-input flow. The thread terminal cannot answer this typed request.`})]}),O>0&&(0,V.jsxs)(`div`,{className:`mt-3 flex items-start gap-2 rounded-md border border-amber-500/25 bg-amber-500/[0.05] px-3 py-2 text-[11px] leading-snug text-amber-100/75`,children:[(0,V.jsx)(Mw,{"aria-hidden":`true`,size:13,className:`mt-0.5 shrink-0`}),(0,V.jsxs)(`span`,{children:[O===1?`One advertised choice`:`${O} advertised choices`,` cannot be safely labeled or delivered in Frizz and is not shown.`]})]}),S&&(0,V.jsxs)(`div`,{"data-durable-confirmation":!0,role:`group`,"aria-label":`Confirm ${S.label}`,className:`mt-3 rounded-md border border-amber-400/45 bg-amber-500/[0.08] p-3`,children:[(0,V.jsx)(`div`,{className:`text-[12px] font-semibold text-amber-100`,children:`This approval persists beyond the current request.`}),(0,V.jsx)(`div`,{className:`mt-1 text-[11px] leading-snug text-amber-100/75`,children:S.scope}),(0,V.jsxs)(`label`,{className:`mt-2.5 flex cursor-pointer items-start gap-2 text-[11px] leading-snug text-fg/85`,children:[(0,V.jsx)(`input`,{type:`checkbox`,autoFocus:!0,checked:w,onChange:e=>T(e.target.checked),className:`mt-0.5 accent-[var(--color-accent)]`}),(0,V.jsx)(`span`,{children:`I understand this may authorize later matching actions in this session.`})]}),(0,V.jsxs)(`div`,{className:`mt-3 flex flex-wrap justify-start gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,onClick:()=>{C(void 0),T(!1)},className:`rounded-md border border-border px-2.5 py-1.5 text-[11px] text-muted hover:bg-panel-2 hover:text-fg`,children:`Back`}),(0,V.jsxs)(`button`,{type:`button`,disabled:!w||A.isPending,onClick:()=>M(S,!0),className:`rounded-md border border-amber-400/50 bg-amber-500/15 px-2.5 py-1.5 text-[11px] font-semibold text-amber-50 hover:bg-amber-500/25 disabled:opacity-35`,children:[`Confirm `,S.label.toLowerCase()]})]})]}),g&&(0,V.jsx)(`div`,{role:`alert`,className:`mt-3 break-words text-[11px] leading-snug text-red-300`,children:g}),(E.status??v)&&(0,V.jsx)(`div`,{role:`status`,"aria-live":`polite`,className:`mt-3 text-[11px] leading-snug text-muted`,children:E.status??v}),E.actionsEnabled&&!S&&!b&&D.length>0&&(0,V.jsxs)(`div`,{className:`mt-4 flex flex-wrap justify-start gap-2`,children:[D.map(e=>(0,V.jsxs)(`button`,{type:e===N?`submit`:`button`,"data-interaction-decision":e.id,disabled:A.isPending,"aria-describedby":e.durable?`${r}-scope-${e.id}`:void 0,onClick:e===N?void 0:()=>M(e),className:p3(e),children:[A.isPending?`Sending…`:e.label,e.durable&&(0,V.jsx)(`span`,{className:`sr-only`,children:`; persistent approval`})]},e.id)),D.filter(e=>e.durable).map(e=>(0,V.jsx)(`span`,{id:`${r}-scope-${e.id}`,className:`sr-only`,children:e.scope},`scope-${e.id}`))]}),!h3.has(e.payload.kind)&&(0,V.jsx)(v3,{record:e})]})})]})}function p3(e){let t=`rounded-md border px-2.5 py-1.5 text-[11px] font-medium outline-none transition-colors focus-visible:ring-2 focus-visible:ring-fg/50 disabled:opacity-40`;return e.tone===`primary`?`${t} border-accent/55 bg-accent/15 text-fg hover:bg-accent/25`:e.tone===`danger`?`${t} border-red-400/35 bg-red-500/[0.07] text-red-200 hover:bg-red-500/15`:`${t} border-border bg-panel text-muted hover:bg-panel-2 hover:text-fg`}function m3({record:e,instanceId:t,draft:n,setDraft:r,errors:i,autoFocus:a}){let o=e.payload,s=(e,t)=>r(J4(n,e,t)),c;return c=o.kind===`command-approval`||o.kind===`file-approval`||o.kind===`permission-approval`?(0,V.jsx)(T4,{payload:o}):o.kind===`mcp-elicitation-url`?(0,V.jsx)(_3,{url:o.url}):(0,V.jsx)(y3,{instanceId:t,fields:o.fields,draft:n,setValue:s,errors:i,autoFocus:a}),(0,V.jsxs)(V.Fragment,{children:[`message`in o&&o.message&&(0,V.jsx)(g3,{text:o.message}),(0,V.jsx)(`div`,{className:`message`in o&&o.message?`mt-3`:``,children:c})]})}var h3=new Set([`command-approval`,`file-approval`,`permission-approval`]);function g3({text:e}){return e.length>600||e.split(`
480
- `).length>6?(0,V.jsxs)(`details`,{className:`rounded-md border border-border/70 bg-panel/60`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer px-2.5 py-2 text-[11px] text-muted outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/50`,children:`Request message`}),(0,V.jsx)(`div`,{className:`max-h-52 overflow-auto border-t border-border/60 px-2.5 py-2 whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})]}):(0,V.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})}function _3({url:e}){let t=Z4(e,location.href);return(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-[11px] font-medium text-fg`,children:`Open this page to continue`}),(0,V.jsx)(`code`,{className:`mt-1.5 block max-h-24 overflow-auto break-all rounded-md border border-border bg-bg/40 px-2.5 py-2 font-mono-keep text-[10.5px] text-fg/80`,children:e}),t?(0,V.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 inline-flex items-center gap-1.5 rounded-md border border-border bg-panel px-2.5 py-1.5 text-[11px] font-medium text-fg hover:bg-panel-2`,children:[(0,V.jsx)(YC,{"aria-hidden":`true`,size:12}),`Open page`]}):(0,V.jsx)(`div`,{role:`alert`,className:`mt-1.5 break-words text-[11px] text-red-300`,children:`This request did not provide a safe http(s) URL.`})]})}function v3({record:e}){return(0,V.jsxs)(`details`,{className:`mt-3 border-t border-border/50 pt-2 text-[10.5px] text-muted/70`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer w-fit outline-none hover:text-muted focus-visible:ring-1 focus-visible:ring-fg/50`,children:`Request details`}),(0,V.jsxs)(`dl`,{className:`mt-2 grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1`,children:[(0,V.jsx)(`dt`,{children:`Provider`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:W4(e.provider.kind)}),e.provider.name&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Reported name`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.name})]}),e.provider.version&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Reported version`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.version})]}),(0,V.jsx)(`dt`,{children:`Source`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:G4(e.source.kind)}),e.source.label&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Reported source`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.source.label})]}),(0,V.jsx)(`dt`,{children:`Scope`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:`This thread · this request`}),e.expiresAt&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Expires`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.expiresAt})]})]})]})}function y3({instanceId:e,fields:t,draft:n,setValue:r,errors:i,autoFocus:a}){let o=t.findIndex(e=>!e.secret);return(0,V.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,V.jsx)(`legend`,{className:`sr-only`,children:`Requested information`}),(0,V.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:t.map((t,s)=>(0,V.jsx)(b3,{instanceId:e,field:t,value:n[t.id],setValue:e=>r(t.id,e),error:i[t.id],autoFocus:a&&s===o},t.id))})]})}function b3({instanceId:e,field:t,value:n,setValue:r,error:i,autoFocus:a}){let o=`${e}-${t.id}`,s=t.description?`${o}-description`:void 0,c=i?`${o}-error`:void 0,l=[s,c].filter(Boolean).join(` `)||void 0,u=(0,V.jsxs)(V.Fragment,{children:[t.label,t.required&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`ml-0.5 text-accent`,children:`*`})]}),d=`mt-1 w-full min-w-0 rounded-md border border-border bg-bg/45 px-2.5 py-2 text-[12px] text-fg outline-none focus:border-accent focus:ring-1 focus:ring-accent/40`,f;if(t.secret)f=(0,V.jsx)(`div`,{className:`mt-1 text-[11px] text-amber-100/70`,children:`Use the secure fallback below.`});else if(t.input===`multiline`)f=(0,V.jsx)(`textarea`,{id:o,name:t.id,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,minLength:t.minLength,maxLength:t.maxLength,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,rows:4,className:`${d} resize-y`});else if(t.input===`text`){let e=t.format===`email`?`email`:t.format===`uri`?`url`:t.format===`date`?`date`:`text`;f=(0,V.jsx)(`input`,{id:o,name:t.id,type:e,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,minLength:t.minLength,maxLength:t.maxLength,placeholder:t.format===`date-time`?`2026-07-13T12:00:00Z`:void 0,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d})}else if(t.input===`number`||t.input===`integer`)f=(0,V.jsx)(`input`,{id:o,name:t.id,type:`number`,step:t.input===`integer`?1:`any`,min:t.minimum,max:t.maximum,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d});else if(t.input===`boolean`)f=(0,V.jsxs)(`label`,{htmlFor:o,className:`mt-1 flex cursor-pointer items-center gap-2 rounded-md border border-border bg-bg/30 px-2.5 py-2 text-[12px] text-fg/85`,children:[(0,V.jsx)(`input`,{id:o,name:t.id,type:`checkbox`,checked:n===!0,onChange:e=>r(e.target.checked),"aria-describedby":l,autoFocus:a,className:`accent-[var(--color-accent)]`}),(0,V.jsx)(`span`,{children:u})]});else if(t.input===`select`)f=(0,V.jsxs)(`select`,{id:o,name:t.id,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d,children:[(0,V.jsx)(`option`,{value:``,children:`Choose an option…`}),t.options.map((e,t)=>(0,V.jsx)(`option`,{value:String(t),children:e.label},t))]});else if(t.input===`multi-select`){let e=Array.isArray(n)?n:[];f=(0,V.jsxs)(`fieldset`,{id:o,"aria-describedby":l,className:`mt-1 rounded-md border border-border bg-bg/30 px-2.5 py-2`,children:[(0,V.jsx)(`legend`,{className:`px-1 text-[11px] font-medium text-fg/85`,children:u}),(0,V.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.options.map((n,i)=>{let o=String(i);return(0,V.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-[12px] text-fg/85`,children:[(0,V.jsx)(`input`,{type:`checkbox`,name:t.id,value:o,checked:e.includes(o),onChange:t=>r(t.target.checked?[...e,o]:e.filter(e=>e!==o)),autoFocus:a&&i===0,className:`mt-0.5 accent-[var(--color-accent)]`}),(0,V.jsx)(`span`,{children:n.label})]},o)})})]})}return(0,V.jsxs)(`div`,{className:`min-w-0`,children:[t.secret?(0,V.jsx)(`div`,{className:`text-[11px] font-medium text-fg/85`,children:u}):t.input!==`boolean`&&t.input!==`multi-select`?(0,V.jsx)(`label`,{htmlFor:o,className:`block text-[11px] font-medium text-fg/85`,children:u}):null,t.description&&(0,V.jsx)(`div`,{id:s,className:`mt-0.5 whitespace-pre-wrap break-words text-[10.5px] leading-snug text-muted`,children:t.description}),f,i&&(0,V.jsx)(`div`,{id:c,role:`alert`,className:`mt-1 text-[10.5px] text-red-300`,children:i})]})}function x3(e){return(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).length}function S3(e,t={}){let n=(e.subAgents??[]).filter(e=>Oy(e)&&e.state===`running`).length,r=(e.bgShells??[]).filter(e=>e.state===`running`).length,i=t.watchers===!1?0:x3(e),a=[n>0?`${n} sub-agent${n===1?``:`s`}`:null,r>0?`${r} background shell${r===1?``:`s`}`:null,i>0?`${i} PR watcher${i===1?``:`s`}`:null].filter(e=>e!==null);return a.length===0?`0 background shells`:a.length===1?a[0]:`${a.slice(0,-1).join(`, `)} and ${a[a.length-1]}`}function C3(e){return(e.subAgents??[]).some(e=>Oy(e)&&e.state===`running`)}function w3(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length}function T3(e){return C3(e)||w3(e)>0}function E3(e){return D3(e)?`Background shells running`:`Awaiting`}function D3(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length>0&&!C3(e)&&x3(e)===0&&O3(e).length===0}function O3(e){return(e.watches??[]).filter(e=>e.kind===`timer`&&e.state===`armed`)}var k3={mergeable:`no conflicts`,blocked:`merge blocked`,conflicting:`has conflicts`,unknown:null};function A3(e){return e.state!==`open`||e.merge===`blocked`&&e.checks!==`passing`&&e.checks!==`none`?null:k3[e.merge]}var j3=`shrink-0 self-baseline translate-y-[calc(0.5em_-_0.5cap)]`;function M3({tone:e}){return(0,V.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-3 rounded-full border ${e} border-t-transparent motion-safe:animate-spin ${j3}`})}function N3({status:e}){return e?e.state===`merged`?(0,V.jsx)($C,{size:12,className:`${j3} text-purple-400`}):e.state===`closed`?(0,V.jsx)(ew,{size:12,className:`${j3} text-red-400`}):e.checks===`failing`?(0,V.jsx)(GC,{size:12,className:`${j3} text-red-400`}):e.checks===`passing`?(0,V.jsx)(BC,{size:12,className:`${j3} text-emerald-500`}):e.checks===`running`?(0,V.jsx)(M3,{tone:`border-amber-400`}):(0,V.jsx)(VC,{size:12,className:`${j3} text-muted/60`}):(0,V.jsx)(VC,{size:12,className:`${j3} text-muted/60`})}function P3(e){return[e.failed>0?`${e.failed} failing`:null,e.running>0?`${e.running} in progress`:null,e.passed>0?`${e.passed} successful`:null].filter(e=>e!==null).join(`, `)}function F3(e){if(!e)return`Checking…`;if(e.state===`merged`)return`Merged`;if(e.state===`closed`)return`Closed`;let t=P3(e),n=A3(e);return[t||`No checks`,n].filter(e=>e!==null).join(` · `)}var I3=`group relative col-span-4 grid grid-cols-subgrid items-baseline rounded-sm text-[12px] leading-5`,L3=`ml-1.5 min-w-0 truncate font-medium text-fg/90`,R3=`ml-3 min-w-0 truncate text-right text-muted/70`,z3=`outline-none after:absolute after:inset-0 after:rounded-sm focus-visible:after:ring-1 focus-visible:after:ring-fg/60`;function B3(){return(0,V.jsx)(LC,{size:13,"aria-hidden":!0,className:`${j3} ml-[3px] -mr-[4px] text-muted/35 transition-colors group-hover:text-muted/70`})}function V3({mark:e,name:t,status:n,onOpen:r,href:i,title:a,testKind:o,testId:s}){let c=i?(0,V.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer noopener`,title:a,onMouseDown:e=>e.stopPropagation(),className:`${L3} ${z3} group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):r?(0,V.jsx)(`button`,{type:`button`,onClick:r,onMouseDown:e=>e.stopPropagation(),title:a,className:`${L3} ${z3} text-left group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):(0,V.jsx)(`span`,{className:L3,title:a,children:t}),l=!!(i||r);return(0,V.jsxs)(`div`,{"data-wait-row":s,"data-wait-kind":o,className:`${I3} ${l?`cursor-pointer transition-colors hover:bg-fg/[0.045]`:``}`,children:[(0,V.jsx)(`span`,{className:`flex shrink-0`,children:e}),c,(0,V.jsx)(`span`,{"data-wait-status":!0,className:R3,children:n}),l?(0,V.jsx)(B3,{}):(0,V.jsx)(`span`,{})]})}function H3({watch:e}){let t=e.github,n=nJ(e.target);return(0,V.jsx)(V3,{testKind:`github`,testId:e.target,mark:(0,V.jsx)(N3,{status:t}),name:e.target,href:n??void 0,title:n?`Open ${e.target} on GitHub`:e.target,status:(0,V.jsxs)(V.Fragment,{children:[F3(t),t&&t.failing.length>0&&n&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsx)(`a`,{href:`${n}/checks`,target:`_blank`,rel:`noreferrer noopener`,onMouseDown:e=>e.stopPropagation(),className:`relative text-red-400/85 underline decoration-red-400/30 underline-offset-2 hover:decoration-red-400`,children:`view failures`})]})]})})}function U3(e,t){return(e.bgShells??[]).find(e=>e.id===t||e.taskId===t||e.label===t)}function W3(e){return(e.watches??[]).filter(e=>e.kind===`shell`&&e.state===`armed`)}function G3({watch:e,thread:t,slug:n,now:r}){let i=U3(t,e.target),a=nN(i?.startedAt??e.createdAt,r),o=i?.id&&!i.outputUnavailable;return(0,V.jsx)(V3,{testKind:`shell`,testId:e.target,mark:(0,V.jsx)(kw,{size:12,className:`${j3} text-shell`}),name:i?.label??e.target,onOpen:o?()=>GS(n,i.id,{label:i.label,startedAt:i.startedAt}):void 0,title:o?`Read this shell's output — running for ${a}`:i?.label??e.target,status:a?`running · ${a}`:`running`})}function K3({watch:e,now:t}){let n=Date.parse(e.timer?.fireAt??``),r=Number.isFinite(n)?n>t?`fires in ${eN(n-t)}`:`firing…`:`armed`;return(0,V.jsx)(V3,{testKind:`timer`,testId:e.target,mark:(0,V.jsx)(KC,{size:12,className:`${j3} text-muted/60`}),name:e.timer?.prompt||e.target,title:e.timer?.fireAt?`One-off timer, set for ${e.timer.fireAt}`:e.target,status:r})}function q3(e){return(e.subAgents??[]).filter(e=>Oy(e)&&e.state===`running`)}function J3({agent:e,slug:t,now:n}){let r=nN(e.startedAt,n),i=e.subagentType?.replace(/^frizz:/,``);return(0,V.jsx)(V3,{testKind:`agent`,testId:e.id??e.label,mark:(0,V.jsx)(M3,{tone:`border-accent`}),name:e.label,onOpen:e.id?()=>WS(t,e.id,{label:e.label,subagentType:e.subagentType,startedAt:e.startedAt}):void 0,title:e.id?`Open this sub-agent — working for ${r}`:e.label,status:[i,r].filter(Boolean).join(` · `)})}function Y3(e){return e?.awaitingBackground===!0&&e.runtime===`turn-idle`&&e.bgSnoozed!==!0}function X3({thread:e,actions:t}){let n=C3(e),r=fJ(e.lastFence?.kind===`awaiting`?e.lastFence.body:void 0),i=e1(o$(r??``)),a=UM(),o=(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`),s=W3(e),c=q3(e),l=O3(e),u=[{head:`Sub-agents`,rows:c.map(t=>(0,V.jsx)(J3,{agent:t,slug:e.id,now:a},t.id??t.label))},{head:`Background shells`,rows:s.map(t=>(0,V.jsx)(G3,{watch:t,thread:e,slug:e.id,now:a},t.id))},{head:`Pull requests`,rows:o.map(e=>(0,V.jsx)(H3,{watch:e},e.id))},{head:`Timers`,rows:l.map(e=>(0,V.jsx)(K3,{watch:e,now:a},e.id))}].filter(e=>e.rows.length>0);return(0,V.jsxs)(J1,{"data-awaiting-background":!0,icon:D3(e)?kw:iw,label:E3(e),className:t?`pb-0`:``,children:[r&&(0,V.jsx)(`div`,{className:`md-body [overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`,dangerouslySetInnerHTML:i}),u.length===0&&T3(e)&&(0,V.jsx)(`p`,{className:`block min-w-0 text-[13px] leading-5 text-fg/75`,children:n?(0,V.jsxs)(V.Fragment,{children:[`It’s awaiting the results from `,S3(e,{watchers:!1}),` it dispatched. It returns to the queue on its own when the work comes back.`]}):(0,V.jsxs)(V.Fragment,{children:[S3(e,{watchers:!1}),` `,w3(e)===1?`is`:`are`,` still running. It resumes on its own when`,` `,w3(e)===1?`it finishes`:`one of them finishes`,`.`]})}),r&&u.length>0&&(0,V.jsx)(`div`,{"aria-hidden":!0,className:`-mx-4 mt-3 border-t border-border`}),u.length>0&&(0,V.jsx)(`div`,{className:`mt-3 grid grid-cols-[auto_1fr_auto_auto] gap-y-px`,children:u.map((e,t)=>(0,V.jsxs)(B.Fragment,{children:[(0,V.jsx)(`div`,{className:`col-span-4 text-[10.5px] uppercase tracking-wide text-muted/45 ${t>0?`mt-2.5`:``}`,children:e.head}),e.rows]},e.head))}),t?(0,V.jsx)(`div`,{className:`-mx-4 mt-3 flex flex-wrap items-center gap-x-2.5 gap-y-2 border-t border-border bg-fg/[0.03] px-4 py-2.5 ${U1}`,children:t}):null]})}function Z3(e,t=Date.now()){return e!==void 0&&_M(e,t)!==void 0}function Q3(){let[e,t]=(0,B.useState)(()=>Date.now());return(0,B.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function $3({thread:e}){let t=Q3(),[n,r]=(0,B.useState)(!1),i=_M(e,t);if(!i)return null;let a=Date.parse(i),o=Fj(i,t).replace(/^(Today|Tomorrow)/,e=>e.toLowerCase()),s=e.snoozePrompt?.trim();async function c(){r(!0);try{await X.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:null,prompt:null}),Q(`Snooze cleared`)}catch(e){Q((e instanceof Error?e.message:`Wake failed`).slice(0,100))}finally{r(!1)}}return(0,V.jsxs)(J1,{"data-snooze-card":!0,icon:iw,label:`Snoozed`,children:[(0,V.jsx)(`div`,{"data-snooze-countdown":!0,title:new Date(a).toLocaleString(),className:`text-[22px] font-semibold leading-8 tracking-tight text-fg tabular-nums`,children:iN(a-t)}),(0,V.jsx)(`p`,{className:Y1,children:s?(0,V.jsxs)(V.Fragment,{children:[`Resumes `,o,` and sends: “`,zj(s),`”`]}):(0,V.jsxs)(V.Fragment,{children:[`Returns to the queue `,o,`.`]})}),e.foreign!==!0&&(0,V.jsx)(X1,{children:(0,V.jsx)(`button`,{type:`button`,"data-snooze-wake-now":!0,disabled:n,onClick:()=>void c(),className:`${$1} disabled:cursor-not-allowed disabled:opacity-45`,children:`Wake now`})})]})}function e6({at:e,fallbackAt:t,className:n=``}){let r=UM(),i=AM(e,t),a=jM(i,r);return!a||!i?null:(0,V.jsx)(`time`,{dateTime:i,className:n,children:a})}var t6=1500;function n6(e,t){let n=0,r;function i(){r!==void 0&&(t.clearTimeout(r),r=void 0)}return{begin(){let a=++n;return e(!0),i(),r=t.setTimeout(()=>{a===n&&e(!1),r=void 0},t6),a},fail(t){t===n&&(i(),e(!1))},dispose(){n++,i()}}}var r6=`Could not copy terminal command`,i6={attach:`Attach command copied`,resume:`Resume command copied`},a6={attach:`Copy command to attach to this thread's live terminal`,resume:`Copy command to resume this thread in a new terminal`},o6=e=>[`terminalCommand`,e];function s6(e){return X.threadTerminalCommand({slug:e}).then(e=>{if(!e.command)throw Error(e.reason??`No verified provider session is available to resume`);return{command:e.command,mode:e.mode===`attach`?`attach`:`resume`}})}async function c6(e){let t=s6(e);if(typeof ClipboardItem<`u`&&navigator.clipboard?.write)return await navigator.clipboard.write([new ClipboardItem({"text/plain":t.then(({command:e})=>new Blob([e],{type:`text/plain`}))})]),(await t).mode;let{command:n,mode:r}=await t;return await bU(n),r}function l6(e){let t=Jd({mutationFn:()=>c6(e)});return e=>t.mutate(void 0,{onSuccess:t=>{e?.onSuccess?.(),Q(i6[t])},onError:t=>{e?.onError?.(),Q(t instanceof Error?`${r6}: ${t.message}`:r6,{duration:7e3})}})}function u6({slug:e}){let[t,n]=(0,B.useState)(!1),r=(0,B.useRef)(null);r.current||=n6(n,{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)});let i=Md(),a=l6(e);(0,B.useEffect)(()=>()=>r.current?.dispose(),[]);function o(){i.prefetchQuery({queryKey:o6(e),queryFn:()=>s6(e),staleTime:15e3})}function s(){let t=i.getQueryData(o6(e));if(t){bU(t.command).then(()=>{r.current?.begin(),Q(i6[t.mode])},()=>Q(r6,{duration:7e3}));return}a({onSuccess:()=>r.current?.begin()})}let c=i.getQueryData(o6(e)),l=t?c?i6[c.mode]:`Terminal command copied`:c?a6[c.mode]:`Copy terminal command`;return(0,V.jsx)(Pq,{label:l,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":l,title:l,onClick:s,onPointerEnter:o,onFocus:o,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:t?(0,V.jsx)(PC,{size:14,strokeWidth:2.2,className:`text-fg`}):(0,V.jsx)(kw,{size:14,strokeWidth:1.8})})})}function d6(e){let t=Math.max(e.scrollHeight-e.clientHeight,0),n=t-e.scrollTop,r=e.scrollHeight!==e.previousScrollHeight,i=r&&!e.readerMoved?e.following||n<=1:n<=4;return!i||!r||t<=0||n<=1?{following:i,scrollTop:null}:{following:i,scrollTop:t}}function f6(e){let t=e.scrollTop>640?!0:e.armed,n=t&&e.readerMoved&&e.scrollTop<=480&&e.hasEarlier&&!e.loading;return{armed:n?!1:t,shouldLoad:n}}function p6(e){return`legacy:${e.role}:${e.kind??`message`}:${e.at??``}:${e.text}`}function m6(e,t,n){let r=[],i=new Map,a=null;return e.forEach((e,o)=>{if(e.queued||t(e))return;let s=e.sourceId??p6(e),c=i.get(s)??0;i.set(s,c+1),r.push({key:c===0?s:`${s}:${c}`,message:e,messageIndex:o,gap:a===null?0:n(a,e)}),a=e}),r}function h6(e,t,n){let r=e[t];if(!r||r.kind!==`event`||r.boundary!==`rest`)return!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(!(t.queued||n(t)))return!!t.boundary||t.wake===!0}return!0}function g6(e,t){let n=e.map(e=>e.message);return e.filter((e,r)=>!h6(n,r,t))}var _6=new Set([`agent`,`follow up`,`interrupt`,`send message`,`spawn agent`,`wait for agents`]),v6=new Set([`poll process`,`wait`]);function y6(e){return(e.split(`__`).pop()||e).replaceAll(`_`,` `).trim()}function b6(e){return y6(e).toLowerCase()}function x6(e){return e.prompt!==void 0||e.agentId!==void 0||e.sendTo!==void 0||e.sendBody!==void 0||e.backgroundState!==void 0&&!C6(e)||S6(e)||_6.has(b6(e.name))}function S6(e){return e.outputImage!==void 0||e.sentImages!==void 0&&e.sentImages.length>0}function C6(e){return e.backgroundState===`unknown`&&v6.has(b6(e.name))}function w6(e){if(e.role!==`assistant`||e.kind||e.queued)return null;if(e.parts&&e.parts.length>0){let t=[];for(let n of e.parts)if(n.kind===`text`){if(n.text.trim())return null}else t.push(...n.tools);return t.length>0&&t.every(e=>!x6(e))?t:null}return e.text.trim()||e.tools.length===0?null:e.tools.every(e=>!x6(e))?e.tools:null}function T6(e){return e.role!==`assistant`||e.kind||e.queued||e.text.trim()||e.tools.length>0?!1:!e.parts?.some(e=>e.kind===`text`?e.text.trim().length>0:e.tools.length>0)}function E6(e){if(e.role!==`assistant`||e.kind||e.queued)return null;if(!e.parts?.length)return w6(e);for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.kind===`text`){if(n.text.trim())return null;continue}if(n.tools.length!==0)return n.tools.every(e=>!x6(e))?n.tools:null}return null}function D6(e,t,n){let r=[...e.tools,...t],i=e.parts?.map(e=>e.kind===`text`?e:{...e,tools:[...e.tools]})??[],a=-1;for(let e=i.length-1;e>=0;e--){let t=i[e];if(t.kind===`text`){if(t.text.trim())break;continue}if(t.tools.length>0){a=e;break}}let o=i[a];return o?.kind===`tools`?i[a]={kind:`tools`,tools:[...o.tools,...t]}:i.push({kind:`tools`,tools:t}),{...e,at:n??e.at,tools:r,parts:i}}function O6(e){let t=[],n=null;return e.forEach((e,r)=>{if(T6(e))return;if(e.queued){t.push({message:e,messageIndex:r});return}let i=w6(e);if(i&&n){n.message=D6(n.message,i,e.at);return}let a={message:e,messageIndex:r};t.push(a),E6(e)?(a.runStartedAt=e.at,n=a):n=null}),t}function k6(e){return e.status===`completed`||e.status===`failed`||e.status===`cancelled`}function A6(e){let t=j6(e);return t?.tools.some(e=>!k6(e))?t.tools.at(-1):void 0}function j6(e){let t=M6(e);if(!t)return;let n=E6(t.message);return n?{tools:n,at:t.message.at}:void 0}function M6(e){for(let t=e.length-1;t>=0;t--)if(!e[t].message.queued)return e[t]}function N6(e){let t=M6(e);if(t)return E6(t.message)?t.runStartedAt??t.message.at:t.message.at}function P6(e){let t=E6(e);if(!t)return e;let n=e.tools.length>=t.length?e.tools.slice(0,e.tools.length-t.length):e.tools.filter(e=>!t.includes(e)),r=!1,i=e.parts?e.parts.reduceRight((e,n)=>!r&&n.kind===`tools`&&n.tools===t?(r=!0,e):(e.unshift(n),e),[]):e.parts;return{...e,tools:n,parts:i}}function F6(e){let t;for(let n=e.length-1;n>=0;n--){let r=e[n].message;if(!r.queued){E6(r)&&(t=r);break}}if(!t)return[...e];let n=[];for(let r of e){let e=r.message===t?P6(r.message):r.message;T6(e)||n.push(e===r.message?r:{...r,message:e})}return n}function I6(e){return e.detail?.trim()||void 0}var L6={add:`Adding`,analyze:`Analyzing`,apply:`Applying`,audit:`Auditing`,benchmark:`Benchmarking`,build:`Building`,bump:`Bumping`,capture:`Capturing`,check:`Checking`,clean:`Cleaning`,collect:`Collecting`,commit:`Committing`,compare:`Comparing`,confirm:`Confirming`,copy:`Copying`,count:`Counting`,create:`Creating`,debug:`Debugging`,delete:`Deleting`,diff:`Diffing`,disable:`Disabling`,dispatch:`Dispatching`,drive:`Driving`,dump:`Dumping`,edit:`Editing`,enable:`Enabling`,extract:`Extracting`,fetch:`Fetching`,find:`Finding`,fix:`Fixing`,format:`Formatting`,generate:`Generating`,grep:`Grepping`,inspect:`Inspecting`,install:`Installing`,kill:`Killing`,launch:`Launching`,lint:`Linting`,list:`Listing`,load:`Loading`,measure:`Measuring`,merge:`Merging`,migrate:`Migrating`,move:`Moving`,open:`Opening`,parse:`Parsing`,patch:`Patching`,poll:`Polling`,print:`Printing`,probe:`Probing`,profile:`Profiling`,publish:`Publishing`,pull:`Pulling`,push:`Pushing`,query:`Querying`,read:`Reading`,rebase:`Rebasing`,refactor:`Refactoring`,regenerate:`Regenerating`,remove:`Removing`,rename:`Renaming`,render:`Rendering`,reproduce:`Reproducing`,restart:`Restarting`,revert:`Reverting`,review:`Reviewing`,run:`Running`,save:`Saving`,scan:`Scanning`,search:`Searching`,seed:`Seeding`,spawn:`Spawning`,start:`Starting`,stop:`Stopping`,summarize:`Summarizing`,sync:`Syncing`,tag:`Tagging`,test:`Testing`,trace:`Tracing`,typecheck:`Typechecking`,update:`Updating`,validate:`Validating`,verify:`Verifying`,wait:`Waiting`,watch:`Watching`,write:`Writing`};function R6(e,t){let n=e?.trim();if(!n)return t;let r=n.indexOf(` `),i=(r===-1?n:n.slice(0,r)).replace(/[.:]$/,``);if(/ing$/i.test(i))return i.charAt(0).toUpperCase()+i.slice(1)+(r===-1?``:n.slice(r));let a=L6[i.toLowerCase()];return a?a+(r===-1?``:n.slice(r)):n.charAt(0).toUpperCase()+n.slice(1)}function z6(e,t){let n=t?.trim().replace(/\/+$/,``);if(!n||n===`/`||!n.startsWith(`/`))return e;let r=e.replaceAll(`${n}/`,``),i=/^(\/(?:Users|home)\/[^/]+)(?:\/|$)/.exec(n)?.[1];return i?r.replaceAll(`${i}/`,`~/`):r}function B6(e,t){return z6(V6(e),t)}function V6(e){let t=b6(e.name),n=I6(e),r=n?` ${n}`:``;return t===`bash`||t===`exec`||t===`run command`?R6(e.desc,n?`Running ${n}`:`Running a command`):t===`read`||t===`view image`?`Reading${r||` a file`}`:t===`grep`||t===`search`||t===`search query`||t===`find`?n?`Searching for ${n}`:`Searching`:t===`glob`||t===`find files`?n?`Finding ${n}`:`Finding files`:t===`edit`||t===`write`||t===`apply patch`?n?`Editing ${n}`:`Editing files`:t===`todos`||t===`update plan`?`Updating the plan`:t===`screenshot`||t===`snapshot`?n?`Capturing ${n}`:`Capturing the page`:t===`navigate`?n?`Navigating to ${n}`:`Navigating`:t===`evaluate`?`Evaluating the page`:t===`pages`?`Listing pages`:t===`new page`?`Opening a new page`:t===`close page`?`Closing the page`:t===`select page`?`Selecting a page`:t===`console`||t===`console message`?`Reading the console`:t===`network`||t===`network request`?`Inspecting network traffic`:t===`press key`?n?`Pressing ${n}`:`Pressing a key`:t===`fill form`?`Filling the form`:t===`dialog`?`Handling a dialog`:t===`upload`?n?`Uploading ${n}`:`Uploading a file`:t===`wait for`||t===`wait`?n?`Waiting for ${n}`:`Waiting`:t===`resize`?`Resizing the page`:t===`ask`?`Preparing a question`:t===`web`||t===`web search`?n?`Searching for ${n}`:`Searching the web`:`Using ${y6(e.name)||`a tool`}`}var H6=new Set([`edit`,`multiedit`,`write`,`apply patch`]);function U6(e){let t=new Set;for(let n of e){for(let e of n.edits??(n.edit?[n.edit]:[]))e.file.trim()&&t.add(e.file.trim());if(n.edit||n.edits?.length)continue;let e=n.detail?.trim();e&&H6.has(b6(n.name))&&t.add(e)}return t.size}function W6(e,t=0){let n=`Ran ${e} tool ${e===1?`call`:`calls`}`;return t===0?n:`${n}, edited ${t} file${t===1?``:`s`}`}function G6(e){return e>0?`${W6(e)}. Thinking…`:`Thinking…`}function K6(e,t){let n=e[t];return typeof n==`string`&&n?n:void 0}function q6(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function J6(e,t){let n=K6(e,t);if(n)try{let e=new URL(n);return e.protocol===`https:`||e.protocol===`http:`?e.href:void 0}catch{return}}function Y6({directive:e,icon:t,title:n,meta:r,children:i}){return(0,V.jsxs)(`section`,{"data-codex-directive":e.name,className:`min-w-0 ${V1} border border-border bg-panel-2/75 p-4`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-muted`,"aria-hidden":!0,children:t}),(0,V.jsx)(`div`,{className:`max-w-[calc(100%-1.5rem)] shrink-0 break-words text-[12px] font-medium leading-4 text-fg`,children:n}),r&&(0,V.jsx)(`div`,{className:`min-w-0 truncate text-[11px] font-normal leading-4 text-muted`,children:r})]}),i]})}function X6({children:e,mono:t=!1}){return(0,V.jsx)(`div`,{className:`ml-6 mt-1 break-words text-[11px] leading-4 text-muted${t?` font-mono-keep`:``}`,children:e})}function Z6({directive:e}){let t=e.attrs,n=K6(t,`display_name`)??K6(t,`skill_name`)??`Artifact template`,r=K6(t,`artifact_kind`),i=K6(t,`skill_name`),a=K6(t,`skill_directory`),[o,s]=(0,B.useState)(!!a);return(0,V.jsxs)(Y6,{directive:e,icon:(0,V.jsx)(lw,{size:15}),title:n,meta:r?`${r} template`:`Template`,children:[i&&(0,V.jsx)(X6,{mono:!0,children:i.startsWith(`$`)?i:`$${i}`}),o&&a&&(0,V.jsx)(`img`,{src:RH(`${a}/assets/preview.png`),alt:`${n} template preview`,loading:`lazy`,onError:()=>s(!1),className:`ml-6 mt-2 max-h-44 max-w-[calc(100%-1.5rem)] rounded-md border border-border object-contain`})]})}function Q6({directive:e}){let t=e.attrs,n=K6(t,`file`),r=q6(t,`start`),i=q6(t,`end`)??r,a=q6(t,`priority`),o=n?`${n}${r?`:${r}${i&&i!==r?`-${i}`:``}`:``}`:`Code location unavailable`;return(0,V.jsxs)(Y6,{directive:e,icon:(0,V.jsx)(fw,{size:15}),title:K6(t,`title`)??`Review finding`,meta:a===void 0?void 0:`P${a}`,children:[K6(t,`body`)&&(0,V.jsx)(X6,{children:K6(t,`body`)}),n?(0,V.jsx)(`button`,{type:`button`,className:`local-file-action ml-6 mt-1 max-w-[calc(100%-1.5rem)] break-all text-left font-mono-keep text-[11px] leading-4 text-accent underline decoration-dotted underline-offset-2`,"data-local-path":n,title:o,children:o}):(0,V.jsx)(X6,{mono:!0,children:o})]})}var $6={"git-stage":[hw,`Changes staged`],"git-commit":[QC,`Commit created`],"git-create-branch":[ZC,`Branch created`],"git-push":[Nw,`Branch pushed`],"git-create-pr":[nw,`Pull request created`]};function e8({directive:e}){let[t,n]=$6[e.name],r=K6(e.attrs,`branch`),i=J6(e.attrs,`url`),a=`${n}${e.attrs.isDraft===!0?` as draft`:``}`;return(0,V.jsx)(Y6,{directive:e,icon:(0,V.jsx)(t,{size:15}),title:i?(0,V.jsx)(`a`,{className:`text-accent underline underline-offset-2`,href:i,target:`_blank`,rel:`noopener noreferrer`,children:a}):a,meta:r&&(0,V.jsx)(`span`,{className:`font-mono-keep`,children:r})})}function t8({directive:e}){let t=K6(e.attrs,`threadId`),n=K6(e.attrs,`pendingWorktreeId`);return(0,V.jsx)(Y6,{directive:e,icon:(0,V.jsx)(mw,{size:15}),title:n?`Thread setup queued`:`Thread created`,meta:(t||n)&&(0,V.jsx)(`span`,{className:`font-mono-keep`,children:t??n})})}function n8({directive:e}){let t=K6(e.attrs,`reason`);return(0,V.jsx)(Y6,{directive:e,icon:(0,V.jsx)(EC,{size:15}),title:`Archive suggested`,meta:t})}function r8(e){if(typeof e!=`string`||!e)return;let t=e.match(/(?:^|;)INTERVAL=(\d+)(?:;|$)/)?.[1];return/(?:^|;)FREQ=HOURLY(?:;|$)/.test(e)?`Every ${t??`1`} hour${t===`1`||t===void 0?``:`s`}`:/(?:^|;)FREQ=WEEKLY(?:;|$)/.test(e)?`Weekly schedule`:`Custom schedule`}function i8({directive:e}){let t=e.attrs,n=K6(t,`mode`),r=K6(t,`name`)??`Automation`,i=r8(t.rrule),a=[r,n,K6(t,`status`),i].filter(Boolean).join(` · `);return(0,V.jsx)(Y6,{directive:e,icon:(0,V.jsx)(NC,{size:15}),title:`Automation suggested`,meta:a,children:K6(t,`prompt`)&&(0,V.jsx)(X6,{children:K6(t,`prompt`)})})}function a8({directive:e}){return e.name===`artifact-template`?(0,V.jsx)(Z6,{directive:e}):e.name===`code-comment`?(0,V.jsx)(Q6,{directive:e}):e.name.startsWith(`git-`)?(0,V.jsx)(e8,{directive:e}):e.name===`created-thread`?(0,V.jsx)(t8,{directive:e}):e.name===`archive`||e.name===`archive-thread`?(0,V.jsx)(n8,{directive:e}):(0,V.jsx)(i8,{directive:e})}var o8;function s8(){return o8??=UO(async()=>{let{default:e}=await import(`./mermaid.core-C5yyeZnx.js`);return{default:e}},__vite__mapDeps([2,3,4,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`dark`,themeVariables:{background:`#181b20`,primaryColor:`#181b20`,primaryTextColor:`#e6e7e9`,primaryBorderColor:`#33363c`,lineColor:`#8b8f96`,secondaryColor:`#26282d`,tertiaryColor:`#0d0e10`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`}}),e)),o8}function c8({source:e}){let t=(0,B.useId)(),[n,r]=(0,B.useState)({}),i=e1(n.html??``);return(0,B.useEffect)(()=>{let n=!0;if(r({}),e.length>5e4)return r({error:`Diagram source exceeds the 50 KB rendering limit`}),()=>{n=!1};let i=`frizz-mermaid-${t.replace(/[^a-zA-Z0-9]/g,``)}`;return s8().then(t=>t.render(i,e)).then(({svg:e})=>{n&&r({html:e})}).catch(e=>{if(!n)return;let t=e instanceof Error?e.message.split(/\n| for text:/,1)[0]:`Unknown diagram error`;r({error:t.slice(0,240)})}).finally(()=>document.getElementById(`d${i}`)?.remove()),()=>{n=!1}},[t,e]),n.error?(0,V.jsxs)(`section`,{"data-mermaid-state":`error`,className:`${V1} border border-border bg-panel-2/75 p-4`,children:[(0,V.jsx)(`div`,{className:`text-[12px] font-medium text-fg`,children:`Diagram unavailable`}),(0,V.jsx)(`div`,{className:`mt-1 text-[11px] text-muted`,children:n.error}),(0,V.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap rounded-md bg-bg p-2 font-mono-keep text-[11px] text-muted`,children:e})]}):n.html?(0,V.jsx)(`div`,{"data-mermaid-state":`ready`,className:`overflow-x-auto ${V1} border border-border bg-panel-2/75 p-4 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:i}):(0,V.jsx)(`div`,{"data-mermaid-state":`loading`,role:`status`,"aria-label":`Rendering diagram`,className:`h-24 animate-pulse ${V1} bg-panel-2`})}var l8=(0,B.createContext)(null),u8=(0,B.createContext)(null);function d8(){let e=(0,B.useContext)(l8),t=(0,B.useContext)(u8);return e??t}var f8=(0,B.createContext)(null);function p8(e){return e.status===`pending`&&e.backgroundState===`background`}function m8(e){let t=[];for(let n of e)for(let e of n.tools)p8(e)&&n.at&&t.push({label:e.desc??e.detail??e.command??`Background command`,startedAt:n.at,state:`running`,...e.shellId?{launchId:e.shellId}:{},...e.command?{command:e.command}:{}});return t}function h8(e){return e.map(e=>{if(!e.tools.some(p8))return e;let t=e.tools.filter(e=>!p8(e)),n=e.parts?.map(e=>e.kind===`tools`?{...e,tools:e.tools.filter(e=>!p8(e))}:e).filter(e=>e.kind!==`tools`||e.tools.length>0);return{...e,tools:t,parts:n}})}function g8({slug:e,onStatusApplied:t,onClose:n,virtualized:r=!1,showReturnToQueue:i=!1}){let a=sC(ej(),e);return(0,V.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,V.jsx)(C8,{slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:i}),(0,V.jsx)(_8,{slug:e,virtualized:r}),a&&(0,V.jsx)(d4,{thread:a,sticky:!0,safeArea:!0,onArchived:t})]})}function _8({slug:e,virtualized:t}){let n=ej(),r=sC(n,e),i=r?.runtime===`running`||r?.runtime===`spawning`,a=l6(e),o=r?.pendingInteraction?void 0:r?.pendingAsk,s=uj(e,{poll:i}),c=Md(),l=(0,B.useRef)(!1),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(null),m=(0,B.useMemo)(()=>s.data?.messages??[],[s.data]),h=(0,B.useMemo)(()=>m8(m),[m]),g=(0,B.useMemo)(()=>h8(m),[m]),_=(0,B.useMemo)(()=>L8(g),[g]),v=(0,B.useMemo)(()=>O6(g),[g]),y=i?j6(v):void 0,b=i?A6(v):void 0,x=b?B6(b,n?.projectDir):void 0,S=i?N6(v):void 0,C=(0,B.useMemo)(()=>{let e=i?F6(v):v;return g6(e,R8(e,_))},[v,i,_]),w=i,T=(0,B.useMemo)(()=>z1(m),[m]),E=(0,B.useMemo)(()=>Q0(m),[m]),{stickyUserMessage:D}=Hf(qj),{answeringForMessage:O}=k0(e,m),k=(0,B.useRef)(null),[A,j]=(0,B.useState)(null),M=s.data?.messages.length??0;(0,B.useEffect)(()=>{if(t)return;let e=k.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<=4&&(e.scrollTop=e.scrollHeight)},[M,i,t]);let N=(0,B.useCallback)(async()=>{if(l.current)return;let t=c.getQueryData([`transcript`,e]),n=t?.beforeCursor,r=t?.transcriptKey;if(!(!t?.hasEarlier||!n||!r)){l.current=!0,d(!0),p(null);try{let t=await X.threadTranscriptEarlier({slug:e,cursor:n}),i=c.getQueryData([`transcript`,e]);if(!i?.transcriptKey||i.transcriptKey!==r||t.transcriptKey!==r){await s.refetch(),Q(`Transcript changed while loading history; refreshed the current session`);return}c.setQueryData([`transcript`,e],gA(i,t))}catch(e){let t=e instanceof Error?e.message:`Could not load earlier transcript history`;p(t)}finally{l.current=!1,d(!1)}}},[s,c,e]);return(0,V.jsx)(l8.Provider,{value:e,children:(0,V.jsxs)(`div`,{"data-drawer-scroll-ready":s.isPending?`false`:`true`,className:`flex-1 min-h-0 flex flex-col overflow-hidden outline-none`,children:[(0,V.jsxs)(`div`,{className:`relative min-h-0 flex-1 flex flex-col`,children:[(0,V.jsx)(`div`,{ref:k,"data-drawer-transcript-scroll":!0,"data-virtualized-transcript-scroll":t||void 0,tabIndex:t?0:void 0,role:t?`region`:void 0,"aria-label":t?`Thread conversation`:void 0,"aria-busy":t&&u?!0:void 0,className:`relative min-h-0 flex-1 overflow-y-auto pb-3 outline-none [overflow-anchor:none] focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:t&&M>0?(0,V.jsx)(x8,{slug:e,transcriptRef:k,transcriptKey:s.data?.transcriptKey,messages:g,paired:T,answeringForMessage:O,thread:r,running:i,copyTerminalCommand:a,stickyUserMessage:D,transportFallback:s.transportFallback,isFetching:s.isFetching,refresh:()=>void s.refetch(),retryLiveUpdates:s.retryLiveUpdates,hasEarlier:s.data?.hasEarlier===!0,beforeCursor:s.data?.beforeCursor,loadingEarlier:u,earlierError:f,loadEarlier:()=>void N(),jumpOverlay:A}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(l3,{thread:r,className:`px-6 pt-5`,autoFocusFirst:!0}),s.transportFallback&&(0,V.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`mx-6 mt-3 flex flex-wrap items-center gap-2.5 rounded-xl border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:s.transportFallback.kind===`payload-too-large`?`Live payload ${s.transportFallback.actualBytes} bytes; socket limit ${s.transportFallback.maxBytes} bytes`:`Transcript read budget reached (${s.transportFallback.scope}); retry after about ${s.transportFallback.retryAfterMs}ms`,children:[(0,V.jsx)(Mw,{size:13,className:`shrink-0 text-muted`}),(0,V.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,s.transportFallback.kind===`payload-too-large`?`The transcript is too large for push; the last complete HTTP-loaded copy remains visible.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,V.jsx)(`button`,{type:`button`,disabled:s.isFetching,onClick:()=>void s.refetch(),className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-40`,children:s.isFetching?`Refreshing…`:`Refresh once`}),(0,V.jsx)(`button`,{type:`button`,onClick:s.retryLiveUpdates,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`,children:`Retry live`})]}),(0,V.jsx)(`div`,{"data-transcript-column":!0,className:`flex min-h-full flex-col px-6 py-5`,children:M===0?(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted`,children:s.isPending?(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(G5,{}),` Loading…`]}):i?(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(G5,{}),` Session starting…`]}):t2(r)?(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`p`,{className:`mb-3`,children:`No session is attached to this thread yet.`}),(0,V.jsx)(`button`,{className:`btn-ghost border border-border text-[12px]`,onClick:()=>X.adoptThread({slug:e}).catch(()=>{}),children:`Start a session on this thread`})]}):`No conversation yet.`}):(0,V.jsxs)(V.Fragment,{children:[H8(C.map(e=>e.message),(e,t)=>{let n=C[t].messageIndex,r=n===E&&D,i=(0,V.jsx)(S5,{m:e,answering:O(e),showSendButton:!0,paired:T[n],sticky:r,staleAwaiting:_>=0&&n<_},t);return r?(0,V.jsx)(b5,{children:i},t):i},e=>!!e.queued),(r?.providerFault||r?.limitPause||o||r?.runtime===`perm-prompt`||w||Z3(r)||r?.awaitingBackground)&&(0,V.jsx)(e0,{h:w&&!r?.providerFault&&!r?.limitPause&&!o&&r?.runtime!==`perm-prompt`?V8(C.map(e=>e.message)):14}),r?.providerFault&&!r.foreign?(0,V.jsx)(N5,{slug:e,sessionId:r.sessionId,fault:r.providerFault,retryText:E>=0?m[E]?.text:void 0}):r?.limitPause&&!r.foreign?(0,V.jsx)(F5,{slug:e,sessionId:r.sessionId,pause:r.limitPause}):o?(0,V.jsx)(z5,{ask:o,onTerminal:a}):r?.runtime===`perm-prompt`?(0,V.jsx)(I5,{onTerminal:a}):w?(0,V.jsx)(K5,{since:r?.lastUserAt,startedAt:S,activityLabel:x,run:y}):Z3(r)?(0,V.jsx)($3,{thread:r}):Y3(r)?(0,V.jsx)(X3,{thread:r}):null,r?.permPolicy?(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(L5,{policy:r.permPolicy,denies:r.permDenies})}):null,m.some(e=>e.queued)&&(0,V.jsx)(e0,{}),(0,V.jsx)(`div`,{className:`flex flex-col gap-3.5`,children:m.map((e,t)=>e.queued?(0,V.jsx)(S5,{m:e,paired:T[t]},`q${t}`):null)})]})})]})}),(0,V.jsx)(`div`,{ref:j,"data-transcript-overlay":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-end p-4 [&>*]:pointer-events-auto`})]}),(0,V.jsx)(`div`,{"data-thread-chat-footer":!0,className:`z-10 shrink-0 border-t border-border/60 bg-panel`,children:(0,V.jsx)(E2,{slug:e,onTerminal:a,ops:(0,V.jsx)(R5,{slug:e,transcriptShells:h,className:`px-1 pt-1.5`})})})]})})}var v8=700,y8=250,b8=(()=>{try{return localStorage.getItem(`frizz.debugScroll`)===`1`}catch{return!1}})();function x8({slug:e,transcriptRef:t,transcriptKey:n,messages:r,paired:i,answeringForMessage:a,thread:o,running:s,copyTerminalCommand:c,stickyUserMessage:l,transportFallback:u,isFetching:d,refresh:f,retryLiveUpdates:p,hasEarlier:m,beforeCursor:h,loadingEarlier:g,earlierError:_,loadEarlier:v,jumpOverlay:y}){let b=tj(),x=(0,B.useMemo)(()=>O6(r),[r]),S=s?j6(x):void 0,C=s?A6(x):void 0,w=C?B6(C,b):void 0,T=s?N6(x):void 0,E=(0,B.useMemo)(()=>L8(r),[r]),D=(0,B.useMemo)(()=>{let e=s?F6(x):x;return g6(e,R8(e,E))},[x,s,E]),O=s,k=(0,B.useMemo)(()=>m6(D.map(e=>e.message),R8(D,E),F8).map(e=>({...e,messageIndex:D[e.messageIndex].messageIndex})),[D,E]),A=(0,B.useMemo)(()=>Q0(r),[r]),j=!!(o?.providerFault&&!o.foreign||o?.limitPause&&!o.foreign||!o?.pendingInteraction&&o?.pendingAsk||o?.runtime===`perm-prompt`||O||Z3(o)||o?.awaitingBackground),M=(0,B.useMemo)(()=>O&&!(o?.providerFault&&!o.foreign)&&!(o?.limitPause&&!o.foreign)&&!(!o?.pendingInteraction&&o?.pendingAsk)&&o?.runtime!==`perm-prompt`?V8(D.map(e=>e.message)):14,[D,O,o]),N=(0,B.useMemo)(()=>{let e=[{key:`head-anchor`,kind:`head-anchor`}];u&&e.push({key:`transport-fallback`,kind:`transport-fallback`}),(m||g||_)&&e.push({key:`earlier-history:${h??`complete`}`,kind:`earlier-history`}),e.push(...k.map(e=>({...e,kind:`message`}))),e.push({key:`interactions`,kind:`interactions`}),j&&e.push({key:`runtime-status`,kind:`runtime-status`});let t=j||k.length>0?14:0;return r.forEach((n,r)=>{if(!n.queued)return;let i=`queued:${n.deliveryId??n.sourceId??r}`;e.push({key:i,kind:`queued`,message:n,messageIndex:r,gap:t}),t=14}),e},[h,_,m,j,g,k,r,u]),P=(0,B.useMemo)(()=>!l||A<0?-1:N.findIndex(e=>e.kind===`message`&&e.messageIndex===A),[A,N,l]),ee=eX({count:N.length,getScrollElement:()=>t.current,getItemKey:e=>N[e]?.key??e,estimateSize:e=>{let t=N[e];return t?t.kind===`head-anchor`||t.kind===`interactions`?1:t.kind===`earlier-history`?42:t.kind===`transport-fallback`?76:t.kind===`runtime-status`?54:t.kind===`message`?108+t.gap:82+t.gap:80},overscan:8,paddingStart:20,paddingEnd:20,anchorTo:`end`,followOnAppend:!0,scrollEndThreshold:4,scrollToFn:(e,{adjustments:t,behavior:n},r)=>{let i=r.scrollElement;i&&i.scrollTo({top:t===void 0?e:i.scrollTop+t,behavior:n})}}),[F,te]=(0,B.useState)(!0),ne=(0,B.useRef)(!0),re=(0,B.useRef)(-1),ie=(0,B.useRef)(0),ae=(0,B.useRef)(null),oe=(0,B.useRef)(!1),se=(0,B.useRef)(!1),ce=(0,B.useRef)(!0),le=(0,B.useRef)(null),ue=(0,B.useRef)(void 0),de=(0,B.useRef)(null),fe=(0,B.useRef)(void 0),pe=(0,B.useRef)(void 0),me=(0,B.useRef)(0),he=(0,B.useCallback)(()=>{let e=t.current;if(e){let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-transcript-source-id]:not([data-transcript-sticky])`)).find(e=>e.getBoundingClientRect().bottom>t+1),r=n?.dataset.transcriptRowKey;n&&r&&(le.current={rowKey:r,viewportTop:n.getBoundingClientRect().top-t})}v()},[v,t]);(0,B.useLayoutEffect)(()=>{if(!n||N.length===0||ue.current===n)return;ue.current=n,oe.current=!1,se.current=!1,ce.current=!0;let e=requestAnimationFrame(()=>{ee.scrollToEnd({behavior:`instant`}),oe.current=!0,te(!0)});return()=>cancelAnimationFrame(e)},[N.length,n,ee]),(0,B.useLayoutEffect)(()=>{let e=le.current,n=t.current;if(!e||!n||g)return;let r=()=>{let t=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey);if(!t)return;let r=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=r-e.viewportTop};r();let i=0,a=requestAnimationFrame(()=>{r(),i=requestAnimationFrame(()=>{r(),le.current===e&&(le.current=null)})});return()=>{cancelAnimationFrame(a),cancelAnimationFrame(i)}},[g,k.length,t]);let ge=(0,B.useCallback)(()=>{let e=t.current;if(!e)return null;let n=e.getBoundingClientRect().top,r=Array.from(e.querySelectorAll(`[data-transcript-row-key]:not([data-transcript-sticky])`)).find(e=>e.getBoundingClientRect().bottom>n+1),i=r?.dataset.transcriptRowKey;return!r||!i?null:{rowKey:i,viewportTop:r.getBoundingClientRect().top-n}},[t]),_e=(0,B.useCallback)(e=>{let n=t.current;if(!n)return;let r=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey&&t.dataset.transcriptSticky!==`true`);if(!r)return;let i=r.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=i-e.viewportTop},[t]),ve=P>=0?N[P]?.key:void 0;(0,B.useLayoutEffect)(()=>{let e=ve,t=fe.current;if(fe.current=e,t===void 0||t===e||ne.current)return;let n=de.current;if(!n||le.current)return;me.current=performance.now()+y8,_e(n);let r=0,i=0,a=requestAnimationFrame(()=>{_e(n),r=requestAnimationFrame(()=>{_e(n),i=requestAnimationFrame(()=>{_e(n),me.current=0})})});return()=>{cancelAnimationFrame(a),cancelAnimationFrame(r),cancelAnimationFrame(i),me.current=0}},[_e,ve]);let ye=k[0]?.key;(0,B.useLayoutEffect)(()=>{let e=pe.current;if(pe.current=ye,e===void 0||e===ye||!oe.current||ne.current||le.current)return;let t=de.current;if(!t)return;_e(t);let n=()=>{if(performance.now()<ie.current)return;let e=de.current;e&&_e(e)},r=0,i=requestAnimationFrame(()=>{n(),r=requestAnimationFrame(n)});return()=>{cancelAnimationFrame(i),cancelAnimationFrame(r)}},[_e,ye]);let be=(0,B.useCallback)(()=>{let e=t.current;if(!e||le.current||performance.now()<me.current)return;let n=d6({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,previousScrollHeight:re.current,following:ne.current,readerMoved:performance.now()<ie.current});if(ne.current=n.following,n.scrollTop!==null&&(e.scrollTop=n.scrollTop),re.current=e.scrollHeight,te(e=>e===n.following?e:n.following),b8&&!n.following&&performance.now()>=ie.current){let t=de.current,n=t&&Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.dataset.transcriptRowKey===t.rowKey&&e.dataset.transcriptSticky!==`true`);if(t&&n){let r=Math.round(n.getBoundingClientRect().top-e.getBoundingClientRect().top-t.viewportTop);Math.abs(r)>2&&console.warn(`[frizz] transcript moved ${r}px under a still reader — pin=${fe.current??`none`} row=${t.rowKey}`)}}de.current=ge()??de.current},[ge,t]);(0,B.useLayoutEffect)(be),(0,B.useEffect)(()=>{let e=ae.current;if(!e)return;let t=new ResizeObserver(be);return t.observe(e),()=>t.disconnect()},[be]),(0,B.useEffect)(()=>{let e=t.current;if(!e)return;let n=()=>{be();let t=f6({armed:ce.current,scrollTop:e.scrollTop,readerMoved:oe.current&&se.current,hasEarlier:m,loading:g});ce.current=t.armed,t.shouldLoad&&he()},r=()=>{se.current=!0,ie.current=performance.now()+v8,requestAnimationFrame(n)},i=t=>{[`ArrowUp`,`PageUp`,`Home`,` `].includes(t.key)&&(e.scrollTop<=480&&(ce.current=!0),r())},a=t=>{t.deltaY<0&&e.scrollTop<=480&&(ce.current=!0),r()},o=()=>{e.scrollTop<=480&&(ce.current=!0),r()};e.addEventListener(`scroll`,n,{passive:!0}),e.addEventListener(`wheel`,a,{passive:!0}),e.addEventListener(`touchstart`,o,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!0}),e.addEventListener(`pointerdown`,r,{passive:!0}),e.addEventListener(`keydown`,i);let s=requestAnimationFrame(n);return()=>{cancelAnimationFrame(s),e.removeEventListener(`scroll`,n),e.removeEventListener(`wheel`,a),e.removeEventListener(`touchstart`,o),e.removeEventListener(`touchmove`,o),e.removeEventListener(`pointerdown`,r),e.removeEventListener(`keydown`,i)}},[m,g,he,be,t]);let xe=ee.getVirtualItems(),Se=ee.getTotalSize(),Ce=P>=0?N[P]:void 0,we=Ce?.kind===`message`?Ce:void 0,Te=we?ee.measurementsCache[P]?.start??0:0;return(0,V.jsxs)(`div`,{ref:ae,"data-virtualized-transcript":!0,"data-virtual-row-count":xe.length,className:`relative w-full`,style:{height:Se},children:[we&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{"aria-hidden":!0,style:{height:Te}}),(0,V.jsx)(`div`,{ref:ee.measureElement,"data-index":P,"data-transcript-row-key":we.key,"data-transcript-source-id":we.message.sourceId,"data-transcript-sticky":`true`,className:`pointer-events-none [&>*]:pointer-events-auto sticky top-0 z-[9] flex w-full flex-col px-6 pt-3 pb-1.5`,children:(0,V.jsx)(S5,{m:we.message,answering:a(we.message),showSendButton:!0,paired:i[we.messageIndex],sticky:!0})},we.key)]}),xe.map(t=>{let n=N[t.index];return!n||t.index===P?null:(0,V.jsx)(`div`,{ref:ee.measureElement,"data-index":t.index,"data-transcript-row-key":n.key,"data-transcript-source-id":n.kind===`message`?n.message.sourceId:void 0,className:`absolute left-0 top-0 w-full`,style:{transform:`translateY(${t.start}px)`},children:n.kind===`head-anchor`?null:n.kind===`interactions`?(0,V.jsx)(l3,{thread:o,className:`px-6 pt-5`,autoFocusFirst:!0}):n.kind===`transport-fallback`?u?(0,V.jsx)(`div`,{className:`px-6 pt-3`,children:(0,V.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`flex flex-wrap items-center gap-2.5 ${V1} border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:u.kind===`payload-too-large`?`Live payload ${u.actualBytes} bytes; socket limit ${u.maxBytes} bytes`:`Transcript read budget reached (${u.scope}); retry after about ${u.retryAfterMs}ms`,children:[(0,V.jsx)(Mw,{size:13,className:`shrink-0 text-muted`}),(0,V.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,u.kind===`payload-too-large`?`The transcript is too large for push; the last complete HTTP-loaded copy remains visible.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,V.jsx)(`button`,{type:`button`,disabled:d,onClick:f,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-40`,children:d?`Refreshing…`:`Refresh once`}),(0,V.jsx)(`button`,{type:`button`,onClick:p,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`,children:`Retry live`})]})}):null:n.kind===`earlier-history`?(0,V.jsx)(`div`,{className:`flex min-h-10 items-center justify-center px-6 text-[11px] text-muted`,role:`status`,children:_?(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-2 text-center`,children:[(0,V.jsx)(`span`,{children:_}),(0,V.jsx)(`button`,{type:`button`,onClick:he,className:`rounded-md border border-border px-2 py-1 text-fg/90 hover:bg-panel-2`,children:`Retry`})]}):g?(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(dw,{size:12,className:`animate-spin`}),` Loading earlier messages…`]}):(0,V.jsx)(`button`,{type:`button`,onClick:he,className:`rounded-md px-2 py-1 outline-none hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:`Load earlier messages`})}):n.kind===`message`?(0,V.jsx)(`div`,{className:`flex flex-col px-6`,style:{paddingTop:n.gap},children:(0,V.jsx)(S5,{m:n.message,answering:a(n.message),showSendButton:!0,paired:i[n.messageIndex],staleAwaiting:E>=0&&n.messageIndex<E})}):n.kind===`runtime-status`?(0,V.jsxs)(`div`,{className:`px-6`,style:{paddingTop:M},children:[o?.providerFault&&!o.foreign?(0,V.jsx)(N5,{slug:e,sessionId:o.sessionId,fault:o.providerFault,retryText:A>=0?r[A]?.text:void 0}):o?.limitPause&&!o.foreign?(0,V.jsx)(F5,{slug:e,sessionId:o.sessionId,pause:o.limitPause}):!o?.pendingInteraction&&o?.pendingAsk?(0,V.jsx)(z5,{ask:o.pendingAsk,onTerminal:c}):o?.runtime===`perm-prompt`?(0,V.jsx)(I5,{onTerminal:c}):O?(0,V.jsx)(K5,{since:o?.lastUserAt,startedAt:T,activityLabel:w,run:S}):Z3(o)?(0,V.jsx)($3,{thread:o}):Y3(o)?(0,V.jsx)(X3,{thread:o}):null,o?.permPolicy?(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(L5,{policy:o.permPolicy,denies:o.permDenies})}):null]}):(0,V.jsx)(`div`,{className:`flex flex-col px-6`,style:{paddingTop:n.gap},children:(0,V.jsx)(S5,{m:n.message,paired:i[n.messageIndex]})})},n.key)}),(0,V.jsx)(S8,{overlay:y,hidden:F,onJump:()=>ee.scrollToEnd({behavior:`smooth`})})]})}function S8({overlay:e,hidden:t,onJump:n}){return!e||t?null:(0,Xd.createPortal)((0,V.jsxs)(`button`,{type:`button`,"data-jump-to-latest":!0,onClick:n,className:`flex items-center gap-1.5 rounded-full border border-border-strong bg-elevated px-3 py-1.5 text-[11px] font-medium text-fg shadow-lg shadow-black/30 hover:bg-panel-2`,children:[(0,V.jsx)(DC,{size:12}),`Jump to latest`]}),e)}function C8({slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:r=!1}){let i=sC(ej(),e),a=Jd({mutationFn:()=>X.markComplete({slug:e})}),o=Jd({mutationFn:t=>X.renameThread({slug:e,title:t})}),s=Jd({mutationFn:()=>X.aiRenameThread({slug:e}),onSuccess:({title:e})=>Q(`Renamed to “${e}”`),onError:e=>Q(e instanceof Error?e.message:`Could not rename with Claude`,{duration:7e3})}),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!c)return;let e=requestAnimationFrame(()=>{f.current?.focus(),f.current?.select()});return()=>cancelAnimationFrame(e)},[c]),(0,B.useEffect)(()=>{l(!1),d(``)},[e]);let p=qQ(qd({queryKey:[`threadBody`,e],queryFn:()=>X.threadBody({slug:e})}).data?.markdown??``).trim().length>0;if(!i)return null;let m=i.kind===`session`&&i.foreign!==!0,h=i.foreign===!0,g=i.kind===`session`&&!h,_=Zj(i),v=i2(i),y=!v.enabled||s.isPending,b=s.isPending?`Claude is generating a title…`:v.enabled&&s.error instanceof Error?s.error.message:v.label;function x(){l(!1),d(``)}function S(){let e=n2(u,_);if(l(!1),!e){d(``);return}o.mutate(e,{onSuccess:()=>{d(``),Q(`Thread renamed`)},onError:t=>{d(e),l(!0),Q(t instanceof Error?t.message:`Could not rename thread`)}})}return(0,V.jsxs)(`header`,{"data-thread-header":!0,className:a2,children:[(0,V.jsx)(`div`,{className:o2,children:(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[r&&(0,V.jsx)(Pq,{label:`Return to queue`,children:(0,V.jsx)(`a`,{href:vj(`/`),"aria-label":`Return to queue`,"data-standalone-return":!0,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:(0,V.jsx)(OC,{size:14})})}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 leading-tight`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[c?(0,V.jsx)(`input`,{ref:f,"aria-label":`Thread title`,value:u,maxLength:200,onChange:e=>d(e.target.value),onBlur:S,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),S()):e.key===`Escape`&&(e.preventDefault(),x())},className:`min-w-0 flex-1 rounded-md border border-border bg-elevated px-1.5 py-1 font-semibold text-[15px] text-fg outline-none focus:border-accent`}):g?(0,V.jsx)(`button`,{type:`button`,title:`Edit title`,"aria-label":`Edit thread title: ${_}`,disabled:o.isPending||s.isPending,onClick:()=>{d(r2(_,i.id)),l(!0)},className:`min-w-0 max-w-full shrink truncate rounded px-0.5 -mx-0.5 font-semibold text-[15px] text-left outline-none transition-colors hover:bg-panel-2 focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-not-allowed disabled:opacity-40`,children:_}):(0,V.jsx)(`div`,{className:`min-w-0 max-w-full shrink truncate px-0.5 -mx-0.5 font-semibold text-[15px]`,title:_,children:_}),v.show&&!c&&(0,V.jsx)(Pq,{label:b,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":s.isPending?`Renaming with Claude`:v.enabled?`Rename with Claude`:v.label,title:b,"aria-busy":s.isPending,"aria-disabled":y,onClick:()=>{y||(s.reset(),s.mutate())},className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md outline-none transition-colors ${y?`cursor-not-allowed opacity-40`:``} ${s.error?`text-red-400 hover:bg-red-500/10`:`text-accent hover:bg-accent/10`}`,children:(0,V.jsx)(Ew,{size:13,strokeWidth:2,className:s.isPending?`animate-pulse`:``})})})]}),(0,V.jsx)(e6,{at:cM(i),fallbackAt:i.spawnedAt,className:`mt-0.5 block truncate text-[11px] leading-tight text-muted/75`})]})]})}),(0,V.jsxs)(`div`,{className:s2,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[m&&(0,V.jsx)(u6,{slug:e}),(0,V.jsx)(D2,{thread:i,onDoc:p?()=>US(`doc`,i.id):void 0,onDone:()=>a.mutate(void 0,{onSuccess:t}),doneBusy:a.isPending,onStatusApplied:t}),n&&(0,V.jsx)(Pq,{label:`Open in new tab`,children:(0,V.jsx)(`a`,{href:Px(e),target:`_blank`,rel:`noopener`,"aria-label":`Open in new tab`,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:(0,V.jsx)(kC,{size:14})})})]}),n&&(0,V.jsx)(`button`,{type:`button`,"aria-label":`Close`,"data-dialog-initial-focus":!0,onClick:n,className:`ml-0.5 shrink-0 rounded-md p-1.5 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,V.jsx)(Pw,{size:15})})]})]})}function w8(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||g4(e))return null;if(e.parts&&e.parts.length>0){for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.kind===`tools`?n.tools.length>0:n.text.trim())return n.kind===`tools`?n.tools:null}return null}return(e.tools?.length??0)>0&&!e.text.trim()?e.tools:null}function T8(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||g4(e))return null;if(e.parts&&e.parts.length>0){for(let t of e.parts)if(t.kind===`tools`?t.tools.length>0:t.text.trim())return t.kind===`tools`?t.tools:null;return null}return(e.tools?.length??0)>0?e.tools:null}function E8(e){return w8(e)!==null}function D8(e){return T8(e)!==null}function O8(e){return e.kind===`event`&&!e.boundary||e.kind===`reasoning`}function k8(e){return O8(e)||E8(e)}function A8(e){return O8(e)||D8(e)}function j8(e){if(O8(e))return!0;let t=w8(e);return t!==null&&!x6(t[t.length-1])}function M8(e){if(O8(e))return!0;let t=T8(e);return t!==null&&!x6(t[0])}function N8(e){let t=w8(e);return t!==null&&S6(t[t.length-1])}function P8(e){let t=T8(e);return t!==null&&S6(t[0])}function F8(e,t){let n=N8(e)||P8(t),r=!n&&k8(e)&&A8(t)&&!(j8(e)&&M8(t));return(n?22:r?6:14)+(e.role===`user`&&t.role!==`user`?3:0)}function I8(e,t){return e.kind===`event`||e.kind===`reasoning`||e.role===`user`?!1:e.parts&&e.parts.length>0?e.parts.every(n=>n.kind===`tools`?n.tools.length===0:z8(e,n.text,t)):(e.tools?.length??0)===0&&z8(e,e.text,t)}function L8(e){for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`&&e[t].kind!==`event`)return t;return-1}function R8(e,t){let n=new WeakSet;if(t>=0)for(let r of e)r.messageIndex<t&&n.add(r.message);return e=>I8(e,n.has(e))}function z8(e,t,n){return!e.fenceRefused&&!n?!t.trim():O1(t).every(e=>e.kind===`fence`&&e.fenceKind===`awaiting`)}function B8(e,t){return e.kind===`event`||e.kind===`reasoning`||e.role===`user`?!1:e.parts&&e.parts.length>0?e.parts.some(n=>n.kind===`text`&&!z8(e,n.text,t)):typeof e.text==`string`&&!z8(e,e.text,t)}function V8(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.queued||I8(n)))return N8(n)?22:k8(n)&&!j8(n)?6:14+(n.role===`user`?3:0)}return 0}function H8(e,t,n){let r=[],i=null;return e.forEach((e,a)=>{n?.(e,a)||I8(e)||(i!==null&&r.push((0,V.jsx)(e0,{h:F8(i,e)},`s${a}`)),r.push(t(e,a)),i=e)}),r}function U8(e){let t=[];for(let n of e){if(n.kind===`text`){if(!n.text.trim())continue;t.push(n);continue}if(n.tools.length===0)continue;let e=t[t.length-1];e&&e.kind===`tools`?t[t.length-1]={kind:`tools`,tools:[...e.tools,...n.tools]}:t.push(n)}return t}function W8(e,t=14){let n=e.filter(e=>e!=null&&e!==!1),r=[];return n.forEach((e,n)=>{n>0&&r.push((0,V.jsx)(e0,{h:typeof t==`number`?t:t(n)},`vs${n}`)),r.push(e)}),r}var G8={head:!1,tail:!1};function K8(e,t){return n=>e[n-1]?.tail||e[n]?.head?22:t}function q8(e){return{head:S6(e[0]),tail:S6(e[e.length-1])}}function J8(e){let t=[];for(let n of e){let e=t[t.length-1];if(n.edit){let r=!!(n.input||n.output||n.status||n.exitCode!==void 0);e&&e.edits&&!r&&!e.input&&!e.output&&!e.status&&e.edits[0].file===n.edit.file?e.edits.push(n.edit):t.push({name:n.name,detail:n.detail,edits:[n.edit],input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}else n.command?t.push({name:n.name,detail:n.detail,command:n.command,desc:n.desc,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):n.outputImage?t.push({name:n.name,detail:n.detail,outputImage:n.outputImage,output:n.output??n.read,status:n.status,durationMs:n.durationMs,count:1}):n.read?t.push({name:n.name,detail:n.detail,read:n.read,status:n.status,durationMs:n.durationMs,count:1}):n.prompt||n.agentId?t.push({name:n.name,detail:n.detail,prompt:n.prompt,input:n.input,subagentType:n.subagentType,agentId:n.agentId,agentStatus:n.agentStatus,agentElapsedMs:n.agentElapsedMs,output:n.output,status:n.status,durationMs:n.durationMs,count:1}):n.sendTo!==void 0||n.sendBody!==void 0?t.push({name:n.name,detail:n.detail,sendTo:n.sendTo,sendSummary:n.sendSummary,sendBody:n.sendBody,sendType:n.sendType,sendDispatchId:n.sendDispatchId,sendTargetLabel:n.sendTargetLabel,status:n.status,durationMs:n.durationMs,count:1}):n.todos?t.push({name:n.name,detail:n.detail,todos:n.todos,input:n.input,status:n.status,durationMs:n.durationMs,count:1}):n.sentImages||n.sentFiles?t.push({name:n.name,detail:n.detail,sentImages:n.sentImages,sentFiles:n.sentFiles,caption:n.caption,status:n.status,durationMs:n.durationMs,count:1}):n.input||n.output?t.push({name:n.name,detail:n.detail,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):e&&!e.edits&&!e.command&&!e.input&&!e.output&&!e.read&&!e.prompt&&!e.outputImage&&!e.sentImages&&!e.sentFiles&&e.sendTo===void 0&&e.sendBody===void 0&&e.name===n.name&&e.detail===n.detail&&e.status===n.status&&e.backgroundState===n.backgroundState&&e.exitCode===n.exitCode&&e.cwd===n.cwd&&e.sessionId===n.sessionId&&e.durationMs===n.durationMs?e.count++:t.push({name:n.name,detail:n.detail,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}return t}function Y8(e){return e.split(`__`).pop()||e}function X8(e){let t=Z.board?.projectDir;return t&&e.startsWith(t+`/`)?e.slice(t.length+1):e}function Z8({tools:e,at:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useId)(),a=e.reduce((e,t)=>e+t.count,0),o=W6(a,U6(e));return(0,V.jsxs)(`div`,{"data-tool-activity":!0,"data-tool-activity-state":`settled`,className:`flex min-w-0 flex-col`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":i,"aria-expanded":n,"aria-label":`${n?`Collapse`:`Expand`} ${a} tool ${a===1?`call`:`calls`}: ${o}`,className:`group flex w-full min-w-0 items-baseline gap-1.5 rounded py-0.5 text-left outline-none transition-colors hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 ${S4}`,children:[(0,V.jsx)(`span`,{"data-tool-activity-label":!0,title:o,className:`min-w-0 truncate text-muted`,children:o}),(0,V.jsx)(LC,{"data-tool-activity-chevron":!0,"aria-hidden":`true`,size:13,className:w4(n)})]}),n&&(0,V.jsx)(`div`,{id:i,className:`mt-1.5 flex flex-col`,children:W8(e.map((e,n)=>(0,V.jsx)($8,{t:e,startedAt:t},n)),6)}),!n&&(0,V.jsx)(`div`,{id:i,hidden:!0})]})}function Q8({tools:e,at:t}){let n=[];for(let t of e){let e=x6(t),r=n[n.length-1];r?.exceptional===e?r.tools.push(t):n.push({exceptional:e,tools:[t]})}return(0,V.jsx)(`div`,{className:`flex flex-col`,children:W8(n.map((e,n)=>e.exceptional?(0,V.jsx)(`div`,{className:`flex flex-col`,children:W8(e.tools.map((e,n)=>(0,V.jsx)($8,{t:e,startedAt:t},n)),K8(e.tools.map(e=>q8([e])),6))},`exceptions-${n}`):(0,V.jsx)(Z8,{tools:e.tools,at:t},`activity-${n}`)),K8(n.map(e=>q8(e.tools)),6))})}function $8({t:e,startedAt:t}){let n=(0,B.useContext)(l8),r=ej(),i=ZM(e,(n?sC(r,n):void 0)?.bgShells??[]);return e.edits&&e.status!==`failed`&&e.status!==`cancelled`?(0,V.jsx)(U$,{edits:e.edits,meta:(0,V.jsx)(r5,{status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,durationMs:e.durationMs})}):e.command?(0,V.jsx)(d5,{command:e.command,desc:e.desc??e.detail,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t}):e.outputImage?(0,V.jsx)(c5,{name:e.name,detail:e.detail,outputImage:e.outputImage,output:e.output,status:e.status,durationMs:e.durationMs}):e.read?(0,V.jsx)(p5,{detail:e.detail,read:e.read,status:e.status,durationMs:e.durationMs}):e.prompt||e.agentId?(0,V.jsx)(h5,{detail:e.detail,prompt:e.prompt,input:e.input,subagentType:e.subagentType,agentId:e.agentId,agentStatus:e.agentStatus,agentElapsedMs:e.agentElapsedMs,status:e.status,durationMs:e.durationMs,output:e.output}):e.sendTo!==void 0||e.sendBody!==void 0?(0,V.jsx)(_5,{to:e.sendTo,summary:e.sendSummary,body:e.sendBody??``,type:e.sendType,dispatchId:e.sendDispatchId,targetLabel:e.sendTargetLabel,status:e.status,durationMs:e.durationMs}):e.sentImages||e.sentFiles?(0,V.jsx)(l5,{images:e.sentImages??[],files:e.sentFiles??[],caption:e.caption,status:e.status,durationMs:e.durationMs}):e.todos?(0,V.jsx)(s1,{todos:e.todos,note:e.input,meta:(0,V.jsx)(r5,{status:e.status,durationMs:e.durationMs})}):e.input||e.output?(0,V.jsx)(d5,{name:e.name,command:e.input??``,desc:e.detail,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,inputLabel:`input`,startedAt:t}):(0,V.jsx)(s5,{name:e.name,detail:e.detail,count:e.count,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,cwd:e.cwd,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t})}function e5({tone:e,indicator:t,label:n,duration:r,title:i}){return(0,V.jsxs)(`span`,{className:`petite-caps frizz-tool-header-caps flex shrink-0 items-center gap-1 whitespace-nowrap text-[11.5px] leading-none ${e}`,title:i,"aria-label":i,children:[t,(0,V.jsx)(`span`,{children:[n,r].filter(Boolean).join(` · `)})]})}function t5(e,t,n){let[r,i]=(0,B.useState)(()=>Date.now()),a=JM(e,t),o=YM(e,t,n,r);return(0,B.useEffect)(()=>{if(!a||o)return;let e=n?Date.parse(n):NaN;if(!Number.isFinite(e))return;let t=setTimeout(()=>i(Date.now()),Math.max(qM-(Date.now()-e),0));return()=>clearTimeout(t)},[a,o,n]),o}function n5({status:e,backgroundState:t,liveBackgroundState:n,startedAt:r}){let i=t5(e,t,r),a=n===`running`?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):n===`stale`?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot-quiet frizz-live-dot-quiet--shell`,"data-running-indicator":`tool-quiet`,title:fN}):KM(e,t)||i?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):null;return a?(0,V.jsx)(`span`,{className:`frizz-tool-mark -mr-1 flex w-[9px] shrink-0 justify-center`,children:a}):null}function r5({status:e,backgroundState:t,liveBackgroundState:n,exitCode:r,durationMs:i}){if(!e&&i===void 0)return null;let[a,o]=n===`running`?[`running`,`background running`]:n===`stale`?[`stale`,`background stale`]:e===`pending`?t===`unknown`?[`unknown`,`background / unknown`]:[`running`,t===`background`?`background running`:`running`]:e===`failed`?r===void 0?[`failed`,`failed`]:[`exit ${r}`,`exit ${r}`]:e===`cancelled`?[`cancelled`,`cancelled`]:e===`completed`?[`done`,`done`]:[void 0,void 0],s=i===void 0?void 0:QM(i),c=[o,s].filter(Boolean).join(` · `);return(0,V.jsx)(e5,{tone:e===`failed`?`frizz-tool-failed`:e===`cancelled`?`text-amber-400`:`text-muted/55`,title:c,label:a,duration:s})}function i5(e,t,n){let r=t?Date.parse(t):NaN,i=e===`pending`&&Number.isFinite(r),[a,o]=(0,B.useState)(()=>Date.now());return(0,B.useEffect)(()=>{if(!i)return;let e=()=>o(Date.now()),t,n=setTimeout(()=>{e(),t=setInterval(e,1e3)},1e3-Date.now()%1e3);return()=>{clearTimeout(n),t&&clearInterval(t)}},[i,t]),i?Math.max(a-r,0):n}function a5(e,t,n){let r=t&&t!==Z.board?.projectDir?`in ${X8(t)}`:void 0;return[e,t?r:n!==void 0&&!e?.includes(String(n))?`session ${n}`:void 0].filter(Boolean).join(` · `)||void 0}function o5(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.includes(`…`)}function s5({name:e,detail:t,count:n,status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,cwd:s,sessionId:c,durationMs:l,startedAt:u}){let d=a5(t,s,c),f=d?X8(d):void 0,p=t&&o5(t)?t:void 0;return(0,V.jsx)(`div`,{className:`frizz-bash`,title:d,children:(0,V.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(n5,{status:r,backgroundState:i,liveBackgroundState:a,startedAt:u}),(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:Y8(e)}),f&&(p?(0,V.jsx)(`span`,{className:`min-w-0 truncate`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(V$,{path:p,className:`text-[11.5px] text-muted`,children:f})}):(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:f}))]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(r5,{status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,durationMs:l}),n>1&&(0,V.jsxs)(`span`,{className:`tabular-nums text-[11px] text-muted/45`,children:[`×`,n]})]})]})})}function c5({name:e,detail:t,outputImage:n,output:r,status:i,durationMs:a}){let o=t?X8(t):void 0,s=(0,V.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:Y8(e)}),o&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,title:t,children:o})]}),(0,V.jsx)(`span`,{className:`flex shrink-0 items-center gap-2`,children:(0,V.jsx)(r5,{status:i,durationMs:a})})]});return(0,V.jsxs)(`div`,{children:[(0,V.jsx)(T5,{path:n,hideCaption:!0,altText:o?`${Y8(e)}: ${o}`:Y8(e),header:s}),r&&(0,V.jsx)(`pre`,{className:`frizz-bash frizz-bash-body frizz-bash-output-body mt-1.5`,children:r})]})}function l5({images:e,files:t,caption:n,status:r,durationMs:i}){let[a,o]=(0,B.useState)(!0),s=(0,B.useId)(),c=[e.length?`${e.length} image${e.length===1?``:`s`}`:``,t.length?`${t.length} file${t.length===1?``:`s`}`:``].filter(Boolean).join(` · `);return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":s,"aria-expanded":a,"aria-label":`${a?`Collapse`:`Expand`} files sent to you${c?`: ${c}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Sent to you`}),c&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:c})]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(r5,{status:r,durationMs:i}),(0,V.jsx)(LC,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${a?`rotate-90`:``}`})]})]}),(0,V.jsx)(`div`,{id:s,hidden:!a,children:a&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5 px-2.5 pb-2.5 pt-1.5`,children:[e.map((e,t)=>(0,V.jsx)(T5,{path:e,hideCaption:!0,altText:n??`delivered image`},`i${t}`)),t.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map((e,t)=>(0,V.jsx)(E5,{path:e},`f${t}`))}),n&&(0,V.jsx)(`div`,{className:`max-w-[65%] text-[12px] leading-snug text-muted`,children:n})]})})]})}var u5=16;function d5({command:e,desc:t,output:n,name:r=`Bash`,status:i,backgroundState:a,liveBackgroundState:o,exitCode:s,sessionId:c,durationMs:l,inputLabel:u,startedAt:d}){let[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(!1),v=(0,B.useId)(),y=i5(i,d,l),b=(0,B.useMemo)(()=>e.split(`
480
+ `).length>6?(0,V.jsxs)(`details`,{className:`rounded-md border border-border/70 bg-panel/60`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer px-2.5 py-2 text-[11px] text-muted outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/50`,children:`Request message`}),(0,V.jsx)(`div`,{className:`max-h-52 overflow-auto border-t border-border/60 px-2.5 py-2 whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})]}):(0,V.jsx)(`div`,{className:`whitespace-pre-wrap break-words text-[12px] leading-relaxed text-fg/80`,children:e})}function _3({url:e}){let t=Z4(e,location.href);return(0,V.jsxs)(`div`,{children:[(0,V.jsx)(`div`,{className:`text-[11px] font-medium text-fg`,children:`Open this page to continue`}),(0,V.jsx)(`code`,{className:`mt-1.5 block max-h-24 overflow-auto break-all rounded-md border border-border bg-bg/40 px-2.5 py-2 font-mono-keep text-[10.5px] text-fg/80`,children:e}),t?(0,V.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,className:`mt-2 inline-flex items-center gap-1.5 rounded-md border border-border bg-panel px-2.5 py-1.5 text-[11px] font-medium text-fg hover:bg-panel-2`,children:[(0,V.jsx)(YC,{"aria-hidden":`true`,size:12}),`Open page`]}):(0,V.jsx)(`div`,{role:`alert`,className:`mt-1.5 break-words text-[11px] text-red-300`,children:`This request did not provide a safe http(s) URL.`})]})}function v3({record:e}){return(0,V.jsxs)(`details`,{className:`mt-3 border-t border-border/50 pt-2 text-[10.5px] text-muted/70`,children:[(0,V.jsx)(`summary`,{className:`cursor-pointer w-fit outline-none hover:text-muted focus-visible:ring-1 focus-visible:ring-fg/50`,children:`Request details`}),(0,V.jsxs)(`dl`,{className:`mt-2 grid min-w-0 grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1`,children:[(0,V.jsx)(`dt`,{children:`Provider`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:W4(e.provider.kind)}),e.provider.name&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Reported name`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.name})]}),e.provider.version&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Reported version`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.provider.version})]}),(0,V.jsx)(`dt`,{children:`Source`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:G4(e.source.kind)}),e.source.label&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Reported source`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.source.label})]}),(0,V.jsx)(`dt`,{children:`Scope`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:`This thread · this request`}),e.expiresAt&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{children:`Expires`}),(0,V.jsx)(`dd`,{className:`min-w-0 break-all text-fg/65`,children:e.expiresAt})]})]})]})}function y3({instanceId:e,fields:t,draft:n,setValue:r,errors:i,autoFocus:a}){let o=t.findIndex(e=>!e.secret);return(0,V.jsxs)(`fieldset`,{className:`min-w-0`,children:[(0,V.jsx)(`legend`,{className:`sr-only`,children:`Requested information`}),(0,V.jsx)(`div`,{className:`flex min-w-0 flex-col gap-3`,children:t.map((t,s)=>(0,V.jsx)(b3,{instanceId:e,field:t,value:n[t.id],setValue:e=>r(t.id,e),error:i[t.id],autoFocus:a&&s===o},t.id))})]})}function b3({instanceId:e,field:t,value:n,setValue:r,error:i,autoFocus:a}){let o=`${e}-${t.id}`,s=t.description?`${o}-description`:void 0,c=i?`${o}-error`:void 0,l=[s,c].filter(Boolean).join(` `)||void 0,u=(0,V.jsxs)(V.Fragment,{children:[t.label,t.required&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`ml-0.5 text-accent`,children:`*`})]}),d=`mt-1 w-full min-w-0 rounded-md border border-border bg-bg/45 px-2.5 py-2 text-[12px] text-fg outline-none focus:border-accent focus:ring-1 focus:ring-accent/40`,f;if(t.secret)f=(0,V.jsx)(`div`,{className:`mt-1 text-[11px] text-amber-100/70`,children:`Use the secure fallback below.`});else if(t.input===`multiline`)f=(0,V.jsx)(`textarea`,{id:o,name:t.id,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,minLength:t.minLength,maxLength:t.maxLength,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,rows:4,className:`${d} resize-y`});else if(t.input===`text`){let e=t.format===`email`?`email`:t.format===`uri`?`url`:t.format===`date`?`date`:`text`;f=(0,V.jsx)(`input`,{id:o,name:t.id,type:e,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,minLength:t.minLength,maxLength:t.maxLength,placeholder:t.format===`date-time`?`2026-07-13T12:00:00Z`:void 0,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d})}else if(t.input===`number`||t.input===`integer`)f=(0,V.jsx)(`input`,{id:o,name:t.id,type:`number`,step:t.input===`integer`?1:`any`,min:t.minimum,max:t.maximum,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d});else if(t.input===`boolean`)f=(0,V.jsxs)(`label`,{htmlFor:o,className:`mt-1 flex cursor-pointer items-center gap-2 rounded-md border border-border bg-bg/30 px-2.5 py-2 text-[12px] text-fg/85`,children:[(0,V.jsx)(`input`,{id:o,name:t.id,type:`checkbox`,checked:n===!0,onChange:e=>r(e.target.checked),"aria-describedby":l,autoFocus:a,className:`accent-[var(--color-accent)]`}),(0,V.jsx)(`span`,{children:u})]});else if(t.input===`select`)f=(0,V.jsxs)(`select`,{id:o,name:t.id,value:typeof n==`string`?n:``,onChange:e=>r(e.target.value),required:t.required,"aria-describedby":l,"aria-invalid":!!i,autoFocus:a,className:d,children:[(0,V.jsx)(`option`,{value:``,children:`Choose an option…`}),t.options.map((e,t)=>(0,V.jsx)(`option`,{value:String(t),children:e.label},t))]});else if(t.input===`multi-select`){let e=Array.isArray(n)?n:[];f=(0,V.jsxs)(`fieldset`,{id:o,"aria-describedby":l,className:`mt-1 rounded-md border border-border bg-bg/30 px-2.5 py-2`,children:[(0,V.jsx)(`legend`,{className:`px-1 text-[11px] font-medium text-fg/85`,children:u}),(0,V.jsx)(`div`,{className:`flex flex-col gap-1.5`,children:t.options.map((n,i)=>{let o=String(i);return(0,V.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 text-[12px] text-fg/85`,children:[(0,V.jsx)(`input`,{type:`checkbox`,name:t.id,value:o,checked:e.includes(o),onChange:t=>r(t.target.checked?[...e,o]:e.filter(e=>e!==o)),autoFocus:a&&i===0,className:`mt-0.5 accent-[var(--color-accent)]`}),(0,V.jsx)(`span`,{children:n.label})]},o)})})]})}return(0,V.jsxs)(`div`,{className:`min-w-0`,children:[t.secret?(0,V.jsx)(`div`,{className:`text-[11px] font-medium text-fg/85`,children:u}):t.input!==`boolean`&&t.input!==`multi-select`?(0,V.jsx)(`label`,{htmlFor:o,className:`block text-[11px] font-medium text-fg/85`,children:u}):null,t.description&&(0,V.jsx)(`div`,{id:s,className:`mt-0.5 whitespace-pre-wrap break-words text-[10.5px] leading-snug text-muted`,children:t.description}),f,i&&(0,V.jsx)(`div`,{id:c,role:`alert`,className:`mt-1 text-[10.5px] text-red-300`,children:i})]})}function x3(e){return(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`).length}function S3(e,t={}){let n=(e.subAgents??[]).filter(e=>Oy(e)&&e.state===`running`).length,r=(e.bgShells??[]).filter(e=>e.state===`running`).length,i=t.watchers===!1?0:x3(e),a=[n>0?`${n} sub-agent${n===1?``:`s`}`:null,r>0?`${r} background shell${r===1?``:`s`}`:null,i>0?`${i} PR watcher${i===1?``:`s`}`:null].filter(e=>e!==null);return a.length===0?`0 background shells`:a.length===1?a[0]:`${a.slice(0,-1).join(`, `)} and ${a[a.length-1]}`}function C3(e){return(e.subAgents??[]).some(e=>Oy(e)&&e.state===`running`)}function w3(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length}function T3(e){return C3(e)||w3(e)>0}function E3(e){return D3(e)?`Background shells running`:`Awaiting`}function D3(e){return(e.bgShells??[]).filter(e=>e.state===`running`).length>0&&!C3(e)&&x3(e)===0&&O3(e).length===0}function O3(e){return(e.watches??[]).filter(e=>e.kind===`timer`&&e.state===`armed`)}var k3={mergeable:`no conflicts`,blocked:`merge blocked`,conflicting:`has conflicts`,unknown:null};function A3(e){return e.state!==`open`||e.merge===`blocked`&&e.checks!==`passing`&&e.checks!==`none`?null:k3[e.merge]}var j3=`shrink-0 self-baseline translate-y-[calc(0.5em_-_0.5cap)]`;function M3({tone:e}){return(0,V.jsx)(`span`,{"aria-hidden":!0,className:`inline-block size-3 rounded-full border ${e} border-t-transparent motion-safe:animate-spin ${j3}`})}function N3({status:e}){return e?e.state===`merged`?(0,V.jsx)($C,{size:12,className:`${j3} text-purple-400`}):e.state===`closed`?(0,V.jsx)(ew,{size:12,className:`${j3} text-red-400`}):e.checks===`failing`?(0,V.jsx)(GC,{size:12,className:`${j3} text-red-400`}):e.checks===`passing`?(0,V.jsx)(BC,{size:12,className:`${j3} text-emerald-500`}):e.checks===`running`?(0,V.jsx)(M3,{tone:`border-amber-400`}):(0,V.jsx)(VC,{size:12,className:`${j3} text-muted/60`}):(0,V.jsx)(VC,{size:12,className:`${j3} text-muted/60`})}function P3(e){return[e.failed>0?`${e.failed} failing`:null,e.running>0?`${e.running} in progress`:null,e.passed>0?`${e.passed} successful`:null].filter(e=>e!==null).join(`, `)}function F3(e){if(!e)return`Checking…`;if(e.state===`merged`)return`Merged`;if(e.state===`closed`)return`Closed`;let t=P3(e),n=A3(e);return[t||`No checks`,n].filter(e=>e!==null).join(` · `)}var I3=`group relative col-span-4 grid grid-cols-subgrid items-baseline rounded-sm text-[12px] leading-5`,L3=`ml-1.5 min-w-0 truncate font-medium text-fg/90`,R3=`ml-3 min-w-0 truncate text-right text-muted/70`,z3=`outline-none after:absolute after:inset-0 after:rounded-sm focus-visible:after:ring-1 focus-visible:after:ring-fg/60`;function B3(){return(0,V.jsx)(LC,{size:13,"aria-hidden":!0,className:`${j3} ml-[3px] -mr-[4px] text-muted/35 transition-colors group-hover:text-muted/70`})}function V3({mark:e,name:t,status:n,onOpen:r,href:i,title:a,testKind:o,testId:s}){let c=i?(0,V.jsx)(`a`,{href:i,target:`_blank`,rel:`noreferrer noopener`,title:a,onMouseDown:e=>e.stopPropagation(),className:`${L3} ${z3} group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):r?(0,V.jsx)(`button`,{type:`button`,onClick:r,onMouseDown:e=>e.stopPropagation(),title:a,className:`${L3} ${z3} text-left group-hover:underline group-hover:decoration-fg/40 group-hover:underline-offset-2`,children:t}):(0,V.jsx)(`span`,{className:L3,title:a,children:t}),l=!!(i||r);return(0,V.jsxs)(`div`,{"data-wait-row":s,"data-wait-kind":o,className:`${I3} ${l?`cursor-pointer transition-colors hover:bg-fg/[0.045]`:``}`,children:[(0,V.jsx)(`span`,{className:`flex shrink-0`,children:e}),c,(0,V.jsx)(`span`,{"data-wait-status":!0,className:R3,children:n}),l?(0,V.jsx)(B3,{}):(0,V.jsx)(`span`,{})]})}function H3({watch:e}){let t=e.github,n=nJ(e.target);return(0,V.jsx)(V3,{testKind:`github`,testId:e.target,mark:(0,V.jsx)(N3,{status:t}),name:e.target,href:n??void 0,title:n?`Open ${e.target} on GitHub`:e.target,status:(0,V.jsxs)(V.Fragment,{children:[F3(t),t&&t.failing.length>0&&n&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsx)(`a`,{href:`${n}/checks`,target:`_blank`,rel:`noreferrer noopener`,onMouseDown:e=>e.stopPropagation(),className:`relative text-red-400/85 underline decoration-red-400/30 underline-offset-2 hover:decoration-red-400`,children:`view failures`})]})]})})}function U3(e,t){return(e.bgShells??[]).find(e=>e.id===t||e.taskId===t||e.label===t)}function W3(e){return(e.watches??[]).filter(e=>e.kind===`shell`&&e.state===`armed`)}function G3({watch:e,thread:t,slug:n,now:r}){let i=U3(t,e.target),a=nN(i?.startedAt??e.createdAt,r),o=i?.id&&!i.outputUnavailable;return(0,V.jsx)(V3,{testKind:`shell`,testId:e.target,mark:(0,V.jsx)(kw,{size:12,className:`${j3} text-shell`}),name:i?.label??e.target,onOpen:o?()=>GS(n,i.id,{label:i.label,startedAt:i.startedAt}):void 0,title:o?`Read this shell's output — running for ${a}`:i?.label??e.target,status:a?`running · ${a}`:`running`})}function K3({watch:e,now:t}){let n=Date.parse(e.timer?.fireAt??``),r=Number.isFinite(n)?n>t?`fires in ${eN(n-t)}`:`firing…`:`armed`;return(0,V.jsx)(V3,{testKind:`timer`,testId:e.target,mark:(0,V.jsx)(KC,{size:12,className:`${j3} text-muted/60`}),name:e.timer?.prompt||e.target,title:e.timer?.fireAt?`One-off timer, set for ${e.timer.fireAt}`:e.target,status:r})}function q3(e){return(e.subAgents??[]).filter(e=>Oy(e)&&e.state===`running`)}function J3({agent:e,slug:t,now:n}){let r=nN(e.startedAt,n),i=e.subagentType?.replace(/^frizz:/,``);return(0,V.jsx)(V3,{testKind:`agent`,testId:e.id??e.label,mark:(0,V.jsx)(M3,{tone:`border-accent`}),name:e.label,onOpen:e.id?()=>WS(t,e.id,{label:e.label,subagentType:e.subagentType,startedAt:e.startedAt}):void 0,title:e.id?`Open this sub-agent — working for ${r}`:e.label,status:[i,r].filter(Boolean).join(` · `)})}function Y3(e){return e?.awaitingBackground===!0&&e.runtime===`turn-idle`&&e.bgSnoozed!==!0}function X3({thread:e,actions:t}){let n=C3(e),r=fJ(e.lastFence?.kind===`awaiting`?e.lastFence.body:void 0),i=e1(o$(r??``)),a=UM(),o=(e.watches??[]).filter(e=>e.kind===`github`&&e.state===`armed`),s=W3(e),c=q3(e),l=O3(e),u=[{head:`Sub-agents`,rows:c.map(t=>(0,V.jsx)(J3,{agent:t,slug:e.id,now:a},t.id??t.label))},{head:`Background shells`,rows:s.map(t=>(0,V.jsx)(G3,{watch:t,thread:e,slug:e.id,now:a},t.id))},{head:`Pull requests`,rows:o.map(e=>(0,V.jsx)(H3,{watch:e},e.id))},{head:`Timers`,rows:l.map(e=>(0,V.jsx)(K3,{watch:e,now:a},e.id))}].filter(e=>e.rows.length>0);return(0,V.jsxs)(J1,{"data-awaiting-background":!0,icon:D3(e)?kw:iw,label:E3(e),className:t?`pb-0`:``,children:[r&&(0,V.jsx)(`div`,{className:`md-body [overflow-wrap:anywhere] [&_pre]:whitespace-pre-wrap [&_pre]:break-all`,dangerouslySetInnerHTML:i}),u.length===0&&T3(e)&&(0,V.jsx)(`p`,{className:`block min-w-0 text-[13px] leading-5 text-fg/75`,children:n?(0,V.jsxs)(V.Fragment,{children:[`It’s awaiting the results from `,S3(e,{watchers:!1}),` it dispatched. It returns to the queue on its own when the work comes back.`]}):(0,V.jsxs)(V.Fragment,{children:[S3(e,{watchers:!1}),` `,w3(e)===1?`is`:`are`,` still running. It resumes on its own when`,` `,w3(e)===1?`it finishes`:`one of them finishes`,`.`]})}),r&&u.length>0&&(0,V.jsx)(`div`,{"aria-hidden":!0,className:`-mx-4 mt-3 border-t border-border`}),u.length>0&&(0,V.jsx)(`div`,{className:`mt-3 grid grid-cols-[auto_1fr_auto_auto] gap-y-px`,children:u.map((e,t)=>(0,V.jsxs)(B.Fragment,{children:[(0,V.jsx)(`div`,{className:`col-span-4 text-[10.5px] uppercase tracking-wide text-muted/45 ${t>0?`mt-2.5`:``}`,children:e.head}),e.rows]},e.head))}),t?(0,V.jsx)(`div`,{className:`-mx-4 mt-3 flex flex-wrap items-center gap-x-2.5 gap-y-2 border-t border-border bg-fg/[0.03] px-4 py-2.5 ${U1}`,children:t}):null]})}function Z3(e,t=Date.now()){return e!==void 0&&_M(e,t)!==void 0}function Q3(){let[e,t]=(0,B.useState)(()=>Date.now());return(0,B.useEffect)(()=>{let e=setInterval(()=>t(Date.now()),1e3);return()=>clearInterval(e)},[]),e}function $3({thread:e}){let t=Q3(),[n,r]=(0,B.useState)(!1),i=_M(e,t);if(!i)return null;let a=Date.parse(i),o=Fj(i,t).replace(/^(Today|Tomorrow)/,e=>e.toLowerCase()),s=e.snoozePrompt?.trim();async function c(){r(!0);try{await X.setThreadSnooze({slug:e.id,sessionId:e.sessionId??``,until:null,prompt:null}),Q(`Snooze cleared`)}catch(e){Q((e instanceof Error?e.message:`Wake failed`).slice(0,100))}finally{r(!1)}}return(0,V.jsxs)(J1,{"data-snooze-card":!0,icon:iw,label:`Snoozed`,children:[(0,V.jsx)(`div`,{"data-snooze-countdown":!0,title:new Date(a).toLocaleString(),className:`text-[22px] font-semibold leading-8 tracking-tight text-fg tabular-nums`,children:iN(a-t)}),(0,V.jsx)(`p`,{className:Y1,children:s?(0,V.jsxs)(V.Fragment,{children:[`Resumes `,o,` and sends: “`,zj(s),`”`]}):(0,V.jsxs)(V.Fragment,{children:[`Returns to the queue `,o,`.`]})}),e.foreign!==!0&&(0,V.jsx)(X1,{children:(0,V.jsx)(`button`,{type:`button`,"data-snooze-wake-now":!0,disabled:n,onClick:()=>void c(),className:`${$1} disabled:cursor-not-allowed disabled:opacity-45`,children:`Wake now`})})]})}function e6({at:e,fallbackAt:t,className:n=``}){let r=UM(),i=AM(e,t),a=jM(i,r);return!a||!i?null:(0,V.jsx)(`time`,{dateTime:i,className:n,children:a})}var t6=1500;function n6(e,t){let n=0,r;function i(){r!==void 0&&(t.clearTimeout(r),r=void 0)}return{begin(){let a=++n;return e(!0),i(),r=t.setTimeout(()=>{a===n&&e(!1),r=void 0},t6),a},fail(t){t===n&&(i(),e(!1))},dispose(){n++,i()}}}var r6=`Could not copy terminal command`,i6={attach:`Attach command copied`,resume:`Resume command copied`},a6={attach:`Copy command to attach to this thread's live terminal`,resume:`Copy command to resume this thread in a new terminal`},o6=e=>[`terminalCommand`,e];function s6(e){return X.threadTerminalCommand({slug:e}).then(e=>{if(!e.command)throw Error(e.reason??`No verified provider session is available to resume`);return{command:e.command,mode:e.mode===`attach`?`attach`:`resume`}})}async function c6(e){let t=s6(e);if(typeof ClipboardItem<`u`&&navigator.clipboard?.write)return await navigator.clipboard.write([new ClipboardItem({"text/plain":t.then(({command:e})=>new Blob([e],{type:`text/plain`}))})]),(await t).mode;let{command:n,mode:r}=await t;return await bU(n),r}function l6(e){let t=Jd({mutationFn:()=>c6(e)});return e=>t.mutate(void 0,{onSuccess:t=>{e?.onSuccess?.(),Q(i6[t])},onError:t=>{e?.onError?.(),Q(t instanceof Error?`${r6}: ${t.message}`:r6,{duration:7e3})}})}function u6({slug:e}){let[t,n]=(0,B.useState)(!1),r=(0,B.useRef)(null);r.current||=n6(n,{setTimeout:(e,t)=>window.setTimeout(e,t),clearTimeout:e=>window.clearTimeout(e)});let i=Md(),a=l6(e);(0,B.useEffect)(()=>()=>r.current?.dispose(),[]);function o(){i.prefetchQuery({queryKey:o6(e),queryFn:()=>s6(e),staleTime:15e3})}function s(){let t=i.getQueryData(o6(e));if(t){bU(t.command).then(()=>{r.current?.begin(),Q(i6[t.mode])},()=>Q(r6,{duration:7e3}));return}a({onSuccess:()=>r.current?.begin()})}let c=i.getQueryData(o6(e)),l=t?c?i6[c.mode]:`Terminal command copied`:c?a6[c.mode]:`Copy terminal command`;return(0,V.jsx)(Pq,{label:l,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":l,title:l,onClick:s,onPointerEnter:o,onFocus:o,className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:t?(0,V.jsx)(PC,{size:14,strokeWidth:2.2,className:`text-fg`}):(0,V.jsx)(kw,{size:14,strokeWidth:1.8})})})}function d6(e){let t=Math.max(e.scrollHeight-e.clientHeight,0),n=t-e.scrollTop,r=e.scrollHeight!==e.previousScrollHeight,i=r&&!e.readerMoved?e.following||n<=1:n<=4;return!i||!r||t<=0||n<=1?{following:i,scrollTop:null}:{following:i,scrollTop:t}}function f6(e){let t=e.scrollTop>640?!0:e.armed,n=t&&e.readerMoved&&e.scrollTop<=480&&e.hasEarlier&&!e.loading;return{armed:n?!1:t,shouldLoad:n}}function p6(e){return`legacy:${e.role}:${e.kind??`message`}:${e.at??``}:${e.text}`}function m6(e,t,n){let r=[],i=new Map,a=null;return e.forEach((e,o)=>{if(e.queued||t(e))return;let s=e.sourceId??p6(e),c=i.get(s)??0;i.set(s,c+1),r.push({key:c===0?s:`${s}:${c}`,message:e,messageIndex:o,gap:a===null?0:n(a,e)}),a=e}),r}function h6(e,t,n){let r=e[t];if(!r||r.kind!==`event`||r.boundary!==`rest`)return!1;for(let r=t+1;r<e.length;r++){let t=e[r];if(!(t.queued||n(t)))return!!t.boundary||t.wake===!0}return!0}function g6(e,t){let n=e.map(e=>e.message);return e.filter((e,r)=>!h6(n,r,t))}var _6=new Set([`agent`,`follow up`,`interrupt`,`send message`,`spawn agent`,`wait for agents`]),v6=new Set([`poll process`,`wait`]);function y6(e){return(e.split(`__`).pop()||e).replaceAll(`_`,` `).trim()}function b6(e){return y6(e).toLowerCase()}function x6(e){return e.prompt!==void 0||e.agentId!==void 0||e.sendTo!==void 0||e.sendBody!==void 0||e.backgroundState!==void 0&&!C6(e)||S6(e)||_6.has(b6(e.name))}function S6(e){return e.outputImage!==void 0||e.sentImages!==void 0&&e.sentImages.length>0}function C6(e){return e.backgroundState===`unknown`&&v6.has(b6(e.name))}function w6(e){if(e.role!==`assistant`||e.kind||e.queued)return null;if(e.parts&&e.parts.length>0){let t=[];for(let n of e.parts)if(n.kind===`text`){if(n.text.trim())return null}else t.push(...n.tools);return t.length>0&&t.every(e=>!x6(e))?t:null}return e.text.trim()||e.tools.length===0?null:e.tools.every(e=>!x6(e))?e.tools:null}function T6(e){return e.role!==`assistant`||e.kind||e.queued||e.text.trim()||e.tools.length>0?!1:!e.parts?.some(e=>e.kind===`text`?e.text.trim().length>0:e.tools.length>0)}function E6(e){if(e.role!==`assistant`||e.kind||e.queued)return null;if(!e.parts?.length)return w6(e);for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.kind===`text`){if(n.text.trim())return null;continue}if(n.tools.length!==0)return n.tools.every(e=>!x6(e))?n.tools:null}return null}function D6(e,t,n){let r=[...e.tools,...t],i=e.parts?.map(e=>e.kind===`text`?e:{...e,tools:[...e.tools]})??[],a=-1;for(let e=i.length-1;e>=0;e--){let t=i[e];if(t.kind===`text`){if(t.text.trim())break;continue}if(t.tools.length>0){a=e;break}}let o=i[a];return o?.kind===`tools`?i[a]={kind:`tools`,tools:[...o.tools,...t]}:i.push({kind:`tools`,tools:t}),{...e,at:n??e.at,tools:r,parts:i}}function O6(e){let t=[],n=null;return e.forEach((e,r)=>{if(T6(e))return;if(e.queued){t.push({message:e,messageIndex:r});return}let i=w6(e);if(i&&n){n.message=D6(n.message,i,e.at);return}let a={message:e,messageIndex:r};t.push(a),E6(e)?(a.runStartedAt=e.at,n=a):n=null}),t}function k6(e){return e.status===`completed`||e.status===`failed`||e.status===`cancelled`}function A6(e){let t=j6(e);return t?.tools.some(e=>!k6(e))?t.tools.at(-1):void 0}function j6(e){let t=M6(e);if(!t)return;let n=E6(t.message);return n?{tools:n,at:t.message.at}:void 0}function M6(e){for(let t=e.length-1;t>=0;t--)if(!e[t].message.queued)return e[t]}function N6(e){let t=M6(e);if(t)return E6(t.message)?t.runStartedAt??t.message.at:t.message.at}function P6(e){let t=E6(e);if(!t)return e;let n=e.tools.length>=t.length?e.tools.slice(0,e.tools.length-t.length):e.tools.filter(e=>!t.includes(e)),r=!1,i=e.parts?e.parts.reduceRight((e,n)=>!r&&n.kind===`tools`&&n.tools===t?(r=!0,e):(e.unshift(n),e),[]):e.parts;return{...e,tools:n,parts:i}}function F6(e){let t;for(let n=e.length-1;n>=0;n--){let r=e[n].message;if(!r.queued){E6(r)&&(t=r);break}}if(!t)return[...e];let n=[];for(let r of e){let e=r.message===t?P6(r.message):r.message;T6(e)||n.push(e===r.message?r:{...r,message:e})}return n}function I6(e){return e.detail?.trim()||void 0}var L6={add:`Adding`,analyze:`Analyzing`,apply:`Applying`,audit:`Auditing`,benchmark:`Benchmarking`,build:`Building`,bump:`Bumping`,capture:`Capturing`,check:`Checking`,clean:`Cleaning`,collect:`Collecting`,commit:`Committing`,compare:`Comparing`,confirm:`Confirming`,copy:`Copying`,count:`Counting`,create:`Creating`,debug:`Debugging`,delete:`Deleting`,diff:`Diffing`,disable:`Disabling`,dispatch:`Dispatching`,drive:`Driving`,dump:`Dumping`,edit:`Editing`,enable:`Enabling`,extract:`Extracting`,fetch:`Fetching`,find:`Finding`,fix:`Fixing`,format:`Formatting`,generate:`Generating`,grep:`Grepping`,inspect:`Inspecting`,install:`Installing`,kill:`Killing`,launch:`Launching`,lint:`Linting`,list:`Listing`,load:`Loading`,measure:`Measuring`,merge:`Merging`,migrate:`Migrating`,move:`Moving`,open:`Opening`,parse:`Parsing`,patch:`Patching`,poll:`Polling`,print:`Printing`,probe:`Probing`,profile:`Profiling`,publish:`Publishing`,pull:`Pulling`,push:`Pushing`,query:`Querying`,read:`Reading`,rebase:`Rebasing`,refactor:`Refactoring`,regenerate:`Regenerating`,remove:`Removing`,rename:`Renaming`,render:`Rendering`,reproduce:`Reproducing`,restart:`Restarting`,revert:`Reverting`,review:`Reviewing`,run:`Running`,save:`Saving`,scan:`Scanning`,search:`Searching`,seed:`Seeding`,spawn:`Spawning`,start:`Starting`,stop:`Stopping`,summarize:`Summarizing`,sync:`Syncing`,tag:`Tagging`,test:`Testing`,trace:`Tracing`,typecheck:`Typechecking`,update:`Updating`,validate:`Validating`,verify:`Verifying`,wait:`Waiting`,watch:`Watching`,write:`Writing`};function R6(e,t){let n=e?.trim();if(!n)return t;let r=n.indexOf(` `),i=(r===-1?n:n.slice(0,r)).replace(/[.:]$/,``);if(/ing$/i.test(i))return i.charAt(0).toUpperCase()+i.slice(1)+(r===-1?``:n.slice(r));let a=L6[i.toLowerCase()];return a?a+(r===-1?``:n.slice(r)):n.charAt(0).toUpperCase()+n.slice(1)}function z6(e,t){let n=t?.trim().replace(/\/+$/,``);if(!n||n===`/`||!n.startsWith(`/`))return e;let r=e.replaceAll(`${n}/`,``),i=/^(\/(?:Users|home)\/[^/]+)(?:\/|$)/.exec(n)?.[1];return i?r.replaceAll(`${i}/`,`~/`):r}function B6(e,t){return z6(V6(e),t)}function V6(e){let t=b6(e.name),n=I6(e),r=n?` ${n}`:``;return t===`bash`||t===`exec`||t===`run command`?R6(e.desc,n?`Running ${n}`:`Running a command`):t===`read`||t===`view image`?`Reading${r||` a file`}`:t===`grep`||t===`search`||t===`search query`||t===`find`?n?`Searching for ${n}`:`Searching`:t===`glob`||t===`find files`?n?`Finding ${n}`:`Finding files`:t===`edit`||t===`write`||t===`apply patch`?n?`Editing ${n}`:`Editing files`:t===`todos`||t===`update plan`?`Updating the plan`:t===`screenshot`||t===`snapshot`?n?`Capturing ${n}`:`Capturing the page`:t===`navigate`?n?`Navigating to ${n}`:`Navigating`:t===`evaluate`?`Evaluating the page`:t===`pages`?`Listing pages`:t===`new page`?`Opening a new page`:t===`close page`?`Closing the page`:t===`select page`?`Selecting a page`:t===`console`||t===`console message`?`Reading the console`:t===`network`||t===`network request`?`Inspecting network traffic`:t===`press key`?n?`Pressing ${n}`:`Pressing a key`:t===`fill form`?`Filling the form`:t===`dialog`?`Handling a dialog`:t===`upload`?n?`Uploading ${n}`:`Uploading a file`:t===`wait for`||t===`wait`?n?`Waiting for ${n}`:`Waiting`:t===`resize`?`Resizing the page`:t===`ask`?`Preparing a question`:t===`web`||t===`web search`?n?`Searching for ${n}`:`Searching the web`:`Using ${y6(e.name)||`a tool`}`}var H6=new Set([`edit`,`multiedit`,`write`,`apply patch`]);function U6(e){let t=new Set;for(let n of e){for(let e of n.edits??(n.edit?[n.edit]:[]))e.file.trim()&&t.add(e.file.trim());if(n.edit||n.edits?.length)continue;let e=n.detail?.trim();e&&H6.has(b6(n.name))&&t.add(e)}return t.size}function W6(e,t=0){let n=`Ran ${e} tool ${e===1?`call`:`calls`}`;return t===0?n:`${n}, edited ${t} file${t===1?``:`s`}`}function G6(e){return e>0?`${W6(e)}. Thinking…`:`Thinking…`}function K6(e,t){let n=e[t];return typeof n==`string`&&n?n:void 0}function q6(e,t){let n=e[t];return typeof n==`number`&&Number.isFinite(n)?n:void 0}function J6(e,t){let n=K6(e,t);if(n)try{let e=new URL(n);return e.protocol===`https:`||e.protocol===`http:`?e.href:void 0}catch{return}}function Y6({directive:e,icon:t,title:n,meta:r,children:i}){return(0,V.jsxs)(`section`,{"data-codex-directive":e.name,className:`min-w-0 ${V1} border border-border bg-panel-2/75 p-4`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center text-muted`,"aria-hidden":!0,children:t}),(0,V.jsx)(`div`,{className:`max-w-[calc(100%-1.5rem)] shrink-0 break-words text-[12px] font-medium leading-4 text-fg`,children:n}),r&&(0,V.jsx)(`div`,{className:`min-w-0 truncate text-[11px] font-normal leading-4 text-muted`,children:r})]}),i]})}function X6({children:e,mono:t=!1}){return(0,V.jsx)(`div`,{className:`ml-6 mt-1 break-words text-[11px] leading-4 text-muted${t?` font-mono-keep`:``}`,children:e})}function Z6({directive:e}){let t=e.attrs,n=K6(t,`display_name`)??K6(t,`skill_name`)??`Artifact template`,r=K6(t,`artifact_kind`),i=K6(t,`skill_name`),a=K6(t,`skill_directory`),[o,s]=(0,B.useState)(!!a);return(0,V.jsxs)(Y6,{directive:e,icon:(0,V.jsx)(lw,{size:15}),title:n,meta:r?`${r} template`:`Template`,children:[i&&(0,V.jsx)(X6,{mono:!0,children:i.startsWith(`$`)?i:`$${i}`}),o&&a&&(0,V.jsx)(`img`,{src:RH(`${a}/assets/preview.png`),alt:`${n} template preview`,loading:`lazy`,onError:()=>s(!1),className:`ml-6 mt-2 max-h-44 max-w-[calc(100%-1.5rem)] rounded-md border border-border object-contain`})]})}function Q6({directive:e}){let t=e.attrs,n=K6(t,`file`),r=q6(t,`start`),i=q6(t,`end`)??r,a=q6(t,`priority`),o=n?`${n}${r?`:${r}${i&&i!==r?`-${i}`:``}`:``}`:`Code location unavailable`;return(0,V.jsxs)(Y6,{directive:e,icon:(0,V.jsx)(fw,{size:15}),title:K6(t,`title`)??`Review finding`,meta:a===void 0?void 0:`P${a}`,children:[K6(t,`body`)&&(0,V.jsx)(X6,{children:K6(t,`body`)}),n?(0,V.jsx)(`button`,{type:`button`,className:`local-file-action ml-6 mt-1 max-w-[calc(100%-1.5rem)] break-all text-left font-mono-keep text-[11px] leading-4 text-accent underline decoration-dotted underline-offset-2`,"data-local-path":n,title:o,children:o}):(0,V.jsx)(X6,{mono:!0,children:o})]})}var $6={"git-stage":[hw,`Changes staged`],"git-commit":[QC,`Commit created`],"git-create-branch":[ZC,`Branch created`],"git-push":[Nw,`Branch pushed`],"git-create-pr":[nw,`Pull request created`]};function e8({directive:e}){let[t,n]=$6[e.name],r=K6(e.attrs,`branch`),i=J6(e.attrs,`url`),a=`${n}${e.attrs.isDraft===!0?` as draft`:``}`;return(0,V.jsx)(Y6,{directive:e,icon:(0,V.jsx)(t,{size:15}),title:i?(0,V.jsx)(`a`,{className:`text-accent underline underline-offset-2`,href:i,target:`_blank`,rel:`noopener noreferrer`,children:a}):a,meta:r&&(0,V.jsx)(`span`,{className:`font-mono-keep`,children:r})})}function t8({directive:e}){let t=K6(e.attrs,`threadId`),n=K6(e.attrs,`pendingWorktreeId`);return(0,V.jsx)(Y6,{directive:e,icon:(0,V.jsx)(mw,{size:15}),title:n?`Thread setup queued`:`Thread created`,meta:(t||n)&&(0,V.jsx)(`span`,{className:`font-mono-keep`,children:t??n})})}function n8({directive:e}){let t=K6(e.attrs,`reason`);return(0,V.jsx)(Y6,{directive:e,icon:(0,V.jsx)(EC,{size:15}),title:`Archive suggested`,meta:t})}function r8(e){if(typeof e!=`string`||!e)return;let t=e.match(/(?:^|;)INTERVAL=(\d+)(?:;|$)/)?.[1];return/(?:^|;)FREQ=HOURLY(?:;|$)/.test(e)?`Every ${t??`1`} hour${t===`1`||t===void 0?``:`s`}`:/(?:^|;)FREQ=WEEKLY(?:;|$)/.test(e)?`Weekly schedule`:`Custom schedule`}function i8({directive:e}){let t=e.attrs,n=K6(t,`mode`),r=K6(t,`name`)??`Automation`,i=r8(t.rrule),a=[r,n,K6(t,`status`),i].filter(Boolean).join(` · `);return(0,V.jsx)(Y6,{directive:e,icon:(0,V.jsx)(NC,{size:15}),title:`Automation suggested`,meta:a,children:K6(t,`prompt`)&&(0,V.jsx)(X6,{children:K6(t,`prompt`)})})}function a8({directive:e}){return e.name===`artifact-template`?(0,V.jsx)(Z6,{directive:e}):e.name===`code-comment`?(0,V.jsx)(Q6,{directive:e}):e.name.startsWith(`git-`)?(0,V.jsx)(e8,{directive:e}):e.name===`created-thread`?(0,V.jsx)(t8,{directive:e}):e.name===`archive`||e.name===`archive-thread`?(0,V.jsx)(n8,{directive:e}):(0,V.jsx)(i8,{directive:e})}var o8;function s8(){return o8??=UO(async()=>{let{default:e}=await import(`./mermaid.core-C2DMq9ss.js`);return{default:e}},__vite__mapDeps([2,3,4,1,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21])).then(({default:e})=>(e.initialize({startOnLoad:!1,securityLevel:`strict`,theme:`dark`,themeVariables:{background:`#181b20`,primaryColor:`#181b20`,primaryTextColor:`#e6e7e9`,primaryBorderColor:`#33363c`,lineColor:`#8b8f96`,secondaryColor:`#26282d`,tertiaryColor:`#0d0e10`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, monospace`}}),e)),o8}function c8({source:e}){let t=(0,B.useId)(),[n,r]=(0,B.useState)({}),i=e1(n.html??``);return(0,B.useEffect)(()=>{let n=!0;if(r({}),e.length>5e4)return r({error:`Diagram source exceeds the 50 KB rendering limit`}),()=>{n=!1};let i=`frizz-mermaid-${t.replace(/[^a-zA-Z0-9]/g,``)}`;return s8().then(t=>t.render(i,e)).then(({svg:e})=>{n&&r({html:e})}).catch(e=>{if(!n)return;let t=e instanceof Error?e.message.split(/\n| for text:/,1)[0]:`Unknown diagram error`;r({error:t.slice(0,240)})}).finally(()=>document.getElementById(`d${i}`)?.remove()),()=>{n=!1}},[t,e]),n.error?(0,V.jsxs)(`section`,{"data-mermaid-state":`error`,className:`${V1} border border-border bg-panel-2/75 p-4`,children:[(0,V.jsx)(`div`,{className:`text-[12px] font-medium text-fg`,children:`Diagram unavailable`}),(0,V.jsx)(`div`,{className:`mt-1 text-[11px] text-muted`,children:n.error}),(0,V.jsx)(`pre`,{className:`mt-2 overflow-x-auto whitespace-pre-wrap rounded-md bg-bg p-2 font-mono-keep text-[11px] text-muted`,children:e})]}):n.html?(0,V.jsx)(`div`,{"data-mermaid-state":`ready`,className:`overflow-x-auto ${V1} border border-border bg-panel-2/75 p-4 [&_svg]:mx-auto [&_svg]:h-auto [&_svg]:max-w-full`,dangerouslySetInnerHTML:i}):(0,V.jsx)(`div`,{"data-mermaid-state":`loading`,role:`status`,"aria-label":`Rendering diagram`,className:`h-24 animate-pulse ${V1} bg-panel-2`})}var l8=(0,B.createContext)(null),u8=(0,B.createContext)(null);function d8(){let e=(0,B.useContext)(l8),t=(0,B.useContext)(u8);return e??t}var f8=(0,B.createContext)(null);function p8(e){return e.status===`pending`&&e.backgroundState===`background`}function m8(e){let t=[];for(let n of e)for(let e of n.tools)p8(e)&&n.at&&t.push({label:e.desc??e.detail??e.command??`Background command`,startedAt:n.at,state:`running`,...e.shellId?{launchId:e.shellId}:{},...e.command?{command:e.command}:{}});return t}function h8(e){return e.map(e=>{if(!e.tools.some(p8))return e;let t=e.tools.filter(e=>!p8(e)),n=e.parts?.map(e=>e.kind===`tools`?{...e,tools:e.tools.filter(e=>!p8(e))}:e).filter(e=>e.kind!==`tools`||e.tools.length>0);return{...e,tools:t,parts:n}})}function g8({slug:e,onStatusApplied:t,onClose:n,virtualized:r=!1,showReturnToQueue:i=!1}){let a=sC(ej(),e);return(0,V.jsxs)(`div`,{className:`flex-1 min-h-0 flex flex-col`,children:[(0,V.jsx)(C8,{slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:i}),(0,V.jsx)(_8,{slug:e,virtualized:r}),a&&(0,V.jsx)(d4,{thread:a,sticky:!0,safeArea:!0,onArchived:t})]})}function _8({slug:e,virtualized:t}){let n=ej(),r=sC(n,e),i=r?.runtime===`running`||r?.runtime===`spawning`,a=l6(e),o=r?.pendingInteraction?void 0:r?.pendingAsk,s=uj(e,{poll:i}),c=Md(),l=(0,B.useRef)(!1),[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(null),m=(0,B.useMemo)(()=>s.data?.messages??[],[s.data]),h=(0,B.useMemo)(()=>m8(m),[m]),g=(0,B.useMemo)(()=>h8(m),[m]),_=(0,B.useMemo)(()=>L8(g),[g]),v=(0,B.useMemo)(()=>O6(g),[g]),y=i?j6(v):void 0,b=i?A6(v):void 0,x=b?B6(b,n?.projectDir):void 0,S=i?N6(v):void 0,C=(0,B.useMemo)(()=>{let e=i?F6(v):v;return g6(e,R8(e,_))},[v,i,_]),w=i,T=(0,B.useMemo)(()=>z1(m),[m]),E=(0,B.useMemo)(()=>Q0(m),[m]),{stickyUserMessage:D}=Hf(qj),{answeringForMessage:O}=k0(e,m),k=(0,B.useRef)(null),[A,j]=(0,B.useState)(null),M=s.data?.messages.length??0;(0,B.useEffect)(()=>{if(t)return;let e=k.current;e&&e.scrollHeight-e.scrollTop-e.clientHeight<=4&&(e.scrollTop=e.scrollHeight)},[M,i,t]);let N=(0,B.useCallback)(async()=>{if(l.current)return;let t=c.getQueryData([`transcript`,e]),n=t?.beforeCursor,r=t?.transcriptKey;if(!(!t?.hasEarlier||!n||!r)){l.current=!0,d(!0),p(null);try{let t=await X.threadTranscriptEarlier({slug:e,cursor:n}),i=c.getQueryData([`transcript`,e]);if(!i?.transcriptKey||i.transcriptKey!==r||t.transcriptKey!==r){await s.refetch(),Q(`Transcript changed while loading history; refreshed the current session`);return}c.setQueryData([`transcript`,e],gA(i,t))}catch(e){let t=e instanceof Error?e.message:`Could not load earlier transcript history`;p(t)}finally{l.current=!1,d(!1)}}},[s,c,e]);return(0,V.jsx)(l8.Provider,{value:e,children:(0,V.jsxs)(`div`,{"data-drawer-scroll-ready":s.isPending?`false`:`true`,className:`flex-1 min-h-0 flex flex-col overflow-hidden outline-none`,children:[(0,V.jsxs)(`div`,{className:`relative min-h-0 flex-1 flex flex-col`,children:[(0,V.jsx)(`div`,{ref:k,"data-drawer-transcript-scroll":!0,"data-virtualized-transcript-scroll":t||void 0,tabIndex:t?0:void 0,role:t?`region`:void 0,"aria-label":t?`Thread conversation`:void 0,"aria-busy":t&&u?!0:void 0,className:`relative min-h-0 flex-1 overflow-y-auto pb-3 outline-none [overflow-anchor:none] focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:t&&M>0?(0,V.jsx)(x8,{slug:e,transcriptRef:k,transcriptKey:s.data?.transcriptKey,messages:g,paired:T,answeringForMessage:O,thread:r,running:i,copyTerminalCommand:a,stickyUserMessage:D,transportFallback:s.transportFallback,isFetching:s.isFetching,refresh:()=>void s.refetch(),retryLiveUpdates:s.retryLiveUpdates,hasEarlier:s.data?.hasEarlier===!0,beforeCursor:s.data?.beforeCursor,loadingEarlier:u,earlierError:f,loadEarlier:()=>void N(),jumpOverlay:A}):(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(l3,{thread:r,className:`px-6 pt-5`,autoFocusFirst:!0}),s.transportFallback&&(0,V.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`mx-6 mt-3 flex flex-wrap items-center gap-2.5 rounded-xl border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:s.transportFallback.kind===`payload-too-large`?`Live payload ${s.transportFallback.actualBytes} bytes; socket limit ${s.transportFallback.maxBytes} bytes`:`Transcript read budget reached (${s.transportFallback.scope}); retry after about ${s.transportFallback.retryAfterMs}ms`,children:[(0,V.jsx)(Mw,{size:13,className:`shrink-0 text-muted`}),(0,V.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,s.transportFallback.kind===`payload-too-large`?`The transcript is too large for push; the last complete HTTP-loaded copy remains visible.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,V.jsx)(`button`,{type:`button`,disabled:s.isFetching,onClick:()=>void s.refetch(),className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-40`,children:s.isFetching?`Refreshing…`:`Refresh once`}),(0,V.jsx)(`button`,{type:`button`,onClick:s.retryLiveUpdates,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`,children:`Retry live`})]}),(0,V.jsx)(`div`,{"data-transcript-column":!0,className:`flex min-h-full flex-col px-6 py-5`,children:M===0?(0,V.jsx)(`div`,{className:`flex-1 flex items-center justify-center text-sm text-muted`,children:s.isPending?(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(G5,{}),` Loading…`]}):i?(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(G5,{}),` Session starting…`]}):t2(r)?(0,V.jsxs)(`div`,{className:`text-center`,children:[(0,V.jsx)(`p`,{className:`mb-3`,children:`No session is attached to this thread yet.`}),(0,V.jsx)(`button`,{className:`btn-ghost border border-border text-[12px]`,onClick:()=>X.adoptThread({slug:e}).catch(()=>{}),children:`Start a session on this thread`})]}):`No conversation yet.`}):(0,V.jsxs)(V.Fragment,{children:[H8(C.map(e=>e.message),(e,t)=>{let n=C[t].messageIndex,r=n===E&&D,i=(0,V.jsx)(S5,{m:e,answering:O(e),showSendButton:!0,paired:T[n],sticky:r,staleAwaiting:_>=0&&n<_},t);return r?(0,V.jsx)(b5,{children:i},t):i},e=>!!e.queued),(r?.providerFault||r?.limitPause||o||r?.runtime===`perm-prompt`||w||Z3(r)||r?.awaitingBackground)&&(0,V.jsx)(e0,{h:w&&!r?.providerFault&&!r?.limitPause&&!o&&r?.runtime!==`perm-prompt`?V8(C.map(e=>e.message)):14}),r?.providerFault&&!r.foreign?(0,V.jsx)(N5,{slug:e,sessionId:r.sessionId,fault:r.providerFault,retryText:E>=0?m[E]?.text:void 0}):r?.limitPause&&!r.foreign?(0,V.jsx)(F5,{slug:e,sessionId:r.sessionId,pause:r.limitPause}):o?(0,V.jsx)(z5,{ask:o,onTerminal:a}):r?.runtime===`perm-prompt`?(0,V.jsx)(I5,{onTerminal:a}):w?(0,V.jsx)(K5,{since:r?.lastUserAt,startedAt:S,activityLabel:x,run:y}):Z3(r)?(0,V.jsx)($3,{thread:r}):Y3(r)?(0,V.jsx)(X3,{thread:r}):null,r?.permPolicy?(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(L5,{policy:r.permPolicy,denies:r.permDenies})}):null,m.some(e=>e.queued)&&(0,V.jsx)(e0,{}),(0,V.jsx)(`div`,{className:`flex flex-col gap-3.5`,children:m.map((e,t)=>e.queued?(0,V.jsx)(S5,{m:e,paired:T[t]},`q${t}`):null)})]})})]})}),(0,V.jsx)(`div`,{ref:j,"data-transcript-overlay":!0,className:`pointer-events-none absolute inset-x-0 bottom-0 z-20 flex justify-end p-4 [&>*]:pointer-events-auto`})]}),(0,V.jsx)(`div`,{"data-thread-chat-footer":!0,className:`z-10 shrink-0 border-t border-border/60 bg-panel`,children:(0,V.jsx)(E2,{slug:e,onTerminal:a,ops:(0,V.jsx)(R5,{slug:e,transcriptShells:h,className:`px-1 pt-1.5`})})})]})})}var v8=700,y8=250,b8=(()=>{try{return localStorage.getItem(`frizz.debugScroll`)===`1`}catch{return!1}})();function x8({slug:e,transcriptRef:t,transcriptKey:n,messages:r,paired:i,answeringForMessage:a,thread:o,running:s,copyTerminalCommand:c,stickyUserMessage:l,transportFallback:u,isFetching:d,refresh:f,retryLiveUpdates:p,hasEarlier:m,beforeCursor:h,loadingEarlier:g,earlierError:_,loadEarlier:v,jumpOverlay:y}){let b=tj(),x=(0,B.useMemo)(()=>O6(r),[r]),S=s?j6(x):void 0,C=s?A6(x):void 0,w=C?B6(C,b):void 0,T=s?N6(x):void 0,E=(0,B.useMemo)(()=>L8(r),[r]),D=(0,B.useMemo)(()=>{let e=s?F6(x):x;return g6(e,R8(e,E))},[x,s,E]),O=s,k=(0,B.useMemo)(()=>m6(D.map(e=>e.message),R8(D,E),F8).map(e=>({...e,messageIndex:D[e.messageIndex].messageIndex})),[D,E]),A=(0,B.useMemo)(()=>Q0(r),[r]),j=!!(o?.providerFault&&!o.foreign||o?.limitPause&&!o.foreign||!o?.pendingInteraction&&o?.pendingAsk||o?.runtime===`perm-prompt`||O||Z3(o)||o?.awaitingBackground),M=(0,B.useMemo)(()=>O&&!(o?.providerFault&&!o.foreign)&&!(o?.limitPause&&!o.foreign)&&!(!o?.pendingInteraction&&o?.pendingAsk)&&o?.runtime!==`perm-prompt`?V8(D.map(e=>e.message)):14,[D,O,o]),N=(0,B.useMemo)(()=>{let e=[{key:`head-anchor`,kind:`head-anchor`}];u&&e.push({key:`transport-fallback`,kind:`transport-fallback`}),(m||g||_)&&e.push({key:`earlier-history:${h??`complete`}`,kind:`earlier-history`}),e.push(...k.map(e=>({...e,kind:`message`}))),e.push({key:`interactions`,kind:`interactions`}),j&&e.push({key:`runtime-status`,kind:`runtime-status`});let t=j||k.length>0?14:0;return r.forEach((n,r)=>{if(!n.queued)return;let i=`queued:${n.deliveryId??n.sourceId??r}`;e.push({key:i,kind:`queued`,message:n,messageIndex:r,gap:t}),t=14}),e},[h,_,m,j,g,k,r,u]),P=(0,B.useMemo)(()=>!l||A<0?-1:N.findIndex(e=>e.kind===`message`&&e.messageIndex===A),[A,N,l]),ee=eX({count:N.length,getScrollElement:()=>t.current,getItemKey:e=>N[e]?.key??e,estimateSize:e=>{let t=N[e];return t?t.kind===`head-anchor`||t.kind===`interactions`?1:t.kind===`earlier-history`?42:t.kind===`transport-fallback`?76:t.kind===`runtime-status`?54:t.kind===`message`?108+t.gap:82+t.gap:80},overscan:8,paddingStart:20,paddingEnd:20,anchorTo:`end`,followOnAppend:!0,scrollEndThreshold:4,scrollToFn:(e,{adjustments:t,behavior:n},r)=>{let i=r.scrollElement;i&&i.scrollTo({top:t===void 0?e:i.scrollTop+t,behavior:n})}}),[F,te]=(0,B.useState)(!0),ne=(0,B.useRef)(!0),re=(0,B.useRef)(-1),ie=(0,B.useRef)(0),ae=(0,B.useRef)(null),oe=(0,B.useRef)(!1),se=(0,B.useRef)(!1),ce=(0,B.useRef)(!0),le=(0,B.useRef)(null),ue=(0,B.useRef)(void 0),de=(0,B.useRef)(null),fe=(0,B.useRef)(void 0),pe=(0,B.useRef)(void 0),me=(0,B.useRef)(0),he=(0,B.useCallback)(()=>{let e=t.current;if(e){let t=e.getBoundingClientRect().top,n=Array.from(e.querySelectorAll(`[data-transcript-source-id]:not([data-transcript-sticky])`)).find(e=>e.getBoundingClientRect().bottom>t+1),r=n?.dataset.transcriptRowKey;n&&r&&(le.current={rowKey:r,viewportTop:n.getBoundingClientRect().top-t})}v()},[v,t]);(0,B.useLayoutEffect)(()=>{if(!n||N.length===0||ue.current===n)return;ue.current=n,oe.current=!1,se.current=!1,ce.current=!0;let e=requestAnimationFrame(()=>{ee.scrollToEnd({behavior:`instant`}),oe.current=!0,te(!0)});return()=>cancelAnimationFrame(e)},[N.length,n,ee]),(0,B.useLayoutEffect)(()=>{let e=le.current,n=t.current;if(!e||!n||g)return;let r=()=>{let t=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey);if(!t)return;let r=t.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=r-e.viewportTop};r();let i=0,a=requestAnimationFrame(()=>{r(),i=requestAnimationFrame(()=>{r(),le.current===e&&(le.current=null)})});return()=>{cancelAnimationFrame(a),cancelAnimationFrame(i)}},[g,k.length,t]);let ge=(0,B.useCallback)(()=>{let e=t.current;if(!e)return null;let n=e.getBoundingClientRect().top,r=Array.from(e.querySelectorAll(`[data-transcript-row-key]:not([data-transcript-sticky])`)).find(e=>e.getBoundingClientRect().bottom>n+1),i=r?.dataset.transcriptRowKey;return!r||!i?null:{rowKey:i,viewportTop:r.getBoundingClientRect().top-n}},[t]),_e=(0,B.useCallback)(e=>{let n=t.current;if(!n)return;let r=Array.from(n.querySelectorAll(`[data-transcript-row-key]`)).find(t=>t.dataset.transcriptRowKey===e.rowKey&&t.dataset.transcriptSticky!==`true`);if(!r)return;let i=r.getBoundingClientRect().top-n.getBoundingClientRect().top;n.scrollTop+=i-e.viewportTop},[t]),ve=P>=0?N[P]?.key:void 0;(0,B.useLayoutEffect)(()=>{let e=ve,t=fe.current;if(fe.current=e,t===void 0||t===e||ne.current)return;let n=de.current;if(!n||le.current)return;me.current=performance.now()+y8,_e(n);let r=0,i=0,a=requestAnimationFrame(()=>{_e(n),r=requestAnimationFrame(()=>{_e(n),i=requestAnimationFrame(()=>{_e(n),me.current=0})})});return()=>{cancelAnimationFrame(a),cancelAnimationFrame(r),cancelAnimationFrame(i),me.current=0}},[_e,ve]);let ye=k[0]?.key;(0,B.useLayoutEffect)(()=>{let e=pe.current;if(pe.current=ye,e===void 0||e===ye||!oe.current||ne.current||le.current)return;let t=de.current;if(!t)return;_e(t);let n=()=>{if(performance.now()<ie.current)return;let e=de.current;e&&_e(e)},r=0,i=requestAnimationFrame(()=>{n(),r=requestAnimationFrame(n)});return()=>{cancelAnimationFrame(i),cancelAnimationFrame(r)}},[_e,ye]);let be=(0,B.useCallback)(()=>{let e=t.current;if(!e||le.current||performance.now()<me.current)return;let n=d6({scrollTop:e.scrollTop,scrollHeight:e.scrollHeight,clientHeight:e.clientHeight,previousScrollHeight:re.current,following:ne.current,readerMoved:performance.now()<ie.current});if(ne.current=n.following,n.scrollTop!==null&&(e.scrollTop=n.scrollTop),re.current=e.scrollHeight,te(e=>e===n.following?e:n.following),b8&&!n.following&&performance.now()>=ie.current){let t=de.current,n=t&&Array.from(e.querySelectorAll(`[data-transcript-row-key]`)).find(e=>e.dataset.transcriptRowKey===t.rowKey&&e.dataset.transcriptSticky!==`true`);if(t&&n){let r=Math.round(n.getBoundingClientRect().top-e.getBoundingClientRect().top-t.viewportTop);Math.abs(r)>2&&console.warn(`[frizz] transcript moved ${r}px under a still reader — pin=${fe.current??`none`} row=${t.rowKey}`)}}de.current=ge()??de.current},[ge,t]);(0,B.useLayoutEffect)(be),(0,B.useEffect)(()=>{let e=ae.current;if(!e)return;let t=new ResizeObserver(be);return t.observe(e),()=>t.disconnect()},[be]),(0,B.useEffect)(()=>{let e=t.current;if(!e)return;let n=()=>{be();let t=f6({armed:ce.current,scrollTop:e.scrollTop,readerMoved:oe.current&&se.current,hasEarlier:m,loading:g});ce.current=t.armed,t.shouldLoad&&he()},r=()=>{se.current=!0,ie.current=performance.now()+v8,requestAnimationFrame(n)},i=t=>{[`ArrowUp`,`PageUp`,`Home`,` `].includes(t.key)&&(e.scrollTop<=480&&(ce.current=!0),r())},a=t=>{t.deltaY<0&&e.scrollTop<=480&&(ce.current=!0),r()},o=()=>{e.scrollTop<=480&&(ce.current=!0),r()};e.addEventListener(`scroll`,n,{passive:!0}),e.addEventListener(`wheel`,a,{passive:!0}),e.addEventListener(`touchstart`,o,{passive:!0}),e.addEventListener(`touchmove`,o,{passive:!0}),e.addEventListener(`pointerdown`,r,{passive:!0}),e.addEventListener(`keydown`,i);let s=requestAnimationFrame(n);return()=>{cancelAnimationFrame(s),e.removeEventListener(`scroll`,n),e.removeEventListener(`wheel`,a),e.removeEventListener(`touchstart`,o),e.removeEventListener(`touchmove`,o),e.removeEventListener(`pointerdown`,r),e.removeEventListener(`keydown`,i)}},[m,g,he,be,t]);let xe=ee.getVirtualItems(),Se=ee.getTotalSize(),Ce=P>=0?N[P]:void 0,we=Ce?.kind===`message`?Ce:void 0,Te=we?ee.measurementsCache[P]?.start??0:0;return(0,V.jsxs)(`div`,{ref:ae,"data-virtualized-transcript":!0,"data-virtual-row-count":xe.length,className:`relative w-full`,style:{height:Se},children:[we&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{"aria-hidden":!0,style:{height:Te}}),(0,V.jsx)(`div`,{ref:ee.measureElement,"data-index":P,"data-transcript-row-key":we.key,"data-transcript-source-id":we.message.sourceId,"data-transcript-sticky":`true`,className:`pointer-events-none [&>*]:pointer-events-auto sticky top-0 z-[9] flex w-full flex-col px-6 pt-3 pb-1.5`,children:(0,V.jsx)(S5,{m:we.message,answering:a(we.message),showSendButton:!0,paired:i[we.messageIndex],sticky:!0})},we.key)]}),xe.map(t=>{let n=N[t.index];return!n||t.index===P?null:(0,V.jsx)(`div`,{ref:ee.measureElement,"data-index":t.index,"data-transcript-row-key":n.key,"data-transcript-source-id":n.kind===`message`?n.message.sourceId:void 0,className:`absolute left-0 top-0 w-full`,style:{transform:`translateY(${t.start}px)`},children:n.kind===`head-anchor`?null:n.kind===`interactions`?(0,V.jsx)(l3,{thread:o,className:`px-6 pt-5`,autoFocusFirst:!0}):n.kind===`transport-fallback`?u?(0,V.jsx)(`div`,{className:`px-6 pt-3`,children:(0,V.jsxs)(`div`,{"data-transcript-sync-fallback":!0,className:`flex flex-wrap items-center gap-2.5 ${V1} border border-border-strong bg-panel-2 px-4 py-2.5 text-[12px]`,title:u.kind===`payload-too-large`?`Live payload ${u.actualBytes} bytes; socket limit ${u.maxBytes} bytes`:`Transcript read budget reached (${u.scope}); retry after about ${u.retryAfterMs}ms`,children:[(0,V.jsx)(Mw,{size:13,className:`shrink-0 text-muted`}),(0,V.jsxs)(`div`,{className:`min-w-[180px] flex-1 leading-snug text-fg/85`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:`Live transcript updates paused.`}),` `,u.kind===`payload-too-large`?`The transcript is too large for push; the last complete HTTP-loaded copy remains visible.`:`The live read budget was reached; the last complete copy remains visible. Retry in a moment.`]}),(0,V.jsx)(`button`,{type:`button`,disabled:d,onClick:f,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel disabled:opacity-40`,children:d?`Refreshing…`:`Refresh once`}),(0,V.jsx)(`button`,{type:`button`,onClick:p,className:`shrink-0 rounded-md border border-border px-2 py-1 text-[11px] text-fg/90 transition-colors hover:bg-panel`,children:`Retry live`})]})}):null:n.kind===`earlier-history`?(0,V.jsx)(`div`,{className:`flex min-h-10 items-center justify-center px-6 text-[11px] text-muted`,role:`status`,children:_?(0,V.jsxs)(`span`,{className:`flex flex-wrap items-center justify-center gap-2 text-center`,children:[(0,V.jsx)(`span`,{children:_}),(0,V.jsx)(`button`,{type:`button`,onClick:he,className:`rounded-md border border-border px-2 py-1 text-fg/90 hover:bg-panel-2`,children:`Retry`})]}):g?(0,V.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(dw,{size:12,className:`animate-spin`}),` Loading earlier messages…`]}):(0,V.jsx)(`button`,{type:`button`,onClick:he,className:`rounded-md px-2 py-1 outline-none hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:`Load earlier messages`})}):n.kind===`message`?(0,V.jsx)(`div`,{className:`flex flex-col px-6`,style:{paddingTop:n.gap},children:(0,V.jsx)(S5,{m:n.message,answering:a(n.message),showSendButton:!0,paired:i[n.messageIndex],staleAwaiting:E>=0&&n.messageIndex<E})}):n.kind===`runtime-status`?(0,V.jsxs)(`div`,{className:`px-6`,style:{paddingTop:M},children:[o?.providerFault&&!o.foreign?(0,V.jsx)(N5,{slug:e,sessionId:o.sessionId,fault:o.providerFault,retryText:A>=0?r[A]?.text:void 0}):o?.limitPause&&!o.foreign?(0,V.jsx)(F5,{slug:e,sessionId:o.sessionId,pause:o.limitPause}):!o?.pendingInteraction&&o?.pendingAsk?(0,V.jsx)(z5,{ask:o.pendingAsk,onTerminal:c}):o?.runtime===`perm-prompt`?(0,V.jsx)(I5,{onTerminal:c}):O?(0,V.jsx)(K5,{since:o?.lastUserAt,startedAt:T,activityLabel:w,run:S}):Z3(o)?(0,V.jsx)($3,{thread:o}):Y3(o)?(0,V.jsx)(X3,{thread:o}):null,o?.permPolicy?(0,V.jsx)(`div`,{className:`mt-3`,children:(0,V.jsx)(L5,{policy:o.permPolicy,denies:o.permDenies})}):null]}):(0,V.jsx)(`div`,{className:`flex flex-col px-6`,style:{paddingTop:n.gap},children:(0,V.jsx)(S5,{m:n.message,paired:i[n.messageIndex]})})},n.key)}),(0,V.jsx)(S8,{overlay:y,hidden:F,onJump:()=>ee.scrollToEnd({behavior:`smooth`})})]})}function S8({overlay:e,hidden:t,onJump:n}){return!e||t?null:(0,Xd.createPortal)((0,V.jsxs)(`button`,{type:`button`,"data-jump-to-latest":!0,onClick:n,className:`flex items-center gap-1.5 rounded-full border border-border-strong bg-elevated px-3 py-1.5 text-[11px] font-medium text-fg shadow-lg shadow-black/30 hover:bg-panel-2`,children:[(0,V.jsx)(DC,{size:12}),`Jump to latest`]}),e)}function C8({slug:e,onStatusApplied:t,onClose:n,showReturnToQueue:r=!1}){let i=sC(ej(),e),a=Jd({mutationFn:()=>X.markComplete({slug:e})}),o=Jd({mutationFn:t=>X.renameThread({slug:e,title:t})}),s=Jd({mutationFn:()=>X.aiRenameThread({slug:e}),onSuccess:({title:e})=>Q(`Renamed to “${e}”`),onError:e=>Q(e instanceof Error?e.message:`Could not rename with Claude`,{duration:7e3})}),[c,l]=(0,B.useState)(!1),[u,d]=(0,B.useState)(``),f=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!c)return;let e=requestAnimationFrame(()=>{f.current?.focus(),f.current?.select()});return()=>cancelAnimationFrame(e)},[c]),(0,B.useEffect)(()=>{l(!1),d(``)},[e]);let p=qQ(qd({queryKey:[`threadBody`,e],queryFn:()=>X.threadBody({slug:e})}).data?.markdown??``).trim().length>0;if(!i)return null;let m=i.kind===`session`&&i.foreign!==!0,h=i.foreign===!0,g=i.kind===`session`&&!h,_=Zj(i),v=i2(i),y=!v.enabled||s.isPending,b=s.isPending?`Claude is generating a title…`:v.enabled&&s.error instanceof Error?s.error.message:v.label;function x(){l(!1),d(``)}function S(){let e=n2(u,_);if(l(!1),!e){d(``);return}o.mutate(e,{onSuccess:()=>{d(``),Q(`Thread renamed`)},onError:t=>{d(e),l(!0),Q(t instanceof Error?t.message:`Could not rename thread`)}})}return(0,V.jsxs)(`header`,{"data-thread-header":!0,className:a2,children:[(0,V.jsx)(`div`,{className:o2,children:(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1.5`,children:[r&&(0,V.jsx)(Pq,{label:`Return to queue`,children:(0,V.jsx)(`a`,{href:vj(`/`),"aria-label":`Return to queue`,"data-standalone-return":!0,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:(0,V.jsx)(OC,{size:14})})}),(0,V.jsxs)(`div`,{className:`min-w-0 flex-1 leading-tight`,children:[(0,V.jsxs)(`div`,{className:`flex min-w-0 items-center gap-1`,children:[c?(0,V.jsx)(`input`,{ref:f,"aria-label":`Thread title`,value:u,maxLength:200,onChange:e=>d(e.target.value),onBlur:S,onKeyDown:e=>{e.key===`Enter`?(e.preventDefault(),S()):e.key===`Escape`&&(e.preventDefault(),x())},className:`min-w-0 flex-1 rounded-md border border-border bg-elevated px-1.5 py-1 font-semibold text-[15px] text-fg outline-none focus:border-accent`}):g?(0,V.jsx)(`button`,{type:`button`,title:`Edit title`,"aria-label":`Edit thread title: ${_}`,disabled:o.isPending||s.isPending,onClick:()=>{d(r2(_,i.id)),l(!0)},className:`min-w-0 max-w-full shrink truncate rounded px-0.5 -mx-0.5 font-semibold text-[15px] text-left outline-none transition-colors hover:bg-panel-2 focus-visible:ring-1 focus-visible:ring-fg/60 disabled:cursor-not-allowed disabled:opacity-40`,children:_}):(0,V.jsx)(`div`,{className:`min-w-0 max-w-full shrink truncate px-0.5 -mx-0.5 font-semibold text-[15px]`,title:_,children:_}),v.show&&!c&&(0,V.jsx)(Pq,{label:b,children:(0,V.jsx)(`button`,{type:`button`,"aria-label":s.isPending?`Renaming with Claude`:v.enabled?`Rename with Claude`:v.label,title:b,"aria-busy":s.isPending,"aria-disabled":y,onClick:()=>{y||(s.reset(),s.mutate())},className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md outline-none transition-colors ${y?`cursor-not-allowed opacity-40`:``} ${s.error?`text-red-400 hover:bg-red-500/10`:`text-accent hover:bg-accent/10`}`,children:(0,V.jsx)(Ew,{size:13,strokeWidth:2,className:s.isPending?`animate-pulse`:``})})})]}),(0,V.jsx)(e6,{at:cM(i),fallbackAt:i.spawnedAt,className:`mt-0.5 block truncate text-[11px] leading-tight text-muted/75`})]})]})}),(0,V.jsxs)(`div`,{className:s2,children:[(0,V.jsxs)(`div`,{className:`flex shrink-0 items-center`,children:[m&&(0,V.jsx)(u6,{slug:e}),(0,V.jsx)(D2,{thread:i,onDoc:p?()=>US(`doc`,i.id):void 0,onDone:()=>a.mutate(void 0,{onSuccess:t}),doneBusy:a.isPending,onStatusApplied:t}),n&&(0,V.jsx)(Pq,{label:`Open in new tab`,children:(0,V.jsx)(`a`,{href:Px(e),target:`_blank`,rel:`noopener`,"aria-label":`Open in new tab`,className:`flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60`,children:(0,V.jsx)(kC,{size:14})})})]}),n&&(0,V.jsx)(`button`,{type:`button`,"aria-label":`Close`,"data-dialog-initial-focus":!0,onClick:n,className:`ml-0.5 shrink-0 rounded-md p-1.5 text-muted outline-none transition-colors hover:bg-panel-2 hover:text-fg`,children:(0,V.jsx)(Pw,{size:15})})]})]})}function w8(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||g4(e))return null;if(e.parts&&e.parts.length>0){for(let t=e.parts.length-1;t>=0;t--){let n=e.parts[t];if(n.kind===`tools`?n.tools.length>0:n.text.trim())return n.kind===`tools`?n.tools:null}return null}return(e.tools?.length??0)>0&&!e.text.trim()?e.tools:null}function T8(e){if(e.kind===`event`||e.kind===`reasoning`||e.role===`user`||g4(e))return null;if(e.parts&&e.parts.length>0){for(let t of e.parts)if(t.kind===`tools`?t.tools.length>0:t.text.trim())return t.kind===`tools`?t.tools:null;return null}return(e.tools?.length??0)>0?e.tools:null}function E8(e){return w8(e)!==null}function D8(e){return T8(e)!==null}function O8(e){return e.kind===`event`&&!e.boundary||e.kind===`reasoning`}function k8(e){return O8(e)||E8(e)}function A8(e){return O8(e)||D8(e)}function j8(e){if(O8(e))return!0;let t=w8(e);return t!==null&&!x6(t[t.length-1])}function M8(e){if(O8(e))return!0;let t=T8(e);return t!==null&&!x6(t[0])}function N8(e){let t=w8(e);return t!==null&&S6(t[t.length-1])}function P8(e){let t=T8(e);return t!==null&&S6(t[0])}function F8(e,t){let n=N8(e)||P8(t),r=!n&&k8(e)&&A8(t)&&!(j8(e)&&M8(t));return(n?22:r?6:14)+(e.role===`user`&&t.role!==`user`?3:0)}function I8(e,t){return e.kind===`event`||e.kind===`reasoning`||e.role===`user`?!1:e.parts&&e.parts.length>0?e.parts.every(n=>n.kind===`tools`?n.tools.length===0:z8(e,n.text,t)):(e.tools?.length??0)===0&&z8(e,e.text,t)}function L8(e){for(let t=e.length-1;t>=0;t--)if(e[t].role===`assistant`&&e[t].kind!==`event`)return t;return-1}function R8(e,t){let n=new WeakSet;if(t>=0)for(let r of e)r.messageIndex<t&&n.add(r.message);return e=>I8(e,n.has(e))}function z8(e,t,n){return!e.fenceRefused&&!n?!t.trim():O1(t).every(e=>e.kind===`fence`&&e.fenceKind===`awaiting`)}function B8(e,t){return e.kind===`event`||e.kind===`reasoning`||e.role===`user`?!1:e.parts&&e.parts.length>0?e.parts.some(n=>n.kind===`text`&&!z8(e,n.text,t)):typeof e.text==`string`&&!z8(e,e.text,t)}function V8(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(!(n.queued||I8(n)))return N8(n)?22:k8(n)&&!j8(n)?6:14+(n.role===`user`?3:0)}return 0}function H8(e,t,n){let r=[],i=null;return e.forEach((e,a)=>{n?.(e,a)||I8(e)||(i!==null&&r.push((0,V.jsx)(e0,{h:F8(i,e)},`s${a}`)),r.push(t(e,a)),i=e)}),r}function U8(e){let t=[];for(let n of e){if(n.kind===`text`){if(!n.text.trim())continue;t.push(n);continue}if(n.tools.length===0)continue;let e=t[t.length-1];e&&e.kind===`tools`?t[t.length-1]={kind:`tools`,tools:[...e.tools,...n.tools]}:t.push(n)}return t}function W8(e,t=14){let n=e.filter(e=>e!=null&&e!==!1),r=[];return n.forEach((e,n)=>{n>0&&r.push((0,V.jsx)(e0,{h:typeof t==`number`?t:t(n)},`vs${n}`)),r.push(e)}),r}var G8={head:!1,tail:!1};function K8(e,t){return n=>e[n-1]?.tail||e[n]?.head?22:t}function q8(e){return{head:S6(e[0]),tail:S6(e[e.length-1])}}function J8(e){let t=[];for(let n of e){let e=t[t.length-1];if(n.edit){let r=!!(n.input||n.output||n.status||n.exitCode!==void 0);e&&e.edits&&!r&&!e.input&&!e.output&&!e.status&&e.edits[0].file===n.edit.file?e.edits.push(n.edit):t.push({name:n.name,detail:n.detail,edits:[n.edit],input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}else n.command?t.push({name:n.name,detail:n.detail,command:n.command,desc:n.desc,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):n.outputImage?t.push({name:n.name,detail:n.detail,outputImage:n.outputImage,output:n.output??n.read,status:n.status,durationMs:n.durationMs,count:1}):n.read?t.push({name:n.name,detail:n.detail,read:n.read,status:n.status,durationMs:n.durationMs,count:1}):n.prompt||n.agentId?t.push({name:n.name,detail:n.detail,prompt:n.prompt,input:n.input,subagentType:n.subagentType,agentId:n.agentId,agentStatus:n.agentStatus,agentElapsedMs:n.agentElapsedMs,output:n.output,status:n.status,durationMs:n.durationMs,count:1}):n.sendTo!==void 0||n.sendBody!==void 0?t.push({name:n.name,detail:n.detail,sendTo:n.sendTo,sendSummary:n.sendSummary,sendBody:n.sendBody,sendType:n.sendType,sendDispatchId:n.sendDispatchId,sendTargetLabel:n.sendTargetLabel,status:n.status,durationMs:n.durationMs,count:1}):n.todos?t.push({name:n.name,detail:n.detail,todos:n.todos,input:n.input,status:n.status,durationMs:n.durationMs,count:1}):n.sentImages||n.sentFiles?t.push({name:n.name,detail:n.detail,sentImages:n.sentImages,sentFiles:n.sentFiles,caption:n.caption,status:n.status,durationMs:n.durationMs,count:1}):n.input||n.output?t.push({name:n.name,detail:n.detail,input:n.input,output:n.output,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1}):e&&!e.edits&&!e.command&&!e.input&&!e.output&&!e.read&&!e.prompt&&!e.outputImage&&!e.sentImages&&!e.sentFiles&&e.sendTo===void 0&&e.sendBody===void 0&&e.name===n.name&&e.detail===n.detail&&e.status===n.status&&e.backgroundState===n.backgroundState&&e.exitCode===n.exitCode&&e.cwd===n.cwd&&e.sessionId===n.sessionId&&e.durationMs===n.durationMs?e.count++:t.push({name:n.name,detail:n.detail,status:n.status,backgroundState:n.backgroundState,exitCode:n.exitCode,cwd:n.cwd,sessionId:n.sessionId,durationMs:n.durationMs,count:1})}return t}function Y8(e){return e.split(`__`).pop()||e}function X8(e){let t=Z.board?.projectDir;return t&&e.startsWith(t+`/`)?e.slice(t.length+1):e}function Z8({tools:e,at:t}){let[n,r]=(0,B.useState)(!1),i=(0,B.useId)(),a=e.reduce((e,t)=>e+t.count,0),o=W6(a,U6(e));return(0,V.jsxs)(`div`,{"data-tool-activity":!0,"data-tool-activity-state":`settled`,className:`flex min-w-0 flex-col`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":i,"aria-expanded":n,"aria-label":`${n?`Collapse`:`Expand`} ${a} tool ${a===1?`call`:`calls`}: ${o}`,className:`group flex w-full min-w-0 items-baseline gap-1.5 rounded py-0.5 text-left outline-none transition-colors hover:text-fg focus-visible:ring-1 focus-visible:ring-fg/60 ${S4}`,children:[(0,V.jsx)(`span`,{"data-tool-activity-label":!0,title:o,className:`min-w-0 truncate text-muted`,children:o}),(0,V.jsx)(LC,{"data-tool-activity-chevron":!0,"aria-hidden":`true`,size:13,className:w4(n)})]}),n&&(0,V.jsx)(`div`,{id:i,className:`mt-1.5 flex flex-col`,children:W8(e.map((e,n)=>(0,V.jsx)($8,{t:e,startedAt:t},n)),6)}),!n&&(0,V.jsx)(`div`,{id:i,hidden:!0})]})}function Q8({tools:e,at:t}){let n=[];for(let t of e){let e=x6(t),r=n[n.length-1];r?.exceptional===e?r.tools.push(t):n.push({exceptional:e,tools:[t]})}return(0,V.jsx)(`div`,{className:`flex flex-col`,children:W8(n.map((e,n)=>e.exceptional?(0,V.jsx)(`div`,{className:`flex flex-col`,children:W8(e.tools.map((e,n)=>(0,V.jsx)($8,{t:e,startedAt:t},n)),K8(e.tools.map(e=>q8([e])),6))},`exceptions-${n}`):(0,V.jsx)(Z8,{tools:e.tools,at:t},`activity-${n}`)),K8(n.map(e=>q8(e.tools)),6))})}function $8({t:e,startedAt:t}){let n=(0,B.useContext)(l8),r=ej(),i=ZM(e,(n?sC(r,n):void 0)?.bgShells??[]);return e.edits&&e.status!==`failed`&&e.status!==`cancelled`?(0,V.jsx)(U$,{edits:e.edits,meta:(0,V.jsx)(r5,{status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,durationMs:e.durationMs})}):e.command?(0,V.jsx)(d5,{command:e.command,desc:e.desc??e.detail,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t}):e.outputImage?(0,V.jsx)(c5,{name:e.name,detail:e.detail,outputImage:e.outputImage,output:e.output,status:e.status,durationMs:e.durationMs}):e.read?(0,V.jsx)(p5,{detail:e.detail,read:e.read,status:e.status,durationMs:e.durationMs}):e.prompt||e.agentId?(0,V.jsx)(h5,{detail:e.detail,prompt:e.prompt,input:e.input,subagentType:e.subagentType,agentId:e.agentId,agentStatus:e.agentStatus,agentElapsedMs:e.agentElapsedMs,status:e.status,durationMs:e.durationMs,output:e.output}):e.sendTo!==void 0||e.sendBody!==void 0?(0,V.jsx)(_5,{to:e.sendTo,summary:e.sendSummary,body:e.sendBody??``,type:e.sendType,dispatchId:e.sendDispatchId,targetLabel:e.sendTargetLabel,status:e.status,durationMs:e.durationMs}):e.sentImages||e.sentFiles?(0,V.jsx)(l5,{images:e.sentImages??[],files:e.sentFiles??[],caption:e.caption,status:e.status,durationMs:e.durationMs}):e.todos?(0,V.jsx)(s1,{todos:e.todos,note:e.input,meta:(0,V.jsx)(r5,{status:e.status,durationMs:e.durationMs})}):e.input||e.output?(0,V.jsx)(d5,{name:e.name,command:e.input??``,desc:e.detail,output:e.output,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,sessionId:e.sessionId,durationMs:e.durationMs,inputLabel:`input`,startedAt:t}):(0,V.jsx)(s5,{name:e.name,detail:e.detail,count:e.count,status:e.status,backgroundState:e.backgroundState,liveBackgroundState:i,exitCode:e.exitCode,cwd:e.cwd,sessionId:e.sessionId,durationMs:e.durationMs,startedAt:t})}function e5({tone:e,indicator:t,label:n,duration:r,title:i}){return(0,V.jsxs)(`span`,{className:`petite-caps frizz-tool-header-caps flex shrink-0 items-center gap-1 whitespace-nowrap text-[11.5px] leading-none ${e}`,title:i,"aria-label":i,children:[t,(0,V.jsx)(`span`,{children:[n,r].filter(Boolean).join(` · `)})]})}function t5(e,t,n){let[r,i]=(0,B.useState)(()=>Date.now()),a=JM(e,t),o=YM(e,t,n,r);return(0,B.useEffect)(()=>{if(!a||o)return;let e=n?Date.parse(n):NaN;if(!Number.isFinite(e))return;let t=setTimeout(()=>i(Date.now()),Math.max(qM-(Date.now()-e),0));return()=>clearTimeout(t)},[a,o,n]),o}function n5({status:e,backgroundState:t,liveBackgroundState:n,startedAt:r}){let i=t5(e,t,r),a=n===`running`?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):n===`stale`?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot-quiet frizz-live-dot-quiet--shell`,"data-running-indicator":`tool-quiet`,title:fN}):KM(e,t)||i?(0,V.jsx)(`span`,{"aria-hidden":!0,className:`frizz-live-dot frizz-live-dot--shell`,"data-running-indicator":`tool-disclosure`}):null;return a?(0,V.jsx)(`span`,{className:`frizz-tool-mark -mr-1 flex w-[9px] shrink-0 justify-center`,children:a}):null}function r5({status:e,backgroundState:t,liveBackgroundState:n,exitCode:r,durationMs:i}){if(!e&&i===void 0)return null;let[a,o]=n===`running`?[`running`,`background running`]:n===`stale`?[`stale`,`background stale`]:e===`pending`?t===`unknown`?[`unknown`,`background / unknown`]:[`running`,t===`background`?`background running`:`running`]:e===`failed`?r===void 0?[`failed`,`failed`]:[`exit ${r}`,`exit ${r}`]:e===`cancelled`?[`cancelled`,`cancelled`]:e===`completed`?[`done`,`done`]:[void 0,void 0],s=i===void 0?void 0:QM(i),c=[o,s].filter(Boolean).join(` · `);return(0,V.jsx)(e5,{tone:e===`failed`?`frizz-tool-failed`:e===`cancelled`?`text-amber-400`:`text-muted/55`,title:c,label:a,duration:s})}function i5(e,t,n){let r=t?Date.parse(t):NaN,i=e===`pending`&&Number.isFinite(r),[a,o]=(0,B.useState)(()=>Date.now());return(0,B.useEffect)(()=>{if(!i)return;let e=()=>o(Date.now()),t,n=setTimeout(()=>{e(),t=setInterval(e,1e3)},1e3-Date.now()%1e3);return()=>{clearTimeout(n),t&&clearInterval(t)}},[i,t]),i?Math.max(a-r,0):n}function a5(e,t,n){let r=t&&t!==Z.board?.projectDir?`in ${X8(t)}`:void 0;return[e,t?r:n!==void 0&&!e?.includes(String(n))?`session ${n}`:void 0].filter(Boolean).join(` · `)||void 0}function o5(e){return e.startsWith(`/`)&&!e.includes(` `)&&!e.includes(`…`)}function s5({name:e,detail:t,count:n,status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,cwd:s,sessionId:c,durationMs:l,startedAt:u}){let d=a5(t,s,c),f=d?X8(d):void 0,p=t&&o5(t)?t:void 0;return(0,V.jsx)(`div`,{className:`frizz-bash`,title:d,children:(0,V.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(n5,{status:r,backgroundState:i,liveBackgroundState:a,startedAt:u}),(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:Y8(e)}),f&&(p?(0,V.jsx)(`span`,{className:`min-w-0 truncate`,onClick:e=>e.stopPropagation(),children:(0,V.jsx)(V$,{path:p,className:`text-[11.5px] text-muted`,children:f})}):(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:f}))]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(r5,{status:r,backgroundState:i,liveBackgroundState:a,exitCode:o,durationMs:l}),n>1&&(0,V.jsxs)(`span`,{className:`tabular-nums text-[11px] text-muted/45`,children:[`×`,n]})]})]})})}function c5({name:e,detail:t,outputImage:n,output:r,status:i,durationMs:a}){let o=t?X8(t):void 0,s=(0,V.jsxs)(`div`,{className:`frizz-bash-header`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:Y8(e)}),o&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,title:t,children:o})]}),(0,V.jsx)(`span`,{className:`flex shrink-0 items-center gap-2`,children:(0,V.jsx)(r5,{status:i,durationMs:a})})]});return(0,V.jsxs)(`div`,{children:[(0,V.jsx)(T5,{path:n,hideCaption:!0,altText:o?`${Y8(e)}: ${o}`:Y8(e),header:s}),r&&(0,V.jsx)(`pre`,{className:`frizz-bash frizz-bash-body frizz-bash-output-body mt-1.5`,children:r})]})}function l5({images:e,files:t,caption:n,status:r,durationMs:i}){let[a,o]=(0,B.useState)(!0),s=(0,B.useId)(),c=[e.length?`${e.length} image${e.length===1?``:`s`}`:``,t.length?`${t.length} file${t.length===1?``:`s`}`:``].filter(Boolean).join(` · `);return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":s,"aria-expanded":a,"aria-label":`${a?`Collapse`:`Expand`} files sent to you${c?`: ${c}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Sent to you`}),c&&(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:c})]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(r5,{status:r,durationMs:i}),(0,V.jsx)(LC,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${a?`rotate-90`:``}`})]})]}),(0,V.jsx)(`div`,{id:s,hidden:!a,children:a&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1.5 px-2.5 pb-2.5 pt-1.5`,children:[e.map((e,t)=>(0,V.jsx)(T5,{path:e,hideCaption:!0,altText:n??`delivered image`},`i${t}`)),t.length>0&&(0,V.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map((e,t)=>(0,V.jsx)(E5,{path:e},`f${t}`))}),n&&(0,V.jsx)(`div`,{className:`max-w-[65%] text-[12px] leading-snug text-muted`,children:n})]})})]})}var u5=16;function d5({command:e,desc:t,output:n,name:r=`Bash`,status:i,backgroundState:a,liveBackgroundState:o,exitCode:s,sessionId:c,durationMs:l,inputLabel:u,startedAt:d}){let[f,p]=(0,B.useState)(!1),[m,h]=(0,B.useState)(!1),[g,_]=(0,B.useState)(!1),v=(0,B.useId)(),y=i5(i,d,l),b=(0,B.useMemo)(()=>e.split(`
481
481
  `).length,[e]),x=b>u5,S=(0,B.useMemo)(()=>n?n.split(`
482
482
  `).length:0,[n]),C=S>u5,w=a5(t,void 0,c),T=!!(e||n);return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>T&&p(e=>!e),onMouseDown:e=>e.preventDefault(),"aria-controls":T?v:void 0,"aria-expanded":T?f:void 0,"aria-label":`${T?`${f?`Collapse`:`Expand`} `:``}${Y8(r)}${w?`: ${w}`:``}`,className:`frizz-bash-header w-full text-left outline-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-fg/60`,children:[(0,V.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,V.jsx)(n5,{status:i,backgroundState:a,liveBackgroundState:o,startedAt:d}),(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:Y8(r)}),(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,title:w,children:w??``})]}),(0,V.jsxs)(`span`,{className:`flex shrink-0 items-center gap-2`,children:[(0,V.jsx)(r5,{status:i,backgroundState:a,liveBackgroundState:o,exitCode:s,durationMs:y}),T&&(0,V.jsx)(LC,{"aria-hidden":`true`,size:12,className:`shrink-0 text-muted transition-transform ${f?`rotate-90`:``}`})]})]}),T&&(0,V.jsxs)(`div`,{id:v,hidden:!f,children:[f&&e&&(0,V.jsxs)(V.Fragment,{children:[u&&(0,V.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:u}),(0,V.jsx)(t1,{text:e,language:u?`plaintext`:`bash`,className:`frizz-bash-body${u?` frizz-bash-output-body`:``}${x&&!m?` frizz-bash-clamp`:``}`}),x&&(0,V.jsx)(`button`,{type:`button`,onClick:()=>h(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand petite-caps px-2.5 pb-1.5`,children:m?`Collapse`:`Show all ${b} lines`})]}),f&&n&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`div`,{className:`frizz-bash-output-label petite-caps`,children:`output`}),(0,V.jsx)(`pre`,{className:`frizz-bash-body frizz-bash-output-body${C&&!g?` frizz-bash-clamp`:``}`,children:n}),C&&(0,V.jsx)(`button`,{type:`button`,onClick:()=>_(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand petite-caps px-2.5 pb-1.5`,children:g?`Collapse`:`Show all ${S} lines`})]})]})]})}var f5=16;function p5({detail:e,read:t,status:n,durationMs:r}){let[i,a]=(0,B.useState)(!1),[o,s]=(0,B.useState)(!1),c=(0,B.useId)(),l=(0,B.useMemo)(()=>t.split(`
483
483
  `).length,[t]),u=l>f5,d=e?X8(e):void 0,f=e&&o5(e)?e:void 0;return(0,V.jsxs)(`div`,{className:`frizz-bash`,children:[(0,V.jsxs)(B$,{className:`frizz-bash-header`,controls:c,expanded:i,label:`${i?`Collapse`:`Expand`} Read${e?`: ${e}`:``}`,onToggle:()=>a(e=>!e),meta:(0,V.jsx)(r5,{status:n,durationMs:r}),children:[(0,V.jsx)(`span`,{className:`petite-caps frizz-bash-label shrink-0`,children:`Read`}),d&&(f?(0,V.jsx)(`span`,{className:`min-w-0 truncate`,children:(0,V.jsx)(V$,{path:f,className:`text-[11.5px] text-muted`,children:d})}):(0,V.jsx)(`span`,{className:`min-w-0 truncate text-[11.5px] text-muted`,children:d}))]}),(0,V.jsx)(`div`,{id:c,hidden:!i,children:i&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(t1,{text:t,language:gQ(e),className:`frizz-bash-body${u&&!o?` frizz-bash-clamp`:``}`}),u&&(0,V.jsx)(`button`,{type:`button`,onClick:()=>s(e=>!e),onMouseDown:e=>e.preventDefault(),className:`frizz-bash-expand petite-caps px-2.5 pb-1.5`,children:o?`Collapse`:`Show all ${l} lines`})]})})]})}var m5=16;function h5({detail:e,prompt:t,input:n,subagentType:r,agentId:i,agentStatus:a,agentElapsedMs:o,status:s,durationMs:c,output:l}){let[u,d]=(0,B.useState)(!1),[f,p]=(0,B.useState)(!1),m=(0,B.useId)(),h=t??n,g=(0,B.useMemo)(()=>h?h.split(`