9remote 2.0.1 → 2.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,8 @@
1
+ (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const s of r.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&i(s)}).observe(document,{childList:!0,subtree:!0});function o(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(n){if(n.ep)return;n.ep=!0;const r=o(n);fetch(n.href,r)}})();var Ce,D,tn,$,dt,nn,rn,Ee,_e,ue,on,ot,$e,et,be={},xe=[],bn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,ke=Array.isArray;function G(e,t){for(var o in t)e[o]=t[o];return e}function it(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function xn(e,t,o){var i,n,r,s={};for(r in t)r=="key"?i=t[r]:r=="ref"?n=t[r]:s[r]=t[r];if(arguments.length>2&&(s.children=arguments.length>3?Ce.call(arguments,2):o),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)s[r]===void 0&&(s[r]=e.defaultProps[r]);return ge(e,s,i,n,null)}function ge(e,t,o,i,n){var r={type:e,props:t,key:o,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++tn,__i:-1,__u:0};return n==null&&D.vnode!=null&&D.vnode(r),r}function ee(e){return e.children}function ye(e,t){this.props=e,this.context=t}function le(e,t){if(t==null)return e.__?le(e.__,e.__i+1):null;for(var o;t<e.__k.length;t++)if((o=e.__k[t])!=null&&o.__e!=null)return o.__e;return typeof e.type=="function"?le(e):null}function wn(e){if(e.__P&&e.__d){var t=e.__v,o=t.__e,i=[],n=[],r=G({},t);r.__v=t.__v+1,D.vnode&&D.vnode(r),st(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[o]:null,i,o??le(t),!!(32&t.__u),n),r.__v=t.__v,r.__.__k[r.__i]=r,cn(i,r,n),t.__e=t.__=null,r.__e!=o&&sn(r)}}function sn(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),sn(e)}function ft(e){(!e.__d&&(e.__d=!0)&&$.push(e)&&!we.__r++||dt!=D.debounceRendering)&&((dt=D.debounceRendering)||nn)(we)}function we(){try{for(var e,t=1;$.length;)$.length>t&&$.sort(rn),e=$.shift(),t=$.length,wn(e)}finally{$.length=we.__r=0}}function ln(e,t,o,i,n,r,s,l,a,d,m){var u,h,f,y,b,P,p,g=i&&i.__k||xe,x=t.length;for(a=Nn(o,t,g,a,x),u=0;u<x;u++)(f=o.__k[u])!=null&&(h=f.__i!=-1&&g[f.__i]||be,f.__i=u,P=st(e,f,h,n,r,s,l,a,d,m),y=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&lt(h.ref,null,f),m.push(f.ref,f.__c||y,f)),b==null&&y!=null&&(b=y),(p=!!(4&f.__u))||h.__k===f.__k?(a=an(f,a,e,p),p&&h.__e&&(h.__e=null)):typeof f.type=="function"&&P!==void 0?a=P:y&&(a=y.nextSibling),f.__u&=-7);return o.__e=b,a}function Nn(e,t,o,i,n){var r,s,l,a,d,m=o.length,u=m,h=0;for(e.__k=new Array(n),r=0;r<n;r++)(s=t[r])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[r]=ge(null,s,null,null,null):ke(s)?s=e.__k[r]=ge(ee,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[r]=ge(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[r]=s,a=r+h,s.__=e,s.__b=e.__b+1,l=null,(d=s.__i=Cn(s,o,a,u))!=-1&&(u--,(l=o[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(n>m?h--:n<m&&h++),typeof s.type!="function"&&(s.__u|=4)):d!=a&&(d==a-1?h--:d==a+1?h++:(d>a?h--:h++,s.__u|=4))):e.__k[r]=null;if(u)for(r=0;r<m;r++)(l=o[r])!=null&&(2&l.__u)==0&&(l.__e==i&&(i=le(l)),dn(l,l));return i}function an(e,t,o,i){var n,r;if(typeof e.type=="function"){for(n=e.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=e,t=an(n[r],t,o,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=le(e)),o.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Cn(e,t,o,i){var n,r,s,l=e.key,a=e.type,d=t[o],m=d!=null&&(2&d.__u)==0;if(d===null&&l==null||m&&l==d.key&&a==d.type)return o;if(i>(m?1:0)){for(n=o-1,r=o+1;n>=0||r<t.length;)if((d=t[s=n>=0?n--:r++])!=null&&(2&d.__u)==0&&l==d.key&&a==d.type)return s}return-1}function ht(e,t,o){t[0]=="-"?e.setProperty(t,o??""):e[t]=o==null?"":typeof o!="number"||bn.test(t)?o:o+"px"}function he(e,t,o,i,n){var r,s;e:if(t=="style")if(typeof o=="string")e.style.cssText=o;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)o&&t in o||ht(e.style,t,"");if(o)for(t in o)i&&o[t]==i[t]||ht(e.style,t,o[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(on,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=o,o?i?o[ue]=i[ue]:(o[ue]=ot,e.addEventListener(t,r?et:$e,r)):e.removeEventListener(t,r?et:$e,r);else{if(n=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=o??"";break e}catch{}typeof o=="function"||(o==null||o===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&o==1?"":o))}}function mt(e){return function(t){if(this.l){var o=this.l[t.type+e];if(t[_e]==null)t[_e]=ot++;else if(t[_e]<o[ue])return;return o(D.event?D.event(t):t)}}}function st(e,t,o,i,n,r,s,l,a,d){var m,u,h,f,y,b,P,p,g,x,N,M,v,w,C,_=t.type;if(t.constructor!==void 0)return null;128&o.__u&&(a=!!(32&o.__u),r=[l=t.__e=o.__e]),(m=D.__b)&&m(t);e:if(typeof _=="function")try{if(p=t.props,g=_.prototype&&_.prototype.render,x=(m=_.contextType)&&i[m.__c],N=m?x?x.props.value:m.__:i,o.__c?P=(u=t.__c=o.__c).__=u.__E:(g?t.__c=u=new _(p,N):(t.__c=u=new ye(p,N),u.constructor=_,u.render=Sn),x&&x.sub(u),u.state||(u.state={}),u.__n=i,h=u.__d=!0,u.__h=[],u._sb=[]),g&&u.__s==null&&(u.__s=u.state),g&&_.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=G({},u.__s)),G(u.__s,_.getDerivedStateFromProps(p,u.__s))),f=u.props,y=u.state,u.__v=t,h)g&&_.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),g&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(g&&_.getDerivedStateFromProps==null&&p!==f&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(p,N),t.__v==o.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(p,u.__s,N)===!1){t.__v!=o.__v&&(u.props=p,u.state=u.__s,u.__d=!1),t.__e=o.__e,t.__k=o.__k,t.__k.some(function(k){k&&(k.__=t)}),xe.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&s.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(p,u.__s,N),g&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(f,y,b)})}if(u.context=N,u.props=p,u.__P=e,u.__e=!1,M=D.__r,v=0,g)u.state=u.__s,u.__d=!1,M&&M(t),m=u.render(u.props,u.state,u.context),xe.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,M&&M(t),m=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++v<25);u.state=u.__s,u.getChildContext!=null&&(i=G(G({},i),u.getChildContext())),g&&!h&&u.getSnapshotBeforeUpdate!=null&&(b=u.getSnapshotBeforeUpdate(f,y)),w=m!=null&&m.type===ee&&m.key==null?un(m.props.children):m,l=ln(e,ke(w)?w:[w],t,o,i,n,r,s,l,a,d),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),P&&(u.__E=u.__=null)}catch(k){if(t.__v=null,a||r!=null)if(k.then){for(t.__u|=a?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;r[r.indexOf(l)]=null,t.__e=l}else{for(C=r.length;C--;)it(r[C]);tt(t)}else t.__e=o.__e,t.__k=o.__k,k.then||tt(t);D.__e(k,t,o)}else r==null&&t.__v==o.__v?(t.__k=o.__k,t.__e=o.__e):l=t.__e=kn(o.__e,t,o,i,n,r,s,a,d);return(m=D.diffed)&&m(t),128&t.__u?void 0:l}function tt(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(tt))}function cn(e,t,o){for(var i=0;i<o.length;i++)lt(o[i],o[++i],o[++i]);D.__c&&D.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){D.__e(r,n.__v)}})}function un(e){return typeof e!="object"||e==null||e.__b>0?e:ke(e)?e.map(un):G({},e)}function kn(e,t,o,i,n,r,s,l,a){var d,m,u,h,f,y,b,P=o.props||be,p=t.props,g=t.type;if(g=="svg"?n="http://www.w3.org/2000/svg":g=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),r!=null){for(d=0;d<r.length;d++)if((f=r[d])&&"setAttribute"in f==!!g&&(g?f.localName==g:f.nodeType==3)){e=f,r[d]=null;break}}if(e==null){if(g==null)return document.createTextNode(p);e=document.createElementNS(n,g,p.is&&p),l&&(D.__m&&D.__m(t,r),l=!1),r=null}if(g==null)P===p||l&&e.data==p||(e.data=p);else{if(r=r&&Ce.call(e.childNodes),!l&&r!=null)for(P={},d=0;d<e.attributes.length;d++)P[(f=e.attributes[d]).name]=f.value;for(d in P)f=P[d],d=="dangerouslySetInnerHTML"?u=f:d=="children"||d in p||d=="value"&&"defaultValue"in p||d=="checked"&&"defaultChecked"in p||he(e,d,null,f,n);for(d in p)f=p[d],d=="children"?h=f:d=="dangerouslySetInnerHTML"?m=f:d=="value"?y=f:d=="checked"?b=f:l&&typeof f!="function"||P[d]===f||he(e,d,f,P[d],n);if(m)l||u&&(m.__html==u.__html||m.__html==e.innerHTML)||(e.innerHTML=m.__html),t.__k=[];else if(u&&(e.innerHTML=""),ln(t.type=="template"?e.content:e,ke(h)?h:[h],t,o,i,g=="foreignObject"?"http://www.w3.org/1999/xhtml":n,r,s,r?r[0]:o.__k&&le(o,0),l,a),r!=null)for(d=r.length;d--;)it(r[d]);l||(d="value",g=="progress"&&y==null?e.removeAttribute("value"):y!=null&&(y!==e[d]||g=="progress"&&!y||g=="option"&&y!=P[d])&&he(e,d,y,P[d],n),d="checked",b!=null&&b!=e[d]&&he(e,d,b,P[d],n))}return e}function lt(e,t,o){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(n){D.__e(n,o)}}function dn(e,t,o){var i,n;if(D.unmount&&D.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||lt(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){D.__e(r,t)}i.base=i.__P=null}if(i=e.__k)for(n=0;n<i.length;n++)i[n]&&dn(i[n],t,o||typeof e.type!="function");o||it(e.__e),e.__c=e.__=e.__e=void 0}function Sn(e,t,o){return this.constructor(e,o)}function En(e,t,o){var i,n,r,s;t==document&&(t=document.documentElement),D.__&&D.__(e,t),n=(i=!1)?null:t.__k,r=[],s=[],st(t,e=t.__k=xn(ee,null,[e]),n||be,be,t.namespaceURI,n?null:t.firstChild?Ce.call(t.childNodes):null,r,n?n.__e:t.firstChild,i,s),cn(r,e,s)}Ce=xe.slice,D={__e:function(e,t,o,i){for(var n,r,s;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&r.getDerivedStateFromError!=null&&(n.setState(r.getDerivedStateFromError(e)),s=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,i||{}),s=n.__d),s)return n.__E=n}catch(l){e=l}throw e}},tn=0,ye.prototype.setState=function(e,t){var o;o=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=G({},this.state),typeof e=="function"&&(e=e(G({},o),this.props)),e&&G(o,e),e!=null&&this.__v&&(t&&this._sb.push(t),ft(this))},ye.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ft(this))},ye.prototype.render=ee,$=[],nn=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,rn=function(e,t){return e.__v.__b-t.__v.__b},we.__r=0,Ee=Math.random().toString(8),_e="__d"+Ee,ue="__a"+Ee,on=/(PointerCapture)$|Capture$/i,ot=0,$e=mt(!1),et=mt(!0);var Tn=0;function c(e,t,o,i,n,r){t||(t={});var s,l,a=t;if("ref"in a)for(l in a={},t)l=="ref"?s=t[l]:a[l]=t[l];var d={type:e,props:a,key:o,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Tn,__i:-1,__u:0,__source:n,__self:r};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)a[l]===void 0&&(a[l]=s[l]);return D.vnode&&D.vnode(d),d}var fe,q,Te,pt,Ne=0,fn=[],j=D,_t=j.__b,gt=j.__r,yt=j.diffed,vt=j.__c,bt=j.unmount,xt=j.__;function at(e,t){j.__h&&j.__h(q,e,Ne||t),Ne=0;var o=q.__H||(q.__H={__:[],__h:[]});return e>=o.__.length&&o.__.push({}),o.__[e]}function F(e){return Ne=1,An(mn,e)}function An(e,t,o){var i=at(fe++,2);if(i.t=e,!i.__c&&(i.__=[mn(void 0,t),function(l){var a=i.__N?i.__N[0]:i.__[0],d=i.t(a,l);a!==d&&(i.__N=[d,i.__[1]],i.__c.setState({}))}],i.__c=q,!q.__f)){var n=function(l,a,d){if(!i.__c.__H)return!0;var m=i.__c.__H.__.filter(function(h){return h.__c});if(m.every(function(h){return!h.__N}))return!r||r.call(this,l,a,d);var u=i.__c.props!==l;return m.some(function(h){if(h.__N){var f=h.__[0];h.__=h.__N,h.__N=void 0,f!==h.__[0]&&(u=!0)}}),r&&r.call(this,l,a,d)||u};q.__f=!0;var r=q.shouldComponentUpdate,s=q.componentWillUpdate;q.componentWillUpdate=function(l,a,d){if(this.__e){var m=r;r=void 0,n(l,a,d),r=m}s&&s.call(this,l,a,d)},q.shouldComponentUpdate=n}return i.__N||i.__}function se(e,t){var o=at(fe++,3);!j.__s&&hn(o.__H,t)&&(o.__=e,o.u=t,q.__H.__h.push(o))}function ct(e){return Ne=5,Rn(function(){return{current:e}},[])}function Rn(e,t){var o=at(fe++,7);return hn(o.__H,t)&&(o.__=e(),o.__H=t,o.__h=e),o.__}function In(){for(var e;e=fn.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ve),t.__h.some(nt),t.__h=[]}catch(o){t.__h=[],j.__e(o,e.__v)}}}j.__b=function(e){q=null,_t&&_t(e)},j.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),xt&&xt(e,t)},j.__r=function(e){gt&&gt(e),fe=0;var t=(q=e.__c).__H;t&&(Te===q?(t.__h=[],q.__h=[],t.__.some(function(o){o.__N&&(o.__=o.__N),o.u=o.__N=void 0})):(t.__h.some(ve),t.__h.some(nt),t.__h=[],fe=0)),Te=q},j.diffed=function(e){yt&&yt(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(fn.push(t)!==1&&pt===j.requestAnimationFrame||((pt=j.requestAnimationFrame)||Pn)(In)),t.__H.__.some(function(o){o.u&&(o.__H=o.u),o.u=void 0})),Te=q=null},j.__c=function(e,t){t.some(function(o){try{o.__h.some(ve),o.__h=o.__h.filter(function(i){return!i.__||nt(i)})}catch(i){t.some(function(n){n.__h&&(n.__h=[])}),t=[],j.__e(i,o.__v)}}),vt&&vt(e,t)},j.unmount=function(e){bt&&bt(e);var t,o=e.__c;o&&o.__H&&(o.__H.__.some(function(i){try{ve(i)}catch(n){t=n}}),o.__H=void 0,t&&j.__e(t,o.__v))};var wt=typeof requestAnimationFrame=="function";function Pn(e){var t,o=function(){clearTimeout(i),wt&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(o,35);wt&&(t=requestAnimationFrame(o))}function ve(e){var t=q,o=e.__c;typeof o=="function"&&(e.__c=void 0,o()),q=t}function nt(e){var t=q;e.__c=e.__(),q=t}function hn(e,t){return!e||e.length!==t.length||t.some(function(o,i){return o!==e[i]})}function mn(e,t){return typeof t=="function"?t(e):t}const Bn=[{icon:"download",label:"Preparing",desc:"Checking tunnel binary"},{icon:"cloud_sync",label:"Connecting",desc:"Creating session"},{icon:"lan",label:"Tunneling",desc:"Starting secure tunnel"},{icon:"verified",label:"Verifying",desc:"Health check"},{icon:"check_circle",label:"Ready",desc:"Connected"}],Mn=3;function Dn({currentStep:e,activeDesc:t="",healthCheck:o}){var r;const i=e-1,n=(r=o==null?void 0:o.logs)!=null&&r.length?o.logs[o.logs.length-1]:null;return c("div",{className:"glass-card p-5 flex flex-col gap-4",children:[c("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:"var(--text-muted)"},children:"Setting up connection"}),c("div",{className:"flex flex-col gap-3",children:Bn.map((s,l)=>{const a=l<i,d=l===i,m=d&&l===Mn;let u=d&&t?t:s.desc,h="var(--text-muted)";if(m&&n){const f=/^\d{3}$/.test(String(n.status));u=`#${n.attempt} → ${n.status}`,h=n.ok||n.waiting?"#22c55e":f?"#eab308":"#ef4444"}return c("div",{className:"flex items-center gap-3",children:[c("div",{className:"w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",style:{background:a?"var(--brand-500)":d?"rgba(255,87,10,0.15)":"var(--glass-bg)",border:d?"1.5px solid var(--brand-500)":"1.5px solid transparent"},children:a?c("span",{className:"material-symbols-outlined text-white",style:{fontSize:16},children:"check"}):d?c("span",{className:"flex gap-0.5 items-center",children:[0,1,2].map(f=>c("span",{className:"w-1 h-1 rounded-full bg-orange-400 dot-bounce",style:{animationDelay:`${f*.18}s`}},f))}):c("span",{className:"material-symbols-outlined",style:{fontSize:16,color:"var(--text-muted)",opacity:.3},children:s.icon})}),c("div",{className:"flex-1 min-w-0",children:[c("p",{className:"text-sm font-medium",style:{color:a?"var(--text-muted)":d?"var(--text-main)":"var(--text-muted)",opacity:a||d?1:.4},children:s.label}),c("p",{className:"text-xs mt-0.5 truncate",style:{color:h,opacity:d?m&&n?.95:.7:.4,fontFamily:m&&n?"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace":void 0},children:u})]}),a&&c("span",{className:"text-xs flex-shrink-0",style:{color:"var(--text-muted)"},children:"Done"}),d&&c("span",{className:"text-xs flex-shrink-0 px-2 py-0.5 rounded-full",style:{background:"rgba(255,87,10,0.15)",color:"var(--brand-400)"},children:"Running"})]},l)})})]})}function Ln(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ie={},Ae,Nt;function Un(){return Nt||(Nt=1,Ae=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Ae}var Re={},Z={},Ct;function te(){if(Ct)return Z;Ct=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return Z.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},Z.getSymbolTotalCodewords=function(i){return t[i]},Z.getBCHDigit=function(o){let i=0;for(;o!==0;)i++,o>>>=1;return i},Z.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');e=i},Z.isKanjiModeEnabled=function(){return typeof e<"u"},Z.toSJIS=function(i){return e(i)},Z}var Ie={},kt;function ut(){return kt||(kt=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+o)}}e.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},e.from=function(i,n){if(e.isValid(i))return i;try{return t(i)}catch{return n}}})(Ie)),Ie}var Pe,St;function qn(){if(St)return Pe;St=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const o=Math.floor(t/8);return(this.buffer[o]>>>7-t%8&1)===1},put:function(t,o){for(let i=0;i<o;i++)this.putBit((t>>>o-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const o=Math.floor(this.length/8);this.buffer.length<=o&&this.buffer.push(0),t&&(this.buffer[o]|=128>>>this.length%8),this.length++}},Pe=e,Pe}var Be,Et;function Fn(){if(Et)return Be;Et=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,o,i,n){const r=t*this.size+o;this.data[r]=i,n&&(this.reservedBit[r]=!0)},e.prototype.get=function(t,o){return this.data[t*this.size+o]},e.prototype.xor=function(t,o,i){this.data[t*this.size+o]^=i},e.prototype.isReserved=function(t,o){return this.reservedBit[t*this.size+o]},Be=e,Be}var Me={},Tt;function jn(){return Tt||(Tt=1,(function(e){const t=te().getSymbolSize;e.getRowColCoords=function(i){if(i===1)return[];const n=Math.floor(i/7)+2,r=t(i),s=r===145?26:Math.ceil((r-13)/(2*n-2))*2,l=[r-7];for(let a=1;a<n-1;a++)l[a]=l[a-1]-s;return l.push(6),l.reverse()},e.getPositions=function(i){const n=[],r=e.getRowColCoords(i),s=r.length;for(let l=0;l<s;l++)for(let a=0;a<s;a++)l===0&&a===0||l===0&&a===s-1||l===s-1&&a===0||n.push([r[l],r[a]]);return n}})(Me)),Me}var De={},At;function On(){if(At)return De;At=1;const e=te().getSymbolSize,t=7;return De.getPositions=function(i){const n=e(i);return[[0,0],[n-t,0],[0,n-t]]},De}var Le={},Rt;function Hn(){return Rt||(Rt=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},e.from=function(n){return e.isValid(n)?parseInt(n,10):void 0},e.getPenaltyN1=function(n){const r=n.size;let s=0,l=0,a=0,d=null,m=null;for(let u=0;u<r;u++){l=a=0,d=m=null;for(let h=0;h<r;h++){let f=n.get(u,h);f===d?l++:(l>=5&&(s+=t.N1+(l-5)),d=f,l=1),f=n.get(h,u),f===m?a++:(a>=5&&(s+=t.N1+(a-5)),m=f,a=1)}l>=5&&(s+=t.N1+(l-5)),a>=5&&(s+=t.N1+(a-5))}return s},e.getPenaltyN2=function(n){const r=n.size;let s=0;for(let l=0;l<r-1;l++)for(let a=0;a<r-1;a++){const d=n.get(l,a)+n.get(l,a+1)+n.get(l+1,a)+n.get(l+1,a+1);(d===4||d===0)&&s++}return s*t.N2},e.getPenaltyN3=function(n){const r=n.size;let s=0,l=0,a=0;for(let d=0;d<r;d++){l=a=0;for(let m=0;m<r;m++)l=l<<1&2047|n.get(d,m),m>=10&&(l===1488||l===93)&&s++,a=a<<1&2047|n.get(m,d),m>=10&&(a===1488||a===93)&&s++}return s*t.N3},e.getPenaltyN4=function(n){let r=0;const s=n.data.length;for(let a=0;a<s;a++)r+=n.data[a];return Math.abs(Math.ceil(r*100/s/5)-10)*t.N4};function o(i,n,r){switch(i){case e.Patterns.PATTERN000:return(n+r)%2===0;case e.Patterns.PATTERN001:return n%2===0;case e.Patterns.PATTERN010:return r%3===0;case e.Patterns.PATTERN011:return(n+r)%3===0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2===0;case e.Patterns.PATTERN101:return n*r%2+n*r%3===0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2===0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}e.applyMask=function(n,r){const s=r.size;for(let l=0;l<s;l++)for(let a=0;a<s;a++)r.isReserved(a,l)||r.xor(a,l,o(n,a,l))},e.getBestMask=function(n,r){const s=Object.keys(e.Patterns).length;let l=0,a=1/0;for(let d=0;d<s;d++){r(d),e.applyMask(d,n);const m=e.getPenaltyN1(n)+e.getPenaltyN2(n)+e.getPenaltyN3(n)+e.getPenaltyN4(n);e.applyMask(d,n),m<a&&(a=m,l=d)}return l}})(Le)),Le}var me={},It;function pn(){if(It)return me;It=1;const e=ut(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],o=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return me.getBlocksCount=function(n,r){switch(r){case e.L:return t[(n-1)*4+0];case e.M:return t[(n-1)*4+1];case e.Q:return t[(n-1)*4+2];case e.H:return t[(n-1)*4+3];default:return}},me.getTotalCodewordsCount=function(n,r){switch(r){case e.L:return o[(n-1)*4+0];case e.M:return o[(n-1)*4+1];case e.Q:return o[(n-1)*4+2];case e.H:return o[(n-1)*4+3];default:return}},me}var Ue={},ce={},Pt;function zn(){if(Pt)return ce;Pt=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let i=1;for(let n=0;n<255;n++)e[n]=i,t[i]=n,i<<=1,i&256&&(i^=285);for(let n=255;n<512;n++)e[n]=e[n-255]})(),ce.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},ce.exp=function(i){return e[i]},ce.mul=function(i,n){return i===0||n===0?0:e[t[i]+t[n]]},ce}var Bt;function Kn(){return Bt||(Bt=1,(function(e){const t=zn();e.mul=function(i,n){const r=new Uint8Array(i.length+n.length-1);for(let s=0;s<i.length;s++)for(let l=0;l<n.length;l++)r[s+l]^=t.mul(i[s],n[l]);return r},e.mod=function(i,n){let r=new Uint8Array(i);for(;r.length-n.length>=0;){const s=r[0];for(let a=0;a<n.length;a++)r[a]^=t.mul(n[a],s);let l=0;for(;l<r.length&&r[l]===0;)l++;r=r.slice(l)}return r},e.generateECPolynomial=function(i){let n=new Uint8Array([1]);for(let r=0;r<i;r++)n=e.mul(n,new Uint8Array([1,t.exp(r)]));return n}})(Ue)),Ue}var qe,Mt;function Vn(){if(Mt)return qe;Mt=1;const e=Kn();function t(o){this.genPoly=void 0,this.degree=o,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(i){this.degree=i,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const n=new Uint8Array(i.length+this.degree);n.set(i);const r=e.mod(n,this.genPoly),s=this.degree-r.length;if(s>0){const l=new Uint8Array(this.degree);return l.set(r,s),l}return r},qe=t,qe}var Fe={},je={},Oe={},Dt;function _n(){return Dt||(Dt=1,Oe.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Oe}var J={},Lt;function gn(){if(Lt)return J;Lt=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let o="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";o=o.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+o+`)(?:.|[\r
2
+ ]))+`;J.KANJI=new RegExp(o,"g"),J.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),J.BYTE=new RegExp(i,"g"),J.NUMERIC=new RegExp(e,"g"),J.ALPHANUMERIC=new RegExp(t,"g");const n=new RegExp("^"+o+"$"),r=new RegExp("^"+e+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return J.testKanji=function(a){return n.test(a)},J.testNumeric=function(a){return r.test(a)},J.testAlphanumeric=function(a){return s.test(a)},J}var Ut;function ne(){return Ut||(Ut=1,(function(e){const t=_n(),o=gn();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(r,s){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?r.ccBits[0]:s<27?r.ccBits[1]:r.ccBits[2]},e.getBestModeForData=function(r){return o.testNumeric(r)?e.NUMERIC:o.testAlphanumeric(r)?e.ALPHANUMERIC:o.testKanji(r)?e.KANJI:e.BYTE},e.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},e.isValid=function(r){return r&&r.bit&&r.ccBits};function i(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+n)}}e.from=function(r,s){if(e.isValid(r))return r;try{return i(r)}catch{return s}}})(je)),je}var qt;function Jn(){return qt||(qt=1,(function(e){const t=te(),o=pn(),i=ut(),n=ne(),r=_n(),s=7973,l=t.getBCHDigit(s);function a(h,f,y){for(let b=1;b<=40;b++)if(f<=e.getCapacity(b,y,h))return b}function d(h,f){return n.getCharCountIndicator(h,f)+4}function m(h,f){let y=0;return h.forEach(function(b){const P=d(b.mode,f);y+=P+b.getBitsLength()}),y}function u(h,f){for(let y=1;y<=40;y++)if(m(h,y)<=e.getCapacity(y,f,n.MIXED))return y}e.from=function(f,y){return r.isValid(f)?parseInt(f,10):y},e.getCapacity=function(f,y,b){if(!r.isValid(f))throw new Error("Invalid QR Code version");typeof b>"u"&&(b=n.BYTE);const P=t.getSymbolTotalCodewords(f),p=o.getTotalCodewordsCount(f,y),g=(P-p)*8;if(b===n.MIXED)return g;const x=g-d(b,f);switch(b){case n.NUMERIC:return Math.floor(x/10*3);case n.ALPHANUMERIC:return Math.floor(x/11*2);case n.KANJI:return Math.floor(x/13);case n.BYTE:default:return Math.floor(x/8)}},e.getBestVersionForData=function(f,y){let b;const P=i.from(y,i.M);if(Array.isArray(f)){if(f.length>1)return u(f,P);if(f.length===0)return 1;b=f[0]}else b=f;return a(b.mode,b.getLength(),P)},e.getEncodedBits=function(f){if(!r.isValid(f)||f<7)throw new Error("Invalid QR Code version");let y=f<<12;for(;t.getBCHDigit(y)-l>=0;)y^=s<<t.getBCHDigit(y)-l;return f<<12|y}})(Fe)),Fe}var He={},Ft;function Yn(){if(Ft)return He;Ft=1;const e=te(),t=1335,o=21522,i=e.getBCHDigit(t);return He.getEncodedBits=function(r,s){const l=r.bit<<3|s;let a=l<<10;for(;e.getBCHDigit(a)-i>=0;)a^=t<<e.getBCHDigit(a)-i;return(l<<10|a)^o},He}var ze={},Ke,jt;function Gn(){if(jt)return Ke;jt=1;const e=ne();function t(o){this.mode=e.NUMERIC,this.data=o.toString()}return t.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(i){let n,r,s;for(n=0;n+3<=this.data.length;n+=3)r=this.data.substr(n,3),s=parseInt(r,10),i.put(s,10);const l=this.data.length-n;l>0&&(r=this.data.substr(n),s=parseInt(r,10),i.put(s,l*3+1))},Ke=t,Ke}var Ve,Ot;function Qn(){if(Ot)return Ve;Ot=1;const e=ne(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function o(i){this.mode=e.ALPHANUMERIC,this.data=i}return o.getBitsLength=function(n){return 11*Math.floor(n/2)+6*(n%2)},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(n){let r;for(r=0;r+2<=this.data.length;r+=2){let s=t.indexOf(this.data[r])*45;s+=t.indexOf(this.data[r+1]),n.put(s,11)}this.data.length%2&&n.put(t.indexOf(this.data[r]),6)},Ve=o,Ve}var Je,Ht;function Wn(){if(Ht)return Je;Ht=1;const e=ne();function t(o){this.mode=e.BYTE,typeof o=="string"?this.data=new TextEncoder().encode(o):this.data=new Uint8Array(o)}return t.getBitsLength=function(i){return i*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(o){for(let i=0,n=this.data.length;i<n;i++)o.put(this.data[i],8)},Je=t,Je}var Ye,zt;function Xn(){if(zt)return Ye;zt=1;const e=ne(),t=te();function o(i){this.mode=e.KANJI,this.data=i}return o.getBitsLength=function(n){return n*13},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(i){let n;for(n=0;n<this.data.length;n++){let r=t.toSJIS(this.data[n]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[n]+`
3
+ Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),i.put(r,13)}},Ye=o,Ye}var Ge={exports:{}},Kt;function Zn(){return Kt||(Kt=1,(function(e){var t={single_source_shortest_paths:function(o,i,n){var r={},s={};s[i]=0;var l=t.PriorityQueue.make();l.push(i,0);for(var a,d,m,u,h,f,y,b,P;!l.empty();){a=l.pop(),d=a.value,u=a.cost,h=o[d]||{};for(m in h)h.hasOwnProperty(m)&&(f=h[m],y=u+f,b=s[m],P=typeof s[m]>"u",(P||b>y)&&(s[m]=y,l.push(m,y),r[m]=d))}if(typeof n<"u"&&typeof s[n]>"u"){var p=["Could not find a path from ",i," to ",n,"."].join("");throw new Error(p)}return r},extract_shortest_path_from_predecessor_list:function(o,i){for(var n=[],r=i;r;)n.push(r),o[r],r=o[r];return n.reverse(),n},find_path:function(o,i,n){var r=t.single_source_shortest_paths(o,i,n);return t.extract_shortest_path_from_predecessor_list(r,n)},PriorityQueue:{make:function(o){var i=t.PriorityQueue,n={},r;o=o||{};for(r in i)i.hasOwnProperty(r)&&(n[r]=i[r]);return n.queue=[],n.sorter=o.sorter||i.default_sorter,n},default_sorter:function(o,i){return o.cost-i.cost},push:function(o,i){var n={value:o,cost:i};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Ge)),Ge.exports}var Vt;function $n(){return Vt||(Vt=1,(function(e){const t=ne(),o=Gn(),i=Qn(),n=Wn(),r=Xn(),s=gn(),l=te(),a=Zn();function d(p){return unescape(encodeURIComponent(p)).length}function m(p,g,x){const N=[];let M;for(;(M=p.exec(x))!==null;)N.push({data:M[0],index:M.index,mode:g,length:M[0].length});return N}function u(p){const g=m(s.NUMERIC,t.NUMERIC,p),x=m(s.ALPHANUMERIC,t.ALPHANUMERIC,p);let N,M;return l.isKanjiModeEnabled()?(N=m(s.BYTE,t.BYTE,p),M=m(s.KANJI,t.KANJI,p)):(N=m(s.BYTE_KANJI,t.BYTE,p),M=[]),g.concat(x,N,M).sort(function(w,C){return w.index-C.index}).map(function(w){return{data:w.data,mode:w.mode,length:w.length}})}function h(p,g){switch(g){case t.NUMERIC:return o.getBitsLength(p);case t.ALPHANUMERIC:return i.getBitsLength(p);case t.KANJI:return r.getBitsLength(p);case t.BYTE:return n.getBitsLength(p)}}function f(p){return p.reduce(function(g,x){const N=g.length-1>=0?g[g.length-1]:null;return N&&N.mode===x.mode?(g[g.length-1].data+=x.data,g):(g.push(x),g)},[])}function y(p){const g=[];for(let x=0;x<p.length;x++){const N=p[x];switch(N.mode){case t.NUMERIC:g.push([N,{data:N.data,mode:t.ALPHANUMERIC,length:N.length},{data:N.data,mode:t.BYTE,length:N.length}]);break;case t.ALPHANUMERIC:g.push([N,{data:N.data,mode:t.BYTE,length:N.length}]);break;case t.KANJI:g.push([N,{data:N.data,mode:t.BYTE,length:d(N.data)}]);break;case t.BYTE:g.push([{data:N.data,mode:t.BYTE,length:d(N.data)}])}}return g}function b(p,g){const x={},N={start:{}};let M=["start"];for(let v=0;v<p.length;v++){const w=p[v],C=[];for(let _=0;_<w.length;_++){const k=w[_],T=""+v+_;C.push(T),x[T]={node:k,lastCount:0},N[T]={};for(let A=0;A<M.length;A++){const S=M[A];x[S]&&x[S].node.mode===k.mode?(N[S][T]=h(x[S].lastCount+k.length,k.mode)-h(x[S].lastCount,k.mode),x[S].lastCount+=k.length):(x[S]&&(x[S].lastCount=k.length),N[S][T]=h(k.length,k.mode)+4+t.getCharCountIndicator(k.mode,g))}}M=C}for(let v=0;v<M.length;v++)N[M[v]].end=0;return{map:N,table:x}}function P(p,g){let x;const N=t.getBestModeForData(p);if(x=t.from(g,N),x!==t.BYTE&&x.bit<N.bit)throw new Error('"'+p+'" cannot be encoded with mode '+t.toString(x)+`.
4
+ Suggested mode is: `+t.toString(N));switch(x===t.KANJI&&!l.isKanjiModeEnabled()&&(x=t.BYTE),x){case t.NUMERIC:return new o(p);case t.ALPHANUMERIC:return new i(p);case t.KANJI:return new r(p);case t.BYTE:return new n(p)}}e.fromArray=function(g){return g.reduce(function(x,N){return typeof N=="string"?x.push(P(N,null)):N.data&&x.push(P(N.data,N.mode)),x},[])},e.fromString=function(g,x){const N=u(g,l.isKanjiModeEnabled()),M=y(N),v=b(M,x),w=a.find_path(v.map,"start","end"),C=[];for(let _=1;_<w.length-1;_++)C.push(v.table[w[_]].node);return e.fromArray(f(C))},e.rawSplit=function(g){return e.fromArray(u(g,l.isKanjiModeEnabled()))}})(ze)),ze}var Jt;function er(){if(Jt)return Re;Jt=1;const e=te(),t=ut(),o=qn(),i=Fn(),n=jn(),r=On(),s=Hn(),l=pn(),a=Vn(),d=Jn(),m=Yn(),u=ne(),h=$n();function f(v,w){const C=v.size,_=r.getPositions(w);for(let k=0;k<_.length;k++){const T=_[k][0],A=_[k][1];for(let S=-1;S<=7;S++)if(!(T+S<=-1||C<=T+S))for(let R=-1;R<=7;R++)A+R<=-1||C<=A+R||(S>=0&&S<=6&&(R===0||R===6)||R>=0&&R<=6&&(S===0||S===6)||S>=2&&S<=4&&R>=2&&R<=4?v.set(T+S,A+R,!0,!0):v.set(T+S,A+R,!1,!0))}}function y(v){const w=v.size;for(let C=8;C<w-8;C++){const _=C%2===0;v.set(C,6,_,!0),v.set(6,C,_,!0)}}function b(v,w){const C=n.getPositions(w);for(let _=0;_<C.length;_++){const k=C[_][0],T=C[_][1];for(let A=-2;A<=2;A++)for(let S=-2;S<=2;S++)A===-2||A===2||S===-2||S===2||A===0&&S===0?v.set(k+A,T+S,!0,!0):v.set(k+A,T+S,!1,!0)}}function P(v,w){const C=v.size,_=d.getEncodedBits(w);let k,T,A;for(let S=0;S<18;S++)k=Math.floor(S/3),T=S%3+C-8-3,A=(_>>S&1)===1,v.set(k,T,A,!0),v.set(T,k,A,!0)}function p(v,w,C){const _=v.size,k=m.getEncodedBits(w,C);let T,A;for(T=0;T<15;T++)A=(k>>T&1)===1,T<6?v.set(T,8,A,!0):T<8?v.set(T+1,8,A,!0):v.set(_-15+T,8,A,!0),T<8?v.set(8,_-T-1,A,!0):T<9?v.set(8,15-T-1+1,A,!0):v.set(8,15-T-1,A,!0);v.set(_-8,8,1,!0)}function g(v,w){const C=v.size;let _=-1,k=C-1,T=7,A=0;for(let S=C-1;S>0;S-=2)for(S===6&&S--;;){for(let R=0;R<2;R++)if(!v.isReserved(k,S-R)){let O=!1;A<w.length&&(O=(w[A]>>>T&1)===1),v.set(k,S-R,O),T--,T===-1&&(A++,T=7)}if(k+=_,k<0||C<=k){k-=_,_=-_;break}}}function x(v,w,C){const _=new o;C.forEach(function(R){_.put(R.mode.bit,4),_.put(R.getLength(),u.getCharCountIndicator(R.mode,v)),R.write(_)});const k=e.getSymbolTotalCodewords(v),T=l.getTotalCodewordsCount(v,w),A=(k-T)*8;for(_.getLengthInBits()+4<=A&&_.put(0,4);_.getLengthInBits()%8!==0;)_.putBit(0);const S=(A-_.getLengthInBits())/8;for(let R=0;R<S;R++)_.put(R%2?17:236,8);return N(_,v,w)}function N(v,w,C){const _=e.getSymbolTotalCodewords(w),k=l.getTotalCodewordsCount(w,C),T=_-k,A=l.getBlocksCount(w,C),S=_%A,R=A-S,O=Math.floor(_/A),z=Math.floor(T/A),V=z+1,re=O-z,ae=new a(re);let Y=0;const Q=new Array(A),W=new Array(A);let I=0;const L=new Uint8Array(v.buffer);for(let X=0;X<A;X++){const oe=X<R?z:V;Q[X]=L.slice(Y,Y+oe),W[X]=ae.encode(Q[X]),Y+=oe,I=Math.max(I,oe)}const E=new Uint8Array(_);let B=0,H,U;for(H=0;H<I;H++)for(U=0;U<A;U++)H<Q[U].length&&(E[B++]=Q[U][H]);for(H=0;H<re;H++)for(U=0;U<A;U++)E[B++]=W[U][H];return E}function M(v,w,C,_){let k;if(Array.isArray(v))k=h.fromArray(v);else if(typeof v=="string"){let O=w;if(!O){const z=h.rawSplit(v);O=d.getBestVersionForData(z,C)}k=h.fromString(v,O||40)}else throw new Error("Invalid data");const T=d.getBestVersionForData(k,C);if(!T)throw new Error("The amount of data is too big to be stored in a QR Code");if(!w)w=T;else if(w<T)throw new Error(`
5
+ The chosen QR Code version cannot contain this amount of data.
6
+ Minimum version required to store current data is: `+T+`.
7
+ `);const A=x(w,C,k),S=e.getSymbolSize(w),R=new i(S);return f(R,w),y(R),b(R,w),p(R,C,0),w>=7&&P(R,w),g(R,A),isNaN(_)&&(_=s.getBestMask(R,p.bind(null,R,C))),s.applyMask(_,R),p(R,C,_),{modules:R,version:w,errorCorrectionLevel:C,maskPattern:_,segments:k}}return Re.create=function(w,C){if(typeof w>"u"||w==="")throw new Error("No input text");let _=t.M,k,T;return typeof C<"u"&&(_=t.from(C.errorCorrectionLevel,t.M),k=d.from(C.version),T=s.from(C.maskPattern),C.toSJISFunc&&e.setToSJISFunction(C.toSJISFunc)),M(w,k,_,T)},Re}var Qe={},We={},Yt;function yn(){return Yt||(Yt=1,(function(e){function t(o){if(typeof o=="number"&&(o=o.toString()),typeof o!="string")throw new Error("Color should be defined as hex string");let i=o.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+o);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(r){return[r,r]}))),i.length===6&&i.push("F","F");const n=parseInt(i.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+i.slice(0,6).join("")}}e.getOptions=function(i){i||(i={}),i.color||(i.color={});const n=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,r=i.width&&i.width>=21?i.width:void 0,s=i.scale||4;return{width:r,scale:r?4:s,margin:n,color:{dark:t(i.color.dark||"#000000ff"),light:t(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},e.getScale=function(i,n){return n.width&&n.width>=i+n.margin*2?n.width/(i+n.margin*2):n.scale},e.getImageWidth=function(i,n){const r=e.getScale(i,n);return Math.floor((i+n.margin*2)*r)},e.qrToImageData=function(i,n,r){const s=n.modules.size,l=n.modules.data,a=e.getScale(s,r),d=Math.floor((s+r.margin*2)*a),m=r.margin*a,u=[r.color.light,r.color.dark];for(let h=0;h<d;h++)for(let f=0;f<d;f++){let y=(h*d+f)*4,b=r.color.light;if(h>=m&&f>=m&&h<d-m&&f<d-m){const P=Math.floor((h-m)/a),p=Math.floor((f-m)/a);b=u[l[P*s+p]?1:0]}i[y++]=b.r,i[y++]=b.g,i[y++]=b.b,i[y]=b.a}}})(We)),We}var Gt;function tr(){return Gt||(Gt=1,(function(e){const t=yn();function o(n,r,s){n.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=s,r.width=s,r.style.height=s+"px",r.style.width=s+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(r,s,l){let a=l,d=s;typeof a>"u"&&(!s||!s.getContext)&&(a=s,s=void 0),s||(d=i()),a=t.getOptions(a);const m=t.getImageWidth(r.modules.size,a),u=d.getContext("2d"),h=u.createImageData(m,m);return t.qrToImageData(h.data,r,a),o(u,d,m),u.putImageData(h,0,0),d},e.renderToDataURL=function(r,s,l){let a=l;typeof a>"u"&&(!s||!s.getContext)&&(a=s,s=void 0),a||(a={});const d=e.render(r,s,a),m=a.type||"image/png",u=a.rendererOpts||{};return d.toDataURL(m,u.quality)}})(Qe)),Qe}var Xe={},Qt;function nr(){if(Qt)return Xe;Qt=1;const e=yn();function t(n,r){const s=n.a/255,l=r+'="'+n.hex+'"';return s<1?l+" "+r+'-opacity="'+s.toFixed(2).slice(1)+'"':l}function o(n,r,s){let l=n+r;return typeof s<"u"&&(l+=" "+s),l}function i(n,r,s){let l="",a=0,d=!1,m=0;for(let u=0;u<n.length;u++){const h=Math.floor(u%r),f=Math.floor(u/r);!h&&!d&&(d=!0),n[u]?(m++,u>0&&h>0&&n[u-1]||(l+=d?o("M",h+s,.5+f+s):o("m",a,0),a=0,d=!1),h+1<r&&n[u+1]||(l+=o("h",m),m=0)):a++}return l}return Xe.render=function(r,s,l){const a=e.getOptions(s),d=r.modules.size,m=r.modules.data,u=d+a.margin*2,h=a.color.light.a?"<path "+t(a.color.light,"fill")+' d="M0 0h'+u+"v"+u+'H0z"/>':"",f="<path "+t(a.color.dark,"stroke")+' d="'+i(m,d,a.margin)+'"/>',y='viewBox="0 0 '+u+" "+u+'"',P='<svg xmlns="http://www.w3.org/2000/svg" '+(a.width?'width="'+a.width+'" height="'+a.width+'" ':"")+y+' shape-rendering="crispEdges">'+h+f+`</svg>
8
+ `;return typeof l=="function"&&l(null,P),P},Xe}var Wt;function rr(){if(Wt)return ie;Wt=1;const e=Un(),t=er(),o=tr(),i=nr();function n(r,s,l,a,d){const m=[].slice.call(arguments,1),u=m.length,h=typeof m[u-1]=="function";if(!h&&!e())throw new Error("Callback required as last argument");if(h){if(u<2)throw new Error("Too few arguments provided");u===2?(d=l,l=s,s=a=void 0):u===3&&(s.getContext&&typeof d>"u"?(d=a,a=void 0):(d=a,a=l,l=s,s=void 0))}else{if(u<1)throw new Error("Too few arguments provided");return u===1?(l=s,s=a=void 0):u===2&&!s.getContext&&(a=l,l=s,s=void 0),new Promise(function(f,y){try{const b=t.create(l,a);f(r(b,s,a))}catch(b){y(b)}})}try{const f=t.create(l,a);d(null,r(f,s,a))}catch(f){d(f)}}return ie.create=t.create,ie.toCanvas=n.bind(null,o.render),ie.toDataURL=n.bind(null,o.renderToDataURL),ie.toString=n.bind(null,function(r,s,l){return i.render(r,l)}),ie}var or=rr();const ir=Ln(or);function de({message:e,confirmLabel:t="Confirm",confirmDanger:o=!1,onConfirm:i,onCancel:n}){return c("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},children:c("div",{className:"glass-card p-5 flex flex-col gap-4 w-72",children:[c("p",{className:"text-sm text-center",style:{color:"var(--text-main)"},children:e}),c("div",{className:"flex gap-2",children:[c("button",{onClick:n,className:"glass-btn flex-1 py-2 text-sm",style:{color:"var(--text-muted)"},children:"Cancel"}),c("button",{onClick:i,className:"flex-1 py-2 text-sm font-semibold rounded-xl",style:{background:o?"rgba(220,53,69,0.8)":"var(--brand-500)",color:"#fff"},children:t})]})]})})}const Xt="9remote.cc";function sr(e){if(e<=0)return"Expired";const t=Math.floor(e/1e3),o=Math.floor(t/60),i=t%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}`}function pe({icon:e,onClick:t,title:o,danger:i}){return c("button",{onClick:t,title:o,className:"glass-btn w-7 h-7 flex items-center justify-center flex-shrink-0",style:i?{color:"rgba(255,100,100,0.7)"}:{color:"var(--text-muted)"},children:c("span",{className:"material-symbols-outlined",style:{fontSize:15},children:e})})}function Zt({qrUrl:e,oneTimeKey:t,oneTimeKeyExpiresAt:o,permanentKey:i,onGenerateOneTimeKey:n,onRegenerateKey:r}){const s=ct(null),[l,a]=F(null),[d,m]=F(null),[u,h]=F(null);se(()=>{!e||!s.current||ir.toCanvas(s.current,e,{width:160,margin:1,color:{dark:"#0f1923",light:"#ffffff"}}).catch(()=>{})},[e]),se(()=>{if(!o){a(null);return}const y=()=>a(o-Date.now());y();const b=setInterval(y,1e3);return()=>clearInterval(b)},[o]);const f=(y,b)=>{navigator.clipboard.writeText(y).catch(()=>{}),m(b),setTimeout(()=>m(null),2e3)};return c(ee,{children:[u==="oneTime"&&c(de,{message:"Generate a new one-time key? The current one will expire immediately.",confirmLabel:"Generate",onConfirm:()=>{h(null),n==null||n()},onCancel:()=>h(null)}),u==="regen"&&c(de,{message:"Regenerate permanent key? All existing sessions will be disconnected.",confirmLabel:"Regenerate",confirmDanger:!0,onConfirm:()=>{h(null),r==null||r()},onCancel:()=>h(null)}),c("div",{className:"glass-card p-5 flex flex-col items-center gap-4",children:[c("div",{className:"w-44 h-44 rounded-xl overflow-hidden bg-white p-2 flex items-center justify-center flex-shrink-0",children:e?c("canvas",{ref:s}):c("span",{className:"material-symbols-outlined text-gray-300 text-6xl",children:"qr_code_2"})}),c("div",{className:"flex flex-col items-center gap-1",children:[c("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Scan QR or open link to sign in"}),c("a",{href:`https://${Xt}/login`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 hover:underline transition-opacity",children:[c("span",{className:"w-2 h-2 rounded-full bg-green-400 flex-shrink-0"}),c("span",{className:"text-sm font-bold",style:{color:"var(--brand-500)"},children:[Xt,"/login"]}),c("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:14,color:"var(--brand-500)"},children:"open_in_new"})]})]}),c("div",{className:"w-full h-px",style:{background:"var(--border)"}}),c("div",{className:"w-full flex flex-col gap-1.5",children:[c("div",{className:"flex items-center justify-between px-0.5",children:[c("span",{className:"text-xs font-medium",style:{color:"var(--text-muted)"},children:"One-Time Key"}),c("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Single use · expires"})]}),c("div",{className:"w-full flex items-center gap-2 dark-card px-3 py-2.5",children:[c("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:16,color:"var(--text-muted)"},children:"timer"}),c("span",{className:"flex-1 font-mono font-bold tracking-[0.18em] text-base truncate",style:{color:t?"var(--brand-500)":"var(--border)"},children:t||"• • • • • •"}),l!==null&&c("span",{className:`text-xs font-mono flex-shrink-0 ${l<=0?"text-red-400":""}`,style:l>0?{color:"var(--text-muted)"}:{},children:sr(l)}),t&&c(pe,{icon:d==="oneTime"?"check":"content_copy",onClick:()=>f(t,"oneTime"),title:"Copy one-time key"}),c(pe,{icon:"refresh",onClick:()=>h("oneTime"),title:"New one-time key"})]})]}),c("div",{className:"w-full flex flex-col gap-1.5",children:[c("div",{className:"flex items-center justify-between px-0.5",children:[c("span",{className:"text-xs font-medium",style:{color:"var(--text-muted)"},children:"Permanent Key"}),c("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Reusable · no expiry"})]}),c("div",{className:"w-full flex items-center gap-2 dark-card px-3 py-2.5",children:[c("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:16,color:"var(--text-muted)"},children:"key"}),c("span",{className:"flex-1 font-mono text-xs truncate",style:{color:"var(--text-muted)"},children:i||"— not set —"}),i&&c(pe,{icon:d==="permanent"?"check":"content_copy",onClick:()=>f(i,"permanent"),title:"Copy permanent key"}),c(pe,{icon:"autorenew",onClick:()=>h("regen"),title:"Regenerate permanent key",danger:!0})]})]})]})]})}const lr="https://docs.9remote.cc/",vn={screenRecording:{label:"Screen Recording",icon:"screenshot_monitor",desc:"Capture screen content"},accessibility:{label:"Accessibility",icon:"accessibility_new",desc:"Control mouse & keyboard"}};function ar({type:e,granted:t,onRequest:o}){const i=vn[e]||{label:e,desc:""};return c("div",{className:"flex items-center gap-3 py-2 border-b last:border-0",style:{borderColor:"var(--border)"},children:[c("span",{className:`material-symbols-outlined flex-shrink-0 ${t?"text-green-400":""}`,style:{fontSize:18,color:t?void 0:"var(--text-muted)"},children:t?"check_circle":"cancel"}),c("div",{className:"flex-1 min-w-0",children:[c("p",{className:"text-xs font-medium",style:{color:t?"var(--text-main)":"var(--text-muted)"},children:i.label}),c("p",{className:"text-[10px] leading-4",style:{color:"var(--text-muted)"},children:i.desc})]}),!t&&c("button",{onClick:()=>o(e),title:"Click to grant permission",className:"flex-shrink-0 w-11 h-6 rounded-full transition-all relative",style:{background:"var(--border)",cursor:"pointer"},children:c("span",{className:"absolute top-0.5 w-5 h-5 rounded-full bg-white transition-all",style:{left:"2px",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"}})})]})}function cr({desktopEnabled:e,onDesktopToggle:t,permissions:o,onRequestPermission:i}){const n=Object.entries(vn),s=!n.every(([l])=>!!(o!=null&&o[l]))&&!e;return c("div",{className:"glass-card p-4 flex flex-col gap-3",children:[c("div",{className:"flex items-center gap-3",children:[c("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:"rgba(255,87,10,0.15)"},children:c("span",{className:"material-symbols-outlined",style:{fontSize:20,color:"var(--brand-400)"},children:"terminal"})}),c("div",{className:"flex-1 min-w-0",children:[c("p",{className:"text-sm font-semibold",style:{color:"var(--text-main)"},children:"Remote Terminal"}),c("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Full shell access · always on"})]}),c("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-full",style:{background:"rgba(74,222,128,0.1)"},children:[c("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400"}),c("span",{className:"text-xs text-green-400 font-medium",children:"On"})]})]}),c("div",{className:"w-full h-px",style:{background:"var(--border)"}}),c("div",{className:"flex items-center gap-3",children:[c("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:e?"rgba(255,87,10,0.15)":"var(--glass-bg)"},children:c("span",{className:"material-symbols-outlined",style:{fontSize:20,color:e?"var(--brand-400)":"var(--text-muted)"},children:"desktop_windows"})}),c("div",{className:"flex-1 min-w-0",children:[c("p",{className:"text-sm font-semibold",style:{color:"var(--text-main)"},children:"Remote Desktop"}),c("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Control screen, mouse & keyboard"})]}),c("button",{onClick:s?void 0:t,disabled:s,title:s?"Grant all permissions below to enable":"",className:"flex-shrink-0 w-11 h-6 rounded-full transition-all relative",style:{background:e?"var(--brand-500)":"var(--border)",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"},children:c("span",{className:"absolute top-0.5 w-5 h-5 rounded-full bg-white transition-all",style:{left:e?"calc(100% - 22px)":"2px",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"}})})]}),c("div",{className:"flex flex-col border-t pt-2",style:{borderColor:"var(--border)"},children:[c("p",{className:"text-[10px] uppercase tracking-wider mb-1",style:{color:"var(--text-muted)"},children:"System Permissions"}),n.map(([l])=>c(ar,{type:l,granted:(o==null?void 0:o[l])??!1,onRequest:i},l))]})]})}function ur({version:e}){return e?c("div",{className:"px-5 py-2 flex items-center gap-2 border-b",style:{background:"rgba(255,87,10,0.08)",borderColor:"rgba(255,87,10,0.2)"},children:[c("span",{className:"material-symbols-outlined text-sm flex-shrink-0",style:{color:"var(--brand-400)"},children:"system_update"}),c("span",{className:"text-xs flex-1",style:{color:"var(--brand-400)"},children:["Version ",e," available"]}),c("button",{onClick:()=>fetch("/api/update",{method:"POST"}).catch(()=>{}),className:"flex-shrink-0 text-xs px-2 py-0.5 rounded font-medium",style:{background:"rgba(255,87,10,0.15)",color:"var(--brand-400)"},children:"Update"})]}):null}const dr=[{icon:"terminal",label:"Terminal",desc:"Full shell access"},{icon:"desktop_windows",label:"Desktop",desc:"Remote screen control"},{icon:"folder_open",label:"Files",desc:"Browse & edit files"}],fr=[{icon:"qr_code_scanner",text:"Scan QR to connect instantly"},{icon:"wifi_off",text:"No port forwarding needed"},{icon:"devices",text:"Works on any device"}];function hr({onStart:e}){const[t,o]=F(!1),i=()=>{o(!0),e()};return c("div",{className:"flex-1 flex flex-col items-center justify-between px-6 py-6 overflow-y-auto",children:[c("div",{className:"flex flex-col items-center gap-2 text-center mt-2",children:[c("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mb-1",style:{background:"var(--brand-500)",boxShadow:"0 8px 32px rgba(255,87,10,0.35)"},children:c("span",{className:"material-symbols-outlined text-white",style:{fontSize:30},children:"terminal"})}),c("h1",{className:"text-lg font-bold tracking-tight",style:{color:"var(--text-main)"},children:"9Remote"}),c("p",{className:"text-xs leading-5 max-w-[220px]",style:{color:"var(--text-muted)"},children:"Access your terminal, desktop & files from anywhere"})]}),c("div",{className:"flex gap-2 w-full mt-5",children:dr.map(n=>c("div",{className:"flex-1 dark-card flex flex-col items-center gap-1.5 py-3 px-1",children:[c("span",{className:"material-symbols-outlined",style:{fontSize:22,color:"var(--brand-400)"},children:n.icon}),c("p",{className:"text-xs font-semibold",style:{color:"var(--text-main)"},children:n.label}),c("p",{className:"text-[10px] text-center leading-4",style:{color:"var(--text-muted)"},children:n.desc})]},n.label))}),c("div",{className:"flex flex-col gap-2 w-full mt-4",children:fr.map(n=>c("div",{className:"flex items-center gap-2.5",children:[c("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:16,color:"var(--brand-400)"},children:n.icon}),c("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:n.text})]},n.text))}),c("button",{onClick:t?void 0:i,disabled:t,className:"btn-primary w-full py-3.5 flex items-center justify-center gap-2 text-sm font-semibold mt-6",style:{borderRadius:"var(--radius-brand)",opacity:t?.7:1},children:t?c(ee,{children:[c("span",{className:"flex gap-0.5 items-center",children:[0,1,2].map(n=>c("span",{className:"w-1.5 h-1.5 rounded-full bg-white dot-bounce",style:{animationDelay:`${n*.18}s`}},n))}),"Connecting..."]}):c(ee,{children:[c("span",{className:"material-symbols-outlined text-base",children:"play_arrow"}),"Connect"]})})]})}function mr(e,t,o=[]){const i=new Map;for(const l of t){if(!l.deviceId)continue;const a=i.get(l.deviceId);(!a||l.connectedAt&&l.connectedAt<a.connectedAt)&&i.set(l.deviceId,l)}const n=e.map(l=>{const a=i.get(l.deviceId);return{deviceId:l.deviceId,status:a?"online":"offline",ip:(a==null?void 0:a.ip)||null,connectedAt:(a==null?void 0:a.connectedAt)||null,approvedAt:l.approvedAt||null}}),r=o.map(l=>({deviceId:l.deviceId,status:"pending",ip:l.ip||null,connectedAt:null,approvedAt:null,rejectedAt:l.rejectedAt||null})),s={online:0,pending:1,offline:2};return[...n,...r].sort((l,a)=>s[l.status]-s[a.status])}const $t={online:{color:"#4ade80",icon:"wifi",title:"Online"},offline:{color:"var(--text-muted)",icon:"wifi_off",title:"Offline"},pending:{color:"#f59e0b",icon:"hourglass_top",title:"Pending approval"}};function pr({client:e,onRemove:t,onApprove:o}){const i=`${e.deviceId.slice(0,8)}...`,n=$t[e.status]||$t.offline,r=e.status==="online"?`Connected · ${e.connectedAt?new Date(e.connectedAt).toLocaleTimeString():""}`:e.status==="pending"?"Pending · waiting for approval":e.approvedAt?`Offline · approved ${new Date(e.approvedAt).toLocaleDateString()}`:"Offline",s=e.status==="online"?"Disconnect":"Remove";return c("div",{className:"flex items-center gap-3 py-2 border-b last:border-0",style:{borderColor:"var(--border)"},children:[c("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:18,color:n.color},title:n.title,children:n.icon}),c("div",{className:"flex-1 min-w-0",children:[c("p",{className:"text-xs font-medium font-mono truncate",style:{color:"var(--text-main)"},children:[i,e.ip?` · ${e.ip}`:""]}),c("p",{className:"text-[10px]",style:{color:"var(--text-muted)"},children:r})]}),e.status==="pending"&&c("button",{onClick:()=>o==null?void 0:o(e),className:"flex-shrink-0 text-xs px-2 py-1 rounded-lg font-medium",style:{background:"rgba(74,222,128,0.15)",color:"#4ade80"},title:"Approve this device",children:"Approve"}),c("button",{onClick:()=>t(e),className:"flex-shrink-0 text-xs px-2 py-1 rounded-lg font-medium",style:{background:"rgba(220,53,69,0.15)",color:"#dc3545"},title:"Disconnect and remove this device",children:s})]})}function _r({step:e,stepDesc:t="",healthCheck:o,tunnelUrl:i,oneTimeKey:n,oneTimeKeyExpiresAt:r,permanentKey:s,qrUrl:l,permissions:a,desktopEnabled:d,updateVersion:m,connections:u=[],version:h="",onRequestPermission:f,onDesktopToggle:y,onStop:b,onStart:P,onShutdown:p,onGenerateOneTimeKey:g,onRegenerateKey:x,logs:N=[],theme:M,onToggleTheme:v,pendingDevice:w,onDeviceApprove:C,onDeviceReject:_,approvedDevices:k=[],rejectedDevices:T=[],onDeviceRemove:A,onFetchDevices:S,onDeviceApproveRejected:R,autoApprove:O=!1,onAutoApproveToggle:z}){var oe;const[V,re]=F("connect"),[ae,Y]=F(!1),[Q,W]=F(!1),[I,L]=F(null),E=ct(null),B=e===0,H=e>0&&e<5;se(()=>{var K;V==="log"&&((K=E.current)==null||K.scrollIntoView({behavior:"smooth"})),V==="connect"&&(S==null||S())},[N,V,u.length]);const U=mr(k,u,T),X=U.filter(K=>K.status==="online").length;return c("div",{className:"h-full flex flex-col relative overflow-hidden",style:{background:"var(--bg-body)"},children:[c("div",{className:"flex-1 flex flex-col w-full min-h-0 dot-grid-bg overflow-hidden md:max-w-5xl p-3",style:{margin:"0 auto"},children:[c("div",{className:"flex items-center justify-between px-5 py-4",style:{boxShadow:"var(--header-shadow)",backdropFilter:"blur(10px)"},children:[c("div",{className:"flex items-center gap-3",children:[c("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--brand-500)"},children:c("span",{className:"material-symbols-outlined text-white text-base",children:"terminal"})}),c("div",{className:"flex flex-col leading-tight",children:[c("span",{className:"brand-text text-xs",children:"9Remote"}),h&&c("span",{className:"text-[10px]",style:{color:"var(--text-muted)"},children:["v",h]})]})]}),c("div",{className:"flex items-center gap-2",children:[c("button",{onClick:v,className:"glass-btn w-7 h-7 flex items-center justify-center",style:{color:"var(--text-muted)"},title:M==="dark"?"Switch to light mode":"Switch to dark mode",children:c("span",{className:"material-symbols-outlined text-sm",children:M==="dark"?"light_mode":"dark_mode"})}),c("button",{onClick:()=>window.open(lr,"_blank"),className:"glass-btn w-7 h-7 flex items-center justify-center",style:{color:"var(--text-muted)"},children:c("span",{className:"material-symbols-outlined text-sm",children:"help_outline"})}),!B&&c("button",{onClick:()=>Y(!0),className:"btn-danger px-3 h-7 flex items-center gap-1.5 text-xs font-medium",children:[c("span",{className:"material-symbols-outlined text-sm",children:"stop_circle"}),"Disconnect"]}),c("button",{onClick:()=>W(!0),className:"glass-btn w-7 h-7 flex items-center justify-center",style:{color:"var(--text-muted)"},title:"Shutdown 9Remote (stop server, tunnel and quit)",children:c("span",{className:"material-symbols-outlined text-sm",children:"power_settings_new"})})]})]}),c(ur,{version:m}),B?c(hr,{onStart:P,connecting:!1}):H?c("div",{className:"flex-1 overflow-y-auto px-5 py-4 flex flex-col gap-4 max-w-2xl mx-auto w-full",children:c(Dn,{currentStep:e,activeDesc:t,healthCheck:o})}):c("div",{className:"flex-1 flex flex-col md:flex-row min-h-0",children:[c("div",{className:"hidden md:flex md:flex-col sidebar w-96 flex-shrink-0 overflow-y-auto p-5 gap-4",children:c(Zt,{qrUrl:l,oneTimeKey:n,oneTimeKeyExpiresAt:r,permanentKey:s,tunnelUrl:i,onGenerateOneTimeKey:g,onRegenerateKey:x})}),c("div",{className:"flex-1 flex flex-col min-h-0",children:[c("div",{className:"flex px-5 pt-3 gap-3",style:{borderColor:"var(--border)"},children:[{id:"connect",label:"Connection"},{id:"log",label:"Logs"}].map(K=>c("button",{onClick:()=>re(K.id),className:"py-2 text-xs font-medium border-b-2 transition-colors",style:V===K.id?{borderColor:"var(--brand-500)",color:"var(--brand-500)"}:{borderColor:"transparent",color:"var(--text-muted)"},children:K.label},K.id))}),c("div",{className:"flex-1 overflow-y-auto px-5 py-4 flex flex-col gap-4",children:[V==="connect"&&c(ee,{children:[c("div",{className:"md:hidden",children:c(Zt,{qrUrl:l,oneTimeKey:n,oneTimeKeyExpiresAt:r,permanentKey:s,tunnelUrl:i,onGenerateOneTimeKey:g,onRegenerateKey:x})}),c(cr,{desktopEnabled:d,onDesktopToggle:y,permissions:a,onRequestPermission:f}),c("div",{className:"glass-card p-4 flex flex-col gap-1",children:[c("p",{className:"text-xs font-medium uppercase tracking-wider mb-2",style:{color:"var(--text-muted)"},children:["Clients",U.length>0?` (${X}/${U.length} online)`:""]}),c("div",{className:"flex items-center gap-3 py-2 border-b",style:{borderColor:"var(--border)"},children:[c("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:18,color:O?"var(--brand-400)":"var(--text-muted)"},children:O?"lock_open":"lock"}),c("div",{className:"flex-1 min-w-0",children:[c("p",{className:"text-xs font-medium",style:{color:"var(--text-main)"},children:"Auto-approve new devices"}),c("p",{className:"text-[10px] leading-4",style:{color:"var(--text-muted)"},children:O?"Any new device connects without approval":"Require manual approval for new devices"})]}),c("button",{onClick:z,title:O?"Disable auto-approve":"Enable auto-approve",className:"flex-shrink-0 w-11 h-6 rounded-full transition-all relative",style:{background:O?"var(--brand-500)":"var(--border)",cursor:"pointer"},children:c("span",{className:"absolute top-0.5 w-5 h-5 rounded-full bg-white transition-all",style:{left:O?"calc(100% - 22px)":"2px",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"}})})]}),U.length===0?c("p",{className:"text-xs text-center py-3",style:{color:"var(--text-muted)"},children:"No clients yet"}):U.map(K=>c(pr,{client:K,onRemove:L,onApprove:Se=>R==null?void 0:R(Se.deviceId)},K.deviceId))]})]}),V==="log"&&c("div",{className:"flex-1 flex flex-col",children:N.length===0?c("p",{className:"text-xs text-center mt-8",style:{color:"var(--text-muted)"},children:"No logs yet"}):c("div",{className:"flex flex-col gap-0.5",children:[N.map((K,Se)=>c("p",{className:"text-xs font-mono leading-5 break-all",style:{color:"var(--text-muted)"},children:K},Se)),c("div",{ref:E})]})})]})]})]})]}),ae&&c(de,{message:"Disconnect and stop the tunnel? Remote clients will be disconnected.",confirmLabel:"Disconnect",confirmDanger:!0,onConfirm:()=>{Y(!1),b==null||b()},onCancel:()=>Y(!1)}),Q&&c(de,{message:"Shutdown 9Remote completely? This will stop the server, close the tunnel and quit the app.",confirmLabel:"Shutdown",confirmDanger:!0,onConfirm:()=>{W(!1),p==null||p()},onCancel:()=>W(!1)}),I&&c(de,{message:I.status==="online"?`Disconnect and remove device ${I.deviceId.slice(0,8)}...? The client will be disconnected and need approval again next time.`:I.status==="pending"?`Remove pending device ${I.deviceId.slice(0,8)}...? It will need a fresh approval request to connect again.`:`Remove device ${I.deviceId.slice(0,8)}...? It will need approval again next time.`,confirmLabel:I.status==="online"?"Disconnect & Remove":"Remove",confirmDanger:!0,onConfirm:()=>{A==null||A(I),L(null)},onCancel:()=>L(null)}),w&&c("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},children:c("div",{className:"glass-card p-5 flex flex-col gap-4 w-80",children:[c("div",{className:"flex items-center gap-2",children:[c("span",{className:"material-symbols-outlined",style:{color:"var(--brand-500)",fontSize:24},children:"devices"}),c("span",{className:"text-sm font-semibold",style:{color:"var(--text-main)"},children:"New Device Connection"})]}),c("div",{className:"flex flex-col gap-1 text-xs",style:{color:"var(--text-muted)"},children:[c("span",{children:["Device: ",c("span",{style:{color:"var(--text-main)"},children:[(oe=w.deviceId)==null?void 0:oe.slice(0,8),"..."]})]}),c("span",{children:["IP: ",c("span",{style:{color:"var(--text-main)"},children:w.ip})]})]}),c("div",{className:"flex gap-2",children:[c("button",{onClick:_,className:"glass-btn flex-1 py-2 text-sm",style:{color:"var(--text-muted)"},children:"Reject"}),c("button",{onClick:C,className:"flex-1 py-2 text-sm font-semibold rounded-xl",style:{background:"var(--brand-500)",color:"#fff"},children:"Approve"})]})]})})]})}const gr=3e3,rt={running:!1,timeoutMs:0,startedAt:null,logs:[]},Ze={step:0,stepDesc:"",tunnelUrl:"",oneTimeKey:"",oneTimeKeyExpiresAt:null,permanentKey:"",qrUrl:"",latency:null,uptime:null,healthCheck:rt},yr={screenRecording:!1,accessibility:!1},en=200;function vr(){const[e,t]=F(Ze),[o,i]=F(yr),[n,r]=F(!1),[s,l]=F([]),[a,d]=F(null),[m,u]=F([]),[h,f]=F(null),[y,b]=F([]),[P,p]=F([]),[g,x]=F(!1),[N,M]=F(""),[v,w]=F(()=>localStorage.getItem("9remote-theme")||"dark");se(()=>{document.documentElement.setAttribute("data-theme",v),localStorage.setItem("9remote-theme",v)},[v]);const C=()=>{w(I=>I==="dark"?"light":"dark")};se(()=>{fetch("/api/version").then(E=>E.json()).then(E=>M(E.version??"")).catch(()=>{}),fetch("/api/ui/state").then(E=>E.json()).then(E=>{t({step:E.step??0,stepDesc:E.stepDesc??"",tunnelUrl:E.tunnelUrl??"",oneTimeKey:E.oneTimeKey??"",oneTimeKeyExpiresAt:E.oneTimeKeyExpiresAt??null,permanentKey:E.permanentKey??"",qrUrl:E.qrUrl??"",latency:E.latency??null,uptime:E.uptime??null,healthCheck:E.healthCheck??rt}),i({screenRecording:E.screenRecording??!1,accessibility:E.accessibility??!1}),E.desktopEnabled!==void 0&&r(E.desktopEnabled),E.theme&&(E.theme==="light"||E.theme==="dark")&&w(E.theme)}).catch(()=>{});const I=new EventSource("/api/ui/events");I.onmessage=E=>{try{const B=JSON.parse(E.data);B.type==="state"?t({step:B.step??0,stepDesc:B.stepDesc??"",tunnelUrl:B.tunnelUrl??"",oneTimeKey:B.oneTimeKey??"",oneTimeKeyExpiresAt:B.oneTimeKeyExpiresAt??null,permanentKey:B.permanentKey??"",qrUrl:B.qrUrl??"",latency:B.latency??null,uptime:B.uptime??null,healthCheck:B.healthCheck??rt}):B.type==="log"?l(H=>{const U=[...H,B.message];return U.length>en?U.slice(-en):U}):B.type==="updateAvailable"?d(B.version):B.type==="permissions"?(i({screenRecording:B.screenRecording,accessibility:B.accessibility}),B.desktopEnabled!==void 0&&r(B.desktopEnabled)):B.type==="connections"?u(B.connections??[]):B.type==="deviceApproval"&&B.action==="pending"?f({socketId:B.socketId,deviceId:B.deviceId,ip:B.ip}):B.type==="deviceApproval"&&B.action==="refresh"&&z()}catch{}},I.onerror=()=>{},fetch("/api/device/auto-approve").then(E=>E.json()).then(E=>{x(!!(E!=null&&E.enabled))}).catch(()=>{});const L=setInterval(async()=>{var E;if(!_.current)try{const B=await fetch("/api/device/pending");if(!B.ok)return;const H=await B.json(),U=(E=H==null?void 0:H.pending)==null?void 0:E[0];U&&!_.current&&f({socketId:U.socketId,deviceId:U.deviceId,ip:U.ip})}catch{}},gr);return()=>{I.close(),clearInterval(L)}},[]);const _=ct(null);se(()=>{_.current=h},[h]);const k=async I=>{await fetch("/api/permissions/request",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:I})}).catch(()=>{})},T=()=>{fetch("/api/ui/stop",{method:"POST"}).catch(()=>{}),t(Ze)},A=()=>{fetch("/api/ui/start",{method:"POST"}).catch(()=>{})},S=()=>{fetch("/api/ui/shutdown",{method:"POST"}).catch(()=>{}),t(Ze)},R=async()=>{const I=await fetch("/api/key/one-time",{method:"POST"}).catch(()=>null);if(!(I!=null&&I.ok))return;const L=await I.json().catch(()=>null);L!=null&&L.oneTimeKey&&t(E=>({...E,oneTimeKey:L.oneTimeKey,oneTimeKeyExpiresAt:L.expiresAt,qrUrl:L.qrUrl??E.qrUrl}))},O=async()=>{const I=!n;r(I),await fetch("/api/desktop/toggle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:I})}).catch(()=>{})},z=async()=>{try{const[I,L]=await Promise.all([fetch("/api/device/approved"),fetch("/api/device/rejected")]);if(I.ok){const E=await I.json();b(E.devices||[])}if(L.ok){const E=await L.json();p(E.rejected||[])}}catch{}},V=async I=>{const L=I.status==="pending"?"/api/device/clear-rejected":"/api/device/remove";await fetch(L,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceId:I.deviceId})}).catch(()=>{}),z()},re=async()=>{h&&(await fetch("/api/device/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({socketId:h.socketId})}).catch(()=>{}),f(null),z())},ae=async()=>{h&&(await fetch("/api/device/reject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({socketId:h.socketId})}).catch(()=>{}),f(null),z())},Y=async()=>{const I=!g;x(I);try{const E=await(await fetch("/api/device/auto-approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:I})})).json().catch(()=>null);E&&typeof E.enabled=="boolean"&&x(E.enabled)}catch{x(!I)}},Q=async I=>{await fetch("/api/device/approve-rejected",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceId:I})}).catch(()=>{}),z()},W=async()=>{const I=await fetch("/api/key/regenerate",{method:"POST"}).catch(()=>null);if(!(I!=null&&I.ok))return;const L=await I.json().catch(()=>null);L!=null&&L.permanentKey&&t(E=>({...E,permanentKey:L.permanentKey}))};return c(_r,{step:e.step,stepDesc:e.stepDesc,healthCheck:e.healthCheck,tunnelUrl:e.tunnelUrl,oneTimeKey:e.oneTimeKey,oneTimeKeyExpiresAt:e.oneTimeKeyExpiresAt,permanentKey:e.permanentKey,qrUrl:e.qrUrl,permissions:o,desktopEnabled:n,updateVersion:a,connections:m,onRequestPermission:k,onDesktopToggle:O,onStop:T,onStart:A,onShutdown:S,onGenerateOneTimeKey:R,onRegenerateKey:W,logs:s,version:N,theme:v,onToggleTheme:C,pendingDevice:h,onDeviceApprove:re,onDeviceReject:ae,approvedDevices:y,rejectedDevices:P,onDeviceRemove:V,onFetchDevices:z,onDeviceApproveRejected:Q,autoApprove:g,onAutoApproveToggle:Y})}En(c(vr,{}),document.getElementById("root"));
@@ -14,7 +14,7 @@
14
14
  const savedTheme = localStorage.getItem("9remote-theme") || "dark";
15
15
  document.documentElement.setAttribute("data-theme", savedTheme);
16
16
  </script>
17
- <script type="module" crossorigin src="/assets/index-njTKNAa6.js"></script>
17
+ <script type="module" crossorigin src="/assets/index-BWfJSBGG.js"></script>
18
18
  <link rel="stylesheet" crossorigin href="/assets/index-COWVKicT.css">
19
19
  </head>
20
20
  <body>
package/index.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  handlePermissionsGet, handlePermissionsRequest,
28
28
  } from "./api/ui.js";
29
29
  import { handleOneTimeKey, handleRegenerate } from "./api/key.js";
30
- import { handleApprove, handleReject, handlePending, handleApproved, handleRemove, handleDisconnect, handleRejected, handleApproveRejected, handleClearRejected } from "./api/device.js";
30
+ import { handleApprove, handleReject, handlePending, handleApproved, handleRemove, handleDisconnect, handleRejected, handleApproveRejected, handleClearRejected, handleGetAutoApprove, handleSetAutoApprove } from "./api/device.js";
31
31
  import { handleNotifyPost, handleNotifyGet } from "./api/notify.js";
32
32
 
33
33
  const __dirname = fileURLToPath(new URL(".", import.meta.url));
@@ -154,6 +154,8 @@ const ROUTES = [
154
154
  { path: "/api/device/clear-rejected", method: "POST", handler: handleClearRejected },
155
155
  { path: "/api/device/remove", method: "POST", handler: handleRemove },
156
156
  { path: "/api/device/disconnect", method: "POST", handler: handleDisconnect },
157
+ { path: "/api/device/auto-approve", method: "GET", handler: handleGetAutoApprove },
158
+ { path: "/api/device/auto-approve", method: "POST", handler: handleSetAutoApprove },
157
159
 
158
160
  // System (localhost-only)
159
161
  { path: "/api/connections", method: "GET", handler: handleConnections },
@@ -8,10 +8,14 @@ import { homedir } from "os";
8
8
 
9
9
  const STATE_DIR = join(homedir(), ".9remote");
10
10
  const DEVICES_FILE = join(STATE_DIR, "approvedDevices.json");
11
+ const CONFIG_FILE = join(STATE_DIR, "config.json");
11
12
 
12
13
  // deviceId -> { approvedAt }
13
14
  let approvedDevices = new Map();
14
15
 
16
+ // Auto-approve new device connections (default false). Persisted to config.json.
17
+ let autoApprove = false;
18
+
15
19
  // Pending approval requests: socketId -> { deviceId, ip }
16
20
  const pendingApprovals = new Map();
17
21
 
@@ -114,3 +118,35 @@ export function getRejectedDevices() {
114
118
  export function clearRejectedDevice(deviceId) {
115
119
  rejectedDevices.delete(deviceId);
116
120
  }
121
+
122
+ // ── Auto-approve setting (persisted) ────────────────────────────────
123
+ function readConfig() {
124
+ try {
125
+ if (existsSync(CONFIG_FILE)) return JSON.parse(readFileSync(CONFIG_FILE, "utf8")) || {};
126
+ } catch {}
127
+ return {};
128
+ }
129
+
130
+ function writeConfig(cfg) {
131
+ try {
132
+ ensureDir();
133
+ writeFileSync(CONFIG_FILE, JSON.stringify(cfg, null, 2));
134
+ } catch {}
135
+ }
136
+
137
+ export function loadAutoApprove() {
138
+ autoApprove = !!readConfig().autoApprove;
139
+ return autoApprove;
140
+ }
141
+
142
+ export function isAutoApprove() {
143
+ return autoApprove;
144
+ }
145
+
146
+ export function setAutoApprove(enabled) {
147
+ autoApprove = !!enabled;
148
+ const cfg = readConfig();
149
+ cfg.autoApprove = autoApprove;
150
+ writeConfig(cfg);
151
+ return autoApprove;
152
+ }
package/lib/socketio.js CHANGED
@@ -18,7 +18,9 @@ import {
18
18
  markDeviceRejected,
19
19
  isDeviceRejected,
20
20
  updateRejectedSocket,
21
- clearRejectedDevice
21
+ clearRejectedDevice,
22
+ loadAutoApprove,
23
+ isAutoApprove
22
24
  } from "./deviceApproval.js";
23
25
 
24
26
  function loadApiKey() {
@@ -134,8 +136,9 @@ export function rejectSocketDevice(socketId) {
134
136
  }
135
137
 
136
138
  export async function setupSocketIO(server) {
137
- // Load approved devices from disk
139
+ // Load approved devices + auto-approve setting from disk
138
140
  loadApprovedDevices();
141
+ loadAutoApprove();
139
142
 
140
143
  const io = new Server(server, {
141
144
  cors: {
@@ -191,6 +194,16 @@ export async function setupSocketIO(server) {
191
194
  pushUiLog(`Rejected device reconnected: ${deviceId.slice(0, 8)} — waiting in Clients list`);
192
195
  socket.emit("device:rejected");
193
196
  pushUiEvent("deviceApproval", { action: "refresh" });
197
+ } else if (deviceId && isAutoApprove()) {
198
+ // Auto-approve enabled — skip pending flow, approve immediately
199
+ approveDevice(deviceId);
200
+ clearRejectedDevice(deviceId);
201
+ socket.data.approved = true;
202
+ pushUiLog(`Auto-approved device: ${deviceId.slice(0, 8)}...`);
203
+ setupSocketFeatures(socket);
204
+ // Notify client after it signals ready so listeners are attached
205
+ socket.once("device:clientReady", () => socket.emit("device:approved"));
206
+ pushUiEvent("deviceApproval", { action: "refresh" });
194
207
  } else {
195
208
  // Unknown device — hold and request approval
196
209
  pushUiLog(`Unknown device: ${deviceId?.slice(0, 8) || "no-id"} — waiting for approval`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "9remote",
3
- "version": "2.0.1",
3
+ "version": "2.0.2",
4
4
  "type": "module",
5
5
  "description": "Remote terminal access from anywhere",
6
6
  "main": "index.js",
@@ -1,8 +0,0 @@
1
- (function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const n of document.querySelectorAll('link[rel="modulepreload"]'))i(n);new MutationObserver(n=>{for(const r of n)if(r.type==="childList")for(const s of r.addedNodes)s.tagName==="LINK"&&s.rel==="modulepreload"&&i(s)}).observe(document,{childList:!0,subtree:!0});function o(n){const r={};return n.integrity&&(r.integrity=n.integrity),n.referrerPolicy&&(r.referrerPolicy=n.referrerPolicy),n.crossOrigin==="use-credentials"?r.credentials="include":n.crossOrigin==="anonymous"?r.credentials="omit":r.credentials="same-origin",r}function i(n){if(n.ep)return;n.ep=!0;const r=o(n);fetch(n.href,r)}})();var Ne,D,Zt,X,at,$t,en,ke,_e,le,tn,nt,Xe,Ze,ve={},be=[],yn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Ce=Array.isArray;function J(e,t){for(var o in t)e[o]=t[o];return e}function rt(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function vn(e,t,o){var i,n,r,s={};for(r in t)r=="key"?i=t[r]:r=="ref"?n=t[r]:s[r]=t[r];if(arguments.length>2&&(s.children=arguments.length>3?Ne.call(arguments,2):o),typeof e=="function"&&e.defaultProps!=null)for(r in e.defaultProps)s[r]===void 0&&(s[r]=e.defaultProps[r]);return pe(e,s,i,n,null)}function pe(e,t,o,i,n){var r={type:e,props:t,key:o,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++Zt,__i:-1,__u:0};return n==null&&D.vnode!=null&&D.vnode(r),r}function Z(e){return e.children}function ge(e,t){this.props=e,this.context=t}function re(e,t){if(t==null)return e.__?re(e.__,e.__i+1):null;for(var o;t<e.__k.length;t++)if((o=e.__k[t])!=null&&o.__e!=null)return o.__e;return typeof e.type=="function"?re(e):null}function bn(e){if(e.__P&&e.__d){var t=e.__v,o=t.__e,i=[],n=[],r=J({},t);r.__v=t.__v+1,D.vnode&&D.vnode(r),ot(e.__P,r,t,e.__n,e.__P.namespaceURI,32&t.__u?[o]:null,i,o??re(t),!!(32&t.__u),n),r.__v=t.__v,r.__.__k[r.__i]=r,sn(i,r,n),t.__e=t.__=null,r.__e!=o&&nn(r)}}function nn(e){if((e=e.__)!=null&&e.__c!=null)return e.__e=e.__c.base=null,e.__k.some(function(t){if(t!=null&&t.__e!=null)return e.__e=e.__c.base=t.__e}),nn(e)}function ct(e){(!e.__d&&(e.__d=!0)&&X.push(e)&&!we.__r++||at!=D.debounceRendering)&&((at=D.debounceRendering)||$t)(we)}function we(){try{for(var e,t=1;X.length;)X.length>t&&X.sort(en),e=X.shift(),t=X.length,bn(e)}finally{X.length=we.__r=0}}function rn(e,t,o,i,n,r,s,l,a,d,m){var u,h,f,g,x,I,_,y=i&&i.__k||be,C=t.length;for(a=wn(o,t,y,a,C),u=0;u<C;u++)(f=o.__k[u])!=null&&(h=f.__i!=-1&&y[f.__i]||ve,f.__i=u,I=ot(e,f,h,n,r,s,l,a,d,m),g=f.__e,f.ref&&h.ref!=f.ref&&(h.ref&&it(h.ref,null,f),m.push(f.ref,f.__c||g,f)),x==null&&g!=null&&(x=g),(_=!!(4&f.__u))||h.__k===f.__k?(a=on(f,a,e,_),_&&h.__e&&(h.__e=null)):typeof f.type=="function"&&I!==void 0?a=I:g&&(a=g.nextSibling),f.__u&=-7);return o.__e=x,a}function wn(e,t,o,i,n){var r,s,l,a,d,m=o.length,u=m,h=0;for(e.__k=new Array(n),r=0;r<n;r++)(s=t[r])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=e.__k[r]=pe(null,s,null,null,null):Ce(s)?s=e.__k[r]=pe(Z,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[r]=pe(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[r]=s,a=r+h,s.__=e,s.__b=e.__b+1,l=null,(d=s.__i=xn(s,o,a,u))!=-1&&(u--,(l=o[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(n>m?h--:n<m&&h++),typeof s.type!="function"&&(s.__u|=4)):d!=a&&(d==a-1?h--:d==a+1?h++:(d>a?h--:h++,s.__u|=4))):e.__k[r]=null;if(u)for(r=0;r<m;r++)(l=o[r])!=null&&(2&l.__u)==0&&(l.__e==i&&(i=re(l)),an(l,l));return i}function on(e,t,o,i){var n,r;if(typeof e.type=="function"){for(n=e.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=e,t=on(n[r],t,o,i));return t}e.__e!=t&&(i&&(t&&e.type&&!t.parentNode&&(t=re(e)),o.insertBefore(e.__e,t||null)),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function xn(e,t,o,i){var n,r,s,l=e.key,a=e.type,d=t[o],m=d!=null&&(2&d.__u)==0;if(d===null&&l==null||m&&l==d.key&&a==d.type)return o;if(i>(m?1:0)){for(n=o-1,r=o+1;n>=0||r<t.length;)if((d=t[s=n>=0?n--:r++])!=null&&(2&d.__u)==0&&l==d.key&&a==d.type)return s}return-1}function ut(e,t,o){t[0]=="-"?e.setProperty(t,o??""):e[t]=o==null?"":typeof o!="number"||yn.test(t)?o:o+"px"}function fe(e,t,o,i,n){var r,s;e:if(t=="style")if(typeof o=="string")e.style.cssText=o;else{if(typeof i=="string"&&(e.style.cssText=i=""),i)for(t in i)o&&t in o||ut(e.style,t,"");if(o)for(t in o)i&&o[t]==i[t]||ut(e.style,t,o[t])}else if(t[0]=="o"&&t[1]=="n")r=t!=(t=t.replace(tn,"$1")),s=t.toLowerCase(),t=s in e||t=="onFocusOut"||t=="onFocusIn"?s.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+r]=o,o?i?o[le]=i[le]:(o[le]=nt,e.addEventListener(t,r?Ze:Xe,r)):e.removeEventListener(t,r?Ze:Xe,r);else{if(n=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=o??"";break e}catch{}typeof o=="function"||(o==null||o===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&o==1?"":o))}}function dt(e){return function(t){if(this.l){var o=this.l[t.type+e];if(t[_e]==null)t[_e]=nt++;else if(t[_e]<o[le])return;return o(D.event?D.event(t):t)}}}function ot(e,t,o,i,n,r,s,l,a,d){var m,u,h,f,g,x,I,_,y,C,v,M,b,N,k,p=t.type;if(t.constructor!==void 0)return null;128&o.__u&&(a=!!(32&o.__u),r=[l=t.__e=o.__e]),(m=D.__b)&&m(t);e:if(typeof p=="function")try{if(_=t.props,y=p.prototype&&p.prototype.render,C=(m=p.contextType)&&i[m.__c],v=m?C?C.props.value:m.__:i,o.__c?I=(u=t.__c=o.__c).__=u.__E:(y?t.__c=u=new p(_,v):(t.__c=u=new ge(_,v),u.constructor=p,u.render=Cn),C&&C.sub(u),u.state||(u.state={}),u.__n=i,h=u.__d=!0,u.__h=[],u._sb=[]),y&&u.__s==null&&(u.__s=u.state),y&&p.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=J({},u.__s)),J(u.__s,p.getDerivedStateFromProps(_,u.__s))),f=u.props,g=u.state,u.__v=t,h)y&&p.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),y&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(y&&p.getDerivedStateFromProps==null&&_!==f&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(_,v),t.__v==o.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(_,u.__s,v)===!1){t.__v!=o.__v&&(u.props=_,u.state=u.__s,u.__d=!1),t.__e=o.__e,t.__k=o.__k,t.__k.some(function(S){S&&(S.__=t)}),be.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&s.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(_,u.__s,v),y&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(f,g,x)})}if(u.context=v,u.props=_,u.__P=e,u.__e=!1,M=D.__r,b=0,y)u.state=u.__s,u.__d=!1,M&&M(t),m=u.render(u.props,u.state,u.context),be.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,M&&M(t),m=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++b<25);u.state=u.__s,u.getChildContext!=null&&(i=J(J({},i),u.getChildContext())),y&&!h&&u.getSnapshotBeforeUpdate!=null&&(x=u.getSnapshotBeforeUpdate(f,g)),N=m!=null&&m.type===Z&&m.key==null?ln(m.props.children):m,l=rn(e,Ce(N)?N:[N],t,o,i,n,r,s,l,a,d),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),I&&(u.__E=u.__=null)}catch(S){if(t.__v=null,a||r!=null)if(S.then){for(t.__u|=a?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;r[r.indexOf(l)]=null,t.__e=l}else{for(k=r.length;k--;)rt(r[k]);$e(t)}else t.__e=o.__e,t.__k=o.__k,S.then||$e(t);D.__e(S,t,o)}else r==null&&t.__v==o.__v?(t.__k=o.__k,t.__e=o.__e):l=t.__e=Nn(o.__e,t,o,i,n,r,s,a,d);return(m=D.diffed)&&m(t),128&t.__u?void 0:l}function $e(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some($e))}function sn(e,t,o){for(var i=0;i<o.length;i++)it(o[i],o[++i],o[++i]);D.__c&&D.__c(t,e),e.some(function(n){try{e=n.__h,n.__h=[],e.some(function(r){r.call(n)})}catch(r){D.__e(r,n.__v)}})}function ln(e){return typeof e!="object"||e==null||e.__b>0?e:Ce(e)?e.map(ln):J({},e)}function Nn(e,t,o,i,n,r,s,l,a){var d,m,u,h,f,g,x,I=o.props||ve,_=t.props,y=t.type;if(y=="svg"?n="http://www.w3.org/2000/svg":y=="math"?n="http://www.w3.org/1998/Math/MathML":n||(n="http://www.w3.org/1999/xhtml"),r!=null){for(d=0;d<r.length;d++)if((f=r[d])&&"setAttribute"in f==!!y&&(y?f.localName==y:f.nodeType==3)){e=f,r[d]=null;break}}if(e==null){if(y==null)return document.createTextNode(_);e=document.createElementNS(n,y,_.is&&_),l&&(D.__m&&D.__m(t,r),l=!1),r=null}if(y==null)I===_||l&&e.data==_||(e.data=_);else{if(r=r&&Ne.call(e.childNodes),!l&&r!=null)for(I={},d=0;d<e.attributes.length;d++)I[(f=e.attributes[d]).name]=f.value;for(d in I)f=I[d],d=="dangerouslySetInnerHTML"?u=f:d=="children"||d in _||d=="value"&&"defaultValue"in _||d=="checked"&&"defaultChecked"in _||fe(e,d,null,f,n);for(d in _)f=_[d],d=="children"?h=f:d=="dangerouslySetInnerHTML"?m=f:d=="value"?g=f:d=="checked"?x=f:l&&typeof f!="function"||I[d]===f||fe(e,d,f,I[d],n);if(m)l||u&&(m.__html==u.__html||m.__html==e.innerHTML)||(e.innerHTML=m.__html),t.__k=[];else if(u&&(e.innerHTML=""),rn(t.type=="template"?e.content:e,Ce(h)?h:[h],t,o,i,y=="foreignObject"?"http://www.w3.org/1999/xhtml":n,r,s,r?r[0]:o.__k&&re(o,0),l,a),r!=null)for(d=r.length;d--;)rt(r[d]);l||(d="value",y=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[d]||y=="progress"&&!g||y=="option"&&g!=I[d])&&fe(e,d,g,I[d],n),d="checked",x!=null&&x!=e[d]&&fe(e,d,x,I[d],n))}return e}function it(e,t,o){try{if(typeof e=="function"){var i=typeof e.__u=="function";i&&e.__u(),i&&t==null||(e.__u=e(t))}else e.current=t}catch(n){D.__e(n,o)}}function an(e,t,o){var i,n;if(D.unmount&&D.unmount(e),(i=e.ref)&&(i.current&&i.current!=e.__e||it(i,null,t)),(i=e.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){D.__e(r,t)}i.base=i.__P=null}if(i=e.__k)for(n=0;n<i.length;n++)i[n]&&an(i[n],t,o||typeof e.type!="function");o||rt(e.__e),e.__c=e.__=e.__e=void 0}function Cn(e,t,o){return this.constructor(e,o)}function kn(e,t,o){var i,n,r,s;t==document&&(t=document.documentElement),D.__&&D.__(e,t),n=(i=!1)?null:t.__k,r=[],s=[],ot(t,e=t.__k=vn(Z,null,[e]),n||ve,ve,t.namespaceURI,n?null:t.firstChild?Ne.call(t.childNodes):null,r,n?n.__e:t.firstChild,i,s),sn(r,e,s)}Ne=be.slice,D={__e:function(e,t,o,i){for(var n,r,s;t=t.__;)if((n=t.__c)&&!n.__)try{if((r=n.constructor)&&r.getDerivedStateFromError!=null&&(n.setState(r.getDerivedStateFromError(e)),s=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(e,i||{}),s=n.__d),s)return n.__E=n}catch(l){e=l}throw e}},Zt=0,ge.prototype.setState=function(e,t){var o;o=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=J({},this.state),typeof e=="function"&&(e=e(J({},o),this.props)),e&&J(o,e),e!=null&&this.__v&&(t&&this._sb.push(t),ct(this))},ge.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),ct(this))},ge.prototype.render=Z,X=[],$t=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,en=function(e,t){return e.__v.__b-t.__v.__b},we.__r=0,ke=Math.random().toString(8),_e="__d"+ke,le="__a"+ke,tn=/(PointerCapture)$|Capture$/i,nt=0,Xe=dt(!1),Ze=dt(!0);var Sn=0;function c(e,t,o,i,n,r){t||(t={});var s,l,a=t;if("ref"in a)for(l in a={},t)l=="ref"?s=t[l]:a[l]=t[l];var d={type:e,props:a,key:o,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Sn,__i:-1,__u:0,__source:n,__self:r};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)a[l]===void 0&&(a[l]=s[l]);return D.vnode&&D.vnode(d),d}var ce,U,Se,ft,xe=0,cn=[],q=D,ht=q.__b,mt=q.__r,_t=q.diffed,pt=q.__c,gt=q.unmount,yt=q.__;function st(e,t){q.__h&&q.__h(U,e,xe||t),xe=0;var o=U.__H||(U.__H={__:[],__h:[]});return e>=o.__.length&&o.__.push({}),o.__[e]}function F(e){return xe=1,En(fn,e)}function En(e,t,o){var i=st(ce++,2);if(i.t=e,!i.__c&&(i.__=[fn(void 0,t),function(l){var a=i.__N?i.__N[0]:i.__[0],d=i.t(a,l);a!==d&&(i.__N=[d,i.__[1]],i.__c.setState({}))}],i.__c=U,!U.__f)){var n=function(l,a,d){if(!i.__c.__H)return!0;var m=i.__c.__H.__.filter(function(h){return h.__c});if(m.every(function(h){return!h.__N}))return!r||r.call(this,l,a,d);var u=i.__c.props!==l;return m.some(function(h){if(h.__N){var f=h.__[0];h.__=h.__N,h.__N=void 0,f!==h.__[0]&&(u=!0)}}),r&&r.call(this,l,a,d)||u};U.__f=!0;var r=U.shouldComponentUpdate,s=U.componentWillUpdate;U.componentWillUpdate=function(l,a,d){if(this.__e){var m=r;r=void 0,n(l,a,d),r=m}s&&s.call(this,l,a,d)},U.shouldComponentUpdate=n}return i.__N||i.__}function ue(e,t){var o=st(ce++,3);!q.__s&&dn(o.__H,t)&&(o.__=e,o.u=t,U.__H.__h.push(o))}function un(e){return xe=5,Tn(function(){return{current:e}},[])}function Tn(e,t){var o=st(ce++,7);return dn(o.__H,t)&&(o.__=e(),o.__H=t,o.__h=e),o.__}function An(){for(var e;e=cn.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(ye),t.__h.some(et),t.__h=[]}catch(o){t.__h=[],q.__e(o,e.__v)}}}q.__b=function(e){U=null,ht&&ht(e)},q.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),yt&&yt(e,t)},q.__r=function(e){mt&&mt(e),ce=0;var t=(U=e.__c).__H;t&&(Se===U?(t.__h=[],U.__h=[],t.__.some(function(o){o.__N&&(o.__=o.__N),o.u=o.__N=void 0})):(t.__h.some(ye),t.__h.some(et),t.__h=[],ce=0)),Se=U},q.diffed=function(e){_t&&_t(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(cn.push(t)!==1&&ft===q.requestAnimationFrame||((ft=q.requestAnimationFrame)||Rn)(An)),t.__H.__.some(function(o){o.u&&(o.__H=o.u),o.u=void 0})),Se=U=null},q.__c=function(e,t){t.some(function(o){try{o.__h.some(ye),o.__h=o.__h.filter(function(i){return!i.__||et(i)})}catch(i){t.some(function(n){n.__h&&(n.__h=[])}),t=[],q.__e(i,o.__v)}}),pt&&pt(e,t)},q.unmount=function(e){gt&&gt(e);var t,o=e.__c;o&&o.__H&&(o.__H.__.some(function(i){try{ye(i)}catch(n){t=n}}),o.__H=void 0,t&&q.__e(t,o.__v))};var vt=typeof requestAnimationFrame=="function";function Rn(e){var t,o=function(){clearTimeout(i),vt&&cancelAnimationFrame(t),setTimeout(e)},i=setTimeout(o,35);vt&&(t=requestAnimationFrame(o))}function ye(e){var t=U,o=e.__c;typeof o=="function"&&(e.__c=void 0,o()),U=t}function et(e){var t=U;e.__c=e.__(),U=t}function dn(e,t){return!e||e.length!==t.length||t.some(function(o,i){return o!==e[i]})}function fn(e,t){return typeof t=="function"?t(e):t}const Pn=[{icon:"download",label:"Preparing",desc:"Checking tunnel binary"},{icon:"cloud_sync",label:"Connecting",desc:"Creating session"},{icon:"lan",label:"Tunneling",desc:"Starting secure tunnel"},{icon:"verified",label:"Verifying",desc:"Health check"},{icon:"check_circle",label:"Ready",desc:"Connected"}],In=3;function Bn({currentStep:e,activeDesc:t="",healthCheck:o}){var r;const i=e-1,n=(r=o==null?void 0:o.logs)!=null&&r.length?o.logs[o.logs.length-1]:null;return c("div",{className:"glass-card p-5 flex flex-col gap-4",children:[c("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:"var(--text-muted)"},children:"Setting up connection"}),c("div",{className:"flex flex-col gap-3",children:Pn.map((s,l)=>{const a=l<i,d=l===i,m=d&&l===In;let u=d&&t?t:s.desc,h="var(--text-muted)";if(m&&n){const f=/^\d{3}$/.test(String(n.status));u=`#${n.attempt} → ${n.status}`,h=n.ok||n.waiting?"#22c55e":f?"#eab308":"#ef4444"}return c("div",{className:"flex items-center gap-3",children:[c("div",{className:"w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",style:{background:a?"var(--brand-500)":d?"rgba(255,87,10,0.15)":"var(--glass-bg)",border:d?"1.5px solid var(--brand-500)":"1.5px solid transparent"},children:a?c("span",{className:"material-symbols-outlined text-white",style:{fontSize:16},children:"check"}):d?c("span",{className:"flex gap-0.5 items-center",children:[0,1,2].map(f=>c("span",{className:"w-1 h-1 rounded-full bg-orange-400 dot-bounce",style:{animationDelay:`${f*.18}s`}},f))}):c("span",{className:"material-symbols-outlined",style:{fontSize:16,color:"var(--text-muted)",opacity:.3},children:s.icon})}),c("div",{className:"flex-1 min-w-0",children:[c("p",{className:"text-sm font-medium",style:{color:a?"var(--text-muted)":d?"var(--text-main)":"var(--text-muted)",opacity:a||d?1:.4},children:s.label}),c("p",{className:"text-xs mt-0.5 truncate",style:{color:h,opacity:d?m&&n?.95:.7:.4,fontFamily:m&&n?"ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace":void 0},children:u})]}),a&&c("span",{className:"text-xs flex-shrink-0",style:{color:"var(--text-muted)"},children:"Done"}),d&&c("span",{className:"text-xs flex-shrink-0 px-2 py-0.5 rounded-full",style:{background:"rgba(255,87,10,0.15)",color:"var(--brand-400)"},children:"Running"})]},l)})})]})}function Mn(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ne={},Ee,bt;function Dn(){return bt||(bt=1,Ee=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),Ee}var Te={},W={},wt;function ee(){if(wt)return W;wt=1;let e;const t=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];return W.getSymbolSize=function(i){if(!i)throw new Error('"version" cannot be null or undefined');if(i<1||i>40)throw new Error('"version" should be in range from 1 to 40');return i*4+17},W.getSymbolTotalCodewords=function(i){return t[i]},W.getBCHDigit=function(o){let i=0;for(;o!==0;)i++,o>>>=1;return i},W.setToSJISFunction=function(i){if(typeof i!="function")throw new Error('"toSJISFunc" is not a valid function.');e=i},W.isKanjiModeEnabled=function(){return typeof e<"u"},W.toSJIS=function(i){return e(i)},W}var Ae={},xt;function lt(){return xt||(xt=1,(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+o)}}e.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},e.from=function(i,n){if(e.isValid(i))return i;try{return t(i)}catch{return n}}})(Ae)),Ae}var Re,Nt;function Ln(){if(Nt)return Re;Nt=1;function e(){this.buffer=[],this.length=0}return e.prototype={get:function(t){const o=Math.floor(t/8);return(this.buffer[o]>>>7-t%8&1)===1},put:function(t,o){for(let i=0;i<o;i++)this.putBit((t>>>o-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){const o=Math.floor(this.length/8);this.buffer.length<=o&&this.buffer.push(0),t&&(this.buffer[o]|=128>>>this.length%8),this.length++}},Re=e,Re}var Pe,Ct;function Un(){if(Ct)return Pe;Ct=1;function e(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=new Uint8Array(t*t),this.reservedBit=new Uint8Array(t*t)}return e.prototype.set=function(t,o,i,n){const r=t*this.size+o;this.data[r]=i,n&&(this.reservedBit[r]=!0)},e.prototype.get=function(t,o){return this.data[t*this.size+o]},e.prototype.xor=function(t,o,i){this.data[t*this.size+o]^=i},e.prototype.isReserved=function(t,o){return this.reservedBit[t*this.size+o]},Pe=e,Pe}var Ie={},kt;function qn(){return kt||(kt=1,(function(e){const t=ee().getSymbolSize;e.getRowColCoords=function(i){if(i===1)return[];const n=Math.floor(i/7)+2,r=t(i),s=r===145?26:Math.ceil((r-13)/(2*n-2))*2,l=[r-7];for(let a=1;a<n-1;a++)l[a]=l[a-1]-s;return l.push(6),l.reverse()},e.getPositions=function(i){const n=[],r=e.getRowColCoords(i),s=r.length;for(let l=0;l<s;l++)for(let a=0;a<s;a++)l===0&&a===0||l===0&&a===s-1||l===s-1&&a===0||n.push([r[l],r[a]]);return n}})(Ie)),Ie}var Be={},St;function Fn(){if(St)return Be;St=1;const e=ee().getSymbolSize,t=7;return Be.getPositions=function(i){const n=e(i);return[[0,0],[n-t,0],[0,n-t]]},Be}var Me={},Et;function jn(){return Et||(Et=1,(function(e){e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},e.from=function(n){return e.isValid(n)?parseInt(n,10):void 0},e.getPenaltyN1=function(n){const r=n.size;let s=0,l=0,a=0,d=null,m=null;for(let u=0;u<r;u++){l=a=0,d=m=null;for(let h=0;h<r;h++){let f=n.get(u,h);f===d?l++:(l>=5&&(s+=t.N1+(l-5)),d=f,l=1),f=n.get(h,u),f===m?a++:(a>=5&&(s+=t.N1+(a-5)),m=f,a=1)}l>=5&&(s+=t.N1+(l-5)),a>=5&&(s+=t.N1+(a-5))}return s},e.getPenaltyN2=function(n){const r=n.size;let s=0;for(let l=0;l<r-1;l++)for(let a=0;a<r-1;a++){const d=n.get(l,a)+n.get(l,a+1)+n.get(l+1,a)+n.get(l+1,a+1);(d===4||d===0)&&s++}return s*t.N2},e.getPenaltyN3=function(n){const r=n.size;let s=0,l=0,a=0;for(let d=0;d<r;d++){l=a=0;for(let m=0;m<r;m++)l=l<<1&2047|n.get(d,m),m>=10&&(l===1488||l===93)&&s++,a=a<<1&2047|n.get(m,d),m>=10&&(a===1488||a===93)&&s++}return s*t.N3},e.getPenaltyN4=function(n){let r=0;const s=n.data.length;for(let a=0;a<s;a++)r+=n.data[a];return Math.abs(Math.ceil(r*100/s/5)-10)*t.N4};function o(i,n,r){switch(i){case e.Patterns.PATTERN000:return(n+r)%2===0;case e.Patterns.PATTERN001:return n%2===0;case e.Patterns.PATTERN010:return r%3===0;case e.Patterns.PATTERN011:return(n+r)%3===0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2===0;case e.Patterns.PATTERN101:return n*r%2+n*r%3===0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2===0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}e.applyMask=function(n,r){const s=r.size;for(let l=0;l<s;l++)for(let a=0;a<s;a++)r.isReserved(a,l)||r.xor(a,l,o(n,a,l))},e.getBestMask=function(n,r){const s=Object.keys(e.Patterns).length;let l=0,a=1/0;for(let d=0;d<s;d++){r(d),e.applyMask(d,n);const m=e.getPenaltyN1(n)+e.getPenaltyN2(n)+e.getPenaltyN3(n)+e.getPenaltyN4(n);e.applyMask(d,n),m<a&&(a=m,l=d)}return l}})(Me)),Me}var he={},Tt;function hn(){if(Tt)return he;Tt=1;const e=lt(),t=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],o=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];return he.getBlocksCount=function(n,r){switch(r){case e.L:return t[(n-1)*4+0];case e.M:return t[(n-1)*4+1];case e.Q:return t[(n-1)*4+2];case e.H:return t[(n-1)*4+3];default:return}},he.getTotalCodewordsCount=function(n,r){switch(r){case e.L:return o[(n-1)*4+0];case e.M:return o[(n-1)*4+1];case e.Q:return o[(n-1)*4+2];case e.H:return o[(n-1)*4+3];default:return}},he}var De={},se={},At;function On(){if(At)return se;At=1;const e=new Uint8Array(512),t=new Uint8Array(256);return(function(){let i=1;for(let n=0;n<255;n++)e[n]=i,t[i]=n,i<<=1,i&256&&(i^=285);for(let n=255;n<512;n++)e[n]=e[n-255]})(),se.log=function(i){if(i<1)throw new Error("log("+i+")");return t[i]},se.exp=function(i){return e[i]},se.mul=function(i,n){return i===0||n===0?0:e[t[i]+t[n]]},se}var Rt;function Hn(){return Rt||(Rt=1,(function(e){const t=On();e.mul=function(i,n){const r=new Uint8Array(i.length+n.length-1);for(let s=0;s<i.length;s++)for(let l=0;l<n.length;l++)r[s+l]^=t.mul(i[s],n[l]);return r},e.mod=function(i,n){let r=new Uint8Array(i);for(;r.length-n.length>=0;){const s=r[0];for(let a=0;a<n.length;a++)r[a]^=t.mul(n[a],s);let l=0;for(;l<r.length&&r[l]===0;)l++;r=r.slice(l)}return r},e.generateECPolynomial=function(i){let n=new Uint8Array([1]);for(let r=0;r<i;r++)n=e.mul(n,new Uint8Array([1,t.exp(r)]));return n}})(De)),De}var Le,Pt;function zn(){if(Pt)return Le;Pt=1;const e=Hn();function t(o){this.genPoly=void 0,this.degree=o,this.degree&&this.initialize(this.degree)}return t.prototype.initialize=function(i){this.degree=i,this.genPoly=e.generateECPolynomial(this.degree)},t.prototype.encode=function(i){if(!this.genPoly)throw new Error("Encoder not initialized");const n=new Uint8Array(i.length+this.degree);n.set(i);const r=e.mod(n,this.genPoly),s=this.degree-r.length;if(s>0){const l=new Uint8Array(this.degree);return l.set(r,s),l}return r},Le=t,Le}var Ue={},qe={},Fe={},It;function mn(){return It||(It=1,Fe.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40}),Fe}var K={},Bt;function _n(){if(Bt)return K;Bt=1;const e="[0-9]+",t="[A-Z $%*+\\-./:]+";let o="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";o=o.replace(/u/g,"\\u");const i="(?:(?![A-Z0-9 $%*+\\-./:]|"+o+`)(?:.|[\r
2
- ]))+`;K.KANJI=new RegExp(o,"g"),K.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),K.BYTE=new RegExp(i,"g"),K.NUMERIC=new RegExp(e,"g"),K.ALPHANUMERIC=new RegExp(t,"g");const n=new RegExp("^"+o+"$"),r=new RegExp("^"+e+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return K.testKanji=function(a){return n.test(a)},K.testNumeric=function(a){return r.test(a)},K.testAlphanumeric=function(a){return s.test(a)},K}var Mt;function te(){return Mt||(Mt=1,(function(e){const t=mn(),o=_n();e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(r,s){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?r.ccBits[0]:s<27?r.ccBits[1]:r.ccBits[2]},e.getBestModeForData=function(r){return o.testNumeric(r)?e.NUMERIC:o.testAlphanumeric(r)?e.ALPHANUMERIC:o.testKanji(r)?e.KANJI:e.BYTE},e.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},e.isValid=function(r){return r&&r.bit&&r.ccBits};function i(n){if(typeof n!="string")throw new Error("Param is not a string");switch(n.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+n)}}e.from=function(r,s){if(e.isValid(r))return r;try{return i(r)}catch{return s}}})(qe)),qe}var Dt;function Kn(){return Dt||(Dt=1,(function(e){const t=ee(),o=hn(),i=lt(),n=te(),r=mn(),s=7973,l=t.getBCHDigit(s);function a(h,f,g){for(let x=1;x<=40;x++)if(f<=e.getCapacity(x,g,h))return x}function d(h,f){return n.getCharCountIndicator(h,f)+4}function m(h,f){let g=0;return h.forEach(function(x){const I=d(x.mode,f);g+=I+x.getBitsLength()}),g}function u(h,f){for(let g=1;g<=40;g++)if(m(h,g)<=e.getCapacity(g,f,n.MIXED))return g}e.from=function(f,g){return r.isValid(f)?parseInt(f,10):g},e.getCapacity=function(f,g,x){if(!r.isValid(f))throw new Error("Invalid QR Code version");typeof x>"u"&&(x=n.BYTE);const I=t.getSymbolTotalCodewords(f),_=o.getTotalCodewordsCount(f,g),y=(I-_)*8;if(x===n.MIXED)return y;const C=y-d(x,f);switch(x){case n.NUMERIC:return Math.floor(C/10*3);case n.ALPHANUMERIC:return Math.floor(C/11*2);case n.KANJI:return Math.floor(C/13);case n.BYTE:default:return Math.floor(C/8)}},e.getBestVersionForData=function(f,g){let x;const I=i.from(g,i.M);if(Array.isArray(f)){if(f.length>1)return u(f,I);if(f.length===0)return 1;x=f[0]}else x=f;return a(x.mode,x.getLength(),I)},e.getEncodedBits=function(f){if(!r.isValid(f)||f<7)throw new Error("Invalid QR Code version");let g=f<<12;for(;t.getBCHDigit(g)-l>=0;)g^=s<<t.getBCHDigit(g)-l;return f<<12|g}})(Ue)),Ue}var je={},Lt;function Vn(){if(Lt)return je;Lt=1;const e=ee(),t=1335,o=21522,i=e.getBCHDigit(t);return je.getEncodedBits=function(r,s){const l=r.bit<<3|s;let a=l<<10;for(;e.getBCHDigit(a)-i>=0;)a^=t<<e.getBCHDigit(a)-i;return(l<<10|a)^o},je}var Oe={},He,Ut;function Jn(){if(Ut)return He;Ut=1;const e=te();function t(o){this.mode=e.NUMERIC,this.data=o.toString()}return t.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(i){let n,r,s;for(n=0;n+3<=this.data.length;n+=3)r=this.data.substr(n,3),s=parseInt(r,10),i.put(s,10);const l=this.data.length-n;l>0&&(r=this.data.substr(n),s=parseInt(r,10),i.put(s,l*3+1))},He=t,He}var ze,qt;function Yn(){if(qt)return ze;qt=1;const e=te(),t=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function o(i){this.mode=e.ALPHANUMERIC,this.data=i}return o.getBitsLength=function(n){return 11*Math.floor(n/2)+6*(n%2)},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(n){let r;for(r=0;r+2<=this.data.length;r+=2){let s=t.indexOf(this.data[r])*45;s+=t.indexOf(this.data[r+1]),n.put(s,11)}this.data.length%2&&n.put(t.indexOf(this.data[r]),6)},ze=o,ze}var Ke,Ft;function Gn(){if(Ft)return Ke;Ft=1;const e=te();function t(o){this.mode=e.BYTE,typeof o=="string"?this.data=new TextEncoder().encode(o):this.data=new Uint8Array(o)}return t.getBitsLength=function(i){return i*8},t.prototype.getLength=function(){return this.data.length},t.prototype.getBitsLength=function(){return t.getBitsLength(this.data.length)},t.prototype.write=function(o){for(let i=0,n=this.data.length;i<n;i++)o.put(this.data[i],8)},Ke=t,Ke}var Ve,jt;function Qn(){if(jt)return Ve;jt=1;const e=te(),t=ee();function o(i){this.mode=e.KANJI,this.data=i}return o.getBitsLength=function(n){return n*13},o.prototype.getLength=function(){return this.data.length},o.prototype.getBitsLength=function(){return o.getBitsLength(this.data.length)},o.prototype.write=function(i){let n;for(n=0;n<this.data.length;n++){let r=t.toSJIS(this.data[n]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[n]+`
3
- Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),i.put(r,13)}},Ve=o,Ve}var Je={exports:{}},Ot;function Wn(){return Ot||(Ot=1,(function(e){var t={single_source_shortest_paths:function(o,i,n){var r={},s={};s[i]=0;var l=t.PriorityQueue.make();l.push(i,0);for(var a,d,m,u,h,f,g,x,I;!l.empty();){a=l.pop(),d=a.value,u=a.cost,h=o[d]||{};for(m in h)h.hasOwnProperty(m)&&(f=h[m],g=u+f,x=s[m],I=typeof s[m]>"u",(I||x>g)&&(s[m]=g,l.push(m,g),r[m]=d))}if(typeof n<"u"&&typeof s[n]>"u"){var _=["Could not find a path from ",i," to ",n,"."].join("");throw new Error(_)}return r},extract_shortest_path_from_predecessor_list:function(o,i){for(var n=[],r=i;r;)n.push(r),o[r],r=o[r];return n.reverse(),n},find_path:function(o,i,n){var r=t.single_source_shortest_paths(o,i,n);return t.extract_shortest_path_from_predecessor_list(r,n)},PriorityQueue:{make:function(o){var i=t.PriorityQueue,n={},r;o=o||{};for(r in i)i.hasOwnProperty(r)&&(n[r]=i[r]);return n.queue=[],n.sorter=o.sorter||i.default_sorter,n},default_sorter:function(o,i){return o.cost-i.cost},push:function(o,i){var n={value:o,cost:i};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};e.exports=t})(Je)),Je.exports}var Ht;function Xn(){return Ht||(Ht=1,(function(e){const t=te(),o=Jn(),i=Yn(),n=Gn(),r=Qn(),s=_n(),l=ee(),a=Wn();function d(_){return unescape(encodeURIComponent(_)).length}function m(_,y,C){const v=[];let M;for(;(M=_.exec(C))!==null;)v.push({data:M[0],index:M.index,mode:y,length:M[0].length});return v}function u(_){const y=m(s.NUMERIC,t.NUMERIC,_),C=m(s.ALPHANUMERIC,t.ALPHANUMERIC,_);let v,M;return l.isKanjiModeEnabled()?(v=m(s.BYTE,t.BYTE,_),M=m(s.KANJI,t.KANJI,_)):(v=m(s.BYTE_KANJI,t.BYTE,_),M=[]),y.concat(C,v,M).sort(function(N,k){return N.index-k.index}).map(function(N){return{data:N.data,mode:N.mode,length:N.length}})}function h(_,y){switch(y){case t.NUMERIC:return o.getBitsLength(_);case t.ALPHANUMERIC:return i.getBitsLength(_);case t.KANJI:return r.getBitsLength(_);case t.BYTE:return n.getBitsLength(_)}}function f(_){return _.reduce(function(y,C){const v=y.length-1>=0?y[y.length-1]:null;return v&&v.mode===C.mode?(y[y.length-1].data+=C.data,y):(y.push(C),y)},[])}function g(_){const y=[];for(let C=0;C<_.length;C++){const v=_[C];switch(v.mode){case t.NUMERIC:y.push([v,{data:v.data,mode:t.ALPHANUMERIC,length:v.length},{data:v.data,mode:t.BYTE,length:v.length}]);break;case t.ALPHANUMERIC:y.push([v,{data:v.data,mode:t.BYTE,length:v.length}]);break;case t.KANJI:y.push([v,{data:v.data,mode:t.BYTE,length:d(v.data)}]);break;case t.BYTE:y.push([{data:v.data,mode:t.BYTE,length:d(v.data)}])}}return y}function x(_,y){const C={},v={start:{}};let M=["start"];for(let b=0;b<_.length;b++){const N=_[b],k=[];for(let p=0;p<N.length;p++){const S=N[p],E=""+b+p;k.push(E),C[E]={node:S,lastCount:0},v[E]={};for(let T=0;T<M.length;T++){const w=M[T];C[w]&&C[w].node.mode===S.mode?(v[w][E]=h(C[w].lastCount+S.length,S.mode)-h(C[w].lastCount,S.mode),C[w].lastCount+=S.length):(C[w]&&(C[w].lastCount=S.length),v[w][E]=h(S.length,S.mode)+4+t.getCharCountIndicator(S.mode,y))}}M=k}for(let b=0;b<M.length;b++)v[M[b]].end=0;return{map:v,table:C}}function I(_,y){let C;const v=t.getBestModeForData(_);if(C=t.from(y,v),C!==t.BYTE&&C.bit<v.bit)throw new Error('"'+_+'" cannot be encoded with mode '+t.toString(C)+`.
4
- Suggested mode is: `+t.toString(v));switch(C===t.KANJI&&!l.isKanjiModeEnabled()&&(C=t.BYTE),C){case t.NUMERIC:return new o(_);case t.ALPHANUMERIC:return new i(_);case t.KANJI:return new r(_);case t.BYTE:return new n(_)}}e.fromArray=function(y){return y.reduce(function(C,v){return typeof v=="string"?C.push(I(v,null)):v.data&&C.push(I(v.data,v.mode)),C},[])},e.fromString=function(y,C){const v=u(y,l.isKanjiModeEnabled()),M=g(v),b=x(M,C),N=a.find_path(b.map,"start","end"),k=[];for(let p=1;p<N.length-1;p++)k.push(b.table[N[p]].node);return e.fromArray(f(k))},e.rawSplit=function(y){return e.fromArray(u(y,l.isKanjiModeEnabled()))}})(Oe)),Oe}var zt;function Zn(){if(zt)return Te;zt=1;const e=ee(),t=lt(),o=Ln(),i=Un(),n=qn(),r=Fn(),s=jn(),l=hn(),a=zn(),d=Kn(),m=Vn(),u=te(),h=Xn();function f(b,N){const k=b.size,p=r.getPositions(N);for(let S=0;S<p.length;S++){const E=p[S][0],T=p[S][1];for(let w=-1;w<=7;w++)if(!(E+w<=-1||k<=E+w))for(let P=-1;P<=7;P++)T+P<=-1||k<=T+P||(w>=0&&w<=6&&(P===0||P===6)||P>=0&&P<=6&&(w===0||w===6)||w>=2&&w<=4&&P>=2&&P<=4?b.set(E+w,T+P,!0,!0):b.set(E+w,T+P,!1,!0))}}function g(b){const N=b.size;for(let k=8;k<N-8;k++){const p=k%2===0;b.set(k,6,p,!0),b.set(6,k,p,!0)}}function x(b,N){const k=n.getPositions(N);for(let p=0;p<k.length;p++){const S=k[p][0],E=k[p][1];for(let T=-2;T<=2;T++)for(let w=-2;w<=2;w++)T===-2||T===2||w===-2||w===2||T===0&&w===0?b.set(S+T,E+w,!0,!0):b.set(S+T,E+w,!1,!0)}}function I(b,N){const k=b.size,p=d.getEncodedBits(N);let S,E,T;for(let w=0;w<18;w++)S=Math.floor(w/3),E=w%3+k-8-3,T=(p>>w&1)===1,b.set(S,E,T,!0),b.set(E,S,T,!0)}function _(b,N,k){const p=b.size,S=m.getEncodedBits(N,k);let E,T;for(E=0;E<15;E++)T=(S>>E&1)===1,E<6?b.set(E,8,T,!0):E<8?b.set(E+1,8,T,!0):b.set(p-15+E,8,T,!0),E<8?b.set(8,p-E-1,T,!0):E<9?b.set(8,15-E-1+1,T,!0):b.set(8,15-E-1,T,!0);b.set(p-8,8,1,!0)}function y(b,N){const k=b.size;let p=-1,S=k-1,E=7,T=0;for(let w=k-1;w>0;w-=2)for(w===6&&w--;;){for(let P=0;P<2;P++)if(!b.isReserved(S,w-P)){let j=!1;T<N.length&&(j=(N[T]>>>E&1)===1),b.set(S,w-P,j),E--,E===-1&&(T++,E=7)}if(S+=p,S<0||k<=S){S-=p,p=-p;break}}}function C(b,N,k){const p=new o;k.forEach(function(P){p.put(P.mode.bit,4),p.put(P.getLength(),u.getCharCountIndicator(P.mode,b)),P.write(p)});const S=e.getSymbolTotalCodewords(b),E=l.getTotalCodewordsCount(b,N),T=(S-E)*8;for(p.getLengthInBits()+4<=T&&p.put(0,4);p.getLengthInBits()%8!==0;)p.putBit(0);const w=(T-p.getLengthInBits())/8;for(let P=0;P<w;P++)p.put(P%2?17:236,8);return v(p,b,N)}function v(b,N,k){const p=e.getSymbolTotalCodewords(N),S=l.getTotalCodewordsCount(N,k),E=p-S,T=l.getBlocksCount(N,k),w=p%T,P=T-w,j=Math.floor(p/T),V=Math.floor(E/T),oe=V+1,Y=j-V,B=new a(Y);let R=0;const A=new Array(T),G=new Array(T);let z=0;const de=new Uint8Array(b.buffer);for(let L=0;L<T;L++){const $=L<P?V:oe;A[L]=de.slice(R,R+$),G[L]=B.encode(A[L]),R+=$,z=Math.max(z,$)}const ie=new Uint8Array(p);let Q=0,H,O;for(H=0;H<z;H++)for(O=0;O<T;O++)H<A[O].length&&(ie[Q++]=A[O][H]);for(H=0;H<Y;H++)for(O=0;O<T;O++)ie[Q++]=G[O][H];return ie}function M(b,N,k,p){let S;if(Array.isArray(b))S=h.fromArray(b);else if(typeof b=="string"){let j=N;if(!j){const V=h.rawSplit(b);j=d.getBestVersionForData(V,k)}S=h.fromString(b,j||40)}else throw new Error("Invalid data");const E=d.getBestVersionForData(S,k);if(!E)throw new Error("The amount of data is too big to be stored in a QR Code");if(!N)N=E;else if(N<E)throw new Error(`
5
- The chosen QR Code version cannot contain this amount of data.
6
- Minimum version required to store current data is: `+E+`.
7
- `);const T=C(N,k,S),w=e.getSymbolSize(N),P=new i(w);return f(P,N),g(P),x(P,N),_(P,k,0),N>=7&&I(P,N),y(P,T),isNaN(p)&&(p=s.getBestMask(P,_.bind(null,P,k))),s.applyMask(p,P),_(P,k,p),{modules:P,version:N,errorCorrectionLevel:k,maskPattern:p,segments:S}}return Te.create=function(N,k){if(typeof N>"u"||N==="")throw new Error("No input text");let p=t.M,S,E;return typeof k<"u"&&(p=t.from(k.errorCorrectionLevel,t.M),S=d.from(k.version),E=s.from(k.maskPattern),k.toSJISFunc&&e.setToSJISFunction(k.toSJISFunc)),M(N,S,p,E)},Te}var Ye={},Ge={},Kt;function pn(){return Kt||(Kt=1,(function(e){function t(o){if(typeof o=="number"&&(o=o.toString()),typeof o!="string")throw new Error("Color should be defined as hex string");let i=o.slice().replace("#","").split("");if(i.length<3||i.length===5||i.length>8)throw new Error("Invalid hex color: "+o);(i.length===3||i.length===4)&&(i=Array.prototype.concat.apply([],i.map(function(r){return[r,r]}))),i.length===6&&i.push("F","F");const n=parseInt(i.join(""),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:"#"+i.slice(0,6).join("")}}e.getOptions=function(i){i||(i={}),i.color||(i.color={});const n=typeof i.margin>"u"||i.margin===null||i.margin<0?4:i.margin,r=i.width&&i.width>=21?i.width:void 0,s=i.scale||4;return{width:r,scale:r?4:s,margin:n,color:{dark:t(i.color.dark||"#000000ff"),light:t(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},e.getScale=function(i,n){return n.width&&n.width>=i+n.margin*2?n.width/(i+n.margin*2):n.scale},e.getImageWidth=function(i,n){const r=e.getScale(i,n);return Math.floor((i+n.margin*2)*r)},e.qrToImageData=function(i,n,r){const s=n.modules.size,l=n.modules.data,a=e.getScale(s,r),d=Math.floor((s+r.margin*2)*a),m=r.margin*a,u=[r.color.light,r.color.dark];for(let h=0;h<d;h++)for(let f=0;f<d;f++){let g=(h*d+f)*4,x=r.color.light;if(h>=m&&f>=m&&h<d-m&&f<d-m){const I=Math.floor((h-m)/a),_=Math.floor((f-m)/a);x=u[l[I*s+_]?1:0]}i[g++]=x.r,i[g++]=x.g,i[g++]=x.b,i[g]=x.a}}})(Ge)),Ge}var Vt;function $n(){return Vt||(Vt=1,(function(e){const t=pn();function o(n,r,s){n.clearRect(0,0,r.width,r.height),r.style||(r.style={}),r.height=s,r.width=s,r.style.height=s+"px",r.style.width=s+"px"}function i(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}e.render=function(r,s,l){let a=l,d=s;typeof a>"u"&&(!s||!s.getContext)&&(a=s,s=void 0),s||(d=i()),a=t.getOptions(a);const m=t.getImageWidth(r.modules.size,a),u=d.getContext("2d"),h=u.createImageData(m,m);return t.qrToImageData(h.data,r,a),o(u,d,m),u.putImageData(h,0,0),d},e.renderToDataURL=function(r,s,l){let a=l;typeof a>"u"&&(!s||!s.getContext)&&(a=s,s=void 0),a||(a={});const d=e.render(r,s,a),m=a.type||"image/png",u=a.rendererOpts||{};return d.toDataURL(m,u.quality)}})(Ye)),Ye}var Qe={},Jt;function er(){if(Jt)return Qe;Jt=1;const e=pn();function t(n,r){const s=n.a/255,l=r+'="'+n.hex+'"';return s<1?l+" "+r+'-opacity="'+s.toFixed(2).slice(1)+'"':l}function o(n,r,s){let l=n+r;return typeof s<"u"&&(l+=" "+s),l}function i(n,r,s){let l="",a=0,d=!1,m=0;for(let u=0;u<n.length;u++){const h=Math.floor(u%r),f=Math.floor(u/r);!h&&!d&&(d=!0),n[u]?(m++,u>0&&h>0&&n[u-1]||(l+=d?o("M",h+s,.5+f+s):o("m",a,0),a=0,d=!1),h+1<r&&n[u+1]||(l+=o("h",m),m=0)):a++}return l}return Qe.render=function(r,s,l){const a=e.getOptions(s),d=r.modules.size,m=r.modules.data,u=d+a.margin*2,h=a.color.light.a?"<path "+t(a.color.light,"fill")+' d="M0 0h'+u+"v"+u+'H0z"/>':"",f="<path "+t(a.color.dark,"stroke")+' d="'+i(m,d,a.margin)+'"/>',g='viewBox="0 0 '+u+" "+u+'"',I='<svg xmlns="http://www.w3.org/2000/svg" '+(a.width?'width="'+a.width+'" height="'+a.width+'" ':"")+g+' shape-rendering="crispEdges">'+h+f+`</svg>
8
- `;return typeof l=="function"&&l(null,I),I},Qe}var Yt;function tr(){if(Yt)return ne;Yt=1;const e=Dn(),t=Zn(),o=$n(),i=er();function n(r,s,l,a,d){const m=[].slice.call(arguments,1),u=m.length,h=typeof m[u-1]=="function";if(!h&&!e())throw new Error("Callback required as last argument");if(h){if(u<2)throw new Error("Too few arguments provided");u===2?(d=l,l=s,s=a=void 0):u===3&&(s.getContext&&typeof d>"u"?(d=a,a=void 0):(d=a,a=l,l=s,s=void 0))}else{if(u<1)throw new Error("Too few arguments provided");return u===1?(l=s,s=a=void 0):u===2&&!s.getContext&&(a=l,l=s,s=void 0),new Promise(function(f,g){try{const x=t.create(l,a);f(r(x,s,a))}catch(x){g(x)}})}try{const f=t.create(l,a);d(null,r(f,s,a))}catch(f){d(f)}}return ne.create=t.create,ne.toCanvas=n.bind(null,o.render),ne.toDataURL=n.bind(null,o.renderToDataURL),ne.toString=n.bind(null,function(r,s,l){return i.render(r,l)}),ne}var nr=tr();const rr=Mn(nr);function ae({message:e,confirmLabel:t="Confirm",confirmDanger:o=!1,onConfirm:i,onCancel:n}){return c("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},children:c("div",{className:"glass-card p-5 flex flex-col gap-4 w-72",children:[c("p",{className:"text-sm text-center",style:{color:"var(--text-main)"},children:e}),c("div",{className:"flex gap-2",children:[c("button",{onClick:n,className:"glass-btn flex-1 py-2 text-sm",style:{color:"var(--text-muted)"},children:"Cancel"}),c("button",{onClick:i,className:"flex-1 py-2 text-sm font-semibold rounded-xl",style:{background:o?"rgba(220,53,69,0.8)":"var(--brand-500)",color:"#fff"},children:t})]})]})})}const Gt="9remote.cc";function or(e){if(e<=0)return"Expired";const t=Math.floor(e/1e3),o=Math.floor(t/60),i=t%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}`}function me({icon:e,onClick:t,title:o,danger:i}){return c("button",{onClick:t,title:o,className:"glass-btn w-7 h-7 flex items-center justify-center flex-shrink-0",style:i?{color:"rgba(255,100,100,0.7)"}:{color:"var(--text-muted)"},children:c("span",{className:"material-symbols-outlined",style:{fontSize:15},children:e})})}function Qt({qrUrl:e,oneTimeKey:t,oneTimeKeyExpiresAt:o,permanentKey:i,onGenerateOneTimeKey:n,onRegenerateKey:r}){const s=un(null),[l,a]=F(null),[d,m]=F(null),[u,h]=F(null);ue(()=>{!e||!s.current||rr.toCanvas(s.current,e,{width:160,margin:1,color:{dark:"#0f1923",light:"#ffffff"}}).catch(()=>{})},[e]),ue(()=>{if(!o){a(null);return}const g=()=>a(o-Date.now());g();const x=setInterval(g,1e3);return()=>clearInterval(x)},[o]);const f=(g,x)=>{navigator.clipboard.writeText(g).catch(()=>{}),m(x),setTimeout(()=>m(null),2e3)};return c(Z,{children:[u==="oneTime"&&c(ae,{message:"Generate a new one-time key? The current one will expire immediately.",confirmLabel:"Generate",onConfirm:()=>{h(null),n==null||n()},onCancel:()=>h(null)}),u==="regen"&&c(ae,{message:"Regenerate permanent key? All existing sessions will be disconnected.",confirmLabel:"Regenerate",confirmDanger:!0,onConfirm:()=>{h(null),r==null||r()},onCancel:()=>h(null)}),c("div",{className:"glass-card p-5 flex flex-col items-center gap-4",children:[c("div",{className:"w-44 h-44 rounded-xl overflow-hidden bg-white p-2 flex items-center justify-center flex-shrink-0",children:e?c("canvas",{ref:s}):c("span",{className:"material-symbols-outlined text-gray-300 text-6xl",children:"qr_code_2"})}),c("div",{className:"flex flex-col items-center gap-1",children:[c("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Scan QR or open link to sign in"}),c("a",{href:`https://${Gt}/login`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 hover:underline transition-opacity",children:[c("span",{className:"w-2 h-2 rounded-full bg-green-400 flex-shrink-0"}),c("span",{className:"text-sm font-bold",style:{color:"var(--brand-500)"},children:[Gt,"/login"]}),c("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:14,color:"var(--brand-500)"},children:"open_in_new"})]})]}),c("div",{className:"w-full h-px",style:{background:"var(--border)"}}),c("div",{className:"w-full flex flex-col gap-1.5",children:[c("div",{className:"flex items-center justify-between px-0.5",children:[c("span",{className:"text-xs font-medium",style:{color:"var(--text-muted)"},children:"One-Time Key"}),c("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Single use · expires"})]}),c("div",{className:"w-full flex items-center gap-2 dark-card px-3 py-2.5",children:[c("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:16,color:"var(--text-muted)"},children:"timer"}),c("span",{className:"flex-1 font-mono font-bold tracking-[0.18em] text-base truncate",style:{color:t?"var(--brand-500)":"var(--border)"},children:t||"• • • • • •"}),l!==null&&c("span",{className:`text-xs font-mono flex-shrink-0 ${l<=0?"text-red-400":""}`,style:l>0?{color:"var(--text-muted)"}:{},children:or(l)}),t&&c(me,{icon:d==="oneTime"?"check":"content_copy",onClick:()=>f(t,"oneTime"),title:"Copy one-time key"}),c(me,{icon:"refresh",onClick:()=>h("oneTime"),title:"New one-time key"})]})]}),c("div",{className:"w-full flex flex-col gap-1.5",children:[c("div",{className:"flex items-center justify-between px-0.5",children:[c("span",{className:"text-xs font-medium",style:{color:"var(--text-muted)"},children:"Permanent Key"}),c("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Reusable · no expiry"})]}),c("div",{className:"w-full flex items-center gap-2 dark-card px-3 py-2.5",children:[c("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:16,color:"var(--text-muted)"},children:"key"}),c("span",{className:"flex-1 font-mono text-xs truncate",style:{color:"var(--text-muted)"},children:i||"— not set —"}),i&&c(me,{icon:d==="permanent"?"check":"content_copy",onClick:()=>f(i,"permanent"),title:"Copy permanent key"}),c(me,{icon:"autorenew",onClick:()=>h("regen"),title:"Regenerate permanent key",danger:!0})]})]})]})]})}const ir="https://docs.9remote.cc/",gn={screenRecording:{label:"Screen Recording",icon:"screenshot_monitor",desc:"Capture screen content"},accessibility:{label:"Accessibility",icon:"accessibility_new",desc:"Control mouse & keyboard"}};function sr({type:e,granted:t,onRequest:o}){const i=gn[e]||{label:e,desc:""};return c("div",{className:"flex items-center gap-3 py-2 border-b last:border-0",style:{borderColor:"var(--border)"},children:[c("span",{className:`material-symbols-outlined flex-shrink-0 ${t?"text-green-400":""}`,style:{fontSize:18,color:t?void 0:"var(--text-muted)"},children:t?"check_circle":"cancel"}),c("div",{className:"flex-1 min-w-0",children:[c("p",{className:"text-xs font-medium",style:{color:t?"var(--text-main)":"var(--text-muted)"},children:i.label}),c("p",{className:"text-[10px] leading-4",style:{color:"var(--text-muted)"},children:i.desc})]}),!t&&c("button",{onClick:()=>o(e),title:"Click to grant permission",className:"flex-shrink-0 w-11 h-6 rounded-full transition-all relative",style:{background:"var(--border)",cursor:"pointer"},children:c("span",{className:"absolute top-0.5 w-5 h-5 rounded-full bg-white transition-all",style:{left:"2px",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"}})})]})}function lr({desktopEnabled:e,onDesktopToggle:t,permissions:o,onRequestPermission:i}){const n=Object.entries(gn),s=!n.every(([l])=>!!(o!=null&&o[l]))&&!e;return c("div",{className:"glass-card p-4 flex flex-col gap-3",children:[c("div",{className:"flex items-center gap-3",children:[c("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:"rgba(255,87,10,0.15)"},children:c("span",{className:"material-symbols-outlined",style:{fontSize:20,color:"var(--brand-400)"},children:"terminal"})}),c("div",{className:"flex-1 min-w-0",children:[c("p",{className:"text-sm font-semibold",style:{color:"var(--text-main)"},children:"Remote Terminal"}),c("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Full shell access · always on"})]}),c("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-full",style:{background:"rgba(74,222,128,0.1)"},children:[c("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400"}),c("span",{className:"text-xs text-green-400 font-medium",children:"On"})]})]}),c("div",{className:"w-full h-px",style:{background:"var(--border)"}}),c("div",{className:"flex items-center gap-3",children:[c("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:e?"rgba(255,87,10,0.15)":"var(--glass-bg)"},children:c("span",{className:"material-symbols-outlined",style:{fontSize:20,color:e?"var(--brand-400)":"var(--text-muted)"},children:"desktop_windows"})}),c("div",{className:"flex-1 min-w-0",children:[c("p",{className:"text-sm font-semibold",style:{color:"var(--text-main)"},children:"Remote Desktop"}),c("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Control screen, mouse & keyboard"})]}),c("button",{onClick:s?void 0:t,disabled:s,title:s?"Grant all permissions below to enable":"",className:"flex-shrink-0 w-11 h-6 rounded-full transition-all relative",style:{background:e?"var(--brand-500)":"var(--border)",opacity:s?.5:1,cursor:s?"not-allowed":"pointer"},children:c("span",{className:"absolute top-0.5 w-5 h-5 rounded-full bg-white transition-all",style:{left:e?"calc(100% - 22px)":"2px",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"}})})]}),c("div",{className:"flex flex-col border-t pt-2",style:{borderColor:"var(--border)"},children:[c("p",{className:"text-[10px] uppercase tracking-wider mb-1",style:{color:"var(--text-muted)"},children:"System Permissions"}),n.map(([l])=>c(sr,{type:l,granted:(o==null?void 0:o[l])??!1,onRequest:i},l))]})]})}function ar({version:e}){return e?c("div",{className:"px-5 py-2 flex items-center gap-2 border-b",style:{background:"rgba(255,87,10,0.08)",borderColor:"rgba(255,87,10,0.2)"},children:[c("span",{className:"material-symbols-outlined text-sm flex-shrink-0",style:{color:"var(--brand-400)"},children:"system_update"}),c("span",{className:"text-xs flex-1",style:{color:"var(--brand-400)"},children:["Version ",e," available"]}),c("button",{onClick:()=>fetch("/api/update",{method:"POST"}).catch(()=>{}),className:"flex-shrink-0 text-xs px-2 py-0.5 rounded font-medium",style:{background:"rgba(255,87,10,0.15)",color:"var(--brand-400)"},children:"Update"})]}):null}const cr=[{icon:"terminal",label:"Terminal",desc:"Full shell access"},{icon:"desktop_windows",label:"Desktop",desc:"Remote screen control"},{icon:"folder_open",label:"Files",desc:"Browse & edit files"}],ur=[{icon:"qr_code_scanner",text:"Scan QR to connect instantly"},{icon:"wifi_off",text:"No port forwarding needed"},{icon:"devices",text:"Works on any device"}];function dr({onStart:e}){const[t,o]=F(!1),i=()=>{o(!0),e()};return c("div",{className:"flex-1 flex flex-col items-center justify-between px-6 py-6 overflow-y-auto",children:[c("div",{className:"flex flex-col items-center gap-2 text-center mt-2",children:[c("div",{className:"w-14 h-14 rounded-2xl flex items-center justify-center mb-1",style:{background:"var(--brand-500)",boxShadow:"0 8px 32px rgba(255,87,10,0.35)"},children:c("span",{className:"material-symbols-outlined text-white",style:{fontSize:30},children:"terminal"})}),c("h1",{className:"text-lg font-bold tracking-tight",style:{color:"var(--text-main)"},children:"9Remote"}),c("p",{className:"text-xs leading-5 max-w-[220px]",style:{color:"var(--text-muted)"},children:"Access your terminal, desktop & files from anywhere"})]}),c("div",{className:"flex gap-2 w-full mt-5",children:cr.map(n=>c("div",{className:"flex-1 dark-card flex flex-col items-center gap-1.5 py-3 px-1",children:[c("span",{className:"material-symbols-outlined",style:{fontSize:22,color:"var(--brand-400)"},children:n.icon}),c("p",{className:"text-xs font-semibold",style:{color:"var(--text-main)"},children:n.label}),c("p",{className:"text-[10px] text-center leading-4",style:{color:"var(--text-muted)"},children:n.desc})]},n.label))}),c("div",{className:"flex flex-col gap-2 w-full mt-4",children:ur.map(n=>c("div",{className:"flex items-center gap-2.5",children:[c("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:16,color:"var(--brand-400)"},children:n.icon}),c("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:n.text})]},n.text))}),c("button",{onClick:t?void 0:i,disabled:t,className:"btn-primary w-full py-3.5 flex items-center justify-center gap-2 text-sm font-semibold mt-6",style:{borderRadius:"var(--radius-brand)",opacity:t?.7:1},children:t?c(Z,{children:[c("span",{className:"flex gap-0.5 items-center",children:[0,1,2].map(n=>c("span",{className:"w-1.5 h-1.5 rounded-full bg-white dot-bounce",style:{animationDelay:`${n*.18}s`}},n))}),"Connecting..."]}):c(Z,{children:[c("span",{className:"material-symbols-outlined text-base",children:"play_arrow"}),"Connect"]})})]})}function fr(e,t,o=[]){const i=new Map;for(const l of t){if(!l.deviceId)continue;const a=i.get(l.deviceId);(!a||l.connectedAt&&l.connectedAt<a.connectedAt)&&i.set(l.deviceId,l)}const n=e.map(l=>{const a=i.get(l.deviceId);return{deviceId:l.deviceId,status:a?"online":"offline",ip:(a==null?void 0:a.ip)||null,connectedAt:(a==null?void 0:a.connectedAt)||null,approvedAt:l.approvedAt||null}}),r=o.map(l=>({deviceId:l.deviceId,status:"pending",ip:l.ip||null,connectedAt:null,approvedAt:null,rejectedAt:l.rejectedAt||null})),s={online:0,pending:1,offline:2};return[...n,...r].sort((l,a)=>s[l.status]-s[a.status])}const Wt={online:{color:"#4ade80",icon:"wifi",title:"Online"},offline:{color:"var(--text-muted)",icon:"wifi_off",title:"Offline"},pending:{color:"#f59e0b",icon:"hourglass_top",title:"Pending approval"}};function hr({client:e,onRemove:t,onApprove:o}){const i=`${e.deviceId.slice(0,8)}...`,n=Wt[e.status]||Wt.offline,r=e.status==="online"?`Connected · ${e.connectedAt?new Date(e.connectedAt).toLocaleTimeString():""}`:e.status==="pending"?"Pending · waiting for approval":e.approvedAt?`Offline · approved ${new Date(e.approvedAt).toLocaleDateString()}`:"Offline",s=e.status==="online"?"Disconnect":"Remove";return c("div",{className:"flex items-center gap-3 py-2 border-b last:border-0",style:{borderColor:"var(--border)"},children:[c("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:18,color:n.color},title:n.title,children:n.icon}),c("div",{className:"flex-1 min-w-0",children:[c("p",{className:"text-xs font-medium font-mono truncate",style:{color:"var(--text-main)"},children:[i,e.ip?` · ${e.ip}`:""]}),c("p",{className:"text-[10px]",style:{color:"var(--text-muted)"},children:r})]}),e.status==="pending"&&c("button",{onClick:()=>o==null?void 0:o(e),className:"flex-shrink-0 text-xs px-2 py-1 rounded-lg font-medium",style:{background:"rgba(74,222,128,0.15)",color:"#4ade80"},title:"Approve this device",children:"Approve"}),c("button",{onClick:()=>t(e),className:"flex-shrink-0 text-xs px-2 py-1 rounded-lg font-medium",style:{background:"rgba(220,53,69,0.15)",color:"#dc3545"},title:"Disconnect and remove this device",children:s})]})}function mr({step:e,stepDesc:t="",healthCheck:o,tunnelUrl:i,oneTimeKey:n,oneTimeKeyExpiresAt:r,permanentKey:s,qrUrl:l,permissions:a,desktopEnabled:d,updateVersion:m,connections:u=[],version:h="",onRequestPermission:f,onDesktopToggle:g,onStop:x,onStart:I,onShutdown:_,onGenerateOneTimeKey:y,onRegenerateKey:C,logs:v=[],theme:M,onToggleTheme:b,pendingDevice:N,onDeviceApprove:k,onDeviceReject:p,approvedDevices:S=[],rejectedDevices:E=[],onDeviceRemove:T,onFetchDevices:w,onDeviceApproveRejected:P}){var O;const[j,V]=F("connect"),[oe,Y]=F(!1),[B,R]=F(!1),[A,G]=F(null),z=un(null),de=e===0,ie=e>0&&e<5;ue(()=>{var L;j==="log"&&((L=z.current)==null||L.scrollIntoView({behavior:"smooth"})),j==="connect"&&(w==null||w())},[v,j,u.length]);const Q=fr(S,u,E),H=Q.filter(L=>L.status==="online").length;return c("div",{className:"h-full flex flex-col relative overflow-hidden",style:{background:"var(--bg-body)"},children:[c("div",{className:"flex-1 flex flex-col w-full min-h-0 dot-grid-bg overflow-hidden md:max-w-5xl p-3",style:{margin:"0 auto"},children:[c("div",{className:"flex items-center justify-between px-5 py-4",style:{boxShadow:"var(--header-shadow)",backdropFilter:"blur(10px)"},children:[c("div",{className:"flex items-center gap-3",children:[c("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--brand-500)"},children:c("span",{className:"material-symbols-outlined text-white text-base",children:"terminal"})}),c("div",{className:"flex flex-col leading-tight",children:[c("span",{className:"brand-text text-xs",children:"9Remote"}),h&&c("span",{className:"text-[10px]",style:{color:"var(--text-muted)"},children:["v",h]})]})]}),c("div",{className:"flex items-center gap-2",children:[c("button",{onClick:b,className:"glass-btn w-7 h-7 flex items-center justify-center",style:{color:"var(--text-muted)"},title:M==="dark"?"Switch to light mode":"Switch to dark mode",children:c("span",{className:"material-symbols-outlined text-sm",children:M==="dark"?"light_mode":"dark_mode"})}),c("button",{onClick:()=>window.open(ir,"_blank"),className:"glass-btn w-7 h-7 flex items-center justify-center",style:{color:"var(--text-muted)"},children:c("span",{className:"material-symbols-outlined text-sm",children:"help_outline"})}),!de&&c("button",{onClick:()=>Y(!0),className:"btn-danger px-3 h-7 flex items-center gap-1.5 text-xs font-medium",children:[c("span",{className:"material-symbols-outlined text-sm",children:"stop_circle"}),"Disconnect"]}),c("button",{onClick:()=>R(!0),className:"glass-btn w-7 h-7 flex items-center justify-center",style:{color:"var(--text-muted)"},title:"Shutdown 9Remote (stop server, tunnel and quit)",children:c("span",{className:"material-symbols-outlined text-sm",children:"power_settings_new"})})]})]}),c(ar,{version:m}),de?c(dr,{onStart:I,connecting:!1}):ie?c("div",{className:"flex-1 overflow-y-auto px-5 py-4 flex flex-col gap-4 max-w-2xl mx-auto w-full",children:c(Bn,{currentStep:e,activeDesc:t,healthCheck:o})}):c("div",{className:"flex-1 flex flex-col md:flex-row min-h-0",children:[c("div",{className:"hidden md:flex md:flex-col sidebar w-96 flex-shrink-0 overflow-y-auto p-5 gap-4",children:c(Qt,{qrUrl:l,oneTimeKey:n,oneTimeKeyExpiresAt:r,permanentKey:s,tunnelUrl:i,onGenerateOneTimeKey:y,onRegenerateKey:C})}),c("div",{className:"flex-1 flex flex-col min-h-0",children:[c("div",{className:"flex px-5 pt-3 gap-3",style:{borderColor:"var(--border)"},children:[{id:"connect",label:"Connection"},{id:"log",label:"Logs"}].map(L=>c("button",{onClick:()=>V(L.id),className:"py-2 text-xs font-medium border-b-2 transition-colors",style:j===L.id?{borderColor:"var(--brand-500)",color:"var(--brand-500)"}:{borderColor:"transparent",color:"var(--text-muted)"},children:L.label},L.id))}),c("div",{className:"flex-1 overflow-y-auto px-5 py-4 flex flex-col gap-4",children:[j==="connect"&&c(Z,{children:[c("div",{className:"md:hidden",children:c(Qt,{qrUrl:l,oneTimeKey:n,oneTimeKeyExpiresAt:r,permanentKey:s,tunnelUrl:i,onGenerateOneTimeKey:y,onRegenerateKey:C})}),c(lr,{desktopEnabled:d,onDesktopToggle:g,permissions:a,onRequestPermission:f}),c("div",{className:"glass-card p-4 flex flex-col gap-1",children:[c("p",{className:"text-xs font-medium uppercase tracking-wider mb-2",style:{color:"var(--text-muted)"},children:["Clients",Q.length>0?` (${H}/${Q.length} online)`:""]}),Q.length===0?c("p",{className:"text-xs text-center py-3",style:{color:"var(--text-muted)"},children:"No clients yet"}):Q.map(L=>c(hr,{client:L,onRemove:G,onApprove:$=>P==null?void 0:P($.deviceId)},L.deviceId))]})]}),j==="log"&&c("div",{className:"flex-1 flex flex-col",children:v.length===0?c("p",{className:"text-xs text-center mt-8",style:{color:"var(--text-muted)"},children:"No logs yet"}):c("div",{className:"flex flex-col gap-0.5",children:[v.map((L,$)=>c("p",{className:"text-xs font-mono leading-5 break-all",style:{color:"var(--text-muted)"},children:L},$)),c("div",{ref:z})]})})]})]})]})]}),oe&&c(ae,{message:"Disconnect and stop the tunnel? Remote clients will be disconnected.",confirmLabel:"Disconnect",confirmDanger:!0,onConfirm:()=>{Y(!1),x==null||x()},onCancel:()=>Y(!1)}),B&&c(ae,{message:"Shutdown 9Remote completely? This will stop the server, close the tunnel and quit the app.",confirmLabel:"Shutdown",confirmDanger:!0,onConfirm:()=>{R(!1),_==null||_()},onCancel:()=>R(!1)}),A&&c(ae,{message:A.status==="online"?`Disconnect and remove device ${A.deviceId.slice(0,8)}...? The client will be disconnected and need approval again next time.`:A.status==="pending"?`Remove pending device ${A.deviceId.slice(0,8)}...? It will need a fresh approval request to connect again.`:`Remove device ${A.deviceId.slice(0,8)}...? It will need approval again next time.`,confirmLabel:A.status==="online"?"Disconnect & Remove":"Remove",confirmDanger:!0,onConfirm:()=>{T==null||T(A),G(null)},onCancel:()=>G(null)}),N&&c("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},children:c("div",{className:"glass-card p-5 flex flex-col gap-4 w-80",children:[c("div",{className:"flex items-center gap-2",children:[c("span",{className:"material-symbols-outlined",style:{color:"var(--brand-500)",fontSize:24},children:"devices"}),c("span",{className:"text-sm font-semibold",style:{color:"var(--text-main)"},children:"New Device Connection"})]}),c("div",{className:"flex flex-col gap-1 text-xs",style:{color:"var(--text-muted)"},children:[c("span",{children:["Device: ",c("span",{style:{color:"var(--text-main)"},children:[(O=N.deviceId)==null?void 0:O.slice(0,8),"..."]})]}),c("span",{children:["IP: ",c("span",{style:{color:"var(--text-main)"},children:N.ip})]})]}),c("div",{className:"flex gap-2",children:[c("button",{onClick:p,className:"glass-btn flex-1 py-2 text-sm",style:{color:"var(--text-muted)"},children:"Reject"}),c("button",{onClick:k,className:"flex-1 py-2 text-sm font-semibold rounded-xl",style:{background:"var(--brand-500)",color:"#fff"},children:"Approve"})]})]})})]})}const tt={running:!1,timeoutMs:0,startedAt:null,logs:[]},We={step:0,stepDesc:"",tunnelUrl:"",oneTimeKey:"",oneTimeKeyExpiresAt:null,permanentKey:"",qrUrl:"",latency:null,uptime:null,healthCheck:tt},_r={screenRecording:!1,accessibility:!1},Xt=200;function pr(){const[e,t]=F(We),[o,i]=F(_r),[n,r]=F(!1),[s,l]=F([]),[a,d]=F(null),[m,u]=F([]),[h,f]=F(null),[g,x]=F([]),[I,_]=F([]),[y,C]=F(""),[v,M]=F(()=>localStorage.getItem("9remote-theme")||"dark");ue(()=>{document.documentElement.setAttribute("data-theme",v),localStorage.setItem("9remote-theme",v)},[v]);const b=()=>{M(B=>B==="dark"?"light":"dark")};ue(()=>{fetch("/api/version").then(R=>R.json()).then(R=>C(R.version??"")).catch(()=>{}),fetch("/api/ui/state").then(R=>R.json()).then(R=>{t({step:R.step??0,stepDesc:R.stepDesc??"",tunnelUrl:R.tunnelUrl??"",oneTimeKey:R.oneTimeKey??"",oneTimeKeyExpiresAt:R.oneTimeKeyExpiresAt??null,permanentKey:R.permanentKey??"",qrUrl:R.qrUrl??"",latency:R.latency??null,uptime:R.uptime??null,healthCheck:R.healthCheck??tt}),i({screenRecording:R.screenRecording??!1,accessibility:R.accessibility??!1}),R.desktopEnabled!==void 0&&r(R.desktopEnabled),R.theme&&(R.theme==="light"||R.theme==="dark")&&M(R.theme)}).catch(()=>{});const B=new EventSource("/api/ui/events");return B.onmessage=R=>{try{const A=JSON.parse(R.data);A.type==="state"?t({step:A.step??0,stepDesc:A.stepDesc??"",tunnelUrl:A.tunnelUrl??"",oneTimeKey:A.oneTimeKey??"",oneTimeKeyExpiresAt:A.oneTimeKeyExpiresAt??null,permanentKey:A.permanentKey??"",qrUrl:A.qrUrl??"",latency:A.latency??null,uptime:A.uptime??null,healthCheck:A.healthCheck??tt}):A.type==="log"?l(G=>{const z=[...G,A.message];return z.length>Xt?z.slice(-Xt):z}):A.type==="updateAvailable"?d(A.version):A.type==="permissions"?(i({screenRecording:A.screenRecording,accessibility:A.accessibility}),A.desktopEnabled!==void 0&&r(A.desktopEnabled)):A.type==="connections"?u(A.connections??[]):A.type==="deviceApproval"&&A.action==="pending"?f({socketId:A.socketId,deviceId:A.deviceId,ip:A.ip}):A.type==="deviceApproval"&&A.action==="refresh"&&w()}catch{}},B.onerror=()=>{},()=>B.close()},[]);const N=async B=>{await fetch("/api/permissions/request",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:B})}).catch(()=>{})},k=()=>{fetch("/api/ui/stop",{method:"POST"}).catch(()=>{}),t(We)},p=()=>{fetch("/api/ui/start",{method:"POST"}).catch(()=>{})},S=()=>{fetch("/api/ui/shutdown",{method:"POST"}).catch(()=>{}),t(We)},E=async()=>{const B=await fetch("/api/key/one-time",{method:"POST"}).catch(()=>null);if(!(B!=null&&B.ok))return;const R=await B.json().catch(()=>null);R!=null&&R.oneTimeKey&&t(A=>({...A,oneTimeKey:R.oneTimeKey,oneTimeKeyExpiresAt:R.expiresAt,qrUrl:R.qrUrl??A.qrUrl}))},T=async()=>{const B=!n;r(B),await fetch("/api/desktop/toggle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:B})}).catch(()=>{})},w=async()=>{try{const[B,R]=await Promise.all([fetch("/api/device/approved"),fetch("/api/device/rejected")]);if(B.ok){const A=await B.json();x(A.devices||[])}if(R.ok){const A=await R.json();_(A.rejected||[])}}catch{}},P=async B=>{const R=B.status==="pending"?"/api/device/clear-rejected":"/api/device/remove";await fetch(R,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceId:B.deviceId})}).catch(()=>{}),w()},j=async()=>{h&&(await fetch("/api/device/approve",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({socketId:h.socketId})}).catch(()=>{}),f(null),w())},V=async()=>{h&&(await fetch("/api/device/reject",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({socketId:h.socketId})}).catch(()=>{}),f(null),w())},oe=async B=>{await fetch("/api/device/approve-rejected",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({deviceId:B})}).catch(()=>{}),w()},Y=async()=>{const B=await fetch("/api/key/regenerate",{method:"POST"}).catch(()=>null);if(!(B!=null&&B.ok))return;const R=await B.json().catch(()=>null);R!=null&&R.permanentKey&&t(A=>({...A,permanentKey:R.permanentKey}))};return c(mr,{step:e.step,stepDesc:e.stepDesc,healthCheck:e.healthCheck,tunnelUrl:e.tunnelUrl,oneTimeKey:e.oneTimeKey,oneTimeKeyExpiresAt:e.oneTimeKeyExpiresAt,permanentKey:e.permanentKey,qrUrl:e.qrUrl,permissions:o,desktopEnabled:n,updateVersion:a,connections:m,onRequestPermission:N,onDesktopToggle:T,onStop:k,onStart:p,onShutdown:S,onGenerateOneTimeKey:E,onRegenerateKey:Y,logs:s,version:y,theme:v,onToggleTheme:b,pendingDevice:h,onDeviceApprove:j,onDeviceReject:V,approvedDevices:g,rejectedDevices:I,onDeviceRemove:P,onFetchDevices:w,onDeviceApproveRejected:oe})}kn(c(pr,{}),document.getElementById("root"));