@townco/gui-template 0.1.4 → 0.1.5
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/assets/{acp-sdk-DjnJtAf8.js → acp-sdk-C7r2g8Gx.js} +1 -1
- package/dist/assets/icons-DyKSdrA7.js +1 -0
- package/dist/assets/index-CwjFUPJ1.css +1 -0
- package/dist/assets/index-bBppzLNv.js +8 -0
- package/dist/assets/{markdown-BLVKlqjB.js → markdown-BYclSlXM.js} +1 -1
- package/dist/assets/radix-5M08E2bk.js +5 -0
- package/dist/assets/{react-BUwpDnu9.js → react-oZw8z-KQ.js} +1 -1
- package/dist/assets/vendor-CEpcc87q.js +48 -0
- package/dist/index.html +8 -8
- package/package.json +3 -3
- package/src/ChatView.tsx +159 -135
- package/dist/assets/icons-B1wHwGRq.js +0 -1
- package/dist/assets/index-B6Vo9iGc.css +0 -1
- package/dist/assets/index-C9pfdbke.js +0 -7
- package/dist/assets/radix-zBfH0NEp.js +0 -5
- package/dist/assets/vendor-CNJ4Zu8U.js +0 -48
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{r as s,R as Be,j as d,a as se,b as We,c as Ln,d as lt}from"./react-BUwpDnu9.js";import{h as ut,i as jn,j as $n,k as kn,m as Bn,p as Wn,q as Un,t as Hn,v as Vn,w as Kn}from"./vendor-CNJ4Zu8U.js";function et(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Ue(...e){return t=>{let n=!1;const o=e.map(r=>{const i=et(r,t);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let r=0;r<o.length;r++){const i=o[r];typeof i=="function"?i():et(e[r],null)}}}}function O(...e){return s.useCallback(Ue(...e),e)}var Gn=Symbol.for("react.lazy"),xe=Be[" use ".trim().toString()];function zn(e){return typeof e=="object"&&e!==null&&"then"in e}function dt(e){return e!=null&&typeof e=="object"&&"$$typeof"in e&&e.$$typeof===Gn&&"_payload"in e&&zn(e._payload)}function ft(e){const t=Yn(e),n=s.forwardRef((o,r)=>{let{children:i,...c}=o;dt(i)&&typeof xe=="function"&&(i=xe(i._payload));const a=s.Children.toArray(i),l=a.find(Xn);if(l){const u=l.props.children,p=a.map(m=>m===l?s.Children.count(u)>1?s.Children.only(null):s.isValidElement(u)?u.props.children:null:m);return d.jsx(t,{...c,ref:r,children:s.isValidElement(u)?s.cloneElement(u,void 0,p):null})}return d.jsx(t,{...c,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}var Hr=ft("Slot");function Yn(e){const t=s.forwardRef((n,o)=>{let{children:r,...i}=n;if(dt(r)&&typeof xe=="function"&&(r=xe(r._payload)),s.isValidElement(r)){const c=Jn(r),a=Zn(i,r.props);return r.type!==s.Fragment&&(a.ref=o?Ue(o,c):c),s.cloneElement(r,a)}return s.Children.count(r)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var qn=Symbol("radix.slottable");function Xn(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===qn}function Zn(e,t){const n={...t};for(const o in t){const r=e[o],i=t[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...a)=>{const l=i(...a);return r(...a),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function Jn(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function I(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e?.(r),n===!1||!r.defaultPrevented)return t?.(r)}}function Qn(e,t){const n=s.createContext(t),o=i=>{const{children:c,...a}=i,l=s.useMemo(()=>a,Object.values(a));return d.jsx(n.Provider,{value:l,children:c})};o.displayName=e+"Provider";function r(i){const c=s.useContext(n);if(c)return c;if(t!==void 0)return t;throw new Error(`\`${i}\` must be used within \`${e}\``)}return[o,r]}function le(e,t=[]){let n=[];function o(i,c){const a=s.createContext(c),l=n.length;n=[...n,c];const u=m=>{const{scope:x,children:S,...E}=m,f=x?.[e]?.[l]||a,v=s.useMemo(()=>E,Object.values(E));return d.jsx(f.Provider,{value:v,children:S})};u.displayName=i+"Provider";function p(m,x){const S=x?.[e]?.[l]||a,E=s.useContext(S);if(E)return E;if(c!==void 0)return c;throw new Error(`\`${m}\` must be used within \`${i}\``)}return[u,p]}const r=()=>{const i=n.map(c=>s.createContext(c));return function(a){const l=a?.[e]||i;return s.useMemo(()=>({[`__scope${e}`]:{...a,[e]:l}}),[a,l])}};return r.scopeName=e,[o,eo(r,...t)]}function eo(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const o=e.map(r=>({useScope:r(),scopeName:r.scopeName}));return function(i){const c=o.reduce((a,{useScope:l,scopeName:u})=>{const m=l(i)[`__scope${u}`];return{...a,...m}},{});return s.useMemo(()=>({[`__scope${t.scopeName}`]:c}),[c])}};return n.scopeName=t.scopeName,n}function ve(e){const t=to(e),n=s.forwardRef((o,r)=>{const{children:i,...c}=o,a=s.Children.toArray(i),l=a.find(oo);if(l){const u=l.props.children,p=a.map(m=>m===l?s.Children.count(u)>1?s.Children.only(null):s.isValidElement(u)?u.props.children:null:m);return d.jsx(t,{...c,ref:r,children:s.isValidElement(u)?s.cloneElement(u,void 0,p):null})}return d.jsx(t,{...c,ref:r,children:i})});return n.displayName=`${e}.Slot`,n}function to(e){const t=s.forwardRef((n,o)=>{const{children:r,...i}=n;if(s.isValidElement(r)){const c=so(r),a=ro(i,r.props);return r.type!==s.Fragment&&(a.ref=o?Ue(o,c):c),s.cloneElement(r,a)}return s.Children.count(r)>1?s.Children.only(null):null});return t.displayName=`${e}.SlotClone`,t}var no=Symbol("radix.slottable");function oo(e){return s.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===no}function ro(e,t){const n={...t};for(const o in t){const r=e[o],i=t[o];/^on[A-Z]/.test(o)?r&&i?n[o]=(...a)=>{const l=i(...a);return r(...a),l}:r&&(n[o]=r):o==="style"?n[o]={...r,...i}:o==="className"&&(n[o]=[r,i].filter(Boolean).join(" "))}return{...e,...n}}function so(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function pt(e){const t=e+"CollectionProvider",[n,o]=le(t),[r,i]=n(t,{collectionRef:{current:null},itemMap:new Map}),c=f=>{const{scope:v,children:y}=f,h=se.useRef(null),g=se.useRef(new Map).current;return d.jsx(r,{scope:v,itemMap:g,collectionRef:h,children:y})};c.displayName=t;const a=e+"CollectionSlot",l=ve(a),u=se.forwardRef((f,v)=>{const{scope:y,children:h}=f,g=i(a,y),C=O(v,g.collectionRef);return d.jsx(l,{ref:C,children:h})});u.displayName=a;const p=e+"CollectionItemSlot",m="data-radix-collection-item",x=ve(p),S=se.forwardRef((f,v)=>{const{scope:y,children:h,...g}=f,C=se.useRef(null),A=O(v,C),M=i(p,y);return se.useEffect(()=>(M.itemMap.set(C,{ref:C,...g}),()=>void M.itemMap.delete(C))),d.jsx(x,{[m]:"",ref:A,children:h})});S.displayName=p;function E(f){const v=i(e+"CollectionConsumer",f);return se.useCallback(()=>{const h=v.collectionRef.current;if(!h)return[];const g=Array.from(h.querySelectorAll(`[${m}]`));return Array.from(v.itemMap.values()).sort((M,b)=>g.indexOf(M.ref.current)-g.indexOf(b.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:c,Slot:u,ItemSlot:S},E,o]}var L=globalThis?.document?s.useLayoutEffect:()=>{},io=Be[" useId ".trim().toString()]||(()=>{}),ao=0;function Ee(e){const[t,n]=s.useState(io());return L(()=>{n(o=>o??String(ao++))},[e]),t?`radix-${t}`:""}var co=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],P=co.reduce((e,t)=>{const n=ve(`Primitive.${t}`),o=s.forwardRef((r,i)=>{const{asChild:c,...a}=r,l=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:i})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{});function lo(e,t){e&&We.flushSync(()=>e.dispatchEvent(t))}function Q(e){const t=s.useRef(e);return s.useEffect(()=>{t.current=e}),s.useMemo(()=>(...n)=>t.current?.(...n),[])}var uo=Be[" useInsertionEffect ".trim().toString()]||L;function mt({prop:e,defaultProp:t,onChange:n=()=>{},caller:o}){const[r,i,c]=fo({defaultProp:t,onChange:n}),a=e!==void 0,l=a?e:r;{const p=s.useRef(e!==void 0);s.useEffect(()=>{const m=p.current;m!==a&&console.warn(`${o} is changing from ${m?"controlled":"uncontrolled"} to ${a?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),p.current=a},[a,o])}const u=s.useCallback(p=>{if(a){const m=po(p)?p(e):p;m!==e&&c.current?.(m)}else i(p)},[a,e,i,c]);return[l,u]}function fo({defaultProp:e,onChange:t}){const[n,o]=s.useState(e),r=s.useRef(n),i=s.useRef(t);return uo(()=>{i.current=t},[t]),s.useEffect(()=>{r.current!==n&&(i.current?.(n),r.current=n)},[n,r]),[n,o,i]}function po(e){return typeof e=="function"}var mo=s.createContext(void 0);function vt(e){const t=s.useContext(mo);return e||t||"ltr"}var Ne="rovingFocusGroup.onEntryFocus",vo={bubbles:!1,cancelable:!0},he="RovingFocusGroup",[De,ht,ho]=pt(he),[go,gt]=le(he,[ho]),[yo,xo]=go(he),yt=s.forwardRef((e,t)=>d.jsx(De.Provider,{scope:e.__scopeRovingFocusGroup,children:d.jsx(De.Slot,{scope:e.__scopeRovingFocusGroup,children:d.jsx(So,{...e,ref:t})})}));yt.displayName=he;var So=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:o,loop:r=!1,dir:i,currentTabStopId:c,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:l,onEntryFocus:u,preventScrollOnEntryFocus:p=!1,...m}=e,x=s.useRef(null),S=O(t,x),E=vt(i),[f,v]=mt({prop:c,defaultProp:a??null,onChange:l,caller:he}),[y,h]=s.useState(!1),g=Q(u),C=ht(n),A=s.useRef(!1),[M,b]=s.useState(0);return s.useEffect(()=>{const R=x.current;if(R)return R.addEventListener(Ne,g),()=>R.removeEventListener(Ne,g)},[g]),d.jsx(yo,{scope:n,orientation:o,dir:E,loop:r,currentTabStopId:f,onItemFocus:s.useCallback(R=>v(R),[v]),onItemShiftTab:s.useCallback(()=>h(!0),[]),onFocusableItemAdd:s.useCallback(()=>b(R=>R+1),[]),onFocusableItemRemove:s.useCallback(()=>b(R=>R-1),[]),children:d.jsx(P.div,{tabIndex:y||M===0?-1:0,"data-orientation":o,...m,ref:S,style:{outline:"none",...e.style},onMouseDown:I(e.onMouseDown,()=>{A.current=!0}),onFocus:I(e.onFocus,R=>{const V=!A.current;if(R.target===R.currentTarget&&V&&!y){const k=new CustomEvent(Ne,vo);if(R.currentTarget.dispatchEvent(k),!k.defaultPrevented){const $=C().filter(F=>F.focusable),K=$.find(F=>F.active),W=$.find(F=>F.id===f),U=[K,W,...$].filter(Boolean).map(F=>F.ref.current);wt(U,p)}}A.current=!1}),onBlur:I(e.onBlur,()=>h(!1))})})}),xt="RovingFocusGroupItem",St=s.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:o=!0,active:r=!1,tabStopId:i,children:c,...a}=e,l=Ee(),u=i||l,p=xo(xt,n),m=p.currentTabStopId===u,x=ht(n),{onFocusableItemAdd:S,onFocusableItemRemove:E,currentTabStopId:f}=p;return s.useEffect(()=>{if(o)return S(),()=>E()},[o,S,E]),d.jsx(De.ItemSlot,{scope:n,id:u,focusable:o,active:r,children:d.jsx(P.span,{tabIndex:m?0:-1,"data-orientation":p.orientation,...a,ref:t,onMouseDown:I(e.onMouseDown,v=>{o?p.onItemFocus(u):v.preventDefault()}),onFocus:I(e.onFocus,()=>p.onItemFocus(u)),onKeyDown:I(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){p.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const y=Co(v,p.orientation,p.dir);if(y!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let g=x().filter(C=>C.focusable).map(C=>C.ref.current);if(y==="last")g.reverse();else if(y==="prev"||y==="next"){y==="prev"&&g.reverse();const C=g.indexOf(v.currentTarget);g=p.loop?bo(g,C+1):g.slice(C+1)}setTimeout(()=>wt(g))}}),children:typeof c=="function"?c({isCurrentTabStop:m,hasTabStop:f!=null}):c})})});St.displayName=xt;var wo={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function Eo(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function Co(e,t,n){const o=Eo(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(o))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(o)))return wo[o]}function wt(e,t=!1){const n=document.activeElement;for(const o of e)if(o===n||(o.focus({preventScroll:t}),document.activeElement!==n))return}function bo(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var Io=yt,Po=St;function Ro(e,t){return s.useReducer((n,o)=>t[n][o]??n,e)}var ge=e=>{const{present:t,children:n}=e,o=To(t),r=typeof n=="function"?n({present:o.isPresent}):s.Children.only(n),i=O(o.ref,No(r));return typeof n=="function"||o.isPresent?s.cloneElement(r,{ref:i}):null};ge.displayName="Presence";function To(e){const[t,n]=s.useState(),o=s.useRef(null),r=s.useRef(e),i=s.useRef("none"),c=e?"mounted":"unmounted",[a,l]=Ro(c,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return s.useEffect(()=>{const u=ye(o.current);i.current=a==="mounted"?u:"none"},[a]),L(()=>{const u=o.current,p=r.current;if(p!==e){const x=i.current,S=ye(u);e?l("MOUNT"):S==="none"||u?.display==="none"?l("UNMOUNT"):l(p&&x!==S?"ANIMATION_OUT":"UNMOUNT"),r.current=e}},[e,l]),L(()=>{if(t){let u;const p=t.ownerDocument.defaultView??window,m=S=>{const f=ye(o.current).includes(CSS.escape(S.animationName));if(S.target===t&&f&&(l("ANIMATION_END"),!r.current)){const v=t.style.animationFillMode;t.style.animationFillMode="forwards",u=p.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=v)})}},x=S=>{S.target===t&&(i.current=ye(o.current))};return t.addEventListener("animationstart",x),t.addEventListener("animationcancel",m),t.addEventListener("animationend",m),()=>{p.clearTimeout(u),t.removeEventListener("animationstart",x),t.removeEventListener("animationcancel",m),t.removeEventListener("animationend",m)}}else l("ANIMATION_END")},[t,l]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:s.useCallback(u=>{o.current=u?getComputedStyle(u):null,n(u)},[])}}function ye(e){return e?.animationName||"none"}function No(e){let t=Object.getOwnPropertyDescriptor(e.props,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=Object.getOwnPropertyDescriptor(e,"ref")?.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Ce="Tabs",[Ao]=le(Ce,[gt]),Et=gt(),[_o,He]=Ao(Ce),Ct=s.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,onValueChange:r,defaultValue:i,orientation:c="horizontal",dir:a,activationMode:l="automatic",...u}=e,p=vt(a),[m,x]=mt({prop:o,onChange:r,defaultProp:i??"",caller:Ce});return d.jsx(_o,{scope:n,baseId:Ee(),value:m,onValueChange:x,orientation:c,dir:p,activationMode:l,children:d.jsx(P.div,{dir:p,"data-orientation":c,...u,ref:t})})});Ct.displayName=Ce;var bt="TabsList",It=s.forwardRef((e,t)=>{const{__scopeTabs:n,loop:o=!0,...r}=e,i=He(bt,n),c=Et(n);return d.jsx(Io,{asChild:!0,...c,orientation:i.orientation,dir:i.dir,loop:o,children:d.jsx(P.div,{role:"tablist","aria-orientation":i.orientation,...r,ref:t})})});It.displayName=bt;var Pt="TabsTrigger",Rt=s.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,disabled:r=!1,...i}=e,c=He(Pt,n),a=Et(n),l=At(c.baseId,o),u=_t(c.baseId,o),p=o===c.value;return d.jsx(Po,{asChild:!0,...a,focusable:!r,active:p,children:d.jsx(P.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":u,"data-state":p?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:l,...i,ref:t,onMouseDown:I(e.onMouseDown,m=>{!r&&m.button===0&&m.ctrlKey===!1?c.onValueChange(o):m.preventDefault()}),onKeyDown:I(e.onKeyDown,m=>{[" ","Enter"].includes(m.key)&&c.onValueChange(o)}),onFocus:I(e.onFocus,()=>{const m=c.activationMode!=="manual";!p&&!r&&m&&c.onValueChange(o)})})})});Rt.displayName=Pt;var Tt="TabsContent",Nt=s.forwardRef((e,t)=>{const{__scopeTabs:n,value:o,forceMount:r,children:i,...c}=e,a=He(Tt,n),l=At(a.baseId,o),u=_t(a.baseId,o),p=o===a.value,m=s.useRef(p);return s.useEffect(()=>{const x=requestAnimationFrame(()=>m.current=!1);return()=>cancelAnimationFrame(x)},[]),d.jsx(ge,{present:r||p,children:({present:x})=>d.jsx(P.div,{"data-state":p?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":l,hidden:!x,id:u,tabIndex:0,...c,ref:t,style:{...e.style,animationDuration:m.current?"0s":void 0},children:x&&i})})});Nt.displayName=Tt;function At(e,t){return`${e}-trigger-${t}`}function _t(e,t){return`${e}-content-${t}`}var Vr=Ct,Kr=It,Gr=Rt,zr=Nt;function Oo(e,t=globalThis?.document){const n=Q(e);s.useEffect(()=>{const o=r=>{r.key==="Escape"&&n(r)};return t.addEventListener("keydown",o,{capture:!0}),()=>t.removeEventListener("keydown",o,{capture:!0})},[n,t])}var Do="DismissableLayer",Me="dismissableLayer.update",Mo="dismissableLayer.pointerDownOutside",Fo="dismissableLayer.focusOutside",tt,Ot=s.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Ve=s.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:o,onPointerDownOutside:r,onFocusOutside:i,onInteractOutside:c,onDismiss:a,...l}=e,u=s.useContext(Ot),[p,m]=s.useState(null),x=p?.ownerDocument??globalThis?.document,[,S]=s.useState({}),E=O(t,b=>m(b)),f=Array.from(u.layers),[v]=[...u.layersWithOutsidePointerEventsDisabled].slice(-1),y=f.indexOf(v),h=p?f.indexOf(p):-1,g=u.layersWithOutsidePointerEventsDisabled.size>0,C=h>=y,A=$o(b=>{const R=b.target,V=[...u.branches].some(k=>k.contains(R));!C||V||(r?.(b),c?.(b),b.defaultPrevented||a?.())},x),M=ko(b=>{const R=b.target;[...u.branches].some(k=>k.contains(R))||(i?.(b),c?.(b),b.defaultPrevented||a?.())},x);return Oo(b=>{h===u.layers.size-1&&(o?.(b),!b.defaultPrevented&&a&&(b.preventDefault(),a()))},x),s.useEffect(()=>{if(p)return n&&(u.layersWithOutsidePointerEventsDisabled.size===0&&(tt=x.body.style.pointerEvents,x.body.style.pointerEvents="none"),u.layersWithOutsidePointerEventsDisabled.add(p)),u.layers.add(p),nt(),()=>{n&&u.layersWithOutsidePointerEventsDisabled.size===1&&(x.body.style.pointerEvents=tt)}},[p,x,n,u]),s.useEffect(()=>()=>{p&&(u.layers.delete(p),u.layersWithOutsidePointerEventsDisabled.delete(p),nt())},[p,u]),s.useEffect(()=>{const b=()=>S({});return document.addEventListener(Me,b),()=>document.removeEventListener(Me,b)},[]),d.jsx(P.div,{...l,ref:E,style:{pointerEvents:g?C?"auto":"none":void 0,...e.style},onFocusCapture:I(e.onFocusCapture,M.onFocusCapture),onBlurCapture:I(e.onBlurCapture,M.onBlurCapture),onPointerDownCapture:I(e.onPointerDownCapture,A.onPointerDownCapture)})});Ve.displayName=Do;var Lo="DismissableLayerBranch",jo=s.forwardRef((e,t)=>{const n=s.useContext(Ot),o=s.useRef(null),r=O(t,o);return s.useEffect(()=>{const i=o.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),d.jsx(P.div,{...e,ref:r})});jo.displayName=Lo;function $o(e,t=globalThis?.document){const n=Q(e),o=s.useRef(!1),r=s.useRef(()=>{});return s.useEffect(()=>{const i=a=>{if(a.target&&!o.current){let l=function(){Dt(Mo,n,u,{discrete:!0})};const u={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",r.current),r.current=l,t.addEventListener("click",r.current,{once:!0})):l()}else t.removeEventListener("click",r.current);o.current=!1},c=window.setTimeout(()=>{t.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(c),t.removeEventListener("pointerdown",i),t.removeEventListener("click",r.current)}},[t,n]),{onPointerDownCapture:()=>o.current=!0}}function ko(e,t=globalThis?.document){const n=Q(e),o=s.useRef(!1);return s.useEffect(()=>{const r=i=>{i.target&&!o.current&&Dt(Fo,n,{originalEvent:i},{discrete:!1})};return t.addEventListener("focusin",r),()=>t.removeEventListener("focusin",r)},[t,n]),{onFocusCapture:()=>o.current=!0,onBlurCapture:()=>o.current=!1}}function nt(){const e=new CustomEvent(Me);document.dispatchEvent(e)}function Dt(e,t,n,{discrete:o}){const r=n.originalEvent.target,i=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&r.addEventListener(e,t,{once:!0}),o?lo(r,i):r.dispatchEvent(i)}var Ae="focusScope.autoFocusOnMount",_e="focusScope.autoFocusOnUnmount",ot={bubbles:!1,cancelable:!0},Bo="FocusScope",Ke=s.forwardRef((e,t)=>{const{loop:n=!1,trapped:o=!1,onMountAutoFocus:r,onUnmountAutoFocus:i,...c}=e,[a,l]=s.useState(null),u=Q(r),p=Q(i),m=s.useRef(null),x=O(t,f=>l(f)),S=s.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;s.useEffect(()=>{if(o){let f=function(g){if(S.paused||!a)return;const C=g.target;a.contains(C)?m.current=C:J(m.current,{select:!0})},v=function(g){if(S.paused||!a)return;const C=g.relatedTarget;C!==null&&(a.contains(C)||J(m.current,{select:!0}))},y=function(g){if(document.activeElement===document.body)for(const A of g)A.removedNodes.length>0&&J(a)};document.addEventListener("focusin",f),document.addEventListener("focusout",v);const h=new MutationObserver(y);return a&&h.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",f),document.removeEventListener("focusout",v),h.disconnect()}}},[o,a,S.paused]),s.useEffect(()=>{if(a){st.add(S);const f=document.activeElement;if(!a.contains(f)){const y=new CustomEvent(Ae,ot);a.addEventListener(Ae,u),a.dispatchEvent(y),y.defaultPrevented||(Wo(Go(Mt(a)),{select:!0}),document.activeElement===f&&J(a))}return()=>{a.removeEventListener(Ae,u),setTimeout(()=>{const y=new CustomEvent(_e,ot);a.addEventListener(_e,p),a.dispatchEvent(y),y.defaultPrevented||J(f??document.body,{select:!0}),a.removeEventListener(_e,p),st.remove(S)},0)}}},[a,u,p,S]);const E=s.useCallback(f=>{if(!n&&!o||S.paused)return;const v=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,y=document.activeElement;if(v&&y){const h=f.currentTarget,[g,C]=Uo(h);g&&C?!f.shiftKey&&y===C?(f.preventDefault(),n&&J(g,{select:!0})):f.shiftKey&&y===g&&(f.preventDefault(),n&&J(C,{select:!0})):y===h&&f.preventDefault()}},[n,o,S.paused]);return d.jsx(P.div,{tabIndex:-1,...c,ref:x,onKeyDown:E})});Ke.displayName=Bo;function Wo(e,{select:t=!1}={}){const n=document.activeElement;for(const o of e)if(J(o,{select:t}),document.activeElement!==n)return}function Uo(e){const t=Mt(e),n=rt(t,e),o=rt(t.reverse(),e);return[n,o]}function Mt(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const r=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||r?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function rt(e,t){for(const n of e)if(!Ho(n,{upTo:t}))return n}function Ho(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Vo(e){return e instanceof HTMLInputElement&&"select"in e}function J(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Vo(e)&&t&&e.select()}}var st=Ko();function Ko(){let e=[];return{add(t){const n=e[0];t!==n&&n?.pause(),e=it(e,t),e.unshift(t)},remove(t){e=it(e,t),e[0]?.resume()}}}function it(e,t){const n=[...e],o=n.indexOf(t);return o!==-1&&n.splice(o,1),n}function Go(e){return e.filter(t=>t.tagName!=="A")}var zo="Portal",Ge=s.forwardRef((e,t)=>{const{container:n,...o}=e,[r,i]=s.useState(!1);L(()=>i(!0),[]);const c=n||r&&globalThis?.document?.body;return c?Ln.createPortal(d.jsx(P.div,{...o,ref:t}),c):null});Ge.displayName=zo;var Oe=0;function Ft(){s.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??at()),document.body.insertAdjacentElement("beforeend",e[1]??at()),Oe++,()=>{Oe===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Oe--}},[])}function at(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var Lt="Dialog",[jt]=le(Lt),[Yr,q]=jt(Lt),$t="DialogTrigger",Yo=s.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=q($t,n),i=O(t,r.triggerRef);return d.jsx(P.button,{type:"button","aria-haspopup":"dialog","aria-expanded":r.open,"aria-controls":r.contentId,"data-state":qe(r.open),...o,ref:i,onClick:I(e.onClick,r.onOpenToggle)})});Yo.displayName=$t;var ze="DialogPortal",[qo,kt]=jt(ze,{forceMount:void 0}),Bt=e=>{const{__scopeDialog:t,forceMount:n,children:o,container:r}=e,i=q(ze,t);return d.jsx(qo,{scope:t,forceMount:n,children:s.Children.map(o,c=>d.jsx(ge,{present:n||i.open,children:d.jsx(Ge,{asChild:!0,container:r,children:c})}))})};Bt.displayName=ze;var Se="DialogOverlay",Wt=s.forwardRef((e,t)=>{const n=kt(Se,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,i=q(Se,e.__scopeDialog);return i.modal?d.jsx(ge,{present:o||i.open,children:d.jsx(Zo,{...r,ref:t})}):null});Wt.displayName=Se;var Xo=ve("DialogOverlay.RemoveScroll"),Zo=s.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=q(Se,n);return d.jsx(lt,{as:Xo,allowPinchZoom:!0,shards:[r.contentRef],children:d.jsx(P.div,{"data-state":qe(r.open),...o,ref:t,style:{pointerEvents:"auto",...o.style}})})}),ie="DialogContent",Ut=s.forwardRef((e,t)=>{const n=kt(ie,e.__scopeDialog),{forceMount:o=n.forceMount,...r}=e,i=q(ie,e.__scopeDialog);return d.jsx(ge,{present:o||i.open,children:i.modal?d.jsx(Jo,{...r,ref:t}):d.jsx(Qo,{...r,ref:t})})});Ut.displayName=ie;var Jo=s.forwardRef((e,t)=>{const n=q(ie,e.__scopeDialog),o=s.useRef(null),r=O(t,n.contentRef,o);return s.useEffect(()=>{const i=o.current;if(i)return ut(i)},[]),d.jsx(Ht,{...e,ref:r,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:I(e.onCloseAutoFocus,i=>{i.preventDefault(),n.triggerRef.current?.focus()}),onPointerDownOutside:I(e.onPointerDownOutside,i=>{const c=i.detail.originalEvent,a=c.button===0&&c.ctrlKey===!0;(c.button===2||a)&&i.preventDefault()}),onFocusOutside:I(e.onFocusOutside,i=>i.preventDefault())})}),Qo=s.forwardRef((e,t)=>{const n=q(ie,e.__scopeDialog),o=s.useRef(!1),r=s.useRef(!1);return d.jsx(Ht,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{e.onCloseAutoFocus?.(i),i.defaultPrevented||(o.current||n.triggerRef.current?.focus(),i.preventDefault()),o.current=!1,r.current=!1},onInteractOutside:i=>{e.onInteractOutside?.(i),i.defaultPrevented||(o.current=!0,i.detail.originalEvent.type==="pointerdown"&&(r.current=!0));const c=i.target;n.triggerRef.current?.contains(c)&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&r.current&&i.preventDefault()}})}),Ht=s.forwardRef((e,t)=>{const{__scopeDialog:n,trapFocus:o,onOpenAutoFocus:r,onCloseAutoFocus:i,...c}=e,a=q(ie,n),l=s.useRef(null),u=O(t,l);return Ft(),d.jsxs(d.Fragment,{children:[d.jsx(Ke,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:r,onUnmountAutoFocus:i,children:d.jsx(Ve,{role:"dialog",id:a.contentId,"aria-describedby":a.descriptionId,"aria-labelledby":a.titleId,"data-state":qe(a.open),...c,ref:u,onDismiss:()=>a.onOpenChange(!1)})}),d.jsxs(d.Fragment,{children:[d.jsx(er,{titleId:a.titleId}),d.jsx(nr,{contentRef:l,descriptionId:a.descriptionId})]})]})}),Ye="DialogTitle",Vt=s.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=q(Ye,n);return d.jsx(P.h2,{id:r.titleId,...o,ref:t})});Vt.displayName=Ye;var Kt="DialogDescription",Gt=s.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=q(Kt,n);return d.jsx(P.p,{id:r.descriptionId,...o,ref:t})});Gt.displayName=Kt;var zt="DialogClose",Yt=s.forwardRef((e,t)=>{const{__scopeDialog:n,...o}=e,r=q(zt,n);return d.jsx(P.button,{type:"button",...o,ref:t,onClick:I(e.onClick,()=>r.onOpenChange(!1))})});Yt.displayName=zt;function qe(e){return e?"open":"closed"}var qt="DialogTitleWarning",[qr,Xt]=Qn(qt,{contentName:ie,titleName:Ye,docsSlug:"dialog"}),er=({titleId:e})=>{const t=Xt(qt),n=`\`${t.contentName}\` requires a \`${t.titleName}\` for the component to be accessible for screen reader users.
|
|
2
|
-
|
|
3
|
-
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
4
|
-
|
|
5
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return s.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},tr="DialogDescriptionWarning",nr=({contentRef:e,descriptionId:t})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Xt(tr).contentName}}.`;return s.useEffect(()=>{const r=e.current?.getAttribute("aria-describedby");t&&r&&(document.getElementById(t)||console.warn(o))},[o,e,t]),null},Xr=Bt,Zr=Wt,Jr=Ut,Qr=Vt,es=Gt,ts=Yt,or=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],rr=or.reduce((e,t)=>{const n=ft(`Primitive.${t}`),o=s.forwardRef((r,i)=>{const{asChild:c,...a}=r,l=c?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(l,{...a,ref:i})});return o.displayName=`Primitive.${t}`,{...e,[t]:o}},{}),sr="Label",Zt=s.forwardRef((e,t)=>d.jsx(rr.label,{...e,ref:t,onMouseDown:n=>{n.target.closest("button, input, select, textarea")||(e.onMouseDown?.(n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Zt.displayName=sr;var ns=Zt;function ct(e,[t,n]){return Math.min(n,Math.max(t,e))}var ir="Arrow",Jt=s.forwardRef((e,t)=>{const{children:n,width:o=10,height:r=5,...i}=e;return d.jsx(P.svg,{...i,ref:t,width:o,height:r,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});Jt.displayName=ir;var ar=Jt;function cr(e){const[t,n]=s.useState(void 0);return L(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const o=new ResizeObserver(r=>{if(!Array.isArray(r)||!r.length)return;const i=r[0];let c,a;if("borderBoxSize"in i){const l=i.borderBoxSize,u=Array.isArray(l)?l[0]:l;c=u.inlineSize,a=u.blockSize}else c=e.offsetWidth,a=e.offsetHeight;n({width:c,height:a})});return o.observe(e,{box:"border-box"}),()=>o.unobserve(e)}else n(void 0)},[e]),t}var Qt="Popper",[en,tn]=le(Qt),[os,nn]=en(Qt),on="PopperAnchor",rn=s.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:o,...r}=e,i=nn(on,n),c=s.useRef(null),a=O(t,c),l=s.useRef(null);return s.useEffect(()=>{const u=l.current;l.current=o?.current||c.current,u!==l.current&&i.onAnchorChange(l.current)}),o?null:d.jsx(P.div,{...r,ref:a})});rn.displayName=on;var Xe="PopperContent",[lr,ur]=en(Xe),sn=s.forwardRef((e,t)=>{const{__scopePopper:n,side:o="bottom",sideOffset:r=0,align:i="center",alignOffset:c=0,arrowPadding:a=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:p=0,sticky:m="partial",hideWhenDetached:x=!1,updatePositionStrategy:S="optimized",onPlaced:E,...f}=e,v=nn(Xe,n),[y,h]=s.useState(null),g=O(t,w=>h(w)),[C,A]=s.useState(null),M=cr(C),b=M?.width??0,R=M?.height??0,V=o+(i!=="center"?"-"+i:""),k=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},$=Array.isArray(u)?u:[u],K=$.length>0,W={padding:k,boundary:$.filter(fr),altBoundary:K},{refs:X,floatingStyles:U,placement:F,isPositioned:G,middlewareData:B}=jn({strategy:"fixed",placement:V,whileElementsMounted:(...w)=>Kn(...w,{animationFrame:S==="always"}),elements:{reference:v.anchor},middleware:[$n({mainAxis:r+R,alignmentAxis:c}),l&&kn({mainAxis:!0,crossAxis:!1,limiter:m==="partial"?Vn():void 0,...W}),l&&Bn({...W}),Wn({...W,apply:({elements:w,rects:_,availableWidth:j,availableHeight:T})=>{const{width:N,height:D}=_.reference,H=w.floating.style;H.setProperty("--radix-popper-available-width",`${j}px`),H.setProperty("--radix-popper-available-height",`${T}px`),H.setProperty("--radix-popper-anchor-width",`${N}px`),H.setProperty("--radix-popper-anchor-height",`${D}px`)}}),C&&Un({element:C,padding:a}),pr({arrowWidth:b,arrowHeight:R}),x&&Hn({strategy:"referenceHidden",...W})]}),[z,de]=ln(F),ne=Q(E);L(()=>{G&&ne?.()},[G,ne]);const fe=B.arrow?.x,pe=B.arrow?.y,Z=B.arrow?.centerOffset!==0,[ce,oe]=s.useState();return L(()=>{y&&oe(window.getComputedStyle(y).zIndex)},[y]),d.jsx("div",{ref:X.setFloating,"data-radix-popper-content-wrapper":"",style:{...U,transform:G?U.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:ce,"--radix-popper-transform-origin":[B.transformOrigin?.x,B.transformOrigin?.y].join(" "),...B.hide?.referenceHidden&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d.jsx(lr,{scope:n,placedSide:z,onArrowChange:A,arrowX:fe,arrowY:pe,shouldHideArrow:Z,children:d.jsx(P.div,{"data-side":z,"data-align":de,...f,ref:g,style:{...f.style,animation:G?void 0:"none"}})})})});sn.displayName=Xe;var an="PopperArrow",dr={top:"bottom",right:"left",bottom:"top",left:"right"},cn=s.forwardRef(function(t,n){const{__scopePopper:o,...r}=t,i=ur(an,o),c=dr[i.placedSide];return d.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[c]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:d.jsx(ar,{...r,ref:n,style:{...r.style,display:"block"}})})});cn.displayName=an;function fr(e){return e!==null}var pr=e=>({name:"transformOrigin",options:e,fn(t){const{placement:n,rects:o,middlewareData:r}=t,c=r.arrow?.centerOffset!==0,a=c?0:e.arrowWidth,l=c?0:e.arrowHeight,[u,p]=ln(n),m={start:"0%",center:"50%",end:"100%"}[p],x=(r.arrow?.x??0)+a/2,S=(r.arrow?.y??0)+l/2;let E="",f="";return u==="bottom"?(E=c?m:`${x}px`,f=`${-l}px`):u==="top"?(E=c?m:`${x}px`,f=`${o.floating.height+l}px`):u==="right"?(E=`${-l}px`,f=c?m:`${S}px`):u==="left"&&(E=`${o.floating.width+l}px`,f=c?m:`${S}px`),{data:{x:E,y:f}}}});function ln(e){const[t,n="center"]=e.split("-");return[t,n]}var mr=rn,vr=sn,hr=cn;function gr(e){const t=s.useRef({value:e,previous:e});return s.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var un=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),yr="VisuallyHidden",xr=s.forwardRef((e,t)=>d.jsx(P.span,{...e,ref:t,style:{...un,...e.style}}));xr.displayName=yr;var Sr=[" ","Enter","ArrowUp","ArrowDown"],wr=[" ","Enter"],be="Select",[Ze,Ie,Er]=pt(be),[ue]=le(be,[Er,tn]),Je=tn(),[rs,ee]=ue(be),[ss,Cr]=ue(be),dn="SelectTrigger",fn=s.forwardRef((e,t)=>{const{__scopeSelect:n,disabled:o=!1,...r}=e,i=Je(n),c=ee(dn,n),a=c.disabled||o,l=O(t,c.onTriggerChange),u=Ie(n),p=s.useRef("touch"),[m,x,S]=Mn(f=>{const v=u().filter(g=>!g.disabled),y=v.find(g=>g.value===c.value),h=Fn(v,f,y);h!==void 0&&c.onValueChange(h.value)}),E=f=>{a||(c.onOpenChange(!0),S()),f&&(c.triggerPointerDownPosRef.current={x:Math.round(f.pageX),y:Math.round(f.pageY)})};return d.jsx(mr,{asChild:!0,...i,children:d.jsx(P.button,{type:"button",role:"combobox","aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":"none",dir:c.dir,"data-state":c.open?"open":"closed",disabled:a,"data-disabled":a?"":void 0,"data-placeholder":Dn(c.value)?"":void 0,...r,ref:l,onClick:I(r.onClick,f=>{f.currentTarget.focus(),p.current!=="mouse"&&E(f)}),onPointerDown:I(r.onPointerDown,f=>{p.current=f.pointerType;const v=f.target;v.hasPointerCapture(f.pointerId)&&v.releasePointerCapture(f.pointerId),f.button===0&&f.ctrlKey===!1&&f.pointerType==="mouse"&&(E(f),f.preventDefault())}),onKeyDown:I(r.onKeyDown,f=>{const v=m.current!=="";!(f.ctrlKey||f.altKey||f.metaKey)&&f.key.length===1&&x(f.key),!(v&&f.key===" ")&&Sr.includes(f.key)&&(E(),f.preventDefault())})})})});fn.displayName=dn;var pn="SelectValue",br=s.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,children:i,placeholder:c="",...a}=e,l=ee(pn,n),{onValueNodeHasChildrenChange:u}=l,p=i!==void 0,m=O(t,l.onValueNodeChange);return L(()=>{u(p)},[u,p]),d.jsx(P.span,{...a,ref:m,style:{pointerEvents:"none"},children:Dn(l.value)?d.jsx(d.Fragment,{children:c}):i})});br.displayName=pn;var Ir="SelectIcon",mn=s.forwardRef((e,t)=>{const{__scopeSelect:n,children:o,...r}=e;return d.jsx(P.span,{"aria-hidden":!0,...r,ref:t,children:o||"▼"})});mn.displayName=Ir;var Pr="SelectPortal",vn=e=>d.jsx(Ge,{asChild:!0,...e});vn.displayName=Pr;var ae="SelectContent",hn=s.forwardRef((e,t)=>{const n=ee(ae,e.__scopeSelect),[o,r]=s.useState();if(L(()=>{r(new DocumentFragment)},[]),!n.open){const i=o;return i?We.createPortal(d.jsx(gn,{scope:e.__scopeSelect,children:d.jsx(Ze.Slot,{scope:e.__scopeSelect,children:d.jsx("div",{children:e.children})})}),i):null}return d.jsx(yn,{...e,ref:t})});hn.displayName=ae;var Y=10,[gn,te]=ue(ae),Rr="SelectContentImpl",Tr=ve("SelectContent.RemoveScroll"),yn=s.forwardRef((e,t)=>{const{__scopeSelect:n,position:o="item-aligned",onCloseAutoFocus:r,onEscapeKeyDown:i,onPointerDownOutside:c,side:a,sideOffset:l,align:u,alignOffset:p,arrowPadding:m,collisionBoundary:x,collisionPadding:S,sticky:E,hideWhenDetached:f,avoidCollisions:v,...y}=e,h=ee(ae,n),[g,C]=s.useState(null),[A,M]=s.useState(null),b=O(t,w=>C(w)),[R,V]=s.useState(null),[k,$]=s.useState(null),K=Ie(n),[W,X]=s.useState(!1),U=s.useRef(!1);s.useEffect(()=>{if(g)return ut(g)},[g]),Ft();const F=s.useCallback(w=>{const[_,...j]=K().map(D=>D.ref.current),[T]=j.slice(-1),N=document.activeElement;for(const D of w)if(D===N||(D?.scrollIntoView({block:"nearest"}),D===_&&A&&(A.scrollTop=0),D===T&&A&&(A.scrollTop=A.scrollHeight),D?.focus(),document.activeElement!==N))return},[K,A]),G=s.useCallback(()=>F([R,g]),[F,R,g]);s.useEffect(()=>{W&&G()},[W,G]);const{onOpenChange:B,triggerPointerDownPosRef:z}=h;s.useEffect(()=>{if(g){let w={x:0,y:0};const _=T=>{w={x:Math.abs(Math.round(T.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(T.pageY)-(z.current?.y??0))}},j=T=>{w.x<=10&&w.y<=10?T.preventDefault():g.contains(T.target)||B(!1),document.removeEventListener("pointermove",_),z.current=null};return z.current!==null&&(document.addEventListener("pointermove",_),document.addEventListener("pointerup",j,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",_),document.removeEventListener("pointerup",j,{capture:!0})}}},[g,B,z]),s.useEffect(()=>{const w=()=>B(!1);return window.addEventListener("blur",w),window.addEventListener("resize",w),()=>{window.removeEventListener("blur",w),window.removeEventListener("resize",w)}},[B]);const[de,ne]=Mn(w=>{const _=K().filter(N=>!N.disabled),j=_.find(N=>N.ref.current===document.activeElement),T=Fn(_,w,j);T&&setTimeout(()=>T.ref.current.focus())}),fe=s.useCallback((w,_,j)=>{const T=!U.current&&!j;(h.value!==void 0&&h.value===_||T)&&(V(w),T&&(U.current=!0))},[h.value]),pe=s.useCallback(()=>g?.focus(),[g]),Z=s.useCallback((w,_,j)=>{const T=!U.current&&!j;(h.value!==void 0&&h.value===_||T)&&$(w)},[h.value]),ce=o==="popper"?Fe:xn,oe=ce===Fe?{side:a,sideOffset:l,align:u,alignOffset:p,arrowPadding:m,collisionBoundary:x,collisionPadding:S,sticky:E,hideWhenDetached:f,avoidCollisions:v}:{};return d.jsx(gn,{scope:n,content:g,viewport:A,onViewportChange:M,itemRefCallback:fe,selectedItem:R,onItemLeave:pe,itemTextRefCallback:Z,focusSelectedItem:G,selectedItemText:k,position:o,isPositioned:W,searchRef:de,children:d.jsx(lt,{as:Tr,allowPinchZoom:!0,children:d.jsx(Ke,{asChild:!0,trapped:h.open,onMountAutoFocus:w=>{w.preventDefault()},onUnmountAutoFocus:I(r,w=>{h.trigger?.focus({preventScroll:!0}),w.preventDefault()}),children:d.jsx(Ve,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:c,onFocusOutside:w=>w.preventDefault(),onDismiss:()=>h.onOpenChange(!1),children:d.jsx(ce,{role:"listbox",id:h.contentId,"data-state":h.open?"open":"closed",dir:h.dir,onContextMenu:w=>w.preventDefault(),...y,...oe,onPlaced:()=>X(!0),ref:b,style:{display:"flex",flexDirection:"column",outline:"none",...y.style},onKeyDown:I(y.onKeyDown,w=>{const _=w.ctrlKey||w.altKey||w.metaKey;if(w.key==="Tab"&&w.preventDefault(),!_&&w.key.length===1&&ne(w.key),["ArrowUp","ArrowDown","Home","End"].includes(w.key)){let T=K().filter(N=>!N.disabled).map(N=>N.ref.current);if(["ArrowUp","End"].includes(w.key)&&(T=T.slice().reverse()),["ArrowUp","ArrowDown"].includes(w.key)){const N=w.target,D=T.indexOf(N);T=T.slice(D+1)}setTimeout(()=>F(T)),w.preventDefault()}})})})})})})});yn.displayName=Rr;var Nr="SelectItemAlignedPosition",xn=s.forwardRef((e,t)=>{const{__scopeSelect:n,onPlaced:o,...r}=e,i=ee(ae,n),c=te(ae,n),[a,l]=s.useState(null),[u,p]=s.useState(null),m=O(t,b=>p(b)),x=Ie(n),S=s.useRef(!1),E=s.useRef(!0),{viewport:f,selectedItem:v,selectedItemText:y,focusSelectedItem:h}=c,g=s.useCallback(()=>{if(i.trigger&&i.valueNode&&a&&u&&f&&v&&y){const b=i.trigger.getBoundingClientRect(),R=u.getBoundingClientRect(),V=i.valueNode.getBoundingClientRect(),k=y.getBoundingClientRect();if(i.dir!=="rtl"){const N=k.left-R.left,D=V.left-N,H=b.left-D,re=b.width+H,Pe=Math.max(re,R.width),Re=window.innerWidth-Y,Te=ct(D,[Y,Math.max(Y,Re-Pe)]);a.style.minWidth=re+"px",a.style.left=Te+"px"}else{const N=R.right-k.right,D=window.innerWidth-V.right-N,H=window.innerWidth-b.right-D,re=b.width+H,Pe=Math.max(re,R.width),Re=window.innerWidth-Y,Te=ct(D,[Y,Math.max(Y,Re-Pe)]);a.style.minWidth=re+"px",a.style.right=Te+"px"}const $=x(),K=window.innerHeight-Y*2,W=f.scrollHeight,X=window.getComputedStyle(u),U=parseInt(X.borderTopWidth,10),F=parseInt(X.paddingTop,10),G=parseInt(X.borderBottomWidth,10),B=parseInt(X.paddingBottom,10),z=U+F+W+B+G,de=Math.min(v.offsetHeight*5,z),ne=window.getComputedStyle(f),fe=parseInt(ne.paddingTop,10),pe=parseInt(ne.paddingBottom,10),Z=b.top+b.height/2-Y,ce=K-Z,oe=v.offsetHeight/2,w=v.offsetTop+oe,_=U+F+w,j=z-_;if(_<=Z){const N=$.length>0&&v===$[$.length-1].ref.current;a.style.bottom="0px";const D=u.clientHeight-f.offsetTop-f.offsetHeight,H=Math.max(ce,oe+(N?pe:0)+D+G),re=_+H;a.style.height=re+"px"}else{const N=$.length>0&&v===$[0].ref.current;a.style.top="0px";const H=Math.max(Z,U+f.offsetTop+(N?fe:0)+oe)+j;a.style.height=H+"px",f.scrollTop=_-Z+f.offsetTop}a.style.margin=`${Y}px 0`,a.style.minHeight=de+"px",a.style.maxHeight=K+"px",o?.(),requestAnimationFrame(()=>S.current=!0)}},[x,i.trigger,i.valueNode,a,u,f,v,y,i.dir,o]);L(()=>g(),[g]);const[C,A]=s.useState();L(()=>{u&&A(window.getComputedStyle(u).zIndex)},[u]);const M=s.useCallback(b=>{b&&E.current===!0&&(g(),h?.(),E.current=!1)},[g,h]);return d.jsx(_r,{scope:n,contentWrapper:a,shouldExpandOnScrollRef:S,onScrollButtonChange:M,children:d.jsx("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:C},children:d.jsx(P.div,{...r,ref:m,style:{boxSizing:"border-box",maxHeight:"100%",...r.style}})})})});xn.displayName=Nr;var Ar="SelectPopperPosition",Fe=s.forwardRef((e,t)=>{const{__scopeSelect:n,align:o="start",collisionPadding:r=Y,...i}=e,c=Je(n);return d.jsx(vr,{...c,...i,ref:t,align:o,collisionPadding:r,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Fe.displayName=Ar;var[_r,Qe]=ue(ae,{}),Le="SelectViewport",Sn=s.forwardRef((e,t)=>{const{__scopeSelect:n,nonce:o,...r}=e,i=te(Le,n),c=Qe(Le,n),a=O(t,i.onViewportChange),l=s.useRef(0);return d.jsxs(d.Fragment,{children:[d.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:o}),d.jsx(Ze.Slot,{scope:n,children:d.jsx(P.div,{"data-radix-select-viewport":"",role:"presentation",...r,ref:a,style:{position:"relative",flex:1,overflow:"hidden auto",...r.style},onScroll:I(r.onScroll,u=>{const p=u.currentTarget,{contentWrapper:m,shouldExpandOnScrollRef:x}=c;if(x?.current&&m){const S=Math.abs(l.current-p.scrollTop);if(S>0){const E=window.innerHeight-Y*2,f=parseFloat(m.style.minHeight),v=parseFloat(m.style.height),y=Math.max(f,v);if(y<E){const h=y+S,g=Math.min(E,h),C=h-g;m.style.height=g+"px",m.style.bottom==="0px"&&(p.scrollTop=C>0?C:0,m.style.justifyContent="flex-end")}}}l.current=p.scrollTop})})})]})});Sn.displayName=Le;var wn="SelectGroup",[Or,Dr]=ue(wn),Mr=s.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Ee();return d.jsx(Or,{scope:n,id:r,children:d.jsx(P.div,{role:"group","aria-labelledby":r,...o,ref:t})})});Mr.displayName=wn;var En="SelectLabel",Cn=s.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Dr(En,n);return d.jsx(P.div,{id:r.id,...o,ref:t})});Cn.displayName=En;var we="SelectItem",[Fr,bn]=ue(we),In=s.forwardRef((e,t)=>{const{__scopeSelect:n,value:o,disabled:r=!1,textValue:i,...c}=e,a=ee(we,n),l=te(we,n),u=a.value===o,[p,m]=s.useState(i??""),[x,S]=s.useState(!1),E=O(t,h=>l.itemRefCallback?.(h,o,r)),f=Ee(),v=s.useRef("touch"),y=()=>{r||(a.onValueChange(o),a.onOpenChange(!1))};if(o==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d.jsx(Fr,{scope:n,value:o,disabled:r,textId:f,isSelected:u,onItemTextChange:s.useCallback(h=>{m(g=>g||(h?.textContent??"").trim())},[]),children:d.jsx(Ze.ItemSlot,{scope:n,value:o,disabled:r,textValue:p,children:d.jsx(P.div,{role:"option","aria-labelledby":f,"data-highlighted":x?"":void 0,"aria-selected":u&&x,"data-state":u?"checked":"unchecked","aria-disabled":r||void 0,"data-disabled":r?"":void 0,tabIndex:r?void 0:-1,...c,ref:E,onFocus:I(c.onFocus,()=>S(!0)),onBlur:I(c.onBlur,()=>S(!1)),onClick:I(c.onClick,()=>{v.current!=="mouse"&&y()}),onPointerUp:I(c.onPointerUp,()=>{v.current==="mouse"&&y()}),onPointerDown:I(c.onPointerDown,h=>{v.current=h.pointerType}),onPointerMove:I(c.onPointerMove,h=>{v.current=h.pointerType,r?l.onItemLeave?.():v.current==="mouse"&&h.currentTarget.focus({preventScroll:!0})}),onPointerLeave:I(c.onPointerLeave,h=>{h.currentTarget===document.activeElement&&l.onItemLeave?.()}),onKeyDown:I(c.onKeyDown,h=>{l.searchRef?.current!==""&&h.key===" "||(wr.includes(h.key)&&y(),h.key===" "&&h.preventDefault())})})})})});In.displayName=we;var me="SelectItemText",Pn=s.forwardRef((e,t)=>{const{__scopeSelect:n,className:o,style:r,...i}=e,c=ee(me,n),a=te(me,n),l=bn(me,n),u=Cr(me,n),[p,m]=s.useState(null),x=O(t,y=>m(y),l.onItemTextChange,y=>a.itemTextRefCallback?.(y,l.value,l.disabled)),S=p?.textContent,E=s.useMemo(()=>d.jsx("option",{value:l.value,disabled:l.disabled,children:S},l.value),[l.disabled,l.value,S]),{onNativeOptionAdd:f,onNativeOptionRemove:v}=u;return L(()=>(f(E),()=>v(E)),[f,v,E]),d.jsxs(d.Fragment,{children:[d.jsx(P.span,{id:l.textId,...i,ref:x}),l.isSelected&&c.valueNode&&!c.valueNodeHasChildren?We.createPortal(i.children,c.valueNode):null]})});Pn.displayName=me;var Rn="SelectItemIndicator",Tn=s.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return bn(Rn,n).isSelected?d.jsx(P.span,{"aria-hidden":!0,...o,ref:t}):null});Tn.displayName=Rn;var je="SelectScrollUpButton",Nn=s.forwardRef((e,t)=>{const n=te(je,e.__scopeSelect),o=Qe(je,e.__scopeSelect),[r,i]=s.useState(!1),c=O(t,o.onScrollButtonChange);return L(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollTop>0;i(u)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?d.jsx(_n,{...e,ref:c,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop-l.offsetHeight)}}):null});Nn.displayName=je;var $e="SelectScrollDownButton",An=s.forwardRef((e,t)=>{const n=te($e,e.__scopeSelect),o=Qe($e,e.__scopeSelect),[r,i]=s.useState(!1),c=O(t,o.onScrollButtonChange);return L(()=>{if(n.viewport&&n.isPositioned){let a=function(){const u=l.scrollHeight-l.clientHeight,p=Math.ceil(l.scrollTop)<u;i(p)};const l=n.viewport;return a(),l.addEventListener("scroll",a),()=>l.removeEventListener("scroll",a)}},[n.viewport,n.isPositioned]),r?d.jsx(_n,{...e,ref:c,onAutoScroll:()=>{const{viewport:a,selectedItem:l}=n;a&&l&&(a.scrollTop=a.scrollTop+l.offsetHeight)}}):null});An.displayName=$e;var _n=s.forwardRef((e,t)=>{const{__scopeSelect:n,onAutoScroll:o,...r}=e,i=te("SelectScrollButton",n),c=s.useRef(null),a=Ie(n),l=s.useCallback(()=>{c.current!==null&&(window.clearInterval(c.current),c.current=null)},[]);return s.useEffect(()=>()=>l(),[l]),L(()=>{a().find(p=>p.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[a]),d.jsx(P.div,{"aria-hidden":!0,...r,ref:t,style:{flexShrink:0,...r.style},onPointerDown:I(r.onPointerDown,()=>{c.current===null&&(c.current=window.setInterval(o,50))}),onPointerMove:I(r.onPointerMove,()=>{i.onItemLeave?.(),c.current===null&&(c.current=window.setInterval(o,50))}),onPointerLeave:I(r.onPointerLeave,()=>{l()})})}),Lr="SelectSeparator",On=s.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e;return d.jsx(P.div,{"aria-hidden":!0,...o,ref:t})});On.displayName=Lr;var ke="SelectArrow",jr=s.forwardRef((e,t)=>{const{__scopeSelect:n,...o}=e,r=Je(n),i=ee(ke,n),c=te(ke,n);return i.open&&c.position==="popper"?d.jsx(hr,{...r,...o,ref:t}):null});jr.displayName=ke;var $r="SelectBubbleInput",kr=s.forwardRef(({__scopeSelect:e,value:t,...n},o)=>{const r=s.useRef(null),i=O(o,r),c=gr(t);return s.useEffect(()=>{const a=r.current;if(!a)return;const l=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(l,"value").set;if(c!==t&&p){const m=new Event("change",{bubbles:!0});p.call(a,t),a.dispatchEvent(m)}},[c,t]),d.jsx(P.select,{...n,style:{...un,...n.style},ref:i,defaultValue:t})});kr.displayName=$r;function Dn(e){return e===""||e===void 0}function Mn(e){const t=Q(e),n=s.useRef(""),o=s.useRef(0),r=s.useCallback(c=>{const a=n.current+c;t(a),(function l(u){n.current=u,window.clearTimeout(o.current),u!==""&&(o.current=window.setTimeout(()=>l(""),1e3))})(a)},[t]),i=s.useCallback(()=>{n.current="",window.clearTimeout(o.current)},[]);return s.useEffect(()=>()=>window.clearTimeout(o.current),[]),[n,r,i]}function Fn(e,t,n){const r=t.length>1&&Array.from(t).every(u=>u===t[0])?t[0]:t,i=n?e.indexOf(n):-1;let c=Br(e,Math.max(i,0));r.length===1&&(c=c.filter(u=>u!==n));const l=c.find(u=>u.textValue.toLowerCase().startsWith(r.toLowerCase()));return l!==n?l:void 0}function Br(e,t){return e.map((n,o)=>e[(t+o)%e.length])}var is=fn,as=mn,cs=vn,ls=hn,us=Sn,ds=Cn,fs=In,ps=Pn,ms=Tn,vs=Nn,hs=An,gs=On;export{zr as C,es as D,as as I,Kr as L,Zr as O,Xr as P,Vr as R,Hr as S,Gr as T,us as V,Jr as a,ts as b,Qr as c,ns as d,is as e,vs as f,hs as g,cs as h,ls as i,ds as j,fs as k,ms as l,ps as m,gs as n};
|