mirror of
https://github.com/jkingsman/Remote-Terminal-for-MeshCore.git
synced 2026-10-23 01:41:15 +00:00
Unread mentions are now red
This commit is contained in:
1 parent
1cee26bff1
commit
1eeed67b14
9 files changed
+736
-568
No files matched your search
+541
@@ -0,0 +1,541 @@
|
||||
var pv=Object.defineProperty;var mv=(r,a,s)=>a in r?pv(r,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[a]=s;var Fo=(r,a,s)=>mv(r,typeof a!="symbol"?a+"":a,s);function Av(r,a){for(var s=0;s<a.length;s++){const l=a[s];if(typeof l!="string"&&!Array.isArray(l)){for(const f in l)if(f!=="default"&&!(f in r)){const d=Object.getOwnPropertyDescriptor(l,f);d&&Object.defineProperty(r,f,d.get?d:{enumerable:!0,get:()=>l[f]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const f of document.querySelectorAll('link[rel="modulepreload"]'))l(f);new MutationObserver(f=>{for(const d of f)if(d.type==="childList")for(const m of d.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&l(m)}).observe(document,{childList:!0,subtree:!0});function s(f){const d={};return f.integrity&&(d.integrity=f.integrity),f.referrerPolicy&&(d.referrerPolicy=f.referrerPolicy),f.crossOrigin==="use-credentials"?d.credentials="include":f.crossOrigin==="anonymous"?d.credentials="omit":d.credentials="same-origin",d}function l(f){if(f.ep)return;f.ep=!0;const d=s(f);fetch(f.href,d)}})();var yf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Us(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function xA(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var a=r.default;if(typeof a=="function"){var s=function l(){return this instanceof l?Reflect.construct(a,arguments,this.constructor):a.apply(this,arguments)};s.prototype=a.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(r).forEach(function(l){var f=Object.getOwnPropertyDescriptor(r,l);Object.defineProperty(s,l,f.get?f:{enumerable:!0,get:function(){return r[l]}})}),s}var _f={exports:{}},Ma={},wf={exports:{}},st={};/**
|
||||
* @license React
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var dp;function gv(){if(dp)return st;dp=1;var r=Symbol.for("react.element"),a=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),d=Symbol.for("react.provider"),m=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.iterator;function w(D){return D===null||typeof D!="object"?null:(D=v&&D[v]||D["@@iterator"],typeof D=="function"?D:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},T=Object.assign,C={};function E(D,Z,$){this.props=D,this.context=Z,this.refs=C,this.updater=$||S}E.prototype.isReactComponent={},E.prototype.setState=function(D,Z){if(typeof D!="object"&&typeof D!="function"&&D!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,D,Z,"setState")},E.prototype.forceUpdate=function(D){this.updater.enqueueForceUpdate(this,D,"forceUpdate")};function P(){}P.prototype=E.prototype;function B(D,Z,$){this.props=D,this.context=Z,this.refs=C,this.updater=$||S}var k=B.prototype=new P;k.constructor=B,T(k,E.prototype),k.isPureReactComponent=!0;var I=Array.isArray,N=Object.prototype.hasOwnProperty,z={current:null},j={key:!0,ref:!0,__self:!0,__source:!0};function H(D,Z,$){var X,fe={},he=null,ke=null;if(Z!=null)for(X in Z.ref!==void 0&&(ke=Z.ref),Z.key!==void 0&&(he=""+Z.key),Z)N.call(Z,X)&&!j.hasOwnProperty(X)&&(fe[X]=Z[X]);var Ae=arguments.length-2;if(Ae===1)fe.children=$;else if(1<Ae){for(var qe=Array(Ae),Ye=0;Ye<Ae;Ye++)qe[Ye]=arguments[Ye+2];fe.children=qe}if(D&&D.defaultProps)for(X in Ae=D.defaultProps,Ae)fe[X]===void 0&&(fe[X]=Ae[X]);return{$$typeof:r,type:D,key:he,ref:ke,props:fe,_owner:z.current}}function K(D,Z){return{$$typeof:r,type:D.type,key:Z,ref:D.ref,props:D.props,_owner:D._owner}}function U(D){return typeof D=="object"&&D!==null&&D.$$typeof===r}function G(D){var Z={"=":"=0",":":"=2"};return"$"+D.replace(/[=:]/g,function($){return Z[$]})}var re=/\/+/g;function V(D,Z){return typeof D=="object"&&D!==null&&D.key!=null?G(""+D.key):Z.toString(36)}function J(D,Z,$,X,fe){var he=typeof D;(he==="undefined"||he==="boolean")&&(D=null);var ke=!1;if(D===null)ke=!0;else switch(he){case"string":case"number":ke=!0;break;case"object":switch(D.$$typeof){case r:case a:ke=!0}}if(ke)return ke=D,fe=fe(ke),D=X===""?"."+V(ke,0):X,I(fe)?($="",D!=null&&($=D.replace(re,"$&/")+"/"),J(fe,Z,$,"",function(Ye){return Ye})):fe!=null&&(U(fe)&&(fe=K(fe,$+(!fe.key||ke&&ke.key===fe.key?"":(""+fe.key).replace(re,"$&/")+"/")+D)),Z.push(fe)),1;if(ke=0,X=X===""?".":X+":",I(D))for(var Ae=0;Ae<D.length;Ae++){he=D[Ae];var qe=X+V(he,Ae);ke+=J(he,Z,$,qe,fe)}else if(qe=w(D),typeof qe=="function")for(D=qe.call(D),Ae=0;!(he=D.next()).done;)he=he.value,qe=X+V(he,Ae++),ke+=J(he,Z,$,qe,fe);else if(he==="object")throw Z=String(D),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(D).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.");return ke}function le(D,Z,$){if(D==null)return D;var X=[],fe=0;return J(D,X,"","",function(he){return Z.call($,he,fe++)}),X}function oe(D){if(D._status===-1){var Z=D._result;Z=Z(),Z.then(function($){(D._status===0||D._status===-1)&&(D._status=1,D._result=$)},function($){(D._status===0||D._status===-1)&&(D._status=2,D._result=$)}),D._status===-1&&(D._status=0,D._result=Z)}if(D._status===1)return D._result.default;throw D._result}var de={current:null},q={transition:null},me={ReactCurrentDispatcher:de,ReactCurrentBatchConfig:q,ReactCurrentOwner:z};function ne(){throw Error("act(...) is not supported in production builds of React.")}return st.Children={map:le,forEach:function(D,Z,$){le(D,function(){Z.apply(this,arguments)},$)},count:function(D){var Z=0;return le(D,function(){Z++}),Z},toArray:function(D){return le(D,function(Z){return Z})||[]},only:function(D){if(!U(D))throw Error("React.Children.only expected to receive a single React element child.");return D}},st.Component=E,st.Fragment=s,st.Profiler=f,st.PureComponent=B,st.StrictMode=l,st.Suspense=x,st.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=me,st.act=ne,st.cloneElement=function(D,Z,$){if(D==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+D+".");var X=T({},D.props),fe=D.key,he=D.ref,ke=D._owner;if(Z!=null){if(Z.ref!==void 0&&(he=Z.ref,ke=z.current),Z.key!==void 0&&(fe=""+Z.key),D.type&&D.type.defaultProps)var Ae=D.type.defaultProps;for(qe in Z)N.call(Z,qe)&&!j.hasOwnProperty(qe)&&(X[qe]=Z[qe]===void 0&&Ae!==void 0?Ae[qe]:Z[qe])}var qe=arguments.length-2;if(qe===1)X.children=$;else if(1<qe){Ae=Array(qe);for(var Ye=0;Ye<qe;Ye++)Ae[Ye]=arguments[Ye+2];X.children=Ae}return{$$typeof:r,type:D.type,key:fe,ref:he,props:X,_owner:ke}},st.createLine truncated
|
||||
* @license React
|
||||
* react-jsx-runtime.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var hp;function xv(){if(hp)return Ma;hp=1;var r=r0(),a=Symbol.for("react.element"),s=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,f=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,d={key:!0,ref:!0,__self:!0,__source:!0};function m(h,x,p){var y,v={},w=null,S=null;p!==void 0&&(w=""+p),x.key!==void 0&&(w=""+x.key),x.ref!==void 0&&(S=x.ref);for(y in x)l.call(x,y)&&!d.hasOwnProperty(y)&&(v[y]=x[y]);if(h&&h.defaultProps)for(y in x=h.defaultProps,x)v[y]===void 0&&(v[y]=x[y]);return{$$typeof:a,type:h,key:w,ref:S,props:v,_owner:f.current}}return Ma.Fragment=s,Ma.jsx=m,Ma.jsxs=m,Ma}var pp;function vv(){return pp||(pp=1,_f.exports=xv()),_f.exports}var F=vv(),R=r0();const be=Us(R),i0=Av({__proto__:null,default:be},[R]);var wu={},bf={exports:{}},Hn={},Cf={exports:{}},Ef={};/**
|
||||
* @license React
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var mp;function yv(){return mp||(mp=1,(function(r){function a(q,me){var ne=q.length;q.push(me);e:for(;0<ne;){var D=ne-1>>>1,Z=q[D];if(0<f(Z,me))q[D]=me,q[ne]=Z,ne=D;else break e}}function s(q){return q.length===0?null:q[0]}function l(q){if(q.length===0)return null;var me=q[0],ne=q.pop();if(ne!==me){q[0]=ne;e:for(var D=0,Z=q.length,$=Z>>>1;D<$;){var X=2*(D+1)-1,fe=q[X],he=X+1,ke=q[he];if(0>f(fe,ne))he<Z&&0>f(ke,fe)?(q[D]=ke,q[he]=ne,D=he):(q[D]=fe,q[X]=ne,D=X);else if(he<Z&&0>f(ke,ne))q[D]=ke,q[he]=ne,D=he;else break e}}return me}function f(q,me){var ne=q.sortIndex-me.sortIndex;return ne!==0?ne:q.id-me.id}if(typeof performance=="object"&&typeof performance.now=="function"){var d=performance;r.unstable_now=function(){return d.now()}}else{var m=Date,h=m.now();r.unstable_now=function(){return m.now()-h}}var x=[],p=[],y=1,v=null,w=3,S=!1,T=!1,C=!1,E=typeof setTimeout=="function"?setTimeout:null,P=typeof clearTimeout=="function"?clearTimeout:null,B=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function k(q){for(var me=s(p);me!==null;){if(me.callback===null)l(p);else if(me.startTime<=q)l(p),me.sortIndex=me.expirationTime,a(x,me);else break;me=s(p)}}function I(q){if(C=!1,k(q),!T)if(s(x)!==null)T=!0,oe(N);else{var me=s(p);me!==null&&de(I,me.startTime-q)}}function N(q,me){T=!1,C&&(C=!1,P(H),H=-1),S=!0;var ne=w;try{for(k(me),v=s(x);v!==null&&(!(v.expirationTime>me)||q&&!G());){var D=v.callback;if(typeof D=="function"){v.callback=null,w=v.priorityLevel;var Z=D(v.expirationTime<=me);me=r.unstable_now(),typeof Z=="function"?v.callback=Z:v===s(x)&&l(x),k(me)}else l(x);v=s(x)}if(v!==null)var $=!0;else{var X=s(p);X!==null&&de(I,X.startTime-me),$=!1}return $}finally{v=null,w=ne,S=!1}}var z=!1,j=null,H=-1,K=5,U=-1;function G(){return!(r.unstable_now()-U<K)}function re(){if(j!==null){var q=r.unstable_now();U=q;var me=!0;try{me=j(!0,q)}finally{me?V():(z=!1,j=null)}}else z=!1}var V;if(typeof B=="function")V=function(){B(re)};else if(typeof MessageChannel<"u"){var J=new MessageChannel,le=J.port2;J.port1.onmessage=re,V=function(){le.postMessage(null)}}else V=function(){E(re,0)};function oe(q){j=q,z||(z=!0,V())}function de(q,me){H=E(function(){q(r.unstable_now())},me)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(q){q.callback=null},r.unstable_continueExecution=function(){T||S||(T=!0,oe(N))},r.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):K=0<q?Math.floor(1e3/q):5},r.unstable_getCurrentPriorityLevel=function(){return w},r.unstable_getFirstCallbackNode=function(){return s(x)},r.unstable_next=function(q){switch(w){case 1:case 2:case 3:var me=3;break;default:me=w}var ne=w;w=me;try{return q()}finally{w=ne}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(q,me){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ne=w;w=q;try{return me()}finally{w=ne}},r.unstable_scheduleCallback=function(q,me,ne){var D=r.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?D+ne:D):ne=D,q){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=ne+Z,q={id:y++,callback:me,priorityLevel:q,startTime:ne,expirationTime:Z,sortIndex:-1},ne>D?(q.sortIndex=ne,a(p,q),s(x)===null&&q===s(p)&&(C?(P(H),H=-1):C=!0,de(I,ne-D))):(q.sortIndex=Z,a(x,q),T||S||(T=!0,oe(N))),q},r.unstable_shouldYield=G,r.unstable_wrapCallback=function(q){var me=w;return function(){var ne=w;w=me;try{return q.apply(this,arguments)}finally{w=ne}}}})(Ef)),Ef}var Ap;function _v(){return Ap||(Ap=1,Cf.exports=yv()),Cf.exports}/**
|
||||
* @license React
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var gp;function wv(){if(gp)return Hn;gp=1;var r=r0(),a=_v();function s(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=1;o<arguments.length;o++)n+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=new Set,f={};function d(e,n){m(e,n),m(e+"Capture",n)}function m(e,n){for(f[e]=n,e=0;e<n.length;e++)l.add(n[e])}var h=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),x=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,y={},v={};function w(e){return x.call(v,e)?!0:x.call(y,e)?!1:p.test(e)?v[e]=!0:(y[e]=!0,!1)}function S(e,n,o,c){if(o!==null&&o.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return c?!1:o!==null?!o.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function T(e,n,o,c){if(n===null||typeof n>"u"||S(e,n,o,c))return!0;if(c)return!1;if(o!==null)switch(o.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function C(e,n,o,c,g,_,M){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=c,this.attributeNamespace=g,this.mustUseProperty=o,this.propertyName=e,this.type=n,this.sanitizeURL=_,this.removeEmptyString=M}var E={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){E[e]=new C(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];E[n]=new C(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){E[e]=new C(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){E[e]=new C(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){E[e]=new C(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){E[e]=new C(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){E[e]=new C(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){E[e]=new C(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){E[e]=new C(e,5,!1,e.toLowerCase(),null,!1,!1)});var P=/[\-:]([a-z])/g;function B(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(P,B);E[n]=new C(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(P,B);E[n]=new C(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(P,B);E[n]=new C(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){E[e]=new C(e,1,!1,e.toLowerCase(),null,!1,!1)}),E.xlinkHref=new C("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){E[e]=new C(e,1,!1,e.toLowerCase(),null,!0,!0)});function k(e,n,o,c){var g=E.hasOwnProperty(n)?E[n]:null;(g!==null?g.type!==0:c||!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=
Line truncated
|
||||
`+D+e}var $=!1;function X(e,n){if(!e||$)return"";$=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(ce){var c=ce}Reflect.construct(e,[],n)}else{try{n.call()}catch(ce){c=ce}e.call(n.prototype)}else{try{throw Error()}catch(ce){c=ce}e()}}catch(ce){if(ce&&c&&typeof ce.stack=="string"){for(var g=ce.stack.split(`
|
||||
`),_=c.stack.split(`
|
||||
`),M=g.length-1,W=_.length-1;1<=M&&0<=W&&g[M]!==_[W];)W--;for(;1<=M&&0<=W;M--,W--)if(g[M]!==_[W]){if(M!==1||W!==1)do if(M--,W--,0>W||g[M]!==_[W]){var Y=`
|
||||
`+g[M].replace(" at new "," at ");return e.displayName&&Y.includes("<anonymous>")&&(Y=Y.replace("<anonymous>",e.displayName)),Y}while(1<=M&&0<=W);break}}}finally{$=!1,Error.prepareStackTrace=o}return(e=e?e.displayName||e.name:"")?Z(e):""}function fe(e){switch(e.tag){case 5:return Z(e.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return e=X(e.type,!1),e;case 11:return e=X(e.type.render,!1),e;case 1:return e=X(e.type,!0),e;default:return""}}function he(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case j:return"Fragment";case z:return"Portal";case K:return"Profiler";case H:return"StrictMode";case V:return"Suspense";case J:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case G:return(e.displayName||"Context")+".Consumer";case U:return(e._context.displayName||"Context")+".Provider";case re:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case le:return n=e.displayName||null,n!==null?n:he(e.type)||"Memo";case oe:n=e._payload,e=e._init;try{return he(e(n))}catch{}}return null}function ke(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return he(n);case 8:return n===H?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function Ae(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function qe(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ye(e){var n=qe(e)?"checked":"value",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),c=""+e[n];if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var g=o.get,_=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return g.call(this)},set:function(M){c=""+M,_.call(this,M)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return c},setValue:function(M){c=""+M},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function Et(e){e._valueTracker||(e._valueTracker=Ye(e))}function ht(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var o=n.getValue(),c="";return e&&(c=qe(e)?e.checked?"true":"false":e.value),e=c,e!==o?(n.setValue(e),!0):!1}function Se(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ve(e,n){var o=n.checked;return ne({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??e._wrapperState.initialChecked})}function dt(e,n){var o=n.defaultValue==null?"":n.defaultValue,c=n.checked!=null?n.checked:n.defaultChecked;o=Ae(n.value!=null?n.value:o),e._wrapperState={initialChecked:c,initialValue:o,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Mt(e,n){n=n.checked,n!=null&&k(e,"checked",n,!1)}function vt(e,n){Mt(e,n);var o=Ae(n.value),c=n.type;if(o!=null)c==="number"?(o===0&&e.value===""||e.value!=o)&&(e.value=""+o):e.value!==""+o&&(e.value=""+o);else if(c==="submit"||c==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?Qe(e,n.type,o):n.hasOwnProperty("defaultValue")&&Qe(e,n.type,Ae(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function ot(e,n,o){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var c=n.type;if(!(c!=="submit"&&c!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,o||n===e.value||(e.value=n),e.defaultValue=n}o=e.name,o!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,o!==""&&(e.name=o)}function Qe(e,n,o){(n!=="number"||Se(e.ownerDocument)!==e)&&(o==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+o&&(e.defaultValue=""+o))}var Xe=Array.isArray;function et(e,n,o,c){if(e=e.options,n){n={};for(var g=0;g<o.length;g++)n["$"+o[g]]=!0;for(o=0;o<e.length;o++)g=n.hasOwnProperty("$"+e[o].value),e[o].selected!==g&&(e[o].selected=g),g&&c&&(e[o].defaultSelected=!0)}else{for(o=""+Ae(o),n=null,g=0;g<e.length;g++){if(e[g].value===o){e[g].selected=!0,c&&(e[g].defaultSelected=!0);return}n!==null||e[g].disabled||(n=e[g])}n!==null&&(n.selected=!0)}}function Oe(e,n){if(n.dangerouslySetInnerHTM
Line truncated
|
||||
`).replace(Q,"")}function ue(e,n,o){if(n=ie(n),ie(e)!==n&&o)throw Error(s(425))}function ge(){}var Be=null,Ue=null;function tt(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var tn=typeof setTimeout=="function"?setTimeout:void 0,Yt=typeof clearTimeout=="function"?clearTimeout:void 0,Tn=typeof Promise=="function"?Promise:void 0,_n=typeof queueMicrotask=="function"?queueMicrotask:typeof Tn<"u"?function(e){return Tn.resolve(null).then(e).catch(Hi)}:tn;function Hi(e){setTimeout(function(){throw e})}function _a(e,n){var o=n,c=0;do{var g=o.nextSibling;if(e.removeChild(o),g&&g.nodeType===8)if(o=g.data,o==="/$"){if(c===0){e.removeChild(g),Kn(n);return}c--}else o!=="$"&&o!=="$?"&&o!=="$!"||c++;o=g}while(o);Kn(n)}function Vr(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return e}function Il(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var o=e.data;if(o==="$"||o==="$!"||o==="$?"){if(n===0)return e;n--}else o==="/$"&&n++}e=e.previousSibling}return null}var si=Math.random().toString(36).slice(2),cr="__reactFiber$"+si,Vi="__reactProps$"+si,yt="__reactContainer$"+si,Ui="__reactEvents$"+si,pd="__reactListeners$"+si,md="__reactHandles$"+si;function ai(e){var n=e[cr];if(n)return n;for(var o=e.parentNode;o;){if(n=o[yt]||o[cr]){if(o=n.alternate,n.child!==null||o!==null&&o.child!==null)for(e=Il(e);e!==null;){if(o=e[cr])return o;e=Il(e)}return n}e=o,o=e.parentNode}return null}function li(e){return e=e[cr]||e[yt],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ui(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(s(33))}function xs(e){return e[Vi]||null}var Ad=[],vs=-1;function Zi(e){return{current:e}}function Dt(e){0>vs||(e.current=Ad[vs],Ad[vs]=null,vs--)}function Pt(e,n){vs++,Ad[vs]=e.current,e.current=n}var Wi={},wn=Zi(Wi),Mn=Zi(!1),wo=Wi;function ys(e,n){var o=e.type.contextTypes;if(!o)return Wi;var c=e.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===n)return c.__reactInternalMemoizedMaskedChildContext;var g={},_;for(_ in o)g[_]=n[_];return c&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=g),g}function In(e){return e=e.childContextTypes,e!=null}function Ol(){Dt(Mn),Dt(wn)}function F0(e,n,o){if(wn.current!==Wi)throw Error(s(168));Pt(wn,n),Pt(Mn,o)}function N0(e,n,o){var c=e.stateNode;if(n=n.childContextTypes,typeof c.getChildContext!="function")return o;c=c.getChildContext();for(var g in c)if(!(g in n))throw Error(s(108,ke(e)||"Unknown",g));return ne({},o,c)}function zl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Wi,wo=wn.current,Pt(wn,e),Pt(Mn,Mn.current),!0}function L0(e,n,o){var c=e.stateNode;if(!c)throw Error(s(169));o?(e=N0(e,n,wo),c.__reactInternalMemoizedMergedChildContext=e,Dt(Mn),Dt(wn),Pt(wn,e)):Dt(Mn),Pt(Mn,o)}var ci=null,jl=!1,gd=!1;function M0(e){ci===null?ci=[e]:ci.push(e)}function Fx(e){jl=!0,M0(e)}function qi(){if(!gd&&ci!==null){gd=!0;var e=0,n=ft;try{var o=ci;for(ft=1;e<o.length;e++){var c=o[e];do c=c(!0);while(c!==null)}ci=null,jl=!1}catch(g){throw ci!==null&&(ci=ci.slice(e+1)),hl($s,qi),g}finally{ft=n,gd=!1}}return null}var _s=[],ws=0,Hl=null,Vl=0,dr=[],fr=0,bo=null,di=1,fi="";function Co(e,n){_s[ws++]=Vl,_s[ws++]=Hl,Hl=e,Vl=n}function I0(e,n,o){dr[fr++]=di,dr[fr++]=fi,dr[fr++]=bo,bo=e;var c=di;e=fi;var g=32-Je(c)-1;c&=~(1<<g),o+=1;var _=32-Je(n)+g;if(30<_){var M=g-g%5;_=(c&(1<<M)-1).toString(32),c>>=M,g-=M,di=1<<32-Je(n)+g|o<<g|c,fi=_+e}else di=1<<_|o<<g|c,fi=e}function xd(e){e.return!==null&&(Co(e,1),I0(e,1,0))}function vd(e){for(;e===Hl;)Hl=_s[--ws],_s[ws]=null,Vl=_s[--ws],_s[ws]=null;for(;e===bo;)bo=dr[--fr],dr[fr]=null,fi=dr[--fr],dr[fr]=null,di=dr[--fr],dr[fr]=null}var er=null,tr=null,Nt=!1,Er=null;function O0(e,n){var o=Ar(5,null,null,0);o.elementType="DELETED",o.stateNode=n,o.return=e,n=e.deletions,n===null?(e.deletions=[o],e.flags|=16):n.push(o)}function z0(e,n){switch(e.tag){case 5:var o=e.type;return n=n.nodeType!==1||o.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(e.stateNode=n,er=e,tr=Vr(n.firstChild),!0):!1;case 6:return n=e.pendingProps===""||n.nodeType!==3?null:n,n!==null?(e.stateNode=n,er=e,tr=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(o=bo!==null?{id:di,overflow:fi}:null,e.memoizedState={dehydrated:n,treeContext:o,retryLane:1073741824},o=Ar(18,null,null,0),o.stateNode=n,o.return=e,e.child=o,er=e,tr=null,!0):!1;default:return!1}}function yd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function _d(e){if(Nt){var n=tr;if(n){var o=n;if(!z0(e,n)){if(yd(e))throw Error(s(418));n=Vr(o.nextSibling);var c=er;n&&z0(e,n)?O0(c,o):(e.flags=e.flags&-4097|2,Nt=!1,er=e)}}else{if(yd(e))throw Error(s(418));e.flags=e.flags&-4097|2,Nt=!1,er=e}}}function j0(e){for(e=e.
Line truncated
|
||||
Error generating stack: `+_.message+`
|
||||
`+_.stack}return{value:e,source:n,stack:g,digest:null}}function Ud(e,n,o){return{value:e,source:null,stack:o??null,digest:n??null}}function Zd(e,n){try{console.error(n.value)}catch(o){setTimeout(function(){throw o})}}var Vx=typeof WeakMap=="function"?WeakMap:Map;function yh(e,n,o){o=pi(-1,o),o.tag=3,o.payload={element:null};var c=n.value;return o.callback=function(){lu||(lu=!0,sf=c),Zd(e,n)},o}function _h(e,n,o){o=pi(-1,o),o.tag=3;var c=e.type.getDerivedStateFromError;if(typeof c=="function"){var g=n.value;o.payload=function(){return c(g)},o.callback=function(){Zd(e,n)}}var _=e.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(o.callback=function(){Zd(e,n),typeof c!="function"&&($i===null?$i=new Set([this]):$i.add(this));var M=n.stack;this.componentDidCatch(n.value,{componentStack:M!==null?M:""})}),o}function wh(e,n,o){var c=e.pingCache;if(c===null){c=e.pingCache=new Vx;var g=new Set;c.set(n,g)}else g=c.get(n),g===void 0&&(g=new Set,c.set(n,g));g.has(o)||(g.add(o),e=nv.bind(null,e,n,o),n.then(e,e))}function bh(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function Ch(e,n,o,c,g){return(e.mode&1)===0?(e===n?e.flags|=65536:(e.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(n=pi(-1,1),n.tag=2,Qi(o,n,1))),o.lanes|=1),e):(e.flags|=65536,e.lanes=g,e)}var Ux=I.ReactCurrentOwner,On=!1;function Dn(e,n,o,c){n.child=e===null?Z0(n,null,o,c):Cs(n,e.child,o,c)}function Eh(e,n,o,c,g){o=o.render;var _=n.ref;return ks(n,g),c=Ld(e,n,o,c,_,g),o=Md(),e!==null&&!On?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~g,mi(e,n,g)):(Nt&&o&&xd(n),n.flags|=1,Dn(e,n,c,g),n.child)}function kh(e,n,o,c,g){if(e===null){var _=o.type;return typeof _=="function"&&!hf(_)&&_.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(n.tag=15,n.type=_,Sh(e,n,_,c,g)):(e=pu(o.type,null,c,n,n.mode,g),e.ref=n.ref,e.return=n,n.child=e)}if(_=e.child,(e.lanes&g)===0){var M=_.memoizedProps;if(o=o.compare,o=o!==null?o:zr,o(M,c)&&e.ref===n.ref)return mi(e,n,g)}return n.flags|=1,e=eo(_,c),e.ref=n.ref,e.return=n,n.child=e}function Sh(e,n,o,c,g){if(e!==null){var _=e.memoizedProps;if(zr(_,c)&&e.ref===n.ref)if(On=!1,n.pendingProps=c=_,(e.lanes&g)!==0)(e.flags&131072)!==0&&(On=!0);else return n.lanes=e.lanes,mi(e,n,g)}return Wd(e,n,o,c,g)}function Bh(e,n,o){var c=n.pendingProps,g=c.children,_=e!==null?e.memoizedState:null;if(c.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},Pt(Ts,nr),nr|=o;else{if((o&1073741824)===0)return e=_!==null?_.baseLanes|o:o,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,Pt(Ts,nr),nr|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=_!==null?_.baseLanes:o,Pt(Ts,nr),nr|=c}else _!==null?(c=_.baseLanes|o,n.memoizedState=null):c=o,Pt(Ts,nr),nr|=c;return Dn(e,n,g,o),n.child}function Ph(e,n){var o=n.ref;(e===null&&o!==null||e!==null&&e.ref!==o)&&(n.flags|=512,n.flags|=2097152)}function Wd(e,n,o,c,g){var _=In(o)?wo:wn.current;return _=ys(n,_),ks(n,g),o=Ld(e,n,o,c,_,g),c=Md(),e!==null&&!On?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~g,mi(e,n,g)):(Nt&&c&&xd(n),n.flags|=1,Dn(e,n,o,g),n.child)}function Th(e,n,o,c,g){if(In(o)){var _=!0;zl(n)}else _=!1;if(ks(n,g),n.stateNode===null)ru(e,n),xh(n,o,c),Vd(n,o,c,g),c=!0;else if(e===null){var M=n.stateNode,W=n.memoizedProps;M.props=W;var Y=M.context,ce=o.contextType;typeof ce=="object"&&ce!==null?ce=hr(ce):(ce=In(o)?wo:wn.current,ce=ys(n,ce));var ye=o.getDerivedStateFromProps,_e=typeof ye=="function"||typeof M.getSnapshotBeforeUpdate=="function";_e||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(W!==c||Y!==ce)&&vh(n,M,c,ce),Gi=!1;var ve=n.memoizedState;M.state=ve,Ql(n,c,M,g),Y=n.memoizedState,W!==c||ve!==Y||Mn.current||Gi?(typeof ye=="function"&&(Hd(n,o,ye,c),Y=n.memoizedState),(W=Gi||gh(n,o,W,c,ve,Y,ce))?(_e||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(n.flags|=4194308)):(typeof M.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=Y),M.props=c,M.state=Y,M.context=ce,c=W):(typeof M.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{M=n.stateNode,q0(e,n),W=n.memoizedProps,ce=n.type===n.elementType?W:kr(n.type,W),M.props=ce,_e=n.pendingProps,ve=M.context,Y=o.contextType,typeof Y=="object"&&Y!==null?Y=hr(Y):(Y=In(o)?wo:wn.current,Y=ys(n,Y));var Te=o.getDerivedStateFromProps;(ye=typeof Te=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(W!==_e||ve!==Y)&&vh(n,M,c,Y),Gi=!1,ve=n.m
Line truncated
|
||||
`)}function Bv(r){if(r.length===0)return`Neighbors
|
||||
No neighbors reported`;const a=[...r].sort((l,f)=>f.snr-l.snr),s=[`Neighbors (${a.length})`];for(const l of a){const f=l.name||l.pubkey_prefix,d=l.snr>=0?`+${l.snr.toFixed(1)}`:l.snr.toFixed(1);s.push(`${f}, ${d} dB [${Ru(l.last_heard_seconds)} ago]`)}return s.join(`
|
||||
`)}function Pv(r){if(r.length===0)return`ACL
|
||||
No ACL entries`;const a=[`ACL (${r.length})`];for(const s of r){const l=s.name||s.pubkey_prefix;a.push(`${l}: ${s.permission_name}`)}return a.join(`
|
||||
`)}function No(r,a,s,l=0){const f=Math.floor(Date.now()/1e3);return{id:-Date.now()-l,type:"PRIV",conversation_key:r,text:a,sender_timestamp:f,received_at:f,path_len:null,txt_type:0,signature:null,outgoing:s,acked:1}}function Tv(r,a,s){const[l,f]=R.useState(!1);R.useEffect(()=>{f(!1)},[r==null?void 0:r.id]);const d=R.useMemo(()=>{if(!r||r.type!=="contact")return!1;const x=a.find(p=>p.public_key===r.id);return(x==null?void 0:x.type)===o0},[r,a]),m=R.useCallback(async x=>{if(!(!r||r.type!=="contact")&&d)try{const p=await at.requestTelemetry(r.id,x),y=No(r.id,Sv(p),!1,0),v=No(r.id,Bv(p.neighbors),!1,1),w=No(r.id,Pv(p.acl),!1,2);s(S=>[...S,y,v,w]),f(!0)}catch(p){const y=No(r.id,`Telemetry request failed: ${p instanceof Error?p.message:"Unknown error"}`,!1,0);s(v=>[...v,y])}},[r,d,s]),h=R.useCallback(async x=>{if(!r||r.type!=="contact"||!d||!l)return;const p=No(r.id,`> ${x}`,!0,0);s(y=>[...y,p]);try{const y=await at.sendRepeaterCommand(r.id,x),v=No(r.id,y.response,!1,1);y.sender_timestamp&&(v.sender_timestamp=y.sender_timestamp),s(w=>[...w,v])}catch(y){const v=No(r.id,`Command failed: ${y instanceof Error?y.message:"Unknown error"}`,!1,1);s(w=>[...w,v])}},[r,d,l,s]);return{repeaterLoggedIn:l,activeContactIsRepeater:d,handleTelemetryRequest:m,handleRepeaterCommand:h}}const Dv=12;function js(r){return r.slice(0,Dv)}function yA(r,a){return!r||!a?!1:js(r)===js(a)}function Vo(r,a){return r||js(a)}const Vf="remoteterm-lastMessageTime";function _A(r){try{const a=localStorage.getItem(r);return a?JSON.parse(a):{}}catch{return{}}}function Rv(r,a){try{localStorage.setItem(r,JSON.stringify(a))}catch{}}function yp(){return _A(Vf)}function kf(r,a){const s=_A(Vf);return(!s[r]||a>s[r])&&(s[r]=a,Rv(Vf,s)),s}function Dr(r,a){return r==="channel"?`channel-${a}`:`contact-${js(a)}`}function _p(r,a){if(!a)return!1;const s=a.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return new RegExp(`@\\[${s}\\]`,"i").test(r)}function Fv(r,a,s,l=null){const[f,d]=R.useState({}),[m,h]=R.useState({}),[x,p]=R.useState(yp),y=R.useRef(l);R.useEffect(()=>{y.current=l},[l]);const v=R.useRef(new Set),w=R.useRef(new Set);R.useEffect(()=>{const P=r.filter(I=>!v.current.has(I.key)),B=a.filter(I=>I.public_key&&!w.current.has(I.public_key));if(P.length===0&&B.length===0)return;P.forEach(I=>v.current.add(I.key)),B.forEach(I=>w.current.add(I.public_key)),(async()=>{const I=[...P.map(N=>({type:"CHAN",conversation_key:N.key})),...B.map(N=>({type:"PRIV",conversation_key:N.public_key}))];if(I.length!==0)try{const N=await at.getMessagesBulk(I,100),z={},j={},H={};for(const K of P){const U=N[`CHAN:${K.key}`]||[];if(U.length>0){const G=Dr("channel",K.key),re=K.last_read_at||0,V=U.filter(le=>!le.outgoing&&le.received_at>re);V.length>0&&(z[G]=V.length,V.some(le=>_p(le.text,y.current))&&(j[G]=!0));const J=Math.max(...U.map(le=>le.received_at));H[G]=J,kf(G,J)}}for(const K of B){const U=N[`PRIV:${K.public_key}`]||[];if(U.length>0){const G=Dr("contact",K.public_key),re=K.last_read_at||0,V=U.filter(le=>!le.outgoing&&le.received_at>re);V.length>0&&(z[G]=V.length,V.some(le=>_p(le.text,y.current))&&(j[G]=!0));const J=Math.max(...U.map(le=>le.received_at));H[G]=J,kf(G,J)}}Object.keys(z).length>0&&d(K=>({...K,...z})),Object.keys(j).length>0&&h(K=>({...K,...j})),p(yp())}catch(N){console.error("Failed to fetch messages bulk:",N)}})()},[r,a]),R.useEffect(()=>{if(s&&s.type!=="raw"&&s.type!=="map"){const P=Dr(s.type,s.id);d(B=>{if(B[P]){const k={...B};return delete k[P],k}return B}),h(B=>{if(B[P]){const k={...B};return delete k[P],k}return B}),s.type==="channel"?at.markChannelRead(s.id).catch(B=>{console.error("Failed to mark channel as read on server:",B)}):s.type==="contact"&&at.markContactRead(s.id).catch(B=>{console.error("Failed to mark contact as read on server:",B)})}},[s]);const S=R.useCallback((P,B)=>{d(k=>({...k,[P]:(k[P]||0)+1})),B&&h(k=>({...k,[P]:!0}))},[]),T=R.useCallback(()=>{d({}),h({}),at.markAllRead().catch(P=>{console.error("Failed to mark all as read on server:",P)})},[]),C=R.useCallback(P=>{if(P.type==="raw"||P.type==="map")return;const B=Dr(P.type,P.id);d(k=>{if(k[B]){const I={...k};return delete I[B],I}return k}),h(k=>{if(k[B]){const I={...k};return delete I[B],I}return k}),P.type==="channel"?at.markChannelRead(P.id).catch(k=>{console.error("Failed to mark channel as read on server:",k)}):P.type==="contact"&&at.markContactRead(P.id).catch(k=>{console.error("Failed to mark contact as read on server:",k)})},[]),E=R.useCallback(P=>{let B=null;if(P.type==="CHAN"&&P.conversation_key?B=Dr("channel",P.conversation_key):P.type==="PRIV"&&P.conversation_key&&(B=Dr("contact",P.conversation_key)),B){const k=P.received_at||Math.floor(Date.now()/1e3),I=kf(B,k);p(I)}},[]);return{unreadCounts:f,mentions:m,lastMessageTimes:x,incrementUnread:S,markAllRead:T,markConversationRead:C,trackNewMessage:E}}var s0=vA();const wA=Us(s0);function Nv(r){if(typeof document>"u")return;let a=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",a.appen
Line truncated
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const uy=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),cy=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,s,l)=>l?l.toUpperCase():s.toLowerCase()),Cp=r=>{const a=cy(r);return a.charAt(0).toUpperCase()+a.slice(1)},bA=(...r)=>r.filter((a,s,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===s).join(" ").trim(),dy=r=>{for(const a in r)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/var fy={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const hy=R.forwardRef(({color:r="currentColor",size:a=24,strokeWidth:s=2,absoluteStrokeWidth:l,className:f="",children:d,iconNode:m,...h},x)=>R.createElement("svg",{ref:x,...fy,width:a,height:a,stroke:r,strokeWidth:l?Number(s)*24/Number(a):s,className:bA("lucide",f),...!d&&!dy(h)&&{"aria-hidden":"true"},...h},[...m.map(([p,y])=>R.createElement(p,y)),...Array.isArray(d)?d:[d]]));/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const a0=(r,a)=>{const s=R.forwardRef(({className:l,...f},d)=>R.createElement(hy,{ref:d,iconNode:a,className:bA(`lucide-${uy(Cp(r))}`,`lucide-${r}`,l),...f}));return s.displayName=Cp(r),s};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const py=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],my=a0("check",py);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const Ay=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],gy=a0("menu",Ay);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const xy=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],CA=a0("x",xy);function vy({health:r,config:a,onConfigClick:s,onMaintenanceClick:l,onAdvertise:f,onMenuClick:d}){const m=(r==null?void 0:r.radio_connected)??!1,[h,x]=R.useState(!1),p=async()=>{x(!0);try{const y=await at.reconnectRadio();y.connected&&Lt.success("Reconnected",{description:y.message})}catch(y){Lt.error("Reconnection failed",{description:y instanceof Error?y.message:"Check radio connection and power"})}finally{x(!1)}};return F.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 bg-[#252525] border-b border-[#333] text-xs",children:[d&&F.jsx("button",{onClick:d,className:"md:hidden p-1 bg-transparent border-none text-[#e0e0e0] cursor-pointer","aria-label":"Open menu",children:F.jsx(gy,{className:"h-5 w-5"})}),F.jsx("h1",{className:"hidden lg:block text-base font-semibold mr-auto",children:"RemoteTerm"}),F.jsxs("div",{className:"flex items-center gap-1 text-[#888]",children:[F.jsx("div",{className:`w-2 h-2 rounded-full ${m?"bg-[#4caf50]":"bg-[#666]"}`}),F.jsx("span",{className:"hidden lg:inline text-[#e0e0e0]",children:m?"Connected":"Disconnected"})]}),(r==null?void 0:r.serial_port)&&F.jsxs("div",{className:"hidden xl:flex items-center gap-1 text-[#888]",children:["Port: ",F.jsx("span",{className:"text-[#e0e0e0]",children:r.serial_port})]}),a&&F.jsxs(F.Fragment,{children:[F.jsx("div",{className:"hidden lg:flex items-center gap-1 text-[#888]",children:F.jsx("span",{className:"text-[#e0e0e0]",children:a.name||"Unnamed"})}),F.jsxs("div",{className:"hidden xl:flex items-center gap-1 text-[#888]",children:[a.radio.freq," MHz/SF",a.radio.sf,"/CR",a.radio.cr,"/",a.tx_power,"dBm"]})]}),F.jsx("div",{className:"flex-1 lg:hidden"}),!m&&F.jsx("button",{onClick:p,disabled:h,className:"px-3 py-1 bg-[#4a3000] border border-[#6b4500] text-[#ffa500] rounded text-xs cursor-pointer hover:bg-[#5a3a00] disabled:opacity-50 disabled:cursor-not-allowed",children:h?"Reconnecting...":"Reconnect"}),F.jsx("button",{onClick:f,disabled:!m,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444] disabled:bg-[#333] disabled:text-[#666] disabled:cursor-not-allowed",children:"Advertise"}),F.jsx("button",{onClick:l,className:"px-2 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444]",title:"Database Maintenance",children:F.jsx("span",{role:"img","aria-label":"Settings",children:"⚙️"})}),F.jsxs("button",{onClick:s,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444]",children:[F.jsx("span",{role:"img","aria-label":"Radio",children:"📻"})," Config"]})]})}const Zf=2,yy={text:"🛜",background:"#444444",textColor:"#ffffff"};function _y(r){let a=0;for(let s=0;s<r.length;s++){const l=r.charCodeAt(s);a=(a<<5)-a+l,a=a&a}return Math.abs(a)}const wy=/[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|[\u{1F600}-\u{1F64F}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]/u;function by(r,a){if(!r)return a.slice(0,2).toUpperCase();const s=r.match(wy);if(s)return s[0];const l=r.match(/[a-zA-Z]/g);if(!l||l.length===0)return a.slice(0,2).toUpperCase();const f=r.indexOf(" ");if(f!==-1){const d=l[0],m=r.slice(f+1).match(/[a-zA-Z]/);if(m)return(d+m[0]).toUpperCase()}return l[0].toUpperCase()}function Cy(r){const a=_y(r),s=a%360,l=50+(a>>8)%30,f=35+(a>>16)%20,d=`hsl(${s}, ${l}%, ${f}%)`,m=f<45?"#ffffff":"#000000";return{background:d,text:m}}function Ey(r,a,s){if(s===Zf)return yy;const l=by(r,a),f=Cy(a);return{text:l,background:f.background,textColor:f.text}}function EA({name:r,publicKey:a,size:s=28,contactType:l}){const f=Ey(r,a,l);return F.jsx("div",{className:"flex items-center justify-center rounded-full font-semibold flex-shrink-0 select-none",style:{backgroundColor:f.background,color:f.textColor,width:s,height:s,fontSize:s*.45},children:f.text})}function kA(r){var a,s,l="";if(typeof r=="string"||typeof r=="number")l+=r;else if(typeof r=="object")if(Array.isArray(r)){var f=r.length;for(a=0;a<f;a++)r[a]&&(s=kA(r[a]))&&(l&&(l+=" "),l+=s)}else for(s in r)r[s]&&(l&&(l+=" "),l+=s);return l}function SA(){for(var r,a,s=0,l="",f=arguments.length;s<f;s++)(r=arguments[s])&&(a=kA(r))&&(l&&(l+=" "),l+=a);return l}const ky=(r,a)=>{const s=new Array(r.length+a.length);for(let l=0;l<r.length;l++)s[l]=r[l];for(let l=0;l<a.length;l++)s[r.length+l]=a[l];return s},Sy=(r,a)=>({classGroupId:r,validator:a}),BA=(r=new Map,a=null,s)=>({nextPart:r,validators:a,classGroupId:s}),bc="-",Ep=[],By="arbitrary..",Py=r=>{const a=Dy(r),{conflictingClassGroups:s,conflictingClassGroupModifiers:l}=r;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return Ty(m);const h=m.split(bc),x=h[0]===""&&h.length>1?1:0;return PA(h,x,a)},getConflictingClassGroupIds:(m,h)=>{if(h){const x=l[m],p=s[m];return x?p?ky(p,x):x:p||Ep}return s[m]||Ep}}},PA=(r,a,s)=>{if(r.length-a===0)return s.classGroupId;const f=r[a],d=s.Line truncated
|
||||
`).map((D,Z,$)=>F.jsxs("span",{children:[k_(D,h),Z<$.length-1&&F.jsx("br",{})]},Z)),!oe&&F.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-2",children:Ec(N.sender_timestamp||N.received_at)}),N.outgoing&&(N.acked>0?` ✓${N.acked>1?N.acked:""}`:" ?")]})]})]},N.id)})]}),v&&F.jsx("button",{onClick:C,className:"absolute bottom-4 right-4 w-10 h-10 rounded-full bg-muted hover:bg-accent border border-border flex items-center justify-center shadow-lg transition-opacity",title:"Scroll to bottom",children:F.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:F.jsx("polyline",{points:"6 9 12 15 18 9"})})})]})}const Np=156,B_=140,P_=156,T_=120,D_=8,R_=R.forwardRef(function({onSend:a,disabled:s,placeholder:l,isRepeaterMode:f,conversationType:d,senderName:m},h){const[x,p]=R.useState(""),[y,v]=R.useState(!1),w=R.useRef(null);R.useImperativeHandle(h,()=>({appendText:N=>{var z;p(j=>j+N),(z=w.current)==null||z.focus()}}));const S=R.useMemo(()=>{if(d==="contact")return{warningAt:B_,dangerAt:Np,hardLimit:Np};if(d==="channel"){const N=(m==null?void 0:m.length)??10,z=Math.max(1,P_-N-2);return{warningAt:T_,dangerAt:Math.max(1,z-D_),hardLimit:z}}return null},[d,m]),{limitState:T,warningMessage:C}=R.useMemo(()=>{if(!S)return{limitState:"normal",warningMessage:null};const N=x.length;return N>=S.hardLimit?{limitState:"error",warningMessage:"likely truncated by radio"}:N>=S.dangerAt?{limitState:"danger",warningMessage:"may impact multi-repeater hop delivery"}:N>=S.warningAt?{limitState:"warning",warningMessage:"may impact multi-repeater hop delivery"}:{limitState:"normal",warningMessage:null}},[x.length,S]),E=S?S.hardLimit-x.length:0,P=R.useCallback(async N=>{N.preventDefault();const z=x.trim();if(f){if(y||s)return;const j=z==="."?"":z;v(!0);try{await a(j),p("")}catch(H){console.error("Failed to request telemetry:",H),Lt.error("Failed to request telemetry",{description:H instanceof Error?H.message:"Check radio connection"});return}finally{v(!1)}setTimeout(()=>{var H;return(H=w.current)==null?void 0:H.focus()},0)}else{if(!z||y||s)return;v(!0);try{await a(z),p("")}catch(j){console.error("Failed to send message:",j),Lt.error("Failed to send message",{description:j instanceof Error?j.message:"Check radio connection"});return}finally{v(!1)}setTimeout(()=>{var j;return(j=w.current)==null?void 0:j.focus()},0)}},[x,y,s,a,f]),B=R.useCallback(N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),P(N))},[P]),k=f?x.trim().length>0||x===".":x.trim().length>0,I=!f&&S!==null;return F.jsxs("form",{className:"px-4 py-3 border-t border-border flex flex-col gap-1",onSubmit:P,children:[F.jsxs("div",{className:"flex gap-2",children:[F.jsx(Kt,{ref:w,type:f?"password":"text",value:x,onChange:N=>p(N.target.value),onKeyDown:B,placeholder:l||(f?"Enter password (or . for none)...":"Type a message..."),disabled:s||y,className:"flex-1 min-w-0"}),F.jsx(gr,{type:"submit",disabled:s||y||!k,className:"flex-shrink-0",children:y?f?"Fetching...":"Sending...":f?"Fetch":"Send"})]}),I&&F.jsxs("div",{className:"flex items-center justify-end gap-2 text-xs",children:[F.jsxs("span",{className:lt("tabular-nums",T==="error"||T==="danger"?"text-red-500 font-medium":T==="warning"?"text-yellow-500":"text-muted-foreground"),children:[x.length,"/",S.hardLimit,E<0&&` (${E})`]}),C&&F.jsxs("span",{className:lt(T==="error"?"text-red-500":"text-yellow-500"),children:["— ",C]})]})]})});function sn(r,a,{checkForDefaultPrevented:s=!0}={}){return function(f){if(r==null||r(f),s===!1||!f.defaultPrevented)return a==null?void 0:a(f)}}function F_(r,a){const s=R.createContext(a),l=d=>{const{children:m,...h}=d,x=R.useMemo(()=>h,Object.values(h));return F.jsx(s.Provider,{value:x,children:m})};l.displayName=r+"Provider";function f(d){const m=R.useContext(s);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${d}\` must be used within \`${r}\``)}return[l,f]}function sl(r,a=[]){let s=[];function l(d,m){const h=R.createContext(m),x=s.length;s=[...s,m];const p=v=>{var P;const{scope:w,children:S,...T}=v,C=((P=w==null?void 0:w[r])==null?void 0:P[x])||h,E=R.useMemo(()=>T,Object.values(T));return F.jsx(C.Provider,{value:E,children:S})};p.displayName=d+"Provider";function y(v,w){var C;const S=((C=w==null?void 0:w[r])==null?void 0:C[x])||h,T=R.useContext(S);if(T)return T;if(m!==void 0)return m;throw new Error(`\`${v}\` must be used within \`${d}\``)}return[p,y]}const f=()=>{const d=s.map(m=>R.createContext(m));return function(h){const x=(h==null?void 0:h[r])||d;return R.useMemo(()=>({[`__scope${r}`]:{...h,[r]:x}}),[h,x])}};return f.scopeName=r,[l,N_(f,...a)]}function N_(...r){const a=r[0];if(r.length===1)return a;const s=()=>{const l=r.map(f=>({useScope:f(),scopeName:f.scopeName}));return function(d){const m=l.reduce((h,{useScope:x,scopeName:p})=>{const v=x(d)[`__scope${p}`];return{...h,...v}},{});return R.useMemo(()Line truncated
|
||||
.`.concat(m1,` {
|
||||
overflow: hidden `).concat(l,`;
|
||||
padding-right: `).concat(h,"px ").concat(l,`;
|
||||
}
|
||||
body[`).concat(Os,`] {
|
||||
overflow: hidden `).concat(l,`;
|
||||
overscroll-behavior: contain;
|
||||
`).concat([a&&"position: relative ".concat(l,";"),s==="margin"&&`
|
||||
padding-left: `.concat(f,`px;
|
||||
padding-top: `).concat(d,`px;
|
||||
padding-right: `).concat(m,`px;
|
||||
margin-left:0;
|
||||
margin-top:0;
|
||||
margin-right: `).concat(h,"px ").concat(l,`;
|
||||
`),s==="padding"&&"padding-right: ".concat(h,"px ").concat(l,";")].filter(Boolean).join(""),`
|
||||
}
|
||||
|
||||
.`).concat(Nu,` {
|
||||
right: `).concat(h,"px ").concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(Lu,` {
|
||||
margin-right: `).concat(h,"px ").concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(Nu," .").concat(Nu,` {
|
||||
right: 0 `).concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(Lu," .").concat(Lu,` {
|
||||
margin-right: 0 `).concat(l,`;
|
||||
}
|
||||
|
||||
body[`).concat(Os,`] {
|
||||
`).concat(A1,": ").concat(h,`px;
|
||||
}
|
||||
`)},Up=function(){var r=parseInt(document.body.getAttribute(Os)||"0",10);return isFinite(r)?r:0},L1=function(){R.useEffect(function(){return document.body.setAttribute(Os,(Up()+1).toString()),function(){var r=Up()-1;r<=0?document.body.removeAttribute(Os):document.body.setAttribute(Os,r.toString())}},[])},M1=function(r){var a=r.noRelative,s=r.noImportant,l=r.gapMode,f=l===void 0?"margin":l;L1();var d=R.useMemo(function(){return R1(f)},[f]);return R.createElement(F1,{styles:N1(d,!a,f,s?"":"!important")})},Gf=!1;if(typeof window<"u")try{var Bu=Object.defineProperty({},"passive",{get:function(){return Gf=!0,!0}});window.addEventListener("test",Bu,Bu),window.removeEventListener("test",Bu,Bu)}catch{Gf=!1}var Ns=Gf?{passive:!1}:!1,I1=function(r){return r.tagName==="TEXTAREA"},YA=function(r,a){if(!(r instanceof Element))return!1;var s=window.getComputedStyle(r);return s[a]!=="hidden"&&!(s.overflowY===s.overflowX&&!I1(r)&&s[a]==="visible")},O1=function(r){return YA(r,"overflowY")},z1=function(r){return YA(r,"overflowX")},Zp=function(r,a){var s=a.ownerDocument,l=a;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var f=XA(r,l);if(f){var d=JA(r,l),m=d[1],h=d[2];if(m>h)return!0}l=l.parentNode}while(l&&l!==s.body);return!1},j1=function(r){var a=r.scrollTop,s=r.scrollHeight,l=r.clientHeight;return[a,s,l]},H1=function(r){var a=r.scrollLeft,s=r.scrollWidth,l=r.clientWidth;return[a,s,l]},XA=function(r,a){return r==="v"?O1(a):z1(a)},JA=function(r,a){return r==="v"?j1(a):H1(a)},V1=function(r,a){return r==="h"&&a==="rtl"?-1:1},U1=function(r,a,s,l,f){var d=V1(r,window.getComputedStyle(a).direction),m=d*l,h=s.target,x=a.contains(h),p=!1,y=m>0,v=0,w=0;do{if(!h)break;var S=JA(r,h),T=S[0],C=S[1],E=S[2],P=C-E-d*T;(T||P)&&XA(r,h)&&(v+=P,w+=T);var B=h.parentNode;h=B&&B.nodeType===Node.DOCUMENT_FRAGMENT_NODE?B.host:B}while(!x&&h!==document.body||x&&(a.contains(h)||a===h));return(y&&Math.abs(v)<1||!y&&Math.abs(w)<1)&&(p=!0),p},Pu=function(r){return"changedTouches"in r?[r.changedTouches[0].clientX,r.changedTouches[0].clientY]:[0,0]},Wp=function(r){return[r.deltaX,r.deltaY]},qp=function(r){return r&&"current"in r?r.current:r},Z1=function(r,a){return r[0]===a[0]&&r[1]===a[1]},W1=function(r){return`
|
||||
.block-interactivity-`.concat(r,` {pointer-events: none;}
|
||||
.allow-interactivity-`).concat(r,` {pointer-events: all;}
|
||||
`)},q1=0,Ls=[];function G1(r){var a=R.useRef([]),s=R.useRef([0,0]),l=R.useRef(),f=R.useState(q1++)[0],d=R.useState($A)[0],m=R.useRef(r);R.useEffect(function(){m.current=r},[r]),R.useEffect(function(){if(r.inert){document.body.classList.add("block-interactivity-".concat(f));var C=p1([r.lockRef.current],(r.shards||[]).map(qp),!0).filter(Boolean);return C.forEach(function(E){return E.classList.add("allow-interactivity-".concat(f))}),function(){document.body.classList.remove("block-interactivity-".concat(f)),C.forEach(function(E){return E.classList.remove("allow-interactivity-".concat(f))})}}},[r.inert,r.lockRef.current,r.shards]);var h=R.useCallback(function(C,E){if("touches"in C&&C.touches.length===2||C.type==="wheel"&&C.ctrlKey)return!m.current.allowPinchZoom;var P=Pu(C),B=s.current,k="deltaX"in C?C.deltaX:B[0]-P[0],I="deltaY"in C?C.deltaY:B[1]-P[1],N,z=C.target,j=Math.abs(k)>Math.abs(I)?"h":"v";if("touches"in C&&j==="h"&&z.type==="range")return!1;var H=window.getSelection(),K=H&&H.anchorNode,U=K?K===z||K.contains(z):!1;if(U)return!1;var G=Zp(j,z);if(!G)return!0;if(G?N=j:(N=j==="v"?"h":"v",G=Zp(j,z)),!G)return!1;if(!l.current&&"changedTouches"in C&&(k||I)&&(l.current=N),!N)return!0;var re=l.current||N;return U1(re,E,C,re==="h"?k:I)},[]),x=R.useCallback(function(C){var E=C;if(!(!Ls.length||Ls[Ls.length-1]!==d)){var P="deltaY"in E?Wp(E):Pu(E),B=a.current.filter(function(N){return N.name===E.type&&(N.target===E.target||E.target===N.shadowParent)&&Z1(N.delta,P)})[0];if(B&&B.should){E.cancelable&&E.preventDefault();return}if(!B){var k=(m.current.shards||[]).map(qp).filter(Boolean).filter(function(N){return N.contains(E.target)}),I=k.length>0?h(E,k[0]):!m.current.noIsolation;I&&E.cancelable&&E.preventDefault()}}},[]),p=R.useCallback(function(C,E,P,B){var k={name:C,delta:E,target:P,should:B,shadowParent:Q1(P)};a.current.push(k),setTimeout(function(){a.current=a.current.filter(function(I){return I!==k})},1)},[]),y=R.useCallback(function(C){s.current=Pu(C),l.current=void 0},[]),v=R.useCallback(function(C){p(C.type,Wp(C),C.target,h(C,r.lockRef.current))},[]),w=R.useCallback(function(C){p(C.type,Pu(C),C.target,h(C,r.lockRef.current))},[]);R.useEffect(function(){return Ls.push(d),r.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:w}),document.addEventListener("wheel",x,Ns),document.addEventListener("touchmove",x,Ns),document.addEventListener("touchstart",y,Ns),function(){Ls=Ls.filter(function(C){return C!==d}),document.removeEventListener("wheel",x,Ns),document.removeEventListener("touchmove",x,Ns),document.removeEventListener("touchstart",y,Ns)}},[]);var S=r.removeScrollBar,T=r.inert;return R.createElement(R.Fragment,null,T?R.createElement(d,{styles:W1(f)}):null,S?R.createElement(M1,{noRelative:r.noRelative,gapMode:r.gapMode}):null)}function Q1(r){for(var a=null;r!==null;)r instanceof ShadowRoot&&(a=r.host,r=r.host),r=r.parentNode;return a}const K1=b1(KA,G1);var eg=R.forwardRef(function(r,a){return R.createElement(Fc,Kr({},r,{ref:a,sideCar:K1}))});eg.classNames=Fc.classNames;var $1=function(r){if(typeof document>"u")return null;var a=Array.isArray(r)?r[0]:r;return a.ownerDocument.body},Ms=new WeakMap,Tu=new WeakMap,Du={},Lf=0,tg=function(r){return r&&(r.host||tg(r.parentNode))},Y1=function(r,a){return a.map(function(s){if(r.contains(s))return s;var l=tg(s);return l&&r.contains(l)?l:(console.error("aria-hidden",s,"in not contained inside",r,". Doing nothing"),null)}).filter(function(s){return!!s})},X1=function(r,a,s,l){var f=Y1(a,Array.isArray(r)?r:[r]);Du[s]||(Du[s]=new WeakMap);var d=Du[s],m=[],h=new Set,x=new Set(f),p=function(v){!v||h.has(v)||(h.add(v),p(v.parentNode))};f.forEach(p);var y=function(v){!v||x.has(v)||Array.prototype.forEach.call(v.children,function(w){if(h.has(w))y(w);else try{var S=w.getAttribute(l),T=S!==null&&S!=="false",C=(Ms.get(w)||0)+1,E=(d.get(w)||0)+1;Ms.set(w,C),d.set(w,E),m.push(w),C===1&&T&&Tu.set(w,!0),E===1&&w.setAttribute(s,"true"),T||w.setAttribute(l,"true")}catch(P){console.error("aria-hidden: cannot operate on ",w,P)}})};return y(a),h.clear(),Lf++,function(){m.forEach(function(v){var w=Ms.get(v)-1,S=d.get(v)-1;Ms.set(v,w),d.set(v,S),w||(Tu.has(v)||v.removeAttribute(l),Tu.delete(v)),S||v.removeAttribute(s)}),Lf--,Lf||(Ms=new WeakMap,Ms=new WeakMap,Tu=new WeakMap,Du={})}},J1=function(r,a,s){s===void 0&&(s="data-aria-hidden");var l=Array.from(Array.isArray(r)?r:[r]),f=$1(r);return f?(l.push.apply(l,Array.from(f.querySelectorAll("[aria-live], script"))),X1(l,f,s,"aria-hidden")):function(){return null}};function ew(r){const a=tw(r),s=R.forwardRef((l,f)=>{const{children:d,...m}=l,h=R.Children.toArray(d),x=h.find(rw);if(x){const p=x.props.children,y=h.map(v=>v===x?R.Children.count(p)>1?R.Children.only(null):R.isValidElement(p)?p.props.children:null:v);return F.jsx(a,{...m,ref:f,children:R.isValidElement(p)?R.cloneElement(p,void 0,y):null})}return F.jsx(a,{...m,ref:f,children:d})});return s.displayName=`${r}.Slot`,s}function tw(r){const a=R.forwardRef((s,l)=>{const{childre
Line truncated
|
||||
|
||||
If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component.
|
||||
|
||||
For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return R.useEffect(()=>{r&&(document.getElementById(r)||console.error(s))},[s,r]),null},pw="DialogDescriptionWarning",mw=({contentRef:r,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${Ag(pw).contentName}}.`;return R.useEffect(()=>{var d;const f=(d=r.current)==null?void 0:d.getAttribute("aria-describedby");a&&f&&(document.getElementById(a)||console.warn(l))},[l,r,a]),null},gg=rg,xg=sg,Lc=ag,Mc=lg,Ic=cg,Oc=fg,vg=pg;const h0=gg,Aw=xg,yg=R.forwardRef(({className:r,...a},s)=>F.jsx(Lc,{ref:s,className:lt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...a}));yg.displayName=Lc.displayName;const zc=R.forwardRef(({className:r,children:a,...s},l)=>F.jsxs(Aw,{children:[F.jsx(yg,{}),F.jsxs(Mc,{ref:l,className:lt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r),...s,children:[a,F.jsxs(vg,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[F.jsx(CA,{className:"h-4 w-4"}),F.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));zc.displayName=Mc.displayName;const jc=({className:r,...a})=>F.jsx("div",{className:lt("flex flex-col space-y-1.5 text-center sm:text-left",r),...a});jc.displayName="DialogHeader";const p0=({className:r,...a})=>F.jsx("div",{className:lt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",r),...a});p0.displayName="DialogFooter";const Hc=R.forwardRef(({className:r,...a},s)=>F.jsx(Ic,{ref:s,className:lt("text-lg font-semibold leading-none tracking-tight",r),...a}));Hc.displayName=Ic.displayName;const gw=R.forwardRef(({className:r,...a},s)=>F.jsx(Oc,{ref:s,className:lt("text-sm text-muted-foreground",r),...a}));gw.displayName=Oc.displayName;function Gp(r){const a=xw(r),s=R.forwardRef((l,f)=>{const{children:d,...m}=l,h=R.Children.toArray(d),x=h.find(yw);if(x){const p=x.props.children,y=h.map(v=>v===x?R.Children.count(p)>1?R.Children.only(null):R.isValidElement(p)?p.props.children:null:v);return F.jsx(a,{...m,ref:f,children:R.isValidElement(p)?R.cloneElement(p,void 0,y):null})}return F.jsx(a,{...m,ref:f,children:d})});return s.displayName=`${r}.Slot`,s}function xw(r){const a=R.forwardRef((s,l)=>{const{children:f,...d}=s;if(R.isValidElement(f)){const m=ww(f),h=_w(d,f.props);return f.type!==R.Fragment&&(h.ref=l?ol(l,m):m),R.cloneElement(f,h)}return R.Children.count(f)>1?R.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var vw=Symbol("radix.slottable");function yw(r){return R.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===vw}function _w(r,a){const s={...a};for(const l in a){const f=r[l],d=a[l];/^on[A-Z]/.test(l)?f&&d?s[l]=(...h)=>{const x=d(...h);return f(...h),x}:f&&(s[l]=f):l==="style"?s[l]={...f,...d}:l==="className"&&(s[l]=[f,d].filter(Boolean).join(" "))}return{...r,...s}}function ww(r){var l,f;let a=(l=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:l.get,s=a&&"isReactWarning"in a&&a.isReactWarning;return s?r.ref:(a=(f=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:f.get,s=a&&"isReactWarning"in a&&a.isReactWarning,s?r.props.ref:r.props.ref||r.ref)}function bw(r){const a=r+"CollectionProvider",[s,l]=sl(a),[f,d]=s(a,{collectionRef:{current:null},itemMap:new Map}),m=C=>{const{scope:E,children:P}=C,B=be.useRef(null),k=be.useRef(new Map).current;return F.jsx(f,{scope:E,itemMap:k,collectionRef:B,children:P})};m.displayName=a;const h=r+"CollectionSlot",x=Gp(h),p=be.forwardRef((C,E)=>{const{scope:P,children:B}=C,k=d(h,P),I=xr(E,k.collectionRef);return F.jsx(x,{ref:I,children:B})});p.displayName=h;const y=r+"CollectionItemSlot",v="data-radix-collection-item",w=Gp(y),S=be.forwardRef((C,E)=>{const{scope:P,children:B,...k}=C,I=be.useRef(null),N=xr(E,I),z=d(y,P);return be.useEffect(()=>(z.itemMap.set(I,{ref:I,...k}),()=>void z.itemMap.delete(I))),F.jsx(w,{[v]:"",ref:N,children:B})});S.displayName=y;function T(C){const E=d(r+"CollectionConsumer",C);return be.useCallback(()=>{const B=E.collectionRef.current;if(!B)return[];const k=Array.from(B.querySelectorAll(`[${v}]`));return Array.from(E.itemMap.values()).sort((z,j)=>k.indexOf(z.ref.current)-k.indexOf(j.ref.current))},[E.coll
Line truncated
|
||||
* Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
|
||||
* (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
|
||||
*/var v2=Ja.exports,$p;function y2(){return $p||($p=1,(function(r,a){(function(s,l){l(a)})(v2,(function(s){var l="1.9.4";function f(t){var i,u,A,b;for(u=1,A=arguments.length;u<A;u++){b=arguments[u];for(i in b)t[i]=b[i]}return t}var d=Object.create||(function(){function t(){}return function(i){return t.prototype=i,new t}})();function m(t,i){var u=Array.prototype.slice;if(t.bind)return t.bind.apply(t,u.call(arguments,1));var A=u.call(arguments,2);return function(){return t.apply(i,A.length?A.concat(u.call(arguments)):arguments)}}var h=0;function x(t){return"_leaflet_id"in t||(t._leaflet_id=++h),t._leaflet_id}function p(t,i,u){var A,b,O,Q;return Q=function(){A=!1,b&&(O.apply(u,b),b=!1)},O=function(){A?b=arguments:(t.apply(u,arguments),setTimeout(Q,i),A=!0)},O}function y(t,i,u){var A=i[1],b=i[0],O=A-b;return t===A&&u?t:((t-b)%O+O)%O+b}function v(){return!1}function w(t,i){if(i===!1)return t;var u=Math.pow(10,i===void 0?6:i);return Math.round(t*u)/u}function S(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function T(t){return S(t).split(/\s+/)}function C(t,i){Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?d(t.options):{});for(var u in i)t.options[u]=i[u];return t.options}function E(t,i,u){var A=[];for(var b in t)A.push(encodeURIComponent(u?b.toUpperCase():b)+"="+encodeURIComponent(t[b]));return(!i||i.indexOf("?")===-1?"?":"&")+A.join("&")}var P=/\{ *([\w_ -]+) *\}/g;function B(t,i){return t.replace(P,function(u,A){var b=i[A];if(b===void 0)throw new Error("No value provided for variable "+u);return typeof b=="function"&&(b=b(i)),b})}var k=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};function I(t,i){for(var u=0;u<t.length;u++)if(t[u]===i)return u;return-1}var N="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function z(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var j=0;function H(t){var i=+new Date,u=Math.max(0,16-(i-j));return j=i+u,window.setTimeout(t,u)}var K=window.requestAnimationFrame||z("RequestAnimationFrame")||H,U=window.cancelAnimationFrame||z("CancelAnimationFrame")||z("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function G(t,i,u){if(u&&K===H)t.call(i);else return K.call(window,m(t,i))}function re(t){t&&U.call(window,t)}var V={__proto__:null,extend:f,create:d,bind:m,get lastId(){return h},stamp:x,throttle:p,wrapNum:y,falseFn:v,formatNum:w,trim:S,splitWords:T,setOptions:C,getParamString:E,template:B,isArray:k,indexOf:I,emptyImageUrl:N,requestFn:K,cancelFn:U,requestAnimFrame:G,cancelAnimFrame:re};function J(){}J.extend=function(t){var i=function(){C(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},u=i.__super__=this.prototype,A=d(u);A.constructor=i,i.prototype=A;for(var b in this)Object.prototype.hasOwnProperty.call(this,b)&&b!=="prototype"&&b!=="__super__"&&(i[b]=this[b]);return t.statics&&f(i,t.statics),t.includes&&(le(t.includes),f.apply(null,[A].concat(t.includes))),f(A,t),delete A.statics,delete A.includes,A.options&&(A.options=u.options?d(u.options):{},f(A.options,t.options)),A._initHooks=[],A.callInitHooks=function(){if(!this._initHooksCalled){u.callInitHooks&&u.callInitHooks.call(this),this._initHooksCalled=!0;for(var O=0,Q=A._initHooks.length;O<Q;O++)A._initHooks[O].call(this)}},i},J.include=function(t){var i=this.prototype.options;return f(this.prototype,t),t.options&&(this.prototype.options=i,this.mergeOptions(t.options)),this},J.mergeOptions=function(t){return f(this.prototype.options,t),this},J.addInitHook=function(t){var i=Array.prototype.slice.call(arguments,1),u=typeof t=="function"?t:function(){this[t].apply(this,i)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(u),this};function le(t){if(!(typeof L>"u"||!L||!L.Mixin)){t=k(t)?t:[t];for(var i=0;i<t.length;i++)t[i]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var oe={on:function(t,i,u){if(typeof t=="object")for(var A in t)this._on(A,t[A],i);else{t=T(t);for(var b=0,O=t.length;b<O;b++)this._on(t[b],i,u)}return this},off:function(t,i,u){if(!arguments.length)delete this._events;else if(typeof t=="object")for(var A in t)this._off(A,t[A],i);else{t=T(t);for(var b=arguments.length===1,O=0,Q=t.length;O<Q;O++)b?this._off(t[O]):this._off(t[O],i,u)}return this},_on:function(t,i,u,A){if(typeof i!="function"){console.warn("wrong listener type: "+typeof i);return}if(this._listens(t,i,u)===!1){u===this&&(u=void 0);var b={fn:i,ctx:u};A&&(b.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(b)}},_off:function(t,i,u){var A,b,O;if(this._events&&(A=this._events[t],!!A)){if(arguments.length===1){if(this._firingCount)for(b=0,O=A.length;b<O;b++)A[b].fn=v;delete this._events[t];return}if(typeof i!="function"){console.warn("wrong listener type: "+typeof i);return}var Q=this._listLine truncated
|
||||
(c) 2012 by Cédric Mesnil. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/return(function(l){var f=s,d=f.lib,m=d.WordArray,h=d.Hasher,x=f.algo,p=m.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),y=m.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),v=m.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),w=m.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),S=m.create([0,1518500249,1859775393,2400959708,2840853838]),T=m.create([1352829926,1548603684,1836072691,2053994217,0]),C=x.RIPEMD160=h.extend({_doReset:function(){this._hash=m.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(z,j){for(var H=0;H<16;H++){var K=j+H,U=z[K];z[K]=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360}var G=this._hash.words,re=S.words,V=T.words,J=p.words,le=y.words,oe=v.words,de=w.words,q,me,ne,D,Z,$,X,fe,he,ke;$=q=G[0],X=me=G[1],fe=ne=G[2],he=D=G[3],ke=Z=G[4];for(var Ae,H=0;H<80;H+=1)Ae=q+z[j+J[H]]|0,H<16?Ae+=E(me,ne,D)+re[0]:H<32?Ae+=P(me,ne,D)+re[1]:H<48?Ae+=B(me,ne,D)+re[2]:H<64?Ae+=k(me,ne,D)+re[3]:Ae+=I(me,ne,D)+re[4],Ae=Ae|0,Ae=N(Ae,oe[H]),Ae=Ae+Z|0,q=Z,Z=D,D=N(ne,10),ne=me,me=Ae,Ae=$+z[j+le[H]]|0,H<16?Ae+=I(X,fe,he)+V[0]:H<32?Ae+=k(X,fe,he)+V[1]:H<48?Ae+=B(X,fe,he)+V[2]:H<64?Ae+=P(X,fe,he)+V[3]:Ae+=E(X,fe,he)+V[4],Ae=Ae|0,Ae=N(Ae,de[H]),Ae=Ae+ke|0,$=ke,ke=he,he=N(fe,10),fe=X,X=Ae;Ae=G[1]+ne+he|0,G[1]=G[2]+D+ke|0,G[2]=G[3]+Z+$|0,G[3]=G[4]+q+X|0,G[4]=G[0]+me+fe|0,G[0]=Ae},_doFinalize:function(){var z=this._data,j=z.words,H=this._nDataBytes*8,K=z.sigBytes*8;j[K>>>5]|=128<<24-K%32,j[(K+64>>>9<<4)+14]=(H<<8|H>>>24)&16711935|(H<<24|H>>>8)&4278255360,z.sigBytes=(j.length+1)*4,this._process();for(var U=this._hash,G=U.words,re=0;re<5;re++){var V=G[re];G[re]=(V<<8|V>>>24)&16711935|(V<<24|V>>>8)&4278255360}return U},clone:function(){var z=h.clone.call(this);return z._hash=this._hash.clone(),z}});function E(z,j,H){return z^j^H}function P(z,j,H){return z&j|~z&H}function B(z,j,H){return(z|~j)^H}function k(z,j,H){return z&H|j&~H}function I(z,j,H){return z^(j|~H)}function N(z,j){return z<<j|z>>>32-j}f.RIPEMD160=h._createHelper(C),f.HmacRIPEMD160=h._createHmacHelper(C)})(),s.RIPEMD160})})(Yu)),Yu.exports}var Xu={exports:{}},ub=Xu.exports,mm;function Qc(){return mm||(mm=1,(function(r,a){(function(s,l){r.exports=l(ct())})(ub,function(s){(function(){var l=s,f=l.lib,d=f.Base,m=l.enc,h=m.Utf8,x=l.algo;x.HMAC=d.extend({init:function(p,y){p=this._hasher=new p.init,typeof y=="string"&&(y=h.parse(y));var v=p.blockSize,w=v*4;y.sigBytes>w&&(y=p.finalize(y)),y.clamp();for(var S=this._oKey=y.clone(),T=this._iKey=y.clone(),C=S.words,E=T.words,P=0;P<v;P++)C[P]^=1549556828,E[P]^=909522486;S.sigBytes=T.sigBytes=w,this.reset()},reset:function(){var p=this._hasher;p.reset(),p.update(this._iKey)},update:function(p){return this._hasher.update(p),this},finalize:function(p){var y=this._hasher,v=y.finalize(p);y.reset();var w=y.finalize(this._oKey.clone().concat(v));return w}})})()})})(Xu)),Xu.exports}var Ju={exports:{}},cb=Ju.exports,Am;function db(){return Am||(Am=1,(function(r,a){(function(s,l,f){r.exports=l(ct(),ll(),Qc())})(cb,function(s){return(function(){var l=s,f=l.lib,d=f.Base,m=f.WordArray,h=l.algo,x=h.SHA256,p=h.HMAC,y=h.PBKDF2=d.extend({cfg:d.extend({keySize:128/32,hasher:x,iterations:25e4}),init:function(v){this.cfg=this.cfg.extend(v)},compute:function(v,w){for(var S=this.cfg,T=p.create(S.hasher,v),C=m.create(),E=m.create([1]),P=C.words,B=E.words,k=S.keySize,I=S.iterations;P.length<k;){var N=T.update(w).finalize(E);T.reset();for(var z=N.words,j=z.length,H=N,K=1;K<I;K++){H=T.finalize(H),T.reset();for(var U=H.words,G=0;G<j;G++)z[G]^=U[G]}C.concat(N),B[0]++}return C.sigBytes=k*4,C}});l.PBKDF2=function(v,w,S){return y.create(S).compute(v,w)}})(),s.PBKDF2})})(Ju)),Ju.exports}var ec={exports:{}},fb=ec.exports,gm;function so(){return gm||(gm=1,(function(r,a){(function(s,l,f){r.exports=l(ct(),sx(),Qc())})(fb,function(s){return(function(){var l=s,f=l.lib,d=f.Base,m=f.WordArray,h=l.algo,x=h.MD5,p=h.EvpKDF=d.extend({cfg:d.extend({keySize:128/32,hasher:x,iterations:1}),init:function(y){this.cfg=this.cfg.extend(y)},compute:function(y,v){for(var w,S=this.cfg,T=S.hasher.create(),C=m.create(),E=C.words,P=S.keySize,B=S.iterations;E.length<P;){w&&T.update(w),w=T.update(y).finalize(v),T.reset();for(var k=1;k<B;k++)w=T.finalize(w),T.reset();C.concat(w)}return C.sigBytes=P*4,C}});l.EvpKDF=function(y,v,w){return p.create(w).compute(y,v)}})(),s.EvpKDF})})(ec)),ec.exports}var tc={exports:{}},hb=tc.Line truncated
|
||||
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
||||
* derived from CryptoJS.mode.CTR
|
||||
* Jan Hruby jhruby.web@gmail.com
|
||||
*/return s.mode.CTRGladman=(function(){var l=s.lib.BlockCipherMode.extend();function f(h){if((h>>24&255)===255){var x=h>>16&255,p=h>>8&255,y=h&255;x===255?(x=0,p===255?(p=0,y===255?y=0:++y):++p):++x,h=0,h+=x<<16,h+=p<<8,h+=y}else h+=1<<24;return h}function d(h){return(h[0]=f(h[0]))===0&&(h[1]=f(h[1])),h}var m=l.Encryptor=l.extend({processBlock:function(h,x){var p=this._cipher,y=p.blockSize,v=this._iv,w=this._counter;v&&(w=this._counter=v.slice(0),this._iv=void 0),d(w);var S=w.slice(0);p.encryptBlock(S,0);for(var T=0;T<y;T++)h[x+T]^=S[T]}});return l.Decryptor=m,l})(),s.mode.CTRGladman})})(ic)),ic.exports}var oc={exports:{}},yb=oc.exports,wm;function _b(){return wm||(wm=1,(function(r,a){(function(s,l,f){r.exports=l(ct(),dn())})(yb,function(s){return s.mode.OFB=(function(){var l=s.lib.BlockCipherMode.extend(),f=l.Encryptor=l.extend({processBlock:function(d,m){var h=this._cipher,x=h.blockSize,p=this._iv,y=this._keystream;p&&(y=this._keystream=p.slice(0),this._iv=void 0),h.encryptBlock(y,0);for(var v=0;v<x;v++)d[m+v]^=y[v]}});return l.Decryptor=f,l})(),s.mode.OFB})})(oc)),oc.exports}var sc={exports:{}},wb=sc.exports,bm;function bb(){return bm||(bm=1,(function(r,a){(function(s,l,f){r.exports=l(ct(),dn())})(wb,function(s){return s.mode.ECB=(function(){var l=s.lib.BlockCipherMode.extend();return l.Encryptor=l.extend({processBlock:function(f,d){this._cipher.encryptBlock(f,d)}}),l.Decryptor=l.extend({processBlock:function(f,d){this._cipher.decryptBlock(f,d)}}),l})(),s.mode.ECB})})(sc)),sc.exports}var ac={exports:{}},Cb=ac.exports,Cm;function Eb(){return Cm||(Cm=1,(function(r,a){(function(s,l,f){r.exports=l(ct(),dn())})(Cb,function(s){return s.pad.AnsiX923={pad:function(l,f){var d=l.sigBytes,m=f*4,h=m-d%m,x=d+h-1;l.clamp(),l.words[x>>>2]|=h<<24-x%4*8,l.sigBytes+=h},unpad:function(l){var f=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=f}},s.pad.Ansix923})})(ac)),ac.exports}var lc={exports:{}},kb=lc.exports,Em;function Sb(){return Em||(Em=1,(function(r,a){(function(s,l,f){r.exports=l(ct(),dn())})(kb,function(s){return s.pad.Iso10126={pad:function(l,f){var d=f*4,m=d-l.sigBytes%d;l.concat(s.lib.WordArray.random(m-1)).concat(s.lib.WordArray.create([m<<24],1))},unpad:function(l){var f=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=f}},s.pad.Iso10126})})(lc)),lc.exports}var uc={exports:{}},Bb=uc.exports,km;function Pb(){return km||(km=1,(function(r,a){(function(s,l,f){r.exports=l(ct(),dn())})(Bb,function(s){return s.pad.Iso97971={pad:function(l,f){l.concat(s.lib.WordArray.create([2147483648],1)),s.pad.ZeroPadding.pad(l,f)},unpad:function(l){s.pad.ZeroPadding.unpad(l),l.sigBytes--}},s.pad.Iso97971})})(uc)),uc.exports}var cc={exports:{}},Tb=cc.exports,Sm;function Db(){return Sm||(Sm=1,(function(r,a){(function(s,l,f){r.exports=l(ct(),dn())})(Tb,function(s){return s.pad.ZeroPadding={pad:function(l,f){var d=f*4;l.clamp(),l.sigBytes+=d-(l.sigBytes%d||d)},unpad:function(l){for(var f=l.words,d=l.sigBytes-1,d=l.sigBytes-1;d>=0;d--)if(f[d>>>2]>>>24-d%4*8&255){l.sigBytes=d+1;break}}},s.pad.ZeroPadding})})(cc)),cc.exports}var dc={exports:{}},Rb=dc.exports,Bm;function Fb(){return Bm||(Bm=1,(function(r,a){(function(s,l,f){r.exports=l(ct(),dn())})(Rb,function(s){return s.pad.NoPadding={pad:function(){},unpad:function(){}},s.pad.NoPadding})})(dc)),dc.exports}var fc={exports:{}},Nb=fc.exports,Pm;function Lb(){return Pm||(Pm=1,(function(r,a){(function(s,l,f){r.exports=l(ct(),dn())})(Nb,function(s){return(function(l){var f=s,d=f.lib,m=d.CipherParams,h=f.enc,x=h.Hex,p=f.format;p.Hex={stringify:function(y){return y.ciphertext.toString(x)},parse:function(y){var v=x.parse(y);return m.create({ciphertext:v})}}})(),s.format.Hex})})(fc)),fc.exports}var hc={exports:{}},Mb=hc.exports,Tm;function Ib(){return Tm||(Tm=1,(function(r,a){(function(s,l,f){r.exports=l(ct(),Wo(),qo(),so(),dn())})(Mb,function(s){return(function(){var l=s,f=l.lib,d=f.BlockCipher,m=l.algo,h=[],x=[],p=[],y=[],v=[],w=[],S=[],T=[],C=[],E=[];(function(){for(var k=[],I=0;I<256;I++)I<128?k[I]=I<<1:k[I]=I<<1^283;for(var N=0,z=0,I=0;I<256;I++){var j=z^z<<1^z<<2^z<<3^z<<4;j=j>>>8^j&255^99,h[N]=j,x[j]=N;var H=k[N],K=k[H],U=k[K],G=k[j]*257^j*16843008;p[N]=G<<24|G>>>8,y[N]=G<<16|G>>>16,v[N]=G<<8|G>>>24,w[N]=G;var G=U*16843009^K*65537^H*257^N*16843008;S[j]=G<<24|G>>>8,T[j]=G<<16|G>>>16,C[j]=G<<8|G>>>24,E[j]=G,N?(N=H^k[k[k[U^H]]],z^=k[k[z]]):N=z=1}})();var P=[0,1,2,4,8,16,32,64,128,27,54],B=m.AES=d.extend({_doReset:function(){var k;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var I=this._keyPriorReset=this._key,N=I.words,z=I.sigBytes/4,j=this._nRounds=z+6,H=(j+1)*4,K=this._keySchedule=[],U=0;U<H;U++)U<z?K[U]=N[U]:(k=K[U-1],U%z?z>6&&U%z==4&&(k=h[k>>>24]<<24|h[k>>>16&255]<<16|h[k>>>8&255]<<8|h[k&255]):(k=k<<8|k>>>24,k=h[k>>>24]<<24|h[k>>>16&255]<<16|h[k>>>8&255]<<8|h[k&255],k^=P[U/z|0]<<24),K[U]=K[U-z]^k);for(var G=this._invKeySchedule=[],re=0;re<H;re++){var U=H-re;if(re%4)var k=K[U];else var k=K[U-4];re<4||U<=4?G[re]=k:G[re]=S[h[k>>>24]]^T[h[k>>>16&255]]^C[h[k>>>8&255]]^E[h[k&255]]}}},encryLine truncated
|
||||
• Timestamp (4 bytes) - send time as unix timestamp
|
||||
• Request Type (1 byte) - type of request (GetStats, GetTelemetryData, etc.)
|
||||
• Request Data (remaining bytes) - additional request-specific data`,startByte:h+x,endByte:h+f.length-1,value:w});const S={type:r.PayloadType.Request,version:r.PayloadVersion.Version1,isValid:!0,timestamp:0,requestType:r.RequestType.GetStats,requestData:"",destinationHash:p,sourceHash:y,cipherMac:v,ciphertext:w};return d!=null&&d.includeSegments&&(S.segments=m),S}catch(m){return{type:r.PayloadType.Request,version:r.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode request payload"],timestamp:0,requestType:r.RequestType.GetStats,requestData:"",destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:""}}}}return Za.RequestPayloadDecoder=s,Za}var Wa={},Jm;function vC(){if(Jm)return Wa;Jm=1,Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.ResponsePayloadDecoder=void 0;const r=ir(),a=gn();class s{static decode(f,d){try{if(f.length<4){const T={type:r.PayloadType.Response,version:r.PayloadVersion.Version1,isValid:!1,errors:["Response payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return d!=null&&d.includeSegments&&(T.segments=[{name:"Invalid Response Data",description:"Response payload too short (minimum 4 bytes required)",startByte:d.segmentOffset||0,endByte:(d.segmentOffset||0)+f.length-1,value:(0,a.bytesToHex)(f)}]),T}const m=[],h=(d==null?void 0:d.segmentOffset)||0;let x=0;const p=(0,a.byteToHex)(f[x]);d!=null&&d.includeSegments&&m.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:h+x,endByte:h+x,value:p}),x+=1;const y=(0,a.byteToHex)(f[x]);d!=null&&d.includeSegments&&m.push({name:"Source Hash",description:"First byte of source node public key",startByte:h+x,endByte:h+x,value:y}),x+=1;const v=(0,a.bytesToHex)(f.subarray(x,x+2));d!=null&&d.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:h+x,endByte:h+x+1,value:v}),x+=2;const w=(0,a.bytesToHex)(f.subarray(x));d!=null&&d.includeSegments&&f.length>x&&m.push({name:"Ciphertext",description:"Encrypted response data (tag + content)",startByte:h+x,endByte:h+f.length-1,value:w});const S={type:r.PayloadType.Response,version:r.PayloadVersion.Version1,isValid:!0,destinationHash:p,sourceHash:y,cipherMac:v,ciphertext:w,ciphertextLength:f.length-4};return d!=null&&d.includeSegments&&(S.segments=m),S}catch(m){return{type:r.PayloadType.Response,version:r.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode response payload"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return Wa.ResponsePayloadDecoder=s,Wa}var qa={},eA;function yC(){if(eA)return qa;eA=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.AnonRequestPayloadDecoder=void 0;const r=ir(),a=gn();class s{static decode(f,d){try{if(f.length<35){const T={type:r.PayloadType.AnonRequest,version:r.PayloadVersion.Version1,isValid:!1,errors:["AnonRequest payload too short (minimum 35 bytes: dest + public key + MAC)"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return d!=null&&d.includeSegments&&(T.segments=[{name:"Invalid AnonRequest Data",description:"AnonRequest payload too short (minimum 35 bytes required: 1 for dest hash + 32 for public key + 2 for MAC)",startByte:d.segmentOffset||0,endByte:(d.segmentOffset||0)+f.length-1,value:(0,a.bytesToHex)(f)}]),T}const m=[],h=(d==null?void 0:d.segmentOffset)||0;let x=0;const p=(0,a.byteToHex)(f[0]);d!=null&&d.includeSegments&&m.push({name:"Destination Hash",description:`First byte of destination node public key: 0x${p}`,startByte:h+x,endByte:h+x,value:p}),x+=1;const y=(0,a.bytesToHex)(f.subarray(1,33));d!=null&&d.includeSegments&&m.push({name:"Sender Public Key",description:"Ed25519 public key of the sender (32 bytes)",startByte:h+x,endByte:h+x+31,value:y}),x+=32;const v=(0,a.bytesToHex)(f.subarray(33,35));d!=null&&d.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data verification (2 bytes)",startByte:h+x,endByte:h+x+1,value:v}),x+=2;const w=(0,a.bytesToHex)(f.subarray(35));d!=null&&d.includeSegments&&f.length>35&&m.push({name:"Ciphertext",description:`Encrypted message data (${f.length-35} bytes). Contains encrypted plaintext with this structure:
|
||||
• Timestamp (4 bytes) - send time as unix timestamp
|
||||
• Sync Timestamp (4 bytes) - room server only, sender's "sync messages SINCE x" timestamp
|
||||
• Password (remaining bytes) - password for repeater/room`,startByte:h+x,endByte:h+f.length-1,value:w});const S={type:r.PayloadType.AnonRequest,version:r.PayloadVersion.Version1,isValid:!0,destinationHash:p,senderPublicKey:y,cipherMac:v,ciphertext:w,ciphertextLength:f.length-35};return d!=null&&d.includeSegments&&(S.segments=m),S}catch(m){return{type:r.PayloadType.AnonRequest,version:r.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode AnonRequest payload"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return qa.AnonRequestPayloadDecoder=s,qa}var Ga={},tA;function _C(){if(tA)return Ga;tA=1,Object.defineProperty(Ga,"__esModule",{value:!0}),Ga.AckPayloadDecoder=void 0;const r=ir(),a=gn();class s{static decode(f,d){try{if(f.length<4){const y={type:r.PayloadType.Ack,version:r.PayloadVersion.Version1,isValid:!1,errors:["Ack payload too short (minimum 4 bytes for checksum)"],checksum:""};return d!=null&&d.includeSegments&&(y.segments=[{name:"Invalid Ack Data",description:"Ack payload too short (minimum 4 bytes required for checksum)",startByte:d.segmentOffset||0,endByte:(d.segmentOffset||0)+f.length-1,value:(0,a.bytesToHex)(f)}]),y}const m=[],h=(d==null?void 0:d.segmentOffset)||0,x=(0,a.bytesToHex)(f.subarray(0,4));d!=null&&d.includeSegments&&m.push({name:"Checksum",description:`CRC checksum of message timestamp, text, and sender pubkey: 0x${x}`,startByte:h,endByte:h+3,value:x}),d!=null&&d.includeSegments&&f.length>4&&m.push({name:"Additional Data",description:"Extra data in Ack payload",startByte:h+4,endByte:h+f.length-1,value:(0,a.bytesToHex)(f.subarray(4))});const p={type:r.PayloadType.Ack,version:r.PayloadVersion.Version1,isValid:!0,checksum:x};return d!=null&&d.includeSegments&&(p.segments=m),p}catch(m){return{type:r.PayloadType.Ack,version:r.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode Ack payload"],checksum:""}}}}return Ga.AckPayloadDecoder=s,Ga}var Qa={},nA;function wC(){if(nA)return Qa;nA=1,Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.PathPayloadDecoder=void 0;const r=ir(),a=gn();class s{static decode(f){try{if(f.length<2)return{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!1,errors:["Path payload too short (minimum 2 bytes: path length + extra type)"],pathLength:0,pathHashes:[],extraType:0,extraData:""};const d=f[0];if(f.length<1+d+1)return{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!1,errors:[`Path payload too short (need ${1+d+1} bytes for path length + path + extra type)`],pathLength:d,pathHashes:[],extraType:0,extraData:""};const m=[];for(let p=0;p<d;p++)m.push((0,a.byteToHex)(f[1+p]));const h=f[1+d];let x="";return f.length>1+d+1&&(x=(0,a.bytesToHex)(f.subarray(1+d+1))),{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!0,pathLength:d,pathHashes:m,extraType:h,extraData:x}}catch(d){return{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!1,errors:[d instanceof Error?d.message:"Failed to decode Path payload"],pathLength:0,pathHashes:[],extraType:0,extraData:""}}}}return Qa.PathPayloadDecoder=s,Qa}var Ka={},rA;function bC(){if(rA)return Ka;rA=1,Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.TextMessagePayloadDecoder=void 0;const r=ir(),a=gn();class s{static decode(f,d){try{if(f.length<4){const T={type:r.PayloadType.TextMessage,version:r.PayloadVersion.Version1,isValid:!1,errors:["TextMessage payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return d!=null&&d.includeSegments&&(T.segments=[{name:"Invalid TextMessage Data",description:"TextMessage payload too short (minimum 4 bytes required)",startByte:d.segmentOffset||0,endByte:(d.segmentOffset||0)+f.length-1,value:(0,a.bytesToHex)(f)}]),T}const m=[],h=(d==null?void 0:d.segmentOffset)||0;let x=0;const p=(0,a.byteToHex)(f[x]);d!=null&&d.includeSegments&&m.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:h+x,endByte:h+x,value:p}),x+=1;const y=(0,a.byteToHex)(f[x]);d!=null&&d.includeSegments&&m.push({name:"Source Hash",description:"First byte of source node public key",startByte:h+x,endByte:h+x,value:y}),x+=1;const v=(0,a.bytesToHex)(f.subarray(x,x+2));d!=null&&d.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:h+x,endByte:h+x+1,value:v}),x+=2;const w=(0,a.bytesToHex)(f.subarray(x));d!=null&&d.includeSegments&&f.length>x&&m.push({name:"Ciphertext",description:"Encrypted message data (timestamp + message text)",startByte:h+x,endByte:h+f.length-1,value:w});const S={type:r.PayloadType.TextMessage,version:r.PayloadVersion.Version1,isValid:!0,destinationHash:p,sourceHash:y,cipherMac:v,ciphertext:w,ciphertextLength:f.length-4};return d!=null&&d.includeSegments&&(S.segments=m),S}catch(m){return{type:r.PayloadType.TextMessage,version:r.PayloadVersion.Version1,i
Line truncated
|
||||
// SHA256 round constants
|
||||
const K: array<u32, 64> = array<u32, 64>(
|
||||
0x428a2f98u, 0x71374491u, 0xb5c0fbcfu, 0xe9b5dba5u, 0x3956c25bu, 0x59f111f1u, 0x923f82a4u, 0xab1c5ed5u,
|
||||
0xd807aa98u, 0x12835b01u, 0x243185beu, 0x550c7dc3u, 0x72be5d74u, 0x80deb1feu, 0x9bdc06a7u, 0xc19bf174u,
|
||||
0xe49b69c1u, 0xefbe4786u, 0x0fc19dc6u, 0x240ca1ccu, 0x2de92c6fu, 0x4a7484aau, 0x5cb0a9dcu, 0x76f988dau,
|
||||
0x983e5152u, 0xa831c66du, 0xb00327c8u, 0xbf597fc7u, 0xc6e00bf3u, 0xd5a79147u, 0x06ca6351u, 0x14292967u,
|
||||
0x27b70a85u, 0x2e1b2138u, 0x4d2c6dfcu, 0x53380d13u, 0x650a7354u, 0x766a0abbu, 0x81c2c92eu, 0x92722c85u,
|
||||
0xa2bfe8a1u, 0xa81a664bu, 0xc24b8b70u, 0xc76c51a3u, 0xd192e819u, 0xd6990624u, 0xf40e3585u, 0x106aa070u,
|
||||
0x19a4c116u, 0x1e376c08u, 0x2748774cu, 0x34b0bcb5u, 0x391c0cb3u, 0x4ed8aa4au, 0x5b9cca4fu, 0x682e6ff3u,
|
||||
0x748f82eeu, 0x78a5636fu, 0x84c87814u, 0x8cc70208u, 0x90befffau, 0xa4506cebu, 0xbef9a3f7u, 0xc67178f2u
|
||||
);
|
||||
|
||||
// Character lookup table (a-z = 0-25, 0-9 = 26-35, dash = 36)
|
||||
const CHARS: array<u32, 37> = array<u32, 37>(
|
||||
0x61u, 0x62u, 0x63u, 0x64u, 0x65u, 0x66u, 0x67u, 0x68u, 0x69u, 0x6au, // a-j
|
||||
0x6bu, 0x6cu, 0x6du, 0x6eu, 0x6fu, 0x70u, 0x71u, 0x72u, 0x73u, 0x74u, // k-t
|
||||
0x75u, 0x76u, 0x77u, 0x78u, 0x79u, 0x7au, // u-z
|
||||
0x30u, 0x31u, 0x32u, 0x33u, 0x34u, 0x35u, 0x36u, 0x37u, 0x38u, 0x39u, // 0-9
|
||||
0x2du // dash
|
||||
);
|
||||
|
||||
struct Params {
|
||||
target_channel_hash: u32,
|
||||
batch_offset: u32,
|
||||
name_length: u32,
|
||||
batch_size: u32,
|
||||
target_mac: u32, // First 2 bytes of target MAC (in high 16 bits)
|
||||
ciphertext_words: u32, // Number of 32-bit words in ciphertext
|
||||
ciphertext_len_bits: u32, // Length of ciphertext in bits
|
||||
verify_mac: u32, // 1 to verify MAC, 0 to skip
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> params: Params;
|
||||
@group(0) @binding(1) var<storage, read_write> match_count: atomic<u32>;
|
||||
@group(0) @binding(2) var<storage, read_write> match_indices: array<u32>;
|
||||
@group(0) @binding(3) var<storage, read> ciphertext: array<u32>; // Ciphertext data
|
||||
|
||||
fn rotr(x: u32, n: u32) -> u32 {
|
||||
return (x >> n) | (x << (32u - n));
|
||||
}
|
||||
|
||||
fn ch(x: u32, y: u32, z: u32) -> u32 {
|
||||
return (x & y) ^ (~x & z);
|
||||
}
|
||||
|
||||
fn maj(x: u32, y: u32, z: u32) -> u32 {
|
||||
return (x & y) ^ (x & z) ^ (y & z);
|
||||
}
|
||||
|
||||
fn sigma0(x: u32) -> u32 {
|
||||
return rotr(x, 2u) ^ rotr(x, 13u) ^ rotr(x, 22u);
|
||||
}
|
||||
|
||||
fn sigma1(x: u32) -> u32 {
|
||||
return rotr(x, 6u) ^ rotr(x, 11u) ^ rotr(x, 25u);
|
||||
}
|
||||
|
||||
fn gamma0(x: u32) -> u32 {
|
||||
return rotr(x, 7u) ^ rotr(x, 18u) ^ (x >> 3u);
|
||||
}
|
||||
|
||||
fn gamma1(x: u32) -> u32 {
|
||||
return rotr(x, 17u) ^ rotr(x, 19u) ^ (x >> 10u);
|
||||
}
|
||||
|
||||
// Convert index to room name bytes, returns the hash as a u32 for the first byte check
|
||||
fn index_to_room_name(idx: u32, length: u32, msg: ptr<function, array<u32, 16>>) -> bool {
|
||||
// Message starts with '#' (0x23)
|
||||
var byte_pos = 0u;
|
||||
var word_idx = 0u;
|
||||
var current_word = 0x23000000u; // '#' in big-endian position 0
|
||||
byte_pos = 1u;
|
||||
|
||||
var remaining = idx;
|
||||
var prev_was_dash = false;
|
||||
|
||||
// Generate room name from index
|
||||
for (var i = 0u; i < length; i++) {
|
||||
let char_count = select(37u, 36u, i == 0u || i == length - 1u); // no dash at start/end
|
||||
var char_idx = remaining % char_count;
|
||||
remaining = remaining / char_count;
|
||||
|
||||
// Check for consecutive dashes (invalid)
|
||||
let is_dash = char_idx == 36u && i > 0u && i < length - 1u;
|
||||
if (is_dash && prev_was_dash) {
|
||||
return false; // Invalid: consecutive dashes
|
||||
}
|
||||
prev_was_dash = is_dash;
|
||||
|
||||
// Map char index to actual character
|
||||
let c = CHARS[char_idx];
|
||||
|
||||
// Pack byte into current word (big-endian)
|
||||
let shift = (3u - byte_pos % 4u) * 8u;
|
||||
if (byte_pos % 4u == 0u && byte_pos > 0u) {
|
||||
(*msg)[word_idx] = current_word;
|
||||
word_idx = word_idx + 1u;
|
||||
current_word = 0u;
|
||||
}
|
||||
current_word = current_word | (c << shift);
|
||||
byte_pos = byte_pos + 1u;
|
||||
}
|
||||
|
||||
// Add padding: 0x80 followed by zeros, then length in bits
|
||||
let msg_len_bits = (length + 1u) * 8u; // +1 for '#'
|
||||
|
||||
// Add 0x80 padding byte
|
||||
let shift = (3u - byte_pos % 4u) * 8u;
|
||||
if (byte_pos % 4u == 0u) {
|
||||
(*msg)[word_idx] = current_word;
|
||||
word_idx = word_idx + 1u;
|
||||
current_word = 0x80000000u;
|
||||
} else {
|
||||
current_word = current_word | (0x80u << shift);
|
||||
}
|
||||
byte_pos = byte_pos + 1u;
|
||||
|
||||
// Store current word
|
||||
if (byte_pos % 4u == 0u || word_idx < 14u) {
|
||||
(*msg)[word_idx] = current_word;
|
||||
word_idx = word_idx + 1u;
|
||||
}
|
||||
|
||||
// Zero-fill until word 14
|
||||
for (var i = word_idx; i < 14u; i++) {
|
||||
(*msg)[i] = 0u;
|
||||
}
|
||||
|
||||
// Length in bits (64-bit, but we only use lower 32 bits for short messages)
|
||||
(*msg)[14u] = 0u;
|
||||
(*msg)[15u] = msg_len_bits;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
fn sha256_block(msg: ptr<function, array<u32, 16>>) -> array<u32, 8> {
|
||||
// Initialize hash values
|
||||
var h: array<u32, 8> = array<u32, 8>(
|
||||
0x6a09e667u, 0xbb67ae85u, 0x3c6ef372u, 0xa54ff53au,
|
||||
0x510e527fu, 0x9b05688cu, 0x1f83d9abu, 0x5be0cd19u
|
||||
);
|
||||
|
||||
// Message schedule
|
||||
var w: array<u32, 64>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
w[i] = (*msg)[i];
|
||||
}
|
||||
for (var i = 16u; i < 64u; i++) {
|
||||
w[i] = gamma1(w[i-2u]) + w[i-7u] + gamma0(w[i-15u]) + w[i-16u];
|
||||
}
|
||||
|
||||
// Compression
|
||||
var a = h[0]; var b = h[1]; var c = h[2]; var d = h[3];
|
||||
var e = h[4]; var f = h[5]; var g = h[6]; var hh = h[7];
|
||||
|
||||
for (var i = 0u; i < 64u; i++) {
|
||||
let t1 = hh + sigma1(e) + ch(e, f, g) + K[i] + w[i];
|
||||
let t2 = sigma0(a) + maj(a, b, c);
|
||||
hh = g; g = f; f = e; e = d + t1;
|
||||
d = c; c = b; b = a; a = t1 + t2;
|
||||
}
|
||||
|
||||
h[0] = h[0] + a; h[1] = h[1] + b; h[2] = h[2] + c; h[3] = h[3] + d;
|
||||
h[4] = h[4] + e; h[5] = h[5] + f; h[6] = h[6] + g; h[7] = h[7] + hh;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
// Compute SHA256 of the key (16 bytes) to get channel hash
|
||||
fn sha256_key(key: array<u32, 4>) -> u32 {
|
||||
var msg: array<u32, 16>;
|
||||
|
||||
// Key bytes (16 bytes = 4 words)
|
||||
msg[0] = key[0];
|
||||
msg[1] = key[1];
|
||||
msg[2] = key[2];
|
||||
msg[3] = key[3];
|
||||
|
||||
// Padding: 0x80 followed by zeros
|
||||
msg[4] = 0x80000000u;
|
||||
for (var i = 5u; i < 14u; i++) {
|
||||
msg[i] = 0u;
|
||||
}
|
||||
|
||||
// Length: 128 bits
|
||||
msg[14] = 0u;
|
||||
msg[15] = 128u;
|
||||
|
||||
let hash = sha256_block(&msg);
|
||||
|
||||
// Return first byte of hash (big-endian)
|
||||
return hash[0] >> 24u;
|
||||
}
|
||||
|
||||
// HMAC-SHA256 for MAC verification
|
||||
// Key is 16 bytes (4 words), padded to 32 bytes with zeros for MeshCore
|
||||
// Returns first 2 bytes of HMAC (as u32 in high 16 bits)
|
||||
fn hmac_sha256_mac(key: array<u32, 4>, ciphertext_len: u32) -> u32 {
|
||||
// HMAC: H((K' ^ opad) || H((K' ^ ipad) || message))
|
||||
// K' is 64 bytes (32 bytes key + 32 bytes zero padding for MeshCore, then padded to 64)
|
||||
// ipad = 0x36 repeated, opad = 0x5c repeated
|
||||
|
||||
// Build padded key (64 bytes = 16 words)
|
||||
// MeshCore uses 32-byte secret: 16-byte key + 16 zero bytes
|
||||
var k_pad: array<u32, 16>;
|
||||
k_pad[0] = key[0];
|
||||
k_pad[1] = key[1];
|
||||
k_pad[2] = key[2];
|
||||
k_pad[3] = key[3];
|
||||
for (var i = 4u; i < 16u; i++) {
|
||||
k_pad[i] = 0u;
|
||||
}
|
||||
|
||||
// Inner hash: SHA256((K' ^ ipad) || message)
|
||||
// First block: K' ^ ipad (64 bytes)
|
||||
var inner_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
inner_block[i] = k_pad[i] ^ 0x36363636u;
|
||||
}
|
||||
|
||||
// Initialize hash state with first block
|
||||
var h: array<u32, 8> = sha256_block(&inner_block);
|
||||
|
||||
// Process ciphertext blocks (continuing from h state)
|
||||
let ciphertext_words = params.ciphertext_words;
|
||||
var word_idx = 0u;
|
||||
|
||||
// Process full 64-byte blocks of ciphertext
|
||||
while (word_idx + 16u <= ciphertext_words) {
|
||||
var block: array<u32, 16>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
block[i] = ciphertext[word_idx + i];
|
||||
}
|
||||
h = sha256_block_continue(&block, h);
|
||||
word_idx = word_idx + 16u;
|
||||
}
|
||||
|
||||
// Final block with remaining ciphertext + padding
|
||||
var final_block: array<u32, 16>;
|
||||
var remaining = ciphertext_words - word_idx;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
if (i < remaining) {
|
||||
final_block[i] = ciphertext[word_idx + i];
|
||||
} else if (i == remaining) {
|
||||
// Add 0x80 padding
|
||||
final_block[i] = 0x80000000u;
|
||||
} else {
|
||||
final_block[i] = 0u;
|
||||
}
|
||||
}
|
||||
|
||||
// Add length (64 bytes of ipad + ciphertext length)
|
||||
let total_bits = 512u + params.ciphertext_len_bits;
|
||||
if (remaining < 14u) {
|
||||
final_block[14] = 0u;
|
||||
final_block[15] = total_bits;
|
||||
h = sha256_block_continue(&final_block, h);
|
||||
} else {
|
||||
// Need extra block for length
|
||||
h = sha256_block_continue(&final_block, h);
|
||||
var len_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 14u; i++) {
|
||||
len_block[i] = 0u;
|
||||
}
|
||||
len_block[14] = 0u;
|
||||
len_block[15] = total_bits;
|
||||
h = sha256_block_continue(&len_block, h);
|
||||
}
|
||||
|
||||
let inner_hash = h;
|
||||
|
||||
// Outer hash: SHA256((K' ^ opad) || inner_hash)
|
||||
var outer_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
outer_block[i] = k_pad[i] ^ 0x5c5c5c5cu;
|
||||
}
|
||||
h = sha256_block(&outer_block);
|
||||
|
||||
// Second block: inner_hash (32 bytes) + padding
|
||||
var hash_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 8u; i++) {
|
||||
hash_block[i] = inner_hash[i];
|
||||
}
|
||||
hash_block[8] = 0x80000000u;
|
||||
for (var i = 9u; i < 14u; i++) {
|
||||
hash_block[i] = 0u;
|
||||
}
|
||||
hash_block[14] = 0u;
|
||||
hash_block[15] = 512u + 256u; // 64 bytes opad + 32 bytes inner hash
|
||||
|
||||
h = sha256_block_continue(&hash_block, h);
|
||||
|
||||
// Return first 2 bytes (high 16 bits of first word)
|
||||
return h[0] & 0xFFFF0000u;
|
||||
}
|
||||
|
||||
// SHA256 block computation continuing from existing state
|
||||
fn sha256_block_continue(msg: ptr<function, array<u32, 16>>, h_in: array<u32, 8>) -> array<u32, 8> {
|
||||
var h = h_in;
|
||||
|
||||
// Message schedule
|
||||
var w: array<u32, 64>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
w[i] = (*msg)[i];
|
||||
}
|
||||
for (var i = 16u; i < 64u; i++) {
|
||||
w[i] = gamma1(w[i-2u]) + w[i-7u] + gamma0(w[i-15u]) + w[i-16u];
|
||||
}
|
||||
|
||||
// Compression
|
||||
var a = h[0]; var b = h[1]; var c = h[2]; var d = h[3];
|
||||
var e = h[4]; var f = h[5]; var g = h[6]; var hh = h[7];
|
||||
|
||||
for (var i = 0u; i < 64u; i++) {
|
||||
let t1 = hh + sigma1(e) + ch(e, f, g) + K[i] + w[i];
|
||||
let t2 = sigma0(a) + maj(a, b, c);
|
||||
hh = g; g = f; f = e; e = d + t1;
|
||||
d = c; c = b; b = a; a = t1 + t2;
|
||||
}
|
||||
|
||||
h[0] = h[0] + a; h[1] = h[1] + b; h[2] = h[2] + c; h[3] = h[3] + d;
|
||||
h[4] = h[4] + e; h[5] = h[5] + f; h[6] = h[6] + g; h[7] = h[7] + hh;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
// Process a single candidate and record match if found
|
||||
fn process_candidate(name_idx: u32) {
|
||||
// Generate message for this room name
|
||||
var msg: array<u32, 16>;
|
||||
let valid = index_to_room_name(name_idx, params.name_length, &msg);
|
||||
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Compute SHA256("#roomname") - this gives us the key
|
||||
let key_hash = sha256_block(&msg);
|
||||
|
||||
// Take first 16 bytes (4 words) as the key
|
||||
var key: array<u32, 4>;
|
||||
key[0] = key_hash[0];
|
||||
key[1] = key_hash[1];
|
||||
key[2] = key_hash[2];
|
||||
key[3] = key_hash[3];
|
||||
|
||||
// Compute SHA256(key) to get channel hash
|
||||
let channel_hash = sha256_key(key);
|
||||
|
||||
// Check if channel hash matches target
|
||||
if (channel_hash != params.target_channel_hash) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Channel hash matches - verify MAC if enabled
|
||||
if (params.verify_mac == 1u) {
|
||||
let computed_mac = hmac_sha256_mac(key, params.ciphertext_len_bits);
|
||||
if (computed_mac != params.target_mac) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Found a match - record the index
|
||||
let match_idx = atomicAdd(&match_count, 1u);
|
||||
if (match_idx < 1024u) { // Limit stored matches
|
||||
match_indices[match_idx] = name_idx;
|
||||
}
|
||||
}
|
||||
|
||||
// Each thread processes 16 candidates to amortize thread overhead
|
||||
const CANDIDATES_PER_THREAD: u32 = 16u;
|
||||
|
||||
@compute @workgroup_size(256)
|
||||
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
||||
let base_idx = global_id.x * CANDIDATES_PER_THREAD;
|
||||
|
||||
for (var i = 0u; i < CANDIDATES_PER_THREAD; i++) {
|
||||
let idx = base_idx + i;
|
||||
if (idx >= params.batch_size) {
|
||||
return;
|
||||
}
|
||||
let name_idx = params.batch_offset + idx;
|
||||
process_candidate(name_idx);
|
||||
}
|
||||
}
|
||||
`}async init(){if(!navigator.gpu)return console.warn("WebGPU not supported"),!1;try{const a=await navigator.gpu.requestAdapter();if(!a)return console.warn("No GPU adapter found"),!1;this.device=await a.requestDevice(),this.bindGroupLayout=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}]}),this.paramsBuffer=this.device.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.matchCountBuffer=this.device.createBuffer({size:4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST}),this.matchIndicesBuffer=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC});for(let f=0;f<2;f++)this.matchCountReadBuffers[f]=this.device.createBuffer({size:4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.matchIndicesReadBuffers[f]=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST});const s=this.device.createShaderModule({code:this.shaderCode}),l=this.device.createPipelineLayout({bindGroupLayouts:[this.bindGroupLayout]});return this.pipeline=this.device.createComputePipeline({layout:l,compute:{module:s,entryPoint:"main"}}),!0}catch(a){return console.error("WebGPU initialization failed:",a),!1}}isAvailable(){return this.device!==null&&this.pipeline!==null}indexToRoomName(a,s){return Ho(s,a)}countNamesForLength(a){return el(a)}async runBatch(a,s,l,f,d,m){if(!this.device||!this.pipeline||!this.bindGroupLayout||!this.paramsBuffer||!this.matchCountBuffer||!this.matchIndicesBuffer||!this.matchCountReadBuffers[0]||!this.matchCountReadBuffers[1]||!this.matchIndicesReadBuffers[0]||!this.matchIndicesReadBuffers[1])throw new Error("GPU not initialized");const h=this.currentReadBufferIndex;this.currentReadBufferIndex=1-this.currentReadBufferIndex;const x=this.matchCountReadBuffers[h],p=this.matchIndicesReadBuffers[h],y=d&&m?1:0;let v,w=0,S=0;if(y){const N=new Uint8Array(d.length/2);for(let U=0;U<N.length;U++)N[U]=parseInt(d.substr(U*2,2),16);w=N.length*8;const z=Math.ceil(N.length/4)*4,j=new Uint8Array(z);j.set(N),v=new Uint32Array(z/4);for(let U=0;U<v.length;U++)v[U]=j[U*4]<<24|j[U*4+1]<<16|j[U*4+2]<<8|j[U*4+3];const H=parseInt(m.substr(0,2),16),K=parseInt(m.substr(2,2),16);S=H<<24|K<<16}else v=new Uint32Array([0]);const T=Math.max(v.length*4,4);(!this.ciphertextBuffer||this.ciphertextBufferSize<T)&&(this.ciphertextBuffer&&this.ciphertextBuffer.destroy(),this.ciphertextBuffer=this.device.createBuffer({size:T,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.ciphertextBufferSize=T,this.bindGroupDirty=!0);const C=new Uint32Array([a,l,s,f,S,v.length,w,y]);this.device.queue.writeBuffer(this.paramsBuffer,0,C),this.device.queue.writeBuffer(this.ciphertextBuffer,0,v),this.device.queue.writeBuffer(this.matchCountBuffer,0,$c.ZERO_DATA),(this.bindGroupDirty||!this.bindGroup)&&(this.bindGroup=this.device.createBindGroup({layout:this.bindGroupLayout,entries:[{binding:0,resource:{buffer:this.paramsBuffer}},{binding:1,resource:{buffer:this.matchCountBuffer}},{binding:2,resource:{buffer:this.matchIndicesBuffer}},{binding:3,resource:{buffer:this.ciphertextBuffer}}]}),this.bindGroupDirty=!1);const E=this.device.createCommandEncoder(),P=E.beginComputePass();P.setPipeline(this.pipeline),P.setBindGroup(0,this.bindGroup),P.dispatchWorkgroups(Math.ceil(f/(256*16))),P.end(),E.copyBufferToBuffer(this.matchCountBuffer,0,x,0,4),E.copyBufferToBuffer(this.matchIndicesBuffer,0,p,0,1024*4),this.device.queue.submit([E.finish()]),await x.mapAsync(GPUMapMode.READ);const k=new Uint32Array(x.getMappedRange())[0];x.unmap();const I=[];if(k>0){await p.mapAsync(GPUMapMode.READ);const N=new Uint32Array(p.getMappedRange());for(let z=0;z<Math.min(k,1024);z++)I.push(N[z]);p.unmap()}return I}destroy(){var a,s,l,f,d,m,h,x;(a=this.paramsBuffer)==null||a.destroy(),(s=this.matchCountBuffer)==null||s.destroy(),(l=this.matchIndicesBuffer)==null||l.destroy(),(f=this.ciphertextBuffer)==null||f.destroy(),(d=this.matchCountReadBuffers[0])==null||d.destroy(),(m=this.matchCountReadBuffers[1])==null||m.destroy(),(h=this.matchIndicesReadBuffers[0])==null||h.destroy(),(x=this.matchIndicesReadBuffers[1])==null||x.destroy(),this.paramsBuffer=null,this.matchCountBuffer=null,this.matchIndicesBuffer=null,this.ciphertextBuffer=null,this.ciphertextBufferSize=0,this.matchCountReadBuffers=[null,null],this.matchIndicesReadBuffers=[null,null],this.currentReadBufferIndex=0,this.bindGroup=null,this.bindGroupDirty=!0,this.device&&(this.device.destroy(),this.device=null),this.pipeline=null,this.bindGroupLayout=null}}$c.ZERO_DATA=new Uint32Array([0]);function IC(){return typeof navigator<"u"&&"gpu"in navigator}class hA{runBatch(a,s,l,f,d,m){const h=[],x=a.toString(16).padStart(2,"0")
Line truncated
|
||||
`).map(d=>d.trim().toLowerCase()).filter(d=>d.length>0);this.wordlist=f.filter(pA)}setWordlist(a){this.wordlist=a.map(s=>s.trim().toLowerCase()).filter(pA)}abort(){this.abortFlag=!0}isGpuAvailable(){return IC()}async decodePacket(a){var l;const s=a.trim().replace(/\s+/g,"").replace(/^0x/i,"");if(!s||!/^[0-9a-fA-F]+$/.test(s))return null;try{const d=(l=(await cA.MeshCorePacketDecoder.decodeWithVerification(s,{})).payload)==null?void 0:l.decoded;return!(d!=null&&d.channelHash)||!(d!=null&&d.ciphertext)||!(d!=null&&d.cipherMac)?null:{channelHash:d.channelHash,ciphertext:d.ciphertext,cipherMac:d.cipherMac,isGroupText:!0}}catch{return null}}async crack(a,s,l){this.abortFlag=!1,this.useTimestampFilter=(s==null?void 0:s.useTimestampFilter)??!0,this.useUtf8Filter=(s==null?void 0:s.useUtf8Filter)??!0,this.validSeconds=(s==null?void 0:s.validSeconds)??e0,this.useCpu=(s==null?void 0:s.forceCpu)??!1;const f=(s==null?void 0:s.maxLength)??8,d=(s==null?void 0:s.startingLength)??1,m=(s==null?void 0:s.useDictionary)??!0,h=(s==null?void 0:s.startFromType)??"bruteforce",x=a.toLowerCase(),p=await this.decodePacket(x);if(!p)return{found:!1,error:"Invalid packet or not a GroupText packet"};const{channelHash:y,ciphertext:v,cipherMac:w}=p,S=parseInt(y,16);this.useCpu?this.cpuInstance||(this.cpuInstance=new hA):this.gpuInstance||(this.gpuInstance=new $c,await this.gpuInstance.init()||(this.useCpu=!0,this.cpuInstance=new hA));const T=performance.now();let C=0,E=performance.now(),P=d,B=0,k=0,I=!1;if(s!=null&&s.startFrom){const V=s.startFrom.toLowerCase();if(h==="dictionary"){const J=this.wordlist.indexOf(V);J>=0&&(k=J+1)}else{I=!0;const J=NC(V);J&&(P=Math.max(d,J.length),B=J.index+1,B>=el(P)&&(P++,B=0))}}let N=0;m&&!I&&this.wordlist.length>0&&(N+=this.wordlist.length-k);for(let V=P;V<=f;V++)N+=el(V);N-=B;const z=(V,J,le)=>{if(!l)return;const de=(performance.now()-T)/1e3,q=de>0?Math.round(C/de):0,me=N-C,ne=q>0?me/q:0;l({checked:C,total:N,percent:N>0?Math.min(100,C/N*100):0,rateKeysPerSec:q,etaSeconds:ne,elapsedSeconds:de,currentLength:J,currentPosition:le,phase:V})},j=V=>{if(!Bx(v,w,V))return{valid:!1};const J=cA.ChannelCrypto.decryptGroupTextMessage(v,w,V);return!J.success||!J.data?{valid:!1}:this.useTimestampFilter&&!LC(J.data.timestamp,this.validSeconds)?{valid:!1}:this.useUtf8Filter&&!MC(J.data.message)?{valid:!1}:{valid:!0,message:J.data.message}};if(!I&&k===0&&P===d&&B===0){z("public-key",0,Jf);const V=n0(wc);if(y===V){const J=j(wc);if(J.valid)return{found:!0,roomName:Jf,key:wc,decryptedMessage:J.message}}}if(m&&!I&&this.wordlist.length>0)for(let V=k;V<this.wordlist.length;V++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:this.wordlist[V],resumeType:"dictionary"};const J=this.wordlist[V],le=t0("#"+J),oe=n0(le);if(parseInt(oe,16)===S){const q=j(le);if(q.valid)return{found:!0,roomName:J,key:le,decryptedMessage:q.message,resumeFrom:J,resumeType:"dictionary"}}C++;const de=performance.now();de-E>=200&&(z("wordlist",J.length,J),E=de,await new Promise(q=>setTimeout(q,0)))}const H=this.useCpu?1024:32768,K=(s==null?void 0:s.gpuDispatchMs)??1e3;let U=H,G=!1;for(let V=P;V<=f;V++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Ho(V,0)||void 0,resumeType:"bruteforce"};const J=el(V);let le=V===P?B:0;for(;le<J;){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Ho(V,le)||void 0,resumeType:"bruteforce"};const oe=Math.min(U,J-le),de=performance.now();let q;this.useCpu?q=this.cpuInstance.runBatch(S,V,le,oe,v,w):q=await this.gpuInstance.runBatch(S,V,le,oe,v,w);const me=performance.now()-de;if(C+=oe,!this.useCpu&&!G&&oe>=H&&me>0){const D=K/me,Z=Math.round(oe*D),$=Math.pow(2,Math.round(Math.log2(Math.max(H,Z))));U=Math.max(H,$),G=!0}for(const D of q){const Z=Ho(V,D);if(!Z)continue;const $=t0("#"+Z),X=j($);if(X.valid)return{found:!0,roomName:Z,key:$,decryptedMessage:X.message,resumeFrom:Z,resumeType:"bruteforce"}}le+=oe;const ne=performance.now();if(ne-E>=200){const D=Ho(V,Math.min(le,J-1))||"";z("bruteforce",V,D),E=ne,await new Promise(Z=>setTimeout(Z,0))}}}return{found:!1,resumeFrom:Ho(f,el(f)-1)||void 0,resumeType:"bruteforce"}}destroy(){this.gpuInstance&&(this.gpuInstance.destroy(),this.gpuInstance=null),this.cpuInstance&&(this.cpuInstance.destroy(),this.cpuInstance=null)}}var jf,mA;function VC(){return mA||(mA=1,jf={webm:"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIEgY6JPbwIeVgF2b3JiaXMAAAAAAoC
Line truncated
|
||||
NoSleep enabled for older iOS devices. This can interrupt
|
||||
active or long-running network requests from completing successfully.
|
||||
See https://github.com/richtr/NoSleep.js/issues/15 for more details.
|
||||
`),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(h=>(this.enabled=!0,h)).catch(h=>{throw this.enabled=!1,h})}disable(){l()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):s()?this.noSleepTimer&&(console.warn(`
|
||||
NoSleep now disabled for older iOS devices.
|
||||
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}return Hf=f,Hf}var ZC=UC();const WC=Us(ZC);function qC(r){if(r.length<4)return null;try{const s=parseInt(r.slice(0,2),16)&3;let l=2;if(s===0||s===3){if(r.length<l+8)return null;l+=8}if(r.length<l+2)return null;const f=parseInt(r.slice(l,l+2),16);l+=2;const d=f*2;return r.length<l+d?null:(l+=d,r.slice(l))}catch{return null}}function GC({packets:r,channels:a,onChannelCreate:s,onRunningChange:l,visible:f=!1}){const[d,m]=R.useState(!1),[h,x]=R.useState(6),[p,y]=R.useState(!1),[v,w]=R.useState(!0),[S,T]=R.useState(!1),[C,E]=R.useState(null),[P,B]=R.useState(new Map),[k,I]=R.useState([]),[N,z]=R.useState(!1),[j,H]=R.useState(null),[K,U]=R.useState(null),[G,re]=R.useState(0),V=R.useRef(null),J=R.useRef(null),le=R.useRef(!1),oe=R.useRef(!1),de=R.useRef(!1),q=R.useRef(new Map),me=R.useRef(!1),ne=R.useRef(6),D=R.useRef(!0),Z=R.useRef(!1),$=R.useRef(new Set),X=R.useRef(new Set);R.useEffect(()=>{const Se=new HC;V.current=Se,H(Se.isGpuAvailable());const Ve=new WC;return J.current=Ve,()=>{Se.destroy(),V.current=null,Ve.disable(),J.current=null}},[]),R.useEffect(()=>{!f||N||z2(async()=>{const{ENGLISH_WORDLIST:Se}=await import("./wordlist-BV_32SRm.js");return{ENGLISH_WORDLIST:Se}},[]).then(({ENGLISH_WORDLIST:Se})=>{V.current&&(V.current.setWordlist(Se),z(!0))}).catch(Se=>{console.error("Failed to load wordlist:",Se),Lt.error("Failed to load wordlist",{description:"Cracking will not be available"})})},[f,N]),R.useEffect(()=>{const Se=()=>{at.getUndecryptedPacketCount().then(({count:dt})=>U(dt)).catch(()=>U(null))};Se();const Ve=setInterval(Se,3e4);return()=>clearInterval(Ve)},[]);const fe=new Set(a.map(Se=>Se.key.toUpperCase())),he=r.filter(Se=>Se.payload_type==="GROUP_TEXT"&&!Se.decrypted);R.useEffect(()=>{let Se=0;B(Ve=>{const dt=new Map(Ve);let Mt=!1;for(const vt of he)if(!dt.has(vt.id)){const ot=qC(vt.data);if(ot&&X.current.has(ot)){Se++;continue}ot&&X.current.add(ot),dt.set(vt.id,{packet:vt,attempts:0,lastAttemptLength:0,status:"pending"}),Mt=!0}return Mt?(q.current=dt,dt):Ve}),Se>0&&re(Ve=>Ve+Se)},[he.length]),R.useEffect(()=>{q.current=P},[P]),R.useEffect(()=>{me.current=p},[p]),R.useEffect(()=>{ne.current=h},[h]),R.useEffect(()=>{D.current=v},[v]),R.useEffect(()=>{Z.current=S},[S]),R.useEffect(()=>{$.current=new Set(he.map(Se=>Se.id))},[he]),R.useEffect(()=>{l==null||l(d)},[d,l]);const ke=Array.from(P.values()).filter(Se=>Se.status==="pending").length,Ae=Array.from(P.values()).filter(Se=>Se.status==="cracked").length,qe=Array.from(P.values()).filter(Se=>Se.status==="failed").length,Ye=R.useCallback(async()=>{if(de.current||!V.current||!le.current)return;const Se=q.current;let Ve=null,dt=null;for(const[Qe,Xe]of Se.entries())if(Xe.status==="pending"){Ve=Xe,dt=Qe;break}if(!Ve&&me.current){const Qe=Array.from(Se.entries()).filter(([,Xe])=>Xe.status==="failed"&&Xe.lastAttemptLength<10);Qe.length>0&&(Qe.sort((Xe,et)=>Xe[1].lastAttemptLength-et[1].lastAttemptLength),[dt,Ve]=Qe[0])}if(!Ve||dt===null){le.current&&setTimeout(()=>Ye(),1e3);return}if(!$.current.has(dt)){B(Qe=>{const Xe=new Map(Qe);return Xe.delete(dt),Xe}),le.current&&setTimeout(()=>Ye(),10);return}de.current=!0;const Mt=ne.current,vt=Ve.lastAttemptLength>0,ot=vt?Ve.lastAttemptLength+1:Mt;try{const Qe=await V.current.crack(Ve.packet.data,{maxLength:ot,useTimestampFilter:!0,useUtf8Filter:!0,...Z.current&&{gpuDispatchMs:1e4},...vt&&{useDictionary:!1,startingLength:ot}},Xe=>{E(Xe)});if(oe.current){oe.current=!1,de.current=!1,E(null);return}if(Qe.found&&Qe.roomName&&Qe.key){B(Oe=>{const _t=new Map(Oe),$t=_t.get(dt);return $t&&_t.set(dt,{...$t,status:"cracked",attempts:$t.attempts+1,lastAttemptLength:ot}),_t});const Xe={roomName:Qe.roomName,key:Qe.key,packetId:dt,message:Qe.decryptedMessage||"",crackedAt:Date.now()};I(Oe=>[...Oe,Xe]);const et=Qe.key.toUpperCase();if(!fe.has(et))try{const Oe="#"+Qe.roomName;await s(Oe,Qe.key),D.current&&await at.decryptHistoricalPackets({key_type:"channel",channel_name:Oe})}catch(Oe){console.error("Failed to create channel or decrypt historical:",Oe),Lt.error("Failed to save cracked channel",{description:Oe instanceof Error?Oe.message:"Channel discovered but could not be saved"})}}else B(Xe=>{const et=new Map(Xe),Oe=et.get(dt);return Oe&&et.set(dt,{...Oe,status:"failed",attempts:Oe.attempts+1,lastAttemptLength:ot}),et})}catch(Qe){console.error("Cracking error:",Qe),B(Xe=>{const et=new Map(Xe),Oe=et.get(dt);return Oe&&et.set(dt,{...Oe,status:"failed",attempts:Oe.attempts+1,lastAttemptLength:ot}),et})}de.current=!1,E(null),le.current&&setTimeout(()=>Ye(),100)},[fe,s]),Et=()=>{var Se;if(!j){Lt.error("WebGPU not available",{description:"Cracking requires Chrome 113+ or Edge 113+ with WebGPU support."});return}m(!0),le.current=!0,oe.current=!1,(Se=J.current)==null||Se.enable(),Ye()},ht=()=>{var Se,Ve;m(!1),le.current=!1,oe.current=!0,(Se=V.current)==null||Se.abort(),(Ve=J.current)==null||Ve.disable()};return F.jsxs("div",
Line truncated
|
||||
//# sourceMappingURL=index-70eOpM-W.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"mappings":";;;;;;;;6CASa,IAAIA,EAAE,OAAO,IAAI,eAAe,EAAEC,EAAE,OAAO,IAAI,cAAc,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,mBAAmB,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,eAAe,EAAEC,EAAE,OAAO,IAAI,mBAAmB,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,YAAY,EAAE,EAAE,OAAO,IAAI,YAAY,EAAEC,EAAE,OAAO,SAAS,SAASC,EAAEC,EAAE,CAAC,OAAUA,IAAP,MAAqB,OAAOA,GAAlB,SAA2B,MAAKA,EAAEF,GAAGE,EAAEF,CAAC,GAAGE,EAAE,YAAY,EAAqB,OAAOA,GAApB,WAAsBA,EAAE,KAAI,CAC1e,IAAIC,EAAE,CAAC,UAAU,UAAU,CAAC,MAAM,EAAE,EAAE,mBAAmB,UAAU,GAAG,oBAAoB,UAAU,GAAG,gBAAgB,UAAU,EAAE,EAAEC,EAAE,OAAO,OAAOC,EAAE,GAAG,SAAS,EAAEH,EAAEI,EAAEC,EAAE,CAAC,KAAK,MAAML,EAAE,KAAK,QAAQI,EAAE,KAAK,KAAKD,EAAE,KAAK,QAAQE,GAAGJ,CAAC,CAAC,EAAE,UAAU,iBAAiB,GACnQ,EAAE,UAAU,SAAS,SAASD,EAAEI,EAAE,CAAC,GAAc,OAAOJ,GAAlB,UAAkC,OAAOA,GAApB,YAA6BA,GAAN,KAAQ,MAAM,MAAM,uHAAuH,EAAE,KAAK,QAAQ,gBAAgB,KAAKA,EAAEI,EAAE,UAAU,CAAC,EAAE,EAAE,UAAU,YAAY,SAASJ,EAAE,CAAC,KAAK,QAAQ,mBAAmB,KAAKA,EAAE,aAAa,CAAC,EAAE,SAASM,GAAG,EAAEA,EAAE,UAAU,EAAE,UAAU,SAASC,EAAEP,EAAEI,EAAEC,EAAE,CAAC,KAAK,MAAML,EAAE,KAAK,QAAQI,EAAE,KAAK,KAAKD,EAAE,KAAK,QAAQE,GAAGJ,CAAC,CAAC,IAAIO,EAAED,EAAE,UAAU,IAAID,EACrfE,EAAE,YAAYD,EAAEL,EAAEM,EAAE,EAAE,SAAS,EAAEA,EAAE,qBAAqB,GAAG,IAAI,EAAE,MAAM,QAAQC,EAAE,OAAO,UAAU,eAAeC,EAAE,CAAC,QAAQ,IAAI,EAAEC,EAAE,CAAC,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,SAAS,EAAE,EACxK,SAASC,EAAEZ,EAAEI,EAAEC,EAAE,CAAC,IAAIQ,EAAEC,GAAE,GAAGC,GAAE,KAAKC,GAAE,KAAK,GAASZ,GAAN,KAAQ,IAAIS,KAAcT,EAAE,MAAX,SAAiBY,GAAEZ,EAAE,KAAcA,EAAE,MAAX,SAAiBW,GAAE,GAAGX,EAAE,KAAKA,EAAEK,EAAE,KAAKL,EAAES,CAAC,GAAG,CAACF,EAAE,eAAeE,CAAC,IAAIC,GAAED,CAAC,EAAET,EAAES,CAAC,GAAG,IAAII,GAAE,UAAU,OAAO,EAAE,GAAOA,KAAJ,EAAMH,GAAE,SAAST,UAAU,EAAEY,GAAE,CAAC,QAAQC,GAAE,MAAMD,EAAC,EAAEE,GAAE,EAAEA,GAAEF,GAAEE,KAAID,GAAEC,EAAC,EAAE,UAAUA,GAAE,CAAC,EAAEL,GAAE,SAASI,EAAC,CAAC,GAAGlB,GAAGA,EAAE,aAAa,IAAIa,KAAKI,GAAEjB,EAAE,aAAaiB,GAAWH,GAAED,CAAC,IAAZ,SAAgBC,GAAED,CAAC,EAAEI,GAAEJ,CAAC,GAAG,MAAM,CAAC,SAASzB,EAAE,KAAKY,EAAE,IAAIe,GAAE,IAAIC,GAAE,MAAMF,GAAE,OAAOJ,EAAE,OAAO,CAAC,CAC7a,SAASU,EAAEpB,EAAEI,EAAE,CAAC,MAAM,CAAC,SAAShB,EAAE,KAAKY,EAAE,KAAK,IAAII,EAAE,IAAIJ,EAAE,IAAI,MAAMA,EAAE,MAAM,OAAOA,EAAE,MAAM,CAAC,CAAC,SAASqB,EAAErB,EAAE,CAAC,OAAiB,OAAOA,GAAlB,UAA4BA,IAAP,MAAUA,EAAE,WAAWZ,CAAC,CAAC,SAASkC,EAAOtB,EAAE,CAAC,IAAII,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,EAAE,MAAM,IAAIJ,EAAE,QAAQ,QAAQ,SAASA,EAAE,CAAC,OAAOI,EAAEJ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAIuB,GAAE,OAAO,SAASC,EAAExB,EAAEI,EAAE,CAAC,OAAiB,OAAOJ,GAAlB,UAA4BA,IAAP,MAAgBA,EAAE,KAAR,KAAYsB,EAAO,GAAGtB,EAAE,GAAG,EAAEI,EAAE,SAAS,EAAE,CAAC,CAC/W,SAASqB,EAAEzB,EAAEI,EAAEC,EAAEQ,EAAEC,GAAE,CAAC,IAAIC,GAAE,OAAOf,GAAmBe,KAAd,aAA6BA,KAAZ,aAAcf,EAAE,MAAK,IAAIgB,GAAE,GAAG,GAAUhB,IAAP,KAASgB,GAAE,OAAQ,QAAOD,GAAC,CAAE,IAAK,SAAS,IAAK,SAASC,GAAE,GAAG,MAAM,IAAK,SAAS,OAAOhB,EAAE,SAAQ,CAAE,KAAKZ,EAAE,KAAKC,EAAE2B,GAAE,EAAE,CAAC,CAAC,GAAGA,GAAE,OAAOA,GAAEhB,EAAEc,GAAEA,GAAEE,EAAC,EAAEhB,EAAOa,IAAL,GAAO,IAAIW,EAAER,GAAE,CAAC,EAAEH,EAAE,EAAEC,EAAC,GAAGT,EAAE,GAASL,GAAN,OAAUK,EAAEL,EAAE,QAAQuB,GAAE,KAAK,EAAE,KAAKE,EAAEX,GAAEV,EAAEC,EAAE,GAAG,SAASL,GAAE,CAAC,OAAOA,EAAC,CAAC,GAASc,IAAN,OAAUO,EAAEP,EAAC,IAAIA,GAAEM,EAAEN,GAAET,GAAG,CAACS,GAAE,KAAKE,IAAGA,GAAE,MAAMF,GAAE,IAAI,IAAI,GAAGA,GAAE,KAAK,QAAQS,GAAE,KAAK,EAAE,KAAKvB,CAAC,GAAGI,EAAE,KAAKU,EAAC,GAAG,EAAyB,GAAvBE,GAAE,EAAEH,EAAOA,IAAL,GAAO,IAAIA,EAAE,IAAO,EAAEb,CAAC,EAAE,QAAQiB,GAAE,EAAEA,GAAEjB,EAAE,OAAOiB,KAAI,CAACF,GACrff,EAAEiB,EAAC,EAAE,IAAIC,GAAEL,EAAEW,EAAET,GAAEE,EAAC,EAAED,IAAGS,EAAEV,GAAEX,EAAEC,EAAEa,GAAEJ,EAAC,CAAC,SAASI,GAAEnB,EAAEC,CAAC,EAAe,OAAOkB,IAApB,WAAsB,IAAIlB,EAAEkB,GAAE,KAAKlB,CAAC,EAAEiB,GAAE,EAAE,EAAEF,GAAEf,EAAE,KAAI,GAAI,MAAMe,GAAEA,GAAE,MAAMG,GAAEL,EAAEW,EAAET,GAAEE,IAAG,EAAED,IAAGS,EAAEV,GAAEX,EAAEC,EAAEa,GAAEJ,EAAC,UAAqBC,KAAX,SAAa,MAAMX,EAAE,OAAOJ,CAAC,EAAE,MAAM,mDAAuEI,IAApB,kBAAsB,qBAAqB,OAAO,KAAKJ,CAAC,EAAE,KAAK,IAAI,EAAE,IAAII,GAAG,2EAA2E,EAAE,OAAOY,EAAC,CACzZ,SAASU,GAAE1B,EAAEI,EAAEC,EAAE,CAAC,GAASL,GAAN,KAAQ,OAAOA,EAAE,IAAIa,EAAE,GAAGC,GAAE,EAAE,OAAAW,EAAEzB,EAAEa,EAAE,GAAG,GAAG,SAASb,GAAE,CAAC,OAAOI,EAAE,KAAKC,EAAEL,GAAEc,IAAG,CAAC,CAAC,EAASD,CAAC,CAAC,SAASc,GAAE3B,EAAE,CAAC,GAAQA,EAAE,UAAP,GAAe,CAAC,IAAII,EAAEJ,EAAE,QAAQI,EAAEA,EAAC,EAAGA,EAAE,KAAK,SAASA,EAAE,EAAQJ,EAAE,UAAN,GAAoBA,EAAE,UAAP,MAAeA,EAAE,QAAQ,EAAEA,EAAE,QAAQI,EAAC,EAAE,SAASA,EAAE,EAAQJ,EAAE,UAAN,GAAoBA,EAAE,UAAP,MAAeA,EAAE,QAAQ,EAAEA,EAAE,QAAQI,EAAC,CAAC,EAAOJ,EAAE,UAAP,KAAiBA,EAAE,QAAQ,EAAEA,EAAE,QAAQI,EAAE,CAAC,GAAOJ,EAAE,UAAN,EAAc,OAAOA,EAAE,QAAQ,QAAQ,MAAMA,EAAE,OAAQ,CAC5Z,IAAI4B,GAAE,CAAC,QAAQ,IAAI,EAAEC,EAAE,CAAC,WAAW,IAAI,EAAEC,GAAE,CAAC,uBAAuBF,GAAE,wBAAwBC,EAAE,kBAAkBnB,CAAC,EAAE,SAASqB,IAAG,CAAC,MAAM,MAAM,0DAA0D,CAAE,CACzM,OAAAC,GAAA,SAAiB,CAAC,IAAIN,GAAE,QAAQ,SAAS1B,EAAEI,EAAEC,EAAE,CAACqB,GAAE1B,EAAE,UAAU,CAACI,EAAE,MAAM,KAAK,SAAS,CAAC,EAAEC,CAAC,CAAC,EAAE,MAAM,SAASL,EAAE,CAAC,IAAII,EAAE,EAAE,OAAAsB,GAAE1B,EAAE,UAAU,CAACI,GAAG,CAAC,EAASA,CAAC,EAAE,QAAQ,SAASJ,EAAE,CAAC,OAAO0B,GAAE1B,EAAE,SAASA,EAAE,CAAC,OAAOA,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,SAASA,EAAE,CAAC,GAAG,CAACqB,EAAErB,CAAC,EAAE,MAAM,MAAM,uEAAuE,EAALine truncated
|
||||
-541
@@ -1,541 +0,0 @@
|
||||
var hv=Object.defineProperty;var pv=(r,a,s)=>a in r?hv(r,a,{enumerable:!0,configurable:!0,writable:!0,value:s}):r[a]=s;var Fo=(r,a,s)=>pv(r,typeof a!="symbol"?a+"":a,s);function mv(r,a){for(var s=0;s<a.length;s++){const l=a[s];if(typeof l!="string"&&!Array.isArray(l)){for(const d in l)if(d!=="default"&&!(d in r)){const f=Object.getOwnPropertyDescriptor(l,d);f&&Object.defineProperty(r,d,f.get?f:{enumerable:!0,get:()=>l[d]})}}}return Object.freeze(Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}))}(function(){const a=document.createElement("link").relList;if(a&&a.supports&&a.supports("modulepreload"))return;for(const d of document.querySelectorAll('link[rel="modulepreload"]'))l(d);new MutationObserver(d=>{for(const f of d)if(f.type==="childList")for(const m of f.addedNodes)m.tagName==="LINK"&&m.rel==="modulepreload"&&l(m)}).observe(document,{childList:!0,subtree:!0});function s(d){const f={};return d.integrity&&(f.integrity=d.integrity),d.referrerPolicy&&(f.referrerPolicy=d.referrerPolicy),d.crossOrigin==="use-credentials"?f.credentials="include":d.crossOrigin==="anonymous"?f.credentials="omit":f.credentials="same-origin",f}function l(d){if(d.ep)return;d.ep=!0;const f=s(d);fetch(d.href,f)}})();var vf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Us(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function gA(r){if(Object.prototype.hasOwnProperty.call(r,"__esModule"))return r;var a=r.default;if(typeof a=="function"){var s=function l(){return this instanceof l?Reflect.construct(a,arguments,this.constructor):a.apply(this,arguments)};s.prototype=a.prototype}else s={};return Object.defineProperty(s,"__esModule",{value:!0}),Object.keys(r).forEach(function(l){var d=Object.getOwnPropertyDescriptor(r,l);Object.defineProperty(s,l,d.get?d:{enumerable:!0,get:function(){return r[l]}})}),s}var yf={exports:{}},Ma={},_f={exports:{}},ot={};/**
|
||||
* @license React
|
||||
* react.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var dp;function Av(){if(dp)return ot;dp=1;var r=Symbol.for("react.element"),a=Symbol.for("react.portal"),s=Symbol.for("react.fragment"),l=Symbol.for("react.strict_mode"),d=Symbol.for("react.profiler"),f=Symbol.for("react.provider"),m=Symbol.for("react.context"),h=Symbol.for("react.forward_ref"),x=Symbol.for("react.suspense"),p=Symbol.for("react.memo"),y=Symbol.for("react.lazy"),v=Symbol.iterator;function w(P){return P===null||typeof P!="object"?null:(P=v&&P[v]||P["@@iterator"],typeof P=="function"?P:null)}var k={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},S=Object.assign,E={};function b(P,Z,K){this.props=P,this.context=Z,this.refs=E,this.updater=K||k}b.prototype.isReactComponent={},b.prototype.setState=function(P,Z){if(typeof P!="object"&&typeof P!="function"&&P!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,P,Z,"setState")},b.prototype.forceUpdate=function(P){this.updater.enqueueForceUpdate(this,P,"forceUpdate")};function D(){}D.prototype=b.prototype;function T(P,Z,K){this.props=P,this.context=Z,this.refs=E,this.updater=K||k}var B=T.prototype=new D;B.constructor=T,S(B,b.prototype),B.isPureReactComponent=!0;var I=Array.isArray,N=Object.prototype.hasOwnProperty,z={current:null},H={key:!0,ref:!0,__self:!0,__source:!0};function j(P,Z,K){var Y,fe={},me=null,Ee=null;if(Z!=null)for(Y in Z.ref!==void 0&&(Ee=Z.ref),Z.key!==void 0&&(me=""+Z.key),Z)N.call(Z,Y)&&!H.hasOwnProperty(Y)&&(fe[Y]=Z[Y]);var ge=arguments.length-2;if(ge===1)fe.children=K;else if(1<ge){for(var je=Array(ge),Ge=0;Ge<ge;Ge++)je[Ge]=arguments[Ge+2];fe.children=je}if(P&&P.defaultProps)for(Y in ge=P.defaultProps,ge)fe[Y]===void 0&&(fe[Y]=ge[Y]);return{$$typeof:r,type:P,key:me,ref:Ee,props:fe,_owner:z.current}}function Q(P,Z){return{$$typeof:r,type:P.type,key:Z,ref:P.ref,props:P.props,_owner:P._owner}}function U(P){return typeof P=="object"&&P!==null&&P.$$typeof===r}function V(P){var Z={"=":"=0",":":"=2"};return"$"+P.replace(/[=:]/g,function(K){return Z[K]})}var J=/\/+/g;function X(P,Z){return typeof P=="object"&&P!==null&&P.key!=null?V(""+P.key):Z.toString(36)}function oe(P,Z,K,Y,fe){var me=typeof P;(me==="undefined"||me==="boolean")&&(P=null);var Ee=!1;if(P===null)Ee=!0;else switch(me){case"string":case"number":Ee=!0;break;case"object":switch(P.$$typeof){case r:case a:Ee=!0}}if(Ee)return Ee=P,fe=fe(Ee),P=Y===""?"."+X(Ee,0):Y,I(fe)?(K="",P!=null&&(K=P.replace(J,"$&/")+"/"),oe(fe,Z,K,"",function(Ge){return Ge})):fe!=null&&(U(fe)&&(fe=Q(fe,K+(!fe.key||Ee&&Ee.key===fe.key?"":(""+fe.key).replace(J,"$&/")+"/")+P)),Z.push(fe)),1;if(Ee=0,Y=Y===""?".":Y+":",I(P))for(var ge=0;ge<P.length;ge++){me=P[ge];var je=Y+X(me,ge);Ee+=oe(me,Z,K,je,fe)}else if(je=w(P),typeof je=="function")for(P=je.call(P),ge=0;!(me=P.next()).done;)me=me.value,je=Y+X(me,ge++),Ee+=oe(me,Z,K,je,fe);else if(me==="object")throw Z=String(P),Error("Objects are not valid as a React child (found: "+(Z==="[object Object]"?"object with keys {"+Object.keys(P).join(", ")+"}":Z)+"). If you meant to render a collection of children, use an array instead.");return Ee}function pe(P,Z,K){if(P==null)return P;var Y=[],fe=0;return oe(P,Y,"","",function(me){return Z.call(K,me,fe++)}),Y}function se(P){if(P._status===-1){var Z=P._result;Z=Z(),Z.then(function(K){(P._status===0||P._status===-1)&&(P._status=1,P._result=K)},function(K){(P._status===0||P._status===-1)&&(P._status=2,P._result=K)}),P._status===-1&&(P._status=0,P._result=Z)}if(P._status===1)return P._result.default;throw P._result}var he={current:null},q={transition:null},Ae={ReactCurrentDispatcher:he,ReactCurrentBatchConfig:q,ReactCurrentOwner:z};function ne(){throw Error("act(...) is not supported in production builds of React.")}return ot.Children={map:pe,forEach:function(P,Z,K){pe(P,function(){Z.apply(this,arguments)},K)},count:function(P){var Z=0;return pe(P,function(){Z++}),Z},toArray:function(P){return pe(P,function(Z){return Z})||[]},only:function(P){if(!U(P))throw Error("React.Children.only expected to receive a single React element child.");return P}},ot.Component=b,ot.Fragment=s,ot.Profiler=d,ot.PureComponent=T,ot.StrictMode=l,ot.Suspense=x,ot.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=Ae,ot.act=ne,ot.cloneElement=function(P,Z,K){if(P==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+P+".");var Y=S({},P.props),fe=P.key,me=P.ref,Ee=P._owner;if(Z!=null){if(Z.ref!==void 0&&(me=Z.ref,Ee=z.current),Z.key!==void 0&&(fe=""+Z.key),P.type&&P.type.defaultProps)var ge=P.type.defaultProps;for(je in Z)N.call(Z,je)&&!H.hasOwnProperty(je)&&(Y[je]=Z[je]===void 0&&ge!==void 0?ge[je]:Z[je])}var je=arguments.length-2;if(je===1)Y.children=K;else if(1<je){ge=Array(je);for(var Ge=0;Ge<je;Ge++)ge[Ge]=arguments[Ge+2];Y.children=ge}return{$$typeof:r,type:P.type,key:fe,ref:me,props:Y,_owner:Ee}},ot.creaLine truncated
|
||||
* @license React
|
||||
* react-jsx-runtime.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var hp;function gv(){if(hp)return Ma;hp=1;var r=r0(),a=Symbol.for("react.element"),s=Symbol.for("react.fragment"),l=Object.prototype.hasOwnProperty,d=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,f={key:!0,ref:!0,__self:!0,__source:!0};function m(h,x,p){var y,v={},w=null,k=null;p!==void 0&&(w=""+p),x.key!==void 0&&(w=""+x.key),x.ref!==void 0&&(k=x.ref);for(y in x)l.call(x,y)&&!f.hasOwnProperty(y)&&(v[y]=x[y]);if(h&&h.defaultProps)for(y in x=h.defaultProps,x)v[y]===void 0&&(v[y]=x[y]);return{$$typeof:a,type:h,key:w,ref:k,props:v,_owner:d.current}}return Ma.Fragment=s,Ma.jsx=m,Ma.jsxs=m,Ma}var pp;function xv(){return pp||(pp=1,yf.exports=gv()),yf.exports}var R=xv(),F=r0();const we=Us(F),i0=mv({__proto__:null,default:we},[F]);var wu={},wf={exports:{}},Vn={},Cf={exports:{}},bf={};/**
|
||||
* @license React
|
||||
* scheduler.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var mp;function vv(){return mp||(mp=1,(function(r){function a(q,Ae){var ne=q.length;q.push(Ae);e:for(;0<ne;){var P=ne-1>>>1,Z=q[P];if(0<d(Z,Ae))q[P]=Ae,q[ne]=Z,ne=P;else break e}}function s(q){return q.length===0?null:q[0]}function l(q){if(q.length===0)return null;var Ae=q[0],ne=q.pop();if(ne!==Ae){q[0]=ne;e:for(var P=0,Z=q.length,K=Z>>>1;P<K;){var Y=2*(P+1)-1,fe=q[Y],me=Y+1,Ee=q[me];if(0>d(fe,ne))me<Z&&0>d(Ee,fe)?(q[P]=Ee,q[me]=ne,P=me):(q[P]=fe,q[Y]=ne,P=Y);else if(me<Z&&0>d(Ee,ne))q[P]=Ee,q[me]=ne,P=me;else break e}}return Ae}function d(q,Ae){var ne=q.sortIndex-Ae.sortIndex;return ne!==0?ne:q.id-Ae.id}if(typeof performance=="object"&&typeof performance.now=="function"){var f=performance;r.unstable_now=function(){return f.now()}}else{var m=Date,h=m.now();r.unstable_now=function(){return m.now()-h}}var x=[],p=[],y=1,v=null,w=3,k=!1,S=!1,E=!1,b=typeof setTimeout=="function"?setTimeout:null,D=typeof clearTimeout=="function"?clearTimeout:null,T=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function B(q){for(var Ae=s(p);Ae!==null;){if(Ae.callback===null)l(p);else if(Ae.startTime<=q)l(p),Ae.sortIndex=Ae.expirationTime,a(x,Ae);else break;Ae=s(p)}}function I(q){if(E=!1,B(q),!S)if(s(x)!==null)S=!0,se(N);else{var Ae=s(p);Ae!==null&&he(I,Ae.startTime-q)}}function N(q,Ae){S=!1,E&&(E=!1,D(j),j=-1),k=!0;var ne=w;try{for(B(Ae),v=s(x);v!==null&&(!(v.expirationTime>Ae)||q&&!V());){var P=v.callback;if(typeof P=="function"){v.callback=null,w=v.priorityLevel;var Z=P(v.expirationTime<=Ae);Ae=r.unstable_now(),typeof Z=="function"?v.callback=Z:v===s(x)&&l(x),B(Ae)}else l(x);v=s(x)}if(v!==null)var K=!0;else{var Y=s(p);Y!==null&&he(I,Y.startTime-Ae),K=!1}return K}finally{v=null,w=ne,k=!1}}var z=!1,H=null,j=-1,Q=5,U=-1;function V(){return!(r.unstable_now()-U<Q)}function J(){if(H!==null){var q=r.unstable_now();U=q;var Ae=!0;try{Ae=H(!0,q)}finally{Ae?X():(z=!1,H=null)}}else z=!1}var X;if(typeof T=="function")X=function(){T(J)};else if(typeof MessageChannel<"u"){var oe=new MessageChannel,pe=oe.port2;oe.port1.onmessage=J,X=function(){pe.postMessage(null)}}else X=function(){b(J,0)};function se(q){H=q,z||(z=!0,X())}function he(q,Ae){j=b(function(){q(r.unstable_now())},Ae)}r.unstable_IdlePriority=5,r.unstable_ImmediatePriority=1,r.unstable_LowPriority=4,r.unstable_NormalPriority=3,r.unstable_Profiling=null,r.unstable_UserBlockingPriority=2,r.unstable_cancelCallback=function(q){q.callback=null},r.unstable_continueExecution=function(){S||k||(S=!0,se(N))},r.unstable_forceFrameRate=function(q){0>q||125<q?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):Q=0<q?Math.floor(1e3/q):5},r.unstable_getCurrentPriorityLevel=function(){return w},r.unstable_getFirstCallbackNode=function(){return s(x)},r.unstable_next=function(q){switch(w){case 1:case 2:case 3:var Ae=3;break;default:Ae=w}var ne=w;w=Ae;try{return q()}finally{w=ne}},r.unstable_pauseExecution=function(){},r.unstable_requestPaint=function(){},r.unstable_runWithPriority=function(q,Ae){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var ne=w;w=q;try{return Ae()}finally{w=ne}},r.unstable_scheduleCallback=function(q,Ae,ne){var P=r.unstable_now();switch(typeof ne=="object"&&ne!==null?(ne=ne.delay,ne=typeof ne=="number"&&0<ne?P+ne:P):ne=P,q){case 1:var Z=-1;break;case 2:Z=250;break;case 5:Z=1073741823;break;case 4:Z=1e4;break;default:Z=5e3}return Z=ne+Z,q={id:y++,callback:Ae,priorityLevel:q,startTime:ne,expirationTime:Z,sortIndex:-1},ne>P?(q.sortIndex=ne,a(p,q),s(x)===null&&q===s(p)&&(E?(D(j),j=-1):E=!0,he(I,ne-P))):(q.sortIndex=Z,a(x,q),S||k||(S=!0,se(N))),q},r.unstable_shouldYield=V,r.unstable_wrapCallback=function(q){var Ae=w;return function(){var ne=w;w=Ae;try{return q.apply(this,arguments)}finally{w=ne}}}})(bf)),bf}var Ap;function yv(){return Ap||(Ap=1,Cf.exports=vv()),Cf.exports}/**
|
||||
* @license React
|
||||
* react-dom.production.min.js
|
||||
*
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/var gp;function _v(){if(gp)return Vn;gp=1;var r=r0(),a=yv();function s(e){for(var n="https://reactjs.org/docs/error-decoder.html?invariant="+e,o=1;o<arguments.length;o++)n+="&args[]="+encodeURIComponent(arguments[o]);return"Minified React error #"+e+"; visit "+n+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var l=new Set,d={};function f(e,n){m(e,n),m(e+"Capture",n)}function m(e,n){for(d[e]=n,e=0;e<n.length;e++)l.add(n[e])}var h=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),x=Object.prototype.hasOwnProperty,p=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,y={},v={};function w(e){return x.call(v,e)?!0:x.call(y,e)?!1:p.test(e)?v[e]=!0:(y[e]=!0,!1)}function k(e,n,o,c){if(o!==null&&o.type===0)return!1;switch(typeof n){case"function":case"symbol":return!0;case"boolean":return c?!1:o!==null?!o.acceptsBooleans:(e=e.toLowerCase().slice(0,5),e!=="data-"&&e!=="aria-");default:return!1}}function S(e,n,o,c){if(n===null||typeof n>"u"||k(e,n,o,c))return!0;if(c)return!1;if(o!==null)switch(o.type){case 3:return!n;case 4:return n===!1;case 5:return isNaN(n);case 6:return isNaN(n)||1>n}return!1}function E(e,n,o,c,g,_,M){this.acceptsBooleans=n===2||n===3||n===4,this.attributeName=c,this.attributeNamespace=g,this.mustUseProperty=o,this.propertyName=e,this.type=n,this.sanitizeURL=_,this.removeEmptyString=M}var b={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(e){b[e]=new E(e,0,!1,e,null,!1,!1)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(e){var n=e[0];b[n]=new E(n,1,!1,e[1],null,!1,!1)}),["contentEditable","draggable","spellCheck","value"].forEach(function(e){b[e]=new E(e,2,!1,e.toLowerCase(),null,!1,!1)}),["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(e){b[e]=new E(e,2,!1,e,null,!1,!1)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(e){b[e]=new E(e,3,!1,e.toLowerCase(),null,!1,!1)}),["checked","multiple","muted","selected"].forEach(function(e){b[e]=new E(e,3,!0,e,null,!1,!1)}),["capture","download"].forEach(function(e){b[e]=new E(e,4,!1,e,null,!1,!1)}),["cols","rows","size","span"].forEach(function(e){b[e]=new E(e,6,!1,e,null,!1,!1)}),["rowSpan","start"].forEach(function(e){b[e]=new E(e,5,!1,e.toLowerCase(),null,!1,!1)});var D=/[\-:]([a-z])/g;function T(e){return e[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(e){var n=e.replace(D,T);b[n]=new E(n,1,!1,e,null,!1,!1)}),"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(e){var n=e.replace(D,T);b[n]=new E(n,1,!1,e,"http://www.w3.org/1999/xlink",!1,!1)}),["xml:base","xml:lang","xml:space"].forEach(function(e){var n=e.replace(D,T);b[n]=new E(n,1,!1,e,"http://www.w3.org/XML/1998/namespace",!1,!1)}),["tabIndex","crossOrigin"].forEach(function(e){b[e]=new E(e,1,!1,e.toLowerCase(),null,!1,!1)}),b.xlinkHref=new E("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1),["src","href","action","formAction"].forEach(function(e){b[e]=new E(e,1,!1,e.toLowerCase(),null,!0,!0)});function B(e,n,o,c){var g=b.hasOwnProperty(n)?b[n]:null;(g!==null?g.type!==0:c||!(2<n.length)||n[0]!=="o"&&n[0]!=="O"||n[1]!=="n"&&n[1]!=
Line truncated
|
||||
`+P+e}var K=!1;function Y(e,n){if(!e||K)return"";K=!0;var o=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(n)if(n=function(){throw Error()},Object.defineProperty(n.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(n,[])}catch(ue){var c=ue}Reflect.construct(e,[],n)}else{try{n.call()}catch(ue){c=ue}e.call(n.prototype)}else{try{throw Error()}catch(ue){c=ue}e()}}catch(ue){if(ue&&c&&typeof ue.stack=="string"){for(var g=ue.stack.split(`
|
||||
`),_=c.stack.split(`
|
||||
`),M=g.length-1,W=_.length-1;1<=M&&0<=W&&g[M]!==_[W];)W--;for(;1<=M&&0<=W;M--,W--)if(g[M]!==_[W]){if(M!==1||W!==1)do if(M--,W--,0>W||g[M]!==_[W]){var $=`
|
||||
`+g[M].replace(" at new "," at ");return e.displayName&&$.includes("<anonymous>")&&($=$.replace("<anonymous>",e.displayName)),$}while(1<=M&&0<=W);break}}}finally{K=!1,Error.prepareStackTrace=o}return(e=e?e.displayName||e.name:"")?Z(e):""}function fe(e){switch(e.tag){case 5:return Z(e.type);case 16:return Z("Lazy");case 13:return Z("Suspense");case 19:return Z("SuspenseList");case 0:case 2:case 15:return e=Y(e.type,!1),e;case 11:return e=Y(e.type.render,!1),e;case 1:return e=Y(e.type,!0),e;default:return""}}function me(e){if(e==null)return null;if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case H:return"Fragment";case z:return"Portal";case Q:return"Profiler";case j:return"StrictMode";case X:return"Suspense";case oe:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case V:return(e.displayName||"Context")+".Consumer";case U:return(e._context.displayName||"Context")+".Provider";case J:var n=e.render;return e=e.displayName,e||(e=n.displayName||n.name||"",e=e!==""?"ForwardRef("+e+")":"ForwardRef"),e;case pe:return n=e.displayName||null,n!==null?n:me(e.type)||"Memo";case se:n=e._payload,e=e._init;try{return me(e(n))}catch{}}return null}function Ee(e){var n=e.type;switch(e.tag){case 24:return"Cache";case 9:return(n.displayName||"Context")+".Consumer";case 10:return(n._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return e=n.render,e=e.displayName||e.name||"",n.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case 7:return"Fragment";case 5:return n;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return me(n);case 8:return n===j?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof n=="function")return n.displayName||n.name||null;if(typeof n=="string")return n}return null}function ge(e){switch(typeof e){case"boolean":case"number":case"string":case"undefined":return e;case"object":return e;default:return""}}function je(e){var n=e.type;return(e=e.nodeName)&&e.toLowerCase()==="input"&&(n==="checkbox"||n==="radio")}function Ge(e){var n=je(e)?"checked":"value",o=Object.getOwnPropertyDescriptor(e.constructor.prototype,n),c=""+e[n];if(!e.hasOwnProperty(n)&&typeof o<"u"&&typeof o.get=="function"&&typeof o.set=="function"){var g=o.get,_=o.set;return Object.defineProperty(e,n,{configurable:!0,get:function(){return g.call(this)},set:function(M){c=""+M,_.call(this,M)}}),Object.defineProperty(e,n,{enumerable:o.enumerable}),{getValue:function(){return c},setValue:function(M){c=""+M},stopTracking:function(){e._valueTracker=null,delete e[n]}}}}function wt(e){e._valueTracker||(e._valueTracker=Ge(e))}function xt(e){if(!e)return!1;var n=e._valueTracker;if(!n)return!0;var o=n.getValue(),c="";return e&&(c=je(e)?e.checked?"true":"false":e.value),e=c,e!==o?(n.setValue(e),!0):!1}function ke(e){if(e=e||(typeof document<"u"?document:void 0),typeof e>"u")return null;try{return e.activeElement||e.body}catch{return e.body}}function Ze(e,n){var o=n.checked;return ne({},n,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:o??e._wrapperState.initialChecked})}function Xe(e,n){var o=n.defaultValue==null?"":n.defaultValue,c=n.checked!=null?n.checked:n.defaultChecked;o=ge(n.value!=null?n.value:o),e._wrapperState={initialChecked:c,initialValue:o,controlled:n.type==="checkbox"||n.type==="radio"?n.checked!=null:n.value!=null}}function Bt(e,n){n=n.checked,n!=null&&B(e,"checked",n,!1)}function ct(e,n){Bt(e,n);var o=ge(n.value),c=n.type;if(o!=null)c==="number"?(o===0&&e.value===""||e.value!=o)&&(e.value=""+o):e.value!==""+o&&(e.value=""+o);else if(c==="submit"||c==="reset"){e.removeAttribute("value");return}n.hasOwnProperty("value")?Qe(e,n.type,o):n.hasOwnProperty("defaultValue")&&Qe(e,n.type,ge(n.defaultValue)),n.checked==null&&n.defaultChecked!=null&&(e.defaultChecked=!!n.defaultChecked)}function vt(e,n,o){if(n.hasOwnProperty("value")||n.hasOwnProperty("defaultValue")){var c=n.type;if(!(c!=="submit"&&c!=="reset"||n.value!==void 0&&n.value!==null))return;n=""+e._wrapperState.initialValue,o||n===e.value||(e.value=n),e.defaultValue=n}o=e.name,o!==""&&(e.name=""),e.defaultChecked=!!e._wrapperState.initialChecked,o!==""&&(e.name=o)}function Qe(e,n,o){(n!=="number"||ke(e.ownerDocument)!==e)&&(o==null?e.defaultValue=""+e._wrapperState.initialValue:e.defaultValue!==""+o&&(e.defaultValue=""+o))}var rt=Array.isArray;function et(e,n,o,c){if(e=e.options,n){n={};for(var g=0;g<o.length;g++)n["$"+o[g]]=!0;for(o=0;o<e.length;o++)g=n.hasOwnProperty("$"+e[o].value),e[o].selected!==g&&(e[o].selected=g),g&&c&&(e[o].defaultSelected=!0)}else{for(o=""+ge(o),n=null,g=0;g<e.length;g++){if(e[g].value===o){e[g].selected=!0,c&&(e[g].defaultSelected=!0);return}n!==null||e[g].disabled||(n=e[g])}n!==null&&(n.selected=!0)}}function Ie(e,n){if(n.dangerouslySetInnerHTM
Line truncated
|
||||
`).replace(G,"")}function le(e,n,o){if(n=re(n),re(e)!==n&&o)throw Error(s(425))}function xe(){}var Se=null,ze=null;function Je(e,n){return e==="textarea"||e==="noscript"||typeof n.children=="string"||typeof n.children=="number"||typeof n.dangerouslySetInnerHTML=="object"&&n.dangerouslySetInnerHTML!==null&&n.dangerouslySetInnerHTML.__html!=null}var nn=typeof setTimeout=="function"?setTimeout:void 0,Xt=typeof clearTimeout=="function"?clearTimeout:void 0,Tn=typeof Promise=="function"?Promise:void 0,_n=typeof queueMicrotask=="function"?queueMicrotask:typeof Tn<"u"?function(e){return Tn.resolve(null).then(e).catch(Hi)}:nn;function Hi(e){setTimeout(function(){throw e})}function _a(e,n){var o=n,c=0;do{var g=o.nextSibling;if(e.removeChild(o),g&&g.nodeType===8)if(o=g.data,o==="/$"){if(c===0){e.removeChild(g),Kn(n);return}c--}else o!=="$"&&o!=="$?"&&o!=="$!"||c++;o=g}while(o);Kn(n)}function Hr(e){for(;e!=null;e=e.nextSibling){var n=e.nodeType;if(n===1||n===3)break;if(n===8){if(n=e.data,n==="$"||n==="$!"||n==="$?")break;if(n==="/$")return null}}return e}function Il(e){e=e.previousSibling;for(var n=0;e;){if(e.nodeType===8){var o=e.data;if(o==="$"||o==="$!"||o==="$?"){if(n===0)return e;n--}else o==="/$"&&n++}e=e.previousSibling}return null}var si=Math.random().toString(36).slice(2),cr="__reactFiber$"+si,Vi="__reactProps$"+si,_t="__reactContainer$"+si,Ui="__reactEvents$"+si,hd="__reactListeners$"+si,pd="__reactHandles$"+si;function ai(e){var n=e[cr];if(n)return n;for(var o=e.parentNode;o;){if(n=o[_t]||o[cr]){if(o=n.alternate,n.child!==null||o!==null&&o.child!==null)for(e=Il(e);e!==null;){if(o=e[cr])return o;e=Il(e)}return n}e=o,o=e.parentNode}return null}function li(e){return e=e[cr]||e[_t],!e||e.tag!==5&&e.tag!==6&&e.tag!==13&&e.tag!==3?null:e}function ui(e){if(e.tag===5||e.tag===6)return e.stateNode;throw Error(s(33))}function xs(e){return e[Vi]||null}var md=[],vs=-1;function Zi(e){return{current:e}}function Ft(e){0>vs||(e.current=md[vs],md[vs]=null,vs--)}function Dt(e,n){vs++,md[vs]=e.current,e.current=n}var Wi={},wn=Zi(Wi),In=Zi(!1),wo=Wi;function ys(e,n){var o=e.type.contextTypes;if(!o)return Wi;var c=e.stateNode;if(c&&c.__reactInternalMemoizedUnmaskedChildContext===n)return c.__reactInternalMemoizedMaskedChildContext;var g={},_;for(_ in o)g[_]=n[_];return c&&(e=e.stateNode,e.__reactInternalMemoizedUnmaskedChildContext=n,e.__reactInternalMemoizedMaskedChildContext=g),g}function On(e){return e=e.childContextTypes,e!=null}function Ol(){Ft(In),Ft(wn)}function F0(e,n,o){if(wn.current!==Wi)throw Error(s(168));Dt(wn,n),Dt(In,o)}function N0(e,n,o){var c=e.stateNode;if(n=n.childContextTypes,typeof c.getChildContext!="function")return o;c=c.getChildContext();for(var g in c)if(!(g in n))throw Error(s(108,Ee(e)||"Unknown",g));return ne({},o,c)}function zl(e){return e=(e=e.stateNode)&&e.__reactInternalMemoizedMergedChildContext||Wi,wo=wn.current,Dt(wn,e),Dt(In,In.current),!0}function L0(e,n,o){var c=e.stateNode;if(!c)throw Error(s(169));o?(e=N0(e,n,wo),c.__reactInternalMemoizedMergedChildContext=e,Ft(In),Ft(wn),Dt(wn,e)):Ft(In),Dt(In,o)}var ci=null,jl=!1,Ad=!1;function M0(e){ci===null?ci=[e]:ci.push(e)}function Rx(e){jl=!0,M0(e)}function qi(){if(!Ad&&ci!==null){Ad=!0;var e=0,n=ft;try{var o=ci;for(ft=1;e<o.length;e++){var c=o[e];do c=c(!0);while(c!==null)}ci=null,jl=!1}catch(g){throw ci!==null&&(ci=ci.slice(e+1)),hl($s,qi),g}finally{ft=n,Ad=!1}}return null}var _s=[],ws=0,Hl=null,Vl=0,dr=[],fr=0,Co=null,di=1,fi="";function bo(e,n){_s[ws++]=Vl,_s[ws++]=Hl,Hl=e,Vl=n}function I0(e,n,o){dr[fr++]=di,dr[fr++]=fi,dr[fr++]=Co,Co=e;var c=di;e=fi;var g=32-Ye(c)-1;c&=~(1<<g),o+=1;var _=32-Ye(n)+g;if(30<_){var M=g-g%5;_=(c&(1<<M)-1).toString(32),c>>=M,g-=M,di=1<<32-Ye(n)+g|o<<g|c,fi=_+e}else di=1<<_|o<<g|c,fi=e}function gd(e){e.return!==null&&(bo(e,1),I0(e,1,0))}function xd(e){for(;e===Hl;)Hl=_s[--ws],_s[ws]=null,Vl=_s[--ws],_s[ws]=null;for(;e===Co;)Co=dr[--fr],dr[fr]=null,fi=dr[--fr],dr[fr]=null,di=dr[--fr],dr[fr]=null}var er=null,tr=null,Mt=!1,Er=null;function O0(e,n){var o=Ar(5,null,null,0);o.elementType="DELETED",o.stateNode=n,o.return=e,n=e.deletions,n===null?(e.deletions=[o],e.flags|=16):n.push(o)}function z0(e,n){switch(e.tag){case 5:var o=e.type;return n=n.nodeType!==1||o.toLowerCase()!==n.nodeName.toLowerCase()?null:n,n!==null?(e.stateNode=n,er=e,tr=Hr(n.firstChild),!0):!1;case 6:return n=e.pendingProps===""||n.nodeType!==3?null:n,n!==null?(e.stateNode=n,er=e,tr=null,!0):!1;case 13:return n=n.nodeType!==8?null:n,n!==null?(o=Co!==null?{id:di,overflow:fi}:null,e.memoizedState={dehydrated:n,treeContext:o,retryLane:1073741824},o=Ar(18,null,null,0),o.stateNode=n,o.return=e,e.child=o,er=e,tr=null,!0):!1;default:return!1}}function vd(e){return(e.mode&1)!==0&&(e.flags&128)===0}function yd(e){if(Mt){var n=tr;if(n){var o=n;if(!z0(e,n)){if(vd(e))throw Error(s(418));n=Hr(o.nextSibling);var c=er;n&&z0(e,n)?O0(c,o):(e.flags=e.flags&-4097|2,Mt=!1,er=e)}}else{if(vd(e))throw Error(s(418));e.flags=e.flags&-4097|2,Mt=!1,er=e}}}function j0(e){for(e=e.
Line truncated
|
||||
Error generating stack: `+_.message+`
|
||||
`+_.stack}return{value:e,source:n,stack:g,digest:null}}function Vd(e,n,o){return{value:e,source:null,stack:o??null,digest:n??null}}function Ud(e,n){try{console.error(n.value)}catch(o){setTimeout(function(){throw o})}}var Hx=typeof WeakMap=="function"?WeakMap:Map;function yh(e,n,o){o=pi(-1,o),o.tag=3,o.payload={element:null};var c=n.value;return o.callback=function(){lu||(lu=!0,of=c),Ud(e,n)},o}function _h(e,n,o){o=pi(-1,o),o.tag=3;var c=e.type.getDerivedStateFromError;if(typeof c=="function"){var g=n.value;o.payload=function(){return c(g)},o.callback=function(){Ud(e,n)}}var _=e.stateNode;return _!==null&&typeof _.componentDidCatch=="function"&&(o.callback=function(){Ud(e,n),typeof c!="function"&&($i===null?$i=new Set([this]):$i.add(this));var M=n.stack;this.componentDidCatch(n.value,{componentStack:M!==null?M:""})}),o}function wh(e,n,o){var c=e.pingCache;if(c===null){c=e.pingCache=new Hx;var g=new Set;c.set(n,g)}else g=c.get(n),g===void 0&&(g=new Set,c.set(n,g));g.has(o)||(g.add(o),e=tv.bind(null,e,n,o),n.then(e,e))}function Ch(e){do{var n;if((n=e.tag===13)&&(n=e.memoizedState,n=n!==null?n.dehydrated!==null:!0),n)return e;e=e.return}while(e!==null);return null}function bh(e,n,o,c,g){return(e.mode&1)===0?(e===n?e.flags|=65536:(e.flags|=128,o.flags|=131072,o.flags&=-52805,o.tag===1&&(o.alternate===null?o.tag=17:(n=pi(-1,1),n.tag=2,Qi(o,n,1))),o.lanes|=1),e):(e.flags|=65536,e.lanes=g,e)}var Vx=I.ReactCurrentOwner,zn=!1;function Dn(e,n,o,c){n.child=e===null?Z0(n,null,o,c):bs(n,e.child,o,c)}function Eh(e,n,o,c,g){o=o.render;var _=n.ref;return ks(n,g),c=Nd(e,n,o,c,_,g),o=Ld(),e!==null&&!zn?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~g,mi(e,n,g)):(Mt&&o&&gd(n),n.flags|=1,Dn(e,n,c,g),n.child)}function kh(e,n,o,c,g){if(e===null){var _=o.type;return typeof _=="function"&&!ff(_)&&_.defaultProps===void 0&&o.compare===null&&o.defaultProps===void 0?(n.tag=15,n.type=_,Sh(e,n,_,c,g)):(e=pu(o.type,null,c,n,n.mode,g),e.ref=n.ref,e.return=n,n.child=e)}if(_=e.child,(e.lanes&g)===0){var M=_.memoizedProps;if(o=o.compare,o=o!==null?o:Or,o(M,c)&&e.ref===n.ref)return mi(e,n,g)}return n.flags|=1,e=eo(_,c),e.ref=n.ref,e.return=n,n.child=e}function Sh(e,n,o,c,g){if(e!==null){var _=e.memoizedProps;if(Or(_,c)&&e.ref===n.ref)if(zn=!1,n.pendingProps=c=_,(e.lanes&g)!==0)(e.flags&131072)!==0&&(zn=!0);else return n.lanes=e.lanes,mi(e,n,g)}return Zd(e,n,o,c,g)}function Bh(e,n,o){var c=n.pendingProps,g=c.children,_=e!==null?e.memoizedState:null;if(c.mode==="hidden")if((n.mode&1)===0)n.memoizedState={baseLanes:0,cachePool:null,transitions:null},Dt(Ts,nr),nr|=o;else{if((o&1073741824)===0)return e=_!==null?_.baseLanes|o:o,n.lanes=n.childLanes=1073741824,n.memoizedState={baseLanes:e,cachePool:null,transitions:null},n.updateQueue=null,Dt(Ts,nr),nr|=e,null;n.memoizedState={baseLanes:0,cachePool:null,transitions:null},c=_!==null?_.baseLanes:o,Dt(Ts,nr),nr|=c}else _!==null?(c=_.baseLanes|o,n.memoizedState=null):c=o,Dt(Ts,nr),nr|=c;return Dn(e,n,g,o),n.child}function Ph(e,n){var o=n.ref;(e===null&&o!==null||e!==null&&e.ref!==o)&&(n.flags|=512,n.flags|=2097152)}function Zd(e,n,o,c,g){var _=On(o)?wo:wn.current;return _=ys(n,_),ks(n,g),o=Nd(e,n,o,c,_,g),c=Ld(),e!==null&&!zn?(n.updateQueue=e.updateQueue,n.flags&=-2053,e.lanes&=~g,mi(e,n,g)):(Mt&&c&&gd(n),n.flags|=1,Dn(e,n,o,g),n.child)}function Th(e,n,o,c,g){if(On(o)){var _=!0;zl(n)}else _=!1;if(ks(n,g),n.stateNode===null)ru(e,n),xh(n,o,c),Hd(n,o,c,g),c=!0;else if(e===null){var M=n.stateNode,W=n.memoizedProps;M.props=W;var $=M.context,ue=o.contextType;typeof ue=="object"&&ue!==null?ue=hr(ue):(ue=On(o)?wo:wn.current,ue=ys(n,ue));var ye=o.getDerivedStateFromProps,_e=typeof ye=="function"||typeof M.getSnapshotBeforeUpdate=="function";_e||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(W!==c||$!==ue)&&vh(n,M,c,ue),Gi=!1;var ve=n.memoizedState;M.state=ve,Ql(n,c,M,g),$=n.memoizedState,W!==c||ve!==$||In.current||Gi?(typeof ye=="function"&&(jd(n,o,ye,c),$=n.memoizedState),(W=Gi||gh(n,o,W,c,ve,$,ue))?(_e||typeof M.UNSAFE_componentWillMount!="function"&&typeof M.componentWillMount!="function"||(typeof M.componentWillMount=="function"&&M.componentWillMount(),typeof M.UNSAFE_componentWillMount=="function"&&M.UNSAFE_componentWillMount()),typeof M.componentDidMount=="function"&&(n.flags|=4194308)):(typeof M.componentDidMount=="function"&&(n.flags|=4194308),n.memoizedProps=c,n.memoizedState=$),M.props=c,M.state=$,M.context=ue,c=W):(typeof M.componentDidMount=="function"&&(n.flags|=4194308),c=!1)}else{M=n.stateNode,q0(e,n),W=n.memoizedProps,ue=n.type===n.elementType?W:kr(n.type,W),M.props=ue,_e=n.pendingProps,ve=M.context,$=o.contextType,typeof $=="object"&&$!==null?$=hr($):($=On(o)?wo:wn.current,$=ys(n,$));var Pe=o.getDerivedStateFromProps;(ye=typeof Pe=="function"||typeof M.getSnapshotBeforeUpdate=="function")||typeof M.UNSAFE_componentWillReceiveProps!="function"&&typeof M.componentWillReceiveProps!="function"||(W!==_e||ve!==$)&&vh(n,M,c,$),Gi=!1,ve=n.m
Line truncated
|
||||
`)}function Sv(r){if(r.length===0)return`Neighbors
|
||||
No neighbors reported`;const a=[...r].sort((l,d)=>d.snr-l.snr),s=[`Neighbors (${a.length})`];for(const l of a){const d=l.name||l.pubkey_prefix,f=l.snr>=0?`+${l.snr.toFixed(1)}`:l.snr.toFixed(1);s.push(`${d}, ${f} dB [${Ru(l.last_heard_seconds)} ago]`)}return s.join(`
|
||||
`)}function Bv(r){if(r.length===0)return`ACL
|
||||
No ACL entries`;const a=[`ACL (${r.length})`];for(const s of r){const l=s.name||s.pubkey_prefix;a.push(`${l}: ${s.permission_name}`)}return a.join(`
|
||||
`)}function No(r,a,s,l=0){const d=Math.floor(Date.now()/1e3);return{id:-Date.now()-l,type:"PRIV",conversation_key:r,text:a,sender_timestamp:d,received_at:d,path_len:null,txt_type:0,signature:null,outgoing:s,acked:1}}function Pv(r,a,s){const[l,d]=F.useState(!1);F.useEffect(()=>{d(!1)},[r==null?void 0:r.id]);const f=F.useMemo(()=>{if(!r||r.type!=="contact")return!1;const x=a.find(p=>p.public_key===r.id);return(x==null?void 0:x.type)===o0},[r,a]),m=F.useCallback(async x=>{if(!(!r||r.type!=="contact")&&f)try{const p=await st.requestTelemetry(r.id,x),y=No(r.id,kv(p),!1,0),v=No(r.id,Sv(p.neighbors),!1,1),w=No(r.id,Bv(p.acl),!1,2);s(k=>[...k,y,v,w]),d(!0)}catch(p){const y=No(r.id,`Telemetry request failed: ${p instanceof Error?p.message:"Unknown error"}`,!1,0);s(v=>[...v,y])}},[r,f,s]),h=F.useCallback(async x=>{if(!r||r.type!=="contact"||!f||!l)return;const p=No(r.id,`> ${x}`,!0,0);s(y=>[...y,p]);try{const y=await st.sendRepeaterCommand(r.id,x),v=No(r.id,y.response,!1,1);y.sender_timestamp&&(v.sender_timestamp=y.sender_timestamp),s(w=>[...w,v])}catch(y){const v=No(r.id,`Command failed: ${y instanceof Error?y.message:"Unknown error"}`,!1,1);s(w=>[...w,v])}},[r,f,l,s]);return{repeaterLoggedIn:l,activeContactIsRepeater:f,handleTelemetryRequest:m,handleRepeaterCommand:h}}const Tv=12;function js(r){return r.slice(0,Tv)}function vA(r,a){return!r||!a?!1:js(r)===js(a)}function Vo(r,a){return r||js(a)}const Vf="remoteterm-lastMessageTime";function yA(r){try{const a=localStorage.getItem(r);return a?JSON.parse(a):{}}catch{return{}}}function Dv(r,a){try{localStorage.setItem(r,JSON.stringify(a))}catch{}}function yp(){return yA(Vf)}function Ef(r,a){const s=yA(Vf);return(!s[r]||a>s[r])&&(s[r]=a,Dv(Vf,s)),s}function Qr(r,a){return r==="channel"?`channel-${a}`:`contact-${js(a)}`}function Rv(r,a,s){const[l,d]=F.useState({}),[f,m]=F.useState(yp),h=F.useRef(new Set),x=F.useRef(new Set);F.useEffect(()=>{const k=r.filter(b=>!h.current.has(b.key)),S=a.filter(b=>b.public_key&&!x.current.has(b.public_key));if(k.length===0&&S.length===0)return;k.forEach(b=>h.current.add(b.key)),S.forEach(b=>x.current.add(b.public_key)),(async()=>{const b=[...k.map(D=>({type:"CHAN",conversation_key:D.key})),...S.map(D=>({type:"PRIV",conversation_key:D.public_key}))];if(b.length!==0)try{const D=await st.getMessagesBulk(b,100),T={},B={};for(const I of k){const N=D[`CHAN:${I.key}`]||[];if(N.length>0){const z=Qr("channel",I.key),H=I.last_read_at||0,j=N.filter(U=>!U.outgoing&&U.received_at>H).length;j>0&&(T[z]=j);const Q=Math.max(...N.map(U=>U.received_at));B[z]=Q,Ef(z,Q)}}for(const I of S){const N=D[`PRIV:${I.public_key}`]||[];if(N.length>0){const z=Qr("contact",I.public_key),H=I.last_read_at||0,j=N.filter(U=>!U.outgoing&&U.received_at>H).length;j>0&&(T[z]=j);const Q=Math.max(...N.map(U=>U.received_at));B[z]=Q,Ef(z,Q)}}Object.keys(T).length>0&&d(I=>({...I,...T})),m(yp())}catch(D){console.error("Failed to fetch messages bulk:",D)}})()},[r,a]),F.useEffect(()=>{if(s&&s.type!=="raw"){const k=Qr(s.type,s.id);d(S=>{if(S[k]){const E={...S};return delete E[k],E}return S}),s.type==="channel"?st.markChannelRead(s.id).catch(S=>{console.error("Failed to mark channel as read on server:",S)}):s.type==="contact"&&st.markContactRead(s.id).catch(S=>{console.error("Failed to mark contact as read on server:",S)})}},[s]);const p=F.useCallback(k=>{d(S=>({...S,[k]:(S[k]||0)+1}))},[]),y=F.useCallback(()=>{d({}),st.markAllRead().catch(k=>{console.error("Failed to mark all as read on server:",k)})},[]),v=F.useCallback(k=>{if(k.type==="raw")return;const S=Qr(k.type,k.id);d(E=>{if(E[S]){const b={...E};return delete b[S],b}return E}),k.type==="channel"?st.markChannelRead(k.id).catch(E=>{console.error("Failed to mark channel as read on server:",E)}):k.type==="contact"&&st.markContactRead(k.id).catch(E=>{console.error("Failed to mark contact as read on server:",E)})},[]),w=F.useCallback(k=>{let S=null;if(k.type==="CHAN"&&k.conversation_key?S=Qr("channel",k.conversation_key):k.type==="PRIV"&&k.conversation_key&&(S=Qr("contact",k.conversation_key)),S){const E=k.received_at||Math.floor(Date.now()/1e3),b=Ef(S,E);m(b)}},[]);return{unreadCounts:l,lastMessageTimes:f,incrementUnread:p,markAllRead:y,markConversationRead:v,trackNewMessage:w}}var s0=xA();const _A=Us(s0);function Fv(r){if(typeof document>"u")return;let a=document.head||document.getElementsByTagName("head")[0],s=document.createElement("style");s.type="text/css",a.appendChild(s),s.styleSheet?s.styleSheet.cssText=r:s.appendChild(document.createTextNode(r))}const Nv=r=>{switch(r){case"success":return Iv;case"info":return zv;case"warning":return Ov;case"error":return jv;default:return null}},Lv=Array(12).fill(0),Mv=({visible:r,className:a})=>we.createElement("div",{className:["sonner-loading-wrapper",a].filter(Boolean).join(" "),"data-visible":r},we.createElement("div",{className:"sonner-spinner"},Lv.map((s,l)=>we.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${l}`})))),Iv=we.createElement("svg",{xmlns:"http://www.w3
Line truncated
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const ly=r=>r.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),uy=r=>r.replace(/^([A-Z])|[\s-_]+(\w)/g,(a,s,l)=>l?l.toUpperCase():s.toLowerCase()),Cp=r=>{const a=uy(r);return a.charAt(0).toUpperCase()+a.slice(1)},wA=(...r)=>r.filter((a,s,l)=>!!a&&a.trim()!==""&&l.indexOf(a)===s).join(" ").trim(),cy=r=>{for(const a in r)if(a.startsWith("aria-")||a==="role"||a==="title")return!0};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/var dy={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const fy=F.forwardRef(({color:r="currentColor",size:a=24,strokeWidth:s=2,absoluteStrokeWidth:l,className:d="",children:f,iconNode:m,...h},x)=>F.createElement("svg",{ref:x,...dy,width:a,height:a,stroke:r,strokeWidth:l?Number(s)*24/Number(a):s,className:wA("lucide",d),...!f&&!cy(h)&&{"aria-hidden":"true"},...h},[...m.map(([p,y])=>F.createElement(p,y)),...Array.isArray(f)?f:[f]]));/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const a0=(r,a)=>{const s=F.forwardRef(({className:l,...d},f)=>F.createElement(fy,{ref:f,iconNode:a,className:wA(`lucide-${ly(Cp(r))}`,`lucide-${r}`,l),...d}));return s.displayName=Cp(r),s};/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const hy=[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]],py=a0("check",hy);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const my=[["path",{d:"M4 5h16",key:"1tepv9"}],["path",{d:"M4 12h16",key:"1lakjw"}],["path",{d:"M4 19h16",key:"1djgab"}]],Ay=a0("menu",my);/**
|
||||
* @license lucide-react v0.562.0 - ISC
|
||||
*
|
||||
* This source code is licensed under the ISC license.
|
||||
* See the LICENSE file in the root directory of this source tree.
|
||||
*/const gy=[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]],CA=a0("x",gy);function xy({health:r,config:a,onConfigClick:s,onMaintenanceClick:l,onAdvertise:d,onMenuClick:f}){const m=(r==null?void 0:r.radio_connected)??!1,[h,x]=F.useState(!1),p=async()=>{x(!0);try{const y=await st.reconnectRadio();y.connected&&It.success("Reconnected",{description:y.message})}catch(y){It.error("Reconnection failed",{description:y instanceof Error?y.message:"Check radio connection and power"})}finally{x(!1)}};return R.jsxs("div",{className:"flex items-center gap-4 px-4 py-2 bg-[#252525] border-b border-[#333] text-xs",children:[f&&R.jsx("button",{onClick:f,className:"md:hidden p-1 bg-transparent border-none text-[#e0e0e0] cursor-pointer","aria-label":"Open menu",children:R.jsx(Ay,{className:"h-5 w-5"})}),R.jsx("h1",{className:"hidden lg:block text-base font-semibold mr-auto",children:"RemoteTerm"}),R.jsxs("div",{className:"flex items-center gap-1 text-[#888]",children:[R.jsx("div",{className:`w-2 h-2 rounded-full ${m?"bg-[#4caf50]":"bg-[#666]"}`}),R.jsx("span",{className:"hidden lg:inline text-[#e0e0e0]",children:m?"Connected":"Disconnected"})]}),(r==null?void 0:r.serial_port)&&R.jsxs("div",{className:"hidden xl:flex items-center gap-1 text-[#888]",children:["Port: ",R.jsx("span",{className:"text-[#e0e0e0]",children:r.serial_port})]}),a&&R.jsxs(R.Fragment,{children:[R.jsx("div",{className:"hidden lg:flex items-center gap-1 text-[#888]",children:R.jsx("span",{className:"text-[#e0e0e0]",children:a.name||"Unnamed"})}),R.jsxs("div",{className:"hidden xl:flex items-center gap-1 text-[#888]",children:[a.radio.freq," MHz/SF",a.radio.sf,"/CR",a.radio.cr,"/",a.tx_power,"dBm"]})]}),R.jsx("div",{className:"flex-1 lg:hidden"}),!m&&R.jsx("button",{onClick:p,disabled:h,className:"px-3 py-1 bg-[#4a3000] border border-[#6b4500] text-[#ffa500] rounded text-xs cursor-pointer hover:bg-[#5a3a00] disabled:opacity-50 disabled:cursor-not-allowed",children:h?"Reconnecting...":"Reconnect"}),R.jsx("button",{onClick:d,disabled:!m,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444] disabled:bg-[#333] disabled:text-[#666] disabled:cursor-not-allowed",children:"Advertise"}),R.jsx("button",{onClick:l,className:"px-2 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444]",title:"Database Maintenance",children:R.jsx("span",{role:"img","aria-label":"Settings",children:"⚙️"})}),R.jsxs("button",{onClick:s,className:"px-3 py-1 bg-[#333] border border-[#444] text-[#e0e0e0] rounded text-xs cursor-pointer hover:bg-[#444]",children:[R.jsx("span",{role:"img","aria-label":"Radio",children:"📻"})," Config"]})]})}const Zf=2,vy={text:"🛜",background:"#444444",textColor:"#ffffff"};function yy(r){let a=0;for(let s=0;s<r.length;s++){const l=r.charCodeAt(s);a=(a<<5)-a+l,a=a&a}return Math.abs(a)}const _y=/[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]|[\u{1F600}-\u{1F64F}]|[\u{1F680}-\u{1F6FF}]|[\u{1F1E0}-\u{1F1FF}]/u;function wy(r,a){if(!r)return a.slice(0,2).toUpperCase();const s=r.match(_y);if(s)return s[0];const l=r.match(/[a-zA-Z]/g);if(!l||l.length===0)return a.slice(0,2).toUpperCase();const d=r.indexOf(" ");if(d!==-1){const f=l[0],m=r.slice(d+1).match(/[a-zA-Z]/);if(m)return(f+m[0]).toUpperCase()}return l[0].toUpperCase()}function Cy(r){const a=yy(r),s=a%360,l=50+(a>>8)%30,d=35+(a>>16)%20,f=`hsl(${s}, ${l}%, ${d}%)`,m=d<45?"#ffffff":"#000000";return{background:f,text:m}}function by(r,a,s){if(s===Zf)return vy;const l=wy(r,a),d=Cy(a);return{text:l,background:d.background,textColor:d.text}}function bA({name:r,publicKey:a,size:s=28,contactType:l}){const d=by(r,a,l);return R.jsx("div",{className:"flex items-center justify-center rounded-full font-semibold flex-shrink-0 select-none",style:{backgroundColor:d.background,color:d.textColor,width:s,height:s,fontSize:s*.45},children:d.text})}function EA(r){var a,s,l="";if(typeof r=="string"||typeof r=="number")l+=r;else if(typeof r=="object")if(Array.isArray(r)){var d=r.length;for(a=0;a<d;a++)r[a]&&(s=EA(r[a]))&&(l&&(l+=" "),l+=s)}else for(s in r)r[s]&&(l&&(l+=" "),l+=s);return l}function kA(){for(var r,a,s=0,l="",d=arguments.length;s<d;s++)(r=arguments[s])&&(a=EA(r))&&(l&&(l+=" "),l+=a);return l}const Ey=(r,a)=>{const s=new Array(r.length+a.length);for(let l=0;l<r.length;l++)s[l]=r[l];for(let l=0;l<a.length;l++)s[r.length+l]=a[l];return s},ky=(r,a)=>({classGroupId:r,validator:a}),SA=(r=new Map,a=null,s)=>({nextPart:r,validators:a,classGroupId:s}),wc="-",bp=[],Sy="arbitrary..",By=r=>{const a=Ty(r),{conflictingClassGroups:s,conflictingClassGroupModifiers:l}=r;return{getClassGroupId:m=>{if(m.startsWith("[")&&m.endsWith("]"))return Py(m);const h=m.split(wc),x=h[0]===""&&h.length>1?1:0;return BA(h,x,a)},getConflictingClassGroupIds:(m,h)=>{if(h){const x=l[m],p=s[m];return x?p?Ey(p,x):x:p||bp}return s[m]||bp}}},BA=(r,a,s)=>{if(r.length-a===0)return s.classGroupId;const d=r[a],f=s.Line truncated
|
||||
`).map((P,Z,K)=>R.jsxs("span",{children:[E_(P,h),Z<K.length-1&&R.jsx("br",{})]},Z)),!se&&R.jsx("span",{className:"text-[10px] text-muted-foreground/50 ml-2",children:bc(N.sender_timestamp||N.received_at)}),N.outgoing&&(N.acked>0?` ✓${N.acked>1?N.acked:""}`:" ?")]})]})]},N.id)})]}),v&&R.jsx("button",{onClick:E,className:"absolute bottom-4 right-4 w-10 h-10 rounded-full bg-muted hover:bg-accent border border-border flex items-center justify-center shadow-lg transition-opacity",title:"Scroll to bottom",children:R.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"text-muted-foreground",children:R.jsx("polyline",{points:"6 9 12 15 18 9"})})})]})}const Fp=156,S_=140,B_=156,P_=120,T_=8,D_=F.forwardRef(function({onSend:a,disabled:s,placeholder:l,isRepeaterMode:d,conversationType:f,senderName:m},h){const[x,p]=F.useState(""),[y,v]=F.useState(!1),w=F.useRef(null);F.useImperativeHandle(h,()=>({appendText:N=>{var z;p(H=>H+N),(z=w.current)==null||z.focus()}}));const k=F.useMemo(()=>{if(f==="contact")return{warningAt:S_,dangerAt:Fp,hardLimit:Fp};if(f==="channel"){const N=(m==null?void 0:m.length)??10,z=Math.max(1,B_-N-2);return{warningAt:P_,dangerAt:Math.max(1,z-T_),hardLimit:z}}return null},[f,m]),{limitState:S,warningMessage:E}=F.useMemo(()=>{if(!k)return{limitState:"normal",warningMessage:null};const N=x.length;return N>=k.hardLimit?{limitState:"error",warningMessage:"likely truncated by radio"}:N>=k.dangerAt?{limitState:"danger",warningMessage:"may impact multi-repeater hop delivery"}:N>=k.warningAt?{limitState:"warning",warningMessage:"may impact multi-repeater hop delivery"}:{limitState:"normal",warningMessage:null}},[x.length,k]),b=k?k.hardLimit-x.length:0,D=F.useCallback(async N=>{N.preventDefault();const z=x.trim();if(d){if(y||s)return;const H=z==="."?"":z;v(!0);try{await a(H),p("")}catch(j){console.error("Failed to request telemetry:",j),It.error("Failed to request telemetry",{description:j instanceof Error?j.message:"Check radio connection"});return}finally{v(!1)}setTimeout(()=>{var j;return(j=w.current)==null?void 0:j.focus()},0)}else{if(!z||y||s)return;v(!0);try{await a(z),p("")}catch(H){console.error("Failed to send message:",H),It.error("Failed to send message",{description:H instanceof Error?H.message:"Check radio connection"});return}finally{v(!1)}setTimeout(()=>{var H;return(H=w.current)==null?void 0:H.focus()},0)}},[x,y,s,a,d]),T=F.useCallback(N=>{N.key==="Enter"&&!N.shiftKey&&(N.preventDefault(),D(N))},[D]),B=d?x.trim().length>0||x===".":x.trim().length>0,I=!d&&k!==null;return R.jsxs("form",{className:"px-4 py-3 border-t border-border flex flex-col gap-1",onSubmit:D,children:[R.jsxs("div",{className:"flex gap-2",children:[R.jsx($t,{ref:w,type:d?"password":"text",value:x,onChange:N=>p(N.target.value),onKeyDown:T,placeholder:l||(d?"Enter password (or . for none)...":"Type a message..."),disabled:s||y,className:"flex-1 min-w-0"}),R.jsx(gr,{type:"submit",disabled:s||y||!B,className:"flex-shrink-0",children:y?d?"Fetching...":"Sending...":d?"Fetch":"Send"})]}),I&&R.jsxs("div",{className:"flex items-center justify-end gap-2 text-xs",children:[R.jsxs("span",{className:dt("tabular-nums",S==="error"||S==="danger"?"text-red-500 font-medium":S==="warning"?"text-yellow-500":"text-muted-foreground"),children:[x.length,"/",k.hardLimit,b<0&&` (${b})`]}),E&&R.jsxs("span",{className:dt(S==="error"?"text-red-500":"text-yellow-500"),children:["— ",E]})]})]})});function an(r,a,{checkForDefaultPrevented:s=!0}={}){return function(d){if(r==null||r(d),s===!1||!d.defaultPrevented)return a==null?void 0:a(d)}}function R_(r,a){const s=F.createContext(a),l=f=>{const{children:m,...h}=f,x=F.useMemo(()=>h,Object.values(h));return R.jsx(s.Provider,{value:x,children:m})};l.displayName=r+"Provider";function d(f){const m=F.useContext(s);if(m)return m;if(a!==void 0)return a;throw new Error(`\`${f}\` must be used within \`${r}\``)}return[l,d]}function sl(r,a=[]){let s=[];function l(f,m){const h=F.createContext(m),x=s.length;s=[...s,m];const p=v=>{var D;const{scope:w,children:k,...S}=v,E=((D=w==null?void 0:w[r])==null?void 0:D[x])||h,b=F.useMemo(()=>S,Object.values(S));return R.jsx(E.Provider,{value:b,children:k})};p.displayName=f+"Provider";function y(v,w){var E;const k=((E=w==null?void 0:w[r])==null?void 0:E[x])||h,S=F.useContext(k);if(S)return S;if(m!==void 0)return m;throw new Error(`\`${v}\` must be used within \`${f}\``)}return[p,y]}const d=()=>{const f=s.map(m=>F.createContext(m));return function(h){const x=(h==null?void 0:h[r])||f;return F.useMemo(()=>({[`__scope${r}`]:{...h,[r]:x}}),[h,x])}};return d.scopeName=r,[l,F_(d,...a)]}function F_(...r){const a=r[0];if(r.length===1)return a;const s=()=>{const l=r.map(d=>({useScope:d(),scopeName:d.scopeName}));return function(f){const m=l.reduce((h,{useScope:x,scopeName:p})=>{const v=x(f)[`__scope${p}`];return{...h,...v}},{});return F.useMemo(()Line truncated
|
||||
.`.concat(p1,` {
|
||||
overflow: hidden `).concat(l,`;
|
||||
padding-right: `).concat(h,"px ").concat(l,`;
|
||||
}
|
||||
body[`).concat(Os,`] {
|
||||
overflow: hidden `).concat(l,`;
|
||||
overscroll-behavior: contain;
|
||||
`).concat([a&&"position: relative ".concat(l,";"),s==="margin"&&`
|
||||
padding-left: `.concat(d,`px;
|
||||
padding-top: `).concat(f,`px;
|
||||
padding-right: `).concat(m,`px;
|
||||
margin-left:0;
|
||||
margin-top:0;
|
||||
margin-right: `).concat(h,"px ").concat(l,`;
|
||||
`),s==="padding"&&"padding-right: ".concat(h,"px ").concat(l,";")].filter(Boolean).join(""),`
|
||||
}
|
||||
|
||||
.`).concat(Fu,` {
|
||||
right: `).concat(h,"px ").concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(Nu,` {
|
||||
margin-right: `).concat(h,"px ").concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(Fu," .").concat(Fu,` {
|
||||
right: 0 `).concat(l,`;
|
||||
}
|
||||
|
||||
.`).concat(Nu," .").concat(Nu,` {
|
||||
margin-right: 0 `).concat(l,`;
|
||||
}
|
||||
|
||||
body[`).concat(Os,`] {
|
||||
`).concat(m1,": ").concat(h,`px;
|
||||
}
|
||||
`)},Vp=function(){var r=parseInt(document.body.getAttribute(Os)||"0",10);return isFinite(r)?r:0},N1=function(){F.useEffect(function(){return document.body.setAttribute(Os,(Vp()+1).toString()),function(){var r=Vp()-1;r<=0?document.body.removeAttribute(Os):document.body.setAttribute(Os,r.toString())}},[])},L1=function(r){var a=r.noRelative,s=r.noImportant,l=r.gapMode,d=l===void 0?"margin":l;N1();var f=F.useMemo(function(){return D1(d)},[d]);return F.createElement(R1,{styles:F1(f,!a,d,s?"":"!important")})},Gf=!1;if(typeof window<"u")try{var Bu=Object.defineProperty({},"passive",{get:function(){return Gf=!0,!0}});window.addEventListener("test",Bu,Bu),window.removeEventListener("test",Bu,Bu)}catch{Gf=!1}var Ns=Gf?{passive:!1}:!1,M1=function(r){return r.tagName==="TEXTAREA"},$A=function(r,a){if(!(r instanceof Element))return!1;var s=window.getComputedStyle(r);return s[a]!=="hidden"&&!(s.overflowY===s.overflowX&&!M1(r)&&s[a]==="visible")},I1=function(r){return $A(r,"overflowY")},O1=function(r){return $A(r,"overflowX")},Up=function(r,a){var s=a.ownerDocument,l=a;do{typeof ShadowRoot<"u"&&l instanceof ShadowRoot&&(l=l.host);var d=YA(r,l);if(d){var f=XA(r,l),m=f[1],h=f[2];if(m>h)return!0}l=l.parentNode}while(l&&l!==s.body);return!1},z1=function(r){var a=r.scrollTop,s=r.scrollHeight,l=r.clientHeight;return[a,s,l]},j1=function(r){var a=r.scrollLeft,s=r.scrollWidth,l=r.clientWidth;return[a,s,l]},YA=function(r,a){return r==="v"?I1(a):O1(a)},XA=function(r,a){return r==="v"?z1(a):j1(a)},H1=function(r,a){return r==="h"&&a==="rtl"?-1:1},V1=function(r,a,s,l,d){var f=H1(r,window.getComputedStyle(a).direction),m=f*l,h=s.target,x=a.contains(h),p=!1,y=m>0,v=0,w=0;do{if(!h)break;var k=XA(r,h),S=k[0],E=k[1],b=k[2],D=E-b-f*S;(S||D)&&YA(r,h)&&(v+=D,w+=S);var T=h.parentNode;h=T&&T.nodeType===Node.DOCUMENT_FRAGMENT_NODE?T.host:T}while(!x&&h!==document.body||x&&(a.contains(h)||a===h));return(y&&Math.abs(v)<1||!y&&Math.abs(w)<1)&&(p=!0),p},Pu=function(r){return"changedTouches"in r?[r.changedTouches[0].clientX,r.changedTouches[0].clientY]:[0,0]},Zp=function(r){return[r.deltaX,r.deltaY]},Wp=function(r){return r&&"current"in r?r.current:r},U1=function(r,a){return r[0]===a[0]&&r[1]===a[1]},Z1=function(r){return`
|
||||
.block-interactivity-`.concat(r,` {pointer-events: none;}
|
||||
.allow-interactivity-`).concat(r,` {pointer-events: all;}
|
||||
`)},W1=0,Ls=[];function q1(r){var a=F.useRef([]),s=F.useRef([0,0]),l=F.useRef(),d=F.useState(W1++)[0],f=F.useState(KA)[0],m=F.useRef(r);F.useEffect(function(){m.current=r},[r]),F.useEffect(function(){if(r.inert){document.body.classList.add("block-interactivity-".concat(d));var E=h1([r.lockRef.current],(r.shards||[]).map(Wp),!0).filter(Boolean);return E.forEach(function(b){return b.classList.add("allow-interactivity-".concat(d))}),function(){document.body.classList.remove("block-interactivity-".concat(d)),E.forEach(function(b){return b.classList.remove("allow-interactivity-".concat(d))})}}},[r.inert,r.lockRef.current,r.shards]);var h=F.useCallback(function(E,b){if("touches"in E&&E.touches.length===2||E.type==="wheel"&&E.ctrlKey)return!m.current.allowPinchZoom;var D=Pu(E),T=s.current,B="deltaX"in E?E.deltaX:T[0]-D[0],I="deltaY"in E?E.deltaY:T[1]-D[1],N,z=E.target,H=Math.abs(B)>Math.abs(I)?"h":"v";if("touches"in E&&H==="h"&&z.type==="range")return!1;var j=window.getSelection(),Q=j&&j.anchorNode,U=Q?Q===z||Q.contains(z):!1;if(U)return!1;var V=Up(H,z);if(!V)return!0;if(V?N=H:(N=H==="v"?"h":"v",V=Up(H,z)),!V)return!1;if(!l.current&&"changedTouches"in E&&(B||I)&&(l.current=N),!N)return!0;var J=l.current||N;return V1(J,b,E,J==="h"?B:I)},[]),x=F.useCallback(function(E){var b=E;if(!(!Ls.length||Ls[Ls.length-1]!==f)){var D="deltaY"in b?Zp(b):Pu(b),T=a.current.filter(function(N){return N.name===b.type&&(N.target===b.target||b.target===N.shadowParent)&&U1(N.delta,D)})[0];if(T&&T.should){b.cancelable&&b.preventDefault();return}if(!T){var B=(m.current.shards||[]).map(Wp).filter(Boolean).filter(function(N){return N.contains(b.target)}),I=B.length>0?h(b,B[0]):!m.current.noIsolation;I&&b.cancelable&&b.preventDefault()}}},[]),p=F.useCallback(function(E,b,D,T){var B={name:E,delta:b,target:D,should:T,shadowParent:G1(D)};a.current.push(B),setTimeout(function(){a.current=a.current.filter(function(I){return I!==B})},1)},[]),y=F.useCallback(function(E){s.current=Pu(E),l.current=void 0},[]),v=F.useCallback(function(E){p(E.type,Zp(E),E.target,h(E,r.lockRef.current))},[]),w=F.useCallback(function(E){p(E.type,Pu(E),E.target,h(E,r.lockRef.current))},[]);F.useEffect(function(){return Ls.push(f),r.setCallbacks({onScrollCapture:v,onWheelCapture:v,onTouchMoveCapture:w}),document.addEventListener("wheel",x,Ns),document.addEventListener("touchmove",x,Ns),document.addEventListener("touchstart",y,Ns),function(){Ls=Ls.filter(function(E){return E!==f}),document.removeEventListener("wheel",x,Ns),document.removeEventListener("touchmove",x,Ns),document.removeEventListener("touchstart",y,Ns)}},[]);var k=r.removeScrollBar,S=r.inert;return F.createElement(F.Fragment,null,S?F.createElement(f,{styles:Z1(d)}):null,k?F.createElement(L1,{noRelative:r.noRelative,gapMode:r.gapMode}):null)}function G1(r){for(var a=null;r!==null;)r instanceof ShadowRoot&&(a=r.host,r=r.host),r=r.parentNode;return a}const Q1=w1(QA,q1);var JA=F.forwardRef(function(r,a){return F.createElement(Rc,Kr({},r,{ref:a,sideCar:Q1}))});JA.classNames=Rc.classNames;var K1=function(r){if(typeof document>"u")return null;var a=Array.isArray(r)?r[0]:r;return a.ownerDocument.body},Ms=new WeakMap,Tu=new WeakMap,Du={},Lf=0,eg=function(r){return r&&(r.host||eg(r.parentNode))},$1=function(r,a){return a.map(function(s){if(r.contains(s))return s;var l=eg(s);return l&&r.contains(l)?l:(console.error("aria-hidden",s,"in not contained inside",r,". Doing nothing"),null)}).filter(function(s){return!!s})},Y1=function(r,a,s,l){var d=$1(a,Array.isArray(r)?r:[r]);Du[s]||(Du[s]=new WeakMap);var f=Du[s],m=[],h=new Set,x=new Set(d),p=function(v){!v||h.has(v)||(h.add(v),p(v.parentNode))};d.forEach(p);var y=function(v){!v||x.has(v)||Array.prototype.forEach.call(v.children,function(w){if(h.has(w))y(w);else try{var k=w.getAttribute(l),S=k!==null&&k!=="false",E=(Ms.get(w)||0)+1,b=(f.get(w)||0)+1;Ms.set(w,E),f.set(w,b),m.push(w),E===1&&S&&Tu.set(w,!0),b===1&&w.setAttribute(s,"true"),S||w.setAttribute(l,"true")}catch(D){console.error("aria-hidden: cannot operate on ",w,D)}})};return y(a),h.clear(),Lf++,function(){m.forEach(function(v){var w=Ms.get(v)-1,k=f.get(v)-1;Ms.set(v,w),f.set(v,k),w||(Tu.has(v)||v.removeAttribute(l),Tu.delete(v)),k||v.removeAttribute(s)}),Lf--,Lf||(Ms=new WeakMap,Ms=new WeakMap,Tu=new WeakMap,Du={})}},X1=function(r,a,s){s===void 0&&(s="data-aria-hidden");var l=Array.from(Array.isArray(r)?r:[r]),d=K1(r);return d?(l.push.apply(l,Array.from(d.querySelectorAll("[aria-live], script"))),Y1(l,d,s,"aria-hidden")):function(){return null}};function J1(r){const a=ew(r),s=F.forwardRef((l,d)=>{const{children:f,...m}=l,h=F.Children.toArray(f),x=h.find(nw);if(x){const p=x.props.children,y=h.map(v=>v===x?F.Children.count(p)>1?F.Children.only(null):F.isValidElement(p)?p.props.children:null:v);return R.jsx(a,{...m,ref:d,children:F.isValidElement(p)?F.cloneElement(p,void 0,y):null})}return R.jsx(a,{...m,ref:d,children:f})});return s.displayName=`${r}.Slot`,s}function ew(r){const a=F.forwardRef((s,l)=>{const{children:d
Line truncated
|
||||
|
||||
If you want to hide the \`${a.titleName}\`, you can wrap it with our VisuallyHidden component.
|
||||
|
||||
For more information, see https://radix-ui.com/primitives/docs/components/${a.docsSlug}`;return F.useEffect(()=>{r&&(document.getElementById(r)||console.error(s))},[s,r]),null},hw="DialogDescriptionWarning",pw=({contentRef:r,descriptionId:a})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${mg(hw).contentName}}.`;return F.useEffect(()=>{var f;const d=(f=r.current)==null?void 0:f.getAttribute("aria-describedby");a&&d&&(document.getElementById(a)||console.warn(l))},[l,r,a]),null},Ag=ng,gg=og,Nc=sg,Lc=ag,Mc=ug,Ic=dg,xg=hg;const h0=Ag,mw=gg,vg=F.forwardRef(({className:r,...a},s)=>R.jsx(Nc,{ref:s,className:dt("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",r),...a}));vg.displayName=Nc.displayName;const Oc=F.forwardRef(({className:r,children:a,...s},l)=>R.jsxs(mw,{children:[R.jsx(vg,{}),R.jsxs(Lc,{ref:l,className:dt("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",r),...s,children:[a,R.jsxs(xg,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground",children:[R.jsx(CA,{className:"h-4 w-4"}),R.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Oc.displayName=Lc.displayName;const zc=({className:r,...a})=>R.jsx("div",{className:dt("flex flex-col space-y-1.5 text-center sm:text-left",r),...a});zc.displayName="DialogHeader";const p0=({className:r,...a})=>R.jsx("div",{className:dt("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",r),...a});p0.displayName="DialogFooter";const jc=F.forwardRef(({className:r,...a},s)=>R.jsx(Mc,{ref:s,className:dt("text-lg font-semibold leading-none tracking-tight",r),...a}));jc.displayName=Mc.displayName;const Aw=F.forwardRef(({className:r,...a},s)=>R.jsx(Ic,{ref:s,className:dt("text-sm text-muted-foreground",r),...a}));Aw.displayName=Ic.displayName;function qp(r){const a=gw(r),s=F.forwardRef((l,d)=>{const{children:f,...m}=l,h=F.Children.toArray(f),x=h.find(vw);if(x){const p=x.props.children,y=h.map(v=>v===x?F.Children.count(p)>1?F.Children.only(null):F.isValidElement(p)?p.props.children:null:v);return R.jsx(a,{...m,ref:d,children:F.isValidElement(p)?F.cloneElement(p,void 0,y):null})}return R.jsx(a,{...m,ref:d,children:f})});return s.displayName=`${r}.Slot`,s}function gw(r){const a=F.forwardRef((s,l)=>{const{children:d,...f}=s;if(F.isValidElement(d)){const m=_w(d),h=yw(f,d.props);return d.type!==F.Fragment&&(h.ref=l?ol(l,m):m),F.cloneElement(d,h)}return F.Children.count(d)>1?F.Children.only(null):null});return a.displayName=`${r}.SlotClone`,a}var xw=Symbol("radix.slottable");function vw(r){return F.isValidElement(r)&&typeof r.type=="function"&&"__radixId"in r.type&&r.type.__radixId===xw}function yw(r,a){const s={...a};for(const l in a){const d=r[l],f=a[l];/^on[A-Z]/.test(l)?d&&f?s[l]=(...h)=>{const x=f(...h);return d(...h),x}:d&&(s[l]=d):l==="style"?s[l]={...d,...f}:l==="className"&&(s[l]=[d,f].filter(Boolean).join(" "))}return{...r,...s}}function _w(r){var l,d;let a=(l=Object.getOwnPropertyDescriptor(r.props,"ref"))==null?void 0:l.get,s=a&&"isReactWarning"in a&&a.isReactWarning;return s?r.ref:(a=(d=Object.getOwnPropertyDescriptor(r,"ref"))==null?void 0:d.get,s=a&&"isReactWarning"in a&&a.isReactWarning,s?r.props.ref:r.props.ref||r.ref)}function ww(r){const a=r+"CollectionProvider",[s,l]=sl(a),[d,f]=s(a,{collectionRef:{current:null},itemMap:new Map}),m=E=>{const{scope:b,children:D}=E,T=we.useRef(null),B=we.useRef(new Map).current;return R.jsx(d,{scope:b,itemMap:B,collectionRef:T,children:D})};m.displayName=a;const h=r+"CollectionSlot",x=qp(h),p=we.forwardRef((E,b)=>{const{scope:D,children:T}=E,B=f(h,D),I=xr(b,B.collectionRef);return R.jsx(x,{ref:I,children:T})});p.displayName=h;const y=r+"CollectionItemSlot",v="data-radix-collection-item",w=qp(y),k=we.forwardRef((E,b)=>{const{scope:D,children:T,...B}=E,I=we.useRef(null),N=xr(b,I),z=f(y,D);return we.useEffect(()=>(z.itemMap.set(I,{ref:I,...B}),()=>void z.itemMap.delete(I))),R.jsx(w,{[v]:"",ref:N,children:T})});k.displayName=y;function S(E){const b=f(r+"CollectionConsumer",E);return we.useCallback(()=>{const T=b.collectionRef.current;if(!T)return[];const B=Array.from(T.querySelectorAll(`[${v}]`));return Array.from(b.itemMap.values()).sort((z,H)=>B.indexOf(z.ref.current)-B.indexOf(H.ref.current))},[b.coll
Line truncated
|
||||
* Leaflet 1.9.4, a JS library for interactive maps. https://leafletjs.com
|
||||
* (c) 2010-2023 Vladimir Agafonkin, (c) 2010-2011 CloudMade
|
||||
*/var x2=Ja.exports,Kp;function v2(){return Kp||(Kp=1,(function(r,a){(function(s,l){l(a)})(x2,(function(s){var l="1.9.4";function d(t){var i,u,A,C;for(u=1,A=arguments.length;u<A;u++){C=arguments[u];for(i in C)t[i]=C[i]}return t}var f=Object.create||(function(){function t(){}return function(i){return t.prototype=i,new t}})();function m(t,i){var u=Array.prototype.slice;if(t.bind)return t.bind.apply(t,u.call(arguments,1));var A=u.call(arguments,2);return function(){return t.apply(i,A.length?A.concat(u.call(arguments)):arguments)}}var h=0;function x(t){return"_leaflet_id"in t||(t._leaflet_id=++h),t._leaflet_id}function p(t,i,u){var A,C,O,G;return G=function(){A=!1,C&&(O.apply(u,C),C=!1)},O=function(){A?C=arguments:(t.apply(u,arguments),setTimeout(G,i),A=!0)},O}function y(t,i,u){var A=i[1],C=i[0],O=A-C;return t===A&&u?t:((t-C)%O+O)%O+C}function v(){return!1}function w(t,i){if(i===!1)return t;var u=Math.pow(10,i===void 0?6:i);return Math.round(t*u)/u}function k(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}function S(t){return k(t).split(/\s+/)}function E(t,i){Object.prototype.hasOwnProperty.call(t,"options")||(t.options=t.options?f(t.options):{});for(var u in i)t.options[u]=i[u];return t.options}function b(t,i,u){var A=[];for(var C in t)A.push(encodeURIComponent(u?C.toUpperCase():C)+"="+encodeURIComponent(t[C]));return(!i||i.indexOf("?")===-1?"?":"&")+A.join("&")}var D=/\{ *([\w_ -]+) *\}/g;function T(t,i){return t.replace(D,function(u,A){var C=i[A];if(C===void 0)throw new Error("No value provided for variable "+u);return typeof C=="function"&&(C=C(i)),C})}var B=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};function I(t,i){for(var u=0;u<t.length;u++)if(t[u]===i)return u;return-1}var N="data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";function z(t){return window["webkit"+t]||window["moz"+t]||window["ms"+t]}var H=0;function j(t){var i=+new Date,u=Math.max(0,16-(i-H));return H=i+u,window.setTimeout(t,u)}var Q=window.requestAnimationFrame||z("RequestAnimationFrame")||j,U=window.cancelAnimationFrame||z("CancelAnimationFrame")||z("CancelRequestAnimationFrame")||function(t){window.clearTimeout(t)};function V(t,i,u){if(u&&Q===j)t.call(i);else return Q.call(window,m(t,i))}function J(t){t&&U.call(window,t)}var X={__proto__:null,extend:d,create:f,bind:m,get lastId(){return h},stamp:x,throttle:p,wrapNum:y,falseFn:v,formatNum:w,trim:k,splitWords:S,setOptions:E,getParamString:b,template:T,isArray:B,indexOf:I,emptyImageUrl:N,requestFn:Q,cancelFn:U,requestAnimFrame:V,cancelAnimFrame:J};function oe(){}oe.extend=function(t){var i=function(){E(this),this.initialize&&this.initialize.apply(this,arguments),this.callInitHooks()},u=i.__super__=this.prototype,A=f(u);A.constructor=i,i.prototype=A;for(var C in this)Object.prototype.hasOwnProperty.call(this,C)&&C!=="prototype"&&C!=="__super__"&&(i[C]=this[C]);return t.statics&&d(i,t.statics),t.includes&&(pe(t.includes),d.apply(null,[A].concat(t.includes))),d(A,t),delete A.statics,delete A.includes,A.options&&(A.options=u.options?f(u.options):{},d(A.options,t.options)),A._initHooks=[],A.callInitHooks=function(){if(!this._initHooksCalled){u.callInitHooks&&u.callInitHooks.call(this),this._initHooksCalled=!0;for(var O=0,G=A._initHooks.length;O<G;O++)A._initHooks[O].call(this)}},i},oe.include=function(t){var i=this.prototype.options;return d(this.prototype,t),t.options&&(this.prototype.options=i,this.mergeOptions(t.options)),this},oe.mergeOptions=function(t){return d(this.prototype.options,t),this},oe.addInitHook=function(t){var i=Array.prototype.slice.call(arguments,1),u=typeof t=="function"?t:function(){this[t].apply(this,i)};return this.prototype._initHooks=this.prototype._initHooks||[],this.prototype._initHooks.push(u),this};function pe(t){if(!(typeof L>"u"||!L||!L.Mixin)){t=B(t)?t:[t];for(var i=0;i<t.length;i++)t[i]===L.Mixin.Events&&console.warn("Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.",new Error().stack)}}var se={on:function(t,i,u){if(typeof t=="object")for(var A in t)this._on(A,t[A],i);else{t=S(t);for(var C=0,O=t.length;C<O;C++)this._on(t[C],i,u)}return this},off:function(t,i,u){if(!arguments.length)delete this._events;else if(typeof t=="object")for(var A in t)this._off(A,t[A],i);else{t=S(t);for(var C=arguments.length===1,O=0,G=t.length;O<G;O++)C?this._off(t[O]):this._off(t[O],i,u)}return this},_on:function(t,i,u,A){if(typeof i!="function"){console.warn("wrong listener type: "+typeof i);return}if(this._listens(t,i,u)===!1){u===this&&(u=void 0);var C={fn:i,ctx:u};A&&(C.once=!0),this._events=this._events||{},this._events[t]=this._events[t]||[],this._events[t].push(C)}},_off:function(t,i,u){var A,C,O;if(this._events&&(A=this._events[t],!!A)){if(arguments.length===1){if(this._firingCount)for(C=0,O=A.length;C<O;C++)A[C].fn=v;delete this._events[t];return}if(typeof i!="function"){console.warn("wrong listener type: "+typeof i);return}var G=this._lLine truncated
|
||||
(c) 2012 by Cédric Mesnil. All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/return(function(l){var d=s,f=d.lib,m=f.WordArray,h=f.Hasher,x=d.algo,p=m.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),y=m.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),v=m.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),w=m.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),k=m.create([0,1518500249,1859775393,2400959708,2840853838]),S=m.create([1352829926,1548603684,1836072691,2053994217,0]),E=x.RIPEMD160=h.extend({_doReset:function(){this._hash=m.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(z,H){for(var j=0;j<16;j++){var Q=H+j,U=z[Q];z[Q]=(U<<8|U>>>24)&16711935|(U<<24|U>>>8)&4278255360}var V=this._hash.words,J=k.words,X=S.words,oe=p.words,pe=y.words,se=v.words,he=w.words,q,Ae,ne,P,Z,K,Y,fe,me,Ee;K=q=V[0],Y=Ae=V[1],fe=ne=V[2],me=P=V[3],Ee=Z=V[4];for(var ge,j=0;j<80;j+=1)ge=q+z[H+oe[j]]|0,j<16?ge+=b(Ae,ne,P)+J[0]:j<32?ge+=D(Ae,ne,P)+J[1]:j<48?ge+=T(Ae,ne,P)+J[2]:j<64?ge+=B(Ae,ne,P)+J[3]:ge+=I(Ae,ne,P)+J[4],ge=ge|0,ge=N(ge,se[j]),ge=ge+Z|0,q=Z,Z=P,P=N(ne,10),ne=Ae,Ae=ge,ge=K+z[H+pe[j]]|0,j<16?ge+=I(Y,fe,me)+X[0]:j<32?ge+=B(Y,fe,me)+X[1]:j<48?ge+=T(Y,fe,me)+X[2]:j<64?ge+=D(Y,fe,me)+X[3]:ge+=b(Y,fe,me)+X[4],ge=ge|0,ge=N(ge,he[j]),ge=ge+Ee|0,K=Ee,Ee=me,me=N(fe,10),fe=Y,Y=ge;ge=V[1]+ne+me|0,V[1]=V[2]+P+Ee|0,V[2]=V[3]+Z+K|0,V[3]=V[4]+q+Y|0,V[4]=V[0]+Ae+fe|0,V[0]=ge},_doFinalize:function(){var z=this._data,H=z.words,j=this._nDataBytes*8,Q=z.sigBytes*8;H[Q>>>5]|=128<<24-Q%32,H[(Q+64>>>9<<4)+14]=(j<<8|j>>>24)&16711935|(j<<24|j>>>8)&4278255360,z.sigBytes=(H.length+1)*4,this._process();for(var U=this._hash,V=U.words,J=0;J<5;J++){var X=V[J];V[J]=(X<<8|X>>>24)&16711935|(X<<24|X>>>8)&4278255360}return U},clone:function(){var z=h.clone.call(this);return z._hash=this._hash.clone(),z}});function b(z,H,j){return z^H^j}function D(z,H,j){return z&H|~z&j}function T(z,H,j){return(z|~H)^j}function B(z,H,j){return z&j|H&~j}function I(z,H,j){return z^(H|~j)}function N(z,H){return z<<H|z>>>32-H}d.RIPEMD160=h._createHelper(E),d.HmacRIPEMD160=h._createHmacHelper(E)})(),s.RIPEMD160})})($u)),$u.exports}var Yu={exports:{}},lC=Yu.exports,pm;function Gc(){return pm||(pm=1,(function(r,a){(function(s,l){r.exports=l(ut())})(lC,function(s){(function(){var l=s,d=l.lib,f=d.Base,m=l.enc,h=m.Utf8,x=l.algo;x.HMAC=f.extend({init:function(p,y){p=this._hasher=new p.init,typeof y=="string"&&(y=h.parse(y));var v=p.blockSize,w=v*4;y.sigBytes>w&&(y=p.finalize(y)),y.clamp();for(var k=this._oKey=y.clone(),S=this._iKey=y.clone(),E=k.words,b=S.words,D=0;D<v;D++)E[D]^=1549556828,b[D]^=909522486;k.sigBytes=S.sigBytes=w,this.reset()},reset:function(){var p=this._hasher;p.reset(),p.update(this._iKey)},update:function(p){return this._hasher.update(p),this},finalize:function(p){var y=this._hasher,v=y.finalize(p);y.reset();var w=y.finalize(this._oKey.clone().concat(v));return w}})})()})})(Yu)),Yu.exports}var Xu={exports:{}},uC=Xu.exports,mm;function cC(){return mm||(mm=1,(function(r,a){(function(s,l,d){r.exports=l(ut(),ll(),Gc())})(uC,function(s){return(function(){var l=s,d=l.lib,f=d.Base,m=d.WordArray,h=l.algo,x=h.SHA256,p=h.HMAC,y=h.PBKDF2=f.extend({cfg:f.extend({keySize:128/32,hasher:x,iterations:25e4}),init:function(v){this.cfg=this.cfg.extend(v)},compute:function(v,w){for(var k=this.cfg,S=p.create(k.hasher,v),E=m.create(),b=m.create([1]),D=E.words,T=b.words,B=k.keySize,I=k.iterations;D.length<B;){var N=S.update(w).finalize(b);S.reset();for(var z=N.words,H=z.length,j=N,Q=1;Q<I;Q++){j=S.finalize(j),S.reset();for(var U=j.words,V=0;V<H;V++)z[V]^=U[V]}E.concat(N),T[0]++}return E.sigBytes=B*4,E}});l.PBKDF2=function(v,w,k){return y.create(k).compute(v,w)}})(),s.PBKDF2})})(Xu)),Xu.exports}var Ju={exports:{}},dC=Ju.exports,Am;function so(){return Am||(Am=1,(function(r,a){(function(s,l,d){r.exports=l(ut(),ox(),Gc())})(dC,function(s){return(function(){var l=s,d=l.lib,f=d.Base,m=d.WordArray,h=l.algo,x=h.MD5,p=h.EvpKDF=f.extend({cfg:f.extend({keySize:128/32,hasher:x,iterations:1}),init:function(y){this.cfg=this.cfg.extend(y)},compute:function(y,v){for(var w,k=this.cfg,S=k.hasher.create(),E=m.create(),b=E.words,D=k.keySize,T=k.iterations;b.length<D;){w&&S.update(w),w=S.update(y).finalize(v),S.reset();for(var B=1;B<T;B++)w=S.finalize(w),S.reset();E.concat(w)}return E.sigBytes=D*4,E}});l.EvpKDF=function(y,v,w){return p.create(w).compute(y,v)}})(),s.EvpKDF})})(Ju)),Ju.exports}var ec={exports:{}},fC=ec.exports,gLine truncated
|
||||
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
||||
* derived from CryptoJS.mode.CTR
|
||||
* Jan Hruby jhruby.web@gmail.com
|
||||
*/return s.mode.CTRGladman=(function(){var l=s.lib.BlockCipherMode.extend();function d(h){if((h>>24&255)===255){var x=h>>16&255,p=h>>8&255,y=h&255;x===255?(x=0,p===255?(p=0,y===255?y=0:++y):++p):++x,h=0,h+=x<<16,h+=p<<8,h+=y}else h+=1<<24;return h}function f(h){return(h[0]=d(h[0]))===0&&(h[1]=d(h[1])),h}var m=l.Encryptor=l.extend({processBlock:function(h,x){var p=this._cipher,y=p.blockSize,v=this._iv,w=this._counter;v&&(w=this._counter=v.slice(0),this._iv=void 0),f(w);var k=w.slice(0);p.encryptBlock(k,0);for(var S=0;S<y;S++)h[x+S]^=k[S]}});return l.Decryptor=m,l})(),s.mode.CTRGladman})})(rc)),rc.exports}var ic={exports:{}},vC=ic.exports,_m;function yC(){return _m||(_m=1,(function(r,a){(function(s,l,d){r.exports=l(ut(),fn())})(vC,function(s){return s.mode.OFB=(function(){var l=s.lib.BlockCipherMode.extend(),d=l.Encryptor=l.extend({processBlock:function(f,m){var h=this._cipher,x=h.blockSize,p=this._iv,y=this._keystream;p&&(y=this._keystream=p.slice(0),this._iv=void 0),h.encryptBlock(y,0);for(var v=0;v<x;v++)f[m+v]^=y[v]}});return l.Decryptor=d,l})(),s.mode.OFB})})(ic)),ic.exports}var oc={exports:{}},_C=oc.exports,wm;function wC(){return wm||(wm=1,(function(r,a){(function(s,l,d){r.exports=l(ut(),fn())})(_C,function(s){return s.mode.ECB=(function(){var l=s.lib.BlockCipherMode.extend();return l.Encryptor=l.extend({processBlock:function(d,f){this._cipher.encryptBlock(d,f)}}),l.Decryptor=l.extend({processBlock:function(d,f){this._cipher.decryptBlock(d,f)}}),l})(),s.mode.ECB})})(oc)),oc.exports}var sc={exports:{}},CC=sc.exports,Cm;function bC(){return Cm||(Cm=1,(function(r,a){(function(s,l,d){r.exports=l(ut(),fn())})(CC,function(s){return s.pad.AnsiX923={pad:function(l,d){var f=l.sigBytes,m=d*4,h=m-f%m,x=f+h-1;l.clamp(),l.words[x>>>2]|=h<<24-x%4*8,l.sigBytes+=h},unpad:function(l){var d=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=d}},s.pad.Ansix923})})(sc)),sc.exports}var ac={exports:{}},EC=ac.exports,bm;function kC(){return bm||(bm=1,(function(r,a){(function(s,l,d){r.exports=l(ut(),fn())})(EC,function(s){return s.pad.Iso10126={pad:function(l,d){var f=d*4,m=f-l.sigBytes%f;l.concat(s.lib.WordArray.random(m-1)).concat(s.lib.WordArray.create([m<<24],1))},unpad:function(l){var d=l.words[l.sigBytes-1>>>2]&255;l.sigBytes-=d}},s.pad.Iso10126})})(ac)),ac.exports}var lc={exports:{}},SC=lc.exports,Em;function BC(){return Em||(Em=1,(function(r,a){(function(s,l,d){r.exports=l(ut(),fn())})(SC,function(s){return s.pad.Iso97971={pad:function(l,d){l.concat(s.lib.WordArray.create([2147483648],1)),s.pad.ZeroPadding.pad(l,d)},unpad:function(l){s.pad.ZeroPadding.unpad(l),l.sigBytes--}},s.pad.Iso97971})})(lc)),lc.exports}var uc={exports:{}},PC=uc.exports,km;function TC(){return km||(km=1,(function(r,a){(function(s,l,d){r.exports=l(ut(),fn())})(PC,function(s){return s.pad.ZeroPadding={pad:function(l,d){var f=d*4;l.clamp(),l.sigBytes+=f-(l.sigBytes%f||f)},unpad:function(l){for(var d=l.words,f=l.sigBytes-1,f=l.sigBytes-1;f>=0;f--)if(d[f>>>2]>>>24-f%4*8&255){l.sigBytes=f+1;break}}},s.pad.ZeroPadding})})(uc)),uc.exports}var cc={exports:{}},DC=cc.exports,Sm;function RC(){return Sm||(Sm=1,(function(r,a){(function(s,l,d){r.exports=l(ut(),fn())})(DC,function(s){return s.pad.NoPadding={pad:function(){},unpad:function(){}},s.pad.NoPadding})})(cc)),cc.exports}var dc={exports:{}},FC=dc.exports,Bm;function NC(){return Bm||(Bm=1,(function(r,a){(function(s,l,d){r.exports=l(ut(),fn())})(FC,function(s){return(function(l){var d=s,f=d.lib,m=f.CipherParams,h=d.enc,x=h.Hex,p=d.format;p.Hex={stringify:function(y){return y.ciphertext.toString(x)},parse:function(y){var v=x.parse(y);return m.create({ciphertext:v})}}})(),s.format.Hex})})(dc)),dc.exports}var fc={exports:{}},LC=fc.exports,Pm;function MC(){return Pm||(Pm=1,(function(r,a){(function(s,l,d){r.exports=l(ut(),Wo(),qo(),so(),fn())})(LC,function(s){return(function(){var l=s,d=l.lib,f=d.BlockCipher,m=l.algo,h=[],x=[],p=[],y=[],v=[],w=[],k=[],S=[],E=[],b=[];(function(){for(var B=[],I=0;I<256;I++)I<128?B[I]=I<<1:B[I]=I<<1^283;for(var N=0,z=0,I=0;I<256;I++){var H=z^z<<1^z<<2^z<<3^z<<4;H=H>>>8^H&255^99,h[N]=H,x[H]=N;var j=B[N],Q=B[j],U=B[Q],V=B[H]*257^H*16843008;p[N]=V<<24|V>>>8,y[N]=V<<16|V>>>16,v[N]=V<<8|V>>>24,w[N]=V;var V=U*16843009^Q*65537^j*257^N*16843008;k[H]=V<<24|V>>>8,S[H]=V<<16|V>>>16,E[H]=V<<8|V>>>24,b[H]=V,N?(N=j^B[B[B[U^j]]],z^=B[B[z]]):N=z=1}})();var D=[0,1,2,4,8,16,32,64,128,27,54],T=m.AES=f.extend({_doReset:function(){var B;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var I=this._keyPriorReset=this._key,N=I.words,z=I.sigBytes/4,H=this._nRounds=z+6,j=(H+1)*4,Q=this._keySchedule=[],U=0;U<j;U++)U<z?Q[U]=N[U]:(B=Q[U-1],U%z?z>6&&U%z==4&&(B=h[B>>>24]<<24|h[B>>>16&255]<<16|h[B>>>8&255]<<8|h[B&255]):(B=B<<8|B>>>24,B=h[B>>>24]<<24|h[B>>>16&255]<<16|h[B>>>8&255]<<8|h[B&255],B^=D[U/z|0]<<24),Q[U]=Q[U-z]^B);for(var V=this._invKeySchedule=[],J=0;J<j;J++){var U=j-J;if(J%4)var B=Q[U];else var B=Q[U-4];J<4||U<=4?V[J]=B:V[J]=k[h[B>>>24]]^S[h[B>>>16&255]]^E[h[B>>>8&255]]^b[h[B&255]]}}},encryptBlock:Line truncated
|
||||
• Timestamp (4 bytes) - send time as unix timestamp
|
||||
• Request Type (1 byte) - type of request (GetStats, GetTelemetryData, etc.)
|
||||
• Request Data (remaining bytes) - additional request-specific data`,startByte:h+x,endByte:h+d.length-1,value:w});const k={type:r.PayloadType.Request,version:r.PayloadVersion.Version1,isValid:!0,timestamp:0,requestType:r.RequestType.GetStats,requestData:"",destinationHash:p,sourceHash:y,cipherMac:v,ciphertext:w};return f!=null&&f.includeSegments&&(k.segments=m),k}catch(m){return{type:r.PayloadType.Request,version:r.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode request payload"],timestamp:0,requestType:r.RequestType.GetStats,requestData:"",destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:""}}}}return Za.RequestPayloadDecoder=s,Za}var Wa={},Xm;function xb(){if(Xm)return Wa;Xm=1,Object.defineProperty(Wa,"__esModule",{value:!0}),Wa.ResponsePayloadDecoder=void 0;const r=ir(),a=xn();class s{static decode(d,f){try{if(d.length<4){const S={type:r.PayloadType.Response,version:r.PayloadVersion.Version1,isValid:!1,errors:["Response payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return f!=null&&f.includeSegments&&(S.segments=[{name:"Invalid Response Data",description:"Response payload too short (minimum 4 bytes required)",startByte:f.segmentOffset||0,endByte:(f.segmentOffset||0)+d.length-1,value:(0,a.bytesToHex)(d)}]),S}const m=[],h=(f==null?void 0:f.segmentOffset)||0;let x=0;const p=(0,a.byteToHex)(d[x]);f!=null&&f.includeSegments&&m.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:h+x,endByte:h+x,value:p}),x+=1;const y=(0,a.byteToHex)(d[x]);f!=null&&f.includeSegments&&m.push({name:"Source Hash",description:"First byte of source node public key",startByte:h+x,endByte:h+x,value:y}),x+=1;const v=(0,a.bytesToHex)(d.subarray(x,x+2));f!=null&&f.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:h+x,endByte:h+x+1,value:v}),x+=2;const w=(0,a.bytesToHex)(d.subarray(x));f!=null&&f.includeSegments&&d.length>x&&m.push({name:"Ciphertext",description:"Encrypted response data (tag + content)",startByte:h+x,endByte:h+d.length-1,value:w});const k={type:r.PayloadType.Response,version:r.PayloadVersion.Version1,isValid:!0,destinationHash:p,sourceHash:y,cipherMac:v,ciphertext:w,ciphertextLength:d.length-4};return f!=null&&f.includeSegments&&(k.segments=m),k}catch(m){return{type:r.PayloadType.Response,version:r.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode response payload"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return Wa.ResponsePayloadDecoder=s,Wa}var qa={},Jm;function vb(){if(Jm)return qa;Jm=1,Object.defineProperty(qa,"__esModule",{value:!0}),qa.AnonRequestPayloadDecoder=void 0;const r=ir(),a=xn();class s{static decode(d,f){try{if(d.length<35){const S={type:r.PayloadType.AnonRequest,version:r.PayloadVersion.Version1,isValid:!1,errors:["AnonRequest payload too short (minimum 35 bytes: dest + public key + MAC)"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return f!=null&&f.includeSegments&&(S.segments=[{name:"Invalid AnonRequest Data",description:"AnonRequest payload too short (minimum 35 bytes required: 1 for dest hash + 32 for public key + 2 for MAC)",startByte:f.segmentOffset||0,endByte:(f.segmentOffset||0)+d.length-1,value:(0,a.bytesToHex)(d)}]),S}const m=[],h=(f==null?void 0:f.segmentOffset)||0;let x=0;const p=(0,a.byteToHex)(d[0]);f!=null&&f.includeSegments&&m.push({name:"Destination Hash",description:`First byte of destination node public key: 0x${p}`,startByte:h+x,endByte:h+x,value:p}),x+=1;const y=(0,a.bytesToHex)(d.subarray(1,33));f!=null&&f.includeSegments&&m.push({name:"Sender Public Key",description:"Ed25519 public key of the sender (32 bytes)",startByte:h+x,endByte:h+x+31,value:y}),x+=32;const v=(0,a.bytesToHex)(d.subarray(33,35));f!=null&&f.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data verification (2 bytes)",startByte:h+x,endByte:h+x+1,value:v}),x+=2;const w=(0,a.bytesToHex)(d.subarray(35));f!=null&&f.includeSegments&&d.length>35&&m.push({name:"Ciphertext",description:`Encrypted message data (${d.length-35} bytes). Contains encrypted plaintext with this structure:
|
||||
• Timestamp (4 bytes) - send time as unix timestamp
|
||||
• Sync Timestamp (4 bytes) - room server only, sender's "sync messages SINCE x" timestamp
|
||||
• Password (remaining bytes) - password for repeater/room`,startByte:h+x,endByte:h+d.length-1,value:w});const k={type:r.PayloadType.AnonRequest,version:r.PayloadVersion.Version1,isValid:!0,destinationHash:p,senderPublicKey:y,cipherMac:v,ciphertext:w,ciphertextLength:d.length-35};return f!=null&&f.includeSegments&&(k.segments=m),k}catch(m){return{type:r.PayloadType.AnonRequest,version:r.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode AnonRequest payload"],destinationHash:"",senderPublicKey:"",cipherMac:"",ciphertext:"",ciphertextLength:0}}}}return qa.AnonRequestPayloadDecoder=s,qa}var Ga={},eA;function yb(){if(eA)return Ga;eA=1,Object.defineProperty(Ga,"__esModule",{value:!0}),Ga.AckPayloadDecoder=void 0;const r=ir(),a=xn();class s{static decode(d,f){try{if(d.length<4){const y={type:r.PayloadType.Ack,version:r.PayloadVersion.Version1,isValid:!1,errors:["Ack payload too short (minimum 4 bytes for checksum)"],checksum:""};return f!=null&&f.includeSegments&&(y.segments=[{name:"Invalid Ack Data",description:"Ack payload too short (minimum 4 bytes required for checksum)",startByte:f.segmentOffset||0,endByte:(f.segmentOffset||0)+d.length-1,value:(0,a.bytesToHex)(d)}]),y}const m=[],h=(f==null?void 0:f.segmentOffset)||0,x=(0,a.bytesToHex)(d.subarray(0,4));f!=null&&f.includeSegments&&m.push({name:"Checksum",description:`CRC checksum of message timestamp, text, and sender pubkey: 0x${x}`,startByte:h,endByte:h+3,value:x}),f!=null&&f.includeSegments&&d.length>4&&m.push({name:"Additional Data",description:"Extra data in Ack payload",startByte:h+4,endByte:h+d.length-1,value:(0,a.bytesToHex)(d.subarray(4))});const p={type:r.PayloadType.Ack,version:r.PayloadVersion.Version1,isValid:!0,checksum:x};return f!=null&&f.includeSegments&&(p.segments=m),p}catch(m){return{type:r.PayloadType.Ack,version:r.PayloadVersion.Version1,isValid:!1,errors:[m instanceof Error?m.message:"Failed to decode Ack payload"],checksum:""}}}}return Ga.AckPayloadDecoder=s,Ga}var Qa={},tA;function _b(){if(tA)return Qa;tA=1,Object.defineProperty(Qa,"__esModule",{value:!0}),Qa.PathPayloadDecoder=void 0;const r=ir(),a=xn();class s{static decode(d){try{if(d.length<2)return{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!1,errors:["Path payload too short (minimum 2 bytes: path length + extra type)"],pathLength:0,pathHashes:[],extraType:0,extraData:""};const f=d[0];if(d.length<1+f+1)return{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!1,errors:[`Path payload too short (need ${1+f+1} bytes for path length + path + extra type)`],pathLength:f,pathHashes:[],extraType:0,extraData:""};const m=[];for(let p=0;p<f;p++)m.push((0,a.byteToHex)(d[1+p]));const h=d[1+f];let x="";return d.length>1+f+1&&(x=(0,a.bytesToHex)(d.subarray(1+f+1))),{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!0,pathLength:f,pathHashes:m,extraType:h,extraData:x}}catch(f){return{type:r.PayloadType.Path,version:r.PayloadVersion.Version1,isValid:!1,errors:[f instanceof Error?f.message:"Failed to decode Path payload"],pathLength:0,pathHashes:[],extraType:0,extraData:""}}}}return Qa.PathPayloadDecoder=s,Qa}var Ka={},nA;function wb(){if(nA)return Ka;nA=1,Object.defineProperty(Ka,"__esModule",{value:!0}),Ka.TextMessagePayloadDecoder=void 0;const r=ir(),a=xn();class s{static decode(d,f){try{if(d.length<4){const S={type:r.PayloadType.TextMessage,version:r.PayloadVersion.Version1,isValid:!1,errors:["TextMessage payload too short (minimum 4 bytes: dest + source + MAC)"],destinationHash:"",sourceHash:"",cipherMac:"",ciphertext:"",ciphertextLength:0};return f!=null&&f.includeSegments&&(S.segments=[{name:"Invalid TextMessage Data",description:"TextMessage payload too short (minimum 4 bytes required)",startByte:f.segmentOffset||0,endByte:(f.segmentOffset||0)+d.length-1,value:(0,a.bytesToHex)(d)}]),S}const m=[],h=(f==null?void 0:f.segmentOffset)||0;let x=0;const p=(0,a.byteToHex)(d[x]);f!=null&&f.includeSegments&&m.push({name:"Destination Hash",description:"First byte of destination node public key",startByte:h+x,endByte:h+x,value:p}),x+=1;const y=(0,a.byteToHex)(d[x]);f!=null&&f.includeSegments&&m.push({name:"Source Hash",description:"First byte of source node public key",startByte:h+x,endByte:h+x,value:y}),x+=1;const v=(0,a.bytesToHex)(d.subarray(x,x+2));f!=null&&f.includeSegments&&m.push({name:"Cipher MAC",description:"MAC for encrypted data in next field",startByte:h+x,endByte:h+x+1,value:v}),x+=2;const w=(0,a.bytesToHex)(d.subarray(x));f!=null&&f.includeSegments&&d.length>x&&m.push({name:"Ciphertext",description:"Encrypted message data (timestamp + message text)",startByte:h+x,endByte:h+d.length-1,value:w});const k={type:r.PayloadType.TextMessage,version:r.PayloadVersion.Version1,isValid:!0,destinationHash:p,sourceHash:y,cipherMac:v,ciphertext:w,ciphertextLength:d.length-4};return f!=null&&f.includeSegments&&(k.segments=m),k}catch(m){return{type:r.PayloadType.TextMessage,version:r.PayloadVersion.Version1,i
Line truncated
|
||||
// SHA256 round constants
|
||||
const K: array<u32, 64> = array<u32, 64>(
|
||||
0x428a2f98u, 0x71374491u, 0xb5c0fbcfu, 0xe9b5dba5u, 0x3956c25bu, 0x59f111f1u, 0x923f82a4u, 0xab1c5ed5u,
|
||||
0xd807aa98u, 0x12835b01u, 0x243185beu, 0x550c7dc3u, 0x72be5d74u, 0x80deb1feu, 0x9bdc06a7u, 0xc19bf174u,
|
||||
0xe49b69c1u, 0xefbe4786u, 0x0fc19dc6u, 0x240ca1ccu, 0x2de92c6fu, 0x4a7484aau, 0x5cb0a9dcu, 0x76f988dau,
|
||||
0x983e5152u, 0xa831c66du, 0xb00327c8u, 0xbf597fc7u, 0xc6e00bf3u, 0xd5a79147u, 0x06ca6351u, 0x14292967u,
|
||||
0x27b70a85u, 0x2e1b2138u, 0x4d2c6dfcu, 0x53380d13u, 0x650a7354u, 0x766a0abbu, 0x81c2c92eu, 0x92722c85u,
|
||||
0xa2bfe8a1u, 0xa81a664bu, 0xc24b8b70u, 0xc76c51a3u, 0xd192e819u, 0xd6990624u, 0xf40e3585u, 0x106aa070u,
|
||||
0x19a4c116u, 0x1e376c08u, 0x2748774cu, 0x34b0bcb5u, 0x391c0cb3u, 0x4ed8aa4au, 0x5b9cca4fu, 0x682e6ff3u,
|
||||
0x748f82eeu, 0x78a5636fu, 0x84c87814u, 0x8cc70208u, 0x90befffau, 0xa4506cebu, 0xbef9a3f7u, 0xc67178f2u
|
||||
);
|
||||
|
||||
// Character lookup table (a-z = 0-25, 0-9 = 26-35, dash = 36)
|
||||
const CHARS: array<u32, 37> = array<u32, 37>(
|
||||
0x61u, 0x62u, 0x63u, 0x64u, 0x65u, 0x66u, 0x67u, 0x68u, 0x69u, 0x6au, // a-j
|
||||
0x6bu, 0x6cu, 0x6du, 0x6eu, 0x6fu, 0x70u, 0x71u, 0x72u, 0x73u, 0x74u, // k-t
|
||||
0x75u, 0x76u, 0x77u, 0x78u, 0x79u, 0x7au, // u-z
|
||||
0x30u, 0x31u, 0x32u, 0x33u, 0x34u, 0x35u, 0x36u, 0x37u, 0x38u, 0x39u, // 0-9
|
||||
0x2du // dash
|
||||
);
|
||||
|
||||
struct Params {
|
||||
target_channel_hash: u32,
|
||||
batch_offset: u32,
|
||||
name_length: u32,
|
||||
batch_size: u32,
|
||||
target_mac: u32, // First 2 bytes of target MAC (in high 16 bits)
|
||||
ciphertext_words: u32, // Number of 32-bit words in ciphertext
|
||||
ciphertext_len_bits: u32, // Length of ciphertext in bits
|
||||
verify_mac: u32, // 1 to verify MAC, 0 to skip
|
||||
}
|
||||
|
||||
@group(0) @binding(0) var<uniform> params: Params;
|
||||
@group(0) @binding(1) var<storage, read_write> match_count: atomic<u32>;
|
||||
@group(0) @binding(2) var<storage, read_write> match_indices: array<u32>;
|
||||
@group(0) @binding(3) var<storage, read> ciphertext: array<u32>; // Ciphertext data
|
||||
|
||||
fn rotr(x: u32, n: u32) -> u32 {
|
||||
return (x >> n) | (x << (32u - n));
|
||||
}
|
||||
|
||||
fn ch(x: u32, y: u32, z: u32) -> u32 {
|
||||
return (x & y) ^ (~x & z);
|
||||
}
|
||||
|
||||
fn maj(x: u32, y: u32, z: u32) -> u32 {
|
||||
return (x & y) ^ (x & z) ^ (y & z);
|
||||
}
|
||||
|
||||
fn sigma0(x: u32) -> u32 {
|
||||
return rotr(x, 2u) ^ rotr(x, 13u) ^ rotr(x, 22u);
|
||||
}
|
||||
|
||||
fn sigma1(x: u32) -> u32 {
|
||||
return rotr(x, 6u) ^ rotr(x, 11u) ^ rotr(x, 25u);
|
||||
}
|
||||
|
||||
fn gamma0(x: u32) -> u32 {
|
||||
return rotr(x, 7u) ^ rotr(x, 18u) ^ (x >> 3u);
|
||||
}
|
||||
|
||||
fn gamma1(x: u32) -> u32 {
|
||||
return rotr(x, 17u) ^ rotr(x, 19u) ^ (x >> 10u);
|
||||
}
|
||||
|
||||
// Convert index to room name bytes, returns the hash as a u32 for the first byte check
|
||||
fn index_to_room_name(idx: u32, length: u32, msg: ptr<function, array<u32, 16>>) -> bool {
|
||||
// Message starts with '#' (0x23)
|
||||
var byte_pos = 0u;
|
||||
var word_idx = 0u;
|
||||
var current_word = 0x23000000u; // '#' in big-endian position 0
|
||||
byte_pos = 1u;
|
||||
|
||||
var remaining = idx;
|
||||
var prev_was_dash = false;
|
||||
|
||||
// Generate room name from index
|
||||
for (var i = 0u; i < length; i++) {
|
||||
let char_count = select(37u, 36u, i == 0u || i == length - 1u); // no dash at start/end
|
||||
var char_idx = remaining % char_count;
|
||||
remaining = remaining / char_count;
|
||||
|
||||
// Check for consecutive dashes (invalid)
|
||||
let is_dash = char_idx == 36u && i > 0u && i < length - 1u;
|
||||
if (is_dash && prev_was_dash) {
|
||||
return false; // Invalid: consecutive dashes
|
||||
}
|
||||
prev_was_dash = is_dash;
|
||||
|
||||
// Map char index to actual character
|
||||
let c = CHARS[char_idx];
|
||||
|
||||
// Pack byte into current word (big-endian)
|
||||
let shift = (3u - byte_pos % 4u) * 8u;
|
||||
if (byte_pos % 4u == 0u && byte_pos > 0u) {
|
||||
(*msg)[word_idx] = current_word;
|
||||
word_idx = word_idx + 1u;
|
||||
current_word = 0u;
|
||||
}
|
||||
current_word = current_word | (c << shift);
|
||||
byte_pos = byte_pos + 1u;
|
||||
}
|
||||
|
||||
// Add padding: 0x80 followed by zeros, then length in bits
|
||||
let msg_len_bits = (length + 1u) * 8u; // +1 for '#'
|
||||
|
||||
// Add 0x80 padding byte
|
||||
let shift = (3u - byte_pos % 4u) * 8u;
|
||||
if (byte_pos % 4u == 0u) {
|
||||
(*msg)[word_idx] = current_word;
|
||||
word_idx = word_idx + 1u;
|
||||
current_word = 0x80000000u;
|
||||
} else {
|
||||
current_word = current_word | (0x80u << shift);
|
||||
}
|
||||
byte_pos = byte_pos + 1u;
|
||||
|
||||
// Store current word
|
||||
if (byte_pos % 4u == 0u || word_idx < 14u) {
|
||||
(*msg)[word_idx] = current_word;
|
||||
word_idx = word_idx + 1u;
|
||||
}
|
||||
|
||||
// Zero-fill until word 14
|
||||
for (var i = word_idx; i < 14u; i++) {
|
||||
(*msg)[i] = 0u;
|
||||
}
|
||||
|
||||
// Length in bits (64-bit, but we only use lower 32 bits for short messages)
|
||||
(*msg)[14u] = 0u;
|
||||
(*msg)[15u] = msg_len_bits;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
fn sha256_block(msg: ptr<function, array<u32, 16>>) -> array<u32, 8> {
|
||||
// Initialize hash values
|
||||
var h: array<u32, 8> = array<u32, 8>(
|
||||
0x6a09e667u, 0xbb67ae85u, 0x3c6ef372u, 0xa54ff53au,
|
||||
0x510e527fu, 0x9b05688cu, 0x1f83d9abu, 0x5be0cd19u
|
||||
);
|
||||
|
||||
// Message schedule
|
||||
var w: array<u32, 64>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
w[i] = (*msg)[i];
|
||||
}
|
||||
for (var i = 16u; i < 64u; i++) {
|
||||
w[i] = gamma1(w[i-2u]) + w[i-7u] + gamma0(w[i-15u]) + w[i-16u];
|
||||
}
|
||||
|
||||
// Compression
|
||||
var a = h[0]; var b = h[1]; var c = h[2]; var d = h[3];
|
||||
var e = h[4]; var f = h[5]; var g = h[6]; var hh = h[7];
|
||||
|
||||
for (var i = 0u; i < 64u; i++) {
|
||||
let t1 = hh + sigma1(e) + ch(e, f, g) + K[i] + w[i];
|
||||
let t2 = sigma0(a) + maj(a, b, c);
|
||||
hh = g; g = f; f = e; e = d + t1;
|
||||
d = c; c = b; b = a; a = t1 + t2;
|
||||
}
|
||||
|
||||
h[0] = h[0] + a; h[1] = h[1] + b; h[2] = h[2] + c; h[3] = h[3] + d;
|
||||
h[4] = h[4] + e; h[5] = h[5] + f; h[6] = h[6] + g; h[7] = h[7] + hh;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
// Compute SHA256 of the key (16 bytes) to get channel hash
|
||||
fn sha256_key(key: array<u32, 4>) -> u32 {
|
||||
var msg: array<u32, 16>;
|
||||
|
||||
// Key bytes (16 bytes = 4 words)
|
||||
msg[0] = key[0];
|
||||
msg[1] = key[1];
|
||||
msg[2] = key[2];
|
||||
msg[3] = key[3];
|
||||
|
||||
// Padding: 0x80 followed by zeros
|
||||
msg[4] = 0x80000000u;
|
||||
for (var i = 5u; i < 14u; i++) {
|
||||
msg[i] = 0u;
|
||||
}
|
||||
|
||||
// Length: 128 bits
|
||||
msg[14] = 0u;
|
||||
msg[15] = 128u;
|
||||
|
||||
let hash = sha256_block(&msg);
|
||||
|
||||
// Return first byte of hash (big-endian)
|
||||
return hash[0] >> 24u;
|
||||
}
|
||||
|
||||
// HMAC-SHA256 for MAC verification
|
||||
// Key is 16 bytes (4 words), padded to 32 bytes with zeros for MeshCore
|
||||
// Returns first 2 bytes of HMAC (as u32 in high 16 bits)
|
||||
fn hmac_sha256_mac(key: array<u32, 4>, ciphertext_len: u32) -> u32 {
|
||||
// HMAC: H((K' ^ opad) || H((K' ^ ipad) || message))
|
||||
// K' is 64 bytes (32 bytes key + 32 bytes zero padding for MeshCore, then padded to 64)
|
||||
// ipad = 0x36 repeated, opad = 0x5c repeated
|
||||
|
||||
// Build padded key (64 bytes = 16 words)
|
||||
// MeshCore uses 32-byte secret: 16-byte key + 16 zero bytes
|
||||
var k_pad: array<u32, 16>;
|
||||
k_pad[0] = key[0];
|
||||
k_pad[1] = key[1];
|
||||
k_pad[2] = key[2];
|
||||
k_pad[3] = key[3];
|
||||
for (var i = 4u; i < 16u; i++) {
|
||||
k_pad[i] = 0u;
|
||||
}
|
||||
|
||||
// Inner hash: SHA256((K' ^ ipad) || message)
|
||||
// First block: K' ^ ipad (64 bytes)
|
||||
var inner_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
inner_block[i] = k_pad[i] ^ 0x36363636u;
|
||||
}
|
||||
|
||||
// Initialize hash state with first block
|
||||
var h: array<u32, 8> = sha256_block(&inner_block);
|
||||
|
||||
// Process ciphertext blocks (continuing from h state)
|
||||
let ciphertext_words = params.ciphertext_words;
|
||||
var word_idx = 0u;
|
||||
|
||||
// Process full 64-byte blocks of ciphertext
|
||||
while (word_idx + 16u <= ciphertext_words) {
|
||||
var block: array<u32, 16>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
block[i] = ciphertext[word_idx + i];
|
||||
}
|
||||
h = sha256_block_continue(&block, h);
|
||||
word_idx = word_idx + 16u;
|
||||
}
|
||||
|
||||
// Final block with remaining ciphertext + padding
|
||||
var final_block: array<u32, 16>;
|
||||
var remaining = ciphertext_words - word_idx;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
if (i < remaining) {
|
||||
final_block[i] = ciphertext[word_idx + i];
|
||||
} else if (i == remaining) {
|
||||
// Add 0x80 padding
|
||||
final_block[i] = 0x80000000u;
|
||||
} else {
|
||||
final_block[i] = 0u;
|
||||
}
|
||||
}
|
||||
|
||||
// Add length (64 bytes of ipad + ciphertext length)
|
||||
let total_bits = 512u + params.ciphertext_len_bits;
|
||||
if (remaining < 14u) {
|
||||
final_block[14] = 0u;
|
||||
final_block[15] = total_bits;
|
||||
h = sha256_block_continue(&final_block, h);
|
||||
} else {
|
||||
// Need extra block for length
|
||||
h = sha256_block_continue(&final_block, h);
|
||||
var len_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 14u; i++) {
|
||||
len_block[i] = 0u;
|
||||
}
|
||||
len_block[14] = 0u;
|
||||
len_block[15] = total_bits;
|
||||
h = sha256_block_continue(&len_block, h);
|
||||
}
|
||||
|
||||
let inner_hash = h;
|
||||
|
||||
// Outer hash: SHA256((K' ^ opad) || inner_hash)
|
||||
var outer_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
outer_block[i] = k_pad[i] ^ 0x5c5c5c5cu;
|
||||
}
|
||||
h = sha256_block(&outer_block);
|
||||
|
||||
// Second block: inner_hash (32 bytes) + padding
|
||||
var hash_block: array<u32, 16>;
|
||||
for (var i = 0u; i < 8u; i++) {
|
||||
hash_block[i] = inner_hash[i];
|
||||
}
|
||||
hash_block[8] = 0x80000000u;
|
||||
for (var i = 9u; i < 14u; i++) {
|
||||
hash_block[i] = 0u;
|
||||
}
|
||||
hash_block[14] = 0u;
|
||||
hash_block[15] = 512u + 256u; // 64 bytes opad + 32 bytes inner hash
|
||||
|
||||
h = sha256_block_continue(&hash_block, h);
|
||||
|
||||
// Return first 2 bytes (high 16 bits of first word)
|
||||
return h[0] & 0xFFFF0000u;
|
||||
}
|
||||
|
||||
// SHA256 block computation continuing from existing state
|
||||
fn sha256_block_continue(msg: ptr<function, array<u32, 16>>, h_in: array<u32, 8>) -> array<u32, 8> {
|
||||
var h = h_in;
|
||||
|
||||
// Message schedule
|
||||
var w: array<u32, 64>;
|
||||
for (var i = 0u; i < 16u; i++) {
|
||||
w[i] = (*msg)[i];
|
||||
}
|
||||
for (var i = 16u; i < 64u; i++) {
|
||||
w[i] = gamma1(w[i-2u]) + w[i-7u] + gamma0(w[i-15u]) + w[i-16u];
|
||||
}
|
||||
|
||||
// Compression
|
||||
var a = h[0]; var b = h[1]; var c = h[2]; var d = h[3];
|
||||
var e = h[4]; var f = h[5]; var g = h[6]; var hh = h[7];
|
||||
|
||||
for (var i = 0u; i < 64u; i++) {
|
||||
let t1 = hh + sigma1(e) + ch(e, f, g) + K[i] + w[i];
|
||||
let t2 = sigma0(a) + maj(a, b, c);
|
||||
hh = g; g = f; f = e; e = d + t1;
|
||||
d = c; c = b; b = a; a = t1 + t2;
|
||||
}
|
||||
|
||||
h[0] = h[0] + a; h[1] = h[1] + b; h[2] = h[2] + c; h[3] = h[3] + d;
|
||||
h[4] = h[4] + e; h[5] = h[5] + f; h[6] = h[6] + g; h[7] = h[7] + hh;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
// Process a single candidate and record match if found
|
||||
fn process_candidate(name_idx: u32) {
|
||||
// Generate message for this room name
|
||||
var msg: array<u32, 16>;
|
||||
let valid = index_to_room_name(name_idx, params.name_length, &msg);
|
||||
|
||||
if (!valid) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Compute SHA256("#roomname") - this gives us the key
|
||||
let key_hash = sha256_block(&msg);
|
||||
|
||||
// Take first 16 bytes (4 words) as the key
|
||||
var key: array<u32, 4>;
|
||||
key[0] = key_hash[0];
|
||||
key[1] = key_hash[1];
|
||||
key[2] = key_hash[2];
|
||||
key[3] = key_hash[3];
|
||||
|
||||
// Compute SHA256(key) to get channel hash
|
||||
let channel_hash = sha256_key(key);
|
||||
|
||||
// Check if channel hash matches target
|
||||
if (channel_hash != params.target_channel_hash) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Channel hash matches - verify MAC if enabled
|
||||
if (params.verify_mac == 1u) {
|
||||
let computed_mac = hmac_sha256_mac(key, params.ciphertext_len_bits);
|
||||
if (computed_mac != params.target_mac) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Found a match - record the index
|
||||
let match_idx = atomicAdd(&match_count, 1u);
|
||||
if (match_idx < 1024u) { // Limit stored matches
|
||||
match_indices[match_idx] = name_idx;
|
||||
}
|
||||
}
|
||||
|
||||
// Each thread processes 16 candidates to amortize thread overhead
|
||||
const CANDIDATES_PER_THREAD: u32 = 16u;
|
||||
|
||||
@compute @workgroup_size(256)
|
||||
fn main(@builtin(global_invocation_id) global_id: vec3<u32>) {
|
||||
let base_idx = global_id.x * CANDIDATES_PER_THREAD;
|
||||
|
||||
for (var i = 0u; i < CANDIDATES_PER_THREAD; i++) {
|
||||
let idx = base_idx + i;
|
||||
if (idx >= params.batch_size) {
|
||||
return;
|
||||
}
|
||||
let name_idx = params.batch_offset + idx;
|
||||
process_candidate(name_idx);
|
||||
}
|
||||
}
|
||||
`}async init(){if(!navigator.gpu)return console.warn("WebGPU not supported"),!1;try{const a=await navigator.gpu.requestAdapter();if(!a)return console.warn("No GPU adapter found"),!1;this.device=await a.requestDevice(),this.bindGroupLayout=this.device.createBindGroupLayout({entries:[{binding:0,visibility:GPUShaderStage.COMPUTE,buffer:{type:"uniform"}},{binding:1,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:2,visibility:GPUShaderStage.COMPUTE,buffer:{type:"storage"}},{binding:3,visibility:GPUShaderStage.COMPUTE,buffer:{type:"read-only-storage"}}]}),this.paramsBuffer=this.device.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST}),this.matchCountBuffer=this.device.createBuffer({size:4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC|GPUBufferUsage.COPY_DST}),this.matchIndicesBuffer=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_SRC});for(let d=0;d<2;d++)this.matchCountReadBuffers[d]=this.device.createBuffer({size:4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST}),this.matchIndicesReadBuffers[d]=this.device.createBuffer({size:1024*4,usage:GPUBufferUsage.MAP_READ|GPUBufferUsage.COPY_DST});const s=this.device.createShaderModule({code:this.shaderCode}),l=this.device.createPipelineLayout({bindGroupLayouts:[this.bindGroupLayout]});return this.pipeline=this.device.createComputePipeline({layout:l,compute:{module:s,entryPoint:"main"}}),!0}catch(a){return console.error("WebGPU initialization failed:",a),!1}}isAvailable(){return this.device!==null&&this.pipeline!==null}indexToRoomName(a,s){return Ho(s,a)}countNamesForLength(a){return el(a)}async runBatch(a,s,l,d,f,m){if(!this.device||!this.pipeline||!this.bindGroupLayout||!this.paramsBuffer||!this.matchCountBuffer||!this.matchIndicesBuffer||!this.matchCountReadBuffers[0]||!this.matchCountReadBuffers[1]||!this.matchIndicesReadBuffers[0]||!this.matchIndicesReadBuffers[1])throw new Error("GPU not initialized");const h=this.currentReadBufferIndex;this.currentReadBufferIndex=1-this.currentReadBufferIndex;const x=this.matchCountReadBuffers[h],p=this.matchIndicesReadBuffers[h],y=f&&m?1:0;let v,w=0,k=0;if(y){const N=new Uint8Array(f.length/2);for(let U=0;U<N.length;U++)N[U]=parseInt(f.substr(U*2,2),16);w=N.length*8;const z=Math.ceil(N.length/4)*4,H=new Uint8Array(z);H.set(N),v=new Uint32Array(z/4);for(let U=0;U<v.length;U++)v[U]=H[U*4]<<24|H[U*4+1]<<16|H[U*4+2]<<8|H[U*4+3];const j=parseInt(m.substr(0,2),16),Q=parseInt(m.substr(2,2),16);k=j<<24|Q<<16}else v=new Uint32Array([0]);const S=Math.max(v.length*4,4);(!this.ciphertextBuffer||this.ciphertextBufferSize<S)&&(this.ciphertextBuffer&&this.ciphertextBuffer.destroy(),this.ciphertextBuffer=this.device.createBuffer({size:S,usage:GPUBufferUsage.STORAGE|GPUBufferUsage.COPY_DST}),this.ciphertextBufferSize=S,this.bindGroupDirty=!0);const E=new Uint32Array([a,l,s,d,k,v.length,w,y]);this.device.queue.writeBuffer(this.paramsBuffer,0,E),this.device.queue.writeBuffer(this.ciphertextBuffer,0,v),this.device.queue.writeBuffer(this.matchCountBuffer,0,Kc.ZERO_DATA),(this.bindGroupDirty||!this.bindGroup)&&(this.bindGroup=this.device.createBindGroup({layout:this.bindGroupLayout,entries:[{binding:0,resource:{buffer:this.paramsBuffer}},{binding:1,resource:{buffer:this.matchCountBuffer}},{binding:2,resource:{buffer:this.matchIndicesBuffer}},{binding:3,resource:{buffer:this.ciphertextBuffer}}]}),this.bindGroupDirty=!1);const b=this.device.createCommandEncoder(),D=b.beginComputePass();D.setPipeline(this.pipeline),D.setBindGroup(0,this.bindGroup),D.dispatchWorkgroups(Math.ceil(d/(256*16))),D.end(),b.copyBufferToBuffer(this.matchCountBuffer,0,x,0,4),b.copyBufferToBuffer(this.matchIndicesBuffer,0,p,0,1024*4),this.device.queue.submit([b.finish()]),await x.mapAsync(GPUMapMode.READ);const B=new Uint32Array(x.getMappedRange())[0];x.unmap();const I=[];if(B>0){await p.mapAsync(GPUMapMode.READ);const N=new Uint32Array(p.getMappedRange());for(let z=0;z<Math.min(B,1024);z++)I.push(N[z]);p.unmap()}return I}destroy(){var a,s,l,d,f,m,h,x;(a=this.paramsBuffer)==null||a.destroy(),(s=this.matchCountBuffer)==null||s.destroy(),(l=this.matchIndicesBuffer)==null||l.destroy(),(d=this.ciphertextBuffer)==null||d.destroy(),(f=this.matchCountReadBuffers[0])==null||f.destroy(),(m=this.matchCountReadBuffers[1])==null||m.destroy(),(h=this.matchIndicesReadBuffers[0])==null||h.destroy(),(x=this.matchIndicesReadBuffers[1])==null||x.destroy(),this.paramsBuffer=null,this.matchCountBuffer=null,this.matchIndicesBuffer=null,this.ciphertextBuffer=null,this.ciphertextBufferSize=0,this.matchCountReadBuffers=[null,null],this.matchIndicesReadBuffers=[null,null],this.currentReadBufferIndex=0,this.bindGroup=null,this.bindGroupDirty=!0,this.device&&(this.device.destroy(),this.device=null),this.pipeline=null,this.bindGroupLayout=null}}Kc.ZERO_DATA=new Uint32Array([0]);function Mb(){return typeof navigator<"u"&&"gpu"in navigator}class fA{runBatch(a,s,l,d,f,m){const h=[],x=a.toString(16).padStart(2,"0")
Line truncated
|
||||
`).map(f=>f.trim().toLowerCase()).filter(f=>f.length>0);this.wordlist=d.filter(hA)}setWordlist(a){this.wordlist=a.map(s=>s.trim().toLowerCase()).filter(hA)}abort(){this.abortFlag=!0}isGpuAvailable(){return Mb()}async decodePacket(a){var l;const s=a.trim().replace(/\s+/g,"").replace(/^0x/i,"");if(!s||!/^[0-9a-fA-F]+$/.test(s))return null;try{const f=(l=(await uA.MeshCorePacketDecoder.decodeWithVerification(s,{})).payload)==null?void 0:l.decoded;return!(f!=null&&f.channelHash)||!(f!=null&&f.ciphertext)||!(f!=null&&f.cipherMac)?null:{channelHash:f.channelHash,ciphertext:f.ciphertext,cipherMac:f.cipherMac,isGroupText:!0}}catch{return null}}async crack(a,s,l){this.abortFlag=!1,this.useTimestampFilter=(s==null?void 0:s.useTimestampFilter)??!0,this.useUtf8Filter=(s==null?void 0:s.useUtf8Filter)??!0,this.validSeconds=(s==null?void 0:s.validSeconds)??e0,this.useCpu=(s==null?void 0:s.forceCpu)??!1;const d=(s==null?void 0:s.maxLength)??8,f=(s==null?void 0:s.startingLength)??1,m=(s==null?void 0:s.useDictionary)??!0,h=(s==null?void 0:s.startFromType)??"bruteforce",x=a.toLowerCase(),p=await this.decodePacket(x);if(!p)return{found:!1,error:"Invalid packet or not a GroupText packet"};const{channelHash:y,ciphertext:v,cipherMac:w}=p,k=parseInt(y,16);this.useCpu?this.cpuInstance||(this.cpuInstance=new fA):this.gpuInstance||(this.gpuInstance=new Kc,await this.gpuInstance.init()||(this.useCpu=!0,this.cpuInstance=new fA));const S=performance.now();let E=0,b=performance.now(),D=f,T=0,B=0,I=!1;if(s!=null&&s.startFrom){const X=s.startFrom.toLowerCase();if(h==="dictionary"){const oe=this.wordlist.indexOf(X);oe>=0&&(B=oe+1)}else{I=!0;const oe=Fb(X);oe&&(D=Math.max(f,oe.length),T=oe.index+1,T>=el(D)&&(D++,T=0))}}let N=0;m&&!I&&this.wordlist.length>0&&(N+=this.wordlist.length-B);for(let X=D;X<=d;X++)N+=el(X);N-=T;const z=(X,oe,pe)=>{if(!l)return;const he=(performance.now()-S)/1e3,q=he>0?Math.round(E/he):0,Ae=N-E,ne=q>0?Ae/q:0;l({checked:E,total:N,percent:N>0?Math.min(100,E/N*100):0,rateKeysPerSec:q,etaSeconds:ne,elapsedSeconds:he,currentLength:oe,currentPosition:pe,phase:X})},H=X=>{if(!Sx(v,w,X))return{valid:!1};const oe=uA.ChannelCrypto.decryptGroupTextMessage(v,w,X);return!oe.success||!oe.data?{valid:!1}:this.useTimestampFilter&&!Nb(oe.data.timestamp,this.validSeconds)?{valid:!1}:this.useUtf8Filter&&!Lb(oe.data.message)?{valid:!1}:{valid:!0,message:oe.data.message}};if(!I&&B===0&&D===f&&T===0){z("public-key",0,Jf);const X=n0(_c);if(y===X){const oe=H(_c);if(oe.valid)return{found:!0,roomName:Jf,key:_c,decryptedMessage:oe.message}}}if(m&&!I&&this.wordlist.length>0)for(let X=B;X<this.wordlist.length;X++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:this.wordlist[X],resumeType:"dictionary"};const oe=this.wordlist[X],pe=t0("#"+oe),se=n0(pe);if(parseInt(se,16)===k){const q=H(pe);if(q.valid)return{found:!0,roomName:oe,key:pe,decryptedMessage:q.message,resumeFrom:oe,resumeType:"dictionary"}}E++;const he=performance.now();he-b>=200&&(z("wordlist",oe.length,oe),b=he,await new Promise(q=>setTimeout(q,0)))}const j=this.useCpu?1024:32768,Q=(s==null?void 0:s.gpuDispatchMs)??1e3;let U=j,V=!1;for(let X=D;X<=d;X++){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Ho(X,0)||void 0,resumeType:"bruteforce"};const oe=el(X);let pe=X===D?T:0;for(;pe<oe;){if(this.abortFlag)return{found:!1,aborted:!0,resumeFrom:Ho(X,pe)||void 0,resumeType:"bruteforce"};const se=Math.min(U,oe-pe),he=performance.now();let q;this.useCpu?q=this.cpuInstance.runBatch(k,X,pe,se,v,w):q=await this.gpuInstance.runBatch(k,X,pe,se,v,w);const Ae=performance.now()-he;if(E+=se,!this.useCpu&&!V&&se>=j&&Ae>0){const P=Q/Ae,Z=Math.round(se*P),K=Math.pow(2,Math.round(Math.log2(Math.max(j,Z))));U=Math.max(j,K),V=!0}for(const P of q){const Z=Ho(X,P);if(!Z)continue;const K=t0("#"+Z),Y=H(K);if(Y.valid)return{found:!0,roomName:Z,key:K,decryptedMessage:Y.message,resumeFrom:Z,resumeType:"bruteforce"}}pe+=se;const ne=performance.now();if(ne-b>=200){const P=Ho(X,Math.min(pe,oe-1))||"";z("bruteforce",X,P),b=ne,await new Promise(Z=>setTimeout(Z,0))}}}return{found:!1,resumeFrom:Ho(d,el(d)-1)||void 0,resumeType:"bruteforce"}}destroy(){this.gpuInstance&&(this.gpuInstance.destroy(),this.gpuInstance=null),this.cpuInstance&&(this.cpuInstance.destroy(),this.cpuInstance=null)}}var jf,pA;function Hb(){return pA||(pA=1,jf={webm:"data:video/webm;base64,GkXfowEAAAAAAAAfQoaBAUL3gQFC8oEEQvOBCEKChHdlYm1Ch4EEQoWBAhhTgGcBAAAAAAAVkhFNm3RALE27i1OrhBVJqWZTrIHfTbuMU6uEFlSua1OsggEwTbuMU6uEHFO7a1OsghV17AEAAAAAAACkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmAQAAAAAAAEUq17GDD0JATYCNTGF2ZjU1LjMzLjEwMFdBjUxhdmY1NS4zMy4xMDBzpJBlrrXf3DCDVB8KcgbMpcr+RImIQJBgAAAAAAAWVK5rAQAAAAAAD++uAQAAAAAAADLXgQFzxYEBnIEAIrWcg3VuZIaFVl9WUDiDgQEj44OEAmJaAOABAAAAAAAABrCBsLqBkK4BAAAAAAAPq9eBAnPFgQKcgQAitZyDdW5khohBX1ZPUkJJU4OBAuEBAAAAAAAAEZ+BArWIQOdwAAAAAABiZIE
Line truncated
|
||||
NoSleep enabled for older iOS devices. This can interrupt
|
||||
active or long-running network requests from completing successfully.
|
||||
See https://github.com/richtr/NoSleep.js/issues/15 for more details.
|
||||
`),this.noSleepTimer=window.setInterval(()=>{document.hidden||(window.location.href=window.location.href.split("#")[0],window.setTimeout(window.stop,0))},15e3),this.enabled=!0,Promise.resolve()):this.noSleepVideo.play().then(h=>(this.enabled=!0,h)).catch(h=>{throw this.enabled=!1,h})}disable(){l()?(this._wakeLock&&this._wakeLock.release(),this._wakeLock=null):s()?this.noSleepTimer&&(console.warn(`
|
||||
NoSleep now disabled for older iOS devices.
|
||||
`),window.clearInterval(this.noSleepTimer),this.noSleepTimer=null):this.noSleepVideo.pause(),this.enabled=!1}}return Hf=d,Hf}var Ub=Vb();const Zb=Us(Ub);function Wb(r){if(r.length<4)return null;try{const s=parseInt(r.slice(0,2),16)&3;let l=2;if(s===0||s===3){if(r.length<l+8)return null;l+=8}if(r.length<l+2)return null;const d=parseInt(r.slice(l,l+2),16);l+=2;const f=d*2;return r.length<l+f?null:(l+=f,r.slice(l))}catch{return null}}function qb({packets:r,channels:a,onChannelCreate:s,onRunningChange:l,visible:d=!1}){const[f,m]=F.useState(!1),[h,x]=F.useState(6),[p,y]=F.useState(!1),[v,w]=F.useState(!0),[k,S]=F.useState(!1),[E,b]=F.useState(null),[D,T]=F.useState(new Map),[B,I]=F.useState([]),[N,z]=F.useState(!1),[H,j]=F.useState(null),[Q,U]=F.useState(null),[V,J]=F.useState(0),X=F.useRef(null),oe=F.useRef(null),pe=F.useRef(!1),se=F.useRef(!1),he=F.useRef(!1),q=F.useRef(new Map),Ae=F.useRef(!1),ne=F.useRef(6),P=F.useRef(!0),Z=F.useRef(!1),K=F.useRef(new Set),Y=F.useRef(new Set);F.useEffect(()=>{const ke=new jb;X.current=ke,j(ke.isGpuAvailable());const Ze=new Zb;return oe.current=Ze,()=>{ke.destroy(),X.current=null,Ze.disable(),oe.current=null}},[]),F.useEffect(()=>{!d||N||O2(async()=>{const{ENGLISH_WORDLIST:ke}=await import("./wordlist-BV_32SRm.js");return{ENGLISH_WORDLIST:ke}},[]).then(({ENGLISH_WORDLIST:ke})=>{X.current&&(X.current.setWordlist(ke),z(!0))}).catch(ke=>{console.error("Failed to load wordlist:",ke),It.error("Failed to load wordlist",{description:"Cracking will not be available"})})},[d,N]),F.useEffect(()=>{const ke=()=>{st.getUndecryptedPacketCount().then(({count:Xe})=>U(Xe)).catch(()=>U(null))};ke();const Ze=setInterval(ke,3e4);return()=>clearInterval(Ze)},[]);const fe=new Set(a.map(ke=>ke.key.toUpperCase())),me=r.filter(ke=>ke.payload_type==="GROUP_TEXT"&&!ke.decrypted);F.useEffect(()=>{let ke=0;T(Ze=>{const Xe=new Map(Ze);let Bt=!1;for(const ct of me)if(!Xe.has(ct.id)){const vt=Wb(ct.data);if(vt&&Y.current.has(vt)){ke++;continue}vt&&Y.current.add(vt),Xe.set(ct.id,{packet:ct,attempts:0,lastAttemptLength:0,status:"pending"}),Bt=!0}return Bt?(q.current=Xe,Xe):Ze}),ke>0&&J(Ze=>Ze+ke)},[me.length]),F.useEffect(()=>{q.current=D},[D]),F.useEffect(()=>{Ae.current=p},[p]),F.useEffect(()=>{ne.current=h},[h]),F.useEffect(()=>{P.current=v},[v]),F.useEffect(()=>{Z.current=k},[k]),F.useEffect(()=>{K.current=new Set(me.map(ke=>ke.id))},[me]),F.useEffect(()=>{l==null||l(f)},[f,l]);const Ee=Array.from(D.values()).filter(ke=>ke.status==="pending").length,ge=Array.from(D.values()).filter(ke=>ke.status==="cracked").length,je=Array.from(D.values()).filter(ke=>ke.status==="failed").length,Ge=F.useCallback(async()=>{if(he.current||!X.current||!pe.current)return;const ke=q.current;let Ze=null,Xe=null;for(const[Qe,rt]of ke.entries())if(rt.status==="pending"){Ze=rt,Xe=Qe;break}if(!Ze&&Ae.current){const Qe=Array.from(ke.entries()).filter(([,rt])=>rt.status==="failed"&&rt.lastAttemptLength<10);Qe.length>0&&(Qe.sort((rt,et)=>rt[1].lastAttemptLength-et[1].lastAttemptLength),[Xe,Ze]=Qe[0])}if(!Ze||Xe===null){pe.current&&setTimeout(()=>Ge(),1e3);return}if(!K.current.has(Xe)){T(Qe=>{const rt=new Map(Qe);return rt.delete(Xe),rt}),pe.current&&setTimeout(()=>Ge(),10);return}he.current=!0;const Bt=ne.current,ct=Ze.lastAttemptLength>0,vt=ct?Ze.lastAttemptLength+1:Bt;try{const Qe=await X.current.crack(Ze.packet.data,{maxLength:vt,useTimestampFilter:!0,useUtf8Filter:!0,...Z.current&&{gpuDispatchMs:1e4},...ct&&{useDictionary:!1,startingLength:vt}},rt=>{b(rt)});if(se.current){se.current=!1,he.current=!1,b(null);return}if(Qe.found&&Qe.roomName&&Qe.key){T(Ie=>{const Ct=new Map(Ie),Yt=Ct.get(Xe);return Yt&&Ct.set(Xe,{...Yt,status:"cracked",attempts:Yt.attempts+1,lastAttemptLength:vt}),Ct});const rt={roomName:Qe.roomName,key:Qe.key,packetId:Xe,message:Qe.decryptedMessage||"",crackedAt:Date.now()};I(Ie=>[...Ie,rt]);const et=Qe.key.toUpperCase();if(!fe.has(et))try{const Ie="#"+Qe.roomName;await s(Ie,Qe.key),P.current&&await st.decryptHistoricalPackets({key_type:"channel",channel_name:Ie})}catch(Ie){console.error("Failed to create channel or decrypt historical:",Ie),It.error("Failed to save cracked channel",{description:Ie instanceof Error?Ie.message:"Channel discovered but could not be saved"})}}else T(rt=>{const et=new Map(rt),Ie=et.get(Xe);return Ie&&et.set(Xe,{...Ie,status:"failed",attempts:Ie.attempts+1,lastAttemptLength:vt}),et})}catch(Qe){console.error("Cracking error:",Qe),T(rt=>{const et=new Map(rt),Ie=et.get(Xe);return Ie&&et.set(Xe,{...Ie,status:"failed",attempts:Ie.attempts+1,lastAttemptLength:vt}),et})}he.current=!1,b(null),pe.current&&setTimeout(()=>Ge(),100)},[fe,s]),wt=()=>{var ke;if(!H){It.error("WebGPU not available",{description:"Cracking requires Chrome 113+ or Edge 113+ with WebGPU support."});return}m(!0),pe.current=!0,se.current=!1,(ke=oe.current)==null||ke.enable(),Ge()},xt=()=>{var ke,Ze;m(!1),pe.current=!1,se.current=!0,(ke=X.current)==null||ke.abort(),(Ze=oe.current)==null||Ze.disable()};return R.jsxs("di
Line truncated
|
||||
//# sourceMappingURL=index-EJf0Snt6.js.map
|
||||
-1
@@ -1 +0,0 @@
|
||||
{"version":3,"mappings":";;;;;;;;6CASa,IAAIA,EAAE,OAAO,IAAI,eAAe,EAAEC,EAAE,OAAO,IAAI,cAAc,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,mBAAmB,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,eAAe,EAAEC,EAAE,OAAO,IAAI,mBAAmB,EAAEC,EAAE,OAAO,IAAI,gBAAgB,EAAEC,EAAE,OAAO,IAAI,YAAY,EAAE,EAAE,OAAO,IAAI,YAAY,EAAEC,EAAE,OAAO,SAAS,SAASC,EAAEC,EAAE,CAAC,OAAUA,IAAP,MAAqB,OAAOA,GAAlB,SAA2B,MAAKA,EAAEF,GAAGE,EAAEF,CAAC,GAAGE,EAAE,YAAY,EAAqB,OAAOA,GAApB,WAAsBA,EAAE,KAAI,CAC1e,IAAIC,EAAE,CAAC,UAAU,UAAU,CAAC,MAAM,EAAE,EAAE,mBAAmB,UAAU,GAAG,oBAAoB,UAAU,GAAG,gBAAgB,UAAU,EAAE,EAAEC,EAAE,OAAO,OAAOC,EAAE,GAAG,SAASC,EAAEJ,EAAEK,EAAEC,EAAE,CAAC,KAAK,MAAMN,EAAE,KAAK,QAAQK,EAAE,KAAK,KAAKF,EAAE,KAAK,QAAQG,GAAGL,CAAC,CAACG,EAAE,UAAU,iBAAiB,GACnQA,EAAE,UAAU,SAAS,SAASJ,EAAEK,EAAE,CAAC,GAAc,OAAOL,GAAlB,UAAkC,OAAOA,GAApB,YAA6BA,GAAN,KAAQ,MAAM,MAAM,uHAAuH,EAAE,KAAK,QAAQ,gBAAgB,KAAKA,EAAEK,EAAE,UAAU,CAAC,EAAED,EAAE,UAAU,YAAY,SAASJ,EAAE,CAAC,KAAK,QAAQ,mBAAmB,KAAKA,EAAE,aAAa,CAAC,EAAE,SAASO,GAAG,EAAEA,EAAE,UAAUH,EAAE,UAAU,SAASI,EAAER,EAAEK,EAAEC,EAAE,CAAC,KAAK,MAAMN,EAAE,KAAK,QAAQK,EAAE,KAAK,KAAKF,EAAE,KAAK,QAAQG,GAAGL,CAAC,CAAC,IAAIQ,EAAED,EAAE,UAAU,IAAID,EACrfE,EAAE,YAAYD,EAAEN,EAAEO,EAAEL,EAAE,SAAS,EAAEK,EAAE,qBAAqB,GAAG,IAAI,EAAE,MAAM,QAAQC,EAAE,OAAO,UAAU,eAAeC,EAAE,CAAC,QAAQ,IAAI,EAAEC,EAAE,CAAC,IAAI,GAAG,IAAI,GAAG,OAAO,GAAG,SAAS,EAAE,EACxK,SAASC,EAAEb,EAAEK,EAAEC,EAAE,CAAC,IAAIQ,EAAEC,GAAE,GAAGC,GAAE,KAAKC,GAAE,KAAK,GAASZ,GAAN,KAAQ,IAAIS,KAAcT,EAAE,MAAX,SAAiBY,GAAEZ,EAAE,KAAcA,EAAE,MAAX,SAAiBW,GAAE,GAAGX,EAAE,KAAKA,EAAEK,EAAE,KAAKL,EAAES,CAAC,GAAG,CAACF,EAAE,eAAeE,CAAC,IAAIC,GAAED,CAAC,EAAET,EAAES,CAAC,GAAG,IAAII,GAAE,UAAU,OAAO,EAAE,GAAOA,KAAJ,EAAMH,GAAE,SAAST,UAAU,EAAEY,GAAE,CAAC,QAAQC,GAAE,MAAMD,EAAC,EAAEE,GAAE,EAAEA,GAAEF,GAAEE,KAAID,GAAEC,EAAC,EAAE,UAAUA,GAAE,CAAC,EAAEL,GAAE,SAASI,EAAC,CAAC,GAAGnB,GAAGA,EAAE,aAAa,IAAIc,KAAKI,GAAElB,EAAE,aAAakB,GAAWH,GAAED,CAAC,IAAZ,SAAgBC,GAAED,CAAC,EAAEI,GAAEJ,CAAC,GAAG,MAAM,CAAC,SAAS1B,EAAE,KAAKY,EAAE,IAAIgB,GAAE,IAAIC,GAAE,MAAMF,GAAE,OAAOJ,EAAE,OAAO,CAAC,CAC7a,SAASU,EAAErB,EAAEK,EAAE,CAAC,MAAM,CAAC,SAASjB,EAAE,KAAKY,EAAE,KAAK,IAAIK,EAAE,IAAIL,EAAE,IAAI,MAAMA,EAAE,MAAM,OAAOA,EAAE,MAAM,CAAC,CAAC,SAASsB,EAAEtB,EAAE,CAAC,OAAiB,OAAOA,GAAlB,UAA4BA,IAAP,MAAUA,EAAE,WAAWZ,CAAC,CAAC,SAASmC,EAAOvB,EAAE,CAAC,IAAIK,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,EAAE,MAAM,IAAIL,EAAE,QAAQ,QAAQ,SAASA,EAAE,CAAC,OAAOK,EAAEL,CAAC,CAAC,CAAC,CAAC,CAAC,IAAIwB,EAAE,OAAO,SAASC,EAAEzB,EAAEK,EAAE,CAAC,OAAiB,OAAOL,GAAlB,UAA4BA,IAAP,MAAgBA,EAAE,KAAR,KAAYuB,EAAO,GAAGvB,EAAE,GAAG,EAAEK,EAAE,SAAS,EAAE,CAAC,CAC/W,SAASqB,GAAE1B,EAAEK,EAAEC,EAAEQ,EAAEC,GAAE,CAAC,IAAIC,GAAE,OAAOhB,GAAmBgB,KAAd,aAA6BA,KAAZ,aAAchB,EAAE,MAAK,IAAIiB,GAAE,GAAG,GAAUjB,IAAP,KAASiB,GAAE,OAAQ,QAAOD,GAAC,CAAE,IAAK,SAAS,IAAK,SAASC,GAAE,GAAG,MAAM,IAAK,SAAS,OAAOjB,EAAE,SAAQ,CAAE,KAAKZ,EAAE,KAAKC,EAAE4B,GAAE,EAAE,CAAC,CAAC,GAAGA,GAAE,OAAOA,GAAEjB,EAAEe,GAAEA,GAAEE,EAAC,EAAEjB,EAAOc,IAAL,GAAO,IAAIW,EAAER,GAAE,CAAC,EAAEH,EAAE,EAAEC,EAAC,GAAGT,EAAE,GAASN,GAAN,OAAUM,EAAEN,EAAE,QAAQwB,EAAE,KAAK,EAAE,KAAKE,GAAEX,GAAEV,EAAEC,EAAE,GAAG,SAASN,GAAE,CAAC,OAAOA,EAAC,CAAC,GAASe,IAAN,OAAUO,EAAEP,EAAC,IAAIA,GAAEM,EAAEN,GAAET,GAAG,CAACS,GAAE,KAAKE,IAAGA,GAAE,MAAMF,GAAE,IAAI,IAAI,GAAGA,GAAE,KAAK,QAAQS,EAAE,KAAK,EAAE,KAAKxB,CAAC,GAAGK,EAAE,KAAKU,EAAC,GAAG,EAAyB,GAAvBE,GAAE,EAAEH,EAAOA,IAAL,GAAO,IAAIA,EAAE,IAAO,EAAEd,CAAC,EAAE,QAAQkB,GAAE,EAAEA,GAAElB,EAAE,OAAOkB,KAAI,CAACF,GACrfhB,EAAEkB,EAAC,EAAE,IAAIC,GAAEL,EAAEW,EAAET,GAAEE,EAAC,EAAED,IAAGS,GAAEV,GAAEX,EAAEC,EAAEa,GAAEJ,EAAC,CAAC,SAASI,GAAEpB,EAAEC,CAAC,EAAe,OAAOmB,IAApB,WAAsB,IAAInB,EAAEmB,GAAE,KAAKnB,CAAC,EAAEkB,GAAE,EAAE,EAAEF,GAAEhB,EAAE,KAAI,GAAI,MAAMgB,GAAEA,GAAE,MAAMG,GAAEL,EAAEW,EAAET,GAAEE,IAAG,EAAED,IAAGS,GAAEV,GAAEX,EAAEC,EAAEa,GAAEJ,EAAC,UAAqBC,KAAX,SAAa,MAAMX,EAAE,OAAOL,CAAC,EAAE,MAAM,mDAAuEK,IAApB,kBAAsB,qBAAqB,OAAO,KAAKL,CAAC,EAAE,KAAK,IAAI,EAAE,IAAIK,GAAG,2EAA2E,EAAE,OAAOY,EAAC,CACzZ,SAASU,GAAE3B,EAAEK,EAAEC,EAAE,CAAC,GAASN,GAAN,KAAQ,OAAOA,EAAE,IAAIc,EAAE,GAAGC,GAAE,EAAE,OAAAW,GAAE1B,EAAEc,EAAE,GAAG,GAAG,SAASd,GAAE,CAAC,OAAOK,EAAE,KAAKC,EAAEN,GAAEe,IAAG,CAAC,CAAC,EAASD,CAAC,CAAC,SAASc,GAAE5B,EAAE,CAAC,GAAQA,EAAE,UAAP,GAAe,CAAC,IAAIK,EAAEL,EAAE,QAAQK,EAAEA,EAAC,EAAGA,EAAE,KAAK,SAASA,EAAE,EAAQL,EAAE,UAAN,GAAoBA,EAAE,UAAP,MAAeA,EAAE,QAAQ,EAAEA,EAAE,QAAQK,EAAC,EAAE,SAASA,EAAE,EAAQL,EAAE,UAAN,GAAoBA,EAAE,UAAP,MAAeA,EAAE,QAAQ,EAAEA,EAAE,QAAQK,EAAC,CAAC,EAAOL,EAAE,UAAP,KAAiBA,EAAE,QAAQ,EAAEA,EAAE,QAAQK,EAAE,CAAC,GAAOL,EAAE,UAAN,EAAc,OAAOA,EAAE,QAAQ,QAAQ,MAAMA,EAAE,OAAQ,CAC5Z,IAAI6B,GAAE,CAAC,QAAQ,IAAI,EAAEC,EAAE,CAAC,WAAW,IAAI,EAAEC,GAAE,CAAC,uBAAuBF,GAAE,wBAAwBC,EAAE,kBAAkBnB,CAAC,EAAE,SAASqB,IAAG,CAAC,MAAM,MAAM,0DAA0D,CAAE,CACzM,OAAAC,GAAA,SAAiB,CAAC,IAAIN,GAAE,QAAQ,SAAS3B,EAAEK,EAAEC,EAAE,CAACqB,GAAE3B,EAAE,UAAU,CAACK,EAAE,MAAM,KAAK,SAAS,CAAC,EAAEC,CAAC,CAAC,EAAE,MAAM,SAASN,EAAE,CAAC,IAAIK,EAAE,EAAE,OAAAsB,GAAE3B,EAAE,UAAU,CAACK,GAAG,CAAC,EAASA,CAAC,EAAE,QAAQ,SAASL,EAAE,CAAC,OAAO2B,GAAE3B,EAAE,SAASA,EAAE,CAAC,OAAOA,CAAC,CAAC,GAAG,EAAE,EAAE,KAAK,SAASA,EAAE,CAAC,GAAG,CAACsB,EAAEtB,CAAC,EAAE,MAAM,MALine truncated
|
||||
Vendored
+1
-1
@@ -13,7 +13,7 @@
|
||||
<link rel="shortcut icon" href="/favicon.ico" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
|
||||
<link rel="manifest" href="/site.webmanifest" />
|
||||
<script type="module" crossorigin src="/assets/index-EJf0Snt6.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-70eOpM-W.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-DZ67iE5i.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
+33
-12
@@ -1,7 +1,7 @@
|
||||
import { useState, useEffect, useCallback, useMemo, useRef } from 'react';
|
||||
import { api } from './api';
|
||||
import { useWebSocket } from './useWebSocket';
|
||||
import { useRepeaterMode, useUnreadCounts, useConversationMessages } from './hooks';
|
||||
import { useRepeaterMode, useUnreadCounts, useConversationMessages, getMessageContentKey } from './hooks';
|
||||
import { StatusBar } from './components/StatusBar';
|
||||
import { Sidebar } from './components/Sidebar';
|
||||
import { MessageList } from './components/MessageList';
|
||||
@@ -37,8 +37,9 @@ const MAX_RAW_PACKETS = 500;
|
||||
export function App() {
|
||||
const messageInputRef = useRef<MessageInputHandle>(null);
|
||||
const activeConversationRef = useRef<Conversation | null>(null);
|
||||
// Track seen message IDs to prevent duplicate unread increments
|
||||
const seenMessageIdsRef = useRef<Set<number>>(new Set());
|
||||
// Track seen message content to prevent duplicate unread increments
|
||||
// Uses content-based key (type-conversation_key-text-sender_timestamp) for deduplication
|
||||
const seenMessageContentRef = useRef<Set<string>>(new Set());
|
||||
const [health, setHealth] = useState<HealthStatus | null>(null);
|
||||
const [config, setConfig] = useState<RadioConfig | null>(null);
|
||||
const [appSettings, setAppSettings] = useState<AppSettings | null>(null);
|
||||
@@ -57,6 +58,21 @@ export function App() {
|
||||
// Track previous health status to detect changes
|
||||
const prevHealthRef = useRef<HealthStatus | null>(null);
|
||||
|
||||
// Keep user's name in ref for mention detection in WebSocket callback
|
||||
const myNameRef = useRef<string | null>(null);
|
||||
useEffect(() => {
|
||||
myNameRef.current = config?.name ?? null;
|
||||
}, [config?.name]);
|
||||
|
||||
// Check if a message mentions the user
|
||||
const checkMention = useCallback((text: string): boolean => {
|
||||
const name = myNameRef.current;
|
||||
if (!name) return false;
|
||||
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
const mentionPattern = new RegExp(`@\\[${escaped}\\]`, 'i');
|
||||
return mentionPattern.test(text);
|
||||
}, []);
|
||||
|
||||
// Custom hooks for extracted functionality
|
||||
const {
|
||||
messages,
|
||||
@@ -72,11 +88,12 @@ export function App() {
|
||||
|
||||
const {
|
||||
unreadCounts,
|
||||
mentions,
|
||||
lastMessageTimes,
|
||||
incrementUnread,
|
||||
markAllRead,
|
||||
trackNewMessage,
|
||||
} = useUnreadCounts(channels, contacts, activeConversation);
|
||||
} = useUnreadCounts(channels, contacts, activeConversation, config?.name);
|
||||
|
||||
const {
|
||||
repeaterLoggedIn,
|
||||
@@ -137,16 +154,18 @@ export function App() {
|
||||
|
||||
// Count unread for non-active, incoming messages (with deduplication)
|
||||
if (!msg.outgoing && !isForActiveConversation) {
|
||||
// Skip if we've already seen this message ID (prevents duplicate increments)
|
||||
if (seenMessageIdsRef.current.has(msg.id)) {
|
||||
// Skip if we've already seen this message content (prevents duplicate increments
|
||||
// when the same message arrives via multiple mesh paths)
|
||||
const contentKey = getMessageContentKey(msg);
|
||||
if (seenMessageContentRef.current.has(contentKey)) {
|
||||
return;
|
||||
}
|
||||
seenMessageIdsRef.current.add(msg.id);
|
||||
seenMessageContentRef.current.add(contentKey);
|
||||
|
||||
// Limit set size to prevent memory issues
|
||||
if (seenMessageIdsRef.current.size > 1000) {
|
||||
const ids = Array.from(seenMessageIdsRef.current);
|
||||
seenMessageIdsRef.current = new Set(ids.slice(-500));
|
||||
if (seenMessageContentRef.current.size > 1000) {
|
||||
const keys = Array.from(seenMessageContentRef.current);
|
||||
seenMessageContentRef.current = new Set(keys.slice(-500));
|
||||
}
|
||||
|
||||
let stateKey: string | null = null;
|
||||
@@ -156,7 +175,8 @@ export function App() {
|
||||
stateKey = getStateKey('contact', msg.conversation_key);
|
||||
}
|
||||
if (stateKey) {
|
||||
incrementUnread(stateKey);
|
||||
const hasMention = checkMention(msg.text);
|
||||
incrementUnread(stateKey, hasMention);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -194,7 +214,7 @@ export function App() {
|
||||
onMessageAcked: (messageId: number, ackCount: number) => {
|
||||
updateMessageAck(messageId, ackCount);
|
||||
},
|
||||
}), [addMessageIfNew, trackNewMessage, incrementUnread, updateMessageAck]);
|
||||
}), [addMessageIfNew, trackNewMessage, incrementUnread, updateMessageAck, checkMention]);
|
||||
|
||||
// Connect to WebSocket
|
||||
useWebSocket(wsHandlers);
|
||||
@@ -503,6 +523,7 @@ export function App() {
|
||||
}}
|
||||
lastMessageTimes={lastMessageTimes}
|
||||
unreadCounts={unreadCounts}
|
||||
mentions={mentions}
|
||||
showCracker={showCracker}
|
||||
crackerRunning={crackerRunning}
|
||||
onToggleCracker={() => setShowCracker((prev) => !prev)}
|
||||
|
||||
@@ -18,6 +18,8 @@ interface SidebarProps {
|
||||
onNewMessage: () => void;
|
||||
lastMessageTimes: ConversationTimes;
|
||||
unreadCounts: Record<string, number>;
|
||||
/** Tracks which conversations have unread messages that mention the user */
|
||||
mentions: Record<string, boolean>;
|
||||
showCracker: boolean;
|
||||
crackerRunning: boolean;
|
||||
onToggleCracker: () => void;
|
||||
@@ -51,6 +53,7 @@ export function Sidebar({
|
||||
onNewMessage,
|
||||
lastMessageTimes,
|
||||
unreadCounts,
|
||||
mentions,
|
||||
showCracker,
|
||||
crackerRunning,
|
||||
onToggleCracker,
|
||||
@@ -79,6 +82,12 @@ export function Sidebar({
|
||||
return unreadCounts[key] || 0;
|
||||
};
|
||||
|
||||
// Check if a conversation has a mention
|
||||
const hasMention = (type: 'channel' | 'contact', id: string): boolean => {
|
||||
const key = getStateKey(type, id);
|
||||
return mentions[key] || false;
|
||||
};
|
||||
|
||||
const getLastMessageTime = (type: 'channel' | 'contact', id: string) => {
|
||||
const key = getStateKey(type, id);
|
||||
return lastMessageTimes[key] || 0;
|
||||
@@ -295,6 +304,7 @@ export function Sidebar({
|
||||
</div>
|
||||
{filteredChannels.map((channel) => {
|
||||
const unreadCount = getUnreadCount('channel', channel.key);
|
||||
const isMention = hasMention('channel', channel.key);
|
||||
return (
|
||||
<div
|
||||
key={`chan-${channel.key}`}
|
||||
@@ -314,7 +324,12 @@ export function Sidebar({
|
||||
<span className="text-muted-foreground text-xs">#</span>
|
||||
<span className="name flex-1 truncate">{channel.name}</span>
|
||||
{unreadCount > 0 && (
|
||||
<span className="bg-primary text-primary-foreground text-[10px] font-semibold px-1.5 py-0.5 rounded-full min-w-[18px] text-center">
|
||||
<span className={cn(
|
||||
"text-[10px] font-semibold px-1.5 py-0.5 rounded-full min-w-[18px] text-center",
|
||||
isMention
|
||||
? "bg-destructive text-destructive-foreground"
|
||||
: "bg-primary text-primary-foreground"
|
||||
)}>
|
||||
{unreadCount}
|
||||
</span>
|
||||
)}
|
||||
@@ -341,6 +356,7 @@ export function Sidebar({
|
||||
</div>
|
||||
{filteredContacts.map((contact) => {
|
||||
const unreadCount = getUnreadCount('contact', contact.public_key);
|
||||
const isMention = hasMention('contact', contact.public_key);
|
||||
return (
|
||||
<div
|
||||
key={contact.public_key}
|
||||
@@ -362,7 +378,12 @@ export function Sidebar({
|
||||
{getContactDisplayName(contact.name, contact.public_key)}
|
||||
</span>
|
||||
{unreadCount > 0 && (
|
||||
<span className="bg-primary text-primary-foreground text-[10px] font-semibold px-1.5 py-0.5 rounded-full min-w-[18px] text-center">
|
||||
<span className={cn(
|
||||
"text-[10px] font-semibold px-1.5 py-0.5 rounded-full min-w-[18px] text-center",
|
||||
isMention
|
||||
? "bg-destructive text-destructive-foreground"
|
||||
: "bg-primary text-primary-foreground"
|
||||
)}>
|
||||
{unreadCount}
|
||||
</span>
|
||||
)}
|
||||
|
||||
@@ -10,21 +10,40 @@ import type { Channel, Contact, Conversation, Message } from '../types';
|
||||
|
||||
export interface UseUnreadCountsResult {
|
||||
unreadCounts: Record<string, number>;
|
||||
/** Tracks which conversations have unread messages that mention the user */
|
||||
mentions: Record<string, boolean>;
|
||||
lastMessageTimes: ConversationTimes;
|
||||
incrementUnread: (stateKey: string) => void;
|
||||
incrementUnread: (stateKey: string, hasMention?: boolean) => void;
|
||||
markAllRead: () => void;
|
||||
markConversationRead: (conv: Conversation) => void;
|
||||
trackNewMessage: (msg: Message) => void;
|
||||
}
|
||||
|
||||
/** Check if a message text contains a mention of the given name in @[name] format */
|
||||
function messageContainsMention(text: string, name: string | null): boolean {
|
||||
if (!name) return false;
|
||||
// Escape special regex characters in the name
|
||||
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
const mentionPattern = new RegExp(`@\\[${escaped}\\]`, 'i');
|
||||
return mentionPattern.test(text);
|
||||
}
|
||||
|
||||
export function useUnreadCounts(
|
||||
channels: Channel[],
|
||||
contacts: Contact[],
|
||||
activeConversation: Conversation | null
|
||||
activeConversation: Conversation | null,
|
||||
myName: string | null = null
|
||||
): UseUnreadCountsResult {
|
||||
const [unreadCounts, setUnreadCounts] = useState<Record<string, number>>({});
|
||||
const [mentions, setMentions] = useState<Record<string, boolean>>({});
|
||||
const [lastMessageTimes, setLastMessageTimes] = useState<ConversationTimes>(getLastMessageTimes);
|
||||
|
||||
// Keep myName in a ref so callbacks always have current value
|
||||
const myNameRef = useRef(myName);
|
||||
useEffect(() => {
|
||||
myNameRef.current = myName;
|
||||
}, [myName]);
|
||||
|
||||
// Track which channels/contacts we've already fetched unreads for
|
||||
const fetchedChannels = useRef<Set<string>>(new Set());
|
||||
const fetchedContacts = useRef<Set<string>>(new Set());
|
||||
@@ -52,6 +71,7 @@ export function useUnreadCounts(
|
||||
try {
|
||||
const bulkMessages = await api.getMessagesBulk(conversations, 100);
|
||||
const newUnreadCounts: Record<string, number> = {};
|
||||
const newMentions: Record<string, boolean> = {};
|
||||
const newLastMessageTimes: Record<string, number> = {};
|
||||
|
||||
// Process channel messages - use server-side last_read_at
|
||||
@@ -62,9 +82,13 @@ export function useUnreadCounts(
|
||||
// Use server-side last_read_at, fallback to 0 if never read
|
||||
const lastRead = channel.last_read_at || 0;
|
||||
|
||||
const unreadCount = msgs.filter(m => !m.outgoing && m.received_at > lastRead).length;
|
||||
if (unreadCount > 0) {
|
||||
newUnreadCounts[key] = unreadCount;
|
||||
const unreadMsgs = msgs.filter(m => !m.outgoing && m.received_at > lastRead);
|
||||
if (unreadMsgs.length > 0) {
|
||||
newUnreadCounts[key] = unreadMsgs.length;
|
||||
// Check if any unread message mentions the user
|
||||
if (unreadMsgs.some(m => messageContainsMention(m.text, myNameRef.current))) {
|
||||
newMentions[key] = true;
|
||||
}
|
||||
}
|
||||
|
||||
const latestTime = Math.max(...msgs.map(m => m.received_at));
|
||||
@@ -81,9 +105,13 @@ export function useUnreadCounts(
|
||||
// Use server-side last_read_at, fallback to 0 if never read
|
||||
const lastRead = contact.last_read_at || 0;
|
||||
|
||||
const unreadCount = msgs.filter(m => !m.outgoing && m.received_at > lastRead).length;
|
||||
if (unreadCount > 0) {
|
||||
newUnreadCounts[key] = unreadCount;
|
||||
const unreadMsgs = msgs.filter(m => !m.outgoing && m.received_at > lastRead);
|
||||
if (unreadMsgs.length > 0) {
|
||||
newUnreadCounts[key] = unreadMsgs.length;
|
||||
// Check if any unread message mentions the user
|
||||
if (unreadMsgs.some(m => messageContainsMention(m.text, myNameRef.current))) {
|
||||
newMentions[key] = true;
|
||||
}
|
||||
}
|
||||
|
||||
const latestTime = Math.max(...msgs.map(m => m.received_at));
|
||||
@@ -95,6 +123,9 @@ export function useUnreadCounts(
|
||||
if (Object.keys(newUnreadCounts).length > 0) {
|
||||
setUnreadCounts(prev => ({ ...prev, ...newUnreadCounts }));
|
||||
}
|
||||
if (Object.keys(newMentions).length > 0) {
|
||||
setMentions(prev => ({ ...prev, ...newMentions }));
|
||||
}
|
||||
setLastMessageTimes(getLastMessageTimes());
|
||||
} catch (err) {
|
||||
console.error('Failed to fetch messages bulk:', err);
|
||||
@@ -107,7 +138,7 @@ export function useUnreadCounts(
|
||||
// Mark conversation as read when user views it
|
||||
// Calls server API to persist read state across devices
|
||||
useEffect(() => {
|
||||
if (activeConversation && activeConversation.type !== 'raw') {
|
||||
if (activeConversation && activeConversation.type !== 'raw' && activeConversation.type !== 'map') {
|
||||
const key = getStateKey(
|
||||
activeConversation.type as 'channel' | 'contact',
|
||||
activeConversation.id
|
||||
@@ -123,6 +154,16 @@ export function useUnreadCounts(
|
||||
return prev;
|
||||
});
|
||||
|
||||
// Also clear mentions for this conversation
|
||||
setMentions((prev) => {
|
||||
if (prev[key]) {
|
||||
const next = { ...prev };
|
||||
delete next[key];
|
||||
return next;
|
||||
}
|
||||
return prev;
|
||||
});
|
||||
|
||||
// Persist to server (fire-and-forget, errors logged but not blocking)
|
||||
if (activeConversation.type === 'channel') {
|
||||
api.markChannelRead(activeConversation.id).catch((err) => {
|
||||
@@ -137,11 +178,17 @@ export function useUnreadCounts(
|
||||
}, [activeConversation]);
|
||||
|
||||
// Increment unread count for a conversation
|
||||
const incrementUnread = useCallback((stateKey: string) => {
|
||||
const incrementUnread = useCallback((stateKey: string, hasMention?: boolean) => {
|
||||
setUnreadCounts((prev) => ({
|
||||
...prev,
|
||||
[stateKey]: (prev[stateKey] || 0) + 1,
|
||||
}));
|
||||
if (hasMention) {
|
||||
setMentions((prev) => ({
|
||||
...prev,
|
||||
[stateKey]: true,
|
||||
}));
|
||||
}
|
||||
}, []);
|
||||
|
||||
// Mark all conversations as read
|
||||
@@ -149,6 +196,7 @@ export function useUnreadCounts(
|
||||
const markAllRead = useCallback(() => {
|
||||
// Update local state immediately
|
||||
setUnreadCounts({});
|
||||
setMentions({});
|
||||
|
||||
// Persist to server with single bulk request
|
||||
api.markAllRead().catch((err) => {
|
||||
@@ -159,7 +207,7 @@ export function useUnreadCounts(
|
||||
// Mark a specific conversation as read
|
||||
// Calls server API to persist read state across devices
|
||||
const markConversationRead = useCallback((conv: Conversation) => {
|
||||
if (conv.type === 'raw') return;
|
||||
if (conv.type === 'raw' || conv.type === 'map') return;
|
||||
|
||||
const key = getStateKey(conv.type as 'channel' | 'contact', conv.id);
|
||||
|
||||
@@ -173,6 +221,16 @@ export function useUnreadCounts(
|
||||
return prev;
|
||||
});
|
||||
|
||||
// Also clear mentions for this conversation
|
||||
setMentions((prev) => {
|
||||
if (prev[key]) {
|
||||
const next = { ...prev };
|
||||
delete next[key];
|
||||
return next;
|
||||
}
|
||||
return prev;
|
||||
});
|
||||
|
||||
// Persist to server (fire-and-forget)
|
||||
if (conv.type === 'channel') {
|
||||
api.markChannelRead(conv.id).catch((err) => {
|
||||
@@ -203,6 +261,7 @@ export function useUnreadCounts(
|
||||
|
||||
return {
|
||||
unreadCounts,
|
||||
mentions,
|
||||
lastMessageTimes,
|
||||
incrementUnread,
|
||||
markAllRead,
|
||||
|
||||
@@ -175,3 +175,70 @@ describe('getUnreadCount', () => {
|
||||
expect(getUnreadCount('contact', 'xyz999999999fullkey12345678901234567890123456789', counts)).toBe(0);
|
||||
});
|
||||
});
|
||||
|
||||
/**
|
||||
* Check if a message text contains a mention of the given name in @[name] format.
|
||||
* Extracted from useUnreadCounts.ts for testing.
|
||||
*/
|
||||
function messageContainsMention(text: string, name: string | null): boolean {
|
||||
if (!name) return false;
|
||||
// Escape special regex characters in the name
|
||||
const escaped = name.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||
const mentionPattern = new RegExp(`@\\[${escaped}\\]`, 'i');
|
||||
return mentionPattern.test(text);
|
||||
}
|
||||
|
||||
describe('messageContainsMention', () => {
|
||||
it('returns true when text contains mention of the name', () => {
|
||||
expect(messageContainsMention('Hey @[Alice] check this out', 'Alice')).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false when text does not contain the mention', () => {
|
||||
expect(messageContainsMention('Hey Alice check this out', 'Alice')).toBe(false);
|
||||
});
|
||||
|
||||
it('returns false when name is null', () => {
|
||||
expect(messageContainsMention('Hey @[Alice] check this out', null)).toBe(false);
|
||||
});
|
||||
|
||||
it('returns false when text is empty', () => {
|
||||
expect(messageContainsMention('', 'Alice')).toBe(false);
|
||||
});
|
||||
|
||||
it('matches case insensitively', () => {
|
||||
expect(messageContainsMention('Hey @[ALICE] check this out', 'alice')).toBe(true);
|
||||
expect(messageContainsMention('Hey @[alice] check this out', 'ALICE')).toBe(true);
|
||||
});
|
||||
|
||||
it('handles emojis in names', () => {
|
||||
expect(messageContainsMention('Hey @[FlightlessDt🥝] nice!', 'FlightlessDt🥝')).toBe(true);
|
||||
expect(messageContainsMention('Hey @[🎉Party🎉]', '🎉Party🎉')).toBe(true);
|
||||
});
|
||||
|
||||
it('handles special regex characters in names', () => {
|
||||
// Names with characters that have special meaning in regex
|
||||
expect(messageContainsMention('Hey @[Test.User] hello', 'Test.User')).toBe(true);
|
||||
expect(messageContainsMention('Hey @[User+1] hello', 'User+1')).toBe(true);
|
||||
expect(messageContainsMention('Hey @[User*Star] hello', 'User*Star')).toBe(true);
|
||||
expect(messageContainsMention('Hey @[What?] hello', 'What?')).toBe(true);
|
||||
});
|
||||
|
||||
it('does not match partial names', () => {
|
||||
// @[Alice] should not match a name of just "Ali"
|
||||
expect(messageContainsMention('Hey @[Alice] check this', 'Ali')).toBe(false);
|
||||
});
|
||||
|
||||
it('handles mention at start of text', () => {
|
||||
expect(messageContainsMention('@[Bob] hello there', 'Bob')).toBe(true);
|
||||
});
|
||||
|
||||
it('handles mention at end of text', () => {
|
||||
expect(messageContainsMention('hello @[Bob]', 'Bob')).toBe(true);
|
||||
});
|
||||
|
||||
it('handles multiple mentions - matches if user is mentioned', () => {
|
||||
expect(messageContainsMention('@[Alice] and @[Bob] should see this', 'Alice')).toBe(true);
|
||||
expect(messageContainsMention('@[Alice] and @[Bob] should see this', 'Bob')).toBe(true);
|
||||
expect(messageContainsMention('@[Alice] and @[Bob] should see this', 'Charlie')).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user