opencami 1.9.1 → 2.0.0

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 (66) hide show
  1. package/dist/client/assets/{CSPContext-B3PAVjBL.js → CSPContext-CrlIQW7-.js} +1 -1
  2. package/dist/client/assets/{DirectionContext-CR5CCisG.js → DirectionContext-X-0CRn1O.js} +1 -1
  3. package/dist/client/assets/_sessionKey-yNQ57svB.js +23 -0
  4. package/dist/client/assets/agents-WqWjsymD.js +2 -0
  5. package/dist/client/assets/{agents-screen--ZMzN5cB.js → agents-screen-BhOVp_S6.js} +1 -1
  6. package/dist/client/assets/bots-DNqiFT7w.js +2 -0
  7. package/dist/client/assets/{bots-screen-C_uJBNwI.js → bots-screen-DLFd0ydi.js} +1 -1
  8. package/dist/client/assets/button-D0n2Qsd_.js +1 -0
  9. package/dist/client/assets/{composite-DArWbFHm.js → composite-GtKwZKbV.js} +1 -1
  10. package/dist/client/assets/{connect-B48HecjN.js → connect-vQWL0_11.js} +1 -1
  11. package/dist/client/assets/{dashboard-BVKx9FMy.js → dashboard-Knwc61i1.js} +1 -1
  12. package/dist/client/assets/{event-BCwqPPkP.js → event-CHpdjYFR.js} +1 -1
  13. package/dist/client/assets/file-explorer-screen-FoYNs9zK.js +1 -0
  14. package/dist/client/assets/files-BtR_gArr.js +2 -0
  15. package/dist/client/assets/follow-up-suggestions-DVXNLqga.js +5 -0
  16. package/dist/client/assets/{index-0gdwm1_H.js → index-CNPHef4O.js} +1 -1
  17. package/dist/client/assets/{index-CGeJcqZ3.js → index-CTT0Y1ya.js} +1 -1
  18. package/dist/client/assets/{keyboard-shortcuts-dialog-CK_XTzLr.js → keyboard-shortcuts-dialog-DP8ptQ7N.js} +1 -1
  19. package/dist/client/assets/{main-B2CrcRuC.js → main-xPlWrMhO.js} +3 -3
  20. package/dist/client/assets/{markdown-CdkuX06F.js → markdown-3Js_RbUp.js} +1 -1
  21. package/dist/client/assets/memory-BRGPq5t6.js +2 -0
  22. package/dist/client/assets/{memory-screen-C1RfLy-d.js → memory-screen-nzRra2Qi.js} +1 -1
  23. package/dist/client/assets/{menu-CIwnliij.js → menu-BnSEqetd.js} +1 -1
  24. package/dist/client/assets/{opencami-logo-SVuYD55V.js → opencami-logo-B_hLbomw.js} +1 -1
  25. package/dist/client/assets/{proxy-BijR8W1L.js → proxy-BnlGpgC1.js} +1 -1
  26. package/dist/client/assets/{react-DWx7OvUo.js → react-BgjQyJHw.js} +1 -1
  27. package/dist/client/assets/{search-dialog-CB4KE8ec.js → search-dialog-Bib2QY9u.js} +1 -1
  28. package/dist/client/assets/{search-sources-badge-B8Z-8sSf.js → search-sources-badge-COHcYFRB.js} +1 -1
  29. package/dist/client/assets/{session-export-dialog-tDiFuv3a.js → session-export-dialog-ooPnfHh_.js} +1 -1
  30. package/dist/client/assets/settings-dialog-B8mz99u-.js +1 -0
  31. package/dist/client/assets/skills-DA9J_tsC.js +2 -0
  32. package/dist/client/assets/{skills-panel-fjJQVMog.js → skills-panel-D2uMdCHp.js} +1 -1
  33. package/dist/client/assets/styles-CWabEzNU.css +1 -0
  34. package/dist/client/assets/{switch-Bn5uei2k.js → switch-BUQ0qH6r.js} +1 -1
  35. package/dist/client/assets/{tabs-DOBNAUVE.js → tabs-BEyU6TjN.js} +1 -1
  36. package/dist/client/assets/{thinking-dfGrFAMV.js → thinking-CA48yhOE.js} +1 -1
  37. package/dist/client/assets/{tooltip-DOKkNFvu.js → tooltip-CcIdgcV0.js} +1 -1
  38. package/dist/client/assets/{use-file-explorer-state-BAa6Cxyr.js → use-file-explorer-state-CN_IJGcd.js} +2 -2
  39. package/dist/client/assets/{useBaseUiId-DFpBD0sg.js → useBaseUiId-ClbEYEil.js} +1 -1
  40. package/dist/client/assets/useCompositeItem-B_OxfJee.js +1 -0
  41. package/dist/client/assets/{useControlled-CQHE0ITz.js → useControlled-CyT-lqbs.js} +1 -1
  42. package/dist/client/assets/{useMutation-BFl-7GnD.js → useMutation-eQUrsn-X.js} +1 -1
  43. package/dist/client/assets/{useOnFirstRender-DlXHIIGk.js → useOnFirstRender-CR_o2MK_.js} +1 -1
  44. package/dist/client/assets/{useQuery-D-sF8Tld.js → useQuery-k6EMRoMD.js} +1 -1
  45. package/dist/server/assets/{_sessionKey-D8TGrDRM.js → _sessionKey-CaFqmyhU.js} +56 -263
  46. package/dist/server/assets/{_tanstack-start-manifest_v-DalBo2bY.js → _tanstack-start-manifest_v-P3skSR3R.js} +1 -1
  47. package/dist/server/assets/{follow-up-suggestions-C65ptDij.js → follow-up-suggestions-DHv2_XzB.js} +13 -74
  48. package/dist/server/assets/{index-gRco4Ina.js → index-C7lmufwX.js} +1 -1
  49. package/dist/server/assets/{router-DaKDqc9w.js → router-X2L0PDPI.js} +124 -287
  50. package/dist/server/assets/{search-dialog-DSSK93kq.js → search-dialog-CXhofdoP.js} +2 -2
  51. package/dist/server/assets/{settings-dialog-DyWNblva.js → settings-dialog-CPdftvjz.js} +1 -254
  52. package/dist/server/assets/{thinking-CU0FRlzT.js → thinking-YkRSlXtf.js} +2 -2
  53. package/dist/server/server.js +2 -2
  54. package/package.json +1 -1
  55. package/dist/client/assets/_sessionKey-Bg_9uype.js +0 -23
  56. package/dist/client/assets/agents-BiTHBb6Z.js +0 -2
  57. package/dist/client/assets/bots-DxhRnQp5.js +0 -2
  58. package/dist/client/assets/button-BciDmec0.js +0 -1
  59. package/dist/client/assets/file-explorer-screen-DPs-FWeA.js +0 -1
  60. package/dist/client/assets/files-SEycwYCa.js +0 -2
  61. package/dist/client/assets/follow-up-suggestions-BPjWBpiy.js +0 -5
  62. package/dist/client/assets/memory-C7lKdkmc.js +0 -2
  63. package/dist/client/assets/settings-dialog-aL-AH4Rt.js +0 -1
  64. package/dist/client/assets/skills-D1T6uemU.js +0 -2
  65. package/dist/client/assets/styles-D0L88B64.css +0 -1
  66. package/dist/client/assets/useCompositeItem-B-Axq9-D.js +0 -1
