diff --git a/frontend/dist/assets/index-BQNVNq9u.js b/frontend/dist/assets/index-DfR6hR94.js similarity index 99% rename from frontend/dist/assets/index-BQNVNq9u.js rename to frontend/dist/assets/index-DfR6hR94.js index 4c75fa2..b4890b7 100644 --- a/frontend/dist/assets/index-BQNVNq9u.js +++ b/frontend/dist/assets/index-DfR6hR94.js @@ -78,7 +78,7 @@ No ACL entries`;const r=[`ACL (${a.length})`];for(const o of a){const s=o.name|| * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const Bk=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],Xg=Ou("x",Bk);var Jg=Gg();const ey=Ro(Jg);function _k(a){if(typeof document>"u")return;let r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css",r.appendChild(o),o.styleSheet?o.styleSheet.cssText=a:o.appendChild(document.createTextNode(a))}const Dk=a=>{switch(a){case"success":return Tk;case"info":return Nk;case"warning":return Pk;case"error":return Ik;default:return null}},Fk=Array(12).fill(0),Rk=({visible:a,className:r})=>pe.createElement("div",{className:["sonner-loading-wrapper",r].filter(Boolean).join(" "),"data-visible":a},pe.createElement("div",{className:"sonner-spinner"},Fk.map((o,s)=>pe.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${s}`})))),Tk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),Pk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),Nk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),Ik=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},pe.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),Mk=pe.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},pe.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),pe.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),Ok=()=>{const[a,r]=pe.useState(document.hidden);return pe.useEffect(()=>{const o=()=>{r(document.hidden)};return document.addEventListener("visibilitychange",o),()=>window.removeEventListener("visibilitychange",o)},[]),a};let ju=1;class Lk{constructor(){this.subscribe=r=>(this.subscribers.push(r),()=>{const o=this.subscribers.indexOf(r);this.subscribers.splice(o,1)}),this.publish=r=>{this.subscribers.forEach(o=>o(r))},this.addToast=r=>{this.publish(r),this.toasts=[...this.toasts,r]},this.create=r=>{var o;const{message:s,...u}=r,l=typeof(r==null?void 0:r.id)=="number"||((o=r.id)==null?void 0:o.length)>0?r.id:ju++,m=this.toasts.find(h=>h.id===l),c=r.dismissible===void 0?!0:r.dismissible;return this.dismissedToasts.has(l)&&this.dismissedToasts.delete(l),m?this.toasts=this.toasts.map(h=>h.id===l?(this.publish({...h,...r,id:l,title:s}),{...h,...r,id:l,dismissible:c,title:s}):h):this.addToast({title:s,...u,dismissible:c,id:l}),l},this.dismiss=r=>(r?(this.dismissedToasts.add(r),requestAnimationFrame(()=>this.subscribers.forEach(o=>o({id:r,dismiss:!0})))):this.toasts.forEach(o=>{this.subscribers.forEach(s=>s({id:o.id,dismiss:!0}))}),r),this.message=(r,o)=>this.create({...o,message:r}),this.error=(r,o)=>this.create({...o,message:r,type:"error"}),this.success=(r,o)=>this.create({...o,type:"success",message:r}),this.info=(r,o)=>this.create({...o,type:"info",message:r}),this.warning=(r,o)=>this.create({...o,type:"warning",message:r}),this.loading=(r,o)=>this.create({...o,type:"loading",message:r}),this.promise=(r,o)=>{if(!o)return;let s;o.loading!==void 0&&(s=this.create({...o,promise:r,type:"loading",message:o.loading,description:typeof o.description!="function"?o.description:void 0}));const u=Promise.resolve(r instanceof Function?r():r);let l=s!==void 0,m;const c=u.then(async d=>{if(m=["resolve",d],pe.isValidElement(d))l=!1,this.create({id:s,type:"default",message:d});else if(Vk(d)&&!d.ok){l=!1;const y=typeof o.error=="function"?await o.error(`HTTP error! status: ${d.status}`):o.error,f=typeof o.description=="function"?await o.description(`HTTP error! status: ${d.status}`):o.description,k=typeof y=="object"&&!pe.isValidElement(y)?y:{message:y};this.create({id:s,type:"error",description:f,...k})}else if(d instanceof Error){l=!1;const y=typeof o.error=="function"?await o.error(d):o.error,f=typeof o.description=="function"?await o.description(d):o.description,k=typeof y=="object"&&!pe.isValidElement(y)?y:{message:y};this.create({id:s,type:"error",description:f,...k})}else if(o.success!==void 0){l=!1;const y=typeof o.success=="function"?await o.success(d):o.success,f=typeof o.description=="function"?await o.description(d):o.description,k=typeof y=="object"&&!pe.isValidElement(y)?y:{message:y};this.create({id:s,type:"success",description:f,...k})}}).catch(async d=>{if(m=["reject",d],o.error!==void 0){l=!1;const g=typeof o.error=="function"?await o.error(d):o.error,y=typeof o.description=="function"?await o.description(d):o.description,w=typeof g=="object"&&!pe.isValidElement(g)?g:{message:g};this.create({id:s,type:"error",description:y,...w})}}).finally(()=>{l&&(this.dismiss(s),s=void 0),o.finally==null||o.finally.call(o)}),h=()=>new Promise((d,g)=>c.then(()=>m[0]==="reject"?g(m[1]):d(m[1])).catch(g));return typeof s!="string"&&typeof s!="number"?{unwrap:h}:Object.assign(s,{unwrap:h})},this.custom=(r,o)=>{const s=(o==null?void 0:o.id)||ju++;return this.create({jsx:r(s),id:s,...o}),s},this.getActiveToasts=()=>this.toasts.filter(r=>!this.dismissedToasts.has(r.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}}const na=new Lk,Hk=(a,r)=>{const o=(r==null?void 0:r.id)||ju++;return na.addToast({title:a,...r,id:o}),o},Vk=a=>a&&typeof a=="object"&&"ok"in a&&typeof a.ok=="boolean"&&"status"in a&&typeof a.status=="number",Uk=Hk,Wk=()=>na.toasts,$k=()=>na.getActiveToasts(),Pr=Object.assign(Uk,{success:na.success,info:na.info,warning:na.warning,error:na.error,custom:na.custom,message:na.message,promise:na.promise,dismiss:na.dismiss,loading:na.loading},{getHistory:Wk,getToasts:$k});_k("[data-sonner-toaster][dir=ltr],html[dir=ltr]{--toast-icon-margin-start:-3px;--toast-icon-margin-end:4px;--toast-svg-margin-start:-1px;--toast-svg-margin-end:0px;--toast-button-margin-start:auto;--toast-button-margin-end:0;--toast-close-button-start:0;--toast-close-button-end:unset;--toast-close-button-transform:translate(-35%, -35%)}[data-sonner-toaster][dir=rtl],html[dir=rtl]{--toast-icon-margin-start:4px;--toast-icon-margin-end:-3px;--toast-svg-margin-start:0px;--toast-svg-margin-end:-1px;--toast-button-margin-start:0;--toast-button-margin-end:auto;--toast-close-button-start:unset;--toast-close-button-end:0;--toast-close-button-transform:translate(35%, -35%)}[data-sonner-toaster]{position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1:hsl(0, 0%, 99%);--gray2:hsl(0, 0%, 97.3%);--gray3:hsl(0, 0%, 95.1%);--gray4:hsl(0, 0%, 93%);--gray5:hsl(0, 0%, 90.9%);--gray6:hsl(0, 0%, 88.7%);--gray7:hsl(0, 0%, 85.8%);--gray8:hsl(0, 0%, 78%);--gray9:hsl(0, 0%, 56.1%);--gray10:hsl(0, 0%, 52.3%);--gray11:hsl(0, 0%, 43.5%);--gray12:hsl(0, 0%, 9%);--border-radius:8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:0;z-index:999999999;transition:transform .4s ease}@media (hover:none) and (pointer:coarse){[data-sonner-toaster][data-lifted=true]{transform:none}}[data-sonner-toaster][data-x-position=right]{right:var(--offset-right)}[data-sonner-toaster][data-x-position=left]{left:var(--offset-left)}[data-sonner-toaster][data-x-position=center]{left:50%;transform:translateX(-50%)}[data-sonner-toaster][data-y-position=top]{top:var(--offset-top)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--offset-bottom)}[data-sonner-toast]{--y:translateY(100%);--lift-amount:calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:0;overflow-wrap:anywhere}[data-sonner-toast][data-styled=true]{padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px rgba(0,0,0,.1);width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}[data-sonner-toast]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-y-position=top]{top:0;--y:translateY(-100%);--lift:1;--lift-amount:calc(1 * var(--gap))}[data-sonner-toast][data-y-position=bottom]{bottom:0;--y:translateY(100%);--lift:-1;--lift-amount:calc(var(--lift) * var(--gap))}[data-sonner-toast][data-styled=true] [data-description]{font-weight:400;line-height:1.4;color:#3f3f3f}[data-rich-colors=true][data-sonner-toast][data-styled=true] [data-description]{color:inherit}[data-sonner-toaster][data-sonner-theme=dark] [data-description]{color:#e8e8e8}[data-sonner-toast][data-styled=true] [data-title]{font-weight:500;line-height:1.5;color:inherit}[data-sonner-toast][data-styled=true] [data-icon]{display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}[data-sonner-toast][data-promise=true] [data-icon]>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}[data-sonner-toast][data-styled=true] [data-icon]>*{flex-shrink:0}[data-sonner-toast][data-styled=true] [data-icon] svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}[data-sonner-toast][data-styled=true] [data-content]{display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;font-weight:500;cursor:pointer;outline:0;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}[data-sonner-toast][data-styled=true] [data-button]:focus-visible{box-shadow:0 0 0 2px rgba(0,0,0,.4)}[data-sonner-toast][data-styled=true] [data-button]:first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}[data-sonner-toast][data-styled=true] [data-cancel]{color:var(--normal-text);background:rgba(0,0,0,.08)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-styled=true] [data-cancel]{background:rgba(255,255,255,.3)}[data-sonner-toast][data-styled=true] [data-close-button]{position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);background:var(--normal-bg);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast][data-styled=true] [data-close-button]:focus-visible{box-shadow:0 4px 12px rgba(0,0,0,.1),0 0 0 2px rgba(0,0,0,.2)}[data-sonner-toast][data-styled=true] [data-disabled=true]{cursor:not-allowed}[data-sonner-toast][data-styled=true]:hover [data-close-button]:hover{background:var(--gray2);border-color:var(--gray5)}[data-sonner-toast][data-swiping=true]::before{content:'';position:absolute;left:-100%;right:-100%;height:100%;z-index:-1}[data-sonner-toast][data-y-position=top][data-swiping=true]::before{bottom:50%;transform:scaleY(3) translateY(50%)}[data-sonner-toast][data-y-position=bottom][data-swiping=true]::before{top:50%;transform:scaleY(3) translateY(-50%)}[data-sonner-toast][data-swiping=false][data-removed=true]::before{content:'';position:absolute;inset:0;transform:scaleY(2)}[data-sonner-toast][data-expanded=true]::after{content:'';position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}[data-sonner-toast][data-mounted=true]{--y:translateY(0);opacity:1}[data-sonner-toast][data-expanded=false][data-front=false]{--scale:var(--toasts-before) * 0.05 + 1;--y:translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}[data-sonner-toast]>*{transition:opacity .4s}[data-sonner-toast][data-x-position=right]{right:0}[data-sonner-toast][data-x-position=left]{left:0}[data-sonner-toast][data-expanded=false][data-front=false][data-styled=true]>*{opacity:0}[data-sonner-toast][data-visible=false]{opacity:0;pointer-events:none}[data-sonner-toast][data-mounted=true][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}[data-sonner-toast][data-removed=true][data-front=true][data-swipe-out=false]{--y:translateY(calc(var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=true]{--y:translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}[data-sonner-toast][data-removed=true][data-front=false][data-swipe-out=false][data-expanded=false]{--y:translateY(40%);opacity:0;transition:transform .5s,opacity .2s}[data-sonner-toast][data-removed=true][data-front=false]::before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y,0)) translateX(var(--swipe-amount-x,0));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{from{transform:var(--y) translateX(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translateX(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{from{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width:600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-sonner-theme=light]{--normal-bg:#fff;--normal-border:var(--gray4);--normal-text:var(--gray12);--success-bg:hsl(143, 85%, 96%);--success-border:hsl(145, 92%, 87%);--success-text:hsl(140, 100%, 27%);--info-bg:hsl(208, 100%, 97%);--info-border:hsl(221, 91%, 93%);--info-text:hsl(210, 92%, 45%);--warning-bg:hsl(49, 100%, 97%);--warning-border:hsl(49, 91%, 84%);--warning-text:hsl(31, 92%, 45%);--error-bg:hsl(359, 100%, 97%);--error-border:hsl(359, 100%, 94%);--error-text:hsl(360, 100%, 45%)}[data-sonner-toaster][data-sonner-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg:#000;--normal-border:hsl(0, 0%, 20%);--normal-text:var(--gray1)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg:#fff;--normal-border:var(--gray3);--normal-text:var(--gray12)}[data-sonner-toaster][data-sonner-theme=dark]{--normal-bg:#000;--normal-bg-hover:hsl(0, 0%, 12%);--normal-border:hsl(0, 0%, 20%);--normal-border-hover:hsl(0, 0%, 25%);--normal-text:var(--gray1);--success-bg:hsl(150, 100%, 6%);--success-border:hsl(147, 100%, 12%);--success-text:hsl(150, 86%, 65%);--info-bg:hsl(215, 100%, 6%);--info-border:hsl(223, 43%, 17%);--info-text:hsl(216, 87%, 65%);--warning-bg:hsl(64, 100%, 6%);--warning-border:hsl(60, 100%, 9%);--warning-text:hsl(46, 87%, 65%);--error-bg:hsl(358, 76%, 10%);--error-border:hsl(357, 89%, 16%);--error-text:hsl(358, 100%, 81%)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-sonner-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size:16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:first-child{animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}100%{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}100%{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}100%{opacity:.15}}@media (prefers-reduced-motion){.sonner-loading-bar,[data-sonner-toast],[data-sonner-toast]>*{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}");function Js(a){return a.label!==void 0}const Gk=3,Qk="24px",Kk="16px",Jm=4e3,Yk=356,Zk=14,Xk=45,Jk=200;function Ia(...a){return a.filter(Boolean).join(" ")}function ew(a){const[r,o]=a.split("-"),s=[];return r&&s.push(r),o&&s.push(o),s}const iw=a=>{var r,o,s,u,l,m,c,h,d;const{invert:g,toast:y,unstyled:f,interacting:w,setHeights:k,visibleToasts:x,heights:v,index:q,toasts:A,expanded:z,removeToast:_,defaultRichColors:C,closeButton:D,style:F,cancelButtonStyle:R,actionButtonStyle:M,className:P="",descriptionClassName:T="",duration:U,position:H,gap:K,expandByDefault:ie,classNames:Z,icons:ae,closeButtonAriaLabel:W="Close toast"}=a,[ne,X]=pe.useState(null),[j,I]=pe.useState(null),[L,$]=pe.useState(!1),[le,me]=pe.useState(!1),[ge,oe]=pe.useState(!1),[ce,je]=pe.useState(!1),[De,Pe]=pe.useState(!1),[ai,Re]=pe.useState(0),[He,Oe]=pe.useState(0),Je=pe.useRef(y.duration||U||Jm),Ge=pe.useRef(null),oi=pe.useRef(null),fi=q===0,ti=q+1<=x,Ve=y.type,hi=y.dismissible!==!1,Qi=y.className||"",ka=y.descriptionClassName||"",ji=pe.useMemo(()=>v.findIndex(Ae=>Ae.toastId===y.id)||0,[v,y.id]),Mi=pe.useMemo(()=>{var Ae;return(Ae=y.closeButton)!=null?Ae:D},[y.closeButton,D]),Ki=pe.useMemo(()=>y.duration||U||Jm,[y.duration,U]),oa=pe.useRef(0),wi=pe.useRef(0),ee=pe.useRef(0),he=pe.useRef(null),[Be,Ke]=H.split("-"),J=pe.useMemo(()=>v.reduce((Ae,Ze,li)=>li>=ji?Ae:Ae+Ze.height,0),[v,ji]),ue=Ok(),xe=y.invert||g,Le=Ve==="loading";wi.current=pe.useMemo(()=>ji*K+J,[ji,J]),pe.useEffect(()=>{Je.current=Ki},[Ki]),pe.useEffect(()=>{$(!0)},[]),pe.useEffect(()=>{const Ae=oi.current;if(Ae){const Ze=Ae.getBoundingClientRect().height;return Oe(Ze),k(li=>[{toastId:y.id,height:Ze,position:y.position},...li]),()=>k(li=>li.filter(gi=>gi.toastId!==y.id))}},[k,y.id]),pe.useLayoutEffect(()=>{if(!L)return;const Ae=oi.current,Ze=Ae.style.height;Ae.style.height="auto";const li=Ae.getBoundingClientRect().height;Ae.style.height=Ze,Oe(li),k(gi=>gi.find(Ie=>Ie.toastId===y.id)?gi.map(Ie=>Ie.toastId===y.id?{...Ie,height:li}:Ie):[{toastId:y.id,height:li,position:y.position},...gi])},[L,y.title,y.description,k,y.id,y.jsx,y.action,y.cancel]);const _e=pe.useCallback(()=>{me(!0),Re(wi.current),k(Ae=>Ae.filter(Ze=>Ze.toastId!==y.id)),setTimeout(()=>{_(y)},Jk)},[y,_,k,wi]);pe.useEffect(()=>{if(y.promise&&Ve==="loading"||y.duration===1/0||y.type==="loading")return;let Ae;return z||w||ue?(()=>{if(ee.current{Je.current!==1/0&&(oa.current=new Date().getTime(),Ae=setTimeout(()=>{y.onAutoClose==null||y.onAutoClose.call(y,y),_e()},Je.current))})(),()=>clearTimeout(Ae)},[z,w,y,Ve,ue,_e]),pe.useEffect(()=>{y.delete&&(_e(),y.onDismiss==null||y.onDismiss.call(y,y))},[_e,y.delete]);function Ye(){var Ae;if(ae!=null&&ae.loading){var Ze;return pe.createElement("div",{className:Ia(Z==null?void 0:Z.loader,y==null||(Ze=y.classNames)==null?void 0:Ze.loader,"sonner-loader"),"data-visible":Ve==="loading"},ae.loading)}return pe.createElement(Rk,{className:Ia(Z==null?void 0:Z.loader,y==null||(Ae=y.classNames)==null?void 0:Ae.loader),visible:Ve==="loading"})}const Ne=y.icon||(ae==null?void 0:ae[Ve])||Dk(Ve);var Ue,Wi;return pe.createElement("li",{tabIndex:0,ref:oi,className:Ia(P,Qi,Z==null?void 0:Z.toast,y==null||(r=y.classNames)==null?void 0:r.toast,Z==null?void 0:Z.default,Z==null?void 0:Z[Ve],y==null||(o=y.classNames)==null?void 0:o[Ve]),"data-sonner-toast":"","data-rich-colors":(Ue=y.richColors)!=null?Ue:C,"data-styled":!(y.jsx||y.unstyled||f),"data-mounted":L,"data-promise":!!y.promise,"data-swiped":De,"data-removed":le,"data-visible":ti,"data-y-position":Be,"data-x-position":Ke,"data-index":q,"data-front":fi,"data-swiping":ge,"data-dismissible":hi,"data-type":Ve,"data-invert":xe,"data-swipe-out":ce,"data-swipe-direction":j,"data-expanded":!!(z||ie&&L),"data-testid":y.testId,style:{"--index":q,"--toasts-before":q,"--z-index":A.length-q,"--offset":`${le?ai:wi.current}px`,"--initial-height":ie?"auto":`${He}px`,...F,...y.style},onDragEnd:()=>{oe(!1),X(null),he.current=null},onPointerDown:Ae=>{Ae.button!==2&&(Le||!hi||(Ge.current=new Date,Re(wi.current),Ae.target.setPointerCapture(Ae.pointerId),Ae.target.tagName!=="BUTTON"&&(oe(!0),he.current={x:Ae.clientX,y:Ae.clientY})))},onPointerUp:()=>{var Ae,Ze,li;if(ce||!hi)return;he.current=null;const gi=Number(((Ae=oi.current)==null?void 0:Ae.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),da=Number(((Ze=oi.current)==null?void 0:Ze.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),Ie=new Date().getTime()-((li=Ge.current)==null?void 0:li.getTime()),ri=ne==="x"?gi:da,wa=Math.abs(ri)/Ie;if(Math.abs(ri)>=Xk||wa>.11){Re(wi.current),y.onDismiss==null||y.onDismiss.call(y,y),I(ne==="x"?gi>0?"right":"left":da>0?"down":"up"),_e(),je(!0);return}else{var Xe,yi;(Xe=oi.current)==null||Xe.style.setProperty("--swipe-amount-x","0px"),(yi=oi.current)==null||yi.style.setProperty("--swipe-amount-y","0px")}Pe(!1),oe(!1),X(null)},onPointerMove:Ae=>{var Ze,li,gi;if(!he.current||!hi||((Ze=window.getSelection())==null?void 0:Ze.toString().length)>0)return;const Ie=Ae.clientY-he.current.y,ri=Ae.clientX-he.current.x;var wa;const Xe=(wa=a.swipeDirections)!=null?wa:ew(H);!ne&&(Math.abs(ri)>1||Math.abs(Ie)>1)&&X(Math.abs(ri)>Math.abs(Ie)?"x":"y");let yi={x:0,y:0};const xa=Yi=>1/(1.5+Math.abs(Yi)/20);if(ne==="y"){if(Xe.includes("top")||Xe.includes("bottom"))if(Xe.includes("top")&&Ie<0||Xe.includes("bottom")&&Ie>0)yi.y=Ie;else{const Yi=Ie*xa(Ie);yi.y=Math.abs(Yi)0)yi.x=ri;else{const Yi=ri*xa(ri);yi.x=Math.abs(Yi)0||Math.abs(yi.y)>0)&&Pe(!0),(li=oi.current)==null||li.style.setProperty("--swipe-amount-x",`${yi.x}px`),(gi=oi.current)==null||gi.style.setProperty("--swipe-amount-y",`${yi.y}px`)}},Mi&&!y.jsx&&Ve!=="loading"?pe.createElement("button",{"aria-label":W,"data-disabled":Le,"data-close-button":!0,onClick:Le||!hi?()=>{}:()=>{_e(),y.onDismiss==null||y.onDismiss.call(y,y)},className:Ia(Z==null?void 0:Z.closeButton,y==null||(s=y.classNames)==null?void 0:s.closeButton)},(Wi=ae==null?void 0:ae.close)!=null?Wi:Mk):null,(Ve||y.icon||y.promise)&&y.icon!==null&&((ae==null?void 0:ae[Ve])!==null||y.icon)?pe.createElement("div",{"data-icon":"",className:Ia(Z==null?void 0:Z.icon,y==null||(u=y.classNames)==null?void 0:u.icon)},y.promise||y.type==="loading"&&!y.icon?y.icon||Ye():null,y.type!=="loading"?Ne:null):null,pe.createElement("div",{"data-content":"",className:Ia(Z==null?void 0:Z.content,y==null||(l=y.classNames)==null?void 0:l.content)},pe.createElement("div",{"data-title":"",className:Ia(Z==null?void 0:Z.title,y==null||(m=y.classNames)==null?void 0:m.title)},y.jsx?y.jsx:typeof y.title=="function"?y.title():y.title),y.description?pe.createElement("div",{"data-description":"",className:Ia(T,ka,Z==null?void 0:Z.description,y==null||(c=y.classNames)==null?void 0:c.description)},typeof y.description=="function"?y.description():y.description):null),pe.isValidElement(y.cancel)?y.cancel:y.cancel&&Js(y.cancel)?pe.createElement("button",{"data-button":!0,"data-cancel":!0,style:y.cancelButtonStyle||R,onClick:Ae=>{Js(y.cancel)&&hi&&(y.cancel.onClick==null||y.cancel.onClick.call(y.cancel,Ae),_e())},className:Ia(Z==null?void 0:Z.cancelButton,y==null||(h=y.classNames)==null?void 0:h.cancelButton)},y.cancel.label):null,pe.isValidElement(y.action)?y.action:y.action&&Js(y.action)?pe.createElement("button",{"data-button":!0,"data-action":!0,style:y.actionButtonStyle||M,onClick:Ae=>{Js(y.action)&&(y.action.onClick==null||y.action.onClick.call(y.action,Ae),!Ae.defaultPrevented&&_e())},className:Ia(Z==null?void 0:Z.actionButton,y==null||(d=y.classNames)==null?void 0:d.actionButton)},y.action.label):null)};function eh(){if(typeof window>"u"||typeof document>"u")return"ltr";const a=document.documentElement.getAttribute("dir");return a==="auto"||!a?window.getComputedStyle(document.documentElement).direction:a}function aw(a,r){const o={};return[a,r].forEach((s,u)=>{const l=u===1,m=l?"--mobile-offset":"--offset",c=l?Kk:Qk;function h(d){["top","right","bottom","left"].forEach(g=>{o[`${m}-${g}`]=typeof d=="number"?`${d}px`:d})}typeof s=="number"||typeof s=="string"?h(s):typeof s=="object"?["top","right","bottom","left"].forEach(d=>{s[d]===void 0?o[`${m}-${d}`]=c:o[`${m}-${d}`]=typeof s[d]=="number"?`${s[d]}px`:s[d]}):h(c)}),o}const nw=pe.forwardRef(function(r,o){const{id:s,invert:u,position:l="bottom-right",hotkey:m=["altKey","KeyT"],expand:c,closeButton:h,className:d,offset:g,mobileOffset:y,theme:f="light",richColors:w,duration:k,style:x,visibleToasts:v=Gk,toastOptions:q,dir:A=eh(),gap:z=Zk,icons:_,containerAriaLabel:C="Notifications"}=r,[D,F]=pe.useState([]),R=pe.useMemo(()=>s?D.filter(L=>L.toasterId===s):D.filter(L=>!L.toasterId),[D,s]),M=pe.useMemo(()=>Array.from(new Set([l].concat(R.filter(L=>L.position).map(L=>L.position)))),[R,l]),[P,T]=pe.useState([]),[U,H]=pe.useState(!1),[K,ie]=pe.useState(!1),[Z,ae]=pe.useState(f!=="system"?f:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),W=pe.useRef(null),ne=m.join("+").replace(/Key/g,"").replace(/Digit/g,""),X=pe.useRef(null),j=pe.useRef(!1),I=pe.useCallback(L=>{F($=>{var le;return(le=$.find(me=>me.id===L.id))!=null&&le.delete||na.dismiss(L.id),$.filter(({id:me})=>me!==L.id)})},[]);return pe.useEffect(()=>na.subscribe(L=>{if(L.dismiss){requestAnimationFrame(()=>{F($=>$.map(le=>le.id===L.id?{...le,delete:!0}:le))});return}setTimeout(()=>{ey.flushSync(()=>{F($=>{const le=$.findIndex(me=>me.id===L.id);return le!==-1?[...$.slice(0,le),{...$[le],...L},...$.slice(le+1)]:[L,...$]})})})}),[D]),pe.useEffect(()=>{if(f!=="system"){ae(f);return}if(f==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?ae("dark"):ae("light")),typeof window>"u")return;const L=window.matchMedia("(prefers-color-scheme: dark)");try{L.addEventListener("change",({matches:$})=>{ae($?"dark":"light")})}catch{L.addListener(({matches:le})=>{try{ae(le?"dark":"light")}catch(me){console.error(me)}})}},[f]),pe.useEffect(()=>{D.length<=1&&H(!1)},[D]),pe.useEffect(()=>{const L=$=>{var le;if(m.every(oe=>$[oe]||$.code===oe)){var ge;H(!0),(ge=W.current)==null||ge.focus()}$.code==="Escape"&&(document.activeElement===W.current||(le=W.current)!=null&&le.contains(document.activeElement))&&H(!1)};return document.addEventListener("keydown",L),()=>document.removeEventListener("keydown",L)},[m]),pe.useEffect(()=>{if(W.current)return()=>{X.current&&(X.current.focus({preventScroll:!0}),X.current=null,j.current=!1)}},[W.current]),pe.createElement("section",{ref:o,"aria-label":`${C} ${ne}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},M.map((L,$)=>{var le;const[me,ge]=L.split("-");return R.length?pe.createElement("ol",{key:L,dir:A==="auto"?eh():A,tabIndex:-1,ref:W,className:d,"data-sonner-toaster":!0,"data-sonner-theme":Z,"data-y-position":me,"data-x-position":ge,style:{"--front-toast-height":`${((le=P[0])==null?void 0:le.height)||0}px`,"--width":`${Yk}px`,"--gap":`${z}px`,...x,...aw(g,y)},onBlur:oe=>{j.current&&!oe.currentTarget.contains(oe.relatedTarget)&&(j.current=!1,X.current&&(X.current.focus({preventScroll:!0}),X.current=null))},onFocus:oe=>{oe.target instanceof HTMLElement&&oe.target.dataset.dismissible==="false"||j.current||(j.current=!0,X.current=oe.relatedTarget)},onMouseEnter:()=>H(!0),onMouseMove:()=>H(!0),onMouseLeave:()=>{K||H(!1)},onDragEnd:()=>H(!1),onPointerDown:oe=>{oe.target instanceof HTMLElement&&oe.target.dataset.dismissible==="false"||ie(!0)},onPointerUp:()=>ie(!1)},R.filter(oe=>!oe.position&&$===0||oe.position===L).map((oe,ce)=>{var je,De;return pe.createElement(iw,{key:oe.id,icons:_,index:ce,toast:oe,defaultRichColors:w,duration:(je=q==null?void 0:q.duration)!=null?je:k,className:q==null?void 0:q.className,descriptionClassName:q==null?void 0:q.descriptionClassName,invert:u,visibleToasts:v,closeButton:(De=q==null?void 0:q.closeButton)!=null?De:h,interacting:K,position:L,style:q==null?void 0:q.style,unstyled:q==null?void 0:q.unstyled,classNames:q==null?void 0:q.classNames,cancelButtonStyle:q==null?void 0:q.cancelButtonStyle,actionButtonStyle:q==null?void 0:q.actionButtonStyle,closeButtonAriaLabel:q==null?void 0:q.closeButtonAriaLabel,removeToast:I,toasts:R.filter(Pe=>Pe.position==oe.position),heights:P.filter(Pe=>Pe.position==oe.position),setHeights:T,expandByDefault:c,gap:z,expanded:U,swipeDirections:r.swipeDirections})})):null}))}),ow=({...a})=>B.jsx(nw,{theme:"dark",className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-card group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground",error:"group-[.toaster]:bg-[#2a1a1a] group-[.toaster]:text-[#e8a0a0] group-[.toaster]:border-[#4a2a2a] [&_[data-description]]:text-[#b08080]"}},...a});function rw({health:a,config:r,onConfigClick:o,onAdvertise:s,onMenuClick:u}){const l=(a==null?void 0:a.radio_connected)??!1,[m,c]=E.useState(!1),h=async()=>{c(!0);try{const d=await ei.reconnectRadio();d.connected&&Pr.success("Reconnected",{description:d.message})}catch(d){Pr.error("Reconnection failed",{description:d instanceof Error?d.message:"Check radio connection and power"})}finally{c(!1)}};return B.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 bg-[#252525] border-b border-[#333] text-xs",children:[u&&B.jsx("button",{onClick:u,className:"md:hidden p-1 bg-transparent border-none text-[#e0e0e0] cursor-pointer","aria-label":"Open menu",children:B.jsx(Sk,{className:"h-5 w-5"})}),B.jsx("h1",{className:"hidden lg:block text-base font-semibold mr-auto",children:"RemoteTerm"}),B.jsxs("div",{className:"flex items-center gap-1 text-[#888]",children:[B.jsx("div",{className:`w-2 h-2 rounded-full ${l?"bg-[#4caf50]":"bg-[#666]"}`}),B.jsx("span",{className:"hidden lg:inline text-[#e0e0e0]",children:l?"Connected":"Disconnected"})]}),(a==null?void 0:a.serial_port)&&B.jsxs("div",{className:"hidden xl:flex items-center gap-1 text-[#888]",children:["Port: ",B.jsx("span",{className:"text-[#e0e0e0]",children:a.serial_port})]}),r&&B.jsxs(B.Fragment,{children:[B.jsx("div",{className:"hidden lg:flex items-center gap-1 text-[#888]",children:B.jsx("span",{className:"text-[#e0e0e0]",children:r.name||"Unnamed"})}),B.jsxs("div",{className:"hidden xl:flex items-center gap-1 text-[#888]",children:[r.radio.freq," MHz/SF",r.radio.sf,"/CR",r.radio.cr,"/",r.tx_power,"dBm"]})]}),B.jsx("div",{className:"flex-1 lg:hidden"}),!l&&B.jsx("button",{onClick:h,disabled:m,className:"px-3 py-1 bg-[#4a3000] border border-[#6b4500] text-[#ffa500] rounded text-xs cursor-pointer hover:bg-[#5a3a00] disabled:opacity-50 disabled:cursor-not-allowed",children:m?"Reconnecting...":"Reconnect"}),B.jsx("button",{onClick:s,disabled:!l,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444] disabled:bg-[#333] disabled:text-[#666] disabled:cursor-not-allowed",children:"Advertise"}),B.jsx("button",{onClick:o,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444]",children:"Config"})]})}const Au=2,sw={text:"🛜",background:"#444444",textColor:"#ffffff"};function tw(a){let r=0;for(let o=0;o>8)%30,u=35+(r>>16)%20,l=`hsl(${o}, ${s}%, ${u}%)`,m=u<45?"#ffffff":"#000000";return{background:l,text:m}}function dw(a,r,o){if(o===Au)return sw;const s=cw(a,r),u=uw(r);return{text:s,background:u.background,textColor:u.text}}function iy({name:a,publicKey:r,size:o=28,contactType:s}){const u=dw(a,r,s);return B.jsx("div",{className:"flex items-center justify-center rounded-full font-semibold flex-shrink-0 select-none",style:{backgroundColor:u.background,color:u.textColor,width:o,height:o,fontSize:o*.45},children:u.text})}function ay(a){var r,o,s="";if(typeof a=="string"||typeof a=="number")s+=a;else if(typeof a=="object")if(Array.isArray(a)){var u=a.length;for(r=0;r{const o=new Array(a.length+r.length);for(let s=0;s({classGroupId:a,validator:r}),oy=(a=new Map,r=null,o)=>({nextPart:a,validators:r,classGroupId:o}),Zt="-",ih=[],hw="arbitrary..",gw=a=>{const r=bw(a),{conflictingClassGroups:o,conflictingClassGroupModifiers:s}=a;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return yw(m);const c=m.split(Zt),h=c[0]===""&&c.length>1?1:0;return ry(c,h,r)},getConflictingClassGroupIds:(m,c)=>{if(c){const h=s[m],d=o[m];return h?d?pw(d,h):h:d||ih}return o[m]||ih}}},ry=(a,r,o)=>{if(a.length-r===0)return o.classGroupId;const u=a[r],l=o.nextPart.get(u);if(l){const d=ry(a,r+1,l);if(d)return d}const m=o.validators;if(m===null)return;const c=r===0?a.join(Zt):a.slice(r).join(Zt),h=m.length;for(let d=0;da.slice(1,-1).indexOf(":")===-1?void 0:(()=>{const r=a.slice(1,-1),o=r.indexOf(":"),s=r.slice(0,o);return s?hw+s:void 0})(),bw=a=>{const{theme:r,classGroups:o}=a;return fw(o,r)},fw=(a,r)=>{const o=oy();for(const s in a){const u=a[s];Lu(u,o,s,r)}return o},Lu=(a,r,o,s)=>{const u=a.length;for(let l=0;l{if(typeof a=="string"){kw(a,r,o);return}if(typeof a=="function"){ww(a,r,o,s);return}xw(a,r,o,s)},kw=(a,r,o)=>{const s=a===""?r:sy(r,a);s.classGroupId=o},ww=(a,r,o,s)=>{if(zw(a)){Lu(a(s),r,o,s);return}r.validators===null&&(r.validators=[]),r.validators.push(mw(o,a))},xw=(a,r,o,s)=>{const u=Object.entries(a),l=u.length;for(let m=0;m{let o=a;const s=r.split(Zt),u=s.length;for(let l=0;l"isThemeGetter"in a&&a.isThemeGetter===!0,qw=a=>{if(a<1)return{get:()=>{},set:()=>{}};let r=0,o=Object.create(null),s=Object.create(null);const u=(l,m)=>{o[l]=m,r++,r>a&&(r=0,s=o,o=Object.create(null))};return{get(l){let m=o[l];if(m!==void 0)return m;if((m=s[l])!==void 0)return u(l,m),m},set(l,m){l in o?o[l]=m:u(l,m)}}},Cu="!",ah=":",jw=[],nh=(a,r,o,s,u)=>({modifiers:a,hasImportantModifier:r,baseClassName:o,maybePostfixModifierPosition:s,isExternal:u}),Aw=a=>{const{prefix:r,experimentalParseClassName:o}=a;let s=u=>{const l=[];let m=0,c=0,h=0,d;const g=u.length;for(let x=0;xh?d-h:void 0;return nh(l,w,f,k)};if(r){const u=r+ah,l=s;s=m=>m.startsWith(u)?l(m.slice(u.length)):nh(jw,!1,m,void 0,!0)}if(o){const u=s;s=l=>o({className:l,parseClassName:u})}return s},Cw=a=>{const r=new Map;return a.orderSensitiveModifiers.forEach((o,s)=>{r.set(o,1e6+s)}),o=>{const s=[];let u=[];for(let l=0;l0&&(u.sort(),s.push(...u),u=[]),s.push(m)):u.push(m)}return u.length>0&&(u.sort(),s.push(...u)),s}},Ew=a=>({cache:qw(a.cacheSize),parseClassName:Aw(a),sortModifiers:Cw(a),...gw(a)}),Sw=/\s+/,Bw=(a,r)=>{const{parseClassName:o,getClassGroupId:s,getConflictingClassGroupIds:u,sortModifiers:l}=r,m=[],c=a.trim().split(Sw);let h="";for(let d=c.length-1;d>=0;d-=1){const g=c[d],{isExternal:y,modifiers:f,hasImportantModifier:w,baseClassName:k,maybePostfixModifierPosition:x}=o(g);if(y){h=g+(h.length>0?" "+h:h);continue}let v=!!x,q=s(v?k.substring(0,x):k);if(!q){if(!v){h=g+(h.length>0?" "+h:h);continue}if(q=s(k),!q){h=g+(h.length>0?" "+h:h);continue}v=!1}const A=f.length===0?"":f.length===1?f[0]:l(f).join(":"),z=w?A+Cu:A,_=z+q;if(m.indexOf(_)>-1)continue;m.push(_);const C=u(q,v);for(let D=0;D0?" "+h:h)}return h},_w=(...a)=>{let r=0,o,s,u="";for(;r{if(typeof a=="string")return a;let r,o="";for(let s=0;s{let o,s,u,l;const m=h=>{const d=r.reduce((g,y)=>y(g),a());return o=Ew(d),s=o.cache.get,u=o.cache.set,l=c,c(h)},c=h=>{const d=s(h);if(d)return d;const g=Bw(h,o);return u(h,g),g};return l=m,(...h)=>l(_w(...h))},Fw=[],Ei=a=>{const r=o=>o[a]||Fw;return r.isThemeGetter=!0,r},ly=/^\[(?:(\w[\w-]*):)?(.+)\]$/i,cy=/^\((?:(\w[\w-]*):)?(.+)\)$/i,Rw=/^\d+\/\d+$/,Tw=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,Pw=/\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$/,Nw=/^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/,Iw=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,Mw=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,qo=a=>Rw.test(a),Fe=a=>!!a&&!Number.isNaN(Number(a)),zn=a=>!!a&&Number.isInteger(Number(a)),lu=a=>a.endsWith("%")&&Fe(a.slice(0,-1)),Xa=a=>Tw.test(a),Ow=()=>!0,Lw=a=>Pw.test(a)&&!Nw.test(a),uy=()=>!1,Hw=a=>Iw.test(a),Vw=a=>Mw.test(a),Uw=a=>!ve(a)&&!ke(a),Ww=a=>To(a,my,uy),ve=a=>ly.test(a),Vn=a=>To(a,hy,Lw),cu=a=>To(a,Yw,Fe),oh=a=>To(a,dy,uy),$w=a=>To(a,py,Vw),et=a=>To(a,gy,Hw),ke=a=>cy.test(a),vr=a=>Po(a,hy),Gw=a=>Po(a,Zw),rh=a=>Po(a,dy),Qw=a=>Po(a,my),Kw=a=>Po(a,py),it=a=>Po(a,gy,!0),To=(a,r,o)=>{const s=ly.exec(a);return s?s[1]?r(s[1]):o(s[2]):!1},Po=(a,r,o=!1)=>{const s=cy.exec(a);return s?s[1]?r(s[1]):o:!1},dy=a=>a==="position"||a==="percentage",py=a=>a==="image"||a==="url",my=a=>a==="length"||a==="size"||a==="bg-size",hy=a=>a==="length",Yw=a=>a==="number",Zw=a=>a==="family-name",gy=a=>a==="shadow",Xw=()=>{const a=Ei("color"),r=Ei("font"),o=Ei("text"),s=Ei("font-weight"),u=Ei("tracking"),l=Ei("leading"),m=Ei("breakpoint"),c=Ei("container"),h=Ei("spacing"),d=Ei("radius"),g=Ei("shadow"),y=Ei("inset-shadow"),f=Ei("text-shadow"),w=Ei("drop-shadow"),k=Ei("blur"),x=Ei("perspective"),v=Ei("aspect"),q=Ei("ease"),A=Ei("animate"),z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],_=()=>["center","top","bottom","left","right","top-left","left-top","top-right","right-top","bottom-right","right-bottom","bottom-left","left-bottom"],C=()=>[..._(),ke,ve],D=()=>["auto","hidden","clip","visible","scroll"],F=()=>["auto","contain","none"],R=()=>[ke,ve,h],M=()=>[qo,"full","auto",...R()],P=()=>[zn,"none","subgrid",ke,ve],T=()=>["auto",{span:["full",zn,ke,ve]},zn,ke,ve],U=()=>[zn,"auto",ke,ve],H=()=>["auto","min","max","fr",ke,ve],K=()=>["start","end","center","between","around","evenly","stretch","baseline","center-safe","end-safe"],ie=()=>["start","end","center","stretch","center-safe","end-safe"],Z=()=>["auto",...R()],ae=()=>[qo,"auto","full","dvw","dvh","lvw","lvh","svw","svh","min","max","fit",...R()],W=()=>[a,ke,ve],ne=()=>[..._(),rh,oh,{position:[ke,ve]}],X=()=>["no-repeat",{repeat:["","x","y","space","round"]}],j=()=>["auto","cover","contain",Qw,Ww,{size:[ke,ve]}],I=()=>[lu,vr,Vn],L=()=>["","none","full",d,ke,ve],$=()=>["",Fe,vr,Vn],le=()=>["solid","dashed","dotted","double"],me=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ge=()=>[Fe,lu,rh,oh],oe=()=>["","none",k,ke,ve],ce=()=>["none",Fe,ke,ve],je=()=>["none",Fe,ke,ve],De=()=>[Fe,ke,ve],Pe=()=>[qo,"full",...R()];return{cacheSize:500,theme:{animate:["spin","ping","pulse","bounce"],aspect:["video"],blur:[Xa],breakpoint:[Xa],color:[Ow],container:[Xa],"drop-shadow":[Xa],ease:["in","out","in-out"],font:[Uw],"font-weight":["thin","extralight","light","normal","medium","semibold","bold","extrabold","black"],"inset-shadow":[Xa],leading:["none","tight","snug","normal","relaxed","loose"],perspective:["dramatic","near","normal","midrange","distant","none"],radius:[Xa],shadow:[Xa],spacing:["px",Fe],text:[Xa],"text-shadow":[Xa],tracking:["tighter","tight","normal","wide","wider","widest"]},classGroups:{aspect:[{aspect:["auto","square",qo,ve,ke,v]}],container:["container"],columns:[{columns:[Fe,ve,ke,c]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"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"],sr:["sr-only","not-sr-only"],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:C()}],overflow:[{overflow:D()}],"overflow-x":[{"overflow-x":D()}],"overflow-y":[{"overflow-y":D()}],overscroll:[{overscroll:F()}],"overscroll-x":[{"overscroll-x":F()}],"overscroll-y":[{"overscroll-y":F()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:M()}],"inset-x":[{"inset-x":M()}],"inset-y":[{"inset-y":M()}],start:[{start:M()}],end:[{end:M()}],top:[{top:M()}],right:[{right:M()}],bottom:[{bottom:M()}],left:[{left:M()}],visibility:["visible","invisible","collapse"],z:[{z:[zn,"auto",ke,ve]}],basis:[{basis:[qo,"full","auto",c,...R()]}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["nowrap","wrap","wrap-reverse"]}],flex:[{flex:[Fe,qo,"auto","initial","none",ve]}],grow:[{grow:["",Fe,ke,ve]}],shrink:[{shrink:["",Fe,ke,ve]}],order:[{order:[zn,"first","last","none",ke,ve]}],"grid-cols":[{"grid-cols":P()}],"col-start-end":[{col:T()}],"col-start":[{"col-start":U()}],"col-end":[{"col-end":U()}],"grid-rows":[{"grid-rows":P()}],"row-start-end":[{row:T()}],"row-start":[{"row-start":U()}],"row-end":[{"row-end":U()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":H()}],"auto-rows":[{"auto-rows":H()}],gap:[{gap:R()}],"gap-x":[{"gap-x":R()}],"gap-y":[{"gap-y":R()}],"justify-content":[{justify:[...K(),"normal"]}],"justify-items":[{"justify-items":[...ie(),"normal"]}],"justify-self":[{"justify-self":["auto",...ie()]}],"align-content":[{content:["normal",...K()]}],"align-items":[{items:[...ie(),{baseline:["","last"]}]}],"align-self":[{self:["auto",...ie(),{baseline:["","last"]}]}],"place-content":[{"place-content":K()}],"place-items":[{"place-items":[...ie(),"baseline"]}],"place-self":[{"place-self":["auto",...ie()]}],p:[{p:R()}],px:[{px:R()}],py:[{py:R()}],ps:[{ps:R()}],pe:[{pe:R()}],pt:[{pt:R()}],pr:[{pr:R()}],pb:[{pb:R()}],pl:[{pl:R()}],m:[{m:Z()}],mx:[{mx:Z()}],my:[{my:Z()}],ms:[{ms:Z()}],me:[{me:Z()}],mt:[{mt:Z()}],mr:[{mr:Z()}],mb:[{mb:Z()}],ml:[{ml:Z()}],"space-x":[{"space-x":R()}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":R()}],"space-y-reverse":["space-y-reverse"],size:[{size:ae()}],w:[{w:[c,"screen",...ae()]}],"min-w":[{"min-w":[c,"screen","none",...ae()]}],"max-w":[{"max-w":[c,"screen","none","prose",{screen:[m]},...ae()]}],h:[{h:["screen","lh",...ae()]}],"min-h":[{"min-h":["screen","lh","none",...ae()]}],"max-h":[{"max-h":["screen","lh",...ae()]}],"font-size":[{text:["base",o,vr,Vn]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:[s,ke,cu]}],"font-stretch":[{"font-stretch":["ultra-condensed","extra-condensed","condensed","semi-condensed","normal","semi-expanded","expanded","extra-expanded","ultra-expanded",lu,ve]}],"font-family":[{font:[Gw,ve,r]}],"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:[u,ke,ve]}],"line-clamp":[{"line-clamp":[Fe,"none",ke,cu]}],leading:[{leading:[l,...R()]}],"list-image":[{"list-image":["none",ke,ve]}],"list-style-position":[{list:["inside","outside"]}],"list-style-type":[{list:["disc","decimal","none",ke,ve]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"placeholder-color":[{placeholder:W()}],"text-color":[{text:W()}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...le(),"wavy"]}],"text-decoration-thickness":[{decoration:[Fe,"from-font","auto",ke,Vn]}],"text-decoration-color":[{decoration:W()}],"underline-offset":[{"underline-offset":[Fe,"auto",ke,ve]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:R()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",ke,ve]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],wrap:[{wrap:["break-word","anywhere","normal"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",ke,ve]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:ne()}],"bg-repeat":[{bg:X()}],"bg-size":[{bg:j()}],"bg-image":[{bg:["none",{linear:[{to:["t","tr","r","br","b","bl","l","tl"]},zn,ke,ve],radial:["",ke,ve],conic:[zn,ke,ve]},Kw,$w]}],"bg-color":[{bg:W()}],"gradient-from-pos":[{from:I()}],"gradient-via-pos":[{via:I()}],"gradient-to-pos":[{to:I()}],"gradient-from":[{from:W()}],"gradient-via":[{via:W()}],"gradient-to":[{to:W()}],rounded:[{rounded:L()}],"rounded-s":[{"rounded-s":L()}],"rounded-e":[{"rounded-e":L()}],"rounded-t":[{"rounded-t":L()}],"rounded-r":[{"rounded-r":L()}],"rounded-b":[{"rounded-b":L()}],"rounded-l":[{"rounded-l":L()}],"rounded-ss":[{"rounded-ss":L()}],"rounded-se":[{"rounded-se":L()}],"rounded-ee":[{"rounded-ee":L()}],"rounded-es":[{"rounded-es":L()}],"rounded-tl":[{"rounded-tl":L()}],"rounded-tr":[{"rounded-tr":L()}],"rounded-br":[{"rounded-br":L()}],"rounded-bl":[{"rounded-bl":L()}],"border-w":[{border:$()}],"border-w-x":[{"border-x":$()}],"border-w-y":[{"border-y":$()}],"border-w-s":[{"border-s":$()}],"border-w-e":[{"border-e":$()}],"border-w-t":[{"border-t":$()}],"border-w-r":[{"border-r":$()}],"border-w-b":[{"border-b":$()}],"border-w-l":[{"border-l":$()}],"divide-x":[{"divide-x":$()}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":$()}],"divide-y-reverse":["divide-y-reverse"],"border-style":[{border:[...le(),"hidden","none"]}],"divide-style":[{divide:[...le(),"hidden","none"]}],"border-color":[{border:W()}],"border-color-x":[{"border-x":W()}],"border-color-y":[{"border-y":W()}],"border-color-s":[{"border-s":W()}],"border-color-e":[{"border-e":W()}],"border-color-t":[{"border-t":W()}],"border-color-r":[{"border-r":W()}],"border-color-b":[{"border-b":W()}],"border-color-l":[{"border-l":W()}],"divide-color":[{divide:W()}],"outline-style":[{outline:[...le(),"none","hidden"]}],"outline-offset":[{"outline-offset":[Fe,ke,ve]}],"outline-w":[{outline:["",Fe,vr,Vn]}],"outline-color":[{outline:W()}],shadow:[{shadow:["","none",g,it,et]}],"shadow-color":[{shadow:W()}],"inset-shadow":[{"inset-shadow":["none",y,it,et]}],"inset-shadow-color":[{"inset-shadow":W()}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:W()}],"ring-offset-w":[{"ring-offset":[Fe,Vn]}],"ring-offset-color":[{"ring-offset":W()}],"inset-ring-w":[{"inset-ring":$()}],"inset-ring-color":[{"inset-ring":W()}],"text-shadow":[{"text-shadow":["none",f,it,et]}],"text-shadow-color":[{"text-shadow":W()}],opacity:[{opacity:[Fe,ke,ve]}],"mix-blend":[{"mix-blend":[...me(),"plus-darker","plus-lighter"]}],"bg-blend":[{"bg-blend":me()}],"mask-clip":[{"mask-clip":["border","padding","content","fill","stroke","view"]},"mask-no-clip"],"mask-composite":[{mask:["add","subtract","intersect","exclude"]}],"mask-image-linear-pos":[{"mask-linear":[Fe]}],"mask-image-linear-from-pos":[{"mask-linear-from":ge()}],"mask-image-linear-to-pos":[{"mask-linear-to":ge()}],"mask-image-linear-from-color":[{"mask-linear-from":W()}],"mask-image-linear-to-color":[{"mask-linear-to":W()}],"mask-image-t-from-pos":[{"mask-t-from":ge()}],"mask-image-t-to-pos":[{"mask-t-to":ge()}],"mask-image-t-from-color":[{"mask-t-from":W()}],"mask-image-t-to-color":[{"mask-t-to":W()}],"mask-image-r-from-pos":[{"mask-r-from":ge()}],"mask-image-r-to-pos":[{"mask-r-to":ge()}],"mask-image-r-from-color":[{"mask-r-from":W()}],"mask-image-r-to-color":[{"mask-r-to":W()}],"mask-image-b-from-pos":[{"mask-b-from":ge()}],"mask-image-b-to-pos":[{"mask-b-to":ge()}],"mask-image-b-from-color":[{"mask-b-from":W()}],"mask-image-b-to-color":[{"mask-b-to":W()}],"mask-image-l-from-pos":[{"mask-l-from":ge()}],"mask-image-l-to-pos":[{"mask-l-to":ge()}],"mask-image-l-from-color":[{"mask-l-from":W()}],"mask-image-l-to-color":[{"mask-l-to":W()}],"mask-image-x-from-pos":[{"mask-x-from":ge()}],"mask-image-x-to-pos":[{"mask-x-to":ge()}],"mask-image-x-from-color":[{"mask-x-from":W()}],"mask-image-x-to-color":[{"mask-x-to":W()}],"mask-image-y-from-pos":[{"mask-y-from":ge()}],"mask-image-y-to-pos":[{"mask-y-to":ge()}],"mask-image-y-from-color":[{"mask-y-from":W()}],"mask-image-y-to-color":[{"mask-y-to":W()}],"mask-image-radial":[{"mask-radial":[ke,ve]}],"mask-image-radial-from-pos":[{"mask-radial-from":ge()}],"mask-image-radial-to-pos":[{"mask-radial-to":ge()}],"mask-image-radial-from-color":[{"mask-radial-from":W()}],"mask-image-radial-to-color":[{"mask-radial-to":W()}],"mask-image-radial-shape":[{"mask-radial":["circle","ellipse"]}],"mask-image-radial-size":[{"mask-radial":[{closest:["side","corner"],farthest:["side","corner"]}]}],"mask-image-radial-pos":[{"mask-radial-at":_()}],"mask-image-conic-pos":[{"mask-conic":[Fe]}],"mask-image-conic-from-pos":[{"mask-conic-from":ge()}],"mask-image-conic-to-pos":[{"mask-conic-to":ge()}],"mask-image-conic-from-color":[{"mask-conic-from":W()}],"mask-image-conic-to-color":[{"mask-conic-to":W()}],"mask-mode":[{mask:["alpha","luminance","match"]}],"mask-origin":[{"mask-origin":["border","padding","content","fill","stroke","view"]}],"mask-position":[{mask:ne()}],"mask-repeat":[{mask:X()}],"mask-size":[{mask:j()}],"mask-type":[{"mask-type":["alpha","luminance"]}],"mask-image":[{mask:["none",ke,ve]}],filter:[{filter:["","none",ke,ve]}],blur:[{blur:oe()}],brightness:[{brightness:[Fe,ke,ve]}],contrast:[{contrast:[Fe,ke,ve]}],"drop-shadow":[{"drop-shadow":["","none",w,it,et]}],"drop-shadow-color":[{"drop-shadow":W()}],grayscale:[{grayscale:["",Fe,ke,ve]}],"hue-rotate":[{"hue-rotate":[Fe,ke,ve]}],invert:[{invert:["",Fe,ke,ve]}],saturate:[{saturate:[Fe,ke,ve]}],sepia:[{sepia:["",Fe,ke,ve]}],"backdrop-filter":[{"backdrop-filter":["","none",ke,ve]}],"backdrop-blur":[{"backdrop-blur":oe()}],"backdrop-brightness":[{"backdrop-brightness":[Fe,ke,ve]}],"backdrop-contrast":[{"backdrop-contrast":[Fe,ke,ve]}],"backdrop-grayscale":[{"backdrop-grayscale":["",Fe,ke,ve]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[Fe,ke,ve]}],"backdrop-invert":[{"backdrop-invert":["",Fe,ke,ve]}],"backdrop-opacity":[{"backdrop-opacity":[Fe,ke,ve]}],"backdrop-saturate":[{"backdrop-saturate":[Fe,ke,ve]}],"backdrop-sepia":[{"backdrop-sepia":["",Fe,ke,ve]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":R()}],"border-spacing-x":[{"border-spacing-x":R()}],"border-spacing-y":[{"border-spacing-y":R()}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["","all","colors","opacity","shadow","transform","none",ke,ve]}],"transition-behavior":[{transition:["normal","discrete"]}],duration:[{duration:[Fe,"initial",ke,ve]}],ease:[{ease:["linear","initial",q,ke,ve]}],delay:[{delay:[Fe,ke,ve]}],animate:[{animate:["none",A,ke,ve]}],backface:[{backface:["hidden","visible"]}],perspective:[{perspective:[x,ke,ve]}],"perspective-origin":[{"perspective-origin":C()}],rotate:[{rotate:ce()}],"rotate-x":[{"rotate-x":ce()}],"rotate-y":[{"rotate-y":ce()}],"rotate-z":[{"rotate-z":ce()}],scale:[{scale:je()}],"scale-x":[{"scale-x":je()}],"scale-y":[{"scale-y":je()}],"scale-z":[{"scale-z":je()}],"scale-3d":["scale-3d"],skew:[{skew:De()}],"skew-x":[{"skew-x":De()}],"skew-y":[{"skew-y":De()}],transform:[{transform:[ke,ve,"","none","gpu","cpu"]}],"transform-origin":[{origin:C()}],"transform-style":[{transform:["3d","flat"]}],translate:[{translate:Pe()}],"translate-x":[{"translate-x":Pe()}],"translate-y":[{"translate-y":Pe()}],"translate-z":[{"translate-z":Pe()}],"translate-none":["translate-none"],accent:[{accent:W()}],appearance:[{appearance:["none","auto"]}],"caret-color":[{caret:W()}],"color-scheme":[{scheme:["normal","dark","light","light-dark","only-dark","only-light"]}],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",ke,ve]}],"field-sizing":[{"field-sizing":["fixed","content"]}],"pointer-events":[{"pointer-events":["auto","none"]}],resize:[{resize:["none","","y","x"]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":R()}],"scroll-mx":[{"scroll-mx":R()}],"scroll-my":[{"scroll-my":R()}],"scroll-ms":[{"scroll-ms":R()}],"scroll-me":[{"scroll-me":R()}],"scroll-mt":[{"scroll-mt":R()}],"scroll-mr":[{"scroll-mr":R()}],"scroll-mb":[{"scroll-mb":R()}],"scroll-ml":[{"scroll-ml":R()}],"scroll-p":[{"scroll-p":R()}],"scroll-px":[{"scroll-px":R()}],"scroll-py":[{"scroll-py":R()}],"scroll-ps":[{"scroll-ps":R()}],"scroll-pe":[{"scroll-pe":R()}],"scroll-pt":[{"scroll-pt":R()}],"scroll-pr":[{"scroll-pr":R()}],"scroll-pb":[{"scroll-pb":R()}],"scroll-pl":[{"scroll-pl":R()}],"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",ke,ve]}],fill:[{fill:["none",...W()]}],"stroke-w":[{stroke:[Fe,vr,Vn,cu]}],stroke:[{stroke:["none",...W()]}],"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-x","border-w-y","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-x","border-color-y","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"],translate:["translate-x","translate-y","translate-none"],"translate-none":["translate","translate-x","translate-y","translate-z"],"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"]},orderSensitiveModifiers:["*","**","after","backdrop","before","details-content","file","first-letter","first-line","marker","placeholder","selection"]}},Jw=Dw(Xw);function $e(...a){return Jw(ny(a))}const qi=E.forwardRef(({className:a,type:r,...o},s)=>B.jsx("input",{type:r,className:$e("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background 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-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",a),ref:s,...o}));qi.displayName="Input";function sh(a,r){if(typeof a=="function")return a(r);a!=null&&(a.current=r)}function Lr(...a){return r=>{let o=!1;const s=a.map(u=>{const l=sh(u,r);return!o&&typeof l=="function"&&(o=!0),l});if(o)return()=>{for(let u=0;u{let{children:l,...m}=s;yy(l)&&typeof Xt=="function"&&(l=Xt(l._payload));const c=E.Children.toArray(l),h=c.find(rx);if(h){const d=h.props.children,g=c.map(y=>y===h?E.Children.count(d)>1?E.Children.only(null):E.isValidElement(d)?d.props.children:null:y);return B.jsx(r,{...m,ref:u,children:E.isValidElement(d)?E.cloneElement(d,void 0,g):null})}return B.jsx(r,{...m,ref:u,children:l})});return o.displayName=`${a}.Slot`,o}var ax=Hu("Slot");function nx(a){const r=E.forwardRef((o,s)=>{let{children:u,...l}=o;if(yy(u)&&typeof Xt=="function"&&(u=Xt(u._payload)),E.isValidElement(u)){const m=tx(u),c=sx(l,u.props);return u.type!==E.Fragment&&(c.ref=s?Lr(s,m):m),E.cloneElement(u,c)}return E.Children.count(u)>1?E.Children.only(null):null});return r.displayName=`${a}.SlotClone`,r}var ox=Symbol("radix.slottable");function rx(a){return E.isValidElement(a)&&typeof a.type=="function"&&"__radixId"in a.type&&a.type.__radixId===ox}function sx(a,r){const o={...r};for(const s in r){const u=a[s],l=r[s];/^on[A-Z]/.test(s)?u&&l?o[s]=(...c)=>{const h=l(...c);return u(...c),h}:u&&(o[s]=u):s==="style"?o[s]={...u,...l}:s==="className"&&(o[s]=[u,l].filter(Boolean).join(" "))}return{...a,...o}}function tx(a){var s,u;let r=(s=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:s.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?a.ref:(r=(u=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:u.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?a.props.ref:a.props.ref||a.ref)}const th=a=>typeof a=="boolean"?`${a}`:a===0?"0":a,lh=ny,rl=(a,r)=>o=>{var s;if((r==null?void 0:r.variants)==null)return lh(a,o==null?void 0:o.class,o==null?void 0:o.className);const{variants:u,defaultVariants:l}=r,m=Object.keys(u).map(d=>{const g=o==null?void 0:o[d],y=l==null?void 0:l[d];if(g===null)return null;const f=th(g)||th(y);return u[d][f]}),c=o&&Object.entries(o).reduce((d,g)=>{let[y,f]=g;return f===void 0||(d[y]=f),d},{}),h=r==null||(s=r.compoundVariants)===null||s===void 0?void 0:s.reduce((d,g)=>{let{class:y,className:f,...w}=g;return Object.entries(w).every(k=>{let[x,v]=k;return Array.isArray(v)?v.includes({...l,...c}[x]):{...l,...c}[x]===v})?[...d,y,f]:d},[]);return lh(a,m,h,o==null?void 0:o.class,o==null?void 0:o.className)},lx=rl("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Ha=E.forwardRef(({className:a,variant:r,size:o,asChild:s=!1,...u},l)=>{const m=s?ax:"button";return B.jsx(m,{className:$e(lx({variant:r,size:o,className:a})),ref:l,...u})});Ha.displayName="Button";function cx(){try{return localStorage.getItem("remoteterm-sortOrder")==="alpha"?"alpha":"recent"}catch{return"recent"}}function ux(a){try{localStorage.setItem("remoteterm-sortOrder",a)}catch{}}function dx({contacts:a,channels:r,activeConversation:o,onSelectConversation:s,onNewMessage:u,lastMessageTimes:l,unreadCounts:m,showCracker:c,crackerRunning:h,onToggleCracker:d,onMarkAllRead:g}){const[y,f]=E.useState(cx),[w,k]=E.useState(""),x=()=>{const T=y==="alpha"?"recent":"alpha";f(T),ux(T)},v=T=>{k(""),s(T)},q=(T,U)=>(o==null?void 0:o.type)===T&&(o==null?void 0:o.id)===U,A=(T,U)=>{const H=fa(T,U);return m[H]||0},z=(T,U)=>{const H=fa(T,U);return l[H]||0},_=r.reduce((T,U)=>(T.some(H=>H.name===U.name)||T.push(U),T),[]),C=a.filter(T=>T.public_key&&T.public_key.length>0).sort((T,U)=>T.name&&!U.name?-1:!T.name&&U.name?1:(T.name||"").localeCompare(U.name||"")).reduce((T,U)=>{const H=_o(U.public_key);return T.some(K=>_o(K.public_key)===H)||T.push(U),T},[]),D=[..._].sort((T,U)=>{if(T.name==="Public")return-1;if(U.name==="Public")return 1;if(y==="recent"){const H=z("channel",T.key),K=z("channel",U.key);if(H&&K)return K-H;if(H&&!K)return-1;if(!H&&K)return 1}return T.name.localeCompare(U.name)}),F=[...C].sort((T,U)=>{const H=T.type===Au,K=U.type===Au;if(H&&!K)return 1;if(!H&&K)return-1;if(H&&K)return(T.name||T.public_key).localeCompare(U.name||U.public_key);if(y==="recent"){const ie=z("contact",T.public_key),Z=z("contact",U.public_key);if(ie&&Z)return Z-ie;if(ie&&!Z)return-1;if(!ie&&Z)return 1}return(T.name||T.public_key).localeCompare(U.name||U.public_key)}),R=w.toLowerCase().trim(),M=R?D.filter(T=>T.name.toLowerCase().includes(R)):D,P=R?F.filter(T=>{var U;return((U=T.name)==null?void 0:U.toLowerCase().includes(R))||T.public_key.toLowerCase().includes(R)}):F;return B.jsxs("div",{className:"sidebar w-60 h-full min-h-0 bg-card border-r border-border flex flex-col",children:[B.jsxs("div",{className:"flex justify-between items-center px-3 py-3 border-b border-border",children:[B.jsx("h2",{className:"text-xs uppercase text-muted-foreground font-medium",children:"Conversations"}),B.jsx(Ha,{variant:"ghost",size:"sm",onClick:u,title:"New Message",className:"h-6 w-6 p-0 text-muted-foreground hover:text-foreground",children:"+"})]}),B.jsxs("div",{className:"relative px-3 py-2 border-b border-border",children:[B.jsx(qi,{type:"text",placeholder:"Search...",value:w,onChange:T=>k(T.target.value),className:"h-8 text-sm pr-8"}),w&&B.jsx("button",{className:"absolute right-4 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground text-lg leading-none",onClick:()=>k(""),title:"Clear search",children:"×"})]}),B.jsxs("div",{className:"flex-1 overflow-y-auto",children:[!R&&B.jsxs("div",{className:$e("px-3 py-2.5 cursor-pointer flex items-center gap-2 border-l-2 border-transparent hover:bg-accent",q("raw","raw")&&"bg-accent border-l-primary"),onClick:()=>v({type:"raw",id:"raw",name:"Raw Packet Feed"}),children:[B.jsx("span",{className:"text-muted-foreground text-xs",children:"📡"}),B.jsx("span",{className:"flex-1 truncate",children:"Packet Feed"})]}),!R&&B.jsxs("div",{className:$e("px-3 py-2.5 cursor-pointer flex items-center gap-2 border-l-2 border-transparent hover:bg-accent",c&&"bg-accent border-l-primary"),onClick:d,children:[B.jsx("span",{className:"text-muted-foreground text-xs",children:"🔓"}),B.jsxs("span",{className:"flex-1 truncate",children:[c?"Hide":"Show"," Cracker",B.jsxs("span",{className:$e("ml-1 text-xs",h?"text-green-500":"text-muted-foreground"),children:["(",h?"running":"stopped",")"]})]})]}),!R&&Object.keys(m).length>0&&B.jsxs("div",{className:"px-3 py-2.5 cursor-pointer flex items-center gap-2 border-l-2 border-transparent hover:bg-accent",onClick:g,children:[B.jsx("span",{className:"text-muted-foreground text-xs",children:"✓"}),B.jsx("span",{className:"flex-1 truncate text-muted-foreground",children:"Mark all as read"})]}),M.length>0&&B.jsxs(B.Fragment,{children:[B.jsxs("div",{className:"flex justify-between items-center px-3 py-2 pt-3",children:[B.jsx("span",{className:"text-[11px] uppercase text-muted-foreground",children:"Channels"}),B.jsx("button",{className:"bg-transparent border border-border text-muted-foreground px-1.5 py-0.5 text-[10px] rounded hover:bg-accent hover:text-foreground",onClick:x,title:y==="alpha"?"Sort by recent":"Sort alphabetically",children:y==="alpha"?"A-Z":"⏱"})]}),M.map(T=>{const U=A("channel",T.key);return B.jsxs("div",{className:$e("px-3 py-2.5 cursor-pointer flex items-center gap-2 border-l-2 border-transparent hover:bg-accent",q("channel",T.key)&&"bg-accent border-l-primary",U>0&&"[&_.name]:font-bold [&_.name]:text-foreground"),onClick:()=>v({type:"channel",id:T.key,name:T.name}),children:[B.jsx("span",{className:"text-muted-foreground text-xs",children:"#"}),B.jsx("span",{className:"name flex-1 truncate",children:T.name}),U>0&&B.jsx("span",{className:"bg-primary text-primary-foreground text-[10px] font-semibold px-1.5 py-0.5 rounded-full min-w-[18px] text-center",children:U})]},`chan-${T.key}`)})]}),P.length>0&&B.jsxs(B.Fragment,{children:[B.jsxs("div",{className:"flex justify-between items-center px-3 py-2 pt-3",children:[B.jsx("span",{className:"text-[11px] uppercase text-muted-foreground",children:"Contacts"}),M.length===0&&B.jsx("button",{className:"bg-transparent border border-border text-muted-foreground px-1.5 py-0.5 text-[10px] rounded hover:bg-accent hover:text-foreground",onClick:x,title:y==="alpha"?"Sort by recent":"Sort alphabetically",children:y==="alpha"?"A-Z":"⏱"})]}),P.map(T=>{const U=A("contact",T.public_key);return B.jsxs("div",{className:$e("px-3 py-2.5 cursor-pointer flex items-center gap-2 border-l-2 border-transparent hover:bg-accent",q("contact",T.public_key)&&"bg-accent border-l-primary",U>0&&"[&_.name]:font-bold [&_.name]:text-foreground"),onClick:()=>v({type:"contact",id:T.public_key,name:Yn(T.name,T.public_key)}),children:[B.jsx(iy,{name:T.name,publicKey:T.public_key,size:24,contactType:T.type}),B.jsx("span",{className:"name flex-1 truncate",children:Yn(T.name,T.public_key)}),U>0&&B.jsx("span",{className:"bg-primary text-primary-foreground text-[10px] font-semibold px-1.5 py-0.5 rounded-full min-w-[18px] text-center",children:U})]},T.public_key)})]}),P.length===0&&M.length===0&&B.jsx("div",{className:"p-5 text-center text-muted-foreground",children:R?"No matches found":"No conversations yet"})]})]})}function ch(a){const r=a.indexOf(": ");if(r>0&&r<50){const o=a.substring(0,r);if(!o.includes(":"))return{sender:o,content:a.substring(r+2)}}return{sender:null,content:a}}function uh(a){const r=new Date(a*1e3),o=new Date,s=r.toDateString()===o.toDateString(),u=r.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});return s?u:`${r.toLocaleDateString([],{month:"short",day:"numeric"})} ${u}`}function px(a,r){if(!r)return a;const o=/@\[([^\]]+)\]/g,s=[];let u=0,l,m=0;for(;(l=o.exec(a))!==null;){l.index>u&&s.push(a.slice(u,l.index));const c=l[1],h=c===r;s.push(B.jsxs("span",{className:$e("rounded px-0.5",h?"bg-primary/30 text-primary font-medium":"bg-muted-foreground/20"),children:["@[",c,"]"]},m++)),u=l.index+l[0].length}return u0?s:a}function mx({messages:a,contacts:r,loading:o,loadingOlder:s=!1,hasOlderMessages:u=!1,onSenderClick:l,onLoadOlder:m,radioName:c}){const h=E.useRef(null),d=E.useRef(0),g=E.useRef(!0),[y,f]=E.useState(!1),w=E.useRef({scrollTop:0,scrollHeight:0,wasNearTop:!1});E.useLayoutEffect(()=>{if(!h.current)return;const C=h.current,D=a.length-d.current;if(g.current&&a.length>0)C.scrollTop=C.scrollHeight,g.current=!1;else if(D>0&&d.current>0){const F=C.scrollHeight-w.current.scrollHeight;w.current.wasNearTop&&F>0?C.scrollTop=w.current.scrollTop+F:w.current.wasNearTop||(C.scrollTop=C.scrollHeight)}d.current=a.length},[a]),E.useEffect(()=>{a.length===0&&(g.current=!0,d.current=0,w.current={scrollTop:0,scrollHeight:0,wasNearTop:!1})},[a.length]);const k=E.useCallback(()=>{if(!h.current)return;const{scrollTop:C,scrollHeight:D,clientHeight:F}=h.current;w.current={scrollTop:C,scrollHeight:D,wasNearTop:C<150};const R=D-C-F;f(R>100),!(!m||s||!u)&&C<100&&m()},[m,s,u]),x=E.useCallback(()=>{h.current&&(h.current.scrollTop=h.current.scrollHeight)},[]),v=C=>C&&r.find(D=>Kg(D.public_key,C))||null,q=C=>r.find(D=>D.name===C)||null;if(o)return B.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-center text-muted-foreground",children:"Loading messages..."});if(a.length===0)return B.jsx("div",{className:"flex-1 overflow-y-auto p-5 text-center text-muted-foreground",children:"No messages yet"});const z=[...a.reduce((C,D)=>{const F=`${D.type}-${D.conversation_key}-${D.text}-${D.sender_timestamp}`;return C.find(M=>`${M.type}-${M.conversation_key}-${M.text}-${M.sender_timestamp}`===F)||C.push(D),C},[])].sort((C,D)=>C.received_at-D.received_at),_=(C,D)=>C.outgoing?"__outgoing__":C.type==="PRIV"&&C.conversation_key?C.conversation_key:D||"__unknown__";return B.jsxs("div",{className:"flex-1 overflow-hidden relative",children:[B.jsxs("div",{className:"h-full overflow-y-auto p-4 flex flex-col gap-0.5",ref:h,onScroll:k,children:[s&&B.jsx("div",{className:"text-center py-2 text-muted-foreground text-sm",children:"Loading older messages..."}),!s&&u&&B.jsx("div",{className:"text-center py-2 text-muted-foreground text-xs",children:"Scroll up for older messages"}),z.map((C,D)=>{var X;const F=C.type==="PRIV"?v(C.conversation_key):null,R=(F==null?void 0:F.type)===Qg,{sender:M,content:P}=R?{sender:null,content:C.text}:ch(C.text),T=C.outgoing?"You":(F==null?void 0:F.name)||M||((X=C.conversation_key)==null?void 0:X.slice(0,8))||"Unknown",U=!C.outgoing&&l&&T!=="Unknown",H=_(C,M),K=z[D-1],ie=K?_(K,ch(K.text).sender):null,Z=!C.outgoing&&H!==ie,ae=D===0;let W=null,ne="";if(!C.outgoing){if(C.type==="PRIV"&&C.conversation_key)W=(F==null?void 0:F.name)||null,ne=C.conversation_key;else if(M){const j=q(M);W=M,ne=(j==null?void 0:j.public_key)||`name:${M}`}}return B.jsxs("div",{className:$e("flex items-start max-w-[85%]",C.outgoing&&"flex-row-reverse self-end",Z&&!ae&&"mt-3"),children:[!C.outgoing&&B.jsx("div",{className:"w-10 flex-shrink-0 flex items-start pt-0.5",children:Z&&ne&&B.jsx(iy,{name:W,publicKey:ne,size:32})}),B.jsxs("div",{className:$e("py-1.5 px-3 rounded-lg min-w-0",C.outgoing?"bg-[#1e3a29]":"bg-muted"),children:[Z&&B.jsxs("div",{className:"text-[13px] font-semibold text-muted-foreground mb-0.5",children:[U?B.jsx("span",{className:"cursor-pointer hover:text-primary hover:underline",onClick:()=>l(T),title:`Mention ${T}`,children:T}):T,B.jsx("span",{className:"font-normal text-muted-foreground/70 ml-2 text-[11px]",children:uh(C.sender_timestamp||C.received_at)})]}),B.jsxs("div",{className:"break-words whitespace-pre-wrap",children:[P.split(` -`).map((j,I,L)=>B.jsxs("span",{children:[px(j,c),I0?` ✓${C.acked>1?C.acked:""}`:" ?")]})]})]},C.id)})]}),y&&B.jsx("button",{onClick:x,className:"absolute bottom-4 right-4 w-10 h-10 rounded-full bg-muted hover:bg-accent border border-border flex items-center justify-center shadow-lg transition-opacity",title:"Scroll to bottom",children:B.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:B.jsx("polyline",{points:"6 9 12 15 18 9"})})})]})}const hx=E.forwardRef(function({onSend:r,disabled:o,placeholder:s,isRepeaterMode:u},l){const[m,c]=E.useState(""),[h,d]=E.useState(!1),g=E.useRef(null);E.useImperativeHandle(l,()=>({appendText:k=>{var x;c(v=>v+k),(x=g.current)==null||x.focus()}}));const y=E.useCallback(async k=>{k.preventDefault();const x=m.trim();if(u){if(h||o)return;const v=x==="."?"":x;d(!0);try{await r(v),c("")}catch(q){console.error("Failed to request telemetry:",q);return}finally{d(!1)}setTimeout(()=>{var q;return(q=g.current)==null?void 0:q.focus()},0)}else{if(!x||h||o)return;d(!0);try{await r(x),c("")}catch(v){console.error("Failed to send message:",v);return}finally{d(!1)}setTimeout(()=>{var v;return(v=g.current)==null?void 0:v.focus()},0)}},[m,h,o,r,u]),f=E.useCallback(k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),y(k))},[y]),w=u?m.trim().length>0||m===".":m.trim().length>0;return B.jsxs("form",{className:"px-4 py-3 border-t border-border flex gap-2",onSubmit:y,children:[B.jsx(qi,{ref:g,type:u?"password":"text",value:m,onChange:k=>c(k.target.value),onKeyDown:f,placeholder:s||(u?"Enter password (or . for none)...":"Type a message..."),disabled:o||h,className:"flex-1"}),B.jsx(Ha,{type:"submit",disabled:o||h||!w,children:h?u?"Fetching...":"Sending...":u?"Fetch":"Send"})]})});function Si(a,r,{checkForDefaultPrevented:o=!0}={}){return function(u){if(a==null||a(u),o===!1||!u.defaultPrevented)return r==null?void 0:r(u)}}function gx(a,r){const o=E.createContext(r),s=l=>{const{children:m,...c}=l,h=E.useMemo(()=>c,Object.values(c));return B.jsx(o.Provider,{value:h,children:m})};s.displayName=a+"Provider";function u(l){const m=E.useContext(o);if(m)return m;if(r!==void 0)return r;throw new Error(`\`${l}\` must be used within \`${a}\``)}return[s,u]}function Hr(a,r=[]){let o=[];function s(l,m){const c=E.createContext(m),h=o.length;o=[...o,m];const d=y=>{var q;const{scope:f,children:w,...k}=y,x=((q=f==null?void 0:f[a])==null?void 0:q[h])||c,v=E.useMemo(()=>k,Object.values(k));return B.jsx(x.Provider,{value:v,children:w})};d.displayName=l+"Provider";function g(y,f){var x;const w=((x=f==null?void 0:f[a])==null?void 0:x[h])||c,k=E.useContext(w);if(k)return k;if(m!==void 0)return m;throw new Error(`\`${y}\` must be used within \`${l}\``)}return[d,g]}const u=()=>{const l=o.map(m=>E.createContext(m));return function(c){const h=(c==null?void 0:c[a])||l;return E.useMemo(()=>({[`__scope${a}`]:{...c,[a]:h}}),[c,h])}};return u.scopeName=a,[s,yx(u,...r)]}function yx(...a){const r=a[0];if(a.length===1)return r;const o=()=>{const s=a.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(l){const m=s.reduce((c,{useScope:h,scopeName:d})=>{const y=h(l)[`__scope${d}`];return{...c,...y}},{});return E.useMemo(()=>({[`__scope${r.scopeName}`]:m}),[m])}};return o.scopeName=r.scopeName,o}var Do=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},bx=Mu[" useId ".trim().toString()]||(()=>{}),fx=0;function Nr(a){const[r,o]=E.useState(bx());return Do(()=>{o(s=>s??String(fx++))},[a]),r?`radix-${r}`:""}var vx=Mu[" useInsertionEffect ".trim().toString()]||Do;function sl({prop:a,defaultProp:r,onChange:o=()=>{},caller:s}){const[u,l,m]=kx({defaultProp:r,onChange:o}),c=a!==void 0,h=c?a:u;{const g=E.useRef(a!==void 0);E.useEffect(()=>{const y=g.current;y!==c&&console.warn(`${s} is changing from ${y?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=c},[c,s])}const d=E.useCallback(g=>{var y;if(c){const f=wx(g)?g(a):g;f!==a&&((y=m.current)==null||y.call(m,f))}else l(g)},[c,a,l,m]);return[h,d]}function kx({defaultProp:a,onChange:r}){const[o,s]=E.useState(a),u=E.useRef(o),l=E.useRef(r);return vx(()=>{l.current=r},[r]),E.useEffect(()=>{var m;u.current!==o&&((m=l.current)==null||m.call(l,o),u.current=o)},[o,u]),[o,s,l]}function wx(a){return typeof a=="function"}function xx(a){const r=zx(a),o=E.forwardRef((s,u)=>{const{children:l,...m}=s,c=E.Children.toArray(l),h=c.find(jx);if(h){const d=h.props.children,g=c.map(y=>y===h?E.Children.count(d)>1?E.Children.only(null):E.isValidElement(d)?d.props.children:null:y);return B.jsx(r,{...m,ref:u,children:E.isValidElement(d)?E.cloneElement(d,void 0,g):null})}return B.jsx(r,{...m,ref:u,children:l})});return o.displayName=`${a}.Slot`,o}function zx(a){const r=E.forwardRef((o,s)=>{const{children:u,...l}=o;if(E.isValidElement(u)){const m=Cx(u),c=Ax(l,u.props);return u.type!==E.Fragment&&(c.ref=s?Lr(s,m):m),E.cloneElement(u,c)}return E.Children.count(u)>1?E.Children.only(null):null});return r.displayName=`${a}.SlotClone`,r}var qx=Symbol("radix.slottable");function jx(a){return E.isValidElement(a)&&typeof a.type=="function"&&"__radixId"in a.type&&a.type.__radixId===qx}function Ax(a,r){const o={...r};for(const s in r){const u=a[s],l=r[s];/^on[A-Z]/.test(s)?u&&l?o[s]=(...c)=>{const h=l(...c);return u(...c),h}:u&&(o[s]=u):s==="style"?o[s]={...u,...l}:s==="className"&&(o[s]=[u,l].filter(Boolean).join(" "))}return{...a,...o}}function Cx(a){var s,u;let r=(s=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:s.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?a.ref:(r=(u=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:u.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?a.props.ref:a.props.ref||a.ref)}var Ex=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Fi=Ex.reduce((a,r)=>{const o=xx(`Primitive.${r}`),s=E.forwardRef((u,l)=>{const{asChild:m,...c}=u,h=m?o:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),B.jsx(h,{...c,ref:l})});return s.displayName=`Primitive.${r}`,{...a,[r]:s}},{});function Sx(a,r){a&&Jg.flushSync(()=>a.dispatchEvent(r))}function Fo(a){const r=E.useRef(a);return E.useEffect(()=>{r.current=a}),E.useMemo(()=>(...o)=>{var s;return(s=r.current)==null?void 0:s.call(r,...o)},[])}function Bx(a,r=globalThis==null?void 0:globalThis.document){const o=Fo(a);E.useEffect(()=>{const s=u=>{u.key==="Escape"&&o(u)};return r.addEventListener("keydown",s,{capture:!0}),()=>r.removeEventListener("keydown",s,{capture:!0})},[o,r])}var _x="DismissableLayer",Eu="dismissableLayer.update",Dx="dismissableLayer.pointerDownOutside",Fx="dismissableLayer.focusOutside",dh,by=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fy=E.forwardRef((a,r)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onInteractOutside:m,onDismiss:c,...h}=a,d=E.useContext(by),[g,y]=E.useState(null),f=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=E.useState({}),k=va(r,F=>y(F)),x=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),q=x.indexOf(v),A=g?x.indexOf(g):-1,z=d.layersWithOutsidePointerEventsDisabled.size>0,_=A>=q,C=Px(F=>{const R=F.target,M=[...d.branches].some(P=>P.contains(R));!_||M||(u==null||u(F),m==null||m(F),F.defaultPrevented||c==null||c())},f),D=Nx(F=>{const R=F.target;[...d.branches].some(P=>P.contains(R))||(l==null||l(F),m==null||m(F),F.defaultPrevented||c==null||c())},f);return Bx(F=>{A===d.layers.size-1&&(s==null||s(F),!F.defaultPrevented&&c&&(F.preventDefault(),c()))},f),E.useEffect(()=>{if(g)return o&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(dh=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(g)),d.layers.add(g),ph(),()=>{o&&d.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=dh)}},[g,f,o,d]),E.useEffect(()=>()=>{g&&(d.layers.delete(g),d.layersWithOutsidePointerEventsDisabled.delete(g),ph())},[g,d]),E.useEffect(()=>{const F=()=>w({});return document.addEventListener(Eu,F),()=>document.removeEventListener(Eu,F)},[]),B.jsx(Fi.div,{...h,ref:k,style:{pointerEvents:z?_?"auto":"none":void 0,...a.style},onFocusCapture:Si(a.onFocusCapture,D.onFocusCapture),onBlurCapture:Si(a.onBlurCapture,D.onBlurCapture),onPointerDownCapture:Si(a.onPointerDownCapture,C.onPointerDownCapture)})});fy.displayName=_x;var Rx="DismissableLayerBranch",Tx=E.forwardRef((a,r)=>{const o=E.useContext(by),s=E.useRef(null),u=va(r,s);return E.useEffect(()=>{const l=s.current;if(l)return o.branches.add(l),()=>{o.branches.delete(l)}},[o.branches]),B.jsx(Fi.div,{...a,ref:u})});Tx.displayName=Rx;function Px(a,r=globalThis==null?void 0:globalThis.document){const o=Fo(a),s=E.useRef(!1),u=E.useRef(()=>{});return E.useEffect(()=>{const l=c=>{if(c.target&&!s.current){let h=function(){vy(Dx,o,d,{discrete:!0})};const d={originalEvent:c};c.pointerType==="touch"?(r.removeEventListener("click",u.current),u.current=h,r.addEventListener("click",u.current,{once:!0})):h()}else r.removeEventListener("click",u.current);s.current=!1},m=window.setTimeout(()=>{r.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(m),r.removeEventListener("pointerdown",l),r.removeEventListener("click",u.current)}},[r,o]),{onPointerDownCapture:()=>s.current=!0}}function Nx(a,r=globalThis==null?void 0:globalThis.document){const o=Fo(a),s=E.useRef(!1);return E.useEffect(()=>{const u=l=>{l.target&&!s.current&&vy(Fx,o,{originalEvent:l},{discrete:!1})};return r.addEventListener("focusin",u),()=>r.removeEventListener("focusin",u)},[r,o]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function ph(){const a=new CustomEvent(Eu);document.dispatchEvent(a)}function vy(a,r,o,{discrete:s}){const u=o.originalEvent.target,l=new CustomEvent(a,{bubbles:!1,cancelable:!0,detail:o});r&&u.addEventListener(a,r,{once:!0}),s?Sx(u,l):u.dispatchEvent(l)}var uu="focusScope.autoFocusOnMount",du="focusScope.autoFocusOnUnmount",mh={bubbles:!1,cancelable:!0},Ix="FocusScope",ky=E.forwardRef((a,r)=>{const{loop:o=!1,trapped:s=!1,onMountAutoFocus:u,onUnmountAutoFocus:l,...m}=a,[c,h]=E.useState(null),d=Fo(u),g=Fo(l),y=E.useRef(null),f=va(r,x=>h(x)),w=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(s){let x=function(z){if(w.paused||!c)return;const _=z.target;c.contains(_)?y.current=_:qn(y.current,{select:!0})},v=function(z){if(w.paused||!c)return;const _=z.relatedTarget;_!==null&&(c.contains(_)||qn(y.current,{select:!0}))},q=function(z){if(document.activeElement===document.body)for(const C of z)C.removedNodes.length>0&&qn(c)};document.addEventListener("focusin",x),document.addEventListener("focusout",v);const A=new MutationObserver(q);return c&&A.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",v),A.disconnect()}}},[s,c,w.paused]),E.useEffect(()=>{if(c){gh.add(w);const x=document.activeElement;if(!c.contains(x)){const q=new CustomEvent(uu,mh);c.addEventListener(uu,d),c.dispatchEvent(q),q.defaultPrevented||(Mx(Ux(wy(c)),{select:!0}),document.activeElement===x&&qn(c))}return()=>{c.removeEventListener(uu,d),setTimeout(()=>{const q=new CustomEvent(du,mh);c.addEventListener(du,g),c.dispatchEvent(q),q.defaultPrevented||qn(x??document.body,{select:!0}),c.removeEventListener(du,g),gh.remove(w)},0)}}},[c,d,g,w]);const k=E.useCallback(x=>{if(!o&&!s||w.paused)return;const v=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,q=document.activeElement;if(v&&q){const A=x.currentTarget,[z,_]=Ox(A);z&&_?!x.shiftKey&&q===_?(x.preventDefault(),o&&qn(z,{select:!0})):x.shiftKey&&q===z&&(x.preventDefault(),o&&qn(_,{select:!0})):q===A&&x.preventDefault()}},[o,s,w.paused]);return B.jsx(Fi.div,{tabIndex:-1,...m,ref:f,onKeyDown:k})});ky.displayName=Ix;function Mx(a,{select:r=!1}={}){const o=document.activeElement;for(const s of a)if(qn(s,{select:r}),document.activeElement!==o)return}function Ox(a){const r=wy(a),o=hh(r,a),s=hh(r.reverse(),a);return[o,s]}function wy(a){const r=[],o=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const u=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||u?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;o.nextNode();)r.push(o.currentNode);return r}function hh(a,r){for(const o of a)if(!Lx(o,{upTo:r}))return o}function Lx(a,{upTo:r}){if(getComputedStyle(a).visibility==="hidden")return!0;for(;a;){if(r!==void 0&&a===r)return!1;if(getComputedStyle(a).display==="none")return!0;a=a.parentElement}return!1}function Hx(a){return a instanceof HTMLInputElement&&"select"in a}function qn(a,{select:r=!1}={}){if(a&&a.focus){const o=document.activeElement;a.focus({preventScroll:!0}),a!==o&&Hx(a)&&r&&a.select()}}var gh=Vx();function Vx(){let a=[];return{add(r){const o=a[0];r!==o&&(o==null||o.pause()),a=yh(a,r),a.unshift(r)},remove(r){var o;a=yh(a,r),(o=a[0])==null||o.resume()}}}function yh(a,r){const o=[...a],s=o.indexOf(r);return s!==-1&&o.splice(s,1),o}function Ux(a){return a.filter(r=>r.tagName!=="A")}var Wx="Portal",xy=E.forwardRef((a,r)=>{var c;const{container:o,...s}=a,[u,l]=E.useState(!1);Do(()=>l(!0),[]);const m=o||u&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return m?ey.createPortal(B.jsx(Fi.div,{...s,ref:r}),m):null});xy.displayName=Wx;function $x(a,r){return E.useReducer((o,s)=>r[o][s]??o,a)}var No=a=>{const{present:r,children:o}=a,s=Gx(r),u=typeof o=="function"?o({present:s.isPresent}):E.Children.only(o),l=va(s.ref,Qx(u));return typeof o=="function"||s.isPresent?E.cloneElement(u,{ref:l}):null};No.displayName="Presence";function Gx(a){const[r,o]=E.useState(),s=E.useRef(null),u=E.useRef(a),l=E.useRef("none"),m=a?"mounted":"unmounted",[c,h]=$x(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const d=at(s.current);l.current=c==="mounted"?d:"none"},[c]),Do(()=>{const d=s.current,g=u.current;if(g!==a){const f=l.current,w=at(d);a?h("MOUNT"):w==="none"||(d==null?void 0:d.display)==="none"?h("UNMOUNT"):h(g&&f!==w?"ANIMATION_OUT":"UNMOUNT"),u.current=a}},[a,h]),Do(()=>{if(r){let d;const g=r.ownerDocument.defaultView??window,y=w=>{const x=at(s.current).includes(CSS.escape(w.animationName));if(w.target===r&&x&&(h("ANIMATION_END"),!u.current)){const v=r.style.animationFillMode;r.style.animationFillMode="forwards",d=g.setTimeout(()=>{r.style.animationFillMode==="forwards"&&(r.style.animationFillMode=v)})}},f=w=>{w.target===r&&(l.current=at(s.current))};return r.addEventListener("animationstart",f),r.addEventListener("animationcancel",y),r.addEventListener("animationend",y),()=>{g.clearTimeout(d),r.removeEventListener("animationstart",f),r.removeEventListener("animationcancel",y),r.removeEventListener("animationend",y)}}else h("ANIMATION_END")},[r,h]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:E.useCallback(d=>{s.current=d?getComputedStyle(d):null,o(d)},[])}}function at(a){return(a==null?void 0:a.animationName)||"none"}function Qx(a){var s,u;let r=(s=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:s.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?a.ref:(r=(u=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:u.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?a.props.ref:a.props.ref||a.ref)}var pu=0;function Kx(){E.useEffect(()=>{const a=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",a[0]??bh()),document.body.insertAdjacentElement("beforeend",a[1]??bh()),pu++,()=>{pu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),pu--}},[])}function bh(){const a=document.createElement("span");return a.setAttribute("data-radix-focus-guard",""),a.tabIndex=0,a.style.outline="none",a.style.opacity="0",a.style.position="fixed",a.style.pointerEvents="none",a}var La=function(){return La=Object.assign||function(r){for(var o,s=1,u=arguments.length;s"u")return pz;var r=mz(a),o=document.documentElement.clientWidth,s=window.innerWidth;return{left:r[0],top:r[1],right:r[2],gap:Math.max(0,s-o+r[2]-r[0])}},gz=Ay(),So="data-scroll-locked",yz=function(a,r,o,s){var u=a.left,l=a.top,m=a.right,c=a.gap;return o===void 0&&(o="margin"),` +`).map((j,I,L)=>B.jsxs("span",{children:[px(j,c),I0?` ✓${C.acked>1?C.acked:""}`:" ?")]})]})]},C.id)})]}),y&&B.jsx("button",{onClick:x,className:"absolute bottom-4 right-4 w-10 h-10 rounded-full bg-muted hover:bg-accent border border-border flex items-center justify-center shadow-lg transition-opacity",title:"Scroll to bottom",children:B.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:B.jsx("polyline",{points:"6 9 12 15 18 9"})})})]})}const hx=E.forwardRef(function({onSend:r,disabled:o,placeholder:s,isRepeaterMode:u},l){const[m,c]=E.useState(""),[h,d]=E.useState(!1),g=E.useRef(null);E.useImperativeHandle(l,()=>({appendText:k=>{var x;c(v=>v+k),(x=g.current)==null||x.focus()}}));const y=E.useCallback(async k=>{k.preventDefault();const x=m.trim();if(u){if(h||o)return;const v=x==="."?"":x;d(!0);try{await r(v),c("")}catch(q){console.error("Failed to request telemetry:",q);return}finally{d(!1)}setTimeout(()=>{var q;return(q=g.current)==null?void 0:q.focus()},0)}else{if(!x||h||o)return;d(!0);try{await r(x),c("")}catch(v){console.error("Failed to send message:",v);return}finally{d(!1)}setTimeout(()=>{var v;return(v=g.current)==null?void 0:v.focus()},0)}},[m,h,o,r,u]),f=E.useCallback(k=>{k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),y(k))},[y]),w=u?m.trim().length>0||m===".":m.trim().length>0;return B.jsxs("form",{className:"px-4 py-3 border-t border-border flex gap-2",onSubmit:y,children:[B.jsx(qi,{ref:g,type:u?"password":"text",value:m,onChange:k=>c(k.target.value),onKeyDown:f,placeholder:s||(u?"Enter password (or . for none)...":"Type a message..."),disabled:o||h,className:"flex-1 min-w-0"}),B.jsx(Ha,{type:"submit",disabled:o||h||!w,className:"flex-shrink-0",children:h?u?"Fetching...":"Sending...":u?"Fetch":"Send"})]})});function Si(a,r,{checkForDefaultPrevented:o=!0}={}){return function(u){if(a==null||a(u),o===!1||!u.defaultPrevented)return r==null?void 0:r(u)}}function gx(a,r){const o=E.createContext(r),s=l=>{const{children:m,...c}=l,h=E.useMemo(()=>c,Object.values(c));return B.jsx(o.Provider,{value:h,children:m})};s.displayName=a+"Provider";function u(l){const m=E.useContext(o);if(m)return m;if(r!==void 0)return r;throw new Error(`\`${l}\` must be used within \`${a}\``)}return[s,u]}function Hr(a,r=[]){let o=[];function s(l,m){const c=E.createContext(m),h=o.length;o=[...o,m];const d=y=>{var q;const{scope:f,children:w,...k}=y,x=((q=f==null?void 0:f[a])==null?void 0:q[h])||c,v=E.useMemo(()=>k,Object.values(k));return B.jsx(x.Provider,{value:v,children:w})};d.displayName=l+"Provider";function g(y,f){var x;const w=((x=f==null?void 0:f[a])==null?void 0:x[h])||c,k=E.useContext(w);if(k)return k;if(m!==void 0)return m;throw new Error(`\`${y}\` must be used within \`${l}\``)}return[d,g]}const u=()=>{const l=o.map(m=>E.createContext(m));return function(c){const h=(c==null?void 0:c[a])||l;return E.useMemo(()=>({[`__scope${a}`]:{...c,[a]:h}}),[c,h])}};return u.scopeName=a,[s,yx(u,...r)]}function yx(...a){const r=a[0];if(a.length===1)return r;const o=()=>{const s=a.map(u=>({useScope:u(),scopeName:u.scopeName}));return function(l){const m=s.reduce((c,{useScope:h,scopeName:d})=>{const y=h(l)[`__scope${d}`];return{...c,...y}},{});return E.useMemo(()=>({[`__scope${r.scopeName}`]:m}),[m])}};return o.scopeName=r.scopeName,o}var Do=globalThis!=null&&globalThis.document?E.useLayoutEffect:()=>{},bx=Mu[" useId ".trim().toString()]||(()=>{}),fx=0;function Nr(a){const[r,o]=E.useState(bx());return Do(()=>{o(s=>s??String(fx++))},[a]),r?`radix-${r}`:""}var vx=Mu[" useInsertionEffect ".trim().toString()]||Do;function sl({prop:a,defaultProp:r,onChange:o=()=>{},caller:s}){const[u,l,m]=kx({defaultProp:r,onChange:o}),c=a!==void 0,h=c?a:u;{const g=E.useRef(a!==void 0);E.useEffect(()=>{const y=g.current;y!==c&&console.warn(`${s} is changing from ${y?"controlled":"uncontrolled"} to ${c?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),g.current=c},[c,s])}const d=E.useCallback(g=>{var y;if(c){const f=wx(g)?g(a):g;f!==a&&((y=m.current)==null||y.call(m,f))}else l(g)},[c,a,l,m]);return[h,d]}function kx({defaultProp:a,onChange:r}){const[o,s]=E.useState(a),u=E.useRef(o),l=E.useRef(r);return vx(()=>{l.current=r},[r]),E.useEffect(()=>{var m;u.current!==o&&((m=l.current)==null||m.call(l,o),u.current=o)},[o,u]),[o,s,l]}function wx(a){return typeof a=="function"}function xx(a){const r=zx(a),o=E.forwardRef((s,u)=>{const{children:l,...m}=s,c=E.Children.toArray(l),h=c.find(jx);if(h){const d=h.props.children,g=c.map(y=>y===h?E.Children.count(d)>1?E.Children.only(null):E.isValidElement(d)?d.props.children:null:y);return B.jsx(r,{...m,ref:u,children:E.isValidElement(d)?E.cloneElement(d,void 0,g):null})}return B.jsx(r,{...m,ref:u,children:l})});return o.displayName=`${a}.Slot`,o}function zx(a){const r=E.forwardRef((o,s)=>{const{children:u,...l}=o;if(E.isValidElement(u)){const m=Cx(u),c=Ax(l,u.props);return u.type!==E.Fragment&&(c.ref=s?Lr(s,m):m),E.cloneElement(u,c)}return E.Children.count(u)>1?E.Children.only(null):null});return r.displayName=`${a}.SlotClone`,r}var qx=Symbol("radix.slottable");function jx(a){return E.isValidElement(a)&&typeof a.type=="function"&&"__radixId"in a.type&&a.type.__radixId===qx}function Ax(a,r){const o={...r};for(const s in r){const u=a[s],l=r[s];/^on[A-Z]/.test(s)?u&&l?o[s]=(...c)=>{const h=l(...c);return u(...c),h}:u&&(o[s]=u):s==="style"?o[s]={...u,...l}:s==="className"&&(o[s]=[u,l].filter(Boolean).join(" "))}return{...a,...o}}function Cx(a){var s,u;let r=(s=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:s.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?a.ref:(r=(u=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:u.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?a.props.ref:a.props.ref||a.ref)}var Ex=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Fi=Ex.reduce((a,r)=>{const o=xx(`Primitive.${r}`),s=E.forwardRef((u,l)=>{const{asChild:m,...c}=u,h=m?o:r;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),B.jsx(h,{...c,ref:l})});return s.displayName=`Primitive.${r}`,{...a,[r]:s}},{});function Sx(a,r){a&&Jg.flushSync(()=>a.dispatchEvent(r))}function Fo(a){const r=E.useRef(a);return E.useEffect(()=>{r.current=a}),E.useMemo(()=>(...o)=>{var s;return(s=r.current)==null?void 0:s.call(r,...o)},[])}function Bx(a,r=globalThis==null?void 0:globalThis.document){const o=Fo(a);E.useEffect(()=>{const s=u=>{u.key==="Escape"&&o(u)};return r.addEventListener("keydown",s,{capture:!0}),()=>r.removeEventListener("keydown",s,{capture:!0})},[o,r])}var _x="DismissableLayer",Eu="dismissableLayer.update",Dx="dismissableLayer.pointerDownOutside",Fx="dismissableLayer.focusOutside",dh,by=E.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),fy=E.forwardRef((a,r)=>{const{disableOutsidePointerEvents:o=!1,onEscapeKeyDown:s,onPointerDownOutside:u,onFocusOutside:l,onInteractOutside:m,onDismiss:c,...h}=a,d=E.useContext(by),[g,y]=E.useState(null),f=(g==null?void 0:g.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,w]=E.useState({}),k=va(r,F=>y(F)),x=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),q=x.indexOf(v),A=g?x.indexOf(g):-1,z=d.layersWithOutsidePointerEventsDisabled.size>0,_=A>=q,C=Px(F=>{const R=F.target,M=[...d.branches].some(P=>P.contains(R));!_||M||(u==null||u(F),m==null||m(F),F.defaultPrevented||c==null||c())},f),D=Nx(F=>{const R=F.target;[...d.branches].some(P=>P.contains(R))||(l==null||l(F),m==null||m(F),F.defaultPrevented||c==null||c())},f);return Bx(F=>{A===d.layers.size-1&&(s==null||s(F),!F.defaultPrevented&&c&&(F.preventDefault(),c()))},f),E.useEffect(()=>{if(g)return o&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(dh=f.body.style.pointerEvents,f.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(g)),d.layers.add(g),ph(),()=>{o&&d.layersWithOutsidePointerEventsDisabled.size===1&&(f.body.style.pointerEvents=dh)}},[g,f,o,d]),E.useEffect(()=>()=>{g&&(d.layers.delete(g),d.layersWithOutsidePointerEventsDisabled.delete(g),ph())},[g,d]),E.useEffect(()=>{const F=()=>w({});return document.addEventListener(Eu,F),()=>document.removeEventListener(Eu,F)},[]),B.jsx(Fi.div,{...h,ref:k,style:{pointerEvents:z?_?"auto":"none":void 0,...a.style},onFocusCapture:Si(a.onFocusCapture,D.onFocusCapture),onBlurCapture:Si(a.onBlurCapture,D.onBlurCapture),onPointerDownCapture:Si(a.onPointerDownCapture,C.onPointerDownCapture)})});fy.displayName=_x;var Rx="DismissableLayerBranch",Tx=E.forwardRef((a,r)=>{const o=E.useContext(by),s=E.useRef(null),u=va(r,s);return E.useEffect(()=>{const l=s.current;if(l)return o.branches.add(l),()=>{o.branches.delete(l)}},[o.branches]),B.jsx(Fi.div,{...a,ref:u})});Tx.displayName=Rx;function Px(a,r=globalThis==null?void 0:globalThis.document){const o=Fo(a),s=E.useRef(!1),u=E.useRef(()=>{});return E.useEffect(()=>{const l=c=>{if(c.target&&!s.current){let h=function(){vy(Dx,o,d,{discrete:!0})};const d={originalEvent:c};c.pointerType==="touch"?(r.removeEventListener("click",u.current),u.current=h,r.addEventListener("click",u.current,{once:!0})):h()}else r.removeEventListener("click",u.current);s.current=!1},m=window.setTimeout(()=>{r.addEventListener("pointerdown",l)},0);return()=>{window.clearTimeout(m),r.removeEventListener("pointerdown",l),r.removeEventListener("click",u.current)}},[r,o]),{onPointerDownCapture:()=>s.current=!0}}function Nx(a,r=globalThis==null?void 0:globalThis.document){const o=Fo(a),s=E.useRef(!1);return E.useEffect(()=>{const u=l=>{l.target&&!s.current&&vy(Fx,o,{originalEvent:l},{discrete:!1})};return r.addEventListener("focusin",u),()=>r.removeEventListener("focusin",u)},[r,o]),{onFocusCapture:()=>s.current=!0,onBlurCapture:()=>s.current=!1}}function ph(){const a=new CustomEvent(Eu);document.dispatchEvent(a)}function vy(a,r,o,{discrete:s}){const u=o.originalEvent.target,l=new CustomEvent(a,{bubbles:!1,cancelable:!0,detail:o});r&&u.addEventListener(a,r,{once:!0}),s?Sx(u,l):u.dispatchEvent(l)}var uu="focusScope.autoFocusOnMount",du="focusScope.autoFocusOnUnmount",mh={bubbles:!1,cancelable:!0},Ix="FocusScope",ky=E.forwardRef((a,r)=>{const{loop:o=!1,trapped:s=!1,onMountAutoFocus:u,onUnmountAutoFocus:l,...m}=a,[c,h]=E.useState(null),d=Fo(u),g=Fo(l),y=E.useRef(null),f=va(r,x=>h(x)),w=E.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;E.useEffect(()=>{if(s){let x=function(z){if(w.paused||!c)return;const _=z.target;c.contains(_)?y.current=_:qn(y.current,{select:!0})},v=function(z){if(w.paused||!c)return;const _=z.relatedTarget;_!==null&&(c.contains(_)||qn(y.current,{select:!0}))},q=function(z){if(document.activeElement===document.body)for(const C of z)C.removedNodes.length>0&&qn(c)};document.addEventListener("focusin",x),document.addEventListener("focusout",v);const A=new MutationObserver(q);return c&&A.observe(c,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",x),document.removeEventListener("focusout",v),A.disconnect()}}},[s,c,w.paused]),E.useEffect(()=>{if(c){gh.add(w);const x=document.activeElement;if(!c.contains(x)){const q=new CustomEvent(uu,mh);c.addEventListener(uu,d),c.dispatchEvent(q),q.defaultPrevented||(Mx(Ux(wy(c)),{select:!0}),document.activeElement===x&&qn(c))}return()=>{c.removeEventListener(uu,d),setTimeout(()=>{const q=new CustomEvent(du,mh);c.addEventListener(du,g),c.dispatchEvent(q),q.defaultPrevented||qn(x??document.body,{select:!0}),c.removeEventListener(du,g),gh.remove(w)},0)}}},[c,d,g,w]);const k=E.useCallback(x=>{if(!o&&!s||w.paused)return;const v=x.key==="Tab"&&!x.altKey&&!x.ctrlKey&&!x.metaKey,q=document.activeElement;if(v&&q){const A=x.currentTarget,[z,_]=Ox(A);z&&_?!x.shiftKey&&q===_?(x.preventDefault(),o&&qn(z,{select:!0})):x.shiftKey&&q===z&&(x.preventDefault(),o&&qn(_,{select:!0})):q===A&&x.preventDefault()}},[o,s,w.paused]);return B.jsx(Fi.div,{tabIndex:-1,...m,ref:f,onKeyDown:k})});ky.displayName=Ix;function Mx(a,{select:r=!1}={}){const o=document.activeElement;for(const s of a)if(qn(s,{select:r}),document.activeElement!==o)return}function Ox(a){const r=wy(a),o=hh(r,a),s=hh(r.reverse(),a);return[o,s]}function wy(a){const r=[],o=document.createTreeWalker(a,NodeFilter.SHOW_ELEMENT,{acceptNode:s=>{const u=s.tagName==="INPUT"&&s.type==="hidden";return s.disabled||s.hidden||u?NodeFilter.FILTER_SKIP:s.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;o.nextNode();)r.push(o.currentNode);return r}function hh(a,r){for(const o of a)if(!Lx(o,{upTo:r}))return o}function Lx(a,{upTo:r}){if(getComputedStyle(a).visibility==="hidden")return!0;for(;a;){if(r!==void 0&&a===r)return!1;if(getComputedStyle(a).display==="none")return!0;a=a.parentElement}return!1}function Hx(a){return a instanceof HTMLInputElement&&"select"in a}function qn(a,{select:r=!1}={}){if(a&&a.focus){const o=document.activeElement;a.focus({preventScroll:!0}),a!==o&&Hx(a)&&r&&a.select()}}var gh=Vx();function Vx(){let a=[];return{add(r){const o=a[0];r!==o&&(o==null||o.pause()),a=yh(a,r),a.unshift(r)},remove(r){var o;a=yh(a,r),(o=a[0])==null||o.resume()}}}function yh(a,r){const o=[...a],s=o.indexOf(r);return s!==-1&&o.splice(s,1),o}function Ux(a){return a.filter(r=>r.tagName!=="A")}var Wx="Portal",xy=E.forwardRef((a,r)=>{var c;const{container:o,...s}=a,[u,l]=E.useState(!1);Do(()=>l(!0),[]);const m=o||u&&((c=globalThis==null?void 0:globalThis.document)==null?void 0:c.body);return m?ey.createPortal(B.jsx(Fi.div,{...s,ref:r}),m):null});xy.displayName=Wx;function $x(a,r){return E.useReducer((o,s)=>r[o][s]??o,a)}var No=a=>{const{present:r,children:o}=a,s=Gx(r),u=typeof o=="function"?o({present:s.isPresent}):E.Children.only(o),l=va(s.ref,Qx(u));return typeof o=="function"||s.isPresent?E.cloneElement(u,{ref:l}):null};No.displayName="Presence";function Gx(a){const[r,o]=E.useState(),s=E.useRef(null),u=E.useRef(a),l=E.useRef("none"),m=a?"mounted":"unmounted",[c,h]=$x(m,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return E.useEffect(()=>{const d=at(s.current);l.current=c==="mounted"?d:"none"},[c]),Do(()=>{const d=s.current,g=u.current;if(g!==a){const f=l.current,w=at(d);a?h("MOUNT"):w==="none"||(d==null?void 0:d.display)==="none"?h("UNMOUNT"):h(g&&f!==w?"ANIMATION_OUT":"UNMOUNT"),u.current=a}},[a,h]),Do(()=>{if(r){let d;const g=r.ownerDocument.defaultView??window,y=w=>{const x=at(s.current).includes(CSS.escape(w.animationName));if(w.target===r&&x&&(h("ANIMATION_END"),!u.current)){const v=r.style.animationFillMode;r.style.animationFillMode="forwards",d=g.setTimeout(()=>{r.style.animationFillMode==="forwards"&&(r.style.animationFillMode=v)})}},f=w=>{w.target===r&&(l.current=at(s.current))};return r.addEventListener("animationstart",f),r.addEventListener("animationcancel",y),r.addEventListener("animationend",y),()=>{g.clearTimeout(d),r.removeEventListener("animationstart",f),r.removeEventListener("animationcancel",y),r.removeEventListener("animationend",y)}}else h("ANIMATION_END")},[r,h]),{isPresent:["mounted","unmountSuspended"].includes(c),ref:E.useCallback(d=>{s.current=d?getComputedStyle(d):null,o(d)},[])}}function at(a){return(a==null?void 0:a.animationName)||"none"}function Qx(a){var s,u;let r=(s=Object.getOwnPropertyDescriptor(a.props,"ref"))==null?void 0:s.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?a.ref:(r=(u=Object.getOwnPropertyDescriptor(a,"ref"))==null?void 0:u.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?a.props.ref:a.props.ref||a.ref)}var pu=0;function Kx(){E.useEffect(()=>{const a=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",a[0]??bh()),document.body.insertAdjacentElement("beforeend",a[1]??bh()),pu++,()=>{pu===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(r=>r.remove()),pu--}},[])}function bh(){const a=document.createElement("span");return a.setAttribute("data-radix-focus-guard",""),a.tabIndex=0,a.style.outline="none",a.style.opacity="0",a.style.position="fixed",a.style.pointerEvents="none",a}var La=function(){return La=Object.assign||function(r){for(var o,s=1,u=arguments.length;s"u")return pz;var r=mz(a),o=document.documentElement.clientWidth,s=window.innerWidth;return{left:r[0],top:r[1],right:r[2],gap:Math.max(0,s-o+r[2]-r[0])}},gz=Ay(),So="data-scroll-locked",yz=function(a,r,o,s){var u=a.left,l=a.top,m=a.right,c=a.gap;return o===void 0&&(o="margin"),` .`.concat(Zx,` { overflow: hidden `).concat(s,`; padding-right: `).concat(c,"px ").concat(s,`; @@ -534,4 +534,4 @@ fn main(@builtin(global_invocation_id) global_id: vec3) { See https://github.com/richtr/NoSleep.js/issues/15 for more details. `),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(c=>(this.enabled=!0,c)).catch(c=>{throw this.enabled=!1,c})}disable(){s()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):o()?this.noSleepTimer&&(console.warn(` NoSleep now disabled for older iOS devices. - `),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}return xu=u,xu}var Zj=Yj();const Xj=Ro(Zj);function Jj({packets:a,channels:r,onChannelCreate:o,onRunningChange:s}){const[u,l]=E.useState(!1),[m,c]=E.useState(6),[h,d]=E.useState(!1),[g,y]=E.useState(!0),[f,w]=E.useState(!1),[k,x]=E.useState(null),[v,q]=E.useState(new Map),[A,z]=E.useState([]),[_,C]=E.useState(!1),[D,F]=E.useState(null),[R,M]=E.useState(null),P=E.useRef(null),T=E.useRef(null),U=E.useRef(!1),H=E.useRef(!1),K=E.useRef(!1),ie=E.useRef(new Map),Z=E.useRef(!1),ae=E.useRef(6),W=E.useRef(!0),ne=E.useRef(!1),X=E.useRef(new Set);E.useEffect(()=>{const ce=new Gj;P.current=ce,F(ce.isGpuAvailable());const je=new Xj;return T.current=je,ce.setWordlist(Qj),C(!0),()=>{ce.destroy(),P.current=null,je.disable(),T.current=null}},[]),E.useEffect(()=>{const ce=()=>{ei.getUndecryptedPacketCount().then(({count:De})=>M(De)).catch(()=>M(null))};ce();const je=setInterval(ce,3e4);return()=>clearInterval(je)},[]);const j=new Set(r.map(ce=>ce.key.toUpperCase())),I=a.filter(ce=>ce.payload_type==="GROUP_TEXT"&&!ce.decrypted);E.useEffect(()=>{q(ce=>{const je=new Map(ce);let De=!1;for(const Pe of I)je.has(Pe.id)||(je.set(Pe.id,{packet:Pe,attempts:0,lastAttemptLength:0,status:"pending"}),De=!0);return De?(ie.current=je,je):ce})},[I.length]),E.useEffect(()=>{ie.current=v},[v]),E.useEffect(()=>{Z.current=h},[h]),E.useEffect(()=>{ae.current=m},[m]),E.useEffect(()=>{W.current=g},[g]),E.useEffect(()=>{ne.current=f},[f]),E.useEffect(()=>{X.current=new Set(I.map(ce=>ce.id))},[I]),E.useEffect(()=>{s==null||s(u)},[u,s]);const L=Array.from(v.values()).filter(ce=>ce.status==="pending").length,$=Array.from(v.values()).filter(ce=>ce.status==="cracked").length,le=Array.from(v.values()).filter(ce=>ce.status==="failed").length,me=E.useCallback(async()=>{if(K.current||!P.current||!U.current)return;const ce=ie.current;let je=null,De=null;for(const[He,Oe]of ce.entries())if(Oe.status==="pending"){je=Oe,De=He;break}if(!je&&Z.current){const He=Array.from(ce.entries()).filter(([,Oe])=>Oe.status==="failed"&&Oe.lastAttemptLength<10);He.length>0&&(He.sort((Oe,Je)=>Oe[1].lastAttemptLength-Je[1].lastAttemptLength),[De,je]=He[0])}if(!je||De===null){U.current&&setTimeout(()=>me(),1e3);return}if(!X.current.has(De)){q(He=>{const Oe=new Map(He);return Oe.delete(De),Oe}),U.current&&setTimeout(()=>me(),10);return}K.current=!0;const Pe=ae.current,ai=je.lastAttemptLength>0,Re=ai?je.lastAttemptLength+1:Pe;try{const He=await P.current.crack(je.packet.data,{maxLength:Re,useTimestampFilter:!0,useUtf8Filter:!0,...ne.current&&{gpuDispatchMs:1e4},...ai&&{useDictionary:!1,startingLength:Re}},Oe=>{x(Oe)});if(H.current){H.current=!1,K.current=!1,x(null);return}if(He.found&&He.roomName&&He.key){q(Ge=>{const oi=new Map(Ge),fi=oi.get(De);return fi&&oi.set(De,{...fi,status:"cracked",attempts:fi.attempts+1,lastAttemptLength:Re}),oi});const Oe={roomName:He.roomName,key:He.key,packetId:De,message:He.decryptedMessage||"",crackedAt:Date.now()};z(Ge=>[...Ge,Oe]);const Je=He.key.toUpperCase();if(!j.has(Je))try{const Ge="#"+He.roomName;await o(Ge,He.key),W.current&&await ei.decryptHistoricalPackets({key_type:"channel",channel_name:Ge})}catch(Ge){console.error("Failed to create channel or decrypt historical:",Ge)}}else q(Oe=>{const Je=new Map(Oe),Ge=Je.get(De);return Ge&&Je.set(De,{...Ge,status:"failed",attempts:Ge.attempts+1,lastAttemptLength:Re}),Je})}catch(He){console.error("Cracking error:",He),q(Oe=>{const Je=new Map(Oe),Ge=Je.get(De);return Ge&&Je.set(De,{...Ge,status:"failed",attempts:Ge.attempts+1,lastAttemptLength:Re}),Je})}K.current=!1,x(null),U.current&&setTimeout(()=>me(),100)},[j,o]),ge=()=>{var ce;if(!D){alert("WebGPU is not available in your browser. Please use Chrome 113+ or Edge 113+.");return}l(!0),U.current=!0,H.current=!1,(ce=T.current)==null||ce.enable(),me()},oe=()=>{var ce,je;l(!1),U.current=!1,H.current=!0,(ce=P.current)==null||ce.abort(),(je=T.current)==null||je.disable()};return B.jsxs("div",{className:"flex flex-col h-full p-3 gap-3 bg-background border-t border-border",children:[B.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["This will attempt to dictionary attack, then brute force GroupText packets as they arrive, testing room names up to the specified length.",B.jsx("strong",{children:" Retry failed at n+1"})," will let the cracker return to the failed queue and pick up messages it couldn't crack, attempting them at one longer length.",B.jsx("strong",{children:" Decrypt historical"})," will run an async job on any room name it finds to see if any historically captured packets will decrypt with that key.",B.jsx("strong",{children:" Turbo mode"})," will push your GPU to the max (target dispatch time of 10s) and may allow accelerated cracking and/or system instability."]}),B.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[B.jsx("button",{onClick:u?oe:ge,disabled:!_||D===!1,className:$e("px-4 py-1.5 rounded text-sm font-medium",u?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"bg-primary text-primary-foreground hover:bg-primary/90","disabled:opacity-50 disabled:cursor-not-allowed"),children:u?"Stop":"Start Cracking"}),B.jsxs("div",{className:"flex items-center gap-2",children:[B.jsx("label",{className:"text-sm text-muted-foreground",children:"Max Length:"}),B.jsx("input",{type:"number",min:1,max:10,value:m,onChange:ce=>c(Math.min(10,Math.max(1,parseInt(ce.target.value)||6))),className:"w-14 px-2 py-1 text-sm bg-muted border border-border rounded"})]}),B.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer",children:[B.jsx("input",{type:"checkbox",checked:h,onChange:ce=>d(ce.target.checked),className:"rounded"}),"Retry failed at n+1"]}),B.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer",children:[B.jsx("input",{type:"checkbox",checked:g,onChange:ce=>y(ce.target.checked),className:"rounded"}),"Decrypt historical"]}),g&&B.jsx("span",{className:"text-xs text-muted-foreground",children:R!==null&&R>0?`(${R.toLocaleString()} packets; messages stream in as decrypted)`:"(messages stream in as decrypted)"}),B.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer",children:[B.jsx("input",{type:"checkbox",checked:f,onChange:ce=>w(ce.target.checked),className:"rounded"}),"Turbo mode (experimental)"]})]}),B.jsxs("div",{className:"flex gap-4 text-sm",children:[B.jsxs("span",{className:"text-muted-foreground",children:["Pending: ",B.jsx("span",{className:"text-foreground font-medium",children:L})]}),B.jsxs("span",{className:"text-muted-foreground",children:["Cracked: ",B.jsx("span",{className:"text-green-500 font-medium",children:$})]}),B.jsxs("span",{className:"text-muted-foreground",children:["Failed: ",B.jsx("span",{className:"text-destructive font-medium",children:le})]})]}),k&&B.jsxs("div",{className:"space-y-1",children:[B.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[B.jsxs("span",{children:[k.phase==="wordlist"?"Dictionary":k.phase==="bruteforce"?"Bruteforce":"Public Key",k.phase==="bruteforce"&&` - Length ${k.currentLength}`,": ",k.currentPosition]}),B.jsxs("span",{children:[k.rateKeysPerSec>=1e9?`${(k.rateKeysPerSec/1e9).toFixed(2)} Gkeys/s`:`${(k.rateKeysPerSec/1e6).toFixed(1)} Mkeys/s`," ","• ETA: ",k.etaSeconds<60?`${Math.round(k.etaSeconds)}s`:`${Math.round(k.etaSeconds/60)}m`]})]}),B.jsx("div",{className:"h-2 bg-muted rounded overflow-hidden",children:B.jsx("div",{className:"h-full bg-primary transition-all duration-200",style:{width:`${k.percent}%`}})})]}),D===!1&&B.jsx("div",{className:"text-sm text-destructive",children:"WebGPU not available. Cracking requires Chrome 113+ or Edge 113+."}),!_&&D!==!1&&B.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading wordlist..."}),A.length>0&&B.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[B.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Cracked Rooms:"}),B.jsx("div",{className:"space-y-1",children:A.map((ce,je)=>B.jsxs("div",{className:"text-sm bg-green-950/30 border border-green-900/50 rounded px-2 py-1",children:[B.jsxs("span",{className:"text-green-400 font-medium",children:["#",ce.roomName]}),B.jsxs("span",{className:"text-muted-foreground ml-2 text-xs",children:['"',ce.message.slice(0,50),ce.message.length>50?"...":"",'"']})]},je))})]})]})}const eA=Gy,iA=Qy,nf=E.forwardRef(({className:a,...r},o)=>B.jsx(cl,{className:$e("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",a),...r,ref:o}));nf.displayName=cl.displayName;const aA=rl("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),of=E.forwardRef(({side:a="right",className:r,children:o,hideCloseButton:s=!1,...u},l)=>B.jsxs(iA,{children:[B.jsx(nf,{}),B.jsxs(ul,{ref:l,className:$e(aA({side:a}),r),...u,children:[!s&&B.jsxs(Ky,{className:"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-secondary",children:[B.jsx(Xg,{className:"h-4 w-4"}),B.jsx("span",{className:"sr-only",children:"Close"})]}),o]})]}));of.displayName=ul.displayName;const rf=({className:a,...r})=>B.jsx("div",{className:$e("flex flex-col space-y-2 text-center sm:text-left",a),...r});rf.displayName="SheetHeader";const sf=E.forwardRef(({className:a,...r},o)=>B.jsx(dl,{ref:o,className:$e("text-lg font-semibold text-foreground",a),...r}));sf.displayName=dl.displayName;const nA=E.forwardRef(({className:a,...r},o)=>B.jsx(pl,{ref:o,className:$e("text-sm text-muted-foreground",a),...r}));nA.displayName=pl.displayName;function oA(){const a=window.location.hash.slice(1);if(!a)return null;if(a==="raw")return{type:"raw",name:"raw"};const r=a.indexOf("/");if(r===-1)return null;const o=a.slice(0,r),s=decodeURIComponent(a.slice(r+1));return(o==="channel"||o==="contact")&&s?{type:o,name:s}:null}function rA(a){if(!a)return"";if(a.type==="raw")return"#raw";const r=a.type==="channel"&&a.name.startsWith("#")?a.name.slice(1):a.name;return`#${a.type}/${encodeURIComponent(r)}`}function sA(a){const r=rA(a);r!==window.location.hash&&window.history.replaceState(null,"",r||window.location.pathname)}const Wg=500;function tA(){const a=E.useRef(null),r=E.useRef(null),[o,s]=E.useState(null),[u,l]=E.useState(null),[m,c]=E.useState(null),[h,d]=E.useState([]),[g,y]=E.useState([]),[f,w]=E.useState([]),[k,x]=E.useState(null),[v,q]=E.useState(!1),[A,z]=E.useState(!1),[_,C]=E.useState(!1),[D,F]=E.useState(0),[R,M]=E.useState(!1),[P,T]=E.useState(!1),U=E.useRef(null),{messages:H,messagesLoading:K,loadingOlder:ie,hasOlderMessages:Z,setMessages:ae,fetchMessages:W,fetchOlderMessages:ne,addMessageIfNew:X,updateMessageAck:j}=kk(k),{unreadCounts:I,lastMessageTimes:L,incrementUnread:$,markAllRead:le,trackNewMessage:me}=vk(g,h,k),{repeaterLoggedIn:ge,activeContactIsRepeater:oe,handleTelemetryRequest:ce,handleRepeaterCommand:je}=yk(k,h,ae),De=E.useMemo(()=>({onHealth:ee=>{const he=U.current;U.current=ee,s(ee),he!==null&&he.radio_connected!==ee.radio_connected&&(ee.radio_connected?Pr.success("Radio connected",{description:ee.serial_port?`Connected to ${ee.serial_port}`:void 0}):Pr.error("Radio disconnected",{description:"Check radio connection and power"}))},onError:ee=>{Pr.error(ee.message,{description:ee.details})},onContacts:ee=>d(ee),onChannels:ee=>y(ee),onMessage:ee=>{const he=r.current,Be=he?ee.type==="CHAN"&&he.type==="channel"?ee.conversation_key===he.id:ee.type==="PRIV"&&he.type==="contact"?ee.conversation_key&&Kg(he.id,ee.conversation_key):!1:!1;if(Be&&X(ee),me(ee),!ee.outgoing&&!Be){let Ke=null;ee.type==="CHAN"&&ee.conversation_key?Ke=fa("channel",ee.conversation_key):ee.type==="PRIV"&&ee.conversation_key&&(Ke=fa("contact",ee.conversation_key)),Ke&&$(Ke)}},onContact:ee=>{d(he=>{const Be=he.findIndex(Ke=>Ke.public_key===ee.public_key);if(Be>=0){const Ke=[...he],J=he[Be];return Ke[Be]={...J,...ee,name:ee.name??J.name,last_path:ee.last_path??J.last_path,lat:ee.lat??J.lat,lon:ee.lon??J.lon},Ke}return[...he,ee]})},onRawPacket:ee=>{w(he=>{if(he.some(Ke=>Ke.id===ee.id))return he;const Be=[...he,ee];return Be.length>Wg?Be.slice(-Wg):Be})},onMessageAcked:(ee,he)=>{j(ee,he)}}),[X,me,$,j]);pk(De);const Pe=E.useCallback(async()=>{try{const ee=await ei.getRadioConfig();l(ee)}catch(ee){console.error("Failed to fetch config:",ee)}},[]),ai=E.useCallback(async()=>{try{const ee=await ei.getSettings();c(ee)}catch(ee){console.error("Failed to fetch app settings:",ee)}},[]),Re=E.useCallback(async()=>{try{const ee=await ei.getUndecryptedPacketCount();F(ee.count)}catch(ee){console.error("Failed to fetch undecrypted count:",ee)}},[]);E.useEffect(()=>{Pe(),ai(),Re()},[Pe,ai,Re]);const He=E.useCallback(()=>{const ee=oA();if(!ee)return null;if(ee.type==="raw")return{type:"raw",id:"raw",name:"Raw Packet Feed"};if(ee.type==="channel"){const he=g.find(Be=>Be.name===ee.name||Be.name===`#${ee.name}`);if(he)return{type:"channel",id:he.key,name:he.name}}if(ee.type==="contact"){const he=h.find(Be=>Yn(Be.name,Be.public_key)===ee.name);if(he)return{type:"contact",id:he.public_key,name:Yn(he.name,he.public_key)}}return null},[g,h]),Oe=E.useRef(!1);E.useEffect(()=>{if(Oe.current||k||g.length===0&&h.length===0)return;const ee=He();if(ee){x(ee),Oe.current=!0;return}const he=g.find(Be=>Be.name==="Public");he&&(x({type:"channel",id:he.key,name:he.name}),Oe.current=!0)},[g,h,k,He]),E.useEffect(()=>{r.current=k,k&&sA(k)},[k]);const Je=E.useCallback(async ee=>{k&&(k.type==="channel"?await ei.sendChannelMessage(k.id,ee):await ei.sendDirectMessage(k.id,ee),await W())},[k,W]),Ge=E.useCallback(async ee=>{await ei.updateRadioConfig(ee),await Pe()},[Pe]),oi=E.useCallback(async ee=>{await ei.updateSettings(ee),await ai()},[ai]),fi=E.useCallback(async ee=>{await ei.setPrivateKey(ee),await Pe()},[Pe]),ti=E.useCallback(async()=>{await ei.rebootRadio(),s(he=>he&&{...he,radio_connected:!1}),(async()=>{for(let he=0;he<30;he++){await new Promise(Be=>setTimeout(Be,1e3));try{const Be=await ei.getHealth();if(s(Be),Be.radio_connected){Pe();return}}catch{}}})()},[Pe]),Ve=E.useCallback(async()=>{try{await ei.sendAdvertisement(!0)}catch(ee){console.error("Failed to send advertisement:",ee)}},[]),hi=E.useCallback(ee=>{var he;(he=a.current)==null||he.appendText(`@[${ee}] `)},[]),Qi=E.useCallback(ee=>{x(ee),C(!1)},[]),ka=E.useCallback(async ee=>{if(confirm("Delete this channel? Message history will be preserved."))try{await ei.deleteChannel(ee),y(he=>he.filter(Be=>Be.key!==ee)),x(null)}catch(he){console.error("Failed to delete channel:",he)}},[]),ji=E.useCallback(async ee=>{if(confirm("Delete this contact? Message history will be preserved."))try{await ei.deleteContact(ee),d(he=>he.filter(Be=>Be.public_key!==ee)),x(null)}catch(he){console.error("Failed to delete contact:",he)}},[]),Mi=E.useCallback(async(ee,he,Be)=>{const Ke={public_key:he,name:ee,type:0,flags:0,last_path:null,last_path_len:-1,last_advert:null,lat:null,lon:null,last_seen:null,on_radio:!1};d(J=>[...J,Ke]),x({type:"contact",id:he,name:Yn(ee,he)}),Be&&console.log("Contact historical decryption not yet supported")},[]),Ki=E.useCallback(async(ee,he,Be)=>{const Ke=await ei.createChannel(ee,he),J=await ei.getChannels();y(J),x({type:"channel",id:Ke.key,name:ee}),Be&&(await ei.decryptHistoricalPackets({key_type:"channel",channel_key:Ke.key}),Re())},[Re]),oa=E.useCallback(async(ee,he)=>{const Be=ee.startsWith("#")?ee:`#${ee}`,Ke=await ei.createChannel(Be),J=await ei.getChannels();y(J),x({type:"channel",id:Ke.key,name:Be}),he&&(await ei.decryptHistoricalPackets({key_type:"channel",channel_name:Be}),Re())},[Re]),wi=B.jsx(dx,{contacts:h,channels:g,activeConversation:k,onSelectConversation:Qi,onNewMessage:()=>{q(!0),C(!1)},lastMessageTimes:L,unreadCounts:I,showCracker:R,crackerRunning:P,onToggleCracker:()=>M(ee=>!ee),onMarkAllRead:le});return B.jsxs("div",{className:"flex flex-col h-dvh",children:[B.jsx(rw,{health:o,config:u,onConfigClick:()=>z(!0),onAdvertise:Ve,onMenuClick:()=>C(!0)}),B.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[B.jsx("div",{className:"hidden md:block",children:wi}),B.jsx(eA,{open:_,onOpenChange:C,children:B.jsxs(of,{side:"left",className:"w-[280px] p-0 flex flex-col",hideCloseButton:!0,children:[B.jsx(rf,{className:"sr-only",children:B.jsx(sf,{children:"Navigation"})}),B.jsx("div",{className:"flex-1 overflow-hidden",children:wi})]})}),B.jsx("div",{className:"flex-1 flex flex-col bg-background",children:k?k.type==="raw"?B.jsxs(B.Fragment,{children:[B.jsx("div",{className:"flex justify-between items-center px-4 py-3 border-b border-border font-medium",children:"Raw Packet Feed"}),B.jsx("div",{className:"flex-1 overflow-hidden",children:B.jsx(W0,{packets:f})})]}):B.jsxs(B.Fragment,{children:[B.jsxs("div",{className:"flex justify-between items-center px-4 py-3 border-b border-border font-medium",children:[B.jsxs("span",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-2",children:[B.jsxs("span",{children:[k.type==="channel"&&!k.name.startsWith("#")?"#":"",k.name]}),B.jsx("span",{className:"font-normal text-xs text-muted-foreground font-mono",children:k.id})]}),!(k.type==="channel"&&k.name==="Public")&&B.jsx("button",{className:"py-1 px-3 bg-destructive/20 border border-destructive/30 text-destructive rounded text-xs cursor-pointer hover:bg-destructive/30",onClick:()=>{k.type==="channel"?ka(k.id):ji(k.id)},children:"Delete"})]}),B.jsx(mx,{messages:H,contacts:h,loading:K,loadingOlder:ie,hasOlderMessages:Z,onSenderClick:k.type==="channel"?hi:void 0,onLoadOlder:ne,radioName:u==null?void 0:u.name}),B.jsx(hx,{ref:a,onSend:oe?ge?je:ce:Je,disabled:!(o!=null&&o.radio_connected),isRepeaterMode:oe&&!ge,placeholder:o!=null&&o.radio_connected?oe?ge?"Send CLI command (requires admin login)...":`Enter password for ${k.name} (or . for none)...`:`Message ${k.name}...`:"Radio not connected"})]}):B.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a conversation or start a new one"})})]}),B.jsx("div",{className:$e("border-t border-border bg-background transition-all duration-200 overflow-hidden",R?"h-[275px]":"h-0"),children:B.jsx(Jj,{packets:f,channels:g,onChannelCreate:async(ee,he)=>{const Be=await ei.createChannel(ee,he),Ke=await ei.getChannels();y(Ke),await ei.decryptHistoricalPackets({key_type:"channel",channel_key:Be.key}),Re()},onRunningChange:T})}),B.jsx(F0,{open:v,contacts:h,undecryptedCount:D,onClose:()=>q(!1),onSelectConversation:ee=>{x(ee),q(!1)},onCreateContact:Mi,onCreateChannel:Ki,onCreateHashtagChannel:oa}),B.jsx(L0,{open:A,config:u,appSettings:m,onClose:()=>z(!1),onSave:Ge,onSaveAppSettings:oi,onSetPrivateKey:fi,onReboot:ti}),B.jsx(ow,{position:"top-right"})]})}uk.createRoot(document.getElementById("root")).render(B.jsx(E.StrictMode,{children:B.jsx(tA,{})})); + `),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}return xu=u,xu}var Zj=Yj();const Xj=Ro(Zj);function Jj({packets:a,channels:r,onChannelCreate:o,onRunningChange:s}){const[u,l]=E.useState(!1),[m,c]=E.useState(6),[h,d]=E.useState(!1),[g,y]=E.useState(!0),[f,w]=E.useState(!1),[k,x]=E.useState(null),[v,q]=E.useState(new Map),[A,z]=E.useState([]),[_,C]=E.useState(!1),[D,F]=E.useState(null),[R,M]=E.useState(null),P=E.useRef(null),T=E.useRef(null),U=E.useRef(!1),H=E.useRef(!1),K=E.useRef(!1),ie=E.useRef(new Map),Z=E.useRef(!1),ae=E.useRef(6),W=E.useRef(!0),ne=E.useRef(!1),X=E.useRef(new Set);E.useEffect(()=>{const ce=new Gj;P.current=ce,F(ce.isGpuAvailable());const je=new Xj;return T.current=je,ce.setWordlist(Qj),C(!0),()=>{ce.destroy(),P.current=null,je.disable(),T.current=null}},[]),E.useEffect(()=>{const ce=()=>{ei.getUndecryptedPacketCount().then(({count:De})=>M(De)).catch(()=>M(null))};ce();const je=setInterval(ce,3e4);return()=>clearInterval(je)},[]);const j=new Set(r.map(ce=>ce.key.toUpperCase())),I=a.filter(ce=>ce.payload_type==="GROUP_TEXT"&&!ce.decrypted);E.useEffect(()=>{q(ce=>{const je=new Map(ce);let De=!1;for(const Pe of I)je.has(Pe.id)||(je.set(Pe.id,{packet:Pe,attempts:0,lastAttemptLength:0,status:"pending"}),De=!0);return De?(ie.current=je,je):ce})},[I.length]),E.useEffect(()=>{ie.current=v},[v]),E.useEffect(()=>{Z.current=h},[h]),E.useEffect(()=>{ae.current=m},[m]),E.useEffect(()=>{W.current=g},[g]),E.useEffect(()=>{ne.current=f},[f]),E.useEffect(()=>{X.current=new Set(I.map(ce=>ce.id))},[I]),E.useEffect(()=>{s==null||s(u)},[u,s]);const L=Array.from(v.values()).filter(ce=>ce.status==="pending").length,$=Array.from(v.values()).filter(ce=>ce.status==="cracked").length,le=Array.from(v.values()).filter(ce=>ce.status==="failed").length,me=E.useCallback(async()=>{if(K.current||!P.current||!U.current)return;const ce=ie.current;let je=null,De=null;for(const[He,Oe]of ce.entries())if(Oe.status==="pending"){je=Oe,De=He;break}if(!je&&Z.current){const He=Array.from(ce.entries()).filter(([,Oe])=>Oe.status==="failed"&&Oe.lastAttemptLength<10);He.length>0&&(He.sort((Oe,Je)=>Oe[1].lastAttemptLength-Je[1].lastAttemptLength),[De,je]=He[0])}if(!je||De===null){U.current&&setTimeout(()=>me(),1e3);return}if(!X.current.has(De)){q(He=>{const Oe=new Map(He);return Oe.delete(De),Oe}),U.current&&setTimeout(()=>me(),10);return}K.current=!0;const Pe=ae.current,ai=je.lastAttemptLength>0,Re=ai?je.lastAttemptLength+1:Pe;try{const He=await P.current.crack(je.packet.data,{maxLength:Re,useTimestampFilter:!0,useUtf8Filter:!0,...ne.current&&{gpuDispatchMs:1e4},...ai&&{useDictionary:!1,startingLength:Re}},Oe=>{x(Oe)});if(H.current){H.current=!1,K.current=!1,x(null);return}if(He.found&&He.roomName&&He.key){q(Ge=>{const oi=new Map(Ge),fi=oi.get(De);return fi&&oi.set(De,{...fi,status:"cracked",attempts:fi.attempts+1,lastAttemptLength:Re}),oi});const Oe={roomName:He.roomName,key:He.key,packetId:De,message:He.decryptedMessage||"",crackedAt:Date.now()};z(Ge=>[...Ge,Oe]);const Je=He.key.toUpperCase();if(!j.has(Je))try{const Ge="#"+He.roomName;await o(Ge,He.key),W.current&&await ei.decryptHistoricalPackets({key_type:"channel",channel_name:Ge})}catch(Ge){console.error("Failed to create channel or decrypt historical:",Ge)}}else q(Oe=>{const Je=new Map(Oe),Ge=Je.get(De);return Ge&&Je.set(De,{...Ge,status:"failed",attempts:Ge.attempts+1,lastAttemptLength:Re}),Je})}catch(He){console.error("Cracking error:",He),q(Oe=>{const Je=new Map(Oe),Ge=Je.get(De);return Ge&&Je.set(De,{...Ge,status:"failed",attempts:Ge.attempts+1,lastAttemptLength:Re}),Je})}K.current=!1,x(null),U.current&&setTimeout(()=>me(),100)},[j,o]),ge=()=>{var ce;if(!D){alert("WebGPU is not available in your browser. Please use Chrome 113+ or Edge 113+.");return}l(!0),U.current=!0,H.current=!1,(ce=T.current)==null||ce.enable(),me()},oe=()=>{var ce,je;l(!1),U.current=!1,H.current=!0,(ce=P.current)==null||ce.abort(),(je=T.current)==null||je.disable()};return B.jsxs("div",{className:"flex flex-col h-full p-3 gap-3 bg-background border-t border-border",children:[B.jsxs("p",{className:"text-xs text-muted-foreground leading-relaxed",children:["This will attempt to dictionary attack, then brute force GroupText packets as they arrive, testing room names up to the specified length.",B.jsx("strong",{children:" Retry failed at n+1"})," will let the cracker return to the failed queue and pick up messages it couldn't crack, attempting them at one longer length.",B.jsx("strong",{children:" Decrypt historical"})," will run an async job on any room name it finds to see if any historically captured packets will decrypt with that key.",B.jsx("strong",{children:" Turbo mode"})," will push your GPU to the max (target dispatch time of 10s) and may allow accelerated cracking and/or system instability."]}),B.jsxs("div",{className:"flex items-center gap-3 flex-wrap",children:[B.jsx("button",{onClick:u?oe:ge,disabled:!_||D===!1,className:$e("px-4 py-1.5 rounded text-sm font-medium",u?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"bg-primary text-primary-foreground hover:bg-primary/90","disabled:opacity-50 disabled:cursor-not-allowed"),children:u?"Stop":"Start Cracking"}),B.jsxs("div",{className:"flex items-center gap-2",children:[B.jsx("label",{className:"text-sm text-muted-foreground",children:"Max Length:"}),B.jsx("input",{type:"number",min:1,max:10,value:m,onChange:ce=>c(Math.min(10,Math.max(1,parseInt(ce.target.value)||6))),className:"w-14 px-2 py-1 text-sm bg-muted border border-border rounded"})]}),B.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer",children:[B.jsx("input",{type:"checkbox",checked:h,onChange:ce=>d(ce.target.checked),className:"rounded"}),"Retry failed at n+1"]}),B.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer",children:[B.jsx("input",{type:"checkbox",checked:g,onChange:ce=>y(ce.target.checked),className:"rounded"}),"Decrypt historical"]}),g&&B.jsx("span",{className:"text-xs text-muted-foreground",children:R!==null&&R>0?`(${R.toLocaleString()} packets; messages stream in as decrypted)`:"(messages stream in as decrypted)"}),B.jsxs("label",{className:"flex items-center gap-2 text-sm text-muted-foreground cursor-pointer",children:[B.jsx("input",{type:"checkbox",checked:f,onChange:ce=>w(ce.target.checked),className:"rounded"}),"Turbo mode (experimental)"]})]}),B.jsxs("div",{className:"flex gap-4 text-sm",children:[B.jsxs("span",{className:"text-muted-foreground",children:["Pending: ",B.jsx("span",{className:"text-foreground font-medium",children:L})]}),B.jsxs("span",{className:"text-muted-foreground",children:["Cracked: ",B.jsx("span",{className:"text-green-500 font-medium",children:$})]}),B.jsxs("span",{className:"text-muted-foreground",children:["Failed: ",B.jsx("span",{className:"text-destructive font-medium",children:le})]})]}),k&&B.jsxs("div",{className:"space-y-1",children:[B.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[B.jsxs("span",{children:[k.phase==="wordlist"?"Dictionary":k.phase==="bruteforce"?"Bruteforce":"Public Key",k.phase==="bruteforce"&&` - Length ${k.currentLength}`,": ",k.currentPosition]}),B.jsxs("span",{children:[k.rateKeysPerSec>=1e9?`${(k.rateKeysPerSec/1e9).toFixed(2)} Gkeys/s`:`${(k.rateKeysPerSec/1e6).toFixed(1)} Mkeys/s`," ","• ETA: ",k.etaSeconds<60?`${Math.round(k.etaSeconds)}s`:`${Math.round(k.etaSeconds/60)}m`]})]}),B.jsx("div",{className:"h-2 bg-muted rounded overflow-hidden",children:B.jsx("div",{className:"h-full bg-primary transition-all duration-200",style:{width:`${k.percent}%`}})})]}),D===!1&&B.jsx("div",{className:"text-sm text-destructive",children:"WebGPU not available. Cracking requires Chrome 113+ or Edge 113+."}),!_&&D!==!1&&B.jsx("div",{className:"text-sm text-muted-foreground",children:"Loading wordlist..."}),A.length>0&&B.jsxs("div",{className:"flex-1 overflow-y-auto min-h-0",children:[B.jsx("div",{className:"text-xs text-muted-foreground mb-1",children:"Cracked Rooms:"}),B.jsx("div",{className:"space-y-1",children:A.map((ce,je)=>B.jsxs("div",{className:"text-sm bg-green-950/30 border border-green-900/50 rounded px-2 py-1",children:[B.jsxs("span",{className:"text-green-400 font-medium",children:["#",ce.roomName]}),B.jsxs("span",{className:"text-muted-foreground ml-2 text-xs",children:['"',ce.message.slice(0,50),ce.message.length>50?"...":"",'"']})]},je))})]})]})}const eA=Gy,iA=Qy,nf=E.forwardRef(({className:a,...r},o)=>B.jsx(cl,{className:$e("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",a),...r,ref:o}));nf.displayName=cl.displayName;const aA=rl("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=closed]:duration-300 data-[state=open]:duration-500 data-[state=open]:animate-in data-[state=closed]:animate-out",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),of=E.forwardRef(({side:a="right",className:r,children:o,hideCloseButton:s=!1,...u},l)=>B.jsxs(iA,{children:[B.jsx(nf,{}),B.jsxs(ul,{ref:l,className:$e(aA({side:a}),r),...u,children:[!s&&B.jsxs(Ky,{className:"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-secondary",children:[B.jsx(Xg,{className:"h-4 w-4"}),B.jsx("span",{className:"sr-only",children:"Close"})]}),o]})]}));of.displayName=ul.displayName;const rf=({className:a,...r})=>B.jsx("div",{className:$e("flex flex-col space-y-2 text-center sm:text-left",a),...r});rf.displayName="SheetHeader";const sf=E.forwardRef(({className:a,...r},o)=>B.jsx(dl,{ref:o,className:$e("text-lg font-semibold text-foreground",a),...r}));sf.displayName=dl.displayName;const nA=E.forwardRef(({className:a,...r},o)=>B.jsx(pl,{ref:o,className:$e("text-sm text-muted-foreground",a),...r}));nA.displayName=pl.displayName;function oA(){const a=window.location.hash.slice(1);if(!a)return null;if(a==="raw")return{type:"raw",name:"raw"};const r=a.indexOf("/");if(r===-1)return null;const o=a.slice(0,r),s=decodeURIComponent(a.slice(r+1));return(o==="channel"||o==="contact")&&s?{type:o,name:s}:null}function rA(a){if(!a)return"";if(a.type==="raw")return"#raw";const r=a.type==="channel"&&a.name.startsWith("#")?a.name.slice(1):a.name;return`#${a.type}/${encodeURIComponent(r)}`}function sA(a){const r=rA(a);r!==window.location.hash&&window.history.replaceState(null,"",r||window.location.pathname)}const Wg=500;function tA(){const a=E.useRef(null),r=E.useRef(null),[o,s]=E.useState(null),[u,l]=E.useState(null),[m,c]=E.useState(null),[h,d]=E.useState([]),[g,y]=E.useState([]),[f,w]=E.useState([]),[k,x]=E.useState(null),[v,q]=E.useState(!1),[A,z]=E.useState(!1),[_,C]=E.useState(!1),[D,F]=E.useState(0),[R,M]=E.useState(!1),[P,T]=E.useState(!1),U=E.useRef(null),{messages:H,messagesLoading:K,loadingOlder:ie,hasOlderMessages:Z,setMessages:ae,fetchMessages:W,fetchOlderMessages:ne,addMessageIfNew:X,updateMessageAck:j}=kk(k),{unreadCounts:I,lastMessageTimes:L,incrementUnread:$,markAllRead:le,trackNewMessage:me}=vk(g,h,k),{repeaterLoggedIn:ge,activeContactIsRepeater:oe,handleTelemetryRequest:ce,handleRepeaterCommand:je}=yk(k,h,ae),De=E.useMemo(()=>({onHealth:ee=>{const he=U.current;U.current=ee,s(ee),he!==null&&he.radio_connected!==ee.radio_connected&&(ee.radio_connected?Pr.success("Radio connected",{description:ee.serial_port?`Connected to ${ee.serial_port}`:void 0}):Pr.error("Radio disconnected",{description:"Check radio connection and power"}))},onError:ee=>{Pr.error(ee.message,{description:ee.details})},onContacts:ee=>d(ee),onChannels:ee=>y(ee),onMessage:ee=>{const he=r.current,Be=he?ee.type==="CHAN"&&he.type==="channel"?ee.conversation_key===he.id:ee.type==="PRIV"&&he.type==="contact"?ee.conversation_key&&Kg(he.id,ee.conversation_key):!1:!1;if(Be&&X(ee),me(ee),!ee.outgoing&&!Be){let Ke=null;ee.type==="CHAN"&&ee.conversation_key?Ke=fa("channel",ee.conversation_key):ee.type==="PRIV"&&ee.conversation_key&&(Ke=fa("contact",ee.conversation_key)),Ke&&$(Ke)}},onContact:ee=>{d(he=>{const Be=he.findIndex(Ke=>Ke.public_key===ee.public_key);if(Be>=0){const Ke=[...he],J=he[Be];return Ke[Be]={...J,...ee,name:ee.name??J.name,last_path:ee.last_path??J.last_path,lat:ee.lat??J.lat,lon:ee.lon??J.lon},Ke}return[...he,ee]})},onRawPacket:ee=>{w(he=>{if(he.some(Ke=>Ke.id===ee.id))return he;const Be=[...he,ee];return Be.length>Wg?Be.slice(-Wg):Be})},onMessageAcked:(ee,he)=>{j(ee,he)}}),[X,me,$,j]);pk(De);const Pe=E.useCallback(async()=>{try{const ee=await ei.getRadioConfig();l(ee)}catch(ee){console.error("Failed to fetch config:",ee)}},[]),ai=E.useCallback(async()=>{try{const ee=await ei.getSettings();c(ee)}catch(ee){console.error("Failed to fetch app settings:",ee)}},[]),Re=E.useCallback(async()=>{try{const ee=await ei.getUndecryptedPacketCount();F(ee.count)}catch(ee){console.error("Failed to fetch undecrypted count:",ee)}},[]);E.useEffect(()=>{Pe(),ai(),Re()},[Pe,ai,Re]);const He=E.useCallback(()=>{const ee=oA();if(!ee)return null;if(ee.type==="raw")return{type:"raw",id:"raw",name:"Raw Packet Feed"};if(ee.type==="channel"){const he=g.find(Be=>Be.name===ee.name||Be.name===`#${ee.name}`);if(he)return{type:"channel",id:he.key,name:he.name}}if(ee.type==="contact"){const he=h.find(Be=>Yn(Be.name,Be.public_key)===ee.name);if(he)return{type:"contact",id:he.public_key,name:Yn(he.name,he.public_key)}}return null},[g,h]),Oe=E.useRef(!1);E.useEffect(()=>{if(Oe.current||k||g.length===0&&h.length===0)return;const ee=He();if(ee){x(ee),Oe.current=!0;return}const he=g.find(Be=>Be.name==="Public");he&&(x({type:"channel",id:he.key,name:he.name}),Oe.current=!0)},[g,h,k,He]),E.useEffect(()=>{r.current=k,k&&sA(k)},[k]);const Je=E.useCallback(async ee=>{k&&(k.type==="channel"?await ei.sendChannelMessage(k.id,ee):await ei.sendDirectMessage(k.id,ee),await W())},[k,W]),Ge=E.useCallback(async ee=>{await ei.updateRadioConfig(ee),await Pe()},[Pe]),oi=E.useCallback(async ee=>{await ei.updateSettings(ee),await ai()},[ai]),fi=E.useCallback(async ee=>{await ei.setPrivateKey(ee),await Pe()},[Pe]),ti=E.useCallback(async()=>{await ei.rebootRadio(),s(he=>he&&{...he,radio_connected:!1}),(async()=>{for(let he=0;he<30;he++){await new Promise(Be=>setTimeout(Be,1e3));try{const Be=await ei.getHealth();if(s(Be),Be.radio_connected){Pe();return}}catch{}}})()},[Pe]),Ve=E.useCallback(async()=>{try{await ei.sendAdvertisement(!0)}catch(ee){console.error("Failed to send advertisement:",ee)}},[]),hi=E.useCallback(ee=>{var he;(he=a.current)==null||he.appendText(`@[${ee}] `)},[]),Qi=E.useCallback(ee=>{x(ee),C(!1)},[]),ka=E.useCallback(async ee=>{if(confirm("Delete this channel? Message history will be preserved."))try{await ei.deleteChannel(ee),y(he=>he.filter(Be=>Be.key!==ee)),x(null)}catch(he){console.error("Failed to delete channel:",he)}},[]),ji=E.useCallback(async ee=>{if(confirm("Delete this contact? Message history will be preserved."))try{await ei.deleteContact(ee),d(he=>he.filter(Be=>Be.public_key!==ee)),x(null)}catch(he){console.error("Failed to delete contact:",he)}},[]),Mi=E.useCallback(async(ee,he,Be)=>{const Ke={public_key:he,name:ee,type:0,flags:0,last_path:null,last_path_len:-1,last_advert:null,lat:null,lon:null,last_seen:null,on_radio:!1};d(J=>[...J,Ke]),x({type:"contact",id:he,name:Yn(ee,he)}),Be&&console.log("Contact historical decryption not yet supported")},[]),Ki=E.useCallback(async(ee,he,Be)=>{const Ke=await ei.createChannel(ee,he),J=await ei.getChannels();y(J),x({type:"channel",id:Ke.key,name:ee}),Be&&(await ei.decryptHistoricalPackets({key_type:"channel",channel_key:Ke.key}),Re())},[Re]),oa=E.useCallback(async(ee,he)=>{const Be=ee.startsWith("#")?ee:`#${ee}`,Ke=await ei.createChannel(Be),J=await ei.getChannels();y(J),x({type:"channel",id:Ke.key,name:Be}),he&&(await ei.decryptHistoricalPackets({key_type:"channel",channel_name:Be}),Re())},[Re]),wi=B.jsx(dx,{contacts:h,channels:g,activeConversation:k,onSelectConversation:Qi,onNewMessage:()=>{q(!0),C(!1)},lastMessageTimes:L,unreadCounts:I,showCracker:R,crackerRunning:P,onToggleCracker:()=>M(ee=>!ee),onMarkAllRead:le});return B.jsxs("div",{className:"flex flex-col h-dvh",children:[B.jsx(rw,{health:o,config:u,onConfigClick:()=>z(!0),onAdvertise:Ve,onMenuClick:()=>C(!0)}),B.jsxs("div",{className:"flex flex-1 overflow-hidden",children:[B.jsx("div",{className:"hidden md:block",children:wi}),B.jsx(eA,{open:_,onOpenChange:C,children:B.jsxs(of,{side:"left",className:"w-[280px] p-0 flex flex-col",hideCloseButton:!0,children:[B.jsx(rf,{className:"sr-only",children:B.jsx(sf,{children:"Navigation"})}),B.jsx("div",{className:"flex-1 overflow-hidden",children:wi})]})}),B.jsx("div",{className:"flex-1 flex flex-col bg-background min-w-0",children:k?k.type==="raw"?B.jsxs(B.Fragment,{children:[B.jsx("div",{className:"flex justify-between items-center px-4 py-3 border-b border-border font-medium",children:"Raw Packet Feed"}),B.jsx("div",{className:"flex-1 overflow-hidden",children:B.jsx(W0,{packets:f})})]}):B.jsxs(B.Fragment,{children:[B.jsxs("div",{className:"flex justify-between items-center px-4 py-3 border-b border-border font-medium gap-2",children:[B.jsxs("span",{className:"flex flex-col sm:flex-row sm:items-center sm:gap-2 min-w-0 flex-1",children:[B.jsxs("span",{className:"truncate",children:[k.type==="channel"&&!k.name.startsWith("#")?"#":"",k.name]}),B.jsx("span",{className:"font-normal text-xs text-muted-foreground font-mono truncate",children:k.id})]}),!(k.type==="channel"&&k.name==="Public")&&B.jsx("button",{className:"py-1 px-3 bg-destructive/20 border border-destructive/30 text-destructive rounded text-xs cursor-pointer hover:bg-destructive/30 flex-shrink-0",onClick:()=>{k.type==="channel"?ka(k.id):ji(k.id)},children:"Delete"})]}),B.jsx(mx,{messages:H,contacts:h,loading:K,loadingOlder:ie,hasOlderMessages:Z,onSenderClick:k.type==="channel"?hi:void 0,onLoadOlder:ne,radioName:u==null?void 0:u.name}),B.jsx(hx,{ref:a,onSend:oe?ge?je:ce:Je,disabled:!(o!=null&&o.radio_connected),isRepeaterMode:oe&&!ge,placeholder:o!=null&&o.radio_connected?oe?ge?"Send CLI command (requires admin login)...":`Enter password for ${k.name} (or . for none)...`:`Message ${k.name}...`:"Radio not connected"})]}):B.jsx("div",{className:"flex-1 flex items-center justify-center text-muted-foreground",children:"Select a conversation or start a new one"})})]}),B.jsx("div",{className:$e("border-t border-border bg-background transition-all duration-200 overflow-hidden",R?"h-[275px]":"h-0"),children:B.jsx(Jj,{packets:f,channels:g,onChannelCreate:async(ee,he)=>{const Be=await ei.createChannel(ee,he),Ke=await ei.getChannels();y(Ke),await ei.decryptHistoricalPackets({key_type:"channel",channel_key:Be.key}),Re()},onRunningChange:T})}),B.jsx(F0,{open:v,contacts:h,undecryptedCount:D,onClose:()=>q(!1),onSelectConversation:ee=>{x(ee),q(!1)},onCreateContact:Mi,onCreateChannel:Ki,onCreateHashtagChannel:oa}),B.jsx(L0,{open:A,config:u,appSettings:m,onClose:()=>z(!1),onSave:Ge,onSaveAppSettings:oi,onSetPrivateKey:fi,onReboot:ti}),B.jsx(ow,{position:"top-right"})]})}uk.createRoot(document.getElementById("root")).render(B.jsx(E.StrictMode,{children:B.jsx(tA,{})})); diff --git a/frontend/dist/index.html b/frontend/dist/index.html index 7a15ba2..6988250 100644 --- a/frontend/dist/index.html +++ b/frontend/dist/index.html @@ -13,7 +13,7 @@ - + diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index b612e43..9bb82c6 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -507,7 +507,7 @@ export function App() { -
+
{activeConversation ? ( activeConversation.type === 'raw' ? ( <> @@ -518,19 +518,19 @@ export function App() { ) : ( <> -
- - +
+ + {activeConversation.type === 'channel' && !activeConversation.name.startsWith('#') ? '#' : ''} {activeConversation.name} - + {activeConversation.id} {!(activeConversation.type === 'channel' && activeConversation.name === 'Public') && (