9remote 0.1.63 → 2.0.1

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.
@@ -1,8 +0,0 @@
1
- (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.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 ue,B,Ot,j,et,Vt,Jt,Yt,Ve,He,ze,se={},le=[],hn=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,de=Array.isArray;function F(t,e){for(var o in e)t[o]=e[o];return t}function Je(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function mn(t,e,o){var i,n,r,s={};for(r in e)r=="key"?i=e[r]:r=="ref"?n=e[r]:s[r]=e[r];if(arguments.length>2&&(s.children=arguments.length>3?ue.call(arguments,2):o),typeof t=="function"&&t.defaultProps!=null)for(r in t.defaultProps)s[r]===void 0&&(s[r]=t.defaultProps[r]);return re(t,s,i,n,null)}function re(t,e,o,i,n){var r={type:t,props:e,key:o,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:n??++Ot,__i:-1,__u:0};return n==null&&B.vnode!=null&&B.vnode(r),r}function K(t){return t.children}function oe(t,e){this.props=t,this.context=e}function G(t,e){if(e==null)return t.__?G(t.__,t.__i+1):null;for(var o;e<t.__k.length;e++)if((o=t.__k[e])!=null&&o.__e!=null)return o.__e;return typeof t.type=="function"?G(t):null}function _n(t){if(t.__P&&t.__d){var e=t.__v,o=e.__e,i=[],n=[],r=F({},e);r.__v=e.__v+1,B.vnode&&B.vnode(r),Ye(t.__P,r,e,t.__n,t.__P.namespaceURI,32&e.__u?[o]:null,i,o??G(e),!!(32&e.__u),n),r.__v=e.__v,r.__.__k[r.__i]=r,Xt(i,r,n),e.__e=e.__=null,r.__e!=o&&Gt(r)}}function Gt(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(e){if(e!=null&&e.__e!=null)return t.__e=t.__c.base=e.__e}),Gt(t)}function tt(t){(!t.__d&&(t.__d=!0)&&j.push(t)&&!ae.__r++||et!=B.debounceRendering)&&((et=B.debounceRendering)||Vt)(ae)}function ae(){try{for(var t,e=1;j.length;)j.length>e&&j.sort(Jt),t=j.shift(),e=j.length,_n(t)}finally{j.length=ae.__r=0}}function Qt(t,e,o,i,n,r,s,l,a,d,h){var c,_,f,v,C,P,y,b=i&&i.__k||le,k=e.length;for(a=gn(o,e,b,a,k),c=0;c<k;c++)(f=o.__k[c])!=null&&(_=f.__i!=-1&&b[f.__i]||se,f.__i=c,P=Ye(t,f,_,n,r,s,l,a,d,h),v=f.__e,f.ref&&_.ref!=f.ref&&(_.ref&&Ge(_.ref,null,f),h.push(f.ref,f.__c||v,f)),C==null&&v!=null&&(C=v),(y=!!(4&f.__u))||_.__k===f.__k?a=Wt(f,a,t,y):typeof f.type=="function"&&P!==void 0?a=P:v&&(a=v.nextSibling),f.__u&=-7);return o.__e=C,a}function gn(t,e,o,i,n){var r,s,l,a,d,h=o.length,c=h,_=0;for(t.__k=new Array(n),r=0;r<n;r++)(s=e[r])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=t.__k[r]=re(null,s,null,null,null):de(s)?s=t.__k[r]=re(K,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=t.__k[r]=re(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):t.__k[r]=s,a=r+_,s.__=t,s.__b=t.__b+1,l=null,(d=s.__i=pn(s,o,a,c))!=-1&&(c--,(l=o[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(n>h?_--:n<h&&_++),typeof s.type!="function"&&(s.__u|=4)):d!=a&&(d==a-1?_--:d==a+1?_++:(d>a?_--:_++,s.__u|=4))):t.__k[r]=null;if(c)for(r=0;r<h;r++)(l=o[r])!=null&&(2&l.__u)==0&&(l.__e==i&&(i=G(l)),$t(l,l));return i}function Wt(t,e,o,i){var n,r;if(typeof t.type=="function"){for(n=t.__k,r=0;n&&r<n.length;r++)n[r]&&(n[r].__=t,e=Wt(n[r],e,o,i));return e}t.__e!=e&&(i&&(e&&t.type&&!e.parentNode&&(e=G(t)),o.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function pn(t,e,o,i){var n,r,s,l=t.key,a=t.type,d=e[o],h=d!=null&&(2&d.__u)==0;if(d===null&&l==null||h&&l==d.key&&a==d.type)return o;if(i>(h?1:0)){for(n=o-1,r=o+1;n>=0||r<e.length;)if((d=e[s=n>=0?n--:r++])!=null&&(2&d.__u)==0&&l==d.key&&a==d.type)return s}return-1}function nt(t,e,o){e[0]=="-"?t.setProperty(e,o??""):t[e]=o==null?"":typeof o!="number"||hn.test(e)?o:o+"px"}function ee(t,e,o,i,n){var r,s;e:if(e=="style")if(typeof o=="string")t.style.cssText=o;else{if(typeof i=="string"&&(t.style.cssText=i=""),i)for(e in i)o&&e in o||nt(t.style,e,"");if(o)for(e in o)i&&o[e]==i[e]||nt(t.style,e,o[e])}else if(e[0]=="o"&&e[1]=="n")r=e!=(e=e.replace(Yt,"$1")),s=e.toLowerCase(),e=s in t||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=o,o?i?o.u=i.u:(o.u=Ve,t.addEventListener(e,r?ze:He,r)):t.removeEventListener(e,r?ze:He,r);else{if(n=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=o??"";break e}catch{}typeof o=="function"||(o==null||o===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&o==1?"":o))}}function rt(t){return function(e){if(this.l){var o=this.l[e.type+t];if(e.t==null)e.t=Ve++;else if(e.t<o.u)return;return o(B.event?B.event(e):e)}}}function Ye(t,e,o,i,n,r,s,l,a,d){var h,c,_,f,v,C,P,y,b,k,N,A,x,p,g,m=e.type;if(e.constructor!==void 0)return null;128&o.__u&&(a=!!(32&o.__u),r=[l=e.__e=o.__e]),(h=B.__b)&&h(e);e:if(typeof m=="function")try{if(y=e.props,b=m.prototype&&m.prototype.render,k=(h=m.contextType)&&i[h.__c],N=h?k?k.props.value:h.__:i,o.__c?P=(c=e.__c=o.__c).__=c.__E:(b?e.__c=c=new m(y,N):(e.__c=c=new oe(y,N),c.constructor=m,c.render=vn),k&&k.sub(c),c.state||(c.state={}),c.__n=i,_=c.__d=!0,c.__h=[],c._sb=[]),b&&c.__s==null&&(c.__s=c.state),b&&m.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=F({},c.__s)),F(c.__s,m.getDerivedStateFromProps(y,c.__s))),f=c.props,v=c.state,c.__v=e,_)b&&m.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),b&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(b&&m.getDerivedStateFromProps==null&&y!==f&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(y,N),e.__v==o.__v||!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(y,c.__s,N)===!1){e.__v!=o.__v&&(c.props=y,c.state=c.__s,c.__d=!1),e.__e=o.__e,e.__k=o.__k,e.__k.some(function(E){E&&(E.__=e)}),le.push.apply(c.__h,c._sb),c._sb=[],c.__h.length&&s.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(y,c.__s,N),b&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(f,v,C)})}if(c.context=N,c.props=y,c.__P=t,c.__e=!1,A=B.__r,x=0,b)c.state=c.__s,c.__d=!1,A&&A(e),h=c.render(c.props,c.state,c.context),le.push.apply(c.__h,c._sb),c._sb=[];else do c.__d=!1,A&&A(e),h=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++x<25);c.state=c.__s,c.getChildContext!=null&&(i=F(F({},i),c.getChildContext())),b&&!_&&c.getSnapshotBeforeUpdate!=null&&(C=c.getSnapshotBeforeUpdate(f,v)),p=h!=null&&h.type===K&&h.key==null?Zt(h.props.children):h,l=Qt(t,de(p)?p:[p],e,o,i,n,r,s,l,a,d),c.base=e.__e,e.__u&=-161,c.__h.length&&s.push(c),P&&(c.__E=c.__=null)}catch(E){if(e.__v=null,a||r!=null)if(E.then){for(e.__u|=a?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;r[r.indexOf(l)]=null,e.__e=l}else{for(g=r.length;g--;)Je(r[g]);je(e)}else e.__e=o.__e,e.__k=o.__k,E.then||je(e);B.__e(E,e,o)}else r==null&&e.__v==o.__v?(e.__k=o.__k,e.__e=o.__e):l=e.__e=yn(o.__e,e,o,i,n,r,s,a,d);return(h=B.diffed)&&h(e),128&e.__u?void 0:l}function je(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(je))}function Xt(t,e,o){for(var i=0;i<o.length;i++)Ge(o[i],o[++i],o[++i]);B.__c&&B.__c(e,t),t.some(function(n){try{t=n.__h,n.__h=[],t.some(function(r){r.call(n)})}catch(r){B.__e(r,n.__v)}})}function Zt(t){return typeof t!="object"||t==null||t.__b>0?t:de(t)?t.map(Zt):F({},t)}function yn(t,e,o,i,n,r,s,l,a){var d,h,c,_,f,v,C,P=o.props||se,y=e.props,b=e.type;if(b=="svg"?n="http://www.w3.org/2000/svg":b=="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==!!b&&(b?f.localName==b:f.nodeType==3)){t=f,r[d]=null;break}}if(t==null){if(b==null)return document.createTextNode(y);t=document.createElementNS(n,b,y.is&&y),l&&(B.__m&&B.__m(e,r),l=!1),r=null}if(b==null)P===y||l&&t.data==y||(t.data=y);else{if(r=r&&ue.call(t.childNodes),!l&&r!=null)for(P={},d=0;d<t.attributes.length;d++)P[(f=t.attributes[d]).name]=f.value;for(d in P)f=P[d],d=="dangerouslySetInnerHTML"?c=f:d=="children"||d in y||d=="value"&&"defaultValue"in y||d=="checked"&&"defaultChecked"in y||ee(t,d,null,f,n);for(d in y)f=y[d],d=="children"?_=f:d=="dangerouslySetInnerHTML"?h=f:d=="value"?v=f:d=="checked"?C=f:l&&typeof f!="function"||P[d]===f||ee(t,d,f,P[d],n);if(h)l||c&&(h.__html==c.__html||h.__html==t.innerHTML)||(t.innerHTML=h.__html),e.__k=[];else if(c&&(t.innerHTML=""),Qt(e.type=="template"?t.content:t,de(_)?_:[_],e,o,i,b=="foreignObject"?"http://www.w3.org/1999/xhtml":n,r,s,r?r[0]:o.__k&&G(o,0),l,a),r!=null)for(d=r.length;d--;)Je(r[d]);l||(d="value",b=="progress"&&v==null?t.removeAttribute("value"):v!=null&&(v!==t[d]||b=="progress"&&!v||b=="option"&&v!=P[d])&&ee(t,d,v,P[d],n),d="checked",C!=null&&C!=t[d]&&ee(t,d,C,P[d],n))}return t}function Ge(t,e,o){try{if(typeof t=="function"){var i=typeof t.__u=="function";i&&t.__u(),i&&e==null||(t.__u=t(e))}else t.current=e}catch(n){B.__e(n,o)}}function $t(t,e,o){var i,n;if(B.unmount&&B.unmount(t),(i=t.ref)&&(i.current&&i.current!=t.__e||Ge(i,null,e)),(i=t.__c)!=null){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(r){B.__e(r,e)}i.base=i.__P=null}if(i=t.__k)for(n=0;n<i.length;n++)i[n]&&$t(i[n],e,o||typeof t.type!="function");o||Je(t.__e),t.__c=t.__=t.__e=void 0}function vn(t,e,o){return this.constructor(t,o)}function bn(t,e,o){var i,n,r,s;e==document&&(e=document.documentElement),B.__&&B.__(t,e),n=(i=!1)?null:e.__k,r=[],s=[],Ye(e,t=e.__k=mn(K,null,[t]),n||se,se,e.namespaceURI,n?null:e.firstChild?ue.call(e.childNodes):null,r,n?n.__e:e.firstChild,i,s),Xt(r,t,s)}ue=le.slice,B={__e:function(t,e,o,i){for(var n,r,s;e=e.__;)if((n=e.__c)&&!n.__)try{if((r=n.constructor)&&r.getDerivedStateFromError!=null&&(n.setState(r.getDerivedStateFromError(t)),s=n.__d),n.componentDidCatch!=null&&(n.componentDidCatch(t,i||{}),s=n.__d),s)return n.__E=n}catch(l){t=l}throw t}},Ot=0,oe.prototype.setState=function(t,e){var o;o=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=F({},this.state),typeof t=="function"&&(t=t(F({},o),this.props)),t&&F(o,t),t!=null&&this.__v&&(e&&this._sb.push(e),tt(this))},oe.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),tt(this))},oe.prototype.render=K,j=[],Vt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Jt=function(t,e){return t.__v.__b-e.__v.__b},ae.__r=0,Yt=/(PointerCapture)$|Capture$/i,Ve=0,He=rt(!1),ze=rt(!0);var wn=0;function u(t,e,o,i,n,r){e||(e={});var s,l,a=e;if("ref"in a)for(l in a={},e)l=="ref"?s=e[l]:a[l]=e[l];var d={type:t,props:a,key:o,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--wn,__i:-1,__u:0,__source:n,__self:r};if(typeof t=="function"&&(s=t.defaultProps))for(l in s)a[l]===void 0&&(a[l]=s[l]);return B.vnode&&B.vnode(d),d}var X,I,ge,ot,ce=0,en=[],M=B,it=M.__b,st=M.__r,lt=M.diffed,at=M.__c,ct=M.unmount,ut=M.__;function Qe(t,e){M.__h&&M.__h(I,t,ce||e),ce=0;var o=I.__H||(I.__H={__:[],__h:[]});return t>=o.__.length&&o.__.push({}),o.__[t]}function L(t){return ce=1,xn(rn,t)}function xn(t,e,o){var i=Qe(X++,2);if(i.t=t,!i.__c&&(i.__=[rn(void 0,e),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=I,!I.__f)){var n=function(l,a,d){if(!i.__c.__H)return!0;var h=i.__c.__H.__.filter(function(_){return _.__c});if(h.every(function(_){return!_.__N}))return!r||r.call(this,l,a,d);var c=i.__c.props!==l;return h.some(function(_){if(_.__N){var f=_.__[0];_.__=_.__N,_.__N=void 0,f!==_.__[0]&&(c=!0)}}),r&&r.call(this,l,a,d)||c};I.__f=!0;var r=I.shouldComponentUpdate,s=I.componentWillUpdate;I.componentWillUpdate=function(l,a,d){if(this.__e){var h=r;r=void 0,n(l,a,d),r=h}s&&s.call(this,l,a,d)},I.shouldComponentUpdate=n}return i.__N||i.__}function Z(t,e){var o=Qe(X++,3);!M.__s&&nn(o.__H,e)&&(o.__=t,o.u=e,I.__H.__h.push(o))}function tn(t){return ce=5,Nn(function(){return{current:t}},[])}function Nn(t,e){var o=Qe(X++,7);return nn(o.__H,e)&&(o.__=t(),o.__H=e,o.__h=t),o.__}function Cn(){for(var t;t=en.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(ie),e.__h.some(Ke),e.__h=[]}catch(o){e.__h=[],M.__e(o,t.__v)}}}M.__b=function(t){I=null,it&&it(t)},M.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),ut&&ut(t,e)},M.__r=function(t){st&&st(t),X=0;var e=(I=t.__c).__H;e&&(ge===I?(e.__h=[],I.__h=[],e.__.some(function(o){o.__N&&(o.__=o.__N),o.u=o.__N=void 0})):(e.__h.some(ie),e.__h.some(Ke),e.__h=[],X=0)),ge=I},M.diffed=function(t){lt&&lt(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(en.push(e)!==1&&ot===M.requestAnimationFrame||((ot=M.requestAnimationFrame)||kn)(Cn)),e.__H.__.some(function(o){o.u&&(o.__H=o.u),o.u=void 0})),ge=I=null},M.__c=function(t,e){e.some(function(o){try{o.__h.some(ie),o.__h=o.__h.filter(function(i){return!i.__||Ke(i)})}catch(i){e.some(function(n){n.__h&&(n.__h=[])}),e=[],M.__e(i,o.__v)}}),at&&at(t,e)},M.unmount=function(t){ct&&ct(t);var e,o=t.__c;o&&o.__H&&(o.__H.__.some(function(i){try{ie(i)}catch(n){e=n}}),o.__H=void 0,e&&M.__e(e,o.__v))};var dt=typeof requestAnimationFrame=="function";function kn(t){var e,o=function(){clearTimeout(i),dt&&cancelAnimationFrame(e),setTimeout(t)},i=setTimeout(o,35);dt&&(e=requestAnimationFrame(o))}function ie(t){var e=I,o=t.__c;typeof o=="function"&&(t.__c=void 0,o()),I=e}function Ke(t){var e=I;t.__c=t.__(),I=e}function nn(t,e){return!t||t.length!==e.length||e.some(function(o,i){return o!==t[i]})}function rn(t,e){return typeof e=="function"?e(t):e}const En=[{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:"check_circle",label:"Ready",desc:"Connected"}];function Sn({currentStep:t}){const e=t-1;return u("div",{className:"glass-card p-5 flex flex-col gap-4",children:[u("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:"var(--text-muted)"},children:"Setting up connection"}),u("div",{className:"flex flex-col gap-3",children:En.map((o,i)=>{const n=i<e,r=i===e;return u("div",{className:"flex items-center gap-3",children:[u("div",{className:"w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0",style:{background:n?"var(--brand-500)":r?"rgba(255,87,10,0.15)":"var(--glass-bg)",border:r?"1.5px solid var(--brand-500)":"1.5px solid transparent"},children:n?u("span",{className:"material-symbols-outlined text-white",style:{fontSize:16},children:"check"}):r?u("span",{className:"flex gap-0.5 items-center",children:[0,1,2].map(s=>u("span",{className:"w-1 h-1 rounded-full bg-orange-400 dot-bounce",style:{animationDelay:`${s*.18}s`}},s))}):u("span",{className:"material-symbols-outlined",style:{fontSize:16,color:"var(--text-muted)",opacity:.3},children:o.icon})}),u("div",{className:"flex-1 min-w-0",children:[u("p",{className:"text-sm font-medium",style:{color:n?"var(--text-muted)":r?"var(--text-main)":"var(--text-muted)",opacity:n||r?1:.4},children:o.label}),u("p",{className:"text-xs mt-0.5",style:{color:"var(--text-muted)",opacity:r?.7:.4},children:o.desc})]}),n&&u("span",{className:"text-xs flex-shrink-0",style:{color:"var(--text-muted)"},children:"Done"}),r&&u("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"})]},i)})})]})}function Tn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Y={},pe,ft;function Pn(){return ft||(ft=1,pe=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then}),pe}var ye={},z={},ht;function O(){if(ht)return z;ht=1;let t;const e=[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 e[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.');t=i},z.isKanjiModeEnabled=function(){return typeof t<"u"},z.toSJIS=function(i){return t(i)},z}var ve={},mt;function We(){return mt||(mt=1,(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+o)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,n){if(t.isValid(i))return i;try{return e(i)}catch{return n}}})(ve)),ve}var be,_t;function Rn(){if(_t)return be;_t=1;function t(){this.buffer=[],this.length=0}return t.prototype={get:function(e){const o=Math.floor(e/8);return(this.buffer[o]>>>7-e%8&1)===1},put:function(e,o){for(let i=0;i<o;i++)this.putBit((e>>>o-i-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const o=Math.floor(this.length/8);this.buffer.length<=o&&this.buffer.push(0),e&&(this.buffer[o]|=128>>>this.length%8),this.length++}},be=t,be}var we,gt;function An(){if(gt)return we;gt=1;function t(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}return t.prototype.set=function(e,o,i,n){const r=e*this.size+o;this.data[r]=i,n&&(this.reservedBit[r]=!0)},t.prototype.get=function(e,o){return this.data[e*this.size+o]},t.prototype.xor=function(e,o,i){this.data[e*this.size+o]^=i},t.prototype.isReserved=function(e,o){return this.reservedBit[e*this.size+o]},we=t,we}var xe={},pt;function Bn(){return pt||(pt=1,(function(t){const e=O().getSymbolSize;t.getRowColCoords=function(i){if(i===1)return[];const n=Math.floor(i/7)+2,r=e(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()},t.getPositions=function(i){const n=[],r=t.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}})(xe)),xe}var Ne={},yt;function In(){if(yt)return Ne;yt=1;const t=O().getSymbolSize,e=7;return Ne.getPositions=function(i){const n=t(i);return[[0,0],[n-e,0],[0,n-e]]},Ne}var Ce={},vt;function Mn(){return vt||(vt=1,(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};const e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(n){const r=n.size;let s=0,l=0,a=0,d=null,h=null;for(let c=0;c<r;c++){l=a=0,d=h=null;for(let _=0;_<r;_++){let f=n.get(c,_);f===d?l++:(l>=5&&(s+=e.N1+(l-5)),d=f,l=1),f=n.get(_,c),f===h?a++:(a>=5&&(s+=e.N1+(a-5)),h=f,a=1)}l>=5&&(s+=e.N1+(l-5)),a>=5&&(s+=e.N1+(a-5))}return s},t.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*e.N2},t.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 h=0;h<r;h++)l=l<<1&2047|n.get(d,h),h>=10&&(l===1488||l===93)&&s++,a=a<<1&2047|n.get(h,d),h>=10&&(a===1488||a===93)&&s++}return s*e.N3},t.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)*e.N4};function o(i,n,r){switch(i){case t.Patterns.PATTERN000:return(n+r)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return r%3===0;case t.Patterns.PATTERN011:return(n+r)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2===0;case t.Patterns.PATTERN101:return n*r%2+n*r%3===0;case t.Patterns.PATTERN110:return(n*r%2+n*r%3)%2===0;case t.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.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))},t.getBestMask=function(n,r){const s=Object.keys(t.Patterns).length;let l=0,a=1/0;for(let d=0;d<s;d++){r(d),t.applyMask(d,n);const h=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(d,n),h<a&&(a=h,l=d)}return l}})(Ce)),Ce}var te={},bt;function on(){if(bt)return te;bt=1;const t=We(),e=[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 te.getBlocksCount=function(n,r){switch(r){case t.L:return e[(n-1)*4+0];case t.M:return e[(n-1)*4+1];case t.Q:return e[(n-1)*4+2];case t.H:return e[(n-1)*4+3];default:return}},te.getTotalCodewordsCount=function(n,r){switch(r){case t.L:return o[(n-1)*4+0];case t.M:return o[(n-1)*4+1];case t.Q:return o[(n-1)*4+2];case t.H:return o[(n-1)*4+3];default:return}},te}var ke={},W={},wt;function Ln(){if(wt)return W;wt=1;const t=new Uint8Array(512),e=new Uint8Array(256);return(function(){let i=1;for(let n=0;n<255;n++)t[n]=i,e[i]=n,i<<=1,i&256&&(i^=285);for(let n=255;n<512;n++)t[n]=t[n-255]})(),W.log=function(i){if(i<1)throw new Error("log("+i+")");return e[i]},W.exp=function(i){return t[i]},W.mul=function(i,n){return i===0||n===0?0:t[e[i]+e[n]]},W}var xt;function Dn(){return xt||(xt=1,(function(t){const e=Ln();t.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]^=e.mul(i[s],n[l]);return r},t.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]^=e.mul(n[a],s);let l=0;for(;l<r.length&&r[l]===0;)l++;r=r.slice(l)}return r},t.generateECPolynomial=function(i){let n=new Uint8Array([1]);for(let r=0;r<i;r++)n=t.mul(n,new Uint8Array([1,e.exp(r)]));return n}})(ke)),ke}var Ee,Nt;function Un(){if(Nt)return Ee;Nt=1;const t=Dn();function e(o){this.genPoly=void 0,this.degree=o,this.degree&&this.initialize(this.degree)}return e.prototype.initialize=function(i){this.degree=i,this.genPoly=t.generateECPolynomial(this.degree)},e.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=t.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},Ee=e,Ee}var Se={},Te={},Pe={},Ct;function sn(){return Ct||(Ct=1,Pe.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}),Pe}var D={},kt;function ln(){if(kt)return D;kt=1;const t="[0-9]+",e="[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
- ]))+`;D.KANJI=new RegExp(o,"g"),D.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g"),D.BYTE=new RegExp(i,"g"),D.NUMERIC=new RegExp(t,"g"),D.ALPHANUMERIC=new RegExp(e,"g");const n=new RegExp("^"+o+"$"),r=new RegExp("^"+t+"$"),s=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");return D.testKanji=function(a){return n.test(a)},D.testNumeric=function(a){return r.test(a)},D.testAlphanumeric=function(a){return s.test(a)},D}var Et;function V(){return Et||(Et=1,(function(t){const e=sn(),o=ln();t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(r,s){if(!r.ccBits)throw new Error("Invalid mode: "+r);if(!e.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?r.ccBits[0]:s<27?r.ccBits[1]:r.ccBits[2]},t.getBestModeForData=function(r){return o.testNumeric(r)?t.NUMERIC:o.testAlphanumeric(r)?t.ALPHANUMERIC:o.testKanji(r)?t.KANJI:t.BYTE},t.toString=function(r){if(r&&r.id)return r.id;throw new Error("Invalid mode")},t.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 t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+n)}}t.from=function(r,s){if(t.isValid(r))return r;try{return i(r)}catch{return s}}})(Te)),Te}var St;function qn(){return St||(St=1,(function(t){const e=O(),o=on(),i=We(),n=V(),r=sn(),s=7973,l=e.getBCHDigit(s);function a(_,f,v){for(let C=1;C<=40;C++)if(f<=t.getCapacity(C,v,_))return C}function d(_,f){return n.getCharCountIndicator(_,f)+4}function h(_,f){let v=0;return _.forEach(function(C){const P=d(C.mode,f);v+=P+C.getBitsLength()}),v}function c(_,f){for(let v=1;v<=40;v++)if(h(_,v)<=t.getCapacity(v,f,n.MIXED))return v}t.from=function(f,v){return r.isValid(f)?parseInt(f,10):v},t.getCapacity=function(f,v,C){if(!r.isValid(f))throw new Error("Invalid QR Code version");typeof C>"u"&&(C=n.BYTE);const P=e.getSymbolTotalCodewords(f),y=o.getTotalCodewordsCount(f,v),b=(P-y)*8;if(C===n.MIXED)return b;const k=b-d(C,f);switch(C){case n.NUMERIC:return Math.floor(k/10*3);case n.ALPHANUMERIC:return Math.floor(k/11*2);case n.KANJI:return Math.floor(k/13);case n.BYTE:default:return Math.floor(k/8)}},t.getBestVersionForData=function(f,v){let C;const P=i.from(v,i.M);if(Array.isArray(f)){if(f.length>1)return c(f,P);if(f.length===0)return 1;C=f[0]}else C=f;return a(C.mode,C.getLength(),P)},t.getEncodedBits=function(f){if(!r.isValid(f)||f<7)throw new Error("Invalid QR Code version");let v=f<<12;for(;e.getBCHDigit(v)-l>=0;)v^=s<<e.getBCHDigit(v)-l;return f<<12|v}})(Se)),Se}var Re={},Tt;function Fn(){if(Tt)return Re;Tt=1;const t=O(),e=1335,o=21522,i=t.getBCHDigit(e);return Re.getEncodedBits=function(r,s){const l=r.bit<<3|s;let a=l<<10;for(;t.getBCHDigit(a)-i>=0;)a^=e<<t.getBCHDigit(a)-i;return(l<<10|a)^o},Re}var Ae={},Be,Pt;function Hn(){if(Pt)return Be;Pt=1;const t=V();function e(o){this.mode=t.NUMERIC,this.data=o.toString()}return e.getBitsLength=function(i){return 10*Math.floor(i/3)+(i%3?i%3*3+1:0)},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.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))},Be=e,Be}var Ie,Rt;function zn(){if(Rt)return Ie;Rt=1;const t=V(),e=["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=t.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=e.indexOf(this.data[r])*45;s+=e.indexOf(this.data[r+1]),n.put(s,11)}this.data.length%2&&n.put(e.indexOf(this.data[r]),6)},Ie=o,Ie}var Me,At;function jn(){if(At)return Me;At=1;const t=V();function e(o){this.mode=t.BYTE,typeof o=="string"?this.data=new TextEncoder().encode(o):this.data=new Uint8Array(o)}return e.getBitsLength=function(i){return i*8},e.prototype.getLength=function(){return this.data.length},e.prototype.getBitsLength=function(){return e.getBitsLength(this.data.length)},e.prototype.write=function(o){for(let i=0,n=this.data.length;i<n;i++)o.put(this.data[i],8)},Me=e,Me}var Le,Bt;function Kn(){if(Bt)return Le;Bt=1;const t=V(),e=O();function o(i){this.mode=t.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=e.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)}},Le=o,Le}var De={exports:{}},It;function On(){return It||(It=1,(function(t){var e={single_source_shortest_paths:function(o,i,n){var r={},s={};s[i]=0;var l=e.PriorityQueue.make();l.push(i,0);for(var a,d,h,c,_,f,v,C,P;!l.empty();){a=l.pop(),d=a.value,c=a.cost,_=o[d]||{};for(h in _)_.hasOwnProperty(h)&&(f=_[h],v=c+f,C=s[h],P=typeof s[h]>"u",(P||C>v)&&(s[h]=v,l.push(h,v),r[h]=d))}if(typeof n<"u"&&typeof s[n]>"u"){var y=["Could not find a path from ",i," to ",n,"."].join("");throw new Error(y)}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=e.single_source_shortest_paths(o,i,n);return e.extract_shortest_path_from_predecessor_list(r,n)},PriorityQueue:{make:function(o){var i=e.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}}};t.exports=e})(De)),De.exports}var Mt;function Vn(){return Mt||(Mt=1,(function(t){const e=V(),o=Hn(),i=zn(),n=jn(),r=Kn(),s=ln(),l=O(),a=On();function d(y){return unescape(encodeURIComponent(y)).length}function h(y,b,k){const N=[];let A;for(;(A=y.exec(k))!==null;)N.push({data:A[0],index:A.index,mode:b,length:A[0].length});return N}function c(y){const b=h(s.NUMERIC,e.NUMERIC,y),k=h(s.ALPHANUMERIC,e.ALPHANUMERIC,y);let N,A;return l.isKanjiModeEnabled()?(N=h(s.BYTE,e.BYTE,y),A=h(s.KANJI,e.KANJI,y)):(N=h(s.BYTE_KANJI,e.BYTE,y),A=[]),b.concat(k,N,A).sort(function(p,g){return p.index-g.index}).map(function(p){return{data:p.data,mode:p.mode,length:p.length}})}function _(y,b){switch(b){case e.NUMERIC:return o.getBitsLength(y);case e.ALPHANUMERIC:return i.getBitsLength(y);case e.KANJI:return r.getBitsLength(y);case e.BYTE:return n.getBitsLength(y)}}function f(y){return y.reduce(function(b,k){const N=b.length-1>=0?b[b.length-1]:null;return N&&N.mode===k.mode?(b[b.length-1].data+=k.data,b):(b.push(k),b)},[])}function v(y){const b=[];for(let k=0;k<y.length;k++){const N=y[k];switch(N.mode){case e.NUMERIC:b.push([N,{data:N.data,mode:e.ALPHANUMERIC,length:N.length},{data:N.data,mode:e.BYTE,length:N.length}]);break;case e.ALPHANUMERIC:b.push([N,{data:N.data,mode:e.BYTE,length:N.length}]);break;case e.KANJI:b.push([N,{data:N.data,mode:e.BYTE,length:d(N.data)}]);break;case e.BYTE:b.push([{data:N.data,mode:e.BYTE,length:d(N.data)}])}}return b}function C(y,b){const k={},N={start:{}};let A=["start"];for(let x=0;x<y.length;x++){const p=y[x],g=[];for(let m=0;m<p.length;m++){const E=p[m],w=""+x+m;g.push(w),k[w]={node:E,lastCount:0},N[w]={};for(let S=0;S<A.length;S++){const T=A[S];k[T]&&k[T].node.mode===E.mode?(N[T][w]=_(k[T].lastCount+E.length,E.mode)-_(k[T].lastCount,E.mode),k[T].lastCount+=E.length):(k[T]&&(k[T].lastCount=E.length),N[T][w]=_(E.length,E.mode)+4+e.getCharCountIndicator(E.mode,b))}}A=g}for(let x=0;x<A.length;x++)N[A[x]].end=0;return{map:N,table:k}}function P(y,b){let k;const N=e.getBestModeForData(y);if(k=e.from(b,N),k!==e.BYTE&&k.bit<N.bit)throw new Error('"'+y+'" cannot be encoded with mode '+e.toString(k)+`.
4
- Suggested mode is: `+e.toString(N));switch(k===e.KANJI&&!l.isKanjiModeEnabled()&&(k=e.BYTE),k){case e.NUMERIC:return new o(y);case e.ALPHANUMERIC:return new i(y);case e.KANJI:return new r(y);case e.BYTE:return new n(y)}}t.fromArray=function(b){return b.reduce(function(k,N){return typeof N=="string"?k.push(P(N,null)):N.data&&k.push(P(N.data,N.mode)),k},[])},t.fromString=function(b,k){const N=c(b,l.isKanjiModeEnabled()),A=v(N),x=C(A,k),p=a.find_path(x.map,"start","end"),g=[];for(let m=1;m<p.length-1;m++)g.push(x.table[p[m]].node);return t.fromArray(f(g))},t.rawSplit=function(b){return t.fromArray(c(b,l.isKanjiModeEnabled()))}})(Ae)),Ae}var Lt;function Jn(){if(Lt)return ye;Lt=1;const t=O(),e=We(),o=Rn(),i=An(),n=Bn(),r=In(),s=Mn(),l=on(),a=Un(),d=qn(),h=Fn(),c=V(),_=Vn();function f(x,p){const g=x.size,m=r.getPositions(p);for(let E=0;E<m.length;E++){const w=m[E][0],S=m[E][1];for(let T=-1;T<=7;T++)if(!(w+T<=-1||g<=w+T))for(let R=-1;R<=7;R++)S+R<=-1||g<=S+R||(T>=0&&T<=6&&(R===0||R===6)||R>=0&&R<=6&&(T===0||T===6)||T>=2&&T<=4&&R>=2&&R<=4?x.set(w+T,S+R,!0,!0):x.set(w+T,S+R,!1,!0))}}function v(x){const p=x.size;for(let g=8;g<p-8;g++){const m=g%2===0;x.set(g,6,m,!0),x.set(6,g,m,!0)}}function C(x,p){const g=n.getPositions(p);for(let m=0;m<g.length;m++){const E=g[m][0],w=g[m][1];for(let S=-2;S<=2;S++)for(let T=-2;T<=2;T++)S===-2||S===2||T===-2||T===2||S===0&&T===0?x.set(E+S,w+T,!0,!0):x.set(E+S,w+T,!1,!0)}}function P(x,p){const g=x.size,m=d.getEncodedBits(p);let E,w,S;for(let T=0;T<18;T++)E=Math.floor(T/3),w=T%3+g-8-3,S=(m>>T&1)===1,x.set(E,w,S,!0),x.set(w,E,S,!0)}function y(x,p,g){const m=x.size,E=h.getEncodedBits(p,g);let w,S;for(w=0;w<15;w++)S=(E>>w&1)===1,w<6?x.set(w,8,S,!0):w<8?x.set(w+1,8,S,!0):x.set(m-15+w,8,S,!0),w<8?x.set(8,m-w-1,S,!0):w<9?x.set(8,15-w-1+1,S,!0):x.set(8,15-w-1,S,!0);x.set(m-8,8,1,!0)}function b(x,p){const g=x.size;let m=-1,E=g-1,w=7,S=0;for(let T=g-1;T>0;T-=2)for(T===6&&T--;;){for(let R=0;R<2;R++)if(!x.isReserved(E,T-R)){let H=!1;S<p.length&&(H=(p[S]>>>w&1)===1),x.set(E,T-R,H),w--,w===-1&&(S++,w=7)}if(E+=m,E<0||g<=E){E-=m,m=-m;break}}}function k(x,p,g){const m=new o;g.forEach(function(R){m.put(R.mode.bit,4),m.put(R.getLength(),c.getCharCountIndicator(R.mode,x)),R.write(m)});const E=t.getSymbolTotalCodewords(x),w=l.getTotalCodewordsCount(x,p),S=(E-w)*8;for(m.getLengthInBits()+4<=S&&m.put(0,4);m.getLengthInBits()%8!==0;)m.putBit(0);const T=(S-m.getLengthInBits())/8;for(let R=0;R<T;R++)m.put(R%2?17:236,8);return N(m,x,p)}function N(x,p,g){const m=t.getSymbolTotalCodewords(p),E=l.getTotalCodewordsCount(p,g),w=m-E,S=l.getBlocksCount(p,g),T=m%S,R=S-T,H=Math.floor(m/S),Q=Math.floor(w/S),un=Q+1,Xe=H-Q,dn=new a(Xe);let fe=0;const $=new Array(S),Ze=new Array(S);let he=0;const fn=new Uint8Array(x.buffer);for(let J=0;J<S;J++){const _e=J<R?Q:un;$[J]=fn.slice(fe,fe+_e),Ze[J]=dn.encode($[J]),fe+=_e,he=Math.max(he,_e)}const me=new Uint8Array(m);let $e=0,U,q;for(U=0;U<he;U++)for(q=0;q<S;q++)U<$[q].length&&(me[$e++]=$[q][U]);for(U=0;U<Xe;U++)for(q=0;q<S;q++)me[$e++]=Ze[q][U];return me}function A(x,p,g,m){let E;if(Array.isArray(x))E=_.fromArray(x);else if(typeof x=="string"){let H=p;if(!H){const Q=_.rawSplit(x);H=d.getBestVersionForData(Q,g)}E=_.fromString(x,H||40)}else throw new Error("Invalid data");const w=d.getBestVersionForData(E,g);if(!w)throw new Error("The amount of data is too big to be stored in a QR Code");if(!p)p=w;else if(p<w)throw new Error(`
5
- The chosen QR Code version cannot contain this amount of data.
6
- Minimum version required to store current data is: `+w+`.
7
- `);const S=k(p,g,E),T=t.getSymbolSize(p),R=new i(T);return f(R,p),v(R),C(R,p),y(R,g,0),p>=7&&P(R,p),b(R,S),isNaN(m)&&(m=s.getBestMask(R,y.bind(null,R,g))),s.applyMask(m,R),y(R,g,m),{modules:R,version:p,errorCorrectionLevel:g,maskPattern:m,segments:E}}return ye.create=function(p,g){if(typeof p>"u"||p==="")throw new Error("No input text");let m=e.M,E,w;return typeof g<"u"&&(m=e.from(g.errorCorrectionLevel,e.M),E=d.from(g.version),w=s.from(g.maskPattern),g.toSJISFunc&&t.setToSJISFunction(g.toSJISFunc)),A(p,E,m,w)},ye}var Ue={},qe={},Dt;function an(){return Dt||(Dt=1,(function(t){function e(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("")}}t.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:e(i.color.dark||"#000000ff"),light:e(i.color.light||"#ffffffff")},type:i.type,rendererOpts:i.rendererOpts||{}}},t.getScale=function(i,n){return n.width&&n.width>=i+n.margin*2?n.width/(i+n.margin*2):n.scale},t.getImageWidth=function(i,n){const r=t.getScale(i,n);return Math.floor((i+n.margin*2)*r)},t.qrToImageData=function(i,n,r){const s=n.modules.size,l=n.modules.data,a=t.getScale(s,r),d=Math.floor((s+r.margin*2)*a),h=r.margin*a,c=[r.color.light,r.color.dark];for(let _=0;_<d;_++)for(let f=0;f<d;f++){let v=(_*d+f)*4,C=r.color.light;if(_>=h&&f>=h&&_<d-h&&f<d-h){const P=Math.floor((_-h)/a),y=Math.floor((f-h)/a);C=c[l[P*s+y]?1:0]}i[v++]=C.r,i[v++]=C.g,i[v++]=C.b,i[v]=C.a}}})(qe)),qe}var Ut;function Yn(){return Ut||(Ut=1,(function(t){const e=an();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")}}t.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=e.getOptions(a);const h=e.getImageWidth(r.modules.size,a),c=d.getContext("2d"),_=c.createImageData(h,h);return e.qrToImageData(_.data,r,a),o(c,d,h),c.putImageData(_,0,0),d},t.renderToDataURL=function(r,s,l){let a=l;typeof a>"u"&&(!s||!s.getContext)&&(a=s,s=void 0),a||(a={});const d=t.render(r,s,a),h=a.type||"image/png",c=a.rendererOpts||{};return d.toDataURL(h,c.quality)}})(Ue)),Ue}var Fe={},qt;function Gn(){if(qt)return Fe;qt=1;const t=an();function e(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,h=0;for(let c=0;c<n.length;c++){const _=Math.floor(c%r),f=Math.floor(c/r);!_&&!d&&(d=!0),n[c]?(h++,c>0&&_>0&&n[c-1]||(l+=d?o("M",_+s,.5+f+s):o("m",a,0),a=0,d=!1),_+1<r&&n[c+1]||(l+=o("h",h),h=0)):a++}return l}return Fe.render=function(r,s,l){const a=t.getOptions(s),d=r.modules.size,h=r.modules.data,c=d+a.margin*2,_=a.color.light.a?"<path "+e(a.color.light,"fill")+' d="M0 0h'+c+"v"+c+'H0z"/>':"",f="<path "+e(a.color.dark,"stroke")+' d="'+i(h,d,a.margin)+'"/>',v='viewBox="0 0 '+c+" "+c+'"',P='<svg xmlns="http://www.w3.org/2000/svg" '+(a.width?'width="'+a.width+'" height="'+a.width+'" ':"")+v+' shape-rendering="crispEdges">'+_+f+`</svg>
8
- `;return typeof l=="function"&&l(null,P),P},Fe}var Ft;function Qn(){if(Ft)return Y;Ft=1;const t=Pn(),e=Jn(),o=Yn(),i=Gn();function n(r,s,l,a,d){const h=[].slice.call(arguments,1),c=h.length,_=typeof h[c-1]=="function";if(!_&&!t())throw new Error("Callback required as last argument");if(_){if(c<2)throw new Error("Too few arguments provided");c===2?(d=l,l=s,s=a=void 0):c===3&&(s.getContext&&typeof d>"u"?(d=a,a=void 0):(d=a,a=l,l=s,s=void 0))}else{if(c<1)throw new Error("Too few arguments provided");return c===1?(l=s,s=a=void 0):c===2&&!s.getContext&&(a=l,l=s,s=void 0),new Promise(function(f,v){try{const C=e.create(l,a);f(r(C,s,a))}catch(C){v(C)}})}try{const f=e.create(l,a);d(null,r(f,s,a))}catch(f){d(f)}}return Y.create=e.create,Y.toCanvas=n.bind(null,o.render),Y.toDataURL=n.bind(null,o.renderToDataURL),Y.toString=n.bind(null,function(r,s,l){return i.render(r,l)}),Y}var Wn=Qn();const Xn=Tn(Wn);function Oe({message:t,confirmLabel:e="Confirm",confirmDanger:o=!1,onConfirm:i,onCancel:n}){return u("div",{className:"fixed inset-0 z-50 flex items-center justify-center",style:{background:"rgba(0,0,0,0.6)"},children:u("div",{className:"glass-card p-5 flex flex-col gap-4 w-72",children:[u("p",{className:"text-sm text-center",style:{color:"var(--text-main)"},children:t}),u("div",{className:"flex gap-2",children:[u("button",{onClick:n,className:"glass-btn flex-1 py-2 text-sm",style:{color:"var(--text-muted)"},children:"Cancel"}),u("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:e})]})]})})}const Ht="9remote.cc";function Zn(t){if(t<=0)return"Expired";const e=Math.floor(t/1e3),o=Math.floor(e/60),i=e%60;return`${String(o).padStart(2,"0")}:${String(i).padStart(2,"0")}`}function ne({icon:t,onClick:e,title:o,danger:i}){return u("button",{onClick:e,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:u("span",{className:"material-symbols-outlined",style:{fontSize:15},children:t})})}function zt({qrUrl:t,oneTimeKey:e,oneTimeKeyExpiresAt:o,permanentKey:i,onGenerateOneTimeKey:n,onRegenerateKey:r}){const s=tn(null),[l,a]=L(null),[d,h]=L(null),[c,_]=L(null);Z(()=>{!t||!s.current||Xn.toCanvas(s.current,t,{width:160,margin:1,color:{dark:"#0f1923",light:"#ffffff"}}).catch(()=>{})},[t]),Z(()=>{if(!o){a(null);return}const v=()=>a(o-Date.now());v();const C=setInterval(v,1e3);return()=>clearInterval(C)},[o]);const f=(v,C)=>{navigator.clipboard.writeText(v).catch(()=>{}),h(C),setTimeout(()=>h(null),2e3)};return u(K,{children:[c==="oneTime"&&u(Oe,{message:"Generate a new one-time key? The current one will expire immediately.",confirmLabel:"Generate",onConfirm:()=>{_(null),n==null||n()},onCancel:()=>_(null)}),c==="regen"&&u(Oe,{message:"Regenerate permanent key? All existing sessions will be disconnected.",confirmLabel:"Regenerate",confirmDanger:!0,onConfirm:()=>{_(null),r==null||r()},onCancel:()=>_(null)}),u("div",{className:"glass-card p-5 flex flex-col items-center gap-4",children:[u("div",{className:"w-44 h-44 rounded-xl overflow-hidden bg-white p-2 flex items-center justify-center flex-shrink-0",children:t?u("canvas",{ref:s}):u("span",{className:"material-symbols-outlined text-gray-300 text-6xl",children:"qr_code_2"})}),u("a",{href:`https://${Ht}/login`,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 hover:opacity-80 transition-opacity",children:[u("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400 flex-shrink-0"}),u("span",{className:"text-xs font-medium",style:{color:"var(--text-muted)"},children:[Ht,"/login"]})]}),u("div",{className:"w-full h-px",style:{background:"var(--border)"}}),u("div",{className:"w-full flex flex-col gap-1.5",children:[u("div",{className:"flex items-center justify-between px-0.5",children:[u("span",{className:"text-xs font-medium",style:{color:"var(--text-muted)"},children:"One-Time Key"}),u("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Single use · expires"})]}),u("div",{className:"w-full flex items-center gap-2 dark-card px-3 py-2.5",children:[u("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:16,color:"var(--text-muted)"},children:"timer"}),u("span",{className:"flex-1 font-mono font-bold tracking-[0.18em] text-base truncate",style:{color:e?"var(--brand-500)":"var(--border)"},children:e||"• • • • • •"}),l!==null&&u("span",{className:`text-xs font-mono flex-shrink-0 ${l<=0?"text-red-400":""}`,style:l>0?{color:"var(--text-muted)"}:{},children:Zn(l)}),e&&u(ne,{icon:d==="oneTime"?"check":"content_copy",onClick:()=>f(e,"oneTime"),title:"Copy one-time key"}),u(ne,{icon:"refresh",onClick:()=>_("oneTime"),title:"New one-time key"})]})]}),u("div",{className:"w-full flex flex-col gap-1.5",children:[u("div",{className:"flex items-center justify-between px-0.5",children:[u("span",{className:"text-xs font-medium",style:{color:"var(--text-muted)"},children:"Permanent Key"}),u("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Reusable · no expiry"})]}),u("div",{className:"w-full flex items-center gap-2 dark-card px-3 py-2.5",children:[u("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:16,color:"var(--text-muted)"},children:"key"}),u("span",{className:"flex-1 font-mono text-xs truncate",style:{color:"var(--text-muted)"},children:i||"— not set —"}),i&&u(ne,{icon:d==="permanent"?"check":"content_copy",onClick:()=>f(i,"permanent"),title:"Copy permanent key"}),u(ne,{icon:"autorenew",onClick:()=>_("regen"),title:"Regenerate permanent key",danger:!0})]})]})]})]})}const $n="https://docs.9remote.cc/",cn={screenRecording:{label:"Screen Recording",icon:"screenshot_monitor",desc:"Capture screen content"},accessibility:{label:"Accessibility",icon:"accessibility_new",desc:"Control mouse & keyboard"}};function er({type:t,granted:e,onRequest:o}){const i=cn[t]||{label:t,desc:""};return u("div",{className:"flex items-center gap-3 py-2 border-b last:border-0",style:{borderColor:"var(--border)"},children:[u("span",{className:`material-symbols-outlined flex-shrink-0 ${e?"text-green-400":""}`,style:{fontSize:18,color:e?void 0:"var(--text-muted)"},children:e?"check_circle":"cancel"}),u("div",{className:"flex-1 min-w-0",children:[u("p",{className:"text-xs font-medium",style:{color:e?"var(--text-main)":"var(--text-muted)"},children:i.label}),u("p",{className:"text-[10px] leading-4",style:{color:"var(--text-muted)"},children:i.desc})]}),!e&&u("button",{onClick:()=>o(t),className:"flex-shrink-0 text-xs px-2.5 py-1 rounded-lg font-medium",style:{background:"rgba(255,87,10,0.15)",color:"var(--brand-400)"},children:"Grant"})]})}function tr({desktopEnabled:t,onDesktopToggle:e,permissions:o,onRequestPermission:i}){const n=Object.entries(cn);return u("div",{className:"glass-card p-4 flex flex-col gap-3",children:[u("div",{className:"flex items-center gap-3",children:[u("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:u("span",{className:"material-symbols-outlined",style:{fontSize:20,color:"var(--brand-400)"},children:"terminal"})}),u("div",{className:"flex-1 min-w-0",children:[u("p",{className:"text-sm font-semibold",style:{color:"var(--text-main)"},children:"Remote Terminal"}),u("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Full shell access · always on"})]}),u("div",{className:"flex items-center gap-1.5 px-2 py-1 rounded-full",style:{background:"rgba(74,222,128,0.1)"},children:[u("span",{className:"w-1.5 h-1.5 rounded-full bg-green-400"}),u("span",{className:"text-xs text-green-400 font-medium",children:"On"})]})]}),u("div",{className:"w-full h-px",style:{background:"var(--border)"}}),u("div",{className:"flex items-center gap-3",children:[u("div",{className:"w-9 h-9 rounded-xl flex items-center justify-center flex-shrink-0",style:{background:t?"rgba(255,87,10,0.15)":"var(--glass-bg)"},children:u("span",{className:"material-symbols-outlined",style:{fontSize:20,color:t?"var(--brand-400)":"var(--text-muted)"},children:"desktop_windows"})}),u("div",{className:"flex-1 min-w-0",children:[u("p",{className:"text-sm font-semibold",style:{color:"var(--text-main)"},children:"Remote Desktop"}),u("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:"Control screen, mouse & keyboard"})]}),u("button",{onClick:e,className:"flex-shrink-0 w-11 h-6 rounded-full transition-all relative",style:{background:t?"var(--brand-500)":"var(--border)"},children:u("span",{className:"absolute top-0.5 w-5 h-5 rounded-full bg-white transition-all",style:{left:t?"calc(100% - 22px)":"2px",boxShadow:"0 1px 3px rgba(0,0,0,0.3)"}})})]}),t&&u("div",{className:"flex flex-col border-t pt-2",style:{borderColor:"var(--border)"},children:[u("p",{className:"text-[10px] uppercase tracking-wider mb-1",style:{color:"var(--text-muted)"},children:"System Permissions"}),n.map(([r])=>u(er,{type:r,granted:(o==null?void 0:o[r])??!1,onRequest:i},r))]})]})}function nr({version:t}){return t?u("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:[u("span",{className:"material-symbols-outlined text-sm flex-shrink-0",style:{color:"var(--brand-400)"},children:"system_update"}),u("span",{className:"text-xs flex-1",style:{color:"var(--brand-400)"},children:["Version ",t," available"]}),u("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 rr=[{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"}],or=[{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 ir({onStart:t}){const[e,o]=L(!1),i=()=>{o(!0),t()};return u("div",{className:"flex-1 flex flex-col items-center justify-between px-6 py-6 overflow-y-auto",children:[u("div",{className:"flex flex-col items-center gap-2 text-center mt-2",children:[u("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:u("span",{className:"material-symbols-outlined text-white",style:{fontSize:30},children:"terminal"})}),u("h1",{className:"text-lg font-bold tracking-tight",style:{color:"var(--text-main)"},children:"9Remote"}),u("p",{className:"text-xs leading-5 max-w-[220px]",style:{color:"var(--text-muted)"},children:"Access your terminal, desktop & files from anywhere"})]}),u("div",{className:"flex gap-2 w-full mt-5",children:rr.map(n=>u("div",{className:"flex-1 dark-card flex flex-col items-center gap-1.5 py-3 px-1",children:[u("span",{className:"material-symbols-outlined",style:{fontSize:22,color:"var(--brand-400)"},children:n.icon}),u("p",{className:"text-xs font-semibold",style:{color:"var(--text-main)"},children:n.label}),u("p",{className:"text-[10px] text-center leading-4",style:{color:"var(--text-muted)"},children:n.desc})]},n.label))}),u("div",{className:"flex flex-col gap-2 w-full mt-4",children:or.map(n=>u("div",{className:"flex items-center gap-2.5",children:[u("span",{className:"material-symbols-outlined flex-shrink-0",style:{fontSize:16,color:"var(--brand-400)"},children:n.icon}),u("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:n.text})]},n.text))}),u("button",{onClick:e?void 0:i,disabled:e,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:e?.7:1},children:e?u(K,{children:[u("span",{className:"flex gap-0.5 items-center",children:[0,1,2].map(n=>u("span",{className:"w-1.5 h-1.5 rounded-full bg-white dot-bounce",style:{animationDelay:`${n*.18}s`}},n))}),"Connecting..."]}):u(K,{children:[u("span",{className:"material-symbols-outlined text-base",children:"play_arrow"}),"Connect"]})})]})}function sr({conn:t}){return u("div",{className:"flex items-center gap-3 py-2 border-b last:border-0",style:{borderColor:"var(--border)"},children:[u("div",{className:"w-2 h-2 rounded-full bg-green-400 flex-shrink-0"}),u("div",{className:"flex-1 min-w-0",children:[u("p",{className:"text-xs font-medium truncate",style:{color:"var(--text-main)"},children:t.ip||"Unknown"}),u("p",{className:"text-xs",style:{color:"var(--text-muted)"},children:t.connectedAt?new Date(t.connectedAt).toLocaleTimeString():""})]}),u("span",{className:"text-xs",style:{color:"var(--text-muted)"},children:t.type||"ws"})]})}function lr({step:t,tunnelUrl:e,oneTimeKey:o,oneTimeKeyExpiresAt:i,permanentKey:n,qrUrl:r,permissions:s,desktopEnabled:l,updateVersion:a,connections:d=[],version:h="",onRequestPermission:c,onDesktopToggle:_,onStop:f,onStart:v,onGenerateOneTimeKey:C,onRegenerateKey:P,logs:y=[],theme:b,onToggleTheme:k}){const[N,A]=L("connect"),[x,p]=L(!1),g=tn(null),m=t===0,E=t>0&&t<4;return Z(()=>{var w;N==="log"&&((w=g.current)==null||w.scrollIntoView({behavior:"smooth"}))},[y,N]),u("div",{className:"h-full flex flex-col relative overflow-hidden",style:{background:"var(--bg-main)"},children:[u("div",{className:"flex-1 flex flex-col w-full min-h-0 dot-grid-bg overflow-hidden md:max-w-6xl",style:{margin:"0 auto"},children:[u("div",{className:"flex items-center justify-between px-5 py-4",style:{boxShadow:"var(--header-shadow)",backdropFilter:"blur(10px)"},children:[u("div",{className:"flex items-center gap-3",children:[u("div",{className:"w-7 h-7 rounded-lg flex items-center justify-center",style:{background:"var(--brand-500)"},children:u("span",{className:"material-symbols-outlined text-white text-base",children:"terminal"})}),u("div",{className:"flex flex-col leading-tight",children:[u("span",{className:"brand-text text-xs",children:"9Remote"}),h&&u("span",{className:"text-[10px]",style:{color:"var(--text-muted)"},children:["v",h]})]})]}),u("div",{className:"flex items-center gap-2",children:[u("button",{onClick:k,className:"glass-btn w-7 h-7 flex items-center justify-center",style:{color:"var(--text-muted)"},title:b==="dark"?"Switch to light mode":"Switch to dark mode",children:u("span",{className:"material-symbols-outlined text-sm",children:b==="dark"?"light_mode":"dark_mode"})}),u("button",{onClick:()=>window.open($n,"_blank"),className:"glass-btn w-7 h-7 flex items-center justify-center",style:{color:"var(--text-muted)"},children:u("span",{className:"material-symbols-outlined text-sm",children:"help_outline"})}),!m&&u("button",{onClick:()=>p(!0),className:"btn-danger px-3 h-7 flex items-center gap-1.5 text-xs font-medium",children:[u("span",{className:"material-symbols-outlined text-sm",children:"stop_circle"}),"Disconnect"]})]})]}),u(nr,{version:a}),m?u(ir,{onStart:v,connecting:!1}):E?u("div",{className:"flex-1 overflow-y-auto px-5 py-4 flex flex-col gap-4 max-w-2xl mx-auto w-full",children:u(Sn,{currentStep:t})}):u("div",{className:"flex-1 flex flex-col md:flex-row min-h-0",children:[u("div",{className:"hidden md:flex md:flex-col sidebar w-96 flex-shrink-0 overflow-y-auto p-5 gap-4",children:u(zt,{qrUrl:r,oneTimeKey:o,oneTimeKeyExpiresAt:i,permanentKey:n,tunnelUrl:e,onGenerateOneTimeKey:C,onRegenerateKey:P})}),u("div",{className:"flex-1 flex flex-col min-h-0",children:[u("div",{className:"flex px-5 pt-3 gap-3",style:{borderColor:"var(--border)"},children:[{id:"connect",label:"Connection"},{id:"log",label:"Logs"}].map(w=>u("button",{onClick:()=>A(w.id),className:"py-2 text-xs font-medium border-b-2 transition-colors",style:N===w.id?{borderColor:"var(--brand-500)",color:"var(--brand-500)"}:{borderColor:"transparent",color:"var(--text-muted)"},children:w.label},w.id))}),u("div",{className:"flex-1 overflow-y-auto px-5 py-4 flex flex-col gap-4",children:[N==="connect"&&u(K,{children:[u("div",{className:"md:hidden",children:u(zt,{qrUrl:r,oneTimeKey:o,oneTimeKeyExpiresAt:i,permanentKey:n,tunnelUrl:e,onGenerateOneTimeKey:C,onRegenerateKey:P})}),u(tr,{desktopEnabled:l,onDesktopToggle:_,permissions:s,onRequestPermission:c}),u("div",{className:"glass-card p-4 flex flex-col gap-1",children:[u("p",{className:"text-xs font-medium uppercase tracking-wider mb-2",style:{color:"var(--text-muted)"},children:["Clients",d.length>0?` (${d.length})`:""]}),d.length===0?u("p",{className:"text-xs text-center py-3",style:{color:"var(--text-muted)"},children:"No active connections"}):d.map((w,S)=>u(sr,{conn:w},S))]})]}),N==="log"&&u("div",{className:"flex-1 flex flex-col",children:y.length===0?u("p",{className:"text-xs text-center mt-8",style:{color:"var(--text-muted)"},children:"No logs yet"}):u("div",{className:"flex flex-col gap-0.5",children:[y.map((w,S)=>u("p",{className:"text-xs font-mono leading-5 break-all",style:{color:"var(--text-muted)"},children:w},S)),u("div",{ref:g})]})})]})]})]})]}),x&&u(Oe,{message:"Disconnect and stop the tunnel? Remote clients will be disconnected.",confirmLabel:"Disconnect",confirmDanger:!0,onConfirm:()=>{p(!1),f==null||f()},onCancel:()=>p(!1)})]})}const jt={step:0,tunnelUrl:"",oneTimeKey:"",oneTimeKeyExpiresAt:null,permanentKey:"",qrUrl:"",latency:null,uptime:null},ar={screenRecording:!1,accessibility:!1},Kt=200;function cr(){const[t,e]=L(jt),[o,i]=L(ar),[n,r]=L(!1),[s,l]=L([]),[a,d]=L(null),[h,c]=L([]),[_,f]=L(""),[v,C]=L(()=>localStorage.getItem("9remote-theme")||"dark");Z(()=>{document.documentElement.setAttribute("data-theme",v),localStorage.setItem("9remote-theme",v)},[v]);const P=()=>{C(p=>p==="dark"?"light":"dark")};Z(()=>{fetch("/api/version").then(g=>g.json()).then(g=>f(g.version??"")).catch(()=>{}),fetch("/api/ui/state").then(g=>g.json()).then(g=>{e({step:g.step??0,tunnelUrl:g.tunnelUrl??"",oneTimeKey:g.oneTimeKey??"",oneTimeKeyExpiresAt:g.oneTimeKeyExpiresAt??null,permanentKey:g.permanentKey??"",qrUrl:g.qrUrl??"",latency:g.latency??null,uptime:g.uptime??null}),i({screenRecording:g.screenRecording??!1,accessibility:g.accessibility??!1}),g.desktopEnabled!==void 0&&r(g.desktopEnabled),g.theme&&(g.theme==="light"||g.theme==="dark")&&C(g.theme)}).catch(()=>{});const p=new EventSource("/api/ui/events");return p.onmessage=g=>{try{const m=JSON.parse(g.data);m.type==="state"?e({step:m.step??0,tunnelUrl:m.tunnelUrl??"",oneTimeKey:m.oneTimeKey??"",oneTimeKeyExpiresAt:m.oneTimeKeyExpiresAt??null,permanentKey:m.permanentKey??"",qrUrl:m.qrUrl??"",latency:m.latency??null,uptime:m.uptime??null}):m.type==="log"?l(E=>{const w=[...E,m.message];return w.length>Kt?w.slice(-Kt):w}):m.type==="updateAvailable"?d(m.version):m.type==="permissions"?(i({screenRecording:m.screenRecording,accessibility:m.accessibility}),m.desktopEnabled!==void 0&&r(m.desktopEnabled)):m.type==="connections"&&c(m.connections??[])}catch{}},p.onerror=()=>{},()=>p.close()},[]);const y=async p=>{await fetch("/api/permissions/request",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:p})}).catch(()=>{})},b=()=>{fetch("/api/ui/stop",{method:"POST"}).catch(()=>{}),e(jt)},k=()=>{fetch("/api/ui/start",{method:"POST"}).catch(()=>{})},N=async()=>{const p=await fetch("/api/key/one-time",{method:"POST"}).catch(()=>null);if(!(p!=null&&p.ok))return;const g=await p.json().catch(()=>null);g!=null&&g.oneTimeKey&&e(m=>({...m,oneTimeKey:g.oneTimeKey,oneTimeKeyExpiresAt:g.expiresAt,qrUrl:g.qrUrl??m.qrUrl}))},A=async()=>{const p=!n;r(p),await fetch("/api/desktop/toggle",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({enabled:p})}).catch(()=>{})},x=async()=>{const p=await fetch("/api/key/regenerate",{method:"POST"}).catch(()=>null);if(!(p!=null&&p.ok))return;const g=await p.json().catch(()=>null);g!=null&&g.permanentKey&&e(m=>({...m,permanentKey:g.permanentKey}))};return u(lr,{step:t.step,tunnelUrl:t.tunnelUrl,oneTimeKey:t.oneTimeKey,oneTimeKeyExpiresAt:t.oneTimeKeyExpiresAt,permanentKey:t.permanentKey,qrUrl:t.qrUrl,permissions:o,desktopEnabled:n,updateVersion:a,connections:h,onRequestPermission:y,onDesktopToggle:A,onStop:b,onStart:k,onGenerateOneTimeKey:N,onRegenerateKey:x,logs:s,version:_,theme:v,onToggleTheme:P})}bn(u(cr,{}),document.getElementById("root"));