@@ -1 +1 @@
1
- import{u as w,p as Me,g as Y,j as At,a as E,O as Ft,r as Lt,d as B,w as Ce,x as Dt,i as jt,h as _t,o as Vt,E as Ie,t as We,H as Ht,n as qt}from"./useBaseUiId-DFpBD0sg.js";import{C as X,ab as ue,ag as Bt,ac as Kt,ai as zt,af as Wt}from"./button-BciDmec0.js";import{r as d,j as D,w as Ae,x as Ut,y as Yt}from"./main-B2CrcRuC.js";import{u as Qe,e as ee,o as G,d as Gt,v as $t,w as Xt,k as U,x as Zt,y as A,f as Jt,F as Qt,z as et,S as tt}from"./event-BCwqPPkP.js";import{a as en}from"./visuallyHidden-COI6QeQH.js";const Sr=500,Tr=500,Rr={style:{transition:"none"}},Cr="data-base-ui-click-trigger",Ir={fallbackAxisSide:"none"},xr={fallbackAxisSide:"end"},tn={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Q=0;class me{static create(){return new me}currentId=Q;start(e,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Q,n()},e)}isStarted(){return this.currentId!==Q}clear=()=>{this.currentId!==Q&&(clearTimeout(this.currentId),this.currentId=Q)};disposeEffect=()=>this.clear}function Ue(){const t=X(me.create).current;return Qe(t.disposeEffect),t}const se=null;class nn{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let s=0;s<n.length;s+=1)n[s]?.(e)};request(e){const n=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(e){const n=e-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const ie=new nn;class L{static create(){return new L}static request(e){return ie.request(e)}static cancel(e){return ie.cancel(e)}currentId=se;request(e){this.cancel(),this.currentId=ie.request(()=>{this.currentId=se,e()})}cancel=()=>{this.currentId!==se&&(ie.cancel(this.currentId),this.currentId=se)};disposeEffect=()=>this.cancel}function rn(){const t=X(L.create).current;return Qe(t.disposeEffect),t}function Or(t){const e=X(sn,t).current;return e.next=t,w(e.effect),e}function sn(t){const e={current:t,next:t,effect:()=>{e.current=e.next}};return e}function le(t,e,n=!0){return t.filter(s=>s.parentId===e&&(!n||s.context?.open)).flatMap(s=>[s,...le(t,s.id,n)])}function wr(t,e){let n=[],r=t.find(s=>s.id===e)?.parentId;for(;r;){const s=t.find(i=>i.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}var on=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],fe=on.join(","),nt=typeof Element>"u",$=nt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,de=!nt&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},pe=function(e,n){var r;n===void 0&&(n=!0);var s=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),i=s===""||s==="true",a=i||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):pe(e.parentNode));return a},an=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},rt=function(e,n,r){if(pe(e))return[];var s=Array.prototype.slice.apply(e.querySelectorAll(fe));return n&&$.call(e,fe)&&s.unshift(e),s=s.filter(r),s},ge=function(e,n,r){for(var s=[],i=Array.from(e);i.length;){var a=i.shift();if(!pe(a,!1))if(a.tagName==="SLOT"){var o=a.assignedElements(),l=o.length?o:a.children,c=ge(l,!0,r);r.flatten?s.push.apply(s,c):s.push({scopeParent:a,candidates:c})}else{var g=$.call(a,fe);g&&r.filter(a)&&(n||!e.includes(a))&&s.push(a);var f=a.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(a),b=!pe(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(f&&b){var v=ge(f===!0?a.children:f.children,!0,r);r.flatten?s.push.apply(s,v):s.push({scopeParent:a,candidates:v})}else i.unshift.apply(i,a.children)}}return s},st=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},it=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||an(e))&&!st(e)?0:e.tabIndex},cn=function(e,n){var r=it(e);return r<0&&n&&!st(e)?0:r},un=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},ot=function(e){return e.tagName==="INPUT"},ln=function(e){return ot(e)&&e.type==="hidden"},fn=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},dn=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},pn=function(e){if(!e.name)return!0;var n=e.form||de(e),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},s;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")s=r(window.CSS.escape(e.name));else try{s=r(e.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var i=dn(s,e.form);return!i||i===e},gn=function(e){return ot(e)&&e.type==="radio"},hn=function(e){return gn(e)&&!pn(e)},mn=function(e){var n,r=e&&de(e),s=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==e){var a,o,l;for(i=!!((a=s)!==null&&a!==void 0&&(o=a.ownerDocument)!==null&&o!==void 0&&o.contains(s)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!i&&s;){var c,g,f;r=de(s),s=(c=r)===null||c===void 0?void 0:c.host,i=!!((g=s)!==null&&g!==void 0&&(f=g.ownerDocument)!==null&&f!==void 0&&f.contains(s))}}return i},Ye=function(e){var n=e.getBoundingClientRect(),r=n.width,s=n.height;return r===0&&s===0},bn=function(e,n){var r=n.displayCheck,s=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var i=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(e).visibility==="hidden")return!0;var a=$.call(e,"details>summary:first-of-type"),o=a?e.parentElement:e;if($.call(o,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof s=="function"){for(var l=e;e;){var c=e.parentElement,g=de(e);if(c&&!c.shadowRoot&&s(c)===!0)return Ye(e);e.assignedSlot?e=e.assignedSlot:!c&&g!==e.ownerDocument?e=g.host:e=c}e=l}if(mn(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ye(e);return!1},vn=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var s=n.children.item(r);if(s.tagName==="LEGEND")return $.call(n,"fieldset[disabled] *")?!0:!s.contains(e)}return!0}n=n.parentElement}return!1},Oe=function(e,n){return!(n.disabled||ln(n)||bn(n,e)||fn(n)||vn(n))},we=function(e,n){return!(hn(n)||it(n)<0||!Oe(e,n))},En=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},at=function(e){var n=[],r=[];return e.forEach(function(s,i){var a=!!s.scopeParent,o=a?s.scopeParent:s,l=cn(o,a),c=a?at(s.candidates):o;l===0?a?n.push.apply(n,c):n.push(o):r.push({documentOrder:i,tabIndex:l,item:s,isScope:a,content:c})}),r.sort(un).reduce(function(s,i){return i.isScope?s.push.apply(s,i.content):s.push(i.content),s},[]).concat(n)},Fe=function(e,n){n=n||{};var r;return n.getShadowRoot?r=ge([e],n.includeContainer,{filter:we.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:En}):r=rt(e,n.includeContainer,we.bind(null,n)),at(r)},Pr=function(e,n){n=n||{};var r;return n.getShadowRoot?r=ge([e],n.includeContainer,{filter:Oe.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=rt(e,n.includeContainer,Oe.bind(null,n)),r},kr=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return $.call(e,fe)===!1?!1:we(n,e)};const Le=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ct(t,e){const n=Fe(t,Le()),r=n.length;if(r===0)return;const s=Gt(G(t)),i=n.indexOf(s),a=i===-1?e===1?0:r-1:i+e;return n[a]}function yn(t){return ct(G(t).body,1)||t}function Sn(t){return ct(G(t).body,-1)||t}function ut(t,e){if(!t)return null;const n=Fe(G(t).body,Le()),r=n.length;if(r===0)return null;const s=n.indexOf(t);if(s===-1)return null;const i=(s+e+r)%r;return n[i]}function Nr(t){return ut(t,1)}function Mr(t){return ut(t,-1)}function xe(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!ee(n,r)}function Tn(t){Fe(t,Le()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Ge(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function lt(){const t=new Map;return{emit(e,n){t.get(e)?.forEach(r=>r(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){t.get(e)?.delete(n)}}}class Rn{nodesRef={current:[]};events=lt();addNode(e){this.nodesRef.current.push(e)}removeNode(e){const n=this.nodesRef.current.findIndex(r=>r===e);n!==-1&&this.nodesRef.current.splice(n,1)}}const ft=d.createContext(null),dt=d.createContext(null),De=()=>d.useContext(ft)?.id||null,pt=t=>{const e=d.useContext(dt);return t??e};function Ar(t){const e=Me(),n=pt(t),r=De();return w(()=>{if(!e)return;const s={id:e,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,e,r]),e}function Fr(t){const{children:e,id:n}=t,r=De();return D.jsx(ft.Provider,{value:d.useMemo(()=>({id:n,parentId:r}),[n,r]),children:e})}function Lr(t){const{children:e,externalTree:n}=t,r=X(()=>n??new Rn).current;return D.jsx(dt.Provider,{value:r,children:e})}function gt(t){return`data-base-ui-${t}`}const $e=d.forwardRef(function(e,n){const[r,s]=d.useState();w(()=>{$t&&s("button")},[]);const i={tabIndex:0,role:r};return D.jsx("span",{...e,ref:n,style:en,"aria-hidden":r?void 0:!0,...i,"data-base-ui-focus-guard":""})}),ht=d.createContext(null),Cn=()=>d.useContext(ht),In=gt("portal");function xn(t={}){const{ref:e,container:n,componentProps:r=ue,elementProps:s}=t,i=Me(),o=Cn()?.portalNode,[l,c]=d.useState(null),[g,f]=d.useState(null),b=E(P=>{P!==null&&f(P)}),v=d.useRef(null);w(()=>{if(n===null){v.current&&(v.current=null,f(null),c(null));return}if(i==null)return;const P=(n&&(Ft(n)?n:n.current))??o??document.body;if(P==null){v.current&&(v.current=null,f(null),c(null));return}v.current!==P&&(v.current=P,f(null),c(P))},[n,o,i]);const S=Bt("div",r,{ref:[e,b],props:[{id:i,[In]:""},s]});return{portalNode:g,portalSubtree:l&&S?Ae.createPortal(S,l):null}}const Dr=d.forwardRef(function(e,n){const{children:r,container:s,className:i,render:a,renderGuards:o,...l}=e,{portalNode:c,portalSubtree:g}=xn({container:s,ref:n,componentProps:e,elementProps:l}),f=d.useRef(null),b=d.useRef(null),v=d.useRef(null),S=d.useRef(null),[y,P]=d.useState(null),j=y?.modal,k=y?.open,_=typeof o=="boolean"?o:!!y&&!y.modal&&y.open&&!!c;d.useEffect(()=>{if(!c||j)return;function R(N){c&&N.relatedTarget&&xe(N)&&(N.type==="focusin"?Ge:Tn)(c)}return c.addEventListener("focusin",R,!0),c.addEventListener("focusout",R,!0),()=>{c.removeEventListener("focusin",R,!0),c.removeEventListener("focusout",R,!0)}},[c,j]),d.useEffect(()=>{!c||k||Ge(c)},[k,c]);const F=d.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:b,beforeInsideRef:v,afterInsideRef:S,portalNode:c,setFocusManagerState:P}),[c]);return D.jsxs(d.Fragment,{children:[g,D.jsxs(ht.Provider,{value:F,children:[_&&c&&D.jsx($e,{"data-type":"outside",ref:f,onFocus:R=>{if(xe(R,c))v.current?.focus();else{const N=y?y.domReference:null;Sn(N)?.focus()}}}),_&&c&&D.jsx("span",{"aria-owns":c.id,style:tn}),c&&Ae.createPortal(r,c),_&&c&&D.jsx($e,{"data-type":"outside",ref:b,onFocus:R=>{if(xe(R,c))S.current?.focus();else{const N=y?y.domReference:null;yn(N)?.focus(),y?.closeOnFocusOut&&y?.onOpenChange(!1,Y(At,R.nativeEvent))}}})]})]})});function On(t){return t==null?t:"current"in t?t.current:t}const wn={intentional:"onClick",sloppy:"onPointerDown"};function Pn(t){return{escapeKey:typeof t=="boolean"?t:t?.escapeKey??!1,outsidePress:typeof t=="boolean"?t:t?.outsidePress??!0}}function jr(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),s=n.useState("floatingElement"),i=n.useState("referenceElement"),a=n.useState("domReferenceElement"),{onOpenChange:o,dataRef:l}=n.context,{enabled:c=!0,escapeKey:g=!0,outsidePress:f=!0,outsidePressEvent:b="sloppy",referencePress:v=!1,referencePressEvent:S="sloppy",ancestorScroll:y=!1,bubbles:P,externalTree:j}=e,k=pt(j),_=E(typeof f=="function"?f:()=>!1),F=typeof f=="function"?_:f,R=d.useRef(!1),{escapeKey:N,outsidePress:Z}=Pn(P),I=d.useRef(null),ne=Ue(),_e=Ue(),K=E(()=>{_e.clear(),l.current.insideReactTree=!1}),be=d.useRef(!1),Ve=d.useRef(""),ve=E(u=>{Ve.current=u.pointerType}),z=E(()=>{const u=Ve.current,h=u==="pen"||!u?"mouse":u,p=typeof b=="function"?b():b;return typeof p=="string"?p:p[h]}),V=E(u=>{if(!r||!c||!g||u.key!=="Escape"||be.current)return;const h=l.current.floatingContext?.nodeId,p=k?le(k.nodesRef.current,h):[];if(!N&&p.length>0){let x=!0;if(p.forEach(C=>{C.context?.open&&!C.context.dataRef.current.__escapeKeyBubbles&&(x=!1)}),!x)return}const M=Xt(u)?u.nativeEvent:u,m=Y(Lt,M);n.setOpen(!1,m),!N&&!m.isPropagationAllowed&&u.stopPropagation()}),St=E(u=>{const h=z();return h==="intentional"&&u.type!=="click"||h==="sloppy"&&u.type==="click"}),H=E(()=>{l.current.insideReactTree=!0,_e.start(0,K)}),J=E((u,h=!1)=>{if(St(u)){K();return}if(l.current.insideReactTree){K();return}if(z()==="intentional"&&h||typeof F=="function"&&!F(u))return;const p=U(u),M=`[${gt("inert")}]`,m=G(n.select("floatingElement")).querySelectorAll(M),x=n.context.triggerElements;if(p&&(x.hasElement(p)||x.hasMatchingElement(O=>ee(O,p))))return;let C=B(p)?p:null;for(;C&&!Ce(C);){const O=Dt(C);if(Ce(O)||!B(O))break;C=O}if(m.length&&B(p)&&!Zt(p)&&!ee(p,n.select("floatingElement"))&&Array.from(m).every(O=>!ee(C,O)))return;if(jt(p)&&!("touches"in u)){const O=Ce(p),W=_t(p),ze=/auto|scroll/,xt=O||ze.test(W.overflowX),Ot=O||ze.test(W.overflowY),wt=xt&&p.clientWidth>0&&p.scrollWidth>p.clientWidth,Pt=Ot&&p.clientHeight>0&&p.scrollHeight>p.clientHeight,kt=W.direction==="rtl",Nt=Pt&&(kt?u.offsetX<=p.offsetWidth-p.clientWidth:u.offsetX>p.clientWidth),Mt=wt&&u.offsetY>p.clientHeight;if(Nt||Mt)return}const Be=l.current.floatingContext?.nodeId,It=k&&le(k.nodesRef.current,Be).some(O=>A(u,O.context?.elements.floating));if(A(u,n.select("floatingElement"))||A(u,n.select("domReferenceElement"))||It)return;const Ke=k?le(k.nodesRef.current,Be):[];if(Ke.length>0){let O=!0;if(Ke.forEach(W=>{W.context?.open&&!W.context.dataRef.current.__outsidePressBubbles&&(O=!1)}),!O)return}n.setOpen(!1,Y(Vt,u)),K()}),He=E(u=>{z()!=="sloppy"||u.pointerType==="touch"||!n.select("open")||!c||A(u,n.select("floatingElement"))||A(u,n.select("domReferenceElement"))||J(u)}),Tt=E(u=>{if(z()!=="sloppy"||!n.select("open")||!c||A(u,n.select("floatingElement"))||A(u,n.select("domReferenceElement")))return;const h=u.touches[0];h&&(I.current={startTime:Date.now(),startX:h.clientX,startY:h.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},ne.start(1e3,()=>{I.current&&(I.current.dismissOnTouchEnd=!1,I.current.dismissOnMouseDown=!1)}))}),Ee=E(u=>{const h=U(u);function p(){Tt(u),h?.removeEventListener(u.type,p)}h?.addEventListener(u.type,p)}),q=E(u=>{const h=R.current;if(R.current=!1,ne.clear(),u.type==="mousedown"&&I.current&&!I.current.dismissOnMouseDown)return;const p=U(u);function M(){u.type==="pointerdown"?He(u):J(u,h),p?.removeEventListener(u.type,M)}p?.addEventListener(u.type,M)}),Rt=E(u=>{if(z()!=="sloppy"||!I.current||A(u,n.select("floatingElement"))||A(u,n.select("domReferenceElement")))return;const h=u.touches[0];if(!h)return;const p=Math.abs(h.clientX-I.current.startX),M=Math.abs(h.clientY-I.current.startY),m=Math.sqrt(p*p+M*M);m>5&&(I.current.dismissOnTouchEnd=!0),m>10&&(J(u),ne.clear(),I.current=null)}),ye=E(u=>{const h=U(u);function p(){Rt(u),h?.removeEventListener(u.type,p)}h?.addEventListener(u.type,p)}),Ct=E(u=>{z()!=="sloppy"||!I.current||A(u,n.select("floatingElement"))||A(u,n.select("domReferenceElement"))||(I.current.dismissOnTouchEnd&&J(u),ne.clear(),I.current=null)}),Se=E(u=>{const h=U(u);function p(){Ct(u),h?.removeEventListener(u.type,p)}h?.addEventListener(u.type,p)});d.useEffect(()=>{if(!r||!c)return;l.current.__escapeKeyBubbles=N,l.current.__outsidePressBubbles=Z;const u=new me;function h(C){n.setOpen(!1,Y(qt,C))}function p(){u.clear(),be.current=!0}function M(){u.start(Ht()?5:0,()=>{be.current=!1})}const m=G(s);m.addEventListener("pointerdown",ve,!0),g&&(m.addEventListener("keydown",V),m.addEventListener("compositionstart",p),m.addEventListener("compositionend",M)),F&&(m.addEventListener("click",q,!0),m.addEventListener("pointerdown",q,!0),m.addEventListener("touchstart",Ee,!0),m.addEventListener("touchmove",ye,!0),m.addEventListener("touchend",Se,!0),m.addEventListener("mousedown",q,!0));let x=[];return y&&(B(a)&&(x=Ie(a)),B(s)&&(x=x.concat(Ie(s))),!B(i)&&i&&i.contextElement&&(x=x.concat(Ie(i.contextElement)))),x=x.filter(C=>C!==m.defaultView?.visualViewport),x.forEach(C=>{C.addEventListener("scroll",h,{passive:!0})}),()=>{m.removeEventListener("pointerdown",ve,!0),g&&(m.removeEventListener("keydown",V),m.removeEventListener("compositionstart",p),m.removeEventListener("compositionend",M)),F&&(m.removeEventListener("click",q,!0),m.removeEventListener("pointerdown",q,!0),m.removeEventListener("touchstart",Ee,!0),m.removeEventListener("touchmove",ye,!0),m.removeEventListener("touchend",Se,!0),m.removeEventListener("mousedown",q,!0)),x.forEach(C=>{C.removeEventListener("scroll",h)}),u.clear(),R.current=!1}},[l,s,i,a,g,F,r,o,y,c,N,Z,V,J,q,He,Ee,ye,Se,ve,n]),d.useEffect(K,[F,K]);const Te=d.useMemo(()=>({onKeyDown:V,...v&&{[wn[S]]:u=>{n.setOpen(!1,Y(We,u.nativeEvent))},...S!=="intentional"&&{onClick(u){n.setOpen(!1,Y(We,u.nativeEvent))}}}}),[V,n,v,S]),re=E(u=>{const h=U(u.nativeEvent);!ee(n.select("floatingElement"),h)||u.button!==0||(R.current=!0)}),Re=E(u=>{!r||!c||u.button!==0||(R.current=!0)}),qe=d.useMemo(()=>({onKeyDown:V,onPointerDown:re,onMouseDown:re,onMouseUp:re,onClickCapture:H,onMouseDownCapture(u){H(),Re(u)},onPointerDownCapture(u){H(),Re(u)},onMouseUpCapture:H,onTouchEndCapture:H,onTouchMoveCapture:H}),[V,re,H,Re]);return d.useMemo(()=>c?{reference:Te,floating:qe,trigger:Te}:{},[c,Te,qe])}var he=Symbol("NOT_FOUND");function kn(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function Nn(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function Mn(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var Xe=t=>Array.isArray(t)?t:[t];function An(t){const e=Array.isArray(t[0])?t[0]:t;return Mn(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function Fn(t,e){const n=[],{length:r}=t;for(let s=0;s<r;s++)n.push(t[s].apply(null,e));return n}function Ln(t){let e;return{get(n){return e&&t(e.key,n)?e.value:he},put(n,r){e={key:n,value:r}},getEntries(){return e?[e]:[]},clear(){e=void 0}}}function Dn(t,e){let n=[];function r(o){const l=n.findIndex(c=>e(o,c.key));if(l>-1){const c=n[l];return l>0&&(n.splice(l,1),n.unshift(c)),c.value}return he}function s(o,l){r(o)===he&&(n.unshift({key:o,value:l}),n.length>t&&n.pop())}function i(){return n}function a(){n=[]}return{get:r,put:s,getEntries:i,clear:a}}var jn=(t,e)=>t===e;function _n(t){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:s}=n;for(let i=0;i<s;i++)if(!t(n[i],r[i]))return!1;return!0}}function Vn(t,e){const n=typeof e=="object"?e:{equalityCheck:e},{equalityCheck:r=jn,maxSize:s=1,resultEqualityCheck:i}=n,a=_n(r);let o=0;const l=s<=1?Ln(a):Dn(s,a);function c(){let g=l.get(arguments);if(g===he){if(g=t.apply(null,arguments),o++,i){const b=l.getEntries().find(v=>i(v.value,g));b&&(g=b.value,o!==0&&o--)}l.put(arguments,g)}return g}return c.clearCache=()=>{l.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var Hn=class{constructor(t){this.value=t}deref(){return this.value}},qn=typeof WeakRef<"u"?WeakRef:Hn,Bn=0,Ze=1;function oe(){return{s:Bn,v:void 0,o:null,p:null}}function mt(t,e={}){let n=oe();const{resultEqualityCheck:r}=e;let s,i=0;function a(){let o=n;const{length:l}=arguments;for(let f=0,b=l;f<b;f++){const v=arguments[f];if(typeof v=="function"||typeof v=="object"&&v!==null){let S=o.o;S===null&&(o.o=S=new WeakMap);const y=S.get(v);y===void 0?(o=oe(),S.set(v,o)):o=y}else{let S=o.p;S===null&&(o.p=S=new Map);const y=S.get(v);y===void 0?(o=oe(),S.set(v,o)):o=y}}const c=o;let g;if(o.s===Ze)g=o.v;else if(g=t.apply(null,arguments),i++,r){const f=s?.deref?.()??s;f!=null&&r(f,g)&&(g=f,i!==0&&i--),s=typeof g=="object"&&g!==null||typeof g=="function"?new qn(g):g}return c.s=Ze,c.v=g,g}return a.clearCache=()=>{n=oe(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function bt(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...s)=>{let i=0,a=0,o,l={},c=s.pop();typeof c=="object"&&(l=c,c=s.pop()),kn(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const g={...n,...l},{memoize:f,memoizeOptions:b=[],argsMemoize:v=mt,argsMemoizeOptions:S=[]}=g,y=Xe(b),P=Xe(S),j=An(s),k=f(function(){return i++,c.apply(null,arguments)},...y),_=v(function(){a++;const R=Fn(j,arguments);return o=k.apply(null,R),o},...P);return Object.assign(_,{resultFunc:c,memoizedResultFunc:k,dependencies:j,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>o,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:f,argsMemoize:v})};return Object.assign(r,{withTypes:()=>r}),r}var Kn=bt(mt),zn=Object.assign((t,e=Kn)=>{Nn(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),r=n.map(i=>t[i]);return e(r,(...i)=>i.reduce((a,o,l)=>(a[n[l]]=o,a),{}))},{withTypes:()=>zn});bt({memoize:Vn,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const T=(t,e,n,r,s,i,...a)=>{if(a.length>0)throw new Error(Kt(1));let o;if(t)o=t;else throw new Error("Missing arguments");return o};var vt=Ut();const Pe=[];let ke;function Wn(){return ke}function Un(t){Pe.push(t)}function Yn(t){const e=(n,r)=>{const s=X(Gn).current;let i;try{ke=s;for(const a of Pe)a.before(s);i=t(n,r);for(const a of Pe)a.after(s);s.didInitialize=!0}finally{ke=void 0}return i};return e.displayName=t.displayName||t.name,e}function _r(t){return d.forwardRef(Yn(t))}function Gn(){return{didInitialize:!1}}const $n=zt(19),Xn=$n?Jn:Qn;function Et(t,e,n,r,s){return Xn(t,e,n,r,s)}function Zn(t,e,n,r,s){const i=d.useCallback(()=>e(t.getSnapshot(),n,r,s),[t,e,n,r,s]);return vt.useSyncExternalStore(t.subscribe,i,i)}Un({before(t){t.syncIndex=0,t.didInitialize||(t.syncTick=1,t.syncHooks=[],t.didChangeStore=!0,t.getSnapshot=()=>{let e=!1;for(let n=0;n<t.syncHooks.length;n+=1){const r=t.syncHooks[n],s=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,s))&&(e=!0,r.value=s,r.didChange=!1)}return e&&(t.syncTick+=1),t.syncTick})},after(t){t.syncHooks.length>0&&(t.didChangeStore&&(t.didChangeStore=!1,t.subscribe=e=>{const n=new Set;for(const s of t.syncHooks)n.add(s.store);const r=[];for(const s of n)r.push(s.subscribe(e));return()=>{for(const s of r)s()}}),vt.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot))}});function Jn(t,e,n,r,s){const i=Wn();if(!i)return Zn(t,e,n,r,s);const a=i.syncIndex;i.syncIndex+=1;let o;return i.didInitialize?(o=i.syncHooks[a],(o.store!==t||o.selector!==e||!Object.is(o.a1,n)||!Object.is(o.a2,r)||!Object.is(o.a3,s))&&(o.store!==t&&(i.didChangeStore=!0),o.store=t,o.selector=e,o.a1=n,o.a2=r,o.a3=s,o.didChange=!0)):(o={store:t,selector:e,a1:n,a2:r,a3:s,value:e(t.getSnapshot(),n,r,s),didChange:!1},i.syncHooks.push(o)),o.value}function Qn(t,e,n,r,s){return Yt.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getSnapshot,i=>e(i,n,r,s))}class er{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(e)}}update(e){for(const n in e)if(!Object.is(this.state[n],e[n])){this.setState({...this.state,...e});return}}set(e,n){Object.is(this.state[e],n)||this.setState({...this.state,[e]:n})}notifyAll(){const e={...this.state};this.setState(e)}use(e,n,r,s){return Et(this,e,n,r,s)}}class tr extends er{constructor(e,n={},r){super(e),this.context=n,this.selectors=r}useSyncedValue(e,n){d.useDebugValue(e),w(()=>{this.state[e]!==n&&this.set(e,n)},[e,n])}useSyncedValueWithCleanup(e,n){const r=this;w(()=>(r.state[e]!==n&&r.set(e,n),()=>{r.set(e,void 0)}),[r,e,n])}useSyncedValues(e){const n=this,r=Object.values(e);w(()=>{n.update(e)},[n,...r])}useControlledProp(e,n){d.useDebugValue(e);const r=n!==void 0;w(()=>{r&&!Object.is(this.state[e],n)&&super.setState({...this.state,[e]:n})},[e,n,r])}select(e,n,r,s){const i=this.selectors[e];return i(this.state,n,r,s)}useState(e,n,r,s){return d.useDebugValue(e),Et(this,this.selectors[e],n,r,s)}useContextCallback(e,n){d.useDebugValue(e);const r=E(n??Wt);this.context[e]=r}useStateSetter(e){const n=d.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(e,r)}),n.current}observe(e,n){let r;typeof e=="function"?r=e:r=this.selectors[e];let s=r(this.state);return n(s,s,this),this.subscribe(i=>{const a=r(i);if(!Object.is(s,a)){const o=s;s=a,n(a,o,this)}})}}const nr={open:T(t=>t.open),domReferenceElement:T(t=>t.domReferenceElement),referenceElement:T(t=>t.positionReference??t.referenceElement),floatingElement:T(t=>t.floatingElement),floatingId:T(t=>t.floatingId)};class yt extends tr{constructor(e){const{nested:n,noEmit:r,onOpenChange:s,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:lt(),nested:n,noEmit:r,triggerElements:i},nr)}setOpen=(e,n)=>{if((!e||!this.state.open||Jt(n.event))&&(this.context.dataRef.current.openEvent=e?n.event:void 0),!this.context.noEmit){const r={open:e,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(e,n)}}function rr(t,e=!1,n=!1){const[r,s]=d.useState(t&&e?"idle":void 0),[i,a]=d.useState(t);return t&&!i&&(a(!0),s("starting")),!t&&i&&r!=="ending"&&!n&&s("ending"),!t&&!i&&r==="ending"&&s(void 0),w(()=>{if(!t&&i&&r!=="ending"&&n){const o=L.request(()=>{s("ending")});return()=>{L.cancel(o)}}},[t,i,r,n]),w(()=>{if(!t||e)return;const o=L.request(()=>{s(void 0)});return()=>{L.cancel(o)}},[e,t]),w(()=>{if(!t||!e)return;t&&i&&r!=="idle"&&s("starting");const o=L.request(()=>{s("idle")});return()=>{L.cancel(o)}},[e,t,i,s,r]),d.useMemo(()=>({mounted:i,setMounted:a,transitionStatus:r}),[i,r])}let te=(function(t){return t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t})({});const sr={[te.startingStyle]:""},ir={[te.endingStyle]:""},Vr={transitionStatus(t){return t==="starting"?sr:t==="ending"?ir:null}};function or(t,e=!1,n=!0){const r=rn();return E((s,i=null)=>{r.cancel();function a(){Ae.flushSync(s)}const o=On(t);if(o==null)return;const l=o;if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)s();else{let c=function(){const f=te.startingStyle;if(!l.hasAttribute(f)){r.request(g);return}const b=new MutationObserver(()=>{l.hasAttribute(f)||(b.disconnect(),g())});b.observe(l,{attributes:!0,attributeFilter:[f]}),i?.addEventListener("abort",()=>b.disconnect(),{once:!0})},g=function(){Promise.all(l.getAnimations().map(f=>f.finished)).then(()=>{i?.aborted||a()}).catch(()=>{const f=l.getAnimations();if(n){if(i?.aborted)return;a()}else f.length>0&&f.some(b=>b.pending||b.playState!=="finished")&&g()})};if(e){c();return}r.request(g)}})}function ar(t){const{enabled:e=!0,open:n,ref:r,onComplete:s}=t,i=E(s),a=or(r,n,!1);d.useEffect(()=>{if(!e)return;const o=new AbortController;return a(i,o.signal),()=>{o.abort()}},[e,n,i,a])}function cr(t,e){const n=d.useRef(null),r=d.useRef(null);return d.useCallback(s=>{if(t!==void 0){if(n.current!==null){const i=n.current,a=r.current,o=e.context.triggerElements.getById(i);a&&o===a&&e.context.triggerElements.delete(i),n.current=null,r.current=null}s!==null&&(n.current=t,r.current=s,e.context.triggerElements.add(t,s))}},[e,t])}function Hr(t,e,n,r){const s=n.useState("isMountedByTrigger",t),i=cr(t,n),a=E(o=>{if(i(o),!o||!n.select("open"))return;const l=n.select("activeTriggerId");if(l===t){n.update({activeTriggerElement:o,...r});return}l==null&&n.update({activeTriggerId:t,activeTriggerElement:o,...r})});return w(()=>{s&&n.update({activeTriggerElement:e.current,...r})},[s,n,e,...Object.values(r)]),{registerTrigger:a,isMountedByThisTrigger:s}}function qr(t){const e=t.useState("open");w(()=>{if(e&&!t.select("activeTriggerId")&&t.context.triggerElements.size===1){const n=t.context.triggerElements.entries().next();if(!n.done){const[r,s]=n.value;t.update({activeTriggerId:r,activeTriggerElement:s})}}},[e,t])}function Br(t,e,n){const{mounted:r,setMounted:s,transitionStatus:i}=rr(t);e.useSyncedValues({mounted:r,transitionStatus:i});const a=E(()=>{s(!1),e.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),e.context.onOpenChangeComplete?.(!1)}),o=e.useState("preventUnmountingOnClose");return ar({enabled:!o,open:t,ref:e.context.popupRef,onComplete(){t||a()}}),{forceUnmount:a,transitionStatus:i}}class ur{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,n){const r=this.idMap.get(e);r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(e,n))}delete(e){const n=this.idMap.get(e);n&&(this.elementsSet.delete(n),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(const n of this.elementsSet)if(e(n))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function lr(){return new yt({open:!1,floatingElement:null,referenceElement:null,triggerElements:new ur,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Kr(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:lr(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:ue,inactiveTriggerProps:ue,popupProps:ue}}const ae=T(t=>t.triggerIdProp??t.activeTriggerId),zr={open:T(t=>t.openProp??t.open),mounted:T(t=>t.mounted),transitionStatus:T(t=>t.transitionStatus),floatingRootContext:T(t=>t.floatingRootContext),preventUnmountingOnClose:T(t=>t.preventUnmountingOnClose),payload:T(t=>t.payload),activeTriggerId:ae,activeTriggerElement:T(t=>t.mounted?t.activeTriggerElement:null),isTriggerActive:T((t,e)=>e!==void 0&&ae(t)===e),isOpenedByTrigger:T((t,e)=>e!==void 0&&ae(t)===e&&t.open),isMountedByTrigger:T((t,e)=>e!==void 0&&ae(t)===e&&t.mounted),triggerProps:T((t,e)=>e?t.activeTriggerProps:t.inactiveTriggerProps),popupProps:T(t=>t.popupProps),popupElement:T(t=>t.popupElement),positionerElement:T(t=>t.positionerElement)};function Wr(t){const{popupStore:e,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:s}=t,i=Me(),a=De()!=null,o=e.useState("open"),l=e.useState("activeTriggerElement"),c=e.useState(r?"popupElement":"positionerElement"),g=e.context.triggerElements,f=X(()=>new yt({open:o,referenceElement:l,floatingElement:c,triggerElements:g,onOpenChange:s,floatingId:i,nested:a,noEmit:n})).current;return w(()=>{const b={open:o,floatingId:i,referenceElement:l,floatingElement:c};B(l)&&(b.domReferenceElement=l),f.state.positionReference===f.state.referenceElement&&(b.positionReference=l),f.update(b)},[o,i,l,c,f]),f.context.onOpenChange=s,f.context.nested=a,f.context.noEmit=n,f}function Ur(t=[]){const e=t.map(c=>c?.reference),n=t.map(c=>c?.floating),r=t.map(c=>c?.item),s=t.map(c=>c?.trigger),i=d.useCallback(c=>ce(c,t,"reference"),e),a=d.useCallback(c=>ce(c,t,"floating"),n),o=d.useCallback(c=>ce(c,t,"item"),r),l=d.useCallback(c=>ce(c,t,"trigger"),s);return d.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o,getTriggerProps:l}),[i,a,o,l])}function ce(t,e,n){const r=new Map,s=n==="item",i={};n==="floating"&&(i.tabIndex=-1,i[Qt]="");for(const a in t)s&&t&&(a===et||a===tt)||(i[a]=t[a]);for(let a=0;a<e.length;a+=1){let o;const l=e[a]?.[n];typeof l=="function"?o=t?l(t):null:o=l,o&&Je(i,o,s,r)}return Je(i,t,s,r),i}function Je(t,e,n,r){for(const s in e){const i=e[s];n&&(s===et||s===tt)||(s.startsWith("on")?(r.has(s)||r.set(s,[]),typeof i=="function"&&(r.get(s)?.push(i),t[s]=(...a)=>r.get(s)?.map(o=>o(...a)).find(o=>o!==void 0))):t[s]=i)}}let je=(function(t){return t.open="data-open",t.closed="data-closed",t[t.startingStyle=te.startingStyle]="startingStyle",t[t.endingStyle=te.endingStyle]="endingStyle",t.anchorHidden="data-anchor-hidden",t.side="data-side",t.align="data-align",t})({}),Ne=(function(t){return t.popupOpen="data-popup-open",t.pressed="data-pressed",t})({});const fr={[Ne.popupOpen]:""},dr={[Ne.popupOpen]:"",[Ne.pressed]:""},pr={[je.open]:""},gr={[je.closed]:""},hr={[je.anchorHidden]:""},Yr={open(t){return t?fr:null}},Gr={open(t){return t?dr:null}},$r={open(t){return t?pr:gr},anchorHidden(t){return t?hr:null}};function Xr(t){const e=d.useRef(!0);e.current&&(e.current=!1,t())}export{Ne as $,xe as A,Nr as B,yn as C,Ir as D,Gr as E,Dr as F,$e as G,Tr as H,me as I,L as J,Cn as K,Fe as L,Le as M,gt as N,wr as O,xr as P,On as Q,tr as R,le as S,Sr as T,Sn as U,Cr as V,kr as W,Pr as X,je as Y,yt as Z,Rr as _,Ue as a,Yr as a0,xn as a1,rr as a2,or as a3,te as a4,Or as b,De as c,pt as d,ar as e,Fr as f,ur as g,zr as h,Rn as i,Kr as j,T as k,Yn as l,Xr as m,Ar as n,qr as o,$r as p,Br as q,Wr as r,jr as s,Vr as t,rn as u,Ur as v,Lr as w,_r as x,Hr as y,Mr as z};
1
+ import{u as w,p as Me,g as Y,j as At,a as E,O as Ft,r as Lt,d as B,w as Ce,x as Dt,i as jt,h as _t,o as Vt,E as Ie,t as We,H as Ht,n as qt}from"./useBaseUiId-ClbEYEil.js";import{u as X,a9 as ue,ae as Bt,aa as Kt,ag as zt,ad as Wt}from"./button-D0n2Qsd_.js";import{r as d,j as D,w as Ae,x as Ut,y as Yt}from"./main-xPlWrMhO.js";import{u as Qe,e as ee,o as G,d as Gt,v as $t,w as Xt,k as U,x as Zt,y as A,f as Jt,F as Qt,z as et,S as tt}from"./event-CHpdjYFR.js";import{a as en}from"./visuallyHidden-COI6QeQH.js";const Sr=500,Tr=500,Rr={style:{transition:"none"}},Cr="data-base-ui-click-trigger",Ir={fallbackAxisSide:"none"},xr={fallbackAxisSide:"end"},tn={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Q=0;class me{static create(){return new me}currentId=Q;start(e,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Q,n()},e)}isStarted(){return this.currentId!==Q}clear=()=>{this.currentId!==Q&&(clearTimeout(this.currentId),this.currentId=Q)};disposeEffect=()=>this.clear}function Ue(){const t=X(me.create).current;return Qe(t.disposeEffect),t}const se=null;class nn{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let s=0;s<n.length;s+=1)n[s]?.(e)};request(e){const n=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,!this.isScheduled&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(e){const n=e-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const ie=new nn;class L{static create(){return new L}static request(e){return ie.request(e)}static cancel(e){return ie.cancel(e)}currentId=se;request(e){this.cancel(),this.currentId=ie.request(()=>{this.currentId=se,e()})}cancel=()=>{this.currentId!==se&&(ie.cancel(this.currentId),this.currentId=se)};disposeEffect=()=>this.cancel}function rn(){const t=X(L.create).current;return Qe(t.disposeEffect),t}function Or(t){const e=X(sn,t).current;return e.next=t,w(e.effect),e}function sn(t){const e={current:t,next:t,effect:()=>{e.current=e.next}};return e}function le(t,e,n=!0){return t.filter(s=>s.parentId===e&&(!n||s.context?.open)).flatMap(s=>[s,...le(t,s.id,n)])}function wr(t,e){let n=[],r=t.find(s=>s.id===e)?.parentId;for(;r;){const s=t.find(i=>i.id===r);r=s?.parentId,s&&(n=n.concat(s))}return n}var on=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],fe=on.join(","),nt=typeof Element>"u",$=nt?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,de=!nt&&Element.prototype.getRootNode?function(t){var e;return t==null||(e=t.getRootNode)===null||e===void 0?void 0:e.call(t)}:function(t){return t?.ownerDocument},pe=function(e,n){var r;n===void 0&&(n=!0);var s=e==null||(r=e.getAttribute)===null||r===void 0?void 0:r.call(e,"inert"),i=s===""||s==="true",a=i||n&&e&&(typeof e.closest=="function"?e.closest("[inert]"):pe(e.parentNode));return a},an=function(e){var n,r=e==null||(n=e.getAttribute)===null||n===void 0?void 0:n.call(e,"contenteditable");return r===""||r==="true"},rt=function(e,n,r){if(pe(e))return[];var s=Array.prototype.slice.apply(e.querySelectorAll(fe));return n&&$.call(e,fe)&&s.unshift(e),s=s.filter(r),s},ge=function(e,n,r){for(var s=[],i=Array.from(e);i.length;){var a=i.shift();if(!pe(a,!1))if(a.tagName==="SLOT"){var o=a.assignedElements(),l=o.length?o:a.children,c=ge(l,!0,r);r.flatten?s.push.apply(s,c):s.push({scopeParent:a,candidates:c})}else{var g=$.call(a,fe);g&&r.filter(a)&&(n||!e.includes(a))&&s.push(a);var f=a.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(a),b=!pe(f,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(a));if(f&&b){var v=ge(f===!0?a.children:f.children,!0,r);r.flatten?s.push.apply(s,v):s.push({scopeParent:a,candidates:v})}else i.unshift.apply(i,a.children)}}return s},st=function(e){return!isNaN(parseInt(e.getAttribute("tabindex"),10))},it=function(e){if(!e)throw new Error("No node provided");return e.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(e.tagName)||an(e))&&!st(e)?0:e.tabIndex},cn=function(e,n){var r=it(e);return r<0&&n&&!st(e)?0:r},un=function(e,n){return e.tabIndex===n.tabIndex?e.documentOrder-n.documentOrder:e.tabIndex-n.tabIndex},ot=function(e){return e.tagName==="INPUT"},ln=function(e){return ot(e)&&e.type==="hidden"},fn=function(e){var n=e.tagName==="DETAILS"&&Array.prototype.slice.apply(e.children).some(function(r){return r.tagName==="SUMMARY"});return n},dn=function(e,n){for(var r=0;r<e.length;r++)if(e[r].checked&&e[r].form===n)return e[r]},pn=function(e){if(!e.name)return!0;var n=e.form||de(e),r=function(o){return n.querySelectorAll('input[type="radio"][name="'+o+'"]')},s;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")s=r(window.CSS.escape(e.name));else try{s=r(e.name)}catch(a){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",a.message),!1}var i=dn(s,e.form);return!i||i===e},gn=function(e){return ot(e)&&e.type==="radio"},hn=function(e){return gn(e)&&!pn(e)},mn=function(e){var n,r=e&&de(e),s=(n=r)===null||n===void 0?void 0:n.host,i=!1;if(r&&r!==e){var a,o,l;for(i=!!((a=s)!==null&&a!==void 0&&(o=a.ownerDocument)!==null&&o!==void 0&&o.contains(s)||e!=null&&(l=e.ownerDocument)!==null&&l!==void 0&&l.contains(e));!i&&s;){var c,g,f;r=de(s),s=(c=r)===null||c===void 0?void 0:c.host,i=!!((g=s)!==null&&g!==void 0&&(f=g.ownerDocument)!==null&&f!==void 0&&f.contains(s))}}return i},Ye=function(e){var n=e.getBoundingClientRect(),r=n.width,s=n.height;return r===0&&s===0},bn=function(e,n){var r=n.displayCheck,s=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in e){var i=e.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!i}if(getComputedStyle(e).visibility==="hidden")return!0;var a=$.call(e,"details>summary:first-of-type"),o=a?e.parentElement:e;if($.call(o,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof s=="function"){for(var l=e;e;){var c=e.parentElement,g=de(e);if(c&&!c.shadowRoot&&s(c)===!0)return Ye(e);e.assignedSlot?e=e.assignedSlot:!c&&g!==e.ownerDocument?e=g.host:e=c}e=l}if(mn(e))return!e.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return Ye(e);return!1},vn=function(e){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(e.tagName))for(var n=e.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var s=n.children.item(r);if(s.tagName==="LEGEND")return $.call(n,"fieldset[disabled] *")?!0:!s.contains(e)}return!0}n=n.parentElement}return!1},Oe=function(e,n){return!(n.disabled||ln(n)||bn(n,e)||fn(n)||vn(n))},we=function(e,n){return!(hn(n)||it(n)<0||!Oe(e,n))},En=function(e){var n=parseInt(e.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},at=function(e){var n=[],r=[];return e.forEach(function(s,i){var a=!!s.scopeParent,o=a?s.scopeParent:s,l=cn(o,a),c=a?at(s.candidates):o;l===0?a?n.push.apply(n,c):n.push(o):r.push({documentOrder:i,tabIndex:l,item:s,isScope:a,content:c})}),r.sort(un).reduce(function(s,i){return i.isScope?s.push.apply(s,i.content):s.push(i.content),s},[]).concat(n)},Fe=function(e,n){n=n||{};var r;return n.getShadowRoot?r=ge([e],n.includeContainer,{filter:we.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:En}):r=rt(e,n.includeContainer,we.bind(null,n)),at(r)},Pr=function(e,n){n=n||{};var r;return n.getShadowRoot?r=ge([e],n.includeContainer,{filter:Oe.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=rt(e,n.includeContainer,Oe.bind(null,n)),r},kr=function(e,n){if(n=n||{},!e)throw new Error("No node provided");return $.call(e,fe)===!1?!1:we(n,e)};const Le=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function ct(t,e){const n=Fe(t,Le()),r=n.length;if(r===0)return;const s=Gt(G(t)),i=n.indexOf(s),a=i===-1?e===1?0:r-1:i+e;return n[a]}function yn(t){return ct(G(t).body,1)||t}function Sn(t){return ct(G(t).body,-1)||t}function ut(t,e){if(!t)return null;const n=Fe(G(t).body,Le()),r=n.length;if(r===0)return null;const s=n.indexOf(t);if(s===-1)return null;const i=(s+e+r)%r;return n[i]}function Nr(t){return ut(t,1)}function Mr(t){return ut(t,-1)}function xe(t,e){const n=e||t.currentTarget,r=t.relatedTarget;return!r||!ee(n,r)}function Tn(t){Fe(t,Le()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function Ge(t){t.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}function lt(){const t=new Map;return{emit(e,n){t.get(e)?.forEach(r=>r(n))},on(e,n){t.has(e)||t.set(e,new Set),t.get(e).add(n)},off(e,n){t.get(e)?.delete(n)}}}class Rn{nodesRef={current:[]};events=lt();addNode(e){this.nodesRef.current.push(e)}removeNode(e){const n=this.nodesRef.current.findIndex(r=>r===e);n!==-1&&this.nodesRef.current.splice(n,1)}}const ft=d.createContext(null),dt=d.createContext(null),De=()=>d.useContext(ft)?.id||null,pt=t=>{const e=d.useContext(dt);return t??e};function Ar(t){const e=Me(),n=pt(t),r=De();return w(()=>{if(!e)return;const s={id:e,parentId:r};return n?.addNode(s),()=>{n?.removeNode(s)}},[n,e,r]),e}function Fr(t){const{children:e,id:n}=t,r=De();return D.jsx(ft.Provider,{value:d.useMemo(()=>({id:n,parentId:r}),[n,r]),children:e})}function Lr(t){const{children:e,externalTree:n}=t,r=X(()=>n??new Rn).current;return D.jsx(dt.Provider,{value:r,children:e})}function gt(t){return`data-base-ui-${t}`}const $e=d.forwardRef(function(e,n){const[r,s]=d.useState();w(()=>{$t&&s("button")},[]);const i={tabIndex:0,role:r};return D.jsx("span",{...e,ref:n,style:en,"aria-hidden":r?void 0:!0,...i,"data-base-ui-focus-guard":""})}),ht=d.createContext(null),Cn=()=>d.useContext(ht),In=gt("portal");function xn(t={}){const{ref:e,container:n,componentProps:r=ue,elementProps:s}=t,i=Me(),o=Cn()?.portalNode,[l,c]=d.useState(null),[g,f]=d.useState(null),b=E(P=>{P!==null&&f(P)}),v=d.useRef(null);w(()=>{if(n===null){v.current&&(v.current=null,f(null),c(null));return}if(i==null)return;const P=(n&&(Ft(n)?n:n.current))??o??document.body;if(P==null){v.current&&(v.current=null,f(null),c(null));return}v.current!==P&&(v.current=P,f(null),c(P))},[n,o,i]);const S=Bt("div",r,{ref:[e,b],props:[{id:i,[In]:""},s]});return{portalNode:g,portalSubtree:l&&S?Ae.createPortal(S,l):null}}const Dr=d.forwardRef(function(e,n){const{children:r,container:s,className:i,render:a,renderGuards:o,...l}=e,{portalNode:c,portalSubtree:g}=xn({container:s,ref:n,componentProps:e,elementProps:l}),f=d.useRef(null),b=d.useRef(null),v=d.useRef(null),S=d.useRef(null),[y,P]=d.useState(null),j=y?.modal,k=y?.open,_=typeof o=="boolean"?o:!!y&&!y.modal&&y.open&&!!c;d.useEffect(()=>{if(!c||j)return;function R(N){c&&N.relatedTarget&&xe(N)&&(N.type==="focusin"?Ge:Tn)(c)}return c.addEventListener("focusin",R,!0),c.addEventListener("focusout",R,!0),()=>{c.removeEventListener("focusin",R,!0),c.removeEventListener("focusout",R,!0)}},[c,j]),d.useEffect(()=>{!c||k||Ge(c)},[k,c]);const F=d.useMemo(()=>({beforeOutsideRef:f,afterOutsideRef:b,beforeInsideRef:v,afterInsideRef:S,portalNode:c,setFocusManagerState:P}),[c]);return D.jsxs(d.Fragment,{children:[g,D.jsxs(ht.Provider,{value:F,children:[_&&c&&D.jsx($e,{"data-type":"outside",ref:f,onFocus:R=>{if(xe(R,c))v.current?.focus();else{const N=y?y.domReference:null;Sn(N)?.focus()}}}),_&&c&&D.jsx("span",{"aria-owns":c.id,style:tn}),c&&Ae.createPortal(r,c),_&&c&&D.jsx($e,{"data-type":"outside",ref:b,onFocus:R=>{if(xe(R,c))S.current?.focus();else{const N=y?y.domReference:null;yn(N)?.focus(),y?.closeOnFocusOut&&y?.onOpenChange(!1,Y(At,R.nativeEvent))}}})]})]})});function On(t){return t==null?t:"current"in t?t.current:t}const wn={intentional:"onClick",sloppy:"onPointerDown"};function Pn(t){return{escapeKey:typeof t=="boolean"?t:t?.escapeKey??!1,outsidePress:typeof t=="boolean"?t:t?.outsidePress??!0}}function jr(t,e={}){const n="rootStore"in t?t.rootStore:t,r=n.useState("open"),s=n.useState("floatingElement"),i=n.useState("referenceElement"),a=n.useState("domReferenceElement"),{onOpenChange:o,dataRef:l}=n.context,{enabled:c=!0,escapeKey:g=!0,outsidePress:f=!0,outsidePressEvent:b="sloppy",referencePress:v=!1,referencePressEvent:S="sloppy",ancestorScroll:y=!1,bubbles:P,externalTree:j}=e,k=pt(j),_=E(typeof f=="function"?f:()=>!1),F=typeof f=="function"?_:f,R=d.useRef(!1),{escapeKey:N,outsidePress:Z}=Pn(P),I=d.useRef(null),ne=Ue(),_e=Ue(),K=E(()=>{_e.clear(),l.current.insideReactTree=!1}),be=d.useRef(!1),Ve=d.useRef(""),ve=E(u=>{Ve.current=u.pointerType}),z=E(()=>{const u=Ve.current,h=u==="pen"||!u?"mouse":u,p=typeof b=="function"?b():b;return typeof p=="string"?p:p[h]}),V=E(u=>{if(!r||!c||!g||u.key!=="Escape"||be.current)return;const h=l.current.floatingContext?.nodeId,p=k?le(k.nodesRef.current,h):[];if(!N&&p.length>0){let x=!0;if(p.forEach(C=>{C.context?.open&&!C.context.dataRef.current.__escapeKeyBubbles&&(x=!1)}),!x)return}const M=Xt(u)?u.nativeEvent:u,m=Y(Lt,M);n.setOpen(!1,m),!N&&!m.isPropagationAllowed&&u.stopPropagation()}),St=E(u=>{const h=z();return h==="intentional"&&u.type!=="click"||h==="sloppy"&&u.type==="click"}),H=E(()=>{l.current.insideReactTree=!0,_e.start(0,K)}),J=E((u,h=!1)=>{if(St(u)){K();return}if(l.current.insideReactTree){K();return}if(z()==="intentional"&&h||typeof F=="function"&&!F(u))return;const p=U(u),M=`[${gt("inert")}]`,m=G(n.select("floatingElement")).querySelectorAll(M),x=n.context.triggerElements;if(p&&(x.hasElement(p)||x.hasMatchingElement(O=>ee(O,p))))return;let C=B(p)?p:null;for(;C&&!Ce(C);){const O=Dt(C);if(Ce(O)||!B(O))break;C=O}if(m.length&&B(p)&&!Zt(p)&&!ee(p,n.select("floatingElement"))&&Array.from(m).every(O=>!ee(C,O)))return;if(jt(p)&&!("touches"in u)){const O=Ce(p),W=_t(p),ze=/auto|scroll/,xt=O||ze.test(W.overflowX),Ot=O||ze.test(W.overflowY),wt=xt&&p.clientWidth>0&&p.scrollWidth>p.clientWidth,Pt=Ot&&p.clientHeight>0&&p.scrollHeight>p.clientHeight,kt=W.direction==="rtl",Nt=Pt&&(kt?u.offsetX<=p.offsetWidth-p.clientWidth:u.offsetX>p.clientWidth),Mt=wt&&u.offsetY>p.clientHeight;if(Nt||Mt)return}const Be=l.current.floatingContext?.nodeId,It=k&&le(k.nodesRef.current,Be).some(O=>A(u,O.context?.elements.floating));if(A(u,n.select("floatingElement"))||A(u,n.select("domReferenceElement"))||It)return;const Ke=k?le(k.nodesRef.current,Be):[];if(Ke.length>0){let O=!0;if(Ke.forEach(W=>{W.context?.open&&!W.context.dataRef.current.__outsidePressBubbles&&(O=!1)}),!O)return}n.setOpen(!1,Y(Vt,u)),K()}),He=E(u=>{z()!=="sloppy"||u.pointerType==="touch"||!n.select("open")||!c||A(u,n.select("floatingElement"))||A(u,n.select("domReferenceElement"))||J(u)}),Tt=E(u=>{if(z()!=="sloppy"||!n.select("open")||!c||A(u,n.select("floatingElement"))||A(u,n.select("domReferenceElement")))return;const h=u.touches[0];h&&(I.current={startTime:Date.now(),startX:h.clientX,startY:h.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},ne.start(1e3,()=>{I.current&&(I.current.dismissOnTouchEnd=!1,I.current.dismissOnMouseDown=!1)}))}),Ee=E(u=>{const h=U(u);function p(){Tt(u),h?.removeEventListener(u.type,p)}h?.addEventListener(u.type,p)}),q=E(u=>{const h=R.current;if(R.current=!1,ne.clear(),u.type==="mousedown"&&I.current&&!I.current.dismissOnMouseDown)return;const p=U(u);function M(){u.type==="pointerdown"?He(u):J(u,h),p?.removeEventListener(u.type,M)}p?.addEventListener(u.type,M)}),Rt=E(u=>{if(z()!=="sloppy"||!I.current||A(u,n.select("floatingElement"))||A(u,n.select("domReferenceElement")))return;const h=u.touches[0];if(!h)return;const p=Math.abs(h.clientX-I.current.startX),M=Math.abs(h.clientY-I.current.startY),m=Math.sqrt(p*p+M*M);m>5&&(I.current.dismissOnTouchEnd=!0),m>10&&(J(u),ne.clear(),I.current=null)}),ye=E(u=>{const h=U(u);function p(){Rt(u),h?.removeEventListener(u.type,p)}h?.addEventListener(u.type,p)}),Ct=E(u=>{z()!=="sloppy"||!I.current||A(u,n.select("floatingElement"))||A(u,n.select("domReferenceElement"))||(I.current.dismissOnTouchEnd&&J(u),ne.clear(),I.current=null)}),Se=E(u=>{const h=U(u);function p(){Ct(u),h?.removeEventListener(u.type,p)}h?.addEventListener(u.type,p)});d.useEffect(()=>{if(!r||!c)return;l.current.__escapeKeyBubbles=N,l.current.__outsidePressBubbles=Z;const u=new me;function h(C){n.setOpen(!1,Y(qt,C))}function p(){u.clear(),be.current=!0}function M(){u.start(Ht()?5:0,()=>{be.current=!1})}const m=G(s);m.addEventListener("pointerdown",ve,!0),g&&(m.addEventListener("keydown",V),m.addEventListener("compositionstart",p),m.addEventListener("compositionend",M)),F&&(m.addEventListener("click",q,!0),m.addEventListener("pointerdown",q,!0),m.addEventListener("touchstart",Ee,!0),m.addEventListener("touchmove",ye,!0),m.addEventListener("touchend",Se,!0),m.addEventListener("mousedown",q,!0));let x=[];return y&&(B(a)&&(x=Ie(a)),B(s)&&(x=x.concat(Ie(s))),!B(i)&&i&&i.contextElement&&(x=x.concat(Ie(i.contextElement)))),x=x.filter(C=>C!==m.defaultView?.visualViewport),x.forEach(C=>{C.addEventListener("scroll",h,{passive:!0})}),()=>{m.removeEventListener("pointerdown",ve,!0),g&&(m.removeEventListener("keydown",V),m.removeEventListener("compositionstart",p),m.removeEventListener("compositionend",M)),F&&(m.removeEventListener("click",q,!0),m.removeEventListener("pointerdown",q,!0),m.removeEventListener("touchstart",Ee,!0),m.removeEventListener("touchmove",ye,!0),m.removeEventListener("touchend",Se,!0),m.removeEventListener("mousedown",q,!0)),x.forEach(C=>{C.removeEventListener("scroll",h)}),u.clear(),R.current=!1}},[l,s,i,a,g,F,r,o,y,c,N,Z,V,J,q,He,Ee,ye,Se,ve,n]),d.useEffect(K,[F,K]);const Te=d.useMemo(()=>({onKeyDown:V,...v&&{[wn[S]]:u=>{n.setOpen(!1,Y(We,u.nativeEvent))},...S!=="intentional"&&{onClick(u){n.setOpen(!1,Y(We,u.nativeEvent))}}}}),[V,n,v,S]),re=E(u=>{const h=U(u.nativeEvent);!ee(n.select("floatingElement"),h)||u.button!==0||(R.current=!0)}),Re=E(u=>{!r||!c||u.button!==0||(R.current=!0)}),qe=d.useMemo(()=>({onKeyDown:V,onPointerDown:re,onMouseDown:re,onMouseUp:re,onClickCapture:H,onMouseDownCapture(u){H(),Re(u)},onPointerDownCapture(u){H(),Re(u)},onMouseUpCapture:H,onTouchEndCapture:H,onTouchMoveCapture:H}),[V,re,H,Re]);return d.useMemo(()=>c?{reference:Te,floating:qe,trigger:Te}:{},[c,Te,qe])}var he=Symbol("NOT_FOUND");function kn(t,e=`expected a function, instead received ${typeof t}`){if(typeof t!="function")throw new TypeError(e)}function Nn(t,e=`expected an object, instead received ${typeof t}`){if(typeof t!="object")throw new TypeError(e)}function Mn(t,e="expected all items to be functions, instead received the following types: "){if(!t.every(n=>typeof n=="function")){const n=t.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${e}[${n}]`)}}var Xe=t=>Array.isArray(t)?t:[t];function An(t){const e=Array.isArray(t[0])?t[0]:t;return Mn(e,"createSelector expects all input-selectors to be functions, but received the following types: "),e}function Fn(t,e){const n=[],{length:r}=t;for(let s=0;s<r;s++)n.push(t[s].apply(null,e));return n}function Ln(t){let e;return{get(n){return e&&t(e.key,n)?e.value:he},put(n,r){e={key:n,value:r}},getEntries(){return e?[e]:[]},clear(){e=void 0}}}function Dn(t,e){let n=[];function r(o){const l=n.findIndex(c=>e(o,c.key));if(l>-1){const c=n[l];return l>0&&(n.splice(l,1),n.unshift(c)),c.value}return he}function s(o,l){r(o)===he&&(n.unshift({key:o,value:l}),n.length>t&&n.pop())}function i(){return n}function a(){n=[]}return{get:r,put:s,getEntries:i,clear:a}}var jn=(t,e)=>t===e;function _n(t){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:s}=n;for(let i=0;i<s;i++)if(!t(n[i],r[i]))return!1;return!0}}function Vn(t,e){const n=typeof e=="object"?e:{equalityCheck:e},{equalityCheck:r=jn,maxSize:s=1,resultEqualityCheck:i}=n,a=_n(r);let o=0;const l=s<=1?Ln(a):Dn(s,a);function c(){let g=l.get(arguments);if(g===he){if(g=t.apply(null,arguments),o++,i){const b=l.getEntries().find(v=>i(v.value,g));b&&(g=b.value,o!==0&&o--)}l.put(arguments,g)}return g}return c.clearCache=()=>{l.clear(),c.resetResultsCount()},c.resultsCount=()=>o,c.resetResultsCount=()=>{o=0},c}var Hn=class{constructor(t){this.value=t}deref(){return this.value}},qn=typeof WeakRef<"u"?WeakRef:Hn,Bn=0,Ze=1;function oe(){return{s:Bn,v:void 0,o:null,p:null}}function mt(t,e={}){let n=oe();const{resultEqualityCheck:r}=e;let s,i=0;function a(){let o=n;const{length:l}=arguments;for(let f=0,b=l;f<b;f++){const v=arguments[f];if(typeof v=="function"||typeof v=="object"&&v!==null){let S=o.o;S===null&&(o.o=S=new WeakMap);const y=S.get(v);y===void 0?(o=oe(),S.set(v,o)):o=y}else{let S=o.p;S===null&&(o.p=S=new Map);const y=S.get(v);y===void 0?(o=oe(),S.set(v,o)):o=y}}const c=o;let g;if(o.s===Ze)g=o.v;else if(g=t.apply(null,arguments),i++,r){const f=s?.deref?.()??s;f!=null&&r(f,g)&&(g=f,i!==0&&i--),s=typeof g=="object"&&g!==null||typeof g=="function"?new qn(g):g}return c.s=Ze,c.v=g,g}return a.clearCache=()=>{n=oe(),a.resetResultsCount()},a.resultsCount=()=>i,a.resetResultsCount=()=>{i=0},a}function bt(t,...e){const n=typeof t=="function"?{memoize:t,memoizeOptions:e}:t,r=(...s)=>{let i=0,a=0,o,l={},c=s.pop();typeof c=="object"&&(l=c,c=s.pop()),kn(c,`createSelector expects an output function after the inputs, but received: [${typeof c}]`);const g={...n,...l},{memoize:f,memoizeOptions:b=[],argsMemoize:v=mt,argsMemoizeOptions:S=[]}=g,y=Xe(b),P=Xe(S),j=An(s),k=f(function(){return i++,c.apply(null,arguments)},...y),_=v(function(){a++;const R=Fn(j,arguments);return o=k.apply(null,R),o},...P);return Object.assign(_,{resultFunc:c,memoizedResultFunc:k,dependencies:j,dependencyRecomputations:()=>a,resetDependencyRecomputations:()=>{a=0},lastResult:()=>o,recomputations:()=>i,resetRecomputations:()=>{i=0},memoize:f,argsMemoize:v})};return Object.assign(r,{withTypes:()=>r}),r}var Kn=bt(mt),zn=Object.assign((t,e=Kn)=>{Nn(t,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof t}`);const n=Object.keys(t),r=n.map(i=>t[i]);return e(r,(...i)=>i.reduce((a,o,l)=>(a[n[l]]=o,a),{}))},{withTypes:()=>zn});bt({memoize:Vn,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const T=(t,e,n,r,s,i,...a)=>{if(a.length>0)throw new Error(Kt(1));let o;if(t)o=t;else throw new Error("Missing arguments");return o};var vt=Ut();const Pe=[];let ke;function Wn(){return ke}function Un(t){Pe.push(t)}function Yn(t){const e=(n,r)=>{const s=X(Gn).current;let i;try{ke=s;for(const a of Pe)a.before(s);i=t(n,r);for(const a of Pe)a.after(s);s.didInitialize=!0}finally{ke=void 0}return i};return e.displayName=t.displayName||t.name,e}function _r(t){return d.forwardRef(Yn(t))}function Gn(){return{didInitialize:!1}}const $n=zt(19),Xn=$n?Jn:Qn;function Et(t,e,n,r,s){return Xn(t,e,n,r,s)}function Zn(t,e,n,r,s){const i=d.useCallback(()=>e(t.getSnapshot(),n,r,s),[t,e,n,r,s]);return vt.useSyncExternalStore(t.subscribe,i,i)}Un({before(t){t.syncIndex=0,t.didInitialize||(t.syncTick=1,t.syncHooks=[],t.didChangeStore=!0,t.getSnapshot=()=>{let e=!1;for(let n=0;n<t.syncHooks.length;n+=1){const r=t.syncHooks[n],s=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,s))&&(e=!0,r.value=s,r.didChange=!1)}return e&&(t.syncTick+=1),t.syncTick})},after(t){t.syncHooks.length>0&&(t.didChangeStore&&(t.didChangeStore=!1,t.subscribe=e=>{const n=new Set;for(const s of t.syncHooks)n.add(s.store);const r=[];for(const s of n)r.push(s.subscribe(e));return()=>{for(const s of r)s()}}),vt.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getSnapshot))}});function Jn(t,e,n,r,s){const i=Wn();if(!i)return Zn(t,e,n,r,s);const a=i.syncIndex;i.syncIndex+=1;let o;return i.didInitialize?(o=i.syncHooks[a],(o.store!==t||o.selector!==e||!Object.is(o.a1,n)||!Object.is(o.a2,r)||!Object.is(o.a3,s))&&(o.store!==t&&(i.didChangeStore=!0),o.store=t,o.selector=e,o.a1=n,o.a2=r,o.a3=s,o.didChange=!0)):(o={store:t,selector:e,a1:n,a2:r,a3:s,value:e(t.getSnapshot(),n,r,s),didChange:!1},i.syncHooks.push(o)),o.value}function Qn(t,e,n,r,s){return Yt.useSyncExternalStoreWithSelector(t.subscribe,t.getSnapshot,t.getSnapshot,i=>e(i,n,r,s))}class er{constructor(e){this.state=e,this.listeners=new Set,this.updateTick=0}subscribe=e=>(this.listeners.add(e),()=>{this.listeners.delete(e)});getSnapshot=()=>this.state;setState(e){if(this.state===e)return;this.state=e,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(e)}}update(e){for(const n in e)if(!Object.is(this.state[n],e[n])){this.setState({...this.state,...e});return}}set(e,n){Object.is(this.state[e],n)||this.setState({...this.state,[e]:n})}notifyAll(){const e={...this.state};this.setState(e)}use(e,n,r,s){return Et(this,e,n,r,s)}}class tr extends er{constructor(e,n={},r){super(e),this.context=n,this.selectors=r}useSyncedValue(e,n){d.useDebugValue(e),w(()=>{this.state[e]!==n&&this.set(e,n)},[e,n])}useSyncedValueWithCleanup(e,n){const r=this;w(()=>(r.state[e]!==n&&r.set(e,n),()=>{r.set(e,void 0)}),[r,e,n])}useSyncedValues(e){const n=this,r=Object.values(e);w(()=>{n.update(e)},[n,...r])}useControlledProp(e,n){d.useDebugValue(e);const r=n!==void 0;w(()=>{r&&!Object.is(this.state[e],n)&&super.setState({...this.state,[e]:n})},[e,n,r])}select(e,n,r,s){const i=this.selectors[e];return i(this.state,n,r,s)}useState(e,n,r,s){return d.useDebugValue(e),Et(this,this.selectors[e],n,r,s)}useContextCallback(e,n){d.useDebugValue(e);const r=E(n??Wt);this.context[e]=r}useStateSetter(e){const n=d.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(e,r)}),n.current}observe(e,n){let r;typeof e=="function"?r=e:r=this.selectors[e];let s=r(this.state);return n(s,s,this),this.subscribe(i=>{const a=r(i);if(!Object.is(s,a)){const o=s;s=a,n(a,o,this)}})}}const nr={open:T(t=>t.open),domReferenceElement:T(t=>t.domReferenceElement),referenceElement:T(t=>t.positionReference??t.referenceElement),floatingElement:T(t=>t.floatingElement),floatingId:T(t=>t.floatingId)};class yt extends tr{constructor(e){const{nested:n,noEmit:r,onOpenChange:s,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:lt(),nested:n,noEmit:r,triggerElements:i},nr)}setOpen=(e,n)=>{if((!e||!this.state.open||Jt(n.event))&&(this.context.dataRef.current.openEvent=e?n.event:void 0),!this.context.noEmit){const r={open:e,reason:n.reason,nativeEvent:n.event,nested:this.context.nested,triggerElement:n.trigger};this.context.events.emit("openchange",r)}this.context.onOpenChange?.(e,n)}}function rr(t,e=!1,n=!1){const[r,s]=d.useState(t&&e?"idle":void 0),[i,a]=d.useState(t);return t&&!i&&(a(!0),s("starting")),!t&&i&&r!=="ending"&&!n&&s("ending"),!t&&!i&&r==="ending"&&s(void 0),w(()=>{if(!t&&i&&r!=="ending"&&n){const o=L.request(()=>{s("ending")});return()=>{L.cancel(o)}}},[t,i,r,n]),w(()=>{if(!t||e)return;const o=L.request(()=>{s(void 0)});return()=>{L.cancel(o)}},[e,t]),w(()=>{if(!t||!e)return;t&&i&&r!=="idle"&&s("starting");const o=L.request(()=>{s("idle")});return()=>{L.cancel(o)}},[e,t,i,s,r]),d.useMemo(()=>({mounted:i,setMounted:a,transitionStatus:r}),[i,r])}let te=(function(t){return t.startingStyle="data-starting-style",t.endingStyle="data-ending-style",t})({});const sr={[te.startingStyle]:""},ir={[te.endingStyle]:""},Vr={transitionStatus(t){return t==="starting"?sr:t==="ending"?ir:null}};function or(t,e=!1,n=!0){const r=rn();return E((s,i=null)=>{r.cancel();function a(){Ae.flushSync(s)}const o=On(t);if(o==null)return;const l=o;if(typeof l.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)s();else{let c=function(){const f=te.startingStyle;if(!l.hasAttribute(f)){r.request(g);return}const b=new MutationObserver(()=>{l.hasAttribute(f)||(b.disconnect(),g())});b.observe(l,{attributes:!0,attributeFilter:[f]}),i?.addEventListener("abort",()=>b.disconnect(),{once:!0})},g=function(){Promise.all(l.getAnimations().map(f=>f.finished)).then(()=>{i?.aborted||a()}).catch(()=>{const f=l.getAnimations();if(n){if(i?.aborted)return;a()}else f.length>0&&f.some(b=>b.pending||b.playState!=="finished")&&g()})};if(e){c();return}r.request(g)}})}function ar(t){const{enabled:e=!0,open:n,ref:r,onComplete:s}=t,i=E(s),a=or(r,n,!1);d.useEffect(()=>{if(!e)return;const o=new AbortController;return a(i,o.signal),()=>{o.abort()}},[e,n,i,a])}function cr(t,e){const n=d.useRef(null),r=d.useRef(null);return d.useCallback(s=>{if(t!==void 0){if(n.current!==null){const i=n.current,a=r.current,o=e.context.triggerElements.getById(i);a&&o===a&&e.context.triggerElements.delete(i),n.current=null,r.current=null}s!==null&&(n.current=t,r.current=s,e.context.triggerElements.add(t,s))}},[e,t])}function Hr(t,e,n,r){const s=n.useState("isMountedByTrigger",t),i=cr(t,n),a=E(o=>{if(i(o),!o||!n.select("open"))return;const l=n.select("activeTriggerId");if(l===t){n.update({activeTriggerElement:o,...r});return}l==null&&n.update({activeTriggerId:t,activeTriggerElement:o,...r})});return w(()=>{s&&n.update({activeTriggerElement:e.current,...r})},[s,n,e,...Object.values(r)]),{registerTrigger:a,isMountedByThisTrigger:s}}function qr(t){const e=t.useState("open");w(()=>{if(e&&!t.select("activeTriggerId")&&t.context.triggerElements.size===1){const n=t.context.triggerElements.entries().next();if(!n.done){const[r,s]=n.value;t.update({activeTriggerId:r,activeTriggerElement:s})}}},[e,t])}function Br(t,e,n){const{mounted:r,setMounted:s,transitionStatus:i}=rr(t);e.useSyncedValues({mounted:r,transitionStatus:i});const a=E(()=>{s(!1),e.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n?.(),e.context.onOpenChangeComplete?.(!1)}),o=e.useState("preventUnmountingOnClose");return ar({enabled:!o,open:t,ref:e.context.popupRef,onComplete(){t||a()}}),{forceUnmount:a,transitionStatus:i}}class ur{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,n){const r=this.idMap.get(e);r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(e,n))}delete(e){const n=this.idMap.get(e);n&&(this.elementsSet.delete(n),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(const n of this.elementsSet)if(e(n))return!0;return!1}getById(e){return this.idMap.get(e)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function lr(){return new yt({open:!1,floatingElement:null,referenceElement:null,triggerElements:new ur,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function Kr(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:lr(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:ue,inactiveTriggerProps:ue,popupProps:ue}}const ae=T(t=>t.triggerIdProp??t.activeTriggerId),zr={open:T(t=>t.openProp??t.open),mounted:T(t=>t.mounted),transitionStatus:T(t=>t.transitionStatus),floatingRootContext:T(t=>t.floatingRootContext),preventUnmountingOnClose:T(t=>t.preventUnmountingOnClose),payload:T(t=>t.payload),activeTriggerId:ae,activeTriggerElement:T(t=>t.mounted?t.activeTriggerElement:null),isTriggerActive:T((t,e)=>e!==void 0&&ae(t)===e),isOpenedByTrigger:T((t,e)=>e!==void 0&&ae(t)===e&&t.open),isMountedByTrigger:T((t,e)=>e!==void 0&&ae(t)===e&&t.mounted),triggerProps:T((t,e)=>e?t.activeTriggerProps:t.inactiveTriggerProps),popupProps:T(t=>t.popupProps),popupElement:T(t=>t.popupElement),positionerElement:T(t=>t.positionerElement)};function Wr(t){const{popupStore:e,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:s}=t,i=Me(),a=De()!=null,o=e.useState("open"),l=e.useState("activeTriggerElement"),c=e.useState(r?"popupElement":"positionerElement"),g=e.context.triggerElements,f=X(()=>new yt({open:o,referenceElement:l,floatingElement:c,triggerElements:g,onOpenChange:s,floatingId:i,nested:a,noEmit:n})).current;return w(()=>{const b={open:o,floatingId:i,referenceElement:l,floatingElement:c};B(l)&&(b.domReferenceElement=l),f.state.positionReference===f.state.referenceElement&&(b.positionReference=l),f.update(b)},[o,i,l,c,f]),f.context.onOpenChange=s,f.context.nested=a,f.context.noEmit=n,f}function Ur(t=[]){const e=t.map(c=>c?.reference),n=t.map(c=>c?.floating),r=t.map(c=>c?.item),s=t.map(c=>c?.trigger),i=d.useCallback(c=>ce(c,t,"reference"),e),a=d.useCallback(c=>ce(c,t,"floating"),n),o=d.useCallback(c=>ce(c,t,"item"),r),l=d.useCallback(c=>ce(c,t,"trigger"),s);return d.useMemo(()=>({getReferenceProps:i,getFloatingProps:a,getItemProps:o,getTriggerProps:l}),[i,a,o,l])}function ce(t,e,n){const r=new Map,s=n==="item",i={};n==="floating"&&(i.tabIndex=-1,i[Qt]="");for(const a in t)s&&t&&(a===et||a===tt)||(i[a]=t[a]);for(let a=0;a<e.length;a+=1){let o;const l=e[a]?.[n];typeof l=="function"?o=t?l(t):null:o=l,o&&Je(i,o,s,r)}return Je(i,t,s,r),i}function Je(t,e,n,r){for(const s in e){const i=e[s];n&&(s===et||s===tt)||(s.startsWith("on")?(r.has(s)||r.set(s,[]),typeof i=="function"&&(r.get(s)?.push(i),t[s]=(...a)=>r.get(s)?.map(o=>o(...a)).find(o=>o!==void 0))):t[s]=i)}}let je=(function(t){return t.open="data-open",t.closed="data-closed",t[t.startingStyle=te.startingStyle]="startingStyle",t[t.endingStyle=te.endingStyle]="endingStyle",t.anchorHidden="data-anchor-hidden",t.side="data-side",t.align="data-align",t})({}),Ne=(function(t){return t.popupOpen="data-popup-open",t.pressed="data-pressed",t})({});const fr={[Ne.popupOpen]:""},dr={[Ne.popupOpen]:"",[Ne.pressed]:""},pr={[je.open]:""},gr={[je.closed]:""},hr={[je.anchorHidden]:""},Yr={open(t){return t?fr:null}},Gr={open(t){return t?dr:null}},$r={open(t){return t?pr:gr},anchorHidden(t){return t?hr:null}};function Xr(t){const e=d.useRef(!0);e.current&&(e.current=!1,t())}export{Ne as $,xe as A,Nr as B,yn as C,Ir as D,Gr as E,Dr as F,$e as G,Tr as H,me as I,L as J,Cn as K,Fe as L,Le as M,gt as N,wr as O,xr as P,On as Q,tr as R,le as S,Sr as T,Sn as U,Cr as V,kr as W,Pr as X,je as Y,yt as Z,Rr as _,Ue as a,Yr as a0,xn as a1,rr as a2,or as a3,te as a4,Or as b,De as c,pt as d,ar as e,Fr as f,ur as g,zr as h,Rn as i,Kr as j,T as k,Yn as l,Xr as m,Ar as n,qr as o,$r as p,Br as q,Wr as r,jr as s,Vr as t,rn as u,Ur as v,Lr as w,_r as x,Hr as y,Mr as z};
@@ -1 +1 @@
1
- import{S as G,p as N,e as l,s as Q,f as g,b as M,i as x,k as B,t as J,l as C,m as X,o as Y,q as A,n as z,r as d,c as V,u as Z}from"./main-B2CrcRuC.js";var $=class extends G{constructor(t,e){super(),this.options=e,this.#s=t,this.#i=null,this.#r=N(),this.bindMethods(),this.setOptions(e)}#s;#t=void 0;#p=void 0;#e=void 0;#a;#u;#r;#i;#b;#l;#d;#o;#h;#n;#f=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),j(this.#t,this.options)?this.#c():this.updateResult(),this.#g())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#S(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#s.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof l(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!Q(this.options,e)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&H(this.#t,s,this.options,e)&&this.#c(),this.updateResult(),r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(e.staleTime,this.#t))&&this.#R();const i=this.#v();r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||i!==this.#n)&&this.#m(i)}getOptimisticResult(t){const e=this.#s.getQueryCache().build(this.#s,t),s=this.createResult(e,t);return tt(this,s)&&(this.#e=s,this.#u=this.options,this.#a=this.#t.state),s}getCurrentResult(){return this.#e}trackResult(t,e){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){this.#f.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#s.defaultQueryOptions(t),s=this.#s.getQueryCache().build(this.#s,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#c({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#e))}#c(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(M)),e}#R(){this.#y();const t=g(this.options.staleTime,this.#t);if(x||this.#e.isStale||!B(t))return;const s=J(this.#e.dataUpdatedAt,t)+1;this.#o=C.setTimeout(()=>{this.#e.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#m(t){this.#S(),this.#n=t,!(x||l(this.options.enabled,this.#t)===!1||!B(this.#n)||this.#n===0)&&(this.#h=C.setInterval(()=>{(this.options.refetchIntervalInBackground||X.isFocused())&&this.#c()},this.#n))}#g(){this.#R(),this.#m(this.#v())}#y(){this.#o&&(C.clearTimeout(this.#o),this.#o=void 0)}#S(){this.#h&&(C.clearInterval(this.#h),this.#h=void 0)}createResult(t,e){const s=this.#t,r=this.options,i=this.#e,u=this.#a,a=this.#u,R=t!==s?t.state:this.#p,{state:h}=t;let n={...h},v=!1,o;if(e._optimisticResults){const c=this.hasListeners(),m=!c&&j(t,e),S=c&&H(t,s,e,r);(m||S)&&(n={...n,...Y(h.data,t.options)}),e._optimisticResults==="isRestoring"&&(n.fetchStatus="idle")}let{error:y,errorUpdatedAt:U,status:b}=n;o=n.data;let D=!1;if(e.placeholderData!==void 0&&o===void 0&&b==="pending"){let c;i?.isPlaceholderData&&e.placeholderData===a?.placeholderData?(c=i.data,D=!0):c=typeof e.placeholderData=="function"?e.placeholderData(this.#d?.state.data,this.#d):e.placeholderData,c!==void 0&&(b="success",o=A(i?.data,c,e),v=!0)}if(e.select&&o!==void 0&&!D)if(i&&o===u?.data&&e.select===this.#b)o=this.#l;else try{this.#b=e.select,o=e.select(o),o=A(i?.data,o,e),this.#l=o,this.#i=null}catch(c){this.#i=c}this.#i&&(y=this.#i,o=this.#l,U=Date.now(),b="error");const I=n.fetchStatus==="fetching",T=b==="pending",w=b==="error",F=T&&I,k=o!==void 0,p={status:b,fetchStatus:n.fetchStatus,isPending:T,isSuccess:b==="success",isError:w,isInitialLoading:F,isLoading:F,data:o,dataUpdatedAt:n.dataUpdatedAt,error:y,errorUpdatedAt:U,failureCount:n.fetchFailureCount,failureReason:n.fetchFailureReason,errorUpdateCount:n.errorUpdateCount,isFetched:n.dataUpdateCount>0||n.errorUpdateCount>0,isFetchedAfterMount:n.dataUpdateCount>R.dataUpdateCount||n.errorUpdateCount>R.errorUpdateCount,isFetching:I,isRefetching:I&&!T,isLoadingError:w&&!k,isPaused:n.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:w&&k,isStale:P(t,e),refetch:this.refetch,promise:this.#r,isEnabled:l(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const c=p.data!==void 0,m=p.status==="error"&&!c,S=E=>{m?E.reject(p.error):c&&E.resolve(p.data)},L=()=>{const E=this.#r=p.promise=N();S(E)},O=this.#r;switch(O.status){case"pending":t.queryHash===s.queryHash&&S(O);break;case"fulfilled":(m||p.data!==O.value)&&L();break;case"rejected":(!m||p.error!==O.reason)&&L();break}}return p}updateResult(){const t=this.#e,e=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#u=this.options,this.#a.data!==void 0&&(this.#d=this.#t),Q(e,t))return;this.#e=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#f.size)return!0;const u=new Set(i??this.#f);return this.options.throwOnError&&u.add("error"),Object.keys(this.#e).some(a=>{const f=a;return this.#e[f]!==t[f]&&u.has(f)})};this.#E({listeners:s()})}#O(){const t=this.#s.getQueryCache().build(this.#s,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#p=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#g()}#E(t){z.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#e)}),this.#s.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function q(t,e){return l(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function j(t,e){return q(t,e)||t.state.data!==void 0&&_(t,e,e.refetchOnMount)}function _(t,e,s){if(l(e.enabled,t)!==!1&&g(e.staleTime,t)!=="static"){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&P(t,e)}return!1}function H(t,e,s,r){return(t!==e||l(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&P(t,s)}function P(t,e){return l(e.enabled,t)!==!1&&t.isStaleByTime(g(e.staleTime,t))}function tt(t,e){return!Q(t.getCurrentResult(),e)}var K=d.createContext(!1),et=()=>d.useContext(K);K.Provider;function st(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var rt=d.createContext(st()),it=()=>d.useContext(rt),nt=(t,e,s)=>{const r=s?.state.error&&typeof t.throwOnError=="function"?V(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},at=t=>{d.useEffect(()=>{t.clearReset()},[t])},ot=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||V(s,[t.error,r])),ht=t=>{if(t.suspense){const s=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},ct=(t,e)=>t.isLoading&&t.isFetching&&!e,ut=(t,e)=>t?.suspense&&e.isPending,W=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function lt(t,e,s){const r=et(),i=it(),u=Z(),a=u.defaultQueryOptions(t);u.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const f=u.getQueryCache().get(a.queryHash);a._optimisticResults=r?"isRestoring":"optimistic",ht(a),nt(a,i,f),at(i);const R=!u.getQueryCache().get(a.queryHash),[h]=d.useState(()=>new e(u,a)),n=h.getOptimisticResult(a),v=!r&&t.subscribed!==!1;if(d.useSyncExternalStore(d.useCallback(o=>{const y=v?h.subscribe(z.batchCalls(o)):M;return h.updateResult(),y},[h,v]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),d.useEffect(()=>{h.setOptions(a)},[a,h]),ut(a,n))throw W(a,h,i);if(ot({result:n,errorResetBoundary:i,throwOnError:a.throwOnError,query:f,suspense:a.suspense}))throw n.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(a,n),a.experimental_prefetchInRender&&!x&&ct(n,r)&&(R?W(a,h,i):f?.promise)?.catch(M).finally(()=>{h.updateResult()}),a.notifyOnChangeProps?n:h.trackResult(n)}function pt(t,e){return lt(t,$)}export{pt as u};
1
+ import{S as G,p as N,e as l,s as Q,f as g,b as M,i as x,k as B,t as J,l as C,m as X,o as Y,q as A,n as z,r as d,c as V,u as Z}from"./main-xPlWrMhO.js";var $=class extends G{constructor(t,e){super(),this.options=e,this.#s=t,this.#i=null,this.#r=N(),this.bindMethods(),this.setOptions(e)}#s;#t=void 0;#p=void 0;#e=void 0;#a;#u;#r;#i;#b;#l;#d;#o;#h;#n;#f=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),j(this.#t,this.options)?this.#c():this.updateResult(),this.#g())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#y(),this.#S(),this.#t.removeObserver(this)}setOptions(t){const e=this.options,s=this.#t;if(this.options=this.#s.defaultQueryOptions(t),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof l(this.options.enabled,this.#t)!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#O(),this.#t.setOptions(this.options),e._defaulted&&!Q(this.options,e)&&this.#s.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#t,observer:this});const r=this.hasListeners();r&&H(this.#t,s,this.options,e)&&this.#c(),this.updateResult(),r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||g(this.options.staleTime,this.#t)!==g(e.staleTime,this.#t))&&this.#R();const i=this.#v();r&&(this.#t!==s||l(this.options.enabled,this.#t)!==l(e.enabled,this.#t)||i!==this.#n)&&this.#m(i)}getOptimisticResult(t){const e=this.#s.getQueryCache().build(this.#s,t),s=this.createResult(e,t);return tt(this,s)&&(this.#e=s,this.#u=this.options,this.#a=this.#t.state),s}getCurrentResult(){return this.#e}trackResult(t,e){return new Proxy(t,{get:(s,r)=>(this.trackProp(r),e?.(r),r==="promise"&&(this.trackProp("data"),!this.options.experimental_prefetchInRender&&this.#r.status==="pending"&&this.#r.reject(new Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(s,r))})}trackProp(t){this.#f.add(t)}getCurrentQuery(){return this.#t}refetch({...t}={}){return this.fetch({...t})}fetchOptimistic(t){const e=this.#s.defaultQueryOptions(t),s=this.#s.getQueryCache().build(this.#s,e);return s.fetch().then(()=>this.createResult(s,e))}fetch(t){return this.#c({...t,cancelRefetch:t.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#e))}#c(t){this.#O();let e=this.#t.fetch(this.options,t);return t?.throwOnError||(e=e.catch(M)),e}#R(){this.#y();const t=g(this.options.staleTime,this.#t);if(x||this.#e.isStale||!B(t))return;const s=J(this.#e.dataUpdatedAt,t)+1;this.#o=C.setTimeout(()=>{this.#e.isStale||this.updateResult()},s)}#v(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(this.#t):this.options.refetchInterval)??!1}#m(t){this.#S(),this.#n=t,!(x||l(this.options.enabled,this.#t)===!1||!B(this.#n)||this.#n===0)&&(this.#h=C.setInterval(()=>{(this.options.refetchIntervalInBackground||X.isFocused())&&this.#c()},this.#n))}#g(){this.#R(),this.#m(this.#v())}#y(){this.#o&&(C.clearTimeout(this.#o),this.#o=void 0)}#S(){this.#h&&(C.clearInterval(this.#h),this.#h=void 0)}createResult(t,e){const s=this.#t,r=this.options,i=this.#e,u=this.#a,a=this.#u,R=t!==s?t.state:this.#p,{state:h}=t;let n={...h},v=!1,o;if(e._optimisticResults){const c=this.hasListeners(),m=!c&&j(t,e),S=c&&H(t,s,e,r);(m||S)&&(n={...n,...Y(h.data,t.options)}),e._optimisticResults==="isRestoring"&&(n.fetchStatus="idle")}let{error:y,errorUpdatedAt:U,status:b}=n;o=n.data;let D=!1;if(e.placeholderData!==void 0&&o===void 0&&b==="pending"){let c;i?.isPlaceholderData&&e.placeholderData===a?.placeholderData?(c=i.data,D=!0):c=typeof e.placeholderData=="function"?e.placeholderData(this.#d?.state.data,this.#d):e.placeholderData,c!==void 0&&(b="success",o=A(i?.data,c,e),v=!0)}if(e.select&&o!==void 0&&!D)if(i&&o===u?.data&&e.select===this.#b)o=this.#l;else try{this.#b=e.select,o=e.select(o),o=A(i?.data,o,e),this.#l=o,this.#i=null}catch(c){this.#i=c}this.#i&&(y=this.#i,o=this.#l,U=Date.now(),b="error");const I=n.fetchStatus==="fetching",T=b==="pending",w=b==="error",F=T&&I,k=o!==void 0,p={status:b,fetchStatus:n.fetchStatus,isPending:T,isSuccess:b==="success",isError:w,isInitialLoading:F,isLoading:F,data:o,dataUpdatedAt:n.dataUpdatedAt,error:y,errorUpdatedAt:U,failureCount:n.fetchFailureCount,failureReason:n.fetchFailureReason,errorUpdateCount:n.errorUpdateCount,isFetched:n.dataUpdateCount>0||n.errorUpdateCount>0,isFetchedAfterMount:n.dataUpdateCount>R.dataUpdateCount||n.errorUpdateCount>R.errorUpdateCount,isFetching:I,isRefetching:I&&!T,isLoadingError:w&&!k,isPaused:n.fetchStatus==="paused",isPlaceholderData:v,isRefetchError:w&&k,isStale:P(t,e),refetch:this.refetch,promise:this.#r,isEnabled:l(e.enabled,t)!==!1};if(this.options.experimental_prefetchInRender){const c=p.data!==void 0,m=p.status==="error"&&!c,S=E=>{m?E.reject(p.error):c&&E.resolve(p.data)},L=()=>{const E=this.#r=p.promise=N();S(E)},O=this.#r;switch(O.status){case"pending":t.queryHash===s.queryHash&&S(O);break;case"fulfilled":(m||p.data!==O.value)&&L();break;case"rejected":(!m||p.error!==O.reason)&&L();break}}return p}updateResult(){const t=this.#e,e=this.createResult(this.#t,this.options);if(this.#a=this.#t.state,this.#u=this.options,this.#a.data!==void 0&&(this.#d=this.#t),Q(e,t))return;this.#e=e;const s=()=>{if(!t)return!0;const{notifyOnChangeProps:r}=this.options,i=typeof r=="function"?r():r;if(i==="all"||!i&&!this.#f.size)return!0;const u=new Set(i??this.#f);return this.options.throwOnError&&u.add("error"),Object.keys(this.#e).some(a=>{const f=a;return this.#e[f]!==t[f]&&u.has(f)})};this.#E({listeners:s()})}#O(){const t=this.#s.getQueryCache().build(this.#s,this.options);if(t===this.#t)return;const e=this.#t;this.#t=t,this.#p=t.state,this.hasListeners()&&(e?.removeObserver(this),t.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#g()}#E(t){z.batch(()=>{t.listeners&&this.listeners.forEach(e=>{e(this.#e)}),this.#s.getQueryCache().notify({query:this.#t,type:"observerResultsUpdated"})})}};function q(t,e){return l(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function j(t,e){return q(t,e)||t.state.data!==void 0&&_(t,e,e.refetchOnMount)}function _(t,e,s){if(l(e.enabled,t)!==!1&&g(e.staleTime,t)!=="static"){const r=typeof s=="function"?s(t):s;return r==="always"||r!==!1&&P(t,e)}return!1}function H(t,e,s,r){return(t!==e||l(r.enabled,t)===!1)&&(!s.suspense||t.state.status!=="error")&&P(t,s)}function P(t,e){return l(e.enabled,t)!==!1&&t.isStaleByTime(g(e.staleTime,t))}function tt(t,e){return!Q(t.getCurrentResult(),e)}var K=d.createContext(!1),et=()=>d.useContext(K);K.Provider;function st(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var rt=d.createContext(st()),it=()=>d.useContext(rt),nt=(t,e,s)=>{const r=s?.state.error&&typeof t.throwOnError=="function"?V(t.throwOnError,[s.state.error,s]):t.throwOnError;(t.suspense||t.experimental_prefetchInRender||r)&&(e.isReset()||(t.retryOnMount=!1))},at=t=>{d.useEffect(()=>{t.clearReset()},[t])},ot=({result:t,errorResetBoundary:e,throwOnError:s,query:r,suspense:i})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(i&&t.data===void 0||V(s,[t.error,r])),ht=t=>{if(t.suspense){const s=i=>i==="static"?i:Math.max(i??1e3,1e3),r=t.staleTime;t.staleTime=typeof r=="function"?(...i)=>s(r(...i)):s(r),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},ct=(t,e)=>t.isLoading&&t.isFetching&&!e,ut=(t,e)=>t?.suspense&&e.isPending,W=(t,e,s)=>e.fetchOptimistic(t).catch(()=>{s.clearReset()});function lt(t,e,s){const r=et(),i=it(),u=Z(),a=u.defaultQueryOptions(t);u.getDefaultOptions().queries?._experimental_beforeQuery?.(a);const f=u.getQueryCache().get(a.queryHash);a._optimisticResults=r?"isRestoring":"optimistic",ht(a),nt(a,i,f),at(i);const R=!u.getQueryCache().get(a.queryHash),[h]=d.useState(()=>new e(u,a)),n=h.getOptimisticResult(a),v=!r&&t.subscribed!==!1;if(d.useSyncExternalStore(d.useCallback(o=>{const y=v?h.subscribe(z.batchCalls(o)):M;return h.updateResult(),y},[h,v]),()=>h.getCurrentResult(),()=>h.getCurrentResult()),d.useEffect(()=>{h.setOptions(a)},[a,h]),ut(a,n))throw W(a,h,i);if(ot({result:n,errorResetBoundary:i,throwOnError:a.throwOnError,query:f,suspense:a.suspense}))throw n.error;return u.getDefaultOptions().queries?._experimental_afterQuery?.(a,n),a.experimental_prefetchInRender&&!x&&ct(n,r)&&(R?W(a,h,i):f?.promise)?.catch(M).finally(()=>{h.updateResult()}),a.notifyOnChangeProps?n:h.trackResult(n)}function pt(t,e){return lt(t,$)}export{pt as u};
@@ -19,7 +19,7 @@ import { u as useChatSettings$1 } from "./index-B_F4DTUu.js";
19
19
  import { createPortal } from "react-dom";
20
20
  import { create } from "zustand";
21
21
  import { persist } from "zustand/middleware";
22
- import { a as Route } from "./router-DaKDqc9w.js";
22
+ import { a as Route } from "./router-X2L0PDPI.js";
23
23
  function deriveFriendlyIdFromKey(key) {
24
24
  if (!key) return "main";
25
25
  const trimmed = key.trim();
@@ -1686,7 +1686,7 @@ function areSidebarSessionsEqual(prev, next) {
1686
1686
  return true;
1687
1687
  }
1688
1688
  const SettingsDialog = lazy(
1689
- () => import("./settings-dialog-DyWNblva.js").then((m) => ({ default: m.SettingsDialog }))
1689
+ () => import("./settings-dialog-CPdftvjz.js").then((m) => ({ default: m.SettingsDialog }))
1690
1690
  );
1691
1691
  const SessionExportDialog = lazy(
1692
1692
  () => import("./session-export-dialog-CgtlOnwf.js").then((m) => ({
@@ -2833,7 +2833,7 @@ function Tool({ toolPart, defaultOpen = false }) {
2833
2833
  ] }) });
2834
2834
  }
2835
2835
  const Thinking = lazy(
2836
- () => import("./thinking-CU0FRlzT.js").then((m) => ({
2836
+ () => import("./thinking-YkRSlXtf.js").then((m) => ({
2837
2837
  default: m.Thinking
2838
2838
  }))
2839
2839
  );
@@ -3502,7 +3502,7 @@ function TypingIndicator({ className }) {
3502
3502
  ] });
3503
3503
  }
3504
3504
  const FollowUpSuggestions = lazy(
3505
- () => import("./follow-up-suggestions-C65ptDij.js").then((m) => ({
3505
+ () => import("./follow-up-suggestions-DHv2_XzB.js").then((m) => ({
3506
3506
  default: m.FollowUpSuggestions
3507
3507
  }))
3508
3508
  );
@@ -5723,268 +5723,66 @@ function useChatSessions({
5723
5723
  sessionsError
5724
5724
  };
5725
5725
  }
5726
- const LLM_PROVIDER_DEFAULTS = {
5727
- openai: {
5728
- baseUrl: "https://api.openai.com/v1",
5729
- model: "gpt-4.1-nano"
5730
- },
5731
- openrouter: {
5732
- baseUrl: "https://openrouter.ai/api/v1",
5733
- model: "openai/gpt-oss-120b"
5734
- },
5735
- kilocode: {
5736
- baseUrl: "https://api.kilo.ai/api/gateway",
5737
- model: "google/gemini-2.5-flash"
5738
- },
5739
- ollama: {
5740
- baseUrl: "http://localhost:11434/v1",
5741
- model: "llama3.2"
5742
- },
5743
- custom: {
5744
- baseUrl: "",
5745
- model: ""
5746
- }
5747
- };
5748
- const DEFAULT_LLM_SETTINGS = {
5749
- useLlmTitles: true,
5750
- useLlmFollowUps: true,
5751
- llmProvider: "openai",
5752
- llmBaseUrl: "",
5753
- llmModel: "",
5754
- llmApiKey: ""
5755
- };
5756
- function getLlmProviderDefaults(provider) {
5757
- return LLM_PROVIDER_DEFAULTS[provider];
5758
- }
5759
- function getEffectiveLlmBaseUrl(settings) {
5760
- if (settings.llmBaseUrl.trim()) return settings.llmBaseUrl.trim();
5761
- return getLlmProviderDefaults(settings.llmProvider).baseUrl;
5762
- }
5763
- function getEffectiveLlmModel(settings) {
5764
- if (settings.llmModel.trim()) return settings.llmModel.trim();
5765
- return getLlmProviderDefaults(settings.llmProvider).model;
5766
- }
5767
- function getAvailability(settings, hasEnvKey) {
5768
- if (settings.llmProvider === "ollama") return true;
5769
- if (settings.llmProvider === "custom") {
5770
- return Boolean(settings.llmApiKey.trim()) || Boolean(settings.llmBaseUrl.trim() && settings.llmModel.trim());
5771
- }
5772
- return hasEnvKey || Boolean(settings.llmApiKey.trim());
5773
- }
5774
- function migratePersistedState(persistedState) {
5775
- if (!persistedState || typeof persistedState !== "object") {
5776
- return { settings: DEFAULT_LLM_SETTINGS };
5777
- }
5778
- const { settings } = persistedState;
5779
- if (!settings) {
5780
- return { settings: DEFAULT_LLM_SETTINGS };
5781
- }
5782
- const { openaiApiKey, ...rest } = settings;
5783
- const llmApiKey = rest.llmApiKey ?? openaiApiKey ?? "";
5784
- return {
5785
- settings: {
5786
- ...DEFAULT_LLM_SETTINGS,
5787
- ...rest,
5788
- llmApiKey
5789
- }
5790
- };
5791
- }
5792
- const useLlmSettingsStore = create()(
5793
- persist(
5794
- (set) => ({
5795
- settings: {
5796
- ...DEFAULT_LLM_SETTINGS
5797
- },
5798
- updateSettings: (updates) => set((state) => ({
5799
- settings: { ...state.settings, ...updates }
5800
- })),
5801
- clearApiKey: () => set((state) => ({
5802
- settings: { ...state.settings, llmApiKey: "" }
5803
- }))
5804
- }),
5805
- {
5806
- name: "llm-settings",
5807
- version: 2,
5808
- migrate: (persistedState) => migratePersistedState(persistedState)
5809
- }
5810
- )
5811
- );
5812
- function useLlmSettings() {
5813
- const settings = useLlmSettingsStore((state) => state.settings);
5814
- const updateSettings = useLlmSettingsStore((state) => state.updateSettings);
5815
- const clearApiKey = useLlmSettingsStore((state) => state.clearApiKey);
5816
- const [status, setStatus] = useState({
5817
- hasEnvKey: false,
5818
- hasOpenRouterKey: false,
5819
- hasKilocodeKey: false,
5820
- hasUserKey: Boolean(settings.llmApiKey),
5821
- isAvailable: getAvailability(settings, false),
5822
- isLoading: true,
5823
- error: null
5824
- });
5825
- useEffect(() => {
5826
- let cancelled = false;
5827
- async function checkStatus() {
5828
- try {
5829
- const res = await fetch("/api/llm-features");
5830
- if (!res.ok) throw new Error("Failed to check LLM status");
5831
- const data = await res.json();
5832
- if (cancelled) return;
5833
- const hasUserKey = Boolean(settings.llmApiKey);
5834
- const hasProviderKey = settings.llmProvider === "openrouter" ? Boolean(data.hasOpenRouterKey) : settings.llmProvider === "kilocode" ? Boolean(data.hasKilocodeKey) : data.hasEnvKey;
5835
- setStatus({
5836
- hasEnvKey: data.hasEnvKey,
5837
- hasOpenRouterKey: Boolean(data.hasOpenRouterKey),
5838
- hasKilocodeKey: Boolean(data.hasKilocodeKey),
5839
- hasUserKey,
5840
- isAvailable: getAvailability(settings, hasProviderKey),
5841
- isLoading: false,
5842
- error: null
5843
- });
5844
- } catch (err) {
5845
- if (cancelled) return;
5846
- setStatus((prev) => ({
5847
- ...prev,
5848
- isLoading: false,
5849
- error: err instanceof Error ? err.message : "Failed to check status"
5850
- }));
5851
- }
5726
+ function useSmartTitle() {
5727
+ const [isGenerating, setIsGenerating] = useState(false);
5728
+ const [lastTitle, setLastTitle] = useState(null);
5729
+ const [lastSource, setLastSource] = useState(null);
5730
+ const abortControllerRef = useRef(null);
5731
+ const generateTitle = useCallback(async (message) => {
5732
+ if (abortControllerRef.current) {
5733
+ abortControllerRef.current.abort();
5852
5734
  }
5853
- void checkStatus();
5854
- return () => {
5855
- cancelled = true;
5856
- };
5857
- }, [
5858
- settings.llmApiKey,
5859
- settings.llmProvider,
5860
- settings.llmBaseUrl,
5861
- settings.llmModel
5862
- ]);
5863
- const testApiKey = useCallback(async (key) => {
5735
+ const controller = new AbortController();
5736
+ abortControllerRef.current = controller;
5737
+ setIsGenerating(true);
5864
5738
  try {
5865
- const headers = buildLlmHeaders({
5866
- ...settings,
5867
- llmApiKey: key
5868
- });
5869
5739
  const res = await fetch("/api/llm-features", {
5870
5740
  method: "POST",
5871
5741
  headers: {
5872
- "Content-Type": "application/json",
5873
- ...headers
5742
+ "Content-Type": "application/json"
5874
5743
  },
5875
- body: JSON.stringify({ action: "test" })
5744
+ body: JSON.stringify({
5745
+ action: "title",
5746
+ message
5747
+ }),
5748
+ signal: controller.signal
5876
5749
  });
5750
+ if (!res.ok) {
5751
+ throw new Error(`API error: ${res.status}`);
5752
+ }
5877
5753
  const data = await res.json();
5878
- if (!data.ok) {
5879
- return { valid: false, error: data.error || "Test failed" };
5754
+ if (controller.signal.aborted) {
5755
+ throw new Error("Aborted");
5880
5756
  }
5881
- return { valid: data.valid ?? false, error: data.error };
5882
- } catch (err) {
5757
+ const rawTitle = data.title || message.slice(0, 50);
5758
+ const title = rawTitle.length > 64 ? rawTitle.slice(0, 61) + "..." : rawTitle;
5759
+ const source = data.source || "heuristic";
5760
+ setLastTitle(title);
5761
+ setLastSource(source);
5883
5762
  return {
5884
- valid: false,
5885
- error: err instanceof Error ? err.message : "Network error"
5763
+ title,
5764
+ source,
5765
+ error: data.error
5886
5766
  };
5887
- }
5888
- }, [settings]);
5889
- return {
5890
- settings,
5891
- updateSettings,
5892
- clearApiKey,
5893
- status,
5894
- testApiKey
5895
- };
5896
- }
5897
- function buildLlmHeaders(settings) {
5898
- const apiKey = settings.llmApiKey;
5899
- const baseUrl = getEffectiveLlmBaseUrl(settings);
5900
- const model = getEffectiveLlmModel(settings);
5901
- if (apiKey) {
5902
- return {
5903
- "X-OpenAI-API-Key": apiKey,
5904
- ...baseUrl ? { "X-LLM-Base-URL": baseUrl } : {},
5905
- ...model ? { "X-LLM-Model": model } : {}
5906
- };
5907
- }
5908
- return {
5909
- ...baseUrl ? { "X-LLM-Base-URL": baseUrl } : {},
5910
- ...model ? { "X-LLM-Model": model } : {}
5911
- };
5912
- }
5913
- function getLlmHeaders() {
5914
- const settings = useLlmSettingsStore.getState().settings;
5915
- return buildLlmHeaders(settings);
5916
- }
5917
- function useSmartTitle() {
5918
- const llmSettings = useLlmSettingsStore((state) => state.settings);
5919
- const [isGenerating, setIsGenerating] = useState(false);
5920
- const [lastTitle, setLastTitle] = useState(null);
5921
- const [lastSource, setLastSource] = useState(null);
5922
- const abortControllerRef = useRef(null);
5923
- const generateTitle = useCallback(
5924
- async (message) => {
5925
- if (abortControllerRef.current) {
5926
- abortControllerRef.current.abort();
5767
+ } catch (err) {
5768
+ if (err instanceof Error && err.name === "AbortError") {
5769
+ throw err;
5927
5770
  }
5928
- const controller = new AbortController();
5929
- abortControllerRef.current = controller;
5930
- setIsGenerating(true);
5931
- try {
5932
- const headers = {
5933
- "Content-Type": "application/json",
5934
- ...getLlmHeaders()
5935
- };
5936
- const res = await fetch("/api/llm-features", {
5937
- method: "POST",
5938
- headers,
5939
- body: JSON.stringify({
5940
- action: "title",
5941
- message
5942
- }),
5943
- signal: controller.signal
5944
- });
5945
- if (!res.ok) {
5946
- throw new Error(`API error: ${res.status}`);
5947
- }
5948
- const data = await res.json();
5949
- if (controller.signal.aborted) {
5950
- throw new Error("Aborted");
5951
- }
5952
- const rawTitle = data.title || message.slice(0, 50);
5953
- const title = rawTitle.length > 64 ? rawTitle.slice(0, 61) + "..." : rawTitle;
5954
- const source = data.source || "heuristic";
5955
- setLastTitle(title);
5956
- setLastSource(source);
5957
- return {
5958
- title,
5959
- source,
5960
- error: data.error
5961
- };
5962
- } catch (err) {
5963
- if (err instanceof Error && err.name === "AbortError") {
5964
- throw err;
5965
- }
5966
- const fallbackTitle = generateHeuristicTitle(message);
5967
- setLastTitle(fallbackTitle);
5968
- setLastSource("heuristic");
5969
- return {
5970
- title: fallbackTitle,
5971
- source: "heuristic",
5972
- error: err instanceof Error ? err.message : "Unknown error"
5973
- };
5974
- } finally {
5975
- setIsGenerating(false);
5976
- if (abortControllerRef.current === controller) {
5977
- abortControllerRef.current = null;
5978
- }
5771
+ const fallbackTitle = generateHeuristicTitle(message);
5772
+ setLastTitle(fallbackTitle);
5773
+ setLastSource("heuristic");
5774
+ return {
5775
+ title: fallbackTitle,
5776
+ source: "heuristic",
5777
+ error: err instanceof Error ? err.message : "Unknown error"
5778
+ };
5779
+ } finally {
5780
+ setIsGenerating(false);
5781
+ if (abortControllerRef.current === controller) {
5782
+ abortControllerRef.current = null;
5979
5783
  }
5980
- },
5981
- [
5982
- llmSettings.llmApiKey,
5983
- llmSettings.llmBaseUrl,
5984
- llmSettings.llmModel,
5985
- llmSettings.llmProvider
5986
- ]
5987
- );
5784
+ }
5785
+ }, []);
5988
5786
  return {
5989
5787
  generateTitle,
5990
5788
  isGenerating,
@@ -6014,7 +5812,7 @@ function generateHeuristicTitle(message) {
6014
5812
  return title || message.slice(0, 50);
6015
5813
  }
6016
5814
  function useLlmTitlesEnabled() {
6017
- return useLlmSettingsStore((state) => state.settings.useLlmTitles);
5815
+ return true;
6018
5816
  }
6019
5817
  function handleAgentEvent(payload, fallbackSessionKey, options) {
6020
5818
  const agentPayload = asRecord(payload);
@@ -6438,7 +6236,7 @@ const KeyboardShortcutsDialog = lazy(
6438
6236
  }))
6439
6237
  );
6440
6238
  const SearchDialog = lazy(
6441
- () => import("./search-dialog-DSSK93kq.js").then((m) => ({
6239
+ () => import("./search-dialog-CXhofdoP.js").then((m) => ({
6442
6240
  default: m.SearchDialog
6443
6241
  }))
6444
6242
  );
@@ -6807,7 +6605,6 @@ function ChatScreen({
6807
6605
  }
6808
6606
  }, [historyMessages, streamFinish]);
6809
6607
  useEffect(() => {
6810
- if (!llmTitlesEnabled) return;
6811
6608
  if (isNewChat || isRedirecting) return;
6812
6609
  const sessionKey = forcedSessionKey || resolvedSessionKey || activeSessionKey;
6813
6610
  if (!sessionKey) return;
@@ -7465,11 +7262,7 @@ const $sessionKey = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
7465
7262
  export {
7466
7263
  $sessionKey as $,
7467
7264
  Collapsible as C,
7468
- useLlmSettingsStore as a,
7469
- getLlmHeaders as b,
7470
- chatQueryKeys as c,
7471
- CollapsibleTrigger as d,
7472
- CollapsiblePanel as e,
7473
- getLlmProviderDefaults as g,
7474
- useLlmSettings as u
7265
+ CollapsibleTrigger as a,
7266
+ CollapsiblePanel as b,
7267
+ chatQueryKeys as c
7475
7268
  };