@hydralms/components 0.1.0 → 0.1.2
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/components.css +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +442 -110
- package/dist/modules/CoursePlayer/CoursePlayer.d.ts +2 -0
- package/dist/modules/CoursePlayer/types.d.ts +59 -0
- package/dist/modules/FlashcardLab/FlashcardLab.d.ts +2 -0
- package/dist/modules/FlashcardLab/types.d.ts +55 -0
- package/dist/modules/QuizModule/QuizModule.d.ts +2 -0
- package/dist/modules/QuizModule/types.d.ts +54 -0
- package/dist/modules/index.d.ts +6 -0
- package/dist/provider/HydraProvider.d.ts +1 -1
- package/dist/sections.cjs +1 -1
- package/dist/sections.js +261 -291
- package/dist/table-BrS5cDQu.js +2510 -0
- package/dist/table-D6AkBBEo.cjs +1 -0
- package/dist/ui/alert-dialog.d.ts +14 -8
- package/dist/ui/button.d.ts +1 -1
- package/dist/ui/tabs.d.ts +15 -5
- package/dist/ui/tooltip.d.ts +12 -5
- package/dist/video/index.d.ts +6 -1
- package/dist/video/types.d.ts +167 -0
- package/dist/video/video-bookmark.d.ts +2 -0
- package/dist/video/video-chapter-list.d.ts +2 -0
- package/dist/video/video-playlist-item.d.ts +2 -0
- package/dist/video/video-thumbnail-card.d.ts +2 -0
- package/dist/video/video-transcript.d.ts +2 -0
- package/package.json +135 -24
- package/src/__tests__/setup.ts +1 -0
- package/src/assessment-toolbar/assessment-toolbar.tsx +96 -0
- package/src/assessment-toolbar/index.ts +10 -0
- package/src/assessment-toolbar/question-navigator.tsx +86 -0
- package/src/assessment-toolbar/timer-display.tsx +73 -0
- package/src/assessment-toolbar/types.ts +92 -0
- package/src/assets/hydra-icon.png +0 -0
- package/src/assets/hydra-icon.svg +18 -0
- package/src/assets/hydra-lms-icon.png +0 -0
- package/src/assets/hydra-lms-icon.svg +9 -0
- package/src/common/confirm-dialog.tsx +60 -0
- package/src/common/due-date-display.tsx +64 -0
- package/src/common/empty-state.tsx +24 -0
- package/src/common/index.ts +12 -0
- package/src/common/search-input.tsx +68 -0
- package/src/common/status-badge.test.tsx +43 -0
- package/src/common/status-badge.tsx +81 -0
- package/src/common/types.ts +129 -0
- package/src/content/content-block.tsx +116 -0
- package/src/content/file-upload-zone.tsx +109 -0
- package/src/content/index.ts +7 -0
- package/src/content/types.ts +76 -0
- package/src/curriculum/curriculum-item.tsx +81 -0
- package/src/curriculum/curriculum-tree.tsx +69 -0
- package/src/curriculum/index.ts +11 -0
- package/src/curriculum/learning-object-icon.tsx +44 -0
- package/src/curriculum/types.ts +83 -0
- package/src/feedback/feedback-banner.tsx +46 -0
- package/src/feedback/index.ts +8 -0
- package/src/feedback/likert-scale.tsx +58 -0
- package/src/feedback/star-rating.tsx +65 -0
- package/src/feedback/types.ts +86 -0
- package/src/flashcards/flashcard-deck.tsx +130 -0
- package/src/flashcards/flashcard.tsx +108 -0
- package/src/flashcards/index.ts +3 -0
- package/src/flashcards/types.ts +60 -0
- package/src/index.ts +38 -0
- package/src/lib/utils.ts +6 -0
- package/src/modules/CoursePlayer/CoursePlayer.tsx +281 -0
- package/src/modules/CoursePlayer/types.ts +48 -0
- package/src/modules/FlashcardLab/FlashcardLab.tsx +275 -0
- package/src/modules/FlashcardLab/types.ts +58 -0
- package/src/modules/QuizModule/QuizModule.tsx +241 -0
- package/src/modules/QuizModule/types.ts +56 -0
- package/src/modules/index.ts +12 -0
- package/src/progress/grade-indicator.tsx +65 -0
- package/src/progress/index.ts +8 -0
- package/src/progress/progress-ring.tsx +56 -0
- package/src/progress/stat-card.tsx +42 -0
- package/src/progress/types.ts +73 -0
- package/src/provider/HydraProvider.tsx +26 -0
- package/src/provider/index.ts +2 -0
- package/src/questions/choice.tsx +90 -0
- package/src/questions/essay.tsx +59 -0
- package/src/questions/fill-in-the-blank.tsx +69 -0
- package/src/questions/index.ts +14 -0
- package/src/questions/multiple-choice.test.tsx +104 -0
- package/src/questions/multiple-choice.tsx +97 -0
- package/src/questions/question-renderer.tsx +37 -0
- package/src/questions/true-false.test.tsx +89 -0
- package/src/questions/true-false.tsx +90 -0
- package/src/questions/types.ts +53 -0
- package/src/sections/AnnouncementFeed/AnnouncementFeed.tsx +141 -0
- package/src/sections/AnnouncementFeed/types.ts +50 -0
- package/src/sections/AssessmentReview/AssessmentReview.tsx +148 -0
- package/src/sections/AssessmentReview/types.ts +61 -0
- package/src/sections/AssignmentSubmission/AssignmentSubmission.tsx +190 -0
- package/src/sections/AssignmentSubmission/types.ts +60 -0
- package/src/sections/CertificateViewer/CertificateViewer.tsx +117 -0
- package/src/sections/CertificateViewer/types.ts +45 -0
- package/src/sections/CourseOutline/CourseOutline.tsx +79 -0
- package/src/sections/CourseOutline/types.ts +53 -0
- package/src/sections/DiscussionThread/DiscussionThread.tsx +186 -0
- package/src/sections/DiscussionThread/types.ts +77 -0
- package/src/sections/ExamSession/ExamSession.tsx +182 -0
- package/src/sections/ExamSession/types.ts +64 -0
- package/src/sections/FlashcardStudySession/FlashcardStudySession.tsx +76 -0
- package/src/sections/FlashcardStudySession/types.ts +42 -0
- package/src/sections/GradebookTable/GradebookTable.tsx +229 -0
- package/src/sections/GradebookTable/types.ts +75 -0
- package/src/sections/LecturePlayer/LecturePlayer.tsx +60 -0
- package/src/sections/LecturePlayer/types.ts +48 -0
- package/src/sections/LessonPage/LessonPage.tsx +91 -0
- package/src/sections/LessonPage/types.ts +41 -0
- package/src/sections/PracticeQuiz/PracticeQuiz.tsx +199 -0
- package/src/sections/PracticeQuiz/types.ts +44 -0
- package/src/sections/ProgressDashboard/ProgressDashboard.tsx +140 -0
- package/src/sections/ProgressDashboard/types.ts +74 -0
- package/src/sections/QuizSession/QuizSession.tsx +113 -0
- package/src/sections/QuizSession/types.ts +47 -0
- package/src/sections/ResourceLibrary/ResourceLibrary.tsx +218 -0
- package/src/sections/ResourceLibrary/types.ts +57 -0
- package/src/sections/ScrollableQuiz/ScrollableQuiz.tsx +170 -0
- package/src/sections/ScrollableQuiz/types.ts +40 -0
- package/src/sections/SurveyForm/SurveyForm.tsx +180 -0
- package/src/sections/SurveyForm/types.ts +69 -0
- package/src/sections/index.ts +90 -0
- package/src/social/index.ts +3 -0
- package/src/social/post-card.tsx +91 -0
- package/src/social/types.ts +57 -0
- package/src/social/user-avatar.tsx +76 -0
- package/src/styles/globals.css +125 -0
- package/src/ui/alert-dialog.tsx +343 -0
- package/src/ui/alert.tsx +65 -0
- package/src/ui/avatar.tsx +52 -0
- package/src/ui/badge.tsx +53 -0
- package/src/ui/button.tsx +62 -0
- package/src/ui/card.tsx +92 -0
- package/src/ui/index.ts +44 -0
- package/src/ui/input.tsx +21 -0
- package/src/ui/progress.tsx +73 -0
- package/src/ui/separator.tsx +29 -0
- package/src/ui/skeleton.tsx +15 -0
- package/src/ui/slot.tsx +48 -0
- package/src/ui/table.tsx +108 -0
- package/src/ui/tabs.tsx +147 -0
- package/src/ui/textarea.tsx +20 -0
- package/src/ui/tooltip.tsx +177 -0
- package/src/utils/debounce.test.ts +59 -0
- package/src/utils/debounce.ts +10 -0
- package/src/utils/format-duration.test.ts +55 -0
- package/src/utils/format-duration.ts +30 -0
- package/src/video/index.ts +17 -0
- package/src/video/types.ts +216 -0
- package/src/video/video-bookmark.tsx +76 -0
- package/src/video/video-chapter-list.tsx +93 -0
- package/src/video/video-player.tsx +103 -0
- package/src/video/video-playlist-item.tsx +90 -0
- package/src/video/video-thumbnail-card.tsx +74 -0
- package/src/video/video-transcript.tsx +102 -0
- package/dist/table-CW4_BYny.js +0 -9869
- package/dist/table-DSBBqb9X.cjs +0 -56
package/dist/table-DSBBqb9X.cjs
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
"use strict";var Bc=Object.defineProperty;var $c=(e,t,n)=>t in e?Bc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var de=(e,t,n)=>$c(e,typeof t!="symbol"?t+"":t,n);const m=require("react/jsx-runtime"),U=require("lucide-react"),re=require("react"),Hc=require("react-dom"),zt=require("class-variance-authority"),zc=require("clsx"),Wc=require("tailwind-merge");function ss(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const b=ss(re),gt=ss(Hc);function V(...e){return Wc.twMerge(zc.clsx(e))}const is=zt.cva("relative flex w-full items-start gap-3 rounded-lg border p-4 text-sm [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:translate-y-0.5",{variants:{variant:{default:"bg-card text-foreground",destructive:"border-destructive/50 bg-destructive/5 text-destructive [&>svg]:text-destructive",success:"border-success/50 bg-success/5 text-success [&>svg]:text-success",warning:"border-warning/50 bg-warning/5 text-warning [&>svg]:text-warning",info:"border-info/50 bg-info/5 text-info [&>svg]:text-info"}},defaultVariants:{variant:"default"}});function It({className:e,variant:t,...n}){return m.jsx("div",{"data-slot":"alert",role:"alert",className:V(is({variant:t}),e),...n})}function Uc({className:e,...t}){return m.jsx("div",{"data-slot":"alert-title",className:V("font-medium leading-normal tracking-tight",e),...t})}function Pt({className:e,...t}){return m.jsx("div",{"data-slot":"alert-description",className:V("text-foreground text-sm [&_p]:leading-relaxed",e),...t})}const cs=({question:e,sessionAnswers:t,onAnswer:n,readOnly:r=!1,showCorrectAnswers:o=!1,disabled:s=!1})=>{const[i,c]=re.useState([]),u=[...e.answers||[]].sort((l,g)=>l.sequence-g.sequence),a=l=>{r||s||c(g=>{const p=g.includes(l)?g.filter(f=>f!==l):[...g,l];return n==null||n(p.map(f=>({uid:f}))),p})};re.useEffect(()=>{const l=(t==null?void 0:t.map(g=>g.answerUid))||[];c(l)},[t]);const d=l=>{var p;if(!o)return"";const g=(p=e.answers)==null?void 0:p.find(f=>f.uid===l);return g!=null&&g.isCorrect?"bg-success/10 border border-success/30 px-2":i.includes(l)&&!(g!=null&&g.isCorrect)?"bg-destructive/10 border border-destructive/30 px-2":""};return m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx("div",{dangerouslySetInnerHTML:{__html:e.content}}),m.jsx("div",{className:"flex flex-col gap-2",children:u.map(l=>m.jsx("div",{className:V("rounded-md transition-colors",d(l.uid)),children:m.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 has-[input:disabled]:cursor-default has-[input:disabled]:opacity-60",children:[m.jsx("input",{type:"checkbox",checked:i.includes(l.uid),onChange:()=>a(l.uid),disabled:r||s,className:"accent-primary m-0 shrink-0"}),m.jsx("span",{className:"text-sm",dangerouslySetInnerHTML:{__html:l.content}})]})},l.uid))}),o&&e.explanation&&m.jsx(It,{className:"mt-2",children:m.jsxs(Pt,{children:[m.jsx("strong",{children:"Explanation:"})," ",m.jsx("span",{dangerouslySetInnerHTML:{__html:e.explanation}})]})})]})},as=({question:e,sessionAnswers:t,onAnswer:n,readOnly:r=!1,showCorrectAnswers:o=!1,disabled:s=!1})=>{const[i,c]=re.useState(""),u=[...e.answers||[]].sort((l,g)=>l.sequence-g.sequence),a=l=>{r||s||(c(l),n==null||n([{uid:l}]))};re.useEffect(()=>{var g;const l=((g=t==null?void 0:t[0])==null?void 0:g.answerUid)||"";c(l)},[t]);const d=l=>{var p;if(!o)return"px-2";const g=(p=e.answers)==null?void 0:p.find(f=>f.uid===l);return g!=null&&g.isCorrect?"bg-success/10 border border-success/30 px-2":i===l&&!(g!=null&&g.isCorrect)?"bg-destructive/10 border border-destructive/30 px-2":"px-2"};return m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx("div",{dangerouslySetInnerHTML:{__html:e.content}}),m.jsx("div",{className:"flex flex-col gap-2",children:u.map(l=>m.jsx("div",{className:V("rounded-md transition-colors",d(l.uid)),children:m.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 has-[input:disabled]:cursor-default has-[input:disabled]:opacity-60",children:[m.jsx("input",{type:"radio",name:e.uid,value:l.uid,checked:i===l.uid,onChange:()=>a(l.uid),disabled:r||s,className:"accent-primary m-0 shrink-0"}),m.jsx("span",{dangerouslySetInnerHTML:{__html:l.content}})]})},l.uid))}),o&&e.explanation&&m.jsx(It,{className:"mt-2",children:m.jsxs(Pt,{children:[m.jsx("strong",{children:"Explanation:"})," ",m.jsx("span",{dangerouslySetInnerHTML:{__html:e.explanation}})]})})]})},ls=({question:e,sessionAnswers:t,onAnswer:n,readOnly:r=!1,showCorrectAnswers:o=!1,disabled:s=!1})=>{const[i,c]=re.useState(""),u=[...e.answers||[]].sort((l,g)=>l.sequence-g.sequence),a=l=>{r||s||(c(l),n==null||n([{uid:l}]))};re.useEffect(()=>{var g;const l=((g=t==null?void 0:t[0])==null?void 0:g.answerUid)||"";c(l)},[t]);const d=l=>{var p;if(!o)return"px-2";const g=(p=e.answers)==null?void 0:p.find(f=>f.uid===l);return g!=null&&g.isCorrect?"bg-success/10 border border-success/30 px-2":i===l&&!(g!=null&&g.isCorrect)?"bg-destructive/10 border border-destructive/30 px-2":"px-2"};return m.jsxs("div",{className:"flex flex-col gap-4",children:[m.jsx("div",{dangerouslySetInnerHTML:{__html:e.content}}),m.jsx("div",{className:"flex flex-col gap-2",children:u.map(l=>m.jsx("div",{className:V("rounded-md transition-colors",d(l.uid)),children:m.jsxs("label",{className:"flex items-center gap-2 cursor-pointer py-1 has-[input:disabled]:cursor-default has-[input:disabled]:opacity-60",children:[m.jsx("input",{type:"radio",name:e.uid,value:l.uid,checked:i===l.uid,onChange:()=>a(l.uid),disabled:r||s,className:"accent-primary m-0 shrink-0"}),m.jsx("span",{dangerouslySetInnerHTML:{__html:l.content}})]})},l.uid))}),o&&e.explanation&&m.jsx(It,{className:"mt-2",children:m.jsxs(Pt,{children:[m.jsx("strong",{children:"Explanation:"})," ",m.jsx("span",{dangerouslySetInnerHTML:{__html:e.explanation}})]})})]})};function Er(e,t){let n;return(...r)=>{clearTimeout(n),n=setTimeout(()=>e(...r),t)}}function us({className:e,type:t,...n}){return m.jsx("input",{type:t,"data-slot":"input",className:V("file:text-foreground placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground border-input flex h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-sm shadow-xs outline-none transition-[color,box-shadow] file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:opacity-50","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 aria-invalid:border-destructive",e),...n})}const ds=({question:e,sessionAnswers:t,onAnswer:n,readOnly:r=!1,showCorrectAnswers:o=!1,disabled:s=!1})=>{const[i,c]=re.useState(""),u=re.useCallback(Er(d=>{var l,g;n==null||n([{uid:((g=(l=e.answers)==null?void 0:l[0])==null?void 0:g.uid)||"",content:d}])},300),[n,e.answers]),a=d=>{const l=d.target.value;c(l),u(l)};return re.useEffect(()=>{var d;c(((d=t==null?void 0:t[0])==null?void 0:d.content)||"")},[t]),m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx("div",{dangerouslySetInnerHTML:{__html:e.content}}),m.jsx(us,{value:i,onChange:a,placeholder:"Type your answer here...",disabled:r||s}),o&&e.explanation&&m.jsx(It,{className:"mt-1",children:m.jsxs(Pt,{children:[m.jsx("strong",{children:"Explanation:"})," ",m.jsx("span",{dangerouslySetInnerHTML:{__html:e.explanation}})]})})]})};function fs({className:e,...t}){return m.jsx("textarea",{"data-slot":"textarea",className:V("placeholder:text-muted-foreground border-input flex min-h-16 w-full rounded-md border bg-transparent px-3 py-2 text-sm shadow-xs outline-none transition-[color,box-shadow] disabled:pointer-events-none disabled:opacity-50","focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]","aria-invalid:ring-destructive/20 aria-invalid:border-destructive",e),...t})}const ps=({question:e,sessionAnswers:t,onAnswer:n,readOnly:r=!1,disabled:o=!1})=>{const[s,i]=re.useState(""),c=re.useCallback(Er(a=>{var d,l;n==null||n([{uid:((l=(d=e.answers)==null?void 0:d[0])==null?void 0:l.uid)||e.uid,content:a}])},500),[n,e.answers,e.uid]),u=a=>{const d=a.target.value;i(d),c(d)};return re.useEffect(()=>{var a;i(((a=t==null?void 0:t[0])==null?void 0:a.content)||"")},[t]),m.jsxs("div",{className:"flex flex-col gap-2",children:[m.jsx("div",{dangerouslySetInnerHTML:{__html:e.content}}),m.jsx(fs,{className:"min-h-30 resize-y",value:s,onChange:u,placeholder:"Write your response here...",disabled:r||o})]})},gs=e=>{switch(e.question.type){case"multiple_choice":return m.jsx(cs,{...e});case"choice":return m.jsx(as,{...e});case"true_false":return m.jsx(ls,{...e});case"fill_in_the_blank":return m.jsx(ds,{...e});case"essay":return m.jsx(ps,{...e});default:return m.jsxs("p",{className:"text-muted-foreground",children:["Question type “",e.question.type,"” is not supported yet."]})}},ms=e=>{if(e<1)return"-";const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60,o=[];return t>0&&o.push(`${t}h`),n>0&&o.push(`${n}m`),r>0&&o.push(`${r}s`),o.join(" ")},lo=e=>{const t=Math.floor(e/3600),n=Math.floor(e%3600/60),r=e%60,o=s=>s.toString().padStart(2,"0");return t>0?`${o(t)}:${o(n)}:${o(r)}`:`${o(n)}:${o(r)}`};function Yc(e,t){return e?{wrapper:"border-destructive/30 bg-destructive/10 text-destructive",bold:!0}:t?{wrapper:"border-warning/30 bg-warning/10 text-warning",bold:!0}:{wrapper:"border-border bg-muted text-muted-foreground",bold:!1}}const hs=({timeElapsedSeconds:e,timeLimitSeconds:t,variant:n="compact"})=>{const r=t!=null&&t>0,o=r?Math.max(0,t-e):0,s=r&&o<t*.1,i=r&&o<=60,c=lo(r?o:e),u=Yc(i,s);return n==="compact"?m.jsxs("div",{className:V("flex items-center gap-1.5 px-2.5 py-1 rounded-full border",u.wrapper),children:[m.jsx("span",{className:"inline-flex leading-none",children:m.jsx(U.Clock,{size:13})}),m.jsx("span",{className:"text-xs font-semibold font-mono tracking-wide",children:c})]}):m.jsxs("div",{className:V("flex items-center gap-1.5",u.wrapper),children:[m.jsx("span",{className:"inline-flex leading-none",children:m.jsx(U.Clock,{size:16})}),m.jsxs("span",{className:V("text-sm",u.bold&&"font-semibold"),children:[r?"Time remaining: ":"Time elapsed: ",m.jsx("span",{className:"font-mono font-semibold",children:c})]})]})},uo={};function Ie(e,t){const n=b.useRef(uo);return n.current===uo&&(n.current=e(t)),n}const or=[];let sr;function Kc(){return sr}function Gc(e){or.push(e)}function bs(e){const t=(n,r)=>{const o=Ie(qc).current;let s;try{sr=o;for(const i of or)i.before(o);s=e(n,r);for(const i of or)i.after(o);o.didInitialize=!0}finally{sr=void 0}return s};return t.displayName=e.displayName||e.name,t}function Xc(e){return b.forwardRef(bs(e))}function qc(){return{didInitialize:!1}}function xs(e){const t=b.useRef(!0);t.current&&(t.current=!1,e())}const Zc=()=>{},G=typeof document<"u"?b.useLayoutEffect:Zc;function Le(e,...t){const n=new URL("https://base-ui.com/production-error");return n.searchParams.set("code",e.toString()),t.forEach(r=>n.searchParams.append("args[]",r)),`Base UI error #${e}; visit ${n} for the full message.`}const wr=b.createContext(void 0);process.env.NODE_ENV!=="production"&&(wr.displayName="TooltipRootContext");function Wt(e){const t=b.useContext(wr);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: TooltipRootContext is missing. Tooltip parts must be placed within <Tooltip.Root>.":Le(72));return t}const Jc=[];function Sr(e){b.useEffect(e,Jc)}const Dt=0;class Ke{constructor(){de(this,"currentId",Dt);de(this,"clear",()=>{this.currentId!==Dt&&(clearTimeout(this.currentId),this.currentId=Dt)});de(this,"disposeEffect",()=>this.clear)}static create(){return new Ke}start(t,n){this.clear(),this.currentId=setTimeout(()=>{this.currentId=Dt,n()},t)}isStarted(){return this.currentId!==Dt}}function Rt(){const e=Ie(Ke.create).current;return Sr(e.disposeEffect),e}function Nn(){return typeof window<"u"}function nt(e){return Rr(e)?(e.nodeName||"").toLowerCase():"#document"}function ve(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ge(e){var t;return(t=(Rr(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Rr(e){return Nn()?e instanceof Node||e instanceof ve(e).Node:!1}function oe(e){return Nn()?e instanceof Element||e instanceof ve(e).Element:!1}function be(e){return Nn()?e instanceof HTMLElement||e instanceof ve(e).HTMLElement:!1}function ir(e){return!Nn()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof ve(e).ShadowRoot}function rt(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Me(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&o!=="inline"&&o!=="contents"}function Qc(e){return/^(table|td|th)$/.test(nt(e))}function In(e){try{if(e.matches(":popover-open"))return!0}catch{}try{return e.matches(":modal")}catch{return!1}}const ea=/transform|translate|scale|rotate|perspective|filter/,ta=/paint|layout|strict|content/,st=e=>!!e&&e!=="none";let Hn;function Tr(e){const t=oe(e)?Me(e):e;return st(t.transform)||st(t.translate)||st(t.scale)||st(t.rotate)||st(t.perspective)||!Pn()&&(st(t.backdropFilter)||st(t.filter))||ea.test(t.willChange||"")||ta.test(t.contain||"")}function na(e){let t=Je(e);for(;be(t)&&!Ze(t);){if(Tr(t))return t;if(In(t))return null;t=Je(t)}return null}function Pn(){return Hn==null&&(Hn=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Hn}function Ze(e){return/^(html|body|#document)$/.test(nt(e))}function Me(e){return ve(e).getComputedStyle(e)}function jn(e){return oe(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Je(e){if(nt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||ir(e)&&e.host||Ge(e);return ir(t)?t.host:t}function vs(e){const t=Je(e);return Ze(t)?e.ownerDocument?e.ownerDocument.body:e.body:be(t)&&rt(t)?t:vs(t)}function tt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=vs(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=ve(o);if(s){const c=cr(i);return t.concat(i,i.visualViewport||[],rt(o)?o:[],c&&n?tt(c):[])}else return t.concat(o,tt(o,[],n))}function cr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function Ue(e){const t=Ie(ra,e).current;return t.next=e,G(t.effect),t}function ra(e){const t={current:e,next:e,effect:()=>{t.current=t.next}};return t}const zn=b[`useInsertionEffect${Math.random().toFixed(1)}`.slice(0,-3)],oa=zn&&zn!==b.useLayoutEffect?zn:e=>e();function W(e){const t=Ie(sa).current;return t.next=e,oa(t.effect),t.trampoline}function sa(){const e={next:void 0,callback:ia,trampoline:(...t)=>{var n;return(n=e.callback)==null?void 0:n.call(e,...t)},effect:()=>{e.callback=e.next}};return e}function ia(){if(process.env.NODE_ENV!=="production")throw new Error("Base UI: Cannot call an event handler while rendering.")}function ce(e){return(e==null?void 0:e.ownerDocument)||document}const jt=typeof navigator<"u",Wn=aa(),ys=ua(),Es=la(),ws=typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter:none"),Ss=Wn.platform==="MacIntel"&&Wn.maxTouchPoints>1?!0:/iP(hone|ad|od)|iOS/.test(Wn.platform),Rs=jt&&/apple/i.test(navigator.vendor),ar=jt&&/android/i.test(ys)||/android/i.test(Es),ca=jt&&ys.toLowerCase().startsWith("mac")&&!navigator.maxTouchPoints,Ts=Es.includes("jsdom/");function aa(){if(!jt)return{platform:"",maxTouchPoints:-1};const e=navigator.userAgentData;return e!=null&&e.platform?{platform:e.platform,maxTouchPoints:navigator.maxTouchPoints}:{platform:navigator.platform??"",maxTouchPoints:navigator.maxTouchPoints??-1}}function la(){if(!jt)return"";const e=navigator.userAgentData;return e&&Array.isArray(e.brands)?e.brands.map(({brand:t,version:n})=>`${t}/${n}`).join(" "):navigator.userAgent}function ua(){if(!jt)return"";const e=navigator.userAgentData;return e!=null&&e.platform?e.platform:navigator.platform??""}const lr="data-base-ui-focusable",Cs="active",Os="selected",Ns="input:not([type='hidden']):not([disabled]),[contenteditable]:not([contenteditable='false']),textarea:not([disabled])",Un="ArrowLeft",Yn="ArrowRight",da="ArrowUp",fa="ArrowDown";function ze(e){var n;let t=e.activeElement;for(;((n=t==null?void 0:t.shadowRoot)==null?void 0:n.activeElement)!=null;)t=t.shadowRoot.activeElement;return t}function ne(e,t){var r;if(!e||!t)return!1;const n=(r=t.getRootNode)==null?void 0:r.call(t);if(e.contains(t))return!0;if(n&&ir(n)){let o=t;for(;o;){if(e===o)return!0;o=o.parentNode||o.host}}return!1}function xn(e,t){if(!oe(e))return!1;const n=e;if(t.hasElement(n))return!n.hasAttribute("data-trigger-disabled");for(const[,r]of t.entries())if(ne(r,n))return!r.hasAttribute("data-trigger-disabled");return!1}function Oe(e){return"composedPath"in e?e.composedPath()[0]:e.target}function Ve(e,t){if(t==null)return!1;if("composedPath"in e)return e.composedPath().includes(t);const n=e;return n.target!=null&&t.contains(n.target)}function pa(e){return e.matches("html,body")}function kn(e){return be(e)&&e.matches(Ns)}function fo(e){return e?e.getAttribute("role")==="combobox"&&kn(e):!1}function ga(e){if(!e||Ts)return!0;try{return e.matches(":focus-visible")}catch{return!0}}function ur(e){return e?e.hasAttribute(lr)?e:e.querySelector(`[${lr}]`)||e:null}function ut(e,t,n=!0){return e.filter(o=>{var s;return o.parentId===t&&(!n||((s=o.context)==null?void 0:s.open))}).flatMap(o=>[o,...ut(e,o.id,n)])}function po(e,t){var o;let n=[],r=(o=e.find(s=>s.id===t))==null?void 0:o.parentId;for(;r;){const s=e.find(i=>i.id===r);r=s==null?void 0:s.parentId,s&&(n=n.concat(s))}return n}function it(e){e.preventDefault(),e.stopPropagation()}function ma(e){return"nativeEvent"in e}function ha(e){return e.pointerType===""&&e.isTrusted?!0:ar&&e.pointerType?e.type==="click"&&e.buttons===1:e.detail===0&&!e.pointerType}function ba(e){return Ts?!1:!ar&&e.width===0&&e.height===0||ar&&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 ft(e,t){const n=["mouse","pen"];return t||n.push("",void 0),n.includes(e)}function Is(e){const t=e.type;return t==="click"||t==="mousedown"||t==="keydown"||t==="keyup"}const xa=["top","right","bottom","left"],Tt=Math.min,ke=Math.max,vn=Math.round,vt=Math.floor,Ye=e=>({x:e,y:e}),va={left:"right",right:"left",bottom:"top",top:"bottom"};function dr(e,t,n){return ke(e,Tt(t,n))}function Qe(e,t){return typeof e=="function"?e(t):e}function Ne(e){return e.split("-")[0]}function ot(e){return e.split("-")[1]}function Cr(e){return e==="x"?"y":"x"}function Or(e){return e==="y"?"height":"width"}function Ae(e){const t=e[0];return t==="t"||t==="b"?"y":"x"}function Nr(e){return Cr(Ae(e))}function ya(e,t,n){n===void 0&&(n=!1);const r=ot(e),o=Nr(e),s=Or(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=yn(i)),[i,yn(i)]}function Ea(e){const t=yn(e);return[fr(e),t,fr(t)]}function fr(e){return e.includes("start")?e.replace("start","end"):e.replace("end","start")}const go=["left","right"],mo=["right","left"],wa=["top","bottom"],Sa=["bottom","top"];function Ra(e,t,n){switch(e){case"top":case"bottom":return n?t?mo:go:t?go:mo;case"left":case"right":return t?wa:Sa;default:return[]}}function Ta(e,t,n,r){const o=ot(e);let s=Ra(Ne(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(fr)))),s}function yn(e){const t=Ne(e);return va[t]+e.slice(t.length)}function Ca(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ps(e){return typeof e!="number"?Ca(e):{top:e,right:e,bottom:e,left:e}}function En(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function en(e,t,n){return Math.floor(e/t)!==n}function fn(e,t){return t<0||t>=e.current.length}function Oa(e,t){return je(e,{disabledIndices:t})}function Na(e,t){return je(e,{decrement:!0,startingIndex:e.current.length,disabledIndices:t})}function je(e,{startingIndex:t=-1,decrement:n=!1,disabledIndices:r,amount:o=1}={}){let s=t;do s+=n?-o:o;while(s>=0&&s<=e.current.length-1&&At(e,s,r));return s}function Ia(e,{event:t,orientation:n,loopFocus:r,rtl:o,cols:s,disabledIndices:i,minIndex:c,maxIndex:u,prevIndex:a,stopEvent:d=!1}){let l=a;const g=[],p={};let f=!1;{let x=null,E=-1;e.current.forEach((w,y)=>{if(w==null)return;const T=w.closest('[role="row"]');T&&(f=!0),(T!==x||E===-1)&&(x=T,E+=1,g[E]=[]),g[E].push(y),p[y]=E})}const h=f&&g.length>0&&g.some(x=>x.length!==s);function v(x){if(!h||a===-1)return;const E=p[a];if(E==null)return;const w=g[E].indexOf(a);let y=x==="up"?E-1:E+1;r&&(y<0?y=g.length-1:y>=g.length&&(y=0));const T=new Set;for(;y>=0&&y<g.length&&!T.has(y);){T.add(y);const S=g[y];if(S.length===0){y=x==="up"?y-1:y+1;continue}const C=Math.min(w,S.length-1);for(let O=C;O>=0;O-=1){const P=S[O];if(!At(e,P,i))return P}y=x==="up"?y-1:y+1,r&&(y<0?y=g.length-1:y>=g.length&&(y=0))}}if(t.key===da){const x=v("up");if(x!==void 0)d&&it(t),l=x;else{if(d&&it(t),a===-1)l=u;else if(l=je(e,{startingIndex:l,amount:s,decrement:!0,disabledIndices:i}),r&&(a-s<c||l<0)){const E=a%s,w=u%s,y=u-(w-E);w===E?l=u:l=w>E?y:y-s}fn(e,l)&&(l=a)}}if(t.key===fa){const x=v("down");x!==void 0?(d&&it(t),l=x):(d&&it(t),a===-1?l=c:(l=je(e,{startingIndex:a,amount:s,disabledIndices:i}),r&&a+s>u&&(l=je(e,{startingIndex:a%s-s,amount:s,disabledIndices:i}))),fn(e,l)&&(l=a))}if(n==="both"){const x=vt(a/s);t.key===(o?Un:Yn)&&(d&&it(t),a%s!==s-1?(l=je(e,{startingIndex:a,disabledIndices:i}),r&&en(l,s,x)&&(l=je(e,{startingIndex:a-a%s-1,disabledIndices:i}))):r&&(l=je(e,{startingIndex:a-a%s-1,disabledIndices:i})),en(l,s,x)&&(l=a)),t.key===(o?Yn:Un)&&(d&&it(t),a%s!==0?(l=je(e,{startingIndex:a,decrement:!0,disabledIndices:i}),r&&en(l,s,x)&&(l=je(e,{startingIndex:a+(s-a%s),decrement:!0,disabledIndices:i}))):r&&(l=je(e,{startingIndex:a+(s-a%s),decrement:!0,disabledIndices:i})),en(l,s,x)&&(l=a));const E=vt(u/s)===x;fn(e,l)&&(r&&E?l=t.key===(o?Yn:Un)?u:je(e,{startingIndex:a-a%s-1,disabledIndices:i}):l=a)}return l}function Pa(e,t,n){const r=[];let o=0;return e.forEach(({width:s,height:i},c)=>{if(s>t&&process.env.NODE_ENV!=="production")throw new Error(`[Floating UI]: Invalid grid - item width at index ${c} is greater than grid columns`);let u=!1;for(n&&(o=0);!u;){const a=[];for(let d=0;d<s;d+=1)for(let l=0;l<i;l+=1)a.push(o+d+l*t);o%t+s<=t&&a.every(d=>r[d]==null)?(a.forEach(d=>{r[d]=c}),u=!0):o+=1}}),[...r]}function ja(e,t,n,r,o){if(e===-1)return-1;const s=n.indexOf(e),i=t[e];switch(o){case"tl":return s;case"tr":return i?s+i.width-1:s;case"bl":return i?s+(i.height-1)*r:s;case"br":return n.lastIndexOf(e);default:return-1}}function ka(e,t){return t.flatMap((n,r)=>e.includes(n)?[r]:[])}function At(e,t,n){if(typeof n=="function")return n(t);if(n)return n.includes(t);const r=e.current[t];return r?r.hasAttribute("disabled")||r.getAttribute("aria-disabled")==="true":!1}/*!
|
|
2
|
-
* tabbable 6.4.0
|
|
3
|
-
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
4
|
-
*/var Ma=["input:not([inert]):not([inert] *)","select:not([inert]):not([inert] *)","textarea:not([inert]):not([inert] *)","a[href]:not([inert]):not([inert] *)","button:not([inert]):not([inert] *)","[tabindex]:not(slot):not([inert]):not([inert] *)","audio[controls]:not([inert]):not([inert] *)","video[controls]:not([inert]):not([inert] *)",'[contenteditable]:not([contenteditable="false"]):not([inert]):not([inert] *)',"details>summary:first-of-type:not([inert]):not([inert] *)","details:not([inert]):not([inert] *)"],wn=Ma.join(","),js=typeof Element>"u",Ct=js?function(){}:Element.prototype.matches||Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector,Sn=!js&&Element.prototype.getRootNode?function(e){var t;return e==null||(t=e.getRootNode)===null||t===void 0?void 0:t.call(e)}:function(e){return e==null?void 0:e.ownerDocument},Rn=function(t,n){var r;n===void 0&&(n=!0);var o=t==null||(r=t.getAttribute)===null||r===void 0?void 0:r.call(t,"inert"),s=o===""||o==="true",i=s||n&&t&&(typeof t.closest=="function"?t.closest("[inert]"):Rn(t.parentNode));return i},Da=function(t){var n,r=t==null||(n=t.getAttribute)===null||n===void 0?void 0:n.call(t,"contenteditable");return r===""||r==="true"},ks=function(t,n,r){if(Rn(t))return[];var o=Array.prototype.slice.apply(t.querySelectorAll(wn));return n&&Ct.call(t,wn)&&o.unshift(t),o=o.filter(r),o},Tn=function(t,n,r){for(var o=[],s=Array.from(t);s.length;){var i=s.shift();if(!Rn(i,!1))if(i.tagName==="SLOT"){var c=i.assignedElements(),u=c.length?c:i.children,a=Tn(u,!0,r);r.flatten?o.push.apply(o,a):o.push({scopeParent:i,candidates:a})}else{var d=Ct.call(i,wn);d&&r.filter(i)&&(n||!t.includes(i))&&o.push(i);var l=i.shadowRoot||typeof r.getShadowRoot=="function"&&r.getShadowRoot(i),g=!Rn(l,!1)&&(!r.shadowRootFilter||r.shadowRootFilter(i));if(l&&g){var p=Tn(l===!0?i.children:l.children,!0,r);r.flatten?o.push.apply(o,p):o.push({scopeParent:i,candidates:p})}else s.unshift.apply(s,i.children)}}return o},Ms=function(t){return!isNaN(parseInt(t.getAttribute("tabindex"),10))},Ds=function(t){if(!t)throw new Error("No node provided");return t.tabIndex<0&&(/^(AUDIO|VIDEO|DETAILS)$/.test(t.tagName)||Da(t))&&!Ms(t)?0:t.tabIndex},Aa=function(t,n){var r=Ds(t);return r<0&&n&&!Ms(t)?0:r},La=function(t,n){return t.tabIndex===n.tabIndex?t.documentOrder-n.documentOrder:t.tabIndex-n.tabIndex},As=function(t){return t.tagName==="INPUT"},_a=function(t){return As(t)&&t.type==="hidden"},Fa=function(t){var n=t.tagName==="DETAILS"&&Array.prototype.slice.apply(t.children).some(function(r){return r.tagName==="SUMMARY"});return n},Va=function(t,n){for(var r=0;r<t.length;r++)if(t[r].checked&&t[r].form===n)return t[r]},Ba=function(t){if(!t.name)return!0;var n=t.form||Sn(t),r=function(c){return n.querySelectorAll('input[type="radio"][name="'+c+'"]')},o;if(typeof window<"u"&&typeof window.CSS<"u"&&typeof window.CSS.escape=="function")o=r(window.CSS.escape(t.name));else try{o=r(t.name)}catch(i){return console.error("Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s",i.message),!1}var s=Va(o,t.form);return!s||s===t},$a=function(t){return As(t)&&t.type==="radio"},Ha=function(t){return $a(t)&&!Ba(t)},za=function(t){var n,r=t&&Sn(t),o=(n=r)===null||n===void 0?void 0:n.host,s=!1;if(r&&r!==t){var i,c,u;for(s=!!((i=o)!==null&&i!==void 0&&(c=i.ownerDocument)!==null&&c!==void 0&&c.contains(o)||t!=null&&(u=t.ownerDocument)!==null&&u!==void 0&&u.contains(t));!s&&o;){var a,d,l;r=Sn(o),o=(a=r)===null||a===void 0?void 0:a.host,s=!!((d=o)!==null&&d!==void 0&&(l=d.ownerDocument)!==null&&l!==void 0&&l.contains(o))}}return s},ho=function(t){var n=t.getBoundingClientRect(),r=n.width,o=n.height;return r===0&&o===0},Wa=function(t,n){var r=n.displayCheck,o=n.getShadowRoot;if(r==="full-native"&&"checkVisibility"in t){var s=t.checkVisibility({checkOpacity:!1,opacityProperty:!1,contentVisibilityAuto:!0,visibilityProperty:!0,checkVisibilityCSS:!0});return!s}if(getComputedStyle(t).visibility==="hidden")return!0;var i=Ct.call(t,"details>summary:first-of-type"),c=i?t.parentElement:t;if(Ct.call(c,"details:not([open]) *"))return!0;if(!r||r==="full"||r==="full-native"||r==="legacy-full"){if(typeof o=="function"){for(var u=t;t;){var a=t.parentElement,d=Sn(t);if(a&&!a.shadowRoot&&o(a)===!0)return ho(t);t.assignedSlot?t=t.assignedSlot:!a&&d!==t.ownerDocument?t=d.host:t=a}t=u}if(za(t))return!t.getClientRects().length;if(r!=="legacy-full")return!0}else if(r==="non-zero-area")return ho(t);return!1},Ua=function(t){if(/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(t.tagName))for(var n=t.parentElement;n;){if(n.tagName==="FIELDSET"&&n.disabled){for(var r=0;r<n.children.length;r++){var o=n.children.item(r);if(o.tagName==="LEGEND")return Ct.call(n,"fieldset[disabled] *")?!0:!o.contains(t)}return!0}n=n.parentElement}return!1},pr=function(t,n){return!(n.disabled||_a(n)||Wa(n,t)||Fa(n)||Ua(n))},gr=function(t,n){return!(Ha(n)||Ds(n)<0||!pr(t,n))},Ya=function(t){var n=parseInt(t.getAttribute("tabindex"),10);return!!(isNaN(n)||n>=0)},Ls=function(t){var n=[],r=[];return t.forEach(function(o,s){var i=!!o.scopeParent,c=i?o.scopeParent:o,u=Aa(c,i),a=i?Ls(o.candidates):c;u===0?i?n.push.apply(n,a):n.push(c):r.push({documentOrder:s,tabIndex:u,item:o,isScope:i,content:a})}),r.sort(La).reduce(function(o,s){return s.isScope?o.push.apply(o,s.content):o.push(s.content),o},[]).concat(n)},Mn=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Tn([t],n.includeContainer,{filter:gr.bind(null,n),flatten:!1,getShadowRoot:n.getShadowRoot,shadowRootFilter:Ya}):r=ks(t,n.includeContainer,gr.bind(null,n)),Ls(r)},Ka=function(t,n){n=n||{};var r;return n.getShadowRoot?r=Tn([t],n.includeContainer,{filter:pr.bind(null,n),flatten:!0,getShadowRoot:n.getShadowRoot}):r=ks(t,n.includeContainer,pr.bind(null,n)),r},_s=function(t,n){if(n=n||{},!t)throw new Error("No node provided");return Ct.call(t,wn)===!1?!1:gr(n,t)};const Ut=()=>({getShadowRoot:!0,displayCheck:typeof ResizeObserver=="function"&&ResizeObserver.toString().includes("[native code]")?"full":"none"});function Fs(e,t){const n=Mn(e,Ut()),r=n.length;if(r===0)return;const o=ze(ce(e)),s=n.indexOf(o),i=s===-1?t===1?0:r-1:s+t;return n[i]}function Vs(e){return Fs(ce(e).body,1)||e}function Bs(e){return Fs(ce(e).body,-1)||e}function Lt(e,t){const n=t||e.currentTarget,r=e.relatedTarget;return!r||!ne(n,r)}function Ga(e){Mn(e,Ut()).forEach(n=>{n.dataset.tabindex=n.getAttribute("tabindex")||"",n.setAttribute("tabindex","-1")})}function bo(e){e.querySelectorAll("[data-tabindex]").forEach(n=>{const r=n.dataset.tabindex;delete n.dataset.tabindex,r?n.setAttribute("tabindex",r):n.removeAttribute("tabindex")})}const ct={...b};let xo=0;function Xa(e,t="mui"){const[n,r]=b.useState(e),o=e||n;return b.useEffect(()=>{n==null&&(xo+=1,r(`${t}-${xo}`))},[n,t]),o}const vo=ct.useId;function Yt(e,t){if(vo!==void 0){const n=vo();return e??(t?`${t}-${n}`:n)}return Xa(e,t)}function qa(){const e=new Map;return{emit(t,n){var r;(r=e.get(t))==null||r.forEach(o=>o(n))},on(t,n){e.has(t)||e.set(t,new Set),e.get(t).add(n)},off(t,n){var r;(r=e.get(t))==null||r.delete(n)}}}const $s=b.createContext(null);process.env.NODE_ENV!=="production"&&($s.displayName="FloatingNodeContext");const Hs=b.createContext(null);process.env.NODE_ENV!=="production"&&(Hs.displayName="FloatingTreeContext");const Dn=()=>{var e;return((e=b.useContext($s))==null?void 0:e.id)||null},Kt=e=>{const t=b.useContext(Hs);return e??t};function zs(){}const mr=Object.freeze([]),Re=Object.freeze({}),Za={style:{transition:"none"}},Ws="data-base-ui-click-trigger",Ja={fallbackAxisSide:"end"},Qa={clipPath:"inset(50%)",position:"fixed",top:0,left:0},Ft="none",Vt="trigger-press",Be="trigger-hover",pn="trigger-focus",Us="outside-press",Ys="focus-out",Ir="escape-key",el="disabled",Ks="imperative-action";function ae(e,t,n,r){let o=!1,s=!1;const i=r??Re;return{reason:e,event:t??new Event("base-ui"),cancel(){o=!0},allowPropagation(){s=!0},get isCanceled(){return o},get isPropagationAllowed(){return s},trigger:n,...i}}function Ot(e){return`data-base-ui-${e}`}function gn(e,t,n){if(n&&!ft(n))return 0;if(typeof e=="number")return e;if(typeof e=="function"){const r=e();return typeof r=="number"?r:r==null?void 0:r[t]}return e==null?void 0:e[t]}const Gs=b.createContext({hasProvider:!1,timeoutMs:0,delayRef:{current:0},initialDelayRef:{current:0},timeout:new Ke,currentIdRef:{current:null},currentContextRef:{current:null}});process.env.NODE_ENV!=="production"&&(Gs.displayName="FloatingDelayGroupContext");function tl(e,t={open:!1}){const n="rootStore"in e?e.rootStore:e,r=n.useState("floatingId"),{open:o}=t,s=b.useContext(Gs),{currentIdRef:i,delayRef:c,timeoutMs:u,initialDelayRef:a,currentContextRef:d,hasProvider:l,timeout:g}=s,[p,f]=b.useState(!1);return G(()=>{function h(){var v;f(!1),(v=d.current)==null||v.setIsInstantPhase(!1),i.current=null,d.current=null,c.current=a.current}if(i.current&&!o&&i.current===r){if(f(!1),u){const v=r;return g.start(u,()=>{n.select("open")||i.current&&i.current!==v||h()}),()=>{g.clear()}}h()}},[o,r,i,c,u,a,d,g,n]),G(()=>{if(!o)return;const h=d.current,v=i.current;g.clear(),d.current={onOpenChange:n.setOpen,setIsInstantPhase:f},i.current=r,c.current={open:0,close:gn(a.current,"close")},v!==null&&v!==r?(f(!0),h==null||h.setIsInstantPhase(!0),h==null||h.onOpenChange(!1,ae(Ft))):(f(!1),h==null||h.setIsInstantPhase(!1))},[o,r,n,i,c,u,a,d,g]),G(()=>()=>{d.current=null},[d]),b.useMemo(()=>({hasProvider:l,delayRef:c,isInstantPhase:p}),[l,c,p])}function Nt(e,t,n,r){const o=Ie(Xs).current;return rl(o,e,t,n,r)&&qs(o,[e,t,n,r]),o.callback}function nl(e){const t=Ie(Xs).current;return ol(t,e)&&qs(t,e),t.callback}function Xs(){return{callback:null,cleanup:null,refs:[]}}function rl(e,t,n,r,o){return e.refs[0]!==t||e.refs[1]!==n||e.refs[2]!==r||e.refs[3]!==o}function ol(e,t){return e.refs.length!==t.length||e.refs.some((n,r)=>n!==t[r])}function qs(e,t){if(e.refs=t,t.every(n=>n==null)){e.callback=null;return}e.callback=n=>{if(e.cleanup&&(e.cleanup(),e.cleanup=null),n!=null){const r=Array(t.length).fill(null);for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=s(n);typeof i=="function"&&(r[o]=i);break}case"object":{s.current=n;break}}}e.cleanup=()=>{for(let o=0;o<t.length;o+=1){const s=t[o];if(s!=null)switch(typeof s){case"function":{const i=r[o];typeof i=="function"?i():s(null);break}case"object":{s.current=null;break}}}}}}}const sl={clipPath:"inset(50%)",overflow:"hidden",whiteSpace:"nowrap",border:0,padding:0,width:1,height:1,margin:-1},Zs={...sl,position:"fixed",top:0,left:0},tn=null;let yo=globalThis.requestAnimationFrame;class il{constructor(){de(this,"callbacks",[]);de(this,"callbacksCount",0);de(this,"nextId",1);de(this,"startId",1);de(this,"isScheduled",!1);de(this,"tick",t=>{var o;this.isScheduled=!1;const n=this.callbacks,r=this.callbacksCount;if(this.callbacks=[],this.callbacksCount=0,this.startId=this.nextId,r>0)for(let s=0;s<n.length;s+=1)(o=n[s])==null||o.call(n,t)})}request(t){const n=this.nextId;this.nextId+=1,this.callbacks.push(t),this.callbacksCount+=1;const r=process.env.NODE_ENV!=="production"&&yo!==requestAnimationFrame&&(yo=requestAnimationFrame,!0);return(!this.isScheduled||r)&&(requestAnimationFrame(this.tick),this.isScheduled=!0),n}cancel(t){const n=t-this.startId;n<0||n>=this.callbacks.length||(this.callbacks[n]=null,this.callbacksCount-=1)}}const nn=new il;class We{constructor(){de(this,"currentId",tn);de(this,"cancel",()=>{this.currentId!==tn&&(nn.cancel(this.currentId),this.currentId=tn)});de(this,"disposeEffect",()=>this.cancel)}static create(){return new We}static request(t){return nn.request(t)}static cancel(t){return nn.cancel(t)}request(t){this.cancel(),this.currentId=nn.request(()=>{this.currentId=tn,t()})}}function Pr(){const e=Ie(We.create).current;return Sr(e.disposeEffect),e}const Bt=b.forwardRef(function(t,n){const[r,o]=b.useState();G(()=>{Rs&&o("button")},[]);const s={tabIndex:0,role:r};return m.jsx("span",{...t,ref:n,style:Zs,"aria-hidden":r?void 0:!0,...s,"data-base-ui-focus-guard":""})});process.env.NODE_ENV!=="production"&&(Bt.displayName="FocusGuard");let Eo=0;function Kn(e,t={}){const{preventScroll:n=!1,cancelPrevious:r=!0,sync:o=!1}=t;r&&cancelAnimationFrame(Eo);const s=()=>e==null?void 0:e.focus({preventScroll:n});o?s():Eo=requestAnimationFrame(s)}const yt={inert:new WeakMap,"aria-hidden":new WeakMap,none:new WeakMap};function wo(e){return e==="inert"?yt.inert:e==="aria-hidden"?yt["aria-hidden"]:yt.none}let rn=new WeakSet,on={},Gn=0;const Js=e=>e&&(e.host||Js(e.parentNode)),cl=(e,t)=>t.map(n=>{if(e.contains(n))return n;const r=Js(n);return e.contains(r)?r:null}).filter(n=>n!=null);function al(e,t,n,r){const o="data-base-ui-inert",s=r?"inert":n?"aria-hidden":null,i=cl(t,e),c=new Set,u=new Set(i),a=[];on[o]||(on[o]=new WeakMap);const d=on[o];i.forEach(l),g(t),c.clear();function l(p){!p||c.has(p)||(c.add(p),p.parentNode&&l(p.parentNode))}function g(p){!p||u.has(p)||[].forEach.call(p.children,f=>{if(nt(f)!=="script")if(c.has(f))g(f);else{const h=s?f.getAttribute(s):null,v=h!==null&&h!=="false",x=wo(s),E=(x.get(f)||0)+1,w=(d.get(f)||0)+1;x.set(f,E),d.set(f,w),a.push(f),E===1&&v&&rn.add(f),w===1&&f.setAttribute(o,""),!v&&s&&f.setAttribute(s,s==="inert"?"":"true")}})}return Gn+=1,()=>{a.forEach(p=>{const f=wo(s),v=(f.get(p)||0)-1,x=(d.get(p)||0)-1;f.set(p,v),d.set(p,x),v||(!rn.has(p)&&s&&p.removeAttribute(s),rn.delete(p)),x||p.removeAttribute(o)}),Gn-=1,Gn||(yt.inert=new WeakMap,yt["aria-hidden"]=new WeakMap,yt.none=new WeakMap,rn=new WeakSet,on={})}}function ll(e,t=!1,n=!1){const r=ce(e[0]).body;return al(e.concat(Array.from(r.querySelectorAll("[aria-live]"))),r,t,n)}const ul=parseInt(b.version,10);function jr(e){return ul>=e}function So(e){if(!b.isValidElement(e))return null;const t=e,n=t.props;return(jr(19)?n==null?void 0:n.ref:t.ref)??null}function hr(e,t){if(e&&!t)return e;if(!e&&t)return t;if(e||t)return{...e,...t}}function dl(e,t){const n={};for(const r in e){const o=e[r];if(t!=null&&t.hasOwnProperty(r)){const s=t[r](o);s!=null&&Object.assign(n,s);continue}o===!0?n[`data-${r.toLowerCase()}`]="":o&&(n[`data-${r.toLowerCase()}`]=o.toString())}return n}function fl(e,t){return typeof e=="function"?e(t):e}function pl(e,t){return typeof e=="function"?e(t):e}const _t={};function Qs(e,t,n,r,o){let s={...br(e,_t)};return t&&(s=mn(s,t)),n&&(s=mn(s,n)),r&&(s=mn(s,r)),s}function gl(e){if(e.length===0)return _t;if(e.length===1)return br(e[0],_t);let t={...br(e[0],_t)};for(let n=1;n<e.length;n+=1)t=mn(t,e[n]);return t}function mn(e,t){return ei(t)?t(e):ml(e,t)}function ml(e,t){if(!t)return e;for(const n in t){const r=t[n];switch(n){case"style":{e[n]=hr(e.style,r);break}case"className":{e[n]=ti(e.className,r);break}default:hl(n,r)?e[n]=bl(e[n],r):e[n]=r}}return e}function hl(e,t){const n=e.charCodeAt(0),r=e.charCodeAt(1),o=e.charCodeAt(2);return n===111&&r===110&&o>=65&&o<=90&&(typeof t=="function"||typeof t>"u")}function ei(e){return typeof e=="function"}function br(e,t){return ei(e)?e(t):e??_t}function bl(e,t){return t?e?n=>{if(xl(n)){const o=n;xr(o);const s=t(o);return o.baseUIHandlerPrevented||e==null||e(o),s}const r=t(n);return e==null||e(n),r}:t:e}function xr(e){return e.preventBaseUIHandler=()=>{e.baseUIHandlerPrevented=!0},e}function ti(e,t){return t?e?t+" "+e:t:e}function xl(e){return e!=null&&typeof e=="object"&&"nativeEvent"in e}function Pe(e,t,n={}){const r=t.render,o=vl(t,n);if(n.enabled===!1)return null;const s=n.state??Re;return El(e,r,o,s)}function vl(e,t={}){const{className:n,style:r,render:o}=e,{state:s=Re,ref:i,props:c,stateAttributesMapping:u,enabled:a=!0}=t,d=a?fl(n,s):void 0,l=a?pl(r,s):void 0,g=a?dl(s,u):Re,p=a?hr(g,Array.isArray(c)?gl(c):c)??Re:Re;return typeof document<"u"&&(a?Array.isArray(i)?p.ref=nl([p.ref,So(o),...i]):p.ref=Nt(p.ref,So(o),i):Nt(null,null)),a?(d!==void 0&&(p.className=ti(p.className,d)),l!==void 0&&(p.style=hr(p.style,l)),p):Re}const yl=Symbol.for("react.lazy");function El(e,t,n,r){if(t){if(typeof t=="function")return t(n,r);const o=Qs(n,t.props);o.ref=n.ref;let s=t;if((s==null?void 0:s.$$typeof)===yl&&(s=b.Children.toArray(t)[0]),process.env.NODE_ENV!=="production"&&!b.isValidElement(s))throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.","A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.","https://base-ui.com/r/invalid-render-prop"].join(`
|
|
5
|
-
`));return b.cloneElement(s,o)}if(e&&typeof e=="string")return wl(e,n);throw new Error(process.env.NODE_ENV!=="production"?"Base UI: Render element or function are not defined.":Le(8))}function wl(e,t){return e==="button"?re.createElement("button",{type:"button",...t,key:t.key}):e==="img"?re.createElement("img",{alt:"",...t,key:t.key}):b.createElement(e,t)}const kr=b.createContext(null);process.env.NODE_ENV!=="production"&&(kr.displayName="PortalContext");const ni=()=>b.useContext(kr),Sl=Ot("portal");function ri(e={}){const{ref:t,container:n,componentProps:r=Re,elementProps:o}=e,s=Yt(),i=ni(),c=i==null?void 0:i.portalNode,[u,a]=b.useState(null),[d,l]=b.useState(null),g=W(v=>{v!==null&&l(v)}),p=b.useRef(null);G(()=>{if(n===null){p.current&&(p.current=null,l(null),a(null));return}if(s==null)return;const v=(n&&(Rr(n)?n:n.current))??c??document.body;if(v==null){p.current&&(p.current=null,l(null),a(null));return}p.current!==v&&(p.current=v,l(null),a(v))},[n,c,s]);const f=Pe("div",r,{ref:[t,g],props:[{id:s,[Sl]:""},o]});return{portalNode:d,portalSubtree:u&&f?gt.createPortal(f,u):null}}const oi=b.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,renderGuards:c,...u}=t,{portalNode:a,portalSubtree:d}=ri({container:o,ref:n,componentProps:t,elementProps:u}),l=b.useRef(null),g=b.useRef(null),p=b.useRef(null),f=b.useRef(null),[h,v]=b.useState(null),x=h==null?void 0:h.modal,E=h==null?void 0:h.open,w=typeof c=="boolean"?c:!!h&&!h.modal&&h.open&&!!a;b.useEffect(()=>{if(!a||x)return;function T(S){a&&S.relatedTarget&&Lt(S)&&(S.type==="focusin"?bo:Ga)(a)}return a.addEventListener("focusin",T,!0),a.addEventListener("focusout",T,!0),()=>{a.removeEventListener("focusin",T,!0),a.removeEventListener("focusout",T,!0)}},[a,x]),b.useEffect(()=>{!a||E||bo(a)},[E,a]);const y=b.useMemo(()=>({beforeOutsideRef:l,afterOutsideRef:g,beforeInsideRef:p,afterInsideRef:f,portalNode:a,setFocusManagerState:v}),[a]);return m.jsxs(b.Fragment,{children:[d,m.jsxs(kr.Provider,{value:y,children:[w&&a&&m.jsx(Bt,{"data-type":"outside",ref:l,onFocus:T=>{var S;if(Lt(T,a))(S=p.current)==null||S.focus();else{const C=h?h.domReference:null,O=Bs(C);O==null||O.focus()}}}),w&&a&&m.jsx("span",{"aria-owns":a.id,style:Qa}),a&>.createPortal(r,a),w&&a&&m.jsx(Bt,{"data-type":"outside",ref:g,onFocus:T=>{var S;if(Lt(T,a))(S=f.current)==null||S.focus();else{const C=h?h.domReference:null,O=Vs(C);O==null||O.focus(),h!=null&&h.closeOnFocusOut&&(h==null||h.onOpenChange(!1,ae(Ys,T.nativeEvent)))}}})]})]})});process.env.NODE_ENV!=="production"&&(oi.displayName="FloatingPortal");function qe(e){return e==null?e:"current"in e?e.current:e}function Rl(e,t){const n=ve(e.target);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"):""}const Ro=20;let et=[];function Mr(){et=et.filter(e=>{var t;return(t=e.deref())==null?void 0:t.isConnected})}function Tl(e){Mr(),e&&nt(e)!=="body"&&(et.push(new WeakRef(e)),et.length>Ro&&(et=et.slice(-Ro)))}function Xn(){var e;return Mr(),(e=et[et.length-1])==null?void 0:e.deref()}function Cl(e){if(!e)return null;const t=Ut();return _s(e,t)?e:Mn(e,t)[0]||e}function Ol(e){return!e||!e.isConnected?!1:typeof e.checkVisibility=="function"?e.checkVisibility():Me(e).display!=="none"}function To(e,t){var i;if(!t.current.includes("floating")&&!((i=e.getAttribute("role"))!=null&&i.includes("dialog")))return;const n=Ut(),o=Ka(e,n).filter(c=>{const u=c.getAttribute("data-tabindex")||"";return _s(c,n)||c.hasAttribute("data-tabindex")&&!u.startsWith("-")}),s=e.getAttribute("tabindex");t.current.includes("floating")||o.length===0?s!=="0"&&e.setAttribute("tabindex","0"):(s!=="-1"||e.hasAttribute("data-tabindex")&&e.getAttribute("data-tabindex")!=="-1")&&(e.setAttribute("tabindex","-1"),e.setAttribute("data-tabindex","-1"))}function Nl(e){const{context:t,children:n,disabled:r=!1,initialFocus:o=!0,returnFocus:s=!0,restoreFocus:i=!1,modal:c=!0,closeOnFocusOut:u=!0,openInteractionType:a="",nextFocusableElement:d,previousFocusableElement:l,beforeContentFocusGuardRef:g,externalTree:p}=e,f="rootStore"in t?t.rootStore:t,h=f.useState("open"),v=f.useState("domReferenceElement"),x=f.useState("floatingElement"),{events:E,dataRef:w}=f.context,y=W(()=>{var M;return(M=w.current.floatingContext)==null?void 0:M.nodeId}),T=o===!1,S=fo(v)&&T,C=b.useRef(["content"]),O=Ue(o),P=Ue(s),_=Ue(a),j=Kt(p),R=ni(),N=b.useRef(null),Y=b.useRef(null),D=b.useRef(!1),B=b.useRef(!1),L=b.useRef(!1),I=b.useRef(-1),A=b.useRef(""),H=b.useRef(""),le=b.useRef(null),fe=b.useRef(null),se=Nt(le,g,R==null?void 0:R.beforeInsideRef),pe=Nt(fe,R==null?void 0:R.afterInsideRef),ye=Rt(),ee=Rt(),J=Pr(),me=R!=null,K=ur(x),he=W((M=K)=>M?Mn(M,Ut()):[]),_e=W(M=>{const F=he(M);return C.current.map(()=>F).filter(Boolean).flat()});b.useEffect(()=>{if(r||!c)return;function M(X){X.key==="Tab"&&ne(K,ze(ce(K)))&&he().length===0&&!S&&it(X)}const F=ce(K);return F.addEventListener("keydown",M),()=>{F.removeEventListener("keydown",M)}},[r,v,K,c,C,S,he,_e]),b.useEffect(()=>{if(r||!h)return;const M=ce(K);function F(){L.current=!1}function X(Z){const $=Oe(Z),te=ne(x,$)||ne(v,$)||ne(R==null?void 0:R.portalNode,$);L.current=!te,H.current=Z.pointerType||"keyboard",$!=null&&$.closest(`[${Ws}]`)&&(B.current=!0)}function z(){H.current="keyboard"}return M.addEventListener("pointerdown",X,!0),M.addEventListener("pointerup",F,!0),M.addEventListener("pointercancel",F,!0),M.addEventListener("keydown",z,!0),()=>{M.removeEventListener("pointerdown",X,!0),M.removeEventListener("pointerup",F,!0),M.removeEventListener("pointercancel",F,!0),M.removeEventListener("keydown",z,!0)}},[r,x,v,K,h,R]),b.useEffect(()=>{if(r||!u)return;const M=ce(K);function F(){B.current=!0,ee.start(0,()=>{B.current=!1})}function X(ie){const q=Oe(ie),ge=he().indexOf(q);ge!==-1&&(I.current=ge)}function z(ie){const q=ie.relatedTarget,Te=ie.currentTarget,ge=Oe(ie);queueMicrotask(()=>{const xe=y(),Fe=f.context.triggerElements,ht=(q==null?void 0:q.hasAttribute(Ot("focus-guard")))&&[le.current,fe.current,R==null?void 0:R.beforeInsideRef.current,R==null?void 0:R.afterInsideRef.current,R==null?void 0:R.beforeOutsideRef.current,R==null?void 0:R.afterOutsideRef.current,qe(l),qe(d)].includes(q),bt=!(ne(v,q)||ne(x,q)||ne(q,x)||ne(R==null?void 0:R.portalNode,q)||q!=null&&Fe.hasElement(q)||Fe.hasMatchingElement(we=>ne(we,q))||ht||j&&(ut(j.nodesRef.current,xe).find(we=>{var Ce,Se;return ne((Ce=we.context)==null?void 0:Ce.elements.floating,q)||ne((Se=we.context)==null?void 0:Se.elements.domReference,q)})||po(j.nodesRef.current,xe).find(we=>{var Ce,Se,$e;return[(Ce=we.context)==null?void 0:Ce.elements.floating,ur((Se=we.context)==null?void 0:Se.elements.floating)].includes(q)||(($e=we.context)==null?void 0:$e.elements.domReference)===q})));if(Te===v&&K&&To(K,C),i&&Te!==v&&!Ol(ge)&&ze(M)===M.body){if(be(K)&&(K.focus(),i==="popup")){J.request(()=>{K.focus()});return}const we=I.current,Ce=he(),Se=Ce[we]||Ce[Ce.length-1]||K;be(Se)&&Se.focus()}if(w.current.insideReactTree){w.current.insideReactTree=!1;return}(S||!c)&&q&&bt&&!B.current&&(S||q!==Xn())&&(D.current=!0,f.setOpen(!1,ae(Ys,ie)))})}function Z(){L.current||(w.current.insideReactTree=!0,ye.start(0,()=>{w.current.insideReactTree=!1}))}const $=be(v)?v:null,te=[];if(!(!x&&!$))return $&&($.addEventListener("focusout",z),$.addEventListener("pointerdown",F),te.push(()=>{$.removeEventListener("focusout",z),$.removeEventListener("pointerdown",F)})),x&&(x.addEventListener("focusin",X),x.addEventListener("focusout",z),R&&(x.addEventListener("focusout",Z,!0),te.push(()=>{x.removeEventListener("focusout",Z,!0)})),te.push(()=>{x.removeEventListener("focusin",X),x.removeEventListener("focusout",z)})),()=>{te.forEach(ie=>{ie()})}},[r,v,x,K,c,j,R,f,u,i,he,S,y,C,w,ye,ee,J,d,l]),b.useEffect(()=>{var Z,$,te;if(r||!x||!h)return;const M=Array.from(((Z=R==null?void 0:R.portalNode)==null?void 0:Z.querySelectorAll(`[${Ot("portal")}]`))||[]),X=(te=($=(j?po(j.nodesRef.current,y()):[]).find(ie=>{var q;return fo(((q=ie.context)==null?void 0:q.elements.domReference)||null)}))==null?void 0:$.context)==null?void 0:te.elements.domReference,z=[x,X,...M,N.current,Y.current,le.current,fe.current,R==null?void 0:R.beforeOutsideRef.current,R==null?void 0:R.afterOutsideRef.current,qe(l),qe(d),S?v:null].filter(ie=>ie!=null);return ll(z,c||S)},[h,r,v,x,c,C,R,S,j,y,d,l]),G(()=>{if(!h||r||!be(K))return;const M=ce(K),F=ze(M);queueMicrotask(()=>{const X=_e(K),z=O.current,Z=typeof z=="function"?z(_.current||""):z;if(Z===void 0||Z===!1)return;let $;Z===!0||Z===null?$=X[0]||K:$=qe(Z),$=$||X[0]||K,!ne(K,F)&&Kn($,{preventScroll:$===K})})},[r,h,K,T,_e,O,_]),G(()=>{if(r||!K)return;const M=ce(K),F=ze(M);Tl(F);function X($){if($.open||(A.current=Rl($.nativeEvent,H.current)),$.reason===Be&&$.nativeEvent.type==="mouseleave"&&(D.current=!0),$.reason===Us)if($.nested)D.current=!1;else if(ha($.nativeEvent)||ba($.nativeEvent))D.current=!1;else{let te=!1;document.createElement("div").focus({get preventScroll(){return te=!0,!1}}),te?D.current=!1:D.current=!0}}E.on("openchange",X);const z=M.createElement("span");z.setAttribute("tabindex","-1"),z.setAttribute("aria-hidden","true"),Object.assign(z.style,Zs),me&&v&&v.insertAdjacentElement("afterend",z);function Z(){const $=P.current;let te=typeof $=="function"?$(A.current):$;if(te===void 0||te===!1)return null;if(te===null&&(te=!0),typeof te=="boolean"){const q=v||Xn();return q&&q.isConnected?q:z}const ie=v||Xn()||z;return qe(te)||ie}return()=>{E.off("openchange",X);const $=ze(M),te=ne(x,$)||j&&ut(j.nodesRef.current,y(),!1).some(q=>{var Te;return ne((Te=q.context)==null?void 0:Te.elements.floating,$)}),ie=Z();queueMicrotask(()=>{const q=Cl(ie),Te=typeof P.current!="boolean";P.current&&!D.current&&be(q)&&(!(!Te&&q!==$&&$!==M.body)||te)&&q.focus({preventScroll:!0}),z.remove(),D.current=!1})}},[r,x,K,P,w,E,j,me,v,y]),G(()=>{if(!ws||h||!x)return;const M=ze(ce(x));!be(M)||!kn(M)||ne(x,M)&&M.blur()},[h,x]),G(()=>{if(!(r||!R))return R.setFocusManagerState({modal:c,closeOnFocusOut:u,open:h,onOpenChange:f.setOpen,domReference:v}),()=>{R.setFocusManagerState(null)}},[r,R,c,h,f,u,v]),G(()=>{if(!(r||!K))return To(K,C),()=>{queueMicrotask(Mr)}},[r,K,C]);const k=!r&&(c?!S:!0)&&(me||c);return m.jsxs(b.Fragment,{children:[k&&m.jsx(Bt,{"data-type":"inside",ref:se,onFocus:M=>{var F;if(c){const X=_e();Kn(X[X.length-1])}else if(R!=null&&R.portalNode)if(D.current=!1,Lt(M,R.portalNode)){const X=Vs(v);X==null||X.focus()}else(F=qe(l??R.beforeOutsideRef))==null||F.focus()}}),n,k&&m.jsx(Bt,{"data-type":"inside",ref:pe,onFocus:M=>{var F;if(c)Kn(_e()[0]);else if(R!=null&&R.portalNode)if(u&&(D.current=!0),Lt(M,R.portalNode)){const X=Bs(v);X==null||X.focus()}else(F=qe(d??R.afterOutsideRef))==null||F.focus()}})]})}function Il(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.context.dataRef,{enabled:o=!0,event:s="click",toggle:i=!0,ignoreMouse:c=!1,stickIfOpen:u=!0,touchOpenDelay:a=0,reason:d=Vt}=t,l=b.useRef(void 0),g=Pr(),p=Rt(),f=b.useMemo(()=>({onPointerDown(h){l.current=h.pointerType},onMouseDown(h){const v=l.current,x=h.nativeEvent,E=n.select("open");if(h.button!==0||s==="click"||ft(v,!0)&&c)return;const w=r.current.openEvent,y=w==null?void 0:w.type,T=n.select("domReferenceElement")!==h.currentTarget,S=E&&T||!(E&&i&&(!(w&&u)||y==="click"||y==="mousedown"));if(kn(x.target)){const O=ae(d,x,x.target);S&&v==="touch"&&a>0?p.start(a,()=>{n.setOpen(!0,O)}):n.setOpen(S,O);return}const C=h.currentTarget;g.request(()=>{const O=ae(d,x,C);S&&v==="touch"&&a>0?p.start(a,()=>{n.setOpen(!0,O)}):n.setOpen(S,O)})},onClick(h){if(s==="mousedown-only")return;const v=l.current;if(s==="mousedown"&&v){l.current=void 0;return}if(ft(v,!0)&&c)return;const x=n.select("open"),E=r.current.openEvent,w=n.select("domReferenceElement")!==h.currentTarget,y=x&&w||!(x&&i&&(!(E&&u)||Is(E))),T=ae(d,h.nativeEvent,h.currentTarget);y&&v==="touch"&&a>0?p.start(a,()=>{n.setOpen(!0,T)}):n.setOpen(y,T)},onKeyDown(){l.current=void 0}}),[r,s,c,n,u,i,g,p,a,d]);return b.useMemo(()=>o?{reference:f}:Re,[o,f])}function Pl(e,t){let n=null,r=null,o=!1;return{contextElement:e||void 0,getBoundingClientRect(){var p;const s=(e==null?void 0:e.getBoundingClientRect())||{width:0,height:0,x:0,y:0},i=t.axis==="x"||t.axis==="both",c=t.axis==="y"||t.axis==="both",u=["mouseenter","mousemove"].includes(((p=t.dataRef.current.openEvent)==null?void 0:p.type)||"")&&t.pointerType!=="touch";let a=s.width,d=s.height,l=s.x,g=s.y;return n==null&&t.x&&i&&(n=s.x-t.x),r==null&&t.y&&c&&(r=s.y-t.y),l-=n||0,g-=r||0,a=0,d=0,!o||u?(a=t.axis==="y"?s.width:0,d=t.axis==="x"?s.height:0,l=i&&t.x!=null?t.x:l,g=c&&t.y!=null?t.y:g):o&&!u&&(d=t.axis==="x"?s.height:d,a=t.axis==="y"?s.width:a),o=!0,{width:a,height:d,x:l,y:g,top:g,right:l+a,bottom:g+d,left:l}}}}function Co(e){return e!=null&&e.clientX!=null}function jl(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),i=n.context.dataRef,{enabled:c=!0,axis:u="both"}=t,a=b.useRef(!1),d=b.useRef(null),[l,g]=b.useState(),[p,f]=b.useState([]),h=W((y,T,S)=>{a.current||i.current.openEvent&&!Co(i.current.openEvent)||n.set("positionReference",Pl(S??s,{x:y,y:T,axis:u,dataRef:i,pointerType:l}))}),v=W(y=>{r?d.current||f([]):h(y.clientX,y.clientY,y.currentTarget)}),x=ft(l)?o:r,E=b.useCallback(()=>{if(!x||!c)return;const y=ve(o);function T(S){const C=Oe(S);ne(o,C)?(y.removeEventListener("mousemove",T),d.current=null):h(S.clientX,S.clientY)}if(!i.current.openEvent||Co(i.current.openEvent)){y.addEventListener("mousemove",T);const S=()=>{y.removeEventListener("mousemove",T),d.current=null};return d.current=S,S}n.set("positionReference",s)},[x,c,o,i,s,n,h]);b.useEffect(()=>E(),[E,p]),b.useEffect(()=>{c&&!o&&(a.current=!1)},[c,o]),b.useEffect(()=>{!c&&r&&(a.current=!0)},[c,r]);const w=b.useMemo(()=>{function y(T){g(T.pointerType)}return{onPointerDown:y,onPointerEnter:y,onMouseMove:v,onMouseEnter:v}},[v]);return b.useMemo(()=>c?{reference:w,trigger:w}:{},[c,w])}function Oo(e,t,n){let{reference:r,floating:o}=e;const s=Ae(t),i=Nr(t),c=Or(i),u=Ne(t),a=s==="y",d=r.x+r.width/2-o.width/2,l=r.y+r.height/2-o.height/2,g=r[c]/2-o[c]/2;let p;switch(u){case"top":p={x:d,y:r.y-o.height};break;case"bottom":p={x:d,y:r.y+r.height};break;case"right":p={x:r.x+r.width,y:l};break;case"left":p={x:r.x-o.width,y:l};break;default:p={x:r.x,y:r.y}}switch(ot(t)){case"start":p[i]-=g*(n&&a?-1:1);break;case"end":p[i]+=g*(n&&a?-1:1);break}return p}async function kl(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:c,strategy:u}=e,{boundary:a="clippingAncestors",rootBoundary:d="viewport",elementContext:l="floating",altBoundary:g=!1,padding:p=0}=Qe(t,e),f=Ps(p),v=c[g?l==="floating"?"reference":"floating":l],x=En(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(v)))==null||n?v:v.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(c.floating)),boundary:a,rootBoundary:d,strategy:u})),E=l==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c.floating)),y=await(s.isElement==null?void 0:s.isElement(w))?await(s.getScale==null?void 0:s.getScale(w))||{x:1,y:1}:{x:1,y:1},T=En(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:c,rect:E,offsetParent:w,strategy:u}):E);return{top:(x.top-T.top+f.top)/y.y,bottom:(T.bottom-x.bottom+f.bottom)/y.y,left:(x.left-T.left+f.left)/y.x,right:(T.right-x.right+f.right)/y.x}}const Ml=50,Dl=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,c=i.detectOverflow?i:{...i,detectOverflow:kl},u=await(i.isRTL==null?void 0:i.isRTL(t));let a=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:d,y:l}=Oo(a,r,u),g=r,p=0;const f={};for(let h=0;h<s.length;h++){const v=s[h];if(!v)continue;const{name:x,fn:E}=v,{x:w,y,data:T,reset:S}=await E({x:d,y:l,initialPlacement:r,placement:g,strategy:o,middlewareData:f,rects:a,platform:c,elements:{reference:e,floating:t}});d=w??d,l=y??l,f[x]={...f[x],...T},S&&p<Ml&&(p++,typeof S=="object"&&(S.placement&&(g=S.placement),S.rects&&(a=S.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):S.rects),{x:d,y:l}=Oo(a,g,u)),h=-1)}return{x:d,y:l,placement:g,strategy:o,middlewareData:f}},Al=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:c,platform:u,elements:a}=t,{mainAxis:d=!0,crossAxis:l=!0,fallbackPlacements:g,fallbackStrategy:p="bestFit",fallbackAxisSideDirection:f="none",flipAlignment:h=!0,...v}=Qe(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=Ne(o),E=Ae(c),w=Ne(c)===c,y=await(u.isRTL==null?void 0:u.isRTL(a.floating)),T=g||(w||!h?[yn(c)]:Ea(c)),S=f!=="none";!g&&S&&T.push(...Ta(c,h,f,y));const C=[c,...T],O=await u.detectOverflow(t,v),P=[];let _=((r=s.flip)==null?void 0:r.overflows)||[];if(d&&P.push(O[x]),l){const Y=ya(o,i,y);P.push(O[Y[0]],O[Y[1]])}if(_=[..._,{placement:o,overflows:P}],!P.every(Y=>Y<=0)){var j,R;const Y=(((j=s.flip)==null?void 0:j.index)||0)+1,D=C[Y];if(D&&(!(l==="alignment"?E!==Ae(D):!1)||_.every(I=>Ae(I.placement)===E?I.overflows[0]>0:!0)))return{data:{index:Y,overflows:_},reset:{placement:D}};let B=(R=_.filter(L=>L.overflows[0]<=0).sort((L,I)=>L.overflows[1]-I.overflows[1])[0])==null?void 0:R.placement;if(!B)switch(p){case"bestFit":{var N;const L=(N=_.filter(I=>{if(S){const A=Ae(I.placement);return A===E||A==="y"}return!0}).map(I=>[I.placement,I.overflows.filter(A=>A>0).reduce((A,H)=>A+H,0)]).sort((I,A)=>I[1]-A[1])[0])==null?void 0:N[0];L&&(B=L);break}case"initialPlacement":B=c;break}if(o!==B)return{reset:{placement:B}}}return{}}}};function No(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Io(e){return xa.some(t=>e[t]>=0)}const Ll=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n,platform:r}=t,{strategy:o="referenceHidden",...s}=Qe(e,t);switch(o){case"referenceHidden":{const i=await r.detectOverflow(t,{...s,elementContext:"reference"}),c=No(i,n.reference);return{data:{referenceHiddenOffsets:c,referenceHidden:Io(c)}}}case"escaped":{const i=await r.detectOverflow(t,{...s,altBoundary:!0}),c=No(i,n.floating);return{data:{escapedOffsets:c,escaped:Io(c)}}}default:return{}}}}},si=new Set(["left","top"]);async function _l(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ne(n),c=ot(n),u=Ae(n)==="y",a=si.has(i)?-1:1,d=s&&u?-1:1,l=Qe(t,e);let{mainAxis:g,crossAxis:p,alignmentAxis:f}=typeof l=="number"?{mainAxis:l,crossAxis:0,alignmentAxis:null}:{mainAxis:l.mainAxis||0,crossAxis:l.crossAxis||0,alignmentAxis:l.alignmentAxis};return c&&typeof f=="number"&&(p=c==="end"?f*-1:f),u?{x:p*d,y:g*a}:{x:g*a,y:p*d}}const Fl=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:c}=t,u=await _l(t,e);return i===((n=c.offset)==null?void 0:n.placement)&&(r=c.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:s+u.y,data:{...u,placement:i}}}}},Vl=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o,platform:s}=t,{mainAxis:i=!0,crossAxis:c=!1,limiter:u={fn:x=>{let{x:E,y:w}=x;return{x:E,y:w}}},...a}=Qe(e,t),d={x:n,y:r},l=await s.detectOverflow(t,a),g=Ae(Ne(o)),p=Cr(g);let f=d[p],h=d[g];if(i){const x=p==="y"?"top":"left",E=p==="y"?"bottom":"right",w=f+l[x],y=f-l[E];f=dr(w,f,y)}if(c){const x=g==="y"?"top":"left",E=g==="y"?"bottom":"right",w=h+l[x],y=h-l[E];h=dr(w,h,y)}const v=u.fn({...t,[p]:f,[g]:h});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[p]:i,[g]:c}}}}}},Bl=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:c=0,mainAxis:u=!0,crossAxis:a=!0}=Qe(e,t),d={x:n,y:r},l=Ae(o),g=Cr(l);let p=d[g],f=d[l];const h=Qe(c,t),v=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){const w=g==="y"?"height":"width",y=s.reference[g]-s.floating[w]+v.mainAxis,T=s.reference[g]+s.reference[w]-v.mainAxis;p<y?p=y:p>T&&(p=T)}if(a){var x,E;const w=g==="y"?"width":"height",y=si.has(Ne(o)),T=s.reference[l]-s.floating[w]+(y&&((x=i.offset)==null?void 0:x[l])||0)+(y?0:v.crossAxis),S=s.reference[l]+s.reference[w]+(y?0:((E=i.offset)==null?void 0:E[l])||0)-(y?v.crossAxis:0);f<T?f=T:f>S&&(f=S)}return{[g]:p,[l]:f}}}},$l=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:c}=t,{apply:u=()=>{},...a}=Qe(e,t),d=await i.detectOverflow(t,a),l=Ne(o),g=ot(o),p=Ae(o)==="y",{width:f,height:h}=s.floating;let v,x;l==="top"||l==="bottom"?(v=l,x=g===(await(i.isRTL==null?void 0:i.isRTL(c.floating))?"start":"end")?"left":"right"):(x=l,v=g==="end"?"top":"bottom");const E=h-d.top-d.bottom,w=f-d.left-d.right,y=Tt(h-d[v],E),T=Tt(f-d[x],w),S=!t.middlewareData.shift;let C=y,O=T;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=w),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=E),S&&!g){const _=ke(d.left,0),j=ke(d.right,0),R=ke(d.top,0),N=ke(d.bottom,0);p?O=f-2*(_!==0||j!==0?_+j:ke(d.left,d.right)):C=h-2*(R!==0||N!==0?R+N:ke(d.top,d.bottom))}await u({...t,availableWidth:O,availableHeight:C});const P=await i.getDimensions(c.floating);return f!==P.width||h!==P.height?{reset:{rects:!0}}:{}}}};function ii(e){const t=Me(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=be(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,c=vn(n)!==s||vn(r)!==i;return c&&(n=s,r=i),{width:n,height:r,$:c}}function Dr(e){return oe(e)?e:e.contextElement}function Et(e){const t=Dr(e);if(!be(t))return Ye(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=ii(t);let i=(s?vn(n.width):n.width)/r,c=(s?vn(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!c||!Number.isFinite(c))&&(c=1),{x:i,y:c}}const Hl=Ye(0);function ci(e){const t=ve(e);return!Pn()||!t.visualViewport?Hl:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function zl(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==ve(e)?!1:t}function pt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Dr(e);let i=Ye(1);t&&(r?oe(r)&&(i=Et(r)):i=Et(e));const c=zl(s,n,r)?ci(s):Ye(0);let u=(o.left+c.x)/i.x,a=(o.top+c.y)/i.y,d=o.width/i.x,l=o.height/i.y;if(s){const g=ve(s),p=r&&oe(r)?ve(r):r;let f=g,h=cr(f);for(;h&&r&&p!==f;){const v=Et(h),x=h.getBoundingClientRect(),E=Me(h),w=x.left+(h.clientLeft+parseFloat(E.paddingLeft))*v.x,y=x.top+(h.clientTop+parseFloat(E.paddingTop))*v.y;u*=v.x,a*=v.y,d*=v.x,l*=v.y,u+=w,a+=y,f=ve(h),h=cr(f)}}return En({width:d,height:l,x:u,y:a})}function An(e,t){const n=jn(e).scrollLeft;return t?t.left+n:pt(Ge(e)).left+n}function ai(e,t){const n=e.getBoundingClientRect(),r=n.left+t.scrollLeft-An(e,n),o=n.top+t.scrollTop;return{x:r,y:o}}function Wl(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=Ge(r),c=t?In(t.floating):!1;if(r===i||c&&s)return n;let u={scrollLeft:0,scrollTop:0},a=Ye(1);const d=Ye(0),l=be(r);if((l||!l&&!s)&&((nt(r)!=="body"||rt(i))&&(u=jn(r)),l)){const p=pt(r);a=Et(r),d.x=p.x+r.clientLeft,d.y=p.y+r.clientTop}const g=i&&!l&&!s?ai(i,u):Ye(0);return{width:n.width*a.x,height:n.height*a.y,x:n.x*a.x-u.scrollLeft*a.x+d.x+g.x,y:n.y*a.y-u.scrollTop*a.y+d.y+g.y}}function Ul(e){return Array.from(e.getClientRects())}function Yl(e){const t=Ge(e),n=jn(e),r=e.ownerDocument.body,o=ke(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=ke(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+An(e);const c=-n.scrollTop;return Me(r).direction==="rtl"&&(i+=ke(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:c}}const Po=25;function Kl(e,t){const n=ve(e),r=Ge(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,c=0,u=0;if(o){s=o.width,i=o.height;const d=Pn();(!d||d&&t==="fixed")&&(c=o.offsetLeft,u=o.offsetTop)}const a=An(r);if(a<=0){const d=r.ownerDocument,l=d.body,g=getComputedStyle(l),p=d.compatMode==="CSS1Compat"&&parseFloat(g.marginLeft)+parseFloat(g.marginRight)||0,f=Math.abs(r.clientWidth-l.clientWidth-p);f<=Po&&(s-=f)}else a<=Po&&(s+=a);return{width:s,height:i,x:c,y:u}}function Gl(e,t){const n=pt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=be(e)?Et(e):Ye(1),i=e.clientWidth*s.x,c=e.clientHeight*s.y,u=o*s.x,a=r*s.y;return{width:i,height:c,x:u,y:a}}function jo(e,t,n){let r;if(t==="viewport")r=Kl(e,n);else if(t==="document")r=Yl(Ge(e));else if(oe(t))r=Gl(t,n);else{const o=ci(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return En(r)}function li(e,t){const n=Je(e);return n===t||!oe(n)||Ze(n)?!1:Me(n).position==="fixed"||li(n,t)}function Xl(e,t){const n=t.get(e);if(n)return n;let r=tt(e,[],!1).filter(c=>oe(c)&&nt(c)!=="body"),o=null;const s=Me(e).position==="fixed";let i=s?Je(e):e;for(;oe(i)&&!Ze(i);){const c=Me(i),u=Tr(i);!u&&c.position==="fixed"&&(o=null),(s?!u&&!o:!u&&c.position==="static"&&!!o&&(o.position==="absolute"||o.position==="fixed")||rt(i)&&!u&&li(e,i))?r=r.filter(d=>d!==i):o=c,i=Je(i)}return t.set(e,r),r}function ql(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?In(t)?[]:Xl(t,this._c):[].concat(n),r],c=jo(t,i[0],o);let u=c.top,a=c.right,d=c.bottom,l=c.left;for(let g=1;g<i.length;g++){const p=jo(t,i[g],o);u=ke(p.top,u),a=Tt(p.right,a),d=Tt(p.bottom,d),l=ke(p.left,l)}return{width:a-l,height:d-u,x:l,y:u}}function Zl(e){const{width:t,height:n}=ii(e);return{width:t,height:n}}function Jl(e,t,n){const r=be(t),o=Ge(t),s=n==="fixed",i=pt(e,!0,s,t);let c={scrollLeft:0,scrollTop:0};const u=Ye(0);function a(){u.x=An(o)}if(r||!r&&!s)if((nt(t)!=="body"||rt(o))&&(c=jn(t)),r){const p=pt(t,!0,s,t);u.x=p.x+t.clientLeft,u.y=p.y+t.clientTop}else o&&a();s&&!r&&o&&a();const d=o&&!r&&!s?ai(o,c):Ye(0),l=i.left+c.scrollLeft-u.x-d.x,g=i.top+c.scrollTop-u.y-d.y;return{x:l,y:g,width:i.width,height:i.height}}function qn(e){return Me(e).position==="static"}function ko(e,t){if(!be(e)||Me(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ge(e)===n&&(n=n.ownerDocument.body),n}function ui(e,t){const n=ve(e);if(In(e))return n;if(!be(e)){let o=Je(e);for(;o&&!Ze(o);){if(oe(o)&&!qn(o))return o;o=Je(o)}return n}let r=ko(e,t);for(;r&&Qc(r)&&qn(r);)r=ko(r,t);return r&&Ze(r)&&qn(r)&&!Tr(r)?n:r||na(e)||n}const Ql=async function(e){const t=this.getOffsetParent||ui,n=this.getDimensions,r=await n(e.floating);return{reference:Jl(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function eu(e){return Me(e).direction==="rtl"}const tu={convertOffsetParentRelativeRectToViewportRelativeRect:Wl,getDocumentElement:Ge,getClippingRect:ql,getOffsetParent:ui,getElementRects:Ql,getClientRects:Ul,getDimensions:Zl,getScale:Et,isElement:oe,isRTL:eu};function di(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function nu(e,t){let n=null,r;const o=Ge(e);function s(){var c;clearTimeout(r),(c=n)==null||c.disconnect(),n=null}function i(c,u){c===void 0&&(c=!1),u===void 0&&(u=1),s();const a=e.getBoundingClientRect(),{left:d,top:l,width:g,height:p}=a;if(c||t(),!g||!p)return;const f=vt(l),h=vt(o.clientWidth-(d+g)),v=vt(o.clientHeight-(l+p)),x=vt(d),w={rootMargin:-f+"px "+-h+"px "+-v+"px "+-x+"px",threshold:ke(0,Tt(1,u))||1};let y=!0;function T(S){const C=S[0].intersectionRatio;if(C!==u){if(!y)return i();C?i(!1,C):r=setTimeout(()=>{i(!1,1e-7)},1e3)}C===1&&!di(a,e.getBoundingClientRect())&&i(),y=!1}try{n=new IntersectionObserver(T,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(T,w)}n.observe(e)}return i(!0),s}function Mo(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:c=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,a=Dr(e),d=o||s?[...a?tt(a):[],...t?tt(t):[]]:[];d.forEach(x=>{o&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const l=a&&c?nu(a,n):null;let g=-1,p=null;i&&(p=new ResizeObserver(x=>{let[E]=x;E&&E.target===a&&p&&t&&(p.unobserve(t),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var w;(w=p)==null||w.observe(t)})),n()}),a&&!u&&p.observe(a),t&&p.observe(t));let f,h=u?pt(e):null;u&&v();function v(){const x=pt(e);h&&!di(h,x)&&n(),h=x,f=requestAnimationFrame(v)}return n(),()=>{var x;d.forEach(E=>{o&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),l==null||l(),(x=p)==null||x.disconnect(),p=null,u&&cancelAnimationFrame(f)}}const ru=Fl,ou=Vl,su=Al,iu=$l,cu=Ll,au=Bl,lu=(e,t,n)=>{const r=new Map,o={platform:tu,...n},s={...o.platform,_c:r};return Dl(e,t,{...o,platform:s})};var uu=typeof document<"u",du=function(){},hn=uu?re.useLayoutEffect:du;function Cn(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,o;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(!Cn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!Cn(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function fi(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Do(e,t){const n=fi(e);return Math.round(t*n)/n}function Zn(e){const t=b.useRef(e);return hn(()=>{t.current=e}),t}function fu(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:c=!0,whileElementsMounted:u,open:a}=e,[d,l]=b.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[g,p]=b.useState(r);Cn(g,r)||p(r);const[f,h]=b.useState(null),[v,x]=b.useState(null),E=b.useCallback(I=>{I!==S.current&&(S.current=I,h(I))},[]),w=b.useCallback(I=>{I!==C.current&&(C.current=I,x(I))},[]),y=s||f,T=i||v,S=b.useRef(null),C=b.useRef(null),O=b.useRef(d),P=u!=null,_=Zn(u),j=Zn(o),R=Zn(a),N=b.useCallback(()=>{if(!S.current||!C.current)return;const I={placement:t,strategy:n,middleware:g};j.current&&(I.platform=j.current),lu(S.current,C.current,I).then(A=>{const H={...A,isPositioned:R.current!==!1};Y.current&&!Cn(O.current,H)&&(O.current=H,gt.flushSync(()=>{l(H)}))})},[g,t,n,j,R]);hn(()=>{a===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,l(I=>({...I,isPositioned:!1})))},[a]);const Y=b.useRef(!1);hn(()=>(Y.current=!0,()=>{Y.current=!1}),[]),hn(()=>{if(y&&(S.current=y),T&&(C.current=T),y&&T){if(_.current)return _.current(y,T,N);N()}},[y,T,N,_,P]);const D=b.useMemo(()=>({reference:S,floating:C,setReference:E,setFloating:w}),[E,w]),B=b.useMemo(()=>({reference:y,floating:T}),[y,T]),L=b.useMemo(()=>{const I={position:n,left:0,top:0};if(!B.floating)return I;const A=Do(B.floating,d.x),H=Do(B.floating,d.y);return c?{...I,transform:"translate("+A+"px, "+H+"px)",...fi(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:A,top:H}},[n,c,B.floating,d.x,d.y]);return b.useMemo(()=>({...d,update:N,refs:D,elements:B,floatingStyles:L}),[d,N,D,B,L])}const pu=(e,t)=>{const n=ru(e);return{name:n.name,fn:n.fn,options:[e,t]}},gu=(e,t)=>{const n=ou(e);return{name:n.name,fn:n.fn,options:[e,t]}},mu=(e,t)=>({fn:au(e).fn,options:[e,t]}),hu=(e,t)=>{const n=su(e);return{name:n.name,fn:n.fn,options:[e,t]}},bu=(e,t)=>{const n=iu(e);return{name:n.name,fn:n.fn,options:[e,t]}},xu=(e,t)=>{const n=cu(e);return{name:n.name,fn:n.fn,options:[e,t]}},vu={intentional:"onClick",sloppy:"onPointerDown"};function yu(e){return{escapeKey:typeof e=="boolean"?e:(e==null?void 0:e.escapeKey)??!1,outsidePress:typeof e=="boolean"?e:(e==null?void 0:e.outsidePress)??!0}}function pi(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("referenceElement"),i=n.useState("domReferenceElement"),{onOpenChange:c,dataRef:u}=n.context,{enabled:a=!0,escapeKey:d=!0,outsidePress:l=!0,outsidePressEvent:g="sloppy",referencePress:p=!1,referencePressEvent:f="sloppy",ancestorScroll:h=!1,bubbles:v,externalTree:x}=t,E=Kt(x),w=W(typeof l=="function"?l:()=>!1),y=typeof l=="function"?w:l,T=b.useRef(!1),{escapeKey:S,outsidePress:C}=yu(v),O=b.useRef(null),P=Rt(),_=Rt(),j=W(()=>{_.clear(),u.current.insideReactTree=!1}),R=b.useRef(!1),N=b.useRef(""),Y=W(k=>{N.current=k.pointerType}),D=W(()=>{const k=N.current,M=k==="pen"||!k?"mouse":k,F=typeof g=="function"?g():g;return typeof F=="string"?F:F[M]}),B=W(k=>{var Z;if(!r||!a||!d||k.key!=="Escape"||R.current)return;const M=(Z=u.current.floatingContext)==null?void 0:Z.nodeId,F=E?ut(E.nodesRef.current,M):[];if(!S&&F.length>0){let $=!0;if(F.forEach(te=>{var ie;(ie=te.context)!=null&&ie.open&&!te.context.dataRef.current.__escapeKeyBubbles&&($=!1)}),!$)return}const X=ma(k)?k.nativeEvent:k,z=ae(Ir,X);n.setOpen(!1,z),!S&&!z.isPropagationAllowed&&k.stopPropagation()}),L=W(k=>{const M=D();return M==="intentional"&&k.type!=="click"||M==="sloppy"&&k.type==="click"}),I=W(()=>{u.current.insideReactTree=!0,_.start(0,j)}),A=W((k,M=!1)=>{var Te;if(L(k)){j();return}if(u.current.insideReactTree){j();return}if(D()==="intentional"&&M||typeof y=="function"&&!y(k))return;const F=Oe(k),X=`[${Ot("inert")}]`,z=ce(n.select("floatingElement")).querySelectorAll(X),Z=n.context.triggerElements;if(F&&(Z.hasElement(F)||Z.hasMatchingElement(ge=>ne(ge,F))))return;let $=oe(F)?F:null;for(;$&&!Ze($);){const ge=Je($);if(Ze(ge)||!oe(ge))break;$=ge}if(z.length&&oe(F)&&!pa(F)&&!ne(F,n.select("floatingElement"))&&Array.from(z).every(ge=>!ne($,ge)))return;if(be(F)&&!("touches"in k)){const ge=Ze(F),xe=Me(F),Fe=/auto|scroll/,ht=ge||Fe.test(xe.overflowX),bt=ge||Fe.test(xe.overflowY),we=ht&&F.clientWidth>0&&F.scrollWidth>F.clientWidth,Ce=bt&&F.clientHeight>0&&F.scrollHeight>F.clientHeight,Se=xe.direction==="rtl",$e=Ce&&(Se?k.offsetX<=F.offsetWidth-F.clientWidth:k.offsetX>F.clientWidth),Zt=we&&k.offsetY>F.clientHeight;if($e||Zt)return}const te=(Te=u.current.floatingContext)==null?void 0:Te.nodeId,ie=E&&ut(E.nodesRef.current,te).some(ge=>{var xe;return Ve(k,(xe=ge.context)==null?void 0:xe.elements.floating)});if(Ve(k,n.select("floatingElement"))||Ve(k,n.select("domReferenceElement"))||ie)return;const q=E?ut(E.nodesRef.current,te):[];if(q.length>0){let ge=!0;if(q.forEach(xe=>{var Fe;(Fe=xe.context)!=null&&Fe.open&&!xe.context.dataRef.current.__outsidePressBubbles&&(ge=!1)}),!ge)return}n.setOpen(!1,ae(Us,k)),j()}),H=W(k=>{D()!=="sloppy"||k.pointerType==="touch"||!n.select("open")||!a||Ve(k,n.select("floatingElement"))||Ve(k,n.select("domReferenceElement"))||A(k)}),le=W(k=>{if(D()!=="sloppy"||!n.select("open")||!a||Ve(k,n.select("floatingElement"))||Ve(k,n.select("domReferenceElement")))return;const M=k.touches[0];M&&(O.current={startTime:Date.now(),startX:M.clientX,startY:M.clientY,dismissOnTouchEnd:!1,dismissOnMouseDown:!0},P.start(1e3,()=>{O.current&&(O.current.dismissOnTouchEnd=!1,O.current.dismissOnMouseDown=!1)}))}),fe=W(k=>{const M=Oe(k);function F(){le(k),M==null||M.removeEventListener(k.type,F)}M==null||M.addEventListener(k.type,F)}),se=W(k=>{const M=T.current;if(T.current=!1,P.clear(),k.type==="mousedown"&&O.current&&!O.current.dismissOnMouseDown)return;const F=Oe(k);function X(){k.type==="pointerdown"?H(k):A(k,M),F==null||F.removeEventListener(k.type,X)}F==null||F.addEventListener(k.type,X)}),pe=W(k=>{if(D()!=="sloppy"||!O.current||Ve(k,n.select("floatingElement"))||Ve(k,n.select("domReferenceElement")))return;const M=k.touches[0];if(!M)return;const F=Math.abs(M.clientX-O.current.startX),X=Math.abs(M.clientY-O.current.startY),z=Math.sqrt(F*F+X*X);z>5&&(O.current.dismissOnTouchEnd=!0),z>10&&(A(k),P.clear(),O.current=null)}),ye=W(k=>{const M=Oe(k);function F(){pe(k),M==null||M.removeEventListener(k.type,F)}M==null||M.addEventListener(k.type,F)}),ee=W(k=>{D()!=="sloppy"||!O.current||Ve(k,n.select("floatingElement"))||Ve(k,n.select("domReferenceElement"))||(O.current.dismissOnTouchEnd&&A(k),P.clear(),O.current=null)}),J=W(k=>{const M=Oe(k);function F(){ee(k),M==null||M.removeEventListener(k.type,F)}M==null||M.addEventListener(k.type,F)});b.useEffect(()=>{if(!r||!a)return;u.current.__escapeKeyBubbles=S,u.current.__outsidePressBubbles=C;const k=new Ke;function M($){n.setOpen(!1,ae(Ft,$))}function F(){k.clear(),R.current=!0}function X(){k.start(Pn()?5:0,()=>{R.current=!1})}const z=ce(o);z.addEventListener("pointerdown",Y,!0),d&&(z.addEventListener("keydown",B),z.addEventListener("compositionstart",F),z.addEventListener("compositionend",X)),y&&(z.addEventListener("click",se,!0),z.addEventListener("pointerdown",se,!0),z.addEventListener("touchstart",fe,!0),z.addEventListener("touchmove",ye,!0),z.addEventListener("touchend",J,!0),z.addEventListener("mousedown",se,!0));let Z=[];return h&&(oe(i)&&(Z=tt(i)),oe(o)&&(Z=Z.concat(tt(o))),!oe(s)&&s&&s.contextElement&&(Z=Z.concat(tt(s.contextElement)))),Z=Z.filter($=>{var te;return $!==((te=z.defaultView)==null?void 0:te.visualViewport)}),Z.forEach($=>{$.addEventListener("scroll",M,{passive:!0})}),()=>{z.removeEventListener("pointerdown",Y,!0),d&&(z.removeEventListener("keydown",B),z.removeEventListener("compositionstart",F),z.removeEventListener("compositionend",X)),y&&(z.removeEventListener("click",se,!0),z.removeEventListener("pointerdown",se,!0),z.removeEventListener("touchstart",fe,!0),z.removeEventListener("touchmove",ye,!0),z.removeEventListener("touchend",J,!0),z.removeEventListener("mousedown",se,!0)),Z.forEach($=>{$.removeEventListener("scroll",M)}),k.clear(),T.current=!1}},[u,o,s,i,d,y,r,c,h,a,S,C,B,A,se,H,fe,ye,J,Y,n]),b.useEffect(j,[y,j]);const me=b.useMemo(()=>({onKeyDown:B,...p&&{[vu[f]]:k=>{n.setOpen(!1,ae(Vt,k.nativeEvent))},...f!=="intentional"&&{onClick(k){n.setOpen(!1,ae(Vt,k.nativeEvent))}}}}),[B,n,p,f]),K=W(k=>{const M=Oe(k.nativeEvent);!ne(n.select("floatingElement"),M)||k.button!==0||(T.current=!0)}),he=W(k=>{!r||!a||k.button!==0||(T.current=!0)}),_e=b.useMemo(()=>({onKeyDown:B,onPointerDown:K,onMouseDown:K,onMouseUp:K,onClickCapture:I,onMouseDownCapture(k){I(),he(k)},onPointerDownCapture(k){I(),he(k)},onMouseUpCapture:I,onTouchEndCapture:I,onTouchMoveCapture:I}),[B,K,I,he]);return b.useMemo(()=>a?{reference:me,floating:_e,trigger:me}:{},[a,me,_e])}var Eu=(e,t,n)=>{if(t.length===1&&t[0]===n){let r=!1;try{const o={};e(o)===o&&(r=!0)}catch{}if(r){let o;try{throw new Error}catch(s){({stack:o}=s)}console.warn(`The result function returned its own inputs without modification. e.g
|
|
6
|
-
\`createSelector([state => state.todos], todos => todos)\`
|
|
7
|
-
This could lead to inefficient memoization and unnecessary re-renders.
|
|
8
|
-
Ensure transformation logic is in the result function, and extraction logic is in the input selectors.`,{stack:o})}}},wu=(e,t,n)=>{const{memoize:r,memoizeOptions:o}=t,{inputSelectorResults:s,inputSelectorResultsCopy:i}=e,c=r(()=>({}),...o);if(!(c.apply(null,s)===c.apply(null,i))){let a;try{throw new Error}catch(d){({stack:a}=d)}console.warn(`An input selector returned a different result when passed same arguments.
|
|
9
|
-
This means your output selector will likely run more frequently than intended.
|
|
10
|
-
Avoid returning a new reference inside your input selector, e.g.
|
|
11
|
-
\`createSelector([state => state.todos.map(todo => todo.id)], todoIds => todoIds.length)\``,{arguments:n,firstInputs:s,secondInputs:i,stack:a})}},Su={inputStabilityCheck:"once",identityFunctionCheck:"once"},On=Symbol("NOT_FOUND");function Ru(e,t=`expected a function, instead received ${typeof e}`){if(typeof e!="function")throw new TypeError(t)}function Tu(e,t=`expected an object, instead received ${typeof e}`){if(typeof e!="object")throw new TypeError(t)}function Cu(e,t="expected all items to be functions, instead received the following types: "){if(!e.every(n=>typeof n=="function")){const n=e.map(r=>typeof r=="function"?`function ${r.name||"unnamed"}()`:typeof r).join(", ");throw new TypeError(`${t}[${n}]`)}}var Ao=e=>Array.isArray(e)?e:[e];function Ou(e){const t=Array.isArray(e[0])?e[0]:e;return Cu(t,"createSelector expects all input-selectors to be functions, but received the following types: "),t}function Lo(e,t){const n=[],{length:r}=e;for(let o=0;o<r;o++)n.push(e[o].apply(null,t));return n}var Nu=(e,t)=>{const{identityFunctionCheck:n,inputStabilityCheck:r}={...Su,...t};return{identityFunctionCheck:{shouldRun:n==="always"||n==="once"&&e,run:Eu},inputStabilityCheck:{shouldRun:r==="always"||r==="once"&&e,run:wu}}};function Iu(e){let t;return{get(n){return t&&e(t.key,n)?t.value:On},put(n,r){t={key:n,value:r}},getEntries(){return t?[t]:[]},clear(){t=void 0}}}function Pu(e,t){let n=[];function r(c){const u=n.findIndex(a=>t(c,a.key));if(u>-1){const a=n[u];return u>0&&(n.splice(u,1),n.unshift(a)),a.value}return On}function o(c,u){r(c)===On&&(n.unshift({key:c,value:u}),n.length>e&&n.pop())}function s(){return n}function i(){n=[]}return{get:r,put:o,getEntries:s,clear:i}}var ju=(e,t)=>e===t;function ku(e){return function(n,r){if(n===null||r===null||n.length!==r.length)return!1;const{length:o}=n;for(let s=0;s<o;s++)if(!e(n[s],r[s]))return!1;return!0}}function Mu(e,t){const n=typeof t=="object"?t:{equalityCheck:t},{equalityCheck:r=ju,maxSize:o=1,resultEqualityCheck:s}=n,i=ku(r);let c=0;const u=o<=1?Iu(i):Pu(o,i);function a(){let d=u.get(arguments);if(d===On){if(d=e.apply(null,arguments),c++,s){const g=u.getEntries().find(p=>s(p.value,d));g&&(d=g.value,c!==0&&c--)}u.put(arguments,d)}return d}return a.clearCache=()=>{u.clear(),a.resetResultsCount()},a.resultsCount=()=>c,a.resetResultsCount=()=>{c=0},a}var Du=class{constructor(e){this.value=e}deref(){return this.value}},Au=typeof WeakRef<"u"?WeakRef:Du,Lu=0,_o=1;function sn(){return{s:Lu,v:void 0,o:null,p:null}}function gi(e,t={}){let n=sn();const{resultEqualityCheck:r}=t;let o,s=0;function i(){var l;let c=n;const{length:u}=arguments;for(let g=0,p=u;g<p;g++){const f=arguments[g];if(typeof f=="function"||typeof f=="object"&&f!==null){let h=c.o;h===null&&(c.o=h=new WeakMap);const v=h.get(f);v===void 0?(c=sn(),h.set(f,c)):c=v}else{let h=c.p;h===null&&(c.p=h=new Map);const v=h.get(f);v===void 0?(c=sn(),h.set(f,c)):c=v}}const a=c;let d;if(c.s===_o)d=c.v;else if(d=e.apply(null,arguments),s++,r){const g=((l=o==null?void 0:o.deref)==null?void 0:l.call(o))??o;g!=null&&r(g,d)&&(d=g,s!==0&&s--),o=typeof d=="object"&&d!==null||typeof d=="function"?new Au(d):d}return a.s=_o,a.v=d,d}return i.clearCache=()=>{n=sn(),i.resetResultsCount()},i.resultsCount=()=>s,i.resetResultsCount=()=>{s=0},i}function mi(e,...t){const n=typeof e=="function"?{memoize:e,memoizeOptions:t}:e,r=(...o)=>{let s=0,i=0,c,u={},a=o.pop();typeof a=="object"&&(u=a,a=o.pop()),Ru(a,`createSelector expects an output function after the inputs, but received: [${typeof a}]`);const d={...n,...u},{memoize:l,memoizeOptions:g=[],argsMemoize:p=gi,argsMemoizeOptions:f=[],devModeChecks:h={}}=d,v=Ao(g),x=Ao(f),E=Ou(o),w=l(function(){return s++,a.apply(null,arguments)},...v);let y=!0;const T=p(function(){i++;const C=Lo(E,arguments);if(c=w.apply(null,C),process.env.NODE_ENV!=="production"){const{identityFunctionCheck:O,inputStabilityCheck:P}=Nu(y,h);if(O.shouldRun&&O.run(a,C,c),P.shouldRun){const _=Lo(E,arguments);P.run({inputSelectorResults:C,inputSelectorResultsCopy:_},{memoize:l,memoizeOptions:v},arguments)}y&&(y=!1)}return c},...x);return Object.assign(T,{resultFunc:a,memoizedResultFunc:w,dependencies:E,dependencyRecomputations:()=>i,resetDependencyRecomputations:()=>{i=0},lastResult:()=>c,recomputations:()=>s,resetRecomputations:()=>{s=0},memoize:l,argsMemoize:p})};return Object.assign(r,{withTypes:()=>r}),r}var _u=mi(gi),Fu=Object.assign((e,t=_u)=>{Tu(e,`createStructuredSelector expects first argument to be an object where each property is a selector, instead received a ${typeof e}`);const n=Object.keys(e),r=n.map(s=>e[s]);return t(r,(...s)=>s.reduce((i,c,u)=>(i[n[u]]=c,i),{}))},{withTypes:()=>Fu});mi({memoize:Mu,memoizeOptions:{maxSize:1,equalityCheck:Object.is}});const Q=(e,t,n,r,o,s,...i)=>{if(i.length>0)throw new Error(process.env.NODE_ENV!=="production"?"Unsupported number of selectors":Le(1));let c;if(e)c=e;else throw new Error("Missing arguments");return c};var cn={exports:{}},Jn={};/**
|
|
12
|
-
* @license React
|
|
13
|
-
* use-sync-external-store-shim.production.js
|
|
14
|
-
*
|
|
15
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
16
|
-
*
|
|
17
|
-
* This source code is licensed under the MIT license found in the
|
|
18
|
-
* LICENSE file in the root directory of this source tree.
|
|
19
|
-
*/var Fo;function Vu(){if(Fo)return Jn;Fo=1;var e=re;function t(l,g){return l===g&&(l!==0||1/l===1/g)||l!==l&&g!==g}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,i=e.useDebugValue;function c(l,g){var p=g(),f=r({inst:{value:p,getSnapshot:g}}),h=f[0].inst,v=f[1];return s(function(){h.value=p,h.getSnapshot=g,u(h)&&v({inst:h})},[l,p,g]),o(function(){return u(h)&&v({inst:h}),l(function(){u(h)&&v({inst:h})})},[l]),i(p),p}function u(l){var g=l.getSnapshot;l=l.value;try{var p=g();return!n(l,p)}catch{return!0}}function a(l,g){return g()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?a:c;return Jn.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Jn}var Qn={};/**
|
|
20
|
-
* @license React
|
|
21
|
-
* use-sync-external-store-shim.development.js
|
|
22
|
-
*
|
|
23
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
24
|
-
*
|
|
25
|
-
* This source code is licensed under the MIT license found in the
|
|
26
|
-
* LICENSE file in the root directory of this source tree.
|
|
27
|
-
*/var Vo;function Bu(){return Vo||(Vo=1,process.env.NODE_ENV!=="production"&&(function(){function e(p,f){return p===f&&(p!==0||1/p===1/f)||p!==p&&f!==f}function t(p,f){d||o.startTransition===void 0||(d=!0,console.error("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var h=f();if(!l){var v=f();s(h,v)||(console.error("The result of getSnapshot should be cached to avoid an infinite loop"),l=!0)}v=i({inst:{value:h,getSnapshot:f}});var x=v[0].inst,E=v[1];return u(function(){x.value=h,x.getSnapshot=f,n(x)&&E({inst:x})},[p,h,f]),c(function(){return n(x)&&E({inst:x}),p(function(){n(x)&&E({inst:x})})},[p]),a(h),h}function n(p){var f=p.getSnapshot;p=p.value;try{var h=f();return!s(p,h)}catch{return!0}}function r(p,f){return f()}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var o=re,s=typeof Object.is=="function"?Object.is:e,i=o.useState,c=o.useEffect,u=o.useLayoutEffect,a=o.useDebugValue,d=!1,l=!1,g=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:t;Qn.useSyncExternalStore=o.useSyncExternalStore!==void 0?o.useSyncExternalStore:g,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),Qn}var Bo;function Ar(){return Bo||(Bo=1,process.env.NODE_ENV==="production"?cn.exports=Vu():cn.exports=Bu()),cn.exports}var hi=Ar(),an={exports:{}},er={};/**
|
|
28
|
-
* @license React
|
|
29
|
-
* use-sync-external-store-shim/with-selector.production.js
|
|
30
|
-
*
|
|
31
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
32
|
-
*
|
|
33
|
-
* This source code is licensed under the MIT license found in the
|
|
34
|
-
* LICENSE file in the root directory of this source tree.
|
|
35
|
-
*/var $o;function $u(){if($o)return er;$o=1;var e=re,t=Ar();function n(a,d){return a===d&&(a!==0||1/a===1/d)||a!==a&&d!==d}var r=typeof Object.is=="function"?Object.is:n,o=t.useSyncExternalStore,s=e.useRef,i=e.useEffect,c=e.useMemo,u=e.useDebugValue;return er.useSyncExternalStoreWithSelector=function(a,d,l,g,p){var f=s(null);if(f.current===null){var h={hasValue:!1,value:null};f.current=h}else h=f.current;f=c(function(){function x(S){if(!E){if(E=!0,w=S,S=g(S),p!==void 0&&h.hasValue){var C=h.value;if(p(C,S))return y=C}return y=S}if(C=y,r(w,S))return C;var O=g(S);return p!==void 0&&p(C,O)?(w=S,C):(w=S,y=O)}var E=!1,w,y,T=l===void 0?null:l;return[function(){return x(d())},T===null?void 0:function(){return x(T())}]},[d,l,g,p]);var v=o(a,f[0],f[1]);return i(function(){h.hasValue=!0,h.value=v},[v]),u(v),v},er}var tr={};/**
|
|
36
|
-
* @license React
|
|
37
|
-
* use-sync-external-store-shim/with-selector.development.js
|
|
38
|
-
*
|
|
39
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
40
|
-
*
|
|
41
|
-
* This source code is licensed under the MIT license found in the
|
|
42
|
-
* LICENSE file in the root directory of this source tree.
|
|
43
|
-
*/var Ho;function Hu(){return Ho||(Ho=1,process.env.NODE_ENV!=="production"&&(function(){function e(a,d){return a===d&&(a!==0||1/a===1/d)||a!==a&&d!==d}typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(Error());var t=re,n=Ar(),r=typeof Object.is=="function"?Object.is:e,o=n.useSyncExternalStore,s=t.useRef,i=t.useEffect,c=t.useMemo,u=t.useDebugValue;tr.useSyncExternalStoreWithSelector=function(a,d,l,g,p){var f=s(null);if(f.current===null){var h={hasValue:!1,value:null};f.current=h}else h=f.current;f=c(function(){function x(S){if(!E){if(E=!0,w=S,S=g(S),p!==void 0&&h.hasValue){var C=h.value;if(p(C,S))return y=C}return y=S}if(C=y,r(w,S))return C;var O=g(S);return p!==void 0&&p(C,O)?(w=S,C):(w=S,y=O)}var E=!1,w,y,T=l===void 0?null:l;return[function(){return x(d())},T===null?void 0:function(){return x(T())}]},[d,l,g,p]);var v=o(a,f[0],f[1]);return i(function(){h.hasValue=!0,h.value=v},[v]),u(v),v},typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(Error())})()),tr}var zo;function zu(){return zo||(zo=1,process.env.NODE_ENV==="production"?an.exports=$u():an.exports=Hu()),an.exports}var Wu=zu();const Uu=jr(19),Yu=Uu?Gu:Xu;function bi(e,t,n,r,o){return Yu(e,t,n,r,o)}function Ku(e,t,n,r,o){const s=b.useCallback(()=>t(e.getSnapshot(),n,r,o),[e,t,n,r,o]);return hi.useSyncExternalStore(e.subscribe,s,s)}Gc({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){const r=e.syncHooks[n],o=r.selector(r.store.state,r.a1,r.a2,r.a3);(r.didChange||!Object.is(r.value,o))&&(t=!0,r.value=o,r.didChange=!1)}return t&&(e.syncTick+=1),e.syncTick})},after(e){e.syncHooks.length>0&&(e.didChangeStore&&(e.didChangeStore=!1,e.subscribe=t=>{const n=new Set;for(const o of e.syncHooks)n.add(o.store);const r=[];for(const o of n)r.push(o.subscribe(t));return()=>{for(const o of r)o()}}),hi.useSyncExternalStore(e.subscribe,e.getSnapshot,e.getSnapshot))}});function Gu(e,t,n,r,o){const s=Kc();if(!s)return Ku(e,t,n,r,o);const i=s.syncIndex;s.syncIndex+=1;let c;return s.didInitialize?(c=s.syncHooks[i],(c.store!==e||c.selector!==t||!Object.is(c.a1,n)||!Object.is(c.a2,r)||!Object.is(c.a3,o))&&(c.store!==e&&(s.didChangeStore=!0),c.store=e,c.selector=t,c.a1=n,c.a2=r,c.a3=o,c.didChange=!0)):(c={store:e,selector:t,a1:n,a2:r,a3:o,value:t(e.getSnapshot(),n,r,o),didChange:!1},s.syncHooks.push(c)),c.value}function Xu(e,t,n,r,o){return Wu.useSyncExternalStoreWithSelector(e.subscribe,e.getSnapshot,e.getSnapshot,s=>t(s,n,r,o))}class qu{constructor(t){de(this,"subscribe",t=>(this.listeners.add(t),()=>{this.listeners.delete(t)}));de(this,"getSnapshot",()=>this.state);this.state=t,this.listeners=new Set,this.updateTick=0}setState(t){if(this.state===t)return;this.state=t,this.updateTick+=1;const n=this.updateTick;for(const r of this.listeners){if(n!==this.updateTick)return;r(t)}}update(t){for(const n in t)if(!Object.is(this.state[n],t[n])){this.setState({...this.state,...t});return}}set(t,n){Object.is(this.state[t],n)||this.setState({...this.state,[t]:n})}notifyAll(){const t={...this.state};this.setState(t)}use(t,n,r,o){return bi(this,t,n,r,o)}}class Lr extends qu{constructor(t,n={},r){super(t),this.context=n,this.selectors=r}useSyncedValue(t,n){b.useDebugValue(t),G(()=>{this.state[t]!==n&&this.set(t,n)},[t,n])}useSyncedValueWithCleanup(t,n){const r=this;G(()=>(r.state[t]!==n&&r.set(t,n),()=>{r.set(t,void 0)}),[r,t,n])}useSyncedValues(t){const n=this;if(process.env.NODE_ENV!=="production"){b.useDebugValue(t,i=>Object.keys(i));const o=b.useRef(Object.keys(t)).current,s=Object.keys(t);(o.length!==s.length||o.some((i,c)=>i!==s[c]))&&console.error("ReactStore.useSyncedValues expects the same prop keys on every render. Keys should be stable.")}const r=Object.values(t);G(()=>{n.update(t)},[n,...r])}useControlledProp(t,n){b.useDebugValue(t);const r=n!==void 0;if(G(()=>{r&&!Object.is(this.state[t],n)&&super.setState({...this.state,[t]:n})},[t,n,r]),process.env.NODE_ENV!=="production"){const o=this.controlledValues??(this.controlledValues=new Map);o.has(t)||o.set(t,r);const s=o.get(t);s!==void 0&&s!==r&&console.error(`A component is changing the ${r?"":"un"}controlled state of ${t.toString()} to be ${r?"un":""}controlled. Elements should not switch from uncontrolled to controlled (or vice versa).`)}}select(t,n,r,o){const s=this.selectors[t];return s(this.state,n,r,o)}useState(t,n,r,o){return b.useDebugValue(t),bi(this,this.selectors[t],n,r,o)}useContextCallback(t,n){b.useDebugValue(t);const r=W(n??zs);this.context[t]=r}useStateSetter(t){const n=b.useRef(void 0);return n.current===void 0&&(n.current=r=>{this.set(t,r)}),n.current}observe(t,n){let r;typeof t=="function"?r=t:r=this.selectors[t];let o=r(this.state);return n(o,o,this),this.subscribe(s=>{const i=r(s);if(!Object.is(o,i)){const c=o;o=i,n(i,c,this)}})}}const Zu={open:Q(e=>e.open),domReferenceElement:Q(e=>e.domReferenceElement),referenceElement:Q(e=>e.positionReference??e.referenceElement),floatingElement:Q(e=>e.floatingElement),floatingId:Q(e=>e.floatingId)};class _r extends Lr{constructor(n){const{nested:r,noEmit:o,onOpenChange:s,triggerElements:i,...c}=n;super({...c,positionReference:c.referenceElement,domReferenceElement:c.referenceElement},{onOpenChange:s,dataRef:{current:{}},events:qa(),nested:r,noEmit:o,triggerElements:i},Zu);de(this,"setOpen",(n,r)=>{var o,s;if((!n||!this.state.open||Is(r.event))&&(this.context.dataRef.current.openEvent=n?r.event:void 0),!this.context.noEmit){const i={open:n,reason:r.reason,nativeEvent:r.event,nested:this.context.nested,triggerElement:r.trigger};this.context.events.emit("openchange",i)}(s=(o=this.context).onOpenChange)==null||s.call(o,n,r)})}}function xi(e,t=!1,n=!1){const[r,o]=b.useState(e&&t?"idle":void 0),[s,i]=b.useState(e);return e&&!s&&(i(!0),o("starting")),!e&&s&&r!=="ending"&&!n&&o("ending"),!e&&!s&&r==="ending"&&o(void 0),G(()=>{if(!e&&s&&r!=="ending"&&n){const c=We.request(()=>{o("ending")});return()=>{We.cancel(c)}}},[e,s,r,n]),G(()=>{if(!e||t)return;const c=We.request(()=>{o(void 0)});return()=>{We.cancel(c)}},[t,e]),G(()=>{if(!e||!t)return;e&&s&&r!=="idle"&&o("starting");const c=We.request(()=>{o("idle")});return()=>{We.cancel(c)}},[t,e,s,o,r]),b.useMemo(()=>({mounted:s,setMounted:i,transitionStatus:r}),[s,r])}let $t=(function(e){return e.startingStyle="data-starting-style",e.endingStyle="data-ending-style",e})({});const Ju={[$t.startingStyle]:""},Qu={[$t.endingStyle]:""},Ln={transitionStatus(e){return e==="starting"?Ju:e==="ending"?Qu:null}};function ed(e,t=!1,n=!0){const r=Pr();return W((o,s=null)=>{r.cancel();function i(){gt.flushSync(o)}const c=qe(e);if(c==null)return;const u=c;if(typeof u.getAnimations!="function"||globalThis.BASE_UI_ANIMATIONS_DISABLED)o();else{let a=function(){const l=$t.startingStyle;if(!u.hasAttribute(l)){r.request(d);return}const g=new MutationObserver(()=>{u.hasAttribute(l)||(g.disconnect(),d())});g.observe(u,{attributes:!0,attributeFilter:[l]}),s==null||s.addEventListener("abort",()=>g.disconnect(),{once:!0})},d=function(){Promise.all(u.getAnimations().map(l=>l.finished)).then(()=>{s!=null&&s.aborted||i()}).catch(()=>{const l=u.getAnimations();if(n){if(s!=null&&s.aborted)return;i()}else l.length>0&&l.some(g=>g.pending||g.playState!=="finished")&&d()})};if(t){a();return}r.request(d)}})}function _n(e){const{enabled:t=!0,open:n,ref:r,onComplete:o}=e,s=W(o),i=ed(r,n,!1);b.useEffect(()=>{if(!t)return;const c=new AbortController;return i(s,c.signal),()=>{c.abort()}},[t,n,s,i])}function td(e,t){const n=b.useRef(null),r=b.useRef(null);return b.useCallback(o=>{if(e!==void 0){if(n.current!==null){const s=n.current,i=r.current,c=t.context.triggerElements.getById(s);i&&c===i&&t.context.triggerElements.delete(s),n.current=null,r.current=null}o!==null&&(n.current=e,r.current=o,t.context.triggerElements.add(e,o))}},[t,e])}function vi(e,t,n,r){const o=n.useState("isMountedByTrigger",e),s=td(e,n),i=W(c=>{if(s(c),!c||!n.select("open"))return;const u=n.select("activeTriggerId");if(u===e){n.update({activeTriggerElement:c,...r});return}u==null&&n.update({activeTriggerId:e,activeTriggerElement:c,...r})});return G(()=>{o&&n.update({activeTriggerElement:t.current,...r})},[o,n,t,...Object.values(r)]),{registerTrigger:i,isMountedByThisTrigger:o}}function yi(e){const t=e.useState("open");G(()=>{if(t&&!e.select("activeTriggerId")&&e.context.triggerElements.size===1){const n=e.context.triggerElements.entries().next();if(!n.done){const[r,o]=n.value;e.update({activeTriggerId:r,activeTriggerElement:o})}}},[t,e])}function Ei(e,t,n){const{mounted:r,setMounted:o,transitionStatus:s}=xi(e);t.useSyncedValues({mounted:r,transitionStatus:s});const i=W(()=>{var u,a;o(!1),t.update({activeTriggerId:null,activeTriggerElement:null,mounted:!1}),n==null||n(),(a=(u=t.context).onOpenChangeComplete)==null||a.call(u,!1)}),c=t.useState("preventUnmountingOnClose");return _n({enabled:!c,open:e,ref:t.context.popupRef,onComplete(){e||i()}}),{forceUnmount:i,transitionStatus:s}}class Fn{constructor(){this.elementsSet=new Set,this.idMap=new Map}add(t,n){const r=this.idMap.get(t);if(r!==n&&(r!==void 0&&this.elementsSet.delete(r),this.elementsSet.add(n),this.idMap.set(t,n),process.env.NODE_ENV!=="production"&&this.elementsSet.size!==this.idMap.size))throw new Error("Base UI: A trigger element cannot be registered under multiple IDs in PopupTriggerMap.")}delete(t){const n=this.idMap.get(t);n&&(this.elementsSet.delete(n),this.idMap.delete(t))}hasElement(t){return this.elementsSet.has(t)}hasMatchingElement(t){for(const n of this.elementsSet)if(t(n))return!0;return!1}getById(t){return this.idMap.get(t)}entries(){return this.idMap.entries()}elements(){return this.elementsSet.values()}get size(){return this.idMap.size}}function nd(){return new _r({open:!1,floatingElement:null,referenceElement:null,triggerElements:new Fn,floatingId:"",nested:!1,noEmit:!1,onOpenChange:void 0})}function wi(){return{open:!1,openProp:void 0,mounted:!1,transitionStatus:"idle",floatingRootContext:nd(),preventUnmountingOnClose:!1,payload:void 0,activeTriggerId:null,activeTriggerElement:null,triggerIdProp:void 0,popupElement:null,positionerElement:null,activeTriggerProps:Re,inactiveTriggerProps:Re,popupProps:Re}}const ln=Q(e=>e.triggerIdProp??e.activeTriggerId),Si={open:Q(e=>e.openProp??e.open),mounted:Q(e=>e.mounted),transitionStatus:Q(e=>e.transitionStatus),floatingRootContext:Q(e=>e.floatingRootContext),preventUnmountingOnClose:Q(e=>e.preventUnmountingOnClose),payload:Q(e=>e.payload),activeTriggerId:ln,activeTriggerElement:Q(e=>e.mounted?e.activeTriggerElement:null),isTriggerActive:Q((e,t)=>t!==void 0&&ln(e)===t),isOpenedByTrigger:Q((e,t)=>t!==void 0&&ln(e)===t&&e.open),isMountedByTrigger:Q((e,t)=>t!==void 0&&ln(e)===t&&e.mounted),triggerProps:Q((e,t)=>t?e.activeTriggerProps:e.inactiveTriggerProps),popupProps:Q(e=>e.popupProps),popupElement:Q(e=>e.popupElement),positionerElement:Q(e=>e.positionerElement)};function rd(e){const{open:t=!1,onOpenChange:n,elements:r={}}=e,o=Yt(),s=Dn()!=null;if(process.env.NODE_ENV!=="production"){const c=r.reference;c&&!oe(c)&&console.error("Cannot pass a virtual element to the `elements.reference` option,","as it must be a real DOM element. Use `context.setPositionReference()`","instead.")}const i=Ie(()=>new _r({open:t,onOpenChange:n,referenceElement:r.reference??null,floatingElement:r.floating??null,triggerElements:new Fn,floatingId:o,nested:s,noEmit:!1})).current;return G(()=>{const c={open:t,floatingId:o};r.reference!==void 0&&(c.referenceElement=r.reference,c.domReferenceElement=oe(r.reference)?r.reference:null),r.floating!==void 0&&(c.floatingElement=r.floating),i.update(c)},[t,o,r.reference,r.floating,i]),i.context.onOpenChange=n,i.context.nested=s,i.context.noEmit=!1,i}function od(e={}){const{nodeId:t,externalTree:n}=e,r=rd(e),o=e.rootContext||r,s={reference:o.useState("referenceElement"),floating:o.useState("floatingElement"),domReference:o.useState("domReferenceElement")},[i,c]=b.useState(null),u=b.useRef(null),a=Kt(n);G(()=>{s.domReference&&(u.current=s.domReference)},[s.domReference]);const d=fu({...e,elements:{...s,...i&&{reference:i}}}),l=b.useCallback(C=>{const O=oe(C)?{getBoundingClientRect:()=>C.getBoundingClientRect(),getClientRects:()=>C.getClientRects(),contextElement:C}:C;c(O),d.refs.setReference(O)},[d.refs]),[g,p]=b.useState(null),[f,h]=b.useState(null);o.useSyncedValue("referenceElement",g),o.useSyncedValue("domReferenceElement",oe(g)?g:null),o.useSyncedValue("floatingElement",f);const v=b.useCallback(C=>{(oe(C)||C===null)&&(u.current=C,p(C)),(oe(d.refs.reference.current)||d.refs.reference.current===null||C!==null&&!oe(C))&&d.refs.setReference(C)},[d.refs,p]),x=b.useCallback(C=>{h(C),d.refs.setFloating(C)},[d.refs]),E=b.useMemo(()=>({...d.refs,setReference:v,setFloating:x,setPositionReference:l,domReference:u}),[d.refs,v,x,l]),w=b.useMemo(()=>({...d.elements,domReference:s.domReference}),[d.elements,s.domReference]),y=o.useState("open"),T=o.useState("floatingId"),S=b.useMemo(()=>({...d,dataRef:o.context.dataRef,open:y,onOpenChange:o.setOpen,events:o.context.events,floatingId:T,refs:E,elements:w,nodeId:t,rootStore:o}),[d,E,w,t,o,y,T]);return G(()=>{o.context.dataRef.current.floatingContext=S;const C=a==null?void 0:a.nodesRef.current.find(O=>O.id===t);C&&(C.context=S)}),b.useMemo(()=>({...d,context:S,refs:E,elements:w,rootStore:o}),[d,E,w,S,o])}function Ri(e){const{popupStore:t,noEmit:n=!1,treatPopupAsFloatingElement:r=!1,onOpenChange:o}=e,s=Yt(),i=Dn()!=null,c=t.useState("open"),u=t.useState("activeTriggerElement"),a=t.useState(r?"popupElement":"positionerElement"),d=t.context.triggerElements,l=Ie(()=>new _r({open:c,referenceElement:u,floatingElement:a,triggerElements:d,onOpenChange:o,floatingId:s,nested:i,noEmit:n})).current;return G(()=>{const g={open:c,floatingId:s,referenceElement:u,floatingElement:a};oe(u)&&(g.domReferenceElement=u),l.state.positionReference===l.state.referenceElement&&(g.positionReference=u),l.update(g)},[c,s,u,a,l]),l.context.onOpenChange=o,l.context.nested=i,l.context.noEmit=n,l}const nr=ca&&Rs;function sd(e,t={}){const n="rootStore"in e?e.rootStore:e,{events:r,dataRef:o}=n.context,{enabled:s=!0,delay:i}=t,c=b.useRef(!1),u=b.useRef(null),a=Rt(),d=b.useRef(!0);b.useEffect(()=>{const g=n.select("domReferenceElement");if(!s)return;const p=ve(g);function f(){const x=n.select("domReferenceElement");!n.select("open")&&be(x)&&x===ze(ce(x))&&(c.current=!0)}function h(){d.current=!0}function v(){d.current=!1}return p.addEventListener("blur",f),nr&&(p.addEventListener("keydown",h,!0),p.addEventListener("pointerdown",v,!0)),()=>{p.removeEventListener("blur",f),nr&&(p.removeEventListener("keydown",h,!0),p.removeEventListener("pointerdown",v,!0))}},[n,s]),b.useEffect(()=>{if(!s)return;function g(p){if(p.reason===Vt||p.reason===Ir){const f=n.select("domReferenceElement");oe(f)&&(u.current=f,c.current=!0)}}return r.on("openchange",g),()=>{r.off("openchange",g)}},[r,s,n]);const l=b.useMemo(()=>({onMouseLeave(){c.current=!1,u.current=null},onFocus(g){const p=g.currentTarget;if(c.current){if(u.current===p)return;c.current=!1,u.current=null}const f=Oe(g.nativeEvent);if(oe(f)){if(nr&&!g.relatedTarget){if(!d.current&&!kn(f))return}else if(!ga(f))return}const h=xn(g.relatedTarget,n.context.triggerElements),{nativeEvent:v,currentTarget:x}=g,E=typeof i=="function"?i():i;if(n.select("open")&&h||E===0||E===void 0){n.setOpen(!0,ae(pn,v,x));return}a.start(E,()=>{c.current||n.setOpen(!0,ae(pn,v,x))})},onBlur(g){c.current=!1,u.current=null;const p=g.relatedTarget,f=g.nativeEvent,h=oe(p)&&p.hasAttribute(Ot("focus-guard"))&&p.getAttribute("data-type")==="outside";a.start(0,()=>{var w;const v=n.select("domReferenceElement"),x=ze(v?v.ownerDocument:document);!p&&x===v||ne((w=o.current.floatingContext)==null?void 0:w.refs.floating.current,x)||ne(v,x)||h||xn(p??x,n.context.triggerElements)||n.setOpen(!1,ae(pn,f))})}}),[o,n,a,i]);return b.useMemo(()=>s?{reference:l,trigger:l}:{},[s,l])}const vr=Ot("safe-polygon"),id=`button,a,[role="button"],select,[tabindex]:not([tabindex="-1"]),${Ns}`;function cd(e){return e?!!e.closest(id):!1}class Fr{constructor(){de(this,"dispose",()=>{this.openChangeTimeout.clear(),this.restTimeout.clear()});de(this,"disposeEffect",()=>this.dispose);this.pointerType=void 0,this.interactedInside=!1,this.handler=void 0,this.blockMouseMove=!0,this.performedPointerEventsMutation=!1,this.unbindMouseMove=()=>{},this.restTimeoutPending=!1,this.openChangeTimeout=new Ke,this.restTimeout=new Ke,this.handleCloseOptions=void 0}static create(){return new Fr}}function Ti(e){const t=Ie(Fr.create).current,n=e.context.dataRef.current;return n.hoverInteractionState||(n.hoverInteractionState=t),Sr(n.hoverInteractionState.disposeEffect),n.hoverInteractionState}const ad=new Set(["click","mousedown"]);function ld(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingElement"),s=n.useState("domReferenceElement"),{dataRef:i}=n.context,{enabled:c=!0,closeDelay:u=0}=t,a=Ti(n),d=Kt(),l=Dn(),g=W(()=>a.interactedInside?!0:i.current.openEvent?ad.has(i.current.openEvent.type):!1),p=W(()=>{var y;const w=(y=i.current.openEvent)==null?void 0:y.type;return(w==null?void 0:w.includes("mouse"))&&w!=="mousedown"}),f=W(w=>xn(w,n.context.triggerElements)),h=b.useCallback((w,y=!0)=>{const T=ud(u,a.pointerType);T&&!a.handler?a.openChangeTimeout.start(T,()=>n.setOpen(!1,ae(Be,w))):y&&(a.openChangeTimeout.clear(),n.setOpen(!1,ae(Be,w)))},[u,n,a]),v=W(()=>{a.unbindMouseMove(),a.handler=void 0}),x=W(()=>{if(a.performedPointerEventsMutation){const w=ce(o).body;w.style.pointerEvents="",w.removeAttribute(vr),a.performedPointerEventsMutation=!1}}),E=W(w=>{const y=Oe(w);if(!cd(y)){a.interactedInside=!1;return}a.interactedInside=!0});G(()=>{r||(a.pointerType=void 0,a.restTimeoutPending=!1,a.interactedInside=!1,v(),x())},[r,a,v,x]),b.useEffect(()=>()=>{v()},[v]),b.useEffect(()=>x,[x]),G(()=>{var w,y,T;if(c&&r&&(w=a.handleCloseOptions)!=null&&w.blockPointerEvents&&p()&&oe(s)&&o){a.performedPointerEventsMutation=!0;const S=ce(o).body;S.setAttribute(vr,"");const C=s,O=o,P=(T=(y=d==null?void 0:d.nodesRef.current.find(_=>_.id===l))==null?void 0:y.context)==null?void 0:T.elements.floating;return P&&(P.style.pointerEvents=""),S.style.pointerEvents="none",C.style.pointerEvents="auto",O.style.pointerEvents="auto",()=>{S.style.pointerEvents="",C.style.pointerEvents="",O.style.pointerEvents=""}}},[c,r,s,o,a,p,d,l]),b.useEffect(()=>{if(!c)return;function w(C){g()||!i.current.floatingContext||!n.select("open")||f(C.relatedTarget)||(x(),v(),g()||h(C))}function y(C){var O;a.openChangeTimeout.clear(),x(),(O=a.handler)==null||O.call(a,C),v()}function T(C){g()||h(C,!1)}const S=o;return S&&(S.addEventListener("mouseleave",w),S.addEventListener("mouseenter",y),S.addEventListener("mouseleave",T),S.addEventListener("pointerdown",E,!0)),()=>{S&&(S.removeEventListener("mouseleave",w),S.removeEventListener("mouseenter",y),S.removeEventListener("mouseleave",T),S.removeEventListener("pointerdown",E,!0))}},[c,o,n,i,g,f,h,x,v,E,a])}function ud(e,t){return t&&!ft(t)?0:typeof e=="function"?e():e}function rr(e){return typeof e=="function"?e():e}const dd={current:null};function fd(e,t={}){var _;const n="rootStore"in e?e.rootStore:e,{dataRef:r,events:o}=n.context,{enabled:s=!0,delay:i=0,handleClose:c=null,mouseOnly:u=!1,restMs:a=0,move:d=!0,triggerElementRef:l=dd,externalTree:g,isActiveTrigger:p=!0}=t,f=Kt(g),h=Ti(n),v=Ue(c),x=Ue(i),E=Ue(a),w=Ue(s);p&&(h.handleCloseOptions=(_=v.current)==null?void 0:_.__options);const y=W(()=>h.interactedInside?!0:r.current.openEvent?["click","mousedown"].includes(r.current.openEvent.type):!1),T=W(j=>xn(j,n.context.triggerElements)),S=b.useCallback((j,R=!0)=>{const N=gn(x.current,"close",h.pointerType);N&&!h.handler?h.openChangeTimeout.start(N,()=>n.setOpen(!1,ae(Be,j))):R&&(h.openChangeTimeout.clear(),n.setOpen(!1,ae(Be,j)))},[x,n,h]),C=W(()=>{h.unbindMouseMove(),h.handler=void 0}),O=W(()=>{if(h.performedPointerEventsMutation){const j=ce(n.select("domReferenceElement")).body;j.style.pointerEvents="",j.removeAttribute(vr),h.performedPointerEventsMutation=!1}});b.useEffect(()=>{if(!s)return;function j(R){R.open||(h.openChangeTimeout.clear(),h.restTimeout.clear(),h.blockMouseMove=!0,h.restTimeoutPending=!1)}return o.on("openchange",j),()=>{o.off("openchange",j)}},[s,o,h]);const P=W(j=>{var N;if(y()||!r.current.floatingContext||T(j.relatedTarget))return;const R=l.current;(N=v.current)==null||N.call(v,{...r.current.floatingContext,tree:f,x:j.clientX,y:j.clientY,onClose(){O(),C(),!y()&&R===n.select("domReferenceElement")&&S(j)}})(j)});return b.useEffect(()=>{if(!s)return;const j=l.current??(p?n.select("domReferenceElement"):null);if(!oe(j))return;function R(D){if(h.openChangeTimeout.clear(),h.blockMouseMove=!1,u&&!ft(h.pointerType)||rr(E.current)>0&&!gn(x.current,"open"))return;const B=gn(x.current,"open",h.pointerType),L=n.select("domReferenceElement"),I=n.context.triggerElements,A=(I.hasElement(D.target)||I.hasMatchingElement(se=>ne(se,D.target)))&&(!L||!ne(L,D.target)),H=D.currentTarget??null,le=n.select("open"),fe=!le||A;A&&le?n.setOpen(!0,ae(Be,D,H)):B?h.openChangeTimeout.start(B,()=>{fe&&n.setOpen(!0,ae(Be,D,H))}):fe&&n.setOpen(!0,ae(Be,D,H))}function N(D){if(y()){O();return}h.unbindMouseMove();const B=n.select("domReferenceElement"),L=ce(B);if(h.restTimeout.clear(),h.restTimeoutPending=!1,T(D.relatedTarget))return;if(v.current&&r.current.floatingContext){n.select("open")||h.openChangeTimeout.clear();const A=l.current;h.handler=v.current({...r.current.floatingContext,tree:f,x:D.clientX,y:D.clientY,onClose(){O(),C(),w.current&&!y()&&A===n.select("domReferenceElement")&&S(D,!0)}});const H=h.handler;H(D),L.addEventListener("mousemove",H),h.unbindMouseMove=()=>{L.removeEventListener("mousemove",H)};return}(h.pointerType==="touch"?!ne(n.select("floatingElement"),D.relatedTarget):!0)&&S(D)}function Y(D){P(D)}return n.select("open")&&j.addEventListener("mouseleave",Y),d&&j.addEventListener("mousemove",R,{once:!0}),j.addEventListener("mouseenter",R),j.addEventListener("mouseleave",N),()=>{j.removeEventListener("mouseleave",Y),d&&j.removeEventListener("mousemove",R),j.removeEventListener("mouseenter",R),j.removeEventListener("mouseleave",N)}},[C,O,r,x,S,n,s,v,P,h,p,y,T,u,d,E,l,f,w]),b.useMemo(()=>{if(!s)return;function j(R){h.pointerType=R.pointerType}return{onPointerDown:j,onPointerEnter:j,onMouseMove(R){const{nativeEvent:N}=R,Y=R.currentTarget,D=n.select("domReferenceElement"),B=n.context.triggerElements,L=n.select("open"),I=(B.hasElement(R.target)||B.hasMatchingElement(H=>ne(H,R.target)))&&(!D||!ne(D,R.target));if(u&&!ft(h.pointerType)||L&&!I||rr(E.current)===0||!I&&h.restTimeoutPending&&R.movementX**2+R.movementY**2<2)return;h.restTimeout.clear();function A(){if(h.restTimeoutPending=!1,y())return;const H=n.select("open");!h.blockMouseMove&&(!H||I)&&n.setOpen(!0,ae(Be,N,Y))}h.pointerType==="touch"?gt.flushSync(()=>{A()}):I&&L?A():(h.restTimeoutPending=!0,h.restTimeout.start(rr(E.current),A))}}},[s,h,y,u,n,E])}function Vr(e=[]){const t=e.map(a=>a==null?void 0:a.reference),n=e.map(a=>a==null?void 0:a.floating),r=e.map(a=>a==null?void 0:a.item),o=e.map(a=>a==null?void 0:a.trigger),s=b.useCallback(a=>un(a,e,"reference"),t),i=b.useCallback(a=>un(a,e,"floating"),n),c=b.useCallback(a=>un(a,e,"item"),r),u=b.useCallback(a=>un(a,e,"trigger"),o);return b.useMemo(()=>({getReferenceProps:s,getFloatingProps:i,getItemProps:c,getTriggerProps:u}),[s,i,c,u])}function un(e,t,n){var i;const r=new Map,o=n==="item",s={};n==="floating"&&(s.tabIndex=-1,s[lr]="");for(const c in e)o&&e&&(c===Cs||c===Os)||(s[c]=e[c]);for(let c=0;c<t.length;c+=1){let u;const a=(i=t[c])==null?void 0:i[n];typeof a=="function"?u=e?a(e):null:u=a,u&&Wo(s,u,o,r)}return Wo(s,e,o,r),s}function Wo(e,t,n,r){var o;for(const s in t){const i=t[s];n&&(s===Cs||s===Os)||(s.startsWith("on")?(r.has(s)||r.set(s,[]),typeof i=="function"&&((o=r.get(s))==null||o.push(i),e[s]=(...c)=>{var u;return(u=r.get(s))==null?void 0:u.map(a=>a(...c)).find(a=>a!==void 0)})):e[s]=i)}}const pd=new Map([["select","listbox"],["combobox","listbox"],["label",!1]]);function gd(e,t={}){const n="rootStore"in e?e.rootStore:e,r=n.useState("open"),o=n.useState("floatingId"),s=n.useState("domReferenceElement"),i=n.useState("floatingElement"),{role:c="dialog"}=t,u=Yt(),a=(s==null?void 0:s.id)||u,d=b.useMemo(()=>{var E;return((E=ur(i))==null?void 0:E.id)||o},[i,o]),l=pd.get(c)??c,p=Dn()!=null,f=b.useMemo(()=>l==="tooltip"||c==="label"?Re:{"aria-haspopup":l==="alertdialog"?"dialog":l,"aria-expanded":"false",...l==="listbox"&&{role:"combobox"},...l==="menu"&&p&&{role:"menuitem"},...c==="select"&&{"aria-autocomplete":"none"},...c==="combobox"&&{"aria-autocomplete":"list"}},[l,p,c]),h=b.useMemo(()=>l==="tooltip"||c==="label"?{[`aria-${c==="label"?"labelledby":"describedby"}`]:r?d:void 0}:{...f,"aria-expanded":r?"true":"false","aria-controls":r?d:void 0,...l==="menu"&&{id:a}},[l,d,r,a,c,f]),v=b.useMemo(()=>{const E={id:d,...l&&{role:l}};return l==="tooltip"||c==="label"?E:{...E,...l==="menu"&&{"aria-labelledby":a}}},[l,d,a,c]),x=b.useCallback(({active:E,selected:w})=>{const y={role:"option",...E&&{id:`${d}-fui-option`}};switch(c){case"select":case"combobox":return{...y,"aria-selected":w}}return{}},[d,c]);return b.useMemo(()=>({reference:h,floating:v,item:x,trigger:f}),[h,v,f,x])}function Uo(e,t){const[n,r]=e;let o=!1;const s=t.length;for(let i=0,c=s-1;i<s;c=i++){const[u,a]=t[i]||[0,0],[d,l]=t[c]||[0,0];a>=r!=l>=r&&n<=(d-u)*(r-a)/(l-a)+u&&(o=!o)}return o}function md(e,t){return e[0]>=t.x&&e[0]<=t.x+t.width&&e[1]>=t.y&&e[1]<=t.y+t.height}function hd(e={}){const{buffer:t=.5,blockPointerEvents:n=!1,requireIntent:r=!0}=e,o=new Ke;let s=!1,i=null,c=null,u=typeof performance<"u"?performance.now():0;function a(l,g){const p=performance.now(),f=p-u;if(i===null||c===null||f===0)return i=l,c=g,u=p,null;const h=l-i,v=g-c,E=Math.sqrt(h*h+v*v)/f;return i=l,c=g,u=p,E}const d=({x:l,y:g,placement:p,elements:f,onClose:h,nodeId:v,tree:x})=>function(w){function y(){o.clear(),h()}if(o.clear(),!f.domReference||!f.floating||p==null||l==null||g==null)return;const{clientX:T,clientY:S}=w,C=[T,S],O=Oe(w),P=w.type==="mouseleave",_=ne(f.floating,O),j=ne(f.domReference,O),R=f.domReference.getBoundingClientRect(),N=f.floating.getBoundingClientRect(),Y=p.split("-")[0],D=l>N.right-N.width/2,B=g>N.bottom-N.height/2,L=md(C,R),I=N.width>R.width,A=N.height>R.height,H=(I?R:N).left,le=(I?R:N).right,fe=(A?R:N).top,se=(A?R:N).bottom;if(_&&(s=!0,!P))return;if(j&&(s=!1),j&&!P){s=!0;return}if(P&&oe(w.relatedTarget)&&ne(f.floating,w.relatedTarget)||x&&ut(x.nodesRef.current,v).some(({context:ee})=>ee==null?void 0:ee.open))return;if(Y==="top"&&g>=R.bottom-1||Y==="bottom"&&g<=R.top+1||Y==="left"&&l>=R.right-1||Y==="right"&&l<=R.left+1)return y();let pe=[];switch(Y){case"top":pe=[[H,R.top+1],[H,N.bottom-1],[le,N.bottom-1],[le,R.top+1]];break;case"bottom":pe=[[H,N.top+1],[H,R.bottom-1],[le,R.bottom-1],[le,N.top+1]];break;case"left":pe=[[N.right-1,se],[N.right-1,fe],[R.left+1,fe],[R.left+1,se]];break;case"right":pe=[[R.right-1,se],[R.right-1,fe],[N.left+1,fe],[N.left+1,se]];break}function ye([ee,J]){switch(Y){case"top":{const me=[I?ee+t/2:D?ee+t*4:ee-t*4,J+t+1],K=[I?ee-t/2:D?ee+t*4:ee-t*4,J+t+1],he=[[N.left,D||I?N.bottom-t:N.top],[N.right,D?I?N.bottom-t:N.top:N.bottom-t]];return[me,K,...he]}case"bottom":{const me=[I?ee+t/2:D?ee+t*4:ee-t*4,J-t],K=[I?ee-t/2:D?ee+t*4:ee-t*4,J-t],he=[[N.left,D||I?N.top+t:N.bottom],[N.right,D?I?N.top+t:N.bottom:N.top+t]];return[me,K,...he]}case"left":{const me=[ee+t+1,A?J+t/2:B?J+t*4:J-t*4],K=[ee+t+1,A?J-t/2:B?J+t*4:J-t*4];return[...[[B||A?N.right-t:N.left,N.top],[B?A?N.right-t:N.left:N.right-t,N.bottom]],me,K]}case"right":{const me=[ee-t,A?J+t/2:B?J+t*4:J-t*4],K=[ee-t,A?J-t/2:B?J+t*4:J-t*4],he=[[B||A?N.left+t:N.right,N.top],[B?A?N.left+t:N.right:N.left+t,N.bottom]];return[me,K,...he]}default:return[]}}if(!Uo([T,S],pe)){if(s&&!L)return y();if(!P&&r){const ee=a(w.clientX,w.clientY);if(ee!==null&&ee<.1)return y()}Uo([T,S],ye([l,g]))?!s&&r&&o.start(40,y):y()}};return d.__options={blockPointerEvents:n},d}const bd={...Si,disabled:Q(e=>e.disabled),instantType:Q(e=>e.instantType),isInstantPhase:Q(e=>e.isInstantPhase),trackCursorAxis:Q(e=>e.trackCursorAxis),disableHoverablePopup:Q(e=>e.disableHoverablePopup),lastOpenChangeReason:Q(e=>e.openChangeReason),closeDelay:Q(e=>e.closeDelay),hasViewport:Q(e=>e.hasViewport)};class Br extends Lr{constructor(n){super({...xd(),...n},{popupRef:b.createRef(),onOpenChange:void 0,onOpenChangeComplete:void 0,triggerElements:new Fn},bd);de(this,"setOpen",(n,r)=>{var a,d;const o=r.reason,s=o===Be,i=n&&o===pn,c=!n&&(o===Vt||o===Ir);if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},(d=(a=this.context).onOpenChange)==null||d.call(a,n,r),r.isCanceled)return;const u=()=>{var p;const l={open:n,openChangeReason:o};i?l.instantType="focus":c?l.instantType="dismiss":o===Be&&(l.instantType=void 0);const g=((p=r.trigger)==null?void 0:p.id)??null;(g||n)&&(l.activeTriggerId=g,l.activeTriggerElement=r.trigger??null),this.update(l)};s?gt.flushSync(u):u()})}static useStore(n,r){const o=Ie(()=>new Br(r)).current,s=n??o,i=Ri({popupStore:s,onOpenChange:s.setOpen});return s.state.floatingRootContext=i,s}}function xd(){return{...wi(),disabled:!1,instantType:void 0,isInstantPhase:!1,trackCursorAxis:"none",disableHoverablePopup:!1,openChangeReason:null,closeDelay:0,hasViewport:!1}}const Ci=bs(function(t){const{disabled:n=!1,defaultOpen:r=!1,open:o,disableHoverablePopup:s=!1,trackCursorAxis:i="none",actionsRef:c,onOpenChange:u,onOpenChangeComplete:a,handle:d,triggerId:l,defaultTriggerId:g=null,children:p}=t,f=Br.useStore(d==null?void 0:d.store,{open:r,openProp:o,activeTriggerId:g,triggerIdProp:l});xs(()=>{o===void 0&&f.state.open===!1&&r===!0&&f.update({open:!0,activeTriggerId:g})}),f.useControlledProp("openProp",o),f.useControlledProp("triggerIdProp",l),f.useContextCallback("onOpenChange",u),f.useContextCallback("onOpenChangeComplete",a);const h=f.useState("open"),v=!n&&h,x=f.useState("activeTriggerId"),E=f.useState("payload");f.useSyncedValues({trackCursorAxis:i,disableHoverablePopup:s}),G(()=>{h&&n&&f.setOpen(!1,ae(el))},[h,n,f]),f.useSyncedValue("disabled",n),yi(f);const{forceUnmount:w,transitionStatus:y}=Ei(v,f),T=f.useState("isInstantPhase"),S=f.useState("instantType"),C=f.useState("lastOpenChangeReason"),O=b.useRef(null);G(()=>{y==="ending"&&C===Ft||y!=="ending"&&T?(S!=="delay"&&(O.current=S),f.set("instantType","delay")):O.current!==null&&(f.set("instantType",O.current),O.current=null)},[y,T,C,S,f]),G(()=>{v&&x==null&&f.set("payload",void 0)},[f,x,v]);const P=b.useCallback(()=>{f.setOpen(!1,vd(f,Ks))},[f]);b.useImperativeHandle(c,()=>({unmount:w,close:P}),[w,P]);const _=f.useState("floatingRootContext"),j=pi(_,{enabled:!n,referencePress:!0}),R=jl(_,{enabled:!n&&i!=="none",axis:i==="none"?void 0:i}),{getReferenceProps:N,getFloatingProps:Y,getTriggerProps:D}=Vr([j,R]),B=b.useMemo(()=>N(),[N]),L=b.useMemo(()=>D(),[D]),I=b.useMemo(()=>Y(),[Y]);return f.useSyncedValues({activeTriggerProps:B,inactiveTriggerProps:L,popupProps:I}),m.jsx(wr.Provider,{value:f,children:typeof p=="function"?p({payload:E}):p})});process.env.NODE_ENV!=="production"&&(Ci.displayName="TooltipRoot");function vd(e,t){const n=ae(t);return n.preventUnmountOnClose=()=>{e.set("preventUnmountingOnClose",!0)},n}let at=(function(e){return e.open="data-open",e.closed="data-closed",e[e.startingStyle=$t.startingStyle]="startingStyle",e[e.endingStyle=$t.endingStyle]="endingStyle",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e})({}),Oi=(function(e){return e.popupOpen="data-popup-open",e.pressed="data-pressed",e})({});const yd={[Oi.popupOpen]:""},Ed={[at.open]:""},wd={[at.closed]:""},Sd={[at.anchorHidden]:""},Ni={open(e){return e?yd:null}},Gt={open(e){return e?Ed:wd},anchorHidden(e){return e?Sd:null}};function kt(e){return Yt(e,"base-ui")}const Ii=b.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ii.displayName="TooltipProviderContext");function Rd(){return b.useContext(Ii)}let Td=(function(e){return e[e.popupOpen=Oi.popupOpen]="popupOpen",e.triggerDisabled="data-trigger-disabled",e})({});const Cd=600,Pi=Xc(function(t,n){const{className:r,render:o,handle:s,payload:i,disabled:c,delay:u,closeDelay:a,id:d,...l}=t,g=Wt(!0),p=(s==null?void 0:s.store)??g;if(!p)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Tooltip.Trigger> must be either used within a <Tooltip.Root> component or provided with a handle.":Le(82));const f=kt(d),h=p.useState("isTriggerActive",f),v=p.useState("isOpenedByTrigger",f),x=p.useState("floatingRootContext"),E=b.useRef(null),w=u??Cd,y=a??0,{registerTrigger:T,isMountedByThisTrigger:S}=vi(f,E,p,{payload:i,closeDelay:y}),C=Rd(),{delayRef:O,isInstantPhase:P,hasProvider:_}=tl(x,{open:v});p.useSyncedValue("isInstantPhase",P);const j=p.useState("disabled"),R=c??j,N=p.useState("trackCursorAxis"),Y=p.useState("disableHoverablePopup"),D=fd(x,{enabled:!R,mouseOnly:!0,move:!1,handleClose:!Y&&N!=="both"?hd():null,restMs(){const H=C==null?void 0:C.delay,le=typeof O.current=="object"?O.current.open:void 0;let fe=w;return _&&(le!==0?fe=u??H??w:fe=0),fe},delay(){const H=typeof O.current=="object"?O.current.close:void 0;let le=y;return a==null&&_&&(le=H),{close:le}},triggerElementRef:E,isActiveTrigger:h}),B=sd(x,{enabled:!R}).reference,L={open:v},I=p.useState("triggerProps",S);return Pe("button",t,{state:L,ref:[n,T,E],props:[D,B,I,{id:f,[Td.triggerDisabled]:R?"":void 0},l],stateAttributesMapping:Ni})});process.env.NODE_ENV!=="production"&&(Pi.displayName="TooltipTrigger");const $r=b.createContext(void 0);process.env.NODE_ENV!=="production"&&($r.displayName="TooltipPortalContext");function Od(){const e=b.useContext($r);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Tooltip.Portal> is missing.":Le(70));return e}const ji=b.forwardRef(function(t,n){const{children:r,container:o,className:s,render:i,...c}=t,{portalNode:u,portalSubtree:a}=ri({container:o,ref:n,componentProps:t,elementProps:c});return!a&&!u?null:m.jsxs(b.Fragment,{children:[a,u&>.createPortal(r,u)]})});process.env.NODE_ENV!=="production"&&(ji.displayName="FloatingPortalLite");const ki=b.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t;return Wt().useState("mounted")||r?m.jsx($r.Provider,{value:r,children:m.jsx(ji,{ref:n,...o})}):null});process.env.NODE_ENV!=="production"&&(ki.displayName="TooltipPortal");const Hr=b.createContext(void 0);process.env.NODE_ENV!=="production"&&(Hr.displayName="TooltipPositionerContext");function Mi(){const e=b.useContext(Hr);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: TooltipPositionerContext is missing. TooltipPositioner parts must be placed within <Tooltip.Positioner>.":Le(71));return e}const Di=b.createContext(void 0);process.env.NODE_ENV!=="production"&&(Di.displayName="DirectionContext");function zr(){const e=b.useContext(Di);return(e==null?void 0:e.direction)??"ltr"}const Nd=e=>({name:"arrow",options:e,async fn(t){var A,H;const{x:n,y:r,placement:o,rects:s,platform:i,elements:c,middlewareData:u}=t,{element:a,padding:d=0,offsetParent:l="real"}=Qe(e,t)||{};if(a==null)return{};const g=Ps(d),p={x:n,y:r},f=Nr(o),h=Or(f),v=await i.getDimensions(a),x=f==="y",E=x?"top":"left",w=x?"bottom":"right",y=x?"clientHeight":"clientWidth",T=s.reference[h]+s.reference[f]-p[f]-s.floating[h],S=p[f]-s.reference[f],C=l==="real"?await((A=i.getOffsetParent)==null?void 0:A.call(i,a)):c.floating;let O=c.floating[y]||s.floating[h];(!O||!await((H=i.isElement)==null?void 0:H.call(i,C)))&&(O=c.floating[y]||s.floating[h]);const P=T/2-S/2,_=O/2-v[h]/2-1,j=Math.min(g[E],_),R=Math.min(g[w],_),N=j,Y=O-v[h]-R,D=O/2-v[h]/2+P,B=dr(N,D,Y),L=!u.arrow&&ot(o)!=null&&D!==B&&s.reference[h]/2-(D<N?j:R)-v[h]/2<0,I=L?D<N?D-N:D-Y:0;return{[f]:p[f]+I,data:{[f]:B,centerOffset:D-B-I,...L&&{alignmentOffset:I}},reset:L}}}),Id=(e,t)=>({...Nd(e),options:[e,t]}),Pd={name:"hide",async fn(e){var c;const{width:t,height:n,x:r,y:o}=e.rects.reference,s=t===0&&n===0&&r===0&&o===0;return{data:{referenceHidden:((c=(await xu().fn(e)).data)==null?void 0:c.referenceHidden)||s}}}},bn={sideX:"left",sideY:"top"},jd={name:"adaptiveOrigin",async fn(e){var E,w;const{x:t,y:n,rects:{floating:r},elements:{floating:o},platform:s,strategy:i,placement:c}=e,u=ve(o),a=u.getComputedStyle(o);if(!(a.transitionDuration!=="0s"&&a.transitionDuration!==""))return{x:t,y:n,data:bn};const l=await((E=s.getOffsetParent)==null?void 0:E.call(s,o));let g={width:0,height:0};if(i==="fixed"&&(u!=null&&u.visualViewport))g={width:u.visualViewport.width,height:u.visualViewport.height};else if(l===u){const y=ce(o);g={width:y.documentElement.clientWidth,height:y.documentElement.clientHeight}}else await((w=s.isElement)==null?void 0:w.call(s,l))&&(g=await s.getDimensions(l));const p=Ne(c);let f=t,h=n;p==="left"&&(f=g.width-(t+r.width)),p==="top"&&(h=g.height-(n+r.height));const v=p==="left"?"right":bn.sideX,x=p==="top"?"bottom":bn.sideY;return{x:f,y:h,data:{sideX:v,sideY:x}}}};function Ai(e,t,n){const 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 Yo(e,t,n){const{rects:r,placement:o}=e;return{side:Ai(t,Ne(o),n),align:ot(o)||"center",anchor:{width:r.reference.width,height:r.reference.height},positioner:{width:r.floating.width,height:r.floating.height}}}function kd(e){var ro,oo;const{anchor:t,positionMethod:n="absolute",side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,collisionBoundary:c,collisionPadding:u=5,sticky:a=!1,arrowPadding:d=5,disableAnchorTracking:l=!1,keepMounted:g=!1,floatingRootContext:p,mounted:f,collisionAvoidance:h,shiftCrossAxis:v=!1,nodeId:x,adaptiveOrigin:E,lazyFlip:w=!1,externalTree:y}=e,[T,S]=b.useState(null);!f&&T!==null&&S(null);const C=h.side||"flip",O=h.align||"flip",P=h.fallbackAxisSide||"end",_=typeof t=="function"?t:void 0,j=W(_),R=_?j:t,N=Ue(t),D=zr()==="rtl",B=T||{top:"top",right:"right",bottom:"bottom",left:"left","inline-end":D?"left":"right","inline-start":D?"right":"left"}[r],L=s==="center"?B:`${B}-${s}`;let I=u;const A=1,H=r==="bottom"?A:0,le=r==="top"?A:0,fe=r==="right"?A:0,se=r==="left"?A:0;typeof I=="number"?I={top:I+H,right:I+se,bottom:I+le,left:I+fe}:I&&(I={top:(I.top||0)+H,right:(I.right||0)+se,bottom:(I.bottom||0)+le,left:(I.left||0)+fe});const pe={boundary:c==="clipping-ancestors"?"clippingAncestors":c,padding:I},ye=b.useRef(null),ee=Ue(o),J=Ue(i),he=[pu(ue=>{const Ee=Yo(ue,r,D),He=typeof ee.current=="function"?ee.current(Ee):ee.current,De=typeof J.current=="function"?J.current(Ee):J.current;return{mainAxis:He,crossAxis:De,alignmentAxis:De}},[typeof o!="function"?o:0,typeof i!="function"?i:0,D,r])],_e=O==="none"&&C!=="shift",k=!_e&&(a||v||C==="shift"),M=C==="none"?null:hu({...pe,padding:{top:I.top+A,right:I.right+A,bottom:I.bottom+A,left:I.left+A},mainAxis:!v&&C==="flip",crossAxis:O==="flip"?"alignment":!1,fallbackAxisSideDirection:P}),F=_e?null:gu(ue=>{const Ee=ce(ue.elements.floating).documentElement;return{...pe,rootBoundary:v?{x:0,y:0,width:Ee.clientWidth,height:Ee.clientHeight}:void 0,mainAxis:O!=="none",crossAxis:k,limiter:a||v?void 0:mu(He=>{if(!ye.current)return{};const{width:De,height:Xe}=ye.current.getBoundingClientRect(),Jt=Ae(Ne(He.placement)),Qt=Jt==="y"?De:Xe,Bn=Jt==="y"?I.left+I.right:I.top+I.bottom;return{offset:Qt/2+Bn/2}})}},[pe,a,v,I,O]);C==="shift"||O==="shift"||s==="center"?he.push(F,M):he.push(M,F),he.push(bu({...pe,apply({elements:{floating:ue},rects:{reference:Ee},availableWidth:He,availableHeight:De}){const Xe=ue.style;Xe.setProperty("--available-width",`${He}px`),Xe.setProperty("--available-height",`${De}px`),Xe.setProperty("--anchor-width",`${Ee.width}px`),Xe.setProperty("--anchor-height",`${Ee.height}px`)}}),Id(()=>({element:ye.current||document.createElement("div"),padding:d,offsetParent:"floating"}),[d]),{name:"transformOrigin",fn(ue){var io,co,ao;const{elements:Ee,middlewareData:He,placement:De,rects:Xe,y:Jt}=ue,Qt=Ne(De),Bn=Ae(Qt),xt=ye.current,jc=((io=He.arrow)==null?void 0:io.x)||0,kc=((co=He.arrow)==null?void 0:co.y)||0,Mc=(xt==null?void 0:xt.clientWidth)||0,Dc=(xt==null?void 0:xt.clientHeight)||0,$n=jc+Mc/2,so=kc+Dc/2,Ac=Math.abs(((ao=He.shift)==null?void 0:ao.y)||0),Lc=Xe.reference.height/2,Mt=typeof o=="function"?o(Yo(ue,r,D)):o,_c=Ac>Mt,Fc={top:`${$n}px calc(100% + ${Mt}px)`,bottom:`${$n}px ${-Mt}px`,left:`calc(100% + ${Mt}px) ${so}px`,right:`${-Mt}px ${so}px`}[Qt],Vc=`${$n}px ${Xe.reference.y+Lc-Jt}px`;return Ee.floating.style.setProperty("--transform-origin",k&&Bn==="y"&&_c?Vc:Fc),{}}},Pd,E),G(()=>{!f&&p&&p.update({referenceElement:null,floatingElement:null,domReferenceElement:null})},[f,p]);const X=b.useMemo(()=>({elementResize:!l&&typeof ResizeObserver<"u",layoutShift:!l&&typeof IntersectionObserver<"u"}),[l]),{refs:z,elements:Z,x:$,y:te,middlewareData:ie,update:q,placement:Te,context:ge,isPositioned:xe,floatingStyles:Fe}=od({rootContext:p,placement:L,middleware:he,strategy:n,whileElementsMounted:g?void 0:(...ue)=>Mo(...ue,X),nodeId:x,externalTree:y}),{sideX:ht,sideY:bt}=ie.adaptiveOrigin||bn,we=xe?n:"fixed",Ce=b.useMemo(()=>{const ue=E?{position:we,[ht]:$,[bt]:te}:{position:we,...Fe};return xe||(ue.opacity=0),ue},[E,we,ht,$,bt,te,Fe,xe]),Se=b.useRef(null);G(()=>{if(!f)return;const ue=N.current,Ee=typeof ue=="function"?ue():ue,De=(Ko(Ee)?Ee.current:Ee)||null||null;De!==Se.current&&(z.setPositionReference(De),Se.current=De)},[f,z,R,N]),b.useEffect(()=>{if(!f)return;const ue=N.current;typeof ue!="function"&&Ko(ue)&&ue.current!==Se.current&&(z.setPositionReference(ue.current),Se.current=ue.current)},[f,z,R,N]),b.useEffect(()=>{if(g&&f&&Z.domReference&&Z.floating)return Mo(Z.domReference,Z.floating,q,X)},[g,f,Z,q,X]);const $e=Ne(Te),Zt=Ai(r,$e,D),Qr=ot(Te)||"center",eo=!!((ro=ie.hide)!=null&&ro.referenceHidden);G(()=>{w&&f&&xe&&S($e)},[w,f,xe,$e]);const to=b.useMemo(()=>{var ue,Ee;return{position:"absolute",top:(ue=ie.arrow)==null?void 0:ue.y,left:(Ee=ie.arrow)==null?void 0:Ee.x}},[ie.arrow]),no=((oo=ie.arrow)==null?void 0:oo.centerOffset)!==0;return b.useMemo(()=>({positionerStyles:Ce,arrowStyles:to,arrowRef:ye,arrowUncentered:no,side:Zt,align:Qr,physicalSide:$e,anchorHidden:eo,refs:z,context:ge,isPositioned:xe,update:q}),[Ce,to,ye,no,Zt,Qr,$e,eo,z,ge,xe,q])}function Ko(e){return e!=null&&"current"in e}function Li(e){return e==="starting"?Za:Re}const _i=b.forwardRef(function(t,n){const{render:r,className:o,anchor:s,positionMethod:i="absolute",side:c="top",align:u="center",sideOffset:a=0,alignOffset:d=0,collisionBoundary:l="clipping-ancestors",collisionPadding:g=5,arrowPadding:p=5,sticky:f=!1,disableAnchorTracking:h=!1,collisionAvoidance:v=Ja,...x}=t,E=Wt(),w=Od(),y=E.useState("open"),T=E.useState("mounted"),S=E.useState("trackCursorAxis"),C=E.useState("disableHoverablePopup"),O=E.useState("floatingRootContext"),P=E.useState("instantType"),_=E.useState("transitionStatus"),j=E.useState("hasViewport"),R=kd({anchor:s,positionMethod:i,floatingRootContext:O,mounted:T,side:c,sideOffset:a,align:u,alignOffset:d,collisionBoundary:l,collisionPadding:g,sticky:f,arrowPadding:p,disableAnchorTracking:h,keepMounted:w,collisionAvoidance:v,adaptiveOrigin:j?jd:void 0}),N=b.useMemo(()=>{const L={};return(!y||S==="both"||C)&&(L.pointerEvents="none"),{role:"presentation",hidden:!T,style:{...R.positionerStyles,...L}}},[y,S,C,T,R.positionerStyles]),Y=b.useMemo(()=>({open:y,side:R.side,align:R.align,anchorHidden:R.anchorHidden,instant:S!=="none"?"tracking-cursor":P}),[y,R.side,R.align,R.anchorHidden,S,P]),D=b.useMemo(()=>({...Y,arrowRef:R.arrowRef,arrowStyles:R.arrowStyles,arrowUncentered:R.arrowUncentered}),[Y,R.arrowRef,R.arrowStyles,R.arrowUncentered]),B=Pe("div",t,{state:Y,props:[N,Li(_),x],ref:[n,E.useStateSetter("positionerElement")],stateAttributesMapping:Gt});return m.jsx(Hr.Provider,{value:D,children:B})});process.env.NODE_ENV!=="production"&&(_i.displayName="TooltipPositioner");const Md={...Gt,...Ln},Fi=b.forwardRef(function(t,n){const{className:r,render:o,...s}=t,i=Wt(),{side:c,align:u}=Mi(),a=i.useState("open"),d=i.useState("instantType"),l=i.useState("transitionStatus"),g=i.useState("popupProps"),p=i.useState("floatingRootContext");_n({open:a,ref:i.context.popupRef,onComplete(){var E,w;a&&((w=(E=i.context).onOpenChangeComplete)==null||w.call(E,!0))}});const f=i.useState("disabled"),h=i.useState("closeDelay");return ld(p,{enabled:!f,closeDelay:h}),Pe("div",t,{state:{open:a,side:c,align:u,instant:d,transitionStatus:l},ref:[n,i.context.popupRef,i.useStateSetter("popupElement")],props:[g,Li(l),s],stateAttributesMapping:Md})});process.env.NODE_ENV!=="production"&&(Fi.displayName="TooltipPopup");const Vi=b.forwardRef(function(t,n){const{className:r,render:o,...s}=t,c=Wt().useState("instantType"),{open:u,arrowRef:a,side:d,align:l,arrowUncentered:g,arrowStyles:p}=Mi();return Pe("div",t,{state:{open:u,side:d,align:l,uncentered:g,instant:c},ref:[n,a],props:[{style:p,"aria-hidden":!0},s],stateAttributesMapping:Gt})});process.env.NODE_ENV!=="production"&&(Vi.displayName="TooltipArrow");function Bi(e){return jr(19)?e:e?"true":void 0}function $i({...e}){return m.jsx(Ci,{...e})}function Hi({...e}){return m.jsx(Pi,{...e})}function zi({className:e,sideOffset:t=8,children:n,...r}){return m.jsx(ki,{children:m.jsx(_i,{sideOffset:t,children:m.jsxs(Fi,{"data-slot":"tooltip-content",className:V("bg-primary text-primary-foreground z-50 max-w-60 rounded-md px-2.5 py-1.5 text-xs leading-snug shadow-md","data-[starting-style]:opacity-0 data-[ending-style]:opacity-0 transition-opacity",e),...r,children:[n,m.jsx(Vi,{className:"fill-primary [&>path]:stroke-primary"})]})})})}const Dd={current:"bg-primary text-primary-foreground border-primary",flagged:"bg-warning/10 text-warning border-warning/30",answered:"bg-success/10 text-success border-success/30",default:"bg-background text-muted-foreground border-border"},Ad=(e,t)=>e.uid===t?"current":e.isFlagged?"flagged":e.isAnswered?"answered":"default",Wi=({questions:e,currentQuestionUid:t,onNavigate:n,onToggleFlag:r,readOnly:o=!1})=>{const s=i=>{const c=[`Question ${i.sequence+1}`];return i.isFlagged&&c.push("Flagged"),i.isAnswered&&c.push("Answered"),i.isSkipped&&c.push("Skipped"),c.join(" · ")};return m.jsx("div",{className:"flex flex-wrap gap-1.5",children:e.map(i=>{const c=Ad(i,t);return m.jsxs("div",{title:s(i),className:V("inline-flex items-center gap-1 px-2 py-1 rounded-md border transition-all duration-150",Dd[c],o?"cursor-default":"cursor-pointer hover:shadow-sm hover:-translate-y-px"),onClick:o?void 0:()=>n==null?void 0:n(i.uid),children:[m.jsx("span",{className:"text-xs font-semibold min-w-4 text-center",children:i.sequence+1}),!o&&r&&m.jsxs($i,{children:[m.jsx(Hi,{render:m.jsx("span",{role:"button","aria-label":i.isFlagged?"Unflag question":"Flag question",className:V("inline-flex cursor-pointer transition-colors duration-150",i.isFlagged?"text-warning":"text-muted-foreground hover:text-warning"),onClick:u=>{u.stopPropagation(),r(i.uid)},children:m.jsx(U.Flag,{size:11,fill:i.isFlagged?"currentColor":"none"})})}),m.jsx(zi,{children:i.isFlagged?"Unflag question":"Flag question"})]})]},i.uid)})})};function Ui({children:e,...t}){return b.isValidElement(e)?b.cloneElement(e,{...Ld(t,e.props),ref:e.ref}):(b.Children.count(e)>1&&b.Children.only(null),null)}function Ld(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];r==="style"?n[r]={...o,...s}:r==="className"?n[r]=[o,s].filter(Boolean).join(" "):typeof o=="function"&&typeof s=="function"&&(n[r]=(...i)=>{s(...i),o(...i)})}return{...e,...n}}const Vn=zt.cva("inline-flex shrink-0 items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-all outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:bg-destructive/60 dark:focus-visible:ring-destructive/40",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",xs:"h-6 gap-1 rounded-md px-2 text-xs has-[>svg]:px-1.5 [&_svg:not([class*='size-'])]:size-3",sm:"h-8 gap-1.5 rounded-md px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9","icon-xs":"size-6 rounded-md [&_svg:not([class*='size-'])]:size-3","icon-sm":"size-8","icon-lg":"size-10"}},defaultVariants:{variant:"default",size:"default"}});function dt({className:e,variant:t="default",size:n="default",asChild:r=!1,...o}){const s=r?Ui:"button";return m.jsx(s,{"data-slot":"button",className:V(Vn({variant:t,size:n,className:e})),...o})}const _d=({currentQuestionIndex:e,totalQuestions:t,hasNext:n,hasPrevious:r,onNext:o,onPrevious:s,onSubmit:i,timeElapsedSeconds:c,timeLimitSeconds:u,questions:a,onNavigateToQuestion:d,onToggleFlag:l,currentQuestionUid:g,isCompleted:p=!1,isSubmitting:f=!1,readOnly:h=!1})=>{const v=c!=null&&c>=0,x=a&&a.length>0;return m.jsxs("div",{className:"rounded-lg border border-border overflow-hidden shadow-sm",children:[m.jsxs("div",{className:"flex items-center justify-between px-4 py-2.5 bg-muted border-b border-border",children:[m.jsxs("span",{className:"text-sm font-medium text-foreground",children:["Question"," ",m.jsx("span",{className:"font-bold",children:e+1})," ","of ",t]}),v&&m.jsx(hs,{timeElapsedSeconds:c,timeLimitSeconds:u})]}),x&&m.jsx("div",{className:"px-4 py-3 border-b border-border",children:m.jsx(Wi,{questions:a,currentQuestionUid:g,onNavigate:d,onToggleFlag:l,readOnly:h})}),m.jsxs("div",{className:"flex items-center justify-between gap-2 px-4 py-3",children:[m.jsxs(dt,{variant:"outline",size:"sm",className:"rounded-lg",disabled:!r||h,onClick:s,children:[m.jsx(U.ChevronLeft,{size:16})," Previous"]}),!n||p?m.jsxs(dt,{variant:p?"secondary":"default",size:"sm",className:"rounded-lg",onClick:i,disabled:h||f,children:[f?"Submitting...":p?"Review":"Submit",!f&&m.jsx(U.Send,{size:14})]}):m.jsxs(dt,{size:"sm",className:"rounded-lg",disabled:!n||h,onClick:o,children:["Next ",m.jsx(U.ChevronRight,{size:16})]})]})]})},Go={color1:{bg:"bg-blue-50 dark:bg-blue-950/40",border:"border-blue-200 dark:border-blue-800",accent:"bg-blue-200 dark:bg-blue-800"},color2:{bg:"bg-violet-50 dark:bg-violet-950/40",border:"border-violet-200 dark:border-violet-800",accent:"bg-violet-200 dark:bg-violet-800"},color3:{bg:"bg-emerald-50 dark:bg-emerald-950/40",border:"border-emerald-200 dark:border-emerald-800",accent:"bg-emerald-200 dark:bg-emerald-800"},color4:{bg:"bg-amber-50 dark:bg-amber-950/40",border:"border-amber-200 dark:border-amber-800",accent:"bg-amber-200 dark:bg-amber-800"},color5:{bg:"bg-rose-50 dark:bg-rose-950/40",border:"border-rose-200 dark:border-rose-800",accent:"bg-rose-200 dark:bg-rose-800"},color6:{bg:"bg-green-50 dark:bg-green-950/40",border:"border-green-200 dark:border-green-800",accent:"bg-green-200 dark:bg-green-800"}},Fd={small:{width:280,height:180,fontSize:"0.875rem"},medium:{width:400,height:260,fontSize:"1rem"},large:{width:520,height:340,fontSize:"1.125rem"}},Yi=({card:e,isFlipped:t,onFlip:n,readOnly:r=!1,size:o="medium"})=>{const[s,i]=re.useState(!1),c=t!==void 0,u=c?t:s,a=()=>{r||(c||i(f=>!f),n==null||n())},{width:d,height:l,fontSize:g}=Fd[o],p=Go[e.color]||Go.color1;return m.jsx("div",{className:"perspective-[1000px]",style:{width:`${d}px`,height:`${l}px`},children:m.jsxs("div",{className:V("relative size-full transition-transform duration-500 transform-3d",u&&"transform-[rotateY(180deg)]"),children:[m.jsxs("div",{className:V("absolute inset-0 flex flex-col rounded-lg border backface-hidden",p.bg,p.border,!r&&"cursor-pointer"),onClick:a,children:[m.jsx("div",{className:"flex flex-1 items-center justify-center p-5 overflow-auto",children:m.jsx("div",{className:"text-center",style:{fontSize:g},dangerouslySetInnerHTML:{__html:e.front}})}),!r&&m.jsxs("div",{className:"flex items-center justify-center gap-1 pb-3 text-muted-foreground",children:[m.jsx(U.RotateCcw,{size:12}),m.jsx("span",{className:"text-xs",children:"Tap to flip"})]})]}),m.jsxs("div",{className:V("absolute inset-0 flex flex-col rounded-lg border border-border bg-background backface-hidden transform-[rotateY(180deg)]",!r&&"cursor-pointer"),onClick:a,children:[m.jsx("div",{className:V("h-1.5 rounded-t-lg",p.accent)}),m.jsx("div",{className:"flex flex-1 items-center justify-center p-5 overflow-auto",children:m.jsx("div",{className:"text-center",style:{fontSize:g},dangerouslySetInnerHTML:{__html:e.back}})}),!r&&m.jsxs("div",{className:"flex items-center justify-center gap-1 pb-3 text-muted-foreground",children:[m.jsx(U.RotateCcw,{size:12}),m.jsx("span",{className:"text-xs",children:"Tap to flip back"})]})]})]})})};function Vd(e){const t=[...e];for(let n=t.length-1;n>0;n--){const r=Math.floor(Math.random()*(n+1));[t[n],t[r]]=[t[r],t[n]]}return t}const Ki=({cards:e,deckName:t,deckDescription:n,currentIndex:r,onNavigate:o,onComplete:s,readOnly:i=!1,showProgress:c=!0,shuffled:u=!1})=>{const a=re.useMemo(()=>u?Vd(e):e,[e,u]),[d,l]=re.useState(0),[g,p]=re.useState(!1),f=r!==void 0,h=f?r:d,v=a[h],x=h>0,E=h<a.length-1,w=C=>{p(!1),f?o==null||o(C):l(C)},y=()=>{x&&w(h-1)},T=()=>{E?w(h+1):s==null||s()};if(!a.length)return m.jsx("span",{className:"text-sm text-muted-foreground",children:"No flashcards in this deck."});const S=(h+1)/a.length*100;return m.jsxs("div",{className:"flex flex-col gap-4",children:[(t||n)&&m.jsxs("div",{className:"flex flex-col gap-0.5",children:[t&&m.jsx("span",{className:"text-lg font-semibold",children:t}),n&&m.jsx("span",{className:"text-sm text-muted-foreground",children:n})]}),v&&m.jsx(Yi,{card:v,isFlipped:g,onFlip:()=>p(C=>!C),readOnly:i}),c&&m.jsxs("div",{className:"flex items-center gap-2",children:[m.jsx("div",{className:"flex-1 h-1.5 rounded-full bg-muted overflow-hidden",children:m.jsx("div",{className:"h-full rounded-full bg-primary transition-[width] duration-300",style:{width:`${S}%`}})}),m.jsxs("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:[h+1," of ",a.length]})]}),m.jsxs("div",{className:"flex items-center justify-between gap-3",children:[m.jsxs(dt,{variant:"outline",size:"sm",className:"rounded-lg",disabled:!x,onClick:y,children:[m.jsx(U.ChevronLeft,{size:16})," Previous"]}),m.jsxs(dt,{size:"sm",className:"rounded-lg",onClick:T,children:[E?"Next":"Finish"," ",m.jsx(U.ChevronRight,{size:16})]})]})]})},Bd={video:U.Video,video_lesson:U.Video,stream:U.PlayCircle,document:U.FileText,pdf:U.FileText,page:U.FileText,quiz:U.HelpCircle,assessment:U.HelpCircle,assignment:U.ClipboardList,discussion:U.MessageSquare,link:U.ExternalLink,url:U.ExternalLink,audio:U.Music,image:U.Image,scorm:U.Code,iframe:U.Code,lesson:U.BookOpen,module:U.BookOpen},Gi=({type:e,size:t=18})=>{const n=Bd[e]??U.FileText;return m.jsx(n,{size:t})},Xi=({item:e,level:t,isActive:n=!1,isCompleted:r=!1,isExpanded:o=!1,hasChildren:s,onToggleExpand:i,onClick:c,showDuration:u=!0,showIcon:a=!0,showProgress:d=!0})=>{const l=s,g=l?"font-semibold":n?"font-medium":"font-normal";return m.jsxs("div",{className:V("flex items-center gap-2 py-2 pr-3 transition-colors",c&&"cursor-pointer hover:bg-muted",n&&"bg-secondary"),style:{paddingLeft:`${t*20+8}px`},onClick:c,children:[m.jsx("div",{className:"shrink-0 flex items-center justify-center size-5",children:d&&r?m.jsx("span",{className:"text-success",children:m.jsx(U.CheckCircle2,{size:18})}):a?m.jsx("span",{className:n?"text-primary":"text-muted-foreground",children:m.jsx(Gi,{type:e.type,size:16})}):m.jsx("span",{className:"text-muted-foreground",children:m.jsx(U.Circle,{size:16})})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("div",{className:V("text-sm truncate",n?"text-primary":"text-foreground",g),children:e.name}),u&&e.duration>0&&!l&&m.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:ms(e.duration)})]}),s&&m.jsx("button",{className:"inline-flex items-center justify-center rounded-md p-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":o?"Collapse":"Expand",onClick:p=>{p.stopPropagation(),i==null||i()},children:o?m.jsx(U.ChevronDown,{size:16}):m.jsx(U.ChevronRight,{size:16})})]})},$d=({items:e,progress:t,activeItemUid:n,onItemClick:r,readOnly:o=!1,showDuration:s=!0,showIcons:i=!0,showProgress:c=!0})=>{const[u,a]=re.useState({});if(!e||e.length===0)return null;const d=p=>{a(f=>({...f,[p]:!f[p]}))},l=p=>!t||!c?!1:t.some(f=>f.resourceUid===p&&f.isCompleted),g=(p,f)=>m.jsx("div",{className:"flex flex-col",children:p.map(h=>{var E;const v=!!((E=h.children)!=null&&E.length),x=u[h.uid]||!1;return m.jsxs("div",{children:[m.jsx(Xi,{item:h,level:f,isActive:n===h.uid,isCompleted:l(h.uid),isExpanded:x,hasChildren:v,onToggleExpand:()=>d(h.uid),onClick:o?void 0:()=>r==null?void 0:r(h),showDuration:s,showIcon:i,showProgress:c}),v&&x&&g(h.children,f+1)]},h.uid)})});return m.jsx("nav",{className:"rounded-lg border border-border overflow-hidden",children:g(e,0)})},qi=({src:e,poster:t,title:n,autoPlay:r=!1,onPlay:o,onPause:s,onEnded:i,onTimeUpdate:c,readOnly:u=!1,aspectRatio:a="16/9",className:d,style:l})=>{const g=re.useRef(null),p=()=>{const f=g.current;f&&c&&c(f.currentTime,f.duration)};return e?u?m.jsxs("div",{className:V("relative overflow-hidden rounded-lg",d),style:{aspectRatio:a,...l},children:[t?m.jsx("img",{src:t,alt:n||"Video poster",style:{width:"100%",height:"100%",objectFit:"cover"}}):m.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-muted",children:m.jsx("div",{className:"flex items-center justify-center size-14 rounded-full bg-black/60",children:m.jsx(U.Play,{size:28,className:"text-white ml-0.5"})})}),t&&m.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/30 transition-opacity",children:m.jsx("div",{className:"flex items-center justify-center size-14 rounded-full bg-black/60",children:m.jsx(U.Play,{size:28,className:"text-white ml-0.5"})})}),n&&m.jsx("div",{className:"absolute bottom-0 left-0 right-0 bg-linear-to-t from-black/60 to-transparent p-2",children:m.jsx("span",{className:"text-sm text-white font-medium",children:n})})]}):m.jsxs("div",{className:d,style:l,children:[n&&m.jsx("p",{className:"mb-2 text-sm font-medium",children:n}),m.jsx("div",{className:"rounded-lg overflow-hidden",children:m.jsx("video",{ref:g,src:e,poster:t,controls:!0,autoPlay:r,onPlay:o,onPause:s,onEnded:i,onTimeUpdate:p,style:{width:"100%",aspectRatio:a,display:"block"}})})]}):m.jsx("div",{className:V("relative overflow-hidden rounded-lg border border-border bg-muted",d),style:{aspectRatio:a,...l},children:m.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-2",children:[m.jsx("div",{className:"flex items-center justify-center size-12 rounded-full bg-muted-foreground/10",children:m.jsx(U.Video,{size:24})}),m.jsx("span",{className:"text-sm text-muted-foreground",children:"No video source provided"})]})})};function Hd({icon:e,title:t,description:n,action:r,className:o,style:s}){return m.jsxs("div",{className:V("flex flex-col items-center justify-center text-center px-3 py-6",o),style:s,children:[e&&m.jsx("div",{className:"mb-2 text-muted-foreground [&>svg]:size-12",children:e}),m.jsx("p",{className:"text-lg font-semibold text-foreground mb-1",children:t}),n&&m.jsx("p",{className:V("text-sm text-muted-foreground max-w-[360px]",r&&"mb-2"),children:n}),r]})}const Wr=b.createContext(void 0);process.env.NODE_ENV!=="production"&&(Wr.displayName="DialogRootContext");function mt(e){const t=b.useContext(Wr);if(e===!1&&t===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: DialogRootContext is missing. Dialog parts must be placed within <Dialog.Root>.":Le(27));return t}const zd={...Gt,...Ln},Zi=b.forwardRef(function(t,n){const{render:r,className:o,forceRender:s=!1,...i}=t,{store:c}=mt(),u=c.useState("open"),a=c.useState("nested"),d=c.useState("mounted"),l=c.useState("transitionStatus");return Pe("div",t,{state:{open:u,transitionStatus:l},ref:[c.context.backdropRef,n],stateAttributesMapping:zd,props:[{role:"presentation",hidden:!d,style:{userSelect:"none",WebkitUserSelect:"none"}},i],enabled:s||!a})});process.env.NODE_ENV!=="production"&&(Zi.displayName="DialogBackdrop");let yr;process.env.NODE_ENV!=="production"&&(yr=new Set);function Xo(...e){if(process.env.NODE_ENV!=="production"){const t=e.join(" ");yr.has(t)||(yr.add(t),console.error(`Base UI: ${t}`))}}const Ur=b.createContext(void 0);process.env.NODE_ENV!=="production"&&(Ur.displayName="CompositeRootContext");function Ji(e=!1){const t=b.useContext(Ur);if(t===void 0&&!e)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: CompositeRootContext is missing. Composite parts must be placed within <Composite.Root>.":Le(16));return t}function Wd(e){const{focusableWhenDisabled:t,disabled:n,composite:r=!1,tabIndex:o=0,isNativeButton:s}=e,i=r&&t!==!1,c=r&&t===!1;return{props:b.useMemo(()=>{const a={onKeyDown(d){n&&t&&d.key!=="Tab"&&d.preventDefault()}};return r||(a.tabIndex=o,!s&&n&&(a.tabIndex=t?o:-1)),(s&&(t||i)||!s&&n)&&(a["aria-disabled"]=n),s&&(!t||c)&&(a.disabled=n),a},[r,n,t,i,c,s,o])}}function Qi(e={}){const{disabled:t=!1,focusableWhenDisabled:n,tabIndex:r=0,native:o=!0}=e,s=b.useRef(null),i=Ji(!0)!==void 0,c=W(()=>{const g=s.current;return!!((g==null?void 0:g.tagName)==="A"&&(g!=null&&g.href))}),{props:u}=Wd({focusableWhenDisabled:n,disabled:t,composite:i,tabIndex:r,isNativeButton:o});process.env.NODE_ENV!=="production"&&b.useEffect(()=>{var p,f;if(!s.current)return;const g=s.current.tagName==="BUTTON";if(o){if(!g){const h=((p=ct.captureOwnerStack)==null?void 0:p.call(ct))||"";Xo(`A component that acts as a button expected a native <button> because the \`nativeButton\` prop is true. Rendering a non-<button> removes native button semantics, which can impact forms and accessibility. Use a real <button> in the \`render\` prop, or set \`nativeButton\` to \`false\`.${h}`)}}else if(g){const h=((f=ct.captureOwnerStack)==null?void 0:f.call(ct))||"";Xo(`A component that acts as a button expected a non-<button> because the \`nativeButton\` prop is false. Rendering a <button> keeps native behavior while Base UI applies non-native attributes and handlers, which can add unintended extra attributes (such as \`role\` or \`aria-disabled\`). Use a non-<button> in the \`render\` prop, or set \`nativeButton\` to \`true\`.${h}`)}},[o]);const a=b.useCallback(()=>{const g=s.current;Ud(g)&&i&&t&&u.disabled===void 0&&g.disabled&&(g.disabled=!1)},[t,u.disabled,i]);G(a,[a]);const d=b.useCallback((g={})=>{const{onClick:p,onMouseDown:f,onKeyUp:h,onKeyDown:v,onPointerDown:x,...E}=g;return Qs({type:o?"button":void 0,onClick(y){if(t){y.preventDefault();return}p==null||p(y)},onMouseDown(y){t||f==null||f(y)},onKeyDown(y){if(t||(xr(y),v==null||v(y)),y.baseUIHandlerPrevented)return;const T=y.target===y.currentTarget&&!o&&!c()&&!t,S=y.key==="Enter",C=y.key===" ";T&&((C||S)&&y.preventDefault(),S&&(p==null||p(y)))},onKeyUp(y){t||(xr(y),h==null||h(y)),!y.baseUIHandlerPrevented&&y.target===y.currentTarget&&!o&&!t&&y.key===" "&&(p==null||p(y))},onPointerDown(y){if(t){y.preventDefault();return}x==null||x(y)}},o?void 0:{role:"button"},u,E)},[t,u,o,c]),l=W(g=>{s.current=g,a()});return{getButtonProps:d,buttonRef:l}}function Ud(e){return be(e)&&e.tagName==="BUTTON"}const ec=b.forwardRef(function(t,n){const{render:r,className:o,id:s,...i}=t,{store:c}=mt(),u=kt(s);return c.useSyncedValueWithCleanup("descriptionElementId",u),Pe("p",t,{ref:n,props:[{id:u},i]})});process.env.NODE_ENV!=="production"&&(ec.displayName="DialogDescription");let Yd=(function(e){return e.nestedDialogs="--nested-dialogs",e})({}),Kd=(function(e){return e[e.open=at.open]="open",e[e.closed=at.closed]="closed",e[e.startingStyle=at.startingStyle]="startingStyle",e[e.endingStyle=at.endingStyle]="endingStyle",e.nested="data-nested",e.nestedDialogOpen="data-nested-dialog-open",e})({});const Yr=b.createContext(void 0);process.env.NODE_ENV!=="production"&&(Yr.displayName="DialogPortalContext");function Gd(){const e=b.useContext(Yr);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Portal> is missing.":Le(26));return e}const wt="ArrowUp",lt="ArrowDown",Ht="ArrowLeft",St="ArrowRight",Xt="Home",qt="End",tc=new Set([Ht,St]),Xd=new Set([Ht,St,Xt,qt]),nc=new Set([wt,lt]),qd=new Set([wt,lt,Xt,qt]),rc=new Set([...tc,...nc]),Zd=new Set([...rc,Xt,qt]),Jd=new Set([wt,lt,Ht,St,Xt,qt]),Qd="Shift",ef="Control",tf="Alt",nf="Meta",rf=new Set([Qd,ef,tf,nf]);function of(e){return be(e)&&e.tagName==="INPUT"}function qo(e){return!!(of(e)&&e.selectionStart!=null||be(e)&&e.tagName==="TEXTAREA")}function Zo(e,t,n,r){if(!e||!t||!t.scrollTo)return;let o=e.scrollLeft,s=e.scrollTop;const i=e.clientWidth<e.scrollWidth,c=e.clientHeight<e.scrollHeight;if(i&&r!=="vertical"){const u=Jo(e,t,"left"),a=dn(e),d=dn(t);n==="ltr"&&(u+t.offsetWidth+d.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight?o=u+t.offsetWidth+d.scrollMarginRight-e.clientWidth+a.scrollPaddingRight:u-d.scrollMarginLeft<e.scrollLeft+a.scrollPaddingLeft&&(o=u-d.scrollMarginLeft-a.scrollPaddingLeft)),n==="rtl"&&(u-d.scrollMarginRight<e.scrollLeft+a.scrollPaddingLeft?o=u-d.scrollMarginLeft-a.scrollPaddingLeft:u+t.offsetWidth+d.scrollMarginRight>e.scrollLeft+e.clientWidth-a.scrollPaddingRight&&(o=u+t.offsetWidth+d.scrollMarginRight-e.clientWidth+a.scrollPaddingRight))}if(c&&r!=="horizontal"){const u=Jo(e,t,"top"),a=dn(e),d=dn(t);u-d.scrollMarginTop<e.scrollTop+a.scrollPaddingTop?s=u-d.scrollMarginTop-a.scrollPaddingTop:u+t.offsetHeight+d.scrollMarginBottom>e.scrollTop+e.clientHeight-a.scrollPaddingBottom&&(s=u+t.offsetHeight+d.scrollMarginBottom-e.clientHeight+a.scrollPaddingBottom)}e.scrollTo({left:o,top:s,behavior:"auto"})}function Jo(e,t,n){const r=n==="left"?"offsetLeft":"offsetTop";let o=0;for(;t.offsetParent&&(o+=t[r],t.offsetParent!==e);)t=t.offsetParent;return o}function dn(e){const t=getComputedStyle(e);return{scrollMarginTop:parseFloat(t.scrollMarginTop)||0,scrollMarginRight:parseFloat(t.scrollMarginRight)||0,scrollMarginBottom:parseFloat(t.scrollMarginBottom)||0,scrollMarginLeft:parseFloat(t.scrollMarginLeft)||0,scrollPaddingTop:parseFloat(t.scrollPaddingTop)||0,scrollPaddingRight:parseFloat(t.scrollPaddingRight)||0,scrollPaddingBottom:parseFloat(t.scrollPaddingBottom)||0,scrollPaddingLeft:parseFloat(t.scrollPaddingLeft)||0}}const sf={...Gt,...Ln,nestedDialogOpen(e){return e?{[Kd.nestedDialogOpen]:""}:null}},oc=b.forwardRef(function(t,n){const{className:r,finalFocus:o,initialFocus:s,render:i,...c}=t,{store:u}=mt(),a=u.useState("descriptionElementId"),d=u.useState("disablePointerDismissal"),l=u.useState("floatingRootContext"),g=u.useState("popupProps"),p=u.useState("modal"),f=u.useState("mounted"),h=u.useState("nested"),v=u.useState("nestedOpenDialogCount"),x=u.useState("open"),E=u.useState("openMethod"),w=u.useState("titleElementId"),y=u.useState("transitionStatus"),T=u.useState("role");Gd(),_n({open:x,ref:u.context.popupRef,onComplete(){var j,R;x&&((R=(j=u.context).onOpenChangeComplete)==null||R.call(j,!0))}});function S(j){return j==="touch"?u.context.popupRef.current:!0}const C=s===void 0?S:s,O=v>0,_=Pe("div",t,{state:{open:x,nested:h,transitionStatus:y,nestedDialogOpen:O},props:[g,{"aria-labelledby":w??void 0,"aria-describedby":a??void 0,role:T,tabIndex:-1,hidden:!f,onKeyDown(j){Jd.has(j.key)&&j.stopPropagation()},style:{[Yd.nestedDialogs]:v}},c],ref:[n,u.context.popupRef,u.useStateSetter("popupElement")],stateAttributesMapping:sf});return m.jsx(Nl,{context:l,openInteractionType:E,disabled:!f,closeOnFocusOut:!d,initialFocus:C,returnFocus:o,modal:p!==!1,restoreFocus:"popup",children:_})});process.env.NODE_ENV!=="production"&&(oc.displayName="DialogPopup");const sc=b.forwardRef(function(t,n){const{cutout:r,...o}=t;let s;if(r){const i=r==null?void 0:r.getBoundingClientRect();s=`polygon(
|
|
44
|
-
0% 0%,
|
|
45
|
-
100% 0%,
|
|
46
|
-
100% 100%,
|
|
47
|
-
0% 100%,
|
|
48
|
-
0% 0%,
|
|
49
|
-
${i.left}px ${i.top}px,
|
|
50
|
-
${i.left}px ${i.bottom}px,
|
|
51
|
-
${i.right}px ${i.bottom}px,
|
|
52
|
-
${i.right}px ${i.top}px,
|
|
53
|
-
${i.left}px ${i.top}px
|
|
54
|
-
)`}return m.jsx("div",{ref:n,role:"presentation","data-base-ui-inert":"",...o,style:{position:"fixed",inset:0,userSelect:"none",WebkitUserSelect:"none",clipPath:s}})});process.env.NODE_ENV!=="production"&&(sc.displayName="InternalBackdrop");const ic=b.forwardRef(function(t,n){const{keepMounted:r=!1,...o}=t,{store:s}=mt(),i=s.useState("mounted"),c=s.useState("modal"),u=s.useState("open");return i||r?m.jsx(Yr.Provider,{value:r,children:m.jsxs(oi,{ref:n,...o,children:[i&&c===!0&&m.jsx(sc,{ref:s.context.internalBackdropRef,inert:Bi(!u)}),t.children]})}):null});process.env.NODE_ENV!=="production"&&(ic.displayName="DialogPortal");let Qo={},es={},ts="";function cf(e){if(typeof document>"u")return!1;const t=ce(e);return ve(t).innerWidth-t.documentElement.clientWidth>0}function af(e){if(!(typeof CSS<"u"&&CSS.supports&&CSS.supports("scrollbar-gutter","stable"))||typeof document>"u")return!1;const n=ce(e),r=n.documentElement,o=n.body,s=rt(r)?r:o,i=s.style.overflowY,c=r.style.scrollbarGutter;r.style.scrollbarGutter="stable",s.style.overflowY="scroll";const u=s.offsetWidth;s.style.overflowY="hidden";const a=s.offsetWidth;return s.style.overflowY=i,r.style.scrollbarGutter=c,u===a}function lf(e){const t=ce(e),n=t.documentElement,r=t.body,o=rt(n)?n:r,s={overflowY:o.style.overflowY,overflowX:o.style.overflowX};return Object.assign(o.style,{overflowY:"hidden",overflowX:"hidden"}),()=>{Object.assign(o.style,s)}}function uf(e){var g;const t=ce(e),n=t.documentElement,r=t.body,o=ve(n);let s=0,i=0,c=!1;const u=We.create();if(ws&&(((g=o.visualViewport)==null?void 0:g.scale)??1)!==1)return()=>{};function a(){const p=o.getComputedStyle(n),f=o.getComputedStyle(r),x=(p.scrollbarGutter||"").includes("both-edges")?"stable both-edges":"stable";s=n.scrollTop,i=n.scrollLeft,Qo={scrollbarGutter:n.style.scrollbarGutter,overflowY:n.style.overflowY,overflowX:n.style.overflowX},ts=n.style.scrollBehavior,es={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};const E=n.scrollHeight>n.clientHeight,w=n.scrollWidth>n.clientWidth,y=p.overflowY==="scroll"||f.overflowY==="scroll",T=p.overflowX==="scroll"||f.overflowX==="scroll",S=Math.max(0,o.innerWidth-r.clientWidth),C=Math.max(0,o.innerHeight-r.clientHeight),O=parseFloat(f.marginTop)+parseFloat(f.marginBottom),P=parseFloat(f.marginLeft)+parseFloat(f.marginRight),_=rt(n)?n:r;if(c=af(e),c){n.style.scrollbarGutter=x,_.style.overflowY="hidden",_.style.overflowX="hidden";return}Object.assign(n.style,{scrollbarGutter:x,overflowY:"hidden",overflowX:"hidden"}),(E||y)&&(n.style.overflowY="scroll"),(w||T)&&(n.style.overflowX="scroll"),Object.assign(r.style,{position:"relative",height:O||C?`calc(100dvh - ${O+C}px)`:"100dvh",width:P||S?`calc(100vw - ${P+S}px)`:"100vw",boxSizing:"border-box",overflow:"hidden",scrollBehavior:"unset"}),r.scrollTop=s,r.scrollLeft=i,n.setAttribute("data-base-ui-scroll-locked",""),n.style.scrollBehavior="unset"}function d(){Object.assign(n.style,Qo),Object.assign(r.style,es),c||(n.scrollTop=s,n.scrollLeft=i,n.removeAttribute("data-base-ui-scroll-locked"),n.style.scrollBehavior=ts)}function l(){d(),u.request(a)}return a(),o.addEventListener("resize",l),()=>{u.cancel(),d(),typeof o.removeEventListener=="function"&&o.removeEventListener("resize",l)}}class df{constructor(){de(this,"lockCount",0);de(this,"restore",null);de(this,"timeoutLock",Ke.create());de(this,"timeoutUnlock",Ke.create());de(this,"release",()=>{this.lockCount-=1,this.lockCount===0&&this.restore&&this.timeoutUnlock.start(0,this.unlock)});de(this,"unlock",()=>{var t;this.lockCount===0&&this.restore&&((t=this.restore)==null||t.call(this),this.restore=null)})}acquire(t){return this.lockCount+=1,this.lockCount===1&&this.restore===null&&this.timeoutLock.start(0,()=>this.lock(t)),this.release}lock(t){if(this.lockCount===0||this.restore!==null)return;const r=ce(t).documentElement,o=ve(r).getComputedStyle(r).overflowY;if(o==="hidden"||o==="clip"){this.restore=zs;return}const s=Ss||!cf(t);this.restore=s?lf(t):uf(t)}}const ff=new df;function pf(e=!0,t=null){G(()=>{if(e)return ff.acquire(t)},[e,t])}function gf(e){const t=b.useRef(""),n=b.useCallback(o=>{o.defaultPrevented||(t.current=o.pointerType,e(o,o.pointerType))},[e]);return{onClick:b.useCallback(o=>{if(o.detail===0){e(o,"keyboard");return}"pointerType"in o?e(o,o.pointerType):e(o,t.current),t.current=""},[e]),onPointerDown:n}}function mf(e){const[t,n]=b.useState(null),r=W((c,u)=>{e||n(u||(Ss?"touch":""))}),o=b.useCallback(()=>{n(null)},[]),{onClick:s,onPointerDown:i}=gf(r);return b.useMemo(()=>({openMethod:t,reset:o,triggerProps:{onClick:s,onPointerDown:i}}),[t,o,s,i])}function hf(e){const{store:t,parentContext:n,actionsRef:r}=e,o=t.useState("open"),s=t.useState("disablePointerDismissal"),i=t.useState("modal"),c=t.useState("popupElement"),{openMethod:u,triggerProps:a,reset:d}=mf(o);yi(t);const{forceUnmount:l}=Ei(o,t,()=>{d()}),g=W(_=>{const j=ae(_);return j.preventUnmountOnClose=()=>{t.set("preventUnmountingOnClose",!0)},j}),p=b.useCallback(()=>{t.setOpen(!1,g(Ks))},[t,g]);b.useImperativeHandle(r,()=>({unmount:l,close:p}),[l,p]);const f=Ri({popupStore:t,onOpenChange:t.setOpen,treatPopupAsFloatingElement:!0,noEmit:!0}),[h,v]=b.useState(0),x=h===0,E=gd(f),w=pi(f,{outsidePressEvent(){return t.context.internalBackdropRef.current||t.context.backdropRef.current?"intentional":{mouse:i==="trap-focus"?"sloppy":"intentional",touch:"sloppy"}},outsidePress(_){if(!t.context.outsidePressEnabledRef.current||"button"in _&&_.button!==0||"touches"in _&&_.touches.length!==1)return!1;const j=Oe(_);if(x&&!s){const R=j;return i&&(t.context.internalBackdropRef.current||t.context.backdropRef.current)?t.context.internalBackdropRef.current===R||t.context.backdropRef.current===R||ne(R,c)&&!(R!=null&&R.hasAttribute("data-base-ui-portal")):!0}return!1},escapeKey:x});pf(o&&i===!0,c);const{getReferenceProps:y,getFloatingProps:T,getTriggerProps:S}=Vr([E,w]);t.useContextCallback("onNestedDialogOpen",_=>{v(_+1)}),t.useContextCallback("onNestedDialogClose",()=>{v(0)}),b.useEffect(()=>(n!=null&&n.onNestedDialogOpen&&o&&n.onNestedDialogOpen(h),n!=null&&n.onNestedDialogClose&&!o&&n.onNestedDialogClose(),()=>{n!=null&&n.onNestedDialogClose&&o&&n.onNestedDialogClose()}),[o,n,h]);const C=b.useMemo(()=>y(a),[y,a]),O=b.useMemo(()=>S(a),[S,a]),P=b.useMemo(()=>T(),[T]);t.useSyncedValues({openMethod:u,activeTriggerProps:C,inactiveTriggerProps:O,popupProps:P,floatingRootContext:f,nestedOpenDialogCount:h})}const bf={...Si,modal:Q(e=>e.modal),nested:Q(e=>e.nested),nestedOpenDialogCount:Q(e=>e.nestedOpenDialogCount),disablePointerDismissal:Q(e=>e.disablePointerDismissal),openMethod:Q(e=>e.openMethod),descriptionElementId:Q(e=>e.descriptionElementId),titleElementId:Q(e=>e.titleElementId),viewportElement:Q(e=>e.viewportElement),role:Q(e=>e.role)};class xf extends Lr{constructor(n){super(vf(n),{popupRef:b.createRef(),backdropRef:b.createRef(),internalBackdropRef:b.createRef(),outsidePressEnabledRef:{current:!0},triggerElements:new Fn,onOpenChange:void 0,onOpenChangeComplete:void 0},bf);de(this,"setOpen",(n,r)=>{var c,u,a,d;if(r.preventUnmountOnClose=()=>{this.set("preventUnmountingOnClose",!0)},!n&&r.trigger==null&&this.state.activeTriggerId!=null&&(r.trigger=this.state.activeTriggerElement??void 0),(u=(c=this.context).onOpenChange)==null||u.call(c,n,r),r.isCanceled)return;const o={open:n,nativeEvent:r.event,reason:r.reason,nested:this.state.nested};(a=this.state.floatingRootContext.context.events)==null||a.emit("openchange",o);const s={open:n},i=((d=r.trigger)==null?void 0:d.id)??null;(i||n)&&(s.activeTriggerId=i,s.activeTriggerElement=r.trigger??null),this.update(s)})}}function vf(e={}){return{...wi(),modal:!0,disablePointerDismissal:!1,popupElement:null,viewportElement:null,descriptionElementId:void 0,titleElementId:void 0,openMethod:null,nested:!1,nestedOpenDialogCount:0,role:"dialog",...e}}function yf(e){const{children:t,open:n,defaultOpen:r=!1,onOpenChange:o,onOpenChangeComplete:s,disablePointerDismissal:i=!1,modal:c=!0,actionsRef:u,handle:a,triggerId:d,defaultTriggerId:l=null}=e,g=mt(!0),p=!!g,f=Ie(()=>(a==null?void 0:a.store)??new xf({open:r,openProp:n,activeTriggerId:l,triggerIdProp:d,modal:c,disablePointerDismissal:i,nested:p})).current;xs(()=>{n===void 0&&f.state.open===!1&&r===!0&&f.update({open:!0,activeTriggerId:l})}),f.useControlledProp("openProp",n),f.useControlledProp("triggerIdProp",d),f.useSyncedValues({disablePointerDismissal:i,nested:p,modal:c}),f.useContextCallback("onOpenChange",o),f.useContextCallback("onOpenChangeComplete",s);const h=f.useState("payload");hf({store:f,actionsRef:u,parentContext:g==null?void 0:g.store.context});const v=b.useMemo(()=>({store:f}),[f]);return m.jsx(Wr.Provider,{value:v,children:typeof t=="function"?t({payload:h}):t})}const cc=b.forwardRef(function(t,n){const{render:r,className:o,id:s,...i}=t,{store:c}=mt(),u=kt(s);return c.useSyncedValueWithCleanup("titleElementId",u),Pe("h2",t,{ref:n,props:[{id:u},i]})});process.env.NODE_ENV!=="production"&&(cc.displayName="DialogTitle");const ac=b.forwardRef(function(t,n){const{render:r,className:o,disabled:s=!1,nativeButton:i=!0,id:c,payload:u,handle:a,...d}=t,l=mt(!0),g=(a==null?void 0:a.store)??(l==null?void 0:l.store);if(!g)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: <Dialog.Trigger> must be used within <Dialog.Root> or provided with a handle.":Le(79));const p=kt(c),f=g.useState("floatingRootContext"),h=g.useState("isOpenedByTrigger",p),v=b.useRef(null),{registerTrigger:x,isMountedByThisTrigger:E}=vi(p,v,g,{payload:u}),{getButtonProps:w,buttonRef:y}=Qi({disabled:s,native:i}),T=Il(f,{enabled:f!=null}),S=Vr([T]),C={disabled:s,open:h},O=g.useState("triggerProps",E);return Pe("button",t,{state:C,ref:[y,n,x,v],props:[S.getReferenceProps(),O,{[Ws]:"",id:p},d,w],stateAttributesMapping:Ni})});process.env.NODE_ENV!=="production"&&(ac.displayName="DialogTrigger");function lc({...e}){return m.jsx(yf,{...e})}function Ef({...e}){return m.jsx(ac,{...e})}function uc({...e}){return m.jsx(ic,{...e})}function dc({className:e,...t}){return m.jsx(Zi,{"data-slot":"alert-dialog-backdrop",className:V("data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 fixed inset-0 z-50 bg-black/50 transition-opacity",e),...t})}function fc({className:e,children:t,...n}){return m.jsxs(uc,{children:[m.jsx(dc,{}),m.jsx(oc,{"data-slot":"alert-dialog-content",className:V("bg-background data-[ending-style]:opacity-0 data-[starting-style]:opacity-0 data-[ending-style]:scale-95 data-[starting-style]:scale-95 fixed top-1/2 left-1/2 z-50 grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4 rounded-lg border p-6 shadow-lg transition-all",e),...n,children:t})]})}function pc({className:e,...t}){return m.jsx("div",{"data-slot":"alert-dialog-header",className:V("flex flex-col gap-2 text-center sm:text-left",e),...t})}function gc({className:e,...t}){return m.jsx("div",{"data-slot":"alert-dialog-footer",className:V("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...t})}function mc({className:e,...t}){return m.jsx(cc,{"data-slot":"alert-dialog-title",className:V("text-lg font-semibold",e),...t})}function hc({className:e,...t}){return m.jsx(ec,{"data-slot":"alert-dialog-description",className:V("text-muted-foreground text-sm",e),...t})}function bc({className:e,...t}){return m.jsx("button",{className:V(Vn(),e),...t})}function xc({className:e,...t}){return m.jsx("button",{className:V(Vn({variant:"outline"}),e),...t})}const ns={primary:"bg-primary text-primary-foreground hover:bg-primary/90",error:"bg-destructive text-destructive-foreground hover:bg-destructive/90",warning:"bg-warning text-warning-foreground hover:bg-warning/90"};function wf({open:e,title:t,message:n,confirmLabel:r="Confirm",cancelLabel:o="Cancel",confirmColor:s="primary",onConfirm:i,onCancel:c,isLoading:u=!1}){return m.jsx(lc,{open:e,onOpenChange:a=>!a&&c(),children:m.jsxs(fc,{children:[m.jsxs(pc,{children:[m.jsx(mc,{children:t}),typeof n=="string"?m.jsx(hc,{children:n}):n]}),m.jsxs(gc,{children:[m.jsx(xc,{onClick:c,disabled:u,children:o}),m.jsxs(bc,{className:V(ns[s]??ns.primary),onClick:i,disabled:u,children:[u&&m.jsx("span",{className:"inline-block size-4 animate-spin rounded-full border-2 border-current border-t-transparent"}),r]})]})]})})}function Sf({value:e,onChange:t,placeholder:n="Search...",debounceMs:r=300,fullWidth:o=!1,size:s="small",className:i,style:c}){const[u,a]=re.useState(e);re.useEffect(()=>{a(e)},[e]);const d=re.useCallback(Er(t,r),[t,r]);function l(p){const f=p.target.value;a(f),d(f)}function g(){a(""),t("")}return m.jsx("div",{className:V("w-full",i),style:{...c,width:o?"100%":void 0},children:m.jsxs("div",{className:"flex items-center w-full border border-input rounded-md bg-background transition-colors focus-within:border-ring focus-within:ring-ring/50 focus-within:ring-[3px]",children:[m.jsx("span",{className:"flex items-center justify-center px-2 text-muted-foreground shrink-0",children:m.jsx(U.Search,{size:18})}),m.jsx("input",{className:V("flex-1 border-none outline-none bg-transparent text-foreground text-sm min-w-0 placeholder:text-muted-foreground",s==="medium"?"py-2":"py-1.5"),value:u,onChange:l,placeholder:n}),u&&m.jsx("button",{type:"button",className:"inline-flex items-center justify-center p-0.5 mr-1 rounded-md text-muted-foreground cursor-pointer transition-colors hover:bg-muted hover:text-foreground","aria-label":"Clear search",onClick:g,children:m.jsx(U.X,{size:16})})]})})}const vc=zt.cva("inline-flex items-center justify-center rounded-full border px-2.5 py-0.5 text-xs font-medium whitespace-nowrap transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-3",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground",secondary:"border-transparent bg-secondary text-secondary-foreground",destructive:"border-transparent bg-destructive text-destructive-foreground",outline:"text-foreground",success:"border-transparent bg-success/15 text-success",warning:"border-transparent bg-warning/15 text-warning",info:"border-transparent bg-info/15 text-info",muted:"border-transparent bg-muted text-muted-foreground"}},defaultVariants:{variant:"default"}});function yc({className:e,variant:t,asChild:n=!1,...r}){const o=n?Ui:"span";return m.jsx(o,{"data-slot":"badge",className:V(vc({variant:t}),e),...r})}const Rf={graded:"green",submitted:"teal",pending:"gray",missing:"red",late:"orange",excused:"gray",draft:"gray",not_started:"gray",resubmit:"orange"},Tf={success:"green",error:"red",warning:"orange",info:"teal",default:"gray"},Cf={green:"success",red:"destructive",orange:"warning",gray:"muted",teal:"info"},rs={green:"bg-transparent border-success text-success",red:"bg-transparent border-destructive text-destructive",orange:"bg-transparent border-warning text-warning",gray:"bg-transparent border-border text-muted-foreground",teal:"bg-transparent border-info text-info"},Of={green:"bg-success text-success-foreground",red:"bg-destructive text-destructive-foreground",orange:"bg-warning text-warning-foreground",teal:"bg-info text-info-foreground"};function Nf({status:e,colorMap:t,size:n="small",variant:r="filled"}){const o={...Rf};if(t)for(const[a,d]of Object.entries(t))o[a]=Tf[d]??d;const s=o[e]??"gray",i=e.replace(/_/g," ").replace(/\b\w/g,a=>a.toUpperCase()),c=Cf[s]??"muted",u=r==="outlined"?rs[s]??rs.gray:Of[s]??void 0;return m.jsx(yc,{variant:c,className:V(n==="small"?"text-xs px-2 h-5.5":"text-sm px-2.5 h-6.5","leading-none",u),children:i})}const If={success:"text-success",destructive:"text-destructive",warning:"text-warning",muted:"text-muted-foreground"};function Pf(e){const t=new Date,n=e.getTime()-t.getTime(),r=Math.round(n/(1e3*60*60*24));return r===0?"Due today":r===1?"Due tomorrow":r===-1?"Due yesterday":r>1?`Due in ${r} days`:`${Math.abs(r)} days overdue`}function jf(e,t){if(t)return"success";const n=new Date,o=(e.getTime()-n.getTime())/(1e3*60*60*24);return o<0?"destructive":o<2?"warning":"muted"}function kf({dueDate:e,submittedDate:t,showRelative:n=!0,size:r="medium",className:o,style:s}){const i=new Date(e),c=!!t,u=If[jf(i,c)]??"text-muted-foreground",a=r==="small"?14:16;return m.jsxs("div",{className:V("flex items-center gap-1",u,o),style:s,children:[m.jsx("span",{className:"shrink-0 inline-flex",children:c?m.jsx(U.CheckCircle,{size:a}):m.jsx(U.Clock,{size:a})}),m.jsx("span",{className:r==="small"?"text-xs":"text-sm",children:c?`Submitted ${new Date(t).toLocaleDateString()}`:n?Pf(i):i.toLocaleDateString()})]})}function Mf({isCorrect:e,explanation:t,onRetry:n,retryLabel:r="Try Again",className:o,style:s}){return m.jsxs("div",{role:"alert",className:V("flex items-start gap-2 rounded-md border p-3 text-sm",e?"border-success/50 bg-success/5":"border-destructive/50 bg-destructive/5",o),style:s,children:[m.jsx("span",{className:V("shrink-0",e?"text-success":"text-destructive"),children:e?m.jsx(U.CheckCircle,{size:20}):m.jsx(U.XCircle,{size:20})}),m.jsx("div",{className:"flex-1",children:m.jsxs("div",{className:"flex items-start justify-between gap-2",children:[m.jsxs("div",{children:[m.jsx("span",{className:"font-semibold",children:e?"Correct!":"Incorrect"}),t&&m.jsx("p",{className:"mt-1 text-foreground",children:t})]}),!e&&n&&m.jsx("button",{className:"shrink-0 rounded-md border border-border bg-background px-3 py-1 text-sm font-medium transition-colors hover:bg-muted",onClick:n,children:r})]})})]})}function Df({value:e,onChange:t,points:n=5,lowLabel:r="Strongly Disagree",highLabel:o="Strongly Agree",disabled:s=!1,readOnly:i=!1,className:c,style:u}){const a=Array.from({length:n},(l,g)=>g+1),d=!s&&!i;return m.jsxs("div",{className:V("flex flex-col gap-1",c),style:u,children:[m.jsx("div",{className:"flex flex-row",role:"radiogroup",children:a.map(l=>{const g=e===l;return m.jsxs("label",{className:V("flex items-center justify-center border border-border px-1.5 py-2 text-sm transition-colors first:rounded-l-md last:rounded-r-md -ml-px first:ml-0",g?"bg-primary text-primary-foreground border-primary z-10":"bg-background text-foreground",!d&&"opacity-60 cursor-not-allowed",d&&!g&&"cursor-pointer hover:bg-muted"),children:[m.jsx("input",{type:"radio",name:"likert-scale",className:"sr-only",value:l,checked:g,disabled:s,onChange:()=>{d&&t(l)}}),m.jsx("span",{className:"text-sm font-medium",children:l})]},l)})}),m.jsxs("div",{className:"flex justify-between",children:[m.jsx("span",{className:"text-xs text-muted-foreground",children:r}),m.jsx("span",{className:"text-xs text-muted-foreground",children:o})]})]})}const Af={small:18,medium:24,large:32};function Lf({value:e,onChange:t,maxStars:n=5,allowHalf:r=!1,size:o="medium",disabled:s=!1,readOnly:i=!1,className:c,style:u}){const[a,d]=re.useState(null),l=Af[o],g=a??e,p=!s&&!i;function f(h){p&&t(h)}return m.jsx("div",{className:V("inline-flex gap-0.5",c),style:u,onMouseLeave:()=>p&&d(null),children:Array.from({length:n},(h,v)=>{const x=v+1,E=g>=x,w=r&&!E&&g>=x-.5;return m.jsx("button",{type:"button",className:V("inline-flex items-center justify-center rounded-md border-none bg-transparent p-0",p?"cursor-pointer":"cursor-default",E||w?"text-warning":"text-muted-foreground"),disabled:s,onClick:()=>f(x),onMouseEnter:()=>p&&d(x),"aria-label":`Rate ${x} star${x!==1?"s":""}`,children:m.jsx(U.Star,{size:l,fill:E||w?"currentColor":"none",strokeWidth:1.5,style:w?{clipPath:"inset(0 50% 0 0)"}:void 0})},v)})})}function Ec({value:e,size:t=120,strokeWidth:n=8,label:r,color:o,className:s,style:i}){const c=(t-n)/2,u=2*Math.PI*c,a=u-Math.min(Math.max(e,0),100)/100*u,d=t/2;return m.jsxs("div",{className:V("relative inline-flex",s),style:{width:`${t}px`,height:`${t}px`,...i},children:[m.jsxs("svg",{width:t,height:t,children:[m.jsx("circle",{cx:d,cy:d,r:c,fill:"none",stroke:"currentColor",strokeWidth:n,opacity:.15}),m.jsx("circle",{cx:d,cy:d,r:c,fill:"none",stroke:o??"currentColor",strokeWidth:n,strokeDasharray:u,strokeDashoffset:a,strokeLinecap:"round",transform:`rotate(-90 ${d} ${d})`,style:{transition:"stroke-dashoffset 0.4s ease"}})]}),m.jsx("span",{className:"absolute inset-0 flex items-center justify-center font-bold text-foreground",style:{fontSize:`${t*.2}px`},children:r??`${Math.round(e)}%`})]})}const _f={small:48,medium:64,large:96},Ff={small:"0.75rem",medium:"0.875rem",large:"1rem"},Vf={small:"4px",medium:"6px",large:"8px"},Bf={primary:"var(--primary)",success:"var(--success)",warning:"var(--warning)",destructive:"var(--destructive)"};function $f(e,t){return t==null?"primary":e>=t?"success":e>=t*.7?"warning":"destructive"}function Hf({percentage:e,letterGrade:t,variant:n="circular",size:r="medium",passingThreshold:o,showLabel:s=!0,className:i,style:c}){const u=$f(e,o),a=Bf[u]??"var(--primary)";return n==="linear"?m.jsxs("div",{className:V("flex flex-row items-center gap-1",i),style:c,children:[m.jsx("div",{className:"flex-1 bg-muted rounded-full overflow-hidden",style:{height:Vf[r]},children:m.jsx("div",{className:"h-full rounded-full transition-[width] duration-300 ease-in-out",style:{width:`${e}%`,background:a}})}),s&&m.jsx("span",{className:"font-semibold min-w-9",style:{fontSize:Ff[r]},children:t??`${Math.round(e)}%`})]}):m.jsx("div",{className:V("inline-flex flex-col items-center",i),style:c,children:m.jsx(Ec,{value:e,size:_f[r],strokeWidth:r==="small"?4:6,color:a,label:t??`${Math.round(e)}%`})})}const zf={up:"var(--success)",down:"var(--destructive)",flat:"var(--muted-foreground)"},Wf={up:U.TrendingUp,down:U.TrendingDown,flat:U.Minus};function Uf({icon:e,label:t,value:n,subtitle:r,trend:o,className:s,style:i}){const c=o?Wf[o.direction]:null;return m.jsxs("div",{className:V("rounded-md border border-border p-4",s),style:i,children:[e&&m.jsx("div",{className:"mb-1 text-primary [&>svg]:size-6",children:e}),m.jsx("span",{className:"text-xs text-muted-foreground",children:t}),m.jsxs("div",{className:"flex flex-row items-baseline gap-1",children:[m.jsx("span",{className:"text-2xl font-bold",children:n}),o&&c&&m.jsxs("span",{className:"flex flex-row items-center gap-px",style:{color:zf[o.direction]},children:[m.jsx(c,{size:14}),m.jsxs("span",{className:"text-xs font-semibold",children:[o.value>0?"+":"",o.value,"%"]})]})]}),r&&m.jsx("span",{className:"text-xs text-muted-foreground",children:r})]})}const Yf={small:28,medium:36,large:48},Kf={student:"Student",instructor:"Instructor",ta:"Teaching Assistant",admin:"Admin"},Gf={instructor:"var(--primary)",ta:"var(--purple)",admin:"var(--destructive)",student:"var(--muted-foreground)"};function Xf(e){return e.split(" ").filter(Boolean).map(t=>t[0]).slice(0,2).join("").toUpperCase()}function wc({displayName:e,avatarUrl:t,role:n,showRoleBadge:r=!1,size:o="medium",className:s,style:i}){const c=Yf[o],u=c*.4,[a,d]=re.useState(!1),l=r&&n&&n!=="student",g=l?Kf[n]??n:void 0;return m.jsxs("div",{className:V("relative inline-flex",s),style:i,title:g,children:[m.jsx("div",{className:"flex items-center justify-center rounded-full bg-muted text-muted-foreground overflow-hidden",style:{width:`${c}px`,height:`${c}px`,fontSize:`${u}px`},children:t&&!a?m.jsx("img",{className:"size-full object-cover",src:t,alt:e,onError:()=>d(!0)}):m.jsx("span",{children:Xf(e)})}),l&&m.jsx("span",{className:"absolute -bottom-0.5 -right-0.5 size-2.5 rounded-full border-2 border-background",style:{background:Gf[n]??"var(--muted-foreground)"}})]})}function Kr({className:e,orientation:t="horizontal",decorative:n=!0,...r}){return m.jsx("div",{"data-slot":"separator",role:n?"none":"separator","aria-orientation":n?void 0:t,className:V("bg-border shrink-0",t==="horizontal"?"h-px w-full":"h-full w-px",e),...r})}function qf(e){const t=new Date(e),r=new Date().getTime()-t.getTime(),o=Math.floor(r/6e4);if(o<1)return"Just now";if(o<60)return`${o}m ago`;const s=Math.floor(o/60);if(s<24)return`${s}h ago`;const i=Math.floor(s/24);return i<7?`${i}d ago`:t.toLocaleDateString()}const Zf={pinned:"var(--warning)",answer:"var(--success)"};function Jf({author:e,content:t,createdAt:n,updatedAt:r,actions:o,highlight:s="none",indentLevel:i=0,className:c,style:u}){const a=Zf[s];return m.jsx("div",{className:V("rounded-md border border-border p-3",c),style:{marginLeft:i?`calc(${i} * 1rem)`:void 0,...a&&{borderLeftWidth:"3px",borderLeftColor:a},...u},children:m.jsxs("div",{className:"flex gap-2",children:[m.jsx(wc,{displayName:e.displayName,avatarUrl:e.avatarUrl,role:e.role,size:"medium"}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsxs("div",{className:"flex items-center gap-1.5 flex-wrap text-sm",children:[m.jsx("span",{className:"font-semibold",children:e.displayName}),e.role&&e.role!=="student"&&m.jsx("span",{className:"rounded-full bg-primary/10 px-1.5 py-0.5 text-xs font-medium text-primary capitalize",children:e.role}),m.jsx("span",{className:"text-xs text-muted-foreground",children:qf(n)}),r&&m.jsx("span",{className:"text-xs text-muted-foreground italic",children:"(edited)"}),s==="pinned"&&m.jsx(U.Pin,{size:14})]}),m.jsx("p",{className:"mt-1 text-sm whitespace-pre-wrap",children:t}),o&&m.jsxs(m.Fragment,{children:[m.jsx(Kr,{className:"my-2"}),m.jsx("div",{className:"flex items-center gap-1",children:o})]})]})]})})}const Qf={info:{variant:"info",Icon:U.Info},warning:{variant:"warning",Icon:U.AlertTriangle},tip:{variant:"success",Icon:U.Lightbulb}};function ep({block:e,onQuestionAnswer:t,readOnly:n=!1,className:r,style:o}){const s=i=>m.jsx("div",{className:V(r),style:o,children:i});switch(e.type){case"video":return s(m.jsx(qi,{...e.video,readOnly:n}));case"richtext":return s(m.jsx("div",{className:"[&_p]:mb-[1.5em] [&_ul]:pl-[1.5em] [&_ol]:pl-[1.5em]",dangerouslySetInnerHTML:{__html:e.html}}));case"heading":{const i=e.level===1?"h2":e.level===3?"h4":"h3",c=e.level===1?"text-xl":e.level===3?"text-base":"text-lg";return s(m.jsx(i,{className:V(c,"font-semibold m-0"),children:e.text}))}case"image":return s(m.jsxs("figure",{className:"m-0",children:[m.jsx("img",{src:e.src,alt:e.alt??"",className:"max-w-full rounded-sm"}),e.caption&&m.jsx("figcaption",{className:"text-xs text-muted-foreground mt-0.5",children:e.caption})]}));case"callout":{const i=Qf[e.variant??"info"];return s(m.jsxs(It,{variant:i.variant,children:[m.jsx(i.Icon,{size:20}),m.jsx(Pt,{children:e.content})]}))}case"question":return s(m.jsx(gs,{question:e.question,onAnswer:i=>t==null?void 0:t(e.question.uid,i.map(c=>({uid:e.question.uid,answerUid:c.uid,content:c.content}))),readOnly:n}));case"flashcards":return s(m.jsx(Ki,{cards:e.cards,deckName:e.deckName,readOnly:n}));case"divider":return s(m.jsx(Kr,{}));case"custom":return s(m.jsx(m.Fragment,{children:e.render}));default:return null}}function tp(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function np({files:e,onFilesAdded:t,onFileRemove:n,accept:r,maxFiles:o,maxSizeMB:s,disabled:i=!1,label:c="Drag files here or click to browse"}){const u=re.useRef(null),[a,d]=re.useState(!1),l=o!=null&&e.length>=o;function g(p){if(!p)return;let f=Array.from(p);s&&(f=f.filter(h=>h.size<=s*1024*1024)),o&&(f=f.slice(0,o-e.length)),f.length>0&&t(f)}return m.jsxs("div",{children:[m.jsxs("div",{className:V("border-2 border-dashed border-border rounded-md p-8 text-center cursor-pointer transition-all duration-200",a&&"border-primary bg-muted",i&&"cursor-default opacity-50",l&&"cursor-default"),onDragOver:p=>{p.preventDefault(),!i&&!l&&d(!0)},onDragLeave:()=>d(!1),onDrop:p=>{p.preventDefault(),d(!1),!i&&!l&&g(p.dataTransfer.files)},onClick:()=>{var p;return!i&&!l&&((p=u.current)==null?void 0:p.click())},children:[m.jsx(U.Upload,{size:32,className:"mx-auto mb-2 opacity-50"}),m.jsx("span",{className:"text-sm text-muted-foreground",children:l?`Maximum ${o} files reached`:c}),(r||s)&&m.jsx("span",{className:"text-xs text-muted-foreground mt-1 block",children:[r&&`Accepted: ${r}`,s&&`Max: ${s}MB`].filter(Boolean).join(" · ")})]}),m.jsx("input",{ref:u,type:"file",accept:r,multiple:!o||o>1,hidden:!0,onChange:p=>{g(p.target.files),p.target.value=""}}),e.length>0&&m.jsx("div",{className:"flex flex-col gap-1 mt-2",children:e.map((p,f)=>m.jsxs("div",{className:"flex items-center gap-3 py-1",children:[m.jsx("div",{className:"shrink-0 w-9 flex justify-center text-muted-foreground",children:m.jsx(U.File,{size:18})}),m.jsxs("div",{className:"flex-1 min-w-0",children:[m.jsx("span",{className:"text-sm block truncate",children:p.name}),m.jsx("span",{className:"text-xs text-muted-foreground",children:tp(p.size)})]}),m.jsx(dt,{variant:"ghost",size:"icon-xs","aria-label":"Remove file",onClick:()=>n(f),disabled:i,children:m.jsx(U.X,{size:16})})]},`${p.name}-${f}`))})]})}function rp({className:e,...t}){return m.jsx("div",{"data-slot":"card",className:V("bg-card text-card-foreground rounded-xl border shadow-sm",e),...t})}function op({className:e,...t}){return m.jsx("div",{"data-slot":"card-header",className:V("flex flex-col gap-1.5 px-6 pt-6 has-data-[slot=card-action]:flex-row has-data-[slot=card-action]:items-center has-data-[slot=card-action]:justify-between",e),...t})}function sp({className:e,...t}){return m.jsx("div",{"data-slot":"card-title",className:V("leading-none font-semibold",e),...t})}function ip({className:e,...t}){return m.jsx("div",{"data-slot":"card-description",className:V("text-muted-foreground text-sm",e),...t})}function cp({className:e,...t}){return m.jsx("div",{"data-slot":"card-action",className:V("col-start-2 row-span-2 row-start-1 self-start justify-self-end",e),...t})}function ap({className:e,...t}){return m.jsx("div",{"data-slot":"card-content",className:V("px-6 pb-6 pt-0",e),...t})}function lp({className:e,...t}){return m.jsx("div",{"data-slot":"card-footer",className:V("flex items-center px-6 pb-6 pt-0",e),...t})}function up({controlled:e,default:t,name:n,state:r="value"}){const{current:o}=b.useRef(e!==void 0),[s,i]=b.useState(t),c=o?e:s;if(process.env.NODE_ENV!=="production"){b.useEffect(()=>{o!==(e!==void 0)&&console.error([`Base UI: A component is changing the ${o?"":"un"}controlled ${r} state of ${n} to be ${o?"un":""}controlled.`,"Elements should not switch from uncontrolled to controlled (or vice versa).",`Decide between using a controlled or uncontrolled ${n} element for the lifetime of the component.`,"The nature of the state is determined during the first render. It's considered controlled if the value is not `undefined`.","More info: https://fb.me/react-controlled-components"].join(`
|
|
55
|
-
`))},[r,n,e]);const{current:a}=b.useRef(t);b.useEffect(()=>{!o&&JSON.stringify(a)!==JSON.stringify(t)&&console.error([`Base UI: A component is changing the default ${r} state of an uncontrolled ${n} after being initialized. To suppress this warning opt to use a controlled ${n}.`].join(`
|
|
56
|
-
`))},[JSON.stringify(t)])}const u=b.useCallback(a=>{o||i(a)},[]);return[c,u]}const Gr=b.createContext({register:()=>{},unregister:()=>{},subscribeMapChange:()=>()=>{},elementsRef:{current:[]},nextIndexRef:{current:0}});process.env.NODE_ENV!=="production"&&(Gr.displayName="CompositeListContext");function dp(){return b.useContext(Gr)}function Sc(e){const{children:t,elementsRef:n,labelsRef:r,onMapChange:o}=e,s=W(o),i=b.useRef(0),c=Ie(pp).current,u=Ie(fp).current,[a,d]=b.useState(0),l=b.useRef(a),g=W((x,E)=>{u.set(x,E??null),l.current+=1,d(l.current)}),p=W(x=>{u.delete(x),l.current+=1,d(l.current)}),f=b.useMemo(()=>{const x=new Map;return Array.from(u.keys()).filter(w=>w.isConnected).sort(gp).forEach((w,y)=>{const T=u.get(w)??{};x.set(w,{...T,index:y})}),x},[u,a]);G(()=>{if(typeof MutationObserver!="function"||f.size===0)return;const x=new MutationObserver(E=>{const w=new Set,y=T=>w.has(T)?w.delete(T):w.add(T);E.forEach(T=>{T.removedNodes.forEach(y),T.addedNodes.forEach(y)}),w.size===0&&(l.current+=1,d(l.current))});return f.forEach((E,w)=>{w.parentElement&&x.observe(w.parentElement,{childList:!0})}),()=>{x.disconnect()}},[f]),G(()=>{l.current===a&&(n.current.length!==f.size&&(n.current.length=f.size),r&&r.current.length!==f.size&&(r.current.length=f.size),i.current=f.size),s(f)},[s,f,n,r,a]),G(()=>()=>{n.current=[]},[n]),G(()=>()=>{r&&(r.current=[])},[r]);const h=W(x=>(c.add(x),()=>{c.delete(x)}));G(()=>{c.forEach(x=>x(f))},[c,f]);const v=b.useMemo(()=>({register:g,unregister:p,subscribeMapChange:h,elementsRef:n,labelsRef:r,nextIndexRef:i}),[g,p,h,n,r,i]);return m.jsx(Gr.Provider,{value:v,children:t})}function fp(){return new Map}function pp(){return new Set}function gp(e,t){const 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}const Xr=b.createContext(void 0);process.env.NODE_ENV!=="production"&&(Xr.displayName="TabsRootContext");function qr(){const e=b.useContext(Xr);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: TabsRootContext is missing. Tabs parts must be placed within <Tabs.Root>.":Le(64));return e}let mp=(function(e){return e.activationDirection="data-activation-direction",e.orientation="data-orientation",e})({});const Zr={tabActivationDirection:e=>({[mp.activationDirection]:e})},Rc=b.forwardRef(function(t,n){const{className:r,defaultValue:o=0,onValueChange:s,orientation:i="horizontal",render:c,value:u,...a}=t,d=zr(),l=Object.hasOwn(t,"defaultValue"),g=b.useRef([]),[p,f]=b.useState(()=>new Map),[h,v]=up({controlled:u,default:o,name:"Tabs",state:"value"}),x=u!==void 0,[E,w]=b.useState(()=>new Map),[y,T]=b.useState("none"),S=W((L,I)=>{s==null||s(L,I),!I.isCanceled&&(v(L),T(I.activationDirection))}),C=W((L,I)=>{f(A=>{if(A.get(L)===I)return A;const H=new Map(A);return H.set(L,I),H})}),O=W((L,I)=>{f(A=>{if(!A.has(L)||A.get(L)!==I)return A;const H=new Map(A);return H.delete(L),H})}),P=b.useCallback(L=>p.get(L),[p]),_=b.useCallback(L=>{for(const I of E.values())if(L===(I==null?void 0:I.value))return I==null?void 0:I.id},[E]),j=b.useCallback(L=>{if(L===void 0)return null;for(const[I,A]of E.entries())if(A!=null&&L===(A.value??A.index))return I;return null},[E]),R=b.useMemo(()=>({direction:d,getTabElementBySelectedValue:j,getTabIdByPanelValue:_,getTabPanelIdByValue:P,onValueChange:S,orientation:i,registerMountedTabPanel:C,setTabMap:w,unregisterMountedTabPanel:O,tabActivationDirection:y,value:h}),[d,j,_,P,S,i,C,w,O,y,h]),N=b.useMemo(()=>{for(const L of E.values())if(L!=null&&L.value===h)return L},[E,h]),Y=b.useMemo(()=>{for(const L of E.values())if(L!=null&&!L.disabled)return L.value},[E]);G(()=>{if(x||E.size===0)return;const L=N==null?void 0:N.disabled,I=N==null&&h!==null;if(l&&L&&h===o||!L&&!I)return;const H=Y??null;h!==H&&(v(H),T("none"))},[o,Y,l,x,N,T,v,E,h]);const B=Pe("div",t,{state:{orientation:i,tabActivationDirection:y},ref:n,props:a,stateAttributesMapping:Zr});return m.jsx(Xr.Provider,{value:R,children:m.jsx(Sc,{elementsRef:g,children:B})})});process.env.NODE_ENV!=="production"&&(Rc.displayName="TabsRoot");const Tc="data-composite-item-active";let hp=(function(e){return e[e.None=0]="None",e[e.GuessFromOrder=1]="GuessFromOrder",e})({});function Cc(e={}){const{label:t,metadata:n,textRef:r,indexGuessBehavior:o,index:s}=e,{register:i,unregister:c,subscribeMapChange:u,elementsRef:a,labelsRef:d,nextIndexRef:l}=dp(),g=b.useRef(-1),[p,f]=b.useState(s??(o===hp.GuessFromOrder?()=>{if(g.current===-1){const x=l.current;l.current+=1,g.current=x}return g.current}:-1)),h=b.useRef(null),v=b.useCallback(x=>{var E;if(h.current=x,p!==-1&&x!==null&&(a.current[p]=x,d)){const w=t!==void 0;d.current[p]=w?t:((E=r==null?void 0:r.current)==null?void 0:E.textContent)??x.textContent}},[p,a,d,t,r]);return G(()=>{if(s!=null)return;const x=h.current;if(x)return i(x,n),()=>{c(x)}},[s,i,c,n]),G(()=>{if(s==null)return u(x=>{var w;const E=h.current?(w=x.get(h.current))==null?void 0:w.index:null;E!=null&&f(E)})},[s,u,f]),b.useMemo(()=>({ref:v,index:p}),[p,v])}function bp(e={}){const{highlightItemOnHover:t,highlightedIndex:n,onHighlightedIndexChange:r}=Ji(),{ref:o,index:s}=Cc(e),i=n===s,c=b.useRef(null),u=Nt(o,c);return{compositeProps:b.useMemo(()=>({tabIndex:i?0:-1,onFocus(){r(s)},onMouseMove(){const d=c.current;if(!t||!d)return;const l=d.hasAttribute("disabled")||d.ariaDisabled==="true";!i&&!l&&d.focus()}}),[i,r,s,t]),compositeRef:u,index:s}}const Jr=b.createContext(void 0);process.env.NODE_ENV!=="production"&&(Jr.displayName="TabsListContext");function xp(){const e=b.useContext(Jr);if(e===void 0)throw new Error(process.env.NODE_ENV!=="production"?"Base UI: TabsListContext is missing. TabsList parts must be placed within <Tabs.List>.":Le(65));return e}const Oc=b.forwardRef(function(t,n){const{className:r,disabled:o=!1,render:s,value:i,id:c,nativeButton:u=!0,...a}=t,{value:d,getTabPanelIdByValue:l,orientation:g}=qr(),{activateOnFocus:p,highlightedTabIndex:f,onTabActivation:h,setHighlightedTabIndex:v,tabsListElement:x}=xp(),E=kt(c),w=b.useMemo(()=>({disabled:o,id:E,value:i}),[o,E,i]),{compositeProps:y,compositeRef:T,index:S}=bp({metadata:w}),C=i===d,O=b.useRef(!1);G(()=>{if(O.current){O.current=!1;return}if(!(C&&S>-1&&f!==S))return;const A=x;if(A!=null){const H=ze(ce(A));if(H&&ne(A,H))return}o||v(S)},[C,S,f,v,o,x]);const{getButtonProps:P,buttonRef:_}=Qi({disabled:o,native:u,focusableWhenDisabled:!0}),j=l(i),R=b.useRef(!1),N=b.useRef(!1);function Y(A){C||o||h(i,ae(Ft,A.nativeEvent,void 0,{activationDirection:"none"}))}function D(A){C||(S>-1&&!o&&v(S),!o&&p&&(!R.current||R.current&&N.current)&&h(i,ae(Ft,A.nativeEvent,void 0,{activationDirection:"none"})))}function B(A){if(C||o)return;R.current=!0;function H(){R.current=!1,N.current=!1}(!A.button||A.button===0)&&(N.current=!0,ce(A.currentTarget).addEventListener("pointerup",H,{once:!0}))}return Pe("button",t,{state:{disabled:o,active:C,orientation:g},ref:[n,_,T],props:[y,{role:"tab","aria-controls":j,"aria-selected":C,id:E,onClick:Y,onFocus:D,onPointerDown:B,[Tc]:C?"":void 0,onKeyDownCapture(){O.current=!0}},a,P]})});process.env.NODE_ENV!=="production"&&(Oc.displayName="TabsTab");let vp=(function(e){return e.index="data-index",e.activationDirection="data-activation-direction",e.orientation="data-orientation",e.hidden="data-hidden",e})({});const yp={...Zr,...Ln},Nc=b.forwardRef(function(t,n){const{className:r,value:o,render:s,keepMounted:i=!1,...c}=t,{value:u,getTabIdByPanelValue:a,orientation:d,tabActivationDirection:l,registerMountedTabPanel:g,unregisterMountedTabPanel:p}=qr(),f=kt(),h=b.useMemo(()=>({id:f,value:o}),[f,o]),{ref:v,index:x}=Cc({metadata:h}),E=o===u,{mounted:w,transitionStatus:y,setMounted:T}=xi(E),S=!w,C=a(o),O={hidden:S,orientation:d,tabActivationDirection:l,transitionStatus:y},P=b.useRef(null),_=Pe("div",t,{state:O,ref:[n,v,P],props:[{"aria-labelledby":C,hidden:S,id:f,role:"tabpanel",tabIndex:E?0:-1,inert:Bi(!E),[vp.index]:x},c],stateAttributesMapping:yp});return _n({open:E,ref:P,onComplete(){E||T(!1)}}),G(()=>{if(!(S&&!i)&&f!=null)return g(o,f),()=>{p(o,f)}},[S,i,o,f,g,p]),i||w?_:null});process.env.NODE_ENV!=="production"&&(Nc.displayName="TabsPanel");function Ep(e){return e==null||e.hasAttribute("disabled")||e.getAttribute("aria-disabled")==="true"}const wp=[];function Sp(e){const{itemSizes:t,cols:n=1,loopFocus:r=!0,dense:o=!1,orientation:s="both",direction:i,highlightedIndex:c,onHighlightedIndexChange:u,rootRef:a,enableHomeAndEndKeys:d=!1,stopEventPropagation:l=!1,disabledIndices:g,modifierKeys:p=wp}=e,[f,h]=b.useState(0),v=n>1,x=b.useRef(null),E=Nt(x,a),w=b.useRef([]),y=b.useRef(!1),T=c??f,S=W((P,_=!1)=>{if((u??h)(P),_){const j=w.current[P];Zo(x.current,j,i,s)}}),C=W(P=>{if(P.size===0||y.current)return;y.current=!0;const _=Array.from(P.keys()),j=_.find(N=>N==null?void 0:N.hasAttribute(Tc))??null,R=j?_.indexOf(j):-1;R!==-1&&S(R),Zo(x.current,j,i,s)}),O=b.useMemo(()=>({"aria-orientation":s==="both"?void 0:s,ref:E,onFocus(P){!x.current||!qo(P.target)||P.target.setSelectionRange(0,P.target.value.length??0)},onKeyDown(P){const _=d?Zd:rc;if(!_.has(P.key)||Rp(P,p)||!x.current)return;const R=i==="rtl",N=R?Ht:St,Y={horizontal:N,vertical:lt,both:N}[s],D=R?St:Ht,B={horizontal:D,vertical:wt,both:D}[s];if(qo(P.target)&&!Ep(P.target)){const se=P.target.selectionStart,pe=P.target.selectionEnd,ye=P.target.value??"";if(se==null||P.shiftKey||se!==pe||P.key!==B&&se<ye.length||P.key!==Y&&se>0)return}let L=T;const I=Oa(w,g),A=Na(w,g);if(v){const se=t||Array.from({length:w.current.length},()=>({width:1,height:1})),pe=Pa(se,n,o),ye=pe.findIndex(J=>J!=null&&!At(w,J,g)),ee=pe.reduce((J,me,K)=>me!=null&&!At(w,me,g)?K:J,-1);L=pe[Ia({current:pe.map(J=>J?w.current[J]:null)},{event:P,orientation:s,loopFocus:r,cols:n,disabledIndices:ka([...g||w.current.map((J,me)=>At(w,me)?me:void 0),void 0],pe),minIndex:ye,maxIndex:ee,prevIndex:ja(T>A?I:T,se,pe,n,P.key===lt?"bl":P.key===St?"tr":"tl"),rtl:R})]}const H={horizontal:[N],vertical:[lt],both:[N,lt]}[s],le={horizontal:[D],vertical:[wt],both:[D,wt]}[s],fe=v?_:{horizontal:d?Xd:tc,vertical:d?qd:nc,both:_}[s];d&&(P.key===Xt?L=I:P.key===qt&&(L=A)),L===T&&(H.includes(P.key)||le.includes(P.key))&&(r&&L===A&&H.includes(P.key)?L=I:r&&L===I&&le.includes(P.key)?L=A:L=je(w,{startingIndex:L,decrement:le.includes(P.key),disabledIndices:g})),L!==T&&!fn(w,L)&&(l&&P.stopPropagation(),fe.has(P.key)&&P.preventDefault(),S(L,!0),queueMicrotask(()=>{var se;(se=w.current[L])==null||se.focus()}))}}),[n,o,i,g,w,d,T,v,t,r,E,p,S,s,l]);return b.useMemo(()=>({props:O,highlightedIndex:T,onHighlightedIndexChange:S,elementsRef:w,disabledIndices:g,onMapChange:C,relayKeyboardEvent:O.onKeyDown}),[O,T,S,w,g,C])}function Rp(e,t){for(const n of rf.values())if(!t.includes(n)&&e.getModifierState(n))return!0;return!1}function Tp(e){const{render:t,className:n,refs:r=mr,props:o=mr,state:s=Re,stateAttributesMapping:i,highlightedIndex:c,onHighlightedIndexChange:u,orientation:a,dense:d,itemSizes:l,loopFocus:g,cols:p,enableHomeAndEndKeys:f,onMapChange:h,stopEventPropagation:v=!0,rootRef:x,disabledIndices:E,modifierKeys:w,highlightItemOnHover:y=!1,tag:T="div",...S}=e,C=zr(),{props:O,highlightedIndex:P,onHighlightedIndexChange:_,elementsRef:j,onMapChange:R,relayKeyboardEvent:N}=Sp({itemSizes:l,cols:p,loopFocus:g,dense:d,orientation:a,highlightedIndex:c,onHighlightedIndexChange:u,rootRef:x,stopEventPropagation:v,enableHomeAndEndKeys:f,direction:C,disabledIndices:E,modifierKeys:w}),Y=Pe(T,e,{state:s,ref:r,props:[O,...o,S],stateAttributesMapping:i}),D=b.useMemo(()=>({highlightedIndex:P,onHighlightedIndexChange:_,highlightItemOnHover:y,relayKeyboardEvent:N}),[P,_,y,N]);return m.jsx(Ur.Provider,{value:D,children:m.jsx(Sc,{elementsRef:j,onMapChange:B=>{h==null||h(B),R(B)},children:Y})})}const Ic=b.forwardRef(function(t,n){const{activateOnFocus:r=!1,className:o,loopFocus:s=!0,render:i,...c}=t,{getTabElementBySelectedValue:u,onValueChange:a,orientation:d,value:l,setTabMap:g,tabActivationDirection:p}=qr(),[f,h]=b.useState(0),[v,x]=b.useState(null),E=Cp(l,d,v,u),w=W((C,O)=>{if(C!==l){const P=E(C);O.activationDirection=P,a(C,O)}}),y={orientation:d,tabActivationDirection:p},T={"aria-orientation":d==="vertical"?"vertical":void 0,role:"tablist"},S=b.useMemo(()=>({activateOnFocus:r,highlightedTabIndex:f,onTabActivation:w,setHighlightedTabIndex:h,tabsListElement:v,value:l}),[r,f,w,h,v,l]);return m.jsx(Jr.Provider,{value:S,children:m.jsx(Tp,{render:i,className:o,state:y,refs:[n,x],props:[T,c],stateAttributesMapping:Zr,highlightedIndex:f,enableHomeAndEndKeys:!0,loopFocus:s,orientation:d,onHighlightedIndexChange:h,onMapChange:g,disabledIndices:mr})})});process.env.NODE_ENV!=="production"&&(Ic.displayName="TabsList");function os(e,t){const{left:n,top:r}=e.getBoundingClientRect(),{left:o,top:s}=t.getBoundingClientRect(),i=n-o,c=r-s;return{left:i,top:c}}function Cp(e,t,n,r){const[o,s]=b.useState(null);return G(()=>{if(e==null||n==null){s(null);return}const i=r(e);if(i==null){s(null);return}const{left:c,top:u}=os(i,n);s(t==="horizontal"?c:u)},[t,r,n,e]),b.useCallback(i=>{if(i===e)return"none";if(i==null)return s(null),"none";if(i!=null&&n!=null){const c=r(i);if(c!=null){const{left:u,top:a}=os(c,n);if(o==null)return s(t==="horizontal"?u:a),"none";if(t==="horizontal"){if(u<o)return s(u),"left";if(u>o)return s(u),"right"}else{if(a<o)return s(a),"up";if(a>o)return s(a),"down"}}}return"none"},[r,t,o,n,e])}function Op({...e}){return m.jsx(Rc,{"data-slot":"tabs",...e})}function Np({className:e,...t}){return m.jsx(Ic,{"data-slot":"tabs-list",className:V("flex border-b border-border overflow-x-auto",e),...t})}function Ip({className:e,...t}){return m.jsx(Oc,{"data-slot":"tabs-trigger",className:V("border-b-2 border-transparent px-3 py-1.5 text-sm font-medium text-muted-foreground whitespace-nowrap transition-colors hover:text-foreground cursor-pointer bg-transparent data-[selected]:text-primary data-[selected]:border-b-primary",e),...t})}function Pp({className:e,...t}){return m.jsx(Nc,{"data-slot":"tabs-content",className:V("pt-2",e),...t})}const Pc=zt.cva("h-full rounded-full transition-all duration-300",{variants:{variant:{default:"bg-primary",success:"bg-success",warning:"bg-warning",info:"bg-info"},size:{sm:"",default:""}},defaultVariants:{variant:"default",size:"default"}}),jp=zt.cva("bg-muted overflow-hidden rounded-full w-full",{variants:{size:{sm:"h-1.5",default:"h-2.5"}},defaultVariants:{size:"default"}});function kp({className:e,value:t=0,max:n=100,variant:r,size:o,...s}){const i=Math.min(100,Math.max(0,t/n*100));return m.jsx("div",{"data-slot":"progress",role:"progressbar","aria-valuenow":t,"aria-valuemin":0,"aria-valuemax":n,className:V(jp({size:o}),e),...s,children:m.jsx("div",{className:Pc({variant:r,size:o}),style:{width:`${i}%`}})})}function Mp({className:e,...t}){return m.jsx("div",{"data-slot":"table-container",className:"relative w-full overflow-auto",children:m.jsx("table",{"data-slot":"table",className:V("w-full caption-bottom text-sm",e),...t})})}function Dp({className:e,...t}){return m.jsx("thead",{"data-slot":"table-header",className:V("[&_tr]:border-b",e),...t})}function Ap({className:e,...t}){return m.jsx("tbody",{"data-slot":"table-body",className:V("[&_tr:last-child]:border-0",e),...t})}function Lp({className:e,...t}){return m.jsx("tfoot",{"data-slot":"table-footer",className:V("bg-muted/50 border-t font-medium [&>tr]:last:border-b-0",e),...t})}function _p({className:e,...t}){return m.jsx("tr",{"data-slot":"table-row",className:V("border-b border-border transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",e),...t})}function Fp({className:e,...t}){return m.jsx("th",{"data-slot":"table-head",className:V("text-muted-foreground h-10 px-3 text-left align-middle font-semibold whitespace-nowrap text-sm [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function Vp({className:e,...t}){return m.jsx("td",{"data-slot":"table-cell",className:V("px-3 py-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",e),...t})}function Bp({className:e,...t}){return m.jsx("caption",{"data-slot":"table-caption",className:V("text-muted-foreground mt-4 text-sm",e),...t})}exports.Alert=It;exports.AlertDescription=Pt;exports.AlertDialog=lc;exports.AlertDialogAction=bc;exports.AlertDialogBackdrop=dc;exports.AlertDialogCancel=xc;exports.AlertDialogContent=fc;exports.AlertDialogDescription=hc;exports.AlertDialogFooter=gc;exports.AlertDialogHeader=pc;exports.AlertDialogPortal=uc;exports.AlertDialogTitle=mc;exports.AlertDialogTrigger=Ef;exports.AlertTitle=Uc;exports.AssessmentToolbar=_d;exports.Badge=yc;exports.Button=dt;exports.Card=rp;exports.CardAction=cp;exports.CardContent=ap;exports.CardDescription=ip;exports.CardFooter=lp;exports.CardHeader=op;exports.CardTitle=sp;exports.Choice=as;exports.ConfirmDialog=wf;exports.ContentBlock=ep;exports.CurriculumItemRow=Xi;exports.CurriculumTree=$d;exports.DueDateDisplay=kf;exports.EmptyState=Hd;exports.Essay=ps;exports.FeedbackBanner=Mf;exports.FileUploadZone=np;exports.FillInTheBlank=ds;exports.Flashcard=Yi;exports.FlashcardDeck=Ki;exports.GradeIndicator=Hf;exports.Input=us;exports.LearningObjectIcon=Gi;exports.LikertScale=Df;exports.MultipleChoice=cs;exports.PostCard=Jf;exports.Progress=kp;exports.ProgressRing=Ec;exports.QuestionNavigator=Wi;exports.QuestionRenderer=gs;exports.SearchInput=Sf;exports.Separator=Kr;exports.StarRating=Lf;exports.StatCard=Uf;exports.StatusBadge=Nf;exports.Table=Mp;exports.TableBody=Ap;exports.TableCaption=Bp;exports.TableCell=Vp;exports.TableFooter=Lp;exports.TableHead=Fp;exports.TableHeader=Dp;exports.TableRow=_p;exports.Tabs=Op;exports.TabsContent=Pp;exports.TabsList=Np;exports.TabsTrigger=Ip;exports.Textarea=fs;exports.TimerDisplay=hs;exports.Tooltip=$i;exports.TooltipContent=zi;exports.TooltipTrigger=Hi;exports.TrueFalse=ls;exports.UserAvatar=wc;exports.VideoPlayer=qi;exports.alertVariants=is;exports.badgeVariants=vc;exports.buttonVariants=Vn;exports.cn=V;exports.formatDuration=ms;exports.progressVariants=Pc;
|