dccxx-s3-explorer 1.0.87 → 1.0.89

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.
@@ -201,7 +201,7 @@ function print() { __p += __j.call(arguments, '') }
201
201
  * This source code is licensed under the ISC license.
202
202
  * See the LICENSE file in the root directory of this source tree.
203
203
  */const lg=Sn("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);function Bx(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var o=t.length;for(e=0;e<o;e++)t[e]&&(n=Bx(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function zx(){for(var t,e,n=0,r="",o=arguments.length;n<o;n++)(t=arguments[n])&&(e=Bx(t))&&(r&&(r+=" "),r+=e);return r}function WD(t){if(typeof document>"u")return;let e=document.head||document.getElementsByTagName("head")[0],n=document.createElement("style");n.type="text/css",e.firstChild?e.insertBefore(n,e.firstChild):e.appendChild(n),n.styleSheet?n.styleSheet.cssText=t:n.appendChild(document.createTextNode(t))}WD(`:root{--toastify-color-light: #fff;--toastify-color-dark: #121212;--toastify-color-info: #3498db;--toastify-color-success: #07bc0c;--toastify-color-warning: #f1c40f;--toastify-color-error: hsl(6, 78%, 57%);--toastify-color-transparent: rgba(255, 255, 255, .7);--toastify-icon-color-info: var(--toastify-color-info);--toastify-icon-color-success: var(--toastify-color-success);--toastify-icon-color-warning: var(--toastify-color-warning);--toastify-icon-color-error: var(--toastify-color-error);--toastify-container-width: fit-content;--toastify-toast-width: 320px;--toastify-toast-offset: 16px;--toastify-toast-top: max(var(--toastify-toast-offset), env(safe-area-inset-top));--toastify-toast-right: max(var(--toastify-toast-offset), env(safe-area-inset-right));--toastify-toast-left: max(var(--toastify-toast-offset), env(safe-area-inset-left));--toastify-toast-bottom: max(var(--toastify-toast-offset), env(safe-area-inset-bottom));--toastify-toast-background: #fff;--toastify-toast-padding: 14px;--toastify-toast-min-height: 64px;--toastify-toast-max-height: 800px;--toastify-toast-bd-radius: 6px;--toastify-toast-shadow: 0px 4px 12px rgba(0, 0, 0, .1);--toastify-font-family: sans-serif;--toastify-z-index: 9999;--toastify-text-color-light: #757575;--toastify-text-color-dark: #fff;--toastify-text-color-info: #fff;--toastify-text-color-success: #fff;--toastify-text-color-warning: #fff;--toastify-text-color-error: #fff;--toastify-spinner-color: #616161;--toastify-spinner-color-empty-area: #e0e0e0;--toastify-color-progress-light: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55);--toastify-color-progress-dark: #bb86fc;--toastify-color-progress-info: var(--toastify-color-info);--toastify-color-progress-success: var(--toastify-color-success);--toastify-color-progress-warning: var(--toastify-color-warning);--toastify-color-progress-error: var(--toastify-color-error);--toastify-color-progress-bgo: .2}.Toastify__toast-container{z-index:var(--toastify-z-index);-webkit-transform:translate3d(0,0,var(--toastify-z-index));position:fixed;width:var(--toastify-container-width);box-sizing:border-box;color:#fff;display:flex;flex-direction:column}.Toastify__toast-container--top-left{top:var(--toastify-toast-top);left:var(--toastify-toast-left)}.Toastify__toast-container--top-center{top:var(--toastify-toast-top);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--top-right{top:var(--toastify-toast-top);right:var(--toastify-toast-right);align-items:end}.Toastify__toast-container--bottom-left{bottom:var(--toastify-toast-bottom);left:var(--toastify-toast-left)}.Toastify__toast-container--bottom-center{bottom:var(--toastify-toast-bottom);left:50%;transform:translate(-50%);align-items:center}.Toastify__toast-container--bottom-right{bottom:var(--toastify-toast-bottom);right:var(--toastify-toast-right);align-items:end}.Toastify__toast{--y: 0;position:relative;touch-action:none;width:var(--toastify-toast-width);min-height:var(--toastify-toast-min-height);box-sizing:border-box;margin-bottom:1rem;padding:var(--toastify-toast-padding);border-radius:var(--toastify-toast-bd-radius);box-shadow:var(--toastify-toast-shadow);max-height:var(--toastify-toast-max-height);font-family:var(--toastify-font-family);z-index:0;display:flex;flex:1 auto;align-items:center;word-break:break-word}@media only screen and (max-width: 480px){.Toastify__toast-container{width:100vw;left:env(safe-area-inset-left);margin:0}.Toastify__toast-container--top-left,.Toastify__toast-container--top-center,.Toastify__toast-container--top-right{top:env(safe-area-inset-top);transform:translate(0)}.Toastify__toast-container--bottom-left,.Toastify__toast-container--bottom-center,.Toastify__toast-container--bottom-right{bottom:env(safe-area-inset-bottom);transform:translate(0)}.Toastify__toast-container--rtl{right:env(safe-area-inset-right);left:initial}.Toastify__toast{--toastify-toast-width: 100%;margin-bottom:0;border-radius:0}}.Toastify__toast-container[data-stacked=true]{width:var(--toastify-toast-width)}.Toastify__toast--stacked{position:absolute;width:100%;transform:translate3d(0,var(--y),0) scale(var(--s));transition:transform .3s}.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body,.Toastify__toast--stacked[data-collapsed] .Toastify__close-button{transition:opacity .1s}.Toastify__toast--stacked[data-collapsed=false]{overflow:visible}.Toastify__toast--stacked[data-collapsed=true]:not(:last-child)>*{opacity:0}.Toastify__toast--stacked:after{content:"";position:absolute;left:0;right:0;height:calc(var(--g) * 1px);bottom:100%}.Toastify__toast--stacked[data-pos=top]{top:0}.Toastify__toast--stacked[data-pos=bot]{bottom:0}.Toastify__toast--stacked[data-pos=bot].Toastify__toast--stacked:before{transform-origin:top}.Toastify__toast--stacked[data-pos=top].Toastify__toast--stacked:before{transform-origin:bottom}.Toastify__toast--stacked:before{content:"";position:absolute;left:0;right:0;bottom:0;height:100%;transform:scaleY(3);z-index:-1}.Toastify__toast--rtl{direction:rtl}.Toastify__toast--close-on-click{cursor:pointer}.Toastify__toast-icon{margin-inline-end:10px;width:22px;flex-shrink:0;display:flex}.Toastify--animate{animation-fill-mode:both;animation-duration:.5s}.Toastify--animate-icon{animation-fill-mode:both;animation-duration:.3s}.Toastify__toast-theme--dark{background:var(--toastify-color-dark);color:var(--toastify-text-color-dark)}.Toastify__toast-theme--light,.Toastify__toast-theme--colored.Toastify__toast--default{background:var(--toastify-color-light);color:var(--toastify-text-color-light)}.Toastify__toast-theme--colored.Toastify__toast--info{color:var(--toastify-text-color-info);background:var(--toastify-color-info)}.Toastify__toast-theme--colored.Toastify__toast--success{color:var(--toastify-text-color-success);background:var(--toastify-color-success)}.Toastify__toast-theme--colored.Toastify__toast--warning{color:var(--toastify-text-color-warning);background:var(--toastify-color-warning)}.Toastify__toast-theme--colored.Toastify__toast--error{color:var(--toastify-text-color-error);background:var(--toastify-color-error)}.Toastify__progress-bar-theme--light{background:var(--toastify-color-progress-light)}.Toastify__progress-bar-theme--dark{background:var(--toastify-color-progress-dark)}.Toastify__progress-bar--info{background:var(--toastify-color-progress-info)}.Toastify__progress-bar--success{background:var(--toastify-color-progress-success)}.Toastify__progress-bar--warning{background:var(--toastify-color-progress-warning)}.Toastify__progress-bar--error{background:var(--toastify-color-progress-error)}.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning,.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error{background:var(--toastify-color-transparent)}.Toastify__close-button{color:#fff;position:absolute;top:6px;right:6px;background:transparent;outline:none;border:none;padding:0;cursor:pointer;opacity:.7;transition:.3s ease;z-index:1}.Toastify__toast--rtl .Toastify__close-button{left:6px;right:unset}.Toastify__close-button--light{color:#000;opacity:.3}.Toastify__close-button>svg{fill:currentColor;height:16px;width:14px}.Toastify__close-button:hover,.Toastify__close-button:focus{opacity:1}@keyframes Toastify__trackProgress{0%{transform:scaleX(1)}to{transform:scaleX(0)}}.Toastify__progress-bar{position:absolute;bottom:0;left:0;width:100%;height:100%;z-index:1;opacity:.7;transform-origin:left}.Toastify__progress-bar--animated{animation:Toastify__trackProgress linear 1 forwards}.Toastify__progress-bar--controlled{transition:transform .2s}.Toastify__progress-bar--rtl{right:0;left:initial;transform-origin:right;border-bottom-left-radius:initial}.Toastify__progress-bar--wrp{position:absolute;overflow:hidden;bottom:0;left:0;width:100%;height:5px;border-bottom-left-radius:var(--toastify-toast-bd-radius);border-bottom-right-radius:var(--toastify-toast-bd-radius)}.Toastify__progress-bar--wrp[data-hidden=true]{opacity:0}.Toastify__progress-bar--bg{opacity:var(--toastify-color-progress-bgo);width:100%;height:100%}.Toastify__spinner{width:20px;height:20px;box-sizing:border-box;border:2px solid;border-radius:100%;border-color:var(--toastify-spinner-color-empty-area);border-right-color:var(--toastify-spinner-color);animation:Toastify__spin .65s linear infinite}@keyframes Toastify__bounceInRight{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(3000px,0,0)}60%{opacity:1;transform:translate3d(-25px,0,0)}75%{transform:translate3d(10px,0,0)}90%{transform:translate3d(-5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutRight{20%{opacity:1;transform:translate3d(-20px,var(--y),0)}to{opacity:0;transform:translate3d(2000px,var(--y),0)}}@keyframes Toastify__bounceInLeft{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(-3000px,0,0)}60%{opacity:1;transform:translate3d(25px,0,0)}75%{transform:translate3d(-10px,0,0)}90%{transform:translate3d(5px,0,0)}to{transform:none}}@keyframes Toastify__bounceOutLeft{20%{opacity:1;transform:translate3d(20px,var(--y),0)}to{opacity:0;transform:translate3d(-2000px,var(--y),0)}}@keyframes Toastify__bounceInUp{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,3000px,0)}60%{opacity:1;transform:translate3d(0,-20px,0)}75%{transform:translate3d(0,10px,0)}90%{transform:translate3d(0,-5px,0)}to{transform:translateZ(0)}}@keyframes Toastify__bounceOutUp{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,-2000px,0)}}@keyframes Toastify__bounceInDown{0%,60%,75%,90%,to{animation-timing-function:cubic-bezier(.215,.61,.355,1)}0%{opacity:0;transform:translate3d(0,-3000px,0)}60%{opacity:1;transform:translate3d(0,25px,0)}75%{transform:translate3d(0,-10px,0)}90%{transform:translate3d(0,5px,0)}to{transform:none}}@keyframes Toastify__bounceOutDown{20%{transform:translate3d(0,calc(var(--y) - 10px),0)}40%,45%{opacity:1;transform:translate3d(0,calc(var(--y) + 20px),0)}to{opacity:0;transform:translate3d(0,2000px,0)}}.Toastify__bounce-enter--top-left,.Toastify__bounce-enter--bottom-left{animation-name:Toastify__bounceInLeft}.Toastify__bounce-enter--top-right,.Toastify__bounce-enter--bottom-right{animation-name:Toastify__bounceInRight}.Toastify__bounce-enter--top-center{animation-name:Toastify__bounceInDown}.Toastify__bounce-enter--bottom-center{animation-name:Toastify__bounceInUp}.Toastify__bounce-exit--top-left,.Toastify__bounce-exit--bottom-left{animation-name:Toastify__bounceOutLeft}.Toastify__bounce-exit--top-right,.Toastify__bounce-exit--bottom-right{animation-name:Toastify__bounceOutRight}.Toastify__bounce-exit--top-center{animation-name:Toastify__bounceOutUp}.Toastify__bounce-exit--bottom-center{animation-name:Toastify__bounceOutDown}@keyframes Toastify__zoomIn{0%{opacity:0;transform:scale3d(.3,.3,.3)}50%{opacity:1}}@keyframes Toastify__zoomOut{0%{opacity:1}50%{opacity:0;transform:translate3d(0,var(--y),0) scale3d(.3,.3,.3)}to{opacity:0}}.Toastify__zoom-enter{animation-name:Toastify__zoomIn}.Toastify__zoom-exit{animation-name:Toastify__zoomOut}@keyframes Toastify__flipIn{0%{transform:perspective(400px) rotateX(90deg);animation-timing-function:ease-in;opacity:0}40%{transform:perspective(400px) rotateX(-20deg);animation-timing-function:ease-in}60%{transform:perspective(400px) rotateX(10deg);opacity:1}80%{transform:perspective(400px) rotateX(-5deg)}to{transform:perspective(400px)}}@keyframes Toastify__flipOut{0%{transform:translate3d(0,var(--y),0) perspective(400px)}30%{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(-20deg);opacity:1}to{transform:translate3d(0,var(--y),0) perspective(400px) rotateX(90deg);opacity:0}}.Toastify__flip-enter{animation-name:Toastify__flipIn}.Toastify__flip-exit{animation-name:Toastify__flipOut}@keyframes Toastify__slideInRight{0%{transform:translate3d(110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInLeft{0%{transform:translate3d(-110%,0,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInUp{0%{transform:translate3d(0,110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideInDown{0%{transform:translate3d(0,-110%,0);visibility:visible}to{transform:translate3d(0,var(--y),0)}}@keyframes Toastify__slideOutRight{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(110%,var(--y),0)}}@keyframes Toastify__slideOutLeft{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(-110%,var(--y),0)}}@keyframes Toastify__slideOutDown{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,500px,0)}}@keyframes Toastify__slideOutUp{0%{transform:translate3d(0,var(--y),0)}to{visibility:hidden;transform:translate3d(0,-500px,0)}}.Toastify__slide-enter--top-left,.Toastify__slide-enter--bottom-left{animation-name:Toastify__slideInLeft}.Toastify__slide-enter--top-right,.Toastify__slide-enter--bottom-right{animation-name:Toastify__slideInRight}.Toastify__slide-enter--top-center{animation-name:Toastify__slideInDown}.Toastify__slide-enter--bottom-center{animation-name:Toastify__slideInUp}.Toastify__slide-exit--top-left,.Toastify__slide-exit--bottom-left{animation-name:Toastify__slideOutLeft;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-right,.Toastify__slide-exit--bottom-right{animation-name:Toastify__slideOutRight;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--top-center{animation-name:Toastify__slideOutUp;animation-timing-function:ease-in;animation-duration:.3s}.Toastify__slide-exit--bottom-center{animation-name:Toastify__slideOutDown;animation-timing-function:ease-in;animation-duration:.3s}@keyframes Toastify__spin{0%{transform:rotate(0)}to{transform:rotate(360deg)}}
204
- `);var dg=t=>typeof t=="number"&&!isNaN(t),oc=t=>typeof t=="string",Vx=t=>typeof t=="function",qD=t=>oc(t)||dg(t),YD=t=>M.isValidElement(t)||oc(t)||Vx(t)||dg(t),JD=1,Kx=()=>`${JD++}`,ho=new Map,ug=[],Gx=new Set,jx=()=>ho.size>0,QD=(t,{containerId:e})=>{var n;return(n=ho.get(e||1))==null?void 0:n.toasts.get(t)};function XD(t,e){var n;if(e)return!!((n=ho.get(e))!=null&&n.isToastActive(t));let r=!1;return ho.forEach(o=>{o.isToastActive(t)&&(r=!0)}),r}function ZD(t){if(!jx()){ug=ug.filter(e=>t!=null&&e.options.toastId!==t);return}if(t==null||qD(t))ho.forEach(e=>{e.removeToast(t)});else if(t&&("containerId"in t||"id"in t)){let e=ho.get(t.containerId);e?e.removeToast(t.id):ho.forEach(n=>{n.removeToast(t.id)})}}var eL=(t={})=>{ho.forEach(e=>{e.props.limit&&(!t.containerId||e.id===t.containerId)&&e.clearQueue()})};function tL(t,e){YD(t)&&(jx()||ug.push({content:t,options:e}),ho.forEach(n=>{n.buildToast(t,e)}))}function Wx(t,e){ho.forEach(n=>{(e==null||!(e!=null&&e.containerId)||(e==null?void 0:e.containerId)===n.id)&&n.toggle(t,e==null?void 0:e.id)})}function nL(t){return Gx.add(t),()=>{Gx.delete(t)}}function rL(t){return t&&(oc(t.toastId)||dg(t.toastId))?t.toastId:Kx()}function ic(t,e){return tL(t,e),e.toastId}function Vd(t,e){return{...e,type:e&&e.type||t,toastId:rL(e)}}function Kd(t){return(e,n)=>ic(e,Vd(t,n))}function st(t,e){return ic(t,Vd("default",e))}st.loading=(t,e)=>ic(t,Vd("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...e}));function oL(t,{pending:e,error:n,success:r},o){let a;e&&(a=oc(e)?st.loading(e,o):st.loading(e.render,{...o,...e}));let s={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(h,p,g)=>{if(p==null){st.dismiss(a);return}let w={type:h,...s,...o,data:g},y=oc(p)?{render:p}:p;return a?st.update(a,{...w,...y}):st(y.render,{...w,...y}),g},u=Vx(t)?t():t;return u.then(h=>l("success",r,h)).catch(h=>l("error",n,h)),u}st.promise=oL,st.success=Kd("success"),st.info=Kd("info"),st.error=Kd("error"),st.warning=Kd("warning"),st.warn=st.warning,st.dark=(t,e)=>ic(t,Vd("default",{theme:"dark",...e}));function iL(t){ZD(t)}st.dismiss=iL,st.clearWaitingQueue=eL,st.isActive=XD,st.update=(t,e={})=>{let n=QD(t,e);if(n){let{props:r,content:o}=n,a={delay:100,...r,...e,toastId:e.toastId||t,updateId:Kx()};a.toastId!==t&&(a.staleId=t);let s=a.render||o;delete a.render,ic(s,a)}},st.done=t=>{st.update(t,{progress:1})},st.onChange=nL,st.play=t=>Wx(!0,t),st.pause=t=>Wx(!1,t);const aL={category:"Thư mục gốc",fileName:"Tên tệp",fullPath:"Đường dẫn đầy đủ",createAt:"Ngày tạo",creator:"Người tạo",creatorId:"ID người tạo",DataSource:"Nguồn dữ liệu",SuggestedAICategories:"Danh mục AI gợi ý",KeywordAISuggestion:"Từ khóa AI gợi ý",SummaryOfSuggestedAI:"Tóm tắt AI gợi ý",AccessLevel:"Cấp độ truy cập"},sL=t=>t==="SummaryOfSuggestedAI"||t==="KeywordAISuggestion"||t==="SuggestedAICategories",fg=t=>t==="fullPath"||t==="createAt"||t==="creator"||t==="creatorId"||t==="DataSource"||t==="AccessLevel"||t==="category"||t==="fileName",cL={STARTING:"Đang bắt đầu",IN_PROGRESS:"Đang đồng bộ",COMPLETE:"Đồng bộ thành công",FAILED:"Đồng bộ thất bại",STOPPING:"Đang dừng",STOPPED:"Đã dừng"},lL=t=>cL[t]||t;function mi(t){const e=dL(t),n=C.forwardRef((r,o)=>{const{children:a,...s}=r,l=C.Children.toArray(a),u=l.find(fL);if(u){const h=u.props.children,p=l.map(g=>g===u?C.Children.count(h)>1?C.Children.only(null):C.isValidElement(h)?h.props.children:null:g);return d.jsx(e,{...s,ref:o,children:C.isValidElement(h)?C.cloneElement(h,void 0,p):null})}return d.jsx(e,{...s,ref:o,children:a})});return n.displayName=`${t}.Slot`,n}var qx=mi("Slot");function dL(t){const e=C.forwardRef((n,r)=>{const{children:o,...a}=n;if(C.isValidElement(o)){const s=pL(o),l=hL(a,o.props);return o.type!==C.Fragment&&(l.ref=r?FC(r,s):s),C.cloneElement(o,l)}return C.Children.count(o)>1?C.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var uL=Symbol("radix.slottable");function fL(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===uL}function hL(t,e){const n={...e};for(const r in e){const o=t[r],a=e[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...l)=>{const u=a(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...t,...n}}function pL(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const hg="-",gL=t=>{const e=vL(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{const l=s.split(hg);return l[0]===""&&l.length!==1&&l.shift(),Yx(l,e)||mL(s)},getConflictingClassGroupIds:(s,l)=>{const u=n[s]||[];return l&&r[s]?[...u,...r[s]]:u}}},Yx=(t,e)=>{var s;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),o=r?Yx(t.slice(1),r):void 0;if(o)return o;if(e.validators.length===0)return;const a=t.join(hg);return(s=e.validators.find(({validator:l})=>l(a)))==null?void 0:s.classGroupId},Jx=/^\[(.+)\]$/,mL=t=>{if(Jx.test(t)){const e=Jx.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},vL=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return wL(Object.entries(t.classGroups),n).forEach(([a,s])=>{pg(s,r,a,e)}),r},pg=(t,e,n,r)=>{t.forEach(o=>{if(typeof o=="string"){const a=o===""?e:Qx(e,o);a.classGroupId=n;return}if(typeof o=="function"){if(yL(o)){pg(o(r),e,n,r);return}e.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([a,s])=>{pg(s,Qx(e,a),n,r)})})},Qx=(t,e)=>{let n=t;return e.split(hg).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},yL=t=>t.isThemeGetter,wL=(t,e)=>e?t.map(([n,r])=>{const o=r.map(a=>typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([s,l])=>[e+s,l])):a);return[n,o]}):t,CL=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const o=(a,s)=>{n.set(a,s),e++,e>t&&(e=0,r=n,n=new Map)};return{get(a){let s=n.get(a);if(s!==void 0)return s;if((s=r.get(a))!==void 0)return o(a,s),s},set(a,s){n.has(a)?n.set(a,s):o(a,s)}}},Xx="!",bL=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,o=e[0],a=e.length,s=l=>{const u=[];let h=0,p=0,g;for(let b=0;b<l.length;b++){let E=l[b];if(h===0){if(E===o&&(r||l.slice(b,b+a)===e)){u.push(l.slice(p,b)),p=b+a;continue}if(E==="/"){g=b;continue}}E==="["?h++:E==="]"&&h--}const w=u.length===0?l:l.substring(p),y=w.startsWith(Xx),x=y?w.substring(1):w,v=g&&g>p?g-p:void 0;return{modifiers:u,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:v}};return n?l=>n({className:l,parseClassName:s}):s},xL=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},SL=t=>({cache:CL(t.cacheSize),parseClassName:bL(t),...gL(t)}),_L=/\s+/,EL=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=e,a=[],s=t.trim().split(_L);let l="";for(let u=s.length-1;u>=0;u-=1){const h=s[u],{modifiers:p,hasImportantModifier:g,baseClassName:w,maybePostfixModifierPosition:y}=n(h);let x=!!y,v=r(x?w.substring(0,y):w);if(!v){if(!x){l=h+(l.length>0?" "+l:l);continue}if(v=r(w),!v){l=h+(l.length>0?" "+l:l);continue}x=!1}const b=xL(p).join(":"),E=g?b+Xx:b,T=E+v;if(a.includes(T))continue;a.push(T);const N=o(v,x);for(let P=0;P<N.length;++P){const _=N[P];a.push(E+_)}l=h+(l.length>0?" "+l:l)}return l};function TL(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=Zx(e))&&(r&&(r+=" "),r+=n);return r}const Zx=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=Zx(t[r]))&&(n&&(n+=" "),n+=e);return n};function AL(t,...e){let n,r,o,a=s;function s(u){const h=e.reduce((p,g)=>g(p),t());return n=SL(h),r=n.cache.get,o=n.cache.set,a=l,l(u)}function l(u){const h=r(u);if(h)return h;const p=EL(u,n);return o(u,p),p}return function(){return a(TL.apply(null,arguments))}}const Ft=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},eS=/^\[(?:([a-z-]+):)?(.+)\]$/i,IL=/^\d+\/\d+$/,kL=new Set(["px","full","screen"]),NL=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,PL=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,OL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,ML=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fo=t=>Ja(t)||kL.has(t)||IL.test(t),vi=t=>Qa(t,"length",zL),Ja=t=>!!t&&!Number.isNaN(Number(t)),gg=t=>Qa(t,"number",Ja),ac=t=>!!t&&Number.isInteger(Number(t)),DL=t=>t.endsWith("%")&&Ja(t.slice(0,-1)),ot=t=>eS.test(t),yi=t=>NL.test(t),LL=new Set(["length","size","percentage"]),FL=t=>Qa(t,LL,tS),$L=t=>Qa(t,"position",tS),HL=new Set(["image","url"]),UL=t=>Qa(t,HL,KL),BL=t=>Qa(t,"",VL),sc=()=>!0,Qa=(t,e,n)=>{const r=eS.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},zL=t=>PL.test(t)&&!OL.test(t),tS=()=>!1,VL=t=>ML.test(t),KL=t=>RL.test(t),GL=AL(()=>{const t=Ft("colors"),e=Ft("spacing"),n=Ft("blur"),r=Ft("brightness"),o=Ft("borderColor"),a=Ft("borderRadius"),s=Ft("borderSpacing"),l=Ft("borderWidth"),u=Ft("contrast"),h=Ft("grayscale"),p=Ft("hueRotate"),g=Ft("invert"),w=Ft("gap"),y=Ft("gradientColorStops"),x=Ft("gradientColorStopPositions"),v=Ft("inset"),b=Ft("margin"),E=Ft("opacity"),T=Ft("padding"),N=Ft("saturate"),P=Ft("scale"),_=Ft("sepia"),D=Ft("skew"),H=Ft("space"),K=Ft("translate"),ee=()=>["auto","contain","none"],W=()=>["auto","hidden","clip","visible","scroll"],de=()=>["auto",ot,e],se=()=>[ot,e],fe=()=>["",Fo,vi],q=()=>["auto",Ja,ot],Z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Y=()=>["solid","dashed","dotted","double","none"],oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>["start","end","center","between","around","evenly","stretch"],X=()=>["","0",ot],$=()=>["auto","avoid","all","avoid-page","page","left","right","column"],te=()=>[Ja,ot];return{cacheSize:500,separator:":",theme:{colors:[sc],spacing:[Fo,vi],blur:["none","",yi,ot],brightness:te(),borderColor:[t],borderRadius:["none","","full",yi,ot],borderSpacing:se(),borderWidth:fe(),contrast:te(),grayscale:X(),hueRotate:te(),invert:X(),gap:se(),gradientColorStops:[t],gradientColorStopPositions:[DL,vi],inset:de(),margin:de(),opacity:te(),padding:se(),saturate:te(),scale:te(),sepia:X(),skew:te(),space:se(),translate:se()},classGroups:{aspect:[{aspect:["auto","square","video",ot]}],container:["container"],columns:[{columns:[yi]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Z(),ot]}],overflow:[{overflow:W()}],"overflow-x":[{"overflow-x":W()}],"overflow-y":[{"overflow-y":W()}],overscroll:[{overscroll:ee()}],"overscroll-x":[{"overscroll-x":ee()}],"overscroll-y":[{"overscroll-y":ee()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ac,ot]}],basis:[{basis:de()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ot]}],grow:[{grow:X()}],shrink:[{shrink:X()}],order:[{order:["first","last","none",ac,ot]}],"grid-cols":[{"grid-cols":[sc]}],"col-start-end":[{col:["auto",{span:["full",ac,ot]},ot]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[sc]}],"row-start-end":[{row:["auto",{span:[ac,ot]},ot]}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ot]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ot]}],gap:[{gap:[w]}],"gap-x":[{"gap-x":[w]}],"gap-y":[{"gap-y":[w]}],"justify-content":[{justify:["normal",...Q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[T]}],px:[{px:[T]}],py:[{py:[T]}],ps:[{ps:[T]}],pe:[{pe:[T]}],pt:[{pt:[T]}],pr:[{pr:[T]}],pb:[{pb:[T]}],pl:[{pl:[T]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ot,e]}],"min-w":[{"min-w":[ot,e,"min","max","fit"]}],"max-w":[{"max-w":[ot,e,"none","full","min","max","fit","prose",{screen:[yi]},yi]}],h:[{h:[ot,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ot,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ot,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ot,e,"auto","min","max","fit"]}],"font-size":[{text:["base",yi,vi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",gg]}],"font-family":[{font:[sc]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ot]}],"line-clamp":[{"line-clamp":["none",Ja,gg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Fo,ot]}],"list-image":[{"list-image":["none",ot]}],"list-style-type":[{list:["none","disc","decimal",ot]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Fo,vi]}],"underline-offset":[{"underline-offset":["auto",Fo,ot]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:se()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ot]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ot]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Z(),$L]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",FL]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},UL]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...Y(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:Y()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...Y()]}],"outline-offset":[{"outline-offset":[Fo,ot]}],"outline-w":[{outline:[Fo,vi]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:fe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[Fo,vi]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",yi,BL]}],"shadow-color":[{shadow:[sc]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...oe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":oe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",yi,ot]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[g]}],saturate:[{saturate:[N]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ot]}],duration:[{duration:te()}],ease:[{ease:["linear","in","out","in-out",ot]}],delay:[{delay:te()}],animate:[{animate:["none","spin","ping","pulse","bounce",ot]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[ac,ot]}],"translate-x":[{"translate-x":[K]}],"translate-y":[{"translate-y":[K]}],"skew-x":[{"skew-x":[D]}],"skew-y":[{"skew-y":[D]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ot]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ot]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":se()}],"scroll-mx":[{"scroll-mx":se()}],"scroll-my":[{"scroll-my":se()}],"scroll-ms":[{"scroll-ms":se()}],"scroll-me":[{"scroll-me":se()}],"scroll-mt":[{"scroll-mt":se()}],"scroll-mr":[{"scroll-mr":se()}],"scroll-mb":[{"scroll-mb":se()}],"scroll-ml":[{"scroll-ml":se()}],"scroll-p":[{"scroll-p":se()}],"scroll-px":[{"scroll-px":se()}],"scroll-py":[{"scroll-py":se()}],"scroll-ps":[{"scroll-ps":se()}],"scroll-pe":[{"scroll-pe":se()}],"scroll-pt":[{"scroll-pt":se()}],"scroll-pr":[{"scroll-pr":se()}],"scroll-pb":[{"scroll-pb":se()}],"scroll-pl":[{"scroll-pl":se()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ot]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Fo,vi,gg]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function ze(...t){return GL(zx(t))}function qi(){let t=localStorage.getItem("dataLogin"),e;try{t&&(t=JSON.parse(t),e=t.user)}catch(n){console.error("Error parsing dataLogin from localStorage:",n),t=null}return e}const Gd=C.forwardRef(({className:t,...e},n)=>d.jsx("nav",{ref:n,"aria-label":"breadcrumb",className:ze("s3-explr-ui-breadcrumb",t),...e}));Gd.displayName="Breadcrumb";const jd=C.forwardRef(({className:t,...e},n)=>d.jsx("ol",{ref:n,className:ze("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5","s3-explr-ui-breadcrumb-list",t),...e}));jd.displayName="BreadcrumbList";const cc=C.forwardRef(({className:t,...e},n)=>d.jsx("li",{ref:n,className:ze("inline-flex items-center gap-1.5","s3-explr-ui-breadcrumb-item",t),...e}));cc.displayName="BreadcrumbItem";const lc=C.forwardRef(({asChild:t,className:e,...n},r)=>{const o=t?qx:"a";return d.jsx(o,{ref:r,className:ze("transition-colors hover:text-foreground","s3-explr-ui-breadcrumb-link",e),...n})});lc.displayName="BreadcrumbLink";const jL=C.forwardRef(({className:t,...e},n)=>d.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:ze("font-normal text-foreground","s3-explr-ui-breadcrumb-page",t),...e}));jL.displayName="BreadcrumbPage";const Wd=({children:t,className:e,...n})=>d.jsx("li",{role:"presentation","aria-hidden":"true",className:ze("[&>svg]:w-3.5 [&>svg]:h-3.5","s3-explr-ui-breadcrumb-separator",e),...n,children:t??d.jsx(Hx,{})});Wd.displayName="BreadcrumbSeparator";const nS=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,rS=zx,mg=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return rS(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:a}=e,s=Object.keys(o).map(h=>{const p=n==null?void 0:n[h],g=a==null?void 0:a[h];if(p===null)return null;const w=nS(p)||nS(g);return o[h][w]}),l=n&&Object.entries(n).reduce((h,p)=>{let[g,w]=p;return w===void 0||(h[g]=w),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,p)=>{let{class:g,className:w,...y}=p;return Object.entries(y).every(x=>{let[v,b]=x;return Array.isArray(b)?b.includes({...a,...l}[v]):{...a,...l}[v]===b})?[...h,g,w]:h},[]);return rS(t,s,u,n==null?void 0:n.class,n==null?void 0:n.className)},oS=mg("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 s3-explr-ui-button",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 s3-explr-ui-button-default",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 s3-explr-ui-button-destructive",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground s3-explr-ui-button-outline",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 s3-explr-ui-button-secondary",ghost:"hover:bg-accent hover:text-accent-foreground s3-explr-ui-button-ghost",link:"text-primary underline-offset-4 hover:underline s3-explr-ui-button-link"},size:{default:"h-9 px-4 py-2 s3-explr-ui-button-size-default",sm:"h-8 rounded-md px-3 text-xs s3-explr-ui-button-size-sm",lg:"h-10 rounded-md px-8 s3-explr-ui-button-size-lg",icon:"h-9 w-9 s3-explr-ui-button-size-icon"}},defaultVariants:{variant:"default",size:"default"}}),He=C.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...o},a)=>{const s=r?qx:"button";return d.jsx(s,{className:ze(oS({variant:e,size:n,className:t})),ref:a,...o})});He.displayName="Button";function iS(t){const e=C.useRef({value:t,previous:t});return C.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function vg(t){const[e,n]=C.useState(void 0);return tn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const a=o[0];let s,l;if("borderBoxSize"in a){const u=a.borderBoxSize,h=Array.isArray(u)?u[0]:u;s=h.inlineSize,l=h.blockSize}else s=t.offsetWidth,l=t.offsetHeight;n({width:s,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var qd="Checkbox",[WL,$j]=gr(qd),[qL,yg]=WL(qd);function YL(t){const{__scopeCheckbox:e,checked:n,children:r,defaultChecked:o,disabled:a,form:s,name:l,onCheckedChange:u,required:h,value:p="on",internal_do_not_use_render:g}=t,[w,y]=ui({prop:n,defaultProp:o??!1,onChange:u,caller:qd}),[x,v]=C.useState(null),[b,E]=C.useState(null),T=C.useRef(!1),N=x?!!s||!!x.closest("form"):!0,P={checked:w,disabled:a,setChecked:y,control:x,setControl:v,name:l,form:s,value:p,hasConsumerStoppedPropagationRef:T,required:h,defaultChecked:wi(o)?!1:o,isFormControl:N,bubbleInput:b,setBubbleInput:E};return d.jsx(qL,{scope:e,...P,children:JL(g)?g(P):r})}var aS="CheckboxTrigger",sS=C.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...r},o)=>{const{control:a,value:s,disabled:l,checked:u,required:h,setControl:p,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:y,bubbleInput:x}=yg(aS,t),v=rt(o,p),b=C.useRef(u);return C.useEffect(()=>{const E=a==null?void 0:a.form;if(E){const T=()=>g(b.current);return E.addEventListener("reset",T),()=>E.removeEventListener("reset",T)}},[a,g]),d.jsx(mt.button,{type:"button",role:"checkbox","aria-checked":wi(u)?"mixed":u,"aria-required":h,"data-state":fS(u),"data-disabled":l?"":void 0,disabled:l,value:s,...r,ref:v,onKeyDown:Ue(e,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:Ue(n,E=>{g(T=>wi(T)?!0:!T),x&&y&&(w.current=E.isPropagationStopped(),w.current||E.stopPropagation())})})});sS.displayName=aS;var wg=C.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:a,required:s,disabled:l,value:u,onCheckedChange:h,form:p,...g}=t;return d.jsx(YL,{__scopeCheckbox:n,checked:o,defaultChecked:a,disabled:l,required:s,onCheckedChange:h,name:r,form:p,value:u,internal_do_not_use_render:({isFormControl:w})=>d.jsxs(d.Fragment,{children:[d.jsx(sS,{...g,ref:e,__scopeCheckbox:n}),w&&d.jsx(uS,{__scopeCheckbox:n})]})})});wg.displayName=qd;var cS="CheckboxIndicator",lS=C.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...o}=t,a=yg(cS,n);return d.jsx(Ro,{present:r||wi(a.checked)||a.checked===!0,children:d.jsx(mt.span,{"data-state":fS(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});lS.displayName=cS;var dS="CheckboxBubbleInput",uS=C.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:a,defaultChecked:s,required:l,disabled:u,name:h,value:p,form:g,bubbleInput:w,setBubbleInput:y}=yg(dS,t),x=rt(n,y),v=iS(a),b=vg(r);C.useEffect(()=>{const T=w;if(!T)return;const N=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(N,"checked").set,D=!o.current;if(v!==a&&_){const H=new Event("click",{bubbles:D});T.indeterminate=wi(a),_.call(T,wi(a)?!1:a),T.dispatchEvent(H)}},[w,v,a,o]);const E=C.useRef(wi(a)?!1:a);return d.jsx(mt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??E.current,required:l,disabled:u,name:h,value:p,form:g,...e,tabIndex:-1,ref:x,style:{...e.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});uS.displayName=dS;function JL(t){return typeof t=="function"}function wi(t){return t==="indeterminate"}function fS(t){return wi(t)?"indeterminate":t?"checked":"unchecked"}const dc=C.forwardRef(({className:t,...e},n)=>d.jsx(wg,{ref:n,className:ze("s3-explr-ui-checkbox peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:d.jsx(lS,{className:ze("s3-explr-ui-checkbox-indicator flex items-center justify-center text-current"),children:d.jsx($x,{className:"s3-explr-ui-checkbox-check h-4 w-4"})})}));dc.displayName=wg.displayName;const ar=Qs,uc=lM,QL=dM,hS=C.forwardRef(({className:t,...e},n)=>d.jsx(ja,{ref:n,className:ze("s3-explr-ui-dialog-overlay fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));hS.displayName=ja.displayName;const zn=C.forwardRef(({className:t,children:e,...n},r)=>d.jsxs(QL,{children:[d.jsx(hS,{}),d.jsxs(Wa,{ref:r,className:ze("s3-explr-ui-dialog-content fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,d.jsxs(kp,{className:ze("s3-explr-ui-dialog-close absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"),children:[d.jsx(lg,{className:"s3-explr-ui-dialog-close-icon h-4 w-4"}),d.jsx("span",{className:"s3-explr-ui-dialog-close-text sr-only",children:"Close"})]})]})]}));zn.displayName=Wa.displayName;const Vn=({className:t,...e})=>d.jsx("div",{className:ze("s3-explr-ui-dialog-header flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Vn.displayName="DialogHeader";const Fr=({className:t,...e})=>d.jsx("div",{className:ze("s3-explr-ui-dialog-footer flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Fr.displayName="DialogFooter";const Kn=C.forwardRef(({className:t,...e},n)=>d.jsx(Pb,{ref:n,className:ze("s3-explr-ui-dialog-title text-lg font-semibold leading-none tracking-tight",t),...e}));Kn.displayName=Pb.displayName;const Ci=C.forwardRef(({className:t,...e},n)=>d.jsx(Ob,{ref:n,className:ze("s3-explr-ui-dialog-description text-sm text-muted-foreground",t),...e}));Ci.displayName=Ob.displayName;const Gn=C.forwardRef(({className:t,type:e,...n},r)=>d.jsx("input",{type:e,className:ze("s3-explr-ui-input","flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Gn.displayName="Input";var XL="Label",pS=C.forwardRef((t,e)=>d.jsx(mt.label,{...t,ref:e,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=t.onMouseDown)==null||o.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));pS.displayName=XL;var gS=pS;const ZL=mg("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 s3-explr-ui-label",{variants:{variant:{default:"s3-explr-ui-label-default",required:"s3-explr-ui-label-required",disabled:"s3-explr-ui-label-disabled"},size:{default:"s3-explr-ui-label-size-default",sm:"s3-explr-ui-label-size-sm",lg:"s3-explr-ui-label-size-lg"}},defaultVariants:{variant:"default",size:"default"}}),mr=C.forwardRef(({className:t,variant:e,size:n,...r},o)=>d.jsx(gS,{ref:o,className:ze(ZL({variant:e,size:n}),t),...r}));mr.displayName=gS.displayName;const Yd=({className:t,...e})=>d.jsx("nav",{role:"navigation","aria-label":"pagination",className:ze("mx-auto flex w-full justify-center",t),...e});Yd.displayName="Pagination";const Jd=C.forwardRef(({className:t,...e},n)=>d.jsx("ul",{ref:n,className:ze("flex flex-row items-center gap-1",t),...e}));Jd.displayName="PaginationContent";const $r=C.forwardRef(({className:t,...e},n)=>d.jsx("li",{ref:n,className:ze("",t),...e}));$r.displayName="PaginationItem";const Xa=({className:t,isActive:e,size:n="icon",...r})=>d.jsx("a",{"aria-current":e?"page":void 0,className:ze(oS({variant:e?"outline":"ghost",size:n}),t),...r});Xa.displayName="PaginationLink";const Qd=({className:t,...e})=>d.jsxs(Xa,{"aria-label":"Go to previous page",size:"default",className:ze("gap-1 pl-2.5",t),...e,children:[d.jsx(BD,{className:"h-4 w-4"}),d.jsx("span",{children:"Previous"})]});Qd.displayName="PaginationPrevious";const Xd=({className:t,...e})=>d.jsxs(Xa,{"aria-label":"Go to next page",size:"default",className:ze("gap-1 pr-2.5",t),...e,children:[d.jsx("span",{children:"Next"}),d.jsx(Hx,{className:"h-4 w-4"})]});Xd.displayName="PaginationNext";const Zd=({className:t,...e})=>d.jsxs("span",{"aria-hidden":!0,className:ze("flex h-9 w-9 items-center justify-center",t),...e,children:[d.jsx(zD,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"More pages"})]});Zd.displayName="PaginationEllipsis";const eu=C.forwardRef(({className:t,...e},n)=>d.jsx("div",{className:ze("relative w-full overflow-auto","s3-explr-ui-table-container"),children:d.jsx("table",{ref:n,className:ze("w-full caption-bottom text-sm","s3-explr-ui-table",t),...e})}));eu.displayName="Table";const tu=C.forwardRef(({className:t,...e},n)=>d.jsx("thead",{ref:n,className:ze("[&_tr]:border-b","s3-explr-ui-table-header",t),...e}));tu.displayName="TableHeader";const nu=C.forwardRef(({className:t,...e},n)=>d.jsx("tbody",{ref:n,className:ze("[&_tr:last-child]:border-0","s3-explr-ui-table-body",t),...e}));nu.displayName="TableBody";const eF=C.forwardRef(({className:t,...e},n)=>d.jsx("tfoot",{ref:n,className:ze("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0","s3-explr-ui-table-footer",t),...e}));eF.displayName="TableFooter";const Hr=C.forwardRef(({className:t,...e},n)=>d.jsx("tr",{ref:n,className:ze("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted","s3-explr-ui-table-row",t),...e}));Hr.displayName="TableRow";const po=C.forwardRef(({className:t,...e},n)=>d.jsx("th",{ref:n,className:ze("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]","s3-explr-ui-table-head",t),...e}));po.displayName="TableHead";const jn=C.forwardRef(({className:t,...e},n)=>d.jsx("td",{ref:n,className:ze("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]","s3-explr-ui-table-cell",t),...e}));jn.displayName="TableCell";const tF=C.forwardRef(({className:t,...e},n)=>d.jsx("caption",{ref:n,className:ze("mt-4 text-sm text-muted-foreground","s3-explr-ui-table-caption",t),...e}));tF.displayName="TableCaption";function mS(t){const e=nF(t),n=C.forwardRef((r,o)=>{const{children:a,...s}=r,l=C.Children.toArray(a),u=l.find(oF);if(u){const h=u.props.children,p=l.map(g=>g===u?C.Children.count(h)>1?C.Children.only(null):C.isValidElement(h)?h.props.children:null:g);return d.jsx(e,{...s,ref:o,children:C.isValidElement(h)?C.cloneElement(h,void 0,p):null})}return d.jsx(e,{...s,ref:o,children:a})});return n.displayName=`${t}.Slot`,n}function nF(t){const e=C.forwardRef((n,r)=>{const{children:o,...a}=n,s=C.isValidElement(o)?aF(o):void 0,l=rt(s,r);if(C.isValidElement(o)){const u=iF(a,o.props);return o.type!==C.Fragment&&(u.ref=l),C.cloneElement(o,u)}return C.Children.count(o)>1?C.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var rF=Symbol("radix.slottable");function oF(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===rF}function iF(t,e){const n={...e};for(const r in e){const o=t[r],a=e[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...l)=>{const u=a(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...t,...n}}function aF(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function sF(t){const e=t+"CollectionProvider",[n,r]=gr(e),[o,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:b,children:E}=v,T=M.useRef(null),N=M.useRef(new Map).current;return d.jsx(o,{scope:b,itemMap:N,collectionRef:T,children:E})};s.displayName=e;const l=t+"CollectionSlot",u=mS(l),h=M.forwardRef((v,b)=>{const{scope:E,children:T}=v,N=a(l,E),P=rt(b,N.collectionRef);return d.jsx(u,{ref:P,children:T})});h.displayName=l;const p=t+"CollectionItemSlot",g="data-radix-collection-item",w=mS(p),y=M.forwardRef((v,b)=>{const{scope:E,children:T,...N}=v,P=M.useRef(null),_=rt(b,P),D=a(p,E);return M.useEffect(()=>(D.itemMap.set(P,{ref:P,...N}),()=>void D.itemMap.delete(P))),d.jsx(w,{[g]:"",ref:_,children:T})});y.displayName=p;function x(v){const b=a(t+"CollectionConsumer",v);return M.useCallback(()=>{const T=b.collectionRef.current;if(!T)return[];const N=Array.from(T.querySelectorAll(`[${g}]`));return Array.from(b.itemMap.values()).sort((D,H)=>N.indexOf(D.ref.current)-N.indexOf(H.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:s,Slot:h,ItemSlot:y},x,r]}var cF=C.createContext(void 0);function Cg(t){const e=C.useContext(cF);return t||e||"ltr"}var bg="rovingFocusGroup.onEntryFocus",lF={bubbles:!1,cancelable:!0},fc="RovingFocusGroup",[xg,vS,dF]=sF(fc),[uF,yS]=gr(fc,[dF]),[fF,hF]=uF(fc),wS=C.forwardRef((t,e)=>d.jsx(xg.Provider,{scope:t.__scopeRovingFocusGroup,children:d.jsx(xg.Slot,{scope:t.__scopeRovingFocusGroup,children:d.jsx(pF,{...t,ref:e})})}));wS.displayName=fc;var pF=C.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:a,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:p=!1,...g}=t,w=C.useRef(null),y=rt(e,w),x=Cg(a),[v,b]=ui({prop:s,defaultProp:l??null,onChange:u,caller:fc}),[E,T]=C.useState(!1),N=gn(h),P=vS(n),_=C.useRef(!1),[D,H]=C.useState(0);return C.useEffect(()=>{const K=w.current;if(K)return K.addEventListener(bg,N),()=>K.removeEventListener(bg,N)},[N]),d.jsx(fF,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:v,onItemFocus:C.useCallback(K=>b(K),[b]),onItemShiftTab:C.useCallback(()=>T(!0),[]),onFocusableItemAdd:C.useCallback(()=>H(K=>K+1),[]),onFocusableItemRemove:C.useCallback(()=>H(K=>K-1),[]),children:d.jsx(mt.div,{tabIndex:E||D===0?-1:0,"data-orientation":r,...g,ref:y,style:{outline:"none",...t.style},onMouseDown:Ue(t.onMouseDown,()=>{_.current=!0}),onFocus:Ue(t.onFocus,K=>{const ee=!_.current;if(K.target===K.currentTarget&&ee&&!E){const W=new CustomEvent(bg,lF);if(K.currentTarget.dispatchEvent(W),!W.defaultPrevented){const de=P().filter(Y=>Y.focusable),se=de.find(Y=>Y.active),fe=de.find(Y=>Y.id===v),Z=[se,fe,...de].filter(Boolean).map(Y=>Y.ref.current);xS(Z,p)}}_.current=!1}),onBlur:Ue(t.onBlur,()=>T(!1))})})}),CS="RovingFocusGroupItem",bS=C.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:a,children:s,...l}=t,u=Mo(),h=a||u,p=hF(CS,n),g=p.currentTabStopId===h,w=vS(n),{onFocusableItemAdd:y,onFocusableItemRemove:x,currentTabStopId:v}=p;return C.useEffect(()=>{if(r)return y(),()=>x()},[r,y,x]),d.jsx(xg.ItemSlot,{scope:n,id:h,focusable:r,active:o,children:d.jsx(mt.span,{tabIndex:g?0:-1,"data-orientation":p.orientation,...l,ref:e,onMouseDown:Ue(t.onMouseDown,b=>{r?p.onItemFocus(h):b.preventDefault()}),onFocus:Ue(t.onFocus,()=>p.onItemFocus(h)),onKeyDown:Ue(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){p.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const E=vF(b,p.orientation,p.dir);if(E!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let N=w().filter(P=>P.focusable).map(P=>P.ref.current);if(E==="last")N.reverse();else if(E==="prev"||E==="next"){E==="prev"&&N.reverse();const P=N.indexOf(b.currentTarget);N=p.loop?yF(N,P+1):N.slice(P+1)}setTimeout(()=>xS(N))}}),children:typeof s=="function"?s({isCurrentTabStop:g,hasTabStop:v!=null}):s})})});bS.displayName=CS;var gF={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function mF(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function vF(t,e,n){const r=mF(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return gF[r]}function xS(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function yF(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var wF=wS,CF=bS,ru="Tabs",[bF,Hj]=gr(ru,[yS]),SS=yS(),[xF,Sg]=bF(ru),_S=C.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:a,orientation:s="horizontal",dir:l,activationMode:u="automatic",...h}=t,p=Cg(l),[g,w]=ui({prop:r,onChange:o,defaultProp:a??"",caller:ru});return d.jsx(xF,{scope:n,baseId:Mo(),value:g,onValueChange:w,orientation:s,dir:p,activationMode:u,children:d.jsx(mt.div,{dir:p,"data-orientation":s,...h,ref:e})})});_S.displayName=ru;var ES="TabsList",TS=C.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...o}=t,a=Sg(ES,n),s=SS(n);return d.jsx(wF,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:r,children:d.jsx(mt.div,{role:"tablist","aria-orientation":a.orientation,...o,ref:e})})});TS.displayName=ES;var AS="TabsTrigger",IS=C.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...a}=t,s=Sg(AS,n),l=SS(n),u=PS(s.baseId,r),h=OS(s.baseId,r),p=r===s.value;return d.jsx(CF,{asChild:!0,...l,focusable:!o,active:p,children:d.jsx(mt.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":h,"data-state":p?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...a,ref:e,onMouseDown:Ue(t.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?s.onValueChange(r):g.preventDefault()}),onKeyDown:Ue(t.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&s.onValueChange(r)}),onFocus:Ue(t.onFocus,()=>{const g=s.activationMode!=="manual";!p&&!o&&g&&s.onValueChange(r)})})})});IS.displayName=AS;var kS="TabsContent",NS=C.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:o,children:a,...s}=t,l=Sg(kS,n),u=PS(l.baseId,r),h=OS(l.baseId,r),p=r===l.value,g=C.useRef(p);return C.useEffect(()=>{const w=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(w)},[]),d.jsx(Ro,{present:o||p,children:({present:w})=>d.jsx(mt.div,{"data-state":p?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":u,hidden:!w,id:h,tabIndex:0,...s,ref:e,style:{...t.style,animationDuration:g.current?"0s":void 0},children:w&&a})})});NS.displayName=kS;function PS(t,e){return`${t}-trigger-${e}`}function OS(t,e){return`${t}-content-${e}`}var SF=_S,MS=TS,RS=IS,DS=NS;const _g=SF,ou=C.forwardRef(({className:t,...e},n)=>d.jsx(MS,{ref:n,className:ze("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ou.displayName=MS.displayName;const Yi=C.forwardRef(({className:t,...e},n)=>d.jsx(RS,{ref:n,className:ze("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));Yi.displayName=RS.displayName;const Ji=C.forwardRef(({className:t,...e},n)=>d.jsx(DS,{ref:n,className:ze("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));Ji.displayName=DS.displayName;const hc=C.forwardRef(({className:t,...e},n)=>d.jsx("textarea",{className:ze("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));hc.displayName="Textarea";function LS(t){const e=_F(t),n=C.forwardRef((r,o)=>{const{children:a,...s}=r,l=C.Children.toArray(a),u=l.find(TF);if(u){const h=u.props.children,p=l.map(g=>g===u?C.Children.count(h)>1?C.Children.only(null):C.isValidElement(h)?h.props.children:null:g);return d.jsx(e,{...s,ref:o,children:C.isValidElement(h)?C.cloneElement(h,void 0,p):null})}return d.jsx(e,{...s,ref:o,children:a})});return n.displayName=`${t}.Slot`,n}function _F(t){const e=C.forwardRef((n,r)=>{const{children:o,...a}=n,s=C.isValidElement(o)?IF(o):void 0,l=rt(s,r);if(C.isValidElement(o)){const u=AF(a,o.props);return o.type!==C.Fragment&&(u.ref=l),C.cloneElement(o,u)}return C.Children.count(o)>1?C.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var EF=Symbol("radix.slottable");function TF(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===EF}function AF(t,e){const n={...e};for(const r in e){const o=t[r],a=e[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...l)=>{const u=a(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...t,...n}}function IF(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function kF(t){const e=t+"CollectionProvider",[n,r]=gr(e),[o,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:b,children:E}=v,T=M.useRef(null),N=M.useRef(new Map).current;return d.jsx(o,{scope:b,itemMap:N,collectionRef:T,children:E})};s.displayName=e;const l=t+"CollectionSlot",u=LS(l),h=M.forwardRef((v,b)=>{const{scope:E,children:T}=v,N=a(l,E),P=rt(b,N.collectionRef);return d.jsx(u,{ref:P,children:T})});h.displayName=l;const p=t+"CollectionItemSlot",g="data-radix-collection-item",w=LS(p),y=M.forwardRef((v,b)=>{const{scope:E,children:T,...N}=v,P=M.useRef(null),_=rt(b,P),D=a(p,E);return M.useEffect(()=>(D.itemMap.set(P,{ref:P,...N}),()=>void D.itemMap.delete(P))),d.jsx(w,{[g]:"",ref:_,children:T})});y.displayName=p;function x(v){const b=a(t+"CollectionConsumer",v);return M.useCallback(()=>{const T=b.collectionRef.current;if(!T)return[];const N=Array.from(T.querySelectorAll(`[${g}]`));return Array.from(b.itemMap.values()).sort((D,H)=>N.indexOf(D.ref.current)-N.indexOf(H.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:s,Slot:h,ItemSlot:y},x,r]}var NF=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"}),PF="VisuallyHidden",Eg=C.forwardRef((t,e)=>d.jsx(mt.span,{...t,ref:e,style:{...NF,...t.style}}));Eg.displayName=PF;var Tg="ToastProvider",[Ag,OF,MF]=kF("Toast"),[FS,Uj]=gr("Toast",[MF]),[RF,iu]=FS(Tg),$S=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:a=50,children:s}=t,[l,u]=C.useState(null),[h,p]=C.useState(0),g=C.useRef(!1),w=C.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Tg}\`. Expected non-empty \`string\`.`),d.jsx(Ag.Provider,{scope:e,children:d.jsx(RF,{scope:e,label:n,duration:r,swipeDirection:o,swipeThreshold:a,toastCount:h,viewport:l,onViewportChange:u,onToastAdd:C.useCallback(()=>p(y=>y+1),[]),onToastRemove:C.useCallback(()=>p(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:g,isClosePausedRef:w,children:s})})};$S.displayName=Tg;var HS="ToastViewport",DF=["F8"],Ig="toast.viewportPause",kg="toast.viewportResume",US=C.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=DF,label:o="Notifications ({hotkey})",...a}=t,s=iu(HS,n),l=OF(n),u=C.useRef(null),h=C.useRef(null),p=C.useRef(null),g=C.useRef(null),w=rt(e,g,s.onViewportChange),y=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=s.toastCount>0;C.useEffect(()=>{const b=E=>{var N;r.length!==0&&r.every(P=>E[P]||E.code===P)&&((N=g.current)==null||N.focus())};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]),C.useEffect(()=>{const b=u.current,E=g.current;if(x&&b&&E){const T=()=>{if(!s.isClosePausedRef.current){const D=new CustomEvent(Ig);E.dispatchEvent(D),s.isClosePausedRef.current=!0}},N=()=>{if(s.isClosePausedRef.current){const D=new CustomEvent(kg);E.dispatchEvent(D),s.isClosePausedRef.current=!1}},P=D=>{!b.contains(D.relatedTarget)&&N()},_=()=>{b.contains(document.activeElement)||N()};return b.addEventListener("focusin",T),b.addEventListener("focusout",P),b.addEventListener("pointermove",T),b.addEventListener("pointerleave",_),window.addEventListener("blur",T),window.addEventListener("focus",N),()=>{b.removeEventListener("focusin",T),b.removeEventListener("focusout",P),b.removeEventListener("pointermove",T),b.removeEventListener("pointerleave",_),window.removeEventListener("blur",T),window.removeEventListener("focus",N)}}},[x,s.isClosePausedRef]);const v=C.useCallback(({tabbingDirection:b})=>{const T=l().map(N=>{const P=N.ref.current,_=[P,...qF(P)];return b==="forwards"?_:_.reverse()});return(b==="forwards"?T.reverse():T).flat()},[l]);return C.useEffect(()=>{const b=g.current;if(b){const E=T=>{var _,D,H;const N=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!N){const K=document.activeElement,ee=T.shiftKey;if(T.target===b&&ee){(_=h.current)==null||_.focus();return}const se=v({tabbingDirection:ee?"backwards":"forwards"}),fe=se.findIndex(q=>q===K);Og(se.slice(fe+1))?T.preventDefault():ee?(D=h.current)==null||D.focus():(H=p.current)==null||H.focus()}};return b.addEventListener("keydown",E),()=>b.removeEventListener("keydown",E)}},[l,v]),d.jsxs(XO,{ref:u,role:"region","aria-label":o.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&d.jsx(Ng,{ref:h,onFocusFromOutsideViewport:()=>{const b=v({tabbingDirection:"forwards"});Og(b)}}),d.jsx(Ag.Slot,{scope:n,children:d.jsx(mt.ol,{tabIndex:-1,...a,ref:w})}),x&&d.jsx(Ng,{ref:p,onFocusFromOutsideViewport:()=>{const b=v({tabbingDirection:"backwards"});Og(b)}})]})});US.displayName=HS;var BS="ToastFocusProxy",Ng=C.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=t,a=iu(BS,n);return d.jsx(Eg,{"aria-hidden":!0,tabIndex:0,...o,ref:e,style:{position:"fixed"},onFocus:s=>{var h;const l=s.relatedTarget;!((h=a.viewport)!=null&&h.contains(l))&&r()}})});Ng.displayName=BS;var pc="Toast",LF="toast.swipeStart",FF="toast.swipeMove",$F="toast.swipeCancel",HF="toast.swipeEnd",zS=C.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:a,...s}=t,[l,u]=ui({prop:r,defaultProp:o??!0,onChange:a,caller:pc});return d.jsx(Ro,{present:n||l,children:d.jsx(zF,{open:l,...s,ref:e,onClose:()=>u(!1),onPause:gn(t.onPause),onResume:gn(t.onResume),onSwipeStart:Ue(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ue(t.onSwipeMove,h=>{const{x:p,y:g}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${p}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${g}px`)}),onSwipeCancel:Ue(t.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ue(t.onSwipeEnd,h=>{const{x:p,y:g}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${p}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${g}px`),u(!1)})})})});zS.displayName=pc;var[UF,BF]=FS(pc,{onClose(){}}),zF=C.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:a,onClose:s,onEscapeKeyDown:l,onPause:u,onResume:h,onSwipeStart:p,onSwipeMove:g,onSwipeCancel:w,onSwipeEnd:y,...x}=t,v=iu(pc,n),[b,E]=C.useState(null),T=rt(e,q=>E(q)),N=C.useRef(null),P=C.useRef(null),_=o||v.duration,D=C.useRef(0),H=C.useRef(_),K=C.useRef(0),{onToastAdd:ee,onToastRemove:W}=v,de=gn(()=>{var Z;(b==null?void 0:b.contains(document.activeElement))&&((Z=v.viewport)==null||Z.focus()),s()}),se=C.useCallback(q=>{!q||q===1/0||(window.clearTimeout(K.current),D.current=new Date().getTime(),K.current=window.setTimeout(de,q))},[de]);C.useEffect(()=>{const q=v.viewport;if(q){const Z=()=>{se(H.current),h==null||h()},Y=()=>{const oe=new Date().getTime()-D.current;H.current=H.current-oe,window.clearTimeout(K.current),u==null||u()};return q.addEventListener(Ig,Y),q.addEventListener(kg,Z),()=>{q.removeEventListener(Ig,Y),q.removeEventListener(kg,Z)}}},[v.viewport,_,u,h,se]),C.useEffect(()=>{a&&!v.isClosePausedRef.current&&se(_)},[a,_,v.isClosePausedRef,se]),C.useEffect(()=>(ee(),()=>W()),[ee,W]);const fe=C.useMemo(()=>b?YS(b):null,[b]);return v.viewport?d.jsxs(d.Fragment,{children:[fe&&d.jsx(VF,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:fe}),d.jsx(UF,{scope:n,onClose:de,children:Ia.createPortal(d.jsx(Ag.ItemSlot,{scope:n,children:d.jsx(QO,{asChild:!0,onEscapeKeyDown:Ue(l,()=>{v.isFocusedToastEscapeKeyDownRef.current||de(),v.isFocusedToastEscapeKeyDownRef.current=!1}),children:d.jsx(mt.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":v.swipeDirection,...x,ref:T,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Ue(t.onKeyDown,q=>{q.key==="Escape"&&(l==null||l(q.nativeEvent),q.nativeEvent.defaultPrevented||(v.isFocusedToastEscapeKeyDownRef.current=!0,de()))}),onPointerDown:Ue(t.onPointerDown,q=>{q.button===0&&(N.current={x:q.clientX,y:q.clientY})}),onPointerMove:Ue(t.onPointerMove,q=>{if(!N.current)return;const Z=q.clientX-N.current.x,Y=q.clientY-N.current.y,oe=!!P.current,Q=["left","right"].includes(v.swipeDirection),X=["left","up"].includes(v.swipeDirection)?Math.min:Math.max,$=Q?X(0,Z):0,te=Q?0:X(0,Y),_e=q.pointerType==="touch"?10:2,ke={x:$,y:te},xe={originalEvent:q,delta:ke};oe?(P.current=ke,au(FF,g,xe,{discrete:!1})):JS(ke,v.swipeDirection,_e)?(P.current=ke,au(LF,p,xe,{discrete:!1}),q.target.setPointerCapture(q.pointerId)):(Math.abs(Z)>_e||Math.abs(Y)>_e)&&(N.current=null)}),onPointerUp:Ue(t.onPointerUp,q=>{const Z=P.current,Y=q.target;if(Y.hasPointerCapture(q.pointerId)&&Y.releasePointerCapture(q.pointerId),P.current=null,N.current=null,Z){const oe=q.currentTarget,Q={originalEvent:q,delta:Z};JS(Z,v.swipeDirection,v.swipeThreshold)?au(HF,y,Q,{discrete:!0}):au($F,w,Q,{discrete:!0}),oe.addEventListener("click",X=>X.preventDefault(),{once:!0})}})})})}),v.viewport)})]}):null}),VF=t=>{const{__scopeToast:e,children:n,...r}=t,o=iu(pc,e),[a,s]=C.useState(!1),[l,u]=C.useState(!1);return jF(()=>s(!0)),C.useEffect(()=>{const h=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(h)},[]),l?null:d.jsx(fd,{asChild:!0,children:d.jsx(Eg,{...r,children:a&&d.jsxs(d.Fragment,{children:[o.label," ",n]})})})},KF="ToastTitle",VS=C.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return d.jsx(mt.div,{...r,ref:e})});VS.displayName=KF;var GF="ToastDescription",KS=C.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return d.jsx(mt.div,{...r,ref:e})});KS.displayName=GF;var GS="ToastAction",jS=C.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?d.jsx(qS,{altText:n,asChild:!0,children:d.jsx(Pg,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${GS}\`. Expected non-empty \`string\`.`),null)});jS.displayName=GS;var WS="ToastClose",Pg=C.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,o=BF(WS,n);return d.jsx(qS,{asChild:!0,children:d.jsx(mt.button,{type:"button",...r,ref:e,onClick:Ue(t.onClick,o.onClose)})})});Pg.displayName=WS;var qS=C.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...o}=t;return d.jsx(mt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:e})});function YS(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),WF(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",a=r.dataset.radixToastAnnounceExclude==="";if(!o)if(a){const s=r.dataset.radixToastAnnounceAlt;s&&e.push(s)}else e.push(...YS(r))}}),e}function au(t,e,n,{discrete:r}){const o=n.originalEvent.currentTarget,a=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?$C(o,a):o.dispatchEvent(a)}var JS=(t,e,n=0)=>{const r=Math.abs(t.x),o=Math.abs(t.y),a=r>o;return e==="left"||e==="right"?a&&r>n:!a&&o>n};function jF(t=()=>{}){const e=gn(t);tn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function WF(t){return t.nodeType===t.ELEMENT_NODE}function qF(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Og(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var YF=$S,QS=US,XS=zS,ZS=VS,e_=KS,t_=jS,n_=Pg;const JF=YF,r_=C.forwardRef(({className:t,...e},n)=>d.jsx(QS,{ref:n,className:ze("s3-explr-ui-toast-viewport fixed top-0 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px] z-[10000]",t),...e}));r_.displayName=QS.displayName;const QF=mg("s3-explr-ui-toast group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"s3-explr-ui-toast-default border bg-background text-foreground",destructive:"s3-explr-ui-toast-destructive destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),o_=C.forwardRef(({className:t,variant:e,...n},r)=>d.jsx(XS,{ref:r,className:ze(QF({variant:e}),t),...n}));o_.displayName=XS.displayName;const XF=C.forwardRef(({className:t,...e},n)=>d.jsx(t_,{ref:n,className:ze("s3-explr-ui-toast-action inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));XF.displayName=t_.displayName;const i_=C.forwardRef(({className:t,...e},n)=>d.jsx(n_,{ref:n,className:ze("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity duration-200 ease-in-out hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600 font-bold",t),"toast-close":"",...e,children:d.jsx(lg,{className:"s3-explr-ui-toast-close-icon h-4 w-4"})}));i_.displayName=n_.displayName;const a_=C.forwardRef(({className:t,...e},n)=>d.jsx(ZS,{ref:n,className:ze("s3-explr-ui-toast-title text-sm font-semibold [&+div]:text-xs",t),...e}));a_.displayName=ZS.displayName;const s_=C.forwardRef(({className:t,...e},n)=>d.jsx(e_,{ref:n,className:ze("text-sm opacity-90 font-bold",t),...e}));s_.displayName=e_.displayName;const ZF=1,e2=1e6;let Mg=0;function t2(){return Mg=(Mg+1)%Number.MAX_SAFE_INTEGER,Mg.toString()}const Rg=new Map,c_=t=>{if(Rg.has(t))return;const e=setTimeout(()=>{Rg.delete(t),gc({type:"REMOVE_TOAST",toastId:t})},e2);Rg.set(t,e)},n2=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,ZF)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?c_(n):t.toasts.forEach(r=>{c_(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},su=[];let cu={toasts:[]};function gc(t){cu=n2(cu,t),su.forEach(e=>{e(cu)})}function r2({...t}){const e=t2(),n=o=>gc({type:"UPDATE_TOAST",toast:{...o,id:e}}),r=()=>gc({type:"DISMISS_TOAST",toastId:e});return gc({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:o=>{o||r()}}}),{id:e,dismiss:r,update:n}}function mc(){const[t,e]=C.useState(cu);return C.useEffect(()=>(su.push(e),()=>{const n=su.indexOf(e);n>-1&&su.splice(n,1)}),[t]),{...t,toast:r2,dismiss:n=>gc({type:"DISMISS_TOAST",toastId:n})}}function l_(){const{toasts:t}=mc();return d.jsxs(JF,{children:[t.map(function({id:e,title:n,description:r,action:o,...a}){return d.jsxs(o_,{...a,className:`s3-explr-ui-toast ${a.className||""}`,children:[d.jsxs("div",{className:"s3-explr-ui-toast-content grid gap-1",children:[n&&d.jsx(a_,{className:"s3-explr-ui-toast-title",children:n}),r&&d.jsx(s_,{className:"s3-explr-ui-toast-description",children:r})]}),o&&d.jsx("div",{className:"s3-explr-ui-toast-action",children:o}),d.jsx(i_,{className:"s3-explr-ui-toast-close"})]},e)}),d.jsx(r_,{className:"s3-explr-ui-toast-viewport"})]})}const o2=["top","right","bottom","left"],bi=Math.min,sr=Math.max,lu=Math.round,du=Math.floor,go=t=>({x:t,y:t}),i2={left:"right",right:"left",bottom:"top",top:"bottom"},a2={start:"end",end:"start"};function Dg(t,e,n){return sr(t,bi(e,n))}function $o(t,e){return typeof t=="function"?t(e):t}function Ho(t){return t.split("-")[0]}function Za(t){return t.split("-")[1]}function Lg(t){return t==="x"?"y":"x"}function Fg(t){return t==="y"?"height":"width"}function Uo(t){return["top","bottom"].includes(Ho(t))?"y":"x"}function $g(t){return Lg(Uo(t))}function s2(t,e,n){n===void 0&&(n=!1);const r=Za(t),o=$g(t),a=Fg(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(s=uu(s)),[s,uu(s)]}function c2(t){const e=uu(t);return[Hg(t),e,Hg(e)]}function Hg(t){return t.replace(/start|end/g,e=>a2[e])}function l2(t,e,n){const r=["left","right"],o=["right","left"],a=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?o:r:e?r:o;case"left":case"right":return e?a:s;default:return[]}}function d2(t,e,n,r){const o=Za(t);let a=l2(Ho(t),n==="start",r);return o&&(a=a.map(s=>s+"-"+o),e&&(a=a.concat(a.map(Hg)))),a}function uu(t){return t.replace(/left|right|bottom|top/g,e=>i2[e])}function u2(t){return{top:0,right:0,bottom:0,left:0,...t}}function d_(t){return typeof t!="number"?u2(t):{top:t,right:t,bottom:t,left:t}}function fu(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}function u_(t,e,n){let{reference:r,floating:o}=t;const a=Uo(e),s=$g(e),l=Fg(s),u=Ho(e),h=a==="y",p=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,w=r[l]/2-o[l]/2;let y;switch(u){case"top":y={x:p,y:r.y-o.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:g};break;case"left":y={x:r.x-o.width,y:g};break;default:y={x:r.x,y:r.y}}switch(Za(e)){case"start":y[s]-=w*(n&&h?-1:1);break;case"end":y[s]+=w*(n&&h?-1:1);break}return y}const f2=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:s}=n,l=a.filter(Boolean),u=await(s.isRTL==null?void 0:s.isRTL(e));let h=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:p,y:g}=u_(h,r,u),w=r,y={},x=0;for(let v=0;v<l.length;v++){const{name:b,fn:E}=l[v],{x:T,y:N,data:P,reset:_}=await E({x:p,y:g,initialPlacement:r,placement:w,strategy:o,middlewareData:y,rects:h,platform:s,elements:{reference:t,floating:e}});p=T??p,g=N??g,y={...y,[b]:{...y[b],...P}},_&&x<=50&&(x++,typeof _=="object"&&(_.placement&&(w=_.placement),_.rects&&(h=_.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:o}):_.rects),{x:p,y:g}=u_(h,w,u)),v=-1)}return{x:p,y:g,placement:w,strategy:o,middlewareData:y}};async function vc(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:a,rects:s,elements:l,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:g="floating",altBoundary:w=!1,padding:y=0}=$o(e,t),x=d_(y),b=l[w?g==="floating"?"reference":"floating":g],E=fu(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(b)))==null||n?b:b.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:h,rootBoundary:p,strategy:u})),T=g==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,N=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),P=await(a.isElement==null?void 0:a.isElement(N))?await(a.getScale==null?void 0:a.getScale(N))||{x:1,y:1}:{x:1,y:1},_=fu(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:T,offsetParent:N,strategy:u}):T);return{top:(E.top-_.top+x.top)/P.y,bottom:(_.bottom-E.bottom+x.bottom)/P.y,left:(E.left-_.left+x.left)/P.x,right:(_.right-E.right+x.right)/P.x}}const h2=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:a,platform:s,elements:l,middlewareData:u}=e,{element:h,padding:p=0}=$o(t,e)||{};if(h==null)return{};const g=d_(p),w={x:n,y:r},y=$g(o),x=Fg(y),v=await s.getDimensions(h),b=y==="y",E=b?"top":"left",T=b?"bottom":"right",N=b?"clientHeight":"clientWidth",P=a.reference[x]+a.reference[y]-w[y]-a.floating[x],_=w[y]-a.reference[y],D=await(s.getOffsetParent==null?void 0:s.getOffsetParent(h));let H=D?D[N]:0;(!H||!await(s.isElement==null?void 0:s.isElement(D)))&&(H=l.floating[N]||a.floating[x]);const K=P/2-_/2,ee=H/2-v[x]/2-1,W=bi(g[E],ee),de=bi(g[T],ee),se=W,fe=H-v[x]-de,q=H/2-v[x]/2+K,Z=Dg(se,q,fe),Y=!u.arrow&&Za(o)!=null&&q!==Z&&a.reference[x]/2-(q<se?W:de)-v[x]/2<0,oe=Y?q<se?q-se:q-fe:0;return{[y]:w[y]+oe,data:{[y]:Z,centerOffset:q-Z-oe,...Y&&{alignmentOffset:oe}},reset:Y}}}),p2=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:a,rects:s,initialPlacement:l,platform:u,elements:h}=e,{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:w,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...b}=$o(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const E=Ho(o),T=Uo(l),N=Ho(l)===l,P=await(u.isRTL==null?void 0:u.isRTL(h.floating)),_=w||(N||!v?[uu(l)]:c2(l)),D=x!=="none";!w&&D&&_.push(...d2(l,v,x,P));const H=[l,..._],K=await vc(e,b),ee=[];let W=((r=a.flip)==null?void 0:r.overflows)||[];if(p&&ee.push(K[E]),g){const Z=s2(o,s,P);ee.push(K[Z[0]],K[Z[1]])}if(W=[...W,{placement:o,overflows:ee}],!ee.every(Z=>Z<=0)){var de,se;const Z=(((de=a.flip)==null?void 0:de.index)||0)+1,Y=H[Z];if(Y){var fe;const Q=g==="alignment"?T!==Uo(Y):!1,X=((fe=W[0])==null?void 0:fe.overflows[0])>0;if(!Q||X)return{data:{index:Z,overflows:W},reset:{placement:Y}}}let oe=(se=W.filter(Q=>Q.overflows[0]<=0).sort((Q,X)=>Q.overflows[1]-X.overflows[1])[0])==null?void 0:se.placement;if(!oe)switch(y){case"bestFit":{var q;const Q=(q=W.filter(X=>{if(D){const $=Uo(X.placement);return $===T||$==="y"}return!0}).map(X=>[X.placement,X.overflows.filter($=>$>0).reduce(($,te)=>$+te,0)]).sort((X,$)=>X[1]-$[1])[0])==null?void 0:q[0];Q&&(oe=Q);break}case"initialPlacement":oe=l;break}if(o!==oe)return{reset:{placement:oe}}}return{}}}};function f_(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function h_(t){return o2.some(e=>t[e]>=0)}const g2=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...o}=$o(t,e);switch(r){case"referenceHidden":{const a=await vc(e,{...o,elementContext:"reference"}),s=f_(a,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:h_(s)}}}case"escaped":{const a=await vc(e,{...o,altBoundary:!0}),s=f_(a,n.floating);return{data:{escapedOffsets:s,escaped:h_(s)}}}default:return{}}}}};async function m2(t,e){const{placement:n,platform:r,elements:o}=t,a=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Ho(n),l=Za(n),u=Uo(n)==="y",h=["left","top"].includes(s)?-1:1,p=a&&u?-1:1,g=$o(e,t);let{mainAxis:w,crossAxis:y,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return l&&typeof x=="number"&&(y=l==="end"?x*-1:x),u?{x:y*p,y:w*h}:{x:w*h,y:y*p}}const v2=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:a,placement:s,middlewareData:l}=e,u=await m2(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:a+u.y,data:{...u,placement:s}}}}},y2=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:a=!0,crossAxis:s=!1,limiter:l={fn:b=>{let{x:E,y:T}=b;return{x:E,y:T}}},...u}=$o(t,e),h={x:n,y:r},p=await vc(e,u),g=Uo(Ho(o)),w=Lg(g);let y=h[w],x=h[g];if(a){const b=w==="y"?"top":"left",E=w==="y"?"bottom":"right",T=y+p[b],N=y-p[E];y=Dg(T,y,N)}if(s){const b=g==="y"?"top":"left",E=g==="y"?"bottom":"right",T=x+p[b],N=x-p[E];x=Dg(T,x,N)}const v=l.fn({...e,[w]:y,[g]:x});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[w]:a,[g]:s}}}}}},w2=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:o,rects:a,middlewareData:s}=e,{offset:l=0,mainAxis:u=!0,crossAxis:h=!0}=$o(t,e),p={x:n,y:r},g=Uo(o),w=Lg(g);let y=p[w],x=p[g];const v=$o(l,e),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(u){const N=w==="y"?"height":"width",P=a.reference[w]-a.floating[N]+b.mainAxis,_=a.reference[w]+a.reference[N]-b.mainAxis;y<P?y=P:y>_&&(y=_)}if(h){var E,T;const N=w==="y"?"width":"height",P=["top","left"].includes(Ho(o)),_=a.reference[g]-a.floating[N]+(P&&((E=s.offset)==null?void 0:E[g])||0)+(P?0:b.crossAxis),D=a.reference[g]+a.reference[N]+(P?0:((T=s.offset)==null?void 0:T[g])||0)-(P?b.crossAxis:0);x<_?x=_:x>D&&(x=D)}return{[w]:y,[g]:x}}}},C2=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:o,rects:a,platform:s,elements:l}=e,{apply:u=()=>{},...h}=$o(t,e),p=await vc(e,h),g=Ho(o),w=Za(o),y=Uo(o)==="y",{width:x,height:v}=a.floating;let b,E;g==="top"||g==="bottom"?(b=g,E=w===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(E=g,b=w==="end"?"top":"bottom");const T=v-p.top-p.bottom,N=x-p.left-p.right,P=bi(v-p[b],T),_=bi(x-p[E],N),D=!e.middlewareData.shift;let H=P,K=_;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(K=N),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(H=T),D&&!w){const W=sr(p.left,0),de=sr(p.right,0),se=sr(p.top,0),fe=sr(p.bottom,0);y?K=x-2*(W!==0||de!==0?W+de:sr(p.left,p.right)):H=v-2*(se!==0||fe!==0?se+fe:sr(p.top,p.bottom))}await u({...e,availableWidth:K,availableHeight:H});const ee=await s.getDimensions(l.floating);return x!==ee.width||v!==ee.height?{reset:{rects:!0}}:{}}}};function hu(){return typeof window<"u"}function es(t){return p_(t)?(t.nodeName||"").toLowerCase():"#document"}function cr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function mo(t){var e;return(e=(p_(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function p_(t){return hu()?t instanceof Node||t instanceof cr(t).Node:!1}function Ur(t){return hu()?t instanceof Element||t instanceof cr(t).Element:!1}function vo(t){return hu()?t instanceof HTMLElement||t instanceof cr(t).HTMLElement:!1}function g_(t){return!hu()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof cr(t).ShadowRoot}function yc(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=Br(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(o)}function b2(t){return["table","td","th"].includes(es(t))}function pu(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Ug(t){const e=Bg(),n=Ur(t)?Br(t):t;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function x2(t){let e=xi(t);for(;vo(e)&&!ts(e);){if(Ug(e))return e;if(pu(e))return null;e=xi(e)}return null}function Bg(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ts(t){return["html","body","#document"].includes(es(t))}function Br(t){return cr(t).getComputedStyle(t)}function gu(t){return Ur(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function xi(t){if(es(t)==="html")return t;const e=t.assignedSlot||t.parentNode||g_(t)&&t.host||mo(t);return g_(e)?e.host:e}function m_(t){const e=xi(t);return ts(e)?t.ownerDocument?t.ownerDocument.body:t.body:vo(e)&&yc(e)?e:m_(e)}function wc(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=m_(t),a=o===((r=t.ownerDocument)==null?void 0:r.body),s=cr(o);if(a){const l=zg(s);return e.concat(s,s.visualViewport||[],yc(o)?o:[],l&&n?wc(l):[])}return e.concat(o,wc(o,[],n))}function zg(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function v_(t){const e=Br(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=vo(t),a=o?t.offsetWidth:n,s=o?t.offsetHeight:r,l=lu(n)!==a||lu(r)!==s;return l&&(n=a,r=s),{width:n,height:r,$:l}}function Vg(t){return Ur(t)?t:t.contextElement}function ns(t){const e=Vg(t);if(!vo(e))return go(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:a}=v_(e);let s=(a?lu(n.width):n.width)/r,l=(a?lu(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const S2=go(0);function y_(t){const e=cr(t);return!Bg()||!e.visualViewport?S2:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _2(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==cr(t)?!1:e}function Qi(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),a=Vg(t);let s=go(1);e&&(r?Ur(r)&&(s=ns(r)):s=ns(t));const l=_2(a,n,r)?y_(a):go(0);let u=(o.left+l.x)/s.x,h=(o.top+l.y)/s.y,p=o.width/s.x,g=o.height/s.y;if(a){const w=cr(a),y=r&&Ur(r)?cr(r):r;let x=w,v=zg(x);for(;v&&r&&y!==x;){const b=ns(v),E=v.getBoundingClientRect(),T=Br(v),N=E.left+(v.clientLeft+parseFloat(T.paddingLeft))*b.x,P=E.top+(v.clientTop+parseFloat(T.paddingTop))*b.y;u*=b.x,h*=b.y,p*=b.x,g*=b.y,u+=N,h+=P,x=cr(v),v=zg(x)}}return fu({width:p,height:g,x:u,y:h})}function Kg(t,e){const n=gu(t).scrollLeft;return e?e.left+n:Qi(mo(t)).left+n}function w_(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),o=r.left+e.scrollLeft-(n?0:Kg(t,r)),a=r.top+e.scrollTop;return{x:o,y:a}}function E2(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const a=o==="fixed",s=mo(r),l=e?pu(e.floating):!1;if(r===s||l&&a)return n;let u={scrollLeft:0,scrollTop:0},h=go(1);const p=go(0),g=vo(r);if((g||!g&&!a)&&((es(r)!=="body"||yc(s))&&(u=gu(r)),vo(r))){const y=Qi(r);h=ns(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const w=s&&!g&&!a?w_(s,u,!0):go(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+p.x+w.x,y:n.y*h.y-u.scrollTop*h.y+p.y+w.y}}function T2(t){return Array.from(t.getClientRects())}function A2(t){const e=mo(t),n=gu(t),r=t.ownerDocument.body,o=sr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=sr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Kg(t);const l=-n.scrollTop;return Br(r).direction==="rtl"&&(s+=sr(e.clientWidth,r.clientWidth)-o),{width:o,height:a,x:s,y:l}}function I2(t,e){const n=cr(t),r=mo(t),o=n.visualViewport;let a=r.clientWidth,s=r.clientHeight,l=0,u=0;if(o){a=o.width,s=o.height;const h=Bg();(!h||h&&e==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}return{width:a,height:s,x:l,y:u}}function k2(t,e){const n=Qi(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,a=vo(t)?ns(t):go(1),s=t.clientWidth*a.x,l=t.clientHeight*a.y,u=o*a.x,h=r*a.y;return{width:s,height:l,x:u,y:h}}function C_(t,e,n){let r;if(e==="viewport")r=I2(t,n);else if(e==="document")r=A2(mo(t));else if(Ur(e))r=k2(e,n);else{const o=y_(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return fu(r)}function b_(t,e){const n=xi(t);return n===e||!Ur(n)||ts(n)?!1:Br(n).position==="fixed"||b_(n,e)}function N2(t,e){const n=e.get(t);if(n)return n;let r=wc(t,[],!1).filter(l=>Ur(l)&&es(l)!=="body"),o=null;const a=Br(t).position==="fixed";let s=a?xi(t):t;for(;Ur(s)&&!ts(s);){const l=Br(s),u=Ug(s);!u&&l.position==="fixed"&&(o=null),(a?!u&&!o:!u&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||yc(s)&&!u&&b_(t,s))?r=r.filter(p=>p!==s):o=l,s=xi(s)}return e.set(t,r),r}function P2(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const s=[...n==="clippingAncestors"?pu(e)?[]:N2(e,this._c):[].concat(n),r],l=s[0],u=s.reduce((h,p)=>{const g=C_(e,p,o);return h.top=sr(g.top,h.top),h.right=bi(g.right,h.right),h.bottom=bi(g.bottom,h.bottom),h.left=sr(g.left,h.left),h},C_(e,l,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function O2(t){const{width:e,height:n}=v_(t);return{width:e,height:n}}function M2(t,e,n){const r=vo(e),o=mo(e),a=n==="fixed",s=Qi(t,!0,a,e);let l={scrollLeft:0,scrollTop:0};const u=go(0);function h(){u.x=Kg(o)}if(r||!r&&!a)if((es(e)!=="body"||yc(o))&&(l=gu(e)),r){const y=Qi(e,!0,a,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else o&&h();a&&!r&&o&&h();const p=o&&!r&&!a?w_(o,l):go(0),g=s.left+l.scrollLeft-u.x-p.x,w=s.top+l.scrollTop-u.y-p.y;return{x:g,y:w,width:s.width,height:s.height}}function Gg(t){return Br(t).position==="static"}function x_(t,e){if(!vo(t)||Br(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return mo(t)===n&&(n=n.ownerDocument.body),n}function S_(t,e){const n=cr(t);if(pu(t))return n;if(!vo(t)){let o=xi(t);for(;o&&!ts(o);){if(Ur(o)&&!Gg(o))return o;o=xi(o)}return n}let r=x_(t,e);for(;r&&b2(r)&&Gg(r);)r=x_(r,e);return r&&ts(r)&&Gg(r)&&!Ug(r)?n:r||x2(t)||n}const R2=async function(t){const e=this.getOffsetParent||S_,n=this.getDimensions,r=await n(t.floating);return{reference:M2(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function D2(t){return Br(t).direction==="rtl"}const L2={convertOffsetParentRelativeRectToViewportRelativeRect:E2,getDocumentElement:mo,getClippingRect:P2,getOffsetParent:S_,getElementRects:R2,getClientRects:T2,getDimensions:O2,getScale:ns,isElement:Ur,isRTL:D2};function __(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function F2(t,e){let n=null,r;const o=mo(t);function a(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function s(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),a();const h=t.getBoundingClientRect(),{left:p,top:g,width:w,height:y}=h;if(l||e(),!w||!y)return;const x=du(g),v=du(o.clientWidth-(p+w)),b=du(o.clientHeight-(g+y)),E=du(p),N={rootMargin:-x+"px "+-v+"px "+-b+"px "+-E+"px",threshold:sr(0,bi(1,u))||1};let P=!0;function _(D){const H=D[0].intersectionRatio;if(H!==u){if(!P)return s();H?s(!1,H):r=setTimeout(()=>{s(!1,1e-7)},1e3)}H===1&&!__(h,t.getBoundingClientRect())&&s(),P=!1}try{n=new IntersectionObserver(_,{...N,root:o.ownerDocument})}catch{n=new IntersectionObserver(_,N)}n.observe(t)}return s(!0),a}function E_(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=Vg(t),p=o||a?[...h?wc(h):[],...wc(e)]:[];p.forEach(E=>{o&&E.addEventListener("scroll",n,{passive:!0}),a&&E.addEventListener("resize",n)});const g=h&&l?F2(h,n):null;let w=-1,y=null;s&&(y=new ResizeObserver(E=>{let[T]=E;T&&T.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var N;(N=y)==null||N.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let x,v=u?Qi(t):null;u&&b();function b(){const E=Qi(t);v&&!__(v,E)&&n(),v=E,x=requestAnimationFrame(b)}return n(),()=>{var E;p.forEach(T=>{o&&T.removeEventListener("scroll",n),a&&T.removeEventListener("resize",n)}),g==null||g(),(E=y)==null||E.disconnect(),y=null,u&&cancelAnimationFrame(x)}}const $2=v2,H2=y2,U2=p2,B2=C2,z2=g2,T_=h2,V2=w2,K2=(t,e,n)=>{const r=new Map,o={platform:L2,...n},a={...o.platform,_c:r};return f2(t,e,{...o,platform:a})};var mu=typeof document<"u"?M.useLayoutEffect:M.useEffect;function vu(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!vu(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const a=o[r];if(!(a==="_owner"&&t.$$typeof)&&!vu(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function A_(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function I_(t,e){const n=A_(t);return Math.round(e*n)/n}function jg(t){const e=C.useRef(t);return mu(()=>{e.current=t}),e}function k_(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:a,floating:s}={},transform:l=!0,whileElementsMounted:u,open:h}=t,[p,g]=C.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[w,y]=C.useState(r);vu(w,r)||y(r);const[x,v]=C.useState(null),[b,E]=C.useState(null),T=C.useCallback(Q=>{Q!==D.current&&(D.current=Q,v(Q))},[]),N=C.useCallback(Q=>{Q!==H.current&&(H.current=Q,E(Q))},[]),P=a||x,_=s||b,D=C.useRef(null),H=C.useRef(null),K=C.useRef(p),ee=u!=null,W=jg(u),de=jg(o),se=jg(h),fe=C.useCallback(()=>{if(!D.current||!H.current)return;const Q={placement:e,strategy:n,middleware:w};de.current&&(Q.platform=de.current),K2(D.current,H.current,Q).then(X=>{const $={...X,isPositioned:se.current!==!1};q.current&&!vu(K.current,$)&&(K.current=$,Ia.flushSync(()=>{g($)}))})},[w,e,n,de,se]);mu(()=>{h===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,g(Q=>({...Q,isPositioned:!1})))},[h]);const q=C.useRef(!1);mu(()=>(q.current=!0,()=>{q.current=!1}),[]),mu(()=>{if(P&&(D.current=P),_&&(H.current=_),P&&_){if(W.current)return W.current(P,_,fe);fe()}},[P,_,fe,W,ee]);const Z=C.useMemo(()=>({reference:D,floating:H,setReference:T,setFloating:N}),[T,N]),Y=C.useMemo(()=>({reference:P,floating:_}),[P,_]),oe=C.useMemo(()=>{const Q={position:n,left:0,top:0};if(!Y.floating)return Q;const X=I_(Y.floating,p.x),$=I_(Y.floating,p.y);return l?{...Q,transform:"translate("+X+"px, "+$+"px)",...A_(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:X,top:$}},[n,l,Y.floating,p.x,p.y]);return C.useMemo(()=>({...p,update:fe,refs:Z,elements:Y,floatingStyles:oe}),[p,fe,Z,Y,oe])}const G2=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?T_({element:r.current,padding:o}).fn(n):{}:r?T_({element:r,padding:o}).fn(n):{}}}},N_=(t,e)=>({...$2(t),options:[t,e]}),P_=(t,e)=>({...H2(t),options:[t,e]}),O_=(t,e)=>({...V2(t),options:[t,e]}),M_=(t,e)=>({...U2(t),options:[t,e]}),R_=(t,e)=>({...B2(t),options:[t,e]}),D_=(t,e)=>({...z2(t),options:[t,e]}),L_=(t,e)=>({...G2(t),options:[t,e]});var j2="Arrow",F_=C.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...a}=t;return d.jsx(mt.svg,{...a,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});F_.displayName=j2;var W2=F_,Wg="Popper",[$_,H_]=gr(Wg),[q2,U_]=$_(Wg),B_=t=>{const{__scopePopper:e,children:n}=t,[r,o]=C.useState(null);return d.jsx(q2,{scope:e,anchor:r,onAnchorChange:o,children:n})};B_.displayName=Wg;var z_="PopperAnchor",V_=C.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,a=U_(z_,n),s=C.useRef(null),l=rt(e,s);return C.useEffect(()=>{a.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:d.jsx(mt.div,{...o,ref:l})});V_.displayName=z_;var qg="PopperContent",[Y2,J2]=$_(qg),K_=C.forwardRef((t,e)=>{var z,ce,Ae,Ce,Ne,ne;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:a="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:p=0,sticky:g="partial",hideWhenDetached:w=!1,updatePositionStrategy:y="optimized",onPlaced:x,...v}=t,b=U_(qg,n),[E,T]=C.useState(null),N=rt(e,Ve=>T(Ve)),[P,_]=C.useState(null),D=vg(P),H=(D==null?void 0:D.width)??0,K=(D==null?void 0:D.height)??0,ee=r+(a!=="center"?"-"+a:""),W=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},de=Array.isArray(h)?h:[h],se=de.length>0,fe={padding:W,boundary:de.filter(X2),altBoundary:se},{refs:q,floatingStyles:Z,placement:Y,isPositioned:oe,middlewareData:Q}=k_({strategy:"fixed",placement:ee,whileElementsMounted:(...Ve)=>E_(...Ve,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[N_({mainAxis:o+K,alignmentAxis:s}),u&&P_({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?O_():void 0,...fe}),u&&M_({...fe}),R_({...fe,apply:({elements:Ve,rects:Qe,availableWidth:Ct,availableHeight:Yt})=>{const{width:bt,height:rn}=Qe.reference,zt=Ve.floating.style;zt.setProperty("--radix-popper-available-width",`${Ct}px`),zt.setProperty("--radix-popper-available-height",`${Yt}px`),zt.setProperty("--radix-popper-anchor-width",`${bt}px`),zt.setProperty("--radix-popper-anchor-height",`${rn}px`)}}),P&&L_({element:P,padding:l}),Z2({arrowWidth:H,arrowHeight:K}),w&&D_({strategy:"referenceHidden",...fe})]}),[X,$]=W_(Y),te=gn(x);tn(()=>{oe&&(te==null||te())},[oe,te]);const _e=(z=Q.arrow)==null?void 0:z.x,ke=(ce=Q.arrow)==null?void 0:ce.y,xe=((Ae=Q.arrow)==null?void 0:Ae.centerOffset)!==0,[Pe,Te]=C.useState();return tn(()=>{E&&Te(window.getComputedStyle(E).zIndex)},[E]),d.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:oe?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Pe,"--radix-popper-transform-origin":[(Ce=Q.transformOrigin)==null?void 0:Ce.x,(Ne=Q.transformOrigin)==null?void 0:Ne.y].join(" "),...((ne=Q.hide)==null?void 0:ne.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:d.jsx(Y2,{scope:n,placedSide:X,onArrowChange:_,arrowX:_e,arrowY:ke,shouldHideArrow:xe,children:d.jsx(mt.div,{"data-side":X,"data-align":$,...v,ref:N,style:{...v.style,animation:oe?void 0:"none"}})})})});K_.displayName=qg;var G_="PopperArrow",Q2={top:"bottom",right:"left",bottom:"top",left:"right"},j_=C.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,a=J2(G_,r),s=Q2[a.placedSide];return d.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:d.jsx(W2,{...o,ref:n,style:{...o.style,display:"block"}})})});j_.displayName=G_;function X2(t){return t!==null}var Z2=t=>({name:"transformOrigin",options:t,fn(e){var b,E,T;const{placement:n,rects:r,middlewareData:o}=e,s=((b=o.arrow)==null?void 0:b.centerOffset)!==0,l=s?0:t.arrowWidth,u=s?0:t.arrowHeight,[h,p]=W_(n),g={start:"0%",center:"50%",end:"100%"}[p],w=(((E=o.arrow)==null?void 0:E.x)??0)+l/2,y=(((T=o.arrow)==null?void 0:T.y)??0)+u/2;let x="",v="";return h==="bottom"?(x=s?g:`${w}px`,v=`${-u}px`):h==="top"?(x=s?g:`${w}px`,v=`${r.floating.height+u}px`):h==="right"?(x=`${-u}px`,v=s?g:`${y}px`):h==="left"&&(x=`${r.floating.width+u}px`,v=s?g:`${y}px`),{data:{x,y:v}}}});function W_(t){const[e,n="center"]=t.split("-");return[e,n]}var e$=B_,t$=V_,n$=K_,r$=j_,o$=Symbol("radix.slottable");function i$(t){const e=({children:n})=>d.jsx(d.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=o$,e}var a$=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"}),s$="VisuallyHidden",q_=C.forwardRef((t,e)=>d.jsx(mt.span,{...t,ref:e,style:{...a$,...t.style}}));q_.displayName=s$;var c$=q_,[yu,Bj]=gr("Tooltip",[H_]),wu=H_(),Y_="TooltipProvider",l$=700,Yg="tooltip.open",[d$,Jg]=yu(Y_),J_=t=>{const{__scopeTooltip:e,delayDuration:n=l$,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:a}=t,s=C.useRef(!0),l=C.useRef(!1),u=C.useRef(0);return C.useEffect(()=>{const h=u.current;return()=>window.clearTimeout(h)},[]),d.jsx(d$,{scope:e,isOpenDelayedRef:s,delayDuration:n,onOpen:C.useCallback(()=>{window.clearTimeout(u.current),s.current=!1},[]),onClose:C.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>s.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:C.useCallback(h=>{l.current=h},[]),disableHoverableContent:o,children:a})};J_.displayName=Y_;var Cc="Tooltip",[u$,bc]=yu(Cc),Q_=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:o,onOpenChange:a,disableHoverableContent:s,delayDuration:l}=t,u=Jg(Cc,t.__scopeTooltip),h=wu(e),[p,g]=C.useState(null),w=Mo(),y=C.useRef(0),x=s??u.disableHoverableContent,v=l??u.delayDuration,b=C.useRef(!1),[E,T]=ui({prop:r,defaultProp:o??!1,onChange:H=>{H?(u.onOpen(),document.dispatchEvent(new CustomEvent(Yg))):u.onClose(),a==null||a(H)},caller:Cc}),N=C.useMemo(()=>E?b.current?"delayed-open":"instant-open":"closed",[E]),P=C.useCallback(()=>{window.clearTimeout(y.current),y.current=0,b.current=!1,T(!0)},[T]),_=C.useCallback(()=>{window.clearTimeout(y.current),y.current=0,T(!1)},[T]),D=C.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{b.current=!0,T(!0),y.current=0},v)},[v,T]);return C.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),d.jsx(e$,{...h,children:d.jsx(u$,{scope:e,contentId:w,open:E,stateAttribute:N,trigger:p,onTriggerChange:g,onTriggerEnter:C.useCallback(()=>{u.isOpenDelayedRef.current?D():P()},[u.isOpenDelayedRef,D,P]),onTriggerLeave:C.useCallback(()=>{x?_():(window.clearTimeout(y.current),y.current=0)},[_,x]),onOpen:P,onClose:_,disableHoverableContent:x,children:n})})};Q_.displayName=Cc;var Qg="TooltipTrigger",X_=C.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,o=bc(Qg,n),a=Jg(Qg,n),s=wu(n),l=C.useRef(null),u=rt(e,l,o.onTriggerChange),h=C.useRef(!1),p=C.useRef(!1),g=C.useCallback(()=>h.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),d.jsx(t$,{asChild:!0,...s,children:d.jsx(mt.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:Ue(t.onPointerMove,w=>{w.pointerType!=="touch"&&!p.current&&!a.isPointerInTransitRef.current&&(o.onTriggerEnter(),p.current=!0)}),onPointerLeave:Ue(t.onPointerLeave,()=>{o.onTriggerLeave(),p.current=!1}),onPointerDown:Ue(t.onPointerDown,()=>{o.open&&o.onClose(),h.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Ue(t.onFocus,()=>{h.current||o.onOpen()}),onBlur:Ue(t.onBlur,o.onClose),onClick:Ue(t.onClick,o.onClose)})})});X_.displayName=Qg;var Xg="TooltipPortal",[f$,h$]=yu(Xg,{forceMount:void 0}),Z_=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:o}=t,a=bc(Xg,e);return d.jsx(f$,{scope:e,forceMount:n,children:d.jsx(Ro,{present:n||a.open,children:d.jsx(fd,{asChild:!0,container:o,children:r})})})};Z_.displayName=Xg;var rs="TooltipContent",eE=C.forwardRef((t,e)=>{const n=h$(rs,t.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...a}=t,s=bc(rs,t.__scopeTooltip);return d.jsx(Ro,{present:r||s.open,children:s.disableHoverableContent?d.jsx(tE,{side:o,...a,ref:e}):d.jsx(p$,{side:o,...a,ref:e})})}),p$=C.forwardRef((t,e)=>{const n=bc(rs,t.__scopeTooltip),r=Jg(rs,t.__scopeTooltip),o=C.useRef(null),a=rt(e,o),[s,l]=C.useState(null),{trigger:u,onClose:h}=n,p=o.current,{onPointerInTransitChange:g}=r,w=C.useCallback(()=>{l(null),g(!1)},[g]),y=C.useCallback((x,v)=>{const b=x.currentTarget,E={x:x.clientX,y:x.clientY},T=w$(E,b.getBoundingClientRect()),N=C$(E,T),P=b$(v.getBoundingClientRect()),_=S$([...N,...P]);l(_),g(!0)},[g]);return C.useEffect(()=>()=>w(),[w]),C.useEffect(()=>{if(u&&p){const x=b=>y(b,p),v=b=>y(b,u);return u.addEventListener("pointerleave",x),p.addEventListener("pointerleave",v),()=>{u.removeEventListener("pointerleave",x),p.removeEventListener("pointerleave",v)}}},[u,p,y,w]),C.useEffect(()=>{if(s){const x=v=>{const b=v.target,E={x:v.clientX,y:v.clientY},T=(u==null?void 0:u.contains(b))||(p==null?void 0:p.contains(b)),N=!x$(E,s);T?w():N&&(w(),h())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[u,p,s,h,w]),d.jsx(tE,{...t,ref:a})}),[g$,m$]=yu(Cc,{isInside:!1}),v$=i$("TooltipContent"),tE=C.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:a,onPointerDownOutside:s,...l}=t,u=bc(rs,n),h=wu(n),{onClose:p}=u;return C.useEffect(()=>(document.addEventListener(Yg,p),()=>document.removeEventListener(Yg,p)),[p]),C.useEffect(()=>{if(u.trigger){const g=w=>{const y=w.target;y!=null&&y.contains(u.trigger)&&p()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[u.trigger,p]),d.jsx(ud,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:g=>g.preventDefault(),onDismiss:p,children:d.jsxs(n$,{"data-state":u.stateAttribute,...h,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(v$,{children:r}),d.jsx(g$,{scope:n,isInside:!0,children:d.jsx(c$,{id:u.contentId,role:"tooltip",children:o||r})})]})})});eE.displayName=rs;var nE="TooltipArrow",y$=C.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,o=wu(n);return m$(nE,n).isInside?null:d.jsx(r$,{...o,...r,ref:e})});y$.displayName=nE;function w$(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),o=Math.abs(e.right-t.x),a=Math.abs(e.left-t.x);switch(Math.min(n,r,o,a)){case a:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function C$(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function b$(t){const{top:e,right:n,bottom:r,left:o}=t;return[{x:o,y:e},{x:n,y:e},{x:n,y:r},{x:o,y:r}]}function x$(t,e){const{x:n,y:r}=t;let o=!1;for(let a=0,s=e.length-1;a<e.length;s=a++){const l=e[a],u=e[s],h=l.x,p=l.y,g=u.x,w=u.y;p>r!=w>r&&n<(g-h)*(r-p)/(w-p)+h&&(o=!o)}return o}function S$(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),_$(e)}function _$(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const o=t[r];for(;e.length>=2;){const a=e[e.length-1],s=e[e.length-2];if((a.x-s.x)*(o.y-s.y)>=(a.y-s.y)*(o.x-s.x))e.pop();else break}e.push(o)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const o=t[r];for(;n.length>=2;){const a=n[n.length-1],s=n[n.length-2];if((a.x-s.x)*(o.y-s.y)>=(a.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var E$=J_,T$=Q_,A$=X_,I$=Z_,rE=eE;const vr=E$,yr=T$,wr=A$,lr=C.forwardRef(({className:t,sideOffset:e=4,...n},r)=>d.jsx(I$,{children:d.jsx(rE,{ref:r,sideOffset:e,className:ze("z-50 overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",t),...n})}));lr.displayName=rE.displayName;function k$({title:t,titleId:e,...n},r){return C.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?C.createElement("title",{id:e},t):null,C.createElement("path",{fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const N$=C.forwardRef(k$);var P$=function(t){return function(e,n){var r=M.useRef(!1);t(function(){return function(){r.current=!1}},[]),t(function(){if(!r.current)r.current=!0;else return e()},n)}},oE=function(t){return typeof t=="function"},iE=process.env.NODE_ENV==="development"||process.env.NODE_ENV==="test";const O$=P$(M.useEffect);function aE(t){var e=M.useRef(t);return e.current=t,e}var M$=function(t){iE&&(oE(t)||console.error("useUnmount expected parameter is a function, got ".concat(typeof t)));var e=aE(t);M.useEffect(function(){return function(){e.current()}},[])};function R$(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var sE=R$,D$=typeof fo=="object"&&fo&&fo.Object===Object&&fo,L$=D$,F$=L$,$$=typeof self=="object"&&self&&self.Object===Object&&self,H$=F$||$$||Function("return this")(),cE=H$,U$=cE,B$=function(){return U$.Date.now()},z$=B$,V$=/\s/;function K$(t){for(var e=t.length;e--&&V$.test(t.charAt(e)););return e}var G$=K$,j$=G$,W$=/^\s+/;function q$(t){return t&&t.slice(0,j$(t)+1).replace(W$,"")}var Y$=q$,J$=cE,Q$=J$.Symbol,lE=Q$,dE=lE,uE=Object.prototype,X$=uE.hasOwnProperty,Z$=uE.toString,xc=dE?dE.toStringTag:void 0;function eH(t){var e=X$.call(t,xc),n=t[xc];try{t[xc]=void 0;var r=!0}catch{}var o=Z$.call(t);return r&&(e?t[xc]=n:delete t[xc]),o}var tH=eH,nH=Object.prototype,rH=nH.toString;function oH(t){return rH.call(t)}var iH=oH,fE=lE,aH=tH,sH=iH,cH="[object Null]",lH="[object Undefined]",hE=fE?fE.toStringTag:void 0;function dH(t){return t==null?t===void 0?lH:cH:hE&&hE in Object(t)?aH(t):sH(t)}var uH=dH;function fH(t){return t!=null&&typeof t=="object"}var hH=fH,pH=uH,gH=hH,mH="[object Symbol]";function vH(t){return typeof t=="symbol"||gH(t)&&pH(t)==mH}var yH=vH,wH=Y$,pE=sE,CH=yH,gE=NaN,bH=/^[-+]0x[0-9a-f]+$/i,xH=/^0b[01]+$/i,SH=/^0o[0-7]+$/i,_H=parseInt;function EH(t){if(typeof t=="number")return t;if(CH(t))return gE;if(pE(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=pE(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=wH(t);var n=xH.test(t);return n||SH.test(t)?_H(t.slice(2),n?2:8):bH.test(t)?gE:+t}var TH=EH,AH=sE,Zg=z$,mE=TH,IH="Expected a function",kH=Math.max,NH=Math.min;function PH(t,e,n){var r,o,a,s,l,u,h=0,p=!1,g=!1,w=!0;if(typeof t!="function")throw new TypeError(IH);e=mE(e)||0,AH(n)&&(p=!!n.leading,g="maxWait"in n,a=g?kH(mE(n.maxWait)||0,e):a,w="trailing"in n?!!n.trailing:w);function y(D){var H=r,K=o;return r=o=void 0,h=D,s=t.apply(K,H),s}function x(D){return h=D,l=setTimeout(E,e),p?y(D):s}function v(D){var H=D-u,K=D-h,ee=e-H;return g?NH(ee,a-K):ee}function b(D){var H=D-u,K=D-h;return u===void 0||H>=e||H<0||g&&K>=a}function E(){var D=Zg();if(b(D))return T(D);l=setTimeout(E,v(D))}function T(D){return l=void 0,w&&r?y(D):(r=o=void 0,s)}function N(){l!==void 0&&clearTimeout(l),h=0,r=u=o=l=void 0}function P(){return l===void 0?s:T(Zg())}function _(){var D=Zg(),H=b(D);if(r=arguments,o=this,u=D,H){if(l===void 0)return x(u);if(g)return clearTimeout(l),l=setTimeout(E,e),y(u)}return l===void 0&&(l=setTimeout(E,e)),s}return _.cancel=N,_.flush=P,_}var OH=PH;const MH=Ud(OH);function RH(){var t=(typeof global>"u"?"undefined":typeof global)=="object"&&global&&global.Object===Object&&global,e=typeof self=="object"&&self&&self.Object===Object&&self;return t||e}RH()||(global.Date=Date);function DH(t,e){var n;iE&&(oE(t)||console.error("useDebounceFn expected parameter is a function, got ".concat(typeof t)));var r=aE(t),o=(n=e==null?void 0:e.wait)!==null&&n!==void 0?n:1e3,a=M.useMemo(function(){return MH(function(){for(var s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return r.current.apply(r,tb([],eb(s),!1))},o,e)},[]);return M$(function(){a.cancel()}),{run:a,cancel:a.cancel,flush:a.flush}}function LH(t,e,n){var r=eb(M.useState({}),2),o=r[0],a=r[1],s=DH(function(){a({})},n).run;M.useEffect(function(){return s()},e),O$(t,[o])}const FH=M.forwardRef(({onChange:t},e)=>{const n=M.useRef(null),[r,o]=M.useState("");return M.useImperativeHandle(e,()=>({setValue:a=>{var s;o(a),(s=n.current)==null||s.focus()}})),LH(()=>{t==null||t(r)},[r],{wait:300}),d.jsxs(d.Fragment,{children:[d.jsx(Gn,{ref:n,type:"text",placeholder:"Search files...",value:r,onChange:a=>o(a.target.value),className:"pr-8"}),r&&d.jsx("button",{onClick:()=>{var a;o(""),(a=n.current)==null||a.focus()},className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700",children:d.jsx(N$,{className:"h-5 w-5"})})]})});var zr=(t=>(t.VIEW_DOCUMENT="VIEW_DOCUMENT",t.DOWNLOAD_DOCUMENT="DOWNLOAD_DOCUMENT",t.EDIT_DOCUMENT="EDIT_DOCUMENT",t.OWNER_DOCUMENT="OWNER_DOCUMENT",t))(zr||{});const $H=(t,e)=>{const[n,r]=M.useState([]),[o,a]=M.useState([]),[s,l]=M.useState([]),[u,h]=M.useState([]),{toast:p}=mc(),[g,w]=M.useState(!1),[y,x]=M.useState(!1),v=M.useCallback(async(P,_,D)=>{if(!y){x(!0);try{const H=await Le.post(t+"/document-permission/grandted",{path:P,grandtedBy:_,data:D});return H.status===200&&(p({title:"Phân quyền tài liệu thành công."}),await N(P)),H}catch{return null}finally{x(!1)}}},[]),b=M.useCallback(async()=>{var P;try{return(P=(await Le.get(e+"admin/users/get-all",{params:{limit:1e4}})).data||[])==null?void 0:P.filter(K=>K.role!=="MASTER_ADMIN")}catch(_){return console.error("Error fetchAllUsers",_),[]}},[]),E=M.useCallback(async()=>{try{return(await Le.get(e+"admin/group-users")).data.filter(_=>`${_.groupname}`.toUpperCase()!=="MASTER_ADMIN").map(_=>{var D;return{..._,users:((D=_.users)==null?void 0:D.length)||0}})}catch(P){return console.error("Error fetchAllGroups",P),[]}},[]),T=M.useCallback(async P=>{try{const D=(await Le.get(t+"/document-permission/grandted",{params:{path:P}})).data;return{usersShared:(D==null?void 0:D.users)||[],groupsShared:(D==null?void 0:D.groups)||[]}}catch(_){return console.error("Error fetchShared",_),{usersShared:[],groupsShared:[]}}},[]),N=M.useCallback(async P=>{if(g)return;w(!0);let[_,D,{usersShared:H,groupsShared:K}]=await Promise.all([b(),E(),T(P)]);_=_==null?void 0:_.filter(ee=>!(H!=null&&H.find(W=>W.userId===ee.id))),D=D==null?void 0:D.filter(ee=>!(K!=null&&K.find(W=>W.groupname===ee.groupname))),Array.isArray(_)&&r(_),Array.isArray(D)&&a(D),Array.isArray(H)&&l(H),Array.isArray(K)&&h(K),w(!1)},[]);return{users:n,groups:o,sharedUsers:s,sharedGroups:u,setUsers:r,setGroups:a,setSharedUsers:l,setSharedGroups:h,fetchData:N,loading:g,postGranted:v,loadingGrandted:y}},HH=({failureReasons:t,onNavigateToFile:e})=>{const n=u=>{if(e){const h=u.replace("s3://cts-llm-docs-bucket/","");e(h)}},r=u=>{const h=[];return u.forEach(p=>{try{JSON.parse(p).forEach(w=>{const y=w.match(/\[Files: ([^\]]+)\]/),x=w.match(/^([^[]+)/);if(y&&x&&y[1]&&x[1]){const v=y[1].split(", ").map(T=>T.trim()),b=x[1].trim().replace("Encountered error: ","");let E="unknown";b.includes("invalid metadata attributes")||b.includes("metadata quota")?E="metadata":b.includes("No metadata was provided")||b.includes("metadata file")?E="missing_metadata":b.includes("file size")||b.includes("exceeds")||b.includes("50 MB")?E="file_size":b.includes("format not supported")||b.includes("unsupported format")||b.includes("file type")?E="file_format":b.includes("embedding failed")||b.includes("EMBEDDING_FAILED")?E="embedding_failed":b.includes("indexing failed")||b.includes("INDEXING_FAILED")?E="indexing_failed":b.includes("access denied")||b.includes("AccessDeniedException")||b.includes("permission")?E="access_denied":(b.includes("quota")||b.includes("limit")||b.includes("ServiceQuotaExceededException"))&&(E="quota_exceeded"),h.push({errorMessage:b,files:v,errorType:E})}})}catch{h.push({errorMessage:p,files:[],errorType:"unknown"})}}),h},o=u=>{switch(u){case"metadata":return d.jsx(gi,{className:"h-4 w-4 text-orange-500"});case"missing_metadata":return d.jsx(cg,{className:"h-4 w-4 text-red-500"});case"file_size":return d.jsx(gi,{className:"h-4 w-4 text-yellow-500"});case"file_format":return d.jsx(cg,{className:"h-4 w-4 text-purple-500"});case"embedding_failed":return d.jsx(gi,{className:"h-4 w-4 text-red-600"});case"indexing_failed":return d.jsx(gi,{className:"h-4 w-4 text-red-600"});case"access_denied":return d.jsx(gi,{className:"h-4 w-4 text-red-700"});case"quota_exceeded":return d.jsx(gi,{className:"h-4 w-4 text-orange-600"});default:return d.jsx(gi,{className:"h-4 w-4 text-red-500"})}},a=u=>{switch(u){case"metadata":return"border-orange-200 bg-orange-50";case"missing_metadata":return"border-red-200 bg-red-50";case"file_size":return"border-yellow-200 bg-yellow-50";case"file_format":return"border-purple-200 bg-purple-50";case"embedding_failed":return"border-red-300 bg-red-100";case"indexing_failed":return"border-red-300 bg-red-100";case"access_denied":return"border-red-400 bg-red-100";case"quota_exceeded":return"border-orange-300 bg-orange-100";default:return"border-red-200 bg-red-50"}},s=u=>{switch(u){case"metadata":return"text-orange-800";case"missing_metadata":return"text-red-800";case"file_size":return"text-yellow-800";case"file_format":return"text-purple-800";case"embedding_failed":return"text-red-900";case"indexing_failed":return"text-red-900";case"access_denied":return"text-red-900";case"quota_exceeded":return"text-orange-900";default:return"text-red-800"}},l=r(t);return l.length===0?null:d.jsxs("div",{className:"border-t pt-2",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(gi,{className:"h-4 w-4 text-red-500"}),d.jsxs("p",{className:"text-red-600 font-medium",children:["Các file lỗi (",l.reduce((u,h)=>u+h.files.length,0)," file)"]})]}),d.jsx("div",{className:"space-y-3 max-h-80 overflow-y-auto",children:l.map((u,h)=>d.jsxs("div",{className:`p-3 rounded-lg border ${a(u.errorType)}`,children:[d.jsx("div",{className:"flex items-start justify-between",children:d.jsxs("div",{className:"flex items-start gap-2 flex-1",children:[o(u.errorType),d.jsxs("div",{className:"flex-1",children:[d.jsx("p",{className:`font-medium text-sm ${s(u.errorType)}`,children:u.errorMessage}),u.files.length>0&&d.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:[u.files.length," file bị ảnh hưởng"]})]})]})}),u.files.length>0&&d.jsxs("div",{className:"mt-3 pt-2 border-t border-gray-200",children:[d.jsx("p",{className:"text-xs font-medium text-gray-700 mb-2",children:"Danh sách file lỗi:"}),d.jsx("div",{className:"max-h-32 overflow-y-auto space-y-1",children:u.files.map((p,g)=>d.jsxs("div",{className:"flex items-center gap-2 text-xs p-2 bg-white/50 rounded hover:bg-white/80 transition-colors",children:[d.jsx(cg,{className:"h-3 w-3 text-red-400 flex-shrink-0"}),e?d.jsxs("button",{onClick:()=>n(p),className:"text-blue-600 hover:text-blue-800 underline break-all font-mono text-left flex-1 flex items-center gap-1",title:"Nhấp để điều hướng đến file",children:[d.jsx("span",{children:p.replace("s3://cts-llm-docs-bucket/","")}),d.jsx(VD,{className:"h-3 w-3 flex-shrink-0"})]}):d.jsx("span",{className:"text-gray-700 break-all font-mono",children:p.replace("s3://cts-llm-docs-bucket/","")})]},g))})]})]},h))})]})};var em={exports:{}},Cu={exports:{}},yt={};/** @license React v16.13.1
204
+ `);var dg=t=>typeof t=="number"&&!isNaN(t),oc=t=>typeof t=="string",Vx=t=>typeof t=="function",qD=t=>oc(t)||dg(t),YD=t=>M.isValidElement(t)||oc(t)||Vx(t)||dg(t),JD=1,Kx=()=>`${JD++}`,ho=new Map,ug=[],Gx=new Set,jx=()=>ho.size>0,QD=(t,{containerId:e})=>{var n;return(n=ho.get(e||1))==null?void 0:n.toasts.get(t)};function XD(t,e){var n;if(e)return!!((n=ho.get(e))!=null&&n.isToastActive(t));let r=!1;return ho.forEach(o=>{o.isToastActive(t)&&(r=!0)}),r}function ZD(t){if(!jx()){ug=ug.filter(e=>t!=null&&e.options.toastId!==t);return}if(t==null||qD(t))ho.forEach(e=>{e.removeToast(t)});else if(t&&("containerId"in t||"id"in t)){let e=ho.get(t.containerId);e?e.removeToast(t.id):ho.forEach(n=>{n.removeToast(t.id)})}}var eL=(t={})=>{ho.forEach(e=>{e.props.limit&&(!t.containerId||e.id===t.containerId)&&e.clearQueue()})};function tL(t,e){YD(t)&&(jx()||ug.push({content:t,options:e}),ho.forEach(n=>{n.buildToast(t,e)}))}function Wx(t,e){ho.forEach(n=>{(e==null||!(e!=null&&e.containerId)||(e==null?void 0:e.containerId)===n.id)&&n.toggle(t,e==null?void 0:e.id)})}function nL(t){return Gx.add(t),()=>{Gx.delete(t)}}function rL(t){return t&&(oc(t.toastId)||dg(t.toastId))?t.toastId:Kx()}function ic(t,e){return tL(t,e),e.toastId}function Vd(t,e){return{...e,type:e&&e.type||t,toastId:rL(e)}}function Kd(t){return(e,n)=>ic(e,Vd(t,n))}function st(t,e){return ic(t,Vd("default",e))}st.loading=(t,e)=>ic(t,Vd("default",{isLoading:!0,autoClose:!1,closeOnClick:!1,closeButton:!1,draggable:!1,...e}));function oL(t,{pending:e,error:n,success:r},o){let a;e&&(a=oc(e)?st.loading(e,o):st.loading(e.render,{...o,...e}));let s={isLoading:null,autoClose:null,closeOnClick:null,closeButton:null,draggable:null},l=(h,p,g)=>{if(p==null){st.dismiss(a);return}let w={type:h,...s,...o,data:g},y=oc(p)?{render:p}:p;return a?st.update(a,{...w,...y}):st(y.render,{...w,...y}),g},u=Vx(t)?t():t;return u.then(h=>l("success",r,h)).catch(h=>l("error",n,h)),u}st.promise=oL,st.success=Kd("success"),st.info=Kd("info"),st.error=Kd("error"),st.warning=Kd("warning"),st.warn=st.warning,st.dark=(t,e)=>ic(t,Vd("default",{theme:"dark",...e}));function iL(t){ZD(t)}st.dismiss=iL,st.clearWaitingQueue=eL,st.isActive=XD,st.update=(t,e={})=>{let n=QD(t,e);if(n){let{props:r,content:o}=n,a={delay:100,...r,...e,toastId:e.toastId||t,updateId:Kx()};a.toastId!==t&&(a.staleId=t);let s=a.render||o;delete a.render,ic(s,a)}},st.done=t=>{st.update(t,{progress:1})},st.onChange=nL,st.play=t=>Wx(!0,t),st.pause=t=>Wx(!1,t);const aL={category:"Thư mục gốc",fileName:"Tên tệp",fullPath:"Đường dẫn đầy đủ",createAt:"Ngày tạo",creator:"Người tạo",creatorId:"ID người tạo",DataSource:"Nguồn dữ liệu",SuggestedAICategories:"Danh mục AI gợi ý",KeywordAISuggestion:"Từ khóa AI gợi ý",SummaryOfSuggestedAI:"Tóm tắt AI gợi ý",AccessLevel:"Cấp độ truy cập"},sL=t=>t==="SummaryOfSuggestedAI"||t==="KeywordAISuggestion"||t==="SuggestedAICategories",fg=t=>t==="fullPath"||t==="createAt"||t==="creator"||t==="creatorId"||t==="DataSource"||t==="AccessLevel"||t==="category"||t==="fileName",cL={STARTING:"Đang bắt đầu",IN_PROGRESS:"Đang đồng bộ",COMPLETE:"Đồng bộ thành công",FAILED:"Đồng bộ thất bại",STOPPING:"Đang dừng",STOPPED:"Đã dừng"},lL=t=>cL[t]||t;function mi(t){const e=dL(t),n=C.forwardRef((r,o)=>{const{children:a,...s}=r,l=C.Children.toArray(a),u=l.find(fL);if(u){const h=u.props.children,p=l.map(g=>g===u?C.Children.count(h)>1?C.Children.only(null):C.isValidElement(h)?h.props.children:null:g);return d.jsx(e,{...s,ref:o,children:C.isValidElement(h)?C.cloneElement(h,void 0,p):null})}return d.jsx(e,{...s,ref:o,children:a})});return n.displayName=`${t}.Slot`,n}var qx=mi("Slot");function dL(t){const e=C.forwardRef((n,r)=>{const{children:o,...a}=n;if(C.isValidElement(o)){const s=pL(o),l=hL(a,o.props);return o.type!==C.Fragment&&(l.ref=r?FC(r,s):s),C.cloneElement(o,l)}return C.Children.count(o)>1?C.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var uL=Symbol("radix.slottable");function fL(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===uL}function hL(t,e){const n={...e};for(const r in e){const o=t[r],a=e[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...l)=>{const u=a(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...t,...n}}function pL(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}const hg="-",gL=t=>{const e=vL(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:s=>{const l=s.split(hg);return l[0]===""&&l.length!==1&&l.shift(),Yx(l,e)||mL(s)},getConflictingClassGroupIds:(s,l)=>{const u=n[s]||[];return l&&r[s]?[...u,...r[s]]:u}}},Yx=(t,e)=>{var s;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),o=r?Yx(t.slice(1),r):void 0;if(o)return o;if(e.validators.length===0)return;const a=t.join(hg);return(s=e.validators.find(({validator:l})=>l(a)))==null?void 0:s.classGroupId},Jx=/^\[(.+)\]$/,mL=t=>{if(Jx.test(t)){const e=Jx.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},vL=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return wL(Object.entries(t.classGroups),n).forEach(([a,s])=>{pg(s,r,a,e)}),r},pg=(t,e,n,r)=>{t.forEach(o=>{if(typeof o=="string"){const a=o===""?e:Qx(e,o);a.classGroupId=n;return}if(typeof o=="function"){if(yL(o)){pg(o(r),e,n,r);return}e.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([a,s])=>{pg(s,Qx(e,a),n,r)})})},Qx=(t,e)=>{let n=t;return e.split(hg).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},yL=t=>t.isThemeGetter,wL=(t,e)=>e?t.map(([n,r])=>{const o=r.map(a=>typeof a=="string"?e+a:typeof a=="object"?Object.fromEntries(Object.entries(a).map(([s,l])=>[e+s,l])):a);return[n,o]}):t,CL=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const o=(a,s)=>{n.set(a,s),e++,e>t&&(e=0,r=n,n=new Map)};return{get(a){let s=n.get(a);if(s!==void 0)return s;if((s=r.get(a))!==void 0)return o(a,s),s},set(a,s){n.has(a)?n.set(a,s):o(a,s)}}},Xx="!",bL=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,o=e[0],a=e.length,s=l=>{const u=[];let h=0,p=0,g;for(let b=0;b<l.length;b++){let E=l[b];if(h===0){if(E===o&&(r||l.slice(b,b+a)===e)){u.push(l.slice(p,b)),p=b+a;continue}if(E==="/"){g=b;continue}}E==="["?h++:E==="]"&&h--}const w=u.length===0?l:l.substring(p),y=w.startsWith(Xx),x=y?w.substring(1):w,v=g&&g>p?g-p:void 0;return{modifiers:u,hasImportantModifier:y,baseClassName:x,maybePostfixModifierPosition:v}};return n?l=>n({className:l,parseClassName:s}):s},xL=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},SL=t=>({cache:CL(t.cacheSize),parseClassName:bL(t),...gL(t)}),_L=/\s+/,EL=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=e,a=[],s=t.trim().split(_L);let l="";for(let u=s.length-1;u>=0;u-=1){const h=s[u],{modifiers:p,hasImportantModifier:g,baseClassName:w,maybePostfixModifierPosition:y}=n(h);let x=!!y,v=r(x?w.substring(0,y):w);if(!v){if(!x){l=h+(l.length>0?" "+l:l);continue}if(v=r(w),!v){l=h+(l.length>0?" "+l:l);continue}x=!1}const b=xL(p).join(":"),E=g?b+Xx:b,T=E+v;if(a.includes(T))continue;a.push(T);const N=o(v,x);for(let P=0;P<N.length;++P){const _=N[P];a.push(E+_)}l=h+(l.length>0?" "+l:l)}return l};function TL(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=Zx(e))&&(r&&(r+=" "),r+=n);return r}const Zx=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=Zx(t[r]))&&(n&&(n+=" "),n+=e);return n};function AL(t,...e){let n,r,o,a=s;function s(u){const h=e.reduce((p,g)=>g(p),t());return n=SL(h),r=n.cache.get,o=n.cache.set,a=l,l(u)}function l(u){const h=r(u);if(h)return h;const p=EL(u,n);return o(u,p),p}return function(){return a(TL.apply(null,arguments))}}const Ft=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},eS=/^\[(?:([a-z-]+):)?(.+)\]$/i,IL=/^\d+\/\d+$/,kL=new Set(["px","full","screen"]),NL=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,PL=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,OL=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,ML=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,RL=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,Fo=t=>Ja(t)||kL.has(t)||IL.test(t),vi=t=>Qa(t,"length",zL),Ja=t=>!!t&&!Number.isNaN(Number(t)),gg=t=>Qa(t,"number",Ja),ac=t=>!!t&&Number.isInteger(Number(t)),DL=t=>t.endsWith("%")&&Ja(t.slice(0,-1)),ot=t=>eS.test(t),yi=t=>NL.test(t),LL=new Set(["length","size","percentage"]),FL=t=>Qa(t,LL,tS),$L=t=>Qa(t,"position",tS),HL=new Set(["image","url"]),UL=t=>Qa(t,HL,KL),BL=t=>Qa(t,"",VL),sc=()=>!0,Qa=(t,e,n)=>{const r=eS.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},zL=t=>PL.test(t)&&!OL.test(t),tS=()=>!1,VL=t=>ML.test(t),KL=t=>RL.test(t),GL=AL(()=>{const t=Ft("colors"),e=Ft("spacing"),n=Ft("blur"),r=Ft("brightness"),o=Ft("borderColor"),a=Ft("borderRadius"),s=Ft("borderSpacing"),l=Ft("borderWidth"),u=Ft("contrast"),h=Ft("grayscale"),p=Ft("hueRotate"),g=Ft("invert"),w=Ft("gap"),y=Ft("gradientColorStops"),x=Ft("gradientColorStopPositions"),v=Ft("inset"),b=Ft("margin"),E=Ft("opacity"),T=Ft("padding"),N=Ft("saturate"),P=Ft("scale"),_=Ft("sepia"),D=Ft("skew"),H=Ft("space"),K=Ft("translate"),ee=()=>["auto","contain","none"],W=()=>["auto","hidden","clip","visible","scroll"],de=()=>["auto",ot,e],se=()=>[ot,e],fe=()=>["",Fo,vi],q=()=>["auto",Ja,ot],Z=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],Y=()=>["solid","dashed","dotted","double","none"],oe=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Q=()=>["start","end","center","between","around","evenly","stretch"],X=()=>["","0",ot],$=()=>["auto","avoid","all","avoid-page","page","left","right","column"],te=()=>[Ja,ot];return{cacheSize:500,separator:":",theme:{colors:[sc],spacing:[Fo,vi],blur:["none","",yi,ot],brightness:te(),borderColor:[t],borderRadius:["none","","full",yi,ot],borderSpacing:se(),borderWidth:fe(),contrast:te(),grayscale:X(),hueRotate:te(),invert:X(),gap:se(),gradientColorStops:[t],gradientColorStopPositions:[DL,vi],inset:de(),margin:de(),opacity:te(),padding:se(),saturate:te(),scale:te(),sepia:X(),skew:te(),space:se(),translate:se()},classGroups:{aspect:[{aspect:["auto","square","video",ot]}],container:["container"],columns:[{columns:[yi]}],"break-after":[{"break-after":$()}],"break-before":[{"break-before":$()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...Z(),ot]}],overflow:[{overflow:W()}],"overflow-x":[{"overflow-x":W()}],"overflow-y":[{"overflow-y":W()}],overscroll:[{overscroll:ee()}],"overscroll-x":[{"overscroll-x":ee()}],"overscroll-y":[{"overscroll-y":ee()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[v]}],"inset-x":[{"inset-x":[v]}],"inset-y":[{"inset-y":[v]}],start:[{start:[v]}],end:[{end:[v]}],top:[{top:[v]}],right:[{right:[v]}],bottom:[{bottom:[v]}],left:[{left:[v]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",ac,ot]}],basis:[{basis:de()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",ot]}],grow:[{grow:X()}],shrink:[{shrink:X()}],order:[{order:["first","last","none",ac,ot]}],"grid-cols":[{"grid-cols":[sc]}],"col-start-end":[{col:["auto",{span:["full",ac,ot]},ot]}],"col-start":[{"col-start":q()}],"col-end":[{"col-end":q()}],"grid-rows":[{"grid-rows":[sc]}],"row-start-end":[{row:["auto",{span:[ac,ot]},ot]}],"row-start":[{"row-start":q()}],"row-end":[{"row-end":q()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",ot]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",ot]}],gap:[{gap:[w]}],"gap-x":[{"gap-x":[w]}],"gap-y":[{"gap-y":[w]}],"justify-content":[{justify:["normal",...Q()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Q(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Q(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[T]}],px:[{px:[T]}],py:[{py:[T]}],ps:[{ps:[T]}],pe:[{pe:[T]}],pt:[{pt:[T]}],pr:[{pr:[T]}],pb:[{pb:[T]}],pl:[{pl:[T]}],m:[{m:[b]}],mx:[{mx:[b]}],my:[{my:[b]}],ms:[{ms:[b]}],me:[{me:[b]}],mt:[{mt:[b]}],mr:[{mr:[b]}],mb:[{mb:[b]}],ml:[{ml:[b]}],"space-x":[{"space-x":[H]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[H]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",ot,e]}],"min-w":[{"min-w":[ot,e,"min","max","fit"]}],"max-w":[{"max-w":[ot,e,"none","full","min","max","fit","prose",{screen:[yi]},yi]}],h:[{h:[ot,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[ot,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[ot,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[ot,e,"auto","min","max","fit"]}],"font-size":[{text:["base",yi,vi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",gg]}],"font-family":[{font:[sc]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",ot]}],"line-clamp":[{"line-clamp":["none",Ja,gg]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",Fo,ot]}],"list-image":[{"list-image":["none",ot]}],"list-style-type":[{list:["none","disc","decimal",ot]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[E]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[E]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...Y(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",Fo,vi]}],"underline-offset":[{"underline-offset":["auto",Fo,ot]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:se()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ot]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ot]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[E]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...Z(),$L]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",FL]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},UL]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[x]}],"gradient-via-pos":[{via:[x]}],"gradient-to-pos":[{to:[x]}],"gradient-from":[{from:[y]}],"gradient-via":[{via:[y]}],"gradient-to":[{to:[y]}],rounded:[{rounded:[a]}],"rounded-s":[{"rounded-s":[a]}],"rounded-e":[{"rounded-e":[a]}],"rounded-t":[{"rounded-t":[a]}],"rounded-r":[{"rounded-r":[a]}],"rounded-b":[{"rounded-b":[a]}],"rounded-l":[{"rounded-l":[a]}],"rounded-ss":[{"rounded-ss":[a]}],"rounded-se":[{"rounded-se":[a]}],"rounded-ee":[{"rounded-ee":[a]}],"rounded-es":[{"rounded-es":[a]}],"rounded-tl":[{"rounded-tl":[a]}],"rounded-tr":[{"rounded-tr":[a]}],"rounded-br":[{"rounded-br":[a]}],"rounded-bl":[{"rounded-bl":[a]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[E]}],"border-style":[{border:[...Y(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[E]}],"divide-style":[{divide:Y()}],"border-color":[{border:[o]}],"border-color-x":[{"border-x":[o]}],"border-color-y":[{"border-y":[o]}],"border-color-s":[{"border-s":[o]}],"border-color-e":[{"border-e":[o]}],"border-color-t":[{"border-t":[o]}],"border-color-r":[{"border-r":[o]}],"border-color-b":[{"border-b":[o]}],"border-color-l":[{"border-l":[o]}],"divide-color":[{divide:[o]}],"outline-style":[{outline:["",...Y()]}],"outline-offset":[{"outline-offset":[Fo,ot]}],"outline-w":[{outline:[Fo,vi]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:fe()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[E]}],"ring-offset-w":[{"ring-offset":[Fo,vi]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",yi,BL]}],"shadow-color":[{shadow:[sc]}],opacity:[{opacity:[E]}],"mix-blend":[{"mix-blend":[...oe(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":oe()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",yi,ot]}],grayscale:[{grayscale:[h]}],"hue-rotate":[{"hue-rotate":[p]}],invert:[{invert:[g]}],saturate:[{saturate:[N]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[h]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[p]}],"backdrop-invert":[{"backdrop-invert":[g]}],"backdrop-opacity":[{"backdrop-opacity":[E]}],"backdrop-saturate":[{"backdrop-saturate":[N]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",ot]}],duration:[{duration:te()}],ease:[{ease:["linear","in","out","in-out",ot]}],delay:[{delay:te()}],animate:[{animate:["none","spin","ping","pulse","bounce",ot]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[P]}],"scale-x":[{"scale-x":[P]}],"scale-y":[{"scale-y":[P]}],rotate:[{rotate:[ac,ot]}],"translate-x":[{"translate-x":[K]}],"translate-y":[{"translate-y":[K]}],"skew-x":[{"skew-x":[D]}],"skew-y":[{"skew-y":[D]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",ot]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",ot]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":se()}],"scroll-mx":[{"scroll-mx":se()}],"scroll-my":[{"scroll-my":se()}],"scroll-ms":[{"scroll-ms":se()}],"scroll-me":[{"scroll-me":se()}],"scroll-mt":[{"scroll-mt":se()}],"scroll-mr":[{"scroll-mr":se()}],"scroll-mb":[{"scroll-mb":se()}],"scroll-ml":[{"scroll-ml":se()}],"scroll-p":[{"scroll-p":se()}],"scroll-px":[{"scroll-px":se()}],"scroll-py":[{"scroll-py":se()}],"scroll-ps":[{"scroll-ps":se()}],"scroll-pe":[{"scroll-pe":se()}],"scroll-pt":[{"scroll-pt":se()}],"scroll-pr":[{"scroll-pr":se()}],"scroll-pb":[{"scroll-pb":se()}],"scroll-pl":[{"scroll-pl":se()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",ot]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[Fo,vi,gg]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}});function ze(...t){return GL(zx(t))}function qi(){let t=localStorage.getItem("dataLogin"),e;try{t&&(t=JSON.parse(t),e=t.user)}catch(n){console.error("Error parsing dataLogin from localStorage:",n),t=null}return e}const Gd=C.forwardRef(({className:t,...e},n)=>d.jsx("nav",{ref:n,"aria-label":"breadcrumb",className:ze("s3-explr-ui-breadcrumb",t),...e}));Gd.displayName="Breadcrumb";const jd=C.forwardRef(({className:t,...e},n)=>d.jsx("ol",{ref:n,className:ze("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5","s3-explr-ui-breadcrumb-list",t),...e}));jd.displayName="BreadcrumbList";const cc=C.forwardRef(({className:t,...e},n)=>d.jsx("li",{ref:n,className:ze("inline-flex items-center gap-1.5","s3-explr-ui-breadcrumb-item",t),...e}));cc.displayName="BreadcrumbItem";const lc=C.forwardRef(({asChild:t,className:e,...n},r)=>{const o=t?qx:"a";return d.jsx(o,{ref:r,className:ze("transition-colors hover:text-foreground","s3-explr-ui-breadcrumb-link",e),...n})});lc.displayName="BreadcrumbLink";const jL=C.forwardRef(({className:t,...e},n)=>d.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:ze("font-normal text-foreground","s3-explr-ui-breadcrumb-page",t),...e}));jL.displayName="BreadcrumbPage";const Wd=({children:t,className:e,...n})=>d.jsx("li",{role:"presentation","aria-hidden":"true",className:ze("[&>svg]:w-3.5 [&>svg]:h-3.5","s3-explr-ui-breadcrumb-separator",e),...n,children:t??d.jsx(Hx,{})});Wd.displayName="BreadcrumbSeparator";const nS=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,rS=zx,mg=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return rS(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:a}=e,s=Object.keys(o).map(h=>{const p=n==null?void 0:n[h],g=a==null?void 0:a[h];if(p===null)return null;const w=nS(p)||nS(g);return o[h][w]}),l=n&&Object.entries(n).reduce((h,p)=>{let[g,w]=p;return w===void 0||(h[g]=w),h},{}),u=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((h,p)=>{let{class:g,className:w,...y}=p;return Object.entries(y).every(x=>{let[v,b]=x;return Array.isArray(b)?b.includes({...a,...l}[v]):{...a,...l}[v]===b})?[...h,g,w]:h},[]);return rS(t,s,u,n==null?void 0:n.class,n==null?void 0:n.className)},oS=mg("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 s3-explr-ui-button",{variants:{variant:{default:"bg-primary text-primary-foreground shadow hover:bg-primary/90 s3-explr-ui-button-default",destructive:"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90 s3-explr-ui-button-destructive",outline:"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground s3-explr-ui-button-outline",secondary:"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80 s3-explr-ui-button-secondary",ghost:"hover:bg-accent hover:text-accent-foreground s3-explr-ui-button-ghost",link:"text-primary underline-offset-4 hover:underline s3-explr-ui-button-link"},size:{default:"h-9 px-4 py-2 s3-explr-ui-button-size-default",sm:"h-8 rounded-md px-3 text-xs s3-explr-ui-button-size-sm",lg:"h-10 rounded-md px-8 s3-explr-ui-button-size-lg",icon:"h-9 w-9 s3-explr-ui-button-size-icon"}},defaultVariants:{variant:"default",size:"default"}}),He=C.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...o},a)=>{const s=r?qx:"button";return d.jsx(s,{className:ze(oS({variant:e,size:n,className:t})),ref:a,...o})});He.displayName="Button";function iS(t){const e=C.useRef({value:t,previous:t});return C.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}function vg(t){const[e,n]=C.useState(void 0);return tn(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const a=o[0];let s,l;if("borderBoxSize"in a){const u=a.borderBoxSize,h=Array.isArray(u)?u[0]:u;s=h.inlineSize,l=h.blockSize}else s=t.offsetWidth,l=t.offsetHeight;n({width:s,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var qd="Checkbox",[WL,$j]=gr(qd),[qL,yg]=WL(qd);function YL(t){const{__scopeCheckbox:e,checked:n,children:r,defaultChecked:o,disabled:a,form:s,name:l,onCheckedChange:u,required:h,value:p="on",internal_do_not_use_render:g}=t,[w,y]=ui({prop:n,defaultProp:o??!1,onChange:u,caller:qd}),[x,v]=C.useState(null),[b,E]=C.useState(null),T=C.useRef(!1),N=x?!!s||!!x.closest("form"):!0,P={checked:w,disabled:a,setChecked:y,control:x,setControl:v,name:l,form:s,value:p,hasConsumerStoppedPropagationRef:T,required:h,defaultChecked:wi(o)?!1:o,isFormControl:N,bubbleInput:b,setBubbleInput:E};return d.jsx(qL,{scope:e,...P,children:JL(g)?g(P):r})}var aS="CheckboxTrigger",sS=C.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...r},o)=>{const{control:a,value:s,disabled:l,checked:u,required:h,setControl:p,setChecked:g,hasConsumerStoppedPropagationRef:w,isFormControl:y,bubbleInput:x}=yg(aS,t),v=rt(o,p),b=C.useRef(u);return C.useEffect(()=>{const E=a==null?void 0:a.form;if(E){const T=()=>g(b.current);return E.addEventListener("reset",T),()=>E.removeEventListener("reset",T)}},[a,g]),d.jsx(mt.button,{type:"button",role:"checkbox","aria-checked":wi(u)?"mixed":u,"aria-required":h,"data-state":fS(u),"data-disabled":l?"":void 0,disabled:l,value:s,...r,ref:v,onKeyDown:Ue(e,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:Ue(n,E=>{g(T=>wi(T)?!0:!T),x&&y&&(w.current=E.isPropagationStopped(),w.current||E.stopPropagation())})})});sS.displayName=aS;var wg=C.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:a,required:s,disabled:l,value:u,onCheckedChange:h,form:p,...g}=t;return d.jsx(YL,{__scopeCheckbox:n,checked:o,defaultChecked:a,disabled:l,required:s,onCheckedChange:h,name:r,form:p,value:u,internal_do_not_use_render:({isFormControl:w})=>d.jsxs(d.Fragment,{children:[d.jsx(sS,{...g,ref:e,__scopeCheckbox:n}),w&&d.jsx(uS,{__scopeCheckbox:n})]})})});wg.displayName=qd;var cS="CheckboxIndicator",lS=C.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...o}=t,a=yg(cS,n);return d.jsx(Ro,{present:r||wi(a.checked)||a.checked===!0,children:d.jsx(mt.span,{"data-state":fS(a.checked),"data-disabled":a.disabled?"":void 0,...o,ref:e,style:{pointerEvents:"none",...t.style}})})});lS.displayName=cS;var dS="CheckboxBubbleInput",uS=C.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:r,hasConsumerStoppedPropagationRef:o,checked:a,defaultChecked:s,required:l,disabled:u,name:h,value:p,form:g,bubbleInput:w,setBubbleInput:y}=yg(dS,t),x=rt(n,y),v=iS(a),b=vg(r);C.useEffect(()=>{const T=w;if(!T)return;const N=window.HTMLInputElement.prototype,_=Object.getOwnPropertyDescriptor(N,"checked").set,D=!o.current;if(v!==a&&_){const H=new Event("click",{bubbles:D});T.indeterminate=wi(a),_.call(T,wi(a)?!1:a),T.dispatchEvent(H)}},[w,v,a,o]);const E=C.useRef(wi(a)?!1:a);return d.jsx(mt.input,{type:"checkbox","aria-hidden":!0,defaultChecked:s??E.current,required:l,disabled:u,name:h,value:p,form:g,...e,tabIndex:-1,ref:x,style:{...e.style,...b,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});uS.displayName=dS;function JL(t){return typeof t=="function"}function wi(t){return t==="indeterminate"}function fS(t){return wi(t)?"indeterminate":t?"checked":"unchecked"}const dc=C.forwardRef(({className:t,...e},n)=>d.jsx(wg,{ref:n,className:ze("s3-explr-ui-checkbox peer h-4 w-4 shrink-0 rounded-sm border border-primary shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",t),...e,children:d.jsx(lS,{className:ze("s3-explr-ui-checkbox-indicator flex items-center justify-center text-current"),children:d.jsx($x,{className:"s3-explr-ui-checkbox-check h-4 w-4"})})}));dc.displayName=wg.displayName;const ar=Qs,uc=lM,QL=dM,hS=C.forwardRef(({className:t,...e},n)=>d.jsx(ja,{ref:n,className:ze("s3-explr-ui-dialog-overlay fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));hS.displayName=ja.displayName;const zn=C.forwardRef(({className:t,children:e,...n},r)=>d.jsxs(QL,{children:[d.jsx(hS,{}),d.jsxs(Wa,{ref:r,className:ze("s3-explr-ui-dialog-content fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,d.jsxs(kp,{className:ze("s3-explr-ui-dialog-close absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"),children:[d.jsx(lg,{className:"s3-explr-ui-dialog-close-icon h-4 w-4"}),d.jsx("span",{className:"s3-explr-ui-dialog-close-text sr-only",children:"Close"})]})]})]}));zn.displayName=Wa.displayName;const Vn=({className:t,...e})=>d.jsx("div",{className:ze("s3-explr-ui-dialog-header flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Vn.displayName="DialogHeader";const Fr=({className:t,...e})=>d.jsx("div",{className:ze("s3-explr-ui-dialog-footer flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Fr.displayName="DialogFooter";const Kn=C.forwardRef(({className:t,...e},n)=>d.jsx(Pb,{ref:n,className:ze("s3-explr-ui-dialog-title text-lg font-semibold leading-none tracking-tight",t),...e}));Kn.displayName=Pb.displayName;const Ci=C.forwardRef(({className:t,...e},n)=>d.jsx(Ob,{ref:n,className:ze("s3-explr-ui-dialog-description text-sm text-muted-foreground",t),...e}));Ci.displayName=Ob.displayName;const Gn=C.forwardRef(({className:t,type:e,...n},r)=>d.jsx("input",{type:e,className:ze("s3-explr-ui-input","flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-base shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Gn.displayName="Input";var XL="Label",pS=C.forwardRef((t,e)=>d.jsx(mt.label,{...t,ref:e,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=t.onMouseDown)==null||o.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));pS.displayName=XL;var gS=pS;const ZL=mg("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 s3-explr-ui-label",{variants:{variant:{default:"s3-explr-ui-label-default",required:"s3-explr-ui-label-required",disabled:"s3-explr-ui-label-disabled"},size:{default:"s3-explr-ui-label-size-default",sm:"s3-explr-ui-label-size-sm",lg:"s3-explr-ui-label-size-lg"}},defaultVariants:{variant:"default",size:"default"}}),mr=C.forwardRef(({className:t,variant:e,size:n,...r},o)=>d.jsx(gS,{ref:o,className:ze(ZL({variant:e,size:n}),t),...r}));mr.displayName=gS.displayName;const Yd=({className:t,...e})=>d.jsx("nav",{role:"navigation","aria-label":"pagination",className:ze("mx-auto flex w-full justify-center",t),...e});Yd.displayName="Pagination";const Jd=C.forwardRef(({className:t,...e},n)=>d.jsx("ul",{ref:n,className:ze("flex flex-row items-center gap-1",t),...e}));Jd.displayName="PaginationContent";const $r=C.forwardRef(({className:t,...e},n)=>d.jsx("li",{ref:n,className:ze("",t),...e}));$r.displayName="PaginationItem";const Xa=({className:t,isActive:e,size:n="icon",...r})=>d.jsx("a",{"aria-current":e?"page":void 0,className:ze(oS({variant:e?"outline":"ghost",size:n}),t),...r});Xa.displayName="PaginationLink";const Qd=({className:t,...e})=>d.jsxs(Xa,{"aria-label":"Go to previous page",size:"default",className:ze("gap-1 pl-2.5",t),...e,children:[d.jsx(BD,{className:"h-4 w-4"}),d.jsx("span",{children:"Previous"})]});Qd.displayName="PaginationPrevious";const Xd=({className:t,...e})=>d.jsxs(Xa,{"aria-label":"Go to next page",size:"default",className:ze("gap-1 pr-2.5",t),...e,children:[d.jsx("span",{children:"Next"}),d.jsx(Hx,{className:"h-4 w-4"})]});Xd.displayName="PaginationNext";const Zd=({className:t,...e})=>d.jsxs("span",{"aria-hidden":!0,className:ze("flex h-9 w-9 items-center justify-center",t),...e,children:[d.jsx(zD,{className:"h-4 w-4"}),d.jsx("span",{className:"sr-only",children:"More pages"})]});Zd.displayName="PaginationEllipsis";const eu=C.forwardRef(({className:t,...e},n)=>d.jsx("div",{className:ze("relative w-full overflow-auto","s3-explr-ui-table-container"),children:d.jsx("table",{ref:n,className:ze("w-full caption-bottom text-sm","s3-explr-ui-table",t),...e})}));eu.displayName="Table";const tu=C.forwardRef(({className:t,...e},n)=>d.jsx("thead",{ref:n,className:ze("[&_tr]:border-b","s3-explr-ui-table-header",t),...e}));tu.displayName="TableHeader";const nu=C.forwardRef(({className:t,...e},n)=>d.jsx("tbody",{ref:n,className:ze("[&_tr:last-child]:border-0","s3-explr-ui-table-body",t),...e}));nu.displayName="TableBody";const eF=C.forwardRef(({className:t,...e},n)=>d.jsx("tfoot",{ref:n,className:ze("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0","s3-explr-ui-table-footer",t),...e}));eF.displayName="TableFooter";const Hr=C.forwardRef(({className:t,...e},n)=>d.jsx("tr",{ref:n,className:ze("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted","s3-explr-ui-table-row",t),...e}));Hr.displayName="TableRow";const po=C.forwardRef(({className:t,...e},n)=>d.jsx("th",{ref:n,className:ze("h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]","s3-explr-ui-table-head",t),...e}));po.displayName="TableHead";const jn=C.forwardRef(({className:t,...e},n)=>d.jsx("td",{ref:n,className:ze("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]","s3-explr-ui-table-cell",t),...e}));jn.displayName="TableCell";const tF=C.forwardRef(({className:t,...e},n)=>d.jsx("caption",{ref:n,className:ze("mt-4 text-sm text-muted-foreground","s3-explr-ui-table-caption",t),...e}));tF.displayName="TableCaption";function mS(t){const e=nF(t),n=C.forwardRef((r,o)=>{const{children:a,...s}=r,l=C.Children.toArray(a),u=l.find(oF);if(u){const h=u.props.children,p=l.map(g=>g===u?C.Children.count(h)>1?C.Children.only(null):C.isValidElement(h)?h.props.children:null:g);return d.jsx(e,{...s,ref:o,children:C.isValidElement(h)?C.cloneElement(h,void 0,p):null})}return d.jsx(e,{...s,ref:o,children:a})});return n.displayName=`${t}.Slot`,n}function nF(t){const e=C.forwardRef((n,r)=>{const{children:o,...a}=n,s=C.isValidElement(o)?aF(o):void 0,l=rt(s,r);if(C.isValidElement(o)){const u=iF(a,o.props);return o.type!==C.Fragment&&(u.ref=l),C.cloneElement(o,u)}return C.Children.count(o)>1?C.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var rF=Symbol("radix.slottable");function oF(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===rF}function iF(t,e){const n={...e};for(const r in e){const o=t[r],a=e[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...l)=>{const u=a(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...t,...n}}function aF(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function sF(t){const e=t+"CollectionProvider",[n,r]=gr(e),[o,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:b,children:E}=v,T=M.useRef(null),N=M.useRef(new Map).current;return d.jsx(o,{scope:b,itemMap:N,collectionRef:T,children:E})};s.displayName=e;const l=t+"CollectionSlot",u=mS(l),h=M.forwardRef((v,b)=>{const{scope:E,children:T}=v,N=a(l,E),P=rt(b,N.collectionRef);return d.jsx(u,{ref:P,children:T})});h.displayName=l;const p=t+"CollectionItemSlot",g="data-radix-collection-item",w=mS(p),y=M.forwardRef((v,b)=>{const{scope:E,children:T,...N}=v,P=M.useRef(null),_=rt(b,P),D=a(p,E);return M.useEffect(()=>(D.itemMap.set(P,{ref:P,...N}),()=>void D.itemMap.delete(P))),d.jsx(w,{[g]:"",ref:_,children:T})});y.displayName=p;function x(v){const b=a(t+"CollectionConsumer",v);return M.useCallback(()=>{const T=b.collectionRef.current;if(!T)return[];const N=Array.from(T.querySelectorAll(`[${g}]`));return Array.from(b.itemMap.values()).sort((D,H)=>N.indexOf(D.ref.current)-N.indexOf(H.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:s,Slot:h,ItemSlot:y},x,r]}var cF=C.createContext(void 0);function Cg(t){const e=C.useContext(cF);return t||e||"ltr"}var bg="rovingFocusGroup.onEntryFocus",lF={bubbles:!1,cancelable:!0},fc="RovingFocusGroup",[xg,vS,dF]=sF(fc),[uF,yS]=gr(fc,[dF]),[fF,hF]=uF(fc),wS=C.forwardRef((t,e)=>d.jsx(xg.Provider,{scope:t.__scopeRovingFocusGroup,children:d.jsx(xg.Slot,{scope:t.__scopeRovingFocusGroup,children:d.jsx(pF,{...t,ref:e})})}));wS.displayName=fc;var pF=C.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:a,currentTabStopId:s,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:u,onEntryFocus:h,preventScrollOnEntryFocus:p=!1,...g}=t,w=C.useRef(null),y=rt(e,w),x=Cg(a),[v,b]=ui({prop:s,defaultProp:l??null,onChange:u,caller:fc}),[E,T]=C.useState(!1),N=gn(h),P=vS(n),_=C.useRef(!1),[D,H]=C.useState(0);return C.useEffect(()=>{const K=w.current;if(K)return K.addEventListener(bg,N),()=>K.removeEventListener(bg,N)},[N]),d.jsx(fF,{scope:n,orientation:r,dir:x,loop:o,currentTabStopId:v,onItemFocus:C.useCallback(K=>b(K),[b]),onItemShiftTab:C.useCallback(()=>T(!0),[]),onFocusableItemAdd:C.useCallback(()=>H(K=>K+1),[]),onFocusableItemRemove:C.useCallback(()=>H(K=>K-1),[]),children:d.jsx(mt.div,{tabIndex:E||D===0?-1:0,"data-orientation":r,...g,ref:y,style:{outline:"none",...t.style},onMouseDown:Ue(t.onMouseDown,()=>{_.current=!0}),onFocus:Ue(t.onFocus,K=>{const ee=!_.current;if(K.target===K.currentTarget&&ee&&!E){const W=new CustomEvent(bg,lF);if(K.currentTarget.dispatchEvent(W),!W.defaultPrevented){const de=P().filter(Y=>Y.focusable),se=de.find(Y=>Y.active),fe=de.find(Y=>Y.id===v),Z=[se,fe,...de].filter(Boolean).map(Y=>Y.ref.current);xS(Z,p)}}_.current=!1}),onBlur:Ue(t.onBlur,()=>T(!1))})})}),CS="RovingFocusGroupItem",bS=C.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:a,children:s,...l}=t,u=Mo(),h=a||u,p=hF(CS,n),g=p.currentTabStopId===h,w=vS(n),{onFocusableItemAdd:y,onFocusableItemRemove:x,currentTabStopId:v}=p;return C.useEffect(()=>{if(r)return y(),()=>x()},[r,y,x]),d.jsx(xg.ItemSlot,{scope:n,id:h,focusable:r,active:o,children:d.jsx(mt.span,{tabIndex:g?0:-1,"data-orientation":p.orientation,...l,ref:e,onMouseDown:Ue(t.onMouseDown,b=>{r?p.onItemFocus(h):b.preventDefault()}),onFocus:Ue(t.onFocus,()=>p.onItemFocus(h)),onKeyDown:Ue(t.onKeyDown,b=>{if(b.key==="Tab"&&b.shiftKey){p.onItemShiftTab();return}if(b.target!==b.currentTarget)return;const E=vF(b,p.orientation,p.dir);if(E!==void 0){if(b.metaKey||b.ctrlKey||b.altKey||b.shiftKey)return;b.preventDefault();let N=w().filter(P=>P.focusable).map(P=>P.ref.current);if(E==="last")N.reverse();else if(E==="prev"||E==="next"){E==="prev"&&N.reverse();const P=N.indexOf(b.currentTarget);N=p.loop?yF(N,P+1):N.slice(P+1)}setTimeout(()=>xS(N))}}),children:typeof s=="function"?s({isCurrentTabStop:g,hasTabStop:v!=null}):s})})});bS.displayName=CS;var gF={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function mF(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function vF(t,e,n){const r=mF(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return gF[r]}function xS(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function yF(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var wF=wS,CF=bS,ru="Tabs",[bF,Hj]=gr(ru,[yS]),SS=yS(),[xF,Sg]=bF(ru),_S=C.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:a,orientation:s="horizontal",dir:l,activationMode:u="automatic",...h}=t,p=Cg(l),[g,w]=ui({prop:r,onChange:o,defaultProp:a??"",caller:ru});return d.jsx(xF,{scope:n,baseId:Mo(),value:g,onValueChange:w,orientation:s,dir:p,activationMode:u,children:d.jsx(mt.div,{dir:p,"data-orientation":s,...h,ref:e})})});_S.displayName=ru;var ES="TabsList",TS=C.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...o}=t,a=Sg(ES,n),s=SS(n);return d.jsx(wF,{asChild:!0,...s,orientation:a.orientation,dir:a.dir,loop:r,children:d.jsx(mt.div,{role:"tablist","aria-orientation":a.orientation,...o,ref:e})})});TS.displayName=ES;var AS="TabsTrigger",IS=C.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...a}=t,s=Sg(AS,n),l=SS(n),u=PS(s.baseId,r),h=OS(s.baseId,r),p=r===s.value;return d.jsx(CF,{asChild:!0,...l,focusable:!o,active:p,children:d.jsx(mt.button,{type:"button",role:"tab","aria-selected":p,"aria-controls":h,"data-state":p?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...a,ref:e,onMouseDown:Ue(t.onMouseDown,g=>{!o&&g.button===0&&g.ctrlKey===!1?s.onValueChange(r):g.preventDefault()}),onKeyDown:Ue(t.onKeyDown,g=>{[" ","Enter"].includes(g.key)&&s.onValueChange(r)}),onFocus:Ue(t.onFocus,()=>{const g=s.activationMode!=="manual";!p&&!o&&g&&s.onValueChange(r)})})})});IS.displayName=AS;var kS="TabsContent",NS=C.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:o,children:a,...s}=t,l=Sg(kS,n),u=PS(l.baseId,r),h=OS(l.baseId,r),p=r===l.value,g=C.useRef(p);return C.useEffect(()=>{const w=requestAnimationFrame(()=>g.current=!1);return()=>cancelAnimationFrame(w)},[]),d.jsx(Ro,{present:o||p,children:({present:w})=>d.jsx(mt.div,{"data-state":p?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":u,hidden:!w,id:h,tabIndex:0,...s,ref:e,style:{...t.style,animationDuration:g.current?"0s":void 0},children:w&&a})})});NS.displayName=kS;function PS(t,e){return`${t}-trigger-${e}`}function OS(t,e){return`${t}-content-${e}`}var SF=_S,MS=TS,RS=IS,DS=NS;const _g=SF,ou=C.forwardRef(({className:t,...e},n)=>d.jsx(MS,{ref:n,className:ze("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",t),...e}));ou.displayName=MS.displayName;const Yi=C.forwardRef(({className:t,...e},n)=>d.jsx(RS,{ref:n,className:ze("inline-flex items-center justify-center whitespace-nowrap rounded-md px-3 py-1 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow",t),...e}));Yi.displayName=RS.displayName;const Ji=C.forwardRef(({className:t,...e},n)=>d.jsx(DS,{ref:n,className:ze("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));Ji.displayName=DS.displayName;const hc=C.forwardRef(({className:t,...e},n)=>d.jsx("textarea",{className:ze("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-base shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:n,...e}));hc.displayName="Textarea";function LS(t){const e=_F(t),n=C.forwardRef((r,o)=>{const{children:a,...s}=r,l=C.Children.toArray(a),u=l.find(TF);if(u){const h=u.props.children,p=l.map(g=>g===u?C.Children.count(h)>1?C.Children.only(null):C.isValidElement(h)?h.props.children:null:g);return d.jsx(e,{...s,ref:o,children:C.isValidElement(h)?C.cloneElement(h,void 0,p):null})}return d.jsx(e,{...s,ref:o,children:a})});return n.displayName=`${t}.Slot`,n}function _F(t){const e=C.forwardRef((n,r)=>{const{children:o,...a}=n,s=C.isValidElement(o)?IF(o):void 0,l=rt(s,r);if(C.isValidElement(o)){const u=AF(a,o.props);return o.type!==C.Fragment&&(u.ref=l),C.cloneElement(o,u)}return C.Children.count(o)>1?C.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var EF=Symbol("radix.slottable");function TF(t){return C.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===EF}function AF(t,e){const n={...e};for(const r in e){const o=t[r],a=e[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...l)=>{const u=a(...l);return o(...l),u}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...t,...n}}function IF(t){var r,o;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(o=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:o.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function kF(t){const e=t+"CollectionProvider",[n,r]=gr(e),[o,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:b,children:E}=v,T=M.useRef(null),N=M.useRef(new Map).current;return d.jsx(o,{scope:b,itemMap:N,collectionRef:T,children:E})};s.displayName=e;const l=t+"CollectionSlot",u=LS(l),h=M.forwardRef((v,b)=>{const{scope:E,children:T}=v,N=a(l,E),P=rt(b,N.collectionRef);return d.jsx(u,{ref:P,children:T})});h.displayName=l;const p=t+"CollectionItemSlot",g="data-radix-collection-item",w=LS(p),y=M.forwardRef((v,b)=>{const{scope:E,children:T,...N}=v,P=M.useRef(null),_=rt(b,P),D=a(p,E);return M.useEffect(()=>(D.itemMap.set(P,{ref:P,...N}),()=>void D.itemMap.delete(P))),d.jsx(w,{[g]:"",ref:_,children:T})});y.displayName=p;function x(v){const b=a(t+"CollectionConsumer",v);return M.useCallback(()=>{const T=b.collectionRef.current;if(!T)return[];const N=Array.from(T.querySelectorAll(`[${g}]`));return Array.from(b.itemMap.values()).sort((D,H)=>N.indexOf(D.ref.current)-N.indexOf(H.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:s,Slot:h,ItemSlot:y},x,r]}var NF=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"}),PF="VisuallyHidden",Eg=C.forwardRef((t,e)=>d.jsx(mt.span,{...t,ref:e,style:{...NF,...t.style}}));Eg.displayName=PF;var Tg="ToastProvider",[Ag,OF,MF]=kF("Toast"),[FS,Uj]=gr("Toast",[MF]),[RF,iu]=FS(Tg),$S=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:a=50,children:s}=t,[l,u]=C.useState(null),[h,p]=C.useState(0),g=C.useRef(!1),w=C.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Tg}\`. Expected non-empty \`string\`.`),d.jsx(Ag.Provider,{scope:e,children:d.jsx(RF,{scope:e,label:n,duration:r,swipeDirection:o,swipeThreshold:a,toastCount:h,viewport:l,onViewportChange:u,onToastAdd:C.useCallback(()=>p(y=>y+1),[]),onToastRemove:C.useCallback(()=>p(y=>y-1),[]),isFocusedToastEscapeKeyDownRef:g,isClosePausedRef:w,children:s})})};$S.displayName=Tg;var HS="ToastViewport",DF=["F8"],Ig="toast.viewportPause",kg="toast.viewportResume",US=C.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=DF,label:o="Notifications ({hotkey})",...a}=t,s=iu(HS,n),l=OF(n),u=C.useRef(null),h=C.useRef(null),p=C.useRef(null),g=C.useRef(null),w=rt(e,g,s.onViewportChange),y=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),x=s.toastCount>0;C.useEffect(()=>{const b=E=>{var N;r.length!==0&&r.every(P=>E[P]||E.code===P)&&((N=g.current)==null||N.focus())};return document.addEventListener("keydown",b),()=>document.removeEventListener("keydown",b)},[r]),C.useEffect(()=>{const b=u.current,E=g.current;if(x&&b&&E){const T=()=>{if(!s.isClosePausedRef.current){const D=new CustomEvent(Ig);E.dispatchEvent(D),s.isClosePausedRef.current=!0}},N=()=>{if(s.isClosePausedRef.current){const D=new CustomEvent(kg);E.dispatchEvent(D),s.isClosePausedRef.current=!1}},P=D=>{!b.contains(D.relatedTarget)&&N()},_=()=>{b.contains(document.activeElement)||N()};return b.addEventListener("focusin",T),b.addEventListener("focusout",P),b.addEventListener("pointermove",T),b.addEventListener("pointerleave",_),window.addEventListener("blur",T),window.addEventListener("focus",N),()=>{b.removeEventListener("focusin",T),b.removeEventListener("focusout",P),b.removeEventListener("pointermove",T),b.removeEventListener("pointerleave",_),window.removeEventListener("blur",T),window.removeEventListener("focus",N)}}},[x,s.isClosePausedRef]);const v=C.useCallback(({tabbingDirection:b})=>{const T=l().map(N=>{const P=N.ref.current,_=[P,...qF(P)];return b==="forwards"?_:_.reverse()});return(b==="forwards"?T.reverse():T).flat()},[l]);return C.useEffect(()=>{const b=g.current;if(b){const E=T=>{var _,D,H;const N=T.altKey||T.ctrlKey||T.metaKey;if(T.key==="Tab"&&!N){const K=document.activeElement,ee=T.shiftKey;if(T.target===b&&ee){(_=h.current)==null||_.focus();return}const se=v({tabbingDirection:ee?"backwards":"forwards"}),fe=se.findIndex(q=>q===K);Og(se.slice(fe+1))?T.preventDefault():ee?(D=h.current)==null||D.focus():(H=p.current)==null||H.focus()}};return b.addEventListener("keydown",E),()=>b.removeEventListener("keydown",E)}},[l,v]),d.jsxs(XO,{ref:u,role:"region","aria-label":o.replace("{hotkey}",y),tabIndex:-1,style:{pointerEvents:x?void 0:"none"},children:[x&&d.jsx(Ng,{ref:h,onFocusFromOutsideViewport:()=>{const b=v({tabbingDirection:"forwards"});Og(b)}}),d.jsx(Ag.Slot,{scope:n,children:d.jsx(mt.ol,{tabIndex:-1,...a,ref:w})}),x&&d.jsx(Ng,{ref:p,onFocusFromOutsideViewport:()=>{const b=v({tabbingDirection:"backwards"});Og(b)}})]})});US.displayName=HS;var BS="ToastFocusProxy",Ng=C.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=t,a=iu(BS,n);return d.jsx(Eg,{"aria-hidden":!0,tabIndex:0,...o,ref:e,style:{position:"fixed"},onFocus:s=>{var h;const l=s.relatedTarget;!((h=a.viewport)!=null&&h.contains(l))&&r()}})});Ng.displayName=BS;var pc="Toast",LF="toast.swipeStart",FF="toast.swipeMove",$F="toast.swipeCancel",HF="toast.swipeEnd",zS=C.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:a,...s}=t,[l,u]=ui({prop:r,defaultProp:o??!0,onChange:a,caller:pc});return d.jsx(Ro,{present:n||l,children:d.jsx(zF,{open:l,...s,ref:e,onClose:()=>u(!1),onPause:gn(t.onPause),onResume:gn(t.onResume),onSwipeStart:Ue(t.onSwipeStart,h=>{h.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Ue(t.onSwipeMove,h=>{const{x:p,y:g}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","move"),h.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${p}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${g}px`)}),onSwipeCancel:Ue(t.onSwipeCancel,h=>{h.currentTarget.setAttribute("data-swipe","cancel"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Ue(t.onSwipeEnd,h=>{const{x:p,y:g}=h.detail.delta;h.currentTarget.setAttribute("data-swipe","end"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),h.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),h.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${p}px`),h.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${g}px`),u(!1)})})})});zS.displayName=pc;var[UF,BF]=FS(pc,{onClose(){}}),zF=C.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:a,onClose:s,onEscapeKeyDown:l,onPause:u,onResume:h,onSwipeStart:p,onSwipeMove:g,onSwipeCancel:w,onSwipeEnd:y,...x}=t,v=iu(pc,n),[b,E]=C.useState(null),T=rt(e,q=>E(q)),N=C.useRef(null),P=C.useRef(null),_=o||v.duration,D=C.useRef(0),H=C.useRef(_),K=C.useRef(0),{onToastAdd:ee,onToastRemove:W}=v,de=gn(()=>{var Z;(b==null?void 0:b.contains(document.activeElement))&&((Z=v.viewport)==null||Z.focus()),s()}),se=C.useCallback(q=>{!q||q===1/0||(window.clearTimeout(K.current),D.current=new Date().getTime(),K.current=window.setTimeout(de,q))},[de]);C.useEffect(()=>{const q=v.viewport;if(q){const Z=()=>{se(H.current),h==null||h()},Y=()=>{const oe=new Date().getTime()-D.current;H.current=H.current-oe,window.clearTimeout(K.current),u==null||u()};return q.addEventListener(Ig,Y),q.addEventListener(kg,Z),()=>{q.removeEventListener(Ig,Y),q.removeEventListener(kg,Z)}}},[v.viewport,_,u,h,se]),C.useEffect(()=>{a&&!v.isClosePausedRef.current&&se(_)},[a,_,v.isClosePausedRef,se]),C.useEffect(()=>(ee(),()=>W()),[ee,W]);const fe=C.useMemo(()=>b?YS(b):null,[b]);return v.viewport?d.jsxs(d.Fragment,{children:[fe&&d.jsx(VF,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:fe}),d.jsx(UF,{scope:n,onClose:de,children:Ia.createPortal(d.jsx(Ag.ItemSlot,{scope:n,children:d.jsx(QO,{asChild:!0,onEscapeKeyDown:Ue(l,()=>{v.isFocusedToastEscapeKeyDownRef.current||de(),v.isFocusedToastEscapeKeyDownRef.current=!1}),children:d.jsx(mt.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":a?"open":"closed","data-swipe-direction":v.swipeDirection,...x,ref:T,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Ue(t.onKeyDown,q=>{q.key==="Escape"&&(l==null||l(q.nativeEvent),q.nativeEvent.defaultPrevented||(v.isFocusedToastEscapeKeyDownRef.current=!0,de()))}),onPointerDown:Ue(t.onPointerDown,q=>{q.button===0&&(N.current={x:q.clientX,y:q.clientY})}),onPointerMove:Ue(t.onPointerMove,q=>{if(!N.current)return;const Z=q.clientX-N.current.x,Y=q.clientY-N.current.y,oe=!!P.current,Q=["left","right"].includes(v.swipeDirection),X=["left","up"].includes(v.swipeDirection)?Math.min:Math.max,$=Q?X(0,Z):0,te=Q?0:X(0,Y),_e=q.pointerType==="touch"?10:2,ke={x:$,y:te},xe={originalEvent:q,delta:ke};oe?(P.current=ke,au(FF,g,xe,{discrete:!1})):JS(ke,v.swipeDirection,_e)?(P.current=ke,au(LF,p,xe,{discrete:!1}),q.target.setPointerCapture(q.pointerId)):(Math.abs(Z)>_e||Math.abs(Y)>_e)&&(N.current=null)}),onPointerUp:Ue(t.onPointerUp,q=>{const Z=P.current,Y=q.target;if(Y.hasPointerCapture(q.pointerId)&&Y.releasePointerCapture(q.pointerId),P.current=null,N.current=null,Z){const oe=q.currentTarget,Q={originalEvent:q,delta:Z};JS(Z,v.swipeDirection,v.swipeThreshold)?au(HF,y,Q,{discrete:!0}):au($F,w,Q,{discrete:!0}),oe.addEventListener("click",X=>X.preventDefault(),{once:!0})}})})})}),v.viewport)})]}):null}),VF=t=>{const{__scopeToast:e,children:n,...r}=t,o=iu(pc,e),[a,s]=C.useState(!1),[l,u]=C.useState(!1);return jF(()=>s(!0)),C.useEffect(()=>{const h=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(h)},[]),l?null:d.jsx(fd,{asChild:!0,children:d.jsx(Eg,{...r,children:a&&d.jsxs(d.Fragment,{children:[o.label," ",n]})})})},KF="ToastTitle",VS=C.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return d.jsx(mt.div,{...r,ref:e})});VS.displayName=KF;var GF="ToastDescription",KS=C.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return d.jsx(mt.div,{...r,ref:e})});KS.displayName=GF;var GS="ToastAction",jS=C.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?d.jsx(qS,{altText:n,asChild:!0,children:d.jsx(Pg,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${GS}\`. Expected non-empty \`string\`.`),null)});jS.displayName=GS;var WS="ToastClose",Pg=C.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,o=BF(WS,n);return d.jsx(qS,{asChild:!0,children:d.jsx(mt.button,{type:"button",...r,ref:e,onClick:Ue(t.onClick,o.onClose)})})});Pg.displayName=WS;var qS=C.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...o}=t;return d.jsx(mt.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:e})});function YS(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),WF(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",a=r.dataset.radixToastAnnounceExclude==="";if(!o)if(a){const s=r.dataset.radixToastAnnounceAlt;s&&e.push(s)}else e.push(...YS(r))}}),e}function au(t,e,n,{discrete:r}){const o=n.originalEvent.currentTarget,a=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?$C(o,a):o.dispatchEvent(a)}var JS=(t,e,n=0)=>{const r=Math.abs(t.x),o=Math.abs(t.y),a=r>o;return e==="left"||e==="right"?a&&r>n:!a&&o>n};function jF(t=()=>{}){const e=gn(t);tn(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function WF(t){return t.nodeType===t.ELEMENT_NODE}function qF(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function Og(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var YF=$S,QS=US,XS=zS,ZS=VS,e_=KS,t_=jS,n_=Pg;const JF=YF,r_=C.forwardRef(({className:t,...e},n)=>d.jsx(QS,{ref:n,className:ze("s3-explr-ui-toast-viewport fixed top-0 flex max-h-screen w-full flex-col-reverse p-4 sm:bottom-0 sm:right-0 sm:top-auto sm:flex-col md:max-w-[420px] z-[10000]",t),...e}));r_.displayName=QS.displayName;const QF=mg("s3-explr-ui-toast group pointer-events-auto relative flex w-full items-center justify-between space-x-2 overflow-hidden rounded-md border p-4 pr-6 shadow-lg transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full",{variants:{variant:{default:"s3-explr-ui-toast-default border bg-background text-foreground",destructive:"s3-explr-ui-toast-destructive destructive group border-destructive bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),o_=C.forwardRef(({className:t,variant:e,...n},r)=>d.jsx(XS,{ref:r,className:ze(QF({variant:e}),t),...n}));o_.displayName=XS.displayName;const XF=C.forwardRef(({className:t,...e},n)=>d.jsx(t_,{ref:n,className:ze("s3-explr-ui-toast-action inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium transition-colors hover:bg-secondary focus:outline-none focus:ring-1 focus:ring-ring disabled:pointer-events-none disabled:opacity-50 group-[.destructive]:border-muted/40 group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground group-[.destructive]:focus:ring-destructive",t),...e}));XF.displayName=t_.displayName;const i_=C.forwardRef(({className:t,...e},n)=>d.jsx(n_,{ref:n,className:ze("absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity duration-200 ease-in-out hover:text-foreground focus:opacity-100 focus:outline-none focus:ring-1 group-hover:opacity-100 group-[.destructive]:text-red-300 group-[.destructive]:hover:text-red-50 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600 font-bold",t),"toast-close":"",...e,children:d.jsx(lg,{className:"s3-explr-ui-toast-close-icon h-4 w-4"})}));i_.displayName=n_.displayName;const a_=C.forwardRef(({className:t,...e},n)=>d.jsx(ZS,{ref:n,className:ze("s3-explr-ui-toast-title text-sm font-semibold [&+div]:text-xs",t),...e}));a_.displayName=ZS.displayName;const s_=C.forwardRef(({className:t,...e},n)=>d.jsx(e_,{ref:n,className:ze("text-sm opacity-90 font-bold",t),...e}));s_.displayName=e_.displayName;const ZF=1,e2=1e6;let Mg=0;function t2(){return Mg=(Mg+1)%Number.MAX_SAFE_INTEGER,Mg.toString()}const Rg=new Map,c_=t=>{if(Rg.has(t))return;const e=setTimeout(()=>{Rg.delete(t),gc({type:"REMOVE_TOAST",toastId:t})},e2);Rg.set(t,e)},n2=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,ZF)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?c_(n):t.toasts.forEach(r=>{c_(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},su=[];let cu={toasts:[]};function gc(t){cu=n2(cu,t),su.forEach(e=>{e(cu)})}function r2({...t}){const e=t2(),n=o=>gc({type:"UPDATE_TOAST",toast:{...o,id:e}}),r=()=>gc({type:"DISMISS_TOAST",toastId:e});return gc({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:o=>{o||r()}}}),{id:e,dismiss:r,update:n}}function mc(){const[t,e]=C.useState(cu);return C.useEffect(()=>(su.push(e),()=>{const n=su.indexOf(e);n>-1&&su.splice(n,1)}),[t]),{...t,toast:r2,dismiss:n=>gc({type:"DISMISS_TOAST",toastId:n})}}function l_(){const{toasts:t}=mc();return d.jsxs(JF,{children:[t.map(function({id:e,title:n,description:r,action:o,...a}){return d.jsxs(o_,{...a,className:`s3-explr-ui-toast ${a.className||""}`,children:[d.jsxs("div",{className:"s3-explr-ui-toast-content grid gap-1",children:[n&&d.jsx(a_,{className:"s3-explr-ui-toast-title",children:n}),r&&d.jsx(s_,{className:"s3-explr-ui-toast-description",children:r})]}),o&&d.jsx("div",{className:"s3-explr-ui-toast-action",children:o}),d.jsx(i_,{className:"s3-explr-ui-toast-close"})]},e)}),d.jsx(r_,{className:"s3-explr-ui-toast-viewport"})]})}const o2=["top","right","bottom","left"],bi=Math.min,sr=Math.max,lu=Math.round,du=Math.floor,go=t=>({x:t,y:t}),i2={left:"right",right:"left",bottom:"top",top:"bottom"},a2={start:"end",end:"start"};function Dg(t,e,n){return sr(t,bi(e,n))}function $o(t,e){return typeof t=="function"?t(e):t}function Ho(t){return t.split("-")[0]}function Za(t){return t.split("-")[1]}function Lg(t){return t==="x"?"y":"x"}function Fg(t){return t==="y"?"height":"width"}function Uo(t){return["top","bottom"].includes(Ho(t))?"y":"x"}function $g(t){return Lg(Uo(t))}function s2(t,e,n){n===void 0&&(n=!1);const r=Za(t),o=$g(t),a=Fg(o);let s=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[a]>e.floating[a]&&(s=uu(s)),[s,uu(s)]}function c2(t){const e=uu(t);return[Hg(t),e,Hg(e)]}function Hg(t){return t.replace(/start|end/g,e=>a2[e])}function l2(t,e,n){const r=["left","right"],o=["right","left"],a=["top","bottom"],s=["bottom","top"];switch(t){case"top":case"bottom":return n?e?o:r:e?r:o;case"left":case"right":return e?a:s;default:return[]}}function d2(t,e,n,r){const o=Za(t);let a=l2(Ho(t),n==="start",r);return o&&(a=a.map(s=>s+"-"+o),e&&(a=a.concat(a.map(Hg)))),a}function uu(t){return t.replace(/left|right|bottom|top/g,e=>i2[e])}function u2(t){return{top:0,right:0,bottom:0,left:0,...t}}function d_(t){return typeof t!="number"?u2(t):{top:t,right:t,bottom:t,left:t}}function fu(t){const{x:e,y:n,width:r,height:o}=t;return{width:r,height:o,top:n,left:e,right:e+r,bottom:n+o,x:e,y:n}}function u_(t,e,n){let{reference:r,floating:o}=t;const a=Uo(e),s=$g(e),l=Fg(s),u=Ho(e),h=a==="y",p=r.x+r.width/2-o.width/2,g=r.y+r.height/2-o.height/2,w=r[l]/2-o[l]/2;let y;switch(u){case"top":y={x:p,y:r.y-o.height};break;case"bottom":y={x:p,y:r.y+r.height};break;case"right":y={x:r.x+r.width,y:g};break;case"left":y={x:r.x-o.width,y:g};break;default:y={x:r.x,y:r.y}}switch(Za(e)){case"start":y[s]-=w*(n&&h?-1:1);break;case"end":y[s]+=w*(n&&h?-1:1);break}return y}const f2=async(t,e,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:s}=n,l=a.filter(Boolean),u=await(s.isRTL==null?void 0:s.isRTL(e));let h=await s.getElementRects({reference:t,floating:e,strategy:o}),{x:p,y:g}=u_(h,r,u),w=r,y={},x=0;for(let v=0;v<l.length;v++){const{name:b,fn:E}=l[v],{x:T,y:N,data:P,reset:_}=await E({x:p,y:g,initialPlacement:r,placement:w,strategy:o,middlewareData:y,rects:h,platform:s,elements:{reference:t,floating:e}});p=T??p,g=N??g,y={...y,[b]:{...y[b],...P}},_&&x<=50&&(x++,typeof _=="object"&&(_.placement&&(w=_.placement),_.rects&&(h=_.rects===!0?await s.getElementRects({reference:t,floating:e,strategy:o}):_.rects),{x:p,y:g}=u_(h,w,u)),v=-1)}return{x:p,y:g,placement:w,strategy:o,middlewareData:y}};async function vc(t,e){var n;e===void 0&&(e={});const{x:r,y:o,platform:a,rects:s,elements:l,strategy:u}=t,{boundary:h="clippingAncestors",rootBoundary:p="viewport",elementContext:g="floating",altBoundary:w=!1,padding:y=0}=$o(e,t),x=d_(y),b=l[w?g==="floating"?"reference":"floating":g],E=fu(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(b)))==null||n?b:b.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(l.floating)),boundary:h,rootBoundary:p,strategy:u})),T=g==="floating"?{x:r,y:o,width:s.floating.width,height:s.floating.height}:s.reference,N=await(a.getOffsetParent==null?void 0:a.getOffsetParent(l.floating)),P=await(a.isElement==null?void 0:a.isElement(N))?await(a.getScale==null?void 0:a.getScale(N))||{x:1,y:1}:{x:1,y:1},_=fu(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:T,offsetParent:N,strategy:u}):T);return{top:(E.top-_.top+x.top)/P.y,bottom:(_.bottom-E.bottom+x.bottom)/P.y,left:(E.left-_.left+x.left)/P.x,right:(_.right-E.right+x.right)/P.x}}const h2=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:o,rects:a,platform:s,elements:l,middlewareData:u}=e,{element:h,padding:p=0}=$o(t,e)||{};if(h==null)return{};const g=d_(p),w={x:n,y:r},y=$g(o),x=Fg(y),v=await s.getDimensions(h),b=y==="y",E=b?"top":"left",T=b?"bottom":"right",N=b?"clientHeight":"clientWidth",P=a.reference[x]+a.reference[y]-w[y]-a.floating[x],_=w[y]-a.reference[y],D=await(s.getOffsetParent==null?void 0:s.getOffsetParent(h));let H=D?D[N]:0;(!H||!await(s.isElement==null?void 0:s.isElement(D)))&&(H=l.floating[N]||a.floating[x]);const K=P/2-_/2,ee=H/2-v[x]/2-1,W=bi(g[E],ee),de=bi(g[T],ee),se=W,fe=H-v[x]-de,q=H/2-v[x]/2+K,Z=Dg(se,q,fe),Y=!u.arrow&&Za(o)!=null&&q!==Z&&a.reference[x]/2-(q<se?W:de)-v[x]/2<0,oe=Y?q<se?q-se:q-fe:0;return{[y]:w[y]+oe,data:{[y]:Z,centerOffset:q-Z-oe,...Y&&{alignmentOffset:oe}},reset:Y}}}),p2=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:o,middlewareData:a,rects:s,initialPlacement:l,platform:u,elements:h}=e,{mainAxis:p=!0,crossAxis:g=!0,fallbackPlacements:w,fallbackStrategy:y="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...b}=$o(t,e);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const E=Ho(o),T=Uo(l),N=Ho(l)===l,P=await(u.isRTL==null?void 0:u.isRTL(h.floating)),_=w||(N||!v?[uu(l)]:c2(l)),D=x!=="none";!w&&D&&_.push(...d2(l,v,x,P));const H=[l,..._],K=await vc(e,b),ee=[];let W=((r=a.flip)==null?void 0:r.overflows)||[];if(p&&ee.push(K[E]),g){const Z=s2(o,s,P);ee.push(K[Z[0]],K[Z[1]])}if(W=[...W,{placement:o,overflows:ee}],!ee.every(Z=>Z<=0)){var de,se;const Z=(((de=a.flip)==null?void 0:de.index)||0)+1,Y=H[Z];if(Y){var fe;const Q=g==="alignment"?T!==Uo(Y):!1,X=((fe=W[0])==null?void 0:fe.overflows[0])>0;if(!Q||X)return{data:{index:Z,overflows:W},reset:{placement:Y}}}let oe=(se=W.filter(Q=>Q.overflows[0]<=0).sort((Q,X)=>Q.overflows[1]-X.overflows[1])[0])==null?void 0:se.placement;if(!oe)switch(y){case"bestFit":{var q;const Q=(q=W.filter(X=>{if(D){const $=Uo(X.placement);return $===T||$==="y"}return!0}).map(X=>[X.placement,X.overflows.filter($=>$>0).reduce(($,te)=>$+te,0)]).sort((X,$)=>X[1]-$[1])[0])==null?void 0:q[0];Q&&(oe=Q);break}case"initialPlacement":oe=l;break}if(o!==oe)return{reset:{placement:oe}}}return{}}}};function f_(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function h_(t){return o2.some(e=>t[e]>=0)}const g2=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...o}=$o(t,e);switch(r){case"referenceHidden":{const a=await vc(e,{...o,elementContext:"reference"}),s=f_(a,n.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:h_(s)}}}case"escaped":{const a=await vc(e,{...o,altBoundary:!0}),s=f_(a,n.floating);return{data:{escapedOffsets:s,escaped:h_(s)}}}default:return{}}}}};async function m2(t,e){const{placement:n,platform:r,elements:o}=t,a=await(r.isRTL==null?void 0:r.isRTL(o.floating)),s=Ho(n),l=Za(n),u=Uo(n)==="y",h=["left","top"].includes(s)?-1:1,p=a&&u?-1:1,g=$o(e,t);let{mainAxis:w,crossAxis:y,alignmentAxis:x}=typeof g=="number"?{mainAxis:g,crossAxis:0,alignmentAxis:null}:{mainAxis:g.mainAxis||0,crossAxis:g.crossAxis||0,alignmentAxis:g.alignmentAxis};return l&&typeof x=="number"&&(y=l==="end"?x*-1:x),u?{x:y*p,y:w*h}:{x:w*h,y:y*p}}const v2=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:o,y:a,placement:s,middlewareData:l}=e,u=await m2(e,t);return s===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:a+u.y,data:{...u,placement:s}}}}},y2=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:o}=e,{mainAxis:a=!0,crossAxis:s=!1,limiter:l={fn:b=>{let{x:E,y:T}=b;return{x:E,y:T}}},...u}=$o(t,e),h={x:n,y:r},p=await vc(e,u),g=Uo(Ho(o)),w=Lg(g);let y=h[w],x=h[g];if(a){const b=w==="y"?"top":"left",E=w==="y"?"bottom":"right",T=y+p[b],N=y-p[E];y=Dg(T,y,N)}if(s){const b=g==="y"?"top":"left",E=g==="y"?"bottom":"right",T=x+p[b],N=x-p[E];x=Dg(T,x,N)}const v=l.fn({...e,[w]:y,[g]:x});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[w]:a,[g]:s}}}}}},w2=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:o,rects:a,middlewareData:s}=e,{offset:l=0,mainAxis:u=!0,crossAxis:h=!0}=$o(t,e),p={x:n,y:r},g=Uo(o),w=Lg(g);let y=p[w],x=p[g];const v=$o(l,e),b=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(u){const N=w==="y"?"height":"width",P=a.reference[w]-a.floating[N]+b.mainAxis,_=a.reference[w]+a.reference[N]-b.mainAxis;y<P?y=P:y>_&&(y=_)}if(h){var E,T;const N=w==="y"?"width":"height",P=["top","left"].includes(Ho(o)),_=a.reference[g]-a.floating[N]+(P&&((E=s.offset)==null?void 0:E[g])||0)+(P?0:b.crossAxis),D=a.reference[g]+a.reference[N]+(P?0:((T=s.offset)==null?void 0:T[g])||0)-(P?b.crossAxis:0);x<_?x=_:x>D&&(x=D)}return{[w]:y,[g]:x}}}},C2=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:o,rects:a,platform:s,elements:l}=e,{apply:u=()=>{},...h}=$o(t,e),p=await vc(e,h),g=Ho(o),w=Za(o),y=Uo(o)==="y",{width:x,height:v}=a.floating;let b,E;g==="top"||g==="bottom"?(b=g,E=w===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(E=g,b=w==="end"?"top":"bottom");const T=v-p.top-p.bottom,N=x-p.left-p.right,P=bi(v-p[b],T),_=bi(x-p[E],N),D=!e.middlewareData.shift;let H=P,K=_;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(K=N),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(H=T),D&&!w){const W=sr(p.left,0),de=sr(p.right,0),se=sr(p.top,0),fe=sr(p.bottom,0);y?K=x-2*(W!==0||de!==0?W+de:sr(p.left,p.right)):H=v-2*(se!==0||fe!==0?se+fe:sr(p.top,p.bottom))}await u({...e,availableWidth:K,availableHeight:H});const ee=await s.getDimensions(l.floating);return x!==ee.width||v!==ee.height?{reset:{rects:!0}}:{}}}};function hu(){return typeof window<"u"}function es(t){return p_(t)?(t.nodeName||"").toLowerCase():"#document"}function cr(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function mo(t){var e;return(e=(p_(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function p_(t){return hu()?t instanceof Node||t instanceof cr(t).Node:!1}function Ur(t){return hu()?t instanceof Element||t instanceof cr(t).Element:!1}function vo(t){return hu()?t instanceof HTMLElement||t instanceof cr(t).HTMLElement:!1}function g_(t){return!hu()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof cr(t).ShadowRoot}function yc(t){const{overflow:e,overflowX:n,overflowY:r,display:o}=Br(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(o)}function b2(t){return["table","td","th"].includes(es(t))}function pu(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function Ug(t){const e=Bg(),n=Ur(t)?Br(t):t;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function x2(t){let e=xi(t);for(;vo(e)&&!ts(e);){if(Ug(e))return e;if(pu(e))return null;e=xi(e)}return null}function Bg(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function ts(t){return["html","body","#document"].includes(es(t))}function Br(t){return cr(t).getComputedStyle(t)}function gu(t){return Ur(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function xi(t){if(es(t)==="html")return t;const e=t.assignedSlot||t.parentNode||g_(t)&&t.host||mo(t);return g_(e)?e.host:e}function m_(t){const e=xi(t);return ts(e)?t.ownerDocument?t.ownerDocument.body:t.body:vo(e)&&yc(e)?e:m_(e)}function wc(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const o=m_(t),a=o===((r=t.ownerDocument)==null?void 0:r.body),s=cr(o);if(a){const l=zg(s);return e.concat(s,s.visualViewport||[],yc(o)?o:[],l&&n?wc(l):[])}return e.concat(o,wc(o,[],n))}function zg(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function v_(t){const e=Br(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const o=vo(t),a=o?t.offsetWidth:n,s=o?t.offsetHeight:r,l=lu(n)!==a||lu(r)!==s;return l&&(n=a,r=s),{width:n,height:r,$:l}}function Vg(t){return Ur(t)?t:t.contextElement}function ns(t){const e=Vg(t);if(!vo(e))return go(1);const n=e.getBoundingClientRect(),{width:r,height:o,$:a}=v_(e);let s=(a?lu(n.width):n.width)/r,l=(a?lu(n.height):n.height)/o;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const S2=go(0);function y_(t){const e=cr(t);return!Bg()||!e.visualViewport?S2:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function _2(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==cr(t)?!1:e}function Qi(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const o=t.getBoundingClientRect(),a=Vg(t);let s=go(1);e&&(r?Ur(r)&&(s=ns(r)):s=ns(t));const l=_2(a,n,r)?y_(a):go(0);let u=(o.left+l.x)/s.x,h=(o.top+l.y)/s.y,p=o.width/s.x,g=o.height/s.y;if(a){const w=cr(a),y=r&&Ur(r)?cr(r):r;let x=w,v=zg(x);for(;v&&r&&y!==x;){const b=ns(v),E=v.getBoundingClientRect(),T=Br(v),N=E.left+(v.clientLeft+parseFloat(T.paddingLeft))*b.x,P=E.top+(v.clientTop+parseFloat(T.paddingTop))*b.y;u*=b.x,h*=b.y,p*=b.x,g*=b.y,u+=N,h+=P,x=cr(v),v=zg(x)}}return fu({width:p,height:g,x:u,y:h})}function Kg(t,e){const n=gu(t).scrollLeft;return e?e.left+n:Qi(mo(t)).left+n}function w_(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),o=r.left+e.scrollLeft-(n?0:Kg(t,r)),a=r.top+e.scrollTop;return{x:o,y:a}}function E2(t){let{elements:e,rect:n,offsetParent:r,strategy:o}=t;const a=o==="fixed",s=mo(r),l=e?pu(e.floating):!1;if(r===s||l&&a)return n;let u={scrollLeft:0,scrollTop:0},h=go(1);const p=go(0),g=vo(r);if((g||!g&&!a)&&((es(r)!=="body"||yc(s))&&(u=gu(r)),vo(r))){const y=Qi(r);h=ns(r),p.x=y.x+r.clientLeft,p.y=y.y+r.clientTop}const w=s&&!g&&!a?w_(s,u,!0):go(0);return{width:n.width*h.x,height:n.height*h.y,x:n.x*h.x-u.scrollLeft*h.x+p.x+w.x,y:n.y*h.y-u.scrollTop*h.y+p.y+w.y}}function T2(t){return Array.from(t.getClientRects())}function A2(t){const e=mo(t),n=gu(t),r=t.ownerDocument.body,o=sr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),a=sr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let s=-n.scrollLeft+Kg(t);const l=-n.scrollTop;return Br(r).direction==="rtl"&&(s+=sr(e.clientWidth,r.clientWidth)-o),{width:o,height:a,x:s,y:l}}function I2(t,e){const n=cr(t),r=mo(t),o=n.visualViewport;let a=r.clientWidth,s=r.clientHeight,l=0,u=0;if(o){a=o.width,s=o.height;const h=Bg();(!h||h&&e==="fixed")&&(l=o.offsetLeft,u=o.offsetTop)}return{width:a,height:s,x:l,y:u}}function k2(t,e){const n=Qi(t,!0,e==="fixed"),r=n.top+t.clientTop,o=n.left+t.clientLeft,a=vo(t)?ns(t):go(1),s=t.clientWidth*a.x,l=t.clientHeight*a.y,u=o*a.x,h=r*a.y;return{width:s,height:l,x:u,y:h}}function C_(t,e,n){let r;if(e==="viewport")r=I2(t,n);else if(e==="document")r=A2(mo(t));else if(Ur(e))r=k2(e,n);else{const o=y_(t);r={x:e.x-o.x,y:e.y-o.y,width:e.width,height:e.height}}return fu(r)}function b_(t,e){const n=xi(t);return n===e||!Ur(n)||ts(n)?!1:Br(n).position==="fixed"||b_(n,e)}function N2(t,e){const n=e.get(t);if(n)return n;let r=wc(t,[],!1).filter(l=>Ur(l)&&es(l)!=="body"),o=null;const a=Br(t).position==="fixed";let s=a?xi(t):t;for(;Ur(s)&&!ts(s);){const l=Br(s),u=Ug(s);!u&&l.position==="fixed"&&(o=null),(a?!u&&!o:!u&&l.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||yc(s)&&!u&&b_(t,s))?r=r.filter(p=>p!==s):o=l,s=xi(s)}return e.set(t,r),r}function P2(t){let{element:e,boundary:n,rootBoundary:r,strategy:o}=t;const s=[...n==="clippingAncestors"?pu(e)?[]:N2(e,this._c):[].concat(n),r],l=s[0],u=s.reduce((h,p)=>{const g=C_(e,p,o);return h.top=sr(g.top,h.top),h.right=bi(g.right,h.right),h.bottom=bi(g.bottom,h.bottom),h.left=sr(g.left,h.left),h},C_(e,l,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function O2(t){const{width:e,height:n}=v_(t);return{width:e,height:n}}function M2(t,e,n){const r=vo(e),o=mo(e),a=n==="fixed",s=Qi(t,!0,a,e);let l={scrollLeft:0,scrollTop:0};const u=go(0);function h(){u.x=Kg(o)}if(r||!r&&!a)if((es(e)!=="body"||yc(o))&&(l=gu(e)),r){const y=Qi(e,!0,a,e);u.x=y.x+e.clientLeft,u.y=y.y+e.clientTop}else o&&h();a&&!r&&o&&h();const p=o&&!r&&!a?w_(o,l):go(0),g=s.left+l.scrollLeft-u.x-p.x,w=s.top+l.scrollTop-u.y-p.y;return{x:g,y:w,width:s.width,height:s.height}}function Gg(t){return Br(t).position==="static"}function x_(t,e){if(!vo(t)||Br(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return mo(t)===n&&(n=n.ownerDocument.body),n}function S_(t,e){const n=cr(t);if(pu(t))return n;if(!vo(t)){let o=xi(t);for(;o&&!ts(o);){if(Ur(o)&&!Gg(o))return o;o=xi(o)}return n}let r=x_(t,e);for(;r&&b2(r)&&Gg(r);)r=x_(r,e);return r&&ts(r)&&Gg(r)&&!Ug(r)?n:r||x2(t)||n}const R2=async function(t){const e=this.getOffsetParent||S_,n=this.getDimensions,r=await n(t.floating);return{reference:M2(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function D2(t){return Br(t).direction==="rtl"}const L2={convertOffsetParentRelativeRectToViewportRelativeRect:E2,getDocumentElement:mo,getClippingRect:P2,getOffsetParent:S_,getElementRects:R2,getClientRects:T2,getDimensions:O2,getScale:ns,isElement:Ur,isRTL:D2};function __(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function F2(t,e){let n=null,r;const o=mo(t);function a(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function s(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),a();const h=t.getBoundingClientRect(),{left:p,top:g,width:w,height:y}=h;if(l||e(),!w||!y)return;const x=du(g),v=du(o.clientWidth-(p+w)),b=du(o.clientHeight-(g+y)),E=du(p),N={rootMargin:-x+"px "+-v+"px "+-b+"px "+-E+"px",threshold:sr(0,bi(1,u))||1};let P=!0;function _(D){const H=D[0].intersectionRatio;if(H!==u){if(!P)return s();H?s(!1,H):r=setTimeout(()=>{s(!1,1e-7)},1e3)}H===1&&!__(h,t.getBoundingClientRect())&&s(),P=!1}try{n=new IntersectionObserver(_,{...N,root:o.ownerDocument})}catch{n=new IntersectionObserver(_,N)}n.observe(t)}return s(!0),a}function E_(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,h=Vg(t),p=o||a?[...h?wc(h):[],...wc(e)]:[];p.forEach(E=>{o&&E.addEventListener("scroll",n,{passive:!0}),a&&E.addEventListener("resize",n)});const g=h&&l?F2(h,n):null;let w=-1,y=null;s&&(y=new ResizeObserver(E=>{let[T]=E;T&&T.target===h&&y&&(y.unobserve(e),cancelAnimationFrame(w),w=requestAnimationFrame(()=>{var N;(N=y)==null||N.observe(e)})),n()}),h&&!u&&y.observe(h),y.observe(e));let x,v=u?Qi(t):null;u&&b();function b(){const E=Qi(t);v&&!__(v,E)&&n(),v=E,x=requestAnimationFrame(b)}return n(),()=>{var E;p.forEach(T=>{o&&T.removeEventListener("scroll",n),a&&T.removeEventListener("resize",n)}),g==null||g(),(E=y)==null||E.disconnect(),y=null,u&&cancelAnimationFrame(x)}}const $2=v2,H2=y2,U2=p2,B2=C2,z2=g2,T_=h2,V2=w2,K2=(t,e,n)=>{const r=new Map,o={platform:L2,...n},a={...o.platform,_c:r};return f2(t,e,{...o,platform:a})};var mu=typeof document<"u"?M.useLayoutEffect:M.useEffect;function vu(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,o;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!vu(t[r],e[r]))return!1;return!0}if(o=Object.keys(t),n=o.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,o[r]))return!1;for(r=n;r--!==0;){const a=o[r];if(!(a==="_owner"&&t.$$typeof)&&!vu(t[a],e[a]))return!1}return!0}return t!==t&&e!==e}function A_(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function I_(t,e){const n=A_(t);return Math.round(e*n)/n}function jg(t){const e=C.useRef(t);return mu(()=>{e.current=t}),e}function k_(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:a,floating:s}={},transform:l=!0,whileElementsMounted:u,open:h}=t,[p,g]=C.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[w,y]=C.useState(r);vu(w,r)||y(r);const[x,v]=C.useState(null),[b,E]=C.useState(null),T=C.useCallback(Q=>{Q!==D.current&&(D.current=Q,v(Q))},[]),N=C.useCallback(Q=>{Q!==H.current&&(H.current=Q,E(Q))},[]),P=a||x,_=s||b,D=C.useRef(null),H=C.useRef(null),K=C.useRef(p),ee=u!=null,W=jg(u),de=jg(o),se=jg(h),fe=C.useCallback(()=>{if(!D.current||!H.current)return;const Q={placement:e,strategy:n,middleware:w};de.current&&(Q.platform=de.current),K2(D.current,H.current,Q).then(X=>{const $={...X,isPositioned:se.current!==!1};q.current&&!vu(K.current,$)&&(K.current=$,Ia.flushSync(()=>{g($)}))})},[w,e,n,de,se]);mu(()=>{h===!1&&K.current.isPositioned&&(K.current.isPositioned=!1,g(Q=>({...Q,isPositioned:!1})))},[h]);const q=C.useRef(!1);mu(()=>(q.current=!0,()=>{q.current=!1}),[]),mu(()=>{if(P&&(D.current=P),_&&(H.current=_),P&&_){if(W.current)return W.current(P,_,fe);fe()}},[P,_,fe,W,ee]);const Z=C.useMemo(()=>({reference:D,floating:H,setReference:T,setFloating:N}),[T,N]),Y=C.useMemo(()=>({reference:P,floating:_}),[P,_]),oe=C.useMemo(()=>{const Q={position:n,left:0,top:0};if(!Y.floating)return Q;const X=I_(Y.floating,p.x),$=I_(Y.floating,p.y);return l?{...Q,transform:"translate("+X+"px, "+$+"px)",...A_(Y.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:X,top:$}},[n,l,Y.floating,p.x,p.y]);return C.useMemo(()=>({...p,update:fe,refs:Z,elements:Y,floatingStyles:oe}),[p,fe,Z,Y,oe])}const G2=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:o}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?T_({element:r.current,padding:o}).fn(n):{}:r?T_({element:r,padding:o}).fn(n):{}}}},N_=(t,e)=>({...$2(t),options:[t,e]}),P_=(t,e)=>({...H2(t),options:[t,e]}),O_=(t,e)=>({...V2(t),options:[t,e]}),M_=(t,e)=>({...U2(t),options:[t,e]}),R_=(t,e)=>({...B2(t),options:[t,e]}),D_=(t,e)=>({...z2(t),options:[t,e]}),L_=(t,e)=>({...G2(t),options:[t,e]});var j2="Arrow",F_=C.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...a}=t;return d.jsx(mt.svg,{...a,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});F_.displayName=j2;var W2=F_,Wg="Popper",[$_,H_]=gr(Wg),[q2,U_]=$_(Wg),B_=t=>{const{__scopePopper:e,children:n}=t,[r,o]=C.useState(null);return d.jsx(q2,{scope:e,anchor:r,onAnchorChange:o,children:n})};B_.displayName=Wg;var z_="PopperAnchor",V_=C.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,a=U_(z_,n),s=C.useRef(null),l=rt(e,s);return C.useEffect(()=>{a.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:d.jsx(mt.div,{...o,ref:l})});V_.displayName=z_;var qg="PopperContent",[Y2,J2]=$_(qg),K_=C.forwardRef((t,e)=>{var z,ce,Ae,Ce,Ne,ne;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:a="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:p=0,sticky:g="partial",hideWhenDetached:w=!1,updatePositionStrategy:y="optimized",onPlaced:x,...v}=t,b=U_(qg,n),[E,T]=C.useState(null),N=rt(e,Ve=>T(Ve)),[P,_]=C.useState(null),D=vg(P),H=(D==null?void 0:D.width)??0,K=(D==null?void 0:D.height)??0,ee=r+(a!=="center"?"-"+a:""),W=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},de=Array.isArray(h)?h:[h],se=de.length>0,fe={padding:W,boundary:de.filter(X2),altBoundary:se},{refs:q,floatingStyles:Z,placement:Y,isPositioned:oe,middlewareData:Q}=k_({strategy:"fixed",placement:ee,whileElementsMounted:(...Ve)=>E_(...Ve,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[N_({mainAxis:o+K,alignmentAxis:s}),u&&P_({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?O_():void 0,...fe}),u&&M_({...fe}),R_({...fe,apply:({elements:Ve,rects:Qe,availableWidth:Ct,availableHeight:Yt})=>{const{width:bt,height:rn}=Qe.reference,zt=Ve.floating.style;zt.setProperty("--radix-popper-available-width",`${Ct}px`),zt.setProperty("--radix-popper-available-height",`${Yt}px`),zt.setProperty("--radix-popper-anchor-width",`${bt}px`),zt.setProperty("--radix-popper-anchor-height",`${rn}px`)}}),P&&L_({element:P,padding:l}),Z2({arrowWidth:H,arrowHeight:K}),w&&D_({strategy:"referenceHidden",...fe})]}),[X,$]=W_(Y),te=gn(x);tn(()=>{oe&&(te==null||te())},[oe,te]);const _e=(z=Q.arrow)==null?void 0:z.x,ke=(ce=Q.arrow)==null?void 0:ce.y,xe=((Ae=Q.arrow)==null?void 0:Ae.centerOffset)!==0,[Pe,Te]=C.useState();return tn(()=>{E&&Te(window.getComputedStyle(E).zIndex)},[E]),d.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:oe?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Pe,"--radix-popper-transform-origin":[(Ce=Q.transformOrigin)==null?void 0:Ce.x,(Ne=Q.transformOrigin)==null?void 0:Ne.y].join(" "),...((ne=Q.hide)==null?void 0:ne.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:d.jsx(Y2,{scope:n,placedSide:X,onArrowChange:_,arrowX:_e,arrowY:ke,shouldHideArrow:xe,children:d.jsx(mt.div,{"data-side":X,"data-align":$,...v,ref:N,style:{...v.style,animation:oe?void 0:"none"}})})})});K_.displayName=qg;var G_="PopperArrow",Q2={top:"bottom",right:"left",bottom:"top",left:"right"},j_=C.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,a=J2(G_,r),s=Q2[a.placedSide];return d.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:d.jsx(W2,{...o,ref:n,style:{...o.style,display:"block"}})})});j_.displayName=G_;function X2(t){return t!==null}var Z2=t=>({name:"transformOrigin",options:t,fn(e){var b,E,T;const{placement:n,rects:r,middlewareData:o}=e,s=((b=o.arrow)==null?void 0:b.centerOffset)!==0,l=s?0:t.arrowWidth,u=s?0:t.arrowHeight,[h,p]=W_(n),g={start:"0%",center:"50%",end:"100%"}[p],w=(((E=o.arrow)==null?void 0:E.x)??0)+l/2,y=(((T=o.arrow)==null?void 0:T.y)??0)+u/2;let x="",v="";return h==="bottom"?(x=s?g:`${w}px`,v=`${-u}px`):h==="top"?(x=s?g:`${w}px`,v=`${r.floating.height+u}px`):h==="right"?(x=`${-u}px`,v=s?g:`${y}px`):h==="left"&&(x=`${r.floating.width+u}px`,v=s?g:`${y}px`),{data:{x,y:v}}}});function W_(t){const[e,n="center"]=t.split("-");return[e,n]}var e$=B_,t$=V_,n$=K_,r$=j_,o$=Symbol("radix.slottable");function i$(t){const e=({children:n})=>d.jsx(d.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=o$,e}var a$=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"}),s$="VisuallyHidden",q_=C.forwardRef((t,e)=>d.jsx(mt.span,{...t,ref:e,style:{...a$,...t.style}}));q_.displayName=s$;var c$=q_,[yu,Bj]=gr("Tooltip",[H_]),wu=H_(),Y_="TooltipProvider",l$=700,Yg="tooltip.open",[d$,Jg]=yu(Y_),J_=t=>{const{__scopeTooltip:e,delayDuration:n=l$,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:a}=t,s=C.useRef(!0),l=C.useRef(!1),u=C.useRef(0);return C.useEffect(()=>{const h=u.current;return()=>window.clearTimeout(h)},[]),d.jsx(d$,{scope:e,isOpenDelayedRef:s,delayDuration:n,onOpen:C.useCallback(()=>{window.clearTimeout(u.current),s.current=!1},[]),onClose:C.useCallback(()=>{window.clearTimeout(u.current),u.current=window.setTimeout(()=>s.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:C.useCallback(h=>{l.current=h},[]),disableHoverableContent:o,children:a})};J_.displayName=Y_;var Cc="Tooltip",[u$,bc]=yu(Cc),Q_=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:o,onOpenChange:a,disableHoverableContent:s,delayDuration:l}=t,u=Jg(Cc,t.__scopeTooltip),h=wu(e),[p,g]=C.useState(null),w=Mo(),y=C.useRef(0),x=s??u.disableHoverableContent,v=l??u.delayDuration,b=C.useRef(!1),[E,T]=ui({prop:r,defaultProp:o??!1,onChange:H=>{H?(u.onOpen(),document.dispatchEvent(new CustomEvent(Yg))):u.onClose(),a==null||a(H)},caller:Cc}),N=C.useMemo(()=>E?b.current?"delayed-open":"instant-open":"closed",[E]),P=C.useCallback(()=>{window.clearTimeout(y.current),y.current=0,b.current=!1,T(!0)},[T]),_=C.useCallback(()=>{window.clearTimeout(y.current),y.current=0,T(!1)},[T]),D=C.useCallback(()=>{window.clearTimeout(y.current),y.current=window.setTimeout(()=>{b.current=!0,T(!0),y.current=0},v)},[v,T]);return C.useEffect(()=>()=>{y.current&&(window.clearTimeout(y.current),y.current=0)},[]),d.jsx(e$,{...h,children:d.jsx(u$,{scope:e,contentId:w,open:E,stateAttribute:N,trigger:p,onTriggerChange:g,onTriggerEnter:C.useCallback(()=>{u.isOpenDelayedRef.current?D():P()},[u.isOpenDelayedRef,D,P]),onTriggerLeave:C.useCallback(()=>{x?_():(window.clearTimeout(y.current),y.current=0)},[_,x]),onOpen:P,onClose:_,disableHoverableContent:x,children:n})})};Q_.displayName=Cc;var Qg="TooltipTrigger",X_=C.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,o=bc(Qg,n),a=Jg(Qg,n),s=wu(n),l=C.useRef(null),u=rt(e,l,o.onTriggerChange),h=C.useRef(!1),p=C.useRef(!1),g=C.useCallback(()=>h.current=!1,[]);return C.useEffect(()=>()=>document.removeEventListener("pointerup",g),[g]),d.jsx(t$,{asChild:!0,...s,children:d.jsx(mt.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:Ue(t.onPointerMove,w=>{w.pointerType!=="touch"&&!p.current&&!a.isPointerInTransitRef.current&&(o.onTriggerEnter(),p.current=!0)}),onPointerLeave:Ue(t.onPointerLeave,()=>{o.onTriggerLeave(),p.current=!1}),onPointerDown:Ue(t.onPointerDown,()=>{o.open&&o.onClose(),h.current=!0,document.addEventListener("pointerup",g,{once:!0})}),onFocus:Ue(t.onFocus,()=>{h.current||o.onOpen()}),onBlur:Ue(t.onBlur,o.onClose),onClick:Ue(t.onClick,o.onClose)})})});X_.displayName=Qg;var Xg="TooltipPortal",[f$,h$]=yu(Xg,{forceMount:void 0}),Z_=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:o}=t,a=bc(Xg,e);return d.jsx(f$,{scope:e,forceMount:n,children:d.jsx(Ro,{present:n||a.open,children:d.jsx(fd,{asChild:!0,container:o,children:r})})})};Z_.displayName=Xg;var rs="TooltipContent",eE=C.forwardRef((t,e)=>{const n=h$(rs,t.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...a}=t,s=bc(rs,t.__scopeTooltip);return d.jsx(Ro,{present:r||s.open,children:s.disableHoverableContent?d.jsx(tE,{side:o,...a,ref:e}):d.jsx(p$,{side:o,...a,ref:e})})}),p$=C.forwardRef((t,e)=>{const n=bc(rs,t.__scopeTooltip),r=Jg(rs,t.__scopeTooltip),o=C.useRef(null),a=rt(e,o),[s,l]=C.useState(null),{trigger:u,onClose:h}=n,p=o.current,{onPointerInTransitChange:g}=r,w=C.useCallback(()=>{l(null),g(!1)},[g]),y=C.useCallback((x,v)=>{const b=x.currentTarget,E={x:x.clientX,y:x.clientY},T=w$(E,b.getBoundingClientRect()),N=C$(E,T),P=b$(v.getBoundingClientRect()),_=S$([...N,...P]);l(_),g(!0)},[g]);return C.useEffect(()=>()=>w(),[w]),C.useEffect(()=>{if(u&&p){const x=b=>y(b,p),v=b=>y(b,u);return u.addEventListener("pointerleave",x),p.addEventListener("pointerleave",v),()=>{u.removeEventListener("pointerleave",x),p.removeEventListener("pointerleave",v)}}},[u,p,y,w]),C.useEffect(()=>{if(s){const x=v=>{const b=v.target,E={x:v.clientX,y:v.clientY},T=(u==null?void 0:u.contains(b))||(p==null?void 0:p.contains(b)),N=!x$(E,s);T?w():N&&(w(),h())};return document.addEventListener("pointermove",x),()=>document.removeEventListener("pointermove",x)}},[u,p,s,h,w]),d.jsx(tE,{...t,ref:a})}),[g$,m$]=yu(Cc,{isInside:!1}),v$=i$("TooltipContent"),tE=C.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:a,onPointerDownOutside:s,...l}=t,u=bc(rs,n),h=wu(n),{onClose:p}=u;return C.useEffect(()=>(document.addEventListener(Yg,p),()=>document.removeEventListener(Yg,p)),[p]),C.useEffect(()=>{if(u.trigger){const g=w=>{const y=w.target;y!=null&&y.contains(u.trigger)&&p()};return window.addEventListener("scroll",g,{capture:!0}),()=>window.removeEventListener("scroll",g,{capture:!0})}},[u.trigger,p]),d.jsx(ud,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:g=>g.preventDefault(),onDismiss:p,children:d.jsxs(n$,{"data-state":u.stateAttribute,...h,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[d.jsx(v$,{children:r}),d.jsx(g$,{scope:n,isInside:!0,children:d.jsx(c$,{id:u.contentId,role:"tooltip",children:o||r})})]})})});eE.displayName=rs;var nE="TooltipArrow",y$=C.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,o=wu(n);return m$(nE,n).isInside?null:d.jsx(r$,{...o,...r,ref:e})});y$.displayName=nE;function w$(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),o=Math.abs(e.right-t.x),a=Math.abs(e.left-t.x);switch(Math.min(n,r,o,a)){case a:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function C$(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function b$(t){const{top:e,right:n,bottom:r,left:o}=t;return[{x:o,y:e},{x:n,y:e},{x:n,y:r},{x:o,y:r}]}function x$(t,e){const{x:n,y:r}=t;let o=!1;for(let a=0,s=e.length-1;a<e.length;s=a++){const l=e[a],u=e[s],h=l.x,p=l.y,g=u.x,w=u.y;p>r!=w>r&&n<(g-h)*(r-p)/(w-p)+h&&(o=!o)}return o}function S$(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),_$(e)}function _$(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const o=t[r];for(;e.length>=2;){const a=e[e.length-1],s=e[e.length-2];if((a.x-s.x)*(o.y-s.y)>=(a.y-s.y)*(o.x-s.x))e.pop();else break}e.push(o)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const o=t[r];for(;n.length>=2;){const a=n[n.length-1],s=n[n.length-2];if((a.x-s.x)*(o.y-s.y)>=(a.y-s.y)*(o.x-s.x))n.pop();else break}n.push(o)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var E$=J_,T$=Q_,A$=X_,I$=Z_,rE=eE;const vr=E$,yr=T$,wr=A$,lr=C.forwardRef(({className:t,sideOffset:e=4,...n},r)=>d.jsx(I$,{children:d.jsx(rE,{ref:r,sideOffset:e,className:ze("z-[1001] overflow-hidden rounded-md bg-primary px-3 py-1.5 text-xs text-primary-foreground animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-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",t),...n})}));lr.displayName=rE.displayName;function k$({title:t,titleId:e,...n},r){return C.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?C.createElement("title",{id:e},t):null,C.createElement("path",{fillRule:"evenodd",d:"M5.47 5.47a.75.75 0 0 1 1.06 0L12 10.94l5.47-5.47a.75.75 0 1 1 1.06 1.06L13.06 12l5.47 5.47a.75.75 0 1 1-1.06 1.06L12 13.06l-5.47 5.47a.75.75 0 0 1-1.06-1.06L10.94 12 5.47 6.53a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))}const N$=C.forwardRef(k$);var P$=function(t){return function(e,n){var r=M.useRef(!1);t(function(){return function(){r.current=!1}},[]),t(function(){if(!r.current)r.current=!0;else return e()},n)}},oE=function(t){return typeof t=="function"},iE=process.env.NODE_ENV==="development"||process.env.NODE_ENV==="test";const O$=P$(M.useEffect);function aE(t){var e=M.useRef(t);return e.current=t,e}var M$=function(t){iE&&(oE(t)||console.error("useUnmount expected parameter is a function, got ".concat(typeof t)));var e=aE(t);M.useEffect(function(){return function(){e.current()}},[])};function R$(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var sE=R$,D$=typeof fo=="object"&&fo&&fo.Object===Object&&fo,L$=D$,F$=L$,$$=typeof self=="object"&&self&&self.Object===Object&&self,H$=F$||$$||Function("return this")(),cE=H$,U$=cE,B$=function(){return U$.Date.now()},z$=B$,V$=/\s/;function K$(t){for(var e=t.length;e--&&V$.test(t.charAt(e)););return e}var G$=K$,j$=G$,W$=/^\s+/;function q$(t){return t&&t.slice(0,j$(t)+1).replace(W$,"")}var Y$=q$,J$=cE,Q$=J$.Symbol,lE=Q$,dE=lE,uE=Object.prototype,X$=uE.hasOwnProperty,Z$=uE.toString,xc=dE?dE.toStringTag:void 0;function eH(t){var e=X$.call(t,xc),n=t[xc];try{t[xc]=void 0;var r=!0}catch{}var o=Z$.call(t);return r&&(e?t[xc]=n:delete t[xc]),o}var tH=eH,nH=Object.prototype,rH=nH.toString;function oH(t){return rH.call(t)}var iH=oH,fE=lE,aH=tH,sH=iH,cH="[object Null]",lH="[object Undefined]",hE=fE?fE.toStringTag:void 0;function dH(t){return t==null?t===void 0?lH:cH:hE&&hE in Object(t)?aH(t):sH(t)}var uH=dH;function fH(t){return t!=null&&typeof t=="object"}var hH=fH,pH=uH,gH=hH,mH="[object Symbol]";function vH(t){return typeof t=="symbol"||gH(t)&&pH(t)==mH}var yH=vH,wH=Y$,pE=sE,CH=yH,gE=NaN,bH=/^[-+]0x[0-9a-f]+$/i,xH=/^0b[01]+$/i,SH=/^0o[0-7]+$/i,_H=parseInt;function EH(t){if(typeof t=="number")return t;if(CH(t))return gE;if(pE(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=pE(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=wH(t);var n=xH.test(t);return n||SH.test(t)?_H(t.slice(2),n?2:8):bH.test(t)?gE:+t}var TH=EH,AH=sE,Zg=z$,mE=TH,IH="Expected a function",kH=Math.max,NH=Math.min;function PH(t,e,n){var r,o,a,s,l,u,h=0,p=!1,g=!1,w=!0;if(typeof t!="function")throw new TypeError(IH);e=mE(e)||0,AH(n)&&(p=!!n.leading,g="maxWait"in n,a=g?kH(mE(n.maxWait)||0,e):a,w="trailing"in n?!!n.trailing:w);function y(D){var H=r,K=o;return r=o=void 0,h=D,s=t.apply(K,H),s}function x(D){return h=D,l=setTimeout(E,e),p?y(D):s}function v(D){var H=D-u,K=D-h,ee=e-H;return g?NH(ee,a-K):ee}function b(D){var H=D-u,K=D-h;return u===void 0||H>=e||H<0||g&&K>=a}function E(){var D=Zg();if(b(D))return T(D);l=setTimeout(E,v(D))}function T(D){return l=void 0,w&&r?y(D):(r=o=void 0,s)}function N(){l!==void 0&&clearTimeout(l),h=0,r=u=o=l=void 0}function P(){return l===void 0?s:T(Zg())}function _(){var D=Zg(),H=b(D);if(r=arguments,o=this,u=D,H){if(l===void 0)return x(u);if(g)return clearTimeout(l),l=setTimeout(E,e),y(u)}return l===void 0&&(l=setTimeout(E,e)),s}return _.cancel=N,_.flush=P,_}var OH=PH;const MH=Ud(OH);function RH(){var t=(typeof global>"u"?"undefined":typeof global)=="object"&&global&&global.Object===Object&&global,e=typeof self=="object"&&self&&self.Object===Object&&self;return t||e}RH()||(global.Date=Date);function DH(t,e){var n;iE&&(oE(t)||console.error("useDebounceFn expected parameter is a function, got ".concat(typeof t)));var r=aE(t),o=(n=e==null?void 0:e.wait)!==null&&n!==void 0?n:1e3,a=M.useMemo(function(){return MH(function(){for(var s=[],l=0;l<arguments.length;l++)s[l]=arguments[l];return r.current.apply(r,tb([],eb(s),!1))},o,e)},[]);return M$(function(){a.cancel()}),{run:a,cancel:a.cancel,flush:a.flush}}function LH(t,e,n){var r=eb(M.useState({}),2),o=r[0],a=r[1],s=DH(function(){a({})},n).run;M.useEffect(function(){return s()},e),O$(t,[o])}const FH=M.forwardRef(({onChange:t},e)=>{const n=M.useRef(null),[r,o]=M.useState("");return M.useImperativeHandle(e,()=>({setValue:a=>{var s;o(a),(s=n.current)==null||s.focus()}})),LH(()=>{t==null||t(r)},[r],{wait:300}),d.jsxs(d.Fragment,{children:[d.jsx(Gn,{ref:n,type:"text",placeholder:"Search files...",value:r,onChange:a=>o(a.target.value),className:"pr-8"}),r&&d.jsx("button",{onClick:()=>{var a;o(""),(a=n.current)==null||a.focus()},className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700",children:d.jsx(N$,{className:"h-5 w-5"})})]})});var zr=(t=>(t.VIEW_DOCUMENT="VIEW_DOCUMENT",t.DOWNLOAD_DOCUMENT="DOWNLOAD_DOCUMENT",t.EDIT_DOCUMENT="EDIT_DOCUMENT",t.OWNER_DOCUMENT="OWNER_DOCUMENT",t))(zr||{});const $H=(t,e)=>{const[n,r]=M.useState([]),[o,a]=M.useState([]),[s,l]=M.useState([]),[u,h]=M.useState([]),{toast:p}=mc(),[g,w]=M.useState(!1),[y,x]=M.useState(!1),v=M.useCallback(async(P,_,D)=>{if(!y){x(!0);try{const H=await Le.post(t+"/document-permission/grandted",{path:P,grandtedBy:_,data:D});return H.status===200&&(p({title:"Phân quyền tài liệu thành công."}),await N(P)),H}catch{return null}finally{x(!1)}}},[]),b=M.useCallback(async()=>{var P;try{return(P=(await Le.get(e+"admin/users/get-all",{params:{limit:1e4}})).data||[])==null?void 0:P.filter(K=>K.role!=="MASTER_ADMIN")}catch(_){return console.error("Error fetchAllUsers",_),[]}},[]),E=M.useCallback(async()=>{try{return(await Le.get(e+"admin/group-users")).data.filter(_=>`${_.groupname}`.toUpperCase()!=="MASTER_ADMIN").map(_=>{var D;return{..._,users:((D=_.users)==null?void 0:D.length)||0}})}catch(P){return console.error("Error fetchAllGroups",P),[]}},[]),T=M.useCallback(async P=>{try{const D=(await Le.get(t+"/document-permission/grandted",{params:{path:P}})).data;return{usersShared:(D==null?void 0:D.users)||[],groupsShared:(D==null?void 0:D.groups)||[]}}catch(_){return console.error("Error fetchShared",_),{usersShared:[],groupsShared:[]}}},[]),N=M.useCallback(async P=>{if(g)return;w(!0);let[_,D,{usersShared:H,groupsShared:K}]=await Promise.all([b(),E(),T(P)]);_=_==null?void 0:_.filter(ee=>!(H!=null&&H.find(W=>W.userId===ee.id))),D=D==null?void 0:D.filter(ee=>!(K!=null&&K.find(W=>W.groupname===ee.groupname))),Array.isArray(_)&&r(_),Array.isArray(D)&&a(D),Array.isArray(H)&&l(H),Array.isArray(K)&&h(K),w(!1)},[]);return{users:n,groups:o,sharedUsers:s,sharedGroups:u,setUsers:r,setGroups:a,setSharedUsers:l,setSharedGroups:h,fetchData:N,loading:g,postGranted:v,loadingGrandted:y}},HH=({failureReasons:t,onNavigateToFile:e})=>{const n=u=>{if(e){const h=u.replace("s3://cts-llm-docs-bucket/","");e(h)}},r=u=>{const h=[];return u.forEach(p=>{try{JSON.parse(p).forEach(w=>{const y=w.match(/\[Files: ([^\]]+)\]/),x=w.match(/^([^[]+)/);if(y&&x&&y[1]&&x[1]){const v=y[1].split(", ").map(T=>T.trim()),b=x[1].trim().replace("Encountered error: ","");let E="unknown";b.includes("invalid metadata attributes")||b.includes("metadata quota")?E="metadata":b.includes("No metadata was provided")||b.includes("metadata file")?E="missing_metadata":b.includes("file size")||b.includes("exceeds")||b.includes("50 MB")?E="file_size":b.includes("format not supported")||b.includes("unsupported format")||b.includes("file type")?E="file_format":b.includes("embedding failed")||b.includes("EMBEDDING_FAILED")?E="embedding_failed":b.includes("indexing failed")||b.includes("INDEXING_FAILED")?E="indexing_failed":b.includes("access denied")||b.includes("AccessDeniedException")||b.includes("permission")?E="access_denied":(b.includes("quota")||b.includes("limit")||b.includes("ServiceQuotaExceededException"))&&(E="quota_exceeded"),h.push({errorMessage:b,files:v,errorType:E})}})}catch{h.push({errorMessage:p,files:[],errorType:"unknown"})}}),h},o=u=>{switch(u){case"metadata":return d.jsx(gi,{className:"h-4 w-4 text-orange-500"});case"missing_metadata":return d.jsx(cg,{className:"h-4 w-4 text-red-500"});case"file_size":return d.jsx(gi,{className:"h-4 w-4 text-yellow-500"});case"file_format":return d.jsx(cg,{className:"h-4 w-4 text-purple-500"});case"embedding_failed":return d.jsx(gi,{className:"h-4 w-4 text-red-600"});case"indexing_failed":return d.jsx(gi,{className:"h-4 w-4 text-red-600"});case"access_denied":return d.jsx(gi,{className:"h-4 w-4 text-red-700"});case"quota_exceeded":return d.jsx(gi,{className:"h-4 w-4 text-orange-600"});default:return d.jsx(gi,{className:"h-4 w-4 text-red-500"})}},a=u=>{switch(u){case"metadata":return"border-orange-200 bg-orange-50";case"missing_metadata":return"border-red-200 bg-red-50";case"file_size":return"border-yellow-200 bg-yellow-50";case"file_format":return"border-purple-200 bg-purple-50";case"embedding_failed":return"border-red-300 bg-red-100";case"indexing_failed":return"border-red-300 bg-red-100";case"access_denied":return"border-red-400 bg-red-100";case"quota_exceeded":return"border-orange-300 bg-orange-100";default:return"border-red-200 bg-red-50"}},s=u=>{switch(u){case"metadata":return"text-orange-800";case"missing_metadata":return"text-red-800";case"file_size":return"text-yellow-800";case"file_format":return"text-purple-800";case"embedding_failed":return"text-red-900";case"indexing_failed":return"text-red-900";case"access_denied":return"text-red-900";case"quota_exceeded":return"text-orange-900";default:return"text-red-800"}},l=r(t);return l.length===0?null:d.jsxs("div",{className:"border-t pt-2",children:[d.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[d.jsx(gi,{className:"h-4 w-4 text-red-500"}),d.jsxs("p",{className:"text-red-600 font-medium",children:["Các file lỗi (",l.reduce((u,h)=>u+h.files.length,0)," file)"]})]}),d.jsx("div",{className:"space-y-3 max-h-80 overflow-y-auto",children:l.map((u,h)=>d.jsxs("div",{className:`p-3 rounded-lg border ${a(u.errorType)}`,children:[d.jsx("div",{className:"flex items-start justify-between",children:d.jsxs("div",{className:"flex items-start gap-2 flex-1",children:[o(u.errorType),d.jsxs("div",{className:"flex-1",children:[d.jsx("p",{className:`font-medium text-sm ${s(u.errorType)}`,children:u.errorMessage}),u.files.length>0&&d.jsxs("p",{className:"text-xs text-gray-600 mt-1",children:[u.files.length," file bị ảnh hưởng"]})]})]})}),u.files.length>0&&d.jsxs("div",{className:"mt-3 pt-2 border-t border-gray-200",children:[d.jsx("p",{className:"text-xs font-medium text-gray-700 mb-2",children:"Danh sách file lỗi:"}),d.jsx("div",{className:"max-h-32 overflow-y-auto space-y-1",children:u.files.map((p,g)=>d.jsxs("div",{className:"flex items-center gap-2 text-xs p-2 bg-white/50 rounded hover:bg-white/80 transition-colors",children:[d.jsx(cg,{className:"h-3 w-3 text-red-400 flex-shrink-0"}),e?d.jsxs("button",{onClick:()=>n(p),className:"text-blue-600 hover:text-blue-800 underline break-all font-mono text-left flex-1 flex items-center gap-1",title:"Nhấp để điều hướng đến file",children:[d.jsx("span",{children:p.replace("s3://cts-llm-docs-bucket/","")}),d.jsx(VD,{className:"h-3 w-3 flex-shrink-0"})]}):d.jsx("span",{className:"text-gray-700 break-all font-mono",children:p.replace("s3://cts-llm-docs-bucket/","")})]},g))})]})]},h))})]})};var em={exports:{}},Cu={exports:{}},yt={};/** @license React v16.13.1
205
205
  * react-is.production.min.js
206
206
  *
207
207
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -224,7 +224,7 @@ Valid keys: `+JSON.stringify(Object.keys($),null," "));var ne=Ne(z,Ce,xe,Pe,Te+
224
224
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function cU(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function lU(t){if(Array.isArray(t))return dm(t)}function RE(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function DE(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?RE(Object(n),!0).forEach(function(r){LE(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):RE(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function LE(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Sc(t,e){return fU(t)||uU(t,e)||FE(t,e)||dU()}function dU(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
225
225
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FE(t,e){if(t){if(typeof t=="string")return dm(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return dm(t,e)}}function dm(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function uU(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],o=!0,a=!1,s,l;try{for(n=n.call(t);!(o=(s=n.next()).done)&&(r.push(s.value),!(e&&r.length===e));o=!0);}catch(u){a=!0,l=u}finally{try{!o&&n.return!=null&&n.return()}finally{if(a)throw l}}return r}}function fU(t){if(Array.isArray(t))return t}var hU=typeof lm=="function"?lm:lm.default,pU="file-invalid-type",gU="file-too-large",mU="file-too-small",vU="too-many-files",yU=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"",n=e.split(","),r=n.length>1?"one of ".concat(n.join(", ")):n[0];return{code:pU,message:"File type must be ".concat(r)}},$E=function(e){return{code:gU,message:"File is larger than ".concat(e," ").concat(e===1?"byte":"bytes")}},HE=function(e){return{code:mU,message:"File is smaller than ".concat(e," ").concat(e===1?"byte":"bytes")}},wU={code:vU,message:"Too many files"};function UE(t,e){var n=t.type==="application/x-moz-file"||hU(t,e);return[n,n?null:yU(e)]}function BE(t,e,n){if(Xi(t.size))if(Xi(e)&&Xi(n)){if(t.size>n)return[!1,$E(n)];if(t.size<e)return[!1,HE(e)]}else{if(Xi(e)&&t.size<e)return[!1,HE(e)];if(Xi(n)&&t.size>n)return[!1,$E(n)]}return[!0,null]}function Xi(t){return t!=null}function CU(t){var e=t.files,n=t.accept,r=t.minSize,o=t.maxSize,a=t.multiple,s=t.maxFiles,l=t.validator;return!a&&e.length>1||a&&s>=1&&e.length>s?!1:e.every(function(u){var h=UE(u,n),p=Sc(h,1),g=p[0],w=BE(u,r,o),y=Sc(w,1),x=y[0],v=l?l(u):null;return g&&x&&!v})}function xu(t){return typeof t.isPropagationStopped=="function"?t.isPropagationStopped():typeof t.cancelBubble<"u"?t.cancelBubble:!1}function Su(t){return t.dataTransfer?Array.prototype.some.call(t.dataTransfer.types,function(e){return e==="Files"||e==="application/x-moz-file"}):!!t.target&&!!t.target.files}function zE(t){t.preventDefault()}function bU(t){return t.indexOf("MSIE")!==-1||t.indexOf("Trident/")!==-1}function xU(t){return t.indexOf("Edge/")!==-1}function SU(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:window.navigator.userAgent;return bU(t)||xU(t)}function yo(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(r){for(var o=arguments.length,a=new Array(o>1?o-1:0),s=1;s<o;s++)a[s-1]=arguments[s];return e.some(function(l){return!xu(r)&&l&&l.apply(void 0,[r].concat(a)),xu(r)})}}function _U(){return"showOpenFilePicker"in window}function EU(t){if(Xi(t)){var e=Object.entries(t).filter(function(n){var r=Sc(n,2),o=r[0],a=r[1],s=!0;return VE(o)||(console.warn('Skipped "'.concat(o,'" because it is not a valid MIME type. Check https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types for a list of valid MIME types.')),s=!1),(!Array.isArray(a)||!a.every(KE))&&(console.warn('Skipped "'.concat(o,'" because an invalid file extension was provided.')),s=!1),s}).reduce(function(n,r){var o=Sc(r,2),a=o[0],s=o[1];return DE(DE({},n),{},LE({},a,s))},{});return[{description:"Files",accept:e}]}return t}function TU(t){if(Xi(t))return Object.entries(t).reduce(function(e,n){var r=Sc(n,2),o=r[0],a=r[1];return[].concat(ME(e),[o],ME(a))},[]).filter(function(e){return VE(e)||KE(e)}).join(",")}function AU(t){return t instanceof DOMException&&(t.name==="AbortError"||t.code===t.ABORT_ERR)}function IU(t){return t instanceof DOMException&&(t.name==="SecurityError"||t.code===t.SECURITY_ERR)}function VE(t){return t==="audio/*"||t==="video/*"||t==="image/*"||t==="text/*"||t==="application/*"||/\w+\/[-+.\w]+/g.test(t)}function KE(t){return/^.*\.[\w]+$/.test(t)}var kU=["children"],NU=["open"],PU=["refKey","role","onKeyDown","onFocus","onBlur","onClick","onDragEnter","onDragOver","onDragLeave","onDrop"],OU=["refKey","onChange","onClick"];function MU(t){return LU(t)||DU(t)||GE(t)||RU()}function RU(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
226
226
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DU(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function LU(t){if(Array.isArray(t))return fm(t)}function um(t,e){return HU(t)||$U(t,e)||GE(t,e)||FU()}function FU(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
227
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GE(t,e){if(t){if(typeof t=="string")return fm(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fm(t,e)}}function fm(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function $U(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],o=!0,a=!1,s,l;try{for(n=n.call(t);!(o=(s=n.next()).done)&&(r.push(s.value),!(e&&r.length===e));o=!0);}catch(u){a=!0,l=u}finally{try{!o&&n.return!=null&&n.return()}finally{if(a)throw l}}return r}}function HU(t){if(Array.isArray(t))return t}function jE(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Bt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jE(Object(n),!0).forEach(function(r){hm(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jE(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hm(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _u(t,e){if(t==null)return{};var n=UU(t,e),r,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(o=0;o<a.length;o++)r=a[o],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function UU(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,a;for(a=0;a<r.length;a++)o=r[a],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}var pm=M.forwardRef(function(t,e){var n=t.children,r=_u(t,kU),o=qE(r),a=o.open,s=_u(o,NU);return M.useImperativeHandle(e,function(){return{open:a}},[a]),M.createElement(M.Fragment,null,n(Bt(Bt({},s),{},{open:a})))});pm.displayName="Dropzone";var WE={disabled:!1,getFilesFromEvent:XH,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};pm.defaultProps=WE,pm.propTypes={children:Nt.func,accept:Nt.objectOf(Nt.arrayOf(Nt.string)),multiple:Nt.bool,preventDropOnDocument:Nt.bool,noClick:Nt.bool,noKeyboard:Nt.bool,noDrag:Nt.bool,noDragEventsBubbling:Nt.bool,minSize:Nt.number,maxSize:Nt.number,maxFiles:Nt.number,disabled:Nt.bool,getFilesFromEvent:Nt.func,onFileDialogCancel:Nt.func,onFileDialogOpen:Nt.func,useFsAccessApi:Nt.bool,autoFocus:Nt.bool,onDragEnter:Nt.func,onDragLeave:Nt.func,onDragOver:Nt.func,onDrop:Nt.func,onDropAccepted:Nt.func,onDropRejected:Nt.func,onError:Nt.func,validator:Nt.func};var gm={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function qE(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=Bt(Bt({},WE),t),n=e.accept,r=e.disabled,o=e.getFilesFromEvent,a=e.maxSize,s=e.minSize,l=e.multiple,u=e.maxFiles,h=e.onDragEnter,p=e.onDragLeave,g=e.onDragOver,w=e.onDrop,y=e.onDropAccepted,x=e.onDropRejected,v=e.onFileDialogCancel,b=e.onFileDialogOpen,E=e.useFsAccessApi,T=e.autoFocus,N=e.preventDropOnDocument,P=e.noClick,_=e.noKeyboard,D=e.noDrag,H=e.noDragEventsBubbling,K=e.onError,ee=e.validator,W=M.useMemo(function(){return TU(n)},[n]),de=M.useMemo(function(){return EU(n)},[n]),se=M.useMemo(function(){return typeof b=="function"?b:YE},[b]),fe=M.useMemo(function(){return typeof v=="function"?v:YE},[v]),q=M.useRef(null),Z=M.useRef(null),Y=M.useReducer(BU,gm),oe=um(Y,2),Q=oe[0],X=oe[1],$=Q.isFocused,te=Q.isFileDialogActive,_e=M.useRef(typeof window<"u"&&window.isSecureContext&&E&&_U()),ke=function(){!_e.current&&te&&setTimeout(function(){if(Z.current){var ae=Z.current.files;ae.length||(X({type:"closeDialog"}),fe())}},300)};M.useEffect(function(){return window.addEventListener("focus",ke,!1),function(){window.removeEventListener("focus",ke,!1)}},[Z,te,fe,_e]);var xe=M.useRef([]),Pe=function(ae){q.current&&q.current.contains(ae.target)||(ae.preventDefault(),xe.current=[])};M.useEffect(function(){return N&&(document.addEventListener("dragover",zE,!1),document.addEventListener("drop",Pe,!1)),function(){N&&(document.removeEventListener("dragover",zE),document.removeEventListener("drop",Pe))}},[q,N]),M.useEffect(function(){return!r&&T&&q.current&&q.current.focus(),function(){}},[q,T,r]);var Te=M.useCallback(function(U){K?K(U):console.error(U)},[K]),z=M.useCallback(function(U){U.preventDefault(),U.persist(),Rn(U),xe.current=[].concat(MU(xe.current),[U.target]),Su(U)&&Promise.resolve(o(U)).then(function(ae){if(!(xu(U)&&!H)){var ye=ae.length,he=ye>0&&CU({files:ae,accept:W,minSize:s,maxSize:a,multiple:l,maxFiles:u,validator:ee}),Ee=ye>0&&!he;X({isDragAccept:he,isDragReject:Ee,isDragActive:!0,type:"setDraggedFiles"}),h&&h(U)}}).catch(function(ae){return Te(ae)})},[o,h,Te,H,W,s,a,l,u,ee]),ce=M.useCallback(function(U){U.preventDefault(),U.persist(),Rn(U);var ae=Su(U);if(ae&&U.dataTransfer)try{U.dataTransfer.dropEffect="copy"}catch{}return ae&&g&&g(U),!1},[g,H]),Ae=M.useCallback(function(U){U.preventDefault(),U.persist(),Rn(U);var ae=xe.current.filter(function(he){return q.current&&q.current.contains(he)}),ye=ae.indexOf(U.target);ye!==-1&&ae.splice(ye,1),xe.current=ae,!(ae.length>0)&&(X({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Su(U)&&p&&p(U))},[q,p,H]),Ce=M.useCallback(function(U,ae){var ye=[],he=[];U.forEach(function(Ee){var Xe=UE(Ee,W),ft=um(Xe,2),xt=ft[0],bo=ft[1],Jt=BE(Ee,s,a),vn=um(Jt,2),jr=vn[0],Gt=vn[1],dr=ee?ee(Ee):null;if(xt&&jr&&!dr)ye.push(Ee);else{var Wr=[bo,Gt];dr&&(Wr=Wr.concat(dr)),he.push({file:Ee,errors:Wr.filter(function(ia){return ia})})}}),(!l&&ye.length>1||l&&u>=1&&ye.length>u)&&(ye.forEach(function(Ee){he.push({file:Ee,errors:[wU]})}),ye.splice(0)),X({acceptedFiles:ye,fileRejections:he,isDragReject:he.length>0,type:"setFiles"}),w&&w(ye,he,ae),he.length>0&&x&&x(he,ae),ye.length>0&&y&&y(ye,ae)},[X,l,W,s,a,u,w,y,x,ee]),Ne=M.useCallback(function(U){U.preventDefault(),U.persist(),Rn(U),xe.current=[],Su(U)&&Promise.resolve(o(U)).then(function(ae){xu(U)&&!H||Ce(ae,U)}).catch(function(ae){return Te(ae)}),X({type:"reset"})},[o,Ce,Te,H]),ne=M.useCallback(function(){if(_e.current){X({type:"openDialog"}),se();var U={multiple:l,types:de};window.showOpenFilePicker(U).then(function(ae){return o(ae)}).then(function(ae){Ce(ae,null),X({type:"closeDialog"})}).catch(function(ae){AU(ae)?(fe(ae),X({type:"closeDialog"})):IU(ae)?(_e.current=!1,Z.current?(Z.current.value=null,Z.current.click()):Te(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):Te(ae)});return}Z.current&&(X({type:"openDialog"}),se(),Z.current.value=null,Z.current.click())},[X,se,fe,E,Ce,Te,de,l]),Ve=M.useCallback(function(U){!q.current||!q.current.isEqualNode(U.target)||(U.key===" "||U.key==="Enter"||U.keyCode===32||U.keyCode===13)&&(U.preventDefault(),ne())},[q,ne]),Qe=M.useCallback(function(){X({type:"focus"})},[]),Ct=M.useCallback(function(){X({type:"blur"})},[]),Yt=M.useCallback(function(){P||(SU()?setTimeout(ne,0):ne())},[P,ne]),bt=function(ae){return r?null:ae},rn=function(ae){return _?null:bt(ae)},zt=function(ae){return D?null:bt(ae)},Rn=function(ae){H&&ae.stopPropagation()},Kt=M.useMemo(function(){return function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ae=U.refKey,ye=ae===void 0?"ref":ae,he=U.role,Ee=U.onKeyDown,Xe=U.onFocus,ft=U.onBlur,xt=U.onClick,bo=U.onDragEnter,Jt=U.onDragOver,vn=U.onDragLeave,jr=U.onDrop,Gt=_u(U,PU);return Bt(Bt(hm({onKeyDown:rn(yo(Ee,Ve)),onFocus:rn(yo(Xe,Qe)),onBlur:rn(yo(ft,Ct)),onClick:bt(yo(xt,Yt)),onDragEnter:zt(yo(bo,z)),onDragOver:zt(yo(Jt,ce)),onDragLeave:zt(yo(vn,Ae)),onDrop:zt(yo(jr,Ne)),role:typeof he=="string"&&he!==""?he:"presentation"},ye,q),!r&&!_?{tabIndex:0}:{}),Gt)}},[q,Ve,Qe,Ct,Yt,z,ce,Ae,Ne,_,D,r]),L=M.useCallback(function(U){U.stopPropagation()},[]),J=M.useMemo(function(){return function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ae=U.refKey,ye=ae===void 0?"ref":ae,he=U.onChange,Ee=U.onClick,Xe=_u(U,OU),ft=hm({accept:W,multiple:l,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:bt(yo(he,Ne)),onClick:bt(yo(Ee,L)),tabIndex:-1},ye,Z);return Bt(Bt({},ft),Xe)}},[Z,n,l,Ne,r]);return Bt(Bt({},Q),{},{isFocused:$&&!r,getRootProps:Kt,getInputProps:J,rootRef:q,inputRef:Z,open:bt(ne)})}function BU(t,e){switch(e.type){case"focus":return Bt(Bt({},t),{},{isFocused:!0});case"blur":return Bt(Bt({},t),{},{isFocused:!1});case"openDialog":return Bt(Bt({},gm),{},{isFileDialogActive:!0});case"closeDialog":return Bt(Bt({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return Bt(Bt({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return Bt(Bt({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return Bt({},gm);default:return t}}function YE(){}const zU=({onFilesSelected:t,children:e})=>{const[n,r]=M.useState(!1),{getRootProps:o,getInputProps:a}=qE({noClick:!0,onDrop:s=>{if(s&&s.length>0)if(s[0].path.split("/").length>2){const u=s.map(h=>{const g=(h.path||h.relativePath||"").split("/").slice(1).join("/");return(!h.webkitRelativePath||h.webkitRelativePath==="")&&Object.defineProperty(h,"webkitRelativePath",{writable:!0,value:g,enumerable:!0,configurable:!0}),h});t(u,"folder")}else t(s,"files");r(!1)},onDragOver:s=>{s.preventDefault(),n||r(!0)},multiple:!0});return M.useEffect(()=>{const s=l=>{l.clientX===0&&l.clientY===0&&r(!1)};return document.addEventListener("dragleave",s),()=>{document.removeEventListener("dragleave",s)}},[]),d.jsxs("div",{...o(),className:"transition-opacity min-h-[600px]",children:[n?d.jsx("div",{className:"flex flex-col items-center justify-center p-4 border-2 border-dashed border-gray-300 rounded-lg bg-gray-50 h-screen"}):e,d.jsx("input",{...a()})]})},VU=({openDialogRename:t,setOpenDialogRename:e,apiBaseUrl:n,setFileToMove:r,fileToMove:o,refreshFiles:a,ignoreCache:s,autoSyncAfterFileOperation:l})=>{var N;const[u,h]=M.useState({}),[p,g]=M.useState(!1),[w,y]=M.useState(!1),[x,v]=M.useState(""),{toast:b}=mc();M.useEffect(()=>{t&&E(x)},[x,t]);const E=async P=>{try{y(!0);const _=await Le.get(`${n}/api/list-s3-folders?prefix=${P}`);h(_==null?void 0:_.data)}catch{b({title:"Error",description:"Unable to load S3 folder list",variant:"destructive"})}finally{y(!1)}},T=async()=>{g(!0);try{const P=o.key,_=P.endsWith("/")?P:`${P}/`,D=x.endsWith("/")?x:`${x}/`;if(_===D||P===x){b({title:"Lỗi",description:"Không thể di chuyển file đến cùng vị trí",variant:"destructive"}),g(!1);return}await Le.post(`${n}/api/move`,{oldPath:P,newPath:x}),s.current=!0,await a(),b({title:"Đã di chuyển",description:`Đã di chuyển thành công "${o.name}" đến "${x}"`}),e(!1),r(null),v(""),l&&await l("move")}catch(P){console.error("Error renaming item:",P),b({title:"Lỗi",description:"Không thể đổi tên",variant:"destructive"})}finally{g(!1)}};return d.jsx(ar,{open:t,onOpenChange:P=>{P||(e(!1),r(null),v(""))},children:d.jsxs(zn,{className:"max-h-[700px] pb-3 px-1 s3-explr-input-group max-w-5xl w-[90%] p-6 bg-white rounded-lg shadow-lg",children:[d.jsxs(Vn,{className:"mb-4 w-full h-full",children:[d.jsx("nav",{className:"mb-4",children:d.jsxs("ul",{className:"flex items-center space-x-2 text-sm text-gray-600",children:[d.jsx("li",{className:"cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>v(""),children:"Root"}),x.split("/").map((P,_,D)=>d.jsx("li",{className:"cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>v(P==="Root"?"":D.slice(0,_+1).join("/")+"/"),children:P},_))]})}),d.jsxs(Kn,{className:"text-xl font-semibold text-gray-800",children:["Di chuyển"," ",d.jsxs("span",{className:"text-sm text-gray-500",children:["( file hoặc folder sẽ được di chuyển đến thư mục"," ",x===""?"Root":x," )"]})]}),d.jsx(Ci,{className:"text-gray-600 w-full h-[50dvh] max-h-[500px] overflow-hidden overflow-y-auto",children:w?d.jsx("div",{className:"flex justify-center items-center py-4",children:d.jsx("div",{className:"loader ease-linear rounded-full border-4 border-t-4 border-gray-200 h-12 w-12"})}):d.jsx("ul",{className:"space-y-2",children:(N=Object.keys(u))==null?void 0:N.map(P=>d.jsx("li",{className:"cursor-pointer hover:bg-gray-100 p-2 rounded transition-colors",onClick:()=>v(P),children:P},P))})})]}),d.jsxs(Fr,{className:"flex justify-end space-x-2",children:[d.jsx(He,{variant:"outline",onClick:()=>e(!1),className:"px-4 py-2 rounded border border-gray-300 text-gray-700 hover:bg-gray-100 transition-colors",children:"Cancel"}),d.jsx(He,{onClick:T,disabled:p,className:"s3-explr-crawl-btn",children:"Move"})]})]})})};function JE(t,[e,n]){return Math.min(n,Math.max(e,t))}function KU(t){const e=t+"CollectionProvider",[n,r]=gr(e),[o,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:b,children:E}=v,T=M.useRef(null),N=M.useRef(new Map).current;return d.jsx(o,{scope:b,itemMap:N,collectionRef:T,children:E})};s.displayName=e;const l=t+"CollectionSlot",u=mi(l),h=M.forwardRef((v,b)=>{const{scope:E,children:T}=v,N=a(l,E),P=rt(b,N.collectionRef);return d.jsx(u,{ref:P,children:T})});h.displayName=l;const p=t+"CollectionItemSlot",g="data-radix-collection-item",w=mi(p),y=M.forwardRef((v,b)=>{const{scope:E,children:T,...N}=v,P=M.useRef(null),_=rt(b,P),D=a(p,E);return M.useEffect(()=>(D.itemMap.set(P,{ref:P,...N}),()=>void D.itemMap.delete(P))),d.jsx(w,{[g]:"",ref:_,children:T})});y.displayName=p;function x(v){const b=a(t+"CollectionConsumer",v);return M.useCallback(()=>{const T=b.collectionRef.current;if(!T)return[];const N=Array.from(T.querySelectorAll(`[${g}]`));return Array.from(b.itemMap.values()).sort((D,H)=>N.indexOf(D.ref.current)-N.indexOf(H.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:s,Slot:h,ItemSlot:y},x,r]}var GU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],mn=GU.reduce((t,e)=>{const n=mi(`Primitive.${e}`),r=C.forwardRef((o,a)=>{const{asChild:s,...l}=o,u=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(u,{...l,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function jU(t,e){t&&Ia.flushSync(()=>t.dispatchEvent(e))}var WU="DismissableLayer",mm="dismissableLayer.update",qU="dismissableLayer.pointerDownOutside",YU="dismissableLayer.focusOutside",QE,XE=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ZE=C.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:s,onDismiss:l,...u}=t,h=C.useContext(XE),[p,g]=C.useState(null),w=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=C.useState({}),x=rt(e,H=>g(H)),v=Array.from(h.layers),[b]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),E=v.indexOf(b),T=p?v.indexOf(p):-1,N=h.layersWithOutsidePointerEventsDisabled.size>0,P=T>=E,_=XU(H=>{const K=H.target,ee=[...h.branches].some(W=>W.contains(K));!P||ee||(o==null||o(H),s==null||s(H),H.defaultPrevented||l==null||l())},w),D=ZU(H=>{const K=H.target;[...h.branches].some(W=>W.contains(K))||(a==null||a(H),s==null||s(H),H.defaultPrevented||l==null||l())},w);return HC(H=>{T===h.layers.size-1&&(r==null||r(H),!H.defaultPrevented&&l&&(H.preventDefault(),l()))},w),C.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(QE=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),eT(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=QE)}},[p,w,n,h]),C.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),eT())},[p,h]),C.useEffect(()=>{const H=()=>y({});return document.addEventListener(mm,H),()=>document.removeEventListener(mm,H)},[]),d.jsx(mn.div,{...u,ref:x,style:{pointerEvents:N?P?"auto":"none":void 0,...t.style},onFocusCapture:Ue(t.onFocusCapture,D.onFocusCapture),onBlurCapture:Ue(t.onBlurCapture,D.onBlurCapture),onPointerDownCapture:Ue(t.onPointerDownCapture,_.onPointerDownCapture)})});ZE.displayName=WU;var JU="DismissableLayerBranch",QU=C.forwardRef((t,e)=>{const n=C.useContext(XE),r=C.useRef(null),o=rt(e,r);return C.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),d.jsx(mn.div,{...t,ref:o})});QU.displayName=JU;function XU(t,e=globalThis==null?void 0:globalThis.document){const n=gn(t),r=C.useRef(!1),o=C.useRef(()=>{});return C.useEffect(()=>{const a=l=>{if(l.target&&!r.current){let u=function(){tT(qU,n,h,{discrete:!0})};const h={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=u,e.addEventListener("click",o.current,{once:!0})):u()}else e.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",a),e.removeEventListener("click",o.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function ZU(t,e=globalThis==null?void 0:globalThis.document){const n=gn(t),r=C.useRef(!1);return C.useEffect(()=>{const o=a=>{a.target&&!r.current&&tT(YU,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function eT(){const t=new CustomEvent(mm);document.dispatchEvent(t)}function tT(t,e,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?jU(o,a):o.dispatchEvent(a)}var vm="focusScope.autoFocusOnMount",ym="focusScope.autoFocusOnUnmount",nT={bubbles:!1,cancelable:!0},eB="FocusScope",rT=C.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...s}=t,[l,u]=C.useState(null),h=gn(o),p=gn(a),g=C.useRef(null),w=rt(e,v=>u(v)),y=C.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;C.useEffect(()=>{if(r){let v=function(N){if(y.paused||!l)return;const P=N.target;l.contains(P)?g.current=P:Si(g.current,{select:!0})},b=function(N){if(y.paused||!l)return;const P=N.relatedTarget;P!==null&&(l.contains(P)||Si(g.current,{select:!0}))},E=function(N){if(document.activeElement===document.body)for(const _ of N)_.removedNodes.length>0&&Si(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",b);const T=new MutationObserver(E);return l&&T.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",b),T.disconnect()}}},[r,l,y.paused]),C.useEffect(()=>{if(l){aT.add(y);const v=document.activeElement;if(!l.contains(v)){const E=new CustomEvent(vm,nT);l.addEventListener(vm,h),l.dispatchEvent(E),E.defaultPrevented||(tB(aB(oT(l)),{select:!0}),document.activeElement===v&&Si(l))}return()=>{l.removeEventListener(vm,h),setTimeout(()=>{const E=new CustomEvent(ym,nT);l.addEventListener(ym,p),l.dispatchEvent(E),E.defaultPrevented||Si(v??document.body,{select:!0}),l.removeEventListener(ym,p),aT.remove(y)},0)}}},[l,h,p,y]);const x=C.useCallback(v=>{if(!n&&!r||y.paused)return;const b=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,E=document.activeElement;if(b&&E){const T=v.currentTarget,[N,P]=nB(T);N&&P?!v.shiftKey&&E===P?(v.preventDefault(),n&&Si(N,{select:!0})):v.shiftKey&&E===N&&(v.preventDefault(),n&&Si(P,{select:!0})):E===T&&v.preventDefault()}},[n,r,y.paused]);return d.jsx(mn.div,{tabIndex:-1,...s,ref:w,onKeyDown:x})});rT.displayName=eB;function tB(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Si(r,{select:e}),document.activeElement!==n)return}function nB(t){const e=oT(t),n=iT(e,t),r=iT(e.reverse(),t);return[n,r]}function oT(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function iT(t,e){for(const n of t)if(!rB(n,{upTo:e}))return n}function rB(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function oB(t){return t instanceof HTMLInputElement&&"select"in t}function Si(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&oB(t)&&e&&t.select()}}var aT=iB();function iB(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=sT(t,e),t.unshift(e)},remove(e){var n;t=sT(t,e),(n=t[0])==null||n.resume()}}}function sT(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function aB(t){return t.filter(e=>e.tagName!=="A")}var sB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],cB=sB.reduce((t,e)=>{const n=mi(`Primitive.${e}`),r=C.forwardRef((o,a)=>{const{asChild:s,...l}=o,u=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(u,{...l,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),lB="Arrow",cT=C.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...a}=t;return d.jsx(cB.svg,{...a,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});cT.displayName=lB;var dB=cT,uB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lT=uB.reduce((t,e)=>{const n=mi(`Primitive.${e}`),r=C.forwardRef((o,a)=>{const{asChild:s,...l}=o,u=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(u,{...l,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),wm="Popper",[dT,uT]=gr(wm),[fB,fT]=dT(wm),hT=t=>{const{__scopePopper:e,children:n}=t,[r,o]=C.useState(null);return d.jsx(fB,{scope:e,anchor:r,onAnchorChange:o,children:n})};hT.displayName=wm;var pT="PopperAnchor",gT=C.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,a=fT(pT,n),s=C.useRef(null),l=rt(e,s);return C.useEffect(()=>{a.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:d.jsx(lT.div,{...o,ref:l})});gT.displayName=pT;var Cm="PopperContent",[hB,pB]=dT(Cm),mT=C.forwardRef((t,e)=>{var z,ce,Ae,Ce,Ne,ne;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:a="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:p=0,sticky:g="partial",hideWhenDetached:w=!1,updatePositionStrategy:y="optimized",onPlaced:x,...v}=t,b=fT(Cm,n),[E,T]=C.useState(null),N=rt(e,Ve=>T(Ve)),[P,_]=C.useState(null),D=vg(P),H=(D==null?void 0:D.width)??0,K=(D==null?void 0:D.height)??0,ee=r+(a!=="center"?"-"+a:""),W=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},de=Array.isArray(h)?h:[h],se=de.length>0,fe={padding:W,boundary:de.filter(mB),altBoundary:se},{refs:q,floatingStyles:Z,placement:Y,isPositioned:oe,middlewareData:Q}=k_({strategy:"fixed",placement:ee,whileElementsMounted:(...Ve)=>E_(...Ve,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[N_({mainAxis:o+K,alignmentAxis:s}),u&&P_({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?O_():void 0,...fe}),u&&M_({...fe}),R_({...fe,apply:({elements:Ve,rects:Qe,availableWidth:Ct,availableHeight:Yt})=>{const{width:bt,height:rn}=Qe.reference,zt=Ve.floating.style;zt.setProperty("--radix-popper-available-width",`${Ct}px`),zt.setProperty("--radix-popper-available-height",`${Yt}px`),zt.setProperty("--radix-popper-anchor-width",`${bt}px`),zt.setProperty("--radix-popper-anchor-height",`${rn}px`)}}),P&&L_({element:P,padding:l}),vB({arrowWidth:H,arrowHeight:K}),w&&D_({strategy:"referenceHidden",...fe})]}),[X,$]=wT(Y),te=gn(x);tn(()=>{oe&&(te==null||te())},[oe,te]);const _e=(z=Q.arrow)==null?void 0:z.x,ke=(ce=Q.arrow)==null?void 0:ce.y,xe=((Ae=Q.arrow)==null?void 0:Ae.centerOffset)!==0,[Pe,Te]=C.useState();return tn(()=>{E&&Te(window.getComputedStyle(E).zIndex)},[E]),d.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:oe?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Pe,"--radix-popper-transform-origin":[(Ce=Q.transformOrigin)==null?void 0:Ce.x,(Ne=Q.transformOrigin)==null?void 0:Ne.y].join(" "),...((ne=Q.hide)==null?void 0:ne.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:d.jsx(hB,{scope:n,placedSide:X,onArrowChange:_,arrowX:_e,arrowY:ke,shouldHideArrow:xe,children:d.jsx(lT.div,{"data-side":X,"data-align":$,...v,ref:N,style:{...v.style,animation:oe?void 0:"none"}})})})});mT.displayName=Cm;var vT="PopperArrow",gB={top:"bottom",right:"left",bottom:"top",left:"right"},yT=C.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,a=pB(vT,r),s=gB[a.placedSide];return d.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:d.jsx(dB,{...o,ref:n,style:{...o.style,display:"block"}})})});yT.displayName=vT;function mB(t){return t!==null}var vB=t=>({name:"transformOrigin",options:t,fn(e){var b,E,T;const{placement:n,rects:r,middlewareData:o}=e,s=((b=o.arrow)==null?void 0:b.centerOffset)!==0,l=s?0:t.arrowWidth,u=s?0:t.arrowHeight,[h,p]=wT(n),g={start:"0%",center:"50%",end:"100%"}[p],w=(((E=o.arrow)==null?void 0:E.x)??0)+l/2,y=(((T=o.arrow)==null?void 0:T.y)??0)+u/2;let x="",v="";return h==="bottom"?(x=s?g:`${w}px`,v=`${-u}px`):h==="top"?(x=s?g:`${w}px`,v=`${r.floating.height+u}px`):h==="right"?(x=`${-u}px`,v=s?g:`${y}px`):h==="left"&&(x=`${r.floating.width+u}px`,v=s?g:`${y}px`),{data:{x,y:v}}}});function wT(t){const[e,n="center"]=t.split("-");return[e,n]}var yB=hT,wB=gT,CB=mT,bB=yT,xB="Portal",CT=C.forwardRef((t,e)=>{var l;const{container:n,...r}=t,[o,a]=C.useState(!1);tn(()=>a(!0),[]);const s=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?Vf.createPortal(d.jsx(mn.div,{...r,ref:e}),s):null});CT.displayName=xB;var SB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_B=SB.reduce((t,e)=>{const n=mi(`Primitive.${e}`),r=C.forwardRef((o,a)=>{const{asChild:s,...l}=o,u=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(u,{...l,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),bT=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"}),EB="VisuallyHidden",TB=C.forwardRef((t,e)=>d.jsx(_B.span,{...t,ref:e,style:{...bT,...t.style}}));TB.displayName=EB;var AB=[" ","Enter","ArrowUp","ArrowDown"],IB=[" ","Enter"],Zi="Select",[Eu,Tu,kB]=KU(Zi),[is,zj]=gr(Zi,[kB,uT]),Au=uT(),[NB,_i]=is(Zi),[PB,OB]=is(Zi),xT=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:o,onOpenChange:a,value:s,defaultValue:l,onValueChange:u,dir:h,name:p,autoComplete:g,disabled:w,required:y,form:x}=t,v=Au(e),[b,E]=C.useState(null),[T,N]=C.useState(null),[P,_]=C.useState(!1),D=Cg(h),[H,K]=ui({prop:r,defaultProp:o??!1,onChange:a,caller:Zi}),[ee,W]=ui({prop:s,defaultProp:l,onChange:u,caller:Zi}),de=C.useRef(null),se=b?x||!!b.closest("form"):!0,[fe,q]=C.useState(new Set),Z=Array.from(fe).map(Y=>Y.props.value).join(";");return d.jsx(yB,{...v,children:d.jsxs(NB,{required:y,scope:e,trigger:b,onTriggerChange:E,valueNode:T,onValueNodeChange:N,valueNodeHasChildren:P,onValueNodeHasChildrenChange:_,contentId:Mo(),value:ee,onValueChange:W,open:H,onOpenChange:K,dir:D,triggerPointerDownPosRef:de,disabled:w,children:[d.jsx(Eu.Provider,{scope:e,children:d.jsx(PB,{scope:t.__scopeSelect,onNativeOptionAdd:C.useCallback(Y=>{q(oe=>new Set(oe).add(Y))},[]),onNativeOptionRemove:C.useCallback(Y=>{q(oe=>{const Q=new Set(oe);return Q.delete(Y),Q})},[]),children:n})}),se?d.jsxs(KT,{"aria-hidden":!0,required:y,tabIndex:-1,name:p,autoComplete:g,value:ee,onChange:Y=>W(Y.target.value),disabled:w,form:x,children:[ee===void 0?d.jsx("option",{value:""}):null,Array.from(fe)]},Z):null]})})};xT.displayName=Zi;var ST="SelectTrigger",_T=C.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...o}=t,a=Au(n),s=_i(ST,n),l=s.disabled||r,u=rt(e,s.onTriggerChange),h=Tu(n),p=C.useRef("touch"),[g,w,y]=jT(v=>{const b=h().filter(N=>!N.disabled),E=b.find(N=>N.value===s.value),T=WT(b,v,E);T!==void 0&&s.onValueChange(T.value)}),x=v=>{l||(s.onOpenChange(!0),y()),v&&(s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return d.jsx(wB,{asChild:!0,...a,children:d.jsx(mn.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":GT(s.value)?"":void 0,...o,ref:u,onClick:Ue(o.onClick,v=>{v.currentTarget.focus(),p.current!=="mouse"&&x(v)}),onPointerDown:Ue(o.onPointerDown,v=>{p.current=v.pointerType;const b=v.target;b.hasPointerCapture(v.pointerId)&&b.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(x(v),v.preventDefault())}),onKeyDown:Ue(o.onKeyDown,v=>{const b=g.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&w(v.key),!(b&&v.key===" ")&&AB.includes(v.key)&&(x(),v.preventDefault())})})})});_T.displayName=ST;var ET="SelectValue",TT=C.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:o,children:a,placeholder:s="",...l}=t,u=_i(ET,n),{onValueNodeHasChildrenChange:h}=u,p=a!==void 0,g=rt(e,u.onValueNodeChange);return tn(()=>{h(p)},[h,p]),d.jsx(mn.span,{...l,ref:g,style:{pointerEvents:"none"},children:GT(u.value)?d.jsx(d.Fragment,{children:s}):a})});TT.displayName=ET;var MB="SelectIcon",AT=C.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...o}=t;return d.jsx(mn.span,{"aria-hidden":!0,...o,ref:e,children:r||"▼"})});AT.displayName=MB;var RB="SelectPortal",IT=t=>d.jsx(CT,{asChild:!0,...t});IT.displayName=RB;var ea="SelectContent",kT=C.forwardRef((t,e)=>{const n=_i(ea,t.__scopeSelect),[r,o]=C.useState();if(tn(()=>{o(new DocumentFragment)},[]),!n.open){const a=r;return a?Ia.createPortal(d.jsx(NT,{scope:t.__scopeSelect,children:d.jsx(Eu.Slot,{scope:t.__scopeSelect,children:d.jsx("div",{children:t.children})})}),a):null}return d.jsx(PT,{...t,ref:e})});kT.displayName=ea;var Vr=10,[NT,Ei]=is(ea),DB="SelectContentImpl",LB=mi("SelectContent.RemoveScroll"),PT=C.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:s,side:l,sideOffset:u,align:h,alignOffset:p,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:x,hideWhenDetached:v,avoidCollisions:b,...E}=t,T=_i(ea,n),[N,P]=C.useState(null),[_,D]=C.useState(null),H=rt(e,z=>P(z)),[K,ee]=C.useState(null),[W,de]=C.useState(null),se=Tu(n),[fe,q]=C.useState(!1),Z=C.useRef(!1);C.useEffect(()=>{if(N)return pb(N)},[N]),QC();const Y=C.useCallback(z=>{const[ce,...Ae]=se().map(ne=>ne.ref.current),[Ce]=Ae.slice(-1),Ne=document.activeElement;for(const ne of z)if(ne===Ne||(ne==null||ne.scrollIntoView({block:"nearest"}),ne===ce&&_&&(_.scrollTop=0),ne===Ce&&_&&(_.scrollTop=_.scrollHeight),ne==null||ne.focus(),document.activeElement!==Ne))return},[se,_]),oe=C.useCallback(()=>Y([K,N]),[Y,K,N]);C.useEffect(()=>{fe&&oe()},[fe,oe]);const{onOpenChange:Q,triggerPointerDownPosRef:X}=T;C.useEffect(()=>{if(N){let z={x:0,y:0};const ce=Ce=>{var Ne,ne;z={x:Math.abs(Math.round(Ce.pageX)-(((Ne=X.current)==null?void 0:Ne.x)??0)),y:Math.abs(Math.round(Ce.pageY)-(((ne=X.current)==null?void 0:ne.y)??0))}},Ae=Ce=>{z.x<=10&&z.y<=10?Ce.preventDefault():N.contains(Ce.target)||Q(!1),document.removeEventListener("pointermove",ce),X.current=null};return X.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",Ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",Ae,{capture:!0})}}},[N,Q,X]),C.useEffect(()=>{const z=()=>Q(!1);return window.addEventListener("blur",z),window.addEventListener("resize",z),()=>{window.removeEventListener("blur",z),window.removeEventListener("resize",z)}},[Q]);const[$,te]=jT(z=>{const ce=se().filter(Ne=>!Ne.disabled),Ae=ce.find(Ne=>Ne.ref.current===document.activeElement),Ce=WT(ce,z,Ae);Ce&&setTimeout(()=>Ce.ref.current.focus())}),_e=C.useCallback((z,ce,Ae)=>{const Ce=!Z.current&&!Ae;(T.value!==void 0&&T.value===ce||Ce)&&(ee(z),Ce&&(Z.current=!0))},[T.value]),ke=C.useCallback(()=>N==null?void 0:N.focus(),[N]),xe=C.useCallback((z,ce,Ae)=>{const Ce=!Z.current&&!Ae;(T.value!==void 0&&T.value===ce||Ce)&&de(z)},[T.value]),Pe=r==="popper"?bm:OT,Te=Pe===bm?{side:l,sideOffset:u,align:h,alignOffset:p,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:x,hideWhenDetached:v,avoidCollisions:b}:{};return d.jsx(NT,{scope:n,content:N,viewport:_,onViewportChange:D,itemRefCallback:_e,selectedItem:K,onItemLeave:ke,itemTextRefCallback:xe,focusSelectedItem:oe,selectedItemText:W,position:r,isPositioned:fe,searchRef:$,children:d.jsx(_p,{as:LB,allowPinchZoom:!0,children:d.jsx(rT,{asChild:!0,trapped:T.open,onMountAutoFocus:z=>{z.preventDefault()},onUnmountAutoFocus:Ue(o,z=>{var ce;(ce=T.trigger)==null||ce.focus({preventScroll:!0}),z.preventDefault()}),children:d.jsx(ZE,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:z=>z.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:d.jsx(Pe,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:z=>z.preventDefault(),...E,...Te,onPlaced:()=>q(!0),ref:H,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:Ue(E.onKeyDown,z=>{const ce=z.ctrlKey||z.altKey||z.metaKey;if(z.key==="Tab"&&z.preventDefault(),!ce&&z.key.length===1&&te(z.key),["ArrowUp","ArrowDown","Home","End"].includes(z.key)){let Ce=se().filter(Ne=>!Ne.disabled).map(Ne=>Ne.ref.current);if(["ArrowUp","End"].includes(z.key)&&(Ce=Ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(z.key)){const Ne=z.target,ne=Ce.indexOf(Ne);Ce=Ce.slice(ne+1)}setTimeout(()=>Y(Ce)),z.preventDefault()}})})})})})})});PT.displayName=DB;var FB="SelectItemAlignedPosition",OT=C.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...o}=t,a=_i(ea,n),s=Ei(ea,n),[l,u]=C.useState(null),[h,p]=C.useState(null),g=rt(e,H=>p(H)),w=Tu(n),y=C.useRef(!1),x=C.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:E,focusSelectedItem:T}=s,N=C.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&h&&v&&b&&E){const H=a.trigger.getBoundingClientRect(),K=h.getBoundingClientRect(),ee=a.valueNode.getBoundingClientRect(),W=E.getBoundingClientRect();if(a.dir!=="rtl"){const Ne=W.left-K.left,ne=ee.left-Ne,Ve=H.left-ne,Qe=H.width+Ve,Ct=Math.max(Qe,K.width),Yt=window.innerWidth-Vr,bt=JE(ne,[Vr,Math.max(Vr,Yt-Ct)]);l.style.minWidth=Qe+"px",l.style.left=bt+"px"}else{const Ne=K.right-W.right,ne=window.innerWidth-ee.right-Ne,Ve=window.innerWidth-H.right-ne,Qe=H.width+Ve,Ct=Math.max(Qe,K.width),Yt=window.innerWidth-Vr,bt=JE(ne,[Vr,Math.max(Vr,Yt-Ct)]);l.style.minWidth=Qe+"px",l.style.right=bt+"px"}const de=w(),se=window.innerHeight-Vr*2,fe=v.scrollHeight,q=window.getComputedStyle(h),Z=parseInt(q.borderTopWidth,10),Y=parseInt(q.paddingTop,10),oe=parseInt(q.borderBottomWidth,10),Q=parseInt(q.paddingBottom,10),X=Z+Y+fe+Q+oe,$=Math.min(b.offsetHeight*5,X),te=window.getComputedStyle(v),_e=parseInt(te.paddingTop,10),ke=parseInt(te.paddingBottom,10),xe=H.top+H.height/2-Vr,Pe=se-xe,Te=b.offsetHeight/2,z=b.offsetTop+Te,ce=Z+Y+z,Ae=X-ce;if(ce<=xe){const Ne=de.length>0&&b===de[de.length-1].ref.current;l.style.bottom="0px";const ne=h.clientHeight-v.offsetTop-v.offsetHeight,Ve=Math.max(Pe,Te+(Ne?ke:0)+ne+oe),Qe=ce+Ve;l.style.height=Qe+"px"}else{const Ne=de.length>0&&b===de[0].ref.current;l.style.top="0px";const Ve=Math.max(xe,Z+v.offsetTop+(Ne?_e:0)+Te)+Ae;l.style.height=Ve+"px",v.scrollTop=ce-xe+v.offsetTop}l.style.margin=`${Vr}px 0`,l.style.minHeight=$+"px",l.style.maxHeight=se+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[w,a.trigger,a.valueNode,l,h,v,b,E,a.dir,r]);tn(()=>N(),[N]);const[P,_]=C.useState();tn(()=>{h&&_(window.getComputedStyle(h).zIndex)},[h]);const D=C.useCallback(H=>{H&&x.current===!0&&(N(),T==null||T(),x.current=!1)},[N,T]);return d.jsx(HB,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:y,onScrollButtonChange:D,children:d.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P},children:d.jsx(mn.div,{...o,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});OT.displayName=FB;var $B="SelectPopperPosition",bm=C.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Vr,...a}=t,s=Au(n);return d.jsx(CB,{...s,...a,ref:e,align:r,collisionPadding:o,style:{boxSizing:"border-box",...a.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)"}})});bm.displayName=$B;var[HB,xm]=is(ea,{}),Sm="SelectViewport",MT=C.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...o}=t,a=Ei(Sm,n),s=xm(Sm,n),l=rt(e,a.onViewportChange),u=C.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:r}),d.jsx(Eu.Slot,{scope:n,children:d.jsx(mn.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Ue(o.onScroll,h=>{const p=h.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:w}=s;if(w!=null&&w.current&&g){const y=Math.abs(u.current-p.scrollTop);if(y>0){const x=window.innerHeight-Vr*2,v=parseFloat(g.style.minHeight),b=parseFloat(g.style.height),E=Math.max(v,b);if(E<x){const T=E+y,N=Math.min(x,T),P=T-N;g.style.height=N+"px",g.style.bottom==="0px"&&(p.scrollTop=P>0?P:0,g.style.justifyContent="flex-end")}}}u.current=p.scrollTop})})})]})});MT.displayName=Sm;var RT="SelectGroup",[UB,BB]=is(RT),zB=C.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=Mo();return d.jsx(UB,{scope:n,id:o,children:d.jsx(mn.div,{role:"group","aria-labelledby":o,...r,ref:e})})});zB.displayName=RT;var DT="SelectLabel",LT=C.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=BB(DT,n);return d.jsx(mn.div,{id:o.id,...r,ref:e})});LT.displayName=DT;var Iu="SelectItem",[VB,FT]=is(Iu),$T=C.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:a,...s}=t,l=_i(Iu,n),u=Ei(Iu,n),h=l.value===r,[p,g]=C.useState(a??""),[w,y]=C.useState(!1),x=rt(e,T=>{var N;return(N=u.itemRefCallback)==null?void 0:N.call(u,T,r,o)}),v=Mo(),b=C.useRef("touch"),E=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")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(VB,{scope:n,value:r,disabled:o,textId:v,isSelected:h,onItemTextChange:C.useCallback(T=>{g(N=>N||((T==null?void 0:T.textContent)??"").trim())},[]),children:d.jsx(Eu.ItemSlot,{scope:n,value:r,disabled:o,textValue:p,children:d.jsx(mn.div,{role:"option","aria-labelledby":v,"data-highlighted":w?"":void 0,"aria-selected":h&&w,"data-state":h?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:x,onFocus:Ue(s.onFocus,()=>y(!0)),onBlur:Ue(s.onBlur,()=>y(!1)),onClick:Ue(s.onClick,()=>{b.current!=="mouse"&&E()}),onPointerUp:Ue(s.onPointerUp,()=>{b.current==="mouse"&&E()}),onPointerDown:Ue(s.onPointerDown,T=>{b.current=T.pointerType}),onPointerMove:Ue(s.onPointerMove,T=>{var N;b.current=T.pointerType,o?(N=u.onItemLeave)==null||N.call(u):b.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ue(s.onPointerLeave,T=>{var N;T.currentTarget===document.activeElement&&((N=u.onItemLeave)==null||N.call(u))}),onKeyDown:Ue(s.onKeyDown,T=>{var P;((P=u.searchRef)==null?void 0:P.current)!==""&&T.key===" "||(IB.includes(T.key)&&E(),T.key===" "&&T.preventDefault())})})})})});$T.displayName=Iu;var _c="SelectItemText",HT=C.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:o,...a}=t,s=_i(_c,n),l=Ei(_c,n),u=FT(_c,n),h=OB(_c,n),[p,g]=C.useState(null),w=rt(e,E=>g(E),u.onItemTextChange,E=>{var T;return(T=l.itemTextRefCallback)==null?void 0:T.call(l,E,u.value,u.disabled)}),y=p==null?void 0:p.textContent,x=C.useMemo(()=>d.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:v,onNativeOptionRemove:b}=h;return tn(()=>(v(x),()=>b(x)),[v,b,x]),d.jsxs(d.Fragment,{children:[d.jsx(mn.span,{id:u.textId,...a,ref:w}),u.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Ia.createPortal(a.children,s.valueNode):null]})});HT.displayName=_c;var UT="SelectItemIndicator",BT=C.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return FT(UT,n).isSelected?d.jsx(mn.span,{"aria-hidden":!0,...r,ref:e}):null});BT.displayName=UT;var _m="SelectScrollUpButton",KB=C.forwardRef((t,e)=>{const n=Ei(_m,t.__scopeSelect),r=xm(_m,t.__scopeSelect),[o,a]=C.useState(!1),s=rt(e,r.onScrollButtonChange);return tn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const h=u.scrollTop>0;a(h)};const u=n.viewport;return l(),u.addEventListener("scroll",l),()=>u.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?d.jsx(zT,{...t,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:u}=n;l&&u&&(l.scrollTop=l.scrollTop-u.offsetHeight)}}):null});KB.displayName=_m;var Em="SelectScrollDownButton",GB=C.forwardRef((t,e)=>{const n=Ei(Em,t.__scopeSelect),r=xm(Em,t.__scopeSelect),[o,a]=C.useState(!1),s=rt(e,r.onScrollButtonChange);return tn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const h=u.scrollHeight-u.clientHeight,p=Math.ceil(u.scrollTop)<h;a(p)};const u=n.viewport;return l(),u.addEventListener("scroll",l),()=>u.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?d.jsx(zT,{...t,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:u}=n;l&&u&&(l.scrollTop=l.scrollTop+u.offsetHeight)}}):null});GB.displayName=Em;var zT=C.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=t,a=Ei("SelectScrollButton",n),s=C.useRef(null),l=Tu(n),u=C.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return C.useEffect(()=>()=>u(),[u]),tn(()=>{var p;const h=l().find(g=>g.ref.current===document.activeElement);(p=h==null?void 0:h.ref.current)==null||p.scrollIntoView({block:"nearest"})},[l]),d.jsx(mn.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:Ue(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Ue(o.onPointerMove,()=>{var h;(h=a.onItemLeave)==null||h.call(a),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Ue(o.onPointerLeave,()=>{u()})})}),jB="SelectSeparator",VT=C.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return d.jsx(mn.div,{"aria-hidden":!0,...r,ref:e})});VT.displayName=jB;var Tm="SelectArrow",WB=C.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=Au(n),a=_i(Tm,n),s=Ei(Tm,n);return a.open&&s.position==="popper"?d.jsx(bB,{...o,...r,ref:e}):null});WB.displayName=Tm;var qB="SelectBubbleInput",KT=C.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const o=C.useRef(null),a=rt(r,o),s=iS(e);return C.useEffect(()=>{const l=o.current;if(!l)return;const u=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(u,"value").set;if(s!==e&&p){const g=new Event("change",{bubbles:!0});p.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(mn.select,{...n,style:{...bT,...n.style},ref:a,defaultValue:e})});KT.displayName=qB;function GT(t){return t===""||t===void 0}function jT(t){const e=gn(t),n=C.useRef(""),r=C.useRef(0),o=C.useCallback(s=>{const l=n.current+s;e(l),function u(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}(l)},[e]),a=C.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return C.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,a]}function WT(t,e,n){const o=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,a=n?t.indexOf(n):-1;let s=YB(t,Math.max(a,0));o.length===1&&(s=s.filter(h=>h!==n));const u=s.find(h=>h.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}function YB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var JB=xT,qT=_T,QB=TT,XB=AT,ZB=IT,YT=kT,e3=MT,JT=LT,QT=$T,t3=HT,n3=BT,XT=VT;const Am=JB,Im=QB,ku=C.forwardRef(({className:t,children:e,...n},r)=>d.jsxs(qT,{ref:r,className:ze("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:[e,d.jsx(XB,{asChild:!0,children:d.jsx(UD,{className:"h-4 w-4 opacity-50"})})]}));ku.displayName=qT.displayName;const Nu=C.forwardRef(({className:t,children:e,position:n="popper",...r},o)=>d.jsx(ZB,{children:d.jsx(YT,{ref:o,className:ze("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:d.jsx(e3,{className:ze("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e})})}));Nu.displayName=YT.displayName;const r3=C.forwardRef(({className:t,...e},n)=>d.jsx(JT,{ref:n,className:ze("px-2 py-1.5 text-sm font-semibold",t),...e}));r3.displayName=JT.displayName;const ta=C.forwardRef(({className:t,children:e,...n},r)=>d.jsxs(QT,{ref:r,className:ze("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[d.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(n3,{children:d.jsx($x,{className:"h-4 w-4"})})}),d.jsx(t3,{children:e})]}));ta.displayName=QT.displayName;const o3=C.forwardRef(({className:t,...e},n)=>d.jsx(XT,{ref:n,className:ze("-mx-1 my-1 h-px bg-muted",t),...e}));o3.displayName=XT.displayName;const km=[{value:"VIEW_DOCUMENT",label:"Chỉ xem"},{value:"EDIT_DOCUMENT",label:"Chỉnh sửa"},{value:"DOWNLOAD_DOCUMENT",label:"Tải xuống"}];function i3({onClose:t,open:e,file:n,apiBaseUrl:r,rootUrlHostApi:o}){const[a,s]=M.useState("users"),[l,u]=M.useState(""),[h,p]=M.useState(""),[g,w]=M.useState(""),[y,x]=M.useState(""),[v,b]=M.useState(zr.VIEW_DOCUMENT),[E,T]=M.useState([]),{users:N,groups:P,sharedUsers:_,sharedGroups:D,fetchData:H,loading:K,postGranted:ee,loadingGrandted:W,setSharedGroups:de,setSharedUsers:se}=$H(r,o),fe=qi(),q=n?n.key:"",Z=N.filter(z=>{var ce;return(fe==null?void 0:fe.id)!==z.id&&(z.username.toLowerCase().includes(l.toLowerCase())||((ce=z.email)==null?void 0:ce.toLowerCase().includes(l.toLowerCase())))}),Y=P.filter(z=>z.groupname.toLowerCase().includes(h.toLowerCase())),oe=_.filter(z=>{var ce,Ae;return((ce=z.username)==null?void 0:ce.toLowerCase().includes(g.toLowerCase()))||((Ae=z.email)==null?void 0:Ae.toLowerCase().includes(g.toLowerCase()))}),Q=D.filter(z=>{var ce;return(ce=z.groupname)==null?void 0:ce.toLowerCase().includes(y.toLowerCase())}),X=z=>{b(z),T(ce=>ce.map(Ae=>({...Ae,permissions:z})))},$=()=>{a==="users"?(u(""),w("")):(p(""),x(""),s("users")),T([]),b(zr.VIEW_DOCUMENT)};M.useEffect(()=>{e?H(q):$()},[e,q]);const te=z=>{z!==a&&(a==="users"?(u(""),w("")):(p(""),x(""))),s(z)},_e=z=>{n&&T(ce=>{if(ce.find(ne=>ne.userId===z))return ce.filter(ne=>ne.userId!==z);const Ne={path:n.key+n.name,permissions:v,userId:z,grandtedBy:fe==null?void 0:fe.id};return[...ce,Ne]})},ke=z=>{if(!n)return;const ce=z.groupname;T(Ae=>{if(Ae.find(Ve=>Ve.groupname===ce))return Ae.filter(Ve=>Ve.groupname!==ce);const ne={path:n.key+n.name,permissions:v,groupname:ce,groupId:z.id,grandtedBy:fe==null?void 0:fe.id,users:z.users};return[...Ae,ne]})},xe=async(z,ce,Ae)=>{const Ce={...z,permissions:ce};T(Ne=>{const ne=Ne.map(Qe=>Qe.id===Ce.id?Ce:Qe);return Ne.some(Qe=>Qe.id===Ce.id)||ne.push(Ce),ne}),Ae==="users"?se(Ne=>Ne.map(ne=>ne.id===z.id?Ce:ne)):de(Ne=>Ne.map(ne=>ne.id===z.id?Ce:ne))},Pe=async()=>{if(n){const z=(n==null?void 0:n.key)||""+(n==null?void 0:n.name),ce=await ee(z,fe==null?void 0:fe.id,E);(ce==null?void 0:ce.status)==200&&T([])}},Te="flex-1 min-h-0 overflow-y-auto border rounded-lg px-3 py-2 bg-background shadow-sm";return n?d.jsx(ar,{open:e,onOpenChange:t,children:d.jsxs(zn,{className:"max-w-5xl h-[80vh] flex flex-col overflow-hidden",children:[d.jsx(Vn,{children:d.jsxs(Kn,{className:"text-lg font-semibold",children:["Chia sẻ tài liệu: ",n.name]})}),d.jsxs(_g,{defaultValue:"users",className:"flex-1 flex flex-col overflow-hidden",children:[d.jsxs(ou,{className:"grid grid-cols-2 w-1/2 mx-auto mb-4 bg-muted rounded-lg",children:[d.jsx(Yi,{value:"users",className:"py-2",onClick:()=>te("users"),children:"Người dùng"}),d.jsx(Yi,{value:"groups",className:"py-2",onClick:()=>te("groups"),children:"Nhóm"})]}),d.jsx(Ji,{value:"users",className:"flex-1 h-full min-h-0 overflow-hidden",children:d.jsxs("div",{className:"grid grid-cols-2 gap-6 h-full",children:[d.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[d.jsx("p",{className:"text-sm font-semibold mb-2",children:"Chia sẻ với người dùng:"}),d.jsx(Gn,{placeholder:"Tìm người dùng...",className:"mb-3 border-input bg-background shadow-sm",value:l,onChange:z=>u(z.target.value)}),d.jsx("div",{className:Te,children:K?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(kt,{className:"h-10 w-10 animate-spin text-muted-foreground"})}):Z.length===0?d.jsx("p",{className:"text-muted-foreground italic text-center h-full flex items-center justify-center",children:"Không tìm thấy người dùng."}):d.jsx("ul",{className:"space-y-2",children:Z.map(z=>d.jsx("li",{onClick:()=>_e(z.id),className:"flex flex-col space-y-1 cursor-pointer hover:bg-accent p-2 rounded-md transition-colors",children:d.jsxs("div",{className:"flex items-center space-x-3",children:[d.jsx(dc,{id:`user-${z.id}`,checked:!!E.find(ce=>ce.userId===z.id)}),d.jsxs(mr,{className:"flex-1",children:[d.jsx("p",{className:"font-medium",children:z.username}),d.jsx("p",{className:"text-xs text-muted-foreground",children:z.email}),d.jsx("p",{className:"text-xs text-muted-foreground",children:z.groupname})]})]})},z.id))})})]}),d.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[d.jsx("p",{className:"text-sm font-semibold mb-2",children:"Đã chia sẻ với người dùng:"}),d.jsx(Gn,{placeholder:"Tìm người dùng đã chia sẻ...",className:"mb-3 border-input bg-background shadow-sm",value:g,onChange:z=>w(z.target.value)}),d.jsx("div",{className:Te,children:K?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(kt,{className:"h-10 w-10 animate-spin text-muted-foreground"})}):oe.length===0?d.jsx("p",{className:"text-muted-foreground italic text-center h-full flex items-center justify-center",children:"Chưa chia sẻ với người dùng nào."}):d.jsx("ul",{className:"space-y-2",children:oe.map(z=>d.jsxs("li",{className:"flex items-center justify-between gap-4 hover:bg-accent p-2 rounded-md transition-colors",children:[d.jsxs("div",{className:"flex flex-col",children:[d.jsx("p",{className:"font-medium",children:z.username}),d.jsx("p",{className:"text-xs text-muted-foreground",children:z.email}),d.jsx("p",{className:"text-xs text-muted-foreground",children:z.groupname})]}),d.jsxs(Am,{value:z.permissions,onValueChange:ce=>xe(z,ce,"users"),disabled:z.permissions===zr.OWNER_DOCUMENT,children:[d.jsx(ku,{className:"w-[120px]",children:d.jsx(Im,{placeholder:"Chọn quyền"})}),d.jsxs(Nu,{children:[km.map(ce=>d.jsx(ta,{value:ce.value,children:ce.label},ce.value)),z.permissions===zr.OWNER_DOCUMENT&&d.jsx(ta,{value:zr.OWNER_DOCUMENT,children:"Chủ sở hữu"},zr.OWNER_DOCUMENT),d.jsx(ta,{value:"None",children:"Thu hồi"},"None")]})]})]},z.id))})})]})]})}),d.jsx(Ji,{value:"groups",className:"flex-1 h-full min-h-0 overflow-hidden",children:d.jsxs("div",{className:"grid grid-cols-2 gap-6 h-full",children:[d.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[d.jsx("p",{className:"text-sm font-semibold mb-2",children:"Chia sẻ với nhóm:"}),d.jsx(Gn,{placeholder:"Tìm nhóm...",className:"mb-3 border-input bg-background shadow-sm",value:h,onChange:z=>p(z.target.value)}),d.jsx("div",{className:Te,children:K?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(kt,{className:"h-10 w-10 animate-spin text-muted-foreground"})}):Y.length===0?d.jsx("p",{className:"text-muted-foreground italic text-center h-full flex items-center justify-center",children:"Không tìm thấy nhóm."}):d.jsx("ul",{className:"space-y-2",children:Y.map(z=>d.jsxs("li",{onClick:()=>ke(z),className:"flex items-center space-x-3 cursor-pointer hover:bg-accent p-2 rounded-md transition-colors",children:[d.jsx(dc,{id:`group-${z.groupname}`,checked:!!E.find(ce=>ce.groupname===z.groupname)}),d.jsxs(mr,{className:"font-medium",children:[d.jsx("p",{className:"font-medium",children:z.groupname}),d.jsxs("p",{className:"text-xs text-muted-foreground",children:["Số lượng: ",z.users||0]})]})]},z.groupname))})})]}),d.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[d.jsx("p",{className:"text-sm font-semibold mb-2",children:"Đã chia sẻ với nhóm:"}),d.jsx(Gn,{placeholder:"Tìm nhóm đã chia sẻ...",className:"mb-3 border-input bg-background shadow-sm",value:y,onChange:z=>x(z.target.value)}),d.jsx("div",{className:Te,children:K?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(kt,{className:"h-10 w-10 animate-spin text-muted-foreground"})}):Q.length===0?d.jsx("p",{className:"text-muted-foreground italic text-center h-full flex items-center justify-center",children:"Chưa chia sẻ với nhóm nào."}):d.jsx("ul",{className:"space-y-2",children:Q.map(z=>d.jsxs("li",{className:"flex items-center justify-between gap-4 hover:bg-accent p-2 rounded-md transition-colors",children:[d.jsxs("div",{className:"flex flex-col",children:[d.jsx("p",{className:"font-medium",children:z.groupname}),d.jsxs("p",{className:"text-xs text-muted-foreground",children:["Số lượng: ",z.users||0]})]}),d.jsxs(Am,{value:z.permissions,onValueChange:ce=>xe(z,ce,"groups"),children:[d.jsx(ku,{className:"w-[120px]",children:d.jsx(Im,{placeholder:"Chọn quyền"})}),d.jsxs(Nu,{children:[km.map(ce=>d.jsx(ta,{value:ce.value,children:ce.label},ce.value)),d.jsx(ta,{value:"None",children:"Thu hồi"},"None")]})]})]},z.groupname))})})]})]})})]}),d.jsxs("div",{className:"mt-4 bg-muted/50 p-4 rounded-lg",children:[d.jsx(mr,{className:"font-medium mb-2 block",children:"Phân quyền:"}),d.jsxs(Am,{value:v,onValueChange:X,children:[d.jsx(ku,{className:"w-1/2 border border-input bg-background shadow-sm hover:bg-accent",children:d.jsx(Im,{placeholder:"Chọn quyền truy cập"})}),d.jsx(Nu,{children:km.map(z=>d.jsx(ta,{value:z.value,className:"flex items-center gap-2",children:z.label}))})]})]}),d.jsxs(Fr,{children:[d.jsx(He,{variant:"outline",onClick:t,children:"Huỷ"}),d.jsx(He,{variant:"default",onClick:Pe,disabled:E.length===0||W,className:"w-[120px] justify-center",children:W?d.jsx(kt,{className:"h-4 w-4 animate-spin"}):"Lưu thay đổi"})]})]})}):null}const a3={},s3="AIzaSyBI8KiTWudkw8iR5cjH7ZsA4JBN1NqJw8A",c3="726815747852-5deq413t8kd8j3mgj48d46eatjauapq5.apps.googleusercontent.com",l3="https://www.googleapis.com/auth/drive";Lo(Le,{retries:3,shouldResetTimeout:!0,retryCondition:t=>Lo.isRetryableError(t)&&t.config.method==="get"});const Wn={current:!1},ZT="crawl:jobs",as="crawl:current_job",d3=t=>{const[e,n]=M.useState(null),[r,o]=M.useState(0);return M.useEffect(()=>{const a=localStorage.getItem(as);if(a){const s=JSON.parse(a);n(s),s!=null&&s.startTime&&o(Math.floor((Date.now()-s.startTime)/1e3))}},[]),M.useEffect(()=>{if(!(e!=null&&e.startTime))return;const a=setInterval(()=>{o(Math.floor((Date.now()-e.startTime)/1e3))},1e3);return()=>clearInterval(a)},[e==null?void 0:e.startTime]),M.useEffect(()=>{if(!(e!=null&&e.id))return;const a=async()=>{try{const u=(await Le.get(`${t}/api/crawl/${e.id}?taskId=${e.taskId}`)).data;n(h=>{if(!h)return null;const p={...h,status:u};return localStorage.setItem(as,JSON.stringify(p)),(u.status==="completed"||u.status==="failed")&&setTimeout(()=>{n(null),localStorage.removeItem(as)},100),p})}catch(l){console.error("Error polling job status:",l)}},s=setInterval(a,3e3);return a(),()=>clearInterval(s)},[e==null?void 0:e.id,t]),{currentJob:e,elapsedTime:r,setCurrentJob:a=>{a&&!a.startTime&&(a.startTime=Date.now()),n(a),a?localStorage.setItem(as,JSON.stringify(a)):localStorage.removeItem(as)}}},Pu=(t,e)=>{const n=[],r=o=>{(t[o]||[]).forEach(s=>{n.push(s.key),s.isFolder&&r(s.key)})};return r(e),n},u3=(t,e)=>{const n=[];return(t[e]||[]).forEach(o=>{n.push(o.key),o.isFolder&&n.push(...Pu(t,o.key))}),n},f3=(t,e,n=[],r,o,a,s,l,u,h)=>{const[p,g]=M.useState({}),[w,y]=M.useState(!1),[x,v]=M.useState(null),[b,E]=M.useState(0),T=M.useRef(e);M.useEffect(()=>{T.current=e},[e]);const N=async()=>{var _;y(!0);try{const D=qi(),H=await Le.get(`${t}/api/files`,{params:{cache:!1,displayPrefixes:JSON.stringify(n),prefix:T.current,userId:(D==null?void 0:D.id)||"",groupId:((_=D==null?void 0:D.group)==null?void 0:_.id)||"",groupname:(D==null?void 0:D.groupname)||""},timeout:3e5}),K=[];zd.forEach(H.data,(ee,W)=>{l!=null&&l.has(W)&&zd.forEach(ee,de=>{(u==null?void 0:u.current[de.key])!==!1&&K.push(de.key)})}),K.length&&(h==null||h(ee=>{const W=new Set(ee);return K.forEach(de=>W.add(de)),W})),g(H.data),v(null)}catch(D){v(D instanceof Error?D:new Error("Failed to fetch files"))}finally{y(!1),E(0),a("")}},P=async _=>{var D,H;try{if(!_)return;y(!0);const K=await Le.get(`${t}/api/search-db?query=${_}&rootPrefix=${e}&offset=${(o-1)*20}&limit=20`,{timeout:3e5});return g({[e]:((D=K==null?void 0:K.data)==null?void 0:D.result)||[]}),E(((H=K==null?void 0:K.data)==null?void 0:H.estimatedTotalHits)||0),K}catch(K){v(K instanceof Error?K:new Error("Failed to fetch files"))}finally{y(!1)}};return M.useEffect(()=>{!r&&!w&&N(),r&&!w&&P(r)},[r,o]),{data:p,isLoading:w,error:x,estimatedTotalHits:b,refetch:N}},na=t=>{var r,o,a;const e=((a=(o=(r=t==null?void 0:t.name)==null?void 0:r.split("."))==null?void 0:o.pop())==null?void 0:a.toLowerCase())??"";return["txt","md","json","js","ts","jsx","tsx","css","html","xml","yaml","yml"].includes(e||"")},h3={auth:{clientId:"584d5fa9-5123-4602-a1a5-a3746a83745f",authority:"https://login.microsoftonline.com/consumers",redirectUri:a3.VITE_ONE_DRIVE_REDIRECT_URI||"https://s3-explorer.cmcts1.studio.ai.vn/sharepoint/redirect"}},p3=new pp(h3),Nm={[zr.VIEW_DOCUMENT]:1,[zr.DOWNLOAD_DOCUMENT]:2,[zr.EDIT_DOCUMENT]:10,[zr.OWNER_DOCUMENT]:100},ra=t=>{const e=qi();return`${e==null?void 0:e.groupname}`.toUpperCase()==="MASTER_ADMIN"?!0:t?Nm[t]>=10:!1},g3=t=>{const e=qi();return`${e==null?void 0:e.groupname}`.toUpperCase()==="MASTER_ADMIN"?!0:t?Nm[t]>=2:!1},m3=t=>{const e=qi();return`${e==null?void 0:e.groupname}`.toUpperCase()==="MASTER_ADMIN"?!0:t?Nm[t]>=1:!1},v3=M.memo(({homeLabel:t="Kho tài liệu",apiBaseUrl:e="http://localhost:3000",rootPrefix:n="",rootUrlHostApi:r="http://localhost:3003/api/v1",asSelector:o=!1,onSelected:a=h=>console.log("Đã chọn:",h),displayPrefixes:s,preSelectedFiles:l,idCreator:u})=>{var ki;const[h,p]=M.useState([]),[g,w]=M.useState(""),[y,x]=M.useState(new Set(l)),[v,b]=M.useState(n),[E,T]=M.useState(""),[N,P]=M.useState(!1),[_,D]=M.useState(""),[H,K]=M.useState(!1),[ee,W]=M.useState(null),[de,se]=M.useState(null),[fe,q]=M.useState(!1),[Z,Y]=M.useState(!1),[,oe]=M.useState(null),Q=M.useRef(null),{toast:X}=mc(),[$,te]=M.useState(null),[_e,ke]=M.useState(null),[xe,Pe]=M.useState(null),[Te,z]=M.useState(""),[ce,Ae]=M.useState(!1),[Ce,Ne]=M.useState(!1),[ne,Ve]=M.useState(new Set),[Qe,Ct]=M.useState(""),[Yt,bt]=M.useState(!1),[rn,zt]=M.useState(!1),[Rn,Kt]=M.useState("rename"),[L,J]=M.useState(!1),[U,ae]=M.useState(""),[ye,he]=M.useState("1"),[Ee,Xe]=M.useState(!1),[ft,xt]=M.useState(!1),[bo,Jt]=M.useState(!1),[vn,jr]=M.useState(!1),[Gt,dr]=M.useState(1),[Wr,ia]=M.useState(!1),{currentJob:Je,elapsedTime:zo,setCurrentJob:Nc}=d3(e),[xo,aa]=M.useState(null),[sa,cs]=M.useState(""),[Fu,ca]=M.useState(!1),[ls,$u]=M.useState(""),[Pc,Hu]=M.useState(!1),[Oc,Uu]=M.useState(!1),[ds,Bu]=M.useState([]),[la,zu]=M.useState(!1),[us,Fm]=M.useState(""),Vo=M.useRef({}),[Mc,Rc]=M.useState(null),$m=async A=>{Uu(!0);try{const O=await Le.get(`${r}get-knowledge-base/knowledge-base-name/${A}`,{headers:{Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjAyOTliMmIwLTk4MGEtNGQ1Yy04NjkyLWJjNjllM2I1NzZlMiIsInVzZXJuYW1lIjoiY21jX3RzX2FkbWluIiwiaWF0IjoxNzQ3MTk0MTg3fQ.7LB2rgd0fQnhZP_cFgTTCPMSYl0_apwffcNEd7oqjeM"}});O.status===200&&Bu(O.data.knowledgeBase.chatflows.map(G=>({...G,KnowledgeBaseId:O.data.knowledgeBase.knowledge_base_id})))}catch{}finally{Uu(!1)}};M.useEffect(()=>{ls&&r&&$m(ls)},[ls]),M.useEffect(()=>{console.log("pre selected files",l)},[l]);const[Pt,Dc]=M.useState(null),[x0,Hm]=M.useState(!1),[Lc,Fc]=M.useState(!1),[da,fs]=M.useState(!1),[Vu,Ku]=M.useState([]),[$c,Hc]=M.useState([]),[ua,Uc]=M.useState([{id:"root",name:"OneDrive"}]),[Um,hs]=M.useState(!1),[ps,Bc]=M.useState([]),[Gu,Ko]=M.useState(!1),[gs,zc]=M.useState([]),[Vc,ms]=M.useState([]),[vs,ju]=M.useState([]),[Kc,fa]=M.useState([{id:"root",name:"SharePoint"}]),[So,ha]=M.useState(!1),[Gc,jc]=M.useState([]),[gt,qr]=M.useState(null),[Wu,ys]=M.useState(!1),[Bm,pa]=M.useState(!1),[Go,Wc]=M.useState(!1),Vm=new URL(window.location.href).searchParams.get("prefix")||""||E||n,[_0,qu]=M.useState(null),{data:En,isLoading:Ai,error:Km,estimatedTotalHits:ga,refetch:on}=f3(e,Vm,s,g,Gt,w,u,y,Vo,x),[qc,_o]=M.useState(!1),Yc=M.useRef(null),Jc=qi(),Ht=(()=>{const A=localStorage.getItem("dataLogin");try{if(A){const O=JSON.parse(A);return(O==null?void 0:O.user)??null}}catch{return null}return null})();M.useEffect(()=>{if(!qc)return;function A(O){Yc.current&&!Yc.current.contains(O.target)&&_o(!1)}return document.addEventListener("mousedown",A),()=>{document.removeEventListener("mousedown",A)}},[qc]);const Ot=async()=>{try{const A=await Le.get(`${e}/api/login-sharepoint`),{loginUrl:O}=A.data,G=window.open(O,"SharePoint Login","width=600,height=600");if(!G)throw new Error("Không thể mở cửa sổ pop-up");G.focus();const pe=setInterval(()=>{try{if(G.closed){clearInterval(pe);return}const be=G.location.href;if(be.includes("code=")){const Ie=new URL(be).searchParams.get("code");Ie&&(Yu(Ie),G.close(),clearInterval(pe))}}catch(be){be instanceof Error&&!be.message.includes("cross-origin")&&console.error("SharePoint login error:",be)}},1e3)}catch(A){st.error("Lỗi khi đăng nhập SharePoint: "+(A instanceof Error?A.message:"Lỗi không xác định"))}},At=async()=>{try{zc([]),fa([{id:"root",name:"SharePoint"}]),window.location.href="https://login.microsoftonline.com/common/oauth2/v2.0/logout?post_logout_redirect_uri="+encodeURIComponent(window.location.origin),X({title:"Success",description:"Logged out from SharePoint"})}catch(A){console.error("Error logging out from SharePoint:",A),X({title:"Error",description:"Failed to logout from SharePoint",variant:"destructive"})}},Yu=async A=>{try{const O=await Le.post(`${e}/api/get-sharepoint-access-token`,{code:A,userId:"1"}),{accessToken:G,refreshToken:pe}=O.data;localStorage.setItem("sharepoint_access_token",G),localStorage.setItem("refresh_sharepoint_access_token",pe),Fc(!0),ha(!0)}catch(O){console.error("❌ Error fetching SharePoint access token:",O),X({title:"Error",description:"Failed to connect to SharePoint",variant:"destructive"})}},Gm=async()=>{try{Ko(!0);const O=(await Le.post(`${e}/api/list-site-sharepoint`,{userId:"1"})).data.sites.map(G=>{const pe=new URL(G.webUrl);return{id:G.id,name:G.name,description:G.description,hostname:G.hostname||pe.hostname,sitePath:G.sitePath||pe.pathname.replace(/^\/+/,"")}});console.log("data",O),jc(O),Ko(!1)}catch(A){console.error("❌ Error fetching SharePoint sites:",A),X({title:"Error",description:"Failed to fetch SharePoint sites",variant:"destructive"}),Ko(!1)}},jm=async A=>{qr(A),console.log(A),await ws("root",A.name,A.hostname||"",A.sitePath||"")},ws=async(A,O,G,pe)=>{try{Ko(!0);const Ie=(await Le.post(`${e}/api/list-file-sharepoint`,{folderId:A,userId:"1",hostname:G,sitePath:pe})).data.files.map(Me=>({id:Me.id,name:Me.name,size:Me.size??0,lastModified:Me.lastModifiedDateTime?new Date(Me.lastModifiedDateTime):new Date,contentType:Me.mimeType??void 0,isFolder:Me.type==="folder",parentId:Me.parentId??""}));ms(Ie.filter(Me=>Me.isFolder)),zc(Ie.filter(Me=>!Me.isFolder)),ha(!0),fa(Me=>Me.some(Mt=>Mt.id===A)?Me:[...Me,{id:A,name:O==="root"?"SharePoint":O}]),Ko(!1)}catch(be){console.error("❌ Error fetching SharePoint files:",be),X({title:"Error",description:"Failed to fetch SharePoint files",variant:"destructive"}),Ko(!1)}},Wm=A=>{ju(O=>O.some(pe=>pe.id===A.id)?O.filter(pe=>pe.id!==A.id):[...O,{id:A.id,name:A.name,size:A.size,lastModified:A.lastModified,contentType:A.contentType,isFolder:A.isFolder,parentId:A.parentId}])},qm=A=>{var G;fa(pe=>pe.slice(0,A+1));const O=(G=Kc[A])==null?void 0:G.id;O&&ws(O,"SharePoint",(gt==null?void 0:gt.hostname)||"",(gt==null?void 0:gt.sitePath)||"")},Ju=async(A,O)=>{const G=localStorage.getItem("sharepoint_access_token");if(!G){st.error("Không tìm thấy access token. Vui lòng đăng nhập lại.");return}const pe=st.loading("Đang đồng bộ SharePoint...",{position:"bottom-right",autoClose:!1});try{const be={prefix:O,folders:[],files:[],hostname:(gt==null?void 0:gt.hostname)||"",sitePath:(gt==null?void 0:gt.sitePath)||"",isAutoUpdateKB:Go,refreshAccessToken:localStorage.getItem("refresh_sharepoint_access_token")||""};A.forEach(Me=>{Me.isFolder?be.folders.push({id:Me.id,name:Me.name}):be.files.push({id:Me.id,name:Me.name})});const Ie=await Le.post(`${e}/api/sync-sharepoint-to-s3`,be,{headers:{Authorization:`Bearer ${G}`}});on(),st.update(pe,{render:`Đồng bộ thành công! Đã tải lên ${Ie.data.uploadedKeys.length} file.`,type:"success",isLoading:!1,autoClose:3e3,position:"bottom-right"}),ha(!1)}catch(be){console.error("Lỗi khi đồng bộ file từ SharePoint:",be),st.update(pe,{render:"Không thể đồng bộ file từ SharePoint.",type:"error",isLoading:!1,autoClose:3e3,position:"bottom-right"})}},Qu=()=>{ha(!1),zc([]),ju([]),fa([{id:"root",name:"SharePoint"}])};M.useEffect(()=>{if(So){const O=new URLSearchParams(window.location.search).get("code");O&&(Yu(O),window.history.replaceState({},document.title,window.location.pathname))}},[So]),M.useEffect(()=>{p3.initialize().then(()=>{Hm(!0)}).catch(A=>console.error("❌ Lỗi khởi tạo MSAL:",A))},[]),M.useEffect(()=>{sn()},[]);async function sn(){localStorage.getItem("onedrive_access_token")&&Fc(!0)}const Cs=A=>{Bc(O=>O.some(pe=>pe.id===A.id)?O.filter(pe=>pe.id!==A.id):[...O,{id:A.id,name:A.name,size:A.size,lastModified:A.lastModified,contentType:A.contentType,isFolder:A.isFolder,parentId:A.parentId}])};function Yr(A){if(A===0)return"0 B";const O=1024,G=["B","KB","MB","GB","TB"],pe=Math.floor(Math.log(A)/Math.log(O));return parseFloat((A/Math.pow(O,pe)).toFixed(1))+" "+G[pe]}function Xu(A){const O=new Date(A);return O.toLocaleDateString()+" "+O.toLocaleTimeString()}const Qc=async()=>{try{const A=await Le.get(`${e}/api/login-one-drive`),{loginUrl:O}=A.data,G=window.open(O,"OneDrive Login","width=600,height=600");if(!G)throw new Error("Không thể mở cửa sổ pop-up");G.focus();const pe=setInterval(()=>{try{if(G.closed){clearInterval(pe);return}const be=G.location.href;if(be.includes("code=")){const Ie=new URL(be).searchParams.get("code");Ie&&(Zu(Ie),G.close(),clearInterval(pe))}}catch(be){be instanceof Error&&!be.message.includes("cross-origin")&&console.error("OneDrive login error:",be)}},1e3)}catch(A){st.error("Lỗi khi đăng nhập OneDrive: "+(A instanceof Error?A.message:"Lỗi không xác định"))}},qn=async()=>{try{await Le.post(`${e}/api/logout-one-drive`),localStorage.removeItem("onedrive_access_token"),st.success("Đã đăng xuất khỏi OneDrive"),window.location.href="https://login.microsoftonline.com/common/oauth2/v2.0/logout?post_logout_redirect_uri="+encodeURIComponent(window.location.origin)}catch(A){st.error("Lỗi khi đăng xuất OneDrive: "+(A instanceof Error?A.message:"Lỗi không xác định"))}},Zu=async A=>{try{const G=await Le.post(`${e}/api/get-one-drive-access-token`,{authorizationCode:A,userId:"1"}),{accessToken:pe}=G.data;localStorage.setItem("onedrive_access_token",pe),Fc(!0),fs(!0),await ma("root","One Drive")}catch(O){console.error("❌ Lỗi khi lấy Access Token:",O)}},ma=async(A,O)=>{try{hs(!0);const be=(await Le.post(`${e}/api/list-file-one-drive`,{folderId:A,userId:"1"})).data.map(Ie=>({id:Ie.id,name:Ie.name,size:Ie.size??0,lastModified:Ie.lastModifiedDateTime?new Date(Ie.lastModifiedDateTime):new Date,contentType:Ie.mimeType??void 0,isFolder:Ie.type==="folder",parentId:Ie.parentId??""}));Ku(be.filter(Ie=>Ie.isFolder)),Hc(be.filter(Ie=>!Ie.isFolder)),fs(!0),Uc(Ie=>Ie.some(Me=>Me.id===A)?Ie:[...Ie,{id:A,name:O==="root"?"OneDrive":O}]),hs(!1)}catch(G){console.error("Lỗi lấy danh sách file:",G),hs(!1)}},ef=A=>{if(A===ua.length-1)return;const O=ua[A];O&&(Uc(ua.slice(0,A+1)),ma(O.id,O.name))},tf=async(A,O)=>{const G=localStorage.getItem("onedrive_access_token");if(!G){st.error("Không tìm thấy access token. Vui lòng đăng nhập lại.");return}const pe=st.loading("Đang đồng bộ OneDrive...",{position:"bottom-right",autoClose:!1});try{const be={prefix:O,folders:[],files:[]};A.forEach(Me=>{Me.isFolder?be.folders.push({id:Me.id,name:Me.name}):be.files.push({id:Me.id,name:Me.name})});const Ie=await Le.post(`${e}/api/sync-one-drive-to-s3`,be,{headers:{Authorization:`Bearer ${G}`}});on(),st.update(pe,{render:`Đồng bộ thành công! Đã tải lên ${Ie.data.uploadedKeys.length} file.`,type:"success",isLoading:!1,autoClose:3e3,position:"bottom-right"})}catch(be){console.error("Lỗi khi đồng bộ file từ OneDrive:",be),st.update(pe,{render:"Không thể đồng bộ file từ OneDrive.",type:"error",isLoading:!1,autoClose:3e3,position:"bottom-right"})}},Xc=()=>{fs(!1),Uc([{id:"root",name:"OneDrive"}]),Ku([]),Hc([]),Bc([]),hs(!1)},nf=pM({onSuccess:A=>{qu(A.access_token),localStorage.setItem("google_access_token",A.access_token),Dn(A.access_token)},onError:()=>{console.log("Đăng nhập thất bại!")},scope:l3}),Dn=A=>{const O=document.createElement("script");O.src="https://apis.google.com/js/api.js",O.onload=()=>{window.gapi.load("picker",()=>Ym(A))},document.body.appendChild(O)},Ym=A=>{const O=new window.google.picker.DocsView(window.google.picker.ViewId.DOCS).setIncludeFolders(!0).setSelectFolderEnabled(!0).setOwnedByMe(!1),G=new window.google.picker.DocsView(window.google.picker.ViewId.DRIVE).setIncludeFolders(!0).setSelectFolderEnabled(!0);new window.google.picker.PickerBuilder().setDeveloperKey(s3).setOAuthToken(A).enableFeature(window.google.picker.Feature.MULTISELECT_ENABLED).setLocale("vi").addView(O).addView(G).setCallback(async be=>{if(be.action===window.google.picker.Action.PICKED){const Ie=be.docs.map(Me=>({id:Me.id,name:Me.name,mimeType:Me.mimeType}));await Yn(Ie,v)}}).build().setVisible(!0)},Yn=async(A,O="")=>{const G=localStorage.getItem("google_access_token");if(!G){console.error("❌ Không tìm thấy access token. Vui lòng đăng nhập lại."),st.error("Không tìm thấy access token. Vui lòng đăng nhập lại.",{position:"bottom-right"});return}const pe=st.loading("Đang đồng bộ...",{position:"bottom-right",autoClose:!1});try{const be={prefix:O,folders:[],files:[]};A.forEach(Me=>{Me.mimeType==="application/vnd.google-apps.folder"?be.folders.push({id:Me.id,name:Me.name}):be.files.push({id:Me.id,name:Me.name})});const Ie=await Le.post(`${e}/api/sync-drive-to-s3`,be,{headers:{Authorization:`Bearer ${G}`}});Wn.current=!0,on(),st.update(pe,{render:`Đồng bộ thành công! Đã tải lên ${Ie.data.uploadedKeys.length} file.`,type:"success",isLoading:!1,autoClose:3e3,position:"bottom-right"})}catch(be){console.error("❌ Lỗi khi đồng bộ file từ Google Drive:",be),st.update(pe,{render:"Không thể đồng bộ file từ Google Drive.",type:"error",isLoading:!1,autoClose:3e3,position:"bottom-right"})}};M.useEffect(()=>{const A=O=>{if(O.data.action==="logout"){const G=document.createElement("iframe");G.style.display="none",G.src="https://accounts.google.com/Logout",document.body.appendChild(G),setTimeout(()=>document.body.removeChild(G),2e3)}};return window.addEventListener("message",A),()=>window.removeEventListener("message",A)},[]),M.useEffect(()=>{const A=new Set(l);x(A)},[]),M.useEffect(()=>{Je!=null&&Je.status&&(Je.status.status==="completed"?(X({title:"Thu thập website hoàn tất",description:`Đã thu thập thành công ${Je.url} với ${Je.status.completed} trang`}),Wn.current=!0,on()):Je.status.status==="failed"&&X({title:"Thu thập website thất bại",description:`Không thể thu thập ${Je.url}. Vui lòng thử lại.`,variant:"destructive"}))},[(ki=Je==null?void 0:Je.status)==null?void 0:ki.status]);const rf=M.useMemo(()=>En[v]||[],[En,v]),Jr=M.useMemo(()=>rf.filter(A=>m3(A.permission)),[rf,v,En]),Jn=M.useMemo(()=>{const A={};return Jr.forEach((O,G)=>{y.has(O.key)&&(A[G]=!0)}),A},[y,Jr]),bs=A=>{const O=Pu(En,A);if(O.length===0)return y.has(A)?"all":"none";const G=O.filter(pe=>y.has(pe)).length;return G===0?"none":G===O.length?"all":"partial"},Qr=(A,O=!0)=>{if(v!==A){if(u&&!v)ia(!0),T(A+u),b(A+u);else if(ia(!0),T(A),b(A),O&&!o){const G=window.location.pathname==="/"?"":window.location.pathname,pe=A?`${window.location.origin}${G}?prefix=${encodeURIComponent(A)}`:`${window.location.origin}${G}`;window.history.pushState({path:pe},"",pe)}}},Lt=A=>{const O=A.lastIndexOf("/"),G=O>0?A.substring(0,O+1):"";G?(Qr(G),setTimeout(()=>{x(new Set([A]))},500)):x(new Set([A]))};M.useEffect(()=>{Wr&&(Wn.current=!0,on().finally(()=>ia(!1)))},[Wr]);const Eo=async(A,O)=>{var G,pe;K(!0);try{if(Jr.some(Mt=>Mt.isFolder&&Mt.name.toLowerCase()===A.toLowerCase())){X({title:"Lỗi",description:`Thư mục "${A}" đã tồn tại trong thư mục hiện tại.`,variant:"destructive"}),K(!1);return}const Ie=`${O}${A}/`;if((await Le.post(`${e}/api/create-folder`,{prefix:Ie,userId:(Jc==null?void 0:Jc.id)||""})).status!==200){X({title:"Lỗi",description:"Không thể tạo thư mục",variant:"destructive"});return}Wn.current=!0,await on(),X({title:"Đã tạo thư mục",description:`Đã tạo thành công thư mục "${A}"`}),D(""),P(!1)}catch(be){console.error("Error creating folder:",be);const Ie=((pe=(G=be==null?void 0:be.response)==null?void 0:G.data)==null?void 0:pe.error)||"Không thể tạo thư mục";X({title:"Lỗi",description:Ie,variant:"destructive"})}finally{K(!1)}},va=async(A,O,G)=>{var pe,be,Ie,Me,Mt,Zr,wa,Ts,il;oe(G),Jt(!0);try{if(Array.from(A).reduce((Tn,Cr)=>Tn+Cr.size,0)>=100*1024*1024){X({title:"Lỗi",description:"Tổng kích thước các tập tin vượt quá 100 MB",variant:"destructive"}),oe(null),Jt(!1);return}const Wo=Array.from(A).filter(Tn=>Tn.size===0);if(Wo.length>0){const Tn=Wo.map(Cr=>Cr.name).join(", ");X({title:"Lỗi tải lên",description:`Không thể tải lên tập tin rỗng: ${Tn}`,variant:"destructive"}),Jt(!1),oe(null);return}const qo=new FormData;if(Ht!=null&&Ht.id&&qo.append("metadata",JSON.stringify({creator:Ht.username,creatorId:Ht.id,DataSource:"Tệp tải lên"})),G==="folder"&&A[0]){const Tn=A[0].webkitRelativePath.split("/")[0];Tn&&qo.append("folderName",Tn)}qo.append("prefix",O),Array.from(A).forEach(Tn=>G==="folder"?qo.append("files",Tn,Tn.webkitRelativePath):qo.append("files",Tn)),Wn.current=!0;const Qt=await Le.post(`${e}/api/check-files-existed`,qo,{headers:{"Content-Type":"multipart/form-data"}});if(((pe=Qt==null?void 0:Qt.data)==null?void 0:pe.status)===200)await Le.post(`${e}/api/upload`,qo,{headers:{"Content-Type":"multipart/form-data"},timeout:0}),w(""),T(O),setTimeout(async()=>{oe(null),await on(),Jt(!1),await jo("upload")},500);else{if(((Ie=(be=Qt==null?void 0:Qt.data)==null?void 0:be.names)==null?void 0:Ie.length)>0&&!((Me=Qt==null?void 0:Qt.data)!=null&&Me.isFolder)){const Tn=Array.from(A).filter(Cr=>Qt.data.names.includes(Cr.name));aa(Tn),ca(!0)}(Mt=Qt==null?void 0:Qt.data)!=null&&Mt.isFolder&&((Zr=Qt==null?void 0:Qt.data)!=null&&Zr.name)&&(cs((wa=Qt==null?void 0:Qt.data)==null?void 0:wa.name),aa(A),ca(!0))}}catch(Qn){console.error("Lỗi tải lên:",Qn);const Wo=((il=(Ts=Qn==null?void 0:Qn.response)==null?void 0:Ts.data)==null?void 0:il.error)||"Không thể tải lên tập tin";X({title:"Lỗi",description:Wo,variant:"destructive"}),oe(null),Jt(!1)}},Jm=async()=>{var A,O;try{Jt(!0);const G=new FormData;if(xo){oe(sa?"folder":"files"),ca(!1);let pe=localStorage.getItem("dataLogin"),be;try{pe&&(pe=JSON.parse(pe),be=pe.user)}catch{pe=null}if(sa&&xo[0]){const Ie=xo[0].webkitRelativePath.split("/")[0];Ie&&G.append("folderName",Ie)}G.append("prefix",v),Array.from(xo).forEach(Ie=>sa&&xo[0]?G.append("files",Ie,Ie.webkitRelativePath):G.append("files",Ie)),be!=null&&be.id&&G.append("metadata",JSON.stringify({creator:be.username,creatorId:be.id,DataSource:"Tệp tải lên"})),await Le.post(`${e}/api/upload`,G,{headers:{"Content-Type":"multipart/form-data"},timeout:0}),w(""),T(v),Wn.current=!0}}catch(G){console.error("Lỗi tải lên:",G);const pe=((O=(A=G==null?void 0:G.response)==null?void 0:A.data)==null?void 0:O.error)||"Không thể tải lên tập tin";X({title:"Lỗi",description:pe,variant:"destructive"})}finally{setTimeout(async()=>{oe(null),await on(),Jt(!1),cs(""),aa(null),await jo("overwrite")},500)}},xs=async A=>{var O;try{if(await Le.delete(`${e}/api/files`,{data:{paths:[A.key]}}),y.has(A.key)){const pe=new Set(y);pe.delete(A.key),x(pe)}const G=((O=A.key)==null?void 0:O.replace(/^(.*?)(\/.*)?$/,(pe,be,Ie)=>!Ie||Ie==="/"?"":be+"/"))||"";T(G),Wn.current=!0,X({title:"Đã xóa tập tin",description:`Đã xóa thành công "${A.name}"`}),W(null),await jo("delete")}catch(G){console.error("Error deleting file:",G),X({title:"Lỗi",description:"Không thể xóa tập tin",variant:"destructive"})}finally{jr(!1),await on()}},Ss=A=>{const O=new Set(y),G=typeof A=="function"?A(Jn):A;new Set(Object.keys(Jn).map(Number)).forEach(be=>{const Ie=Jr[be];Ie&&(G[be]||(O.delete(Ie.key),Ie.isFolder&&Pu(En,Ie.key).forEach(Me=>O.delete(Me))))}),Object.entries(G).forEach(([be,Ie])=>{const Me=parseInt(be),Mt=Jr[Me];Mt&&Ie&&(O.add(Mt.key),Mt.isFolder&&Pu(En,Mt.key).forEach(Zr=>O.add(Zr)))}),x(O)},Qm=async()=>{var A;q(!0);try{const O=Array.from(y),G=O.map(be=>Object.values(En).flat().find(Ie=>Ie.key===be)).filter(be=>be!==void 0);if(G.length===0){X({title:"Lỗi",description:"Không có tập tin nào được chọn để xóa",variant:"destructive"});return}await Le.delete(`${e}/api/files`,{data:{paths:O}});const pe=((A=G[0])==null?void 0:A.key.replace(/^(.*?)(\/.*)?$/,(be,Ie,Me)=>!Me||Me==="/"?"":Ie+"/"))||"";T(pe),Wn.current=!0,on(),X({title:"Đã xóa tập tin",description:`Đã xóa thành công ${G.length} mục`}),Y(!1),x(new Set),await jo("bulk-delete")}catch(O){console.error("Error deleting files:",O),X({title:"Lỗi",description:"Không thể xóa các tập tin đã chọn",variant:"destructive"})}finally{q(!1)}},Xm=async(A,O)=>{if(!v.trim()){X({title:"Lỗi",description:"Không thể đổi tên tập tin hoặc thư mục ở thư mục gốc. Chỉ có thể xóa.",variant:"destructive"});return}Ne(!0);try{const G=A.key;let pe;A.isFolder?pe=G.split("/").slice(0,-2).join("/")+"/":pe=G.substring(0,G.lastIndexOf("/")+1);const be=pe+O+(A.isFolder?"/":"");await Le.post(`${e}/api/rename`,{oldPath:G,newPath:be}),Wn.current=!0,await on(),X({title:"Đã đổi tên",description:`Đã đổi tên thành công "${A.name}" thành "${O}"`}),te(null),z(""),Pe(null),await jo("rename")}catch(G){console.error("Error renaming item:",G),X({title:"Lỗi",description:"Không thể đổi tên",variant:"destructive"})}finally{Ne(!1)}},of=async A=>{Ve(O=>new Set([...O,...A]));try{const O=await Le.post(`${e}/api/download`,{paths:A},{responseType:"blob"}),G=window.URL.createObjectURL(O.data),pe=document.createElement("a");pe.href=G;const be=O.headers["Content-Disposition"]||O.headers["content-disposition"],Ie=be==null?void 0:be.match(/filename="(.+)"/),Me=Ie?decodeURIComponent(Ie[1]):"download.zip";pe.setAttribute("download",Me),document.body.appendChild(pe),pe.click(),document.body.removeChild(pe),window.URL.revokeObjectURL(G),X({title:"Bắt đầu tải xuống",description:`Đã bắt đầu tải xuống ${A.length} mục${A.length>1,""}`})}catch(O){console.error("Error downloading files:",O),X({title:"Lỗi",description:"Không thể tải xuống tập tin",variant:"destructive"})}finally{Ve(O=>{const G=new Set(O);return A.forEach(pe=>G.delete(pe)),G})}},ya=v?v.replace(n,"").split("/").filter(Boolean):[],Ii=()=>{let A=Array.from(y).map(G=>({key:G}));A.length>1&&(A=A.filter(G=>G.key!==n));const O=G=>zd.findIndex(A,pe=>!pe.key.endsWith("/")&&pe.key.startsWith(G))!==-1;return A=A.filter(G=>G.key.endsWith("/")?!O(G.key):!0),A},af=M.useMemo(()=>{const A=[...(Ht==null?void 0:Ht.role)!=="MASTER_ADMIN"&&(Ht==null?void 0:Ht.role)!=="SITE_ADMIN"&&(v===""||v==="/")?[]:[{id:"select",header:()=>{const O=u3(En,v),G=O.length>0&&O.every(be=>y.has(be)),pe=O.some(be=>y.has(be));return d.jsx(dc,{checked:G?!0:pe?"indeterminate":!1,onCheckedChange:be=>{if(be){const Ie=Jr.reduce((Me,Mt,Zr)=>(Me[Zr]=!0,Me),{});Ss(Ie)}else{for(const Ie of Array.from(y))Ie.startsWith(v)&&(y.delete(Ie),Vo.current[Ie]=!1);zd.forEach(Vo.current,(Ie,Me)=>{Me.startsWith(v)&&(Vo.current[Me]=!1)}),Ss({})}},"aria-label":"Chọn tất cả"})},cell:({row:O})=>{const G=O.original;let be=G.isFolder?bs(G.key):y.has(G.key)?"all":"none";if(be==="none"&&G.key.endsWith("/")){for(const Ie of Array.from(y))if(Ie.startsWith(G.key)){be="all";break}}return d.jsx("div",{className:"flex items-center",children:d.jsx(dc,{checked:be==="partial"?"indeterminate":be==="all",onCheckedChange:Ie=>{var Mt,Zr;const Me={...Jn};if(Ie?Me[O.index]=!0:delete Me[O.index],Vo.current[((Mt=O.original)==null?void 0:Mt.key)||"_"]=!!Ie,(Zr=O.original)!=null&&Zr.key.endsWith("/"))for(const wa of Array.from(y))wa.startsWith(O.original.key)&&(Vo.current[O.original.key]=!1,y.delete(wa));Ss(Me)},"aria-label":"Chọn dòng"})})},enableSorting:!1}],{id:"fileName",header:({column:O})=>d.jsxs(He,{variant:"ghost",onClick:()=>O.toggleSorting(O.getIsSorted()==="asc"),children:["Tên tập tin",d.jsx(sg,{})]}),accessorKey:"name",cell:({row:O})=>{const G=O.original,pe=G.key.substring(0,G.key.lastIndexOf("/"))||"/",be=g.trim()!==""&&pe!==v,Ie=pe.split("/").filter(Boolean);return d.jsxs("div",{className:"flex flex-col group",children:[d.jsxs("div",{className:"flex items-center",children:[d.jsxs("div",{className:`flex items-center gap-2 ${G.isFolder?"cursor-pointer hover:text-blue-600":""}`,onClick:()=>{G.isFolder&&Qr(G.key)},children:[G.isFolder?d.jsx(Js,{className:"h-5 w-5 text-blue-500"}):null,G.name]}),d.jsx("button",{className:"ml-2 opacity-0 group-hover:opacity-100 transition-opacity",onClick:Me=>{Me.stopPropagation(),navigator.clipboard.writeText(G.key),X({title:"Copied to clipboard",description:`Path: ${G.key}`,duration:2e3})},title:"Copy path to clipboard",children:d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),d.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),be&&d.jsxs("div",{className:"text-sm text-gray-500 flex items-center",children:[d.jsx(Js,{className:"h-4 w-4 text-gray-500 my-auto"}),d.jsxs("span",{className:"flex items-center ml-1",children:[d.jsx("span",{className:"cursor-pointer hover:text-blue-600",onClick:()=>{Qr("")},children:"/"}),Ie.map((Me,Mt)=>d.jsxs("span",{className:"flex items-center",children:[d.jsx("span",{className:"cursor-pointer hover:text-blue-600",onClick:()=>{Qr(Ie.slice(0,Mt+1).join("/")+"/")},children:Me}),Mt<Ie.length-1&&d.jsx("span",{children:"/"})]},Mt))]})]})]})}}];return o||A.push({id:"size",header:({column:O})=>d.jsxs(He,{variant:"ghost",onClick:()=>O.toggleSorting(O.getIsSorted()==="asc"),children:["Kích thước",d.jsx(sg,{})]}),accessorKey:"size",cell:({getValue:O,row:G})=>{const pe=O();return d.jsx("span",{children:G.original.isFolder?"-":Yr(pe)})}},{id:"lastModified",header:({column:O})=>d.jsxs(He,{variant:"ghost",onClick:()=>O.toggleSorting(O.getIsSorted()==="asc"),className:"px-0 w-full flex-row justify-end",children:["Sửa đổi lần cuối",d.jsx(sg,{})]}),accessorKey:"lastModified",cell:({row:O})=>{const G=O.original.lastModified;return d.jsx("div",{className:"w-full flex-row justify-end items-center text-right",children:d.jsx("span",{children:G&&Lx(G).isValid()?Lx(G).format("DD/MM/YYYY HH:mm"):"-"})})},size:200},{id:"actions",header:()=>d.jsx("span",{children:"Hành động"}),accessorKey:"key",cell:({row:O})=>d.jsxs("div",{className:"flex items-center gap-2",children:[v===""&&r&&d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>{$u(O.original.key),Hu(!0)},className:"h-8 w-8 p-0",children:ne.has(O.original.key)?d.jsx(kt,{className:"h-4 w-4 animate-spin"}):d.jsx(vO,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Những Flow sử dụng Folder này làm Data"})]})}),d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:!O.original.isFolder&&d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>of([O.original.key]),className:"h-8 w-8 p-0",disabled:!g3(O.original.permission)||ne.has(O.original.key),children:ne.has(O.original.key)?d.jsx(kt,{className:"h-4 w-4 animate-spin"}):d.jsx(hO,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Tải xuống"})]})}),v.trim()!==""&&(ra(O.original.permission)?d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>{te(O.original),z(O.original.name)},className:"h-8 w-8 p-0",disabled:!ra(O.original.permission),children:d.jsx(_O,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Đổi tên"})]})}):d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>{console.log("call"),ke(O.original)},className:"h-8 w-8 p-0",disabled:O.original.isFolder,children:d.jsx(Ux,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Xem"})]})})),d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>{Ae(!0),se(O.original)},className:"h-8 w-8 p-0",disabled:!ra(O.original.permission),children:d.jsx(KD,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Di chuyển"})]})}),!((Ht==null?void 0:Ht.role)!=="MASTER_ADMIN"&&(Ht==null?void 0:Ht.role)!=="SITE_ADMIN"&&(v===""||v==="/"))&&d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>W(O.original),className:"h-8 w-8 p-0",disabled:!ra(O.original.permission),children:d.jsx(DC,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Xóa"})]})}),d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>Rc(O.original),className:"h-8 w-8 p-0",disabled:!ra(O.original.permission),children:d.jsx(RC,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Chia sẻ"})]})})]})}),A},[y,Jr,Jn,ne,o]),_s=jb({data:Jr,columns:af,state:{rowSelection:Jn,sorting:h},onSortingChange:p,enableRowSelection:!0,onRowSelectionChange:Ss,getCoreRowModel:Gb(),getSortedRowModel:qM()}),Zc=async A=>{var O,G;bt(!0);try{if(na(A)){const pe=await Le.get(`${e}/api/read-text`,{params:{path:A.key}});Ct(pe.data.content)}try{const pe=await Le.get(`${e}/api/read-json`,{params:{path:A.key+".metadata.json"}}),be=((G=(O=pe==null?void 0:pe.data)==null?void 0:O.content)==null?void 0:G.metadataAttributes)||null;return Pe({fullPath:$==null?void 0:$.key,...be})}catch{return Pe("Lỗi phân tích siêu dữ liệu")}}catch(pe){console.error("Error loading file content:",pe),X({title:"Lỗi",description:"Không thể tải nội dung tập tin",variant:"destructive"})}finally{bt(!1)}},el=async(A,O)=>{zt(!0);try{await Le.post(`${e}/api/modify-text`,{path:A.key,content:O}),X({title:"Đã lưu tập tin",description:"Nội dung tập tin đã được cập nhật thành công"}),Wn.current=!0,await on(),te(null),Ct(""),Kt("rename"),await jo("edit-content")}catch(G){console.error("Error saving file content:",G),X({title:"Lỗi",description:"Không thể lưu nội dung tập tin",variant:"destructive"})}finally{zt(!1)}},tl=async A=>{zt(!0);try{await Le.post(`${e}/api/modify-json`,{path:A.key+".metadata.json",content:{metadataAttributes:xe}}),X({title:"Đã lưu tập tin",description:"Nội dung tập tin đã được cập nhật thành công"}),Wn.current=!0,await on(),te(null),Ct(""),Kt("rename")}catch(O){console.error("Error saving file content:",O),X({title:"Lỗi",description:"Không thể lưu nội dung tập tin",variant:"destructive"})}finally{zt(!1)}};M.useEffect(()=>{$&&($.isFolder||Zc($),Kt("rename"))},[$]),M.useEffect(()=>{_e&&!_e.isFolder&&Zc(_e)},[_e]);const nl=async(A,O)=>{var G;if(Je){X({title:"Đang thu thập website",description:"Vui lòng đợi cho công việc thu thập hiện tại hoàn thành.",variant:"destructive"});return}Xe(!0);try{const{data:pe}=await Le.post(`${e}/api/crawl`,{url:A,limit:O,prefix:v,isAutoUpdateKB:Go});if(pe.id){Nc({id:pe.id,url:A,limit:O,prefix:v,taskId:((G=pe.task)==null?void 0:G.id)||""});const be=localStorage.getItem(ZT),Ie=be?JSON.parse(be):[];Ie.some(Me=>Me.id===pe.id)||(Ie.unshift({url:A,id:pe.id,limit:O,prefix:v,timestamp:Date.now()}),Ie.length>20&&(Ie.length=20),localStorage.setItem(ZT,JSON.stringify(Ie))),X({title:"Bắt đầu thu thập website",description:`Đã thêm nhiệm vụ thu thập ${A} với giới hạn ${O}. Dữ liệu sẽ có sẵn sau khi thu thập hoàn tất.`}),J(!1),ae(""),he("1")}}catch(pe){console.error("Error crawling website:",pe),X({title:"Lỗi",description:"Không thể bắt đầu thu thập website",variant:"destructive"})}finally{Xe(!1)}},Zm=async()=>{try{if(!(Je!=null&&Je.id))return;Nc(null),localStorage.removeItem(as),X({title:"Đã dừng thu thập",description:`Đã dừng thu thập website ${Je.url}`})}catch(A){console.error("Error stopping job:",A),X({title:"Lỗi",description:"Không thể dừng thu thập website",variant:"destructive"})}};M.useEffect(()=>{if(o)return;const A=(O=!0)=>{const pe=new URL(window.location.href).searchParams.get("prefix")||"";pe?Qr(pe,!1):(O&&!l&&x(new Set),T(n),b(n),Wn.current=!0,setTimeout(()=>{on()},0))};return A(!1),window.addEventListener("popstate",()=>A(!0)),()=>{window.removeEventListener("popstate",()=>A(!0))}},[]);const Es=async()=>{zu(!0);try{await Le.post(`${e}/api/prediction-report`),X({title:"Xuất báo cáo thành công",description:"Báo cáo dự đoán đã được xuất"})}catch(A){console.error("Error exporting report:",A),X({title:"Lỗi",description:"Không thể xuất báo cáo dự đoán",variant:"destructive"})}finally{zu(!1)}},rl=async()=>{try{const A=qi();A&&(await Le.post(`${e}/api/start-ingestion-job`,{prefix:v,user_id:A.id,userName:A.username})).status===200&&await dn()}catch(A){xt(!1),console.log(A)}},jo=async A=>{try{us&&v.includes(us)&&(console.log(`Auto syncing knowledge base after ${A} operation`),await dn())}catch(O){console.log(`Error auto syncing after ${A}:`,O)}},Xr=M.useRef(),dn=async()=>{try{xt(!0);const A=await Le.post(`${e}/api/get-ingestion-job-status`,{prefix:v}),{status:O}=A==null?void 0:A.data;O==="FAILED"||O==="COMPLETE"||O==="STOPPED"||O==="STOPPING"||!O?(xt(!1),Xr.current&&(clearInterval(Xr.current),Xr.current=null),Dc(A==null?void 0:A.data)):(Xr.current||(Xr.current=setInterval(()=>dn(),5e3)),Dc(A==null?void 0:A.data))}catch(A){console.log(A)}},ol=()=>{const A=Array.from(y);let O;return v?O=A.filter(G=>G.startsWith(v)&&G!==v).length:O=new Set(A.filter(G=>G.split("/").shift())).size,`Đang chọn: ${O}`};return M.useEffect(()=>{const A=v==null?void 0:v.split("/")[0];return A!==us&&(xt(!1),Xr.current&&(clearInterval(Xr.current),Xr.current=null),Fm(A||""),Dc(null),A&&dn()),()=>{}},[us,v]),M.useEffect(()=>{So&&Gc.length===0&&(Gm(),qr(null))},[So]),M.useEffect(()=>{if(l)for(const A of Array.from(l))Vo.current[A]=!0},[]),d.jsxs("div",{className:"space-y-4 s3-explr-container",children:[d.jsx(l_,{}),d.jsx(ar,{open:Fu,onOpenChange:A=>{ca(A),A||(cs(""),aa(null),Jt(!1),oe(null))},children:d.jsxs(zn,{children:[d.jsxs(Vn,{children:[d.jsx(Kn,{children:"Cảnh báo trùng lặp"}),d.jsxs(Ci,{children:[sa&&d.jsxs(d.Fragment,{children:["Folder $",sa," đã có."]}),xo&&xo.length>0&&d.jsxs(d.Fragment,{children:["Những tệp sau bị lặp:",d.jsx("ul",{className:"mt-2 list-disc pl-5 text-sm text-red-600",children:Array.from(xo).map((A,O)=>d.jsx("li",{children:A.name},O))})]})]})]}),d.jsxs(Fr,{children:[d.jsx(He,{variant:"outline",onClick:()=>{ca(!1),cs(""),aa(null),Jt(!1),oe(null)},children:"Bỏ qua"}),d.jsx(He,{variant:"destructive",onClick:()=>Jm(),children:"Ghi đè"})]})]})}),d.jsx(Gd,{className:"s3-explr-breadcrumb",children:d.jsxs(jd,{className:"s3-explr-breadcrumb-list",children:[d.jsx(cc,{className:"s3-explr-breadcrumb-item",children:d.jsx(lc,{onClick:()=>Qr(n),className:"flex items-center gap-1 cursor-pointer s3-explr-breadcrumb-home",children:t})}),!u&&ya.map((A,O)=>d.jsxs("div",{className:"flex items-center",children:[d.jsx(Wd,{className:"s3-explr-breadcrumb-separator"},`sep-${O}`),d.jsx(cc,{className:"s3-explr-breadcrumb-item",children:d.jsx(lc,{onClick:()=>Qr(n+ya.slice(0,O+1).join("/")+"/"),className:"cursor-pointer s3-explr-breadcrumb-link",children:A})},`item-${A}`)]},O))]})}),d.jsxs("div",{className:"flex items-center space-x-4 s3-explr-toolbar",children:[d.jsx("div",{className:"relative max-w-sm w-full s3-explr-search-container",children:d.jsx(FH,{ref:Q,onChange:A=>w(A)})}),d.jsxs(He,{variant:"outline",size:"sm",onClick:()=>{T(v),Wn.current=!0,on()},disabled:Ai,className:"flex items-center gap-2 s3-explr-refresh-btn",children:[d.jsx(dd,{className:`h-4 w-4 s3-explr-refresh-icon ${Ai?"animate-spin":""}`}),"Làm mới"]}),v&&v!=="/"&&d.jsx(vr,{delayDuration:0,children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsxs(He,{variant:"outline",size:"sm",onClick:()=>{Ai||ft||(xt(!0),rl())},"aria-disabled":Ai||ft,className:"flex items-center gap-2 s3-explr-refresh-btn aria-disabled:opacity-50",children:[d.jsx(dd,{className:`h-4 w-4 s3-explr-refresh-icon ${Ai||ft?"animate-spin":""}`}),"Đồng bộ KB"]})}),Pt&&d.jsx(lr,{side:"right",sideOffset:5,children:d.jsxs("div",{className:"space-y-2 p-3 max-w-md",children:[d.jsx("p",{className:"font-semibold text-lg border-b pb-1",children:"Thông tin đồng bộ"}),d.jsx("div",{className:"space-y-1",children:d.jsxs("p",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"font-medium",children:"Trạng thái:"}),d.jsxs("span",{className:`flex items-center gap-1 font-semibold ${Pt.status==="COMPLETE"?"text-green-600":Pt.status==="FAILED"?"text-red-600":"text-yellow-600"}`,children:[Pt.status==="COMPLETE"&&d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),Pt.status==="FAILED"&&d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),Pt.status!=="COMPLETE"&&Pt.status!=="FAILED"&&d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),lL(Pt.status)]})]})}),Pt.statistics&&d.jsxs("div",{className:"space-y-1 border-t pt-2",children:[d.jsx("p",{className:"font-medium text-gray-50",children:"Thống kê xử lý:"}),d.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-sm",children:[d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Tài liệu quét:"}),d.jsx("span",{className:"font-medium",children:Pt.statistics.numberOfDocumentsScanned})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Metadata quét:"}),d.jsx("span",{className:"font-medium",children:Pt.statistics.numberOfMetadataDocumentsScanned})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Tài liệu mới:"}),d.jsx("span",{className:"font-medium text-green-600",children:Pt.statistics.numberOfNewDocumentsIndexed})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Tài liệu sửa:"}),d.jsx("span",{className:"font-medium text-blue-600",children:Pt.statistics.numberOfModifiedDocumentsIndexed})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Metadata sửa:"}),d.jsx("span",{className:"font-medium text-blue-600",children:Pt.statistics.numberOfMetadataDocumentsModified})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Tài liệu xóa:"}),d.jsx("span",{className:"font-medium text-orange-600",children:Pt.statistics.numberOfDocumentsDeleted})]}),d.jsxs("div",{className:"flex justify-between col-span-2",children:[d.jsx("span",{children:"Tài liệu lỗi:"}),d.jsx("span",{className:"font-medium text-red-600",children:Pt.statistics.numberOfDocumentsFailed})]})]})]}),d.jsxs("div",{className:"space-y-1 border-t pt-2 text-sm text-gray-200",children:[d.jsx("p",{className:"font-medium text-gray-50",children:"Chi tiết Job:"}),d.jsxs("p",{children:[d.jsx("span",{className:"font-medium",children:"DataSource ID:"})," ",Pt.dataSourceId]}),d.jsxs("p",{children:[d.jsx("span",{className:"font-medium",children:"Ingestion Job ID:"})," ",Pt.ingestionJobId]}),d.jsxs("p",{children:[d.jsx("span",{className:"font-medium",children:"Knowledge Base ID:"})," ",Pt.knowledgeBaseId]}),d.jsxs("p",{children:[d.jsx("span",{className:"font-medium",children:"Job trong queue:"})," ",Pt.is_still_in_stock?"Còn":"Không"]})]}),Pt.errorMessage&&d.jsxs("div",{className:"border-t pt-2",children:[d.jsx("p",{className:"text-red-600 font-medium",children:"Lỗi:"}),d.jsx("p",{className:"text-red-600 text-sm bg-red-50 p-2 rounded",children:Pt.errorMessage})]}),Pt.failureReasons&&Pt.failureReasons.length>0&&d.jsx(HH,{failureReasons:Pt.failureReasons,onNavigateToFile:Lt})]})})]})}),ra(En==null?void 0:En.prefixPermission)&&d.jsxs("div",{className:"relative",ref:Yc,children:[d.jsxs(He,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-file-btn bg-[#1682fe] hover:bg-[#0f6cd4] text-white rounded-md px-4 py-2 transition-colors aria-disabled:hidden",onClick:()=>_o(A=>!A),"aria-disabled":(Ht==null?void 0:Ht.role)!=="MASTER_ADMIN"&&(Ht==null?void 0:Ht.role)!=="SITE_ADMIN"&&(v===""||v==="/"),children:[d.jsx(TO,{className:"w-4 h-4"}),"Add file"]}),qc&&d.jsxs("div",{className:"absolute z-50 mt-2 right-0 w-56 bg-white border rounded-lg shadow-lg py-2 flex flex-col",children:[d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",onClick:()=>{_o(!1);const A=document.createElement("input");A.type="file",A.multiple=!0,A.onchange=O=>{const G=O.target.files;G&&va(G,v,"files")},A.click()},children:[d.jsx(gp,{className:"h-4 w-4 mr-2"})," Tải tệp tin"]}),d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",onClick:()=>{_o(!1);const A=document.createElement("input");A.type="file",A.multiple=!0,A.webkitdirectory=!0,A.onchange=O=>{const G=O.target.files;G&&va(G,v,"folder")},A.click()},children:[d.jsx(Js,{className:"h-4 w-4 mr-2"})," Tải lên thư mục"]}),d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",disabled:!!s&&!v,onClick:()=>P(!0),children:[d.jsx(wO,{className:"h-4 w-4 mr-2 s3-explr-folder-plus-icon"}),"Thư mục mới"]}),d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",onClick:()=>{_o(!1),J(!0)},children:[d.jsx(xO,{className:"h-4 w-4 mr-2"})," Thêm Website"]}),d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",onClick:()=>{_o(!1),nf()},children:[d.jsxs("svg",{viewBox:"0 0 87.3 78",xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",children:[d.jsx("path",{d:"m6.6 66.85 3.85 6.65c.8 1.4 1.95 2.5 3.3 3.3l13.75-23.8h-27.5c0 1.55.4 3.1 1.2 4.5z",fill:"#0066da"}),d.jsx("path",{d:"m43.65 25-13.75-23.8c-1.35.8-2.5 1.9-3.3 3.3l-25.4 44a9.06 9.06 0 0 0 -1.2 4.5h27.5z",fill:"#00ac47"}),d.jsx("path",{d:"m73.55 76.8c1.35-.8 2.5-1.9 3.3-3.3l1.6-2.75 7.65-13.25c.8-1.4 1.2-2.95 1.2-4.5h-27.502l5.852 11.5z",fill:"#ea4335"}),d.jsx("path",{d:"m43.65 25 13.75-23.8c-1.35-.8-2.9-1.2-4.5-1.2h-18.5c-1.6 0-3.15.45-4.5 1.2z",fill:"#00832d"}),d.jsx("path",{d:"m59.8 53h-32.3l-13.75 23.8c1.35.8 2.9 1.2 4.5 1.2h50.8c1.6 0 3.15-.45 4.5-1.2z",fill:"#2684fc"}),d.jsx("path",{d:"m73.4 26.5-12.7-22c-.8-1.4-1.95-2.5-3.3-3.3l-13.75 23.8 16.15 28h27.45c0-1.55-.4-3.1-1.2-4.5z",fill:"#ffba00"})]})," ","Đồng bộ Google Drive"]}),d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",onClick:()=>{_o(!1),Qc()},children:[d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 64 64",className:"h-4 w-4 mr-2",children:[d.jsx("path",{fill:"#094ab2",d:"M47.3 28.2C45.3 18.6 37.1 12 28 12c-8.5 0-15.9 5.6-18.4 13.5C4.2 27.2 0 32.2 0 38c0 6.6 5.4 12 12 12h36c8.3 0 16-6.6 16-15.5 0-6.8-4.9-12.4-11.7-13.3z"}),d.jsx("path",{fill:"#0067c5",d:"M44.9 30.1c-.2 0-.4-.1-.6-.1H26c-3.3 0-6 2.7-6 6 0 .9.2 1.8.6 2.6-1.7-.7-3.5-1.1-5.5-1.1C7.6 37.5 4 41.5 4 46s3.6 8.5 8.1 8.5h34.3c6.8 0 12.6-5.4 12.6-12s-5.5-11.6-11.1-12.4z"})]})," ","Đồng bộ OneDrive"]}),d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",onClick:()=>{_o(!1),Ot()},children:[d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"h-4 w-4 mr-2",children:[d.jsx("path",{fill:"#036C70",d:"M19 14.5v-9c0-.28-.22-.5-.5-.5h-13c-.28 0-.5.22-.5.5v9c0 .28.22.5.5.5h13c.28 0 .5-.22.5-.5z"}),d.jsx("path",{fill:"#17828F",d:"M16 17.5v-9c0-.28-.22-.5-.5-.5h-13c-.28 0-.5.22-.5.5v9c0 .28.22.5.5.5h13c.28 0 .5-.22.5-.5z"}),d.jsx("path",{fill:"#4DB6AC",d:"M13 20.5v-9c0-.28-.22-.5-.5-.5h-13c-.28 0-.5.22-.5.5v9c0 .28.22.5.5.5h13c.28 0 .5-.22.5-.5z"}),d.jsx("path",{fill:"#fff",d:"M4.5 15.5v-3c0-.28.22-.5.5-.5h3c.28 0 .5.22.5.5v3c0 .28-.22.5-.5.5H5c-.28 0-.5-.22-.5-.5z"})]})," ","Đồng bộ SharePoint"]})]})]}),ra((En==null?void 0:En.prefixPermission)&&y.size>0)&&d.jsxs(He,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-file-btn bg-[#1682fe] hover:bg-[#0f6cd4] text-white rounded-md px-4 py-2 transition-colors aria-disabled:hidden",onClick:()=>Rc({contentType:"application/x-directory",isFolder:!0,key:v||"/",lastModified:"-",name:"",size:0}),children:[d.jsx(RC,{className:"w-4 h-4"}),"Chia sẻ"]}),!o&&d.jsxs(d.Fragment,{children:[y.size>0&&d.jsx(d.Fragment,{children:d.jsxs(ar,{open:Z,onOpenChange:Y,children:[d.jsx(uc,{asChild:!0,children:d.jsxs(He,{variant:"destructive",size:"sm",className:"flex items-center gap-2 s3-explr-bulk-delete-btn",children:[d.jsx(DC,{className:"h-4 w-4 s3-explr-trash-icon"}),"Xóa đã chọn (",y.size,")"]})}),d.jsxs(zn,{className:"s3-explr-dialog-content",children:[d.jsxs(Vn,{className:"s3-explr-dialog-header",children:[d.jsx(Kn,{className:"s3-explr-dialog-title",children:"Xác nhận xóa hàng loạt"}),d.jsxs(Ci,{className:"s3-explr-dialog-description",children:["Bạn có chắc chắn muốn xóa ",y.size," mục đã chọn? Hành động này không thể hoàn tác."]})]}),d.jsxs(Fr,{className:"s3-explr-dialog-footer",children:[d.jsx(He,{variant:"outline",onClick:()=>Y(!1),className:"s3-explr-cancel-btn",children:"Hủy"}),d.jsx(He,{variant:"destructive",onClick:Qm,disabled:fe,className:"s3-explr-confirm-delete-btn",children:fe?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang xóa..."]}):"Xóa đã chọn"})]})]})]})}),!u&&d.jsxs(ar,{open:N,onOpenChange:P,children:[d.jsx(uc,{asChild:!0}),d.jsxs(zn,{className:"s3-explr-dialog-content",children:[d.jsx(Vn,{className:"s3-explr-dialog-header",children:d.jsx(Kn,{className:"s3-explr-dialog-title",children:"Tạo thư mục mới"})}),d.jsxs("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:[d.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[d.jsx(mr,{htmlFor:"name",className:"s3-explr-label",children:"Tên thư mục"}),d.jsx(Gn,{disabled:H,id:"name",value:_,onChange:A=>D(A.target.value),placeholder:"Nhập tên thư mục",className:"s3-explr-input"})]}),d.jsxs(He,{onClick:()=>{_.trim()&&Eo(_,v)},disabled:H,className:"s3-explr-create-btn",children:[H&&d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),H?"Đang tạo...":"Tạo"]})]})]})]}),u&&!v?d.jsx(d.Fragment,{}):d.jsxs("div",{className:"flex items-center gap-2 s3-explr-upload-group",children:[Je?d.jsx(vr,{delayDuration:0,children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(He,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-website-btn",disabled:!0,children:[d.jsx(kt,{className:"h-4 w-4 animate-spin s3-explr-loader"}),Je.status?d.jsxs(d.Fragment,{children:[Je.status.isProcessing?"Đang thu thập ":"Đang quét sitemap ","(",Je.status.completed,"/",Je.status.total,") -"," ",Math.floor(zo/60),":",String(zo%60).padStart(2,"0")]}):"Đang thu thập..."]}),d.jsxs(He,{variant:"destructive",size:"sm",onClick:()=>void Zm(),className:"flex items-center gap-2",children:[d.jsx("span",{className:"sr-only",children:"Dừng thu thập"}),d.jsx(kO,{className:"h-4 w-4"})]})]})}),Je.status&&d.jsx(lr,{side:"right",sideOffset:5,children:d.jsxs("div",{className:"space-y-1 p-2",children:[d.jsxs("p",{className:"font-semibold",children:["Đang thu thập ",Je==null?void 0:Je.url]}),d.jsxs("p",{children:["Tiến độ: ",Je==null?void 0:Je.status.completed,"/",Je==null?void 0:Je.status.total," ","trang"]}),d.jsxs("p",{children:["Thời gian: ",Math.floor(zo/60),":",String(zo%60).padStart(2,"0")]}),d.jsxs("p",{children:["Trạng thái:"," ",(Je==null?void 0:Je.status.status)==="scraping"?"Đang thu thập":(Je==null?void 0:Je.status.status)==="completed"?"Hoàn thành":"Thất bại"]})]})})]})}):!u&&d.jsxs(ar,{open:L,onOpenChange:J,children:[d.jsx(uc,{asChild:!0}),d.jsxs(zn,{className:"s3-explr-dialog-content",children:[d.jsxs(Vn,{className:"s3-explr-dialog-header",children:[d.jsx(Kn,{className:"s3-explr-dialog-title",children:"Thêm website"}),d.jsx(Ci,{className:"s3-explr-dialog-description",children:"Nhập URL website để thu thập và thêm vào S3."})]}),d.jsxs("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:[d.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[d.jsx(mr,{htmlFor:"websiteUrl",className:"s3-explr-label",children:"URL Website"}),d.jsx(Gn,{id:"websiteUrl",value:U,onChange:A=>ae(A.target.value),placeholder:"https://example.com",type:"url",disabled:Ee,className:"s3-explr-input"})]}),d.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[d.jsx(mr,{htmlFor:"crawlLimit",className:"s3-explr-label",children:"Giới hạn thu thập"}),d.jsx(Gn,{id:"crawlLimit",value:ye,onChange:A=>{const O=A.target.value;/^\d*$/.test(O)&&he(O)},placeholder:"1",type:"text",disabled:Ee,className:"s3-explr-input"}),d.jsx("p",{className:"text-sm text-gray-500",children:"Số lượng liên kết cần thu thập (mặc định: 1)"})]})]}),d.jsxs(Fr,{className:"s3-explr-dialog-footer",children:[d.jsx(He,{variant:"outline",onClick:()=>{J(!1),ae(""),he("1")},disabled:Ee,className:"s3-explr-cancel-btn",children:"Hủy"}),d.jsx(He,{onClick:()=>{U.trim()&&nl(U.trim(),parseInt(ye)||1)},disabled:Ee||!U.trim(),className:"s3-explr-crawl-btn",children:Ee?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang thu thập..."]}):"Bắt đầu thu thập"})]})]})]}),v.startsWith("BKTTW/")&&d.jsx(vr,{delayDuration:0,children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsxs(He,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-website-btn",disabled:!!s&&!v,onClick:Es,children:[la&&d.jsx(dd,{className:`h-4 w-4 s3-explr-refresh-icon ${la?"animate-spin":""}`}),"Xuất báo cáo"]})}),(Je==null?void 0:Je.status)&&d.jsx(lr,{side:"right",sideOffset:5,children:d.jsxs("div",{className:"space-y-1 p-2",children:[d.jsxs("p",{className:"font-semibold",children:["Đang thu thập ",Je.url]}),d.jsxs("p",{children:["Tiến độ: ",Je.status.completed,"/",Je.status.total," ","trang"]}),d.jsxs("p",{children:["Thời gian: ",Math.floor(zo/60),":",String(zo%60).padStart(2,"0")]}),d.jsxs("p",{children:["Trạng thái:"," ",Je.status.status==="scraping"?"Đang thu thập":Je.status.status==="completed"?"Hoàn thành":"Thất bại"]})]})})]})}),d.jsxs(ar,{open:L,onOpenChange:J,children:[d.jsx(uc,{asChild:!0}),d.jsxs(zn,{className:"s3-explr-dialog-content",children:[d.jsxs(Vn,{className:"s3-explr-dialog-header",children:[d.jsx(Kn,{className:"s3-explr-dialog-title",children:"Thêm website"}),d.jsx(Ci,{className:"s3-explr-dialog-description",children:"Nhập URL website để thu thập và thêm vào S3."})]}),d.jsxs("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:[d.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[d.jsx(mr,{htmlFor:"websiteUrl",className:"s3-explr-label",children:"URL Website"}),d.jsx(Gn,{id:"websiteUrl",value:U,onChange:A=>ae(A.target.value),placeholder:"https://example.com",type:"url",disabled:Ee,className:"s3-explr-input"})]}),d.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[d.jsx(mr,{htmlFor:"crawlLimit",className:"s3-explr-label",children:"Giới hạn thu thập"}),d.jsx(Gn,{id:"crawlLimit",value:ye,onChange:A=>{const O=A.target.value;/^\d*$/.test(O)&&he(O)},placeholder:"1",type:"text",disabled:Ee,className:"s3-explr-input"}),d.jsx("p",{className:"text-sm text-gray-500",children:"Số lượng liên kết cần thu thập (mặc định: 1)"})]})]}),d.jsxs(Fr,{className:"s3-explr-dialog-footer",children:[d.jsxs(He,{className:`absolute left-4 flex items-center gap-2 px-3 py-2 rounded-md text-white transition-colors ${Go?"bg-green-500 hover:bg-green-600":"bg-gray-400 hover:bg-gray-500"}`,onClick:()=>Wc(A=>!A),children:[d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"6",ry:"6"}),d.jsx("circle",{cx:Go?"16":"8",cy:"12",r:"2",fill:"currentColor"})]}),d.jsx("span",{className:"text-sm",children:"Tự động cập nhật KB"})]}),d.jsx(He,{variant:"outline",onClick:()=>{J(!1),ae(""),he("1")},disabled:Ee,className:"s3-explr-cancel-btn",children:"Hủy"}),d.jsx(He,{onClick:()=>{U.trim()&&nl(U.trim(),parseInt(ye)||1)},disabled:Ee||!U.trim(),className:"s3-explr-crawl-btn",children:Ee?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang thu thập..."]}):"Bắt đầu thu thập"})]})]})]})]}),v.startsWith("BKTTW/")&&d.jsx(vr,{delayDuration:0,children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsxs(He,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-website-btn",disabled:!!s&&!v,onClick:Es,children:[la&&d.jsx(dd,{className:`h-4 w-4 s3-explr-refresh-icon ${la?"animate-spin":""}`}),"Xuất báo cáo"]})}),la&&d.jsx(lr,{sideOffset:5,children:"Đang xuất báo cáo"})]})}),d.jsxs("div",{className:"flex items-center gap-4",children:[da&&d.jsxs(Qs,{open:da,onOpenChange:fs,children:[d.jsx(ja,{className:"fixed inset-0 bg-black bg-opacity-50 z-50"}),d.jsxs(Wa,{className:"fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-white p-6 rounded-lg shadow-lg w-[700px] max-w-[90vw] max-h-[80vh] z-50 flex flex-col",children:[d.jsxs("div",{className:"relative",children:[d.jsx(kp,{asChild:!0,children:d.jsx("button",{className:"absolute top-2 right-2 text-gray-600",onClick:Xc,children:"✖"})}),d.jsx("h2",{className:"text-lg font-semibold",children:"My OneDrive"}),d.jsx(Gd,{className:"onedrive-breadcrumb",children:d.jsx(jd,{className:"onedrive-breadcrumb-list",children:ua.map((A,O)=>d.jsxs("div",{className:"flex items-center",children:[O>0&&d.jsx(Wd,{className:"onedrive-breadcrumb-separator"}),d.jsx(cc,{className:"onedrive-breadcrumb-item",children:d.jsx(lc,{onClick:()=>ef(O),className:"cursor-pointer onedrive-breadcrumb-link",children:A.name})})]},O))})})]}),d.jsx("div",{className:"space-y-2 mt-4 flex-1 overflow-y-auto",children:Um?d.jsx("div",{className:"text-sm text-gray-500",children:"Đang tải nội dung thư mục... Vui lòng đợi."}):d.jsx(d.Fragment,{children:[...Vu,...$c].length>0?[...Vu,...$c].map(A=>d.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-gray-100 ${ps.some(O=>O.id===A.id)?"bg-blue-100":""}`,children:[d.jsx("input",{type:"checkbox",checked:ps.some(O=>O.id===A.id),onChange:O=>{O.stopPropagation(),Cs(A)},className:"cursor-pointer"}),A.isFolder?d.jsx(Js,{className:"text-blue-500 w-5 h-5 cursor-pointer",onClick:()=>ma(A.id,A.name)}):d.jsx(gp,{className:"text-gray-500 w-5 h-5"}),d.jsxs("div",{className:"flex-1",children:[d.jsx("div",{className:`font-medium ${A.isFolder?"cursor-pointer text-blue-600":""}`,onClick:()=>{A.isFolder?ma(A.id,A.name):Cs(A)},children:A.name}),!A.isFolder&&d.jsxs("div",{className:"text-xs text-gray-500",children:[Yr(A.size)," •"," ",Xu(A.lastModified.toISOString())]})]})]},A.id)):d.jsx("div",{className:"text-sm text-gray-500",children:"Không có thư mục hoặc tệp nào."})})}),d.jsx("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:d.jsx(He,{onClick:()=>{tf(ps,v),Xc()},className:"bg-[#1682fe] hover:bg-[#0f6cd4] text-white rounded-md px-4 py-2 transition-colors",disabled:ps.length===0,children:"Đồng bộ"})}),d.jsx("button",{onClick:()=>pa(!0),className:"absolute bottom-4 left-4 text-gray-600 hover:text-gray-800",title:"Đăng xuất OneDrive",children:d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),d.jsx("polyline",{points:"16 17 21 12 16 7"}),d.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]})})]})]}),d.jsxs(Qs,{open:Bm,onOpenChange:pa,children:[d.jsx(ja,{className:"fixed inset-0 bg-black bg-opacity-50 z-[60]"}),d.jsxs(Wa,{className:"fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-white p-6 rounded-lg shadow-lg w-[400px] max-w-[90vw] z-[60]",children:[d.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Xác nhận đăng xuất"}),d.jsx("p",{className:"text-gray-600 mb-6",children:"Bạn có chắc chắn muốn đăng xuất khỏi OneDrive?"}),d.jsxs("div",{className:"flex justify-end gap-2",children:[d.jsx(He,{variant:"outline",onClick:()=>pa(!1),children:"Hủy"}),d.jsx(He,{variant:"destructive",onClick:()=>{qn(),pa(!1)},children:"Đăng xuất"})]})]})]}),So&&d.jsxs(Qs,{open:So,onOpenChange:ha,children:[d.jsx(ja,{className:"fixed inset-0 bg-black bg-opacity-50 z-50"}),d.jsxs(Wa,{className:"fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-white p-6 rounded-lg shadow-lg w-[700px] max-w-[90vw] max-h-[80vh] z-50 flex flex-col",children:[d.jsxs("div",{className:"relative",children:[d.jsx(kp,{asChild:!0,children:d.jsx("button",{className:"absolute top-2 right-2 text-gray-600",onClick:Qu,children:"✖"})}),d.jsxs("div",{className:"flex items-center gap-2",children:[gt&&d.jsx("button",{onClick:()=>qr(null),className:"text-gray-600 hover:text-gray-800",children:d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),d.jsx("h2",{className:"text-lg font-semibold",children:"My SharePoint"})]}),gt&&d.jsx(Gd,{className:"sharepoint-breadcrumb",children:d.jsx(jd,{className:"sharepoint-breadcrumb-list",children:Kc.map((A,O)=>d.jsxs("div",{className:"flex items-center",children:[O>0&&d.jsx(Wd,{className:"sharepoint-breadcrumb-separator"}),d.jsx(cc,{className:"sharepoint-breadcrumb-item",children:d.jsx(lc,{onClick:()=>qm(O),className:"cursor-pointer sharepoint-breadcrumb-link",children:A.name})})]},O))})})]}),d.jsx("div",{className:"space-y-2 mt-4 flex-1 overflow-y-auto",children:Gu?d.jsx("div",{className:"text-sm text-gray-500",children:"Đang tải nội dung thư mục... Vui lòng đợi."}):gt?[...Vc,...gs].length===0?d.jsx("div",{className:"text-sm text-gray-500",children:"Không có thư mục hoặc tệp nào."}):[...Vc,...gs].map(A=>{const O=vs.some(G=>G.id===A.id);return d.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-gray-100 ${O?"bg-blue-100":""}`,children:[d.jsx("input",{type:"checkbox",checked:O,onChange:G=>{G.stopPropagation(),Wm(A)},className:"cursor-pointer"}),A.isFolder?d.jsx(Js,{className:"text-blue-500 w-5 h-5 cursor-pointer",onClick:()=>ws(A.id,A.name,(gt==null?void 0:gt.hostname)||"",(gt==null?void 0:gt.sitePath)||"")}):d.jsx(gp,{className:"text-gray-500 w-5 h-5"}),d.jsxs("div",{className:"flex-1",children:[d.jsx("div",{className:`font-medium ${A.isFolder?"cursor-pointer text-blue-600":""}`,onClick:()=>{A.isFolder&&ws(A.id,A.name,(gt==null?void 0:gt.hostname)||"",(gt==null?void 0:gt.sitePath)||"")},children:A.name}),!A.isFolder&&d.jsxs("div",{className:"text-xs text-gray-500",children:[Yr(A.size)," •"," ",A.lastModified.toLocaleString()]})]})]},A.id)}):d.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6",children:Gc.map(A=>d.jsxs("div",{className:"cursor-pointer bg-white shadow-md rounded-xl p-5 flex flex-col justify-center items-start transition-shadow duration-200 hover:shadow-lg border border-gray-100 min-h-[120px]",style:{overflow:"hidden",wordBreak:"break-word",textOverflow:"ellipsis",whiteSpace:"normal"},onClick:()=>jm(A),children:[d.jsx("div",{className:"font-bold text-lg mb-1 truncate w-full",title:A.name,children:A.name}),d.jsx("div",{className:"text-sm text-gray-500 truncate w-full",title:A.description,children:A.description})]},A.id))})}),d.jsx("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:gt&&d.jsxs(d.Fragment,{children:[d.jsx(He,{onClick:()=>{Ju(vs,v),Qu()},className:"bg-[#1682fe] hover:bg-[#0f6cd4] text-white rounded-md px-4 py-2 transition-colors",disabled:vs.length===0,children:"Đồng bộ"}),d.jsx(He,{onClick:()=>qr(null),children:"Quay lại"})]})}),gt&&d.jsxs("button",{onClick:()=>Wc(A=>!A),className:`absolute bottom-4 left-4 flex items-center gap-2 px-3 py-2 rounded-md text-white transition-colors ${Go?"bg-green-500 hover:bg-green-600":"bg-gray-400 hover:bg-gray-500"}`,title:"Bật/tắt tự động cập nhật KB",children:[d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"6",ry:"6"}),d.jsx("circle",{cx:Go?"16":"8",cy:"12",r:"2",fill:"currentColor"})]}),d.jsx("span",{className:"text-sm",children:"Tự động cập nhật KB"})]})]})]}),d.jsxs(Qs,{open:Wu,onOpenChange:ys,children:[d.jsx(ja,{className:"fixed inset-0 bg-black bg-opacity-50 z-[60]"}),d.jsxs(Wa,{className:"fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-white p-6 rounded-lg shadow-lg w-[400px] max-w-[90vw] z-[60]",children:[d.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Xác nhận đăng xuất"}),d.jsx("p",{className:"text-gray-600 mb-6",children:"Bạn có chắc chắn muốn đăng xuất khỏi SharePoint?"}),d.jsxs("div",{className:"flex justify-end gap-2",children:[d.jsx(He,{variant:"outline",onClick:()=>ys(!1),children:"Hủy"}),d.jsx(He,{variant:"destructive",onClick:()=>{At(),ys(!1)},children:"Đăng xuất"})]})]})]})]}),d.jsx(ar,{open:!!Pc,onOpenChange:A=>{A||(Hu(!1),Bu([]),$u(""))},children:d.jsxs(zn,{className:"max-h-[700px] pb-3 px-1 s3-explr-input-group max-w-5xl w-[90%] p-6 bg-white rounded-lg shadow-lg",children:[d.jsxs(Vn,{className:"s3-explr-dialog-header",children:[d.jsx(Kn,{className:"s3-explr-dialog-title",children:d.jsxs("h3",{className:"font-medium mb-2",children:["Danh sách flows đang sử dụng dữ liệu từ folder(",d.jsx("span",{className:"font-bold",children:ls}),"):"," "]})}),d.jsx(Ci,{className:"s3-explr-dialog-description",children:Oc?d.jsxs("div",{className:"flex items-center justify-center py-4",children:[d.jsx(kt,{className:"h-6 w-6 animate-spin"}),d.jsx("span",{className:"ml-2",children:"Đang tải thông tin flows..."})]}):d.jsx("div",{children:ds&&Array.isArray(ds)&&ds.length>0?d.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:d.jsxs("table",{className:"w-full border-collapse",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"bg-gray-100",children:[d.jsx("th",{className:"border border-gray-300 px-4 py-2 text-left",children:"Tên Flow"}),d.jsx("th",{className:"border border-gray-300 px-4 py-2 text-left",children:"KnowledgeBase Id"}),d.jsx("th",{className:"border border-gray-300 px-4 py-2 text-left",children:"Loại"}),d.jsx("th",{className:"border border-gray-300 px-4 py-2 text-left",children:"Ngày tạo"})]})}),d.jsx("tbody",{children:ds.map((A,O)=>d.jsxs("tr",{className:O%2===0?"bg-white":"bg-gray-50",children:[d.jsx("td",{className:"border border-gray-300 px-4 py-2",children:A.name}),d.jsx("td",{className:"border border-gray-300 px-4 py-2",children:A.KnowledgeBaseId}),d.jsx("td",{className:"border border-gray-300 px-4 py-2",children:A.type==="MULTIAGENT"?"Agent Flow":"Chat Flow"}),d.jsx("td",{className:"border border-gray-300 px-4 py-2",children:A.createdDate?new Date(A.createdDate).toLocaleString("vi-VN"):"N/A"})]},O))})]})}):d.jsx("div",{className:"text-gray-500 italic py-2",children:"Không có flow nào sử dụng dữ liệu từ folder này"})})})]}),d.jsxs(Fr,{className:"s3-explr-dialog-footer",children:[d.jsx(He,{variant:"outline",onClick:()=>W(null),className:"s3-explr-cancel-btn",children:"Hủy"}),d.jsx(He,{variant:"destructive",onClick:()=>xs(ee),disabled:vn,className:"s3-explr-confirm-delete-btn",children:vn?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang xóa..."]}):"Xóa"})]})]})}),d.jsx(ar,{open:!!ee,onOpenChange:A=>!A&&W(null),children:d.jsxs(zn,{className:"s3-explr-dialog-content",children:[d.jsxs(Vn,{className:"s3-explr-dialog-header",children:[d.jsx(Kn,{className:"s3-explr-dialog-title",children:"Xác nhận xóa"}),d.jsxs(Ci,{className:"s3-explr-dialog-description",children:["Bạn có chắc chắn muốn xóa ",ee==null?void 0:ee.name,"? Hành động này không thể hoàn tác."]})]}),d.jsxs(Fr,{className:"s3-explr-dialog-footer",children:[d.jsx(He,{variant:"outline",onClick:()=>W(null),className:"s3-explr-cancel-btn",children:"Hủy"}),d.jsx(He,{variant:"destructive",onClick:()=>xs(ee),disabled:vn,className:"s3-explr-confirm-delete-btn",children:vn?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang xóa..."]}):"Xóa"})]})]})}),d.jsx(ar,{open:!!$,onOpenChange:A=>{A||(te(null),Pe(null),z(""),Ct(""),Kt("rename"))},children:d.jsxs(zn,{className:"s3-explr-dialog-content max-w-5xl w-[90%]",children:[d.jsx(Vn,{className:"s3-explr-dialog-header",children:d.jsx(Kn,{className:"s3-explr-dialog-title",children:$!=null&&$.isFolder?"Đổi tên thư mục":na($)?"Quản lý tập tin":"Đổi tên tập tin"})}),$&&d.jsxs(_g,{value:Rn,onValueChange:A=>Kt(A),children:[d.jsxs(ou,{"aria-checked":!na($),"aria-disabled":$.isFolder,className:"grid w-full grid-cols-3 aria-checked:grid-cols-2 aria-disabled:grid-cols-1",children:[d.jsx(Yi,{value:"rename",children:"Đổi tên"}),!$.isFolder&&d.jsxs(d.Fragment,{children:[na($)&&d.jsx(Yi,{value:"edit",children:"Sửa nội dung"}),d.jsx(Yi,{value:"edit-metadata",children:"Sửa metadata file"})]})]}),d.jsx(Ji,{value:"rename",children:d.jsx("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:d.jsxs("div",{className:"h-[70dvh] min-h-[500px] overflow-hidden overflow-y-auto pb-3 px-1 s3-explr-input-group",children:[d.jsx(mr,{htmlFor:"newName",className:"s3-explr-label",children:"Tên mới"}),d.jsx(Gn,{id:"newName",value:Te,onChange:A=>z(A.target.value),placeholder:"Nhập tên mới",disabled:Ce,className:"s3-explr-input"})]})})}),!$.isFolder&&d.jsxs(d.Fragment,{children:[na($)&&d.jsx(Ji,{value:"edit",children:d.jsx("div",{className:"space-y-4 py-4",children:Yt?d.jsx("div",{className:"flex items-center justify-center py-10",children:d.jsx(kt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):d.jsxs("div",{className:"max-h-[70dvh] overflow-auto rounded-md border px-4 py-3 bg-muted/30",children:[d.jsx(mr,{htmlFor:"content",className:"block text-sm font-medium mb-2 text-muted-foreground",children:"Nội dung tập tin"}),d.jsx(hc,{id:"content",value:Qe,onChange:A=>Ct(A.target.value),placeholder:"Nhập nội dung tập tin",className:"font-mono text-sm resize-none min-h-[200px] w-full",disabled:rn,style:{height:"auto",maxHeight:"60vh"},rows:Math.max(10,Qe.split(`
227
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function GE(t,e){if(t){if(typeof t=="string")return fm(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return fm(t,e)}}function fm(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function $U(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],o=!0,a=!1,s,l;try{for(n=n.call(t);!(o=(s=n.next()).done)&&(r.push(s.value),!(e&&r.length===e));o=!0);}catch(u){a=!0,l=u}finally{try{!o&&n.return!=null&&n.return()}finally{if(a)throw l}}return r}}function HU(t){if(Array.isArray(t))return t}function jE(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(t,o).enumerable})),n.push.apply(n,r)}return n}function Bt(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jE(Object(n),!0).forEach(function(r){hm(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jE(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function hm(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _u(t,e){if(t==null)return{};var n=UU(t,e),r,o;if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(t);for(o=0;o<a.length;o++)r=a[o],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function UU(t,e){if(t==null)return{};var n={},r=Object.keys(t),o,a;for(a=0;a<r.length;a++)o=r[a],!(e.indexOf(o)>=0)&&(n[o]=t[o]);return n}var pm=M.forwardRef(function(t,e){var n=t.children,r=_u(t,kU),o=qE(r),a=o.open,s=_u(o,NU);return M.useImperativeHandle(e,function(){return{open:a}},[a]),M.createElement(M.Fragment,null,n(Bt(Bt({},s),{},{open:a})))});pm.displayName="Dropzone";var WE={disabled:!1,getFilesFromEvent:XH,maxSize:1/0,minSize:0,multiple:!0,maxFiles:0,preventDropOnDocument:!0,noClick:!1,noKeyboard:!1,noDrag:!1,noDragEventsBubbling:!1,validator:null,useFsAccessApi:!1,autoFocus:!1};pm.defaultProps=WE,pm.propTypes={children:Nt.func,accept:Nt.objectOf(Nt.arrayOf(Nt.string)),multiple:Nt.bool,preventDropOnDocument:Nt.bool,noClick:Nt.bool,noKeyboard:Nt.bool,noDrag:Nt.bool,noDragEventsBubbling:Nt.bool,minSize:Nt.number,maxSize:Nt.number,maxFiles:Nt.number,disabled:Nt.bool,getFilesFromEvent:Nt.func,onFileDialogCancel:Nt.func,onFileDialogOpen:Nt.func,useFsAccessApi:Nt.bool,autoFocus:Nt.bool,onDragEnter:Nt.func,onDragLeave:Nt.func,onDragOver:Nt.func,onDrop:Nt.func,onDropAccepted:Nt.func,onDropRejected:Nt.func,onError:Nt.func,validator:Nt.func};var gm={isFocused:!1,isFileDialogActive:!1,isDragActive:!1,isDragAccept:!1,isDragReject:!1,acceptedFiles:[],fileRejections:[]};function qE(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=Bt(Bt({},WE),t),n=e.accept,r=e.disabled,o=e.getFilesFromEvent,a=e.maxSize,s=e.minSize,l=e.multiple,u=e.maxFiles,h=e.onDragEnter,p=e.onDragLeave,g=e.onDragOver,w=e.onDrop,y=e.onDropAccepted,x=e.onDropRejected,v=e.onFileDialogCancel,b=e.onFileDialogOpen,E=e.useFsAccessApi,T=e.autoFocus,N=e.preventDropOnDocument,P=e.noClick,_=e.noKeyboard,D=e.noDrag,H=e.noDragEventsBubbling,K=e.onError,ee=e.validator,W=M.useMemo(function(){return TU(n)},[n]),de=M.useMemo(function(){return EU(n)},[n]),se=M.useMemo(function(){return typeof b=="function"?b:YE},[b]),fe=M.useMemo(function(){return typeof v=="function"?v:YE},[v]),q=M.useRef(null),Z=M.useRef(null),Y=M.useReducer(BU,gm),oe=um(Y,2),Q=oe[0],X=oe[1],$=Q.isFocused,te=Q.isFileDialogActive,_e=M.useRef(typeof window<"u"&&window.isSecureContext&&E&&_U()),ke=function(){!_e.current&&te&&setTimeout(function(){if(Z.current){var ae=Z.current.files;ae.length||(X({type:"closeDialog"}),fe())}},300)};M.useEffect(function(){return window.addEventListener("focus",ke,!1),function(){window.removeEventListener("focus",ke,!1)}},[Z,te,fe,_e]);var xe=M.useRef([]),Pe=function(ae){q.current&&q.current.contains(ae.target)||(ae.preventDefault(),xe.current=[])};M.useEffect(function(){return N&&(document.addEventListener("dragover",zE,!1),document.addEventListener("drop",Pe,!1)),function(){N&&(document.removeEventListener("dragover",zE),document.removeEventListener("drop",Pe))}},[q,N]),M.useEffect(function(){return!r&&T&&q.current&&q.current.focus(),function(){}},[q,T,r]);var Te=M.useCallback(function(U){K?K(U):console.error(U)},[K]),z=M.useCallback(function(U){U.preventDefault(),U.persist(),Rn(U),xe.current=[].concat(MU(xe.current),[U.target]),Su(U)&&Promise.resolve(o(U)).then(function(ae){if(!(xu(U)&&!H)){var ye=ae.length,he=ye>0&&CU({files:ae,accept:W,minSize:s,maxSize:a,multiple:l,maxFiles:u,validator:ee}),Ee=ye>0&&!he;X({isDragAccept:he,isDragReject:Ee,isDragActive:!0,type:"setDraggedFiles"}),h&&h(U)}}).catch(function(ae){return Te(ae)})},[o,h,Te,H,W,s,a,l,u,ee]),ce=M.useCallback(function(U){U.preventDefault(),U.persist(),Rn(U);var ae=Su(U);if(ae&&U.dataTransfer)try{U.dataTransfer.dropEffect="copy"}catch{}return ae&&g&&g(U),!1},[g,H]),Ae=M.useCallback(function(U){U.preventDefault(),U.persist(),Rn(U);var ae=xe.current.filter(function(he){return q.current&&q.current.contains(he)}),ye=ae.indexOf(U.target);ye!==-1&&ae.splice(ye,1),xe.current=ae,!(ae.length>0)&&(X({type:"setDraggedFiles",isDragActive:!1,isDragAccept:!1,isDragReject:!1}),Su(U)&&p&&p(U))},[q,p,H]),Ce=M.useCallback(function(U,ae){var ye=[],he=[];U.forEach(function(Ee){var Xe=UE(Ee,W),ft=um(Xe,2),xt=ft[0],bo=ft[1],Jt=BE(Ee,s,a),vn=um(Jt,2),jr=vn[0],Gt=vn[1],dr=ee?ee(Ee):null;if(xt&&jr&&!dr)ye.push(Ee);else{var Wr=[bo,Gt];dr&&(Wr=Wr.concat(dr)),he.push({file:Ee,errors:Wr.filter(function(ia){return ia})})}}),(!l&&ye.length>1||l&&u>=1&&ye.length>u)&&(ye.forEach(function(Ee){he.push({file:Ee,errors:[wU]})}),ye.splice(0)),X({acceptedFiles:ye,fileRejections:he,isDragReject:he.length>0,type:"setFiles"}),w&&w(ye,he,ae),he.length>0&&x&&x(he,ae),ye.length>0&&y&&y(ye,ae)},[X,l,W,s,a,u,w,y,x,ee]),Ne=M.useCallback(function(U){U.preventDefault(),U.persist(),Rn(U),xe.current=[],Su(U)&&Promise.resolve(o(U)).then(function(ae){xu(U)&&!H||Ce(ae,U)}).catch(function(ae){return Te(ae)}),X({type:"reset"})},[o,Ce,Te,H]),ne=M.useCallback(function(){if(_e.current){X({type:"openDialog"}),se();var U={multiple:l,types:de};window.showOpenFilePicker(U).then(function(ae){return o(ae)}).then(function(ae){Ce(ae,null),X({type:"closeDialog"})}).catch(function(ae){AU(ae)?(fe(ae),X({type:"closeDialog"})):IU(ae)?(_e.current=!1,Z.current?(Z.current.value=null,Z.current.click()):Te(new Error("Cannot open the file picker because the https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API is not supported and no <input> was provided."))):Te(ae)});return}Z.current&&(X({type:"openDialog"}),se(),Z.current.value=null,Z.current.click())},[X,se,fe,E,Ce,Te,de,l]),Ve=M.useCallback(function(U){!q.current||!q.current.isEqualNode(U.target)||(U.key===" "||U.key==="Enter"||U.keyCode===32||U.keyCode===13)&&(U.preventDefault(),ne())},[q,ne]),Qe=M.useCallback(function(){X({type:"focus"})},[]),Ct=M.useCallback(function(){X({type:"blur"})},[]),Yt=M.useCallback(function(){P||(SU()?setTimeout(ne,0):ne())},[P,ne]),bt=function(ae){return r?null:ae},rn=function(ae){return _?null:bt(ae)},zt=function(ae){return D?null:bt(ae)},Rn=function(ae){H&&ae.stopPropagation()},Kt=M.useMemo(function(){return function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ae=U.refKey,ye=ae===void 0?"ref":ae,he=U.role,Ee=U.onKeyDown,Xe=U.onFocus,ft=U.onBlur,xt=U.onClick,bo=U.onDragEnter,Jt=U.onDragOver,vn=U.onDragLeave,jr=U.onDrop,Gt=_u(U,PU);return Bt(Bt(hm({onKeyDown:rn(yo(Ee,Ve)),onFocus:rn(yo(Xe,Qe)),onBlur:rn(yo(ft,Ct)),onClick:bt(yo(xt,Yt)),onDragEnter:zt(yo(bo,z)),onDragOver:zt(yo(Jt,ce)),onDragLeave:zt(yo(vn,Ae)),onDrop:zt(yo(jr,Ne)),role:typeof he=="string"&&he!==""?he:"presentation"},ye,q),!r&&!_?{tabIndex:0}:{}),Gt)}},[q,Ve,Qe,Ct,Yt,z,ce,Ae,Ne,_,D,r]),L=M.useCallback(function(U){U.stopPropagation()},[]),J=M.useMemo(function(){return function(){var U=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},ae=U.refKey,ye=ae===void 0?"ref":ae,he=U.onChange,Ee=U.onClick,Xe=_u(U,OU),ft=hm({accept:W,multiple:l,type:"file",style:{border:0,clip:"rect(0, 0, 0, 0)",clipPath:"inset(50%)",height:"1px",margin:"0 -1px -1px 0",overflow:"hidden",padding:0,position:"absolute",width:"1px",whiteSpace:"nowrap"},onChange:bt(yo(he,Ne)),onClick:bt(yo(Ee,L)),tabIndex:-1},ye,Z);return Bt(Bt({},ft),Xe)}},[Z,n,l,Ne,r]);return Bt(Bt({},Q),{},{isFocused:$&&!r,getRootProps:Kt,getInputProps:J,rootRef:q,inputRef:Z,open:bt(ne)})}function BU(t,e){switch(e.type){case"focus":return Bt(Bt({},t),{},{isFocused:!0});case"blur":return Bt(Bt({},t),{},{isFocused:!1});case"openDialog":return Bt(Bt({},gm),{},{isFileDialogActive:!0});case"closeDialog":return Bt(Bt({},t),{},{isFileDialogActive:!1});case"setDraggedFiles":return Bt(Bt({},t),{},{isDragActive:e.isDragActive,isDragAccept:e.isDragAccept,isDragReject:e.isDragReject});case"setFiles":return Bt(Bt({},t),{},{acceptedFiles:e.acceptedFiles,fileRejections:e.fileRejections,isDragReject:e.isDragReject});case"reset":return Bt({},gm);default:return t}}function YE(){}const zU=({onFilesSelected:t,children:e})=>{const[n,r]=M.useState(!1),{getRootProps:o,getInputProps:a}=qE({noClick:!0,onDrop:s=>{if(s&&s.length>0)if(s[0].path.split("/").length>2){const u=s.map(h=>{const g=(h.path||h.relativePath||"").split("/").slice(1).join("/");return(!h.webkitRelativePath||h.webkitRelativePath==="")&&Object.defineProperty(h,"webkitRelativePath",{writable:!0,value:g,enumerable:!0,configurable:!0}),h});t(u,"folder")}else t(s,"files");r(!1)},onDragOver:s=>{s.preventDefault(),n||r(!0)},multiple:!0});return M.useEffect(()=>{const s=l=>{l.clientX===0&&l.clientY===0&&r(!1)};return document.addEventListener("dragleave",s),()=>{document.removeEventListener("dragleave",s)}},[]),d.jsxs("div",{...o(),className:"transition-opacity min-h-[600px]",children:[n?d.jsx("div",{className:"flex flex-col items-center justify-center p-4 border-2 border-dashed border-gray-300 rounded-lg bg-gray-50 h-screen"}):e,d.jsx("input",{...a()})]})},VU=({openDialogRename:t,setOpenDialogRename:e,apiBaseUrl:n,setFileToMove:r,fileToMove:o,refreshFiles:a,ignoreCache:s,autoSyncAfterFileOperation:l})=>{var N;const[u,h]=M.useState({}),[p,g]=M.useState(!1),[w,y]=M.useState(!1),[x,v]=M.useState(""),{toast:b}=mc();M.useEffect(()=>{t&&E(x)},[x,t]);const E=async P=>{try{y(!0);const _=await Le.get(`${n}/api/list-s3-folders?prefix=${P}`);h(_==null?void 0:_.data)}catch{b({title:"Error",description:"Unable to load S3 folder list",variant:"destructive"})}finally{y(!1)}},T=async()=>{g(!0);try{const P=o.key,_=P.endsWith("/")?P:`${P}/`,D=x.endsWith("/")?x:`${x}/`;if(_===D||P===x){b({title:"Lỗi",description:"Không thể di chuyển file đến cùng vị trí",variant:"destructive"}),g(!1);return}await Le.post(`${n}/api/move`,{oldPath:P,newPath:x}),s.current=!0,await a(),b({title:"Đã di chuyển",description:`Đã di chuyển thành công "${o.name}" đến "${x}"`}),e(!1),r(null),v(""),l&&await l("move")}catch(P){console.error("Error renaming item:",P),b({title:"Lỗi",description:"Không thể đổi tên",variant:"destructive"})}finally{g(!1)}};return d.jsx(ar,{open:t,onOpenChange:P=>{P||(e(!1),r(null),v(""))},children:d.jsxs(zn,{className:"max-h-[700px] pb-3 px-1 s3-explr-input-group max-w-5xl w-[90%] p-6 bg-white rounded-lg shadow-lg",children:[d.jsxs(Vn,{className:"mb-4 w-full h-full",children:[d.jsx("nav",{className:"mb-4",children:d.jsxs("ul",{className:"flex items-center space-x-2 text-sm text-gray-600",children:[d.jsx("li",{className:"cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>v(""),children:"Root"}),x.split("/").map((P,_,D)=>d.jsx("li",{className:"cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>v(P==="Root"?"":D.slice(0,_+1).join("/")+"/"),children:P},_))]})}),d.jsxs(Kn,{className:"text-xl font-semibold text-gray-800",children:["Di chuyển"," ",d.jsxs("span",{className:"text-sm text-gray-500",children:["( file hoặc folder sẽ được di chuyển đến thư mục"," ",x===""?"Root":x," )"]})]}),d.jsx(Ci,{className:"text-gray-600 w-full h-[50dvh] max-h-[500px] overflow-hidden overflow-y-auto",children:w?d.jsx("div",{className:"flex justify-center items-center py-4",children:d.jsx("div",{className:"loader ease-linear rounded-full border-4 border-t-4 border-gray-200 h-12 w-12"})}):d.jsx("ul",{className:"space-y-2",children:(N=Object.keys(u))==null?void 0:N.map(P=>d.jsx("li",{className:"cursor-pointer hover:bg-gray-100 p-2 rounded transition-colors",onClick:()=>v(P),children:P},P))})})]}),d.jsxs(Fr,{className:"flex justify-end space-x-2",children:[d.jsx(He,{variant:"outline",onClick:()=>e(!1),className:"px-4 py-2 rounded border border-gray-300 text-gray-700 hover:bg-gray-100 transition-colors",children:"Cancel"}),d.jsx(He,{onClick:T,disabled:p,className:"s3-explr-crawl-btn",children:"Move"})]})]})})};function JE(t,[e,n]){return Math.min(n,Math.max(e,t))}function KU(t){const e=t+"CollectionProvider",[n,r]=gr(e),[o,a]=n(e,{collectionRef:{current:null},itemMap:new Map}),s=v=>{const{scope:b,children:E}=v,T=M.useRef(null),N=M.useRef(new Map).current;return d.jsx(o,{scope:b,itemMap:N,collectionRef:T,children:E})};s.displayName=e;const l=t+"CollectionSlot",u=mi(l),h=M.forwardRef((v,b)=>{const{scope:E,children:T}=v,N=a(l,E),P=rt(b,N.collectionRef);return d.jsx(u,{ref:P,children:T})});h.displayName=l;const p=t+"CollectionItemSlot",g="data-radix-collection-item",w=mi(p),y=M.forwardRef((v,b)=>{const{scope:E,children:T,...N}=v,P=M.useRef(null),_=rt(b,P),D=a(p,E);return M.useEffect(()=>(D.itemMap.set(P,{ref:P,...N}),()=>void D.itemMap.delete(P))),d.jsx(w,{[g]:"",ref:_,children:T})});y.displayName=p;function x(v){const b=a(t+"CollectionConsumer",v);return M.useCallback(()=>{const T=b.collectionRef.current;if(!T)return[];const N=Array.from(T.querySelectorAll(`[${g}]`));return Array.from(b.itemMap.values()).sort((D,H)=>N.indexOf(D.ref.current)-N.indexOf(H.ref.current))},[b.collectionRef,b.itemMap])}return[{Provider:s,Slot:h,ItemSlot:y},x,r]}var GU=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],mn=GU.reduce((t,e)=>{const n=mi(`Primitive.${e}`),r=C.forwardRef((o,a)=>{const{asChild:s,...l}=o,u=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(u,{...l,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function jU(t,e){t&&Ia.flushSync(()=>t.dispatchEvent(e))}var WU="DismissableLayer",mm="dismissableLayer.update",qU="dismissableLayer.pointerDownOutside",YU="dismissableLayer.focusOutside",QE,XE=C.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ZE=C.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:s,onDismiss:l,...u}=t,h=C.useContext(XE),[p,g]=C.useState(null),w=(p==null?void 0:p.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,y]=C.useState({}),x=rt(e,H=>g(H)),v=Array.from(h.layers),[b]=[...h.layersWithOutsidePointerEventsDisabled].slice(-1),E=v.indexOf(b),T=p?v.indexOf(p):-1,N=h.layersWithOutsidePointerEventsDisabled.size>0,P=T>=E,_=XU(H=>{const K=H.target,ee=[...h.branches].some(W=>W.contains(K));!P||ee||(o==null||o(H),s==null||s(H),H.defaultPrevented||l==null||l())},w),D=ZU(H=>{const K=H.target;[...h.branches].some(W=>W.contains(K))||(a==null||a(H),s==null||s(H),H.defaultPrevented||l==null||l())},w);return HC(H=>{T===h.layers.size-1&&(r==null||r(H),!H.defaultPrevented&&l&&(H.preventDefault(),l()))},w),C.useEffect(()=>{if(p)return n&&(h.layersWithOutsidePointerEventsDisabled.size===0&&(QE=w.body.style.pointerEvents,w.body.style.pointerEvents="none"),h.layersWithOutsidePointerEventsDisabled.add(p)),h.layers.add(p),eT(),()=>{n&&h.layersWithOutsidePointerEventsDisabled.size===1&&(w.body.style.pointerEvents=QE)}},[p,w,n,h]),C.useEffect(()=>()=>{p&&(h.layers.delete(p),h.layersWithOutsidePointerEventsDisabled.delete(p),eT())},[p,h]),C.useEffect(()=>{const H=()=>y({});return document.addEventListener(mm,H),()=>document.removeEventListener(mm,H)},[]),d.jsx(mn.div,{...u,ref:x,style:{pointerEvents:N?P?"auto":"none":void 0,...t.style},onFocusCapture:Ue(t.onFocusCapture,D.onFocusCapture),onBlurCapture:Ue(t.onBlurCapture,D.onBlurCapture),onPointerDownCapture:Ue(t.onPointerDownCapture,_.onPointerDownCapture)})});ZE.displayName=WU;var JU="DismissableLayerBranch",QU=C.forwardRef((t,e)=>{const n=C.useContext(XE),r=C.useRef(null),o=rt(e,r);return C.useEffect(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),d.jsx(mn.div,{...t,ref:o})});QU.displayName=JU;function XU(t,e=globalThis==null?void 0:globalThis.document){const n=gn(t),r=C.useRef(!1),o=C.useRef(()=>{});return C.useEffect(()=>{const a=l=>{if(l.target&&!r.current){let u=function(){tT(qU,n,h,{discrete:!0})};const h={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",o.current),o.current=u,e.addEventListener("click",o.current,{once:!0})):u()}else e.removeEventListener("click",o.current);r.current=!1},s=window.setTimeout(()=>{e.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(s),e.removeEventListener("pointerdown",a),e.removeEventListener("click",o.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function ZU(t,e=globalThis==null?void 0:globalThis.document){const n=gn(t),r=C.useRef(!1);return C.useEffect(()=>{const o=a=>{a.target&&!r.current&&tT(YU,n,{originalEvent:a},{discrete:!1})};return e.addEventListener("focusin",o),()=>e.removeEventListener("focusin",o)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function eT(){const t=new CustomEvent(mm);document.dispatchEvent(t)}function tT(t,e,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&o.addEventListener(t,e,{once:!0}),r?jU(o,a):o.dispatchEvent(a)}var vm="focusScope.autoFocusOnMount",ym="focusScope.autoFocusOnUnmount",nT={bubbles:!1,cancelable:!0},eB="FocusScope",rT=C.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...s}=t,[l,u]=C.useState(null),h=gn(o),p=gn(a),g=C.useRef(null),w=rt(e,v=>u(v)),y=C.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;C.useEffect(()=>{if(r){let v=function(N){if(y.paused||!l)return;const P=N.target;l.contains(P)?g.current=P:Si(g.current,{select:!0})},b=function(N){if(y.paused||!l)return;const P=N.relatedTarget;P!==null&&(l.contains(P)||Si(g.current,{select:!0}))},E=function(N){if(document.activeElement===document.body)for(const _ of N)_.removedNodes.length>0&&Si(l)};document.addEventListener("focusin",v),document.addEventListener("focusout",b);const T=new MutationObserver(E);return l&&T.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",v),document.removeEventListener("focusout",b),T.disconnect()}}},[r,l,y.paused]),C.useEffect(()=>{if(l){aT.add(y);const v=document.activeElement;if(!l.contains(v)){const E=new CustomEvent(vm,nT);l.addEventListener(vm,h),l.dispatchEvent(E),E.defaultPrevented||(tB(aB(oT(l)),{select:!0}),document.activeElement===v&&Si(l))}return()=>{l.removeEventListener(vm,h),setTimeout(()=>{const E=new CustomEvent(ym,nT);l.addEventListener(ym,p),l.dispatchEvent(E),E.defaultPrevented||Si(v??document.body,{select:!0}),l.removeEventListener(ym,p),aT.remove(y)},0)}}},[l,h,p,y]);const x=C.useCallback(v=>{if(!n&&!r||y.paused)return;const b=v.key==="Tab"&&!v.altKey&&!v.ctrlKey&&!v.metaKey,E=document.activeElement;if(b&&E){const T=v.currentTarget,[N,P]=nB(T);N&&P?!v.shiftKey&&E===P?(v.preventDefault(),n&&Si(N,{select:!0})):v.shiftKey&&E===N&&(v.preventDefault(),n&&Si(P,{select:!0})):E===T&&v.preventDefault()}},[n,r,y.paused]);return d.jsx(mn.div,{tabIndex:-1,...s,ref:w,onKeyDown:x})});rT.displayName=eB;function tB(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(Si(r,{select:e}),document.activeElement!==n)return}function nB(t){const e=oT(t),n=iT(e,t),r=iT(e.reverse(),t);return[n,r]}function oT(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function iT(t,e){for(const n of t)if(!rB(n,{upTo:e}))return n}function rB(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function oB(t){return t instanceof HTMLInputElement&&"select"in t}function Si(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&oB(t)&&e&&t.select()}}var aT=iB();function iB(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=sT(t,e),t.unshift(e)},remove(e){var n;t=sT(t,e),(n=t[0])==null||n.resume()}}}function sT(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function aB(t){return t.filter(e=>e.tagName!=="A")}var sB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],cB=sB.reduce((t,e)=>{const n=mi(`Primitive.${e}`),r=C.forwardRef((o,a)=>{const{asChild:s,...l}=o,u=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(u,{...l,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),lB="Arrow",cT=C.forwardRef((t,e)=>{const{children:n,width:r=10,height:o=5,...a}=t;return d.jsx(cB.svg,{...a,ref:e,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:d.jsx("polygon",{points:"0,0 30,0 15,10"})})});cT.displayName=lB;var dB=cT,uB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],lT=uB.reduce((t,e)=>{const n=mi(`Primitive.${e}`),r=C.forwardRef((o,a)=>{const{asChild:s,...l}=o,u=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(u,{...l,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),wm="Popper",[dT,uT]=gr(wm),[fB,fT]=dT(wm),hT=t=>{const{__scopePopper:e,children:n}=t,[r,o]=C.useState(null);return d.jsx(fB,{scope:e,anchor:r,onAnchorChange:o,children:n})};hT.displayName=wm;var pT="PopperAnchor",gT=C.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...o}=t,a=fT(pT,n),s=C.useRef(null),l=rt(e,s);return C.useEffect(()=>{a.onAnchorChange((r==null?void 0:r.current)||s.current)}),r?null:d.jsx(lT.div,{...o,ref:l})});gT.displayName=pT;var Cm="PopperContent",[hB,pB]=dT(Cm),mT=C.forwardRef((t,e)=>{var z,ce,Ae,Ce,Ne,ne;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:a="center",alignOffset:s=0,arrowPadding:l=0,avoidCollisions:u=!0,collisionBoundary:h=[],collisionPadding:p=0,sticky:g="partial",hideWhenDetached:w=!1,updatePositionStrategy:y="optimized",onPlaced:x,...v}=t,b=fT(Cm,n),[E,T]=C.useState(null),N=rt(e,Ve=>T(Ve)),[P,_]=C.useState(null),D=vg(P),H=(D==null?void 0:D.width)??0,K=(D==null?void 0:D.height)??0,ee=r+(a!=="center"?"-"+a:""),W=typeof p=="number"?p:{top:0,right:0,bottom:0,left:0,...p},de=Array.isArray(h)?h:[h],se=de.length>0,fe={padding:W,boundary:de.filter(mB),altBoundary:se},{refs:q,floatingStyles:Z,placement:Y,isPositioned:oe,middlewareData:Q}=k_({strategy:"fixed",placement:ee,whileElementsMounted:(...Ve)=>E_(...Ve,{animationFrame:y==="always"}),elements:{reference:b.anchor},middleware:[N_({mainAxis:o+K,alignmentAxis:s}),u&&P_({mainAxis:!0,crossAxis:!1,limiter:g==="partial"?O_():void 0,...fe}),u&&M_({...fe}),R_({...fe,apply:({elements:Ve,rects:Qe,availableWidth:Ct,availableHeight:Yt})=>{const{width:bt,height:rn}=Qe.reference,zt=Ve.floating.style;zt.setProperty("--radix-popper-available-width",`${Ct}px`),zt.setProperty("--radix-popper-available-height",`${Yt}px`),zt.setProperty("--radix-popper-anchor-width",`${bt}px`),zt.setProperty("--radix-popper-anchor-height",`${rn}px`)}}),P&&L_({element:P,padding:l}),vB({arrowWidth:H,arrowHeight:K}),w&&D_({strategy:"referenceHidden",...fe})]}),[X,$]=wT(Y),te=gn(x);tn(()=>{oe&&(te==null||te())},[oe,te]);const _e=(z=Q.arrow)==null?void 0:z.x,ke=(ce=Q.arrow)==null?void 0:ce.y,xe=((Ae=Q.arrow)==null?void 0:Ae.centerOffset)!==0,[Pe,Te]=C.useState();return tn(()=>{E&&Te(window.getComputedStyle(E).zIndex)},[E]),d.jsx("div",{ref:q.setFloating,"data-radix-popper-content-wrapper":"",style:{...Z,transform:oe?Z.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Pe,"--radix-popper-transform-origin":[(Ce=Q.transformOrigin)==null?void 0:Ce.x,(Ne=Q.transformOrigin)==null?void 0:Ne.y].join(" "),...((ne=Q.hide)==null?void 0:ne.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:d.jsx(hB,{scope:n,placedSide:X,onArrowChange:_,arrowX:_e,arrowY:ke,shouldHideArrow:xe,children:d.jsx(lT.div,{"data-side":X,"data-align":$,...v,ref:N,style:{...v.style,animation:oe?void 0:"none"}})})})});mT.displayName=Cm;var vT="PopperArrow",gB={top:"bottom",right:"left",bottom:"top",left:"right"},yT=C.forwardRef(function(e,n){const{__scopePopper:r,...o}=e,a=pB(vT,r),s=gB[a.placedSide];return d.jsx("span",{ref:a.onArrowChange,style:{position:"absolute",left:a.arrowX,top:a.arrowY,[s]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[a.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[a.placedSide],visibility:a.shouldHideArrow?"hidden":void 0},children:d.jsx(dB,{...o,ref:n,style:{...o.style,display:"block"}})})});yT.displayName=vT;function mB(t){return t!==null}var vB=t=>({name:"transformOrigin",options:t,fn(e){var b,E,T;const{placement:n,rects:r,middlewareData:o}=e,s=((b=o.arrow)==null?void 0:b.centerOffset)!==0,l=s?0:t.arrowWidth,u=s?0:t.arrowHeight,[h,p]=wT(n),g={start:"0%",center:"50%",end:"100%"}[p],w=(((E=o.arrow)==null?void 0:E.x)??0)+l/2,y=(((T=o.arrow)==null?void 0:T.y)??0)+u/2;let x="",v="";return h==="bottom"?(x=s?g:`${w}px`,v=`${-u}px`):h==="top"?(x=s?g:`${w}px`,v=`${r.floating.height+u}px`):h==="right"?(x=`${-u}px`,v=s?g:`${y}px`):h==="left"&&(x=`${r.floating.width+u}px`,v=s?g:`${y}px`),{data:{x,y:v}}}});function wT(t){const[e,n="center"]=t.split("-");return[e,n]}var yB=hT,wB=gT,CB=mT,bB=yT,xB="Portal",CT=C.forwardRef((t,e)=>{var l;const{container:n,...r}=t,[o,a]=C.useState(!1);tn(()=>a(!0),[]);const s=n||o&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return s?Vf.createPortal(d.jsx(mn.div,{...r,ref:e}),s):null});CT.displayName=xB;var SB=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],_B=SB.reduce((t,e)=>{const n=mi(`Primitive.${e}`),r=C.forwardRef((o,a)=>{const{asChild:s,...l}=o,u=s?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d.jsx(u,{...l,ref:a})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{}),bT=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"}),EB="VisuallyHidden",TB=C.forwardRef((t,e)=>d.jsx(_B.span,{...t,ref:e,style:{...bT,...t.style}}));TB.displayName=EB;var AB=[" ","Enter","ArrowUp","ArrowDown"],IB=[" ","Enter"],Zi="Select",[Eu,Tu,kB]=KU(Zi),[is,zj]=gr(Zi,[kB,uT]),Au=uT(),[NB,_i]=is(Zi),[PB,OB]=is(Zi),xT=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:o,onOpenChange:a,value:s,defaultValue:l,onValueChange:u,dir:h,name:p,autoComplete:g,disabled:w,required:y,form:x}=t,v=Au(e),[b,E]=C.useState(null),[T,N]=C.useState(null),[P,_]=C.useState(!1),D=Cg(h),[H,K]=ui({prop:r,defaultProp:o??!1,onChange:a,caller:Zi}),[ee,W]=ui({prop:s,defaultProp:l,onChange:u,caller:Zi}),de=C.useRef(null),se=b?x||!!b.closest("form"):!0,[fe,q]=C.useState(new Set),Z=Array.from(fe).map(Y=>Y.props.value).join(";");return d.jsx(yB,{...v,children:d.jsxs(NB,{required:y,scope:e,trigger:b,onTriggerChange:E,valueNode:T,onValueNodeChange:N,valueNodeHasChildren:P,onValueNodeHasChildrenChange:_,contentId:Mo(),value:ee,onValueChange:W,open:H,onOpenChange:K,dir:D,triggerPointerDownPosRef:de,disabled:w,children:[d.jsx(Eu.Provider,{scope:e,children:d.jsx(PB,{scope:t.__scopeSelect,onNativeOptionAdd:C.useCallback(Y=>{q(oe=>new Set(oe).add(Y))},[]),onNativeOptionRemove:C.useCallback(Y=>{q(oe=>{const Q=new Set(oe);return Q.delete(Y),Q})},[]),children:n})}),se?d.jsxs(KT,{"aria-hidden":!0,required:y,tabIndex:-1,name:p,autoComplete:g,value:ee,onChange:Y=>W(Y.target.value),disabled:w,form:x,children:[ee===void 0?d.jsx("option",{value:""}):null,Array.from(fe)]},Z):null]})})};xT.displayName=Zi;var ST="SelectTrigger",_T=C.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...o}=t,a=Au(n),s=_i(ST,n),l=s.disabled||r,u=rt(e,s.onTriggerChange),h=Tu(n),p=C.useRef("touch"),[g,w,y]=jT(v=>{const b=h().filter(N=>!N.disabled),E=b.find(N=>N.value===s.value),T=WT(b,v,E);T!==void 0&&s.onValueChange(T.value)}),x=v=>{l||(s.onOpenChange(!0),y()),v&&(s.triggerPointerDownPosRef.current={x:Math.round(v.pageX),y:Math.round(v.pageY)})};return d.jsx(wB,{asChild:!0,...a,children:d.jsx(mn.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":GT(s.value)?"":void 0,...o,ref:u,onClick:Ue(o.onClick,v=>{v.currentTarget.focus(),p.current!=="mouse"&&x(v)}),onPointerDown:Ue(o.onPointerDown,v=>{p.current=v.pointerType;const b=v.target;b.hasPointerCapture(v.pointerId)&&b.releasePointerCapture(v.pointerId),v.button===0&&v.ctrlKey===!1&&v.pointerType==="mouse"&&(x(v),v.preventDefault())}),onKeyDown:Ue(o.onKeyDown,v=>{const b=g.current!=="";!(v.ctrlKey||v.altKey||v.metaKey)&&v.key.length===1&&w(v.key),!(b&&v.key===" ")&&AB.includes(v.key)&&(x(),v.preventDefault())})})})});_T.displayName=ST;var ET="SelectValue",TT=C.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:o,children:a,placeholder:s="",...l}=t,u=_i(ET,n),{onValueNodeHasChildrenChange:h}=u,p=a!==void 0,g=rt(e,u.onValueNodeChange);return tn(()=>{h(p)},[h,p]),d.jsx(mn.span,{...l,ref:g,style:{pointerEvents:"none"},children:GT(u.value)?d.jsx(d.Fragment,{children:s}):a})});TT.displayName=ET;var MB="SelectIcon",AT=C.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...o}=t;return d.jsx(mn.span,{"aria-hidden":!0,...o,ref:e,children:r||"▼"})});AT.displayName=MB;var RB="SelectPortal",IT=t=>d.jsx(CT,{asChild:!0,...t});IT.displayName=RB;var ea="SelectContent",kT=C.forwardRef((t,e)=>{const n=_i(ea,t.__scopeSelect),[r,o]=C.useState();if(tn(()=>{o(new DocumentFragment)},[]),!n.open){const a=r;return a?Ia.createPortal(d.jsx(NT,{scope:t.__scopeSelect,children:d.jsx(Eu.Slot,{scope:t.__scopeSelect,children:d.jsx("div",{children:t.children})})}),a):null}return d.jsx(PT,{...t,ref:e})});kT.displayName=ea;var Vr=10,[NT,Ei]=is(ea),DB="SelectContentImpl",LB=mi("SelectContent.RemoveScroll"),PT=C.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:s,side:l,sideOffset:u,align:h,alignOffset:p,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:x,hideWhenDetached:v,avoidCollisions:b,...E}=t,T=_i(ea,n),[N,P]=C.useState(null),[_,D]=C.useState(null),H=rt(e,z=>P(z)),[K,ee]=C.useState(null),[W,de]=C.useState(null),se=Tu(n),[fe,q]=C.useState(!1),Z=C.useRef(!1);C.useEffect(()=>{if(N)return pb(N)},[N]),QC();const Y=C.useCallback(z=>{const[ce,...Ae]=se().map(ne=>ne.ref.current),[Ce]=Ae.slice(-1),Ne=document.activeElement;for(const ne of z)if(ne===Ne||(ne==null||ne.scrollIntoView({block:"nearest"}),ne===ce&&_&&(_.scrollTop=0),ne===Ce&&_&&(_.scrollTop=_.scrollHeight),ne==null||ne.focus(),document.activeElement!==Ne))return},[se,_]),oe=C.useCallback(()=>Y([K,N]),[Y,K,N]);C.useEffect(()=>{fe&&oe()},[fe,oe]);const{onOpenChange:Q,triggerPointerDownPosRef:X}=T;C.useEffect(()=>{if(N){let z={x:0,y:0};const ce=Ce=>{var Ne,ne;z={x:Math.abs(Math.round(Ce.pageX)-(((Ne=X.current)==null?void 0:Ne.x)??0)),y:Math.abs(Math.round(Ce.pageY)-(((ne=X.current)==null?void 0:ne.y)??0))}},Ae=Ce=>{z.x<=10&&z.y<=10?Ce.preventDefault():N.contains(Ce.target)||Q(!1),document.removeEventListener("pointermove",ce),X.current=null};return X.current!==null&&(document.addEventListener("pointermove",ce),document.addEventListener("pointerup",Ae,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",ce),document.removeEventListener("pointerup",Ae,{capture:!0})}}},[N,Q,X]),C.useEffect(()=>{const z=()=>Q(!1);return window.addEventListener("blur",z),window.addEventListener("resize",z),()=>{window.removeEventListener("blur",z),window.removeEventListener("resize",z)}},[Q]);const[$,te]=jT(z=>{const ce=se().filter(Ne=>!Ne.disabled),Ae=ce.find(Ne=>Ne.ref.current===document.activeElement),Ce=WT(ce,z,Ae);Ce&&setTimeout(()=>Ce.ref.current.focus())}),_e=C.useCallback((z,ce,Ae)=>{const Ce=!Z.current&&!Ae;(T.value!==void 0&&T.value===ce||Ce)&&(ee(z),Ce&&(Z.current=!0))},[T.value]),ke=C.useCallback(()=>N==null?void 0:N.focus(),[N]),xe=C.useCallback((z,ce,Ae)=>{const Ce=!Z.current&&!Ae;(T.value!==void 0&&T.value===ce||Ce)&&de(z)},[T.value]),Pe=r==="popper"?bm:OT,Te=Pe===bm?{side:l,sideOffset:u,align:h,alignOffset:p,arrowPadding:g,collisionBoundary:w,collisionPadding:y,sticky:x,hideWhenDetached:v,avoidCollisions:b}:{};return d.jsx(NT,{scope:n,content:N,viewport:_,onViewportChange:D,itemRefCallback:_e,selectedItem:K,onItemLeave:ke,itemTextRefCallback:xe,focusSelectedItem:oe,selectedItemText:W,position:r,isPositioned:fe,searchRef:$,children:d.jsx(_p,{as:LB,allowPinchZoom:!0,children:d.jsx(rT,{asChild:!0,trapped:T.open,onMountAutoFocus:z=>{z.preventDefault()},onUnmountAutoFocus:Ue(o,z=>{var ce;(ce=T.trigger)==null||ce.focus({preventScroll:!0}),z.preventDefault()}),children:d.jsx(ZE,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:s,onFocusOutside:z=>z.preventDefault(),onDismiss:()=>T.onOpenChange(!1),children:d.jsx(Pe,{role:"listbox",id:T.contentId,"data-state":T.open?"open":"closed",dir:T.dir,onContextMenu:z=>z.preventDefault(),...E,...Te,onPlaced:()=>q(!0),ref:H,style:{display:"flex",flexDirection:"column",outline:"none",...E.style},onKeyDown:Ue(E.onKeyDown,z=>{const ce=z.ctrlKey||z.altKey||z.metaKey;if(z.key==="Tab"&&z.preventDefault(),!ce&&z.key.length===1&&te(z.key),["ArrowUp","ArrowDown","Home","End"].includes(z.key)){let Ce=se().filter(Ne=>!Ne.disabled).map(Ne=>Ne.ref.current);if(["ArrowUp","End"].includes(z.key)&&(Ce=Ce.slice().reverse()),["ArrowUp","ArrowDown"].includes(z.key)){const Ne=z.target,ne=Ce.indexOf(Ne);Ce=Ce.slice(ne+1)}setTimeout(()=>Y(Ce)),z.preventDefault()}})})})})})})});PT.displayName=DB;var FB="SelectItemAlignedPosition",OT=C.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...o}=t,a=_i(ea,n),s=Ei(ea,n),[l,u]=C.useState(null),[h,p]=C.useState(null),g=rt(e,H=>p(H)),w=Tu(n),y=C.useRef(!1),x=C.useRef(!0),{viewport:v,selectedItem:b,selectedItemText:E,focusSelectedItem:T}=s,N=C.useCallback(()=>{if(a.trigger&&a.valueNode&&l&&h&&v&&b&&E){const H=a.trigger.getBoundingClientRect(),K=h.getBoundingClientRect(),ee=a.valueNode.getBoundingClientRect(),W=E.getBoundingClientRect();if(a.dir!=="rtl"){const Ne=W.left-K.left,ne=ee.left-Ne,Ve=H.left-ne,Qe=H.width+Ve,Ct=Math.max(Qe,K.width),Yt=window.innerWidth-Vr,bt=JE(ne,[Vr,Math.max(Vr,Yt-Ct)]);l.style.minWidth=Qe+"px",l.style.left=bt+"px"}else{const Ne=K.right-W.right,ne=window.innerWidth-ee.right-Ne,Ve=window.innerWidth-H.right-ne,Qe=H.width+Ve,Ct=Math.max(Qe,K.width),Yt=window.innerWidth-Vr,bt=JE(ne,[Vr,Math.max(Vr,Yt-Ct)]);l.style.minWidth=Qe+"px",l.style.right=bt+"px"}const de=w(),se=window.innerHeight-Vr*2,fe=v.scrollHeight,q=window.getComputedStyle(h),Z=parseInt(q.borderTopWidth,10),Y=parseInt(q.paddingTop,10),oe=parseInt(q.borderBottomWidth,10),Q=parseInt(q.paddingBottom,10),X=Z+Y+fe+Q+oe,$=Math.min(b.offsetHeight*5,X),te=window.getComputedStyle(v),_e=parseInt(te.paddingTop,10),ke=parseInt(te.paddingBottom,10),xe=H.top+H.height/2-Vr,Pe=se-xe,Te=b.offsetHeight/2,z=b.offsetTop+Te,ce=Z+Y+z,Ae=X-ce;if(ce<=xe){const Ne=de.length>0&&b===de[de.length-1].ref.current;l.style.bottom="0px";const ne=h.clientHeight-v.offsetTop-v.offsetHeight,Ve=Math.max(Pe,Te+(Ne?ke:0)+ne+oe),Qe=ce+Ve;l.style.height=Qe+"px"}else{const Ne=de.length>0&&b===de[0].ref.current;l.style.top="0px";const Ve=Math.max(xe,Z+v.offsetTop+(Ne?_e:0)+Te)+Ae;l.style.height=Ve+"px",v.scrollTop=ce-xe+v.offsetTop}l.style.margin=`${Vr}px 0`,l.style.minHeight=$+"px",l.style.maxHeight=se+"px",r==null||r(),requestAnimationFrame(()=>y.current=!0)}},[w,a.trigger,a.valueNode,l,h,v,b,E,a.dir,r]);tn(()=>N(),[N]);const[P,_]=C.useState();tn(()=>{h&&_(window.getComputedStyle(h).zIndex)},[h]);const D=C.useCallback(H=>{H&&x.current===!0&&(N(),T==null||T(),x.current=!1)},[N,T]);return d.jsx(HB,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:y,onScrollButtonChange:D,children:d.jsx("div",{ref:u,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:P},children:d.jsx(mn.div,{...o,ref:g,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});OT.displayName=FB;var $B="SelectPopperPosition",bm=C.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Vr,...a}=t,s=Au(n);return d.jsx(CB,{...s,...a,ref:e,align:r,collisionPadding:o,style:{boxSizing:"border-box",...a.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)"}})});bm.displayName=$B;var[HB,xm]=is(ea,{}),Sm="SelectViewport",MT=C.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...o}=t,a=Ei(Sm,n),s=xm(Sm,n),l=rt(e,a.onViewportChange),u=C.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:r}),d.jsx(Eu.Slot,{scope:n,children:d.jsx(mn.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:Ue(o.onScroll,h=>{const p=h.currentTarget,{contentWrapper:g,shouldExpandOnScrollRef:w}=s;if(w!=null&&w.current&&g){const y=Math.abs(u.current-p.scrollTop);if(y>0){const x=window.innerHeight-Vr*2,v=parseFloat(g.style.minHeight),b=parseFloat(g.style.height),E=Math.max(v,b);if(E<x){const T=E+y,N=Math.min(x,T),P=T-N;g.style.height=N+"px",g.style.bottom==="0px"&&(p.scrollTop=P>0?P:0,g.style.justifyContent="flex-end")}}}u.current=p.scrollTop})})})]})});MT.displayName=Sm;var RT="SelectGroup",[UB,BB]=is(RT),zB=C.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=Mo();return d.jsx(UB,{scope:n,id:o,children:d.jsx(mn.div,{role:"group","aria-labelledby":o,...r,ref:e})})});zB.displayName=RT;var DT="SelectLabel",LT=C.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=BB(DT,n);return d.jsx(mn.div,{id:o.id,...r,ref:e})});LT.displayName=DT;var Iu="SelectItem",[VB,FT]=is(Iu),$T=C.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:a,...s}=t,l=_i(Iu,n),u=Ei(Iu,n),h=l.value===r,[p,g]=C.useState(a??""),[w,y]=C.useState(!1),x=rt(e,T=>{var N;return(N=u.itemRefCallback)==null?void 0:N.call(u,T,r,o)}),v=Mo(),b=C.useRef("touch"),E=()=>{o||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")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(VB,{scope:n,value:r,disabled:o,textId:v,isSelected:h,onItemTextChange:C.useCallback(T=>{g(N=>N||((T==null?void 0:T.textContent)??"").trim())},[]),children:d.jsx(Eu.ItemSlot,{scope:n,value:r,disabled:o,textValue:p,children:d.jsx(mn.div,{role:"option","aria-labelledby":v,"data-highlighted":w?"":void 0,"aria-selected":h&&w,"data-state":h?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...s,ref:x,onFocus:Ue(s.onFocus,()=>y(!0)),onBlur:Ue(s.onBlur,()=>y(!1)),onClick:Ue(s.onClick,()=>{b.current!=="mouse"&&E()}),onPointerUp:Ue(s.onPointerUp,()=>{b.current==="mouse"&&E()}),onPointerDown:Ue(s.onPointerDown,T=>{b.current=T.pointerType}),onPointerMove:Ue(s.onPointerMove,T=>{var N;b.current=T.pointerType,o?(N=u.onItemLeave)==null||N.call(u):b.current==="mouse"&&T.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Ue(s.onPointerLeave,T=>{var N;T.currentTarget===document.activeElement&&((N=u.onItemLeave)==null||N.call(u))}),onKeyDown:Ue(s.onKeyDown,T=>{var P;((P=u.searchRef)==null?void 0:P.current)!==""&&T.key===" "||(IB.includes(T.key)&&E(),T.key===" "&&T.preventDefault())})})})})});$T.displayName=Iu;var _c="SelectItemText",HT=C.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:o,...a}=t,s=_i(_c,n),l=Ei(_c,n),u=FT(_c,n),h=OB(_c,n),[p,g]=C.useState(null),w=rt(e,E=>g(E),u.onItemTextChange,E=>{var T;return(T=l.itemTextRefCallback)==null?void 0:T.call(l,E,u.value,u.disabled)}),y=p==null?void 0:p.textContent,x=C.useMemo(()=>d.jsx("option",{value:u.value,disabled:u.disabled,children:y},u.value),[u.disabled,u.value,y]),{onNativeOptionAdd:v,onNativeOptionRemove:b}=h;return tn(()=>(v(x),()=>b(x)),[v,b,x]),d.jsxs(d.Fragment,{children:[d.jsx(mn.span,{id:u.textId,...a,ref:w}),u.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Ia.createPortal(a.children,s.valueNode):null]})});HT.displayName=_c;var UT="SelectItemIndicator",BT=C.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return FT(UT,n).isSelected?d.jsx(mn.span,{"aria-hidden":!0,...r,ref:e}):null});BT.displayName=UT;var _m="SelectScrollUpButton",KB=C.forwardRef((t,e)=>{const n=Ei(_m,t.__scopeSelect),r=xm(_m,t.__scopeSelect),[o,a]=C.useState(!1),s=rt(e,r.onScrollButtonChange);return tn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const h=u.scrollTop>0;a(h)};const u=n.viewport;return l(),u.addEventListener("scroll",l),()=>u.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?d.jsx(zT,{...t,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:u}=n;l&&u&&(l.scrollTop=l.scrollTop-u.offsetHeight)}}):null});KB.displayName=_m;var Em="SelectScrollDownButton",GB=C.forwardRef((t,e)=>{const n=Ei(Em,t.__scopeSelect),r=xm(Em,t.__scopeSelect),[o,a]=C.useState(!1),s=rt(e,r.onScrollButtonChange);return tn(()=>{if(n.viewport&&n.isPositioned){let l=function(){const h=u.scrollHeight-u.clientHeight,p=Math.ceil(u.scrollTop)<h;a(p)};const u=n.viewport;return l(),u.addEventListener("scroll",l),()=>u.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),o?d.jsx(zT,{...t,ref:s,onAutoScroll:()=>{const{viewport:l,selectedItem:u}=n;l&&u&&(l.scrollTop=l.scrollTop+u.offsetHeight)}}):null});GB.displayName=Em;var zT=C.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=t,a=Ei("SelectScrollButton",n),s=C.useRef(null),l=Tu(n),u=C.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return C.useEffect(()=>()=>u(),[u]),tn(()=>{var p;const h=l().find(g=>g.ref.current===document.activeElement);(p=h==null?void 0:h.ref.current)==null||p.scrollIntoView({block:"nearest"})},[l]),d.jsx(mn.div,{"aria-hidden":!0,...o,ref:e,style:{flexShrink:0,...o.style},onPointerDown:Ue(o.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(r,50))}),onPointerMove:Ue(o.onPointerMove,()=>{var h;(h=a.onItemLeave)==null||h.call(a),s.current===null&&(s.current=window.setInterval(r,50))}),onPointerLeave:Ue(o.onPointerLeave,()=>{u()})})}),jB="SelectSeparator",VT=C.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return d.jsx(mn.div,{"aria-hidden":!0,...r,ref:e})});VT.displayName=jB;var Tm="SelectArrow",WB=C.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,o=Au(n),a=_i(Tm,n),s=Ei(Tm,n);return a.open&&s.position==="popper"?d.jsx(bB,{...o,...r,ref:e}):null});WB.displayName=Tm;var qB="SelectBubbleInput",KT=C.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const o=C.useRef(null),a=rt(r,o),s=iS(e);return C.useEffect(()=>{const l=o.current;if(!l)return;const u=window.HTMLSelectElement.prototype,p=Object.getOwnPropertyDescriptor(u,"value").set;if(s!==e&&p){const g=new Event("change",{bubbles:!0});p.call(l,e),l.dispatchEvent(g)}},[s,e]),d.jsx(mn.select,{...n,style:{...bT,...n.style},ref:a,defaultValue:e})});KT.displayName=qB;function GT(t){return t===""||t===void 0}function jT(t){const e=gn(t),n=C.useRef(""),r=C.useRef(0),o=C.useCallback(s=>{const l=n.current+s;e(l),function u(h){n.current=h,window.clearTimeout(r.current),h!==""&&(r.current=window.setTimeout(()=>u(""),1e3))}(l)},[e]),a=C.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return C.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,o,a]}function WT(t,e,n){const o=e.length>1&&Array.from(e).every(h=>h===e[0])?e[0]:e,a=n?t.indexOf(n):-1;let s=YB(t,Math.max(a,0));o.length===1&&(s=s.filter(h=>h!==n));const u=s.find(h=>h.textValue.toLowerCase().startsWith(o.toLowerCase()));return u!==n?u:void 0}function YB(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var JB=xT,qT=_T,QB=TT,XB=AT,ZB=IT,YT=kT,e3=MT,JT=LT,QT=$T,t3=HT,n3=BT,XT=VT;const Am=JB,Im=QB,ku=C.forwardRef(({className:t,children:e,...n},r)=>d.jsxs(qT,{ref:r,className:ze("flex h-9 w-full items-center justify-between rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50",t),...n,children:[e,d.jsx(XB,{asChild:!0,children:d.jsx(UD,{className:"h-4 w-4 opacity-50"})})]}));ku.displayName=qT.displayName;const Nu=C.forwardRef(({className:t,children:e,position:n="popper",...r},o)=>d.jsx(ZB,{children:d.jsx(YT,{ref:o,className:ze("relative z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md 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",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:d.jsx(e3,{className:ze("p-1",n==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:e})})}));Nu.displayName=YT.displayName;const r3=C.forwardRef(({className:t,...e},n)=>d.jsx(JT,{ref:n,className:ze("px-2 py-1.5 text-sm font-semibold",t),...e}));r3.displayName=JT.displayName;const ta=C.forwardRef(({className:t,children:e,...n},r)=>d.jsxs(QT,{ref:r,className:ze("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...n,children:[d.jsx("span",{className:"absolute right-2 flex h-3.5 w-3.5 items-center justify-center",children:d.jsx(n3,{children:d.jsx($x,{className:"h-4 w-4"})})}),d.jsx(t3,{children:e})]}));ta.displayName=QT.displayName;const o3=C.forwardRef(({className:t,...e},n)=>d.jsx(XT,{ref:n,className:ze("-mx-1 my-1 h-px bg-muted",t),...e}));o3.displayName=XT.displayName;const km=[{value:"VIEW_DOCUMENT",label:"Chỉ xem"},{value:"EDIT_DOCUMENT",label:"Chỉnh sửa"},{value:"DOWNLOAD_DOCUMENT",label:"Tải xuống"}];function i3({onClose:t,open:e,file:n,apiBaseUrl:r,rootUrlHostApi:o}){const[a,s]=M.useState("users"),[l,u]=M.useState(""),[h,p]=M.useState(""),[g,w]=M.useState(""),[y,x]=M.useState(""),[v,b]=M.useState(zr.VIEW_DOCUMENT),[E,T]=M.useState([]),{users:N,groups:P,sharedUsers:_,sharedGroups:D,fetchData:H,loading:K,postGranted:ee,loadingGrandted:W,setSharedGroups:de,setSharedUsers:se}=$H(r,o),fe=qi(),q=n?n.key:"",Z=N.filter(z=>{var ce;return(fe==null?void 0:fe.id)!==z.id&&(z.username.toLowerCase().includes(l.toLowerCase())||((ce=z.email)==null?void 0:ce.toLowerCase().includes(l.toLowerCase())))}),Y=P.filter(z=>z.groupname.toLowerCase().includes(h.toLowerCase())),oe=_.filter(z=>{var ce,Ae;return((ce=z.username)==null?void 0:ce.toLowerCase().includes(g.toLowerCase()))||((Ae=z.email)==null?void 0:Ae.toLowerCase().includes(g.toLowerCase()))}),Q=D.filter(z=>{var ce;return(ce=z.groupname)==null?void 0:ce.toLowerCase().includes(y.toLowerCase())}),X=z=>{b(z),T(ce=>ce.map(Ae=>({...Ae,permissions:z})))},$=()=>{a==="users"?(u(""),w("")):(p(""),x(""),s("users")),T([]),b(zr.VIEW_DOCUMENT)};M.useEffect(()=>{e?H(q):$()},[e,q]);const te=z=>{z!==a&&(a==="users"?(u(""),w("")):(p(""),x(""))),s(z)},_e=z=>{n&&T(ce=>{if(ce.find(ne=>ne.userId===z))return ce.filter(ne=>ne.userId!==z);const Ne={path:n.key+n.name,permissions:v,userId:z,grandtedBy:fe==null?void 0:fe.id};return[...ce,Ne]})},ke=z=>{if(!n)return;const ce=z.groupname;T(Ae=>{if(Ae.find(Ve=>Ve.groupname===ce))return Ae.filter(Ve=>Ve.groupname!==ce);const ne={path:n.key+n.name,permissions:v,groupname:ce,groupId:z.id,grandtedBy:fe==null?void 0:fe.id,users:z.users};return[...Ae,ne]})},xe=async(z,ce,Ae)=>{const Ce={...z,permissions:ce};T(Ne=>{const ne=Ne.map(Qe=>Qe.id===Ce.id?Ce:Qe);return Ne.some(Qe=>Qe.id===Ce.id)||ne.push(Ce),ne}),Ae==="users"?se(Ne=>Ne.map(ne=>ne.id===z.id?Ce:ne)):de(Ne=>Ne.map(ne=>ne.id===z.id?Ce:ne))},Pe=async()=>{if(n){const z=(n==null?void 0:n.key)||""+(n==null?void 0:n.name),ce=await ee(z,fe==null?void 0:fe.id,E);(ce==null?void 0:ce.status)==200&&T([])}},Te="flex-1 min-h-0 overflow-y-auto border rounded-lg px-3 py-2 bg-background shadow-sm";return n?d.jsx(ar,{open:e,onOpenChange:t,children:d.jsxs(zn,{className:"max-w-5xl h-[80vh] flex flex-col overflow-hidden",children:[d.jsx(Vn,{children:d.jsxs(Kn,{className:"text-lg font-semibold",children:["Chia sẻ tài liệu: ",n.name]})}),d.jsxs(_g,{defaultValue:"users",className:"flex-1 flex flex-col overflow-hidden",children:[d.jsxs(ou,{className:"grid grid-cols-2 w-1/2 mx-auto mb-4 bg-muted rounded-lg",children:[d.jsx(Yi,{value:"users",className:"py-2",onClick:()=>te("users"),children:"Người dùng"}),d.jsx(Yi,{value:"groups",className:"py-2",onClick:()=>te("groups"),children:"Nhóm"})]}),d.jsx(Ji,{value:"users",className:"flex-1 h-full min-h-0 overflow-hidden",children:d.jsxs("div",{className:"grid grid-cols-2 gap-6 h-full",children:[d.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[d.jsx("p",{className:"text-sm font-semibold mb-2",children:"Chia sẻ với người dùng:"}),d.jsx(Gn,{placeholder:"Tìm người dùng...",className:"mb-3 border-input bg-background shadow-sm",value:l,onChange:z=>u(z.target.value)}),d.jsx("div",{className:Te,children:K?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(kt,{className:"h-10 w-10 animate-spin text-muted-foreground"})}):Z.length===0?d.jsx("p",{className:"text-muted-foreground italic text-center h-full flex items-center justify-center",children:"Không tìm thấy người dùng."}):d.jsx("ul",{className:"space-y-2",children:Z.map(z=>d.jsx("li",{onClick:()=>_e(z.id),className:"flex flex-col space-y-1 cursor-pointer hover:bg-accent p-2 rounded-md transition-colors",children:d.jsxs("div",{className:"flex items-center space-x-3",children:[d.jsx(dc,{id:`user-${z.id}`,checked:!!E.find(ce=>ce.userId===z.id)}),d.jsxs(mr,{className:"flex-1",children:[d.jsx("p",{className:"font-medium",children:z.username}),d.jsx("p",{className:"text-xs text-muted-foreground",children:z.email}),d.jsx("p",{className:"text-xs text-muted-foreground",children:z.groupname})]})]})},z.id))})})]}),d.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[d.jsx("p",{className:"text-sm font-semibold mb-2",children:"Đã chia sẻ với người dùng:"}),d.jsx(Gn,{placeholder:"Tìm người dùng đã chia sẻ...",className:"mb-3 border-input bg-background shadow-sm",value:g,onChange:z=>w(z.target.value)}),d.jsx("div",{className:Te,children:K?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(kt,{className:"h-10 w-10 animate-spin text-muted-foreground"})}):oe.length===0?d.jsx("p",{className:"text-muted-foreground italic text-center h-full flex items-center justify-center",children:"Chưa chia sẻ với người dùng nào."}):d.jsx("ul",{className:"space-y-2",children:oe.map(z=>d.jsxs("li",{className:"flex items-center justify-between gap-4 hover:bg-accent p-2 rounded-md transition-colors",children:[d.jsxs("div",{className:"flex flex-col",children:[d.jsx("p",{className:"font-medium",children:z.username}),d.jsx("p",{className:"text-xs text-muted-foreground",children:z.email}),d.jsx("p",{className:"text-xs text-muted-foreground",children:z.groupname})]}),d.jsxs(Am,{value:z.permissions,onValueChange:ce=>xe(z,ce,"users"),disabled:z.permissions===zr.OWNER_DOCUMENT,children:[d.jsx(ku,{className:"w-[120px]",children:d.jsx(Im,{placeholder:"Chọn quyền"})}),d.jsxs(Nu,{children:[km.map(ce=>d.jsx(ta,{value:ce.value,children:ce.label},ce.value)),z.permissions===zr.OWNER_DOCUMENT&&d.jsx(ta,{value:zr.OWNER_DOCUMENT,children:"Chủ sở hữu"},zr.OWNER_DOCUMENT),d.jsx(ta,{value:"None",children:"Thu hồi"},"None")]})]})]},z.id))})})]})]})}),d.jsx(Ji,{value:"groups",className:"flex-1 h-full min-h-0 overflow-hidden",children:d.jsxs("div",{className:"grid grid-cols-2 gap-6 h-full",children:[d.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[d.jsx("p",{className:"text-sm font-semibold mb-2",children:"Chia sẻ với nhóm:"}),d.jsx(Gn,{placeholder:"Tìm nhóm...",className:"mb-3 border-input bg-background shadow-sm",value:h,onChange:z=>p(z.target.value)}),d.jsx("div",{className:Te,children:K?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(kt,{className:"h-10 w-10 animate-spin text-muted-foreground"})}):Y.length===0?d.jsx("p",{className:"text-muted-foreground italic text-center h-full flex items-center justify-center",children:"Không tìm thấy nhóm."}):d.jsx("ul",{className:"space-y-2",children:Y.map(z=>d.jsxs("li",{onClick:()=>ke(z),className:"flex items-center space-x-3 cursor-pointer hover:bg-accent p-2 rounded-md transition-colors",children:[d.jsx(dc,{id:`group-${z.groupname}`,checked:!!E.find(ce=>ce.groupname===z.groupname)}),d.jsxs(mr,{className:"font-medium",children:[d.jsx("p",{className:"font-medium",children:z.groupname}),d.jsxs("p",{className:"text-xs text-muted-foreground",children:["Số lượng: ",z.users||0]})]})]},z.groupname))})})]}),d.jsxs("div",{className:"flex flex-col flex-1 min-h-0",children:[d.jsx("p",{className:"text-sm font-semibold mb-2",children:"Đã chia sẻ với nhóm:"}),d.jsx(Gn,{placeholder:"Tìm nhóm đã chia sẻ...",className:"mb-3 border-input bg-background shadow-sm",value:y,onChange:z=>x(z.target.value)}),d.jsx("div",{className:Te,children:K?d.jsx("div",{className:"flex items-center justify-center h-full",children:d.jsx(kt,{className:"h-10 w-10 animate-spin text-muted-foreground"})}):Q.length===0?d.jsx("p",{className:"text-muted-foreground italic text-center h-full flex items-center justify-center",children:"Chưa chia sẻ với nhóm nào."}):d.jsx("ul",{className:"space-y-2",children:Q.map(z=>d.jsxs("li",{className:"flex items-center justify-between gap-4 hover:bg-accent p-2 rounded-md transition-colors",children:[d.jsxs("div",{className:"flex flex-col",children:[d.jsx("p",{className:"font-medium",children:z.groupname}),d.jsxs("p",{className:"text-xs text-muted-foreground",children:["Số lượng: ",z.users||0]})]}),d.jsxs(Am,{value:z.permissions,onValueChange:ce=>xe(z,ce,"groups"),children:[d.jsx(ku,{className:"w-[120px]",children:d.jsx(Im,{placeholder:"Chọn quyền"})}),d.jsxs(Nu,{children:[km.map(ce=>d.jsx(ta,{value:ce.value,children:ce.label},ce.value)),d.jsx(ta,{value:"None",children:"Thu hồi"},"None")]})]})]},z.groupname))})})]})]})})]}),d.jsxs("div",{className:"mt-4 bg-muted/50 p-4 rounded-lg",children:[d.jsx(mr,{className:"font-medium mb-2 block",children:"Phân quyền:"}),d.jsxs(Am,{value:v,onValueChange:X,children:[d.jsx(ku,{className:"w-1/2 border border-input bg-background shadow-sm hover:bg-accent",children:d.jsx(Im,{placeholder:"Chọn quyền truy cập"})}),d.jsx(Nu,{children:km.map(z=>d.jsx(ta,{value:z.value,className:"flex items-center gap-2",children:z.label}))})]})]}),d.jsxs(Fr,{children:[d.jsx(He,{variant:"outline",onClick:t,children:"Huỷ"}),d.jsx(He,{variant:"default",onClick:Pe,disabled:E.length===0||W,className:"w-[120px] justify-center",children:W?d.jsx(kt,{className:"h-4 w-4 animate-spin"}):"Lưu thay đổi"})]})]})}):null}const a3={},s3="AIzaSyBI8KiTWudkw8iR5cjH7ZsA4JBN1NqJw8A",c3="726815747852-5deq413t8kd8j3mgj48d46eatjauapq5.apps.googleusercontent.com",l3="https://www.googleapis.com/auth/drive";Lo(Le,{retries:3,shouldResetTimeout:!0,retryCondition:t=>Lo.isRetryableError(t)&&t.config.method==="get"});const Wn={current:!1},ZT="crawl:jobs",as="crawl:current_job",d3=t=>{const[e,n]=M.useState(null),[r,o]=M.useState(0);return M.useEffect(()=>{const a=localStorage.getItem(as);if(a){const s=JSON.parse(a);n(s),s!=null&&s.startTime&&o(Math.floor((Date.now()-s.startTime)/1e3))}},[]),M.useEffect(()=>{if(!(e!=null&&e.startTime))return;const a=setInterval(()=>{o(Math.floor((Date.now()-e.startTime)/1e3))},1e3);return()=>clearInterval(a)},[e==null?void 0:e.startTime]),M.useEffect(()=>{if(!(e!=null&&e.id))return;const a=async()=>{try{const u=(await Le.get(`${t}/api/crawl/${e.id}?taskId=${e.taskId}`)).data;n(h=>{if(!h)return null;const p={...h,status:u};return localStorage.setItem(as,JSON.stringify(p)),(u.status==="completed"||u.status==="failed")&&setTimeout(()=>{n(null),localStorage.removeItem(as)},100),p})}catch(l){console.error("Error polling job status:",l)}},s=setInterval(a,3e3);return a(),()=>clearInterval(s)},[e==null?void 0:e.id,t]),{currentJob:e,elapsedTime:r,setCurrentJob:a=>{a&&!a.startTime&&(a.startTime=Date.now()),n(a),a?localStorage.setItem(as,JSON.stringify(a)):localStorage.removeItem(as)}}},Pu=(t,e)=>{const n=[],r=o=>{(t[o]||[]).forEach(s=>{n.push(s.key),s.isFolder&&r(s.key)})};return r(e),n},u3=(t,e)=>{const n=[];return(t[e]||[]).forEach(o=>{n.push(o.key),o.isFolder&&n.push(...Pu(t,o.key))}),n},f3=(t,e,n=[],r,o,a,s,l,u,h)=>{const[p,g]=M.useState({}),[w,y]=M.useState(!1),[x,v]=M.useState(null),[b,E]=M.useState(0),T=M.useRef(e);M.useEffect(()=>{T.current=e},[e]);const N=async()=>{var _;y(!0);try{const D=qi(),H=await Le.get(`${t}/api/files`,{params:{cache:!1,displayPrefixes:JSON.stringify(n),prefix:T.current,userId:(D==null?void 0:D.id)||"",groupId:((_=D==null?void 0:D.group)==null?void 0:_.id)||"",groupname:(D==null?void 0:D.groupname)||""},timeout:3e5}),K=[];zd.forEach(H.data,(ee,W)=>{l!=null&&l.has(W)&&zd.forEach(ee,de=>{(u==null?void 0:u.current[de.key])!==!1&&K.push(de.key)})}),K.length&&(h==null||h(ee=>{const W=new Set(ee);return K.forEach(de=>W.add(de)),W})),g(H.data),v(null)}catch(D){v(D instanceof Error?D:new Error("Failed to fetch files"))}finally{y(!1),E(0),a("")}},P=async _=>{var D,H;try{if(!_)return;y(!0);const K=await Le.get(`${t}/api/search-db?query=${_}&rootPrefix=${e}&offset=${(o-1)*20}&limit=20`,{timeout:3e5});return g({[e]:((D=K==null?void 0:K.data)==null?void 0:D.result)||[]}),E(((H=K==null?void 0:K.data)==null?void 0:H.estimatedTotalHits)||0),K}catch(K){v(K instanceof Error?K:new Error("Failed to fetch files"))}finally{y(!1)}};return M.useEffect(()=>{!r&&!w&&N(),r&&!w&&P(r)},[r,o]),{data:p,isLoading:w,error:x,estimatedTotalHits:b,refetch:N}},na=t=>{var r,o,a;const e=((a=(o=(r=t==null?void 0:t.name)==null?void 0:r.split("."))==null?void 0:o.pop())==null?void 0:a.toLowerCase())??"";return["txt","md","json","js","ts","jsx","tsx","css","html","xml","yaml","yml"].includes(e||"")},h3={auth:{clientId:"584d5fa9-5123-4602-a1a5-a3746a83745f",authority:"https://login.microsoftonline.com/consumers",redirectUri:a3.VITE_ONE_DRIVE_REDIRECT_URI||"https://s3-explorer.cmcts1.studio.ai.vn/sharepoint/redirect"}},p3=new pp(h3),Nm={[zr.VIEW_DOCUMENT]:1,[zr.DOWNLOAD_DOCUMENT]:2,[zr.EDIT_DOCUMENT]:10,[zr.OWNER_DOCUMENT]:100},ra=t=>{const e=qi();return`${e==null?void 0:e.groupname}`.toUpperCase()==="MASTER_ADMIN"?!0:t?Nm[t]>=10:!1},g3=t=>{const e=qi();return`${e==null?void 0:e.groupname}`.toUpperCase()==="MASTER_ADMIN"?!0:t?Nm[t]>=2:!1},m3=t=>{const e=qi();return`${e==null?void 0:e.groupname}`.toUpperCase()==="MASTER_ADMIN"?!0:t?Nm[t]>=1:!1},v3=M.memo(({homeLabel:t="Kho tài liệu",apiBaseUrl:e="http://localhost:3000",rootPrefix:n="",rootUrlHostApi:r="http://localhost:3003/api/v1",asSelector:o=!1,onSelected:a=h=>console.log("Đã chọn:",h),displayPrefixes:s,preSelectedFiles:l,idCreator:u})=>{var ki;const[h,p]=M.useState([]),[g,w]=M.useState(""),[y,x]=M.useState(new Set(l)),[v,b]=M.useState(n),[E,T]=M.useState(""),[N,P]=M.useState(!1),[_,D]=M.useState(""),[H,K]=M.useState(!1),[ee,W]=M.useState(null),[de,se]=M.useState(null),[fe,q]=M.useState(!1),[Z,Y]=M.useState(!1),[,oe]=M.useState(null),Q=M.useRef(null),{toast:X}=mc(),[$,te]=M.useState(null),[_e,ke]=M.useState(null),[xe,Pe]=M.useState(null),[Te,z]=M.useState(""),[ce,Ae]=M.useState(!1),[Ce,Ne]=M.useState(!1),[ne,Ve]=M.useState(new Set),[Qe,Ct]=M.useState(""),[Yt,bt]=M.useState(!1),[rn,zt]=M.useState(!1),[Rn,Kt]=M.useState("rename"),[L,J]=M.useState(!1),[U,ae]=M.useState(""),[ye,he]=M.useState("1"),[Ee,Xe]=M.useState(!1),[ft,xt]=M.useState(!1),[bo,Jt]=M.useState(!1),[vn,jr]=M.useState(!1),[Gt,dr]=M.useState(1),[Wr,ia]=M.useState(!1),{currentJob:Je,elapsedTime:zo,setCurrentJob:Nc}=d3(e),[xo,aa]=M.useState(null),[sa,cs]=M.useState(""),[Fu,ca]=M.useState(!1),[ls,$u]=M.useState(""),[Pc,Hu]=M.useState(!1),[Oc,Uu]=M.useState(!1),[ds,Bu]=M.useState([]),[la,zu]=M.useState(!1),[us,Fm]=M.useState(""),Vo=M.useRef({}),[Mc,Rc]=M.useState(null),$m=async A=>{Uu(!0);try{const O=await Le.get(`${r}get-knowledge-base/knowledge-base-name/${A}`,{headers:{Authorization:"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjAyOTliMmIwLTk4MGEtNGQ1Yy04NjkyLWJjNjllM2I1NzZlMiIsInVzZXJuYW1lIjoiY21jX3RzX2FkbWluIiwiaWF0IjoxNzQ3MTk0MTg3fQ.7LB2rgd0fQnhZP_cFgTTCPMSYl0_apwffcNEd7oqjeM"}});O.status===200&&Bu(O.data.knowledgeBase.chatflows.map(G=>({...G,KnowledgeBaseId:O.data.knowledgeBase.knowledge_base_id})))}catch{}finally{Uu(!1)}};M.useEffect(()=>{ls&&r&&$m(ls)},[ls]),M.useEffect(()=>{console.log("pre selected files",l)},[l]);const[Pt,Dc]=M.useState(null),[x0,Hm]=M.useState(!1),[Lc,Fc]=M.useState(!1),[da,fs]=M.useState(!1),[Vu,Ku]=M.useState([]),[$c,Hc]=M.useState([]),[ua,Uc]=M.useState([{id:"root",name:"OneDrive"}]),[Um,hs]=M.useState(!1),[ps,Bc]=M.useState([]),[Gu,Ko]=M.useState(!1),[gs,zc]=M.useState([]),[Vc,ms]=M.useState([]),[vs,ju]=M.useState([]),[Kc,fa]=M.useState([{id:"root",name:"SharePoint"}]),[So,ha]=M.useState(!1),[Gc,jc]=M.useState([]),[gt,qr]=M.useState(null),[Wu,ys]=M.useState(!1),[Bm,pa]=M.useState(!1),[Go,Wc]=M.useState(!1),Vm=new URL(window.location.href).searchParams.get("prefix")||""||E||n,[_0,qu]=M.useState(null),{data:En,isLoading:Ai,error:Km,estimatedTotalHits:ga,refetch:on}=f3(e,Vm,s,g,Gt,w,u,y,Vo,x),[qc,_o]=M.useState(!1),Yc=M.useRef(null),Jc=qi(),Ht=(()=>{const A=localStorage.getItem("dataLogin");try{if(A){const O=JSON.parse(A);return(O==null?void 0:O.user)??null}}catch{return null}return null})();M.useEffect(()=>{if(!qc)return;function A(O){Yc.current&&!Yc.current.contains(O.target)&&_o(!1)}return document.addEventListener("mousedown",A),()=>{document.removeEventListener("mousedown",A)}},[qc]);const Ot=async()=>{try{const A=await Le.get(`${e}/api/login-sharepoint`),{loginUrl:O}=A.data,G=window.open(O,"SharePoint Login","width=600,height=600");if(!G)throw new Error("Không thể mở cửa sổ pop-up");G.focus();const pe=setInterval(()=>{try{if(G.closed){clearInterval(pe);return}const be=G.location.href;if(be.includes("code=")){const Ie=new URL(be).searchParams.get("code");Ie&&(Yu(Ie),G.close(),clearInterval(pe))}}catch(be){be instanceof Error&&!be.message.includes("cross-origin")&&console.error("SharePoint login error:",be)}},1e3)}catch(A){st.error("Lỗi khi đăng nhập SharePoint: "+(A instanceof Error?A.message:"Lỗi không xác định"))}},At=async()=>{try{zc([]),fa([{id:"root",name:"SharePoint"}]),window.location.href="https://login.microsoftonline.com/common/oauth2/v2.0/logout?post_logout_redirect_uri="+encodeURIComponent(window.location.origin),X({title:"Success",description:"Logged out from SharePoint"})}catch(A){console.error("Error logging out from SharePoint:",A),X({title:"Error",description:"Failed to logout from SharePoint",variant:"destructive"})}},Yu=async A=>{try{const O=await Le.post(`${e}/api/get-sharepoint-access-token`,{code:A,userId:"1"}),{accessToken:G,refreshToken:pe}=O.data;localStorage.setItem("sharepoint_access_token",G),localStorage.setItem("refresh_sharepoint_access_token",pe),Fc(!0),ha(!0)}catch(O){console.error("❌ Error fetching SharePoint access token:",O),X({title:"Error",description:"Failed to connect to SharePoint",variant:"destructive"})}},Gm=async()=>{try{Ko(!0);const O=(await Le.post(`${e}/api/list-site-sharepoint`,{userId:"1"})).data.sites.map(G=>{const pe=new URL(G.webUrl);return{id:G.id,name:G.name,description:G.description,hostname:G.hostname||pe.hostname,sitePath:G.sitePath||pe.pathname.replace(/^\/+/,"")}});console.log("data",O),jc(O),Ko(!1)}catch(A){console.error("❌ Error fetching SharePoint sites:",A),X({title:"Error",description:"Failed to fetch SharePoint sites",variant:"destructive"}),Ko(!1)}},jm=async A=>{qr(A),console.log(A),await ws("root",A.name,A.hostname||"",A.sitePath||"")},ws=async(A,O,G,pe)=>{try{Ko(!0);const Ie=(await Le.post(`${e}/api/list-file-sharepoint`,{folderId:A,userId:"1",hostname:G,sitePath:pe})).data.files.map(Me=>({id:Me.id,name:Me.name,size:Me.size??0,lastModified:Me.lastModifiedDateTime?new Date(Me.lastModifiedDateTime):new Date,contentType:Me.mimeType??void 0,isFolder:Me.type==="folder",parentId:Me.parentId??""}));ms(Ie.filter(Me=>Me.isFolder)),zc(Ie.filter(Me=>!Me.isFolder)),ha(!0),fa(Me=>Me.some(Mt=>Mt.id===A)?Me:[...Me,{id:A,name:O==="root"?"SharePoint":O}]),Ko(!1)}catch(be){console.error("❌ Error fetching SharePoint files:",be),X({title:"Error",description:"Failed to fetch SharePoint files",variant:"destructive"}),Ko(!1)}},Wm=A=>{ju(O=>O.some(pe=>pe.id===A.id)?O.filter(pe=>pe.id!==A.id):[...O,{id:A.id,name:A.name,size:A.size,lastModified:A.lastModified,contentType:A.contentType,isFolder:A.isFolder,parentId:A.parentId}])},qm=A=>{var G;fa(pe=>pe.slice(0,A+1));const O=(G=Kc[A])==null?void 0:G.id;O&&ws(O,"SharePoint",(gt==null?void 0:gt.hostname)||"",(gt==null?void 0:gt.sitePath)||"")},Ju=async(A,O)=>{const G=localStorage.getItem("sharepoint_access_token");if(!G){st.error("Không tìm thấy access token. Vui lòng đăng nhập lại.");return}const pe=st.loading("Đang đồng bộ SharePoint...",{position:"bottom-right",autoClose:!1});try{const be={prefix:O,folders:[],files:[],hostname:(gt==null?void 0:gt.hostname)||"",sitePath:(gt==null?void 0:gt.sitePath)||"",isAutoUpdateKB:Go,refreshAccessToken:localStorage.getItem("refresh_sharepoint_access_token")||""};A.forEach(Me=>{Me.isFolder?be.folders.push({id:Me.id,name:Me.name}):be.files.push({id:Me.id,name:Me.name})});const Ie=await Le.post(`${e}/api/sync-sharepoint-to-s3`,be,{headers:{Authorization:`Bearer ${G}`}});on(),st.update(pe,{render:`Đồng bộ thành công! Đã tải lên ${Ie.data.uploadedKeys.length} file.`,type:"success",isLoading:!1,autoClose:3e3,position:"bottom-right"}),ha(!1)}catch(be){console.error("Lỗi khi đồng bộ file từ SharePoint:",be),st.update(pe,{render:"Không thể đồng bộ file từ SharePoint.",type:"error",isLoading:!1,autoClose:3e3,position:"bottom-right"})}},Qu=()=>{ha(!1),zc([]),ju([]),fa([{id:"root",name:"SharePoint"}])};M.useEffect(()=>{if(So){const O=new URLSearchParams(window.location.search).get("code");O&&(Yu(O),window.history.replaceState({},document.title,window.location.pathname))}},[So]),M.useEffect(()=>{p3.initialize().then(()=>{Hm(!0)}).catch(A=>console.error("❌ Lỗi khởi tạo MSAL:",A))},[]),M.useEffect(()=>{sn()},[]);async function sn(){localStorage.getItem("onedrive_access_token")&&Fc(!0)}const Cs=A=>{Bc(O=>O.some(pe=>pe.id===A.id)?O.filter(pe=>pe.id!==A.id):[...O,{id:A.id,name:A.name,size:A.size,lastModified:A.lastModified,contentType:A.contentType,isFolder:A.isFolder,parentId:A.parentId}])};function Yr(A){if(A===0)return"0 B";const O=1024,G=["B","KB","MB","GB","TB"],pe=Math.floor(Math.log(A)/Math.log(O));return parseFloat((A/Math.pow(O,pe)).toFixed(1))+" "+G[pe]}function Xu(A){const O=new Date(A);return O.toLocaleDateString()+" "+O.toLocaleTimeString()}const Qc=async()=>{try{const A=await Le.get(`${e}/api/login-one-drive`),{loginUrl:O}=A.data,G=window.open(O,"OneDrive Login","width=600,height=600");if(!G)throw new Error("Không thể mở cửa sổ pop-up");G.focus();const pe=setInterval(()=>{try{if(G.closed){clearInterval(pe);return}const be=G.location.href;if(be.includes("code=")){const Ie=new URL(be).searchParams.get("code");Ie&&(Zu(Ie),G.close(),clearInterval(pe))}}catch(be){be instanceof Error&&!be.message.includes("cross-origin")&&console.error("OneDrive login error:",be)}},1e3)}catch(A){st.error("Lỗi khi đăng nhập OneDrive: "+(A instanceof Error?A.message:"Lỗi không xác định"))}},qn=async()=>{try{await Le.post(`${e}/api/logout-one-drive`),localStorage.removeItem("onedrive_access_token"),st.success("Đã đăng xuất khỏi OneDrive"),window.location.href="https://login.microsoftonline.com/common/oauth2/v2.0/logout?post_logout_redirect_uri="+encodeURIComponent(window.location.origin)}catch(A){st.error("Lỗi khi đăng xuất OneDrive: "+(A instanceof Error?A.message:"Lỗi không xác định"))}},Zu=async A=>{try{const G=await Le.post(`${e}/api/get-one-drive-access-token`,{authorizationCode:A,userId:"1"}),{accessToken:pe}=G.data;localStorage.setItem("onedrive_access_token",pe),Fc(!0),fs(!0),await ma("root","One Drive")}catch(O){console.error("❌ Lỗi khi lấy Access Token:",O)}},ma=async(A,O)=>{try{hs(!0);const be=(await Le.post(`${e}/api/list-file-one-drive`,{folderId:A,userId:"1"})).data.map(Ie=>({id:Ie.id,name:Ie.name,size:Ie.size??0,lastModified:Ie.lastModifiedDateTime?new Date(Ie.lastModifiedDateTime):new Date,contentType:Ie.mimeType??void 0,isFolder:Ie.type==="folder",parentId:Ie.parentId??""}));Ku(be.filter(Ie=>Ie.isFolder)),Hc(be.filter(Ie=>!Ie.isFolder)),fs(!0),Uc(Ie=>Ie.some(Me=>Me.id===A)?Ie:[...Ie,{id:A,name:O==="root"?"OneDrive":O}]),hs(!1)}catch(G){console.error("Lỗi lấy danh sách file:",G),hs(!1)}},ef=A=>{if(A===ua.length-1)return;const O=ua[A];O&&(Uc(ua.slice(0,A+1)),ma(O.id,O.name))},tf=async(A,O)=>{const G=localStorage.getItem("onedrive_access_token");if(!G){st.error("Không tìm thấy access token. Vui lòng đăng nhập lại.");return}const pe=st.loading("Đang đồng bộ OneDrive...",{position:"bottom-right",autoClose:!1});try{const be={prefix:O,folders:[],files:[]};A.forEach(Me=>{Me.isFolder?be.folders.push({id:Me.id,name:Me.name}):be.files.push({id:Me.id,name:Me.name})});const Ie=await Le.post(`${e}/api/sync-one-drive-to-s3`,be,{headers:{Authorization:`Bearer ${G}`}});on(),st.update(pe,{render:`Đồng bộ thành công! Đã tải lên ${Ie.data.uploadedKeys.length} file.`,type:"success",isLoading:!1,autoClose:3e3,position:"bottom-right"})}catch(be){console.error("Lỗi khi đồng bộ file từ OneDrive:",be),st.update(pe,{render:"Không thể đồng bộ file từ OneDrive.",type:"error",isLoading:!1,autoClose:3e3,position:"bottom-right"})}},Xc=()=>{fs(!1),Uc([{id:"root",name:"OneDrive"}]),Ku([]),Hc([]),Bc([]),hs(!1)},nf=pM({onSuccess:A=>{qu(A.access_token),localStorage.setItem("google_access_token",A.access_token),Dn(A.access_token)},onError:()=>{console.log("Đăng nhập thất bại!")},scope:l3}),Dn=A=>{const O=document.createElement("script");O.src="https://apis.google.com/js/api.js",O.onload=()=>{window.gapi.load("picker",()=>Ym(A))},document.body.appendChild(O)},Ym=A=>{const O=new window.google.picker.DocsView(window.google.picker.ViewId.DOCS).setIncludeFolders(!0).setSelectFolderEnabled(!0).setOwnedByMe(!1),G=new window.google.picker.DocsView(window.google.picker.ViewId.DRIVE).setIncludeFolders(!0).setSelectFolderEnabled(!0);new window.google.picker.PickerBuilder().setDeveloperKey(s3).setOAuthToken(A).enableFeature(window.google.picker.Feature.MULTISELECT_ENABLED).setLocale("vi").addView(O).addView(G).setCallback(async be=>{if(be.action===window.google.picker.Action.PICKED){const Ie=be.docs.map(Me=>({id:Me.id,name:Me.name,mimeType:Me.mimeType}));await Yn(Ie,v)}}).build().setVisible(!0)},Yn=async(A,O="")=>{const G=localStorage.getItem("google_access_token");if(!G){console.error("❌ Không tìm thấy access token. Vui lòng đăng nhập lại."),st.error("Không tìm thấy access token. Vui lòng đăng nhập lại.",{position:"bottom-right"});return}const pe=st.loading("Đang đồng bộ...",{position:"bottom-right",autoClose:!1});try{const be={prefix:O,folders:[],files:[]};A.forEach(Me=>{Me.mimeType==="application/vnd.google-apps.folder"?be.folders.push({id:Me.id,name:Me.name}):be.files.push({id:Me.id,name:Me.name})});const Ie=await Le.post(`${e}/api/sync-drive-to-s3`,be,{headers:{Authorization:`Bearer ${G}`}});Wn.current=!0,on(),st.update(pe,{render:`Đồng bộ thành công! Đã tải lên ${Ie.data.uploadedKeys.length} file.`,type:"success",isLoading:!1,autoClose:3e3,position:"bottom-right"})}catch(be){console.error("❌ Lỗi khi đồng bộ file từ Google Drive:",be),st.update(pe,{render:"Không thể đồng bộ file từ Google Drive.",type:"error",isLoading:!1,autoClose:3e3,position:"bottom-right"})}};M.useEffect(()=>{const A=O=>{if(O.data.action==="logout"){const G=document.createElement("iframe");G.style.display="none",G.src="https://accounts.google.com/Logout",document.body.appendChild(G),setTimeout(()=>document.body.removeChild(G),2e3)}};return window.addEventListener("message",A),()=>window.removeEventListener("message",A)},[]),M.useEffect(()=>{const A=new Set(l);x(A)},[]),M.useEffect(()=>{Je!=null&&Je.status&&(Je.status.status==="completed"?(X({title:"Thu thập website hoàn tất",description:`Đã thu thập thành công ${Je.url} với ${Je.status.completed} trang`}),Wn.current=!0,on()):Je.status.status==="failed"&&X({title:"Thu thập website thất bại",description:`Không thể thu thập ${Je.url}. Vui lòng thử lại.`,variant:"destructive"}))},[(ki=Je==null?void 0:Je.status)==null?void 0:ki.status]);const rf=M.useMemo(()=>En[v]||[],[En,v]),Jr=M.useMemo(()=>rf.filter(A=>m3(A.permission)),[rf,v,En]),Jn=M.useMemo(()=>{const A={};return Jr.forEach((O,G)=>{y.has(O.key)&&(A[G]=!0)}),A},[y,Jr]),bs=A=>{const O=Pu(En,A);if(O.length===0)return y.has(A)?"all":"none";const G=O.filter(pe=>y.has(pe)).length;return G===0?"none":G===O.length?"all":"partial"},Qr=(A,O=!0)=>{if(v!==A){if(u&&!v)ia(!0),T(A+u),b(A+u);else if(ia(!0),T(A),b(A),O&&!o){const G=window.location.pathname==="/"?"":window.location.pathname,pe=A?`${window.location.origin}${G}?prefix=${encodeURIComponent(A)}`:`${window.location.origin}${G}`;window.history.pushState({path:pe},"",pe)}}},Lt=A=>{const O=A.lastIndexOf("/"),G=O>0?A.substring(0,O+1):"";G?(Qr(G),setTimeout(()=>{x(new Set([A]))},500)):x(new Set([A]))};M.useEffect(()=>{Wr&&(Wn.current=!0,on().finally(()=>ia(!1)))},[Wr]);const Eo=async(A,O)=>{var G,pe;K(!0);try{if(Jr.some(Mt=>Mt.isFolder&&Mt.name.toLowerCase()===A.toLowerCase())){X({title:"Lỗi",description:`Thư mục "${A}" đã tồn tại trong thư mục hiện tại.`,variant:"destructive"}),K(!1);return}const Ie=`${O}${A}/`;if((await Le.post(`${e}/api/create-folder`,{prefix:Ie,userId:(Jc==null?void 0:Jc.id)||""})).status!==200){X({title:"Lỗi",description:"Không thể tạo thư mục",variant:"destructive"});return}Wn.current=!0,await on(),X({title:"Đã tạo thư mục",description:`Đã tạo thành công thư mục "${A}"`}),D(""),P(!1)}catch(be){console.error("Error creating folder:",be);const Ie=((pe=(G=be==null?void 0:be.response)==null?void 0:G.data)==null?void 0:pe.error)||"Không thể tạo thư mục";X({title:"Lỗi",description:Ie,variant:"destructive"})}finally{K(!1)}},va=async(A,O,G)=>{var pe,be,Ie,Me,Mt,Zr,wa,Ts,il;oe(G),Jt(!0);try{if(Array.from(A).reduce((Tn,Cr)=>Tn+Cr.size,0)>=100*1024*1024){X({title:"Lỗi",description:"Tổng kích thước các tập tin vượt quá 100 MB",variant:"destructive"}),oe(null),Jt(!1);return}const Wo=Array.from(A).filter(Tn=>Tn.size===0);if(Wo.length>0){const Tn=Wo.map(Cr=>Cr.name).join(", ");X({title:"Lỗi tải lên",description:`Không thể tải lên tập tin rỗng: ${Tn}`,variant:"destructive"}),Jt(!1),oe(null);return}const qo=new FormData;if(Ht!=null&&Ht.id&&qo.append("metadata",JSON.stringify({creator:Ht.username,creatorId:Ht.id,DataSource:"Tệp tải lên"})),G==="folder"&&A[0]){const Tn=A[0].webkitRelativePath.split("/")[0];Tn&&qo.append("folderName",Tn)}qo.append("prefix",O),Array.from(A).forEach(Tn=>G==="folder"?qo.append("files",Tn,Tn.webkitRelativePath):qo.append("files",Tn)),Wn.current=!0;const Qt=await Le.post(`${e}/api/check-files-existed`,qo,{headers:{"Content-Type":"multipart/form-data"}});if(((pe=Qt==null?void 0:Qt.data)==null?void 0:pe.status)===200)await Le.post(`${e}/api/upload`,qo,{headers:{"Content-Type":"multipart/form-data"},timeout:0}),w(""),T(O),setTimeout(async()=>{oe(null),await on(),Jt(!1),await jo("upload")},500);else{if(((Ie=(be=Qt==null?void 0:Qt.data)==null?void 0:be.names)==null?void 0:Ie.length)>0&&!((Me=Qt==null?void 0:Qt.data)!=null&&Me.isFolder)){const Tn=Array.from(A).filter(Cr=>Qt.data.names.includes(Cr.name));aa(Tn),ca(!0)}(Mt=Qt==null?void 0:Qt.data)!=null&&Mt.isFolder&&((Zr=Qt==null?void 0:Qt.data)!=null&&Zr.name)&&(cs((wa=Qt==null?void 0:Qt.data)==null?void 0:wa.name),aa(A),ca(!0))}}catch(Qn){console.error("Lỗi tải lên:",Qn);const Wo=((il=(Ts=Qn==null?void 0:Qn.response)==null?void 0:Ts.data)==null?void 0:il.error)||"Không thể tải lên tập tin";X({title:"Lỗi",description:Wo,variant:"destructive"}),oe(null),Jt(!1)}},Jm=async()=>{var A,O;try{Jt(!0);const G=new FormData;if(xo){oe(sa?"folder":"files"),ca(!1);let pe=localStorage.getItem("dataLogin"),be;try{pe&&(pe=JSON.parse(pe),be=pe.user)}catch{pe=null}if(sa&&xo[0]){const Ie=xo[0].webkitRelativePath.split("/")[0];Ie&&G.append("folderName",Ie)}G.append("prefix",v),Array.from(xo).forEach(Ie=>sa&&xo[0]?G.append("files",Ie,Ie.webkitRelativePath):G.append("files",Ie)),be!=null&&be.id&&G.append("metadata",JSON.stringify({creator:be.username,creatorId:be.id,DataSource:"Tệp tải lên"})),await Le.post(`${e}/api/upload`,G,{headers:{"Content-Type":"multipart/form-data"},timeout:0}),w(""),T(v),Wn.current=!0}}catch(G){console.error("Lỗi tải lên:",G);const pe=((O=(A=G==null?void 0:G.response)==null?void 0:A.data)==null?void 0:O.error)||"Không thể tải lên tập tin";X({title:"Lỗi",description:pe,variant:"destructive"})}finally{setTimeout(async()=>{oe(null),await on(),Jt(!1),cs(""),aa(null),await jo("overwrite")},500)}},xs=async A=>{var O;try{if(await Le.delete(`${e}/api/files`,{data:{paths:[A.key]}}),y.has(A.key)){const pe=new Set(y);pe.delete(A.key),x(pe)}const G=((O=A.key)==null?void 0:O.replace(/^(.*?)(\/.*)?$/,(pe,be,Ie)=>!Ie||Ie==="/"?"":be+"/"))||"";T(G),Wn.current=!0,X({title:"Đã xóa tập tin",description:`Đã xóa thành công "${A.name}"`}),W(null),await jo("delete")}catch(G){console.error("Error deleting file:",G),X({title:"Lỗi",description:"Không thể xóa tập tin",variant:"destructive"})}finally{jr(!1),await on()}},Ss=A=>{const O=new Set(y),G=typeof A=="function"?A(Jn):A;new Set(Object.keys(Jn).map(Number)).forEach(be=>{const Ie=Jr[be];Ie&&(G[be]||(O.delete(Ie.key),Ie.isFolder&&Pu(En,Ie.key).forEach(Me=>O.delete(Me))))}),Object.entries(G).forEach(([be,Ie])=>{const Me=parseInt(be),Mt=Jr[Me];Mt&&Ie&&(O.add(Mt.key),Mt.isFolder&&Pu(En,Mt.key).forEach(Zr=>O.add(Zr)))}),x(O)},Qm=async()=>{var A;q(!0);try{const O=Array.from(y),G=O.map(be=>Object.values(En).flat().find(Ie=>Ie.key===be)).filter(be=>be!==void 0);if(G.length===0){X({title:"Lỗi",description:"Không có tập tin nào được chọn để xóa",variant:"destructive"});return}await Le.delete(`${e}/api/files`,{data:{paths:O}});const pe=((A=G[0])==null?void 0:A.key.replace(/^(.*?)(\/.*)?$/,(be,Ie,Me)=>!Me||Me==="/"?"":Ie+"/"))||"";T(pe),Wn.current=!0,on(),X({title:"Đã xóa tập tin",description:`Đã xóa thành công ${G.length} mục`}),Y(!1),x(new Set),await jo("bulk-delete")}catch(O){console.error("Error deleting files:",O),X({title:"Lỗi",description:"Không thể xóa các tập tin đã chọn",variant:"destructive"})}finally{q(!1)}},Xm=async(A,O)=>{if(!v.trim()){X({title:"Lỗi",description:"Không thể đổi tên tập tin hoặc thư mục ở thư mục gốc. Chỉ có thể xóa.",variant:"destructive"});return}Ne(!0);try{const G=A.key;let pe;A.isFolder?pe=G.split("/").slice(0,-2).join("/")+"/":pe=G.substring(0,G.lastIndexOf("/")+1);const be=pe+O+(A.isFolder?"/":"");await Le.post(`${e}/api/rename`,{oldPath:G,newPath:be}),Wn.current=!0,await on(),X({title:"Đã đổi tên",description:`Đã đổi tên thành công "${A.name}" thành "${O}"`}),te(null),z(""),Pe(null),await jo("rename")}catch(G){console.error("Error renaming item:",G),X({title:"Lỗi",description:"Không thể đổi tên",variant:"destructive"})}finally{Ne(!1)}},of=async A=>{Ve(O=>new Set([...O,...A]));try{const O=await Le.post(`${e}/api/download`,{paths:A},{responseType:"blob"}),G=window.URL.createObjectURL(O.data),pe=document.createElement("a");pe.href=G;const be=O.headers["Content-Disposition"]||O.headers["content-disposition"],Ie=be==null?void 0:be.match(/filename="(.+)"/),Me=Ie?decodeURIComponent(Ie[1]):"download.zip";pe.setAttribute("download",Me),document.body.appendChild(pe),pe.click(),document.body.removeChild(pe),window.URL.revokeObjectURL(G),X({title:"Bắt đầu tải xuống",description:`Đã bắt đầu tải xuống ${A.length} mục${A.length>1,""}`})}catch(O){console.error("Error downloading files:",O),X({title:"Lỗi",description:"Không thể tải xuống tập tin",variant:"destructive"})}finally{Ve(O=>{const G=new Set(O);return A.forEach(pe=>G.delete(pe)),G})}},ya=v?v.replace(n,"").split("/").filter(Boolean):[],Ii=()=>{let A=Array.from(y).map(G=>({key:G}));A.length>1&&(A=A.filter(G=>G.key!==n));const O=G=>zd.findIndex(A,pe=>!pe.key.endsWith("/")&&pe.key.startsWith(G))!==-1;return A=A.filter(G=>G.key.endsWith("/")?!O(G.key):!0),A},af=M.useMemo(()=>{const A=[...(Ht==null?void 0:Ht.role)!=="MASTER_ADMIN"&&(Ht==null?void 0:Ht.role)!=="SITE_ADMIN"&&(v===""||v==="/")?[]:[{id:"select",header:()=>{const O=u3(En,v),G=O.length>0&&O.every(be=>y.has(be)),pe=O.some(be=>y.has(be));return d.jsx(dc,{checked:G?!0:pe?"indeterminate":!1,onCheckedChange:be=>{if(be){const Ie=Jr.reduce((Me,Mt,Zr)=>(Me[Zr]=!0,Me),{});Ss(Ie)}else{for(const Ie of Array.from(y))Ie.startsWith(v)&&(y.delete(Ie),Vo.current[Ie]=!1);zd.forEach(Vo.current,(Ie,Me)=>{Me.startsWith(v)&&(Vo.current[Me]=!1)}),Ss({})}},"aria-label":"Chọn tất cả"})},cell:({row:O})=>{const G=O.original;let be=G.isFolder?bs(G.key):y.has(G.key)?"all":"none";if(be==="none"&&G.key.endsWith("/")){for(const Ie of Array.from(y))if(Ie.startsWith(G.key)){be="all";break}}return d.jsx("div",{className:"flex items-center",children:d.jsx(dc,{checked:be==="partial"?"indeterminate":be==="all",onCheckedChange:Ie=>{var Mt,Zr;const Me={...Jn};if(Ie?Me[O.index]=!0:delete Me[O.index],Vo.current[((Mt=O.original)==null?void 0:Mt.key)||"_"]=!!Ie,(Zr=O.original)!=null&&Zr.key.endsWith("/"))for(const wa of Array.from(y))wa.startsWith(O.original.key)&&(Vo.current[O.original.key]=!1,y.delete(wa));Ss(Me)},"aria-label":"Chọn dòng"})})},enableSorting:!1}],{id:"fileName",header:({column:O})=>d.jsxs(He,{variant:"ghost",onClick:()=>O.toggleSorting(O.getIsSorted()==="asc"),children:["Tên tập tin",d.jsx(sg,{})]}),accessorKey:"name",cell:({row:O})=>{const G=O.original,pe=G.key.substring(0,G.key.lastIndexOf("/"))||"/",be=g.trim()!==""&&pe!==v,Ie=pe.split("/").filter(Boolean);return d.jsxs("div",{className:"flex flex-col group",children:[d.jsxs("div",{className:"flex items-center",children:[d.jsxs("div",{className:`flex items-center gap-2 ${G.isFolder?"cursor-pointer hover:text-blue-600":""}`,onClick:()=>{G.isFolder&&Qr(G.key)},children:[G.isFolder?d.jsx(Js,{className:"h-5 w-5 text-blue-500"}):null,G.name]}),d.jsx("button",{className:"ml-2 opacity-0 group-hover:opacity-100 transition-opacity",onClick:Me=>{Me.stopPropagation(),navigator.clipboard.writeText(G.key),X({title:"Copied to clipboard",description:`Path: ${G.key}`,duration:2e3})},title:"Copy path to clipboard",children:d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),d.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]}),be&&d.jsxs("div",{className:"text-sm text-gray-500 flex items-center",children:[d.jsx(Js,{className:"h-4 w-4 text-gray-500 my-auto"}),d.jsxs("span",{className:"flex items-center ml-1",children:[d.jsx("span",{className:"cursor-pointer hover:text-blue-600",onClick:()=>{Qr("")},children:"/"}),Ie.map((Me,Mt)=>d.jsxs("span",{className:"flex items-center",children:[d.jsx("span",{className:"cursor-pointer hover:text-blue-600",onClick:()=>{Qr(Ie.slice(0,Mt+1).join("/")+"/")},children:Me}),Mt<Ie.length-1&&d.jsx("span",{children:"/"})]},Mt))]})]})]})}}];return o||A.push({id:"size",header:({column:O})=>d.jsxs(He,{variant:"ghost",onClick:()=>O.toggleSorting(O.getIsSorted()==="asc"),children:["Kích thước",d.jsx(sg,{})]}),accessorKey:"size",cell:({getValue:O,row:G})=>{const pe=O();return d.jsx("span",{children:G.original.isFolder?"-":Yr(pe)})}},{id:"lastModified",header:({column:O})=>d.jsxs(He,{variant:"ghost",onClick:()=>O.toggleSorting(O.getIsSorted()==="asc"),className:"px-0 w-full flex-row justify-end",children:["Sửa đổi lần cuối",d.jsx(sg,{})]}),accessorKey:"lastModified",cell:({row:O})=>{const G=O.original.lastModified;return d.jsx("div",{className:"w-full flex-row justify-end items-center text-right",children:d.jsx("span",{children:G&&Lx(G).isValid()?Lx(G).format("DD/MM/YYYY HH:mm"):"-"})})},size:200},{id:"actions",header:()=>d.jsx("span",{children:"Hành động"}),accessorKey:"key",cell:({row:O})=>d.jsxs("div",{className:"flex items-center gap-2",children:[v===""&&r&&d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>{$u(O.original.key),Hu(!0)},className:"h-8 w-8 p-0",children:ne.has(O.original.key)?d.jsx(kt,{className:"h-4 w-4 animate-spin"}):d.jsx(vO,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Những Flow sử dụng Folder này làm Data"})]})}),d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:!O.original.isFolder&&d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>of([O.original.key]),className:"h-8 w-8 p-0",disabled:!g3(O.original.permission)||ne.has(O.original.key),children:ne.has(O.original.key)?d.jsx(kt,{className:"h-4 w-4 animate-spin"}):d.jsx(hO,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Tải xuống"})]})}),v.trim()!==""&&(ra(O.original.permission)?d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>{te(O.original),z(O.original.name)},className:"h-8 w-8 p-0",disabled:!ra(O.original.permission),children:d.jsx(_O,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Đổi tên"})]})}):d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>{console.log("call"),ke(O.original)},className:"h-8 w-8 p-0",disabled:O.original.isFolder,children:d.jsx(Ux,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Xem"})]})})),d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>{Ae(!0),se(O.original)},className:"h-8 w-8 p-0",disabled:!ra(O.original.permission),children:d.jsx(KD,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Di chuyển"})]})}),!((Ht==null?void 0:Ht.role)!=="MASTER_ADMIN"&&(Ht==null?void 0:Ht.role)!=="SITE_ADMIN"&&(v===""||v==="/"))&&d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>W(O.original),className:"h-8 w-8 p-0",disabled:!ra(O.original.permission),children:d.jsx(DC,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Xóa"})]})}),d.jsx(vr,{children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsx(He,{variant:"ghost",size:"icon",onClick:()=>Rc(O.original),className:"h-8 w-8 p-0",disabled:!ra(O.original.permission),children:d.jsx(RC,{className:"h-4 w-4"})})}),d.jsx(lr,{children:"Chia sẻ"})]})})]})}),A},[y,Jr,Jn,ne,o]),_s=jb({data:Jr,columns:af,state:{rowSelection:Jn,sorting:h},onSortingChange:p,enableRowSelection:!0,onRowSelectionChange:Ss,getCoreRowModel:Gb(),getSortedRowModel:qM()}),Zc=async A=>{var O,G;bt(!0);try{if(na(A)){const pe=await Le.get(`${e}/api/read-text`,{params:{path:A.key}});Ct(pe.data.content)}try{const pe=await Le.get(`${e}/api/read-json`,{params:{path:A.key+".metadata.json"}}),be=((G=(O=pe==null?void 0:pe.data)==null?void 0:O.content)==null?void 0:G.metadataAttributes)||null;return Pe({fullPath:$==null?void 0:$.key,...be})}catch{return Pe("Lỗi phân tích siêu dữ liệu")}}catch(pe){console.error("Error loading file content:",pe),X({title:"Lỗi",description:"Không thể tải nội dung tập tin",variant:"destructive"})}finally{bt(!1)}},el=async(A,O)=>{zt(!0);try{await Le.post(`${e}/api/modify-text`,{path:A.key,content:O}),X({title:"Đã lưu tập tin",description:"Nội dung tập tin đã được cập nhật thành công"}),Wn.current=!0,await on(),te(null),Ct(""),Kt("rename"),await jo("edit-content")}catch(G){console.error("Error saving file content:",G),X({title:"Lỗi",description:"Không thể lưu nội dung tập tin",variant:"destructive"})}finally{zt(!1)}},tl=async A=>{zt(!0);try{await Le.post(`${e}/api/modify-json`,{path:A.key+".metadata.json",content:{metadataAttributes:xe}}),X({title:"Đã lưu tập tin",description:"Nội dung tập tin đã được cập nhật thành công"}),Wn.current=!0,await on(),te(null),Ct(""),Kt("rename")}catch(O){console.error("Error saving file content:",O),X({title:"Lỗi",description:"Không thể lưu nội dung tập tin",variant:"destructive"})}finally{zt(!1)}};M.useEffect(()=>{$&&($.isFolder||Zc($),Kt("rename"))},[$]),M.useEffect(()=>{_e&&!_e.isFolder&&Zc(_e)},[_e]);const nl=async(A,O)=>{var G;if(Je){X({title:"Đang thu thập website",description:"Vui lòng đợi cho công việc thu thập hiện tại hoàn thành.",variant:"destructive"});return}Xe(!0);try{const{data:pe}=await Le.post(`${e}/api/crawl`,{url:A,limit:O,prefix:v,isAutoUpdateKB:Go});if(pe.id){Nc({id:pe.id,url:A,limit:O,prefix:v,taskId:((G=pe.task)==null?void 0:G.id)||""});const be=localStorage.getItem(ZT),Ie=be?JSON.parse(be):[];Ie.some(Me=>Me.id===pe.id)||(Ie.unshift({url:A,id:pe.id,limit:O,prefix:v,timestamp:Date.now()}),Ie.length>20&&(Ie.length=20),localStorage.setItem(ZT,JSON.stringify(Ie))),X({title:"Bắt đầu thu thập website",description:`Đã thêm nhiệm vụ thu thập ${A} với giới hạn ${O}. Dữ liệu sẽ có sẵn sau khi thu thập hoàn tất.`}),J(!1),ae(""),he("1")}}catch(pe){console.error("Error crawling website:",pe),X({title:"Lỗi",description:"Không thể bắt đầu thu thập website",variant:"destructive"})}finally{Xe(!1)}},Zm=async()=>{try{if(!(Je!=null&&Je.id))return;Nc(null),localStorage.removeItem(as),X({title:"Đã dừng thu thập",description:`Đã dừng thu thập website ${Je.url}`})}catch(A){console.error("Error stopping job:",A),X({title:"Lỗi",description:"Không thể dừng thu thập website",variant:"destructive"})}};M.useEffect(()=>{if(o)return;const A=(O=!0)=>{const pe=new URL(window.location.href).searchParams.get("prefix")||"";pe?Qr(pe,!1):(O&&!l&&x(new Set),T(n),b(n),Wn.current=!0,setTimeout(()=>{on()},0))};return A(!1),window.addEventListener("popstate",()=>A(!0)),()=>{window.removeEventListener("popstate",()=>A(!0))}},[]);const Es=async()=>{zu(!0);try{await Le.post(`${e}/api/prediction-report`),X({title:"Xuất báo cáo thành công",description:"Báo cáo dự đoán đã được xuất"})}catch(A){console.error("Error exporting report:",A),X({title:"Lỗi",description:"Không thể xuất báo cáo dự đoán",variant:"destructive"})}finally{zu(!1)}},rl=async()=>{try{const A=qi();A&&(await Le.post(`${e}/api/start-ingestion-job`,{prefix:v,user_id:A.id,userName:A.username})).status===200&&await dn()}catch(A){xt(!1),console.log(A)}},jo=async A=>{try{us&&v.includes(us)&&(console.log(`Auto syncing knowledge base after ${A} operation`),await dn())}catch(O){console.log(`Error auto syncing after ${A}:`,O)}},Xr=M.useRef(),dn=async()=>{try{xt(!0);const A=await Le.post(`${e}/api/get-ingestion-job-status`,{prefix:v}),{status:O}=A==null?void 0:A.data;O==="FAILED"||O==="COMPLETE"||O==="STOPPED"||O==="STOPPING"||!O?(xt(!1),Xr.current&&(clearInterval(Xr.current),Xr.current=null),Dc(A==null?void 0:A.data)):(Xr.current||(Xr.current=setInterval(()=>dn(),5e3)),Dc(A==null?void 0:A.data))}catch(A){console.log(A)}},ol=()=>{const A=Array.from(y);let O;return v?O=A.filter(G=>G.startsWith(v)&&G!==v).length:O=new Set(A.filter(G=>G.split("/").shift())).size,`Đang chọn: ${O}`};return M.useEffect(()=>{const A=v==null?void 0:v.split("/")[0];return A!==us&&(xt(!1),Xr.current&&(clearInterval(Xr.current),Xr.current=null),Fm(A||""),Dc(null),A&&dn()),()=>{}},[us,v]),M.useEffect(()=>{So&&Gc.length===0&&(Gm(),qr(null))},[So]),M.useEffect(()=>{if(l)for(const A of Array.from(l))Vo.current[A]=!0},[]),d.jsxs("div",{className:"space-y-4 s3-explr-container",children:[d.jsx(l_,{}),d.jsx(ar,{open:Fu,onOpenChange:A=>{ca(A),A||(cs(""),aa(null),Jt(!1),oe(null))},children:d.jsxs(zn,{children:[d.jsxs(Vn,{children:[d.jsx(Kn,{children:"Cảnh báo trùng lặp"}),d.jsxs(Ci,{children:[sa&&d.jsxs(d.Fragment,{children:["Folder $",sa," đã có."]}),xo&&xo.length>0&&d.jsxs(d.Fragment,{children:["Những tệp sau bị lặp:",d.jsx("ul",{className:"mt-2 list-disc pl-5 text-sm text-red-600",children:Array.from(xo).map((A,O)=>d.jsx("li",{children:A.name},O))})]})]})]}),d.jsxs(Fr,{children:[d.jsx(He,{variant:"outline",onClick:()=>{ca(!1),cs(""),aa(null),Jt(!1),oe(null)},children:"Bỏ qua"}),d.jsx(He,{variant:"destructive",onClick:()=>Jm(),children:"Ghi đè"})]})]})}),d.jsx(Gd,{className:"s3-explr-breadcrumb",children:d.jsxs(jd,{className:"s3-explr-breadcrumb-list",children:[d.jsx(cc,{className:"s3-explr-breadcrumb-item",children:d.jsx(lc,{onClick:()=>Qr(n),className:"flex items-center gap-1 cursor-pointer s3-explr-breadcrumb-home",children:t})}),!u&&ya.map((A,O)=>d.jsxs("div",{className:"flex items-center",children:[d.jsx(Wd,{className:"s3-explr-breadcrumb-separator"},`sep-${O}`),d.jsx(cc,{className:"s3-explr-breadcrumb-item",children:d.jsx(lc,{onClick:()=>Qr(n+ya.slice(0,O+1).join("/")+"/"),className:"cursor-pointer s3-explr-breadcrumb-link",children:A})},`item-${A}`)]},O))]})}),d.jsxs("div",{className:"flex items-center space-x-4 s3-explr-toolbar",children:[d.jsx("div",{className:"relative max-w-sm w-full s3-explr-search-container",children:d.jsx(FH,{ref:Q,onChange:A=>w(A)})}),d.jsxs(He,{variant:"outline",size:"sm",onClick:()=>{T(v),Wn.current=!0,on()},disabled:Ai,className:"flex items-center gap-2 s3-explr-refresh-btn",children:[d.jsx(dd,{className:`h-4 w-4 s3-explr-refresh-icon ${Ai?"animate-spin":""}`}),"Làm mới"]}),v&&v!=="/"&&d.jsx(vr,{delayDuration:0,children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsxs(He,{variant:"outline",size:"sm",onClick:()=>{Ai||ft||(xt(!0),rl())},"aria-disabled":Ai||ft,className:"flex items-center gap-2 s3-explr-refresh-btn aria-disabled:opacity-50",children:[d.jsx(dd,{className:`h-4 w-4 s3-explr-refresh-icon ${Ai||ft?"animate-spin":""}`}),"Đồng bộ KB"]})}),Pt&&d.jsx(lr,{side:"right",sideOffset:5,children:d.jsxs("div",{className:"space-y-2 p-3 max-w-md",children:[d.jsx("p",{className:"font-semibold text-lg border-b pb-1",children:"Thông tin đồng bộ"}),d.jsx("div",{className:"space-y-1",children:d.jsxs("p",{className:"flex items-center gap-2",children:[d.jsx("span",{className:"font-medium",children:"Trạng thái:"}),d.jsxs("span",{className:`flex items-center gap-1 font-semibold ${Pt.status==="COMPLETE"?"text-green-600":Pt.status==="FAILED"?"text-red-600":"text-yellow-600"}`,children:[Pt.status==="COMPLETE"&&d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),Pt.status==="FAILED"&&d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})}),Pt.status!=="COMPLETE"&&Pt.status!=="FAILED"&&d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 animate-spin",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:d.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"})}),lL(Pt.status)]})]})}),Pt.statistics&&d.jsxs("div",{className:"space-y-1 border-t pt-2",children:[d.jsx("p",{className:"font-medium text-gray-50",children:"Thống kê xử lý:"}),d.jsxs("div",{className:"grid grid-cols-2 gap-x-4 gap-y-1 text-sm",children:[d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Tài liệu quét:"}),d.jsx("span",{className:"font-medium",children:Pt.statistics.numberOfDocumentsScanned})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Metadata quét:"}),d.jsx("span",{className:"font-medium",children:Pt.statistics.numberOfMetadataDocumentsScanned})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Tài liệu mới:"}),d.jsx("span",{className:"font-medium text-green-600",children:Pt.statistics.numberOfNewDocumentsIndexed})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Tài liệu sửa:"}),d.jsx("span",{className:"font-medium text-blue-600",children:Pt.statistics.numberOfModifiedDocumentsIndexed})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Metadata sửa:"}),d.jsx("span",{className:"font-medium text-blue-600",children:Pt.statistics.numberOfMetadataDocumentsModified})]}),d.jsxs("div",{className:"flex justify-between",children:[d.jsx("span",{children:"Tài liệu xóa:"}),d.jsx("span",{className:"font-medium text-orange-600",children:Pt.statistics.numberOfDocumentsDeleted})]}),d.jsxs("div",{className:"flex justify-between col-span-2",children:[d.jsx("span",{children:"Tài liệu lỗi:"}),d.jsx("span",{className:"font-medium text-red-600",children:Pt.statistics.numberOfDocumentsFailed})]})]})]}),d.jsxs("div",{className:"space-y-1 border-t pt-2 text-sm text-gray-200",children:[d.jsx("p",{className:"font-medium text-gray-50",children:"Chi tiết Job:"}),d.jsxs("p",{children:[d.jsx("span",{className:"font-medium",children:"DataSource ID:"})," ",Pt.dataSourceId]}),d.jsxs("p",{children:[d.jsx("span",{className:"font-medium",children:"Ingestion Job ID:"})," ",Pt.ingestionJobId]}),d.jsxs("p",{children:[d.jsx("span",{className:"font-medium",children:"Knowledge Base ID:"})," ",Pt.knowledgeBaseId]}),d.jsxs("p",{children:[d.jsx("span",{className:"font-medium",children:"Job trong queue:"})," ",Pt.is_still_in_stock?"Còn":"Không"]})]}),Pt.errorMessage&&d.jsxs("div",{className:"border-t pt-2",children:[d.jsx("p",{className:"text-red-600 font-medium",children:"Lỗi:"}),d.jsx("p",{className:"text-red-600 text-sm bg-red-50 p-2 rounded",children:Pt.errorMessage})]}),Pt.failureReasons&&Pt.failureReasons.length>0&&d.jsx(HH,{failureReasons:Pt.failureReasons,onNavigateToFile:Lt})]})})]})}),ra(En==null?void 0:En.prefixPermission)&&d.jsxs("div",{className:"relative",ref:Yc,children:[d.jsxs(He,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-file-btn bg-[#1682fe] hover:bg-[#0f6cd4] text-white rounded-md px-4 py-2 transition-colors aria-disabled:hidden",onClick:()=>_o(A=>!A),"aria-disabled":(Ht==null?void 0:Ht.role)!=="MASTER_ADMIN"&&(Ht==null?void 0:Ht.role)!=="SITE_ADMIN"&&(v===""||v==="/"),children:[d.jsx(TO,{className:"w-4 h-4"}),"Add file"]}),qc&&d.jsxs("div",{className:"absolute z-50 mt-2 right-0 w-56 bg-white border rounded-lg shadow-lg py-2 flex flex-col",children:[d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",onClick:()=>{_o(!1);const A=document.createElement("input");A.type="file",A.multiple=!0,A.onchange=O=>{const G=O.target.files;G&&va(G,v,"files")},A.click()},children:[d.jsx(gp,{className:"h-4 w-4 mr-2"})," Tải tệp tin"]}),d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",onClick:()=>{_o(!1);const A=document.createElement("input");A.type="file",A.multiple=!0,A.webkitdirectory=!0,A.onchange=O=>{const G=O.target.files;G&&va(G,v,"folder")},A.click()},children:[d.jsx(Js,{className:"h-4 w-4 mr-2"})," Tải lên thư mục"]}),d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",disabled:!!s&&!v,onClick:()=>P(!0),children:[d.jsx(wO,{className:"h-4 w-4 mr-2 s3-explr-folder-plus-icon"}),"Thư mục mới"]}),d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",onClick:()=>{_o(!1),J(!0)},children:[d.jsx(xO,{className:"h-4 w-4 mr-2"})," Thêm Website"]}),d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",onClick:()=>{_o(!1),nf()},children:[d.jsxs("svg",{viewBox:"0 0 87.3 78",xmlns:"http://www.w3.org/2000/svg",className:"h-4 w-4 mr-2",children:[d.jsx("path",{d:"m6.6 66.85 3.85 6.65c.8 1.4 1.95 2.5 3.3 3.3l13.75-23.8h-27.5c0 1.55.4 3.1 1.2 4.5z",fill:"#0066da"}),d.jsx("path",{d:"m43.65 25-13.75-23.8c-1.35.8-2.5 1.9-3.3 3.3l-25.4 44a9.06 9.06 0 0 0 -1.2 4.5h27.5z",fill:"#00ac47"}),d.jsx("path",{d:"m73.55 76.8c1.35-.8 2.5-1.9 3.3-3.3l1.6-2.75 7.65-13.25c.8-1.4 1.2-2.95 1.2-4.5h-27.502l5.852 11.5z",fill:"#ea4335"}),d.jsx("path",{d:"m43.65 25 13.75-23.8c-1.35-.8-2.9-1.2-4.5-1.2h-18.5c-1.6 0-3.15.45-4.5 1.2z",fill:"#00832d"}),d.jsx("path",{d:"m59.8 53h-32.3l-13.75 23.8c1.35.8 2.9 1.2 4.5 1.2h50.8c1.6 0 3.15-.45 4.5-1.2z",fill:"#2684fc"}),d.jsx("path",{d:"m73.4 26.5-12.7-22c-.8-1.4-1.95-2.5-3.3-3.3l-13.75 23.8 16.15 28h27.45c0-1.55-.4-3.1-1.2-4.5z",fill:"#ffba00"})]})," ","Đồng bộ Google Drive"]}),d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",onClick:()=>{_o(!1),Qc()},children:[d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 64 64",className:"h-4 w-4 mr-2",children:[d.jsx("path",{fill:"#094ab2",d:"M47.3 28.2C45.3 18.6 37.1 12 28 12c-8.5 0-15.9 5.6-18.4 13.5C4.2 27.2 0 32.2 0 38c0 6.6 5.4 12 12 12h36c8.3 0 16-6.6 16-15.5 0-6.8-4.9-12.4-11.7-13.3z"}),d.jsx("path",{fill:"#0067c5",d:"M44.9 30.1c-.2 0-.4-.1-.6-.1H26c-3.3 0-6 2.7-6 6 0 .9.2 1.8.6 2.6-1.7-.7-3.5-1.1-5.5-1.1C7.6 37.5 4 41.5 4 46s3.6 8.5 8.1 8.5h34.3c6.8 0 12.6-5.4 12.6-12s-5.5-11.6-11.1-12.4z"})]})," ","Đồng bộ OneDrive"]}),d.jsxs("button",{className:"flex items-center px-4 py-2 text-sm hover:bg-gray-100 text-left",onClick:()=>{_o(!1),Ot()},children:[d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",className:"h-4 w-4 mr-2",children:[d.jsx("path",{fill:"#036C70",d:"M19 14.5v-9c0-.28-.22-.5-.5-.5h-13c-.28 0-.5.22-.5.5v9c0 .28.22.5.5.5h13c.28 0 .5-.22.5-.5z"}),d.jsx("path",{fill:"#17828F",d:"M16 17.5v-9c0-.28-.22-.5-.5-.5h-13c-.28 0-.5.22-.5.5v9c0 .28.22.5.5.5h13c.28 0 .5-.22.5-.5z"}),d.jsx("path",{fill:"#4DB6AC",d:"M13 20.5v-9c0-.28-.22-.5-.5-.5h-13c-.28 0-.5.22-.5.5v9c0 .28.22.5.5.5h13c.28 0 .5-.22.5-.5z"}),d.jsx("path",{fill:"#fff",d:"M4.5 15.5v-3c0-.28.22-.5.5-.5h3c.28 0 .5.22.5.5v3c0 .28-.22.5-.5.5H5c-.28 0-.5-.22-.5-.5z"})]})," ","Đồng bộ SharePoint"]})]})]}),ra((En==null?void 0:En.prefixPermission)&&y.size>0)&&d.jsxs(He,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-file-btn bg-[#1682fe] hover:bg-[#0f6cd4] text-white rounded-md px-4 py-2 transition-colors aria-disabled:hidden",onClick:()=>Rc({contentType:"application/x-directory",isFolder:!0,key:v||"/",lastModified:"-",name:"",size:0}),children:[d.jsx(RC,{className:"w-4 h-4"}),"Chia sẻ"]}),!o&&d.jsxs(d.Fragment,{children:[y.size>0&&d.jsx(d.Fragment,{children:d.jsxs(ar,{open:Z,onOpenChange:Y,children:[d.jsx(uc,{asChild:!0,children:d.jsxs(He,{variant:"destructive",size:"sm",className:"flex items-center gap-2 s3-explr-bulk-delete-btn",children:[d.jsx(DC,{className:"h-4 w-4 s3-explr-trash-icon"}),"Xóa đã chọn (",y.size,")"]})}),d.jsxs(zn,{className:"s3-explr-dialog-content",children:[d.jsxs(Vn,{className:"s3-explr-dialog-header",children:[d.jsx(Kn,{className:"s3-explr-dialog-title",children:"Xác nhận xóa hàng loạt"}),d.jsxs(Ci,{className:"s3-explr-dialog-description",children:["Bạn có chắc chắn muốn xóa ",y.size," mục đã chọn? Hành động này không thể hoàn tác."]})]}),d.jsxs(Fr,{className:"s3-explr-dialog-footer",children:[d.jsx(He,{variant:"outline",onClick:()=>Y(!1),className:"s3-explr-cancel-btn",children:"Hủy"}),d.jsx(He,{variant:"destructive",onClick:Qm,disabled:fe,className:"s3-explr-confirm-delete-btn",children:fe?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang xóa..."]}):"Xóa đã chọn"})]})]})]})}),!u&&d.jsxs(ar,{open:N,onOpenChange:P,children:[d.jsx(uc,{asChild:!0}),d.jsxs(zn,{className:"s3-explr-dialog-content",children:[d.jsx(Vn,{className:"s3-explr-dialog-header",children:d.jsx(Kn,{className:"s3-explr-dialog-title",children:"Tạo thư mục mới"})}),d.jsxs("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:[d.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[d.jsx(mr,{htmlFor:"name",className:"s3-explr-label",children:"Tên thư mục"}),d.jsx(Gn,{disabled:H,id:"name",value:_,onChange:A=>D(A.target.value),placeholder:"Nhập tên thư mục",className:"s3-explr-input"})]}),d.jsxs(He,{onClick:()=>{_.trim()&&Eo(_,v)},disabled:H,className:"s3-explr-create-btn",children:[H&&d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),H?"Đang tạo...":"Tạo"]})]})]})]}),u&&!v?d.jsx(d.Fragment,{}):d.jsxs("div",{className:"flex items-center gap-2 s3-explr-upload-group",children:[Je?d.jsx(vr,{delayDuration:0,children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsxs("div",{className:"flex items-center gap-2",children:[d.jsxs(He,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-website-btn",disabled:!0,children:[d.jsx(kt,{className:"h-4 w-4 animate-spin s3-explr-loader"}),Je.status?d.jsxs(d.Fragment,{children:[Je.status.isProcessing?"Đang thu thập ":"Đang quét sitemap ","(",Je.status.completed,"/",Je.status.total,") -"," ",Math.floor(zo/60),":",String(zo%60).padStart(2,"0")]}):"Đang thu thập..."]}),d.jsxs(He,{variant:"destructive",size:"sm",onClick:()=>void Zm(),className:"flex items-center gap-2",children:[d.jsx("span",{className:"sr-only",children:"Dừng thu thập"}),d.jsx(kO,{className:"h-4 w-4"})]})]})}),Je.status&&d.jsx(lr,{side:"right",sideOffset:5,children:d.jsxs("div",{className:"space-y-1 p-2",children:[d.jsxs("p",{className:"font-semibold",children:["Đang thu thập ",Je==null?void 0:Je.url]}),d.jsxs("p",{children:["Tiến độ: ",Je==null?void 0:Je.status.completed,"/",Je==null?void 0:Je.status.total," ","trang"]}),d.jsxs("p",{children:["Thời gian: ",Math.floor(zo/60),":",String(zo%60).padStart(2,"0")]}),d.jsxs("p",{children:["Trạng thái:"," ",(Je==null?void 0:Je.status.status)==="scraping"?"Đang thu thập":(Je==null?void 0:Je.status.status)==="completed"?"Hoàn thành":"Thất bại"]})]})})]})}):!u&&d.jsxs(ar,{open:L,onOpenChange:J,children:[d.jsx(uc,{asChild:!0}),d.jsxs(zn,{className:"s3-explr-dialog-content",children:[d.jsxs(Vn,{className:"s3-explr-dialog-header",children:[d.jsx(Kn,{className:"s3-explr-dialog-title",children:"Thêm website"}),d.jsx(Ci,{className:"s3-explr-dialog-description",children:"Nhập URL website để thu thập và thêm vào S3."})]}),d.jsxs("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:[d.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[d.jsx(mr,{htmlFor:"websiteUrl",className:"s3-explr-label",children:"URL Website"}),d.jsx(Gn,{id:"websiteUrl",value:U,onChange:A=>ae(A.target.value),placeholder:"https://example.com",type:"url",disabled:Ee,className:"s3-explr-input"})]}),d.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[d.jsx(mr,{htmlFor:"crawlLimit",className:"s3-explr-label",children:"Giới hạn thu thập"}),d.jsx(Gn,{id:"crawlLimit",value:ye,onChange:A=>{const O=A.target.value;/^\d*$/.test(O)&&he(O)},placeholder:"1",type:"text",disabled:Ee,className:"s3-explr-input"}),d.jsx("p",{className:"text-sm text-gray-500",children:"Số lượng liên kết cần thu thập (mặc định: 1)"})]})]}),d.jsxs(Fr,{className:"s3-explr-dialog-footer",children:[d.jsx(He,{variant:"outline",onClick:()=>{J(!1),ae(""),he("1")},disabled:Ee,className:"s3-explr-cancel-btn",children:"Hủy"}),d.jsx(He,{onClick:()=>{U.trim()&&nl(U.trim(),parseInt(ye)||1)},disabled:Ee||!U.trim(),className:"s3-explr-crawl-btn",children:Ee?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang thu thập..."]}):"Bắt đầu thu thập"})]})]})]}),v.startsWith("BKTTW/")&&d.jsx(vr,{delayDuration:0,children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsxs(He,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-website-btn",disabled:!!s&&!v,onClick:Es,children:[la&&d.jsx(dd,{className:`h-4 w-4 s3-explr-refresh-icon ${la?"animate-spin":""}`}),"Xuất báo cáo"]})}),(Je==null?void 0:Je.status)&&d.jsx(lr,{side:"right",sideOffset:5,children:d.jsxs("div",{className:"space-y-1 p-2",children:[d.jsxs("p",{className:"font-semibold",children:["Đang thu thập ",Je.url]}),d.jsxs("p",{children:["Tiến độ: ",Je.status.completed,"/",Je.status.total," ","trang"]}),d.jsxs("p",{children:["Thời gian: ",Math.floor(zo/60),":",String(zo%60).padStart(2,"0")]}),d.jsxs("p",{children:["Trạng thái:"," ",Je.status.status==="scraping"?"Đang thu thập":Je.status.status==="completed"?"Hoàn thành":"Thất bại"]})]})})]})}),d.jsxs(ar,{open:L,onOpenChange:J,children:[d.jsx(uc,{asChild:!0}),d.jsxs(zn,{className:"s3-explr-dialog-content",children:[d.jsxs(Vn,{className:"s3-explr-dialog-header",children:[d.jsx(Kn,{className:"s3-explr-dialog-title",children:"Thêm website"}),d.jsx(Ci,{className:"s3-explr-dialog-description",children:"Nhập URL website để thu thập và thêm vào S3."})]}),d.jsxs("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:[d.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[d.jsx(mr,{htmlFor:"websiteUrl",className:"s3-explr-label",children:"URL Website"}),d.jsx(Gn,{id:"websiteUrl",value:U,onChange:A=>ae(A.target.value),placeholder:"https://example.com",type:"url",disabled:Ee,className:"s3-explr-input"})]}),d.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[d.jsx(mr,{htmlFor:"crawlLimit",className:"s3-explr-label",children:"Giới hạn thu thập"}),d.jsx(Gn,{id:"crawlLimit",value:ye,onChange:A=>{const O=A.target.value;/^\d*$/.test(O)&&he(O)},placeholder:"1",type:"text",disabled:Ee,className:"s3-explr-input"}),d.jsx("p",{className:"text-sm text-gray-500",children:"Số lượng liên kết cần thu thập (mặc định: 1)"})]})]}),d.jsxs(Fr,{className:"s3-explr-dialog-footer",children:[d.jsxs(He,{className:`absolute left-4 flex items-center gap-2 px-3 py-2 rounded-md text-white transition-colors ${Go?"bg-green-500 hover:bg-green-600":"bg-gray-400 hover:bg-gray-500"}`,onClick:()=>Wc(A=>!A),children:[d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"6",ry:"6"}),d.jsx("circle",{cx:Go?"16":"8",cy:"12",r:"2",fill:"currentColor"})]}),d.jsx("span",{className:"text-sm",children:"Tự động cập nhật KB"})]}),d.jsx(He,{variant:"outline",onClick:()=>{J(!1),ae(""),he("1")},disabled:Ee,className:"s3-explr-cancel-btn",children:"Hủy"}),d.jsx(He,{onClick:()=>{U.trim()&&nl(U.trim(),parseInt(ye)||1)},disabled:Ee||!U.trim(),className:"s3-explr-crawl-btn",children:Ee?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang thu thập..."]}):"Bắt đầu thu thập"})]})]})]})]}),v.startsWith("BKTTW/")&&d.jsx(vr,{delayDuration:0,children:d.jsxs(yr,{children:[d.jsx(wr,{asChild:!0,children:d.jsxs(He,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-website-btn",disabled:!!s&&!v,onClick:Es,children:[la&&d.jsx(dd,{className:`h-4 w-4 s3-explr-refresh-icon ${la?"animate-spin":""}`}),"Xuất báo cáo"]})}),la&&d.jsx(lr,{sideOffset:5,children:"Đang xuất báo cáo"})]})}),d.jsxs("div",{className:"flex items-center gap-4",children:[da&&d.jsxs(Qs,{open:da,onOpenChange:fs,children:[d.jsx(ja,{className:"fixed inset-0 bg-black bg-opacity-50 z-50"}),d.jsxs(Wa,{className:"fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-white p-6 rounded-lg shadow-lg w-[700px] max-w-[90vw] max-h-[80vh] z-50 flex flex-col",children:[d.jsxs("div",{className:"relative",children:[d.jsx(kp,{asChild:!0,children:d.jsx("button",{className:"absolute top-2 right-2 text-gray-600",onClick:Xc,children:"✖"})}),d.jsx("h2",{className:"text-lg font-semibold",children:"My OneDrive"}),d.jsx(Gd,{className:"onedrive-breadcrumb",children:d.jsx(jd,{className:"onedrive-breadcrumb-list",children:ua.map((A,O)=>d.jsxs("div",{className:"flex items-center",children:[O>0&&d.jsx(Wd,{className:"onedrive-breadcrumb-separator"}),d.jsx(cc,{className:"onedrive-breadcrumb-item",children:d.jsx(lc,{onClick:()=>ef(O),className:"cursor-pointer onedrive-breadcrumb-link",children:A.name})})]},O))})})]}),d.jsx("div",{className:"space-y-2 mt-4 flex-1 overflow-y-auto",children:Um?d.jsx("div",{className:"text-sm text-gray-500",children:"Đang tải nội dung thư mục... Vui lòng đợi."}):d.jsx(d.Fragment,{children:[...Vu,...$c].length>0?[...Vu,...$c].map(A=>d.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-gray-100 ${ps.some(O=>O.id===A.id)?"bg-blue-100":""}`,children:[d.jsx("input",{type:"checkbox",checked:ps.some(O=>O.id===A.id),onChange:O=>{O.stopPropagation(),Cs(A)},className:"cursor-pointer"}),A.isFolder?d.jsx(Js,{className:"text-blue-500 w-5 h-5 cursor-pointer",onClick:()=>ma(A.id,A.name)}):d.jsx(gp,{className:"text-gray-500 w-5 h-5"}),d.jsxs("div",{className:"flex-1",children:[d.jsx("div",{className:`font-medium ${A.isFolder?"cursor-pointer text-blue-600":""}`,onClick:()=>{A.isFolder?ma(A.id,A.name):Cs(A)},children:A.name}),!A.isFolder&&d.jsxs("div",{className:"text-xs text-gray-500",children:[Yr(A.size)," •"," ",Xu(A.lastModified.toISOString())]})]})]},A.id)):d.jsx("div",{className:"text-sm text-gray-500",children:"Không có thư mục hoặc tệp nào."})})}),d.jsx("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:d.jsx(He,{onClick:()=>{tf(ps,v),Xc()},className:"bg-[#1682fe] hover:bg-[#0f6cd4] text-white rounded-md px-4 py-2 transition-colors",disabled:ps.length===0,children:"Đồng bộ"})}),d.jsx("button",{onClick:()=>pa(!0),className:"absolute bottom-4 left-4 text-gray-600 hover:text-gray-800",title:"Đăng xuất OneDrive",children:d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"}),d.jsx("polyline",{points:"16 17 21 12 16 7"}),d.jsx("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]})})]})]}),d.jsxs(Qs,{open:Bm,onOpenChange:pa,children:[d.jsx(ja,{className:"fixed inset-0 bg-black bg-opacity-50 z-[60]"}),d.jsxs(Wa,{className:"fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-white p-6 rounded-lg shadow-lg w-[400px] max-w-[90vw] z-[60]",children:[d.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Xác nhận đăng xuất"}),d.jsx("p",{className:"text-gray-600 mb-6",children:"Bạn có chắc chắn muốn đăng xuất khỏi OneDrive?"}),d.jsxs("div",{className:"flex justify-end gap-2",children:[d.jsx(He,{variant:"outline",onClick:()=>pa(!1),children:"Hủy"}),d.jsx(He,{variant:"destructive",onClick:()=>{qn(),pa(!1)},children:"Đăng xuất"})]})]})]}),So&&d.jsxs(Qs,{open:So,onOpenChange:ha,children:[d.jsx(ja,{className:"fixed inset-0 bg-black bg-opacity-50 z-50"}),d.jsxs(Wa,{className:"fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-white p-6 rounded-lg shadow-lg w-[700px] max-w-[90vw] max-h-[80vh] z-50 flex flex-col",children:[d.jsxs("div",{className:"relative",children:[d.jsx(kp,{asChild:!0,children:d.jsx("button",{className:"absolute top-2 right-2 text-gray-600",onClick:Qu,children:"✖"})}),d.jsxs("div",{className:"flex items-center gap-2",children:[gt&&d.jsx("button",{onClick:()=>qr(null),className:"text-gray-600 hover:text-gray-800",children:d.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:d.jsx("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}),d.jsx("h2",{className:"text-lg font-semibold",children:"My SharePoint"})]}),gt&&d.jsx(Gd,{className:"sharepoint-breadcrumb",children:d.jsx(jd,{className:"sharepoint-breadcrumb-list",children:Kc.map((A,O)=>d.jsxs("div",{className:"flex items-center",children:[O>0&&d.jsx(Wd,{className:"sharepoint-breadcrumb-separator"}),d.jsx(cc,{className:"sharepoint-breadcrumb-item",children:d.jsx(lc,{onClick:()=>qm(O),className:"cursor-pointer sharepoint-breadcrumb-link",children:A.name})})]},O))})})]}),d.jsx("div",{className:"space-y-2 mt-4 flex-1 overflow-y-auto",children:Gu?d.jsx("div",{className:"text-sm text-gray-500",children:"Đang tải nội dung thư mục... Vui lòng đợi."}):gt?[...Vc,...gs].length===0?d.jsx("div",{className:"text-sm text-gray-500",children:"Không có thư mục hoặc tệp nào."}):[...Vc,...gs].map(A=>{const O=vs.some(G=>G.id===A.id);return d.jsxs("div",{className:`flex items-center gap-3 p-2 rounded-lg hover:bg-gray-100 ${O?"bg-blue-100":""}`,children:[d.jsx("input",{type:"checkbox",checked:O,onChange:G=>{G.stopPropagation(),Wm(A)},className:"cursor-pointer"}),A.isFolder?d.jsx(Js,{className:"text-blue-500 w-5 h-5 cursor-pointer",onClick:()=>ws(A.id,A.name,(gt==null?void 0:gt.hostname)||"",(gt==null?void 0:gt.sitePath)||"")}):d.jsx(gp,{className:"text-gray-500 w-5 h-5"}),d.jsxs("div",{className:"flex-1",children:[d.jsx("div",{className:`font-medium ${A.isFolder?"cursor-pointer text-blue-600":""}`,onClick:()=>{A.isFolder&&ws(A.id,A.name,(gt==null?void 0:gt.hostname)||"",(gt==null?void 0:gt.sitePath)||"")},children:A.name}),!A.isFolder&&d.jsxs("div",{className:"text-xs text-gray-500",children:[Yr(A.size)," •"," ",A.lastModified.toLocaleString()]})]})]},A.id)}):d.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6",children:Gc.map(A=>d.jsxs("div",{className:"cursor-pointer bg-white shadow-md rounded-xl p-5 flex flex-col justify-center items-start transition-shadow duration-200 hover:shadow-lg border border-gray-100 min-h-[120px]",style:{overflow:"hidden",wordBreak:"break-word",textOverflow:"ellipsis",whiteSpace:"normal"},onClick:()=>jm(A),children:[d.jsx("div",{className:"font-bold text-lg mb-1 truncate w-full",title:A.name,children:A.name}),d.jsx("div",{className:"text-sm text-gray-500 truncate w-full",title:A.description,children:A.description})]},A.id))})}),d.jsx("div",{className:"mt-4 flex flex-wrap justify-end gap-2",children:gt&&d.jsxs(d.Fragment,{children:[d.jsx(He,{onClick:()=>{Ju(vs,v),Qu()},className:"bg-[#1682fe] hover:bg-[#0f6cd4] text-white rounded-md px-4 py-2 transition-colors",disabled:vs.length===0,children:"Đồng bộ"}),d.jsx(He,{onClick:()=>qr(null),children:"Quay lại"})]})}),gt&&d.jsxs("button",{onClick:()=>Wc(A=>!A),className:`absolute bottom-4 left-4 flex items-center gap-2 px-3 py-2 rounded-md text-white transition-colors ${Go?"bg-green-500 hover:bg-green-600":"bg-gray-400 hover:bg-gray-500"}`,title:"Bật/tắt tự động cập nhật KB",children:[d.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[d.jsx("rect",{x:"2",y:"6",width:"20",height:"12",rx:"6",ry:"6"}),d.jsx("circle",{cx:Go?"16":"8",cy:"12",r:"2",fill:"currentColor"})]}),d.jsx("span",{className:"text-sm",children:"Tự động cập nhật KB"})]})]})]}),d.jsxs(Qs,{open:Wu,onOpenChange:ys,children:[d.jsx(ja,{className:"fixed inset-0 bg-black bg-opacity-50 z-[60]"}),d.jsxs(Wa,{className:"fixed top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 bg-white p-6 rounded-lg shadow-lg w-[400px] max-w-[90vw] z-[60]",children:[d.jsx("h3",{className:"text-lg font-semibold mb-4",children:"Xác nhận đăng xuất"}),d.jsx("p",{className:"text-gray-600 mb-6",children:"Bạn có chắc chắn muốn đăng xuất khỏi SharePoint?"}),d.jsxs("div",{className:"flex justify-end gap-2",children:[d.jsx(He,{variant:"outline",onClick:()=>ys(!1),children:"Hủy"}),d.jsx(He,{variant:"destructive",onClick:()=>{At(),ys(!1)},children:"Đăng xuất"})]})]})]})]}),d.jsx(ar,{open:!!Pc,onOpenChange:A=>{A||(Hu(!1),Bu([]),$u(""))},children:d.jsxs(zn,{className:"max-h-[700px] pb-3 px-1 s3-explr-input-group max-w-5xl w-[90%] p-6 bg-white rounded-lg shadow-lg",children:[d.jsxs(Vn,{className:"s3-explr-dialog-header",children:[d.jsx(Kn,{className:"s3-explr-dialog-title",children:d.jsxs("h3",{className:"font-medium mb-2",children:["Danh sách flows đang sử dụng dữ liệu từ folder(",d.jsx("span",{className:"font-bold",children:ls}),"):"," "]})}),d.jsx(Ci,{className:"s3-explr-dialog-description",children:Oc?d.jsxs("div",{className:"flex items-center justify-center py-4",children:[d.jsx(kt,{className:"h-6 w-6 animate-spin"}),d.jsx("span",{className:"ml-2",children:"Đang tải thông tin flows..."})]}):d.jsx("div",{children:ds&&Array.isArray(ds)&&ds.length>0?d.jsx("div",{className:"max-h-[400px] overflow-y-auto",children:d.jsxs("table",{className:"w-full border-collapse",children:[d.jsx("thead",{children:d.jsxs("tr",{className:"bg-gray-100",children:[d.jsx("th",{className:"border border-gray-300 px-4 py-2 text-left",children:"Tên Flow"}),d.jsx("th",{className:"border border-gray-300 px-4 py-2 text-left",children:"KnowledgeBase Id"}),d.jsx("th",{className:"border border-gray-300 px-4 py-2 text-left",children:"Loại"}),d.jsx("th",{className:"border border-gray-300 px-4 py-2 text-left",children:"Ngày tạo"})]})}),d.jsx("tbody",{children:ds.map((A,O)=>d.jsxs("tr",{className:O%2===0?"bg-white":"bg-gray-50",children:[d.jsx("td",{className:"border border-gray-300 px-4 py-2",children:A.name}),d.jsx("td",{className:"border border-gray-300 px-4 py-2",children:A.KnowledgeBaseId}),d.jsx("td",{className:"border border-gray-300 px-4 py-2",children:A.type==="MULTIAGENT"?"Agent Flow":"Chat Flow"}),d.jsx("td",{className:"border border-gray-300 px-4 py-2",children:A.createdDate?new Date(A.createdDate).toLocaleString("vi-VN"):"N/A"})]},O))})]})}):d.jsx("div",{className:"text-gray-500 italic py-2",children:"Không có flow nào sử dụng dữ liệu từ folder này"})})})]}),d.jsxs(Fr,{className:"s3-explr-dialog-footer",children:[d.jsx(He,{variant:"outline",onClick:()=>W(null),className:"s3-explr-cancel-btn",children:"Hủy"}),d.jsx(He,{variant:"destructive",onClick:()=>xs(ee),disabled:vn,className:"s3-explr-confirm-delete-btn",children:vn?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang xóa..."]}):"Xóa"})]})]})}),d.jsx(ar,{open:!!ee,onOpenChange:A=>!A&&W(null),children:d.jsxs(zn,{className:"s3-explr-dialog-content",children:[d.jsxs(Vn,{className:"s3-explr-dialog-header",children:[d.jsx(Kn,{className:"s3-explr-dialog-title",children:"Xác nhận xóa"}),d.jsxs(Ci,{className:"s3-explr-dialog-description break-words whitespace-pre-wrap",children:["Bạn có chắc chắn muốn xóa ",d.jsx("span",{className:"font-medium break-all",children:ee==null?void 0:ee.name}),"? Hành động này không thể hoàn tác."]})]}),d.jsxs(Fr,{className:"s3-explr-dialog-footer",children:[d.jsx(He,{variant:"outline",onClick:()=>W(null),className:"s3-explr-cancel-btn",children:"Hủy"}),d.jsx(He,{variant:"destructive",onClick:()=>xs(ee),disabled:vn,className:"s3-explr-confirm-delete-btn",children:vn?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang xóa..."]}):"Xóa"})]})]})}),d.jsx(ar,{open:!!$,onOpenChange:A=>{A||(te(null),Pe(null),z(""),Ct(""),Kt("rename"))},children:d.jsxs(zn,{className:"s3-explr-dialog-content max-w-5xl w-[90%]",children:[d.jsx(Vn,{className:"s3-explr-dialog-header",children:d.jsx(Kn,{className:"s3-explr-dialog-title",children:$!=null&&$.isFolder?"Đổi tên thư mục":na($)?"Quản lý tập tin":"Đổi tên tập tin"})}),$&&d.jsxs(_g,{value:Rn,onValueChange:A=>Kt(A),children:[d.jsxs(ou,{"aria-checked":!na($),"aria-disabled":$.isFolder,className:"grid w-full grid-cols-3 aria-checked:grid-cols-2 aria-disabled:grid-cols-1",children:[d.jsx(Yi,{value:"rename",children:"Đổi tên"}),!$.isFolder&&d.jsxs(d.Fragment,{children:[na($)&&d.jsx(Yi,{value:"edit",children:"Sửa nội dung"}),d.jsx(Yi,{value:"edit-metadata",children:"Sửa metadata file"})]})]}),d.jsx(Ji,{value:"rename",children:d.jsx("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:d.jsxs("div",{className:"h-[70dvh] min-h-[500px] overflow-hidden overflow-y-auto pb-3 px-1 s3-explr-input-group",children:[d.jsx(mr,{htmlFor:"newName",className:"s3-explr-label",children:"Tên mới"}),d.jsx(Gn,{id:"newName",value:Te,onChange:A=>z(A.target.value),placeholder:"Nhập tên mới",disabled:Ce,className:"s3-explr-input"})]})})}),!$.isFolder&&d.jsxs(d.Fragment,{children:[na($)&&d.jsx(Ji,{value:"edit",children:d.jsx("div",{className:"space-y-4 py-4",children:Yt?d.jsx("div",{className:"flex items-center justify-center py-10",children:d.jsx(kt,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):d.jsxs("div",{className:"max-h-[70dvh] overflow-auto rounded-md border px-4 py-3 bg-muted/30",children:[d.jsx(mr,{htmlFor:"content",className:"block text-sm font-medium mb-2 text-muted-foreground",children:"Nội dung tập tin"}),d.jsx(hc,{id:"content",value:Qe,onChange:A=>Ct(A.target.value),placeholder:"Nhập nội dung tập tin",className:"font-mono text-sm resize-none min-h-[200px] w-full",disabled:rn,style:{height:"auto",maxHeight:"60vh"},rows:Math.max(10,Qe.split(`
228
228
  `).length+1)})]})})}),d.jsx(Ji,{value:"edit-metadata",children:d.jsx("div",{className:"space-y-4 py-4",children:Yt?d.jsx("div",{className:"flex items-center justify-center py-4",children:d.jsx(kt,{className:"h-6 w-6 animate-spin"})}):d.jsx("div",{className:"h-[70dvh] min-h-[500px] overflow-hidden overflow-y-auto pb-3 px-1",children:xe&&typeof xe=="object"&&Object.entries(xe).map(([A,O],G)=>d.jsxs("div",{className:"pb-3 flex flex-col gap-2",children:[d.jsxs(mr,{htmlFor:A,className:"s3-explr-label flex items-center gap-1",children:[aL[A]||A,fg(A)&&d.jsx(GD,{className:"h-[12px] w-[12px] text-red-500"})]}),sL(A)?d.jsx(hc,{id:A,value:typeof O=="string"?O:JSON.stringify(O),onChange:pe=>{const be={...xe,[A]:pe.target.value};Pe(be)},placeholder:"Nhập nội dung tập tin",className:"min-h-[200px] font-mono",disabled:rn||fg(A)}):d.jsx(Gn,{id:A,value:typeof O=="string"?O:JSON.stringify(O),onChange:pe=>{const be={...xe,[A]:pe.target.value};Pe(be)},placeholder:"Nhập nội dung",className:"s3-explr-input",disabled:rn||fg(A)})]},G))})})})]})]}),d.jsxs(Fr,{className:"s3-explr-dialog-footer",children:[d.jsx(He,{variant:"outline",onClick:()=>{te(null),Pe(null),z(""),Ct("")},className:"s3-explr-cancel-btn",children:"Hủy"}),Rn==="edit"?d.jsx(He,{onClick:()=>$&&el($,Qe),disabled:rn||Yt,className:"s3-explr-save-btn",children:rn?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang lưu..."]}):"Lưu thay đổi"}):Rn==="edit-metadata"?d.jsx(He,{onClick:()=>xe&&typeof xe=="object"&&$&&tl($),disabled:rn||Yt,className:"s3-explr-save-btn",children:rn?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang lưu..."]}):"Lưu thay đổi"}):d.jsx(He,{onClick:()=>{Te.trim()&&$&&Xm($,Te.trim())},disabled:Ce||!Te.trim()||Te.trim()===($==null?void 0:$.name),className:"s3-explr-rename-btn",children:Ce?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang đổi tên..."]}):"Đổi tên"})]})]})}),d.jsx(ar,{open:!!_e,onOpenChange:A=>{A||(ke(null),Ct(""))},children:d.jsxs(zn,{className:"s3-explr-dialog-content max-w-5xl w-[90%]",children:[d.jsx(Vn,{className:"s3-explr-dialog-header",children:d.jsx(Kn,{className:"s3-explr-dialog-title",children:"Xem tập tin"})}),_e&&d.jsxs(_g,{value:"view",children:[d.jsx(ou,{className:"grid w-full grid-cols-1 ",children:!_e.isFolder&&na(_e)&&d.jsx(Yi,{value:"view",children:"Nội dung"})}),!_e.isFolder&&na(_e)&&d.jsx(Ji,{value:"view",children:d.jsx("div",{className:"space-y-4 py-4",children:Yt?d.jsx("div",{className:"flex items-center justify-center py-4",children:d.jsx(kt,{className:"h-6 w-6 animate-spin"})}):d.jsx("div",{className:"overflow-hidden overflow-y-auto pb-3 px-1",children:d.jsx("div",{className:"rounded-md bg-muted p-4 font-mono text-sm overflow-auto max-h-[60vh] border",children:d.jsx("pre",{className:"whitespace-pre-wrap break-words",children:Qe})})})})})]}),d.jsx(Fr,{className:"s3-explr-dialog-footer",children:d.jsx(He,{variant:"outline",onClick:()=>{ke(null),Ct("")},className:"s3-explr-cancel-btn",children:"Đóng"})})]})}),de&&ce&&d.jsx(VU,{openDialogRename:ce,setOpenDialogRename:Ae,apiBaseUrl:e,setFileToMove:se,fileToMove:de,refreshFiles:on,ignoreCache:Wn,autoSyncAfterFileOperation:jo})]})]}),Km&&d.jsx("div",{className:"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded relative s3-explr-error",children:"Đã xảy ra lỗi khi tải danh sách tập tin"}),d.jsx(zU,{onFilesSelected:(A,O)=>va(A,v,O),children:d.jsx("div",{className:"rounded-md border s3-explr-table-container",children:d.jsxs(eu,{className:"s3-explr-table",children:[d.jsx(tu,{className:"s3-explr-table-header",children:_s.getHeaderGroups().map(A=>d.jsx(Hr,{className:"hover:bg-transparent s3-explr-header-row",children:A.headers.map(O=>d.jsx(po,{className:"s3-explr-header-cell",children:O.isPlaceholder?null:Ad(O.column.columnDef.header,O.getContext())},O.id))},A.id))}),d.jsx(nu,{className:"s3-explr-table-body",children:_s.getRowModel().rows.length===0?d.jsx(Hr,{className:"s3-explr-empty-row",children:d.jsx(jn,{colSpan:af.length,className:"h-24 text-center s3-explr-empty-cell",children:g?d.jsxs("div",{className:"text-gray-500 s3-explr-no-results",children:['Không tìm thấy tập tin hoặc thư mục nào khớp với "',g,'"']}):d.jsx("div",{className:"text-gray-500 s3-explr-empty-message",children:Ai?"Đang tải nội dung thư mục... Vui lòng đợi":"Thư mục này không chứa tập tin hoặc thư mục con nào"})})}):_s.getRowModel().rows.map(A=>d.jsx(Hr,{className:"h-12 s3-explr-row",children:A.getVisibleCells().map(O=>d.jsx(jn,{className:"align-middle s3-explr-cell",children:Ad(O.column.columnDef.cell,O.getContext())},O.id))},A.id))})]})})}),g&&ga!==0&&d.jsx(d.Fragment,{children:d.jsx(Yd,{children:d.jsxs(Jd,{children:[d.jsx(Qd,{onClick:()=>dr(A=>Math.max(A-1,1)),"aria-disabled":Gt===1,className:"cursor-pointer aria-disabled:pointer-events-none"}),Array.from({length:Math.ceil(ga/20)},(A,O)=>{const G=O+1,pe=Math.ceil(ga/20);return pe>7&&!(G===1||G===pe||G>=Gt-1&&G<=Gt+1)?G===Gt-2&&Gt>4||G===Gt+2&&Gt<pe-3?d.jsx(Zd,{className:"pointer-events-none",children:"..."},O):null:d.jsx($r,{className:"cursor-pointer",children:d.jsx(Xa,{isActive:Gt===G,onClick:()=>dr(G),className:`${Gt===G?"bg-blue-500 text-white":"bg-white text-black"} hover:bg-blue-100`,children:G})},O)}),d.jsx($r,{children:d.jsx(Xd,{onClick:()=>dr(A=>Math.min(A+1,Math.ceil(ga/20))),"aria-disabled":Gt===Math.ceil(ga/20),className:"cursor-pointer aria-disabled:pointer-events-none"})})]})})}),o&&a&&d.jsxs("div",{className:"flex justify-between items-center mt-4 s3-explr-selector-footer",children:[d.jsx("div",{className:"text-sm text-gray-500 s3-explr-selection-count",children:ol()}),d.jsx(He,{variant:"default",onClick:()=>a(Ii()),disabled:y.size===0,className:"s3-explr-ok-btn",children:"OK"})]}),d.jsx(i3,{open:!!Mc,onClose:()=>Rc(null),file:Mc,apiBaseUrl:e,rootUrlHostApi:r})]})}),y3=t=>d.jsx(fM,{clientId:c3,children:d.jsx(v3,{...t})});var Ec=t=>t.type==="checkbox",oa=t=>t instanceof Date,On=t=>t==null;const e0=t=>typeof t=="object";var qt=t=>!On(t)&&!Array.isArray(t)&&e0(t)&&!oa(t),w3=t=>qt(t)&&t.target?Ec(t.target)?t.target.checked:t.target.value:t,C3=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,b3=(t,e)=>t.has(C3(e)),x3=t=>{const e=t.constructor&&t.constructor.prototype;return qt(e)&&e.hasOwnProperty("isPrototypeOf")},Pm=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function _n(t){let e;const n=Array.isArray(t),r=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(Pm&&(t instanceof Blob||r))&&(n||qt(t)))if(e=n?[]:{},!n&&!x3(t))e=t;else for(const o in t)t.hasOwnProperty(o)&&(e[o]=_n(t[o]));else return t;return e}var Ou=t=>Array.isArray(t)?t.filter(Boolean):[],nn=t=>t===void 0,Fe=(t,e,n)=>{if(!e||!qt(t))return n;const r=Ou(e.split(/[,[\].]+?/)).reduce((o,a)=>On(o)?o:o[a],t);return nn(r)||r===t?nn(t[e])?n:t[e]:r},wo=t=>typeof t=="boolean",Om=t=>/^\w*$/.test(t),t0=t=>Ou(t.replace(/["|']|\]/g,"").split(/\.|\[/)),$t=(t,e,n)=>{let r=-1;const o=Om(e)?[e]:t0(e),a=o.length,s=a-1;for(;++r<a;){const l=o[r];let u=n;if(r!==s){const h=t[l];u=qt(h)||Array.isArray(h)?h:isNaN(+o[r+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;t[l]=u,t=t[l]}};const n0={BLUR:"blur",FOCUS_OUT:"focusout"},Kr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Bo={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};M.createContext(null);var S3=(t,e,n,r=!0)=>{const o={defaultValues:e._defaultValues};for(const a in t)Object.defineProperty(o,a,{get:()=>{const s=a;return e._proxyFormState[s]!==Kr.all&&(e._proxyFormState[s]=!r||Kr.all),t[s]}});return o};const _3=typeof window<"u"?C.useLayoutEffect:C.useEffect;var Co=t=>typeof t=="string",E3=(t,e,n,r,o)=>Co(t)?(r&&e.watch.add(t),Fe(n,t,o)):Array.isArray(t)?t.map(a=>(r&&e.watch.add(a),Fe(n,a))):(r&&(e.watchAll=!0),n),T3=(t,e,n,r,o)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:o||!0}}:{},Tc=t=>Array.isArray(t)?t:[t],r0=()=>{let t=[];return{get observers(){return t},next:o=>{for(const a of t)a.next&&a.next(o)},subscribe:o=>(t.push(o),{unsubscribe:()=>{t=t.filter(a=>a!==o)}}),unsubscribe:()=>{t=[]}}},Mm=t=>On(t)||!e0(t);function Ti(t,e){if(Mm(t)||Mm(e))return t===e;if(oa(t)&&oa(e))return t.getTime()===e.getTime();const n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(const o of n){const a=t[o];if(!r.includes(o))return!1;if(o!=="ref"){const s=e[o];if(oa(a)&&oa(s)||qt(a)&&qt(s)||Array.isArray(a)&&Array.isArray(s)?!Ti(a,s):a!==s)return!1}}return!0}var Mn=t=>qt(t)&&!Object.keys(t).length,Rm=t=>t.type==="file",Gr=t=>typeof t=="function",Mu=t=>{if(!Pm)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},o0=t=>t.type==="select-multiple",Dm=t=>t.type==="radio",A3=t=>Dm(t)||Ec(t),Lm=t=>Mu(t)&&t.isConnected;function I3(t,e){const n=e.slice(0,-1).length;let r=0;for(;r<n;)t=nn(t)?r++:t[e[r++]];return t}function k3(t){for(const e in t)if(t.hasOwnProperty(e)&&!nn(t[e]))return!1;return!0}function an(t,e){const n=Array.isArray(e)?e:Om(e)?[e]:t0(e),r=n.length===1?t:I3(t,n),o=n.length-1,a=n[o];return r&&delete r[a],o!==0&&(qt(r)&&Mn(r)||Array.isArray(r)&&k3(r))&&an(t,n.slice(0,-1)),t}var i0=t=>{for(const e in t)if(Gr(t[e]))return!0;return!1};function Ru(t,e={}){const n=Array.isArray(t);if(qt(t)||n)for(const r in t)Array.isArray(t[r])||qt(t[r])&&!i0(t[r])?(e[r]=Array.isArray(t[r])?[]:{},Ru(t[r],e[r])):On(t[r])||(e[r]=!0);return e}function a0(t,e,n){const r=Array.isArray(t);if(qt(t)||r)for(const o in t)Array.isArray(t[o])||qt(t[o])&&!i0(t[o])?nn(e)||Mm(n[o])?n[o]=Array.isArray(t[o])?Ru(t[o],[]):{...Ru(t[o])}:a0(t[o],On(e)?{}:e[o],n[o]):n[o]=!Ti(t[o],e[o]);return n}var Ac=(t,e)=>a0(t,e,Ru(e));const s0={value:!1,isValid:!1},c0={value:!0,isValid:!0};var l0=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!nn(t[0].attributes.value)?nn(t[0].value)||t[0].value===""?c0:{value:t[0].value,isValid:!0}:c0:s0}return s0},d0=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>nn(t)?t:e?t===""?NaN:t&&+t:n&&Co(t)?new Date(t):r?r(t):t;const u0={isValid:!1,value:null};var f0=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,u0):u0;function h0(t){const e=t.ref;return Rm(e)?e.files:Dm(e)?f0(t.refs).value:o0(e)?[...e.selectedOptions].map(({value:n})=>n):Ec(e)?l0(t.refs).value:d0(nn(e.value)?t.ref.value:e.value,t)}var N3=(t,e,n,r)=>{const o={};for(const a of t){const s=Fe(e,a);s&&$t(o,a,s._f)}return{criteriaMode:n,names:[...t],fields:o,shouldUseNativeValidation:r}},Du=t=>t instanceof RegExp,Ic=t=>nn(t)?t:Du(t)?t.source:qt(t)?Du(t.value)?t.value.source:t.value:t,p0=t=>({isOnSubmit:!t||t===Kr.onSubmit,isOnBlur:t===Kr.onBlur,isOnChange:t===Kr.onChange,isOnAll:t===Kr.all,isOnTouch:t===Kr.onTouched});const g0="AsyncFunction";var P3=t=>!!t&&!!t.validate&&!!(Gr(t.validate)&&t.validate.constructor.name===g0||qt(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===g0)),O3=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),m0=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const kc=(t,e,n,r)=>{for(const o of n||Object.keys(t)){const a=Fe(t,o);if(a){const{_f:s,...l}=a;if(s){if(s.refs&&s.refs[0]&&e(s.refs[0],o)&&!r)return!0;if(s.ref&&e(s.ref,s.name)&&!r)return!0;if(kc(l,e))break}else if(qt(l)&&kc(l,e))break}}};function v0(t,e,n){const r=Fe(t,n);if(r||Om(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const a=o.join("."),s=Fe(e,a),l=Fe(t,a);if(s&&!Array.isArray(s)&&n!==a)return{name:n};if(l&&l.type)return{name:a,error:l};o.pop()}return{name:n}}var M3=(t,e,n,r)=>{n(t);const{name:o,...a}=t;return Mn(a)||Object.keys(a).length>=Object.keys(e).length||Object.keys(a).find(s=>e[s]===(!r||Kr.all))},R3=(t,e,n)=>!t||!e||t===e||Tc(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r))),D3=(t,e,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(e||t):(n?r.isOnBlur:o.isOnBlur)?!t:(n?r.isOnChange:o.isOnChange)?t:!0,L3=(t,e)=>!Ou(Fe(t,e)).length&&an(t,e),F3=(t,e,n)=>{const r=Tc(Fe(t,n));return $t(r,"root",e[n]),$t(t,n,r),t},Lu=t=>Co(t);function y0(t,e,n="validate"){if(Lu(t)||Array.isArray(t)&&t.every(Lu)||wo(t)&&!t)return{type:n,message:Lu(t)?t:"",ref:e}}var ss=t=>qt(t)&&!Du(t)?t:{value:t,message:""},w0=async(t,e,n,r,o,a)=>{const{ref:s,refs:l,required:u,maxLength:h,minLength:p,min:g,max:w,pattern:y,validate:x,name:v,valueAsNumber:b,mount:E}=t._f,T=Fe(n,v);if(!E||e.has(v))return{};const N=l?l[0]:s,P=se=>{o&&N.reportValidity&&(N.setCustomValidity(wo(se)?"":se||""),N.reportValidity())},_={},D=Dm(s),H=Ec(s),K=D||H,ee=(b||Rm(s))&&nn(s.value)&&nn(T)||Mu(s)&&s.value===""||T===""||Array.isArray(T)&&!T.length,W=T3.bind(null,v,r,_),de=(se,fe,q,Z=Bo.maxLength,Y=Bo.minLength)=>{const oe=se?fe:q;_[v]={type:se?Z:Y,message:oe,ref:s,...W(se?Z:Y,oe)}};if(a?!Array.isArray(T)||!T.length:u&&(!K&&(ee||On(T))||wo(T)&&!T||H&&!l0(l).isValid||D&&!f0(l).isValid)){const{value:se,message:fe}=Lu(u)?{value:!!u,message:u}:ss(u);if(se&&(_[v]={type:Bo.required,message:fe,ref:N,...W(Bo.required,fe)},!r))return P(fe),_}if(!ee&&(!On(g)||!On(w))){let se,fe;const q=ss(w),Z=ss(g);if(!On(T)&&!isNaN(T)){const Y=s.valueAsNumber||T&&+T;On(q.value)||(se=Y>q.value),On(Z.value)||(fe=Y<Z.value)}else{const Y=s.valueAsDate||new Date(T),oe=$=>new Date(new Date().toDateString()+" "+$),Q=s.type=="time",X=s.type=="week";Co(q.value)&&T&&(se=Q?oe(T)>oe(q.value):X?T>q.value:Y>new Date(q.value)),Co(Z.value)&&T&&(fe=Q?oe(T)<oe(Z.value):X?T<Z.value:Y<new Date(Z.value))}if((se||fe)&&(de(!!se,q.message,Z.message,Bo.max,Bo.min),!r))return P(_[v].message),_}if((h||p)&&!ee&&(Co(T)||a&&Array.isArray(T))){const se=ss(h),fe=ss(p),q=!On(se.value)&&T.length>+se.value,Z=!On(fe.value)&&T.length<+fe.value;if((q||Z)&&(de(q,se.message,fe.message),!r))return P(_[v].message),_}if(y&&!ee&&Co(T)){const{value:se,message:fe}=ss(y);if(Du(se)&&!T.match(se)&&(_[v]={type:Bo.pattern,message:fe,ref:s,...W(Bo.pattern,fe)},!r))return P(fe),_}if(x){if(Gr(x)){const se=await x(T,n),fe=y0(se,N);if(fe&&(_[v]={...fe,...W(Bo.validate,fe.message)},!r))return P(fe.message),_}else if(qt(x)){let se={};for(const fe in x){if(!Mn(se)&&!r)break;const q=y0(await x[fe](T,n),N,fe);q&&(se={...q,...W(fe,q.message)},P(q.message),r&&(_[v]=se))}if(!Mn(se)&&(_[v]={ref:N,...se},!r))return _}}return P(!0),_};const $3={mode:Kr.onSubmit,reValidateMode:Kr.onChange,shouldFocusError:!0};function H3(t={}){let e={...$3,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:Gr(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1};const r={};let o=qt(e.defaultValues)||qt(e.values)?_n(e.defaultValues||e.values)||{}:{},a=e.shouldUnregister?{}:_n(o),s={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},u,h=0;const p={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let g={...p};const w={array:r0(),state:r0()},y=p0(e.mode),x=p0(e.reValidateMode),v=e.criteriaMode===Kr.all,b=L=>J=>{clearTimeout(h),h=setTimeout(L,J)},E=async L=>{if(!e.disabled&&(p.isValid||g.isValid||L)){const J=e.resolver?Mn((await ee()).errors):await de(r,!0);J!==n.isValid&&w.state.next({isValid:J})}},T=(L,J)=>{!e.disabled&&(p.isValidating||p.validatingFields||g.isValidating||g.validatingFields)&&((L||Array.from(l.mount)).forEach(U=>{U&&(J?$t(n.validatingFields,U,J):an(n.validatingFields,U))}),w.state.next({validatingFields:n.validatingFields,isValidating:!Mn(n.validatingFields)}))},N=(L,J=[],U,ae,ye=!0,he=!0)=>{if(ae&&U&&!e.disabled){if(s.action=!0,he&&Array.isArray(Fe(r,L))){const Ee=U(Fe(r,L),ae.argA,ae.argB);ye&&$t(r,L,Ee)}if(he&&Array.isArray(Fe(n.errors,L))){const Ee=U(Fe(n.errors,L),ae.argA,ae.argB);ye&&$t(n.errors,L,Ee),L3(n.errors,L)}if((p.touchedFields||g.touchedFields)&&he&&Array.isArray(Fe(n.touchedFields,L))){const Ee=U(Fe(n.touchedFields,L),ae.argA,ae.argB);ye&&$t(n.touchedFields,L,Ee)}(p.dirtyFields||g.dirtyFields)&&(n.dirtyFields=Ac(o,a)),w.state.next({name:L,isDirty:fe(L,J),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else $t(a,L,J)},P=(L,J)=>{$t(n.errors,L,J),w.state.next({errors:n.errors})},_=L=>{n.errors=L,w.state.next({errors:n.errors,isValid:!1})},D=(L,J,U,ae)=>{const ye=Fe(r,L);if(ye){const he=Fe(a,L,nn(U)?Fe(o,L):U);nn(he)||ae&&ae.defaultChecked||J?$t(a,L,J?he:h0(ye._f)):Y(L,he),s.mount&&E()}},H=(L,J,U,ae,ye)=>{let he=!1,Ee=!1;const Xe={name:L};if(!e.disabled){if(!U||ae){(p.isDirty||g.isDirty)&&(Ee=n.isDirty,n.isDirty=Xe.isDirty=fe(),he=Ee!==Xe.isDirty);const ft=Ti(Fe(o,L),J);Ee=!!Fe(n.dirtyFields,L),ft?an(n.dirtyFields,L):$t(n.dirtyFields,L,!0),Xe.dirtyFields=n.dirtyFields,he=he||(p.dirtyFields||g.dirtyFields)&&Ee!==!ft}if(U){const ft=Fe(n.touchedFields,L);ft||($t(n.touchedFields,L,U),Xe.touchedFields=n.touchedFields,he=he||(p.touchedFields||g.touchedFields)&&ft!==U)}he&&ye&&w.state.next(Xe)}return he?Xe:{}},K=(L,J,U,ae)=>{const ye=Fe(n.errors,L),he=(p.isValid||g.isValid)&&wo(J)&&n.isValid!==J;if(e.delayError&&U?(u=b(()=>P(L,U)),u(e.delayError)):(clearTimeout(h),u=null,U?$t(n.errors,L,U):an(n.errors,L)),(U?!Ti(ye,U):ye)||!Mn(ae)||he){const Ee={...ae,...he&&wo(J)?{isValid:J}:{},errors:n.errors,name:L};n={...n,...Ee},w.state.next(Ee)}},ee=async L=>{T(L,!0);const J=await e.resolver(a,e.context,N3(L||l.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return T(L),J},W=async L=>{const{errors:J}=await ee(L);if(L)for(const U of L){const ae=Fe(J,U);ae?$t(n.errors,U,ae):an(n.errors,U)}else n.errors=J;return J},de=async(L,J,U={valid:!0})=>{for(const ae in L){const ye=L[ae];if(ye){const{_f:he,...Ee}=ye;if(he){const Xe=l.array.has(he.name),ft=ye._f&&P3(ye._f);ft&&p.validatingFields&&T([ae],!0);const xt=await w0(ye,l.disabled,a,v,e.shouldUseNativeValidation&&!J,Xe);if(ft&&p.validatingFields&&T([ae]),xt[he.name]&&(U.valid=!1,J))break;!J&&(Fe(xt,he.name)?Xe?F3(n.errors,xt,he.name):$t(n.errors,he.name,xt[he.name]):an(n.errors,he.name))}!Mn(Ee)&&await de(Ee,J,U)}}return U.valid},se=()=>{for(const L of l.unMount){const J=Fe(r,L);J&&(J._f.refs?J._f.refs.every(U=>!Lm(U)):!Lm(J._f.ref))&&Ae(L)}l.unMount=new Set},fe=(L,J)=>!e.disabled&&(L&&J&&$t(a,L,J),!Ti(_e(),o)),q=(L,J,U)=>E3(L,l,{...s.mount?a:nn(J)?o:Co(L)?{[L]:J}:J},U,J),Z=L=>Ou(Fe(s.mount?a:o,L,e.shouldUnregister?Fe(o,L,[]):[])),Y=(L,J,U={})=>{const ae=Fe(r,L);let ye=J;if(ae){const he=ae._f;he&&(!he.disabled&&$t(a,L,d0(J,he)),ye=Mu(he.ref)&&On(J)?"":J,o0(he.ref)?[...he.ref.options].forEach(Ee=>Ee.selected=ye.includes(Ee.value)):he.refs?Ec(he.ref)?he.refs.length>1?he.refs.forEach(Ee=>(!Ee.defaultChecked||!Ee.disabled)&&(Ee.checked=Array.isArray(ye)?!!ye.find(Xe=>Xe===Ee.value):ye===Ee.value)):he.refs[0]&&(he.refs[0].checked=!!ye):he.refs.forEach(Ee=>Ee.checked=Ee.value===ye):Rm(he.ref)?he.ref.value="":(he.ref.value=ye,he.ref.type||w.state.next({name:L,values:_n(a)})))}(U.shouldDirty||U.shouldTouch)&&H(L,ye,U.shouldTouch,U.shouldDirty,!0),U.shouldValidate&&te(L)},oe=(L,J,U)=>{for(const ae in J){const ye=J[ae],he=`${L}.${ae}`,Ee=Fe(r,he);(l.array.has(L)||qt(ye)||Ee&&!Ee._f)&&!oa(ye)?oe(he,ye,U):Y(he,ye,U)}},Q=(L,J,U={})=>{const ae=Fe(r,L),ye=l.array.has(L),he=_n(J);$t(a,L,he),ye?(w.array.next({name:L,values:_n(a)}),(p.isDirty||p.dirtyFields||g.isDirty||g.dirtyFields)&&U.shouldDirty&&w.state.next({name:L,dirtyFields:Ac(o,a),isDirty:fe(L,he)})):ae&&!ae._f&&!On(he)?oe(L,he,U):Y(L,he,U),m0(L,l)&&w.state.next({...n}),w.state.next({name:s.mount?L:void 0,values:_n(a)})},X=async L=>{s.mount=!0;const J=L.target;let U=J.name,ae=!0;const ye=Fe(r,U),he=Ee=>{ae=Number.isNaN(Ee)||oa(Ee)&&isNaN(Ee.getTime())||Ti(Ee,Fe(a,U,Ee))};if(ye){let Ee,Xe;const ft=J.type?h0(ye._f):w3(L),xt=L.type===n0.BLUR||L.type===n0.FOCUS_OUT,bo=!O3(ye._f)&&!e.resolver&&!Fe(n.errors,U)&&!ye._f.deps||D3(xt,Fe(n.touchedFields,U),n.isSubmitted,x,y),Jt=m0(U,l,xt);$t(a,U,ft),xt?(ye._f.onBlur&&ye._f.onBlur(L),u&&u(0)):ye._f.onChange&&ye._f.onChange(L);const vn=H(U,ft,xt),jr=!Mn(vn)||Jt;if(!xt&&w.state.next({name:U,type:L.type,values:_n(a)}),bo)return(p.isValid||g.isValid)&&(e.mode==="onBlur"?xt&&E():xt||E()),jr&&w.state.next({name:U,...Jt?{}:vn});if(!xt&&Jt&&w.state.next({...n}),e.resolver){const{errors:Gt}=await ee([U]);if(he(ft),ae){const dr=v0(n.errors,r,U),Wr=v0(Gt,r,dr.name||U);Ee=Wr.error,U=Wr.name,Xe=Mn(Gt)}}else T([U],!0),Ee=(await w0(ye,l.disabled,a,v,e.shouldUseNativeValidation))[U],T([U]),he(ft),ae&&(Ee?Xe=!1:(p.isValid||g.isValid)&&(Xe=await de(r,!0)));ae&&(ye._f.deps&&te(ye._f.deps),K(U,Xe,Ee,vn))}},$=(L,J)=>{if(Fe(n.errors,J)&&L.focus)return L.focus(),1},te=async(L,J={})=>{let U,ae;const ye=Tc(L);if(e.resolver){const he=await W(nn(L)?L:ye);U=Mn(he),ae=L?!ye.some(Ee=>Fe(he,Ee)):U}else L?(ae=(await Promise.all(ye.map(async he=>{const Ee=Fe(r,he);return await de(Ee&&Ee._f?{[he]:Ee}:Ee)}))).every(Boolean),!(!ae&&!n.isValid)&&E()):ae=U=await de(r);return w.state.next({...!Co(L)||(p.isValid||g.isValid)&&U!==n.isValid?{}:{name:L},...e.resolver||!L?{isValid:U}:{},errors:n.errors}),J.shouldFocus&&!ae&&kc(r,$,L?ye:l.mount),ae},_e=L=>{const J={...s.mount?a:o};return nn(L)?J:Co(L)?Fe(J,L):L.map(U=>Fe(J,U))},ke=(L,J)=>({invalid:!!Fe((J||n).errors,L),isDirty:!!Fe((J||n).dirtyFields,L),error:Fe((J||n).errors,L),isValidating:!!Fe(n.validatingFields,L),isTouched:!!Fe((J||n).touchedFields,L)}),xe=L=>{L&&Tc(L).forEach(J=>an(n.errors,J)),w.state.next({errors:L?n.errors:{}})},Pe=(L,J,U)=>{const ae=(Fe(r,L,{_f:{}})._f||{}).ref,ye=Fe(n.errors,L)||{},{ref:he,message:Ee,type:Xe,...ft}=ye;$t(n.errors,L,{...ft,...J,ref:ae}),w.state.next({name:L,errors:n.errors,isValid:!1}),U&&U.shouldFocus&&ae&&ae.focus&&ae.focus()},Te=(L,J)=>Gr(L)?w.state.subscribe({next:U=>L(q(void 0,J),U)}):q(L,J,!0),z=L=>w.state.subscribe({next:J=>{R3(L.name,J.name,L.exact)&&M3(J,L.formState||p,zt,L.reRenderRoot)&&L.callback({values:{...a},...n,...J})}}).unsubscribe,ce=L=>(s.mount=!0,g={...g,...L.formState},z({...L,formState:g})),Ae=(L,J={})=>{for(const U of L?Tc(L):l.mount)l.mount.delete(U),l.array.delete(U),J.keepValue||(an(r,U),an(a,U)),!J.keepError&&an(n.errors,U),!J.keepDirty&&an(n.dirtyFields,U),!J.keepTouched&&an(n.touchedFields,U),!J.keepIsValidating&&an(n.validatingFields,U),!e.shouldUnregister&&!J.keepDefaultValue&&an(o,U);w.state.next({values:_n(a)}),w.state.next({...n,...J.keepDirty?{isDirty:fe()}:{}}),!J.keepIsValid&&E()},Ce=({disabled:L,name:J})=>{(wo(L)&&s.mount||L||l.disabled.has(J))&&(L?l.disabled.add(J):l.disabled.delete(J))},Ne=(L,J={})=>{let U=Fe(r,L);const ae=wo(J.disabled)||wo(e.disabled);return $t(r,L,{...U||{},_f:{...U&&U._f?U._f:{ref:{name:L}},name:L,mount:!0,...J}}),l.mount.add(L),U?Ce({disabled:wo(J.disabled)?J.disabled:e.disabled,name:L}):D(L,!0,J.value),{...ae?{disabled:J.disabled||e.disabled}:{},...e.progressive?{required:!!J.required,min:Ic(J.min),max:Ic(J.max),minLength:Ic(J.minLength),maxLength:Ic(J.maxLength),pattern:Ic(J.pattern)}:{},name:L,onChange:X,onBlur:X,ref:ye=>{if(ye){Ne(L,J),U=Fe(r,L);const he=nn(ye.value)&&ye.querySelectorAll&&ye.querySelectorAll("input,select,textarea")[0]||ye,Ee=A3(he),Xe=U._f.refs||[];if(Ee?Xe.find(ft=>ft===he):he===U._f.ref)return;$t(r,L,{_f:{...U._f,...Ee?{refs:[...Xe.filter(Lm),he,...Array.isArray(Fe(o,L))?[{}]:[]],ref:{type:he.type,name:L}}:{ref:he}}}),D(L,!1,void 0,he)}else U=Fe(r,L,{}),U._f&&(U._f.mount=!1),(e.shouldUnregister||J.shouldUnregister)&&!(b3(l.array,L)&&s.action)&&l.unMount.add(L)}}},ne=()=>e.shouldFocusError&&kc(r,$,l.mount),Ve=L=>{wo(L)&&(w.state.next({disabled:L}),kc(r,(J,U)=>{const ae=Fe(r,U);ae&&(J.disabled=ae._f.disabled||L,Array.isArray(ae._f.refs)&&ae._f.refs.forEach(ye=>{ye.disabled=ae._f.disabled||L}))},0,!1))},Qe=(L,J)=>async U=>{let ae;U&&(U.preventDefault&&U.preventDefault(),U.persist&&U.persist());let ye=_n(a);if(w.state.next({isSubmitting:!0}),e.resolver){const{errors:he,values:Ee}=await ee();n.errors=he,ye=Ee}else await de(r);if(l.disabled.size)for(const he of l.disabled)$t(ye,he,void 0);if(an(n.errors,"root"),Mn(n.errors)){w.state.next({errors:{}});try{await L(ye,U)}catch(he){ae=he}}else J&&await J({...n.errors},U),ne(),setTimeout(ne);if(w.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Mn(n.errors)&&!ae,submitCount:n.submitCount+1,errors:n.errors}),ae)throw ae},Ct=(L,J={})=>{Fe(r,L)&&(nn(J.defaultValue)?Q(L,_n(Fe(o,L))):(Q(L,J.defaultValue),$t(o,L,_n(J.defaultValue))),J.keepTouched||an(n.touchedFields,L),J.keepDirty||(an(n.dirtyFields,L),n.isDirty=J.defaultValue?fe(L,_n(Fe(o,L))):fe()),J.keepError||(an(n.errors,L),p.isValid&&E()),w.state.next({...n}))},Yt=(L,J={})=>{const U=L?_n(L):o,ae=_n(U),ye=Mn(L),he=ye?o:ae;if(J.keepDefaultValues||(o=U),!J.keepValues){if(J.keepDirtyValues){const Ee=new Set([...l.mount,...Object.keys(Ac(o,a))]);for(const Xe of Array.from(Ee))Fe(n.dirtyFields,Xe)?$t(he,Xe,Fe(a,Xe)):Q(Xe,Fe(he,Xe))}else{if(Pm&&nn(L))for(const Ee of l.mount){const Xe=Fe(r,Ee);if(Xe&&Xe._f){const ft=Array.isArray(Xe._f.refs)?Xe._f.refs[0]:Xe._f.ref;if(Mu(ft)){const xt=ft.closest("form");if(xt){xt.reset();break}}}}for(const Ee of l.mount)Q(Ee,Fe(he,Ee))}a=_n(he),w.array.next({values:{...he}}),w.state.next({values:{...he}})}l={mount:J.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},s.mount=!p.isValid||!!J.keepIsValid||!!J.keepDirtyValues,s.watch=!!e.shouldUnregister,w.state.next({submitCount:J.keepSubmitCount?n.submitCount:0,isDirty:ye?!1:J.keepDirty?n.isDirty:!!(J.keepDefaultValues&&!Ti(L,o)),isSubmitted:J.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:ye?{}:J.keepDirtyValues?J.keepDefaultValues&&a?Ac(o,a):n.dirtyFields:J.keepDefaultValues&&L?Ac(o,L):J.keepDirty?n.dirtyFields:{},touchedFields:J.keepTouched?n.touchedFields:{},errors:J.keepErrors?n.errors:{},isSubmitSuccessful:J.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},bt=(L,J)=>Yt(Gr(L)?L(a):L,J),rn=(L,J={})=>{const U=Fe(r,L),ae=U&&U._f;if(ae){const ye=ae.refs?ae.refs[0]:ae.ref;ye.focus&&(ye.focus(),J.shouldSelect&&Gr(ye.select)&&ye.select())}},zt=L=>{n={...n,...L}},Kt={control:{register:Ne,unregister:Ae,getFieldState:ke,handleSubmit:Qe,setError:Pe,_subscribe:z,_runSchema:ee,_getWatch:q,_getDirty:fe,_setValid:E,_setFieldArray:N,_setDisabledField:Ce,_setErrors:_,_getFieldArray:Z,_reset:Yt,_resetDefaultValues:()=>Gr(e.defaultValues)&&e.defaultValues().then(L=>{bt(L,e.resetOptions),w.state.next({isLoading:!1})}),_removeUnmounted:se,_disableForm:Ve,_subjects:w,_proxyFormState:p,get _fields(){return r},get _formValues(){return a},get _state(){return s},set _state(L){s=L},get _defaultValues(){return o},get _names(){return l},set _names(L){l=L},get _formState(){return n},get _options(){return e},set _options(L){e={...e,...L}}},subscribe:ce,trigger:te,register:Ne,handleSubmit:Qe,watch:Te,setValue:Q,getValues:_e,reset:bt,resetField:Ct,clearErrors:xe,unregister:Ae,setError:Pe,setFocus:rn,getFieldState:ke};return{...Kt,formControl:Kt}}function U3(t={}){const e=M.useRef(void 0),n=M.useRef(void 0),[r,o]=M.useState({isDirty:!1,isValidating:!1,isLoading:Gr(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:Gr(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...t.formControl?t.formControl:H3(t),formState:r},t.formControl&&t.defaultValues&&!Gr(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions));const a=e.current.control;return a._options=t,_3(()=>{const s=a._subscribe({formState:a._proxyFormState,callback:()=>o({...a._formState}),reRenderRoot:!0});return o(l=>({...l,isReady:!0})),a._formState.isReady=!0,s},[a]),M.useEffect(()=>a._disableForm(t.disabled),[a,t.disabled]),M.useEffect(()=>{t.mode&&(a._options.mode=t.mode),t.reValidateMode&&(a._options.reValidateMode=t.reValidateMode),t.errors&&!Mn(t.errors)&&a._setErrors(t.errors)},[a,t.errors,t.mode,t.reValidateMode]),M.useEffect(()=>{t.shouldUnregister&&a._subjects.state.next({values:a._getWatch()})},[a,t.shouldUnregister]),M.useEffect(()=>{if(a._proxyFormState.isDirty){const s=a._getDirty();s!==r.isDirty&&a._subjects.state.next({isDirty:s})}},[a,r.isDirty]),M.useEffect(()=>{t.values&&!Ti(t.values,n.current)?(a._reset(t.values,a._options.resetOptions),n.current=t.values,o(s=>({...s}))):a._resetDefaultValues()},[a,t.values]),M.useEffect(()=>{a._state.mount||(a._setValid(),a._state.mount=!0),a._state.watch&&(a._state.watch=!1,a._subjects.state.next({...a._formState})),a._removeUnmounted()}),e.current.formState=S3(r,a),e.current}const C0=({className:t,children:e,content:n,side:r})=>{const[o,a]=M.useState(!1);return d.jsx(vr,{delayDuration:0,children:d.jsxs(yr,{open:o,children:[d.jsx(wr,{asChild:!0,children:d.jsx("button",{type:"button",className:ze("cursor-pointer",t),onClick:()=>a(!o),onMouseEnter:()=>a(!0),onMouseLeave:()=>a(!1),onTouchStart:()=>a(!o),onKeyDown:s=>{s.preventDefault(),s.key==="Enter"&&a(!o)},children:e})}),d.jsx(lr,{side:r,className:n?"":"hidden",children:d.jsx("span",{className:"inline-block",children:n})})]})})},B3=(t,e)=>{const[n,r]=M.useState(t);return M.useEffect(()=>{const o=setTimeout(()=>{r(t)},e);return()=>{clearTimeout(o)}},[t,e]),n},z3=({apiBaseUrl:t="http://localhost:3000"})=>{var D,H;const[e,n]=M.useState([]),[r,o]=M.useState(!1),[a,s]=M.useState([]),[l,u]=M.useState(1),[h,p]=M.useState(1),[g,w]=M.useState(null),[y,x]=M.useState(""),v=B3(y,500),b=K=>{const ee=K.match(/\d{6}/);if(!ee)return{month:"",year:""};const W=ee[0],de=W.substring(0,2),se=W.substring(2);return{month:de,year:se}},E=K=>K.map(W=>{let de=(W==null?void 0:W.month)||"",se=(W==null?void 0:W.year)||"";if((!de||!se)&&(W!=null&&W.file_name)){const fe=b(W.file_name);de=de||fe.month,se=se||fe.year}return{id:W==null?void 0:W.id,prefix:(W==null?void 0:W.prefix)||"",model:(W==null?void 0:W.model)||"",fileName:(W==null?void 0:W.file_name)||"",code:(W==null?void 0:W.stock_id)||"",month:de,year:se,content:(W==null?void 0:W.text_summary)||"",status:(W==null?void 0:W.status)||"",note:(W==null?void 0:W.note)||"",lastUpdate:W==null?void 0:W.updated_at,stock_id:W==null?void 0:W.stock_id}}),T=K=>{if(!(K!=null&&K.data))return[];const ee=E(K==null?void 0:K.data);n(ee),p(K.pagination.totalPages)},N=async(K=1,ee=15)=>{w(K),o(!0);try{const W=await Le.get(`${t}/api/latest-summaries`,{params:{page:K,limit:ee,search:y}});(W==null?void 0:W.status)===200?T(W.data):console.error(W)}catch(W){console.error("Error fetching data:",W)}finally{w(null),o(!1)}};M.useEffect(()=>{v&&u(1),N(l)},[l,v]);const P=M.useMemo(()=>[{id:"code",header:"Mã",accessorKey:"code",cell:({row:ee})=>d.jsx("span",{className:"flex flex-col",children:ee.original.code})},{id:"month",header:"Tháng",accessorKey:"month",cell:({row:ee})=>{const W=ee.original.month,de=ee.original.year;return d.jsx("span",{className:"flex flex-col",children:`${W.toString().padStart(2,"0")}/${de}`})}},{id:"content",header:"Nội dung",accessorKey:"content",cell:({row:ee})=>{const W=ee.getValue("content");return d.jsx("div",{className:"text-start truncate text-ellipsis overflow-hidden whitespace-nowrap max-w-[30dvw]",children:W})}},{id:"status",header:"Trạng thái",accessorKey:"status",cell:({row:ee})=>{const de=ee.original.status!=="unpublish";return d.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0 text-[10px] font-bold ${de?"bg-green-50 text-green-700 ring-1 ring-inset ring-green-600/20":"bg-gray-50 text-gray-600 ring-1 ring-inset ring-gray-500/20"}`,children:de?"PUBLISHED":"UNPUBLISHED"})}},{id:"note",header:"Ghi chú",accessorKey:"note",cell:({row:ee})=>d.jsx(C0,{content:d.jsx("div",{className:"font-medium text-[16px] max-w-[90dvw]",children:ee.original.note}),children:d.jsx("div",{className:"text-start truncate text-ellipsis overflow-hidden whitespace-nowrap max-w-[20dvw]",children:ee.original.note})})},{id:"last-update",header:"Cập nhật",accessorKey:"last-update",cell:({row:ee})=>{const W=new Date(ee.original.lastUpdate),de=W.getDate(),se=W.getMonth()+1,fe=`ngày ${de} tháng ${se}`;return d.jsx("span",{className:"flex flex-col",children:fe})}},{accessorKey:"actions",header:()=>d.jsx("div",{className:"font-medium text-right",children:"Hành động"}),cell:({row:ee})=>{const[W,de]=M.useState(!1),[se,fe]=M.useState(!1),[q,Z]=M.useState(!1),{handleSubmit:Y,register:oe,reset:Q}=U3(),X=ee.original.id,$=ee.getValue("status"),te=ee.getValue("content"),[_e,ke]=M.useState(!1),xe=async()=>{try{ke(!0);const Te=$==="unpublish"?"published":"unpublish",z=await Le.patch(`${t}/api/toggle-publish/${X}`,{id:X,typeAction:"update",status:$,idInput:X,stock_id:ee.original.stock_id,prefix:ee.original.prefix,model:ee.original.model,summary_result:ee.original.content,note:ee.original.note});z.status===200?n(ce=>ce.map(Ae=>Ae.id===X?{...Ae,status:Te}:Ae)):console.error("Failed to toggle publish status:",z)}catch(Te){console.error("Error toggling publish status:",Te)}finally{ke(!1)}},Pe=async Te=>{de(!0);try{const z=await Le.patch(`${t}/api/update-summary`,{note:Te.note,text_summary:Te.content,id:X});z.status===200?(await N(l),fe(!1)):console.error("Failed to update summary:",z)}catch(z){console.error("Error updating summary:",z)}return de(!1)};return d.jsxs("div",{className:"flex items-center justify-end gap-2",children:[d.jsx(He,{variant:"outline",size:"sm",onClick:()=>Z(!0),className:"px-2 py-0.5 h-7",children:d.jsx(Ux,{className:"h-4 w-4"})}),d.jsx(ar,{open:q,onOpenChange:Z,children:d.jsxs(zn,{className:"max-w-3xl max-h-[80vh]",children:[d.jsx(Vn,{children:d.jsx(Kn,{children:"Nội dung chi tiết"})}),d.jsx("div",{className:"mt-4 overflow-y-auto max-h-[60vh]",children:d.jsx("div",{className:"whitespace-pre-wrap text-[16px] leading-relaxed",children:te})})]})}),d.jsxs(ar,{open:se,onOpenChange:Te=>{fe(Te),Te?Q({content:ee.original.content,note:ee.original.note}):Q()},children:[d.jsx(uc,{asChild:!0,children:d.jsx(He,{variant:"outline",size:"sm",onClick:()=>fe(!0),className:"px-2 py-0.5 h-7",children:"Sửa"})}),d.jsx(zn,{className:"rounded-lg sm:px-3 h-[calc(100dvh-200px)] min-w-[calc(100dvw-112px)]",children:d.jsxs(Vn,{className:"flex flex-col gap-3",children:[d.jsx(Kn,{className:"max-sm:hidden text-center",children:"Sửa summary"}),d.jsxs("form",{className:"flex flex-col gap-3 h-full justify-between",onSubmit:Y(Pe),children:[d.jsxs("div",{className:"flex flex-col gap-2",children:[d.jsxs("div",{className:"flex flex-col items-start",children:[d.jsx("span",{children:"Nội dung:"}),d.jsx(hc,{placeholder:"Nội dung",className:"w-full input-scroll-bar",defaultValue:ee.original.answer||"",rows:10,...oe("content")})]}),d.jsxs("div",{className:"flex flex-col items-start",children:[d.jsx("span",{children:"Ghi chú:"}),d.jsx(hc,{placeholder:"Nội dung",className:"w-full input-scroll-bar",defaultValue:ee.original.note||"",rows:1,...oe("note")})]})]}),d.jsx("div",{className:"flex justify-end",children:d.jsx(He,{disabled:W,type:"submit",variant:"default",children:W?d.jsx(kt,{className:"h-4 w-4 animate-spin"}):"Ok"})})]})]})})]}),d.jsx(He,{variant:"outline",size:"sm",onClick:xe,disabled:_e,className:"w-[70px] px-2 py-0.5 h-7",children:_e?d.jsx(kt,{className:"h-4 w-4 animate-spin"}):$==="unpublish"?"Publish":"Unpublish"})]})}}],[]),_=jb({data:e,columns:P,state:{columnFilters:a},enableRowSelection:!0,onColumnFiltersChange:s,getFilteredRowModel:WM(),getCoreRowModel:Gb()});return d.jsxs("div",{className:"space-y-4 s3-explr-container",children:[d.jsx("div",{className:"flex items-center space-x-4 s3-explr-toolbar",children:d.jsxs("div",{className:"relative max-w-sm",children:[d.jsx(Gn,{placeholder:"Tìm kiếm theo mã...",value:y,onChange:K=>x(K.target.value),className:"pr-8"}),y&&d.jsx(He,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6 p-0",onClick:()=>x(""),children:d.jsx(lg,{className:"h-4 w-4"})})]})}),d.jsx("div",{className:"rounded-md border s3-explr-table-container",children:d.jsxs(eu,{className:"s3-explr-table",children:[d.jsx(tu,{className:"s3-explr-table-header",children:_.getHeaderGroups().map(K=>d.jsx(Hr,{className:"hover:bg-transparent s3-explr-header-row",children:K.headers.map(ee=>d.jsx(po,{className:"s3-explr-header-cell",children:ee.isPlaceholder?null:Ad(ee.column.columnDef.header,ee.getContext())},ee.id))},K.id))}),d.jsx(nu,{className:"s3-explr-table-body",children:r?d.jsx(Hr,{children:d.jsx(jn,{colSpan:P.length,className:"h-24 text-center",children:"Đang tải dữ liệu..."})}):(D=_.getRowModel().rows)!=null&&D.length?(H=_.getRowModel().rows)==null?void 0:H.map(K=>d.jsx(Hr,{className:"h-12 s3-explr-row",children:K.getVisibleCells().map(ee=>d.jsx(jn,{className:"align-middle s3-explr-cell",children:Ad(ee.column.columnDef.cell,ee.getContext())},ee.id))},K.id)):d.jsx(Hr,{children:d.jsx(jn,{colSpan:P.length,className:"h-24 text-center",children:"Không có kết quả."})})})]})}),d.jsx("div",{className:"mt-4",children:d.jsx(Yd,{children:d.jsxs(Jd,{children:[d.jsx($r,{children:d.jsx(Qd,{onClick:()=>u(K=>Math.max(1,K-1)),className:l===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:h},(K,ee)=>ee+1).filter(K=>K===1||K===h||Math.abs(K-l)<=1).map((K,ee,W)=>d.jsxs(d.Fragment,{children:[ee>0&&W[ee-1]!==K-1&&d.jsx($r,{children:d.jsx(Zd,{})},K+"..."),d.jsx($r,{children:d.jsx(Xa,{onClick:()=>u(K),isActive:l===K,className:`cursor-pointer ${r?"pointer-events-none":""}`,children:g===K?d.jsx(kt,{className:"h-4 w-4 animate-spin"}):K})},K)]})),d.jsx($r,{children:d.jsx(Xd,{onClick:()=>u(K=>Math.min(h,K+1)),className:l===h||g!==null?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]})},b0=10,V3=M.memo(({apiBaseUrl:t="http://localhost:3000"})=>{const[e,n]=M.useState(1),[r,o]=M.useState([]),[a,s]=M.useState({total:0,page:1,limit:b0,totalPages:1}),[l,u]=M.useState(!0),[h,p]=M.useState(null),[g,w]=M.useState(new Set),{toast:y}=mc(),[x,v]=M.useState(!1),b=async _=>{try{p(_);const D=await Le.get(`${t}/api/jobs`,{params:{page:_.toString(),limit:b0.toString()}});o(D.data.data),s(D.data.pagination)}catch{y({variant:"destructive",title:"Error",description:"Failed to fetch jobs. Please try again."})}finally{p(null),u(!1)}};M.useEffect(()=>{b(e)},[e,t]);const E=async _=>{w(D=>new Set(D).add(_.toString()));try{await Le.post(`${t}/api/retry-job`,{jobId:_}),y({title:"Job Restarted",description:`Job ${_} has been successfully restarted.`}),b(e)}catch{y({variant:"destructive",title:"Retry Failed",description:`Failed to restart job ${_}. Please try again.`})}finally{w(D=>{const H=new Set(D);return H.delete(_.toString()),H})}},T=async()=>{v(!0),n(1),await b(1),v(!1)},N=_=>new Date(_).toLocaleString(),P=_=>{if(_=parseFloat(_),_<60)return`${_.toFixed(2)}s`;const D=Math.floor(_/60),H=(_%60).toFixed(0);return`${D}m ${H}s`};return d.jsxs("div",{children:[d.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[d.jsx(HD,{className:"w-8 h-8 text-primary"}),d.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Job Management"}),d.jsx(He,{variant:"outline",size:"icon",onClick:T,disabled:x||l,className:"ml-2",children:d.jsx(jD,{className:`h-4 w-4 ${x?"animate-spin":""}`})})]}),d.jsx("div",{className:"rounded-md border",children:d.jsxs(eu,{children:[d.jsx(tu,{children:d.jsxs(Hr,{children:[d.jsx(po,{children:"ID"}),d.jsx(po,{children:"Tên Công Việc"}),d.jsx(po,{children:"Thời Gian Bắt Đầu"}),d.jsx(po,{children:"Thời Gian Cập Nhật"}),d.jsx(po,{children:"Thời Gian Thực Thi"}),d.jsx(po,{children:"Trạng Thái"}),d.jsx(po,{children:"Thao Tác"})]})}),d.jsx(nu,{children:l&&r.length===0?d.jsx(Hr,{children:d.jsx(jn,{colSpan:7,className:"text-center py-4",children:d.jsx(kt,{className:"w-6 h-6 animate-spin mx-auto"})})}):r.map(_=>{var D,H;return d.jsxs(Hr,{children:[d.jsx(jn,{className:"!w-[100px]",children:_.id}),d.jsx(jn,{className:"font-medium",children:(D=_.job_name)==null?void 0:D.replace("Upload file","Summary")}),d.jsx(jn,{className:"!w-[200px]",children:N(_.created_at)}),d.jsx(jn,{className:"!w-[200px]",children:N(_.updated_at)}),d.jsx(jn,{className:"!w-[150px]",children:P(_.execution_time_seconds)}),d.jsx(jn,{className:"!w-[200px]",children:d.jsx(C0,{content:_.status==="fail"&&_.error?d.jsx("div",{className:"font-medium text-[16px] max-w-[90dvw]",children:_.error}):null,children:d.jsx("div",{className:`inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium truncate text-ellipsis overflow-hidden whitespace-nowrap max-w-[30dvw]
229
229
  ${_.status==="done"?"bg-green-100 text-green-800":_.status==="fail"?"bg-red-100 text-red-800":"bg-yellow-100 text-yellow-800"}`,children:_.status==="fail"?"FAILED":(H=_.status)==null?void 0:H.toUpperCase()})})}),d.jsx(jn,{className:"!w-[200px]",children:_.status==="fail"?d.jsx(He,{variant:"outline",size:"sm",onClick:()=>E(_.id),disabled:g.has(_.id.toString()),className:"h-[32px]",children:g.has(_.id.toString())?d.jsxs(d.Fragment,{children:[d.jsx(kt,{className:"mr-2 h-4 w-4 animate-spin"}),"Đang thử lại..."]}):"Thử Lại"}):d.jsx("div",{className:"h-[32px]"})})]},_.id)})})]})}),d.jsx("div",{className:"mt-4",children:d.jsx(Yd,{children:d.jsxs(Jd,{children:[d.jsx($r,{children:d.jsx(Qd,{onClick:()=>n(_=>Math.max(1,_-1)),className:e===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:a.totalPages},(_,D)=>D+1).filter(_=>_===1||_===a.totalPages||Math.abs(_-e)<=1).map((_,D,H)=>d.jsxs(d.Fragment,{children:[D>0&&H[D-1]!==_-1&&d.jsx($r,{children:d.jsx(Zd,{})},_+"..."),d.jsx($r,{children:d.jsx(Xa,{onClick:()=>n(_),isActive:e===_,className:`cursor-pointer ${h!==null?"pointer-events-none":""}`,children:h===_?d.jsx(kt,{className:"h-4 w-4 animate-spin"}):_})},_)]})),d.jsx($r,{children:d.jsx(Xd,{onClick:()=>n(_=>Math.min(a.totalPages,_+1)),className:e===a.totalPages||h!==null?"pointer-events-none opacity-50":"cursor-pointer"})})]})})}),d.jsx(l_,{})]})});Ar.Job=V3,Ar.S3Explorer=y3,Ar.Summary=z3,Object.defineProperty(Ar,Symbol.toStringTag,{value:"Module"})});
230
230
  //# sourceMappingURL=s3-explorer.umd.cjs.map