@meetquinn/animactl 0.1.30 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/cli/cli-errors.js +4 -0
- package/dist/server/messages/contact-policy.service.d.ts +9 -0
- package/dist/server/messages/contact-policy.service.d.ts.map +1 -1
- package/dist/server/messages/contact-policy.service.js +44 -16
- package/dist/server/tests/contact-policy.test.js +45 -4
- package/dist/web/assets/{FileViewer-2hthjdQD.js → FileViewer-BtzV0xCy.js} +3 -3
- package/dist/web/assets/{OwnerPickerForm-BOG15_5q.js → OwnerPickerForm-Dad51XVK.js} +1 -1
- package/dist/web/assets/{SlackTimeline-DJMHtjVN.js → SlackTimeline-CEQmQliZ.js} +1 -1
- package/dist/web/assets/{UsageHeatmap-DIM_N0fI.js → UsageHeatmap-BW-EDtlf.js} +1 -1
- package/dist/web/assets/{activity-CF_uXyqx.js → activity-DxOg0Zpw.js} +1 -1
- package/dist/web/assets/{arc-DN3rV-nI.js → arc-fS3jqr6M.js} +1 -1
- package/dist/web/assets/architecture-7EHR7CIX-JFavxCHZ.js +1 -0
- package/dist/web/assets/{architectureDiagram-3BPJPVTR-BjOQPVOb.js → architectureDiagram-3BPJPVTR-CDsOHh13.js} +1 -1
- package/dist/web/assets/arrow-right-rNbgcgPM.js +1 -0
- package/dist/web/assets/{blockDiagram-GPEHLZMM-CxnJJyNZ.js → blockDiagram-GPEHLZMM-Dafvh8yC.js} +1 -1
- package/dist/web/assets/{c4Diagram-AAUBKEIU-MJtkpqPP.js → c4Diagram-AAUBKEIU-BqFnkKWL.js} +1 -1
- package/dist/web/assets/channel-CM3nHrAD.js +1 -0
- package/dist/web/assets/{channels-DAmTOZbW.js → channels-CFYn9Uzy.js} +1 -1
- package/dist/web/assets/{chunk-2J33WTMH-DH7F6Toz.js → chunk-2J33WTMH-BEmf3Qku.js} +1 -1
- package/dist/web/assets/{chunk-3OPIFGDE-SXmEESKD.js → chunk-3OPIFGDE-CtmMZbUU.js} +1 -1
- package/dist/web/assets/{chunk-4BX2VUAB-DB0OPa2S.js → chunk-4BX2VUAB-CacBYgOE.js} +1 -1
- package/dist/web/assets/{chunk-55IACEB6-DGr-WOhv.js → chunk-55IACEB6-BXURqjLZ.js} +1 -1
- package/dist/web/assets/{chunk-5ZQYHXKU-Vgr4jBt1.js → chunk-5ZQYHXKU-D_5qZ4Zv.js} +1 -1
- package/dist/web/assets/{chunk-727SXJPM-CWaX9Qk5.js → chunk-727SXJPM-BU31EEG5.js} +1 -1
- package/dist/web/assets/{chunk-AQP2D5EJ-CFTKUNkn.js → chunk-AQP2D5EJ-DTtKK5xv.js} +1 -1
- package/dist/web/assets/{chunk-BSJP7CBP-DD2WqzXl.js → chunk-BSJP7CBP-C5nluir4.js} +1 -1
- package/dist/web/assets/{chunk-CSCIHK7Q-xxNdF5BX.js → chunk-CSCIHK7Q-BeNiRoDm.js} +3 -3
- package/dist/web/assets/{chunk-FMBD7UC4-D637Lg0-.js → chunk-FMBD7UC4-LV5XAtCz.js} +1 -1
- package/dist/web/assets/{chunk-KSCS5N6A-B9pu9Zdk.js → chunk-KSCS5N6A-D80hU7za.js} +1 -1
- package/dist/web/assets/{chunk-L5ZTLDWV-DYHe5z-p.js → chunk-L5ZTLDWV-DtSiy2JS.js} +1 -1
- package/dist/web/assets/{chunk-LZXEDZCA-C2A3MD3P.js → chunk-LZXEDZCA-CFWlwpSj.js} +2 -2
- package/dist/web/assets/{chunk-ND2GUHAM-CzVnJeg1.js → chunk-ND2GUHAM-Cks69kWo.js} +1 -1
- package/dist/web/assets/{chunk-NZK2D7GU-Bi3zqbUv.js → chunk-NZK2D7GU-BKDBTHUK.js} +1 -1
- package/dist/web/assets/{chunk-O5CBEL6O-B7YJjftf.js → chunk-O5CBEL6O-Dh_KkhDf.js} +1 -1
- package/dist/web/assets/chunk-QZHKN3VN-CXmYofd4.js +1 -0
- package/dist/web/assets/chunk-WU5MYG2G-BAvj0V8I.js +1 -0
- package/dist/web/assets/{chunk-XPW4576I-BRwQ5uRX.js → chunk-XPW4576I-BaeieIoE.js} +1 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-CqWCXo7M.js +1 -0
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-CqWCXo7M.js +1 -0
- package/dist/web/assets/{copy-CrJlq9AF.js → copy-DI3PIiTH.js} +1 -1
- package/dist/web/assets/{cose-bilkent-S5V4N54A-T1Va7b5W.js → cose-bilkent-S5V4N54A-Illz9lmk.js} +1 -1
- package/dist/web/assets/{dagre-BM42HDAG-BP0-K47r.js → dagre-BM42HDAG-uzpuT_vy.js} +1 -1
- package/dist/web/assets/{diagram-2AECGRRQ-CezL6GWB.js → diagram-2AECGRRQ-BCPKQqtp.js} +1 -1
- package/dist/web/assets/{diagram-5GNKFQAL-DAToGWTN.js → diagram-5GNKFQAL-ComD16wh.js} +1 -1
- package/dist/web/assets/{diagram-KO2AKTUF-CkbuKqVt.js → diagram-KO2AKTUF-BzSas2Wg.js} +1 -1
- package/dist/web/assets/{diagram-LMA3HP47-Ccw5LzTI.js → diagram-LMA3HP47-Di6iEw3F.js} +1 -1
- package/dist/web/assets/{diagram-OG6HWLK6-DM8PEKD_.js → diagram-OG6HWLK6-BiJvsy5z.js} +1 -1
- package/dist/web/assets/{dist-CwHmnwO6.js → dist-BVWlbvC4.js} +1 -1
- package/dist/web/assets/{erDiagram-TEJ5UH35-DtZHusNf.js → erDiagram-TEJ5UH35-2dFfOUHh.js} +1 -1
- package/dist/web/assets/eventmodeling-FCH6USID-BHZ_hWV_.js +1 -0
- package/dist/web/assets/{files-BySZvVoJ.js → files-fW_iAV7E.js} +1 -1
- package/dist/web/assets/{flowDiagram-I6XJVG4X-BtiRpY_v.js → flowDiagram-I6XJVG4X-DENcgZKO.js} +1 -1
- package/dist/web/assets/{ganttDiagram-6RSMTGT7-CvsbKTJa.js → ganttDiagram-6RSMTGT7-CGsf5ccc.js} +1 -1
- package/dist/web/assets/gitGraph-WXDBUCRP-DhWA66Cy.js +1 -0
- package/dist/web/assets/{gitGraphDiagram-PVQCEYII-D2UEiEmu.js → gitGraphDiagram-PVQCEYII-BQIgIegs.js} +1 -1
- package/dist/web/assets/{index-CbAhFc-0.js → index-DlHETnHC.js} +2 -2
- package/dist/web/assets/info-J43DQDTF-CEcqsbJ5.js +1 -0
- package/dist/web/assets/{infoDiagram-5YYISTIA-C1JIXj0K.js → infoDiagram-5YYISTIA-MrkM0y-m.js} +1 -1
- package/dist/web/assets/{ishikawaDiagram-YF4QCWOH-CrV-BAK2.js → ishikawaDiagram-YF4QCWOH-Dr8UsvPX.js} +1 -1
- package/dist/web/assets/{journeyDiagram-JHISSGLW-C5UZDjPg.js → journeyDiagram-JHISSGLW-DGypTGb1.js} +1 -1
- package/dist/web/assets/{kanban-definition-UN3LZRKU-CmAcW_Gm.js → kanban-definition-UN3LZRKU-yYXyv91m.js} +1 -1
- package/dist/web/assets/{kb-CrNRBaRa.js → kb-f003GncV.js} +1 -1
- package/dist/web/assets/{lightbulb-BZTBGg7G.js → lightbulb-17VUUl6S.js} +1 -1
- package/dist/web/assets/{line-BeG27-zH.js → line-CX3cghIS.js} +1 -1
- package/dist/web/assets/{linear-D6Qub4j1.js → linear-87q8d4nG.js} +1 -1
- package/dist/web/assets/{login-DF6d0xuk.js → login-DptYMeSz.js} +1 -1
- package/dist/web/assets/{mermaid-parser.core-OQrfCf7Q.js → mermaid-parser.core-DZTDfv4-.js} +2 -2
- package/dist/web/assets/{mermaid.core-DnM6i6kF.js → mermaid.core-BhLaljEz.js} +3 -3
- package/dist/web/assets/{mindmap-definition-RKZ34NQL-C90Pg8IG.js → mindmap-definition-RKZ34NQL-Cgrh68Ws.js} +1 -1
- package/dist/web/assets/{onboarding-Ds4m8CzL.js → onboarding-CGAqAgFX.js} +1 -1
- package/dist/web/assets/packet-YPE3B663-BmMYdqRg.js +1 -0
- package/dist/web/assets/pie-LRSECV5Y-1wIF2xtw.js +1 -0
- package/dist/web/assets/{pieDiagram-4H26LBE5-DMHbg7t6.js → pieDiagram-4H26LBE5-CsIniA7U.js} +1 -1
- package/dist/web/assets/{profile-D8xJTQW-.js → profile-BCiWQjvh.js} +1 -1
- package/dist/web/assets/{quadrantDiagram-W4KKPZXB-CdlyTllG.js → quadrantDiagram-W4KKPZXB-ppRpf4TS.js} +1 -1
- package/dist/web/assets/radar-GUYGQ44K-p1z2JqZu.js +1 -0
- package/dist/web/assets/{reminders-Cls3R6H7.js → reminders-CYmvRDWq.js} +1 -1
- package/dist/web/assets/{requirementDiagram-4Y6WPE33-CJJ8Lrck.js → requirementDiagram-4Y6WPE33-lnX3NUSy.js} +1 -1
- package/dist/web/assets/{sankeyDiagram-5OEKKPKP-BGraj5n6.js → sankeyDiagram-5OEKKPKP-DGuhoGFR.js} +1 -1
- package/dist/web/assets/search-BB_1c6y5.js +1 -0
- package/dist/web/assets/{sequenceDiagram-3UESZ5HK-B8g-XwoX.js → sequenceDiagram-3UESZ5HK-C-LlJv8b.js} +1 -1
- package/dist/web/assets/{settings-9rtkfxfO.js → settings-BfsiJmaF.js} +1 -1
- package/dist/web/assets/{src-DOSXYjwH.js → src-B2YqOS_g.js} +1 -1
- package/dist/web/assets/{stateDiagram-AJRCARHV-tzHGG25a.js → stateDiagram-AJRCARHV-m_XE9xkX.js} +1 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-eKkkGk4l.js +1 -0
- package/dist/web/assets/{timeline-definition-PNZ67QCA-Bm5F6kuI.js → timeline-definition-PNZ67QCA-BD126VRM.js} +1 -1
- package/dist/web/assets/treeView-BLDUP644-Bt9NKcs-.js +1 -0
- package/dist/web/assets/treemap-LRROVOQU-Bw9RdNCX.js +1 -0
- package/dist/web/assets/{useInfiniteQuery-D4aujXNJ.js → useInfiniteQuery-BYCmT0Iw.js} +1 -1
- package/dist/web/assets/{useNow-BwVNU1Kt.js → useNow-BbEkaqh-.js} +1 -1
- package/dist/web/assets/{vennDiagram-CIIHVFJN-CD9fmg50.js → vennDiagram-CIIHVFJN-DLM0FNBN.js} +1 -1
- package/dist/web/assets/wardley-L42UT6IY-DpsUZBpc.js +1 -0
- package/dist/web/assets/{wardleyDiagram-YWT4CUSO-CKu3d4sB.js → wardleyDiagram-YWT4CUSO-DQgt20IC.js} +1 -1
- package/dist/web/assets/{xychartDiagram-2RQKCTM6-CRRLjHSX.js → xychartDiagram-2RQKCTM6-CUCAmkCj.js} +1 -1
- package/dist/web/index.html +1 -1
- package/docs/agent/guide.md +1 -2
- package/docs/guide/working-with-your-agent.md +1 -1
- package/package.json +1 -1
- package/dist/web/assets/architecture-7EHR7CIX-DU_giWjw.js +0 -1
- package/dist/web/assets/arrow-right-Da05Wwlp.js +0 -1
- package/dist/web/assets/channel-BfxUxG5f.js +0 -1
- package/dist/web/assets/chunk-QZHKN3VN-NhFAU-9O.js +0 -1
- package/dist/web/assets/chunk-WU5MYG2G-CZXAqd3y.js +0 -1
- package/dist/web/assets/classDiagram-4FO5ZUOK-Dy777uwp.js +0 -1
- package/dist/web/assets/classDiagram-v2-Q7XG4LA2-Dy777uwp.js +0 -1
- package/dist/web/assets/eventmodeling-FCH6USID-CDO-goTv.js +0 -1
- package/dist/web/assets/gitGraph-WXDBUCRP-Cn7wn299.js +0 -1
- package/dist/web/assets/info-J43DQDTF-BHUyVizh.js +0 -1
- package/dist/web/assets/packet-YPE3B663-B_2RTGcc.js +0 -1
- package/dist/web/assets/pie-LRSECV5Y-ieCDED7Y.js +0 -1
- package/dist/web/assets/radar-GUYGQ44K-CpqbrBX-.js +0 -1
- package/dist/web/assets/search-BoEnT13J.js +0 -1
- package/dist/web/assets/stateDiagram-v2-BHNVJYJU-DeLaPJhU.js +0 -1
- package/dist/web/assets/treeView-BLDUP644-WRDNuShD.js +0 -1
- package/dist/web/assets/treemap-LRROVOQU-BlaZCSii.js +0 -1
- package/dist/web/assets/wardley-L42UT6IY-C-Xkgr9M.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as e,$t as t,B as n,Dr as r,Er as i,G as a,H as o,Ht as s,I as c,J as l,Jn as u,K as d,Kn as f,L as p,Ln as m,Mn as h,N as g,P as _,Q as v,R as y,Tr as b,U as x,V as S,W as C,Wn as w,X as T,Xt as E,Y as D,Z as O,at as k,bn as A,cn as j,ct as M,dt as N,et as P,fr as F,ft as I,g as L,in as R,it as ee,kr as z,lt as B,nr as V,nt as H,ot as U,pt as W,q as te,rt as ne,sn as G,st as re,t as ie,tt as ae,un as oe,ut as se,z as ce}from"./index-CbAhFc-0.js";var le=oe(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ue=oe(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),de=oe(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]);function fe(e,t){return e.map(e=>{if(!e.dynamicModels)return e;let n=me(e,t??null);return{...e,defaultModel:n?.defaultModel??``,models:n?.models??[]}})}function pe(e,t,n){if(!e)return[];let r=me(e,n??null);return A(e.kind,t,r)}function me(e,t){return t?.find(t=>t.kind===e.kind)}function he(e,t){if(!e?.dynamicModels)return;let n=me(e,t??null);if(!n?.checkedAt||!n.defaultModel||!n.models?.length)return`Model catalog not checked`;let r=new Date(n.checkedAt);return`Model catalog checked ${Number.isNaN(r.getTime())?n.checkedAt:r.toLocaleString()}`}function ge(e,t){if(!e||!t)return!1;let n=me(e,t);return n?.present===!0?!e.dynamicModels||!!(n.defaultModel&&n.models?.length):!1}function _e(e,t){return e.find(e=>ge(e,t))}function ve(e,t){if(!t)return`checking...`;let n=me(e,t);if(!n?.present)return`not installed`;if(e.dynamicModels&&(!n.defaultModel||!n.models?.length))return`models not checked`}function ye(e,t){if(!e||!t)return;let n=me(e,t);if(!n?.present)return e.installHint;if(e.dynamicModels&&(!n.defaultModel||!n.models?.length))return n.modelCheckError??`Sign in to this provider so Anima can read its current model catalog.`}function be(e,t){return t?e.flatMap(e=>{let n=ve(e,t),r=ye(e,t);return n&&r?[{kind:e.kind,label:e.label,status:n,hint:r}]:[]}):[]}var K=z(i()),xe=z(b()),q=F(),J=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),Se={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ce={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},we={disabled:!1,...Ce},Te={valid(e){return e===null?null:e?{[J.valid]:``}:{[J.invalid]:``}}},Ee={invalid:void 0,name:void 0,validityData:{state:Se,errors:[],error:``,value:``,initialValue:null},setValidityData:ce,disabled:void 0,touched:Ce.touched,setTouched:ce,dirty:Ce.dirty,setDirty:ce,filled:Ce.filled,setFilled:ce,focused:Ce.focused,setFocused:ce,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:we,markedDirtyRef:{current:!1},registerFieldControl:ce,validation:{getValidationProps:(e=y)=>e,getInputValidationProps:(e=y)=>e,inputRef:{current:null},commit:async()=>{}}},De=K.createContext(Ee);function Oe(e=!0){let t=K.useContext(De);if(t.setValidityData===ce&&!e)throw Error(x(28));return t}var ke=K.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:ce,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function Ae(){return K.useContext(ke)}var je=0;function Me(e,t=`mui`){let[n,r]=K.useState(e),i=e||n;return K.useEffect(()=>{n??(je+=1,r(`${t}-${je}`))},[n,t]),i}var Ne=l.useId;function Pe(e,t){if(Ne!==void 0){let n=Ne();return e??(t?`${t}-${n}`:n)}return Me(e,t)}function Fe(e){return Pe(e,`base-ui`)}var Ie=K.createContext({controlId:void 0,registerControlId:ce,labelId:void 0,setLabelId:ce,messageIds:[],setMessageIds:ce,getDescriptionProps:e=>e});function Le(){return K.useContext(Ie)}function Re(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:o}=Le(),s=Fe(t),c=n?i:void 0,l=te(()=>Symbol(`labelable-control`)),u=K.useRef(!1),f=K.useRef(t!=null),p=d(()=>{!u.current||o===ce||(u.current=!1,o(l.current,void 0))});return a(()=>{if(o===ce)return;let e;if(n){let n=r?.current;e=k(n)&&n.closest(`label`)!=null?t??null:c??s}else if(t!=null)f.current=!0,e=t;else if(f.current)e=s;else{p();return}if(e===void 0){p();return}u.current=!0,o(l.current,e)},[t,r,c,o,n,s,l,p]),K.useEffect(()=>p,[p]),i??s}function Y(e){return e?.ownerDocument||document}var ze=typeof navigator<`u`,Be=Je(),Ve=Xe(),He=Ye(),Ue=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),We=Be.platform===`MacIntel`&&Be.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Be.platform);ze&&/firefox/i.test(He);var Ge=ze&&/apple/i.test(navigator.vendor);ze&&/Edg/i.test(He);var Ke=ze&&/android/i.test(Ve)||/android/i.test(He);ze&&Ve.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var qe=He.includes(`jsdom/`);function Je(){if(!ze)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function Ye(){if(!ze)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function Xe(){if(!ze)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}var Ze=`data-base-ui-focusable`,Qe=`ArrowLeft`,$e=`ArrowRight`,et=`ArrowUp`,tt=`ArrowDown`;function nt(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function X(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&se(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function rt(e){return`composedPath`in e?e.composedPath()[0]:e.target}function it(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function at(e){return e.matches(`html,body`)}function ot(e){return U(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function st(e){return e?e.getAttribute(`role`)===`combobox`&&ot(e):!1}function ct(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function lt(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...lt(e,t.id,n)])}function ut(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function dt(e){e.preventDefault(),e.stopPropagation()}function ft(e){return`nativeEvent`in e}function pt(e){return e.pointerType===``&&e.isTrusted?!0:Ke&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function mt(e){return qe?!1:!Ke&&e.width===0&&e.height===0||Ke&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function ht(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function gt(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var _t=[`top`,`right`,`bottom`,`left`],vt=Math.min,yt=Math.max,bt=Math.round,xt=Math.floor,St=e=>({x:e,y:e}),Ct={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function wt(e,t,n){return yt(e,vt(t,n))}function Tt(e,t){return typeof e==`function`?e(t):e}function Et(e){return e.split(`-`)[0]}function Dt(e){return e.split(`-`)[1]}function Ot(e){return e===`x`?`y`:`x`}function kt(e){return e===`y`?`height`:`width`}function At(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function jt(e){return Ot(At(e))}function Mt(e,t,n){n===void 0&&(n=!1);let r=Dt(e),i=jt(e),a=kt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Vt(o)),[o,Vt(o)]}function Nt(e){let t=Vt(e);return[Pt(e),t,Pt(t)]}function Pt(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Ft=[`left`,`right`],It=[`right`,`left`],Lt=[`top`,`bottom`],Rt=[`bottom`,`top`];function zt(e,t,n){switch(e){case`top`:case`bottom`:return n?t?It:Ft:t?Ft:It;case`left`:case`right`:return t?Lt:Rt;default:return[]}}function Bt(e,t,n,r){let i=Dt(e),a=zt(Et(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Pt)))),a}function Vt(e){let t=Et(e);return Ct[t]+e.slice(t.length)}function Ht(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ut(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ht(e)}function Wt(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Gt(e,t,n){return Math.floor(e/t)!==n}function Kt(e,t){return t<0||t>=e.length}function qt(e,t){return Yt(e.current,{disabledIndices:t})}function Jt(e,t){return Yt(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Yt(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&en(e,a,r));return a}function Xt(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!en(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=xt(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!en(e,r,s))return r}};d&&dt(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=Yt(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=Yt(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}Kt(e,f)&&(f=u)}if(n===`both`){let n=xt(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&dt(t),u%o===o-1?r&&(f=Yt(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=Yt(e,{startingIndex:u,disabledIndices:s}),r&&Gt(f,o,n)&&(f=Yt(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),Gt(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&dt(t),u%o===0?r&&(f=Yt(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=Yt(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&Gt(f,o,n)&&(f=Yt(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),Gt(f,o,n)&&(f=u));let c=xt(l/o)===n;Kt(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:Yt(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function Zt(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function Qt(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function $t(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function en(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?nn(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function tn(e){return e.visibility===`hidden`||e.visibility===`collapse`}function nn(e,t=e?D(e):null){return!e||!e.isConnected||!t||tn(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var rn=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function an(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return se(n)?n.host:null}function on(t){for(let n of Array.from(t.children))if(e(n)===`summary`)return n;return null}function sn(e,t){let n=on(t);return!!n&&(e===n||X(n,e))}function cn(t){let n=t?e(t):``;return t!=null&&t.matches(rn)&&(n!==`summary`||t.parentElement!=null&&e(t.parentElement)===`details`&&on(t.parentElement)===t)&&(n!==`details`||on(t)==null)&&(n!==`input`||t.type!==`hidden`)}function ln(t){if(!cn(t)||!t.isConnected||t.matches(`:disabled`))return!1;for(let n=t;n;n=an(n)){let r=n!==t,i=e(n)===`slot`;if(n.hasAttribute(`inert`)||r&&e(n)===`details`&&!n.open&&!sn(t,n)||n.hasAttribute(`hidden`)||!i&&!un(n,r))return!1}return!0}function un(e,t){let n=D(e);return t?n.display!==`none`:nn(e,n)}function dn(t){let n=t.tabIndex;if(n<0){let n=e(t);if(n===`details`||n===`audio`||n===`video`||U(t)&&t.isContentEditable)return 0}return n}function fn(t){if(e(t)!==`input`)return null;let n=t;return n.type===`radio`&&n.name!==``?n:null}function pn(e,t){let n=fn(e);if(!n)return!0;let r=t.find(e=>{let t=fn(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=fn(e);return t?.name===n.name&&t.form===n.form})===n}function mn(t){if(U(t)&&e(t)===`slot`){let e=t.assignedElements({flatten:!0});if(e.length>0)return e}return U(t)&&t.shadowRoot?Array.from(t.shadowRoot.children):Array.from(t.children)}function hn(e,t){mn(e).forEach(e=>{cn(e)&&t.push(e),hn(e,t)})}function gn(e,t,n){mn(e).forEach(e=>{U(e)&&e.matches(t)&&n.push(e),gn(e,t,n)})}function _n(e){return ln(e)&&dn(e)>=0}function vn(e){let t=[];return hn(e,t),t.filter(ln)}function yn(e){let t=vn(e);return t.filter(e=>dn(e)>=0&&pn(e,t))}function bn(e,t){let n=yn(e),r=n.length;if(r===0)return;let i=nt(Y(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function xn(e){return bn(Y(e).body,1)||e}function Sn(e){return bn(Y(e).body,-1)||e}function Cn(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!X(n,r)}function wn(e){yn(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Tn(e){let t=[];gn(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var En=[];function Dn(e){K.useEffect(e,En)}var On=0,kn=class e{static create(){return new e}currentId=On;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=On,t()},e)}isStarted(){return this.currentId!==On}clear=()=>{this.currentId!==On&&(clearTimeout(this.currentId),this.currentId=On)};disposeEffect=()=>this.clear};function An(){let e=te(kn.create).current;return Dn(e.disposeEffect),e}var jn=null;globalThis.requestAnimationFrame;var Mn=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},Nn=class e{static create(){return new e}static request(e){return Mn.request(e)}static cancel(e){return Mn.cancel(e)}currentId=jn;request(e){this.cancel(),this.currentId=Mn.request(()=>{this.currentId=jn,e()})}cancel=()=>{this.currentId!==jn&&(Mn.cancel(this.currentId),this.currentId=jn)};disposeEffect=()=>this.cancel};function Pn(){let e=te(Nn.create).current;return Dn(e.disposeEffect),e}function Fn(e){return e==null?e:`current`in e?e.current:e}var In=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),Ln={[In.startingStyle]:``},Rn={[In.endingStyle]:``},zn={transitionStatus(e){return e===`starting`?Ln:e===`ending`?Rn:null}};function Bn(e,t=!1,n=!0){let r=Pn();return d((i,a=null)=>{r.cancel();let o=Fn(e);if(o==null)return;let s=o,c=()=>{xe.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=In.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function Vn(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=d(i),o=Bn(r,n,!1);K.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}function Hn(e,t=!1,n=!1){let[r,i]=K.useState(e&&t?`idle`:void 0),[o,s]=K.useState(e);return e&&!o&&(s(!0),i(`starting`)),!e&&o&&r!==`ending`&&!n&&i(`ending`),!e&&!o&&r===`ending`&&i(void 0),a(()=>{if(!e&&o&&r!==`ending`&&n){let e=Nn.request(()=>{i(`ending`)});return()=>{Nn.cancel(e)}}},[e,o,r,n]),a(()=>{if(!e||t)return;let n=Nn.request(()=>{i(void 0)});return()=>{Nn.cancel(n)}},[t,e]),a(()=>{if(!e||!t)return;e&&o&&r!==`idle`&&i(`starting`);let n=Nn.request(()=>{i(`idle`)});return()=>{Nn.cancel(n)}},[t,e,o,r]),{mounted:o,setMounted:s,transitionStatus:r}}function Un({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=K.useRef(e!==void 0),[a,o]=K.useState(t);return[i?e:a,K.useCallback(e=>{i||o(e)},[])]}function Wn(e,t,n,r,i=!0){let{registerFieldControl:o}=Oe(),s=K.useRef(null);s.current||=Symbol(),a(()=>{let a=s.current;if(!(!a||!i))return o(a,{controlRef:e,getValue:r,id:t,value:n}),()=>{o(a,void 0)}},[e,i,r,t,o,n])}var Gn=`none`,Kn=`trigger-press`,qn=`outside-press`,Jn=`item-press`,Yn=`focus-out`,Xn=`escape-key`,Zn=`list-navigation`,Qn=`cancel-open`,$n=`window-resize`;function er(e,t,n,r){let i=!1,a=!1,o=r??y;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var tr={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},nr={...tr,position:`fixed`,top:0,left:0},rr={...tr,position:`absolute`};function ir(e){let t=K.useRef(!0);t.current&&(t.current=!1,e())}function ar(e){let[t,n]=K.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function or(e){let t=te(sr,e).current;return t.next=e,a(t.effect),t}function sr(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Z=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(x(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},cr=r((e=>{var t=i();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),lr=r(((e,t)=>{t.exports=cr()})),ur=r((e=>{var t=i(),n=lr();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:r,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),dr=r(((e,t)=>{t.exports=ur()})),fr=lr(),pr=dr(),mr=[],hr=void 0;function gr(){return hr}function _r(e){mr.push(e)}var vr=n(19)?br:xr;function Q(e,t,n,r,i){return vr(e,t,n,r,i)}function yr(e,t,n,r,i){let a=K.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,fr.useSyncExternalStore)(e.subscribe,a,a)}_r({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,fr.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function br(e,t,n,r,i){let a=gr();if(!a)return yr(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function xr(e,t,n,r,i){return(0,pr.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Sr=class{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;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Q(this,e,t,n,r)}},Cr=class extends Sr{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){K.useDebugValue(e);let n=this;a(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;a(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;a(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){K.useDebugValue(e);let n=this,r=t!==void 0;a(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return K.useDebugValue(e),Q(this,this.selectors[e],t,n,r)}useContextCallback(e,t){K.useDebugValue(e);let n=d(t??ce);this.context[e]=n}useStateSetter(e){let t=K.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}};function wr(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Tr(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var Er=K.forwardRef(function(e,t){let[n,r]=K.useState();a(()=>{Ge&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,q.jsx)(`span`,{...e,ref:t,style:nr,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})});function Dr(e){return`data-base-ui-${e}`}var Or=0;function kr(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(Or);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),ce;let o=requestAnimationFrame(a);return Or=o,()=>{Or===o&&(cancelAnimationFrame(o),Or=0)}}var Ar={inert:new WeakMap,"aria-hidden":new WeakMap},jr=`data-base-ui-inert`,Mr={inert:new WeakSet,"aria-hidden":new WeakSet},Nr=new WeakMap,Pr=0;function Fr(e){return Mr[e]}function Ir(e){return e?se(e)?e.host:Ir(e.parentNode):null}var Lr=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Ir(t);return e.contains(n)?n:null}).filter(e=>e!=null),Rr=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},zr=(t,n,r)=>{let i=[],a=t=>{!t||r.has(t)||Array.from(t.children).forEach(t=>{e(t)!==`script`&&(n.has(t)?a(t):i.push(t))})};return a(t),i};function Br(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=Lr(t,e),u=i?Lr(t,a):[],d=new Set(u),f=i?zr(t,Rr(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=Ar[o],n=Fr(o);c=n,s=e;let r=Lr(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);zr(t,Rr(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(Nr.get(e)||0)+1;Nr.set(e,t),m.push(e),t===1&&e.setAttribute(jr,``)}),Pr+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(Nr.get(e)||0)-1;Nr.set(e,t),t||e.removeAttribute(jr)}),--Pr,Pr||(Ar.inert=new WeakMap,Ar[`aria-hidden`]=new WeakMap,Mr.inert=new WeakSet,Mr[`aria-hidden`]=new WeakSet,Nr=new WeakMap)}}function Vr(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=Y(e[0]).body;return Br(e,o,n,r,{mark:i,markerIgnoreElements:a})}var Hr={style:{transition:`none`}},Ur={fallbackAxisSide:`none`},Wr={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},Gr=K.createContext(null),Kr=()=>K.useContext(Gr),qr=Dr(`portal`);function Jr(e={}){let{ref:t,container:n,componentProps:r=y,elementProps:i}=e,o=Pe(),s=Kr()?.portalNode,[l,u]=K.useState(null),[f,p]=K.useState(null),m=d(e=>{e!==null&&p(e)}),h=K.useRef(null);a(()=>{if(n===null){h.current&&(h.current=null,p(null),u(null));return}if(o==null)return;let e=(n&&(M(n)?n:n.current))??s??document.body;if(e==null){h.current&&(h.current=null,p(null),u(null));return}h.current!==e&&(h.current=e,p(null),u(e))},[n,s,o]);let g=c(`div`,r,{ref:[t,m],props:[{id:o,[qr]:``},i]});return{portalNode:f,portalSubtree:l&&g?xe.createPortal(g,l):null}}var Yr=K.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,renderGuards:s,...c}=e,{portalNode:l,portalSubtree:u}=Jr({container:o,ref:t,componentProps:e,elementProps:c}),d=K.useRef(null),f=K.useRef(null),p=K.useRef(null),m=K.useRef(null),[h,g]=K.useState(null),_=K.useRef(!1),v=h?.modal,y=h?.open,b=typeof s==`boolean`?s:!!h&&!h.modal&&h.open&&!!l;K.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&Cn(e)&&(e.type===`focusin`?_.current&&=(Tn(l),!1):(wn(l),_.current=!0))}return wr(Tr(l,`focusin`,e,!0),Tr(l,`focusout`,e,!0))},[l,v]),K.useEffect(()=>{!l||y!==!1||(Tn(l),_.current=!1)},[y,l]);let x=K.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,q.jsxs)(K.Fragment,{children:[u,(0,q.jsxs)(Gr.Provider,{value:x,children:[b&&l&&(0,q.jsx)(Er,{"data-type":`outside`,ref:d,onFocus:e=>{Cn(e,l)?p.current?.focus():Sn(h?h.domReference:null)?.focus()}}),b&&l&&(0,q.jsx)(`span`,{"aria-owns":l.id,style:Wr}),l&&xe.createPortal(a,l),b&&l&&(0,q.jsx)(Er,{"data-type":`outside`,ref:f,onFocus:e=>{Cn(e,l)?m.current?.focus():(xn(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,er(`focus-out`,e.nativeEvent)))}})]})]})});function Xr(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var Zr=K.createContext(null),Qr=K.createContext(null),$r=()=>K.useContext(Zr)?.id||null,ei=e=>{let t=K.useContext(Qr);return e??t};function ti(e,t){let n=ne(rt(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var ni=20,ri=[];function ii(){ri=ri.filter(e=>e.deref()?.isConnected)}function ai(t){ii(),t&&e(t)!==`body`&&(ri.push(new WeakRef(t)),ri.length>ni&&(ri=ri.slice(-20)))}function oi(){return ii(),ri[ri.length-1]?.deref()}function si(e){return e?_n(e)?e:yn(e)[0]||e:null}function ci(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=vn(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return _n(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function li(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:o=!0,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:f,previousFocusableElement:p,beforeContentFocusGuardRef:m,externalTree:h,getInsideElements:g}=e,_=`rootStore`in t?t.rootStore:t,v=_.useState(`open`),y=_.useState(`domReferenceElement`),b=_.useState(`floatingElement`),{events:x,dataRef:C}=_.context,w=d(()=>C.current.floatingContext?.nodeId),T=i===!1,E=st(y)&&T,D=K.useRef([`content`]),O=or(i),k=or(o),A=or(u),j=ei(h),M=Kr(),N=K.useRef(!1),P=K.useRef(!1),F=K.useRef(!1),I=K.useRef(null),L=K.useRef(``),R=K.useRef(``),ee=K.useRef(null),z=K.useRef(null),B=S(ee,m,M?.beforeInsideRef),V=S(z,M?.afterInsideRef),H=An(),W=An(),te=Pn(),ne=M!=null,G=ct(b),re=d((e=G)=>e?yn(e):[]),ie=d(()=>g?.().filter(e=>e!=null)??[]);K.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&X(G,nt(Y(G)))&&re().length===0&&!E&&dt(e)}return Tr(Y(G),`keydown`,e)},[r,G,c,E,re]),K.useEffect(()=>{if(r||!v)return;let e=Y(G);function t(){F.current=!1}function n(e){let t=rt(e),n=ie();F.current=!(X(b,t)||X(y,t)||X(M?.portalNode,t)||n.some(e=>e===t||X(e,t))),R.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(P.current=!0)}function i(){R.current=`keyboard`}return wr(Tr(e,`pointerdown`,n,!0),Tr(e,`pointerup`,t,!0),Tr(e,`pointercancel`,t,!0),Tr(e,`keydown`,i,!0))},[r,b,y,G,v,M,ie]),K.useEffect(()=>{if(r||!l)return;let e=Y(G);function t(){P.current=!0,W.start(0,()=>{P.current=!1})}function n(e){let t=rt(e);_n(t)&&(I.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=rt(t);queueMicrotask(()=>{let a=w(),o=_.context.triggerElements,l=ie(),u=n?.hasAttribute(Dr(`focus-guard`))&&[ee.current,z.current,M?.beforeInsideRef.current,M?.afterInsideRef.current,M?.beforeOutsideRef.current,M?.afterOutsideRef.current,Fn(p),Fn(f)].includes(n),d=!(X(y,n)||X(b,n)||X(n,b)||X(M?.portalNode,n)||l.some(e=>e===n||X(e,n))||n!=null&&o.hasElement(n)||o.hasMatchingElement(e=>X(e,n))||u||j&&(lt(j.nodesRef.current,a).find(e=>X(e.context?.elements.floating,n)||X(e.context?.elements.domReference,n))||ut(j.nodesRef.current,a).find(e=>[e.context?.elements.floating,ct(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===y&&G&&ci(G,D),s&&r!==y&&!nn(i)&&nt(e)===e.body){if(U(G)&&(G.focus(),s===`popup`)){te.request(()=>{G.focus()});return}let e=re(),t=I.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||G;U(n)&&n.focus()}if(C.current.insideReactTree){C.current.insideReactTree=!1;return}(E||!c)&&n&&d&&!P.current&&(E||n!==oi())&&(N.current=!0,_.setOpen(!1,er(Yn,t)))})}function a(){F.current||(C.current.insideReactTree=!0,H.start(0,()=>{C.current.insideReactTree=!1}))}let o=U(y)?y:null;if(!(!b&&!o))return wr(o&&Tr(o,`focusout`,i),o&&Tr(o,`pointerdown`,t),b&&Tr(b,`focusin`,n),b&&Tr(b,`focusout`,i),b&&M&&Tr(b,`focusout`,a,!0))},[r,y,b,G,c,j,M,_,l,s,re,E,w,D,C,H,W,te,f,p,ie]),K.useEffect(()=>{if(r||!b||!v)return;let e=Array.from(M?.portalNode?.querySelectorAll(`[${Dr(`portal`)}]`)||[]),t=(j?ut(j.nodesRef.current,w()):[]).find(e=>st(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Vr([b,...e,ee.current,z.current,M?.beforeOutsideRef.current,M?.afterOutsideRef.current,...ie(),t,Fn(p),Fn(f),E?y:null].filter(e=>e!=null),{ariaHidden:c||E,mark:!1}),i=Vr([b,...e].filter(e=>e!=null));return()=>{i(),n()}},[v,r,y,b,c,M,E,j,w,f,p,ie]),a(()=>{if(!v||r||!U(G))return;let e=Y(G),t=nt(e);queueMicrotask(()=>{let n=O.current,r=typeof n==`function`?n(A.current||``):n;if(r===void 0||r===!1||X(G,t))return;let i=null,a=()=>(i??=re(G),i[0]||G),o;o=r===!0||r===null?a():Fn(r),o||=a();let s=X(G,nt(e));kr(o,{preventScroll:o===G,shouldFocus(){if(s)return!0;let t=nt(e);return!(t!==o&&X(G,t))}})})},[r,v,G,re,O,A]),a(()=>{if(r||!G)return;let e=Y(G);ai(nt(e));function t(e){if(e.open||(L.current=ti(e.nativeEvent,R.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(N.current=!0),e.reason===`outside-press`)if(e.nested)N.current=!1;else if(pt(e.nativeEvent)||mt(e.nativeEvent))N.current=!1;else{let e=!1;Y(G).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?N.current=!1:N.current=!0}}x.on(`openchange`,t);function n(){let e=k.current,t=typeof e==`function`?e(L.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`)return y?.isConnected?y:oi()||null;let n=y?.isConnected?y:oi();return Fn(t)||n||null}return()=>{x.off(`openchange`,t);let r=nt(e),i=ie(),a=X(b,r)||i.some(e=>e===r||X(e,r))||j&<(j.nodesRef.current,w(),!1).some(e=>X(e.context?.elements.floating,r)),o=k.current,s=n();queueMicrotask(()=>{let t=si(s),n=typeof o!=`boolean`;o&&!N.current&&U(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),N.current=!1})}},[r,b,G,k,x,j,y,w,ie]),a(()=>{if(!Ue||v||!b)return;let e=nt(Y(b));!U(e)||!ot(e)||X(b,e)&&e.blur()},[v,b]),a(()=>{if(!(r||!M))return M.setFocusManagerState({modal:c,closeOnFocusOut:l,open:v,onOpenChange:_.setOpen,domReference:y}),()=>{M.setFocusManagerState(null)}},[r,M,c,v,_,l,y]),a(()=>{if(!(r||!G))return ci(G,D),()=>{queueMicrotask(ii)}},[r,G,D]);let ae=!r&&(c?!E:!0)&&(ne||c);return(0,q.jsxs)(K.Fragment,{children:[ae&&(0,q.jsx)(Er,{"data-type":`inside`,ref:B,onFocus:e=>{if(c){let e=re();kr(e[e.length-1])}else M?.portalNode&&(N.current=!1,Cn(e,M.portalNode)?xn(y)?.focus():Fn(p??M.beforeOutsideRef)?.focus())}}),n,ae&&(0,q.jsx)(Er,{"data-type":`inside`,ref:V,onFocus:e=>{c?kr(re()[0]):M?.portalNode&&(l&&(N.current=!0),Cn(e,M.portalNode)?Sn(y)?.focus():Fn(f??M.afterOutsideRef)?.focus())}})]})}function ui(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=Kn}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=K.useRef(void 0),f=Pn(),p=An(),m=K.useMemo(()=>{function e(e,t,n,r){let i=er(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||ht(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=rt(o);if(ot(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}ht(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return K.useMemo(()=>n?{reference:m}:y,[n,m])}var di={intentional:`onClick`,sloppy:`onPointerDown`};function fi(){return!1}function pi(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function mi(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=fi,referencePressEvent:s=`sloppy`,bubbles:c,externalTree:l}=t,u=`rootStore`in e?e.rootStore:e,f=u.useState(`open`),p=u.useState(`floatingElement`),{dataRef:m}=u.context,h=ei(l),g=d(typeof i==`function`?i:()=>!1),_=typeof i==`function`?g:i,v=_!==!1,y=d(()=>a),{escapeKey:b,outsidePress:x}=pi(c),S=K.useRef(!1),C=K.useRef(!1),w=K.useRef(!1),T=K.useRef(!1),E=K.useRef(``),O=K.useRef(null),A=An(),j=An(),M=d(()=>{j.clear(),m.current.insideReactTree=!1}),N=d(e=>{let t=m.current.floatingContext?.nodeId;return(h?lt(h.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),P=d(e=>it(e,u.select(`floatingElement`))||it(e,u.select(`domReferenceElement`))),F=d(e=>{o()&&u.setOpen(!1,er(Kn,e.nativeEvent))}),I=d(e=>{if(!f||!n||!r||e.key!==`Escape`||T.current||!b&&N(`__escapeKeyBubbles`))return;let t=er(Xn,ft(e)?e.nativeEvent:e);u.setOpen(!1,t),t.isCanceled||e.preventDefault(),!b&&!t.isPropagationAllowed&&e.stopPropagation()}),L=d(()=>{m.current.insideReactTree=!0,j.start(0,M)}),R=d(e=>{if(!f||!n||e.button!==0)return;let t=rt(e.nativeEvent);X(u.select(`floatingElement`),t)&&(S.current||(S.current=!0,C.current=!1))}),ee=d(e=>{!f||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&S.current&&(C.current=!0)});K.useEffect(()=>{if(!f||!n)return;m.current.__escapeKeyBubbles=b,m.current.__outsidePressBubbles=x;let e=new kn,t=new kn;function i(){e.clear(),T.current=!0}function a(){e.start(W()?5:0,()=>{T.current=!1})}function o(){w.current=!0,t.start(0,()=>{w.current=!1})}function s(){S.current=!1,C.current=!1}function c(){let e=E.current,t=e===`pen`||!e?`mouse`:e,n=y(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function l(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function d(e){let t=m.current.floatingContext?.nodeId,n=h&<(h.nodesRef.current,t).some(t=>it(e,t.context?.elements.floating));return P(e)||n}function g(e){if(l(e)){e.type!==`click`&&!P(e)&&(t.clear(),w.current=!1),M();return}if(m.current.insideReactTree){M();return}let n=rt(e),r=`[${Dr(`inert`)}]`,i=k(n)?n.getRootNode():null,a=Array.from((se(i)?i:Y(u.select(`floatingElement`))).querySelectorAll(r)),o=u.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>X(e,n))))return;let s=k(n)?n:null;for(;s&&!re(s);){let e=H(s);if(re(e)||!k(e))break;s=e}if(!(a.length&&k(n)&&!at(n)&&!X(n,u.select(`floatingElement`))&&a.every(e=>!X(s,e)))){if(U(n)&&!(`touches`in e)){let t=re(n),r=D(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!d(e)){if(c()===`intentional`&&w.current){t.clear(),w.current=!1;return}typeof _==`function`&&!_(e)||N(`__outsidePressBubbles`)||(u.setOpen(!1,er(qn,e)),M())}}}function j(e){c()!==`sloppy`||e.pointerType===`touch`||!u.select(`open`)||!n||P(e)||g(e)}function F(e){if(c()!==`sloppy`||!u.select(`open`)||!n||P(e))return;let t=e.touches[0];t&&(O.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},A.start(1e3,()=>{O.current&&(O.current.dismissOnTouchEnd=!1,O.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=rt(e);if(!n)return;let r=Tr(n,e.type,()=>{t(e),r()})}function R(e){E.current=`touch`,L(e,F)}function ee(e){A.clear(),e.type===`pointerdown`&&(E.current=e.pointerType),!(e.type===`mousedown`&&O.current&&!O.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?j(e):g(e)})}function z(e){if(!S.current)return;let n=C.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!d(e)){if(n){o();return}typeof _==`function`&&!_(e)||(t.clear(),w.current=!0,M())}}}function B(e){if(c()!==`sloppy`||!O.current||P(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-O.current.startX),r=Math.abs(t.clientY-O.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(O.current.dismissOnTouchEnd=!0),i>10&&(g(e),A.clear(),O.current=null)}function V(e){L(e,B)}function te(e){c()!==`sloppy`||!O.current||P(e)||(O.current.dismissOnTouchEnd&&g(e),A.clear(),O.current=null)}function ne(e){L(e,te)}let G=Y(p),ie=wr(r&&wr(Tr(G,`keydown`,I),Tr(G,`compositionstart`,i),Tr(G,`compositionend`,a)),v&&wr(Tr(G,`click`,ee,!0),Tr(G,`pointerdown`,ee,!0),Tr(G,`pointerup`,z,!0),Tr(G,`pointercancel`,z,!0),Tr(G,`mousedown`,ee,!0),Tr(G,`mouseup`,z,!0),Tr(G,`touchstart`,R,!0),Tr(G,`touchmove`,V,!0),Tr(G,`touchend`,ne,!0)));return()=>{ie(),e.clear(),t.clear(),s(),w.current=!1}},[m,p,r,v,_,f,n,b,x,I,M,y,N,P,h,u,A]),K.useEffect(M,[_,M]);let z=K.useMemo(()=>({onKeyDown:I,[di[s]]:F,...s!==`intentional`&&{onClick:F}}),[I,F,s]),B=K.useMemo(()=>({onKeyDown:I,onPointerDown:ee,onMouseDown:ee,onClickCapture:L,onMouseDownCapture(e){L(),R(e)},onPointerDownCapture(e){L(),R(e)},onMouseUpCapture:L,onTouchEndCapture:L,onTouchMoveCapture:L}),[I,L,R,ee]);return K.useMemo(()=>n?{reference:z,floating:B,trigger:z}:{},[n,z,B])}function hi(e,t,n){let{reference:r,floating:i}=e,a=At(t),o=jt(t),s=kt(o),c=Et(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Dt(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function gi(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Tt(t,e),p=Ut(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Wt(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Wt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var _i=50,vi=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:gi},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=hi(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<_i&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=hi(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},yi=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Tt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Et(r),_=At(o),v=Et(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Vt(o)]:Nt(o)),x=p!==`none`;!d&&x&&b.push(...Bt(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Mt(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==At(t))||T.every(e=>At(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=At(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function bi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xi(e){return _t.some(t=>e[t]>=0)}var Si=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Tt(e,t);switch(i){case`referenceHidden`:{let e=bi(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:xi(e)}}}case`escaped`:{let e=bi(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:xi(e)}}}default:return{}}}}},Ci=new Set([`left`,`top`]);async function wi(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Et(n),s=Dt(n),c=At(n)===`y`,l=Ci.has(o)?-1:1,u=a&&c?-1:1,d=Tt(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Ti=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await wi(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ei=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Tt(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=At(Et(i)),p=Ot(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=wt(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=wt(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Di=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Tt(e,t),u={x:n,y:r},d=At(i),f=Ot(d),p=u[f],m=u[d],h=Tt(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ci.has(Et(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Oi=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Tt(e,t),u=await o.detectOverflow(t,l),d=Et(i),f=Dt(i),p=At(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=vt(h-u[g],v),x=vt(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=yt(u.left,0),t=yt(u.right,0),n=yt(u.top,0),r=yt(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:yt(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:yt(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function ki(e){let t=D(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=U(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=bt(n)!==a||bt(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ai(e){return k(e)?e:e.contextElement}function ji(e){let t=Ai(e);if(!U(t))return St(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ki(t),o=(a?bt(n.width):n.width)/r,s=(a?bt(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Mi=St(0);function Ni(e){let t=ne(e);return!W()||!t.visualViewport?Mi:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pi(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ne(e)?!1:t}function Fi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ai(e),o=St(1);t&&(r?k(r)&&(o=ji(r)):o=ji(e));let s=Pi(a,n,r)?Ni(a):St(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=ne(a),t=r&&k(r)?ne(r):r,n=e,i=v(n);for(;i&&r&&t!==n;){let e=ji(i),t=i.getBoundingClientRect(),r=D(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=ne(i),i=v(n)}}return Wt({width:u,height:d,x:c,y:l})}function Ii(e,t){let n=P(e).scrollLeft;return t?t.left+n:Fi(O(e)).left+n}function Li(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ii(e,n),y:n.top+t.scrollTop}}function Ri(t){let{elements:n,rect:r,offsetParent:i,strategy:a}=t,o=a===`fixed`,s=O(i),c=n?I(n.floating):!1;if(i===s||c&&o)return r;let l={scrollLeft:0,scrollTop:0},u=St(1),d=St(0),f=U(i);if((f||!f&&!o)&&((e(i)!==`body`||B(s))&&(l=P(i)),f)){let e=Fi(i);u=ji(i),d.x=e.x+i.clientLeft,d.y=e.y+i.clientTop}let p=s&&!f&&!o?Li(s,l):St(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:r.y*u.y-l.scrollTop*u.y+d.y+p.y}}function zi(e){return Array.from(e.getClientRects())}function Bi(e){let t=O(e),n=P(e),r=e.ownerDocument.body,i=yt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=yt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Ii(e),s=-n.scrollTop;return D(r).direction===`rtl`&&(o+=yt(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Vi=25;function Hi(e,t){let n=ne(e),r=O(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=W();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Ii(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Vi&&(a-=o)}else l<=Vi&&(a+=l);return{width:a,height:o,x:s,y:c}}function Ui(e,t){let n=Fi(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=U(e)?ji(e):St(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Wi(e,t,n){let r;if(t===`viewport`)r=Hi(e,n);else if(t===`document`)r=Bi(O(e));else if(k(t))r=Ui(t,n);else{let n=Ni(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Wt(r)}function Gi(e,t){let n=H(e);return n===t||!k(n)||re(n)?!1:D(n).position===`fixed`||Gi(n,t)}function Ki(t,n){let r=n.get(t);if(r)return r;let i=ae(t,[],!1).filter(t=>k(t)&&e(t)!==`body`),a=null,o=D(t).position===`fixed`,s=o?H(t):t;for(;k(s)&&!re(s);){let e=D(s),n=ee(s);!n&&e.position===`fixed`&&(a=null),(o?!n&&!a:!n&&e.position===`static`&&a&&(a.position===`absolute`||a.position===`fixed`)||B(s)&&!n&&Gi(t,s))?i=i.filter(e=>e!==s):a=e,s=H(s)}return n.set(t,i),i}function qi(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?I(t)?[]:Ki(t,this._c):[].concat(n),r],o=Wi(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Wi(t,a[e],i);s=yt(n.top,s),c=vt(n.right,c),l=vt(n.bottom,l),u=yt(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ji(e){let{width:t,height:n}=ki(e);return{width:t,height:n}}function Yi(t,n,r){let i=U(n),a=O(n),o=r===`fixed`,s=Fi(t,!0,o,n),c={scrollLeft:0,scrollTop:0},l=St(0);function u(){l.x=Ii(a)}if(i||!i&&!o)if((e(n)!==`body`||B(a))&&(c=P(n)),i){let e=Fi(n,!0,o,n);l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}else a&&u();o&&!i&&a&&u();let d=a&&!i&&!o?Li(a,c):St(0);return{x:s.left+c.scrollLeft-l.x-d.x,y:s.top+c.scrollTop-l.y-d.y,width:s.width,height:s.height}}function Xi(e){return D(e).position===`static`}function Zi(e,t){if(!U(e)||D(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return O(e)===n&&(n=n.ownerDocument.body),n}function Qi(e,t){let n=ne(e);if(I(e))return n;if(!U(e)){let t=H(e);for(;t&&!re(t);){if(k(t)&&!Xi(t))return t;t=H(t)}return n}let r=Zi(e,t);for(;r&&N(r)&&Xi(r);)r=Zi(r,t);return r&&re(r)&&Xi(r)&&!ee(r)?n:r||T(e)||n}var $i=async function(e){let t=this.getOffsetParent||Qi,n=this.getDimensions,r=await n(e.floating);return{reference:Yi(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ea(e){return D(e).direction===`rtl`}var ta={convertOffsetParentRelativeRectToViewportRelativeRect:Ri,getDocumentElement:O,getClippingRect:qi,getOffsetParent:Qi,getElementRects:$i,getClientRects:zi,getDimensions:Ji,getScale:ji,isElement:k,isRTL:ea};function na(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ra(e,t){let n=null,r,i=O(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=xt(d),h=xt(i.clientWidth-(u+f)),g=xt(i.clientHeight-(d+p)),_=xt(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:yt(0,vt(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!na(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function ia(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ai(e),u=i||a?[...l?ae(l):[],...t?ae(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?ra(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Fi(e):null;c&&g();function g(){let t=Fi(e);h&&!na(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var aa=Ti,oa=Ei,sa=yi,ca=Oi,la=Si,ua=Di,da=(e,t,n)=>{let r=new Map,i={platform:ta,...n},a={...i.platform,_c:r};return vi(e,t,{...i,platform:a})},fa=typeof document<`u`?K.useLayoutEffect:function(){};function pa(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!pa(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!pa(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ma(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ha(e,t){let n=ma(e);return Math.round(t*n)/n}function ga(e){let t=K.useRef(e);return fa(()=>{t.current=e}),t}function _a(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=K.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=K.useState(r);pa(f,r)||p(r);let[m,h]=K.useState(null),[g,_]=K.useState(null),v=K.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=K.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=K.useRef(null),C=K.useRef(null),w=K.useRef(u),T=c!=null,E=ga(c),D=ga(i),O=ga(l),k=K.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),da(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!pa(w.current,t)&&(w.current=t,xe.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);fa(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=K.useRef(!1);fa(()=>(A.current=!0,()=>{A.current=!1}),[]),fa(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=K.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=K.useMemo(()=>({reference:b,floating:x}),[b,x]),N=K.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=ha(M.floating,u.x),r=ha(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ma(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return K.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var va=(e,t)=>{let n=aa(e);return{name:n.name,fn:n.fn,options:[e,t]}},ya=(e,t)=>{let n=oa(e);return{name:n.name,fn:n.fn,options:[e,t]}},ba=(e,t)=>({fn:ua(e).fn,options:[e,t]}),xa=(e,t)=>{let n=sa(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sa=(e,t)=>{let n=ca(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ca=(e,t)=>{let n=la(e);return{name:n.name,fn:n.fn,options:[e,t]}},wa={open:Z(e=>e.open),transitionStatus:Z(e=>e.transitionStatus),domReferenceElement:Z(e=>e.domReferenceElement),referenceElement:Z(e=>e.positionReference??e.referenceElement),floatingElement:Z(e=>e.floatingElement),floatingId:Z(e=>e.floatingId)},Ta=class extends Cr{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Xr(),nested:n,triggerElements:i},wa),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&>(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}},Ea={tabIndex:-1,[Ze]:``},Da=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))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 Oa(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Pe(),o=$r()!=null,s=te(()=>new Ta({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Da,floatingId:i,syncOnly:!1,nested:o})).current;return a(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=k(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),s.update(e)},[t,i,r.reference,r.floating,s]),s.context.onOpenChange=n,s.context.nested=o,s}function ka(e={}){let{nodeId:t,externalTree:n}=e,r=Oa(e),i=e.rootContext||r,o=i.useState(`referenceElement`),s=i.useState(`floatingElement`),c=i.useState(`domReferenceElement`),l=i.useState(`open`),u=i.useState(`floatingId`),[d,f]=K.useState(null),[p,m]=K.useState(void 0),[h,g]=K.useState(void 0),_=K.useRef(null),v=ei(n),y=K.useMemo(()=>({reference:o,floating:s,domReference:c}),[o,s,c]),b=_a({...e,elements:{...y,...d&&{reference:d}}}),x=k(p)?p:null,S=h===void 0?i.state.floatingElement:h;i.useSyncedValue(`referenceElement`,p??null),i.useSyncedValue(`domReferenceElement`,p===void 0?c:x),i.useSyncedValue(`floatingElement`,S);let C=K.useCallback(e=>{let t=k(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;f(t),b.refs.setReference(t)},[b.refs]),w=K.useCallback(e=>{(k(e)||e===null)&&(_.current=e,m(e)),(k(b.refs.reference.current)||b.refs.reference.current===null||e!==null&&!k(e))&&b.refs.setReference(e)},[b.refs,m]),T=K.useCallback(e=>{g(e),b.refs.setFloating(e)},[b.refs]),E=K.useMemo(()=>({...b.refs,setReference:w,setFloating:T,setPositionReference:C,domReference:_}),[b.refs,w,T,C]),D=K.useMemo(()=>({...b.elements,domReference:c}),[b.elements,c]),O=K.useMemo(()=>({...b,dataRef:i.context.dataRef,open:l,onOpenChange:i.setOpen,events:i.context.events,floatingId:u,refs:E,elements:D,nodeId:t,rootStore:i}),[b,E,D,t,i,l,u]);return a(()=>{c&&(_.current=c)},[c]),a(()=>{i.context.dataRef.current.floatingContext=O;let e=v?.nodesRef.current.find(e=>e.id===t);e&&(e.context=O)}),K.useMemo(()=>({...b,context:O,refs:E,elements:D,rootStore:i}),[b,E,D,O,i])}var Aa=`Escape`;function ja(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Ma(e,t){return ja(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Na(e,t,n){return ja(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Pa(e,t,n){return ja(t,n?e===Qe:e===$e,e===tt)}function Fa(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===Aa:ja(t,n?e===$e:e===Qe,e===et)}function Ia(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:o=!0,selectedIndex:s=null,allowEscape:c=!1,loopFocus:l=!1,nested:u=!1,rtl:f=!1,virtual:p=!1,focusItemOnOpen:m=`auto`,focusItemOnHover:h=!0,openOnArrowKeyDown:g=!0,disabledIndices:_=void 0,orientation:v=`vertical`,parentOrientation:y,cols:b=1,id:x,resetOnPointerLeave:S=!0,externalTree:C}=t,w=`rootStore`in e?e.rootStore:e,T=w.useState(`open`),E=w.useState(`floatingElement`),D=w.useState(`domReferenceElement`),O=w.context.dataRef,k=ct(E),A=st(D),j=or(k),M=$r(),N=ei(C),P=K.useRef(m),F=K.useRef(s??-1),I=K.useRef(null),L=K.useRef(!0),R=d(e=>{i(F.current===-1?null:F.current,e)}),ee=K.useRef(R),z=K.useRef(!!E),B=K.useRef(T),V=K.useRef(!1),H=K.useRef(!1),W=K.useRef(null),te=or(_),ne=or(T),G=or(s),re=or(S),ie=Pn(),ae=Pn(),oe=d(()=>{function e(e){p?N?.events.emit(`virtualfocus`,e):W.current=kr(e,{sync:V.current,preventScroll:!0})}let t=n.current[F.current],r=H.current;t&&e(t),(V.current?e=>e():e=>ie.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),fe&&(r||!L.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});a(()=>{O.current.orientation=v},[O,v]),a(()=>{o&&(T&&E?(F.current=s??-1,P.current&&s!=null&&(H.current=!0,R())):z.current&&(F.current=-1,ee.current()))},[o,T,E,s,R]),a(()=>{if(o){if(!T){V.current=!1;return}if(E)if(r==null){if(V.current=!1,G.current!=null)return;if(z.current&&(F.current=-1,oe()),(!B.current||!z.current)&&P.current&&(I.current!=null||P.current===!0&&I.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ae.request(e):queueMicrotask)(t),e+=1):(F.current=I.current==null||Na(I.current,v,f)||u?qt(n):Jt(n),I.current=null,R())};t()}}else Kt(n.current,r)||(F.current=r,oe(),H.current=!1)}},[o,T,E,r,G,u,n,v,f,R,oe,ae]),a(()=>{if(!o||E||!N||p||!z.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=nt(Y(E)),r=e.some(e=>e.context&&X(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[o,E,N,M,p]),a(()=>{ee.current=R,B.current=T,z.current=!!E}),a(()=>{T||(I.current=null,P.current=m)},[T,m]);let se=r!=null,ce=d(e=>{if(!ne.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,R(e))}),le=d(()=>y??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation),ue=d(()=>qt(n,te.current)),de=d(e=>{if(L.current=!1,V.current=!0,e.which===229||!ne.current&&e.currentTarget===j.current)return;if(u&&Fa(e.key,v,f,b)){Ma(e.key,le())||dt(e),w.setOpen(!1,er(Zn,e.nativeEvent)),U(D)&&(p?N?.events.emit(`virtualfocus`,D):D.focus());return}let t=F.current,r=qt(n,_),i=Jt(n,_);if(A||(e.key===`Home`&&(dt(e),F.current=r,R(e)),e.key===`End`&&(dt(e),F.current=i,R(e))),b>1){let t=Array.from({length:n.current.length},()=>({width:1,height:1})),a=Zt(t,b,!1),o=a.findIndex(e=>e!=null&&!en(n.current,e,_)),s=a.reduce((e,t,r)=>t!=null&&!en(n.current,t,_)?r:e,-1),c=a[Xt(a.map(e=>e==null?null:n.current[e]),{event:e,orientation:v,loopFocus:l,rtl:f,cols:b,disabledIndices:$t([...(typeof _==`function`?null:_)||n.current.map((e,t)=>en(n.current,t,_)?t:void 0),void 0],a),minIndex:o,maxIndex:s,prevIndex:Qt(F.current>i?r:F.current,t,a,b,e.key===`ArrowDown`?`bl`:e.key===(f?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(F.current=c,R(e)),v===`both`)return}if(Ma(e.key,v)){if(dt(e),T&&!p&&nt(e.currentTarget.ownerDocument)===e.currentTarget){F.current=Na(e.key,v,f)?r:i,R(e);return}Na(e.key,v,f)?l?t>=i?c&&t!==n.current.length?F.current=-1:(V.current=!1,F.current=r):F.current=Yt(n.current,{startingIndex:t,disabledIndices:_}):F.current=Math.min(i,Yt(n.current,{startingIndex:t,disabledIndices:_})):l?t<=r?c&&t!==-1?F.current=n.current.length:(V.current=!1,F.current=i):F.current=Yt(n.current,{startingIndex:t,decrement:!0,disabledIndices:_}):F.current=Math.max(r,Yt(n.current,{startingIndex:t,decrement:!0,disabledIndices:_})),Kt(n.current,F.current)&&(F.current=-1),R(e)}}),fe=K.useMemo(()=>({onFocus(e){V.current=!0,ce(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){V.current=!0,H.current=!1,h&&ce(e)},onPointerLeave(e){if(!ne.current||!L.current||e.pointerType===`touch`)return;V.current=!0;let t=e.relatedTarget;if(!(!h||n.current.includes(t))&&re.current&&(W.current?.(),W.current=null,F.current=-1,R(e),!p)){let e=j.current,t=nt(Y(e));e&&X(e,t)&&e.focus({preventScroll:!0})}}}),[ce,ne,j,h,n,R,re,p]),pe=K.useMemo(()=>p&&T&&se&&{"aria-activedescendant":`${x}-${r}`},[p,T,se,x,r]),me=K.useMemo(()=>({"aria-orientation":v===`both`?void 0:v,...A?{}:pe,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&T&&!p){let t=rt(e.nativeEvent);if(t&&!X(j.current,t))return;dt(e),w.setOpen(!1,er(Yn,e.nativeEvent)),U(D)&&D.focus();return}de(e)},onPointerMove(){L.current=!0}}),[pe,de,j,v,A,w,T,p,D]),he=K.useMemo(()=>{function e(e){w.setOpen(!0,er(Zn,e.nativeEvent,e.currentTarget))}function t(e){m===`auto`&&pt(e.nativeEvent)&&(P.current=!p)}function n(e){P.current=m,m===`auto`&&mt(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(t){let n=w.select(`open`);L.current=!1;let r=t.key.startsWith(`Arrow`),i=Pa(t.key,le(),f),a=Ma(t.key,v),o=(u?i:a)||t.key===`Enter`||t.key.trim()===``;if(p&&n)return de(t);if(!(!n&&!g&&r)){if(o){let e=Ma(t.key,le());I.current=u&&e?null:t.key}if(u){i&&(dt(t),n?(F.current=ue(),R(t)):e(t));return}a&&(G.current!=null&&(F.current=G.current),dt(t),!n&&g?e(t):de(t),n&&R(t))}},onFocus(e){w.select(`open`)&&!p&&(F.current=-1,R(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[de,m,ue,u,R,w,g,v,le,f,G,p]),ge=K.useMemo(()=>({...pe,...he}),[pe,he]);return K.useMemo(()=>o?{reference:ge,floating:me,item:fe,trigger:he}:{},[o,ge,me,he,fe])}function La(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,f=`rootStore`in e?e.rootStore:e,p=f.useState(`open`),m=An(),h=K.useRef(``),g=K.useRef(u??i??-1),_=K.useRef(null),v=d(e=>{function t(e){let t=r?.current[e];return!t||nn(t)}function a(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let c=n.current;if(h.current.length>0&&e.key===` `&&(dt(e),s?.(!0)),h.current.length>0&&h.current[0]!==` `&&a(c,h.current)===-1&&e.key!==` `&&s?.(!1),c==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;p&&e.key!==` `&&(dt(e),s?.(!0));let d=h.current===``;d&&(g.current=u??i??-1),c.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&h.current===e.key&&(h.current=``,g.current=_.current),h.current+=e.key,m.start(l,()=>{h.current=``,g.current=_.current,s?.(!1)});let f=((d?u??i??-1:g.current)??0)+1,v=a(c,h.current,f);v===-1?e.key!==` `&&(h.current=``,s?.(!1)):(o?.(v),_.current=v)}),y=d(e=>{let t=e.relatedTarget,n=f.select(`domReferenceElement`),r=f.select(`floatingElement`);X(n,t)||X(r,t)||(m.clear(),h.current=``,g.current=_.current,s?.(!1))});a(()=>{!p&&u!==null||(m.clear(),_.current=null,h.current!==``&&(h.current=``))},[p,u,m]),a(()=>{p&&h.current===``&&(g.current=u??i??-1)},[p,u,i]);let b=K.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return K.useMemo(()=>c?{reference:b,floating:b}:{},[c,b])}var Ra=K.createContext(null),za=K.createContext(null);function Ba(){let e=K.useContext(Ra);if(e===null)throw Error(x(60));return e}function Va(){let e=K.useContext(za);if(e===null)throw Error(x(61));return e}var Ha=(e,t)=>Object.is(e,t);function Ua(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Wa(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:Ua(t,e,n))}function Ga(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:Ua(e,t,n))}function Ka(e,t,n){return e.filter(e=>!Ua(t,e,n))}function qa(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Ja(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Ya(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Ja(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Xa(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return qa(e)}function Za(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?qa(e.value):qa(e)}function Qa(e,t,n){function r(){return Xa(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=Ja(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function $a(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,q.jsx)(K.Fragment,{children:Qa(r,t,n)},i)),e),[])}var $={id:Z(e=>e.id),labelId:Z(e=>e.labelId),modal:Z(e=>e.modal),multiple:Z(e=>e.multiple),items:Z(e=>e.items),itemToStringLabel:Z(e=>e.itemToStringLabel),itemToStringValue:Z(e=>e.itemToStringValue),isItemEqualToValue:Z(e=>e.isItemEqualToValue),value:Z(e=>e.value),hasSelectedValue:Z(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Za(t,r)!==``}),hasNullItemLabel:Z((e,t)=>t?Ya(e.items):!1),open:Z(e=>e.open),mounted:Z(e=>e.mounted),forceMount:Z(e=>e.forceMount),transitionStatus:Z(e=>e.transitionStatus),openMethod:Z(e=>e.openMethod),activeIndex:Z(e=>e.activeIndex),selectedIndex:Z(e=>e.selectedIndex),isActive:Z((e,t)=>e.activeIndex===t),isSelected:Z((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>Ua(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Ua(n,i,r)}),isSelectedByFocus:Z((e,t)=>e.selectedIndex===t),popupProps:Z(e=>e.popupProps),triggerProps:Z(e=>e.triggerProps),triggerElement:Z(e=>e.triggerElement),positionerElement:Z(e=>e.positionerElement),listElement:Z(e=>e.listElement),popupSide:Z(e=>e.popupSide),scrollUpArrowVisible:Z(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Z(e=>e.scrollDownArrowVisible),hasScrollArrows:Z(e=>e.hasScrollArrows)};function eo(e,t){let n=K.useRef(e),r=d(t);a(()=>{n.current!==e&&r(n.current)},[e,r]),a(()=>{n.current=e},[e])}function to(e){let t=K.useRef(``),n=K.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:K.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function no(e,t){let{onClick:n,onPointerDown:r}=to(d((n,r)=>{(typeof e==`function`?e():e)||t(r||(We?`touch`:``))}));return K.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function ro(e){let[t,n]=K.useState(null),r=no(e,n);return eo(e,t=>{t&&!e&&n(null)}),K.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function io(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function ao(e,t){return Math.max(0,e-t)}function oo(e,t){if(t<=0)return 0;let n=io(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function so(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:o,defaultOpen:s=!1,onOpenChange:c,name:l,form:u,autoComplete:f,disabled:m=!1,readOnly:h=!1,required:g=!1,modal:_=!0,actionsRef:v,inputRef:b,onOpenChangeComplete:x,items:w,multiple:T=!1,itemToStringLabel:E,itemToStringValue:D,isItemEqualToValue:O=Ha,highlightItemOnHover:k=!0,children:A}=e,{clearErrors:j}=Ae(),{setDirty:M,setTouched:N,setFocused:P,shouldValidateOnChange:F,validityData:I,setFilled:L,name:R,disabled:ee,validation:z,validationMode:B}=Oe(),V=Re({id:t}),H=ee||m,U=R??l,[W,ne]=Un({controlled:n,default:T?r??p:r,name:`Select`,state:`value`}),[G,re]=Un({controlled:o,default:s,name:`Select`,state:`open`}),ie=K.useRef([]),ae=K.useRef([]),oe=K.useRef(null),se=K.useRef(null),ce=K.useRef(0),le=K.useRef(null),ue=K.useRef([]),de=K.useRef(!1),fe=K.useRef(!1),pe=K.useRef(null),me=K.useRef(null),he=K.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ge=K.useRef(!1),{mounted:_e,setMounted:ve,transitionStatus:ye}=Hn(G),{openMethod:be,triggerProps:xe}=ro(G),J=te(()=>new Sr({id:V,labelId:void 0,modal:_,multiple:T,itemToStringLabel:E,itemToStringValue:D,isItemEqualToValue:O,value:W,open:G,mounted:_e,transitionStatus:ye,items:w,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Se=Q(J,$.activeIndex),Ce=Q(J,$.selectedIndex),we=Q(J,$.triggerElement),Te=Q(J,$.positionerElement),Ee=ar(be),De=be??Ee,ke=K.useMemo(()=>T&&Array.isArray(W)&&W.length===0?``:Za(W,D),[T,W,D]),je=K.useMemo(()=>T&&Array.isArray(W)?W.map(e=>Za(e,D)):Za(W,D),[T,W,D]);Wn(or(J.state.triggerElement),V,W,d(()=>je));let Me=K.useRef(W),Ne=T?Array.isArray(W)&&W.length>0:W!=null;a(()=>{W!==Me.current&&J.set(`forceMount`,!0)},[J,W]),a(()=>{L(Ne)},[Ne,L]),a(function(){let e=ue.current,t;if(T){let n=Array.isArray(W)?W:[];if(n.length===0)t=null;else{let r=n[n.length-1],i=Ga(e,r,O);t=i===-1?null:i}}else{let n=Ga(e,W,O);t=n===-1?null:n}t===null&&(me.current=null),!G&&J.set(`selectedIndex`,t)},[Ne,T,G,W,ue,O,J,me]),eo(W,()=>{j(U),M(W!==I.initialValue),F()?z.commit(W):z.commit(W,!0)});let Pe=d((e,t)=>{if(c?.(e,t),!t.isCanceled&&(re(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(N(!0),P(!1),B===`onBlur`&&z.commit(W)),!e&&J.state.activeIndex!==null)){let e=ie.current[J.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Fe=d(()=>{ve(!1),J.update({activeIndex:null,openMethod:null}),x?.(!1)});Vn({enabled:!v,open:G,ref:oe,onComplete(){G||Fe()}}),K.useImperativeHandle(v,()=>({unmount:Fe}),[Fe]);let Ie=d((e,t)=>{i?.(e,t),!t.isCanceled&&ne(e)}),Le=d(()=>{let e=J.state.listElement||oe.current;if(!e)return;let t=ao(e.scrollHeight,e.clientHeight),n=oo(e.scrollTop,t),r=n>0,i=n<t;J.state.scrollUpArrowVisible!==r&&J.set(`scrollUpArrowVisible`,r),J.state.scrollDownArrowVisible!==i&&J.set(`scrollDownArrowVisible`,i)}),Y=Oa({open:G,onOpenChange:Pe,elements:{reference:we,floating:Te}}),ze=ui(Y,{enabled:!h&&!H,event:`mousedown`}),Be=mi(Y),Ve=Ia(Y,{enabled:!h&&!H,listRef:ie,activeIndex:Se,selectedIndex:Ce,disabledIndices:p,onNavigate(e){e===null&&!G||J.set(`activeIndex`,e)},focusItemOnHover:k}),He=La(Y,{enabled:!h&&!H&&(G||!T),listRef:ae,activeIndex:Se,selectedIndex:Ce,onMatch(e){G?J.set(`activeIndex`,e):Ie(ue.current[e],er(`none`))},onTyping(e){de.current=e}}),Ue=K.useMemo(()=>{let e=C(He.reference,Ve.reference,Be.reference,ze.reference,xe);return V&&(e.id=V),e},[ze.reference,He.reference,Ve.reference,Be.reference,xe,V]),We=K.useMemo(()=>C(Ea,He.floating,Ve.floating,Be.floating),[He.floating,Ve.floating,Be.floating]),Ge=Ve.item??y;ir(()=>{J.update({popupProps:We,triggerProps:Ue})}),a(()=>{J.update({id:V,modal:_,multiple:T,value:W,open:G,mounted:_e,transitionStatus:ye,popupProps:We,triggerProps:Ue,items:w,itemToStringLabel:E,itemToStringValue:D,isItemEqualToValue:O,openMethod:De})},[J,V,_,T,W,G,_e,ye,We,Ue,w,E,D,O,De]);let Ke=K.useMemo(()=>({store:J,name:U,required:g,disabled:H,readOnly:h,multiple:T,highlightItemOnHover:k,setValue:Ie,setOpen:Pe,listRef:ie,popupRef:oe,scrollHandlerRef:se,handleScrollArrowVisibility:Le,scrollArrowsMountedCountRef:ce,itemProps:Ge,events:Y.context.events,valueRef:le,valuesRef:ue,labelsRef:ae,typingRef:de,selectionRef:he,firstItemTextRef:pe,selectedItemTextRef:me,validation:z,onOpenChangeComplete:x,keyboardActiveRef:fe,alignItemWithTriggerActiveRef:ge,initialValueRef:Me}),[J,U,g,H,h,T,k,Ie,Pe,Ge,Y.context.events,z,x,Le]),qe=S(b,z.inputRef),Je=T&&Array.isArray(W)&&W.length>0,Ye=T?void 0:U,Xe=K.useMemo(()=>!T||!Array.isArray(W)||!U?null:W.map(e=>{let t=Za(e,D);return(0,q.jsx)(`input`,{type:`hidden`,form:u,name:U,value:t},t)}),[T,W,u,U,D]);return(0,q.jsx)(Ra.Provider,{value:Ke,children:(0,q.jsxs)(za.Provider,{value:Y,children:[A,(0,q.jsx)(`input`,{...z.getInputValidationProps({onFocus(){J.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||H||h){e.preventBaseUIHandler?.();return}let t=e.currentTarget.value,n=er(Gn,e.nativeEvent);function r(){if(T)return;let e=ue.current.find(e=>Za(e,D).toLowerCase()===t.toLowerCase()||Xa(e,E).toLowerCase()===t.toLowerCase());e!=null&&(M(e!==I.initialValue),Ie(e,n),F()&&z.commit(e))}J.set(`forceMount`,!0),queueMicrotask(r)}}),id:V&&Ye==null?`${V}-hidden-input`:void 0,form:u,name:Ye,autoComplete:f,value:ke,disabled:H,required:g&&!Je,readOnly:h,ref:qe,style:U?rr:nr,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Xe]})})}function co(e,t){return e??t}var lo=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=In.startingStyle]=`startingStyle`,e[e.endingStyle=In.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),uo=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),fo={[uo.popupOpen]:``},po={[uo.popupOpen]:``,[uo.pressed]:``},mo={[lo.open]:``},ho={[lo.closed]:``},go={[lo.anchorHidden]:``},_o={open(e){return e?fo:null}},vo={open(e){return e?po:null}},yo={open(e){return e?mo:ho},anchorHidden(e){return e?go:null}};function bo(e){let t=e.getBoundingClientRect(),n=ne(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var xo=2,So=400,Co={...vo,...Te,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},wo=K.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:s=!0,style:l,...u}=e,{setTouched:f,setFocused:p,validationMode:m,state:h,disabled:g}=Oe(),{labelId:_}=Le(),{store:v,setOpen:y,selectionRef:b,validation:x,readOnly:w,required:T,alignItemWithTriggerActiveRef:E,disabled:D,keyboardActiveRef:O}=Ba(),k=g||D||a,A=Q(v,$.open),j=Q(v,$.mounted),M=Q(v,$.value),N=Q(v,$.triggerProps),P=Q(v,$.positionerElement),F=Q(v,$.listElement),I=Q(v,$.popupSide),L=Q(v,$.id),R=Q(v,$.labelId),ee=Q(v,$.hasSelectedValue),z=j&&P?I:null,B=i??L,V=co(_,R);Re({id:B});let H=or(P),U=K.useRef(null),{getButtonProps:W,buttonRef:te}=o({disabled:k,native:s}),ne=S(t,U,te,d(e=>{v.set(`triggerElement`,e)})),G=An(),re=An(),ie=An();K.useEffect(()=>{if(A)return ie.start(So,()=>{b.current.allowUnselectedMouseUp=!0,b.current.allowSelectedMouseUp=!0}),()=>{ie.clear()};b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},re.clear()},[A,b,re,ie]);let ae=C(N,{id:B,role:`combobox`,"aria-expanded":A?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":A?F?.id??ct(P)?.id:void 0,"aria-labelledby":V,"aria-readonly":w||void 0,"aria-required":T||void 0,tabIndex:k?-1:0,ref:ne,onFocus(e){p(!0),A&&E.current&&y(!1,er(Gn,e.nativeEvent)),G.start(0,()=>{v.set(`forceMount`,!0)})},onBlur(e){X(P,e.relatedTarget)||(f(!0),p(!1),m===`onBlur`&&x.commit(M))},onPointerMove(){O.current=!1},onKeyDown(){O.current=!0},onMouseDown(e){if(A)return;let t=Y(e.currentTarget);function n(e){if(!U.current)return;let t=e.target;if(X(U.current,t)||X(H.current,t)||t===U.current)return;let n=bo(U.current);e.clientX>=n.left-xo&&e.clientX<=n.right+xo&&e.clientY>=n.top-xo&&e.clientY<=n.bottom+xo||y(!1,er(Qn,e))}re.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},x.getValidationProps,u,W);ae.role=`combobox`;let oe={...h,open:A,disabled:k,value:M,readOnly:w,popupSide:z,placeholder:!ee};return c(`button`,e,{ref:[t,U],state:oe,stateAttributesMapping:Co,props:ae})}),To={value:()=>null},Eo=K.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:l,valueRef:u}=Ba(),d=Q(l,$.value),f=Q(l,$.items),p=Q(l,$.itemToStringLabel),m=Q(l,$.hasSelectedValue),h=!m&&a!=null&&i==null,g=Q(l,$.hasNullItemLabel,h),_={value:d,placeholder:!m},v=null;return v=typeof i==`function`?i(d):i??(!m&&a!=null&&!g?a:Array.isArray(d)?$a(d,f,p):Qa(d,f,p)),c(`span`,e,{state:_,ref:[t,u],props:[{children:v},s],stateAttributesMapping:To})}),Do=K.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Ba();return c(`span`,e,{state:{open:Q(o,$.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:_o})}),Oo=K.createContext(void 0),ko=K.forwardRef(function(e,t){let{store:n}=Ba(),r=Q(n,$.mounted),i=Q(n,$.forceMount);return r||i?(0,q.jsx)(Oo.Provider,{value:!0,children:(0,q.jsx)(Yr,{ref:t,...e})}):null});function Ao(e){return n(19)?e:e?`true`:void 0}var jo=K.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Mo(){return K.useContext(jo)}function No(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,o=d(i),s=K.useRef(0),c=te(Fo).current,l=te(Po).current,[u,f]=K.useState(0),p=K.useRef(u),m=d((e,t)=>{l.set(e,t??null),p.current+=1,f(p.current)}),h=d(e=>{l.delete(e),p.current+=1,f(p.current)}),g=K.useMemo(()=>{let e=new Map;return Array.from(l.keys()).filter(e=>e.isConnected).sort(Io).forEach((t,n)=>{let r=l.get(t)??{};e.set(t,{...r,index:n})}),e},[l,u]);a(()=>{if(typeof MutationObserver!=`function`||g.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(p.current+=1,f(p.current))});return g.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[g]),a(()=>{p.current===u&&(n.current.length!==g.size&&(n.current.length=g.size),r&&r.current.length!==g.size&&(r.current.length=g.size),s.current=g.size),o(g)},[o,g,n,r,u]),a(()=>()=>{n.current=[]},[n]),a(()=>()=>{r&&(r.current=[])},[r]);let _=d(e=>(c.add(e),()=>{c.delete(e)}));a(()=>{c.forEach(e=>e(g))},[c,g]);let v=K.useMemo(()=>({register:m,unregister:h,subscribeMapChange:_,elementsRef:n,labelsRef:r,nextIndexRef:s}),[m,h,_,n,r,s]);return(0,q.jsx)(jo.Provider,{value:v,children:t})}function Po(){return new Map}function Fo(){return new Set}function Io(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var Lo=K.createContext(void 0);function Ro(){return K.useContext(Lo)?.direction??`ltr`}var zo=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=Tt(e,t)||{};if(l==null)return{};let f=Ut(u),p={x:n,y:r},m=jt(i),h=kt(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=wt(k,j,A),N=!c.arrow&&Dt(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),Bo=(e,t)=>({...zo(e),options:[e,t]}),Vo={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await Ca().fn(e)).data?.referenceHidden||a}}}},Ho={sideX:`left`,sideY:`top`};function Uo(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function Wo(e,t,n){let{rects:r,placement:i}=e;return{side:Uo(t,Et(i),n),align:Dt(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Go(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:f=5,disableAnchorTracking:p=!1,inline:m,keepMounted:h=!1,floatingRootContext:g,mounted:_,collisionAvoidance:v,shiftCrossAxis:y=!1,nodeId:b,adaptiveOrigin:x,lazyFlip:S=!1,externalTree:C}=e,[w,T]=K.useState(null);!_&&w!==null&&T(null);let E=v.side||`flip`,D=v.align||`flip`,O=v.fallbackAxisSide||`end`,k=typeof t==`function`?t:void 0,A=d(k),j=k?A:t,M=or(t),N=or(_),P=Ro()===`rtl`,F=w||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":P?`left`:`right`,"inline-start":P?`right`:`left`}[r],I=o===`center`?F:`${F}-${o}`,L=l,R=+(r===`bottom`),ee=+(r===`top`),z=+(r===`right`),B=+(r===`left`);typeof L==`number`?L={top:L+R,right:L+B,bottom:L+ee,left:L+z}:L&&={top:(L.top||0)+R,right:(L.right||0)+B,bottom:(L.bottom||0)+ee,left:(L.left||0)+z};let V={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:L},H=K.useRef(null),U=or(i),W=or(s),te=typeof i==`function`?0:i,G=typeof s==`function`?0:s,re=[];m&&re.push(m),re.push(va(e=>{let t=Wo(e,r,P),n=typeof U.current==`function`?U.current(t):U.current,i=typeof W.current==`function`?W.current(t):W.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[te,G,P,r]));let ie=D===`none`&&E!==`shift`,ae=!ie&&(u||y||E===`shift`),oe=E===`none`?null:xa({...V,padding:{top:L.top+1,right:L.right+1,bottom:L.bottom+1,left:L.left+1},mainAxis:!y&&E===`flip`,crossAxis:D===`flip`?`alignment`:!1,fallbackAxisSideDirection:O}),se=ie?null:ya(e=>{let t=Y(e.elements.floating).documentElement;return{...V,rootBoundary:y?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:D!==`none`,crossAxis:ae,limiter:u||y?void 0:ba(e=>{if(!H.current)return{};let{width:t,height:n}=H.current.getBoundingClientRect(),r=At(Et(e.placement)),i=r===`y`?t:n,a=r===`y`?L.left+L.right:L.top+L.bottom;return{offset:i/2+a/2}})}},[V,u,y,L,D]);E===`shift`||D===`shift`||o===`center`?re.push(se,oe):re.push(oe,se),re.push(Sa({...V,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!N.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=ne(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),Bo(e=>({element:H.current||Y(e.elements.floating).createElement(`div`),padding:f,offsetParent:`floating`}),[f]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=Et(a),l=At(c),u=H.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(Wo(e,r,P)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ae&&l===`y`&&b?S:x),{}}},Vo,x),a(()=>{!_&&g&&g.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[_,g]);let ce=K.useMemo(()=>({elementResize:!p&&typeof ResizeObserver<`u`,layoutShift:!p&&typeof IntersectionObserver<`u`}),[p]),{refs:le,elements:ue,x:de,y:fe,middlewareData:pe,update:me,placement:he,context:ge,isPositioned:_e,floatingStyles:ve}=ka({rootContext:g,open:h?_:void 0,placement:I,middleware:re,strategy:n,whileElementsMounted:h?void 0:(...e)=>ia(...e,ce),nodeId:b,externalTree:C}),{sideX:ye,sideY:be}=pe.adaptiveOrigin||Ho,xe=_e?n:`fixed`,q=K.useMemo(()=>{let e=x?{position:xe,[ye]:de,[be]:fe}:{position:xe,...ve};return _e||(e.opacity=0),e},[x,xe,ye,de,be,fe,ve,_e]),J=K.useRef(null);a(()=>{if(!_)return;let e=M.current,t=typeof e==`function`?e():e,n=(Ko(t)?t.current:t)||null;n!==J.current&&(le.setPositionReference(n),J.current=n)},[_,le,j,M]),K.useEffect(()=>{if(!_)return;let e=M.current;typeof e!=`function`&&Ko(e)&&e.current!==J.current&&(le.setPositionReference(e.current),J.current=e.current)},[_,le,j,M]),K.useEffect(()=>{if(h&&_&&ue.domReference&&ue.floating)return ia(ue.domReference,ue.floating,me,ce)},[h,_,ue,me,ce]);let Se=Et(he),Ce=Uo(r,Se,P),we=Dt(he)||`center`,Te=!!pe.hide?.referenceHidden;a(()=>{S&&_&&_e&&T(Se)},[S,_,_e,Se]);let Ee=K.useMemo(()=>({position:`absolute`,top:pe.arrow?.y,left:pe.arrow?.x}),[pe.arrow]),De=pe.arrow?.centerOffset!==0;return K.useMemo(()=>({positionerStyles:q,arrowStyles:Ee,arrowRef:H,arrowUncentered:De,side:Ce,align:we,physicalSide:Se,anchorHidden:Te,refs:le,context:ge,isPositioned:_e,update:me}),[q,Ee,H,De,Ce,we,Se,Te,le,ge,_e,me])}function Ko(e){return e!=null&&`current`in e}var qo=K.createContext(void 0);function Jo(){let e=K.useContext(qo);if(!e)throw Error(x(59));return e}var Yo=K.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function Xo(e,t){e&&Object.assign(e.style,t)}var Zo={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function Qo(e){return e===`starting`?Hr:y}function $o(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let l={...n};return s&&(l.pointerEvents=`none`),c(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:l},Qo(r),i],stateAttributesMapping:yo})}var es={},ts={},ns=``;function rs(e){if(typeof document>`u`)return!1;let t=Y(e);return ne(t).innerWidth-t.documentElement.clientWidth>0}function is(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Y(e),n=t.documentElement,r=t.body,i=B(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function as(e){let t=Y(e),n=t.documentElement,r=t.body,i=B(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function os(e){let t=Y(e),n=t.documentElement,r=t.body,i=ne(n),a=0,o=0,s=!1,c=Nn.create();if(Ue&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,es={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},ns=n.style.scrollBehavior,ts={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=B(n)?n:r;if(s=is(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,es),Object.assign(r.style,ts),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=ns)}function d(){u(),c.request(l)}l();let f=Tr(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var ss=new class{lockCount=0;restore=null;timeoutLock=kn.create();timeoutUnlock=kn.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Y(e).documentElement,n=ne(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=ce;return}let r=We||!rs(e);this.restore=r?as(e):os(e)}};function cs(e=!0,t=null){a(()=>{if(e)return ss.acquire(t)},[e,t])}var ls=20;function us(e,t,n,r){let[i,o]=K.useState(!1);a(()=>{if(!e||!t||n==null){o(!1);return}let r=Y(n).documentElement.clientWidth,i=n.offsetWidth;o(r>0&&i>0&&i>=r-ls)},[e,t,n]),cs(e&&(!t||i),r)}var ds={position:`fixed`},fs=K.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:o,side:s=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:f=`clipping-ancestors`,collisionPadding:p,arrowPadding:m=5,sticky:h=!1,disableAnchorTracking:g,alignItemWithTrigger:_=!0,collisionAvoidance:v=Ur,style:y,...b}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=Ba(),A=Va(),j=Q(x,$.open),M=Q(x,$.mounted),N=Q(x,$.modal),P=Q(x,$.value),F=Q(x,$.openMethod),I=Q(x,$.positionerElement),L=Q(x,$.triggerElement),R=Q(x,$.isItemEqualToValue),ee=Q(x,$.transitionStatus),z=K.useRef(null),B=K.useRef(null),[V,H]=K.useState(_),U=M&&V&&F!==`touch`;!M&&V!==_&&H(_),a(()=>{M||($.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),$.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),K.useImperativeHandle(w,()=>U),us((U||N)&&j,F===`touch`,I,L);let W=Go({anchor:n,floatingRootContext:A,positionMethod:r,mounted:M,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:m,collisionBoundary:f,collisionPadding:p,sticky:h,disableAnchorTracking:g??U,collisionAvoidance:v,keepMounted:!0}),te=U?`none`:W.side,ne=U?ds:W.positionerStyles,G={open:j,side:te,align:W.align,anchorHidden:W.anchorHidden};a(()=>{x.set(`popupSide`,W.side)},[x,W.side]);let re=$o(e,G,{styles:ne,transitionStatus:ee,props:b,refs:[t,d(e=>{x.set(`positionerElement`,e)})],hidden:!M,inert:!j}),ie=K.useRef(0),ae=d(e=>{if(e.size===0&&ie.current===0||E.current.length===0)return;let t=ie.current;if(ie.current=e.size,e.size===t)return;let n=er(Gn);if(t!==0&&!x.state.multiple&&P!==null&&Ga(E.current,P,R)===-1){let e=D.current,t=e!=null&&Ga(E.current,e,R)!==-1?e:null;k(t,n),t===null&&(x.set(`selectedIndex`,null),T.current=null)}if(t!==0&&x.state.multiple&&Array.isArray(P)){let e=e=>Ga(E.current,e,R)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!Wa(P,e,R)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&U){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};Xo(I,e),Xo(O.current,e)}}),oe=K.useMemo(()=>({...W,side:te,alignItemWithTriggerActive:U,setControlledAlignItemWithTrigger:H,scrollUpArrowRef:z,scrollDownArrowRef:B}),[W,te,U,H]);return(0,q.jsx)(No,{elementsRef:S,labelsRef:C,onMapChange:ae,children:(0,q.jsxs)(qo.Provider,{value:oe,children:[M&&N&&(0,q.jsx)(Yo,{inert:Ao(!j),cutout:L}),re]})})}),ps=`base-ui-disable-scrollbar`,ms={className:ps,getElement(e){return(0,q.jsx)(`style`,{nonce:e,href:ps,precedence:`base-ui:low`,children:`.${ps}{scrollbar-width:none}.${ps}::-webkit-scrollbar{display:none}`})}},hs=K.createContext(void 0);function gs(e){let t=K.useContext(hs);if(t===void 0&&!e)throw Error(x(69));return t}var _s=`ArrowUp`,vs=`ArrowDown`,ys=`ArrowLeft`,bs=`ArrowRight`,xs=`Home`,Ss=new Set([ys,bs]),Cs=new Set([_s,vs]),ws=new Set([...Ss,...Cs]),Ts=new Set([...ws,xs,`End`]),Es=K.createContext(void 0),Ds={disableStyleElements:!1};function Os(){return K.useContext(Es)??Ds}var ks={...yo,...zn},As=K.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:o,...s}=e,{store:l,popupRef:u,onOpenChangeComplete:f,setOpen:p,valueRef:m,firstItemTextRef:h,selectedItemTextRef:g,keyboardActiveRef:_,multiple:v,handleScrollArrowVisibility:y,scrollHandlerRef:b,listRef:x,highlightItemOnHover:S}=Ba(),{side:C,align:w,alignItemWithTriggerActive:T,isPositioned:E,setControlledAlignItemWithTrigger:D,scrollDownArrowRef:O,scrollUpArrowRef:k}=Jo(),A=gs(!0)!=null,j=Va(),M=Ro(),{nonce:N,disableStyleElements:P}=Os(),F=Q(l,$.id),I=Q(l,$.open),L=Q(l,$.mounted),R=Q(l,$.popupProps),ee=Q(l,$.transitionStatus),z=Q(l,$.triggerElement),B=Q(l,$.positionerElement),V=Q(l,$.listElement),H=K.useRef(!1),U=K.useRef(!1),W=K.useRef({}),te=Pn(),G=d(e=>{if(!B||!u.current||!U.current)return;if(H.current||!T){y();return}let t=B.style.top===`0px`,n=B.style.bottom===`0px`;if(!t&&!n){y();return}let r=Ns(B),i=Ps(B.getBoundingClientRect().height,`y`,r),a=Y(B),o=getComputedStyle(B),s=parseFloat(o.marginTop),c=parseFloat(o.marginBottom),l=js(getComputedStyle(u.current)),d=Math.min(a.documentElement.clientHeight-s-c,l),f=e.scrollTop,p=Ms(e),m=0,h=null,g=!1,_=!1,v=e=>{B.style.height=`${e}px`},b=(t,n)=>{let r=io(t,0,d-i);r>0&&v(i+r),e.scrollTop=n,d-(i+r)<=1&&(H.current=!0),y()},x=t?p-f:f,S=Math.min(i+x,d);if(m=S,x<=1){b(x,t?p:0);return}if(d-S>1?t?_=!0:h=0:(g=!0,n&&f<p&&(h=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&v(m),_||h!=null){let t=Ms(e),n=_?t:io(h,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(g||m>=d-1)&&(H.current=!0),y()});K.useImperativeHandle(b,()=>G,[G]),Vn({open:I,ref:u,onComplete(){I&&f?.(!0)}});let re={open:I,transitionStatus:ee,side:C,align:w};a(()=>{!B||!u.current||Object.keys(W.current).length||(W.current={top:B.style.top||`0`,left:B.style.left||`0`,right:B.style.right,height:B.style.height,bottom:B.style.bottom,minHeight:B.style.minHeight,maxHeight:B.style.maxHeight,marginTop:B.style.marginTop,marginBottom:B.style.marginBottom})},[u,B]),a(()=>{I||T||(U.current=!1,H.current=!1,Xo(B,W.current))},[I,T,B,u]),a(()=>{let e=u.current;if(!I||!z||!B||!e||T&&!E||l.state.transitionStatus===`ending`)return;if(!T){U.current=!0,te.request(y),e.style.removeProperty(`--transform-origin`);return}let t=Ls(e);e.style.removeProperty(`--transform-origin`);try{let t=g.current;t?.isConnected||(t=!$.hasSelectedValue(l.state)&&h.current?.isConnected?h.current:null);let n=m.current,r=getComputedStyle(B),i=getComputedStyle(e),a=Y(z),o=ne(B),s=Ns(z),c=Fs(z.getBoundingClientRect(),s),u=Fs(B.getBoundingClientRect(),s),d=c.height,f=V||e,p=f.scrollHeight,_=parseFloat(i.borderBottomWidth),v=parseFloat(r.marginTop)||10,b=parseFloat(r.marginBottom)||10,C=parseFloat(r.minHeight)||100,w=js(i),T=a.documentElement.clientHeight-v-b,E=a.documentElement.clientWidth,O=T-c.bottom+d,k,A=M===`rtl`?c.right-u.width:c.left,j=0;if(t&&n){let e=Fs(n.getBoundingClientRect(),s);k=Fs(t.getBoundingClientRect(),s),A=u.left+(M===`rtl`?e.right-k.right:e.left-k.left);let r=e.top-c.top+e.height/2;j=k.top-u.top+k.height/2-r}let N=O+j+b+_,P=Math.min(T,N),F=T-v-b,I=N-P,L=E-5;B.style.left=`${io(A,5,L-u.width)}px`,B.style.height=`${P}px`,B.style.maxHeight=`auto`,B.style.marginTop=`${v}px`,B.style.marginBottom=`${b}px`,e.style.height=`100%`;let R=Ms(f),ee=I>=R-1;ee&&(P=Math.min(T,u.height)-(I-R));let te=c.top<20||c.bottom>T-20||Math.ceil(P)+1<Math.min(p,C),G=(o.visualViewport?.scale??1)!==1&&Ue;if(te||G){U.current=!0,Xo(B,W.current),D(!1);return}let re=Math.max(C,P);if(ee){let e=Math.max(0,T-N);B.style.top=u.height>=F?`0`:`${e}px`,B.style.height=`${P}px`,f.scrollTop=Ms(f)}else B.style.bottom=`0`,f.scrollTop=I;if(k){let t=u.top,n=u.height,r=k.top+k.height/2,i=io(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(re===T||P>=w)&&(H.current=!0),y(),S&&l.state.selectedIndex===null&&l.state.activeIndex===null&&x.current[0]!=null&&l.set(`activeIndex`,0),U.current=!0}finally{t()}},[l,I,B,z,m,h,g,u,y,T,D,te,O,k,V,x,S,M,E]),K.useEffect(()=>{if(!T||!B||!I)return;let e=ne(B);function t(e){p(!1,er($n,e))}return Tr(e,`resize`,t)},[p,T,B,I]);let ie={...V?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":v||void 0,id:`${F}-list`},onKeyDown(e){_.current=!0,A&&Ts.has(e.key)&&e.stopPropagation()},onMouseMove(){_.current=!1},onScroll(e){V||G(e.currentTarget)},...T&&{style:V?{height:`100%`}:Zo}},ae=c(`div`,e,{ref:[t,u],state:re,stateAttributesMapping:ks,props:[R,ie,Qo(ee),{className:!V&&T?ms.className:void 0},s]});return(0,q.jsxs)(K.Fragment,{children:[!P&&ms.getElement(N),(0,q.jsx)(li,{context:j,modal:!1,disabled:!L,returnFocus:o,restoreFocus:!0,children:ae})]})});function js(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function Ms(e){return ao(e.scrollHeight,e.clientHeight)}function Ns(e){return ta.getScale(e)}function Ps(e,t,n){return e/n[t]}function Fs(e,t){return Wt({x:Ps(e.x,`x`,t),y:Ps(e.y,`y`,t),width:Ps(e.width,`x`,t),height:Ps(e.height,`y`,t)})}var Is=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Ls(e){let{style:t}=e,n={};for(let[e,r]of Is)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of Is){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Rs=K.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=Ba(),{alignItemWithTriggerActive:l}=Jo(),u=Q(o,$.hasScrollArrows),f=Q(o,$.openMethod),p=Q(o,$.multiple),m={id:`${Q(o,$.id)}-list`,role:`listbox`,"aria-multiselectable":p||void 0,onScroll(e){s.current?.(e.currentTarget)},...l&&{style:Zo},className:u&&f!==`touch`?ms.className:void 0};return c(`div`,e,{ref:[t,d(e=>{o.set(`listElement`,e)})],props:[m,a]})}),zs=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function Bs(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:o}=e,{register:s,unregister:c,subscribeMapChange:l,elementsRef:u,labelsRef:d,nextIndexRef:f}=Mo(),p=K.useRef(-1),[m,h]=K.useState(o??(i===zs.GuessFromOrder?()=>{if(p.current===-1){let e=f.current;f.current+=1,p.current=e}return p.current}:-1)),g=K.useRef(null),_=K.useCallback(e=>{if(g.current=e,m!==-1&&e!==null&&(u.current[m]=e,d)){let n=t!==void 0;d.current[m]=n?t:r?.current?.textContent??e.textContent}},[m,u,d,t,r]);return a(()=>{if(o!=null)return;let e=g.current;if(e)return s(e,n),()=>{c(e)}},[o,s,c,n]),a(()=>{if(o==null)return l(e=>{let t=g.current?e.get(g.current)?.index:null;t!=null&&h(t)})},[o,l,h]),K.useMemo(()=>({ref:_,index:m}),[m,_])}var Vs=K.createContext(void 0);function Hs(){let e=K.useContext(Vs);if(!e)throw Error(x(57));return e}var Us=K.memo(K.forwardRef(function(e,t){let{render:n,className:r,style:i,value:s=null,label:l,disabled:u=!1,nativeButton:d=!1,...f}=e,p=K.useRef(null),m=Bs({label:l,textRef:p,indexGuessBehavior:zs.GuessFromOrder}),{store:h,itemProps:g,setOpen:_,setValue:v,selectionRef:y,typingRef:b,valuesRef:x,multiple:S,selectedItemTextRef:C}=Ba(),w=Q(h,$.isActive,m.index),T=Q(h,$.isSelected,m.index,s),E=Q(h,$.isSelectedByFocus,m.index),D=Q(h,$.isItemEqualToValue),O=m.index,k=O!==-1,A=K.useRef(null);a(()=>{if(!k)return;let e=x.current;return e[O]=s,()=>{delete e[O]}},[k,O,s,x]),a(()=>{if(!k)return;let e=h.state.value,t=e;S&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&Ua(s,t,D)&&(h.set(`selectedIndex`,O),p.current&&(C.current=p.current))},[k,O,S,D,h,s,C]);let j=K.useRef(null),M=K.useRef(`mouse`),N=K.useRef(!1),{getButtonProps:P,buttonRef:F}=o({disabled:u,focusableWhenDisabled:!0,native:d,composite:!0}),I={disabled:u,selected:T,highlighted:w};function L(e){let t=h.state.value;if(S){let n=Array.isArray(t)?t:[];v(T?Ka(n,s,D):[...n,s],er(Jn,e))}else v(s,er(Jn,e)),_(!1,er(Jn,e))}function R(){y.current.dragY=0}let ee={role:`option`,"aria-selected":T,tabIndex:w?0:-1,onKeyDown(e){j.current=e.key,h.set(`activeIndex`,O),e.key===` `&&b.current&&e.preventDefault()},onClick(e){let t=e.type===`click`&&M.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&pt(e.nativeEvent)&&(n!==void 0||w),i=t&&!r&&!N.current;N.current=!1,!(e.type===`keydown`&&j.current===null)&&(u||e.type===`keydown`&&j.current===` `&&b.current||i||(j.current=null,L(e.nativeEvent)))},onPointerEnter(e){M.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=y.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){M.current=e.pointerType,N.current=!0,R()},onMouseUp(){if(R(),u||M.current===`touch`||N.current)return;let e=!y.current.allowSelectedMouseUp&&T,t=!y.current.allowUnselectedMouseUp&&!T;e||t||(N.current=!0,A.current?.click(),N.current=!1)}},z=c(`div`,e,{ref:[F,t,m.ref,A],state:I,props:[g,ee,f,P]}),B=K.useMemo(()=>({selected:T,index:O,textRef:p,selectedByFocus:E,hasRegistered:k}),[T,O,p,E,k]);return(0,q.jsx)(Vs.Provider,{value:B,children:z})})),Ws=K.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=Hs();return n||r?(0,q.jsx)(Gs,{...e,ref:t}):null}),Gs=K.memo(K.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Hs(),l=K.useRef(null),{transitionStatus:u,setMounted:d}=Hn(s),f=c(`span`,e,{ref:[t,l],state:{selected:s,transitionStatus:u},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:zn});return Vn({open:s,ref:l,onComplete(){s||d(!1)}}),f})),Ks=K.memo(K.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i,hasRegistered:a}=Hs(),{firstItemTextRef:o,selectedItemTextRef:s}=Ba(),{render:l,className:u,style:d,...f}=e;return c(`div`,e,{ref:[K.useCallback(e=>{e&&(a&&n===0&&(o.current=e),a&&i&&(s.current=e))},[o,s,n,i,a]),t,r],props:f})})),qs=K.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:o,keepMounted:s=!1,...l}=e,u=o===`up`,{store:d,popupRef:f,listRef:p,handleScrollArrowVisibility:m,scrollArrowsMountedCountRef:h}=Ba(),{side:g,scrollDownArrowRef:_,scrollUpArrowRef:v}=Jo(),y=Q(d,u?$.scrollUpArrowVisible:$.scrollDownArrowVisible),b=Q(d,$.openMethod),x=y&&b!==`touch`,S=An(),C=u?v:_,{transitionStatus:w,setMounted:T}=Hn(x);a(()=>(h.current+=1,d.state.hasScrollArrows||d.set(`hasScrollArrows`,!0),()=>{h.current=Math.max(0,h.current-1),h.current===0&&d.state.hasScrollArrows&&d.set(`hasScrollArrows`,!1)}),[d,h]),Vn({open:x,ref:C,onComplete(){x||T(!1)}});let E=c(`div`,e,{ref:[t,C],state:{direction:o,visible:x,side:g,transitionStatus:w},props:[{"aria-hidden":!0,children:u?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||S.isStarted())return;d.set(`activeIndex`,null);function t(){let e=d.state.listElement??f.current;if(!e)return;d.set(`activeIndex`,null),m();let n=ao(e.scrollHeight,e.clientHeight),r=oo(e.scrollTop,n),i=r===(u?0:n),a=p.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&d.set(u?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){S.clear();return}if(a.length>0){let t=C.current?.offsetHeight||0;e.scrollTop=Js(a,u,r,e.clientHeight,t,n)}S.start(40,t)}S.start(40,t)},onMouseLeave(){S.clear()}},l]});return x||s?E:null});function Js(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?oo(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?oo(l.offsetTop+l.offsetHeight-r+i,a):a}var Ys=K.forwardRef(function(e,t){return(0,q.jsx)(qs,{...e,ref:t,direction:`down`})}),Xs=K.forwardRef(function(e,t){return(0,q.jsx)(qs,{...e,ref:t,direction:`up`})}),Zs=so;function Qs({className:e,...t}){return(0,q.jsx)(Eo,{"data-slot":`select-value`,className:_(`flex flex-1 text-left`,e),...t})}function $s({className:e,size:t=`default`,children:n,...r}){return(0,q.jsxs)(wo,{"data-slot":`select-trigger`,"data-size":t,className:_(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,q.jsx)(Do,{render:(0,q.jsx)(G,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function ec({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`start`,alignOffset:a=0,alignItemWithTrigger:o=!1,...s}){return(0,q.jsx)(ko,{children:(0,q.jsx)(fs,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,q.jsxs)(As,{"data-slot":`select-content`,"data-align-trigger":o,className:_(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-sm border border-border-soft bg-surface p-1 text-popover-foreground shadow-deep`,e),...s,children:[(0,q.jsx)(nc,{}),(0,q.jsx)(Rs,{children:t}),(0,q.jsx)(rc,{})]})})})}function tc({className:e,children:t,...n}){return(0,q.jsxs)(Us,{"data-slot":`select-item`,className:_(`relative flex w-full cursor-default items-center gap-1.5 rounded-sm py-1 pr-8 pl-1.5 text-sm outline-hidden transition-colors select-none focus:bg-surface-elevated focus:text-text data-selected:text-accent data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,q.jsx)(Ks,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,q.jsx)(Ws,{render:(0,q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,q.jsx)(j,{className:`pointer-events-none`})})]})}function nc({className:e,...t}){return(0,q.jsx)(Xs,{"data-slot":`select-scroll-up-button`,className:_(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,q.jsx)(le,{})})}function rc({className:e,...t}){return(0,q.jsx)(Ys,{"data-slot":`select-scroll-down-button`,className:_(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,q.jsx)(G,{})})}function ic(e,t){return t.find(t=>t.kind===e)?.label??e}function ac(e){return e?e===`xhigh`?`Extra High`:e===`claude-opus-4-8`?`Claude Opus 4.8`:e===`claude-opus-4-6`?`Claude Opus 4.6`:e===`claude-sonnet-4-6`?`Claude Sonnet 4.6`:e===`gpt-6-astra`?`GPT-6 Astra`:e===`gpt-6-sol`?`GPT-6 Sol`:e===`gpt-6-luna`?`GPT-6 Luna`:e===`gpt-5.6-sol`?`GPT-5.6 Sol`:e===`gpt-5.6-terra`?`GPT-5.6 Terra`:e===`gpt-5.6-luna`?`GPT-5.6 Luna`:e===`deepseek/deepseek-v4-pro`?`DeepSeek V4 Pro`:e===`deepseek/deepseek-flash`||e===`deepseek/deepseek-v4-flash`||e===`deepseek/deepseek-v4-flash-vision-exp`?`DeepSeek V4.1 Flash`:/^[a-z]+$/.test(e)?`${e.charAt(0).toUpperCase()}${e.slice(1)}`:e:``}var oc={missing_token:``,wrong_token_type:``,unknown_token_type:"This doesn't look like a Slack token. Bot tokens start with `xoxb-`, app-level tokens with `xapp-`.",invalid_token:`Slack didn't recognize this token. Check you copied the whole thing and the app is still installed.`,missing_connections_write:"Slack says this App-Level Token is missing `connections:write`. In App-Level Tokens, regenerate it with that scope checked.",not_bot_token:"Slack says this is not the Bot User OAuth Token. Copy Bot User OAuth Token from OAuth & Permissions. It starts with `xoxb-`.",slack_api_error:`Couldn't reach Slack to check this token. Try again in a moment.`},sc=`These two tokens are from different Slack apps. Make sure both came from the same app you just created.`;function cc(e){return e.valid?{status:`verified`,result:e}:{status:`failed`,result:e}}function lc(e,t){return!e.reason||e.reason===`missing_token`?``:e.reason===`wrong_token_type`?t===`app`?"That’s a Bot token (`xoxb-…`). The App-Level Token goes here. It starts with `xapp-`.":"That’s an App-Level Token (`xapp-…`). The Bot User OAuth Token goes here. It starts with `xoxb-`.":oc[e.reason]||`Validation failed.`}function uc({n:e,done:t,active:n,onClick:r}){return(0,q.jsx)(`span`,{onClick:r,title:r?`Go back to this step`:void 0,className:[`font-sans mt-px flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-[11px] font-semibold transition-opacity`,t?`border-health-ok bg-health-ok-soft text-health-ok`:n?`border-health-warn/50 text-health-warn`:`border-border text-text-subtle`,r?`cursor-pointer hover:opacity-60`:``].join(` `),children:t?(0,q.jsx)(j,{className:`h-3.5 w-3.5`}):e})}function dc({state:e,field:t}){if(e.status===`idle`)return null;if(e.status===`pending`)return(0,q.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 font-sans text-[12px] text-text-muted`,children:[(0,q.jsx)(E,{className:`h-3.5 w-3.5 animate-spin`}),(0,q.jsx)(`span`,{children:`Checking with Slack…`})]});if(e.status===`verified`){let n=t===`bot`&&e.result.botName?`@${e.result.botName}${e.result.workspaceName?` · ${e.result.workspaceName}`:``}`:e.result.workspaceName??`Verified`;return(0,q.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 font-sans text-[12px] text-health-ok`,children:[(0,q.jsx)(j,{className:`h-3.5 w-3.5 shrink-0`}),(0,q.jsx)(`span`,{children:n})]})}return(0,q.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-1.5 font-sans text-[12px] text-health-error`,children:[(0,q.jsx)(s,{className:`mt-px h-3.5 w-3.5 shrink-0`}),(0,q.jsx)(`span`,{children:lc(e.result,t)})]})}function fc({conn:e}){return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-sm border border-health-ok/30 bg-health-ok-soft px-4 py-3`,children:[(0,q.jsxs)(`div`,{className:`flex flex-1 min-w-0 items-center gap-2`,children:[e.workspaceIconUrl&&(0,q.jsx)(`img`,{src:e.workspaceIconUrl,alt:``,className:`h-5 w-5 shrink-0 rounded-sm object-cover`}),(0,q.jsxs)(`span`,{className:`font-serif text-[13px] text-text`,children:[`Connected to `,(0,q.jsx)(`strong`,{children:e.workspaceName??`your workspace`}),e.botName?(0,q.jsxs)(q.Fragment,{children:[` `,`as`,` `,e.botAvatarUrl&&(0,q.jsx)(`img`,{src:e.botAvatarUrl,alt:``,className:`mx-0.5 inline h-4 w-4 rounded-full object-cover align-middle`}),(0,q.jsxs)(`strong`,{children:[`@`,e.botName]})]}):null]})]}),(0,q.jsx)(j,{className:`h-4 w-4 shrink-0 text-health-ok`})]})}function pc({agentId:e,onConnect:t}){let[n,r]=(0,K.useState)(!1),[i,a]=(0,K.useState)(``),[o,c]=(0,K.useState)(``),[l,u]=(0,K.useState)({status:`idle`}),[d,p]=(0,K.useState)({status:`idle`}),[m,g]=(0,K.useState)(null),[_,v]=(0,K.useState)(!1),[y,b]=(0,K.useState)(),[x,S]=(0,K.useState)(!1),C=(0,K.useRef)(null),w=l.status===`verified`,T=d.status===`verified`,D=n,O=w,k=n&&O,A=T,j=(0,K.useCallback)(async t=>{if(t.trim()){u({status:`pending`}),g(null);try{let n=await V(e,{appToken:t.trim()});n.app&&u(cc(n.app))}catch{u({status:`failed`,result:{valid:!1,expected:`app`,reason:`slack_api_error`}})}}},[e]),M=(0,K.useCallback)(async t=>{if(t.trim()){p({status:`pending`}),g(null);try{let n=await V(e,{botToken:t.trim()});n.bot&&p(cc(n.bot))}catch{p({status:`failed`,result:{valid:!1,expected:`bot`,reason:`slack_api_error`}})}}},[e]);async function N(){if(!(_||x)){v(!0),b(void 0);try{await h(e,{appToken:i.trim(),botToken:o.trim()}),S(!0),f(),t?.()}catch(e){b(e instanceof Error?e.message:`Connection failed`),g(null)}finally{v(!1)}}}async function P(){try{let t=await V(e,{appToken:i.trim(),botToken:o.trim()});t.connection.valid?(g(t.connection),N()):t.connection.reason===`app_mismatch`?(b(sc),u({status:`idle`}),p({status:`idle`}),g(null)):t.connection.reason===`incomplete`||b(`Could not connect. Try again.`)}catch{b(`Could not reach Slack to validate the token pair.`)}}(0,K.useEffect)(()=>{w&&T&&!_&&!x&&setTimeout(()=>void P(),0)},[w,T]);function F(e){C.current&&clearTimeout(C.current);let t=e.trim();if(t.length<=20)return;let n=t.startsWith(`xoxb-`)?300:600;C.current=setTimeout(()=>void j(t),n)}function I(e){C.current&&clearTimeout(C.current);let t=e.trim();if(t.length<=20)return;let n=t.startsWith(`xapp-`)?300:600;C.current=setTimeout(()=>void M(t),n)}function L(e){a(e),u({status:`idle`}),g(null),b(void 0),F(e)}function R(e){c(e),p({status:`idle`}),g(null),b(void 0),I(e)}function ee(){window.open(`/api/agents/${encodeURIComponent(e)}/slack/install`,`_blank`,`noopener,noreferrer`),r(!0)}return(0,q.jsxs)(`div`,{className:`space-y-5`,children:[(0,q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,q.jsx)(uc,{n:1,done:n,active:!0,onClick:n?()=>{r(!1),a(``),c(``),u({status:`idle`}),p({status:`idle`}),S(!1),b(void 0),g(null)}:void 0}),(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Create & install the Slack app`}),(0,q.jsxs)(`div`,{className:`mt-1 font-serif text-[13px] leading-snug text-text-muted`,children:[(0,q.jsx)(`button`,{onClick:ee,className:`font-serif text-[13px] text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent`,children:`Create app in Slack`}),` `,`→ pick your workspace → click `,(0,q.jsx)(`strong`,{children:`Install`}),`.`,` `,`Anima fills in the manifest; reusing an older app only works if Interactivity is enabled.`]}),!n&&(0,q.jsx)(`button`,{onClick:()=>r(!0),className:`mt-1.5 font-sans text-[11px] text-text-subtle underline decoration-text-subtle/40 underline-offset-2 hover:text-text-muted hover:decoration-text-muted/40`,children:`I already created the app`})]})]}),(0,q.jsxs)(`div`,{className:[`flex gap-3`,D?``:`pointer-events-none opacity-40`].join(` `),children:[(0,q.jsx)(uc,{n:2,done:O,active:D,onClick:O?()=>{a(``),u({status:`idle`}),S(!1),b(void 0),g(null)}:void 0}),(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Paste App-Level Token`}),(0,q.jsxs)(`div`,{className:`mt-1 font-serif text-[13px] leading-snug text-text-muted`,children:[`In Slack: Basic Information → App-Level Tokens → Generate. Add scope`,` `,(0,q.jsx)(`span`,{className:`font-mono text-[11px]`,children:`connections:write`}),`, then paste the`,` `,(0,q.jsx)(`span`,{className:`font-mono text-[11px]`,children:`xapp-…`}),` token here.`]}),D&&(0,q.jsxs)(`div`,{className:`mt-2`,children:[(0,q.jsx)(`input`,{"aria-label":`App-Level Token`,autoComplete:`off`,type:`text`,value:i,onChange:e=>L(e.target.value),onBlur:()=>{let e=i.trim();e.length>20&&l.status===`idle`&&j(e)},placeholder:`xapp-…`,disabled:w||_,spellCheck:!1,className:[`w-full rounded-sm border bg-muted/30 px-3 py-1.5 font-mono text-[12px] text-text placeholder:font-sans placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-ring`,l.status===`verified`?`border-health-ok/50`:l.status===`failed`?`border-health-error/50`:`border-border`].join(` `)}),(0,q.jsx)(dc,{state:l,field:`app`})]})]})]}),(0,q.jsxs)(`div`,{className:[`flex gap-3`,k?``:`pointer-events-none opacity-40`].join(` `),children:[(0,q.jsx)(uc,{n:3,done:A,active:k,onClick:A?()=>{c(``),p({status:`idle`}),S(!1),b(void 0),g(null)}:void 0}),(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Paste Bot User OAuth Token`}),(0,q.jsxs)(`div`,{className:`mt-1 font-serif text-[13px] leading-snug text-text-muted`,children:[`In Slack: OAuth & Permissions → Install to Workspace. Copy`,` `,(0,q.jsx)(`strong`,{children:`Bot User OAuth Token`}),` and paste the`,` `,(0,q.jsx)(`span`,{className:`font-mono text-[11px]`,children:`xoxb-…`}),` token here.`]}),k&&(0,q.jsxs)(`div`,{className:`mt-2 space-y-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`input`,{"aria-label":`Bot User OAuth Token`,autoComplete:`off`,type:`text`,value:o,onChange:e=>R(e.target.value),onBlur:()=>{let e=o.trim();e.length>20&&d.status===`idle`&&M(e)},placeholder:`xoxb-…`,disabled:T||_,spellCheck:!1,className:[`w-full rounded-sm border bg-muted/30 px-3 py-1.5 font-mono text-[12px] text-text placeholder:font-sans placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-ring`,d.status===`verified`?`border-health-ok/50`:d.status===`failed`?`border-health-error/50`:`border-border`].join(` `)}),(0,q.jsx)(dc,{state:d,field:`bot`})]}),_&&(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 font-sans text-[12px] text-text-muted`,children:[(0,q.jsx)(E,{className:`h-3.5 w-3.5 animate-spin`}),(0,q.jsx)(`span`,{children:`Connecting…`})]}),y&&(0,q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(s,{className:`mt-px h-3.5 w-3.5 shrink-0 text-health-error`}),(0,q.jsx)(`span`,{className:`font-sans text-[12px] text-health-error`,children:y})]})]})]})]}),m?.valid&&(0,q.jsx)(fc,{conn:m})]})}var mc=2e3,hc=[`starting`,`waiting`,`slow_down`,`domain_switched`];function gc(e){return!!(e&&hc.includes(e.state))}function _c({agentId:e,enabled:t=!0,intervalMs:n=mc,isCurrentRun:r,onError:i,onStatus:a,registration:o,shouldPoll:s=gc}){let c=(0,K.useRef)(!1),l=(0,K.useRef)(r),u=(0,K.useRef)(i),d=(0,K.useRef)(a),f=(0,K.useRef)(s);(0,K.useEffect)(()=>{l.current=r,u.current=i,d.current=a,f.current=s},[r,i,a,s]),(0,K.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let p=(0,K.useCallback)(e=>c.current&&(e?e():!0),[]),h=(0,K.useCallback)(async(t,r)=>{let i=t;for(;r.shouldContinue(i);){if(await vc(n),!p(r.isCurrentRun)||(i=await m(r.agentId??e,i.registrationId),!p(r.isCurrentRun)))return null;r.onStatus?.(i)}return i},[e,n,p]);return(0,K.useEffect)(()=>{if(!t||!o?.registrationId||!f.current(o))return;let r=!1,i=window.setInterval(()=>{m(e,o.registrationId).then(e=>{r||!p(l.current)||(f.current(e)||(r=!0,window.clearInterval(i)),d.current?.(e))}).catch(e=>{r||!p(l.current)||u.current?.(e)})},n);return()=>{r=!0,window.clearInterval(i)}},[e,t,n,p,o?.registrationId,o]),{pollUntil:h}}function vc(e){return new Promise(t=>window.setTimeout(t,e))}var yc=r(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),bc=r(((e,t)=>{var n=yc();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),xc=r(((e,t)=>{t.exports=bc()()})),Sc=r(((e,t)=>{t.exports={L:1,M:0,Q:3,H:2}})),Cc=r(((e,t)=>{t.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}})),wc=r(((e,t)=>{var n=Cc();function r(e){this.mode=n.MODE_8BIT_BYTE,this.data=e}r.prototype={getLength:function(e){return this.data.length},write:function(e){for(var t=0;t<this.data.length;t++)e.put(this.data.charCodeAt(t),8)}},t.exports=r})),Tc=r(((e,t)=>{var n=Sc();function r(e,t){this.totalCount=e,this.dataCount=t}r.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],r.getRSBlocks=function(e,t){var n=r.getRsBlockTable(e,t);if(n==null)throw Error(`bad rs block @ typeNumber:`+e+`/errorCorrectLevel:`+t);for(var i=n.length/3,a=[],o=0;o<i;o++)for(var s=n[o*3+0],c=n[o*3+1],l=n[o*3+2],u=0;u<s;u++)a.push(new r(c,l));return a},r.getRsBlockTable=function(e,t){switch(t){case n.L:return r.RS_BLOCK_TABLE[(e-1)*4+0];case n.M:return r.RS_BLOCK_TABLE[(e-1)*4+1];case n.Q:return r.RS_BLOCK_TABLE[(e-1)*4+2];case n.H:return r.RS_BLOCK_TABLE[(e-1)*4+3];default:return}},t.exports=r})),Ec=r(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Dc=r(((e,t)=>{for(var n={glog:function(e){if(e<1)throw Error(`glog(`+e+`)`);return n.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return n.EXP_TABLE[e]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)},r=0;r<8;r++)n.EXP_TABLE[r]=1<<r;for(var r=8;r<256;r++)n.EXP_TABLE[r]=n.EXP_TABLE[r-4]^n.EXP_TABLE[r-5]^n.EXP_TABLE[r-6]^n.EXP_TABLE[r-8];for(var r=0;r<255;r++)n.LOG_TABLE[n.EXP_TABLE[r]]=r;t.exports=n})),Oc=r(((e,t)=>{var n=Dc();function r(e,t){if(e.length==null)throw Error(e.length+`/`+t);for(var n=0;n<e.length&&e[n]==0;)n++;this.num=Array(e.length-n+t);for(var r=0;r<e.length-n;r++)this.num[r]=e[r+n]}r.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=Array(this.getLength()+e.getLength()-1),i=0;i<this.getLength();i++)for(var a=0;a<e.getLength();a++)t[i+a]^=n.gexp(n.glog(this.get(i))+n.glog(e.get(a)));return new r(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=n.glog(this.get(0))-n.glog(e.get(0)),i=Array(this.getLength()),a=0;a<this.getLength();a++)i[a]=this.get(a);for(var a=0;a<e.getLength();a++)i[a]^=n.gexp(n.glog(e.get(a))+t);return new r(i,0).mod(e)}},t.exports=r})),kc=r(((e,t)=>{var n=Cc(),r=Oc(),i=Dc(),a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;o.getBCHDigit(t)-o.getBCHDigit(o.G15)>=0;)t^=o.G15<<o.getBCHDigit(t)-o.getBCHDigit(o.G15);return(e<<10|t)^o.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;o.getBCHDigit(t)-o.getBCHDigit(o.G18)>=0;)t^=o.G18<<o.getBCHDigit(t)-o.getBCHDigit(o.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;e!=0;)t++,e>>>=1;return t},getPatternPosition:function(e){return o.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,n){switch(e){case a.PATTERN000:return(t+n)%2==0;case a.PATTERN001:return t%2==0;case a.PATTERN010:return n%3==0;case a.PATTERN011:return(t+n)%3==0;case a.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case a.PATTERN101:return t*n%2+t*n%3==0;case a.PATTERN110:return(t*n%2+t*n%3)%2==0;case a.PATTERN111:return(t*n%3+(t+n)%2)%2==0;default:throw Error(`bad maskPattern:`+e)}},getErrorCorrectPolynomial:function(e){for(var t=new r([1],0),n=0;n<e;n++)t=t.multiply(new r([1,i.gexp(n)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case n.MODE_NUMBER:return 10;case n.MODE_ALPHA_NUM:return 9;case n.MODE_8BIT_BYTE:return 8;case n.MODE_KANJI:return 8;default:throw Error(`mode:`+e)}else if(t<27)switch(e){case n.MODE_NUMBER:return 12;case n.MODE_ALPHA_NUM:return 11;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 10;default:throw Error(`mode:`+e)}else if(t<41)switch(e){case n.MODE_NUMBER:return 14;case n.MODE_ALPHA_NUM:return 13;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 12;default:throw Error(`mode:`+e)}else throw Error(`type:`+t)},getLostPoint:function(e){for(var t=e.getModuleCount(),n=0,r=0;r<t;r++)for(var i=0;i<t;i++){for(var a=0,o=e.isDark(r,i),s=-1;s<=1;s++)if(!(r+s<0||t<=r+s))for(var c=-1;c<=1;c++)i+c<0||t<=i+c||s==0&&c==0||o==e.isDark(r+s,i+c)&&a++;a>5&&(n+=3+a-5)}for(var r=0;r<t-1;r++)for(var i=0;i<t-1;i++){var l=0;e.isDark(r,i)&&l++,e.isDark(r+1,i)&&l++,e.isDark(r,i+1)&&l++,e.isDark(r+1,i+1)&&l++,(l==0||l==4)&&(n+=3)}for(var r=0;r<t;r++)for(var i=0;i<t-6;i++)e.isDark(r,i)&&!e.isDark(r,i+1)&&e.isDark(r,i+2)&&e.isDark(r,i+3)&&e.isDark(r,i+4)&&!e.isDark(r,i+5)&&e.isDark(r,i+6)&&(n+=40);for(var i=0;i<t;i++)for(var r=0;r<t-6;r++)e.isDark(r,i)&&!e.isDark(r+1,i)&&e.isDark(r+2,i)&&e.isDark(r+3,i)&&e.isDark(r+4,i)&&!e.isDark(r+5,i)&&e.isDark(r+6,i)&&(n+=40);for(var u=0,i=0;i<t;i++)for(var r=0;r<t;r++)e.isDark(r,i)&&u++;var d=Math.abs(100*u/t/t-50)/5;return n+=d*10,n}};t.exports=o})),Ac=r(((e,t)=>{var n=wc(),r=Tc(),i=Ec(),a=kc(),o=Oc();function s(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var c=s.prototype;c.addData=function(e){var t=new n(e);this.dataList.push(t),this.dataCache=null},c.isDark=function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw Error(e+`,`+t);return this.modules[e][t]},c.getModuleCount=function(){return this.moduleCount},c.make=function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=r.getRSBlocks(e,this.errorCorrectLevel),n=new i,o=0,s=0;s<t.length;s++)o+=t[s].dataCount;for(var s=0;s<this.dataList.length;s++){var c=this.dataList[s];n.put(c.mode,4),n.put(c.getLength(),a.getLengthInBits(c.mode,e)),c.write(n)}if(n.getLengthInBits()<=o*8)break}this.typeNumber=e}this.makeImpl(!1,this.getBestMaskPattern())},c.makeImpl=function(e,t){this.moduleCount=this.typeNumber*4+17,this.modules=Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++){this.modules[n]=Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++)this.modules[n][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),this.dataCache??=s.createData(this.typeNumber,this.errorCorrectLevel,this.dataList),this.mapData(this.dataCache,t)},c.setupPositionProbePattern=function(e,t){for(var n=-1;n<=7;n++)if(!(e+n<=-1||this.moduleCount<=e+n))for(var r=-1;r<=7;r++)t+r<=-1||this.moduleCount<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[e+n][t+r]=!0:this.modules[e+n][t+r]=!1)},c.getBestMaskPattern=function(){for(var e=0,t=0,n=0;n<8;n++){this.makeImpl(!0,n);var r=a.getLostPoint(this);(n==0||e>r)&&(e=r,t=n)}return t},c.createMovieClip=function(e,t,n){var r=e.createEmptyMovieClip(t,n),i=1;this.make();for(var a=0;a<this.modules.length;a++)for(var o=a*i,s=0;s<this.modules[a].length;s++){var c=s*i;this.modules[a][s]&&(r.beginFill(0,100),r.moveTo(c,o),r.lineTo(c+i,o),r.lineTo(c+i,o+i),r.lineTo(c,o+i),r.endFill())}return r},c.setupTimingPattern=function(){for(var e=8;e<this.moduleCount-8;e++)this.modules[e][6]??(this.modules[e][6]=e%2==0);for(var t=8;t<this.moduleCount-8;t++)this.modules[6][t]??(this.modules[6][t]=t%2==0)},c.setupPositionAdjustPattern=function(){for(var e=a.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var n=0;n<e.length;n++){var r=e[t],i=e[n];if(this.modules[r][i]==null)for(var o=-2;o<=2;o++)for(var s=-2;s<=2;s++)o==-2||o==2||s==-2||s==2||o==0&&s==0?this.modules[r+o][i+s]=!0:this.modules[r+o][i+s]=!1}},c.setupTypeNumber=function(e){for(var t=a.getBCHTypeNumber(this.typeNumber),n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(var n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}},c.setupTypeInfo=function(e,t){for(var n=this.errorCorrectLevel<<3|t,r=a.getBCHTypeInfo(n),i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o}for(var i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=o:i<9?this.modules[8][15-i-1+1]=o:this.modules[8][15-i-1]=o}this.modules[this.moduleCount-8][8]=!e},c.mapData=function(e,t){for(var n=-1,r=this.moduleCount-1,i=7,o=0,s=this.moduleCount-1;s>0;s-=2)for(s==6&&s--;;){for(var c=0;c<2;c++)if(this.modules[r][s-c]==null){var l=!1;o<e.length&&(l=(e[o]>>>i&1)==1),a.getMask(t,r,s-c)&&(l=!l),this.modules[r][s-c]=l,i--,i==-1&&(o++,i=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}},s.PAD0=236,s.PAD1=17,s.createData=function(e,t,n){for(var o=r.getRSBlocks(e,t),c=new i,l=0;l<n.length;l++){var u=n[l];c.put(u.mode,4),c.put(u.getLength(),a.getLengthInBits(u.mode,e)),u.write(c)}for(var d=0,l=0;l<o.length;l++)d+=o[l].dataCount;if(c.getLengthInBits()>d*8)throw Error(`code length overflow. (`+c.getLengthInBits()+`>`+d*8+`)`);for(c.getLengthInBits()+4<=d*8&&c.put(0,4);c.getLengthInBits()%8!=0;)c.putBit(!1);for(;!(c.getLengthInBits()>=d*8||(c.put(s.PAD0,8),c.getLengthInBits()>=d*8));)c.put(s.PAD1,8);return s.createBytes(c,o)},s.createBytes=function(e,t){for(var n=0,r=0,i=0,s=Array(t.length),c=Array(t.length),l=0;l<t.length;l++){var u=t[l].dataCount,d=t[l].totalCount-u;r=Math.max(r,u),i=Math.max(i,d),s[l]=Array(u);for(var f=0;f<s[l].length;f++)s[l][f]=255&e.buffer[f+n];n+=u;var p=a.getErrorCorrectPolynomial(d),m=new o(s[l],p.getLength()-1).mod(p);c[l]=Array(p.getLength()-1);for(var f=0;f<c[l].length;f++){var h=f+m.getLength()-c[l].length;c[l][f]=h>=0?m.get(h):0}}for(var g=0,f=0;f<t.length;f++)g+=t[f].totalCount;for(var _=Array(g),v=0,f=0;f<r;f++)for(var l=0;l<t.length;l++)f<s[l].length&&(_[v++]=s[l][f]);for(var f=0;f<i;f++)for(var l=0;l<t.length;l++)f<c[l].length&&(_[v++]=c[l][f]);return _},t.exports=s})),jc=r((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n=o(xc()),r=i(),a=o(r);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var c={bgColor:n.default.oneOfType([n.default.object,n.default.string]).isRequired,bgD:n.default.string.isRequired,fgColor:n.default.oneOfType([n.default.object,n.default.string]).isRequired,fgD:n.default.string.isRequired,size:n.default.number.isRequired,title:n.default.string,viewBoxSize:n.default.number.isRequired,xmlns:n.default.string},l=(0,r.forwardRef)(function(e,n){var r=e.bgColor,i=e.bgD,o=e.fgD,c=e.fgColor,l=e.size,u=e.title,d=e.viewBoxSize,f=e.xmlns,p=f===void 0?`http://www.w3.org/2000/svg`:f,m=s(e,[`bgColor`,`bgD`,`fgD`,`fgColor`,`size`,`title`,`viewBoxSize`,`xmlns`]);return a.default.createElement(`svg`,t({},m,{height:l,ref:n,viewBox:`0 0 `+d+` `+d,width:l,xmlns:p}),u?a.default.createElement(`title`,null,u):null,a.default.createElement(`path`,{d:i,fill:r}),a.default.createElement(`path`,{d:o,fill:c}))});l.displayName=`QRCodeSvg`,l.propTypes=c,e.default=l})),Mc=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.QRCode=void 0;var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n=l(xc()),r=l(Sc()),a=l(Ac()),o=i(),s=l(o),c=l(jc());function l(e){return e&&e.__esModule?e:{default:e}}function u(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function d(e){return e.map(function(e){return String.fromCharCode(e&255)}).join(``)}function f(e){return Array.from(new TextEncoder().encode(e))}var p={bgColor:n.default.oneOfType([n.default.object,n.default.string]),fgColor:n.default.oneOfType([n.default.object,n.default.string]),level:n.default.string,size:n.default.number,value:n.default.string.isRequired},m=(0,o.forwardRef)(function(e,n){var i=e.bgColor,o=i===void 0?`#FFFFFF`:i,l=e.fgColor,p=l===void 0?`#000000`:l,m=e.level,h=m===void 0?`L`:m,g=e.size,_=g===void 0?256:g,v=e.value,y=u(e,[`bgColor`,`fgColor`,`level`,`size`,`value`]),b=new a.default(-1,r.default[h]),x=d(f(v));b.addData(x,`Byte`),b.make();var S=b.modules;return s.default.createElement(c.default,t({},y,{bgColor:o,bgD:S.map(function(e,t){return e.map(function(e,n){return e?``:`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`}).join(` `)}).join(` `),fgColor:p,fgD:S.map(function(e,t){return e.map(function(e,n){return e?`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`:``}).join(` `)}).join(` `),ref:n,size:_,viewBoxSize:S.length}))});e.QRCode=m,m.displayName=`QRCode`,m.propTypes=p}))(),Nc=15e3;function Pc(){return(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,q.jsx)(E,{className:`h-4 w-4 animate-spin`}),`Creating your Feishu app…`]})}function Fc(){return(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,q.jsx)(E,{className:`h-4 w-4 animate-spin`}),`Connecting…`]})}function Ic(){return(0,q.jsx)(`p`,{className:`text-center font-sans text-[12px] text-text-subtle`,children:`This is taking longer than usual.`})}function Lc({frame:e=`plain`,verificationUrl:n}){let r=ie(),i=e===`card`?`rounded-sm border border-border-soft bg-surface px-4 py-6`:`px-2 py-6`;return r?(0,q.jsxs)(`div`,{className:`flex flex-col items-center ${i} text-center`,children:[(0,q.jsxs)(g,{className:`w-full max-w-xs`,render:(0,q.jsx)(`a`,{href:n,rel:`noreferrer`,target:`_blank`}),children:[`Open Feishu`,(0,q.jsx)(t,{className:`h-4 w-4`,"aria-hidden":!0})]}),(0,q.jsx)(`p`,{className:`mt-3 max-w-xs text-balance font-serif text-[13px] leading-relaxed text-text-muted`,children:`Open Feishu to confirm the new app there.`})]}):(0,q.jsxs)(`div`,{className:`flex flex-col items-center ${i} text-center`,children:[(0,q.jsx)(`span`,{className:`rounded-md border border-border-soft bg-white p-3`,children:(0,q.jsx)(Mc.QRCode,{value:n,size:144,bgColor:`#ffffff`,fgColor:`#1c1a17`,level:`M`})}),(0,q.jsx)(`p`,{className:`mt-3 max-w-[18rem] text-balance font-serif text-[13px] leading-relaxed text-text-muted`,children:`Scan with Feishu, then confirm the new app there.`}),(0,q.jsxs)(`a`,{className:`mt-3 inline-flex items-center gap-1.5 font-sans text-[12px] text-text-muted underline decoration-text-muted/40 underline-offset-2 transition-colors hover:text-text hover:decoration-text/40`,href:n,rel:`noreferrer`,target:`_blank`,children:[`Or open the Feishu tab in your browser`,(0,q.jsx)(t,{className:`h-3 w-3`,"aria-hidden":!0})]})]})}function Rc({appId:e,appSecret:t,description:n,disabled:r,onAppId:i,onAppSecret:a,onSubmit:o,saving:s}){return(0,q.jsxs)(`div`,{className:`space-y-3 rounded-sm border border-border-soft bg-surface px-4 py-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Connect an existing Feishu app`}),(0,q.jsx)(`p`,{className:`mt-1 font-serif text-[12px] leading-snug text-text-muted`,children:n})]}),(0,q.jsx)(zc,{label:`App ID`,placeholder:`cli_...`,value:e,onChange:i}),(0,q.jsx)(zc,{label:`App Secret`,placeholder:`App secret`,secret:!0,value:t,onChange:a}),(0,q.jsx)(`p`,{className:`font-sans text-[12px] leading-snug text-text-muted`,children:`Find these on your app's Credentials & Basic Info page in the Feishu Open Platform Developer Console.`}),(0,q.jsx)(g,{className:`w-full`,onClick:o,disabled:r,children:s?(0,q.jsx)(Fc,{}):`Connect Feishu app`})]})}function zc({label:e,onChange:t,optional:n=!1,placeholder:r,secret:i=!1,value:a}){return(0,q.jsxs)(`label`,{className:`block`,children:[(0,q.jsxs)(`span`,{className:`font-sans mb-1.5 block text-[12px] font-medium uppercase tracking-[0.08em] text-text-muted`,children:[e,n?(0,q.jsx)(`span`,{className:`normal-case tracking-normal text-text-subtle`,children:` · optional`}):null]}),(0,q.jsx)(`input`,{autoComplete:`off`,className:`w-full rounded-sm border border-border-soft bg-surface px-3 py-2 font-mono text-[12px] text-text placeholder:font-sans placeholder:text-text-subtle focus:border-accent focus:outline-none`,onChange:e=>t(e.target.value),placeholder:r,spellCheck:!1,type:i?`password`:`text`,value:a})]})}var Bc={"contact:user.basic_profile:readonly":`Get user's basic info`,"contact:user.id:readonly":`Obtain user ID via email or mobile number`,"contact:user.employee_id:readonly":`Obtain user ID`,"contact:user.email:readonly":`Obtain user's email information`,"contact:user.phone:readonly":`Obtain user's mobile number`,"im:message.group_msg":`Read all messages in associated group chat (sensitive scope)`,"im:message.group_at_msg.include_bot:readonly":`Receive other bots' and users' mentions`,"im:chat.members:write_only":`Add and remove group member`,"bitable:app":`View, comment, edit and manage Base`,"bitable:app:readonly":`View, comment, and export Base`,"board:whiteboard:node:create":`Create board node`,"board:whiteboard:node:delete":`Delete board node`,"board:whiteboard:node:read":`View board node`,"board:whiteboard:node:update":`Update board node`,"docs:doc":`View, comment, edit, and manage Docs`,"docs:doc:readonly":`View, comment, and export Docs`,"docs:document.comment:create":`Add and reply to comment in document`,"docs:document.comment:delete":`Delete comment in document`,"docs:document.comment:read":`Get comments in document`,"docs:document.comment:update":`Modify comment in document`,"docs:document.comment:write_only":`Reply, edit, delete comment in document`,"docs:document.content:read":`View document content`,"docs:document.media:download":`Download image and file in document`,"docs:document.media:upload":`Upload image and file to document`,"docs:document.subscription":`Subscribe to document and update subscription status`,"docs:document.subscription:read":`Get subscription status of document`,"docs:document:copy":`Duplicate document`,"docs:document:export":`Export document`,"docs:document:import":`View and create document import task`,"docs:event.document_deleted:read":`Receive document delete event`,"docs:event.document_edited:read":`Receive document edit event`,"docs:event.document_opened:read":`Receive document open event`,"docs:event:subscribe":`Subscribe to document-related events`,"docs:permission.member":`View, add, update, and delete document collaborators`,"docs:permission.member:apply":`Request docs permission`,"docs:permission.member:auth":`Verify user's access to document`,"docs:permission.member:create":`Add document collaborator`,"docs:permission.member:delete":`Remove document collaborator`,"docs:permission.member:readonly":`View document collaborators (legacy version)`,"docs:permission.member:retrieve":`Get document collaborators`,"docs:permission.member:transfer":`Transfer ownership of document`,"docs:permission.member:update":`Update collaborator permission of document`,"docs:permission.setting":`View and update document permission settings`,"docs:permission.setting:read":`Query permission settings of document`,"docs:permission.setting:readonly":`View document permission settings`,"docs:permission.setting:write_only":`Modify permission settings of document`,"docs:secure_label:readonly":`View document's security level label`,"docs:secure_label:write_only":`Modify document security level`,"docx:document":`Create and edit upgraded Docs`,"docx:document.block:convert":`Convert text to cloud document block`,"docx:document:create":`Create upgraded Docs`,"docx:document:readonly":`View upgraded Docs`,"docx:document:write_only":`Edit upgraded Docs`,"drive:drive":`View, comment, edit, and manage all files in My Space`,"drive:drive.metadata:readonly":`View the metadata of files in My Space`,"drive:drive.search:readonly":`Search files in My Space`,"drive:drive:readonly":`View, comment, and download all files in My Space`,"drive:drive:version":`View, create, and delete document versions`,"drive:drive:version:readonly":`View document versions`,"drive:export:readonly":`Export Docs documents`,"drive:file":`Upload and download files to My Space`,"drive:file.like:readonly":`View the likes information of document`,"drive:file.meta.sec_label.read_only":`View document security level label`,"drive:file:download":`Download file in My Space`,"drive:file:readonly":`View and download files in My Space`,"drive:file:upload":`Upload file`,"drive:file:view_record:readonly":`Get document's view history`,"drive:quota_detail:read_one":`Get personal storage quota information`,"sheets:spreadsheet":`View, comment, edit, and manage Sheets`,"sheets:spreadsheet.meta:read":`Query metadata of spreadsheet`,"sheets:spreadsheet.meta:write_only":`Modify metadata of spreadsheet`,"sheets:spreadsheet:create":`Create spreadsheet`,"sheets:spreadsheet:read":`View spreadsheet`,"sheets:spreadsheet:readonly":`View, comment, and export Sheets`,"sheets:spreadsheet:write_only":`Edit spreadsheet`,"slides:presentation:create":`Create slides`,"slides:presentation:read":`View slides`,"slides:presentation:update":`Edit slides`,"slides:presentation:write_only":`Create and edit slides`,"space:document.event:read":`Subscribe to file-related events under folder`,"space:document:delete":`Delete folder and document in My Space`,"space:document:move":`Move folder and document in My Space`,"space:document:retrieve":`Get document list in My Space folder`,"space:document:shortcut":`Create document shortcut`,"space:folder:create":`Create folder in My Space`,"wiki:member:create":`Add wiki space member`,"wiki:member:retrieve":`View wiki space member list`,"wiki:member:update":`Update wiki space member`,"wiki:node:copy":`Create wiki space node copy`,"wiki:node:create":`Create wiki space node`,"wiki:node:move":`Move wiki space node`,"wiki:node:read":`View wiki space node information`,"wiki:node:retrieve":`View wiki space node list`,"wiki:node:update":`Update wiki space node information`,"wiki:setting:read":`View wiki space settings`,"wiki:setting:write_only":`Update wiki space settings`,"wiki:space:read":`View wiki space information`,"wiki:space:retrieve":`View wiki space list`,"wiki:space:write_only":`Create and update wiki space`,"wiki:wiki":`View, edit, and manage Wiki`,"wiki:wiki:readonly":`View all Wiki`};function Vc(e,t){return Bc[e]??t}function Hc(e){return e?.recommended.scopes.length?e.recommended.scopes:L.map(e=>({capability:e.capability,description:e.description,granted:!1,label:e.label,scope:e.scope}))}function Uc({n:e,alert:t=!1}){return(0,q.jsx)(`span`,{className:`flex h-[20px] w-[20px] shrink-0 items-center justify-center rounded-full font-sans text-[11px] font-medium ${t?`bg-health-error-soft text-health-error ring-1 ring-health-error/40`:`bg-canvas text-text-subtle`}`,children:e})}function Wc({anyGranted:e}){return(0,q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-health-error/30 bg-health-error-soft px-3 py-2`,children:[(0,q.jsx)(R,{className:`mt-0.5 h-4 w-4 shrink-0 text-health-error`,"aria-hidden":!0}),(0,q.jsx)(`div`,{className:`space-y-0.5`,children:e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`font-serif text-[13px] font-semibold leading-snug text-text`,children:`Some permissions aren’t active yet`}),(0,q.jsx)(`p`,{className:`font-serif text-[12px] leading-snug text-text-muted`,children:`The ones still marked below need granting in Feishu. Add them in the console, publish a new app version, then recheck.`})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`font-serif text-[13px] font-semibold leading-snug text-text`,children:`Not authorized yet.`}),(0,q.jsx)(`p`,{className:`font-serif text-[12px] leading-snug text-text-muted`,children:`Feishu hasn’t applied the new permissions. This usually means step 2 wasn’t published yet. Publish a new app version, then recheck. If you just published, give it a moment and recheck.`})]})})]})}function Gc({scopes:e,authUrl:n,authUrls:r,confirmedMissing:i,showPerms:a,onTogglePerms:o,onRecheck:c,isRechecking:l,statusLine:u,footer:d}){let f=a||i,p=r?.length?r:n?[{authUrl:n,label:`Recommended permissions`,scopes:[]}]:[];return(0,q.jsxs)(`div`,{className:`space-y-4 rounded-md border border-border-soft bg-surface px-4 py-4`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`div`,{className:`font-serif text-[15px] font-semibold leading-tight text-text`,children:`Authorize Feishu permissions`}),(0,q.jsx)(`p`,{className:`font-serif text-[13px] leading-relaxed text-text-muted`,children:`These let your Feishu bot recognize teammates by name, take part in group chats with people and other bots, look people up by email or phone, and work with Feishu Drive and cloud documents.`})]}),i&&(0,q.jsx)(Wc,{anyGranted:e.some(e=>e.granted)}),(0,q.jsxs)(`ol`,{className:`space-y-3.5`,children:[(0,q.jsxs)(`li`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(Uc,{n:1}),(0,q.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,q.jsx)(`span`,{className:`font-serif text-[13px] leading-snug text-text`,children:`Add the permissions`}),p.length>0&&(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`p`,{className:`font-serif text-[12px] leading-snug text-text-subtle`,children:`Open the groups you need in Feishu.`}),(0,q.jsx)(`div`,{className:`grid gap-1.5 sm:grid-cols-2`,children:p.map(e=>(0,q.jsxs)(g,{size:`sm`,variant:`outline`,className:`w-full justify-between`,render:(0,q.jsx)(`a`,{href:e.authUrl,rel:`noreferrer`,target:`_blank`}),children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,q.jsx)(t,{className:`h-3.5 w-3.5`,"aria-hidden":!0})]},`${e.label}:${e.authUrl}`))})]}),(0,q.jsxs)(`div`,{className:`pt-0.5`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:o,"aria-expanded":f,className:`inline-flex items-center gap-1 font-sans text-[12px] text-text-muted transition-colors hover:text-text`,children:[`Permissions`,(0,q.jsx)(G,{className:`h-3.5 w-3.5 transition-transform ${f?`rotate-180`:``}`,"aria-hidden":!0})]}),f&&(0,q.jsx)(`ul`,{className:`mt-2 max-h-72 space-y-1 overflow-y-auto pr-1`,children:e.map(e=>(0,q.jsxs)(`li`,{className:`flex items-start gap-2 font-serif text-[12px] leading-snug text-text-muted`,children:[i?e.granted?(0,q.jsx)(j,{className:`mt-[1px] h-3.5 w-3.5 shrink-0 text-health-ok`,strokeWidth:2.75,"aria-hidden":!0}):(0,q.jsx)(s,{className:`mt-[1px] h-3.5 w-3.5 shrink-0 text-health-error`,strokeWidth:2.75,"aria-hidden":!0}):(0,q.jsx)(`span`,{className:`mt-[7px] h-1 w-1 shrink-0 rounded-full bg-text-subtle/50`,"aria-hidden":!0}),(0,q.jsx)(`span`,{children:Vc(e.scope,e.label)})]},e.scope))})]})]})]}),(0,q.jsxs)(`li`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(Uc,{n:2,alert:i}),(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`span`,{className:`font-serif text-[13px] leading-snug text-text`,children:`Publish a new app version`}),(0,q.jsx)(`p`,{className:`font-serif text-[12px] leading-snug text-text-subtle`,children:`Feishu applies the new permissions only after you publish a version by hand.`})]})]}),(0,q.jsxs)(`li`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(Uc,{n:3}),(0,q.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,q.jsx)(`span`,{className:`font-serif text-[13px] leading-snug text-text`,children:`Verify access`}),(0,q.jsx)(`div`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:c,disabled:l,className:`inline-flex min-h-[44px] items-center justify-center gap-1 rounded-sm md:min-h-8 font-sans text-[12px] text-text-muted underline decoration-text-subtle/40 underline-offset-2 transition-colors hover:text-text hover:decoration-text/40 disabled:cursor-not-allowed disabled:opacity-50`,children:[l?(0,q.jsx)(E,{className:`h-3 w-3 animate-spin`}):(0,q.jsx)(de,{className:`h-3 w-3`,"aria-hidden":!0}),`Recheck access`]})})]})]})]}),u,d]})}function Kc(){return(0,q.jsx)(`p`,{className:`font-sans text-[13px] leading-relaxed text-text-muted`,children:`The owner is the person this agent answers to. The agent introduces itself to them and checks in. It's how it knows who it's working for.`})}function qc({agentId:e,onConfirm:t,onSkip:n,submitLabel:r=`Assign owner →`,skipLabel:i=`Skip for now →`,autoFocus:a=!0,showRationale:o=!1}){let s=(0,K.useId)(),c=`${s}-listbox`,l=e=>`${s}-option-${e}`,[d,p]=(0,K.useState)([]),[m,h]=(0,K.useState)(!0),[_,v]=(0,K.useState)(),[y,b]=(0,K.useState)(``),[x,S]=(0,K.useState)(!1),[C,T]=(0,K.useState)(-1),[E,D]=(0,K.useState)(``),[O,k]=(0,K.useState)(!0),[A,M]=(0,K.useState)(``),[N,P]=(0,K.useState)(!1),[F,I]=(0,K.useState)(),L=(0,K.useRef)(null),R=(0,K.useRef)(null),ee=(0,K.useRef)(null);(0,K.useEffect)(()=>{let t=!1;return w(e).then(e=>{t||(p(e),h(!1))}).catch(e=>{t||(v(e instanceof Error?e.message:`Could not load Slack members`),h(!1))}),()=>{t=!0}},[e]),(0,K.useEffect)(()=>{function e(e){L.current&&!L.current.contains(e.target)&&S(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,K.useEffect)(()=>{a&&!m&&setTimeout(()=>R.current?.focus(),50)},[a,m]);let z=d.find(e=>e.slackUserId===E),B=y.trim()?d.filter(e=>{let t=y.trim().toLowerCase();return e.displayName.toLowerCase().includes(t)||e.handle&&e.handle.toLowerCase().includes(t)}):d,V=x&&C>=0&&B[C]?l(B[C].slackUserId):void 0;(0,K.useEffect)(()=>{!x||C<0||document.getElementById(l(B[C]?.slackUserId??``))?.scrollIntoView({block:`nearest`})},[C,x]);function H(e){let t=e.target.value;b(t),S(!0),T(0),E&&t!==(z?.displayName??``)&&(D(``),I(void 0))}function U(){S(!0),E&&b(``)}function W(){z&&!x&&b(z.displayName)}function te(e){D(e.slackUserId),b(e.displayName),S(!1),T(-1),I(void 0)}function ne(e){if(!x){e.key===`ArrowDown`&&(S(!0),T(0),e.preventDefault());return}if(e.key===`Escape`)S(!1),T(-1),z&&b(z.displayName),e.preventDefault();else if(e.key===`ArrowDown`)T(e=>Math.min(e+1,B.length-1)),e.preventDefault();else if(e.key===`ArrowUp`)T(e=>Math.max(e-1,0)),e.preventDefault();else if(e.key===`Home`)T(0),e.preventDefault();else if(e.key===`End`)T(Math.max(B.length-1,0)),e.preventDefault();else if(e.key===`Enter`){e.preventDefault();let t=C>=0?B[C]:B[0];t&&te(t)}}async function G(){if(!(!E||N)){P(!0),I(void 0);try{await u(e,{slackUserId:E,introduce:O,...O&&A.trim()?{openerNote:A.trim()}:{}}),f(),t()}catch(e){I(e instanceof Error?e.message:`Could not assign owner`)}finally{P(!1)}}}return m?(0,q.jsxs)(`div`,{className:`space-y-3`,children:[o&&(0,q.jsx)(Kc,{}),(0,q.jsx)(`div`,{className:`font-sans text-[12px] text-text-muted`,children:`Loading Slack members…`})]}):_?(0,q.jsxs)(`div`,{className:`space-y-2`,children:[o&&(0,q.jsx)(Kc,{}),(0,q.jsx)(`div`,{className:`font-sans text-[12px] text-health-error`,children:_}),(0,q.jsx)(g,{variant:`ghost`,size:`sm`,onClick:()=>{h(!0),v(void 0),w(e).then(e=>{p(e),h(!1)}).catch(e=>{v(e instanceof Error?e.message:`Could not load Slack members`),h(!1)})},children:`Retry`})]}):(0,q.jsxs)(`div`,{className:`space-y-3`,children:[o&&(0,q.jsx)(Kc,{}),(0,q.jsxs)(`div`,{ref:L,className:`relative`,children:[(0,q.jsx)(`input`,{ref:R,role:`combobox`,"aria-expanded":x,"aria-controls":x?c:void 0,"aria-activedescendant":V,"aria-autocomplete":`list`,"aria-haspopup":`listbox`,type:`text`,value:y,onChange:H,onFocus:U,onBlur:W,onKeyDown:ne,placeholder:z?z.displayName:`Search by name or handle…`,disabled:N,className:`w-full rounded-sm border border-border-soft bg-surface px-3 py-2 font-sans text-[13px] text-text placeholder:text-text-subtle focus:border-accent focus:outline-none disabled:opacity-50`}),z&&!x&&(0,q.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 right-2 flex items-center`,children:(0,q.jsx)(j,{className:`h-3.5 w-3.5 text-accent`})}),x&&(0,q.jsx)(`div`,{ref:ee,id:c,role:`listbox`,"aria-label":`Slack members`,className:`absolute left-0 right-0 top-full z-50 mt-1 max-h-52 overflow-y-auto rounded-sm border border-border-soft bg-surface shadow-deep`,children:B.length===0?(0,q.jsx)(`div`,{role:`status`,className:`px-3 py-2 font-sans text-[12px] text-text-muted`,children:d.length===0?`No workspace members found.`:`No members match.`}):B.map((e,t)=>{let n=e.slackUserId===E,r=t===C;return(0,q.jsxs)(`div`,{id:l(e.slackUserId),role:`option`,"aria-selected":n,onMouseDown:t=>{t.preventDefault(),te(e)},onClick:()=>te(e),className:[`flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors`,r?`bg-accent/10`:n?`bg-accent/5`:`hover:bg-surface-elevated`].join(` `),children:[e.avatarUrl?(0,q.jsx)(`img`,{src:e.avatarUrl,alt:``,className:`h-6 w-6 shrink-0 rounded-sm object-cover`}):(0,q.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-sm bg-muted font-sans text-[10px] font-bold text-text-muted`,children:e.displayName.charAt(0).toUpperCase()}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block truncate font-serif text-[14px] text-text`,children:e.displayName}),e.handle&&(0,q.jsxs)(`span`,{className:`font-sans text-[11px] text-text-muted`,children:[`@`,e.handle]})]}),n&&(0,q.jsx)(j,{className:`h-3.5 w-3.5 shrink-0 text-accent`})]},e.slackUserId)})})]}),(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>k(e.target.checked),disabled:N,className:`h-4 w-4 accent-accent`}),(0,q.jsx)(`span`,{className:`font-sans text-[13px] text-text`,children:z?(0,q.jsxs)(q.Fragment,{children:[`Notify `,(0,q.jsx)(`span`,{className:`font-medium`,children:z.displayName}),` now`]}):`Notify the new owner now`})]}),(0,q.jsx)(`p`,{className:`font-sans pl-[26px] text-[11px] text-text-subtle`,children:`The agent will DM them to introduce itself.`})]}),O&&(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`label`,{className:`font-sans mb-1.5 block text-[12px] font-medium text-text-muted`,children:[`What should the agent know before it reaches out to`,` `,z?z.displayName:`its owner`,`?`,` `,(0,q.jsx)(`span`,{className:`font-normal`,children:`(optional)`})]}),(0,q.jsx)(`textarea`,{value:A,onChange:e=>M(e.target.value),placeholder:z?`e.g. I set this agent up to help ${z.displayName} with code review and deploys.`:`e.g. I set this agent up to help them with code review and deploys.`,rows:3,className:`w-full resize-none rounded-sm border border-border-soft bg-surface px-3 py-2 font-sans text-[13px] text-text placeholder:text-text-subtle focus:border-accent focus:outline-none`}),(0,q.jsxs)(`p`,{className:`font-sans mt-1 text-[11px] text-text-subtle`,children:[`Used as context for the agent's first message:`,` `,z?`so ${z.displayName} knows who set it up and why.`:`so the owner knows who set it up and why.`]})]}),F&&(0,q.jsx)(`div`,{className:`font-sans text-[12px] text-health-error`,children:F}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(g,{className:`w-full`,onClick:()=>void G(),disabled:N||!E,children:N?`Assigning…`:r}),n&&(0,q.jsx)(`div`,{className:`text-center`,children:(0,q.jsx)(`button`,{type:`button`,onClick:n,disabled:N,className:`font-sans text-[12px] text-text-muted underline decoration-text-muted/40 underline-offset-2 hover:text-text hover:decoration-text/40 transition-colors`,children:i})})]})]})}export{_e as A,nt as C,Oe as D,Le as E,ve as F,be as I,ue as L,he as M,ge as N,Te as O,ye as P,Un as S,Re as T,$s as _,Lc as a,Gn as b,Ic as c,pc as d,ic as f,tc as g,ec as h,Nc as i,fe as j,pe as k,gc as l,Zs as m,Gc as n,Pc as o,ac as p,Hc as r,Rc as s,qc as t,_c as u,Qs as v,Y as w,Wn as x,er as y};
|
|
1
|
+
import{$ as e,$t as t,B as n,Dr as r,Er as i,G as a,H as o,Ht as s,I as c,J as l,Jn as u,K as d,Kn as f,L as p,Ln as m,Mn as h,N as g,P as _,Q as v,R as y,Tr as b,U as x,V as S,W as C,Wn as w,X as T,Xt as E,Y as D,Z as O,at as k,bn as A,cn as j,ct as M,dt as N,et as P,fr as F,ft as I,g as L,in as R,it as ee,kr as z,lt as B,nr as V,nt as H,ot as U,pt as W,q as te,rt as ne,sn as G,st as re,t as ie,tt as ae,un as oe,ut as se,z as ce}from"./index-DlHETnHC.js";var le=oe(`chevron-up`,[[`path`,{d:`m18 15-6-6-6 6`,key:`153udz`}]]),ue=oe(`circle-check`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m9 12 2 2 4-4`,key:`dzmm74`}]]),de=oe(`rotate-cw`,[[`path`,{d:`M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8`,key:`1p45f6`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}]]);function fe(e,t){return e.map(e=>{if(!e.dynamicModels)return e;let n=me(e,t??null);return{...e,defaultModel:n?.defaultModel??``,models:n?.models??[]}})}function pe(e,t,n){if(!e)return[];let r=me(e,n??null);return A(e.kind,t,r)}function me(e,t){return t?.find(t=>t.kind===e.kind)}function he(e,t){if(!e?.dynamicModels)return;let n=me(e,t??null);if(!n?.checkedAt||!n.defaultModel||!n.models?.length)return`Model catalog not checked`;let r=new Date(n.checkedAt);return`Model catalog checked ${Number.isNaN(r.getTime())?n.checkedAt:r.toLocaleString()}`}function ge(e,t){if(!e||!t)return!1;let n=me(e,t);return n?.present===!0?!e.dynamicModels||!!(n.defaultModel&&n.models?.length):!1}function _e(e,t){return e.find(e=>ge(e,t))}function ve(e,t){if(!t)return`checking...`;let n=me(e,t);if(!n?.present)return`not installed`;if(e.dynamicModels&&(!n.defaultModel||!n.models?.length))return`models not checked`}function ye(e,t){if(!e||!t)return;let n=me(e,t);if(!n?.present)return e.installHint;if(e.dynamicModels&&(!n.defaultModel||!n.models?.length))return n.modelCheckError??`Sign in to this provider so Anima can read its current model catalog.`}function be(e,t){return t?e.flatMap(e=>{let n=ve(e,t),r=ye(e,t);return n&&r?[{kind:e.kind,label:e.label,status:n,hint:r}]:[]}):[]}var K=z(i()),xe=z(b()),q=F(),J=function(e){return e.disabled=`data-disabled`,e.valid=`data-valid`,e.invalid=`data-invalid`,e.touched=`data-touched`,e.dirty=`data-dirty`,e.filled=`data-filled`,e.focused=`data-focused`,e}({}),Se={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},Ce={valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},we={disabled:!1,...Ce},Te={valid(e){return e===null?null:e?{[J.valid]:``}:{[J.invalid]:``}}},Ee={invalid:void 0,name:void 0,validityData:{state:Se,errors:[],error:``,value:``,initialValue:null},setValidityData:ce,disabled:void 0,touched:Ce.touched,setTouched:ce,dirty:Ce.dirty,setDirty:ce,filled:Ce.filled,setFilled:ce,focused:Ce.focused,setFocused:ce,validate:()=>null,validationMode:`onSubmit`,validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:we,markedDirtyRef:{current:!1},registerFieldControl:ce,validation:{getValidationProps:(e=y)=>e,getInputValidationProps:(e=y)=>e,inputRef:{current:null},commit:async()=>{}}},De=K.createContext(Ee);function Oe(e=!0){let t=K.useContext(De);if(t.setValidityData===ce&&!e)throw Error(x(28));return t}var ke=K.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:ce,validationMode:`onSubmit`,submitAttemptedRef:{current:!1}});function Ae(){return K.useContext(ke)}var je=0;function Me(e,t=`mui`){let[n,r]=K.useState(e),i=e||n;return K.useEffect(()=>{n??(je+=1,r(`${t}-${je}`))},[n,t]),i}var Ne=l.useId;function Pe(e,t){if(Ne!==void 0){let n=Ne();return e??(t?`${t}-${n}`:n)}return Me(e,t)}function Fe(e){return Pe(e,`base-ui`)}var Ie=K.createContext({controlId:void 0,registerControlId:ce,labelId:void 0,setLabelId:ce,messageIds:[],setMessageIds:ce,getDescriptionProps:e=>e});function Le(){return K.useContext(Ie)}function Re(e={}){let{id:t,implicit:n=!1,controlRef:r}=e,{controlId:i,registerControlId:o}=Le(),s=Fe(t),c=n?i:void 0,l=te(()=>Symbol(`labelable-control`)),u=K.useRef(!1),f=K.useRef(t!=null),p=d(()=>{!u.current||o===ce||(u.current=!1,o(l.current,void 0))});return a(()=>{if(o===ce)return;let e;if(n){let n=r?.current;e=k(n)&&n.closest(`label`)!=null?t??null:c??s}else if(t!=null)f.current=!0,e=t;else if(f.current)e=s;else{p();return}if(e===void 0){p();return}u.current=!0,o(l.current,e)},[t,r,c,o,n,s,l,p]),K.useEffect(()=>p,[p]),i??s}function Y(e){return e?.ownerDocument||document}var ze=typeof navigator<`u`,Be=Je(),Ve=Xe(),He=Ye(),Ue=typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter:none`),We=Be.platform===`MacIntel`&&Be.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Be.platform);ze&&/firefox/i.test(He);var Ge=ze&&/apple/i.test(navigator.vendor);ze&&/Edg/i.test(He);var Ke=ze&&/android/i.test(Ve)||/android/i.test(He);ze&&Ve.toLowerCase().startsWith(`mac`)&&navigator.maxTouchPoints;var qe=He.includes(`jsdom/`);function Je(){if(!ze)return{platform:``,maxTouchPoints:-1};let e=navigator.userAgentData;return e?.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??``,maxTouchPoints:navigator.maxTouchPoints??-1}}function Ye(){if(!ze)return``;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:e,version:t})=>`${e}/${t}`).join(` `):navigator.userAgent}function Xe(){if(!ze)return``;let e=navigator.userAgentData;return e?.platform?e.platform:navigator.platform??``}var Ze=`data-base-ui-focusable`,Qe=`ArrowLeft`,$e=`ArrowRight`,et=`ArrowUp`,tt=`ArrowDown`;function nt(e){let t=e.activeElement;for(;t?.shadowRoot?.activeElement!=null;)t=t.shadowRoot.activeElement;return t}function X(e,t){if(!e||!t)return!1;let n=t.getRootNode?.();if(e.contains(t))return!0;if(n&&se(n)){let n=t;for(;n;){if(e===n)return!0;n=n.parentNode||n.host}}return!1}function rt(e){return`composedPath`in e?e.composedPath()[0]:e.target}function it(e,t){if(t==null)return!1;if(`composedPath`in e)return e.composedPath().includes(t);let n=e;return n.target!=null&&t.contains(n.target)}function at(e){return e.matches(`html,body`)}function ot(e){return U(e)&&e.matches(`input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])`)}function st(e){return e?e.getAttribute(`role`)===`combobox`&&ot(e):!1}function ct(e){return e?e.hasAttribute(`data-base-ui-focusable`)?e:e.querySelector(`[data-base-ui-focusable]`)||e:null}function lt(e,t,n=!0){return e.filter(e=>e.parentId===t).flatMap(t=>[...!n||t.context?.open?[t]:[],...lt(e,t.id,n)])}function ut(e,t){let n=[],r=e.find(e=>e.id===t)?.parentId;for(;r;){let t=e.find(e=>e.id===r);r=t?.parentId,t&&(n=n.concat(t))}return n}function dt(e){e.preventDefault(),e.stopPropagation()}function ft(e){return`nativeEvent`in e}function pt(e){return e.pointerType===``&&e.isTrusted?!0:Ke&&e.pointerType?e.type===`click`&&e.buttons===1:e.detail===0&&!e.pointerType}function mt(e){return qe?!1:!Ke&&e.width===0&&e.height===0||Ke&&e.width===1&&e.height===1&&e.pressure===0&&e.detail===0&&e.pointerType===`mouse`||e.width<1&&e.height<1&&e.pressure===0&&e.detail===0&&e.pointerType===`touch`}function ht(e,t){let n=[`mouse`,`pen`];return t||n.push(``,void 0),n.includes(e)}function gt(e){let t=e.type;return t===`click`||t===`mousedown`||t===`keydown`||t===`keyup`}var _t=[`top`,`right`,`bottom`,`left`],vt=Math.min,yt=Math.max,bt=Math.round,xt=Math.floor,St=e=>({x:e,y:e}),Ct={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function wt(e,t,n){return yt(e,vt(t,n))}function Tt(e,t){return typeof e==`function`?e(t):e}function Et(e){return e.split(`-`)[0]}function Dt(e){return e.split(`-`)[1]}function Ot(e){return e===`x`?`y`:`x`}function kt(e){return e===`y`?`height`:`width`}function At(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function jt(e){return Ot(At(e))}function Mt(e,t,n){n===void 0&&(n=!1);let r=Dt(e),i=jt(e),a=kt(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Vt(o)),[o,Vt(o)]}function Nt(e){let t=Vt(e);return[Pt(e),t,Pt(t)]}function Pt(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var Ft=[`left`,`right`],It=[`right`,`left`],Lt=[`top`,`bottom`],Rt=[`bottom`,`top`];function zt(e,t,n){switch(e){case`top`:case`bottom`:return n?t?It:Ft:t?Ft:It;case`left`:case`right`:return t?Lt:Rt;default:return[]}}function Bt(e,t,n,r){let i=Dt(e),a=zt(Et(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Pt)))),a}function Vt(e){let t=Et(e);return Ct[t]+e.slice(t.length)}function Ht(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ut(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ht(e)}function Wt(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Gt(e,t,n){return Math.floor(e/t)!==n}function Kt(e,t){return t<0||t>=e.length}function qt(e,t){return Yt(e.current,{disabledIndices:t})}function Jt(e,t){return Yt(e.current,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function Yt(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:i=1}={}){let a=t;do a+=n?-i:i;while(a>=0&&a<=e.length-1&&en(e,a,r));return a}function Xt(e,{event:t,orientation:n,loopFocus:r,onLoop:i,rtl:a,cols:o,disabledIndices:s,minIndex:c,maxIndex:l,prevIndex:u,stopEvent:d=!1}){let f=u,p;if(t.key===`ArrowUp`?p=`up`:t.key===`ArrowDown`&&(p=`down`),p){let n=[],a=[],m=!1,h=0;{let t=null,r=-1;e.forEach((e,i)=>{if(e==null)return;h+=1;let o=e.closest(`[role="row"]`);o&&(m=!0),(o!==t||r===-1)&&(t=o,r+=1,n[r]=[]),n[r].push(i),a[i]=r})}let g=!1,_=0;if(m)for(let e of n){let t=e.length;t>_&&(_=t),t!==o&&(g=!0)}let v=g&&h<e.length,y=_||o,b=o=>{if(!g||u===-1)return;let c=a[u];if(c==null)return;let l=n[c].indexOf(u),d=o===`up`?-1:1;for(let o=c+d,f=0;f<n.length;f+=1,o+=d){if(o<0||o>=n.length){if(!r||v)return;if(o=o<0?n.length-1:0,i){let e=Math.min(l,n[o].length-1);o=a[i(t,u,n[o][e]??n[o][0])]??o}}let c=n[o];for(let t=Math.min(l,c.length-1);t>=0;--t){let n=c[t];if(!en(e,n,s))return n}}},x=t=>{if(!v||u===-1)return;let n=u%y,i=t===`up`?-y:y,a=l-l%y,o=xt(l/y)+1;for(let t=u-n+i,c=0;c<o;c+=1,t+=i){if(t<0||t>l){if(!r)return;t=t<0?a:0}let i=Math.min(t+y-1,l);for(let r=Math.min(t+n,i);r>=t;--r)if(!en(e,r,s))return r}};d&&dt(t);let S=b(p)??x(p);if(S!==void 0)f=S;else if(u===-1)f=p===`up`?l:c;else if(f=Yt(e,{startingIndex:u,amount:y,decrement:p===`up`,disabledIndices:s}),r){if(p===`up`&&(u-y<c||f<0)){let e=u%y,n=l%y,r=l-(n-e);f=n===e?l:n>e?r:r-y,i&&(f=i(t,u,f))}p===`down`&&u+y>l&&(f=Yt(e,{startingIndex:u%y-y,amount:y,disabledIndices:s}),i&&(f=i(t,u,f)))}Kt(e,f)&&(f=u)}if(n===`both`){let n=xt(u/o);t.key===(a?`ArrowLeft`:`ArrowRight`)&&(d&&dt(t),u%o===o-1?r&&(f=Yt(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):(f=Yt(e,{startingIndex:u,disabledIndices:s}),r&&Gt(f,o,n)&&(f=Yt(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f)))),Gt(f,o,n)&&(f=u)),t.key===(a?`ArrowRight`:`ArrowLeft`)&&(d&&dt(t),u%o===0?r&&(f=Yt(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f))):(f=Yt(e,{startingIndex:u,decrement:!0,disabledIndices:s}),r&&Gt(f,o,n)&&(f=Yt(e,{startingIndex:u+(o-u%o),decrement:!0,disabledIndices:s}),i&&(f=i(t,u,f)))),Gt(f,o,n)&&(f=u));let c=xt(l/o)===n;Kt(e,f)&&(r&&c?(f=t.key===(a?`ArrowRight`:`ArrowLeft`)?l:Yt(e,{startingIndex:u-u%o-1,disabledIndices:s}),i&&(f=i(t,u,f))):f=u)}return f}function Zt(e,t,n){let r=[],i=0;return e.forEach(({width:e,height:a},o)=>{let s=!1;for(n&&(i=0);!s;){let n=[];for(let r=0;r<e;r+=1)for(let e=0;e<a;e+=1)n.push(i+r+e*t);i%t+e<=t&&n.every(e=>r[e]==null)?(n.forEach(e=>{r[e]=o}),s=!0):i+=1}}),[...r]}function Qt(e,t,n,r,i){if(e===-1)return-1;let a=n.indexOf(e),o=t[e];switch(i){case`tl`:return a;case`tr`:return o?a+o.width-1:a;case`bl`:return o?a+(o.height-1)*r:a;case`br`:return n.lastIndexOf(e);default:return-1}}function $t(e,t){return t.flatMap((t,n)=>e.includes(t)?[n]:[])}function en(e,t,n){if(typeof n==`function`?n(t):n?.includes(t)??!1)return!0;let r=e[t];return r?nn(r)?!n&&(r.hasAttribute(`disabled`)||r.getAttribute(`aria-disabled`)===`true`):!0:!1}function tn(e){return e.visibility===`hidden`||e.visibility===`collapse`}function nn(e,t=e?D(e):null){return!e||!e.isConnected||!t||tn(t)?!1:typeof e.checkVisibility==`function`?e.checkVisibility():t.display!==`none`&&t.display!==`contents`}var rn=`a[href],button,input,select,textarea,summary,details,iframe,object,embed,[tabindex],[contenteditable]:not([contenteditable="false"]),audio[controls],video[controls]`;function an(e){let t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;let n=e.getRootNode();return se(n)?n.host:null}function on(t){for(let n of Array.from(t.children))if(e(n)===`summary`)return n;return null}function sn(e,t){let n=on(t);return!!n&&(e===n||X(n,e))}function cn(t){let n=t?e(t):``;return t!=null&&t.matches(rn)&&(n!==`summary`||t.parentElement!=null&&e(t.parentElement)===`details`&&on(t.parentElement)===t)&&(n!==`details`||on(t)==null)&&(n!==`input`||t.type!==`hidden`)}function ln(t){if(!cn(t)||!t.isConnected||t.matches(`:disabled`))return!1;for(let n=t;n;n=an(n)){let r=n!==t,i=e(n)===`slot`;if(n.hasAttribute(`inert`)||r&&e(n)===`details`&&!n.open&&!sn(t,n)||n.hasAttribute(`hidden`)||!i&&!un(n,r))return!1}return!0}function un(e,t){let n=D(e);return t?n.display!==`none`:nn(e,n)}function dn(t){let n=t.tabIndex;if(n<0){let n=e(t);if(n===`details`||n===`audio`||n===`video`||U(t)&&t.isContentEditable)return 0}return n}function fn(t){if(e(t)!==`input`)return null;let n=t;return n.type===`radio`&&n.name!==``?n:null}function pn(e,t){let n=fn(e);if(!n)return!0;let r=t.find(e=>{let t=fn(e);return t?.name===n.name&&t.form===n.form&&t.checked});return r?r===n:t.find(e=>{let t=fn(e);return t?.name===n.name&&t.form===n.form})===n}function mn(t){if(U(t)&&e(t)===`slot`){let e=t.assignedElements({flatten:!0});if(e.length>0)return e}return U(t)&&t.shadowRoot?Array.from(t.shadowRoot.children):Array.from(t.children)}function hn(e,t){mn(e).forEach(e=>{cn(e)&&t.push(e),hn(e,t)})}function gn(e,t,n){mn(e).forEach(e=>{U(e)&&e.matches(t)&&n.push(e),gn(e,t,n)})}function _n(e){return ln(e)&&dn(e)>=0}function vn(e){let t=[];return hn(e,t),t.filter(ln)}function yn(e){let t=vn(e);return t.filter(e=>dn(e)>=0&&pn(e,t))}function bn(e,t){let n=yn(e),r=n.length;if(r===0)return;let i=nt(Y(e)),a=n.indexOf(i);return n[a===-1?t===1?0:r-1:a+t]}function xn(e){return bn(Y(e).body,1)||e}function Sn(e){return bn(Y(e).body,-1)||e}function Cn(e,t){let n=t||e.currentTarget,r=e.relatedTarget;return!r||!X(n,r)}function wn(e){yn(e).forEach(e=>{e.dataset.tabindex=e.getAttribute(`tabindex`)||``,e.setAttribute(`tabindex`,`-1`)})}function Tn(e){let t=[];gn(e,`[data-tabindex]`,t),t.forEach(e=>{let t=e.dataset.tabindex;delete e.dataset.tabindex,t?e.setAttribute(`tabindex`,t):e.removeAttribute(`tabindex`)})}var En=[];function Dn(e){K.useEffect(e,En)}var On=0,kn=class e{static create(){return new e}currentId=On;start(e,t){this.clear(),this.currentId=setTimeout(()=>{this.currentId=On,t()},e)}isStarted(){return this.currentId!==On}clear=()=>{this.currentId!==On&&(clearTimeout(this.currentId),this.currentId=On)};disposeEffect=()=>this.clear};function An(){let e=te(kn.create).current;return Dn(e.disposeEffect),e}var jn=null;globalThis.requestAnimationFrame;var Mn=new class{callbacks=[];callbacksCount=0;nextId=1;startId=1;isScheduled=!1;tick=e=>{this.isScheduled=!1;let t=this.callbacks,n=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,n>0)for(let n=0;n<t.length;n+=1)t[n]?.(e)};request(e){let t=this.nextId;return this.nextId+=1,this.callbacks.push(e),this.callbacksCount+=1,this.isScheduled||=(requestAnimationFrame(this.tick),!0),t}cancel(e){let t=e-this.startId;t<0||t>=this.callbacks.length||(this.callbacks[t]=null,--this.callbacksCount)}},Nn=class e{static create(){return new e}static request(e){return Mn.request(e)}static cancel(e){return Mn.cancel(e)}currentId=jn;request(e){this.cancel(),this.currentId=Mn.request(()=>{this.currentId=jn,e()})}cancel=()=>{this.currentId!==jn&&(Mn.cancel(this.currentId),this.currentId=jn)};disposeEffect=()=>this.cancel};function Pn(){let e=te(Nn.create).current;return Dn(e.disposeEffect),e}function Fn(e){return e==null?e:`current`in e?e.current:e}var In=function(e){return e.startingStyle=`data-starting-style`,e.endingStyle=`data-ending-style`,e}({}),Ln={[In.startingStyle]:``},Rn={[In.endingStyle]:``},zn={transitionStatus(e){return e===`starting`?Ln:e===`ending`?Rn:null}};function Bn(e,t=!1,n=!0){let r=Pn();return d((i,a=null)=>{r.cancel();let o=Fn(e);if(o==null)return;let s=o,c=()=>{xe.flushSync(i)};if(typeof s.getAnimations!=`function`||globalThis.BASE_UI_ANIMATIONS_DISABLED){i();return}function l(){Promise.all(s.getAnimations().map(e=>e.finished)).then(()=>{a?.aborted||c()}).catch(()=>{if(n){a?.aborted||c();return}let e=s.getAnimations();!a?.aborted&&e.length>0&&e.some(e=>e.pending||e.playState!==`finished`)&&l()})}if(t){let e=In.startingStyle;if(!s.hasAttribute(e)){r.request(l);return}let t=new MutationObserver(()=>{s.hasAttribute(e)||(t.disconnect(),l())});t.observe(s,{attributes:!0,attributeFilter:[e]}),a?.addEventListener(`abort`,()=>t.disconnect(),{once:!0});return}r.request(l)})}function Vn(e){let{enabled:t=!0,open:n,ref:r,onComplete:i}=e,a=d(i),o=Bn(r,n,!1);K.useEffect(()=>{if(!t)return;let e=new AbortController;return o(a,e.signal),()=>{e.abort()}},[t,n,a,o])}function Hn(e,t=!1,n=!1){let[r,i]=K.useState(e&&t?`idle`:void 0),[o,s]=K.useState(e);return e&&!o&&(s(!0),i(`starting`)),!e&&o&&r!==`ending`&&!n&&i(`ending`),!e&&!o&&r===`ending`&&i(void 0),a(()=>{if(!e&&o&&r!==`ending`&&n){let e=Nn.request(()=>{i(`ending`)});return()=>{Nn.cancel(e)}}},[e,o,r,n]),a(()=>{if(!e||t)return;let n=Nn.request(()=>{i(void 0)});return()=>{Nn.cancel(n)}},[t,e]),a(()=>{if(!e||!t)return;e&&o&&r!==`idle`&&i(`starting`);let n=Nn.request(()=>{i(`idle`)});return()=>{Nn.cancel(n)}},[t,e,o,r]),{mounted:o,setMounted:s,transitionStatus:r}}function Un({controlled:e,default:t,name:n,state:r=`value`}){let{current:i}=K.useRef(e!==void 0),[a,o]=K.useState(t);return[i?e:a,K.useCallback(e=>{i||o(e)},[])]}function Wn(e,t,n,r,i=!0){let{registerFieldControl:o}=Oe(),s=K.useRef(null);s.current||=Symbol(),a(()=>{let a=s.current;if(!(!a||!i))return o(a,{controlRef:e,getValue:r,id:t,value:n}),()=>{o(a,void 0)}},[e,i,r,t,o,n])}var Gn=`none`,Kn=`trigger-press`,qn=`outside-press`,Jn=`item-press`,Yn=`focus-out`,Xn=`escape-key`,Zn=`list-navigation`,Qn=`cancel-open`,$n=`window-resize`;function er(e,t,n,r){let i=!1,a=!1,o=r??y;return{reason:e,event:t??new Event(`base-ui`),cancel(){i=!0},allowPropagation(){a=!0},get isCanceled(){return i},get isPropagationAllowed(){return a},trigger:n,...o}}var tr={clipPath:`inset(50%)`,overflow:`hidden`,whiteSpace:`nowrap`,border:0,padding:0,width:1,height:1,margin:-1},nr={...tr,position:`fixed`,top:0,left:0},rr={...tr,position:`absolute`};function ir(e){let t=K.useRef(!0);t.current&&(t.current=!1,e())}function ar(e){let[t,n]=K.useState({current:e,previous:null});return e!==t.current&&n({current:e,previous:t.current}),t.previous}function or(e){let t=te(sr,e).current;return t.next=e,a(t.effect),t}function sr(e){let t={current:e,next:e,effect:()=>{t.current=t.next}};return t}var Z=(e,t,n,r,i,a,...o)=>{if(o.length>0)throw Error(x(1));let s;if(e&&t&&n&&r&&i&&a)s=(o,s,c,l)=>a(e(o,s,c,l),t(o,s,c,l),n(o,s,c,l),r(o,s,c,l),i(o,s,c,l),s,c,l);else if(e&&t&&n&&r&&i)s=(a,o,s,c)=>i(e(a,o,s,c),t(a,o,s,c),n(a,o,s,c),r(a,o,s,c),o,s,c);else if(e&&t&&n&&r)s=(i,a,o,s)=>r(e(i,a,o,s),t(i,a,o,s),n(i,a,o,s),a,o,s);else if(e&&t&&n)s=(r,i,a,o)=>n(e(r,i,a,o),t(r,i,a,o),i,a,o);else if(e&&t)s=(n,r,i,a)=>t(e(n,r,i,a),r,i,a);else if(e)s=e;else throw Error(`Missing arguments`);return s},cr=r((e=>{var t=i();function n(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var r=typeof Object.is==`function`?Object.is:n,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!r(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),lr=r(((e,t)=>{t.exports=cr()})),ur=r((e=>{var t=i(),n=lr();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:r,o=n.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),dr=r(((e,t)=>{t.exports=ur()})),fr=lr(),pr=dr(),mr=[],hr=void 0;function gr(){return hr}function _r(e){mr.push(e)}var vr=n(19)?br:xr;function Q(e,t,n,r,i){return vr(e,t,n,r,i)}function yr(e,t,n,r,i){let a=K.useCallback(()=>t(e.getSnapshot(),n,r,i),[e,t,n,r,i]);return(0,fr.useSyncExternalStore)(e.subscribe,a,a)}_r({before(e){e.syncIndex=0,e.didInitialize||(e.syncTick=1,e.syncHooks=[],e.didChangeStore=!0,e.getSnapshot=()=>{let t=!1;for(let n=0;n<e.syncHooks.length;n+=1){let r=e.syncHooks[n],i=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,i))&&(t=!0,r.value=i,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{let n=new Set;for(let t of e.syncHooks)n.add(t.store);let r=[];for(let e of n)r.push(e.subscribe(t));return()=>{for(let e of r)e()}}),(0,fr.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getSnapshot))}});function br(e,t,n,r,i){let a=gr();if(!a)return yr(e,t,n,r,i);let o=a.syncIndex;a.syncIndex+=1;let s;return a.didInitialize?(s=a.syncHooks[o],(s.store!==e||s.selector!==t||!Object.is(s.a1,n)||!Object.is(s.a2,r)||!Object.is(s.a3,i))&&(s.store!==e&&(a.didChangeStore=!0),s.store=e,s.selector=t,s.a1=n,s.a2=r,s.a3=i,s.didChange=!0)):(s={store:e,selector:t,a1:n,a2:r,a3:i,value:t(e.getSnapshot(),n,r,i),didChange:!1},a.syncHooks.push(s)),s.value}function xr(e,t,n,r,i){return(0,pr.useSyncExternalStoreWithSelector)(e.subscribe,e.getSnapshot,e.getSnapshot,e=>t(e,n,r,i))}var Sr=class{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;let t=this.updateTick;for(let n of this.listeners){if(t!==this.updateTick)return;n(e)}}update(e){for(let t in e)if(!Object.is(this.state[t],e[t])){this.setState({...this.state,...e});return}}set(e,t){Object.is(this.state[e],t)||this.setState({...this.state,[e]:t})}notifyAll(){let e={...this.state};this.setState(e)}use(e,t,n,r){return Q(this,e,t,n,r)}},Cr=class extends Sr{constructor(e,t={},n){super(e),this.context=t,this.selectors=n}useSyncedValue(e,t){K.useDebugValue(e);let n=this;a(()=>{n.state[e]!==t&&n.set(e,t)},[n,e,t])}useSyncedValueWithCleanup(e,t){let n=this;a(()=>(n.state[e]!==t&&n.set(e,t),()=>{n.set(e,void 0)}),[n,e,t])}useSyncedValues(e){let t=this;a(()=>{t.update(e)},[t,...Object.values(e)])}useControlledProp(e,t){K.useDebugValue(e);let n=this,r=t!==void 0;a(()=>{r&&!Object.is(n.state[e],t)&&n.setState({...n.state,[e]:t})},[n,e,t,r])}select(e,t,n,r){let i=this.selectors[e];return i(this.state,t,n,r)}useState(e,t,n,r){return K.useDebugValue(e),Q(this,this.selectors[e],t,n,r)}useContextCallback(e,t){K.useDebugValue(e);let n=d(t??ce);this.context[e]=n}useStateSetter(e){let t=K.useRef(void 0);return t.current===void 0&&(t.current=t=>{this.set(e,t)}),t.current}observe(e,t){let n;n=typeof e==`function`?e:this.selectors[e];let r=n(this.state);return t(r,r,this),this.subscribe(e=>{let i=n(e);if(!Object.is(r,i)){let e=r;r=i,t(i,e,this)}})}};function wr(...e){return()=>{for(let t=0;t<e.length;t+=1){let n=e[t];n&&n()}}}function Tr(e,t,n,r){return e.addEventListener(t,n,r),()=>{e.removeEventListener(t,n,r)}}var Er=K.forwardRef(function(e,t){let[n,r]=K.useState();a(()=>{Ge&&r(`button`)},[]);let i={tabIndex:0,role:n};return(0,q.jsx)(`span`,{...e,ref:t,style:nr,"aria-hidden":n?void 0:!0,...i,"data-base-ui-focus-guard":``})});function Dr(e){return`data-base-ui-${e}`}var Or=0;function kr(e,t={}){let{preventScroll:n=!1,sync:r=!1,shouldFocus:i}=t;cancelAnimationFrame(Or);function a(){i&&!i()||e?.focus({preventScroll:n})}if(r)return a(),ce;let o=requestAnimationFrame(a);return Or=o,()=>{Or===o&&(cancelAnimationFrame(o),Or=0)}}var Ar={inert:new WeakMap,"aria-hidden":new WeakMap},jr=`data-base-ui-inert`,Mr={inert:new WeakSet,"aria-hidden":new WeakSet},Nr=new WeakMap,Pr=0;function Fr(e){return Mr[e]}function Ir(e){return e?se(e)?e.host:Ir(e.parentNode):null}var Lr=(e,t)=>t.map(t=>{if(e.contains(t))return t;let n=Ir(t);return e.contains(n)?n:null}).filter(e=>e!=null),Rr=e=>{let t=new Set;return e.forEach(e=>{let n=e;for(;n&&!t.has(n);)t.add(n),n=n.parentNode}),t},zr=(t,n,r)=>{let i=[],a=t=>{!t||r.has(t)||Array.from(t.children).forEach(t=>{e(t)!==`script`&&(n.has(t)?a(t):i.push(t))})};return a(t),i};function Br(e,t,n,r,{mark:i=!0,markerIgnoreElements:a=[]}){let o=r?`inert`:n?`aria-hidden`:null,s=null,c=null,l=Lr(t,e),u=i?Lr(t,a):[],d=new Set(u),f=i?zr(t,Rr(l),new Set(l)).filter(e=>!d.has(e)):[],p=[],m=[];if(o){let e=Ar[o],n=Fr(o);c=n,s=e;let r=Lr(t,Array.from(t.querySelectorAll(`[aria-live]`))),i=l.concat(r);zr(t,Rr(i),new Set(i)).forEach(t=>{let r=t.getAttribute(o),i=r!==null&&r!==`false`,a=(e.get(t)||0)+1;e.set(t,a),p.push(t),a===1&&i&&n.add(t),i||t.setAttribute(o,o===`inert`?``:`true`)})}return i&&f.forEach(e=>{let t=(Nr.get(e)||0)+1;Nr.set(e,t),m.push(e),t===1&&e.setAttribute(jr,``)}),Pr+=1,()=>{s&&p.forEach(e=>{let t=(s.get(e)||0)-1;s.set(e,t),t||(!c?.has(e)&&o&&e.removeAttribute(o),c?.delete(e))}),i&&m.forEach(e=>{let t=(Nr.get(e)||0)-1;Nr.set(e,t),t||e.removeAttribute(jr)}),--Pr,Pr||(Ar.inert=new WeakMap,Ar[`aria-hidden`]=new WeakMap,Mr.inert=new WeakSet,Mr[`aria-hidden`]=new WeakSet,Nr=new WeakMap)}}function Vr(e,t={}){let{ariaHidden:n=!1,inert:r=!1,mark:i=!0,markerIgnoreElements:a=[]}=t,o=Y(e[0]).body;return Br(e,o,n,r,{mark:i,markerIgnoreElements:a})}var Hr={style:{transition:`none`}},Ur={fallbackAxisSide:`none`},Wr={clipPath:`inset(50%)`,position:`fixed`,top:0,left:0},Gr=K.createContext(null),Kr=()=>K.useContext(Gr),qr=Dr(`portal`);function Jr(e={}){let{ref:t,container:n,componentProps:r=y,elementProps:i}=e,o=Pe(),s=Kr()?.portalNode,[l,u]=K.useState(null),[f,p]=K.useState(null),m=d(e=>{e!==null&&p(e)}),h=K.useRef(null);a(()=>{if(n===null){h.current&&(h.current=null,p(null),u(null));return}if(o==null)return;let e=(n&&(M(n)?n:n.current))??s??document.body;if(e==null){h.current&&(h.current=null,p(null),u(null));return}h.current!==e&&(h.current=e,p(null),u(e))},[n,s,o]);let g=c(`div`,r,{ref:[t,m],props:[{id:o,[qr]:``},i]});return{portalNode:f,portalSubtree:l&&g?xe.createPortal(g,l):null}}var Yr=K.forwardRef(function(e,t){let{render:n,className:r,style:i,children:a,container:o,renderGuards:s,...c}=e,{portalNode:l,portalSubtree:u}=Jr({container:o,ref:t,componentProps:e,elementProps:c}),d=K.useRef(null),f=K.useRef(null),p=K.useRef(null),m=K.useRef(null),[h,g]=K.useState(null),_=K.useRef(!1),v=h?.modal,y=h?.open,b=typeof s==`boolean`?s:!!h&&!h.modal&&h.open&&!!l;K.useEffect(()=>{if(!l||v)return;function e(e){l&&e.relatedTarget&&Cn(e)&&(e.type===`focusin`?_.current&&=(Tn(l),!1):(wn(l),_.current=!0))}return wr(Tr(l,`focusin`,e,!0),Tr(l,`focusout`,e,!0))},[l,v]),K.useEffect(()=>{!l||y!==!1||(Tn(l),_.current=!1)},[y,l]);let x=K.useMemo(()=>({beforeOutsideRef:d,afterOutsideRef:f,beforeInsideRef:p,afterInsideRef:m,portalNode:l,setFocusManagerState:g}),[l]);return(0,q.jsxs)(K.Fragment,{children:[u,(0,q.jsxs)(Gr.Provider,{value:x,children:[b&&l&&(0,q.jsx)(Er,{"data-type":`outside`,ref:d,onFocus:e=>{Cn(e,l)?p.current?.focus():Sn(h?h.domReference:null)?.focus()}}),b&&l&&(0,q.jsx)(`span`,{"aria-owns":l.id,style:Wr}),l&&xe.createPortal(a,l),b&&l&&(0,q.jsx)(Er,{"data-type":`outside`,ref:f,onFocus:e=>{Cn(e,l)?m.current?.focus():(xn(h?h.domReference:null)?.focus(),h?.closeOnFocusOut&&h?.onOpenChange(!1,er(`focus-out`,e.nativeEvent)))}})]})]})});function Xr(){let e=new Map;return{emit(t,n){e.get(t)?.forEach(e=>e(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){e.get(t)?.delete(n)}}}var Zr=K.createContext(null),Qr=K.createContext(null),$r=()=>K.useContext(Zr)?.id||null,ei=e=>{let t=K.useContext(Qr);return e??t};function ti(e,t){let n=ne(rt(e));return e instanceof n.KeyboardEvent?`keyboard`:e instanceof n.FocusEvent?t||`keyboard`:`pointerType`in e?e.pointerType||`keyboard`:`touches`in e?`touch`:e instanceof n.MouseEvent?t||(e.detail===0?`keyboard`:`mouse`):``}var ni=20,ri=[];function ii(){ri=ri.filter(e=>e.deref()?.isConnected)}function ai(t){ii(),t&&e(t)!==`body`&&(ri.push(new WeakRef(t)),ri.length>ni&&(ri=ri.slice(-20)))}function oi(){return ii(),ri[ri.length-1]?.deref()}function si(e){return e?_n(e)?e:yn(e)[0]||e:null}function ci(e,t){if(e.hasAttribute(`tabindex`)&&!e.hasAttribute(`data-tabindex`)||!t.current.includes(`floating`)&&!e.getAttribute(`role`)?.includes(`dialog`))return;let n=vn(e).filter(e=>{let t=e.getAttribute(`data-tabindex`)||``;return _n(e)||e.hasAttribute(`data-tabindex`)&&!t.startsWith(`-`)}),r=e.getAttribute(`tabindex`);t.current.includes(`floating`)||n.length===0?r!==`0`&&e.setAttribute(`tabindex`,`0`):(r!==`-1`||e.hasAttribute(`data-tabindex`)&&e.getAttribute(`data-tabindex`)!==`-1`)&&(e.setAttribute(`tabindex`,`-1`),e.setAttribute(`data-tabindex`,`-1`))}function li(e){let{context:t,children:n,disabled:r=!1,initialFocus:i=!0,returnFocus:o=!0,restoreFocus:s=!1,modal:c=!0,closeOnFocusOut:l=!0,openInteractionType:u=``,nextFocusableElement:f,previousFocusableElement:p,beforeContentFocusGuardRef:m,externalTree:h,getInsideElements:g}=e,_=`rootStore`in t?t.rootStore:t,v=_.useState(`open`),y=_.useState(`domReferenceElement`),b=_.useState(`floatingElement`),{events:x,dataRef:C}=_.context,w=d(()=>C.current.floatingContext?.nodeId),T=i===!1,E=st(y)&&T,D=K.useRef([`content`]),O=or(i),k=or(o),A=or(u),j=ei(h),M=Kr(),N=K.useRef(!1),P=K.useRef(!1),F=K.useRef(!1),I=K.useRef(null),L=K.useRef(``),R=K.useRef(``),ee=K.useRef(null),z=K.useRef(null),B=S(ee,m,M?.beforeInsideRef),V=S(z,M?.afterInsideRef),H=An(),W=An(),te=Pn(),ne=M!=null,G=ct(b),re=d((e=G)=>e?yn(e):[]),ie=d(()=>g?.().filter(e=>e!=null)??[]);K.useEffect(()=>{if(r||!c)return;function e(e){e.key===`Tab`&&X(G,nt(Y(G)))&&re().length===0&&!E&&dt(e)}return Tr(Y(G),`keydown`,e)},[r,G,c,E,re]),K.useEffect(()=>{if(r||!v)return;let e=Y(G);function t(){F.current=!1}function n(e){let t=rt(e),n=ie();F.current=!(X(b,t)||X(y,t)||X(M?.portalNode,t)||n.some(e=>e===t||X(e,t))),R.current=e.pointerType||`keyboard`,t?.closest(`[data-base-ui-click-trigger]`)&&(P.current=!0)}function i(){R.current=`keyboard`}return wr(Tr(e,`pointerdown`,n,!0),Tr(e,`pointerup`,t,!0),Tr(e,`pointercancel`,t,!0),Tr(e,`keydown`,i,!0))},[r,b,y,G,v,M,ie]),K.useEffect(()=>{if(r||!l)return;let e=Y(G);function t(){P.current=!0,W.start(0,()=>{P.current=!1})}function n(e){let t=rt(e);_n(t)&&(I.current=t)}function i(t){let n=t.relatedTarget,r=t.currentTarget,i=rt(t);queueMicrotask(()=>{let a=w(),o=_.context.triggerElements,l=ie(),u=n?.hasAttribute(Dr(`focus-guard`))&&[ee.current,z.current,M?.beforeInsideRef.current,M?.afterInsideRef.current,M?.beforeOutsideRef.current,M?.afterOutsideRef.current,Fn(p),Fn(f)].includes(n),d=!(X(y,n)||X(b,n)||X(n,b)||X(M?.portalNode,n)||l.some(e=>e===n||X(e,n))||n!=null&&o.hasElement(n)||o.hasMatchingElement(e=>X(e,n))||u||j&&(lt(j.nodesRef.current,a).find(e=>X(e.context?.elements.floating,n)||X(e.context?.elements.domReference,n))||ut(j.nodesRef.current,a).find(e=>[e.context?.elements.floating,ct(e.context?.elements.floating)].includes(n)||e.context?.elements.domReference===n)));if(r===y&&G&&ci(G,D),s&&r!==y&&!nn(i)&&nt(e)===e.body){if(U(G)&&(G.focus(),s===`popup`)){te.request(()=>{G.focus()});return}let e=re(),t=I.current,n=(t&&e.includes(t)?t:null)||e[e.length-1]||G;U(n)&&n.focus()}if(C.current.insideReactTree){C.current.insideReactTree=!1;return}(E||!c)&&n&&d&&!P.current&&(E||n!==oi())&&(N.current=!0,_.setOpen(!1,er(Yn,t)))})}function a(){F.current||(C.current.insideReactTree=!0,H.start(0,()=>{C.current.insideReactTree=!1}))}let o=U(y)?y:null;if(!(!b&&!o))return wr(o&&Tr(o,`focusout`,i),o&&Tr(o,`pointerdown`,t),b&&Tr(b,`focusin`,n),b&&Tr(b,`focusout`,i),b&&M&&Tr(b,`focusout`,a,!0))},[r,y,b,G,c,j,M,_,l,s,re,E,w,D,C,H,W,te,f,p,ie]),K.useEffect(()=>{if(r||!b||!v)return;let e=Array.from(M?.portalNode?.querySelectorAll(`[${Dr(`portal`)}]`)||[]),t=(j?ut(j.nodesRef.current,w()):[]).find(e=>st(e.context?.elements.domReference||null))?.context?.elements.domReference,n=Vr([b,...e,ee.current,z.current,M?.beforeOutsideRef.current,M?.afterOutsideRef.current,...ie(),t,Fn(p),Fn(f),E?y:null].filter(e=>e!=null),{ariaHidden:c||E,mark:!1}),i=Vr([b,...e].filter(e=>e!=null));return()=>{i(),n()}},[v,r,y,b,c,M,E,j,w,f,p,ie]),a(()=>{if(!v||r||!U(G))return;let e=Y(G),t=nt(e);queueMicrotask(()=>{let n=O.current,r=typeof n==`function`?n(A.current||``):n;if(r===void 0||r===!1||X(G,t))return;let i=null,a=()=>(i??=re(G),i[0]||G),o;o=r===!0||r===null?a():Fn(r),o||=a();let s=X(G,nt(e));kr(o,{preventScroll:o===G,shouldFocus(){if(s)return!0;let t=nt(e);return!(t!==o&&X(G,t))}})})},[r,v,G,re,O,A]),a(()=>{if(r||!G)return;let e=Y(G);ai(nt(e));function t(e){if(e.open||(L.current=ti(e.nativeEvent,R.current)),e.reason===`trigger-hover`&&e.nativeEvent.type===`mouseleave`&&(N.current=!0),e.reason===`outside-press`)if(e.nested)N.current=!1;else if(pt(e.nativeEvent)||mt(e.nativeEvent))N.current=!1;else{let e=!1;Y(G).createElement(`div`).focus({get preventScroll(){return e=!0,!1}}),e?N.current=!1:N.current=!0}}x.on(`openchange`,t);function n(){let e=k.current,t=typeof e==`function`?e(L.current):e;if(t===void 0||t===!1)return null;if(t===null&&(t=!0),typeof t==`boolean`)return y?.isConnected?y:oi()||null;let n=y?.isConnected?y:oi();return Fn(t)||n||null}return()=>{x.off(`openchange`,t);let r=nt(e),i=ie(),a=X(b,r)||i.some(e=>e===r||X(e,r))||j&<(j.nodesRef.current,w(),!1).some(e=>X(e.context?.elements.floating,r)),o=k.current,s=n();queueMicrotask(()=>{let t=si(s),n=typeof o!=`boolean`;o&&!N.current&&U(t)&&(!(!n&&t!==r&&r!==e.body)||a)&&t.focus({preventScroll:!0}),N.current=!1})}},[r,b,G,k,x,j,y,w,ie]),a(()=>{if(!Ue||v||!b)return;let e=nt(Y(b));!U(e)||!ot(e)||X(b,e)&&e.blur()},[v,b]),a(()=>{if(!(r||!M))return M.setFocusManagerState({modal:c,closeOnFocusOut:l,open:v,onOpenChange:_.setOpen,domReference:y}),()=>{M.setFocusManagerState(null)}},[r,M,c,v,_,l,y]),a(()=>{if(!(r||!G))return ci(G,D),()=>{queueMicrotask(ii)}},[r,G,D]);let ae=!r&&(c?!E:!0)&&(ne||c);return(0,q.jsxs)(K.Fragment,{children:[ae&&(0,q.jsx)(Er,{"data-type":`inside`,ref:B,onFocus:e=>{if(c){let e=re();kr(e[e.length-1])}else M?.portalNode&&(N.current=!1,Cn(e,M.portalNode)?xn(y)?.focus():Fn(p??M.beforeOutsideRef)?.focus())}}),n,ae&&(0,q.jsx)(Er,{"data-type":`inside`,ref:V,onFocus:e=>{c?kr(re()[0]):M?.portalNode&&(l&&(N.current=!0),Cn(e,M.portalNode)?Sn(y)?.focus():Fn(f??M.afterOutsideRef)?.focus())}})]})}function ui(e,t={}){let{enabled:n=!0,event:r=`click`,toggle:i=!0,ignoreMouse:a=!1,stickIfOpen:o=!0,touchOpenDelay:s=0,reason:c=Kn}=t,l=`rootStore`in e?e.rootStore:e,u=l.context.dataRef,d=K.useRef(void 0),f=Pn(),p=An(),m=K.useMemo(()=>{function e(e,t,n,r){let i=er(c,t,n);e&&r===`touch`&&s>0?p.start(s,()=>{l.setOpen(!0,i)}):l.setOpen(e,i)}function t(e,t,n){let r=u.current.openEvent,a=l.select(`domReferenceElement`)!==t;return e&&a||!e||!i?!0:r&&o?!n(r.type):!1}return{onPointerDown(e){d.current=e.pointerType},onMouseDown(n){let i=d.current,o=n.nativeEvent,s=l.select(`open`);if(n.button!==0||r===`click`||ht(i,!0)&&a)return;let c=t(s,n.currentTarget,e=>e===`click`||e===`mousedown`),u=rt(o);if(ot(u)){e(c,o,u,i);return}let p=n.currentTarget;f.request(()=>{e(c,o,p,i)})},onClick(n){if(r===`mousedown-only`)return;let i=d.current;if(r===`mousedown`&&i){d.current=void 0;return}ht(i,!0)&&a||e(t(l.select(`open`),n.currentTarget,e=>e===`click`||e===`mousedown`||e===`keydown`||e===`keyup`),n.nativeEvent,n.currentTarget,i)},onKeyDown(){d.current=void 0}}},[u,r,a,c,l,o,i,f,p,s]);return K.useMemo(()=>n?{reference:m}:y,[n,m])}var di={intentional:`onClick`,sloppy:`onPointerDown`};function fi(){return!1}function pi(e){return{escapeKey:typeof e==`boolean`?e:e?.escapeKey??!1,outsidePress:typeof e==`boolean`?e:e?.outsidePress??!0}}function mi(e,t={}){let{enabled:n=!0,escapeKey:r=!0,outsidePress:i=!0,outsidePressEvent:a=`sloppy`,referencePress:o=fi,referencePressEvent:s=`sloppy`,bubbles:c,externalTree:l}=t,u=`rootStore`in e?e.rootStore:e,f=u.useState(`open`),p=u.useState(`floatingElement`),{dataRef:m}=u.context,h=ei(l),g=d(typeof i==`function`?i:()=>!1),_=typeof i==`function`?g:i,v=_!==!1,y=d(()=>a),{escapeKey:b,outsidePress:x}=pi(c),S=K.useRef(!1),C=K.useRef(!1),w=K.useRef(!1),T=K.useRef(!1),E=K.useRef(``),O=K.useRef(null),A=An(),j=An(),M=d(()=>{j.clear(),m.current.insideReactTree=!1}),N=d(e=>{let t=m.current.floatingContext?.nodeId;return(h?lt(h.nodesRef.current,t):[]).some(t=>t.context?.open&&!t.context.dataRef.current[e])}),P=d(e=>it(e,u.select(`floatingElement`))||it(e,u.select(`domReferenceElement`))),F=d(e=>{o()&&u.setOpen(!1,er(Kn,e.nativeEvent))}),I=d(e=>{if(!f||!n||!r||e.key!==`Escape`||T.current||!b&&N(`__escapeKeyBubbles`))return;let t=er(Xn,ft(e)?e.nativeEvent:e);u.setOpen(!1,t),t.isCanceled||e.preventDefault(),!b&&!t.isPropagationAllowed&&e.stopPropagation()}),L=d(()=>{m.current.insideReactTree=!0,j.start(0,M)}),R=d(e=>{if(!f||!n||e.button!==0)return;let t=rt(e.nativeEvent);X(u.select(`floatingElement`),t)&&(S.current||(S.current=!0,C.current=!1))}),ee=d(e=>{!f||!n||(e.defaultPrevented||e.nativeEvent.defaultPrevented)&&S.current&&(C.current=!0)});K.useEffect(()=>{if(!f||!n)return;m.current.__escapeKeyBubbles=b,m.current.__outsidePressBubbles=x;let e=new kn,t=new kn;function i(){e.clear(),T.current=!0}function a(){e.start(W()?5:0,()=>{T.current=!1})}function o(){w.current=!0,t.start(0,()=>{w.current=!1})}function s(){S.current=!1,C.current=!1}function c(){let e=E.current,t=e===`pen`||!e?`mouse`:e,n=y(),r=typeof n==`function`?n():n;return typeof r==`string`?r:r[t]}function l(e){let t=c();return t===`intentional`&&e.type!==`click`||t===`sloppy`&&e.type===`click`}function d(e){let t=m.current.floatingContext?.nodeId,n=h&<(h.nodesRef.current,t).some(t=>it(e,t.context?.elements.floating));return P(e)||n}function g(e){if(l(e)){e.type!==`click`&&!P(e)&&(t.clear(),w.current=!1),M();return}if(m.current.insideReactTree){M();return}let n=rt(e),r=`[${Dr(`inert`)}]`,i=k(n)?n.getRootNode():null,a=Array.from((se(i)?i:Y(u.select(`floatingElement`))).querySelectorAll(r)),o=u.context.triggerElements;if(n&&(o.hasElement(n)||o.hasMatchingElement(e=>X(e,n))))return;let s=k(n)?n:null;for(;s&&!re(s);){let e=H(s);if(re(e)||!k(e))break;s=e}if(!(a.length&&k(n)&&!at(n)&&!X(n,u.select(`floatingElement`))&&a.every(e=>!X(s,e)))){if(U(n)&&!(`touches`in e)){let t=re(n),r=D(n),i=/auto|scroll/,a=t||i.test(r.overflowX),o=t||i.test(r.overflowY),s=a&&n.clientWidth>0&&n.scrollWidth>n.clientWidth,c=o&&n.clientHeight>0&&n.scrollHeight>n.clientHeight,l=r.direction===`rtl`,u=c&&(l?e.offsetX<=n.offsetWidth-n.clientWidth:e.offsetX>n.clientWidth),d=s&&e.offsetY>n.clientHeight;if(u||d)return}if(!d(e)){if(c()===`intentional`&&w.current){t.clear(),w.current=!1;return}typeof _==`function`&&!_(e)||N(`__outsidePressBubbles`)||(u.setOpen(!1,er(qn,e)),M())}}}function j(e){c()!==`sloppy`||e.pointerType===`touch`||!u.select(`open`)||!n||P(e)||g(e)}function F(e){if(c()!==`sloppy`||!u.select(`open`)||!n||P(e))return;let t=e.touches[0];t&&(O.current={startTime:Date.now(),startX:t.clientX,startY:t.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},A.start(1e3,()=>{O.current&&(O.current.dismissOnTouchEnd=!1,O.current.dismissOnMouseDown=!1)}))}function L(e,t){let n=rt(e);if(!n)return;let r=Tr(n,e.type,()=>{t(e),r()})}function R(e){E.current=`touch`,L(e,F)}function ee(e){A.clear(),e.type===`pointerdown`&&(E.current=e.pointerType),!(e.type===`mousedown`&&O.current&&!O.current.dismissOnMouseDown)&&L(e,e=>{e.type===`pointerdown`?j(e):g(e)})}function z(e){if(!S.current)return;let n=C.current;if(s(),c()===`intentional`){if(e.type===`pointercancel`){n&&o();return}if(!d(e)){if(n){o();return}typeof _==`function`&&!_(e)||(t.clear(),w.current=!0,M())}}}function B(e){if(c()!==`sloppy`||!O.current||P(e))return;let t=e.touches[0];if(!t)return;let n=Math.abs(t.clientX-O.current.startX),r=Math.abs(t.clientY-O.current.startY),i=Math.sqrt(n*n+r*r);i>5&&(O.current.dismissOnTouchEnd=!0),i>10&&(g(e),A.clear(),O.current=null)}function V(e){L(e,B)}function te(e){c()!==`sloppy`||!O.current||P(e)||(O.current.dismissOnTouchEnd&&g(e),A.clear(),O.current=null)}function ne(e){L(e,te)}let G=Y(p),ie=wr(r&&wr(Tr(G,`keydown`,I),Tr(G,`compositionstart`,i),Tr(G,`compositionend`,a)),v&&wr(Tr(G,`click`,ee,!0),Tr(G,`pointerdown`,ee,!0),Tr(G,`pointerup`,z,!0),Tr(G,`pointercancel`,z,!0),Tr(G,`mousedown`,ee,!0),Tr(G,`mouseup`,z,!0),Tr(G,`touchstart`,R,!0),Tr(G,`touchmove`,V,!0),Tr(G,`touchend`,ne,!0)));return()=>{ie(),e.clear(),t.clear(),s(),w.current=!1}},[m,p,r,v,_,f,n,b,x,I,M,y,N,P,h,u,A]),K.useEffect(M,[_,M]);let z=K.useMemo(()=>({onKeyDown:I,[di[s]]:F,...s!==`intentional`&&{onClick:F}}),[I,F,s]),B=K.useMemo(()=>({onKeyDown:I,onPointerDown:ee,onMouseDown:ee,onClickCapture:L,onMouseDownCapture(e){L(),R(e)},onPointerDownCapture(e){L(),R(e)},onMouseUpCapture:L,onTouchEndCapture:L,onTouchMoveCapture:L}),[I,L,R,ee]);return K.useMemo(()=>n?{reference:z,floating:B,trigger:z}:{},[n,z,B])}function hi(e,t,n){let{reference:r,floating:i}=e,a=At(t),o=jt(t),s=kt(o),c=Et(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(Dt(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function gi(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=Tt(t,e),p=Ut(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Wt(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=Wt(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var _i=50,vi=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:gi},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=hi(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<_i&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=hi(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},yi=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=Tt(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=Et(r),_=At(o),v=Et(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Vt(o)]:Nt(o)),x=p!==`none`;!d&&x&&b.push(...Bt(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Mt(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==At(t))||T.every(e=>At(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=At(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function bi(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function xi(e){return _t.some(t=>e[t]>=0)}var Si=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=Tt(e,t);switch(i){case`referenceHidden`:{let e=bi(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:xi(e)}}}case`escaped`:{let e=bi(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:xi(e)}}}default:return{}}}}},Ci=new Set([`left`,`top`]);async function wi(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=Et(n),s=Dt(n),c=At(n)===`y`,l=Ci.has(o)?-1:1,u=a&&c?-1:1,d=Tt(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Ti=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await wi(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ei=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=Tt(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=At(Et(i)),p=Ot(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=wt(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=wt(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Di=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=Tt(e,t),u={x:n,y:r},d=At(i),f=Ot(d),p=u[f],m=u[d],h=Tt(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ci.has(Et(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Oi=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=Tt(e,t),u=await o.detectOverflow(t,l),d=Et(i),f=Dt(i),p=At(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=vt(h-u[g],v),x=vt(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=yt(u.left,0),t=yt(u.right,0),n=yt(u.top,0),r=yt(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:yt(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:yt(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function ki(e){let t=D(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=U(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=bt(n)!==a||bt(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function Ai(e){return k(e)?e:e.contextElement}function ji(e){let t=Ai(e);if(!U(t))return St(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ki(t),o=(a?bt(n.width):n.width)/r,s=(a?bt(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var Mi=St(0);function Ni(e){let t=ne(e);return!W()||!t.visualViewport?Mi:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Pi(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ne(e)?!1:t}function Fi(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=Ai(e),o=St(1);t&&(r?k(r)&&(o=ji(r)):o=ji(e));let s=Pi(a,n,r)?Ni(a):St(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=ne(a),t=r&&k(r)?ne(r):r,n=e,i=v(n);for(;i&&r&&t!==n;){let e=ji(i),t=i.getBoundingClientRect(),r=D(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=ne(i),i=v(n)}}return Wt({width:u,height:d,x:c,y:l})}function Ii(e,t){let n=P(e).scrollLeft;return t?t.left+n:Fi(O(e)).left+n}function Li(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-Ii(e,n),y:n.top+t.scrollTop}}function Ri(t){let{elements:n,rect:r,offsetParent:i,strategy:a}=t,o=a===`fixed`,s=O(i),c=n?I(n.floating):!1;if(i===s||c&&o)return r;let l={scrollLeft:0,scrollTop:0},u=St(1),d=St(0),f=U(i);if((f||!f&&!o)&&((e(i)!==`body`||B(s))&&(l=P(i)),f)){let e=Fi(i);u=ji(i),d.x=e.x+i.clientLeft,d.y=e.y+i.clientTop}let p=s&&!f&&!o?Li(s,l):St(0);return{width:r.width*u.x,height:r.height*u.y,x:r.x*u.x-l.scrollLeft*u.x+d.x+p.x,y:r.y*u.y-l.scrollTop*u.y+d.y+p.y}}function zi(e){return Array.from(e.getClientRects())}function Bi(e){let t=O(e),n=P(e),r=e.ownerDocument.body,i=yt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=yt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Ii(e),s=-n.scrollTop;return D(r).direction===`rtl`&&(o+=yt(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Vi=25;function Hi(e,t){let n=ne(e),r=O(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=W();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=Ii(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Vi&&(a-=o)}else l<=Vi&&(a+=l);return{width:a,height:o,x:s,y:c}}function Ui(e,t){let n=Fi(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=U(e)?ji(e):St(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Wi(e,t,n){let r;if(t===`viewport`)r=Hi(e,n);else if(t===`document`)r=Bi(O(e));else if(k(t))r=Ui(t,n);else{let n=Ni(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Wt(r)}function Gi(e,t){let n=H(e);return n===t||!k(n)||re(n)?!1:D(n).position===`fixed`||Gi(n,t)}function Ki(t,n){let r=n.get(t);if(r)return r;let i=ae(t,[],!1).filter(t=>k(t)&&e(t)!==`body`),a=null,o=D(t).position===`fixed`,s=o?H(t):t;for(;k(s)&&!re(s);){let e=D(s),n=ee(s);!n&&e.position===`fixed`&&(a=null),(o?!n&&!a:!n&&e.position===`static`&&a&&(a.position===`absolute`||a.position===`fixed`)||B(s)&&!n&&Gi(t,s))?i=i.filter(e=>e!==s):a=e,s=H(s)}return n.set(t,i),i}function qi(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?I(t)?[]:Ki(t,this._c):[].concat(n),r],o=Wi(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=Wi(t,a[e],i);s=yt(n.top,s),c=vt(n.right,c),l=vt(n.bottom,l),u=yt(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Ji(e){let{width:t,height:n}=ki(e);return{width:t,height:n}}function Yi(t,n,r){let i=U(n),a=O(n),o=r===`fixed`,s=Fi(t,!0,o,n),c={scrollLeft:0,scrollTop:0},l=St(0);function u(){l.x=Ii(a)}if(i||!i&&!o)if((e(n)!==`body`||B(a))&&(c=P(n)),i){let e=Fi(n,!0,o,n);l.x=e.x+n.clientLeft,l.y=e.y+n.clientTop}else a&&u();o&&!i&&a&&u();let d=a&&!i&&!o?Li(a,c):St(0);return{x:s.left+c.scrollLeft-l.x-d.x,y:s.top+c.scrollTop-l.y-d.y,width:s.width,height:s.height}}function Xi(e){return D(e).position===`static`}function Zi(e,t){if(!U(e)||D(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return O(e)===n&&(n=n.ownerDocument.body),n}function Qi(e,t){let n=ne(e);if(I(e))return n;if(!U(e)){let t=H(e);for(;t&&!re(t);){if(k(t)&&!Xi(t))return t;t=H(t)}return n}let r=Zi(e,t);for(;r&&N(r)&&Xi(r);)r=Zi(r,t);return r&&re(r)&&Xi(r)&&!ee(r)?n:r||T(e)||n}var $i=async function(e){let t=this.getOffsetParent||Qi,n=this.getDimensions,r=await n(e.floating);return{reference:Yi(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function ea(e){return D(e).direction===`rtl`}var ta={convertOffsetParentRelativeRectToViewportRelativeRect:Ri,getDocumentElement:O,getClippingRect:qi,getOffsetParent:Qi,getElementRects:$i,getClientRects:zi,getDimensions:Ji,getScale:ji,isElement:k,isRTL:ea};function na(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function ra(e,t){let n=null,r,i=O(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=xt(d),h=xt(i.clientWidth-(u+f)),g=xt(i.clientHeight-(d+p)),_=xt(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:yt(0,vt(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!na(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function ia(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=Ai(e),u=i||a?[...l?ae(l):[],...t?ae(t):[]]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?ra(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&t&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),t&&p.observe(t));let m,h=c?Fi(e):null;c&&g();function g(){let t=Fi(e);h&&!na(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var aa=Ti,oa=Ei,sa=yi,ca=Oi,la=Si,ua=Di,da=(e,t,n)=>{let r=new Map,i={platform:ta,...n},a={...i.platform,_c:r};return vi(e,t,{...i,platform:a})},fa=typeof document<`u`?K.useLayoutEffect:function(){};function pa(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!pa(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!pa(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function ma(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function ha(e,t){let n=ma(e);return Math.round(t*n)/n}function ga(e){let t=K.useRef(e);return fa(()=>{t.current=e}),t}function _a(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=K.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=K.useState(r);pa(f,r)||p(r);let[m,h]=K.useState(null),[g,_]=K.useState(null),v=K.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=K.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=K.useRef(null),C=K.useRef(null),w=K.useRef(u),T=c!=null,E=ga(c),D=ga(i),O=ga(l),k=K.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),da(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!pa(w.current,t)&&(w.current=t,xe.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);fa(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=K.useRef(!1);fa(()=>(A.current=!0,()=>{A.current=!1}),[]),fa(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=K.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=K.useMemo(()=>({reference:b,floating:x}),[b,x]),N=K.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=ha(M.floating,u.x),r=ha(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...ma(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return K.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var va=(e,t)=>{let n=aa(e);return{name:n.name,fn:n.fn,options:[e,t]}},ya=(e,t)=>{let n=oa(e);return{name:n.name,fn:n.fn,options:[e,t]}},ba=(e,t)=>({fn:ua(e).fn,options:[e,t]}),xa=(e,t)=>{let n=sa(e);return{name:n.name,fn:n.fn,options:[e,t]}},Sa=(e,t)=>{let n=ca(e);return{name:n.name,fn:n.fn,options:[e,t]}},Ca=(e,t)=>{let n=la(e);return{name:n.name,fn:n.fn,options:[e,t]}},wa={open:Z(e=>e.open),transitionStatus:Z(e=>e.transitionStatus),domReferenceElement:Z(e=>e.domReferenceElement),referenceElement:Z(e=>e.positionReference??e.referenceElement),floatingElement:Z(e=>e.floatingElement),floatingId:Z(e=>e.floatingId)},Ta=class extends Cr{constructor(e){let{syncOnly:t,nested:n,onOpenChange:r,triggerElements:i,...a}=e;super({...a,positionReference:a.referenceElement,domReferenceElement:a.referenceElement},{onOpenChange:r,dataRef:{current:{}},events:Xr(),nested:n,triggerElements:i},wa),this.syncOnly=t}syncOpenEvent=(e,t)=>{(!e||!this.state.open||t!=null&>(t))&&(this.context.dataRef.current.openEvent=e?t:void 0)};dispatchOpenChange=(e,t)=>{this.syncOpenEvent(e,t.event);let n={open:e,reason:t.reason,nativeEvent:t.event,nested:this.context.nested,triggerElement:t.trigger};this.context.events.emit(`openchange`,n)};setOpen=(e,t)=>{if(this.syncOnly){this.context.onOpenChange?.(e,t);return}this.dispatchOpenChange(e,t),this.context.onOpenChange?.(e,t)}},Ea={tabIndex:-1,[Ze]:``},Da=class{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(e,t){let n=this.idMap.get(e);n!==t&&(n!==void 0&&this.elementsSet.delete(n),this.elementsSet.add(t),this.idMap.set(e,t))}delete(e){let t=this.idMap.get(e);t&&(this.elementsSet.delete(t),this.idMap.delete(e))}hasElement(e){return this.elementsSet.has(e)}hasMatchingElement(e){for(let t of this.elementsSet)if(e(t))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 Oa(e){let{open:t=!1,onOpenChange:n,elements:r={}}=e,i=Pe(),o=$r()!=null,s=te(()=>new Ta({open:t,transitionStatus:void 0,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Da,floatingId:i,syncOnly:!1,nested:o})).current;return a(()=>{let e={open:t,floatingId:i};r.reference!==void 0&&(e.referenceElement=r.reference,e.domReferenceElement=k(r.reference)?r.reference:null),r.floating!==void 0&&(e.floatingElement=r.floating),s.update(e)},[t,i,r.reference,r.floating,s]),s.context.onOpenChange=n,s.context.nested=o,s}function ka(e={}){let{nodeId:t,externalTree:n}=e,r=Oa(e),i=e.rootContext||r,o=i.useState(`referenceElement`),s=i.useState(`floatingElement`),c=i.useState(`domReferenceElement`),l=i.useState(`open`),u=i.useState(`floatingId`),[d,f]=K.useState(null),[p,m]=K.useState(void 0),[h,g]=K.useState(void 0),_=K.useRef(null),v=ei(n),y=K.useMemo(()=>({reference:o,floating:s,domReference:c}),[o,s,c]),b=_a({...e,elements:{...y,...d&&{reference:d}}}),x=k(p)?p:null,S=h===void 0?i.state.floatingElement:h;i.useSyncedValue(`referenceElement`,p??null),i.useSyncedValue(`domReferenceElement`,p===void 0?c:x),i.useSyncedValue(`floatingElement`,S);let C=K.useCallback(e=>{let t=k(e)?{getBoundingClientRect:()=>e.getBoundingClientRect(),getClientRects:()=>e.getClientRects(),contextElement:e}:e;f(t),b.refs.setReference(t)},[b.refs]),w=K.useCallback(e=>{(k(e)||e===null)&&(_.current=e,m(e)),(k(b.refs.reference.current)||b.refs.reference.current===null||e!==null&&!k(e))&&b.refs.setReference(e)},[b.refs,m]),T=K.useCallback(e=>{g(e),b.refs.setFloating(e)},[b.refs]),E=K.useMemo(()=>({...b.refs,setReference:w,setFloating:T,setPositionReference:C,domReference:_}),[b.refs,w,T,C]),D=K.useMemo(()=>({...b.elements,domReference:c}),[b.elements,c]),O=K.useMemo(()=>({...b,dataRef:i.context.dataRef,open:l,onOpenChange:i.setOpen,events:i.context.events,floatingId:u,refs:E,elements:D,nodeId:t,rootStore:i}),[b,E,D,t,i,l,u]);return a(()=>{c&&(_.current=c)},[c]),a(()=>{i.context.dataRef.current.floatingContext=O;let e=v?.nodesRef.current.find(e=>e.id===t);e&&(e.context=O)}),K.useMemo(()=>({...b,context:O,refs:E,elements:D,rootStore:i}),[b,E,D,O,i])}var Aa=`Escape`;function ja(e,t,n){switch(e){case`vertical`:return t;case`horizontal`:return n;default:return t||n}}function Ma(e,t){return ja(t,e===`ArrowUp`||e===`ArrowDown`,e===`ArrowLeft`||e===`ArrowRight`)}function Na(e,t,n){return ja(t,e===`ArrowDown`,n?e===`ArrowLeft`:e===`ArrowRight`)||e===`Enter`||e===` `||e===``}function Pa(e,t,n){return ja(t,n?e===Qe:e===$e,e===tt)}function Fa(e,t,n,r){return t===`both`||t===`horizontal`&&r&&r>1?e===Aa:ja(t,n?e===$e:e===Qe,e===et)}function Ia(e,t){let{listRef:n,activeIndex:r,onNavigate:i=()=>{},enabled:o=!0,selectedIndex:s=null,allowEscape:c=!1,loopFocus:l=!1,nested:u=!1,rtl:f=!1,virtual:p=!1,focusItemOnOpen:m=`auto`,focusItemOnHover:h=!0,openOnArrowKeyDown:g=!0,disabledIndices:_=void 0,orientation:v=`vertical`,parentOrientation:y,cols:b=1,id:x,resetOnPointerLeave:S=!0,externalTree:C}=t,w=`rootStore`in e?e.rootStore:e,T=w.useState(`open`),E=w.useState(`floatingElement`),D=w.useState(`domReferenceElement`),O=w.context.dataRef,k=ct(E),A=st(D),j=or(k),M=$r(),N=ei(C),P=K.useRef(m),F=K.useRef(s??-1),I=K.useRef(null),L=K.useRef(!0),R=d(e=>{i(F.current===-1?null:F.current,e)}),ee=K.useRef(R),z=K.useRef(!!E),B=K.useRef(T),V=K.useRef(!1),H=K.useRef(!1),W=K.useRef(null),te=or(_),ne=or(T),G=or(s),re=or(S),ie=Pn(),ae=Pn(),oe=d(()=>{function e(e){p?N?.events.emit(`virtualfocus`,e):W.current=kr(e,{sync:V.current,preventScroll:!0})}let t=n.current[F.current],r=H.current;t&&e(t),(V.current?e=>e():e=>ie.request(e))(()=>{let i=n.current[F.current]||t;i&&(t||e(i),fe&&(r||!L.current)&&i.scrollIntoView?.({block:`nearest`,inline:`nearest`}))})});a(()=>{O.current.orientation=v},[O,v]),a(()=>{o&&(T&&E?(F.current=s??-1,P.current&&s!=null&&(H.current=!0,R())):z.current&&(F.current=-1,ee.current()))},[o,T,E,s,R]),a(()=>{if(o){if(!T){V.current=!1;return}if(E)if(r==null){if(V.current=!1,G.current!=null)return;if(z.current&&(F.current=-1,oe()),(!B.current||!z.current)&&P.current&&(I.current!=null||P.current===!0&&I.current==null)){let e=0,t=()=>{n.current[0]==null?(e<2&&(e?e=>ae.request(e):queueMicrotask)(t),e+=1):(F.current=I.current==null||Na(I.current,v,f)||u?qt(n):Jt(n),I.current=null,R())};t()}}else Kt(n.current,r)||(F.current=r,oe(),H.current=!1)}},[o,T,E,r,G,u,n,v,f,R,oe,ae]),a(()=>{if(!o||E||!N||p||!z.current)return;let e=N.nodesRef.current,t=e.find(e=>e.id===M)?.context?.elements.floating,n=nt(Y(E)),r=e.some(e=>e.context&&X(e.context.elements.floating,n));t&&!r&&L.current&&t.focus({preventScroll:!0})},[o,E,N,M,p]),a(()=>{ee.current=R,B.current=T,z.current=!!E}),a(()=>{T||(I.current=null,P.current=m)},[T,m]);let se=r!=null,ce=d(e=>{if(!ne.current)return;let t=n.current.indexOf(e.currentTarget);t!==-1&&(F.current!==t||r!==t)&&(F.current=t,R(e))}),le=d(()=>y??N?.nodesRef.current.find(e=>e.id===M)?.context?.dataRef?.current.orientation),ue=d(()=>qt(n,te.current)),de=d(e=>{if(L.current=!1,V.current=!0,e.which===229||!ne.current&&e.currentTarget===j.current)return;if(u&&Fa(e.key,v,f,b)){Ma(e.key,le())||dt(e),w.setOpen(!1,er(Zn,e.nativeEvent)),U(D)&&(p?N?.events.emit(`virtualfocus`,D):D.focus());return}let t=F.current,r=qt(n,_),i=Jt(n,_);if(A||(e.key===`Home`&&(dt(e),F.current=r,R(e)),e.key===`End`&&(dt(e),F.current=i,R(e))),b>1){let t=Array.from({length:n.current.length},()=>({width:1,height:1})),a=Zt(t,b,!1),o=a.findIndex(e=>e!=null&&!en(n.current,e,_)),s=a.reduce((e,t,r)=>t!=null&&!en(n.current,t,_)?r:e,-1),c=a[Xt(a.map(e=>e==null?null:n.current[e]),{event:e,orientation:v,loopFocus:l,rtl:f,cols:b,disabledIndices:$t([...(typeof _==`function`?null:_)||n.current.map((e,t)=>en(n.current,t,_)?t:void 0),void 0],a),minIndex:o,maxIndex:s,prevIndex:Qt(F.current>i?r:F.current,t,a,b,e.key===`ArrowDown`?`bl`:e.key===(f?`ArrowLeft`:`ArrowRight`)?`tr`:`tl`),stopEvent:!0})];if(c!=null&&(F.current=c,R(e)),v===`both`)return}if(Ma(e.key,v)){if(dt(e),T&&!p&&nt(e.currentTarget.ownerDocument)===e.currentTarget){F.current=Na(e.key,v,f)?r:i,R(e);return}Na(e.key,v,f)?l?t>=i?c&&t!==n.current.length?F.current=-1:(V.current=!1,F.current=r):F.current=Yt(n.current,{startingIndex:t,disabledIndices:_}):F.current=Math.min(i,Yt(n.current,{startingIndex:t,disabledIndices:_})):l?t<=r?c&&t!==-1?F.current=n.current.length:(V.current=!1,F.current=i):F.current=Yt(n.current,{startingIndex:t,decrement:!0,disabledIndices:_}):F.current=Math.max(r,Yt(n.current,{startingIndex:t,decrement:!0,disabledIndices:_})),Kt(n.current,F.current)&&(F.current=-1),R(e)}}),fe=K.useMemo(()=>({onFocus(e){V.current=!0,ce(e)},onClick:({currentTarget:e})=>e.focus({preventScroll:!0}),onMouseMove(e){V.current=!0,H.current=!1,h&&ce(e)},onPointerLeave(e){if(!ne.current||!L.current||e.pointerType===`touch`)return;V.current=!0;let t=e.relatedTarget;if(!(!h||n.current.includes(t))&&re.current&&(W.current?.(),W.current=null,F.current=-1,R(e),!p)){let e=j.current,t=nt(Y(e));e&&X(e,t)&&e.focus({preventScroll:!0})}}}),[ce,ne,j,h,n,R,re,p]),pe=K.useMemo(()=>p&&T&&se&&{"aria-activedescendant":`${x}-${r}`},[p,T,se,x,r]),me=K.useMemo(()=>({"aria-orientation":v===`both`?void 0:v,...A?{}:pe,onKeyDown(e){if(e.key===`Tab`&&e.shiftKey&&T&&!p){let t=rt(e.nativeEvent);if(t&&!X(j.current,t))return;dt(e),w.setOpen(!1,er(Yn,e.nativeEvent)),U(D)&&D.focus();return}de(e)},onPointerMove(){L.current=!0}}),[pe,de,j,v,A,w,T,p,D]),he=K.useMemo(()=>{function e(e){w.setOpen(!0,er(Zn,e.nativeEvent,e.currentTarget))}function t(e){m===`auto`&&pt(e.nativeEvent)&&(P.current=!p)}function n(e){P.current=m,m===`auto`&&mt(e.nativeEvent)&&(P.current=!0)}return{onKeyDown(t){let n=w.select(`open`);L.current=!1;let r=t.key.startsWith(`Arrow`),i=Pa(t.key,le(),f),a=Ma(t.key,v),o=(u?i:a)||t.key===`Enter`||t.key.trim()===``;if(p&&n)return de(t);if(!(!n&&!g&&r)){if(o){let e=Ma(t.key,le());I.current=u&&e?null:t.key}if(u){i&&(dt(t),n?(F.current=ue(),R(t)):e(t));return}a&&(G.current!=null&&(F.current=G.current),dt(t),!n&&g?e(t):de(t),n&&R(t))}},onFocus(e){w.select(`open`)&&!p&&(F.current=-1,R(e))},onPointerDown:n,onPointerEnter:n,onMouseDown:t,onClick:t}},[de,m,ue,u,R,w,g,v,le,f,G,p]),ge=K.useMemo(()=>({...pe,...he}),[pe,he]);return K.useMemo(()=>o?{reference:ge,floating:me,item:fe,trigger:he}:{},[o,ge,me,he,fe])}function La(e,t){let{listRef:n,elementsRef:r,activeIndex:i,onMatch:o,onTyping:s,enabled:c=!0,resetMs:l=750,selectedIndex:u=null}=t,f=`rootStore`in e?e.rootStore:e,p=f.useState(`open`),m=An(),h=K.useRef(``),g=K.useRef(u??i??-1),_=K.useRef(null),v=d(e=>{function t(e){let t=r?.current[e];return!t||nn(t)}function a(e,n,r=0){if(e.length===0)return-1;let i=(r%e.length+e.length)%e.length,a=n.toLocaleLowerCase();for(let n=0;n<e.length;n+=1){let r=(i+n)%e.length;if(!(!e[r]?.toLocaleLowerCase().startsWith(a)||!t(r)))return r}return-1}let c=n.current;if(h.current.length>0&&e.key===` `&&(dt(e),s?.(!0)),h.current.length>0&&h.current[0]!==` `&&a(c,h.current)===-1&&e.key!==` `&&s?.(!1),c==null||e.key.length!==1||e.ctrlKey||e.metaKey||e.altKey)return;p&&e.key!==` `&&(dt(e),s?.(!0));let d=h.current===``;d&&(g.current=u??i??-1),c.every(e=>e?e[0]?.toLocaleLowerCase()!==e[1]?.toLocaleLowerCase():!0)&&h.current===e.key&&(h.current=``,g.current=_.current),h.current+=e.key,m.start(l,()=>{h.current=``,g.current=_.current,s?.(!1)});let f=((d?u??i??-1:g.current)??0)+1,v=a(c,h.current,f);v===-1?e.key!==` `&&(h.current=``,s?.(!1)):(o?.(v),_.current=v)}),y=d(e=>{let t=e.relatedTarget,n=f.select(`domReferenceElement`),r=f.select(`floatingElement`);X(n,t)||X(r,t)||(m.clear(),h.current=``,g.current=_.current,s?.(!1))});a(()=>{!p&&u!==null||(m.clear(),_.current=null,h.current!==``&&(h.current=``))},[p,u,m]),a(()=>{p&&h.current===``&&(g.current=u??i??-1)},[p,u,i]);let b=K.useMemo(()=>({onKeyDown:v,onBlur:y}),[v,y]);return K.useMemo(()=>c?{reference:b,floating:b}:{},[c,b])}var Ra=K.createContext(null),za=K.createContext(null);function Ba(){let e=K.useContext(Ra);if(e===null)throw Error(x(60));return e}function Va(){let e=K.useContext(za);if(e===null)throw Error(x(61));return e}var Ha=(e,t)=>Object.is(e,t);function Ua(e,t,n){return e==null||t==null?Object.is(e,t):n(e,t)}function Wa(e,t,n){return!e||e.length===0?!1:e.some(e=>e===void 0?!1:Ua(t,e,n))}function Ga(e,t,n){return!e||e.length===0?-1:e.findIndex(e=>e===void 0?!1:Ua(e,t,n))}function Ka(e,t,n){return e.filter(e=>!Ua(t,e,n))}function qa(e){if(e==null)return``;if(typeof e==`string`)return e;try{return JSON.stringify(e)}catch{return String(e)}}function Ja(e){return e!=null&&e.length>0&&typeof e[0]==`object`&&e[0]!=null&&`items`in e[0]}function Ya(e){if(!Array.isArray(e))return e!=null&&`null`in e;let t=e;if(Ja(t)){for(let e of t)for(let t of e.items)if(t&&t.value==null&&t.label!=null)return!0;return!1}for(let e of t)if(e&&e.value==null&&e.label!=null)return!0;return!1}function Xa(e,t){if(t&&e!=null)return t(e)??``;if(e&&typeof e==`object`){if(`label`in e&&e.label!=null)return String(e.label);if(`value`in e)return String(e.value)}return qa(e)}function Za(e,t){return t&&e!=null?t(e)??``:e&&typeof e==`object`&&`value`in e&&`label`in e?qa(e.value):qa(e)}function Qa(e,t,n){function r(){return Xa(e,n)}if(n&&e!=null)return n(e);if(e&&typeof e==`object`&&`label`in e&&e.label!=null)return e.label;if(t&&!Array.isArray(t))return t[e]??r();if(Array.isArray(t)){let n=t,i=Ja(n)?n.flatMap(e=>e.items):n;if(typeof e!=`object`||!e){let t=i.find(t=>t.value===e);return t&&t.label!=null?t.label:r()}if(`value`in e){let t=i.find(t=>t&&t.value===e.value);if(t&&t.label!=null)return t.label}}return r()}function $a(e,t,n){return e.reduce((e,r,i)=>(i>0&&e.push(`, `),e.push((0,q.jsx)(K.Fragment,{children:Qa(r,t,n)},i)),e),[])}var $={id:Z(e=>e.id),labelId:Z(e=>e.labelId),modal:Z(e=>e.modal),multiple:Z(e=>e.multiple),items:Z(e=>e.items),itemToStringLabel:Z(e=>e.itemToStringLabel),itemToStringValue:Z(e=>e.itemToStringValue),isItemEqualToValue:Z(e=>e.isItemEqualToValue),value:Z(e=>e.value),hasSelectedValue:Z(e=>{let{value:t,multiple:n,itemToStringValue:r}=e;return t==null?!1:n&&Array.isArray(t)?t.length>0:Za(t,r)!==``}),hasNullItemLabel:Z((e,t)=>t?Ya(e.items):!1),open:Z(e=>e.open),mounted:Z(e=>e.mounted),forceMount:Z(e=>e.forceMount),transitionStatus:Z(e=>e.transitionStatus),openMethod:Z(e=>e.openMethod),activeIndex:Z(e=>e.activeIndex),selectedIndex:Z(e=>e.selectedIndex),isActive:Z((e,t)=>e.activeIndex===t),isSelected:Z((e,t,n)=>{let r=e.isItemEqualToValue,i=e.value;return e.multiple?Array.isArray(i)&&i.some(e=>Ua(n,e,r)):e.selectedIndex===t&&e.selectedIndex!==null?!0:Ua(n,i,r)}),isSelectedByFocus:Z((e,t)=>e.selectedIndex===t),popupProps:Z(e=>e.popupProps),triggerProps:Z(e=>e.triggerProps),triggerElement:Z(e=>e.triggerElement),positionerElement:Z(e=>e.positionerElement),listElement:Z(e=>e.listElement),popupSide:Z(e=>e.popupSide),scrollUpArrowVisible:Z(e=>e.scrollUpArrowVisible),scrollDownArrowVisible:Z(e=>e.scrollDownArrowVisible),hasScrollArrows:Z(e=>e.hasScrollArrows)};function eo(e,t){let n=K.useRef(e),r=d(t);a(()=>{n.current!==e&&r(n.current)},[e,r]),a(()=>{n.current=e},[e])}function to(e){let t=K.useRef(``),n=K.useCallback(n=>{n.defaultPrevented||(t.current=n.pointerType,e(n,n.pointerType))},[e]);return{onClick:K.useCallback(n=>{if(n.detail===0){e(n,`keyboard`);return}`pointerType`in n?e(n,n.pointerType):e(n,t.current),t.current=``},[e]),onPointerDown:n}}function no(e,t){let{onClick:n,onPointerDown:r}=to(d((n,r)=>{(typeof e==`function`?e():e)||t(r||(We?`touch`:``))}));return K.useMemo(()=>({onClick:n,onPointerDown:r}),[n,r])}function ro(e){let[t,n]=K.useState(null),r=no(e,n);return eo(e,t=>{t&&!e&&n(null)}),K.useMemo(()=>({openMethod:t,triggerProps:r}),[t,r])}function io(e,t=-(2**53-1),n=2**53-1){return Math.max(t,Math.min(e,n))}function ao(e,t){return Math.max(0,e-t)}function oo(e,t){if(t<=0)return 0;let n=io(e,0,t),r=n,i=t-n,a=r<=1,o=i<=1;return a&&o?r<=i?0:t:a?0:o?t:n}function so(e){let{id:t,value:n,defaultValue:r=null,onValueChange:i,open:o,defaultOpen:s=!1,onOpenChange:c,name:l,form:u,autoComplete:f,disabled:m=!1,readOnly:h=!1,required:g=!1,modal:_=!0,actionsRef:v,inputRef:b,onOpenChangeComplete:x,items:w,multiple:T=!1,itemToStringLabel:E,itemToStringValue:D,isItemEqualToValue:O=Ha,highlightItemOnHover:k=!0,children:A}=e,{clearErrors:j}=Ae(),{setDirty:M,setTouched:N,setFocused:P,shouldValidateOnChange:F,validityData:I,setFilled:L,name:R,disabled:ee,validation:z,validationMode:B}=Oe(),V=Re({id:t}),H=ee||m,U=R??l,[W,ne]=Un({controlled:n,default:T?r??p:r,name:`Select`,state:`value`}),[G,re]=Un({controlled:o,default:s,name:`Select`,state:`open`}),ie=K.useRef([]),ae=K.useRef([]),oe=K.useRef(null),se=K.useRef(null),ce=K.useRef(0),le=K.useRef(null),ue=K.useRef([]),de=K.useRef(!1),fe=K.useRef(!1),pe=K.useRef(null),me=K.useRef(null),he=K.useRef({allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0}),ge=K.useRef(!1),{mounted:_e,setMounted:ve,transitionStatus:ye}=Hn(G),{openMethod:be,triggerProps:xe}=ro(G),J=te(()=>new Sr({id:V,labelId:void 0,modal:_,multiple:T,itemToStringLabel:E,itemToStringValue:D,isItemEqualToValue:O,value:W,open:G,mounted:_e,transitionStatus:ye,items:w,forceMount:!1,openMethod:null,activeIndex:null,selectedIndex:null,popupProps:{},triggerProps:{},triggerElement:null,positionerElement:null,listElement:null,popupSide:null,scrollUpArrowVisible:!1,scrollDownArrowVisible:!1,hasScrollArrows:!1})).current,Se=Q(J,$.activeIndex),Ce=Q(J,$.selectedIndex),we=Q(J,$.triggerElement),Te=Q(J,$.positionerElement),Ee=ar(be),De=be??Ee,ke=K.useMemo(()=>T&&Array.isArray(W)&&W.length===0?``:Za(W,D),[T,W,D]),je=K.useMemo(()=>T&&Array.isArray(W)?W.map(e=>Za(e,D)):Za(W,D),[T,W,D]);Wn(or(J.state.triggerElement),V,W,d(()=>je));let Me=K.useRef(W),Ne=T?Array.isArray(W)&&W.length>0:W!=null;a(()=>{W!==Me.current&&J.set(`forceMount`,!0)},[J,W]),a(()=>{L(Ne)},[Ne,L]),a(function(){let e=ue.current,t;if(T){let n=Array.isArray(W)?W:[];if(n.length===0)t=null;else{let r=n[n.length-1],i=Ga(e,r,O);t=i===-1?null:i}}else{let n=Ga(e,W,O);t=n===-1?null:n}t===null&&(me.current=null),!G&&J.set(`selectedIndex`,t)},[Ne,T,G,W,ue,O,J,me]),eo(W,()=>{j(U),M(W!==I.initialValue),F()?z.commit(W):z.commit(W,!0)});let Pe=d((e,t)=>{if(c?.(e,t),!t.isCanceled&&(re(e),!e&&(t.reason===`focus-out`||t.reason===`outside-press`)&&(N(!0),P(!1),B===`onBlur`&&z.commit(W)),!e&&J.state.activeIndex!==null)){let e=ie.current[J.state.activeIndex];queueMicrotask(()=>{e?.setAttribute(`tabindex`,`-1`)})}}),Fe=d(()=>{ve(!1),J.update({activeIndex:null,openMethod:null}),x?.(!1)});Vn({enabled:!v,open:G,ref:oe,onComplete(){G||Fe()}}),K.useImperativeHandle(v,()=>({unmount:Fe}),[Fe]);let Ie=d((e,t)=>{i?.(e,t),!t.isCanceled&&ne(e)}),Le=d(()=>{let e=J.state.listElement||oe.current;if(!e)return;let t=ao(e.scrollHeight,e.clientHeight),n=oo(e.scrollTop,t),r=n>0,i=n<t;J.state.scrollUpArrowVisible!==r&&J.set(`scrollUpArrowVisible`,r),J.state.scrollDownArrowVisible!==i&&J.set(`scrollDownArrowVisible`,i)}),Y=Oa({open:G,onOpenChange:Pe,elements:{reference:we,floating:Te}}),ze=ui(Y,{enabled:!h&&!H,event:`mousedown`}),Be=mi(Y),Ve=Ia(Y,{enabled:!h&&!H,listRef:ie,activeIndex:Se,selectedIndex:Ce,disabledIndices:p,onNavigate(e){e===null&&!G||J.set(`activeIndex`,e)},focusItemOnHover:k}),He=La(Y,{enabled:!h&&!H&&(G||!T),listRef:ae,activeIndex:Se,selectedIndex:Ce,onMatch(e){G?J.set(`activeIndex`,e):Ie(ue.current[e],er(`none`))},onTyping(e){de.current=e}}),Ue=K.useMemo(()=>{let e=C(He.reference,Ve.reference,Be.reference,ze.reference,xe);return V&&(e.id=V),e},[ze.reference,He.reference,Ve.reference,Be.reference,xe,V]),We=K.useMemo(()=>C(Ea,He.floating,Ve.floating,Be.floating),[He.floating,Ve.floating,Be.floating]),Ge=Ve.item??y;ir(()=>{J.update({popupProps:We,triggerProps:Ue})}),a(()=>{J.update({id:V,modal:_,multiple:T,value:W,open:G,mounted:_e,transitionStatus:ye,popupProps:We,triggerProps:Ue,items:w,itemToStringLabel:E,itemToStringValue:D,isItemEqualToValue:O,openMethod:De})},[J,V,_,T,W,G,_e,ye,We,Ue,w,E,D,O,De]);let Ke=K.useMemo(()=>({store:J,name:U,required:g,disabled:H,readOnly:h,multiple:T,highlightItemOnHover:k,setValue:Ie,setOpen:Pe,listRef:ie,popupRef:oe,scrollHandlerRef:se,handleScrollArrowVisibility:Le,scrollArrowsMountedCountRef:ce,itemProps:Ge,events:Y.context.events,valueRef:le,valuesRef:ue,labelsRef:ae,typingRef:de,selectionRef:he,firstItemTextRef:pe,selectedItemTextRef:me,validation:z,onOpenChangeComplete:x,keyboardActiveRef:fe,alignItemWithTriggerActiveRef:ge,initialValueRef:Me}),[J,U,g,H,h,T,k,Ie,Pe,Ge,Y.context.events,z,x,Le]),qe=S(b,z.inputRef),Je=T&&Array.isArray(W)&&W.length>0,Ye=T?void 0:U,Xe=K.useMemo(()=>!T||!Array.isArray(W)||!U?null:W.map(e=>{let t=Za(e,D);return(0,q.jsx)(`input`,{type:`hidden`,form:u,name:U,value:t},t)}),[T,W,u,U,D]);return(0,q.jsx)(Ra.Provider,{value:Ke,children:(0,q.jsxs)(za.Provider,{value:Y,children:[A,(0,q.jsx)(`input`,{...z.getInputValidationProps({onFocus(){J.state.triggerElement?.focus({focusVisible:!0})},onChange(e){if(e.nativeEvent.defaultPrevented||H||h){e.preventBaseUIHandler?.();return}let t=e.currentTarget.value,n=er(Gn,e.nativeEvent);function r(){if(T)return;let e=ue.current.find(e=>Za(e,D).toLowerCase()===t.toLowerCase()||Xa(e,E).toLowerCase()===t.toLowerCase());e!=null&&(M(e!==I.initialValue),Ie(e,n),F()&&z.commit(e))}J.set(`forceMount`,!0),queueMicrotask(r)}}),id:V&&Ye==null?`${V}-hidden-input`:void 0,form:u,name:Ye,autoComplete:f,value:ke,disabled:H,required:g&&!Je,readOnly:h,ref:qe,style:U?rr:nr,tabIndex:-1,"aria-hidden":!0,suppressHydrationWarning:!0}),Xe]})})}function co(e,t){return e??t}var lo=function(e){return e.open=`data-open`,e.closed=`data-closed`,e[e.startingStyle=In.startingStyle]=`startingStyle`,e[e.endingStyle=In.endingStyle]=`endingStyle`,e.anchorHidden=`data-anchor-hidden`,e.side=`data-side`,e.align=`data-align`,e}({}),uo=function(e){return e.popupOpen=`data-popup-open`,e.pressed=`data-pressed`,e}({}),fo={[uo.popupOpen]:``},po={[uo.popupOpen]:``,[uo.pressed]:``},mo={[lo.open]:``},ho={[lo.closed]:``},go={[lo.anchorHidden]:``},_o={open(e){return e?fo:null}},vo={open(e){return e?po:null}},yo={open(e){return e?mo:ho},anchorHidden(e){return e?go:null}};function bo(e){let t=e.getBoundingClientRect(),n=ne(e),r=n.getComputedStyle(e,`::before`),i=n.getComputedStyle(e,`::after`);if(!(r.content!==`none`||i.content!==`none`))return t;let a=parseFloat(r.width)||0,o=parseFloat(r.height)||0,s=parseFloat(i.width)||0,c=parseFloat(i.height)||0,l=Math.max(t.width,a,s),u=Math.max(t.height,o,c),d=l-t.width,f=u-t.height;return{left:t.left-d/2,right:t.right+d/2,top:t.top-f/2,bottom:t.bottom+f/2}}var xo=2,So=400,Co={...vo,...Te,popupSide:e=>e?{"data-popup-side":e}:null,value:()=>null},wo=K.forwardRef(function(e,t){let{render:n,className:r,id:i,disabled:a=!1,nativeButton:s=!0,style:l,...u}=e,{setTouched:f,setFocused:p,validationMode:m,state:h,disabled:g}=Oe(),{labelId:_}=Le(),{store:v,setOpen:y,selectionRef:b,validation:x,readOnly:w,required:T,alignItemWithTriggerActiveRef:E,disabled:D,keyboardActiveRef:O}=Ba(),k=g||D||a,A=Q(v,$.open),j=Q(v,$.mounted),M=Q(v,$.value),N=Q(v,$.triggerProps),P=Q(v,$.positionerElement),F=Q(v,$.listElement),I=Q(v,$.popupSide),L=Q(v,$.id),R=Q(v,$.labelId),ee=Q(v,$.hasSelectedValue),z=j&&P?I:null,B=i??L,V=co(_,R);Re({id:B});let H=or(P),U=K.useRef(null),{getButtonProps:W,buttonRef:te}=o({disabled:k,native:s}),ne=S(t,U,te,d(e=>{v.set(`triggerElement`,e)})),G=An(),re=An(),ie=An();K.useEffect(()=>{if(A)return ie.start(So,()=>{b.current.allowUnselectedMouseUp=!0,b.current.allowSelectedMouseUp=!0}),()=>{ie.clear()};b.current={allowSelectedMouseUp:!1,allowUnselectedMouseUp:!1,dragY:0},re.clear()},[A,b,re,ie]);let ae=C(N,{id:B,role:`combobox`,"aria-expanded":A?`true`:`false`,"aria-haspopup":`listbox`,"aria-controls":A?F?.id??ct(P)?.id:void 0,"aria-labelledby":V,"aria-readonly":w||void 0,"aria-required":T||void 0,tabIndex:k?-1:0,ref:ne,onFocus(e){p(!0),A&&E.current&&y(!1,er(Gn,e.nativeEvent)),G.start(0,()=>{v.set(`forceMount`,!0)})},onBlur(e){X(P,e.relatedTarget)||(f(!0),p(!1),m===`onBlur`&&x.commit(M))},onPointerMove(){O.current=!1},onKeyDown(){O.current=!0},onMouseDown(e){if(A)return;let t=Y(e.currentTarget);function n(e){if(!U.current)return;let t=e.target;if(X(U.current,t)||X(H.current,t)||t===U.current)return;let n=bo(U.current);e.clientX>=n.left-xo&&e.clientX<=n.right+xo&&e.clientY>=n.top-xo&&e.clientY<=n.bottom+xo||y(!1,er(Qn,e))}re.start(0,()=>{t.addEventListener(`mouseup`,n,{once:!0})})}},x.getValidationProps,u,W);ae.role=`combobox`;let oe={...h,open:A,disabled:k,value:M,readOnly:w,popupSide:z,placeholder:!ee};return c(`button`,e,{ref:[t,U],state:oe,stateAttributesMapping:Co,props:ae})}),To={value:()=>null},Eo=K.forwardRef(function(e,t){let{className:n,render:r,children:i,placeholder:a,style:o,...s}=e,{store:l,valueRef:u}=Ba(),d=Q(l,$.value),f=Q(l,$.items),p=Q(l,$.itemToStringLabel),m=Q(l,$.hasSelectedValue),h=!m&&a!=null&&i==null,g=Q(l,$.hasNullItemLabel,h),_={value:d,placeholder:!m},v=null;return v=typeof i==`function`?i(d):i??(!m&&a!=null&&!g?a:Array.isArray(d)?$a(d,f,p):Qa(d,f,p)),c(`span`,e,{state:_,ref:[t,u],props:[{children:v},s],stateAttributesMapping:To})}),Do=K.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o}=Ba();return c(`span`,e,{state:{open:Q(o,$.open)},ref:t,props:[{"aria-hidden":!0,children:`▼`},a],stateAttributesMapping:_o})}),Oo=K.createContext(void 0),ko=K.forwardRef(function(e,t){let{store:n}=Ba(),r=Q(n,$.mounted),i=Q(n,$.forceMount);return r||i?(0,q.jsx)(Oo.Provider,{value:!0,children:(0,q.jsx)(Yr,{ref:t,...e})}):null});function Ao(e){return n(19)?e:e?`true`:void 0}var jo=K.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});function Mo(){return K.useContext(jo)}function No(e){let{children:t,elementsRef:n,labelsRef:r,onMapChange:i}=e,o=d(i),s=K.useRef(0),c=te(Fo).current,l=te(Po).current,[u,f]=K.useState(0),p=K.useRef(u),m=d((e,t)=>{l.set(e,t??null),p.current+=1,f(p.current)}),h=d(e=>{l.delete(e),p.current+=1,f(p.current)}),g=K.useMemo(()=>{let e=new Map;return Array.from(l.keys()).filter(e=>e.isConnected).sort(Io).forEach((t,n)=>{let r=l.get(t)??{};e.set(t,{...r,index:n})}),e},[l,u]);a(()=>{if(typeof MutationObserver!=`function`||g.size===0)return;let e=new MutationObserver(e=>{let t=new Set,n=e=>t.has(e)?t.delete(e):t.add(e);e.forEach(e=>{e.removedNodes.forEach(n),e.addedNodes.forEach(n)}),t.size===0&&(p.current+=1,f(p.current))});return g.forEach((t,n)=>{n.parentElement&&e.observe(n.parentElement,{childList:!0})}),()=>{e.disconnect()}},[g]),a(()=>{p.current===u&&(n.current.length!==g.size&&(n.current.length=g.size),r&&r.current.length!==g.size&&(r.current.length=g.size),s.current=g.size),o(g)},[o,g,n,r,u]),a(()=>()=>{n.current=[]},[n]),a(()=>()=>{r&&(r.current=[])},[r]);let _=d(e=>(c.add(e),()=>{c.delete(e)}));a(()=>{c.forEach(e=>e(g))},[c,g]);let v=K.useMemo(()=>({register:m,unregister:h,subscribeMapChange:_,elementsRef:n,labelsRef:r,nextIndexRef:s}),[m,h,_,n,r,s]);return(0,q.jsx)(jo.Provider,{value:v,children:t})}function Po(){return new Map}function Fo(){return new Set}function Io(e,t){let n=e.compareDocumentPosition(t);return n&Node.DOCUMENT_POSITION_FOLLOWING||n&Node.DOCUMENT_POSITION_CONTAINED_BY?-1:n&Node.DOCUMENT_POSITION_PRECEDING||n&Node.DOCUMENT_POSITION_CONTAINS?1:0}var Lo=K.createContext(void 0);function Ro(){return K.useContext(Lo)?.direction??`ltr`}var zo=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0,offsetParent:d=`real`}=Tt(e,t)||{};if(l==null)return{};let f=Ut(u),p={x:n,y:r},m=jt(i),h=kt(m),g=await o.getDimensions(l),_=m===`y`,v=_?`top`:`left`,y=_?`bottom`:`right`,b=_?`clientHeight`:`clientWidth`,x=a.reference[h]+a.reference[m]-p[m]-a.floating[h],S=p[m]-a.reference[m],C=d===`real`?await o.getOffsetParent?.(l):s.floating,w=s.floating[b]||a.floating[h];(!w||!await o.isElement?.(C))&&(w=s.floating[b]||a.floating[h]);let T=x/2-S/2,E=w/2-g[h]/2-1,D=Math.min(f[v],E),O=Math.min(f[y],E),k=D,A=w-g[h]-O,j=w/2-g[h]/2+T,M=wt(k,j,A),N=!c.arrow&&Dt(i)!=null&&j!==M&&a.reference[h]/2-(j<k?D:O)-g[h]/2<0,P=N?j<k?j-k:j-A:0;return{[m]:p[m]+P,data:{[m]:M,centerOffset:j-M-P,...N&&{alignmentOffset:P}},reset:N}}}),Bo=(e,t)=>({...zo(e),options:[e,t]}),Vo={name:`hide`,async fn(e){let{width:t,height:n,x:r,y:i}=e.rects.reference,a=t===0&&n===0&&r===0&&i===0;return{data:{referenceHidden:(await Ca().fn(e)).data?.referenceHidden||a}}}},Ho={sideX:`left`,sideY:`top`};function Uo(e,t,n){let r=e===`inline-start`||e===`inline-end`;return{top:`top`,right:r?n?`inline-start`:`inline-end`:`right`,bottom:`bottom`,left:r?n?`inline-end`:`inline-start`:`left`}[t]}function Wo(e,t,n){let{rects:r,placement:i}=e;return{side:Uo(t,Et(i),n),align:Dt(i)||`center`,anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function Go(e){let{anchor:t,positionMethod:n=`absolute`,side:r=`bottom`,sideOffset:i=0,align:o=`center`,alignOffset:s=0,collisionBoundary:c,collisionPadding:l=5,sticky:u=!1,arrowPadding:f=5,disableAnchorTracking:p=!1,inline:m,keepMounted:h=!1,floatingRootContext:g,mounted:_,collisionAvoidance:v,shiftCrossAxis:y=!1,nodeId:b,adaptiveOrigin:x,lazyFlip:S=!1,externalTree:C}=e,[w,T]=K.useState(null);!_&&w!==null&&T(null);let E=v.side||`flip`,D=v.align||`flip`,O=v.fallbackAxisSide||`end`,k=typeof t==`function`?t:void 0,A=d(k),j=k?A:t,M=or(t),N=or(_),P=Ro()===`rtl`,F=w||{top:`top`,right:`right`,bottom:`bottom`,left:`left`,"inline-end":P?`left`:`right`,"inline-start":P?`right`:`left`}[r],I=o===`center`?F:`${F}-${o}`,L=l,R=+(r===`bottom`),ee=+(r===`top`),z=+(r===`right`),B=+(r===`left`);typeof L==`number`?L={top:L+R,right:L+B,bottom:L+ee,left:L+z}:L&&={top:(L.top||0)+R,right:(L.right||0)+B,bottom:(L.bottom||0)+ee,left:(L.left||0)+z};let V={boundary:c===`clipping-ancestors`?`clippingAncestors`:c,padding:L},H=K.useRef(null),U=or(i),W=or(s),te=typeof i==`function`?0:i,G=typeof s==`function`?0:s,re=[];m&&re.push(m),re.push(va(e=>{let t=Wo(e,r,P),n=typeof U.current==`function`?U.current(t):U.current,i=typeof W.current==`function`?W.current(t):W.current;return{mainAxis:n,crossAxis:i,alignmentAxis:i}},[te,G,P,r]));let ie=D===`none`&&E!==`shift`,ae=!ie&&(u||y||E===`shift`),oe=E===`none`?null:xa({...V,padding:{top:L.top+1,right:L.right+1,bottom:L.bottom+1,left:L.left+1},mainAxis:!y&&E===`flip`,crossAxis:D===`flip`?`alignment`:!1,fallbackAxisSideDirection:O}),se=ie?null:ya(e=>{let t=Y(e.elements.floating).documentElement;return{...V,rootBoundary:y?{x:0,y:0,width:t.clientWidth,height:t.clientHeight}:void 0,mainAxis:D!==`none`,crossAxis:ae,limiter:u||y?void 0:ba(e=>{if(!H.current)return{};let{width:t,height:n}=H.current.getBoundingClientRect(),r=At(Et(e.placement)),i=r===`y`?t:n,a=r===`y`?L.left+L.right:L.top+L.bottom;return{offset:i/2+a/2}})}},[V,u,y,L,D]);E===`shift`||D===`shift`||o===`center`?re.push(se,oe):re.push(oe,se),re.push(Sa({...V,apply({elements:{floating:e},availableWidth:t,availableHeight:n,rects:r}){if(!N.current)return;let i=e.style;i.setProperty(`--available-width`,`${t}px`),i.setProperty(`--available-height`,`${n}px`);let a=ne(e).devicePixelRatio||1,{x:o,y:s,width:c,height:l}=r.reference,u=(Math.round((o+c)*a)-Math.round(o*a))/a,d=(Math.round((s+l)*a)-Math.round(s*a))/a;i.setProperty(`--anchor-width`,`${u}px`),i.setProperty(`--anchor-height`,`${d}px`)}}),Bo(e=>({element:H.current||Y(e.elements.floating).createElement(`div`),padding:f,offsetParent:`floating`}),[f]),{name:`transformOrigin`,fn(e){let{elements:t,middlewareData:n,placement:a,rects:o,y:s}=e,c=Et(a),l=At(c),u=H.current,d=n.arrow?.x||0,f=n.arrow?.y||0,p=u?.clientWidth||0,m=u?.clientHeight||0,h=d+p/2,g=f+m/2,_=Math.abs(n.shift?.y||0),v=o.reference.height/2,y=typeof i==`function`?i(Wo(e,r,P)):i,b=_>y,x={top:`${h}px calc(100% + ${y}px)`,bottom:`${h}px ${-y}px`,left:`calc(100% + ${y}px) ${g}px`,right:`${-y}px ${g}px`}[c],S=`${h}px ${o.reference.y+v-s}px`;return t.floating.style.setProperty(`--transform-origin`,ae&&l===`y`&&b?S:x),{}}},Vo,x),a(()=>{!_&&g&&g.update({referenceElement:null,floatingElement:null,domReferenceElement:null,positionReference:null})},[_,g]);let ce=K.useMemo(()=>({elementResize:!p&&typeof ResizeObserver<`u`,layoutShift:!p&&typeof IntersectionObserver<`u`}),[p]),{refs:le,elements:ue,x:de,y:fe,middlewareData:pe,update:me,placement:he,context:ge,isPositioned:_e,floatingStyles:ve}=ka({rootContext:g,open:h?_:void 0,placement:I,middleware:re,strategy:n,whileElementsMounted:h?void 0:(...e)=>ia(...e,ce),nodeId:b,externalTree:C}),{sideX:ye,sideY:be}=pe.adaptiveOrigin||Ho,xe=_e?n:`fixed`,q=K.useMemo(()=>{let e=x?{position:xe,[ye]:de,[be]:fe}:{position:xe,...ve};return _e||(e.opacity=0),e},[x,xe,ye,de,be,fe,ve,_e]),J=K.useRef(null);a(()=>{if(!_)return;let e=M.current,t=typeof e==`function`?e():e,n=(Ko(t)?t.current:t)||null;n!==J.current&&(le.setPositionReference(n),J.current=n)},[_,le,j,M]),K.useEffect(()=>{if(!_)return;let e=M.current;typeof e!=`function`&&Ko(e)&&e.current!==J.current&&(le.setPositionReference(e.current),J.current=e.current)},[_,le,j,M]),K.useEffect(()=>{if(h&&_&&ue.domReference&&ue.floating)return ia(ue.domReference,ue.floating,me,ce)},[h,_,ue,me,ce]);let Se=Et(he),Ce=Uo(r,Se,P),we=Dt(he)||`center`,Te=!!pe.hide?.referenceHidden;a(()=>{S&&_&&_e&&T(Se)},[S,_,_e,Se]);let Ee=K.useMemo(()=>({position:`absolute`,top:pe.arrow?.y,left:pe.arrow?.x}),[pe.arrow]),De=pe.arrow?.centerOffset!==0;return K.useMemo(()=>({positionerStyles:q,arrowStyles:Ee,arrowRef:H,arrowUncentered:De,side:Ce,align:we,physicalSide:Se,anchorHidden:Te,refs:le,context:ge,isPositioned:_e,update:me}),[q,Ee,H,De,Ce,we,Se,Te,le,ge,_e,me])}function Ko(e){return e!=null&&`current`in e}var qo=K.createContext(void 0);function Jo(){let e=K.useContext(qo);if(!e)throw Error(x(59));return e}var Yo=K.forwardRef(function(e,t){let{cutout:n,...r}=e,i;if(n){let e=n.getBoundingClientRect();i=`polygon(0% 0%,100% 0%,100% 100%,0% 100%,0% 0%,${e.left}px ${e.top}px,${e.left}px ${e.bottom}px,${e.right}px ${e.bottom}px,${e.right}px ${e.top}px,${e.left}px ${e.top}px)`}return(0,q.jsx)(`div`,{ref:t,role:`presentation`,"data-base-ui-inert":``,...r,style:{position:`fixed`,inset:0,userSelect:`none`,WebkitUserSelect:`none`,clipPath:i}})});function Xo(e,t){e&&Object.assign(e.style,t)}var Zo={position:`relative`,maxHeight:`100%`,overflowX:`hidden`,overflowY:`auto`};function Qo(e){return e===`starting`?Hr:y}function $o(e,t,{styles:n,transitionStatus:r,props:i,refs:a,hidden:o,inert:s=!1}){let l={...n};return s&&(l.pointerEvents=`none`),c(`div`,e,{state:t,ref:a,props:[{role:`presentation`,hidden:o,style:l},Qo(r),i],stateAttributesMapping:yo})}var es={},ts={},ns=``;function rs(e){if(typeof document>`u`)return!1;let t=Y(e);return ne(t).innerWidth-t.documentElement.clientWidth>0}function is(e){if(!(typeof CSS<`u`&&CSS.supports&&CSS.supports(`scrollbar-gutter`,`stable`))||typeof document>`u`)return!1;let t=Y(e),n=t.documentElement,r=t.body,i=B(n)?n:r,a=i.style.overflowY,o=n.style.scrollbarGutter;n.style.scrollbarGutter=`stable`,i.style.overflowY=`scroll`;let s=i.offsetWidth;i.style.overflowY=`hidden`;let c=i.offsetWidth;return i.style.overflowY=a,n.style.scrollbarGutter=o,s===c}function as(e){let t=Y(e),n=t.documentElement,r=t.body,i=B(n)?n:r,a={overflowY:i.style.overflowY,overflowX:i.style.overflowX};return Object.assign(i.style,{overflowY:`hidden`,overflowX:`hidden`}),()=>{Object.assign(i.style,a)}}function os(e){let t=Y(e),n=t.documentElement,r=t.body,i=ne(n),a=0,o=0,s=!1,c=Nn.create();if(Ue&&(i.visualViewport?.scale??1)!==1)return()=>{};function l(){let t=i.getComputedStyle(n),c=i.getComputedStyle(r),l=(t.scrollbarGutter||``).includes(`both-edges`)?`stable both-edges`:`stable`;a=n.scrollTop,o=n.scrollLeft,es={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},ns=n.style.scrollBehavior,ts={position:r.style.position,height:r.style.height,width:r.style.width,boxSizing:r.style.boxSizing,overflowY:r.style.overflowY,overflowX:r.style.overflowX,scrollBehavior:r.style.scrollBehavior};let u=n.scrollHeight>n.clientHeight,d=n.scrollWidth>n.clientWidth,f=t.overflowY===`scroll`||c.overflowY===`scroll`,p=t.overflowX===`scroll`||c.overflowX===`scroll`,m=Math.max(0,i.innerWidth-r.clientWidth),h=Math.max(0,i.innerHeight-r.clientHeight),g=parseFloat(c.marginTop)+parseFloat(c.marginBottom),_=parseFloat(c.marginLeft)+parseFloat(c.marginRight),v=B(n)?n:r;if(s=is(e),s){n.style.scrollbarGutter=l,v.style.overflowY=`hidden`,v.style.overflowX=`hidden`;return}Object.assign(n.style,{scrollbarGutter:l,overflowY:`hidden`,overflowX:`hidden`}),(u||f)&&(n.style.overflowY=`scroll`),(d||p)&&(n.style.overflowX=`scroll`),Object.assign(r.style,{position:`relative`,height:g||h?`calc(100dvh - ${g+h}px)`:`100dvh`,width:_||m?`calc(100vw - ${_+m}px)`:`100vw`,boxSizing:`border-box`,overflow:`hidden`,scrollBehavior:`unset`}),r.scrollTop=a,r.scrollLeft=o,n.setAttribute(`data-base-ui-scroll-locked`,``),n.style.scrollBehavior=`unset`}function u(){Object.assign(n.style,es),Object.assign(r.style,ts),s||(n.scrollTop=a,n.scrollLeft=o,n.removeAttribute(`data-base-ui-scroll-locked`),n.style.scrollBehavior=ns)}function d(){u(),c.request(l)}l();let f=Tr(i,`resize`,d);return()=>{c.cancel(),u(),typeof i.removeEventListener==`function`&&f()}}var ss=new class{lockCount=0;restore=null;timeoutLock=kn.create();timeoutUnlock=kn.create();acquire(e){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(e)),this.release}release=()=>{--this.lockCount,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)};unlock=()=>{this.lockCount===0&&this.restore&&(this.restore?.(),this.restore=null)};lock(e){if(this.lockCount===0||this.restore!==null)return;let t=Y(e).documentElement,n=ne(t).getComputedStyle(t).overflowY;if(n===`hidden`||n===`clip`){this.restore=ce;return}let r=We||!rs(e);this.restore=r?as(e):os(e)}};function cs(e=!0,t=null){a(()=>{if(e)return ss.acquire(t)},[e,t])}var ls=20;function us(e,t,n,r){let[i,o]=K.useState(!1);a(()=>{if(!e||!t||n==null){o(!1);return}let r=Y(n).documentElement.clientWidth,i=n.offsetWidth;o(r>0&&i>0&&i>=r-ls)},[e,t,n]),cs(e&&(!t||i),r)}var ds={position:`fixed`},fs=K.forwardRef(function(e,t){let{anchor:n,positionMethod:r=`absolute`,className:i,render:o,side:s=`bottom`,align:c=`center`,sideOffset:l=0,alignOffset:u=0,collisionBoundary:f=`clipping-ancestors`,collisionPadding:p,arrowPadding:m=5,sticky:h=!1,disableAnchorTracking:g,alignItemWithTrigger:_=!0,collisionAvoidance:v=Ur,style:y,...b}=e,{store:x,listRef:S,labelsRef:C,alignItemWithTriggerActiveRef:w,selectedItemTextRef:T,valuesRef:E,initialValueRef:D,popupRef:O,setValue:k}=Ba(),A=Va(),j=Q(x,$.open),M=Q(x,$.mounted),N=Q(x,$.modal),P=Q(x,$.value),F=Q(x,$.openMethod),I=Q(x,$.positionerElement),L=Q(x,$.triggerElement),R=Q(x,$.isItemEqualToValue),ee=Q(x,$.transitionStatus),z=K.useRef(null),B=K.useRef(null),[V,H]=K.useState(_),U=M&&V&&F!==`touch`;!M&&V!==_&&H(_),a(()=>{M||($.scrollUpArrowVisible(x.state)&&x.set(`scrollUpArrowVisible`,!1),$.scrollDownArrowVisible(x.state)&&x.set(`scrollDownArrowVisible`,!1))},[x,M]),K.useImperativeHandle(w,()=>U),us((U||N)&&j,F===`touch`,I,L);let W=Go({anchor:n,floatingRootContext:A,positionMethod:r,mounted:M,side:s,sideOffset:l,align:c,alignOffset:u,arrowPadding:m,collisionBoundary:f,collisionPadding:p,sticky:h,disableAnchorTracking:g??U,collisionAvoidance:v,keepMounted:!0}),te=U?`none`:W.side,ne=U?ds:W.positionerStyles,G={open:j,side:te,align:W.align,anchorHidden:W.anchorHidden};a(()=>{x.set(`popupSide`,W.side)},[x,W.side]);let re=$o(e,G,{styles:ne,transitionStatus:ee,props:b,refs:[t,d(e=>{x.set(`positionerElement`,e)})],hidden:!M,inert:!j}),ie=K.useRef(0),ae=d(e=>{if(e.size===0&&ie.current===0||E.current.length===0)return;let t=ie.current;if(ie.current=e.size,e.size===t)return;let n=er(Gn);if(t!==0&&!x.state.multiple&&P!==null&&Ga(E.current,P,R)===-1){let e=D.current,t=e!=null&&Ga(E.current,e,R)!==-1?e:null;k(t,n),t===null&&(x.set(`selectedIndex`,null),T.current=null)}if(t!==0&&x.state.multiple&&Array.isArray(P)){let e=e=>Ga(E.current,e,R)!==-1,t=P.filter(t=>e(t));(t.length!==P.length||t.some(e=>!Wa(P,e,R)))&&(k(t,n),t.length===0&&(x.set(`selectedIndex`,null),T.current=null))}if(j&&U){x.update({scrollUpArrowVisible:!1,scrollDownArrowVisible:!1});let e={height:``};Xo(I,e),Xo(O.current,e)}}),oe=K.useMemo(()=>({...W,side:te,alignItemWithTriggerActive:U,setControlledAlignItemWithTrigger:H,scrollUpArrowRef:z,scrollDownArrowRef:B}),[W,te,U,H]);return(0,q.jsx)(No,{elementsRef:S,labelsRef:C,onMapChange:ae,children:(0,q.jsxs)(qo.Provider,{value:oe,children:[M&&N&&(0,q.jsx)(Yo,{inert:Ao(!j),cutout:L}),re]})})}),ps=`base-ui-disable-scrollbar`,ms={className:ps,getElement(e){return(0,q.jsx)(`style`,{nonce:e,href:ps,precedence:`base-ui:low`,children:`.${ps}{scrollbar-width:none}.${ps}::-webkit-scrollbar{display:none}`})}},hs=K.createContext(void 0);function gs(e){let t=K.useContext(hs);if(t===void 0&&!e)throw Error(x(69));return t}var _s=`ArrowUp`,vs=`ArrowDown`,ys=`ArrowLeft`,bs=`ArrowRight`,xs=`Home`,Ss=new Set([ys,bs]),Cs=new Set([_s,vs]),ws=new Set([...Ss,...Cs]),Ts=new Set([...ws,xs,`End`]),Es=K.createContext(void 0),Ds={disableStyleElements:!1};function Os(){return K.useContext(Es)??Ds}var ks={...yo,...zn},As=K.forwardRef(function(e,t){let{render:n,className:r,style:i,finalFocus:o,...s}=e,{store:l,popupRef:u,onOpenChangeComplete:f,setOpen:p,valueRef:m,firstItemTextRef:h,selectedItemTextRef:g,keyboardActiveRef:_,multiple:v,handleScrollArrowVisibility:y,scrollHandlerRef:b,listRef:x,highlightItemOnHover:S}=Ba(),{side:C,align:w,alignItemWithTriggerActive:T,isPositioned:E,setControlledAlignItemWithTrigger:D,scrollDownArrowRef:O,scrollUpArrowRef:k}=Jo(),A=gs(!0)!=null,j=Va(),M=Ro(),{nonce:N,disableStyleElements:P}=Os(),F=Q(l,$.id),I=Q(l,$.open),L=Q(l,$.mounted),R=Q(l,$.popupProps),ee=Q(l,$.transitionStatus),z=Q(l,$.triggerElement),B=Q(l,$.positionerElement),V=Q(l,$.listElement),H=K.useRef(!1),U=K.useRef(!1),W=K.useRef({}),te=Pn(),G=d(e=>{if(!B||!u.current||!U.current)return;if(H.current||!T){y();return}let t=B.style.top===`0px`,n=B.style.bottom===`0px`;if(!t&&!n){y();return}let r=Ns(B),i=Ps(B.getBoundingClientRect().height,`y`,r),a=Y(B),o=getComputedStyle(B),s=parseFloat(o.marginTop),c=parseFloat(o.marginBottom),l=js(getComputedStyle(u.current)),d=Math.min(a.documentElement.clientHeight-s-c,l),f=e.scrollTop,p=Ms(e),m=0,h=null,g=!1,_=!1,v=e=>{B.style.height=`${e}px`},b=(t,n)=>{let r=io(t,0,d-i);r>0&&v(i+r),e.scrollTop=n,d-(i+r)<=1&&(H.current=!0),y()},x=t?p-f:f,S=Math.min(i+x,d);if(m=S,x<=1){b(x,t?p:0);return}if(d-S>1?t?_=!0:h=0:(g=!0,n&&f<p&&(h=f-(x-(i+x-d)))),m=Math.ceil(m),m!==0&&v(m),_||h!=null){let t=Ms(e),n=_?t:io(h,0,t);Math.abs(e.scrollTop-n)>1&&(e.scrollTop=n)}(g||m>=d-1)&&(H.current=!0),y()});K.useImperativeHandle(b,()=>G,[G]),Vn({open:I,ref:u,onComplete(){I&&f?.(!0)}});let re={open:I,transitionStatus:ee,side:C,align:w};a(()=>{!B||!u.current||Object.keys(W.current).length||(W.current={top:B.style.top||`0`,left:B.style.left||`0`,right:B.style.right,height:B.style.height,bottom:B.style.bottom,minHeight:B.style.minHeight,maxHeight:B.style.maxHeight,marginTop:B.style.marginTop,marginBottom:B.style.marginBottom})},[u,B]),a(()=>{I||T||(U.current=!1,H.current=!1,Xo(B,W.current))},[I,T,B,u]),a(()=>{let e=u.current;if(!I||!z||!B||!e||T&&!E||l.state.transitionStatus===`ending`)return;if(!T){U.current=!0,te.request(y),e.style.removeProperty(`--transform-origin`);return}let t=Ls(e);e.style.removeProperty(`--transform-origin`);try{let t=g.current;t?.isConnected||(t=!$.hasSelectedValue(l.state)&&h.current?.isConnected?h.current:null);let n=m.current,r=getComputedStyle(B),i=getComputedStyle(e),a=Y(z),o=ne(B),s=Ns(z),c=Fs(z.getBoundingClientRect(),s),u=Fs(B.getBoundingClientRect(),s),d=c.height,f=V||e,p=f.scrollHeight,_=parseFloat(i.borderBottomWidth),v=parseFloat(r.marginTop)||10,b=parseFloat(r.marginBottom)||10,C=parseFloat(r.minHeight)||100,w=js(i),T=a.documentElement.clientHeight-v-b,E=a.documentElement.clientWidth,O=T-c.bottom+d,k,A=M===`rtl`?c.right-u.width:c.left,j=0;if(t&&n){let e=Fs(n.getBoundingClientRect(),s);k=Fs(t.getBoundingClientRect(),s),A=u.left+(M===`rtl`?e.right-k.right:e.left-k.left);let r=e.top-c.top+e.height/2;j=k.top-u.top+k.height/2-r}let N=O+j+b+_,P=Math.min(T,N),F=T-v-b,I=N-P,L=E-5;B.style.left=`${io(A,5,L-u.width)}px`,B.style.height=`${P}px`,B.style.maxHeight=`auto`,B.style.marginTop=`${v}px`,B.style.marginBottom=`${b}px`,e.style.height=`100%`;let R=Ms(f),ee=I>=R-1;ee&&(P=Math.min(T,u.height)-(I-R));let te=c.top<20||c.bottom>T-20||Math.ceil(P)+1<Math.min(p,C),G=(o.visualViewport?.scale??1)!==1&&Ue;if(te||G){U.current=!0,Xo(B,W.current),D(!1);return}let re=Math.max(C,P);if(ee){let e=Math.max(0,T-N);B.style.top=u.height>=F?`0`:`${e}px`,B.style.height=`${P}px`,f.scrollTop=Ms(f)}else B.style.bottom=`0`,f.scrollTop=I;if(k){let t=u.top,n=u.height,r=k.top+k.height/2,i=io(n>0?(r-t)/n*100:50,0,100);e.style.setProperty(`--transform-origin`,`50% ${i}%`)}(re===T||P>=w)&&(H.current=!0),y(),S&&l.state.selectedIndex===null&&l.state.activeIndex===null&&x.current[0]!=null&&l.set(`activeIndex`,0),U.current=!0}finally{t()}},[l,I,B,z,m,h,g,u,y,T,D,te,O,k,V,x,S,M,E]),K.useEffect(()=>{if(!T||!B||!I)return;let e=ne(B);function t(e){p(!1,er($n,e))}return Tr(e,`resize`,t)},[p,T,B,I]);let ie={...V?{role:`presentation`,"aria-orientation":void 0}:{role:`listbox`,"aria-multiselectable":v||void 0,id:`${F}-list`},onKeyDown(e){_.current=!0,A&&Ts.has(e.key)&&e.stopPropagation()},onMouseMove(){_.current=!1},onScroll(e){V||G(e.currentTarget)},...T&&{style:V?{height:`100%`}:Zo}},ae=c(`div`,e,{ref:[t,u],state:re,stateAttributesMapping:ks,props:[R,ie,Qo(ee),{className:!V&&T?ms.className:void 0},s]});return(0,q.jsxs)(K.Fragment,{children:[!P&&ms.getElement(N),(0,q.jsx)(li,{context:j,modal:!1,disabled:!L,returnFocus:o,restoreFocus:!0,children:ae})]})});function js(e){let t=e.maxHeight||``;return t.endsWith(`px`)&&parseFloat(t)||1/0}function Ms(e){return ao(e.scrollHeight,e.clientHeight)}function Ns(e){return ta.getScale(e)}function Ps(e,t,n){return e/n[t]}function Fs(e,t){return Wt({x:Ps(e.x,`x`,t),y:Ps(e.y,`y`,t),width:Ps(e.width,`x`,t),height:Ps(e.height,`y`,t)})}var Is=[[`transform`,`none`],[`scale`,`1`],[`translate`,`0 0`]];function Ls(e){let{style:t}=e,n={};for(let[e,r]of Is)n[e]=t.getPropertyValue(e),t.setProperty(e,r,`important`);return()=>{for(let[e]of Is){let r=n[e];r?t.setProperty(e,r):t.removeProperty(e)}}}var Rs=K.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,{store:o,scrollHandlerRef:s}=Ba(),{alignItemWithTriggerActive:l}=Jo(),u=Q(o,$.hasScrollArrows),f=Q(o,$.openMethod),p=Q(o,$.multiple),m={id:`${Q(o,$.id)}-list`,role:`listbox`,"aria-multiselectable":p||void 0,onScroll(e){s.current?.(e.currentTarget)},...l&&{style:Zo},className:u&&f!==`touch`?ms.className:void 0};return c(`div`,e,{ref:[t,d(e=>{o.set(`listElement`,e)})],props:[m,a]})}),zs=function(e){return e[e.None=0]=`None`,e[e.GuessFromOrder=1]=`GuessFromOrder`,e}({});function Bs(e={}){let{label:t,metadata:n,textRef:r,indexGuessBehavior:i,index:o}=e,{register:s,unregister:c,subscribeMapChange:l,elementsRef:u,labelsRef:d,nextIndexRef:f}=Mo(),p=K.useRef(-1),[m,h]=K.useState(o??(i===zs.GuessFromOrder?()=>{if(p.current===-1){let e=f.current;f.current+=1,p.current=e}return p.current}:-1)),g=K.useRef(null),_=K.useCallback(e=>{if(g.current=e,m!==-1&&e!==null&&(u.current[m]=e,d)){let n=t!==void 0;d.current[m]=n?t:r?.current?.textContent??e.textContent}},[m,u,d,t,r]);return a(()=>{if(o!=null)return;let e=g.current;if(e)return s(e,n),()=>{c(e)}},[o,s,c,n]),a(()=>{if(o==null)return l(e=>{let t=g.current?e.get(g.current)?.index:null;t!=null&&h(t)})},[o,l,h]),K.useMemo(()=>({ref:_,index:m}),[m,_])}var Vs=K.createContext(void 0);function Hs(){let e=K.useContext(Vs);if(!e)throw Error(x(57));return e}var Us=K.memo(K.forwardRef(function(e,t){let{render:n,className:r,style:i,value:s=null,label:l,disabled:u=!1,nativeButton:d=!1,...f}=e,p=K.useRef(null),m=Bs({label:l,textRef:p,indexGuessBehavior:zs.GuessFromOrder}),{store:h,itemProps:g,setOpen:_,setValue:v,selectionRef:y,typingRef:b,valuesRef:x,multiple:S,selectedItemTextRef:C}=Ba(),w=Q(h,$.isActive,m.index),T=Q(h,$.isSelected,m.index,s),E=Q(h,$.isSelectedByFocus,m.index),D=Q(h,$.isItemEqualToValue),O=m.index,k=O!==-1,A=K.useRef(null);a(()=>{if(!k)return;let e=x.current;return e[O]=s,()=>{delete e[O]}},[k,O,s,x]),a(()=>{if(!k)return;let e=h.state.value,t=e;S&&Array.isArray(e)&&e.length>0&&(t=e[e.length-1]),t!==void 0&&Ua(s,t,D)&&(h.set(`selectedIndex`,O),p.current&&(C.current=p.current))},[k,O,S,D,h,s,C]);let j=K.useRef(null),M=K.useRef(`mouse`),N=K.useRef(!1),{getButtonProps:P,buttonRef:F}=o({disabled:u,focusableWhenDisabled:!0,native:d,composite:!0}),I={disabled:u,selected:T,highlighted:w};function L(e){let t=h.state.value;if(S){let n=Array.isArray(t)?t:[];v(T?Ka(n,s,D):[...n,s],er(Jn,e))}else v(s,er(Jn,e)),_(!1,er(Jn,e))}function R(){y.current.dragY=0}let ee={role:`option`,"aria-selected":T,tabIndex:w?0:-1,onKeyDown(e){j.current=e.key,h.set(`activeIndex`,O),e.key===` `&&b.current&&e.preventDefault()},onClick(e){let t=e.type===`click`&&M.current!==`touch`,n=e.nativeEvent.pointerType,r=t&&pt(e.nativeEvent)&&(n!==void 0||w),i=t&&!r&&!N.current;N.current=!1,!(e.type===`keydown`&&j.current===null)&&(u||e.type===`keydown`&&j.current===` `&&b.current||i||(j.current=null,L(e.nativeEvent)))},onPointerEnter(e){M.current=e.pointerType},onPointerMove(e){if(e.pointerType===`mouse`&&e.buttons===1){let t=y.current;t.dragY+=e.movementY,t.dragY**2>=64&&(t.allowUnselectedMouseUp=!0)}},onPointerDown(e){M.current=e.pointerType,N.current=!0,R()},onMouseUp(){if(R(),u||M.current===`touch`||N.current)return;let e=!y.current.allowSelectedMouseUp&&T,t=!y.current.allowUnselectedMouseUp&&!T;e||t||(N.current=!0,A.current?.click(),N.current=!1)}},z=c(`div`,e,{ref:[F,t,m.ref,A],state:I,props:[g,ee,f,P]}),B=K.useMemo(()=>({selected:T,index:O,textRef:p,selectedByFocus:E,hasRegistered:k}),[T,O,p,E,k]);return(0,q.jsx)(Vs.Provider,{value:B,children:z})})),Ws=K.forwardRef(function(e,t){let n=e.keepMounted??!1,{selected:r}=Hs();return n||r?(0,q.jsx)(Gs,{...e,ref:t}):null}),Gs=K.memo(K.forwardRef((e,t)=>{let{render:n,className:r,style:i,keepMounted:a,...o}=e,{selected:s}=Hs(),l=K.useRef(null),{transitionStatus:u,setMounted:d}=Hn(s),f=c(`span`,e,{ref:[t,l],state:{selected:s,transitionStatus:u},props:[{"aria-hidden":!0,children:`✔️`},o],stateAttributesMapping:zn});return Vn({open:s,ref:l,onComplete(){s||d(!1)}}),f})),Ks=K.memo(K.forwardRef(function(e,t){let{index:n,textRef:r,selectedByFocus:i,hasRegistered:a}=Hs(),{firstItemTextRef:o,selectedItemTextRef:s}=Ba(),{render:l,className:u,style:d,...f}=e;return c(`div`,e,{ref:[K.useCallback(e=>{e&&(a&&n===0&&(o.current=e),a&&i&&(s.current=e))},[o,s,n,i,a]),t,r],props:f})})),qs=K.forwardRef(function(e,t){let{render:n,className:r,style:i,direction:o,keepMounted:s=!1,...l}=e,u=o===`up`,{store:d,popupRef:f,listRef:p,handleScrollArrowVisibility:m,scrollArrowsMountedCountRef:h}=Ba(),{side:g,scrollDownArrowRef:_,scrollUpArrowRef:v}=Jo(),y=Q(d,u?$.scrollUpArrowVisible:$.scrollDownArrowVisible),b=Q(d,$.openMethod),x=y&&b!==`touch`,S=An(),C=u?v:_,{transitionStatus:w,setMounted:T}=Hn(x);a(()=>(h.current+=1,d.state.hasScrollArrows||d.set(`hasScrollArrows`,!0),()=>{h.current=Math.max(0,h.current-1),h.current===0&&d.state.hasScrollArrows&&d.set(`hasScrollArrows`,!1)}),[d,h]),Vn({open:x,ref:C,onComplete(){x||T(!1)}});let E=c(`div`,e,{ref:[t,C],state:{direction:o,visible:x,side:g,transitionStatus:w},props:[{"aria-hidden":!0,children:u?`▲`:`▼`,style:{position:`absolute`},onMouseMove(e){if(e.movementX===0&&e.movementY===0||S.isStarted())return;d.set(`activeIndex`,null);function t(){let e=d.state.listElement??f.current;if(!e)return;d.set(`activeIndex`,null),m();let n=ao(e.scrollHeight,e.clientHeight),r=oo(e.scrollTop,n),i=r===(u?0:n),a=p.current;if(r!==e.scrollTop&&(e.scrollTop=r),a.length===0&&d.set(u?`scrollUpArrowVisible`:`scrollDownArrowVisible`,!i),i){S.clear();return}if(a.length>0){let t=C.current?.offsetHeight||0;e.scrollTop=Js(a,u,r,e.clientHeight,t,n)}S.start(40,t)}S.start(40,t)},onMouseLeave(){S.clear()}},l]});return x||s?E:null});function Js(e,t,n,r,i,a){if(t){let t=0,r=n+i-1;for(let n=0;n<e.length;n+=1){let i=e[n];if(i&&i.offsetTop>=r){t=n;break}}let o=Math.max(0,t-1),s=e[o];return o<t&&s?oo(s.offsetTop-i,a):0}let o=e.length-1,s=n+r-i+1;for(let t=0;t<e.length;t+=1){let n=e[t];if(n&&n.offsetTop+n.offsetHeight>s){o=Math.max(0,t-1);break}}let c=Math.min(e.length-1,o+1),l=e[c];return c>o&&l?oo(l.offsetTop+l.offsetHeight-r+i,a):a}var Ys=K.forwardRef(function(e,t){return(0,q.jsx)(qs,{...e,ref:t,direction:`down`})}),Xs=K.forwardRef(function(e,t){return(0,q.jsx)(qs,{...e,ref:t,direction:`up`})}),Zs=so;function Qs({className:e,...t}){return(0,q.jsx)(Eo,{"data-slot":`select-value`,className:_(`flex flex-1 text-left`,e),...t})}function $s({className:e,size:t=`default`,children:n,...r}){return(0,q.jsxs)(wo,{"data-slot":`select-trigger`,"data-size":t,className:_(`flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,e),...r,children:[n,(0,q.jsx)(Do,{render:(0,q.jsx)(G,{className:`pointer-events-none size-4 text-muted-foreground`})})]})}function ec({className:e,children:t,side:n=`bottom`,sideOffset:r=4,align:i=`start`,alignOffset:a=0,alignItemWithTrigger:o=!1,...s}){return(0,q.jsx)(ko,{children:(0,q.jsx)(fs,{side:n,sideOffset:r,align:i,alignOffset:a,alignItemWithTrigger:o,className:`isolate z-50`,children:(0,q.jsxs)(As,{"data-slot":`select-content`,"data-align-trigger":o,className:_(`relative isolate z-50 max-h-(--available-height) w-(--anchor-width) min-w-36 origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-sm border border-border-soft bg-surface p-1 text-popover-foreground shadow-deep`,e),...s,children:[(0,q.jsx)(nc,{}),(0,q.jsx)(Rs,{children:t}),(0,q.jsx)(rc,{})]})})})}function tc({className:e,children:t,...n}){return(0,q.jsxs)(Us,{"data-slot":`select-item`,className:_(`relative flex w-full cursor-default items-center gap-1.5 rounded-sm py-1 pr-8 pl-1.5 text-sm outline-hidden transition-colors select-none focus:bg-surface-elevated focus:text-text data-selected:text-accent data-disabled:pointer-events-none data-disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 *:[span]:last:flex *:[span]:last:items-center *:[span]:last:gap-2`,e),...n,children:[(0,q.jsx)(Ks,{className:`flex flex-1 shrink-0 gap-2 whitespace-nowrap`,children:t}),(0,q.jsx)(Ws,{render:(0,q.jsx)(`span`,{className:`pointer-events-none absolute right-2 flex size-4 items-center justify-center`}),children:(0,q.jsx)(j,{className:`pointer-events-none`})})]})}function nc({className:e,...t}){return(0,q.jsx)(Xs,{"data-slot":`select-scroll-up-button`,className:_(`top-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,q.jsx)(le,{})})}function rc({className:e,...t}){return(0,q.jsx)(Ys,{"data-slot":`select-scroll-down-button`,className:_(`bottom-0 z-10 flex w-full cursor-default items-center justify-center bg-popover py-1 [&_svg:not([class*='size-'])]:size-4`,e),...t,children:(0,q.jsx)(G,{})})}function ic(e,t){return t.find(t=>t.kind===e)?.label??e}function ac(e){return e?e===`xhigh`?`Extra High`:e===`claude-opus-4-8`?`Claude Opus 4.8`:e===`claude-opus-4-6`?`Claude Opus 4.6`:e===`claude-sonnet-4-6`?`Claude Sonnet 4.6`:e===`gpt-6-astra`?`GPT-6 Astra`:e===`gpt-6-sol`?`GPT-6 Sol`:e===`gpt-6-luna`?`GPT-6 Luna`:e===`gpt-5.6-sol`?`GPT-5.6 Sol`:e===`gpt-5.6-terra`?`GPT-5.6 Terra`:e===`gpt-5.6-luna`?`GPT-5.6 Luna`:e===`deepseek/deepseek-v4-pro`?`DeepSeek V4 Pro`:e===`deepseek/deepseek-flash`||e===`deepseek/deepseek-v4-flash`||e===`deepseek/deepseek-v4-flash-vision-exp`?`DeepSeek V4.1 Flash`:/^[a-z]+$/.test(e)?`${e.charAt(0).toUpperCase()}${e.slice(1)}`:e:``}var oc={missing_token:``,wrong_token_type:``,unknown_token_type:"This doesn't look like a Slack token. Bot tokens start with `xoxb-`, app-level tokens with `xapp-`.",invalid_token:`Slack didn't recognize this token. Check you copied the whole thing and the app is still installed.`,missing_connections_write:"Slack says this App-Level Token is missing `connections:write`. In App-Level Tokens, regenerate it with that scope checked.",not_bot_token:"Slack says this is not the Bot User OAuth Token. Copy Bot User OAuth Token from OAuth & Permissions. It starts with `xoxb-`.",slack_api_error:`Couldn't reach Slack to check this token. Try again in a moment.`},sc=`These two tokens are from different Slack apps. Make sure both came from the same app you just created.`;function cc(e){return e.valid?{status:`verified`,result:e}:{status:`failed`,result:e}}function lc(e,t){return!e.reason||e.reason===`missing_token`?``:e.reason===`wrong_token_type`?t===`app`?"That’s a Bot token (`xoxb-…`). The App-Level Token goes here. It starts with `xapp-`.":"That’s an App-Level Token (`xapp-…`). The Bot User OAuth Token goes here. It starts with `xoxb-`.":oc[e.reason]||`Validation failed.`}function uc({n:e,done:t,active:n,onClick:r}){return(0,q.jsx)(`span`,{onClick:r,title:r?`Go back to this step`:void 0,className:[`font-sans mt-px flex h-6 w-6 shrink-0 items-center justify-center rounded-full border text-[11px] font-semibold transition-opacity`,t?`border-health-ok bg-health-ok-soft text-health-ok`:n?`border-health-warn/50 text-health-warn`:`border-border text-text-subtle`,r?`cursor-pointer hover:opacity-60`:``].join(` `),children:t?(0,q.jsx)(j,{className:`h-3.5 w-3.5`}):e})}function dc({state:e,field:t}){if(e.status===`idle`)return null;if(e.status===`pending`)return(0,q.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 font-sans text-[12px] text-text-muted`,children:[(0,q.jsx)(E,{className:`h-3.5 w-3.5 animate-spin`}),(0,q.jsx)(`span`,{children:`Checking with Slack…`})]});if(e.status===`verified`){let n=t===`bot`&&e.result.botName?`@${e.result.botName}${e.result.workspaceName?` · ${e.result.workspaceName}`:``}`:e.result.workspaceName??`Verified`;return(0,q.jsxs)(`div`,{className:`mt-1.5 flex items-center gap-1.5 font-sans text-[12px] text-health-ok`,children:[(0,q.jsx)(j,{className:`h-3.5 w-3.5 shrink-0`}),(0,q.jsx)(`span`,{children:n})]})}return(0,q.jsxs)(`div`,{className:`mt-1.5 flex items-start gap-1.5 font-sans text-[12px] text-health-error`,children:[(0,q.jsx)(s,{className:`mt-px h-3.5 w-3.5 shrink-0`}),(0,q.jsx)(`span`,{children:lc(e.result,t)})]})}function fc({conn:e}){return(0,q.jsxs)(`div`,{className:`flex items-center gap-3 rounded-sm border border-health-ok/30 bg-health-ok-soft px-4 py-3`,children:[(0,q.jsxs)(`div`,{className:`flex flex-1 min-w-0 items-center gap-2`,children:[e.workspaceIconUrl&&(0,q.jsx)(`img`,{src:e.workspaceIconUrl,alt:``,className:`h-5 w-5 shrink-0 rounded-sm object-cover`}),(0,q.jsxs)(`span`,{className:`font-serif text-[13px] text-text`,children:[`Connected to `,(0,q.jsx)(`strong`,{children:e.workspaceName??`your workspace`}),e.botName?(0,q.jsxs)(q.Fragment,{children:[` `,`as`,` `,e.botAvatarUrl&&(0,q.jsx)(`img`,{src:e.botAvatarUrl,alt:``,className:`mx-0.5 inline h-4 w-4 rounded-full object-cover align-middle`}),(0,q.jsxs)(`strong`,{children:[`@`,e.botName]})]}):null]})]}),(0,q.jsx)(j,{className:`h-4 w-4 shrink-0 text-health-ok`})]})}function pc({agentId:e,onConnect:t}){let[n,r]=(0,K.useState)(!1),[i,a]=(0,K.useState)(``),[o,c]=(0,K.useState)(``),[l,u]=(0,K.useState)({status:`idle`}),[d,p]=(0,K.useState)({status:`idle`}),[m,g]=(0,K.useState)(null),[_,v]=(0,K.useState)(!1),[y,b]=(0,K.useState)(),[x,S]=(0,K.useState)(!1),C=(0,K.useRef)(null),w=l.status===`verified`,T=d.status===`verified`,D=n,O=w,k=n&&O,A=T,j=(0,K.useCallback)(async t=>{if(t.trim()){u({status:`pending`}),g(null);try{let n=await V(e,{appToken:t.trim()});n.app&&u(cc(n.app))}catch{u({status:`failed`,result:{valid:!1,expected:`app`,reason:`slack_api_error`}})}}},[e]),M=(0,K.useCallback)(async t=>{if(t.trim()){p({status:`pending`}),g(null);try{let n=await V(e,{botToken:t.trim()});n.bot&&p(cc(n.bot))}catch{p({status:`failed`,result:{valid:!1,expected:`bot`,reason:`slack_api_error`}})}}},[e]);async function N(){if(!(_||x)){v(!0),b(void 0);try{await h(e,{appToken:i.trim(),botToken:o.trim()}),S(!0),f(),t?.()}catch(e){b(e instanceof Error?e.message:`Connection failed`),g(null)}finally{v(!1)}}}async function P(){try{let t=await V(e,{appToken:i.trim(),botToken:o.trim()});t.connection.valid?(g(t.connection),N()):t.connection.reason===`app_mismatch`?(b(sc),u({status:`idle`}),p({status:`idle`}),g(null)):t.connection.reason===`incomplete`||b(`Could not connect. Try again.`)}catch{b(`Could not reach Slack to validate the token pair.`)}}(0,K.useEffect)(()=>{w&&T&&!_&&!x&&setTimeout(()=>void P(),0)},[w,T]);function F(e){C.current&&clearTimeout(C.current);let t=e.trim();if(t.length<=20)return;let n=t.startsWith(`xoxb-`)?300:600;C.current=setTimeout(()=>void j(t),n)}function I(e){C.current&&clearTimeout(C.current);let t=e.trim();if(t.length<=20)return;let n=t.startsWith(`xapp-`)?300:600;C.current=setTimeout(()=>void M(t),n)}function L(e){a(e),u({status:`idle`}),g(null),b(void 0),F(e)}function R(e){c(e),p({status:`idle`}),g(null),b(void 0),I(e)}function ee(){window.open(`/api/agents/${encodeURIComponent(e)}/slack/install`,`_blank`,`noopener,noreferrer`),r(!0)}return(0,q.jsxs)(`div`,{className:`space-y-5`,children:[(0,q.jsxs)(`div`,{className:`flex gap-3`,children:[(0,q.jsx)(uc,{n:1,done:n,active:!0,onClick:n?()=>{r(!1),a(``),c(``),u({status:`idle`}),p({status:`idle`}),S(!1),b(void 0),g(null)}:void 0}),(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Create & install the Slack app`}),(0,q.jsxs)(`div`,{className:`mt-1 font-serif text-[13px] leading-snug text-text-muted`,children:[(0,q.jsx)(`button`,{onClick:ee,className:`font-serif text-[13px] text-accent underline decoration-accent/40 underline-offset-2 hover:decoration-accent`,children:`Create app in Slack`}),` `,`→ pick your workspace → click `,(0,q.jsx)(`strong`,{children:`Install`}),`.`,` `,`Anima fills in the manifest; reusing an older app only works if Interactivity is enabled.`]}),!n&&(0,q.jsx)(`button`,{onClick:()=>r(!0),className:`mt-1.5 font-sans text-[11px] text-text-subtle underline decoration-text-subtle/40 underline-offset-2 hover:text-text-muted hover:decoration-text-muted/40`,children:`I already created the app`})]})]}),(0,q.jsxs)(`div`,{className:[`flex gap-3`,D?``:`pointer-events-none opacity-40`].join(` `),children:[(0,q.jsx)(uc,{n:2,done:O,active:D,onClick:O?()=>{a(``),u({status:`idle`}),S(!1),b(void 0),g(null)}:void 0}),(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Paste App-Level Token`}),(0,q.jsxs)(`div`,{className:`mt-1 font-serif text-[13px] leading-snug text-text-muted`,children:[`In Slack: Basic Information → App-Level Tokens → Generate. Add scope`,` `,(0,q.jsx)(`span`,{className:`font-mono text-[11px]`,children:`connections:write`}),`, then paste the`,` `,(0,q.jsx)(`span`,{className:`font-mono text-[11px]`,children:`xapp-…`}),` token here.`]}),D&&(0,q.jsxs)(`div`,{className:`mt-2`,children:[(0,q.jsx)(`input`,{"aria-label":`App-Level Token`,autoComplete:`off`,type:`text`,value:i,onChange:e=>L(e.target.value),onBlur:()=>{let e=i.trim();e.length>20&&l.status===`idle`&&j(e)},placeholder:`xapp-…`,disabled:w||_,spellCheck:!1,className:[`w-full rounded-sm border bg-muted/30 px-3 py-1.5 font-mono text-[12px] text-text placeholder:font-sans placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-ring`,l.status===`verified`?`border-health-ok/50`:l.status===`failed`?`border-health-error/50`:`border-border`].join(` `)}),(0,q.jsx)(dc,{state:l,field:`app`})]})]})]}),(0,q.jsxs)(`div`,{className:[`flex gap-3`,k?``:`pointer-events-none opacity-40`].join(` `),children:[(0,q.jsx)(uc,{n:3,done:A,active:k,onClick:A?()=>{c(``),p({status:`idle`}),S(!1),b(void 0),g(null)}:void 0}),(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Paste Bot User OAuth Token`}),(0,q.jsxs)(`div`,{className:`mt-1 font-serif text-[13px] leading-snug text-text-muted`,children:[`In Slack: OAuth & Permissions → Install to Workspace. Copy`,` `,(0,q.jsx)(`strong`,{children:`Bot User OAuth Token`}),` and paste the`,` `,(0,q.jsx)(`span`,{className:`font-mono text-[11px]`,children:`xoxb-…`}),` token here.`]}),k&&(0,q.jsxs)(`div`,{className:`mt-2 space-y-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`input`,{"aria-label":`Bot User OAuth Token`,autoComplete:`off`,type:`text`,value:o,onChange:e=>R(e.target.value),onBlur:()=>{let e=o.trim();e.length>20&&d.status===`idle`&&M(e)},placeholder:`xoxb-…`,disabled:T||_,spellCheck:!1,className:[`w-full rounded-sm border bg-muted/30 px-3 py-1.5 font-mono text-[12px] text-text placeholder:font-sans placeholder:text-text-muted focus:outline-none focus:ring-1 focus:ring-ring`,d.status===`verified`?`border-health-ok/50`:d.status===`failed`?`border-health-error/50`:`border-border`].join(` `)}),(0,q.jsx)(dc,{state:d,field:`bot`})]}),_&&(0,q.jsxs)(`div`,{className:`flex items-center gap-1.5 font-sans text-[12px] text-text-muted`,children:[(0,q.jsx)(E,{className:`h-3.5 w-3.5 animate-spin`}),(0,q.jsx)(`span`,{children:`Connecting…`})]}),y&&(0,q.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,q.jsx)(s,{className:`mt-px h-3.5 w-3.5 shrink-0 text-health-error`}),(0,q.jsx)(`span`,{className:`font-sans text-[12px] text-health-error`,children:y})]})]})]})]}),m?.valid&&(0,q.jsx)(fc,{conn:m})]})}var mc=2e3,hc=[`starting`,`waiting`,`slow_down`,`domain_switched`];function gc(e){return!!(e&&hc.includes(e.state))}function _c({agentId:e,enabled:t=!0,intervalMs:n=mc,isCurrentRun:r,onError:i,onStatus:a,registration:o,shouldPoll:s=gc}){let c=(0,K.useRef)(!1),l=(0,K.useRef)(r),u=(0,K.useRef)(i),d=(0,K.useRef)(a),f=(0,K.useRef)(s);(0,K.useEffect)(()=>{l.current=r,u.current=i,d.current=a,f.current=s},[r,i,a,s]),(0,K.useEffect)(()=>(c.current=!0,()=>{c.current=!1}),[]);let p=(0,K.useCallback)(e=>c.current&&(e?e():!0),[]),h=(0,K.useCallback)(async(t,r)=>{let i=t;for(;r.shouldContinue(i);){if(await vc(n),!p(r.isCurrentRun)||(i=await m(r.agentId??e,i.registrationId),!p(r.isCurrentRun)))return null;r.onStatus?.(i)}return i},[e,n,p]);return(0,K.useEffect)(()=>{if(!t||!o?.registrationId||!f.current(o))return;let r=!1,i=window.setInterval(()=>{m(e,o.registrationId).then(e=>{r||!p(l.current)||(f.current(e)||(r=!0,window.clearInterval(i)),d.current?.(e))}).catch(e=>{r||!p(l.current)||u.current?.(e)})},n);return()=>{r=!0,window.clearInterval(i)}},[e,t,n,p,o?.registrationId,o]),{pollUntil:h}}function vc(e){return new Promise(t=>window.setTimeout(t,e))}var yc=r(((e,t)=>{t.exports=`SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED`})),bc=r(((e,t)=>{var n=yc();function r(){}function i(){}i.resetWarningCache=r,t.exports=function(){function e(e,t,r,i,a,o){if(o!==n){var s=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw s.name=`Invariant Violation`,s}}e.isRequired=e;function t(){return e}var a={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:r};return a.PropTypes=a,a}})),xc=r(((e,t)=>{t.exports=bc()()})),Sc=r(((e,t)=>{t.exports={L:1,M:0,Q:3,H:2}})),Cc=r(((e,t)=>{t.exports={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8}})),wc=r(((e,t)=>{var n=Cc();function r(e){this.mode=n.MODE_8BIT_BYTE,this.data=e}r.prototype={getLength:function(e){return this.data.length},write:function(e){for(var t=0;t<this.data.length;t++)e.put(this.data.charCodeAt(t),8)}},t.exports=r})),Tc=r(((e,t)=>{var n=Sc();function r(e,t){this.totalCount=e,this.dataCount=t}r.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]],r.getRSBlocks=function(e,t){var n=r.getRsBlockTable(e,t);if(n==null)throw Error(`bad rs block @ typeNumber:`+e+`/errorCorrectLevel:`+t);for(var i=n.length/3,a=[],o=0;o<i;o++)for(var s=n[o*3+0],c=n[o*3+1],l=n[o*3+2],u=0;u<s;u++)a.push(new r(c,l));return a},r.getRsBlockTable=function(e,t){switch(t){case n.L:return r.RS_BLOCK_TABLE[(e-1)*4+0];case n.M:return r.RS_BLOCK_TABLE[(e-1)*4+1];case n.Q:return r.RS_BLOCK_TABLE[(e-1)*4+2];case n.H:return r.RS_BLOCK_TABLE[(e-1)*4+3];default:return}},t.exports=r})),Ec=r(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){var t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(var n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){var t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),Dc=r(((e,t)=>{for(var n={glog:function(e){if(e<1)throw Error(`glog(`+e+`)`);return n.LOG_TABLE[e]},gexp:function(e){for(;e<0;)e+=255;for(;e>=256;)e-=255;return n.EXP_TABLE[e]},EXP_TABLE:Array(256),LOG_TABLE:Array(256)},r=0;r<8;r++)n.EXP_TABLE[r]=1<<r;for(var r=8;r<256;r++)n.EXP_TABLE[r]=n.EXP_TABLE[r-4]^n.EXP_TABLE[r-5]^n.EXP_TABLE[r-6]^n.EXP_TABLE[r-8];for(var r=0;r<255;r++)n.LOG_TABLE[n.EXP_TABLE[r]]=r;t.exports=n})),Oc=r(((e,t)=>{var n=Dc();function r(e,t){if(e.length==null)throw Error(e.length+`/`+t);for(var n=0;n<e.length&&e[n]==0;)n++;this.num=Array(e.length-n+t);for(var r=0;r<e.length-n;r++)this.num[r]=e[r+n]}r.prototype={get:function(e){return this.num[e]},getLength:function(){return this.num.length},multiply:function(e){for(var t=Array(this.getLength()+e.getLength()-1),i=0;i<this.getLength();i++)for(var a=0;a<e.getLength();a++)t[i+a]^=n.gexp(n.glog(this.get(i))+n.glog(e.get(a)));return new r(t,0)},mod:function(e){if(this.getLength()-e.getLength()<0)return this;for(var t=n.glog(this.get(0))-n.glog(e.get(0)),i=Array(this.getLength()),a=0;a<this.getLength();a++)i[a]=this.get(a);for(var a=0;a<e.getLength();a++)i[a]^=n.gexp(n.glog(e.get(a))+t);return new r(i,0).mod(e)}},t.exports=r})),kc=r(((e,t)=>{var n=Cc(),r=Oc(),i=Dc(),a={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:1335,G18:7973,G15_MASK:21522,getBCHTypeInfo:function(e){for(var t=e<<10;o.getBCHDigit(t)-o.getBCHDigit(o.G15)>=0;)t^=o.G15<<o.getBCHDigit(t)-o.getBCHDigit(o.G15);return(e<<10|t)^o.G15_MASK},getBCHTypeNumber:function(e){for(var t=e<<12;o.getBCHDigit(t)-o.getBCHDigit(o.G18)>=0;)t^=o.G18<<o.getBCHDigit(t)-o.getBCHDigit(o.G18);return e<<12|t},getBCHDigit:function(e){for(var t=0;e!=0;)t++,e>>>=1;return t},getPatternPosition:function(e){return o.PATTERN_POSITION_TABLE[e-1]},getMask:function(e,t,n){switch(e){case a.PATTERN000:return(t+n)%2==0;case a.PATTERN001:return t%2==0;case a.PATTERN010:return n%3==0;case a.PATTERN011:return(t+n)%3==0;case a.PATTERN100:return(Math.floor(t/2)+Math.floor(n/3))%2==0;case a.PATTERN101:return t*n%2+t*n%3==0;case a.PATTERN110:return(t*n%2+t*n%3)%2==0;case a.PATTERN111:return(t*n%3+(t+n)%2)%2==0;default:throw Error(`bad maskPattern:`+e)}},getErrorCorrectPolynomial:function(e){for(var t=new r([1],0),n=0;n<e;n++)t=t.multiply(new r([1,i.gexp(n)],0));return t},getLengthInBits:function(e,t){if(1<=t&&t<10)switch(e){case n.MODE_NUMBER:return 10;case n.MODE_ALPHA_NUM:return 9;case n.MODE_8BIT_BYTE:return 8;case n.MODE_KANJI:return 8;default:throw Error(`mode:`+e)}else if(t<27)switch(e){case n.MODE_NUMBER:return 12;case n.MODE_ALPHA_NUM:return 11;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 10;default:throw Error(`mode:`+e)}else if(t<41)switch(e){case n.MODE_NUMBER:return 14;case n.MODE_ALPHA_NUM:return 13;case n.MODE_8BIT_BYTE:return 16;case n.MODE_KANJI:return 12;default:throw Error(`mode:`+e)}else throw Error(`type:`+t)},getLostPoint:function(e){for(var t=e.getModuleCount(),n=0,r=0;r<t;r++)for(var i=0;i<t;i++){for(var a=0,o=e.isDark(r,i),s=-1;s<=1;s++)if(!(r+s<0||t<=r+s))for(var c=-1;c<=1;c++)i+c<0||t<=i+c||s==0&&c==0||o==e.isDark(r+s,i+c)&&a++;a>5&&(n+=3+a-5)}for(var r=0;r<t-1;r++)for(var i=0;i<t-1;i++){var l=0;e.isDark(r,i)&&l++,e.isDark(r+1,i)&&l++,e.isDark(r,i+1)&&l++,e.isDark(r+1,i+1)&&l++,(l==0||l==4)&&(n+=3)}for(var r=0;r<t;r++)for(var i=0;i<t-6;i++)e.isDark(r,i)&&!e.isDark(r,i+1)&&e.isDark(r,i+2)&&e.isDark(r,i+3)&&e.isDark(r,i+4)&&!e.isDark(r,i+5)&&e.isDark(r,i+6)&&(n+=40);for(var i=0;i<t;i++)for(var r=0;r<t-6;r++)e.isDark(r,i)&&!e.isDark(r+1,i)&&e.isDark(r+2,i)&&e.isDark(r+3,i)&&e.isDark(r+4,i)&&!e.isDark(r+5,i)&&e.isDark(r+6,i)&&(n+=40);for(var u=0,i=0;i<t;i++)for(var r=0;r<t;r++)e.isDark(r,i)&&u++;var d=Math.abs(100*u/t/t-50)/5;return n+=d*10,n}};t.exports=o})),Ac=r(((e,t)=>{var n=wc(),r=Tc(),i=Ec(),a=kc(),o=Oc();function s(e,t){this.typeNumber=e,this.errorCorrectLevel=t,this.modules=null,this.moduleCount=0,this.dataCache=null,this.dataList=[]}var c=s.prototype;c.addData=function(e){var t=new n(e);this.dataList.push(t),this.dataCache=null},c.isDark=function(e,t){if(e<0||this.moduleCount<=e||t<0||this.moduleCount<=t)throw Error(e+`,`+t);return this.modules[e][t]},c.getModuleCount=function(){return this.moduleCount},c.make=function(){if(this.typeNumber<1){var e=1;for(e=1;e<40;e++){for(var t=r.getRSBlocks(e,this.errorCorrectLevel),n=new i,o=0,s=0;s<t.length;s++)o+=t[s].dataCount;for(var s=0;s<this.dataList.length;s++){var c=this.dataList[s];n.put(c.mode,4),n.put(c.getLength(),a.getLengthInBits(c.mode,e)),c.write(n)}if(n.getLengthInBits()<=o*8)break}this.typeNumber=e}this.makeImpl(!1,this.getBestMaskPattern())},c.makeImpl=function(e,t){this.moduleCount=this.typeNumber*4+17,this.modules=Array(this.moduleCount);for(var n=0;n<this.moduleCount;n++){this.modules[n]=Array(this.moduleCount);for(var r=0;r<this.moduleCount;r++)this.modules[n][r]=null}this.setupPositionProbePattern(0,0),this.setupPositionProbePattern(this.moduleCount-7,0),this.setupPositionProbePattern(0,this.moduleCount-7),this.setupPositionAdjustPattern(),this.setupTimingPattern(),this.setupTypeInfo(e,t),this.typeNumber>=7&&this.setupTypeNumber(e),this.dataCache??=s.createData(this.typeNumber,this.errorCorrectLevel,this.dataList),this.mapData(this.dataCache,t)},c.setupPositionProbePattern=function(e,t){for(var n=-1;n<=7;n++)if(!(e+n<=-1||this.moduleCount<=e+n))for(var r=-1;r<=7;r++)t+r<=-1||this.moduleCount<=t+r||(0<=n&&n<=6&&(r==0||r==6)||0<=r&&r<=6&&(n==0||n==6)||2<=n&&n<=4&&2<=r&&r<=4?this.modules[e+n][t+r]=!0:this.modules[e+n][t+r]=!1)},c.getBestMaskPattern=function(){for(var e=0,t=0,n=0;n<8;n++){this.makeImpl(!0,n);var r=a.getLostPoint(this);(n==0||e>r)&&(e=r,t=n)}return t},c.createMovieClip=function(e,t,n){var r=e.createEmptyMovieClip(t,n),i=1;this.make();for(var a=0;a<this.modules.length;a++)for(var o=a*i,s=0;s<this.modules[a].length;s++){var c=s*i;this.modules[a][s]&&(r.beginFill(0,100),r.moveTo(c,o),r.lineTo(c+i,o),r.lineTo(c+i,o+i),r.lineTo(c,o+i),r.endFill())}return r},c.setupTimingPattern=function(){for(var e=8;e<this.moduleCount-8;e++)this.modules[e][6]??(this.modules[e][6]=e%2==0);for(var t=8;t<this.moduleCount-8;t++)this.modules[6][t]??(this.modules[6][t]=t%2==0)},c.setupPositionAdjustPattern=function(){for(var e=a.getPatternPosition(this.typeNumber),t=0;t<e.length;t++)for(var n=0;n<e.length;n++){var r=e[t],i=e[n];if(this.modules[r][i]==null)for(var o=-2;o<=2;o++)for(var s=-2;s<=2;s++)o==-2||o==2||s==-2||s==2||o==0&&s==0?this.modules[r+o][i+s]=!0:this.modules[r+o][i+s]=!1}},c.setupTypeNumber=function(e){for(var t=a.getBCHTypeNumber(this.typeNumber),n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[Math.floor(n/3)][n%3+this.moduleCount-8-3]=r}for(var n=0;n<18;n++){var r=!e&&(t>>n&1)==1;this.modules[n%3+this.moduleCount-8-3][Math.floor(n/3)]=r}},c.setupTypeInfo=function(e,t){for(var n=this.errorCorrectLevel<<3|t,r=a.getBCHTypeInfo(n),i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<6?this.modules[i][8]=o:i<8?this.modules[i+1][8]=o:this.modules[this.moduleCount-15+i][8]=o}for(var i=0;i<15;i++){var o=!e&&(r>>i&1)==1;i<8?this.modules[8][this.moduleCount-i-1]=o:i<9?this.modules[8][15-i-1+1]=o:this.modules[8][15-i-1]=o}this.modules[this.moduleCount-8][8]=!e},c.mapData=function(e,t){for(var n=-1,r=this.moduleCount-1,i=7,o=0,s=this.moduleCount-1;s>0;s-=2)for(s==6&&s--;;){for(var c=0;c<2;c++)if(this.modules[r][s-c]==null){var l=!1;o<e.length&&(l=(e[o]>>>i&1)==1),a.getMask(t,r,s-c)&&(l=!l),this.modules[r][s-c]=l,i--,i==-1&&(o++,i=7)}if(r+=n,r<0||this.moduleCount<=r){r-=n,n=-n;break}}},s.PAD0=236,s.PAD1=17,s.createData=function(e,t,n){for(var o=r.getRSBlocks(e,t),c=new i,l=0;l<n.length;l++){var u=n[l];c.put(u.mode,4),c.put(u.getLength(),a.getLengthInBits(u.mode,e)),u.write(c)}for(var d=0,l=0;l<o.length;l++)d+=o[l].dataCount;if(c.getLengthInBits()>d*8)throw Error(`code length overflow. (`+c.getLengthInBits()+`>`+d*8+`)`);for(c.getLengthInBits()+4<=d*8&&c.put(0,4);c.getLengthInBits()%8!=0;)c.putBit(!1);for(;!(c.getLengthInBits()>=d*8||(c.put(s.PAD0,8),c.getLengthInBits()>=d*8));)c.put(s.PAD1,8);return s.createBytes(c,o)},s.createBytes=function(e,t){for(var n=0,r=0,i=0,s=Array(t.length),c=Array(t.length),l=0;l<t.length;l++){var u=t[l].dataCount,d=t[l].totalCount-u;r=Math.max(r,u),i=Math.max(i,d),s[l]=Array(u);for(var f=0;f<s[l].length;f++)s[l][f]=255&e.buffer[f+n];n+=u;var p=a.getErrorCorrectPolynomial(d),m=new o(s[l],p.getLength()-1).mod(p);c[l]=Array(p.getLength()-1);for(var f=0;f<c[l].length;f++){var h=f+m.getLength()-c[l].length;c[l][f]=h>=0?m.get(h):0}}for(var g=0,f=0;f<t.length;f++)g+=t[f].totalCount;for(var _=Array(g),v=0,f=0;f<r;f++)for(var l=0;l<t.length;l++)f<s[l].length&&(_[v++]=s[l][f]);for(var f=0;f<i;f++)for(var l=0;l<t.length;l++)f<c[l].length&&(_[v++]=c[l][f]);return _},t.exports=s})),jc=r((e=>{Object.defineProperty(e,"__esModule",{value:!0});var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n=o(xc()),r=i(),a=o(r);function o(e){return e&&e.__esModule?e:{default:e}}function s(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}var c={bgColor:n.default.oneOfType([n.default.object,n.default.string]).isRequired,bgD:n.default.string.isRequired,fgColor:n.default.oneOfType([n.default.object,n.default.string]).isRequired,fgD:n.default.string.isRequired,size:n.default.number.isRequired,title:n.default.string,viewBoxSize:n.default.number.isRequired,xmlns:n.default.string},l=(0,r.forwardRef)(function(e,n){var r=e.bgColor,i=e.bgD,o=e.fgD,c=e.fgColor,l=e.size,u=e.title,d=e.viewBoxSize,f=e.xmlns,p=f===void 0?`http://www.w3.org/2000/svg`:f,m=s(e,[`bgColor`,`bgD`,`fgD`,`fgColor`,`size`,`title`,`viewBoxSize`,`xmlns`]);return a.default.createElement(`svg`,t({},m,{height:l,ref:n,viewBox:`0 0 `+d+` `+d,width:l,xmlns:p}),u?a.default.createElement(`title`,null,u):null,a.default.createElement(`path`,{d:i,fill:r}),a.default.createElement(`path`,{d:o,fill:c}))});l.displayName=`QRCodeSvg`,l.propTypes=c,e.default=l})),Mc=r((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.QRCode=void 0;var t=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},n=l(xc()),r=l(Sc()),a=l(Ac()),o=i(),s=l(o),c=l(jc());function l(e){return e&&e.__esModule?e:{default:e}}function u(e,t){var n={};for(var r in e)t.indexOf(r)>=0||Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=e[r]);return n}function d(e){return e.map(function(e){return String.fromCharCode(e&255)}).join(``)}function f(e){return Array.from(new TextEncoder().encode(e))}var p={bgColor:n.default.oneOfType([n.default.object,n.default.string]),fgColor:n.default.oneOfType([n.default.object,n.default.string]),level:n.default.string,size:n.default.number,value:n.default.string.isRequired},m=(0,o.forwardRef)(function(e,n){var i=e.bgColor,o=i===void 0?`#FFFFFF`:i,l=e.fgColor,p=l===void 0?`#000000`:l,m=e.level,h=m===void 0?`L`:m,g=e.size,_=g===void 0?256:g,v=e.value,y=u(e,[`bgColor`,`fgColor`,`level`,`size`,`value`]),b=new a.default(-1,r.default[h]),x=d(f(v));b.addData(x,`Byte`),b.make();var S=b.modules;return s.default.createElement(c.default,t({},y,{bgColor:o,bgD:S.map(function(e,t){return e.map(function(e,n){return e?``:`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`}).join(` `)}).join(` `),fgColor:p,fgD:S.map(function(e,t){return e.map(function(e,n){return e?`M `+n+` `+t+` l 1 0 0 1 -1 0 Z`:``}).join(` `)}).join(` `),ref:n,size:_,viewBoxSize:S.length}))});e.QRCode=m,m.displayName=`QRCode`,m.propTypes=p}))(),Nc=15e3;function Pc(){return(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,q.jsx)(E,{className:`h-4 w-4 animate-spin`}),`Creating your Feishu app…`]})}function Fc(){return(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,q.jsx)(E,{className:`h-4 w-4 animate-spin`}),`Connecting…`]})}function Ic(){return(0,q.jsx)(`p`,{className:`text-center font-sans text-[12px] text-text-subtle`,children:`This is taking longer than usual.`})}function Lc({frame:e=`plain`,verificationUrl:n}){let r=ie(),i=e===`card`?`rounded-sm border border-border-soft bg-surface px-4 py-6`:`px-2 py-6`;return r?(0,q.jsxs)(`div`,{className:`flex flex-col items-center ${i} text-center`,children:[(0,q.jsxs)(g,{className:`w-full max-w-xs`,render:(0,q.jsx)(`a`,{href:n,rel:`noreferrer`,target:`_blank`}),children:[`Open Feishu`,(0,q.jsx)(t,{className:`h-4 w-4`,"aria-hidden":!0})]}),(0,q.jsx)(`p`,{className:`mt-3 max-w-xs text-balance font-serif text-[13px] leading-relaxed text-text-muted`,children:`Open Feishu to confirm the new app there.`})]}):(0,q.jsxs)(`div`,{className:`flex flex-col items-center ${i} text-center`,children:[(0,q.jsx)(`span`,{className:`rounded-md border border-border-soft bg-white p-3`,children:(0,q.jsx)(Mc.QRCode,{value:n,size:144,bgColor:`#ffffff`,fgColor:`#1c1a17`,level:`M`})}),(0,q.jsx)(`p`,{className:`mt-3 max-w-[18rem] text-balance font-serif text-[13px] leading-relaxed text-text-muted`,children:`Scan with Feishu, then confirm the new app there.`}),(0,q.jsxs)(`a`,{className:`mt-3 inline-flex items-center gap-1.5 font-sans text-[12px] text-text-muted underline decoration-text-muted/40 underline-offset-2 transition-colors hover:text-text hover:decoration-text/40`,href:n,rel:`noreferrer`,target:`_blank`,children:[`Or open the Feishu tab in your browser`,(0,q.jsx)(t,{className:`h-3 w-3`,"aria-hidden":!0})]})]})}function Rc({appId:e,appSecret:t,description:n,disabled:r,onAppId:i,onAppSecret:a,onSubmit:o,saving:s}){return(0,q.jsxs)(`div`,{className:`space-y-3 rounded-sm border border-border-soft bg-surface px-4 py-3`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`font-serif text-[14px] font-semibold text-text`,children:`Connect an existing Feishu app`}),(0,q.jsx)(`p`,{className:`mt-1 font-serif text-[12px] leading-snug text-text-muted`,children:n})]}),(0,q.jsx)(zc,{label:`App ID`,placeholder:`cli_...`,value:e,onChange:i}),(0,q.jsx)(zc,{label:`App Secret`,placeholder:`App secret`,secret:!0,value:t,onChange:a}),(0,q.jsx)(`p`,{className:`font-sans text-[12px] leading-snug text-text-muted`,children:`Find these on your app's Credentials & Basic Info page in the Feishu Open Platform Developer Console.`}),(0,q.jsx)(g,{className:`w-full`,onClick:o,disabled:r,children:s?(0,q.jsx)(Fc,{}):`Connect Feishu app`})]})}function zc({label:e,onChange:t,optional:n=!1,placeholder:r,secret:i=!1,value:a}){return(0,q.jsxs)(`label`,{className:`block`,children:[(0,q.jsxs)(`span`,{className:`font-sans mb-1.5 block text-[12px] font-medium uppercase tracking-[0.08em] text-text-muted`,children:[e,n?(0,q.jsx)(`span`,{className:`normal-case tracking-normal text-text-subtle`,children:` · optional`}):null]}),(0,q.jsx)(`input`,{autoComplete:`off`,className:`w-full rounded-sm border border-border-soft bg-surface px-3 py-2 font-mono text-[12px] text-text placeholder:font-sans placeholder:text-text-subtle focus:border-accent focus:outline-none`,onChange:e=>t(e.target.value),placeholder:r,spellCheck:!1,type:i?`password`:`text`,value:a})]})}var Bc={"contact:user.basic_profile:readonly":`Get user's basic info`,"contact:user.id:readonly":`Obtain user ID via email or mobile number`,"contact:user.employee_id:readonly":`Obtain user ID`,"contact:user.email:readonly":`Obtain user's email information`,"contact:user.phone:readonly":`Obtain user's mobile number`,"im:message.group_msg":`Read all messages in associated group chat (sensitive scope)`,"im:message.group_at_msg.include_bot:readonly":`Receive other bots' and users' mentions`,"im:chat.members:write_only":`Add and remove group member`,"bitable:app":`View, comment, edit and manage Base`,"bitable:app:readonly":`View, comment, and export Base`,"board:whiteboard:node:create":`Create board node`,"board:whiteboard:node:delete":`Delete board node`,"board:whiteboard:node:read":`View board node`,"board:whiteboard:node:update":`Update board node`,"docs:doc":`View, comment, edit, and manage Docs`,"docs:doc:readonly":`View, comment, and export Docs`,"docs:document.comment:create":`Add and reply to comment in document`,"docs:document.comment:delete":`Delete comment in document`,"docs:document.comment:read":`Get comments in document`,"docs:document.comment:update":`Modify comment in document`,"docs:document.comment:write_only":`Reply, edit, delete comment in document`,"docs:document.content:read":`View document content`,"docs:document.media:download":`Download image and file in document`,"docs:document.media:upload":`Upload image and file to document`,"docs:document.subscription":`Subscribe to document and update subscription status`,"docs:document.subscription:read":`Get subscription status of document`,"docs:document:copy":`Duplicate document`,"docs:document:export":`Export document`,"docs:document:import":`View and create document import task`,"docs:event.document_deleted:read":`Receive document delete event`,"docs:event.document_edited:read":`Receive document edit event`,"docs:event.document_opened:read":`Receive document open event`,"docs:event:subscribe":`Subscribe to document-related events`,"docs:permission.member":`View, add, update, and delete document collaborators`,"docs:permission.member:apply":`Request docs permission`,"docs:permission.member:auth":`Verify user's access to document`,"docs:permission.member:create":`Add document collaborator`,"docs:permission.member:delete":`Remove document collaborator`,"docs:permission.member:readonly":`View document collaborators (legacy version)`,"docs:permission.member:retrieve":`Get document collaborators`,"docs:permission.member:transfer":`Transfer ownership of document`,"docs:permission.member:update":`Update collaborator permission of document`,"docs:permission.setting":`View and update document permission settings`,"docs:permission.setting:read":`Query permission settings of document`,"docs:permission.setting:readonly":`View document permission settings`,"docs:permission.setting:write_only":`Modify permission settings of document`,"docs:secure_label:readonly":`View document's security level label`,"docs:secure_label:write_only":`Modify document security level`,"docx:document":`Create and edit upgraded Docs`,"docx:document.block:convert":`Convert text to cloud document block`,"docx:document:create":`Create upgraded Docs`,"docx:document:readonly":`View upgraded Docs`,"docx:document:write_only":`Edit upgraded Docs`,"drive:drive":`View, comment, edit, and manage all files in My Space`,"drive:drive.metadata:readonly":`View the metadata of files in My Space`,"drive:drive.search:readonly":`Search files in My Space`,"drive:drive:readonly":`View, comment, and download all files in My Space`,"drive:drive:version":`View, create, and delete document versions`,"drive:drive:version:readonly":`View document versions`,"drive:export:readonly":`Export Docs documents`,"drive:file":`Upload and download files to My Space`,"drive:file.like:readonly":`View the likes information of document`,"drive:file.meta.sec_label.read_only":`View document security level label`,"drive:file:download":`Download file in My Space`,"drive:file:readonly":`View and download files in My Space`,"drive:file:upload":`Upload file`,"drive:file:view_record:readonly":`Get document's view history`,"drive:quota_detail:read_one":`Get personal storage quota information`,"sheets:spreadsheet":`View, comment, edit, and manage Sheets`,"sheets:spreadsheet.meta:read":`Query metadata of spreadsheet`,"sheets:spreadsheet.meta:write_only":`Modify metadata of spreadsheet`,"sheets:spreadsheet:create":`Create spreadsheet`,"sheets:spreadsheet:read":`View spreadsheet`,"sheets:spreadsheet:readonly":`View, comment, and export Sheets`,"sheets:spreadsheet:write_only":`Edit spreadsheet`,"slides:presentation:create":`Create slides`,"slides:presentation:read":`View slides`,"slides:presentation:update":`Edit slides`,"slides:presentation:write_only":`Create and edit slides`,"space:document.event:read":`Subscribe to file-related events under folder`,"space:document:delete":`Delete folder and document in My Space`,"space:document:move":`Move folder and document in My Space`,"space:document:retrieve":`Get document list in My Space folder`,"space:document:shortcut":`Create document shortcut`,"space:folder:create":`Create folder in My Space`,"wiki:member:create":`Add wiki space member`,"wiki:member:retrieve":`View wiki space member list`,"wiki:member:update":`Update wiki space member`,"wiki:node:copy":`Create wiki space node copy`,"wiki:node:create":`Create wiki space node`,"wiki:node:move":`Move wiki space node`,"wiki:node:read":`View wiki space node information`,"wiki:node:retrieve":`View wiki space node list`,"wiki:node:update":`Update wiki space node information`,"wiki:setting:read":`View wiki space settings`,"wiki:setting:write_only":`Update wiki space settings`,"wiki:space:read":`View wiki space information`,"wiki:space:retrieve":`View wiki space list`,"wiki:space:write_only":`Create and update wiki space`,"wiki:wiki":`View, edit, and manage Wiki`,"wiki:wiki:readonly":`View all Wiki`};function Vc(e,t){return Bc[e]??t}function Hc(e){return e?.recommended.scopes.length?e.recommended.scopes:L.map(e=>({capability:e.capability,description:e.description,granted:!1,label:e.label,scope:e.scope}))}function Uc({n:e,alert:t=!1}){return(0,q.jsx)(`span`,{className:`flex h-[20px] w-[20px] shrink-0 items-center justify-center rounded-full font-sans text-[11px] font-medium ${t?`bg-health-error-soft text-health-error ring-1 ring-health-error/40`:`bg-canvas text-text-subtle`}`,children:e})}function Wc({anyGranted:e}){return(0,q.jsxs)(`div`,{className:`flex items-start gap-2 rounded-md border border-health-error/30 bg-health-error-soft px-3 py-2`,children:[(0,q.jsx)(R,{className:`mt-0.5 h-4 w-4 shrink-0 text-health-error`,"aria-hidden":!0}),(0,q.jsx)(`div`,{className:`space-y-0.5`,children:e?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`font-serif text-[13px] font-semibold leading-snug text-text`,children:`Some permissions aren’t active yet`}),(0,q.jsx)(`p`,{className:`font-serif text-[12px] leading-snug text-text-muted`,children:`The ones still marked below need granting in Feishu. Add them in the console, publish a new app version, then recheck.`})]}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`p`,{className:`font-serif text-[13px] font-semibold leading-snug text-text`,children:`Not authorized yet.`}),(0,q.jsx)(`p`,{className:`font-serif text-[12px] leading-snug text-text-muted`,children:`Feishu hasn’t applied the new permissions. This usually means step 2 wasn’t published yet. Publish a new app version, then recheck. If you just published, give it a moment and recheck.`})]})})]})}function Gc({scopes:e,authUrl:n,authUrls:r,confirmedMissing:i,showPerms:a,onTogglePerms:o,onRecheck:c,isRechecking:l,statusLine:u,footer:d}){let f=a||i,p=r?.length?r:n?[{authUrl:n,label:`Recommended permissions`,scopes:[]}]:[];return(0,q.jsxs)(`div`,{className:`space-y-4 rounded-md border border-border-soft bg-surface px-4 py-4`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`div`,{className:`font-serif text-[15px] font-semibold leading-tight text-text`,children:`Authorize Feishu permissions`}),(0,q.jsx)(`p`,{className:`font-serif text-[13px] leading-relaxed text-text-muted`,children:`These let your Feishu bot recognize teammates by name, take part in group chats with people and other bots, look people up by email or phone, and work with Feishu Drive and cloud documents.`})]}),i&&(0,q.jsx)(Wc,{anyGranted:e.some(e=>e.granted)}),(0,q.jsxs)(`ol`,{className:`space-y-3.5`,children:[(0,q.jsxs)(`li`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(Uc,{n:1}),(0,q.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,q.jsx)(`span`,{className:`font-serif text-[13px] leading-snug text-text`,children:`Add the permissions`}),p.length>0&&(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`p`,{className:`font-serif text-[12px] leading-snug text-text-subtle`,children:`Open the groups you need in Feishu.`}),(0,q.jsx)(`div`,{className:`grid gap-1.5 sm:grid-cols-2`,children:p.map(e=>(0,q.jsxs)(g,{size:`sm`,variant:`outline`,className:`w-full justify-between`,render:(0,q.jsx)(`a`,{href:e.authUrl,rel:`noreferrer`,target:`_blank`}),children:[(0,q.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,q.jsx)(t,{className:`h-3.5 w-3.5`,"aria-hidden":!0})]},`${e.label}:${e.authUrl}`))})]}),(0,q.jsxs)(`div`,{className:`pt-0.5`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:o,"aria-expanded":f,className:`inline-flex items-center gap-1 font-sans text-[12px] text-text-muted transition-colors hover:text-text`,children:[`Permissions`,(0,q.jsx)(G,{className:`h-3.5 w-3.5 transition-transform ${f?`rotate-180`:``}`,"aria-hidden":!0})]}),f&&(0,q.jsx)(`ul`,{className:`mt-2 max-h-72 space-y-1 overflow-y-auto pr-1`,children:e.map(e=>(0,q.jsxs)(`li`,{className:`flex items-start gap-2 font-serif text-[12px] leading-snug text-text-muted`,children:[i?e.granted?(0,q.jsx)(j,{className:`mt-[1px] h-3.5 w-3.5 shrink-0 text-health-ok`,strokeWidth:2.75,"aria-hidden":!0}):(0,q.jsx)(s,{className:`mt-[1px] h-3.5 w-3.5 shrink-0 text-health-error`,strokeWidth:2.75,"aria-hidden":!0}):(0,q.jsx)(`span`,{className:`mt-[7px] h-1 w-1 shrink-0 rounded-full bg-text-subtle/50`,"aria-hidden":!0}),(0,q.jsx)(`span`,{children:Vc(e.scope,e.label)})]},e.scope))})]})]})]}),(0,q.jsxs)(`li`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(Uc,{n:2,alert:i}),(0,q.jsxs)(`div`,{className:`flex-1`,children:[(0,q.jsx)(`span`,{className:`font-serif text-[13px] leading-snug text-text`,children:`Publish a new app version`}),(0,q.jsx)(`p`,{className:`font-serif text-[12px] leading-snug text-text-subtle`,children:`Feishu applies the new permissions only after you publish a version by hand.`})]})]}),(0,q.jsxs)(`li`,{className:`flex items-start gap-3`,children:[(0,q.jsx)(Uc,{n:3}),(0,q.jsxs)(`div`,{className:`flex-1 space-y-2`,children:[(0,q.jsx)(`span`,{className:`font-serif text-[13px] leading-snug text-text`,children:`Verify access`}),(0,q.jsx)(`div`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:c,disabled:l,className:`inline-flex min-h-[44px] items-center justify-center gap-1 rounded-sm md:min-h-8 font-sans text-[12px] text-text-muted underline decoration-text-subtle/40 underline-offset-2 transition-colors hover:text-text hover:decoration-text/40 disabled:cursor-not-allowed disabled:opacity-50`,children:[l?(0,q.jsx)(E,{className:`h-3 w-3 animate-spin`}):(0,q.jsx)(de,{className:`h-3 w-3`,"aria-hidden":!0}),`Recheck access`]})})]})]})]}),u,d]})}function Kc(){return(0,q.jsx)(`p`,{className:`font-sans text-[13px] leading-relaxed text-text-muted`,children:`The owner is the person this agent answers to. The agent introduces itself to them and checks in. It's how it knows who it's working for.`})}function qc({agentId:e,onConfirm:t,onSkip:n,submitLabel:r=`Assign owner →`,skipLabel:i=`Skip for now →`,autoFocus:a=!0,showRationale:o=!1}){let s=(0,K.useId)(),c=`${s}-listbox`,l=e=>`${s}-option-${e}`,[d,p]=(0,K.useState)([]),[m,h]=(0,K.useState)(!0),[_,v]=(0,K.useState)(),[y,b]=(0,K.useState)(``),[x,S]=(0,K.useState)(!1),[C,T]=(0,K.useState)(-1),[E,D]=(0,K.useState)(``),[O,k]=(0,K.useState)(!0),[A,M]=(0,K.useState)(``),[N,P]=(0,K.useState)(!1),[F,I]=(0,K.useState)(),L=(0,K.useRef)(null),R=(0,K.useRef)(null),ee=(0,K.useRef)(null);(0,K.useEffect)(()=>{let t=!1;return w(e).then(e=>{t||(p(e),h(!1))}).catch(e=>{t||(v(e instanceof Error?e.message:`Could not load Slack members`),h(!1))}),()=>{t=!0}},[e]),(0,K.useEffect)(()=>{function e(e){L.current&&!L.current.contains(e.target)&&S(!1)}return document.addEventListener(`mousedown`,e),()=>document.removeEventListener(`mousedown`,e)},[]),(0,K.useEffect)(()=>{a&&!m&&setTimeout(()=>R.current?.focus(),50)},[a,m]);let z=d.find(e=>e.slackUserId===E),B=y.trim()?d.filter(e=>{let t=y.trim().toLowerCase();return e.displayName.toLowerCase().includes(t)||e.handle&&e.handle.toLowerCase().includes(t)}):d,V=x&&C>=0&&B[C]?l(B[C].slackUserId):void 0;(0,K.useEffect)(()=>{!x||C<0||document.getElementById(l(B[C]?.slackUserId??``))?.scrollIntoView({block:`nearest`})},[C,x]);function H(e){let t=e.target.value;b(t),S(!0),T(0),E&&t!==(z?.displayName??``)&&(D(``),I(void 0))}function U(){S(!0),E&&b(``)}function W(){z&&!x&&b(z.displayName)}function te(e){D(e.slackUserId),b(e.displayName),S(!1),T(-1),I(void 0)}function ne(e){if(!x){e.key===`ArrowDown`&&(S(!0),T(0),e.preventDefault());return}if(e.key===`Escape`)S(!1),T(-1),z&&b(z.displayName),e.preventDefault();else if(e.key===`ArrowDown`)T(e=>Math.min(e+1,B.length-1)),e.preventDefault();else if(e.key===`ArrowUp`)T(e=>Math.max(e-1,0)),e.preventDefault();else if(e.key===`Home`)T(0),e.preventDefault();else if(e.key===`End`)T(Math.max(B.length-1,0)),e.preventDefault();else if(e.key===`Enter`){e.preventDefault();let t=C>=0?B[C]:B[0];t&&te(t)}}async function G(){if(!(!E||N)){P(!0),I(void 0);try{await u(e,{slackUserId:E,introduce:O,...O&&A.trim()?{openerNote:A.trim()}:{}}),f(),t()}catch(e){I(e instanceof Error?e.message:`Could not assign owner`)}finally{P(!1)}}}return m?(0,q.jsxs)(`div`,{className:`space-y-3`,children:[o&&(0,q.jsx)(Kc,{}),(0,q.jsx)(`div`,{className:`font-sans text-[12px] text-text-muted`,children:`Loading Slack members…`})]}):_?(0,q.jsxs)(`div`,{className:`space-y-2`,children:[o&&(0,q.jsx)(Kc,{}),(0,q.jsx)(`div`,{className:`font-sans text-[12px] text-health-error`,children:_}),(0,q.jsx)(g,{variant:`ghost`,size:`sm`,onClick:()=>{h(!0),v(void 0),w(e).then(e=>{p(e),h(!1)}).catch(e=>{v(e instanceof Error?e.message:`Could not load Slack members`),h(!1)})},children:`Retry`})]}):(0,q.jsxs)(`div`,{className:`space-y-3`,children:[o&&(0,q.jsx)(Kc,{}),(0,q.jsxs)(`div`,{ref:L,className:`relative`,children:[(0,q.jsx)(`input`,{ref:R,role:`combobox`,"aria-expanded":x,"aria-controls":x?c:void 0,"aria-activedescendant":V,"aria-autocomplete":`list`,"aria-haspopup":`listbox`,type:`text`,value:y,onChange:H,onFocus:U,onBlur:W,onKeyDown:ne,placeholder:z?z.displayName:`Search by name or handle…`,disabled:N,className:`w-full rounded-sm border border-border-soft bg-surface px-3 py-2 font-sans text-[13px] text-text placeholder:text-text-subtle focus:border-accent focus:outline-none disabled:opacity-50`}),z&&!x&&(0,q.jsx)(`div`,{className:`pointer-events-none absolute inset-y-0 right-2 flex items-center`,children:(0,q.jsx)(j,{className:`h-3.5 w-3.5 text-accent`})}),x&&(0,q.jsx)(`div`,{ref:ee,id:c,role:`listbox`,"aria-label":`Slack members`,className:`absolute left-0 right-0 top-full z-50 mt-1 max-h-52 overflow-y-auto rounded-sm border border-border-soft bg-surface shadow-deep`,children:B.length===0?(0,q.jsx)(`div`,{role:`status`,className:`px-3 py-2 font-sans text-[12px] text-text-muted`,children:d.length===0?`No workspace members found.`:`No members match.`}):B.map((e,t)=>{let n=e.slackUserId===E,r=t===C;return(0,q.jsxs)(`div`,{id:l(e.slackUserId),role:`option`,"aria-selected":n,onMouseDown:t=>{t.preventDefault(),te(e)},onClick:()=>te(e),className:[`flex w-full cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors`,r?`bg-accent/10`:n?`bg-accent/5`:`hover:bg-surface-elevated`].join(` `),children:[e.avatarUrl?(0,q.jsx)(`img`,{src:e.avatarUrl,alt:``,className:`h-6 w-6 shrink-0 rounded-sm object-cover`}):(0,q.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-sm bg-muted font-sans text-[10px] font-bold text-text-muted`,children:e.displayName.charAt(0).toUpperCase()}),(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block truncate font-serif text-[14px] text-text`,children:e.displayName}),e.handle&&(0,q.jsxs)(`span`,{className:`font-sans text-[11px] text-text-muted`,children:[`@`,e.handle]})]}),n&&(0,q.jsx)(j,{className:`h-3.5 w-3.5 shrink-0 text-accent`})]},e.slackUserId)})})]}),(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,q.jsx)(`input`,{type:`checkbox`,checked:O,onChange:e=>k(e.target.checked),disabled:N,className:`h-4 w-4 accent-accent`}),(0,q.jsx)(`span`,{className:`font-sans text-[13px] text-text`,children:z?(0,q.jsxs)(q.Fragment,{children:[`Notify `,(0,q.jsx)(`span`,{className:`font-medium`,children:z.displayName}),` now`]}):`Notify the new owner now`})]}),(0,q.jsx)(`p`,{className:`font-sans pl-[26px] text-[11px] text-text-subtle`,children:`The agent will DM them to introduce itself.`})]}),O&&(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`label`,{className:`font-sans mb-1.5 block text-[12px] font-medium text-text-muted`,children:[`What should the agent know before it reaches out to`,` `,z?z.displayName:`its owner`,`?`,` `,(0,q.jsx)(`span`,{className:`font-normal`,children:`(optional)`})]}),(0,q.jsx)(`textarea`,{value:A,onChange:e=>M(e.target.value),placeholder:z?`e.g. I set this agent up to help ${z.displayName} with code review and deploys.`:`e.g. I set this agent up to help them with code review and deploys.`,rows:3,className:`w-full resize-none rounded-sm border border-border-soft bg-surface px-3 py-2 font-sans text-[13px] text-text placeholder:text-text-subtle focus:border-accent focus:outline-none`}),(0,q.jsxs)(`p`,{className:`font-sans mt-1 text-[11px] text-text-subtle`,children:[`Used as context for the agent's first message:`,` `,z?`so ${z.displayName} knows who set it up and why.`:`so the owner knows who set it up and why.`]})]}),F&&(0,q.jsx)(`div`,{className:`font-sans text-[12px] text-health-error`,children:F}),(0,q.jsxs)(`div`,{className:`space-y-2`,children:[(0,q.jsx)(g,{className:`w-full`,onClick:()=>void G(),disabled:N||!E,children:N?`Assigning…`:r}),n&&(0,q.jsx)(`div`,{className:`text-center`,children:(0,q.jsx)(`button`,{type:`button`,onClick:n,disabled:N,className:`font-sans text-[12px] text-text-muted underline decoration-text-muted/40 underline-offset-2 hover:text-text hover:decoration-text/40 transition-colors`,children:i})})]})]})}export{_e as A,nt as C,Oe as D,Le as E,ve as F,be as I,ue as L,he as M,ge as N,Te as O,ye as P,Un as S,Re as T,$s as _,Lc as a,Gn as b,Ic as c,pc as d,ic as f,tc as g,ec as h,Nc as i,fe as j,pe as k,gc as l,Zs as m,Gc as n,Pc as o,ac as p,Hc as r,Rc as s,qc as t,_c as u,Qs as v,Y as w,Wn as x,er as y};
|