dccxx-s3-explorer 1.0.30 → 1.0.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/s3-explorer.umd.cjs
CHANGED
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
*
|
|
100
100
|
* This source code is licensed under the ISC license.
|
|
101
101
|
* See the LICENSE file in the root directory of this source tree.
|
|
102
|
-
*/const Uo=Xe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),lg={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"},cg=e=>e==="SummaryOfSuggestedAI"||e==="KeywordAISuggestion"||e==="SuggestedAICategories",jo=e=>e==="fullPath"||e==="createAt"||e==="creator"||e==="creatorId"||e==="DataSource"||e==="AccessLevel"||e==="category"||e==="fileName",ug=(e,t)=>{if(e.length>30)return t({title:"Lỗi tải lên",description:"Bạn chỉ có thể tải lên tối đa 30 tệp.",variant:"destructive"}),!0;for(let o=0;o<e.length;o++){const s=e[o];if(s&&s.size>20971520)return t({title:"Lỗi tải lên",description:`Tệp ${s.name} vượt quá giới hạn kích thước 20MB.`,variant:"destructive"}),!0}return!1};function Ta(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function dg(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Ta(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Ta(e[o],null)}}}}var Qt=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(fg);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return l.jsx(Wo,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return l.jsx(Wo,{...r,ref:t,children:n})});Qt.displayName="Slot";var Wo=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=gg(n);return d.cloneElement(n,{...pg(r,n.props),ref:t?dg(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});Wo.displayName="SlotClone";var Pa=({children:e})=>l.jsx(l.Fragment,{children:e});function fg(e){return d.isValidElement(e)&&e.type===Pa}function pg(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function gg(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Aa(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Aa(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function _a(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Aa(e))&&(r&&(r+=" "),r+=t);return r}const Go="-",hg=e=>{const t=vg(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(Go);return a[0]===""&&a.length!==1&&a.shift(),Fa(a,t)||mg(i)},getConflictingClassGroupIds:(i,a)=>{const u=n[i]||[];return a&&r[i]?[...u,...r[i]]:u}}},Fa=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?Fa(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(Go);return(i=t.validators.find(({validator:a})=>a(s)))==null?void 0:i.classGroupId},Oa=/^\[(.+)\]$/,mg=e=>{if(Oa.test(e)){const t=Oa.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},vg=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return wg(Object.entries(e.classGroups),n).forEach(([s,i])=>{qo(i,r,s,t)}),r},qo=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Da(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(yg(o)){qo(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{qo(i,Da(t,s),n,r)})})},Da=(e,t)=>{let n=e;return t.split(Go).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},yg=e=>e.isThemeGetter,wg=(e,t)=>t?e.map(([n,r])=>{const o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([i,a])=>[t+i,a])):s);return[n,o]}):e,bg=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},Ma="!",xg=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length,i=a=>{const u=[];let c=0,f=0,p;for(let y=0;y<a.length;y++){let w=a[y];if(c===0){if(w===o&&(r||a.slice(y,y+s)===t)){u.push(a.slice(f,y)),f=y+s;continue}if(w==="/"){p=y;continue}}w==="["?c++:w==="]"&&c--}const m=u.length===0?a:a.substring(f),g=m.startsWith(Ma),v=g?m.substring(1):m,h=p&&p>f?p-f:void 0;return{modifiers:u,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:h}};return n?a=>n({className:a,parseClassName:i}):i},Cg=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Sg=e=>({cache:bg(e.cacheSize),parseClassName:xg(e),...hg(e)}),Eg=/\s+/,Ng=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=[],i=e.trim().split(Eg);let a="";for(let u=i.length-1;u>=0;u-=1){const c=i[u],{modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=n(c);let v=!!g,h=r(v?m.substring(0,g):m);if(!h){if(!v){a=c+(a.length>0?" "+a:a);continue}if(h=r(m),!h){a=c+(a.length>0?" "+a:a);continue}v=!1}const y=Cg(f).join(":"),w=p?y+Ma:y,b=w+h;if(s.includes(b))continue;s.push(b);const S=o(h,v);for(let E=0;E<S.length;++E){const x=S[E];s.push(w+x)}a=c+(a.length>0?" "+a:a)}return a};function Tg(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Ia(t))&&(r&&(r+=" "),r+=n);return r}const Ia=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Ia(e[r]))&&(n&&(n+=" "),n+=t);return n};function Pg(e,...t){let n,r,o,s=i;function i(u){const c=t.reduce((f,p)=>p(f),e());return n=Sg(c),r=n.cache.get,o=n.cache.set,s=a,a(u)}function a(u){const c=r(u);if(c)return c;const f=Ng(u,n);return o(u,f),f}return function(){return s(Tg.apply(null,arguments))}}const de=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},ka=/^\[(?:([a-z-]+):)?(.+)\]$/i,Ag=/^\d+\/\d+$/,_g=new Set(["px","full","screen"]),Fg=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Og=/\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$/,Dg=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Mg=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ig=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,mt=e=>en(e)||_g.has(e)||Ag.test(e),_t=e=>tn(e,"length",Hg),en=e=>!!e&&!Number.isNaN(Number(e)),Ko=e=>tn(e,"number",en),On=e=>!!e&&Number.isInteger(Number(e)),kg=e=>e.endsWith("%")&&en(e.slice(0,-1)),re=e=>ka.test(e),Ft=e=>Fg.test(e),$g=new Set(["length","size","percentage"]),Lg=e=>tn(e,$g,$a),Rg=e=>tn(e,"position",$a),Vg=new Set(["image","url"]),Bg=e=>tn(e,Vg,jg),zg=e=>tn(e,"",Ug),Dn=()=>!0,tn=(e,t,n)=>{const r=ka.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},Hg=e=>Og.test(e)&&!Dg.test(e),$a=()=>!1,Ug=e=>Mg.test(e),jg=e=>Ig.test(e),Wg=Pg(()=>{const e=de("colors"),t=de("spacing"),n=de("blur"),r=de("brightness"),o=de("borderColor"),s=de("borderRadius"),i=de("borderSpacing"),a=de("borderWidth"),u=de("contrast"),c=de("grayscale"),f=de("hueRotate"),p=de("invert"),m=de("gap"),g=de("gradientColorStops"),v=de("gradientColorStopPositions"),h=de("inset"),y=de("margin"),w=de("opacity"),b=de("padding"),S=de("saturate"),E=de("scale"),x=de("sepia"),P=de("skew"),F=de("space"),O=de("translate"),I=()=>["auto","contain","none"],D=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",re,t],k=()=>[re,t],z=()=>["",mt,_t],R=()=>["auto",en,re],J=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],B=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],Y=()=>["","0",re],le=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ue=()=>[en,re];return{cacheSize:500,separator:":",theme:{colors:[Dn],spacing:[mt,_t],blur:["none","",Ft,re],brightness:ue(),borderColor:[e],borderRadius:["none","","full",Ft,re],borderSpacing:k(),borderWidth:z(),contrast:ue(),grayscale:Y(),hueRotate:ue(),invert:Y(),gap:k(),gradientColorStops:[e],gradientColorStopPositions:[kg,_t],inset:q(),margin:q(),opacity:ue(),padding:k(),saturate:ue(),scale:ue(),sepia:Y(),skew:ue(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",re]}],container:["container"],columns:[{columns:[Ft]}],"break-after":[{"break-after":le()}],"break-before":[{"break-before":le()}],"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:[...J(),re]}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",On,re]}],basis:[{basis:q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",re]}],grow:[{grow:Y()}],shrink:[{shrink:Y()}],order:[{order:["first","last","none",On,re]}],"grid-cols":[{"grid-cols":[Dn]}],"col-start-end":[{col:["auto",{span:["full",On,re]},re]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[Dn]}],"row-start-end":[{row:["auto",{span:[On,re]},re]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",re]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",re]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[F]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[F]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",re,t]}],"min-w":[{"min-w":[re,t,"min","max","fit"]}],"max-w":[{"max-w":[re,t,"none","full","min","max","fit","prose",{screen:[Ft]},Ft]}],h:[{h:[re,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[re,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[re,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[re,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ft,_t]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ko]}],"font-family":[{font:[Dn]}],"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",re]}],"line-clamp":[{"line-clamp":["none",en,Ko]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",mt,re]}],"list-image":[{"list-image":["none",re]}],"list-style-type":[{list:["none","disc","decimal",re]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",mt,_t]}],"underline-offset":[{"underline-offset":["auto",mt,re]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",re]}],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",re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...J(),Rg]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Lg]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Bg]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...B(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:B()}],"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:["",...B()]}],"outline-offset":[{"outline-offset":[mt,re]}],"outline-w":[{outline:[mt,_t]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[mt,_t]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ft,zg]}],"shadow-color":[{shadow:[Dn]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...U(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Ft,re]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[p]}],saturate:[{saturate:[S]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",re]}],duration:[{duration:ue()}],ease:[{ease:["linear","in","out","in-out",re]}],delay:[{delay:ue()}],animate:[{animate:["none","spin","ping","pulse","bounce",re]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[On,re]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",re]}],accent:[{accent:["auto",e]}],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",re]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",re]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[mt,_t,Ko]}],stroke:[{stroke:[e,"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 ee(...e){return Wg(_a(e))}const Gg=e=>{if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB","TB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(2))} ${n[r]}`},La=d.forwardRef(({className:e,...t},n)=>l.jsx("nav",{ref:n,"aria-label":"breadcrumb",className:ee("s3-explr-ui-breadcrumb",e),...t}));La.displayName="Breadcrumb";const Ra=d.forwardRef(({className:e,...t},n)=>l.jsx("ol",{ref:n,className:ee("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5","s3-explr-ui-breadcrumb-list",e),...t}));Ra.displayName="BreadcrumbList";const Xo=d.forwardRef(({className:e,...t},n)=>l.jsx("li",{ref:n,className:ee("inline-flex items-center gap-1.5","s3-explr-ui-breadcrumb-item",e),...t}));Xo.displayName="BreadcrumbItem";const Jo=d.forwardRef(({asChild:e,className:t,...n},r)=>{const o=e?Qt:"a";return l.jsx(o,{ref:r,className:ee("transition-colors hover:text-foreground","s3-explr-ui-breadcrumb-link",t),...n})});Jo.displayName="BreadcrumbLink";const qg=d.forwardRef(({className:e,...t},n)=>l.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:ee("font-normal text-foreground","s3-explr-ui-breadcrumb-page",e),...t}));qg.displayName="BreadcrumbPage";const Va=({children:e,className:t,...n})=>l.jsx("li",{role:"presentation","aria-hidden":"true",className:ee("[&>svg]:w-3.5 [&>svg]:h-3.5","s3-explr-ui-breadcrumb-separator",t),...n,children:e??l.jsx(Na,{})});Va.displayName="BreadcrumbSeparator";const Ba=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,za=_a,Yo=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return za(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(c=>{const f=n==null?void 0:n[c],p=s==null?void 0:s[c];if(f===null)return null;const m=Ba(f)||Ba(p);return o[c][m]}),a=n&&Object.entries(n).reduce((c,f)=>{let[p,m]=f;return m===void 0||(c[p]=m),c},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,f)=>{let{class:p,className:m,...g}=f;return Object.entries(g).every(v=>{let[h,y]=v;return Array.isArray(y)?y.includes({...s,...a}[h]):{...s,...a}[h]===y})?[...c,p,m]:c},[]);return za(e,i,u,n==null?void 0:n.class,n==null?void 0:n.className)},Ha=Yo("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"}}),ie=d.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},s)=>{const i=r?Qt:"button";return l.jsx(i,{className:ee(Ha({variant:t,size:n,className:e})),ref:s,...o})});ie.displayName="Button";function Kg(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function gr(...e){return t=>e.forEach(n=>Kg(n,t))}function ze(...e){return d.useCallback(gr(...e),e)}function Xg(e,t){const n=d.createContext(t),r=s=>{const{children:i,...a}=s,u=d.useMemo(()=>a,Object.values(a));return l.jsx(n.Provider,{value:u,children:i})};r.displayName=e+"Provider";function o(s){const i=d.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function Ot(e,t=[]){let n=[];function r(s,i){const a=d.createContext(i),u=n.length;n=[...n,i];const c=p=>{var w;const{scope:m,children:g,...v}=p,h=((w=m==null?void 0:m[e])==null?void 0:w[u])||a,y=d.useMemo(()=>v,Object.values(v));return l.jsx(h.Provider,{value:y,children:g})};c.displayName=s+"Provider";function f(p,m){var h;const g=((h=m==null?void 0:m[e])==null?void 0:h[u])||a,v=d.useContext(g);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[c,f]}const o=()=>{const s=n.map(i=>d.createContext(i));return function(a){const u=(a==null?void 0:a[e])||s;return d.useMemo(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return o.scopeName=e,[r,Jg(o,...t)]}function Jg(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:u,scopeName:c})=>{const p=u(s)[`__scope${c}`];return{...a,...p}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function we(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Ae(e){const t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function nn({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=Yg({defaultProp:t,onChange:n}),s=e!==void 0,i=s?e:r,a=Ae(n),u=d.useCallback(c=>{if(s){const p=typeof c=="function"?c(e):c;p!==e&&a(p)}else o(c)},[s,e,o,a]);return[i,u]}function Yg({defaultProp:e,onChange:t}){const n=d.useState(e),[r]=n,o=d.useRef(r),s=Ae(t);return d.useEffect(()=>{o.current!==r&&(s(r),o.current=r)},[r,o,s]),n}function Zg(e){const t=d.useRef({value:e,previous:e});return d.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Re=globalThis!=null&&globalThis.document?d.useLayoutEffect:()=>{};function Ua(e){const[t,n]=d.useState(void 0);return Re(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const u=s.borderBoxSize,c=Array.isArray(u)?u[0]:u;i=c.inlineSize,a=c.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function Qg(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var rn=e=>{const{present:t,children:n}=e,r=eh(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=ze(r.ref,th(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};rn.displayName="Presence";function eh(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[a,u]=Qg(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const c=hr(r.current);s.current=a==="mounted"?c:"none"},[a]),Re(()=>{const c=r.current,f=o.current;if(f!==e){const m=s.current,g=hr(c);e?u("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?u("UNMOUNT"):u(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Re(()=>{if(t){let c;const f=t.ownerDocument.defaultView??window,p=g=>{const h=hr(r.current).includes(g.animationName);if(g.target===t&&h&&(u("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",c=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=g=>{g.target===t&&(s.current=hr(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(c),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:d.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function hr(e){return(e==null?void 0:e.animationName)||"none"}function th(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ja=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(rh);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return l.jsx(Zo,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return l.jsx(Zo,{...r,ref:t,children:n})});ja.displayName="Slot";var Zo=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=sh(n);return d.cloneElement(n,{...oh(r,n.props),ref:t?gr(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});Zo.displayName="SlotClone";var nh=({children:e})=>l.jsx(l.Fragment,{children:e});function rh(e){return d.isValidElement(e)&&e.type===nh}function oh(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function sh(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ih=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],be=ih.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?ja:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Wa(e,t){e&&Yn.flushSync(()=>e.dispatchEvent(t))}var Qo="Checkbox",[ah,uC]=Ot(Qo),[lh,ch]=ah(Qo),Ga=d.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:s,required:i,disabled:a,value:u="on",onCheckedChange:c,form:f,...p}=e,[m,g]=d.useState(null),v=ze(t,E=>g(E)),h=d.useRef(!1),y=m?f||!!m.closest("form"):!0,[w=!1,b]=nn({prop:o,defaultProp:s,onChange:c}),S=d.useRef(w);return d.useEffect(()=>{const E=m==null?void 0:m.form;if(E){const x=()=>b(S.current);return E.addEventListener("reset",x),()=>E.removeEventListener("reset",x)}},[m,b]),l.jsxs(lh,{scope:n,state:w,disabled:a,children:[l.jsx(be.button,{type:"button",role:"checkbox","aria-checked":Dt(w)?"mixed":w,"aria-required":i,"data-state":Xa(w),"data-disabled":a?"":void 0,disabled:a,value:u,...p,ref:v,onKeyDown:we(e.onKeyDown,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:we(e.onClick,E=>{b(x=>Dt(x)?!0:!x),y&&(h.current=E.isPropagationStopped(),h.current||E.stopPropagation())})}),y&&l.jsx(uh,{control:m,bubbles:!h.current,name:r,value:u,checked:w,required:i,disabled:a,form:f,style:{transform:"translateX(-100%)"},defaultChecked:Dt(s)?!1:s})]})});Ga.displayName=Qo;var qa="CheckboxIndicator",Ka=d.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,s=ch(qa,n);return l.jsx(rn,{present:r||Dt(s.state)||s.state===!0,children:l.jsx(be.span,{"data-state":Xa(s.state),"data-disabled":s.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Ka.displayName=qa;var uh=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...s}=e,i=d.useRef(null),a=Zg(n),u=Ua(t);d.useEffect(()=>{const f=i.current,p=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(p,"checked").set;if(a!==n&&g){const v=new Event("click",{bubbles:r});f.indeterminate=Dt(n),g.call(f,Dt(n)?!1:n),f.dispatchEvent(v)}},[a,n,r]);const c=d.useRef(Dt(n)?!1:n);return l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??c.current,...s,tabIndex:-1,ref:i,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Dt(e){return e==="indeterminate"}function Xa(e){return Dt(e)?"indeterminate":e?"checked":"unchecked"}var Ja=Ga,dh=Ka;const es=d.forwardRef(({className:e,...t},n)=>l.jsx(Ja,{ref:n,className:ee("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",e),...t,children:l.jsx(dh,{className:ee("s3-explr-ui-checkbox-indicator flex items-center justify-center text-current"),children:l.jsx(tg,{className:"s3-explr-ui-checkbox-check h-4 w-4"})})}));es.displayName=Ja.displayName;var fh=d.useId||(()=>{}),ph=0;function on(e){const[t,n]=d.useState(fh());return Re(()=>{e||n(r=>r??String(ph++))},[e]),e||(t?`radix-${t}`:"")}function Ya(e,t=globalThis==null?void 0:globalThis.document){const n=Ae(e);d.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var gh="DismissableLayer",ts="dismissableLayer.update",hh="dismissableLayer.pointerDownOutside",mh="dismissableLayer.focusOutside",Za,Qa=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ns=d.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...u}=e,c=d.useContext(Qa),[f,p]=d.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=d.useState({}),v=ze(t,F=>p(F)),h=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),w=h.indexOf(y),b=f?h.indexOf(f):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,E=b>=w,x=yh(F=>{const O=F.target,I=[...c.branches].some(D=>D.contains(O));!E||I||(o==null||o(F),i==null||i(F),F.defaultPrevented||a==null||a())},m),P=wh(F=>{const O=F.target;[...c.branches].some(D=>D.contains(O))||(s==null||s(F),i==null||i(F),F.defaultPrevented||a==null||a())},m);return Ya(F=>{b===c.layers.size-1&&(r==null||r(F),!F.defaultPrevented&&a&&(F.preventDefault(),a()))},m),d.useEffect(()=>{if(f)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Za=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(f)),c.layers.add(f),tl(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Za)}},[f,m,n,c]),d.useEffect(()=>()=>{f&&(c.layers.delete(f),c.layersWithOutsidePointerEventsDisabled.delete(f),tl())},[f,c]),d.useEffect(()=>{const F=()=>g({});return document.addEventListener(ts,F),()=>document.removeEventListener(ts,F)},[]),l.jsx(be.div,{...u,ref:v,style:{pointerEvents:S?E?"auto":"none":void 0,...e.style},onFocusCapture:we(e.onFocusCapture,P.onFocusCapture),onBlurCapture:we(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:we(e.onPointerDownCapture,x.onPointerDownCapture)})});ns.displayName=gh;var vh="DismissableLayerBranch",el=d.forwardRef((e,t)=>{const n=d.useContext(Qa),r=d.useRef(null),o=ze(t,r);return d.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),l.jsx(be.div,{...e,ref:o})});el.displayName=vh;function yh(e,t=globalThis==null?void 0:globalThis.document){const n=Ae(e),r=d.useRef(!1),o=d.useRef(()=>{});return d.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let u=function(){nl(hh,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=u,t.addEventListener("click",o.current,{once:!0})):u()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function wh(e,t=globalThis==null?void 0:globalThis.document){const n=Ae(e),r=d.useRef(!1);return d.useEffect(()=>{const o=s=>{s.target&&!r.current&&nl(mh,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function tl(){const e=new CustomEvent(ts);document.dispatchEvent(e)}function nl(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Wa(o,s):o.dispatchEvent(s)}var bh=ns,xh=el,rs="focusScope.autoFocusOnMount",os="focusScope.autoFocusOnUnmount",rl={bubbles:!1,cancelable:!0},Ch="FocusScope",ol=d.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,u]=d.useState(null),c=Ae(o),f=Ae(s),p=d.useRef(null),m=ze(t,h=>u(h)),g=d.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;d.useEffect(()=>{if(r){let h=function(S){if(g.paused||!a)return;const E=S.target;a.contains(E)?p.current=E:Mt(p.current,{select:!0})},y=function(S){if(g.paused||!a)return;const E=S.relatedTarget;E!==null&&(a.contains(E)||Mt(p.current,{select:!0}))},w=function(S){if(document.activeElement===document.body)for(const x of S)x.removedNodes.length>0&&Mt(a)};document.addEventListener("focusin",h),document.addEventListener("focusout",y);const b=new MutationObserver(w);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",y),b.disconnect()}}},[r,a,g.paused]),d.useEffect(()=>{if(a){al.add(g);const h=document.activeElement;if(!a.contains(h)){const w=new CustomEvent(rs,rl);a.addEventListener(rs,c),a.dispatchEvent(w),w.defaultPrevented||(Sh(Ah(sl(a)),{select:!0}),document.activeElement===h&&Mt(a))}return()=>{a.removeEventListener(rs,c),setTimeout(()=>{const w=new CustomEvent(os,rl);a.addEventListener(os,f),a.dispatchEvent(w),w.defaultPrevented||Mt(h??document.body,{select:!0}),a.removeEventListener(os,f),al.remove(g)},0)}}},[a,c,f,g]);const v=d.useCallback(h=>{if(!n&&!r||g.paused)return;const y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,w=document.activeElement;if(y&&w){const b=h.currentTarget,[S,E]=Eh(b);S&&E?!h.shiftKey&&w===E?(h.preventDefault(),n&&Mt(S,{select:!0})):h.shiftKey&&w===S&&(h.preventDefault(),n&&Mt(E,{select:!0})):w===b&&h.preventDefault()}},[n,r,g.paused]);return l.jsx(be.div,{tabIndex:-1,...i,ref:m,onKeyDown:v})});ol.displayName=Ch;function Sh(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Mt(r,{select:t}),document.activeElement!==n)return}function Eh(e){const t=sl(e),n=il(t,e),r=il(t.reverse(),e);return[n,r]}function sl(e){const t=[],n=document.createTreeWalker(e,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();)t.push(n.currentNode);return t}function il(e,t){for(const n of e)if(!Nh(n,{upTo:t}))return n}function Nh(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Th(e){return e instanceof HTMLInputElement&&"select"in e}function Mt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Th(e)&&t&&e.select()}}var al=Ph();function Ph(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ll(e,t),e.unshift(t)},remove(t){var n;e=ll(e,t),(n=e[0])==null||n.resume()}}}function ll(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Ah(e){return e.filter(t=>t.tagName!=="A")}var _h="Portal",ss=d.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=d.useState(!1);Re(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?uo.createPortal(l.jsx(be.div,{...r,ref:t}),i):null});ss.displayName=_h;var is=0;function Fh(){d.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??cl()),document.body.insertAdjacentElement("beforeend",e[1]??cl()),is++,()=>{is===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),is--}},[])}function cl(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ot=function(){return ot=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},ot.apply(this,arguments)};function ul(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function dl(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{for(;(t===void 0||t-- >0)&&!(o=r.next()).done;)s.push(o.value)}catch(a){i={error:a}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function fl(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var mr="right-scroll-bar-position",vr="width-before-scroll-bar",Oh="with-scroll-bars-hidden",Dh="--removed-body-scroll-bar-size";function as(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Mh(e,t){var n=A.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Ih=typeof window<"u"?d.useLayoutEffect:d.useEffect,pl=new WeakMap;function kh(e,t){var n=Mh(null,function(r){return e.forEach(function(o){return as(o,r)})});return Ih(function(){var r=pl.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||as(a,null)}),s.forEach(function(a){o.has(a)||as(a,i)})}pl.set(n,e)},[e]),n}function $h(e){return e}function Lh(e,t){t===void 0&&(t=$h);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(s),i=n}var u=function(){var f=i;i=[],f.forEach(s)},c=function(){return Promise.resolve().then(u)};c(),n={push:function(f){i.push(f),c()},filter:function(f){return i=i.filter(f),n}}}};return o}function Rh(e){e===void 0&&(e={});var t=Lh(null);return t.options=ot({async:!0,ssr:!1},e),t}var gl=function(e){var t=e.sideCar,n=ul(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return d.createElement(r,ot({},n))};gl.isSideCarExport=!0;function Vh(e,t){return e.useMedium(t),gl}var hl=Rh(),ls=function(){},yr=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:ls,onWheelCapture:ls,onTouchMoveCapture:ls}),o=r[0],s=r[1],i=e.forwardProps,a=e.children,u=e.className,c=e.removeScrollBar,f=e.enabled,p=e.shards,m=e.sideCar,g=e.noIsolation,v=e.inert,h=e.allowPinchZoom,y=e.as,w=y===void 0?"div":y,b=e.gapMode,S=ul(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=m,x=kh([n,t]),P=ot(ot({},S),o);return d.createElement(d.Fragment,null,f&&d.createElement(E,{sideCar:hl,removeScrollBar:c,shards:p,noIsolation:g,inert:v,setCallbacks:s,allowPinchZoom:!!h,lockRef:n,gapMode:b}),i?d.cloneElement(d.Children.only(a),ot(ot({},P),{ref:x})):d.createElement(w,ot({},P,{className:u,ref:x}),a))});yr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},yr.classNames={fullWidth:vr,zeroRight:mr};var Bh=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function zh(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Bh();return t&&e.setAttribute("nonce",t),e}function Hh(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Uh(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var jh=function(){var e=0,t=null;return{add:function(n){e==0&&(t=zh())&&(Hh(t,n),Uh(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Wh=function(){var e=jh();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ml=function(){var e=Wh(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Gh={left:0,top:0,right:0,gap:0},cs=function(e){return parseInt(e||"",10)||0},qh=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[cs(n),cs(r),cs(o)]},Kh=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Gh;var t=qh(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Xh=ml(),sn="data-scroll-locked",Jh=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
102
|
+
*/const Uo=Xe("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),lg={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"},cg=e=>e==="SummaryOfSuggestedAI"||e==="KeywordAISuggestion"||e==="SuggestedAICategories",jo=e=>e==="fullPath"||e==="createAt"||e==="creator"||e==="creatorId"||e==="DataSource"||e==="AccessLevel"||e==="category"||e==="fileName",ug=(e,t)=>{if(e.length>30)return t({title:"Lỗi tải lên",description:"Bạn chỉ có thể tải lên tối đa 30 tệp.",variant:"destructive"}),!0;for(let o=0;o<e.length;o++){const s=e[o];if(s&&s.size>20971520)return t({title:"Lỗi tải lên",description:`Tệp ${s.name} vượt quá giới hạn kích thước 20MB.`,variant:"destructive"}),!0}return!1};function Ta(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function dg(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Ta(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Ta(e[o],null)}}}}var Qt=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(fg);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return l.jsx(Wo,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return l.jsx(Wo,{...r,ref:t,children:n})});Qt.displayName="Slot";var Wo=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=gg(n);return d.cloneElement(n,{...pg(r,n.props),ref:t?dg(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});Wo.displayName="SlotClone";var Pa=({children:e})=>l.jsx(l.Fragment,{children:e});function fg(e){return d.isValidElement(e)&&e.type===Pa}function pg(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function gg(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Aa(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Aa(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function _a(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Aa(e))&&(r&&(r+=" "),r+=t);return r}const Go="-",hg=e=>{const t=vg(e),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=e;return{getClassGroupId:i=>{const a=i.split(Go);return a[0]===""&&a.length!==1&&a.shift(),Fa(a,t)||mg(i)},getConflictingClassGroupIds:(i,a)=>{const u=n[i]||[];return a&&r[i]?[...u,...r[i]]:u}}},Fa=(e,t)=>{var i;if(e.length===0)return t.classGroupId;const n=e[0],r=t.nextPart.get(n),o=r?Fa(e.slice(1),r):void 0;if(o)return o;if(t.validators.length===0)return;const s=e.join(Go);return(i=t.validators.find(({validator:a})=>a(s)))==null?void 0:i.classGroupId},Oa=/^\[(.+)\]$/,mg=e=>{if(Oa.test(e)){const t=Oa.exec(e)[1],n=t==null?void 0:t.substring(0,t.indexOf(":"));if(n)return"arbitrary.."+n}},vg=e=>{const{theme:t,prefix:n}=e,r={nextPart:new Map,validators:[]};return wg(Object.entries(e.classGroups),n).forEach(([s,i])=>{qo(i,r,s,t)}),r},qo=(e,t,n,r)=>{e.forEach(o=>{if(typeof o=="string"){const s=o===""?t:Da(t,o);s.classGroupId=n;return}if(typeof o=="function"){if(yg(o)){qo(o(r),t,n,r);return}t.validators.push({validator:o,classGroupId:n});return}Object.entries(o).forEach(([s,i])=>{qo(i,Da(t,s),n,r)})})},Da=(e,t)=>{let n=e;return t.split(Go).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},yg=e=>e.isThemeGetter,wg=(e,t)=>t?e.map(([n,r])=>{const o=r.map(s=>typeof s=="string"?t+s:typeof s=="object"?Object.fromEntries(Object.entries(s).map(([i,a])=>[t+i,a])):s);return[n,o]}):e,bg=e=>{if(e<1)return{get:()=>{},set:()=>{}};let t=0,n=new Map,r=new Map;const o=(s,i)=>{n.set(s,i),t++,t>e&&(t=0,r=n,n=new Map)};return{get(s){let i=n.get(s);if(i!==void 0)return i;if((i=r.get(s))!==void 0)return o(s,i),i},set(s,i){n.has(s)?n.set(s,i):o(s,i)}}},Ma="!",xg=e=>{const{separator:t,experimentalParseClassName:n}=e,r=t.length===1,o=t[0],s=t.length,i=a=>{const u=[];let c=0,f=0,p;for(let y=0;y<a.length;y++){let w=a[y];if(c===0){if(w===o&&(r||a.slice(y,y+s)===t)){u.push(a.slice(f,y)),f=y+s;continue}if(w==="/"){p=y;continue}}w==="["?c++:w==="]"&&c--}const m=u.length===0?a:a.substring(f),g=m.startsWith(Ma),v=g?m.substring(1):m,h=p&&p>f?p-f:void 0;return{modifiers:u,hasImportantModifier:g,baseClassName:v,maybePostfixModifierPosition:h}};return n?a=>n({className:a,parseClassName:i}):i},Cg=e=>{if(e.length<=1)return e;const t=[];let n=[];return e.forEach(r=>{r[0]==="["?(t.push(...n.sort(),r),n=[]):n.push(r)}),t.push(...n.sort()),t},Sg=e=>({cache:bg(e.cacheSize),parseClassName:xg(e),...hg(e)}),Eg=/\s+/,Ng=(e,t)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:o}=t,s=[],i=e.trim().split(Eg);let a="";for(let u=i.length-1;u>=0;u-=1){const c=i[u],{modifiers:f,hasImportantModifier:p,baseClassName:m,maybePostfixModifierPosition:g}=n(c);let v=!!g,h=r(v?m.substring(0,g):m);if(!h){if(!v){a=c+(a.length>0?" "+a:a);continue}if(h=r(m),!h){a=c+(a.length>0?" "+a:a);continue}v=!1}const y=Cg(f).join(":"),w=p?y+Ma:y,b=w+h;if(s.includes(b))continue;s.push(b);const S=o(h,v);for(let E=0;E<S.length;++E){const x=S[E];s.push(w+x)}a=c+(a.length>0?" "+a:a)}return a};function Tg(){let e=0,t,n,r="";for(;e<arguments.length;)(t=arguments[e++])&&(n=Ia(t))&&(r&&(r+=" "),r+=n);return r}const Ia=e=>{if(typeof e=="string")return e;let t,n="";for(let r=0;r<e.length;r++)e[r]&&(t=Ia(e[r]))&&(n&&(n+=" "),n+=t);return n};function Pg(e,...t){let n,r,o,s=i;function i(u){const c=t.reduce((f,p)=>p(f),e());return n=Sg(c),r=n.cache.get,o=n.cache.set,s=a,a(u)}function a(u){const c=r(u);if(c)return c;const f=Ng(u,n);return o(u,f),f}return function(){return s(Tg.apply(null,arguments))}}const de=e=>{const t=n=>n[e]||[];return t.isThemeGetter=!0,t},ka=/^\[(?:([a-z-]+):)?(.+)\]$/i,Ag=/^\d+\/\d+$/,_g=new Set(["px","full","screen"]),Fg=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Og=/\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$/,Dg=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,Mg=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Ig=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,mt=e=>en(e)||_g.has(e)||Ag.test(e),_t=e=>tn(e,"length",Hg),en=e=>!!e&&!Number.isNaN(Number(e)),Ko=e=>tn(e,"number",en),On=e=>!!e&&Number.isInteger(Number(e)),kg=e=>e.endsWith("%")&&en(e.slice(0,-1)),re=e=>ka.test(e),Ft=e=>Fg.test(e),$g=new Set(["length","size","percentage"]),Lg=e=>tn(e,$g,$a),Rg=e=>tn(e,"position",$a),Vg=new Set(["image","url"]),Bg=e=>tn(e,Vg,jg),zg=e=>tn(e,"",Ug),Dn=()=>!0,tn=(e,t,n)=>{const r=ka.exec(e);return r?r[1]?typeof t=="string"?r[1]===t:t.has(r[1]):n(r[2]):!1},Hg=e=>Og.test(e)&&!Dg.test(e),$a=()=>!1,Ug=e=>Mg.test(e),jg=e=>Ig.test(e),Wg=Pg(()=>{const e=de("colors"),t=de("spacing"),n=de("blur"),r=de("brightness"),o=de("borderColor"),s=de("borderRadius"),i=de("borderSpacing"),a=de("borderWidth"),u=de("contrast"),c=de("grayscale"),f=de("hueRotate"),p=de("invert"),m=de("gap"),g=de("gradientColorStops"),v=de("gradientColorStopPositions"),h=de("inset"),y=de("margin"),w=de("opacity"),b=de("padding"),S=de("saturate"),E=de("scale"),x=de("sepia"),P=de("skew"),F=de("space"),O=de("translate"),I=()=>["auto","contain","none"],D=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",re,t],k=()=>[re,t],z=()=>["",mt,_t],R=()=>["auto",en,re],J=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],B=()=>["solid","dashed","dotted","double","none"],U=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],K=()=>["start","end","center","between","around","evenly","stretch"],Y=()=>["","0",re],le=()=>["auto","avoid","all","avoid-page","page","left","right","column"],ue=()=>[en,re];return{cacheSize:500,separator:":",theme:{colors:[Dn],spacing:[mt,_t],blur:["none","",Ft,re],brightness:ue(),borderColor:[e],borderRadius:["none","","full",Ft,re],borderSpacing:k(),borderWidth:z(),contrast:ue(),grayscale:Y(),hueRotate:ue(),invert:Y(),gap:k(),gradientColorStops:[e],gradientColorStopPositions:[kg,_t],inset:q(),margin:q(),opacity:ue(),padding:k(),saturate:ue(),scale:ue(),sepia:Y(),skew:ue(),space:k(),translate:k()},classGroups:{aspect:[{aspect:["auto","square","video",re]}],container:["container"],columns:[{columns:[Ft]}],"break-after":[{"break-after":le()}],"break-before":[{"break-before":le()}],"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:[...J(),re]}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:I()}],"overscroll-x":[{"overscroll-x":I()}],"overscroll-y":[{"overscroll-y":I()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[h]}],"inset-x":[{"inset-x":[h]}],"inset-y":[{"inset-y":[h]}],start:[{start:[h]}],end:[{end:[h]}],top:[{top:[h]}],right:[{right:[h]}],bottom:[{bottom:[h]}],left:[{left:[h]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",On,re]}],basis:[{basis:q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",re]}],grow:[{grow:Y()}],shrink:[{shrink:Y()}],order:[{order:["first","last","none",On,re]}],"grid-cols":[{"grid-cols":[Dn]}],"col-start-end":[{col:["auto",{span:["full",On,re]},re]}],"col-start":[{"col-start":R()}],"col-end":[{"col-end":R()}],"grid-rows":[{"grid-rows":[Dn]}],"row-start-end":[{row:["auto",{span:[On,re]},re]}],"row-start":[{"row-start":R()}],"row-end":[{"row-end":R()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",re]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",re]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...K()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...K(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...K(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[b]}],px:[{px:[b]}],py:[{py:[b]}],ps:[{ps:[b]}],pe:[{pe:[b]}],pt:[{pt:[b]}],pr:[{pr:[b]}],pb:[{pb:[b]}],pl:[{pl:[b]}],m:[{m:[y]}],mx:[{mx:[y]}],my:[{my:[y]}],ms:[{ms:[y]}],me:[{me:[y]}],mt:[{mt:[y]}],mr:[{mr:[y]}],mb:[{mb:[y]}],ml:[{ml:[y]}],"space-x":[{"space-x":[F]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[F]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",re,t]}],"min-w":[{"min-w":[re,t,"min","max","fit"]}],"max-w":[{"max-w":[re,t,"none","full","min","max","fit","prose",{screen:[Ft]},Ft]}],h:[{h:[re,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[re,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[re,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[re,t,"auto","min","max","fit"]}],"font-size":[{text:["base",Ft,_t]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",Ko]}],"font-family":[{font:[Dn]}],"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",re]}],"line-clamp":[{"line-clamp":["none",en,Ko]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",mt,re]}],"list-image":[{"list-image":["none",re]}],"list-style-type":[{list:["none","disc","decimal",re]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[w]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[w]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...B(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",mt,_t]}],"underline-offset":[{"underline-offset":["auto",mt,re]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:k()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",re]}],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",re]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[w]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...J(),Rg]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",Lg]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},Bg]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[v]}],"gradient-via-pos":[{via:[v]}],"gradient-to-pos":[{to:[v]}],"gradient-from":[{from:[g]}],"gradient-via":[{via:[g]}],"gradient-to":[{to:[g]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[w]}],"border-style":[{border:[...B(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[w]}],"divide-style":[{divide:B()}],"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:["",...B()]}],"outline-offset":[{"outline-offset":[mt,re]}],"outline-w":[{outline:[mt,_t]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:z()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[w]}],"ring-offset-w":[{"ring-offset":[mt,_t]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",Ft,zg]}],"shadow-color":[{shadow:[Dn]}],opacity:[{opacity:[w]}],"mix-blend":[{"mix-blend":[...U(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":U()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[u]}],"drop-shadow":[{"drop-shadow":["","none",Ft,re]}],grayscale:[{grayscale:[c]}],"hue-rotate":[{"hue-rotate":[f]}],invert:[{invert:[p]}],saturate:[{saturate:[S]}],sepia:[{sepia:[x]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[u]}],"backdrop-grayscale":[{"backdrop-grayscale":[c]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[f]}],"backdrop-invert":[{"backdrop-invert":[p]}],"backdrop-opacity":[{"backdrop-opacity":[w]}],"backdrop-saturate":[{"backdrop-saturate":[S]}],"backdrop-sepia":[{"backdrop-sepia":[x]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[i]}],"border-spacing-x":[{"border-spacing-x":[i]}],"border-spacing-y":[{"border-spacing-y":[i]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",re]}],duration:[{duration:ue()}],ease:[{ease:["linear","in","out","in-out",re]}],delay:[{delay:ue()}],animate:[{animate:["none","spin","ping","pulse","bounce",re]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[On,re]}],"translate-x":[{"translate-x":[O]}],"translate-y":[{"translate-y":[O]}],"skew-x":[{"skew-x":[P]}],"skew-y":[{"skew-y":[P]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",re]}],accent:[{accent:["auto",e]}],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",re]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":k()}],"scroll-mx":[{"scroll-mx":k()}],"scroll-my":[{"scroll-my":k()}],"scroll-ms":[{"scroll-ms":k()}],"scroll-me":[{"scroll-me":k()}],"scroll-mt":[{"scroll-mt":k()}],"scroll-mr":[{"scroll-mr":k()}],"scroll-mb":[{"scroll-mb":k()}],"scroll-ml":[{"scroll-ml":k()}],"scroll-p":[{"scroll-p":k()}],"scroll-px":[{"scroll-px":k()}],"scroll-py":[{"scroll-py":k()}],"scroll-ps":[{"scroll-ps":k()}],"scroll-pe":[{"scroll-pe":k()}],"scroll-pt":[{"scroll-pt":k()}],"scroll-pr":[{"scroll-pr":k()}],"scroll-pb":[{"scroll-pb":k()}],"scroll-pl":[{"scroll-pl":k()}],"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",re]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[mt,_t,Ko]}],stroke:[{stroke:[e,"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 te(...e){return Wg(_a(e))}const Gg=e=>{if(e===0)return"0 Bytes";const t=1024,n=["Bytes","KB","MB","GB","TB"],r=Math.floor(Math.log(e)/Math.log(t));return`${parseFloat((e/Math.pow(t,r)).toFixed(2))} ${n[r]}`},La=d.forwardRef(({className:e,...t},n)=>l.jsx("nav",{ref:n,"aria-label":"breadcrumb",className:te("s3-explr-ui-breadcrumb",e),...t}));La.displayName="Breadcrumb";const Ra=d.forwardRef(({className:e,...t},n)=>l.jsx("ol",{ref:n,className:te("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5","s3-explr-ui-breadcrumb-list",e),...t}));Ra.displayName="BreadcrumbList";const Xo=d.forwardRef(({className:e,...t},n)=>l.jsx("li",{ref:n,className:te("inline-flex items-center gap-1.5","s3-explr-ui-breadcrumb-item",e),...t}));Xo.displayName="BreadcrumbItem";const Jo=d.forwardRef(({asChild:e,className:t,...n},r)=>{const o=e?Qt:"a";return l.jsx(o,{ref:r,className:te("transition-colors hover:text-foreground","s3-explr-ui-breadcrumb-link",t),...n})});Jo.displayName="BreadcrumbLink";const qg=d.forwardRef(({className:e,...t},n)=>l.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:te("font-normal text-foreground","s3-explr-ui-breadcrumb-page",e),...t}));qg.displayName="BreadcrumbPage";const Va=({children:e,className:t,...n})=>l.jsx("li",{role:"presentation","aria-hidden":"true",className:te("[&>svg]:w-3.5 [&>svg]:h-3.5","s3-explr-ui-breadcrumb-separator",t),...n,children:e??l.jsx(Na,{})});Va.displayName="BreadcrumbSeparator";const Ba=e=>typeof e=="boolean"?`${e}`:e===0?"0":e,za=_a,Yo=(e,t)=>n=>{var r;if((t==null?void 0:t.variants)==null)return za(e,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:o,defaultVariants:s}=t,i=Object.keys(o).map(c=>{const f=n==null?void 0:n[c],p=s==null?void 0:s[c];if(f===null)return null;const m=Ba(f)||Ba(p);return o[c][m]}),a=n&&Object.entries(n).reduce((c,f)=>{let[p,m]=f;return m===void 0||(c[p]=m),c},{}),u=t==null||(r=t.compoundVariants)===null||r===void 0?void 0:r.reduce((c,f)=>{let{class:p,className:m,...g}=f;return Object.entries(g).every(v=>{let[h,y]=v;return Array.isArray(y)?y.includes({...s,...a}[h]):{...s,...a}[h]===y})?[...c,p,m]:c},[]);return za(e,i,u,n==null?void 0:n.class,n==null?void 0:n.className)},Ha=Yo("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"}}),ie=d.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},s)=>{const i=r?Qt:"button";return l.jsx(i,{className:te(Ha({variant:t,size:n,className:e})),ref:s,...o})});ie.displayName="Button";function Kg(e,t){typeof e=="function"?e(t):e!=null&&(e.current=t)}function gr(...e){return t=>e.forEach(n=>Kg(n,t))}function ze(...e){return d.useCallback(gr(...e),e)}function Xg(e,t){const n=d.createContext(t),r=s=>{const{children:i,...a}=s,u=d.useMemo(()=>a,Object.values(a));return l.jsx(n.Provider,{value:u,children:i})};r.displayName=e+"Provider";function o(s){const i=d.useContext(n);if(i)return i;if(t!==void 0)return t;throw new Error(`\`${s}\` must be used within \`${e}\``)}return[r,o]}function Ot(e,t=[]){let n=[];function r(s,i){const a=d.createContext(i),u=n.length;n=[...n,i];const c=p=>{var w;const{scope:m,children:g,...v}=p,h=((w=m==null?void 0:m[e])==null?void 0:w[u])||a,y=d.useMemo(()=>v,Object.values(v));return l.jsx(h.Provider,{value:y,children:g})};c.displayName=s+"Provider";function f(p,m){var h;const g=((h=m==null?void 0:m[e])==null?void 0:h[u])||a,v=d.useContext(g);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return[c,f]}const o=()=>{const s=n.map(i=>d.createContext(i));return function(a){const u=(a==null?void 0:a[e])||s;return d.useMemo(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return o.scopeName=e,[r,Jg(o,...t)]}function Jg(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:u,scopeName:c})=>{const p=u(s)[`__scope${c}`];return{...a,...p}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}function we(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Ae(e){const t=d.useRef(e);return d.useEffect(()=>{t.current=e}),d.useMemo(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function nn({prop:e,defaultProp:t,onChange:n=()=>{}}){const[r,o]=Yg({defaultProp:t,onChange:n}),s=e!==void 0,i=s?e:r,a=Ae(n),u=d.useCallback(c=>{if(s){const p=typeof c=="function"?c(e):c;p!==e&&a(p)}else o(c)},[s,e,o,a]);return[i,u]}function Yg({defaultProp:e,onChange:t}){const n=d.useState(e),[r]=n,o=d.useRef(r),s=Ae(t);return d.useEffect(()=>{o.current!==r&&(s(r),o.current=r)},[r,o,s]),n}function Zg(e){const t=d.useRef({value:e,previous:e});return d.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Re=globalThis!=null&&globalThis.document?d.useLayoutEffect:()=>{};function Ua(e){const[t,n]=d.useState(void 0);return Re(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const s=o[0];let i,a;if("borderBoxSize"in s){const u=s.borderBoxSize,c=Array.isArray(u)?u[0]:u;i=c.inlineSize,a=c.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}function Qg(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var rn=e=>{const{present:t,children:n}=e,r=eh(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=ze(r.ref,th(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};rn.displayName="Presence";function eh(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[a,u]=Qg(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const c=hr(r.current);s.current=a==="mounted"?c:"none"},[a]),Re(()=>{const c=r.current,f=o.current;if(f!==e){const m=s.current,g=hr(c);e?u("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?u("UNMOUNT"):u(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Re(()=>{if(t){let c;const f=t.ownerDocument.defaultView??window,p=g=>{const h=hr(r.current).includes(g.animationName);if(g.target===t&&h&&(u("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",c=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=g=>{g.target===t&&(s.current=hr(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(c),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:d.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function hr(e){return(e==null?void 0:e.animationName)||"none"}function th(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ja=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(rh);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return l.jsx(Zo,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return l.jsx(Zo,{...r,ref:t,children:n})});ja.displayName="Slot";var Zo=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=sh(n);return d.cloneElement(n,{...oh(r,n.props),ref:t?gr(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});Zo.displayName="SlotClone";var nh=({children:e})=>l.jsx(l.Fragment,{children:e});function rh(e){return d.isValidElement(e)&&e.type===nh}function oh(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function sh(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var ih=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],be=ih.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?ja:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function Wa(e,t){e&&Yn.flushSync(()=>e.dispatchEvent(t))}var Qo="Checkbox",[ah,uC]=Ot(Qo),[lh,ch]=ah(Qo),Ga=d.forwardRef((e,t)=>{const{__scopeCheckbox:n,name:r,checked:o,defaultChecked:s,required:i,disabled:a,value:u="on",onCheckedChange:c,form:f,...p}=e,[m,g]=d.useState(null),v=ze(t,E=>g(E)),h=d.useRef(!1),y=m?f||!!m.closest("form"):!0,[w=!1,b]=nn({prop:o,defaultProp:s,onChange:c}),S=d.useRef(w);return d.useEffect(()=>{const E=m==null?void 0:m.form;if(E){const x=()=>b(S.current);return E.addEventListener("reset",x),()=>E.removeEventListener("reset",x)}},[m,b]),l.jsxs(lh,{scope:n,state:w,disabled:a,children:[l.jsx(be.button,{type:"button",role:"checkbox","aria-checked":Dt(w)?"mixed":w,"aria-required":i,"data-state":Xa(w),"data-disabled":a?"":void 0,disabled:a,value:u,...p,ref:v,onKeyDown:we(e.onKeyDown,E=>{E.key==="Enter"&&E.preventDefault()}),onClick:we(e.onClick,E=>{b(x=>Dt(x)?!0:!x),y&&(h.current=E.isPropagationStopped(),h.current||E.stopPropagation())})}),y&&l.jsx(uh,{control:m,bubbles:!h.current,name:r,value:u,checked:w,required:i,disabled:a,form:f,style:{transform:"translateX(-100%)"},defaultChecked:Dt(s)?!1:s})]})});Ga.displayName=Qo;var qa="CheckboxIndicator",Ka=d.forwardRef((e,t)=>{const{__scopeCheckbox:n,forceMount:r,...o}=e,s=ch(qa,n);return l.jsx(rn,{present:r||Dt(s.state)||s.state===!0,children:l.jsx(be.span,{"data-state":Xa(s.state),"data-disabled":s.disabled?"":void 0,...o,ref:t,style:{pointerEvents:"none",...e.style}})})});Ka.displayName=qa;var uh=e=>{const{control:t,checked:n,bubbles:r=!0,defaultChecked:o,...s}=e,i=d.useRef(null),a=Zg(n),u=Ua(t);d.useEffect(()=>{const f=i.current,p=window.HTMLInputElement.prototype,g=Object.getOwnPropertyDescriptor(p,"checked").set;if(a!==n&&g){const v=new Event("click",{bubbles:r});f.indeterminate=Dt(n),g.call(f,Dt(n)?!1:n),f.dispatchEvent(v)}},[a,n,r]);const c=d.useRef(Dt(n)?!1:n);return l.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:o??c.current,...s,tabIndex:-1,ref:i,style:{...e.style,...u,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})};function Dt(e){return e==="indeterminate"}function Xa(e){return Dt(e)?"indeterminate":e?"checked":"unchecked"}var Ja=Ga,dh=Ka;const es=d.forwardRef(({className:e,...t},n)=>l.jsx(Ja,{ref:n,className:te("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",e),...t,children:l.jsx(dh,{className:te("s3-explr-ui-checkbox-indicator flex items-center justify-center text-current"),children:l.jsx(tg,{className:"s3-explr-ui-checkbox-check h-4 w-4"})})}));es.displayName=Ja.displayName;var fh=d.useId||(()=>{}),ph=0;function on(e){const[t,n]=d.useState(fh());return Re(()=>{e||n(r=>r??String(ph++))},[e]),e||(t?`radix-${t}`:"")}function Ya(e,t=globalThis==null?void 0:globalThis.document){const n=Ae(e);d.useEffect(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var gh="DismissableLayer",ts="dismissableLayer.update",hh="dismissableLayer.pointerDownOutside",mh="dismissableLayer.focusOutside",Za,Qa=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),ns=d.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...u}=e,c=d.useContext(Qa),[f,p]=d.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=d.useState({}),v=ze(t,F=>p(F)),h=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),w=h.indexOf(y),b=f?h.indexOf(f):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,E=b>=w,x=yh(F=>{const O=F.target,I=[...c.branches].some(D=>D.contains(O));!E||I||(o==null||o(F),i==null||i(F),F.defaultPrevented||a==null||a())},m),P=wh(F=>{const O=F.target;[...c.branches].some(D=>D.contains(O))||(s==null||s(F),i==null||i(F),F.defaultPrevented||a==null||a())},m);return Ya(F=>{b===c.layers.size-1&&(r==null||r(F),!F.defaultPrevented&&a&&(F.preventDefault(),a()))},m),d.useEffect(()=>{if(f)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Za=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(f)),c.layers.add(f),tl(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Za)}},[f,m,n,c]),d.useEffect(()=>()=>{f&&(c.layers.delete(f),c.layersWithOutsidePointerEventsDisabled.delete(f),tl())},[f,c]),d.useEffect(()=>{const F=()=>g({});return document.addEventListener(ts,F),()=>document.removeEventListener(ts,F)},[]),l.jsx(be.div,{...u,ref:v,style:{pointerEvents:S?E?"auto":"none":void 0,...e.style},onFocusCapture:we(e.onFocusCapture,P.onFocusCapture),onBlurCapture:we(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:we(e.onPointerDownCapture,x.onPointerDownCapture)})});ns.displayName=gh;var vh="DismissableLayerBranch",el=d.forwardRef((e,t)=>{const n=d.useContext(Qa),r=d.useRef(null),o=ze(t,r);return d.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),l.jsx(be.div,{...e,ref:o})});el.displayName=vh;function yh(e,t=globalThis==null?void 0:globalThis.document){const n=Ae(e),r=d.useRef(!1),o=d.useRef(()=>{});return d.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let u=function(){nl(hh,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=u,t.addEventListener("click",o.current,{once:!0})):u()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function wh(e,t=globalThis==null?void 0:globalThis.document){const n=Ae(e),r=d.useRef(!1);return d.useEffect(()=>{const o=s=>{s.target&&!r.current&&nl(mh,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function tl(){const e=new CustomEvent(ts);document.dispatchEvent(e)}function nl(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Wa(o,s):o.dispatchEvent(s)}var bh=ns,xh=el,rs="focusScope.autoFocusOnMount",os="focusScope.autoFocusOnUnmount",rl={bubbles:!1,cancelable:!0},Ch="FocusScope",ol=d.forwardRef((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:s,...i}=e,[a,u]=d.useState(null),c=Ae(o),f=Ae(s),p=d.useRef(null),m=ze(t,h=>u(h)),g=d.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;d.useEffect(()=>{if(r){let h=function(S){if(g.paused||!a)return;const E=S.target;a.contains(E)?p.current=E:Mt(p.current,{select:!0})},y=function(S){if(g.paused||!a)return;const E=S.relatedTarget;E!==null&&(a.contains(E)||Mt(p.current,{select:!0}))},w=function(S){if(document.activeElement===document.body)for(const x of S)x.removedNodes.length>0&&Mt(a)};document.addEventListener("focusin",h),document.addEventListener("focusout",y);const b=new MutationObserver(w);return a&&b.observe(a,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",y),b.disconnect()}}},[r,a,g.paused]),d.useEffect(()=>{if(a){al.add(g);const h=document.activeElement;if(!a.contains(h)){const w=new CustomEvent(rs,rl);a.addEventListener(rs,c),a.dispatchEvent(w),w.defaultPrevented||(Sh(Ah(sl(a)),{select:!0}),document.activeElement===h&&Mt(a))}return()=>{a.removeEventListener(rs,c),setTimeout(()=>{const w=new CustomEvent(os,rl);a.addEventListener(os,f),a.dispatchEvent(w),w.defaultPrevented||Mt(h??document.body,{select:!0}),a.removeEventListener(os,f),al.remove(g)},0)}}},[a,c,f,g]);const v=d.useCallback(h=>{if(!n&&!r||g.paused)return;const y=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,w=document.activeElement;if(y&&w){const b=h.currentTarget,[S,E]=Eh(b);S&&E?!h.shiftKey&&w===E?(h.preventDefault(),n&&Mt(S,{select:!0})):h.shiftKey&&w===S&&(h.preventDefault(),n&&Mt(E,{select:!0})):w===b&&h.preventDefault()}},[n,r,g.paused]);return l.jsx(be.div,{tabIndex:-1,...i,ref:m,onKeyDown:v})});ol.displayName=Ch;function Sh(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(Mt(r,{select:t}),document.activeElement!==n)return}function Eh(e){const t=sl(e),n=il(t,e),r=il(t.reverse(),e);return[n,r]}function sl(e){const t=[],n=document.createTreeWalker(e,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();)t.push(n.currentNode);return t}function il(e,t){for(const n of e)if(!Nh(n,{upTo:t}))return n}function Nh(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Th(e){return e instanceof HTMLInputElement&&"select"in e}function Mt(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Th(e)&&t&&e.select()}}var al=Ph();function Ph(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ll(e,t),e.unshift(t)},remove(t){var n;e=ll(e,t),(n=e[0])==null||n.resume()}}}function ll(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Ah(e){return e.filter(t=>t.tagName!=="A")}var _h="Portal",ss=d.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=d.useState(!1);Re(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?uo.createPortal(l.jsx(be.div,{...r,ref:t}),i):null});ss.displayName=_h;var is=0;function Fh(){d.useEffect(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??cl()),document.body.insertAdjacentElement("beforeend",e[1]??cl()),is++,()=>{is===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),is--}},[])}function cl(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var ot=function(){return ot=Object.assign||function(t){for(var n,r=1,o=arguments.length;r<o;r++){n=arguments[r];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=n[s])}return t},ot.apply(this,arguments)};function ul(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function dl(e,t){var n=typeof Symbol=="function"&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),o,s=[],i;try{for(;(t===void 0||t-- >0)&&!(o=r.next()).done;)s.push(o.value)}catch(a){i={error:a}}finally{try{o&&!o.done&&(n=r.return)&&n.call(r)}finally{if(i)throw i.error}}return s}function fl(e,t,n){if(n||arguments.length===2)for(var r=0,o=t.length,s;r<o;r++)(s||!(r in t))&&(s||(s=Array.prototype.slice.call(t,0,r)),s[r]=t[r]);return e.concat(s||Array.prototype.slice.call(t))}typeof SuppressedError=="function"&&SuppressedError;var mr="right-scroll-bar-position",vr="width-before-scroll-bar",Oh="with-scroll-bars-hidden",Dh="--removed-body-scroll-bar-size";function as(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function Mh(e,t){var n=A.useState(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var Ih=typeof window<"u"?d.useLayoutEffect:d.useEffect,pl=new WeakMap;function kh(e,t){var n=Mh(null,function(r){return e.forEach(function(o){return as(o,r)})});return Ih(function(){var r=pl.get(n);if(r){var o=new Set(r),s=new Set(e),i=n.current;o.forEach(function(a){s.has(a)||as(a,null)}),s.forEach(function(a){o.has(a)||as(a,i)})}pl.set(n,e)},[e]),n}function $h(e){return e}function Lh(e,t){t===void 0&&(t=$h);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(s){var i=t(s,r);return n.push(i),function(){n=n.filter(function(a){return a!==i})}},assignSyncMedium:function(s){for(r=!0;n.length;){var i=n;n=[],i.forEach(s)}n={push:function(a){return s(a)},filter:function(){return n}}},assignMedium:function(s){r=!0;var i=[];if(n.length){var a=n;n=[],a.forEach(s),i=n}var u=function(){var f=i;i=[],f.forEach(s)},c=function(){return Promise.resolve().then(u)};c(),n={push:function(f){i.push(f),c()},filter:function(f){return i=i.filter(f),n}}}};return o}function Rh(e){e===void 0&&(e={});var t=Lh(null);return t.options=ot({async:!0,ssr:!1},e),t}var gl=function(e){var t=e.sideCar,n=ul(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return d.createElement(r,ot({},n))};gl.isSideCarExport=!0;function Vh(e,t){return e.useMedium(t),gl}var hl=Rh(),ls=function(){},yr=d.forwardRef(function(e,t){var n=d.useRef(null),r=d.useState({onScrollCapture:ls,onWheelCapture:ls,onTouchMoveCapture:ls}),o=r[0],s=r[1],i=e.forwardProps,a=e.children,u=e.className,c=e.removeScrollBar,f=e.enabled,p=e.shards,m=e.sideCar,g=e.noIsolation,v=e.inert,h=e.allowPinchZoom,y=e.as,w=y===void 0?"div":y,b=e.gapMode,S=ul(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),E=m,x=kh([n,t]),P=ot(ot({},S),o);return d.createElement(d.Fragment,null,f&&d.createElement(E,{sideCar:hl,removeScrollBar:c,shards:p,noIsolation:g,inert:v,setCallbacks:s,allowPinchZoom:!!h,lockRef:n,gapMode:b}),i?d.cloneElement(d.Children.only(a),ot(ot({},P),{ref:x})):d.createElement(w,ot({},P,{className:u,ref:x}),a))});yr.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},yr.classNames={fullWidth:vr,zeroRight:mr};var Bh=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function zh(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=Bh();return t&&e.setAttribute("nonce",t),e}function Hh(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function Uh(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var jh=function(){var e=0,t=null;return{add:function(n){e==0&&(t=zh())&&(Hh(t,n),Uh(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},Wh=function(){var e=jh();return function(t,n){d.useEffect(function(){return e.add(t),function(){e.remove()}},[t&&n])}},ml=function(){var e=Wh(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},Gh={left:0,top:0,right:0,gap:0},cs=function(e){return parseInt(e||"",10)||0},qh=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[cs(n),cs(r),cs(o)]},Kh=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return Gh;var t=qh(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Xh=ml(),sn="data-scroll-locked",Jh=function(e,t,n,r){var o=e.left,s=e.top,i=e.right,a=e.gap;return n===void 0&&(n="margin"),`
|
|
103
103
|
.`.concat(Oh,` {
|
|
104
104
|
overflow: hidden `).concat(r,`;
|
|
105
105
|
padding-right: `).concat(a,"px ").concat(r,`;
|
|
@@ -143,6 +143,6 @@
|
|
|
143
143
|
|
|
144
144
|
If you want to hide the \`${t.titleName}\`, you can wrap it with our VisuallyHidden component.
|
|
145
145
|
|
|
146
|
-
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return d.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Tm="DialogDescriptionWarning",Pm=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Hl(Tm).contentName}}.`;return d.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Am=Al,_m=Fl,Fm=Dl,Ul=Ml,jl=Il,Wl=$l,Gl=Rl,Om=Bl;const It=Am,Er=_m,Dm=Fm,ql=d.forwardRef(({className:e,...t},n)=>l.jsx(Ul,{ref:n,className:ee("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",e),...t}));ql.displayName=Ul.displayName;const vt=d.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(Dm,{children:[l.jsx(ql,{}),l.jsxs(jl,{ref:r,className:ee("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",e),...n,children:[t,l.jsxs(Om,{className:ee("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:[l.jsx(Uo,{className:"s3-explr-ui-dialog-close-icon h-4 w-4"}),l.jsx("span",{className:"s3-explr-ui-dialog-close-text sr-only",children:"Close"})]})]})]}));vt.displayName=jl.displayName;const yt=({className:e,...t})=>l.jsx("div",{className:ee("s3-explr-ui-dialog-header flex flex-col space-y-1.5 text-center sm:text-left",e),...t});yt.displayName="DialogHeader";const un=({className:e,...t})=>l.jsx("div",{className:ee("s3-explr-ui-dialog-footer flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});un.displayName="DialogFooter";const wt=d.forwardRef(({className:e,...t},n)=>l.jsx(Wl,{ref:n,className:ee("s3-explr-ui-dialog-title text-lg font-semibold leading-none tracking-tight",e),...t}));wt.displayName=Wl.displayName;const Mn=d.forwardRef(({className:e,...t},n)=>l.jsx(Gl,{ref:n,className:ee("s3-explr-ui-dialog-description text-sm text-muted-foreground",e),...t}));Mn.displayName=Gl.displayName;const kt=d.forwardRef(({className:e,type:t,...n},r)=>l.jsx("input",{type:t,className:ee("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",e),ref:r,...n}));kt.displayName="Input";var Mm="Label",Kl=d.forwardRef((e,t)=>l.jsx(be.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Kl.displayName=Mm;var Xl=Kl;const Im=Yo("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"}}),Wt=d.forwardRef(({className:e,variant:t,size:n,...r},o)=>l.jsx(Xl,{ref:o,className:ee(Im({variant:t,size:n}),e),...r}));Wt.displayName=Xl.displayName;const Nr=d.forwardRef(({className:e,...t},n)=>l.jsx("div",{className:ee("relative w-full overflow-auto","s3-explr-ui-table-container"),children:l.jsx("table",{ref:n,className:ee("w-full caption-bottom text-sm","s3-explr-ui-table",e),...t})}));Nr.displayName="Table";const Tr=d.forwardRef(({className:e,...t},n)=>l.jsx("thead",{ref:n,className:ee("[&_tr]:border-b","s3-explr-ui-table-header",e),...t}));Tr.displayName="TableHeader";const Pr=d.forwardRef(({className:e,...t},n)=>l.jsx("tbody",{ref:n,className:ee("[&_tr:last-child]:border-0","s3-explr-ui-table-body",e),...t}));Pr.displayName="TableBody";const km=d.forwardRef(({className:e,...t},n)=>l.jsx("tfoot",{ref:n,className:ee("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0","s3-explr-ui-table-footer",e),...t}));km.displayName="TableFooter";const Ye=d.forwardRef(({className:e,...t},n)=>l.jsx("tr",{ref:n,className:ee("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted","s3-explr-ui-table-row",e),...t}));Ye.displayName="TableRow";const st=d.forwardRef(({className:e,...t},n)=>l.jsx("th",{ref:n,className:ee("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",e),...t}));st.displayName="TableHead";const De=d.forwardRef(({className:e,...t},n)=>l.jsx("td",{ref:n,className:ee("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]","s3-explr-ui-table-cell",e),...t}));De.displayName="TableCell";const $m=d.forwardRef(({className:e,...t},n)=>l.jsx("caption",{ref:n,className:ee("mt-4 text-sm text-muted-foreground","s3-explr-ui-table-caption",e),...t}));$m.displayName="TableCaption";function vs(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function dn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Jl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ys(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Jl(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Jl(e[o],null)}}}}function ws(...e){return d.useCallback(ys(...e),e)}var bs=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(Rm);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return l.jsx(xs,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return l.jsx(xs,{...r,ref:t,children:n})});bs.displayName="Slot";var xs=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=Bm(n);return d.cloneElement(n,{...Vm(r,n.props),ref:t?ys(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});xs.displayName="SlotClone";var Lm=({children:e})=>l.jsx(l.Fragment,{children:e});function Rm(e){return d.isValidElement(e)&&e.type===Lm}function Vm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Bm(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function zm(e){const t=e+"CollectionProvider",[n,r]=Ot(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:v,children:h}=g,y=A.useRef(null),w=A.useRef(new Map).current;return l.jsx(o,{scope:v,itemMap:w,collectionRef:y,children:h})};i.displayName=t;const a=e+"CollectionSlot",u=A.forwardRef((g,v)=>{const{scope:h,children:y}=g,w=s(a,h),b=ws(v,w.collectionRef);return l.jsx(bs,{ref:b,children:y})});u.displayName=a;const c=e+"CollectionItemSlot",f="data-radix-collection-item",p=A.forwardRef((g,v)=>{const{scope:h,children:y,...w}=g,b=A.useRef(null),S=ws(v,b),E=s(c,h);return A.useEffect(()=>(E.itemMap.set(b,{ref:b,...w}),()=>void E.itemMap.delete(b))),l.jsx(bs,{[f]:"",ref:S,children:y})});p.displayName=c;function m(g){const v=s(e+"CollectionConsumer",g);return A.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((E,x)=>w.indexOf(E.ref.current)-w.indexOf(x.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:u,ItemSlot:p},m,r]}var Yl=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(Um);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return l.jsx(Cs,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return l.jsx(Cs,{...r,ref:t,children:n})});Yl.displayName="Slot";var Cs=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=Wm(n);return d.cloneElement(n,{...jm(r,n.props),ref:t?ys(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});Cs.displayName="SlotClone";var Hm=({children:e})=>l.jsx(l.Fragment,{children:e});function Um(e){return d.isValidElement(e)&&e.type===Hm}function jm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Wm(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Gm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Zl=Gm.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Yl:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),qm=d.createContext(void 0);function Ql(e){const t=d.useContext(qm);return e||t||"ltr"}var Ss="rovingFocusGroup.onEntryFocus",Km={bubbles:!1,cancelable:!0},Ar="RovingFocusGroup",[Es,ec,Xm]=zm(Ar),[Jm,tc]=Ot(Ar,[Xm]),[Ym,Zm]=Jm(Ar),nc=d.forwardRef((e,t)=>l.jsx(Es.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Es.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Qm,{...e,ref:t})})}));nc.displayName=Ar;var Qm=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:u,onEntryFocus:c,preventScrollOnEntryFocus:f=!1,...p}=e,m=d.useRef(null),g=ws(t,m),v=Ql(s),[h=null,y]=nn({prop:i,defaultProp:a,onChange:u}),[w,b]=d.useState(!1),S=Ae(c),E=ec(n),x=d.useRef(!1),[P,F]=d.useState(0);return d.useEffect(()=>{const O=m.current;if(O)return O.addEventListener(Ss,S),()=>O.removeEventListener(Ss,S)},[S]),l.jsx(Ym,{scope:n,orientation:r,dir:v,loop:o,currentTabStopId:h,onItemFocus:d.useCallback(O=>y(O),[y]),onItemShiftTab:d.useCallback(()=>b(!0),[]),onFocusableItemAdd:d.useCallback(()=>F(O=>O+1),[]),onFocusableItemRemove:d.useCallback(()=>F(O=>O-1),[]),children:l.jsx(Zl.div,{tabIndex:w||P===0?-1:0,"data-orientation":r,...p,ref:g,style:{outline:"none",...e.style},onMouseDown:dn(e.onMouseDown,()=>{x.current=!0}),onFocus:dn(e.onFocus,O=>{const I=!x.current;if(O.target===O.currentTarget&&I&&!w){const D=new CustomEvent(Ss,Km);if(O.currentTarget.dispatchEvent(D),!D.defaultPrevented){const q=E().filter(B=>B.focusable),k=q.find(B=>B.active),z=q.find(B=>B.id===h),J=[k,z,...q].filter(Boolean).map(B=>B.ref.current);sc(J,f)}}x.current=!1}),onBlur:dn(e.onBlur,()=>b(!1))})})}),rc="RovingFocusGroupItem",oc=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,...i}=e,a=on(),u=s||a,c=Zm(rc,n),f=c.currentTabStopId===u,p=ec(n),{onFocusableItemAdd:m,onFocusableItemRemove:g}=c;return d.useEffect(()=>{if(r)return m(),()=>g()},[r,m,g]),l.jsx(Es.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:l.jsx(Zl.span,{tabIndex:f?0:-1,"data-orientation":c.orientation,...i,ref:t,onMouseDown:dn(e.onMouseDown,v=>{r?c.onItemFocus(u):v.preventDefault()}),onFocus:dn(e.onFocus,()=>c.onItemFocus(u)),onKeyDown:dn(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const h=nv(v,c.orientation,c.dir);if(h!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=p().filter(b=>b.focusable).map(b=>b.ref.current);if(h==="last")w.reverse();else if(h==="prev"||h==="next"){h==="prev"&&w.reverse();const b=w.indexOf(v.currentTarget);w=c.loop?rv(w,b+1):w.slice(b+1)}setTimeout(()=>sc(w))}})})})});oc.displayName=rc;var ev={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function tv(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function nv(e,t,n){const r=tv(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ev[r]}function sc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function rv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ov=nc,sv=oc;function ic(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function iv(...e){return t=>{let n=!1;const r=e.map(o=>{const s=ic(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():ic(e[o],null)}}}}function av(...e){return d.useCallback(iv(...e),e)}function lv(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var ac=e=>{const{present:t,children:n}=e,r=cv(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=av(r.ref,uv(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};ac.displayName="Presence";function cv(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[a,u]=lv(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const c=_r(r.current);s.current=a==="mounted"?c:"none"},[a]),Re(()=>{const c=r.current,f=o.current;if(f!==e){const m=s.current,g=_r(c);e?u("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?u("UNMOUNT"):u(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Re(()=>{if(t){let c;const f=t.ownerDocument.defaultView??window,p=g=>{const h=_r(r.current).includes(g.animationName);if(g.target===t&&h&&(u("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",c=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=g=>{g.target===t&&(s.current=_r(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(c),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:d.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function _r(e){return(e==null?void 0:e.animationName)||"none"}function uv(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function lc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function dv(...e){return t=>{let n=!1;const r=e.map(o=>{const s=lc(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():lc(e[o],null)}}}}var cc=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(pv);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return l.jsx(Ns,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return l.jsx(Ns,{...r,ref:t,children:n})});cc.displayName="Slot";var Ns=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=hv(n);return d.cloneElement(n,{...gv(r,n.props),ref:t?dv(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});Ns.displayName="SlotClone";var fv=({children:e})=>l.jsx(l.Fragment,{children:e});function pv(e){return d.isValidElement(e)&&e.type===fv}function gv(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function hv(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Fr=mv.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?cc:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Ts="Tabs",[vv,pC]=Ot(Ts,[tc]),uc=tc(),[yv,Ps]=vv(Ts),dc=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:u="automatic",...c}=e,f=Ql(a),[p,m]=nn({prop:r,onChange:o,defaultProp:s});return l.jsx(yv,{scope:n,baseId:on(),value:p,onValueChange:m,orientation:i,dir:f,activationMode:u,children:l.jsx(Fr.div,{dir:f,"data-orientation":i,...c,ref:t})})});dc.displayName=Ts;var fc="TabsList",pc=d.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=Ps(fc,n),i=uc(n);return l.jsx(ov,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:l.jsx(Fr.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});pc.displayName=fc;var gc="TabsTrigger",hc=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=Ps(gc,n),a=uc(n),u=yc(i.baseId,r),c=wc(i.baseId,r),f=r===i.value;return l.jsx(sv,{asChild:!0,...a,focusable:!o,active:f,children:l.jsx(Fr.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":c,"data-state":f?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...s,ref:t,onMouseDown:vs(e.onMouseDown,p=>{!o&&p.button===0&&p.ctrlKey===!1?i.onValueChange(r):p.preventDefault()}),onKeyDown:vs(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(r)}),onFocus:vs(e.onFocus,()=>{const p=i.activationMode!=="manual";!f&&!o&&p&&i.onValueChange(r)})})})});hc.displayName=gc;var mc="TabsContent",vc=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=Ps(mc,n),u=yc(a.baseId,r),c=wc(a.baseId,r),f=r===a.value,p=d.useRef(f);return d.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(ac,{present:o||f,children:({present:m})=>l.jsx(Fr.div,{"data-state":f?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":u,hidden:!m,id:c,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:m&&s})})});vc.displayName=mc;function yc(e,t){return`${e}-trigger-${t}`}function wc(e,t){return`${e}-content-${t}`}var wv=dc,bc=pc,xc=hc,Cc=vc;const bv=wv,Sc=d.forwardRef(({className:e,...t},n)=>l.jsx(bc,{ref:n,className:ee("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Sc.displayName=bc.displayName;const Or=d.forwardRef(({className:e,...t},n)=>l.jsx(xc,{ref:n,className:ee("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",e),...t}));Or.displayName=xc.displayName;const Dr=d.forwardRef(({className:e,...t},n)=>l.jsx(Cc,{ref:n,className:ee("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Dr.displayName=Cc.displayName;const In=d.forwardRef(({className:e,...t},n)=>l.jsx("textarea",{className:ee("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",e),ref:n,...t}));In.displayName="Textarea";function xv(e,t=[]){let n=[];function r(s,i){const a=d.createContext(i),u=n.length;n=[...n,i];function c(p){const{scope:m,children:g,...v}=p,h=(m==null?void 0:m[e][u])||a,y=d.useMemo(()=>v,Object.values(v));return l.jsx(h.Provider,{value:y,children:g})}function f(p,m){const g=(m==null?void 0:m[e][u])||a,v=d.useContext(g);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,f]}const o=()=>{const s=n.map(i=>d.createContext(i));return function(a){const u=(a==null?void 0:a[e])||s;return d.useMemo(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return o.scopeName=e,[r,Cv(o,...t)]}function Cv(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:u,scopeName:c})=>{const p=u(s)[`__scope${c}`];return{...a,...p}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var As=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(Ev);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return l.jsx(_s,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return l.jsx(_s,{...r,ref:t,children:n})});As.displayName="Slot";var _s=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=Tv(n);return d.cloneElement(n,{...Nv(r,n.props),ref:t?gr(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});_s.displayName="SlotClone";var Sv=({children:e})=>l.jsx(l.Fragment,{children:e});function Ev(e){return d.isValidElement(e)&&e.type===Sv}function Nv(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Tv(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Pv(e){const t=e+"CollectionProvider",[n,r]=xv(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:v,children:h}=g,y=A.useRef(null),w=A.useRef(new Map).current;return l.jsx(o,{scope:v,itemMap:w,collectionRef:y,children:h})};i.displayName=t;const a=e+"CollectionSlot",u=A.forwardRef((g,v)=>{const{scope:h,children:y}=g,w=s(a,h),b=ze(v,w.collectionRef);return l.jsx(As,{ref:b,children:y})});u.displayName=a;const c=e+"CollectionItemSlot",f="data-radix-collection-item",p=A.forwardRef((g,v)=>{const{scope:h,children:y,...w}=g,b=A.useRef(null),S=ze(v,b),E=s(c,h);return A.useEffect(()=>(E.itemMap.set(b,{ref:b,...w}),()=>void E.itemMap.delete(b))),l.jsx(As,{[f]:"",ref:S,children:y})});p.displayName=c;function m(g){const v=s(e+"CollectionConsumer",g);return A.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((E,x)=>w.indexOf(E.ref.current)-w.indexOf(x.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:u,ItemSlot:p},m,r]}var Av="VisuallyHidden",Fs=d.forwardRef((e,t)=>l.jsx(be.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));Fs.displayName=Av;var Os="ToastProvider",[Ds,_v,Fv]=Pv("Toast"),[Ec,gC]=Ot("Toast",[Fv]),[Ov,Mr]=Ec(Os),Nc=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:s=50,children:i}=e,[a,u]=d.useState(null),[c,f]=d.useState(0),p=d.useRef(!1),m=d.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Os}\`. Expected non-empty \`string\`.`),l.jsx(Ds.Provider,{scope:t,children:l.jsx(Ov,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:s,toastCount:c,viewport:a,onViewportChange:u,onToastAdd:d.useCallback(()=>f(g=>g+1),[]),onToastRemove:d.useCallback(()=>f(g=>g-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:m,children:i})})};Nc.displayName=Os;var Tc="ToastViewport",Dv=["F8"],Ms="toast.viewportPause",Is="toast.viewportResume",Pc=d.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=Dv,label:o="Notifications ({hotkey})",...s}=e,i=Mr(Tc,n),a=_v(n),u=d.useRef(null),c=d.useRef(null),f=d.useRef(null),p=d.useRef(null),m=ze(t,p,i.onViewportChange),g=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=i.toastCount>0;d.useEffect(()=>{const y=w=>{var S;r.length!==0&&r.every(E=>w[E]||w.code===E)&&((S=p.current)==null||S.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]),d.useEffect(()=>{const y=u.current,w=p.current;if(v&&y&&w){const b=()=>{if(!i.isClosePausedRef.current){const P=new CustomEvent(Ms);w.dispatchEvent(P),i.isClosePausedRef.current=!0}},S=()=>{if(i.isClosePausedRef.current){const P=new CustomEvent(Is);w.dispatchEvent(P),i.isClosePausedRef.current=!1}},E=P=>{!y.contains(P.relatedTarget)&&S()},x=()=>{y.contains(document.activeElement)||S()};return y.addEventListener("focusin",b),y.addEventListener("focusout",E),y.addEventListener("pointermove",b),y.addEventListener("pointerleave",x),window.addEventListener("blur",b),window.addEventListener("focus",S),()=>{y.removeEventListener("focusin",b),y.removeEventListener("focusout",E),y.removeEventListener("pointermove",b),y.removeEventListener("pointerleave",x),window.removeEventListener("blur",b),window.removeEventListener("focus",S)}}},[v,i.isClosePausedRef]);const h=d.useCallback(({tabbingDirection:y})=>{const b=a().map(S=>{const E=S.ref.current,x=[E,...Wv(E)];return y==="forwards"?x:x.reverse()});return(y==="forwards"?b.reverse():b).flat()},[a]);return d.useEffect(()=>{const y=p.current;if(y){const w=b=>{var x,P,F;const S=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!S){const O=document.activeElement,I=b.shiftKey;if(b.target===y&&I){(x=c.current)==null||x.focus();return}const k=h({tabbingDirection:I?"backwards":"forwards"}),z=k.findIndex(R=>R===O);Ls(k.slice(z+1))?b.preventDefault():I?(P=c.current)==null||P.focus():(F=f.current)==null||F.focus()}};return y.addEventListener("keydown",w),()=>y.removeEventListener("keydown",w)}},[a,h]),l.jsxs(xh,{ref:u,role:"region","aria-label":o.replace("{hotkey}",g),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&l.jsx(ks,{ref:c,onFocusFromOutsideViewport:()=>{const y=h({tabbingDirection:"forwards"});Ls(y)}}),l.jsx(Ds.Slot,{scope:n,children:l.jsx(be.ol,{tabIndex:-1,...s,ref:m})}),v&&l.jsx(ks,{ref:f,onFocusFromOutsideViewport:()=>{const y=h({tabbingDirection:"backwards"});Ls(y)}})]})});Pc.displayName=Tc;var Ac="ToastFocusProxy",ks=d.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,s=Mr(Ac,n);return l.jsx(Fs,{"aria-hidden":!0,tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:i=>{var c;const a=i.relatedTarget;!((c=s.viewport)!=null&&c.contains(a))&&r()}})});ks.displayName=Ac;var Ir="Toast",Mv="toast.swipeStart",Iv="toast.swipeMove",kv="toast.swipeCancel",$v="toast.swipeEnd",_c=d.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:s,...i}=e,[a=!0,u]=nn({prop:r,defaultProp:o,onChange:s});return l.jsx(rn,{present:n||a,children:l.jsx(Vv,{open:a,...i,ref:t,onClose:()=>u(!1),onPause:Ae(e.onPause),onResume:Ae(e.onResume),onSwipeStart:we(e.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:we(e.onSwipeMove,c=>{const{x:f,y:p}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:we(e.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:we(e.onSwipeEnd,c=>{const{x:f,y:p}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),u(!1)})})})});_c.displayName=Ir;var[Lv,Rv]=Ec(Ir,{onClose(){}}),Vv=d.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:s,onClose:i,onEscapeKeyDown:a,onPause:u,onResume:c,onSwipeStart:f,onSwipeMove:p,onSwipeCancel:m,onSwipeEnd:g,...v}=e,h=Mr(Ir,n),[y,w]=d.useState(null),b=ze(t,R=>w(R)),S=d.useRef(null),E=d.useRef(null),x=o||h.duration,P=d.useRef(0),F=d.useRef(x),O=d.useRef(0),{onToastAdd:I,onToastRemove:D}=h,q=Ae(()=>{var J;(y==null?void 0:y.contains(document.activeElement))&&((J=h.viewport)==null||J.focus()),i()}),k=d.useCallback(R=>{!R||R===1/0||(window.clearTimeout(O.current),P.current=new Date().getTime(),O.current=window.setTimeout(q,R))},[q]);d.useEffect(()=>{const R=h.viewport;if(R){const J=()=>{k(F.current),c==null||c()},B=()=>{const U=new Date().getTime()-P.current;F.current=F.current-U,window.clearTimeout(O.current),u==null||u()};return R.addEventListener(Ms,B),R.addEventListener(Is,J),()=>{R.removeEventListener(Ms,B),R.removeEventListener(Is,J)}}},[h.viewport,x,u,c,k]),d.useEffect(()=>{s&&!h.isClosePausedRef.current&&k(x)},[s,x,h.isClosePausedRef,k]),d.useEffect(()=>(I(),()=>D()),[I,D]);const z=d.useMemo(()=>y?$c(y):null,[y]);return h.viewport?l.jsxs(l.Fragment,{children:[z&&l.jsx(Bv,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:z}),l.jsx(Lv,{scope:n,onClose:q,children:Yn.createPortal(l.jsx(Ds.ItemSlot,{scope:n,children:l.jsx(bh,{asChild:!0,onEscapeKeyDown:we(a,()=>{h.isFocusedToastEscapeKeyDownRef.current||q(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(be.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":h.swipeDirection,...v,ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:we(e.onKeyDown,R=>{R.key==="Escape"&&(a==null||a(R.nativeEvent),R.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,q()))}),onPointerDown:we(e.onPointerDown,R=>{R.button===0&&(S.current={x:R.clientX,y:R.clientY})}),onPointerMove:we(e.onPointerMove,R=>{if(!S.current)return;const J=R.clientX-S.current.x,B=R.clientY-S.current.y,U=!!E.current,K=["left","right"].includes(h.swipeDirection),Y=["left","up"].includes(h.swipeDirection)?Math.min:Math.max,le=K?Y(0,J):0,ue=K?0:Y(0,B),Ee=R.pointerType==="touch"?10:2,Ie={x:le,y:ue},Ue={originalEvent:R,delta:Ie};U?(E.current=Ie,kr(Iv,p,Ue,{discrete:!1})):Lc(Ie,h.swipeDirection,Ee)?(E.current=Ie,kr(Mv,f,Ue,{discrete:!1}),R.target.setPointerCapture(R.pointerId)):(Math.abs(J)>Ee||Math.abs(B)>Ee)&&(S.current=null)}),onPointerUp:we(e.onPointerUp,R=>{const J=E.current,B=R.target;if(B.hasPointerCapture(R.pointerId)&&B.releasePointerCapture(R.pointerId),E.current=null,S.current=null,J){const U=R.currentTarget,K={originalEvent:R,delta:J};Lc(J,h.swipeDirection,h.swipeThreshold)?kr($v,g,K,{discrete:!0}):kr(kv,m,K,{discrete:!0}),U.addEventListener("click",Y=>Y.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),Bv=e=>{const{__scopeToast:t,children:n,...r}=e,o=Mr(Ir,t),[s,i]=d.useState(!1),[a,u]=d.useState(!1);return Uv(()=>i(!0)),d.useEffect(()=>{const c=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(c)},[]),a?null:l.jsx(ss,{asChild:!0,children:l.jsx(Fs,{...r,children:s&&l.jsxs(l.Fragment,{children:[o.label," ",n]})})})},zv="ToastTitle",Fc=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return l.jsx(be.div,{...r,ref:t})});Fc.displayName=zv;var Hv="ToastDescription",Oc=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return l.jsx(be.div,{...r,ref:t})});Oc.displayName=Hv;var Dc="ToastAction",Mc=d.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?l.jsx(kc,{altText:n,asChild:!0,children:l.jsx($s,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Dc}\`. Expected non-empty \`string\`.`),null)});Mc.displayName=Dc;var Ic="ToastClose",$s=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=Rv(Ic,n);return l.jsx(kc,{asChild:!0,children:l.jsx(be.button,{type:"button",...r,ref:t,onClick:we(e.onClick,o.onClose)})})});$s.displayName=Ic;var kc=d.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return l.jsx(be.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function $c(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),jv(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!o)if(s){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...$c(r))}}),t}function kr(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Wa(o,s):o.dispatchEvent(s)}var Lc=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),s=r>o;return t==="left"||t==="right"?s&&r>n:!s&&o>n};function Uv(e=()=>{}){const t=Ae(e);Re(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function jv(e){return e.nodeType===e.ELEMENT_NODE}function Wv(e){const t=[],n=document.createTreeWalker(e,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();)t.push(n.currentNode);return t}function Ls(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var Gv=Nc,Rc=Pc,Vc=_c,Bc=Fc,zc=Oc,Hc=Mc,Uc=$s;const qv=Gv,jc=d.forwardRef(({className:e,...t},n)=>l.jsx(Rc,{ref:n,className:ee("s3-explr-ui-toast-viewport fixed top-0 z-[100] 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]",e),...t}));jc.displayName=Rc.displayName;const Kv=Yo("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"}}),Wc=d.forwardRef(({className:e,variant:t,...n},r)=>l.jsx(Vc,{ref:r,className:ee(Kv({variant:t}),e),...n}));Wc.displayName=Vc.displayName;const Xv=d.forwardRef(({className:e,...t},n)=>l.jsx(Hc,{ref:n,className:ee("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",e),...t}));Xv.displayName=Hc.displayName;const Gc=d.forwardRef(({className:e,...t},n)=>l.jsx(Uc,{ref:n,className:ee("s3-explr-ui-toast-close absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity 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",e),"toast-close":"",...t,children:l.jsx(Uo,{className:"s3-explr-ui-toast-close-icon h-4 w-4"})}));Gc.displayName=Uc.displayName;const qc=d.forwardRef(({className:e,...t},n)=>l.jsx(Bc,{ref:n,className:ee("s3-explr-ui-toast-title text-sm font-semibold [&+div]:text-xs",e),...t}));qc.displayName=Bc.displayName;const Kc=d.forwardRef(({className:e,...t},n)=>l.jsx(zc,{ref:n,className:ee("s3-explr-ui-toast-description text-sm opacity-90",e),...t}));Kc.displayName=zc.displayName;const Jv=1,Yv=1e6;let Rs=0;function Zv(){return Rs=(Rs+1)%Number.MAX_SAFE_INTEGER,Rs.toString()}const Vs=new Map,Xc=e=>{if(Vs.has(e))return;const t=setTimeout(()=>{Vs.delete(e),kn({type:"REMOVE_TOAST",toastId:e})},Yv);Vs.set(e,t)},Qv=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,Jv)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?Xc(n):e.toasts.forEach(r=>{Xc(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},$r=[];let Lr={toasts:[]};function kn(e){Lr=Qv(Lr,e),$r.forEach(t=>{t(Lr)})}function ey({...e}){const t=Zv(),n=o=>kn({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>kn({type:"DISMISS_TOAST",toastId:t});return kn({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function Rr(){const[e,t]=d.useState(Lr);return d.useEffect(()=>($r.push(t),()=>{const n=$r.indexOf(t);n>-1&&$r.splice(n,1)}),[e]),{...e,toast:ey,dismiss:n=>kn({type:"DISMISS_TOAST",toastId:n})}}function Jc(){const{toasts:e}=Rr();return l.jsxs(qv,{children:[e.map(function({id:t,title:n,description:r,action:o,...s}){return l.jsxs(Wc,{...s,className:`s3-explr-ui-toast ${s.className||""}`,children:[l.jsxs("div",{className:"s3-explr-ui-toast-content grid gap-1",children:[n&&l.jsx(qc,{className:"s3-explr-ui-toast-title",children:n}),r&&l.jsx(Kc,{className:"s3-explr-ui-toast-description",children:r})]}),o&&l.jsx("div",{className:"s3-explr-ui-toast-action",children:o}),l.jsx(Gc,{className:"s3-explr-ui-toast-close"})]},t)}),l.jsx(jc,{className:"s3-explr-ui-toast-viewport"})]})}function bt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Yc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ty(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Yc(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Yc(e[o],null)}}}}function $n(...e){return d.useCallback(ty(...e),e)}var ny=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ln=ny.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Qt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function ry(e,t){e&&Yn.flushSync(()=>e.dispatchEvent(t))}var oy="DismissableLayer",Bs="dismissableLayer.update",sy="dismissableLayer.pointerDownOutside",iy="dismissableLayer.focusOutside",Zc,Qc=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),eu=d.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...u}=e,c=d.useContext(Qc),[f,p]=d.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=d.useState({}),v=$n(t,F=>p(F)),h=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),w=h.indexOf(y),b=f?h.indexOf(f):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,E=b>=w,x=cy(F=>{const O=F.target,I=[...c.branches].some(D=>D.contains(O));!E||I||(o==null||o(F),i==null||i(F),F.defaultPrevented||a==null||a())},m),P=uy(F=>{const O=F.target;[...c.branches].some(D=>D.contains(O))||(s==null||s(F),i==null||i(F),F.defaultPrevented||a==null||a())},m);return Ya(F=>{b===c.layers.size-1&&(r==null||r(F),!F.defaultPrevented&&a&&(F.preventDefault(),a()))},m),d.useEffect(()=>{if(f)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Zc=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(f)),c.layers.add(f),tu(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Zc)}},[f,m,n,c]),d.useEffect(()=>()=>{f&&(c.layers.delete(f),c.layersWithOutsidePointerEventsDisabled.delete(f),tu())},[f,c]),d.useEffect(()=>{const F=()=>g({});return document.addEventListener(Bs,F),()=>document.removeEventListener(Bs,F)},[]),l.jsx(Ln.div,{...u,ref:v,style:{pointerEvents:S?E?"auto":"none":void 0,...e.style},onFocusCapture:bt(e.onFocusCapture,P.onFocusCapture),onBlurCapture:bt(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:bt(e.onPointerDownCapture,x.onPointerDownCapture)})});eu.displayName=oy;var ay="DismissableLayerBranch",ly=d.forwardRef((e,t)=>{const n=d.useContext(Qc),r=d.useRef(null),o=$n(t,r);return d.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),l.jsx(Ln.div,{...e,ref:o})});ly.displayName=ay;function cy(e,t=globalThis==null?void 0:globalThis.document){const n=Ae(e),r=d.useRef(!1),o=d.useRef(()=>{});return d.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let u=function(){nu(sy,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=u,t.addEventListener("click",o.current,{once:!0})):u()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function uy(e,t=globalThis==null?void 0:globalThis.document){const n=Ae(e),r=d.useRef(!1);return d.useEffect(()=>{const o=s=>{s.target&&!r.current&&nu(iy,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function tu(){const e=new CustomEvent(Bs);document.dispatchEvent(e)}function nu(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ry(o,s):o.dispatchEvent(s)}const dy=["top","right","bottom","left"],$t=Math.min,Ve=Math.max,Vr=Math.round,Br=Math.floor,it=e=>({x:e,y:e}),fy={left:"right",right:"left",bottom:"top",top:"bottom"},py={start:"end",end:"start"};function zs(e,t,n){return Ve(e,$t(t,n))}function xt(e,t){return typeof e=="function"?e(t):e}function Ct(e){return e.split("-")[0]}function fn(e){return e.split("-")[1]}function Hs(e){return e==="x"?"y":"x"}function Us(e){return e==="y"?"height":"width"}function Lt(e){return["top","bottom"].includes(Ct(e))?"y":"x"}function js(e){return Hs(Lt(e))}function gy(e,t,n){n===void 0&&(n=!1);const r=fn(e),o=js(e),s=Us(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=zr(i)),[i,zr(i)]}function hy(e){const t=zr(e);return[Ws(e),t,Ws(t)]}function Ws(e){return e.replace(/start|end/g,t=>py[t])}function my(e,t,n){const r=["left","right"],o=["right","left"],s=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?s:i;default:return[]}}function vy(e,t,n,r){const o=fn(e);let s=my(Ct(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Ws)))),s}function zr(e){return e.replace(/left|right|bottom|top/g,t=>fy[t])}function yy(e){return{top:0,right:0,bottom:0,left:0,...e}}function ru(e){return typeof e!="number"?yy(e):{top:e,right:e,bottom:e,left:e}}function Hr(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function ou(e,t,n){let{reference:r,floating:o}=e;const s=Lt(t),i=js(t),a=Us(i),u=Ct(t),c=s==="y",f=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let g;switch(u){case"top":g={x:f,y:r.y-o.height};break;case"bottom":g={x:f,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:p};break;case"left":g={x:r.x-o.width,y:p};break;default:g={x:r.x,y:r.y}}switch(fn(t)){case"start":g[i]-=m*(n&&c?-1:1);break;case"end":g[i]+=m*(n&&c?-1:1);break}return g}const wy=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=s.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:p}=ou(c,r,u),m=r,g={},v=0;for(let h=0;h<a.length;h++){const{name:y,fn:w}=a[h],{x:b,y:S,data:E,reset:x}=await w({x:f,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:g,rects:c,platform:i,elements:{reference:e,floating:t}});f=b??f,p=S??p,g={...g,[y]:{...g[y],...E}},x&&v<=50&&(v++,typeof x=="object"&&(x.placement&&(m=x.placement),x.rects&&(c=x.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):x.rects),{x:f,y:p}=ou(c,m,u)),h=-1)}return{x:f,y:p,placement:m,strategy:o,middlewareData:g}};async function Rn(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:u}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:m=!1,padding:g=0}=xt(t,e),v=ru(g),y=a[m?p==="floating"?"reference":"floating":p],w=Hr(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:f,strategy:u})),b=p==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),E=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},x=Hr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:S,strategy:u}):b);return{top:(w.top-x.top+v.top)/E.y,bottom:(x.bottom-w.bottom+v.bottom)/E.y,left:(w.left-x.left+v.left)/E.x,right:(x.right-w.right+v.right)/E.x}}const by=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:u}=t,{element:c,padding:f=0}=xt(e,t)||{};if(c==null)return{};const p=ru(f),m={x:n,y:r},g=js(o),v=Us(g),h=await i.getDimensions(c),y=g==="y",w=y?"top":"left",b=y?"bottom":"right",S=y?"clientHeight":"clientWidth",E=s.reference[v]+s.reference[g]-m[g]-s.floating[v],x=m[g]-s.reference[g],P=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let F=P?P[S]:0;(!F||!await(i.isElement==null?void 0:i.isElement(P)))&&(F=a.floating[S]||s.floating[v]);const O=E/2-x/2,I=F/2-h[v]/2-1,D=$t(p[w],I),q=$t(p[b],I),k=D,z=F-h[v]-q,R=F/2-h[v]/2+O,J=zs(k,R,z),B=!u.arrow&&fn(o)!=null&&R!==J&&s.reference[v]/2-(R<k?D:q)-h[v]/2<0,U=B?R<k?R-k:R-z:0;return{[g]:m[g]+U,data:{[g]:J,centerOffset:R-J-U,...B&&{alignmentOffset:U}},reset:B}}}),xy=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:u,elements:c}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...y}=xt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=Ct(o),b=Lt(a),S=Ct(a)===a,E=await(u.isRTL==null?void 0:u.isRTL(c.floating)),x=m||(S||!h?[zr(a)]:hy(a)),P=v!=="none";!m&&P&&x.push(...vy(a,h,v,E));const F=[a,...x],O=await Rn(t,y),I=[];let D=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&I.push(O[w]),p){const R=gy(o,i,E);I.push(O[R[0]],O[R[1]])}if(D=[...D,{placement:o,overflows:I}],!I.every(R=>R<=0)){var q,k;const R=(((q=s.flip)==null?void 0:q.index)||0)+1,J=F[R];if(J)return{data:{index:R,overflows:D},reset:{placement:J}};let B=(k=D.filter(U=>U.overflows[0]<=0).sort((U,K)=>U.overflows[1]-K.overflows[1])[0])==null?void 0:k.placement;if(!B)switch(g){case"bestFit":{var z;const U=(z=D.filter(K=>{if(P){const Y=Lt(K.placement);return Y===b||Y==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(Y=>Y>0).reduce((Y,le)=>Y+le,0)]).sort((K,Y)=>K[1]-Y[1])[0])==null?void 0:z[0];U&&(B=U);break}case"initialPlacement":B=a;break}if(o!==B)return{reset:{placement:B}}}return{}}}};function su(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function iu(e){return dy.some(t=>e[t]>=0)}const Cy=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=xt(e,t);switch(r){case"referenceHidden":{const s=await Rn(t,{...o,elementContext:"reference"}),i=su(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:iu(i)}}}case"escaped":{const s=await Rn(t,{...o,altBoundary:!0}),i=su(s,n.floating);return{data:{escapedOffsets:i,escaped:iu(i)}}}default:return{}}}}};async function Sy(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ct(n),a=fn(n),u=Lt(n)==="y",c=["left","top"].includes(i)?-1:1,f=s&&u?-1:1,p=xt(t,e);let{mainAxis:m,crossAxis:g,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),u?{x:g*f,y:m*c}:{x:m*c,y:g*f}}const Ey=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,u=await Sy(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:s+u.y,data:{...u,placement:i}}}}},Ny=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:a={fn:y=>{let{x:w,y:b}=y;return{x:w,y:b}}},...u}=xt(e,t),c={x:n,y:r},f=await Rn(t,u),p=Lt(Ct(o)),m=Hs(p);let g=c[m],v=c[p];if(s){const y=m==="y"?"top":"left",w=m==="y"?"bottom":"right",b=g+f[y],S=g-f[w];g=zs(b,g,S)}if(i){const y=p==="y"?"top":"left",w=p==="y"?"bottom":"right",b=v+f[y],S=v-f[w];v=zs(b,v,S)}const h=a.fn({...t,[m]:g,[p]:v});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[m]:s,[p]:i}}}}}},Ty=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:u=!0,crossAxis:c=!0}=xt(e,t),f={x:n,y:r},p=Lt(o),m=Hs(p);let g=f[m],v=f[p];const h=xt(a,t),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){const S=m==="y"?"height":"width",E=s.reference[m]-s.floating[S]+y.mainAxis,x=s.reference[m]+s.reference[S]-y.mainAxis;g<E?g=E:g>x&&(g=x)}if(c){var w,b;const S=m==="y"?"width":"height",E=["top","left"].includes(Ct(o)),x=s.reference[p]-s.floating[S]+(E&&((w=i.offset)==null?void 0:w[p])||0)+(E?0:y.crossAxis),P=s.reference[p]+s.reference[S]+(E?0:((b=i.offset)==null?void 0:b[p])||0)-(E?y.crossAxis:0);v<x?v=x:v>P&&(v=P)}return{[m]:g,[p]:v}}}},Py=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:u=()=>{},...c}=xt(e,t),f=await Rn(t,c),p=Ct(o),m=fn(o),g=Lt(o)==="y",{width:v,height:h}=s.floating;let y,w;p==="top"||p==="bottom"?(y=p,w=m===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(w=p,y=m==="end"?"top":"bottom");const b=h-f.top-f.bottom,S=v-f.left-f.right,E=$t(h-f[y],b),x=$t(v-f[w],S),P=!t.middlewareData.shift;let F=E,O=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(F=b),P&&!m){const D=Ve(f.left,0),q=Ve(f.right,0),k=Ve(f.top,0),z=Ve(f.bottom,0);g?O=v-2*(D!==0||q!==0?D+q:Ve(f.left,f.right)):F=h-2*(k!==0||z!==0?k+z:Ve(f.top,f.bottom))}await u({...t,availableWidth:O,availableHeight:F});const I=await i.getDimensions(a.floating);return v!==I.width||h!==I.height?{reset:{rects:!0}}:{}}}};function Ur(){return typeof window<"u"}function pn(e){return au(e)?(e.nodeName||"").toLowerCase():"#document"}function Be(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function at(e){var t;return(t=(au(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function au(e){return Ur()?e instanceof Node||e instanceof Be(e).Node:!1}function Ze(e){return Ur()?e instanceof Element||e instanceof Be(e).Element:!1}function lt(e){return Ur()?e instanceof HTMLElement||e instanceof Be(e).HTMLElement:!1}function lu(e){return!Ur()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Be(e).ShadowRoot}function Vn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Qe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Ay(e){return["table","td","th"].includes(pn(e))}function jr(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Gs(e){const t=qs(),n=Ze(e)?Qe(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function _y(e){let t=Rt(e);for(;lt(t)&&!gn(t);){if(Gs(t))return t;if(jr(t))return null;t=Rt(t)}return null}function qs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function gn(e){return["html","body","#document"].includes(pn(e))}function Qe(e){return Be(e).getComputedStyle(e)}function Wr(e){return Ze(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Rt(e){if(pn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||lu(e)&&e.host||at(e);return lu(t)?t.host:t}function cu(e){const t=Rt(e);return gn(t)?e.ownerDocument?e.ownerDocument.body:e.body:lt(t)&&Vn(t)?t:cu(t)}function Bn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=cu(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Be(o);if(s){const a=Ks(i);return t.concat(i,i.visualViewport||[],Vn(o)?o:[],a&&n?Bn(a):[])}return t.concat(o,Bn(o,[],n))}function Ks(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function uu(e){const t=Qe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=lt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Vr(n)!==s||Vr(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Xs(e){return Ze(e)?e:e.contextElement}function hn(e){const t=Xs(e);if(!lt(t))return it(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=uu(t);let i=(s?Vr(n.width):n.width)/r,a=(s?Vr(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Fy=it(0);function du(e){const t=Be(e);return!qs()||!t.visualViewport?Fy:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Oy(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Be(e)?!1:t}function Gt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Xs(e);let i=it(1);t&&(r?Ze(r)&&(i=hn(r)):i=hn(e));const a=Oy(s,n,r)?du(s):it(0);let u=(o.left+a.x)/i.x,c=(o.top+a.y)/i.y,f=o.width/i.x,p=o.height/i.y;if(s){const m=Be(s),g=r&&Ze(r)?Be(r):r;let v=m,h=Ks(v);for(;h&&r&&g!==v;){const y=hn(h),w=h.getBoundingClientRect(),b=Qe(h),S=w.left+(h.clientLeft+parseFloat(b.paddingLeft))*y.x,E=w.top+(h.clientTop+parseFloat(b.paddingTop))*y.y;u*=y.x,c*=y.y,f*=y.x,p*=y.y,u+=S,c+=E,v=Be(h),h=Ks(v)}}return Hr({width:f,height:p,x:u,y:c})}function Js(e,t){const n=Wr(e).scrollLeft;return t?t.left+n:Gt(at(e)).left+n}function fu(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:Js(e,r)),s=r.top+t.scrollTop;return{x:o,y:s}}function Dy(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=at(r),a=t?jr(t.floating):!1;if(r===i||a&&s)return n;let u={scrollLeft:0,scrollTop:0},c=it(1);const f=it(0),p=lt(r);if((p||!p&&!s)&&((pn(r)!=="body"||Vn(i))&&(u=Wr(r)),lt(r))){const g=Gt(r);c=hn(r),f.x=g.x+r.clientLeft,f.y=g.y+r.clientTop}const m=i&&!p&&!s?fu(i,u,!0):it(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-u.scrollLeft*c.x+f.x+m.x,y:n.y*c.y-u.scrollTop*c.y+f.y+m.y}}function My(e){return Array.from(e.getClientRects())}function Iy(e){const t=at(e),n=Wr(e),r=e.ownerDocument.body,o=Ve(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ve(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Js(e);const a=-n.scrollTop;return Qe(r).direction==="rtl"&&(i+=Ve(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}function ky(e,t){const n=Be(e),r=at(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,u=0;if(o){s=o.width,i=o.height;const c=qs();(!c||c&&t==="fixed")&&(a=o.offsetLeft,u=o.offsetTop)}return{width:s,height:i,x:a,y:u}}function $y(e,t){const n=Gt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=lt(e)?hn(e):it(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,u=o*s.x,c=r*s.y;return{width:i,height:a,x:u,y:c}}function pu(e,t,n){let r;if(t==="viewport")r=ky(e,n);else if(t==="document")r=Iy(at(e));else if(Ze(t))r=$y(t,n);else{const o=du(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Hr(r)}function gu(e,t){const n=Rt(e);return n===t||!Ze(n)||gn(n)?!1:Qe(n).position==="fixed"||gu(n,t)}function Ly(e,t){const n=t.get(e);if(n)return n;let r=Bn(e,[],!1).filter(a=>Ze(a)&&pn(a)!=="body"),o=null;const s=Qe(e).position==="fixed";let i=s?Rt(e):e;for(;Ze(i)&&!gn(i);){const a=Qe(i),u=Gs(i);!u&&a.position==="fixed"&&(o=null),(s?!u&&!o:!u&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Vn(i)&&!u&&gu(e,i))?r=r.filter(f=>f!==i):o=a,i=Rt(i)}return t.set(e,r),r}function Ry(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?jr(t)?[]:Ly(t,this._c):[].concat(n),r],a=i[0],u=i.reduce((c,f)=>{const p=pu(t,f,o);return c.top=Ve(p.top,c.top),c.right=$t(p.right,c.right),c.bottom=$t(p.bottom,c.bottom),c.left=Ve(p.left,c.left),c},pu(t,a,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function Vy(e){const{width:t,height:n}=uu(e);return{width:t,height:n}}function By(e,t,n){const r=lt(t),o=at(t),s=n==="fixed",i=Gt(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const u=it(0);if(r||!r&&!s)if((pn(t)!=="body"||Vn(o))&&(a=Wr(t)),r){const m=Gt(t,!0,s,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else o&&(u.x=Js(o));const c=o&&!r&&!s?fu(o,a):it(0),f=i.left+a.scrollLeft-u.x-c.x,p=i.top+a.scrollTop-u.y-c.y;return{x:f,y:p,width:i.width,height:i.height}}function Ys(e){return Qe(e).position==="static"}function hu(e,t){if(!lt(e)||Qe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return at(e)===n&&(n=n.ownerDocument.body),n}function mu(e,t){const n=Be(e);if(jr(e))return n;if(!lt(e)){let o=Rt(e);for(;o&&!gn(o);){if(Ze(o)&&!Ys(o))return o;o=Rt(o)}return n}let r=hu(e,t);for(;r&&Ay(r)&&Ys(r);)r=hu(r,t);return r&&gn(r)&&Ys(r)&&!Gs(r)?n:r||_y(e)||n}const zy=async function(e){const t=this.getOffsetParent||mu,n=this.getDimensions,r=await n(e.floating);return{reference:By(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Hy(e){return Qe(e).direction==="rtl"}const Uy={convertOffsetParentRelativeRectToViewportRelativeRect:Dy,getDocumentElement:at,getClippingRect:Ry,getOffsetParent:mu,getElementRects:zy,getClientRects:My,getDimensions:Vy,getScale:hn,isElement:Ze,isRTL:Hy};function jy(e,t){let n=null,r;const o=at(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,u){a===void 0&&(a=!1),u===void 0&&(u=1),s();const{left:c,top:f,width:p,height:m}=e.getBoundingClientRect();if(a||t(),!p||!m)return;const g=Br(f),v=Br(o.clientWidth-(c+p)),h=Br(o.clientHeight-(f+m)),y=Br(c),b={rootMargin:-g+"px "+-v+"px "+-h+"px "+-y+"px",threshold:Ve(0,$t(1,u))||1};let S=!0;function E(x){const P=x[0].intersectionRatio;if(P!==u){if(!S)return i();P?i(!1,P):r=setTimeout(()=>{i(!1,1e-7)},1e3)}S=!1}try{n=new IntersectionObserver(E,{...b,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,b)}n.observe(e)}return i(!0),s}function Wy(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,c=Xs(e),f=o||s?[...c?Bn(c):[],...Bn(t)]:[];f.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const p=c&&a?jy(c,n):null;let m=-1,g=null;i&&(g=new ResizeObserver(w=>{let[b]=w;b&&b.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var S;(S=g)==null||S.observe(t)})),n()}),c&&!u&&g.observe(c),g.observe(t));let v,h=u?Gt(e):null;u&&y();function y(){const w=Gt(e);h&&(w.x!==h.x||w.y!==h.y||w.width!==h.width||w.height!==h.height)&&n(),h=w,v=requestAnimationFrame(y)}return n(),()=>{var w;f.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),p==null||p(),(w=g)==null||w.disconnect(),g=null,u&&cancelAnimationFrame(v)}}const Gy=Ey,qy=Ny,Ky=xy,Xy=Py,Jy=Cy,vu=by,Yy=Ty,Zy=(e,t,n)=>{const r=new Map,o={platform:Uy,...n},s={...o.platform,_c:r};return wy(e,t,{...o,platform:s})};var Gr=typeof document<"u"?A.useLayoutEffect:A.useEffect;function qr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!qr(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!qr(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function yu(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function wu(e,t){const n=yu(e);return Math.round(t*n)/n}function Zs(e){const t=d.useRef(e);return Gr(()=>{t.current=e}),t}function Qy(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:u,open:c}=e,[f,p]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,g]=d.useState(r);qr(m,r)||g(r);const[v,h]=d.useState(null),[y,w]=d.useState(null),b=d.useCallback(K=>{K!==P.current&&(P.current=K,h(K))},[]),S=d.useCallback(K=>{K!==F.current&&(F.current=K,w(K))},[]),E=s||v,x=i||y,P=d.useRef(null),F=d.useRef(null),O=d.useRef(f),I=u!=null,D=Zs(u),q=Zs(o),k=Zs(c),z=d.useCallback(()=>{if(!P.current||!F.current)return;const K={placement:t,strategy:n,middleware:m};q.current&&(K.platform=q.current),Zy(P.current,F.current,K).then(Y=>{const le={...Y,isPositioned:k.current!==!1};R.current&&!qr(O.current,le)&&(O.current=le,Yn.flushSync(()=>{p(le)}))})},[m,t,n,q,k]);Gr(()=>{c===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,p(K=>({...K,isPositioned:!1})))},[c]);const R=d.useRef(!1);Gr(()=>(R.current=!0,()=>{R.current=!1}),[]),Gr(()=>{if(E&&(P.current=E),x&&(F.current=x),E&&x){if(D.current)return D.current(E,x,z);z()}},[E,x,z,D,I]);const J=d.useMemo(()=>({reference:P,floating:F,setReference:b,setFloating:S}),[b,S]),B=d.useMemo(()=>({reference:E,floating:x}),[E,x]),U=d.useMemo(()=>{const K={position:n,left:0,top:0};if(!B.floating)return K;const Y=wu(B.floating,f.x),le=wu(B.floating,f.y);return a?{...K,transform:"translate("+Y+"px, "+le+"px)",...yu(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:le}},[n,a,B.floating,f.x,f.y]);return d.useMemo(()=>({...f,update:z,refs:J,elements:B,floatingStyles:U}),[f,z,J,B,U])}const ew=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?vu({element:r.current,padding:o}).fn(n):{}:r?vu({element:r,padding:o}).fn(n):{}}}},tw=(e,t)=>({...Gy(e),options:[e,t]}),nw=(e,t)=>({...qy(e),options:[e,t]}),rw=(e,t)=>({...Yy(e),options:[e,t]}),ow=(e,t)=>({...Ky(e),options:[e,t]}),sw=(e,t)=>({...Xy(e),options:[e,t]}),iw=(e,t)=>({...Jy(e),options:[e,t]}),aw=(e,t)=>({...ew(e),options:[e,t]});var lw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],cw=lw.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Qt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),uw="Arrow",bu=d.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return l.jsx(cw.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});bu.displayName=uw;var dw=bu;function xu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function fw(...e){return t=>{let n=!1;const r=e.map(o=>{const s=xu(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():xu(e[o],null)}}}}function Cu(...e){return d.useCallback(fw(...e),e)}var pw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Su=pw.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Qt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Qs="Popper",[Eu,Nu]=Ot(Qs),[gw,Tu]=Eu(Qs),Pu=e=>{const{__scopePopper:t,children:n}=e,[r,o]=d.useState(null);return l.jsx(gw,{scope:t,anchor:r,onAnchorChange:o,children:n})};Pu.displayName=Qs;var Au="PopperAnchor",_u=d.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Tu(Au,n),i=d.useRef(null),a=Cu(t,i);return d.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||i.current)}),r?null:l.jsx(Su.div,{...o,ref:a})});_u.displayName=Au;var ei="PopperContent",[hw,mw]=Eu(ei),Fu=d.forwardRef((e,t)=>{var Ce,tt,je,nt,ft,Xt;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:u=!0,collisionBoundary:c=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:v,...h}=e,y=Tu(ei,n),[w,b]=d.useState(null),S=Cu(t,Pe=>b(Pe)),[E,x]=d.useState(null),P=Ua(E),F=(P==null?void 0:P.width)??0,O=(P==null?void 0:P.height)??0,I=r+(s!=="center"?"-"+s:""),D=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},q=Array.isArray(c)?c:[c],k=q.length>0,z={padding:D,boundary:q.filter(yw),altBoundary:k},{refs:R,floatingStyles:J,placement:B,isPositioned:U,middlewareData:K}=Qy({strategy:"fixed",placement:I,whileElementsMounted:(...Pe)=>Wy(...Pe,{animationFrame:g==="always"}),elements:{reference:y.anchor},middleware:[tw({mainAxis:o+O,alignmentAxis:i}),u&&nw({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?rw():void 0,...z}),u&&ow({...z}),sw({...z,apply:({elements:Pe,rects:pt,availableWidth:Cn,availableHeight:Bt})=>{const{width:io,height:C}=pt.reference,N=Pe.floating.style;N.setProperty("--radix-popper-available-width",`${Cn}px`),N.setProperty("--radix-popper-available-height",`${Bt}px`),N.setProperty("--radix-popper-anchor-width",`${io}px`),N.setProperty("--radix-popper-anchor-height",`${C}px`)}}),E&&aw({element:E,padding:a}),ww({arrowWidth:F,arrowHeight:O}),m&&iw({strategy:"referenceHidden",...z})]}),[Y,le]=Mu(B),ue=Ae(v);Re(()=>{U&&(ue==null||ue())},[U,ue]);const Ee=(Ce=K.arrow)==null?void 0:Ce.x,Ie=(tt=K.arrow)==null?void 0:tt.y,Ue=((je=K.arrow)==null?void 0:je.centerOffset)!==0,[Nt,Se]=d.useState();return Re(()=>{w&&Se(window.getComputedStyle(w).zIndex)},[w]),l.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...J,transform:U?J.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Nt,"--radix-popper-transform-origin":[(nt=K.transformOrigin)==null?void 0:nt.x,(ft=K.transformOrigin)==null?void 0:ft.y].join(" "),...((Xt=K.hide)==null?void 0:Xt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(hw,{scope:n,placedSide:Y,onArrowChange:x,arrowX:Ee,arrowY:Ie,shouldHideArrow:Ue,children:l.jsx(Su.div,{"data-side":Y,"data-align":le,...h,ref:S,style:{...h.style,animation:U?void 0:"none"}})})})});Fu.displayName=ei;var Ou="PopperArrow",vw={top:"bottom",right:"left",bottom:"top",left:"right"},Du=d.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=mw(Ou,r),i=vw[s.placedSide];return l.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:l.jsx(dw,{...o,ref:n,style:{...o.style,display:"block"}})})});Du.displayName=Ou;function yw(e){return e!==null}var ww=e=>({name:"transformOrigin",options:e,fn(t){var y,w,b;const{placement:n,rects:r,middlewareData:o}=t,i=((y=o.arrow)==null?void 0:y.centerOffset)!==0,a=i?0:e.arrowWidth,u=i?0:e.arrowHeight,[c,f]=Mu(n),p={start:"0%",center:"50%",end:"100%"}[f],m=(((w=o.arrow)==null?void 0:w.x)??0)+a/2,g=(((b=o.arrow)==null?void 0:b.y)??0)+u/2;let v="",h="";return c==="bottom"?(v=i?p:`${m}px`,h=`${-u}px`):c==="top"?(v=i?p:`${m}px`,h=`${r.floating.height+u}px`):c==="right"?(v=`${-u}px`,h=i?p:`${g}px`):c==="left"&&(v=`${r.floating.width+u}px`,h=i?p:`${g}px`),{data:{x:v,y:h}}}});function Mu(e){const[t,n="center"]=e.split("-");return[t,n]}var bw=Pu,xw=_u,Cw=Fu,Sw=Du,Ew="Portal",Iu=d.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=d.useState(!1);Re(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?uo.createPortal(l.jsx(Ln.div,{...r,ref:t}),i):null});Iu.displayName=Ew;function Nw(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var ti=e=>{const{present:t,children:n}=e,r=Tw(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=$n(r.ref,Pw(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};ti.displayName="Presence";function Tw(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[a,u]=Nw(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const c=Kr(r.current);s.current=a==="mounted"?c:"none"},[a]),Re(()=>{const c=r.current,f=o.current;if(f!==e){const m=s.current,g=Kr(c);e?u("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?u("UNMOUNT"):u(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Re(()=>{if(t){let c;const f=t.ownerDocument.defaultView??window,p=g=>{const h=Kr(r.current).includes(g.animationName);if(g.target===t&&h&&(u("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",c=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=g=>{g.target===t&&(s.current=Kr(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(c),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:d.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function Kr(e){return(e==null?void 0:e.animationName)||"none"}function Pw(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Aw="VisuallyHidden",ku=d.forwardRef((e,t)=>l.jsx(Ln.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));ku.displayName=Aw;var _w=ku,[Xr,hC]=Ot("Tooltip",[Nu]),Jr=Nu(),$u="TooltipProvider",Fw=700,ni="tooltip.open",[Ow,ri]=Xr($u),Lu=e=>{const{__scopeTooltip:t,delayDuration:n=Fw,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,[i,a]=d.useState(!0),u=d.useRef(!1),c=d.useRef(0);return d.useEffect(()=>{const f=c.current;return()=>window.clearTimeout(f)},[]),l.jsx(Ow,{scope:t,isOpenDelayed:i,delayDuration:n,onOpen:d.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:d.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:d.useCallback(f=>{u.current=f},[]),disableHoverableContent:o,children:s})};Lu.displayName=$u;var Yr="Tooltip",[Dw,zn]=Xr(Yr),Ru=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=e,u=ri(Yr,e.__scopeTooltip),c=Jr(t),[f,p]=d.useState(null),m=on(),g=d.useRef(0),v=i??u.disableHoverableContent,h=a??u.delayDuration,y=d.useRef(!1),[w=!1,b]=nn({prop:r,defaultProp:o,onChange:F=>{F?(u.onOpen(),document.dispatchEvent(new CustomEvent(ni))):u.onClose(),s==null||s(F)}}),S=d.useMemo(()=>w?y.current?"delayed-open":"instant-open":"closed",[w]),E=d.useCallback(()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,b(!0)},[b]),x=d.useCallback(()=>{window.clearTimeout(g.current),g.current=0,b(!1)},[b]),P=d.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{y.current=!0,b(!0),g.current=0},h)},[h,b]);return d.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]),l.jsx(bw,{...c,children:l.jsx(Dw,{scope:t,contentId:m,open:w,stateAttribute:S,trigger:f,onTriggerChange:p,onTriggerEnter:d.useCallback(()=>{u.isOpenDelayed?P():E()},[u.isOpenDelayed,P,E]),onTriggerLeave:d.useCallback(()=>{v?x():(window.clearTimeout(g.current),g.current=0)},[x,v]),onOpen:E,onClose:x,disableHoverableContent:v,children:n})})};Ru.displayName=Yr;var oi="TooltipTrigger",Vu=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=zn(oi,n),s=ri(oi,n),i=Jr(n),a=d.useRef(null),u=$n(t,a,o.onTriggerChange),c=d.useRef(!1),f=d.useRef(!1),p=d.useCallback(()=>c.current=!1,[]);return d.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),l.jsx(xw,{asChild:!0,...i,children:l.jsx(Ln.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:bt(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:bt(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:bt(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:bt(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:bt(e.onBlur,o.onClose),onClick:bt(e.onClick,o.onClose)})})});Vu.displayName=oi;var si="TooltipPortal",[Mw,Iw]=Xr(si,{forceMount:void 0}),Bu=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=zn(si,t);return l.jsx(Mw,{scope:t,forceMount:n,children:l.jsx(ti,{present:n||s.open,children:l.jsx(Iu,{asChild:!0,container:o,children:r})})})};Bu.displayName=si;var mn="TooltipContent",zu=d.forwardRef((e,t)=>{const n=Iw(mn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=zn(mn,e.__scopeTooltip);return l.jsx(ti,{present:r||i.open,children:i.disableHoverableContent?l.jsx(Hu,{side:o,...s,ref:t}):l.jsx(kw,{side:o,...s,ref:t})})}),kw=d.forwardRef((e,t)=>{const n=zn(mn,e.__scopeTooltip),r=ri(mn,e.__scopeTooltip),o=d.useRef(null),s=$n(t,o),[i,a]=d.useState(null),{trigger:u,onClose:c}=n,f=o.current,{onPointerInTransitChange:p}=r,m=d.useCallback(()=>{a(null),p(!1)},[p]),g=d.useCallback((v,h)=>{const y=v.currentTarget,w={x:v.clientX,y:v.clientY},b=Vw(w,y.getBoundingClientRect()),S=Bw(w,b),E=zw(h.getBoundingClientRect()),x=Uw([...S,...E]);a(x),p(!0)},[p]);return d.useEffect(()=>()=>m(),[m]),d.useEffect(()=>{if(u&&f){const v=y=>g(y,f),h=y=>g(y,u);return u.addEventListener("pointerleave",v),f.addEventListener("pointerleave",h),()=>{u.removeEventListener("pointerleave",v),f.removeEventListener("pointerleave",h)}}},[u,f,g,m]),d.useEffect(()=>{if(i){const v=h=>{const y=h.target,w={x:h.clientX,y:h.clientY},b=(u==null?void 0:u.contains(y))||(f==null?void 0:f.contains(y)),S=!Hw(w,i);b?m():S&&(m(),c())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[u,f,i,c,m]),l.jsx(Hu,{...e,ref:s})}),[$w,Lw]=Xr(Yr,{isInside:!1}),Hu=d.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,u=zn(mn,n),c=Jr(n),{onClose:f}=u;return d.useEffect(()=>(document.addEventListener(ni,f),()=>document.removeEventListener(ni,f)),[f]),d.useEffect(()=>{if(u.trigger){const p=m=>{const g=m.target;g!=null&&g.contains(u.trigger)&&f()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[u.trigger,f]),l.jsx(eu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:f,children:l.jsxs(Cw,{"data-state":u.stateAttribute,...c,...a,ref:t,style:{...a.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:[l.jsx(Pa,{children:r}),l.jsx($w,{scope:n,isInside:!0,children:l.jsx(_w,{id:u.contentId,role:"tooltip",children:o||r})})]})})});zu.displayName=mn;var Uu="TooltipArrow",Rw=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Jr(n);return Lw(Uu,n).isInside?null:l.jsx(Sw,{...o,...r,ref:t})});Rw.displayName=Uu;function Vw(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Bw(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function zw(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function Hw(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s].x,u=t[s].y,c=t[i].x,f=t[i].y;u>r!=f>r&&n<(c-a)*(r-u)/(f-u)+a&&(o=!o)}return o}function Uw(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),jw(t)}function jw(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Ww=Lu,Gw=Ru,qw=Vu,Kw=Bu,ju=zu;const vn=Ww,yn=Gw,wn=qw,qt=d.forwardRef(({className:e,sideOffset:t=4,...n},r)=>l.jsx(Kw,{children:l.jsx(ju,{ref:r,sideOffset:t,className:ee("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",e),...n})}));qt.displayName=ju.displayName;function Xw({title:e,titleId:t,...n},r){return d.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":t},n),e?d.createElement("title",{id:t},e):null,d.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 Jw=d.forwardRef(Xw);var Yw=function(e){return function(t,n){var r=A.useRef(!1);e(function(){return function(){r.current=!1}},[]),e(function(){if(!r.current)r.current=!0;else return t()},n)}},Wu=function(e){return typeof e=="function"},Gu=process.env.NODE_ENV==="development"||process.env.NODE_ENV==="test";const Zw=Yw(A.useEffect);function qu(e){var t=A.useRef(e);return t.current=e,t}var Qw=function(e){Gu&&(Wu(e)||console.error("useUnmount expected parameter is a function, got ".concat(typeof e)));var t=qu(e);A.useEffect(function(){return function(){t.current()}},[])},Zr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function eb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function tb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ku=tb,nb=typeof Zr=="object"&&Zr&&Zr.Object===Object&&Zr,rb=nb,ob=rb,sb=typeof self=="object"&&self&&self.Object===Object&&self,ib=ob||sb||Function("return this")(),Xu=ib,ab=Xu,lb=function(){return ab.Date.now()},cb=lb,ub=/\s/;function db(e){for(var t=e.length;t--&&ub.test(e.charAt(t)););return t}var fb=db,pb=fb,gb=/^\s+/;function hb(e){return e&&e.slice(0,pb(e)+1).replace(gb,"")}var mb=hb,vb=Xu,yb=vb.Symbol,Ju=yb,Yu=Ju,Zu=Object.prototype,wb=Zu.hasOwnProperty,bb=Zu.toString,Hn=Yu?Yu.toStringTag:void 0;function xb(e){var t=wb.call(e,Hn),n=e[Hn];try{e[Hn]=void 0;var r=!0}catch{}var o=bb.call(e);return r&&(t?e[Hn]=n:delete e[Hn]),o}var Cb=xb,Sb=Object.prototype,Eb=Sb.toString;function Nb(e){return Eb.call(e)}var Tb=Nb,Qu=Ju,Pb=Cb,Ab=Tb,_b="[object Null]",Fb="[object Undefined]",ed=Qu?Qu.toStringTag:void 0;function Ob(e){return e==null?e===void 0?Fb:_b:ed&&ed in Object(e)?Pb(e):Ab(e)}var Db=Ob;function Mb(e){return e!=null&&typeof e=="object"}var Ib=Mb,kb=Db,$b=Ib,Lb="[object Symbol]";function Rb(e){return typeof e=="symbol"||$b(e)&&kb(e)==Lb}var Vb=Rb,Bb=mb,td=Ku,zb=Vb,nd=NaN,Hb=/^[-+]0x[0-9a-f]+$/i,Ub=/^0b[01]+$/i,jb=/^0o[0-7]+$/i,Wb=parseInt;function Gb(e){if(typeof e=="number")return e;if(zb(e))return nd;if(td(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=td(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Bb(e);var n=Ub.test(e);return n||jb.test(e)?Wb(e.slice(2),n?2:8):Hb.test(e)?nd:+e}var qb=Gb,Kb=Ku,ii=cb,rd=qb,Xb="Expected a function",Jb=Math.max,Yb=Math.min;function Zb(e,t,n){var r,o,s,i,a,u,c=0,f=!1,p=!1,m=!0;if(typeof e!="function")throw new TypeError(Xb);t=rd(t)||0,Kb(n)&&(f=!!n.leading,p="maxWait"in n,s=p?Jb(rd(n.maxWait)||0,t):s,m="trailing"in n?!!n.trailing:m);function g(P){var F=r,O=o;return r=o=void 0,c=P,i=e.apply(O,F),i}function v(P){return c=P,a=setTimeout(w,t),f?g(P):i}function h(P){var F=P-u,O=P-c,I=t-F;return p?Yb(I,s-O):I}function y(P){var F=P-u,O=P-c;return u===void 0||F>=t||F<0||p&&O>=s}function w(){var P=ii();if(y(P))return b(P);a=setTimeout(w,h(P))}function b(P){return a=void 0,m&&r?g(P):(r=o=void 0,i)}function S(){a!==void 0&&clearTimeout(a),c=0,r=u=o=a=void 0}function E(){return a===void 0?i:b(ii())}function x(){var P=ii(),F=y(P);if(r=arguments,o=this,u=P,F){if(a===void 0)return v(u);if(p)return clearTimeout(a),a=setTimeout(w,t),g(u)}return a===void 0&&(a=setTimeout(w,t)),i}return x.cancel=S,x.flush=E,x}var Qb=Zb;const ex=eb(Qb);function tx(){var e=(typeof global>"u"?"undefined":typeof global)=="object"&&global&&global.Object===Object&&global,t=typeof self=="object"&&self&&self.Object===Object&&self;return e||t}tx()||(global.Date=Date);function nx(e,t){var n;Gu&&(Wu(e)||console.error("useDebounceFn expected parameter is a function, got ".concat(typeof e)));var r=qu(e),o=(n=t==null?void 0:t.wait)!==null&&n!==void 0?n:1e3,s=A.useMemo(function(){return ex(function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];return r.current.apply(r,fl([],dl(i),!1))},o,t)},[]);return Qw(function(){s.cancel()}),{run:s,cancel:s.cancel,flush:s.flush}}function rx(e,t,n){var r=dl(A.useState({}),2),o=r[0],s=r[1],i=nx(function(){s({})},n).run;A.useEffect(function(){return i()},t),Zw(e,[o])}const ox=A.forwardRef(({onChange:e},t)=>{const n=A.useRef(null),[r,o]=A.useState("");return A.useImperativeHandle(t,()=>({setValue:s=>{var i;o(s),(i=n.current)==null||i.focus()}})),rx(()=>{e==null||e(r)},[r],{wait:300}),l.jsxs(l.Fragment,{children:[l.jsx(kt,{ref:n,type:"text",placeholder:"Search files...",value:r,onChange:s=>o(s.target.value),className:"pr-8"}),r&&l.jsx("button",{onClick:()=>{var s;o(""),(s=n.current)==null||s.focus()},className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700",children:l.jsx(Jw,{className:"h-5 w-5"})})]})}),sx=({openDialogRename:e,setOpenDialogRename:t,apiBaseUrl:n,setFileToMove:r,fileToMove:o,refreshFiles:s,ignoreCache:i})=>{var b;const[a,u]=A.useState({}),[c,f]=A.useState(!1),[p,m]=A.useState(!1),[g,v]=A.useState(""),{toast:h}=Rr();A.useEffect(()=>{e&&y(g)},[g,e]);const y=async S=>{try{m(!0);const E=await oe.get(`${n}/api/list-s3-folders?prefix=${S}`);u(E==null?void 0:E.data)}catch{h({title:"Error",description:"Unable to load S3 folder list",variant:"destructive"})}finally{m(!1)}},w=async()=>{f(!0);try{const S=o.key;await oe.post(`${n}/api/move`,{oldPath:S,newPath:g}),i.current=!0,await s(),h({title:"Đã đổi tên",description:`Đã đổi tên thành công "${o.name}" thành "${g}"`}),t(!1),r(null),v("")}catch(S){console.error("Error renaming item:",S),h({title:"Lỗi",description:"Không thể đổi tên",variant:"destructive"})}finally{f(!1)}};return l.jsx(It,{open:e,onOpenChange:S=>{S||(t(!1),r(null),v(""))},children:l.jsxs(vt,{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:[l.jsxs(yt,{className:"mb-4 w-full h-full",children:[l.jsx("nav",{className:"mb-4",children:l.jsxs("ul",{className:"flex items-center space-x-2 text-sm text-gray-600",children:[l.jsx("li",{className:"cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>v(""),children:"Root"}),g.split("/").map((S,E,x)=>l.jsx("li",{className:"cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>v(S==="Root"?"":x.slice(0,E+1).join("/")+"/"),children:S},E))]})}),l.jsxs(wt,{className:"text-xl font-semibold text-gray-800",children:["Di chuyển"," ",l.jsxs("span",{className:"text-sm text-gray-500",children:["( file Hoặc folder sẽ được di chuyển đến thư mục"," ",g===""?"Root":g," )"]})]}),l.jsx(Mn,{className:"text-gray-600 w-full h-[50dvh] max-h-[500px] overflow-hidden overflow-y-auto",children:p?l.jsx("div",{className:"flex justify-center items-center py-4",children:l.jsx("div",{className:"loader ease-linear rounded-full border-4 border-t-4 border-gray-200 h-12 w-12"})}):l.jsx("ul",{className:"space-y-2",children:(b=Object.keys(a))==null?void 0:b.map(S=>l.jsx("li",{className:"cursor-pointer hover:bg-gray-100 p-2 rounded transition-colors",onClick:()=>v(S),children:S},S))})})]}),l.jsxs(un,{className:"flex justify-end space-x-2",children:[l.jsx(ie,{variant:"outline",onClick:()=>t(!1),className:"px-4 py-2 rounded border border-gray-300 text-gray-700 hover:bg-gray-100 transition-colors",children:"Cancel"}),l.jsx(ie,{onClick:w,disabled:c,className:"s3-explr-crawl-btn",children:"Move"})]})]})})},_e={current:!1},od="crawl:jobs",bn="crawl:current_job",ix=e=>{const[t,n]=A.useState(null),[r,o]=A.useState(0);return A.useEffect(()=>{const s=localStorage.getItem(bn);if(s){const i=JSON.parse(s);n(i),i!=null&&i.startTime&&o(Math.floor((Date.now()-i.startTime)/1e3))}},[]),A.useEffect(()=>{if(!(t!=null&&t.startTime))return;const s=setInterval(()=>{o(Math.floor((Date.now()-t.startTime)/1e3))},1e3);return()=>clearInterval(s)},[t==null?void 0:t.startTime]),A.useEffect(()=>{if(!(t!=null&&t.id))return;const s=async()=>{try{const u=(await oe.get(`${e}/api/crawl/${t.id}?taskId=${t.taskId}`)).data;n(c=>{if(!c)return null;const f={...c,status:u};return localStorage.setItem(bn,JSON.stringify(f)),(u.status==="completed"||u.status==="failed")&&setTimeout(()=>{n(null),localStorage.removeItem(bn)},100),f})}catch(a){console.error("Error polling job status:",a)}},i=setInterval(s,3e3);return s(),()=>clearInterval(i)},[t==null?void 0:t.id,e]),{currentJob:t,elapsedTime:r,setCurrentJob:s=>{s&&!s.startTime&&(s.startTime=Date.now()),n(s),s?localStorage.setItem(bn,JSON.stringify(s)):localStorage.removeItem(bn)}}},ax=(e,t,n)=>{const r=[],o=s=>{(e[s]||[]).forEach(a=>{a.name.toLowerCase().includes(t.toLowerCase())&&r.push(a),a.isFolder&&a.key.startsWith(n)&&o(a.key)})};return o(n),r},Qr=(e,t)=>{const n=[],r=o=>{(e[o]||[]).forEach(i=>{n.push(i.key),i.isFolder&&r(i.key)})};return r(t),n},lx=(e,t)=>{const n=[];return(e[t]||[]).forEach(o=>{n.push(o.key),o.isFolder&&n.push(...Qr(e,o.key))}),n},cx=(e,t,n=[])=>{const[r,o]=A.useState({}),[s,i]=A.useState(!1),[a,u]=A.useState(null),c=A.useRef(t);A.useEffect(()=>{c.current=t},[t]);const f=async()=>{i(!0);try{const p=!_e.current;_e.current&&(_e.current=!1);const m=await oe.get(`${e}/api/files`,{params:{cache:p,displayPrefixes:JSON.stringify(n),prefix:c.current},timeout:3e5});o(m.data),u(null)}catch(p){u(p instanceof Error?p:new Error("Failed to fetch files"))}finally{i(!1)}};return A.useEffect(()=>{f()},[]),{data:r,isLoading:s,error:a,refetch:f}},Un=e=>{var r,o,s;const t=((s=(o=(r=e==null?void 0:e.name)==null?void 0:r.split("."))==null?void 0:o.pop())==null?void 0:s.toLowerCase())??"";return["txt","md","json","js","ts","jsx","tsx","css","html","xml","yaml","yml"].includes(t||"")},ux=A.memo(({homeLabel:e="Kho tài liệu",apiBaseUrl:t="https://s3-explorer.cmcts1.studio.ai.vn",rootPrefix:n="",asSelector:r=!1,onSelected:o=a=>console.log("Đã chọn:",a),displayPrefixes:s,preSelectedFiles:i})=>{var Fd;const[a,u]=A.useState(""),[c,f]=A.useState(new Set),[p,m]=A.useState(n),[g,v]=A.useState(null),[h,y]=A.useState(!1),[w,b]=A.useState(""),[S,E]=A.useState(!1),[x,P]=A.useState(null),[F,O]=A.useState(null),[I,D]=A.useState(!1),[q,k]=A.useState(!1),[z,R]=A.useState(null),J=A.useRef(null),{toast:B}=Rr(),[U,K]=A.useState(null),[Y,le]=A.useState(null),[ue,Ee]=A.useState(""),[Ie,Ue]=A.useState(!1),[Nt,Se]=A.useState(!1),[Ce,tt]=A.useState(new Set),[je,nt]=A.useState(""),[ft,Xt]=A.useState(!1),[Pe,pt]=A.useState(!1),[Cn,Bt]=A.useState("rename"),[io,C]=A.useState(!1),[N,_]=A.useState(""),[H,V]=A.useState("1"),[L,X]=A.useState(!1),[se,me]=A.useState(!1),[ve,gt]=A.useState(!1),[ao,Sn]=A.useState(!1),{currentJob:ce,elapsedTime:En,setCurrentJob:Xn}=ix(t),bi=g||n,{data:ke,isLoading:xi,error:kx,refetch:We}=cx(t,bi,s);A.useEffect(()=>{const M=new Set(i);f(M)},[]),A.useEffect(()=>{ce!=null&&ce.status&&(ce.status.status==="completed"?(B({title:"Thu thập website hoàn tất",description:`Đã thu thập thành công ${ce.url} với ${ce.status.completed} trang`}),_e.current=!0,We()):ce.status.status==="failed"&&B({title:"Thu thập website thất bại",description:`Không thể thu thập ${ce.url}. Vui lòng thử lại.`,variant:"destructive"}))},[(Fd=ce==null?void 0:ce.status)==null?void 0:Fd.status]);const Nd=A.useMemo(()=>ke[p]||[],[ke,p]),Jt=A.useMemo(()=>a?ax(ke,a,p):Nd,[Nd,a,p,ke]),Jn=A.useMemo(()=>{const M={};return Jt.forEach(($,j)=>{c.has($.key)&&(M[j]=!0)}),M},[c,Jt]),$x=M=>{const $=Qr(ke,M);if($.length===0)return c.has(M)?"all":"none";const j=$.filter(G=>c.has(G)).length;return j===0?"none":j===$.length?"all":"partial"},lo=M=>{Sn(!0),v(M),m(M)};A.useEffect(()=>{ao&&(_e.current=!0,We().finally(()=>Sn(!1)))},[ao]);const Lx=async(M,$)=>{E(!0);try{const j=`${$}${M}/`;if((await oe.post(`${t}/api/create-folder`,{prefix:j})).status!==200){B({title:"Lỗi",description:"Không thể tạo thư mục",variant:"destructive"});return}_e.current=!0,await We(),B({title:"Đã tạo thư mục",description:`Đã tạo thành công thư mục "${M}"`}),b(""),y(!1)}catch(j){console.error("Error creating folder:",j),B({title:"Lỗi",description:"Không thể tạo thư mục",variant:"destructive"})}finally{E(!1)}},Td=async(M,$,j)=>{R(j),me(!0);try{if(ug(M,B))return;let G=localStorage.getItem("dataLogin"),te;try{G&&(G=JSON.parse(G),te=G.user)}catch{G=null}const ae=new FormData;ae.append("prefix",$),Array.from(M).forEach(ge=>ae.append("files",ge)),te!=null&&te.id&&(console.log("🚀 ~ uploadFiles ~ user:",te),ae.append("metadata",JSON.stringify({creator:te.username,creatorId:te.id,DataSource:"Tệp tải lên"}))),await oe.post(`${t}/api/upload`,ae,{headers:{"Content-Type":"multipart/form-data"}}),v($),_e.current=!0,await We()}catch(G){console.error("Lỗi tải lên:",G)}finally{R(null),me(!1)}},Rx=async M=>{var $;gt(!0);try{await oe.delete(`${t}/api/files`,{data:{paths:[M.key]}});const j=(($=M.key)==null?void 0:$.replace(/^(.*?)(\/.*)?$/,(G,te,ae)=>!ae||ae==="/"?"":te+"/"))||"";v(j),_e.current=!0,B({title:"Đã xóa tập tin",description:`Đã xóa thành công "${M.name}"`}),P(null)}catch(j){console.error("Error deleting file:",j),B({title:"Lỗi",description:"Không thể xóa tập tin",variant:"destructive"})}finally{gt(!1),await We()}},co=M=>{const $=new Set(c),j=typeof M=="function"?M(Jn):M;new Set(Object.keys(Jn).map(Number)).forEach(te=>{const ae=Jt[te];ae&&(j[te]||($.delete(ae.key),ae.isFolder&&Qr(ke,ae.key).forEach(ge=>$.delete(ge))))}),Object.entries(j).forEach(([te,ae])=>{const ge=parseInt(te),Tt=Jt[ge];Tt&&ae&&($.add(Tt.key),Tt.isFolder&&Qr(ke,Tt.key).forEach(Si=>$.add(Si)))}),f($)},Vx=async()=>{var M;D(!0);try{const $=Array.from(c),j=$.map(te=>Object.values(ke).flat().find(ae=>ae.key===te)).filter(te=>te!==void 0);if(j.length===0){B({title:"Lỗi",description:"Không có tập tin nào được chọn để xóa",variant:"destructive"});return}await oe.delete(`${t}/api/files`,{data:{paths:$}});const G=((M=j[0])==null?void 0:M.key.replace(/^(.*?)(\/.*)?$/,(te,ae,ge)=>!ge||ge==="/"?"":ae+"/"))||"";v(G),_e.current=!0,We(),B({title:"Đã xóa tập tin",description:`Đã xóa thành công ${j.length} mục`}),k(!1),f(new Set)}catch($){console.error("Error deleting files:",$),B({title:"Lỗi",description:"Không thể xóa các tập tin đã chọn",variant:"destructive"})}finally{D(!1)}},Bx=async(M,$)=>{Se(!0);try{const j=M.key;let G;M.isFolder?G=j.split("/").slice(0,-2).join("/")+"/":G=j.substring(0,j.lastIndexOf("/")+1);const te=G+$+(M.isFolder?"/":"");await oe.post(`${t}/api/rename`,{oldPath:j,newPath:te}),_e.current=!0,await We(),B({title:"Đã đổi tên",description:`Đã đổi tên thành công "${M.name}" thành "${$}"`}),K(null),Ee(""),le(null)}catch(j){console.error("Error renaming item:",j),B({title:"Lỗi",description:"Không thể đổi tên",variant:"destructive"})}finally{Se(!1)}},Pd=async M=>{tt($=>new Set([...$,...M]));try{const $=await oe.post(`${t}/api/download`,{paths:M},{responseType:"blob"}),j=window.URL.createObjectURL($.data),G=document.createElement("a");G.href=j;const te=$.headers["Content-Disposition"]||$.headers["content-disposition"],ae=te==null?void 0:te.match(/filename="(.+)"/),ge=ae?decodeURIComponent(ae[1]):"download.zip";G.setAttribute("download",ge),document.body.appendChild(G),G.click(),document.body.removeChild(G),window.URL.revokeObjectURL(j),B({title:"Bắt đầu tải xuống",description:`Đã bắt đầu tải xuống ${M.length} mục${M.length>1,""}`})}catch($){console.error("Error downloading files:",$),B({title:"Lỗi",description:"Không thể tải xuống tập tin",variant:"destructive"})}finally{tt($=>{const j=new Set($);return M.forEach(G=>j.delete(G)),j})}},Ad=p?p.replace(n,"").split("/").filter(Boolean):[],zx=()=>Array.from(c).map(M=>{var $;for(const j in ke){const G=($=ke[j])==null?void 0:$.find(te=>te.key===M);if(G)return G}return null}).filter(M=>M!==null),_d=A.useMemo(()=>{const M=[{id:"select",header:()=>{const $=lx(ke,p),j=$.length>0&&$.every(te=>c.has(te)),G=$.some(te=>c.has(te));return l.jsx(es,{checked:j?!0:G?"indeterminate":!1,onCheckedChange:te=>{if(te){const ae=Jt.reduce((ge,Tt,Si)=>(ge[Si]=!0,ge),{});co(ae)}else co({})},"aria-label":"Chọn tất cả"})},cell:({row:$})=>{const j=$.original,te=j.isFolder?$x(j.key):c.has(j.key)?"all":"none";return l.jsx("div",{className:"flex items-center",children:l.jsx(es,{checked:te==="partial"?"indeterminate":te==="all",onCheckedChange:ae=>{const ge={...Jn};ae?ge[$.index]=!0:delete ge[$.index],co(ge)},"aria-label":"Chọn dòng"})})},enableSorting:!1},{id:"fileName",header:"Tên tập tin",accessorKey:"name",cell:({row:$})=>{const j=$.original,G=j.key.substring(0,j.key.lastIndexOf("/"))||"/",te=a.trim()!==""&&G!==p,ae=G.split("/").filter(Boolean);return l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("div",{className:`flex items-center gap-2 ${j.isFolder?"cursor-pointer hover:text-blue-600":""}`,onClick:()=>{j.isFolder&&lo(j.key)},children:[j.isFolder?l.jsx(fo,{className:"h-5 w-5 text-blue-500"}):null,j.name]}),te&&l.jsxs("div",{className:"text-sm text-gray-500 flex items-center",children:[l.jsx(fo,{className:"h-4 w-4 text-gray-500 my-auto"}),l.jsxs("span",{className:"flex items-center ml-1",children:[l.jsx("span",{className:"cursor-pointer hover:text-blue-600",onClick:()=>{lo("")},children:"/"}),ae.map((ge,Tt)=>l.jsxs("span",{className:"flex items-center",children:[l.jsx("span",{className:"cursor-pointer hover:text-blue-600",onClick:()=>{lo(ae.slice(0,Tt+1).join("/")+"/")},children:ge}),Tt<ae.length-1&&l.jsx("span",{children:"/"})]},Tt))]})]})]})}}];return r||M.push({id:"size",header:"Kích thước",accessorKey:"size",cell:({getValue:$,row:j})=>{const G=$();return l.jsx("span",{children:j.original.isFolder?"-":Gg(G)})}},{id:"lastModified",header:"Sửa đổi lần cuối",accessorKey:"lastModified",cell:({row:$})=>{const j=$.original.lastModified;return l.jsx("span",{children:j.toLocaleString()})}},{id:"actions",header:"Hành động",accessorKey:"key",cell:({row:$})=>l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(vn,{children:l.jsxs(yn,{children:[l.jsx(wn,{asChild:!0,children:l.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>Pd([$.original.key]),className:"h-8 w-8 p-0",disabled:Ce.has($.original.key),children:Ce.has($.original.key)?l.jsx(ye,{className:"h-4 w-4 animate-spin"}):l.jsx(Ni,{className:"h-4 w-4"})})}),l.jsx(qt,{children:"Tải xuống"})]})}),l.jsx(vn,{children:l.jsxs(yn,{children:[l.jsx(wn,{asChild:!0,children:l.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>{K($.original),Ee($.original.name)},className:"h-8 w-8 p-0",children:l.jsx(Hd,{className:"h-4 w-4"})})}),l.jsx(qt,{children:"Đổi tên"})]})}),l.jsx(vn,{children:l.jsxs(yn,{children:[l.jsx(wn,{asChild:!0,children:l.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>{Ue(!0),O($.original)},className:"h-8 w-8 p-0",children:l.jsx(sg,{className:"h-4 w-4"})})}),l.jsx(qt,{children:"Di chuyển"})]})}),l.jsx(vn,{children:l.jsxs(yn,{children:[l.jsx(wn,{asChild:!0,children:l.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>P($.original),className:"h-8 w-8 p-0",children:l.jsx(Ti,{className:"h-4 w-4"})})}),l.jsx(qt,{children:"Xóa"})]})})]})}),M},[c,Jt,Jn,Ce,r]),Ci=Vi({data:Jt,columns:_d,state:{rowSelection:Jn},enableRowSelection:!0,onRowSelectionChange:co,getCoreRowModel:Ri()}),Hx=async M=>{var $,j;Xt(!0);try{if(Un(M)){const G=await oe.get(`${t}/api/read-text`,{params:{path:M.key}});nt(G.data.content)}try{const G=await oe.get(`${t}/api/read-json`,{params:{path:M.key+".metadata.json"}}),te=((j=($=G==null?void 0:G.data)==null?void 0:$.content)==null?void 0:j.metadataAttributes)||null;return le({fullPath:U==null?void 0:U.key,...te})}catch{return le("Lỗi phân tích siêu dữ liệu")}}catch(G){console.error("Error loading file content:",G),B({title:"Lỗi",description:"Không thể tải nội dung tập tin",variant:"destructive"})}finally{Xt(!1)}},Ux=async(M,$)=>{pt(!0);try{await oe.post(`${t}/api/modify-text`,{path:M.key,content:$}),B({title:"Đã lưu tập tin",description:"Nội dung tập tin đã được cập nhật thành công"}),_e.current=!0,await We(),K(null),nt(""),Bt("rename")}catch(j){console.error("Error saving file content:",j),B({title:"Lỗi",description:"Không thể lưu nội dung tập tin",variant:"destructive"})}finally{pt(!1)}},jx=async M=>{pt(!0);try{console.log("🚀 ~ saveJsonFile ~ metadataForEdit:",Y),await oe.post(`${t}/api/modify-json`,{path:M.key+".metadata.json",content:{metadataAttributes:Y}}),B({title:"Đã lưu tập tin",description:"Nội dung tập tin đã được cập nhật thành công"}),_e.current=!0,await We(),K(null),nt(""),Bt("rename")}catch($){console.error("Error saving file content:",$),B({title:"Lỗi",description:"Không thể lưu nội dung tập tin",variant:"destructive"})}finally{pt(!1)}};A.useEffect(()=>{U&&(U.isFolder||Hx(U),Bt("rename"))},[U]);const Wx=async(M,$)=>{var j;if(ce){B({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}X(!0);try{const{data:G}=await oe.post(`${t}/api/crawl`,{url:M,limit:$,prefix:p});if(G.id){Xn({id:G.id,url:M,limit:$,prefix:p,taskId:((j=G.task)==null?void 0:j.id)||""});const te=localStorage.getItem(od),ae=te?JSON.parse(te):[];ae.some(ge=>ge.id===G.id)||(ae.unshift({url:M,id:G.id,limit:$,prefix:p,timestamp:Date.now()}),ae.length>20&&(ae.length=20),localStorage.setItem(od,JSON.stringify(ae))),B({title:"Bắt đầu thu thập website",description:`Đã thêm nhiệm vụ thu thập ${M} với giới hạn ${$}. Dữ liệu sẽ có sẵn sau khi thu thập hoàn tất.`}),C(!1),_(""),V("1")}}catch(G){console.error("Error crawling website:",G),B({title:"Lỗi",description:"Không thể bắt đầu thu thập website",variant:"destructive"})}finally{X(!1)}},Gx=async()=>{try{if(!(ce!=null&&ce.id))return;Xn(null),localStorage.removeItem(bn),B({title:"Đã dừng thu thập",description:`Đã dừng thu thập website ${ce.url}`})}catch(M){console.error("Error stopping job:",M),B({title:"Lỗi",description:"Không thể dừng thu thập website",variant:"destructive"})}};return l.jsxs("div",{className:"space-y-4 s3-explr-container",children:[l.jsx(La,{className:"s3-explr-breadcrumb",children:l.jsxs(Ra,{className:"s3-explr-breadcrumb-list",children:[l.jsx(Xo,{className:"s3-explr-breadcrumb-item",children:l.jsx(Jo,{onClick:()=>{v(""),m(""),_e.current=!0,setTimeout(()=>{We()},0)},className:"flex items-center gap-1 cursor-pointer s3-explr-breadcrumb-home",children:e})}),Ad.map((M,$)=>l.jsxs(l.Fragment,{children:[l.jsx(Va,{className:"s3-explr-breadcrumb-separator"},`sep-${$}`),l.jsx(Xo,{className:"s3-explr-breadcrumb-item",children:l.jsx(Jo,{onClick:()=>lo(n+Ad.slice(0,$+1).join("/")+"/"),className:"cursor-pointer s3-explr-breadcrumb-link",children:M})},`item-${M}`)]}))]})}),l.jsxs("div",{className:"flex items-center space-x-4 s3-explr-toolbar",children:[l.jsx("div",{className:"relative max-w-sm w-full s3-explr-search-container",children:l.jsx(ox,{ref:J,onChange:M=>u(M)})}),l.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>{v(p),_e.current=!0,We()},disabled:xi,className:"flex items-center gap-2 s3-explr-refresh-btn",children:[l.jsx(Md,{className:`h-4 w-4 s3-explr-refresh-icon ${xi?"animate-spin":""}`}),"Làm mới"]}),!r&&l.jsxs(l.Fragment,{children:[c.size>0&&l.jsxs(l.Fragment,{children:[l.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>Pd(Array.from(c)),disabled:Array.from(c).some(M=>Ce.has(M)),className:"flex items-center gap-2 s3-explr-download-selected-btn",children:[Array.from(c).some(M=>Ce.has(M))?l.jsx(ye,{className:"h-4 w-4 animate-spin mr-2 s3-explr-loader"}):l.jsx(Ni,{className:"h-4 w-4 s3-explr-download-icon"}),"Tải xuống đã chọn (",c.size,")"]}),l.jsxs(It,{open:q,onOpenChange:k,children:[l.jsx(Er,{asChild:!0,children:l.jsxs(ie,{variant:"destructive",size:"sm",className:"flex items-center gap-2 s3-explr-bulk-delete-btn",children:[l.jsx(Ti,{className:"h-4 w-4 s3-explr-trash-icon"}),"Xóa đã chọn (",c.size,")"]})}),l.jsxs(vt,{className:"s3-explr-dialog-content",children:[l.jsxs(yt,{className:"s3-explr-dialog-header",children:[l.jsx(wt,{className:"s3-explr-dialog-title",children:"Xác nhận xóa hàng loạt"}),l.jsxs(Mn,{className:"s3-explr-dialog-description",children:["Bạn có chắc chắn muốn xóa ",c.size," mục đã chọn? Hành động này không thể hoàn tác."]})]}),l.jsxs(un,{className:"s3-explr-dialog-footer",children:[l.jsx(ie,{variant:"outline",onClick:()=>k(!1),className:"s3-explr-cancel-btn",children:"Hủy"}),l.jsx(ie,{variant:"destructive",onClick:Vx,disabled:I,className:"s3-explr-confirm-delete-btn",children:I?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang xóa..."]}):"Xóa đã chọn"})]})]})]})]}),l.jsxs(It,{open:h,onOpenChange:y,children:[l.jsx(Er,{asChild:!0,children:l.jsxs(ie,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-new-folder-btn",disabled:!!s&&!p,children:[l.jsx(Ld,{className:"h-4 w-4 s3-explr-folder-plus-icon"}),"Thư mục mới"]})}),l.jsxs(vt,{className:"s3-explr-dialog-content",children:[l.jsx(yt,{className:"s3-explr-dialog-header",children:l.jsx(wt,{className:"s3-explr-dialog-title",children:"Tạo thư mục mới"})}),l.jsxs("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:[l.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[l.jsx(Wt,{htmlFor:"name",className:"s3-explr-label",children:"Tên thư mục"}),l.jsx(kt,{disabled:S,id:"name",value:w,onChange:M=>b(M.target.value),placeholder:"Nhập tên thư mục",className:"s3-explr-input"})]}),l.jsxs(ie,{onClick:()=>{w.trim()&&Lx(w,p)},disabled:S,className:"s3-explr-create-btn",children:[S&&l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),S?"Đang tạo...":"Tạo"]})]})]})]}),l.jsxs("div",{className:"flex items-center gap-2 s3-explr-upload-group",children:[l.jsx(ie,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-upload-files-btn",onClick:()=>{const M=document.createElement("input");M.type="file",M.multiple=!0,M.onchange=$=>{const j=$.target.files;j&&Td(j,p,"files")},M.click()},disabled:z!==null||!!s&&!p,children:z==="files"?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"h-4 w-4 animate-spin mr-2 s3-explr-loader"}),"Đang tải lên..."]}):l.jsxs(l.Fragment,{children:[l.jsx(kd,{className:"h-4 w-4 s3-explr-upload-icon"}),"Tải lên tập tin"]})}),l.jsx(ie,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-upload-folder-btn",onClick:()=>{const M=document.createElement("input");M.type="file",M.multiple=!0,M.webkitdirectory=!0,M.onchange=$=>{const j=$.target.files;j&&Td(j,p,"folder")},M.click()},disabled:z!==null||!!s&&!p,children:z==="folder"?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"h-4 w-4 animate-spin mr-2 s3-explr-loader"}),"Đang tải lên..."]}):l.jsxs(l.Fragment,{children:[l.jsx(fo,{className:"h-4 w-4 s3-explr-folder-icon"}),"Tải lên thư mục"]})}),ce?l.jsx(vn,{delayDuration:0,children:l.jsxs(yn,{children:[l.jsx(wn,{asChild:!0,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(ie,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-website-btn",disabled:!0,children:[l.jsx(ye,{className:"h-4 w-4 animate-spin s3-explr-loader"}),ce.status?l.jsxs(l.Fragment,{children:["Đang thu thập (",ce.status.completed,"/",ce.status.total,") - ",Math.floor(En/60),":",String(En%60).padStart(2,"0")]}):"Đang thu thập..."]}),l.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>void Gx(),className:"flex items-center gap-2",children:[l.jsx("span",{className:"sr-only",children:"Dừng thu thập"}),l.jsx(jd,{className:"h-4 w-4"})]})]})}),ce.status&&l.jsx(qt,{side:"right",sideOffset:5,children:l.jsxs("div",{className:"space-y-1 p-2",children:[l.jsxs("p",{className:"font-semibold",children:["Đang thu thập ",ce.url]}),l.jsxs("p",{children:["Tiến độ: ",ce.status.completed,"/",ce.status.total," trang"]}),l.jsxs("p",{children:["Thời gian: ",Math.floor(En/60),":",String(En%60).padStart(2,"0")]}),l.jsxs("p",{children:["Trạng thái:"," ",ce.status.status==="scraping"?"Đang thu thập":ce.status.status==="completed"?"Hoàn thành":"Thất bại"]})]})})]})}):l.jsxs(It,{open:io,onOpenChange:C,children:[l.jsx(Er,{asChild:!0,children:l.jsxs(ie,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-website-btn",disabled:!!s&&!p,children:[l.jsx(Bd,{className:"h-4 w-4 s3-explr-globe-icon"}),"Thêm website"]})}),l.jsxs(vt,{className:"s3-explr-dialog-content",children:[l.jsxs(yt,{className:"s3-explr-dialog-header",children:[l.jsx(wt,{className:"s3-explr-dialog-title",children:"Thêm website"}),l.jsx(Mn,{className:"s3-explr-dialog-description",children:"Nhập URL website để thu thập và thêm vào S3."})]}),l.jsxs("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:[l.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[l.jsx(Wt,{htmlFor:"websiteUrl",className:"s3-explr-label",children:"URL Website"}),l.jsx(kt,{id:"websiteUrl",value:N,onChange:M=>_(M.target.value),placeholder:"https://example.com",type:"url",disabled:L,className:"s3-explr-input"})]}),l.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[l.jsx(Wt,{htmlFor:"crawlLimit",className:"s3-explr-label",children:"Giới hạn thu thập"}),l.jsx(kt,{id:"crawlLimit",value:H,onChange:M=>{const $=M.target.value;/^\d*$/.test($)&&V($)},placeholder:"1",type:"text",disabled:L,className:"s3-explr-input"}),l.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)"})]})]}),l.jsxs(un,{className:"s3-explr-dialog-footer",children:[l.jsx(ie,{variant:"outline",onClick:()=>{C(!1),_(""),V("1")},disabled:L,className:"s3-explr-cancel-btn",children:"Hủy"}),l.jsx(ie,{onClick:()=>{N.trim()&&Wx(N.trim(),parseInt(H)||1)},disabled:L||!N.trim(),className:"s3-explr-crawl-btn",children:L?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang thu thập..."]}):"Bắt đầu thu thập"})]})]})]})]}),l.jsx(It,{open:!!x,onOpenChange:M=>!M&&P(null),children:l.jsxs(vt,{className:"s3-explr-dialog-content",children:[l.jsxs(yt,{className:"s3-explr-dialog-header",children:[l.jsx(wt,{className:"s3-explr-dialog-title",children:"Xác nhận xóa"}),l.jsxs(Mn,{className:"s3-explr-dialog-description",children:["Bạn có chắc chắn muốn xóa ",x==null?void 0:x.name,"? Hành động này không thể hoàn tác."]})]}),l.jsxs(un,{className:"s3-explr-dialog-footer",children:[l.jsx(ie,{variant:"outline",onClick:()=>P(null),className:"s3-explr-cancel-btn",children:"Hủy"}),l.jsx(ie,{variant:"destructive",onClick:()=>Rx(x),disabled:ve,className:"s3-explr-confirm-delete-btn",children:ve?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang xóa..."]}):"Xóa"})]})]})}),l.jsx(It,{open:!!U,onOpenChange:M=>{M||(K(null),le(null),Ee(""),nt(""),Bt("rename"))},children:l.jsxs(vt,{className:"s3-explr-dialog-content max-w-5xl w-[90%]",children:[l.jsx(yt,{className:"s3-explr-dialog-header",children:l.jsx(wt,{className:"s3-explr-dialog-title",children:U!=null&&U.isFolder?"Đổi tên thư mục":Un(U)?"Quản lý tập tin":"Đổi tên tập tin"})}),U&&l.jsxs(bv,{value:Cn,onValueChange:M=>Bt(M),children:[l.jsxs(Sc,{"aria-checked":!Un(U),"aria-disabled":U.isFolder,className:"grid w-full grid-cols-3 aria-checked:grid-cols-2 aria-disabled:grid-cols-1",children:[l.jsx(Or,{value:"rename",children:"Đổi tên"}),!U.isFolder&&l.jsxs(l.Fragment,{children:[Un(U)&&l.jsx(Or,{value:"edit",children:"Sửa nội dung"}),l.jsx(Or,{value:"edit-metadata",children:"Sửa metadata file"})]})]}),l.jsx(Dr,{value:"rename",children:l.jsx("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:l.jsxs("div",{className:"h-[70dvh] min-h-[500px] overflow-hidden overflow-y-auto pb-3 px-1 s3-explr-input-group",children:[l.jsx(Wt,{htmlFor:"newName",className:"s3-explr-label",children:"Tên mới"}),l.jsx(kt,{id:"newName",value:ue,onChange:M=>Ee(M.target.value),placeholder:"Nhập tên mới",disabled:Nt,className:"s3-explr-input"})]})})}),!U.isFolder&&l.jsxs(l.Fragment,{children:[Un(U)&&l.jsx(Dr,{value:"edit",children:l.jsx("div",{className:"space-y-4 py-4",children:ft?l.jsx("div",{className:"flex items-center justify-center py-4",children:l.jsx(ye,{className:"h-6 w-6 animate-spin"})}):l.jsxs("div",{className:"h-[70dvh] min-h-[500px] overflow-hidden overflow-y-auto pb-3 px-1",children:[l.jsx(Wt,{htmlFor:"content",className:"s3-explr-label",children:"Nội dung tập tin"}),l.jsx(In,{id:"content",value:je,onChange:M=>nt(M.target.value),placeholder:"Nhập nội dung tập tin",className:"min-h-[200px] font-mono",disabled:Pe})]})})}),l.jsx(Dr,{value:"edit-metadata",children:l.jsx("div",{className:"space-y-4 py-4",children:ft?l.jsx("div",{className:"flex items-center justify-center py-4",children:l.jsx(ye,{className:"h-6 w-6 animate-spin"})}):l.jsx("div",{className:"h-[70dvh] min-h-[500px] overflow-hidden overflow-y-auto pb-3 px-1",children:Y&&typeof Y=="object"&&Object.entries(Y).map(([M,$])=>l.jsxs("div",{className:"pb-3 flex flex-col gap-2",children:[l.jsxs(Wt,{htmlFor:M,className:"s3-explr-label flex items-center gap-1",children:[lg[M]||M,jo(M)&&l.jsx(ig,{className:"h-[12px] w-[12px] text-red-500"})]}),cg(M)?l.jsx(In,{id:M,value:typeof $=="string"?$:JSON.stringify($),onChange:j=>{const G={...Y,[M]:j.target.value};le(G)},placeholder:"Nhập nội dung tập tin",className:"min-h-[200px] font-mono",disabled:Pe||jo(M)}):l.jsx(kt,{id:M,value:typeof $=="string"?$:JSON.stringify($),onChange:j=>{const G={...Y,[M]:j.target.value};le(G)},placeholder:"Nhập nội dung",className:"s3-explr-input",disabled:Pe||jo(M)})]},M))})})})]})]}),l.jsxs(un,{className:"s3-explr-dialog-footer",children:[l.jsx(ie,{variant:"outline",onClick:()=>{K(null),le(null),Ee(""),nt("")},className:"s3-explr-cancel-btn",children:"Hủy"}),Cn==="edit"?l.jsx(ie,{onClick:()=>U&&Ux(U,je),disabled:Pe||ft,className:"s3-explr-save-btn",children:Pe?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang lưu..."]}):"Lưu thay đổi"}):Cn==="edit-metadata"?l.jsx(ie,{onClick:()=>Y&&typeof Y=="object"&&U&&jx(U),disabled:Pe||ft,className:"s3-explr-save-btn",children:Pe?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang lưu..."]}):"Lưu thay đổi"}):l.jsx(ie,{onClick:()=>{ue.trim()&&U&&Bx(U,ue.trim())},disabled:Nt||!ue.trim()||ue.trim()===(U==null?void 0:U.name),className:"s3-explr-rename-btn",children:Nt?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang đổi tên..."]}):"Đổi tên"})]})]})}),F&&Ie&&l.jsx(sx,{openDialogRename:Ie,setOpenDialogRename:Ue,apiBaseUrl:t,setFileToMove:O,fileToMove:F,refreshFiles:We,ignoreCache:_e})]})]}),kx&&l.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"}),l.jsx("div",{className:"rounded-md border s3-explr-table-container",children:l.jsxs(Nr,{className:"s3-explr-table",children:[l.jsx(Tr,{className:"s3-explr-table-header",children:Ci.getHeaderGroups().map(M=>l.jsx(Ye,{className:"hover:bg-transparent s3-explr-header-row",children:M.headers.map($=>l.jsx(st,{className:"s3-explr-header-cell",children:$.isPlaceholder?null:nr($.column.columnDef.header,$.getContext())},$.id))},M.id))}),l.jsx(Pr,{className:"s3-explr-table-body",children:Ci.getRowModel().rows.length===0?l.jsx(Ye,{className:"s3-explr-empty-row",children:l.jsx(De,{colSpan:_d.length,className:"h-24 text-center s3-explr-empty-cell",children:a?l.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 "',a,'"']}):l.jsx("div",{className:"text-gray-500 s3-explr-empty-message",children:xi?"Đ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"})})}):Ci.getRowModel().rows.map(M=>l.jsx(Ye,{className:"h-12 s3-explr-row",children:M.getVisibleCells().map($=>l.jsx(De,{className:"align-middle s3-explr-cell",children:nr($.column.columnDef.cell,$.getContext())},$.id))},M.id))})]})}),r&&o&&l.jsxs("div",{className:"flex justify-between items-center mt-4 s3-explr-selector-footer",children:[l.jsxs("div",{className:"text-sm text-gray-500 s3-explr-selection-count",children:[c.size," ",(c.size===1,"tập tin")," đã chọn"]}),l.jsx(ie,{variant:"default",onClick:()=>o(zx()),disabled:c.size===0,className:"s3-explr-ok-btn",children:"OK"})]}),!r&&l.jsx(Jc,{})]})});var jn=e=>e.type==="checkbox",Kt=e=>e instanceof Date,Fe=e=>e==null;const sd=e=>typeof e=="object";var he=e=>!Fe(e)&&!Array.isArray(e)&&sd(e)&&!Kt(e),dx=e=>he(e)&&e.target?jn(e.target)?e.target.checked:e.target.value:e,fx=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,px=(e,t)=>e.has(fx(t)),gx=e=>{const t=e.constructor&&e.constructor.prototype;return he(t)&&t.hasOwnProperty("isPrototypeOf")},ai=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function He(e){let t;const n=Array.isArray(e),r=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(ai&&(e instanceof Blob||r))&&(n||he(e)))if(t=n?[]:{},!n&&!gx(e))t=e;else for(const o in e)e.hasOwnProperty(o)&&(t[o]=He(e[o]));else return e;return t}var eo=e=>Array.isArray(e)?e.filter(Boolean):[],pe=e=>e===void 0,W=(e,t,n)=>{if(!t||!he(e))return n;const r=eo(t.split(/[,[\].]+?/)).reduce((o,s)=>Fe(o)?o:o[s],e);return pe(r)||r===e?pe(e[t])?n:e[t]:r},ct=e=>typeof e=="boolean",li=e=>/^\w*$/.test(e),id=e=>eo(e.replace(/["|']|\]/g,"").split(/\.|\[/)),fe=(e,t,n)=>{let r=-1;const o=li(t)?[t]:id(t),s=o.length,i=s-1;for(;++r<s;){const a=o[r];let u=n;if(r!==i){const c=e[a];u=he(c)||Array.isArray(c)?c:isNaN(+o[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=u,e=e[a]}return e};const ad={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},et={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},St={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};A.createContext(null);var hx=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==et.all&&(t._proxyFormState[i]=!r||et.all),e[i]}});return o},Me=e=>he(e)&&!Object.keys(e).length,mx=(e,t,n,r)=>{n(e);const{name:o,...s}=e;return Me(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===et.all)},to=e=>Array.isArray(e)?e:[e];function vx(e){const t=A.useRef(e);t.current=e,A.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}var ut=e=>typeof e=="string",yx=(e,t,n,r,o)=>ut(e)?(r&&t.watch.add(e),W(n,e,o)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),W(n,s))):(r&&(t.watchAll=!0),n),wx=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},ld=e=>({isOnSubmit:!e||e===et.onSubmit,isOnBlur:e===et.onBlur,isOnChange:e===et.onChange,isOnAll:e===et.all,isOnTouch:e===et.onTouched}),cd=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Wn=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const s=W(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!r)return!0;if(i.ref&&t(i.ref,i.name)&&!r)return!0;if(Wn(a,t))break}else if(he(a)&&Wn(a,t))break}}};var bx=(e,t,n)=>{const r=to(W(e,n));return fe(r,"root",t[n]),fe(e,n,r),e},ci=e=>e.type==="file",dt=e=>typeof e=="function",no=e=>{if(!ai)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ro=e=>ut(e),ui=e=>e.type==="radio",oo=e=>e instanceof RegExp;const ud={value:!1,isValid:!1},dd={value:!0,isValid:!0};var fd=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!pe(e[0].attributes.value)?pe(e[0].value)||e[0].value===""?dd:{value:e[0].value,isValid:!0}:dd:ud}return ud};const pd={isValid:!1,value:null};var gd=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,pd):pd;function hd(e,t,n="validate"){if(ro(e)||Array.isArray(e)&&e.every(ro)||ct(e)&&!e)return{type:n,message:ro(e)?e:"",ref:t}}var xn=e=>he(e)&&!oo(e)?e:{value:e,message:""},md=async(e,t,n,r,o)=>{const{ref:s,refs:i,required:a,maxLength:u,minLength:c,min:f,max:p,pattern:m,validate:g,name:v,valueAsNumber:h,mount:y,disabled:w}=e._f,b=W(t,v);if(!y||w)return{};const S=i?i[0]:s,E=k=>{r&&S.reportValidity&&(S.setCustomValidity(ct(k)?"":k||""),S.reportValidity())},x={},P=ui(s),F=jn(s),O=P||F,I=(h||ci(s))&&pe(s.value)&&pe(b)||no(s)&&s.value===""||b===""||Array.isArray(b)&&!b.length,D=wx.bind(null,v,n,x),q=(k,z,R,J=St.maxLength,B=St.minLength)=>{const U=k?z:R;x[v]={type:k?J:B,message:U,ref:s,...D(k?J:B,U)}};if(o?!Array.isArray(b)||!b.length:a&&(!O&&(I||Fe(b))||ct(b)&&!b||F&&!fd(i).isValid||P&&!gd(i).isValid)){const{value:k,message:z}=ro(a)?{value:!!a,message:a}:xn(a);if(k&&(x[v]={type:St.required,message:z,ref:S,...D(St.required,z)},!n))return E(z),x}if(!I&&(!Fe(f)||!Fe(p))){let k,z;const R=xn(p),J=xn(f);if(!Fe(b)&&!isNaN(b)){const B=s.valueAsNumber||b&&+b;Fe(R.value)||(k=B>R.value),Fe(J.value)||(z=B<J.value)}else{const B=s.valueAsDate||new Date(b),U=le=>new Date(new Date().toDateString()+" "+le),K=s.type=="time",Y=s.type=="week";ut(R.value)&&b&&(k=K?U(b)>U(R.value):Y?b>R.value:B>new Date(R.value)),ut(J.value)&&b&&(z=K?U(b)<U(J.value):Y?b<J.value:B<new Date(J.value))}if((k||z)&&(q(!!k,R.message,J.message,St.max,St.min),!n))return E(x[v].message),x}if((u||c)&&!I&&(ut(b)||o&&Array.isArray(b))){const k=xn(u),z=xn(c),R=!Fe(k.value)&&b.length>+k.value,J=!Fe(z.value)&&b.length<+z.value;if((R||J)&&(q(R,k.message,z.message),!n))return E(x[v].message),x}if(m&&!I&&ut(b)){const{value:k,message:z}=xn(m);if(oo(k)&&!b.match(k)&&(x[v]={type:St.pattern,message:z,ref:s,...D(St.pattern,z)},!n))return E(z),x}if(g){if(dt(g)){const k=await g(b,t),z=hd(k,S);if(z&&(x[v]={...z,...D(St.validate,z.message)},!n))return E(z.message),x}else if(he(g)){let k={};for(const z in g){if(!Me(k)&&!n)break;const R=hd(await g[z](b,t),S,z);R&&(k={...R,...D(z,R.message)},E(R.message),n&&(x[v]=k))}if(!Me(k)&&(x[v]={ref:S,...k},!n))return x}}return E(!0),x};function xx(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=pe(e)?r++:e[t[r++]];return e}function Cx(e){for(const t in e)if(e.hasOwnProperty(t)&&!pe(e[t]))return!1;return!0}function xe(e,t){const n=Array.isArray(t)?t:li(t)?[t]:id(t),r=n.length===1?e:xx(e,n),o=n.length-1,s=n[o];return r&&delete r[s],o!==0&&(he(r)&&Me(r)||Array.isArray(r)&&Cx(r))&&xe(e,n.slice(0,-1)),e}var di=()=>{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},fi=e=>Fe(e)||!sd(e);function Vt(e,t){if(fi(e)||fi(t))return e===t;if(Kt(e)&&Kt(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const s=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const i=t[o];if(Kt(s)&&Kt(i)||he(s)&&he(i)||Array.isArray(s)&&Array.isArray(i)?!Vt(s,i):s!==i)return!1}}return!0}var vd=e=>e.type==="select-multiple",Sx=e=>ui(e)||jn(e),pi=e=>no(e)&&e.isConnected,yd=e=>{for(const t in e)if(dt(e[t]))return!0;return!1};function so(e,t={}){const n=Array.isArray(e);if(he(e)||n)for(const r in e)Array.isArray(e[r])||he(e[r])&&!yd(e[r])?(t[r]=Array.isArray(e[r])?[]:{},so(e[r],t[r])):Fe(e[r])||(t[r]=!0);return t}function wd(e,t,n){const r=Array.isArray(e);if(he(e)||r)for(const o in e)Array.isArray(e[o])||he(e[o])&&!yd(e[o])?pe(t)||fi(n[o])?n[o]=Array.isArray(e[o])?so(e[o],[]):{...so(e[o])}:wd(e[o],Fe(t)?{}:t[o],n[o]):n[o]=!Vt(e[o],t[o]);return n}var Gn=(e,t)=>wd(e,t,so(t)),bd=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>pe(e)?e:t?e===""?NaN:e&&+e:n&&ut(e)?new Date(e):r?r(e):e;function gi(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return ci(t)?t.files:ui(t)?gd(e.refs).value:vd(t)?[...t.selectedOptions].map(({value:n})=>n):jn(t)?fd(e.refs).value:bd(pe(t.value)?e.ref.value:t.value,e)}var Ex=(e,t,n,r)=>{const o={};for(const s of e){const i=W(t,s);i&&fe(o,s,i._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},qn=e=>pe(e)?e:oo(e)?e.source:he(e)?oo(e.value)?e.value.source:e.value:e;const xd="AsyncFunction";var Nx=e=>!!e&&!!e.validate&&!!(dt(e.validate)&&e.validate.constructor.name===xd||he(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===xd)),Tx=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Cd(e,t,n){const r=W(e,n);if(r||li(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const s=o.join("."),i=W(t,s),a=W(e,s);if(i&&!Array.isArray(i)&&n!==s)return{name:n};if(a&&a.type)return{name:s,error:a};o.pop()}return{name:n}}var Px=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,Ax=(e,t)=>!eo(W(e,t)).length&&xe(e,t);const _x={mode:et.onSubmit,reValidateMode:et.onChange,shouldFocusError:!0};function Fx(e={}){let t={..._x,...e},n={submitCount:0,isDirty:!1,isLoading:dt(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=he(t.defaultValues)||he(t.values)?He(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:He(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,c=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={values:di(),array:di(),state:di()},m=ld(t.mode),g=ld(t.reValidateMode),v=t.criteriaMode===et.all,h=C=>N=>{clearTimeout(c),c=setTimeout(C,N)},y=async C=>{if(!t.disabled&&(f.isValid||C)){const N=t.resolver?Me((await O()).errors):await D(r,!0);N!==n.isValid&&p.state.next({isValid:N})}},w=(C,N)=>{!t.disabled&&(f.isValidating||f.validatingFields)&&((C||Array.from(a.mount)).forEach(_=>{_&&(N?fe(n.validatingFields,_,N):xe(n.validatingFields,_))}),p.state.next({validatingFields:n.validatingFields,isValidating:!Me(n.validatingFields)}))},b=(C,N=[],_,H,V=!0,L=!0)=>{if(H&&_&&!t.disabled){if(i.action=!0,L&&Array.isArray(W(r,C))){const X=_(W(r,C),H.argA,H.argB);V&&fe(r,C,X)}if(L&&Array.isArray(W(n.errors,C))){const X=_(W(n.errors,C),H.argA,H.argB);V&&fe(n.errors,C,X),Ax(n.errors,C)}if(f.touchedFields&&L&&Array.isArray(W(n.touchedFields,C))){const X=_(W(n.touchedFields,C),H.argA,H.argB);V&&fe(n.touchedFields,C,X)}f.dirtyFields&&(n.dirtyFields=Gn(o,s)),p.state.next({name:C,isDirty:k(C,N),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else fe(s,C,N)},S=(C,N)=>{fe(n.errors,C,N),p.state.next({errors:n.errors})},E=C=>{n.errors=C,p.state.next({errors:n.errors,isValid:!1})},x=(C,N,_,H)=>{const V=W(r,C);if(V){const L=W(s,C,pe(_)?W(o,C):_);pe(L)||H&&H.defaultChecked||N?fe(s,C,N?L:gi(V._f)):J(C,L),i.mount&&y()}},P=(C,N,_,H,V)=>{let L=!1,X=!1;const se={name:C};if(!t.disabled){const me=!!(W(r,C)&&W(r,C)._f&&W(r,C)._f.disabled);if(!_||H){f.isDirty&&(X=n.isDirty,n.isDirty=se.isDirty=k(),L=X!==se.isDirty);const ve=me||Vt(W(o,C),N);X=!!(!me&&W(n.dirtyFields,C)),ve||me?xe(n.dirtyFields,C):fe(n.dirtyFields,C,!0),se.dirtyFields=n.dirtyFields,L=L||f.dirtyFields&&X!==!ve}if(_){const ve=W(n.touchedFields,C);ve||(fe(n.touchedFields,C,_),se.touchedFields=n.touchedFields,L=L||f.touchedFields&&ve!==_)}L&&V&&p.state.next(se)}return L?se:{}},F=(C,N,_,H)=>{const V=W(n.errors,C),L=f.isValid&&ct(N)&&n.isValid!==N;if(t.delayError&&_?(u=h(()=>S(C,_)),u(t.delayError)):(clearTimeout(c),u=null,_?fe(n.errors,C,_):xe(n.errors,C)),(_?!Vt(V,_):V)||!Me(H)||L){const X={...H,...L&&ct(N)?{isValid:N}:{},errors:n.errors,name:C};n={...n,...X},p.state.next(X)}},O=async C=>{w(C,!0);const N=await t.resolver(s,t.context,Ex(C||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return w(C),N},I=async C=>{const{errors:N}=await O(C);if(C)for(const _ of C){const H=W(N,_);H?fe(n.errors,_,H):xe(n.errors,_)}else n.errors=N;return N},D=async(C,N,_={valid:!0})=>{for(const H in C){const V=C[H];if(V){const{_f:L,...X}=V;if(L){const se=a.array.has(L.name),me=V._f&&Nx(V._f);me&&f.validatingFields&&w([H],!0);const ve=await md(V,s,v,t.shouldUseNativeValidation&&!N,se);if(me&&f.validatingFields&&w([H]),ve[L.name]&&(_.valid=!1,N))break;!N&&(W(ve,L.name)?se?bx(n.errors,ve,L.name):fe(n.errors,L.name,ve[L.name]):xe(n.errors,L.name))}!Me(X)&&await D(X,N,_)}}return _.valid},q=()=>{for(const C of a.unMount){const N=W(r,C);N&&(N._f.refs?N._f.refs.every(_=>!pi(_)):!pi(N._f.ref))&&Se(C)}a.unMount=new Set},k=(C,N)=>!t.disabled&&(C&&N&&fe(s,C,N),!Vt(ue(),o)),z=(C,N,_)=>yx(C,a,{...i.mount?s:pe(N)?o:ut(C)?{[C]:N}:N},_,N),R=C=>eo(W(i.mount?s:o,C,t.shouldUnregister?W(o,C,[]):[])),J=(C,N,_={})=>{const H=W(r,C);let V=N;if(H){const L=H._f;L&&(!L.disabled&&fe(s,C,bd(N,L)),V=no(L.ref)&&Fe(N)?"":N,vd(L.ref)?[...L.ref.options].forEach(X=>X.selected=V.includes(X.value)):L.refs?jn(L.ref)?L.refs.length>1?L.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(V)?!!V.find(se=>se===X.value):V===X.value)):L.refs[0]&&(L.refs[0].checked=!!V):L.refs.forEach(X=>X.checked=X.value===V):ci(L.ref)?L.ref.value="":(L.ref.value=V,L.ref.type||p.values.next({name:C,values:{...s}})))}(_.shouldDirty||_.shouldTouch)&&P(C,V,_.shouldTouch,_.shouldDirty,!0),_.shouldValidate&&le(C)},B=(C,N,_)=>{for(const H in N){const V=N[H],L=`${C}.${H}`,X=W(r,L);(a.array.has(C)||he(V)||X&&!X._f)&&!Kt(V)?B(L,V,_):J(L,V,_)}},U=(C,N,_={})=>{const H=W(r,C),V=a.array.has(C),L=He(N);fe(s,C,L),V?(p.array.next({name:C,values:{...s}}),(f.isDirty||f.dirtyFields)&&_.shouldDirty&&p.state.next({name:C,dirtyFields:Gn(o,s),isDirty:k(C,L)})):H&&!H._f&&!Fe(L)?B(C,L,_):J(C,L,_),cd(C,a)&&p.state.next({...n}),p.values.next({name:i.mount?C:void 0,values:{...s}})},K=async C=>{i.mount=!0;const N=C.target;let _=N.name,H=!0;const V=W(r,_),L=()=>N.type?gi(V._f):dx(C),X=se=>{H=Number.isNaN(se)||Kt(se)&&isNaN(se.getTime())||Vt(se,W(s,_,se))};if(V){let se,me;const ve=L(),gt=C.type===ad.BLUR||C.type===ad.FOCUS_OUT,ao=!Tx(V._f)&&!t.resolver&&!W(n.errors,_)&&!V._f.deps||Px(gt,W(n.touchedFields,_),n.isSubmitted,g,m),Sn=cd(_,a,gt);fe(s,_,ve),gt?(V._f.onBlur&&V._f.onBlur(C),u&&u(0)):V._f.onChange&&V._f.onChange(C);const ce=P(_,ve,gt,!1),En=!Me(ce)||Sn;if(!gt&&p.values.next({name:_,type:C.type,values:{...s}}),ao)return f.isValid&&(t.mode==="onBlur"?gt&&y():y()),En&&p.state.next({name:_,...Sn?{}:ce});if(!gt&&Sn&&p.state.next({...n}),t.resolver){const{errors:Xn}=await O([_]);if(X(ve),H){const bi=Cd(n.errors,r,_),ke=Cd(Xn,r,bi.name||_);se=ke.error,_=ke.name,me=Me(Xn)}}else w([_],!0),se=(await md(V,s,v,t.shouldUseNativeValidation))[_],w([_]),X(ve),H&&(se?me=!1:f.isValid&&(me=await D(r,!0)));H&&(V._f.deps&&le(V._f.deps),F(_,me,se,ce))}},Y=(C,N)=>{if(W(n.errors,N)&&C.focus)return C.focus(),1},le=async(C,N={})=>{let _,H;const V=to(C);if(t.resolver){const L=await I(pe(C)?C:V);_=Me(L),H=C?!V.some(X=>W(L,X)):_}else C?(H=(await Promise.all(V.map(async L=>{const X=W(r,L);return await D(X&&X._f?{[L]:X}:X)}))).every(Boolean),!(!H&&!n.isValid)&&y()):H=_=await D(r);return p.state.next({...!ut(C)||f.isValid&&_!==n.isValid?{}:{name:C},...t.resolver||!C?{isValid:_}:{},errors:n.errors}),N.shouldFocus&&!H&&Wn(r,Y,C?V:a.mount),H},ue=C=>{const N={...i.mount?s:o};return pe(C)?N:ut(C)?W(N,C):C.map(_=>W(N,_))},Ee=(C,N)=>({invalid:!!W((N||n).errors,C),isDirty:!!W((N||n).dirtyFields,C),error:W((N||n).errors,C),isValidating:!!W(n.validatingFields,C),isTouched:!!W((N||n).touchedFields,C)}),Ie=C=>{C&&to(C).forEach(N=>xe(n.errors,N)),p.state.next({errors:C?n.errors:{}})},Ue=(C,N,_)=>{const H=(W(r,C,{_f:{}})._f||{}).ref,V=W(n.errors,C)||{},{ref:L,message:X,type:se,...me}=V;fe(n.errors,C,{...me,...N,ref:H}),p.state.next({name:C,errors:n.errors,isValid:!1}),_&&_.shouldFocus&&H&&H.focus&&H.focus()},Nt=(C,N)=>dt(C)?p.values.subscribe({next:_=>C(z(void 0,N),_)}):z(C,N,!0),Se=(C,N={})=>{for(const _ of C?to(C):a.mount)a.mount.delete(_),a.array.delete(_),N.keepValue||(xe(r,_),xe(s,_)),!N.keepError&&xe(n.errors,_),!N.keepDirty&&xe(n.dirtyFields,_),!N.keepTouched&&xe(n.touchedFields,_),!N.keepIsValidating&&xe(n.validatingFields,_),!t.shouldUnregister&&!N.keepDefaultValue&&xe(o,_);p.values.next({values:{...s}}),p.state.next({...n,...N.keepDirty?{isDirty:k()}:{}}),!N.keepIsValid&&y()},Ce=({disabled:C,name:N,field:_,fields:H,value:V})=>{if(ct(C)&&i.mount||C){const L=C?void 0:pe(V)?gi(_?_._f:W(H,N)._f):V;(C||!C&&!pe(L))&&fe(s,N,L),P(N,L,!1,!1,!0)}},tt=(C,N={})=>{let _=W(r,C);const H=ct(N.disabled)||ct(t.disabled);return fe(r,C,{..._||{},_f:{..._&&_._f?_._f:{ref:{name:C}},name:C,mount:!0,...N}}),a.mount.add(C),_?Ce({field:_,disabled:ct(N.disabled)?N.disabled:t.disabled,name:C,value:N.value}):x(C,!0,N.value),{...H?{disabled:N.disabled||t.disabled}:{},...t.progressive?{required:!!N.required,min:qn(N.min),max:qn(N.max),minLength:qn(N.minLength),maxLength:qn(N.maxLength),pattern:qn(N.pattern)}:{},name:C,onChange:K,onBlur:K,ref:V=>{if(V){tt(C,N),_=W(r,C);const L=pe(V.value)&&V.querySelectorAll&&V.querySelectorAll("input,select,textarea")[0]||V,X=Sx(L),se=_._f.refs||[];if(X?se.find(me=>me===L):L===_._f.ref)return;fe(r,C,{_f:{..._._f,...X?{refs:[...se.filter(pi),L,...Array.isArray(W(o,C))?[{}]:[]],ref:{type:L.type,name:C}}:{ref:L}}}),x(C,!1,void 0,L)}else _=W(r,C,{}),_._f&&(_._f.mount=!1),(t.shouldUnregister||N.shouldUnregister)&&!(px(a.array,C)&&i.action)&&a.unMount.add(C)}}},je=()=>t.shouldFocusError&&Wn(r,Y,a.mount),nt=C=>{ct(C)&&(p.state.next({disabled:C}),Wn(r,(N,_)=>{const H=W(r,_);H&&(N.disabled=H._f.disabled||C,Array.isArray(H._f.refs)&&H._f.refs.forEach(V=>{V.disabled=H._f.disabled||C}))},0,!1))},ft=(C,N)=>async _=>{let H;if(_&&(_.preventDefault&&_.preventDefault(),_.persist&&_.persist()),t.disabled){N&&await N({...n.errors},_);return}let V=He(s);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:L,values:X}=await O();n.errors=L,V=X}else await D(r);if(xe(n.errors,"root"),Me(n.errors)){p.state.next({errors:{}});try{await C(V,_)}catch(L){H=L}}else N&&await N({...n.errors},_),je(),setTimeout(je);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Me(n.errors)&&!H,submitCount:n.submitCount+1,errors:n.errors}),H)throw H},Xt=(C,N={})=>{W(r,C)&&(pe(N.defaultValue)?U(C,He(W(o,C))):(U(C,N.defaultValue),fe(o,C,He(N.defaultValue))),N.keepTouched||xe(n.touchedFields,C),N.keepDirty||(xe(n.dirtyFields,C),n.isDirty=N.defaultValue?k(C,He(W(o,C))):k()),N.keepError||(xe(n.errors,C),f.isValid&&y()),p.state.next({...n}))},Pe=(C,N={})=>{const _=C?He(C):o,H=He(_),V=Me(C),L=V?o:H;if(N.keepDefaultValues||(o=_),!N.keepValues){if(N.keepDirtyValues){const X=new Set([...a.mount,...Object.keys(Gn(o,s))]);for(const se of Array.from(X))W(n.dirtyFields,se)?fe(L,se,W(s,se)):U(se,W(L,se))}else{if(ai&&pe(C))for(const X of a.mount){const se=W(r,X);if(se&&se._f){const me=Array.isArray(se._f.refs)?se._f.refs[0]:se._f.ref;if(no(me)){const ve=me.closest("form");if(ve){ve.reset();break}}}}r={}}s=t.shouldUnregister?N.keepDefaultValues?He(o):{}:He(L),p.array.next({values:{...L}}),p.values.next({values:{...L}})}a={mount:N.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!f.isValid||!!N.keepIsValid||!!N.keepDirtyValues,i.watch=!!t.shouldUnregister,p.state.next({submitCount:N.keepSubmitCount?n.submitCount:0,isDirty:V?!1:N.keepDirty?n.isDirty:!!(N.keepDefaultValues&&!Vt(C,o)),isSubmitted:N.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:V?{}:N.keepDirtyValues?N.keepDefaultValues&&s?Gn(o,s):n.dirtyFields:N.keepDefaultValues&&C?Gn(o,C):N.keepDirty?n.dirtyFields:{},touchedFields:N.keepTouched?n.touchedFields:{},errors:N.keepErrors?n.errors:{},isSubmitSuccessful:N.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},pt=(C,N)=>Pe(dt(C)?C(s):C,N);return{control:{register:tt,unregister:Se,getFieldState:Ee,handleSubmit:ft,setError:Ue,_executeSchema:O,_getWatch:z,_getDirty:k,_updateValid:y,_removeUnmounted:q,_updateFieldArray:b,_updateDisabledField:Ce,_getFieldArray:R,_reset:Pe,_resetDefaultValues:()=>dt(t.defaultValues)&&t.defaultValues().then(C=>{pt(C,t.resetOptions),p.state.next({isLoading:!1})}),_updateFormState:C=>{n={...n,...C}},_disableForm:nt,_subjects:p,_proxyFormState:f,_setErrors:E,get _fields(){return r},get _formValues(){return s},get _state(){return i},set _state(C){i=C},get _defaultValues(){return o},get _names(){return a},set _names(C){a=C},get _formState(){return n},set _formState(C){n=C},get _options(){return t},set _options(C){t={...t,...C}}},trigger:le,register:tt,handleSubmit:ft,watch:Nt,setValue:U,getValues:ue,reset:pt,resetField:Xt,clearErrors:Ie,unregister:Se,setError:Ue,setFocus:(C,N={})=>{const _=W(r,C),H=_&&_._f;if(H){const V=H.refs?H.refs[0]:H.ref;V.focus&&(V.focus(),N.shouldSelect&&dt(V.select)&&V.select())}},getFieldState:Ee}}function Ox(e={}){const t=A.useRef(),n=A.useRef(),[r,o]=A.useState({isDirty:!1,isValidating:!1,isLoading:dt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:dt(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Fx(e),formState:r});const s=t.current.control;return s._options=e,vx({subject:s._subjects.state,next:i=>{mx(i,s._proxyFormState,s._updateFormState)&&o({...s._formState})}}),A.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),A.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==r.isDirty&&s._subjects.state.next({isDirty:i})}},[s,r.isDirty]),A.useEffect(()=>{e.values&&!Vt(e.values,n.current)?(s._reset(e.values,s._options.resetOptions),n.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[e.values,s]),A.useEffect(()=>{e.errors&&s._setErrors(e.errors)},[e.errors,s]),A.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),A.useEffect(()=>{e.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[e.shouldUnregister,s]),A.useMemo(()=>({...t.current,formState:hx(r,s)}),[r,s])}const Sd=({className:e,children:t,content:n,side:r})=>{const[o,s]=A.useState(!1);return l.jsx(vn,{delayDuration:0,children:l.jsxs(yn,{open:o,children:[l.jsx(wn,{asChild:!0,children:l.jsx("button",{type:"button",className:ee("cursor-pointer",e),onClick:()=>s(!o),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onTouchStart:()=>s(!o),onKeyDown:i=>{i.preventDefault(),i.key==="Enter"&&s(!o)},children:t})}),l.jsx(qt,{side:r,className:n?"":"hidden",children:l.jsx("span",{className:"inline-block",children:n})})]})})},hi=({className:e,...t})=>l.jsx("nav",{role:"navigation","aria-label":"pagination",className:ee("mx-auto flex w-full justify-center",e),...t});hi.displayName="Pagination";const mi=d.forwardRef(({className:e,...t},n)=>l.jsx("ul",{ref:n,className:ee("flex flex-row items-center gap-1",e),...t}));mi.displayName="PaginationContent";const Et=d.forwardRef(({className:e,...t},n)=>l.jsx("li",{ref:n,className:ee("",e),...t}));Et.displayName="PaginationItem";const Kn=({className:e,isActive:t,size:n="icon",...r})=>l.jsx("a",{"aria-current":t?"page":void 0,className:ee(Ha({variant:t?"outline":"ghost",size:n}),e),...r});Kn.displayName="PaginationLink";const vi=({className:e,...t})=>l.jsxs(Kn,{"aria-label":"Go to previous page",size:"default",className:ee("gap-1 pl-2.5",e),...t,children:[l.jsx(ng,{className:"h-4 w-4"}),l.jsx("span",{children:"Previous"})]});vi.displayName="PaginationPrevious";const yi=({className:e,...t})=>l.jsxs(Kn,{"aria-label":"Go to next page",size:"default",className:ee("gap-1 pr-2.5",e),...t,children:[l.jsx("span",{children:"Next"}),l.jsx(Na,{className:"h-4 w-4"})]});yi.displayName="PaginationNext";const wi=({className:e,...t})=>l.jsxs("span",{"aria-hidden":!0,className:ee("flex h-9 w-9 items-center justify-center",e),...t,children:[l.jsx(rg,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"More pages"})]});wi.displayName="PaginationEllipsis";const Dx=(e,t)=>{const[n,r]=A.useState(e);return A.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(o)}},[e,t]),n},Mx=({apiBaseUrl:e="https://s3-explorer.cmcts1.studio.ai.vn"})=>{var P,F;const[t,n]=A.useState([]),[r,o]=A.useState(!1),[s,i]=A.useState([]),[a,u]=A.useState(1),[c,f]=A.useState(1),[p,m]=A.useState(null),[g,v]=A.useState(""),h=Dx(g,500),y=O=>{const I=O.match(/\d{6}/);if(!I)return{month:"",year:""};const D=I[0],q=D.substring(0,2),k=D.substring(2);return{month:q,year:k}},w=O=>O.map(D=>{let q=(D==null?void 0:D.month)||"",k=(D==null?void 0:D.year)||"";if((!q||!k)&&(D!=null&&D.file_name)){const z=y(D.file_name);q=q||z.month,k=k||z.year}return{id:D==null?void 0:D.id,prefix:(D==null?void 0:D.prefix)||"",model:(D==null?void 0:D.model)||"",fileName:(D==null?void 0:D.file_name)||"",code:(D==null?void 0:D.stock_id)||"",month:q,year:k,content:(D==null?void 0:D.text_summary)||"",status:(D==null?void 0:D.status)||"",note:(D==null?void 0:D.note)||"",lastUpdate:D==null?void 0:D.updated_at,stock_id:D==null?void 0:D.stock_id}}),b=O=>{if(!(O!=null&&O.data))return[];const I=w(O==null?void 0:O.data);n(I),f(O.pagination.totalPages)},S=async(O=1,I=15)=>{m(O),o(!0);try{const D=await oe.get(`${e}/api/latest-summaries`,{params:{page:O,limit:I,search:g}});(D==null?void 0:D.status)===200?b(D.data):console.error(D)}catch(D){console.error("Error fetching data:",D)}finally{m(null),o(!1)}};A.useEffect(()=>{h&&u(1),S(a)},[a,h]);const E=A.useMemo(()=>[{id:"code",header:"Mã",accessorKey:"code",cell:({row:I})=>l.jsx("span",{className:"flex flex-col",children:I.original.code})},{id:"month",header:"Tháng",accessorKey:"month",cell:({row:I})=>{const D=I.original.month,q=I.original.year;return l.jsx("span",{className:"flex flex-col",children:`${D.toString().padStart(2,"0")}/${q}`})}},{id:"content",header:"Nội dung",accessorKey:"content",cell:({row:I})=>{const D=I.getValue("content");return l.jsx("div",{className:"text-start truncate text-ellipsis overflow-hidden whitespace-nowrap max-w-[30dvw]",children:D})}},{id:"status",header:"Trạng thái",accessorKey:"status",cell:({row:I})=>{const q=I.original.status!=="unpublish";return l.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0 text-[10px] font-bold ${q?"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:q?"PUBLISHED":"UNPUBLISHED"})}},{id:"note",header:"Ghi chú",accessorKey:"note",cell:({row:I})=>l.jsx(Sd,{content:l.jsx("div",{className:"font-medium text-[16px] max-w-[90dvw]",children:I.original.note}),children:l.jsx("div",{className:"text-start truncate text-ellipsis overflow-hidden whitespace-nowrap max-w-[20dvw]",children:I.original.note})})},{id:"last-update",header:"Cập nhật",accessorKey:"last-update",cell:({row:I})=>{const D=new Date(I.original.lastUpdate),q=D.getDate(),k=D.getMonth()+1,z=`ngày ${q} tháng ${k}`;return l.jsx("span",{className:"flex flex-col",children:z})}},{accessorKey:"actions",header:()=>l.jsx("div",{className:"font-medium text-right",children:"Hành động"}),cell:({row:I})=>{const[D,q]=A.useState(!1),[k,z]=A.useState(!1),[R,J]=A.useState(!1),{handleSubmit:B,register:U,reset:K}=Ox(),Y=I.original.id,le=I.getValue("status"),ue=I.getValue("content"),[Ee,Ie]=A.useState(!1),Ue=async()=>{try{Ie(!0);const Se=le==="unpublish"?"published":"unpublish",Ce=await oe.patch(`${e}/api/toggle-publish/${Y}`,{id:Y,typeAction:"update",status:le,idInput:Y,stock_id:I.original.stock_id,prefix:I.original.prefix,model:I.original.model,summary_result:I.original.content,note:I.original.note});Ce.status===200?n(tt=>tt.map(je=>je.id===Y?{...je,status:Se}:je)):console.error("Failed to toggle publish status:",Ce)}catch(Se){console.error("Error toggling publish status:",Se)}finally{Ie(!1)}},Nt=async Se=>{q(!0);try{const Ce=await oe.patch(`${e}/api/update-summary`,{note:Se.note,text_summary:Se.content,id:Y});Ce.status===200?(await S(a),z(!1)):console.error("Failed to update summary:",Ce)}catch(Ce){console.error("Error updating summary:",Ce)}return q(!1)};return l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[l.jsx(ie,{variant:"outline",size:"sm",onClick:()=>J(!0),className:"px-2 py-0.5 h-7",children:l.jsx(og,{className:"h-4 w-4"})}),l.jsx(It,{open:R,onOpenChange:J,children:l.jsxs(vt,{className:"max-w-3xl max-h-[80vh]",children:[l.jsx(yt,{children:l.jsx(wt,{children:"Nội dung chi tiết"})}),l.jsx("div",{className:"mt-4 overflow-y-auto max-h-[60vh]",children:l.jsx("div",{className:"whitespace-pre-wrap text-[16px] leading-relaxed",children:ue})})]})}),l.jsxs(It,{open:k,onOpenChange:Se=>{z(Se),Se?K({content:I.original.content,note:I.original.note}):K()},children:[l.jsx(Er,{asChild:!0,children:l.jsx(ie,{variant:"outline",size:"sm",onClick:()=>z(!0),className:"px-2 py-0.5 h-7",children:"Sửa"})}),l.jsx(vt,{className:"rounded-lg sm:px-3 h-[calc(100dvh-200px)] min-w-[calc(100dvw-112px)]",children:l.jsxs(yt,{className:"flex flex-col gap-3",children:[l.jsx(wt,{className:"max-sm:hidden text-center",children:"Sửa summary"}),l.jsxs("form",{className:"flex flex-col gap-3 h-full justify-between",onSubmit:B(Nt),children:[l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs("div",{className:"flex flex-col items-start",children:[l.jsx("span",{children:"Nội dung:"}),l.jsx(In,{placeholder:"Nội dung",className:"w-full input-scroll-bar",defaultValue:I.original.answer||"",rows:10,...U("content")})]}),l.jsxs("div",{className:"flex flex-col items-start",children:[l.jsx("span",{children:"Ghi chú:"}),l.jsx(In,{placeholder:"Nội dung",className:"w-full input-scroll-bar",defaultValue:I.original.note||"",rows:1,...U("note")})]})]}),l.jsx("div",{className:"flex justify-end",children:l.jsx(ie,{disabled:D,type:"submit",variant:"default",children:D?l.jsx(ye,{className:"h-4 w-4 animate-spin"}):"Ok"})})]})]})})]}),l.jsx(ie,{variant:"outline",size:"sm",onClick:Ue,disabled:Ee,className:"w-[70px] px-2 py-0.5 h-7",children:Ee?l.jsx(ye,{className:"h-4 w-4 animate-spin"}):le==="unpublish"?"Publish":"Unpublish"})]})}}],[]),x=Vi({data:t,columns:E,state:{columnFilters:s},enableRowSelection:!0,onColumnFiltersChange:i,getFilteredRowModel:Ef(),getCoreRowModel:Ri()});return l.jsxs("div",{className:"space-y-4 s3-explr-container",children:[l.jsx("div",{className:"flex items-center space-x-4 s3-explr-toolbar",children:l.jsxs("div",{className:"relative max-w-sm",children:[l.jsx(kt,{placeholder:"Tìm kiếm theo mã...",value:g,onChange:O=>v(O.target.value),className:"pr-8"}),g&&l.jsx(ie,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6 p-0",onClick:()=>v(""),children:l.jsx(Uo,{className:"h-4 w-4"})})]})}),l.jsx("div",{className:"rounded-md border s3-explr-table-container",children:l.jsxs(Nr,{className:"s3-explr-table",children:[l.jsx(Tr,{className:"s3-explr-table-header",children:x.getHeaderGroups().map(O=>l.jsx(Ye,{className:"hover:bg-transparent s3-explr-header-row",children:O.headers.map(I=>l.jsx(st,{className:"s3-explr-header-cell",children:I.isPlaceholder?null:nr(I.column.columnDef.header,I.getContext())},I.id))},O.id))}),l.jsx(Pr,{className:"s3-explr-table-body",children:r?l.jsx(Ye,{children:l.jsx(De,{colSpan:E.length,className:"h-24 text-center",children:"Đang tải dữ liệu..."})}):(P=x.getRowModel().rows)!=null&&P.length?(F=x.getRowModel().rows)==null?void 0:F.map(O=>l.jsx(Ye,{className:"h-12 s3-explr-row",children:O.getVisibleCells().map(I=>l.jsx(De,{className:"align-middle s3-explr-cell",children:nr(I.column.columnDef.cell,I.getContext())},I.id))},O.id)):l.jsx(Ye,{children:l.jsx(De,{colSpan:E.length,className:"h-24 text-center",children:"Không có kết quả."})})})]})}),l.jsx("div",{className:"mt-4",children:l.jsx(hi,{children:l.jsxs(mi,{children:[l.jsx(Et,{children:l.jsx(vi,{onClick:()=>u(O=>Math.max(1,O-1)),className:a===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:c},(O,I)=>I+1).filter(O=>O===1||O===c||Math.abs(O-a)<=1).map((O,I,D)=>l.jsxs(l.Fragment,{children:[I>0&&D[I-1]!==O-1&&l.jsx(Et,{children:l.jsx(wi,{})},O+"..."),l.jsx(Et,{children:l.jsx(Kn,{onClick:()=>u(O),isActive:a===O,className:`cursor-pointer ${r?"pointer-events-none":""}`,children:p===O?l.jsx(ye,{className:"h-4 w-4 animate-spin"}):O})},O)]})),l.jsx(Et,{children:l.jsx(yi,{onClick:()=>u(O=>Math.min(c,O+1)),className:a===c||p!==null?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]})},Ed=10,Ix=A.memo(({apiBaseUrl:e="https://s3-explorer.cmcts1.studio.ai.vn"})=>{const[t,n]=A.useState(1),[r,o]=A.useState([]),[s,i]=A.useState({total:0,page:1,limit:Ed,totalPages:1}),[a,u]=A.useState(!0),[c,f]=A.useState(null),[p,m]=A.useState(new Set),{toast:g}=Rr(),[v,h]=A.useState(!1),y=async x=>{try{f(x);const P=await oe.get(`${e}/api/jobs`,{params:{page:x.toString(),limit:Ed.toString()}});o(P.data.data),i(P.data.pagination)}catch{g({variant:"destructive",title:"Error",description:"Failed to fetch jobs. Please try again."})}finally{f(null),u(!1)}};A.useEffect(()=>{y(t)},[t,e]);const w=async x=>{m(P=>new Set(P).add(x.toString()));try{await oe.post(`${e}/api/retry-job`,{jobId:x}),g({title:"Job Restarted",description:`Job ${x} has been successfully restarted.`}),y(t)}catch{g({variant:"destructive",title:"Retry Failed",description:`Failed to restart job ${x}. Please try again.`})}finally{m(P=>{const F=new Set(P);return F.delete(x.toString()),F})}},b=async()=>{h(!0),n(1),await y(1),h(!1)},S=x=>new Date(x).toLocaleString(),E=x=>{if(x=parseFloat(x),x<60)return`${x.toFixed(2)}s`;const P=Math.floor(x/60),F=(x%60).toFixed(0);return`${P}m ${F}s`};return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[l.jsx(eg,{className:"w-8 h-8 text-primary"}),l.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Job Management"}),l.jsx(ie,{variant:"outline",size:"icon",onClick:b,disabled:v||a,className:"ml-2",children:l.jsx(ag,{className:`h-4 w-4 ${v?"animate-spin":""}`})})]}),l.jsx("div",{className:"rounded-md border",children:l.jsxs(Nr,{children:[l.jsx(Tr,{children:l.jsxs(Ye,{children:[l.jsx(st,{children:"ID"}),l.jsx(st,{children:"Tên Công Việc"}),l.jsx(st,{children:"Thời Gian Bắt Đầu"}),l.jsx(st,{children:"Thời Gian Cập Nhật"}),l.jsx(st,{children:"Thời Gian Thực Thi"}),l.jsx(st,{children:"Trạng Thái"}),l.jsx(st,{children:"Thao Tác"})]})}),l.jsx(Pr,{children:a&&r.length===0?l.jsx(Ye,{children:l.jsx(De,{colSpan:7,className:"text-center py-4",children:l.jsx(ye,{className:"w-6 h-6 animate-spin mx-auto"})})}):r.map(x=>{var P,F;return l.jsxs(Ye,{children:[l.jsx(De,{className:"!w-[100px]",children:x.id}),l.jsx(De,{className:"font-medium",children:(P=x.job_name)==null?void 0:P.replace("Upload file","Summary")}),l.jsx(De,{className:"!w-[200px]",children:S(x.created_at)}),l.jsx(De,{className:"!w-[200px]",children:S(x.updated_at)}),l.jsx(De,{className:"!w-[150px]",children:E(x.execution_time_seconds)}),l.jsx(De,{className:"!w-[200px]",children:l.jsx(Sd,{content:x.status==="fail"&&x.error?l.jsx("div",{className:"font-medium text-[16px] max-w-[90dvw]",children:x.error}):null,children:l.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]
|
|
146
|
+
For more information, see https://radix-ui.com/primitives/docs/components/${t.docsSlug}`;return d.useEffect(()=>{e&&(document.getElementById(e)||console.error(n))},[n,e]),null},Tm="DialogDescriptionWarning",Pm=({contentRef:e,descriptionId:t})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Hl(Tm).contentName}}.`;return d.useEffect(()=>{var s;const o=(s=e.current)==null?void 0:s.getAttribute("aria-describedby");t&&o&&(document.getElementById(t)||console.warn(r))},[r,e,t]),null},Am=Al,_m=Fl,Fm=Dl,Ul=Ml,jl=Il,Wl=$l,Gl=Rl,Om=Bl;const It=Am,Er=_m,Dm=Fm,ql=d.forwardRef(({className:e,...t},n)=>l.jsx(Ul,{ref:n,className:te("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",e),...t}));ql.displayName=Ul.displayName;const vt=d.forwardRef(({className:e,children:t,...n},r)=>l.jsxs(Dm,{children:[l.jsx(ql,{}),l.jsxs(jl,{ref:r,className:te("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",e),...n,children:[t,l.jsxs(Om,{className:te("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:[l.jsx(Uo,{className:"s3-explr-ui-dialog-close-icon h-4 w-4"}),l.jsx("span",{className:"s3-explr-ui-dialog-close-text sr-only",children:"Close"})]})]})]}));vt.displayName=jl.displayName;const yt=({className:e,...t})=>l.jsx("div",{className:te("s3-explr-ui-dialog-header flex flex-col space-y-1.5 text-center sm:text-left",e),...t});yt.displayName="DialogHeader";const un=({className:e,...t})=>l.jsx("div",{className:te("s3-explr-ui-dialog-footer flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...t});un.displayName="DialogFooter";const wt=d.forwardRef(({className:e,...t},n)=>l.jsx(Wl,{ref:n,className:te("s3-explr-ui-dialog-title text-lg font-semibold leading-none tracking-tight",e),...t}));wt.displayName=Wl.displayName;const Mn=d.forwardRef(({className:e,...t},n)=>l.jsx(Gl,{ref:n,className:te("s3-explr-ui-dialog-description text-sm text-muted-foreground",e),...t}));Mn.displayName=Gl.displayName;const kt=d.forwardRef(({className:e,type:t,...n},r)=>l.jsx("input",{type:t,className:te("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",e),ref:r,...n}));kt.displayName="Input";var Mm="Label",Kl=d.forwardRef((e,t)=>l.jsx(be.label,{...e,ref:t,onMouseDown:n=>{var o;n.target.closest("button, input, select, textarea")||((o=e.onMouseDown)==null||o.call(e,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Kl.displayName=Mm;var Xl=Kl;const Im=Yo("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"}}),Wt=d.forwardRef(({className:e,variant:t,size:n,...r},o)=>l.jsx(Xl,{ref:o,className:te(Im({variant:t,size:n}),e),...r}));Wt.displayName=Xl.displayName;const Nr=d.forwardRef(({className:e,...t},n)=>l.jsx("div",{className:te("relative w-full overflow-auto","s3-explr-ui-table-container"),children:l.jsx("table",{ref:n,className:te("w-full caption-bottom text-sm","s3-explr-ui-table",e),...t})}));Nr.displayName="Table";const Tr=d.forwardRef(({className:e,...t},n)=>l.jsx("thead",{ref:n,className:te("[&_tr]:border-b","s3-explr-ui-table-header",e),...t}));Tr.displayName="TableHeader";const Pr=d.forwardRef(({className:e,...t},n)=>l.jsx("tbody",{ref:n,className:te("[&_tr:last-child]:border-0","s3-explr-ui-table-body",e),...t}));Pr.displayName="TableBody";const km=d.forwardRef(({className:e,...t},n)=>l.jsx("tfoot",{ref:n,className:te("border-t bg-muted/50 font-medium [&>tr]:last:border-b-0","s3-explr-ui-table-footer",e),...t}));km.displayName="TableFooter";const Ye=d.forwardRef(({className:e,...t},n)=>l.jsx("tr",{ref:n,className:te("border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted","s3-explr-ui-table-row",e),...t}));Ye.displayName="TableRow";const st=d.forwardRef(({className:e,...t},n)=>l.jsx("th",{ref:n,className:te("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",e),...t}));st.displayName="TableHead";const De=d.forwardRef(({className:e,...t},n)=>l.jsx("td",{ref:n,className:te("p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]","s3-explr-ui-table-cell",e),...t}));De.displayName="TableCell";const $m=d.forwardRef(({className:e,...t},n)=>l.jsx("caption",{ref:n,className:te("mt-4 text-sm text-muted-foreground","s3-explr-ui-table-caption",e),...t}));$m.displayName="TableCaption";function vs(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function dn(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Jl(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ys(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Jl(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Jl(e[o],null)}}}}function ws(...e){return d.useCallback(ys(...e),e)}var bs=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(Rm);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return l.jsx(xs,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return l.jsx(xs,{...r,ref:t,children:n})});bs.displayName="Slot";var xs=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=Bm(n);return d.cloneElement(n,{...Vm(r,n.props),ref:t?ys(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});xs.displayName="SlotClone";var Lm=({children:e})=>l.jsx(l.Fragment,{children:e});function Rm(e){return d.isValidElement(e)&&e.type===Lm}function Vm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Bm(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function zm(e){const t=e+"CollectionProvider",[n,r]=Ot(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:v,children:h}=g,y=A.useRef(null),w=A.useRef(new Map).current;return l.jsx(o,{scope:v,itemMap:w,collectionRef:y,children:h})};i.displayName=t;const a=e+"CollectionSlot",u=A.forwardRef((g,v)=>{const{scope:h,children:y}=g,w=s(a,h),b=ws(v,w.collectionRef);return l.jsx(bs,{ref:b,children:y})});u.displayName=a;const c=e+"CollectionItemSlot",f="data-radix-collection-item",p=A.forwardRef((g,v)=>{const{scope:h,children:y,...w}=g,b=A.useRef(null),S=ws(v,b),E=s(c,h);return A.useEffect(()=>(E.itemMap.set(b,{ref:b,...w}),()=>void E.itemMap.delete(b))),l.jsx(bs,{[f]:"",ref:S,children:y})});p.displayName=c;function m(g){const v=s(e+"CollectionConsumer",g);return A.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((E,x)=>w.indexOf(E.ref.current)-w.indexOf(x.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:u,ItemSlot:p},m,r]}var Yl=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(Um);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return l.jsx(Cs,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return l.jsx(Cs,{...r,ref:t,children:n})});Yl.displayName="Slot";var Cs=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=Wm(n);return d.cloneElement(n,{...jm(r,n.props),ref:t?ys(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});Cs.displayName="SlotClone";var Hm=({children:e})=>l.jsx(l.Fragment,{children:e});function Um(e){return d.isValidElement(e)&&e.type===Hm}function jm(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Wm(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Gm=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Zl=Gm.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Yl:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),qm=d.createContext(void 0);function Ql(e){const t=d.useContext(qm);return e||t||"ltr"}var Ss="rovingFocusGroup.onEntryFocus",Km={bubbles:!1,cancelable:!0},Ar="RovingFocusGroup",[Es,ec,Xm]=zm(Ar),[Jm,tc]=Ot(Ar,[Xm]),[Ym,Zm]=Jm(Ar),nc=d.forwardRef((e,t)=>l.jsx(Es.Provider,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Es.Slot,{scope:e.__scopeRovingFocusGroup,children:l.jsx(Qm,{...e,ref:t})})}));nc.displayName=Ar;var Qm=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:o=!1,dir:s,currentTabStopId:i,defaultCurrentTabStopId:a,onCurrentTabStopIdChange:u,onEntryFocus:c,preventScrollOnEntryFocus:f=!1,...p}=e,m=d.useRef(null),g=ws(t,m),v=Ql(s),[h=null,y]=nn({prop:i,defaultProp:a,onChange:u}),[w,b]=d.useState(!1),S=Ae(c),E=ec(n),x=d.useRef(!1),[P,F]=d.useState(0);return d.useEffect(()=>{const O=m.current;if(O)return O.addEventListener(Ss,S),()=>O.removeEventListener(Ss,S)},[S]),l.jsx(Ym,{scope:n,orientation:r,dir:v,loop:o,currentTabStopId:h,onItemFocus:d.useCallback(O=>y(O),[y]),onItemShiftTab:d.useCallback(()=>b(!0),[]),onFocusableItemAdd:d.useCallback(()=>F(O=>O+1),[]),onFocusableItemRemove:d.useCallback(()=>F(O=>O-1),[]),children:l.jsx(Zl.div,{tabIndex:w||P===0?-1:0,"data-orientation":r,...p,ref:g,style:{outline:"none",...e.style},onMouseDown:dn(e.onMouseDown,()=>{x.current=!0}),onFocus:dn(e.onFocus,O=>{const I=!x.current;if(O.target===O.currentTarget&&I&&!w){const D=new CustomEvent(Ss,Km);if(O.currentTarget.dispatchEvent(D),!D.defaultPrevented){const q=E().filter(B=>B.focusable),k=q.find(B=>B.active),z=q.find(B=>B.id===h),J=[k,z,...q].filter(Boolean).map(B=>B.ref.current);sc(J,f)}}x.current=!1}),onBlur:dn(e.onBlur,()=>b(!1))})})}),rc="RovingFocusGroupItem",oc=d.forwardRef((e,t)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:o=!1,tabStopId:s,...i}=e,a=on(),u=s||a,c=Zm(rc,n),f=c.currentTabStopId===u,p=ec(n),{onFocusableItemAdd:m,onFocusableItemRemove:g}=c;return d.useEffect(()=>{if(r)return m(),()=>g()},[r,m,g]),l.jsx(Es.ItemSlot,{scope:n,id:u,focusable:r,active:o,children:l.jsx(Zl.span,{tabIndex:f?0:-1,"data-orientation":c.orientation,...i,ref:t,onMouseDown:dn(e.onMouseDown,v=>{r?c.onItemFocus(u):v.preventDefault()}),onFocus:dn(e.onFocus,()=>c.onItemFocus(u)),onKeyDown:dn(e.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){c.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const h=nv(v,c.orientation,c.dir);if(h!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=p().filter(b=>b.focusable).map(b=>b.ref.current);if(h==="last")w.reverse();else if(h==="prev"||h==="next"){h==="prev"&&w.reverse();const b=w.indexOf(v.currentTarget);w=c.loop?rv(w,b+1):w.slice(b+1)}setTimeout(()=>sc(w))}})})})});oc.displayName=rc;var ev={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function tv(e,t){return t!=="rtl"?e:e==="ArrowLeft"?"ArrowRight":e==="ArrowRight"?"ArrowLeft":e}function nv(e,t,n){const r=tv(e.key,n);if(!(t==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(t==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return ev[r]}function sc(e,t=!1){const n=document.activeElement;for(const r of e)if(r===n||(r.focus({preventScroll:t}),document.activeElement!==n))return}function rv(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var ov=nc,sv=oc;function ic(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function iv(...e){return t=>{let n=!1;const r=e.map(o=>{const s=ic(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():ic(e[o],null)}}}}function av(...e){return d.useCallback(iv(...e),e)}function lv(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var ac=e=>{const{present:t,children:n}=e,r=cv(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=av(r.ref,uv(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};ac.displayName="Presence";function cv(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[a,u]=lv(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const c=_r(r.current);s.current=a==="mounted"?c:"none"},[a]),Re(()=>{const c=r.current,f=o.current;if(f!==e){const m=s.current,g=_r(c);e?u("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?u("UNMOUNT"):u(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Re(()=>{if(t){let c;const f=t.ownerDocument.defaultView??window,p=g=>{const h=_r(r.current).includes(g.animationName);if(g.target===t&&h&&(u("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",c=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=g=>{g.target===t&&(s.current=_r(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(c),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:d.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function _r(e){return(e==null?void 0:e.animationName)||"none"}function uv(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function lc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function dv(...e){return t=>{let n=!1;const r=e.map(o=>{const s=lc(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():lc(e[o],null)}}}}var cc=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(pv);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return l.jsx(Ns,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return l.jsx(Ns,{...r,ref:t,children:n})});cc.displayName="Slot";var Ns=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=hv(n);return d.cloneElement(n,{...gv(r,n.props),ref:t?dv(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});Ns.displayName="SlotClone";var fv=({children:e})=>l.jsx(l.Fragment,{children:e});function pv(e){return d.isValidElement(e)&&e.type===fv}function gv(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function hv(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var mv=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Fr=mv.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?cc:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Ts="Tabs",[vv,pC]=Ot(Ts,[tc]),uc=tc(),[yv,Ps]=vv(Ts),dc=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,onValueChange:o,defaultValue:s,orientation:i="horizontal",dir:a,activationMode:u="automatic",...c}=e,f=Ql(a),[p,m]=nn({prop:r,onChange:o,defaultProp:s});return l.jsx(yv,{scope:n,baseId:on(),value:p,onValueChange:m,orientation:i,dir:f,activationMode:u,children:l.jsx(Fr.div,{dir:f,"data-orientation":i,...c,ref:t})})});dc.displayName=Ts;var fc="TabsList",pc=d.forwardRef((e,t)=>{const{__scopeTabs:n,loop:r=!0,...o}=e,s=Ps(fc,n),i=uc(n);return l.jsx(ov,{asChild:!0,...i,orientation:s.orientation,dir:s.dir,loop:r,children:l.jsx(Fr.div,{role:"tablist","aria-orientation":s.orientation,...o,ref:t})})});pc.displayName=fc;var gc="TabsTrigger",hc=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,disabled:o=!1,...s}=e,i=Ps(gc,n),a=uc(n),u=yc(i.baseId,r),c=wc(i.baseId,r),f=r===i.value;return l.jsx(sv,{asChild:!0,...a,focusable:!o,active:f,children:l.jsx(Fr.button,{type:"button",role:"tab","aria-selected":f,"aria-controls":c,"data-state":f?"active":"inactive","data-disabled":o?"":void 0,disabled:o,id:u,...s,ref:t,onMouseDown:vs(e.onMouseDown,p=>{!o&&p.button===0&&p.ctrlKey===!1?i.onValueChange(r):p.preventDefault()}),onKeyDown:vs(e.onKeyDown,p=>{[" ","Enter"].includes(p.key)&&i.onValueChange(r)}),onFocus:vs(e.onFocus,()=>{const p=i.activationMode!=="manual";!f&&!o&&p&&i.onValueChange(r)})})})});hc.displayName=gc;var mc="TabsContent",vc=d.forwardRef((e,t)=>{const{__scopeTabs:n,value:r,forceMount:o,children:s,...i}=e,a=Ps(mc,n),u=yc(a.baseId,r),c=wc(a.baseId,r),f=r===a.value,p=d.useRef(f);return d.useEffect(()=>{const m=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(m)},[]),l.jsx(ac,{present:o||f,children:({present:m})=>l.jsx(Fr.div,{"data-state":f?"active":"inactive","data-orientation":a.orientation,role:"tabpanel","aria-labelledby":u,hidden:!m,id:c,tabIndex:0,...i,ref:t,style:{...e.style,animationDuration:p.current?"0s":void 0},children:m&&s})})});vc.displayName=mc;function yc(e,t){return`${e}-trigger-${t}`}function wc(e,t){return`${e}-content-${t}`}var wv=dc,bc=pc,xc=hc,Cc=vc;const bv=wv,Sc=d.forwardRef(({className:e,...t},n)=>l.jsx(bc,{ref:n,className:te("inline-flex h-9 items-center justify-center rounded-lg bg-muted p-1 text-muted-foreground",e),...t}));Sc.displayName=bc.displayName;const Or=d.forwardRef(({className:e,...t},n)=>l.jsx(xc,{ref:n,className:te("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",e),...t}));Or.displayName=xc.displayName;const Dr=d.forwardRef(({className:e,...t},n)=>l.jsx(Cc,{ref:n,className:te("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",e),...t}));Dr.displayName=Cc.displayName;const In=d.forwardRef(({className:e,...t},n)=>l.jsx("textarea",{className:te("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",e),ref:n,...t}));In.displayName="Textarea";function xv(e,t=[]){let n=[];function r(s,i){const a=d.createContext(i),u=n.length;n=[...n,i];function c(p){const{scope:m,children:g,...v}=p,h=(m==null?void 0:m[e][u])||a,y=d.useMemo(()=>v,Object.values(v));return l.jsx(h.Provider,{value:y,children:g})}function f(p,m){const g=(m==null?void 0:m[e][u])||a,v=d.useContext(g);if(v)return v;if(i!==void 0)return i;throw new Error(`\`${p}\` must be used within \`${s}\``)}return c.displayName=s+"Provider",[c,f]}const o=()=>{const s=n.map(i=>d.createContext(i));return function(a){const u=(a==null?void 0:a[e])||s;return d.useMemo(()=>({[`__scope${e}`]:{...a,[e]:u}}),[a,u])}};return o.scopeName=e,[r,Cv(o,...t)]}function Cv(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(s){const i=r.reduce((a,{useScope:u,scopeName:c})=>{const p=u(s)[`__scope${c}`];return{...a,...p}},{});return d.useMemo(()=>({[`__scope${t.scopeName}`]:i}),[i])}};return n.scopeName=t.scopeName,n}var As=d.forwardRef((e,t)=>{const{children:n,...r}=e,o=d.Children.toArray(n),s=o.find(Ev);if(s){const i=s.props.children,a=o.map(u=>u===s?d.Children.count(i)>1?d.Children.only(null):d.isValidElement(i)?i.props.children:null:u);return l.jsx(_s,{...r,ref:t,children:d.isValidElement(i)?d.cloneElement(i,void 0,a):null})}return l.jsx(_s,{...r,ref:t,children:n})});As.displayName="Slot";var _s=d.forwardRef((e,t)=>{const{children:n,...r}=e;if(d.isValidElement(n)){const o=Tv(n);return d.cloneElement(n,{...Nv(r,n.props),ref:t?gr(t,o):o})}return d.Children.count(n)>1?d.Children.only(null):null});_s.displayName="SlotClone";var Sv=({children:e})=>l.jsx(l.Fragment,{children:e});function Ev(e){return d.isValidElement(e)&&e.type===Sv}function Nv(e,t){const n={...t};for(const r in t){const o=e[r],s=t[r];/^on[A-Z]/.test(r)?o&&s?n[r]=(...a)=>{s(...a),o(...a)}:o&&(n[r]=o):r==="style"?n[r]={...o,...s}:r==="className"&&(n[r]=[o,s].filter(Boolean).join(" "))}return{...e,...n}}function Tv(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}function Pv(e){const t=e+"CollectionProvider",[n,r]=xv(t),[o,s]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=g=>{const{scope:v,children:h}=g,y=A.useRef(null),w=A.useRef(new Map).current;return l.jsx(o,{scope:v,itemMap:w,collectionRef:y,children:h})};i.displayName=t;const a=e+"CollectionSlot",u=A.forwardRef((g,v)=>{const{scope:h,children:y}=g,w=s(a,h),b=ze(v,w.collectionRef);return l.jsx(As,{ref:b,children:y})});u.displayName=a;const c=e+"CollectionItemSlot",f="data-radix-collection-item",p=A.forwardRef((g,v)=>{const{scope:h,children:y,...w}=g,b=A.useRef(null),S=ze(v,b),E=s(c,h);return A.useEffect(()=>(E.itemMap.set(b,{ref:b,...w}),()=>void E.itemMap.delete(b))),l.jsx(As,{[f]:"",ref:S,children:y})});p.displayName=c;function m(g){const v=s(e+"CollectionConsumer",g);return A.useCallback(()=>{const y=v.collectionRef.current;if(!y)return[];const w=Array.from(y.querySelectorAll(`[${f}]`));return Array.from(v.itemMap.values()).sort((E,x)=>w.indexOf(E.ref.current)-w.indexOf(x.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:i,Slot:u,ItemSlot:p},m,r]}var Av="VisuallyHidden",Fs=d.forwardRef((e,t)=>l.jsx(be.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));Fs.displayName=Av;var Os="ToastProvider",[Ds,_v,Fv]=Pv("Toast"),[Ec,gC]=Ot("Toast",[Fv]),[Ov,Mr]=Ec(Os),Nc=e=>{const{__scopeToast:t,label:n="Notification",duration:r=5e3,swipeDirection:o="right",swipeThreshold:s=50,children:i}=e,[a,u]=d.useState(null),[c,f]=d.useState(0),p=d.useRef(!1),m=d.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${Os}\`. Expected non-empty \`string\`.`),l.jsx(Ds.Provider,{scope:t,children:l.jsx(Ov,{scope:t,label:n,duration:r,swipeDirection:o,swipeThreshold:s,toastCount:c,viewport:a,onViewportChange:u,onToastAdd:d.useCallback(()=>f(g=>g+1),[]),onToastRemove:d.useCallback(()=>f(g=>g-1),[]),isFocusedToastEscapeKeyDownRef:p,isClosePausedRef:m,children:i})})};Nc.displayName=Os;var Tc="ToastViewport",Dv=["F8"],Ms="toast.viewportPause",Is="toast.viewportResume",Pc=d.forwardRef((e,t)=>{const{__scopeToast:n,hotkey:r=Dv,label:o="Notifications ({hotkey})",...s}=e,i=Mr(Tc,n),a=_v(n),u=d.useRef(null),c=d.useRef(null),f=d.useRef(null),p=d.useRef(null),m=ze(t,p,i.onViewportChange),g=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),v=i.toastCount>0;d.useEffect(()=>{const y=w=>{var S;r.length!==0&&r.every(E=>w[E]||w.code===E)&&((S=p.current)==null||S.focus())};return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[r]),d.useEffect(()=>{const y=u.current,w=p.current;if(v&&y&&w){const b=()=>{if(!i.isClosePausedRef.current){const P=new CustomEvent(Ms);w.dispatchEvent(P),i.isClosePausedRef.current=!0}},S=()=>{if(i.isClosePausedRef.current){const P=new CustomEvent(Is);w.dispatchEvent(P),i.isClosePausedRef.current=!1}},E=P=>{!y.contains(P.relatedTarget)&&S()},x=()=>{y.contains(document.activeElement)||S()};return y.addEventListener("focusin",b),y.addEventListener("focusout",E),y.addEventListener("pointermove",b),y.addEventListener("pointerleave",x),window.addEventListener("blur",b),window.addEventListener("focus",S),()=>{y.removeEventListener("focusin",b),y.removeEventListener("focusout",E),y.removeEventListener("pointermove",b),y.removeEventListener("pointerleave",x),window.removeEventListener("blur",b),window.removeEventListener("focus",S)}}},[v,i.isClosePausedRef]);const h=d.useCallback(({tabbingDirection:y})=>{const b=a().map(S=>{const E=S.ref.current,x=[E,...Wv(E)];return y==="forwards"?x:x.reverse()});return(y==="forwards"?b.reverse():b).flat()},[a]);return d.useEffect(()=>{const y=p.current;if(y){const w=b=>{var x,P,F;const S=b.altKey||b.ctrlKey||b.metaKey;if(b.key==="Tab"&&!S){const O=document.activeElement,I=b.shiftKey;if(b.target===y&&I){(x=c.current)==null||x.focus();return}const k=h({tabbingDirection:I?"backwards":"forwards"}),z=k.findIndex(R=>R===O);Ls(k.slice(z+1))?b.preventDefault():I?(P=c.current)==null||P.focus():(F=f.current)==null||F.focus()}};return y.addEventListener("keydown",w),()=>y.removeEventListener("keydown",w)}},[a,h]),l.jsxs(xh,{ref:u,role:"region","aria-label":o.replace("{hotkey}",g),tabIndex:-1,style:{pointerEvents:v?void 0:"none"},children:[v&&l.jsx(ks,{ref:c,onFocusFromOutsideViewport:()=>{const y=h({tabbingDirection:"forwards"});Ls(y)}}),l.jsx(Ds.Slot,{scope:n,children:l.jsx(be.ol,{tabIndex:-1,...s,ref:m})}),v&&l.jsx(ks,{ref:f,onFocusFromOutsideViewport:()=>{const y=h({tabbingDirection:"backwards"});Ls(y)}})]})});Pc.displayName=Tc;var Ac="ToastFocusProxy",ks=d.forwardRef((e,t)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...o}=e,s=Mr(Ac,n);return l.jsx(Fs,{"aria-hidden":!0,tabIndex:0,...o,ref:t,style:{position:"fixed"},onFocus:i=>{var c;const a=i.relatedTarget;!((c=s.viewport)!=null&&c.contains(a))&&r()}})});ks.displayName=Ac;var Ir="Toast",Mv="toast.swipeStart",Iv="toast.swipeMove",kv="toast.swipeCancel",$v="toast.swipeEnd",_c=d.forwardRef((e,t)=>{const{forceMount:n,open:r,defaultOpen:o,onOpenChange:s,...i}=e,[a=!0,u]=nn({prop:r,defaultProp:o,onChange:s});return l.jsx(rn,{present:n||a,children:l.jsx(Vv,{open:a,...i,ref:t,onClose:()=>u(!1),onPause:Ae(e.onPause),onResume:Ae(e.onResume),onSwipeStart:we(e.onSwipeStart,c=>{c.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:we(e.onSwipeMove,c=>{const{x:f,y:p}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","move"),c.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${f}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${p}px`)}),onSwipeCancel:we(e.onSwipeCancel,c=>{c.currentTarget.setAttribute("data-swipe","cancel"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:we(e.onSwipeEnd,c=>{const{x:f,y:p}=c.detail.delta;c.currentTarget.setAttribute("data-swipe","end"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),c.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),c.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${f}px`),c.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${p}px`),u(!1)})})})});_c.displayName=Ir;var[Lv,Rv]=Ec(Ir,{onClose(){}}),Vv=d.forwardRef((e,t)=>{const{__scopeToast:n,type:r="foreground",duration:o,open:s,onClose:i,onEscapeKeyDown:a,onPause:u,onResume:c,onSwipeStart:f,onSwipeMove:p,onSwipeCancel:m,onSwipeEnd:g,...v}=e,h=Mr(Ir,n),[y,w]=d.useState(null),b=ze(t,R=>w(R)),S=d.useRef(null),E=d.useRef(null),x=o||h.duration,P=d.useRef(0),F=d.useRef(x),O=d.useRef(0),{onToastAdd:I,onToastRemove:D}=h,q=Ae(()=>{var J;(y==null?void 0:y.contains(document.activeElement))&&((J=h.viewport)==null||J.focus()),i()}),k=d.useCallback(R=>{!R||R===1/0||(window.clearTimeout(O.current),P.current=new Date().getTime(),O.current=window.setTimeout(q,R))},[q]);d.useEffect(()=>{const R=h.viewport;if(R){const J=()=>{k(F.current),c==null||c()},B=()=>{const U=new Date().getTime()-P.current;F.current=F.current-U,window.clearTimeout(O.current),u==null||u()};return R.addEventListener(Ms,B),R.addEventListener(Is,J),()=>{R.removeEventListener(Ms,B),R.removeEventListener(Is,J)}}},[h.viewport,x,u,c,k]),d.useEffect(()=>{s&&!h.isClosePausedRef.current&&k(x)},[s,x,h.isClosePausedRef,k]),d.useEffect(()=>(I(),()=>D()),[I,D]);const z=d.useMemo(()=>y?$c(y):null,[y]);return h.viewport?l.jsxs(l.Fragment,{children:[z&&l.jsx(Bv,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:z}),l.jsx(Lv,{scope:n,onClose:q,children:Yn.createPortal(l.jsx(Ds.ItemSlot,{scope:n,children:l.jsx(bh,{asChild:!0,onEscapeKeyDown:we(a,()=>{h.isFocusedToastEscapeKeyDownRef.current||q(),h.isFocusedToastEscapeKeyDownRef.current=!1}),children:l.jsx(be.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":s?"open":"closed","data-swipe-direction":h.swipeDirection,...v,ref:b,style:{userSelect:"none",touchAction:"none",...e.style},onKeyDown:we(e.onKeyDown,R=>{R.key==="Escape"&&(a==null||a(R.nativeEvent),R.nativeEvent.defaultPrevented||(h.isFocusedToastEscapeKeyDownRef.current=!0,q()))}),onPointerDown:we(e.onPointerDown,R=>{R.button===0&&(S.current={x:R.clientX,y:R.clientY})}),onPointerMove:we(e.onPointerMove,R=>{if(!S.current)return;const J=R.clientX-S.current.x,B=R.clientY-S.current.y,U=!!E.current,K=["left","right"].includes(h.swipeDirection),Y=["left","up"].includes(h.swipeDirection)?Math.min:Math.max,le=K?Y(0,J):0,ue=K?0:Y(0,B),Ee=R.pointerType==="touch"?10:2,Ie={x:le,y:ue},Ue={originalEvent:R,delta:Ie};U?(E.current=Ie,kr(Iv,p,Ue,{discrete:!1})):Lc(Ie,h.swipeDirection,Ee)?(E.current=Ie,kr(Mv,f,Ue,{discrete:!1}),R.target.setPointerCapture(R.pointerId)):(Math.abs(J)>Ee||Math.abs(B)>Ee)&&(S.current=null)}),onPointerUp:we(e.onPointerUp,R=>{const J=E.current,B=R.target;if(B.hasPointerCapture(R.pointerId)&&B.releasePointerCapture(R.pointerId),E.current=null,S.current=null,J){const U=R.currentTarget,K={originalEvent:R,delta:J};Lc(J,h.swipeDirection,h.swipeThreshold)?kr($v,g,K,{discrete:!0}):kr(kv,m,K,{discrete:!0}),U.addEventListener("click",Y=>Y.preventDefault(),{once:!0})}})})})}),h.viewport)})]}):null}),Bv=e=>{const{__scopeToast:t,children:n,...r}=e,o=Mr(Ir,t),[s,i]=d.useState(!1),[a,u]=d.useState(!1);return Uv(()=>i(!0)),d.useEffect(()=>{const c=window.setTimeout(()=>u(!0),1e3);return()=>window.clearTimeout(c)},[]),a?null:l.jsx(ss,{asChild:!0,children:l.jsx(Fs,{...r,children:s&&l.jsxs(l.Fragment,{children:[o.label," ",n]})})})},zv="ToastTitle",Fc=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return l.jsx(be.div,{...r,ref:t})});Fc.displayName=zv;var Hv="ToastDescription",Oc=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e;return l.jsx(be.div,{...r,ref:t})});Oc.displayName=Hv;var Dc="ToastAction",Mc=d.forwardRef((e,t)=>{const{altText:n,...r}=e;return n.trim()?l.jsx(kc,{altText:n,asChild:!0,children:l.jsx($s,{...r,ref:t})}):(console.error(`Invalid prop \`altText\` supplied to \`${Dc}\`. Expected non-empty \`string\`.`),null)});Mc.displayName=Dc;var Ic="ToastClose",$s=d.forwardRef((e,t)=>{const{__scopeToast:n,...r}=e,o=Rv(Ic,n);return l.jsx(kc,{asChild:!0,children:l.jsx(be.button,{type:"button",...r,ref:t,onClick:we(e.onClick,o.onClose)})})});$s.displayName=Ic;var kc=d.forwardRef((e,t)=>{const{__scopeToast:n,altText:r,...o}=e;return l.jsx(be.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...o,ref:t})});function $c(e){const t=[];return Array.from(e.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&t.push(r.textContent),jv(r)){const o=r.ariaHidden||r.hidden||r.style.display==="none",s=r.dataset.radixToastAnnounceExclude==="";if(!o)if(s){const i=r.dataset.radixToastAnnounceAlt;i&&t.push(i)}else t.push(...$c(r))}}),t}function kr(e,t,n,{discrete:r}){const o=n.originalEvent.currentTarget,s=new CustomEvent(e,{bubbles:!0,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?Wa(o,s):o.dispatchEvent(s)}var Lc=(e,t,n=0)=>{const r=Math.abs(e.x),o=Math.abs(e.y),s=r>o;return t==="left"||t==="right"?s&&r>n:!s&&o>n};function Uv(e=()=>{}){const t=Ae(e);Re(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(t)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[t])}function jv(e){return e.nodeType===e.ELEMENT_NODE}function Wv(e){const t=[],n=document.createTreeWalker(e,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();)t.push(n.currentNode);return t}function Ls(e){const t=document.activeElement;return e.some(n=>n===t?!0:(n.focus(),document.activeElement!==t))}var Gv=Nc,Rc=Pc,Vc=_c,Bc=Fc,zc=Oc,Hc=Mc,Uc=$s;const qv=Gv,jc=d.forwardRef(({className:e,...t},n)=>l.jsx(Rc,{ref:n,className:te("s3-explr-ui-toast-viewport fixed top-0 z-[100] 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]",e),...t}));jc.displayName=Rc.displayName;const Kv=Yo("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"}}),Wc=d.forwardRef(({className:e,variant:t,...n},r)=>l.jsx(Vc,{ref:r,className:te(Kv({variant:t}),e),...n}));Wc.displayName=Vc.displayName;const Xv=d.forwardRef(({className:e,...t},n)=>l.jsx(Hc,{ref:n,className:te("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",e),...t}));Xv.displayName=Hc.displayName;const Gc=d.forwardRef(({className:e,...t},n)=>l.jsx(Uc,{ref:n,className:te("s3-explr-ui-toast-close absolute right-1 top-1 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity 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",e),"toast-close":"",...t,children:l.jsx(Uo,{className:"s3-explr-ui-toast-close-icon h-4 w-4"})}));Gc.displayName=Uc.displayName;const qc=d.forwardRef(({className:e,...t},n)=>l.jsx(Bc,{ref:n,className:te("s3-explr-ui-toast-title text-sm font-semibold [&+div]:text-xs",e),...t}));qc.displayName=Bc.displayName;const Kc=d.forwardRef(({className:e,...t},n)=>l.jsx(zc,{ref:n,className:te("s3-explr-ui-toast-description text-sm opacity-90",e),...t}));Kc.displayName=zc.displayName;const Jv=1,Yv=1e6;let Rs=0;function Zv(){return Rs=(Rs+1)%Number.MAX_SAFE_INTEGER,Rs.toString()}const Vs=new Map,Xc=e=>{if(Vs.has(e))return;const t=setTimeout(()=>{Vs.delete(e),kn({type:"REMOVE_TOAST",toastId:e})},Yv);Vs.set(e,t)},Qv=(e,t)=>{switch(t.type){case"ADD_TOAST":return{...e,toasts:[t.toast,...e.toasts].slice(0,Jv)};case"UPDATE_TOAST":return{...e,toasts:e.toasts.map(n=>n.id===t.toast.id?{...n,...t.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=t;return n?Xc(n):e.toasts.forEach(r=>{Xc(r.id)}),{...e,toasts:e.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(n=>n.id!==t.toastId)}}},$r=[];let Lr={toasts:[]};function kn(e){Lr=Qv(Lr,e),$r.forEach(t=>{t(Lr)})}function ey({...e}){const t=Zv(),n=o=>kn({type:"UPDATE_TOAST",toast:{...o,id:t}}),r=()=>kn({type:"DISMISS_TOAST",toastId:t});return kn({type:"ADD_TOAST",toast:{...e,id:t,open:!0,onOpenChange:o=>{o||r()}}}),{id:t,dismiss:r,update:n}}function Rr(){const[e,t]=d.useState(Lr);return d.useEffect(()=>($r.push(t),()=>{const n=$r.indexOf(t);n>-1&&$r.splice(n,1)}),[e]),{...e,toast:ey,dismiss:n=>kn({type:"DISMISS_TOAST",toastId:n})}}function Jc(){const{toasts:e}=Rr();return l.jsxs(qv,{children:[e.map(function({id:t,title:n,description:r,action:o,...s}){return l.jsxs(Wc,{...s,className:`s3-explr-ui-toast ${s.className||""}`,children:[l.jsxs("div",{className:"s3-explr-ui-toast-content grid gap-1",children:[n&&l.jsx(qc,{className:"s3-explr-ui-toast-title",children:n}),r&&l.jsx(Kc,{className:"s3-explr-ui-toast-description",children:r})]}),o&&l.jsx("div",{className:"s3-explr-ui-toast-action",children:o}),l.jsx(Gc,{className:"s3-explr-ui-toast-close"})]},t)}),l.jsx(jc,{className:"s3-explr-ui-toast-viewport"})]})}function bt(e,t,{checkForDefaultPrevented:n=!0}={}){return function(o){if(e==null||e(o),n===!1||!o.defaultPrevented)return t==null?void 0:t(o)}}function Yc(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function ty(...e){return t=>{let n=!1;const r=e.map(o=>{const s=Yc(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():Yc(e[o],null)}}}}function $n(...e){return d.useCallback(ty(...e),e)}var ny=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Ln=ny.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Qt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{});function ry(e,t){e&&Yn.flushSync(()=>e.dispatchEvent(t))}var oy="DismissableLayer",Bs="dismissableLayer.update",sy="dismissableLayer.pointerDownOutside",iy="dismissableLayer.focusOutside",Zc,Qc=d.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),eu=d.forwardRef((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:s,onInteractOutside:i,onDismiss:a,...u}=e,c=d.useContext(Qc),[f,p]=d.useState(null),m=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,g]=d.useState({}),v=$n(t,F=>p(F)),h=Array.from(c.layers),[y]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),w=h.indexOf(y),b=f?h.indexOf(f):-1,S=c.layersWithOutsidePointerEventsDisabled.size>0,E=b>=w,x=cy(F=>{const O=F.target,I=[...c.branches].some(D=>D.contains(O));!E||I||(o==null||o(F),i==null||i(F),F.defaultPrevented||a==null||a())},m),P=uy(F=>{const O=F.target;[...c.branches].some(D=>D.contains(O))||(s==null||s(F),i==null||i(F),F.defaultPrevented||a==null||a())},m);return Ya(F=>{b===c.layers.size-1&&(r==null||r(F),!F.defaultPrevented&&a&&(F.preventDefault(),a()))},m),d.useEffect(()=>{if(f)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(Zc=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(f)),c.layers.add(f),tu(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=Zc)}},[f,m,n,c]),d.useEffect(()=>()=>{f&&(c.layers.delete(f),c.layersWithOutsidePointerEventsDisabled.delete(f),tu())},[f,c]),d.useEffect(()=>{const F=()=>g({});return document.addEventListener(Bs,F),()=>document.removeEventListener(Bs,F)},[]),l.jsx(Ln.div,{...u,ref:v,style:{pointerEvents:S?E?"auto":"none":void 0,...e.style},onFocusCapture:bt(e.onFocusCapture,P.onFocusCapture),onBlurCapture:bt(e.onBlurCapture,P.onBlurCapture),onPointerDownCapture:bt(e.onPointerDownCapture,x.onPointerDownCapture)})});eu.displayName=oy;var ay="DismissableLayerBranch",ly=d.forwardRef((e,t)=>{const n=d.useContext(Qc),r=d.useRef(null),o=$n(t,r);return d.useEffect(()=>{const s=r.current;if(s)return n.branches.add(s),()=>{n.branches.delete(s)}},[n.branches]),l.jsx(Ln.div,{...e,ref:o})});ly.displayName=ay;function cy(e,t=globalThis==null?void 0:globalThis.document){const n=Ae(e),r=d.useRef(!1),o=d.useRef(()=>{});return d.useEffect(()=>{const s=a=>{if(a.target&&!r.current){let u=function(){nu(sy,n,c,{discrete:!0})};const c={originalEvent:a};a.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=u,t.addEventListener("click",o.current,{once:!0})):u()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",s)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",s),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function uy(e,t=globalThis==null?void 0:globalThis.document){const n=Ae(e),r=d.useRef(!1);return d.useEffect(()=>{const o=s=>{s.target&&!r.current&&nu(iy,n,{originalEvent:s},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function tu(){const e=new CustomEvent(Bs);document.dispatchEvent(e)}function nu(e,t,n,{discrete:r}){const o=n.originalEvent.target,s=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?ry(o,s):o.dispatchEvent(s)}const dy=["top","right","bottom","left"],$t=Math.min,Ve=Math.max,Vr=Math.round,Br=Math.floor,it=e=>({x:e,y:e}),fy={left:"right",right:"left",bottom:"top",top:"bottom"},py={start:"end",end:"start"};function zs(e,t,n){return Ve(e,$t(t,n))}function xt(e,t){return typeof e=="function"?e(t):e}function Ct(e){return e.split("-")[0]}function fn(e){return e.split("-")[1]}function Hs(e){return e==="x"?"y":"x"}function Us(e){return e==="y"?"height":"width"}function Lt(e){return["top","bottom"].includes(Ct(e))?"y":"x"}function js(e){return Hs(Lt(e))}function gy(e,t,n){n===void 0&&(n=!1);const r=fn(e),o=js(e),s=Us(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[s]>t.floating[s]&&(i=zr(i)),[i,zr(i)]}function hy(e){const t=zr(e);return[Ws(e),t,Ws(t)]}function Ws(e){return e.replace(/start|end/g,t=>py[t])}function my(e,t,n){const r=["left","right"],o=["right","left"],s=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?s:i;default:return[]}}function vy(e,t,n,r){const o=fn(e);let s=my(Ct(e),n==="start",r);return o&&(s=s.map(i=>i+"-"+o),t&&(s=s.concat(s.map(Ws)))),s}function zr(e){return e.replace(/left|right|bottom|top/g,t=>fy[t])}function yy(e){return{top:0,right:0,bottom:0,left:0,...e}}function ru(e){return typeof e!="number"?yy(e):{top:e,right:e,bottom:e,left:e}}function Hr(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function ou(e,t,n){let{reference:r,floating:o}=e;const s=Lt(t),i=js(t),a=Us(i),u=Ct(t),c=s==="y",f=r.x+r.width/2-o.width/2,p=r.y+r.height/2-o.height/2,m=r[a]/2-o[a]/2;let g;switch(u){case"top":g={x:f,y:r.y-o.height};break;case"bottom":g={x:f,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:p};break;case"left":g={x:r.x-o.width,y:p};break;default:g={x:r.x,y:r.y}}switch(fn(t)){case"start":g[i]-=m*(n&&c?-1:1);break;case"end":g[i]+=m*(n&&c?-1:1);break}return g}const wy=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:s=[],platform:i}=n,a=s.filter(Boolean),u=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:p}=ou(c,r,u),m=r,g={},v=0;for(let h=0;h<a.length;h++){const{name:y,fn:w}=a[h],{x:b,y:S,data:E,reset:x}=await w({x:f,y:p,initialPlacement:r,placement:m,strategy:o,middlewareData:g,rects:c,platform:i,elements:{reference:e,floating:t}});f=b??f,p=S??p,g={...g,[y]:{...g[y],...E}},x&&v<=50&&(v++,typeof x=="object"&&(x.placement&&(m=x.placement),x.rects&&(c=x.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):x.rects),{x:f,y:p}=ou(c,m,u)),h=-1)}return{x:f,y:p,placement:m,strategy:o,middlewareData:g}};async function Rn(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:s,rects:i,elements:a,strategy:u}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:m=!1,padding:g=0}=xt(t,e),v=ru(g),y=a[m?p==="floating"?"reference":"floating":p],w=Hr(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(a.floating)),boundary:c,rootBoundary:f,strategy:u})),b=p==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,S=await(s.getOffsetParent==null?void 0:s.getOffsetParent(a.floating)),E=await(s.isElement==null?void 0:s.isElement(S))?await(s.getScale==null?void 0:s.getScale(S))||{x:1,y:1}:{x:1,y:1},x=Hr(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:b,offsetParent:S,strategy:u}):b);return{top:(w.top-x.top+v.top)/E.y,bottom:(x.bottom-w.bottom+v.bottom)/E.y,left:(w.left-x.left+v.left)/E.x,right:(x.right-w.right+v.right)/E.x}}const by=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:s,platform:i,elements:a,middlewareData:u}=t,{element:c,padding:f=0}=xt(e,t)||{};if(c==null)return{};const p=ru(f),m={x:n,y:r},g=js(o),v=Us(g),h=await i.getDimensions(c),y=g==="y",w=y?"top":"left",b=y?"bottom":"right",S=y?"clientHeight":"clientWidth",E=s.reference[v]+s.reference[g]-m[g]-s.floating[v],x=m[g]-s.reference[g],P=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let F=P?P[S]:0;(!F||!await(i.isElement==null?void 0:i.isElement(P)))&&(F=a.floating[S]||s.floating[v]);const O=E/2-x/2,I=F/2-h[v]/2-1,D=$t(p[w],I),q=$t(p[b],I),k=D,z=F-h[v]-q,R=F/2-h[v]/2+O,J=zs(k,R,z),B=!u.arrow&&fn(o)!=null&&R!==J&&s.reference[v]/2-(R<k?D:q)-h[v]/2<0,U=B?R<k?R-k:R-z:0;return{[g]:m[g]+U,data:{[g]:J,centerOffset:R-J-U,...B&&{alignmentOffset:U}},reset:B}}}),xy=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:s,rects:i,initialPlacement:a,platform:u,elements:c}=t,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:h=!0,...y}=xt(e,t);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const w=Ct(o),b=Lt(a),S=Ct(a)===a,E=await(u.isRTL==null?void 0:u.isRTL(c.floating)),x=m||(S||!h?[zr(a)]:hy(a)),P=v!=="none";!m&&P&&x.push(...vy(a,h,v,E));const F=[a,...x],O=await Rn(t,y),I=[];let D=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&I.push(O[w]),p){const R=gy(o,i,E);I.push(O[R[0]],O[R[1]])}if(D=[...D,{placement:o,overflows:I}],!I.every(R=>R<=0)){var q,k;const R=(((q=s.flip)==null?void 0:q.index)||0)+1,J=F[R];if(J)return{data:{index:R,overflows:D},reset:{placement:J}};let B=(k=D.filter(U=>U.overflows[0]<=0).sort((U,K)=>U.overflows[1]-K.overflows[1])[0])==null?void 0:k.placement;if(!B)switch(g){case"bestFit":{var z;const U=(z=D.filter(K=>{if(P){const Y=Lt(K.placement);return Y===b||Y==="y"}return!0}).map(K=>[K.placement,K.overflows.filter(Y=>Y>0).reduce((Y,le)=>Y+le,0)]).sort((K,Y)=>K[1]-Y[1])[0])==null?void 0:z[0];U&&(B=U);break}case"initialPlacement":B=a;break}if(o!==B)return{reset:{placement:B}}}return{}}}};function su(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function iu(e){return dy.some(t=>e[t]>=0)}const Cy=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=xt(e,t);switch(r){case"referenceHidden":{const s=await Rn(t,{...o,elementContext:"reference"}),i=su(s,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:iu(i)}}}case"escaped":{const s=await Rn(t,{...o,altBoundary:!0}),i=su(s,n.floating);return{data:{escapedOffsets:i,escaped:iu(i)}}}default:return{}}}}};async function Sy(e,t){const{placement:n,platform:r,elements:o}=e,s=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ct(n),a=fn(n),u=Lt(n)==="y",c=["left","top"].includes(i)?-1:1,f=s&&u?-1:1,p=xt(t,e);let{mainAxis:m,crossAxis:g,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),u?{x:g*f,y:m*c}:{x:m*c,y:g*f}}const Ey=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:s,placement:i,middlewareData:a}=t,u=await Sy(t,e);return i===((n=a.offset)==null?void 0:n.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:o+u.x,y:s+u.y,data:{...u,placement:i}}}}},Ny=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:s=!0,crossAxis:i=!1,limiter:a={fn:y=>{let{x:w,y:b}=y;return{x:w,y:b}}},...u}=xt(e,t),c={x:n,y:r},f=await Rn(t,u),p=Lt(Ct(o)),m=Hs(p);let g=c[m],v=c[p];if(s){const y=m==="y"?"top":"left",w=m==="y"?"bottom":"right",b=g+f[y],S=g-f[w];g=zs(b,g,S)}if(i){const y=p==="y"?"top":"left",w=p==="y"?"bottom":"right",b=v+f[y],S=v-f[w];v=zs(b,v,S)}const h=a.fn({...t,[m]:g,[p]:v});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[m]:s,[p]:i}}}}}},Ty=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:s,middlewareData:i}=t,{offset:a=0,mainAxis:u=!0,crossAxis:c=!0}=xt(e,t),f={x:n,y:r},p=Lt(o),m=Hs(p);let g=f[m],v=f[p];const h=xt(a,t),y=typeof h=="number"?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(u){const S=m==="y"?"height":"width",E=s.reference[m]-s.floating[S]+y.mainAxis,x=s.reference[m]+s.reference[S]-y.mainAxis;g<E?g=E:g>x&&(g=x)}if(c){var w,b;const S=m==="y"?"width":"height",E=["top","left"].includes(Ct(o)),x=s.reference[p]-s.floating[S]+(E&&((w=i.offset)==null?void 0:w[p])||0)+(E?0:y.crossAxis),P=s.reference[p]+s.reference[S]+(E?0:((b=i.offset)==null?void 0:b[p])||0)-(E?y.crossAxis:0);v<x?v=x:v>P&&(v=P)}return{[m]:g,[p]:v}}}},Py=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:s,platform:i,elements:a}=t,{apply:u=()=>{},...c}=xt(e,t),f=await Rn(t,c),p=Ct(o),m=fn(o),g=Lt(o)==="y",{width:v,height:h}=s.floating;let y,w;p==="top"||p==="bottom"?(y=p,w=m===(await(i.isRTL==null?void 0:i.isRTL(a.floating))?"start":"end")?"left":"right"):(w=p,y=m==="end"?"top":"bottom");const b=h-f.top-f.bottom,S=v-f.left-f.right,E=$t(h-f[y],b),x=$t(v-f[w],S),P=!t.middlewareData.shift;let F=E,O=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(O=S),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(F=b),P&&!m){const D=Ve(f.left,0),q=Ve(f.right,0),k=Ve(f.top,0),z=Ve(f.bottom,0);g?O=v-2*(D!==0||q!==0?D+q:Ve(f.left,f.right)):F=h-2*(k!==0||z!==0?k+z:Ve(f.top,f.bottom))}await u({...t,availableWidth:O,availableHeight:F});const I=await i.getDimensions(a.floating);return v!==I.width||h!==I.height?{reset:{rects:!0}}:{}}}};function Ur(){return typeof window<"u"}function pn(e){return au(e)?(e.nodeName||"").toLowerCase():"#document"}function Be(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function at(e){var t;return(t=(au(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function au(e){return Ur()?e instanceof Node||e instanceof Be(e).Node:!1}function Ze(e){return Ur()?e instanceof Element||e instanceof Be(e).Element:!1}function lt(e){return Ur()?e instanceof HTMLElement||e instanceof Be(e).HTMLElement:!1}function lu(e){return!Ur()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof Be(e).ShadowRoot}function Vn(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Qe(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function Ay(e){return["table","td","th"].includes(pn(e))}function jr(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Gs(e){const t=qs(),n=Ze(e)?Qe(e):e;return n.transform!=="none"||n.perspective!=="none"||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function _y(e){let t=Rt(e);for(;lt(t)&&!gn(t);){if(Gs(t))return t;if(jr(t))return null;t=Rt(t)}return null}function qs(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function gn(e){return["html","body","#document"].includes(pn(e))}function Qe(e){return Be(e).getComputedStyle(e)}function Wr(e){return Ze(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Rt(e){if(pn(e)==="html")return e;const t=e.assignedSlot||e.parentNode||lu(e)&&e.host||at(e);return lu(t)?t.host:t}function cu(e){const t=Rt(e);return gn(t)?e.ownerDocument?e.ownerDocument.body:e.body:lt(t)&&Vn(t)?t:cu(t)}function Bn(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=cu(e),s=o===((r=e.ownerDocument)==null?void 0:r.body),i=Be(o);if(s){const a=Ks(i);return t.concat(i,i.visualViewport||[],Vn(o)?o:[],a&&n?Bn(a):[])}return t.concat(o,Bn(o,[],n))}function Ks(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function uu(e){const t=Qe(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=lt(e),s=o?e.offsetWidth:n,i=o?e.offsetHeight:r,a=Vr(n)!==s||Vr(r)!==i;return a&&(n=s,r=i),{width:n,height:r,$:a}}function Xs(e){return Ze(e)?e:e.contextElement}function hn(e){const t=Xs(e);if(!lt(t))return it(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:s}=uu(t);let i=(s?Vr(n.width):n.width)/r,a=(s?Vr(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!a||!Number.isFinite(a))&&(a=1),{x:i,y:a}}const Fy=it(0);function du(e){const t=Be(e);return!qs()||!t.visualViewport?Fy:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Oy(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==Be(e)?!1:t}function Gt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),s=Xs(e);let i=it(1);t&&(r?Ze(r)&&(i=hn(r)):i=hn(e));const a=Oy(s,n,r)?du(s):it(0);let u=(o.left+a.x)/i.x,c=(o.top+a.y)/i.y,f=o.width/i.x,p=o.height/i.y;if(s){const m=Be(s),g=r&&Ze(r)?Be(r):r;let v=m,h=Ks(v);for(;h&&r&&g!==v;){const y=hn(h),w=h.getBoundingClientRect(),b=Qe(h),S=w.left+(h.clientLeft+parseFloat(b.paddingLeft))*y.x,E=w.top+(h.clientTop+parseFloat(b.paddingTop))*y.y;u*=y.x,c*=y.y,f*=y.x,p*=y.y,u+=S,c+=E,v=Be(h),h=Ks(v)}}return Hr({width:f,height:p,x:u,y:c})}function Js(e,t){const n=Wr(e).scrollLeft;return t?t.left+n:Gt(at(e)).left+n}function fu(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:Js(e,r)),s=r.top+t.scrollTop;return{x:o,y:s}}function Dy(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const s=o==="fixed",i=at(r),a=t?jr(t.floating):!1;if(r===i||a&&s)return n;let u={scrollLeft:0,scrollTop:0},c=it(1);const f=it(0),p=lt(r);if((p||!p&&!s)&&((pn(r)!=="body"||Vn(i))&&(u=Wr(r)),lt(r))){const g=Gt(r);c=hn(r),f.x=g.x+r.clientLeft,f.y=g.y+r.clientTop}const m=i&&!p&&!s?fu(i,u,!0):it(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-u.scrollLeft*c.x+f.x+m.x,y:n.y*c.y-u.scrollTop*c.y+f.y+m.y}}function My(e){return Array.from(e.getClientRects())}function Iy(e){const t=at(e),n=Wr(e),r=e.ownerDocument.body,o=Ve(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),s=Ve(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Js(e);const a=-n.scrollTop;return Qe(r).direction==="rtl"&&(i+=Ve(t.clientWidth,r.clientWidth)-o),{width:o,height:s,x:i,y:a}}function ky(e,t){const n=Be(e),r=at(e),o=n.visualViewport;let s=r.clientWidth,i=r.clientHeight,a=0,u=0;if(o){s=o.width,i=o.height;const c=qs();(!c||c&&t==="fixed")&&(a=o.offsetLeft,u=o.offsetTop)}return{width:s,height:i,x:a,y:u}}function $y(e,t){const n=Gt(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,s=lt(e)?hn(e):it(1),i=e.clientWidth*s.x,a=e.clientHeight*s.y,u=o*s.x,c=r*s.y;return{width:i,height:a,x:u,y:c}}function pu(e,t,n){let r;if(t==="viewport")r=ky(e,n);else if(t==="document")r=Iy(at(e));else if(Ze(t))r=$y(t,n);else{const o=du(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return Hr(r)}function gu(e,t){const n=Rt(e);return n===t||!Ze(n)||gn(n)?!1:Qe(n).position==="fixed"||gu(n,t)}function Ly(e,t){const n=t.get(e);if(n)return n;let r=Bn(e,[],!1).filter(a=>Ze(a)&&pn(a)!=="body"),o=null;const s=Qe(e).position==="fixed";let i=s?Rt(e):e;for(;Ze(i)&&!gn(i);){const a=Qe(i),u=Gs(i);!u&&a.position==="fixed"&&(o=null),(s?!u&&!o:!u&&a.position==="static"&&!!o&&["absolute","fixed"].includes(o.position)||Vn(i)&&!u&&gu(e,i))?r=r.filter(f=>f!==i):o=a,i=Rt(i)}return t.set(e,r),r}function Ry(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const i=[...n==="clippingAncestors"?jr(t)?[]:Ly(t,this._c):[].concat(n),r],a=i[0],u=i.reduce((c,f)=>{const p=pu(t,f,o);return c.top=Ve(p.top,c.top),c.right=$t(p.right,c.right),c.bottom=$t(p.bottom,c.bottom),c.left=Ve(p.left,c.left),c},pu(t,a,o));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function Vy(e){const{width:t,height:n}=uu(e);return{width:t,height:n}}function By(e,t,n){const r=lt(t),o=at(t),s=n==="fixed",i=Gt(e,!0,s,t);let a={scrollLeft:0,scrollTop:0};const u=it(0);if(r||!r&&!s)if((pn(t)!=="body"||Vn(o))&&(a=Wr(t)),r){const m=Gt(t,!0,s,t);u.x=m.x+t.clientLeft,u.y=m.y+t.clientTop}else o&&(u.x=Js(o));const c=o&&!r&&!s?fu(o,a):it(0),f=i.left+a.scrollLeft-u.x-c.x,p=i.top+a.scrollTop-u.y-c.y;return{x:f,y:p,width:i.width,height:i.height}}function Ys(e){return Qe(e).position==="static"}function hu(e,t){if(!lt(e)||Qe(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return at(e)===n&&(n=n.ownerDocument.body),n}function mu(e,t){const n=Be(e);if(jr(e))return n;if(!lt(e)){let o=Rt(e);for(;o&&!gn(o);){if(Ze(o)&&!Ys(o))return o;o=Rt(o)}return n}let r=hu(e,t);for(;r&&Ay(r)&&Ys(r);)r=hu(r,t);return r&&gn(r)&&Ys(r)&&!Gs(r)?n:r||_y(e)||n}const zy=async function(e){const t=this.getOffsetParent||mu,n=this.getDimensions,r=await n(e.floating);return{reference:By(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Hy(e){return Qe(e).direction==="rtl"}const Uy={convertOffsetParentRelativeRectToViewportRelativeRect:Dy,getDocumentElement:at,getClippingRect:Ry,getOffsetParent:mu,getElementRects:zy,getClientRects:My,getDimensions:Vy,getScale:hn,isElement:Ze,isRTL:Hy};function jy(e,t){let n=null,r;const o=at(e);function s(){var a;clearTimeout(r),(a=n)==null||a.disconnect(),n=null}function i(a,u){a===void 0&&(a=!1),u===void 0&&(u=1),s();const{left:c,top:f,width:p,height:m}=e.getBoundingClientRect();if(a||t(),!p||!m)return;const g=Br(f),v=Br(o.clientWidth-(c+p)),h=Br(o.clientHeight-(f+m)),y=Br(c),b={rootMargin:-g+"px "+-v+"px "+-h+"px "+-y+"px",threshold:Ve(0,$t(1,u))||1};let S=!0;function E(x){const P=x[0].intersectionRatio;if(P!==u){if(!S)return i();P?i(!1,P):r=setTimeout(()=>{i(!1,1e-7)},1e3)}S=!1}try{n=new IntersectionObserver(E,{...b,root:o.ownerDocument})}catch{n=new IntersectionObserver(E,b)}n.observe(e)}return i(!0),s}function Wy(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:s=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,c=Xs(e),f=o||s?[...c?Bn(c):[],...Bn(t)]:[];f.forEach(w=>{o&&w.addEventListener("scroll",n,{passive:!0}),s&&w.addEventListener("resize",n)});const p=c&&a?jy(c,n):null;let m=-1,g=null;i&&(g=new ResizeObserver(w=>{let[b]=w;b&&b.target===c&&g&&(g.unobserve(t),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var S;(S=g)==null||S.observe(t)})),n()}),c&&!u&&g.observe(c),g.observe(t));let v,h=u?Gt(e):null;u&&y();function y(){const w=Gt(e);h&&(w.x!==h.x||w.y!==h.y||w.width!==h.width||w.height!==h.height)&&n(),h=w,v=requestAnimationFrame(y)}return n(),()=>{var w;f.forEach(b=>{o&&b.removeEventListener("scroll",n),s&&b.removeEventListener("resize",n)}),p==null||p(),(w=g)==null||w.disconnect(),g=null,u&&cancelAnimationFrame(v)}}const Gy=Ey,qy=Ny,Ky=xy,Xy=Py,Jy=Cy,vu=by,Yy=Ty,Zy=(e,t,n)=>{const r=new Map,o={platform:Uy,...n},s={...o.platform,_c:r};return wy(e,t,{...o,platform:s})};var Gr=typeof document<"u"?A.useLayoutEffect:A.useEffect;function qr(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!qr(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const s=o[r];if(!(s==="_owner"&&e.$$typeof)&&!qr(e[s],t[s]))return!1}return!0}return e!==e&&t!==t}function yu(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function wu(e,t){const n=yu(e);return Math.round(t*n)/n}function Zs(e){const t=d.useRef(e);return Gr(()=>{t.current=e}),t}function Qy(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:s,floating:i}={},transform:a=!0,whileElementsMounted:u,open:c}=e,[f,p]=d.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[m,g]=d.useState(r);qr(m,r)||g(r);const[v,h]=d.useState(null),[y,w]=d.useState(null),b=d.useCallback(K=>{K!==P.current&&(P.current=K,h(K))},[]),S=d.useCallback(K=>{K!==F.current&&(F.current=K,w(K))},[]),E=s||v,x=i||y,P=d.useRef(null),F=d.useRef(null),O=d.useRef(f),I=u!=null,D=Zs(u),q=Zs(o),k=Zs(c),z=d.useCallback(()=>{if(!P.current||!F.current)return;const K={placement:t,strategy:n,middleware:m};q.current&&(K.platform=q.current),Zy(P.current,F.current,K).then(Y=>{const le={...Y,isPositioned:k.current!==!1};R.current&&!qr(O.current,le)&&(O.current=le,Yn.flushSync(()=>{p(le)}))})},[m,t,n,q,k]);Gr(()=>{c===!1&&O.current.isPositioned&&(O.current.isPositioned=!1,p(K=>({...K,isPositioned:!1})))},[c]);const R=d.useRef(!1);Gr(()=>(R.current=!0,()=>{R.current=!1}),[]),Gr(()=>{if(E&&(P.current=E),x&&(F.current=x),E&&x){if(D.current)return D.current(E,x,z);z()}},[E,x,z,D,I]);const J=d.useMemo(()=>({reference:P,floating:F,setReference:b,setFloating:S}),[b,S]),B=d.useMemo(()=>({reference:E,floating:x}),[E,x]),U=d.useMemo(()=>{const K={position:n,left:0,top:0};if(!B.floating)return K;const Y=wu(B.floating,f.x),le=wu(B.floating,f.y);return a?{...K,transform:"translate("+Y+"px, "+le+"px)",...yu(B.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:Y,top:le}},[n,a,B.floating,f.x,f.y]);return d.useMemo(()=>({...f,update:z,refs:J,elements:B,floatingStyles:U}),[f,z,J,B,U])}const ew=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?vu({element:r.current,padding:o}).fn(n):{}:r?vu({element:r,padding:o}).fn(n):{}}}},tw=(e,t)=>({...Gy(e),options:[e,t]}),nw=(e,t)=>({...qy(e),options:[e,t]}),rw=(e,t)=>({...Yy(e),options:[e,t]}),ow=(e,t)=>({...Ky(e),options:[e,t]}),sw=(e,t)=>({...Xy(e),options:[e,t]}),iw=(e,t)=>({...Jy(e),options:[e,t]}),aw=(e,t)=>({...ew(e),options:[e,t]});var lw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],cw=lw.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Qt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),uw="Arrow",bu=d.forwardRef((e,t)=>{const{children:n,width:r=10,height:o=5,...s}=e;return l.jsx(cw.svg,{...s,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:l.jsx("polygon",{points:"0,0 30,0 15,10"})})});bu.displayName=uw;var dw=bu;function xu(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function fw(...e){return t=>{let n=!1;const r=e.map(o=>{const s=xu(o,t);return!n&&typeof s=="function"&&(n=!0),s});if(n)return()=>{for(let o=0;o<r.length;o++){const s=r[o];typeof s=="function"?s():xu(e[o],null)}}}}function Cu(...e){return d.useCallback(fw(...e),e)}var pw=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","span","svg","ul"],Su=pw.reduce((e,t)=>{const n=d.forwardRef((r,o)=>{const{asChild:s,...i}=r,a=s?Qt:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),l.jsx(a,{...i,ref:o})});return n.displayName=`Primitive.${t}`,{...e,[t]:n}},{}),Qs="Popper",[Eu,Nu]=Ot(Qs),[gw,Tu]=Eu(Qs),Pu=e=>{const{__scopePopper:t,children:n}=e,[r,o]=d.useState(null);return l.jsx(gw,{scope:t,anchor:r,onAnchorChange:o,children:n})};Pu.displayName=Qs;var Au="PopperAnchor",_u=d.forwardRef((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,s=Tu(Au,n),i=d.useRef(null),a=Cu(t,i);return d.useEffect(()=>{s.onAnchorChange((r==null?void 0:r.current)||i.current)}),r?null:l.jsx(Su.div,{...o,ref:a})});_u.displayName=Au;var ei="PopperContent",[hw,mw]=Eu(ei),Fu=d.forwardRef((e,t)=>{var Ce,tt,je,nt,ft,Xt;const{__scopePopper:n,side:r="bottom",sideOffset:o=0,align:s="center",alignOffset:i=0,arrowPadding:a=0,avoidCollisions:u=!0,collisionBoundary:c=[],collisionPadding:f=0,sticky:p="partial",hideWhenDetached:m=!1,updatePositionStrategy:g="optimized",onPlaced:v,...h}=e,y=Tu(ei,n),[w,b]=d.useState(null),S=Cu(t,Pe=>b(Pe)),[E,x]=d.useState(null),P=Ua(E),F=(P==null?void 0:P.width)??0,O=(P==null?void 0:P.height)??0,I=r+(s!=="center"?"-"+s:""),D=typeof f=="number"?f:{top:0,right:0,bottom:0,left:0,...f},q=Array.isArray(c)?c:[c],k=q.length>0,z={padding:D,boundary:q.filter(yw),altBoundary:k},{refs:R,floatingStyles:J,placement:B,isPositioned:U,middlewareData:K}=Qy({strategy:"fixed",placement:I,whileElementsMounted:(...Pe)=>Wy(...Pe,{animationFrame:g==="always"}),elements:{reference:y.anchor},middleware:[tw({mainAxis:o+O,alignmentAxis:i}),u&&nw({mainAxis:!0,crossAxis:!1,limiter:p==="partial"?rw():void 0,...z}),u&&ow({...z}),sw({...z,apply:({elements:Pe,rects:pt,availableWidth:Cn,availableHeight:Bt})=>{const{width:io,height:C}=pt.reference,N=Pe.floating.style;N.setProperty("--radix-popper-available-width",`${Cn}px`),N.setProperty("--radix-popper-available-height",`${Bt}px`),N.setProperty("--radix-popper-anchor-width",`${io}px`),N.setProperty("--radix-popper-anchor-height",`${C}px`)}}),E&&aw({element:E,padding:a}),ww({arrowWidth:F,arrowHeight:O}),m&&iw({strategy:"referenceHidden",...z})]}),[Y,le]=Mu(B),ue=Ae(v);Re(()=>{U&&(ue==null||ue())},[U,ue]);const Ee=(Ce=K.arrow)==null?void 0:Ce.x,Ie=(tt=K.arrow)==null?void 0:tt.y,Ue=((je=K.arrow)==null?void 0:je.centerOffset)!==0,[Nt,Se]=d.useState();return Re(()=>{w&&Se(window.getComputedStyle(w).zIndex)},[w]),l.jsx("div",{ref:R.setFloating,"data-radix-popper-content-wrapper":"",style:{...J,transform:U?J.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:Nt,"--radix-popper-transform-origin":[(nt=K.transformOrigin)==null?void 0:nt.x,(ft=K.transformOrigin)==null?void 0:ft.y].join(" "),...((Xt=K.hide)==null?void 0:Xt.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:l.jsx(hw,{scope:n,placedSide:Y,onArrowChange:x,arrowX:Ee,arrowY:Ie,shouldHideArrow:Ue,children:l.jsx(Su.div,{"data-side":Y,"data-align":le,...h,ref:S,style:{...h.style,animation:U?void 0:"none"}})})})});Fu.displayName=ei;var Ou="PopperArrow",vw={top:"bottom",right:"left",bottom:"top",left:"right"},Du=d.forwardRef(function(t,n){const{__scopePopper:r,...o}=t,s=mw(Ou,r),i=vw[s.placedSide];return l.jsx("span",{ref:s.onArrowChange,style:{position:"absolute",left:s.arrowX,top:s.arrowY,[i]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[s.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[s.placedSide],visibility:s.shouldHideArrow?"hidden":void 0},children:l.jsx(dw,{...o,ref:n,style:{...o.style,display:"block"}})})});Du.displayName=Ou;function yw(e){return e!==null}var ww=e=>({name:"transformOrigin",options:e,fn(t){var y,w,b;const{placement:n,rects:r,middlewareData:o}=t,i=((y=o.arrow)==null?void 0:y.centerOffset)!==0,a=i?0:e.arrowWidth,u=i?0:e.arrowHeight,[c,f]=Mu(n),p={start:"0%",center:"50%",end:"100%"}[f],m=(((w=o.arrow)==null?void 0:w.x)??0)+a/2,g=(((b=o.arrow)==null?void 0:b.y)??0)+u/2;let v="",h="";return c==="bottom"?(v=i?p:`${m}px`,h=`${-u}px`):c==="top"?(v=i?p:`${m}px`,h=`${r.floating.height+u}px`):c==="right"?(v=`${-u}px`,h=i?p:`${g}px`):c==="left"&&(v=`${r.floating.width+u}px`,h=i?p:`${g}px`),{data:{x:v,y:h}}}});function Mu(e){const[t,n="center"]=e.split("-");return[t,n]}var bw=Pu,xw=_u,Cw=Fu,Sw=Du,Ew="Portal",Iu=d.forwardRef((e,t)=>{var a;const{container:n,...r}=e,[o,s]=d.useState(!1);Re(()=>s(!0),[]);const i=n||o&&((a=globalThis==null?void 0:globalThis.document)==null?void 0:a.body);return i?uo.createPortal(l.jsx(Ln.div,{...r,ref:t}),i):null});Iu.displayName=Ew;function Nw(e,t){return d.useReducer((n,r)=>t[n][r]??n,e)}var ti=e=>{const{present:t,children:n}=e,r=Tw(t),o=typeof n=="function"?n({present:r.isPresent}):d.Children.only(n),s=$n(r.ref,Pw(o));return typeof n=="function"||r.isPresent?d.cloneElement(o,{ref:s}):null};ti.displayName="Presence";function Tw(e){const[t,n]=d.useState(),r=d.useRef({}),o=d.useRef(e),s=d.useRef("none"),i=e?"mounted":"unmounted",[a,u]=Nw(i,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return d.useEffect(()=>{const c=Kr(r.current);s.current=a==="mounted"?c:"none"},[a]),Re(()=>{const c=r.current,f=o.current;if(f!==e){const m=s.current,g=Kr(c);e?u("MOUNT"):g==="none"||(c==null?void 0:c.display)==="none"?u("UNMOUNT"):u(f&&m!==g?"ANIMATION_OUT":"UNMOUNT"),o.current=e}},[e,u]),Re(()=>{if(t){let c;const f=t.ownerDocument.defaultView??window,p=g=>{const h=Kr(r.current).includes(g.animationName);if(g.target===t&&h&&(u("ANIMATION_END"),!o.current)){const y=t.style.animationFillMode;t.style.animationFillMode="forwards",c=f.setTimeout(()=>{t.style.animationFillMode==="forwards"&&(t.style.animationFillMode=y)})}},m=g=>{g.target===t&&(s.current=Kr(r.current))};return t.addEventListener("animationstart",m),t.addEventListener("animationcancel",p),t.addEventListener("animationend",p),()=>{f.clearTimeout(c),t.removeEventListener("animationstart",m),t.removeEventListener("animationcancel",p),t.removeEventListener("animationend",p)}}else u("ANIMATION_END")},[t,u]),{isPresent:["mounted","unmountSuspended"].includes(a),ref:d.useCallback(c=>{c&&(r.current=getComputedStyle(c)),n(c)},[])}}function Kr(e){return(e==null?void 0:e.animationName)||"none"}function Pw(e){var r,o;let t=(r=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:r.get,n=t&&"isReactWarning"in t&&t.isReactWarning;return n?e.ref:(t=(o=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:o.get,n=t&&"isReactWarning"in t&&t.isReactWarning,n?e.props.ref:e.props.ref||e.ref)}var Aw="VisuallyHidden",ku=d.forwardRef((e,t)=>l.jsx(Ln.span,{...e,ref:t,style:{position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal",...e.style}}));ku.displayName=Aw;var _w=ku,[Xr,hC]=Ot("Tooltip",[Nu]),Jr=Nu(),$u="TooltipProvider",Fw=700,ni="tooltip.open",[Ow,ri]=Xr($u),Lu=e=>{const{__scopeTooltip:t,delayDuration:n=Fw,skipDelayDuration:r=300,disableHoverableContent:o=!1,children:s}=e,[i,a]=d.useState(!0),u=d.useRef(!1),c=d.useRef(0);return d.useEffect(()=>{const f=c.current;return()=>window.clearTimeout(f)},[]),l.jsx(Ow,{scope:t,isOpenDelayed:i,delayDuration:n,onOpen:d.useCallback(()=>{window.clearTimeout(c.current),a(!1)},[]),onClose:d.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>a(!0),r)},[r]),isPointerInTransitRef:u,onPointerInTransitChange:d.useCallback(f=>{u.current=f},[]),disableHoverableContent:o,children:s})};Lu.displayName=$u;var Yr="Tooltip",[Dw,zn]=Xr(Yr),Ru=e=>{const{__scopeTooltip:t,children:n,open:r,defaultOpen:o=!1,onOpenChange:s,disableHoverableContent:i,delayDuration:a}=e,u=ri(Yr,e.__scopeTooltip),c=Jr(t),[f,p]=d.useState(null),m=on(),g=d.useRef(0),v=i??u.disableHoverableContent,h=a??u.delayDuration,y=d.useRef(!1),[w=!1,b]=nn({prop:r,defaultProp:o,onChange:F=>{F?(u.onOpen(),document.dispatchEvent(new CustomEvent(ni))):u.onClose(),s==null||s(F)}}),S=d.useMemo(()=>w?y.current?"delayed-open":"instant-open":"closed",[w]),E=d.useCallback(()=>{window.clearTimeout(g.current),g.current=0,y.current=!1,b(!0)},[b]),x=d.useCallback(()=>{window.clearTimeout(g.current),g.current=0,b(!1)},[b]),P=d.useCallback(()=>{window.clearTimeout(g.current),g.current=window.setTimeout(()=>{y.current=!0,b(!0),g.current=0},h)},[h,b]);return d.useEffect(()=>()=>{g.current&&(window.clearTimeout(g.current),g.current=0)},[]),l.jsx(bw,{...c,children:l.jsx(Dw,{scope:t,contentId:m,open:w,stateAttribute:S,trigger:f,onTriggerChange:p,onTriggerEnter:d.useCallback(()=>{u.isOpenDelayed?P():E()},[u.isOpenDelayed,P,E]),onTriggerLeave:d.useCallback(()=>{v?x():(window.clearTimeout(g.current),g.current=0)},[x,v]),onOpen:E,onClose:x,disableHoverableContent:v,children:n})})};Ru.displayName=Yr;var oi="TooltipTrigger",Vu=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=zn(oi,n),s=ri(oi,n),i=Jr(n),a=d.useRef(null),u=$n(t,a,o.onTriggerChange),c=d.useRef(!1),f=d.useRef(!1),p=d.useCallback(()=>c.current=!1,[]);return d.useEffect(()=>()=>document.removeEventListener("pointerup",p),[p]),l.jsx(xw,{asChild:!0,...i,children:l.jsx(Ln.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...r,ref:u,onPointerMove:bt(e.onPointerMove,m=>{m.pointerType!=="touch"&&!f.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),f.current=!0)}),onPointerLeave:bt(e.onPointerLeave,()=>{o.onTriggerLeave(),f.current=!1}),onPointerDown:bt(e.onPointerDown,()=>{c.current=!0,document.addEventListener("pointerup",p,{once:!0})}),onFocus:bt(e.onFocus,()=>{c.current||o.onOpen()}),onBlur:bt(e.onBlur,o.onClose),onClick:bt(e.onClick,o.onClose)})})});Vu.displayName=oi;var si="TooltipPortal",[Mw,Iw]=Xr(si,{forceMount:void 0}),Bu=e=>{const{__scopeTooltip:t,forceMount:n,children:r,container:o}=e,s=zn(si,t);return l.jsx(Mw,{scope:t,forceMount:n,children:l.jsx(ti,{present:n||s.open,children:l.jsx(Iu,{asChild:!0,container:o,children:r})})})};Bu.displayName=si;var mn="TooltipContent",zu=d.forwardRef((e,t)=>{const n=Iw(mn,e.__scopeTooltip),{forceMount:r=n.forceMount,side:o="top",...s}=e,i=zn(mn,e.__scopeTooltip);return l.jsx(ti,{present:r||i.open,children:i.disableHoverableContent?l.jsx(Hu,{side:o,...s,ref:t}):l.jsx(kw,{side:o,...s,ref:t})})}),kw=d.forwardRef((e,t)=>{const n=zn(mn,e.__scopeTooltip),r=ri(mn,e.__scopeTooltip),o=d.useRef(null),s=$n(t,o),[i,a]=d.useState(null),{trigger:u,onClose:c}=n,f=o.current,{onPointerInTransitChange:p}=r,m=d.useCallback(()=>{a(null),p(!1)},[p]),g=d.useCallback((v,h)=>{const y=v.currentTarget,w={x:v.clientX,y:v.clientY},b=Vw(w,y.getBoundingClientRect()),S=Bw(w,b),E=zw(h.getBoundingClientRect()),x=Uw([...S,...E]);a(x),p(!0)},[p]);return d.useEffect(()=>()=>m(),[m]),d.useEffect(()=>{if(u&&f){const v=y=>g(y,f),h=y=>g(y,u);return u.addEventListener("pointerleave",v),f.addEventListener("pointerleave",h),()=>{u.removeEventListener("pointerleave",v),f.removeEventListener("pointerleave",h)}}},[u,f,g,m]),d.useEffect(()=>{if(i){const v=h=>{const y=h.target,w={x:h.clientX,y:h.clientY},b=(u==null?void 0:u.contains(y))||(f==null?void 0:f.contains(y)),S=!Hw(w,i);b?m():S&&(m(),c())};return document.addEventListener("pointermove",v),()=>document.removeEventListener("pointermove",v)}},[u,f,i,c,m]),l.jsx(Hu,{...e,ref:s})}),[$w,Lw]=Xr(Yr,{isInside:!1}),Hu=d.forwardRef((e,t)=>{const{__scopeTooltip:n,children:r,"aria-label":o,onEscapeKeyDown:s,onPointerDownOutside:i,...a}=e,u=zn(mn,n),c=Jr(n),{onClose:f}=u;return d.useEffect(()=>(document.addEventListener(ni,f),()=>document.removeEventListener(ni,f)),[f]),d.useEffect(()=>{if(u.trigger){const p=m=>{const g=m.target;g!=null&&g.contains(u.trigger)&&f()};return window.addEventListener("scroll",p,{capture:!0}),()=>window.removeEventListener("scroll",p,{capture:!0})}},[u.trigger,f]),l.jsx(eu,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:s,onPointerDownOutside:i,onFocusOutside:p=>p.preventDefault(),onDismiss:f,children:l.jsxs(Cw,{"data-state":u.stateAttribute,...c,...a,ref:t,style:{...a.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:[l.jsx(Pa,{children:r}),l.jsx($w,{scope:n,isInside:!0,children:l.jsx(_w,{id:u.contentId,role:"tooltip",children:o||r})})]})})});zu.displayName=mn;var Uu="TooltipArrow",Rw=d.forwardRef((e,t)=>{const{__scopeTooltip:n,...r}=e,o=Jr(n);return Lw(Uu,n).isInside?null:l.jsx(Sw,{...o,...r,ref:t})});Rw.displayName=Uu;function Vw(e,t){const n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),o=Math.abs(t.right-e.x),s=Math.abs(t.left-e.x);switch(Math.min(n,r,o,s)){case s:return"left";case o:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function Bw(e,t,n=5){const r=[];switch(t){case"top":r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case"bottom":r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case"left":r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case"right":r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function zw(e){const{top:t,right:n,bottom:r,left:o}=e;return[{x:o,y:t},{x:n,y:t},{x:n,y:r},{x:o,y:r}]}function Hw(e,t){const{x:n,y:r}=e;let o=!1;for(let s=0,i=t.length-1;s<t.length;i=s++){const a=t[s].x,u=t[s].y,c=t[i].x,f=t[i].y;u>r!=f>r&&n<(c-a)*(r-u)/(f-u)+a&&(o=!o)}return o}function Uw(e){const t=e.slice();return t.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),jw(t)}function jw(e){if(e.length<=1)return e.slice();const t=[];for(let r=0;r<e.length;r++){const o=e[r];for(;t.length>=2;){const s=t[t.length-1],i=t[t.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))t.pop();else break}t.push(o)}t.pop();const n=[];for(let r=e.length-1;r>=0;r--){const o=e[r];for(;n.length>=2;){const s=n[n.length-1],i=n[n.length-2];if((s.x-i.x)*(o.y-i.y)>=(s.y-i.y)*(o.x-i.x))n.pop();else break}n.push(o)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Ww=Lu,Gw=Ru,qw=Vu,Kw=Bu,ju=zu;const vn=Ww,yn=Gw,wn=qw,qt=d.forwardRef(({className:e,sideOffset:t=4,...n},r)=>l.jsx(Kw,{children:l.jsx(ju,{ref:r,sideOffset:t,className:te("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",e),...n})}));qt.displayName=ju.displayName;function Xw({title:e,titleId:t,...n},r){return d.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":t},n),e?d.createElement("title",{id:t},e):null,d.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 Jw=d.forwardRef(Xw);var Yw=function(e){return function(t,n){var r=A.useRef(!1);e(function(){return function(){r.current=!1}},[]),e(function(){if(!r.current)r.current=!0;else return t()},n)}},Wu=function(e){return typeof e=="function"},Gu=process.env.NODE_ENV==="development"||process.env.NODE_ENV==="test";const Zw=Yw(A.useEffect);function qu(e){var t=A.useRef(e);return t.current=e,t}var Qw=function(e){Gu&&(Wu(e)||console.error("useUnmount expected parameter is a function, got ".concat(typeof e)));var t=qu(e);A.useEffect(function(){return function(){t.current()}},[])},Zr=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function eb(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function tb(e){var t=typeof e;return e!=null&&(t=="object"||t=="function")}var Ku=tb,nb=typeof Zr=="object"&&Zr&&Zr.Object===Object&&Zr,rb=nb,ob=rb,sb=typeof self=="object"&&self&&self.Object===Object&&self,ib=ob||sb||Function("return this")(),Xu=ib,ab=Xu,lb=function(){return ab.Date.now()},cb=lb,ub=/\s/;function db(e){for(var t=e.length;t--&&ub.test(e.charAt(t)););return t}var fb=db,pb=fb,gb=/^\s+/;function hb(e){return e&&e.slice(0,pb(e)+1).replace(gb,"")}var mb=hb,vb=Xu,yb=vb.Symbol,Ju=yb,Yu=Ju,Zu=Object.prototype,wb=Zu.hasOwnProperty,bb=Zu.toString,Hn=Yu?Yu.toStringTag:void 0;function xb(e){var t=wb.call(e,Hn),n=e[Hn];try{e[Hn]=void 0;var r=!0}catch{}var o=bb.call(e);return r&&(t?e[Hn]=n:delete e[Hn]),o}var Cb=xb,Sb=Object.prototype,Eb=Sb.toString;function Nb(e){return Eb.call(e)}var Tb=Nb,Qu=Ju,Pb=Cb,Ab=Tb,_b="[object Null]",Fb="[object Undefined]",ed=Qu?Qu.toStringTag:void 0;function Ob(e){return e==null?e===void 0?Fb:_b:ed&&ed in Object(e)?Pb(e):Ab(e)}var Db=Ob;function Mb(e){return e!=null&&typeof e=="object"}var Ib=Mb,kb=Db,$b=Ib,Lb="[object Symbol]";function Rb(e){return typeof e=="symbol"||$b(e)&&kb(e)==Lb}var Vb=Rb,Bb=mb,td=Ku,zb=Vb,nd=NaN,Hb=/^[-+]0x[0-9a-f]+$/i,Ub=/^0b[01]+$/i,jb=/^0o[0-7]+$/i,Wb=parseInt;function Gb(e){if(typeof e=="number")return e;if(zb(e))return nd;if(td(e)){var t=typeof e.valueOf=="function"?e.valueOf():e;e=td(t)?t+"":t}if(typeof e!="string")return e===0?e:+e;e=Bb(e);var n=Ub.test(e);return n||jb.test(e)?Wb(e.slice(2),n?2:8):Hb.test(e)?nd:+e}var qb=Gb,Kb=Ku,ii=cb,rd=qb,Xb="Expected a function",Jb=Math.max,Yb=Math.min;function Zb(e,t,n){var r,o,s,i,a,u,c=0,f=!1,p=!1,m=!0;if(typeof e!="function")throw new TypeError(Xb);t=rd(t)||0,Kb(n)&&(f=!!n.leading,p="maxWait"in n,s=p?Jb(rd(n.maxWait)||0,t):s,m="trailing"in n?!!n.trailing:m);function g(P){var F=r,O=o;return r=o=void 0,c=P,i=e.apply(O,F),i}function v(P){return c=P,a=setTimeout(w,t),f?g(P):i}function h(P){var F=P-u,O=P-c,I=t-F;return p?Yb(I,s-O):I}function y(P){var F=P-u,O=P-c;return u===void 0||F>=t||F<0||p&&O>=s}function w(){var P=ii();if(y(P))return b(P);a=setTimeout(w,h(P))}function b(P){return a=void 0,m&&r?g(P):(r=o=void 0,i)}function S(){a!==void 0&&clearTimeout(a),c=0,r=u=o=a=void 0}function E(){return a===void 0?i:b(ii())}function x(){var P=ii(),F=y(P);if(r=arguments,o=this,u=P,F){if(a===void 0)return v(u);if(p)return clearTimeout(a),a=setTimeout(w,t),g(u)}return a===void 0&&(a=setTimeout(w,t)),i}return x.cancel=S,x.flush=E,x}var Qb=Zb;const ex=eb(Qb);function tx(){var e=(typeof global>"u"?"undefined":typeof global)=="object"&&global&&global.Object===Object&&global,t=typeof self=="object"&&self&&self.Object===Object&&self;return e||t}tx()||(global.Date=Date);function nx(e,t){var n;Gu&&(Wu(e)||console.error("useDebounceFn expected parameter is a function, got ".concat(typeof e)));var r=qu(e),o=(n=t==null?void 0:t.wait)!==null&&n!==void 0?n:1e3,s=A.useMemo(function(){return ex(function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];return r.current.apply(r,fl([],dl(i),!1))},o,t)},[]);return Qw(function(){s.cancel()}),{run:s,cancel:s.cancel,flush:s.flush}}function rx(e,t,n){var r=dl(A.useState({}),2),o=r[0],s=r[1],i=nx(function(){s({})},n).run;A.useEffect(function(){return i()},t),Zw(e,[o])}const ox=A.forwardRef(({onChange:e},t)=>{const n=A.useRef(null),[r,o]=A.useState("");return A.useImperativeHandle(t,()=>({setValue:s=>{var i;o(s),(i=n.current)==null||i.focus()}})),rx(()=>{e==null||e(r)},[r],{wait:300}),l.jsxs(l.Fragment,{children:[l.jsx(kt,{ref:n,type:"text",placeholder:"Search files...",value:r,onChange:s=>o(s.target.value),className:"pr-8"}),r&&l.jsx("button",{onClick:()=>{var s;o(""),(s=n.current)==null||s.focus()},className:"absolute right-2 top-1/2 -translate-y-1/2 text-gray-500 hover:text-gray-700",children:l.jsx(Jw,{className:"h-5 w-5"})})]})}),sx=({openDialogRename:e,setOpenDialogRename:t,apiBaseUrl:n,setFileToMove:r,fileToMove:o,refreshFiles:s,ignoreCache:i})=>{var b;const[a,u]=A.useState({}),[c,f]=A.useState(!1),[p,m]=A.useState(!1),[g,v]=A.useState(""),{toast:h}=Rr();A.useEffect(()=>{e&&y(g)},[g,e]);const y=async S=>{try{m(!0);const E=await oe.get(`${n}/api/list-s3-folders?prefix=${S}`);u(E==null?void 0:E.data)}catch{h({title:"Error",description:"Unable to load S3 folder list",variant:"destructive"})}finally{m(!1)}},w=async()=>{f(!0);try{const S=o.key;await oe.post(`${n}/api/move`,{oldPath:S,newPath:g}),i.current=!0,await s(),h({title:"Đã đổi tên",description:`Đã đổi tên thành công "${o.name}" thành "${g}"`}),t(!1),r(null),v("")}catch(S){console.error("Error renaming item:",S),h({title:"Lỗi",description:"Không thể đổi tên",variant:"destructive"})}finally{f(!1)}};return l.jsx(It,{open:e,onOpenChange:S=>{S||(t(!1),r(null),v(""))},children:l.jsxs(vt,{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:[l.jsxs(yt,{className:"mb-4 w-full h-full",children:[l.jsx("nav",{className:"mb-4",children:l.jsxs("ul",{className:"flex items-center space-x-2 text-sm text-gray-600",children:[l.jsx("li",{className:"cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>v(""),children:"Root"}),g.split("/").map((S,E,x)=>l.jsx("li",{className:"cursor-pointer hover:text-blue-600 transition-colors",onClick:()=>v(S==="Root"?"":x.slice(0,E+1).join("/")+"/"),children:S},E))]})}),l.jsxs(wt,{className:"text-xl font-semibold text-gray-800",children:["Di chuyển"," ",l.jsxs("span",{className:"text-sm text-gray-500",children:["( file Hoặc folder sẽ được di chuyển đến thư mục"," ",g===""?"Root":g," )"]})]}),l.jsx(Mn,{className:"text-gray-600 w-full h-[50dvh] max-h-[500px] overflow-hidden overflow-y-auto",children:p?l.jsx("div",{className:"flex justify-center items-center py-4",children:l.jsx("div",{className:"loader ease-linear rounded-full border-4 border-t-4 border-gray-200 h-12 w-12"})}):l.jsx("ul",{className:"space-y-2",children:(b=Object.keys(a))==null?void 0:b.map(S=>l.jsx("li",{className:"cursor-pointer hover:bg-gray-100 p-2 rounded transition-colors",onClick:()=>v(S),children:S},S))})})]}),l.jsxs(un,{className:"flex justify-end space-x-2",children:[l.jsx(ie,{variant:"outline",onClick:()=>t(!1),className:"px-4 py-2 rounded border border-gray-300 text-gray-700 hover:bg-gray-100 transition-colors",children:"Cancel"}),l.jsx(ie,{onClick:w,disabled:c,className:"s3-explr-crawl-btn",children:"Move"})]})]})})},_e={current:!1},od="crawl:jobs",bn="crawl:current_job",ix=e=>{const[t,n]=A.useState(null),[r,o]=A.useState(0);return A.useEffect(()=>{const s=localStorage.getItem(bn);if(s){const i=JSON.parse(s);n(i),i!=null&&i.startTime&&o(Math.floor((Date.now()-i.startTime)/1e3))}},[]),A.useEffect(()=>{if(!(t!=null&&t.startTime))return;const s=setInterval(()=>{o(Math.floor((Date.now()-t.startTime)/1e3))},1e3);return()=>clearInterval(s)},[t==null?void 0:t.startTime]),A.useEffect(()=>{if(!(t!=null&&t.id))return;const s=async()=>{try{const u=(await oe.get(`${e}/api/crawl/${t.id}?taskId=${t.taskId}`)).data;n(c=>{if(!c)return null;const f={...c,status:u};return localStorage.setItem(bn,JSON.stringify(f)),(u.status==="completed"||u.status==="failed")&&setTimeout(()=>{n(null),localStorage.removeItem(bn)},100),f})}catch(a){console.error("Error polling job status:",a)}},i=setInterval(s,3e3);return s(),()=>clearInterval(i)},[t==null?void 0:t.id,e]),{currentJob:t,elapsedTime:r,setCurrentJob:s=>{s&&!s.startTime&&(s.startTime=Date.now()),n(s),s?localStorage.setItem(bn,JSON.stringify(s)):localStorage.removeItem(bn)}}},ax=(e,t,n)=>{const r=[],o=s=>{(e[s]||[]).forEach(a=>{a.name.toLowerCase().includes(t.toLowerCase())&&r.push(a),a.isFolder&&a.key.startsWith(n)&&o(a.key)})};return o(n),r},Qr=(e,t)=>{const n=[],r=o=>{(e[o]||[]).forEach(i=>{n.push(i.key),i.isFolder&&r(i.key)})};return r(t),n},lx=(e,t)=>{const n=[];return(e[t]||[]).forEach(o=>{n.push(o.key),o.isFolder&&n.push(...Qr(e,o.key))}),n},cx=(e,t,n=[])=>{const[r,o]=A.useState({}),[s,i]=A.useState(!1),[a,u]=A.useState(null),c=A.useRef(t);A.useEffect(()=>{c.current=t},[t]);const f=async()=>{i(!0);try{const p=!_e.current;_e.current&&(_e.current=!1);const m=await oe.get(`${e}/api/files`,{params:{cache:p,displayPrefixes:JSON.stringify(n),prefix:c.current},timeout:3e5});o(m.data),u(null)}catch(p){u(p instanceof Error?p:new Error("Failed to fetch files"))}finally{i(!1)}};return A.useEffect(()=>{f()},[]),{data:r,isLoading:s,error:a,refetch:f}},Un=e=>{var r,o,s;const t=((s=(o=(r=e==null?void 0:e.name)==null?void 0:r.split("."))==null?void 0:o.pop())==null?void 0:s.toLowerCase())??"";return["txt","md","json","js","ts","jsx","tsx","css","html","xml","yaml","yml"].includes(t||"")},ux=A.memo(({homeLabel:e="Kho tài liệu",apiBaseUrl:t="https://s3-explorer.cmcts1.studio.ai.vn",rootPrefix:n="",asSelector:r=!1,onSelected:o=a=>console.log("Đã chọn:",a),displayPrefixes:s,preSelectedFiles:i})=>{var Fd;const[a,u]=A.useState(""),[c,f]=A.useState(new Set),[p,m]=A.useState(n),[g,v]=A.useState(null),[h,y]=A.useState(!1),[w,b]=A.useState(""),[S,E]=A.useState(!1),[x,P]=A.useState(null),[F,O]=A.useState(null),[I,D]=A.useState(!1),[q,k]=A.useState(!1),[z,R]=A.useState(null),J=A.useRef(null),{toast:B}=Rr(),[U,K]=A.useState(null),[Y,le]=A.useState(null),[ue,Ee]=A.useState(""),[Ie,Ue]=A.useState(!1),[Nt,Se]=A.useState(!1),[Ce,tt]=A.useState(new Set),[je,nt]=A.useState(""),[ft,Xt]=A.useState(!1),[Pe,pt]=A.useState(!1),[Cn,Bt]=A.useState("rename"),[io,C]=A.useState(!1),[N,_]=A.useState(""),[H,V]=A.useState("1"),[L,X]=A.useState(!1),[se,me]=A.useState(!1),[ve,gt]=A.useState(!1),[ao,Sn]=A.useState(!1),{currentJob:ce,elapsedTime:En,setCurrentJob:Xn}=ix(t),bi=g||n,{data:ke,isLoading:xi,error:kx,refetch:We}=cx(t,bi,s);A.useEffect(()=>{const M=new Set(i);f(M)},[]),A.useEffect(()=>{ce!=null&&ce.status&&(ce.status.status==="completed"?(B({title:"Thu thập website hoàn tất",description:`Đã thu thập thành công ${ce.url} với ${ce.status.completed} trang`}),_e.current=!0,We()):ce.status.status==="failed"&&B({title:"Thu thập website thất bại",description:`Không thể thu thập ${ce.url}. Vui lòng thử lại.`,variant:"destructive"}))},[(Fd=ce==null?void 0:ce.status)==null?void 0:Fd.status]);const Nd=A.useMemo(()=>ke[p]||[],[ke,p]),Jt=A.useMemo(()=>a?ax(ke,a,p):Nd,[Nd,a,p,ke]),Jn=A.useMemo(()=>{const M={};return Jt.forEach(($,j)=>{c.has($.key)&&(M[j]=!0)}),M},[c,Jt]),$x=M=>{const $=Qr(ke,M);if($.length===0)return c.has(M)?"all":"none";const j=$.filter(G=>c.has(G)).length;return j===0?"none":j===$.length?"all":"partial"},lo=M=>{Sn(!0),v(M),m(M)};A.useEffect(()=>{ao&&(_e.current=!0,We().finally(()=>Sn(!1)))},[ao]);const Lx=async(M,$)=>{E(!0);try{const j=`${$}${M}/`;if((await oe.post(`${t}/api/create-folder`,{prefix:j})).status!==200){B({title:"Lỗi",description:"Không thể tạo thư mục",variant:"destructive"});return}_e.current=!0,await We(),B({title:"Đã tạo thư mục",description:`Đã tạo thành công thư mục "${M}"`}),b(""),y(!1)}catch(j){console.error("Error creating folder:",j),B({title:"Lỗi",description:"Không thể tạo thư mục",variant:"destructive"})}finally{E(!1)}},Td=async(M,$,j)=>{R(j),me(!0);try{let G=localStorage.getItem("dataLogin"),ee;try{G&&(G=JSON.parse(G),ee=G.user)}catch{G=null}if(ee&&(ee==null?void 0:ee.role)!=="MASTER_ADMIN"&&ug(M,B))return;const ae=new FormData;ae.append("prefix",$),Array.from(M).forEach(ge=>ae.append("files",ge)),ee!=null&&ee.id&&(console.log("🚀 ~ uploadFiles ~ user:",ee),ae.append("metadata",JSON.stringify({creator:ee.username,creatorId:ee.id,DataSource:"Tệp tải lên"}))),await oe.post(`${t}/api/upload`,ae,{headers:{"Content-Type":"multipart/form-data"}}),v($),_e.current=!0,await We()}catch(G){console.error("Lỗi tải lên:",G)}finally{R(null),me(!1)}},Rx=async M=>{var $;gt(!0);try{await oe.delete(`${t}/api/files`,{data:{paths:[M.key]}});const j=(($=M.key)==null?void 0:$.replace(/^(.*?)(\/.*)?$/,(G,ee,ae)=>!ae||ae==="/"?"":ee+"/"))||"";v(j),_e.current=!0,B({title:"Đã xóa tập tin",description:`Đã xóa thành công "${M.name}"`}),P(null)}catch(j){console.error("Error deleting file:",j),B({title:"Lỗi",description:"Không thể xóa tập tin",variant:"destructive"})}finally{gt(!1),await We()}},co=M=>{const $=new Set(c),j=typeof M=="function"?M(Jn):M;new Set(Object.keys(Jn).map(Number)).forEach(ee=>{const ae=Jt[ee];ae&&(j[ee]||($.delete(ae.key),ae.isFolder&&Qr(ke,ae.key).forEach(ge=>$.delete(ge))))}),Object.entries(j).forEach(([ee,ae])=>{const ge=parseInt(ee),Tt=Jt[ge];Tt&&ae&&($.add(Tt.key),Tt.isFolder&&Qr(ke,Tt.key).forEach(Si=>$.add(Si)))}),f($)},Vx=async()=>{var M;D(!0);try{const $=Array.from(c),j=$.map(ee=>Object.values(ke).flat().find(ae=>ae.key===ee)).filter(ee=>ee!==void 0);if(j.length===0){B({title:"Lỗi",description:"Không có tập tin nào được chọn để xóa",variant:"destructive"});return}await oe.delete(`${t}/api/files`,{data:{paths:$}});const G=((M=j[0])==null?void 0:M.key.replace(/^(.*?)(\/.*)?$/,(ee,ae,ge)=>!ge||ge==="/"?"":ae+"/"))||"";v(G),_e.current=!0,We(),B({title:"Đã xóa tập tin",description:`Đã xóa thành công ${j.length} mục`}),k(!1),f(new Set)}catch($){console.error("Error deleting files:",$),B({title:"Lỗi",description:"Không thể xóa các tập tin đã chọn",variant:"destructive"})}finally{D(!1)}},Bx=async(M,$)=>{Se(!0);try{const j=M.key;let G;M.isFolder?G=j.split("/").slice(0,-2).join("/")+"/":G=j.substring(0,j.lastIndexOf("/")+1);const ee=G+$+(M.isFolder?"/":"");await oe.post(`${t}/api/rename`,{oldPath:j,newPath:ee}),_e.current=!0,await We(),B({title:"Đã đổi tên",description:`Đã đổi tên thành công "${M.name}" thành "${$}"`}),K(null),Ee(""),le(null)}catch(j){console.error("Error renaming item:",j),B({title:"Lỗi",description:"Không thể đổi tên",variant:"destructive"})}finally{Se(!1)}},Pd=async M=>{tt($=>new Set([...$,...M]));try{const $=await oe.post(`${t}/api/download`,{paths:M},{responseType:"blob"}),j=window.URL.createObjectURL($.data),G=document.createElement("a");G.href=j;const ee=$.headers["Content-Disposition"]||$.headers["content-disposition"],ae=ee==null?void 0:ee.match(/filename="(.+)"/),ge=ae?decodeURIComponent(ae[1]):"download.zip";G.setAttribute("download",ge),document.body.appendChild(G),G.click(),document.body.removeChild(G),window.URL.revokeObjectURL(j),B({title:"Bắt đầu tải xuống",description:`Đã bắt đầu tải xuống ${M.length} mục${M.length>1,""}`})}catch($){console.error("Error downloading files:",$),B({title:"Lỗi",description:"Không thể tải xuống tập tin",variant:"destructive"})}finally{tt($=>{const j=new Set($);return M.forEach(G=>j.delete(G)),j})}},Ad=p?p.replace(n,"").split("/").filter(Boolean):[],zx=()=>Array.from(c).map(M=>{var $;for(const j in ke){const G=($=ke[j])==null?void 0:$.find(ee=>ee.key===M);if(G)return G}return null}).filter(M=>M!==null),_d=A.useMemo(()=>{const M=[{id:"select",header:()=>{const $=lx(ke,p),j=$.length>0&&$.every(ee=>c.has(ee)),G=$.some(ee=>c.has(ee));return l.jsx(es,{checked:j?!0:G?"indeterminate":!1,onCheckedChange:ee=>{if(ee){const ae=Jt.reduce((ge,Tt,Si)=>(ge[Si]=!0,ge),{});co(ae)}else co({})},"aria-label":"Chọn tất cả"})},cell:({row:$})=>{const j=$.original,ee=j.isFolder?$x(j.key):c.has(j.key)?"all":"none";return l.jsx("div",{className:"flex items-center",children:l.jsx(es,{checked:ee==="partial"?"indeterminate":ee==="all",onCheckedChange:ae=>{const ge={...Jn};ae?ge[$.index]=!0:delete ge[$.index],co(ge)},"aria-label":"Chọn dòng"})})},enableSorting:!1},{id:"fileName",header:"Tên tập tin",accessorKey:"name",cell:({row:$})=>{const j=$.original,G=j.key.substring(0,j.key.lastIndexOf("/"))||"/",ee=a.trim()!==""&&G!==p,ae=G.split("/").filter(Boolean);return l.jsxs("div",{className:"flex flex-col",children:[l.jsxs("div",{className:`flex items-center gap-2 ${j.isFolder?"cursor-pointer hover:text-blue-600":""}`,onClick:()=>{j.isFolder&&lo(j.key)},children:[j.isFolder?l.jsx(fo,{className:"h-5 w-5 text-blue-500"}):null,j.name]}),ee&&l.jsxs("div",{className:"text-sm text-gray-500 flex items-center",children:[l.jsx(fo,{className:"h-4 w-4 text-gray-500 my-auto"}),l.jsxs("span",{className:"flex items-center ml-1",children:[l.jsx("span",{className:"cursor-pointer hover:text-blue-600",onClick:()=>{lo("")},children:"/"}),ae.map((ge,Tt)=>l.jsxs("span",{className:"flex items-center",children:[l.jsx("span",{className:"cursor-pointer hover:text-blue-600",onClick:()=>{lo(ae.slice(0,Tt+1).join("/")+"/")},children:ge}),Tt<ae.length-1&&l.jsx("span",{children:"/"})]},Tt))]})]})]})}}];return r||M.push({id:"size",header:"Kích thước",accessorKey:"size",cell:({getValue:$,row:j})=>{const G=$();return l.jsx("span",{children:j.original.isFolder?"-":Gg(G)})}},{id:"lastModified",header:"Sửa đổi lần cuối",accessorKey:"lastModified",cell:({row:$})=>{const j=$.original.lastModified;return l.jsx("span",{children:j.toLocaleString()})}},{id:"actions",header:"Hành động",accessorKey:"key",cell:({row:$})=>l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsx(vn,{children:l.jsxs(yn,{children:[l.jsx(wn,{asChild:!0,children:l.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>Pd([$.original.key]),className:"h-8 w-8 p-0",disabled:Ce.has($.original.key),children:Ce.has($.original.key)?l.jsx(ye,{className:"h-4 w-4 animate-spin"}):l.jsx(Ni,{className:"h-4 w-4"})})}),l.jsx(qt,{children:"Tải xuống"})]})}),l.jsx(vn,{children:l.jsxs(yn,{children:[l.jsx(wn,{asChild:!0,children:l.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>{K($.original),Ee($.original.name)},className:"h-8 w-8 p-0",children:l.jsx(Hd,{className:"h-4 w-4"})})}),l.jsx(qt,{children:"Đổi tên"})]})}),l.jsx(vn,{children:l.jsxs(yn,{children:[l.jsx(wn,{asChild:!0,children:l.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>{Ue(!0),O($.original)},className:"h-8 w-8 p-0",children:l.jsx(sg,{className:"h-4 w-4"})})}),l.jsx(qt,{children:"Di chuyển"})]})}),l.jsx(vn,{children:l.jsxs(yn,{children:[l.jsx(wn,{asChild:!0,children:l.jsx(ie,{variant:"ghost",size:"icon",onClick:()=>P($.original),className:"h-8 w-8 p-0",children:l.jsx(Ti,{className:"h-4 w-4"})})}),l.jsx(qt,{children:"Xóa"})]})})]})}),M},[c,Jt,Jn,Ce,r]),Ci=Vi({data:Jt,columns:_d,state:{rowSelection:Jn},enableRowSelection:!0,onRowSelectionChange:co,getCoreRowModel:Ri()}),Hx=async M=>{var $,j;Xt(!0);try{if(Un(M)){const G=await oe.get(`${t}/api/read-text`,{params:{path:M.key}});nt(G.data.content)}try{const G=await oe.get(`${t}/api/read-json`,{params:{path:M.key+".metadata.json"}}),ee=((j=($=G==null?void 0:G.data)==null?void 0:$.content)==null?void 0:j.metadataAttributes)||null;return le({fullPath:U==null?void 0:U.key,...ee})}catch{return le("Lỗi phân tích siêu dữ liệu")}}catch(G){console.error("Error loading file content:",G),B({title:"Lỗi",description:"Không thể tải nội dung tập tin",variant:"destructive"})}finally{Xt(!1)}},Ux=async(M,$)=>{pt(!0);try{await oe.post(`${t}/api/modify-text`,{path:M.key,content:$}),B({title:"Đã lưu tập tin",description:"Nội dung tập tin đã được cập nhật thành công"}),_e.current=!0,await We(),K(null),nt(""),Bt("rename")}catch(j){console.error("Error saving file content:",j),B({title:"Lỗi",description:"Không thể lưu nội dung tập tin",variant:"destructive"})}finally{pt(!1)}},jx=async M=>{pt(!0);try{console.log("🚀 ~ saveJsonFile ~ metadataForEdit:",Y),await oe.post(`${t}/api/modify-json`,{path:M.key+".metadata.json",content:{metadataAttributes:Y}}),B({title:"Đã lưu tập tin",description:"Nội dung tập tin đã được cập nhật thành công"}),_e.current=!0,await We(),K(null),nt(""),Bt("rename")}catch($){console.error("Error saving file content:",$),B({title:"Lỗi",description:"Không thể lưu nội dung tập tin",variant:"destructive"})}finally{pt(!1)}};A.useEffect(()=>{U&&(U.isFolder||Hx(U),Bt("rename"))},[U]);const Wx=async(M,$)=>{var j;if(ce){B({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}X(!0);try{const{data:G}=await oe.post(`${t}/api/crawl`,{url:M,limit:$,prefix:p});if(G.id){Xn({id:G.id,url:M,limit:$,prefix:p,taskId:((j=G.task)==null?void 0:j.id)||""});const ee=localStorage.getItem(od),ae=ee?JSON.parse(ee):[];ae.some(ge=>ge.id===G.id)||(ae.unshift({url:M,id:G.id,limit:$,prefix:p,timestamp:Date.now()}),ae.length>20&&(ae.length=20),localStorage.setItem(od,JSON.stringify(ae))),B({title:"Bắt đầu thu thập website",description:`Đã thêm nhiệm vụ thu thập ${M} với giới hạn ${$}. Dữ liệu sẽ có sẵn sau khi thu thập hoàn tất.`}),C(!1),_(""),V("1")}}catch(G){console.error("Error crawling website:",G),B({title:"Lỗi",description:"Không thể bắt đầu thu thập website",variant:"destructive"})}finally{X(!1)}},Gx=async()=>{try{if(!(ce!=null&&ce.id))return;Xn(null),localStorage.removeItem(bn),B({title:"Đã dừng thu thập",description:`Đã dừng thu thập website ${ce.url}`})}catch(M){console.error("Error stopping job:",M),B({title:"Lỗi",description:"Không thể dừng thu thập website",variant:"destructive"})}};return l.jsxs("div",{className:"space-y-4 s3-explr-container",children:[l.jsx(La,{className:"s3-explr-breadcrumb",children:l.jsxs(Ra,{className:"s3-explr-breadcrumb-list",children:[l.jsx(Xo,{className:"s3-explr-breadcrumb-item",children:l.jsx(Jo,{onClick:()=>{v(""),m(""),_e.current=!0,setTimeout(()=>{We()},0)},className:"flex items-center gap-1 cursor-pointer s3-explr-breadcrumb-home",children:e})}),Ad.map((M,$)=>l.jsxs(l.Fragment,{children:[l.jsx(Va,{className:"s3-explr-breadcrumb-separator"},`sep-${$}`),l.jsx(Xo,{className:"s3-explr-breadcrumb-item",children:l.jsx(Jo,{onClick:()=>lo(n+Ad.slice(0,$+1).join("/")+"/"),className:"cursor-pointer s3-explr-breadcrumb-link",children:M})},`item-${M}`)]}))]})}),l.jsxs("div",{className:"flex items-center space-x-4 s3-explr-toolbar",children:[l.jsx("div",{className:"relative max-w-sm w-full s3-explr-search-container",children:l.jsx(ox,{ref:J,onChange:M=>u(M)})}),l.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>{v(p),_e.current=!0,We()},disabled:xi,className:"flex items-center gap-2 s3-explr-refresh-btn",children:[l.jsx(Md,{className:`h-4 w-4 s3-explr-refresh-icon ${xi?"animate-spin":""}`}),"Làm mới"]}),!r&&l.jsxs(l.Fragment,{children:[c.size>0&&l.jsxs(l.Fragment,{children:[l.jsxs(ie,{variant:"outline",size:"sm",onClick:()=>Pd(Array.from(c)),disabled:Array.from(c).some(M=>Ce.has(M)),className:"flex items-center gap-2 s3-explr-download-selected-btn",children:[Array.from(c).some(M=>Ce.has(M))?l.jsx(ye,{className:"h-4 w-4 animate-spin mr-2 s3-explr-loader"}):l.jsx(Ni,{className:"h-4 w-4 s3-explr-download-icon"}),"Tải xuống đã chọn (",c.size,")"]}),l.jsxs(It,{open:q,onOpenChange:k,children:[l.jsx(Er,{asChild:!0,children:l.jsxs(ie,{variant:"destructive",size:"sm",className:"flex items-center gap-2 s3-explr-bulk-delete-btn",children:[l.jsx(Ti,{className:"h-4 w-4 s3-explr-trash-icon"}),"Xóa đã chọn (",c.size,")"]})}),l.jsxs(vt,{className:"s3-explr-dialog-content",children:[l.jsxs(yt,{className:"s3-explr-dialog-header",children:[l.jsx(wt,{className:"s3-explr-dialog-title",children:"Xác nhận xóa hàng loạt"}),l.jsxs(Mn,{className:"s3-explr-dialog-description",children:["Bạn có chắc chắn muốn xóa ",c.size," mục đã chọn? Hành động này không thể hoàn tác."]})]}),l.jsxs(un,{className:"s3-explr-dialog-footer",children:[l.jsx(ie,{variant:"outline",onClick:()=>k(!1),className:"s3-explr-cancel-btn",children:"Hủy"}),l.jsx(ie,{variant:"destructive",onClick:Vx,disabled:I,className:"s3-explr-confirm-delete-btn",children:I?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang xóa..."]}):"Xóa đã chọn"})]})]})]})]}),l.jsxs(It,{open:h,onOpenChange:y,children:[l.jsx(Er,{asChild:!0,children:l.jsxs(ie,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-new-folder-btn",disabled:!!s&&!p,children:[l.jsx(Ld,{className:"h-4 w-4 s3-explr-folder-plus-icon"}),"Thư mục mới"]})}),l.jsxs(vt,{className:"s3-explr-dialog-content",children:[l.jsx(yt,{className:"s3-explr-dialog-header",children:l.jsx(wt,{className:"s3-explr-dialog-title",children:"Tạo thư mục mới"})}),l.jsxs("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:[l.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[l.jsx(Wt,{htmlFor:"name",className:"s3-explr-label",children:"Tên thư mục"}),l.jsx(kt,{disabled:S,id:"name",value:w,onChange:M=>b(M.target.value),placeholder:"Nhập tên thư mục",className:"s3-explr-input"})]}),l.jsxs(ie,{onClick:()=>{w.trim()&&Lx(w,p)},disabled:S,className:"s3-explr-create-btn",children:[S&&l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),S?"Đang tạo...":"Tạo"]})]})]})]}),l.jsxs("div",{className:"flex items-center gap-2 s3-explr-upload-group",children:[l.jsx(ie,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-upload-files-btn",onClick:()=>{const M=document.createElement("input");M.type="file",M.multiple=!0,M.onchange=$=>{const j=$.target.files;j&&Td(j,p,"files")},M.click()},disabled:z!==null||!!s&&!p,children:z==="files"?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"h-4 w-4 animate-spin mr-2 s3-explr-loader"}),"Đang tải lên..."]}):l.jsxs(l.Fragment,{children:[l.jsx(kd,{className:"h-4 w-4 s3-explr-upload-icon"}),"Tải lên tập tin"]})}),l.jsx(ie,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-upload-folder-btn",onClick:()=>{const M=document.createElement("input");M.type="file",M.multiple=!0,M.webkitdirectory=!0,M.onchange=$=>{const j=$.target.files;j&&Td(j,p,"folder")},M.click()},disabled:z!==null||!!s&&!p,children:z==="folder"?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"h-4 w-4 animate-spin mr-2 s3-explr-loader"}),"Đang tải lên..."]}):l.jsxs(l.Fragment,{children:[l.jsx(fo,{className:"h-4 w-4 s3-explr-folder-icon"}),"Tải lên thư mục"]})}),ce?l.jsx(vn,{delayDuration:0,children:l.jsxs(yn,{children:[l.jsx(wn,{asChild:!0,children:l.jsxs("div",{className:"flex items-center gap-2",children:[l.jsxs(ie,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-website-btn",disabled:!0,children:[l.jsx(ye,{className:"h-4 w-4 animate-spin s3-explr-loader"}),ce.status?l.jsxs(l.Fragment,{children:["Đang thu thập (",ce.status.completed,"/",ce.status.total,") - ",Math.floor(En/60),":",String(En%60).padStart(2,"0")]}):"Đang thu thập..."]}),l.jsxs(ie,{variant:"destructive",size:"sm",onClick:()=>void Gx(),className:"flex items-center gap-2",children:[l.jsx("span",{className:"sr-only",children:"Dừng thu thập"}),l.jsx(jd,{className:"h-4 w-4"})]})]})}),ce.status&&l.jsx(qt,{side:"right",sideOffset:5,children:l.jsxs("div",{className:"space-y-1 p-2",children:[l.jsxs("p",{className:"font-semibold",children:["Đang thu thập ",ce.url]}),l.jsxs("p",{children:["Tiến độ: ",ce.status.completed,"/",ce.status.total," trang"]}),l.jsxs("p",{children:["Thời gian: ",Math.floor(En/60),":",String(En%60).padStart(2,"0")]}),l.jsxs("p",{children:["Trạng thái:"," ",ce.status.status==="scraping"?"Đang thu thập":ce.status.status==="completed"?"Hoàn thành":"Thất bại"]})]})})]})}):l.jsxs(It,{open:io,onOpenChange:C,children:[l.jsx(Er,{asChild:!0,children:l.jsxs(ie,{variant:"outline",size:"sm",className:"flex items-center gap-2 s3-explr-add-website-btn",disabled:!!s&&!p,children:[l.jsx(Bd,{className:"h-4 w-4 s3-explr-globe-icon"}),"Thêm website"]})}),l.jsxs(vt,{className:"s3-explr-dialog-content",children:[l.jsxs(yt,{className:"s3-explr-dialog-header",children:[l.jsx(wt,{className:"s3-explr-dialog-title",children:"Thêm website"}),l.jsx(Mn,{className:"s3-explr-dialog-description",children:"Nhập URL website để thu thập và thêm vào S3."})]}),l.jsxs("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:[l.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[l.jsx(Wt,{htmlFor:"websiteUrl",className:"s3-explr-label",children:"URL Website"}),l.jsx(kt,{id:"websiteUrl",value:N,onChange:M=>_(M.target.value),placeholder:"https://example.com",type:"url",disabled:L,className:"s3-explr-input"})]}),l.jsxs("div",{className:"space-y-2 s3-explr-input-group",children:[l.jsx(Wt,{htmlFor:"crawlLimit",className:"s3-explr-label",children:"Giới hạn thu thập"}),l.jsx(kt,{id:"crawlLimit",value:H,onChange:M=>{const $=M.target.value;/^\d*$/.test($)&&V($)},placeholder:"1",type:"text",disabled:L,className:"s3-explr-input"}),l.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)"})]})]}),l.jsxs(un,{className:"s3-explr-dialog-footer",children:[l.jsx(ie,{variant:"outline",onClick:()=>{C(!1),_(""),V("1")},disabled:L,className:"s3-explr-cancel-btn",children:"Hủy"}),l.jsx(ie,{onClick:()=>{N.trim()&&Wx(N.trim(),parseInt(H)||1)},disabled:L||!N.trim(),className:"s3-explr-crawl-btn",children:L?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang thu thập..."]}):"Bắt đầu thu thập"})]})]})]})]}),l.jsx(It,{open:!!x,onOpenChange:M=>!M&&P(null),children:l.jsxs(vt,{className:"s3-explr-dialog-content",children:[l.jsxs(yt,{className:"s3-explr-dialog-header",children:[l.jsx(wt,{className:"s3-explr-dialog-title",children:"Xác nhận xóa"}),l.jsxs(Mn,{className:"s3-explr-dialog-description",children:["Bạn có chắc chắn muốn xóa ",x==null?void 0:x.name,"? Hành động này không thể hoàn tác."]})]}),l.jsxs(un,{className:"s3-explr-dialog-footer",children:[l.jsx(ie,{variant:"outline",onClick:()=>P(null),className:"s3-explr-cancel-btn",children:"Hủy"}),l.jsx(ie,{variant:"destructive",onClick:()=>Rx(x),disabled:ve,className:"s3-explr-confirm-delete-btn",children:ve?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang xóa..."]}):"Xóa"})]})]})}),l.jsx(It,{open:!!U,onOpenChange:M=>{M||(K(null),le(null),Ee(""),nt(""),Bt("rename"))},children:l.jsxs(vt,{className:"s3-explr-dialog-content max-w-5xl w-[90%]",children:[l.jsx(yt,{className:"s3-explr-dialog-header",children:l.jsx(wt,{className:"s3-explr-dialog-title",children:U!=null&&U.isFolder?"Đổi tên thư mục":Un(U)?"Quản lý tập tin":"Đổi tên tập tin"})}),U&&l.jsxs(bv,{value:Cn,onValueChange:M=>Bt(M),children:[l.jsxs(Sc,{"aria-checked":!Un(U),"aria-disabled":U.isFolder,className:"grid w-full grid-cols-3 aria-checked:grid-cols-2 aria-disabled:grid-cols-1",children:[l.jsx(Or,{value:"rename",children:"Đổi tên"}),!U.isFolder&&l.jsxs(l.Fragment,{children:[Un(U)&&l.jsx(Or,{value:"edit",children:"Sửa nội dung"}),l.jsx(Or,{value:"edit-metadata",children:"Sửa metadata file"})]})]}),l.jsx(Dr,{value:"rename",children:l.jsx("div",{className:"space-y-4 py-4 s3-explr-dialog-body",children:l.jsxs("div",{className:"h-[70dvh] min-h-[500px] overflow-hidden overflow-y-auto pb-3 px-1 s3-explr-input-group",children:[l.jsx(Wt,{htmlFor:"newName",className:"s3-explr-label",children:"Tên mới"}),l.jsx(kt,{id:"newName",value:ue,onChange:M=>Ee(M.target.value),placeholder:"Nhập tên mới",disabled:Nt,className:"s3-explr-input"})]})})}),!U.isFolder&&l.jsxs(l.Fragment,{children:[Un(U)&&l.jsx(Dr,{value:"edit",children:l.jsx("div",{className:"space-y-4 py-4",children:ft?l.jsx("div",{className:"flex items-center justify-center py-4",children:l.jsx(ye,{className:"h-6 w-6 animate-spin"})}):l.jsxs("div",{className:"h-[70dvh] min-h-[500px] overflow-hidden overflow-y-auto pb-3 px-1",children:[l.jsx(Wt,{htmlFor:"content",className:"s3-explr-label",children:"Nội dung tập tin"}),l.jsx(In,{id:"content",value:je,onChange:M=>nt(M.target.value),placeholder:"Nhập nội dung tập tin",className:"min-h-[200px] font-mono",disabled:Pe})]})})}),l.jsx(Dr,{value:"edit-metadata",children:l.jsx("div",{className:"space-y-4 py-4",children:ft?l.jsx("div",{className:"flex items-center justify-center py-4",children:l.jsx(ye,{className:"h-6 w-6 animate-spin"})}):l.jsx("div",{className:"h-[70dvh] min-h-[500px] overflow-hidden overflow-y-auto pb-3 px-1",children:Y&&typeof Y=="object"&&Object.entries(Y).map(([M,$])=>l.jsxs("div",{className:"pb-3 flex flex-col gap-2",children:[l.jsxs(Wt,{htmlFor:M,className:"s3-explr-label flex items-center gap-1",children:[lg[M]||M,jo(M)&&l.jsx(ig,{className:"h-[12px] w-[12px] text-red-500"})]}),cg(M)?l.jsx(In,{id:M,value:typeof $=="string"?$:JSON.stringify($),onChange:j=>{const G={...Y,[M]:j.target.value};le(G)},placeholder:"Nhập nội dung tập tin",className:"min-h-[200px] font-mono",disabled:Pe||jo(M)}):l.jsx(kt,{id:M,value:typeof $=="string"?$:JSON.stringify($),onChange:j=>{const G={...Y,[M]:j.target.value};le(G)},placeholder:"Nhập nội dung",className:"s3-explr-input",disabled:Pe||jo(M)})]},M))})})})]})]}),l.jsxs(un,{className:"s3-explr-dialog-footer",children:[l.jsx(ie,{variant:"outline",onClick:()=>{K(null),le(null),Ee(""),nt("")},className:"s3-explr-cancel-btn",children:"Hủy"}),Cn==="edit"?l.jsx(ie,{onClick:()=>U&&Ux(U,je),disabled:Pe||ft,className:"s3-explr-save-btn",children:Pe?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang lưu..."]}):"Lưu thay đổi"}):Cn==="edit-metadata"?l.jsx(ie,{onClick:()=>Y&&typeof Y=="object"&&U&&jx(U),disabled:Pe||ft,className:"s3-explr-save-btn",children:Pe?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang lưu..."]}):"Lưu thay đổi"}):l.jsx(ie,{onClick:()=>{ue.trim()&&U&&Bx(U,ue.trim())},disabled:Nt||!ue.trim()||ue.trim()===(U==null?void 0:U.name),className:"s3-explr-rename-btn",children:Nt?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin s3-explr-loader"}),"Đang đổi tên..."]}):"Đổi tên"})]})]})}),F&&Ie&&l.jsx(sx,{openDialogRename:Ie,setOpenDialogRename:Ue,apiBaseUrl:t,setFileToMove:O,fileToMove:F,refreshFiles:We,ignoreCache:_e})]})]}),kx&&l.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"}),l.jsx("div",{className:"rounded-md border s3-explr-table-container",children:l.jsxs(Nr,{className:"s3-explr-table",children:[l.jsx(Tr,{className:"s3-explr-table-header",children:Ci.getHeaderGroups().map(M=>l.jsx(Ye,{className:"hover:bg-transparent s3-explr-header-row",children:M.headers.map($=>l.jsx(st,{className:"s3-explr-header-cell",children:$.isPlaceholder?null:nr($.column.columnDef.header,$.getContext())},$.id))},M.id))}),l.jsx(Pr,{className:"s3-explr-table-body",children:Ci.getRowModel().rows.length===0?l.jsx(Ye,{className:"s3-explr-empty-row",children:l.jsx(De,{colSpan:_d.length,className:"h-24 text-center s3-explr-empty-cell",children:a?l.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 "',a,'"']}):l.jsx("div",{className:"text-gray-500 s3-explr-empty-message",children:xi?"Đ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"})})}):Ci.getRowModel().rows.map(M=>l.jsx(Ye,{className:"h-12 s3-explr-row",children:M.getVisibleCells().map($=>l.jsx(De,{className:"align-middle s3-explr-cell",children:nr($.column.columnDef.cell,$.getContext())},$.id))},M.id))})]})}),r&&o&&l.jsxs("div",{className:"flex justify-between items-center mt-4 s3-explr-selector-footer",children:[l.jsxs("div",{className:"text-sm text-gray-500 s3-explr-selection-count",children:[c.size," ",(c.size===1,"tập tin")," đã chọn"]}),l.jsx(ie,{variant:"default",onClick:()=>o(zx()),disabled:c.size===0,className:"s3-explr-ok-btn",children:"OK"})]}),!r&&l.jsx(Jc,{})]})});var jn=e=>e.type==="checkbox",Kt=e=>e instanceof Date,Fe=e=>e==null;const sd=e=>typeof e=="object";var he=e=>!Fe(e)&&!Array.isArray(e)&&sd(e)&&!Kt(e),dx=e=>he(e)&&e.target?jn(e.target)?e.target.checked:e.target.value:e,fx=e=>e.substring(0,e.search(/\.\d+(\.|$)/))||e,px=(e,t)=>e.has(fx(t)),gx=e=>{const t=e.constructor&&e.constructor.prototype;return he(t)&&t.hasOwnProperty("isPrototypeOf")},ai=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function He(e){let t;const n=Array.isArray(e),r=typeof FileList<"u"?e instanceof FileList:!1;if(e instanceof Date)t=new Date(e);else if(e instanceof Set)t=new Set(e);else if(!(ai&&(e instanceof Blob||r))&&(n||he(e)))if(t=n?[]:{},!n&&!gx(e))t=e;else for(const o in e)e.hasOwnProperty(o)&&(t[o]=He(e[o]));else return e;return t}var eo=e=>Array.isArray(e)?e.filter(Boolean):[],pe=e=>e===void 0,W=(e,t,n)=>{if(!t||!he(e))return n;const r=eo(t.split(/[,[\].]+?/)).reduce((o,s)=>Fe(o)?o:o[s],e);return pe(r)||r===e?pe(e[t])?n:e[t]:r},ct=e=>typeof e=="boolean",li=e=>/^\w*$/.test(e),id=e=>eo(e.replace(/["|']|\]/g,"").split(/\.|\[/)),fe=(e,t,n)=>{let r=-1;const o=li(t)?[t]:id(t),s=o.length,i=s-1;for(;++r<s;){const a=o[r];let u=n;if(r!==i){const c=e[a];u=he(c)||Array.isArray(c)?c:isNaN(+o[r+1])?{}:[]}if(a==="__proto__"||a==="constructor"||a==="prototype")return;e[a]=u,e=e[a]}return e};const ad={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},et={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},St={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"};A.createContext(null);var hx=(e,t,n,r=!0)=>{const o={defaultValues:t._defaultValues};for(const s in e)Object.defineProperty(o,s,{get:()=>{const i=s;return t._proxyFormState[i]!==et.all&&(t._proxyFormState[i]=!r||et.all),e[i]}});return o},Me=e=>he(e)&&!Object.keys(e).length,mx=(e,t,n,r)=>{n(e);const{name:o,...s}=e;return Me(s)||Object.keys(s).length>=Object.keys(t).length||Object.keys(s).find(i=>t[i]===et.all)},to=e=>Array.isArray(e)?e:[e];function vx(e){const t=A.useRef(e);t.current=e,A.useEffect(()=>{const n=!e.disabled&&t.current.subject&&t.current.subject.subscribe({next:t.current.next});return()=>{n&&n.unsubscribe()}},[e.disabled])}var ut=e=>typeof e=="string",yx=(e,t,n,r,o)=>ut(e)?(r&&t.watch.add(e),W(n,e,o)):Array.isArray(e)?e.map(s=>(r&&t.watch.add(s),W(n,s))):(r&&(t.watchAll=!0),n),wx=(e,t,n,r,o)=>t?{...n[e],types:{...n[e]&&n[e].types?n[e].types:{},[r]:o||!0}}:{},ld=e=>({isOnSubmit:!e||e===et.onSubmit,isOnBlur:e===et.onBlur,isOnChange:e===et.onChange,isOnAll:e===et.all,isOnTouch:e===et.onTouched}),cd=(e,t,n)=>!n&&(t.watchAll||t.watch.has(e)||[...t.watch].some(r=>e.startsWith(r)&&/^\.\w+/.test(e.slice(r.length))));const Wn=(e,t,n,r)=>{for(const o of n||Object.keys(e)){const s=W(e,o);if(s){const{_f:i,...a}=s;if(i){if(i.refs&&i.refs[0]&&t(i.refs[0],o)&&!r)return!0;if(i.ref&&t(i.ref,i.name)&&!r)return!0;if(Wn(a,t))break}else if(he(a)&&Wn(a,t))break}}};var bx=(e,t,n)=>{const r=to(W(e,n));return fe(r,"root",t[n]),fe(e,n,r),e},ci=e=>e.type==="file",dt=e=>typeof e=="function",no=e=>{if(!ai)return!1;const t=e?e.ownerDocument:0;return e instanceof(t&&t.defaultView?t.defaultView.HTMLElement:HTMLElement)},ro=e=>ut(e),ui=e=>e.type==="radio",oo=e=>e instanceof RegExp;const ud={value:!1,isValid:!1},dd={value:!0,isValid:!0};var fd=e=>{if(Array.isArray(e)){if(e.length>1){const t=e.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:t,isValid:!!t.length}}return e[0].checked&&!e[0].disabled?e[0].attributes&&!pe(e[0].attributes.value)?pe(e[0].value)||e[0].value===""?dd:{value:e[0].value,isValid:!0}:dd:ud}return ud};const pd={isValid:!1,value:null};var gd=e=>Array.isArray(e)?e.reduce((t,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:t,pd):pd;function hd(e,t,n="validate"){if(ro(e)||Array.isArray(e)&&e.every(ro)||ct(e)&&!e)return{type:n,message:ro(e)?e:"",ref:t}}var xn=e=>he(e)&&!oo(e)?e:{value:e,message:""},md=async(e,t,n,r,o)=>{const{ref:s,refs:i,required:a,maxLength:u,minLength:c,min:f,max:p,pattern:m,validate:g,name:v,valueAsNumber:h,mount:y,disabled:w}=e._f,b=W(t,v);if(!y||w)return{};const S=i?i[0]:s,E=k=>{r&&S.reportValidity&&(S.setCustomValidity(ct(k)?"":k||""),S.reportValidity())},x={},P=ui(s),F=jn(s),O=P||F,I=(h||ci(s))&&pe(s.value)&&pe(b)||no(s)&&s.value===""||b===""||Array.isArray(b)&&!b.length,D=wx.bind(null,v,n,x),q=(k,z,R,J=St.maxLength,B=St.minLength)=>{const U=k?z:R;x[v]={type:k?J:B,message:U,ref:s,...D(k?J:B,U)}};if(o?!Array.isArray(b)||!b.length:a&&(!O&&(I||Fe(b))||ct(b)&&!b||F&&!fd(i).isValid||P&&!gd(i).isValid)){const{value:k,message:z}=ro(a)?{value:!!a,message:a}:xn(a);if(k&&(x[v]={type:St.required,message:z,ref:S,...D(St.required,z)},!n))return E(z),x}if(!I&&(!Fe(f)||!Fe(p))){let k,z;const R=xn(p),J=xn(f);if(!Fe(b)&&!isNaN(b)){const B=s.valueAsNumber||b&&+b;Fe(R.value)||(k=B>R.value),Fe(J.value)||(z=B<J.value)}else{const B=s.valueAsDate||new Date(b),U=le=>new Date(new Date().toDateString()+" "+le),K=s.type=="time",Y=s.type=="week";ut(R.value)&&b&&(k=K?U(b)>U(R.value):Y?b>R.value:B>new Date(R.value)),ut(J.value)&&b&&(z=K?U(b)<U(J.value):Y?b<J.value:B<new Date(J.value))}if((k||z)&&(q(!!k,R.message,J.message,St.max,St.min),!n))return E(x[v].message),x}if((u||c)&&!I&&(ut(b)||o&&Array.isArray(b))){const k=xn(u),z=xn(c),R=!Fe(k.value)&&b.length>+k.value,J=!Fe(z.value)&&b.length<+z.value;if((R||J)&&(q(R,k.message,z.message),!n))return E(x[v].message),x}if(m&&!I&&ut(b)){const{value:k,message:z}=xn(m);if(oo(k)&&!b.match(k)&&(x[v]={type:St.pattern,message:z,ref:s,...D(St.pattern,z)},!n))return E(z),x}if(g){if(dt(g)){const k=await g(b,t),z=hd(k,S);if(z&&(x[v]={...z,...D(St.validate,z.message)},!n))return E(z.message),x}else if(he(g)){let k={};for(const z in g){if(!Me(k)&&!n)break;const R=hd(await g[z](b,t),S,z);R&&(k={...R,...D(z,R.message)},E(R.message),n&&(x[v]=k))}if(!Me(k)&&(x[v]={ref:S,...k},!n))return x}}return E(!0),x};function xx(e,t){const n=t.slice(0,-1).length;let r=0;for(;r<n;)e=pe(e)?r++:e[t[r++]];return e}function Cx(e){for(const t in e)if(e.hasOwnProperty(t)&&!pe(e[t]))return!1;return!0}function xe(e,t){const n=Array.isArray(t)?t:li(t)?[t]:id(t),r=n.length===1?e:xx(e,n),o=n.length-1,s=n[o];return r&&delete r[s],o!==0&&(he(r)&&Me(r)||Array.isArray(r)&&Cx(r))&&xe(e,n.slice(0,-1)),e}var di=()=>{let e=[];return{get observers(){return e},next:o=>{for(const s of e)s.next&&s.next(o)},subscribe:o=>(e.push(o),{unsubscribe:()=>{e=e.filter(s=>s!==o)}}),unsubscribe:()=>{e=[]}}},fi=e=>Fe(e)||!sd(e);function Vt(e,t){if(fi(e)||fi(t))return e===t;if(Kt(e)&&Kt(t))return e.getTime()===t.getTime();const n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(const o of n){const s=e[o];if(!r.includes(o))return!1;if(o!=="ref"){const i=t[o];if(Kt(s)&&Kt(i)||he(s)&&he(i)||Array.isArray(s)&&Array.isArray(i)?!Vt(s,i):s!==i)return!1}}return!0}var vd=e=>e.type==="select-multiple",Sx=e=>ui(e)||jn(e),pi=e=>no(e)&&e.isConnected,yd=e=>{for(const t in e)if(dt(e[t]))return!0;return!1};function so(e,t={}){const n=Array.isArray(e);if(he(e)||n)for(const r in e)Array.isArray(e[r])||he(e[r])&&!yd(e[r])?(t[r]=Array.isArray(e[r])?[]:{},so(e[r],t[r])):Fe(e[r])||(t[r]=!0);return t}function wd(e,t,n){const r=Array.isArray(e);if(he(e)||r)for(const o in e)Array.isArray(e[o])||he(e[o])&&!yd(e[o])?pe(t)||fi(n[o])?n[o]=Array.isArray(e[o])?so(e[o],[]):{...so(e[o])}:wd(e[o],Fe(t)?{}:t[o],n[o]):n[o]=!Vt(e[o],t[o]);return n}var Gn=(e,t)=>wd(e,t,so(t)),bd=(e,{valueAsNumber:t,valueAsDate:n,setValueAs:r})=>pe(e)?e:t?e===""?NaN:e&&+e:n&&ut(e)?new Date(e):r?r(e):e;function gi(e){const t=e.ref;if(!(e.refs?e.refs.every(n=>n.disabled):t.disabled))return ci(t)?t.files:ui(t)?gd(e.refs).value:vd(t)?[...t.selectedOptions].map(({value:n})=>n):jn(t)?fd(e.refs).value:bd(pe(t.value)?e.ref.value:t.value,e)}var Ex=(e,t,n,r)=>{const o={};for(const s of e){const i=W(t,s);i&&fe(o,s,i._f)}return{criteriaMode:n,names:[...e],fields:o,shouldUseNativeValidation:r}},qn=e=>pe(e)?e:oo(e)?e.source:he(e)?oo(e.value)?e.value.source:e.value:e;const xd="AsyncFunction";var Nx=e=>!!e&&!!e.validate&&!!(dt(e.validate)&&e.validate.constructor.name===xd||he(e.validate)&&Object.values(e.validate).find(t=>t.constructor.name===xd)),Tx=e=>e.mount&&(e.required||e.min||e.max||e.maxLength||e.minLength||e.pattern||e.validate);function Cd(e,t,n){const r=W(e,n);if(r||li(n))return{error:r,name:n};const o=n.split(".");for(;o.length;){const s=o.join("."),i=W(t,s),a=W(e,s);if(i&&!Array.isArray(i)&&n!==s)return{name:n};if(a&&a.type)return{name:s,error:a};o.pop()}return{name:n}}var Px=(e,t,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(t||e):(n?r.isOnBlur:o.isOnBlur)?!e:(n?r.isOnChange:o.isOnChange)?e:!0,Ax=(e,t)=>!eo(W(e,t)).length&&xe(e,t);const _x={mode:et.onSubmit,reValidateMode:et.onChange,shouldFocusError:!0};function Fx(e={}){let t={..._x,...e},n={submitCount:0,isDirty:!1,isLoading:dt(t.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1},r={},o=he(t.defaultValues)||he(t.values)?He(t.defaultValues||t.values)||{}:{},s=t.shouldUnregister?{}:He(o),i={action:!1,mount:!1,watch:!1},a={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,c=0;const f={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},p={values:di(),array:di(),state:di()},m=ld(t.mode),g=ld(t.reValidateMode),v=t.criteriaMode===et.all,h=C=>N=>{clearTimeout(c),c=setTimeout(C,N)},y=async C=>{if(!t.disabled&&(f.isValid||C)){const N=t.resolver?Me((await O()).errors):await D(r,!0);N!==n.isValid&&p.state.next({isValid:N})}},w=(C,N)=>{!t.disabled&&(f.isValidating||f.validatingFields)&&((C||Array.from(a.mount)).forEach(_=>{_&&(N?fe(n.validatingFields,_,N):xe(n.validatingFields,_))}),p.state.next({validatingFields:n.validatingFields,isValidating:!Me(n.validatingFields)}))},b=(C,N=[],_,H,V=!0,L=!0)=>{if(H&&_&&!t.disabled){if(i.action=!0,L&&Array.isArray(W(r,C))){const X=_(W(r,C),H.argA,H.argB);V&&fe(r,C,X)}if(L&&Array.isArray(W(n.errors,C))){const X=_(W(n.errors,C),H.argA,H.argB);V&&fe(n.errors,C,X),Ax(n.errors,C)}if(f.touchedFields&&L&&Array.isArray(W(n.touchedFields,C))){const X=_(W(n.touchedFields,C),H.argA,H.argB);V&&fe(n.touchedFields,C,X)}f.dirtyFields&&(n.dirtyFields=Gn(o,s)),p.state.next({name:C,isDirty:k(C,N),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else fe(s,C,N)},S=(C,N)=>{fe(n.errors,C,N),p.state.next({errors:n.errors})},E=C=>{n.errors=C,p.state.next({errors:n.errors,isValid:!1})},x=(C,N,_,H)=>{const V=W(r,C);if(V){const L=W(s,C,pe(_)?W(o,C):_);pe(L)||H&&H.defaultChecked||N?fe(s,C,N?L:gi(V._f)):J(C,L),i.mount&&y()}},P=(C,N,_,H,V)=>{let L=!1,X=!1;const se={name:C};if(!t.disabled){const me=!!(W(r,C)&&W(r,C)._f&&W(r,C)._f.disabled);if(!_||H){f.isDirty&&(X=n.isDirty,n.isDirty=se.isDirty=k(),L=X!==se.isDirty);const ve=me||Vt(W(o,C),N);X=!!(!me&&W(n.dirtyFields,C)),ve||me?xe(n.dirtyFields,C):fe(n.dirtyFields,C,!0),se.dirtyFields=n.dirtyFields,L=L||f.dirtyFields&&X!==!ve}if(_){const ve=W(n.touchedFields,C);ve||(fe(n.touchedFields,C,_),se.touchedFields=n.touchedFields,L=L||f.touchedFields&&ve!==_)}L&&V&&p.state.next(se)}return L?se:{}},F=(C,N,_,H)=>{const V=W(n.errors,C),L=f.isValid&&ct(N)&&n.isValid!==N;if(t.delayError&&_?(u=h(()=>S(C,_)),u(t.delayError)):(clearTimeout(c),u=null,_?fe(n.errors,C,_):xe(n.errors,C)),(_?!Vt(V,_):V)||!Me(H)||L){const X={...H,...L&&ct(N)?{isValid:N}:{},errors:n.errors,name:C};n={...n,...X},p.state.next(X)}},O=async C=>{w(C,!0);const N=await t.resolver(s,t.context,Ex(C||a.mount,r,t.criteriaMode,t.shouldUseNativeValidation));return w(C),N},I=async C=>{const{errors:N}=await O(C);if(C)for(const _ of C){const H=W(N,_);H?fe(n.errors,_,H):xe(n.errors,_)}else n.errors=N;return N},D=async(C,N,_={valid:!0})=>{for(const H in C){const V=C[H];if(V){const{_f:L,...X}=V;if(L){const se=a.array.has(L.name),me=V._f&&Nx(V._f);me&&f.validatingFields&&w([H],!0);const ve=await md(V,s,v,t.shouldUseNativeValidation&&!N,se);if(me&&f.validatingFields&&w([H]),ve[L.name]&&(_.valid=!1,N))break;!N&&(W(ve,L.name)?se?bx(n.errors,ve,L.name):fe(n.errors,L.name,ve[L.name]):xe(n.errors,L.name))}!Me(X)&&await D(X,N,_)}}return _.valid},q=()=>{for(const C of a.unMount){const N=W(r,C);N&&(N._f.refs?N._f.refs.every(_=>!pi(_)):!pi(N._f.ref))&&Se(C)}a.unMount=new Set},k=(C,N)=>!t.disabled&&(C&&N&&fe(s,C,N),!Vt(ue(),o)),z=(C,N,_)=>yx(C,a,{...i.mount?s:pe(N)?o:ut(C)?{[C]:N}:N},_,N),R=C=>eo(W(i.mount?s:o,C,t.shouldUnregister?W(o,C,[]):[])),J=(C,N,_={})=>{const H=W(r,C);let V=N;if(H){const L=H._f;L&&(!L.disabled&&fe(s,C,bd(N,L)),V=no(L.ref)&&Fe(N)?"":N,vd(L.ref)?[...L.ref.options].forEach(X=>X.selected=V.includes(X.value)):L.refs?jn(L.ref)?L.refs.length>1?L.refs.forEach(X=>(!X.defaultChecked||!X.disabled)&&(X.checked=Array.isArray(V)?!!V.find(se=>se===X.value):V===X.value)):L.refs[0]&&(L.refs[0].checked=!!V):L.refs.forEach(X=>X.checked=X.value===V):ci(L.ref)?L.ref.value="":(L.ref.value=V,L.ref.type||p.values.next({name:C,values:{...s}})))}(_.shouldDirty||_.shouldTouch)&&P(C,V,_.shouldTouch,_.shouldDirty,!0),_.shouldValidate&&le(C)},B=(C,N,_)=>{for(const H in N){const V=N[H],L=`${C}.${H}`,X=W(r,L);(a.array.has(C)||he(V)||X&&!X._f)&&!Kt(V)?B(L,V,_):J(L,V,_)}},U=(C,N,_={})=>{const H=W(r,C),V=a.array.has(C),L=He(N);fe(s,C,L),V?(p.array.next({name:C,values:{...s}}),(f.isDirty||f.dirtyFields)&&_.shouldDirty&&p.state.next({name:C,dirtyFields:Gn(o,s),isDirty:k(C,L)})):H&&!H._f&&!Fe(L)?B(C,L,_):J(C,L,_),cd(C,a)&&p.state.next({...n}),p.values.next({name:i.mount?C:void 0,values:{...s}})},K=async C=>{i.mount=!0;const N=C.target;let _=N.name,H=!0;const V=W(r,_),L=()=>N.type?gi(V._f):dx(C),X=se=>{H=Number.isNaN(se)||Kt(se)&&isNaN(se.getTime())||Vt(se,W(s,_,se))};if(V){let se,me;const ve=L(),gt=C.type===ad.BLUR||C.type===ad.FOCUS_OUT,ao=!Tx(V._f)&&!t.resolver&&!W(n.errors,_)&&!V._f.deps||Px(gt,W(n.touchedFields,_),n.isSubmitted,g,m),Sn=cd(_,a,gt);fe(s,_,ve),gt?(V._f.onBlur&&V._f.onBlur(C),u&&u(0)):V._f.onChange&&V._f.onChange(C);const ce=P(_,ve,gt,!1),En=!Me(ce)||Sn;if(!gt&&p.values.next({name:_,type:C.type,values:{...s}}),ao)return f.isValid&&(t.mode==="onBlur"?gt&&y():y()),En&&p.state.next({name:_,...Sn?{}:ce});if(!gt&&Sn&&p.state.next({...n}),t.resolver){const{errors:Xn}=await O([_]);if(X(ve),H){const bi=Cd(n.errors,r,_),ke=Cd(Xn,r,bi.name||_);se=ke.error,_=ke.name,me=Me(Xn)}}else w([_],!0),se=(await md(V,s,v,t.shouldUseNativeValidation))[_],w([_]),X(ve),H&&(se?me=!1:f.isValid&&(me=await D(r,!0)));H&&(V._f.deps&&le(V._f.deps),F(_,me,se,ce))}},Y=(C,N)=>{if(W(n.errors,N)&&C.focus)return C.focus(),1},le=async(C,N={})=>{let _,H;const V=to(C);if(t.resolver){const L=await I(pe(C)?C:V);_=Me(L),H=C?!V.some(X=>W(L,X)):_}else C?(H=(await Promise.all(V.map(async L=>{const X=W(r,L);return await D(X&&X._f?{[L]:X}:X)}))).every(Boolean),!(!H&&!n.isValid)&&y()):H=_=await D(r);return p.state.next({...!ut(C)||f.isValid&&_!==n.isValid?{}:{name:C},...t.resolver||!C?{isValid:_}:{},errors:n.errors}),N.shouldFocus&&!H&&Wn(r,Y,C?V:a.mount),H},ue=C=>{const N={...i.mount?s:o};return pe(C)?N:ut(C)?W(N,C):C.map(_=>W(N,_))},Ee=(C,N)=>({invalid:!!W((N||n).errors,C),isDirty:!!W((N||n).dirtyFields,C),error:W((N||n).errors,C),isValidating:!!W(n.validatingFields,C),isTouched:!!W((N||n).touchedFields,C)}),Ie=C=>{C&&to(C).forEach(N=>xe(n.errors,N)),p.state.next({errors:C?n.errors:{}})},Ue=(C,N,_)=>{const H=(W(r,C,{_f:{}})._f||{}).ref,V=W(n.errors,C)||{},{ref:L,message:X,type:se,...me}=V;fe(n.errors,C,{...me,...N,ref:H}),p.state.next({name:C,errors:n.errors,isValid:!1}),_&&_.shouldFocus&&H&&H.focus&&H.focus()},Nt=(C,N)=>dt(C)?p.values.subscribe({next:_=>C(z(void 0,N),_)}):z(C,N,!0),Se=(C,N={})=>{for(const _ of C?to(C):a.mount)a.mount.delete(_),a.array.delete(_),N.keepValue||(xe(r,_),xe(s,_)),!N.keepError&&xe(n.errors,_),!N.keepDirty&&xe(n.dirtyFields,_),!N.keepTouched&&xe(n.touchedFields,_),!N.keepIsValidating&&xe(n.validatingFields,_),!t.shouldUnregister&&!N.keepDefaultValue&&xe(o,_);p.values.next({values:{...s}}),p.state.next({...n,...N.keepDirty?{isDirty:k()}:{}}),!N.keepIsValid&&y()},Ce=({disabled:C,name:N,field:_,fields:H,value:V})=>{if(ct(C)&&i.mount||C){const L=C?void 0:pe(V)?gi(_?_._f:W(H,N)._f):V;(C||!C&&!pe(L))&&fe(s,N,L),P(N,L,!1,!1,!0)}},tt=(C,N={})=>{let _=W(r,C);const H=ct(N.disabled)||ct(t.disabled);return fe(r,C,{..._||{},_f:{..._&&_._f?_._f:{ref:{name:C}},name:C,mount:!0,...N}}),a.mount.add(C),_?Ce({field:_,disabled:ct(N.disabled)?N.disabled:t.disabled,name:C,value:N.value}):x(C,!0,N.value),{...H?{disabled:N.disabled||t.disabled}:{},...t.progressive?{required:!!N.required,min:qn(N.min),max:qn(N.max),minLength:qn(N.minLength),maxLength:qn(N.maxLength),pattern:qn(N.pattern)}:{},name:C,onChange:K,onBlur:K,ref:V=>{if(V){tt(C,N),_=W(r,C);const L=pe(V.value)&&V.querySelectorAll&&V.querySelectorAll("input,select,textarea")[0]||V,X=Sx(L),se=_._f.refs||[];if(X?se.find(me=>me===L):L===_._f.ref)return;fe(r,C,{_f:{..._._f,...X?{refs:[...se.filter(pi),L,...Array.isArray(W(o,C))?[{}]:[]],ref:{type:L.type,name:C}}:{ref:L}}}),x(C,!1,void 0,L)}else _=W(r,C,{}),_._f&&(_._f.mount=!1),(t.shouldUnregister||N.shouldUnregister)&&!(px(a.array,C)&&i.action)&&a.unMount.add(C)}}},je=()=>t.shouldFocusError&&Wn(r,Y,a.mount),nt=C=>{ct(C)&&(p.state.next({disabled:C}),Wn(r,(N,_)=>{const H=W(r,_);H&&(N.disabled=H._f.disabled||C,Array.isArray(H._f.refs)&&H._f.refs.forEach(V=>{V.disabled=H._f.disabled||C}))},0,!1))},ft=(C,N)=>async _=>{let H;if(_&&(_.preventDefault&&_.preventDefault(),_.persist&&_.persist()),t.disabled){N&&await N({...n.errors},_);return}let V=He(s);if(p.state.next({isSubmitting:!0}),t.resolver){const{errors:L,values:X}=await O();n.errors=L,V=X}else await D(r);if(xe(n.errors,"root"),Me(n.errors)){p.state.next({errors:{}});try{await C(V,_)}catch(L){H=L}}else N&&await N({...n.errors},_),je(),setTimeout(je);if(p.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:Me(n.errors)&&!H,submitCount:n.submitCount+1,errors:n.errors}),H)throw H},Xt=(C,N={})=>{W(r,C)&&(pe(N.defaultValue)?U(C,He(W(o,C))):(U(C,N.defaultValue),fe(o,C,He(N.defaultValue))),N.keepTouched||xe(n.touchedFields,C),N.keepDirty||(xe(n.dirtyFields,C),n.isDirty=N.defaultValue?k(C,He(W(o,C))):k()),N.keepError||(xe(n.errors,C),f.isValid&&y()),p.state.next({...n}))},Pe=(C,N={})=>{const _=C?He(C):o,H=He(_),V=Me(C),L=V?o:H;if(N.keepDefaultValues||(o=_),!N.keepValues){if(N.keepDirtyValues){const X=new Set([...a.mount,...Object.keys(Gn(o,s))]);for(const se of Array.from(X))W(n.dirtyFields,se)?fe(L,se,W(s,se)):U(se,W(L,se))}else{if(ai&&pe(C))for(const X of a.mount){const se=W(r,X);if(se&&se._f){const me=Array.isArray(se._f.refs)?se._f.refs[0]:se._f.ref;if(no(me)){const ve=me.closest("form");if(ve){ve.reset();break}}}}r={}}s=t.shouldUnregister?N.keepDefaultValues?He(o):{}:He(L),p.array.next({values:{...L}}),p.values.next({values:{...L}})}a={mount:N.keepDirtyValues?a.mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},i.mount=!f.isValid||!!N.keepIsValid||!!N.keepDirtyValues,i.watch=!!t.shouldUnregister,p.state.next({submitCount:N.keepSubmitCount?n.submitCount:0,isDirty:V?!1:N.keepDirty?n.isDirty:!!(N.keepDefaultValues&&!Vt(C,o)),isSubmitted:N.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:V?{}:N.keepDirtyValues?N.keepDefaultValues&&s?Gn(o,s):n.dirtyFields:N.keepDefaultValues&&C?Gn(o,C):N.keepDirty?n.dirtyFields:{},touchedFields:N.keepTouched?n.touchedFields:{},errors:N.keepErrors?n.errors:{},isSubmitSuccessful:N.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},pt=(C,N)=>Pe(dt(C)?C(s):C,N);return{control:{register:tt,unregister:Se,getFieldState:Ee,handleSubmit:ft,setError:Ue,_executeSchema:O,_getWatch:z,_getDirty:k,_updateValid:y,_removeUnmounted:q,_updateFieldArray:b,_updateDisabledField:Ce,_getFieldArray:R,_reset:Pe,_resetDefaultValues:()=>dt(t.defaultValues)&&t.defaultValues().then(C=>{pt(C,t.resetOptions),p.state.next({isLoading:!1})}),_updateFormState:C=>{n={...n,...C}},_disableForm:nt,_subjects:p,_proxyFormState:f,_setErrors:E,get _fields(){return r},get _formValues(){return s},get _state(){return i},set _state(C){i=C},get _defaultValues(){return o},get _names(){return a},set _names(C){a=C},get _formState(){return n},set _formState(C){n=C},get _options(){return t},set _options(C){t={...t,...C}}},trigger:le,register:tt,handleSubmit:ft,watch:Nt,setValue:U,getValues:ue,reset:pt,resetField:Xt,clearErrors:Ie,unregister:Se,setError:Ue,setFocus:(C,N={})=>{const _=W(r,C),H=_&&_._f;if(H){const V=H.refs?H.refs[0]:H.ref;V.focus&&(V.focus(),N.shouldSelect&&dt(V.select)&&V.select())}},getFieldState:Ee}}function Ox(e={}){const t=A.useRef(),n=A.useRef(),[r,o]=A.useState({isDirty:!1,isValidating:!1,isLoading:dt(e.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1,defaultValues:dt(e.defaultValues)?void 0:e.defaultValues});t.current||(t.current={...Fx(e),formState:r});const s=t.current.control;return s._options=e,vx({subject:s._subjects.state,next:i=>{mx(i,s._proxyFormState,s._updateFormState)&&o({...s._formState})}}),A.useEffect(()=>s._disableForm(e.disabled),[s,e.disabled]),A.useEffect(()=>{if(s._proxyFormState.isDirty){const i=s._getDirty();i!==r.isDirty&&s._subjects.state.next({isDirty:i})}},[s,r.isDirty]),A.useEffect(()=>{e.values&&!Vt(e.values,n.current)?(s._reset(e.values,s._options.resetOptions),n.current=e.values,o(i=>({...i}))):s._resetDefaultValues()},[e.values,s]),A.useEffect(()=>{e.errors&&s._setErrors(e.errors)},[e.errors,s]),A.useEffect(()=>{s._state.mount||(s._updateValid(),s._state.mount=!0),s._state.watch&&(s._state.watch=!1,s._subjects.state.next({...s._formState})),s._removeUnmounted()}),A.useEffect(()=>{e.shouldUnregister&&s._subjects.values.next({values:s._getWatch()})},[e.shouldUnregister,s]),A.useMemo(()=>({...t.current,formState:hx(r,s)}),[r,s])}const Sd=({className:e,children:t,content:n,side:r})=>{const[o,s]=A.useState(!1);return l.jsx(vn,{delayDuration:0,children:l.jsxs(yn,{open:o,children:[l.jsx(wn,{asChild:!0,children:l.jsx("button",{type:"button",className:te("cursor-pointer",e),onClick:()=>s(!o),onMouseEnter:()=>s(!0),onMouseLeave:()=>s(!1),onTouchStart:()=>s(!o),onKeyDown:i=>{i.preventDefault(),i.key==="Enter"&&s(!o)},children:t})}),l.jsx(qt,{side:r,className:n?"":"hidden",children:l.jsx("span",{className:"inline-block",children:n})})]})})},hi=({className:e,...t})=>l.jsx("nav",{role:"navigation","aria-label":"pagination",className:te("mx-auto flex w-full justify-center",e),...t});hi.displayName="Pagination";const mi=d.forwardRef(({className:e,...t},n)=>l.jsx("ul",{ref:n,className:te("flex flex-row items-center gap-1",e),...t}));mi.displayName="PaginationContent";const Et=d.forwardRef(({className:e,...t},n)=>l.jsx("li",{ref:n,className:te("",e),...t}));Et.displayName="PaginationItem";const Kn=({className:e,isActive:t,size:n="icon",...r})=>l.jsx("a",{"aria-current":t?"page":void 0,className:te(Ha({variant:t?"outline":"ghost",size:n}),e),...r});Kn.displayName="PaginationLink";const vi=({className:e,...t})=>l.jsxs(Kn,{"aria-label":"Go to previous page",size:"default",className:te("gap-1 pl-2.5",e),...t,children:[l.jsx(ng,{className:"h-4 w-4"}),l.jsx("span",{children:"Previous"})]});vi.displayName="PaginationPrevious";const yi=({className:e,...t})=>l.jsxs(Kn,{"aria-label":"Go to next page",size:"default",className:te("gap-1 pr-2.5",e),...t,children:[l.jsx("span",{children:"Next"}),l.jsx(Na,{className:"h-4 w-4"})]});yi.displayName="PaginationNext";const wi=({className:e,...t})=>l.jsxs("span",{"aria-hidden":!0,className:te("flex h-9 w-9 items-center justify-center",e),...t,children:[l.jsx(rg,{className:"h-4 w-4"}),l.jsx("span",{className:"sr-only",children:"More pages"})]});wi.displayName="PaginationEllipsis";const Dx=(e,t)=>{const[n,r]=A.useState(e);return A.useEffect(()=>{const o=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(o)}},[e,t]),n},Mx=({apiBaseUrl:e="https://s3-explorer.cmcts1.studio.ai.vn"})=>{var P,F;const[t,n]=A.useState([]),[r,o]=A.useState(!1),[s,i]=A.useState([]),[a,u]=A.useState(1),[c,f]=A.useState(1),[p,m]=A.useState(null),[g,v]=A.useState(""),h=Dx(g,500),y=O=>{const I=O.match(/\d{6}/);if(!I)return{month:"",year:""};const D=I[0],q=D.substring(0,2),k=D.substring(2);return{month:q,year:k}},w=O=>O.map(D=>{let q=(D==null?void 0:D.month)||"",k=(D==null?void 0:D.year)||"";if((!q||!k)&&(D!=null&&D.file_name)){const z=y(D.file_name);q=q||z.month,k=k||z.year}return{id:D==null?void 0:D.id,prefix:(D==null?void 0:D.prefix)||"",model:(D==null?void 0:D.model)||"",fileName:(D==null?void 0:D.file_name)||"",code:(D==null?void 0:D.stock_id)||"",month:q,year:k,content:(D==null?void 0:D.text_summary)||"",status:(D==null?void 0:D.status)||"",note:(D==null?void 0:D.note)||"",lastUpdate:D==null?void 0:D.updated_at,stock_id:D==null?void 0:D.stock_id}}),b=O=>{if(!(O!=null&&O.data))return[];const I=w(O==null?void 0:O.data);n(I),f(O.pagination.totalPages)},S=async(O=1,I=15)=>{m(O),o(!0);try{const D=await oe.get(`${e}/api/latest-summaries`,{params:{page:O,limit:I,search:g}});(D==null?void 0:D.status)===200?b(D.data):console.error(D)}catch(D){console.error("Error fetching data:",D)}finally{m(null),o(!1)}};A.useEffect(()=>{h&&u(1),S(a)},[a,h]);const E=A.useMemo(()=>[{id:"code",header:"Mã",accessorKey:"code",cell:({row:I})=>l.jsx("span",{className:"flex flex-col",children:I.original.code})},{id:"month",header:"Tháng",accessorKey:"month",cell:({row:I})=>{const D=I.original.month,q=I.original.year;return l.jsx("span",{className:"flex flex-col",children:`${D.toString().padStart(2,"0")}/${q}`})}},{id:"content",header:"Nội dung",accessorKey:"content",cell:({row:I})=>{const D=I.getValue("content");return l.jsx("div",{className:"text-start truncate text-ellipsis overflow-hidden whitespace-nowrap max-w-[30dvw]",children:D})}},{id:"status",header:"Trạng thái",accessorKey:"status",cell:({row:I})=>{const q=I.original.status!=="unpublish";return l.jsx("span",{className:`inline-flex items-center rounded-full px-2 py-0 text-[10px] font-bold ${q?"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:q?"PUBLISHED":"UNPUBLISHED"})}},{id:"note",header:"Ghi chú",accessorKey:"note",cell:({row:I})=>l.jsx(Sd,{content:l.jsx("div",{className:"font-medium text-[16px] max-w-[90dvw]",children:I.original.note}),children:l.jsx("div",{className:"text-start truncate text-ellipsis overflow-hidden whitespace-nowrap max-w-[20dvw]",children:I.original.note})})},{id:"last-update",header:"Cập nhật",accessorKey:"last-update",cell:({row:I})=>{const D=new Date(I.original.lastUpdate),q=D.getDate(),k=D.getMonth()+1,z=`ngày ${q} tháng ${k}`;return l.jsx("span",{className:"flex flex-col",children:z})}},{accessorKey:"actions",header:()=>l.jsx("div",{className:"font-medium text-right",children:"Hành động"}),cell:({row:I})=>{const[D,q]=A.useState(!1),[k,z]=A.useState(!1),[R,J]=A.useState(!1),{handleSubmit:B,register:U,reset:K}=Ox(),Y=I.original.id,le=I.getValue("status"),ue=I.getValue("content"),[Ee,Ie]=A.useState(!1),Ue=async()=>{try{Ie(!0);const Se=le==="unpublish"?"published":"unpublish",Ce=await oe.patch(`${e}/api/toggle-publish/${Y}`,{id:Y,typeAction:"update",status:le,idInput:Y,stock_id:I.original.stock_id,prefix:I.original.prefix,model:I.original.model,summary_result:I.original.content,note:I.original.note});Ce.status===200?n(tt=>tt.map(je=>je.id===Y?{...je,status:Se}:je)):console.error("Failed to toggle publish status:",Ce)}catch(Se){console.error("Error toggling publish status:",Se)}finally{Ie(!1)}},Nt=async Se=>{q(!0);try{const Ce=await oe.patch(`${e}/api/update-summary`,{note:Se.note,text_summary:Se.content,id:Y});Ce.status===200?(await S(a),z(!1)):console.error("Failed to update summary:",Ce)}catch(Ce){console.error("Error updating summary:",Ce)}return q(!1)};return l.jsxs("div",{className:"flex items-center justify-end gap-2",children:[l.jsx(ie,{variant:"outline",size:"sm",onClick:()=>J(!0),className:"px-2 py-0.5 h-7",children:l.jsx(og,{className:"h-4 w-4"})}),l.jsx(It,{open:R,onOpenChange:J,children:l.jsxs(vt,{className:"max-w-3xl max-h-[80vh]",children:[l.jsx(yt,{children:l.jsx(wt,{children:"Nội dung chi tiết"})}),l.jsx("div",{className:"mt-4 overflow-y-auto max-h-[60vh]",children:l.jsx("div",{className:"whitespace-pre-wrap text-[16px] leading-relaxed",children:ue})})]})}),l.jsxs(It,{open:k,onOpenChange:Se=>{z(Se),Se?K({content:I.original.content,note:I.original.note}):K()},children:[l.jsx(Er,{asChild:!0,children:l.jsx(ie,{variant:"outline",size:"sm",onClick:()=>z(!0),className:"px-2 py-0.5 h-7",children:"Sửa"})}),l.jsx(vt,{className:"rounded-lg sm:px-3 h-[calc(100dvh-200px)] min-w-[calc(100dvw-112px)]",children:l.jsxs(yt,{className:"flex flex-col gap-3",children:[l.jsx(wt,{className:"max-sm:hidden text-center",children:"Sửa summary"}),l.jsxs("form",{className:"flex flex-col gap-3 h-full justify-between",onSubmit:B(Nt),children:[l.jsxs("div",{className:"flex flex-col gap-2",children:[l.jsxs("div",{className:"flex flex-col items-start",children:[l.jsx("span",{children:"Nội dung:"}),l.jsx(In,{placeholder:"Nội dung",className:"w-full input-scroll-bar",defaultValue:I.original.answer||"",rows:10,...U("content")})]}),l.jsxs("div",{className:"flex flex-col items-start",children:[l.jsx("span",{children:"Ghi chú:"}),l.jsx(In,{placeholder:"Nội dung",className:"w-full input-scroll-bar",defaultValue:I.original.note||"",rows:1,...U("note")})]})]}),l.jsx("div",{className:"flex justify-end",children:l.jsx(ie,{disabled:D,type:"submit",variant:"default",children:D?l.jsx(ye,{className:"h-4 w-4 animate-spin"}):"Ok"})})]})]})})]}),l.jsx(ie,{variant:"outline",size:"sm",onClick:Ue,disabled:Ee,className:"w-[70px] px-2 py-0.5 h-7",children:Ee?l.jsx(ye,{className:"h-4 w-4 animate-spin"}):le==="unpublish"?"Publish":"Unpublish"})]})}}],[]),x=Vi({data:t,columns:E,state:{columnFilters:s},enableRowSelection:!0,onColumnFiltersChange:i,getFilteredRowModel:Ef(),getCoreRowModel:Ri()});return l.jsxs("div",{className:"space-y-4 s3-explr-container",children:[l.jsx("div",{className:"flex items-center space-x-4 s3-explr-toolbar",children:l.jsxs("div",{className:"relative max-w-sm",children:[l.jsx(kt,{placeholder:"Tìm kiếm theo mã...",value:g,onChange:O=>v(O.target.value),className:"pr-8"}),g&&l.jsx(ie,{variant:"ghost",size:"sm",className:"absolute right-1 top-1/2 -translate-y-1/2 h-6 w-6 p-0",onClick:()=>v(""),children:l.jsx(Uo,{className:"h-4 w-4"})})]})}),l.jsx("div",{className:"rounded-md border s3-explr-table-container",children:l.jsxs(Nr,{className:"s3-explr-table",children:[l.jsx(Tr,{className:"s3-explr-table-header",children:x.getHeaderGroups().map(O=>l.jsx(Ye,{className:"hover:bg-transparent s3-explr-header-row",children:O.headers.map(I=>l.jsx(st,{className:"s3-explr-header-cell",children:I.isPlaceholder?null:nr(I.column.columnDef.header,I.getContext())},I.id))},O.id))}),l.jsx(Pr,{className:"s3-explr-table-body",children:r?l.jsx(Ye,{children:l.jsx(De,{colSpan:E.length,className:"h-24 text-center",children:"Đang tải dữ liệu..."})}):(P=x.getRowModel().rows)!=null&&P.length?(F=x.getRowModel().rows)==null?void 0:F.map(O=>l.jsx(Ye,{className:"h-12 s3-explr-row",children:O.getVisibleCells().map(I=>l.jsx(De,{className:"align-middle s3-explr-cell",children:nr(I.column.columnDef.cell,I.getContext())},I.id))},O.id)):l.jsx(Ye,{children:l.jsx(De,{colSpan:E.length,className:"h-24 text-center",children:"Không có kết quả."})})})]})}),l.jsx("div",{className:"mt-4",children:l.jsx(hi,{children:l.jsxs(mi,{children:[l.jsx(Et,{children:l.jsx(vi,{onClick:()=>u(O=>Math.max(1,O-1)),className:a===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:c},(O,I)=>I+1).filter(O=>O===1||O===c||Math.abs(O-a)<=1).map((O,I,D)=>l.jsxs(l.Fragment,{children:[I>0&&D[I-1]!==O-1&&l.jsx(Et,{children:l.jsx(wi,{})},O+"..."),l.jsx(Et,{children:l.jsx(Kn,{onClick:()=>u(O),isActive:a===O,className:`cursor-pointer ${r?"pointer-events-none":""}`,children:p===O?l.jsx(ye,{className:"h-4 w-4 animate-spin"}):O})},O)]})),l.jsx(Et,{children:l.jsx(yi,{onClick:()=>u(O=>Math.min(c,O+1)),className:a===c||p!==null?"pointer-events-none opacity-50":"cursor-pointer"})})]})})})]})},Ed=10,Ix=A.memo(({apiBaseUrl:e="https://s3-explorer.cmcts1.studio.ai.vn"})=>{const[t,n]=A.useState(1),[r,o]=A.useState([]),[s,i]=A.useState({total:0,page:1,limit:Ed,totalPages:1}),[a,u]=A.useState(!0),[c,f]=A.useState(null),[p,m]=A.useState(new Set),{toast:g}=Rr(),[v,h]=A.useState(!1),y=async x=>{try{f(x);const P=await oe.get(`${e}/api/jobs`,{params:{page:x.toString(),limit:Ed.toString()}});o(P.data.data),i(P.data.pagination)}catch{g({variant:"destructive",title:"Error",description:"Failed to fetch jobs. Please try again."})}finally{f(null),u(!1)}};A.useEffect(()=>{y(t)},[t,e]);const w=async x=>{m(P=>new Set(P).add(x.toString()));try{await oe.post(`${e}/api/retry-job`,{jobId:x}),g({title:"Job Restarted",description:`Job ${x} has been successfully restarted.`}),y(t)}catch{g({variant:"destructive",title:"Retry Failed",description:`Failed to restart job ${x}. Please try again.`})}finally{m(P=>{const F=new Set(P);return F.delete(x.toString()),F})}},b=async()=>{h(!0),n(1),await y(1),h(!1)},S=x=>new Date(x).toLocaleString(),E=x=>{if(x=parseFloat(x),x<60)return`${x.toFixed(2)}s`;const P=Math.floor(x/60),F=(x%60).toFixed(0);return`${P}m ${F}s`};return l.jsxs("div",{children:[l.jsxs("div",{className:"flex items-center gap-2 mb-6",children:[l.jsx(eg,{className:"w-8 h-8 text-primary"}),l.jsx("h2",{className:"text-3xl font-bold tracking-tight",children:"Job Management"}),l.jsx(ie,{variant:"outline",size:"icon",onClick:b,disabled:v||a,className:"ml-2",children:l.jsx(ag,{className:`h-4 w-4 ${v?"animate-spin":""}`})})]}),l.jsx("div",{className:"rounded-md border",children:l.jsxs(Nr,{children:[l.jsx(Tr,{children:l.jsxs(Ye,{children:[l.jsx(st,{children:"ID"}),l.jsx(st,{children:"Tên Công Việc"}),l.jsx(st,{children:"Thời Gian Bắt Đầu"}),l.jsx(st,{children:"Thời Gian Cập Nhật"}),l.jsx(st,{children:"Thời Gian Thực Thi"}),l.jsx(st,{children:"Trạng Thái"}),l.jsx(st,{children:"Thao Tác"})]})}),l.jsx(Pr,{children:a&&r.length===0?l.jsx(Ye,{children:l.jsx(De,{colSpan:7,className:"text-center py-4",children:l.jsx(ye,{className:"w-6 h-6 animate-spin mx-auto"})})}):r.map(x=>{var P,F;return l.jsxs(Ye,{children:[l.jsx(De,{className:"!w-[100px]",children:x.id}),l.jsx(De,{className:"font-medium",children:(P=x.job_name)==null?void 0:P.replace("Upload file","Summary")}),l.jsx(De,{className:"!w-[200px]",children:S(x.created_at)}),l.jsx(De,{className:"!w-[200px]",children:S(x.updated_at)}),l.jsx(De,{className:"!w-[150px]",children:E(x.execution_time_seconds)}),l.jsx(De,{className:"!w-[200px]",children:l.jsx(Sd,{content:x.status==="fail"&&x.error?l.jsx("div",{className:"font-medium text-[16px] max-w-[90dvw]",children:x.error}):null,children:l.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]
|
|
147
147
|
${x.status==="done"?"bg-green-100 text-green-800":x.status==="fail"?"bg-red-100 text-red-800":"bg-yellow-100 text-yellow-800"}`,children:x.status==="fail"?"FAILED":(F=x.status)==null?void 0:F.toUpperCase()})})}),l.jsx(De,{className:"!w-[200px]",children:x.status==="fail"?l.jsx(ie,{variant:"outline",size:"sm",onClick:()=>w(x.id),disabled:p.has(x.id.toString()),className:"h-[32px]",children:p.has(x.id.toString())?l.jsxs(l.Fragment,{children:[l.jsx(ye,{className:"mr-2 h-4 w-4 animate-spin"}),"Đang thử lại..."]}):"Thử Lại"}):l.jsx("div",{className:"h-[32px]"})})]},x.id)})})]})}),l.jsx("div",{className:"mt-4",children:l.jsx(hi,{children:l.jsxs(mi,{children:[l.jsx(Et,{children:l.jsx(vi,{onClick:()=>n(x=>Math.max(1,x-1)),className:t===1?"pointer-events-none opacity-50":"cursor-pointer"})}),Array.from({length:s.totalPages},(x,P)=>P+1).filter(x=>x===1||x===s.totalPages||Math.abs(x-t)<=1).map((x,P,F)=>l.jsxs(l.Fragment,{children:[P>0&&F[P-1]!==x-1&&l.jsx(Et,{children:l.jsx(wi,{})},x+"..."),l.jsx(Et,{children:l.jsx(Kn,{onClick:()=>n(x),isActive:t===x,className:`cursor-pointer ${c!==null?"pointer-events-none":""}`,children:c===x?l.jsx(ye,{className:"h-4 w-4 animate-spin"}):x})},x)]})),l.jsx(Et,{children:l.jsx(yi,{onClick:()=>n(x=>Math.min(s.totalPages,x+1)),className:t===s.totalPages||c!==null?"pointer-events-none opacity-50":"cursor-pointer"})})]})})}),l.jsx(Jc,{})]})});Ge.Job=Ix,Ge.S3Explorer=ux,Ge.Summary=Mx,Object.defineProperty(Ge,Symbol.toStringTag,{value:"Module"})});
|
|
148
148
|
//# sourceMappingURL=s3-explorer.umd.cjs.map
|