@crouton-kit/crouter 0.3.70 → 0.3.78

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 (147) hide show
  1. package/README.md +1 -1
  2. package/dist/builtin-memory/00-runtime-base.md +3 -10
  3. package/dist/builtin-memory/04-base-worker.md +18 -0
  4. package/dist/builtin-memory/04-orchestration-kernel.md +1 -1
  5. package/dist/builtin-pi-packages/pi-crtr-extensions/README.md +13 -34
  6. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/__tests__/provider-rotation.test.ts +622 -724
  7. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/provider-rotation.ts +231 -68
  8. package/dist/builtin-pi-packages/pi-crtr-extensions/extensions/statusline.ts +2 -9
  9. package/dist/builtin-pi-packages/pi-crtr-extensions/lib/subscription-state.ts +361 -90
  10. package/dist/builtin-pi-packages/pi-crtr-extensions/package-lock.json +2 -2
  11. package/dist/builtin-pi-packages/pi-mode-switch/README.md +11 -39
  12. package/dist/builtin-pi-packages/pi-mode-switch/extensions/index.ts +20 -15
  13. package/dist/builtin-pi-packages/pi-mode-switch/package.json +1 -1
  14. package/dist/builtin-views/canvas/tui.mjs +8 -9
  15. package/dist/builtin-views/chat/tui.mjs +12 -12
  16. package/dist/builtin-views/git-pr/tui.mjs +7 -8
  17. package/dist/builtin-views/inbox/tui.mjs +27 -41
  18. package/dist/builtin-views/linkedin/tui.mjs +23 -37
  19. package/dist/builtin-views/prompt-review/tui.mjs +11 -11
  20. package/dist/builtin-views/settings/tui.mjs +11 -11
  21. package/dist/builtin-views/workspace-sidebar/tui.mjs +8 -9
  22. package/dist/clients/attach/__tests__/attach-chrome-remote.test.js +3 -3
  23. package/dist/clients/attach/__tests__/crtr-output-render.test.js +1 -1
  24. package/dist/clients/attach/__tests__/mermaid-render.test.d.ts +1 -0
  25. package/dist/clients/attach/__tests__/mermaid-render.test.js +20 -0
  26. package/dist/clients/attach/__tests__/oauth-dialog-lifecycle.test.d.ts +1 -0
  27. package/dist/clients/attach/__tests__/oauth-dialog-lifecycle.test.js +110 -0
  28. package/dist/clients/attach/attach-cmd.d.ts +1 -1
  29. package/dist/clients/attach/attach-cmd.js +738 -735
  30. package/dist/clients/attach/canvas-panels.js +2 -3
  31. package/dist/clients/attach/chat-view.d.ts +7 -8
  32. package/dist/clients/attach/chat-view.js +119 -79
  33. package/dist/clients/attach/edit-diff-render.d.ts +6 -0
  34. package/dist/clients/attach/edit-diff-render.js +263 -0
  35. package/dist/clients/attach/input-controller.d.ts +28 -2
  36. package/dist/clients/attach/input-controller.js +38 -5
  37. package/dist/clients/attach/mermaid-render.js +5 -2
  38. package/dist/clients/attach/pickers.d.ts +8 -7
  39. package/dist/clients/attach/pickers.js +11 -17
  40. package/dist/clients/attach/slash-commands.d.ts +9 -0
  41. package/dist/clients/attach/slash-commands.js +127 -7
  42. package/dist/clients/attach/titled-editor.d.ts +12 -1
  43. package/dist/clients/attach/titled-editor.js +103 -8
  44. package/dist/commands/canvas-browse.js +2 -2
  45. package/dist/commands/memory/lint.js +39 -5
  46. package/dist/commands/memory/write.js +1 -0
  47. package/dist/commands/node.js +9 -2
  48. package/dist/commands/surface-tmux-spread.js +1 -3
  49. package/dist/commands/sys/__tests__/config-keybindings.test.d.ts +1 -0
  50. package/dist/commands/sys/__tests__/config-keybindings.test.js +55 -0
  51. package/dist/commands/sys/__tests__/config-model-ladders.test.d.ts +1 -0
  52. package/dist/commands/sys/__tests__/config-model-ladders.test.js +121 -0
  53. package/dist/commands/sys/config.js +18 -21
  54. package/dist/commands/sys/setup-core.d.ts +12 -1
  55. package/dist/commands/sys/setup-core.js +23 -3
  56. package/dist/commands/sys/setup.js +42 -12
  57. package/dist/core/__tests__/base-worker-prompt.test.d.ts +1 -0
  58. package/dist/core/__tests__/base-worker-prompt.test.js +24 -0
  59. package/dist/core/__tests__/canvas-inbox-watcher-hold.test.js +232 -1
  60. package/dist/core/__tests__/fault-classifier.test.js +15 -0
  61. package/dist/core/__tests__/full/broker-dialogs.test.js +7 -2
  62. package/dist/core/__tests__/host-teardown-process-group.test.js +15 -4
  63. package/dist/core/__tests__/stream-watchdog.test.d.ts +1 -0
  64. package/dist/core/__tests__/stream-watchdog.test.js +70 -0
  65. package/dist/core/__tests__/tmux-surface.test.js +72 -0
  66. package/dist/core/canvas/browse/__tests__/model.test.js +23 -5
  67. package/dist/core/canvas/browse/__tests__/render.test.js +1 -0
  68. package/dist/core/canvas/browse/app.js +164 -5
  69. package/dist/core/canvas/browse/model.d.ts +10 -6
  70. package/dist/core/canvas/browse/model.js +20 -12
  71. package/dist/core/canvas/browse/pins.d.ts +4 -0
  72. package/dist/core/canvas/browse/pins.js +29 -0
  73. package/dist/core/canvas/browse/render.d.ts +13 -1
  74. package/dist/core/canvas/browse/render.js +72 -15
  75. package/dist/core/canvas/nav-model.js +5 -11
  76. package/dist/core/canvas/paths.d.ts +5 -0
  77. package/dist/core/canvas/paths.js +7 -0
  78. package/dist/core/config.d.ts +53 -2
  79. package/dist/core/config.js +228 -110
  80. package/dist/core/fault-classifier.js +1 -1
  81. package/dist/core/fs-utils.d.ts +1 -0
  82. package/dist/core/fs-utils.js +15 -1
  83. package/dist/core/keybindings/__tests__/resolve.test.d.ts +1 -0
  84. package/dist/core/keybindings/__tests__/resolve.test.js +224 -0
  85. package/dist/core/keybindings/catalog.d.ts +14 -0
  86. package/dist/core/keybindings/catalog.js +256 -0
  87. package/dist/core/keybindings/index.d.ts +5 -0
  88. package/dist/core/keybindings/index.js +4 -0
  89. package/dist/core/keybindings/match.d.ts +29 -0
  90. package/dist/core/keybindings/match.js +99 -0
  91. package/dist/core/keybindings/persistence.d.ts +14 -0
  92. package/dist/core/keybindings/persistence.js +31 -0
  93. package/dist/core/keybindings/resolve.d.ts +14 -0
  94. package/dist/core/keybindings/resolve.js +305 -0
  95. package/dist/core/keybindings/types.d.ts +37 -0
  96. package/dist/core/keybindings/types.js +1 -0
  97. package/dist/core/memory-resolver.d.ts +1 -1
  98. package/dist/core/memory-resolver.js +10 -3
  99. package/dist/core/predicate.d.ts +5 -3
  100. package/dist/core/predicate.js +5 -3
  101. package/dist/core/runtime/broker-protocol.d.ts +33 -5
  102. package/dist/core/runtime/broker.js +163 -14
  103. package/dist/core/runtime/launch.d.ts +39 -6
  104. package/dist/core/runtime/launch.js +78 -20
  105. package/dist/core/runtime/naming.js +3 -3
  106. package/dist/core/runtime/pi-cli.d.ts +6 -0
  107. package/dist/core/runtime/pi-cli.js +16 -2
  108. package/dist/core/runtime/placement.d.ts +2 -2
  109. package/dist/core/runtime/placement.js +4 -1
  110. package/dist/core/runtime/promote.js +4 -0
  111. package/dist/core/runtime/recap.d.ts +3 -3
  112. package/dist/core/runtime/recap.js +47 -44
  113. package/dist/core/runtime/recycle.js +6 -1
  114. package/dist/core/runtime/reset.js +5 -0
  115. package/dist/core/runtime/session-list-cache.d.ts +23 -0
  116. package/dist/core/runtime/session-list-cache.js +270 -0
  117. package/dist/core/runtime/spawn.js +51 -32
  118. package/dist/core/runtime/stream-watchdog.d.ts +26 -0
  119. package/dist/core/runtime/stream-watchdog.js +75 -0
  120. package/dist/core/runtime/tmux-chrome.d.ts +1 -1
  121. package/dist/core/runtime/tmux-chrome.js +2 -2
  122. package/dist/core/runtime/tmux.d.ts +18 -15
  123. package/dist/core/runtime/tmux.js +216 -110
  124. package/dist/core/tui/__tests__/host-keybindings.test.d.ts +1 -0
  125. package/dist/core/tui/__tests__/host-keybindings.test.js +112 -0
  126. package/dist/core/tui/host.d.ts +30 -1
  127. package/dist/core/tui/host.js +148 -34
  128. package/dist/core/view/contract.d.ts +17 -3
  129. package/dist/pi-extensions/__tests__/canvas-stophook-agentend.test.js +41 -0
  130. package/dist/pi-extensions/__tests__/canvas-stophook-context-nudge.test.d.ts +1 -0
  131. package/dist/pi-extensions/__tests__/canvas-stophook-context-nudge.test.js +121 -0
  132. package/dist/pi-extensions/canvas-inbox-watcher.d.ts +1 -1
  133. package/dist/pi-extensions/canvas-inbox-watcher.js +203 -25
  134. package/dist/pi-extensions/canvas-recap.d.ts +4 -0
  135. package/dist/pi-extensions/canvas-recap.js +38 -37
  136. package/dist/pi-extensions/canvas-stophook.d.ts +11 -0
  137. package/dist/pi-extensions/canvas-stophook.js +33 -4
  138. package/dist/types.d.ts +3 -13
  139. package/dist/types.js +2 -26
  140. package/dist/web-client/assets/{index-DiFuLcp6.js → index--md2ylfi.js} +1 -1
  141. package/dist/web-client/index.html +1 -1
  142. package/dist/web-client/sw.js +1 -1
  143. package/package.json +3 -3
  144. package/dist/pi-extensions/canvas-nav.d.ts +0 -43
  145. package/dist/pi-extensions/canvas-nav.js +0 -640
  146. package/dist/pi-extensions/widget-order-bus.d.ts +0 -6
  147. package/dist/pi-extensions/widget-order-bus.js +0 -34
@@ -48,7 +48,7 @@ Please change the parent <Route path="${e}"> to <Route path="${e===`/`?`*`:`${e}
48
48
  `},ra=function(){var e=parseInt(document.body.getAttribute(`data-scroll-locked`)||`0`,10);return isFinite(e)?e:0},ia=function(){v.useEffect(function(){return document.body.setAttribute(ta,(ra()+1).toString()),function(){var e=ra()-1;e<=0?document.body.removeAttribute(ta):document.body.setAttribute(ta,e.toString())}},[])},aa=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,i=r===void 0?`margin`:r;ia();var a=v.useMemo(function(){return $i(i)},[i]);return v.createElement(ea,{styles:na(a,!t,i,n?``:`!important`)})},oa=!1;if(typeof window<`u`)try{var sa=Object.defineProperty({},"passive",{get:function(){return oa=!0,!0}});window.addEventListener(`test`,sa,sa),window.removeEventListener(`test`,sa,sa)}catch{oa=!1}var ca=oa?{passive:!1}:!1,la=function(e){return e.tagName===`TEXTAREA`},ua=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!==`hidden`&&!(n.overflowY===n.overflowX&&!la(e)&&n[t]===`visible`)},da=function(e){return ua(e,`overflowY`)},fa=function(e){return ua(e,`overflowX`)},pa=function(e,t){var n=t.ownerDocument,r=t;do{if(typeof ShadowRoot<`u`&&r instanceof ShadowRoot&&(r=r.host),ga(e,r)){var i=_a(e,r);if(i[1]>i[2])return!0}r=r.parentNode}while(r&&r!==n.body);return!1},ma=function(e){return[e.scrollTop,e.scrollHeight,e.clientHeight]},ha=function(e){return[e.scrollLeft,e.scrollWidth,e.clientWidth]},ga=function(e,t){return e===`v`?da(t):fa(t)},_a=function(e,t){return e===`v`?ma(t):ha(t)},va=function(e,t){return e===`h`&&t===`rtl`?-1:1},ya=function(e,t,n,r,i){var a=va(e,window.getComputedStyle(t).direction),o=a*r,s=n.target,c=t.contains(s),l=!1,u=o>0,d=0,f=0;do{if(!s)break;var p=_a(e,s),m=p[0],h=p[1]-p[2]-a*m;(m||h)&&ga(e,s)&&(d+=h,f+=m);var g=s.parentNode;s=g&&g.nodeType===Node.DOCUMENT_FRAGMENT_NODE?g.host:g}while(!c&&s!==document.body||c&&(t.contains(s)||t===s));return(u&&(i&&Math.abs(d)<1||!i&&o>d)||!u&&(i&&Math.abs(f)<1||!i&&-o>f))&&(l=!0),l},ba=function(e){return`changedTouches`in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},xa=function(e){return[e.deltaX,e.deltaY]},Sa=function(e){return e&&`current`in e?e.current:e},Ca=function(e,t){return e[0]===t[0]&&e[1]===t[1]},wa=function(e){return`
49
49
  .block-interactivity-${e} {pointer-events: none;}
50
50
  .allow-interactivity-${e} {pointer-events: all;}
51
- `},Ta=0,Ea=[];function Da(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(Ta++)[0],a=v.useState(Yi)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ti([e.lockRef.current],(e.shards||[]).map(Sa),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=v.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=ba(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=pa(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=pa(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return ya(h,t,e,h===`h`?s:c,!0)},[]),c=v.useCallback(function(e){var n=e;if(!(!Ea.length||Ea[Ea.length-1]!==a)){var r=`deltaY`in n?xa(n):ba(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Ca(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Sa).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=v.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Oa(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=v.useCallback(function(e){n.current=ba(e),r.current=void 0},[]),d=v.useCallback(function(t){l(t.type,xa(t),t.target,s(t,e.lockRef.current))},[]),f=v.useCallback(function(t){l(t.type,ba(t),t.target,s(t,e.lockRef.current))},[]);v.useEffect(function(){return Ea.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,ca),document.addEventListener(`touchmove`,c,ca),document.addEventListener(`touchstart`,u,ca),function(){Ea=Ea.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,ca),document.removeEventListener(`touchmove`,c,ca),document.removeEventListener(`touchstart`,u,ca)}},[]);var p=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(a,{styles:wa(i)}):null,p?v.createElement(aa,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Oa(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var ka=Ri(zi,Da),Aa=v.forwardRef(function(e,t){return v.createElement(Vi,Ci({},e,{ref:t,sideCar:ka}))});Aa.classNames=Vi.classNames;var ja=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Ma=new WeakMap,Na=new WeakMap,Pa={},Fa=0,Ia=function(e){return e&&(e.host||Ia(e.parentNode))},La=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Ia(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})},Ra=function(e,t,n,r){var i=La(t,Array.isArray(e)?e:[e]);Pa[n]||(Pa[n]=new WeakMap);var a=Pa[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=(Ma.get(e)||0)+1,l=(a.get(e)||0)+1;Ma.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Na.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(),Fa++,function(){o.forEach(function(e){var t=Ma.get(e)-1,i=a.get(e)-1;Ma.set(e,t),a.set(e,i),t||(Na.has(e)||e.removeAttribute(r),Na.delete(e)),i||e.removeAttribute(n)}),Fa--,Fa||(Ma=new WeakMap,Ma=new WeakMap,Na=new WeakMap,Pa={})}},za=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||ja(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Ra(r,i,n,`aria-hidden`)):function(){return null}},Ba=`Dialog`,[Va,Ha]=yr(Ba),[Ua,Wa]=Va(Ba),Ga=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),[l,u]=wr({prop:r,defaultProp:i??!1,onChange:a,caller:Ba});return(0,B.jsx)(Ua,{scope:t,triggerRef:s,contentRef:c,contentId:Ir(),titleId:Ir(),descriptionId:Ir(),open:l,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Ga.displayName=Ba;var Ka=`DialogTrigger`,qa=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Wa(Ka,n),a=Zn(t,i.triggerRef);return(0,B.jsx)(pr.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":po(i.open),...r,ref:a,onClick:V(e.onClick,i.onOpenToggle)})});qa.displayName=Ka;var Ja=`DialogPortal`,[Ya,Xa]=Va(Ja,{forceMount:void 0}),Za=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Wa(Ja,t);return(0,B.jsx)(Ya,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,B.jsx)(Or,{present:n||a.open,children:(0,B.jsx)(vi,{asChild:!0,container:i,children:e})}))})};Za.displayName=Ja;var Qa=`DialogOverlay`,$a=v.forwardRef((e,t)=>{let n=Xa(Qa,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Wa(Qa,e.__scopeDialog);return a.modal?(0,B.jsx)(Or,{present:r||a.open,children:(0,B.jsx)(to,{...i,ref:t})}):null});$a.displayName=Qa;var eo=Qn(`DialogOverlay.RemoveScroll`),to=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Wa(Qa,n),a=Zn(t,Yr());return(0,B.jsx)(Aa,{as:eo,allowPinchZoom:!0,shards:[i.contentRef],children:(0,B.jsx)(pr.div,{"data-state":po(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})}),no=`DialogContent`,ro=v.forwardRef((e,t)=>{let n=Xa(no,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Wa(no,e.__scopeDialog);return(0,B.jsx)(Or,{present:r||a.open,children:a.modal?(0,B.jsx)(io,{...i,ref:t}):(0,B.jsx)(ao,{...i,ref:t})})});ro.displayName=no;var io=v.forwardRef((e,t)=>{let n=Wa(no,e.__scopeDialog),r=v.useRef(null),i=Zn(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return za(e)},[]),(0,B.jsx)(oo,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:V(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:V(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:V(e.onFocusOutside,e=>e.preventDefault())})}),ao=v.forwardRef((e,t)=>{let n=Wa(no,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,B.jsx)(oo,{...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()}})}),oo=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Wa(no,n);return xi(),(0,B.jsx)(B.Fragment,{children:(0,B.jsx)(ai,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(Kr,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":po(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),so=`DialogTitle`,co=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Wa(so,n);return(0,B.jsx)(pr.h2,{id:i.titleId,...r,ref:t})});co.displayName=so;var lo=`DialogDescription`,U=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Wa(lo,n);return(0,B.jsx)(pr.p,{id:i.descriptionId,...r,ref:t})});U.displayName=lo;var uo=`DialogClose`,fo=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Wa(uo,n);return(0,B.jsx)(pr.button,{type:`button`,...r,ref:t,onClick:V(e.onClick,()=>i.onOpenChange(!1))})});fo.displayName=uo;function po(e){return e?`open`:`closed`}function mo(e){let t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ho(e){let[t,n]=v.useState(void 0);return Sr(()=>{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 go=[`top`,`right`,`bottom`,`left`],_o=Math.min,vo=Math.max,yo=Math.round,bo=Math.floor,xo=e=>({x:e,y:e}),So={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Co(e,t,n){return vo(e,_o(t,n))}function wo(e,t){return typeof e==`function`?e(t):e}function To(e){return e.split(`-`)[0]}function Eo(e){return e.split(`-`)[1]}function Do(e){return e===`x`?`y`:`x`}function Oo(e){return e===`y`?`height`:`width`}function ko(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ao(e){return Do(ko(e))}function jo(e,t,n){n===void 0&&(n=!1);let r=Eo(e),i=Ao(e),a=Oo(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Bo(o)),[o,Bo(o)]}function Mo(e){let t=Bo(e);return[No(e),t,No(t)]}function No(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Po=[`left`,`right`],Fo=[`right`,`left`],Io=[`top`,`bottom`],Lo=[`bottom`,`top`];function Ro(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Fo:Po:t?Po:Fo;case`left`:case`right`:return t?Io:Lo;default:return[]}}function zo(e,t,n,r){let i=Eo(e),a=Ro(To(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(No)))),a}function Bo(e){let t=To(e);return So[t]+e.slice(t.length)}function Vo(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ho(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Vo(e)}function Uo(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 Wo(e,t,n){let{reference:r,floating:i}=e,a=ko(t),o=Ao(t),s=Oo(o),c=To(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(Eo(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 Go(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}=wo(t,e),p=Ho(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Uo(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=Uo(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 Ko=50,qo=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Go},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Wo(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<Ko&&(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}=Wo(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Jo=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}=wo(e,t)||{};if(l==null)return{};let d=Ho(u),f={x:n,y:r},p=Ao(i),m=Oo(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=_o(d[_],T),D=_o(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Co(O,A,k),M=!c.arrow&&Eo(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}}}),Yo=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}=wo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=To(r),_=ko(o),v=To(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Bo(o)]:Mo(o)),x=p!==`none`;!d&&x&&b.push(...zo(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=jo(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`&&_!==ko(t))||T.every(e=>ko(e.placement)!==_||e.overflows[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=ko(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 Xo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Zo(e){return go.some(t=>e[t]>=0)}var Qo=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=wo(e,t);switch(i){case`referenceHidden`:{let e=Xo(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Zo(e)}}}case`escaped`:{let e=Xo(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Zo(e)}}}default:return{}}}}},$o=new Set([`left`,`top`]);async function es(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=To(n),s=Eo(n),c=ko(n)===`y`,l=$o.has(o)?-1:1,u=a&&c?-1:1,d=wo(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 ts=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 es(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}}}}},ns=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}=wo(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=ko(To(i)),p=Do(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=Co(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=Co(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}}}}}},rs=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}=wo(e,t),u={x:n,y:r},d=ko(i),f=Do(d),p=u[f],m=u[d],h=wo(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=$o.has(To(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}}}},is=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}=wo(e,t),u=await o.detectOverflow(t,l),d=To(i),f=Eo(i),p=ko(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=_o(h-u[g],v),x=_o(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=vo(u.left,0),t=vo(u.right,0),n=vo(u.top,0),r=vo(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:vo(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:vo(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 as(){return typeof window<`u`}function os(e){return ls(e)?(e.nodeName||``).toLowerCase():`#document`}function ss(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cs(e){return((ls(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ls(e){return as()?e instanceof Node||e instanceof ss(e).Node:!1}function us(e){return as()?e instanceof Element||e instanceof ss(e).Element:!1}function ds(e){return as()?e instanceof HTMLElement||e instanceof ss(e).HTMLElement:!1}function fs(e){return!as()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof ss(e).ShadowRoot}function ps(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ws(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ms(e){return/^(table|td|th)$/.test(os(e))}function hs(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var gs=/transform|translate|scale|rotate|perspective|filter/,_s=/paint|layout|strict|content/,vs=e=>!!e&&e!==`none`,ys;function bs(e){let t=us(e)?ws(e):e;return vs(t.transform)||vs(t.translate)||vs(t.scale)||vs(t.rotate)||vs(t.perspective)||!Ss()&&(vs(t.backdropFilter)||vs(t.filter))||gs.test(t.willChange||``)||_s.test(t.contain||``)}function xs(e){let t=Es(e);for(;ds(t)&&!Cs(t);){if(bs(t))return t;if(hs(t))return null;t=Es(t)}return null}function Ss(){return ys??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ys}function Cs(e){return/^(html|body|#document)$/.test(os(e))}function ws(e){return ss(e).getComputedStyle(e)}function Ts(e){return us(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Es(e){if(os(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||fs(e)&&e.host||cs(e);return fs(t)?t.host:t}function Ds(e){let t=Es(e);return Cs(t)?e.ownerDocument?e.ownerDocument.body:e.body:ds(t)&&ps(t)?t:Ds(t)}function Os(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ds(e),i=r===e.ownerDocument?.body,a=ss(r);if(i){let e=ks(a);return t.concat(a,a.visualViewport||[],ps(r)?r:[],e&&n?Os(e):[])}else return t.concat(r,Os(r,[],n))}function ks(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function As(e){let t=ws(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ds(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=yo(n)!==a||yo(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function js(e){return us(e)?e:e.contextElement}function Ms(e){let t=js(e);if(!ds(t))return xo(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=As(t),o=(a?yo(n.width):n.width)/r,s=(a?yo(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ns=xo(0);function Ps(e){let t=ss(e);return!Ss()||!t.visualViewport?Ns:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fs(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ss(e)?!1:t}function Is(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=js(e),o=xo(1);t&&(r?us(r)&&(o=Ms(r)):o=Ms(e));let s=Fs(a,n,r)?Ps(a):xo(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=ss(a),t=r&&us(r)?ss(r):r,n=e,i=ks(n);for(;i&&r&&t!==n;){let e=Ms(i),t=i.getBoundingClientRect(),r=ws(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=ss(i),i=ks(n)}}return Uo({width:u,height:d,x:c,y:l})}function Ls(e,t){let n=Ts(e).scrollLeft;return t?t.left+n:Is(cs(e)).left+n}function Rs(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ls(e,n),y:n.top+t.scrollTop}}function zs(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=cs(r),s=t?hs(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=xo(1),u=xo(0),d=ds(r);if((d||!d&&!a)&&((os(r)!==`body`||ps(o))&&(c=Ts(r)),d)){let e=Is(r);l=Ms(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Rs(o,c):xo(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 Bs(e){return Array.from(e.getClientRects())}function Vs(e){let t=cs(e),n=Ts(e),r=e.ownerDocument.body,i=vo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=vo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Ls(e),s=-n.scrollTop;return ws(r).direction===`rtl`&&(o+=vo(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Hs=25;function Us(e,t){let n=ss(e),r=cs(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ss();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Ls(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<=Hs&&(a-=o)}else l<=Hs&&(a+=l);return{width:a,height:o,x:s,y:c}}function Ws(e,t){let n=Is(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ds(e)?Ms(e):xo(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Gs(e,t,n){let r;if(t===`viewport`)r=Us(e,n);else if(t===`document`)r=Vs(cs(e));else if(us(t))r=Ws(t,n);else{let n=Ps(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Uo(r)}function Ks(e,t){let n=Es(e);return n===t||!us(n)||Cs(n)?!1:ws(n).position===`fixed`||Ks(n,t)}function qs(e,t){let n=t.get(e);if(n)return n;let r=Os(e,[],!1).filter(e=>us(e)&&os(e)!==`body`),i=null,a=ws(e).position===`fixed`,o=a?Es(e):e;for(;us(o)&&!Cs(o);){let t=ws(o),n=bs(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||ps(o)&&!n&&Ks(e,o))?r=r.filter(e=>e!==o):i=t,o=Es(o)}return t.set(e,r),r}function Js(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?hs(t)?[]:qs(t,this._c):[].concat(n),r],o=Gs(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=Gs(t,a[e],i);s=vo(n.top,s),c=_o(n.right,c),l=_o(n.bottom,l),u=vo(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ys(e){let{width:t,height:n}=As(e);return{width:t,height:n}}function Xs(e,t,n){let r=ds(t),i=cs(t),a=n===`fixed`,o=Is(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=xo(0);function l(){c.x=Ls(i)}if(r||!r&&!a)if((os(t)!==`body`||ps(i))&&(s=Ts(t)),r){let e=Is(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?Rs(i,s):xo(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 Zs(e){return ws(e).position===`static`}function Qs(e,t){if(!ds(e)||ws(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return cs(e)===n&&(n=n.ownerDocument.body),n}function $s(e,t){let n=ss(e);if(hs(e))return n;if(!ds(e)){let t=Es(e);for(;t&&!Cs(t);){if(us(t)&&!Zs(t))return t;t=Es(t)}return n}let r=Qs(e,t);for(;r&&ms(r)&&Zs(r);)r=Qs(r,t);return r&&Cs(r)&&Zs(r)&&!bs(r)?n:r||xs(e)||n}var ec=async function(e){let t=this.getOffsetParent||$s,n=this.getDimensions,r=await n(e.floating);return{reference:Xs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function tc(e){return ws(e).direction===`rtl`}var nc={convertOffsetParentRelativeRectToViewportRelativeRect:zs,getDocumentElement:cs,getClippingRect:Js,getOffsetParent:$s,getElementRects:ec,getClientRects:Bs,getDimensions:Ys,getScale:Ms,isElement:us,isRTL:tc};function rc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ic(e,t){let n=null,r,i=cs(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=bo(d),h=bo(i.clientWidth-(u+f)),g=bo(i.clientHeight-(d+p)),_=bo(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:vo(0,_o(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&&!rc(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 ac(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=js(e),u=i||a?[...l?Os(l):[],...t?Os(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?ic(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?Is(e):null;c&&g();function g(){let t=Is(e);h&&!rc(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 oc=ts,sc=ns,cc=Yo,lc=is,uc=Qo,dc=Jo,fc=rs,pc=(e,t,n)=>{let r=new Map,i={platform:nc,...n},a={...i.platform,_c:r};return qo(e,t,{...i,platform:a})},mc=typeof document<`u`?v.useLayoutEffect:function(){};function hc(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(!hc(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)&&!hc(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function gc(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _c(e,t){let n=gc(e);return Math.round(t*n)/n}function vc(e){let t=v.useRef(e);return mc(()=>{t.current=e}),t}function yc(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]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);hc(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),b=v.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),x=v.useCallback(e=>{e!==T.current&&(T.current=e,_(e))},[]),S=a||m,C=o||g,w=v.useRef(null),T=v.useRef(null),E=v.useRef(u),D=c!=null,O=vc(c),k=vc(i),A=vc(l),j=v.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),pc(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!hc(E.current,t)&&(E.current=t,y.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);mc(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=v.useRef(!1);mc(()=>(M.current=!0,()=>{M.current=!1}),[]),mc(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=v.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=v.useMemo(()=>({reference:S,floating:C}),[S,C]),F=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=_c(P.floating,u.x),r=_c(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...gc(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var bc=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?{}:dc({element:r.current,padding:i}).fn(n):r?dc({element:r,padding:i}).fn(n):{}}}},xc=(e,t)=>{let n=oc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sc=(e,t)=>{let n=sc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cc=(e,t)=>({fn:fc(e).fn,options:[e,t]}),wc=(e,t)=>{let n=cc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tc=(e,t)=>{let n=lc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ec=(e,t)=>{let n=uc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dc=(e,t)=>{let n=bc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Oc=`Arrow`,kc=v.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,B.jsx)(pr.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,B.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});kc.displayName=Oc;var Ac=kc,jc=`Popper`,[Mc,Nc]=yr(jc),[Pc,Fc]=Mc(jc),Ic=e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[a,o]=v.useState(void 0);return(0,B.jsx)(Pc,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Ic.displayName=jc;var Lc=`PopperAnchor`,Rc=v.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Fc(Lc,n),o=v.useRef(null),s=a.onAnchorChange,c=Zn(t,v.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=v.useRef(null);v.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Jc(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,B.jsx)(pr.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});Rc.displayName=Lc;var zc=`PopperContent`,[Bc,Vc]=Mc(zc),Hc=v.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=Fc(zc,n),[_,y]=v.useState(null),b=Zn(t,y),[x,S]=v.useState(null),C=ho(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(Kc),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=yc({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>ac(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[xc({mainAxis:i+T,alignmentAxis:o}),c&&Sc({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Cc():void 0,...A}),c&&wc({...A}),Tc({...A,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`)}}),x&&Dc({element:x,padding:s}),qc({arrowWidth:w,arrowHeight:T}),f&&Ec({strategy:`referenceHidden`,...A,boundary:k?A.boundary:void 0})]}),I=g.setPlacementState;Sr(()=>(I(N),()=>{I(void 0)}),[N,I]);let[L,ee]=Jc(N),te=zr(m);Sr(()=>{P&&te?.()},[P,te]);let ne=F.arrow?.x,re=F.arrow?.y,ie=F.arrow?.centerOffset!==0,[R,ae]=v.useState();return Sr(()=>{_&&ae(window.getComputedStyle(_).zIndex)},[_]),(0,B.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:R,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,B.jsx)(Bc,{scope:n,placedSide:L,placedAlign:ee,onArrowChange:S,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,B.jsx)(pr.div,{"data-side":L,"data-align":ee,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});Hc.displayName=zc;var Uc=`PopperArrow`,Wc={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Gc=v.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Vc(Uc,n),a=Wc[i.placedSide];return(0,B.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,B.jsx)(Ac,{...r,ref:t,style:{...r.style,display:`block`}})})});Gc.displayName=Uc;function Kc(e){return e!==null}var qc=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]=Jc(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 Jc(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Yc=Ic,Xc=Rc,Zc=Hc,Qc=Gc,$c=`Label`,el=v.forwardRef((e,t)=>(0,B.jsx)(pr.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));el.displayName=$c;var tl=el;function nl(e,[t,n]){return Math.min(n,Math.max(t,e))}var rl=[` `,`Enter`,`ArrowUp`,`ArrowDown`],il=[` `,`Enter`],al=`Select`,[ol,sl,cl]=xr(al),[ll,ul]=yr(al,[cl,Nc]),dl=Nc(),[fl,pl]=ll(al),[ml,hl]=ll(al),gl=`SelectProvider`;function _l(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=dl(t),[_,y]=v.useState(null),[b,x]=v.useState(null),[S,C]=v.useState(!1),w=Rr(l),[T,E]=wr({prop:r,defaultProp:i??!1,onChange:a,caller:al}),[D,O]=wr({prop:o,defaultProp:s,onChange:c,caller:al}),k=v.useRef(null),A=v.useRef(D);v.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>O(A.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,O]);let j=!_||!!m||!!_.closest(`form`),[M,N]=v.useState(new Set),P=Ir(),F=Array.from(M).map(e=>e.props.value).join(`;`),I=v.useCallback(e=>{N(t=>new Set(t).add(e))},[]),L=v.useCallback(e=>{N(t=>{let n=new Set(t);return n.delete(e),n})},[]),ee={required:p,trigger:_,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:P,value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:M,nativeSelectKey:F,isFormControl:j};return(0,B.jsx)(Yc,{...g,children:(0,B.jsx)(fl,{scope:t,...ee,children:(0,B.jsx)(ol.Provider,{scope:t,children:(0,B.jsx)(ml,{scope:t,onNativeOptionAdd:I,onNativeOptionRemove:L,children:mu(h)?h(ee):n})})})})}_l.displayName=gl;var vl=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,B.jsx)(_l,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,B.jsxs)(B.Fragment,{children:[n,e?(0,B.jsx)(pu,{__scopeSelect:t}):null]})})};vl.displayName=al;var yl=`SelectTrigger`,bl=v.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=dl(n),o=pl(yl,n),s=o.disabled||r,c=Zn(t,o.onTriggerChange),l=sl(n),u=v.useRef(`touch`),[d,f,p]=gu(e=>{let t=l().filter(e=>!e.disabled),n=_u(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,B.jsx)(Xc,{asChild:!0,...a,children:(0,B.jsx)(pr.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":hu(o.value)?``:void 0,...i,ref:c,onClick:V(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:V(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:V(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&rl.includes(e.key)&&(m(),e.preventDefault())})})})});bl.displayName=yl;var xl=`SelectValue`,Sl=v.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=pl(xl,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Zn(t,c.onValueNodeChange);Sr(()=>{l(u)},[l,u]);let f=hu(c.value);return(0,B.jsx)(pr.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,B.jsx)(v.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});Sl.displayName=xl;var Cl=`SelectIcon`,wl=v.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,B.jsx)(pr.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});wl.displayName=Cl;var Tl=`SelectPortal`,[El,Dl]=ll(Tl,{forceMount:void 0}),Ol=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,B.jsx)(El,{scope:e.__scopeSelect,forceMount:n,children:(0,B.jsx)(vi,{asChild:!0,...r})})};Ol.displayName=Tl;var kl=`SelectContent`,Al=v.forwardRef((e,t)=>{let n=Dl(kl,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=pl(kl,e.__scopeSelect),[o,s]=v.useState();return Sr(()=>{s(new DocumentFragment)},[]),(0,B.jsx)(Or,{present:r||a.open,children:({present:e})=>e?(0,B.jsx)(Ll,{...i,ref:t}):(0,B.jsx)(jl,{...i,fragment:o})})});Al.displayName=kl;var jl=v.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?y.createPortal((0,B.jsx)(Nl,{scope:n,children:(0,B.jsx)(ol.Slot,{scope:n,children:(0,B.jsx)(`div`,{ref:t,children:r})})}),i):null});jl.displayName=`SelectContentFragment`;var Ml=10,[Nl,Pl]=ll(kl),Fl=`SelectContentImpl`,Il=Qn(`SelectContent.RemoveScroll`),Ll=v.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,y=pl(kl,n),[b,x]=v.useState(null),[S,C]=v.useState(null),w=Zn(t,x),[T,E]=v.useState(null),[D,O]=v.useState(null),k=sl(n),[A,j]=v.useState(!1),M=v.useRef(!1);v.useEffect(()=>{if(b)return za(b)},[b]),xi();let N=v.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=v.useCallback(()=>N([T,b]),[N,T,b]);v.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=y;v.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(b)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,F,I]),v.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[L,ee]=gu(e=>{let t=k().filter(e=>!e.disabled),n=_u(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),te=v.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(M.current=!0))},[y.value]),ne=v.useCallback(()=>b?.focus(),[b]),re=v.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),ie=r===`popper`?W:zl,R=ie===W?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,B.jsx)(Nl,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:te,selectedItem:T,onItemLeave:ne,itemTextRefCallback:re,focusSelectedItem:P,selectedItemText:D,position:r,isPositioned:A,searchRef:L,children:(0,B.jsx)(Aa,{as:Il,allowPinchZoom:!0,children:(0,B.jsx)(ai,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:V(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,B.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,B.jsx)(ie,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),..._,...R,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:V(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ee(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});Ll.displayName=Fl;var Rl=`SelectItemAlignedPosition`,zl=v.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=pl(kl,n),o=Pl(kl,n),[s,c]=v.useState(null),[l,u]=v.useState(null),d=Zn(t,u),f=sl(n),p=v.useRef(!1),m=v.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:y}=o,b=v.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Ml,d=nl(a,[Ml,Math.max(Ml,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Ml,d=nl(a,[Ml,Math.max(Ml,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Ml*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Ml,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Ml}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);Sr(()=>b(),[b]);let[x,S]=v.useState();return Sr(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,B.jsx)(Vl,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:v.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,B.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,B.jsx)(pr.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});zl.displayName=Rl;var Bl=`SelectPopperPosition`,W=v.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Ml,...a}=e,o=dl(n);return(0,B.jsx)(Zc,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});W.displayName=Bl;var[Vl,G]=ll(kl,{}),K=`SelectViewport`,Hl=v.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Pl(K,n),o=G(K,n),s=Zn(t,a.onViewportChange),c=v.useRef(0);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,B.jsx)(ol.Slot,{scope:n,children:(0,B.jsx)(pr.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:V(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Ml*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Hl.displayName=K;var Ul=`SelectGroup`,[Wl,Gl]=ll(Ul),Kl=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Ir();return(0,B.jsx)(Wl,{scope:n,id:i,children:(0,B.jsx)(pr.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Kl.displayName=Ul;var ql=`SelectLabel`,Jl=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Gl(ql,n);return(0,B.jsx)(pr.div,{id:i.id,...r,ref:t})});Jl.displayName=ql;var Yl=`SelectItem`,[Xl,Zl]=ll(Yl),Ql=v.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=pl(Yl,n),c=Pl(Yl,n),l=s.value===r,[u,d]=v.useState(a??``),[f,p]=v.useState(!1),m=Zn(t,zr(e=>c.itemRefCallback?.(e,r,i))),h=Ir(),g=v.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,B.jsx)(Xl,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:v.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,B.jsx)(ol.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,B.jsx)(pr.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:V(o.onFocus,()=>p(!0)),onBlur:V(o.onBlur,()=>p(!1)),onClick:V(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:V(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:V(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:V(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:V(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:V(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(il.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});Ql.displayName=Yl;var $l=`SelectItemText`,eu=v.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=pl($l,n),s=Pl($l,n),c=Zl($l,n),l=hl($l,n),[u,d]=v.useState(null),f=zr(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=Zn(t,d,c.onItemTextChange,f),m=u?.textContent,h=v.useMemo(()=>(0,B.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return Sr(()=>(g(h),()=>_(h)),[g,_,h]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(pr.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!hu(o.value)?y.createPortal(a.children,o.valueNode):null]})});eu.displayName=$l;var tu=`SelectItemIndicator`,nu=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Zl(tu,n).isSelected?(0,B.jsx)(pr.span,{"aria-hidden":!0,...r,ref:t}):null});nu.displayName=tu;var ru=`SelectScrollUpButton`,iu=v.forwardRef((e,t)=>{let n=Pl(ru,e.__scopeSelect),r=G(ru,e.__scopeSelect),[i,a]=v.useState(!1),o=Zn(t,r.onScrollButtonChange);return Sr(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(su,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});iu.displayName=ru;var au=`SelectScrollDownButton`,ou=v.forwardRef((e,t)=>{let n=Pl(au,e.__scopeSelect),r=G(au,e.__scopeSelect),[i,a]=v.useState(!1),o=Zn(t,r.onScrollButtonChange);return Sr(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(su,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});ou.displayName=au;var su=v.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Pl(`SelectScrollButton`,n),o=v.useRef(null),s=sl(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Sr(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,B.jsx)(pr.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:V(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:V(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:V(i.onPointerLeave,()=>{c()})})}),cu=`SelectSeparator`,lu=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,B.jsx)(pr.div,{"aria-hidden":!0,...r,ref:t})});lu.displayName=cu;var uu=`SelectArrow`,du=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=dl(n);return Pl(uu,n).position===`popper`?(0,B.jsx)(Qc,{...i,...r,ref:t}):null});du.displayName=uu;var fu=`SelectBubbleInput`,pu=v.forwardRef(({__scopeSelect:e,...t},n)=>{let r=pl(fu,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=v.useRef(null),m=Zn(n,p),h=i??``,g=mo(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return v.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,B.jsxs)(pr.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...hr,...t.style},ref:m,defaultValue:h,children:[hu(i)&&!_?(0,B.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});pu.displayName=fu;function mu(e){return typeof e==`function`}function hu(e){return e===``||e===void 0}function gu(e){let t=zr(e),n=v.useRef(``),r=v.useRef(0),i=v.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=v.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function _u(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=vu(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function vu(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var[yu,bu]=yr(`Tooltip`,[Nc]),xu=Nc(),Su=`TooltipProvider`,Cu=700,wu=`tooltip.open`,[Tu,Eu]=yu(Su),Du=e=>{let{__scopeTooltip:t,delayDuration:n=Cu,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=v.useRef(!0),s=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,B.jsx)(Tu,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:v.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:v.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:v.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Du.displayName=Su;var Ou=`Tooltip`,[ku,Au]=yu(Ou),ju=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Eu(Ou,e.__scopeTooltip),l=xu(t),[u,d]=v.useState(null),f=Ir(),p=v.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=v.useRef(!1),[_,y]=wr({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(wu))):c.onClose(),a?.(e)},caller:Ou}),b=v.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),x=v.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,y(!0)},[y]),S=v.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=v.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,y(!0),p.current=0},h)},[h,y]);return v.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,B.jsx)(Yc,{...l,children:(0,B.jsx)(ku,{scope:t,contentId:f,open:_,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:v.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};ju.displayName=Ou;var Mu=`TooltipTrigger`,Nu=v.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Au(Mu,n),a=Eu(Mu,n),o=xu(n),s=Zn(t,v.useRef(null),i.onTriggerChange),c=v.useRef(!1),l=v.useRef(!1),u=v.useCallback(()=>c.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,B.jsx)(Xc,{asChild:!0,...o,children:(0,B.jsx)(pr.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:V(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:V(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:V(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:V(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:V(e.onBlur,i.onClose),onClick:V(e.onClick,i.onClose)})})});Nu.displayName=Mu;var Pu=`TooltipPortal`,[Fu,Iu]=yu(Pu,{forceMount:void 0}),Lu=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Au(Pu,t);return(0,B.jsx)(Fu,{scope:t,forceMount:n,children:(0,B.jsx)(Or,{present:n||a.open,children:(0,B.jsx)(vi,{asChild:!0,container:i,children:r})})})};Lu.displayName=Pu;var Ru=`TooltipContent`,zu=v.forwardRef((e,t)=>{let n=Iu(Ru,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Au(Ru,e.__scopeTooltip);return(0,B.jsx)(Or,{present:r||o.open,children:o.disableHoverableContent?(0,B.jsx)(Wu,{side:i,...a,ref:t}):(0,B.jsx)(Bu,{side:i,...a,ref:t})})}),Bu=v.forwardRef((e,t)=>{let n=Au(Ru,e.__scopeTooltip),r=Eu(Ru,e.__scopeTooltip),i=v.useRef(null),a=Zn(t,i),[o,s]=v.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=v.useCallback(()=>{s(null),d(!1)},[d]),p=v.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Ju(r,qu(r,n.getBoundingClientRect())),a=Yu(t.getBoundingClientRect()),o=Zu([...i,...a]);s(o),d(!0)},[d]);return v.useEffect(()=>()=>f(),[f]),v.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]),v.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=!Xu(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,B.jsx)(Wu,{...e,ref:a})}),[Vu,Hu]=yu(Ou,{isInside:!1}),Uu=tr(`TooltipContent`),Wu=v.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Au(Ru,n),l=xu(n),{onClose:u}=c;return v.useEffect(()=>(document.addEventListener(wu,u),()=>document.removeEventListener(wu,u)),[u]),v.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,B.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,B.jsxs)(Zc,{"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,B.jsx)(Uu,{children:r}),(0,B.jsx)(Vu,{scope:n,isInside:!0,children:(0,B.jsx)(vr,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});zu.displayName=Ru;var Gu=`TooltipArrow`,Ku=v.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=xu(n);return Hu(Gu,n).isInside?null:(0,B.jsx)(Qc,{...i,...r,ref:t})});Ku.displayName=Gu;function qu(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 Ju(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 Yu(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 Xu(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 Zu(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)),Qu(t)}function Qu(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 $u=Du;function ed(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=ed(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function td(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=ed(e))&&(r&&(r+=` `),r+=t);return r}var nd=`-`,rd=e=>{let t=sd(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{let n=e.split(nd);return n[0]===``&&n.length!==1&&n.shift(),id(n,t)||od(e)},getConflictingClassGroupIds:(e,t)=>{let i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},id=(e,t)=>{if(e.length===0)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),i=r?id(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;let a=e.join(nd);return t.validators.find(({validator:e})=>e(a))?.classGroupId},ad=/^\[(.+)\]$/,od=e=>{if(ad.test(e)){let t=ad.exec(e)[1],n=t?.substring(0,t.indexOf(`:`));if(n)return`arbitrary..`+n}},sd=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return dd(Object.entries(e.classGroups),n).forEach(([e,n])=>{cd(n,r,e,t)}),r},cd=(e,t,n,r)=>{e.forEach(e=>{if(typeof e==`string`){let r=e===``?t:ld(t,e);r.classGroupId=n;return}if(typeof e==`function`){if(ud(e)){cd(e(r),t,n,r);return}t.validators.push({validator:e,classGroupId:n});return}Object.entries(e).forEach(([e,i])=>{cd(i,ld(t,e),n,r)})})},ld=(e,t)=>{let n=e;return t.split(nd).forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},ud=e=>e.isThemeGetter,dd=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>typeof e==`string`?t+e:typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,fd=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=new Map,r=new Map,i=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);if(t!==void 0)return t;if((t=r.get(e))!==void 0)return i(e,t),t},set(e,t){n.has(e)?n.set(e,t):i(e,t)}}},pd=`!`,md=e=>{let{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],a=t.length,o=e=>{let n=[],o=0,s=0,c;for(let l=0;l<e.length;l++){let u=e[l];if(o===0){if(u===i&&(r||e.slice(l,l+a)===t)){n.push(e.slice(s,l)),s=l+a;continue}if(u===`/`){c=l;continue}}u===`[`?o++:u===`]`&&o--}let l=n.length===0?e:e.substring(s),u=l.startsWith(pd);return{modifiers:n,hasImportantModifier:u,baseClassName:u?l.substring(1):l,maybePostfixModifierPosition:c&&c>s?c-s:void 0}};return n?e=>n({className:e,parseClassName:o}):o},hd=e=>{if(e.length<=1)return e;let t=[],n=[];return e.forEach(e=>{e[0]===`[`?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},gd=e=>({cache:fd(e.cacheSize),parseClassName:md(e),...rd(e)}),_d=/\s+/,vd=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(_d),s=``;for(let e=o.length-1;e>=0;--e){let t=o[e],{modifiers:c,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:d}=n(t),f=!!d,p=r(f?u.substring(0,d):u);if(!p){if(!f){s=t+(s.length>0?` `+s:s);continue}if(p=r(u),!p){s=t+(s.length>0?` `+s:s);continue}f=!1}let m=hd(c).join(`:`),h=l?m+pd:m,g=h+p;if(a.includes(g))continue;a.push(g);let _=i(p,f);for(let e=0;e<_.length;++e){let t=_[e];a.push(h+t)}s=t+(s.length>0?` `+s:s)}return s};function yd(){let e=0,t,n,r=``;for(;e<arguments.length;)(t=arguments[e++])&&(n=bd(t))&&(r&&(r+=` `),r+=n);return r}var bd=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=bd(e[r]))&&(n&&(n+=` `),n+=t);return n};function xd(e,...t){let n,r,i,a=o;function o(o){return n=gd(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)}function s(e){let t=r(e);if(t)return t;let a=vd(e,n);return i(e,a),a}return function(){return a(yd.apply(null,arguments))}}var Sd=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},Cd=/^\[(?:([a-z-]+):)?(.+)\]$/i,wd=/^\d+\/\d+$/,q=new Set([`px`,`full`,`screen`]),Td=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ed=/\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$/,Dd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Od=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ad=e=>Md(e)||q.has(e)||wd.test(e),jd=e=>Wd(e,`length`,Gd),Md=e=>!!e&&!Number.isNaN(Number(e)),Nd=e=>Wd(e,`number`,Md),Pd=e=>!!e&&Number.isInteger(Number(e)),Fd=e=>e.endsWith(`%`)&&Md(e.slice(0,-1)),J=e=>Cd.test(e),Id=e=>Td.test(e),Ld=new Set([`length`,`size`,`percentage`]),Rd=e=>Wd(e,Ld,Kd),zd=e=>Wd(e,`position`,Kd),Bd=new Set([`image`,`url`]),Vd=e=>Wd(e,Bd,Jd),Hd=e=>Wd(e,``,qd),Ud=()=>!0,Wd=(e,t,n)=>{let r=Cd.exec(e);return r?r[1]?typeof t==`string`?r[1]===t:t.has(r[1]):n(r[2]):!1},Gd=e=>Ed.test(e)&&!Dd.test(e),Kd=()=>!1,qd=e=>Od.test(e),Jd=e=>kd.test(e),Yd=xd(()=>{let e=Sd(`colors`),t=Sd(`spacing`),n=Sd(`blur`),r=Sd(`brightness`),i=Sd(`borderColor`),a=Sd(`borderRadius`),o=Sd(`borderSpacing`),s=Sd(`borderWidth`),c=Sd(`contrast`),l=Sd(`grayscale`),u=Sd(`hueRotate`),d=Sd(`invert`),f=Sd(`gap`),p=Sd(`gradientColorStops`),m=Sd(`gradientColorStopPositions`),h=Sd(`inset`),g=Sd(`margin`),_=Sd(`opacity`),v=Sd(`padding`),y=Sd(`saturate`),b=Sd(`scale`),x=Sd(`sepia`),S=Sd(`skew`),C=Sd(`space`),w=Sd(`translate`),T=()=>[`auto`,`contain`,`none`],E=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],D=()=>[`auto`,J,t],O=()=>[J,t],k=()=>[``,Ad,jd],A=()=>[`auto`,Md,J],j=()=>[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`],M=()=>[`solid`,`dashed`,`dotted`,`double`,`none`],N=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],P=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`],F=()=>[``,`0`,J],I=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],L=()=>[Md,J];return{cacheSize:500,separator:`:`,theme:{colors:[Ud],spacing:[Ad,jd],blur:[`none`,``,Id,J],brightness:L(),borderColor:[e],borderRadius:[`none`,``,`full`,Id,J],borderSpacing:O(),borderWidth:k(),contrast:L(),grayscale:F(),hueRotate:L(),invert:F(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[Fd,jd],inset:D(),margin:D(),opacity:L(),padding:O(),saturate:L(),scale:L(),sepia:F(),skew:L(),space:O(),translate:O()},classGroups:{aspect:[{aspect:[`auto`,`square`,`video`,J]}],container:[`container`],columns:[{columns:[Id]}],"break-after":[{"break-after":I()}],"break-before":[{"break-before":I()}],"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`],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:[...j(),J]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[`auto`,Pd,J]}],basis:[{basis:D()}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`wrap`,`wrap-reverse`,`nowrap`]}],flex:[{flex:[`1`,`auto`,`initial`,`none`,J]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:[`first`,`last`,`none`,Pd,J]}],"grid-cols":[{"grid-cols":[Ud]}],"col-start-end":[{col:[`auto`,{span:[`full`,Pd,J]},J]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[Ud]}],"row-start-end":[{row:[`auto`,{span:[Pd,J]},J]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":[`auto`,`min`,`max`,`fr`,J]}],"auto-rows":[{"auto-rows":[`auto`,`min`,`max`,`fr`,J]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:[`normal`,...P()]}],"justify-items":[{"justify-items":[`start`,`end`,`center`,`stretch`]}],"justify-self":[{"justify-self":[`auto`,`start`,`end`,`center`,`stretch`]}],"align-content":[{content:[`normal`,...P(),`baseline`]}],"align-items":[{items:[`start`,`end`,`center`,`baseline`,`stretch`]}],"align-self":[{self:[`auto`,`start`,`end`,`center`,`stretch`,`baseline`]}],"place-content":[{"place-content":[...P(),`baseline`]}],"place-items":[{"place-items":[`start`,`end`,`center`,`baseline`,`stretch`]}],"place-self":[{"place-self":[`auto`,`start`,`end`,`center`,`stretch`]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[C]}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":[C]}],"space-y-reverse":[`space-y-reverse`],w:[{w:[`auto`,`min`,`max`,`fit`,`svw`,`lvw`,`dvw`,J,t]}],"min-w":[{"min-w":[J,t,`min`,`max`,`fit`]}],"max-w":[{"max-w":[J,t,`none`,`full`,`min`,`max`,`fit`,`prose`,{screen:[Id]},Id]}],h:[{h:[J,t,`auto`,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"min-h":[{"min-h":[J,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"max-h":[{"max-h":[J,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],size:[{size:[J,t,`auto`,`min`,`max`,`fit`]}],"font-size":[{text:[`base`,Id,jd]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`,Nd]}],"font-family":[{font:[Ud]}],"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:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`,J]}],"line-clamp":[{"line-clamp":[`none`,Md,Nd]}],leading:[{leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`,Ad,J]}],"list-image":[{"list-image":[`none`,J]}],"list-style-type":[{list:[`none`,`disc`,`decimal`,J]}],"list-style-position":[{list:[`inside`,`outside`]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...M(),`wavy`]}],"text-decoration-thickness":[{decoration:[`auto`,`from-font`,Ad,jd]}],"underline-offset":[{"underline-offset":[`auto`,Ad,J]}],"text-decoration-color":[{decoration:[e]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:O()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,J]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,J]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:[...j(),zd]}],"bg-repeat":[{bg:[`no-repeat`,{repeat:[``,`x`,`y`,`round`,`space`]}]}],"bg-size":[{bg:[`auto`,`cover`,`contain`,Rd]}],"bg-image":[{bg:[`none`,{"gradient-to":[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Vd]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...M(),`hidden`]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":[`divide-y-reverse`],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:M()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[``,...M()]}],"outline-offset":[{"outline-offset":[Ad,J]}],"outline-w":[{outline:[Ad,jd]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:k()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Ad,jd]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:[``,`inner`,`none`,Id,Hd]}],"shadow-color":[{shadow:[Ud]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...N(),`plus-lighter`,`plus-darker`]}],"bg-blend":[{"bg-blend":N()}],filter:[{filter:[``,`none`]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":[``,`none`,Id,J]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":[``,`none`]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[`none`,`all`,``,`colors`,`opacity`,`shadow`,`transform`,J]}],duration:[{duration:L()}],ease:[{ease:[`linear`,`in`,`out`,`in-out`,J]}],delay:[{delay:L()}],animate:[{animate:[`none`,`spin`,`ping`,`pulse`,`bounce`,J]}],transform:[{transform:[``,`gpu`,`none`]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[Pd,J]}],"translate-x":[{"translate-x":[w]}],"translate-y":[{"translate-y":[w]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:[`center`,`top`,`top-right`,`right`,`bottom-right`,`bottom`,`bottom-left`,`left`,`top-left`,J]}],accent:[{accent:[`auto`,e]}],appearance:[{appearance:[`none`,`auto`]}],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`,J]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":[`none`,`auto`]}],resize:[{resize:[`none`,`y`,`x`,``]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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`,J]}],fill:[{fill:[e,`none`]}],"stroke-w":[{stroke:[Ad,jd,Nd]}],stroke:[{stroke:[e,`none`]}],sr:[`sr-only`,`not-sr-only`],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`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`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`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-s`,`border-w-e`,`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-s`,`border-color-e`,`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`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`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-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`]}}});function Y(...e){return Yd(td(e))}function Xd({delayDuration:e=0,...t}){return(0,B.jsx)($u,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}var Zd=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Qd=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),$d={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`},ef=(0,v.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,v.createElement)(`svg`,{ref:c,...$d,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Qd(`lucide`,i),...s},[...o.map(([e,t])=>(0,v.createElement)(e,t)),...Array.isArray(a)?a:[a]])),X=(e,t)=>{let n=(0,v.forwardRef)(({className:n,...r},i)=>(0,v.createElement)(ef,{ref:i,iconNode:t,className:Qd(`lucide-${Zd(e)}`,n),...r}));return n.displayName=`${e}`,n},tf=X(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),nf=X(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),rf=X(`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`}]]),af=X(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),of=X(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),sf=X(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),cf=X(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),lf=X(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),uf=X(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),df=X(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ff=X(`CircleHelp`,[[`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`}]]),pf=X(`CircleSlash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),mf=X(`CircleX`,[[`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`}]]),hf=X(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),gf=X(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),_f=X(`EllipsisVertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),vf=X(`Flag`,[[`path`,{d:`M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z`,key:`i9b6wo`}],[`line`,{x1:`4`,x2:`4`,y1:`22`,y2:`15`,key:`1cm3nv`}]]),yf=X(`GitBranch`,[[`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`}]]),bf=X(`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`}]]),xf=X(`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`}]]),Sf=X(`Keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),Cf=X(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),wf=X(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Tf=X(`Loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),Ef=X(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),Df=X(`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`}]]),Of=X(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),kf=X(`RefreshCw`,[[`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`}]]),Af=X(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),jf=X(`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`}]]),Mf=X(`ShieldCheck`,[[`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`}]]),Nf=X(`TriangleAlert`,[[`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`}]]),Pf=X(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Ff(){let e=new Map;return{run(t,n){let r=e.get(t);if(r!==void 0)return r;let i=n().finally(()=>{e.get(t)===i&&e.delete(t)});return e.set(t,i),i},get pending(){return e.size}}}var If=Ff(),Lf=`crtr:relay-token`;function Rf(){try{let e=window.localStorage.getItem(Lf);return e!==null&&e!==``?e:void 0}catch{return}}function zf(){let e;try{let t=new URLSearchParams(window.location.search).get(`token`);e=t!==null&&t!==``?t:void 0}catch{e=void 0}if(e!==void 0){try{window.localStorage.setItem(Lf,e)}catch{}return e}return Rf()}var Bf=zf();async function Vf(e,t){try{let n={"content-type":`application/json`};Bf!==void 0&&(n.authorization=`Bearer ${Bf}`);let r=await fetch(`/__crtr/source`,{method:`POST`,headers:n,body:JSON.stringify(e),...t===void 0?{}:{signal:t}});return r.ok?await r.json():{ok:!1,stdout:``,stderr:`bridge ${r.status} ${r.statusText}`}}catch(e){return t?.aborted===!0||e instanceof DOMException&&e.name===`AbortError`?{ok:!1,stdout:``,stderr:`aborted`}:{ok:!1,stdout:``,stderr:e instanceof Error?e.message:String(e)}}}async function Hf(e,t,n){return Vf({kind:`exec`,bin:`crtr`,args:e,...t===void 0?{}:{stdin:t}},n)}var Uf=class extends Error{code;constructor(e,t){super(t),this.name=`CommandError`,this.code=e}};function Wf(e){let t=e.stdout.trim();if(t===``)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&typeof e.error==`string`&&typeof e.message==`string`)return{code:e.error,message:e.message}}catch{}return null}async function Gf(e,t,n){let r=await Hf(e,t,n);if(!r.ok)throw new Uf(`bridge`,r.stderr||`bridge request failed`);let i=Wf(r);if(i!==null)throw new Uf(i.code,i.message);if(r.exitCode!==void 0&&r.exitCode!==0){let t=r.stderr.trim()===``?r.stdout.trim():r.stderr;throw new Uf(`bridge`,t===``?`crtr ${e.join(` `)} failed (${r.exitCode})`:t)}if(r.stdout.trim()!==``)try{return JSON.parse(r.stdout)}catch(e){throw new Uf(`bridge`,e instanceof Error?e.message:String(e))}}function Kf(){return If.run(`canvas:snapshot`,()=>Gf([`canvas`,`snapshot`,`--json`]))}function qf(e){return If.run(`node:inspect:${e}`,()=>Gf([`node`,`inspect`,`show`,e,`--json`]).then(e=>e.node))}function Jf(e){return If.run(`node:snapshot:${e}`,()=>Gf([`node`,`inspect`,`snapshot`,e,`--json`]))}function Yf(e){let t=[`node`,`new`,`--kind`,e.kind];return e.mode&&t.push(`--mode`,e.mode),e.root&&t.push(`--root`),e.cwd?.trim()&&t.push(`--cwd`,e.cwd.trim()),e.name?.trim()&&t.push(`--name`,e.name.trim()),e.model?.trim()&&t.push(`--model`,e.model.trim()),e.parent?.trim()&&t.push(`--parent`,e.parent.trim()),t.push(`--json`),Gf(t,e.prompt)}function Xf(e,t){let n=[`node`,`msg`,`--to`,e];return t.tier?.trim()&&n.push(`--tier`,t.tier.trim()),n.push(`--json`),Gf(n,t.body)}function Zf(e,t={}){let n=[`node`,`lifecycle`,`revive`,e];return t.fresh&&n.push(`--fresh`),n.push(`--json`),Gf(n)}function Qf(e){return Gf([`node`,`lifecycle`,`close`,`--node`,e,`--json`])}async function $f(e,t){let n=await Vf({kind:`file`,path:t});if(!n.ok)throw new Uf(`bridge`,n.stderr||`failed to read ${t}`);return{path:t,content:n.stdout,truncated:!1}}var ep=new Set,tp=!1;function np(){if(tp)return;tp=!0;let e;try{let t=new URL(`/__crtr/events`,window.location.href);Bf!==void 0&&t.searchParams.set(`token`,Bf),e=new EventSource(t.toString())}catch{tp=!1;return}e.onmessage=e=>{let t;try{t=JSON.parse(e.data).kind}catch{return}if(t!==void 0)for(let e of ep)e.kinds.includes(t)&&e.refresh()}}function rp(e,t){let n=(0,v.useRef)(t);n.current=t,(0,v.useEffect)(()=>{np();let t={kinds:e,refresh:()=>n.current()};return ep.add(t),()=>{ep.delete(t)}},[e.join(`,`)])}var ip=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=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},ap=(e=>e?ip(e):ip),op=e=>e;function sp(e,t=op){let n=v.useSyncExternalStore(e.subscribe,v.useCallback(()=>t(e.getState()),[e,t]),v.useCallback(()=>t(e.getInitialState()),[e,t]));return v.useDebugValue(n),n}var cp=e=>{let t=ap(e),n=e=>sp(t,e);return Object.assign(n,t),n},lp=(e=>e?cp(e):cp),up=lp(e=>({reachable:!0,setReachable:t=>e({reachable:t})})),dp=1,fp=`crtr.web.roster.v1`;function pp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mp(e){return typeof e==`string`}function hp(e){return typeof e==`number`}function gp(e){return pp(e)?mp(e.node_id)&&mp(e.name)&&mp(e.kind)&&(e.mode===`base`||e.mode===`orchestrator`)&&(e.lifecycle===`terminal`||e.lifecycle===`resident`)&&(e.status===`active`||e.status===`idle`||e.status===`done`||e.status===`dead`||e.status===`canceled`)&&mp(e.cwd)&&(e.parent===null||mp(e.parent))&&mp(e.created)&&(e.host_kind===`broker`||e.host_kind===`tmux`)&&typeof e.enterable==`boolean`&&hp(e.attention_count)&&(e.cycles===void 0||hp(e.cycles))&&(e.last_activity===void 0||mp(e.last_activity)):!1}function _p(e){return pp(e)?e.schemaVersion===dp&&mp(e.generatedAt)&&hp(e.cachedAt)&&Array.isArray(e.nodes)&&e.nodes.every(gp):!1}function vp(){try{let e=globalThis.localStorage?.getItem(fp);if(e==null)return null;let t=JSON.parse(e);return _p(t)?t:null}catch{return null}}function yp(e,t){let n={schemaVersion:dp,nodes:e,generatedAt:t,cachedAt:Date.now()};try{globalThis.localStorage?.setItem(fp,JSON.stringify(n))}catch{}}var bp=3e4,xp=new class{state;listeners=new Set;started=!1;timer=null;constructor(){let e=vp();this.state=e?{nodes:e.nodes,generatedAt:e.generatedAt,loading:!1}:{nodes:[],generatedAt:null,loading:!0}}subscribe=e=>(this.ensureStarted(),this.listeners.add(e),()=>{this.listeners.delete(e)});getState=()=>this.state;refetch=()=>{this.load()};ensureStarted(){if(this.started)return;this.started=!0,this.load(),this.timer=setInterval(()=>void this.load(),bp);let e=()=>{document.visibilityState===`visible`&&this.load()};document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,e)}setState(e){this.state=e;for(let e of this.listeners)e()}async load(){try{let e=await Kf();this.setState({nodes:e.nodes,generatedAt:e.generated_at,loading:!1}),yp(e.nodes,e.generated_at),up.getState().setReachable(!0)}catch{this.state.loading&&this.setState({...this.state,loading:!1}),up.getState().setReachable(!1)}}};function Sp(){let e=(0,v.useSyncExternalStore)(xp.subscribe,xp.getState);return rp([`nodes`,`inbox`],xp.refetch),e}var Cp=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,wp=td,Tp=(e,t)=>n=>{if(t?.variants==null)return wp(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Cp(t)||Cp(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return wp(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Ep=Tp(`btn justify-center transition-all outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`primary`,destructive:`danger`,outline:``,secondary:``,ghost:`border-transparent`,link:`border-transparent bg-transparent text-primary underline-offset-4 hover:underline hover:bg-transparent`},size:{default:``,xs:`sm gap-1 text-xs [&_svg:not([class*='size-'])]:size-3`,sm:`sm`,lg:`px-6 py-2.5`,icon:`p-0 size-9`,"icon-xs":`p-0 size-6 [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`p-0 size-8`,"icon-lg":`p-0 size-10`}},defaultVariants:{variant:`default`,size:`default`}});function Z({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,B.jsx)(r?$n:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:Y(Ep({variant:t,size:n,className:e})),...i})}function Dp({...e}){return(0,B.jsx)(Ga,{"data-slot":`dialog`,...e})}function Op({...e}){return(0,B.jsx)(Za,{"data-slot":`dialog-portal`,...e})}function kp({className:e,...t}){return(0,B.jsx)($a,{"data-slot":`dialog-overlay`,className:Y(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Ap({className:e,children:t,showCloseButton:n=!0,...r}){return(0,B.jsxs)(Op,{"data-slot":`dialog-portal`,children:[(0,B.jsx)(kp,{}),(0,B.jsxs)(ro,{"data-slot":`dialog-content`,className:Y(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,B.jsxs)(fo,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,B.jsx)(Pf,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function jp({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-header`,className:Y(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Mp({className:e,showCloseButton:t=!1,children:n,...r}){return(0,B.jsxs)(`div`,{"data-slot":`dialog-footer`,className:Y(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,B.jsx)(fo,{asChild:!0,children:(0,B.jsx)(Z,{variant:`outline`,children:`Close`})})]})}function Np({className:e,...t}){return(0,B.jsx)(co,{"data-slot":`dialog-title`,className:Y(`text-lg leading-none font-semibold`,e),...t})}function Pp({className:e,...t}){return(0,B.jsx)(U,{"data-slot":`dialog-description`,className:Y(`text-sm text-muted-foreground`,e),...t})}function Fp({className:e,type:t,...n}){return(0,B.jsx)(`input`,{type:t,"data-slot":`input`,className:Y(`h-9 w-full min-w-0 rounded-md border border-[var(--line)] bg-[oklch(0_0_0/0.25)] px-3 py-1 text-sm text-[var(--ink)] transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-[var(--dim)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,`focus-visible:border-[var(--line2)] focus-visible:ring-[3px] focus-visible:ring-ring/40`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20`,e),...n})}function Ip({className:e,...t}){return(0,B.jsx)(tl,{"data-slot":`label`,className:Y(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Lp({...e}){return(0,B.jsx)(vl,{"data-slot":`select`,...e})}function Rp({...e}){return(0,B.jsx)(Sl,{"data-slot":`select-value`,...e})}function zp({className:e,size:t=`default`,children:n,...r}){return(0,B.jsxs)(bl,{"data-slot":`select-trigger`,"data-size":t,className:Y(`flex w-fit items-center justify-between gap-2 rounded-md border border-[var(--line)] bg-[oklch(0.92_0.008_80/0.02)] px-3 py-2 font-mono text-sm text-[var(--ink2)] whitespace-nowrap transition-[color,box-shadow] outline-none cursor-pointer focus-visible:border-[var(--line2)] focus-visible:ring-[3px] focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-[var(--mut)] data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-[var(--mut)]`,e),...r,children:[n,(0,B.jsx)(wl,{asChild:!0,children:(0,B.jsx)(of,{className:`size-4 opacity-50`})})]})}function Bp({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,B.jsx)(Ol,{children:(0,B.jsxs)(Al,{"data-slot":`select-content`,className:Y(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,B.jsx)(Hp,{}),(0,B.jsx)(Hl,{className:Y(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,B.jsx)(Up,{})]})})}function Vp({className:e,children:t,...n}){return(0,B.jsxs)(Ql,{"data-slot":`select-item`,className:Y(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,B.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,B.jsx)(nu,{children:(0,B.jsx)(af,{className:`size-4`})})}),(0,B.jsx)(eu,{children:t})]})}function Hp({className:e,...t}){return(0,B.jsx)(iu,{"data-slot":`select-scroll-up-button`,className:Y(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(lf,{className:`size-4`})})}function Up({className:e,...t}){return(0,B.jsx)(ou,{"data-slot":`select-scroll-down-button`,className:Y(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(of,{className:`size-4`})})}function Wp({className:e,...t}){return(0,B.jsx)(`textarea`,{"data-slot":`textarea`,className:Y(`flex field-sizing-content min-h-16 w-full rounded-md border border-[var(--line)] bg-[oklch(0_0_0/0.3)] px-3 py-2 text-sm text-[var(--ink)] transition-[color,box-shadow] outline-none placeholder:text-[var(--dim)] focus-visible:border-[var(--line2)] focus-visible:ring-[3px] focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20`,e),...t})}var Gp=Tp(`badge w-fit max-w-full overflow-hidden text-[var(--ink2)] whitespace-nowrap [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:``,secondary:`dead`,destructive:`blocked`,outline:``,ghost:`border-transparent`,link:`border-transparent underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function Kp({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,B.jsx)(n?$n:`span`,{"data-slot":`badge`,"data-variant":t,className:Y(Gp({variant:t}),e),...r})}function qp(e){return e instanceof Uf&&(e.code===`not_found`||e.code===`already_resolved`||e.code===`claimed`)}function Jp(e){let t=e.indexOf(`/.crouter/interactions/`);return t>=0?e.slice(0,t):e}function Yp(e){if(e.trim()===``)return{title:``};let t=e.match(/^\s*#{1,6}\s+(.+?)\s*(?:\n|$)/);return t?{title:t[1],body:e.slice(t[0].length).trim()||void 0}:{title:e.trim(),body:e.trim()}}function Xp(e){switch(e){case`notify`:case`validation`:case`decision`:case`context`:case`error`:return e}throw Error(`Unknown deck kind: ${e}`)}function Zp(e){let{title:t,body:n}=Yp(e.prompt);return{id:e.id,title:t||e.id,body:n,kind:Xp(e.kind),options:e.options.map(e=>({id:e.id,label:e.label,...e.description===void 0?{}:{description:e.description}})),multiSelect:e.multiSelect,allowFreetext:e.allow_freetext}}function Qp(e){return{id:e.id,job_id:e.job_id,kind:Xp(e.kind),title:e.title,blocked_since:e.blocked_since,conversation_id:e.conversation_id,conversation_title:e.conversation_title,asking_node_id:e.asking_node_id,asking_node_name:e.asking_node_name,cwd:Jp(e.dir),interaction_count:e.interaction_count}}function $p(e,t){return{id:e.id,job_id:e.job_id??e.id,kind:Xp(e.kind),title:e.title,blocked_since:e.blocked_since,conversation_id:e.conversation_id,conversation_title:e.conversation_title,asking_node_id:e.asking_node_id,asking_node_name:e.asking_node_name,cwd:t,interaction_count:e.interaction_count,interactions:e.interactions.map(Zp)}}function em(){return If.run(`human:list`,async()=>(await Gf([`human`,`list`,`--json`])).items.map(Qp))}async function tm(e){let t=await Gf([`human`,`deck`,e,`--json`]),n=(await qf(t.asking_node_id)).cwd;return $p(t,n)}async function nm(e,t){let n=JSON.stringify({responses:t.responses}),r=await Gf([`human`,`resolve`,e,`--json`],n);if(r.resolved!==!0)throw new Uf(r.reason===`claimed`?`claimed`:`already_resolved`,r.reason===`claimed`?`That request is already being handled.`:`That request was already handled.`);return{resolved:!0,job_id:r.job_id??e,delivered:r.delivered??!0}}function rm(e){let t=0;for(let n of e)t+=Math.max(0,n.attention_count);return t}function im(){let{nodes:e}=Sp();return rm(e)}function am(){let[e,t]=(0,v.useState)([]),[n,r]=(0,v.useState)(!0),[i,a]=(0,v.useState)(0),o=(0,v.useCallback)(()=>a(e=>e+1),[]);return rp([`inbox`,`nodes`],o),(0,v.useEffect)(()=>{let e=!1;return em().then(n=>{e||(t(n),r(!1))}).catch(()=>{e||r(!1)}),()=>{e=!0}},[i]),{decks:e,loading:n,refetch:o}}function om(e){let{decks:t}=am();return t.filter(t=>t.conversation_id===e)}var sm={notify:{icon:rf,label:`Update`},validation:{icon:Mf,label:`Approval`},decision:{icon:yf,label:`Decision`},context:{icon:ff,label:`Question`},error:{icon:Nf,label:`Problem`}};function cm(e){switch(e){case`notify`:return sm.notify;case`validation`:return sm.validation;case`decision`:return sm.decision;case`context`:return sm.context;case`error`:return sm.error;default:return sm.context}}function lm(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return``;let r=Math.max(0,Math.round((t-n)/1e3));if(r<60)return`${r}s`;let i=Math.round(r/60);if(i<60)return`${i}m`;let a=Math.round(i/60);return a<24?`${a}h`:`${Math.round(a/24)}d`}var um=1,dm=lp(e=>({toasts:[],push:(t,n=`info`)=>{let r=um++;e(e=>({toasts:[...e.toasts,{id:r,message:t,tone:n}]})),setTimeout(()=>e(e=>({toasts:e.toasts.filter(e=>e.id!==r)})),4e3)},dismiss:t=>e(e=>({toasts:e.toasts.filter(e=>e.id!==t)}))}));function fm(e,t=`info`){dm.getState().push(e,t)}var pm=e=>({"--i":e});async function mm(e,t){let n=(await tm(e)).interactions[0];await nm(e,{responses:[t===`ack`?{id:n.id}:{id:n.id,selectedOptionIds:[(t===`yes`?n.options.find(e=>e.id===`yes`)?.id??n.options[0]?.id:n.options.find(e=>e.id===`no`)?.id??n.options[1]?.id)??t]}]})}function hm(){let{decks:e,loading:t}=am(),n=(0,v.useMemo)(()=>[...e].sort((e,t)=>new Date(t.blocked_since).getTime()-new Date(e.blocked_since).getTime()),[e]);return t||n.length===0?null:(0,B.jsxs)(`section`,{className:`needs rv`,style:pm(3),children:[(0,B.jsxs)(`div`,{className:`needs-head`,children:[(0,B.jsx)(vf,{size:14,className:`flag`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{className:`instlabel`,children:[`Needs you — `,n.length,` blocked`]}),(0,B.jsx)(`div`,{className:`rule`})]}),(0,B.jsx)(`div`,{className:`needs-grid`,children:n.map(e=>(0,B.jsx)(gm,{deck:e},e.id))})]})}function gm({deck:e}){let t=ut(),{refetch:n}=am(),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1),l=cm(e.kind).label,u=lm(e.blocked_since);e.kind===`decision`&&a===null&&!s&&(async()=>{if(!(e.kind!==`decision`||s||a!==null)){c(!0);try{let t=(await tm(e.job_id)).interactions[0]?.options??[];o(t.length<=3?t:[])}catch(e){qp(e)?(o([]),n()):(console.error(`[needs-you] failed to load decision options:`,e),o([]))}finally{c(!1)}}})();let d=async t=>{if(!r){i(!0);try{await mm(e.job_id,t),fm(`Done — thanks!`,`success`),n()}catch(e){if(qp(e)){fm(e instanceof Error?e.message:`That request was already handled.`),n();return}console.error(`[needs-you] resolve failed:`,e),fm(`Something went wrong — try again.`)}finally{i(!1)}}},f=async t=>{if(!r){i(!0);try{let r=(await tm(e.job_id)).interactions[0];await nm(e.job_id,{responses:[{id:r.id,selectedOptionIds:[t]}]}),fm(`Done — thanks!`,`success`),n()}catch(e){if(qp(e)){fm(e instanceof Error?e.message:`That request was already handled.`),n();return}console.error(`[needs-you] decision option resolve failed:`,e),fm(`Something went wrong — try again.`)}finally{i(!1)}}},p=e.kind===`decision`&&a!==null&&a.length>0;return(0,B.jsxs)(`div`,{className:`deck`,children:[(0,B.jsxs)(`div`,{className:`deck-meta`,children:[(0,B.jsx)(`span`,{className:`deck-kind`,children:l}),(0,B.jsx)(`span`,{className:`from`,children:e.asking_node_name}),(0,B.jsxs)(`span`,{className:`age`,children:[`blocked `,u]})]}),(0,B.jsx)(`p`,{className:`deck-q line-clamp-2`,children:e.title}),(0,B.jsxs)(`div`,{className:`deck-actions`,children:[e.kind===`notify`&&(0,B.jsx)(Z,{type:`button`,variant:`outline`,size:`sm`,disabled:r,onClick:()=>void d(`ack`),children:`Got it`}),e.kind===`validation`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Z,{type:`button`,size:`sm`,disabled:r,onClick:()=>void d(`yes`),children:`Approve`}),(0,B.jsx)(Z,{type:`button`,variant:`outline`,size:`sm`,disabled:r,onClick:()=>void d(`no`),children:`Reject`})]}),p&&a.map(e=>(0,B.jsx)(Z,{type:`button`,variant:`outline`,size:`sm`,disabled:r,onClick:()=>void f(e.id),children:e.label},e.id)),(0,B.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,disabled:r,onClick:()=>t(`/inbox/${encodeURIComponent(e.job_id)}`),style:{marginLeft:`auto`,color:`var(--dim)`},children:[`open thread `,(0,B.jsx)(nf,{"aria-hidden":!0})]})]})]})}var _m=e=>({"--i":e}),vm=`hosted in a tmux pane — open it in your terminal`;function ym(e){let t=new Map;for(let n of e)t.set(n.node_id,{node:n,children:[]});let n=[];for(let e of t.values()){let r=e.node.parent,i=r?t.get(r):void 0;i?i.children.push(e):n.push(e)}return n}var bm=[`active`,`idle`,`done`,`dead`,`canceled`],xm={query:``,status:`all`,blockedOnly:!1};function Sm(e){return e.query.trim()!==``||e.status!==`all`||e.blockedOnly}function Cm(e,t){if(t.status!==`all`&&e.status!==t.status||t.blockedOnly&&e.attention_count<=0)return!1;let n=t.query.trim().toLowerCase();return!(n&&!`${e.name} ${e.kind} ${e.mode} ${e.cwd} ${e.node_id} ${e.status}`.toLowerCase().includes(n))}function wm(e,t){if(!Sm(t))return e;let n=new Map(e.map(e=>[e.node_id,e])),r=new Set;for(let i of e){if(!Cm(i,t))continue;let e=i;for(;e&&!r.has(e.node_id);)r.add(e.node_id),e=e.parent?n.get(e.parent):void 0}return e.filter(e=>r.has(e.node_id))}var Tm=new Set([`dead`,`canceled`]);function Em(e){return Tm.has(e.node.status)&&e.children.every(Em)}function Dm(e){return 1+e.children.reduce((e,t)=>e+Dm(t),0)}var Om=3,km={active:hf,idle:hf,done:df,dead:pf,canceled:mf};function Am(e,t){return t?uf:km[e]??hf}function jm(e){return e.toLocaleTimeString(`en-GB`,{hour12:!1})}function Mm(){let[e,t]=(0,v.useState)(()=>jm(new Date));return(0,v.useEffect)(()=>{let e=setInterval(()=>t(jm(new Date)),1e3);return()=>clearInterval(e)},[]),e}function Nm(){let{nodes:e}=Sp(),[t,n]=(0,v.useState)(!1),[r,i]=(0,v.useState)(0),[a,o]=(0,v.useState)(xm),s=(0,v.useRef)(null),c=Mm(),l=e.filter(e=>e.status===`active`).length,u=(0,v.useMemo)(()=>ym(wm(e,a)),[e,a]);return(0,v.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=document.activeElement;t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLElement&&t.isContentEditable||(e.preventDefault(),s.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,B.jsxs)(`div`,{className:`in relative z-[1] h-full min-h-0 overflow-auto`,style:{padding:`34px 44px 44px`},children:[(0,B.jsxs)(`div`,{className:`rv flex items-baseline gap-4`,style:_m(1),children:[(0,B.jsx)(`h1`,{className:`text-2xl`,style:{fontWeight:420,letterSpacing:`-0.01em`,fontVariationSettings:`"opsz" 60`,color:`var(--ink)`},children:`Canvas`}),(0,B.jsxs)(`span`,{className:`text-sm`,style:{color:`var(--mut)`},children:[e.length,` `,e.length===1?`node`:`nodes`,l>0&&` · ${l} active`]}),(0,B.jsxs)(`div`,{className:`font-inst text-xs flex items-center gap-2`,style:{marginLeft:`auto`,color:`var(--ink2)`,letterSpacing:`0.1em`},children:[(0,B.jsx)(`span`,{style:{width:`8px`,height:`8px`,borderRadius:`50%`,background:`var(--act)`,animation:`pulse 2.4s ease-out infinite`}}),(0,B.jsx)(`span`,{children:c})]})]}),(0,B.jsxs)(`div`,{className:`rv flex items-center gap-2.5`,style:{margin:`20px 0 22px`,..._m(2)},children:[(0,B.jsxs)(`div`,{className:`search`,children:[(0,B.jsx)(Af,{size:14,className:`opacity-70`,"aria-hidden":!0}),(0,B.jsx)(`input`,{ref:s,value:a.query,onChange:e=>o(t=>({...t,query:e.currentTarget.value})),onKeyDown:e=>{e.key===`Escape`&&(o(e=>({...e,query:``})),e.currentTarget.blur())},placeholder:`Search name, kind, mode, cwd, id…`,"aria-label":`Search nodes`,className:`min-w-0 flex-1 border-0 bg-transparent p-0 text-sm outline-none`,style:{color:`var(--ink)`}}),(0,B.jsx)(`span`,{className:`kbd`,children:`/`})]}),(0,B.jsxs)(`label`,{className:`selectish`,children:[(0,B.jsxs)(`select`,{value:a.status,onChange:e=>o(t=>({...t,status:e.currentTarget.value})),"aria-label":`Filter by status`,className:`cursor-pointer appearance-none border-0 bg-transparent text-sm outline-none`,style:{color:`var(--ink2)`},children:[(0,B.jsx)(`option`,{value:`all`,children:`all statuses`}),bm.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsx)(`span`,{className:`car`,children:`▾`})]}),(0,B.jsxs)(`label`,{className:`checkish select-none`,children:[(0,B.jsx)(`span`,{className:`box`,style:a.blockedOnly?{background:`var(--blk)`,borderColor:`var(--blk)`}:void 0}),`blocked`,(0,B.jsx)(`input`,{type:`checkbox`,checked:a.blockedOnly,onChange:e=>o(t=>({...t,blockedOnly:e.currentTarget.checked})),className:`sr-only`})]}),(0,B.jsx)(`button`,{type:`button`,className:`btn primary`,style:{marginLeft:`auto`},onClick:()=>{i(e=>e+1),n(!0)},children:`+ Spawn a node`})]}),(0,B.jsx)(hm,{}),(0,B.jsxs)(`div`,{className:`panel rv`,style:{padding:`6px 0`,..._m(4)},children:[(0,B.jsxs)(`div`,{className:`flex items-center`,style:{padding:`10px 18px 9px`,borderBottom:`1px solid var(--line)`},children:[(0,B.jsx)(`span`,{className:`instlabel`,style:{color:`var(--dim)`},children:`Node forest`}),(0,B.jsx)(`span`,{className:`font-inst text-xs`,style:{marginLeft:`auto`,color:`var(--dim)`,letterSpacing:`0.1em`},children:`sorted · activity`})]}),(0,B.jsx)(`div`,{className:`tree`,children:e.length===0?(0,B.jsx)(`p`,{className:`px-3 py-2 text-sm italic`,style:{color:`var(--mut)`},children:`No nodes on the canvas yet.`}):u.length===0?(0,B.jsx)(`p`,{className:`px-3 py-2 text-sm italic`,style:{color:`var(--mut)`},children:`No matching nodes.`}):u.map(e=>(0,B.jsx)(Pm,{node:e},e.node.node_id))})]}),(0,B.jsx)(Im,{open:t,onClose:()=>n(!1)},r)]})}function Pm({node:e}){let t=ut(),[n,r]=(0,v.useState)(!1),i=e.node,a=i.attention_count>0,o=Tm.has(i.status),s=a?`blocked`:i.status,c=e.children.filter(e=>!Em(e)),l=e.children.filter(e=>Em(e)),u=l.reduce((e,t)=>e+Dm(t),0),d=u>=Om,f=d?c:e.children,p=()=>{i.enterable&&t(`/nodes/${encodeURIComponent(i.node_id)}`)};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:Y(`node-row s-${s}`,o&&`dimmed`),onClick:p,role:i.enterable?`button`:void 0,tabIndex:i.enterable?0:void 0,style:i.enterable?void 0:{cursor:`default`},onKeyDown:e=>{i.enterable&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),p())},children:[(0,B.jsxs)(`div`,{className:`node-id`,children:[(0,B.jsxs)(`div`,{className:`node-l1`,children:[(0,B.jsx)(`span`,{className:`node-name`,children:i.name}),(0,B.jsxs)(`span`,{className:`node-kind`,children:[i.kind,` · `,i.mode]})]}),(0,B.jsxs)(`div`,{className:`node-l2`,children:[(0,B.jsx)(`span`,{className:`node-cwd`,title:i.cwd,children:i.cwd}),i.lifecycle&&(0,B.jsx)(`span`,{className:`node-life`,children:i.lifecycle}),!i.enterable&&(0,B.jsx)(`span`,{className:`node-note`,children:vm})]})]}),(0,B.jsxs)(`div`,{className:`node-right`,children:[a&&(0,B.jsxs)(`span`,{className:`waitflag`,children:[(0,B.jsx)(vf,{size:14,"aria-hidden":!0}),` `,i.attention_count,` waiting on human`]}),(0,B.jsx)(Fm,{status:i.status,blocked:a})]})]}),(f.length>0||d&&u>0)&&(0,B.jsxs)(`div`,{className:`kids`,children:[f.map(e=>(0,B.jsx)(Pm,{node:e},e.node.node_id)),d&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`flex items-center gap-1.5 px-4 py-2 text-xs transition-colors`,style:{color:`var(--dim)`},children:[(0,B.jsx)(cf,{size:14,"aria-hidden":!0,style:{transform:n?`rotate(90deg)`:`none`,transition:`transform 0.15s ease`}}),n?`Hide ${u} closed`:`Show ${u} closed`]}),n&&l.map(e=>(0,B.jsx)(Pm,{node:e},e.node.node_id))]})]})]})}function Fm({status:e,blocked:t}){let n=Am(e,t);return(0,B.jsxs)(Kp,{variant:`outline`,className:t?`blocked`:e,children:[(0,B.jsx)(n,{"aria-hidden":!0}),e]})}function Im({open:e,onClose:t}){let[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(`developer`),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(null);return(0,B.jsx)(Dp,{open:e,onOpenChange:e=>!e&&t(),children:(0,B.jsxs)(Ap,{className:`max-w-md overflow-y-auto max-h-[90dvh]`,children:[(0,B.jsx)(jp,{children:(0,B.jsx)(Np,{children:`Spawn a node`})}),(0,B.jsxs)(`form`,{id:`spawn-form`,onSubmit:async e=>{if(e.preventDefault(),!n.trim()||!i.trim()){S(`prompt and kind are required`);return}b(!0),S(null);let r={prompt:n.trim(),kind:i.trim(),...o?{mode:o}:{},...c?{root:!0}:{},...u.trim()?{cwd:u.trim()}:{},...f.trim()?{name:f.trim()}:{},...m.trim()?{model:m.trim()}:{},...g.trim()?{parent:g.trim()}:{}};try{await Yf(r),t()}catch(e){console.error(`[spawn] failed:`,e),S(e instanceof Uf?`${e.code}: ${e.message}`:String(e))}finally{b(!1)}},className:`flex flex-col gap-3.5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-prompt`,children:`Prompt`}),(0,B.jsx)(Wp,{id:`spawn-prompt`,value:n,onChange:e=>r(e.currentTarget.value),rows:4,required:!0,className:`resize-none`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-kind`,children:`Kind`}),(0,B.jsx)(Fp,{id:`spawn-kind`,value:i,onChange:e=>a(e.currentTarget.value),required:!0})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-mode`,children:`Mode`}),(0,B.jsxs)(Lp,{value:o===``?`__none__`:o,onValueChange:e=>s(e===`__none__`?``:e),children:[(0,B.jsx)(zp,{id:`spawn-mode`,className:`w-full`,children:(0,B.jsx)(Rp,{})}),(0,B.jsxs)(Bp,{children:[(0,B.jsx)(Vp,{value:`__none__`,children:`(default)`}),(0,B.jsx)(Vp,{value:`base`,children:`base`}),(0,B.jsx)(Vp,{value:`orchestrator`,children:`orchestrator`})]})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`input`,{type:`checkbox`,id:`spawn-root`,checked:c,onChange:e=>l(e.currentTarget.checked),className:`size-4 rounded-none border border-input accent-primary`}),(0,B.jsx)(Ip,{htmlFor:`spawn-root`,className:`cursor-pointer`,children:`Resident root node`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-cwd`,children:`cwd`}),(0,B.jsx)(Fp,{id:`spawn-cwd`,value:u,onChange:e=>d(e.currentTarget.value),placeholder:`(inherit)`,className:`font-mono text-sm`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-name`,children:`Name`}),(0,B.jsx)(Fp,{id:`spawn-name`,value:f,onChange:e=>p(e.currentTarget.value),placeholder:`(auto)`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-model`,children:`Model`}),(0,B.jsx)(Fp,{id:`spawn-model`,value:m,onChange:e=>h(e.currentTarget.value),placeholder:`(default)`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-parent`,children:`Parent node id`}),(0,B.jsx)(Fp,{id:`spawn-parent`,value:g,onChange:e=>_(e.currentTarget.value),placeholder:`(this canvas root)`,className:`font-mono text-sm`})]}),x&&(0,B.jsx)(`p`,{className:`text-sm text-destructive`,children:x})]}),(0,B.jsxs)(Mp,{children:[(0,B.jsx)(Z,{type:`button`,variant:`outline`,onClick:t,disabled:y,children:`Cancel`}),(0,B.jsx)(Z,{type:`submit`,form:`spawn-form`,disabled:y,children:y?`Spawning…`:`Spawn`})]})]})})}function Lm(e){if(!e)return``;let t=e.replace(/\/+$/,``).split(`/`);return t[t.length-1]??``}function Rm(e){let t=e.name?.trim();if(t&&t!==e.kind)return t;let n=Lm(e.cwd);return n?`${e.kind} · ${n}`:e.kind}function zm(e){return e.parent===null&&e.host_kind===`broker`}function Bm(e){let t=new Map;for(let n of e){if(n.parent===null)continue;let e=t.get(n.parent);e?e.push(n):t.set(n.parent,[n])}return t}function Vm(e,t){let n=[],r=new Set,i=[e];for(;i.length>0;){let e=i.pop();if(r.has(e.node_id))continue;r.add(e.node_id),n.push(e);let a=t.get(e.node_id);if(a)for(let e of a)i.push(e)}return n}function Hm(e){return e===`done`||e===`dead`||e===`canceled`}function Um(e){return e.attention_count>0?`blocked`:e.status}function Wm(e,t,n){return t>0?`needs-you`:e.status===`active`||n>0?`active`:Hm(e.status)?`done`:`idle`}function Gm(e){switch(e){case`needs-you`:return 0;case`active`:return 1;case`idle`:return 2;case`done`:return 3}}function Km(e){let t=Bm(e),n=[];for(let r of e){if(!zm(r))continue;let e=Vm(r,t),i=0,a=0;for(let t of e)i+=Math.max(0,t.attention_count),t.node_id!==r.node_id&&t.status===`active`&&(a+=1);n.push({id:r.node_id,title:Rm(r),state:Wm(r,i,a),attention:i,activeChildren:a,nodeCount:e.length,...r.cycles===void 0?{}:{cycles:r.cycles},lastActivity:r.last_activity??r.created})}return n.sort((e,t)=>{let n=Gm(e.state)-Gm(t.state);return n===0?t.lastActivity.localeCompare(e.lastActivity):n}),n}function qm(e){switch(e.state){case`needs-you`:return e.attention>1?`${e.attention} things need your input`:`Needs your input`;case`active`:return e.activeChildren>0?`Working — ${e.activeChildren} ${e.activeChildren===1?`task`:`tasks`} in progress`:`Working…`;case`done`:return`Finished`;case`idle`:return`Idle`}}function Jm(e,t,n){if(e.key===`Enter`&&!e.shiftKey){if(e.altKey){e.preventDefault();let n=e.currentTarget,r=n.selectionStart??n.value.length,i=n.selectionEnd??r,a=`${n.value.slice(0,r)}\n${n.value.slice(i)}`,o=r+1;t(a),requestAnimationFrame(()=>{n.selectionStart=o,n.selectionEnd=o});return}e.metaKey||e.ctrlKey||(e.preventDefault(),n())}}var Ym=[`Research a topic for me`,`Help me write something`,`Review my code`,`Plan a project`];function Xm(){let{nodes:e,loading:t}=Sp(),n=up(e=>e.reachable),r=(0,v.useMemo)(()=>Km(e),[e]),[i,a]=(0,v.useState)(!1),[o]=Rn();(0,v.useEffect)(()=>{o.get(`new`)!==null&&a(!0)},[o]);let s=!t&&r.length===0;return(0,B.jsxs)(`div`,{className:`mx-auto flex h-full min-h-0 max-w-3xl flex-col px-6 py-8`,children:[(0,B.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-3`,children:[(0,B.jsx)(`h1`,{className:`text-3xl`,style:{fontWeight:460,letterSpacing:`-0.01em`,color:`var(--ink)`},children:`Conversations`}),!s&&!i&&(0,B.jsx)(Z,{size:`lg`,onClick:()=>a(!0),children:`+ New chat`})]}),!n&&(0,B.jsx)(`div`,{className:`mb-4 rounded-lg border px-4 py-2.5 text-sm`,style:{borderColor:`rgba(255,94,54,.3)`,background:`var(--blk-dim)`,color:`var(--ink2)`},children:`Couldn't reach your agents — retrying…`}),(i||s)&&(0,B.jsx)(Zm,{firstRun:s,onCancel:s?void 0:()=>a(!1)}),(0,B.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:t?(0,B.jsx)(th,{}):(0,B.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:r.map(e=>(0,B.jsx)(Qm,{conversation:e},e.id))})})]})}function Zm({firstRun:e,onCancel:t}){let n=ut(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),l=async()=>{let e=r.trim();if(!(!e||a)){o(!0),c(null);try{let t=await Yf({prompt:e,kind:`general`,mode:`base`,root:!0});n(`/c/${encodeURIComponent(t.node_id)}`)}catch(e){c(e instanceof Uf?e.message:String(e)),o(!1)}}};return(0,B.jsxs)(`div`,{className:`panel mb-6 p-5`,children:[e&&(0,B.jsx)(`p`,{className:`mb-3 text-base`,style:{fontStyle:`italic`,color:`var(--ink2)`},children:`Start a conversation with an agent.`}),(0,B.jsx)(Wp,{autoFocus:!0,value:r,onChange:e=>i(e.currentTarget.value),onKeyDown:e=>{Jm(e,i,()=>void l())},rows:3,disabled:a,placeholder:`What do you want help with?`,className:`resize-none border-0 bg-transparent px-0 text-base shadow-none focus-visible:ring-0`}),(0,B.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Ym.map(e=>(0,B.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>i(e),className:`rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-[color:var(--line2)] hover:text-foreground`,children:e},e))}),s&&(0,B.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,children:s}),(0,B.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-2`,children:[t&&(0,B.jsx)(Z,{variant:`ghost`,onClick:t,disabled:a,children:`Cancel`}),(0,B.jsx)(Z,{onClick:()=>void l(),disabled:a||!r.trim(),children:a?`Starting…`:`Start chat`})]})]})}function Qm({conversation:e}){let t=ut();return(0,B.jsx)(`li`,{className:`list-none`,children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>t(`/c/${encodeURIComponent(e.id)}`),className:`panel flex w-full items-center gap-4 px-4 py-3.5 text-left transition-colors hover:bg-[color-mix(in_oklch,var(--ink)_3%,transparent)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(eh,{state:e.state}),(0,B.jsx)(`span`,{className:`truncate text-sm`,style:{fontWeight:500,color:`var(--ink)`},children:e.title})]}),(0,B.jsx)(`p`,{className:`mt-0.5 truncate text-sm`,style:{color:`var(--mut)`},children:qm(e)})]}),(0,B.jsxs)(`div`,{className:`font-inst flex shrink-0 items-center gap-3 text-xs`,style:{letterSpacing:`0.04em`,color:`var(--mut)`},children:[e.cycles!==void 0&&(0,B.jsxs)(`span`,{title:`cycles`,children:[`⟳ `,e.cycles]}),(0,B.jsxs)(`span`,{title:`nodes in this conversation`,children:[`◦ `,e.nodeCount,` `,e.nodeCount===1?`node`:`nodes`]}),(0,B.jsx)(`span`,{title:`time since last work`,children:nh(e.lastActivity)})]})]})})}var $m={"needs-you":`needs you`,active:`active`,idle:`idle`,done:`done`};function eh({state:e}){let t=e===`needs-you`?`blocked`:e,n=$m[e];return(0,B.jsx)(`span`,{className:Y(`dot shrink-0`,t),title:n,"aria-label":n})}function th(){return(0,B.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:[0,1,2,3].map(e=>(0,B.jsxs)(`li`,{className:`panel flex items-center gap-4 px-4 py-3.5`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,B.jsx)(`div`,{className:`h-4 w-1/3 animate-pulse rounded bg-muted`}),(0,B.jsx)(`div`,{className:`h-3 w-2/3 animate-pulse rounded bg-muted/70`})]}),(0,B.jsx)(`div`,{className:`h-6 w-16 animate-pulse rounded-full bg-muted`})]},e))})}function nh(e){let t=new Date(e).getTime();if(Number.isNaN(t))return``;let n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}var rh={active:Tf,idle:hf,done:df,dead:pf,canceled:mf,blocked:uf};function ih({status:e}){return(0,B.jsx)(rh[e]??hf,{className:Y(`!size-3.5`,e===`active`&&`animate-spin`)})}function ah(e,t,n,r){return t===`static`?e.status:n===`down`?`dead`:n===`reconnecting`?`idle`:r?`active`:`idle`}function oh(e){let t=e.store.source===`static`,n=e.store.state?.isStreaming??!1,r=e.detail,i=r?ah(r,e.store.source,e.store.brokerStatus,n):null;return r?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{className:Y(sh,`min-w-0 truncate`),title:r.name,children:r.name}),i&&(0,B.jsxs)(Kp,{className:Y(`gap-1.5`,i),children:[(0,B.jsx)(ih,{status:i}),i]}),t&&(0,B.jsx)(`span`,{className:`font-mono text-xs`,style:{color:`var(--idle)`},title:`dormant node — last-known values, not live`,children:`last-known`})]}):(0,B.jsx)(`h2`,{className:sh,children:`…`})}var sh=`con-title text-xl font-medium`;function ch(e){let t=e.store.chrome,n=e.store.source===`static`,r=e.store.state?.isStreaming??!1,i=t.context,a=t.stats,o=t.tokens,s=i&&!n?i.percent:null,c=!n&&a?.cost!==void 0?a.cost:null;return!i&&c===null&&!a&&!o?null:(0,B.jsxs)(`div`,{className:`cluster`,children:[i&&(0,B.jsxs)(`div`,{className:`gauge`,children:[(0,B.jsxs)(`div`,{className:`glabel`,children:[(0,B.jsx)(`span`,{className:`instlabel`,children:`Context`}),(0,B.jsxs)(`span`,{className:`gval`,children:[s===null?`—`:dh(s),s!==null&&(0,B.jsx)(`span`,{className:`u`,children:`%`})]})]}),(0,B.jsx)(`div`,{className:`gbar`,children:(0,B.jsx)(`i`,{style:{width:s===null?`0%`:`${Math.min(100,s)}%`}})}),(0,B.jsxs)(`div`,{className:`gsub`,children:[i.tokens.toLocaleString(),!n&&(0,B.jsxs)(B.Fragment,{children:[` / `,i.window.toLocaleString()]})]})]}),c!==null&&(0,B.jsxs)(`div`,{className:`gauge`,children:[(0,B.jsxs)(`div`,{className:`glabel`,children:[(0,B.jsx)(`span`,{className:`instlabel`,children:`Cost`}),(0,B.jsxs)(`span`,{className:`gval`,children:[(0,B.jsx)(`span`,{className:`u`,style:{marginLeft:0,marginRight:2},children:`$`}),c.toFixed(2)]})]}),(0,B.jsx)(`div`,{className:`gbar`,children:(0,B.jsx)(`i`,{style:{width:`${Math.min(100,c/5*100)}%`}})}),a&&(0,B.jsxs)(`div`,{className:`gsub`,children:[a.turns,` turns`]})]}),(0,B.jsxs)(`div`,{className:`dials`,children:[!n&&a&&c===null&&(0,B.jsx)(lh,{value:String(a.turns),unit:`turns`}),!n&&a&&(0,B.jsx)(lh,{value:`${a.user_messages}/${a.assistant_messages}`,unit:`msgs`}),o&&(0,B.jsx)(lh,{value:`${uh(o.input)} → ${uh(o.output)}`,unit:`tokens`}),!n&&t.tool_calls!==null&&(0,B.jsx)(lh,{value:String(t.tool_calls),unit:`tools`,hot:r})]})]})}function lh({value:e,unit:t,hot:n}){return(0,B.jsx)(`div`,{className:`dial`,children:(0,B.jsxs)(`span`,{className:`dval`,style:n?{color:`var(--act)`}:void 0,children:[e,` `,(0,B.jsx)(`em`,{children:t})]})})}function uh(e){return e>=1e6?`${Math.round(e/1e5)/10}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}function dh(e){return(Math.round(e*10)/10).toFixed(1)}function fh({store:e,detail:t}){let n=e.chrome,r=[],i=n.branch??t?.branch??null;if(i!==null){let e=n.git_status??t?.git_status??null,a=e?.added??0,o=e?.modified??0;r.push((0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(yf,{className:`size-3.5 shrink-0 opacity-70`}),(0,B.jsx)(`b`,{style:ph,children:i}),a>0&&(0,B.jsxs)(`span`,{style:{color:`var(--act)`,opacity:.8},children:[` +`,a]}),o>0&&(0,B.jsxs)(`span`,{style:{color:`var(--idle)`,opacity:.8},children:[` ~`,o]})]},`branch`))}let a=t?.cwd??null;a!==null&&r.push((0,B.jsx)(`span`,{children:mh(a)},`cwd`));let o=n.model??t?.model??null;o!==null&&r.push((0,B.jsx)(`span`,{children:(0,B.jsx)(`b`,{style:ph,children:o})},`model`));let s=n.context??null;return s!==null&&r.push((0,B.jsxs)(`span`,{children:[`ctx `,(0,B.jsx)(`b`,{style:ph,children:hh(s.tokens)}),` / `,hh(s.window)]},`ctx`)),r.length===0?null:(0,B.jsx)(`div`,{className:`flex min-w-0 items-center gap-5 whitespace-nowrap border-b px-6 py-2 text-xs`,style:{borderColor:`var(--line)`,background:`rgba(0,0,0,.18)`,color:`var(--mut)`},children:r.map((e,t)=>(0,B.jsxs)(v.Fragment,{children:[t>0&&(0,B.jsx)(`span`,{style:{color:`var(--dim)`,opacity:.5},className:`select-none`,children:`·`}),e]},t))})}var ph={color:`var(--ink2)`,fontWeight:400};function mh(e){let t=e.match(/^\/(?:Users|home)\/[^/]+(\/.*)$/);if(t)return`~${t[1]}`;let n=e.split(`/`).filter(Boolean);return n.length<=2?e:`…/${n.slice(-2).join(`/`)}`}function hh(e){return e>=1e6?`${Math.round(e/1e6)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}function gh(e){let[t,n]=(0,v.useState)(!1),r=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){n(!1);return}if(e.altKey&&e.code===`KeyI`){if(document.activeElement instanceof HTMLTextAreaElement)return;e.preventDefault(),n(e=>!e)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),t?(0,B.jsx)(`div`,{className:`in fixed inset-0 z-50 flex items-start justify-center pt-22`,style:{background:`rgba(0,0,0,.42)`,backdropFilter:`blur(2px)`},onMouseDown:e=>{r.current?.contains(e.target)||n(!1)},children:(0,B.jsxs)(`div`,{ref:r,className:`panel rv`,style:_h,children:[(0,B.jsxs)(`div`,{style:vh,children:[(0,B.jsx)(`span`,{className:`instlabel`,children:`Instruments`}),(0,B.jsx)(`div`,{style:{flex:1}}),(0,B.jsx)(`span`,{className:`kbd`,children:`⌥i`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>n(!1),className:`transition-colors`,style:{color:`var(--mut)`},"aria-label":`Close instruments`,children:(0,B.jsx)(Pf,{className:`size-3.5`})})]}),(0,B.jsx)(ch,{store:e.store,detail:e.detail})]})}):null}var _h={minWidth:`min(680px, 92vw)`,overflow:`hidden`,"--i":0},vh={display:`flex`,alignItems:`center`,gap:`10px`,padding:`11px 30px`,borderBottom:`1px solid var(--line)`};function yh(e){let t=new Map;for(let n of e){if(n.parent===null)continue;let e=t.get(n.parent);e?e.push(n):t.set(n.parent,[n])}return t}function bh(e,t){let n=[],r=new Set,i=[{node:e,depth:0}];for(;i.length>0;){let e=i.pop();if(r.has(e.node.node_id))continue;r.add(e.node.node_id),n.push({node:e.node,depth:e.depth});let a=t.get(e.node.node_id)??[];for(let t=a.length-1;t>=0;t--)i.push({node:a[t],depth:e.depth+1})}return n}function xh(e,t){let n=t.get(e),r=new Set;for(;n&&n.parent!==null;){if(r.has(n.node_id))return null;r.add(n.node_id),n=t.get(n.parent)}return n??null}function Sh(e,t){let n=new Map(e.map(e=>[e.node_id,e])),r=yh(e),i=xh(t,n),a=i?.node_id??null;return{thisGraph:i===null?[]:bh(i,r),otherGraphs:e.filter(e=>e.parent===null&&e.host_kind===`broker`&&e.node_id!==a&&(e.status===`active`||e.attention_count>0))}}var Ch=new Set([`done`,`dead`,`canceled`]),wh=`crtr:graphrail-collapsed`;function Th(e){return e.attention_count>0||e.status===`active`}function Eh(e,t){let n=new Map(e.map(e=>[e.node.node_id,e.node])),r=new Map;for(let{node:t}of e){if(t.parent===null||!n.has(t.parent))continue;let e=r.get(t.parent);e?e.push(t.node_id):r.set(t.parent,[t.node_id])}let i=new Map,a=e=>{let o=i.get(e);if(o!==void 0)return o;i.set(e,!1);let s=n.get(e),c=e===t||s!==void 0&&Th(s);if(!c){for(let t of r.get(e)??[])if(a(t)){c=!0;break}}return i.set(e,c),c},o=new Set;for(let{node:t}of e)(r.get(t.node_id)?.length??0)>0&&!a(t.node_id)&&o.add(t.node_id);return{children:r,collapsedByDefault:o}}function Dh({currentId:e,onNavigate:t}){let{nodes:n}=Sp(),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(()=>{try{return localStorage.getItem(wh)===`1`}catch{return!1}}),[s,c]=(0,v.useState)({}),{thisGraph:l}=Sh(n,e),u=l[0]?.node.node_id??null,{children:d,collapsedByDefault:f}=(0,v.useMemo)(()=>Eh(l,e),[l,e]),p=e=>s[e]===void 0?f.has(e):!s[e],m=e=>c(t=>({...t,[e]:p(e)})),h=()=>{o(e=>{let t=!e;try{localStorage.setItem(wh,t?`1`:`0`)}catch{}return t})},{liveRoots:g,deadRoots:_}=(0,v.useMemo)(()=>{let e=n.filter(e=>e.parent===null&&e.host_kind===`broker`&&e.node_id!==u),t=[],r=[];for(let n of e)(Ch.has(n.status)&&n.attention_count===0?r:t).push(n);let i=(e,t)=>Date.parse(t.created)-Date.parse(e.created),a=e=>e.attention_count>0?0:e.status===`active`?1:2;return t.sort((e,t)=>a(e)-a(t)||i(e,t)),r.sort(i),{liveRoots:t,deadRoots:r}},[n,u]);if((0,v.useEffect)(()=>{let n=n=>{if(!n.altKey||n.key!==`ArrowUp`&&n.key!==`ArrowDown`)return;let r=l.findIndex(t=>t.node.node_id===e);if(r===-1)return;n.preventDefault();let i=n.key===`ArrowUp`?l[r-1]:l[r+1];i&&t(i.node.node_id)};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[l,e,t]),a)return(0,B.jsx)(`aside`,{className:`graphrail rv`,style:kh,children:(0,B.jsx)(`button`,{type:`button`,onClick:h,title:`Expand graph sidebar`,"aria-label":`Expand graph sidebar`,className:`flex size-6 items-center justify-center rounded-md text-[var(--dim)] transition-colors hover:text-[var(--ink2)]`,children:(0,B.jsx)(cf,{className:`size-4`})})});let y=[],b=null;for(let{node:n,depth:r}of l){if(b!==null){if(r>b)continue;b=null}let i=d.get(n.node_id)??[],a=i.length>0&&p(n.node_id);y.push((0,B.jsx)(Ih,{node:n,depth:r,current:n.node_id===e,hasChildren:i.length>0,collapsed:a,onToggleCollapse:()=>m(n.node_id),onClick:()=>t(n.node_id)},n.node_id)),a&&(b=r)}return(0,B.jsxs)(`aside`,{className:`graphrail rv`,style:Oh,children:[(0,B.jsx)(`div`,{className:`flex items-center justify-end pb-1`,children:(0,B.jsx)(`button`,{type:`button`,onClick:h,title:`Collapse graph sidebar`,"aria-label":`Collapse graph sidebar`,className:`flex size-6 items-center justify-center rounded-md text-[var(--dim)] transition-colors hover:text-[var(--ink2)]`,children:(0,B.jsx)(cf,{className:`size-4 rotate-180`})})}),(0,B.jsx)(Ah,{label:`This graph`,chord:`⌥↑↓ to cycle`}),y,l.length===0&&(0,B.jsx)(jh,{}),(g.length>0||_.length>0)&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`gr-gap`}),(0,B.jsx)(Ah,{label:`Elsewhere`}),g.map(e=>(0,B.jsx)(Ih,{node:e,depth:0,current:!1,elsewhere:!0,onClick:()=>t(e.node_id)},e.node_id)),_.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`mt-1 flex items-center gap-1.5 rounded-md px-3 py-2 text-left text-xs text-[var(--dim)] transition-colors hover:text-[var(--ink2)]`,children:[(0,B.jsx)(cf,{className:Y(`size-3.5 transition-transform`,r&&`rotate-90`)}),r?`Hide`:`Show`,` `,_.length,` finished`]}),r&&_.map(e=>(0,B.jsx)(Ih,{node:e,depth:0,current:!1,elsewhere:!0,onClick:()=>t(e.node_id)},e.node_id))]})]})]})}var Oh={width:`228px`,flex:`none`,display:`flex`,flexDirection:`column`,borderRight:`1px solid var(--line)`,background:`rgba(0,0,0,.16)`,padding:`14px 9px`,overflowY:`auto`,zIndex:1,"--i":2},kh={width:`36px`,flex:`none`,display:`flex`,flexDirection:`column`,alignItems:`center`,borderRight:`1px solid var(--line)`,background:`rgba(0,0,0,.16)`,padding:`14px 6px`,zIndex:1,"--i":2};function Ah({label:e,chord:t}){return(0,B.jsxs)(`div`,{className:`gr-sec`,children:[(0,B.jsx)(`span`,{className:`instlabel`,children:e}),(0,B.jsx)(`div`,{className:`rule`}),t&&(0,B.jsx)(`span`,{title:t,"aria-label":t,className:`flex items-center text-[var(--dim)]`,children:(0,B.jsx)(Sf,{className:`size-3.5`})})]})}function jh(){return(0,B.jsx)(`span`,{className:`px-3 py-1 font-mono text-xs`,style:{color:`var(--dim)`},children:`—`})}function Mh(e){let t=Date.now()-Date.parse(e);if(!Number.isFinite(t)||t<0)return``;let n=Math.floor(t/1e3);if(n<60)return`${n}s`;let r=Math.floor(n/60);if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function Nh(e){return e.split(`/`).filter(Boolean).at(-1)??e}function Ph(e){let t=e.match(/^\/(?:Users|home)\/[^/]+(\/.*)$/);if(t)return`~${t[1]}`;let n=e.split(`/`).filter(Boolean);return n.length<=2?e:`…/${n.slice(-2).join(`/`)}`}var Fh={active:`s-active`,idle:`s-idle`,done:`s-done`,dead:`s-dead`,canceled:`s-canceled`};function Ih({node:e,depth:t,current:n,elsewhere:r=!1,hasChildren:i=!1,collapsed:a=!1,onToggleCollapse:o,onClick:s}){let c=Ch.has(e.status),l=e.attention_count>0,u=l?`blocked`:e.status,d=Mh(e.created),f=t>0?{marginLeft:`${t*12}px`}:void 0,p=(0,B.jsx)(`button`,{type:`button`,onClick:s,className:Y(`node-row text-left`,r?`w-full`:`min-w-0 flex-1`,l?`s-blocked`:Fh[e.status],c&&!l&&`dimmed`,n&&`rounded-md border border-[var(--line2)] bg-[oklch(0.92_0.013_80_/_8%)] shadow-[inset_0_1px_0_var(--raise)]`),children:(0,B.jsxs)(`span`,{className:`node-id`,children:[(0,B.jsxs)(`span`,{className:`node-l1`,children:[(0,B.jsx)(`span`,{className:Y(`node-name truncate`,n&&`font-semibold`),children:r?Nh(e.cwd):e.name}),r?(0,B.jsxs)(`span`,{className:`node-kind truncate`,children:[e.name,` · `,e.kind]}):(0,B.jsx)(`span`,{className:`node-kind`,children:e.kind}),l&&(0,B.jsxs)(Kp,{variant:`destructive`,className:`ml-auto gap-1 text-xs`,children:[(0,B.jsx)(vf,{className:`size-3.5`}),e.attention_count]})]}),(0,B.jsxs)(`span`,{className:`node-l2`,children:[r&&(0,B.jsx)(`span`,{className:`node-cwd`,children:Ph(e.cwd)}),(0,B.jsx)(`span`,{className:Y(`dot`,u),title:u,"aria-label":u}),d&&(0,B.jsx)(`span`,{className:`text-[var(--dim)]`,children:d})]})]})});return r?(0,B.jsx)(`div`,{style:f,children:p}):(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,style:f,children:[i?(0,B.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o?.()},title:a?`Expand branch`:`Collapse branch`,"aria-label":a?`Expand branch`:`Collapse branch`,className:`flex size-4 flex-none items-center justify-center rounded-sm text-[var(--dim)] transition-colors hover:text-[var(--ink2)]`,children:(0,B.jsx)(cf,{className:Y(`size-3.5 transition-transform`,!a&&`rotate-90`)})}):(0,B.jsx)(`span`,{className:`size-4 flex-none`,"aria-hidden":`true`}),p]})}function Lh(e){let t=e.store.presence,n=e.store.role===`controller`;return(0,B.jsxs)(v.Fragment,{children:[(0,B.jsxs)(`div`,{className:`ctl-state flex shrink-0 items-center gap-1.5 text-xs`,style:{color:`var(--mut)`},children:[`control:`,` `,(0,B.jsx)(`span`,{style:{color:`var(--ink2)`,fontStyle:`italic`},children:n?`you`:t.controller?`another client`:`no one`})]}),n?(0,B.jsx)(`button`,{type:`button`,className:`btn sm shrink-0`,onClick:()=>e.store.releaseControl(),children:`Release control`}):(0,B.jsx)(`button`,{type:`button`,className:`btn primary sm shrink-0`,disabled:!e.store.socketReady,title:e.store.socketReady?void 0:`connecting…`,onClick:()=>e.store.requestControl(),children:`Request control`})]})}function Rh(e){return typeof e==`object`&&!!e}function zh(e){return typeof e==`string`?e:``}function Bh(e){let t=e??``;return/rate.?limit|\b429\b|too many requests|quota/i.test(t)?`rate-limit`:/overloaded|\b529\b|\b503\b|capacity|server.{0,3}busy|temporarily unavailable/i.test(t)?`overloaded`:/invalid_grant|refresh token|unauthori[sz]ed|invalid.?api.?key|authentication failed|\b401\b|\b403\b/i.test(t)?`auth`:/connection|econnreset|etimedout|enotfound|econnrefused|network|fetch failed|socket hang|timed? out|timeout/i.test(t)?`connection`:`other`}function Vh(e){let t=zh(e.code)||zh(e.errno);return t===``?null:/^(ECONNREFUSED|ECONNRESET|ETIMEDOUT|ENOENT|ENOTFOUND|EAI_AGAIN|EPIPE|EHOSTUNREACH|ENETUNREACH)$/i.test(t)?`connection`:null}function Hh(e){let t=typeof e.status==`number`?e.status:null;return t===null?null:t===401||t===403?`auth`:t===429?`rate-limit`:t===503||t===529||t>=500&&t<=599?`overloaded`:t>=400&&t<=499?`protocol`:null}function Uh(e){let t=typeof e.code==`number`?e.code:null;if(t===null)return null;if(t===1008)return`protocol`;if(t===1006)return`connection`;if(t===1011){let t=zh(e.reason);return/no running broker/i.test(t)||Bh(t)===`connection`?`connection`:`other`}return null}function Wh(e,t){return t===`auth`||t===`protocol`?`fatal`:e===`pi→provider`?t===`connection`||t===`rate-limit`||t===`overloaded`?`auto`:`fatal`:`manual`}function Gh(e){if(typeof e==`string`)return e;if(!Rh(e))return``;let t=[e.message,e.errorMessage,e.reason,e.body,e.statusText];for(let e of t)if(typeof e==`string`&&e!==``)return e;let n=e.error;if(Rh(n)){let e=n.message;if(typeof e==`string`&&e!==``)return e;let t=n.reason;if(typeof t==`string`&&t!==``)return t}return``}function Kh(e,t){if(Rh(t)){let n=Vh(t);if(n!==null)return{kind:n,disposition:Wh(e,n)};let r=Hh(t);if(r!==null)return{kind:r,disposition:Wh(e,r)};let i=Uh(t);if(i!==null)return{kind:i,disposition:Wh(e,i)}}let n=Bh(Gh(t));return{kind:n,disposition:Wh(e,n)}}var qh=class{nodeId;handlers;ws;closedReported=!1;constructor(e,t){this.nodeId=e,this.handlers=t}get url(){let e=location.protocol===`https:`?`wss:`:`ws:`,t=new URL(`/node/${encodeURIComponent(this.nodeId)}`,window.location.href);return t.protocol=e,Bf!==void 0&&t.searchParams.set(`token`,Bf),t.toString()}connect(){let e;try{e=new WebSocket(this.url)}catch(e){this.reportClose(`transient`,`failed to open ws: ${String(e)}`);return}this.ws=e,e.onopen=()=>this.handlers.onOpen?.(),e.onmessage=e=>this.onMessage(e),e.onclose=e=>{let t=Kh(`browser↔relay`,{code:e.code,reason:e.reason}),n=e.code===1008||t.kind===`protocol`?`invalid`:e.code===1011&&/^no node /.test(e.reason)?`no-node`:e.code===1011&&/^no running broker/.test(e.reason)?`no-broker`:`transient`;this.reportClose(n,e.reason||`closed (${e.code})`)},e.onerror=()=>{}}onMessage(e){if(typeof e.data!=`string`)return;let t;try{t=JSON.parse(e.data)}catch{return}this.handlers.onFrame?.(t)}send(e){let t=this.ws;if(!(t===void 0||t.readyState!==WebSocket.OPEN))try{t.send(JSON.stringify(e))}catch{}}close(){let e=this.ws;if(e!==void 0&&e.readyState<=WebSocket.OPEN)try{e.close()}catch{}}reportClose(e,t){this.closedReported||(this.closedReported=!0,this.ws=void 0,this.handlers.onClose?.(e,t))}},Jh=/^From (?:[a-z0-9]+-[a-f0-9]+|system|human) — \d+ update/;function Yh(e){return Jh.test(e)}function Xh(e){let t=/^From ([a-z0-9]+-[a-f0-9]+|system|human) — /.exec(e);if(!t)return null;let n=t[1];return typeof n==`string`?n:null}function Zh(){return{messages:[],streamingIndex:null,executingToolIds:new Set,partialToolResults:new Map,isStreaming:!1,activity:null,queued:[]}}function Qh(e){let t=e.content;return typeof t==`string`?t:Array.isArray(t)?t.filter(e=>!!e&&e.type===`text`).map(e=>typeof e.text==`string`?e.text:``).join(``):``}function $h(e){return ng(e)!==`user`||e.origin||!Yh(Qh(e))?e:{...e,origin:`inbox`}}function eg(){return{role:`assistant`,content:[]}}function tg(e,t){let n=e.messages.map($h);if(e.state?.isStreaming!==!0)return{messages:n,streamingIndex:null,executingToolIds:new Set,partialToolResults:new Map,isStreaming:!1,activity:null,queued:[]};let r=n.length-1;if(r>=0&&ng(n[r])===`assistant`)return{messages:n,streamingIndex:r,executingToolIds:new Set,partialToolResults:new Map,isStreaming:!0,activity:`Working…`,queued:[]};let i=t&&t.streamingIndex!==null?t.messages[t.streamingIndex]:void 0,a=i&&ng(i)===`assistant`?i:eg(),o=[...n,a];return{messages:o,streamingIndex:o.length-1,executingToolIds:new Set,partialToolResults:new Map,isStreaming:!0,activity:`Working…`,queued:[]}}function ng(e){return e.role??``}function rg(e){for(let t=e.messages.length-1;t>=0;t--)if(ng(e.messages[t])===`bashExecution`)return t;return null}function ig(e,t,n){let r={role:`bashExecution`,command:t,output:``,exitCode:void 0,cancelled:!1,truncated:!1,excludeFromContext:n,timestamp:Date.now()};return{...e,messages:[...e.messages,r]}}function ag(e,t){let n=rg(e);if(n===null)return e;let r=[...e.messages],i=r[n];return r[n]={...i,output:`${i.output??``}${t}`},{...e,messages:r}}function og(e,t){let n=rg(e);if(n===null)return e;let r=[...e.messages];return r[n]={...r[n],exitCode:t.exitCode,cancelled:t.cancelled,truncated:t.truncated,fullOutputPath:t.fullOutputPath},{...e,messages:r}}function sg(e,t){switch(t.type){case`agent_start`:return{...e,isStreaming:!0,activity:`Working…`};case`agent_end`:return{...e,isStreaming:!1,activity:null,streamingIndex:null,executingToolIds:e.executingToolIds.size?new Set:e.executingToolIds};case`message_start`:{let n=$h(t.message),r=[...e.messages,n],i=ng(n)===`assistant`,a=e.partialToolResults;if(ng(n)===`toolResult`){let e=n.toolCallId;if(typeof e==`string`&&a.has(e)){let t=new Map(a);t.delete(e),a=t}}return{...e,messages:r,partialToolResults:a,streamingIndex:i?r.length-1:e.streamingIndex}}case`message_update`:{let n=e.streamingIndex;if(n===null){let t=e.messages.length-1;t>=0&&ng(e.messages[t])===`assistant`&&(n=t)}if(n===null)return e;let r=[...e.messages];return r[n]=t.message,{...e,messages:r,streamingIndex:n}}case`message_end`:{if(e.streamingIndex===null)return e;let n=[...e.messages];return n[e.streamingIndex]=t.message,{...e,messages:n,streamingIndex:null}}case`tool_execution_start`:{let n=new Set(e.executingToolIds);return n.add(t.toolCallId),{...e,executingToolIds:n}}case`tool_execution_update`:{let n=new Map(e.partialToolResults);return n.set(t.toolCallId,cg(t.toolCallId,t.toolName,t.partialResult,!1)),{...e,partialToolResults:n}}case`tool_execution_end`:{let n=new Set(e.executingToolIds);n.delete(t.toolCallId);let r=new Map(e.partialToolResults);return r.set(t.toolCallId,cg(t.toolCallId,t.toolName,t.result,t.isError)),{...e,executingToolIds:n,partialToolResults:r}}case`compaction_start`:return{...e,activity:`Compacting context…`};case`compaction_end`:return{...e,activity:e.isStreaming?`Working…`:null};case`auto_retry_start`:return{...e,activity:`Retrying (${t.attempt}/${t.maxAttempts}) in ${Math.ceil(t.delayMs/1e3)}s…`};case`auto_retry_end`:return{...e,activity:e.isStreaming?`Working…`:null};case`queue_update`:return{...e,queued:[...t.steering,...t.followUp]};default:return e}}function cg(e,t,n,r){let i=typeof n==`object`&&n?n:{};return{role:`toolResult`,toolCallId:e,toolName:t,...i,content:Array.isArray(i.content)?i.content:[],isError:r}}var lg=1,ug=new Set([`stop`,`length`,`toolUse`,`error`,`aborted`]),dg=new Set([`off`,`minimal`,`low`,`medium`,`high`,`xhigh`]),fg=200,pg=256*1024,mg=20,hg=8*1024*1024;function gg(e){return{schemaVersion:lg,...e}}function _g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e){return typeof e==`string`}function vg(e){return typeof e==`number`}function yg(e){return typeof e==`boolean`}function bg(e){return!_g(e)||e.type!==`text`||!Q(e.text)?!1:e.textSignature===void 0||Q(e.textSignature)}function xg(e){return _g(e)&&e.type===`image`&&Q(e.data)&&Q(e.mimeType)}function Sg(e){return _g(e)&&e.type===`toolCall`&&Q(e.id)&&Q(e.name)&&_g(e.arguments)&&(e.thoughtSignature===void 0||Q(e.thoughtSignature))}function Cg(e){return _g(e)&&vg(e.input)&&vg(e.output)&&vg(e.cacheRead)&&vg(e.cacheWrite)&&vg(e.total)}function wg(e){return _g(e)&&vg(e.input)&&vg(e.output)&&vg(e.cacheRead)&&vg(e.cacheWrite)&&(e.cacheWrite1h===void 0||vg(e.cacheWrite1h))&&(e.reasoning===void 0||vg(e.reasoning))&&vg(e.totalTokens)&&Cg(e.cost)}function Tg(e){return typeof e==`string`&&ug.has(e)}function Eg(e){return typeof e==`string`&&dg.has(e)}function Dg(e){return!_g(e)||!Q(e.message)?!1:(e.name===void 0||Q(e.name))&&(e.stack===void 0||Q(e.stack))&&(e.code===void 0||Q(e.code)||vg(e.code))}function Og(e){return!_g(e)||!Q(e.type)||!vg(e.timestamp)?!1:(e.error===void 0||Dg(e.error))&&(e.details===void 0||_g(e.details))}function kg(e){return!_g(e)||e.role!==`user`||!vg(e.timestamp)?!1:typeof e.content==`string`||Array.isArray(e.content)&&e.content.every(e=>bg(e)||xg(e))}function Ag(e){return!_g(e)||e.role!==`assistant`||!vg(e.timestamp)||!Array.isArray(e.content)||!e.content.every(e=>bg(e)||_g(e)&&e.type===`thinking`&&Q(e.thinking)&&(e.thinkingSignature===void 0||Q(e.thinkingSignature))&&(e.redacted===void 0||yg(e.redacted))||Sg(e))?!1:Q(e.api)&&Q(e.provider)&&Q(e.model)&&(e.responseModel===void 0||Q(e.responseModel))&&(e.responseId===void 0||Q(e.responseId))&&(e.diagnostics===void 0||Array.isArray(e.diagnostics)&&e.diagnostics.every(Og))&&wg(e.usage)&&Tg(e.stopReason)&&(e.errorMessage===void 0||Q(e.errorMessage))}function jg(e){return!_g(e)||e.role!==`toolResult`||!vg(e.timestamp)?!1:Q(e.toolCallId)&&Q(e.toolName)&&Array.isArray(e.content)&&e.content.every(e=>bg(e)||xg(e))&&yg(e.isError)}function Mg(e){return _g(e)&&e.role===`bashExecution`&&Q(e.command)&&Q(e.output)&&vg(e.timestamp)&&(e.exitCode===void 0||vg(e.exitCode))&&yg(e.cancelled)&&yg(e.truncated)&&(e.fullOutputPath===void 0||Q(e.fullOutputPath))&&(e.excludeFromContext===void 0||yg(e.excludeFromContext))}function Ng(e){return kg(e)||Ag(e)||jg(e)||Mg(e)}function Pg(e){return!_g(e)||!Q(e.role)?!1:e.role!==`user`&&e.role!==`assistant`&&e.role!==`toolResult`&&e.role!==`bashExecution`}function Fg(e){return Ng(e)||Pg(e)}function Ig(e){return!_g(e)||!Q(e.name)||!Q(e.description)||e.source!==`builtin`&&e.source!==`command`&&e.source!==`template`?!1:(e.location===void 0||e.location===`user`||e.location===`project`||e.location===`path`)&&(e.path===void 0||Q(e.path))&&(e.argument_hint===void 0||Q(e.argument_hint))}function Lg(e){return e===null?!0:_g(e)?Q(e.sessionId)&&(e.sessionFile===null||Q(e.sessionFile))&&(e.model===null||Q(e.model))&&yg(e.isStreaming)&&Eg(e.thinkingLevel)&&(e.steeringMode===`all`||e.steeringMode===`one-at-a-time`)&&(e.followUpMode===`all`||e.followUpMode===`one-at-a-time`)&&(e.sessionName===null||Q(e.sessionName))&&yg(e.autoCompactionEnabled)&&vg(e.pendingMessageCount):!1}function Rg(e,t){return _g(t)?t.schemaVersion===lg&&t.nodeId===e&&Array.isArray(t.messages)&&t.messages.every(Fg)&&Lg(t.sessionState)&&Array.isArray(t.commands)&&t.commands.every(Ig)&&yg(t.isStreaming)&&(t.activity===null||Q(t.activity))&&vg(t.updatedAt)&&(t.source===`broker`||t.source===`static`):!1}function zg(e){return new TextEncoder().encode(JSON.stringify(e)).length}function Bg(e,t,n){let r=e.messages.slice(-t),i={...e,messages:r};for(;r.length>1&&zg(i)>n;)r=r.slice(1),i={...e,messages:r};return i}function Vg(e){return`crtr.web.transcript.tail.${e}`}function Hg(e){try{let t=globalThis.localStorage?.getItem(Vg(e));if(t==null)return null;let n=JSON.parse(t);return Rg(e,n)?n:null}catch{return null}}function Ug(e){let t=Bg(e,mg,pg);try{globalThis.localStorage?.setItem(Vg(e.nodeId),JSON.stringify(t))}catch{}}var Wg=`crtr-web-transcript-cache`,Gg=1,Kg=`entries`;function qg(){return new Promise((e,t)=>{if(typeof indexedDB>`u`){t(Error(`indexedDB unavailable`));return}let n=indexedDB.open(Wg,Gg);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(Kg)||e.createObjectStore(Kg,{keyPath:`nodeId`}).createIndex(`updatedAt`,`updatedAt`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??Error(`indexedDB open failed`))})}async function Jg(e){try{let t=await qg(),n=await new Promise((n,r)=>{let i=t.transaction(Kg,`readonly`).objectStore(Kg).get(e);i.onsuccess=()=>n(i.result),i.onerror=()=>r(i.error??Error(`indexedDB read failed`))});return t.close(),Rg(e,n)?n:null}catch{return null}}async function Yg(e){let t=[];await new Promise((n,r)=>{let i=e.transaction(Kg,`readonly`).objectStore(Kg).index(`updatedAt`).openCursor();i.onsuccess=()=>{let e=i.result;if(!e){n();return}let r=e.value;t.push({nodeId:r.nodeId,updatedAt:r.updatedAt,size:zg(r)}),e.continue()},i.onerror=()=>r(i.error??Error(`indexedDB cursor failed`))});let n=t.reduce((e,t)=>e+t.size,0);n<=hg||await new Promise((r,i)=>{let a=e.transaction(Kg,`readwrite`),o=a.objectStore(Kg),s=0;for(;n>hg&&s<t.length;){let e=t[s];o.delete(e.nodeId),n-=e.size,s+=1}a.oncomplete=()=>r(),a.onerror=()=>i(a.error??Error(`indexedDB prune failed`))})}async function Xg(e){let t=Bg(e,fg,pg);try{let e=await qg();await new Promise((n,r)=>{let i=e.transaction(Kg,`readwrite`);i.objectStore(Kg).put(t),i.oncomplete=()=>n(),i.onerror=()=>r(i.error??Error(`indexedDB write failed`))}),await Yg(e),e.close()}catch{}}function Zg(e){return{clientId:e,conn:`connecting`,conv:Zh(),role:`observer`,controllerId:null,session:null,model:void 0,sessionName:void 0,contextTokens:void 0,dialog:null,commands:[],statuses:{},widgets:{},title:void 0,notice:null}}var Qg={"no-broker":`no-broker`,"no-node":`no-node`,invalid:`invalid`,transient:`closed`};function $g(e){return e===`welcome`||e===`control_changed`||e===`model_changed`||e===`error`||e===`ack`||e===`data`||e===`display_status`||e===`display_widget`||e===`display_title`||e===`bash_start`||e===`bash_output`||e===`bash_end`||e===`extension_ui_request`}function e_(e,t){switch(t.kind){case`connecting`:return e.conn===`connecting`?e:{...e,conn:`connecting`};case`closed`:{let n=Qg[t.closeKind];return e.conn===n?e:{...e,conn:n}}case`notice`:return e.notice===t.text?e:{...e,notice:t.text};case`dismiss-dialog`:return e.dialog===null?e:{...e,dialog:null};case`frame`:return s_(e,t.frame)}}function t_(e,t){return e.name===t.name&&e.description===t.description&&e.source===t.source&&e.location===t.location&&e.path===t.path&&e.argument_hint===t.argument_hint}function n_(e,t){return e.length===t.length&&e.every((e,n)=>t_(e,t[n]))}function r_(e,t){return e===t?!0:e===void 0||t===void 0?!1:e.placement===t.placement&&e.lines.length===t.lines.length&&e.lines.every((e,n)=>e===t.lines[n])}function i_(e){if(e===void 0||e.trim()===``)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>{if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.name==`string`&&typeof t.description==`string`&&(t.source===`builtin`||t.source===`command`||t.source===`template`)}):[]}catch{return[]}}function a_(e){return{sessionId:e.sessionId,sessionFile:e.sessionFile??null,model:e.model??null,isStreaming:e.isStreaming,thinkingLevel:e.thinkingLevel,steeringMode:e.steeringMode,followUpMode:e.followUpMode,sessionName:e.sessionName??null,autoCompactionEnabled:e.autoCompactionEnabled,pendingMessageCount:e.pendingMessageCount}}function o_(e){let t=e.messages.length-1,n=e.isStreaming&&t>=0?t:null;return{messages:e.messages,streamingIndex:n,executingToolIds:new Set,partialToolResults:new Map,isStreaming:e.isStreaming,activity:e.activity,queued:[]}}function s_(e,t){if(!$g(t.type))return{...e,conv:sg(e.conv,t)};switch(t.type){case`welcome`:{let n=tg(t.snapshot,e.conv),r=t.controller_id,i=a_(t.snapshot.state);return{...e,conn:`open`,conv:n,controllerId:r,role:r===e.clientId?`controller`:`observer`,session:i,model:i.model??void 0,sessionName:i.sessionName??void 0,contextTokens:t.snapshot.stats?.tokens?.total,dialog:t.pending_dialog??null,commands:[]}}case`control_changed`:return e.controllerId===t.controller_id?e:{...e,controllerId:t.controller_id,role:t.controller_id===e.clientId?`controller`:`observer`};case`model_changed`:{let n=t.model??null;return e.model===t.model&&(e.session===null||e.session.model===n)?e:{...e,model:t.model,session:e.session?{...e.session,model:n}:e.session}}case`error`:{let n=t.code===`not_controller`?`read-only — another viewer is the controller`:t.message||`error: ${t.code}`;return e.notice===n?e:{...e,notice:n}}case`extension_ui_request`:return{...e,dialog:t};case`display_status`:{let n=e.statuses[t.key];if(t.text===void 0?n===void 0:n===t.text)return e;let r={...e.statuses};return t.text===void 0?delete r[t.key]:r[t.key]=t.text,{...e,statuses:r}}case`display_widget`:{let n=e.widgets[t.key],r=t.lines===void 0?void 0:{lines:t.lines,placement:t.placement};if(r_(n,r))return e;let i={...e.widgets};return r===void 0?delete i[t.key]:i[t.key]=r,{...e,widgets:i}}case`display_title`:return e.title===t.title?e:{...e,title:t.title};case`ack`:{if(t.for!==`get_commands`)return e;let n=t.ok?i_(t.detail):[];return n_(e.commands,n)?e:{...e,commands:n}}case`bash_start`:return{...e,conv:ig(e.conv,t.command,t.excludeFromContext)};case`bash_output`:return{...e,conv:ag(e.conv,t.chunk)};case`bash_end`:return{...e,conv:og(e.conv,t)};default:return e}}var c_=1500,l_=800,u_=5e3,d_=10;function f_(e){return Math.min(u_,l_*2**e)}var p_=class e{nodeId;static CACHE_WRITE_DEBOUNCE_MS=500;clientId;actions;pinned=!1;state;listeners=new Set;client=null;gen=0;timer=null;cacheWriteTimer=null;role=`observer`;streaming=!1;cachedUpdatedAt=0;liveAttached=!1;started=!1;noBrokerAttempts=0;constructor(e){this.nodeId=e,this.clientId=crypto.randomUUID(),this.state=Zg(this.clientId);let t=Hg(e);t&&(this.state={...this.state,conv:o_(t),session:t.sessionState,commands:t.commands,model:t.sessionState?.model??void 0,sessionName:t.sessionState?.sessionName??void 0},this.cachedUpdatedAt=t.updatedAt),this.actions=this.buildActions()}subscribe=e=>(this.ensureStarted(),this.listeners.add(e),()=>{this.listeners.delete(e)});getState=()=>this.state;ensureStarted(){this.started||(this.started=!0,this.hydrateFromFullMirror(),this.dial())}hydrateFromFullMirror(){let e=this.gen;Jg(this.nodeId).then(t=>{if(e===this.gen&&!this.liveAttached&&!(t===null||t.updatedAt<=this.cachedUpdatedAt)){this.state={...this.state,conv:o_(t),session:t.sessionState,commands:t.commands,model:t.sessionState?.model??void 0,sessionName:t.sessionState?.sessionName??void 0},this.cachedUpdatedAt=t.updatedAt;for(let e of this.listeners)e()}})}focus(){this.ensureStarted(),this.pinned=!0,this.state.conn===`open`&&this.send({type:`request_control`})}background(){this.pinned=!1,this.send({type:`release_control`})}dispose(){this.gen+=1,this.timer&&clearTimeout(this.timer),this.cacheWriteTimer&&(clearTimeout(this.cacheWriteTimer),this.cacheWriteTimer=null,this.flushCacheWrite()),this.client?.close(),this.client=null}dispatch(e){let t=this.state,n=e_(t,e);if(n!==t){this.state=n,this.role=n.role,this.streaming=n.conv.isStreaming,e.kind===`frame`&&e.frame.type===`welcome`&&(this.liveAttached=!0),n.conv!==t.conv&&this.scheduleCacheWrite();for(let e of this.listeners)e()}}scheduleCacheWrite(){this.cacheWriteTimer&&clearTimeout(this.cacheWriteTimer),this.cacheWriteTimer=setTimeout(()=>{this.cacheWriteTimer=null,this.flushCacheWrite()},e.CACHE_WRITE_DEBOUNCE_MS)}flushCacheWrite(){let e=gg({nodeId:this.nodeId,messages:this.state.conv.messages,sessionState:this.state.session,commands:this.state.commands,isStreaming:this.state.conv.isStreaming,activity:this.state.conv.activity,updatedAt:Date.now(),source:`broker`});Ug(e),Xg(e),this.cachedUpdatedAt=e.updatedAt}send(e){this.client?.send(e)}dial(){let e=this.gen,t=new qh(this.nodeId,{onOpen:()=>{e===this.gen&&t.send({type:`hello`,role:`observer`,client_id:this.clientId})},onFrame:n=>{e===this.gen&&(this.dispatch({kind:`frame`,frame:n}),n.type===`welcome`&&(t.send({type:`get_commands`}),this.pinned&&t.send({type:`request_control`}),this.noBrokerAttempts=0))},onClose:t=>{if(e===this.gen){if(this.dispatch({kind:`closed`,closeKind:t}),t===`transient`)this.timer=setTimeout(()=>{e===this.gen&&(this.dispatch({kind:`connecting`}),this.dial())},c_);else if(t===`no-broker`&&this.noBrokerAttempts<d_){let t=this.noBrokerAttempts;this.noBrokerAttempts+=1,this.timer=setTimeout(()=>{e===this.gen&&this.dial()},f_(t))}}}});this.client=t,t.connect()}buildActions(){return{sendText:e=>{let t=e.trim();if(t!==``){if(this.role!==`controller`){this.dispatch({kind:`notice`,text:`take control before sending`});return}if(t.startsWith(`!`)){let e=t.startsWith(`!!`),n=t.slice(e?2:1).trim();if(n===``)return;this.send({type:`bash`,command:n,excludeFromContext:e});return}this.send(this.streaming?{type:`steer`,text:t}:{type:`prompt`,text:t})}},abort:()=>{this.role===`controller`&&this.send({type:`abort`})},takeControl:()=>this.send({type:`request_control`}),releaseControl:()=>this.send({type:`release_control`}),setModel:e=>this.send({type:`set_model`,model:e}),cycleModel:()=>this.send({type:`cycle_model`}),setThinkingLevel:e=>this.send({type:`set_thinking_level`,level:e}),compact:e=>this.send({type:`compact`,...e?{instructions:e}:{}}),answerDialog:e=>{this.send(e),this.dispatch({kind:`dismiss-dialog`})},cancelDialog:()=>{let e=this.state.dialog?.id;e!==void 0&&this.send({type:`extension_ui_response`,id:e,cancelled:!0}),this.dispatch({kind:`dismiss-dialog`})},reconnect:()=>{this.timer&&clearTimeout(this.timer),this.gen+=1,this.noBrokerAttempts=0,this.client?.close(),this.dispatch({kind:`connecting`}),this.dial()},clearNotice:()=>this.dispatch({kind:`notice`,text:null})}}},m_=4,h_=new class{handles=new Map;mru=[];poolListeners=new Set;warmIdsSnapshot=[];acquire(e){let t=this.handles.get(e);return t||(t=new p_(e),this.handles.set(e,t)),this.touch(e),this.notifyPool(),this.evictExcess(),t}focus(e){this.handles.get(e)?.focus()}background(e){this.handles.get(e)?.background()}subscribe=e=>(this.poolListeners.add(e),()=>{this.poolListeners.delete(e)});getWarmIds=()=>this.warmIdsSnapshot;evict(e){let t=this.handles.get(e);if(!t)return;t.pinned=!1,t.dispose(),this.handles.delete(e);let n=this.mru.indexOf(e);n!==-1&&this.mru.splice(n,1),this.notifyPool()}touch(e){let t=this.mru.indexOf(e);t!==-1&&this.mru.splice(t,1),this.mru.push(e)}evictExcess(){for(let e=0;e<this.mru.length&&this.mru.length>m_;){let t=this.mru[e],n=this.handles.get(t);if(n?.pinned){e+=1;continue}n?.dispose(),this.handles.delete(t),this.mru.splice(e,1),this.notifyPool()}}notifyPool(){this.warmIdsSnapshot=[...this.mru];for(let e of this.poolListeners)e()}};function g_(e){let t=h_.acquire(e);return{state:(0,v.useSyncExternalStore)(t.subscribe,t.getState),actions:t.actions}}var __={branch:null,model:null,tokens:null,context:null,tool_calls:null,stats:null,git_status:null};function v_(e,t){return{sessionId:t.state?.sessionId??e,sessionFile:t.state?.sessionFile??null,model:t.state?.model??null,isStreaming:!1,thinkingLevel:t.state?.thinkingLevel??`off`,steeringMode:t.state?.steeringMode??`all`,followUpMode:t.state?.followUpMode??`all`,sessionName:t.state?.sessionName??null,autoCompactionEnabled:t.state?.autoCompactionEnabled??!1,pendingMessageCount:t.state?.pendingMessageCount??0}}function y_(e){let{state:t,actions:n}=g_(e),r=up(e=>e.reachable),[i,a]=(0,v.useState)(null);(0,v.useEffect)(()=>{let n=!1;if(t.conn!==`no-broker`){a(null);return}return Jf(e).then(t=>{if(n)return;a(t);let r=gg({nodeId:e,messages:tg(t.snapshot).messages,sessionState:v_(e,t.snapshot),commands:t.commands,isStreaming:!1,activity:null,updatedAt:Date.now(),source:`static`});Ug(r),Xg(r)}).catch(()=>{n||a(null)}),()=>{n=!0}},[e,t.conn]);let o=t.conn===`no-broker`&&i?.node_id===e?i:null,s=(0,v.useMemo)(()=>o===null?null:tg(o.snapshot),[o]),c=(0,v.useMemo)(()=>t.session===null?null:{...t.session,isStreaming:t.conv.isStreaming},[t.session,t.conv.isStreaming]),l=(0,v.useMemo)(()=>t.conn===`connecting`||t.conn===`closed`?null:o===null?c:v_(e,o.snapshot),[e,o,t.conn,c]),u=(0,v.useMemo)(()=>o===null?{...__,model:t.model??null}:{...__,model:o.snapshot.state?.model??null},[o,t.model]),d=s?.messages??t.conv.messages,f=s?.partialToolResults??t.conv.partialToolResults,p=s?.executingToolIds??t.conv.executingToolIds,m=s?.queued??t.conv.queued,h=o?.commands??t.commands;return{messages:d,partialToolResults:f,executingToolIds:p,queued:m,state:l,role:t.role,chrome:u,dialog:t.dialog,commands:h,presence:{viewers:0,controller:t.controllerId},brokerStatus:t.conn===`open`?`connected`:t.conn===`closed`||t.conn===`connecting`?`reconnecting`:`down`,source:t.conn===`no-broker`?`static`:`broker`,serverConnected:r,socketReady:t.conn===`open`,error:t.notice?{code:`broker_unavailable`,message:t.notice}:null,reconnect:n.reconnect,prompt:e=>n.sendText(e),steer:e=>n.sendText(e),abort:n.abort,setModel:n.setModel,cycleModel:n.cycleModel,setThinkingLevel:n.setThinkingLevel,compact:n.compact,requestControl:n.takeControl,releaseControl:n.releaseControl,dialogResponse:(e,t)=>n.answerDialog({type:`extension_ui_response`,id:e,...t})}}var b_=400,x_=4e3;function S_(e){return e.dormant&&e.status===`active`&&e.socketReady&&e.attempt<8}function C_(e){return Math.min(x_,b_*2**Math.max(0,e))}var w_=1,T_=400;function E_(e){return`crtr.web.draft.${e}`}function D_(e,t){if(typeof t!=`object`||!t)return!1;let n=t;return n.schemaVersion===w_&&n.nodeId===e&&typeof n.text==`string`&&typeof n.updatedAt==`number`}function O_(e){try{let t=globalThis.localStorage?.getItem(E_(e));if(t==null)return``;let n=JSON.parse(t);return D_(e,n)?n.text:``}catch{return``}}function k_(e,t){let n={schemaVersion:w_,nodeId:e,text:t,updatedAt:Date.now()};try{globalThis.localStorage?.setItem(E_(e),JSON.stringify(n))}catch{}}function A_(e){try{globalThis.localStorage?.removeItem(E_(e))}catch{}}var j_=new Map;function M_(e,t){let n=j_.get(e);n&&clearTimeout(n);let r=setTimeout(()=>{j_.delete(e),t===``?A_(e):k_(e,t)},T_);j_.set(e,r)}function N_(e){let t=j_.get(e);t&&(clearTimeout(t),j_.delete(e))}function P_(e){let t=y_(e),[n,r]=(0,v.useState)(null);(0,v.useEffect)(()=>(h_.focus(e),()=>{h_.background(e)}),[e]);let[i,a]=(0,v.useState)(``);(0,v.useEffect)(()=>{a(O_(e))},[e]),(0,v.useEffect)(()=>{M_(e,i)},[e,i]);let[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(null),f=t.source===`static`,p=t.brokerStatus===`connected`,m=t.role===`controller`,h=t.state?.isStreaming??!1,g=m&&!f&&p&&t.serverConnected,_=t.commands;(0,v.useEffect)(()=>{let t=!1;return qf(e).then(e=>{t||r(e)}).catch(e=>{t||l(F_(e))}),()=>{t=!0}},[e]);let y=(0,v.useRef)(0);(0,v.useEffect)(()=>{y.current=0},[e]),(0,v.useEffect)(()=>{if(!S_({dormant:f,status:n?.status,socketReady:t.socketReady,attempt:y.current}))return;let e=y.current;y.current+=1;let r=setTimeout(()=>t.reconnect(),C_(e));return()=>clearTimeout(r)},[f,n?.status,t.socketReady,t.reconnect]);let b=()=>{let n=i.trim();!n||!g||(h?t.steer(n):t.prompt(n),N_(e),A_(e),a(``))};return{store:t,detail:n,input:i,setInput:a,reviving:o,actionError:c,peekedPath:u,setPeekedPath:d,dormant:f,brokerUp:p,isController:m,streaming:h,canDrive:g,commands:_,sendPrimary:b,onInputKeyDown:e=>{Jm(e,a,b)},selectCommand:e=>{a(`/${e.name} `)},doRevive:async()=>{s(!0),l(null);try{await Zf(e),t.reconnect()}catch(e){l(F_(e))}finally{s(!1)}},doClose:async()=>{l(null);try{await Qf(e)}catch(e){l(F_(e))}}}}function F_(e){return e instanceof Uf?`${e.code}: ${e.message}`:String(e)}function I_(e){let t=(0,v.useMemo)(()=>{let t=e.query;return t.startsWith(`/`)?t.slice(1).trimStart().toLowerCase():``},[e.query]),n=(0,v.useMemo)(()=>{let n=e.commands;return t?n.filter(e=>e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.source.toLowerCase().includes(t)):n},[t,e.commands]);return e.visible?(0,B.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 z-20 mb-1 max-h-72 overflow-auto border border-border bg-popover`,children:n.length>0?(0,B.jsx)(`ul`,{className:`flex flex-col divide-y divide-border/40`,children:n.map(t=>(0,B.jsxs)(`li`,{className:`flex cursor-pointer flex-wrap items-baseline gap-x-2 gap-y-0.5 px-3 py-2 hover:bg-accent/50`,onClick:()=>e.onSelect(t),children:[(0,B.jsxs)(`span`,{className:`font-mono text-sm font-semibold text-primary`,children:[`/`,t.name]}),t.argument_hint&&(0,B.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground/70`,children:t.argument_hint}),(0,B.jsxs)(`span`,{className:`ml-auto font-mono text-xs text-muted-foreground/50`,children:[t.source,t.location&&(0,B.jsxs)(B.Fragment,{children:[` · `,t.location]})]}),(0,B.jsx)(`span`,{className:`basis-full text-xs text-muted-foreground`,children:t.description})]},t.name))}):(0,B.jsx)(`div`,{className:`px-3 py-2 text-xs italic text-muted-foreground`,children:`no matching commands`})}):null}var L_=new Set([`select`,`confirm`,`input`,`editor`,`notify`]);function R_(e){return L_.has(e.method)}function z_(e){let t=e.store.dialog,n=t&&R_(t)?t:null,r=e.store.role===`controller`;return(0,B.jsx)(Dp,{open:n!==null,children:(0,B.jsx)(Ap,{showCloseButton:!1,className:n&&!r?`opacity-90`:void 0,children:n&&(r?(0,B.jsx)(W_,{req:n,store:e.store},n.id):(0,B.jsx)(B_,{req:n},n.id))})})}function B_(e){return(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(`p`,{className:`text-sm font-semibold`,children:`The controller is being prompted`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:U_(e.req)})]})}function V_(e){switch(e){case`error`:return`border-destructive/40 text-destructive`;case`warning`:return`border-warning/40 text-warning`;case`success`:return`border-success/40 text-success`;default:return`border-border text-foreground`}}function H_(e){let t=/https?:\/\/[^\s]+/g;return e.split(`
51
+ `},Ta=0,Ea=[];function Da(e){var t=v.useRef([]),n=v.useRef([0,0]),r=v.useRef(),i=v.useState(Ta++)[0],a=v.useState(Yi)[0],o=v.useRef(e);v.useEffect(function(){o.current=e},[e]),v.useEffect(function(){if(e.inert){document.body.classList.add(`block-interactivity-${i}`);var t=Ti([e.lockRef.current],(e.shards||[]).map(Sa),!0).filter(Boolean);return t.forEach(function(e){return e.classList.add(`allow-interactivity-${i}`)}),function(){document.body.classList.remove(`block-interactivity-${i}`),t.forEach(function(e){return e.classList.remove(`allow-interactivity-${i}`)})}}},[e.inert,e.lockRef.current,e.shards]);var s=v.useCallback(function(e,t){if(`touches`in e&&e.touches.length===2||e.type===`wheel`&&e.ctrlKey)return!o.current.allowPinchZoom;var i=ba(e),a=n.current,s=`deltaX`in e?e.deltaX:a[0]-i[0],c=`deltaY`in e?e.deltaY:a[1]-i[1],l,u=e.target,d=Math.abs(s)>Math.abs(c)?`h`:`v`;if(`touches`in e&&d===`h`&&u.type===`range`)return!1;var f=window.getSelection(),p=f&&f.anchorNode;if(p&&(p===u||p.contains(u)))return!1;var m=pa(d,u);if(!m)return!0;if(m?l=d:(l=d===`v`?`h`:`v`,m=pa(d,u)),!m)return!1;if(!r.current&&`changedTouches`in e&&(s||c)&&(r.current=l),!l)return!0;var h=r.current||l;return ya(h,t,e,h===`h`?s:c,!0)},[]),c=v.useCallback(function(e){var n=e;if(!(!Ea.length||Ea[Ea.length-1]!==a)){var r=`deltaY`in n?xa(n):ba(n),i=t.current.filter(function(e){return e.name===n.type&&(e.target===n.target||n.target===e.shadowParent)&&Ca(e.delta,r)})[0];if(i&&i.should){n.cancelable&&n.preventDefault();return}if(!i){var c=(o.current.shards||[]).map(Sa).filter(Boolean).filter(function(e){return e.contains(n.target)});(c.length>0?s(n,c[0]):!o.current.noIsolation)&&n.cancelable&&n.preventDefault()}}},[]),l=v.useCallback(function(e,n,r,i){var a={name:e,delta:n,target:r,should:i,shadowParent:Oa(r)};t.current.push(a),setTimeout(function(){t.current=t.current.filter(function(e){return e!==a})},1)},[]),u=v.useCallback(function(e){n.current=ba(e),r.current=void 0},[]),d=v.useCallback(function(t){l(t.type,xa(t),t.target,s(t,e.lockRef.current))},[]),f=v.useCallback(function(t){l(t.type,ba(t),t.target,s(t,e.lockRef.current))},[]);v.useEffect(function(){return Ea.push(a),e.setCallbacks({onScrollCapture:d,onWheelCapture:d,onTouchMoveCapture:f}),document.addEventListener(`wheel`,c,ca),document.addEventListener(`touchmove`,c,ca),document.addEventListener(`touchstart`,u,ca),function(){Ea=Ea.filter(function(e){return e!==a}),document.removeEventListener(`wheel`,c,ca),document.removeEventListener(`touchmove`,c,ca),document.removeEventListener(`touchstart`,u,ca)}},[]);var p=e.removeScrollBar,m=e.inert;return v.createElement(v.Fragment,null,m?v.createElement(a,{styles:wa(i)}):null,p?v.createElement(aa,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function Oa(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}var ka=Ri(zi,Da),Aa=v.forwardRef(function(e,t){return v.createElement(Vi,Ci({},e,{ref:t,sideCar:ka}))});Aa.classNames=Vi.classNames;var ja=function(e){return typeof document>`u`?null:(Array.isArray(e)?e[0]:e).ownerDocument.body},Ma=new WeakMap,Na=new WeakMap,Pa={},Fa=0,Ia=function(e){return e&&(e.host||Ia(e.parentNode))},La=function(e,t){return t.map(function(t){if(e.contains(t))return t;var n=Ia(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})},Ra=function(e,t,n,r){var i=La(t,Array.isArray(e)?e:[e]);Pa[n]||(Pa[n]=new WeakMap);var a=Pa[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=(Ma.get(e)||0)+1,l=(a.get(e)||0)+1;Ma.set(e,c),a.set(e,l),o.push(e),c===1&&i&&Na.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(),Fa++,function(){o.forEach(function(e){var t=Ma.get(e)-1,i=a.get(e)-1;Ma.set(e,t),a.set(e,i),t||(Na.has(e)||e.removeAttribute(r),Na.delete(e)),i||e.removeAttribute(n)}),Fa--,Fa||(Ma=new WeakMap,Ma=new WeakMap,Na=new WeakMap,Pa={})}},za=function(e,t,n){n===void 0&&(n=`data-aria-hidden`);var r=Array.from(Array.isArray(e)?e:[e]),i=t||ja(e);return i?(r.push.apply(r,Array.from(i.querySelectorAll(`[aria-live], script`))),Ra(r,i,n,`aria-hidden`)):function(){return null}},Ba=`Dialog`,[Va,Ha]=yr(Ba),[Ua,Wa]=Va(Ba),Ga=e=>{let{__scopeDialog:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!0}=e,s=v.useRef(null),c=v.useRef(null),[l,u]=wr({prop:r,defaultProp:i??!1,onChange:a,caller:Ba});return(0,B.jsx)(Ua,{scope:t,triggerRef:s,contentRef:c,contentId:Ir(),titleId:Ir(),descriptionId:Ir(),open:l,onOpenChange:u,onOpenToggle:v.useCallback(()=>u(e=>!e),[u]),modal:o,children:n})};Ga.displayName=Ba;var Ka=`DialogTrigger`,qa=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Wa(Ka,n),a=Zn(t,i.triggerRef);return(0,B.jsx)(pr.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":po(i.open),...r,ref:a,onClick:V(e.onClick,i.onOpenToggle)})});qa.displayName=Ka;var Ja=`DialogPortal`,[Ya,Xa]=Va(Ja,{forceMount:void 0}),Za=e=>{let{__scopeDialog:t,forceMount:n,children:r,container:i}=e,a=Wa(Ja,t);return(0,B.jsx)(Ya,{scope:t,forceMount:n,children:v.Children.map(r,e=>(0,B.jsx)(Or,{present:n||a.open,children:(0,B.jsx)(vi,{asChild:!0,container:i,children:e})}))})};Za.displayName=Ja;var Qa=`DialogOverlay`,$a=v.forwardRef((e,t)=>{let n=Xa(Qa,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Wa(Qa,e.__scopeDialog);return a.modal?(0,B.jsx)(Or,{present:r||a.open,children:(0,B.jsx)(to,{...i,ref:t})}):null});$a.displayName=Qa;var eo=Qn(`DialogOverlay.RemoveScroll`),to=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Wa(Qa,n),a=Zn(t,Yr());return(0,B.jsx)(Aa,{as:eo,allowPinchZoom:!0,shards:[i.contentRef],children:(0,B.jsx)(pr.div,{"data-state":po(i.open),...r,ref:a,style:{pointerEvents:`auto`,...r.style}})})}),no=`DialogContent`,ro=v.forwardRef((e,t)=>{let n=Xa(no,e.__scopeDialog),{forceMount:r=n.forceMount,...i}=e,a=Wa(no,e.__scopeDialog);return(0,B.jsx)(Or,{present:r||a.open,children:a.modal?(0,B.jsx)(io,{...i,ref:t}):(0,B.jsx)(ao,{...i,ref:t})})});ro.displayName=no;var io=v.forwardRef((e,t)=>{let n=Wa(no,e.__scopeDialog),r=v.useRef(null),i=Zn(t,n.contentRef,r);return v.useEffect(()=>{let e=r.current;if(e)return za(e)},[]),(0,B.jsx)(oo,{...e,ref:i,trapFocus:n.open,disableOutsidePointerEvents:n.open,onCloseAutoFocus:V(e.onCloseAutoFocus,e=>{e.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:V(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0;(t.button===2||n)&&e.preventDefault()}),onFocusOutside:V(e.onFocusOutside,e=>e.preventDefault())})}),ao=v.forwardRef((e,t)=>{let n=Wa(no,e.__scopeDialog),r=v.useRef(!1),i=v.useRef(!1);return(0,B.jsx)(oo,{...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()}})}),oo=v.forwardRef((e,t)=>{let{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,...o}=e,s=Wa(no,n);return xi(),(0,B.jsx)(B.Fragment,{children:(0,B.jsx)(ai,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,B.jsx)(Kr,{role:`dialog`,id:s.contentId,"aria-describedby":s.descriptionId,"aria-labelledby":s.titleId,"data-state":po(s.open),...o,ref:t,deferPointerDownOutside:!0,onDismiss:()=>s.onOpenChange(!1)})})})}),so=`DialogTitle`,co=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Wa(so,n);return(0,B.jsx)(pr.h2,{id:i.titleId,...r,ref:t})});co.displayName=so;var lo=`DialogDescription`,U=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Wa(lo,n);return(0,B.jsx)(pr.p,{id:i.descriptionId,...r,ref:t})});U.displayName=lo;var uo=`DialogClose`,fo=v.forwardRef((e,t)=>{let{__scopeDialog:n,...r}=e,i=Wa(uo,n);return(0,B.jsx)(pr.button,{type:`button`,...r,ref:t,onClick:V(e.onClick,()=>i.onOpenChange(!1))})});fo.displayName=uo;function po(e){return e?`open`:`closed`}function mo(e){let t=v.useRef({value:e,previous:e});return v.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}function ho(e){let[t,n]=v.useState(void 0);return Sr(()=>{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 go=[`top`,`right`,`bottom`,`left`],_o=Math.min,vo=Math.max,yo=Math.round,bo=Math.floor,xo=e=>({x:e,y:e}),So={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function Co(e,t,n){return vo(e,_o(t,n))}function wo(e,t){return typeof e==`function`?e(t):e}function To(e){return e.split(`-`)[0]}function Eo(e){return e.split(`-`)[1]}function Do(e){return e===`x`?`y`:`x`}function Oo(e){return e===`y`?`height`:`width`}function ko(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ao(e){return Do(ko(e))}function jo(e,t,n){n===void 0&&(n=!1);let r=Eo(e),i=Ao(e),a=Oo(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Bo(o)),[o,Bo(o)]}function Mo(e){let t=Bo(e);return[No(e),t,No(t)]}function No(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Po=[`left`,`right`],Fo=[`right`,`left`],Io=[`top`,`bottom`],Lo=[`bottom`,`top`];function Ro(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Fo:Po:t?Po:Fo;case`left`:case`right`:return t?Io:Lo;default:return[]}}function zo(e,t,n,r){let i=Eo(e),a=Ro(To(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(No)))),a}function Bo(e){let t=To(e);return So[t]+e.slice(t.length)}function Vo(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ho(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Vo(e)}function Uo(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 Wo(e,t,n){let{reference:r,floating:i}=e,a=ko(t),o=Ao(t),s=Oo(o),c=To(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(Eo(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 Go(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}=wo(t,e),p=Ho(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Uo(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=Uo(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 Ko=50,qo=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Go},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Wo(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<Ko&&(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}=Wo(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Jo=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}=wo(e,t)||{};if(l==null)return{};let d=Ho(u),f={x:n,y:r},p=Ao(i),m=Oo(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=_o(d[_],T),D=_o(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=Co(O,A,k),M=!c.arrow&&Eo(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}}}),Yo=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}=wo(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=To(r),_=ko(o),v=To(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Bo(o)]:Mo(o)),x=p!==`none`;!d&&x&&b.push(...zo(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=jo(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`&&_!==ko(t))||T.every(e=>ko(e.placement)!==_||e.overflows[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=ko(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 Xo(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Zo(e){return go.some(t=>e[t]>=0)}var Qo=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=wo(e,t);switch(i){case`referenceHidden`:{let e=Xo(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Zo(e)}}}case`escaped`:{let e=Xo(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Zo(e)}}}default:return{}}}}},$o=new Set([`left`,`top`]);async function es(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=To(n),s=Eo(n),c=ko(n)===`y`,l=$o.has(o)?-1:1,u=a&&c?-1:1,d=wo(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 ts=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 es(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}}}}},ns=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}=wo(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=ko(To(i)),p=Do(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=Co(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=Co(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}}}}}},rs=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}=wo(e,t),u={x:n,y:r},d=ko(i),f=Do(d),p=u[f],m=u[d],h=wo(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=$o.has(To(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}}}},is=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}=wo(e,t),u=await o.detectOverflow(t,l),d=To(i),f=Eo(i),p=ko(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=_o(h-u[g],v),x=_o(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=vo(u.left,0),t=vo(u.right,0),n=vo(u.top,0),r=vo(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:vo(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:vo(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 as(){return typeof window<`u`}function os(e){return ls(e)?(e.nodeName||``).toLowerCase():`#document`}function ss(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function cs(e){return((ls(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function ls(e){return as()?e instanceof Node||e instanceof ss(e).Node:!1}function us(e){return as()?e instanceof Element||e instanceof ss(e).Element:!1}function ds(e){return as()?e instanceof HTMLElement||e instanceof ss(e).HTMLElement:!1}function fs(e){return!as()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof ss(e).ShadowRoot}function ps(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ws(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function ms(e){return/^(table|td|th)$/.test(os(e))}function hs(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var gs=/transform|translate|scale|rotate|perspective|filter/,_s=/paint|layout|strict|content/,vs=e=>!!e&&e!==`none`,ys;function bs(e){let t=us(e)?ws(e):e;return vs(t.transform)||vs(t.translate)||vs(t.scale)||vs(t.rotate)||vs(t.perspective)||!Ss()&&(vs(t.backdropFilter)||vs(t.filter))||gs.test(t.willChange||``)||_s.test(t.contain||``)}function xs(e){let t=Es(e);for(;ds(t)&&!Cs(t);){if(bs(t))return t;if(hs(t))return null;t=Es(t)}return null}function Ss(){return ys??=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`),ys}function Cs(e){return/^(html|body|#document)$/.test(os(e))}function ws(e){return ss(e).getComputedStyle(e)}function Ts(e){return us(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Es(e){if(os(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||fs(e)&&e.host||cs(e);return fs(t)?t.host:t}function Ds(e){let t=Es(e);return Cs(t)?e.ownerDocument?e.ownerDocument.body:e.body:ds(t)&&ps(t)?t:Ds(t)}function Os(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=Ds(e),i=r===e.ownerDocument?.body,a=ss(r);if(i){let e=ks(a);return t.concat(a,a.visualViewport||[],ps(r)?r:[],e&&n?Os(e):[])}else return t.concat(r,Os(r,[],n))}function ks(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function As(e){let t=ws(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=ds(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=yo(n)!==a||yo(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function js(e){return us(e)?e:e.contextElement}function Ms(e){let t=js(e);if(!ds(t))return xo(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=As(t),o=(a?yo(n.width):n.width)/r,s=(a?yo(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Ns=xo(0);function Ps(e){let t=ss(e);return!Ss()||!t.visualViewport?Ns:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Fs(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ss(e)?!1:t}function Is(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=js(e),o=xo(1);t&&(r?us(r)&&(o=Ms(r)):o=Ms(e));let s=Fs(a,n,r)?Ps(a):xo(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=ss(a),t=r&&us(r)?ss(r):r,n=e,i=ks(n);for(;i&&r&&t!==n;){let e=Ms(i),t=i.getBoundingClientRect(),r=ws(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=ss(i),i=ks(n)}}return Uo({width:u,height:d,x:c,y:l})}function Ls(e,t){let n=Ts(e).scrollLeft;return t?t.left+n:Is(cs(e)).left+n}function Rs(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ls(e,n),y:n.top+t.scrollTop}}function zs(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=cs(r),s=t?hs(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=xo(1),u=xo(0),d=ds(r);if((d||!d&&!a)&&((os(r)!==`body`||ps(o))&&(c=Ts(r)),d)){let e=Is(r);l=Ms(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?Rs(o,c):xo(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 Bs(e){return Array.from(e.getClientRects())}function Vs(e){let t=cs(e),n=Ts(e),r=e.ownerDocument.body,i=vo(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=vo(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Ls(e),s=-n.scrollTop;return ws(r).direction===`rtl`&&(o+=vo(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Hs=25;function Us(e,t){let n=ss(e),r=cs(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Ss();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Ls(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<=Hs&&(a-=o)}else l<=Hs&&(a+=l);return{width:a,height:o,x:s,y:c}}function Ws(e,t){let n=Is(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=ds(e)?Ms(e):xo(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Gs(e,t,n){let r;if(t===`viewport`)r=Us(e,n);else if(t===`document`)r=Vs(cs(e));else if(us(t))r=Ws(t,n);else{let n=Ps(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Uo(r)}function Ks(e,t){let n=Es(e);return n===t||!us(n)||Cs(n)?!1:ws(n).position===`fixed`||Ks(n,t)}function qs(e,t){let n=t.get(e);if(n)return n;let r=Os(e,[],!1).filter(e=>us(e)&&os(e)!==`body`),i=null,a=ws(e).position===`fixed`,o=a?Es(e):e;for(;us(o)&&!Cs(o);){let t=ws(o),n=bs(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||ps(o)&&!n&&Ks(e,o))?r=r.filter(e=>e!==o):i=t,o=Es(o)}return t.set(e,r),r}function Js(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?hs(t)?[]:qs(t,this._c):[].concat(n),r],o=Gs(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=Gs(t,a[e],i);s=vo(n.top,s),c=_o(n.right,c),l=_o(n.bottom,l),u=vo(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ys(e){let{width:t,height:n}=As(e);return{width:t,height:n}}function Xs(e,t,n){let r=ds(t),i=cs(t),a=n===`fixed`,o=Is(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=xo(0);function l(){c.x=Ls(i)}if(r||!r&&!a)if((os(t)!==`body`||ps(i))&&(s=Ts(t)),r){let e=Is(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?Rs(i,s):xo(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 Zs(e){return ws(e).position===`static`}function Qs(e,t){if(!ds(e)||ws(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return cs(e)===n&&(n=n.ownerDocument.body),n}function $s(e,t){let n=ss(e);if(hs(e))return n;if(!ds(e)){let t=Es(e);for(;t&&!Cs(t);){if(us(t)&&!Zs(t))return t;t=Es(t)}return n}let r=Qs(e,t);for(;r&&ms(r)&&Zs(r);)r=Qs(r,t);return r&&Cs(r)&&Zs(r)&&!bs(r)?n:r||xs(e)||n}var ec=async function(e){let t=this.getOffsetParent||$s,n=this.getDimensions,r=await n(e.floating);return{reference:Xs(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function tc(e){return ws(e).direction===`rtl`}var nc={convertOffsetParentRelativeRectToViewportRelativeRect:zs,getDocumentElement:cs,getClippingRect:Js,getOffsetParent:$s,getElementRects:ec,getClientRects:Bs,getDimensions:Ys,getScale:Ms,isElement:us,isRTL:tc};function rc(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ic(e,t){let n=null,r,i=cs(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=bo(d),h=bo(i.clientWidth-(u+f)),g=bo(i.clientHeight-(d+p)),_=bo(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:vo(0,_o(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&&!rc(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 ac(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=js(e),u=i||a?[...l?Os(l):[],...t?Os(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?ic(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?Is(e):null;c&&g();function g(){let t=Is(e);h&&!rc(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 oc=ts,sc=ns,cc=Yo,lc=is,uc=Qo,dc=Jo,fc=rs,pc=(e,t,n)=>{let r=new Map,i={platform:nc,...n},a={...i.platform,_c:r};return qo(e,t,{...i,platform:a})},mc=typeof document<`u`?v.useLayoutEffect:function(){};function hc(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(!hc(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)&&!hc(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function gc(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function _c(e,t){let n=gc(e);return Math.round(t*n)/n}function vc(e){let t=v.useRef(e);return mc(()=>{t.current=e}),t}function yc(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]=v.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=v.useState(r);hc(f,r)||p(r);let[m,h]=v.useState(null),[g,_]=v.useState(null),b=v.useCallback(e=>{e!==w.current&&(w.current=e,h(e))},[]),x=v.useCallback(e=>{e!==T.current&&(T.current=e,_(e))},[]),S=a||m,C=o||g,w=v.useRef(null),T=v.useRef(null),E=v.useRef(u),D=c!=null,O=vc(c),k=vc(i),A=vc(l),j=v.useCallback(()=>{if(!w.current||!T.current)return;let e={placement:t,strategy:n,middleware:f};k.current&&(e.platform=k.current),pc(w.current,T.current,e).then(e=>{let t={...e,isPositioned:A.current!==!1};M.current&&!hc(E.current,t)&&(E.current=t,y.flushSync(()=>{d(t)}))})},[f,t,n,k,A]);mc(()=>{l===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let M=v.useRef(!1);mc(()=>(M.current=!0,()=>{M.current=!1}),[]),mc(()=>{if(S&&(w.current=S),C&&(T.current=C),S&&C){if(O.current)return O.current(S,C,j);j()}},[S,C,j,O,D]);let N=v.useMemo(()=>({reference:w,floating:T,setReference:b,setFloating:x}),[b,x]),P=v.useMemo(()=>({reference:S,floating:C}),[S,C]),F=v.useMemo(()=>{let e={position:n,left:0,top:0};if(!P.floating)return e;let t=_c(P.floating,u.x),r=_c(P.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...gc(P.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,P.floating,u.x,u.y]);return v.useMemo(()=>({...u,update:j,refs:N,elements:P,floatingStyles:F}),[u,j,N,P,F])}var bc=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?{}:dc({element:r.current,padding:i}).fn(n):r?dc({element:r,padding:i}).fn(n):{}}}},xc=(e,t)=>{let n=oc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sc=(e,t)=>{let n=sc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Cc=(e,t)=>({fn:fc(e).fn,options:[e,t]}),wc=(e,t)=>{let n=cc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Tc=(e,t)=>{let n=lc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ec=(e,t)=>{let n=uc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Dc=(e,t)=>{let n=bc(e);return{name:n.name,fn:n.fn,options:[e,t]}},Oc=`Arrow`,kc=v.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,B.jsx)(pr.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,B.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});kc.displayName=Oc;var Ac=kc,jc=`Popper`,[Mc,Nc]=yr(jc),[Pc,Fc]=Mc(jc),Ic=e=>{let{__scopePopper:t,children:n}=e,[r,i]=v.useState(null),[a,o]=v.useState(void 0);return(0,B.jsx)(Pc,{scope:t,anchor:r,onAnchorChange:i,placementState:a,setPlacementState:o,children:n})};Ic.displayName=jc;var Lc=`PopperAnchor`,Rc=v.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=Fc(Lc,n),o=v.useRef(null),s=a.onAnchorChange,c=Zn(t,v.useCallback(e=>{o.current=e,e&&s(e)},[s])),l=v.useRef(null);v.useEffect(()=>{if(!r)return;let e=l.current;l.current=r.current,e!==l.current&&s(l.current)});let u=a.placementState&&Jc(a.placementState),d=u?.[0],f=u?.[1];return r?null:(0,B.jsx)(pr.div,{"data-radix-popper-side":d,"data-radix-popper-align":f,...i,ref:c})});Rc.displayName=Lc;var zc=`PopperContent`,[Bc,Vc]=Mc(zc),Hc=v.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=Fc(zc,n),[_,y]=v.useState(null),b=Zn(t,y),[x,S]=v.useState(null),C=ho(x),w=C?.width??0,T=C?.height??0,E=r+(a===`center`?``:`-`+a),D=typeof u==`number`?u:{top:0,right:0,bottom:0,left:0,...u},O=Array.isArray(l)?l:[l],k=O.length>0,A={padding:D,boundary:O.filter(Kc),altBoundary:k},{refs:j,floatingStyles:M,placement:N,isPositioned:P,middlewareData:F}=yc({strategy:`fixed`,placement:E,whileElementsMounted:(...e)=>ac(...e,{animationFrame:p===`always`}),elements:{reference:g.anchor},middleware:[xc({mainAxis:i+T,alignmentAxis:o}),c&&Sc({mainAxis:!0,crossAxis:!1,limiter:d===`partial`?Cc():void 0,...A}),c&&wc({...A}),Tc({...A,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`)}}),x&&Dc({element:x,padding:s}),qc({arrowWidth:w,arrowHeight:T}),f&&Ec({strategy:`referenceHidden`,...A,boundary:k?A.boundary:void 0})]}),I=g.setPlacementState;Sr(()=>(I(N),()=>{I(void 0)}),[N,I]);let[L,ee]=Jc(N),te=zr(m);Sr(()=>{P&&te?.()},[P,te]);let ne=F.arrow?.x,re=F.arrow?.y,ie=F.arrow?.centerOffset!==0,[R,ae]=v.useState();return Sr(()=>{_&&ae(window.getComputedStyle(_).zIndex)},[_]),(0,B.jsx)(`div`,{ref:j.setFloating,"data-radix-popper-content-wrapper":``,style:{...M,transform:P?M.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:R,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,B.jsx)(Bc,{scope:n,placedSide:L,placedAlign:ee,onArrowChange:S,arrowX:ne,arrowY:re,shouldHideArrow:ie,children:(0,B.jsx)(pr.div,{"data-side":L,"data-align":ee,...h,ref:b,style:{...h.style,animation:P?void 0:`none`}})})})});Hc.displayName=zc;var Uc=`PopperArrow`,Wc={top:`bottom`,right:`left`,bottom:`top`,left:`right`},Gc=v.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=Vc(Uc,n),a=Wc[i.placedSide];return(0,B.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,B.jsx)(Ac,{...r,ref:t,style:{...r.style,display:`block`}})})});Gc.displayName=Uc;function Kc(e){return e!==null}var qc=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]=Jc(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 Jc(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Yc=Ic,Xc=Rc,Zc=Hc,Qc=Gc,$c=`Label`,el=v.forwardRef((e,t)=>(0,B.jsx)(pr.label,{...e,ref:t,onMouseDown:t=>{t.target.closest(`button, input, select, textarea`)||(e.onMouseDown?.(t),!t.defaultPrevented&&t.detail>1&&t.preventDefault())}}));el.displayName=$c;var tl=el;function nl(e,[t,n]){return Math.min(n,Math.max(t,e))}var rl=[` `,`Enter`,`ArrowUp`,`ArrowDown`],il=[` `,`Enter`],al=`Select`,[ol,sl,cl]=xr(al),[ll,ul]=yr(al,[cl,Nc]),dl=Nc(),[fl,pl]=ll(al),[ml,hl]=ll(al),gl=`SelectProvider`;function _l(e){let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m,internal_do_not_use_render:h}=e,g=dl(t),[_,y]=v.useState(null),[b,x]=v.useState(null),[S,C]=v.useState(!1),w=Rr(l),[T,E]=wr({prop:r,defaultProp:i??!1,onChange:a,caller:al}),[D,O]=wr({prop:o,defaultProp:s,onChange:c,caller:al}),k=v.useRef(null),A=v.useRef(D);v.useEffect(()=>{let e=m?_?.ownerDocument.getElementById(m):_?.form;if(e instanceof HTMLFormElement){let t=()=>O(A.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[m,_,O]);let j=!_||!!m||!!_.closest(`form`),[M,N]=v.useState(new Set),P=Ir(),F=Array.from(M).map(e=>e.props.value).join(`;`),I=v.useCallback(e=>{N(t=>new Set(t).add(e))},[]),L=v.useCallback(e=>{N(t=>{let n=new Set(t);return n.delete(e),n})},[]),ee={required:p,trigger:_,onTriggerChange:y,valueNode:b,onValueNodeChange:x,valueNodeHasChildren:S,onValueNodeHasChildrenChange:C,contentId:P,value:D,onValueChange:O,open:T,onOpenChange:E,dir:w,triggerPointerDownPosRef:k,disabled:f,name:u,autoComplete:d,form:m,nativeOptions:M,nativeSelectKey:F,isFormControl:j};return(0,B.jsx)(Yc,{...g,children:(0,B.jsx)(fl,{scope:t,...ee,children:(0,B.jsx)(ol.Provider,{scope:t,children:(0,B.jsx)(ml,{scope:t,onNativeOptionAdd:I,onNativeOptionRemove:L,children:mu(h)?h(ee):n})})})})}_l.displayName=gl;var vl=e=>{let{__scopeSelect:t,children:n,...r}=e;return(0,B.jsx)(_l,{__scopeSelect:t,...r,internal_do_not_use_render:({isFormControl:e})=>(0,B.jsxs)(B.Fragment,{children:[n,e?(0,B.jsx)(pu,{__scopeSelect:t}):null]})})};vl.displayName=al;var yl=`SelectTrigger`,bl=v.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=dl(n),o=pl(yl,n),s=o.disabled||r,c=Zn(t,o.onTriggerChange),l=sl(n),u=v.useRef(`touch`),[d,f,p]=gu(e=>{let t=l().filter(e=>!e.disabled),n=_u(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),m=e=>{s||(o.onOpenChange(!0),p()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,B.jsx)(Xc,{asChild:!0,...a,children:(0,B.jsx)(pr.button,{type:`button`,role:`combobox`,"aria-controls":o.open?o.contentId:void 0,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":hu(o.value)?``:void 0,...i,ref:c,onClick:V(i.onClick,e=>{e.currentTarget.focus(),u.current!==`mouse`&&m(e)}),onPointerDown:V(i.onPointerDown,e=>{u.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(m(e),e.preventDefault())}),onKeyDown:V(i.onKeyDown,e=>{let t=d.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&f(e.key),!(t&&e.key===` `)&&rl.includes(e.key)&&(m(),e.preventDefault())})})})});bl.displayName=yl;var xl=`SelectValue`,Sl=v.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=pl(xl,n),{onValueNodeHasChildrenChange:l}=c,u=a!==void 0,d=Zn(t,c.onValueNodeChange);Sr(()=>{l(u)},[l,u]);let f=hu(c.value);return(0,B.jsx)(pr.span,{...s,asChild:!f&&s.asChild,ref:d,style:{pointerEvents:`none`},children:(0,B.jsx)(v.Fragment,{children:f?o:a},f?`placeholder`:`value`)})});Sl.displayName=xl;var Cl=`SelectIcon`,wl=v.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,B.jsx)(pr.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});wl.displayName=Cl;var Tl=`SelectPortal`,[El,Dl]=ll(Tl,{forceMount:void 0}),Ol=e=>{let{__scopeSelect:t,forceMount:n,...r}=e;return(0,B.jsx)(El,{scope:e.__scopeSelect,forceMount:n,children:(0,B.jsx)(vi,{asChild:!0,...r})})};Ol.displayName=Tl;var kl=`SelectContent`,Al=v.forwardRef((e,t)=>{let n=Dl(kl,e.__scopeSelect),{forceMount:r=n.forceMount,...i}=e,a=pl(kl,e.__scopeSelect),[o,s]=v.useState();return Sr(()=>{s(new DocumentFragment)},[]),(0,B.jsx)(Or,{present:r||a.open,children:({present:e})=>e?(0,B.jsx)(Ll,{...i,ref:t}):(0,B.jsx)(jl,{...i,fragment:o})})});Al.displayName=kl;var jl=v.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,fragment:i}=e;return i?y.createPortal((0,B.jsx)(Nl,{scope:n,children:(0,B.jsx)(ol.Slot,{scope:n,children:(0,B.jsx)(`div`,{ref:t,children:r})})}),i):null});jl.displayName=`SelectContentFragment`;var Ml=10,[Nl,Pl]=ll(kl),Fl=`SelectContentImpl`,Il=Qn(`SelectContent.RemoveScroll`),Ll=v.forwardRef((e,t)=>{let{__scopeSelect:n}=e,{position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:a,onPointerDownOutside:o,side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g,..._}=e,y=pl(kl,n),[b,x]=v.useState(null),[S,C]=v.useState(null),w=Zn(t,x),[T,E]=v.useState(null),[D,O]=v.useState(null),k=sl(n),[A,j]=v.useState(!1),M=v.useRef(!1);v.useEffect(()=>{if(b)return za(b)},[b]),xi();let N=v.useCallback(e=>{let[t,...n]=k().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&S&&(S.scrollTop=0),n===r&&S&&(S.scrollTop=S.scrollHeight),n?.focus(),document.activeElement!==i))return},[k,S]),P=v.useCallback(()=>N([T,b]),[N,T,b]);v.useEffect(()=>{A&&P()},[A,P]);let{onOpenChange:F,triggerPointerDownPosRef:I}=y;v.useEffect(()=>{if(b){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():n.composedPath().includes(b)||F(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[b,F,I]),v.useEffect(()=>{let e=()=>F(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[F]);let[L,ee]=gu(e=>{let t=k().filter(e=>!e.disabled),n=_u(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current?.focus())}),te=v.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&(E(e),r&&(M.current=!0))},[y.value]),ne=v.useCallback(()=>b?.focus(),[b]),re=v.useCallback((e,t,n)=>{let r=!M.current&&!n;(y.value!==void 0&&y.value===t||r)&&O(e)},[y.value]),ie=r===`popper`?W:zl,R=ie===W?{side:s,sideOffset:c,align:l,alignOffset:u,arrowPadding:d,collisionBoundary:f,collisionPadding:p,sticky:m,hideWhenDetached:h,avoidCollisions:g}:{};return(0,B.jsx)(Nl,{scope:n,content:b,viewport:S,onViewportChange:C,itemRefCallback:te,selectedItem:T,onItemLeave:ne,itemTextRefCallback:re,focusSelectedItem:P,selectedItemText:D,position:r,isPositioned:A,searchRef:L,children:(0,B.jsx)(Aa,{as:Il,allowPinchZoom:!0,children:(0,B.jsx)(ai,{asChild:!0,trapped:y.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:V(i,e=>{y.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,B.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>y.onOpenChange(!1),children:(0,B.jsx)(ie,{role:`listbox`,id:y.contentId,"data-state":y.open?`open`:`closed`,dir:y.dir,onContextMenu:e=>e.preventDefault(),..._,...R,onPlaced:()=>j(!0),ref:w,style:{display:`flex`,flexDirection:`column`,outline:`none`,..._.style},onKeyDown:V(_.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&ee(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=k().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>N(t)),e.preventDefault()}})})})})})})});Ll.displayName=Fl;var Rl=`SelectItemAlignedPosition`,zl=v.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=pl(kl,n),o=Pl(kl,n),[s,c]=v.useState(null),[l,u]=v.useState(null),d=Zn(t,u),f=sl(n),p=v.useRef(!1),m=v.useRef(!0),{viewport:h,selectedItem:g,selectedItemText:_,focusSelectedItem:y}=o,b=v.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&h&&g&&_){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=_.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Ml,d=nl(a,[Ml,Math.max(Ml,u-l)]);s.style.minWidth=c+`px`,s.style.left=d+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-Ml,d=nl(a,[Ml,Math.max(Ml,u-l)]);s.style.minWidth=c+`px`,s.style.right=d+`px`}let o=f(),c=window.innerHeight-Ml*2,u=h.scrollHeight,d=window.getComputedStyle(l),m=parseInt(d.borderTopWidth,10),v=parseInt(d.paddingTop,10),y=parseInt(d.borderBottomWidth,10),b=parseInt(d.paddingBottom,10),x=m+v+u+b+y,S=Math.min(g.offsetHeight*5,x),C=window.getComputedStyle(h),w=parseInt(C.paddingTop,10),T=parseInt(C.paddingBottom,10),E=e.top+e.height/2-Ml,D=c-E,O=g.offsetHeight/2,k=g.offsetTop+O,A=m+v+k,j=x-A;if(A<=E){let e=o.length>0&&g===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-h.offsetTop-h.offsetHeight,n=A+Math.max(D,O+(e?T:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&g===o[0].ref.current;s.style.top=`0px`;let t=Math.max(E,m+h.offsetTop+(e?w:0)+O)+j;s.style.height=t+`px`,h.scrollTop=A-E+h.offsetTop}s.style.margin=`${Ml}px 0`,s.style.minHeight=S+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>p.current=!0)}},[f,a.trigger,a.valueNode,s,l,h,g,_,a.dir,r]);Sr(()=>b(),[b]);let[x,S]=v.useState();return Sr(()=>{l&&S(window.getComputedStyle(l).zIndex)},[l]),(0,B.jsx)(Vl,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:p,onScrollButtonChange:v.useCallback(e=>{e&&m.current===!0&&(b(),y?.(),m.current=!1)},[b,y]),children:(0,B.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:x},children:(0,B.jsx)(pr.div,{...i,ref:d,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});zl.displayName=Rl;var Bl=`SelectPopperPosition`,W=v.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=Ml,...a}=e,o=dl(n);return(0,B.jsx)(Zc,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});W.displayName=Bl;var[Vl,G]=ll(kl,{}),K=`SelectViewport`,Hl=v.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=Pl(K,n),o=G(K,n),s=Zn(t,a.onViewportChange),c=v.useRef(0);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:r}),(0,B.jsx)(ol.Slot,{scope:n,children:(0,B.jsx)(pr.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:V(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(c.current-t.scrollTop);if(e>0){let r=window.innerHeight-Ml*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}c.current=t.scrollTop})})})]})});Hl.displayName=K;var Ul=`SelectGroup`,[Wl,Gl]=ll(Ul),Kl=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Ir();return(0,B.jsx)(Wl,{scope:n,id:i,children:(0,B.jsx)(pr.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Kl.displayName=Ul;var ql=`SelectLabel`,Jl=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Gl(ql,n);return(0,B.jsx)(pr.div,{id:i.id,...r,ref:t})});Jl.displayName=ql;var Yl=`SelectItem`,[Xl,Zl]=ll(Yl),Ql=v.forwardRef((e,t)=>{let{__scopeSelect:n,value:r,disabled:i=!1,textValue:a,...o}=e,s=pl(Yl,n),c=Pl(Yl,n),l=s.value===r,[u,d]=v.useState(a??``),[f,p]=v.useState(!1),m=Zn(t,zr(e=>c.itemRefCallback?.(e,r,i))),h=Ir(),g=v.useRef(`touch`),_=()=>{i||(s.onValueChange(r),s.onOpenChange(!1))};return(0,B.jsx)(Xl,{scope:n,value:r,disabled:i,textId:h,isSelected:l,onItemTextChange:v.useCallback(e=>{d(t=>t||(e?.textContent??``).trim())},[]),children:(0,B.jsx)(ol.ItemSlot,{scope:n,value:r,disabled:i,textValue:u,children:(0,B.jsx)(pr.div,{role:`option`,"aria-labelledby":h,"data-highlighted":f?``:void 0,"aria-selected":l&&f,"data-state":l?`checked`:`unchecked`,"aria-disabled":i||void 0,"data-disabled":i?``:void 0,tabIndex:i?void 0:-1,...o,ref:m,onFocus:V(o.onFocus,()=>p(!0)),onBlur:V(o.onBlur,()=>p(!1)),onClick:V(o.onClick,()=>{g.current!==`mouse`&&_()}),onPointerUp:V(o.onPointerUp,()=>{g.current===`mouse`&&_()}),onPointerDown:V(o.onPointerDown,e=>{g.current=e.pointerType}),onPointerMove:V(o.onPointerMove,e=>{g.current=e.pointerType,i?c.onItemLeave?.():g.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:V(o.onPointerLeave,e=>{e.currentTarget===document.activeElement&&c.onItemLeave?.()}),onKeyDown:V(o.onKeyDown,e=>{i||e.target!==e.currentTarget||c.searchRef?.current!==``&&e.key===` `||(il.includes(e.key)&&_(),e.key===` `&&e.preventDefault())})})})})});Ql.displayName=Yl;var $l=`SelectItemText`,eu=v.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=pl($l,n),s=Pl($l,n),c=Zl($l,n),l=hl($l,n),[u,d]=v.useState(null),f=zr(e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),p=Zn(t,d,c.onItemTextChange,f),m=u?.textContent,h=v.useMemo(()=>(0,B.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return Sr(()=>(g(h),()=>_(h)),[g,_,h]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(pr.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren&&!hu(o.value)?y.createPortal(a.children,o.valueNode):null]})});eu.displayName=$l;var tu=`SelectItemIndicator`,nu=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Zl(tu,n).isSelected?(0,B.jsx)(pr.span,{"aria-hidden":!0,...r,ref:t}):null});nu.displayName=tu;var ru=`SelectScrollUpButton`,iu=v.forwardRef((e,t)=>{let n=Pl(ru,e.__scopeSelect),r=G(ru,e.__scopeSelect),[i,a]=v.useState(!1),o=Zn(t,r.onScrollButtonChange);return Sr(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollTop>0;a(e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(su,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});iu.displayName=ru;var au=`SelectScrollDownButton`,ou=v.forwardRef((e,t)=>{let n=Pl(au,e.__scopeSelect),r=G(au,e.__scopeSelect),[i,a]=v.useState(!1),o=Zn(t,r.onScrollButtonChange);return Sr(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight,n=Math.ceil(t.scrollTop)<e;a(n)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,B.jsx)(su,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});ou.displayName=au;var su=v.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=Pl(`SelectScrollButton`,n),o=v.useRef(null),s=sl(n),c=v.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return v.useEffect(()=>()=>c(),[c]),Sr(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,B.jsx)(pr.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:V(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:V(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:V(i.onPointerLeave,()=>{c()})})}),cu=`SelectSeparator`,lu=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,B.jsx)(pr.div,{"aria-hidden":!0,...r,ref:t})});lu.displayName=cu;var uu=`SelectArrow`,du=v.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=dl(n);return Pl(uu,n).position===`popper`?(0,B.jsx)(Qc,{...i,...r,ref:t}):null});du.displayName=uu;var fu=`SelectBubbleInput`,pu=v.forwardRef(({__scopeSelect:e,...t},n)=>{let r=pl(fu,e),{value:i,onValueChange:a,required:o,disabled:s,name:c,autoComplete:l,form:u}=r,{nativeOptions:d,nativeSelectKey:f}=r,p=v.useRef(null),m=Zn(n,p),h=i??``,g=mo(h),_=Array.from(d).some(e=>(e.props.value??``)===``);return v.useEffect(()=>{let e=p.current;if(!e)return;let t=window.HTMLSelectElement.prototype,n=Object.getOwnPropertyDescriptor(t,`value`).set;if(g!==h&&n){let t=new Event(`change`,{bubbles:!0});n.call(e,h),e.dispatchEvent(t)}},[g,h]),(0,B.jsxs)(pr.select,{"aria-hidden":!0,required:o,tabIndex:-1,name:c,autoComplete:l,disabled:s,form:u,onChange:e=>a(e.target.value),...t,style:{...hr,...t.style},ref:m,defaultValue:h,children:[hu(i)&&!_?(0,B.jsx)(`option`,{value:``}):null,Array.from(d)]},f)});pu.displayName=fu;function mu(e){return typeof e==`function`}function hu(e){return e===``||e===void 0}function gu(e){let t=zr(e),n=v.useRef(``),r=v.useRef(0),i=v.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=v.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return v.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function _u(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=vu(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function vu(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var[yu,bu]=yr(`Tooltip`,[Nc]),xu=Nc(),Su=`TooltipProvider`,Cu=700,wu=`tooltip.open`,[Tu,Eu]=yu(Su),Du=e=>{let{__scopeTooltip:t,delayDuration:n=Cu,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=v.useRef(!0),s=v.useRef(!1),c=v.useRef(0);return v.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,B.jsx)(Tu,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:v.useCallback(()=>{r<=0||(window.clearTimeout(c.current),o.current=!1)},[r]),onClose:v.useCallback(()=>{r<=0||(window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r))},[r]),isPointerInTransitRef:s,onPointerInTransitChange:v.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Du.displayName=Su;var Ou=`Tooltip`,[ku,Au]=yu(Ou),ju=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=Eu(Ou,e.__scopeTooltip),l=xu(t),[u,d]=v.useState(null),f=Ir(),p=v.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,g=v.useRef(!1),[_,y]=wr({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(wu))):c.onClose(),a?.(e)},caller:Ou}),b=v.useMemo(()=>_?g.current?`delayed-open`:`instant-open`:`closed`,[_]),x=v.useCallback(()=>{window.clearTimeout(p.current),p.current=0,g.current=!1,y(!0)},[y]),S=v.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=v.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{g.current=!0,y(!0),p.current=0},h)},[h,y]);return v.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,B.jsx)(Yc,{...l,children:(0,B.jsx)(ku,{scope:t,contentId:f,open:_,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:v.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:v.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};ju.displayName=Ou;var Mu=`TooltipTrigger`,Nu=v.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Au(Mu,n),a=Eu(Mu,n),o=xu(n),s=Zn(t,v.useRef(null),i.onTriggerChange),c=v.useRef(!1),l=v.useRef(!1),u=v.useCallback(()=>c.current=!1,[]);return v.useEffect(()=>()=>document.removeEventListener(`pointerup`,u),[u]),(0,B.jsx)(Xc,{asChild:!0,...o,children:(0,B.jsx)(pr.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:V(e.onPointerMove,e=>{e.pointerType!==`touch`&&!l.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),l.current=!0)}),onPointerLeave:V(e.onPointerLeave,()=>{i.onTriggerLeave(),l.current=!1}),onPointerDown:V(e.onPointerDown,()=>{i.open&&i.onClose(),c.current=!0,document.addEventListener(`pointerup`,u,{once:!0})}),onFocus:V(e.onFocus,()=>{c.current||i.onOpen()}),onBlur:V(e.onBlur,i.onClose),onClick:V(e.onClick,i.onClose)})})});Nu.displayName=Mu;var Pu=`TooltipPortal`,[Fu,Iu]=yu(Pu,{forceMount:void 0}),Lu=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Au(Pu,t);return(0,B.jsx)(Fu,{scope:t,forceMount:n,children:(0,B.jsx)(Or,{present:n||a.open,children:(0,B.jsx)(vi,{asChild:!0,container:i,children:r})})})};Lu.displayName=Pu;var Ru=`TooltipContent`,zu=v.forwardRef((e,t)=>{let n=Iu(Ru,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Au(Ru,e.__scopeTooltip);return(0,B.jsx)(Or,{present:r||o.open,children:o.disableHoverableContent?(0,B.jsx)(Wu,{side:i,...a,ref:t}):(0,B.jsx)(Bu,{side:i,...a,ref:t})})}),Bu=v.forwardRef((e,t)=>{let n=Au(Ru,e.__scopeTooltip),r=Eu(Ru,e.__scopeTooltip),i=v.useRef(null),a=Zn(t,i),[o,s]=v.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=v.useCallback(()=>{s(null),d(!1)},[d]),p=v.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=Ju(r,qu(r,n.getBoundingClientRect())),a=Yu(t.getBoundingClientRect()),o=Zu([...i,...a]);s(o),d(!0)},[d]);return v.useEffect(()=>()=>f(),[f]),v.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]),v.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=!Xu(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,B.jsx)(Wu,{...e,ref:a})}),[Vu,Hu]=yu(Ou,{isInside:!1}),Uu=tr(`TooltipContent`),Wu=v.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Au(Ru,n),l=xu(n),{onClose:u}=c;return v.useEffect(()=>(document.addEventListener(wu,u),()=>document.removeEventListener(wu,u)),[u]),v.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,B.jsx)(Kr,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,B.jsxs)(Zc,{"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,B.jsx)(Uu,{children:r}),(0,B.jsx)(Vu,{scope:n,isInside:!0,children:(0,B.jsx)(vr,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});zu.displayName=Ru;var Gu=`TooltipArrow`,Ku=v.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=xu(n);return Hu(Gu,n).isInside?null:(0,B.jsx)(Qc,{...i,...r,ref:t})});Ku.displayName=Gu;function qu(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 Ju(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 Yu(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 Xu(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 Zu(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)),Qu(t)}function Qu(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 $u=Du;function ed(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=ed(e[t]))&&(r&&(r+=` `),r+=n)}else for(n in e)e[n]&&(r&&(r+=` `),r+=n);return r}function td(){for(var e,t,n=0,r=``,i=arguments.length;n<i;n++)(e=arguments[n])&&(t=ed(e))&&(r&&(r+=` `),r+=t);return r}var nd=`-`,rd=e=>{let t=sd(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:e=>{let n=e.split(nd);return n[0]===``&&n.length!==1&&n.shift(),id(n,t)||od(e)},getConflictingClassGroupIds:(e,t)=>{let i=n[e]||[];return t&&r[e]?[...i,...r[e]]:i}}},id=(e,t)=>{if(e.length===0)return t.classGroupId;let n=e[0],r=t.nextPart.get(n),i=r?id(e.slice(1),r):void 0;if(i)return i;if(t.validators.length===0)return;let a=e.join(nd);return t.validators.find(({validator:e})=>e(a))?.classGroupId},ad=/^\[(.+)\]$/,od=e=>{if(ad.test(e)){let t=ad.exec(e)[1],n=t?.substring(0,t.indexOf(`:`));if(n)return`arbitrary..`+n}},sd=e=>{let{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return dd(Object.entries(e.classGroups),n).forEach(([e,n])=>{cd(n,r,e,t)}),r},cd=(e,t,n,r)=>{e.forEach(e=>{if(typeof e==`string`){let r=e===``?t:ld(t,e);r.classGroupId=n;return}if(typeof e==`function`){if(ud(e)){cd(e(r),t,n,r);return}t.validators.push({validator:e,classGroupId:n});return}Object.entries(e).forEach(([e,i])=>{cd(i,ld(t,e),n,r)})})},ld=(e,t)=>{let n=e;return t.split(nd).forEach(e=>{n.nextPart.has(e)||n.nextPart.set(e,{nextPart:new Map,validators:[]}),n=n.nextPart.get(e)}),n},ud=e=>e.isThemeGetter,dd=(e,t)=>t?e.map(([e,n])=>[e,n.map(e=>typeof e==`string`?t+e:typeof e==`object`?Object.fromEntries(Object.entries(e).map(([e,n])=>[t+e,n])):e)]):e,fd=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,n=new Map,r=new Map,i=(i,a)=>{n.set(i,a),t++,t>e&&(t=0,r=n,n=new Map)};return{get(e){let t=n.get(e);if(t!==void 0)return t;if((t=r.get(e))!==void 0)return i(e,t),t},set(e,t){n.has(e)?n.set(e,t):i(e,t)}}},pd=`!`,md=e=>{let{separator:t,experimentalParseClassName:n}=e,r=t.length===1,i=t[0],a=t.length,o=e=>{let n=[],o=0,s=0,c;for(let l=0;l<e.length;l++){let u=e[l];if(o===0){if(u===i&&(r||e.slice(l,l+a)===t)){n.push(e.slice(s,l)),s=l+a;continue}if(u===`/`){c=l;continue}}u===`[`?o++:u===`]`&&o--}let l=n.length===0?e:e.substring(s),u=l.startsWith(pd);return{modifiers:n,hasImportantModifier:u,baseClassName:u?l.substring(1):l,maybePostfixModifierPosition:c&&c>s?c-s:void 0}};return n?e=>n({className:e,parseClassName:o}):o},hd=e=>{if(e.length<=1)return e;let t=[],n=[];return e.forEach(e=>{e[0]===`[`?(t.push(...n.sort(),e),n=[]):n.push(e)}),t.push(...n.sort()),t},gd=e=>({cache:fd(e.cacheSize),parseClassName:md(e),...rd(e)}),_d=/\s+/,vd=(e,t)=>{let{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:i}=t,a=[],o=e.trim().split(_d),s=``;for(let e=o.length-1;e>=0;--e){let t=o[e],{modifiers:c,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:d}=n(t),f=!!d,p=r(f?u.substring(0,d):u);if(!p){if(!f){s=t+(s.length>0?` `+s:s);continue}if(p=r(u),!p){s=t+(s.length>0?` `+s:s);continue}f=!1}let m=hd(c).join(`:`),h=l?m+pd:m,g=h+p;if(a.includes(g))continue;a.push(g);let _=i(p,f);for(let e=0;e<_.length;++e){let t=_[e];a.push(h+t)}s=t+(s.length>0?` `+s:s)}return s};function yd(){let e=0,t,n,r=``;for(;e<arguments.length;)(t=arguments[e++])&&(n=bd(t))&&(r&&(r+=` `),r+=n);return r}var bd=e=>{if(typeof e==`string`)return e;let t,n=``;for(let r=0;r<e.length;r++)e[r]&&(t=bd(e[r]))&&(n&&(n+=` `),n+=t);return n};function xd(e,...t){let n,r,i,a=o;function o(o){return n=gd(t.reduce((e,t)=>t(e),e())),r=n.cache.get,i=n.cache.set,a=s,s(o)}function s(e){let t=r(e);if(t)return t;let a=vd(e,n);return i(e,a),a}return function(){return a(yd.apply(null,arguments))}}var Sd=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},Cd=/^\[(?:([a-z-]+):)?(.+)\]$/i,wd=/^\d+\/\d+$/,q=new Set([`px`,`full`,`screen`]),Td=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Ed=/\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$/,Dd=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Od=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,kd=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Ad=e=>Md(e)||q.has(e)||wd.test(e),jd=e=>Wd(e,`length`,Gd),Md=e=>!!e&&!Number.isNaN(Number(e)),Nd=e=>Wd(e,`number`,Md),Pd=e=>!!e&&Number.isInteger(Number(e)),Fd=e=>e.endsWith(`%`)&&Md(e.slice(0,-1)),J=e=>Cd.test(e),Id=e=>Td.test(e),Ld=new Set([`length`,`size`,`percentage`]),Rd=e=>Wd(e,Ld,Kd),zd=e=>Wd(e,`position`,Kd),Bd=new Set([`image`,`url`]),Vd=e=>Wd(e,Bd,Jd),Hd=e=>Wd(e,``,qd),Ud=()=>!0,Wd=(e,t,n)=>{let r=Cd.exec(e);return r?r[1]?typeof t==`string`?r[1]===t:t.has(r[1]):n(r[2]):!1},Gd=e=>Ed.test(e)&&!Dd.test(e),Kd=()=>!1,qd=e=>Od.test(e),Jd=e=>kd.test(e),Yd=xd(()=>{let e=Sd(`colors`),t=Sd(`spacing`),n=Sd(`blur`),r=Sd(`brightness`),i=Sd(`borderColor`),a=Sd(`borderRadius`),o=Sd(`borderSpacing`),s=Sd(`borderWidth`),c=Sd(`contrast`),l=Sd(`grayscale`),u=Sd(`hueRotate`),d=Sd(`invert`),f=Sd(`gap`),p=Sd(`gradientColorStops`),m=Sd(`gradientColorStopPositions`),h=Sd(`inset`),g=Sd(`margin`),_=Sd(`opacity`),v=Sd(`padding`),y=Sd(`saturate`),b=Sd(`scale`),x=Sd(`sepia`),S=Sd(`skew`),C=Sd(`space`),w=Sd(`translate`),T=()=>[`auto`,`contain`,`none`],E=()=>[`auto`,`hidden`,`clip`,`visible`,`scroll`],D=()=>[`auto`,J,t],O=()=>[J,t],k=()=>[``,Ad,jd],A=()=>[`auto`,Md,J],j=()=>[`bottom`,`center`,`left`,`left-bottom`,`left-top`,`right`,`right-bottom`,`right-top`,`top`],M=()=>[`solid`,`dashed`,`dotted`,`double`,`none`],N=()=>[`normal`,`multiply`,`screen`,`overlay`,`darken`,`lighten`,`color-dodge`,`color-burn`,`hard-light`,`soft-light`,`difference`,`exclusion`,`hue`,`saturation`,`color`,`luminosity`],P=()=>[`start`,`end`,`center`,`between`,`around`,`evenly`,`stretch`],F=()=>[``,`0`,J],I=()=>[`auto`,`avoid`,`all`,`avoid-page`,`page`,`left`,`right`,`column`],L=()=>[Md,J];return{cacheSize:500,separator:`:`,theme:{colors:[Ud],spacing:[Ad,jd],blur:[`none`,``,Id,J],brightness:L(),borderColor:[e],borderRadius:[`none`,``,`full`,Id,J],borderSpacing:O(),borderWidth:k(),contrast:L(),grayscale:F(),hueRotate:L(),invert:F(),gap:O(),gradientColorStops:[e],gradientColorStopPositions:[Fd,jd],inset:D(),margin:D(),opacity:L(),padding:O(),saturate:L(),scale:L(),sepia:F(),skew:L(),space:O(),translate:O()},classGroups:{aspect:[{aspect:[`auto`,`square`,`video`,J]}],container:[`container`],columns:[{columns:[Id]}],"break-after":[{"break-after":I()}],"break-before":[{"break-before":I()}],"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`],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:[...j(),J]}],overflow:[{overflow:E()}],"overflow-x":[{"overflow-x":E()}],"overflow-y":[{"overflow-y":E()}],overscroll:[{overscroll:T()}],"overscroll-x":[{"overscroll-x":T()}],"overscroll-y":[{"overscroll-y":T()}],position:[`static`,`fixed`,`absolute`,`relative`,`sticky`],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:[`visible`,`invisible`,`collapse`],z:[{z:[`auto`,Pd,J]}],basis:[{basis:D()}],"flex-direction":[{flex:[`row`,`row-reverse`,`col`,`col-reverse`]}],"flex-wrap":[{flex:[`wrap`,`wrap-reverse`,`nowrap`]}],flex:[{flex:[`1`,`auto`,`initial`,`none`,J]}],grow:[{grow:F()}],shrink:[{shrink:F()}],order:[{order:[`first`,`last`,`none`,Pd,J]}],"grid-cols":[{"grid-cols":[Ud]}],"col-start-end":[{col:[`auto`,{span:[`full`,Pd,J]},J]}],"col-start":[{"col-start":A()}],"col-end":[{"col-end":A()}],"grid-rows":[{"grid-rows":[Ud]}],"row-start-end":[{row:[`auto`,{span:[Pd,J]},J]}],"row-start":[{"row-start":A()}],"row-end":[{"row-end":A()}],"grid-flow":[{"grid-flow":[`row`,`col`,`dense`,`row-dense`,`col-dense`]}],"auto-cols":[{"auto-cols":[`auto`,`min`,`max`,`fr`,J]}],"auto-rows":[{"auto-rows":[`auto`,`min`,`max`,`fr`,J]}],gap:[{gap:[f]}],"gap-x":[{"gap-x":[f]}],"gap-y":[{"gap-y":[f]}],"justify-content":[{justify:[`normal`,...P()]}],"justify-items":[{"justify-items":[`start`,`end`,`center`,`stretch`]}],"justify-self":[{"justify-self":[`auto`,`start`,`end`,`center`,`stretch`]}],"align-content":[{content:[`normal`,...P(),`baseline`]}],"align-items":[{items:[`start`,`end`,`center`,`baseline`,`stretch`]}],"align-self":[{self:[`auto`,`start`,`end`,`center`,`stretch`,`baseline`]}],"place-content":[{"place-content":[...P(),`baseline`]}],"place-items":[{"place-items":[`start`,`end`,`center`,`baseline`,`stretch`]}],"place-self":[{"place-self":[`auto`,`start`,`end`,`center`,`stretch`]}],p:[{p:[v]}],px:[{px:[v]}],py:[{py:[v]}],ps:[{ps:[v]}],pe:[{pe:[v]}],pt:[{pt:[v]}],pr:[{pr:[v]}],pb:[{pb:[v]}],pl:[{pl:[v]}],m:[{m:[g]}],mx:[{mx:[g]}],my:[{my:[g]}],ms:[{ms:[g]}],me:[{me:[g]}],mt:[{mt:[g]}],mr:[{mr:[g]}],mb:[{mb:[g]}],ml:[{ml:[g]}],"space-x":[{"space-x":[C]}],"space-x-reverse":[`space-x-reverse`],"space-y":[{"space-y":[C]}],"space-y-reverse":[`space-y-reverse`],w:[{w:[`auto`,`min`,`max`,`fit`,`svw`,`lvw`,`dvw`,J,t]}],"min-w":[{"min-w":[J,t,`min`,`max`,`fit`]}],"max-w":[{"max-w":[J,t,`none`,`full`,`min`,`max`,`fit`,`prose`,{screen:[Id]},Id]}],h:[{h:[J,t,`auto`,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"min-h":[{"min-h":[J,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],"max-h":[{"max-h":[J,t,`min`,`max`,`fit`,`svh`,`lvh`,`dvh`]}],size:[{size:[J,t,`auto`,`min`,`max`,`fit`]}],"font-size":[{text:[`base`,Id,jd]}],"font-smoothing":[`antialiased`,`subpixel-antialiased`],"font-style":[`italic`,`not-italic`],"font-weight":[{font:[`thin`,`extralight`,`light`,`normal`,`medium`,`semibold`,`bold`,`extrabold`,`black`,Nd]}],"font-family":[{font:[Ud]}],"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:[`tighter`,`tight`,`normal`,`wide`,`wider`,`widest`,J]}],"line-clamp":[{"line-clamp":[`none`,Md,Nd]}],leading:[{leading:[`none`,`tight`,`snug`,`normal`,`relaxed`,`loose`,Ad,J]}],"list-image":[{"list-image":[`none`,J]}],"list-style-type":[{list:[`none`,`disc`,`decimal`,J]}],"list-style-position":[{list:[`inside`,`outside`]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[_]}],"text-alignment":[{text:[`left`,`center`,`right`,`justify`,`start`,`end`]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[_]}],"text-decoration":[`underline`,`overline`,`line-through`,`no-underline`],"text-decoration-style":[{decoration:[...M(),`wavy`]}],"text-decoration-thickness":[{decoration:[`auto`,`from-font`,Ad,jd]}],"underline-offset":[{"underline-offset":[`auto`,Ad,J]}],"text-decoration-color":[{decoration:[e]}],"text-transform":[`uppercase`,`lowercase`,`capitalize`,`normal-case`],"text-overflow":[`truncate`,`text-ellipsis`,`text-clip`],"text-wrap":[{text:[`wrap`,`nowrap`,`balance`,`pretty`]}],indent:[{indent:O()}],"vertical-align":[{align:[`baseline`,`top`,`middle`,`bottom`,`text-top`,`text-bottom`,`sub`,`super`,J]}],whitespace:[{whitespace:[`normal`,`nowrap`,`pre`,`pre-line`,`pre-wrap`,`break-spaces`]}],break:[{break:[`normal`,`words`,`all`,`keep`]}],hyphens:[{hyphens:[`none`,`manual`,`auto`]}],content:[{content:[`none`,J]}],"bg-attachment":[{bg:[`fixed`,`local`,`scroll`]}],"bg-clip":[{"bg-clip":[`border`,`padding`,`content`,`text`]}],"bg-opacity":[{"bg-opacity":[_]}],"bg-origin":[{"bg-origin":[`border`,`padding`,`content`]}],"bg-position":[{bg:[...j(),zd]}],"bg-repeat":[{bg:[`no-repeat`,{repeat:[``,`x`,`y`,`round`,`space`]}]}],"bg-size":[{bg:[`auto`,`cover`,`contain`,Rd]}],"bg-image":[{bg:[`none`,{"gradient-to":[`t`,`tr`,`r`,`br`,`b`,`bl`,`l`,`tl`]},Vd]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[m]}],"gradient-via-pos":[{via:[m]}],"gradient-to-pos":[{to:[m]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[s]}],"border-w-x":[{"border-x":[s]}],"border-w-y":[{"border-y":[s]}],"border-w-s":[{"border-s":[s]}],"border-w-e":[{"border-e":[s]}],"border-w-t":[{"border-t":[s]}],"border-w-r":[{"border-r":[s]}],"border-w-b":[{"border-b":[s]}],"border-w-l":[{"border-l":[s]}],"border-opacity":[{"border-opacity":[_]}],"border-style":[{border:[...M(),`hidden`]}],"divide-x":[{"divide-x":[s]}],"divide-x-reverse":[`divide-x-reverse`],"divide-y":[{"divide-y":[s]}],"divide-y-reverse":[`divide-y-reverse`],"divide-opacity":[{"divide-opacity":[_]}],"divide-style":[{divide:M()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-s":[{"border-s":[i]}],"border-color-e":[{"border-e":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:[``,...M()]}],"outline-offset":[{"outline-offset":[Ad,J]}],"outline-w":[{outline:[Ad,jd]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:k()}],"ring-w-inset":[`ring-inset`],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[_]}],"ring-offset-w":[{"ring-offset":[Ad,jd]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:[``,`inner`,`none`,Id,Hd]}],"shadow-color":[{shadow:[Ud]}],opacity:[{opacity:[_]}],"mix-blend":[{"mix-blend":[...N(),`plus-lighter`,`plus-darker`]}],"bg-blend":[{"bg-blend":N()}],filter:[{filter:[``,`none`]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":[``,`none`,Id,J]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[d]}],saturate:[{saturate:[y]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":[``,`none`]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[d]}],"backdrop-opacity":[{"backdrop-opacity":[_]}],"backdrop-saturate":[{"backdrop-saturate":[y]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:[`collapse`,`separate`]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:[`auto`,`fixed`]}],caption:[{caption:[`top`,`bottom`]}],transition:[{transition:[`none`,`all`,``,`colors`,`opacity`,`shadow`,`transform`,J]}],duration:[{duration:L()}],ease:[{ease:[`linear`,`in`,`out`,`in-out`,J]}],delay:[{delay:L()}],animate:[{animate:[`none`,`spin`,`ping`,`pulse`,`bounce`,J]}],transform:[{transform:[``,`gpu`,`none`]}],scale:[{scale:[b]}],"scale-x":[{"scale-x":[b]}],"scale-y":[{"scale-y":[b]}],rotate:[{rotate:[Pd,J]}],"translate-x":[{"translate-x":[w]}],"translate-y":[{"translate-y":[w]}],"skew-x":[{"skew-x":[S]}],"skew-y":[{"skew-y":[S]}],"transform-origin":[{origin:[`center`,`top`,`top-right`,`right`,`bottom-right`,`bottom`,`bottom-left`,`left`,`top-left`,J]}],accent:[{accent:[`auto`,e]}],appearance:[{appearance:[`none`,`auto`]}],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`,J]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":[`none`,`auto`]}],resize:[{resize:[`none`,`y`,`x`,``]}],"scroll-behavior":[{scroll:[`auto`,`smooth`]}],"scroll-m":[{"scroll-m":O()}],"scroll-mx":[{"scroll-mx":O()}],"scroll-my":[{"scroll-my":O()}],"scroll-ms":[{"scroll-ms":O()}],"scroll-me":[{"scroll-me":O()}],"scroll-mt":[{"scroll-mt":O()}],"scroll-mr":[{"scroll-mr":O()}],"scroll-mb":[{"scroll-mb":O()}],"scroll-ml":[{"scroll-ml":O()}],"scroll-p":[{"scroll-p":O()}],"scroll-px":[{"scroll-px":O()}],"scroll-py":[{"scroll-py":O()}],"scroll-ps":[{"scroll-ps":O()}],"scroll-pe":[{"scroll-pe":O()}],"scroll-pt":[{"scroll-pt":O()}],"scroll-pr":[{"scroll-pr":O()}],"scroll-pb":[{"scroll-pb":O()}],"scroll-pl":[{"scroll-pl":O()}],"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`,J]}],fill:[{fill:[e,`none`]}],"stroke-w":[{stroke:[Ad,jd,Nd]}],stroke:[{stroke:[e,`none`]}],sr:[`sr-only`,`not-sr-only`],"forced-color-adjust":[{"forced-color-adjust":[`auto`,`none`]}]},conflictingClassGroups:{overflow:[`overflow-x`,`overflow-y`],overscroll:[`overscroll-x`,`overscroll-y`],inset:[`inset-x`,`inset-y`,`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`,`pt`,`pr`,`pb`,`pl`],px:[`pr`,`pl`],py:[`pt`,`pb`],m:[`mx`,`my`,`ms`,`me`,`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-s`,`border-w-e`,`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-s`,`border-color-e`,`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`],"scroll-m":[`scroll-mx`,`scroll-my`,`scroll-ms`,`scroll-me`,`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-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`]}}});function Y(...e){return Yd(td(e))}function Xd({delayDuration:e=0,...t}){return(0,B.jsx)($u,{"data-slot":`tooltip-provider`,delayDuration:e,...t})}var Zd=e=>e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase(),Qd=(...e)=>e.filter((e,t,n)=>!!e&&e.trim()!==``&&n.indexOf(e)===t).join(` `).trim(),$d={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`},ef=(0,v.forwardRef)(({color:e=`currentColor`,size:t=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:i=``,children:a,iconNode:o,...s},c)=>(0,v.createElement)(`svg`,{ref:c,...$d,width:t,height:t,stroke:e,strokeWidth:r?Number(n)*24/Number(t):n,className:Qd(`lucide`,i),...s},[...o.map(([e,t])=>(0,v.createElement)(e,t)),...Array.isArray(a)?a:[a]])),X=(e,t)=>{let n=(0,v.forwardRef)(({className:n,...r},i)=>(0,v.createElement)(ef,{ref:i,iconNode:t,className:Qd(`lucide-${Zd(e)}`,n),...r}));return n.displayName=`${e}`,n},tf=X(`ArrowLeft`,[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]),nf=X(`ArrowRight`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]),rf=X(`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`}]]),af=X(`Check`,[[`path`,{d:`M20 6 9 17l-5-5`,key:`1gmf2c`}]]),of=X(`ChevronDown`,[[`path`,{d:`m6 9 6 6 6-6`,key:`qrunsl`}]]),sf=X(`ChevronLeft`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),cf=X(`ChevronRight`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]),lf=X(`ChevronUp`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),uf=X(`CircleAlert`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`12`,x2:`12`,y1:`8`,y2:`12`,key:`1pkeuh`}],[`line`,{x1:`12`,x2:`12.01`,y1:`16`,y2:`16`,key:`4dfq90`}]]),df=X(`CircleCheck`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),ff=X(`CircleHelp`,[[`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`}]]),pf=X(`CircleSlash`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`line`,{x1:`9`,x2:`15`,y1:`15`,y2:`9`,key:`1dfufj`}]]),mf=X(`CircleX`,[[`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`}]]),hf=X(`Circle`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),gf=X(`Download`,[[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`polyline`,{points:`7 10 12 15 17 10`,key:`2ggqvy`}],[`line`,{x1:`12`,x2:`12`,y1:`15`,y2:`3`,key:`1vk2je`}]]),_f=X(`EllipsisVertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),vf=X(`Flag`,[[`path`,{d:`M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z`,key:`i9b6wo`}],[`line`,{x1:`4`,x2:`4`,y1:`22`,y2:`15`,key:`1cm3nv`}]]),yf=X(`GitBranch`,[[`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`}]]),bf=X(`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`}]]),xf=X(`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`}]]),Sf=X(`Keyboard`,[[`path`,{d:`M10 8h.01`,key:`1r9ogq`}],[`path`,{d:`M12 12h.01`,key:`1mp3jc`}],[`path`,{d:`M14 8h.01`,key:`1primd`}],[`path`,{d:`M16 12h.01`,key:`1l6xoz`}],[`path`,{d:`M18 8h.01`,key:`emo2bl`}],[`path`,{d:`M6 8h.01`,key:`x9i8wu`}],[`path`,{d:`M7 16h10`,key:`wp8him`}],[`path`,{d:`M8 12h.01`,key:`czm47f`}],[`rect`,{width:`20`,height:`16`,x:`2`,y:`4`,rx:`2`,key:`18n3k1`}]]),Cf=X(`LayoutGrid`,[[`rect`,{width:`7`,height:`7`,x:`3`,y:`3`,rx:`1`,key:`1g98yp`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`3`,rx:`1`,key:`6d4xhi`}],[`rect`,{width:`7`,height:`7`,x:`14`,y:`14`,rx:`1`,key:`nxv5o0`}],[`rect`,{width:`7`,height:`7`,x:`3`,y:`14`,rx:`1`,key:`1bb6yr`}]]),wf=X(`LoaderCircle`,[[`path`,{d:`M21 12a9 9 0 1 1-6.219-8.56`,key:`13zald`}]]),Tf=X(`Loader`,[[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m16.2 7.8 2.9-2.9`,key:`r700ao`}],[`path`,{d:`M18 12h4`,key:`wj9ykh`}],[`path`,{d:`m16.2 16.2 2.9 2.9`,key:`1bxg5t`}],[`path`,{d:`M12 18v4`,key:`jadmvz`}],[`path`,{d:`m4.9 19.1 2.9-2.9`,key:`bwix9q`}],[`path`,{d:`M2 12h4`,key:`j09sii`}],[`path`,{d:`m4.9 4.9 2.9 2.9`,key:`giyufr`}]]),Ef=X(`MessagesSquare`,[[`path`,{d:`M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z`,key:`p1xzt8`}],[`path`,{d:`M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1`,key:`1cx29u`}]]),Df=X(`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`}]]),Of=X(`Plus`,[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`M12 5v14`,key:`s699le`}]]),kf=X(`RefreshCw`,[[`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`}]]),Af=X(`Search`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),jf=X(`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`}]]),Mf=X(`ShieldCheck`,[[`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`}]]),Nf=X(`TriangleAlert`,[[`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`}]]),Pf=X(`X`,[[`path`,{d:`M18 6 6 18`,key:`1bl5f8`}],[`path`,{d:`m6 6 12 12`,key:`d8bk6v`}]]);function Ff(){let e=new Map;return{run(t,n){let r=e.get(t);if(r!==void 0)return r;let i=n().finally(()=>{e.get(t)===i&&e.delete(t)});return e.set(t,i),i},get pending(){return e.size}}}var If=Ff(),Lf=`crtr:relay-token`;function Rf(){try{let e=window.localStorage.getItem(Lf);return e!==null&&e!==``?e:void 0}catch{return}}function zf(){let e;try{let t=new URLSearchParams(window.location.search).get(`token`);e=t!==null&&t!==``?t:void 0}catch{e=void 0}if(e!==void 0){try{window.localStorage.setItem(Lf,e)}catch{}return e}return Rf()}var Bf=zf();async function Vf(e,t){try{let n={"content-type":`application/json`};Bf!==void 0&&(n.authorization=`Bearer ${Bf}`);let r=await fetch(`/__crtr/source`,{method:`POST`,headers:n,body:JSON.stringify(e),...t===void 0?{}:{signal:t}});return r.ok?await r.json():{ok:!1,stdout:``,stderr:`bridge ${r.status} ${r.statusText}`}}catch(e){return t?.aborted===!0||e instanceof DOMException&&e.name===`AbortError`?{ok:!1,stdout:``,stderr:`aborted`}:{ok:!1,stdout:``,stderr:e instanceof Error?e.message:String(e)}}}async function Hf(e,t,n){return Vf({kind:`exec`,bin:`crtr`,args:e,...t===void 0?{}:{stdin:t}},n)}var Uf=class extends Error{code;constructor(e,t){super(t),this.name=`CommandError`,this.code=e}};function Wf(e){let t=e.stdout.trim();if(t===``)return null;try{let e=JSON.parse(t);if(e&&typeof e==`object`&&typeof e.error==`string`&&typeof e.message==`string`)return{code:e.error,message:e.message}}catch{}return null}async function Gf(e,t,n){let r=await Hf(e,t,n);if(!r.ok)throw new Uf(`bridge`,r.stderr||`bridge request failed`);let i=Wf(r);if(i!==null)throw new Uf(i.code,i.message);if(r.exitCode!==void 0&&r.exitCode!==0){let t=r.stderr.trim()===``?r.stdout.trim():r.stderr;throw new Uf(`bridge`,t===``?`crtr ${e.join(` `)} failed (${r.exitCode})`:t)}if(r.stdout.trim()!==``)try{return JSON.parse(r.stdout)}catch(e){throw new Uf(`bridge`,e instanceof Error?e.message:String(e))}}function Kf(){return If.run(`canvas:snapshot`,()=>Gf([`canvas`,`snapshot`,`--json`]))}function qf(e){return If.run(`node:inspect:${e}`,()=>Gf([`node`,`inspect`,`show`,e,`--json`]).then(e=>e.node))}function Jf(e){return If.run(`node:snapshot:${e}`,()=>Gf([`node`,`inspect`,`snapshot`,e,`--json`]))}function Yf(e){let t=[`node`,`new`,`--kind`,e.kind];return e.mode&&t.push(`--mode`,e.mode),e.root&&t.push(`--root`),e.cwd?.trim()&&t.push(`--cwd`,e.cwd.trim()),e.name?.trim()&&t.push(`--name`,e.name.trim()),e.model?.trim()&&t.push(`--model`,e.model.trim()),e.parent?.trim()&&t.push(`--parent`,e.parent.trim()),t.push(`--json`),Gf(t,e.prompt)}function Xf(e,t){let n=[`node`,`msg`,`--to`,e];return t.tier?.trim()&&n.push(`--tier`,t.tier.trim()),n.push(`--json`),Gf(n,t.body)}function Zf(e,t={}){let n=[`node`,`lifecycle`,`revive`,e];return t.fresh&&n.push(`--fresh`),n.push(`--json`),Gf(n)}function Qf(e){return Gf([`node`,`lifecycle`,`close`,`--node`,e,`--json`])}async function $f(e,t){let n=await Vf({kind:`file`,path:t});if(!n.ok)throw new Uf(`bridge`,n.stderr||`failed to read ${t}`);return{path:t,content:n.stdout,truncated:!1}}var ep=new Set,tp=!1;function np(){if(tp)return;tp=!0;let e;try{let t=new URL(`/__crtr/events`,window.location.href);Bf!==void 0&&t.searchParams.set(`token`,Bf),e=new EventSource(t.toString())}catch{tp=!1;return}e.onmessage=e=>{let t;try{t=JSON.parse(e.data).kind}catch{return}if(t!==void 0)for(let e of ep)e.kinds.includes(t)&&e.refresh()}}function rp(e,t){let n=(0,v.useRef)(t);n.current=t,(0,v.useEffect)(()=>{np();let t={kinds:e,refresh:()=>n.current()};return ep.add(t),()=>{ep.delete(t)}},[e.join(`,`)])}var ip=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=>(n.add(e),()=>n.delete(e))},o=t=e(r,i,a);return a},ap=(e=>e?ip(e):ip),op=e=>e;function sp(e,t=op){let n=v.useSyncExternalStore(e.subscribe,v.useCallback(()=>t(e.getState()),[e,t]),v.useCallback(()=>t(e.getInitialState()),[e,t]));return v.useDebugValue(n),n}var cp=e=>{let t=ap(e),n=e=>sp(t,e);return Object.assign(n,t),n},lp=(e=>e?cp(e):cp),up=lp(e=>({reachable:!0,setReachable:t=>e({reachable:t})})),dp=1,fp=`crtr.web.roster.v1`;function pp(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function mp(e){return typeof e==`string`}function hp(e){return typeof e==`number`}function gp(e){return pp(e)?mp(e.node_id)&&mp(e.name)&&mp(e.kind)&&(e.mode===`base`||e.mode===`orchestrator`)&&(e.lifecycle===`terminal`||e.lifecycle===`resident`)&&(e.status===`active`||e.status===`idle`||e.status===`done`||e.status===`dead`||e.status===`canceled`)&&mp(e.cwd)&&(e.parent===null||mp(e.parent))&&mp(e.created)&&(e.host_kind===`broker`||e.host_kind===`tmux`)&&typeof e.enterable==`boolean`&&hp(e.attention_count)&&(e.cycles===void 0||hp(e.cycles))&&(e.last_activity===void 0||mp(e.last_activity)):!1}function _p(e){return pp(e)?e.schemaVersion===dp&&mp(e.generatedAt)&&hp(e.cachedAt)&&Array.isArray(e.nodes)&&e.nodes.every(gp):!1}function vp(){try{let e=globalThis.localStorage?.getItem(fp);if(e==null)return null;let t=JSON.parse(e);return _p(t)?t:null}catch{return null}}function yp(e,t){let n={schemaVersion:dp,nodes:e,generatedAt:t,cachedAt:Date.now()};try{globalThis.localStorage?.setItem(fp,JSON.stringify(n))}catch{}}var bp=3e4,xp=new class{state;listeners=new Set;started=!1;timer=null;constructor(){let e=vp();this.state=e?{nodes:e.nodes,generatedAt:e.generatedAt,loading:!1}:{nodes:[],generatedAt:null,loading:!0}}subscribe=e=>(this.ensureStarted(),this.listeners.add(e),()=>{this.listeners.delete(e)});getState=()=>this.state;refetch=()=>{this.load()};ensureStarted(){if(this.started)return;this.started=!0,this.load(),this.timer=setInterval(()=>void this.load(),bp);let e=()=>{document.visibilityState===`visible`&&this.load()};document.addEventListener(`visibilitychange`,e),window.addEventListener(`focus`,e)}setState(e){this.state=e;for(let e of this.listeners)e()}async load(){try{let e=await Kf();this.setState({nodes:e.nodes,generatedAt:e.generated_at,loading:!1}),yp(e.nodes,e.generated_at),up.getState().setReachable(!0)}catch{this.state.loading&&this.setState({...this.state,loading:!1}),up.getState().setReachable(!1)}}};function Sp(){let e=(0,v.useSyncExternalStore)(xp.subscribe,xp.getState);return rp([`nodes`,`inbox`],xp.refetch),e}var Cp=e=>typeof e==`boolean`?`${e}`:e===0?`0`:e,wp=td,Tp=(e,t)=>n=>{if(t?.variants==null)return wp(e,n?.class,n?.className);let{variants:r,defaultVariants:i}=t,a=Object.keys(r).map(e=>{let t=n?.[e],a=i?.[e];if(t===null)return null;let o=Cp(t)||Cp(a);return r[e][o]}),o=n&&Object.entries(n).reduce((e,t)=>{let[n,r]=t;return r===void 0||(e[n]=r),e},{});return wp(e,a,t?.compoundVariants?.reduce((e,t)=>{let{class:n,className:r,...a}=t;return Object.entries(a).every(e=>{let[t,n]=e;return Array.isArray(n)?n.includes({...i,...o}[t]):{...i,...o}[t]===n})?[...e,n,r]:e},[]),n?.class,n?.className)},Ep=Tp(`btn justify-center transition-all outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`primary`,destructive:`danger`,outline:``,secondary:``,ghost:`border-transparent`,link:`border-transparent bg-transparent text-primary underline-offset-4 hover:underline hover:bg-transparent`},size:{default:``,xs:`sm gap-1 text-xs [&_svg:not([class*='size-'])]:size-3`,sm:`sm`,lg:`px-6 py-2.5`,icon:`p-0 size-9`,"icon-xs":`p-0 size-6 [&_svg:not([class*='size-'])]:size-3`,"icon-sm":`p-0 size-8`,"icon-lg":`p-0 size-10`}},defaultVariants:{variant:`default`,size:`default`}});function Z({className:e,variant:t=`default`,size:n=`default`,asChild:r=!1,...i}){return(0,B.jsx)(r?$n:`button`,{"data-slot":`button`,"data-variant":t,"data-size":n,className:Y(Ep({variant:t,size:n,className:e})),...i})}function Dp({...e}){return(0,B.jsx)(Ga,{"data-slot":`dialog`,...e})}function Op({...e}){return(0,B.jsx)(Za,{"data-slot":`dialog-portal`,...e})}function kp({className:e,...t}){return(0,B.jsx)($a,{"data-slot":`dialog-overlay`,className:Y(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Ap({className:e,children:t,showCloseButton:n=!0,...r}){return(0,B.jsxs)(Op,{"data-slot":`dialog-portal`,children:[(0,B.jsx)(kp,{}),(0,B.jsxs)(ro,{"data-slot":`dialog-content`,className:Y(`fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border bg-background p-6 duration-200 outline-none data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 sm:max-w-lg`,e),...r,children:[t,n&&(0,B.jsxs)(fo,{"data-slot":`dialog-close`,className:`absolute top-4 right-4 rounded-xs opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,B.jsx)(Pf,{}),(0,B.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function jp({className:e,...t}){return(0,B.jsx)(`div`,{"data-slot":`dialog-header`,className:Y(`flex flex-col gap-2 text-center sm:text-left`,e),...t})}function Mp({className:e,showCloseButton:t=!1,children:n,...r}){return(0,B.jsxs)(`div`,{"data-slot":`dialog-footer`,className:Y(`flex flex-col-reverse gap-2 sm:flex-row sm:justify-end`,e),...r,children:[n,t&&(0,B.jsx)(fo,{asChild:!0,children:(0,B.jsx)(Z,{variant:`outline`,children:`Close`})})]})}function Np({className:e,...t}){return(0,B.jsx)(co,{"data-slot":`dialog-title`,className:Y(`text-lg leading-none font-semibold`,e),...t})}function Pp({className:e,...t}){return(0,B.jsx)(U,{"data-slot":`dialog-description`,className:Y(`text-sm text-muted-foreground`,e),...t})}function Fp({className:e,type:t,...n}){return(0,B.jsx)(`input`,{type:t,"data-slot":`input`,className:Y(`h-9 w-full min-w-0 rounded-md border border-[var(--line)] bg-[oklch(0_0_0/0.25)] px-3 py-1 text-sm text-[var(--ink)] transition-[color,box-shadow] outline-none selection:bg-primary selection:text-primary-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-[var(--dim)] disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50`,`focus-visible:border-[var(--line2)] focus-visible:ring-[3px] focus-visible:ring-ring/40`,`aria-invalid:border-destructive aria-invalid:ring-destructive/20`,e),...n})}function Ip({className:e,...t}){return(0,B.jsx)(tl,{"data-slot":`label`,className:Y(`flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50`,e),...t})}function Lp({...e}){return(0,B.jsx)(vl,{"data-slot":`select`,...e})}function Rp({...e}){return(0,B.jsx)(Sl,{"data-slot":`select-value`,...e})}function zp({className:e,size:t=`default`,children:n,...r}){return(0,B.jsxs)(bl,{"data-slot":`select-trigger`,"data-size":t,className:Y(`flex w-fit items-center justify-between gap-2 rounded-md border border-[var(--line)] bg-[oklch(0.92_0.008_80/0.02)] px-3 py-2 font-mono text-sm text-[var(--ink2)] whitespace-nowrap transition-[color,box-shadow] outline-none cursor-pointer focus-visible:border-[var(--line2)] focus-visible:ring-[3px] focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[placeholder]:text-[var(--mut)] data-[size=default]:h-9 data-[size=sm]:h-8 *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-[var(--mut)]`,e),...r,children:[n,(0,B.jsx)(wl,{asChild:!0,children:(0,B.jsx)(of,{className:`size-4 opacity-50`})})]})}function Bp({className:e,children:t,position:n=`item-aligned`,align:r=`center`,...i}){return(0,B.jsx)(Ol,{children:(0,B.jsxs)(Al,{"data-slot":`select-content`,className:Y(`relative z-50 max-h-(--radix-select-content-available-height) min-w-[8rem] origin-(--radix-select-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover text-popover-foreground data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,n===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,e),position:n,align:r,...i,children:[(0,B.jsx)(Hp,{}),(0,B.jsx)(Hl,{className:Y(`p-1`,n===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)] scroll-my-1`),children:t}),(0,B.jsx)(Up,{})]})})}function Vp({className:e,children:t,...n}){return(0,B.jsxs)(Ql,{"data-slot":`select-item`,className:Y(`relative flex w-full cursor-default items-center gap-2 rounded-sm py-1.5 pr-8 pl-2 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,B.jsx)(`span`,{"data-slot":`select-item-indicator`,className:`absolute right-2 flex size-3.5 items-center justify-center`,children:(0,B.jsx)(nu,{children:(0,B.jsx)(af,{className:`size-4`})})}),(0,B.jsx)(eu,{children:t})]})}function Hp({className:e,...t}){return(0,B.jsx)(iu,{"data-slot":`select-scroll-up-button`,className:Y(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(lf,{className:`size-4`})})}function Up({className:e,...t}){return(0,B.jsx)(ou,{"data-slot":`select-scroll-down-button`,className:Y(`flex cursor-default items-center justify-center py-1`,e),...t,children:(0,B.jsx)(of,{className:`size-4`})})}function Wp({className:e,...t}){return(0,B.jsx)(`textarea`,{"data-slot":`textarea`,className:Y(`flex field-sizing-content min-h-16 w-full rounded-md border border-[var(--line)] bg-[oklch(0_0_0/0.3)] px-3 py-2 text-sm text-[var(--ink)] transition-[color,box-shadow] outline-none placeholder:text-[var(--dim)] focus-visible:border-[var(--line2)] focus-visible:ring-[3px] focus-visible:ring-ring/40 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20`,e),...t})}var Gp=Tp(`badge w-fit max-w-full overflow-hidden text-[var(--ink2)] whitespace-nowrap [&>svg]:pointer-events-none [&>svg]:size-3`,{variants:{variant:{default:``,secondary:`dead`,destructive:`blocked`,outline:``,ghost:`border-transparent`,link:`border-transparent underline-offset-4 [a&]:hover:underline`}},defaultVariants:{variant:`default`}});function Kp({className:e,variant:t=`default`,asChild:n=!1,...r}){return(0,B.jsx)(n?$n:`span`,{"data-slot":`badge`,"data-variant":t,className:Y(Gp({variant:t}),e),...r})}function qp(e){return e instanceof Uf&&(e.code===`not_found`||e.code===`already_resolved`||e.code===`claimed`)}function Jp(e){let t=e.indexOf(`/.crouter/interactions/`);return t>=0?e.slice(0,t):e}function Yp(e){if(e.trim()===``)return{title:``};let t=e.match(/^\s*#{1,6}\s+(.+?)\s*(?:\n|$)/);return t?{title:t[1],body:e.slice(t[0].length).trim()||void 0}:{title:e.trim(),body:e.trim()}}function Xp(e){switch(e){case`notify`:case`validation`:case`decision`:case`context`:case`error`:return e}throw Error(`Unknown deck kind: ${e}`)}function Zp(e){let{title:t,body:n}=Yp(e.prompt);return{id:e.id,title:t||e.id,body:n,kind:Xp(e.kind),options:e.options.map(e=>({id:e.id,label:e.label,...e.description===void 0?{}:{description:e.description}})),multiSelect:e.multiSelect,allowFreetext:e.allow_freetext}}function Qp(e){return{id:e.id,job_id:e.job_id,kind:Xp(e.kind),title:e.title,blocked_since:e.blocked_since,conversation_id:e.conversation_id,conversation_title:e.conversation_title,asking_node_id:e.asking_node_id,asking_node_name:e.asking_node_name,cwd:Jp(e.dir),interaction_count:e.interaction_count}}function $p(e,t){return{id:e.id,job_id:e.job_id??e.id,kind:Xp(e.kind),title:e.title,blocked_since:e.blocked_since,conversation_id:e.conversation_id,conversation_title:e.conversation_title,asking_node_id:e.asking_node_id,asking_node_name:e.asking_node_name,cwd:t,interaction_count:e.interaction_count,interactions:e.interactions.map(Zp)}}function em(){return If.run(`human:list`,async()=>(await Gf([`human`,`list`,`--json`])).items.map(Qp))}async function tm(e){let t=await Gf([`human`,`deck`,e,`--json`]),n=(await qf(t.asking_node_id)).cwd;return $p(t,n)}async function nm(e,t){let n=JSON.stringify({responses:t.responses}),r=await Gf([`human`,`resolve`,e,`--json`],n);if(r.resolved!==!0)throw new Uf(r.reason===`claimed`?`claimed`:`already_resolved`,r.reason===`claimed`?`That request is already being handled.`:`That request was already handled.`);return{resolved:!0,job_id:r.job_id??e,delivered:r.delivered??!0}}function rm(e){let t=0;for(let n of e)t+=Math.max(0,n.attention_count);return t}function im(){let{nodes:e}=Sp();return rm(e)}function am(){let[e,t]=(0,v.useState)([]),[n,r]=(0,v.useState)(!0),[i,a]=(0,v.useState)(0),o=(0,v.useCallback)(()=>a(e=>e+1),[]);return rp([`inbox`,`nodes`],o),(0,v.useEffect)(()=>{let e=!1;return em().then(n=>{e||(t(n),r(!1))}).catch(()=>{e||r(!1)}),()=>{e=!0}},[i]),{decks:e,loading:n,refetch:o}}function om(e){let{decks:t}=am();return t.filter(t=>t.conversation_id===e)}var sm={notify:{icon:rf,label:`Update`},validation:{icon:Mf,label:`Approval`},decision:{icon:yf,label:`Decision`},context:{icon:ff,label:`Question`},error:{icon:Nf,label:`Problem`}};function cm(e){switch(e){case`notify`:return sm.notify;case`validation`:return sm.validation;case`decision`:return sm.decision;case`context`:return sm.context;case`error`:return sm.error;default:return sm.context}}function lm(e,t=Date.now()){let n=new Date(e).getTime();if(Number.isNaN(n))return``;let r=Math.max(0,Math.round((t-n)/1e3));if(r<60)return`${r}s`;let i=Math.round(r/60);if(i<60)return`${i}m`;let a=Math.round(i/60);return a<24?`${a}h`:`${Math.round(a/24)}d`}var um=1,dm=lp(e=>({toasts:[],push:(t,n=`info`)=>{let r=um++;e(e=>({toasts:[...e.toasts,{id:r,message:t,tone:n}]})),setTimeout(()=>e(e=>({toasts:e.toasts.filter(e=>e.id!==r)})),4e3)},dismiss:t=>e(e=>({toasts:e.toasts.filter(e=>e.id!==t)}))}));function fm(e,t=`info`){dm.getState().push(e,t)}var pm=e=>({"--i":e});async function mm(e,t){let n=(await tm(e)).interactions[0];await nm(e,{responses:[t===`ack`?{id:n.id}:{id:n.id,selectedOptionIds:[(t===`yes`?n.options.find(e=>e.id===`yes`)?.id??n.options[0]?.id:n.options.find(e=>e.id===`no`)?.id??n.options[1]?.id)??t]}]})}function hm(){let{decks:e,loading:t}=am(),n=(0,v.useMemo)(()=>[...e].sort((e,t)=>new Date(t.blocked_since).getTime()-new Date(e.blocked_since).getTime()),[e]);return t||n.length===0?null:(0,B.jsxs)(`section`,{className:`needs rv`,style:pm(3),children:[(0,B.jsxs)(`div`,{className:`needs-head`,children:[(0,B.jsx)(vf,{size:14,className:`flag`,"aria-hidden":!0}),(0,B.jsxs)(`span`,{className:`instlabel`,children:[`Needs you — `,n.length,` blocked`]}),(0,B.jsx)(`div`,{className:`rule`})]}),(0,B.jsx)(`div`,{className:`needs-grid`,children:n.map(e=>(0,B.jsx)(gm,{deck:e},e.id))})]})}function gm({deck:e}){let t=ut(),{refetch:n}=am(),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(null),[s,c]=(0,v.useState)(!1),l=cm(e.kind).label,u=lm(e.blocked_since);e.kind===`decision`&&a===null&&!s&&(async()=>{if(!(e.kind!==`decision`||s||a!==null)){c(!0);try{let t=(await tm(e.job_id)).interactions[0]?.options??[];o(t.length<=3?t:[])}catch(e){qp(e)?(o([]),n()):(console.error(`[needs-you] failed to load decision options:`,e),o([]))}finally{c(!1)}}})();let d=async t=>{if(!r){i(!0);try{await mm(e.job_id,t),fm(`Done — thanks!`,`success`),n()}catch(e){if(qp(e)){fm(e instanceof Error?e.message:`That request was already handled.`),n();return}console.error(`[needs-you] resolve failed:`,e),fm(`Something went wrong — try again.`)}finally{i(!1)}}},f=async t=>{if(!r){i(!0);try{let r=(await tm(e.job_id)).interactions[0];await nm(e.job_id,{responses:[{id:r.id,selectedOptionIds:[t]}]}),fm(`Done — thanks!`,`success`),n()}catch(e){if(qp(e)){fm(e instanceof Error?e.message:`That request was already handled.`),n();return}console.error(`[needs-you] decision option resolve failed:`,e),fm(`Something went wrong — try again.`)}finally{i(!1)}}},p=e.kind===`decision`&&a!==null&&a.length>0;return(0,B.jsxs)(`div`,{className:`deck`,children:[(0,B.jsxs)(`div`,{className:`deck-meta`,children:[(0,B.jsx)(`span`,{className:`deck-kind`,children:l}),(0,B.jsx)(`span`,{className:`from`,children:e.asking_node_name}),(0,B.jsxs)(`span`,{className:`age`,children:[`blocked `,u]})]}),(0,B.jsx)(`p`,{className:`deck-q line-clamp-2`,children:e.title}),(0,B.jsxs)(`div`,{className:`deck-actions`,children:[e.kind===`notify`&&(0,B.jsx)(Z,{type:`button`,variant:`outline`,size:`sm`,disabled:r,onClick:()=>void d(`ack`),children:`Got it`}),e.kind===`validation`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(Z,{type:`button`,size:`sm`,disabled:r,onClick:()=>void d(`yes`),children:`Approve`}),(0,B.jsx)(Z,{type:`button`,variant:`outline`,size:`sm`,disabled:r,onClick:()=>void d(`no`),children:`Reject`})]}),p&&a.map(e=>(0,B.jsx)(Z,{type:`button`,variant:`outline`,size:`sm`,disabled:r,onClick:()=>void f(e.id),children:e.label},e.id)),(0,B.jsxs)(Z,{type:`button`,variant:`ghost`,size:`sm`,disabled:r,onClick:()=>t(`/inbox/${encodeURIComponent(e.job_id)}`),style:{marginLeft:`auto`,color:`var(--dim)`},children:[`open thread `,(0,B.jsx)(nf,{"aria-hidden":!0})]})]})]})}var _m=e=>({"--i":e}),vm=`hosted in a tmux pane — open it in your terminal`;function ym(e){let t=new Map;for(let n of e)t.set(n.node_id,{node:n,children:[]});let n=[];for(let e of t.values()){let r=e.node.parent,i=r?t.get(r):void 0;i?i.children.push(e):n.push(e)}return n}var bm=[`active`,`idle`,`done`,`dead`,`canceled`],xm={query:``,status:`all`,blockedOnly:!1};function Sm(e){return e.query.trim()!==``||e.status!==`all`||e.blockedOnly}function Cm(e,t){if(t.status!==`all`&&e.status!==t.status||t.blockedOnly&&e.attention_count<=0)return!1;let n=t.query.trim().toLowerCase();return!(n&&!`${e.name} ${e.kind} ${e.mode} ${e.cwd} ${e.node_id} ${e.status}`.toLowerCase().includes(n))}function wm(e,t){if(!Sm(t))return e;let n=new Map(e.map(e=>[e.node_id,e])),r=new Set;for(let i of e){if(!Cm(i,t))continue;let e=i;for(;e&&!r.has(e.node_id);)r.add(e.node_id),e=e.parent?n.get(e.parent):void 0}return e.filter(e=>r.has(e.node_id))}var Tm=new Set([`dead`,`canceled`]);function Em(e){return Tm.has(e.node.status)&&e.children.every(Em)}function Dm(e){return 1+e.children.reduce((e,t)=>e+Dm(t),0)}var Om=3,km={active:hf,idle:hf,done:df,dead:pf,canceled:mf};function Am(e,t){return t?uf:km[e]??hf}function jm(e){return e.toLocaleTimeString(`en-GB`,{hour12:!1})}function Mm(){let[e,t]=(0,v.useState)(()=>jm(new Date));return(0,v.useEffect)(()=>{let e=setInterval(()=>t(jm(new Date)),1e3);return()=>clearInterval(e)},[]),e}function Nm(){let{nodes:e}=Sp(),[t,n]=(0,v.useState)(!1),[r,i]=(0,v.useState)(0),[a,o]=(0,v.useState)(xm),s=(0,v.useRef)(null),c=Mm(),l=e.filter(e=>e.status===`active`).length,u=(0,v.useMemo)(()=>ym(wm(e,a)),[e,a]);return(0,v.useEffect)(()=>{let e=e=>{if(e.key!==`/`||e.metaKey||e.ctrlKey||e.altKey)return;let t=document.activeElement;t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLElement&&t.isContentEditable||(e.preventDefault(),s.current?.focus())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,B.jsxs)(`div`,{className:`in relative z-[1] h-full min-h-0 overflow-auto`,style:{padding:`34px 44px 44px`},children:[(0,B.jsxs)(`div`,{className:`rv flex items-baseline gap-4`,style:_m(1),children:[(0,B.jsx)(`h1`,{className:`text-2xl`,style:{fontWeight:420,letterSpacing:`-0.01em`,fontVariationSettings:`"opsz" 60`,color:`var(--ink)`},children:`Canvas`}),(0,B.jsxs)(`span`,{className:`text-sm`,style:{color:`var(--mut)`},children:[e.length,` `,e.length===1?`node`:`nodes`,l>0&&` · ${l} active`]}),(0,B.jsxs)(`div`,{className:`font-inst text-xs flex items-center gap-2`,style:{marginLeft:`auto`,color:`var(--ink2)`,letterSpacing:`0.1em`},children:[(0,B.jsx)(`span`,{style:{width:`8px`,height:`8px`,borderRadius:`50%`,background:`var(--act)`,animation:`pulse 2.4s ease-out infinite`}}),(0,B.jsx)(`span`,{children:c})]})]}),(0,B.jsxs)(`div`,{className:`rv flex items-center gap-2.5`,style:{margin:`20px 0 22px`,..._m(2)},children:[(0,B.jsxs)(`div`,{className:`search`,children:[(0,B.jsx)(Af,{size:14,className:`opacity-70`,"aria-hidden":!0}),(0,B.jsx)(`input`,{ref:s,value:a.query,onChange:e=>o(t=>({...t,query:e.currentTarget.value})),onKeyDown:e=>{e.key===`Escape`&&(o(e=>({...e,query:``})),e.currentTarget.blur())},placeholder:`Search name, kind, mode, cwd, id…`,"aria-label":`Search nodes`,className:`min-w-0 flex-1 border-0 bg-transparent p-0 text-sm outline-none`,style:{color:`var(--ink)`}}),(0,B.jsx)(`span`,{className:`kbd`,children:`/`})]}),(0,B.jsxs)(`label`,{className:`selectish`,children:[(0,B.jsxs)(`select`,{value:a.status,onChange:e=>o(t=>({...t,status:e.currentTarget.value})),"aria-label":`Filter by status`,className:`cursor-pointer appearance-none border-0 bg-transparent text-sm outline-none`,style:{color:`var(--ink2)`},children:[(0,B.jsx)(`option`,{value:`all`,children:`all statuses`}),bm.map(e=>(0,B.jsx)(`option`,{value:e,children:e},e))]}),(0,B.jsx)(`span`,{className:`car`,children:`▾`})]}),(0,B.jsxs)(`label`,{className:`checkish select-none`,children:[(0,B.jsx)(`span`,{className:`box`,style:a.blockedOnly?{background:`var(--blk)`,borderColor:`var(--blk)`}:void 0}),`blocked`,(0,B.jsx)(`input`,{type:`checkbox`,checked:a.blockedOnly,onChange:e=>o(t=>({...t,blockedOnly:e.currentTarget.checked})),className:`sr-only`})]}),(0,B.jsx)(`button`,{type:`button`,className:`btn primary`,style:{marginLeft:`auto`},onClick:()=>{i(e=>e+1),n(!0)},children:`+ Spawn a node`})]}),(0,B.jsx)(hm,{}),(0,B.jsxs)(`div`,{className:`panel rv`,style:{padding:`6px 0`,..._m(4)},children:[(0,B.jsxs)(`div`,{className:`flex items-center`,style:{padding:`10px 18px 9px`,borderBottom:`1px solid var(--line)`},children:[(0,B.jsx)(`span`,{className:`instlabel`,style:{color:`var(--dim)`},children:`Node forest`}),(0,B.jsx)(`span`,{className:`font-inst text-xs`,style:{marginLeft:`auto`,color:`var(--dim)`,letterSpacing:`0.1em`},children:`sorted · activity`})]}),(0,B.jsx)(`div`,{className:`tree`,children:e.length===0?(0,B.jsx)(`p`,{className:`px-3 py-2 text-sm italic`,style:{color:`var(--mut)`},children:`No nodes on the canvas yet.`}):u.length===0?(0,B.jsx)(`p`,{className:`px-3 py-2 text-sm italic`,style:{color:`var(--mut)`},children:`No matching nodes.`}):u.map(e=>(0,B.jsx)(Pm,{node:e},e.node.node_id))})]}),(0,B.jsx)(Im,{open:t,onClose:()=>n(!1)},r)]})}function Pm({node:e}){let t=ut(),[n,r]=(0,v.useState)(!1),i=e.node,a=i.attention_count>0,o=Tm.has(i.status),s=a?`blocked`:i.status,c=e.children.filter(e=>!Em(e)),l=e.children.filter(e=>Em(e)),u=l.reduce((e,t)=>e+Dm(t),0),d=u>=Om,f=d?c:e.children,p=()=>{i.enterable&&t(`/nodes/${encodeURIComponent(i.node_id)}`)};return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`div`,{className:Y(`node-row s-${s}`,o&&`dimmed`),onClick:p,role:i.enterable?`button`:void 0,tabIndex:i.enterable?0:void 0,style:i.enterable?void 0:{cursor:`default`},onKeyDown:e=>{i.enterable&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),p())},children:[(0,B.jsxs)(`div`,{className:`node-id`,children:[(0,B.jsxs)(`div`,{className:`node-l1`,children:[(0,B.jsx)(`span`,{className:`node-name`,children:i.name}),(0,B.jsxs)(`span`,{className:`node-kind`,children:[i.kind,` · `,i.mode]})]}),(0,B.jsxs)(`div`,{className:`node-l2`,children:[(0,B.jsx)(`span`,{className:`node-cwd`,title:i.cwd,children:i.cwd}),i.lifecycle&&(0,B.jsx)(`span`,{className:`node-life`,children:i.lifecycle}),!i.enterable&&(0,B.jsx)(`span`,{className:`node-note`,children:vm})]})]}),(0,B.jsxs)(`div`,{className:`node-right`,children:[a&&(0,B.jsxs)(`span`,{className:`waitflag`,children:[(0,B.jsx)(vf,{size:14,"aria-hidden":!0}),` `,i.attention_count,` waiting on human`]}),(0,B.jsx)(Fm,{status:i.status,blocked:a})]})]}),(f.length>0||d&&u>0)&&(0,B.jsxs)(`div`,{className:`kids`,children:[f.map(e=>(0,B.jsx)(Pm,{node:e},e.node.node_id)),d&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`flex items-center gap-1.5 px-4 py-2 text-xs transition-colors`,style:{color:`var(--dim)`},children:[(0,B.jsx)(cf,{size:14,"aria-hidden":!0,style:{transform:n?`rotate(90deg)`:`none`,transition:`transform 0.15s ease`}}),n?`Hide ${u} closed`:`Show ${u} closed`]}),n&&l.map(e=>(0,B.jsx)(Pm,{node:e},e.node.node_id))]})]})]})}function Fm({status:e,blocked:t}){let n=Am(e,t);return(0,B.jsxs)(Kp,{variant:`outline`,className:t?`blocked`:e,children:[(0,B.jsx)(n,{"aria-hidden":!0}),e]})}function Im({open:e,onClose:t}){let[n,r]=(0,v.useState)(``),[i,a]=(0,v.useState)(`developer`),[o,s]=(0,v.useState)(``),[c,l]=(0,v.useState)(!1),[u,d]=(0,v.useState)(``),[f,p]=(0,v.useState)(``),[m,h]=(0,v.useState)(``),[g,_]=(0,v.useState)(``),[y,b]=(0,v.useState)(!1),[x,S]=(0,v.useState)(null);return(0,B.jsx)(Dp,{open:e,onOpenChange:e=>!e&&t(),children:(0,B.jsxs)(Ap,{className:`max-w-md overflow-y-auto max-h-[90dvh]`,children:[(0,B.jsx)(jp,{children:(0,B.jsx)(Np,{children:`Spawn a node`})}),(0,B.jsxs)(`form`,{id:`spawn-form`,onSubmit:async e=>{if(e.preventDefault(),!n.trim()||!i.trim()){S(`prompt and kind are required`);return}b(!0),S(null);let r={prompt:n.trim(),kind:i.trim(),...o?{mode:o}:{},...c?{root:!0}:{},...u.trim()?{cwd:u.trim()}:{},...f.trim()?{name:f.trim()}:{},...m.trim()?{model:m.trim()}:{},...g.trim()?{parent:g.trim()}:{}};try{await Yf(r),t()}catch(e){console.error(`[spawn] failed:`,e),S(e instanceof Uf?`${e.code}: ${e.message}`:String(e))}finally{b(!1)}},className:`flex flex-col gap-3.5`,children:[(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-prompt`,children:`Prompt`}),(0,B.jsx)(Wp,{id:`spawn-prompt`,value:n,onChange:e=>r(e.currentTarget.value),rows:4,required:!0,className:`resize-none`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-kind`,children:`Kind`}),(0,B.jsx)(Fp,{id:`spawn-kind`,value:i,onChange:e=>a(e.currentTarget.value),required:!0})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-mode`,children:`Mode`}),(0,B.jsxs)(Lp,{value:o===``?`__none__`:o,onValueChange:e=>s(e===`__none__`?``:e),children:[(0,B.jsx)(zp,{id:`spawn-mode`,className:`w-full`,children:(0,B.jsx)(Rp,{})}),(0,B.jsxs)(Bp,{children:[(0,B.jsx)(Vp,{value:`__none__`,children:`(default)`}),(0,B.jsx)(Vp,{value:`base`,children:`base`}),(0,B.jsx)(Vp,{value:`orchestrator`,children:`orchestrator`})]})]})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(`input`,{type:`checkbox`,id:`spawn-root`,checked:c,onChange:e=>l(e.currentTarget.checked),className:`size-4 rounded-none border border-input accent-primary`}),(0,B.jsx)(Ip,{htmlFor:`spawn-root`,className:`cursor-pointer`,children:`Resident root node`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-cwd`,children:`cwd`}),(0,B.jsx)(Fp,{id:`spawn-cwd`,value:u,onChange:e=>d(e.currentTarget.value),placeholder:`(inherit)`,className:`font-mono text-sm`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-name`,children:`Name`}),(0,B.jsx)(Fp,{id:`spawn-name`,value:f,onChange:e=>p(e.currentTarget.value),placeholder:`(auto)`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-model`,children:`Model`}),(0,B.jsx)(Fp,{id:`spawn-model`,value:m,onChange:e=>h(e.currentTarget.value),placeholder:`(default)`})]}),(0,B.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,B.jsx)(Ip,{htmlFor:`spawn-parent`,children:`Parent node id`}),(0,B.jsx)(Fp,{id:`spawn-parent`,value:g,onChange:e=>_(e.currentTarget.value),placeholder:`(this canvas root)`,className:`font-mono text-sm`})]}),x&&(0,B.jsx)(`p`,{className:`text-sm text-destructive`,children:x})]}),(0,B.jsxs)(Mp,{children:[(0,B.jsx)(Z,{type:`button`,variant:`outline`,onClick:t,disabled:y,children:`Cancel`}),(0,B.jsx)(Z,{type:`submit`,form:`spawn-form`,disabled:y,children:y?`Spawning…`:`Spawn`})]})]})})}function Lm(e){if(!e)return``;let t=e.replace(/\/+$/,``).split(`/`);return t[t.length-1]??``}function Rm(e){let t=e.name?.trim();if(t&&t!==e.kind)return t;let n=Lm(e.cwd);return n?`${e.kind} · ${n}`:e.kind}function zm(e){return e.parent===null&&e.host_kind===`broker`}function Bm(e){let t=new Map;for(let n of e){if(n.parent===null)continue;let e=t.get(n.parent);e?e.push(n):t.set(n.parent,[n])}return t}function Vm(e,t){let n=[],r=new Set,i=[e];for(;i.length>0;){let e=i.pop();if(r.has(e.node_id))continue;r.add(e.node_id),n.push(e);let a=t.get(e.node_id);if(a)for(let e of a)i.push(e)}return n}function Hm(e){return e===`done`||e===`dead`||e===`canceled`}function Um(e){return e.attention_count>0?`blocked`:e.status}function Wm(e,t,n){return t>0?`needs-you`:e.status===`active`||n>0?`active`:Hm(e.status)?`done`:`idle`}function Gm(e){switch(e){case`needs-you`:return 0;case`active`:return 1;case`idle`:return 2;case`done`:return 3}}function Km(e){let t=Bm(e),n=[];for(let r of e){if(!zm(r))continue;let e=Vm(r,t),i=0,a=0;for(let t of e)i+=Math.max(0,t.attention_count),t.node_id!==r.node_id&&t.status===`active`&&(a+=1);n.push({id:r.node_id,title:Rm(r),state:Wm(r,i,a),attention:i,activeChildren:a,nodeCount:e.length,...r.cycles===void 0?{}:{cycles:r.cycles},lastActivity:r.last_activity??r.created})}return n.sort((e,t)=>{let n=Gm(e.state)-Gm(t.state);return n===0?t.lastActivity.localeCompare(e.lastActivity):n}),n}function qm(e){switch(e.state){case`needs-you`:return e.attention>1?`${e.attention} things need your input`:`Needs your input`;case`active`:return e.activeChildren>0?`Working — ${e.activeChildren} ${e.activeChildren===1?`task`:`tasks`} in progress`:`Working…`;case`done`:return`Finished`;case`idle`:return`Idle`}}function Jm(e,t,n){if(e.key===`Enter`&&!e.shiftKey){if(e.altKey){e.preventDefault();let n=e.currentTarget,r=n.selectionStart??n.value.length,i=n.selectionEnd??r,a=`${n.value.slice(0,r)}\n${n.value.slice(i)}`,o=r+1;t(a),requestAnimationFrame(()=>{n.selectionStart=o,n.selectionEnd=o});return}e.metaKey||e.ctrlKey||(e.preventDefault(),n())}}var Ym=[`Research a topic for me`,`Help me write something`,`Review my code`,`Plan a project`];function Xm(){let{nodes:e,loading:t}=Sp(),n=up(e=>e.reachable),r=(0,v.useMemo)(()=>Km(e),[e]),[i,a]=(0,v.useState)(!1),[o]=Rn();(0,v.useEffect)(()=>{o.get(`new`)!==null&&a(!0)},[o]);let s=!t&&r.length===0;return(0,B.jsxs)(`div`,{className:`mx-auto flex h-full min-h-0 max-w-3xl flex-col px-6 py-8`,children:[(0,B.jsxs)(`div`,{className:`mb-6 flex items-center justify-between gap-3`,children:[(0,B.jsx)(`h1`,{className:`text-3xl`,style:{fontWeight:460,letterSpacing:`-0.01em`,color:`var(--ink)`},children:`Conversations`}),!s&&!i&&(0,B.jsx)(Z,{size:`lg`,onClick:()=>a(!0),children:`+ New chat`})]}),!n&&(0,B.jsx)(`div`,{className:`mb-4 rounded-lg border px-4 py-2.5 text-sm`,style:{borderColor:`rgba(255,94,54,.3)`,background:`var(--blk-dim)`,color:`var(--ink2)`},children:`Couldn't reach your agents — retrying…`}),(i||s)&&(0,B.jsx)(Zm,{firstRun:s,onCancel:s?void 0:()=>a(!1)}),(0,B.jsx)(`div`,{className:`min-h-0 flex-1 overflow-auto`,children:t?(0,B.jsx)(th,{}):(0,B.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:r.map(e=>(0,B.jsx)(Qm,{conversation:e},e.id))})})]})}function Zm({firstRun:e,onCancel:t}){let n=ut(),[r,i]=(0,v.useState)(``),[a,o]=(0,v.useState)(!1),[s,c]=(0,v.useState)(null),l=async()=>{let e=r.trim();if(!(!e||a)){o(!0),c(null);try{let t=await Yf({prompt:e,kind:`general`,mode:`base`,root:!0});n(`/c/${encodeURIComponent(t.node_id)}`)}catch(e){c(e instanceof Uf?e.message:String(e)),o(!1)}}};return(0,B.jsxs)(`div`,{className:`panel mb-6 p-5`,children:[e&&(0,B.jsx)(`p`,{className:`mb-3 text-base`,style:{fontStyle:`italic`,color:`var(--ink2)`},children:`Start a conversation with an agent.`}),(0,B.jsx)(Wp,{autoFocus:!0,value:r,onChange:e=>i(e.currentTarget.value),onKeyDown:e=>{Jm(e,i,()=>void l())},rows:3,disabled:a,placeholder:`What do you want help with?`,className:`resize-none border-0 bg-transparent px-0 text-base shadow-none focus-visible:ring-0`}),(0,B.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:Ym.map(e=>(0,B.jsx)(`button`,{type:`button`,disabled:a,onClick:()=>i(e),className:`rounded-full border border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-[color:var(--line2)] hover:text-foreground`,children:e},e))}),s&&(0,B.jsx)(`p`,{className:`mt-3 text-sm text-destructive`,children:s}),(0,B.jsxs)(`div`,{className:`mt-4 flex items-center justify-end gap-2`,children:[t&&(0,B.jsx)(Z,{variant:`ghost`,onClick:t,disabled:a,children:`Cancel`}),(0,B.jsx)(Z,{onClick:()=>void l(),disabled:a||!r.trim(),children:a?`Starting…`:`Start chat`})]})]})}function Qm({conversation:e}){let t=ut();return(0,B.jsx)(`li`,{className:`list-none`,children:(0,B.jsxs)(`button`,{type:`button`,onClick:()=>t(`/c/${encodeURIComponent(e.id)}`),className:`panel flex w-full items-center gap-4 px-4 py-3.5 text-left transition-colors hover:bg-[color-mix(in_oklch,var(--ink)_3%,transparent)] focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(eh,{state:e.state}),(0,B.jsx)(`span`,{className:`truncate text-sm`,style:{fontWeight:500,color:`var(--ink)`},children:e.title})]}),(0,B.jsx)(`p`,{className:`mt-0.5 truncate text-sm`,style:{color:`var(--mut)`},children:qm(e)})]}),(0,B.jsxs)(`div`,{className:`font-inst flex shrink-0 items-center gap-3 text-xs`,style:{letterSpacing:`0.04em`,color:`var(--mut)`},children:[e.cycles!==void 0&&(0,B.jsxs)(`span`,{title:`cycles`,children:[`⟳ `,e.cycles]}),(0,B.jsxs)(`span`,{title:`nodes in this conversation`,children:[`◦ `,e.nodeCount,` `,e.nodeCount===1?`node`:`nodes`]}),(0,B.jsx)(`span`,{title:`time since last work`,children:nh(e.lastActivity)})]})]})})}var $m={"needs-you":`needs you`,active:`active`,idle:`idle`,done:`done`};function eh({state:e}){let t=e===`needs-you`?`blocked`:e,n=$m[e];return(0,B.jsx)(`span`,{className:Y(`dot shrink-0`,t),title:n,"aria-label":n})}function th(){return(0,B.jsx)(`ul`,{className:`flex flex-col gap-2.5`,children:[0,1,2,3].map(e=>(0,B.jsxs)(`li`,{className:`panel flex items-center gap-4 px-4 py-3.5`,children:[(0,B.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-2`,children:[(0,B.jsx)(`div`,{className:`h-4 w-1/3 animate-pulse rounded bg-muted`}),(0,B.jsx)(`div`,{className:`h-3 w-2/3 animate-pulse rounded bg-muted/70`})]}),(0,B.jsx)(`div`,{className:`h-6 w-16 animate-pulse rounded-full bg-muted`})]},e))})}function nh(e){let t=new Date(e).getTime();if(Number.isNaN(t))return``;let n=Math.max(0,Math.round((Date.now()-t)/1e3));if(n<60)return`just now`;let r=Math.round(n/60);if(r<60)return`${r}m ago`;let i=Math.round(r/60);return i<24?`${i}h ago`:`${Math.round(i/24)}d ago`}var rh={active:Tf,idle:hf,done:df,dead:pf,canceled:mf,blocked:uf};function ih({status:e}){return(0,B.jsx)(rh[e]??hf,{className:Y(`!size-3.5`,e===`active`&&`animate-spin`)})}function ah(e,t,n,r){return t===`static`?e.status:n===`down`?`dead`:n===`reconnecting`?`idle`:r?`active`:`idle`}function oh(e){let t=e.store.source===`static`,n=e.store.state?.isStreaming??!1,r=e.detail,i=r?ah(r,e.store.source,e.store.brokerStatus,n):null;return r?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`h2`,{className:Y(sh,`min-w-0 truncate`),title:r.name,children:r.name}),i&&(0,B.jsxs)(Kp,{className:Y(`gap-1.5`,i),children:[(0,B.jsx)(ih,{status:i}),i]}),t&&(0,B.jsx)(`span`,{className:`font-mono text-xs`,style:{color:`var(--idle)`},title:`dormant node — last-known values, not live`,children:`last-known`})]}):(0,B.jsx)(`h2`,{className:sh,children:`…`})}var sh=`con-title text-xl font-medium`;function ch(e){let t=e.store.chrome,n=e.store.source===`static`,r=e.store.state?.isStreaming??!1,i=t.context,a=t.stats,o=t.tokens,s=i&&!n?i.percent:null,c=!n&&a?.cost!==void 0?a.cost:null;return!i&&c===null&&!a&&!o?null:(0,B.jsxs)(`div`,{className:`cluster`,children:[i&&(0,B.jsxs)(`div`,{className:`gauge`,children:[(0,B.jsxs)(`div`,{className:`glabel`,children:[(0,B.jsx)(`span`,{className:`instlabel`,children:`Context`}),(0,B.jsxs)(`span`,{className:`gval`,children:[s===null?`—`:dh(s),s!==null&&(0,B.jsx)(`span`,{className:`u`,children:`%`})]})]}),(0,B.jsx)(`div`,{className:`gbar`,children:(0,B.jsx)(`i`,{style:{width:s===null?`0%`:`${Math.min(100,s)}%`}})}),(0,B.jsxs)(`div`,{className:`gsub`,children:[i.tokens.toLocaleString(),!n&&(0,B.jsxs)(B.Fragment,{children:[` / `,i.window.toLocaleString()]})]})]}),c!==null&&(0,B.jsxs)(`div`,{className:`gauge`,children:[(0,B.jsxs)(`div`,{className:`glabel`,children:[(0,B.jsx)(`span`,{className:`instlabel`,children:`Cost`}),(0,B.jsxs)(`span`,{className:`gval`,children:[(0,B.jsx)(`span`,{className:`u`,style:{marginLeft:0,marginRight:2},children:`$`}),c.toFixed(2)]})]}),(0,B.jsx)(`div`,{className:`gbar`,children:(0,B.jsx)(`i`,{style:{width:`${Math.min(100,c/5*100)}%`}})}),a&&(0,B.jsxs)(`div`,{className:`gsub`,children:[a.turns,` turns`]})]}),(0,B.jsxs)(`div`,{className:`dials`,children:[!n&&a&&c===null&&(0,B.jsx)(lh,{value:String(a.turns),unit:`turns`}),!n&&a&&(0,B.jsx)(lh,{value:`${a.user_messages}/${a.assistant_messages}`,unit:`msgs`}),o&&(0,B.jsx)(lh,{value:`${uh(o.input)} → ${uh(o.output)}`,unit:`tokens`}),!n&&t.tool_calls!==null&&(0,B.jsx)(lh,{value:String(t.tool_calls),unit:`tools`,hot:r})]})]})}function lh({value:e,unit:t,hot:n}){return(0,B.jsx)(`div`,{className:`dial`,children:(0,B.jsxs)(`span`,{className:`dval`,style:n?{color:`var(--act)`}:void 0,children:[e,` `,(0,B.jsx)(`em`,{children:t})]})})}function uh(e){return e>=1e6?`${Math.round(e/1e5)/10}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}function dh(e){return(Math.round(e*10)/10).toFixed(1)}function fh({store:e,detail:t}){let n=e.chrome,r=[],i=n.branch??t?.branch??null;if(i!==null){let e=n.git_status??t?.git_status??null,a=e?.added??0,o=e?.modified??0;r.push((0,B.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,B.jsx)(yf,{className:`size-3.5 shrink-0 opacity-70`}),(0,B.jsx)(`b`,{style:ph,children:i}),a>0&&(0,B.jsxs)(`span`,{style:{color:`var(--act)`,opacity:.8},children:[` +`,a]}),o>0&&(0,B.jsxs)(`span`,{style:{color:`var(--idle)`,opacity:.8},children:[` ~`,o]})]},`branch`))}let a=t?.cwd??null;a!==null&&r.push((0,B.jsx)(`span`,{children:mh(a)},`cwd`));let o=n.model??t?.model??null;o!==null&&r.push((0,B.jsx)(`span`,{children:(0,B.jsx)(`b`,{style:ph,children:o})},`model`));let s=n.context??null;return s!==null&&r.push((0,B.jsxs)(`span`,{children:[`ctx `,(0,B.jsx)(`b`,{style:ph,children:hh(s.tokens)}),` / `,hh(s.window)]},`ctx`)),r.length===0?null:(0,B.jsx)(`div`,{className:`flex min-w-0 items-center gap-5 whitespace-nowrap border-b px-6 py-2 text-xs`,style:{borderColor:`var(--line)`,background:`rgba(0,0,0,.18)`,color:`var(--mut)`},children:r.map((e,t)=>(0,B.jsxs)(v.Fragment,{children:[t>0&&(0,B.jsx)(`span`,{style:{color:`var(--dim)`,opacity:.5},className:`select-none`,children:`·`}),e]},t))})}var ph={color:`var(--ink2)`,fontWeight:400};function mh(e){let t=e.match(/^\/(?:Users|home)\/[^/]+(\/.*)$/);if(t)return`~${t[1]}`;let n=e.split(`/`).filter(Boolean);return n.length<=2?e:`…/${n.slice(-2).join(`/`)}`}function hh(e){return e>=1e6?`${Math.round(e/1e6)}M`:e>=1e3?`${Math.round(e/1e3)}k`:String(e)}function gh(e){let[t,n]=(0,v.useState)(!1),r=(0,v.useRef)(null);return(0,v.useEffect)(()=>{let e=e=>{if(e.key===`Escape`){n(!1);return}if(e.altKey&&e.code===`KeyI`){if(document.activeElement instanceof HTMLTextAreaElement)return;e.preventDefault(),n(e=>!e)}};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),t?(0,B.jsx)(`div`,{className:`in fixed inset-0 z-50 flex items-start justify-center pt-22`,style:{background:`rgba(0,0,0,.42)`,backdropFilter:`blur(2px)`},onMouseDown:e=>{r.current?.contains(e.target)||n(!1)},children:(0,B.jsxs)(`div`,{ref:r,className:`panel rv`,style:_h,children:[(0,B.jsxs)(`div`,{style:vh,children:[(0,B.jsx)(`span`,{className:`instlabel`,children:`Instruments`}),(0,B.jsx)(`div`,{style:{flex:1}}),(0,B.jsx)(`span`,{className:`kbd`,children:`⌥i`}),(0,B.jsx)(`button`,{type:`button`,onClick:()=>n(!1),className:`transition-colors`,style:{color:`var(--mut)`},"aria-label":`Close instruments`,children:(0,B.jsx)(Pf,{className:`size-3.5`})})]}),(0,B.jsx)(ch,{store:e.store,detail:e.detail})]})}):null}var _h={minWidth:`min(680px, 92vw)`,overflow:`hidden`,"--i":0},vh={display:`flex`,alignItems:`center`,gap:`10px`,padding:`11px 30px`,borderBottom:`1px solid var(--line)`};function yh(e){let t=new Map;for(let n of e){if(n.parent===null)continue;let e=t.get(n.parent);e?e.push(n):t.set(n.parent,[n])}return t}function bh(e,t){let n=[],r=new Set,i=[{node:e,depth:0}];for(;i.length>0;){let e=i.pop();if(r.has(e.node.node_id))continue;r.add(e.node.node_id),n.push({node:e.node,depth:e.depth});let a=t.get(e.node.node_id)??[];for(let t=a.length-1;t>=0;t--)i.push({node:a[t],depth:e.depth+1})}return n}function xh(e,t){let n=t.get(e),r=new Set;for(;n&&n.parent!==null;){if(r.has(n.node_id))return null;r.add(n.node_id),n=t.get(n.parent)}return n??null}function Sh(e,t){let n=new Map(e.map(e=>[e.node_id,e])),r=yh(e),i=xh(t,n),a=i?.node_id??null;return{thisGraph:i===null?[]:bh(i,r),otherGraphs:e.filter(e=>e.parent===null&&e.host_kind===`broker`&&e.node_id!==a&&(e.status===`active`||e.attention_count>0))}}var Ch=new Set([`done`,`dead`,`canceled`]),wh=`crtr:graphrail-collapsed`;function Th(e){return e.attention_count>0||e.status===`active`}function Eh(e,t){let n=new Map(e.map(e=>[e.node.node_id,e.node])),r=new Map;for(let{node:t}of e){if(t.parent===null||!n.has(t.parent))continue;let e=r.get(t.parent);e?e.push(t.node_id):r.set(t.parent,[t.node_id])}let i=new Map,a=e=>{let o=i.get(e);if(o!==void 0)return o;i.set(e,!1);let s=n.get(e),c=e===t||s!==void 0&&Th(s);if(!c){for(let t of r.get(e)??[])if(a(t)){c=!0;break}}return i.set(e,c),c},o=new Set;for(let{node:t}of e)(r.get(t.node_id)?.length??0)>0&&!a(t.node_id)&&o.add(t.node_id);return{children:r,collapsedByDefault:o}}function Dh({currentId:e,onNavigate:t}){let{nodes:n}=Sp(),[r,i]=(0,v.useState)(!1),[a,o]=(0,v.useState)(()=>{try{return localStorage.getItem(wh)===`1`}catch{return!1}}),[s,c]=(0,v.useState)({}),{thisGraph:l}=Sh(n,e),u=l[0]?.node.node_id??null,{children:d,collapsedByDefault:f}=(0,v.useMemo)(()=>Eh(l,e),[l,e]),p=e=>s[e]===void 0?f.has(e):!s[e],m=e=>c(t=>({...t,[e]:p(e)})),h=()=>{o(e=>{let t=!e;try{localStorage.setItem(wh,t?`1`:`0`)}catch{}return t})},{liveRoots:g,deadRoots:_}=(0,v.useMemo)(()=>{let e=n.filter(e=>e.parent===null&&e.host_kind===`broker`&&e.node_id!==u),t=[],r=[];for(let n of e)(Ch.has(n.status)&&n.attention_count===0?r:t).push(n);let i=(e,t)=>Date.parse(t.created)-Date.parse(e.created),a=e=>e.attention_count>0?0:e.status===`active`?1:2;return t.sort((e,t)=>a(e)-a(t)||i(e,t)),r.sort(i),{liveRoots:t,deadRoots:r}},[n,u]);if((0,v.useEffect)(()=>{let n=n=>{if(!n.altKey||n.key!==`ArrowUp`&&n.key!==`ArrowDown`)return;let r=l.findIndex(t=>t.node.node_id===e);if(r===-1)return;n.preventDefault();let i=n.key===`ArrowUp`?l[r-1]:l[r+1];i&&t(i.node.node_id)};return window.addEventListener(`keydown`,n),()=>window.removeEventListener(`keydown`,n)},[l,e,t]),a)return(0,B.jsx)(`aside`,{className:`graphrail rv`,style:kh,children:(0,B.jsx)(`button`,{type:`button`,onClick:h,title:`Expand graph sidebar`,"aria-label":`Expand graph sidebar`,className:`flex size-6 items-center justify-center rounded-md text-[var(--dim)] transition-colors hover:text-[var(--ink2)]`,children:(0,B.jsx)(cf,{className:`size-4`})})});let y=[],b=null;for(let{node:n,depth:r}of l){if(b!==null){if(r>b)continue;b=null}let i=d.get(n.node_id)??[],a=i.length>0&&p(n.node_id);y.push((0,B.jsx)(Ih,{node:n,depth:r,current:n.node_id===e,hasChildren:i.length>0,collapsed:a,onToggleCollapse:()=>m(n.node_id),onClick:()=>t(n.node_id)},n.node_id)),a&&(b=r)}return(0,B.jsxs)(`aside`,{className:`graphrail rv`,style:Oh,children:[(0,B.jsx)(`div`,{className:`flex items-center justify-end pb-1`,children:(0,B.jsx)(`button`,{type:`button`,onClick:h,title:`Collapse graph sidebar`,"aria-label":`Collapse graph sidebar`,className:`flex size-6 items-center justify-center rounded-md text-[var(--dim)] transition-colors hover:text-[var(--ink2)]`,children:(0,B.jsx)(cf,{className:`size-4 rotate-180`})})}),(0,B.jsx)(Ah,{label:`This graph`,chord:`⌥↑↓ to cycle`}),y,l.length===0&&(0,B.jsx)(jh,{}),(g.length>0||_.length>0)&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`div`,{className:`gr-gap`}),(0,B.jsx)(Ah,{label:`Elsewhere`}),g.map(e=>(0,B.jsx)(Ih,{node:e,depth:0,current:!1,elsewhere:!0,onClick:()=>t(e.node_id)},e.node_id)),_.length>0&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`button`,{type:`button`,onClick:()=>i(e=>!e),className:`mt-1 flex items-center gap-1.5 rounded-md px-3 py-2 text-left text-xs text-[var(--dim)] transition-colors hover:text-[var(--ink2)]`,children:[(0,B.jsx)(cf,{className:Y(`size-3.5 transition-transform`,r&&`rotate-90`)}),r?`Hide`:`Show`,` `,_.length,` finished`]}),r&&_.map(e=>(0,B.jsx)(Ih,{node:e,depth:0,current:!1,elsewhere:!0,onClick:()=>t(e.node_id)},e.node_id))]})]})]})}var Oh={width:`228px`,flex:`none`,display:`flex`,flexDirection:`column`,borderRight:`1px solid var(--line)`,background:`rgba(0,0,0,.16)`,padding:`14px 9px`,overflowY:`auto`,zIndex:1,"--i":2},kh={width:`36px`,flex:`none`,display:`flex`,flexDirection:`column`,alignItems:`center`,borderRight:`1px solid var(--line)`,background:`rgba(0,0,0,.16)`,padding:`14px 6px`,zIndex:1,"--i":2};function Ah({label:e,chord:t}){return(0,B.jsxs)(`div`,{className:`gr-sec`,children:[(0,B.jsx)(`span`,{className:`instlabel`,children:e}),(0,B.jsx)(`div`,{className:`rule`}),t&&(0,B.jsx)(`span`,{title:t,"aria-label":t,className:`flex items-center text-[var(--dim)]`,children:(0,B.jsx)(Sf,{className:`size-3.5`})})]})}function jh(){return(0,B.jsx)(`span`,{className:`px-3 py-1 font-mono text-xs`,style:{color:`var(--dim)`},children:`—`})}function Mh(e){let t=Date.now()-Date.parse(e);if(!Number.isFinite(t)||t<0)return``;let n=Math.floor(t/1e3);if(n<60)return`${n}s`;let r=Math.floor(n/60);if(r<60)return`${r}m`;let i=Math.floor(r/60);return i<24?`${i}h`:`${Math.floor(i/24)}d`}function Nh(e){return e.split(`/`).filter(Boolean).at(-1)??e}function Ph(e){let t=e.match(/^\/(?:Users|home)\/[^/]+(\/.*)$/);if(t)return`~${t[1]}`;let n=e.split(`/`).filter(Boolean);return n.length<=2?e:`…/${n.slice(-2).join(`/`)}`}var Fh={active:`s-active`,idle:`s-idle`,done:`s-done`,dead:`s-dead`,canceled:`s-canceled`};function Ih({node:e,depth:t,current:n,elsewhere:r=!1,hasChildren:i=!1,collapsed:a=!1,onToggleCollapse:o,onClick:s}){let c=Ch.has(e.status),l=e.attention_count>0,u=l?`blocked`:e.status,d=Mh(e.created),f=t>0?{marginLeft:`${t*12}px`}:void 0,p=(0,B.jsx)(`button`,{type:`button`,onClick:s,className:Y(`node-row text-left`,r?`w-full`:`min-w-0 flex-1`,l?`s-blocked`:Fh[e.status],c&&!l&&`dimmed`,n&&`rounded-md border border-[var(--line2)] bg-[oklch(0.92_0.013_80_/_8%)] shadow-[inset_0_1px_0_var(--raise)]`),children:(0,B.jsxs)(`span`,{className:`node-id`,children:[(0,B.jsxs)(`span`,{className:`node-l1`,children:[(0,B.jsx)(`span`,{className:Y(`node-name truncate`,n&&`font-semibold`),children:r?Nh(e.cwd):e.name}),r?(0,B.jsxs)(`span`,{className:`node-kind truncate`,children:[e.name,` · `,e.kind]}):(0,B.jsx)(`span`,{className:`node-kind`,children:e.kind}),l&&(0,B.jsxs)(Kp,{variant:`destructive`,className:`ml-auto gap-1 text-xs`,children:[(0,B.jsx)(vf,{className:`size-3.5`}),e.attention_count]})]}),(0,B.jsxs)(`span`,{className:`node-l2`,children:[r&&(0,B.jsx)(`span`,{className:`node-cwd`,children:Ph(e.cwd)}),(0,B.jsx)(`span`,{className:Y(`dot`,u),title:u,"aria-label":u}),d&&(0,B.jsx)(`span`,{className:`text-[var(--dim)]`,children:d})]})]})});return r?(0,B.jsx)(`div`,{style:f,children:p}):(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,style:f,children:[i?(0,B.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),o?.()},title:a?`Expand branch`:`Collapse branch`,"aria-label":a?`Expand branch`:`Collapse branch`,className:`flex size-4 flex-none items-center justify-center rounded-sm text-[var(--dim)] transition-colors hover:text-[var(--ink2)]`,children:(0,B.jsx)(cf,{className:Y(`size-3.5 transition-transform`,!a&&`rotate-90`)})}):(0,B.jsx)(`span`,{className:`size-4 flex-none`,"aria-hidden":`true`}),p]})}function Lh(e){let t=e.store.presence,n=e.store.role===`controller`;return(0,B.jsxs)(v.Fragment,{children:[(0,B.jsxs)(`div`,{className:`ctl-state flex shrink-0 items-center gap-1.5 text-xs`,style:{color:`var(--mut)`},children:[`control:`,` `,(0,B.jsx)(`span`,{style:{color:`var(--ink2)`,fontStyle:`italic`},children:n?`you`:t.controller?`another client`:`no one`})]}),n?(0,B.jsx)(`button`,{type:`button`,className:`btn sm shrink-0`,onClick:()=>e.store.releaseControl(),children:`Release control`}):(0,B.jsx)(`button`,{type:`button`,className:`btn primary sm shrink-0`,disabled:!e.store.socketReady,title:e.store.socketReady?void 0:`connecting…`,onClick:()=>e.store.requestControl(),children:`Request control`})]})}function Rh(e){return typeof e==`object`&&!!e}function zh(e){return typeof e==`string`?e:``}function Bh(e){let t=e??``;return/rate.?limit|\b429\b|too many requests|quota/i.test(t)?`rate-limit`:/overloaded|\b529\b|\b503\b|capacity|server.{0,3}busy|temporarily unavailable/i.test(t)?`overloaded`:/invalid_grant|refresh token|unauthori[sz]ed|invalid.?api.?key|authentication failed|\b401\b|\b403\b/i.test(t)?`auth`:/connection|econnreset|etimedout|enotfound|econnrefused|network|fetch failed|socket hang|timed? out|timeout|\bterminated\b|other side closed|premature close/i.test(t)?`connection`:`other`}function Vh(e){let t=zh(e.code)||zh(e.errno);return t===``?null:/^(ECONNREFUSED|ECONNRESET|ETIMEDOUT|ENOENT|ENOTFOUND|EAI_AGAIN|EPIPE|EHOSTUNREACH|ENETUNREACH)$/i.test(t)?`connection`:null}function Hh(e){let t=typeof e.status==`number`?e.status:null;return t===null?null:t===401||t===403?`auth`:t===429?`rate-limit`:t===503||t===529||t>=500&&t<=599?`overloaded`:t>=400&&t<=499?`protocol`:null}function Uh(e){let t=typeof e.code==`number`?e.code:null;if(t===null)return null;if(t===1008)return`protocol`;if(t===1006)return`connection`;if(t===1011){let t=zh(e.reason);return/no running broker/i.test(t)||Bh(t)===`connection`?`connection`:`other`}return null}function Wh(e,t){return t===`auth`||t===`protocol`?`fatal`:e===`pi→provider`?t===`connection`||t===`rate-limit`||t===`overloaded`?`auto`:`fatal`:`manual`}function Gh(e){if(typeof e==`string`)return e;if(!Rh(e))return``;let t=[e.message,e.errorMessage,e.reason,e.body,e.statusText];for(let e of t)if(typeof e==`string`&&e!==``)return e;let n=e.error;if(Rh(n)){let e=n.message;if(typeof e==`string`&&e!==``)return e;let t=n.reason;if(typeof t==`string`&&t!==``)return t}return``}function Kh(e,t){if(Rh(t)){let n=Vh(t);if(n!==null)return{kind:n,disposition:Wh(e,n)};let r=Hh(t);if(r!==null)return{kind:r,disposition:Wh(e,r)};let i=Uh(t);if(i!==null)return{kind:i,disposition:Wh(e,i)}}let n=Bh(Gh(t));return{kind:n,disposition:Wh(e,n)}}var qh=class{nodeId;handlers;ws;closedReported=!1;constructor(e,t){this.nodeId=e,this.handlers=t}get url(){let e=location.protocol===`https:`?`wss:`:`ws:`,t=new URL(`/node/${encodeURIComponent(this.nodeId)}`,window.location.href);return t.protocol=e,Bf!==void 0&&t.searchParams.set(`token`,Bf),t.toString()}connect(){let e;try{e=new WebSocket(this.url)}catch(e){this.reportClose(`transient`,`failed to open ws: ${String(e)}`);return}this.ws=e,e.onopen=()=>this.handlers.onOpen?.(),e.onmessage=e=>this.onMessage(e),e.onclose=e=>{let t=Kh(`browser↔relay`,{code:e.code,reason:e.reason}),n=e.code===1008||t.kind===`protocol`?`invalid`:e.code===1011&&/^no node /.test(e.reason)?`no-node`:e.code===1011&&/^no running broker/.test(e.reason)?`no-broker`:`transient`;this.reportClose(n,e.reason||`closed (${e.code})`)},e.onerror=()=>{}}onMessage(e){if(typeof e.data!=`string`)return;let t;try{t=JSON.parse(e.data)}catch{return}this.handlers.onFrame?.(t)}send(e){let t=this.ws;if(!(t===void 0||t.readyState!==WebSocket.OPEN))try{t.send(JSON.stringify(e))}catch{}}close(){let e=this.ws;if(e!==void 0&&e.readyState<=WebSocket.OPEN)try{e.close()}catch{}}reportClose(e,t){this.closedReported||(this.closedReported=!0,this.ws=void 0,this.handlers.onClose?.(e,t))}},Jh=/^From (?:[a-z0-9]+-[a-f0-9]+|system|human) — \d+ update/;function Yh(e){return Jh.test(e)}function Xh(e){let t=/^From ([a-z0-9]+-[a-f0-9]+|system|human) — /.exec(e);if(!t)return null;let n=t[1];return typeof n==`string`?n:null}function Zh(){return{messages:[],streamingIndex:null,executingToolIds:new Set,partialToolResults:new Map,isStreaming:!1,activity:null,queued:[]}}function Qh(e){let t=e.content;return typeof t==`string`?t:Array.isArray(t)?t.filter(e=>!!e&&e.type===`text`).map(e=>typeof e.text==`string`?e.text:``).join(``):``}function $h(e){return ng(e)!==`user`||e.origin||!Yh(Qh(e))?e:{...e,origin:`inbox`}}function eg(){return{role:`assistant`,content:[]}}function tg(e,t){let n=e.messages.map($h);if(e.state?.isStreaming!==!0)return{messages:n,streamingIndex:null,executingToolIds:new Set,partialToolResults:new Map,isStreaming:!1,activity:null,queued:[]};let r=n.length-1;if(r>=0&&ng(n[r])===`assistant`)return{messages:n,streamingIndex:r,executingToolIds:new Set,partialToolResults:new Map,isStreaming:!0,activity:`Working…`,queued:[]};let i=t&&t.streamingIndex!==null?t.messages[t.streamingIndex]:void 0,a=i&&ng(i)===`assistant`?i:eg(),o=[...n,a];return{messages:o,streamingIndex:o.length-1,executingToolIds:new Set,partialToolResults:new Map,isStreaming:!0,activity:`Working…`,queued:[]}}function ng(e){return e.role??``}function rg(e){for(let t=e.messages.length-1;t>=0;t--)if(ng(e.messages[t])===`bashExecution`)return t;return null}function ig(e,t,n){let r={role:`bashExecution`,command:t,output:``,exitCode:void 0,cancelled:!1,truncated:!1,excludeFromContext:n,timestamp:Date.now()};return{...e,messages:[...e.messages,r]}}function ag(e,t){let n=rg(e);if(n===null)return e;let r=[...e.messages],i=r[n];return r[n]={...i,output:`${i.output??``}${t}`},{...e,messages:r}}function og(e,t){let n=rg(e);if(n===null)return e;let r=[...e.messages];return r[n]={...r[n],exitCode:t.exitCode,cancelled:t.cancelled,truncated:t.truncated,fullOutputPath:t.fullOutputPath},{...e,messages:r}}function sg(e,t){switch(t.type){case`agent_start`:return{...e,isStreaming:!0,activity:`Working…`};case`agent_end`:return{...e,isStreaming:!1,activity:null,streamingIndex:null,executingToolIds:e.executingToolIds.size?new Set:e.executingToolIds};case`message_start`:{let n=$h(t.message),r=[...e.messages,n],i=ng(n)===`assistant`,a=e.partialToolResults;if(ng(n)===`toolResult`){let e=n.toolCallId;if(typeof e==`string`&&a.has(e)){let t=new Map(a);t.delete(e),a=t}}return{...e,messages:r,partialToolResults:a,streamingIndex:i?r.length-1:e.streamingIndex}}case`message_update`:{let n=e.streamingIndex;if(n===null){let t=e.messages.length-1;t>=0&&ng(e.messages[t])===`assistant`&&(n=t)}if(n===null)return e;let r=[...e.messages];return r[n]=t.message,{...e,messages:r,streamingIndex:n}}case`message_end`:{if(e.streamingIndex===null)return e;let n=[...e.messages];return n[e.streamingIndex]=t.message,{...e,messages:n,streamingIndex:null}}case`tool_execution_start`:{let n=new Set(e.executingToolIds);return n.add(t.toolCallId),{...e,executingToolIds:n}}case`tool_execution_update`:{let n=new Map(e.partialToolResults);return n.set(t.toolCallId,cg(t.toolCallId,t.toolName,t.partialResult,!1)),{...e,partialToolResults:n}}case`tool_execution_end`:{let n=new Set(e.executingToolIds);n.delete(t.toolCallId);let r=new Map(e.partialToolResults);return r.set(t.toolCallId,cg(t.toolCallId,t.toolName,t.result,t.isError)),{...e,executingToolIds:n,partialToolResults:r}}case`compaction_start`:return{...e,activity:`Compacting context…`};case`compaction_end`:return{...e,activity:e.isStreaming?`Working…`:null};case`auto_retry_start`:return{...e,activity:`Retrying (${t.attempt}/${t.maxAttempts}) in ${Math.ceil(t.delayMs/1e3)}s…`};case`auto_retry_end`:return{...e,activity:e.isStreaming?`Working…`:null};case`queue_update`:return{...e,queued:[...t.steering,...t.followUp]};default:return e}}function cg(e,t,n,r){let i=typeof n==`object`&&n?n:{};return{role:`toolResult`,toolCallId:e,toolName:t,...i,content:Array.isArray(i.content)?i.content:[],isError:r}}var lg=1,ug=new Set([`stop`,`length`,`toolUse`,`error`,`aborted`]),dg=new Set([`off`,`minimal`,`low`,`medium`,`high`,`xhigh`]),fg=200,pg=256*1024,mg=20,hg=8*1024*1024;function gg(e){return{schemaVersion:lg,...e}}function _g(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Q(e){return typeof e==`string`}function vg(e){return typeof e==`number`}function yg(e){return typeof e==`boolean`}function bg(e){return!_g(e)||e.type!==`text`||!Q(e.text)?!1:e.textSignature===void 0||Q(e.textSignature)}function xg(e){return _g(e)&&e.type===`image`&&Q(e.data)&&Q(e.mimeType)}function Sg(e){return _g(e)&&e.type===`toolCall`&&Q(e.id)&&Q(e.name)&&_g(e.arguments)&&(e.thoughtSignature===void 0||Q(e.thoughtSignature))}function Cg(e){return _g(e)&&vg(e.input)&&vg(e.output)&&vg(e.cacheRead)&&vg(e.cacheWrite)&&vg(e.total)}function wg(e){return _g(e)&&vg(e.input)&&vg(e.output)&&vg(e.cacheRead)&&vg(e.cacheWrite)&&(e.cacheWrite1h===void 0||vg(e.cacheWrite1h))&&(e.reasoning===void 0||vg(e.reasoning))&&vg(e.totalTokens)&&Cg(e.cost)}function Tg(e){return typeof e==`string`&&ug.has(e)}function Eg(e){return typeof e==`string`&&dg.has(e)}function Dg(e){return!_g(e)||!Q(e.message)?!1:(e.name===void 0||Q(e.name))&&(e.stack===void 0||Q(e.stack))&&(e.code===void 0||Q(e.code)||vg(e.code))}function Og(e){return!_g(e)||!Q(e.type)||!vg(e.timestamp)?!1:(e.error===void 0||Dg(e.error))&&(e.details===void 0||_g(e.details))}function kg(e){return!_g(e)||e.role!==`user`||!vg(e.timestamp)?!1:typeof e.content==`string`||Array.isArray(e.content)&&e.content.every(e=>bg(e)||xg(e))}function Ag(e){return!_g(e)||e.role!==`assistant`||!vg(e.timestamp)||!Array.isArray(e.content)||!e.content.every(e=>bg(e)||_g(e)&&e.type===`thinking`&&Q(e.thinking)&&(e.thinkingSignature===void 0||Q(e.thinkingSignature))&&(e.redacted===void 0||yg(e.redacted))||Sg(e))?!1:Q(e.api)&&Q(e.provider)&&Q(e.model)&&(e.responseModel===void 0||Q(e.responseModel))&&(e.responseId===void 0||Q(e.responseId))&&(e.diagnostics===void 0||Array.isArray(e.diagnostics)&&e.diagnostics.every(Og))&&wg(e.usage)&&Tg(e.stopReason)&&(e.errorMessage===void 0||Q(e.errorMessage))}function jg(e){return!_g(e)||e.role!==`toolResult`||!vg(e.timestamp)?!1:Q(e.toolCallId)&&Q(e.toolName)&&Array.isArray(e.content)&&e.content.every(e=>bg(e)||xg(e))&&yg(e.isError)}function Mg(e){return _g(e)&&e.role===`bashExecution`&&Q(e.command)&&Q(e.output)&&vg(e.timestamp)&&(e.exitCode===void 0||vg(e.exitCode))&&yg(e.cancelled)&&yg(e.truncated)&&(e.fullOutputPath===void 0||Q(e.fullOutputPath))&&(e.excludeFromContext===void 0||yg(e.excludeFromContext))}function Ng(e){return kg(e)||Ag(e)||jg(e)||Mg(e)}function Pg(e){return!_g(e)||!Q(e.role)?!1:e.role!==`user`&&e.role!==`assistant`&&e.role!==`toolResult`&&e.role!==`bashExecution`}function Fg(e){return Ng(e)||Pg(e)}function Ig(e){return!_g(e)||!Q(e.name)||!Q(e.description)||e.source!==`builtin`&&e.source!==`command`&&e.source!==`template`?!1:(e.location===void 0||e.location===`user`||e.location===`project`||e.location===`path`)&&(e.path===void 0||Q(e.path))&&(e.argument_hint===void 0||Q(e.argument_hint))}function Lg(e){return e===null?!0:_g(e)?Q(e.sessionId)&&(e.sessionFile===null||Q(e.sessionFile))&&(e.model===null||Q(e.model))&&yg(e.isStreaming)&&Eg(e.thinkingLevel)&&(e.steeringMode===`all`||e.steeringMode===`one-at-a-time`)&&(e.followUpMode===`all`||e.followUpMode===`one-at-a-time`)&&(e.sessionName===null||Q(e.sessionName))&&yg(e.autoCompactionEnabled)&&vg(e.pendingMessageCount):!1}function Rg(e,t){return _g(t)?t.schemaVersion===lg&&t.nodeId===e&&Array.isArray(t.messages)&&t.messages.every(Fg)&&Lg(t.sessionState)&&Array.isArray(t.commands)&&t.commands.every(Ig)&&yg(t.isStreaming)&&(t.activity===null||Q(t.activity))&&vg(t.updatedAt)&&(t.source===`broker`||t.source===`static`):!1}function zg(e){return new TextEncoder().encode(JSON.stringify(e)).length}function Bg(e,t,n){let r=e.messages.slice(-t),i={...e,messages:r};for(;r.length>1&&zg(i)>n;)r=r.slice(1),i={...e,messages:r};return i}function Vg(e){return`crtr.web.transcript.tail.${e}`}function Hg(e){try{let t=globalThis.localStorage?.getItem(Vg(e));if(t==null)return null;let n=JSON.parse(t);return Rg(e,n)?n:null}catch{return null}}function Ug(e){let t=Bg(e,mg,pg);try{globalThis.localStorage?.setItem(Vg(e.nodeId),JSON.stringify(t))}catch{}}var Wg=`crtr-web-transcript-cache`,Gg=1,Kg=`entries`;function qg(){return new Promise((e,t)=>{if(typeof indexedDB>`u`){t(Error(`indexedDB unavailable`));return}let n=indexedDB.open(Wg,Gg);n.onupgradeneeded=()=>{let e=n.result;e.objectStoreNames.contains(Kg)||e.createObjectStore(Kg,{keyPath:`nodeId`}).createIndex(`updatedAt`,`updatedAt`)},n.onsuccess=()=>e(n.result),n.onerror=()=>t(n.error??Error(`indexedDB open failed`))})}async function Jg(e){try{let t=await qg(),n=await new Promise((n,r)=>{let i=t.transaction(Kg,`readonly`).objectStore(Kg).get(e);i.onsuccess=()=>n(i.result),i.onerror=()=>r(i.error??Error(`indexedDB read failed`))});return t.close(),Rg(e,n)?n:null}catch{return null}}async function Yg(e){let t=[];await new Promise((n,r)=>{let i=e.transaction(Kg,`readonly`).objectStore(Kg).index(`updatedAt`).openCursor();i.onsuccess=()=>{let e=i.result;if(!e){n();return}let r=e.value;t.push({nodeId:r.nodeId,updatedAt:r.updatedAt,size:zg(r)}),e.continue()},i.onerror=()=>r(i.error??Error(`indexedDB cursor failed`))});let n=t.reduce((e,t)=>e+t.size,0);n<=hg||await new Promise((r,i)=>{let a=e.transaction(Kg,`readwrite`),o=a.objectStore(Kg),s=0;for(;n>hg&&s<t.length;){let e=t[s];o.delete(e.nodeId),n-=e.size,s+=1}a.oncomplete=()=>r(),a.onerror=()=>i(a.error??Error(`indexedDB prune failed`))})}async function Xg(e){let t=Bg(e,fg,pg);try{let e=await qg();await new Promise((n,r)=>{let i=e.transaction(Kg,`readwrite`);i.objectStore(Kg).put(t),i.oncomplete=()=>n(),i.onerror=()=>r(i.error??Error(`indexedDB write failed`))}),await Yg(e),e.close()}catch{}}function Zg(e){return{clientId:e,conn:`connecting`,conv:Zh(),role:`observer`,controllerId:null,session:null,model:void 0,sessionName:void 0,contextTokens:void 0,dialog:null,commands:[],statuses:{},widgets:{},title:void 0,notice:null}}var Qg={"no-broker":`no-broker`,"no-node":`no-node`,invalid:`invalid`,transient:`closed`};function $g(e){return e===`welcome`||e===`control_changed`||e===`model_changed`||e===`error`||e===`ack`||e===`data`||e===`display_status`||e===`display_widget`||e===`display_title`||e===`bash_start`||e===`bash_output`||e===`bash_end`||e===`extension_ui_request`||e===`extension_ui_dismiss`}function e_(e,t){switch(t.kind){case`connecting`:return e.conn===`connecting`?e:{...e,conn:`connecting`};case`closed`:{let n=Qg[t.closeKind];return e.conn===n?e:{...e,conn:n}}case`notice`:return e.notice===t.text?e:{...e,notice:t.text};case`dismiss-dialog`:return e.dialog===null?e:{...e,dialog:null};case`frame`:return s_(e,t.frame)}}function t_(e,t){return e.name===t.name&&e.description===t.description&&e.source===t.source&&e.location===t.location&&e.path===t.path&&e.argument_hint===t.argument_hint}function n_(e,t){return e.length===t.length&&e.every((e,n)=>t_(e,t[n]))}function r_(e,t){return e===t?!0:e===void 0||t===void 0?!1:e.placement===t.placement&&e.lines.length===t.lines.length&&e.lines.every((e,n)=>e===t.lines[n])}function i_(e){if(e===void 0||e.trim()===``)return[];try{let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>{if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.name==`string`&&typeof t.description==`string`&&(t.source===`builtin`||t.source===`command`||t.source===`template`)}):[]}catch{return[]}}function a_(e){return{sessionId:e.sessionId,sessionFile:e.sessionFile??null,model:e.model??null,isStreaming:e.isStreaming,thinkingLevel:e.thinkingLevel,steeringMode:e.steeringMode,followUpMode:e.followUpMode,sessionName:e.sessionName??null,autoCompactionEnabled:e.autoCompactionEnabled,pendingMessageCount:e.pendingMessageCount}}function o_(e){let t=e.messages.length-1,n=e.isStreaming&&t>=0?t:null;return{messages:e.messages,streamingIndex:n,executingToolIds:new Set,partialToolResults:new Map,isStreaming:e.isStreaming,activity:e.activity,queued:[]}}function s_(e,t){if(!$g(t.type))return{...e,conv:sg(e.conv,t)};switch(t.type){case`welcome`:{let n=tg(t.snapshot,e.conv),r=t.controller_id,i=a_(t.snapshot.state);return{...e,conn:`open`,conv:n,controllerId:r,role:r===e.clientId?`controller`:`observer`,session:i,model:i.model??void 0,sessionName:i.sessionName??void 0,contextTokens:t.snapshot.stats?.tokens?.total,dialog:t.pending_dialog??null,commands:[]}}case`control_changed`:return e.controllerId===t.controller_id?e:{...e,controllerId:t.controller_id,role:t.controller_id===e.clientId?`controller`:`observer`};case`model_changed`:{let n=t.model??null;return e.model===t.model&&(e.session===null||e.session.model===n)?e:{...e,model:t.model,session:e.session?{...e.session,model:n}:e.session}}case`error`:{let n=t.code===`not_controller`?`read-only — another viewer is the controller`:t.message||`error: ${t.code}`;return e.notice===n?e:{...e,notice:n}}case`extension_ui_request`:return{...e,dialog:t};case`extension_ui_dismiss`:return e.dialog&&e.dialog.id===t.id?{...e,dialog:null}:e;case`display_status`:{let n=e.statuses[t.key];if(t.text===void 0?n===void 0:n===t.text)return e;let r={...e.statuses};return t.text===void 0?delete r[t.key]:r[t.key]=t.text,{...e,statuses:r}}case`display_widget`:{let n=e.widgets[t.key],r=t.lines===void 0?void 0:{lines:t.lines,placement:t.placement};if(r_(n,r))return e;let i={...e.widgets};return r===void 0?delete i[t.key]:i[t.key]=r,{...e,widgets:i}}case`display_title`:return e.title===t.title?e:{...e,title:t.title};case`ack`:{if(t.for!==`get_commands`)return e;let n=t.ok?i_(t.detail):[];return n_(e.commands,n)?e:{...e,commands:n}}case`bash_start`:return{...e,conv:ig(e.conv,t.command,t.excludeFromContext)};case`bash_output`:return{...e,conv:ag(e.conv,t.chunk)};case`bash_end`:return{...e,conv:og(e.conv,t)};default:return e}}var c_=1500,l_=800,u_=5e3,d_=10;function f_(e){return Math.min(u_,l_*2**e)}var p_=class e{nodeId;static CACHE_WRITE_DEBOUNCE_MS=500;clientId;actions;pinned=!1;state;listeners=new Set;client=null;gen=0;timer=null;cacheWriteTimer=null;role=`observer`;streaming=!1;cachedUpdatedAt=0;liveAttached=!1;started=!1;noBrokerAttempts=0;constructor(e){this.nodeId=e,this.clientId=crypto.randomUUID(),this.state=Zg(this.clientId);let t=Hg(e);t&&(this.state={...this.state,conv:o_(t),session:t.sessionState,commands:t.commands,model:t.sessionState?.model??void 0,sessionName:t.sessionState?.sessionName??void 0},this.cachedUpdatedAt=t.updatedAt),this.actions=this.buildActions()}subscribe=e=>(this.ensureStarted(),this.listeners.add(e),()=>{this.listeners.delete(e)});getState=()=>this.state;ensureStarted(){this.started||(this.started=!0,this.hydrateFromFullMirror(),this.dial())}hydrateFromFullMirror(){let e=this.gen;Jg(this.nodeId).then(t=>{if(e===this.gen&&!this.liveAttached&&!(t===null||t.updatedAt<=this.cachedUpdatedAt)){this.state={...this.state,conv:o_(t),session:t.sessionState,commands:t.commands,model:t.sessionState?.model??void 0,sessionName:t.sessionState?.sessionName??void 0},this.cachedUpdatedAt=t.updatedAt;for(let e of this.listeners)e()}})}focus(){this.ensureStarted(),this.pinned=!0,this.state.conn===`open`&&this.send({type:`request_control`})}background(){this.pinned=!1,this.send({type:`release_control`})}dispose(){this.gen+=1,this.timer&&clearTimeout(this.timer),this.cacheWriteTimer&&(clearTimeout(this.cacheWriteTimer),this.cacheWriteTimer=null,this.flushCacheWrite()),this.client?.close(),this.client=null}dispatch(e){let t=this.state,n=e_(t,e);if(n!==t){this.state=n,this.role=n.role,this.streaming=n.conv.isStreaming,e.kind===`frame`&&e.frame.type===`welcome`&&(this.liveAttached=!0),n.conv!==t.conv&&this.scheduleCacheWrite();for(let e of this.listeners)e()}}scheduleCacheWrite(){this.cacheWriteTimer&&clearTimeout(this.cacheWriteTimer),this.cacheWriteTimer=setTimeout(()=>{this.cacheWriteTimer=null,this.flushCacheWrite()},e.CACHE_WRITE_DEBOUNCE_MS)}flushCacheWrite(){let e=gg({nodeId:this.nodeId,messages:this.state.conv.messages,sessionState:this.state.session,commands:this.state.commands,isStreaming:this.state.conv.isStreaming,activity:this.state.conv.activity,updatedAt:Date.now(),source:`broker`});Ug(e),Xg(e),this.cachedUpdatedAt=e.updatedAt}send(e){this.client?.send(e)}dial(){let e=this.gen,t=new qh(this.nodeId,{onOpen:()=>{e===this.gen&&t.send({type:`hello`,role:`observer`,client_id:this.clientId})},onFrame:n=>{e===this.gen&&(this.dispatch({kind:`frame`,frame:n}),n.type===`welcome`&&(t.send({type:`get_commands`}),this.pinned&&t.send({type:`request_control`}),this.noBrokerAttempts=0))},onClose:t=>{if(e===this.gen){if(this.dispatch({kind:`closed`,closeKind:t}),t===`transient`)this.timer=setTimeout(()=>{e===this.gen&&(this.dispatch({kind:`connecting`}),this.dial())},c_);else if(t===`no-broker`&&this.noBrokerAttempts<d_){let t=this.noBrokerAttempts;this.noBrokerAttempts+=1,this.timer=setTimeout(()=>{e===this.gen&&this.dial()},f_(t))}}}});this.client=t,t.connect()}buildActions(){return{sendText:e=>{let t=e.trim();if(t!==``){if(this.role!==`controller`){this.dispatch({kind:`notice`,text:`take control before sending`});return}if(t.startsWith(`!`)){let e=t.startsWith(`!!`),n=t.slice(e?2:1).trim();if(n===``)return;this.send({type:`bash`,command:n,excludeFromContext:e});return}this.send(this.streaming?{type:`steer`,text:t}:{type:`prompt`,text:t})}},abort:()=>{this.role===`controller`&&this.send({type:`abort`})},takeControl:()=>this.send({type:`request_control`}),releaseControl:()=>this.send({type:`release_control`}),setModel:e=>this.send({type:`set_model`,model:e}),cycleModel:()=>this.send({type:`cycle_model`}),setThinkingLevel:e=>this.send({type:`set_thinking_level`,level:e}),compact:e=>this.send({type:`compact`,...e?{instructions:e}:{}}),answerDialog:e=>{this.send(e),this.dispatch({kind:`dismiss-dialog`})},cancelDialog:()=>{let e=this.state.dialog?.id;e!==void 0&&this.send({type:`extension_ui_response`,id:e,cancelled:!0}),this.dispatch({kind:`dismiss-dialog`})},reconnect:()=>{this.timer&&clearTimeout(this.timer),this.gen+=1,this.noBrokerAttempts=0,this.client?.close(),this.dispatch({kind:`connecting`}),this.dial()},clearNotice:()=>this.dispatch({kind:`notice`,text:null})}}},m_=4,h_=new class{handles=new Map;mru=[];poolListeners=new Set;warmIdsSnapshot=[];acquire(e){let t=this.handles.get(e);return t||(t=new p_(e),this.handles.set(e,t)),this.touch(e),this.notifyPool(),this.evictExcess(),t}focus(e){this.handles.get(e)?.focus()}background(e){this.handles.get(e)?.background()}subscribe=e=>(this.poolListeners.add(e),()=>{this.poolListeners.delete(e)});getWarmIds=()=>this.warmIdsSnapshot;evict(e){let t=this.handles.get(e);if(!t)return;t.pinned=!1,t.dispose(),this.handles.delete(e);let n=this.mru.indexOf(e);n!==-1&&this.mru.splice(n,1),this.notifyPool()}touch(e){let t=this.mru.indexOf(e);t!==-1&&this.mru.splice(t,1),this.mru.push(e)}evictExcess(){for(let e=0;e<this.mru.length&&this.mru.length>m_;){let t=this.mru[e],n=this.handles.get(t);if(n?.pinned){e+=1;continue}n?.dispose(),this.handles.delete(t),this.mru.splice(e,1),this.notifyPool()}}notifyPool(){this.warmIdsSnapshot=[...this.mru];for(let e of this.poolListeners)e()}};function g_(e){let t=h_.acquire(e);return{state:(0,v.useSyncExternalStore)(t.subscribe,t.getState),actions:t.actions}}var __={branch:null,model:null,tokens:null,context:null,tool_calls:null,stats:null,git_status:null};function v_(e,t){return{sessionId:t.state?.sessionId??e,sessionFile:t.state?.sessionFile??null,model:t.state?.model??null,isStreaming:!1,thinkingLevel:t.state?.thinkingLevel??`off`,steeringMode:t.state?.steeringMode??`all`,followUpMode:t.state?.followUpMode??`all`,sessionName:t.state?.sessionName??null,autoCompactionEnabled:t.state?.autoCompactionEnabled??!1,pendingMessageCount:t.state?.pendingMessageCount??0}}function y_(e){let{state:t,actions:n}=g_(e),r=up(e=>e.reachable),[i,a]=(0,v.useState)(null);(0,v.useEffect)(()=>{let n=!1;if(t.conn!==`no-broker`){a(null);return}return Jf(e).then(t=>{if(n)return;a(t);let r=gg({nodeId:e,messages:tg(t.snapshot).messages,sessionState:v_(e,t.snapshot),commands:t.commands,isStreaming:!1,activity:null,updatedAt:Date.now(),source:`static`});Ug(r),Xg(r)}).catch(()=>{n||a(null)}),()=>{n=!0}},[e,t.conn]);let o=t.conn===`no-broker`&&i?.node_id===e?i:null,s=(0,v.useMemo)(()=>o===null?null:tg(o.snapshot),[o]),c=(0,v.useMemo)(()=>t.session===null?null:{...t.session,isStreaming:t.conv.isStreaming},[t.session,t.conv.isStreaming]),l=(0,v.useMemo)(()=>t.conn===`connecting`||t.conn===`closed`?null:o===null?c:v_(e,o.snapshot),[e,o,t.conn,c]),u=(0,v.useMemo)(()=>o===null?{...__,model:t.model??null}:{...__,model:o.snapshot.state?.model??null},[o,t.model]),d=s?.messages??t.conv.messages,f=s?.partialToolResults??t.conv.partialToolResults,p=s?.executingToolIds??t.conv.executingToolIds,m=s?.queued??t.conv.queued,h=o?.commands??t.commands;return{messages:d,partialToolResults:f,executingToolIds:p,queued:m,state:l,role:t.role,chrome:u,dialog:t.dialog,commands:h,presence:{viewers:0,controller:t.controllerId},brokerStatus:t.conn===`open`?`connected`:t.conn===`closed`||t.conn===`connecting`?`reconnecting`:`down`,source:t.conn===`no-broker`?`static`:`broker`,serverConnected:r,socketReady:t.conn===`open`,error:t.notice?{code:`broker_unavailable`,message:t.notice}:null,reconnect:n.reconnect,prompt:e=>n.sendText(e),steer:e=>n.sendText(e),abort:n.abort,setModel:n.setModel,cycleModel:n.cycleModel,setThinkingLevel:n.setThinkingLevel,compact:n.compact,requestControl:n.takeControl,releaseControl:n.releaseControl,dialogResponse:(e,t)=>n.answerDialog({type:`extension_ui_response`,id:e,...t})}}var b_=400,x_=4e3;function S_(e){return e.dormant&&e.status===`active`&&e.socketReady&&e.attempt<8}function C_(e){return Math.min(x_,b_*2**Math.max(0,e))}var w_=1,T_=400;function E_(e){return`crtr.web.draft.${e}`}function D_(e,t){if(typeof t!=`object`||!t)return!1;let n=t;return n.schemaVersion===w_&&n.nodeId===e&&typeof n.text==`string`&&typeof n.updatedAt==`number`}function O_(e){try{let t=globalThis.localStorage?.getItem(E_(e));if(t==null)return``;let n=JSON.parse(t);return D_(e,n)?n.text:``}catch{return``}}function k_(e,t){let n={schemaVersion:w_,nodeId:e,text:t,updatedAt:Date.now()};try{globalThis.localStorage?.setItem(E_(e),JSON.stringify(n))}catch{}}function A_(e){try{globalThis.localStorage?.removeItem(E_(e))}catch{}}var j_=new Map;function M_(e,t){let n=j_.get(e);n&&clearTimeout(n);let r=setTimeout(()=>{j_.delete(e),t===``?A_(e):k_(e,t)},T_);j_.set(e,r)}function N_(e){let t=j_.get(e);t&&(clearTimeout(t),j_.delete(e))}function P_(e){let t=y_(e),[n,r]=(0,v.useState)(null);(0,v.useEffect)(()=>(h_.focus(e),()=>{h_.background(e)}),[e]);let[i,a]=(0,v.useState)(``);(0,v.useEffect)(()=>{a(O_(e))},[e]),(0,v.useEffect)(()=>{M_(e,i)},[e,i]);let[o,s]=(0,v.useState)(!1),[c,l]=(0,v.useState)(null),[u,d]=(0,v.useState)(null),f=t.source===`static`,p=t.brokerStatus===`connected`,m=t.role===`controller`,h=t.state?.isStreaming??!1,g=m&&!f&&p&&t.serverConnected,_=t.commands;(0,v.useEffect)(()=>{let t=!1;return qf(e).then(e=>{t||r(e)}).catch(e=>{t||l(F_(e))}),()=>{t=!0}},[e]);let y=(0,v.useRef)(0);(0,v.useEffect)(()=>{y.current=0},[e]),(0,v.useEffect)(()=>{if(!S_({dormant:f,status:n?.status,socketReady:t.socketReady,attempt:y.current}))return;let e=y.current;y.current+=1;let r=setTimeout(()=>t.reconnect(),C_(e));return()=>clearTimeout(r)},[f,n?.status,t.socketReady,t.reconnect]);let b=()=>{let n=i.trim();!n||!g||(h?t.steer(n):t.prompt(n),N_(e),A_(e),a(``))};return{store:t,detail:n,input:i,setInput:a,reviving:o,actionError:c,peekedPath:u,setPeekedPath:d,dormant:f,brokerUp:p,isController:m,streaming:h,canDrive:g,commands:_,sendPrimary:b,onInputKeyDown:e=>{Jm(e,a,b)},selectCommand:e=>{a(`/${e.name} `)},doRevive:async()=>{s(!0),l(null);try{await Zf(e),t.reconnect()}catch(e){l(F_(e))}finally{s(!1)}},doClose:async()=>{l(null);try{await Qf(e)}catch(e){l(F_(e))}}}}function F_(e){return e instanceof Uf?`${e.code}: ${e.message}`:String(e)}function I_(e){let t=(0,v.useMemo)(()=>{let t=e.query;return t.startsWith(`/`)?t.slice(1).trimStart().toLowerCase():``},[e.query]),n=(0,v.useMemo)(()=>{let n=e.commands;return t?n.filter(e=>e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.source.toLowerCase().includes(t)):n},[t,e.commands]);return e.visible?(0,B.jsx)(`div`,{className:`absolute bottom-full left-0 right-0 z-20 mb-1 max-h-72 overflow-auto border border-border bg-popover`,children:n.length>0?(0,B.jsx)(`ul`,{className:`flex flex-col divide-y divide-border/40`,children:n.map(t=>(0,B.jsxs)(`li`,{className:`flex cursor-pointer flex-wrap items-baseline gap-x-2 gap-y-0.5 px-3 py-2 hover:bg-accent/50`,onClick:()=>e.onSelect(t),children:[(0,B.jsxs)(`span`,{className:`font-mono text-sm font-semibold text-primary`,children:[`/`,t.name]}),t.argument_hint&&(0,B.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground/70`,children:t.argument_hint}),(0,B.jsxs)(`span`,{className:`ml-auto font-mono text-xs text-muted-foreground/50`,children:[t.source,t.location&&(0,B.jsxs)(B.Fragment,{children:[` · `,t.location]})]}),(0,B.jsx)(`span`,{className:`basis-full text-xs text-muted-foreground`,children:t.description})]},t.name))}):(0,B.jsx)(`div`,{className:`px-3 py-2 text-xs italic text-muted-foreground`,children:`no matching commands`})}):null}var L_=new Set([`select`,`confirm`,`input`,`editor`,`notify`]);function R_(e){return L_.has(e.method)}function z_(e){let t=e.store.dialog,n=t&&R_(t)?t:null,r=e.store.role===`controller`;return(0,B.jsx)(Dp,{open:n!==null,children:(0,B.jsx)(Ap,{showCloseButton:!1,className:n&&!r?`opacity-90`:void 0,children:n&&(r?(0,B.jsx)(W_,{req:n,store:e.store},n.id):(0,B.jsx)(B_,{req:n},n.id))})})}function B_(e){return(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsx)(`p`,{className:`text-sm font-semibold`,children:`The controller is being prompted`}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:U_(e.req)})]})}function V_(e){switch(e){case`error`:return`border-destructive/40 text-destructive`;case`warning`:return`border-warning/40 text-warning`;case`success`:return`border-success/40 text-success`;default:return`border-border text-foreground`}}function H_(e){let t=/https?:\/\/[^\s]+/g;return e.split(`
52
52
  `).map((e,n)=>{let r=[],i=0,a;for(;a=t.exec(e);)a.index>i&&r.push(e.slice(i,a.index)),r.push((0,B.jsx)(`a`,{href:a[0],target:`_blank`,rel:`noopener noreferrer`,className:`underline break-all`,children:a[0]},a.index)),i=a.index+a[0].length;return i<e.length&&r.push(e.slice(i)),(0,B.jsxs)(`span`,{children:[n>0&&(0,B.jsx)(`br`,{}),r]},n)})}function U_(e){switch(e.method){case`select`:return`${e.title} — ${e.options.length} options`;case`confirm`:return`${e.title}: ${e.message}`;case`input`:return e.title;case`editor`:return e.title;case`notify`:return e.message}}function W_(e){let t=()=>e.store.dialogResponse(e.req.id,{cancelled:!0});return e.req.method===`select`?(0,B.jsx)(G_,{req:e.req,store:e.store,cancel:t}):(0,B.jsx)(K_,{req:e.req,store:e.store,cancel:t})}function G_(e){return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(jp,{children:(0,B.jsx)(Np,{children:e.req.title})}),(0,B.jsx)(`ul`,{className:`flex flex-col gap-2`,children:e.req.options.map(t=>(0,B.jsx)(`li`,{children:(0,B.jsx)(Z,{variant:`secondary`,className:`w-full justify-start`,onClick:()=>e.store.dialogResponse(e.req.id,{value:t}),children:t})},t))}),(0,B.jsx)(Mp,{children:(0,B.jsx)(Z,{type:`button`,variant:`secondary`,onClick:e.cancel,children:`Cancel`})})]})}function K_(e){let[t,n]=(0,v.useState)(e.req.method===`editor`?e.req.prefill??``:``);if(e.req.method===`confirm`){let t=e.req;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(jp,{children:(0,B.jsx)(Np,{children:t.title})}),(0,B.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:t.message}),(0,B.jsxs)(Mp,{children:[(0,B.jsx)(Z,{variant:`secondary`,onClick:()=>e.store.dialogResponse(t.id,{confirmed:!1}),children:`No`}),(0,B.jsx)(Z,{onClick:()=>e.store.dialogResponse(t.id,{confirmed:!0}),children:`Yes`})]})]})}if(e.req.method===`input`||e.req.method===`editor`){let r=e.req;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(jp,{children:(0,B.jsx)(Np,{children:H_(r.title)})}),r.method===`editor`?(0,B.jsx)(Wp,{className:`resize-none font-mono text-sm`,rows:8,value:t,onChange:e=>n(e.currentTarget.value),autoFocus:!0}):(0,B.jsx)(Fp,{placeholder:r.placeholder??``,value:t,onChange:e=>n(e.currentTarget.value),autoFocus:!0}),(0,B.jsxs)(Mp,{children:[(0,B.jsx)(Z,{type:`button`,variant:`secondary`,onClick:e.cancel,children:`Cancel`}),(0,B.jsx)(Z,{onClick:()=>e.store.dialogResponse(r.id,{value:t}),children:`Submit`})]})]})}if(e.req.method===`notify`){let t=e.req;return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:Y(`rounded-none border px-3 py-2 text-sm`,V_(t.notifyType)),children:H_(t.message)}),(0,B.jsx)(Mp,{children:(0,B.jsx)(Z,{onClick:()=>e.store.dialogResponse(t.id,{confirmed:!0}),children:`OK`})})]})}return null}function q_(e,t,n){let r=Array(e);return new Proxy(r,{get(r,i,a){if(typeof i==`string`){let a=i.charCodeAt(0);if(a>=48&&a<=57){let a=+i;if(Number.isInteger(a)&&a>=0&&a<e){let e=r[a];if(!e){let i=t[a*2];e=r[a]={index:a,key:n(a),start:i,size:t[a*2+1],end:i+t[a*2+1],lane:0}}return e}}if(i===`length`)return e}return Reflect.get(r,i,a)}})}function J_(e,t,n){let r=n.initialDeps??[],i,a=!0;function o(){let o=e();return o.length!==r.length||o.some((e,t)=>r[t]!==e)?(r=o,i=t(...o),n?.onChange&&!(a&&n.skipInitialOnChange)&&n.onChange(i),a=!1,i):i}return o.updateDeps=e=>{r=e},o}function Y_(e,t){if(e===void 0)throw Error(`Unexpected undefined${t?`: ${t}`:``}`);return e}var X_=(e,t)=>Math.abs(e-t)<1.01,Z_=(e,t,n)=>{let r;return function(...i){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,i),n)}},Q_,$_=()=>{if(Q_!==void 0)return Q_;if(typeof navigator>`u`)return Q_=!1;if(/iP(hone|od|ad)/.test(navigator.userAgent))return Q_=!0;let e=navigator.maxTouchPoints;return Q_=navigator.platform===`MacIntel`&&e!==void 0&&e>0},ev=e=>{let{offsetWidth:t,offsetHeight:n}=e;return{width:t,height:n}},tv=e=>e,nv=e=>{let t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1)-t+1,r=Array(n);for(let e=0;e<n;e++)r[e]=t+e;return r},rv=(e,t)=>{let n=e.scrollElement;if(!n)return;let r=e.targetWindow;if(!r)return;let i=e=>{let{width:n,height:r}=e;t({width:Math.round(n),height:Math.round(r)})};if(i(ev(n)),!r.ResizeObserver)return()=>{};let a=new r.ResizeObserver(t=>{let r=()=>{let e=t[0];if(e?.borderBoxSize){let t=e.borderBoxSize[0];if(t){i({width:t.inlineSize,height:t.blockSize});return}}i(ev(n))};e.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(r):r()});return a.observe(n,{box:`border-box`}),()=>{a.unobserve(n)}},iv={passive:!0},av=typeof window>`u`||`onscrollend`in window,ov=(e,t,n)=>{let r=e.scrollElement;if(!r)return;let i=e.targetWindow;if(!i)return;let a=e.options.useScrollendEvent&&av,o=0,s=a?null:Z_(i,()=>t(o,!1),e.options.isScrollingResetDelay),c=e=>()=>{o=n(r),s?.(),t(o,e)},l=c(!0),u=c(!1);return r.addEventListener(`scroll`,l,iv),a&&r.addEventListener(`scrollend`,u,iv),()=>{r.removeEventListener(`scroll`,l),a&&r.removeEventListener(`scrollend`,u)}},sv=(e,t)=>ov(e,t,t=>{let{horizontal:n,isRtl:r}=e.options;return n?t.scrollLeft*(r&&-1||1):t.scrollTop}),cv=(e,t,n)=>{if(n.options.useCachedMeasurements){let t=n.indexFromElement(e),r=n.options.getItemKey(t);return n.itemSizeCache.get(r)??n.options.estimateSize(t)}if(t?.borderBoxSize){let e=t.borderBoxSize[0];if(e)return Math.round(e[n.options.horizontal?`inlineSize`:`blockSize`])}if(!t){let t=n.indexFromElement(e),r=n.options.getItemKey(t),i=n.itemSizeCache.get(r);if(i!==void 0)return i}return e[n.options.horizontal?`offsetWidth`:`offsetHeight`]},lv=(e,{adjustments:t=0,behavior:n},r)=>{var i,a;(a=(i=r.scrollElement)?.scrollTo)==null||a.call(i,{[r.options.horizontal?`left`:`top`]:e+t,behavior:n})},uv=class{constructor(e){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollState=null,this.measurementsCache=[],this._flatMeasurements=null,this.itemSizeCache=new Map,this.itemSizeCacheVersion=0,this.laneAssignments=new Map,this.pendingMin=null,this.prevLanes=void 0,this.lanesChangedFlag=!1,this.lanesSettling=!1,this.pendingScrollAnchor=null,this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this._iosDeferredAdjustment=0,this._iosTouching=!1,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._intendedScrollOffset=null,this.elementsCache=new Map,this.now=()=>{var e;return((e=this.targetWindow?.performance)?.now)?.call(e)??Date.now()},this.observer=(()=>{let e=null,t=()=>e||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:e=new this.targetWindow.ResizeObserver(e=>{e.forEach(e=>{let t=()=>{let t=e.target,n=this.indexFromElement(t);if(!t.isConnected){this.observer.unobserve(t);for(let[e,n]of this.elementsCache)if(n===t){this.elementsCache.delete(e);break}return}this.shouldMeasureDuringScroll(n)&&this.resizeItem(n,this.options.measureElement(t,e,this))};this.options.useAnimationFrameWithResizeObserver?requestAnimationFrame(t):t()})}));return{disconnect:()=>{var n;(n=t())==null||n.disconnect(),e=null},observe:e=>t()?.observe(e,{box:`border-box`}),unobserve:e=>t()?.unobserve(e)}})(),this.range=null,this.setOptions=e=>{let t={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:tv,rangeExtractor:nv,onChange:()=>{},measureElement:cv,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:`data-index`,initialMeasurementsCache:[],lanes:1,anchorTo:`start`,followOnAppend:!1,scrollEndThreshold:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,useScrollendEvent:!1,useAnimationFrameWithResizeObserver:!1,laneAssignmentMode:`estimate`,useCachedMeasurements:!1};for(let n in e){let r=e[n];r!==void 0&&(t[n]=r)}let n=this.options,r=null,i=null,a=!1;if(n!==void 0&&n.enabled&&t.enabled&&t.anchorTo===`end`&&this.scrollElement!==null){let e=n.count,o=t.count,s=this.getMeasurements(),c=e>0?s[0]?.key??n.getItemKey(0):null,l=e>0?s[e-1]?.key??n.getItemKey(e-1):null;if(o!==e||e>0&&o>0&&(t.getItemKey(0)!==c||t.getItemKey(o-1)!==l)){a=!0;let c=e>0?this.getVirtualItemForOffset(this.getScrollOffset())??s[0]:null;c&&(r=[c.key,this.getScrollOffset()-c.start]);let u=t.followOnAppend===!0?`auto`:t.followOnAppend||null;u&&o>e&&this.isAtEnd(n.scrollEndThreshold)&&(e===0||t.getItemKey(o-1)!==l)&&(i=u)}}this.options=t,a&&(this.pendingMin=0,this.itemSizeCacheVersion++);let o=!1,s=0;if(r&&this.scrollOffset!==null){let[e,t]=r,n=this.getMeasurements(),{count:i,getItemKey:a}=this.options,c=0;for(;c<i&&a(c)!==e;)c++;if(c<i){let e=n[c];if(e){let n=e.start+t;n!==this.scrollOffset&&(s=n-this.scrollOffset,this.scrollOffset=n,o=!0)}}}(o||i)&&(this.pendingScrollAnchor=[o?r[0]:null,o?r[1]:0,i,s])},this.notify=e=>{var t,n;(n=(t=this.options).onChange)==null||n.call(t,this,e)},this.maybeNotify=J_(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),e=>{this.notify(e)},{key:!1,debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(e=>e()),this.unsubs=[],this.observer.disconnect(),this.rafId!=null&&this.targetWindow&&(this.targetWindow.cancelAnimationFrame(this.rafId),this.rafId=null),this.scrollState=null,this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{let e=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==e){if(this.cleanup(),!e){this.maybeNotify();return}if(this.scrollElement=e,this.scrollElement&&`ownerDocument`in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=this.scrollElement?.window??null,this.elementsCache.forEach(e=>{this.observer.observe(e)}),this.unsubs.push(this.options.observeElementRect(this,e=>{this.scrollRect=e,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(e,t)=>{if(t&&this._intendedScrollOffset===null&&e===this.scrollOffset)return;this._intendedScrollOffset!==null&&Math.abs(e-this._intendedScrollOffset)<1.5&&(e=this._intendedScrollOffset),this._intendedScrollOffset=null,this.scrollAdjustments=0;let n=this.getScrollOffset();this.scrollDirection=t?n===e?this.scrollDirection:n<e?`forward`:`backward`:null,this.scrollOffset=e,this.isScrolling=t,this._flushIosDeferredIfReady(),this.scrollState&&this.scheduleScrollReconcile(),this.maybeNotify()})),`addEventListener`in this.scrollElement){let e=this.scrollElement,t=()=>{this._iosTouching=!0,this._iosJustTouchEnded=!1,this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)},n=()=>{this._iosTouching=!1,!(!$_()||this.targetWindow==null)&&(this._iosJustTouchEnded=!0,this._iosTouchEndTimerId=this.targetWindow.setTimeout(()=>{this._iosJustTouchEnded=!1,this._iosTouchEndTimerId=null,this._flushIosDeferredIfReady()},150))};e.addEventListener(`touchstart`,t,iv),e.addEventListener(`touchend`,n,iv),this.unsubs.push(()=>{e.removeEventListener(`touchstart`,t),e.removeEventListener(`touchend`,n),this._iosTouchEndTimerId!==null&&this.targetWindow!=null&&(this.targetWindow.clearTimeout(this._iosTouchEndTimerId),this._iosTouchEndTimerId=null)})}this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})}let t=this.pendingScrollAnchor;if(this.pendingScrollAnchor=null,t&&this.scrollElement&&this.options.enabled){let[e,n,r,i]=t;e!==null&&!r&&($_()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?i!==0&&(this._iosDeferredAdjustment+=i):this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0})),r&&this.scrollToEnd({behavior:r})}},this._flushIosDeferredIfReady=()=>{if(this._iosDeferredAdjustment===0||this.isScrolling||this._iosTouching||this._iosJustTouchEnded)return;let e=this.getScrollOffset(),t=this.getMaxScrollOffset();if(e<0||e>t)return;let n=this._iosDeferredAdjustment;this._iosDeferredAdjustment=0,this._scrollToOffset(e,{adjustments:this.scrollAdjustments+=n,behavior:void 0})},this.rafId=null,this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?`width`:`height`]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset==`function`?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(e,t)=>{let n=new Map,r=new Map;for(let i=t-1;i>=0;i--){let t=e[i];if(n.has(t.lane))continue;let a=r.get(t.lane);if(a==null||t.end>a.end?r.set(t.lane,t):t.end<a.end&&n.set(t.lane,!0),n.size===this.options.lanes)break}return r.size===this.options.lanes?Array.from(r.values()).sort((e,t)=>e.end===t.end?e.index-t.index:e.end-t.end)[0]:void 0},this.getMeasurementOptions=J_(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled,this.options.lanes,this.options.laneAssignmentMode],(e,t,n,r,i,a,o)=>(this.prevLanes!==void 0&&this.prevLanes!==a&&(this.lanesChangedFlag=!0),this.prevLanes=a,this.pendingMin=null,{count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o}),{key:!1}),this.getMeasurements=J_(()=>[this.getMeasurementOptions(),this.itemSizeCacheVersion],({count:e,paddingStart:t,scrollMargin:n,getItemKey:r,enabled:i,lanes:a,laneAssignmentMode:o},s)=>{let c=this.itemSizeCache;if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),[];if(this.laneAssignments.size>e)for(let t of this.laneAssignments.keys())t>=e&&this.laneAssignments.delete(t);this.lanesChangedFlag&&(this.lanesChangedFlag=!1,this.lanesSettling=!0,this.measurementsCache=[],this.itemSizeCache.clear(),this.laneAssignments.clear(),this.pendingMin=null),this.measurementsCache.length===0&&!this.lanesSettling&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(e=>{this.itemSizeCache.set(e.key,e.size)}));let l=this.lanesSettling?0:this.pendingMin??0;if(this.pendingMin=null,this.lanesSettling&&this.measurementsCache.length===e&&(this.lanesSettling=!1),a===1){let i=this.options.gap,a=e*2,o=this._flatMeasurements;if(!o||o.length<a){let e=new Float64Array(a);o&&l>0&&e.set(o.subarray(0,l*2)),o=e,this._flatMeasurements=o}let s;if(l===0)s=t+n;else{let e=l-1;s=o[e*2]+o[e*2+1]+i}for(let t=l;t<e;t++){let e=r(t),n=c.get(e),a=typeof n==`number`?n:this.options.estimateSize(t);o[t*2]=s,o[t*2+1]=a,s+=a+i}let u=q_(e,o,r);return this.measurementsCache=u,u}let u=this.measurementsCache.slice(0,l),d=Array(a).fill(void 0);for(let e=0;e<l;e++){let t=u[e];t&&(d[t.lane]=e)}for(let i=l;i<e;i++){let e=r(i),a=this.laneAssignments.get(i),s,l,f=o===`estimate`||c.has(e);if(a!==void 0&&this.options.lanes>1){s=a;let e=d[s],r=e===void 0?void 0:u[e];l=r?r.end+this.options.gap:t+n}else{let e=this.options.lanes===1?u[i-1]:this.getFurthestMeasurement(u,i);l=e?e.end+this.options.gap:t+n,s=e?e.lane:i%this.options.lanes,this.options.lanes>1&&f&&this.laneAssignments.set(i,s)}let p=c.get(e),m=typeof p==`number`?p:this.options.estimateSize(i),h=l+m;u[i]={index:i,start:l,size:m,end:h,key:e,lane:s},d[s]=i}return this.measurementsCache=u,u},{key:!1,debug:()=>this.options.debug}),this.calculateRange=J_(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset(),this.options.lanes],(e,t,n,r)=>e.length===0||t===0?(this.range=null,null):(this.range=pv(e,t,n,r,r===1&&this._flatMeasurements!=null?this._flatMeasurements:null),this.range),{key:!1,debug:()=>this.options.debug}),this.getVirtualIndexes=J_(()=>{let e=null,t=null,n=this.calculateRange();return n&&(e=n.startIndex,t=n.endIndex),this.maybeNotify.updateDeps([this.isScrolling,e,t]),[this.options.rangeExtractor,this.options.overscan,this.options.count,e,t]},(e,t,n,r,i)=>r===null||i===null?[]:e({startIndex:r,endIndex:i,overscan:t,count:n}),{key:!1,debug:()=>this.options.debug}),this.indexFromElement=e=>{let t=this.options.indexAttribute,n=e.getAttribute(t);return n?parseInt(n,10):(console.warn(`Missing attribute name '${t}={index}' on measured element.`),-1)},this.shouldMeasureDuringScroll=e=>{if(!this.scrollState||this.scrollState.behavior!==`smooth`)return!0;let t=this.scrollState.index??this.getVirtualItemForOffset(this.scrollState.lastTargetOffset)?.index;if(t!==void 0&&this.range){let n=Math.max(this.options.overscan,Math.ceil((this.range.endIndex-this.range.startIndex)/2)),r=Math.max(0,t-n),i=Math.min(this.options.count-1,t+n);return e>=r&&e<=i}return!0},this.measureElement=e=>{if(!e){this.elementsCache.forEach((e,t)=>{e.isConnected||(this.observer.unobserve(e),this.elementsCache.delete(t))});return}let t=this.indexFromElement(e),n=this.options.getItemKey(t),r=this.elementsCache.get(n);r!==e&&(r&&this.observer.unobserve(r),this.observer.observe(e),this.elementsCache.set(n,e)),(!this.isScrolling||this.scrollState)&&this.shouldMeasureDuringScroll(t)&&this.resizeItem(t,this.options.measureElement(e,void 0,this))},this.resizeItem=(e,t)=>{if(e<0||e>=this.options.count)return;let n,r,i,a=this._flatMeasurements;if(this.options.lanes===1&&a!==null)i=this.options.getItemKey(e),r=a[e*2],n=a[e*2+1];else{let t=this.measurementsCache[e];if(!t)return;i=t.key,r=t.start,n=t.size}let o=t-(this.itemSizeCache.get(i)??n);if(o!==0){let a=this.options.anchorTo===`end`&&this.scrollState?.behavior!==`smooth`&&this.getVirtualDistanceFromEnd()<=this.options.scrollEndThreshold,s=a?this.getTotalSize():0,c=this.scrollState?.behavior!==`smooth`&&(this.shouldAdjustScrollPositionOnItemSizeChange===void 0?r<this.getScrollOffset()+this.scrollAdjustments&&(!this.itemSizeCache.has(i)||this.scrollDirection!==`backward`):this.shouldAdjustScrollPositionOnItemSizeChange(this.measurementsCache[e]??{index:e,key:i,start:r,size:n,end:r+n,lane:0},o,this));(this.pendingMin===null||e<this.pendingMin)&&(this.pendingMin=e),this.itemSizeCache.set(i,t),this.itemSizeCacheVersion++,a?this.applyScrollAdjustment(this.getTotalSize()-s):c&&this.applyScrollAdjustment(o),this.notify(!1)}},this.getVirtualItems=J_(()=>[this.getVirtualIndexes(),this.getMeasurements()],(e,t)=>{let n=[];for(let r=0,i=e.length;r<i;r++){let i=t[e[r]];n.push(i)}return n},{key:!1,debug:()=>this.options.debug}),this.getVirtualItemForOffset=e=>{let t=this.getMeasurements();if(t.length===0)return;let n=this._flatMeasurements,r=this.options.lanes===1&&n!=null;return Y_(t[dv(0,t.length-1,r?e=>n[e*2]:e=>Y_(t[e]).start,e)])},this.getMaxScrollOffset=()=>{if(!this.scrollElement)return 0;if(`scrollHeight`in this.scrollElement)return this.options.horizontal?this.scrollElement.scrollWidth-this.scrollElement.clientWidth:this.scrollElement.scrollHeight-this.scrollElement.clientHeight;{let e=this.scrollElement.document.documentElement;return this.options.horizontal?e.scrollWidth-this.scrollElement.innerWidth:e.scrollHeight-this.scrollElement.innerHeight}},this.getVirtualDistanceFromEnd=()=>Math.max(this.getTotalSize()-this.getSize()-this.getScrollOffset(),0),this.getDistanceFromEnd=()=>Math.max(this.getMaxScrollOffset()-this.getScrollOffset(),0),this.isAtEnd=(e=this.options.scrollEndThreshold)=>this.getDistanceFromEnd()<=e,this.getOffsetForAlignment=(e,t,n=0)=>{if(!this.scrollElement)return 0;let r=this.getSize(),i=this.getScrollOffset();t===`auto`&&(t=e>=i+r?`end`:`start`),t===`center`?e+=(n-r)/2:t===`end`&&(e-=r);let a=this.getMaxScrollOffset();return Math.max(Math.min(a,e),0)},this.getOffsetForIndex=(e,t=`auto`)=>{e=Math.max(0,Math.min(e,this.options.count-1));let n=this.getSize(),r=this.getScrollOffset(),i=this.measurementsCache[e];if(!i)return;if(t===`auto`)if(i.end>=r+n-this.options.scrollPaddingEnd)t=`end`;else if(i.start<=r+this.options.scrollPaddingStart)t=`start`;else return[r,t];if(t===`end`&&e===this.options.count-1)return[this.getMaxScrollOffset(),t];let a=t===`end`?i.end+this.options.scrollPaddingEnd:i.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,t,i.size),t]},this.scrollToOffset=(e,{align:t=`start`,behavior:n=`auto`}={})=>{let r=this.getOffsetForAlignment(e,t),i=this.now();this.scrollState={index:null,align:t,behavior:n,startedAt:i,lastTargetOffset:r,stableFrames:0},this._scrollToOffset(r,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollToIndex=(e,{align:t=`auto`,behavior:n=`auto`}={})=>{e=Math.max(0,Math.min(e,this.options.count-1));let r=this.getOffsetForIndex(e,t);if(!r)return;let[i,a]=r,o=this.now();this.scrollState={index:e,align:a,behavior:n,startedAt:o,lastTargetOffset:i,stableFrames:0},this._scrollToOffset(i,{adjustments:void 0,behavior:n}),this.scheduleScrollReconcile()},this.scrollBy=(e,{behavior:t=`auto`}={})=>{let n=this.getScrollOffset()+e,r=this.now();this.scrollState={index:null,align:`start`,behavior:t,startedAt:r,lastTargetOffset:n,stableFrames:0},this._scrollToOffset(n,{adjustments:void 0,behavior:t}),this.scheduleScrollReconcile()},this.scrollToEnd=({behavior:e=`auto`}={})=>{if(this.options.count>0){this.scrollToIndex(this.options.count-1,{align:`end`,behavior:e});return}this.scrollToOffset(Math.max(this.getTotalSize()-this.getSize(),0),{behavior:e})},this.getTotalSize=()=>{let e=this.getMeasurements(),t;if(e.length===0)t=this.options.paddingStart;else if(this.options.lanes===1){let n=e.length-1,r=this._flatMeasurements;t=r==null?e[n]?.end??0:r[n*2]+r[n*2+1]}else{let n=Array(this.options.lanes).fill(null),r=e.length-1;for(;r>=0&&n.some(e=>e===null);){let t=e[r];n[t.lane]===null&&(n[t.lane]=t.end),r--}t=Math.max(...n.filter(e=>e!==null))}return Math.max(t-this.options.scrollMargin+this.options.paddingEnd,0)},this.takeSnapshot=()=>{let e=[];if(this.itemSizeCache.size===0)return e;let t=this.getMeasurements();for(let n of t)n&&this.itemSizeCache.has(n.key)&&e.push({index:n.index,key:n.key,start:n.start,size:n.size,end:n.end,lane:n.lane});return e},this._scrollToOffset=(e,{adjustments:t,behavior:n})=>{this._intendedScrollOffset=e+(t??0),this.options.scrollToFn(e,{behavior:n,adjustments:t},this)},this.measure=()=>{this.pendingMin=null,this.itemSizeCache.clear(),this.laneAssignments.clear(),this.itemSizeCacheVersion++,this.notify(!1)},this.setOptions(e)}applyScrollAdjustment(e,t){e!==0&&($_()&&(this.isScrolling||this._iosTouching||this._iosJustTouchEnded)?this._iosDeferredAdjustment+=e:(this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=e,behavior:t}),this.scrollOffset!==null&&(this.scrollOffset+=this.scrollAdjustments,this.scrollAdjustments=0)))}scheduleScrollReconcile(){if(!this.targetWindow){this.scrollState=null;return}this.rafId??=this.targetWindow.requestAnimationFrame(()=>{this.rafId=null,this.reconcileScroll()})}reconcileScroll(){if(!this.scrollState||!this.scrollElement)return;if(this.now()-this.scrollState.startedAt>5e3){this.scrollState=null;return}let e=this.scrollState.index==null?void 0:this.getOffsetForIndex(this.scrollState.index,this.scrollState.align),t=e?e[0]:this.scrollState.lastTargetOffset,n=t!==this.scrollState.lastTargetOffset;if(!n&&X_(t,this.getScrollOffset())){if(this.scrollState.stableFrames++,this.scrollState.stableFrames>=1){this.getScrollOffset()!==t&&this._scrollToOffset(t,{adjustments:void 0,behavior:`auto`}),this.scrollState=null;return}}else if(this.scrollState.stableFrames=0,n){let e=this.getSize()||600,n=Math.abs(t-this.getScrollOffset()),r=this.scrollState.behavior===`smooth`&&n>e;this.scrollState.lastTargetOffset=t,r||(this.scrollState.behavior=`auto`),this._scrollToOffset(t,{adjustments:void 0,behavior:r?`smooth`:`auto`})}this.scheduleScrollReconcile()}},dv=(e,t,n,r)=>{for(;e<=t;){let i=(e+t)/2|0,a=n(i);if(a<r)e=i+1;else if(a>r)t=i-1;else return i}return e>0?e-1:0};function fv(e,t,n){let r=0;for(;r<=t;){let i=(r+t)/2|0,a=e[i*2];if(a<n)r=i+1;else if(a>n)t=i-1;else return i}return r>0?r-1:0}function pv(e,t,n,r,i){let a=e.length-1;if(e.length<=r)return{startIndex:0,endIndex:a};if(r===1&&i!==null){let e=fv(i,a,n),r=e,o=n+t;for(;r<a&&i[r*2]+i[r*2+1]<o;)r++;return{startIndex:e,endIndex:r}}let o=dv(0,a,t=>e[t].start,n),s=o;if(r===1)for(;s<a&&e[s].end<n+t;)s++;else if(r>1){let i=Array(r).fill(0);for(;s<a&&i.some(e=>e<n+t);){let t=e[s];i[t.lane]=t.end,s++}let c=Array(r).fill(n+t);for(;o>=0&&c.some(e=>e>=n);){let t=e[o];c[t.lane]=t.start,o--}o=Math.max(0,o-o%r),s=Math.min(a,s+(r-1-s%r))}return{startIndex:o,endIndex:s}}var mv=typeof document<`u`?v.useLayoutEffect:v.useEffect;function hv({useFlushSync:e=!0,directDomUpdates:t=!1,directDomUpdatesMode:n=`transform`,...r}){let i=v.useReducer(e=>e+1,0)[1],a=v.useRef({enabled:t,mode:n,container:null,lastSize:null,lastPositions:new WeakMap,prevRange:null});a.current.enabled=t,a.current.mode=n;let o=e=>{let t=a.current;if(!t.enabled||!t.container)return;let n=e.getTotalSize();if(n!==t.lastSize){t.lastSize=n;let r=e.options.horizontal?`width`:`height`;t.container.style[r]=`${n}px`}let r=!!e.options.horizontal,i=t.mode===`transform`,o=r?`left`:`top`,s=e.options.scrollMargin,c=e.getVirtualItems();for(let n of c){let a=n.start-s,c=e.elementsCache.get(n.key);c&&t.lastPositions.get(c)!==a&&(t.lastPositions.set(c,a),i?c.style.transform=r?`translate3d(${a}px, 0, 0)`:`translate3d(0, ${a}px, 0)`:c.style[o]=`${a}px`)}},s={...r,onChange:(t,n)=>{var s;let c=a.current,l=!0;if(c.enabled){o(t);let e=t.range,n=c.prevRange;l=!n||n.isScrolling!==t.isScrolling||n.startIndex!==e?.startIndex||n.endIndex!==e?.endIndex,l&&(c.prevRange=e?{startIndex:e.startIndex,endIndex:e.endIndex,isScrolling:t.isScrolling}:null)}l&&(e&&n?(0,y.flushSync)(i):i()),(s=r.onChange)==null||s.call(r,t,n)}},[c]=v.useState(()=>{let e=new uv(s);return Object.assign(e,{containerRef:t=>{let n=a.current;if(n.container=t,n.lastSize=null,t&&n.enabled){let r=e.getTotalSize();n.lastSize=r;let i=e.options.horizontal?`width`:`height`;t.style[i]=`${r}px`}}})});return c.setOptions(s),mv(()=>c._didMount(),[]),mv(()=>c._willUpdate()),mv(()=>{o(c)}),c}function gv(e){return hv({observeElementRect:rv,observeElementOffset:sv,scrollToFn:lv,...e})}var _v={};function vv(e){let t=_v[e];if(t)return t;t=_v[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);t.push(n)}for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[r]=`%`+(`0`+r.toString(16).toUpperCase()).slice(-2)}return t}function yv(e,t){typeof t!=`string`&&(t=yv.defaultChars);let n=vv(t);return e.replace(/(%[a-f0-9]{2})+/gi,function(e){let t=``;for(let r=0,i=e.length;r<i;r+=3){let a=parseInt(e.slice(r+1,r+3),16);if(a<128){t+=n[a];continue}if((a&224)==192&&r+3<i){let n=parseInt(e.slice(r+4,r+6),16);if((n&192)==128){let e=a<<6&1984|n&63;e<128?t+=`��`:t+=String.fromCharCode(e),r+=3;continue}}if((a&240)==224&&r+6<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16);if((n&192)==128&&(i&192)==128){let e=a<<12&61440|n<<6&4032|i&63;e<2048||e>=55296&&e<=57343?t+=`���`:t+=String.fromCharCode(e),r+=6;continue}}if((a&248)==240&&r+9<i){let n=parseInt(e.slice(r+4,r+6),16),i=parseInt(e.slice(r+7,r+9),16),o=parseInt(e.slice(r+10,r+12),16);if((n&192)==128&&(i&192)==128&&(o&192)==128){let e=a<<18&1835008|n<<12&258048|i<<6&4032|o&63;e<65536||e>1114111?t+=`����`:(e-=65536,t+=String.fromCharCode(55296+(e>>10),56320+(e&1023))),r+=9;continue}}t+=`�`}return t})}yv.defaultChars=`;/?:@&=+$,#`,yv.componentChars=``;var bv={};function xv(e){let t=bv[e];if(t)return t;t=bv[e]=[];for(let e=0;e<128;e++){let n=String.fromCharCode(e);/^[0-9a-z]$/i.test(n)?t.push(n):t.push(`%`+(`0`+e.toString(16).toUpperCase()).slice(-2))}for(let n=0;n<e.length;n++)t[e.charCodeAt(n)]=e[n];return t}function Sv(e,t,n){typeof t!=`string`&&(n=t,t=Sv.defaultChars),n===void 0&&(n=!0);let r=xv(t),i=``;for(let t=0,a=e.length;t<a;t++){let o=e.charCodeAt(t);if(n&&o===37&&t+2<a&&/^[0-9a-f]{2}$/i.test(e.slice(t+1,t+3))){i+=e.slice(t,t+3),t+=2;continue}if(o<128){i+=r[o];continue}if(o>=55296&&o<=57343){if(o>=55296&&o<=56319&&t+1<a){let n=e.charCodeAt(t+1);if(n>=56320&&n<=57343){i+=encodeURIComponent(e[t]+e[t+1]),t++;continue}}i+=`%EF%BF%BD`;continue}i+=encodeURIComponent(e[t])}return i}Sv.defaultChars=`;/?:@&=+$,-_.!~*'()#`,Sv.componentChars=`-_.!~*'()`;function Cv(e){let t=``;return t+=e.protocol||``,t+=e.slashes?`//`:``,t+=e.auth?e.auth+`@`:``,e.hostname&&e.hostname.indexOf(`:`)!==-1?t+=`[`+e.hostname+`]`:t+=e.hostname||``,t+=e.port?`:`+e.port:``,t+=e.pathname||``,t+=e.search||``,t+=e.hash||``,t}function wv(){this.protocol=null,this.slashes=null,this.auth=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.pathname=null}var Tv=/^([a-z0-9.+-]+:)/i,Ev=/:[0-9]*$/,Dv=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Ov=[`%`,`/`,`?`,`;`,`#`,`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
53
53
  `,` `],kv=[`/`,`?`,`#`],Av=255,jv=/^[+a-z0-9A-Z_-]{0,63}$/,Mv=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,Nv={javascript:!0,"javascript:":!0},Pv={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Fv(e,t){if(e&&e instanceof wv)return e;let n=new wv;return n.parse(e,t),n}wv.prototype.parse=function(e,t){let n,r,i,a=e;if(a=a.trim(),!t&&e.split(`#`).length===1){let e=Dv.exec(a);if(e)return this.pathname=e[1],e[2]&&(this.search=e[2]),this}let o=Tv.exec(a);if(o&&(o=o[0],n=o.toLowerCase(),this.protocol=o,a=a.substr(o.length)),(t||o||a.match(/^\/\/[^@\/]+@[^@\/]+/))&&(i=a.substr(0,2)===`//`,i&&!(o&&Nv[o])&&(a=a.substr(2),this.slashes=!0)),!Nv[o]&&(i||o&&!Pv[o])){let e=-1;for(let t=0;t<kv.length;t++)r=a.indexOf(kv[t]),r!==-1&&(e===-1||r<e)&&(e=r);let t,n;n=e===-1?a.lastIndexOf(`@`):a.lastIndexOf(`@`,e),n!==-1&&(t=a.slice(0,n),a=a.slice(n+1),this.auth=t),e=-1;for(let t=0;t<Ov.length;t++)r=a.indexOf(Ov[t]),r!==-1&&(e===-1||r<e)&&(e=r);e===-1&&(e=a.length),a[e-1]===`:`&&e--;let i=a.slice(0,e);a=a.slice(e),this.parseHost(i),this.hostname=this.hostname||``;let o=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!o){let e=this.hostname.split(/\./);for(let t=0,n=e.length;t<n;t++){let n=e[t];if(n&&!n.match(jv)){let r=``;for(let e=0,t=n.length;e<t;e++)n.charCodeAt(e)>127?r+=`x`:r+=n[e];if(!r.match(jv)){let r=e.slice(0,t),i=e.slice(t+1),o=n.match(Mv);o&&(r.push(o[1]),i.unshift(o[2])),i.length&&(a=i.join(`.`)+a),this.hostname=r.join(`.`);break}}}}this.hostname.length>Av&&(this.hostname=``),o&&(this.hostname=this.hostname.substr(1,this.hostname.length-2))}let s=a.indexOf(`#`);s!==-1&&(this.hash=a.substr(s),a=a.slice(0,s));let c=a.indexOf(`?`);return c!==-1&&(this.search=a.substr(c),a=a.slice(0,c)),a&&(this.pathname=a),Pv[n]&&this.hostname&&!this.pathname&&(this.pathname=``),this},wv.prototype.parseHost=function(e){let t=Ev.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)};var Iv=s({decode:()=>yv,encode:()=>Sv,format:()=>Cv,parse:()=>Fv}),Lv=/[\0-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,Rv=/[\0-\x1F\x7F-\x9F]/,zv=/[\xAD\u0600-\u0605\u061C\u06DD\u070F\u0890\u0891\u08E2\u180E\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u206F\uFEFF\uFFF9-\uFFFB]|\uD804[\uDCBD\uDCCD]|\uD80D[\uDC30-\uDC3F]|\uD82F[\uDCA0-\uDCA3]|\uD834[\uDD73-\uDD7A]|\uDB40[\uDC01\uDC20-\uDC7F]/,Bv=/[!-#%-\*,-\/:;\?@\[-\]_\{\}\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061D-\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u09FD\u0A76\u0AF0\u0C77\u0C84\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1B7D\u1B7E\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E4F\u2E52-\u2E5D\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD803[\uDEAD\uDF55-\uDF59\uDF86-\uDF89]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC8\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDC4B-\uDC4F\uDC5A\uDC5B\uDC5D\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDE60-\uDE6C\uDEB9\uDF3C-\uDF3E]|\uD806[\uDC3B\uDD44-\uDD46\uDDE2\uDE3F-\uDE46\uDE9A-\uDE9C\uDE9E-\uDEA2\uDF00-\uDF09]|\uD807[\uDC41-\uDC45\uDC70\uDC71\uDEF7\uDEF8\uDF43-\uDF4F\uDFFF]|\uD809[\uDC70-\uDC74]|\uD80B[\uDFF1\uDFF2]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD81B[\uDE97-\uDE9A\uDFE2]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]|\uD83A[\uDD5E\uDD5F]/,Vv=/[\$\+<->\^`\|~\xA2-\xA6\xA8\xA9\xAC\xAE-\xB1\xB4\xB8\xD7\xF7\u02C2-\u02C5\u02D2-\u02DF\u02E5-\u02EB\u02ED\u02EF-\u02FF\u0375\u0384\u0385\u03F6\u0482\u058D-\u058F\u0606-\u0608\u060B\u060E\u060F\u06DE\u06E9\u06FD\u06FE\u07F6\u07FE\u07FF\u0888\u09F2\u09F3\u09FA\u09FB\u0AF1\u0B70\u0BF3-\u0BFA\u0C7F\u0D4F\u0D79\u0E3F\u0F01-\u0F03\u0F13\u0F15-\u0F17\u0F1A-\u0F1F\u0F34\u0F36\u0F38\u0FBE-\u0FC5\u0FC7-\u0FCC\u0FCE\u0FCF\u0FD5-\u0FD8\u109E\u109F\u1390-\u1399\u166D\u17DB\u1940\u19DE-\u19FF\u1B61-\u1B6A\u1B74-\u1B7C\u1FBD\u1FBF-\u1FC1\u1FCD-\u1FCF\u1FDD-\u1FDF\u1FED-\u1FEF\u1FFD\u1FFE\u2044\u2052\u207A-\u207C\u208A-\u208C\u20A0-\u20C0\u2100\u2101\u2103-\u2106\u2108\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A\u213B\u2140-\u2144\u214A-\u214D\u214F\u218A\u218B\u2190-\u2307\u230C-\u2328\u232B-\u2426\u2440-\u244A\u249C-\u24E9\u2500-\u2767\u2794-\u27C4\u27C7-\u27E5\u27F0-\u2982\u2999-\u29D7\u29DC-\u29FB\u29FE-\u2B73\u2B76-\u2B95\u2B97-\u2BFF\u2CE5-\u2CEA\u2E50\u2E51\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFF\u3004\u3012\u3013\u3020\u3036\u3037\u303E\u303F\u309B\u309C\u3190\u3191\u3196-\u319F\u31C0-\u31E3\u31EF\u3200-\u321E\u322A-\u3247\u3250\u3260-\u327F\u328A-\u32B0\u32C0-\u33FF\u4DC0-\u4DFF\uA490-\uA4C6\uA700-\uA716\uA720\uA721\uA789\uA78A\uA828-\uA82B\uA836-\uA839\uAA77-\uAA79\uAB5B\uAB6A\uAB6B\uFB29\uFBB2-\uFBC2\uFD40-\uFD4F\uFDCF\uFDFC-\uFDFF\uFE62\uFE64-\uFE66\uFE69\uFF04\uFF0B\uFF1C-\uFF1E\uFF3E\uFF40\uFF5C\uFF5E\uFFE0-\uFFE6\uFFE8-\uFFEE\uFFFC\uFFFD]|\uD800[\uDD37-\uDD3F\uDD79-\uDD89\uDD8C-\uDD8E\uDD90-\uDD9C\uDDA0\uDDD0-\uDDFC]|\uD802[\uDC77\uDC78\uDEC8]|\uD805\uDF3F|\uD807[\uDFD5-\uDFF1]|\uD81A[\uDF3C-\uDF3F\uDF45]|\uD82F\uDC9C|\uD833[\uDF50-\uDFC3]|\uD834[\uDC00-\uDCF5\uDD00-\uDD26\uDD29-\uDD64\uDD6A-\uDD6C\uDD83\uDD84\uDD8C-\uDDA9\uDDAE-\uDDEA\uDE00-\uDE41\uDE45\uDF00-\uDF56]|\uD835[\uDEC1\uDEDB\uDEFB\uDF15\uDF35\uDF4F\uDF6F\uDF89\uDFA9\uDFC3]|\uD836[\uDC00-\uDDFF\uDE37-\uDE3A\uDE6D-\uDE74\uDE76-\uDE83\uDE85\uDE86]|\uD838[\uDD4F\uDEFF]|\uD83B[\uDCAC\uDCB0\uDD2E\uDEF0\uDEF1]|\uD83C[\uDC00-\uDC2B\uDC30-\uDC93\uDCA0-\uDCAE\uDCB1-\uDCBF\uDCC1-\uDCCF\uDCD1-\uDCF5\uDD0D-\uDDAD\uDDE6-\uDE02\uDE10-\uDE3B\uDE40-\uDE48\uDE50\uDE51\uDE60-\uDE65\uDF00-\uDFFF]|\uD83D[\uDC00-\uDED7\uDEDC-\uDEEC\uDEF0-\uDEFC\uDF00-\uDF76\uDF7B-\uDFD9\uDFE0-\uDFEB\uDFF0]|\uD83E[\uDC00-\uDC0B\uDC10-\uDC47\uDC50-\uDC59\uDC60-\uDC87\uDC90-\uDCAD\uDCB0\uDCB1\uDD00-\uDE53\uDE60-\uDE6D\uDE70-\uDE7C\uDE80-\uDE88\uDE90-\uDEBD\uDEBF-\uDEC5\uDECE-\uDEDB\uDEE0-\uDEE8\uDEF0-\uDEF8\uDF00-\uDF92\uDF94-\uDFCA]/,Hv=/[ \xA0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000]/,Uv=s({Any:()=>Lv,Cc:()=>Rv,Cf:()=>zv,P:()=>Bv,S:()=>Vv,Z:()=>Hv}),Wv=new Uint16Array(`ᵁ<Õıʊҝջאٵ۞ޢߖࠏ੊ઑඡ๭༉༦჊ረዡᐕᒝᓃᓟᔥ\0\0\0\0\0\0ᕫᛍᦍᰒᷝ὾⁠↰⊍⏀⏻⑂⠤⤒ⴈ⹈⿎〖㊺㘹㞬㣾㨨㩱㫠㬮ࠀEMabcfglmnoprstu\\bfms„‹•˜¦³¹ÈÏlig耻Æ䃆P耻&䀦cute耻Á䃁reve;䄂Āiyx}rc耻Â䃂;䐐r;쀀𝔄rave耻À䃀pha;䎑acr;䄀d;橓Āgp¡on;䄄f;쀀𝔸plyFunction;恡ing耻Å䃅Ācs¾Ãr;쀀𝒜ign;扔ilde耻Ã䃃ml耻Ä䃄ЀaceforsuåûþėĜĢħĪĀcrêòkslash;或Ŷöø;櫧ed;挆y;䐑ƀcrtąċĔause;戵noullis;愬a;䎒r;쀀𝔅pf;쀀𝔹eve;䋘còēmpeq;扎܀HOacdefhilorsuōőŖƀƞƢƵƷƺǜȕɳɸɾcy;䐧PY耻©䂩ƀcpyŝŢźute;䄆Ā;iŧŨ拒talDifferentialD;慅leys;愭ȀaeioƉƎƔƘron;䄌dil耻Ç䃇rc;䄈nint;戰ot;䄊ĀdnƧƭilla;䂸terDot;䂷òſi;䎧rcleȀDMPTLJNjǑǖot;抙inus;抖lus;投imes;抗oĀcsǢǸkwiseContourIntegral;戲eCurlyĀDQȃȏoubleQuote;思uote;怙ȀlnpuȞȨɇɕonĀ;eȥȦ户;橴ƀgitȯȶȺruent;扡nt;戯ourIntegral;戮ĀfrɌɎ;愂oduct;成nterClockwiseContourIntegral;戳oss;樯cr;쀀𝒞pĀ;Cʄʅ拓ap;才րDJSZacefiosʠʬʰʴʸˋ˗ˡ˦̳ҍĀ;oŹʥtrahd;椑cy;䐂cy;䐅cy;䐏ƀgrsʿ˄ˇger;怡r;憡hv;櫤Āayː˕ron;䄎;䐔lĀ;t˝˞戇a;䎔r;쀀𝔇Āaf˫̧Ācm˰̢riticalȀADGT̖̜̀̆cute;䂴oŴ̋̍;䋙bleAcute;䋝rave;䁠ilde;䋜ond;拄ferentialD;慆Ѱ̽\0\0\0͔͂\0Ѕf;쀀𝔻ƀ;DE͈͉͍䂨ot;惜qual;扐blèCDLRUVͣͲ΂ϏϢϸontourIntegraìȹoɴ͹\0\0ͻ»͉nArrow;懓Āeo·ΤftƀARTΐΖΡrrow;懐ightArrow;懔eåˊngĀLRΫτeftĀARγιrrow;柸ightArrow;柺ightArrow;柹ightĀATϘϞrrow;懒ee;抨pɁϩ\0\0ϯrrow;懑ownArrow;懕erticalBar;戥ǹABLRTaВЪаўѿͼrrowƀ;BUНОТ憓ar;椓pArrow;懵reve;䌑eft˒к\0ц\0ѐightVector;楐eeVector;楞ectorĀ;Bљњ憽ar;楖ightǔѧ\0ѱeeVector;楟ectorĀ;BѺѻ懁ar;楗eeĀ;A҆҇护rrow;憧ĀctҒҗr;쀀𝒟rok;䄐ࠀNTacdfglmopqstuxҽӀӄӋӞӢӧӮӵԡԯԶՒ՝ՠեG;䅊H耻Ð䃐cute耻É䃉ƀaiyӒӗӜron;䄚rc耻Ê䃊;䐭ot;䄖r;쀀𝔈rave耻È䃈ement;戈ĀapӺӾcr;䄒tyɓԆ\0\0ԒmallSquare;旻erySmallSquare;斫ĀgpԦԪon;䄘f;쀀𝔼silon;䎕uĀaiԼՉlĀ;TՂՃ橵ilde;扂librium;懌Āci՗՚r;愰m;橳a;䎗ml耻Ë䃋Āipժկsts;戃onentialE;慇ʀcfiosօֈ֍ֲ׌y;䐤r;쀀𝔉lledɓ֗\0\0֣mallSquare;旼erySmallSquare;斪Ͱֺ\0ֿ\0\0ׄf;쀀𝔽All;戀riertrf;愱cò׋؀JTabcdfgorstר׬ׯ׺؀ؒؖ؛؝أ٬ٲcy;䐃耻>䀾mmaĀ;d׷׸䎓;䏜reve;䄞ƀeiy؇،ؐdil;䄢rc;䄜;䐓ot;䄠r;쀀𝔊;拙pf;쀀𝔾eater̀EFGLSTصلَٖٛ٦qualĀ;Lؾؿ扥ess;招ullEqual;执reater;檢ess;扷lantEqual;橾ilde;扳cr;쀀𝒢;扫ЀAacfiosuڅڋږڛڞڪھۊRDcy;䐪Āctڐڔek;䋇;䁞irc;䄤r;愌lbertSpace;愋ǰگ\0ڲf;愍izontalLine;攀Āctۃۅòکrok;䄦mpńېۘownHumðįqual;扏܀EJOacdfgmnostuۺ۾܃܇܎ܚܞܡܨ݄ݸދޏޕcy;䐕lig;䄲cy;䐁cute耻Í䃍Āiyܓܘrc耻Î䃎;䐘ot;䄰r;愑rave耻Ì䃌ƀ;apܠܯܿĀcgܴܷr;䄪inaryI;慈lieóϝǴ݉\0ݢĀ;eݍݎ戬Āgrݓݘral;戫section;拂isibleĀCTݬݲomma;恣imes;恢ƀgptݿރވon;䄮f;쀀𝕀a;䎙cr;愐ilde;䄨ǫޚ\0ޞcy;䐆l耻Ï䃏ʀcfosuެ޷޼߂ߐĀiyޱ޵rc;䄴;䐙r;쀀𝔍pf;쀀𝕁ǣ߇\0ߌr;쀀𝒥rcy;䐈kcy;䐄΀HJacfosߤߨ߽߬߱ࠂࠈcy;䐥cy;䐌ppa;䎚Āey߶߻dil;䄶;䐚r;쀀𝔎pf;쀀𝕂cr;쀀𝒦րJTaceflmostࠥࠩࠬࡐࡣ঳সে্਷ੇcy;䐉耻<䀼ʀcmnpr࠷࠼ࡁࡄࡍute;䄹bda;䎛g;柪lacetrf;愒r;憞ƀaeyࡗ࡜ࡡron;䄽dil;䄻;䐛Āfsࡨ॰tԀACDFRTUVarࡾࢩࢱࣦ࣠ࣼयज़ΐ४Ānrࢃ࢏gleBracket;柨rowƀ;BR࢙࢚࢞憐ar;懤ightArrow;懆eiling;挈oǵࢷ\0ࣃbleBracket;柦nǔࣈ\0࣒eeVector;楡ectorĀ;Bࣛࣜ懃ar;楙loor;挊ightĀAV࣯ࣵrrow;憔ector;楎Āerँगeƀ;AVउऊऐ抣rrow;憤ector;楚iangleƀ;BEतथऩ抲ar;槏qual;抴pƀDTVषूौownVector;楑eeVector;楠ectorĀ;Bॖॗ憿ar;楘ectorĀ;B॥०憼ar;楒ightáΜs̀EFGLSTॾঋকঝঢভqualGreater;拚ullEqual;扦reater;扶ess;檡lantEqual;橽ilde;扲r;쀀𝔏Ā;eঽা拘ftarrow;懚idot;䄿ƀnpw৔ਖਛgȀLRlr৞৷ਂਐeftĀAR০৬rrow;柵ightArrow;柷ightArrow;柶eftĀarγਊightáοightáϊf;쀀𝕃erĀLRਢਬeftArrow;憙ightArrow;憘ƀchtਾੀੂòࡌ;憰rok;䅁;扪Ѐacefiosuਗ਼੝੠੷੼અઋ઎p;椅y;䐜Ādl੥੯iumSpace;恟lintrf;愳r;쀀𝔐nusPlus;戓pf;쀀𝕄cò੶;䎜ҀJacefostuણધભીଔଙඑ඗ඞcy;䐊cute;䅃ƀaey઴હાron;䅇dil;䅅;䐝ƀgswે૰଎ativeƀMTV૓૟૨ediumSpace;怋hiĀcn૦૘ë૙eryThiî૙tedĀGL૸ଆreaterGreateòٳessLesóੈLine;䀊r;쀀𝔑ȀBnptଢନଷ଺reak;恠BreakingSpace;䂠f;愕ڀ;CDEGHLNPRSTV୕ୖ୪୼஡௫ఄ౞಄ದ೘ൡඅ櫬Āou୛୤ngruent;扢pCap;扭oubleVerticalBar;戦ƀlqxஃஊ஛ement;戉ualĀ;Tஒஓ扠ilde;쀀≂̸ists;戄reater΀;EFGLSTஶஷ஽௉௓௘௥扯qual;扱ullEqual;쀀≧̸reater;쀀≫̸ess;批lantEqual;쀀⩾̸ilde;扵umpń௲௽ownHump;쀀≎̸qual;쀀≏̸eĀfsఊధtTriangleƀ;BEచఛడ拪ar;쀀⧏̸qual;括s̀;EGLSTవశ఼ౄోౘ扮qual;扰reater;扸ess;쀀≪̸lantEqual;쀀⩽̸ilde;扴estedĀGL౨౹reaterGreater;쀀⪢̸essLess;쀀⪡̸recedesƀ;ESಒಓಛ技qual;쀀⪯̸lantEqual;拠ĀeiಫಹverseElement;戌ghtTriangleƀ;BEೋೌ೒拫ar;쀀⧐̸qual;拭ĀquೝഌuareSuĀbp೨೹setĀ;E೰ೳ쀀⊏̸qual;拢ersetĀ;Eഃആ쀀⊐̸qual;拣ƀbcpഓതൎsetĀ;Eഛഞ쀀⊂⃒qual;抈ceedsȀ;ESTലള഻െ抁qual;쀀⪰̸lantEqual;拡ilde;쀀≿̸ersetĀ;E൘൛쀀⊃⃒qual;抉ildeȀ;EFT൮൯൵ൿ扁qual;扄ullEqual;扇ilde;扉erticalBar;戤cr;쀀𝒩ilde耻Ñ䃑;䎝܀Eacdfgmoprstuvලෂ෉෕ෛ෠෧෼ขภยา฿ไlig;䅒cute耻Ó䃓Āiy෎ීrc耻Ô䃔;䐞blac;䅐r;쀀𝔒rave耻Ò䃒ƀaei෮ෲ෶cr;䅌ga;䎩cron;䎟pf;쀀𝕆enCurlyĀDQฎบoubleQuote;怜uote;怘;橔Āclวฬr;쀀𝒪ash耻Ø䃘iŬื฼de耻Õ䃕es;樷ml耻Ö䃖erĀBP๋๠Āar๐๓r;怾acĀek๚๜;揞et;掴arenthesis;揜Ҁacfhilors๿ງຊຏຒດຝະ໼rtialD;戂y;䐟r;쀀𝔓i;䎦;䎠usMinus;䂱Āipຢອncareplanåڝf;愙Ȁ;eio຺ູ໠໤檻cedesȀ;EST່້໏໚扺qual;檯lantEqual;扼ilde;找me;怳Ādp໩໮uct;戏ortionĀ;aȥ໹l;戝Āci༁༆r;쀀𝒫;䎨ȀUfos༑༖༛༟OT耻"䀢r;쀀𝔔pf;愚cr;쀀𝒬؀BEacefhiorsu༾གྷཇའཱིྦྷྪྭ႖ႩႴႾarr;椐G耻®䂮ƀcnrཎནབute;䅔g;柫rĀ;tཛྷཝ憠l;椖ƀaeyཧཬཱron;䅘dil;䅖;䐠Ā;vླྀཹ愜erseĀEUྂྙĀlq྇ྎement;戋uilibrium;懋pEquilibrium;楯r»ཹo;䎡ghtЀACDFTUVa࿁࿫࿳ဢဨၛႇϘĀnr࿆࿒gleBracket;柩rowƀ;BL࿜࿝࿡憒ar;懥eftArrow;懄eiling;按oǵ࿹\0စbleBracket;柧nǔည\0နeeVector;楝ectorĀ;Bဝသ懂ar;楕loor;挋Āerိ၃eƀ;AVဵံြ抢rrow;憦ector;楛iangleƀ;BEၐၑၕ抳ar;槐qual;抵pƀDTVၣၮၸownVector;楏eeVector;楜ectorĀ;Bႂႃ憾ar;楔ectorĀ;B႑႒懀ar;楓Āpuႛ႞f;愝ndImplies;楰ightarrow;懛ĀchႹႼr;愛;憱leDelayed;槴ڀHOacfhimoqstuფჱჷჽᄙᄞᅑᅖᅡᅧᆵᆻᆿĀCcჩხHcy;䐩y;䐨FTcy;䐬cute;䅚ʀ;aeiyᄈᄉᄎᄓᄗ檼ron;䅠dil;䅞rc;䅜;䐡r;쀀𝔖ortȀDLRUᄪᄴᄾᅉownArrow»ОeftArrow»࢚ightArrow»࿝pArrow;憑gma;䎣allCircle;战pf;쀀𝕊ɲᅭ\0\0ᅰt;戚areȀ;ISUᅻᅼᆉᆯ斡ntersection;抓uĀbpᆏᆞsetĀ;Eᆗᆘ抏qual;抑ersetĀ;Eᆨᆩ抐qual;抒nion;抔cr;쀀𝒮ar;拆ȀbcmpᇈᇛሉላĀ;sᇍᇎ拐etĀ;Eᇍᇕqual;抆ĀchᇠህeedsȀ;ESTᇭᇮᇴᇿ扻qual;檰lantEqual;扽ilde;承Tháྌ;我ƀ;esሒሓሣ拑rsetĀ;Eሜም抃qual;抇et»ሓրHRSacfhiorsሾቄ቉ቕ቞ቱቶኟዂወዑORN耻Þ䃞ADE;愢ĀHc቎ቒcy;䐋y;䐦Ābuቚቜ;䀉;䎤ƀaeyብቪቯron;䅤dil;䅢;䐢r;쀀𝔗Āeiቻ኉Dzኀ\0ኇefore;戴a;䎘Ācn኎ኘkSpace;쀀  Space;怉ldeȀ;EFTካኬኲኼ戼qual;扃ullEqual;扅ilde;扈pf;쀀𝕋ipleDot;惛Āctዖዛr;쀀𝒯rok;䅦ૡዷጎጚጦ\0ጬጱ\0\0\0\0\0ጸጽ፷ᎅ\0᏿ᐄᐊᐐĀcrዻጁute耻Ú䃚rĀ;oጇገ憟cir;楉rǣጓ\0጖y;䐎ve;䅬Āiyጞጣrc耻Û䃛;䐣blac;䅰r;쀀𝔘rave耻Ù䃙acr;䅪Ādiፁ፩erĀBPፈ፝Āarፍፐr;䁟acĀekፗፙ;揟et;掵arenthesis;揝onĀ;P፰፱拃lus;抎Āgp፻፿on;䅲f;쀀𝕌ЀADETadps᎕ᎮᎸᏄϨᏒᏗᏳrrowƀ;BDᅐᎠᎤar;椒ownArrow;懅ownArrow;憕quilibrium;楮eeĀ;AᏋᏌ报rrow;憥ownáϳerĀLRᏞᏨeftArrow;憖ightArrow;憗iĀ;lᏹᏺ䏒on;䎥ing;䅮cr;쀀𝒰ilde;䅨ml耻Ü䃜ҀDbcdefosvᐧᐬᐰᐳᐾᒅᒊᒐᒖash;披ar;櫫y;䐒ashĀ;lᐻᐼ抩;櫦Āerᑃᑅ;拁ƀbtyᑌᑐᑺar;怖Ā;iᑏᑕcalȀBLSTᑡᑥᑪᑴar;戣ine;䁼eparator;杘ilde;所ThinSpace;怊r;쀀𝔙pf;쀀𝕍cr;쀀𝒱dash;抪ʀcefosᒧᒬᒱᒶᒼirc;䅴dge;拀r;쀀𝔚pf;쀀𝕎cr;쀀𝒲Ȁfiosᓋᓐᓒᓘr;쀀𝔛;䎞pf;쀀𝕏cr;쀀𝒳ҀAIUacfosuᓱᓵᓹᓽᔄᔏᔔᔚᔠcy;䐯cy;䐇cy;䐮cute耻Ý䃝Āiyᔉᔍrc;䅶;䐫r;쀀𝔜pf;쀀𝕐cr;쀀𝒴ml;䅸ЀHacdefosᔵᔹᔿᕋᕏᕝᕠᕤcy;䐖cute;䅹Āayᕄᕉron;䅽;䐗ot;䅻Dzᕔ\0ᕛoWidtè૙a;䎖r;愨pf;愤cr;쀀𝒵௡ᖃᖊᖐ\0ᖰᖶᖿ\0\0\0\0ᗆᗛᗫᙟ᙭\0ᚕ᚛ᚲᚹ\0ᚾcute耻á䃡reve;䄃̀;Ediuyᖜᖝᖡᖣᖨᖭ戾;쀀∾̳;房rc耻â䃢te肻´̆;䐰lig耻æ䃦Ā;r²ᖺ;쀀𝔞rave耻à䃠ĀepᗊᗖĀfpᗏᗔsym;愵èᗓha;䎱ĀapᗟcĀclᗤᗧr;䄁g;樿ɤᗰ\0\0ᘊʀ;adsvᗺᗻᗿᘁᘇ戧nd;橕;橜lope;橘;橚΀;elmrszᘘᘙᘛᘞᘿᙏᙙ戠;榤e»ᘙsdĀ;aᘥᘦ戡ѡᘰᘲᘴᘶᘸᘺᘼᘾ;榨;榩;榪;榫;榬;榭;榮;榯tĀ;vᙅᙆ戟bĀ;dᙌᙍ抾;榝Āptᙔᙗh;戢»¹arr;捼Āgpᙣᙧon;䄅f;쀀𝕒΀;Eaeiop዁ᙻᙽᚂᚄᚇᚊ;橰cir;橯;扊d;手s;䀧roxĀ;e዁ᚒñᚃing耻å䃥ƀctyᚡᚦᚨr;쀀𝒶;䀪mpĀ;e዁ᚯñʈilde耻ã䃣ml耻ä䃤Āciᛂᛈoninôɲnt;樑ࠀNabcdefiklnoprsu᛭ᛱᜰ᜼ᝃᝈ᝸᝽០៦ᠹᡐᜍ᤽᥈ᥰot;櫭Ācrᛶ᜞kȀcepsᜀᜅᜍᜓong;扌psilon;䏶rime;怵imĀ;e᜚᜛戽q;拍Ŷᜢᜦee;抽edĀ;gᜬᜭ挅e»ᜭrkĀ;t፜᜷brk;掶Āoyᜁᝁ;䐱quo;怞ʀcmprtᝓ᝛ᝡᝤᝨausĀ;eĊĉptyv;榰séᜌnoõēƀahwᝯ᝱ᝳ;䎲;愶een;扬r;쀀𝔟g΀costuvwឍឝឳេ៕៛៞ƀaiuបពរðݠrc;旯p»፱ƀdptឤឨឭot;樀lus;樁imes;樂ɱឹ\0\0ើcup;樆ar;昅riangleĀdu៍្own;施p;斳plus;樄eåᑄåᒭarow;植ƀako៭ᠦᠵĀcn៲ᠣkƀlst៺֫᠂ozenge;槫riangleȀ;dlr᠒᠓᠘᠝斴own;斾eft;旂ight;斸k;搣Ʊᠫ\0ᠳƲᠯ\0ᠱ;斒;斑4;斓ck;斈ĀeoᠾᡍĀ;qᡃᡆ쀀=⃥uiv;쀀≡⃥t;挐Ȁptwxᡙᡞᡧᡬf;쀀𝕓Ā;tᏋᡣom»Ꮜtie;拈؀DHUVbdhmptuvᢅᢖᢪᢻᣗᣛᣬ᣿ᤅᤊᤐᤡȀLRlrᢎᢐᢒᢔ;敗;敔;敖;敓ʀ;DUduᢡᢢᢤᢦᢨ敐;敦;敩;敤;敧ȀLRlrᢳᢵᢷᢹ;敝;敚;敜;教΀;HLRhlrᣊᣋᣍᣏᣑᣓᣕ救;敬;散;敠;敫;敢;敟ox;槉ȀLRlrᣤᣦᣨᣪ;敕;敒;攐;攌ʀ;DUduڽ᣷᣹᣻᣽;敥;敨;攬;攴inus;抟lus;択imes;抠ȀLRlrᤙᤛᤝ᤟;敛;敘;攘;攔΀;HLRhlrᤰᤱᤳᤵᤷ᤻᤹攂;敪;敡;敞;攼;攤;攜Āevģ᥂bar耻¦䂦Ȁceioᥑᥖᥚᥠr;쀀𝒷mi;恏mĀ;e᜚᜜lƀ;bhᥨᥩᥫ䁜;槅sub;柈Ŭᥴ᥾lĀ;e᥹᥺怢t»᥺pƀ;Eeįᦅᦇ;檮Ā;qۜۛೡᦧ\0᧨ᨑᨕᨲ\0ᨷᩐ\0\0᪴\0\0᫁\0\0ᬡᬮ᭍᭒\0᯽\0ᰌƀcpr᦭ᦲ᧝ute;䄇̀;abcdsᦿᧀᧄ᧊᧕᧙戩nd;橄rcup;橉Āau᧏᧒p;橋p;橇ot;橀;쀀∩︀Āeo᧢᧥t;恁îړȀaeiu᧰᧻ᨁᨅǰ᧵\0᧸s;橍on;䄍dil耻ç䃧rc;䄉psĀ;sᨌᨍ橌m;橐ot;䄋ƀdmnᨛᨠᨦil肻¸ƭptyv;榲t脀¢;eᨭᨮ䂢räƲr;쀀𝔠ƀceiᨽᩀᩍy;䑇ckĀ;mᩇᩈ朓ark»ᩈ;䏇r΀;Ecefms᩟᩠ᩢᩫ᪤᪪᪮旋;槃ƀ;elᩩᩪᩭ䋆q;扗eɡᩴ\0\0᪈rrowĀlr᩼᪁eft;憺ight;憻ʀRSacd᪒᪔᪖᪚᪟»ཇ;擈st;抛irc;抚ash;抝nint;樐id;櫯cir;槂ubsĀ;u᪻᪼晣it»᪼ˬ᫇᫔᫺\0ᬊonĀ;eᫍᫎ䀺Ā;qÇÆɭ᫙\0\0᫢aĀ;t᫞᫟䀬;䁀ƀ;fl᫨᫩᫫戁îᅠeĀmx᫱᫶ent»᫩eóɍǧ᫾\0ᬇĀ;dኻᬂot;橭nôɆƀfryᬐᬔᬗ;쀀𝕔oäɔ脀©;sŕᬝr;愗Āaoᬥᬩrr;憵ss;朗Ācuᬲᬷr;쀀𝒸Ābpᬼ᭄Ā;eᭁᭂ櫏;櫑Ā;eᭉᭊ櫐;櫒dot;拯΀delprvw᭠᭬᭷ᮂᮬᯔ᯹arrĀlr᭨᭪;椸;椵ɰ᭲\0\0᭵r;拞c;拟arrĀ;p᭿ᮀ憶;椽̀;bcdosᮏᮐᮖᮡᮥᮨ截rcap;橈Āauᮛᮞp;橆p;橊ot;抍r;橅;쀀∪︀Ȁalrv᮵ᮿᯞᯣrrĀ;mᮼᮽ憷;椼yƀevwᯇᯔᯘqɰᯎ\0\0ᯒreã᭳uã᭵ee;拎edge;拏en耻¤䂤earrowĀlrᯮ᯳eft»ᮀight»ᮽeäᯝĀciᰁᰇoninôǷnt;戱lcty;挭ঀAHabcdefhijlorstuwz᰸᰻᰿ᱝᱩᱵᲊᲞᲬᲷ᳻᳿ᴍᵻᶑᶫᶻ᷆᷍rò΁ar;楥Ȁglrs᱈ᱍ᱒᱔ger;怠eth;愸òᄳhĀ;vᱚᱛ怐»ऊūᱡᱧarow;椏aã̕Āayᱮᱳron;䄏;䐴ƀ;ao̲ᱼᲄĀgrʿᲁr;懊tseq;橷ƀglmᲑᲔᲘ耻°䂰ta;䎴ptyv;榱ĀirᲣᲨsht;楿;쀀𝔡arĀlrᲳᲵ»ࣜ»သʀaegsv᳂͸᳖᳜᳠mƀ;oș᳊᳔ndĀ;ș᳑uit;晦amma;䏝in;拲ƀ;io᳧᳨᳸䃷de脀÷;o᳧ᳰntimes;拇nø᳷cy;䑒cɯᴆ\0\0ᴊrn;挞op;挍ʀlptuwᴘᴝᴢᵉᵕlar;䀤f;쀀𝕕ʀ;emps̋ᴭᴷᴽᵂqĀ;d͒ᴳot;扑inus;戸lus;戔quare;抡blebarwedgåúnƀadhᄮᵝᵧownarrowóᲃarpoonĀlrᵲᵶefôᲴighôᲶŢᵿᶅkaro÷གɯᶊ\0\0ᶎrn;挟op;挌ƀcotᶘᶣᶦĀryᶝᶡ;쀀𝒹;䑕l;槶rok;䄑Ādrᶰᶴot;拱iĀ;fᶺ᠖斿Āah᷀᷃ròЩaòྦangle;榦Āci᷒ᷕy;䑟grarr;柿ऀDacdefglmnopqrstuxḁḉḙḸոḼṉṡṾấắẽỡἪἷὄ὎὚ĀDoḆᴴoôᲉĀcsḎḔute耻é䃩ter;橮ȀaioyḢḧḱḶron;䄛rĀ;cḭḮ扖耻ê䃪lon;払;䑍ot;䄗ĀDrṁṅot;扒;쀀𝔢ƀ;rsṐṑṗ檚ave耻è䃨Ā;dṜṝ檖ot;檘Ȁ;ilsṪṫṲṴ檙nters;揧;愓Ā;dṹṺ檕ot;檗ƀapsẅẉẗcr;䄓tyƀ;svẒẓẕ戅et»ẓpĀ1;ẝẤijạả;怄;怅怃ĀgsẪẬ;䅋p;怂ĀgpẴẸon;䄙f;쀀𝕖ƀalsỄỎỒrĀ;sỊị拕l;槣us;橱iƀ;lvỚớở䎵on»ớ;䏵ȀcsuvỪỳἋἣĀioữḱrc»Ḯɩỹ\0\0ỻíՈantĀglἂἆtr»ṝess»Ṻƀaeiἒ἖Ἒls;䀽st;扟vĀ;DȵἠD;橸parsl;槥ĀDaἯἳot;打rr;楱ƀcdiἾὁỸr;愯oô͒ĀahὉὋ;䎷耻ð䃰Āmrὓὗl耻ë䃫o;悬ƀcipὡὤὧl;䀡sôծĀeoὬὴctatioîՙnentialåչৡᾒ\0ᾞ\0ᾡᾧ\0\0ῆῌ\0ΐ\0ῦῪ \0 ⁚llingdotseñṄy;䑄male;晀ƀilrᾭᾳ῁lig;耀ffiɩᾹ\0\0᾽g;耀ffig;耀ffl;쀀𝔣lig;耀filig;쀀fjƀaltῙ῜ῡt;晭ig;耀flns;斱of;䆒ǰ΅\0ῳf;쀀𝕗ĀakֿῷĀ;vῼ´拔;櫙artint;樍Āao‌⁕Ācs‑⁒ႉ‸⁅⁈\0⁐β•‥‧‪‬\0‮耻½䂽;慓耻¼䂼;慕;慙;慛Ƴ‴\0‶;慔;慖ʴ‾⁁\0\0⁃耻¾䂾;慗;慜5;慘ƶ⁌\0⁎;慚;慝8;慞l;恄wn;挢cr;쀀𝒻ࢀEabcdefgijlnorstv₂₉₟₥₰₴⃰⃵⃺⃿℃ℒℸ̗ℾ⅒↞Ā;lٍ₇;檌ƀcmpₐₕ₝ute;䇵maĀ;dₜ᳚䎳;檆reve;䄟Āiy₪₮rc;䄝;䐳ot;䄡Ȁ;lqsؾق₽⃉ƀ;qsؾٌ⃄lanô٥Ȁ;cdl٥⃒⃥⃕c;檩otĀ;o⃜⃝檀Ā;l⃢⃣檂;檄Ā;e⃪⃭쀀⋛︀s;檔r;쀀𝔤Ā;gٳ؛mel;愷cy;䑓Ȁ;Eajٚℌℎℐ;檒;檥;檤ȀEaesℛℝ℩ℴ;扩pĀ;p℣ℤ檊rox»ℤĀ;q℮ℯ檈Ā;q℮ℛim;拧pf;쀀𝕘Āci⅃ⅆr;愊mƀ;el٫ⅎ⅐;檎;檐茀>;cdlqr׮ⅠⅪⅮⅳⅹĀciⅥⅧ;檧r;橺ot;拗Par;榕uest;橼ʀadelsↄⅪ←ٖ↛ǰ↉\0↎proø₞r;楸qĀlqؿ↖lesó₈ií٫Āen↣↭rtneqq;쀀≩︀Å↪ԀAabcefkosy⇄⇇⇱⇵⇺∘∝∯≨≽ròΠȀilmr⇐⇔⇗⇛rsðᒄf»․ilôکĀdr⇠⇤cy;䑊ƀ;cwࣴ⇫⇯ir;楈;憭ar;意irc;䄥ƀalr∁∎∓rtsĀ;u∉∊晥it»∊lip;怦con;抹r;쀀𝔥sĀew∣∩arow;椥arow;椦ʀamopr∺∾≃≞≣rr;懿tht;戻kĀlr≉≓eftarrow;憩ightarrow;憪f;쀀𝕙bar;怕ƀclt≯≴≸r;쀀𝒽asè⇴rok;䄧Ābp⊂⊇ull;恃hen»ᱛૡ⊣\0⊪\0⊸⋅⋎\0⋕⋳\0\0⋸⌢⍧⍢⍿\0⎆⎪⎴cute耻í䃭ƀ;iyݱ⊰⊵rc耻î䃮;䐸Ācx⊼⊿y;䐵cl耻¡䂡ĀfrΟ⋉;쀀𝔦rave耻ì䃬Ȁ;inoܾ⋝⋩⋮Āin⋢⋦nt;樌t;戭fin;槜ta;愩lig;䄳ƀaop⋾⌚⌝ƀcgt⌅⌈⌗r;䄫ƀelpܟ⌏⌓inåގarôܠh;䄱f;抷ed;䆵ʀ;cfotӴ⌬⌱⌽⍁are;愅inĀ;t⌸⌹戞ie;槝doô⌙ʀ;celpݗ⍌⍐⍛⍡al;抺Āgr⍕⍙eróᕣã⍍arhk;樗rod;樼Ȁcgpt⍯⍲⍶⍻y;䑑on;䄯f;쀀𝕚a;䎹uest耻¿䂿Āci⎊⎏r;쀀𝒾nʀ;EdsvӴ⎛⎝⎡ӳ;拹ot;拵Ā;v⎦⎧拴;拳Ā;iݷ⎮lde;䄩ǫ⎸\0⎼cy;䑖l耻ï䃯̀cfmosu⏌⏗⏜⏡⏧⏵Āiy⏑⏕rc;䄵;䐹r;쀀𝔧ath;䈷pf;쀀𝕛ǣ⏬\0⏱r;쀀𝒿rcy;䑘kcy;䑔Ѐacfghjos␋␖␢␧␭␱␵␻ppaĀ;v␓␔䎺;䏰Āey␛␠dil;䄷;䐺r;쀀𝔨reen;䄸cy;䑅cy;䑜pf;쀀𝕜cr;쀀𝓀஀ABEHabcdefghjlmnoprstuv⑰⒁⒆⒍⒑┎┽╚▀♎♞♥♹♽⚚⚲⛘❝❨➋⟀⠁⠒ƀart⑷⑺⑼rò৆òΕail;椛arr;椎Ā;gঔ⒋;檋ar;楢ॣ⒥\0⒪\0⒱\0\0\0\0\0⒵Ⓔ\0ⓆⓈⓍ\0⓹ute;䄺mptyv;榴raîࡌbda;䎻gƀ;dlࢎⓁⓃ;榑åࢎ;檅uo耻«䂫rЀ;bfhlpst࢙ⓞⓦⓩ⓫⓮⓱⓵Ā;f࢝ⓣs;椟s;椝ë≒p;憫l;椹im;楳l;憢ƀ;ae⓿─┄檫il;椙Ā;s┉┊檭;쀀⪭︀ƀabr┕┙┝rr;椌rk;杲Āak┢┬cĀek┨┪;䁻;䁛Āes┱┳;榋lĀdu┹┻;榏;榍Ȁaeuy╆╋╖╘ron;䄾Ādi═╔il;䄼ìࢰâ┩;䐻Ȁcqrs╣╦╭╽a;椶uoĀ;rนᝆĀdu╲╷har;楧shar;楋h;憲ʀ;fgqs▋▌উ◳◿扤tʀahlrt▘▤▷◂◨rrowĀ;t࢙□aé⓶arpoonĀdu▯▴own»њp»०eftarrows;懇ightƀahs◍◖◞rrowĀ;sࣴࢧarpoonó྘quigarro÷⇰hreetimes;拋ƀ;qs▋ও◺lanôবʀ;cdgsব☊☍☝☨c;檨otĀ;o☔☕橿Ā;r☚☛檁;檃Ā;e☢☥쀀⋚︀s;檓ʀadegs☳☹☽♉♋pproøⓆot;拖qĀgq♃♅ôউgtò⒌ôছiíলƀilr♕࣡♚sht;楼;쀀𝔩Ā;Eজ♣;檑š♩♶rĀdu▲♮Ā;l॥♳;楪lk;斄cy;䑙ʀ;achtੈ⚈⚋⚑⚖rò◁orneòᴈard;楫ri;旺Āio⚟⚤dot;䅀ustĀ;a⚬⚭掰che»⚭ȀEaes⚻⚽⛉⛔;扨pĀ;p⛃⛄檉rox»⛄Ā;q⛎⛏檇Ā;q⛎⚻im;拦Ѐabnoptwz⛩⛴⛷✚✯❁❇❐Ānr⛮⛱g;柬r;懽rëࣁgƀlmr⛿✍✔eftĀar০✇ightá৲apsto;柼ightá৽parrowĀlr✥✩efô⓭ight;憬ƀafl✶✹✽r;榅;쀀𝕝us;樭imes;樴š❋❏st;戗áፎƀ;ef❗❘᠀旊nge»❘arĀ;l❤❥䀨t;榓ʀachmt❳❶❼➅➇ròࢨorneòᶌarĀ;d྘➃;業;怎ri;抿̀achiqt➘➝ੀ➢➮➻quo;怹r;쀀𝓁mƀ;egল➪➬;檍;檏Ābu┪➳oĀ;rฟ➹;怚rok;䅂萀<;cdhilqrࠫ⟒☹⟜⟠⟥⟪⟰Āci⟗⟙;檦r;橹reå◲mes;拉arr;楶uest;橻ĀPi⟵⟹ar;榖ƀ;ef⠀भ᠛旃rĀdu⠇⠍shar;楊har;楦Āen⠗⠡rtneqq;쀀≨︀Å⠞܀Dacdefhilnopsu⡀⡅⢂⢎⢓⢠⢥⢨⣚⣢⣤ઃ⣳⤂Dot;戺Ȁclpr⡎⡒⡣⡽r耻¯䂯Āet⡗⡙;時Ā;e⡞⡟朠se»⡟Ā;sျ⡨toȀ;dluျ⡳⡷⡻owîҌefôएðᏑker;斮Āoy⢇⢌mma;権;䐼ash;怔asuredangle»ᘦr;쀀𝔪o;愧ƀcdn⢯⢴⣉ro耻µ䂵Ȁ;acdᑤ⢽⣀⣄sôᚧir;櫰ot肻·Ƶusƀ;bd⣒ᤃ⣓戒Ā;uᴼ⣘;横ţ⣞⣡p;櫛ò−ðઁĀdp⣩⣮els;抧f;쀀𝕞Āct⣸⣽r;쀀𝓂pos»ᖝƀ;lm⤉⤊⤍䎼timap;抸ఀGLRVabcdefghijlmoprstuvw⥂⥓⥾⦉⦘⧚⧩⨕⨚⩘⩝⪃⪕⪤⪨⬄⬇⭄⭿⮮ⰴⱧⱼ⳩Āgt⥇⥋;쀀⋙̸Ā;v⥐௏쀀≫⃒ƀelt⥚⥲⥶ftĀar⥡⥧rrow;懍ightarrow;懎;쀀⋘̸Ā;v⥻ే쀀≪⃒ightarrow;懏ĀDd⦎⦓ash;抯ash;抮ʀbcnpt⦣⦧⦬⦱⧌la»˞ute;䅄g;쀀∠⃒ʀ;Eiop඄⦼⧀⧅⧈;쀀⩰̸d;쀀≋̸s;䅉roø඄urĀ;a⧓⧔普lĀ;s⧓ସdz⧟\0⧣p肻\xA0ଷmpĀ;e௹ఀʀaeouy⧴⧾⨃⨐⨓ǰ⧹\0⧻;橃on;䅈dil;䅆ngĀ;dൾ⨊ot;쀀⩭̸p;橂;䐽ash;怓΀;Aadqsxஒ⨩⨭⨻⩁⩅⩐rr;懗rĀhr⨳⨶k;椤Ā;oᏲᏰot;쀀≐̸uiöୣĀei⩊⩎ar;椨í஘istĀ;s஠டr;쀀𝔫ȀEest௅⩦⩹⩼ƀ;qs஼⩭௡ƀ;qs஼௅⩴lanô௢ií௪Ā;rஶ⪁»ஷƀAap⪊⪍⪑rò⥱rr;憮ar;櫲ƀ;svྍ⪜ྌĀ;d⪡⪢拼;拺cy;䑚΀AEadest⪷⪺⪾⫂⫅⫶⫹rò⥦;쀀≦̸rr;憚r;急Ȁ;fqs఻⫎⫣⫯tĀar⫔⫙rro÷⫁ightarro÷⪐ƀ;qs఻⪺⫪lanôౕĀ;sౕ⫴»శiíౝĀ;rవ⫾iĀ;eచథiäඐĀpt⬌⬑f;쀀𝕟膀¬;in⬙⬚⬶䂬nȀ;Edvஉ⬤⬨⬮;쀀⋹̸ot;쀀⋵̸ǡஉ⬳⬵;拷;拶iĀ;vಸ⬼ǡಸ⭁⭃;拾;拽ƀaor⭋⭣⭩rȀ;ast୻⭕⭚⭟lleì୻l;쀀⫽⃥;쀀∂̸lint;樔ƀ;ceಒ⭰⭳uåಥĀ;cಘ⭸Ā;eಒ⭽ñಘȀAait⮈⮋⮝⮧rò⦈rrƀ;cw⮔⮕⮙憛;쀀⤳̸;쀀↝̸ghtarrow»⮕riĀ;eೋೖ΀chimpqu⮽⯍⯙⬄୸⯤⯯Ȁ;cerല⯆ഷ⯉uå൅;쀀𝓃ortɭ⬅\0\0⯖ará⭖mĀ;e൮⯟Ā;q൴൳suĀbp⯫⯭å೸åഋƀbcp⯶ⰑⰙȀ;Ees⯿ⰀഢⰄ抄;쀀⫅̸etĀ;eഛⰋqĀ;qണⰀcĀ;eലⰗñസȀ;EesⰢⰣൟⰧ抅;쀀⫆̸etĀ;e൘ⰮqĀ;qൠⰣȀgilrⰽⰿⱅⱇìௗlde耻ñ䃱çృiangleĀlrⱒⱜeftĀ;eచⱚñదightĀ;eೋⱥñ೗Ā;mⱬⱭ䎽ƀ;esⱴⱵⱹ䀣ro;愖p;怇ҀDHadgilrsⲏⲔⲙⲞⲣⲰⲶⳓⳣash;抭arr;椄p;쀀≍⃒ash;抬ĀetⲨⲬ;쀀≥⃒;쀀>⃒nfin;槞ƀAetⲽⳁⳅrr;椂;쀀≤⃒Ā;rⳊⳍ쀀<⃒ie;쀀⊴⃒ĀAtⳘⳜrr;椃rie;쀀⊵⃒im;쀀∼⃒ƀAan⳰⳴ⴂrr;懖rĀhr⳺⳽k;椣Ā;oᏧᏥear;椧ቓ᪕\0\0\0\0\0\0\0\0\0\0\0\0\0ⴭ\0ⴸⵈⵠⵥ⵲ⶄᬇ\0\0ⶍⶫ\0ⷈⷎ\0ⷜ⸙⸫⸾⹃Ācsⴱ᪗ute耻ó䃳ĀiyⴼⵅrĀ;c᪞ⵂ耻ô䃴;䐾ʀabios᪠ⵒⵗLjⵚlac;䅑v;樸old;榼lig;䅓Ācr⵩⵭ir;榿;쀀𝔬ͯ⵹\0\0⵼\0ⶂn;䋛ave耻ò䃲;槁Ābmⶈ෴ar;榵Ȁacitⶕ⶘ⶥⶨrò᪀Āir⶝ⶠr;榾oss;榻nå๒;槀ƀaeiⶱⶵⶹcr;䅍ga;䏉ƀcdnⷀⷅǍron;䎿;榶pf;쀀𝕠ƀaelⷔ⷗ǒr;榷rp;榹΀;adiosvⷪⷫⷮ⸈⸍⸐⸖戨rò᪆Ȁ;efmⷷⷸ⸂⸅橝rĀ;oⷾⷿ愴f»ⷿ耻ª䂪耻º䂺gof;抶r;橖lope;橗;橛ƀclo⸟⸡⸧ò⸁ash耻ø䃸l;折iŬⸯ⸴de耻õ䃵esĀ;aǛ⸺s;樶ml耻ö䃶bar;挽ૡ⹞\0⹽\0⺀⺝\0⺢⺹\0\0⻋ຜ\0⼓\0\0⼫⾼\0⿈rȀ;astЃ⹧⹲຅脀¶;l⹭⹮䂶leìЃɩ⹸\0\0⹻m;櫳;櫽y;䐿rʀcimpt⺋⺏⺓ᡥ⺗nt;䀥od;䀮il;怰enk;怱r;쀀𝔭ƀimo⺨⺰⺴Ā;v⺭⺮䏆;䏕maô੶ne;明ƀ;tv⺿⻀⻈䏀chfork»´;䏖Āau⻏⻟nĀck⻕⻝kĀ;h⇴⻛;愎ö⇴sҀ;abcdemst⻳⻴ᤈ⻹⻽⼄⼆⼊⼎䀫cir;樣ir;樢Āouᵀ⼂;樥;橲n肻±ຝim;樦wo;樧ƀipu⼙⼠⼥ntint;樕f;쀀𝕡nd耻£䂣Ԁ;Eaceinosu່⼿⽁⽄⽇⾁⾉⾒⽾⾶;檳p;檷uå໙Ā;c໎⽌̀;acens່⽙⽟⽦⽨⽾pproø⽃urlyeñ໙ñ໎ƀaes⽯⽶⽺pprox;檹qq;檵im;拨iíໟmeĀ;s⾈ຮ怲ƀEas⽸⾐⽺ð⽵ƀdfp໬⾙⾯ƀals⾠⾥⾪lar;挮ine;挒urf;挓Ā;t໻⾴ï໻rel;抰Āci⿀⿅r;쀀𝓅;䏈ncsp;怈̀fiopsu⿚⋢⿟⿥⿫⿱r;쀀𝔮pf;쀀𝕢rime;恗cr;쀀𝓆ƀaeo⿸〉〓tĀei⿾々rnionóڰnt;樖stĀ;e【】䀿ñἙô༔઀ABHabcdefhilmnoprstux぀けさすムㄎㄫㅇㅢㅲㆎ㈆㈕㈤㈩㉘㉮㉲㊐㊰㊷ƀartぇおがròႳòϝail;検aròᱥar;楤΀cdenqrtとふへみわゔヌĀeuねぱ;쀀∽̱te;䅕iãᅮmptyv;榳gȀ;del࿑らるろ;榒;榥å࿑uo耻»䂻rր;abcfhlpstw࿜ガクシスゼゾダッデナp;極Ā;f࿠ゴs;椠;椳s;椞ë≝ð✮l;楅im;楴l;憣;憝Āaiパフil;椚oĀ;nホボ戶aló༞ƀabrョリヮrò៥rk;杳ĀakンヽcĀekヹ・;䁽;䁝Āes㄂㄄;榌lĀduㄊㄌ;榎;榐Ȁaeuyㄗㄜㄧㄩron;䅙Ādiㄡㄥil;䅗ì࿲âヺ;䑀Ȁclqsㄴㄷㄽㅄa;椷dhar;楩uoĀ;rȎȍh;憳ƀacgㅎㅟངlȀ;ipsླྀㅘㅛႜnåႻarôྩt;断ƀilrㅩဣㅮsht;楽;쀀𝔯ĀaoㅷㆆrĀduㅽㅿ»ѻĀ;l႑ㆄ;楬Ā;vㆋㆌ䏁;䏱ƀgns㆕ㇹㇼht̀ahlrstㆤㆰ㇂㇘㇤㇮rrowĀ;t࿜ㆭaéトarpoonĀduㆻㆿowîㅾp»႒eftĀah㇊㇐rrowó࿪arpoonóՑightarrows;應quigarro÷ニhreetimes;拌g;䋚ingdotseñἲƀahm㈍㈐㈓rò࿪aòՑ;怏oustĀ;a㈞㈟掱che»㈟mid;櫮Ȁabpt㈲㈽㉀㉒Ānr㈷㈺g;柭r;懾rëဃƀafl㉇㉊㉎r;榆;쀀𝕣us;樮imes;樵Āap㉝㉧rĀ;g㉣㉤䀩t;榔olint;樒arò㇣Ȁachq㉻㊀Ⴜ㊅quo;怺r;쀀𝓇Ābu・㊊oĀ;rȔȓƀhir㊗㊛㊠reåㇸmes;拊iȀ;efl㊪ၙᠡ㊫方tri;槎luhar;楨;愞ൡ㋕㋛㋟㌬㌸㍱\0㍺㎤\0\0㏬㏰\0㐨㑈㑚㒭㒱㓊㓱\0㘖\0\0㘳cute;䅛quï➺Ԁ;Eaceinpsyᇭ㋳㋵㋿㌂㌋㌏㌟㌦㌩;檴ǰ㋺\0㋼;檸on;䅡uåᇾĀ;dᇳ㌇il;䅟rc;䅝ƀEas㌖㌘㌛;檶p;檺im;择olint;樓iíሄ;䑁otƀ;be㌴ᵇ㌵担;橦΀Aacmstx㍆㍊㍗㍛㍞㍣㍭rr;懘rĀhr㍐㍒ë∨Ā;oਸ਼਴t耻§䂧i;䀻war;椩mĀin㍩ðnuóñt;朶rĀ;o㍶⁕쀀𝔰Ȁacoy㎂㎆㎑㎠rp;景Āhy㎋㎏cy;䑉;䑈rtɭ㎙\0\0㎜iäᑤaraì⹯耻­䂭Āgm㎨㎴maƀ;fv㎱㎲㎲䏃;䏂Ѐ;deglnprካ㏅㏉㏎㏖㏞㏡㏦ot;橪Ā;q኱ኰĀ;E㏓㏔檞;檠Ā;E㏛㏜檝;檟e;扆lus;樤arr;楲aròᄽȀaeit㏸㐈㐏㐗Āls㏽㐄lsetmé㍪hp;樳parsl;槤Ādlᑣ㐔e;挣Ā;e㐜㐝檪Ā;s㐢㐣檬;쀀⪬︀ƀflp㐮㐳㑂tcy;䑌Ā;b㐸㐹䀯Ā;a㐾㐿槄r;挿f;쀀𝕤aĀdr㑍ЂesĀ;u㑔㑕晠it»㑕ƀcsu㑠㑹㒟Āau㑥㑯pĀ;sᆈ㑫;쀀⊓︀pĀ;sᆴ㑵;쀀⊔︀uĀbp㑿㒏ƀ;esᆗᆜ㒆etĀ;eᆗ㒍ñᆝƀ;esᆨᆭ㒖etĀ;eᆨ㒝ñᆮƀ;afᅻ㒦ְrť㒫ֱ»ᅼaròᅈȀcemt㒹㒾㓂㓅r;쀀𝓈tmîñiì㐕aræᆾĀar㓎㓕rĀ;f㓔ឿ昆Āan㓚㓭ightĀep㓣㓪psiloîỠhé⺯s»⡒ʀbcmnp㓻㕞ሉ㖋㖎Ҁ;Edemnprs㔎㔏㔑㔕㔞㔣㔬㔱㔶抂;櫅ot;檽Ā;dᇚ㔚ot;櫃ult;櫁ĀEe㔨㔪;櫋;把lus;檿arr;楹ƀeiu㔽㕒㕕tƀ;en㔎㕅㕋qĀ;qᇚ㔏eqĀ;q㔫㔨m;櫇Ābp㕚㕜;櫕;櫓c̀;acensᇭ㕬㕲㕹㕻㌦pproø㋺urlyeñᇾñᇳƀaes㖂㖈㌛pproø㌚qñ㌗g;晪ڀ123;Edehlmnps㖩㖬㖯ሜ㖲㖴㗀㗉㗕㗚㗟㗨㗭耻¹䂹耻²䂲耻³䂳;櫆Āos㖹㖼t;檾ub;櫘Ā;dሢ㗅ot;櫄sĀou㗏㗒l;柉b;櫗arr;楻ult;櫂ĀEe㗤㗦;櫌;抋lus;櫀ƀeiu㗴㘉㘌tƀ;enሜ㗼㘂qĀ;qሢ㖲eqĀ;q㗧㗤m;櫈Ābp㘑㘓;櫔;櫖ƀAan㘜㘠㘭rr;懙rĀhr㘦㘨ë∮Ā;oਫ਩war;椪lig耻ß䃟௡㙑㙝㙠ዎ㙳㙹\0㙾㛂\0\0\0\0\0㛛㜃\0㜉㝬\0\0\0㞇ɲ㙖\0\0㙛get;挖;䏄rë๟ƀaey㙦㙫㙰ron;䅥dil;䅣;䑂lrec;挕r;쀀𝔱Ȁeiko㚆㚝㚵㚼Dz㚋\0㚑eĀ4fኄኁaƀ;sv㚘㚙㚛䎸ym;䏑Ācn㚢㚲kĀas㚨㚮pproø዁im»ኬsðኞĀas㚺㚮ð዁rn耻þ䃾Ǭ̟㛆⋧es膀×;bd㛏㛐㛘䃗Ā;aᤏ㛕r;樱;樰ƀeps㛡㛣㜀á⩍Ȁ;bcf҆㛬㛰㛴ot;挶ir;櫱Ā;o㛹㛼쀀𝕥rk;櫚á㍢rime;怴ƀaip㜏㜒㝤dåቈ΀adempst㜡㝍㝀㝑㝗㝜㝟ngleʀ;dlqr㜰㜱㜶㝀㝂斵own»ᶻeftĀ;e⠀㜾ñम;扜ightĀ;e㊪㝋ñၚot;旬inus;樺lus;樹b;槍ime;樻ezium;揢ƀcht㝲㝽㞁Āry㝷㝻;쀀𝓉;䑆cy;䑛rok;䅧Āio㞋㞎xô᝷headĀlr㞗㞠eftarro÷ࡏightarrow»ཝऀAHabcdfghlmoprstuw㟐㟓㟗㟤㟰㟼㠎㠜㠣㠴㡑㡝㡫㢩㣌㣒㣪㣶ròϭar;楣Ācr㟜㟢ute耻ú䃺òᅐrǣ㟪\0㟭y;䑞ve;䅭Āiy㟵㟺rc耻û䃻;䑃ƀabh㠃㠆㠋ròᎭlac;䅱aòᏃĀir㠓㠘sht;楾;쀀𝔲rave耻ù䃹š㠧㠱rĀlr㠬㠮»ॗ»ႃlk;斀Āct㠹㡍ɯ㠿\0\0㡊rnĀ;e㡅㡆挜r»㡆op;挏ri;旸Āal㡖㡚cr;䅫肻¨͉Āgp㡢㡦on;䅳f;쀀𝕦̀adhlsuᅋ㡸㡽፲㢑㢠ownáᎳarpoonĀlr㢈㢌efô㠭ighô㠯iƀ;hl㢙㢚㢜䏅»ᏺon»㢚parrows;懈ƀcit㢰㣄㣈ɯ㢶\0\0㣁rnĀ;e㢼㢽挝r»㢽op;挎ng;䅯ri;旹cr;쀀𝓊ƀdir㣙㣝㣢ot;拰lde;䅩iĀ;f㜰㣨»᠓Āam㣯㣲rò㢨l耻ü䃼angle;榧ހABDacdeflnoprsz㤜㤟㤩㤭㦵㦸㦽㧟㧤㧨㧳㧹㧽㨁㨠ròϷarĀ;v㤦㤧櫨;櫩asèϡĀnr㤲㤷grt;榜΀eknprst㓣㥆㥋㥒㥝㥤㦖appá␕othinçẖƀhir㓫⻈㥙opô⾵Ā;hᎷ㥢ïㆍĀiu㥩㥭gmá㎳Ābp㥲㦄setneqĀ;q㥽㦀쀀⊊︀;쀀⫋︀setneqĀ;q㦏㦒쀀⊋︀;쀀⫌︀Āhr㦛㦟etá㚜iangleĀlr㦪㦯eft»थight»ၑy;䐲ash»ံƀelr㧄㧒㧗ƀ;beⷪ㧋㧏ar;抻q;扚lip;拮Ābt㧜ᑨaòᑩr;쀀𝔳tré㦮suĀbp㧯㧱»ജ»൙pf;쀀𝕧roð໻tré㦴Ācu㨆㨋r;쀀𝓋Ābp㨐㨘nĀEe㦀㨖»㥾nĀEe㦒㨞»㦐igzag;榚΀cefoprs㨶㨻㩖㩛㩔㩡㩪irc;䅵Ādi㩀㩑Ābg㩅㩉ar;機eĀ;qᗺ㩏;扙erp;愘r;쀀𝔴pf;쀀𝕨Ā;eᑹ㩦atèᑹcr;쀀𝓌ૣណ㪇\0㪋\0㪐㪛\0\0㪝㪨㪫㪯\0\0㫃㫎\0㫘ៜ៟tré៑r;쀀𝔵ĀAa㪔㪗ròσrò৶;䎾ĀAa㪡㪤ròθrò৫að✓is;拻ƀdptឤ㪵㪾Āfl㪺ឩ;쀀𝕩imåឲĀAa㫇㫊ròώròਁĀcq㫒ីr;쀀𝓍Āpt៖㫜ré។Ѐacefiosu㫰㫽㬈㬌㬑㬕㬛㬡cĀuy㫶㫻te耻ý䃽;䑏Āiy㬂㬆rc;䅷;䑋n耻¥䂥r;쀀𝔶cy;䑗pf;쀀𝕪cr;쀀𝓎Ācm㬦㬩y;䑎l耻ÿ䃿Ԁacdefhiosw㭂㭈㭔㭘㭤㭩㭭㭴㭺㮀cute;䅺Āay㭍㭒ron;䅾;䐷ot;䅼Āet㭝㭡træᕟa;䎶r;쀀𝔷cy;䐶grarr;懝pf;쀀𝕫cr;쀀𝓏Ājn㮅㮇;怍j;怌`.split(``).map(e=>e.charCodeAt(0))),Gv=new Uint16Array(`Ȁaglq \x1Bɭ\0\0p;䀦os;䀧t;䀾t;䀼uot;䀢`.split(``).map(e=>e.charCodeAt(0))),Kv=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),qv=String.fromCodePoint??function(e){let t=``;return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function Jv(e){return e>=55296&&e<=57343||e>1114111?65533:Kv.get(e)??e}var Yv;(function(e){e[e.NUM=35]=`NUM`,e[e.SEMI=59]=`SEMI`,e[e.EQUALS=61]=`EQUALS`,e[e.ZERO=48]=`ZERO`,e[e.NINE=57]=`NINE`,e[e.LOWER_A=97]=`LOWER_A`,e[e.LOWER_F=102]=`LOWER_F`,e[e.LOWER_X=120]=`LOWER_X`,e[e.LOWER_Z=122]=`LOWER_Z`,e[e.UPPER_A=65]=`UPPER_A`,e[e.UPPER_F=70]=`UPPER_F`,e[e.UPPER_Z=90]=`UPPER_Z`})(Yv||={});var Xv=32,Zv;(function(e){e[e.VALUE_LENGTH=49152]=`VALUE_LENGTH`,e[e.BRANCH_LENGTH=16256]=`BRANCH_LENGTH`,e[e.JUMP_TABLE=127]=`JUMP_TABLE`})(Zv||={});function Qv(e){return e>=Yv.ZERO&&e<=Yv.NINE}function $v(e){return e>=Yv.UPPER_A&&e<=Yv.UPPER_F||e>=Yv.LOWER_A&&e<=Yv.LOWER_F}function ey(e){return e>=Yv.UPPER_A&&e<=Yv.UPPER_Z||e>=Yv.LOWER_A&&e<=Yv.LOWER_Z||Qv(e)}function ty(e){return e===Yv.EQUALS||ey(e)}var ny;(function(e){e[e.EntityStart=0]=`EntityStart`,e[e.NumericStart=1]=`NumericStart`,e[e.NumericDecimal=2]=`NumericDecimal`,e[e.NumericHex=3]=`NumericHex`,e[e.NamedEntity=4]=`NamedEntity`})(ny||={});var ry;(function(e){e[e.Legacy=0]=`Legacy`,e[e.Strict=1]=`Strict`,e[e.Attribute=2]=`Attribute`})(ry||={});var iy=class{constructor(e,t,n){this.decodeTree=e,this.emitCodePoint=t,this.errors=n,this.state=ny.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=ry.Strict}startEntity(e){this.decodeMode=e,this.state=ny.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(e,t){switch(this.state){case ny.EntityStart:return e.charCodeAt(t)===Yv.NUM?(this.state=ny.NumericStart,this.consumed+=1,this.stateNumericStart(e,t+1)):(this.state=ny.NamedEntity,this.stateNamedEntity(e,t));case ny.NumericStart:return this.stateNumericStart(e,t);case ny.NumericDecimal:return this.stateNumericDecimal(e,t);case ny.NumericHex:return this.stateNumericHex(e,t);case ny.NamedEntity:return this.stateNamedEntity(e,t)}}stateNumericStart(e,t){return t>=e.length?-1:(e.charCodeAt(t)|Xv)===Yv.LOWER_X?(this.state=ny.NumericHex,this.consumed+=1,this.stateNumericHex(e,t+1)):(this.state=ny.NumericDecimal,this.stateNumericDecimal(e,t))}addToNumericResult(e,t,n,r){if(t!==n){let i=n-t;this.result=this.result*r**+i+parseInt(e.substr(t,i),r),this.consumed+=i}}stateNumericHex(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(Qv(r)||$v(r))t+=1;else return this.addToNumericResult(e,n,t,16),this.emitNumericEntity(r,3)}return this.addToNumericResult(e,n,t,16),-1}stateNumericDecimal(e,t){let n=t;for(;t<e.length;){let r=e.charCodeAt(t);if(Qv(r))t+=1;else return this.addToNumericResult(e,n,t,10),this.emitNumericEntity(r,2)}return this.addToNumericResult(e,n,t,10),-1}emitNumericEntity(e,t){var n;if(this.consumed<=t)return(n=this.errors)==null||n.absenceOfDigitsInNumericCharacterReference(this.consumed),0;if(e===Yv.SEMI)this.consumed+=1;else if(this.decodeMode===ry.Strict)return 0;return this.emitCodePoint(Jv(this.result),this.consumed),this.errors&&(e!==Yv.SEMI&&this.errors.missingSemicolonAfterCharacterReference(),this.errors.validateNumericCharacterReference(this.result)),this.consumed}stateNamedEntity(e,t){let{decodeTree:n}=this,r=n[this.treeIndex],i=(r&Zv.VALUE_LENGTH)>>14;for(;t<e.length;t++,this.excess++){let a=e.charCodeAt(t);if(this.treeIndex=oy(n,r,this.treeIndex+Math.max(1,i),a),this.treeIndex<0)return this.result===0||this.decodeMode===ry.Attribute&&(i===0||ty(a))?0:this.emitNotTerminatedNamedEntity();if(r=n[this.treeIndex],i=(r&Zv.VALUE_LENGTH)>>14,i!==0){if(a===Yv.SEMI)return this.emitNamedEntityData(this.treeIndex,i,this.consumed+this.excess);this.decodeMode!==ry.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var e;let{result:t,decodeTree:n}=this,r=(n[t]&Zv.VALUE_LENGTH)>>14;return this.emitNamedEntityData(t,r,this.consumed),(e=this.errors)==null||e.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(e,t,n){let{decodeTree:r}=this;return this.emitCodePoint(t===1?r[e]&~Zv.VALUE_LENGTH:r[e+1],n),t===3&&this.emitCodePoint(r[e+2],n),n}end(){var e;switch(this.state){case ny.NamedEntity:return this.result!==0&&(this.decodeMode!==ry.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case ny.NumericDecimal:return this.emitNumericEntity(0,2);case ny.NumericHex:return this.emitNumericEntity(0,3);case ny.NumericStart:return(e=this.errors)==null||e.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case ny.EntityStart:return 0}}};function ay(e){let t=``,n=new iy(e,e=>t+=qv(e));return function(e,r){let i=0,a=0;for(;(a=e.indexOf(`&`,a))>=0;){t+=e.slice(i,a),n.startEntity(r);let o=n.write(e,a+1);if(o<0){i=a+n.end();break}i=a+o,a=o===0?i+1:i}let o=t+e.slice(i);return t=``,o}}function oy(e,t,n,r){let i=(t&Zv.BRANCH_LENGTH)>>7,a=t&Zv.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let t=r-a;return t<0||t>=i?-1:e[n+t]-1}let o=n,s=o+i-1;for(;o<=s;){let t=o+s>>>1,n=e[t];if(n<r)o=t+1;else if(n>r)s=t-1;else return e[t+i]}return-1}var sy=ay(Wv);ay(Gv);function cy(e,t=ry.Legacy){return sy(e,t)}function ly(e){return sy(e,ry.Strict)}var uy=s({arrayReplaceAt:()=>gy,asciiTrim:()=>zy,assign:()=>hy,escapeHtml:()=>ky,escapeRE:()=>jy,fromCodePoint:()=>vy,has:()=>my,isMdAsciiPunct:()=>Iy,isPunctChar:()=>Py,isPunctCharCode:()=>Fy,isSpace:()=>My,isString:()=>fy,isValidEntityCode:()=>_y,isWhiteSpace:()=>Ny,lib:()=>By,normalizeReference:()=>Ly,unescapeAll:()=>wy,unescapeMd:()=>Cy});function dy(e){return Object.prototype.toString.call(e)}function fy(e){return dy(e)===`[object String]`}var py=Object.prototype.hasOwnProperty;function my(e,t){return py.call(e,t)}function hy(e){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(t){if(typeof t!=`object`)throw TypeError(t+`must be object`);Object.keys(t).forEach(function(n){e[n]=t[n]})}}),e}function gy(e,t,n){return[].concat(e.slice(0,t),n,e.slice(t+1))}function _y(e){return!(e>=55296&&e<=57343||e>=64976&&e<=65007||(e&65535)==65535||(e&65535)==65534||e>=0&&e<=8||e===11||e>=14&&e<=31||e>=127&&e<=159||e>1114111)}function vy(e){if(e>65535){e-=65536;let t=55296+(e>>10),n=56320+(e&1023);return String.fromCharCode(t,n)}return String.fromCharCode(e)}var yy=/\\([!"#$%&'()*+,\-./:;<=>?@[\\\]^_`{|}~])/g,by=RegExp(yy.source+`|&([a-z#][a-z0-9]{1,31});`,`gi`),xy=/^#((?:x[a-f0-9]{1,8}|[0-9]{1,8}))$/i;function Sy(e,t){if(t.charCodeAt(0)===35&&xy.test(t)){let n=t[1].toLowerCase()===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return _y(n)?vy(n):e}let n=cy(e);return n===e?e:n}function Cy(e){return e.indexOf(`\\`)<0?e:e.replace(yy,`$1`)}function wy(e){return e.indexOf(`\\`)<0&&e.indexOf(`&`)<0?e:e.replace(by,function(e,t,n){return t||Sy(e,n)})}var Ty=/[&<>"]/,Ey=/[&<>"]/g,Dy={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`};function Oy(e){return Dy[e]}function ky(e){return Ty.test(e)?e.replace(Ey,Oy):e}var Ay=/[.?*+^$[\]\\(){}|-]/g;function jy(e){return e.replace(Ay,`\\$&`)}function My(e){switch(e){case 9:case 32:return!0}return!1}function Ny(e){if(e>=8192&&e<=8202)return!0;switch(e){case 9:case 10:case 11:case 12:case 13:case 32:case 160:case 5760:case 8239:case 8287:case 12288:return!0}return!1}function Py(e){return Bv.test(e)||Vv.test(e)}function Fy(e){return Py(vy(e))}function Iy(e){switch(e){case 33:case 34:case 35:case 36:case 37:case 38:case 39:case 40:case 41:case 42:case 43:case 44:case 45:case 46:case 47:case 58:case 59:case 60:case 61:case 62:case 63:case 64:case 91:case 92:case 93:case 94:case 95:case 96:case 123:case 124:case 125:case 126:return!0;default:return!1}}function Ly(e){return e=e.trim().replace(/\s+/g,` `),e.toLowerCase().toUpperCase()}function Ry(e){return e===32||e===9||e===10||e===13}function zy(e){let t=0;for(;t<e.length&&Ry(e.charCodeAt(t));t++);let n=e.length-1;for(;n>=t&&Ry(e.charCodeAt(n));n--);return e.slice(t,n+1)}var By={mdurl:Iv,ucmicro:Uv};function Vy(e,t,n){let r,i,a,o,s=e.posMax,c=e.pos;for(e.pos=t+1,r=1;e.pos<s;){if(a=e.src.charCodeAt(e.pos),a===93&&(r--,r===0)){i=!0;break}if(o=e.pos,e.md.inline.skipToken(e),a===91){if(o===e.pos-1)r++;else if(n)return e.pos=c,-1}}let l=-1;return i&&(l=e.pos),e.pos=c,l}function Hy(e,t,n){let r,i=t,a={ok:!1,pos:0,str:``};if(e.charCodeAt(i)===60){for(i++;i<n;){if(r=e.charCodeAt(i),r===10||r===60)return a;if(r===62)return a.pos=i+1,a.str=wy(e.slice(t+1,i)),a.ok=!0,a;if(r===92&&i+1<n){i+=2;continue}i++}return a}let o=0;for(;i<n&&(r=e.charCodeAt(i),!(r===32||r<32||r===127));){if(r===92&&i+1<n){if(e.charCodeAt(i+1)===32)break;i+=2;continue}if(r===40&&(o++,o>32))return a;if(r===41){if(o===0)break;o--}i++}return t===i||o!==0?a:(a.str=wy(e.slice(t,i)),a.pos=i,a.ok=!0,a)}function Uy(e,t,n,r){let i,a=t,o={ok:!1,can_continue:!1,pos:0,str:``,marker:0};if(r)o.str=r.str,o.marker=r.marker;else{if(a>=n)return o;let r=e.charCodeAt(a);if(r!==34&&r!==39&&r!==40)return o;t++,a++,r===40&&(r=41),o.marker=r}for(;a<n;){if(i=e.charCodeAt(a),i===o.marker)return o.pos=a+1,o.str+=wy(e.slice(t,a)),o.ok=!0,o;if(i===40&&o.marker===41)return o;i===92&&a+1<n&&a++,a++}return o.can_continue=!0,o.str+=wy(e.slice(t,a)),o}var Wy=s({parseLinkDestination:()=>Hy,parseLinkLabel:()=>Vy,parseLinkTitle:()=>Uy}),Gy={};Gy.code_inline=function(e,t,n,r,i){let a=e[t];return`<code`+i.renderAttrs(a)+`>`+ky(a.content)+`</code>`},Gy.code_block=function(e,t,n,r,i){let a=e[t];return`<pre`+i.renderAttrs(a)+`><code>`+ky(e[t].content)+`</code></pre>
54
54
  `},Gy.fence=function(e,t,n,r,i){let a=e[t],o=a.info?wy(a.info).trim():``,s=``,c=``;if(o){let e=o.split(/(\s+)/g);s=e[0],c=e.slice(2).join(``)}let l;if(l=n.highlight&&n.highlight(a.content,s,c)||ky(a.content),l.indexOf(`<pre`)===0)return l+`