1 line
32 KiB
JavaScript
1 line
32 KiB
JavaScript
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,43193,(e,t,r)=>{"use strict";var n=e.r(34346),l="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=n.useState,s=n.useEffect,i=n.useLayoutEffect,o=n.useDebugValue;function d(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!l(e,r)}catch(e){return!0}}var c="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=a({inst:{value:r,getSnapshot:t}}),l=n[0].inst,c=n[1];return i(function(){l.value=r,l.getSnapshot=t,d(l)&&c({inst:l})},[e,r,t]),s(function(){return d(l)&&c({inst:l}),e(function(){d(l)&&c({inst:l})})},[e]),o(r),r};r.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:c},44738,(e,t,r)=>{"use strict";t.exports=e.r(43193)},43707,e=>{"use strict";var t=e.i(36792),r=e.i(34346),n=e.i(82772),l=e.i(92879),a=e.i(60207),s=e.i(10743),i=e.i(9991),o=e.i(90672),d=e.i(82502),c=e.i(6580),u=e.i(57213),m=e.i(28698),f=e.i(49989),p=e.i(76400),h=e.i(21471),x=e.i(77760),v=e.i(61896),g=e.i(19594),b=e.i(14268),j=e.i(22436),y=e.i(53607),N=e.i(89123),w=e.i(19706),C="Popover",[E,S]=(0,u.createContextScope)(C,[x.createPopperScope]),k=(0,x.createPopperScope)(),[R,A]=E(C),P=e=>{let{__scopePopover:n,children:l,open:a,defaultOpen:s,onOpenChange:i,modal:o=!1}=e,d=k(n),c=r.useRef(null),[u,m]=r.useState(!1),[f=!1,p]=(0,y.useControllableState)({prop:a,defaultProp:s,onChange:i});return(0,t.jsx)(x.Root,{...d,children:(0,t.jsx)(R,{scope:n,contentId:(0,h.useId)(),triggerRef:c,open:f,onOpenChange:p,onOpenToggle:r.useCallback(()=>p(e=>!e),[p]),hasCustomAnchor:u,onCustomAnchorAdd:r.useCallback(()=>m(!0),[]),onCustomAnchorRemove:r.useCallback(()=>m(!1),[]),modal:o,children:l})})};P.displayName=C;var O="PopoverAnchor";r.forwardRef((e,n)=>{let{__scopePopover:l,...a}=e,s=A(O,l),i=k(l),{onCustomAnchorAdd:o,onCustomAnchorRemove:d}=s;return r.useEffect(()=>(o(),()=>d()),[o,d]),(0,t.jsx)(x.Anchor,{...i,...a,ref:n})}).displayName=O;var I="PopoverTrigger",D=r.forwardRef((e,r)=>{let{__scopePopover:n,...l}=e,a=A(I,n),s=k(n),i=(0,c.useComposedRefs)(r,a.triggerRef),o=(0,t.jsx)(b.Primitive.button,{type:"button","aria-haspopup":"dialog","aria-expanded":a.open,"aria-controls":a.contentId,"data-state":z(a.open),...l,ref:i,onClick:(0,d.composeEventHandlers)(e.onClick,a.onOpenToggle)});return a.hasCustomAnchor?o:(0,t.jsx)(x.Anchor,{asChild:!0,...s,children:o})});D.displayName=I;var _="PopoverPortal",[F,$]=E(_,{forceMount:void 0}),M=e=>{let{__scopePopover:r,forceMount:n,children:l,container:a}=e,s=A(_,r);return(0,t.jsx)(F,{scope:r,forceMount:n,children:(0,t.jsx)(g.Presence,{present:n||s.open,children:(0,t.jsx)(v.Portal,{asChild:!0,container:a,children:l})})})};M.displayName=_;var B="PopoverContent",H=r.forwardRef((e,r)=>{let n=$(B,e.__scopePopover),{forceMount:l=n.forceMount,...a}=e,s=A(B,e.__scopePopover);return(0,t.jsx)(g.Presence,{present:l||s.open,children:s.modal?(0,t.jsx)(T,{...a,ref:r}):(0,t.jsx)(V,{...a,ref:r})})});H.displayName=B;var T=r.forwardRef((e,n)=>{let l=A(B,e.__scopePopover),a=r.useRef(null),s=(0,c.useComposedRefs)(n,a),i=r.useRef(!1);return r.useEffect(()=>{let e=a.current;if(e)return(0,N.hideOthers)(e)},[]),(0,t.jsx)(w.RemoveScroll,{as:j.Slot,allowPinchZoom:!0,children:(0,t.jsx)(K,{...e,ref:s,trapFocus:l.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:(0,d.composeEventHandlers)(e.onCloseAutoFocus,e=>{e.preventDefault(),i.current||l.triggerRef.current?.focus()}),onPointerDownOutside:(0,d.composeEventHandlers)(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,r=0===t.button&&!0===t.ctrlKey;i.current=2===t.button||r},{checkForDefaultPrevented:!1}),onFocusOutside:(0,d.composeEventHandlers)(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})}),V=r.forwardRef((e,n)=>{let l=A(B,e.__scopePopover),a=r.useRef(!1),s=r.useRef(!1);return(0,t.jsx)(K,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(a.current||l.triggerRef.current?.focus(),t.preventDefault()),a.current=!1,s.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(a.current=!0,"pointerdown"===t.detail.originalEvent.type&&(s.current=!0));let r=t.target;l.triggerRef.current?.contains(r)&&t.preventDefault(),"focusin"===t.detail.originalEvent.type&&s.current&&t.preventDefault()}})}),K=r.forwardRef((e,r)=>{let{__scopePopover:n,trapFocus:l,onOpenAutoFocus:a,onCloseAutoFocus:s,disableOutsidePointerEvents:i,onEscapeKeyDown:o,onPointerDownOutside:d,onFocusOutside:c,onInteractOutside:u,...h}=e,v=A(B,n),g=k(n);return(0,f.useFocusGuards)(),(0,t.jsx)(p.FocusScope,{asChild:!0,loop:!0,trapped:l,onMountAutoFocus:a,onUnmountAutoFocus:s,children:(0,t.jsx)(m.DismissableLayer,{asChild:!0,disableOutsidePointerEvents:i,onInteractOutside:u,onEscapeKeyDown:o,onPointerDownOutside:d,onFocusOutside:c,onDismiss:()=>v.onOpenChange(!1),children:(0,t.jsx)(x.Content,{"data-state":z(v.open),role:"dialog",id:v.contentId,...g,...h,ref:r,style:{...h.style,"--radix-popover-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-popover-content-available-width":"var(--radix-popper-available-width)","--radix-popover-content-available-height":"var(--radix-popper-available-height)","--radix-popover-trigger-width":"var(--radix-popper-anchor-width)","--radix-popover-trigger-height":"var(--radix-popper-anchor-height)"}})})})}),L="PopoverClose";function z(e){return e?"open":"closed"}r.forwardRef((e,r)=>{let{__scopePopover:n,...l}=e,a=A(L,n);return(0,t.jsx)(b.Primitive.button,{type:"button",...l,ref:r,onClick:(0,d.composeEventHandlers)(e.onClick,()=>a.onOpenChange(!1))})}).displayName=L,r.forwardRef((e,r)=>{let{__scopePopover:n,...l}=e,a=k(n);return(0,t.jsx)(x.Arrow,{...a,...l,ref:r})}).displayName="PopoverArrow";var q=e.i(69744);function U({...e}){return(0,t.jsx)(P,{"data-slot":"popover",...e})}function W({...e}){return(0,t.jsx)(D,{"data-slot":"popover-trigger",...e})}function G({className:e,align:r="center",sideOffset:n=4,...l}){return(0,t.jsx)(M,{children:(0,t.jsx)(H,{"data-slot":"popover-content",align:r,sideOffset:n,className:(0,q.cn)("bg-popover text-popover-foreground data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border p-4 shadow-md outline-hidden",e),...l})})}var Z=/[\\\/_+.#"@\[\(\{&]/,J=/[\\\/_+.#"@\[\(\{&]/g,Q=/[\s-]/,X=/[\s-]/g;function Y(e){return e.toLowerCase().replace(X," ")}var ee=e.i(97185);function et(e,t){if("function"==typeof e)return e(t);null!=e&&(e.current=t)}e.i(76124);var er=Symbol.for("react.lazy"),en=r[" use ".trim().toString()];function el(e){var t;return null!=e&&"object"==typeof e&&"$$typeof"in e&&e.$$typeof===er&&"_payload"in e&&"object"==typeof(t=e._payload)&&null!==t&&"then"in t}var ea=Symbol("radix.slottable");function es(e){return r.isValidElement(e)&&"function"==typeof e.type&&"__radixId"in e.type&&e.type.__radixId===ea}var ei=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"].reduce((e,n)=>{var l,a;let s,i,o,d=(a=l=`Primitive.${n}`,(s=r.forwardRef((e,t)=>{let{children:n,...l}=e;if(el(n)&&"function"==typeof en&&(n=en(n._payload)),r.isValidElement(n)){var a;let e,s,i=(a=n,(s=(e=Object.getOwnPropertyDescriptor(a.props,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.ref:(s=(e=Object.getOwnPropertyDescriptor(a,"ref")?.get)&&"isReactWarning"in e&&e.isReactWarning)?a.props.ref:a.props.ref||a.ref),o=function(e,t){let r={...t};for(let n in t){let l=e[n],a=t[n];/^on[A-Z]/.test(n)?l&&a?r[n]=(...e)=>{let t=a(...e);return l(...e),t}:l&&(r[n]=l):"style"===n?r[n]={...l,...a}:"className"===n&&(r[n]=[l,a].filter(Boolean).join(" "))}return{...e,...r}}(l,n.props);return n.type!==r.Fragment&&(o.ref=t?function(...e){return t=>{let r=!1,n=e.map(e=>{let n=et(e,t);return r||"function"!=typeof n||(r=!0),n});if(r)return()=>{for(let t=0;t<n.length;t++){let r=n[t];"function"==typeof r?r():et(e[t],null)}}}}(t,i):i),r.cloneElement(n,o)}return r.Children.count(n)>1?r.Children.only(null):null})).displayName=`${a}.SlotClone`,i=s,(o=r.forwardRef((e,n)=>{let{children:l,...a}=e;el(l)&&"function"==typeof en&&(l=en(l._payload));let s=r.Children.toArray(l),o=s.find(es);if(o){let e=o.props.children,l=s.map(t=>t!==o?t:r.Children.count(e)>1?r.Children.only(null):r.isValidElement(e)?e.props.children:null);return(0,t.jsx)(i,{...a,ref:n,children:r.isValidElement(e)?r.cloneElement(e,void 0,l):null})}return(0,t.jsx)(i,{...a,ref:n,children:l})})).displayName=`${l}.Slot`,o),c=r.forwardRef((e,r)=>{let{asChild:l,...a}=e;return"undefined"!=typeof window&&(window[Symbol.for("radix-ui")]=!0),(0,t.jsx)(l?d:n,{...a,ref:r})});return c.displayName=`Primitive.${n}`,{...e,[n]:c}},{}),eo=globalThis?.document?r.useLayoutEffect:()=>{},ed=r[" useId ".trim().toString()]||(()=>void 0),ec=0;function eu(e){let[t,n]=r.useState(ed());return eo(()=>{e||n(e=>e??String(ec++))},[e]),e||(t?`radix-${t}`:"")}var em=e.i(44738),ef='[cmdk-group=""]',ep='[cmdk-group-items=""]',eh='[cmdk-item=""]',ex=`${eh}:not([aria-disabled="true"])`,ev="cmdk-item-select",eg="data-value",eb=(e,t,r)=>{var n;return n=e,function e(t,r,n,l,a,s,i){if(s===r.length)return a===t.length?1:.99;var o=`${a},${s}`;if(void 0!==i[o])return i[o];for(var d,c,u,m,f=l.charAt(s),p=n.indexOf(f,a),h=0;p>=0;)(d=e(t,r,n,l,p+1,s+1,i))>h&&(p===a?d*=1:Z.test(t.charAt(p-1))?(d*=.8,(u=t.slice(a,p-1).match(J))&&a>0&&(d*=Math.pow(.999,u.length))):Q.test(t.charAt(p-1))?(d*=.9,(m=t.slice(a,p-1).match(X))&&a>0&&(d*=Math.pow(.999,m.length))):(d*=.17,a>0&&(d*=Math.pow(.999,p-a))),t.charAt(p)!==r.charAt(s)&&(d*=.9999)),(d<.1&&n.charAt(p-1)===l.charAt(s+1)||l.charAt(s+1)===l.charAt(s)&&n.charAt(p-1)!==l.charAt(s))&&.1*(c=e(t,r,n,l,p+1,s+2,i))>d&&(d=.1*c),d>h&&(h=d),p=n.indexOf(f,p+1);return i[o]=h,h}(n=r&&r.length>0?`${n+" "+r.join(" ")}`:n,t,Y(n),Y(t),0,0,{})},ej=r.createContext(void 0),ey=r.createContext(void 0),eN=r.createContext(void 0),ew=r.forwardRef((e,t)=>{let n=eD(()=>{var t,r;return{search:"",value:null!=(r=null!=(t=e.value)?t:e.defaultValue)?r:"",filtered:{count:0,items:new Map,groups:new Set}}}),l=eD(()=>new Set),a=eD(()=>new Map),s=eD(()=>new Map),i=eD(()=>new Set),o=eO(e),{label:d,children:c,value:u,onValueChange:m,filter:f,shouldFilter:p,loop:h,disablePointerSelection:x=!1,vimBindings:v=!0,...g}=e,b=eu(),j=eu(),y=eu(),N=r.useRef(null),w=eM();eI(()=>{if(void 0!==u){let e=u.trim();n.current.value=e,C.emit()}},[u]),eI(()=>{w(6,P)},[]);let C=r.useMemo(()=>({subscribe:e=>(i.current.add(e),()=>i.current.delete(e)),snapshot:()=>n.current,setState:(e,t,r)=>{var l,a,s;if(!Object.is(n.current[e],t)){if(n.current[e]=t,"search"===e)A(),k(),w(1,R);else if("value"===e&&(r||w(5,P),(null==(l=o.current)?void 0:l.value)!==void 0)){null==(s=(a=o.current).onValueChange)||s.call(a,null!=t?t:"");return}C.emit()}},emit:()=>{i.current.forEach(e=>e())}}),[]),E=r.useMemo(()=>({value:(e,t,r)=>{var l;t!==(null==(l=s.current.get(e))?void 0:l.value)&&(s.current.set(e,{value:t,keywords:r}),n.current.filtered.items.set(e,S(t,r)),w(2,()=>{k(),C.emit()}))},item:(e,t)=>(l.current.add(e),t&&(a.current.has(t)?a.current.get(t).add(e):a.current.set(t,new Set([e]))),w(3,()=>{A(),k(),n.current.value||R(),C.emit()}),()=>{s.current.delete(e),l.current.delete(e),n.current.filtered.items.delete(e);let t=O();w(4,()=>{A(),(null==t?void 0:t.getAttribute("id"))===e&&R(),C.emit()})}),group:e=>(a.current.has(e)||a.current.set(e,new Set),()=>{s.current.delete(e),a.current.delete(e)}),filter:()=>o.current.shouldFilter,label:d||e["aria-label"],getDisablePointerSelection:()=>o.current.disablePointerSelection,listId:b,inputId:y,labelId:j,listInnerRef:N}),[]);function S(e,t){var r,l;let a=null!=(l=null==(r=o.current)?void 0:r.filter)?l:eb;return e?a(e,n.current.search,t):0}function k(){if(!n.current.search||!1===o.current.shouldFilter)return;let e=n.current.filtered.items,t=[];n.current.filtered.groups.forEach(r=>{let n=a.current.get(r),l=0;n.forEach(t=>{l=Math.max(e.get(t),l)}),t.push([r,l])});let r=N.current;I().sort((t,r)=>{var n,l;let a=t.getAttribute("id"),s=r.getAttribute("id");return(null!=(n=e.get(s))?n:0)-(null!=(l=e.get(a))?l:0)}).forEach(e=>{let t=e.closest(ep);t?t.appendChild(e.parentElement===t?e:e.closest(`${ep} > *`)):r.appendChild(e.parentElement===r?e:e.closest(`${ep} > *`))}),t.sort((e,t)=>t[1]-e[1]).forEach(e=>{var t;let r=null==(t=N.current)?void 0:t.querySelector(`${ef}[${eg}="${encodeURIComponent(e[0])}"]`);null==r||r.parentElement.appendChild(r)})}function R(){let e=I().find(e=>"true"!==e.getAttribute("aria-disabled")),t=null==e?void 0:e.getAttribute(eg);C.setState("value",t||void 0)}function A(){var e,t,r,i;if(!n.current.search||!1===o.current.shouldFilter){n.current.filtered.count=l.current.size;return}n.current.filtered.groups=new Set;let d=0;for(let a of l.current){let l=S(null!=(t=null==(e=s.current.get(a))?void 0:e.value)?t:"",null!=(i=null==(r=s.current.get(a))?void 0:r.keywords)?i:[]);n.current.filtered.items.set(a,l),l>0&&d++}for(let[e,t]of a.current)for(let r of t)if(n.current.filtered.items.get(r)>0){n.current.filtered.groups.add(e);break}n.current.filtered.count=d}function P(){var e,t,r;let n=O();n&&((null==(e=n.parentElement)?void 0:e.firstChild)===n&&(null==(r=null==(t=n.closest(ef))?void 0:t.querySelector('[cmdk-group-heading=""]'))||r.scrollIntoView({block:"nearest"})),n.scrollIntoView({block:"nearest"}))}function O(){var e;return null==(e=N.current)?void 0:e.querySelector(`${eh}[aria-selected="true"]`)}function I(){var e;return Array.from((null==(e=N.current)?void 0:e.querySelectorAll(ex))||[])}function D(e){let t=I()[e];t&&C.setState("value",t.getAttribute(eg))}function _(e){var t;let r=O(),n=I(),l=n.findIndex(e=>e===r),a=n[l+e];null!=(t=o.current)&&t.loop&&(a=l+e<0?n[n.length-1]:l+e===n.length?n[0]:n[l+e]),a&&C.setState("value",a.getAttribute(eg))}function F(e){let t=O(),r=null==t?void 0:t.closest(ef),n;for(;r&&!n;)n=null==(r=e>0?function(e,t){let r=e.nextElementSibling;for(;r;){if(r.matches(t))return r;r=r.nextElementSibling}}(r,ef):function(e,t){let r=e.previousElementSibling;for(;r;){if(r.matches(t))return r;r=r.previousElementSibling}}(r,ef))?void 0:r.querySelector(ex);n?C.setState("value",n.getAttribute(eg)):_(e)}let $=()=>D(I().length-1),M=e=>{e.preventDefault(),e.metaKey?$():e.altKey?F(1):_(1)},B=e=>{e.preventDefault(),e.metaKey?D(0):e.altKey?F(-1):_(-1)};return r.createElement(ei.div,{ref:t,tabIndex:-1,...g,"cmdk-root":"",onKeyDown:e=>{var t;if(null==(t=g.onKeyDown)||t.call(g,e),!e.defaultPrevented)switch(e.key){case"n":case"j":v&&e.ctrlKey&&M(e);break;case"ArrowDown":M(e);break;case"p":case"k":v&&e.ctrlKey&&B(e);break;case"ArrowUp":B(e);break;case"Home":e.preventDefault(),D(0);break;case"End":e.preventDefault(),$();break;case"Enter":if(!e.nativeEvent.isComposing&&229!==e.keyCode){e.preventDefault();let t=O();if(t){let e=new Event(ev);t.dispatchEvent(e)}}}}},r.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:eH},d),eB(e,e=>r.createElement(ey.Provider,{value:C},r.createElement(ej.Provider,{value:E},e))))}),eC=r.forwardRef((e,t)=>{var n,l;let a=eu(),s=r.useRef(null),i=r.useContext(eN),o=r.useContext(ej),d=eO(e),c=null!=(l=null==(n=d.current)?void 0:n.forceMount)?l:null==i?void 0:i.forceMount;eI(()=>{if(!c)return o.item(a,null==i?void 0:i.id)},[c]);let u=e$(a,s,[e.value,e.children,s],e.keywords),m=r.useContext(ey),f=eF(e=>e.value&&e.value===u.current),p=eF(e=>!!c||!1===o.filter()||!e.search||e.filtered.items.get(a)>0);function h(){var e,t;x(),null==(t=(e=d.current).onSelect)||t.call(e,u.current)}function x(){m.setState("value",u.current,!0)}if(r.useEffect(()=>{let t=s.current;if(!(!t||e.disabled))return t.addEventListener(ev,h),()=>t.removeEventListener(ev,h)},[p,e.onSelect,e.disabled]),!p)return null;let{disabled:v,value:g,onSelect:b,forceMount:j,keywords:y,...N}=e;return r.createElement(ei.div,{ref:e_([s,t]),...N,id:a,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!f,"data-disabled":!!v,"data-selected":!!f,onPointerMove:v||o.getDisablePointerSelection()?void 0:x,onClick:v?void 0:h},e.children)}),eE=r.forwardRef((e,t)=>{let{heading:n,children:l,forceMount:a,...s}=e,i=eu(),o=r.useRef(null),d=r.useRef(null),c=eu(),u=r.useContext(ej),m=eF(e=>!!a||!1===u.filter()||!e.search||e.filtered.groups.has(i));eI(()=>u.group(i),[]),e$(i,o,[e.value,e.heading,d]);let f=r.useMemo(()=>({id:i,forceMount:a}),[a]);return r.createElement(ei.div,{ref:e_([o,t]),...s,"cmdk-group":"",role:"presentation",hidden:!m||void 0},n&&r.createElement("div",{ref:d,"cmdk-group-heading":"","aria-hidden":!0,id:c},n),eB(e,e=>r.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?c:void 0},r.createElement(eN.Provider,{value:f},e))))}),eS=r.forwardRef((e,t)=>{let{alwaysRender:n,...l}=e,a=r.useRef(null),s=eF(e=>!e.search);return n||s?r.createElement(ei.div,{ref:e_([a,t]),...l,"cmdk-separator":"",role:"separator"}):null}),ek=r.forwardRef((e,t)=>{let{onValueChange:n,...l}=e,a=null!=e.value,s=r.useContext(ey),i=eF(e=>e.search),o=eF(e=>e.value),d=r.useContext(ej),c=r.useMemo(()=>{var e;let t=null==(e=d.listInnerRef.current)?void 0:e.querySelector(`${eh}[${eg}="${encodeURIComponent(o)}"]`);return null==t?void 0:t.getAttribute("id")},[]);return r.useEffect(()=>{null!=e.value&&s.setState("search",e.value)},[e.value]),r.createElement(ei.input,{ref:t,...l,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":d.listId,"aria-labelledby":d.labelId,"aria-activedescendant":c,id:d.inputId,type:"text",value:a?e.value:i,onChange:e=>{a||s.setState("search",e.target.value),null==n||n(e.target.value)}})}),eR=r.forwardRef((e,t)=>{let{children:n,label:l="Suggestions",...a}=e,s=r.useRef(null),i=r.useRef(null),o=r.useContext(ej);return r.useEffect(()=>{if(i.current&&s.current){let e=i.current,t=s.current,r,n=new ResizeObserver(()=>{r=requestAnimationFrame(()=>{let r=e.offsetHeight;t.style.setProperty("--cmdk-list-height",r.toFixed(1)+"px")})});return n.observe(e),()=>{cancelAnimationFrame(r),n.unobserve(e)}}},[]),r.createElement(ei.div,{ref:e_([s,t]),...a,"cmdk-list":"",role:"listbox","aria-label":l,id:o.listId},eB(e,e=>r.createElement("div",{ref:e_([i,o.listInnerRef]),"cmdk-list-sizer":""},e)))}),eA=r.forwardRef((e,t)=>{let{open:n,onOpenChange:l,overlayClassName:a,contentClassName:s,container:i,...o}=e;return r.createElement(ee.Root,{open:n,onOpenChange:l},r.createElement(ee.Portal,{container:i},r.createElement(ee.Overlay,{"cmdk-overlay":"",className:a}),r.createElement(ee.Content,{"aria-label":e.label,"cmdk-dialog":"",className:s},r.createElement(ew,{ref:t,...o}))))}),eP=Object.assign(ew,{List:eR,Item:eC,Input:ek,Group:eE,Separator:eS,Dialog:eA,Empty:r.forwardRef((e,t)=>eF(e=>0===e.filtered.count)?r.createElement(ei.div,{ref:t,...e,"cmdk-empty":"",role:"presentation"}):null),Loading:r.forwardRef((e,t)=>{let{progress:n,children:l,label:a="Loading...",...s}=e;return r.createElement(ei.div,{ref:t,...s,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":a},eB(e,e=>r.createElement("div",{"aria-hidden":!0},e)))})});function eO(e){let t=r.useRef(e);return eI(()=>{t.current=e}),t}var eI="undefined"==typeof window?r.useEffect:r.useLayoutEffect;function eD(e){let t=r.useRef();return void 0===t.current&&(t.current=e()),t}function e_(e){return t=>{e.forEach(e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)})}}function eF(e){let t=r.useContext(ey),n=()=>e(t.snapshot());return(0,em.useSyncExternalStore)(t.subscribe,n,n)}function e$(e,t,n,l=[]){let a=r.useRef(),s=r.useContext(ej);return eI(()=>{var r;let i=(()=>{var e;for(let t of n){if("string"==typeof t)return t.trim();if("object"==typeof t&&"current"in t)return t.current?null==(e=t.current.textContent)?void 0:e.trim():a.current}})(),o=l.map(e=>e.trim());s.value(e,i,o),null==(r=t.current)||r.setAttribute(eg,i),a.current=i}),a}var eM=()=>{let[e,t]=r.useState(),n=eD(()=>new Map);return eI(()=>{n.current.forEach(e=>e()),n.current=new Map},[e]),(e,r)=>{n.current.set(e,r),t({})}};function eB({asChild:e,children:t},n){let l;return e&&r.isValidElement(t)?r.cloneElement("function"==typeof(l=t.type)?l(t.props):"render"in l?l.render(t.props):t,{ref:t.ref},n(t.props.children)):n(t)}var eH={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"},eT=e.i(89926),eT=eT;function eV({className:e,...r}){return(0,t.jsx)(eP,{"data-slot":"command",className:(0,q.cn)("bg-popover text-popover-foreground flex h-full w-full flex-col overflow-hidden rounded-md",e),...r})}function eK({className:e,...r}){return(0,t.jsxs)("div",{"data-slot":"command-input-wrapper",className:"flex h-9 items-center gap-2 border-b px-3",children:[(0,t.jsx)(eT.default,{className:"size-4 shrink-0 opacity-50"}),(0,t.jsx)(eP.Input,{"data-slot":"command-input",className:(0,q.cn)("placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",e),...r})]})}function eL({className:e,...r}){return(0,t.jsx)(eP.List,{"data-slot":"command-list",className:(0,q.cn)("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",e),...r})}function ez({...e}){return(0,t.jsx)(eP.Empty,{"data-slot":"command-empty",className:"py-6 text-center text-sm",...e})}function eq({className:e,...r}){return(0,t.jsx)(eP.Group,{"data-slot":"command-group",className:(0,q.cn)("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",e),...r})}function eU({className:e,...r}){return(0,t.jsx)(eP.Item,{"data-slot":"command-item",className:(0,q.cn)("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground [&_svg:not([class*='text-'])]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",e),...r})}e.i(90432);var eW=e.i(99490),eW=eW;let eG=(0,e.i(27706).default)("ChevronsUpDown",[["path",{d:"m7 15 5 5 5-5",key:"1hf1tw"}],["path",{d:"m7 9 5-5 5 5",key:"sgt6xg"}]]);function eZ(){let e,d,c,u,{treeData:m}=(0,l.useFamily)(),{calculateRelationship:f,getDirectRelatives:p,getSiblings:h}=(0,a.useRelationship)(),[x,v]=(0,r.useState)(""),[g,b]=(0,r.useState)(""),[j,y]=(0,r.useState)(null),[N,w]=(0,r.useState)(!1),[C,E]=(0,r.useState)(!1),S=Object.values(m.members);return(0,t.jsxs)("div",{className:"min-h-screen flex flex-col bg-background",children:[(0,t.jsx)(n.SiteHeader,{}),(0,t.jsx)("main",{className:"flex-1 container mx-auto px-4 py-12",children:(0,t.jsxs)("div",{className:"max-w-4xl mx-auto space-y-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-3xl font-serif font-bold mb-2",children:"家族关系计算器"}),(0,t.jsx)("p",{className:"text-muted-foreground",children:"选择两个家族成员,自动计算他们之间的亲属关系"})]}),(0,t.jsxs)(s.Card,{className:"border-none shadow-sm bg-card/50 backdrop-blur",children:[(0,t.jsxs)(s.CardHeader,{className:"text-center",children:[(0,t.jsx)(s.CardTitle,{className:"text-2xl font-serif font-light",children:"选择成员"}),(0,t.jsx)(s.CardDescription,{className:"font-light",children:"请选择要计算关系的两个成员"})]}),(0,t.jsxs)(s.CardContent,{className:"space-y-8",children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:"成员A"}),(0,t.jsxs)(U,{open:N,onOpenChange:w,children:[(0,t.jsx)(W,{asChild:!0,children:(0,t.jsxs)(i.Button,{variant:"outline",role:"combobox","aria-expanded":N,className:"w-full justify-between",children:[x?S.find(e=>e.id===x)?.fullName:"搜索或选择成员A...",(0,t.jsx)(eG,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(G,{className:"w-full p-0",align:"start",children:(0,t.jsxs)(eV,{children:[(0,t.jsx)(eK,{placeholder:"输入姓名搜索..."}),(0,t.jsxs)(eL,{children:[(0,t.jsx)(ez,{children:"未找到成员"}),(0,t.jsx)(eq,{children:S.map(e=>(0,t.jsxs)(eU,{value:`${e.fullName} ${e.generation}`,onSelect:()=>{v(e.id),w(!1)},children:[(0,t.jsx)(eW.default,{className:(0,q.cn)("mr-2 h-4 w-4",x===e.id?"opacity-100":"opacity-0")}),e.fullName," (第",e.generation,"世)"]},e.id))})]})]})})]})]}),(0,t.jsxs)("div",{className:"space-y-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:"成员B"}),(0,t.jsxs)(U,{open:C,onOpenChange:E,children:[(0,t.jsx)(W,{asChild:!0,children:(0,t.jsxs)(i.Button,{variant:"outline",role:"combobox","aria-expanded":C,className:"w-full justify-between",children:[g?S.find(e=>e.id===g)?.fullName:"搜索或选择成员B...",(0,t.jsx)(eG,{className:"ml-2 h-4 w-4 shrink-0 opacity-50"})]})}),(0,t.jsx)(G,{className:"w-full p-0",align:"start",children:(0,t.jsxs)(eV,{children:[(0,t.jsx)(eK,{placeholder:"输入姓名搜索..."}),(0,t.jsxs)(eL,{children:[(0,t.jsx)(ez,{children:"未找到成员"}),(0,t.jsx)(eq,{children:S.map(e=>(0,t.jsxs)(eU,{value:`${e.fullName} ${e.generation}`,onSelect:()=>{b(e.id),E(!1)},children:[(0,t.jsx)(eW.default,{className:(0,q.cn)("mr-2 h-4 w-4",g===e.id?"opacity-100":"opacity-0")}),e.fullName," (第",e.generation,"世)"]},e.id))})]})]})})]})]})]}),(0,t.jsx)(i.Button,{onClick:()=>{if(!x||!g)return;let e=f(x,g);y({from:m.members[x],to:m.members[g],relationship:e})},disabled:!x||!g,className:"w-full h-12 bg-primary text-primary-foreground hover:bg-primary/90",children:"计算关系"})]})]}),j&&(0,t.jsxs)(s.Card,{className:"border-none shadow-sm bg-card/50 backdrop-blur",children:[(0,t.jsx)(s.CardHeader,{className:"text-center",children:(0,t.jsx)(s.CardTitle,{className:"text-2xl font-serif font-light",children:"计算结果"})}),(0,t.jsxs)(s.CardContent,{className:"space-y-4",children:[(0,t.jsxs)("div",{className:"flex items-center justify-center gap-6 p-8 bg-muted/30 rounded-lg",children:[(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-2xl font-serif font-light mb-1",children:j.from.fullName}),(0,t.jsxs)("div",{className:"text-sm text-muted-foreground font-light",children:["第",j.from.generation,"世"]})]}),(0,t.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,t.jsx)(o.Badge,{className:"text-lg px-6 py-2 bg-primary text-primary-foreground",children:j.relationship.term}),j.relationship.path&&(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["路径: ",j.relationship.path]})]}),(0,t.jsxs)("div",{className:"text-center",children:[(0,t.jsx)("div",{className:"text-2xl font-serif font-light mb-1",children:j.to.fullName}),(0,t.jsxs)("div",{className:"text-sm text-muted-foreground font-light",children:["第",j.to.generation,"世"]})]})]}),j.relationship.description&&(0,t.jsxs)("div",{className:"p-6 bg-primary/5 rounded-lg",children:[(0,t.jsx)("div",{className:"text-sm font-light mb-2 text-center",children:"关系说明"}),(0,t.jsxs)("div",{className:"text-muted-foreground font-light text-center",children:[(0,t.jsx)("strong",{children:j.from.fullName})," 是 ",(0,t.jsx)("strong",{children:j.to.fullName})," 的 ",(0,t.jsx)("strong",{className:"text-primary",children:j.relationship.term})]})]}),!1===j.relationship.success&&(0,t.jsx)("div",{className:"p-4 bg-yellow-50 dark:bg-yellow-950 rounded-lg",children:(0,t.jsxs)("div",{className:"text-sm text-yellow-800 dark:text-yellow-200",children:["⚠️ ",j.relationship.error||"无法计算关系"]})})]})]}),(x||g)&&(0,t.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[x&&(0,t.jsxs)(s.Card,{className:"border-none shadow-sm bg-card/50 backdrop-blur",children:[(0,t.jsx)(s.CardHeader,{children:(0,t.jsxs)(s.CardTitle,{className:"text-xl font-serif font-light",children:[m.members[x]?.fullName," 的直系亲属"]})}),(0,t.jsx)(s.CardContent,{children:(d=p(x))?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-3",children:[d.father&&(0,t.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,t.jsx)("div",{className:"text-sm text-muted-foreground mb-1",children:"父亲"}),(0,t.jsx)("div",{className:"font-medium",children:d.father.fullName})]}),d.mother&&(0,t.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,t.jsx)("div",{className:"text-sm text-muted-foreground mb-1",children:"母亲"}),(0,t.jsx)("div",{className:"font-medium",children:d.mother.fullName})]}),d.spouses.length>0&&(0,t.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,t.jsx)("div",{className:"text-sm text-muted-foreground mb-1",children:"配偶"}),d.spouses.map(e=>(0,t.jsx)("div",{className:"font-medium",children:e.fullName},e.id))]}),d.children.length>0&&(0,t.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,t.jsxs)("div",{className:"text-sm text-muted-foreground mb-1",children:["子女 (",d.children.length,"人)"]}),(0,t.jsxs)("div",{className:"space-y-1",children:[d.children.slice(0,3).map(e=>(0,t.jsx)("div",{className:"font-medium text-sm",children:e.fullName},e.id)),d.children.length>3&&(0,t.jsxs)("div",{className:"text-xs text-muted-foreground",children:["还有 ",d.children.length-3," 人..."]})]})]})]}),0===(e=h(x)).length?null:(0,t.jsxs)("div",{className:"mt-3 p-3 bg-muted rounded-lg",children:[(0,t.jsxs)("div",{className:"text-sm text-muted-foreground mb-2",children:["兄弟姐妹 (",e.length,"人)"]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:e.map(e=>(0,t.jsx)(o.Badge,{variant:"outline",children:e.fullName},e.id))})]})]}):null})]}),g&&(0,t.jsxs)(s.Card,{className:"border-none shadow-sm bg-card/50 backdrop-blur",children:[(0,t.jsx)(s.CardHeader,{children:(0,t.jsxs)(s.CardTitle,{className:"text-xl font-serif font-light",children:[m.members[g]?.fullName," 的直系亲属"]})}),(0,t.jsx)(s.CardContent,{children:(u=p(g))?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{className:"grid grid-cols-1 gap-3",children:[u.father&&(0,t.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,t.jsx)("div",{className:"text-sm text-muted-foreground mb-1",children:"父亲"}),(0,t.jsx)("div",{className:"font-medium",children:u.father.fullName})]}),u.mother&&(0,t.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,t.jsx)("div",{className:"text-sm text-muted-foreground mb-1",children:"母亲"}),(0,t.jsx)("div",{className:"font-medium",children:u.mother.fullName})]}),u.spouses.length>0&&(0,t.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,t.jsx)("div",{className:"text-sm text-muted-foreground mb-1",children:"配偶"}),u.spouses.map(e=>(0,t.jsx)("div",{className:"font-medium",children:e.fullName},e.id))]}),u.children.length>0&&(0,t.jsxs)("div",{className:"p-3 bg-muted rounded-lg",children:[(0,t.jsxs)("div",{className:"text-sm text-muted-foreground mb-1",children:["子女 (",u.children.length,"人)"]}),(0,t.jsxs)("div",{className:"space-y-1",children:[u.children.slice(0,3).map(e=>(0,t.jsx)("div",{className:"font-medium text-sm",children:e.fullName},e.id)),u.children.length>3&&(0,t.jsxs)("div",{className:"text-xs text-muted-foreground",children:["还有 ",u.children.length-3," 人..."]})]})]})]}),0===(c=h(g)).length?null:(0,t.jsxs)("div",{className:"mt-3 p-3 bg-muted rounded-lg",children:[(0,t.jsxs)("div",{className:"text-sm text-muted-foreground mb-2",children:["兄弟姐妹 (",c.length,"人)"]}),(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:c.map(e=>(0,t.jsx)(o.Badge,{variant:"outline",children:e.fullName},e.id))})]})]}):null})]})]})]})})]})}e.s(["default",()=>eZ],43707)}]); |