import{r as i,W as Mn,X as In,j as a,A as Z,m as $,D as ct,x as we,v as Tn,C as An,w as Bn,y as Ie,J as Ve,B as ie,N as Fn,Y as Ln,R as On}from"./index-BVAJPyoi.js";import{c as qn}from"./clsx-B-dksMZM.js";import{F as Ue,i as Hn,j as Wn,k as zn,C as $n,a6 as Vn,s as Un,n as be,o as Gn,H as Kn,r as Xn,p as Yn,q as lt}from"./TextField-Co2uoZNe.js";import{a as K,b as xt,c as Jn}from"./tslib.es6-BUas5LQb.js";import{c as Y}from"./utils-Bdm9QozO.js";import{X as Zn}from"./x-CzJs-Tw5.js";import{R as Qn}from"./refresh-cw-DoD9eHF9.js";import{S as er}from"./search-GkEEVNuM.js";const Za=e=>i.createElement("svg",{width:"1em",height:"1em",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e},i.createElement("path",{d:"M4.79175 7.396L10.0001 12.6043L15.2084 7.396",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round"})),Qa=e=>i.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round",className:"icon icon-tabler icons-tabler-outline icon-tabler-folder-open",...e},i.createElement("path",{stroke:"none",d:"M0 0h24v24H0z",fill:"none"}),i.createElement("path",{d:"M5 19l2.757 -7.351a1 1 0 0 1 .936 -.649h12.307a1 1 0 0 1 .986 1.164l-.996 5.211a2 2 0 0 1 -1.964 1.625h-14.026a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v2"}));var tr="Portal",wt=i.forwardRef((e,n)=>{var l;const{container:r,...o}=e,[c,d]=i.useState(!1);Mn(()=>d(!0),[]);const m=r||c&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return m?In.createPortal(a.jsx(Z.div,{...o,ref:n}),m):null});wt.displayName=tr;/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nr=[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]],rr=$("arrow-down",nr);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const or=[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]],ar=$("arrow-up",or);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sr=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]],fe=$("circle-alert",sr);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ir=[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",key:"1u773s"}],["path",{d:"M12 17h.01",key:"p32p05"}]],es=$("circle-question-mark",ir);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cr=[["path",{d:"M20 20v-7a4 4 0 0 0-4-4H4",key:"1nkjon"}],["path",{d:"M9 14 4 9l5-5",key:"102s5s"}]],lr=$("corner-up-left",cr);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ur=[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}]],dr=$("file",ur);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fr=[["path",{d:"m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2",key:"usdka0"}]],Te=$("folder-open",fr);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pr=[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"r6nss1"}]],mr=$("house",pr);/**
 * @license lucide-react v0.544.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hr=[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]],Ae=$("loader-circle",hr),gr=Ue(a.jsx("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})),vr=Ue(a.jsx("path",{d:"M19 3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.11 0 2-.9 2-2V5c0-1.1-.89-2-2-2zm-9 14l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"})),yr=Ue(a.jsx("path",{d:"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm-2 10H7v-2h10v2z"}));function br(e){return Wn("MuiCheckbox",e)}const Be=Hn("MuiCheckbox",["root","checked","disabled","indeterminate","colorPrimary","colorSecondary","sizeSmall","sizeMedium"]),xr=e=>{const{classes:n,indeterminate:r,color:o,size:c}=e,d={root:["root",r&&"indeterminate",`color${be(o)}`,`size${be(c)}`]},m=Gn(d,br,n);return{...n,...m}},wr=Un(Kn,{shouldForwardProp:e=>Xn(e)||e==="classes",name:"MuiCheckbox",slot:"Root",overridesResolver:(e,n)=>{const{ownerState:r}=e;return[n.root,r.indeterminate&&n.indeterminate,n[`size${be(r.size)}`],r.color!=="default"&&n[`color${be(r.color)}`]]}})(Yn(({theme:e})=>({color:(e.vars||e).palette.text.secondary,variants:[{props:{color:"default",disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette.action.active,(e.vars||e).palette.action.hoverOpacity)}}},...Object.entries(e.palette).filter(lt()).map(([n])=>({props:{color:n,disableRipple:!1},style:{"&:hover":{backgroundColor:e.alpha((e.vars||e).palette[n].main,(e.vars||e).palette.action.hoverOpacity)}}})),...Object.entries(e.palette).filter(lt()).map(([n])=>({props:{color:n},style:{[`&.${Be.checked}, &.${Be.indeterminate}`]:{color:(e.vars||e).palette[n].main},[`&.${Be.disabled}`]:{color:(e.vars||e).palette.action.disabled}}})),{props:{disableRipple:!1},style:{"&:hover":{"@media (hover: none)":{backgroundColor:"transparent"}}}}]}))),Sr=a.jsx(vr,{}),_r=a.jsx(gr,{}),Cr=a.jsx(yr,{}),ts=i.forwardRef(function(n,r){var T,q,V;const o=zn({props:n,name:"MuiCheckbox"}),{checkedIcon:c=Sr,color:d="primary",icon:m=_r,indeterminate:l=!1,indeterminateIcon:x=Cr,inputProps:w,size:b="medium",disableRipple:y=!1,className:C,slots:N={},slotProps:D={},...h}=o,v=l?x:m,S=l?x:c,_={...o,disableRipple:y,color:d,indeterminate:l,size:b},j=xr(_),k=(T=D.input)!=null?T:w,[M,P]=$n("root",{ref:r,elementType:wr,className:qn(j.root,C),shouldForwardComponentProp:!0,externalForwardedProps:{slots:N,slotProps:D,...h},ownerState:_,additionalProps:{type:"checkbox",icon:i.cloneElement(v,{fontSize:(q=v.props.fontSize)!=null?q:b}),checkedIcon:i.cloneElement(S,{fontSize:(V=S.props.fontSize)!=null?V:b}),disableRipple:y,slots:N,slotProps:{input:Vn(typeof k=="function"?k(_):k,{"data-indeterminate":l})}}});return a.jsx(M,{...P,classes:j})});var Fe="focusScope.autoFocusOnMount",Le="focusScope.autoFocusOnUnmount",ut={bubbles:!1,cancelable:!0},Nr="FocusScope",St=i.forwardRef((e,n)=>{const{loop:r=!1,trapped:o=!1,onMountAutoFocus:c,onUnmountAutoFocus:d,...m}=e,[l,x]=i.useState(null),w=ct(c),b=ct(d),y=i.useRef(null),C=we(n,h=>x(h)),N=i.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;i.useEffect(()=>{if(o){let h=function(j){if(N.paused||!l)return;const k=j.target;l.contains(k)?y.current=k:G(y.current,{select:!0})},v=function(j){if(N.paused||!l)return;const k=j.relatedTarget;k!==null&&(l.contains(k)||G(y.current,{select:!0}))},S=function(j){if(document.activeElement===document.body)for(const M of j)M.removedNodes.length>0&&G(l)};document.addEventListener("focusin",h),document.addEventListener("focusout",v);const _=new MutationObserver(S);return l&&_.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",h),document.removeEventListener("focusout",v),_.disconnect()}}},[o,l,N.paused]),i.useEffect(()=>{if(l){ft.add(N);const h=document.activeElement;if(!l.contains(h)){const S=new CustomEvent(Fe,ut);l.addEventListener(Fe,w),l.dispatchEvent(S),S.defaultPrevented||(jr(Dr(_t(l)),{select:!0}),document.activeElement===h&&G(l))}return()=>{l.removeEventListener(Fe,w),setTimeout(()=>{const S=new CustomEvent(Le,ut);l.addEventListener(Le,b),l.dispatchEvent(S),S.defaultPrevented||G(h!=null?h:document.body,{select:!0}),l.removeEventListener(Le,b),ft.remove(N)},0)}}},[l,w,b,N]);const D=i.useCallback(h=>{if(!r&&!o||N.paused)return;const v=h.key==="Tab"&&!h.altKey&&!h.ctrlKey&&!h.metaKey,S=document.activeElement;if(v&&S){const _=h.currentTarget,[j,k]=kr(_);j&&k?!h.shiftKey&&S===k?(h.preventDefault(),r&&G(j,{select:!0})):h.shiftKey&&S===j&&(h.preventDefault(),r&&G(k,{select:!0})):S===_&&h.preventDefault()}},[r,o,N.paused]);return a.jsx(Z.div,{tabIndex:-1,...m,ref:C,onKeyDown:D})});St.displayName=Nr;function jr(e,{select:n=!1}={}){const r=document.activeElement;for(const o of e)if(G(o,{select:n}),document.activeElement!==r)return}function kr(e){const n=_t(e),r=dt(n,e),o=dt(n.reverse(),e);return[r,o]}function _t(e){const n=[],r=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:o=>{const c=o.tagName==="INPUT"&&o.type==="hidden";return o.disabled||o.hidden||c?NodeFilter.FILTER_SKIP:o.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;r.nextNode();)n.push(r.currentNode);return n}function dt(e,n){for(const r of e)if(!Er(r,{upTo:n}))return r}function Er(e,{upTo:n}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(n!==void 0&&e===n)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Rr(e){return e instanceof HTMLInputElement&&"select"in e}function G(e,{select:n=!1}={}){if(e&&e.focus){const r=document.activeElement;e.focus({preventScroll:!0}),e!==r&&Rr(e)&&n&&e.select()}}var ft=Pr();function Pr(){let e=[];return{add(n){const r=e[0];n!==r&&(r==null||r.pause()),e=pt(e,n),e.unshift(n)},remove(n){var r;e=pt(e,n),(r=e[0])==null||r.resume()}}}function pt(e,n){const r=[...e],o=r.indexOf(n);return o!==-1&&r.splice(o,1),r}function Dr(e){return e.filter(n=>n.tagName!=="A")}var Oe=0;function Mr(){i.useEffect(()=>{var n,r;const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",(n=e[0])!=null?n:mt()),document.body.insertAdjacentElement("beforeend",(r=e[1])!=null?r:mt()),Oe++,()=>{Oe===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(o=>o.remove()),Oe--}},[])}function mt(){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 ve="right-scroll-bar-position",ye="width-before-scroll-bar",Ir="with-scroll-bars-hidden",Tr="--removed-body-scroll-bar-size";function qe(e,n){return typeof e=="function"?e(n):e&&(e.current=n),e}function Ar(e,n){var r=i.useState(function(){return{value:e,callback:n,facade:{get current(){return r.value},set current(o){var c=r.value;c!==o&&(r.value=o,r.callback(o,c))}}}})[0];return r.callback=n,r.facade}var Br=typeof window!="undefined"?i.useLayoutEffect:i.useEffect,ht=new WeakMap;function Fr(e,n){var r=Ar(null,function(o){return e.forEach(function(c){return qe(c,o)})});return Br(function(){var o=ht.get(r);if(o){var c=new Set(o),d=new Set(e),m=r.current;c.forEach(function(l){d.has(l)||qe(l,null)}),d.forEach(function(l){c.has(l)||qe(l,m)})}ht.set(r,e)},[e]),r}function Lr(e){return e}function Or(e,n){n===void 0&&(n=Lr);var r=[],o=!1,c={read:function(){if(o)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return r.length?r[r.length-1]:e},useMedium:function(d){var m=n(d,o);return r.push(m),function(){r=r.filter(function(l){return l!==m})}},assignSyncMedium:function(d){for(o=!0;r.length;){var m=r;r=[],m.forEach(d)}r={push:function(l){return d(l)},filter:function(){return r}}},assignMedium:function(d){o=!0;var m=[];if(r.length){var l=r;r=[],l.forEach(d),m=r}var x=function(){var b=m;m=[],b.forEach(d)},w=function(){return Promise.resolve().then(x)};w(),r={push:function(b){m.push(b),w()},filter:function(b){return m=m.filter(b),r}}}};return c}function qr(e){e===void 0&&(e={});var n=Or(null);return n.options=K({async:!0,ssr:!1},e),n}var Ct=function(e){var n=e.sideCar,r=xt(e,["sideCar"]);if(!n)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var o=n.read();if(!o)throw new Error("Sidecar medium not found");return i.createElement(o,K({},r))};Ct.isSideCarExport=!0;function Hr(e,n){return e.useMedium(n),Ct}var Nt=qr(),He=function(){},Se=i.forwardRef(function(e,n){var r=i.useRef(null),o=i.useState({onScrollCapture:He,onWheelCapture:He,onTouchMoveCapture:He}),c=o[0],d=o[1],m=e.forwardProps,l=e.children,x=e.className,w=e.removeScrollBar,b=e.enabled,y=e.shards,C=e.sideCar,N=e.noRelative,D=e.noIsolation,h=e.inert,v=e.allowPinchZoom,S=e.as,_=S===void 0?"div":S,j=e.gapMode,k=xt(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),M=C,P=Fr([r,n]),T=K(K({},k),c);return i.createElement(i.Fragment,null,b&&i.createElement(M,{sideCar:Nt,removeScrollBar:w,shards:y,noRelative:N,noIsolation:D,inert:h,setCallbacks:d,allowPinchZoom:!!v,lockRef:r,gapMode:j}),m?i.cloneElement(i.Children.only(l),K(K({},T),{ref:P})):i.createElement(_,K({},T,{className:x,ref:P}),l))});Se.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};Se.classNames={fullWidth:ye,zeroRight:ve};var Wr=function(){if(typeof __webpack_nonce__!="undefined")return __webpack_nonce__};function zr(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var n=Wr();return n&&e.setAttribute("nonce",n),e}function $r(e,n){e.styleSheet?e.styleSheet.cssText=n:e.appendChild(document.createTextNode(n))}function Vr(e){var n=document.head||document.getElementsByTagName("head")[0];n.appendChild(e)}var Ur=function(){var e=0,n=null;return{add:function(r){e==0&&(n=zr())&&($r(n,r),Vr(n)),e++},remove:function(){e--,!e&&n&&(n.parentNode&&n.parentNode.removeChild(n),n=null)}}},Gr=function(){var e=Ur();return function(n,r){i.useEffect(function(){return e.add(n),function(){e.remove()}},[n&&r])}},jt=function(){var e=Gr(),n=function(r){var o=r.styles,c=r.dynamic;return e(o,c),null};return n},Kr={left:0,top:0,right:0,gap:0},We=function(e){return parseInt(e||"",10)||0},Xr=function(e){var n=window.getComputedStyle(document.body),r=n[e==="padding"?"paddingLeft":"marginLeft"],o=n[e==="padding"?"paddingTop":"marginTop"],c=n[e==="padding"?"paddingRight":"marginRight"];return[We(r),We(o),We(c)]},Yr=function(e){if(e===void 0&&(e="margin"),typeof window=="undefined")return Kr;var n=Xr(e),r=document.documentElement.clientWidth,o=window.innerWidth;return{left:n[0],top:n[1],right:n[2],gap:Math.max(0,o-r+n[2]-n[0])}},Jr=jt(),re="data-scroll-locked",Zr=function(e,n,r,o){var c=e.left,d=e.top,m=e.right,l=e.gap;return r===void 0&&(r="margin"),`
  .`.concat(Ir,` {
   overflow: hidden `).concat(o,`;
   padding-right: `).concat(l,"px ").concat(o,`;
  }
  body[`).concat(re,`] {
    overflow: hidden `).concat(o,`;
    overscroll-behavior: contain;
    `).concat([n&&"position: relative ".concat(o,";"),r==="margin"&&`
    padding-left: `.concat(c,`px;
    padding-top: `).concat(d,`px;
    padding-right: `).concat(m,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(l,"px ").concat(o,`;
    `),r==="padding"&&"padding-right: ".concat(l,"px ").concat(o,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(ve,` {
    right: `).concat(l,"px ").concat(o,`;
  }
  
  .`).concat(ye,` {
    margin-right: `).concat(l,"px ").concat(o,`;
  }
  
  .`).concat(ve," .").concat(ve,` {
    right: 0 `).concat(o,`;
  }
  
  .`).concat(ye," .").concat(ye,` {
    margin-right: 0 `).concat(o,`;
  }
  
  body[`).concat(re,`] {
    `).concat(Tr,": ").concat(l,`px;
  }
`)},gt=function(){var e=parseInt(document.body.getAttribute(re)||"0",10);return isFinite(e)?e:0},Qr=function(){i.useEffect(function(){return document.body.setAttribute(re,(gt()+1).toString()),function(){var e=gt()-1;e<=0?document.body.removeAttribute(re):document.body.setAttribute(re,e.toString())}},[])},eo=function(e){var n=e.noRelative,r=e.noImportant,o=e.gapMode,c=o===void 0?"margin":o;Qr();var d=i.useMemo(function(){return Yr(c)},[c]);return i.createElement(Jr,{styles:Zr(d,!n,c,r?"":"!important")})},$e=!1;if(typeof window!="undefined")try{var pe=Object.defineProperty({},"passive",{get:function(){return $e=!0,!0}});window.addEventListener("test",pe,pe),window.removeEventListener("test",pe,pe)}catch(e){$e=!1}var ee=$e?{passive:!1}:!1,to=function(e){return e.tagName==="TEXTAREA"},kt=function(e,n){if(!(e instanceof Element))return!1;var r=window.getComputedStyle(e);return r[n]!=="hidden"&&!(r.overflowY===r.overflowX&&!to(e)&&r[n]==="visible")},no=function(e){return kt(e,"overflowY")},ro=function(e){return kt(e,"overflowX")},vt=function(e,n){var r=n.ownerDocument,o=n;do{typeof ShadowRoot!="undefined"&&o instanceof ShadowRoot&&(o=o.host);var c=Et(e,o);if(c){var d=Rt(e,o),m=d[1],l=d[2];if(m>l)return!0}o=o.parentNode}while(o&&o!==r.body);return!1},oo=function(e){var n=e.scrollTop,r=e.scrollHeight,o=e.clientHeight;return[n,r,o]},ao=function(e){var n=e.scrollLeft,r=e.scrollWidth,o=e.clientWidth;return[n,r,o]},Et=function(e,n){return e==="v"?no(n):ro(n)},Rt=function(e,n){return e==="v"?oo(n):ao(n)},so=function(e,n){return e==="h"&&n==="rtl"?-1:1},io=function(e,n,r,o,c){var d=so(e,window.getComputedStyle(n).direction),m=d*o,l=r.target,x=n.contains(l),w=!1,b=m>0,y=0,C=0;do{if(!l)break;var N=Rt(e,l),D=N[0],h=N[1],v=N[2],S=h-v-d*D;(D||S)&&Et(e,l)&&(y+=S,C+=D);var _=l.parentNode;l=_&&_.nodeType===Node.DOCUMENT_FRAGMENT_NODE?_.host:_}while(!x&&l!==document.body||x&&(n.contains(l)||n===l));return(b&&Math.abs(y)<1||!b&&Math.abs(C)<1)&&(w=!0),w},me=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},yt=function(e){return[e.deltaX,e.deltaY]},bt=function(e){return e&&"current"in e?e.current:e},co=function(e,n){return e[0]===n[0]&&e[1]===n[1]},lo=function(e){return`
  .block-interactivity-`.concat(e,` {pointer-events: none;}
  .allow-interactivity-`).concat(e,` {pointer-events: all;}
`)},uo=0,te=[];function fo(e){var n=i.useRef([]),r=i.useRef([0,0]),o=i.useRef(),c=i.useState(uo++)[0],d=i.useState(jt)[0],m=i.useRef(e);i.useEffect(function(){m.current=e},[e]),i.useEffect(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(c));var h=Jn([e.lockRef.current],(e.shards||[]).map(bt),!0).filter(Boolean);return h.forEach(function(v){return v.classList.add("allow-interactivity-".concat(c))}),function(){document.body.classList.remove("block-interactivity-".concat(c)),h.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(c))})}}},[e.inert,e.lockRef.current,e.shards]);var l=i.useCallback(function(h,v){if("touches"in h&&h.touches.length===2||h.type==="wheel"&&h.ctrlKey)return!m.current.allowPinchZoom;var S=me(h),_=r.current,j="deltaX"in h?h.deltaX:_[0]-S[0],k="deltaY"in h?h.deltaY:_[1]-S[1],M,P=h.target,T=Math.abs(j)>Math.abs(k)?"h":"v";if("touches"in h&&T==="h"&&P.type==="range")return!1;var q=vt(T,P);if(!q)return!0;if(q?M=T:(M=T==="v"?"h":"v",q=vt(T,P)),!q)return!1;if(!o.current&&"changedTouches"in h&&(j||k)&&(o.current=M),!M)return!0;var V=o.current||M;return io(V,v,h,V==="h"?j:k)},[]),x=i.useCallback(function(h){var v=h;if(!(!te.length||te[te.length-1]!==d)){var S="deltaY"in v?yt(v):me(v),_=n.current.filter(function(M){return M.name===v.type&&(M.target===v.target||v.target===M.shadowParent)&&co(M.delta,S)})[0];if(_&&_.should){v.cancelable&&v.preventDefault();return}if(!_){var j=(m.current.shards||[]).map(bt).filter(Boolean).filter(function(M){return M.contains(v.target)}),k=j.length>0?l(v,j[0]):!m.current.noIsolation;k&&v.cancelable&&v.preventDefault()}}},[]),w=i.useCallback(function(h,v,S,_){var j={name:h,delta:v,target:S,should:_,shadowParent:po(S)};n.current.push(j),setTimeout(function(){n.current=n.current.filter(function(k){return k!==j})},1)},[]),b=i.useCallback(function(h){r.current=me(h),o.current=void 0},[]),y=i.useCallback(function(h){w(h.type,yt(h),h.target,l(h,e.lockRef.current))},[]),C=i.useCallback(function(h){w(h.type,me(h),h.target,l(h,e.lockRef.current))},[]);i.useEffect(function(){return te.push(d),e.setCallbacks({onScrollCapture:y,onWheelCapture:y,onTouchMoveCapture:C}),document.addEventListener("wheel",x,ee),document.addEventListener("touchmove",x,ee),document.addEventListener("touchstart",b,ee),function(){te=te.filter(function(h){return h!==d}),document.removeEventListener("wheel",x,ee),document.removeEventListener("touchmove",x,ee),document.removeEventListener("touchstart",b,ee)}},[]);var N=e.removeScrollBar,D=e.inert;return i.createElement(i.Fragment,null,D?i.createElement(d,{styles:lo(c)}):null,N?i.createElement(eo,{noRelative:e.noRelative,gapMode:e.gapMode}):null)}function po(e){for(var n=null;e!==null;)e instanceof ShadowRoot&&(n=e.host,e=e.host),e=e.parentNode;return n}const mo=Hr(Nt,fo);var Pt=i.forwardRef(function(e,n){return i.createElement(Se,K({},e,{ref:n,sideCar:mo}))});Pt.classNames=Se.classNames;var ho=function(e){if(typeof document=="undefined")return null;var n=Array.isArray(e)?e[0]:e;return n.ownerDocument.body},ne=new WeakMap,he=new WeakMap,ge={},ze=0,Dt=function(e){return e&&(e.host||Dt(e.parentNode))},go=function(e,n){return n.map(function(r){if(e.contains(r))return r;var o=Dt(r);return o&&e.contains(o)?o:(console.error("aria-hidden",r,"in not contained inside",e,". Doing nothing"),null)}).filter(function(r){return!!r})},vo=function(e,n,r,o){var c=go(n,Array.isArray(e)?e:[e]);ge[r]||(ge[r]=new WeakMap);var d=ge[r],m=[],l=new Set,x=new Set(c),w=function(y){!y||l.has(y)||(l.add(y),w(y.parentNode))};c.forEach(w);var b=function(y){!y||x.has(y)||Array.prototype.forEach.call(y.children,function(C){if(l.has(C))b(C);else try{var N=C.getAttribute(o),D=N!==null&&N!=="false",h=(ne.get(C)||0)+1,v=(d.get(C)||0)+1;ne.set(C,h),d.set(C,v),m.push(C),h===1&&D&&he.set(C,!0),v===1&&C.setAttribute(r,"true"),D||C.setAttribute(o,"true")}catch(S){console.error("aria-hidden: cannot operate on ",C,S)}})};return b(n),l.clear(),ze++,function(){m.forEach(function(y){var C=ne.get(y)-1,N=d.get(y)-1;ne.set(y,C),d.set(y,N),C||(he.has(y)||y.removeAttribute(o),he.delete(y)),N||y.removeAttribute(r)}),ze--,ze||(ne=new WeakMap,ne=new WeakMap,he=new WeakMap,ge={})}},yo=function(e,n,r){r===void 0&&(r="data-aria-hidden");var o=Array.from(Array.isArray(e)?e:[e]),c=ho(e);return c?(o.push.apply(o,Array.from(c.querySelectorAll("[aria-live], script"))),vo(o,c,r,"aria-hidden")):function(){return null}};function bo(e){const n=xo(e),r=i.forwardRef((o,c)=>{const{children:d,...m}=o,l=i.Children.toArray(d),x=l.find(So);if(x){const w=x.props.children,b=l.map(y=>y===x?i.Children.count(w)>1?i.Children.only(null):i.isValidElement(w)?w.props.children:null:y);return a.jsx(n,{...m,ref:c,children:i.isValidElement(w)?i.cloneElement(w,void 0,b):null})}return a.jsx(n,{...m,ref:c,children:d})});return r.displayName=`${e}.Slot`,r}function xo(e){const n=i.forwardRef((r,o)=>{const{children:c,...d}=r;if(i.isValidElement(c)){const m=Co(c),l=_o(d,c.props);return c.type!==i.Fragment&&(l.ref=o?Tn(o,m):m),i.cloneElement(c,l)}return i.Children.count(c)>1?i.Children.only(null):null});return n.displayName=`${e}.SlotClone`,n}var wo=Symbol("radix.slottable");function So(e){return i.isValidElement(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===wo}function _o(e,n){const r={...n};for(const o in n){const c=e[o],d=n[o];/^on[A-Z]/.test(o)?c&&d?r[o]=(...l)=>{const x=d(...l);return c(...l),x}:c&&(r[o]=c):o==="style"?r[o]={...c,...d}:o==="className"&&(r[o]=[c,d].filter(Boolean).join(" "))}return{...e,...r}}function Co(e){var o,c;let n=(o=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:o.get,r=n&&"isReactWarning"in n&&n.isReactWarning;return r?e.ref:(n=(c=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:c.get,r=n&&"isReactWarning"in n&&n.isReactWarning,r?e.props.ref:e.props.ref||e.ref)}var _e="Dialog",[Mt]=Bn(_e),[No,H]=Mt(_e),It=e=>{const{__scopeDialog:n,children:r,open:o,defaultOpen:c,onOpenChange:d,modal:m=!0}=e,l=i.useRef(null),x=i.useRef(null),[w,b]=An({prop:o,defaultProp:c!=null?c:!1,onChange:d,caller:_e});return a.jsx(No,{scope:n,triggerRef:l,contentRef:x,contentId:Ie(),titleId:Ie(),descriptionId:Ie(),open:w,onOpenChange:b,onOpenToggle:i.useCallback(()=>b(y=>!y),[b]),modal:m,children:r})};It.displayName=_e;var Tt="DialogTrigger",jo=i.forwardRef((e,n)=>{const{__scopeDialog:r,...o}=e,c=H(Tt,r),d=we(n,c.triggerRef);return a.jsx(Z.button,{type:"button","aria-haspopup":"dialog","aria-expanded":c.open,"aria-controls":c.contentId,"data-state":Xe(c.open),...o,ref:d,onClick:ie(e.onClick,c.onOpenToggle)})});jo.displayName=Tt;var Ge="DialogPortal",[ko,At]=Mt(Ge,{forceMount:void 0}),Bt=e=>{const{__scopeDialog:n,forceMount:r,children:o,container:c}=e,d=H(Ge,n);return a.jsx(ko,{scope:n,forceMount:r,children:i.Children.map(o,m=>a.jsx(Ve,{present:r||d.open,children:a.jsx(wt,{asChild:!0,container:c,children:m})}))})};Bt.displayName=Ge;var xe="DialogOverlay",Ft=i.forwardRef((e,n)=>{const r=At(xe,e.__scopeDialog),{forceMount:o=r.forceMount,...c}=e,d=H(xe,e.__scopeDialog);return d.modal?a.jsx(Ve,{present:o||d.open,children:a.jsx(Ro,{...c,ref:n})}):null});Ft.displayName=xe;var Eo=bo("DialogOverlay.RemoveScroll"),Ro=i.forwardRef((e,n)=>{const{__scopeDialog:r,...o}=e,c=H(xe,r);return a.jsx(Pt,{as:Eo,allowPinchZoom:!0,shards:[c.contentRef],children:a.jsx(Z.div,{"data-state":Xe(c.open),...o,ref:n,style:{pointerEvents:"auto",...o.style}})})}),J="DialogContent",Lt=i.forwardRef((e,n)=>{const r=At(J,e.__scopeDialog),{forceMount:o=r.forceMount,...c}=e,d=H(J,e.__scopeDialog);return a.jsx(Ve,{present:o||d.open,children:d.modal?a.jsx(Po,{...c,ref:n}):a.jsx(Do,{...c,ref:n})})});Lt.displayName=J;var Po=i.forwardRef((e,n)=>{const r=H(J,e.__scopeDialog),o=i.useRef(null),c=we(n,r.contentRef,o);return i.useEffect(()=>{const d=o.current;if(d)return yo(d)},[]),a.jsx(Ot,{...e,ref:c,trapFocus:r.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:ie(e.onCloseAutoFocus,d=>{var m;d.preventDefault(),(m=r.triggerRef.current)==null||m.focus()}),onPointerDownOutside:ie(e.onPointerDownOutside,d=>{const m=d.detail.originalEvent,l=m.button===0&&m.ctrlKey===!0;(m.button===2||l)&&d.preventDefault()}),onFocusOutside:ie(e.onFocusOutside,d=>d.preventDefault())})}),Do=i.forwardRef((e,n)=>{const r=H(J,e.__scopeDialog),o=i.useRef(!1),c=i.useRef(!1);return a.jsx(Ot,{...e,ref:n,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:d=>{var m,l;(m=e.onCloseAutoFocus)==null||m.call(e,d),d.defaultPrevented||(o.current||(l=r.triggerRef.current)==null||l.focus(),d.preventDefault()),o.current=!1,c.current=!1},onInteractOutside:d=>{var x,w;(x=e.onInteractOutside)==null||x.call(e,d),d.defaultPrevented||(o.current=!0,d.detail.originalEvent.type==="pointerdown"&&(c.current=!0));const m=d.target;((w=r.triggerRef.current)==null?void 0:w.contains(m))&&d.preventDefault(),d.detail.originalEvent.type==="focusin"&&c.current&&d.preventDefault()}})}),Ot=i.forwardRef((e,n)=>{const{__scopeDialog:r,trapFocus:o,onOpenAutoFocus:c,onCloseAutoFocus:d,...m}=e,l=H(J,r),x=i.useRef(null),w=we(n,x);return Mr(),a.jsxs(a.Fragment,{children:[a.jsx(St,{asChild:!0,loop:!0,trapped:o,onMountAutoFocus:c,onUnmountAutoFocus:d,children:a.jsx(Fn,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Xe(l.open),...m,ref:w,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(Mo,{titleId:l.titleId}),a.jsx(To,{contentRef:x,descriptionId:l.descriptionId})]})]})}),Ke="DialogTitle",qt=i.forwardRef((e,n)=>{const{__scopeDialog:r,...o}=e,c=H(Ke,r);return a.jsx(Z.h2,{id:c.titleId,...o,ref:n})});qt.displayName=Ke;var Ht="DialogDescription",Wt=i.forwardRef((e,n)=>{const{__scopeDialog:r,...o}=e,c=H(Ht,r);return a.jsx(Z.p,{id:c.descriptionId,...o,ref:n})});Wt.displayName=Ht;var zt="DialogClose",$t=i.forwardRef((e,n)=>{const{__scopeDialog:r,...o}=e,c=H(zt,r);return a.jsx(Z.button,{type:"button",...o,ref:n,onClick:ie(e.onClick,()=>c.onOpenChange(!1))})});$t.displayName=zt;function Xe(e){return e?"open":"closed"}var Vt="DialogTitleWarning",[ns,Ut]=Ln(Vt,{contentName:J,titleName:Ke,docsSlug:"dialog"}),Mo=({titleId:e})=>{const n=Ut(Vt),r=`\`${n.contentName}\` requires a \`${n.titleName}\` for the component to be accessible for screen reader users.

If you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHidden component.

For more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return i.useEffect(()=>{e&&(document.getElementById(e)||console.error(r))},[r,e]),null},Io="DialogDescriptionWarning",To=({contentRef:e,descriptionId:n})=>{const o=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ut(Io).contentName}}.`;return i.useEffect(()=>{var d;const c=(d=e.current)==null?void 0:d.getAttribute("aria-describedby");n&&c&&(document.getElementById(n)||console.warn(o))},[o,e,n]),null},Ao=It,Bo=Bt,Gt=Ft,Kt=Lt,Xt=qt,Yt=Wt,Fo=$t;function Lo(){if(typeof document!="undefined")return document.querySelector("#projectpage-portal-root")||document.querySelector("#project-widget-root")||void 0}const Oo=Ao,qo=Bo,Jt=i.forwardRef(({className:e,...n},r)=>a.jsx(Gt,{ref:r,style:{backgroundColor:"transparent",backdropFilter:"none",opacity:1},className:Y("pointer-events-none fixed inset-0 z-40 bg-transparent backdrop-blur-none","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","pp-dialogOverlay",e),...n}));Jt.displayName=Gt.displayName;const Zt=i.forwardRef(({className:e,children:n,container:r,...o},c)=>{var l;const d=Lo(),m=(l=r!=null?r:d)!=null?l:void 0;return a.jsxs(qo,{container:m,children:[a.jsx(Jt,{}),a.jsxs(Kt,{ref:c,onInteractOutside:x=>{x.preventDefault()},className:Y("fixed left-1/2 top-1/2 z-[9999] grid w-full max-w-lg -translate-x-1/2 -translate-y-1/2 gap-4","rounded-2xl border border-gray-200 bg-white p-6 shadow-xl","dark:border-gray-800 dark:bg-gray-900","duration-200","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=open]:zoom-in-95 data-[state=closed]:zoom-out-95","data-[state=open]:fade-in-0 data-[state=closed]:fade-out-0","pp-dialogContent",e),...o,children:[n,a.jsx(Fo,{className:Y("absolute right-4 top-4 rounded-full p-1","border border-transparent bg-transparent","text-gray-500 hover:bg-gray-100 hover:text-gray-900","focus:outline-none","dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-100","pp-dialogClose"),"aria-label":"Close",children:a.jsx(Zn,{className:"h-5 w-5"})})]})]})});Zt.displayName=Kt.displayName;const Qt=({className:e,...n})=>a.jsx("div",{className:Y("flex flex-col space-y-1.5 text-center sm:text-left",e),...n});Qt.displayName="DialogHeader";const Ho=({className:e,...n})=>a.jsx("div",{className:Y("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",e),...n});Ho.displayName="DialogFooter";const en=i.forwardRef(({className:e,...n},r)=>a.jsx(Xt,{ref:r,className:Y("text-lg font-semibold leading-none tracking-tight",e),...n}));en.displayName=Xt.displayName;const tn=i.forwardRef(({className:e,...n},r)=>a.jsx(Yt,{ref:r,className:Y("text-sm text-gray-600 dark:text-gray-400",e),...n}));tn.displayName=Yt.displayName;const Wo="_dialogContent_5gcq3_3",zo="_dialogWidth_5gcq3_22",$o="_dialogHeight_5gcq3_27",Vo="_browserHeight_5gcq3_32",Uo="_previewHeight_5gcq3_36",Go="_dialogLayout_5gcq3_40",Ko="_headerBar_5gcq3_47",Xo="_headerTitle_5gcq3_72",Yo="_toolbar_5gcq3_89",Jo="_bodyGrid_5gcq3_112",Zo="_panel_5gcq3_121",Qo="_panelHeader_5gcq3_137",ea="_panelHeaderLeft_5gcq3_159",ta="_panelHeaderTitle_5gcq3_163",na="_panelHeaderPath_5gcq3_168",ra="_panelError_5gcq3_185",oa="_panelBody_5gcq3_200",aa="_list_5gcq3_206",sa="_listItem_5gcq3_219",ia="_rowBtn_5gcq3_229",ca="_rowBtnSelected_5gcq3_252",la="_fileSize_5gcq3_261",ua="_loadingRow_5gcq3_269",da="_previewViewport_5gcq3_283",fa="_centerPlaceholder_5gcq3_297",pa="_inlineLoading_5gcq3_323",ma="_textPreviewBox_5gcq3_336",ha="_imageFrameResponsive_5gcq3_403",ga="_previewImage_5gcq3_422",va="_metaValue_5gcq3_481",ya="_footer_5gcq3_486",ba="_ppChipBtn_5gcq3_495",xa="_ppDialogBtn_5gcq3_531",wa="_ppDialogBtnPrimary_5gcq3_546",Sa="_truncate_5gcq3_558",_a="_headerTitleText_5gcq3_564",Ca="_srOnly_5gcq3_597",Na="_iconSm_5gcq3_610",ja="_iconXs_5gcq3_616",ka="_iconSmMut_5gcq3_622",Ea="_iconSpinSm_5gcq3_644",Ra="_iconSpinSmMut_5gcq3_651",Pa="_errorBox_5gcq3_664",Da="_previewStack_5gcq3_678",Ma="_previewMain_5gcq3_685",Ia="_previewFooter_5gcq3_691",Ta="_metaGrid_5gcq3_716",Aa="_metaItem_5gcq3_723",Ba="_metaKey_5gcq3_732",Fa="_imageCanvas_5gcq3_744",La="_metaDetails_5gcq3_761",Oa="_metaSummary_5gcq3_766",qa="_metaChevron_5gcq3_783",Ha="_metaSummaryText_5gcq3_796",Wa="_metaJsonBlock_5gcq3_804",za="_metaHint_5gcq3_829",p={dialogContent:Wo,dialogWidth:zo,dialogHeight:$o,browserHeight:Vo,previewHeight:Uo,dialogLayout:Go,headerBar:Ko,headerTitle:Xo,toolbar:Yo,bodyGrid:Jo,panel:Zo,panelHeader:Qo,panelHeaderLeft:ea,panelHeaderTitle:ta,panelHeaderPath:na,panelError:ra,panelBody:oa,list:aa,listItem:sa,rowBtn:ia,rowBtnSelected:ca,fileSize:la,loadingRow:ua,previewViewport:da,centerPlaceholder:fa,inlineLoading:pa,textPreviewBox:ma,imageFrameResponsive:ha,previewImage:ga,metaValue:va,footer:ya,ppChipBtn:ba,ppDialogBtn:xa,ppDialogBtnPrimary:wa,truncate:Sa,headerTitleText:_a,srOnly:Ca,iconSm:Na,iconXs:ja,iconSmMut:ka,iconSpinSm:Ea,iconSpinSmMut:Ra,errorBox:Pa,previewStack:Da,previewMain:Ma,previewFooter:Ia,metaGrid:Ta,metaItem:Aa,metaKey:Ba,imageCanvas:Fa,metaDetails:La,metaSummary:Oa,metaChevron:qa,metaSummaryText:Ha,metaJsonBlock:Wa,metaHint:za};function rs({open:e,onClose:n,title:r="Browse protocol files",initialPath:o="",resolveBrowserPaths:c,listRemoteDirectory:d,previewRemoteEntry:m,protocolId:l,buildDownloadUrl:x,onPick:w}){const[b,y]=i.useState(o),[C,N]=i.useState([]),[D,h]=i.useState(!1),[v,S]=i.useState(null),[_,j]=i.useState(""),[k,M]=i.useState(""),[P,T]=i.useState(null),[q,V]=i.useState(""),[ce,nn]=i.useState("asc"),[E,le]=i.useState(null),[rn,Ce]=i.useState(!1),[Ye,Ne]=i.useState(null),[je,U]=i.useState(""),I=i.useRef(""),[on,an]=i.useState(null),ke=i.useRef(null),oe=i.useRef(0),Q=i.useRef(0),sn=p.dialogWidth,cn=p.dialogHeight,ln=p.browserHeight,un=p.previewHeight;i.useEffect(()=>{const t=typeof document!="undefined"?document:null;if(!t)return;let s=t.getElementById("projectpage-portal-root");s?s.classList.add("projectpage-widget-root"):(s=t.createElement("div"),s.id="projectpage-portal-root",s.classList.add("projectpage-widget-root"),s.style.position="fixed",s.style.left="0",s.style.top="0",s.style.width="0",s.style.height="0",s.style.zIndex="2147483647",t.body.appendChild(s)),t.documentElement.classList.contains("dark")?s.classList.add("dark"):s.classList.remove("dark"),an(s)},[]);const B=t=>(t||"").replace(/\\/g,"/").replace(/\/+/g,"/").trim(),Ee=t=>{const s=B(t||"");return s?s.startsWith("/")||/^[A-Za-z]:\//.test(s):!1},O=t=>{const s=B(t||"").replace(/^\/+/g,"");if(!s)return"";const u=s.split("/").filter(Boolean),f=[];for(const g of u)if(g!=="."){if(g===".."){f.length>0&&f.pop();continue}f.push(g)}return f.join("/")},Re=(t,s)=>{const u=O(t||""),f=O(s||"");return u?f?O(`${u}/${f}`):u:f},Je=t=>{const s=O(t||"");if(!s)return null;const u=s.split("/").filter(Boolean);return u.length<=1?"":u.slice(0,-1).join("/")},dn=t=>{const s=B(t||""),u=B(_||"");if(!s||!u)return"";const f=u.replace(/\/+$/g,""),g=s.replace(/\/+$/g,"");return g===f?"":g.startsWith(`${f}/`)?O(g.slice(f.length+1)):""},Pe=t=>{const s=B((t==null?void 0:t.path)||""),u=O((t==null?void 0:t.name)||"");if(s){if(Ee(s)){const g=dn(s);if(g)return g;const R=s.split("/").filter(Boolean).pop()||u;return Re(b,R)}const f=O(s);return f?f===u?Re(b,f):f:""}return Re(b,u)},fn=t=>{const s=B((t==null?void 0:t.absPath)||"");if(s&&Ee(s))return s;const u=B((t==null?void 0:t.path)||"");if(u&&Ee(u))return u;const f=Pe(t);if(!f&&_)return B(_);if(_){const g=B(_).replace(/\/+$/g,"");return f?`${g}/${f}`:g}return f},ue=(t,s)=>{if(!t||!s)return!1;const u=B(t.absPath||""),f=B(s.absPath||"");if(u||f)return u===f;const g=B(t.path||""),R=B(s.path||"");return g===R&&t.name===s.name&&t.isDir===s.isDir},W=t=>{try{t&&URL.revokeObjectURL(t)}catch(s){}},Ze=t=>{if(t==null||!Number.isFinite(t))return;const s=Math.abs(t),u=1024,f=u*1024,g=f*1024,R=g*1024,F=(A,L)=>{const z=A>=10?1:2;return`${A.toFixed(z)} ${L}`};return s<u?`${Math.round(t)} B`:s<f?F(t/u,"KB"):s<g?F(t/f,"MB"):s<R?F(t/g,"GB"):F(t/R,"TB")};function pn(t){var s,u;if(t!=null){if(typeof t=="number")return Number.isFinite(t)?t:void 0;if(Array.isArray(t)){const f=t.length>0?Number(t[0]):NaN;return Number.isFinite(f)?f:void 0}if(typeof t=="string"){const f=t.trim();if(!f)return;const g=(u=(s=f.split(",")[0])==null?void 0:s.trim())!=null?u:"",R=Number(g);return Number.isFinite(R)?R:void 0}}}function mn(t){const u={...t&&typeof t=="object"?t:{}};for(const L of Object.keys(u)){const z=L.toLowerCase();(z==="mime"||z.endsWith("mime"))&&delete u[L]}const f=u.sizeBytes,g=typeof f=="number"?f:typeof f=="string"?Number(f):void 0;if(typeof g=="number"&&Number.isFinite(g)){const L=Ze(g);L&&(u.size=L),delete u.sizeBytes}const R=pn(u.voxelSize);if(typeof R=="number"&&Number.isFinite(R)){const L=Math.round(R*1e6)/1e6;u.pixelSize=L,delete u.voxelSize}const F=Object.keys(u).sort((L,z)=>L.localeCompare(z)),A=[];for(const L of F){const z=u[L];z!==void 0&&A.push({key:L,rawValue:z})}return A}function Qe(t){const s=(t||"").trim();return s?!!(s.startsWith("{")&&s.endsWith("}")||s.startsWith("[")&&s.endsWith("]")):!1}function hn(t){try{return JSON.stringify(t,null,2)}catch(s){return String(t)}}function et(t){return t===void 0?"":t===null?"null":typeof t=="string"?t:typeof t=="number"?(Number.isFinite(t),String(t)):typeof t=="boolean"?t?"true":"false":Array.isArray(t)?t.map(s=>et(s)).join(", "):typeof t=="object"?"[object]":String(t)}function gn(t){if(t==null)return!1;if(typeof t=="object")return!0;if(typeof t=="string"){const s=t.trim();return s.length<120?!1:Qe(s)}return!1}function vn(t){if(t==null)return"null";if(typeof t=="string"){const s=t.trim();return s?s.length>80?`${s.slice(0,80)}…`:s:'""'}if(Array.isArray(t))return`Array(${t.length})`;if(typeof t=="object")try{return`Object(${Object.keys(t).length})`}catch(s){return"Object"}return String(t)}function yn({value:t}){if(!gn(t))return a.jsx("span",{className:p.metaValue,children:et(t)});const u=vn(t);let f="";if(typeof t=="string"){const g=t.trim();if(Qe(g))try{f=JSON.stringify(JSON.parse(g),null,2)}catch(R){f=g}else f=t}else f=hn(t);return a.jsxs("details",{className:p.metaDetails,children:[a.jsxs("summary",{className:p.metaSummary,children:[a.jsx("span",{className:p.metaChevron,children:"▸"}),a.jsx("span",{className:p.metaSummaryText,children:u}),a.jsx("span",{className:p.metaHint,children:"details"})]}),a.jsx("pre",{className:p.metaJsonBlock,children:f})]})}const bn=t=>{const s=mn(t);return s.length?a.jsx("div",{className:p.previewFooter,children:a.jsx("div",{className:p.metaGrid,children:s.map(u=>a.jsxs("div",{className:p.metaItem,children:[a.jsxs("span",{className:p.metaKey,children:[u.key,":"]}),a.jsx(yn,{value:u.rawValue})]},u.key))})}):null},de=(t,s)=>a.jsxs("div",{className:p.previewStack,children:[a.jsx("div",{className:p.previewMain,children:t}),bn(s)]}),ae=()=>{Q.current+=1,le(null),Ce(!1),Ne(null),W(I.current),I.current="",U("")},X=async t=>{const s=++oe.current;try{h(!0),S(null);const u=O(t||""),f=await d(u);if(oe.current!==s)return;N(Array.isArray(f)?f:[]),y(u),T(null),ae()}catch(u){if(oe.current!==s)return;const f=u instanceof Error?u.message:"Failed to list directory contents";S(f)}finally{oe.current===s&&h(!1)}},tt=t=>{if(!t.isDir)return;const s=Pe(t);X(s)},De=()=>{const t=Je(b);t!==null&&X(t)},xn=()=>{X("")},wn=()=>{k&&X(k)},Sn=async t=>{if(!m){ae();return}if(t.isDir){ae();return}const s=++Q.current;le(null),Ce(!0),Ne(null),W(I.current),I.current="",U("");try{const u=Pe(t),f=await m(u);if(Q.current!==s)return;le(f||{kind:"none",note:"No preview available."})}catch(u){if(Q.current!==s)return;const f=u instanceof Error?u.message:"Failed to load preview";Ne(f),le({kind:"error",message:f})}finally{Q.current===s&&Ce(!1)}},Me=t=>{T(t),Sn(t)},nt=()=>{if(!P||!w)return;const t=fn(P);w(t),n()},_n=t=>{t.stopPropagation()},Cn=t=>{var f;const s=t;if(!s)return!1;const u=(s.tagName||"").toLowerCase();return u==="input"||u==="textarea"||u==="select"?!0:!!((f=s.getAttribute)!=null&&f.call(s,"contenteditable"))},rt=(t,s)=>{if(!s.length)return;const u=P?s.findIndex(F=>ue(F,P)):-1,f=u>=0?u:t>0?-1:s.length,g=Math.max(0,Math.min(s.length-1,f+t)),R=s[g];R&&Me(R)},ot=()=>{var t,s;try{(t=ke.current)==null||t.focus(),(s=ke.current)==null||s.select()}catch(u){}};i.useEffect(()=>{let t=!0;return(async()=>{if(!e){oe.current+=1,Q.current+=1,N([]),y(O(o||"")),M(""),j(""),T(null),V(""),ae(),S(null);return}let u=O(o||""),f="";if(c)try{const g=await c();if(!t)return;const R=B((g==null?void 0:g.startPath)||"");u=O(R),f=B((g==null?void 0:g.rootAbs)||"")}catch(g){u=O(o||""),f=""}j(f),M(u),await X(u)})(),()=>{t=!1}},[e]),i.useEffect(()=>{if(!E||E.kind!=="image"){W(I.current),I.current="",U("");return}const t=E.source;if((t==null?void 0:t.sourceType)==="url"&&typeof t.url=="string"){W(I.current),I.current="",U(t.url);return}if((t==null?void 0:t.sourceType)==="blob"&&t.blob instanceof Blob){W(I.current);const s=URL.createObjectURL(t.blob);return I.current=s,U(s),()=>{W(s),I.current===s&&(I.current="")}}if((t==null?void 0:t.sourceType)==="base64"&&typeof t.dataBase64=="string"){const s=Nn(String(t.mime||E.mime||"image/png"))||"image/png";try{const u=jn(t.dataBase64,s);W(I.current);const f=URL.createObjectURL(u);return I.current=f,U(f),()=>{W(f),I.current===f&&(I.current="")}}catch(u){W(I.current),I.current="",U("");return}}W(I.current),I.current="",U("")},[E]);function Nn(t){const s=(t||"").trim().toLowerCase();return s?s.split(";")[0].trim():""}function jn(t,s){let u=(t||"").trim();if(u.startsWith("data:")){const A=u.indexOf(",");A>=0&&(u=u.slice(A+1))}u=u.replace(/-/g,"+").replace(/_/g,"/");const f=u.length%4;f===2?u+="==":f===3&&(u+="=");const g=atob(u),R=g.length,F=new Uint8Array(R);for(let A=0;A<R;A++)F[A]=g.charCodeAt(A);return new Blob([F],{type:s})}const at=Je(b),kn=at!==null&&!D&&!v,st=i.useMemo(()=>({name:"..",path:"..",isDir:!0}),[]),it=i.useMemo(()=>{const t=O(b||""),s=t?t.split("/").filter(Boolean):[],u=[{label:".",relPath:""}];let f="";for(const g of s)f=f?`${f}/${g}`:g,u.push({label:g,relPath:f});return u},[b]),se=i.useMemo(()=>{const t=(q||"").trim().toLowerCase(),s=t?C.filter(g=>(g.name||"").toLowerCase().includes(t)):C,u=ce==="asc"?1:-1;return[...s].sort((g,R)=>{if(g.isDir!==R.isDir)return g.isDir?-1:1;const F=(g.name||"").toLowerCase(),A=(R.name||"").toLowerCase();return F===A?0:F<A?-1*u:1*u})},[C,q,ce]);i.useEffect(()=>{if(!P)return;se.some(s=>ue(s,P))||(T(null),ae())},[se]);const En=t=>{if(e){if(Cn(t.target)){(t.ctrlKey||t.metaKey)&&(t.key==="f"||t.key==="F")&&(t.preventDefault(),ot());return}if((t.ctrlKey||t.metaKey)&&(t.key==="f"||t.key==="F")){t.preventDefault(),ot();return}if(t.key==="Escape"){t.preventDefault(),n();return}if(t.key==="Backspace"){t.preventDefault(),De();return}if(t.key==="ArrowDown"){t.preventDefault(),rt(1,se);return}if(t.key==="ArrowUp"){t.preventDefault(),rt(-1,se);return}if(t.key==="Enter"){if(t.preventDefault(),!P)return;P.isDir?tt(P):nt()}}},Rn=()=>nn(t=>t==="asc"?"desc":"asc"),Pn=ce==="asc"?ar:rr,Dn=()=>{if(!P)return a.jsx("div",{className:p.centerPlaceholder,children:"Select a file or folder."});if(P.isDir)return a.jsx("div",{className:p.centerPlaceholder,children:"Double-click a folder to enter it. Select to pick this folder."});if(rn)return a.jsxs("div",{className:p.inlineLoading,children:[a.jsx(Ae,{className:p.iconSpinSm}),a.jsx("span",{children:"Loading preview…"})]});if(Ye)return a.jsxs("div",{className:p.errorBox,children:[a.jsx(fe,{className:p.iconSm}),a.jsx("span",{children:Ye})]});if(!E||E.kind==="none"){const t=(E==null?void 0:E.note)||"No preview available.";return de(a.jsx("div",{className:p.centerPlaceholder,children:t}),E==null?void 0:E.meta)}if(E.kind==="error")return a.jsxs("div",{className:p.errorBox,children:[a.jsx(fe,{className:p.iconSm}),a.jsx("span",{children:E.message})]});if(E.kind==="text"){const t=E.text?a.jsx("div",{className:p.textPreviewBox,style:{height:"100%"},children:a.jsx("div",{style:{height:"100%",overflow:"auto",whiteSpace:"pre-wrap"},children:E.text})}):a.jsx("div",{className:p.centerPlaceholder,children:"No text preview available."});return de(t,E.meta)}if(E.kind==="table"){const t=a.jsx("div",{className:p.textPreviewBox,style:{height:"100%",padding:0},children:a.jsx("div",{style:{height:"100%",overflow:"auto"},children:a.jsxs("table",{style:{width:"100%",borderCollapse:"collapse",fontSize:12},children:[a.jsx("thead",{children:a.jsx("tr",{children:E.columns.map(s=>a.jsx("th",{style:{textAlign:"left",padding:"8px 10px",borderBottom:"1px solid rgba(148, 163, 184, 0.18)",position:"sticky",top:0,background:"rgba(15, 23, 42, 0.25)",backdropFilter:"blur(6px)",zIndex:1},children:s},s))})}),a.jsx("tbody",{children:E.rows.map((s,u)=>a.jsx("tr",{children:s.map((f,g)=>a.jsx("td",{style:{padding:"8px 10px",borderBottom:"1px solid rgba(148, 163, 184, 0.10)",whiteSpace:"nowrap",textOverflow:"ellipsis",overflow:"hidden",maxWidth:240},title:f===null?"":String(f),children:f===null?"":String(f)},g))},u))})]})})});return de(t,E.meta)}if(E.kind==="image"){const t=a.jsxs("div",{className:p.imageCanvas,children:[!je&&a.jsx("div",{className:p.centerPlaceholder,children:"No image preview available."}),!!je&&a.jsx("div",{className:p.imageFrameResponsive,children:a.jsx("img",{src:je,alt:P.name,className:p.previewImage})})]});return de(t,E.meta)}return a.jsx("div",{className:p.centerPlaceholder,children:"No preview available."})};return a.jsx(Oo,{open:e,onOpenChange:t=>{t||n()},children:a.jsxs(Zt,{container:on,tabIndex:-1,onKeyDown:En,onInteractOutside:t=>{t.preventDefault()},onClick:_n,className:[sn,cn,p.dialogContent,p.dialogLayout].join(" "),children:[a.jsxs(Qt,{className:p.headerBar,children:[a.jsx(en,{className:p.headerTitle,children:a.jsx("span",{className:p.headerTitleText,children:r})}),a.jsx(tn,{className:p.srOnly,children:"Remote file browser dialog. Use Enter/double-click to open folders, and Select to choose a file or folder."})]}),a.jsxs("div",{className:p.toolbar,children:[a.jsxs("button",{type:"button",onClick:De,className:p.ppChipBtn,disabled:at===null,children:[a.jsx(lr,{className:p.iconSm}),"Up"]}),a.jsxs("button",{type:"button",onClick:xn,className:p.ppChipBtn,children:[a.jsx(mr,{className:p.iconSm}),"Root"]}),l!=null&&a.jsxs("button",{type:"button",onClick:wn,className:p.ppChipBtn,title:"Back to the protocol start directory",children:[a.jsx(Te,{className:p.iconSm}),"Protocol folder"]}),a.jsxs("button",{type:"button",onClick:()=>void X(b||""),disabled:D,title:"Refresh this directory",className:p.ppChipBtn,children:[D?a.jsx(Ae,{className:p.iconSpinSm}):a.jsx(Qn,{className:p.iconSm}),"Refresh"]})]}),a.jsxs("div",{className:[p.bodyGrid,ln].join(" "),children:[a.jsxs("div",{className:p.panel,children:[a.jsxs("div",{className:p.panelHeader,children:[a.jsxs("div",{className:p.panelHeaderLeft,children:[a.jsx("div",{className:p.panelHeaderTitle,children:"Directory"}),a.jsx("div",{className:p.panelHeaderPath,style:{display:"flex",alignItems:"center",flexWrap:"wrap",gap:0,lineHeight:1.2},children:it.map((t,s)=>{const u=s===it.length-1;return a.jsxs(On.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>void X(t.relPath),disabled:D||!!v||u,title:t.relPath?`Go to ./${t.relPath}`:"Go to root",style:{border:"none",background:"transparent",padding:0,margin:0,cursor:u?"default":"pointer",color:"inherit",opacity:u?.9:.7,fontWeight:u?600:500},children:t.label}),!u&&a.jsx("span",{style:{opacity:.55,padding:"0 2px",userSelect:"none"},children:"/"})]},`${t.relPath}-${s}`)})})]}),v&&a.jsxs("span",{className:p.panelError,children:[a.jsx(fe,{className:p.iconXs}),a.jsx("span",{children:"Error"})]})]}),a.jsxs("div",{className:p.panelBody,children:[v&&a.jsxs("div",{className:p.errorBox,children:[a.jsx(fe,{className:p.iconSm}),a.jsx("span",{children:v})]}),!v&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{style:{padding:"10px 10px 0 10px",borderBottom:"1px solid rgba(148, 163, 184, 0.18)"},children:[a.jsxs("div",{style:{position:"relative",display:"flex",alignItems:"center"},children:[a.jsx(er,{className:p.iconSm,style:{position:"absolute",left:10,opacity:.7}}),a.jsx("input",{ref:ke,value:q,onChange:t=>V(t.target.value),placeholder:"Filter file names…","aria-label":"Filter file names",style:{width:"100%",paddingLeft:34,paddingRight:10,height:34,borderRadius:10,border:"1px solid rgba(148, 163, 184, 0.35)",background:"transparent",color:"inherit",outline:"none",fontSize:12}})]}),a.jsxs("div",{style:{marginTop:10,marginLeft:-10,marginRight:-10,padding:"8px 10px",display:"flex",alignItems:"center",justifyContent:"space-between",background:"rgba(148, 163, 184, 0.10)",borderTop:"1px solid rgba(148, 163, 184, 0.14)"},children:[a.jsx("div",{style:{fontSize:12,opacity:.85,fontWeight:600},children:"Name"}),a.jsx("button",{type:"button",onClick:Rn,title:ce==="asc"?"Ascending":"Descending",style:{display:"flex",alignItems:"center",justifyContent:"center",width:30,height:26,borderRadius:8,border:"1px solid rgba(148, 163, 184, 0.25)",background:"rgba(0,0,0,0)",color:"inherit",cursor:"pointer",opacity:.9},children:a.jsx(Pn,{className:p.iconSm})})]})]}),a.jsxs("ul",{className:p.list,children:[kn&&a.jsx("li",{className:p.listItem,children:(()=>{const t=ue(P,st);return a.jsxs("button",{className:[p.rowBtn,t?p.rowBtnSelected:""].join(" "),onClick:()=>Me(st),onDoubleClick:De,type:"button",title:"Double-click to go up",children:[a.jsx(Te,{className:p.iconSmMut}),a.jsx("span",{className:p.truncate,children:".."})]})})()},".."),D&&a.jsxs("li",{className:p.loadingRow,children:[a.jsx(Ae,{className:p.iconSpinSmMut}),a.jsx("span",{children:"Loading…"})]},"loading"),!D&&se.map(t=>{var f,g;const s=ue(P,t),u=`${(f=t.absPath)!=null?f:t.path}-${t.name}-${t.isDir?"d":"f"}`;return a.jsx("li",{className:p.listItem,children:a.jsx("button",{className:[p.rowBtn,s?p.rowBtnSelected:""].join(" "),onClick:()=>Me(t),onDoubleClick:()=>tt(t),type:"button",children:t.isDir?a.jsxs(a.Fragment,{children:[a.jsx(Te,{className:p.iconSmMut}),a.jsx("span",{className:p.truncate,children:t.name})]}):a.jsxs(a.Fragment,{children:[a.jsx(dr,{className:p.iconSmMut}),a.jsx("span",{className:p.truncate,children:t.name}),a.jsx("span",{className:p.fileSize,children:typeof t.size=="number"&&(g=Ze(t.size))!=null?g:""})]})})},u)})]})]})]})]}),a.jsx("div",{className:p.panel,children:a.jsx("div",{className:p.previewViewport+" "+un,children:Dn()})})]}),a.jsxs("div",{className:p.footer,children:[a.jsx("button",{type:"button",className:p.ppDialogBtn,onClick:n,children:"Close"}),a.jsx("button",{type:"button",className:[p.ppDialogBtn,p.ppDialogBtnPrimary].join(" "),onClick:nt,disabled:!P,children:"Select"})]})]})})}export{rr as A,ts as C,Oo as D,Te as F,wt as P,rs as R,Qa as S,es as a,Za as b,ar as c,Pt as d,St as e,dr as f,Zt as g,yo as h,Qt as i,en as j,tn as k,Ho as l,Mr as u};
