🎄 Sync 2026-09-29 01:15:30
No files matched your search
@@ -1 +1 @@
|
||||
snapshot
|
||||
release
|
||||
@@ -1 +1 @@
|
||||
26.270.72820~0818828
|
||||
26.270.72870~a24d1f2
|
||||
@@ -10,8 +10,8 @@ LUCI_DEPENDS:=+luci-base +luci-lib-jsonc +curl +bandix
|
||||
|
||||
PKG_MAINTAINER:=timsaya
|
||||
|
||||
PKG_VERSION:=0.12.11
|
||||
PKG_RELEASE:=11
|
||||
PKG_VERSION:=0.12.12
|
||||
PKG_RELEASE:=12
|
||||
|
||||
include $(TOPDIR)/feeds/luci/luci.mk
|
||||
|
||||
|
||||
@@ -11,8 +11,8 @@ LUCI_DESCRIPTION:=Live firewall log table (firewall4/nft; iptables-tagged lines
|
||||
LUCI_DEPENDS:=+luci-base +logd +jsonfilter +coreutils-timeout
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
PKG_VERSION:=0.1.46
|
||||
PKG_RELEASE:=47
|
||||
PKG_VERSION:=0.1.47
|
||||
PKG_RELEASE:=48
|
||||
|
||||
# Reproducible build: honor SOURCE_DATE_EPOCH from the build environment (set by docker-sdk.sh / CI).
|
||||
ifdef SOURCE_DATE_EPOCH
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
return baseclass.extend({
|
||||
/* Keep in sync with openwrt-feed/luci-app-fwlive/Makefile PKG_VERSION. */
|
||||
APP_VERSION: '0.1.46',
|
||||
APP_VERSION: '0.1.47',
|
||||
ROW_LIMIT_OPTIONS: [25, 50, 100, 250, 500, 1000, 2000],
|
||||
DEFAULT_ROW_LIMIT: 100,
|
||||
FETCH_MODE_OPTIONS: ['auto', 'manual'],
|
||||
|
||||
@@ -5,7 +5,7 @@ local uci = require 'luci.model.uci'.cursor()
|
||||
if fs.access('/etc/config/wizard') then
|
||||
autoupgrade_fm = uci:get('wizard', 'default', 'autoupgrade_fm')
|
||||
end
|
||||
if autoupgrade_fm ~= '0' then
|
||||
if autoupgrade_fm == '1' then
|
||||
-%>
|
||||
<script>
|
||||
var tokenStr = '<%=token%>';
|
||||
|
||||
@@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-honk
|
||||
PKG_VERSION:=1.1.4
|
||||
PKG_RELEASE:=6
|
||||
PKG_RELEASE:=7
|
||||
|
||||
LUCI_TITLE:=LuCI support for honk
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
@@ -1 +1 @@
|
||||
import{j as s}from"./vendor-react-Bf71BWbF.js";import{u as o,e2 as c,e3 as p,e4 as x,e5 as m,B as u}from"./index-CXHBmSa5.js";const r=({action:n})=>s.jsxs(u,{isDisabled:n.isDisabled,isPending:n.isPending,onPress:n.onAction,children:[n.icon,n.label]});function b({actions:n,overflowMode:t="collapse"}){const l=o();if(t==="wrap")return s.jsx(s.Fragment,{children:n.map(e=>s.jsx(r,{action:e},e.id))});const[a,...i]=n;return a?s.jsxs(s.Fragment,{children:[s.jsx(r,{action:a}),i.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"rp-wide-only",children:i.map(e=>s.jsx(r,{action:e},e.id))}),s.jsx("span",{className:"rp-narrow-only",children:s.jsx(c,{chevron:!1,label:l("ui.moreActions"),content:s.jsx(x,{"aria-label":l("ui.moreActions"),disabledKeys:i.filter(e=>e.isDisabled||e.isPending).map(e=>e.id),onAction:e=>i.find(d=>d.id===e)?.onAction(),children:i.map(e=>s.jsx(m,{id:e.id,className:"rp-item plain",textValue:e.label,children:e.label},e.id))}),children:s.jsx(p,{})})})]})]}):null}export{b as A};
|
||||
import{j as s}from"./vendor-react-Bf71BWbF.js";import{u as o,eb as c,ec as p,ed as x,ee as m,B as u}from"./index-BNBwb-FJ.js";const r=({action:n})=>s.jsxs(u,{isDisabled:n.isDisabled,isPending:n.isPending,onPress:n.onAction,children:[n.icon,n.label]});function h({actions:n,overflowMode:t="collapse"}){const l=o();if(t==="wrap")return s.jsx(s.Fragment,{children:n.map(e=>s.jsx(r,{action:e},e.id))});const[a,...i]=n;return a?s.jsxs(s.Fragment,{children:[s.jsx(r,{action:a}),i.length>0&&s.jsxs(s.Fragment,{children:[s.jsx("span",{className:"rp-wide-only",children:i.map(e=>s.jsx(r,{action:e},e.id))}),s.jsx("span",{className:"rp-narrow-only",children:s.jsx(c,{chevron:!1,label:l("ui.moreActions"),content:s.jsx(x,{"aria-label":l("ui.moreActions"),disabledKeys:i.filter(e=>e.isDisabled||e.isPending).map(e=>e.id),onAction:e=>i.find(d=>d.id===e)?.onAction(),children:i.map(e=>s.jsx(m,{id:e.id,className:"rp-item plain",textValue:e.label,children:e.label},e.id))}),children:s.jsx(p,{})})})]})]}):null}export{h as A};
|
||||
@@ -1 +1 @@
|
||||
import{j as r}from"./vendor-react-Bf71BWbF.js";import{c as t}from"./index-CXHBmSa5.js";function o({className:a,...s}){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:t("rp-icon",a),...s,children:r.jsx("path",{fill:"currentColor",d:"M10 1.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17m0 15.5a7 7 0 1 1 0-14 7 7 0 0 1 0 14m3.75-7.75h-3v-3a.75.75 0 0 0-1.5 0v3h-3a.75.75 0 0 0 0 1.5h3v3a.75.75 0 0 0 1.5 0v-3h3a.75.75 0 0 0 0-1.5"})})}export{o as A};
|
||||
import{j as r}from"./vendor-react-Bf71BWbF.js";import{c as t}from"./index-BNBwb-FJ.js";function o({className:a,...s}){return r.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:t("rp-icon",a),...s,children:r.jsx("path",{fill:"currentColor",d:"M10 1.5a8.5 8.5 0 1 0 0 17 8.5 8.5 0 0 0 0-17m0 15.5a7 7 0 1 1 0-14 7 7 0 0 1 0 14m3.75-7.75h-3v-3a.75.75 0 0 0-1.5 0v3h-3a.75.75 0 0 0 0 1.5h3v3a.75.75 0 0 0 1.5 0v-3h3a.75.75 0 0 0 0-1.5"})})}export{o as A};
|
||||
@@ -1 +1 @@
|
||||
import{r as u,j as a}from"./vendor-react-Bf71BWbF.js";import{u as ct,aB as it,eH as rt,eI as ut}from"./index-CXHBmSa5.js";import{u as ht,e as dt,v as q,C as xt,f as pt,n as ft,g as J}from"./layout-BRLew_nj.js";import{G as mt,C as yt}from"./AreaCurve-BriPYJva.js";import"./array-C0P64tl-.js";const Mt=l=>{const o=Math.pow(10,Math.floor(Math.log10(l))),e=l/o;return([1,1.2,1.5,2,2.5,3,4,5,6,8,10].find(h=>e<=h)??10)*o},gt=l=>{const o=Math.pow(10,Math.floor(Math.log10(Math.max(l,1e-9)))),e=l/o;return(e<=1?.2:e<=2?.5:e<=5?1:2)*o},B=[30,60,120,300,600,900,1800,3600,7200,21600,43200,86400].map(l=>l*1e3);function kt(l,o){const e=o-l,s=B.find(c=>e/c<=6)??B[B.length-1],h=s>=864e5?new Date(o).getTimezoneOffset()*6e4:0,y=Math.ceil((l-h)/s)*s+h,x=[];for(let c=y;c<=o;c+=s)c-l>=e*.04&&o-c>=e*.04&&x.push(c);return{ticks:x,step:s}}function Q(l){const[o,e]=u.useState([]);return u.useLayoutEffect(()=>{const s=document.createElement("span");Object.assign(s.style,{position:"absolute",top:"-20000px",whiteSpace:"pre",fontSize:"11px"}),document.body.appendChild(s),e(l.map(y=>{s.textContent=y;const{width:x,height:c}=s.getBoundingClientRect();return{width:x,height:c}})),s.remove()},[l]),o}function wt({label:l,series:o,timestamps:e,fmt:s,locale:h,height:y=150,baseline:x="zero",window:c,fill:U}){const X=ct(),C=it(),F=u.useId(),[Y,L]=rt(Math.round,120),{tip:Z,showAt:_,hide:E}=ht(),[z,I]=u.useState(null),i=z&&z.index<e.length?z.index:null,N=c?c.until-c.since:e.length?e[e.length-1]-e[0]:0,M=c?.since,g=c?.until,p=u.useMemo(()=>M!==void 0&&g!==void 0?kt(M,g):void 0,[M,g]),D=p?p.step<6e4:N<180*1e3,A=p?p.step>=864e5:N>2160*60*1e3,G=u.useMemo(()=>new Intl.DateTimeFormat(h,A?{month:"numeric",day:"numeric"}:D?{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}:{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),[h,D,A]),{yDomain:K,yTicks:j}=u.useMemo(()=>{const t=o.flatMap(d=>d.values.filter(w=>w!==null));let n=0,r=Mt(Math.max(1,...t)*1.08);if(x==="auto"&&t.length){const d=Math.min(...t),w=Math.max(...t),b=gt(Math.max(w-d,w*.02,1));n=Math.max(0,Math.floor(d/b)*b-b),r=Math.ceil(w/b)*b+b}return{yDomain:[n,r],yTicks:x==="auto"?[n,(n+r)/2,r]:[r/2,r]}},[o,x]),P=u.useMemo(()=>{const t=e.length-1;return p?p.ticks:[...new Set((D?[0,Math.round(t/2),t]:[0,Math.round(t/3),Math.round(2*t/3),t]).map(n=>e[n]))]},[p,D,e]),O=u.useMemo(()=>M!==void 0&&g!==void 0?[M,g]:[Math.min(...e),Math.max(...e)],[M,g,e]),k=L?.width??0,S=L?.height??y,m=S-30,v=k-64,tt=[Math.min(O[0],...e),Math.max(O[1],...e)],f=t=>J(t,tt,[20,v]),T=t=>J(t,K,[m,8]),et={x:20,y:8,width:v-20,height:m-8},R=(t,n)=>I({index:t,y:n}),W=()=>{I(null),E()};u.useLayoutEffect(()=>{if(i===null){E();return}if(!o.some(t=>t.values[i]!=null)){E();return}_({x:f(e[i]),y:z?.y??(8+m)/2,width:k,bounds:et,label:ut(h).format(e[i]),lines:o.filter(t=>t.values[i]!=null).sort((t,n)=>t.label<n.label?-1:t.label>n.label?1:0).map(t=>`${t.label}${X("ui.labelSeparator")}${s(t.values[i])}`)})});const $=dt(e.length,R,W),H=u.useMemo(()=>P.map(t=>G.format(t)),[P,G]),nt=u.useMemo(()=>j.map(s),[j,s]),ot=Q(H),st=Q(nt),at=p?q(P.map(f),ot.map(t=>t.width),0,k,16,!0):P.map((t,n)=>({index:n,position:f(t)})),V=q(j.map(T),st.map(t=>t.height),0,S,5,!1),lt=[...new Set([...V.map(t=>T(j[t.index])),8,m])];return a.jsx("div",{ref:Y,style:{height:y,width:"100%",flex:U?"1 1 auto":void 0,position:"relative"},onPointerLeave:$.onPointerLeave,children:e.length>0&&L&&a.jsxs(a.Fragment,{children:[a.jsx(xt,{tip:Z}),a.jsxs("svg",{className:"rp-activity-surface",width:k,height:S,viewBox:`0 0 ${k} ${S}`,style:{display:"block"},role:"application","aria-label":l,tabIndex:0,onFocus:$.onFocus,onBlur:$.onBlur,onKeyDown:$.onKeyDown,onPointerMove:t=>{const{x:n,y:r}=pt(t,t.currentTarget,{width:k,height:S});if(n<20||n>v||r<8||r>m){W();return}const d=ft(e.map(f),n);R(d,r)},children:[a.jsx("g",{className:"rp-area-grid",children:lt.map(t=>a.jsx("line",{x1:20,x2:v,y1:t,y2:t,stroke:C["hl-med"],strokeDasharray:"2 4",fill:"none"},t))}),a.jsx("defs",{children:o.map((t,n)=>a.jsx(mt,{id:F+n,color:t.color},t.label))}),o.map((t,n)=>a.jsx(yt,{points:e.map((r,d)=>t.values[d]==null?null:{x:f(r),y:T(t.values[d])}),baseline:T(Math.max(0,K[0])),color:t.color,id:F+n,strokeWidth:2},t.label)),i!==null&&a.jsx("path",{d:`M${f(e[i])},8L${f(e[i])},${m}`,stroke:C.subtle,strokeDasharray:"3 3",fill:"none",pointerEvents:"none"}),a.jsx("g",{children:at.map(({index:t,position:n})=>a.jsx("text",{x:n,y:m+8,className:"rp-area-tick",fill:C.subtle,textAnchor:"middle",children:a.jsx("tspan",{x:n,dy:"0.71em",children:H[t]})},t))}),a.jsx("g",{className:"rp-area-y-ticks",children:V.map(({index:t,position:n})=>a.jsx("text",{x:v+8,y:n,className:"rp-area-tick",fill:C.subtle,textAnchor:"start",children:a.jsx("tspan",{x:v+8,dy:"0.355em",children:s(j[t])})},t))}),i!==null&&o.map(t=>t.values[i]==null?null:a.jsx("circle",{cx:f(e[i]),cy:T(t.values[i]),r:4,fill:t.color,stroke:"#fff",strokeWidth:2},t.label))]})]})})}export{wt as AreaPlot};
|
||||
import{r as u,j as a}from"./vendor-react-Bf71BWbF.js";import{u as ct,aE as it,eQ as rt,eR as ut}from"./index-BNBwb-FJ.js";import{u as ht,e as dt,v as q,C as xt,f as pt,n as ft,g as H}from"./layout-wfdMYi2n.js";import{G as mt,C as yt}from"./AreaCurve-BriPYJva.js";import"./array-C0P64tl-.js";const Mt=l=>{const o=Math.pow(10,Math.floor(Math.log10(l))),e=l/o;return([1,1.2,1.5,2,2.5,3,4,5,6,8,10].find(h=>e<=h)??10)*o},gt=l=>{const o=Math.pow(10,Math.floor(Math.log10(Math.max(l,1e-9)))),e=l/o;return(e<=1?.2:e<=2?.5:e<=5?1:2)*o},F=[30,60,120,300,600,900,1800,3600,7200,21600,43200,86400].map(l=>l*1e3);function kt(l,o){const e=o-l,s=F.find(c=>e/c<=6)??F[F.length-1],h=s>=864e5?new Date(o).getTimezoneOffset()*6e4:0,y=Math.ceil((l-h)/s)*s+h,x=[];for(let c=y;c<=o;c+=s)c-l>=e*.04&&o-c>=e*.04&&x.push(c);return{ticks:x,step:s}}function J(l){const[o,e]=u.useState([]);return u.useLayoutEffect(()=>{const s=document.createElement("span");Object.assign(s.style,{position:"absolute",top:"-20000px",whiteSpace:"pre",fontSize:"11px"}),document.body.appendChild(s),e(l.map(y=>{s.textContent=y;const{width:x,height:c}=s.getBoundingClientRect();return{width:x,height:c}})),s.remove()},[l]),o}function wt({label:l,series:o,timestamps:e,fmt:s,locale:h,height:y=150,baseline:x="zero",window:c,fill:U}){const X=ct(),C=it(),N=u.useId(),[Y,E]=rt(Math.round,120),{tip:Z,showAt:_,hide:L}=ht(),[z,A]=u.useState(null),i=z&&z.index<e.length?z.index:null,B=c?c.until-c.since:e.length?e[e.length-1]-e[0]:0,M=c?.since,g=c?.until,p=u.useMemo(()=>M!==void 0&&g!==void 0?kt(M,g):void 0,[M,g]),D=p?p.step<6e4:B<180*1e3,I=p?p.step>=864e5:B>2160*60*1e3,R=u.useMemo(()=>new Intl.DateTimeFormat(h,I?{month:"numeric",day:"numeric"}:D?{hour:"2-digit",minute:"2-digit",second:"2-digit",hourCycle:"h23"}:{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),[h,D,I]),{yDomain:G,yTicks:j}=u.useMemo(()=>{const t=o.flatMap(d=>d.values.filter(w=>w!==null));let n=0,r=Mt(Math.max(1,...t)*1.08);if(x==="auto"&&t.length){const d=Math.min(...t),w=Math.max(...t),b=gt(Math.max(w-d,w*.02,1));n=Math.max(0,Math.floor(d/b)*b-b),r=Math.ceil(w/b)*b+b}return{yDomain:[n,r],yTicks:x==="auto"?[n,(n+r)/2,r]:[r/2,r]}},[o,x]),P=u.useMemo(()=>{const t=e.length-1;return p?p.ticks:[...new Set((D?[0,Math.round(t/2),t]:[0,Math.round(t/3),Math.round(2*t/3),t]).map(n=>e[n]))]},[p,D,e]),K=u.useMemo(()=>M!==void 0&&g!==void 0?[M,g]:[Math.min(...e),Math.max(...e)],[M,g,e]),k=E?.width??0,S=E?.height??y,m=S-30,v=k-64,tt=[Math.min(K[0],...e),Math.max(K[1],...e)],f=t=>H(t,tt,[20,v]),T=t=>H(t,G,[m,8]),et={x:20,y:8,width:v-20,height:m-8},O=(t,n)=>A({index:t,y:n}),W=()=>{A(null),L()};u.useLayoutEffect(()=>{if(i===null){L();return}if(!o.some(t=>t.values[i]!=null)){L();return}_({x:f(e[i]),y:z?.y??(8+m)/2,width:k,bounds:et,label:ut(h).format(e[i]),lines:o.filter(t=>t.values[i]!=null).sort((t,n)=>t.label<n.label?-1:t.label>n.label?1:0).map(t=>`${t.label}${X("ui.labelSeparator")}${s(t.values[i])}`)})});const $=dt(e.length,O,W),Q=u.useMemo(()=>P.map(t=>R.format(t)),[P,R]),nt=u.useMemo(()=>j.map(s),[j,s]),ot=J(Q),st=J(nt),at=p?q(P.map(f),ot.map(t=>t.width),0,k,16,!0):P.map((t,n)=>({index:n,position:f(t)})),V=q(j.map(T),st.map(t=>t.height),0,S,5,!1),lt=[...new Set([...V.map(t=>T(j[t.index])),8,m])];return a.jsx("div",{ref:Y,style:{height:y,width:"100%",flex:U?"1 1 auto":void 0,position:"relative"},onPointerLeave:$.onPointerLeave,children:e.length>0&&E&&a.jsxs(a.Fragment,{children:[a.jsx(xt,{tip:Z}),a.jsxs("svg",{className:"rp-activity-surface",width:k,height:S,viewBox:`0 0 ${k} ${S}`,style:{display:"block"},role:"application","aria-label":l,tabIndex:0,onFocus:$.onFocus,onBlur:$.onBlur,onKeyDown:$.onKeyDown,onPointerMove:t=>{const{x:n,y:r}=pt(t,t.currentTarget,{width:k,height:S});if(n<20||n>v||r<8||r>m){W();return}const d=ft(e.map(f),n);O(d,r)},children:[a.jsx("g",{className:"rp-area-grid",children:lt.map(t=>a.jsx("line",{x1:20,x2:v,y1:t,y2:t,stroke:C["hl-med"],strokeDasharray:"2 4",fill:"none"},t))}),a.jsx("defs",{children:o.map((t,n)=>a.jsx(mt,{id:N+n,color:t.color},t.label))}),o.map((t,n)=>a.jsx(yt,{points:e.map((r,d)=>t.values[d]==null?null:{x:f(r),y:T(t.values[d])}),baseline:T(Math.max(0,G[0])),color:t.color,id:N+n,strokeWidth:2},t.label)),i!==null&&a.jsx("path",{d:`M${f(e[i])},8L${f(e[i])},${m}`,stroke:C.subtle,strokeDasharray:"3 3",fill:"none",pointerEvents:"none"}),a.jsx("g",{children:at.map(({index:t,position:n})=>a.jsx("text",{x:n,y:m+8,className:"rp-area-tick",fill:C.subtle,textAnchor:"middle",children:a.jsx("tspan",{x:n,dy:"0.71em",children:Q[t]})},t))}),a.jsx("g",{className:"rp-area-y-ticks",children:V.map(({index:t,position:n})=>a.jsx("text",{x:v+8,y:n,className:"rp-area-tick",fill:C.subtle,textAnchor:"start",children:a.jsx("tspan",{x:v+8,dy:"0.355em",children:s(j[t])})},t))}),i!==null&&o.map(t=>t.values[i]==null?null:a.jsx("circle",{cx:f(e[i]),cy:T(t.values[i]),r:4,fill:t.color,stroke:"#fff",strokeWidth:2},t.label))]})]})})}export{wt as AreaPlot};
|
||||
@@ -1,4 +1,4 @@
|
||||
import{r as x,$ as _,a as St,j as f}from"./vendor-react-Bf71BWbF.js";import{eu as Pt,eN as Bt,eo as ae,bT as G,bR as M,eO as Qe,eP as et,eQ as It,bL as Re,el as F,em as re,en as Be,e7 as N,eA as tt,eR as At,eS as Ot,eT as Mt,bI as jt,bU as Nt,b$ as Rt,eU as Lt,c1 as Vt,c2 as Gt,bG as Ht,es as zt,c4 as Ut,bD as Xt,c6 as Yt,c8 as qt,c5 as _t,eV as Wt,eW as Jt,bE as ke,aJ as Zt,eE as Qt,eB as er,bQ as tr,eX as rt,eY as nt,eZ as oe,bF as rr,bB as at,e6 as nr,c as Ie,J as Ke,e_ as Le,d9 as ot,e$ as Ve,f0 as Ge,de as it,u as W,a5 as ar,a8 as or,a7 as He,aa as ir,cA as lr,dB as sr,b as ur,bb as ze,E as dr,j as cr,I as Q,af as lt,B as L,d5 as Ue,ac as st,T as ut,a as dt,aH as Xe,aC as pr,bx as fr,$ as de,L as gr,h as yr,by as mr,aG as hr,b1 as Dr,eF as br,eG as $r,f1 as vr,aE as Er,bj as xr,ae as ct,cG as wr}from"./index-CXHBmSa5.js";import{$ as Tr,a as kr}from"./Policies-wpHv6bOW.js";import{d as Kr}from"./Virtualizer--Vfl8O3n.js";import{$ as Cr}from"./ListLayout-CPapuywx.js";import{D as pt}from"./DaeCode-STEiRZuV.js";import{b as Fr,g as Sr}from"./policyText-CAFy3qpo.js";import{P as Pr}from"./PolicyPicker-DSSmYroN.js";import{$ as Br}from"./useFilter-DZ8TXqn_.js";import"./useGridSelectionCheckbox-BV96yL-N.js";var P=(function(e){return e[e.none=0]="none",e[e.cancel=0]="cancel",e[e.move=1]="move",e[e.copy=2]="copy",e[e.link=4]="link",e[e.all=7]="all",e})({});const ft={...P,copyMove:3,copyLink:6,linkMove:5,all:7,uninitialized:7},gt=yt(ft);gt[7]="all";const ee={none:"cancel",link:"link",copy:"copy",move:"move"},De=yt(ee);function yt(e){let t={};for(let r in e)t[e[r]]=r;return t}const Ir=new Set(["text/plain","text/uri-list","text/html"]),fe="application/vnd.react-aria.items+json",ge="application/octet-stream",Ae=new WeakMap,mt=Symbol();function Ar(e){let{id:t}=Ae.get(e)||{};if(!t)throw new Error("Droppable item outside a droppable collection");return t}function Or(e){let{ref:t}=Ae.get(e)||{};if(!t)throw new Error("Droppable item outside a droppable collection");return t}function z(e){let t=new Set;for(let r of e)for(let n of Object.keys(r))t.add(n);return t}function ht(e){return e||(e="virtual"),e==="pointer"&&(e="virtual"),e==="virtual"&&typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches&&(e="touch"),e}function Oe(){return ht(Pt())}function Dt(){return ht(Bt())}function Ce(e,t){let r=new Map,n=!1,a=[];for(let o of t){let y=Object.keys(o);y.length>1&&(n=!0);let c={};for(let D of y){let v=r.get(D);v?n=!0:(v=[],r.set(D,v));let g=o[D];c[D]=g,v.push(g)}a.push(c)}for(let[o,y]of r)if(Ir.has(o)){let c=y.join(`
|
||||
`);e.items.add(c,o)}else e.items.add(y[0],o);if(n){let o=JSON.stringify(a);e.items.add(o,fe)}}class ie{constructor(t){this.types=new Set;let r=!1;for(let n of t.items)n.type!==fe&&(n.kind==="file"&&(r=!0),n.type?this.types.add(n.type):this.types.add(ge));this.includesUnknownTypes=!r&&t.types.includes("Files")}has(t){if(Array.isArray(t))return t.some(r=>this.has(r));if(this.includesUnknownTypes||t===mt&&this.types.has(ge)||t==="*/*")return!0;if(typeof t=="string"){if(t.endsWith("/*")){for(let r of this.types)if(r.startsWith(t.slice(0,-2)))return!0;return!1}return this.types.has(t)}return!1}}function bt(e){let t=[];if(!e)return t;let r=!1;if(e.types.includes(fe))try{let n=e.getData(fe),a=JSON.parse(n);for(let o of a)t.push({kind:"text",types:new Set(Object.keys(o)),getText:y=>Promise.resolve(o[y])});r=!0}catch{}if(!r){let n=new Map;for(let a of e.items)if(a.kind==="string")n.set(a.type||ge,e.getData(a.type));else if(a.kind==="file")if(typeof a.webkitGetAsEntry=="function"){let o=a.webkitGetAsEntry();if(!o)continue;o.isFile?t.push(Fe(a.getAsFile())):o.isDirectory&&t.push($t(o))}else t.push(Fe(a.getAsFile()));n.size>0&&t.push({kind:"text",types:new Set(n.keys()),getText:a=>Promise.resolve(n.get(a))})}return t}function Mr(e){return typeof e.text=="function"?e.text():new Promise((t,r)=>{let n=new FileReader;n.onload=()=>{t(n.result)},n.onerror=r,n.readAsText(e)})}function Fe(e){if(!e)throw new Error("No file provided");return{kind:"file",type:e.type||ge,name:e.name,getText:()=>Mr(e),getFile:()=>Promise.resolve(e)}}function $t(e){return{kind:"directory",name:e.name,getEntries:()=>jr(e)}}async function*jr(e){let t=e.createReader(),r;do{r=await new Promise((n,a)=>{t.readEntries(n,a)});for(let n of r)if(n.isFile){let a=await Nr(n);yield Fe(a)}else n.isDirectory&&(yield $t(n))}while(r.length>0)}function Nr(e){return new Promise((t,r)=>e.file(t,r))}function Rr(e){return e.kind==="text"}let B={draggingKeys:new Set};function Lr(e){B.draggingCollectionRef=e}function Vr(e){B.draggingKeys=e}function Y(e){B.dropCollectionRef=e}function vt(){B={draggingKeys:new Set}}function Gr(e){B=e}function V(e){let{draggingCollectionRef:t,dropCollectionRef:r}=B;return t?.current!=null&&t.current===(e?.current||r?.current)}let ce;function ye(e){ce=e}let Se=P.none;function be(e){Se=e}let Pe=new Map,te=new Map,R=null,me=new Set;function Et(e){return Pe.set(e.element,e),R?.updateValidDropTargets(),()=>{Pe.delete(e.element),R?.updateValidDropTargets()}}function Hr(e){return te.set(e.element,e),()=>{te.delete(e.element)}}function zr(e,t){if(R)throw new Error("Cannot begin dragging while already dragging");R=new _r(e,t),requestAnimationFrame(()=>{R&&(R.setup(),Dt()==="keyboard"&&R.next())});for(let r of me)r()}function Me(){let[e,t]=x.useState(R);return x.useEffect(()=>{let r=()=>t(R);return me.add(r),()=>{me.delete(r)}},[]),e}function Ur(){return!!R}function Xr(){R=null;for(let e of me)e()}const Ye=["pointerdown","pointermove","pointerenter","pointerleave","pointerover","pointerout","pointerup","mousedown","mousemove","mouseenter","mouseleave","mouseover","mouseout","mouseup","touchstart","touchmove","touchend","focusin","focusout"],Yr=["pointerup","mouseup","touchend"],qr={keyboard:"dragStartedKeyboard",touch:"dragStartedTouch",virtual:"dragStartedVirtual"};class _r{constructor(t,r){this.validDropTargets=[],this.currentDropTarget=null,this.currentDropItem=null,this.dropOperation=null,this.mutationObserver=null,this.restoreAriaHidden=null,this.isVirtualClick=!1,this.dragTarget=t,this.stringFormatter=r,this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.onClick=this.onClick.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.cancelEvent=this.cancelEvent.bind(this),this.initialFocused=!1}setup(){document.addEventListener("keydown",this.onKeyDown,!0),document.addEventListener("keyup",this.onKeyUp,!0),window.addEventListener("focus",this.onFocus,!0),window.addEventListener("blur",this.onBlur,!0),document.addEventListener("click",this.onClick,!0),document.addEventListener("pointerdown",this.onPointerDown,!0);for(let t of Ye)document.addEventListener(t,this.cancelEvent,!0);this.mutationObserver=new MutationObserver(()=>this.updateValidDropTargets()),this.updateValidDropTargets(),ae(this.stringFormatter.format(qr[Dt()]))}teardown(){document.removeEventListener("keydown",this.onKeyDown,!0),document.removeEventListener("keyup",this.onKeyUp,!0),window.removeEventListener("focus",this.onFocus,!0),window.removeEventListener("blur",this.onBlur,!0),document.removeEventListener("click",this.onClick,!0),document.removeEventListener("pointerdown",this.onPointerDown,!0);for(let t of Ye)document.removeEventListener(t,this.cancelEvent,!0);this.mutationObserver?.disconnect(),this.restoreAriaHidden?.()}onKeyDown(t){if(this.cancelEvent(t),t.key==="Escape"){this.cancel();return}t.key==="Tab"&&!(t.metaKey||t.altKey||t.ctrlKey)&&(t.shiftKey?this.previous(
Line truncated
|
||||
import{r as x,$ as _,a as St,j as f}from"./vendor-react-Bf71BWbF.js";import{eD as Pt,eW as Bt,ex as ae,bX as H,bV as M,eX as Qe,eY as et,eZ as It,bP as Re,eu as F,ev as re,ew as Be,eg as N,eJ as tt,e_ as At,e$ as Ot,f0 as Mt,bM as jt,bY as Nt,c3 as Rt,f1 as Lt,c5 as Vt,c6 as Ht,bK as Gt,eB as zt,c8 as Xt,bH as Yt,ca as Ut,cc as qt,c9 as _t,f2 as Wt,f3 as Jt,bI as ke,aM as Zt,eN as Qt,eK as er,bU as tr,f4 as rt,f5 as nt,f6 as oe,bJ as rr,bF as at,ef as nr,c as Ie,K as Ke,f7 as Le,di as ot,f8 as Ve,f9 as He,dn as it,u as W,a8 as ar,ab as or,aa as Ge,ad as ir,cE as lr,dK as sr,b as ur,be as ze,E as dr,j as cr,I as Q,ai as lt,B as L,de as Xe,af as st,T as ut,a as dt,aK as Ye,aF as pr,bB as fr,a2 as de,L as gr,h as yr,bC as mr,aJ as hr,b4 as Dr,eO as br,eP as $r,fa as vr,aH as Er,bn as xr,ah as ct,cK as wr}from"./index-BNBwb-FJ.js";import{$ as Tr,a as kr}from"./Policies-DiLR7S4N.js";import{d as Kr}from"./Virtualizer-DipGMcji.js";import{$ as Cr}from"./ListLayout-F74Z1Dpf.js";import{D as pt}from"./DaeCode-B8yPDjSE.js";import{b as Fr,g as Sr}from"./policyText-CmeXgUK2.js";import{P as Pr}from"./PolicyPicker-BmHzmXzJ.js";import{$ as Br}from"./useFilter-jz02VVEB.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";var P=(function(e){return e[e.none=0]="none",e[e.cancel=0]="cancel",e[e.move=1]="move",e[e.copy=2]="copy",e[e.link=4]="link",e[e.all=7]="all",e})({});const ft={...P,copyMove:3,copyLink:6,linkMove:5,all:7,uninitialized:7},gt=yt(ft);gt[7]="all";const ee={none:"cancel",link:"link",copy:"copy",move:"move"},De=yt(ee);function yt(e){let t={};for(let r in e)t[e[r]]=r;return t}const Ir=new Set(["text/plain","text/uri-list","text/html"]),fe="application/vnd.react-aria.items+json",ge="application/octet-stream",Ae=new WeakMap,mt=Symbol();function Ar(e){let{id:t}=Ae.get(e)||{};if(!t)throw new Error("Droppable item outside a droppable collection");return t}function Or(e){let{ref:t}=Ae.get(e)||{};if(!t)throw new Error("Droppable item outside a droppable collection");return t}function z(e){let t=new Set;for(let r of e)for(let n of Object.keys(r))t.add(n);return t}function ht(e){return e||(e="virtual"),e==="pointer"&&(e="virtual"),e==="virtual"&&typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(pointer: coarse)").matches&&(e="touch"),e}function Oe(){return ht(Pt())}function Dt(){return ht(Bt())}function Ce(e,t){let r=new Map,n=!1,a=[];for(let o of t){let y=Object.keys(o);y.length>1&&(n=!0);let c={};for(let D of y){let v=r.get(D);v?n=!0:(v=[],r.set(D,v));let g=o[D];c[D]=g,v.push(g)}a.push(c)}for(let[o,y]of r)if(Ir.has(o)){let c=y.join(`
|
||||
`);e.items.add(c,o)}else e.items.add(y[0],o);if(n){let o=JSON.stringify(a);e.items.add(o,fe)}}class ie{constructor(t){this.types=new Set;let r=!1;for(let n of t.items)n.type!==fe&&(n.kind==="file"&&(r=!0),n.type?this.types.add(n.type):this.types.add(ge));this.includesUnknownTypes=!r&&t.types.includes("Files")}has(t){if(Array.isArray(t))return t.some(r=>this.has(r));if(this.includesUnknownTypes||t===mt&&this.types.has(ge)||t==="*/*")return!0;if(typeof t=="string"){if(t.endsWith("/*")){for(let r of this.types)if(r.startsWith(t.slice(0,-2)))return!0;return!1}return this.types.has(t)}return!1}}function bt(e){let t=[];if(!e)return t;let r=!1;if(e.types.includes(fe))try{let n=e.getData(fe),a=JSON.parse(n);for(let o of a)t.push({kind:"text",types:new Set(Object.keys(o)),getText:y=>Promise.resolve(o[y])});r=!0}catch{}if(!r){let n=new Map;for(let a of e.items)if(a.kind==="string")n.set(a.type||ge,e.getData(a.type));else if(a.kind==="file")if(typeof a.webkitGetAsEntry=="function"){let o=a.webkitGetAsEntry();if(!o)continue;o.isFile?t.push(Fe(a.getAsFile())):o.isDirectory&&t.push($t(o))}else t.push(Fe(a.getAsFile()));n.size>0&&t.push({kind:"text",types:new Set(n.keys()),getText:a=>Promise.resolve(n.get(a))})}return t}function Mr(e){return typeof e.text=="function"?e.text():new Promise((t,r)=>{let n=new FileReader;n.onload=()=>{t(n.result)},n.onerror=r,n.readAsText(e)})}function Fe(e){if(!e)throw new Error("No file provided");return{kind:"file",type:e.type||ge,name:e.name,getText:()=>Mr(e),getFile:()=>Promise.resolve(e)}}function $t(e){return{kind:"directory",name:e.name,getEntries:()=>jr(e)}}async function*jr(e){let t=e.createReader(),r;do{r=await new Promise((n,a)=>{t.readEntries(n,a)});for(let n of r)if(n.isFile){let a=await Nr(n);yield Fe(a)}else n.isDirectory&&(yield $t(n))}while(r.length>0)}function Nr(e){return new Promise((t,r)=>e.file(t,r))}function Rr(e){return e.kind==="text"}let B={draggingKeys:new Set};function Lr(e){B.draggingCollectionRef=e}function Vr(e){B.draggingKeys=e}function U(e){B.dropCollectionRef=e}function vt(){B={draggingKeys:new Set}}function Hr(e){B=e}function V(e){let{draggingCollectionRef:t,dropCollectionRef:r}=B;return t?.current!=null&&t.current===(e?.current||r?.current)}let ce;function ye(e){ce=e}let Se=P.none;function be(e){Se=e}let Pe=new Map,te=new Map,R=null,me=new Set;function Et(e){return Pe.set(e.element,e),R?.updateValidDropTargets(),()=>{Pe.delete(e.element),R?.updateValidDropTargets()}}function Gr(e){return te.set(e.element,e),()=>{te.delete(e.element)}}function zr(e,t){if(R)throw new Error("Cannot begin dragging while already dragging");R=new _r(e,t),requestAnimationFrame(()=>{R&&(R.setup(),Dt()==="keyboard"&&R.next())});for(let r of me)r()}function Me(){let[e,t]=x.useState(R);return x.useEffect(()=>{let r=()=>t(R);return me.add(r),()=>{me.delete(r)}},[]),e}function Xr(){return!!R}function Yr(){R=null;for(let e of me)e()}const Ue=["pointerdown","pointermove","pointerenter","pointerleave","pointerover","pointerout","pointerup","mousedown","mousemove","mouseenter","mouseleave","mouseover","mouseout","mouseup","touchstart","touchmove","touchend","focusin","focusout"],Ur=["pointerup","mouseup","touchend"],qr={keyboard:"dragStartedKeyboard",touch:"dragStartedTouch",virtual:"dragStartedVirtual"};class _r{constructor(t,r){this.validDropTargets=[],this.currentDropTarget=null,this.currentDropItem=null,this.dropOperation=null,this.mutationObserver=null,this.restoreAriaHidden=null,this.isVirtualClick=!1,this.dragTarget=t,this.stringFormatter=r,this.onKeyDown=this.onKeyDown.bind(this),this.onKeyUp=this.onKeyUp.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this),this.onClick=this.onClick.bind(this),this.onPointerDown=this.onPointerDown.bind(this),this.cancelEvent=this.cancelEvent.bind(this),this.initialFocused=!1}setup(){document.addEventListener("keydown",this.onKeyDown,!0),document.addEventListener("keyup",this.onKeyUp,!0),window.addEventListener("focus",this.onFocus,!0),window.addEventListener("blur",this.onBlur,!0),document.addEventListener("click",this.onClick,!0),document.addEventListener("pointerdown",this.onPointerDown,!0);for(let t of Ue)document.addEventListener(t,this.cancelEvent,!0);this.mutationObserver=new MutationObserver(()=>this.updateValidDropTargets()),this.updateValidDropTargets(),ae(this.stringFormatter.format(qr[Dt()]))}teardown(){document.removeEventListener("keydown",this.onKeyDown,!0),document.removeEventListener("keyup",this.onKeyUp,!0),window.removeEventListener("focus",this.onFocus,!0),window.removeEventListener("blur",this.onBlur,!0),document.removeEventListener("click",this.onClick,!0),document.removeEventListener("pointerdown",this.onPointerDown,!0);for(let t of Ue)document.removeEventListener(t,this.cancelEvent,!0);this.mutationObserver?.disconnect(),this.restoreAriaHidden?.()}onKeyDown(t){if(this.cancelEvent(t),t.key==="Escape"){this.cancel();return}t.key==="Tab"&&!(t.metaKey||t.altKey||t.ctrlKey)&&(t.shiftKey?this.previous(
Line truncated
|
||||
`),A=new Set(c.map(O=>O.group));return Ke(l.stagedText).filter(O=>A.has(O.name)).map(O=>({group:O.name,text:K.slice(O.from,O.to+1).join(`
|
||||
`)}))},[l.stagedText,c]);return{groups:l.groups,unknown:l.unknown,byGroup:d,subscriptions:i,nodes:T,search:b,setSearch:m,loading:r.loading&&!r.data||a.loading&&!y||o.loading&&!o.data,error:[r,a,o].find(K=>K.error&&!K.data)?.error??(e.main?null:e.error),retry:x.useCallback(()=>void sr(),[]),blocked:S?t(S):null,busy:e.busy||h,applying:h,failure:k,changes:c,changeLines:c.map(K=>Fn(K,$,t)),pendingText:t("arrange.pending",{n:c.length}),place:H,unplace:j,drop:K=>I(A=>Sn(A,K)),discard:()=>I(()=>[]),nameProblem:J,create:(K,A)=>I(O=>Te(O,{kind:"createGroup",group:K,policy:A})),reviewing:s&&c.length>0,setReviewing:K=>{h||u(K)},preview:X,canApply:c.length>0&&l.emptyNew.length===0&&!S&&!h,applyNote:Kn(S?t(S):null,l.emptyNew,t),apply:Z}}function Xn({source:e,groups:t}){const r=W(),n=Pn(e),a=x.useMemo(()=>new Map((t??[]).map(o=>[o.name,o])),[t]);return n.error?f.jsx(dr,{error:n.error,onRetry:n.retry}):n.loading?f.jsx(cr,{}):f.jsxs("div",{className:"rp-arrange",children:[f.jsxs("div",{className:"rp-row",children:[f.jsxs("p",{className:"rp-note rp-grow",children:[f.jsx("span",{className:"rp-wide-only",children:r("arrange.note")}),f.jsx("span",{className:"rp-narrow-only",children:r("arrange.selectHint")})]}),f.jsx(An,{m:n})]}),n.blocked&&f.jsx(Q,{tone:"informative",children:n.blocked}),f.jsxs("div",{className:"rp-arrange-grid",children:[f.jsx("div",{className:"rp-col",children:n.groups.length?n.groups.map(o=>f.jsx(Bn,{group:o,live:a.get(o.name),m:n},o.name)):f.jsx(lt,{children:r("policy.empty")})}),f.jsx(In,{m:n})]}),n.changes.length>0&&f.jsxs(En,{label:r("arrange.pendingRegion"),message:n.pendingText,children:[f.jsx(L,{quiet:!0,onPress:n.discard,isDisabled:n.busy,children:r("arrange.discard")}),f.jsx(L,{accent:!0,onPress:()=>n.setReviewing(!0),children:r("arrange.review")})]}),f.jsx(On,{m:n})]})}function Bn({group:e,live:t,m:r}){const n=W(),a=dt(),o=x.useId(),y=!!r.blocked,c=t?Sr(t.policy,n):null,D=async $=>{const l=await Promise.all($.filter(Rr).filter(d=>d.types.has(pe)).map(d=>d.getText(pe)));r.place(e.name,l.flatMap(d=>Cn(d)??[]))},v=($,l,d)=>f.jsx(L,{quiet:!0,icon:!0,small:!0,label:n("arrange.remove",{name:$,group:e.name}),isDisabled:y||r.applying||!!d,onPress:()=>r.unplace(e.name,l),children:f.jsx(ct,{})}),g=($,l)=>f.jsx(L,{quiet:!0,small:!0,label:n("arrange.undoRemove",{name:$}),isDisabled:r.applying,onPress:()=>r.place(e.name,[l]),children:n("arrange.undoShort")});return f.jsx(nn,{className:mr("rp-drop"),"aria-label":n("arrange.dropInto",{group:e.name}),isDisabled:y||r.applying,getDropOperation:$=>$.has(pe)?"copy":"cancel",onDrop:$=>void D($.items),children:({isDropTarget:$})=>f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"rp-row",children:f.jsxs("span",{className:"rp-cluster",children:[f.jsx("h3",{className:"rp-h3",id:o,children:e.name}),c&&f.jsx(Xe,{tip:c.id,children:c.label}),t&&f.jsx(pr,{small:!0,tone:"neutral",children:n("arrange.memberCount",{n:t.member_count})}),e.isNew&&f.jsx(Xe,{children:n("arrange.new")})]})}),e.holdsAll&&f.jsx("p",{className:"rp-note",children:n("arrange.holdsAll")}),f.jsxs(fr,{reason:kn(e,y||r.applying),children:[(e.names.length>0||e.removedNames.length>0)&&f.jsxs(Je,{label:n("arrange.byName"),children:[f.jsx("span",{className:"rp-label rp-tags-title",children:n("arrange.byName")}),e.names.map(l=>f.jsx(ue,{tone:l.isNew?"new":void 0,action:v(l.name,{kind:"node",value:l.name},l.blocked),children:l.name},l.name)),e.removedNames.map(l=>f.jsx(ue,{tone:"removed",action:g(l,{kind:"node",value:l}),children:l},l))]}),(e.subscriptions.length>0||e.removedSubscriptions.length>0)&&f.jsxs(Je,{label:n("arrange.bySubscription"),children:[f.jsx("span",{className:"rp-label rp-tags-title",children:n("arrange.bySubscription")}),e.subscriptions.map(l=>f.jsx(ue,{tone:l.isNew?"new":void 0,action:v(l.label,{kind:"subscription",value:l.tag},l.blocked),children:l.count===null?l.label:n("arrange.subscriptionCount",{name:l.label,n:l.count})},l.tag)),e.removedSubscriptions.map(l=>f.jsx(ue,{tone:"removed",action:g(l.label,{kind:"subscription",value:l.tag}),children:l.label},l.tag))]})]}),e.rules.length>0&&f.jsxs("div",{className:"rp-arrange-rules",children:[f.jsx("span",{className:"rp-label",children:n("arrange.byRule")}),e.rules.map(l=>f.jsx(pt,{as:"code",text:l},l)),e.ruleNodes.length>0&&f.jsx("span",{children:e.ruleMore?n("arrange.ruleSelectsMore",{names:de(a,e.ruleNodes),n:e.ruleMore}):n("arrange.ruleSelects",{names:de(a,e.ruleNodes)})}),f.jsxs("span",{className:"rp-label",children:[e.ruleNote," ",f.jsx(gr,{appearance:"link",href:yr("config",{tab:"source"}),children:n("arrange.editSource")})]})]}),e.stillIn.length>0&&f.jsx(Q,{tone:"informative",children:n("arrange.stillIn",{names:de(a,e.stillIn)})}),$&&f.jsx("div",{className:"rp-drop-hint","aria-hidden":"true",children:n("arrange.dropHint")})]})})}function In({m:e}){const t=W(),r=x.useId(),n=!!e.blocked||e.applying,[a,o]=x.useState("all"),[y,c]=x.useState(new Set),D=x.useMemo(()=>[...a==="node"?[]:e.subscriptions.map(d=>({id:"subscription:"+d.tag,item:{ki
Line truncated
|
||||
`)}))},[l.stagedText,c]);return{groups:l.groups,unknown:l.unknown,byGroup:d,subscriptions:i,nodes:T,search:b,setSearch:m,loading:r.loading&&!r.data||a.loading&&!y||o.loading&&!o.data,error:[r,a,o].find(K=>K.error&&!K.data)?.error??(e.main?null:e.error),retry:x.useCallback(()=>void sr(),[]),blocked:S?t(S):null,busy:e.busy||h,applying:h,failure:k,changes:c,changeLines:c.map(K=>Fn(K,$,t)),pendingText:t("arrange.pending",{n:c.length}),place:G,unplace:j,drop:K=>I(A=>Sn(A,K)),discard:()=>I(()=>[]),nameProblem:J,create:(K,A)=>I(O=>Te(O,{kind:"createGroup",group:K,policy:A})),reviewing:s&&c.length>0,setReviewing:K=>{h||u(K)},preview:Y,canApply:c.length>0&&l.emptyNew.length===0&&!S&&!h,applyNote:Kn(S?t(S):null,l.emptyNew,t),apply:Z}}function Yn({source:e,groups:t}){const r=W(),n=Pn(e),a=x.useMemo(()=>new Map((t??[]).map(o=>[o.name,o])),[t]);return n.error?f.jsx(dr,{error:n.error,onRetry:n.retry}):n.loading?f.jsx(cr,{}):f.jsxs("div",{className:"rp-arrange",children:[f.jsxs("div",{className:"rp-row",children:[f.jsxs("p",{className:"rp-note rp-grow",children:[f.jsx("span",{className:"rp-wide-only",children:r("arrange.note")}),f.jsx("span",{className:"rp-narrow-only",children:r("arrange.selectHint")})]}),f.jsx(An,{m:n})]}),n.blocked&&f.jsx(Q,{tone:"informative",children:n.blocked}),f.jsxs("div",{className:"rp-arrange-grid",children:[f.jsx("div",{className:"rp-col",children:n.groups.length?n.groups.map(o=>f.jsx(Bn,{group:o,live:a.get(o.name),m:n},o.name)):f.jsx(lt,{children:r("policy.empty")})}),f.jsx(In,{m:n})]}),n.changes.length>0&&f.jsxs(En,{label:r("arrange.pendingRegion"),message:n.pendingText,children:[f.jsx(L,{quiet:!0,onPress:n.discard,isDisabled:n.busy,children:r("arrange.discard")}),f.jsx(L,{accent:!0,onPress:()=>n.setReviewing(!0),children:r("arrange.review")})]}),f.jsx(On,{m:n})]})}function Bn({group:e,live:t,m:r}){const n=W(),a=dt(),o=x.useId(),y=!!r.blocked,c=t?Sr(t.policy,n):null,D=async $=>{const l=await Promise.all($.filter(Rr).filter(d=>d.types.has(pe)).map(d=>d.getText(pe)));r.place(e.name,l.flatMap(d=>Cn(d)??[]))},v=($,l,d)=>f.jsx(L,{quiet:!0,icon:!0,small:!0,label:n("arrange.remove",{name:$,group:e.name}),isDisabled:y||r.applying||!!d,onPress:()=>r.unplace(e.name,l),children:f.jsx(ct,{})}),g=($,l)=>f.jsx(L,{quiet:!0,small:!0,label:n("arrange.undoRemove",{name:$}),isDisabled:r.applying,onPress:()=>r.place(e.name,[l]),children:n("arrange.undoShort")});return f.jsx(nn,{className:mr("rp-drop"),"aria-label":n("arrange.dropInto",{group:e.name}),isDisabled:y||r.applying,getDropOperation:$=>$.has(pe)?"copy":"cancel",onDrop:$=>void D($.items),children:({isDropTarget:$})=>f.jsxs(f.Fragment,{children:[f.jsx("div",{className:"rp-row",children:f.jsxs("span",{className:"rp-cluster",children:[f.jsx("h3",{className:"rp-h3",id:o,children:e.name}),c&&f.jsx(Ye,{tip:c.id,children:c.label}),t&&f.jsx(pr,{small:!0,tone:"neutral",children:n("arrange.memberCount",{n:t.member_count})}),e.isNew&&f.jsx(Ye,{children:n("arrange.new")})]})}),e.holdsAll&&f.jsx("p",{className:"rp-note",children:n("arrange.holdsAll")}),f.jsxs(fr,{reason:kn(e,y||r.applying),children:[(e.names.length>0||e.removedNames.length>0)&&f.jsxs(Je,{label:n("arrange.byName"),children:[f.jsx("span",{className:"rp-label rp-tags-title",children:n("arrange.byName")}),e.names.map(l=>f.jsx(ue,{tone:l.isNew?"new":void 0,action:v(l.name,{kind:"node",value:l.name},l.blocked),children:l.name},l.name)),e.removedNames.map(l=>f.jsx(ue,{tone:"removed",action:g(l,{kind:"node",value:l}),children:l},l))]}),(e.subscriptions.length>0||e.removedSubscriptions.length>0)&&f.jsxs(Je,{label:n("arrange.bySubscription"),children:[f.jsx("span",{className:"rp-label rp-tags-title",children:n("arrange.bySubscription")}),e.subscriptions.map(l=>f.jsx(ue,{tone:l.isNew?"new":void 0,action:v(l.label,{kind:"subscription",value:l.tag},l.blocked),children:l.count===null?l.label:n("arrange.subscriptionCount",{name:l.label,n:l.count})},l.tag)),e.removedSubscriptions.map(l=>f.jsx(ue,{tone:"removed",action:g(l.label,{kind:"subscription",value:l.tag}),children:l.label},l.tag))]})]}),e.rules.length>0&&f.jsxs("div",{className:"rp-arrange-rules",children:[f.jsx("span",{className:"rp-label",children:n("arrange.byRule")}),e.rules.map(l=>f.jsx(pt,{as:"code",text:l},l)),e.ruleNodes.length>0&&f.jsx("span",{children:e.ruleMore?n("arrange.ruleSelectsMore",{names:de(a,e.ruleNodes),n:e.ruleMore}):n("arrange.ruleSelects",{names:de(a,e.ruleNodes)})}),f.jsxs("span",{className:"rp-label",children:[e.ruleNote," ",f.jsx(gr,{appearance:"link",href:yr("config",{tab:"source"}),children:n("arrange.editSource")})]})]}),e.stillIn.length>0&&f.jsx(Q,{tone:"informative",children:n("arrange.stillIn",{names:de(a,e.stillIn)})}),$&&f.jsx("div",{className:"rp-drop-hint","aria-hidden":"true",children:n("arrange.dropHint")})]})})}function In({m:e}){const t=W(),r=x.useId(),n=!!e.blocked||e.applying,[a,o]=x.useState("all"),[y,c]=x.useState(new Set),D=x.useMemo(()=>[...a==="node"?[]:e.subscriptions.map(d=>({id:"subscription:"+d.tag,item:{ki
Line truncated
|
||||
@@ -1,4 +1,4 @@
|
||||
import{r as m,j as o}from"./vendor-react-Bf71BWbF.js";import{a0 as Re,aq as Te,ap as Xe,db as Ye,cL as q,an as Ze,a1 as xe,dc as en,dd as Le,de as nn,$ as Fe,y as Oe,h as we,N as oe,M as tn,df as sn,cP as Ae,u as F,a2 as ee,a as ne,a5 as on,ab as rn,a7 as ye,dg as ce,ay as He,dh as _e,bf as an,be as ln,A as cn,di as dn,bb as H,cO as $e,X as re,bc as Y,cA as de,dj as Be,dk as un,F as fn,dl as pn,D as gn,I as le,B as z,aG as ue,bx as Z,aH as fe,L as mn,aC as $,dm as hn,dn as bn,dp as vn,dq as xn,cz as wn,dr as yn,G as jn,ds as kn,b as Ie,ac as Sn,b2 as pe,T as G,af as Cn,bz as Nn,b1 as Dn,aE as We,dt as Mn,ae as Pn,du as En,aF as zn,E as Rn,j as Tn,aD as Ln,bn as Fn}from"./index-CXHBmSa5.js";import{d as On}from"./files-BxEOxSF8.js";import{r as An,d as Hn,a as _n,t as je,b as $n,w as ke,v as Bn,c as In,n as Wn}from"./setup-B5f1cfyO.js";import{g as Vn}from"./policyText-CAFy3qpo.js";import{a as Kn,s as Gn,c as Un}from"./nav-BeFLfZq8.js";import{S as qn,a as Jn,E as _,C as te,b as ge,l as Qn,h as Xn,c as Se,r as Yn,d as Zn,e as et,f as nt,i as tt,g as st,s as ot,k as rt,t as at,j as it,m as lt,n as ct,o as dt,p as ut,q as ft,u as pt,v as gt,w as Ve,D as J,R as mt,x as ht,y as bt,z as vt,A as xt,B as wt,F as Ke,H as yt,G as K}from"./vendor-editor-CF5uj9id.js";import{d as jt,s as kt,D as Ge}from"./DaeCode-STEiRZuV.js";import{A as St}from"./AddCircle-Db3HxlxQ.js";import{D as Ct}from"./Table-D0NFHHNQ.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";const Nt=["global","subscription","node","group","dns","routing"],Dt=(t,s,e)=>t?e("config.moduleEditBlocked"):s?e("ui.changeApplying"):void 0;function Ce(t,s){return`${q(t)}:${s.line+1}-${s.endLine+1}`}function Mt(t,s,e){return t.slice(0,s.from)+e+t.slice(s.to)}function Pt(t,s){const{section:e,text:n}=t,a=s.find(f=>f.id===e.id);if(a?.source?.content_sha256===e.source.content_sha256)return{next:null,conflict:!1};if(!a?.source?.content||!a.block)return{next:null,conflict:!0};const r=a.source.content.slice(a.block.from,a.block.to),l=e.source.content.slice(e.block.from,e.block.to);return{next:{section:{...a,source:a.source,block:a.block},text:n===l?r:n},conflict:r!==l&&n!==l&&r!==n}}function Et(t,s,e,n){const a=e.line+n.split(`
|
||||
`).length;return t.filter(r=>r.source_id===s&&r.line!==null&&r.line>e.line&&r.line<=a).map(r=>({line:r.line-e.line,column:r.column,level:r.level,message:r.message}))}function zt(t,s){return t.filter(e=>e.source_id===s&&e.line!==null).map(e=>({line:e.line,column:e.column,level:e.level,message:e.message}))}function ae(t,s,e){return e.filter(n=>n.from>s.open&&n.to<=s.close&&n.depth===s.depth+1&&n.parens===0&&n.kind==="text"&&t.slice(n.from,n.to)==="->").length}function Ne(t,s,e){const n=s.filter(a=>a.from>t.open&&a.to<=t.close&&a.depth===t.depth+1&&a.parens===0&&(a.kind==="quoted"||a.kind==="text")&&!e.some(r=>a.from>=r.from&&a.to<=r.to));return e.length+n.length}function Rt(t,s,e,n,a,r){const l=oe(s,e,n);switch(t){case"global":return r("config.moduleSettings",{n:l.length});case"subscription":return r("config.moduleSubscriptions",{n:Ne(e,n,l)});case"node":return r("config.moduleNodes",{n:Ne(e,n,l)});case"group":return r("config.moduleGroups",{n:e.children.length,policies:Fe(a,e.children.map(c=>{const f=oe(s,c,n).find(u=>u.name==="policy")?.value;if(!f)return c.name;const i=tn(f);return r("ui.valuePair",{label:c.name,value:i?Vn({kind:i,native:f},r).label:f})}))});case"dns":{const c=e.children.filter(i=>i.name==="upstream"),f=e.children.filter(i=>i.name==="routing").flatMap(i=>i.children);return[r("config.moduleDnsUpstreams",{n:c.reduce((i,u)=>i+oe(s,u,n).length,0)}),r("config.moduleDnsRequests",{n:f.filter(i=>i.name==="request").reduce((i,u)=>i+ae(s,u,n),0)}),r("config.moduleDnsResponses",{n:f.filter(i=>i.name==="response").reduce((i,u)=>i+ae(s,u,n),0)})].join(r("ui.listSeparator"))}case"routing":{const c=r("config.moduleRules",{n:ae(s,e,n)}),f=l.find(i=>i.name==="fallback")?.value;return f?c+r("ui.separator")+r("ui.valuePair",{label:"fallback",value:f}):c}}}function Tt(t,s,e,n){const r=t.filter(i=>i.kind==="main"||i.kind==="include").map(i=>({source:i,...Oe(i.content??"")})),l=t.find(i=>i.kind==="main")??null,c=Nt.flatMap(i=>{const u=i==="group"?we("policies"):i==="node"||i==="subscription"?we("nodes"):null,g=r.flatMap(({source:d,blocks:v,tokens:S})=>v.filter(w=>w.name===i).map((w,b)=>({id:`${d.id}:${i}:${b}`,kind:i,source:d,block:w,href:u,range:Ce(d,w),summary:Rt(i,d.content,w,S,e,n),note:null})));return g.length||l&&l.content===void 0?g:[{id:i,kind:i,source:l,block:null,href:u,range:l?q(l):"config.dae",summary:l?.content===void 0?"":l.writable?n("config.moduleAbsent",{file:q(l)}):n("config.moduleAbsentReadOnly"),note:l?.content===void 0?n("config.contentWithheld"):null}]}),f=r.flatMap(({source:i,blocks:u})=>i.content===void 0?[{id:i.id,kind:q(i),source:i,block:null,href:null,range:q(i),summary:"",note:n("config.contentWithheld")}]:s.redactedSections(u).map(({block:g,name:d},v)=>({id:`${i.id}:${g.name}:${v}`,kind:d,source:i,block:null,href:null,range:Ce(i,g),summary:"",note:n("config.incomplete")})));return[...c,...f]}function Q(t,s,e){const n=Re(Kn,t.kind,e);return{id:t.id,label:Ye(t)?`${n} ${t.id.slice(0,8)}`:t.path,kind:n,facts:e("config.sourceFacts",{n:t.line_count,size:Xe(String(t.bytes),s)}),loaded:e("config.loadedAt",{time:Te(t.loaded_at,s)}),hasContent:t.content!==void 0}}const Lt={generated:{label:"config.kind.generated",note:"config.generatedNote"},subscription:{label:"config.kind.subscription",note:"config.subscriptionNote"},disabled:{label:"config.readOnly",note:"config.readOnlyNote",help:"config.readOnlyHelp"},secret:{label:"config.secretSource",note:"config.secretNote"},refused:{label:"config.readOnly",note:"config.refusedNote"},withheld:{label:"config.withheldSource",note:"config.contentWithheld"},redacted:{label:"config.redactedSource",note:"config.redactedNote"}};function Ft(t,s,e,n,a){const r=t.kind==="generated"||t.kind==="subscription"?t.kind:s?t.writable?t.content===void 0?"withheld":e===!1?"redacted":null:n.holdsCredentials(t)?"secret":"refused":"disabled";if(!r)return null;const l=Lt[r],c=a(l.label);return{reason:r,label:c,note:a(l.note),...l.help&&{help:{title:c,text:a(l.help)}}}}const Ot={error:"err",warning:"warn",info:"info"},At={error:"config.level.error",warning:"config.level.warning",info:"config.level.info"};function se(t,s,e,n){const a=new Map(s.map(l=>[l.id,q(l)])),r=new Map;for(const l of t){const c=JSON.stringify([l.level,l.source_id,l.line,l.column,l.code,l.message]),f=r.get(c);f?f.count++:r.set(c,{item:l,count:1})}return[...r].map(([l,{item:c,count:f}])=>{const i=a.get(c.source_id)??c.source_id,u=Ze(c.code,c.message,n).summary,g=f>1?n("config.repeated",{text:u,n:xe(f,e)}):u,d=en(c.code)?n("config.backendDetail",{text:g,message:c.message}):g;return{id:l,level:c.level,tone:Ot[c.level],levelText:Re(At,c.level,n),sourceId:c.source_id,line:c.line,where:c.line===null?i:`${i}:${c.line}`,message:g,code:c.code,detail:c.line===null?d:n("config.atFile",{file:i,line:xe(c.line,e),message:d}),count:f}})}function ie(t){return{...An(t),rules:t.trim()?"keep":Hn}}function Ht(t,s,e){return s.content_sha256===e.content_sha256?null:t?"conflict":"follow"}function _t(t,s,e){return{groupUsedText
Line truncated
|
||||
import{r as m,j as o}from"./vendor-react-Bf71BWbF.js";import{a3 as Te,at as ze,as as Xe,dk as Ye,cS as q,aq as Ze,a4 as xe,dl as en,dm as Le,dn as nn,a2 as Fe,y as Oe,h as we,O as oe,N as tn,dp as sn,cW as He,u as F,a5 as ee,a as ne,a8 as on,ae as rn,aa as ye,dq as ce,aB as Ae,dr as _e,bj as an,bi as ln,A as cn,ds as dn,be as A,cV as Be,$ as re,bf as Y,cE as de,dt as Ie,du as un,D as fn,dv as pn,C as gn,I as le,B as R,aJ as ue,bB as Z,aK as fe,L as mn,aF as B,dw as hn,dx as bn,dy as vn,dz as xn,cD as wn,dA as yn,H as jn,dB as kn,b as $e,af as Sn,b5 as pe,T as G,ai as Cn,bD as Dn,b4 as Nn,aH as We,dC as Mn,ah as Pn,dD as En,aI as Rn,E as Tn,j as zn,aG as Ln,br as Fn}from"./index-BNBwb-FJ.js";import{d as On}from"./files-BxEOxSF8.js";import{r as Hn,d as An,a as _n,t as je,b as Bn,w as ke,v as In,c as $n,n as Wn}from"./setup-d2VGFWY1.js";import{g as Vn}from"./policyText-CmeXgUK2.js";import{a as Kn,s as Gn,c as Un}from"./nav-BeFLfZq8.js";import{S as qn,a as Jn,E as _,C as te,b as ge,l as Qn,h as Xn,c as Se,r as Yn,d as Zn,e as et,f as nt,i as tt,g as st,s as ot,k as rt,t as at,j as it,m as lt,n as ct,o as dt,p as ut,q as ft,u as pt,v as gt,w as Ve,D as J,R as mt,x as ht,y as bt,z as vt,A as xt,B as wt,F as Ke,H as yt,G as K}from"./vendor-editor-CF5uj9id.js";import{d as jt,s as kt,D as Ge}from"./DaeCode-B8yPDjSE.js";import{A as St}from"./AddCircle-CIj8X2wL.js";import{D as Ct}from"./Table-DyWJelc_.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";const Dt=["global","subscription","node","group","dns","routing"],Nt=(t,s,e)=>t?e("config.moduleEditBlocked"):s?e("ui.changeApplying"):void 0;function Ce(t,s){return`${q(t)}:${s.line+1}-${s.endLine+1}`}function Mt(t,s,e){return t.slice(0,s.from)+e+t.slice(s.to)}function Pt(t,s){const{section:e,text:n}=t,a=s.find(f=>f.id===e.id);if(a?.source?.content_sha256===e.source.content_sha256)return{next:null,conflict:!1};if(!a?.source?.content||!a.block)return{next:null,conflict:!0};const r=a.source.content.slice(a.block.from,a.block.to),l=e.source.content.slice(e.block.from,e.block.to);return{next:{section:{...a,source:a.source,block:a.block},text:n===l?r:n},conflict:r!==l&&n!==l&&r!==n}}function Et(t,s,e,n){const a=e.line+n.split(`
|
||||
`).length;return t.filter(r=>r.source_id===s&&r.line!==null&&r.line>e.line&&r.line<=a).map(r=>({line:r.line-e.line,column:r.column,level:r.level,message:r.message}))}function Rt(t,s){return t.filter(e=>e.source_id===s&&e.line!==null).map(e=>({line:e.line,column:e.column,level:e.level,message:e.message}))}function ae(t,s,e){return e.filter(n=>n.from>s.open&&n.to<=s.close&&n.depth===s.depth+1&&n.parens===0&&n.kind==="text"&&t.slice(n.from,n.to)==="->").length}function De(t,s,e){const n=s.filter(a=>a.from>t.open&&a.to<=t.close&&a.depth===t.depth+1&&a.parens===0&&(a.kind==="quoted"||a.kind==="text")&&!e.some(r=>a.from>=r.from&&a.to<=r.to));return e.length+n.length}function Tt(t,s,e,n,a,r){const l=oe(s,e,n);switch(t){case"global":return r("config.moduleSettings",{n:l.length});case"subscription":return r("config.moduleSubscriptions",{n:De(e,n,l)});case"node":return r("config.moduleNodes",{n:De(e,n,l)});case"group":return r("config.moduleGroups",{n:e.children.length,policies:Fe(a,e.children.map(c=>{const f=oe(s,c,n).find(u=>u.name==="policy")?.value;if(!f)return c.name;const i=tn(f);return r("ui.valuePair",{label:c.name,value:i?Vn({kind:i,native:f},r).label:f})}))});case"dns":{const c=e.children.filter(i=>i.name==="upstream"),f=e.children.filter(i=>i.name==="routing").flatMap(i=>i.children);return[r("config.moduleDnsUpstreams",{n:c.reduce((i,u)=>i+oe(s,u,n).length,0)}),r("config.moduleDnsRequests",{n:f.filter(i=>i.name==="request").reduce((i,u)=>i+ae(s,u,n),0)}),r("config.moduleDnsResponses",{n:f.filter(i=>i.name==="response").reduce((i,u)=>i+ae(s,u,n),0)})].join(r("ui.listSeparator"))}case"routing":{const c=r("config.moduleRules",{n:ae(s,e,n)}),f=l.find(i=>i.name==="fallback")?.value;return f?c+r("ui.separator")+r("ui.valuePair",{label:"fallback",value:f}):c}}}function zt(t,s,e,n){const r=t.filter(i=>i.kind==="main"||i.kind==="include").map(i=>({source:i,...Oe(i.content??"")})),l=t.find(i=>i.kind==="main")??null,c=Dt.flatMap(i=>{const u=i==="group"?we("policies"):i==="node"||i==="subscription"?we("nodes"):null,g=r.flatMap(({source:d,blocks:v,tokens:S})=>v.filter(w=>w.name===i).map((w,b)=>({id:`${d.id}:${i}:${b}`,kind:i,source:d,block:w,href:u,range:Ce(d,w),summary:Tt(i,d.content,w,S,e,n),note:null})));return g.length||l&&l.content===void 0?g:[{id:i,kind:i,source:l,block:null,href:u,range:l?q(l):"config.dae",summary:l?.content===void 0?"":l.writable?n("config.moduleAbsent",{file:q(l)}):n("config.moduleAbsentReadOnly"),note:l?.content===void 0?n("config.contentWithheld"):null}]}),f=r.flatMap(({source:i,blocks:u})=>i.content===void 0?[{id:i.id,kind:q(i),source:i,block:null,href:null,range:q(i),summary:"",note:n("config.contentWithheld")}]:s.redactedSections(u).map(({block:g,name:d},v)=>({id:`${i.id}:${g.name}:${v}`,kind:d,source:i,block:null,href:null,range:Ce(i,g),summary:"",note:n("config.incomplete")})));return[...c,...f]}function Q(t,s,e){const n=Te(Kn,t.kind,e);return{id:t.id,label:Ye(t)?`${n} ${t.id.slice(0,8)}`:t.path,kind:n,facts:e("config.sourceFacts",{n:t.line_count,size:Xe(String(t.bytes),s)}),loaded:e("config.loadedAt",{time:ze(t.loaded_at,s)}),hasContent:t.content!==void 0}}const Lt={generated:{label:"config.kind.generated",note:"config.generatedNote"},subscription:{label:"config.kind.subscription",note:"config.subscriptionNote"},disabled:{label:"config.readOnly",note:"config.readOnlyNote",help:"config.readOnlyHelp"},secret:{label:"config.secretSource",note:"config.secretNote"},refused:{label:"config.readOnly",note:"config.refusedNote"},withheld:{label:"config.withheldSource",note:"config.contentWithheld"},redacted:{label:"config.redactedSource",note:"config.redactedNote"}};function Ft(t,s,e,n,a){const r=t.kind==="generated"||t.kind==="subscription"?t.kind:s?t.writable?t.content===void 0?"withheld":e===!1?"redacted":null:n.holdsCredentials(t)?"secret":"refused":"disabled";if(!r)return null;const l=Lt[r],c=a(l.label);return{reason:r,label:c,note:a(l.note),...l.help&&{help:{title:c,text:a(l.help)}}}}const Ot={error:"err",warning:"warn",info:"info"},Ht={error:"config.level.error",warning:"config.level.warning",info:"config.level.info"};function se(t,s,e,n){const a=new Map(s.map(l=>[l.id,q(l)])),r=new Map;for(const l of t){const c=JSON.stringify([l.level,l.source_id,l.line,l.column,l.code,l.message]),f=r.get(c);f?f.count++:r.set(c,{item:l,count:1})}return[...r].map(([l,{item:c,count:f}])=>{const i=a.get(c.source_id)??c.source_id,u=Ze(c.code,c.message,n).summary,g=f>1?n("config.repeated",{text:u,n:xe(f,e)}):u,d=en(c.code)?n("config.backendDetail",{text:g,message:c.message}):g;return{id:l,level:c.level,tone:Ot[c.level],levelText:Te(Ht,c.level,n),sourceId:c.source_id,line:c.line,where:c.line===null?i:`${i}:${c.line}`,message:g,code:c.code,detail:c.line===null?d:n("config.atFile",{file:i,line:xe(c.line,e),message:d}),count:f}})}function ie(t){return{...Hn(t),rules:t.trim()?"keep":An}}function At(t,s,e){return s.content_sha256===e.content_sha256?null:t?"conflict":"follow"}function _t(t,s,e){return{groupUsedText
Line truncated
|
||||
|
||||
}`;v.dispatch({changes:{from:w,to:b,insert:x},selection:{anchor:w+d.label.length+4}})}}));else if(u==="routing"||u==="dns")g=[...Xt,...es];else if(u==="global")g=Qt;else if(u==="group")g=/\bpolicy\s*:\s*[\w.-]*$/.test(a)?De:[...De.map(d=>({...d,apply:"policy: "+d.label})),{label:"filter",type:"property",apply:"filter: "}];else return null;return{from:e.from,options:g,validFor:/^[\w.-]*$/}}function ts(t){return Jn({override:[s=>ns(s,t)]})}function ss(t,s){return s.filter(e=>e.line>=1&&e.line<=t.doc.lines).map(e=>{const n=t.doc.line(e.line),a=Math.max(0,(e.column??1)-1),r=new TextEncoder().encode(n.text);let l=0;for(let f=0;f<Math.min(a,r.length);){const i=r[f]<128?1:r[f]<224?2:r[f]<240?3:4;if(f+i>a)break;f+=i,l+=i===4?2:1}return{from:n.from+l,to:n.to,severity:e.level,message:e.message}})}function os(t){return t.key==="Backspace"||t.key==="Delete"||t.key==="Enter"?!0:[...t.key].length===1&&!t.ctrlKey&&!t.metaKey}function rs(t){let s=!1;const e=n=>(n.state.readOnly&&t(),!1);return _.domEventHandlers({keydown:(n,a)=>os(n)&&e(a),paste:(n,a)=>e(a),cut:(n,a)=>e(a),pointerdown:n=>(s=n.pointerType==="touch",!1),click:(n,a)=>s&&e(a)})}const as=[["Completions","cm.completions"],["Find","cm.find"],["Replace","cm.replace"],["next","cm.next"],["previous","cm.previous"],["all","cm.all"],["match case","cm.matchCase"],["regexp","cm.regexp"],["by word","cm.byWord"],["replace","cm.replaceOne"],["replace all","cm.replaceAll"],["close","close"],["Go to line","cm.gotoLine"],["go","cm.go"],["current match","cm.currentMatch"],["replaced $ matches","cm.replacedMatches"],["replaced match on line $","cm.replacedOnLine"],["on line","cm.onLine"],["Selection deleted","cm.selectionDeleted"],["Control character","cm.controlCharacter"]],Me=t=>ge.phrases.of(Object.fromEntries(as.map(([s,e])=>[s,t(e)]))),is=_.theme({"&":{backgroundColor:"var(--rp-base)",color:"var(--rp-text)",border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-md)",fontSize:"var(--rp-text-sm)"},"&.cm-focused":{outline:"none",borderColor:"var(--rp-accent)",boxShadow:"0 0 0 1px var(--rp-accent)"},".cm-scroller":{fontFamily:"ui-monospace, 'SF Mono', Menlo, Consolas, 'JetBrains Mono', 'Fira Code', 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono', monospace",lineHeight:"20px",maxHeight:"70vh",fontVariantLigatures:"none",borderRadius:"calc(var(--rp-r-md) - 1px)"},".cm-content":{padding:"8px 0",caretColor:"var(--rp-text)"},".cm-line":{padding:"0 12px"},".cm-gutters":{backgroundColor:"var(--rp-base)",color:"var(--rp-muted)",border:"none"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 12px",minWidth:"40px"},".cm-activeLine, .cm-focusLine":{backgroundColor:"color-mix(in srgb, var(--rp-hl-med) 60%, transparent)"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"var(--rp-text)"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:"var(--rp-hl-high)"},".cm-cursor":{borderLeftColor:"var(--rp-text)"},".cm-matchingBracket":{backgroundColor:"color-mix(in srgb, var(--rp-accent) 20%, transparent)",outline:"none"},".cm-selectionMatch":{backgroundColor:"color-mix(in srgb, var(--rp-notice) 25%, transparent)"},".cm-tooltip.cm-tooltip-lint":{backgroundColor:"var(--rp-text)",color:"var(--rp-on-text)",border:"none",borderRadius:"var(--rp-r-sm)",padding:"2px 0"},".cm-tooltip-lint .cm-diagnostic":{border:"none",padding:"2px 8px",fontSize:"var(--rp-text-xs)",lineHeight:"16px",fontFamily:"inherit"},".cm-tooltip-lint .cm-diagnosticText":{color:"inherit"},".cm-diag-line-error":{backgroundColor:"color-mix(in srgb, var(--rp-negative) 14%, transparent)"},".cm-diag-line-warning":{backgroundColor:"color-mix(in srgb, var(--rp-notice) 16%, transparent)"},".cm-diag-line-info":{backgroundColor:"color-mix(in srgb, var(--rp-foam) 14%, transparent)"},".cm-lintRange-error":{backgroundImage:"none",textDecoration:"underline wavy var(--rp-negative)",textUnderlineOffset:"3px"},".cm-lintRange-warning":{backgroundImage:"none",textDecoration:"underline wavy var(--rp-notice)",textUnderlineOffset:"3px"},".cm-lintRange-info":{backgroundImage:"none",textDecoration:"underline dotted var(--rp-foam)",textUnderlineOffset:"3px"},".cm-tooltip":{backgroundColor:"var(--rp-surface)",border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-md)",color:"var(--rp-text)"},".cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"var(--rp-selected)",color:"var(--rp-text)"},".cm-tooltip.cm-tooltip-autocomplete > ul":{fontFamily:"ui-monospace, 'SF Mono', Menlo, Consolas, 'JetBrains Mono', 'Fira Code', 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono', monospace"},".cm-panels":{backgroundColor:"var(--rp-surface)",color:"var(--rp-text)"},".cm-panels-bottom":{borderTop:"1px solid var(--rp-hl-med)"},".cm-textfield":{border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-sm)",backgroundColor:"var(--rp-base)",color:"var(--rp-text)"},".cm-button":{border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-sm)",backgroundImage:"none
Line truncated
|
||||
}`;v.dispatch({changes:{from:w,to:b,insert:x},selection:{anchor:w+d.label.length+4}})}}));else if(u==="routing"||u==="dns")g=[...Xt,...es];else if(u==="global")g=Qt;else if(u==="group")g=/\bpolicy\s*:\s*[\w.-]*$/.test(a)?Ne:[...Ne.map(d=>({...d,apply:"policy: "+d.label})),{label:"filter",type:"property",apply:"filter: "}];else return null;return{from:e.from,options:g,validFor:/^[\w.-]*$/}}function ts(t){return Jn({override:[s=>ns(s,t)]})}function ss(t,s){return s.filter(e=>e.line>=1&&e.line<=t.doc.lines).map(e=>{const n=t.doc.line(e.line),a=Math.max(0,(e.column??1)-1),r=new TextEncoder().encode(n.text);let l=0;for(let f=0;f<Math.min(a,r.length);){const i=r[f]<128?1:r[f]<224?2:r[f]<240?3:4;if(f+i>a)break;f+=i,l+=i===4?2:1}return{from:n.from+l,to:n.to,severity:e.level,message:e.message}})}function os(t){return t.key==="Backspace"||t.key==="Delete"||t.key==="Enter"?!0:[...t.key].length===1&&!t.ctrlKey&&!t.metaKey}function rs(t){let s=!1;const e=n=>(n.state.readOnly&&t(),!1);return _.domEventHandlers({keydown:(n,a)=>os(n)&&e(a),paste:(n,a)=>e(a),cut:(n,a)=>e(a),pointerdown:n=>(s=n.pointerType==="touch",!1),click:(n,a)=>s&&e(a)})}const as=[["Completions","cm.completions"],["Find","cm.find"],["Replace","cm.replace"],["next","cm.next"],["previous","cm.previous"],["all","cm.all"],["match case","cm.matchCase"],["regexp","cm.regexp"],["by word","cm.byWord"],["replace","cm.replaceOne"],["replace all","cm.replaceAll"],["close","close"],["Go to line","cm.gotoLine"],["go","cm.go"],["current match","cm.currentMatch"],["replaced $ matches","cm.replacedMatches"],["replaced match on line $","cm.replacedOnLine"],["on line","cm.onLine"],["Selection deleted","cm.selectionDeleted"],["Control character","cm.controlCharacter"]],Me=t=>ge.phrases.of(Object.fromEntries(as.map(([s,e])=>[s,t(e)]))),is=_.theme({"&":{backgroundColor:"var(--rp-base)",color:"var(--rp-text)",border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-md)",fontSize:"var(--rp-text-sm)"},"&.cm-focused":{outline:"none",borderColor:"var(--rp-accent)",boxShadow:"0 0 0 1px var(--rp-accent)"},".cm-scroller":{fontFamily:"ui-monospace, 'SF Mono', Menlo, Consolas, 'JetBrains Mono', 'Fira Code', 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono', monospace",lineHeight:"20px",maxHeight:"70vh",fontVariantLigatures:"none",borderRadius:"calc(var(--rp-r-md) - 1px)"},".cm-content":{padding:"8px 0",caretColor:"var(--rp-text)"},".cm-line":{padding:"0 12px"},".cm-gutters":{backgroundColor:"var(--rp-base)",color:"var(--rp-muted)",border:"none"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 12px",minWidth:"40px"},".cm-activeLine, .cm-focusLine":{backgroundColor:"color-mix(in srgb, var(--rp-hl-med) 60%, transparent)"},".cm-activeLineGutter":{backgroundColor:"transparent",color:"var(--rp-text)"},".cm-selectionBackground, &.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:"var(--rp-hl-high)"},".cm-cursor":{borderLeftColor:"var(--rp-text)"},".cm-matchingBracket":{backgroundColor:"color-mix(in srgb, var(--rp-accent) 20%, transparent)",outline:"none"},".cm-selectionMatch":{backgroundColor:"color-mix(in srgb, var(--rp-notice) 25%, transparent)"},".cm-tooltip.cm-tooltip-lint":{backgroundColor:"var(--rp-text)",color:"var(--rp-on-text)",border:"none",borderRadius:"var(--rp-r-sm)",padding:"2px 0"},".cm-tooltip-lint .cm-diagnostic":{border:"none",padding:"2px 8px",fontSize:"var(--rp-text-xs)",lineHeight:"16px",fontFamily:"inherit"},".cm-tooltip-lint .cm-diagnosticText":{color:"inherit"},".cm-diag-line-error":{backgroundColor:"color-mix(in srgb, var(--rp-negative) 14%, transparent)"},".cm-diag-line-warning":{backgroundColor:"color-mix(in srgb, var(--rp-notice) 16%, transparent)"},".cm-diag-line-info":{backgroundColor:"color-mix(in srgb, var(--rp-foam) 14%, transparent)"},".cm-lintRange-error":{backgroundImage:"none",textDecoration:"underline wavy var(--rp-negative)",textUnderlineOffset:"3px"},".cm-lintRange-warning":{backgroundImage:"none",textDecoration:"underline wavy var(--rp-notice)",textUnderlineOffset:"3px"},".cm-lintRange-info":{backgroundImage:"none",textDecoration:"underline dotted var(--rp-foam)",textUnderlineOffset:"3px"},".cm-tooltip":{backgroundColor:"var(--rp-surface)",border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-md)",color:"var(--rp-text)"},".cm-tooltip.cm-tooltip-autocomplete > ul > li[aria-selected]":{backgroundColor:"var(--rp-selected)",color:"var(--rp-text)"},".cm-tooltip.cm-tooltip-autocomplete > ul":{fontFamily:"ui-monospace, 'SF Mono', Menlo, Consolas, 'JetBrains Mono', 'Fira Code', 'DejaVu Sans Mono', 'Liberation Mono', 'Noto Sans Mono', monospace"},".cm-panels":{backgroundColor:"var(--rp-surface)",color:"var(--rp-text)"},".cm-panels-bottom":{borderTop:"1px solid var(--rp-hl-med)"},".cm-textfield":{border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-sm)",backgroundColor:"var(--rp-base)",color:"var(--rp-text)"},".cm-button":{border:"1px solid var(--rp-hl-high)",borderRadius:"var(--rp-r-sm)",backgroundImage:"none
Line truncated
|
||||
@@ -0,0 +1,3 @@
|
||||
import{j as s,r as w}from"./vendor-react-Bf71BWbF.js";import{aP as xn,aQ as wn,aR as fe,aS as de,u as X,aE as Je,a5 as ve,a as ye,as as te,aT as ee,aU as vn,aI as $e,aV as yn,aJ as ge,E as je,a4 as ie,aW as jn,aX as _n,Y as ue,$ as re,a1 as kn,a3 as _e,aY as ke,aZ as Xe,a_ as xe,at as Cn,a$ as Nn,b0 as Sn,b1 as Ln,ax as Ae,b2 as Mn,b3 as Ye,aK as we,aH as le,af as An,I as Te,b4 as qe,b5 as ce,B as R,b6 as Tn,b7 as Pn,b8 as Ze,b9 as Rn,a8 as ze,aa as G,ae as Dn,ac as Fn,ba as On,bb as In,bc as Bn,bd as En,be as J,f as Pe,bf as Wn,X as Hn,a9 as Un,bg as Vn,bh as Kn,a0 as Qn,ab as Gn,bi as Jn,bj as en,bk as $n,b as Re,bl as Xn,bm as Yn,A as qn,T as De,bn as me,bo as Zn,bp as zn,bq as et,aF as nt,aG as Fe,br as tt}from"./index-BNBwb-FJ.js";import{F as st}from"./FactStrip-n2q1T87k.js";import{B as ot,r as at}from"./ranked-B09X8uKl.js";import{u as lt,C as it,s as Oe,a as rt,p as Ie}from"./layout-wfdMYi2n.js";import{D as ct}from"./Table-DyWJelc_.js";import{T as dt}from"./TimeCell-DUt0i0gi.js";import{t as z,r as nn,a as ut}from"./link-CIkWI7An.js";import{w as Be}from"./labels-Bgu_ZhL8.js";import{c as Ee,d as pt,e as bt}from"./files-BxEOxSF8.js";import{D as mt}from"./DaeCode-B8yPDjSE.js";import{u as ht}from"./outbounds-DPmb26w8.js";import{u as ft}from"./flows-CMFlFH_d.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";const Q=64,gt=22,Z=8,xt=28;function wt({label:e,series:t,fmt:n,onSelect:a,regions:r,height:i=260}){const o=xn(),[l,c]=wn(),{ref:b,tip:y,show:p,hide:m}=lt(),k=Math.max(1,...t.flatMap(h=>h.points.flatMap(T=>[T.x,T.y]))),{end:N,ticks:f}=rt(k),u=Math.max((c??0)-Q-xt,1),C=i-Z-gt,v=h=>Q+Oe(h,N)*u,_=h=>Z+(1-Oe(h,N))*C,S=new Map,I=t.flatMap(h=>h.points.map(T=>{const L=v(T.x),j=_(T.y),A=L+","+j,F=S.get(A)??0;return S.set(A,F+1),{point:T,color:h.color,cx:L,cy:j,nth:F,spot:A}})).map(h=>({...h,twins:S.get(h.spot)}));return s.jsx("div",{className:"rp-scatter",ref:l,children:s.jsxs("div",{className:"rp-chart-hover",ref:b,onPointerLeave:m,children:[c!==null&&s.jsxs("svg",{width:c,height:i,role:"img","aria-label":e,"aria-describedby":o,children:[f.map(h=>s.jsxs("g",{children:[s.jsx("line",{className:"grid",x1:v(h),x2:v(h),y1:Z,y2:Z+C}),s.jsx("line",{className:"grid",x1:Q,x2:Q+u,y1:_(h),y2:_(h)}),s.jsx("text",{className:"tick",x:v(h),y:i-6,textAnchor:"middle",children:n(h)}),s.jsx("text",{className:"tick",x:Q-8,y:_(h)+4,textAnchor:"end",children:n(h)})]},h)),r&&s.jsxs("g",{className:"diagonal",children:[s.jsx("line",{x1:v(0),y1:_(0),x2:v(N),y2:_(N)}),s.jsx("text",{x:Q+8,y:Z+14,children:r.above}),s.jsx("text",{x:Q+u-8,y:Z+C-8,textAnchor:"end",children:r.below})]}),I.map(({point:h,color:T,cx:L,cy:j,nth:A,twins:F})=>{const B=2*Math.PI*A/F,V=F>1?6:0;return s.jsx("circle",{className:a?"pick":void 0,cx:L+V*Math.cos(B),cy:j+V*Math.sin(B),r:5,fill:T,onClick:a?()=>a(h.id):void 0,onPointerMove:D=>p(D,[h.name,h.detail])},h.id)})]}),s.jsx(it,{tip:y})]})})}function vt({series:e}){return s.jsx("div",{className:"rp-legend",children:e.map(t=>s.jsx(fe,{swatch:t.color,label:t.label,value:String(t.points.length)},t.id))})}function yt(e){const t=new Map;let n=0;for(const o of e){if(o.upload_bytes===null||o.download_bytes===null){n++;continue}const l={id:o.id,up:Number(o.upload_bytes),down:Number(o.download_bytes),name:o.domain||o.dst||o.id},c=t.get(o.outbound);c?c.push(l):t.set(o.outbound,[l])}const a=[...t].map(([o,l])=>({outbound:o,points:l})).sort((o,l)=>de(o.outbound??"",l.outbound??""));let r,i=-1n;for(const o of e){if(o.upload_bytes===null||o.download_bytes===null)continue;const l=BigInt(o.upload_bytes)+BigInt(o.download_bytes);l>i&&(i=l,r={id:o.id,up:Number(o.upload_bytes),down:Number(o.download_bytes),name:o.domain||o.dst||o.id,outbound:o.outbound})}return{series:a,unknown:n,heaviest:r,placed:e.length-n}}const We=[0,2,3,1,4,5,6,7],jt=w.memo(function({records:t,outbounds:n,latency:a,latencyError:r,retryLatency:i,truncated:o,onSelect:l}){const c=X(),b=Je(),y=ve[ye()],p=w.useCallback(u=>te(u,y),[y]),m=w.useMemo(()=>yt(t),[t]),k=w.useMemo(()=>{const u=n.filter(v=>v!=="block"),C=v=>v==="block"?b.negative:b.cat[We[Math.max(0,u.indexOf(v))%We.length]];return m.series.map(v=>({id:v.outbound??"",label:ee(v.outbound,c),color:C(v.outbound),points:v.points.map(_=>({id:_.id,x:_.up,y:_.down,name:_.name,detail:c("conn.chart.point",{down:p(_.down),up:p(_.up)})}))}))},[m,n,b,c,p]),N=m.heaviest?[{label:c("conn.chart.busiest"),icon:s.jsx(vn,{}),tint:"c3",value:m.heaviest.name,caption:ee(m.heaviest.outbound,c)},{label:c("conn.chart.down"),value:p(m.heaviest.down),icon:s.jsx($e,{}),tint:"c1"},{label:c("conn.chart.up"),value:p(m.heaviest.up),icon:s.jsx(yn,{}),tint:"c4"}]:[],f=m.unknown?c("conn.chart.sampleUnknown",{n:t.length,unknown:m.unknown}):c("conn.chart.sample",{n:t.length});return s.jsxs("div",{className:"rp-chart-page",children:[s.jsx(st,{facts:N,lead:!0}),s.jsxs(ge,{title:c("conn.chart.title"),note:f,children:[o&&s.jsx("p",{className:"rp-note",children:c("conn.truncated")}),m.pLine truncated
|
||||
`)+`
|
||||
`}function Bt(e,t){const n=e.map(r=>r.id),a=t.bulkLimit!=null&&n.length>t.bulkLimit;return t.narrowed||t.truncated||a?{ids:n}:{ids:n,query:{type:t.network,src:t.src,all:!0}}}const Et=e=>e.target;function Wt({collection:e,view:t,collapse:n,onToggleGroup:a,loading:r,selected:i,onSelect:o,selectOnFocus:l,onSort:c}){const b=X(),[y,p]=Mn(442),m=w.useMemo(()=>{const f={dst:u=>s.jsx(le,{children:u.target}),src:u=>s.jsx(le,{className:"rp-code",children:u.source}),node:u=>s.jsx(le,{className:"rp-chain",text:u.path??void 0,children:u.node}),rule:u=>s.jsxs("span",{className:"rp-rule",children:[s.jsx(Ye,{...u.rule}),u.recomputed&&s.jsx(we,{children:u.recomputed})]}),state:u=>u.state,down:u=>u.download,downRate:u=>u.downloadRate,age:u=>s.jsx(dt,{at:u.startedAt})};return $.filter(u=>!t.hidden.includes(u.id)).map(u=>({...u,label:b(u.label),grow:1,render:f[u.id]}))},[t.hidden,b]),k=w.useMemo(()=>e.map(f=>"connection"in f?f.connection:f),[e]),N=w.useMemo(()=>({grouped:t.group!=="none",collapsed:f=>tn(n,f),onToggle:a}),[t.group,n,a]);return s.jsx("div",{ref:y,children:s.jsx(ct,{label:b("nav.connections"),rowDetail:!0,cols:m,rows:k,height:p,selected:i&&Ce(i),onSelect:o&&(f=>o(f&&Lt(f))),selectOnFocus:l,reveal:!0,empty:b("conn.empty"),loading:r,sort:t.sort&&{column:String(t.sort.column),direction:t.sort.direction},onSort:c,getTextValue:Et,stream:!0,tree:N})})}function Ht({dialog:e}){const t=X();return s.jsxs(An,{title:t("rule.add"),narrow:!0,isOpen:!!e,reason:e?.reason,onOpenChange:n=>{n||e?.close()},footer:()=>s.jsxs(s.Fragment,{children:[s.jsx(R,{onPress:()=>e?.close(),children:t("ui.cancel")}),s.jsx(R,{isDisabled:e?.disabled,isPending:e?.busy,onPress:()=>e?.applyNow(),children:t("rule.addApply")}),s.jsx(R,{accent:!0,isDisabled:e?.disabled||e?.busy,onPress:()=>e?.hold(),children:t("rule.hold")})]}),children:[e?.failure&&s.jsx(Te,{takeFocus:!0,children:e.failure.text},e.failure.id),e&&s.jsxs("div",{className:"rp-list",children:[e.failure?.lines.map((n,a)=>s.jsx("span",{className:"rp-label",children:n},a)),s.jsx(je,{error:e.loadError,onRetry:e.retry}),s.jsx("span",{className:"rp-label",children:t("rule.holdHelp")}),e.targets&&s.jsx(qe,{isDisabled:e.busy,label:t("rule.kind"),value:e.target,onChange:e.setTarget,items:e.targets}),s.jsxs("div",{className:"rp-toolbar top",children:[s.jsx(ce,{isDisabled:e.busy,label:t("ui.outbound"),value:e.outbound,onChange:e.setOutbound,items:e.outbounds}),s.jsx(ce,{isDisabled:e.busy||!e.positions.length,label:t("rule.position"),value:e.before,onChange:e.setBefore,items:e.positions})]}),e.moved&&s.jsx(Te,{tone:"informative",children:t("conn.ruleMoved")}),e.unplaceable&&s.jsx("p",{className:"rp-note",children:t("conn.ruleNoPosition")}),s.jsx(mt,{text:e.preview})]})]})}function Ut(e,t){if(!t.some(p=>p.health?.length))return null;const n=[];let a=0;for(const p of t){const m=Tn(Pn(p.health??[]));m===void 0?a++:n.push({node:p.id,name:p.name,value:m,connections:0})}n.sort((p,m)=>p.value-m.value||de(p.name,m.name));const r=new Map(n.map(p=>[p.node,p])),i=e.some(p=>p.chain?.length);let o=0;for(const p of e){const m=p.chain?.at(-1);if(m===void 0)continue;const k=r.get(m);k?k.connections++:o++}const l=n.reduce((p,m)=>p+m.connections,0);let c=0;const b=n.find(p=>(c+=p.connections)>=Math.max(1,Math.ceil(l/2))),y=n.map(p=>p.value);return{samples:n,chains:i,missing:a,unplaced:o,used:n.filter(p=>p.connections).length,p50:Ie(y,50),p90:Ie(y,90),weightedP50:l?b.value:null}}function Vt(e){const t=r=>r.flatMap(([i,o])=>{const l=Rn(i,o);return l?[{kind:i,condition:l}]:[]}),n=e.domain?t([["domain",e.domain],["domainSuffix",e.domain]]):[],a=ue(e.dst);return n.length?n:a?t([["dip",a]]):[]}function Kt(e,t,n,a){const r=c=>an(c,t),i=e.find(c=>c.rule_id===n&&r(c)),o=e.find(r),l=c=>c===e[0]?a("conn.ruleTop"):a("rule.positionBefore",{n:c.index+1});return[...i?[{rule:i,label:a("conn.ruleBeforeMatched")}]:[],...o&&o!==i?[{rule:o,label:l(o)}]:[]].map(({rule:c,label:b})=>({id:c.rule_id,label:b,desc:c.expression}))}function an(e,t){const n=e&&t.find(a=>a.id===e.source?.source_id);return!!n?.writable&&Ze(n,e)!==null}function Qt(e,t,n){if(!t)return{before:e[0]?.id,moved:!1};const a=e.find(r=>r.id===t.rule.rule_id&&(n===t.generation||r.desc===t.rule.expression));return a?{before:a.id,moved:!1}:{before:e[0]?.id,moved:!0}}function Gt({disabled:e,busy:t,failed:n,unplaceable:a},r){return e&&!t&&!n&&!a?r("ui.loading"):null}function Jt(e){const t=X(),n=ze().data?.resources,a=G(n,"rules",{whileLoading:!1})&&G(n,"config",{whileLoading:!1})&&n?.config.writable===!0,[r,i]=w.useState(null),[o,l]=w.useState(null),c=!!r,b=a?e?.rule_id??null:null,y=ft(c||!!b),p=Dn(c||!!b),m=G(n,"groups",{whileLoading:!1}),k=Fn(c&&m),N=()=>{y.refetch(),p.refetch(),m&&k.refetch()},f=On(),u=p.data?.sources??[],C=Kt(y.data?.rules??[],u,r?.matched??null,t),v=In(k.data??[]),_=!m||!!k.data,S=r?.outbound||v.find(x=>x.id===r?.current)?.id||(_?v[0].id:""),Y=y.data?.generation_id,I=x=>{const M=y.data?.rules.find(O=>O.rule_id===x);return M&&Y?{generation:Y,rule:M}:null},{befo
Line truncated
|
||||
@@ -1,3 +0,0 @@
|
||||
import{j as s,r as g}from"./vendor-react-Bf71BWbF.js";import{aM as fn,aN as gn,aO as fe,aP as de,u as Y,aB as Ge,a2 as ve,a as ye,ap as te,aQ as ee,aR as xn,aF as Je,aS as wn,aG as ge,E as je,a1 as ie,aT as vn,aU as yn,V as ue,X as re,Z as jn,a0 as ke,aV as _e,aW as Xe,aX as xe,aq as kn,aY as _n,aZ as Cn,a_ as Nn,au as Ae,a$ as Mn,b0 as Ye,aH as we,aE as le,ac as Ln,I as Te,b1 as Ze,b2 as ce,B as F,b3 as Sn,b4 as An,b5 as $e,b6 as Tn,a5 as qe,a7 as G,ab as Pn,a9 as Rn,b7 as Dn,b8 as Fn,b9 as On,ba as In,bb as J,f as Pe,bc as Bn,U as Wn,a6 as En,bd as Hn,Y as Un,a8 as Vn,be as Kn,bf as ze,bg as Qn,b as Re,bh as Gn,bi as Jn,A as Xn,T as De,bj as me,bk as Yn,bl as Zn,bm as $n,aC as qn,aD as Fe,bn as zn}from"./index-CXHBmSa5.js";import{F as et}from"./FactStrip-BgQ_tYB6.js";import{B as nt,r as tt}from"./ranked-FVqORIQj.js";import{u as st,C as ot,s as Oe,a as at,p as Ie}from"./layout-BRLew_nj.js";import{D as lt}from"./Table-D0NFHHNQ.js";import{T as it}from"./TimeCell-gSIuLEFc.js";import{t as z,r as en,w as Be,a as rt}from"./link-D6L0Eg5i.js";import{c as We,d as ct,e as dt}from"./files-BxEOxSF8.js";import{D as ut}from"./DaeCode-STEiRZuV.js";import{u as pt}from"./outbounds-f8QoVoCV.js";import{u as bt}from"./flows-C0byZ3sY.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";const Q=64,mt=22,q=8,ht=28;function ft({label:e,series:t,fmt:n,onSelect:a,regions:r,height:i=260}){const o=fn(),[l,c]=gn(),{ref:u,tip:j,show:b,hide:m}=st(),M=Math.max(1,...t.flatMap(h=>h.points.flatMap(A=>[A.x,A.y]))),{end:k,ticks:w}=at(M),p=Math.max((c??0)-Q-ht,1),N=i-q-mt,v=h=>Q+Oe(h,k)*p,y=h=>q+(1-Oe(h,k))*N,L=new Map,R=t.flatMap(h=>h.points.map(A=>{const _=v(A.x),C=y(A.y),T=_+","+C,B=L.get(T)??0;return L.set(T,B+1),{point:A,color:h.color,cx:_,cy:C,nth:B,spot:T}})).map(h=>({...h,twins:L.get(h.spot)}));return s.jsx("div",{className:"rp-scatter",ref:l,children:s.jsxs("div",{className:"rp-chart-hover",ref:u,onPointerLeave:m,children:[c!==null&&s.jsxs("svg",{width:c,height:i,role:"img","aria-label":e,"aria-describedby":o,children:[w.map(h=>s.jsxs("g",{children:[s.jsx("line",{className:"grid",x1:v(h),x2:v(h),y1:q,y2:q+N}),s.jsx("line",{className:"grid",x1:Q,x2:Q+p,y1:y(h),y2:y(h)}),s.jsx("text",{className:"tick",x:v(h),y:i-6,textAnchor:"middle",children:n(h)}),s.jsx("text",{className:"tick",x:Q-8,y:y(h)+4,textAnchor:"end",children:n(h)})]},h)),r&&s.jsxs("g",{className:"diagonal",children:[s.jsx("line",{x1:v(0),y1:y(0),x2:v(k),y2:y(k)}),s.jsx("text",{x:Q+8,y:q+14,children:r.above}),s.jsx("text",{x:Q+p-8,y:q+N-8,textAnchor:"end",children:r.below})]}),R.map(({point:h,color:A,cx:_,cy:C,nth:T,twins:B})=>{const O=2*Math.PI*T/B,U=B>1?6:0;return s.jsx("circle",{className:a?"pick":void 0,cx:_+U*Math.cos(O),cy:C+U*Math.sin(O),r:5,fill:A,onClick:a?()=>a(h.id):void 0,onPointerMove:D=>b(D,[h.name,h.detail])},h.id)})]}),s.jsx(ot,{tip:j})]})})}function gt({series:e}){return s.jsx("div",{className:"rp-legend",children:e.map(t=>s.jsx(fe,{swatch:t.color,label:t.label,value:String(t.points.length)},t.id))})}function xt(e){const t=new Map;let n=0;for(const o of e){if(o.upload_bytes===null||o.download_bytes===null){n++;continue}const l={id:o.id,up:Number(o.upload_bytes),down:Number(o.download_bytes),name:o.domain||o.dst||o.id},c=t.get(o.outbound);c?c.push(l):t.set(o.outbound,[l])}const a=[...t].map(([o,l])=>({outbound:o,points:l})).sort((o,l)=>de(o.outbound??"",l.outbound??""));let r,i=-1n;for(const o of e){if(o.upload_bytes===null||o.download_bytes===null)continue;const l=BigInt(o.upload_bytes)+BigInt(o.download_bytes);l>i&&(i=l,r={id:o.id,up:Number(o.upload_bytes),down:Number(o.download_bytes),name:o.domain||o.dst||o.id,outbound:o.outbound})}return{series:a,unknown:n,heaviest:r,placed:e.length-n}}const Ee=[0,2,3,1,4,5,6,7],wt=g.memo(function({records:t,outbounds:n,latency:a,latencyError:r,retryLatency:i,truncated:o,onSelect:l}){const c=Y(),u=Ge(),j=ve[ye()],b=g.useCallback(p=>te(p,j),[j]),m=g.useMemo(()=>xt(t),[t]),M=g.useMemo(()=>{const p=n.filter(v=>v!=="block"),N=v=>v==="block"?u.negative:u.cat[Ee[Math.max(0,p.indexOf(v))%Ee.length]];return m.series.map(v=>({id:v.outbound??"",label:ee(v.outbound,c),color:N(v.outbound),points:v.points.map(y=>({id:y.id,x:y.up,y:y.down,name:y.name,detail:c("conn.chart.point",{down:b(y.down),up:b(y.up)})}))}))},[m,n,u,c,b]),k=m.heaviest?[{label:c("conn.chart.busiest"),icon:s.jsx(xn,{}),tint:"c3",value:m.heaviest.name,caption:ee(m.heaviest.outbound,c)},{label:c("conn.chart.down"),value:b(m.heaviest.down),icon:s.jsx(Je,{}),tint:"c1"},{label:c("conn.chart.up"),value:b(m.heaviest.up),icon:s.jsx(wn,{}),tint:"c4"}]:[],w=m.unknown?c("conn.chart.sampleUnknown",{n:t.length,unknown:m.unknown}):c("conn.chart.sample",{n:t.length});return s.jsxs("div",{className:"rp-chart-page",children:[s.jsx(et,{facts:k,lead:!0}),s.jsxs(ge,{title:c("conn.chart.title"),note:w,children:[o&&s.jsx("p",{className:"rp-note",children:c("conn.truncated")}),m.placed>0&&s.jsxs(s.Fragment,{children:[s.jsx(fLine truncated
|
||||
`)+`
|
||||
`}function Ft(e,t){const n=e.map(r=>r.id),a=t.bulkLimit!=null&&n.length>t.bulkLimit;return t.narrowed||t.truncated||a?{ids:n}:{ids:n,query:{type:t.network,src:t.src,all:!0}}}const Ot=e=>e.target;function It({collection:e,view:t,collapse:n,onToggleGroup:a,loading:r,selected:i,onSelect:o,selectOnFocus:l,onSort:c}){const u=Y(),[j,b]=Mn(442),m=g.useMemo(()=>{const w={dst:p=>s.jsx(le,{children:p.target}),src:p=>s.jsx(le,{className:"rp-code",children:p.source}),node:p=>s.jsx(le,{className:"rp-chain",text:p.path??void 0,children:p.node}),rule:p=>s.jsxs("span",{className:"rp-rule",children:[s.jsx(Ye,{...p.rule}),p.recomputed&&s.jsx(we,{children:p.recomputed})]}),state:p=>p.state,down:p=>p.download,downRate:p=>p.downloadRate,age:p=>s.jsx(it,{at:p.startedAt})};return X.filter(p=>!t.hidden.includes(p.id)).map(p=>({...p,label:u(p.label),grow:1,render:w[p.id]}))},[t.hidden,u]),M=g.useMemo(()=>e.map(w=>"connection"in w?w.connection:w),[e]),k=g.useMemo(()=>({grouped:t.group!=="none",collapsed:w=>nn(n,w),onToggle:a}),[t.group,n,a]);return s.jsx("div",{ref:j,children:s.jsx(lt,{label:u("nav.connections"),rowDetail:!0,cols:m,rows:M,height:b,selected:i&&Ce(i),onSelect:o&&(w=>o(w&&Ct(w))),selectOnFocus:l,reveal:!0,empty:u("conn.empty"),loading:r,sort:t.sort&&{column:String(t.sort.column),direction:t.sort.direction},onSort:c,getTextValue:Ot,stream:!0,tree:k})})}function Bt({dialog:e}){const t=Y();return s.jsxs(Ln,{title:t("rule.add"),narrow:!0,isOpen:!!e,reason:e?.reason,onOpenChange:n=>{n||e?.close()},footer:()=>s.jsxs(s.Fragment,{children:[s.jsx(F,{onPress:()=>e?.close(),children:t("ui.cancel")}),s.jsx(F,{isDisabled:e?.disabled,isPending:e?.busy,onPress:()=>e?.applyNow(),children:t("rule.addApply")}),s.jsx(F,{accent:!0,isDisabled:e?.disabled||e?.busy,onPress:()=>e?.hold(),children:t("rule.hold")})]}),children:[e?.failure&&s.jsx(Te,{takeFocus:!0,children:e.failure.text},e.failure.id),e&&s.jsxs("div",{className:"rp-list",children:[e.failure?.lines.map((n,a)=>s.jsx("span",{className:"rp-label",children:n},a)),s.jsx(je,{error:e.loadError,onRetry:e.retry}),s.jsx("span",{className:"rp-label",children:t("rule.holdHelp")}),e.targets&&s.jsx(Ze,{isDisabled:e.busy,label:t("rule.kind"),value:e.target,onChange:e.setTarget,items:e.targets}),s.jsxs("div",{className:"rp-toolbar top",children:[s.jsx(ce,{isDisabled:e.busy,label:t("ui.outbound"),value:e.outbound,onChange:e.setOutbound,items:e.outbounds}),s.jsx(ce,{isDisabled:e.busy||!e.positions.length,label:t("rule.position"),value:e.before,onChange:e.setBefore,items:e.positions})]}),e.moved&&s.jsx(Te,{tone:"informative",children:t("conn.ruleMoved")}),e.unplaceable&&s.jsx("p",{className:"rp-note",children:t("conn.ruleNoPosition")}),s.jsx(ut,{text:e.preview})]})]})}function Wt(e,t){if(!t.some(b=>b.health?.length))return null;const n=[];let a=0;for(const b of t){const m=Sn(An(b.health??[]));m===void 0?a++:n.push({node:b.id,name:b.name,value:m,connections:0})}n.sort((b,m)=>b.value-m.value||de(b.name,m.name));const r=new Map(n.map(b=>[b.node,b])),i=e.some(b=>b.chain?.length);let o=0;for(const b of e){const m=b.chain?.at(-1);if(m===void 0)continue;const M=r.get(m);M?M.connections++:o++}const l=n.reduce((b,m)=>b+m.connections,0);let c=0;const u=n.find(b=>(c+=b.connections)>=Math.max(1,Math.ceil(l/2))),j=n.map(b=>b.value);return{samples:n,chains:i,missing:a,unplaced:o,used:n.filter(b=>b.connections).length,p50:Ie(j,50),p90:Ie(j,90),weightedP50:l?u.value:null}}function Et(e){const t=r=>r.flatMap(([i,o])=>{const l=Tn(i,o);return l?[{kind:i,condition:l}]:[]}),n=e.domain?t([["domain",e.domain],["domainSuffix",e.domain]]):[],a=ue(e.dst);return n.length?n:a?t([["dip",a]]):[]}function Ht(e,t,n,a){const r=c=>{const u=t.find(j=>j.id===c.source?.source_id);return!!u?.writable&&$e(u,c)!==null},i=e.find(c=>c.rule_id===n&&r(c)),o=e.find(r),l=c=>c===e[0]?a("conn.ruleTop"):a("rule.positionBefore",{n:c.index+1});return[...i?[{rule:i,label:a("conn.ruleBeforeMatched")}]:[],...o&&o!==i?[{rule:o,label:l(o)}]:[]].map(({rule:c,label:u})=>({id:c.rule_id,label:u,desc:c.expression}))}function Ut(e,t,n){if(!t)return{before:e[0]?.id,moved:!1};const a=e.find(r=>r.id===t.rule.rule_id&&(n===t.generation||r.desc===t.rule.expression));return a?{before:a.id,moved:!1}:{before:e[0]?.id,moved:!0}}function Vt({disabled:e,busy:t,failed:n,unplaceable:a},r){return e&&!t&&!n&&!a?r("ui.loading"):null}function Kt(e){const t=Y(),n=qe().data?.resources,a=G(n,"rules",{whileLoading:!1})&&G(n,"config",{whileLoading:!1})&&n?.config.writable===!0,[r,i]=g.useState(null),[o,l]=g.useState(null),c=!!r,u=bt(c),j=Pn(c),b=G(n,"groups",{whileLoading:!1}),m=Rn(c&&b),M=()=>{u.refetch(),j.refetch(),b&&m.refetch()},k=Dn(),w=j.data?.sources??[],p=Ht(u.data?.rules??[],w,r?.matched??null,t),N=Fn(m.data??[]),v=!b||!!m.data,y=r?.outbound||N.find(x=>x.id===r?.current)?.id||(v?N[0].id:""),L=u.data?.generation_id,Z=x=>{const S=u.data?.rules.find(K=>K.rule_id===x);return S&&L?{generation:L,rule:S}:null},{before:R,moved:h}=Ut(p,r?.pin??null,L),A=r&&!r.pin?Z(R):null;A&&i(
Line truncated
|
||||
@@ -0,0 +1,3 @@
|
||||
import{r as o}from"./vendor-react-Bf71BWbF.js";const h=/^(global|dns|upstream|routing|request|response|subscription|node|group|include|fallback)\b(?!\s*\()/,p=()=>({afterArrow:!1});function l(t,s){return t.sol()&&(s.afterArrow=!1),t.eatSpace()?null:t.match("#")?(t.skipToEnd(),"comment"):t.match(/^'[^']*'/)||t.match(/^"[^"]*"/)?"string":t.match("->")?(s.afterArrow=!0,"operator"):s.afterArrow&&t.match(/^[\w.-]+/)?(s.afterArrow=!1,"keyword"):(t.sol()||t.string.slice(0,t.pos).trim()==="")&&t.match(h)?"keyword":t.match(/^\d+(\.\d+)*(\/\d+)?[a-z]*/)?"number":t.match(/^[\w.-]+(?=\s*\()/)?"propertyName":t.match(/^[\w.-]+(?=\s*:)/)?"variableName":t.match(/^[A-Za-z_][\w.-]*/)?null:t.match(/^[{}()&|!,:]/)?"punctuation":(t.next(),null)}class f{pos=0;string;constructor(s){this.string=s}sol(){return this.pos===0}eatSpace(){const s=/^\s+/.exec(this.string.slice(this.pos));return s?(this.pos+=s[0].length,!0):!1}match(s){const e=typeof s=="string"?this.string.slice(this.pos).startsWith(s)&&s:s.exec(this.string.slice(this.pos));return e&&(this.pos+=typeof e=="string"?e.length:e[0].length),e}skipToEnd(){this.pos=this.string.length}next(){return this.pos<this.string.length?this.string[this.pos++]:void 0}}function g(t){const s=[],e=t.split(`
|
||||
`),r=p();return e.forEach((n,c)=>{const i=new f(n);for(;i.pos<n.length;){const u=i.pos,a=l(i,r);s.push({text:n.slice(u,i.pos),type:a})}c<e.length-1&&s.push({text:`
|
||||
`,type:null})}),s}function m({text:t,as:s="span",className:e=""}){return o.createElement(s,{className:`rp-code ${e}`.trim()},g(t).map((r,n)=>r.type?o.createElement("span",{key:n,className:`rp-dae-${r.type}`},r.text):r.text))}export{m as D,l as d,p as s};
|
||||
@@ -1,3 +0,0 @@
|
||||
import{r as o}from"./vendor-react-Bf71BWbF.js";const h=/^(global|dns|upstream|routing|request|response|subscription|node|group|include|fallback)\b/,p=()=>({afterArrow:!1});function l(t,e){return t.sol()&&(e.afterArrow=!1),t.eatSpace()?null:t.match("#")?(t.skipToEnd(),"comment"):t.match(/^'[^']*'/)||t.match(/^"[^"]*"/)?"string":t.match("->")?(e.afterArrow=!0,"operator"):e.afterArrow&&t.match(/^[\w.-]+/)?(e.afterArrow=!1,"keyword"):(t.sol()||t.string.slice(0,t.pos).trim()==="")&&t.match(h)?"keyword":t.match(/^\d+(\.\d+)*(\/\d+)?[a-z]*/)?"number":t.match(/^[\w.-]+(?=\s*\()/)?"propertyName":t.match(/^[\w.-]+(?=\s*:)/)?"variableName":t.match(/^[A-Za-z_][\w.-]*/)?null:t.match(/^[{}()&|!,:]/)?"punctuation":(t.next(),null)}class f{pos=0;string;constructor(e){this.string=e}sol(){return this.pos===0}eatSpace(){const e=/^\s+/.exec(this.string.slice(this.pos));return e?(this.pos+=e[0].length,!0):!1}match(e){const s=typeof e=="string"?this.string.slice(this.pos).startsWith(e)&&e:e.exec(this.string.slice(this.pos));return s&&(this.pos+=typeof s=="string"?s.length:s[0].length),s}skipToEnd(){this.pos=this.string.length}next(){return this.pos<this.string.length?this.string[this.pos++]:void 0}}function g(t){const e=[],s=t.split(`
|
||||
`),r=p();return s.forEach((n,c)=>{const i=new f(n);for(;i.pos<n.length;){const u=i.pos,a=l(i,r);e.push({text:n.slice(u,i.pos),type:a})}c<s.length-1&&e.push({text:`
|
||||
`,type:null})}),e}function m({text:t,as:e="span",className:s=""}){return o.createElement(e,{className:`rp-code ${s}`.trim()},g(t).map((r,n)=>r.type?o.createElement("span",{key:n,className:`rp-dae-${r.type}`},r.text):r.text))}export{m as D,l as d,p as s};
|
||||
@@ -0,0 +1,3 @@
|
||||
import{r as p,j as a}from"./vendor-react-Bf71BWbF.js";import{u as g,aP as Te,c as _e,a3 as Se,aW as j,at as Le,a4 as ie,an as De,A as Re,ax as qe,bs as ce,a8 as I,bf as E,bt as oe,$ as ee,bj as Ae,bi as Fe,a5 as Q,a as z,bu as se,X as Ee,f as Me,bm as Oe,aa as U,bv as ke,be as P,b as ae,bw as Pe,aS as We,ai as T,j as de,E as F,aE as K,bx as He,by as Ue,bz as Be,bA as Ve,aJ as A,aR as te,aL as ue,b4 as $e,bB as B,T as V,b5 as pe,B as M,bC as Ie,aK as he,aG as G,br as Qe,aH as q,aF as ne,bq as ze,aI as Ke,bD as Ge,bp as Je,L as Xe,bo as Ye}from"./index-BNBwb-FJ.js";import{D as me}from"./Table-DyWJelc_.js";import{T as $}from"./TimeCell-DUt0i0gi.js";import{A as Ze}from"./ActionGroup-BKxDwmnT.js";import{q as es,u as fe,a as ss,s as as,b as ts}from"./dns-CvJ19DpX.js";import{c as re,d as ns,e as rs}from"./files-BxEOxSF8.js";import{d as ls}from"./nav-DuA2h3KP.js";import{b as is}from"./link-CIkWI7An.js";import{F as cs}from"./FactStrip-n2q1T87k.js";import{r as le,B as os}from"./ranked-B09X8uKl.js";import{u as ds,w as us,C as ps,p as W}from"./layout-wfdMYi2n.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";function hs({label:r,shares:t}){const e=g(),s=Te(),{ref:l,tip:n,show:i,hide:c}=ds(),o=p.useMemo(()=>{const d=us(t.map(h=>h.count));return t.flatMap((h,f)=>Array.from({length:d[f]},()=>h))},[t]);return a.jsxs("div",{className:"rp-waffle rp-chart-hover",ref:l,onPointerLeave:c,children:[a.jsx("div",{className:"grid",role:"img","aria-describedby":s,"aria-label":e("ui.valuePair",{label:r,value:t.map(d=>`${d.label} ${d.text}`).join(e("ui.separator"))}),children:o.map((d,h)=>a.jsx("span",{style:{background:d.color},onPointerMove:f=>i(f,[d.label,d.text])},h))}),a.jsx("ul",{className:"legend",children:t.map(d=>a.jsxs("li",{children:[a.jsx("i",{className:"sw",style:{background:d.color}}),a.jsx("span",{children:d.label}),a.jsx("b",{children:d.text})]},d.id))}),a.jsx(ps,{tip:n})]})}function ms({className:r,...t}){return a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:_e("rp-icon",r),...t,children:[a.jsx("path",{fill:"currentColor",d:"M8.249 15.021c-.4 0-.733-.317-.748-.72l-.25-6.5c-.017-.414.307-.763.72-.779H8c.4 0 .733.317.748.72l.25 6.5c.017.414-.307.763-.72.778zM11.751 15.021h-.03c-.413-.016-.737-.365-.72-.779l.25-6.5c.015-.403.348-.72.748-.72h.03c.413.016.737.365.72.779l-.25 6.5c-.015.403-.348.72-.748.72"}),a.jsx("path",{fill:"currentColor",d:"M17 4h-3.5v-.75C13.5 2.01 12.49 1 11.25 1h-2.5C7.51 1 6.5 2.01 6.5 3.25V4H3c-.414 0-.75.336-.75.75s.336.75.75.75h.52l.422 10.342C3.99 17.052 4.98 18 6.19 18h7.62c1.211 0 2.2-.948 2.248-2.158L16.48 5.5H17c.414 0 .75-.336.75-.75S17.414 4 17 4m-9-.75c0-.413.337-.75.75-.75h2.5c.413 0 .75.337.75.75V4H8zm6.56 12.531c-.017.404-.346.719-.75.719H6.19c-.404 0-.733-.315-.75-.719L5.02 5.5h9.96z"})]})}const fs={forced:"dns.route.forced","dns.routing":"dns.route.rules",default:"dns.route.default"};function xe(r,t){return{fields:[[t("ui.state"),r.status],[t("ui.upstream"),r.upstream??"—"],[t("dns.routeSource"),Se(fs,r.route.source,t)],[t("dns.routeRule"),r.route.rule??"—"],[t("ui.elapsed"),j(r.elapsed_ms,t)]],answers:(r.answers??[]).map(e=>t("dns.answer",{name:e.name,type:e.type,ttl:e.ttl,data:e.data})),cacheText:t(r.cached?"dns.hit":"dns.miss"),cacheTone:r.cached?void 0:"warn"}}function xs(r,t,e,s,l,n){const i=t?.dns_query.record_types??[],c=e==="all"?i.length>0:i.includes(e);return{types:i,choices:[...i.map(o=>({id:o,label:o})),{id:"all",label:n("dns.allTypes")}],disabled:l||!t?.dns_query.available||!c||!s.trim(),reason:!t||l?null:t.dns_query.available?c?null:n(e==="all"?"dns.noTypes":"dns.typeUnsupported"):n("dns.queryUnavailable"),showCache:!!t?.dns_cache.available,cards:r?.results.map(o=>({id:o.type,title:`${r.domain} ${o.type}`,...xe(o,n)}))??[],tabs:ls(t).map(o=>({id:o.id,label:n(o.titleKey)}))}}function gs(r,t,e,s,l,n){const i=e.toLowerCase(),c=t?.dns_cache,o=(r?.entries??[]).filter(d=>!i||d.domain.toLowerCase().includes(i));return{fields:[[n("dns.entries"),r?ie(r.total,l):"—"]],coverage:r?["positive","negative","persistent"].filter(d=>!r.coverage[d]).map(d=>({id:d,text:n("ui.valuePair",{label:n({positive:"dns.positive",negative:"dns.negative",persistent:"dns.persistent"}[d]),value:n(d==="persistent"?"dns.chart.memoryOnly":"dns.notCovered")})})):[],filterText:i?n("dns.cacheFilter",{domain:e}):"",confirmationText:r?n("dns.flushConfirm",{n:r.total}):n("dns.flushConfirmAll"),flushDisabled:!!s||!t?.dns_cache.available||!t.dns_cache.flush,flushReason:c&&!s&&(!c.available||!c.flush)?n("dns.flushUnsupported"):null,deleteReason:c&&!s&&o.length>0&&(!c.available||!c.delete_entry)?n("dns.deleteUnsupported"):null,empty:n(t?.dns_cache.available&&t.dns_cache.read?"dns.empty":"dns.cacheUnavailable"),rows:o.map(d=>({id:d.entry_id,domain:d.domain,type:d.type,status:d.status,expiresAt:d.expires_at,staleUntil:d.stale_until,deleteLabel:n("dns.deleteLine truncated
|
||||
`)+`
|
||||
`}function ys(r,t){const e=new Set(r.records.map(s=>s.id));return{...r,records:[...r.records,...t.records.filter(s=>!e.has(s.id))],next_cursor:t.next_cursor}}function ws(r,t){const e=t&&new Set(t.records.map(s=>s.id));return{data:t??r,newerWaiting:!!e&&!!r?.records.some(s=>!e.has(s.id))}}function Ns(r,t,e){if(!r)return null;const{usage:s,coverage:l}=r,n=c=>{const o=qe(c);return o===null?"—":ie(o,t)},i=s?De(s.entries,s.entry_capacity):null;return{note:s?void 0:e("dns.chart.cacheNote",{n:r.total}),usage:s&&i!==null?{pct:i,value:i>0&&i<.5?"<"+e("ui.percent",{n:1}):e("ui.percent",{n:Math.round(i)}),facts:e("dns.chart.usageFacts",{entries:e("ui.fraction",{part:n(s.entries),whole:n(s.entry_capacity)})})}:null,coverage:e("dns.chart.coverage",{kinds:[l.positive&&e("dns.chart.positive"),l.negative&&e("dns.chart.negative")].filter(Boolean).join(e("ui.listSeparator")),persistent:e(l.persistent?"dns.chart.persistent":"dns.chart.memoryOnly")})}}function Cs(r,t,e){return r?e instanceof Re&&e.status===503?"unavailable":t?"ready":e?"error":"loading":"unlisted"}function Ts({go:r,query:t}){const e=g(),s=ce(),l=I(),n=p.useMemo(()=>new URLSearchParams(t),[t]),[i,c]=p.useState(n.get("domain")??""),[o,d]=p.useState(n.get("type")??"A");E(n.get("domain"),m=>c(m??"")),E(n.get("type"),m=>d(m??"A"));const[h,f]=p.useState(null),{busy:y,error:u,run:v}=oe({rethrow:!0}),x=l.data?.resources,_=p.useMemo(()=>xs(h,x,o,i,!!y,e),[h,x,o,i,y,e]),w=_.tabs.map(m=>m.id),L=w.includes("log")?n.has("domain")?"log":"stats":w.includes("query")?"query":w[0]??"query",N=async()=>{try{await v("query",async m=>{const C=await es(s.dnsQuery,i.trim(),o==="all"?_.types:[o],x?.dns_query.limits?.max_types_per_request??1,m);return m.aborted||f(C),C})}catch{}};return{..._,domain:i,setDomain:c,type:o,setType:d,pending:y==="query",queryError:u,submit:()=>void N(),setTab:m=>r("dns",Fe(t,m,x&&!n.has("domain")?L:null)),tab:Ae(t,_.tabs.map(m=>m.id),L),filterDomain:n.get("domain")??"",logEnabled:x?.dns_log.available,viewCache:()=>r("dns",ee(t,{tab:"cache",domain:h?.domain??""})),clearCacheFilter:()=>r("dns",ee(t,{tab:"cache",domain:null}))}}function _s(r){const t=g(),e=Q[z()],s=ss(!ke()),l=p.useMemo(()=>gs(s.cache.data,s.capabilities.data?.resources,r,s.busy,e,t),[s.cache.data,s.capabilities.data,r,s.busy,e,t]),{remove:n}=s,i=p.useCallback(o=>void n(o).then(d=>d&&P("positive",t("dns.deleted",{n:d.deleted})),d=>P("negative",t("dns.deleteFailed"),{detail:ae(d,t)})),[n,t]),c=async()=>{try{const o=await s.flush();o&&P("positive",t("dns.flushed",{matched:o.matched,deleted:o.deleted}))}catch(o){return t("dns.flushFailed",{error:ae(o,t)})}};return{...l,error:s.cache.error,retry:s.cache.refetch,loading:(s.cache.loading||s.capabilities.loading)&&!s.cache.data,flushPending:s.busy==="flush",remove:i,flush:c,abortFlush:()=>{s.cancel(),s.cache.refetch()}}}function Ss(r){const t=fe({},r===!0),e=I().data?.resources;return{log:t,cacheListed:U(e,"dns_cache",{whileLoading:!1})&&e?.dns_cache.read===!0}}function Ls(r){const t=g(),e=Q[z()],[s,l]=Pe(),[n,i]=p.useState(!1),c=ts(r,!l&&n);c.data&&!n&&i(!0);const o=p.useMemo(()=>Ns(c.data,e,t),[c.data,e,t]);return{ref:s,card:o,state:Cs(r,!!o,c.error),error:c.error,retry:c.refetch}}function Ds(r,t){const e=g(),s=Q[z()],[l,n]=p.useState(t);E(t,n);const[i,c]=p.useState("all"),[o,d]=p.useState(""),h=ce(),f=I(),y=se(o),u=Ee(y),v=y.trim()!==""&&!u,[x,_]=p.useState(u);!v&&u!==x&&_(u);const w={name:se(l),type:i,src:v?x:u},L=JSON.stringify(w),N=fe(w,r===!0),[m,C]=p.useState(null),[ge,J]=p.useState(!1),D=oe({scope:L});E(L,()=>C(null));const{data:b,newerWaiting:be}=p.useMemo(()=>ws(N.data,m),[N.data,m]),X=()=>void D.run("older",async S=>{if(!b?.next_cursor)return;C(b);const{page:Ne}=await as(Ce=>h.dnsLog(Ce,S),{name:w.name.trim()||void 0,type:i==="all"?void 0:i,src:w.src,cursor:b.next_cursor,limit:N.limit},S);S.aborted||C(ys(b,Ne))}),Y=()=>{D.cancel(),C(null);const S=N.refetch();S&&(J(!0),S.finally(()=>J(!1)))},[O,ve]=p.useState(null),je=Me(Oe),Z=f.data?.resources.dns_query.record_types,ye=p.useMemo(()=>vs(b,r,e,Z),[b,r,e,Z]),R=p.useMemo(()=>bs(b,O,s,e),[b,O,s,e]),k=f.data?.resources,we=U(k,"dns_rules",{whileLoading:!1})&&U(k,"config",{whileLoading:!1})&&k?.config.writable===!0;return{...ye,detail:R,detailTitle:R?.title??"",ruleHref:R&&we?is({kind:"qnameSuffix",value:R.title.replace(/\.$/,"")},"dns"):null,name:l,newerWaiting:be,setName:n,type:i,setType:c,src:o,setSrc:d,srcError:v?e("ui.invalidIp"):void 0,selected:R?O:null,setSelected:ve,wide:je,error:D.error??N.error,loading:N.loading&&!b,hasOlder:!!b?.next_cursor,loadingOlder:!!D.busy,loadOlder:X,refreshing:ge,refresh:Y,retry:D.error?X:Y,export:()=>ns(rs("dns-log","csv"),js(b?.records??[]),"text/csv;charset=utf-8")}}const Rs=["cached","answered","nxdomain","failed"],qs=r=>r.cached?"cached":r.status==="NOERROR"?"answered":r.status==="NXDOMAIN"?"nxdomain":"failed";function As(r){const t={cached:0,answered:0,nxdomain:0,failed:0},e=[];for(const c of r){const o=qs(c);t[o]++,!c.cached&&c.upstream!==null&&e.push
Line truncated
|
||||
@@ -1,3 +0,0 @@
|
||||
import{r as p,j as a}from"./vendor-react-Bf71BWbF.js";import{u as g,aM as we,c as Ne,a0 as Ce,aT as j,aq as Te,a1 as re,ak as _e,A as Se,au as De,bo as le,a5 as V,bc as F,bp as ie,X as Y,bf as Re,be as Le,a2 as $,a as I,bq as Z,U as qe,f as Ae,bi as Fe,br as Ee,bb as k,b as ee,a7 as Me,bs as Oe,aP as ke,af as C,j as oe,E as L,aB as Q,bt as Pe,bu as We,bv as Ue,bw as He,aG as R,aO as se,aI as ce,b1 as Be,bx as U,T as H,b2 as de,B as E,by as Ve,aH as ue,aD as z,bn as $e,aE as D,aC as ae,bm as Ie,aF as Qe,bz as ze,bl as Ke,bk as Ge}from"./index-CXHBmSa5.js";import{D as pe}from"./Table-D0NFHHNQ.js";import{T as B}from"./TimeCell-gSIuLEFc.js";import{A as Xe}from"./ActionGroup-90AzAQje.js";import{q as Je,u as he,a as Ye,s as Ze,b as es}from"./dns-DQrpG8y_.js";import{c as te,d as ss,e as as}from"./files-BxEOxSF8.js";import{d as ts}from"./nav-C2A1sZKm.js";import{F as ns}from"./FactStrip-BgQ_tYB6.js";import{r as ne,B as rs}from"./ranked-FVqORIQj.js";import{u as ls,w as is,C as os,p as P}from"./layout-BRLew_nj.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";function cs({label:r,shares:t}){const e=g(),s=we(),{ref:l,tip:n,show:i,hide:o}=ls(),c=p.useMemo(()=>{const d=is(t.map(m=>m.count));return t.flatMap((m,f)=>Array.from({length:d[f]},()=>m))},[t]);return a.jsxs("div",{className:"rp-waffle rp-chart-hover",ref:l,onPointerLeave:o,children:[a.jsx("div",{className:"grid",role:"img","aria-describedby":s,"aria-label":e("ui.valuePair",{label:r,value:t.map(d=>`${d.label} ${d.text}`).join(e("ui.separator"))}),children:c.map((d,m)=>a.jsx("span",{style:{background:d.color},onPointerMove:f=>i(f,[d.label,d.text])},m))}),a.jsx("ul",{className:"legend",children:t.map(d=>a.jsxs("li",{children:[a.jsx("i",{className:"sw",style:{background:d.color}}),a.jsx("span",{children:d.label}),a.jsx("b",{children:d.text})]},d.id))}),a.jsx(os,{tip:n})]})}function ds({className:r,...t}){return a.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:Ne("rp-icon",r),...t,children:[a.jsx("path",{fill:"currentColor",d:"M8.249 15.021c-.4 0-.733-.317-.748-.72l-.25-6.5c-.017-.414.307-.763.72-.779H8c.4 0 .733.317.748.72l.25 6.5c.017.414-.307.763-.72.778zM11.751 15.021h-.03c-.413-.016-.737-.365-.72-.779l.25-6.5c.015-.403.348-.72.748-.72h.03c.413.016.737.365.72.779l-.25 6.5c-.015.403-.348.72-.748.72"}),a.jsx("path",{fill:"currentColor",d:"M17 4h-3.5v-.75C13.5 2.01 12.49 1 11.25 1h-2.5C7.51 1 6.5 2.01 6.5 3.25V4H3c-.414 0-.75.336-.75.75s.336.75.75.75h.52l.422 10.342C3.99 17.052 4.98 18 6.19 18h7.62c1.211 0 2.2-.948 2.248-2.158L16.48 5.5H17c.414 0 .75-.336.75-.75S17.414 4 17 4m-9-.75c0-.413.337-.75.75-.75h2.5c.413 0 .75.337.75.75V4H8zm6.56 12.531c-.017.404-.346.719-.75.719H6.19c-.404 0-.733-.315-.75-.719L5.02 5.5h9.96z"})]})}const us={forced:"dns.route.forced","dns.routing":"dns.route.rules",default:"dns.route.default"};function me(r,t){return{fields:[[t("ui.state"),r.status],[t("ui.upstream"),r.upstream??"—"],[t("dns.routeSource"),Ce(us,r.route.source,t)],[t("dns.routeRule"),r.route.rule??"—"],[t("ui.elapsed"),j(r.elapsed_ms,t)]],answers:(r.answers??[]).map(e=>t("dns.answer",{name:e.name,type:e.type,ttl:e.ttl,data:e.data})),cacheText:t(r.cached?"dns.hit":"dns.miss"),cacheTone:r.cached?void 0:"warn"}}function ps(r,t,e,s,l,n){const i=t?.dns_query.record_types??[],o=e==="all"?i.length>0:i.includes(e);return{types:i,choices:[...i.map(c=>({id:c,label:c})),{id:"all",label:n("dns.allTypes")}],disabled:l||!t?.dns_query.available||!o||!s.trim(),reason:!t||l?null:t.dns_query.available?o?null:n(e==="all"?"dns.noTypes":"dns.typeUnsupported"):n("dns.queryUnavailable"),showCache:!!t?.dns_cache.available,cards:r?.results.map(c=>({id:c.type,title:`${r.domain} ${c.type}`,...me(c,n)}))??[],tabs:ts(t).map(c=>({id:c.id,label:n(c.titleKey)}))}}function hs(r,t,e,s,l,n){const i=e.toLowerCase(),o=t?.dns_cache,c=(r?.entries??[]).filter(d=>!i||d.domain.toLowerCase().includes(i));return{fields:[[n("dns.entries"),r?re(r.total,l):"—"]],coverage:r?["positive","negative","persistent"].filter(d=>!r.coverage[d]).map(d=>({id:d,text:n("ui.valuePair",{label:n({positive:"dns.positive",negative:"dns.negative",persistent:"dns.persistent"}[d]),value:n(d==="persistent"?"dns.chart.memoryOnly":"dns.notCovered")})})):[],filterText:i?n("dns.cacheFilter",{domain:e}):"",confirmationText:r?n("dns.flushConfirm",{n:r.total}):n("dns.flushConfirmAll"),flushDisabled:!!s||!t?.dns_cache.available||!t.dns_cache.flush,flushReason:o&&!s&&(!o.available||!o.flush)?n("dns.flushUnsupported"):null,deleteReason:o&&!s&&c.length>0&&(!o.available||!o.delete_entry)?n("dns.deleteUnsupported"):null,empty:n(t?.dns_cache.available&&t.dns_cache.read?"dns.empty":"dns.cacheUnavailable"),rows:c.map(d=>({id:d.entry_id,domain:d.domain,type:d.type,status:d.status,expiresAt:d.expires_at,staleUntil:d.stale_until,deleteLabel:n("dns.deleteEntry",{domain:d.domain,type:d.type}),pending:s==Line truncated
|
||||
`)+`
|
||||
`}function gs(r,t){const e=new Set(r.records.map(s=>s.id));return{...r,records:[...r.records,...t.records.filter(s=>!e.has(s.id))],next_cursor:t.next_cursor}}function bs(r,t){const e=t&&new Set(t.records.map(s=>s.id));return{data:t??r,newerWaiting:!!e&&!!r?.records.some(s=>!e.has(s.id))}}function vs(r,t,e){if(!r)return null;const{usage:s,coverage:l}=r,n=o=>{const c=De(o);return c===null?"—":re(c,t)},i=s?_e(s.entries,s.entry_capacity):null;return{note:s?void 0:e("dns.chart.cacheNote",{n:r.total}),usage:s&&i!==null?{pct:i,value:i>0&&i<.5?"<"+e("ui.percent",{n:1}):e("ui.percent",{n:Math.round(i)}),facts:e("dns.chart.usageFacts",{entries:e("ui.fraction",{part:n(s.entries),whole:n(s.entry_capacity)})})}:null,coverage:e("dns.chart.coverage",{kinds:[l.positive&&e("dns.chart.positive"),l.negative&&e("dns.chart.negative")].filter(Boolean).join(e("ui.listSeparator")),persistent:e(l.persistent?"dns.chart.persistent":"dns.chart.memoryOnly")})}}function js(r,t,e){return r?e instanceof Se&&e.status===503?"unavailable":t?"ready":e?"error":"loading":"unlisted"}function ys({go:r,query:t}){const e=g(),s=le(),l=V(),n=p.useMemo(()=>new URLSearchParams(t),[t]),[i,o]=p.useState(n.get("domain")??""),[c,d]=p.useState(n.get("type")??"A");F(n.get("domain"),h=>o(h??"")),F(n.get("type"),h=>d(h??"A"));const[m,f]=p.useState(null),{busy:y,error:u,run:v}=ie({rethrow:!0}),x=l.data?.resources,w=p.useMemo(()=>ps(m,x,c,i,!!y,e),[m,x,c,i,y,e]),N=n.has("domain")&&w.tabs.some(h=>h.id==="log")?"log":w.tabs[0]?.id??"query",q=async()=>{try{await v("query",async h=>{const _=await Je(s.dnsQuery,i.trim(),c==="all"?w.types:[c],x?.dns_query.limits?.max_types_per_request??1,h);return h.aborted||f(_),_})}catch{}};return{...w,domain:i,setDomain:o,type:c,setType:d,pending:y==="query",queryError:u,submit:()=>void q(),setTab:h=>r("dns",Le(t,h,x&&!n.has("domain")?N:null)),tab:Re(t,w.tabs.map(h=>h.id),N),filterDomain:n.get("domain")??"",logEnabled:x?.dns_log.available,viewCache:()=>r("dns",Y(t,{tab:"cache",domain:m?.domain??""})),clearCacheFilter:()=>r("dns",Y(t,{tab:"cache",domain:null}))}}function ws(r){const t=g(),e=$[I()],s=Ye(!Ee()),l=p.useMemo(()=>hs(s.cache.data,s.capabilities.data?.resources,r,s.busy,e,t),[s.cache.data,s.capabilities.data,r,s.busy,e,t]),{remove:n}=s,i=p.useCallback(c=>void n(c).then(d=>d&&k("positive",t("dns.deleted",{n:d.deleted})),d=>k("negative",t("dns.deleteFailed"),{detail:ee(d,t)})),[n,t]),o=async()=>{try{const c=await s.flush();c&&k("positive",t("dns.flushed",{matched:c.matched,deleted:c.deleted}))}catch(c){return t("dns.flushFailed",{error:ee(c,t)})}};return{...l,error:s.cache.error,retry:s.cache.refetch,loading:(s.cache.loading||s.capabilities.loading)&&!s.cache.data,flushPending:s.busy==="flush",remove:i,flush:o,abortFlush:()=>{s.cancel(),s.cache.refetch()}}}function Ns(r){const t=he({},r===!0),e=V().data?.resources;return{log:t,cacheListed:Me(e,"dns_cache",{whileLoading:!1})&&e?.dns_cache.read===!0}}function Cs(r){const t=g(),e=$[I()],[s,l]=Oe(),[n,i]=p.useState(!1),o=es(r,!l&&n);o.data&&!n&&i(!0);const c=p.useMemo(()=>vs(o.data,e,t),[o.data,e,t]);return{ref:s,card:c,state:js(r,!!c,o.error),error:o.error,retry:o.refetch}}function Ts(r,t){const e=g(),s=$[I()],[l,n]=p.useState(t);F(t,n);const[i,o]=p.useState("all"),[c,d]=p.useState(""),m=le(),f=V(),y=Z(c),u=qe(y),v=y.trim()!==""&&!u,[x,w]=p.useState(u);!v&&u!==x&&w(u);const N={name:Z(l),type:i,src:v?x:u},q=JSON.stringify(N),h=he(N,r===!0),[_,A]=p.useState(null),[fe,K]=p.useState(!1),S=ie({scope:q});F(q,()=>A(null));const{data:b,newerWaiting:xe}=p.useMemo(()=>bs(h.data,_),[h.data,_]),G=()=>void S.run("older",async T=>{if(!b?.next_cursor)return;A(b);const{page:je}=await Ze(ye=>m.dnsLog(ye,T),{name:N.name.trim()||void 0,type:i==="all"?void 0:i,src:N.src,cursor:b.next_cursor,limit:h.limit},T);T.aborted||A(gs(b,je))}),X=()=>{S.cancel(),A(null);const T=h.refetch();T&&(K(!0),T.finally(()=>K(!1)))},[M,ge]=p.useState(null),be=Ae(Fe),J=f.data?.resources.dns_query.record_types,ve=p.useMemo(()=>fs(b,r,e,J),[b,r,e,J]),O=p.useMemo(()=>ms(b,M,s,e),[b,M,s,e]);return{...ve,detail:O,detailTitle:O?.title??"",name:l,newerWaiting:xe,setName:n,type:i,setType:o,src:c,setSrc:d,srcError:v?e("ui.invalidIp"):void 0,selected:O?M:null,setSelected:ge,wide:be,error:S.error??h.error,loading:h.loading&&!b,hasOlder:!!b?.next_cursor,loadingOlder:!!S.busy,loadOlder:G,refreshing:fe,refresh:X,retry:S.error?G:X,export:()=>ss(as("dns-log","csv"),xs(b?.records??[]),"text/csv;charset=utf-8")}}const _s=["cached","answered","nxdomain","failed"],Ss=r=>r.cached?"cached":r.status==="NOERROR"?"answered":r.status==="NXDOMAIN"?"nxdomain":"failed";function Ds(r){const t={cached:0,answered:0,nxdomain:0,failed:0},e=[];for(const o of r){const c=Ss(o);t[c]++,!o.cached&&o.upstream!==null&&e.push({id:o.id,value:o.elapsed_ms,outcome:c,name:o.question.name,upstream:o.upstream})}const s=e.map(o=>o.value).sort((o,c)=>o-c),l=new Map;for(const o of e)l.set(o.upstream,[...l.get(o.upstream)??[],o]);const n=[...l].map(([o,c])=>({upstream:o
Line truncated
|
||||
@@ -1 +1 @@
|
||||
import{r as an,j as K}from"./vendor-react-Bf71BWbF.js";import{u as cn,eH as fn}from"./index-CXHBmSa5.js";import{u as gn,i as hn,e as pn,C as yn}from"./layout-BRLew_nj.js";import{w as dn,c as T,a as mn}from"./array-C0P64tl-.js";const on=Math.abs,w=Math.atan2,k=Math.cos,xn=Math.max,rn=Math.min,b=Math.sin,F=Math.sqrt,S=1e-12,V=Math.PI,X=V/2,W=2*V;function vn(t){return t>1?0:t<-1?V:Math.acos(t)}function ln(t){return t>=1?X:t<=-1?-X:Math.asin(t)}function An(t){return t.innerRadius}function Mn(t){return t.outerRadius}function Rn(t){return t.startAngle}function wn(t){return t.endAngle}function Pn(t){return t&&t.padAngle}function Tn(t,h,v,P,x,A,p,n){var f=v-t,u=P-h,e=p-x,y=n-A,r=y*f-e*u;if(!(r*r<S))return r=(e*(h-A)-y*(t-x))/r,[t+r*f,h+r*u]}function U(t,h,v,P,x,A,p){var n=t-v,f=h-P,u=(p?A:-A)/F(n*n+f*f),e=u*f,y=-u*n,r=t+e,a=h+y,g=v+e,d=P+y,j=(r+g)/2,c=(a+d)/2,m=g-r,o=d-a,l=m*m+o*o,M=x-A,R=r*d-g*a,D=(o<0?-1:1)*F(xn(0,M*M*l-R*R)),I=(R*o-m*D)/l,B=(-R*m-o*D)/l,L=(R*o+m*D)/l,$=(-R*m+o*D)/l,E=I-j,s=B-c,i=L-j,N=$-c;return E*E+s*s>i*i+N*N&&(I=L,B=$),{cx:I,cy:B,x01:-e,y01:-y,x11:I*(x/M-1),y11:B*(x/M-1)}}function jn(){var t=An,h=Mn,v=T(0),P=null,x=Rn,A=wn,p=Pn,n=null,f=dn(u);function u(){var e,y,r=+t.apply(this,arguments),a=+h.apply(this,arguments),g=x.apply(this,arguments)-X,d=A.apply(this,arguments)-X,j=on(d-g),c=d>g;if(n||(n=e=f()),a<r&&(y=a,a=r,r=y),!(a>S))n.moveTo(0,0);else if(j>W-S)n.moveTo(a*k(g),a*b(g)),n.arc(0,0,a,g,d,!c),r>S&&(n.moveTo(r*k(d),r*b(d)),n.arc(0,0,r,d,g,c));else{var m=g,o=d,l=g,M=d,R=j,D=j,I=p.apply(this,arguments)/2,B=I>S&&(P?+P.apply(this,arguments):F(r*r+a*a)),L=rn(on(a-r)/2,+v.apply(this,arguments)),$=L,E=L,s,i;if(B>S){var N=ln(B/r*b(I)),H=ln(B/a*b(I));(R-=N*2)>S?(N*=c?1:-1,l+=N,M-=N):(R=0,l=M=(g+d)/2),(D-=H*2)>S?(H*=c?1:-1,m+=H,o-=H):(D=0,m=o=(g+d)/2)}var q=a*k(m),z=a*b(m),O=r*k(M),G=r*b(M);if(L>S){var J=a*k(o),Q=a*b(o),Y=r*k(l),Z=r*b(l),C;if(j<V)if(C=Tn(q,z,Y,Z,J,Q,O,G)){var _=q-C[0],nn=z-C[1],en=J-C[0],tn=Q-C[1],sn=1/b(vn((_*en+nn*tn)/(F(_*_+nn*nn)*F(en*en+tn*tn)))/2),un=F(C[0]*C[0]+C[1]*C[1]);$=rn(L,(r-un)/(sn-1)),E=rn(L,(a-un)/(sn+1))}else $=E=0}D>S?E>S?(s=U(Y,Z,q,z,a,E,c),i=U(J,Q,O,G,a,E,c),n.moveTo(s.cx+s.x01,s.cy+s.y01),E<L?n.arc(s.cx,s.cy,E,w(s.y01,s.x01),w(i.y01,i.x01),!c):(n.arc(s.cx,s.cy,E,w(s.y01,s.x01),w(s.y11,s.x11),!c),n.arc(0,0,a,w(s.cy+s.y11,s.cx+s.x11),w(i.cy+i.y11,i.cx+i.x11),!c),n.arc(i.cx,i.cy,E,w(i.y11,i.x11),w(i.y01,i.x01),!c))):(n.moveTo(q,z),n.arc(0,0,a,m,o,!c)):n.moveTo(q,z),!(r>S)||!(R>S)?n.lineTo(O,G):$>S?(s=U(O,G,J,Q,r,-$,c),i=U(q,z,Y,Z,r,-$,c),n.lineTo(s.cx+s.x01,s.cy+s.y01),$<L?n.arc(s.cx,s.cy,$,w(s.y01,s.x01),w(i.y01,i.x01),!c):(n.arc(s.cx,s.cy,$,w(s.y01,s.x01),w(s.y11,s.x11),!c),n.arc(0,0,r,w(s.cy+s.y11,s.cx+s.x11),w(i.cy+i.y11,i.cx+i.x11),c),n.arc(i.cx,i.cy,$,w(i.y11,i.x11),w(i.y01,i.x01),!c))):n.arc(0,0,r,M,l,c)}if(n.closePath(),e)return n=null,e+""||null}return u.centroid=function(){var e=(+t.apply(this,arguments)+ +h.apply(this,arguments))/2,y=(+x.apply(this,arguments)+ +A.apply(this,arguments))/2-V/2;return[k(y)*e,b(y)*e]},u.innerRadius=function(e){return arguments.length?(t=typeof e=="function"?e:T(+e),u):t},u.outerRadius=function(e){return arguments.length?(h=typeof e=="function"?e:T(+e),u):h},u.cornerRadius=function(e){return arguments.length?(v=typeof e=="function"?e:T(+e),u):v},u.padRadius=function(e){return arguments.length?(P=e==null?null:typeof e=="function"?e:T(+e),u):P},u.startAngle=function(e){return arguments.length?(x=typeof e=="function"?e:T(+e),u):x},u.endAngle=function(e){return arguments.length?(A=typeof e=="function"?e:T(+e),u):A},u.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:T(+e),u):p},u.context=function(e){return arguments.length?(n=e??null,u):n},u}function Sn(t,h){return h<t?-1:h>t?1:h>=t?0:NaN}function $n(t){return t}function En(){var t=$n,h=Sn,v=null,P=T(0),x=T(W),A=T(0);function p(n){var f,u=(n=mn(n)).length,e,y,r=0,a=new Array(u),g=new Array(u),d=+P.apply(this,arguments),j=Math.min(W,Math.max(-W,x.apply(this,arguments)-d)),c,m=Math.min(Math.abs(j)/u,A.apply(this,arguments)),o=m*(j<0?-1:1),l;for(f=0;f<u;++f)(l=g[a[f]=f]=+t(n[f],f,n))>0&&(r+=l);for(h!=null?a.sort(function(M,R){return h(g[M],g[R])}):v!=null&&a.sort(function(M,R){return v(n[M],n[R])}),f=0,y=r?(j-u*o)/r:0;f<u;++f,d=c)e=a[f],l=g[e],c=d+(l>0?l*y:0)+o,g[e]={data:n[e],index:f,value:l,startAngle:d,endAngle:c,padAngle:m};return g}return p.value=function(n){return arguments.length?(t=typeof n=="function"?n:T(+n),p):t},p.sortValues=function(n){return arguments.length?(h=n,v=null,p):h},p.sort=function(n){return arguments.length?(v=n,h=null,p):v},p.startAngle=function(n){return arguments.length?(P=typeof n=="function"?n:T(+n),p):P},p.endAngle=function(n){return arguments.length?(x=typeof n=="function"?n:T(+n),p):x},p.padAngle=function(n){return arguments.length?(A=typeof n=="function"?n:T(+n),p):A},p}function In({label:t,rows:h}){const v=cn(),[P,x]=fn(Math.round,120),{tip:A,showAt:p,hide:n}=gn(),[f,u]=an.useState(null),e=h.filter(o=>o.value!==null&&o.valuLine truncated
|
||||
import{r as an,j as K}from"./vendor-react-Bf71BWbF.js";import{u as cn,eQ as fn}from"./index-BNBwb-FJ.js";import{u as gn,i as hn,e as pn,C as yn}from"./layout-wfdMYi2n.js";import{w as dn,c as T,a as mn}from"./array-C0P64tl-.js";const on=Math.abs,w=Math.atan2,k=Math.cos,xn=Math.max,rn=Math.min,b=Math.sin,F=Math.sqrt,S=1e-12,V=Math.PI,X=V/2,W=2*V;function vn(t){return t>1?0:t<-1?V:Math.acos(t)}function ln(t){return t>=1?X:t<=-1?-X:Math.asin(t)}function An(t){return t.innerRadius}function Mn(t){return t.outerRadius}function Rn(t){return t.startAngle}function wn(t){return t.endAngle}function Pn(t){return t&&t.padAngle}function Tn(t,h,v,P,x,A,p,n){var f=v-t,u=P-h,e=p-x,y=n-A,r=y*f-e*u;if(!(r*r<S))return r=(e*(h-A)-y*(t-x))/r,[t+r*f,h+r*u]}function U(t,h,v,P,x,A,p){var n=t-v,f=h-P,u=(p?A:-A)/F(n*n+f*f),e=u*f,y=-u*n,r=t+e,a=h+y,g=v+e,d=P+y,j=(r+g)/2,c=(a+d)/2,m=g-r,o=d-a,l=m*m+o*o,M=x-A,R=r*d-g*a,D=(o<0?-1:1)*F(xn(0,M*M*l-R*R)),I=(R*o-m*D)/l,B=(-R*m-o*D)/l,L=(R*o+m*D)/l,$=(-R*m+o*D)/l,E=I-j,s=B-c,i=L-j,N=$-c;return E*E+s*s>i*i+N*N&&(I=L,B=$),{cx:I,cy:B,x01:-e,y01:-y,x11:I*(x/M-1),y11:B*(x/M-1)}}function jn(){var t=An,h=Mn,v=T(0),P=null,x=Rn,A=wn,p=Pn,n=null,f=dn(u);function u(){var e,y,r=+t.apply(this,arguments),a=+h.apply(this,arguments),g=x.apply(this,arguments)-X,d=A.apply(this,arguments)-X,j=on(d-g),c=d>g;if(n||(n=e=f()),a<r&&(y=a,a=r,r=y),!(a>S))n.moveTo(0,0);else if(j>W-S)n.moveTo(a*k(g),a*b(g)),n.arc(0,0,a,g,d,!c),r>S&&(n.moveTo(r*k(d),r*b(d)),n.arc(0,0,r,d,g,c));else{var m=g,o=d,l=g,M=d,R=j,D=j,I=p.apply(this,arguments)/2,B=I>S&&(P?+P.apply(this,arguments):F(r*r+a*a)),L=rn(on(a-r)/2,+v.apply(this,arguments)),$=L,E=L,s,i;if(B>S){var N=ln(B/r*b(I)),O=ln(B/a*b(I));(R-=N*2)>S?(N*=c?1:-1,l+=N,M-=N):(R=0,l=M=(g+d)/2),(D-=O*2)>S?(O*=c?1:-1,m+=O,o-=O):(D=0,m=o=(g+d)/2)}var q=a*k(m),z=a*b(m),Q=r*k(M),G=r*b(M);if(L>S){var H=a*k(o),J=a*b(o),Y=r*k(l),Z=r*b(l),C;if(j<V)if(C=Tn(q,z,Y,Z,H,J,Q,G)){var _=q-C[0],nn=z-C[1],en=H-C[0],tn=J-C[1],sn=1/b(vn((_*en+nn*tn)/(F(_*_+nn*nn)*F(en*en+tn*tn)))/2),un=F(C[0]*C[0]+C[1]*C[1]);$=rn(L,(r-un)/(sn-1)),E=rn(L,(a-un)/(sn+1))}else $=E=0}D>S?E>S?(s=U(Y,Z,q,z,a,E,c),i=U(H,J,Q,G,a,E,c),n.moveTo(s.cx+s.x01,s.cy+s.y01),E<L?n.arc(s.cx,s.cy,E,w(s.y01,s.x01),w(i.y01,i.x01),!c):(n.arc(s.cx,s.cy,E,w(s.y01,s.x01),w(s.y11,s.x11),!c),n.arc(0,0,a,w(s.cy+s.y11,s.cx+s.x11),w(i.cy+i.y11,i.cx+i.x11),!c),n.arc(i.cx,i.cy,E,w(i.y11,i.x11),w(i.y01,i.x01),!c))):(n.moveTo(q,z),n.arc(0,0,a,m,o,!c)):n.moveTo(q,z),!(r>S)||!(R>S)?n.lineTo(Q,G):$>S?(s=U(Q,G,H,J,r,-$,c),i=U(q,z,Y,Z,r,-$,c),n.lineTo(s.cx+s.x01,s.cy+s.y01),$<L?n.arc(s.cx,s.cy,$,w(s.y01,s.x01),w(i.y01,i.x01),!c):(n.arc(s.cx,s.cy,$,w(s.y01,s.x01),w(s.y11,s.x11),!c),n.arc(0,0,r,w(s.cy+s.y11,s.cx+s.x11),w(i.cy+i.y11,i.cx+i.x11),c),n.arc(i.cx,i.cy,$,w(i.y11,i.x11),w(i.y01,i.x01),!c))):n.arc(0,0,r,M,l,c)}if(n.closePath(),e)return n=null,e+""||null}return u.centroid=function(){var e=(+t.apply(this,arguments)+ +h.apply(this,arguments))/2,y=(+x.apply(this,arguments)+ +A.apply(this,arguments))/2-V/2;return[k(y)*e,b(y)*e]},u.innerRadius=function(e){return arguments.length?(t=typeof e=="function"?e:T(+e),u):t},u.outerRadius=function(e){return arguments.length?(h=typeof e=="function"?e:T(+e),u):h},u.cornerRadius=function(e){return arguments.length?(v=typeof e=="function"?e:T(+e),u):v},u.padRadius=function(e){return arguments.length?(P=e==null?null:typeof e=="function"?e:T(+e),u):P},u.startAngle=function(e){return arguments.length?(x=typeof e=="function"?e:T(+e),u):x},u.endAngle=function(e){return arguments.length?(A=typeof e=="function"?e:T(+e),u):A},u.padAngle=function(e){return arguments.length?(p=typeof e=="function"?e:T(+e),u):p},u.context=function(e){return arguments.length?(n=e??null,u):n},u}function Sn(t,h){return h<t?-1:h>t?1:h>=t?0:NaN}function $n(t){return t}function En(){var t=$n,h=Sn,v=null,P=T(0),x=T(W),A=T(0);function p(n){var f,u=(n=mn(n)).length,e,y,r=0,a=new Array(u),g=new Array(u),d=+P.apply(this,arguments),j=Math.min(W,Math.max(-W,x.apply(this,arguments)-d)),c,m=Math.min(Math.abs(j)/u,A.apply(this,arguments)),o=m*(j<0?-1:1),l;for(f=0;f<u;++f)(l=g[a[f]=f]=+t(n[f],f,n))>0&&(r+=l);for(h!=null?a.sort(function(M,R){return h(g[M],g[R])}):v!=null&&a.sort(function(M,R){return v(n[M],n[R])}),f=0,y=r?(j-u*o)/r:0;f<u;++f,d=c)e=a[f],l=g[e],c=d+(l>0?l*y:0)+o,g[e]={data:n[e],index:f,value:l,startAngle:d,endAngle:c,padAngle:m};return g}return p.value=function(n){return arguments.length?(t=typeof n=="function"?n:T(+n),p):t},p.sortValues=function(n){return arguments.length?(h=n,v=null,p):h},p.sort=function(n){return arguments.length?(v=n,h=null,p):v},p.startAngle=function(n){return arguments.length?(P=typeof n=="function"?n:T(+n),p):P},p.endAngle=function(n){return arguments.length?(x=typeof n=="function"?n:T(+n),p):x},p.padAngle=function(n){return arguments.length?(A=typeof n=="function"?n:T(+n),p):A},p}function In({label:t,rows:h}){const v=cn(),[P,x]=fn(Math.round,120),{tip:A,showAt:p,hide:n}=gn(),[f,u]=an.useState(null),e=h.filter(o=>o.value!==null&&o.valuLine truncated
|
||||
@@ -1,2 +1,2 @@
|
||||
import{r as v,j as n}from"./vendor-react-Bf71BWbF.js";import{a0 as b,dy as k,dz as f,aq as j,bo as y,u as g,a2 as E,a as T,a5 as L,dA as N,bc as D,dB as H,dC as C,dD as R,dE as K,aE as p,bm as M,aD as _,b2 as A,aC as F,B as O,aF as S,E as W}from"./index-CXHBmSa5.js";import{D as B}from"./Table-D0NFHHNQ.js";import{d as I,e as P}from"./files-BxEOxSF8.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";const h={buffer_overflow:["event.gap.overflow","event.gapHelp.overflow"],evicted:["event.gap.evicted","event.gapHelp.evicted"]};function V(e,t){const a=e.event==="flow.gap"&&Object.hasOwn(h,e.data.reason)?h[e.data.reason]:void 0;return a&&{title:t(a[0]),text:t(a[1])}}const w=new WeakMap;function q(e,t,a,l){const s=w.get(e);if(s&&s.locale===t)return s.row;const o=l?{key:"event.lostHistory"}:k(e,a),i={id:e.id,timestamp:j(e.data.observed_at,t),iso:e.data.observed_at,kind:e.event,kindText:b(f,e.event,a),summary:a(o.key,o.params),help:V(e,a)};return w.set(e,{locale:t,row:i}),i}function z(e,t,a,l,s,o,i,c,r=!1,u=()=>!1){const m=t==="without-runtime"||c.includes(t)?t:"all",x=e.filter(d=>m==="all"||(m==="without-runtime"?d.event!=="runtime.updated":d.event===m)).slice(0,s);return{kind:m,rows:x.map(d=>q(d,o,i,u(d))),kinds:[{id:"without-runtime",label:i("event.withoutRuntime")},{id:"all",label:i("event.allKinds")},...c.map(d=>({id:d,label:b(f,d,i)}))],status:r&&l!==!1?{tone:"err",text:i("event.disconnected")}:{tone:a?"ok":l===null?"muted":"warn",text:i(l===!1?"event.unavailable":a?"event.connected":l===null?"ui.loading":"event.reconnecting")},limitText:i("event.limit",{n:s}),shown:x}}function J(e){return JSON.stringify(e,null,2)+`
|
||||
`}function G(){const e=y(),t=g(),a=E[T()],s=L().data?.resources.events.kinds,[o,i]=v.useState("without-runtime"),c=o!=="all"&&o!=="runtime.updated"&&s?.includes(o),r=N(o!=="without-runtime"&&!c),u=v.useMemo(()=>z(r.events,o,r.connected,r.available,K,a,t,s??[],!!r.error,R),[r.events,o,r.connected,r.available,r.error,a,t,s]);return D(u.kind,i),{...u,setKind:i,cursor:r.cursor,error:r.error,retry:()=>void H().then(()=>C(e)),loading:!r.error&&!r.connected&&r.available!==!1&&!r.events.length,export:()=>I(P("doona-events","json"),J(u.shown),"application/json")}}function te(){const e=g(),t=G(),a=v.useMemo(()=>[{id:"t",label:e("ui.time"),minWidth:200,grow:0,drop:1,render:s=>n.jsx(p,{className:"rp-code",text:s.iso,children:s.timestamp})},{id:"k",label:e("event.kind"),minWidth:168,drop:2,render:s=>n.jsx(p,{text:s.kind,children:s.kindText})},{id:"m",label:e("event.summary"),minWidth:240,isRowHeader:!0,render:s=>n.jsx(M,{fill:!0,help:s.help,children:n.jsx(p,{children:s.summary})})}],[e]),l=v.useCallback(s=>n.jsx(_,{inline:!0,items:[[e("ui.time"),s.timestamp],[e("event.kind"),s.kindText],[e("event.summary"),s.summary]]}),[e]);return n.jsxs("div",{className:"rp-page",children:[n.jsxs("div",{className:"rp-toolbar",children:[n.jsx(A,{label:e("event.kind"),side:!0,value:t.kind,onChange:t.setKind,items:t.kinds}),n.jsx(F,{small:!0,tone:t.status.tone,children:t.status.text}),t.cursor&&n.jsx(p,{text:t.cursor,children:n.jsx("span",{className:"rp-label",children:e("event.cursor")})}),n.jsx("span",{className:"rp-label",children:t.limitText}),n.jsx("span",{className:"rp-grow"}),n.jsxs(O,{isDisabled:!t.rows.length,onPress:t.export,children:[n.jsx(S,{}),e("event.export")]})]}),t.error&&n.jsx(W,{error:t.error,onRetry:t.retry}),n.jsx(B,{label:e("nav.events"),stream:!0,fit:!0,height:442,loading:t.loading,rows:t.rows,empty:e("event.empty"),cols:a,detail:l})]})}export{te as Events};
|
||||
import{r as v,j as n}from"./vendor-react-Bf71BWbF.js";import{a3 as b,dH as k,dI as f,at as j,bs as y,u as g,a5 as E,a as T,a8 as L,dJ as N,bf as H,dK as K,dL as M,dM as R,dN as D,aH as p,bq as _,aG as C,b5 as F,aF as I,B as O,aI as S,E as W}from"./index-BNBwb-FJ.js";import{D as A}from"./Table-DyWJelc_.js";import{d as B,e as J}from"./files-BxEOxSF8.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";const h={buffer_overflow:["event.gap.overflow","event.gapHelp.overflow"],evicted:["event.gap.evicted","event.gapHelp.evicted"]};function P(e,t){const a=e.event==="flow.gap"&&Object.hasOwn(h,e.data.reason)?h[e.data.reason]:void 0;return a&&{title:t(a[0]),text:t(a[1])}}const w=new WeakMap;function V(e,t,a,l){const s=w.get(e);if(s&&s.locale===t)return s.row;const o=l?{key:"event.lostHistory"}:k(e,a),i={id:e.id,timestamp:j(e.data.observed_at,t),iso:e.data.observed_at,kind:e.event,kindText:b(f,e.event,a),summary:a(o.key,o.params),help:P(e,a)};return w.set(e,{locale:t,row:i}),i}function q(e,t,a,l,s,o,i,c,r=!1,u=()=>!1){const m=t==="without-runtime"||c.includes(t)?t:"all",x=e.filter(d=>m==="all"||(m==="without-runtime"?d.event!=="runtime.updated":d.event===m)).slice(0,s);return{kind:m,rows:x.map(d=>V(d,o,i,u(d))),kinds:[{id:"without-runtime",label:i("event.withoutRuntime")},{id:"all",label:i("event.allKinds")},...c.map(d=>({id:d,label:b(f,d,i)}))],status:r&&l!==!1?{tone:"err",text:i("event.disconnected")}:{tone:a?"ok":l===null?"muted":"warn",text:i(l===!1?"event.unavailable":a?"event.connected":l===null?"ui.loading":"event.reconnecting")},limitText:i("event.limit",{n:s}),shown:x}}function G(e){return JSON.stringify(e,null,2)+`
|
||||
`}function z(){const e=y(),t=g(),a=E[T()],s=L().data?.resources.events.kinds,[o,i]=v.useState("without-runtime"),c=o!=="all"&&o!=="runtime.updated"&&s?.includes(o),r=N(o!=="without-runtime"&&!c),u=v.useMemo(()=>q(r.events,o,r.connected,r.available,D,a,t,s??[],!!r.error,R),[r.events,o,r.connected,r.available,r.error,a,t,s]);return H(u.kind,i),{...u,setKind:i,cursor:r.cursor,error:r.error,retry:()=>void K().then(()=>M(e)),loading:!r.error&&!r.connected&&r.available!==!1&&!r.events.length,export:()=>B(J("doona-events","json"),G(u.shown),"application/json")}}function te(){const e=g(),t=z(),a=v.useMemo(()=>[{id:"t",label:e("ui.time"),minWidth:200,grow:0,drop:1,render:s=>n.jsx(p,{className:"rp-code",text:s.iso,children:s.timestamp})},{id:"k",label:e("event.kind"),minWidth:168,drop:2,render:s=>n.jsx(p,{text:s.kind,children:s.kindText})},{id:"m",label:e("event.summary"),minWidth:240,isRowHeader:!0,render:s=>n.jsx(_,{fill:!0,help:s.help,children:n.jsx(p,{children:s.summary})})}],[e]),l=v.useCallback(s=>n.jsx(C,{inline:!0,items:[[e("ui.time"),s.timestamp],[e("event.kind"),s.kindText],[e("event.summary"),s.summary]]}),[e]);return n.jsxs("div",{className:"rp-page",children:[n.jsxs("div",{className:"rp-toolbar",children:[n.jsx(F,{label:e("event.kind"),side:!0,value:t.kind,onChange:t.setKind,items:t.kinds}),n.jsx(I,{small:!0,tone:t.status.tone,children:t.status.text}),t.cursor&&n.jsx(p,{text:t.cursor,children:n.jsx("span",{className:"rp-label",children:e("event.cursor")})}),n.jsx("span",{className:"rp-label",children:t.limitText}),n.jsx("span",{className:"rp-grow"}),n.jsxs(O,{isDisabled:!t.rows.length,onPress:t.export,children:[n.jsx(S,{}),e("event.export")]})]}),t.error&&n.jsx(W,{error:t.error,onRetry:t.retry}),n.jsx(A,{label:e("nav.events"),stream:!0,fit:!0,height:442,loading:t.loading,rows:t.rows,empty:e("event.empty"),cols:a,detail:l})]})}export{te as Events};
|
||||
@@ -1 +1 @@
|
||||
import{j as s}from"./vendor-react-Bf71BWbF.js";import{aE as t}from"./index-CXHBmSa5.js";function p({facts:l,lead:r}){return l.length?s.jsx("dl",{className:"rp-strip rp-facts"+(r?" rp-facts-lead":""),style:{"--facts":l.length,"--facts-rest":l.length-1},children:l.map((e,i)=>s.jsxs("div",{className:"rp-card"+(e.tone?" "+e.tone:""),children:[s.jsxs("dt",{className:"rp-tile-head"+(e.tint?" rp-tint-"+e.tint:""),children:[e.icon,e.label]}),s.jsxs("dd",{className:"rp-tile-body",children:[r&&i===0?s.jsx(t,{className:"rp-big",cut:"start",children:e.value}):s.jsx("span",{className:"rp-big",title:e.value,children:e.value}),e.caption&&s.jsx("span",{className:"rp-fact-caption",title:e.caption,children:e.caption})]})]},e.label))}):null}export{p as F};
|
||||
import{j as s}from"./vendor-react-Bf71BWbF.js";import{aH as t}from"./index-BNBwb-FJ.js";function p({facts:l,lead:r}){return l.length?s.jsx("dl",{className:"rp-strip rp-facts"+(r?" rp-facts-lead":""),style:{"--facts":l.length,"--facts-rest":l.length-1},children:l.map((e,i)=>s.jsxs("div",{className:"rp-card"+(e.tone?" "+e.tone:""),children:[s.jsxs("dt",{className:"rp-tile-head"+(e.tint?" rp-tint-"+e.tint:""),children:[e.icon,e.label]}),s.jsxs("dd",{className:"rp-tile-body",children:[r&&i===0?s.jsx(t,{className:"rp-big",cut:"start",children:e.value}):s.jsx("span",{className:"rp-big",title:e.value,children:e.value}),e.caption&&s.jsx("span",{className:"rp-fact-caption",title:e.caption,children:e.caption})]})]},e.label))}):null}export{p as F};
|
||||
@@ -1 +1 @@
|
||||
import{ee as v}from"./index-CXHBmSa5.js";import{$ as R,c,a as S,b as p}from"./Virtualizer--Vfl8O3n.js";const f=48;class N extends R{constructor(t={}){super(),this.rowSize=t?.rowSize??t?.rowHeight??null,this.orientation=t.orientation??"vertical",this.estimatedRowSize=t?.estimatedRowSize??t?.estimatedRowHeight??null,this.headingSize=t?.headingSize??t?.headingHeight??null,this.estimatedHeadingSize=t?.estimatedHeadingSize??t?.estimatedHeadingHeight??null,this.loaderSize=t?.loaderSize??t?.loaderHeight??null,this.dropIndicatorThickness=t.dropIndicatorThickness||2,this.gap=t.gap||0,this.padding=t.padding||0,this.layoutNodes=new Map,this.rootNodes=[],this.lastCollection=null,this.invalidateEverything=!1,this.validRect=new c,this.requestedRect=new c,this.contentSize=new S}get collection(){return this.virtualizer.collection}get rowHeight(){return this.rowSize}get estimatedRowHeight(){return this.estimatedRowSize}get headingHeight(){return this.headingSize}get estimatedHeadingHeight(){return this.estimatedHeadingSize}get loaderHeight(){return this.loaderSize}getLayoutInfo(t){return this.ensureLayoutInfo(t),this.layoutNodes.get(t)?.layoutInfo||null}getVisibleLayoutInfos(t){let e=this.orientation==="horizontal"?"x":"y",i=this.orientation==="horizontal"?"width":"height";if(t[i]>1){let s=(this.rowSize??this.estimatedRowSize??f)+this.gap;t=t.copy();let o=Math.floor(t[e]/s)*s,l=t[i]+t[e]-o;t[e]=o,t[i]=Math.ceil(l/s)*s}this.layoutIfNeeded(t);let r=[],h=s=>{for(let o of s)this.isVisible(o,t)&&(r.push(o.layoutInfo),o.children&&h(o.children))};return h(this.rootNodes),r}layoutIfNeeded(t){if(this.lastCollection){this.requestedRect.containsRect(t)||(this.requestedRect=this.requestedRect.union(t),this.rootNodes=this.buildCollection());for(let e of this.virtualizer.persistedKeys)if(this.ensureLayoutInfo(e))return}}ensureLayoutInfo(t){return!this.layoutNodes.has(t)&&this.requestedRect.area<this.contentSize.area&&this.lastCollection?(this.requestedRect=new c(0,0,1/0,1/0),this.rootNodes=this.buildCollection(),this.requestedRect=new c(0,0,this.contentSize.width,this.contentSize.height),!0):!1}isVisible(t,e){return t.layoutInfo.rect.intersects(e)||t.layoutInfo.isSticky||t.layoutInfo.type==="header"||t.layoutInfo.type==="loader"||this.virtualizer.isPersistedKey(t.layoutInfo.key)}shouldInvalidateEverything(t){let e=t.layoutOptions;return t.sizeChanged||this.rowSize!==(e?.rowSize??e?.rowHeight??this.rowSize)||this.orientation!==(e?.orientation??this.orientation)||this.headingSize!==(e?.headingSize??e?.headingHeight??this.headingSize)||this.loaderSize!==(e?.loaderSize??e?.loaderHeight??this.loaderSize)||this.gap!==(e?.gap??this.gap)||this.padding!==(e?.padding??this.padding)}shouldInvalidateLayoutOptions(t,e){return(t?.rowSize??t?.rowHeight)!==(e?.rowSize??e?.rowHeight)||t.orientation!==e.orientation||(t?.estimatedRowSize??t?.estimatedRowHeight)!==(e?.estimatedRowSize??e?.estimatedRowHeight)||(t?.headingSize??t?.headingHeight)!==(e?.headingSize??e?.headingHeight)||(t?.estimatedHeadingSize??t?.estimatedHeadingHeight)!==(e?.estimatedHeadingSize??e?.estimatedHeadingHeight)||(t?.loaderSize??t?.loaderHeight)!==(e?.loaderSize??e?.loaderHeight)||t.dropIndicatorThickness!==e.dropIndicatorThickness||t.gap!==e.gap||t.padding!==e.padding}update(t){let e=this.virtualizer.collection;this.invalidateEverything=this.shouldInvalidateEverything(t),this.invalidateEverything&&(this.requestedRect=this.virtualizer.visibleRect.copy(),this.layoutNodes.clear());let i=t.layoutOptions;if(this.rowSize=i?.rowSize??i?.rowHeight??this.rowSize,this.orientation=i?.orientation??this.orientation,this.estimatedRowSize=i?.estimatedRowSize??i?.estimatedRowHeight??this.estimatedRowSize,this.headingSize=i?.headingSize??i?.headingHeight??this.headingSize,this.estimatedHeadingSize=i?.estimatedHeadingSize??i?.estimatedHeadingHeight??this.estimatedHeadingSize,this.loaderSize=i?.loaderSize??i?.loaderHeight??this.loaderSize,this.dropIndicatorThickness=i?.dropIndicatorThickness??this.dropIndicatorThickness,this.gap=i?.gap??this.gap,this.padding=i?.padding??this.padding,this.rootNodes=this.buildCollection(),this.lastCollection&&e!==this.lastCollection)for(let r of this.lastCollection.getKeys())e.getItem(r)||this.layoutNodes.get(r)&&this.layoutNodes.delete(r);this.lastCollection=e,this.invalidateEverything=!1,this.validRect=this.requestedRect.copy()}buildCollection(t=this.padding){let e=this.virtualizer.collection,i=this.orientation==="horizontal"?"x":"y",r=this.orientation==="horizontal"?"maxX":"maxY",h=H(e,a=>a.type!=="content"),s=h.filter(a=>a.type==="loader"),o=[],l=e?.size===0;l&&(t=0);for(let a of h){let n=(this.rowSize??this.estimatedRowSize??f)+this.gap;if(a.type==="item"&&t+n<this.requestedRect[i]&&!this.isValid(a,t)){t+=n;continue}let d=this.orientation==="horizontal"?this.buildChild(a,t,this.padding,null):this.buildChild(a,this.padding,t,null);if(t=d.layoutInfo.rect[r]+this.gap,o.push(d),a.type==="loader"){let u=s.indexOf(a);s.splice(u,1)}if((a.type==="item"||a.type==="loader"Line truncated
|
||||
import{en as v}from"./index-BNBwb-FJ.js";import{$ as R,c,a as S,b as p}from"./Virtualizer-DipGMcji.js";const f=48;class N extends R{constructor(t={}){super(),this.rowSize=t?.rowSize??t?.rowHeight??null,this.orientation=t.orientation??"vertical",this.estimatedRowSize=t?.estimatedRowSize??t?.estimatedRowHeight??null,this.headingSize=t?.headingSize??t?.headingHeight??null,this.estimatedHeadingSize=t?.estimatedHeadingSize??t?.estimatedHeadingHeight??null,this.loaderSize=t?.loaderSize??t?.loaderHeight??null,this.dropIndicatorThickness=t.dropIndicatorThickness||2,this.gap=t.gap||0,this.padding=t.padding||0,this.layoutNodes=new Map,this.rootNodes=[],this.lastCollection=null,this.invalidateEverything=!1,this.validRect=new c,this.requestedRect=new c,this.contentSize=new S}get collection(){return this.virtualizer.collection}get rowHeight(){return this.rowSize}get estimatedRowHeight(){return this.estimatedRowSize}get headingHeight(){return this.headingSize}get estimatedHeadingHeight(){return this.estimatedHeadingSize}get loaderHeight(){return this.loaderSize}getLayoutInfo(t){return this.ensureLayoutInfo(t),this.layoutNodes.get(t)?.layoutInfo||null}getVisibleLayoutInfos(t){let e=this.orientation==="horizontal"?"x":"y",i=this.orientation==="horizontal"?"width":"height";if(t[i]>1){let s=(this.rowSize??this.estimatedRowSize??f)+this.gap;t=t.copy();let o=Math.floor(t[e]/s)*s,l=t[i]+t[e]-o;t[e]=o,t[i]=Math.ceil(l/s)*s}this.layoutIfNeeded(t);let r=[],h=s=>{for(let o of s)this.isVisible(o,t)&&(r.push(o.layoutInfo),o.children&&h(o.children))};return h(this.rootNodes),r}layoutIfNeeded(t){if(this.lastCollection){this.requestedRect.containsRect(t)||(this.requestedRect=this.requestedRect.union(t),this.rootNodes=this.buildCollection());for(let e of this.virtualizer.persistedKeys)if(this.ensureLayoutInfo(e))return}}ensureLayoutInfo(t){return!this.layoutNodes.has(t)&&this.requestedRect.area<this.contentSize.area&&this.lastCollection?(this.requestedRect=new c(0,0,1/0,1/0),this.rootNodes=this.buildCollection(),this.requestedRect=new c(0,0,this.contentSize.width,this.contentSize.height),!0):!1}isVisible(t,e){return t.layoutInfo.rect.intersects(e)||t.layoutInfo.isSticky||t.layoutInfo.type==="header"||t.layoutInfo.type==="loader"||this.virtualizer.isPersistedKey(t.layoutInfo.key)}shouldInvalidateEverything(t){let e=t.layoutOptions;return t.sizeChanged||this.rowSize!==(e?.rowSize??e?.rowHeight??this.rowSize)||this.orientation!==(e?.orientation??this.orientation)||this.headingSize!==(e?.headingSize??e?.headingHeight??this.headingSize)||this.loaderSize!==(e?.loaderSize??e?.loaderHeight??this.loaderSize)||this.gap!==(e?.gap??this.gap)||this.padding!==(e?.padding??this.padding)}shouldInvalidateLayoutOptions(t,e){return(t?.rowSize??t?.rowHeight)!==(e?.rowSize??e?.rowHeight)||t.orientation!==e.orientation||(t?.estimatedRowSize??t?.estimatedRowHeight)!==(e?.estimatedRowSize??e?.estimatedRowHeight)||(t?.headingSize??t?.headingHeight)!==(e?.headingSize??e?.headingHeight)||(t?.estimatedHeadingSize??t?.estimatedHeadingHeight)!==(e?.estimatedHeadingSize??e?.estimatedHeadingHeight)||(t?.loaderSize??t?.loaderHeight)!==(e?.loaderSize??e?.loaderHeight)||t.dropIndicatorThickness!==e.dropIndicatorThickness||t.gap!==e.gap||t.padding!==e.padding}update(t){let e=this.virtualizer.collection;this.invalidateEverything=this.shouldInvalidateEverything(t),this.invalidateEverything&&(this.requestedRect=this.virtualizer.visibleRect.copy(),this.layoutNodes.clear());let i=t.layoutOptions;if(this.rowSize=i?.rowSize??i?.rowHeight??this.rowSize,this.orientation=i?.orientation??this.orientation,this.estimatedRowSize=i?.estimatedRowSize??i?.estimatedRowHeight??this.estimatedRowSize,this.headingSize=i?.headingSize??i?.headingHeight??this.headingSize,this.estimatedHeadingSize=i?.estimatedHeadingSize??i?.estimatedHeadingHeight??this.estimatedHeadingSize,this.loaderSize=i?.loaderSize??i?.loaderHeight??this.loaderSize,this.dropIndicatorThickness=i?.dropIndicatorThickness??this.dropIndicatorThickness,this.gap=i?.gap??this.gap,this.padding=i?.padding??this.padding,this.rootNodes=this.buildCollection(),this.lastCollection&&e!==this.lastCollection)for(let r of this.lastCollection.getKeys())e.getItem(r)||this.layoutNodes.get(r)&&this.layoutNodes.delete(r);this.lastCollection=e,this.invalidateEverything=!1,this.validRect=this.requestedRect.copy()}buildCollection(t=this.padding){let e=this.virtualizer.collection,i=this.orientation==="horizontal"?"x":"y",r=this.orientation==="horizontal"?"maxX":"maxY",h=H(e,a=>a.type!=="content"),s=h.filter(a=>a.type==="loader"),o=[],l=e?.size===0;l&&(t=0);for(let a of h){let n=(this.rowSize??this.estimatedRowSize??f)+this.gap;if(a.type==="item"&&t+n<this.requestedRect[i]&&!this.isValid(a,t)){t+=n;continue}let d=this.orientation==="horizontal"?this.buildChild(a,t,this.padding,null):this.buildChild(a,this.padding,t,null);if(t=d.layoutInfo.rect[r]+this.gap,o.push(d),a.type==="loader"){let u=s.indexOf(a);s.splice(u,1)}if((a.type==="item"||a.type==="loader"Line truncated
|
||||
@@ -1,2 +0,0 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./LoginShowcase-CwRzXrsa.js","./vendor-react-Bf71BWbF.js","./index-CXHBmSa5.js","./index-BMPxGQXj.css"])))=>i.map(i=>d[i]);
|
||||
import{u as z,a as W,e as X,d as I,A as L,i as Y,b as ee,s as se,r as ne,w as te,n as B,c as re,f as oe,L as C,h as ie,g as ae,S as le,l as ce,E as H,j as ue,I as de,T as b,B as ge,k as me,_ as pe}from"./index-CXHBmSa5.js";import{r as u,j as s}from"./vendor-react-Bf71BWbF.js";import{D as P,s as fe,d as he,a as xe,o as we}from"./auth-BGnwk8Hi.js";function ke(n,r,o,a){return n.some(t=>t.id===r&&B(t.api)===B(o))?n.map(t=>t.id===r?{...t,token:a.trim()}:t):null}const ye=/^[A-Za-z0-9_.-]{1,64}$/;function je(n,r,o,a){const t={};r?ye.test(r)||(t.username="login.badUsername"):t.username="login.usernameRequired";const l=[...o].length;return l?n==="setup"&&l<8?t.password="login.passwordShort":l>128||new TextEncoder().encode(o).length>512?t.password="login.passwordLong":n==="setup"&&o!==a&&(t.confirm="login.mismatch"):t.password="login.passwordRequired",t}function ve(n){return n instanceof L?n.code==="invalid_credentials"?{key:"login.invalidCredentials"}:n.code==="setup_required"?{key:"login.needsSetup",switchTo:"setup"}:n.code==="setup_already_completed"?{key:"login.alreadySetUp",switchTo:"login"}:n.code==="permission_denied"?{key:"login.setupPeer"}:n.code==="rate_limited"?{key:"login.rateLimited",params:{n:n.retryAfter??60}}:null:null}function be(n){return n instanceof SyntaxError?!0:n instanceof L&&(n.status===404||n.status===401||n.status===403)}async function Se(n,r){try{return fe(await he(n,r))}catch(o){if(!be(o))throw o;return!(o instanceof L)||o.status!==404||await xe(n,r)?"token":"no-api"}}function Te(n,r,o){try{const{profiles:a,activeId:t}=ne(),l=ke(a,n,r,o);if(!l)return"login.stale";te({profiles:l,activeId:t})}catch{return"settings.saveError"}return null}async function Ee(n,r,o,a){let t;try{t=await we(r,o,a)}catch(l){return ve(l)??{error:l}}try{se(n,r,t.token,t.expires_at)}catch{return{key:"settings.saveError"}}return null}function Ne(n,r){const{kind:o,failure:a,attempt:t,ended:l,rejected:h}=n;return o==="no-api"?null:a!==null?{tone:"negative",text:typeof a=="string"?a:r(a.key,a.params),focus:!0,id:t}:l?{tone:"informative",text:r("login.sessionEnded"),focus:!1,id:0}:h&&o==="token"?{tone:"negative",text:r("login.rejected"),focus:!1,id:0}:null}function Ae(n,r,o,a){const t=z(),l=W(),[h]=u.useState(()=>X(n,r)),[c,w]=u.useState(null),[k,y]=u.useState({attempt:0,error:null});u.useEffect(()=>{const i=new AbortController;return Se(r,i.signal).then(g=>w(g),g=>{i.signal.aborted||y(m=>({...m,error:g instanceof Error?g:new Error(String(g))}))}),()=>i.abort()},[r,k.attempt]);const[p,d]=u.useState(""),e=Y(r),[x,j]=u.useState(e?P.username:""),[f,S]=u.useState(e?P.password:""),[D,R]=u.useState(""),[T,K]=u.useState(!1),[U,q]=u.useState(!1),[E,F]=u.useState({}),[V,v]=u.useState(null),[Z,Q]=u.useState(0),N=(i,g)=>m=>{g(m),E[i]&&F(({[i]:Ce,...J})=>J)},$=()=>{if(!p.trim())return;const i=Te(n,r,p);i?v({key:i}):location.reload()},G=async i=>{const g=je(i,x,f,D);if(F(g),Object.keys(g).length)return;q(!0);const m=await Ee(n,r,i,{username:x,password:f});if(!m){location.reload();return}if(q(!1),"error"in m){v(t("login.failed",{error:ee(m.error,t)}));return}m.switchTo&&(w(m.switchTo),R("")),v(m)},A=c==="setup"||c==="login",_=i=>E[i]?t(E[i]):void 0;return{kind:c,discoveryError:k.error,retryDiscovery:()=>y(i=>({attempt:i.attempt+1,error:null})),title:t(c==="no-api"?"login.noApiTitle":c==="setup"?"login.setupTitle":c==="token"?"login.title":"login.passwordTitle"),note:c==="no-api"?t("login.noApiNote"):c==="setup"?t("login.setupNote",{backend:o}):c==="login"?t("login.connectedTo",{backend:o}):t("login.note",{backend:o}),demoNote:e&&c==="login"?t("login.demoNote",P):null,alert:Ne({kind:c,failure:V,attempt:Z,ended:h,rejected:a},t),busy:U,token:p,setToken:d,username:x,setUsername:N("username",j),usernameError:_("username"),password:f,setPassword:N("password",S),passwordError:_("password"),confirm:D,setConfirm:N("confirm",R),confirmError:_("confirm"),submit:()=>{U||c==="no-api"||(v(null),Q(i=>i+1),A?G(c):$())},canSubmit:c!=="no-api"&&(A||!!p.trim()),secretType:T?"text":"password",toggle:()=>K(i=>!i),toggleText:t(A?T?"login.hidePassword":"login.showPassword":T?"settings.hideToken":"settings.showToken"),guideHref:I(l),requirementsHref:I(l,"no-native-api")}}function M({className:n,...r}){return s.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:10,height:10,viewBox:"0 0 12 12","aria-hidden":"true",focusable:"false",className:re("rp-icon rp-link-out",n),...r,children:s.jsx("path",{fill:"currentColor",d:"m10.08887,1h-5.51074c-.50293,0-.91113.4082-.91113.91113s.4082.91113.91113.91113h3.31055L1.35547,9.35547c-.35645.35645-.35645.93262,0,1.28906.17773.17773.41113.2666.64453.2666s.4668-.08887.64453-.2666l6.5332-6.5332v3.31055c0,.50293.4082.91113.91113.91113s.91113-.4082.91113-.91113V1.91113c0-.50293-.4082-.91113-.91113-.91113Z"})})}const _e=u.lazy(()=>pe(()=>import("./LoginShowcase-CwRzXrsa.js"),__vite__mapDeps([0,1,2,3]),import.meta.url)),O=s.jsx("div",{className:"rp-login-showcase","aria-hidden":"true"});function Re({profileId:n,api:r,backend:o,rLine truncated
|
||||
@@ -0,0 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./LoginShowcase-CyHbTm5w.js","./vendor-react-Bf71BWbF.js","./index-BNBwb-FJ.js","./index-C8vJM6q6.css"])))=>i.map(i=>d[i]);
|
||||
import{u as G,a as ne,e as re,d as K,A as q,i as oe,b as ie,s as ae,r as le,w as ce,n as V,c as ue,f as de,L as U,h as me,g as ge,P as pe,S as fe,l as he,E as Z,j as we,I as xe,T as E,B as ye,k as je,_ as ke}from"./index-BNBwb-FJ.js";import{r as l,j as t}from"./vendor-react-Bf71BWbF.js";import{D as I,s as ve,d as be,a as Te,o as Se}from"./auth-TcOYUrrj.js";function Ee(s,r,o,c){return s.some(n=>n.id===r&&V(n.api)===V(o))?s.map(n=>n.id===r?{...n,token:c.trim()}:n):null}const Ne=/^[A-Za-z0-9_.-]{1,64}$/;function Ae(s,r,o,c){const n={};r?Ne.test(r)||(n.username="login.badUsername"):n.username="login.usernameRequired";const u=[...o].length;return u?s==="setup"&&u<8?n.password="login.passwordShort":u>128||new TextEncoder().encode(o).length>512?n.password="login.passwordLong":s==="setup"&&o!==c&&(n.confirm="login.mismatch"):n.password="login.passwordRequired",n}function Pe(s){if(!(s instanceof q))return null;if(s.code==="invalid_credentials")return{key:"login.invalidCredentials"};if(s.code==="setup_required")return{key:"login.needsSetup",switchTo:"setup"};if(s.code==="setup_already_completed")return{key:"login.alreadySetUp",switchTo:"login"};if(s.code==="permission_denied")return{key:"login.setupPeer"};if(s.code==="rate_limited"){const r=s.retryAfter??60;return{key:"login.rateLimited",params:{n:r},wait:r}}return null}function _e(s){return s instanceof SyntaxError?!0:s instanceof q&&(s.status===404||s.status===401||s.status===403)}async function Ce(s,r){try{return ve(await be(s,r))}catch(o){if(!_e(o))throw o;return!(o instanceof q)||o.status!==404||await Te(s,r)?"token":"no-api"}}function Le(s,r,o){try{const{profiles:c,activeId:n}=le(),u=Ee(c,s,r,o);if(!u)return"login.stale";ce({profiles:u,activeId:n})}catch{return"settings.saveError"}return null}async function De(s,r,o,c){let n;try{n=await Se(r,o,c)}catch(u){return Pe(u)??{error:u}}try{ae(s,r,n.token,n.expires_at)}catch{return{key:"settings.saveError"}}return null}function Re(s,r){const{kind:o,failure:c,attempt:n,ended:u,rejected:h}=s;return o==="no-api"?null:c!==null?{tone:"negative",text:typeof c=="string"?c:r(c.key,c.params),focus:!0,id:n}:u?{tone:"informative",text:r("login.sessionEnded"),focus:!1,id:0}:h&&o==="token"?{tone:"negative",text:r("login.rejected"),focus:!1,id:0}:null}const Me=s=>typeof s!="string"&&s.key==="login.rateLimited";function Ue(s,r){return Math.max(0,Math.ceil((s-r)/1e3))}function Ie(s,r,o,c){const n=G(),u=ne(),[h]=l.useState(()=>re(s,r)),[a,x]=l.useState(null),[y,j]=l.useState({attempt:0,error:null});l.useEffect(()=>{const i=new AbortController;return Ce(r,i.signal).then(g=>x(g),g=>{i.signal.aborted||j(m=>({...m,error:g instanceof Error?g:new Error(String(g))}))}),()=>i.abort()},[r,y.attempt]);const[p,N]=l.useState(""),d=oe(r),[e,A]=l.useState(d?I.username:""),[f,k]=l.useState(d?I.password:""),[v,F]=l.useState(""),[P,J]=l.useState(!1),[B,H]=l.useState(!1),[_,O]=l.useState({}),[C,b]=l.useState(null),[W,X]=l.useState(0),[T,Y]=l.useState(0),[S,z]=l.useState(Date.now);l.useEffect(()=>{if(T<=S)return;const i=setTimeout(()=>z(Date.now()),(T-S)%1e3||1e3);return()=>clearTimeout(i)},[T,S]);const w=Ue(T,S),L=(i,g)=>m=>{g(m),_[i]&&O(({[i]:M,...se})=>se)},ee=()=>{if(!p.trim())return;const i=Le(s,r,p);i?b({key:i}):location.reload()},te=async i=>{const g=Ae(i,e,f,v);if(O(g),Object.keys(g).length)return;H(!0);const m=await De(s,r,i,{username:e,password:f});if(!m){location.reload();return}if(H(!1),"error"in m){b(n("login.failed",{error:ie(m.error,n)}));return}if(m.wait){const M=Date.now();z(M),Y(M+m.wait*1e3)}m.switchTo&&(x(m.switchTo),F("")),b(m)},D=a==="setup"||a==="login",R=i=>_[i]?n(_[i]):void 0;return{kind:a,discoveryError:y.error,retryDiscovery:()=>j(i=>({attempt:i.attempt+1,error:null})),title:n(a==="no-api"?"login.noApiTitle":a==="setup"?"login.setupTitle":a==="token"?"login.title":"login.passwordTitle"),note:a==="no-api"?n("login.noApiNote"):a==="setup"?n("login.setupNote",{backend:o}):a==="login"?n("login.connectedTo",{backend:o}):n("login.note",{backend:o}),demoNote:d&&a==="login"?n("login.demoNote",I):null,alert:Re({kind:a,failure:C&&!w&&Me(C)?null:C,attempt:W,ended:h,rejected:c},n),busy:B,token:p,setToken:N,username:e,setUsername:L("username",A),usernameError:R("username"),password:f,setPassword:L("password",k),passwordError:R("password"),confirm:v,setConfirm:L("confirm",F),confirmError:R("confirm"),submit:()=>{B||w||a==="no-api"||(b(null),X(i=>i+1),D?te(a):ee())},canSubmit:a!=="no-api"&&!w&&(D||!!p.trim()),submitText:w?n("login.retryIn",{n:w}):n(a==="setup"?"login.create":a==="login"?"login.signIn":"login.submit"),secretType:P?"text":"password",toggle:()=>J(i=>!i),toggleText:n(D?P?"login.hidePassword":"login.showPassword":P?"settings.hideToken":"settings.showToken"),guideHref:K(u),requirementsHref:K(u,"no-native-api")}}function Q({className:s,...r}){return t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:10,height:10,viewBox:"0 0 12 12","aria-hidden":"true",focusable:"false",className:ue("rp-icon rp-link-out",s),...r,children:t.jsx("Line truncated
|
||||
@@ -1 +1 @@
|
||||
import{j as N,r as B}from"./vendor-react-Bf71BWbF.js";import{u as W1,f as j1,aJ as K1}from"./index-CXHBmSa5.js";function N1({label:r,className:a,isDisabled:m,ref:e,canvasRef:l}){return N.jsx("button",{ref:e,type:"button",className:a,"aria-label":r,disabled:m,children:N.jsx("canvas",{ref:l})})}const U1=[["ink","M657 1228c-12-4-23-14-28-26-1-4-2-4-4-4-22 4-36 3-49-3-11-6-18-16-20-27-2-11 3-23 12-34 3-3 6-6 6-6 0 0-7-1-15-1-34-2-70-7-100-14-49-12-98-36-134-67l-5-4-12 4c-20 7-36 9-60 9-21 0-43-4-57-10-13-5-25-16-30-25-5-10-4-23 3-34 4-6 16-18 24-22l6-4-3-8c-2-5-2-9-2-12 1-6 5-15 9-18 4-5 16-13 21-14 3-1 5-2 6-2 0-1-1-6-3-12-21-73-6-145 45-212l7-10-12-2c-15-1-23-3-34-7-24-9-40-29-40-49 0-19 7-34 36-72 15-21 27-39 35-54 11-19 10-17 5-28-2-4-5-11-6-14-2-8-3-32-1-43 4-28 18-59 42-90l3-5-6-4c-11-9-20-21-23-32-2-6-2-9-2-17 1-9 1-10 4-18 6-11 15-20 29-27 14-7 24-10 47-15 1 0 3-3 7-11 19-37 51-71 88-94 12-8 32-18 44-22 10-3 29-8 33-8 1 0 5-2 8-5 11-8 25-14 39-16 12-2 49-1 63 2 21 4 34 9 45 19 8 7 10 9 15 18 4 7 4 7 13 12 34 18 63 46 86 81 10 16 20 38 26 57 4 12 8 34 10 48 2 13 2 43 0 56l-1 10 6 7c8 8 14 19 18 28 3 9 4 24 2 33-3 14-14 27-29 35-9 5-19 7-31 8l-9 1 0 8c0 4 0 15 0 25 0 16-1 31-5 47l0 3 14 0c27 0 58 5 83 14 21 9 51 25 68 39 3 2 6 5 7 5 0 1 6-2 14-6 27-14 49-17 69-11 26 8 38 34 27 64-2 5-3 9-3 10 0 0 4 1 8 3 14 7 24 19 29 34 8 22 0 45-24 73l-5 6 3 9c6 26 8 63 5 89-2 14-7 33-12 48-9 22-26 52-43 72-10 13-34 36-47 46-28 22-59 39-93 52-16 7-44 16-47 16-1 0-1 1-1 3 9 31 7 61-3 81-8 16-19 27-33 34-9 4-14 5-25 5-15 0-28-4-39-13l-6-5-7 6c-9 7-18 13-26 16-9 3-27 4-35 1z"],["paper","M582 1098c-44-2-79-6-117-16-55-14-102-41-141-81-42-43-67-93-75-148-2-14-1-43 1-56 6-30 16-57 32-82 8-12 24-33 32-42 6-7 7-7 17-10 58-18 110-56 126-92 2-5 2-9 3-16 1-14-2-21-15-33-13-14-21-24-33-39-18-26-28-35-45-43-11-5-21-7-33-7-13 0-23 2-33 7-6 3-9 3-9 3-4-6-4-28-2-42 5-23 18-49 37-73 14-18 37-39 56-53 5-4 6-4 11-4 41 1 105 13 154 28 32 9 72 25 104 42 18 9 51 27 66 37 8 5 8 5 11 13 7 16 13 37 16 56 2 11 2 41 1 54-4 39-19 74-44 104-8 9-10 14-9 20 1 5 7 10 13 12 7 2 14-1 24-11 10-11 22-29 32-48 3-5 4-7 6-7 2-1 14-1 27-1 22 0 24 0 37 2 34 8 68 24 98 48 13 11 15 12 20 12 5 0 7-1 16-7 22-14 41-21 53-18 13 3 16 15 7 32-2 5-6 11-8 15-4 8-4 14 0 19 4 5 7 6 17 7 15 1 23 5 27 14 3 6 3 15 0 22-2 6-10 18-20 30-9 11-11 15-8 24 3 10 6 33 7 52 0 26-2 47-10 70-18 53-57 101-111 135-40 25-87 43-144 54-66 14-132 19-194 17z"],["ink","M517 445c-7-2-13-6-18-12-7-7-9-14-9-25 0-7 0-8 3-15 7-13 17-21 31-22 23-1 43 18 41 40-2 19-17 33-36 35-4 0-9-1-12-1z"],["yellow","M541 220c-13-3-27-7-41-9-6-1-14-3-17-3l-5-1 2-6c3-15 13-40 23-59 20-39 43-66 64-73 11-3 56-1 74 4 7 1 13 4 17 7 3 3 3 4-1 4-5 0-17 4-24 7-35 18-62 59-79 118-2 8-4 14-4 14 0 0-4-1-9-3z"],["yellow","M446 203c-4-1-19-1-35-2-16 0-29 0-29-1 0-1 6-12 12-20 22-34 53-62 87-78 10-5 32-13 33-12 0 0-2 3-6 8-19 27-38 69-47 102-1 4-1 4-5 4-3 0-7-1-10-1z"],["yellow","M569 226c13-58 39-102 70-119 14-7 21-6 40 1 53 23 96 73 113 132 9 29 11 67 7 95-71-43-149-81-230-109z"],["yellow","M780 426c-1-2-5-19-5-19 0-1 3 0 8 0 6 0 8 0 10-2 5-4 3-6-21-21-50-32-74-46-109-63-71-36-143-57-225-67-48-6-99-5-107 1-4 3-5 5-2 7 1 2 3 2 10 3l8 0-4 4c-3 3-9 8-13 12l-9 8-4-2c-6-4-13-11-16-17-3-5-4-12-3-17 2-8 11-17 22-22 22-10 60-14 101-12 63 3 121 16 167 36 71 31 145 67 214 105 17 10 27 31 23 45-1 5-6 12-10 15-6 4-15 6-25 7-8 0-10 0-10-1z"],["yellow","M251 640c-19-4-32-16-32-29 0-10 5-19 23-43 26-34 37-50 50-75 6-12 9-17 13-20 12-11 29-13 45-7 11 5 17 10 37 36 9 13 19 25 24 30 5 5 10 10 12 13 2 3 2 5 2 10 0 5-1 8-4 12-17 29-73 61-123 71-14 3-38 4-47 2z"],["yellow","M226 1028c-12-1-24-5-31-10-12-8-13-16-2-27 5-5 19-13 30-17 7-3 11-6 11-8 0-3-1-5-8-9-7-6-10-10-10-14 0-4 1-5 4-8 2-2 6-4 9-5 3-1 5-2 5-2 1 0 4 7 8 14 15 29 28 49 49 72 4 5 7 8 7 9-1 1-21 5-29 6-13 1-31 1-43-1z"],["yellow","M663 1201c-7-4-9-12-7-24 1-7 1-8 0-10-3-4-7-4-15-1-18 7-40 10-48 7-5-2-8-6-8-11 0-7 8-16 29-30l10-7 19 0c22-1 52-4 78-7 18-3 57-9 65-11 6-2 11-1 14 1 2 3 4 7 5 20 4 39-13 70-39 68-9-1-16-5-29-17-14-12-14-12-27 1-11 11-20 18-28 21-7 3-15 3-19 0z"]],U={width:940,height:1192},K=1.4,R=52,Z=72,f1=500,V1=250,F=22,Y=22,i1=Y+2,l1=16,u1=12,X1=56,A1=17,E=9,S1=18,q=1/120,h1=1500,e1=430,C=48,J1=e1*e1/(2*h1),H1=Math.max(2.2*R,R+J1+4),B1=200,_1=B1*h1/(2*e1),Q=.84*R*U.width/U.height/2,d1=.84*R/2;function G1(r,a,m){let e=0;for(;r>=1e3&&e<a.length-1;e++)r/=1e3;return(e?r.toFixed(m):r.toFixed(m>1?1:0))+" "+a[e]}function G(r){return G1(r,["MB","GB","TB","PB"],2)}function I1(r){return r<6?[100,150,200,300,450,650][r]:[1,1.5,2.5,4,6][(r-6)%5]*Math.pow(10,3+Math.floor((r-6)/5))}function q1(r){const a=I1(r);return a<1e3?a+" Mbps":G1(a,["Mbps","Gbps","Tbps","Pbps"],1).replace(".0 "," ")}function D1(r){const a=Math.pow(.9,r);return{speed:_1-(_1-110)*a,gap:H1+(205-H1)*a,space:B1+70*a,swing:r<6?0:34*(1-Math.pow(.8,r-5)),drift:r>=6}}function Q1(r){return(Math.floor(r*1e3/f1)+3)%4}function Y1(r,a,m={}){const e=Z*U.width/U.height,l=Math.max(X1,m.board??0),I=Math.floor(r-2*(u1+l1)-l-i1-YLine truncated
|
||||
import{j as N,r as B}from"./vendor-react-Bf71BWbF.js";import{u as W1,f as j1,aM as K1}from"./index-BNBwb-FJ.js";function N1({label:r,className:a,isDisabled:m,ref:e,canvasRef:l}){return N.jsx("button",{ref:e,type:"button",className:a,"aria-label":r,disabled:m,children:N.jsx("canvas",{ref:l})})}const U1=[["ink","M657 1228c-12-4-23-14-28-26-1-4-2-4-4-4-22 4-36 3-49-3-11-6-18-16-20-27-2-11 3-23 12-34 3-3 6-6 6-6 0 0-7-1-15-1-34-2-70-7-100-14-49-12-98-36-134-67l-5-4-12 4c-20 7-36 9-60 9-21 0-43-4-57-10-13-5-25-16-30-25-5-10-4-23 3-34 4-6 16-18 24-22l6-4-3-8c-2-5-2-9-2-12 1-6 5-15 9-18 4-5 16-13 21-14 3-1 5-2 6-2 0-1-1-6-3-12-21-73-6-145 45-212l7-10-12-2c-15-1-23-3-34-7-24-9-40-29-40-49 0-19 7-34 36-72 15-21 27-39 35-54 11-19 10-17 5-28-2-4-5-11-6-14-2-8-3-32-1-43 4-28 18-59 42-90l3-5-6-4c-11-9-20-21-23-32-2-6-2-9-2-17 1-9 1-10 4-18 6-11 15-20 29-27 14-7 24-10 47-15 1 0 3-3 7-11 19-37 51-71 88-94 12-8 32-18 44-22 10-3 29-8 33-8 1 0 5-2 8-5 11-8 25-14 39-16 12-2 49-1 63 2 21 4 34 9 45 19 8 7 10 9 15 18 4 7 4 7 13 12 34 18 63 46 86 81 10 16 20 38 26 57 4 12 8 34 10 48 2 13 2 43 0 56l-1 10 6 7c8 8 14 19 18 28 3 9 4 24 2 33-3 14-14 27-29 35-9 5-19 7-31 8l-9 1 0 8c0 4 0 15 0 25 0 16-1 31-5 47l0 3 14 0c27 0 58 5 83 14 21 9 51 25 68 39 3 2 6 5 7 5 0 1 6-2 14-6 27-14 49-17 69-11 26 8 38 34 27 64-2 5-3 9-3 10 0 0 4 1 8 3 14 7 24 19 29 34 8 22 0 45-24 73l-5 6 3 9c6 26 8 63 5 89-2 14-7 33-12 48-9 22-26 52-43 72-10 13-34 36-47 46-28 22-59 39-93 52-16 7-44 16-47 16-1 0-1 1-1 3 9 31 7 61-3 81-8 16-19 27-33 34-9 4-14 5-25 5-15 0-28-4-39-13l-6-5-7 6c-9 7-18 13-26 16-9 3-27 4-35 1z"],["paper","M582 1098c-44-2-79-6-117-16-55-14-102-41-141-81-42-43-67-93-75-148-2-14-1-43 1-56 6-30 16-57 32-82 8-12 24-33 32-42 6-7 7-7 17-10 58-18 110-56 126-92 2-5 2-9 3-16 1-14-2-21-15-33-13-14-21-24-33-39-18-26-28-35-45-43-11-5-21-7-33-7-13 0-23 2-33 7-6 3-9 3-9 3-4-6-4-28-2-42 5-23 18-49 37-73 14-18 37-39 56-53 5-4 6-4 11-4 41 1 105 13 154 28 32 9 72 25 104 42 18 9 51 27 66 37 8 5 8 5 11 13 7 16 13 37 16 56 2 11 2 41 1 54-4 39-19 74-44 104-8 9-10 14-9 20 1 5 7 10 13 12 7 2 14-1 24-11 10-11 22-29 32-48 3-5 4-7 6-7 2-1 14-1 27-1 22 0 24 0 37 2 34 8 68 24 98 48 13 11 15 12 20 12 5 0 7-1 16-7 22-14 41-21 53-18 13 3 16 15 7 32-2 5-6 11-8 15-4 8-4 14 0 19 4 5 7 6 17 7 15 1 23 5 27 14 3 6 3 15 0 22-2 6-10 18-20 30-9 11-11 15-8 24 3 10 6 33 7 52 0 26-2 47-10 70-18 53-57 101-111 135-40 25-87 43-144 54-66 14-132 19-194 17z"],["ink","M517 445c-7-2-13-6-18-12-7-7-9-14-9-25 0-7 0-8 3-15 7-13 17-21 31-22 23-1 43 18 41 40-2 19-17 33-36 35-4 0-9-1-12-1z"],["yellow","M541 220c-13-3-27-7-41-9-6-1-14-3-17-3l-5-1 2-6c3-15 13-40 23-59 20-39 43-66 64-73 11-3 56-1 74 4 7 1 13 4 17 7 3 3 3 4-1 4-5 0-17 4-24 7-35 18-62 59-79 118-2 8-4 14-4 14 0 0-4-1-9-3z"],["yellow","M446 203c-4-1-19-1-35-2-16 0-29 0-29-1 0-1 6-12 12-20 22-34 53-62 87-78 10-5 32-13 33-12 0 0-2 3-6 8-19 27-38 69-47 102-1 4-1 4-5 4-3 0-7-1-10-1z"],["yellow","M569 226c13-58 39-102 70-119 14-7 21-6 40 1 53 23 96 73 113 132 9 29 11 67 7 95-71-43-149-81-230-109z"],["yellow","M780 426c-1-2-5-19-5-19 0-1 3 0 8 0 6 0 8 0 10-2 5-4 3-6-21-21-50-32-74-46-109-63-71-36-143-57-225-67-48-6-99-5-107 1-4 3-5 5-2 7 1 2 3 2 10 3l8 0-4 4c-3 3-9 8-13 12l-9 8-4-2c-6-4-13-11-16-17-3-5-4-12-3-17 2-8 11-17 22-22 22-10 60-14 101-12 63 3 121 16 167 36 71 31 145 67 214 105 17 10 27 31 23 45-1 5-6 12-10 15-6 4-15 6-25 7-8 0-10 0-10-1z"],["yellow","M251 640c-19-4-32-16-32-29 0-10 5-19 23-43 26-34 37-50 50-75 6-12 9-17 13-20 12-11 29-13 45-7 11 5 17 10 37 36 9 13 19 25 24 30 5 5 10 10 12 13 2 3 2 5 2 10 0 5-1 8-4 12-17 29-73 61-123 71-14 3-38 4-47 2z"],["yellow","M226 1028c-12-1-24-5-31-10-12-8-13-16-2-27 5-5 19-13 30-17 7-3 11-6 11-8 0-3-1-5-8-9-7-6-10-10-10-14 0-4 1-5 4-8 2-2 6-4 9-5 3-1 5-2 5-2 1 0 4 7 8 14 15 29 28 49 49 72 4 5 7 8 7 9-1 1-21 5-29 6-13 1-31 1-43-1z"],["yellow","M663 1201c-7-4-9-12-7-24 1-7 1-8 0-10-3-4-7-4-15-1-18 7-40 10-48 7-5-2-8-6-8-11 0-7 8-16 29-30l10-7 19 0c22-1 52-4 78-7 18-3 57-9 65-11 6-2 11-1 14 1 2 3 4 7 5 20 4 39-13 70-39 68-9-1-16-5-29-17-14-12-14-12-27 1-11 11-20 18-28 21-7 3-15 3-19 0z"]],U={width:940,height:1192},K=1.4,R=52,Z=72,f1=500,V1=250,F=22,Y=22,i1=Y+2,l1=16,u1=12,X1=56,A1=17,E=9,S1=18,J=1/120,h1=1500,e1=430,C=48,q1=e1*e1/(2*h1),H1=Math.max(2.2*R,R+q1+4),B1=200,_1=B1*h1/(2*e1),Q=.84*R*U.width/U.height/2,d1=.84*R/2;function G1(r,a,m){let e=0;for(;r>=1e3&&e<a.length-1;e++)r/=1e3;return(e?r.toFixed(m):r.toFixed(m>1?1:0))+" "+a[e]}function G(r){return G1(r,["MB","GB","TB","PB"],2)}function I1(r){return r<6?[100,150,200,300,450,650][r]:[1,1.5,2.5,4,6][(r-6)%5]*Math.pow(10,3+Math.floor((r-6)/5))}function J1(r){const a=I1(r);return a<1e3?a+" Mbps":G1(a,["Mbps","Gbps","Tbps","Pbps"],1).replace(".0 "," ")}function D1(r){const a=Math.pow(.9,r);return{speed:_1-(_1-110)*a,gap:H1+(205-H1)*a,space:B1+70*a,swing:r<6?0:34*(1-Math.pow(.8,r-5)),drift:r>=6}}function Q1(r){return(Math.floor(r*1e3/f1)+3)%4}function Y1(r,a,m={}){const e=Z*U.width/U.height,l=Math.max(X1,m.board??0),I=Math.floor(r-2*(u1+l1)-l-i1-YLine truncated
|
||||
@@ -1,3 +1,3 @@
|
||||
import{j as a,r as b}from"./vendor-react-Bf71BWbF.js";import{aM as B,u as L,a2 as O,a as R,aB as P,dF as T,B as W,dG as q,bw as k,dH as C,aG as H,a0 as N,a1 as G,aq as I,a5 as J,ay as _,bq as V,dI as K,cQ as Q,dJ as U,aE as F,aC as E,aD as z,b2 as X,T as Y,cw as Z,aF as ee,E as te}from"./index-CXHBmSa5.js";import{F as se}from"./FactStrip-BgQ_tYB6.js";import{u as ae,h as re,C as oe,t as ne}from"./layout-BRLew_nj.js";import{D as le}from"./Table-D0NFHHNQ.js";import{A as ie}from"./ActionGroup-90AzAQje.js";import{d as ce,e as ge}from"./files-BxEOxSF8.js";import{r as ue}from"./recorder-DlDpPhd4.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";function de({label:e,rows:s,columns:r}){const n=B(),{ref:t,tip:m,show:l,hide:p}=ae();return a.jsxs("div",{className:"rp-heatmap rp-chart-hover",ref:t,onPointerLeave:p,role:"group","aria-label":e,"aria-describedby":n,style:{"--cols":r.length},children:[s.map(o=>{const c=Math.max(...o.counts);return a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"head",children:o.label}),a.jsx("div",{className:"cells",children:o.counts.map((v,x)=>a.jsx("span",{className:"cell t"+re(v,c),style:{"--tone":o.color},onPointerMove:u=>l(u,[o.titles[x]]),role:"img","aria-label":o.titles[x]},x))})]},o.id)}),r.length>0&&a.jsxs("div",{className:"row times","aria-hidden":"true",children:[a.jsx("div",{className:"head"}),a.jsxs("div",{className:"ends",children:[a.jsx("span",{children:r[0]}),r.length>2&&a.jsx("span",{children:r[Math.floor(r.length/2)]}),r.length>1&&a.jsx("span",{children:r[r.length-1]})]})]}),a.jsx(oe,{tip:m})]})}const S=new WeakMap;function $(e){let s=S.get(e);return s===void 0&&S.set(e,s=Date.parse(e.ts)),s}const M=["error","warn","info","debug","trace"];function pe(e,s,r,n=24){const t=r?M.indexOf(r):M.length-1,m=M.filter((g,f)=>s.includes(g)&&f<=t),l=e.map($).filter(Number.isFinite);if(!l.length)return{rows:m.map(g=>({level:g,counts:[]})),buckets:[],width:0,busiest:null};const p=Math.min(...l),o=Math.max(...l),c=ne(p,o,n),v=c.length>1?c[1]-c[0]:Math.max(o-p,6e4),x=new Map(m.map(g=>[g,new Array(c.length).fill(0)])),u=new Array(c.length).fill(0),j=new Array(c.length).fill(0);for(const g of e){const f=$(g),y=x.get(g.level);if(!y||!Number.isFinite(f))continue;const w=Math.min(c.length-1,Math.floor((f-c[0])/v));y[w]++,u[w]++,g.level==="error"&&j[w]++}const i=g=>g.reduce((f,y,w)=>y>g[f]?w:f,0),h=j.reduce((g,f)=>g+f,0),d=i(h?j:u);return{rows:m.map(g=>({level:g,counts:x.get(g)})),buckets:c,width:v,busiest:{start:c[d],count:h?j[d]:u[d],errors:h}}}function me({records:e,offered:s,minimum:r,setMinimum:n}){const t=L(),m=O[R()],l=P(),p=b.useMemo(()=>pe(e,s,r),[e,s,r]),o=b.useMemo(()=>new Intl.DateTimeFormat(m,{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),[m]),c=b.useCallback(i=>`${o.format(i)}–${o.format(i+p.width)}`,[o,p.width]),v=b.useMemo(()=>{const i=Object.keys(T).map(h=>{const d=t(T[h]);return[h,{text:d,label:a.jsxs(W,{quiet:!0,small:!0,className:h===r?"current":void 0,label:t(h===r?"log.chart.current":"log.chart.minimum",{level:d}),onPress:()=>n(h),children:[h===r&&a.jsx(q,{}),d]})}]});return new Map(i)},[r,n,t]),x=b.useMemo(()=>{const i={error:l.negative,warn:l.notice,info:l.info,debug:l.subtle,trace:l.muted},h=p.buckets.map(c);return{columns:p.buckets.map(d=>o.format(d)),rows:p.rows.map(d=>{const{text:g,label:f}=v.get(d.level);return{id:d.level,color:i[d.level],label:f,counts:d.counts,titles:d.counts.map((y,w)=>t("log.chart.cell",{time:h[w],level:g,n:y}))}})}},[p,c,o,v,l,t]);if(!e.length)return null;const u=p.busiest,j=u?u.errors?[{label:t("log.chart.errors"),value:t("log.chart.count",{n:u.errors}),icon:a.jsx(k,{}),tone:"negative"},{label:t("log.chart.peakErrors"),icon:a.jsx(C,{}),tint:"c1",value:c(u.start),caption:t("log.chart.count",{n:u.count})}]:[{label:t("log.chart.errors"),value:t("log.chart.count",{n:0}),icon:a.jsx(k,{}),tint:"c5"},{label:t("log.chart.peak"),icon:a.jsx(C,{}),tint:"c1",value:c(u.start),caption:t("log.chart.count",{n:u.count})}]:[];return a.jsxs("div",{className:"rp-chart-page",children:[a.jsx(se,{facts:j}),a.jsx(H,{title:t("log.chart.title"),note:t("log.chart.sample",{n:e.length}),children:a.jsx(de,{label:t("log.chart.title"),columns:x.columns,rows:x.rows})})]})}const D=["trace","debug","info","warn","error"],he={trace:"muted",debug:"neutral",info:"info",warn:"warn",error:"err"},A=new WeakMap;function fe(e,s,r){const n=A.get(e);if(n&&n.locale===s)return n.row;const t={id:e.id,timestamp:I(e.ts,s),iso:e.ts,levelText:N(T,e.level,r),tone:he[e.level],target:e.target,gap:!1,message:e.message+(e.fields?" "+Object.entries(e.fields).map(([m,l])=>`${m}=${typeof l=="string"?l:JSON.stringify(l)}`).join(" "):"")};return A.set(e,{locale:s,row:t}),t}function xe(e,s,r,n,t,m=new Set,l){const p=o=>!!l&&D.indexOf(o)<D.indexOf(l);return{rows:e.flatMap(o=>{const c=fe(o,n,t);return m.has(o)?[{...c,id:`gap ${o.id}`,timestamp:"",iso:"",levelText:"",target:"",gap:!0,message:t("log.gap")},c]:[c]}),levelsLine truncated
|
||||
import{j as a,r as b}from"./vendor-react-Bf71BWbF.js";import{aP as P,u as M,a5 as D,a as R,aE as B,dO as T,B as W,dP as H,bA as k,dQ as C,aJ as I,a3 as N,a4 as _,at as q,a8 as G,aB as J,bu as V,dR as K,c_ as Q,dS as U,aH as S,aF as E,aG as z,b5 as X,T as Y,cA as Z,aI as ee,E as te}from"./index-BNBwb-FJ.js";import{F as se}from"./FactStrip-n2q1T87k.js";import{u as ae,h as re,C as oe,t as ne}from"./layout-wfdMYi2n.js";import{D as le}from"./Table-DyWJelc_.js";import{A as ie}from"./ActionGroup-BKxDwmnT.js";import{d as ce,e as ge}from"./files-BxEOxSF8.js";import{r as ue}from"./recorder-DlDpPhd4.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";function de({label:e,rows:s,columns:r}){const n=P(),{ref:t,tip:m,show:l,hide:p}=ae();return a.jsxs("div",{className:"rp-heatmap rp-chart-hover",ref:t,onPointerLeave:p,role:"group","aria-label":e,"aria-describedby":n,style:{"--cols":r.length},children:[s.map(o=>{const c=Math.max(...o.counts);return a.jsxs("div",{className:"row",children:[a.jsx("div",{className:"head",children:o.label}),a.jsx("div",{className:"cells",children:o.counts.map((v,x)=>a.jsx("span",{className:"cell t"+re(v,c),style:{"--tone":o.color},onPointerMove:u=>l(u,[o.titles[x]]),role:"img","aria-label":o.titles[x]},x))})]},o.id)}),r.length>0&&a.jsxs("div",{className:"row times","aria-hidden":"true",children:[a.jsx("div",{className:"head"}),a.jsxs("div",{className:"ends",children:[a.jsx("span",{children:r[0]}),r.length>2&&a.jsx("span",{children:r[Math.floor(r.length/2)]}),r.length>1&&a.jsx("span",{children:r[r.length-1]})]})]}),a.jsx(oe,{tip:m})]})}const F=new WeakMap;function $(e){let s=F.get(e);return s===void 0&&F.set(e,s=Date.parse(e.ts)),s}const L=["error","warn","info","debug","trace"];function pe(e,s,r,n=24){const t=r?L.indexOf(r):L.length-1,m=L.filter((g,f)=>s.includes(g)&&f<=t),l=e.map($).filter(Number.isFinite);if(!l.length)return{rows:m.map(g=>({level:g,counts:[]})),buckets:[],width:0,busiest:null};const p=Math.min(...l),o=Math.max(...l),c=ne(p,o,n),v=c.length>1?c[1]-c[0]:Math.max(o-p,6e4),x=new Map(m.map(g=>[g,new Array(c.length).fill(0)])),u=new Array(c.length).fill(0),j=new Array(c.length).fill(0);for(const g of e){const f=$(g),y=x.get(g.level);if(!y||!Number.isFinite(f))continue;const w=Math.min(c.length-1,Math.floor((f-c[0])/v));y[w]++,u[w]++,g.level==="error"&&j[w]++}const i=g=>g.reduce((f,y,w)=>y>g[f]?w:f,0),h=j.reduce((g,f)=>g+f,0),d=i(h?j:u);return{rows:m.map(g=>({level:g,counts:x.get(g)})),buckets:c,width:v,busiest:{start:c[d],count:h?j[d]:u[d],errors:h}}}function me({records:e,offered:s,minimum:r,setMinimum:n}){const t=M(),m=D[R()],l=B(),p=b.useMemo(()=>pe(e,s,r),[e,s,r]),o=b.useMemo(()=>new Intl.DateTimeFormat(m,{hour:"2-digit",minute:"2-digit",hourCycle:"h23"}),[m]),c=b.useCallback(i=>`${o.format(i)}–${o.format(i+p.width)}`,[o,p.width]),v=b.useMemo(()=>{const i=Object.keys(T).map(h=>{const d=t(T[h]);return[h,{text:d,label:a.jsxs(W,{quiet:!0,small:!0,className:h===r?"current":void 0,label:t(h===r?"log.chart.current":"log.chart.minimum",{level:d}),onPress:()=>n(h),children:[h===r&&a.jsx(H,{}),d]})}]});return new Map(i)},[r,n,t]),x=b.useMemo(()=>{const i={error:l.negative,warn:l.notice,info:l.info,debug:l.subtle,trace:l.muted},h=p.buckets.map(c);return{columns:p.buckets.map(d=>o.format(d)),rows:p.rows.map(d=>{const{text:g,label:f}=v.get(d.level);return{id:d.level,color:i[d.level],label:f,counts:d.counts,titles:d.counts.map((y,w)=>t("log.chart.cell",{time:h[w],level:g,n:y}))}})}},[p,c,o,v,l,t]);if(!e.length)return null;const u=p.busiest,j=u?u.errors?[{label:t("log.chart.errors"),value:t("log.chart.count",{n:u.errors}),icon:a.jsx(k,{}),tone:"negative"},{label:t("log.chart.peakErrors"),icon:a.jsx(C,{}),tint:"c1",value:c(u.start),caption:t("log.chart.count",{n:u.count})}]:[{label:t("log.chart.errors"),value:t("log.chart.count",{n:0}),icon:a.jsx(k,{}),tint:"c5"},{label:t("log.chart.peak"),icon:a.jsx(C,{}),tint:"c1",value:c(u.start),caption:t("log.chart.count",{n:u.count})}]:[];return a.jsxs("div",{className:"rp-chart-page",children:[a.jsx(se,{facts:j}),a.jsx(I,{title:t("log.chart.title"),note:t("log.chart.sample",{n:e.length}),children:a.jsx(de,{label:t("log.chart.title"),columns:x.columns,rows:x.rows})})]})}const A=["trace","debug","info","warn","error"],he={trace:"muted",debug:"neutral",info:"info",warn:"warn",error:"err"},O=new WeakMap;function fe(e,s,r){const n=O.get(e);if(n&&n.locale===s)return n.row;const t={id:e.id,timestamp:q(e.ts,s),iso:e.ts,levelText:N(T,e.level,r),tone:he[e.level],target:e.target,gap:!1,message:e.message+(e.fields?" "+Object.entries(e.fields).map(([m,l])=>`${m}=${typeof l=="string"?l:JSON.stringify(l)}`).join(" "):"")};return O.set(e,{locale:s,row:t}),t}function xe(e,s,r,n,t,m=new Set,l){const p=o=>!!l&&A.indexOf(o)<A.indexOf(l);return{rows:e.flatMap(o=>{const c=fe(o,n,t);return m.has(o)?[{...c,id:`gap ${o.id}`,timestamp:"",iso:"",levelText:"",target:"",gap:!0,message:t("log.gap")},c]:[c]}),levelsLine truncated
|
||||
`)+`
|
||||
`}const ye=[];function Te(){const e=L(),s=O[R()],r=J(),n=_(),[t,m]=b.useState("info"),l=b.useCallback(f=>m(f),[]),[p,o]=b.useState(""),[c,v]=b.useState(!1),x=V(p.trim()),u=r.data?.resources.logs,j=je(t,u?.levels),i=K({level:j,target:x,paused:c}),h=Q(r.data?.resources.runtime_settings.available??!1).data,d=h?.log.level,g=b.useMemo(()=>xe(i.records,u?.levels??[],n.data?.engine.name,s,e,i.gaps,d),[i.records,i.gaps,u,n.data,s,e,d]);return{...g,empty:be(h?.recording?.logs,!!x,e),status:ve(i.connected,!!i.error,c,i.pending,U,s,e),records:i.records,offered:u?.levels??ye,level:j??"",setLevel:l,target:p,setTarget:o,paused:c,setPaused:v,error:r.error??i.error,loading:!r.error&&!i.error&&!i.connected&&!i.records.length,clear:i.clear,retry:r.error?r.refetch:i.retry,export:()=>ce(ge(g.exportBase,"txt"),we(i.records,i.gaps,e),"text/plain;charset=utf-8")}}function Oe(){const e=L(),s=Te(),r=b.useMemo(()=>[{id:"ts",label:e("ui.time"),minWidth:200,grow:0,drop:2,render:t=>!t.gap&&a.jsx(F,{className:"rp-code",text:t.iso,children:t.timestamp})},{id:"level",label:e("log.level"),minWidth:90,grow:0,drop:3,render:t=>!t.gap&&a.jsx(E,{small:!0,tone:t.tone,children:t.levelText})},{id:"target",label:e("log.target"),minWidth:160,grow:0,drop:1,render:t=>a.jsx("span",{className:"rp-code",children:t.target})},{id:"message",label:e("log.message"),minWidth:280,grow:3,isRowHeader:!0,render:t=>a.jsx(F,{children:t.message})}],[e]),n=b.useCallback(t=>a.jsx(z,{inline:!0,items:t.gap?[[e("log.message"),t.message]]:[[e("ui.time"),t.timestamp],[e("log.level"),t.levelText],[e("log.target"),t.target],[e("log.message"),t.message]]}),[e]);return a.jsxs("div",{className:"rp-page",children:[a.jsxs("div",{className:"rp-toolbar",children:[a.jsx(X,{side:!0,label:e("log.level"),value:s.level,onChange:s.setLevel,items:s.levels}),a.jsx(Y,{search:!0,label:e("log.target"),value:s.target,width:240,placeholder:e("log.targetPlaceholder"),onChange:s.setTarget}),a.jsx(Z,{isSelected:s.paused,onChange:s.setPaused,children:e("log.pause")}),a.jsx(E,{small:!0,tone:s.status.tone,children:s.status.text}),s.recordedText&&a.jsx("span",{className:"rp-label",children:s.recordedText}),a.jsx("span",{className:"rp-grow"}),a.jsx(ie,{actions:[{id:"clear",label:e("log.clear"),isDisabled:!s.rows.length,onAction:s.clear},{id:"export",label:e("log.export"),icon:a.jsx(ee,{}),isDisabled:!s.rows.length,onAction:s.export}]})]}),a.jsx(te,{error:s.error,onRetry:s.retry}),a.jsx(me,{records:s.records,offered:s.offered,minimum:s.level,setMinimum:s.setLevel}),a.jsx(le,{label:e("nav.logs"),stream:!0,rows:s.rows,height:640,loading:s.loading,empty:s.empty,cols:r,detail:n})]})}export{Oe as Logs};
|
||||
`}const ye=[];function Te(){const e=M(),s=D[R()],r=G(),n=J(),[t,m]=b.useState("info"),l=b.useCallback(f=>m(f),[]),[p,o]=b.useState(""),[c,v]=b.useState(!1),x=V(p.trim()),u=r.data?.resources.logs,j=je(t,u?.levels),i=K({level:j,target:x,paused:c}),h=Q(r.data?.resources.runtime_settings.available??!1).data,d=h?.log.level,g=b.useMemo(()=>xe(i.records,u?.levels??[],n.data?.engine.name,s,e,i.gaps,d),[i.records,i.gaps,u,n.data,s,e,d]);return{...g,empty:be(h?.recording?.logs,!!x,e),status:ve(i.connected,!!i.error,c,i.pending,U,s,e),records:i.records,offered:u?.levels??ye,level:j??"",setLevel:l,target:p,setTarget:o,paused:c,setPaused:v,error:r.error??i.error,loading:!r.error&&!i.error&&!i.connected&&!i.records.length,clear:i.clear,retry:r.error?r.refetch:i.retry,export:()=>ce(ge(g.exportBase,"txt"),we(i.records,i.gaps,e),"text/plain;charset=utf-8")}}function De(){const e=M(),s=Te(),r=b.useMemo(()=>[{id:"ts",label:e("ui.time"),minWidth:200,grow:0,drop:2,render:t=>!t.gap&&a.jsx(S,{className:"rp-code",text:t.iso,children:t.timestamp})},{id:"level",label:e("log.level"),minWidth:90,grow:0,drop:3,render:t=>!t.gap&&a.jsx(E,{small:!0,tone:t.tone,children:t.levelText})},{id:"target",label:e("log.target"),minWidth:160,grow:0,drop:1,render:t=>a.jsx("span",{className:"rp-code",children:t.target})},{id:"message",label:e("log.message"),minWidth:280,grow:3,isRowHeader:!0,render:t=>a.jsx(S,{children:t.message})}],[e]),n=b.useCallback(t=>a.jsx(z,{inline:!0,items:t.gap?[[e("log.message"),t.message]]:[[e("ui.time"),t.timestamp],[e("log.level"),t.levelText],[e("log.target"),t.target],[e("log.message"),t.message]]}),[e]);return a.jsxs("div",{className:"rp-page",children:[a.jsxs("div",{className:"rp-toolbar",children:[a.jsx(X,{side:!0,label:e("log.level"),value:s.level,onChange:s.setLevel,items:s.levels}),a.jsx(Y,{search:!0,label:e("log.target"),value:s.target,width:240,placeholder:e("log.targetPlaceholder"),onChange:s.setTarget}),a.jsx(Z,{isSelected:s.paused,onChange:s.setPaused,children:e("log.pause")}),a.jsx(E,{small:!0,tone:s.status.tone,children:s.status.text}),s.recordedText&&a.jsx("span",{className:"rp-label",children:s.recordedText}),a.jsx("span",{className:"rp-grow"}),a.jsx(ie,{actions:[{id:"clear",label:e("log.clear"),isDisabled:!s.rows.length,onAction:s.clear},{id:"export",label:e("log.export"),icon:a.jsx(ee,{}),isDisabled:!s.rows.length,onAction:s.export}]})]}),a.jsx(te,{error:s.error,onRetry:s.retry}),a.jsx(me,{records:s.records,offered:s.offered,minimum:s.level,setMinimum:s.setLevel}),a.jsx(le,{label:e("nav.logs"),stream:!0,rows:s.rows,height:640,loading:s.loading,empty:s.empty,cols:r,detail:n})]})}export{De as Logs};
|
||||
@@ -1 +1 @@
|
||||
import{j as e}from"./vendor-react-Bf71BWbF.js";import{u as s,ad as a,T as c}from"./index-CXHBmSa5.js";import{d as i}from"./Virtualizer--Vfl8O3n.js";import{$ as b}from"./useFilter-DZ8TXqn_.js";import{$ as f}from"./ListLayout-CPapuywx.js";function x({children:t}){const o=s(),{contains:r}=b({sensitivity:"base"});return e.jsxs(a,{filter:r,children:[e.jsx(c,{search:!0,label:o("policy.filter"),autoFocus:!0,className:"rp-menu-search"}),e.jsx(i,{layout:f,layoutOptions:{rowHeight:32,headingHeight:26},children:t})]})}export{x as NodeSearch};
|
||||
import{j as e}from"./vendor-react-Bf71BWbF.js";import{u as s,ag as a,T as c}from"./index-BNBwb-FJ.js";import{d as i}from"./Virtualizer-DipGMcji.js";import{$ as b}from"./useFilter-jz02VVEB.js";import{$ as f}from"./ListLayout-F74Z1Dpf.js";function x({children:t}){const o=s(),{contains:r}=b({sensitivity:"base"});return e.jsxs(a,{filter:r,children:[e.jsx(c,{search:!0,label:o("policy.filter"),autoFocus:!0,className:"rp-menu-search"}),e.jsx(i,{layout:f,layoutOptions:{rowHeight:32,headingHeight:26},children:t})]})}export{x as NodeSearch};
|
||||
@@ -1,5 +0,0 @@
|
||||
import{r as j,j as t}from"./vendor-react-Bf71BWbF.js";import{u as V,aM as Ye,B as F,cx as ve,aP as q,a5 as _e,a8 as Se,a7 as ee,a9 as Ke,a as ie,aB as Xe,E as Te,j as Ze,af as en,aT as H,bt as Ce,bu as nn,bw as sn,aG as an,cr as Le,b1 as tn,$ as De,aE as ne,aH as on,bj as Re,aC as rn,bz as ln,ae as $e,T as Q,b2 as me,y as Ge,N as dn,q as se,Q as cn,P as ke,C as un,d1 as Ae,d2 as mn,d3 as Fe,as as pn,aY as bn,am as vn,an as hn,a0 as Ne,aq as fn,ap as ce,a1 as ae,b3 as gn,cs as xn,a2 as he,bb as C,cB as pe,cO as fe,b as ge,cN as jn,bc as yn,J as We,d4 as kn,cH as Nn,d5 as we,cA as wn,aa as Pn,d6 as Mn,d7 as _n,cy as Sn,d8 as Tn,be as Cn,bf as Ln,d9 as Dn,cC as Rn,bn as $n,ac as Gn,I as An,cw as Fn,cW as Wn}from"./index-CXHBmSa5.js";import{F as Bn}from"./FactStrip-BgQ_tYB6.js";import{u as In,C as En,p as On}from"./layout-BRLew_nj.js";import{D as Be,c as Hn}from"./Table-D0NFHHNQ.js";import{T as qn}from"./TimeCell-gSIuLEFc.js";import{A as Vn}from"./AddCircle-Db3HxlxQ.js";import{u as zn}from"./outbounds-f8QoVoCV.js";import{p as Un,b as Qn}from"./policyText-CAFy3qpo.js";import{a as Ie}from"./setup-B5f1cfyO.js";import{$ as Jn}from"./useFilter-DZ8TXqn_.js";import{p as Yn}from"./probe-C8ejAKwA.js";import{P as Kn}from"./PolicyPicker-DSSmYroN.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";function Pe({kind:e,color:s}){return t.jsx("i",{className:"rp-marker "+e,style:s?{color:s}:void 0,"aria-hidden":"true"})}function Xn({label:e,groups:s,legend:n,max:a,fmt:l,limit:o=10,showAll:c}){const r=V(),u=Ye(),{ref:d,tip:p,show:m,hide:h}=In(),[k,b]=j.useState(new Set),i=[0,a/4,a/2,3*a/4,a],v=g=>Math.min(100,g/a*100);return t.jsxs("div",{className:"rp-markerplot rp-chart-hover",ref:d,onPointerLeave:h,role:"group","aria-label":e,"aria-describedby":u,children:[t.jsx("ul",{className:"legend",children:n.map(g=>t.jsxs("li",{children:[t.jsx(Pe,{kind:g.kind}),g.label]},g.kind))}),t.jsxs("div",{className:"axis","aria-hidden":"true",children:[t.jsx("span",{}),t.jsx("div",{className:"scale",children:i.map(g=>t.jsx("span",{style:{insetInlineStart:`${v(g)}%`},children:l(g)},g))}),t.jsx("span",{})]}),s.map(g=>t.jsxs("section",{"aria-label":g.label,children:[s.length>1&&t.jsx("h4",{className:"rp-label",children:g.label}),(k.has(g.id)?g.rows:g.rows.slice(0,o)).map(x=>{const N=Object.values(x.values).filter(M=>M!==void 0),T=v(Math.min(...N)),D=v(Math.max(...N));return t.jsxs("div",{className:"row",onPointerMove:M=>m(M,[x.label,...x.details]),children:[t.jsx("span",{className:"name",children:x.label}),t.jsxs("div",{className:"track",role:"img","aria-label":x.label+r("ui.separator")+x.description,children:[i.map(M=>t.jsx("i",{className:"grid",style:{insetInlineStart:`${v(M)}%`}},M)),D>T&&t.jsx("i",{className:"span",style:{insetInlineStart:`${T}%`,width:`${D-T}%`}}),["tick","diamond","dot"].map(M=>x.values[M]===void 0?null:t.jsx("span",{className:"at "+M+(x.values[M]>a?" over":""),style:{insetInlineStart:`${v(x.values[M])}%`},children:t.jsx(Pe,{kind:M,color:M==="dot"?x.tone:void 0})},M))]}),t.jsx("span",{className:"value",children:x.text})]},x.id)}),!k.has(g.id)&&g.rows.length>o&&t.jsx("div",{className:"row more",children:t.jsx(F,{quiet:!0,small:!0,onPress:()=>b(x=>new Set([...x,g.id])),children:c(g.rows.length)})}),g.notes.map(x=>t.jsx("p",{className:"rp-note note",children:x},x))]},g.id)),t.jsx(En,{tip:p})]})}function Zn(e,s,n){const a=new Map((s??[]).map(r=>[r.id,r.name])),l=new Map,o=(r,u)=>{let d=l.get(r);return d||l.set(r,d={id:r,label:u,rows:[],missing:[]}),d};for(const r of e){const u=ve(r),d=n==="protocol"?[["protocol:"+(r.protocol??""),r.protocol??null]]:r.group_ids.length?r.group_ids.map(p=>["group:"+p,a.get(p)??p]):[["group:",null]];for(const[p,m]of d){const h=o(p,m);u?.state==="healthy"&&u.latency_ms!==null?h.rows.push({id:r.id,name:r.name,latest:u.latency_ms,moving:u.moving_avg_ms,avg10:u.avg10_ms}):h.missing.push({id:r.id,name:r.name,state:u?.state==="unavailable"?"unavailable":"unmeasured"})}}const c=[...l.values()];for(const r of c)r.rows.sort((u,d)=>u.latest-d.latest||q(u.name,d.name)),r.missing.sort((u,d)=>q(u.name,d.name));return c.sort((r,u)=>(r.label===null?1:0)-(u.label===null?1:0)||q(r.label??"",u.label??""))}function es(e){const s=e.flatMap(n=>n.rows);return{moving:s.some(n=>n.moving!==null),avg10:s.some(n=>n.avg10!==null)}}function ns(e){const s=e.flatMap(l=>l.rows.flatMap(o=>[o.latest,o.moving??o.latest])).sort((l,o)=>l-o),n=Math.max(10,(On(s,90)??0)*1.25),a=n<=100?20:n<=500?100:n<=2e3?500:1e3;return Math.ceil(n/a)*a}function ss(){const e=_e().data?.resources,s=Se(ee(e,"nodes",{whileLoading:!0})),n=Ke(ee(e,"groups",{whileLoading:!1})),[a,l]=j.useState("group"),o=j.useMemo(()=>Zn(s.data??[],n.data,a),[s.data,n.data,a]);return{nodes:s,by:a,setBy:l,view:o}}const ue=6;function as(){const e=V(),s=ie(),n=Xe(),{nodes:a,by:l,setBy:o,view:c}=ss();if(a.error&&!a.data)return t.jsx(Te,{error:a.error,onRetry:a.refetch});if(!a.data)return t.jsx(Ze,{});if(!a.data.lengLine truncated
|
||||
`,c.from-1)+1,u=/^[ \t]*$/.test(e.slice(r,c.from))?r:c.from,d=l.children.find(i=>i.from===c.from);if(d){for(;n[o+1]?.from<d.to;)o++;if(d.line===d.endLine)continue;const i=dn(e,d,n),v=i.find(x=>x.name==="url"),g=i.find(x=>x.name==="interval");a.push({from:u,to:d.to,block:d,tag:d.name,host:v?re(se(v.value)):null,interval:g?is(se(g.value)):null,fields:i,parts:null});continue}const p=n[o+1];p&&e.slice(p.from,p.to)===":"&&!e.slice(p.to).startsWith("//")&&(o+=2);const m=n[o];if(!m||m.from>=l.close)break;if(m.kind!=="quoted")for(;n[o+1]?.from===n[o].to&&!/[(){}]/.test(e.slice(n[o+1].from,n[o+1].to));)o++;if(e[n[o+1]?.from]==="(")for(o++;n[o+1]&&!(e[n[o].from]===")"&&n[o].parens===1);)o++;let h=n[o].to,k;n[o+1]?.kind==="comment"&&n[o+1].line===n[o].line&&(k=e.slice(n[o+1].from,n[o+1].to),h=n[++o].to);const b=ls(e.slice(u,h));b&&a.push({from:u,to:h,tag:b.tag,host:re(b.url),interval:null,fields:[],parts:b,comment:k})}return a}function ds(e){return Oe(e).map(({tag:s,host:n,interval:a})=>({tag:s,host:n,interval:a}))}function cs(e,s,n){const a=Oe(e).find(u=>u.tag===s);if(!a||a.interval===n)return e;const l=e.slice(a.from,a.to).match(/^[ \t]*/)?.[0]??" ",o=l+(l.includes(" ")?" ":" ");if(a.parts){const u=[`${l}${cn(s)}: {`,`${o}url: ${ke(a.parts.url)}`];return a.parts.ua!==null&&u.push(`${o}ua: ${ke(a.parts.ua)}`),u.push(`${o}interval: '${n}s'`,`${l}}${a.comment?" "+a.comment:""}`),e.slice(0,a.from)+u.join(`
|
||||
`)+e.slice(a.to)}const c=a.fields.find(u=>u.name==="interval");if(c)return e.slice(0,c.valueFrom)+` '${n}s'`+e.slice(c.valueTo);if(!a.block)return e;const r=e.lastIndexOf(`
|
||||
`,a.block.close-1)+1;return e.slice(0,r)+`${o}interval: '${n}s'
|
||||
`+e.slice(r)}function us(e,s,n,a){const l=ve(e),o=l?.state==="healthy"&&l.latency_ms!=null;return{id:e.id,name:e.name,protocol:e.protocol??"—",latency:o?H(l.latency_ms,a):l?.state==="unavailable"?a("ui.unavailable"):"—",latencyClass:o?`ms ${Le(l.latency_ms)}`:l?.state==="unavailable"?"ms err":"ms",groups:e.group_ids.length?De(n,e.group_ids.map(c=>s.get(c)??c)):"—",probeLabel:a("nodes.probe",{name:e.name}),joinLabel:a("nodes.joinGroup",{name:e.name}),removeLabel:a("nodes.remove",{name:e.name})}}const ms=e=>gn(ve(e));function ps(e,s,n,a){const l=new Map;for(const i of s){if(!i.provider_id||!i.subscription_tag)continue;const v=l.get(i.provider_id)??new Set;v.add(i.subscription_tag),l.set(i.provider_id,v)}const o=i=>{const v=l.get(i);return v?.size===1?[...v][0]:void 0},c=i=>{const v=re(i.url_redacted),g=v?n.filter(x=>x.host===v):[];return g.length===1?g[0].tag:void 0},r=new Map,u=e.filter(i=>i.kind==="subscription");for(const i of u){const v=o(i.id)??c(i);v&&r.set(i.id,v)}const d=u.filter(i=>!r.has(i.id)),p=new Set(r.values()),m=n.filter(i=>!p.has(i.tag));d.length===1&&m.length===1&&r.set(d[0].id,m[0].tag);const h=e.map(i=>{const v=o(i.id);return{...i,displayName:r.get(i.id)??i.name,configTag:i.kind==="subscription"&&v&&n.filter(g=>g.tag===v).length===1?v:void 0}}),k={builtin:0,unattributed:0};for(const i of s)i.provider_id==null&&k[Ae(i)]++;const b=[];for(const i of["builtin","unattributed"]){const v=k[i];v&&b.push({id:mn(i,e),name:a(i==="builtin"?"nodes.kind.builtin":"nodes.kind.unattributed"),kind:i,url_redacted:null,node_count:v,updated_at:null,expires_at:null,traffic:null,status:"ok",last_error:null})}return{list:[...b,...h]}}function bs(e,s){return s!==null&&e.some(n=>n.id===s)?s:(e.find(n=>n.kind!=="builtin"&&n.kind!=="unattributed")??e[0])?.id??null}function vs(e,s,n){return e.filter(a=>s===void 0||(s===null?a.provider_id==null&&Ae(a)==="builtin"==(n==="builtin"):a.provider_id===s))}function hs(e,s,n,a,l,o){const c=s.trim(),r=e.filter(m=>(!c||o(m.name,c))&&(!n||m.group_ids.includes(n))&&(!a||m.protocol===a)),u=l.direction==="ascending"?1:-1,d=l.column==="latency"?new Map(r.map(m=>[m.id,ms(m)])):new Map,p={name:(m,h)=>q(m.name,h.name),protocol:(m,h)=>q(m.protocol??"",h.protocol??""),latency:(m,h)=>xn(d.get(m.id),d.get(h.id))||q(m.name,h.name)};return r.sort((m,h)=>u*(p[l.column]??p.name)(m,h))}const be=[3600,21600,43200,86400];function xe(e,s,n){return e===0?n("nodes.manualOnly"):be.includes(e)?n("nodes.everyHours",{n:e/3600}):pn(String(e),s)}function He(e,s,n){return[0,...be,...e===null||e===0||be.includes(e)?[]:[e]].map(a=>({id:String(a),label:xe(a,s,n)}))}function fs(e,s){const n={name:e.name.trim(),kind:"subscription",url:e.value.trim()},a=Number(e.interval);s?.update_interval!==void 0&&e.interval&&a!==s.update_interval&&(n.update_interval=a);const l=e.agent.trim();return s?.user_agent!==void 0&&l&&l!==s.user_agent&&(n.user_agent=l),s?.cache!==void 0&&e.cache!==null&&e.cache!==s.cache&&(n.cache=e.cache),n}function gs(e,s,n,a){const l={subscription:"nodes.kind.subscription",file:"nodes.kind.file",inline:"nodes.kind.inline",builtin:"nodes.kind.builtin",unattributed:"nodes.kind.unattributed"},o={ok:"nodes.status.ok",stale:"nodes.status.stale",error:"nodes.status.error"},c={ok:"ok",stale:"warn",error:"err"},r=e.kind==="builtin"||e.kind==="unattributed",u=e.traffic?bn(e.traffic.upload_bytes,e.traffic.download_bytes):null,d=e.kind==="subscription"?s:void 0,p=e.displayName??e.name;return{id:e.id,name:p,url:e.url_redacted??void 0,kind:Ne(l,e.kind,a),count:ae(e.node_count,n),usage:u===null?"—":e.traffic?.total_bytes?a("ui.fraction",{part:ce(u,n),whole:ce(e.traffic.total_bytes,n)}):ce(u,n),updatedAt:r?null:e.updated_at,expires:e.expires_at?fn(e.expires_at,n):"—",interval:d==null?"—":xe(d,n,a),intervalValue:d==null?"":String(d),hasInterval:d!==void 0,intervalLabel:a("nodes.intervalOf",{name:p}),intervals:d===void 0?[]:He(d,n,a),status:r?null:Ne(o,e.status,a),tone:c[e.status],error:e.last_error?vn(hn(e.last_error.code,e.last_error.message,a),a):void 0,refreshLabel:a("nodes.refresh",{name:p}),removeLabel:a("nodes.remove",{name:p})}}const qe=e=>/^[a-z][a-z0-9+.-]*:\/\/\S+$/i.test(e.trim());function xs(e,s,n,a){const l=s.trim();return e!=="provider"&&e!=="node"||!l&&!n.trim()?null:l?e==="node"?qe(n)?null:a("nodes.linkInvalid"):Fe(l)?Ie(n)?null:a("nodes.urlInvalid"):a("nodes.nameInvalid"):a("nodes.nameMissing")}function js(e){const s=V(),n=he[ie()],{refresh:a}=e,l=new Map(e.entries.map(c=>[c.tag,c.interval]));return{rows:e.rows.map(c=>({...gs(c,c.configTag?l.get(c.configTag):void 0,n,s),refreshable:c.kind==="subscription"&&e.canRefresh,refreshing:a.busy===c.id,refreshDisabled:!!a.busy,refresh:()=>void a.refresh(c.id).then(r=>{r&&("degraded"in r?C("info",s("nodes.refreshedDegraded",{name:c.name})):C("positive",s("nodes.refreshed",{name:c.name,n:ae(r.node_count,n)})))},r=>fe(r,s,s("nodes.refreshFailed",{name:c.name}))),removable:e.canManage&&(c.kind==="subscription"||c.kind==="file"),remove:()=>{(c.kind=
Line truncated
|
||||
@@ -0,0 +1,5 @@
|
||||
import{r as j,j as t}from"./vendor-react-Bf71BWbF.js";import{u as U,aP as Qe,B as G,cB as ve,aS as q,a8 as _e,ab as Se,aa as ee,ac as Xe,a as ie,aE as Ye,E as Te,j as Ze,ai as en,aW as H,bx as Ce,by as nn,bA as sn,aJ as an,cv as Le,b4 as tn,a2 as De,aH as ne,aK as on,bn as Re,aF as rn,bD as ln,ah as $e,T as K,b5 as me,y as Ae,O as dn,q as se,U as cn,R as ke,F as un,da as Fe,db as mn,dc as Ge,av as pn,a$ as bn,ap as vn,aq as hn,a3 as Ne,at as fn,as as ce,a4 as ae,b6 as gn,cw as xn,a5 as he,be as C,cF as pe,cV as fe,b as ge,cU as jn,bf as yn,K as We,dd as kn,cL as Nn,de as we,cE as wn,ad as Pn,df as Mn,dg as _n,cC as Sn,dh as Tn,bi as Cn,bj as Ln,di as Dn,cG as Rn,br as $n,af as An,I as Fn,cA as Gn,d2 as Wn}from"./index-BNBwb-FJ.js";import{F as En}from"./FactStrip-n2q1T87k.js";import{u as In,C as Bn,p as On}from"./layout-wfdMYi2n.js";import{D as Ee,c as Hn}from"./Table-DyWJelc_.js";import{T as qn}from"./TimeCell-DUt0i0gi.js";import{A as Un}from"./AddCircle-CIj8X2wL.js";import{u as Vn}from"./outbounds-DPmb26w8.js";import{p as zn,b as Kn}from"./policyText-CmeXgUK2.js";import{a as Ie}from"./setup-d2VGFWY1.js";import{$ as Jn}from"./useFilter-jz02VVEB.js";import{p as Qn}from"./probe-BZEn7bbG.js";import{P as Xn}from"./PolicyPicker-BmHzmXzJ.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";function Pe({kind:e,color:s}){return t.jsx("i",{className:"rp-marker "+e,style:s?{color:s}:void 0,"aria-hidden":"true"})}function Yn({label:e,groups:s,legend:n,max:a,fmt:l,limit:o=10,showAll:c}){const r=U(),u=Qe(),{ref:d,tip:p,show:m,hide:h}=In(),[k,b]=j.useState(new Set),i=[0,a/4,a/2,3*a/4,a],v=g=>Math.min(100,g/a*100);return t.jsxs("div",{className:"rp-markerplot rp-chart-hover",ref:d,onPointerLeave:h,role:"group","aria-label":e,"aria-describedby":u,children:[t.jsx("ul",{className:"legend",children:n.map(g=>t.jsxs("li",{children:[t.jsx(Pe,{kind:g.kind}),g.label]},g.kind))}),t.jsxs("div",{className:"axis","aria-hidden":"true",children:[t.jsx("span",{}),t.jsx("div",{className:"scale",children:i.map(g=>t.jsx("span",{style:{insetInlineStart:`${v(g)}%`},children:l(g)},g))}),t.jsx("span",{})]}),s.map(g=>t.jsxs("section",{"aria-label":g.label,children:[s.length>1&&t.jsx("h4",{className:"rp-label",children:g.label}),(k.has(g.id)?g.rows:g.rows.slice(0,o)).map(x=>{const N=Object.values(x.values).filter(M=>M!==void 0),T=v(Math.min(...N)),D=v(Math.max(...N));return t.jsxs("div",{className:"row",onPointerMove:M=>m(M,[x.label,...x.details]),children:[t.jsx("span",{className:"name",children:x.label}),t.jsxs("div",{className:"track",role:"img","aria-label":x.label+r("ui.separator")+x.description,children:[i.map(M=>t.jsx("i",{className:"grid",style:{insetInlineStart:`${v(M)}%`}},M)),D>T&&t.jsx("i",{className:"span",style:{insetInlineStart:`${T}%`,width:`${D-T}%`}}),["tick","diamond","dot"].map(M=>x.values[M]===void 0?null:t.jsx("span",{className:"at "+M+(x.values[M]>a?" over":""),style:{insetInlineStart:`${v(x.values[M])}%`},children:t.jsx(Pe,{kind:M,color:M==="dot"?x.tone:void 0})},M))]}),t.jsx("span",{className:"value",children:x.text})]},x.id)}),!k.has(g.id)&&g.rows.length>o&&t.jsx("div",{className:"row more",children:t.jsx(G,{quiet:!0,small:!0,onPress:()=>b(x=>new Set([...x,g.id])),children:c(g.rows.length)})}),g.notes.map(x=>t.jsx("p",{className:"rp-note note",children:x},x))]},g.id)),t.jsx(Bn,{tip:p})]})}function Zn(e,s,n){const a=new Map((s??[]).map(r=>[r.id,r.name])),l=new Map,o=(r,u)=>{let d=l.get(r);return d||l.set(r,d={id:r,label:u,rows:[],missing:[]}),d};for(const r of e){const u=ve(r),d=n==="protocol"?[["protocol:"+(r.protocol??""),r.protocol??null]]:r.group_ids.length?r.group_ids.map(p=>["group:"+p,a.get(p)??p]):[["group:",null]];for(const[p,m]of d){const h=o(p,m);u?.state==="healthy"&&u.latency_ms!==null?h.rows.push({id:r.id,name:r.name,latest:u.latency_ms,moving:u.moving_avg_ms,avg10:u.avg10_ms}):h.missing.push({id:r.id,name:r.name,state:u?.state==="unavailable"?"unavailable":"unmeasured"})}}const c=[...l.values()];for(const r of c)r.rows.sort((u,d)=>u.latest-d.latest||q(u.name,d.name)),r.missing.sort((u,d)=>q(u.name,d.name));return c.sort((r,u)=>(r.label===null?1:0)-(u.label===null?1:0)||q(r.label??"",u.label??""))}function es(e){const s=e.flatMap(n=>n.rows);return{moving:s.some(n=>n.moving!==null),avg10:s.some(n=>n.avg10!==null)}}function ns(e){const s=e.flatMap(l=>l.rows.flatMap(o=>[o.latest,o.moving??o.latest])).sort((l,o)=>l-o),n=Math.max(10,(On(s,90)??0)*1.25),a=n<=100?20:n<=500?100:n<=2e3?500:1e3;return Math.ceil(n/a)*a}function ss(){const e=_e().data?.resources,s=Se(ee(e,"nodes",{whileLoading:!0})),n=Xe(ee(e,"groups",{whileLoading:!1})),[a,l]=j.useState("group"),o=j.useMemo(()=>Zn(s.data??[],n.data,a),[s.data,n.data,a]);return{nodes:s,by:a,setBy:l,view:o}}const ue=6;function as(){const e=U(),s=ie(),n=Ye(),{nodes:a,by:l,setBy:o,view:c}=ss();if(a.error&&!a.data)return t.jsx(Te,{error:a.error,onRetry:a.refetch});if(!a.data)return t.jsx(Ze,{});if(!a.data.lenLine truncated
|
||||
`,c.from-1)+1,u=/^[ \t]*$/.test(e.slice(r,c.from))?r:c.from,d=l.children.find(i=>i.from===c.from);if(d){for(;n[o+1]?.from<d.to;)o++;if(d.line===d.endLine)continue;const i=dn(e,d,n),v=i.find(x=>x.name==="url"),g=i.find(x=>x.name==="interval");a.push({from:u,to:d.to,block:d,tag:d.name,host:v?re(se(v.value)):null,interval:g?is(se(g.value)):null,fields:i,parts:null});continue}const p=n[o+1];p&&e.slice(p.from,p.to)===":"&&!e.slice(p.to).startsWith("//")&&(o+=2);const m=n[o];if(!m||m.from>=l.close)break;if(m.kind!=="quoted")for(;n[o+1]?.from===n[o].to&&!/[(){}]/.test(e.slice(n[o+1].from,n[o+1].to));)o++;if(e[n[o+1]?.from]==="(")for(o++;n[o+1]&&!(e[n[o].from]===")"&&n[o].parens===1);)o++;let h=n[o].to,k;n[o+1]?.kind==="comment"&&n[o+1].line===n[o].line&&(k=e.slice(n[o+1].from,n[o+1].to),h=n[++o].to);const b=ls(e.slice(u,h));b&&a.push({from:u,to:h,tag:b.tag,host:re(b.url),interval:null,fields:[],parts:b,comment:k})}return a}function ds(e){return Oe(e).map(({tag:s,host:n,interval:a})=>({tag:s,host:n,interval:a}))}function cs(e,s,n){const a=Oe(e).find(u=>u.tag===s);if(!a||a.interval===n)return e;const l=e.slice(a.from,a.to).match(/^[ \t]*/)?.[0]??" ",o=l+(l.includes(" ")?" ":" ");if(a.parts){const u=[`${l}${cn(s)}: {`,`${o}url: ${ke(a.parts.url)}`];return a.parts.ua!==null&&u.push(`${o}ua: ${ke(a.parts.ua)}`),u.push(`${o}interval: '${n}s'`,`${l}}${a.comment?" "+a.comment:""}`),e.slice(0,a.from)+u.join(`
|
||||
`)+e.slice(a.to)}const c=a.fields.find(u=>u.name==="interval");if(c)return e.slice(0,c.valueFrom)+` '${n}s'`+e.slice(c.valueTo);if(!a.block)return e;const r=e.lastIndexOf(`
|
||||
`,a.block.close-1)+1;return e.slice(0,r)+`${o}interval: '${n}s'
|
||||
`+e.slice(r)}function us(e,s,n,a){const l=ve(e),o=l?.state==="healthy"&&l.latency_ms!=null;return{id:e.id,name:e.name,protocol:e.protocol??"—",latency:o?H(l.latency_ms,a):l?.state==="unavailable"?a("ui.unavailable"):"—",latencyClass:o?`ms ${Le(l.latency_ms)}`:l?.state==="unavailable"?"ms err":"ms",groups:e.group_ids.length?De(n,e.group_ids.map(c=>s.get(c)??c)):"—",probeLabel:a("nodes.probe",{name:e.name}),joinLabel:a("nodes.joinGroup",{name:e.name}),removeLabel:a("nodes.remove",{name:e.name})}}const ms=e=>gn(ve(e));function ps(e,s,n,a){const l=new Map;for(const i of s){if(!i.provider_id||!i.subscription_tag)continue;const v=l.get(i.provider_id)??new Set;v.add(i.subscription_tag),l.set(i.provider_id,v)}const o=i=>{const v=l.get(i);return v?.size===1?[...v][0]:void 0},c=i=>{const v=re(i.url_redacted),g=v?n.filter(x=>x.host===v):[];return g.length===1?g[0].tag:void 0},r=new Map,u=e.filter(i=>i.kind==="subscription");for(const i of u){const v=o(i.id)??c(i);v&&r.set(i.id,v)}const d=u.filter(i=>!r.has(i.id)),p=new Set(r.values()),m=n.filter(i=>!p.has(i.tag));d.length===1&&m.length===1&&r.set(d[0].id,m[0].tag);const h=e.map(i=>{const v=o(i.id);return{...i,displayName:r.get(i.id)??i.name,configTag:i.kind==="subscription"&&v&&n.filter(g=>g.tag===v).length===1?v:void 0}}),k={builtin:0,unattributed:0};for(const i of s)i.provider_id==null&&k[Fe(i)]++;const b=[];for(const i of["builtin","unattributed"]){const v=k[i];v&&b.push({id:mn(i,e),name:a(i==="builtin"?"nodes.kind.builtin":"nodes.kind.unattributed"),kind:i,url_redacted:null,node_count:v,updated_at:null,expires_at:null,traffic:null,status:"ok",last_error:null})}return{list:[...b,...h]}}function bs(e,s){return s!==null&&e.some(n=>n.id===s)?s:(e.find(n=>n.kind!=="builtin"&&n.kind!=="unattributed")??e[0])?.id??null}function vs(e,s,n){return e.filter(a=>s===void 0||(s===null?a.provider_id==null&&Fe(a)==="builtin"==(n==="builtin"):a.provider_id===s))}function hs(e,s,n,a,l,o){const c=s.trim(),r=e.filter(m=>(!c||o(m.name,c))&&(!n||m.group_ids.includes(n))&&(!a||m.protocol===a)),u=l.direction==="ascending"?1:-1,d=l.column==="latency"?new Map(r.map(m=>[m.id,ms(m)])):new Map,p={name:(m,h)=>q(m.name,h.name),protocol:(m,h)=>q(m.protocol??"",h.protocol??""),latency:(m,h)=>xn(d.get(m.id),d.get(h.id))||q(m.name,h.name)};return r.sort((m,h)=>u*(p[l.column]??p.name)(m,h))}const be=[3600,21600,43200,86400];function xe(e,s,n){return e===0?n("nodes.manualOnly"):be.includes(e)?n("nodes.everyHours",{n:e/3600}):pn(String(e),s)}function He(e,s,n){return[0,...be,...e===null||e===0||be.includes(e)?[]:[e]].map(a=>({id:String(a),label:xe(a,s,n)}))}function fs(e,s){const n={name:e.name.trim(),kind:"subscription",url:e.value.trim()},a=Number(e.interval);s?.update_interval!==void 0&&e.interval&&a!==s.update_interval&&(n.update_interval=a);const l=e.agent.trim();return s?.user_agent!==void 0&&l&&l!==s.user_agent&&(n.user_agent=l),s?.cache!==void 0&&e.cache!==null&&e.cache!==s.cache&&(n.cache=e.cache),n}function gs(e,s,n,a){const l={subscription:"nodes.kind.subscription",file:"nodes.kind.file",inline:"nodes.kind.inline",builtin:"nodes.kind.builtin",unattributed:"nodes.kind.unattributed"},o={ok:"nodes.status.ok",stale:"nodes.status.stale",error:"nodes.status.error"},c={ok:"ok",stale:"warn",error:"err"},r=e.kind==="builtin"||e.kind==="unattributed",u=e.traffic?bn(e.traffic.upload_bytes,e.traffic.download_bytes):null,d=e.kind==="subscription"?s:void 0,p=e.displayName??e.name;return{id:e.id,name:p,url:e.url_redacted??void 0,kind:Ne(l,e.kind,a),count:ae(e.node_count,n),usage:u===null?"—":e.traffic?.total_bytes?a("ui.fraction",{part:ce(u,n),whole:ce(e.traffic.total_bytes,n)}):ce(u,n),updatedAt:r?null:e.updated_at,expires:e.expires_at?fn(e.expires_at,n):"—",interval:d==null?"—":xe(d,n,a),intervalValue:d==null?"":String(d),hasInterval:d!==void 0,intervalLabel:a("nodes.intervalOf",{name:p}),intervals:d===void 0?[]:He(d,n,a),status:r?null:Ne(o,e.status,a),tone:c[e.status],error:e.last_error?vn(hn(e.last_error.code,e.last_error.message,a),a):void 0,refreshLabel:a("nodes.refresh",{name:p}),removeLabel:a("nodes.remove",{name:p})}}const qe=e=>/^[a-z][a-z0-9+.-]*:\/\/\S+$/i.test(e.trim());function xs(e,s,n,a){const l=s.trim();return e!=="provider"&&e!=="node"||!l&&!n.trim()?null:l?e==="node"?qe(n)?null:a("nodes.linkInvalid"):Ge(l)?Ie(n)?null:a("nodes.urlInvalid"):a("nodes.nameInvalid"):a("nodes.nameMissing")}function js(e){const s=U(),n=he[ie()],{refresh:a}=e,l=new Map(e.entries.map(c=>[c.tag,c.interval]));return{rows:e.rows.map(c=>({...gs(c,c.configTag?l.get(c.configTag):void 0,n,s),refreshable:c.kind==="subscription"&&e.canRefresh,refreshing:a.busy===c.id,refreshDisabled:!!a.busy,refresh:()=>void a.refresh(c.id).then(r=>{r&&("degraded"in r?C("info",s("nodes.refreshedDegraded",{name:c.name})):C("positive",s("nodes.refreshed",{name:c.name,n:ae(r.node_count,n)})))},r=>fe(r,s,s("nodes.refreshFailed",{name:c.name}))),removable:e.canManage&&(c.kind==="subscription"||c.kind==="file"),remove:()=>{(c.kind=
Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{r as S,j as t}from"./vendor-react-Bf71BWbF.js";import{an as K,ao as C,ap as I,aq as M,ar as $,as as x,at as B,a4 as g,au as G,av as J,aw as q,ax as z,u as O,a as Q,a5 as X,a8 as Y,ay as Z,aa as A,az as ee,aA as te,aB as ae,aC as se,aD as re,aE as oe,aF as y,E as L,L as P,aG as N,aH as F,aI as ie,aJ as w,aK as ne,ai as H,aL as le,aM as ce,j as T,aN as de,B as pe,aO as ue}from"./index-BNBwb-FJ.js";import{d as ve,e as me}from"./files-BxEOxSF8.js";import{D as he,t as V}from"./Table-DyWJelc_.js";import{A as fe}from"./ActionGroup-BKxDwmnT.js";import{D as xe}from"./DaeCode-B8yPDjSE.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";const W={ebpf:"ov.v.ebpf",userspace:"ov.v.userspace",mock:"ov.v.mock",active:"ov.v.active",degraded:"ov.v.degraded",detached:"ov.v.detached",failed:"ov.v.failed",disabled:"ov.v.disabled",full:"ov.v.full",partial:"ov.v.partial",none:"ov.v.none",real:"ov.v.real",loaded:"ov.v.loaded",not_loaded:"ov.v.notLoaded",attached:"ov.v.attached",partially_attached:"ov.v.partiallyAttached",published:"ov.v.published",not_published:"ov.v.notPublished",healthy:"ov.v.healthy",ready:"ov.v.ready",error:"ov.v.error",unknown:"ov.v.unknown",ingress:"ov.v.ingress",egress:"ov.v.egress"};function E(o,s){return W[o]?s(W[o]):o}function ge(o,s,e){if(o==="degraded")return{title:e("ov.v.degraded"),text:e(s?"ov.degradedHelp.runtime":"ov.degradedHelp.datapath")};if(o==="unknown")return{title:e("ov.v.unknown"),text:e("ov.unknownHelp")}}function be(o,s,e,a,r=!1){const i=o.ebpf,n=i?.maps?.conn_state,c=(p,u)=>{const m=ge(u,r,e);return m?{label:e(p),value:E(u,e),help:m}:[e(p),E(u,e)]},d=i?.maps?.state??"unknown";return[c("ov.f.kind",o.kind),c("ov.f.state",o.state),...o.visibility==="partial"&&i?[]:[c("ov.f.visibility",o.visibility)],...i?[c("ov.f.backend",i.backend),c("ov.f.programs",i.programs),c("ov.f.hooks",i.hooks),c("ov.f.routing",i.routing.state),c("ov.f.health",i.health),...d==="partial"&&n&&!n.occupancy_known?[[e("ov.f.maps"),e("ov.mapCapacity",{capacity:g(n.capacity,a)})]]:[c("ov.f.maps",d),[e("ov.f.connState"),n?.occupancy_known&&n.occupancy!==null?e("ui.fraction",{part:g(n.occupancy,a),whole:g(n.capacity,a)}):n?e("ov.occupancyUnknown",{capacity:g(n.capacity,a)}):s]]]:[]]}const je={service:"ov.v.cgroupService",shared:"ov.v.cgroupShared"},ye={service:"ov.cgroupHelp.service",shared:"ov.cgroupHelp.shared"};function we(o,s,e,a=[],r=!1){const i=o.cgroup?.scope,n=p=>{const u=z(p??null);return u===null?"—":g(u,e)},c=[["ov.f.rss",x(o.process?.rss_bytes??null,e)],["ov.f.cgroupCurrent",x(o.cgroup?.current_bytes??null,e)],["ov.f.cgroupLimit",r&&o.cgroup?.limit_bytes===null?s("ov.noLimit"):x(o.cgroup?.limit_bytes??null,e)],["ov.f.cgroupScope",i&&i!=="unknown"?s(je[i]):"—"],["ov.f.oomHigh",n(o.cgroup?.events?.high)],["ov.f.oom",n(o.cgroup?.events?.oom)],["ov.f.oomKill",n(o.cgroup?.events?.oom_kill)],["ov.f.ebpfBytes",x(o.kernel?.ebpf_bytes??null,e)]],d=[...a,...i==="unknown"?["ov.f.cgroupScope"]:[],...o.kernel?[]:["ov.f.ebpfBytes"]];return c.filter(([p])=>!d.includes(p)).map(([p,u])=>p==="ov.f.cgroupScope"&&i&&i!=="unknown"?{label:s(p),value:u,help:{title:s(p),text:s("ui.valuePair",{label:u,value:s(ye[i])})}}:[s(p),u])}function ke(o,s,e,a){const{capabilities:r,runtime:i,version:n,memory:c,datapath:d,limits:p=[]}=o,u=i?.lifecycle.state,m=i?.generation.config_revision??i?.generation.active_id??"—",v=i?.last_reload,k=i?.process.cpu_percent,b=K(c?.cgroup?.current_bytes??null,c?.cgroup?.limit_bytes??null),h=l=>l===null?"—":g(l,e),f=(l,j)=>l?"ready":j?"loading":"unavailable";return{status:q(u,d?.state,a(s.capabilities||s.runtime?"ov.loading":"ov.unknown"),a),strip:[{label:a("ov.config"),value:G(m),full:m,help:{title:a("ov.config"),text:a("ov.configHelp")}},[a("ov.uptime"),J(i?.lifecycle.uptime_seconds??null,e)],[a("ov.cpu"),k==null?"—":a("ui.percent",{n:g(k,e,1)})],[a("ov.lastReload"),v?B(v.finished_at,e):"—"]],reload:v?{tooltip:v.operation_id,tone:v.status==="succeeded"?"ok":v.status==="failed"?"err":"warn",text:a(v.status==="succeeded"?"ov.succeeded":v.status==="failed"?"ov.failed":"ov.running")}:null,engine:{state:f(!!n,s.version),fields:n?[[a("ov.f.engine"),n.engine.name+" "+n.engine.version],[a("ov.f.api"),a("ui.apiVersion",{name:n.api.name,major:n.api.major,status:n.api.status})],[a("ov.f.build"),[n.build?.revision,n.build?.target].filter(Boolean).join(a("ui.separator"))||"—"],[a("ov.f.instance"),i?.instance_id??"—"],[a("ov.f.started"),B(i?.lifecycle.started_at??null,e)],[a("ov.f.activated"),B(i?.generation.activated_at??null,e)]]:[],profiles:r?.profiles.map(l=>({id:l,text:a(l==="base"?"ov.profileBase":"ov.profileFull")}))??[]},counters:{state:f(!!i,s.capabilities||s.runtime),fields:i?[[a("ov.f.tcp"),h(i.traffic.connections.tcp)],[a("ov.f.udp"),h(i.traffic.connections.udp)],[a("ov.f.total"),h(i.traffic.connections.total)],[a("ui.upload"),x(i.traffic.bytes.upload,e)],[a("ui.download"),x(i.traffic.bytes.download,e)],{label:a("ov.f.rateWindLine truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{r as S,j as a}from"./vendor-react-Bf71BWbF.js";import{ak as T,al as R,am as U,an as K,ao as $,ap as h,aq as B,a1 as b,ar as G,as as J,at as q,au as z,u as W,a as Q,a5 as X,av as Y,a7 as A,aw as Z,ax as ee,ay as ae,az as te,aA as se,a2 as re,aB as oe,aC as _,E as L,L as M,aD as N,aE as C,aF as ie,aG as y,aH as ne,af as H,aI as le,aJ as ce,j as O,aK as de,B as pe,aL as ue}from"./index-CXHBmSa5.js";import{d as ve,e as me}from"./files-BxEOxSF8.js";import{D as he,t as I}from"./Table-D0NFHHNQ.js";import{A as fe}from"./ActionGroup-90AzAQje.js";import{D as xe}from"./DaeCode-STEiRZuV.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";const V={ebpf:"ov.v.ebpf",userspace:"ov.v.userspace",mock:"ov.v.mock",active:"ov.v.active",degraded:"ov.v.degraded",detached:"ov.v.detached",failed:"ov.v.failed",disabled:"ov.v.disabled",full:"ov.v.full",partial:"ov.v.partial",none:"ov.v.none",real:"ov.v.real",loaded:"ov.v.loaded",not_loaded:"ov.v.notLoaded",attached:"ov.v.attached",partially_attached:"ov.v.partiallyAttached",published:"ov.v.published",not_published:"ov.v.notPublished",healthy:"ov.v.healthy",ready:"ov.v.ready",error:"ov.v.error",unknown:"ov.v.unknown",ingress:"ov.v.ingress",egress:"ov.v.egress"};function E(o,s){return V[o]?s(V[o]):o}function ge(o,s,e){if(o==="degraded")return{title:e("ov.v.degraded"),text:e(s?"ov.degradedHelp.runtime":"ov.degradedHelp.datapath")};if(o==="unknown")return{title:e("ov.v.unknown"),text:e("ov.unknownHelp")}}function be(o,s,e,t,r=!1){const i=o.ebpf,l=i?.maps?.conn_state,n=(c,p)=>{const f=ge(p,r,e);return f?{label:e(c),value:E(p,e),help:f}:[e(c),E(p,e)]};return[n("ov.f.kind",o.kind),n("ov.f.state",o.state),n("ov.f.visibility",o.visibility),...i?[n("ov.f.backend",i.backend),n("ov.f.programs",i.programs),n("ov.f.hooks",i.hooks),n("ov.f.routing",i.routing.state),n("ov.f.health",i.health),n("ov.f.maps",i.maps?.state??"unknown"),[e("ov.f.connState"),l?.occupancy_known&&l.occupancy!==null?e("ui.fraction",{part:b(l.occupancy,t),whole:b(l.capacity,t)}):l?e("ov.occupancyUnknown",{capacity:b(l.capacity,t)}):s]]:[]]}const je={service:"ov.v.cgroupService",shared:"ov.v.cgroupShared",unknown:"ui.unknown"},ye={service:"ov.cgroupHelp.service",shared:"ov.cgroupHelp.shared",unknown:"ov.cgroupHelp.unknown"};function we(o,s,e,t=[]){const r=n=>{const c=z(n??null);return c===null?"—":b(c,e)},i=[["ov.f.rss",h(o.process?.rss_bytes??null,e)],["ov.f.cgroupCurrent",h(o.cgroup?.current_bytes??null,e)],["ov.f.cgroupLimit",h(o.cgroup?.limit_bytes??null,e)],["ov.f.cgroupScope",o.cgroup?s(je[o.cgroup.scope]):"—"],["ov.f.oomHigh",r(o.cgroup?.events?.high)],["ov.f.oom",r(o.cgroup?.events?.oom)],["ov.f.oomKill",r(o.cgroup?.events?.oom_kill)],["ov.f.ebpfBytes",h(o.kernel?.ebpf_bytes??null,e)]],l=o.cgroup?.scope;return i.filter(([n])=>!t.includes(n)).map(([n,c])=>n==="ov.f.cgroupScope"&&l?{label:s(n),value:c,help:{title:s(n),text:s("ui.valuePair",{label:c,value:s(ye[l])})}}:[s(n),c])}function ke(o,s,e,t){const{capabilities:r,runtime:i,version:l,memory:n,datapath:c,limits:p=[]}=o,f=i?.lifecycle.state,j=i?.generation.config_revision??i?.generation.active_id??"—",u=i?.last_reload,w=i?.process.cpu_percent,x=T(n?.cgroup?.current_bytes??null,n?.cgroup?.limit_bytes??null),v=d=>d===null?"—":b(d,e),m=(d,g)=>d?"ready":g?"loading":"unavailable";return{status:q(f,c?.state,t(s.capabilities||s.runtime?"ov.loading":"ov.unknown"),t),strip:[{label:t("ov.config"),value:G(j),full:j,help:{title:t("ov.config"),text:t("ov.configHelp")}},[t("ov.uptime"),J(i?.lifecycle.uptime_seconds??null,e)],[t("ov.cpu"),w==null?"—":t("ui.percent",{n:b(w,e,1)})],[t("ov.lastReload"),u?B(u.finished_at,e):"—"]],reload:u?{tooltip:u.operation_id,tone:u.status==="succeeded"?"ok":u.status==="failed"?"err":"warn",text:t(u.status==="succeeded"?"ov.succeeded":u.status==="failed"?"ov.failed":"ov.running")}:null,engine:{state:m(!!l,s.version),fields:l?[[t("ov.f.engine"),l.engine.name+" "+l.engine.version],[t("ov.f.api"),t("ui.apiVersion",{name:l.api.name,major:l.api.major,status:l.api.status})],[t("ov.f.build"),[l.build?.revision,l.build?.target].filter(Boolean).join(t("ui.separator"))||"—"],[t("ov.f.instance"),i?.instance_id??"—"],[t("ov.f.started"),B(i?.lifecycle.started_at??null,e)],[t("ov.f.activated"),B(i?.generation.activated_at??null,e)]]:[],profiles:r?.profiles.map(d=>({id:d,text:t(d==="base"?"ov.profileBase":"ov.profileFull")}))??[]},counters:{state:m(!!i,s.capabilities||s.runtime),fields:i?[[t("ov.f.tcp"),v(i.traffic.connections.tcp)],[t("ov.f.udp"),v(i.traffic.connections.udp)],[t("ov.f.total"),v(i.traffic.connections.total)],[t("ui.upload"),h(i.traffic.bytes.upload,e)],[t("ui.download"),h(i.traffic.bytes.download,e)],{label:t("ov.f.rateWindow"),value:i.traffic.rates?t("ui.seconds",{n:b(i.traffic.rates.window_seconds,e,1)}):"—",help:{title:t("ov.f.rateWindow"),text:t("ov.rateWindowHelp")}}]:[],since:i?t("ov.countersSince",{t:B(i.traffic.counter_since,e),scope:t(i.traffic.scope=Line truncated
|
||||
@@ -0,0 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Arrange-BvqJLS4m.js","./vendor-react-Bf71BWbF.js","./index-BNBwb-FJ.js","./index-C8vJM6q6.css","./Virtualizer-DipGMcji.js","./ListLayout-F74Z1Dpf.js","./DaeCode-B8yPDjSE.js","./policyText-CmeXgUK2.js","./PolicyPicker-BmHzmXzJ.js","./useFilter-jz02VVEB.js","./useGridSelectionCheckbox-CrCOlZv8.js","./Arrange-Dd3j3leY.css"])))=>i.map(i=>d[i]);
|
||||
import{bE as et,bF as tt,bG as it,bH as pe,bI as ie,bJ as Pe,bK as rt,bL as at,bM as ot,bN as nt,bO as De,bP as oe,bQ as ne,bR as me,bS as V,bT as q,bU as J,bV as ee,bW as lt,bX as le,bY as Ke,bZ as st,b_ as ct,b$ as He,c0 as dt,c1 as de,c2 as fe,c3 as Fe,c4 as ue,c5 as ut,c6 as $e,c7 as Ie,c8 as he,c9 as be,ca as Oe,cb as pt,cc as ft,cd as ht,ce as Be,cf as bt,cg as mt,ch as se,ci as gt,cj as yt,ck as vt,cl as xt,cm as $t,cn as kt,co as wt,cp as Pt,cq as It,cr as St,cs as Et,ct as Dt,b as te,cu as Mt,a3 as jt,b6 as Ge,cv as Ct,aW as Nt,J as Tt,cw as _t,aS as Lt,a4 as zt,u as G,a5 as At,a as Rt,ai as ke,cx as Kt,cy as ge,c as ye,T as Se,bn as Ht,cz as Ft,cA as Ve,af as Ue,I as Ot,B as A,ah as Bt,b7 as Gt,a8 as Vt,ac as Ut,aa as Me,ab as Wt,cB as qt,cC as Jt,K as Yt,bi as Qt,bj as Xt,bw as Zt,cD as We,cE as qe,Q as ei,be as U,cF as ti,cG as ii,bf as ri,cH as ai,A as oi,E as Je,j as je,cI as ni,br as li,aJ as si,cJ as ci,_ as di,bB as ui,aK as pi,aF as ce,bq as fi,bD as hi,cK as bi,aG as mi,b4 as gi}from"./index-BNBwb-FJ.js";import{r as g,$ as P,j as l}from"./vendor-react-Bf71BWbF.js";import{$ as yi,a as vi,b as xi,c as $i,d as ki}from"./useGridSelectionCheckbox-CrCOlZv8.js";import{$ as wi,a as B,b as ve,c as Q,d as Pi}from"./Virtualizer-DipGMcji.js";import{$ as Ii}from"./useFilter-jz02VVEB.js";import{g as Si,a as Ei}from"./policyText-CmeXgUK2.js";import{P as Di}from"./PolicyPicker-BmHzmXzJ.js";const Ee=new WeakMap;function we(i,t){let{id:e}=Ee.get(i)??{};if(!e)throw new Error("Unknown list");return`${e}-${Mi(t)}`}function Mi(i){return typeof i=="string"?i.replace(/\s*/g,""):""+i}function ji(i,t,e){let{isVirtualized:r,keyboardDelegate:a,layoutDelegate:n,onAction:s,disallowTypeAhead:c,linkBehavior:o="action",keyboardNavigationBehavior:d="arrow",escapeKeyBehavior:p="clearSelection",shouldSelectOnPressUp:m}=i;!i["aria-label"]&&!i["aria-labelledby"]&&console.warn("An aria-label or aria-labelledby prop is required for accessibility.");let{listProps:x}=et({selectionManager:t.selectionManager,collection:t.collection,disabledKeys:t.disabledKeys,ref:e,keyboardDelegate:a,layoutDelegate:n,isVirtualized:r,selectOnFocus:t.selectionManager.selectionBehavior==="replace",shouldFocusWrap:i.shouldFocusWrap,linkBehavior:o,disallowTypeAhead:c,autoFocus:i.autoFocus,escapeKeyBehavior:p,UNSTABLE_focusOnEntry:i.UNSTABLE_focusOnEntry}),f=tt(i.id);Ee.set(t,{id:f,onAction:s,linkBehavior:o,keyboardNavigationBehavior:d,shouldSelectOnPressUp:m});let h=yi({selectionManager:t.selectionManager,hasItemActions:!!s}),$=it(e,{isDisabled:t.collection.size!==0}),b=pe(i,{labelable:!0}),v=ie(b,{role:"grid",id:f,"aria-multiselectable":t.selectionManager.selectionMode==="multiple"?"true":void 0},t.collection.size===0?{tabIndex:$?-1:0}:x,h);return r&&(v["aria-rowcount"]=t.collection.size,v["aria-colcount"]=1),vi({},t),{gridProps:v}}const Ce={expand:{ltr:"ArrowRight",rtl:"ArrowLeft"},collapse:{ltr:"ArrowLeft",rtl:"ArrowRight"}};function Ci(i,t,e){let{node:r,isVirtualized:a,focusMode:n="row",allowsArrowNavigation:s}=i,{direction:c}=Pe(),{onAction:o,linkBehavior:d,keyboardNavigationBehavior:p,shouldSelectOnPressUp:m}=Ee.get(t),x=rt(),f=g.useRef(null),h=()=>{if(e.current!==null){if(n==="child"){if(De(e.current)&&e.current!==oe(ne(e.current)))return;let E=me(e.current,{tabbable:!0}).firstChild();if(E){V(E),q(E,{containingElement:J(E)});return}}(f.current!=null&&r.key!==f.current||!De(e.current))&&V(e.current)}},$={},b=i.hasChildItems,v=t.selectionManager.isLink(r.key);if(r!=null&&"expandedKeys"in t){let u=t.collection.getChildren?.(r.key);b=b||[...u??[]].length>1,o==null&&!v&&t.selectionManager.selectionMode==="none"&&b&&(o=()=>t.toggleKey(r.key));let E=b?t.expandedKeys.has(r.key):void 0,w=1,D=r.index;if(r.level>=0&&r?.parentKey!=null){let M=t.collection.getItem(r.parentKey);if(M){let R=Ni(M,t.collection);w=[...R].filter(K=>K.type==="item").length,D>0&&R[0].type!=="item"&&(D-=1)}}else w=[...t.collection].filter(M=>M.level===0&&M.type==="item").length;$={"aria-expanded":E,"aria-level":r.level+1,"aria-posinset":D+1,"aria-setsize":w}}let{itemProps:I,...j}=at({selectionManager:t.selectionManager,key:r.key,ref:e,isVirtualized:a,shouldSelectOnPressUp:i.shouldSelectOnPressUp||m,onAction:o||r.props?.onAction?ot(r.props?.onAction,o?()=>o(r.key):void 0):void 0,focus:h,linkBehavior:d}),_=u=>{let E=oe(ne(e.current));if(!le(u.currentTarget,ee(u))||!e.current||!E)return;let w=me(e.current);if(w.currentNode=E,!Ne(u,t,r,b,c,E,e.current,s))switch(u.key){case"ArrowLeft":if(p==="arrow"){let D=c==="rtl"?w.nextNode():w.previousNode();if(D)u.preventDefault(),u.stopPropagation(),V(D),q(D,{containingElement:J(e.current)});else if(u.preventDefault(),u.stopPropagation(),c==="rtl")V(e.current),q(e.current,{containingElement:J(e.current)});else{w.currentNode=e.current;let M=Te(w);M&&(V(M),q(M,{containingElement:J(e.current)}))}}break;case"ArrowRight":if(p==="arrow"){let D=c==="rtl"?w.previousNode():w.nextNode();if(D)u.preventDefault(),u.stopPropagation(),V(D),q(D,{containingElement:JLine truncated
|
||||
@@ -1,2 +0,0 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./Arrange-Aggv2ZKG.js","./vendor-react-Bf71BWbF.js","./index-CXHBmSa5.js","./index-BMPxGQXj.css","./Virtualizer--Vfl8O3n.js","./ListLayout-CPapuywx.js","./DaeCode-STEiRZuV.js","./policyText-CAFy3qpo.js","./PolicyPicker-DSSmYroN.js","./useFilter-DZ8TXqn_.js","./useGridSelectionCheckbox-BV96yL-N.js","./Arrange-Dd3j3leY.css"])))=>i.map(i=>d[i]);
|
||||
import{bA as Je,bB as Qe,bC as Ze,bD as pe,bE as re,bF as we,bG as et,bH as tt,bI as rt,bJ as at,bK as De,bL as oe,bM as ne,bN as me,bO as V,bP as q,bQ as Y,bR as ee,bS as it,bT as le,bU as Ae,bV as ot,bW as nt,bX as Re,bY as lt,bZ as de,b_ as fe,b$ as Ke,c0 as ue,c1 as st,c2 as xe,c3 as Pe,c4 as he,c5 as be,c6 as He,c7 as ct,c8 as dt,c9 as ut,ca as Fe,cb as pt,cc as ft,cd as se,ce as ht,cf as bt,cg as mt,ch as gt,ci as yt,cj as vt,ck as xt,cl as $t,cm as kt,cn as wt,co as Pt,cp as St,b as te,cq as It,a0 as Dt,b3 as Oe,cr as Et,aT as Mt,H as jt,cs as Ct,aP as Nt,a1 as Tt,u as G,a2 as _t,a as Lt,af as $e,ct as zt,cu as ge,c as ye,T as Se,bj as At,cv as Rt,cw as Be,ac as Ge,I as Kt,B as A,ae as Ht,b4 as Ft,a5 as Ot,a9 as Bt,a7 as Ee,a8 as Gt,cx as Vt,cy as Ut,J as Wt,be as qt,bf as Yt,bs as Xt,cz as Ve,cA as Ue,O as Jt,bb as U,cB as Qt,cC as Zt,cD as er,E as We,j as Me,cE as tr,bn as rr,aG as ar,cF as ir,_ as or,bx as nr,aH as lr,aC as ce,bm as sr,bz as cr,cG as dr,aD as ur,b1 as pr}from"./index-CXHBmSa5.js";import{r as m,$ as P,j as n}from"./vendor-react-Bf71BWbF.js";import{$ as fr,a as hr,b as br,c as mr,d as gr}from"./useGridSelectionCheckbox-BV96yL-N.js";import{$ as yr,a as B,b as ve,c as J,d as vr}from"./Virtualizer--Vfl8O3n.js";import{$ as xr}from"./useFilter-DZ8TXqn_.js";import{g as $r,a as kr}from"./policyText-CAFy3qpo.js";import{P as wr}from"./PolicyPicker-DSSmYroN.js";const Ie=new WeakMap;function ke(a,t){let{id:e}=Ie.get(a)??{};if(!e)throw new Error("Unknown list");return`${e}-${Pr(t)}`}function Pr(a){return typeof a=="string"?a.replace(/\s*/g,""):""+a}function Sr(a,t,e){let{isVirtualized:r,keyboardDelegate:i,layoutDelegate:l,onAction:s,disallowTypeAhead:c,linkBehavior:o="action",keyboardNavigationBehavior:d="arrow",escapeKeyBehavior:f="clearSelection",shouldSelectOnPressUp:b}=a;!a["aria-label"]&&!a["aria-labelledby"]&&console.warn("An aria-label or aria-labelledby prop is required for accessibility.");let{listProps:v}=Je({selectionManager:t.selectionManager,collection:t.collection,disabledKeys:t.disabledKeys,ref:e,keyboardDelegate:i,layoutDelegate:l,isVirtualized:r,selectOnFocus:t.selectionManager.selectionBehavior==="replace",shouldFocusWrap:a.shouldFocusWrap,linkBehavior:o,disallowTypeAhead:c,autoFocus:a.autoFocus,escapeKeyBehavior:f,UNSTABLE_focusOnEntry:a.UNSTABLE_focusOnEntry}),h=Qe(a.id);Ie.set(t,{id:h,onAction:s,linkBehavior:o,keyboardNavigationBehavior:d,shouldSelectOnPressUp:b});let u=fr({selectionManager:t.selectionManager,hasItemActions:!!s}),x=Ze(e,{isDisabled:t.collection.size!==0}),g=pe(a,{labelable:!0}),k=re(g,{role:"grid",id:h,"aria-multiselectable":t.selectionManager.selectionMode==="multiple"?"true":void 0},t.collection.size===0?{tabIndex:x?-1:0}:v,u);return r&&(k["aria-rowcount"]=t.collection.size,k["aria-colcount"]=1),hr({},t),{gridProps:k}}const je={expand:{ltr:"ArrowRight",rtl:"ArrowLeft"},collapse:{ltr:"ArrowLeft",rtl:"ArrowRight"}};function Ir(a,t,e){let{node:r,isVirtualized:i,focusMode:l="row",allowsArrowNavigation:s}=a,{direction:c}=we(),{onAction:o,linkBehavior:d,keyboardNavigationBehavior:f,shouldSelectOnPressUp:b}=Ie.get(t),v=et(),h=m.useRef(null),u=()=>{if(e.current!==null){if(l==="child"){if(De(e.current)&&e.current!==oe(ne(e.current)))return;let S=me(e.current,{tabbable:!0}).firstChild();if(S){V(S),q(S,{containingElement:Y(S)});return}}(h.current!=null&&r.key!==h.current||!De(e.current))&&V(e.current)}},x={},g=a.hasChildItems,k=t.selectionManager.isLink(r.key);if(r!=null&&"expandedKeys"in t){let p=t.collection.getChildren?.(r.key);g=g||[...p??[]].length>1,o==null&&!k&&t.selectionManager.selectionMode==="none"&&g&&(o=()=>t.toggleKey(r.key));let S=g?t.expandedKeys.has(r.key):void 0,w=1,D=r.index;if(r.level>=0&&r?.parentKey!=null){let E=t.collection.getItem(r.parentKey);if(E){let R=Dr(E,t.collection);w=[...R].filter(K=>K.type==="item").length,D>0&&R[0].type!=="item"&&(D-=1)}}else w=[...t.collection].filter(E=>E.level===0&&E.type==="item").length;x={"aria-expanded":S,"aria-level":r.level+1,"aria-posinset":D+1,"aria-setsize":w}}let{itemProps:j,...T}=tt({selectionManager:t.selectionManager,key:r.key,ref:e,isVirtualized:i,shouldSelectOnPressUp:a.shouldSelectOnPressUp||b,onAction:o||r.props?.onAction?rt(r.props?.onAction,o?()=>o(r.key):void 0):void 0,focus:u,linkBehavior:d}),N=p=>{let S=oe(ne(e.current));if(!le(p.currentTarget,ee(p))||!e.current||!S)return;let w=me(e.current);if(w.currentNode=S,!Ce(p,t,r,g,c,S,e.current,s))switch(p.key){case"ArrowLeft":if(f==="arrow"){let D=c==="rtl"?w.nextNode():w.previousNode();if(D)p.preventDefault(),p.stopPropagation(),V(D),q(D,{containingElement:Y(e.current)});else if(p.preventDefault(),p.stopPropagation(),c==="rtl")V(e.current),q(e.current,{containingElement:Y(e.current)});else{w.currentNode=e.current;let E=Ne(w);E&&(V(E),q(E,{containingElement:Y(e.current)}))}}break;case"ArrowRight":if(f==="arrow"){let D=c==="rtl"?w.previousNode():w.nextNode();if(D)p.preventDefault(),p.stopPropagation(),V(D),q(D,{containingElement:Y(e.current)});elsLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{j as i}from"./vendor-react-Bf71BWbF.js";import{u as a,b5 as l}from"./index-BNBwb-FJ.js";import{c as m}from"./policyText-CmeXgUK2.js";function f({value:o,onChange:s,isDisabled:t}){const e=a(),{selected:r,items:c}=m(o,e);return i.jsx(l,{label:e("arrange.policy"),value:r,onChange:s,items:c,isDisabled:t})}export{f as P};
|
||||
@@ -1 +0,0 @@
|
||||
import{j as i}from"./vendor-react-Bf71BWbF.js";import{u as a,b2 as l}from"./index-CXHBmSa5.js";import{c as m}from"./policyText-CAFy3qpo.js";function f({value:o,onChange:s,isDisabled:t}){const e=a(),{selected:r,items:c}=m(o,e);return i.jsx(l,{label:e("arrange.policy"),value:r,onChange:s,items:c,isDisabled:t})}export{f as P};
|
||||
@@ -1 +0,0 @@
|
||||
import{r as g,j as r}from"./vendor-react-Bf71BWbF.js";import{cH as Fe,V as Ze,cI as Ye,cx as en,b3 as hn,aV as ie,a0 as K,aZ as gn,a_ as xn,aq as nn,a2 as ce,h as wn,aQ as Se,$ as ee,au as yn,a1 as le,cr as vn,aT as sn,bf as kn,X as G,b8 as jn,cJ as _n,cK as Nn,cL as Mn,y as Sn,b5 as tn,cM as Ln,u as E,a as Le,bo as Cn,a5 as ve,a9 as We,a7 as P,a8 as rn,cN as Rn,bp as Tn,bb as we,b as Pn,U as Pe,cO as on,aE as J,aC as je,ab as In,cP as Dn,b6 as Hn,cA as En,cQ as On,cR as Fn,ba as Wn,cS as An,cT as Vn,cU as Bn,aH as ye,B as W,cV as Un,ae as _e,bx as an,aG as Ne,I as $n,E as de,cW as Qn,b1 as Ce,b2 as ae,T as Y,cw as qn,bm as Gn,aN as Kn,ct as Jn,c as $e,f as zn,bi as Xn,b0 as Zn,bl as Yn,j as Ae,aD as Me,L as Qe,af as ln,be as es,bn as ns,cG as ss,by as ts}from"./index-CXHBmSa5.js";import{u as Re,r as rs,a as Ve,b as os}from"./flows-C0byZ3sY.js";import{q as as}from"./dns-DQrpG8y_.js";import{i as qe}from"./setup-B5f1cfyO.js";import{a as is,t as ls,b as ds,w as H,p as cs,r as us}from"./link-D6L0Eg5i.js";import{g as ps}from"./policyText-CAFy3qpo.js";import{r as ms}from"./nav-D1cfWFA0.js";import{r as fs}from"./recorder-DlDpPhd4.js";import{p as bs}from"./probe-C8ejAKwA.js";import{D as Te}from"./Table-D0NFHHNQ.js";import{D as ge}from"./DaeCode-STEiRZuV.js";import{T as hs}from"./TimeCell-gSIuLEFc.js";import{u as gs}from"./outbounds-f8QoVoCV.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";const xs=["client","rule","outbound","node"],ws=e=>new Map(e.map(n=>[n.id,n.name])),Ee="\0";function ys(e,n){return e.rule_id?n.get(e.rule_id)?.expression===e.rule_expression?e.rule_id:e.rule_id+Ee+e.rule_expression:void 0}function dn(e,n,s,a){switch(n){case"client":{const o=Ze(e.input?.src??void 0);return{label:o??"unknown",unknown:!o}}case"rule":return e.rule_expression?{label:e.rule_expression,unknown:!1,key:ys(e,a)}:{label:"unknown",unknown:!0};case"outbound":return e.outbound?{label:e.outbound,unknown:!1}:{label:"unknown",unknown:!0};case"node":{if(Fe(e.outbound))return null;const o=e.chain.at(-1)??null;return o?{label:s.get(o)??o,unknown:!1,key:o}:{label:"unknown",unknown:!0}}}}const xe=(e,n)=>ls(e,n.unknown?"":n.key??n.label),cn=e=>is(e,xs)?.kind,vs=new Map;function un(e,n,s){const a=cn(n);if(!a)return[];const o=new Map(s.map(t=>[t.rule_id,t]));return e.filter(t=>{const i=dn(t,a,vs,o);return i!==null&&xe(a,i)===n})}function ks(e,n,s,a){const o=e.slice(0,e.indexOf(":")),t=e.slice(e.indexOf(":")+1);return t===""?a(null):o==="rule"?t.includes(Ee)?t.slice(t.indexOf(Ee)+1):n.find(i=>i.rule_id===t)?.expression??t:o==="node"?s.get(t)??t:o==="client"?t:a(t)}function js(e,n,s,a,o="rule"){const t=ws(s),i=new Map(n.map(b=>[b.id,b])),l=new Map(n.map(b=>[b.name,b])),d=new Map(s.map(b=>[b.id,b])),p=new Map(a.map(b=>[b.rule_id,b])),h=new Map,m=new Map,u=new Map,f=new Map,v=(b,x)=>{const L=b+">"+x;let y=f.get(L);return y||f.set(L,y={source:b,target:x,count:0}),y},M=(b,x,L=!1)=>{const y=xe("node",{key:b,label:x,unknown:L});let R=u.get(y);if(!R){const V=L?void 0:d.get(b),B=V&&en(V);u.set(y,R={id:y,label:x,count:0,unknown:L||void 0,latency:hn(B),unavailable:B?.state==="unavailable"})}return R},c=(b,x=!1)=>{const L=xe("outbound",{label:b,unknown:x});let y=m.get(L);if(y)return y;const R=x?void 0:l.get(b),V=x?{groups:[],member:null}:Ye(b,R?.selection.tcp_member_id?"tcp":"udp",l,i,d),B=V.groups.map(I=>({name:I.name,kind:I.policy.kind,policy:I.policy.native})),U=V.member,ne=x?"unknown":b==="direct"||b==="block"?b:B.length?"group":"unknown";return y={id:L,label:b,count:0,unknown:x||void 0,kind:ne,groups:B,node:U&&M(U,t.get(U)??U).id},m.set(L,y),y.node&&v(L,y.node),y},w=(b,x,L=!1)=>{let y=h.get(b);return y||h.set(b,y={id:b,label:x,count:0,unknown:L||void 0,outbound:null,must:!1,fallback:!1}),y};if(o==="rule")for(const b of a){const x=w(xe("rule",{key:b.rule_id,label:b.expression}),b.expression);x.must=b.must,x.fallback=b.kind==="fallback",b.outbound&&(x.outbound=c(b.outbound).id,v(x.id,x.outbound))}const N=[o,"outbound","node"];for(const b of e){let x;for(const L of N){const y=dn(b,L,t,p);if(!y)break;const R=L==="outbound"?c(y.label,y.unknown):L==="node"?M(y.key??y.label,y.label,y.unknown):w(xe(L,y),y.label,y.unknown);R.count++,x&&v(x.id,R.id).count++,x=R}}for(const b of n)c(b.name);const _=new Set([...h.values()].map(b=>b.outbound)),S=new Set([...m.values()].flatMap(b=>b.groups.slice(1).map(x=>x.name))),C=[...m.values()].filter(b=>b.count||_.has(b.id)||!S.has(b.label)),A=new Set(C.map(b=>b.id));return{by:o,leaves:[...h.values()],outbounds:C,nodes:[...u.values()],links:[...f.values()].filter(b=>A.has(b.source)||A.has(b.target))}}const Ge=new WeakMap;function Be(e){const n=Ge.get(e);if(n)return n;const s=new Map,a=new Map,o=new Map;for(const l of e.links){for(const[d,p]of[[s,l.source],[a,l.target]]){let h=d.get(p);h||d.set(p,h=[]),h.push(l)}(!o.has(l.source)||o.get(l.source).count<l.count)&&o.set(l.source,l)}const t=new Map;for(const l of[...e.leaves,...e.outbounds]){const d=("grouLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{r as w,j as r}from"./vendor-react-Bf71BWbF.js";import{cL as He,Y as Je,cM as Ye,cB as Xe,b6 as vn,aY as re,a3 as K,b0 as _n,b1 as Nn,a5 as ee,at as ze,h as Mn,aT as ke,a2 as X,ax as Ln,a4 as oe,cv as Sn,aW as Ze,bj as Rn,$ as W,bi as Cn,G as Tn,cN as en,q as nn,cO as sn,cP as tn,cQ as rn,bb as Pn,cR as In,cS as Hn,y as Dn,cT as Fn,b8 as on,u as E,a as be,bs as En,a8 as le,ac as De,aa as F,ab as an,cU as On,bt as qn,be as me,b as An,X as Le,cV as ln,aH as J,aF as xe,cW as Wn,b9 as Bn,cE as Un,cX as Vn,cY as $n,cZ as Qn,ae as dn,c_ as Gn,c$ as Kn,bd as Jn,d0 as Yn,aK as fe,B,d1 as Xn,ah as we,b5 as te,cA as zn,bB as cn,aJ as ae,I as Zn,E as ie,d2 as es,b4 as je,T as Y,bq as ns,d3 as qe,aQ as ss,cx as ts,c as Ae,f as rs,bm as os,b3 as as,bp as is,j as Fe,aG as ye,L as We,ai as un,bg as ls,br as ds,cK as cs,bC as us}from"./index-BNBwb-FJ.js";import{u as ve,r as ps,a as Ee,b as ms,c as fs}from"./flows-CMFlFH_d.js";import{q as bs}from"./dns-CvJ19DpX.js";import{i as Be}from"./setup-d2VGFWY1.js";import{w as A}from"./labels-Bgu_ZhL8.js";import{g as hs}from"./policyText-CmeXgUK2.js";import{a as gs,t as xs,b as ws,p as pn,r as ys}from"./link-CIkWI7An.js";import{r as ks}from"./nav-DKmRxmdR.js";import{r as js}from"./recorder-DlDpPhd4.js";import{p as vs}from"./probe-BZEn7bbG.js";import{D as _e}from"./Table-DyWJelc_.js";import{D as se}from"./DaeCode-B8yPDjSE.js";import{T as _s}from"./TimeCell-DUt0i0gi.js";import{u as Ns}from"./outbounds-DPmb26w8.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";const Ms=["client","rule","outbound","node"],Ls=e=>new Map(e.map(n=>[n.id,n.name])),Te="\0";function Ss(e,n){return e.rule_id?n.get(e.rule_id)?.expression===e.rule_expression?e.rule_id:e.rule_id+Te+e.rule_expression:void 0}function mn(e,n,s,a){switch(n){case"client":{const t=Je(e.input?.src??void 0);return{label:t??"unknown",unknown:!t}}case"rule":return e.rule_expression?{label:e.rule_expression,unknown:!1,key:Ss(e,a)}:{label:"unknown",unknown:!0};case"outbound":return e.outbound?{label:e.outbound,unknown:!1}:{label:"unknown",unknown:!0};case"node":{if(He(e.outbound))return null;const t=e.chain.at(-1)??null;return t?{label:s.get(t)??t,unknown:!1,key:t}:{label:"unknown",unknown:!0}}}}const pe=(e,n)=>xs(e,n.unknown?"":n.key??n.label),fn=e=>gs(e,Ms)?.kind,Rs=new Map;function bn(e,n,s){const a=fn(n);if(!a)return[];const t=new Map(s.map(o=>[o.rule_id,o]));return e.filter(o=>{const l=mn(o,a,Rs,t);return l!==null&&pe(a,l)===n})}function Cs(e,n,s,a){const t=e.slice(0,e.indexOf(":")),o=e.slice(e.indexOf(":")+1);return o===""?a(null):t==="rule"?o.includes(Te)?o.slice(o.indexOf(Te)+1):n.find(l=>l.rule_id===o)?.expression??o:t==="node"?s.get(o)??o:t==="client"?o:a(o)}function Ts(e,n,s,a,t="rule"){const o=Ls(s),l=new Map(n.map(g=>[g.id,g])),i=new Map(n.map(g=>[g.name,g])),d=new Map(s.map(g=>[g.id,g])),c=new Map(a.map(g=>[g.rule_id,g])),m=new Map,u=new Map,p=new Map,j=new Map,h=(g,x)=>{const M=g+">"+x;let k=j.get(M);return k||j.set(M,k={source:g,target:x,count:0}),k},f=(g,x,M=!1)=>{const k=pe("node",{key:g,label:x,unknown:M});let T=p.get(k);if(!T){const H=M?void 0:d.get(g),R=H&&Xe(H);p.set(k,T={id:k,label:x,count:0,unknown:M||void 0,latency:vn(R),unavailable:R?.state==="unavailable"})}return T},b=(g,x=!1)=>{const M=pe("outbound",{label:g,unknown:x});let k=u.get(M);if(k)return k;const T=x?void 0:i.get(g),H=x?{groups:[],member:null}:Ye(g,T?.selection.tcp_member_id?"tcp":"udp",i,l,d),R=H.groups.map(Q=>({name:Q.name,kind:Q.policy.kind,policy:Q.policy.native})),U=H.member,V=x?"unknown":g==="direct"||g==="block"?g:R.length?"group":"unknown";return k={id:M,label:g,count:0,unknown:x||void 0,kind:V,groups:R,node:U&&f(U,o.get(U)??U).id},u.set(M,k),k.node&&h(M,k.node),k},v=(g,x,M=!1)=>{let k=m.get(g);return k||m.set(g,k={id:g,label:x,count:0,unknown:M||void 0,outbound:null,must:!1,fallback:!1}),k};if(t==="rule")for(const g of a){const x=v(pe("rule",{key:g.rule_id,label:g.expression}),g.expression);x.must=g.must,x.fallback=g.kind==="fallback",g.outbound&&(x.outbound=b(g.outbound).id,h(x.id,x.outbound))}const _=[t,"outbound","node"];for(const g of e){let x;for(const M of _){const k=mn(g,M,o,c);if(!k)break;const T=M==="outbound"?b(k.label,k.unknown):M==="node"?f(k.key??k.label,k.label,k.unknown):v(pe(M,k),k.label,k.unknown);T.count++,x&&h(x.id,T.id).count++,x=T}}for(const g of n)b(g.name);const S=new Set([...m.values()].map(g=>g.outbound)),N=new Set([...u.values()].flatMap(g=>g.groups.slice(1).map(x=>x.name))),P=[...u.values()].filter(g=>g.count||S.has(g.id)||!N.has(g.label)),I=new Set(P.map(g=>g.id));return{by:t,leaves:[...m.values()],outbounds:P,nodes:[...p.values()],links:[...j.values()].filter(g=>I.has(g.source)||I.has(g.target))}}const Ue=new WeakMap;function Oe(e){const n=Ue.get(e);if(n)return n;const s=new Map,a=new Map,t=new Map;for(const i of e.links){for(const[d,c]of[[s,i.source],[a,i.target]]){let m=d.get(c);m||d.set(c,m=[]),m.push(i)}(!t.has(i.source)||t.get(i.source).couLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{r as h,j as i}from"./vendor-react-Bf71BWbF.js";import{Z as L,$ as v,a0 as H,a1 as S,a2 as A,a3 as I,a4 as O,a5 as R,a6 as _,a7 as P,u as E,a as Q,a8 as V,a9 as B,aa as y,ab as D,ac as F,ad as z,ae as G,af as Z,ag as J,T as U,B as w,ah as W,E as X,j as Y,ai as ee,aj as se,ak as ae,al as te,am as ne}from"./index-BNBwb-FJ.js";import{u as re}from"./flows-CMFlFH_d.js";import{d as oe}from"./nav-DuA2h3KP.js";import{r as ie}from"./nav-DKmRxmdR.js";import{s as de}from"./nav-D5WY5Qjf.js";import{c as ce,s as le,a as ue}from"./nav-BeFLfZq8.js";const x=(a,t,e,d,r,o="")=>({hit:{id:t,label:e,description:d,route:r,query:o},keys:a.flatMap(n=>n==null?[]:[n.toLowerCase()])});function pe(a,t,e){const d=s=>_(s,a),r=a?.resources,o=t?.sources.find(s=>s.kind==="main"),n=[...ie(r).map(s=>({path:"rules",params:{tab:s.id},titleKey:s.titleKey})),...oe(r).map(s=>({path:"dns",params:{tab:s.id},titleKey:s.titleKey})),...ce(le(r,o)).map(s=>({path:"config",params:{tab:s.id},titleKey:s.titleKey})),...de(r).map(s=>({path:"settings",params:{card:s.id},titleKey:s.titleKey}))];return[...L.filter(s=>s.nav&&d(s.path)).map(s=>({route:s.path,query:"",title:e(s.nav.titleKey),parent:""})),...n.filter(s=>d(s.path)).map(s=>({route:s.path,query:v("",s.params),title:e(s.titleKey),parent:e(L.find(l=>l.path===s.path).nav.titleKey)}))].map(s=>x([s.title,s.parent&&s.parent+" "+s.title],`page:${s.route}?${s.query}`,s.title,s.parent||void 0,s.route,s.query))}function me(a,t){return H(a).map(e=>x([e.domain,e.dst,e.src],`connection:${e.id}`,e.domain||e.dst||e.src||e.id,S(e,t),"connections",v("",{id:e.id})))}function he(a,t,e){const d=t?.providers??[],r=o=>v("",{provider:P(o,d),q:o.name});return(a??[]).map(o=>x([o.name],`node:${o.id}`,o.name,A(e,o.group_ids)||void 0,"nodes",r(o)))}function fe(a){return(a??[]).map(t=>x([t.name],`group:${t.id}`,t.name,t.policy.native,"policies",v("",{group:t.id})))}function ge(a,t){return(a?.providers??[]).map(e=>x([e.name],`provider:${e.id}`,e.name,t("search.nodeCount",{n:e.node_count}),"nodes",v("",{provider:e.id})))}function be(a,t){return(a?.sources??[]).map(e=>x([e.path],`source:${e.id}`,e.path,I(ue,e.kind,t),"config",v("",{tab:"source",source:e.id})))}function ve(a,t){return(a?.rules??[]).filter(e=>e.kind==="rule").map(e=>x([e.expression,e.outbound],`rule:${e.rule_id}`,e.expression,`#${O(e.index+1,R[t])} → ${e.outbound}`,"rules",v("",{tab:"list",rule:e.rule_id})))}function xe(a,t,e){return{sections:[{id:"pages",title:e("search.pages"),entries:a.pages},{id:"conns",title:e("nav.connections"),entries:a.conns},{id:"nodes",title:e("search.nodes"),entries:a.nodes},{id:"groups",title:e("search.groups"),entries:a.groups},{id:"providers",title:e("search.providers"),entries:a.providers},{id:"sources",title:e("search.sources"),entries:a.sources},{id:"rules",title:e("nav.rules"),entries:a.rules}],partial:t?.truncated?e("conn.truncated"):null}}function ye(a,t){const e=a.trim().toLowerCase(),d=e?8:5,r=new Map;return{sections:t.sections.map(n=>{const c=[];for(const{hit:s,keys:l}of n.entries){if(c.length===d)break;l.some(f=>f.includes(e))&&(c.push(s),r.set(s.id,s))}return{id:n.id,title:n.title,items:c}}).filter(n=>n.items.length>0),byId:r,partial:t.partial}}function $e(a,t){const e=E(),d=Q(),[r,o]=h.useState(""),n=V(),c=n.data?.resources,s=B(void 0,y(c,"connections",{whileLoading:!1})),l=D(y(c,"nodes",{whileLoading:!1})),f=F(y(c,"groups",{whileLoading:!1})),g=z(y(c,"providers",{whileLoading:!1})),b=G(y(c,"config",{whileLoading:!1})),u=re(y(c,"rules",{whileLoading:!1})),p=[n,s,l,f,g,b,u],K=h.useMemo(()=>pe(n.data,b.data,e),[n.data,b.data,e]),C=h.useMemo(()=>me(s.data,e),[s.data,e]),M=h.useMemo(()=>he(l.data,g.data,d),[l.data,g.data,d]),q=h.useMemo(()=>fe(f.data),[f.data]),N=h.useMemo(()=>ge(g.data,e),[g.data,e]),T=h.useMemo(()=>be(b.data,e),[b.data,e]),k=h.useMemo(()=>ve(u.data,d),[u.data,d]),$=ye(r,xe({pages:K,conns:C,nodes:M,groups:q,providers:N,sources:T,rules:k},s.data,e));return{q:r,setQ:o,sections:$.sections,partial:$.partial,openConnections:()=>{a("connections"),t()},empty:$.byId.size===0,error:p.find(m=>m.error)?.error,retry:()=>p.forEach(m=>m.error&&m.refetch()),loading:p.some(m=>m.loading&&!m.data),select:m=>{const j=$.byId.get(String(m));j&&(a(j.route,j.query),t())}}}function qe({onClose:a,go:t}){const e=E(),{q:d,setQ:r,sections:o,partial:n,openConnections:c,empty:s,error:l,retry:f,loading:g,select:b}=$e(t,a);return i.jsx(Z,{title:e("search"),hideTitle:!0,isOpen:!0,onOpenChange:u=>{u||a()},children:i.jsxs(J,{inputValue:d,onInputChange:r,children:[i.jsxs("div",{className:"rp-toolbar",children:[i.jsx(U,{search:!0,large:!0,label:e("search"),value:d,onChange:r,autoFocus:!0,className:"rp-grow"}),i.jsx(w,{quiet:!0,icon:!0,onPress:a,label:e("close"),children:i.jsx(W,{})})]}),l&&i.jsx(X,{error:l,onRetry:f}),n&&i.jsxs("div",{className:"rp-note",role:"status",children:[n,i.jsx(w,{small:!0,quiet:!0,onPress:c,children:e("nav.connections")})]}),s&&(g?i.jsx(Y,{}):i.jsx(ee,{children:e("search.none")})),i.jsx(se,{"aria-label":e("search")Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{r as h,j as i}from"./vendor-react-Bf71BWbF.js";import{W as L,X as v,Y as H,Z as S,$ as A,a0 as I,a1 as O,a2 as R,a3 as _,a4 as P,u as E,a as Q,a5 as V,a6 as B,a7 as y,a8 as D,a9 as F,aa as z,ab as G,ac as W,ad as X,T as Y,B as w,ae as Z,E as J,j as U,af as ee,ag as se,ah as ae,ai as te,aj as ne}from"./index-CXHBmSa5.js";import{u as re}from"./flows-C0byZ3sY.js";import{d as oe}from"./nav-C2A1sZKm.js";import{r as ie}from"./nav-D1cfWFA0.js";import{s as de}from"./nav-BIpfWn6-.js";import{c as ce,s as ue,a as le}from"./nav-BeFLfZq8.js";const x=(a,t,e,d,r,o="")=>({hit:{id:t,label:e,description:d,route:r,query:o},keys:a.flatMap(n=>n==null?[]:[n.toLowerCase()])});function pe(a,t,e){const d=s=>_(s,a),r=a?.resources,o=t?.sources.find(s=>s.kind==="main"),n=[...ie(r).map(s=>({path:"rules",params:{tab:s.id},titleKey:s.titleKey})),...oe(r).map(s=>({path:"dns",params:{tab:s.id},titleKey:s.titleKey})),...ce(ue(r,o)).map(s=>({path:"config",params:{tab:s.id},titleKey:s.titleKey})),...de(r).map(s=>({path:"settings",params:{card:s.id},titleKey:s.titleKey}))];return[...L.filter(s=>s.nav&&d(s.path)).map(s=>({route:s.path,query:"",title:e(s.nav.titleKey),parent:""})),...n.filter(s=>d(s.path)).map(s=>({route:s.path,query:v("",s.params),title:e(s.titleKey),parent:e(L.find(u=>u.path===s.path).nav.titleKey)}))].map(s=>x([s.title,s.parent&&s.parent+" "+s.title],`page:${s.route}?${s.query}`,s.title,s.parent||void 0,s.route,s.query))}function me(a,t){return H(a).map(e=>x([e.domain,e.dst,e.src],`connection:${e.id}`,e.domain||e.dst||e.src||e.id,S(e,t),"connections",v("",{id:e.id})))}function he(a,t,e){const d=t?.providers??[],r=o=>v("",{provider:P(o,d),q:o.name});return(a??[]).map(o=>x([o.name],`node:${o.id}`,o.name,A(e,o.group_ids)||void 0,"nodes",r(o)))}function fe(a){return(a??[]).map(t=>x([t.name],`group:${t.id}`,t.name,t.policy.native,"policies",v("",{group:t.id})))}function ge(a,t){return(a?.providers??[]).map(e=>x([e.name],`provider:${e.id}`,e.name,t("search.nodeCount",{n:e.node_count}),"nodes",v("",{provider:e.id})))}function be(a,t){return(a?.sources??[]).map(e=>x([e.path],`source:${e.id}`,e.path,I(le,e.kind,t),"config",v("",{tab:"source",source:e.id})))}function ve(a,t){return(a?.rules??[]).filter(e=>e.kind==="rule").map(e=>x([e.expression,e.outbound],`rule:${e.rule_id}`,e.expression,`#${O(e.index+1,R[t])} → ${e.outbound}`,"rules",v("",{tab:"list",rule:e.rule_id})))}function xe(a,t,e){return{sections:[{id:"pages",title:e("search.pages"),entries:a.pages},{id:"conns",title:e("nav.connections"),entries:a.conns},{id:"nodes",title:e("search.nodes"),entries:a.nodes},{id:"groups",title:e("search.groups"),entries:a.groups},{id:"providers",title:e("search.providers"),entries:a.providers},{id:"sources",title:e("search.sources"),entries:a.sources},{id:"rules",title:e("nav.rules"),entries:a.rules}],partial:t?.truncated?e("conn.truncated"):null}}function ye(a,t){const e=a.trim().toLowerCase(),d=e?8:5,r=new Map;return{sections:t.sections.map(n=>{const c=[];for(const{hit:s,keys:u}of n.entries){if(c.length===d)break;u.some(f=>f.includes(e))&&(c.push(s),r.set(s.id,s))}return{id:n.id,title:n.title,items:c}}).filter(n=>n.items.length>0),byId:r,partial:t.partial}}function $e(a,t){const e=E(),d=Q(),[r,o]=h.useState(""),n=V(),c=n.data?.resources,s=B(void 0,y(c,"connections",{whileLoading:!1})),u=D(y(c,"nodes",{whileLoading:!1})),f=F(y(c,"groups",{whileLoading:!1})),g=z(y(c,"providers",{whileLoading:!1})),b=G(y(c,"config",{whileLoading:!1})),l=re(y(c,"rules",{whileLoading:!1})),p=[n,s,u,f,g,b,l],K=h.useMemo(()=>pe(n.data,b.data,e),[n.data,b.data,e]),C=h.useMemo(()=>me(s.data,e),[s.data,e]),M=h.useMemo(()=>he(u.data,g.data,d),[u.data,g.data,d]),q=h.useMemo(()=>fe(f.data),[f.data]),N=h.useMemo(()=>ge(g.data,e),[g.data,e]),T=h.useMemo(()=>be(b.data,e),[b.data,e]),k=h.useMemo(()=>ve(l.data,d),[l.data,d]),$=ye(r,xe({pages:K,conns:C,nodes:M,groups:q,providers:N,sources:T,rules:k},s.data,e));return{q:r,setQ:o,sections:$.sections,partial:$.partial,openConnections:()=>{a("connections"),t()},empty:$.byId.size===0,error:p.find(m=>m.error)?.error,retry:()=>p.forEach(m=>m.error&&m.refetch()),loading:p.some(m=>m.loading&&!m.data),select:m=>{const j=$.byId.get(String(m));j&&(a(j.route,j.query),t())}}}function qe({onClose:a,go:t}){const e=E(),{q:d,setQ:r,sections:o,partial:n,openConnections:c,empty:s,error:u,retry:f,loading:g,select:b}=$e(t,a);return i.jsx(W,{title:e("search"),hideTitle:!0,isOpen:!0,onOpenChange:l=>{l||a()},children:i.jsxs(X,{inputValue:d,onInputChange:r,children:[i.jsxs("div",{className:"rp-toolbar",children:[i.jsx(Y,{search:!0,large:!0,label:e("search"),value:d,onChange:r,autoFocus:!0,className:"rp-grow"}),i.jsx(w,{quiet:!0,icon:!0,onPress:a,label:e("close"),children:i.jsx(Z,{})})]}),u&&i.jsx(J,{error:u,onRetry:f}),n&&i.jsxs("div",{className:"rp-note",role:"status",children:[n,i.jsx(w,{small:!0,quiet:!0,onPress:c,children:e("nav.connections")})]}),s&&(g?i.jsx(U,{}):i.jsx(ee,{children:e("search.none")})),i.jsx(se,{"aria-label":e("search"),clLine truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{r as b,a as Je,j as t}from"./vendor-react-Bf71BWbF.js";import{a1 as ie,ap as ce,A as Ne,dK as Ye,u as M,dL as Xe,cA as He,dM as Be,n as ve,i as xe,bb as L,o as Re,dN as Ze,w as es,aU as ss,dO as ts,a5 as pe,ay as as,dP as ns,dQ as rs,r as os,dR as is,b as J,dS as ls,dT as ds,a2 as Se,a as Ce,cQ as Ge,a0 as cs,dF as us,aG as se,E as q,j as ue,I as gs,b2 as G,T as ae,aC as ke,bx as ne,B as I,av as ps,a7 as je,aa as fs,d7 as ms,dU as hs,bd as bs,az as vs,dV as Oe,bg as xs,bk as Le,aE as Ae,am as js,an as ys,dW as ws,dX as Ns,a9 as ks,$ as _s,cO as Ss,cw as Me,du as Cs,cG as Ps,aD as Rs,cW as ge,dY as De,dZ as Ls,bj as As,d_ as Ds}from"./index-CXHBmSa5.js";import{d as Ts,c as Is}from"./auth-BGnwk8Hi.js";import{c as Es,a as te,g as ze}from"./nav-BIpfWn6-.js";import{D as Us}from"./Table-D0NFHHNQ.js";import{T as Fs}from"./TimeCell-gSIuLEFc.js";import{A as Hs}from"./ActionGroup-90AzAQje.js";import{c as Bs}from"./dns-DQrpG8y_.js";import{g as le,m as Gs,v as Os}from"./geodata-DprMPspn.js";import"./useGridSelectionCheckbox-BV96yL-N.js";import"./Virtualizer--Vfl8O3n.js";import"./ListLayout-CPapuywx.js";const Te=["record_flows","record_logs","record_dns_log"],_e={record_flows:{state:"flows",label:"settings.recordFlows"},record_logs:{state:"logs",label:"settings.recordLogs"},record_dns_log:{state:"dns_log",label:"settings.recordDnsLog"}},Ms={auto:"settings.record.auto",on:"settings.record.on",off:"settings.record.off"},zs=s=>s==="auto"?"auto":s==="on";function Vs(s,e,a,n){const r=a?!a.allowed:!1;return{id:s,label:n(_e[s].label),value:e,items:["auto","on","off"].map(l=>({id:l,label:n(Ms[l])})),disabled:r,tone:r?"muted":a?.active?"ok":"neutral",status:n(r?"settings.recordingForbidden":a?.active?"settings.recordingActive":"settings.recordingIdle")}}function qs(s,e){return s?s.grace_remaining_seconds>0?e("settings.recordingGrace",{n:s.grace_remaining_seconds}):e(s.events.active?"settings.recordingEvents":"settings.recordingDetached"):null}const Ks=["log.buffered_records","dns_log.max_records","flows.max_flows","flows.retention_seconds"],de={"log.buffered_records":{read:s=>s.log.buffered_records,write:(s,e)=>{(s.log??={}).buffered_records=e},floor:64,label:"settings.logBuffer"},"dns_log.max_records":{read:s=>s.dns_log.max_records,write:(s,e)=>{(s.dns_log??={}).max_records=e},floor:64,label:"settings.dnsLogSize"},"flows.max_flows":{read:s=>s.flows.max_flows,write:(s,e)=>{(s.flows??={}).max_flows=e},floor:64,label:"settings.flowsMax"},"flows.retention_seconds":{read:s=>s.flows.retention_seconds,write:(s,e)=>{(s.flows??={}).retention_seconds=e},floor:1,label:"settings.flowsRetention"}};function Ws(s,e,a,n,r){const l=de[s];return{id:s,value:e,label:r(l.label),invalid:!/^\d+$/.test(e)||Number(e)<l.floor||a!==void 0&&Number(e)>a,description:a===void 0?r("settings.rangeMin",{min:ie(l.floor,n)}):r("settings.range",{min:ie(l.floor,n),max:ie(a,n)})}}function $s(s,e){return s.map(a=>({id:a.kind,kind:a.kind,size:ce(a.size_bytes,e),modifiedAt:a.modified_at,sha:a.sha256.slice(0,12),shaTitle:a.sha256,source:a.source_redacted??"—",fetched:a.fetched_url_redacted??"—",verified:a.verified===!0}))}function Qs(s,e,a){return{choices:s.map(n=>({id:n.id,label:n.name})),result:e?{text:a(e.key,e.params),role:e.error?"alert":"status",request:e.requestId?a("ui.requestNote",{id:e.requestId}):"",error:!!e.error,id:e.id??0}:null}}function Js(s,e){return s?null:e("settings.noProfile")}function Ys({busy:s,invalid:e,changed:a},n){return s?null:e?n("settings.runtimeInvalid",{field:e}):a?null:n("config.noChanges")}function Xs({ready:s,busy:e,count:a},n){return s&&!e&&!a?n("settings.noSubscriptions"):null}function Ve({busy:s,loaded:e,failed:a},n){return!s&&!e&&a?n("settings.geodataUnread"):null}function Zs(s,e){return s.flatMap(a=>a.items).find(a=>a.id===e)?.label??e}function et(s,e,a,n,r=""){return e.aborted&&e.reason?.name==="TimeoutError"?{key:"settings.timeout"}:e.aborted?null:s instanceof Ne?s.status===401?{key:r?"settings.tokenRejected":"settings.unauthorized"}:s.code==="empty_response"?{key:"settings.nonJson"}:s.code==="invalid_discovery"?{key:"settings.invalidResponse"}:{key:"settings.httpError",params:{status:s.status}}:s instanceof SyntaxError?{key:"settings.nonJson"}:s instanceof TypeError&&new URL(a).origin!==n?{key:"settings.cors"}:{key:"settings.network"}}async function st(s,e,a,n){try{const r=await Ye(s,e).discovery(a);if(!r||!Number.isInteger(r.api_major)||r.api_major<1)throw new Ne(200,"invalid_discovery","Missing API version");return{version:String(r.api_major),password:r.auth?.mode==="password"}}catch(r){const l=et(r,a,s,n,e);return l&&{failure:l,requestId:r instanceof Ne?r.requestId:null}}}function tt(){const[s,e]=b.useState(!1),a=b.useRef(null),n=b.useCallback(()=>{const o=a.current;a.current=null,o?.abort()},[]);b.useEffect(()=>n,[n]);const r=b.useCallback(()=>{n(),e(!1)},[n]);return{pending:s,running:()=>a.current!==null,cancel:r,run:async(o,d,y)=>{const m=new AbortController;a.current=m;const f=setTimeout(()=>m.abort(new DOMExLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{r as b,a as Ze,j as t}from"./vendor-react-Bf71BWbF.js";import{as as ue,dr as es,a2 as Me,h as ss,d as ts,a4 as le,A as Ne,dT as as,u as z,dU as ns,cE as Ve,dV as ze,n as xe,i as je,be as D,o as Ae,dW as rs,w as os,aX as is,dX as ls,a8 as fe,aB as qe,dY as cs,dZ as ds,r as us,d_ as gs,b as X,d$ as ps,e0 as fs,a5 as Pe,a as Re,c_ as Ke,a3 as ms,dO as hs,aJ as te,E as K,j as ge,I as bs,b5 as V,T as re,aF as _e,bB as oe,B as F,ay as vs,aa as ye,ad as xs,dg as js,e1 as ys,bh as ws,aC as ks,e2 as We,bk as Ns,bo as Te,L as Ie,aH as Ee,ap as _s,aq as Cs,e3 as Ss,e4 as Ps,ac as Rs,cV as Ls,cA as Ce,dD as Ds,cK as As,aG as Ts,d2 as pe,e5 as Fe,e6 as Is,e7 as Es,bn as Fs}from"./index-BNBwb-FJ.js";import{d as Us,c as Hs}from"./auth-TcOYUrrj.js";import{g as Le,c as Bs,a as ae,b as Os}from"./nav-D5WY5Qjf.js";import{D as Gs}from"./Table-DyWJelc_.js";import{T as Ms}from"./TimeCell-DUt0i0gi.js";import{A as Vs}from"./ActionGroup-BKxDwmnT.js";import{c as zs}from"./dns-CvJ19DpX.js";import{g as ce,m as qs,v as Ks}from"./geodata-DprMPspn.js";import"./useGridSelectionCheckbox-CrCOlZv8.js";import"./Virtualizer-DipGMcji.js";import"./ListLayout-F74Z1Dpf.js";const Ue=["record_flows","record_logs","record_dns_log"],Se={record_flows:{state:"flows",label:"settings.recordFlows"},record_logs:{state:"logs",label:"settings.recordLogs"},record_dns_log:{state:"dns_log",label:"settings.recordDnsLog"}},Ws={auto:"settings.record.auto",on:"settings.record.on",off:"settings.record.off"},$s=s=>s==="auto"?"auto":s==="on";function Js(s,e,a,n){const r=a?!a.allowed:!1;return{id:s,label:n(Se[s].label),value:e,items:["auto","on","off"].map(o=>({id:o,label:n(o==="auto"&&s==="record_flows"?"settings.record.autoFlows":Ws[o])})),disabled:r,tone:r?"muted":a?.active?"ok":"neutral",status:n(r?"settings.recordingForbidden":a?.active?"settings.recordingActive":"settings.recordingIdle")}}function Qs(s,e){return s?s.grace_remaining_seconds>0?e("settings.recordingGrace",{n:s.grace_remaining_seconds}):e(s.events.active?"settings.recordingEvents":"settings.recordingDetached"):null}const Xs=60,Ys=(s,e)=>s==="auto"?e("settings.recordFlowsAuto",{n:Xs}):null,Zs=["log.buffered_records","dns_log.max_records","flows.max_flows","flows.retention_seconds"],de={"log.buffered_records":{read:s=>s.log.buffered_records,write:(s,e)=>{(s.log??={}).buffered_records=e},floor:64,label:"settings.logBuffer"},"dns_log.max_records":{read:s=>s.dns_log.max_records,write:(s,e)=>{(s.dns_log??={}).max_records=e},floor:64,label:"settings.dnsLogSize"},"flows.max_flows":{read:s=>s.flows.max_flows,write:(s,e)=>{(s.flows??={}).max_flows=e},floor:64,label:"settings.flowsMax"},"flows.retention_seconds":{read:s=>s.flows.retention_seconds,write:(s,e)=>{(s.flows??={}).retention_seconds=e},floor:1,label:"settings.flowsRetention"}};function et(s,e,a,n,r){const o=de[s];return{id:s,value:e,label:r(o.label),invalid:!/^\d+$/.test(e)||Number(e)<o.floor||a!==void 0&&Number(e)>a,description:a===void 0?r("settings.rangeMin",{min:le(o.floor,n)}):r("settings.range",{min:le(o.floor,n),max:le(a,n)})}}function st(s,e){return s.map(a=>({id:a.kind,kind:a.kind,size:ue(a.size_bytes,e),modifiedAt:a.modified_at,sha:a.sha256.slice(0,12),shaTitle:a.sha256,source:a.source_redacted??"—",fetched:a.fetched_url_redacted??"—",verified:a.verified===!0}))}function tt(s,e,a){return{choices:s.map(n=>({id:n.id,label:n.name})),result:e?{text:a(e.key,e.params),role:e.error?"alert":"status",request:e.requestId?a("ui.requestNote",{id:e.requestId}):"",error:!!e.error,id:e.id??0}:null}}function at(s,e){return s?null:e("settings.noProfile")}function nt({busy:s,invalid:e,changed:a},n){return s?null:e?n("settings.runtimeInvalid",{field:e}):a?null:n("config.noChanges")}function rt({ready:s,busy:e,count:a},n){return s&&!e&&!a?n("settings.noSubscriptions"):null}function $e({busy:s,loaded:e,failed:a},n){return!s&&!e&&a?n("settings.geodataUnread"):null}function ot(s,e,a,n){const r=s?.resources;if(!r?.geodata.available||r.geodata.can_update!==!0||Le(r))return null;const o=es(e),i=o.reason("geodata",s);if(i?.code!=="no-download-urls")return null;const l=Me(n,i.settings.map(j=>o.settingName(j.key)));return{text:a("settings.geodataFromConfig",{keys:l}),docs:{href:ts(n,"state-db"),text:a("ov.lim.docsStateDb")},config:r.config.available?{href:ss("config",{tab:"source"}),text:a("nav.config")}:void 0}}function it(s,e){return s.flatMap(a=>a.items).find(a=>a.id===e)?.label??e}function lt(s,e,a,n,r=""){return e.aborted&&e.reason?.name==="TimeoutError"?{key:"settings.timeout"}:e.aborted?null:s instanceof Ne?s.status===401?{key:r?"settings.tokenRejected":"settings.unauthorized"}:s.code==="empty_response"?{key:"settings.nonJson"}:s.code==="invalid_discovery"?{key:"settings.invalidResponse"}:{key:"settings.httpError",params:{status:s.status}}:s instanceof SyntaxError?{key:"settings.nonJson"}:s instanceof TypeError&&new URL(a).origin!==n?{key:"settings.cors"}:{key:"settings.network"}}async function ct(s,e,a,n){try{const r=await as(s,e).discovery(a);if(!r||!Line truncated
|
||||
@@ -1 +1 @@
|
||||
import{r as x,j as r}from"./vendor-react-Bf71BWbF.js";import{aB as k,eH as P,eI as B}from"./index-CXHBmSa5.js";import{u as S,C as T,f as W,n as v,g as j}from"./layout-BRLew_nj.js";import{G as H,C as I}from"./AreaCurve-BriPYJva.js";import"./array-C0P64tl-.js";function L(i){let t=i.parentElement;for(;t&&getComputedStyle(t).overflow==="visible";)t=t.parentElement;const l=i.getBoundingClientRect();if(!t)return{x:-l.left,y:-l.top,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight};const h=t.getBoundingClientRect();return{x:h.left+t.clientLeft-l.left,y:h.top+t.clientTop-l.top,width:t.clientWidth,height:t.clientHeight}}function A({values:i,timestamps:t,color:l,fmt:h,locale:p,height:f=32,floor:m=0}){const g=x.useId(),C=k(),[o,w]=x.useState(null),[u,e]=P(Math.round,120),{tip:M,showAt:b,hide:E}=S(),c=i.filter(n=>n!==null),y=[m>0?0:Math.min(...c)*.85,Math.max(Math.max(...c)*1.05||1,m)],d=n=>j(n,[Math.min(...t),Math.max(...t)],[0,e?.width??0]),a=n=>j(n,y,[(e?.height??f)-2,2]);return x.useLayoutEffect(()=>{if(o===null||i[o]==null||!h||!p||!u.current||!e){E();return}b({x:d(t[o]),y:a(i[o]),width:e.width,bounds:L(u.current),label:B(p).format(t[o]),lines:[h(i[o])]})}),r.jsx("div",{ref:u,style:{height:f,width:"100%",position:"relative"},"aria-hidden":c.length?!0:void 0,onPointerLeave:()=>w(null),children:c.length>0&&e&&r.jsxs(r.Fragment,{children:[r.jsx(T,{tip:M}),r.jsxs("svg",{className:"rp-activity-surface",width:e.width,height:e.height,viewBox:`0 0 ${e.width} ${e.height}`,style:{display:"block"},onPointerMove:n=>{const s=W(n,n.currentTarget,e);w(s.x<0||s.x>e.width||s.y<2||s.y>e.height-2?null:v(t.map(d),s.x))},children:[r.jsx("defs",{children:r.jsx(H,{id:g,color:l})}),r.jsx(I,{points:i.map((n,s)=>n===null?null:{x:d(t[s]),y:a(n)}),baseline:a(Math.max(0,y[0])),color:l,id:g,strokeWidth:1.5}),o!==null&&i[o]!=null&&r.jsx("circle",{cx:d(t[o]),cy:a(i[o]),r:4,fill:l,stroke:C.base,strokeWidth:2})]})]})})}export{A as SparkPlot};
|
||||
import{r as x,j as r}from"./vendor-react-Bf71BWbF.js";import{aE as k,eQ as P,eR as S}from"./index-BNBwb-FJ.js";import{u as T,C as B,f as R,n as W,g as j}from"./layout-wfdMYi2n.js";import{G as v,C as L}from"./AreaCurve-BriPYJva.js";import"./array-C0P64tl-.js";function z(i){let t=i.parentElement;for(;t&&getComputedStyle(t).overflow==="visible";)t=t.parentElement;const l=i.getBoundingClientRect();if(!t)return{x:-l.left,y:-l.top,width:document.documentElement.clientWidth,height:document.documentElement.clientHeight};const h=t.getBoundingClientRect();return{x:h.left+t.clientLeft-l.left,y:h.top+t.clientTop-l.top,width:t.clientWidth,height:t.clientHeight}}function A({values:i,timestamps:t,color:l,fmt:h,locale:p,height:f=32,floor:m=0}){const g=x.useId(),C=k(),[o,w]=x.useState(null),[u,e]=P(Math.round,120),{tip:E,showAt:M,hide:b}=T(),c=i.filter(n=>n!==null),y=[m>0?0:Math.min(...c)*.85,Math.max(Math.max(...c)*1.05||1,m)],d=n=>j(n,[Math.min(...t),Math.max(...t)],[0,e?.width??0]),a=n=>j(n,y,[(e?.height??f)-2,2]);return x.useLayoutEffect(()=>{if(o===null||i[o]==null||!h||!p||!u.current||!e){b();return}M({x:d(t[o]),y:a(i[o]),width:e.width,bounds:z(u.current),label:S(p).format(t[o]),lines:[h(i[o])]})}),r.jsx("div",{ref:u,style:{height:f,width:"100%",position:"relative"},"aria-hidden":c.length?!0:void 0,onPointerLeave:()=>w(null),children:c.length>0&&e&&r.jsxs(r.Fragment,{children:[r.jsx(B,{tip:E}),r.jsxs("svg",{className:"rp-activity-surface",width:e.width,height:e.height,viewBox:`0 0 ${e.width} ${e.height}`,style:{display:"block"},onPointerMove:n=>{const s=R(n,n.currentTarget,e);w(s.x<0||s.x>e.width||s.y<2||s.y>e.height-2?null:W(t.map(d),s.x))},children:[r.jsx("defs",{children:r.jsx(v,{id:g,color:l})}),r.jsx(L,{points:i.map((n,s)=>n===null?null:{x:d(t[s]),y:a(n)}),baseline:a(Math.max(0,y[0])),color:l,id:g,strokeWidth:1.5}),o!==null&&i[o]!=null&&r.jsx("circle",{cx:d(t[o]),cy:a(i[o]),r:4,fill:l,stroke:C.base,strokeWidth:2})]})]})})}export{A as SparkPlot};
|
||||
@@ -1 +1 @@
|
||||
import{r as f,$,b as Vt,j as E}from"./vendor-react-Bf71BWbF.js";import{e6 as Ot,e7 as He,e8 as Ut,e9 as Qe,bR as ee,ea as _t,eb as ie,ec as he,ed as ht,ee as N,ef as jt,eg as Yt,eh as ft,ei as Xt,ej as Ke,cg as yt,bF as ae,ek as Gt,bB as Be,bD as Y,bT as fe,bC as qt,bE as L,el as D,em as be,en as Le,eo as Qt,bH as pt,bN as Pe,bK as Je,bL as ve,bM as Ie,bO as Z,bS as Jt,bP as de,bQ as ce,ep as gt,eq as Zt,er as Ze,bI as el,es as tl,bJ as ll,et as il,eu as rl,c3 as Se,bU as bt,bW as Ve,bV as nl,ev as Oe,c0 as H,b_ as me,c4 as le,cl as ol,ew as al,ca as et,b$ as se,ex as sl,ch as dl,c2 as ye,c6 as Me,cj as cl,cb as ul,ci as hl,ck as fl,cm as yl,ey as pl,c1 as Ce,bX as Ue,c9 as mt,c5 as W,ez as $t,c7 as gl,cc as bl,cd as ze,eA as tt,eB as ml,eC as $l,eD as De,eE as xl,cn as wl,co as vl,cp as Cl,u as xt,aN as lt,f as kl,j as Kl,af as Il,bh as Rl,dY as wt,c as vt,eF as Sl,eG as Ml,aE as Dl}from"./index-CXHBmSa5.js";import{$ as El,a as Pl,e as zl,b as Tl,c as Ct,d as kt}from"./useGridSelectionCheckbox-BV96yL-N.js";import{a as Nl,c as oe,b as ue,d as Hl}from"./Virtualizer--Vfl8O3n.js";import{$ as Wl}from"./ListLayout-CPapuywx.js";function Fl(n){let{onMoveStart:e,onMove:t,onMoveEnd:l}=n,i=f.useRef({didMove:!1,lastPosition:null,id:null}),{addGlobalListener:r,removeGlobalListener:o}=Ot(),s=f.useCallback((y,g,p,h)=>{p===0&&h===0||(i.current.didMove||(i.current.didMove=!0,e?.({type:"movestart",pointerType:g,shiftKey:y.shiftKey,metaKey:y.metaKey,ctrlKey:y.ctrlKey,altKey:y.altKey})),t?.({type:"move",pointerType:g,deltaX:p,deltaY:h,shiftKey:y.shiftKey,metaKey:y.metaKey,ctrlKey:y.ctrlKey,altKey:y.altKey}))},[e,t,i]),a=He(s),d=f.useCallback((y,g)=>{Ut(),i.current.didMove&&l?.({type:"moveend",pointerType:g,shiftKey:y.shiftKey,metaKey:y.metaKey,ctrlKey:y.ctrlKey,altKey:y.altKey})},[l,i]),c=He(d);return{moveProps:f.useMemo(()=>{let y={},g=()=>{_t(),i.current.didMove=!1};{let h=b=>{if(b.pointerId===i.current.id){let k=b.pointerType||"mouse";a(b,k,b.pageX-(i.current.lastPosition?.pageX??0),b.pageY-(i.current.lastPosition?.pageY??0)),i.current.lastPosition={pageX:b.pageX,pageY:b.pageY}}},x=b=>{if(b.pointerId===i.current.id){let k=b.pointerType||"mouse";c(b,k),i.current.id=null;let w=Qe(ee(b));o(w,"pointermove",h,!1),o(w,"pointerup",x,!1),o(w,"pointercancel",x,!1)}};y.onPointerDown=b=>{if(b.button===0&&i.current.id==null){g(),b.stopPropagation(),b.preventDefault(),i.current.lastPosition={pageX:b.pageX,pageY:b.pageY},i.current.id=b.pointerId;let k=Qe(ee(b));r(k,"pointermove",h,!1),r(k,"pointerup",x,!1),r(k,"pointercancel",x,!1)}}}let p=(h,x,b)=>{g(),a(h,"keyboard",x,b),c(h,"keyboard")};return y.onKeyDown=h=>{switch(h.key){case"Left":case"ArrowLeft":h.preventDefault(),h.stopPropagation(),p(h,-1,0);break;case"Right":case"ArrowRight":h.preventDefault(),h.stopPropagation(),p(h,1,0);break;case"Up":case"ArrowUp":h.preventDefault(),h.stopPropagation(),p(h,0,-1);break;case"Down":case"ArrowDown":h.preventDefault(),h.stopPropagation(),p(h,0,1);break}},y},[r,o,i])}}const it=10,rt=5;class Al{setup(e,t,l){this.delegate=e,this.state=t,this.direction=l}getDropTargetFromPoint(e,t,l){let i=this.delegate.getDropTargetFromPoint(e,t,l);return!i||i.type==="root"?i:this.resolveDropTarget(i,e,t,l)}resolveDropTarget(e,t,l,i){let r=this.pointerTracking,o=l-r.lastY,s=t-r.lastX,a=r.yDirection,d=r.xDirection;if(Math.abs(o)>rt&&(a=o>0?"down":"up",r.yDirection=a,r.lastY=l),Math.abs(s)>it&&(d=s>0?"right":"left",r.xDirection=d,r.lastX=t),e.dropPosition==="before"){let y=this.state.collection.getKeyBefore(e.key);for(;y!=null;){let g=this.state.collection.getItem(y);if(g?.type==="item")break;y=g?.parentKey??null}if(y!=null){let g={type:"item",key:y,dropPosition:"after"};i(g)&&(e=g)}}let c=this.getPotentialTargets(e,i);if(c.length===0)return{type:"root"};let u;return c.length>1?u=this.selectTarget(c,e,t,l,a,d):(u=c[0],r.boundaryContext=null),u}getPotentialTargets(e,t){if(e.dropPosition==="on")return[e];let l=e,i=this.state.collection,r=i.getItem(l.key);for(;r&&r?.type!=="item"&&r.nextKey!=null;)l.key=r.nextKey,r=i.getItem(r.nextKey);let o=[l];if(r&&r.hasChildNodes&&this.state.expandedKeys.has(r.key)&&i.getChildren&&l.dropPosition==="after"){let d=r.firstChildKey!=null?i.getItem(r.firstChildKey):null;for(;d&&d.type!=="item";)d=d.nextKey!=null?i.getItem(d.nextKey):null;if(d?.type==="item"){const c={type:"item",key:d.key,dropPosition:"before"};return t(c)?[c]:[]}}if(r?.nextKey!=null)return[e];let s=r?.parentKey,a=[];for(;s!=null;){let d=i.getItem(s),c=d?.nextKey!=null?i.getItem(d.nextKey):null;if(!c||c.parentKey!==s){if(d?.type==="item"){let y={type:"item",key:s,dropPosition:"after"};t(y)&&a.push(y)}if(c)break}s=d?.parentKey}if(a.length>0&&o.push(...a),o.length===1){let d=i.getKeyAfter(l.key),c=d!=null?i.getItem(d):null;if(d!=null&&c&&r&&c.level!=null&&r.level!=null&&c.level>r.level){let u={type:"item",key:d,dropPosition:"before"};if(t(u))return[u]}}return o.filter(t)}selectTarget(e,t,l,i,r,o){if(e.length<2)return e[0];let s=this.pointerTracking,d=this.state.collectionLine truncated
|
||||
import{r as f,$,b as Vt,j as E}from"./vendor-react-Bf71BWbF.js";import{ef as Ot,eg as He,eh as Ut,ei as Qe,bV as ee,ej as _t,ek as ie,el as he,em as ht,en as N,eo as jt,ep as Yt,eq as ft,er as Xt,es as Ke,ck as yt,bJ as ae,et as Gt,bF as Be,bH as Y,bX as fe,bG as qt,bI as L,eu as D,ev as be,ew as Le,ex as Qt,bL as pt,bR as Pe,bO as Je,bP as ve,bQ as Ie,bS as Z,bW as Jt,bT as de,bU as ce,ey as gt,ez as Zt,eA as Ze,bM as el,eB as tl,bN as ll,eC as il,eD as rl,c7 as Se,bY as bt,b_ as Ve,bZ as nl,eE as Oe,c4 as H,c2 as me,c8 as le,cp as ol,eF as al,ce as et,c3 as se,eG as sl,cl as dl,c6 as ye,ca as Me,cn as cl,cf as ul,cm as hl,co as fl,cq as yl,eH as pl,c5 as Ce,b$ as Ue,cd as mt,c9 as W,eI as $t,cb as gl,cg as bl,ch as ze,eJ as tt,eK as ml,eL as $l,eM as De,eN as xl,cr as wl,cs as vl,ct as Cl,u as xt,aQ as lt,f as kl,j as Kl,ai as Il,bl as Rl,e5 as wt,c as vt,eO as Sl,eP as Ml,aH as Dl}from"./index-BNBwb-FJ.js";import{$ as El,a as Pl,e as zl,b as Tl,c as Ct,d as kt}from"./useGridSelectionCheckbox-CrCOlZv8.js";import{a as Nl,c as oe,b as ue,d as Hl}from"./Virtualizer-DipGMcji.js";import{$ as Wl}from"./ListLayout-F74Z1Dpf.js";function Fl(n){let{onMoveStart:e,onMove:t,onMoveEnd:l}=n,i=f.useRef({didMove:!1,lastPosition:null,id:null}),{addGlobalListener:r,removeGlobalListener:o}=Ot(),s=f.useCallback((y,g,p,h)=>{p===0&&h===0||(i.current.didMove||(i.current.didMove=!0,e?.({type:"movestart",pointerType:g,shiftKey:y.shiftKey,metaKey:y.metaKey,ctrlKey:y.ctrlKey,altKey:y.altKey})),t?.({type:"move",pointerType:g,deltaX:p,deltaY:h,shiftKey:y.shiftKey,metaKey:y.metaKey,ctrlKey:y.ctrlKey,altKey:y.altKey}))},[e,t,i]),a=He(s),d=f.useCallback((y,g)=>{Ut(),i.current.didMove&&l?.({type:"moveend",pointerType:g,shiftKey:y.shiftKey,metaKey:y.metaKey,ctrlKey:y.ctrlKey,altKey:y.altKey})},[l,i]),c=He(d);return{moveProps:f.useMemo(()=>{let y={},g=()=>{_t(),i.current.didMove=!1};{let h=b=>{if(b.pointerId===i.current.id){let k=b.pointerType||"mouse";a(b,k,b.pageX-(i.current.lastPosition?.pageX??0),b.pageY-(i.current.lastPosition?.pageY??0)),i.current.lastPosition={pageX:b.pageX,pageY:b.pageY}}},x=b=>{if(b.pointerId===i.current.id){let k=b.pointerType||"mouse";c(b,k),i.current.id=null;let w=Qe(ee(b));o(w,"pointermove",h,!1),o(w,"pointerup",x,!1),o(w,"pointercancel",x,!1)}};y.onPointerDown=b=>{if(b.button===0&&i.current.id==null){g(),b.stopPropagation(),b.preventDefault(),i.current.lastPosition={pageX:b.pageX,pageY:b.pageY},i.current.id=b.pointerId;let k=Qe(ee(b));r(k,"pointermove",h,!1),r(k,"pointerup",x,!1),r(k,"pointercancel",x,!1)}}}let p=(h,x,b)=>{g(),a(h,"keyboard",x,b),c(h,"keyboard")};return y.onKeyDown=h=>{switch(h.key){case"Left":case"ArrowLeft":h.preventDefault(),h.stopPropagation(),p(h,-1,0);break;case"Right":case"ArrowRight":h.preventDefault(),h.stopPropagation(),p(h,1,0);break;case"Up":case"ArrowUp":h.preventDefault(),h.stopPropagation(),p(h,0,-1);break;case"Down":case"ArrowDown":h.preventDefault(),h.stopPropagation(),p(h,0,1);break}},y},[r,o,i])}}const it=10,rt=5;class Al{setup(e,t,l){this.delegate=e,this.state=t,this.direction=l}getDropTargetFromPoint(e,t,l){let i=this.delegate.getDropTargetFromPoint(e,t,l);return!i||i.type==="root"?i:this.resolveDropTarget(i,e,t,l)}resolveDropTarget(e,t,l,i){let r=this.pointerTracking,o=l-r.lastY,s=t-r.lastX,a=r.yDirection,d=r.xDirection;if(Math.abs(o)>rt&&(a=o>0?"down":"up",r.yDirection=a,r.lastY=l),Math.abs(s)>it&&(d=s>0?"right":"left",r.xDirection=d,r.lastX=t),e.dropPosition==="before"){let y=this.state.collection.getKeyBefore(e.key);for(;y!=null;){let g=this.state.collection.getItem(y);if(g?.type==="item")break;y=g?.parentKey??null}if(y!=null){let g={type:"item",key:y,dropPosition:"after"};i(g)&&(e=g)}}let c=this.getPotentialTargets(e,i);if(c.length===0)return{type:"root"};let u;return c.length>1?u=this.selectTarget(c,e,t,l,a,d):(u=c[0],r.boundaryContext=null),u}getPotentialTargets(e,t){if(e.dropPosition==="on")return[e];let l=e,i=this.state.collection,r=i.getItem(l.key);for(;r&&r?.type!=="item"&&r.nextKey!=null;)l.key=r.nextKey,r=i.getItem(r.nextKey);let o=[l];if(r&&r.hasChildNodes&&this.state.expandedKeys.has(r.key)&&i.getChildren&&l.dropPosition==="after"){let d=r.firstChildKey!=null?i.getItem(r.firstChildKey):null;for(;d&&d.type!=="item";)d=d.nextKey!=null?i.getItem(d.nextKey):null;if(d?.type==="item"){const c={type:"item",key:d.key,dropPosition:"before"};return t(c)?[c]:[]}}if(r?.nextKey!=null)return[e];let s=r?.parentKey,a=[];for(;s!=null;){let d=i.getItem(s),c=d?.nextKey!=null?i.getItem(d.nextKey):null;if(!c||c.parentKey!==s){if(d?.type==="item"){let y={type:"item",key:s,dropPosition:"after"};t(y)&&a.push(y)}if(c)break}s=d?.parentKey}if(a.length>0&&o.push(...a),o.length===1){let d=i.getKeyAfter(l.key),c=d!=null?i.getItem(d):null;if(d!=null&&c&&r&&c.level!=null&&r.level!=null&&c.level>r.level){let u={type:"item",key:d,dropPosition:"before"};if(t(u))return[u]}}return o.filter(t)}selectTarget(e,t,l,i,r,o){if(e.length<2)return e[0];let s=this.pointerTracking,d=this.state.collectionLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{j as s}from"./vendor-react-Bf71BWbF.js";import{a5 as t,a as r,e4 as i,aH as l,e3 as n,at as m}from"./index-BNBwb-FJ.js";function p({at:e}){const o=t[r()],a=i();return s.jsx(l,{text:e?m(e,o):void 0,children:n(e,o,a)})}export{p as T};
|
||||
@@ -1 +0,0 @@
|
||||
import{j as e}from"./vendor-react-Bf71BWbF.js";import{a2 as t,a as r,dX as i,aE as l,dW as n,aq as m}from"./index-CXHBmSa5.js";function p({at:o}){const a=t[r()],s=i();return e.jsx(l,{text:o?m(o,a):void 0,children:n(o,a,s)})}export{p as T};
|
||||
@@ -1 +1 @@
|
||||
import{bF as F,bR as te,bT as ie,eJ as ne,eK as le,bM as se,e7 as H,eA as T,eC as re,eL as oe,c0 as ae,eM as he}from"./index-CXHBmSa5.js";import{r as f,$ as z,a as M}from"./vendor-react-Bf71BWbF.js";class x{constructor(e=0,t=0){this.x=e,this.y=t}copy(){return new x(this.x,this.y)}equals(e){return this.x===e.x&&this.y===e.y}isOrigin(){return this.x===0&&this.y===0}}class y{constructor(e=0,t=0,i=0,n=0){this.x=e,this.y=t,this.width=i,this.height=n}get maxX(){return this.x+this.width}get maxY(){return this.y+this.height}get area(){return this.width*this.height}get topLeft(){return new x(this.x,this.y)}get topRight(){return new x(this.maxX,this.y)}get bottomLeft(){return new x(this.x,this.maxY)}get bottomRight(){return new x(this.maxX,this.maxY)}intersects(e){return this.area>0&&e.area>0&&this.x<=e.x+e.width&&e.x<=this.x+this.width&&this.y<=e.y+e.height&&e.y<=this.y+this.height}containsRect(e){return this.x<=e.x&&this.y<=e.y&&this.maxX>=e.maxX&&this.maxY>=e.maxY}containsPoint(e){return this.x<=e.x&&this.y<=e.y&&this.maxX>=e.x&&this.maxY>=e.y}getCornerInRect(e){for(let t of["topLeft","topRight","bottomLeft","bottomRight"])if(e.containsPoint(this[t]))return t;return null}equals(e){return e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height}pointEquals(e){return this.x===e.x&&this.y===e.y}sizeEquals(e){return this.width===e.width&&this.height===e.height}union(e){let t=Math.min(this.x,e.x),i=Math.min(this.y,e.y),n=Math.max(this.maxX,e.maxX)-t,s=Math.max(this.maxY,e.maxY)-i;return new y(t,i,n,s)}intersection(e){if(!this.intersects(e))return new y(0,0,0,0);let t=Math.max(this.x,e.x),i=Math.max(this.y,e.y);return new y(t,i,Math.min(this.maxX,e.maxX)-t,Math.min(this.maxY,e.maxY)-i)}copy(){return new y(this.x,this.y,this.width,this.height)}}class b{constructor(e=0,t=0){this.width=Math.max(e,0),this.height=Math.max(t,0)}copy(){return new b(this.width,this.height)}equals(e){return this.width===e.width&&this.height===e.height}get area(){return this.width*this.height}}let ce=0;class B{constructor(e,t){this.virtualizer=e,this.key=++ce,this.viewType=t,this.children=new Set,this.reusableViews=new Map,this.layoutInfo=null,this.content=null,this.rendered=null}prepareForReuse(){this.content=null,this.rendered=null,this.layoutInfo=null}getReusableView(e){let t=this.reusableViews.get(e);return t&&t.length>0?t.shift():new de(this.virtualizer,this,e)}reuseChild(e){e.prepareForReuse();let t=this.reusableViews.get(e.viewType);t||(t=[],this.reusableViews.set(e.viewType,t)),t.push(e)}}class ue extends B{constructor(e){super(e,"root")}}class de extends B{constructor(e,t,i){super(e,i),this.parent=t}}function fe(l,e){if(l===e)return!0;if(l.size!==e.size)return!1;for(let t of l)if(!e.has(t))return!1;return!0}class ye{setVisibleRect(e){let t=performance.now()-this.startTime;t<500&&(e.x!==this.visibleRect.x&&t>0&&(this.velocity.x=(e.x-this.visibleRect.x)/t),e.y!==this.visibleRect.y&&t>0&&(this.velocity.y=(e.y-this.visibleRect.y)/t)),this.startTime=performance.now(),this.visibleRect=e}getOverscannedRect(){let e=this.visibleRect.copy(),t=this.visibleRect.height/3;e.height+=t,this.velocity.y<0&&(e.y-=t);let i=this.visibleRect.width/3;return e.width+=i,this.velocity.x<0&&(e.x-=i),e}constructor(){this.startTime=0,this.velocity=new x(0,0),this.visibleRect=new y}}const we=4;function _(l){return l==="x"?"width":"height"}function ge(l,e,t,i,n){let s=t(l.key);if(!s)return null;let a=s.rect[l.corner][e]-i[e]-l.offset;if(a===0)return null;let h=i[e]+a,r=_(e),d=Math.max(0,n[r]-i[r]),u=Math.max(0,Math.min(d,h));return u!==i[e]?u:null}function ve(l,e,t,i,n=()=>!0){let s=_(e),a=null;for(let[h,r]of i){if(!r||!n(r))continue;let d=r.rect.intersection(t)[s];if(r.rect.area>0&&d>=we){let u=r.rect.getCornerInRect(t)??"topLeft",c=r.rect[u][e]-t[e];(!a||(l==="end"?c<a.offset:c>a.offset))&&(a={key:h,corner:u,offset:c})}}return a}function be(l,e,t,i){if(l==="start")return 0;let n=_(e);return Math.max(0,t[n]-i[n])}function X(l,e,t,i,n){if(t==="start")return l[i]<=n;let s=_(i);return e[s]-(l[i]+l[s])<=n}function pe(l,e,t,i,n,s,a,h,r,d){let u=c=>e==="x"?new y(c,r.y,r.width,r.height):new y(r.x,c,r.width,r.height);if(t){let c=ge(t,e,h,r,d);if(c!=null)return u(c)}if(i&&!n&&(!s||a>0)){let c=u(be(l,e,d,r));return c.equals(r)?null:c}return null}class me{reset(){this.hasSnappedToEdge=!1,this.hadEstimatedVisibleItems=!1,this.wasNearAnchorEdge=!1}captureBeforeLayout(e,t,i){return e?ve(e.edge,e.axis,i,t,e.isAnchorable):null}resolveAfterLayout(e){let{anchorInfo:t,anchor:i,postLayoutInfos:n,previousVisibleRect:s,previousContentSize:a,contentSize:h,itemSizeChanged:r,isScrolling:d,getLayoutInfo:u}=e;if(!t)return null;let c=this.hadEstimatedVisibleItems,o=this.wasNearAnchorEdge,m=!1;for(let V of n.values())if(V.estimatedSize){m=!0;break}if(this.hadEstimatedVisibleItems=m,c||(this.wasNearAnchorEdge=X(s,a,t.edge,t.axis,t.threshold)),s.area===0)return null;let w=t.axis==="x"?"width":"height",S=h[w]-a[w],$=!this.hasSnappedToEdge;if(this.hasSnappedToEdge=!0,!($||S!==0||r))Line truncated
|
||||
import{bJ as H,bV as te,bX as ie,eS as ne,eT as le,bQ as se,eg as F,eJ as T,eL as re,eU as oe,c4 as ae,eV as he}from"./index-BNBwb-FJ.js";import{r as f,$ as S,a as M}from"./vendor-react-Bf71BWbF.js";class x{constructor(e=0,t=0){this.x=e,this.y=t}copy(){return new x(this.x,this.y)}equals(e){return this.x===e.x&&this.y===e.y}isOrigin(){return this.x===0&&this.y===0}}class y{constructor(e=0,t=0,i=0,n=0){this.x=e,this.y=t,this.width=i,this.height=n}get maxX(){return this.x+this.width}get maxY(){return this.y+this.height}get area(){return this.width*this.height}get topLeft(){return new x(this.x,this.y)}get topRight(){return new x(this.maxX,this.y)}get bottomLeft(){return new x(this.x,this.maxY)}get bottomRight(){return new x(this.maxX,this.maxY)}intersects(e){return this.area>0&&e.area>0&&this.x<=e.x+e.width&&e.x<=this.x+this.width&&this.y<=e.y+e.height&&e.y<=this.y+this.height}containsRect(e){return this.x<=e.x&&this.y<=e.y&&this.maxX>=e.maxX&&this.maxY>=e.maxY}containsPoint(e){return this.x<=e.x&&this.y<=e.y&&this.maxX>=e.x&&this.maxY>=e.y}getCornerInRect(e){for(let t of["topLeft","topRight","bottomLeft","bottomRight"])if(e.containsPoint(this[t]))return t;return null}equals(e){return e.x===this.x&&e.y===this.y&&e.width===this.width&&e.height===this.height}pointEquals(e){return this.x===e.x&&this.y===e.y}sizeEquals(e){return this.width===e.width&&this.height===e.height}union(e){let t=Math.min(this.x,e.x),i=Math.min(this.y,e.y),n=Math.max(this.maxX,e.maxX)-t,s=Math.max(this.maxY,e.maxY)-i;return new y(t,i,n,s)}intersection(e){if(!this.intersects(e))return new y(0,0,0,0);let t=Math.max(this.x,e.x),i=Math.max(this.y,e.y);return new y(t,i,Math.min(this.maxX,e.maxX)-t,Math.min(this.maxY,e.maxY)-i)}copy(){return new y(this.x,this.y,this.width,this.height)}}class b{constructor(e=0,t=0){this.width=Math.max(e,0),this.height=Math.max(t,0)}copy(){return new b(this.width,this.height)}equals(e){return this.width===e.width&&this.height===e.height}get area(){return this.width*this.height}}let ce=0;class B{constructor(e,t){this.virtualizer=e,this.key=++ce,this.viewType=t,this.children=new Set,this.reusableViews=new Map,this.layoutInfo=null,this.content=null,this.rendered=null}prepareForReuse(){this.content=null,this.rendered=null,this.layoutInfo=null}getReusableView(e){let t=this.reusableViews.get(e);return t&&t.length>0?t.shift():new de(this.virtualizer,this,e)}reuseChild(e){e.prepareForReuse();let t=this.reusableViews.get(e.viewType);t||(t=[],this.reusableViews.set(e.viewType,t)),t.push(e)}}class ue extends B{constructor(e){super(e,"root")}}class de extends B{constructor(e,t,i){super(e,i),this.parent=t}}function fe(l,e){if(l===e)return!0;if(l.size!==e.size)return!1;for(let t of l)if(!e.has(t))return!1;return!0}class ye{setVisibleRect(e){let t=performance.now()-this.startTime;t<500&&(e.x!==this.visibleRect.x&&t>0&&(this.velocity.x=(e.x-this.visibleRect.x)/t),e.y!==this.visibleRect.y&&t>0&&(this.velocity.y=(e.y-this.visibleRect.y)/t)),this.startTime=performance.now(),this.visibleRect=e}getOverscannedRect(){let e=this.visibleRect.copy(),t=this.visibleRect.height/3;e.height+=t,this.velocity.y<0&&(e.y-=t);let i=this.visibleRect.width/3;return e.width+=i,this.velocity.x<0&&(e.x-=i),e}constructor(){this.startTime=0,this.velocity=new x(0,0),this.visibleRect=new y}}const we=4;function _(l){return l==="x"?"width":"height"}function ge(l,e,t,i,n){let s=t(l.key);if(!s)return null;let a=s.rect[l.corner][e]-i[e]-l.offset;if(a===0)return null;let h=i[e]+a,r=_(e),d=Math.max(0,n[r]-i[r]),u=Math.max(0,Math.min(d,h));return u!==i[e]?u:null}function ve(l,e,t,i,n=()=>!0){let s=_(e),a=null;for(let[h,r]of i){if(!r||!n(r))continue;let d=r.rect.intersection(t)[s];if(r.rect.area>0&&d>=we){let u=r.rect.getCornerInRect(t)??"topLeft",c=r.rect[u][e]-t[e];(!a||(l==="end"?c<a.offset:c>a.offset))&&(a={key:h,corner:u,offset:c})}}return a}function be(l,e,t,i){if(l==="start")return 0;let n=_(e);return Math.max(0,t[n]-i[n])}function Y(l,e,t,i,n){if(t==="start")return l[i]<=n;let s=_(i);return e[s]-(l[i]+l[s])<=n}function pe(l,e,t,i,n,s,a,h,r,d){let u=c=>e==="x"?new y(c,r.y,r.width,r.height):new y(r.x,c,r.width,r.height);if(t){let c=ge(t,e,h,r,d);if(c!=null)return u(c)}if(i&&!n&&(!s||a>0)){let c=u(be(l,e,d,r));return c.equals(r)?null:c}return null}class me{reset(){this.hasSnappedToEdge=!1,this.hadEstimatedVisibleItems=!1,this.wasNearAnchorEdge=!1}captureBeforeLayout(e,t,i){return e?ve(e.edge,e.axis,i,t,e.isAnchorable):null}resolveAfterLayout(e){let{anchorInfo:t,anchor:i,postLayoutInfos:n,previousVisibleRect:s,previousContentSize:a,contentSize:h,itemSizeChanged:r,isScrolling:d,getLayoutInfo:u}=e;if(!t)return null;let c=this.hadEstimatedVisibleItems,o=this.wasNearAnchorEdge,m=!1;for(let V of n.values())if(V.estimatedSize){m=!0;break}if(this.hadEstimatedVisibleItems=m,c||(this.wasNearAnchorEdge=Y(s,a,t.edge,t.axis,t.threshold)),s.area===0)return null;let w=t.axis==="x"?"width":"height",z=h[w]-a[w],$=!this.hasSnappedToEdge;if(this.hasSnappedToEdge=!0,!($||z!==0||r))Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
import{D as r}from"./auth-BGnwk8Hi.js";import{A as o,o as a}from"./index-CXHBmSa5.js";import"./vendor-react-Bf71BWbF.js";const n="demo-session-",c=12*36e5;function f(){return{mode:"password",setup_required:!1}}function w(e,t){if(e==="setup")throw new o(409,"setup_already_completed","Setup already completed");if(t.username!==r.username||t.password!==r.password)throw new o(401,"invalid_credentials","Invalid credentials");return{token:n+a(),expires_at:new Date(Date.now()+c).toISOString()}}function l(e){return!!e?.startsWith(n)}function _(e){const t=()=>Promise.reject(new o(401,"authentication_required","Authentication required"));return new Proxy(e,{get:(i,s,u)=>typeof Reflect.get(i,s,u)=="function"?t:void 0})}export{f as mockDiscovery,w as mockOpenSession,l as mockSessionValid,_ as refuseWithoutSession};
|
||||
@@ -1,2 +1,2 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./auth-DmBaDwOI.js","./index-CXHBmSa5.js","./vendor-react-Bf71BWbF.js","./index-BMPxGQXj.css"])))=>i.map(i=>d[i]);
|
||||
import{i as r,d$ as a,e0 as c,_ as u}from"./index-CXHBmSa5.js";const n=(o,e)=>new URL(o.replace(/\/+$/,"")+e,globalThis.location?.href),p=()=>u(()=>import("./auth-DmBaDwOI.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),h={username:"demo",password:"demo"};async function l(o,e){if(r(o))return(await p()).mockDiscovery();const t=await a(n(o,"/api"),{headers:{Accept:"application/json"},cache:"no-store",signal:e});if(!t.ok)throw await c(t);return(await t.json()).auth??null}async function w(o,e){return(await a(n(o,"/api/v1/capabilities"),{headers:{Accept:"application/json"},cache:"no-store",signal:e})).status!==404}function f(o){return o?.mode!=="password"?"token":o.setup_required?"setup":"login"}async function m(o,e,t,s){if(r(o))return(await p()).mockOpenSession(e,t);const i=await a(n(o,`/api/v1/auth/${e}`),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t),cache:"no-store",signal:s},e==="setup");if(!i.ok)throw await c(i);return i.json()}async function A(o,e,t){if(r(o))return;const s=await a(n(o,"/api/v1/auth/logout"),{method:"POST",headers:{Accept:"application/json",Authorization:"Bearer "+e},cache:"no-store",signal:t});if(!s.ok&&s.status!==401)throw await c(s)}export{h as D,w as a,A as c,l as d,m as o,f as s};
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./auth-kokL-_Tb.js","./index-BNBwb-FJ.js","./vendor-react-Bf71BWbF.js","./index-C8vJM6q6.css"])))=>i.map(i=>d[i]);
|
||||
import{i as r,e8 as a,e9 as c,_ as u}from"./index-BNBwb-FJ.js";const n=(o,e)=>new URL(o.replace(/\/+$/,"")+e,globalThis.location?.href),p=()=>u(()=>import("./auth-kokL-_Tb.js"),__vite__mapDeps([0,1,2,3]),import.meta.url),d={username:"demo",password:"demo"};async function l(o,e){if(r(o))return(await p()).mockDiscovery();const t=await a(n(o,"/api"),{headers:{Accept:"application/json"},cache:"no-store",signal:e});if(!t.ok)throw await c(t);return(await t.json()).auth??null}async function w(o,e){return(await a(n(o,"/api/v1/capabilities"),{headers:{Accept:"application/json"},cache:"no-store",signal:e})).status!==404}function f(o){return o?.mode!=="password"?"token":o.setup_required?"setup":"login"}async function m(o,e,t,s){if(r(o))return(await p()).mockOpenSession(e,t);const i=await a(n(o,`/api/v1/auth/${e}`),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(t),cache:"no-store",signal:s},e==="setup");if(!i.ok)throw await c(i);return i.json()}async function A(o,e,t){if(r(o))return;const s=await a(n(o,"/api/v1/auth/logout"),{method:"POST",headers:{Accept:"application/json",Authorization:"Bearer "+e},cache:"no-store",signal:t});if(!s.ok&&s.status!==401)throw await c(s)}export{d as D,w as a,A as c,l as d,m as o,f as s};
|
||||
@@ -0,0 +1 @@
|
||||
import{D as i}from"./auth-TcOYUrrj.js";import{A as r,o as p}from"./index-BNBwb-FJ.js";import"./vendor-react-Bf71BWbF.js";const a="demo-session-",h=12*36e5;function u(){return{mode:"password",setup_required:!1}}const c={auth_setup:"/api/v1/auth/setup",auth_login:"/api/v1/auth/login"};function w(e,t){if(e==="setup")throw new r(409,"setup_already_completed","Setup already completed");if(t.username!==i.username||t.password!==i.password)throw new r(401,"invalid_credentials","Invalid credentials");return{token:a+p(),expires_at:new Date(Date.now()+h).toISOString()}}function v(e){return!!e?.startsWith(a)}function y(e){return{...e,discovery:async t=>{const o=await e.discovery(t);return"status"in o?{...o,links:{...o.links,...c,auth_logout:"/api/v1/auth/logout"},auth:{...u(),anonymous_loopback:!1}}:o}}}function _(e){const t=()=>Promise.reject(new r(401,"authentication_required","Authentication required")),o=async n=>(n?.throwIfAborted(),{name:"dae/honk-native",api_major:1,links:{...c},auth:u()});return new Proxy(e,{get:(n,s,d)=>s==="discovery"?o:typeof Reflect.get(n,s,d)=="function"?t:void 0})}export{u as mockDiscovery,w as mockOpenSession,v as mockSessionValid,_ as refuseWithoutSession,y as withPasswordAuth};
|
||||
@@ -0,0 +1 @@
|
||||
import{r as m}from"./vendor-react-Bf71BWbF.js";import{bs as d,bt as g,a8 as b,d5 as w,aa as D,d4 as _,A as L,V as E,d7 as y,d8 as M,ea as x}from"./index-BNBwb-FJ.js";const z=100;function G(e){const t=_(e,e?.resources.dns_log.max_page_size);return t===void 0?void 0:Math.min(z,t)}async function C(e,t,n){try{return{page:await e(t),limit:t.limit}}catch(s){const{limit:a}=t;if(!(s instanceof L&&s.status===503&&s.code==="temporarily_unavailable"&&s.retryAfter!==null)||a===void 0||a<2)throw s;await E(s.retryAfter,n);const c=Math.ceil(a/4);return{page:await e({...t,limit:c}),limit:c}}}function P(e,t){let n=x;return M(async s=>{const a=await C(r=>e.dnsCache(r,t),{cursor:s,limit:n,detail:"summary"},t);return n=a.limit,a.page},(s,a)=>s?(s.entries.push(...a.entries),s):{...a,entries:[...a.entries]})}function W(){const e=d(),{busy:t,run:n,cancel:s}=g({rethrow:!0});return{busy:t!==null,cancel:s,flush:m.useCallback(()=>n("flush",a=>k(e,a)),[e,n])}}function F(e,t=!0){const n=d(),s=e.name?.trim()||void 0,a=e.type&&e.type!=="all"?e.type:void 0,r=e.src?.trim()||void 0,c=b().data,o=G(c),i=w({key:["dnsLog",{name:s,type:a,src:r,limit:o}],fetch:async u=>{const l=await C(f=>n.dnsLog(f,u),{name:s,type:a,src:r,limit:o},u);return{...l.page,limit:l.limit}}},{enabled:t});return{...i,limit:i.data?i.data.limit:o}}const p=new WeakMap,h=new WeakMap;async function S(e,t){const n=h.get(e)??0,s=await P(e,t);return(h.get(e)??0)===n&&p.set(e,{at:Date.now(),list:{...s,entries:[]}}),s}const v=e=>{h.set(e,(h.get(e)??0)+1),p.delete(e)};function k(e,t){return e.flushDnsCache(t).finally(()=>v(e))}function I(e,t,n){return e.deleteDnsEntry(t,n).finally(()=>v(e))}function N(e,t){const n=p.get(e);return n&&Date.now()-n.at<y.background?Promise.resolve(n.list):e.dnsCache({limit:1,detail:"summary"},t)}function O(e=!0,t=!1){const n=d();return w({key:["dnsCache"],every:y.lists,fetch:s=>S(n,s)},{enabled:e,paused:t})}function T(e=!0,t=!1){const n=d();return w({key:["dnsCache",{usage:!0}],every:y.background,fetch:s=>N(n,s)},{enabled:e,paused:t})}function V(e=!1){const t=d(),n=b(),s=n.data?.resources,a=O(D(s,"dns_cache",{whileLoading:!1})&&!!s?.dns_cache.read,e),{refetch:r}=a,{busy:c,error:o,run:i,cancel:u}=g({rethrow:!0});return{capabilities:n,cache:a,busy:c,error:o,cancel:u,remove:m.useCallback(l=>i(l,async f=>{const A=await I(t,l,f);return r(),A}),[t,i,r]),flush:m.useCallback(()=>i("flush",async l=>{const f=await k(t,l);return r(),f}),[t,i,r])}}async function X(e,t,n,s,a){const r=Math.max(1,Math.floor(s));let c;for(let o=0;o<n.length;o+=r){a.throwIfAborted();const i=n.slice(o,o+r),u=await e(t,i,a);a.throwIfAborted(),c?c.results.push(...u.results):c={...u,results:[...u.results]}}if(!c)throw new Error("DNS query requires at least one record type");return c}export{V as a,T as b,W as c,X as q,C as s,F as u};
|
||||
@@ -1 +0,0 @@
|
||||
import{r as m}from"./vendor-react-Bf71BWbF.js";import{bo as h,bp as g,a5 as b,cY as w,a7 as D,cX as _,A as L,R as E,c_ as y,c$ as M,e1 as x}from"./index-CXHBmSa5.js";const z=100;function G(e){const t=_(e,e?.resources.dns_log.max_page_size);return t===void 0?void 0:Math.min(z,t)}async function C(e,t,n){try{return{page:await e(t),limit:t.limit}}catch(s){const{limit:r}=t;if(!(s instanceof L&&s.status===503&&s.code==="temporarily_unavailable"&&s.retryAfter!==null)||r===void 0||r<2)throw s;await E(s.retryAfter,n);const c=Math.ceil(r/4);return{page:await e({...t,limit:c}),limit:c}}}function P(e,t){let n=x;return M(async s=>{const r=await C(a=>e.dnsCache(a,t),{cursor:s,limit:n,detail:"summary"},t);return n=r.limit,r.page},(s,r)=>s?(s.entries.push(...r.entries),s):{...r,entries:[...r.entries]})}function W(){const e=h(),{busy:t,run:n,cancel:s}=g({rethrow:!0});return{busy:t!==null,cancel:s,flush:m.useCallback(()=>n("flush",r=>k(e,r)),[e,n])}}function X(e,t=!0){const n=h(),s=e.name?.trim()||void 0,r=e.type&&e.type!=="all"?e.type:void 0,a=e.src?.trim()||void 0,c=b().data,o=G(c),i=w({key:["dnsLog",{name:s,type:r,src:a,limit:o}],fetch:async u=>{const l=await C(f=>n.dnsLog(f,u),{name:s,type:r,src:a,limit:o},u);return{...l.page,limit:l.limit}}},{enabled:t});return{...i,limit:i.data?i.data.limit:o}}const p=new WeakMap,d=new WeakMap;async function R(e,t){const n=d.get(e)??0,s=await P(e,t);return(d.get(e)??0)===n&&p.set(e,{at:Date.now(),list:{...s,entries:[]}}),s}const v=e=>{d.set(e,(d.get(e)??0)+1),p.delete(e)};function k(e,t){return e.flushDnsCache(t).finally(()=>v(e))}function S(e,t,n){return e.deleteDnsEntry(t,n).finally(()=>v(e))}function I(e,t){const n=p.get(e);return n&&Date.now()-n.at<y.background?Promise.resolve(n.list):e.dnsCache({limit:1,detail:"summary"},t)}function N(e=!0,t=!1){const n=h();return w({key:["dnsCache"],every:y.lists,fetch:s=>R(n,s)},{enabled:e,paused:t})}function F(e=!0,t=!1){const n=h();return w({key:["dnsCache",{usage:!0}],every:y.background,fetch:s=>I(n,s)},{enabled:e,paused:t})}function T(e=!1){const t=h(),n=b(),s=n.data?.resources,r=N(D(s,"dns_cache",{whileLoading:!1})&&!!s?.dns_cache.read,e),{refetch:a}=r,{busy:c,error:o,run:i,cancel:u}=g({rethrow:!0});return{capabilities:n,cache:r,busy:c,error:o,cancel:u,remove:m.useCallback(l=>i(l,async f=>{const A=await S(t,l,f);return a(),A}),[t,i,a]),flush:m.useCallback(()=>i("flush",async l=>{const f=await k(t,l);return a(),f}),[t,i,a])}}async function Y(e,t,n,s,r){const a=Math.max(1,Math.floor(s));let c;for(let o=0;o<n.length;o+=a){r.throwIfAborted();const i=n.slice(o,o+a),u=await e(t,i,r);r.throwIfAborted(),c?c.results.push(...u.results):c={...u,results:[...u.results]}}if(!c)throw new Error("DNS query requires at least one record type");return c}export{T as a,F as b,W as c,Y as q,C as s,X as u};
|
||||
@@ -1 +0,0 @@
|
||||
import{bo as p,a5 as f,cX as _,cY as d,cZ as y,c_ as h,c$ as w,d0 as g}from"./index-CXHBmSa5.js";async function v(s,{input:t,resolve:a,recordTypes:i},o){if(a!=="query")return s.routingTrace({input:t,resolve:a},o);const l=await s.dnsQuery(t.domain,i,o),c=l.results.map(e=>({lookup_id:`query:${e.type}`,parent_lookup_id:null,attempt_id:null,purpose:"dial_target",name:l.domain,qtype:e.type,source:e.cached?"cache":"upstream",upstream_transport:null,carrier_transport:null,cache:e.cached?"hit":"miss",cache_entry_id:e.cache_entry_id,upstream:e.upstream,route_evaluation_ids:[],status:e.status,addresses:(e.answers??[]).filter(r=>r.type===e.type).map(r=>r.data),selected_ip:e.type==="A"||e.type==="AAAA"?(e.answers??[]).find(r=>r.type===e.type)?.data??null:null,error:null})),u=[...new Set(["A","AAAA"].flatMap(e=>c.find(r=>r.qtype===e&&r.selected_ip)?.selected_ip??[]))],n=[];for(const e of u.length?u:[null])n.push(await s.routingTrace({input:e?{...t,dst_ip:e}:t,resolve:"none"},o));if(n.some(e=>e.instance_id!==n[0].instance_id||e.generation_id!==n[0].generation_id))throw g(409,"snapshot_unavailable","The routing generation changed during simulation; retry the query","ui.errGenerationChanged");return{...n[0],evaluations:n.flatMap(e=>e.evaluations),dns:c}}function b({connection_id:s,network:t="all",state:a="all"}={},i=!0){const o=p(),{data:l,error:c}=f(),u=_(l,l?.resources.flows.max_page_size);return d({key:["flows",{connection_id:s,network:t,state:a,limit:u}],every:h.lists,fetch:n=>w(e=>o.flows({network:t,state:a,connection_id:s,cursor:e,limit:u,detail:"full"},n),(e,r)=>e?(e.flows.push(...r.flows),e):{...r,flows:[...r.flows]})},y(l,c,i))}function k(s){const t=p();return d({key:["flow",{id:s}],fetch:a=>s?t.flow(s,a):Promise.resolve(null),acceptEvent:a=>a.event!=="flow.updated"||a.data.resource_id===s},{enabled:s!==null})}function m(s=!0){const t=p();return d({key:["rules"],every:0,fetch:a=>t.rules(a)},{enabled:s})}export{b as a,k as b,v as r,m as u};
|
||||
@@ -0,0 +1 @@
|
||||
import{bs as c,a8 as f,d4 as y,d5 as d,d6 as _,d7 as h,d8 as w,d9 as g}from"./index-BNBwb-FJ.js";async function v(s,{input:r,resolve:a,recordTypes:p},u){if(a!=="query")return s.routingTrace({input:r,resolve:a},u);const l=await s.dnsQuery(r.domain,p,u),i=l.results.map(e=>({lookup_id:`query:${e.type}`,parent_lookup_id:null,attempt_id:null,purpose:"dial_target",name:l.domain,qtype:e.type,source:e.cached?"cache":"upstream",upstream_transport:null,carrier_transport:null,cache:e.cached?"hit":"miss",cache_entry_id:e.cache_entry_id,upstream:e.upstream,route_evaluation_ids:[],status:e.status,addresses:(e.answers??[]).filter(t=>t.type===e.type).map(t=>t.data),selected_ip:e.type==="A"||e.type==="AAAA"?(e.answers??[]).find(t=>t.type===e.type)?.data??null:null,error:null})),o=[...new Set(["A","AAAA"].flatMap(e=>i.find(t=>t.qtype===e&&t.selected_ip)?.selected_ip??[]))],n=[];for(const e of o.length?o:[null])n.push(await s.routingTrace({input:e?{...r,dst_ip:e}:r,resolve:"none"},u));if(n.some(e=>e.instance_id!==n[0].instance_id||e.generation_id!==n[0].generation_id))throw g(409,"snapshot_unavailable","The routing generation changed during simulation; retry the query","ui.errGenerationChanged");return{...n[0],evaluations:n.flatMap(e=>e.evaluations),dns:i}}function b({connection_id:s,network:r="all",state:a="all"}={},p=!0){const u=c(),{data:l,error:i}=f(),o=y(l,l?.resources.flows.max_page_size);return d({key:["flows",{connection_id:s,network:r,state:a,limit:o}],every:h.lists,fetch:n=>w(e=>u.flows({network:r,state:a,connection_id:s,cursor:e,limit:o,detail:"full"},n),(e,t)=>e?(e.flows.push(...t.flows),e):{...t,flows:[...t.flows]})},_(l,i,p))}function k(s){const r=c();return d({key:["flow",{id:s}],fetch:a=>s?r.flow(s,a):Promise.resolve(null),acceptEvent:a=>a.event!=="flow.updated"||a.data.resource_id===s},{enabled:s!==null})}function m(s=!0){const r=c();return d({key:["rules"],every:0,fetch:a=>r.rules(a)},{enabled:s})}function q(s=!0){const r=c();return d({key:["dnsRules"],every:0,fetch:a=>r.dnsRules(a)},{enabled:s})}export{b as a,q as b,k as c,v as r,m as u};
|
||||
@@ -1 +0,0 @@
|
||||
@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1PCEKM_Y.woff2)format("woff2");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116;ascent-override:100%;descent-override:20%;line-gap-override:0%}@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1NyEKM_Y.woff2)format("woff2");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB;ascent-override:100%;descent-override:20%;line-gap-override:0%}@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1NiEKM_Y.woff2)format("woff2");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;ascent-override:100%;descent-override:20%;line-gap-override:0%}@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1OCEK.woff2)format("woff2");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;ascent-override:100%;descent-override:20%;line-gap-override:0%}:root,:root[data-family=rose-pine]{--rp-base:#faf4ed;--rp-surface:#fffaf3;--rp-overlay:#f2e9e1;--rp-muted:#9893a5;--rp-subtle:#797593;--rp-text:#464261;--rp-love:#b4637a;--rp-gold:#ea9d34;--rp-rose:#d7827e;--rp-pine:#286983;--rp-foam:#56949f;--rp-iris:#907aa9;--rp-c1:var(--rp-pine);--rp-c2:var(--rp-foam);--rp-c3:var(--rp-iris);--rp-c4:var(--rp-gold);--rp-c5:var(--rp-rose);--rp-c6:var(--rp-love);--rp-c7:var(--rp-pine);--rp-c8:var(--rp-foam);--rp-hl-low:#f4ede8;--rp-hl-med:#dfdad9;--rp-hl-high:#cecacd;--rp-shadow:0 1px 2px #57527914}:root[data-family=rose-pine]{--rp-negative-text:var(--rp-text);--rp-notice-text:var(--rp-text);--rp-positive-text:var(--rp-text);--rp-accent-tile-text:var(--rp-text);--rp-info-tile-text:var(--rp-text);--rp-subtle-text:var(--rp-text)}:root[data-family=rose-pine][data-scheme=dark],:root[data-flavour=moon][data-scheme=dark]{--rp-base:#232136;--rp-surface:#2a273f;--rp-overlay:#393552;--rp-muted:#6e6a86;--rp-subtle:#908caa;--rp-text:#e0def4;--rp-love:#eb6f92;--rp-gold:#f6c177;--rp-rose:#ea9a97;--rp-pine:#3e8fb0;--rp-foam:#9ccfd8;--rp-iris:#c4a7e7;--rp-c1:var(--rp-pine);--rp-c2:var(--rp-foam);--rp-c3:var(--rp-iris);--rp-c4:var(--rp-gold);--rp-c5:var(--rp-rose);--rp-c6:var(--rp-love);--rp-c7:var(--rp-pine);--rp-c8:var(--rp-foam);--rp-hl-low:#2a283e;--rp-hl-med:#44415a;--rp-hl-high:#56526e;--rp-shadow:0 1px 2px #0000004d;--rp-line:var(--rp-hl-med);--rp-fill:var(--rp-hl-med);--rp-on-accent:#191724;--rp-accent-text:var(--rp-text);--rp-negative-text:var(--rp-negative);--rp-notice-text:var(--rp-notice);--rp-positive-text:var(--rp-positive);--rp-info-text:var(--rp-text);--rp-negative-tile-text:var(--rp-text)}:root[data-family=catppuccin]{--rp-base:#e6e9ef;--rp-surface:#eff1f5;--rp-overlay:#dce0e8;--rp-muted:#9ca0b0;--rp-subtle:#6c6f85;--rp-text:#4c4f69;--rp-love:#d20f39;--rp-gold:#df8e1d;--rp-rose:#fe640b;--rp-pine:#1e66f5;--rp-foam:#179299;--rp-iris:#8839ef;--rp-c1:#1e66f5;--rp-c2:#179299;--rp-c3:#8839ef;--rp-c4:#fe640b;--rp-c5:#40a02b;--rp-c6:#ea76cb;--rp-c7:#df8e1d;--rp-c8:#d20f39;--rp-hl-low:#dce0e8;--rp-hl-med:#ccd0da;--rp-hl-high:#bcc0cc;--rp-shadow:0 1px 2px #4c4f691a;--rp-on-accent:#fff;--rp-accent-text:var(--rp-text);--rp-negative-text:var(--rp-text);--rp-notice-text:var(--rp-text);--rp-positive-text:var(--rp-text);--rp-info-text:var(--rp-text);--rp-subtle-text:var(--rp-text)}:root[data-family=catppuccin][data-scheme=dark],:root[data-flavour=mocha][data-scheme=dark]{--rp-base:#181825;--rp-surface:#1e1e2e;--rp-overlay:#313244;--rp-muted:#6c7086;--rp-subtle:#a6adc8;--rp-text:#cdd6f4;--rp-love:#f38ba8;--rp-gold:#f9e2af;--rp-rose:#fab387;--rp-pine:#89b4fa;--rp-foam:#94e2d5;--rp-iris:#cba6f7;--rp-c1:#89b4fa;--rp-c2:#94e2d5;--rp-c3:#cba6f7;--rp-c4:#fab387;--rp-c5:#a6e3a1;--rp-c6:#f5c2e7;--rp-c7:#f9e2af;--rp-c8:#f38ba8;--rp-hl-low:#313244;--rp-hl-med:#45475a;--rp-hl-high:#585b70;--rp-shadow:0 1px 2px #00000059;--rp-on-accent:var(--rp-surface);--rp-accent-text:var(--rp-accent);--rp-negative-text:var(--rp-negative);--rp-notice-text:var(--rp-notice);--rp-positive-text:var(--rp-positive);--rp-info-text:var(--rp-info);--rp-negative-tile-text:var(--rp-text);--rp-subtle-text:var(--rp-subtle)}:root[data-family=nord]{--rp-base:#e5e9f0;--rp-surface:#eceff4;--rp-overlay:#d8dee9;--rp-muted:#4c566a;--rp-subtle:#3b4252;--rp-text:#2e3440;--rp-love:#bf616a;--rp-gold:#d08770;--rp-rose:#b48ead;--rp-pine:#5e81ac;--rp-foam:#8fbcbb;--rp-iris:#81a1c1;--rp-c1:#88c0d0;--rp-c2:#a3be8c;--rp-c3:#b48ead;--rp-c4:#d08770;--rp-c5:#5e81ac;--rp-c6:#ebcb8b;--rp-c7:#bf616a;--rp-c8:#8fbcbb;--rp-hl-low:#e5e9f0;--rp-hLine truncated
|
||||
@@ -0,0 +1,64 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./fonts-sc-DWPGxLPK.css","./fonts-tc-B6Zt5HQN.css","./SearchDialog-BrTpocW0.js","./vendor-react-Bf71BWbF.js","./flows-CMFlFH_d.js","./nav-DuA2h3KP.js","./nav-DKmRxmdR.js","./nav-D5WY5Qjf.js","./nav-BeFLfZq8.js","./index-DwWqXSpV.js","./geodata-DprMPspn.js","./auth-kokL-_Tb.js","./auth-TcOYUrrj.js","./AreaChart-D20yx2yz.js","./layout-wfdMYi2n.js","./AreaCurve-BriPYJva.js","./array-C0P64tl-.js","./Sparkline-D9jmRGJ6.js","./Donut-C-REp4Mf.js","./NodeSearch-B91jhtS3.js","./Virtualizer-DipGMcji.js","./useFilter-jz02VVEB.js","./ListLayout-F74Z1Dpf.js","./Overview-CuiLM_k-.js","./files-BxEOxSF8.js","./Table-DyWJelc_.js","./useGridSelectionCheckbox-CrCOlZv8.js","./ActionGroup-BKxDwmnT.js","./DaeCode-B8yPDjSE.js","./Connections-B3chbGPe.js","./FactStrip-n2q1T87k.js","./ranked-B09X8uKl.js","./TimeCell-DUt0i0gi.js","./link-CIkWI7An.js","./labels-Bgu_ZhL8.js","./outbounds-DPmb26w8.js","./Dns-CTpwVfIj.js","./dns-CvJ19DpX.js","./Policies-DiLR7S4N.js","./policyText-CmeXgUK2.js","./PolicyPicker-BmHzmXzJ.js","./Rules-DVu2iSwz.js","./setup-d2VGFWY1.js","./recorder-DlDpPhd4.js","./probe-BZEn7bbG.js","./Rules-l5FnUA9B.css","./Nodes-CnRnSpMd.js","./AddCircle-CIj8X2wL.js","./Config-DgoxfEHn.js","./vendor-editor-CF5uj9id.js","./Events-M5fPrUeR.js","./Logs-sKihIR9Z.js","./Settings-DCKpUXHp.js","./Login-DgzaXVol.js"])))=>i.map(i=>d[i]);
|
||||
import{$ as E,r as c,c as Up,s as Xs,a as Qt,b as Fc,j as f,d as zp}from"./vendor-react-Bf71BWbF.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const qp="modulepreload",Wp=function(t,e){return new URL(t,e).href},Na={},pe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(d){return Promise.all(d.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const a=document.getElementsByTagName("link"),l=document.querySelector("meta[property=csp-nonce]"),u=l?.nonce||l?.getAttribute("nonce");i=o(n.map(d=>{if(d=Wp(d,r),d in Na)return;Na[d]=!0;const m=d.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(!!r)for(let y=a.length-1;y>=0;y--){const g=a[y];if(g.href===d&&(!m||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${p}`))return;const b=document.createElement("link");if(b.rel=m?"stylesheet":qp,m||(b.as="script"),b.crossOrigin="",b.href=d,u&&b.setAttribute("nonce",u),document.head.appendChild(b),m)return new Promise((y,g)=>{b.addEventListener("load",y),b.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(o){const a=new Event("vite:preloadError",{cancelable:!0});if(a.payload=o,window.dispatchEvent(a),!a.defaultPrevented)throw o}return i.then(o=>{for(const a of o||[])a.status==="rejected"&&s(a.reason);return e().catch(s)})};function ot(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}const te=typeof document<"u"?E.useLayoutEffect:()=>{},_c={prefix:String(Math.round(Math.random()*1e10)),current:0},Ac=E.createContext(_c),Gp=E.createContext(!1);let Di=new WeakMap;function Jp(t=!1){let e=c.useContext(Ac),n=c.useRef(null);if(n.current===null&&!t){let r=E.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(r){let i=Di.get(r);i==null?Di.set(r,{id:e.current,state:r.memoizedState}):r.memoizedState!==i.state&&(e.current=i.id,Di.delete(r))}n.current=++e.current}return n.current}function Yp(t){let e=c.useContext(Ac),n=Jp(!!t),r=`react-aria${e.prefix}`;return t||`${r}-${n}`}function Xp(t){let e=E.useId(),[n]=c.useState(Je()),r=n?"react-aria":`react-aria${_c.prefix}`;return t||`${r}-${e}`}const Zp=typeof E.useId=="function"?Xp:Yp;function Qp(){return!1}function eh(){return!0}function th(t){return()=>{}}function Je(){return typeof E.useSyncExternalStore=="function"?E.useSyncExternalStore(th,Qp,eh):c.useContext(Gp)}function nh(t){let[e,n]=c.useState(t),r=c.useRef(e),i=c.useRef(null),s=c.useRef(()=>{if(!i.current)return;let a=i.current.next();if(a.done){i.current=null;return}r.current===a.value?s.current():n(a.value)});te(()=>{r.current=e,i.current&&s.current()});let o=c.useCallback(a=>{i.current=a(r.current),s.current()},[s]);return[e,o]}let rh=!!(typeof window<"u"&&window.document&&window.document.createElement),mn=new Map,un;typeof FinalizationRegistry<"u"&&(un=new FinalizationRegistry(t=>{mn.delete(t)}));let Ki=new WeakMap;function de(t){let[e,n]=c.useState(t),r=c.useRef(null),i=Zp(e),s=c.useRef(null),o=Ki.get(s);if(un&&o!==i&&(o!=null&&un.unregister(s),un.register(s,i,s),Ki.set(s,i)),rh){const a=mn.get(i);a&&!a.includes(r)?a.push(r):mn.set(i,[r])}return te(()=>{let a=i;return()=>{un&&(un.unregister(s),Ki.delete(s)),mn.delete(a)}},[i]),c.useEffect(()=>{let a=r.current;return a&&n(a),()=>{a&&(r.current=null)}}),i}function ih(t,e){if(t===e)return t;let n=mn.get(t);if(n)return n.forEach(i=>i.current=e),e;let r=mn.get(e);return r?(r.forEach(i=>i.current=t),t):e}function rt(t=[]){let e=de(),[n,r]=nh(e),i=c.useCallback(()=>{r(function*(){yield e,yield document.getElementById(e)?e:void 0})},[e,r]);return te(i,[e,i,...t]),n}function Nt(...t){return t.length===1&&t[0]?t[0]:e=>{let n=!1;const r=t.map(i=>{const s=La(i,e);return n||=typeof s=="function",s});if(n)return()=>{r.forEach((i,s)=>{typeof i=="function"?i():La(t[s],null)})}}}function La(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function A(...t){let e={...t[0]};for(let n=1;n<t.length;n++){let r=t[n];for(let i in r){let s=e[i],o=r[i];typeof s=="function"&&typeof o=="function"&&i[0]==="o"&&i[1]==="n"&&i.charCodeAt(2)>=65&&i.charCodeAt(2)<=90?e[i]=ot(s,o):(i==="className"||i==="UNSAFE_className")&&typeof s=="string"&&typeof o=="string"?e[i]=Up(s,o):i==="id"&&s&&o?e.id=ih(s,o):i==="ref"&&s&&o?e.ref=Nt(s,o):e[i]=o!==void 0?o:s}}retuLine truncated
|
||||
@layer {
|
||||
[${qa}] {
|
||||
touch-action: pan-x pan-y pinch-zoom;
|
||||
}
|
||||
}
|
||||
`.trim(),C.head.prepend(j)},[p]),c.useEffect(()=>{let C=g.current;return()=>{m||Va(C.target??void 0);for(let j of C.disposables)j();C.disposables=[]}},[m]),{isPressed:l||b,pressProps:A(h,H,{[qa]:!0})}}function fo(t){return t.tagName==="A"&&t.hasAttribute("href")}function Fi(t,e){const{key:n,code:r}=t,i=e,s=i.getAttribute("role");return(n==="Enter"||n===" "||n==="Spacebar"||r==="Space")&&!(i instanceof xe(i).HTMLInputElement&&!Mu(i,n)||i instanceof xe(i).HTMLTextAreaElement||i.isContentEditable)&&!((s==="link"||!s&&fo(i))&&n!=="Enter")}function Dt(t,e){let n=e.clientX,r=e.clientY;return{currentTarget:t,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,clientX:n,clientY:r,key:e.key}}function Im(t){return t instanceof HTMLInputElement?!1:t instanceof HTMLButtonElement?t.type!=="submit"&&t.type!=="reset":!fo(t)}function Wa(t,e){return _e()&&e==="Enter"?!1:t instanceof HTMLInputElement?e==="Enter"&&(t.type==="checkbox"||t.type==="radio")?!1:!Mu(t,e):Im(t)}const jm=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function Mu(t,e){return t.type==="checkbox"||t.type==="radio"?e===" ":jm.has(t.type)}function Dm(t,e){let{elementType:n="a",onPress:r,onPressStart:i,onPressEnd:s,onPressChange:o,onClick:a,isDisabled:l,...u}=t,d={};n!=="a"&&(d={role:"link",tabIndex:l?void 0:0});let{focusableProps:m}=Lt(t,e),{pressProps:p,isPressed:h}=qt({onPress:r,onPressStart:i,onPressEnd:s,onPressChange:o,onClick:a,isDisabled:l,ref:e}),b=X(u,{labelable:!0}),y=A(m,p),g=Cn(),v=li(t);return{isPressed:h,linkProps:A(b,v,{...y,...d,"aria-disabled":l||void 0,"aria-current":t["aria-current"],onClick:$=>{p.onClick?.($),eu($,g,t.href,t.routerOptions)}})}}function Tn(t){let{isDisabled:e,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=t,s=c.useRef({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:a}=pi(),l=c.useCallback(m=>{Z(m.currentTarget,_(m))&&s.current.isFocusWithin&&!Z(m.currentTarget,m.relatedTarget)&&(s.current.isFocusWithin=!1,a(),n&&n(m),i&&i(!1))},[n,i,s,a]),u=Wc(l),d=c.useCallback(m=>{if(!Z(m.currentTarget,_(m)))return;let p=_(m);const h=ne(p),b=se(h);if(!s.current.isFocusWithin&&b===p){r&&r(m),i&&i(!0),s.current.isFocusWithin=!0,u(m);let y=m.currentTarget;o(h,"focus",g=>{let v=_(g);if(s.current.isFocusWithin&&!Z(y,v)){let $=new h.defaultView.FocusEvent("blur",{relatedTarget:v});qc($,y);let x=no($);l(x)}},{capture:!0})}},[r,i,u,o,l]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:l}}}function je(t={}){let{autoFocus:e=!1,isTextInput:n,within:r}=t,i=c.useRef({isFocused:!1,isFocusVisible:e||Rt()}),[s,o]=c.useState(!1),[a,l]=c.useState(()=>i.current.isFocused&&i.current.isFocusVisible),u=c.useCallback(()=>l(i.current.isFocused&&i.current.isFocusVisible),[]),d=c.useCallback(h=>{i.current.isFocused=h,i.current.isFocusVisible=Rt(),o(h),u()},[u]);Lh(h=>{i.current.isFocusVisible=h,u()},[n,s],{enabled:s,isTextInput:n});let{focusProps:m}=oo({isDisabled:r,onFocusChange:d}),{focusWithinProps:p}=Tn({isDisabled:!r,onFocusWithinChange:d});return{isFocused:s,isFocusVisible:a,focusProps:r?p:m}}let hs=!1,xr=0;function Km(){hs=!0,setTimeout(()=>{hs=!1},500)}function Ga(t){t.pointerType==="touch"&&Km()}function Fm(){let t=ne(null);if(!(typeof t>"u"))return xr===0&&typeof PointerEvent<"u"&&t.addEventListener("pointerup",Ga),xr++,()=>{xr--,!(xr>0)&&typeof PointerEvent<"u"&&t.removeEventListener("pointerup",Ga)}}function ke(t){let{onHoverStart:e,onHoverChange:n,onHoverEnd:r,isDisabled:i}=t,[s,o]=c.useState(!1),a=c.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;c.useEffect(Fm,[]);let{addGlobalListener:l,removeAllGlobalListeners:u}=pi(),{hoverProps:d,triggerHoverEnd:m}=c.useMemo(()=>{let p=(y,g)=>{if(a.pointerType=g,i||g==="touch"||a.isHovered||!Z(y.currentTarget,_(y)))return;a.isHovered=!0;let v=y.currentTarget;a.target=v,l(ne(_(y)),"pointerover",$=>{a.isHovered&&a.target&&!Z(a.target,_($))&&h($,$.pointerType)},{capture:!0}),e&&e({type:"hoverstart",target:v,pointerType:g}),n&&n(!0),o(!0)},h=(y,g)=>{let v=a.target;a.pointerType="",a.target=null,!(g==="touch"||!a.isHovered||!v)&&(a.isHovered=!1,u(),r&&r({type:"hoverend",target:v,pointerType:g}),n&&n(!1),o(!1))},b={};return typeof PointerEvent<"u"&&(b.onPointerEnter=y=>{hs&&y.pointerType==="mouse"||p(y,y.pointerType)},b.onPointerLeave=y=>{!i&&Z(y.currentTarget,_(y))&&h(y,y.pointerType)}),{hoverProps:b,triggerHoverEnd:h}},[e,n,r,i,a,l,u]);return c.useEffect(()=>{i&&m({currentTarget:a.target},a.pointerType)},[i]),{hoverProps:d,isHovered:s}}const _m=c.createContext(null),po=c.forwardRef(function(e,n){[e,n]=ae(e,n,_m);let r=e.href&&!e.isDisabled?"a":"span",{linkProps:i,isPressed:s}=Dm({...e,elementType:r},n),o=Q[r],{hoverProps:a,isHovered:l}=ke(e),{focusProps:u,isFocused:d,isFocusVisible:m}=je(),p=ie({...e,defaultClassName:"react-aria-Link",values:{isCurrent:!!e["aria-current"],isDisabled:e.isDisabled||!1,isPressed:s,isHovered:l,isFocused:d,isFo
Line truncated
|
||||
@layer {
|
||||
* {
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
}`.trim(),document.head.prepend(i);let o=d=>{if(!(d.touches.length===2||n)){if(!e||e===document.documentElement||e===document.body){d.preventDefault();return}e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&d.preventDefault()}},a=d=>{let m=_(d),p=d.relatedTarget;p&&An(p)?(p.focus({preventScroll:!0}),El(p,An(m))):p||m.parentElement?.closest("[tabindex]")?.focus({preventScroll:!0})},l=HTMLElement.prototype.focus;Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(d){let m=se(),p=m!=null&&An(m);l.call(this,{...d,preventScroll:!0}),(!d||!d.preventScroll)&&El(this,p)}});let u=ot(bn(document,"touchstart",r,{passive:!1,capture:!0}),bn(document,"touchmove",o,{passive:!1,capture:!0}),bn(document,"blur",a,!0));return()=>{t(),u(),i.remove(),Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:l})}}function El(t,e){e||!On?Sl(t):On.addEventListener("resize",()=>Sl(t),{once:!0})}function Sl(t){let e=document.scrollingElement||document.documentElement,n=t;for(;n&&n!==e;){let r=mo(n);if(r!==document.documentElement&&r!==document.body&&r!==n){let i=r.getBoundingClientRect(),s=n.getBoundingClientRect();if(s.top<i.top||s.bottom>i.top+n.clientHeight){let o=i.bottom;On&&(o=Math.min(o,On.offsetTop+On.height));let a=s.top-i.top-((o-i.top)/2-s.height/2);r.scrollTo({top:Math.max(0,Math.min(r.scrollHeight-r.clientHeight,r.scrollTop+a)),behavior:"smooth"})}}n=r.parentElement}}function rg(t,e){let{triggerRef:n,popoverRef:r,groupRef:i,isNonModal:s,isKeyboardDismissDisabled:o,shouldCloseOnInteractOutside:a,...l}=t,u=l.trigger==="SubmenuTrigger",{overlayProps:d,underlayProps:m}=hd({isOpen:e.isOpen,onClose:e.close,shouldCloseOnBlur:!0,isDismissable:!s||u,isKeyboardDismissDisabled:o,shouldCloseOnInteractOutside:a},i??r),{overlayProps:p,arrowProps:h,placement:b,triggerAnchorPoint:y}=pd({...l,targetRef:n,overlayRef:r,isOpen:e.isOpen,onClose:s&&!u?e.close:null,getTargetRect:l.getTargetRect??(e.point?()=>new DOMRect(e.point.x,e.point.y,0,0):void 0)});md({isDisabled:s||!e.isOpen}),c.useEffect(()=>{if(e.isOpen&&r.current)return s?Bb(i?.current??r.current):ud([i?.current??r.current],{shouldUseInert:!0})},[s,e.isOpen,r,i]);let{focusWithinProps:g}=Tn(t);return{popoverProps:A(d,p,g),arrowProps:h,underlayProps:m,placement:b,triggerAnchorPoint:y}}var bd={};bd={dismiss:"Dismiss"};var gd={};gd={dismiss:"取消"};var yd={};yd={dismiss:"關閉"};var vd={};vd={"ar-AE":S,"bg-BG":S,"cs-CZ":S,"da-DK":S,"de-DE":S,"el-GR":S,"en-US":bd,"es-ES":S,"et-EE":S,"fi-FI":S,"fr-FR":S,"he-IL":S,"hr-HR":S,"hu-HU":S,"it-IT":S,"ja-JP":S,"ko-KR":S,"lt-LT":S,"lv-LV":S,"nb-NO":S,"nl-NL":S,"pl-PL":S,"pt-BR":S,"pt-PT":S,"ro-RO":S,"ru-RU":S,"sk-SK":S,"sl-SI":S,"sr-SP":S,"sv-SE":S,"tr-TR":S,"uk-UA":S,"zh-CN":gd,"zh-TW":yd};function ig(t){return t&&t.__esModule?t.default:t}function Es(t){let{onDismiss:e,...n}=t,r=en(ig(vd),"@react-aria/overlays"),i=or(n,r.format("dismiss")),s=()=>{e&&e()};return E.createElement(bo,null,E.createElement("button",{...i,tabIndex:-1,onClick:s,style:{width:1,height:1}}))}const $d=E.forwardRef(({children:t,...e},n)=>{let r=c.useRef(!1),i=c.useContext(Jn),s=A(i||{},{...e,register(){r.current=!0,i&&i.register()}});return s.ref=we(n||i?.ref),ao(i,s.ref),c.useEffect(()=>{r.current||(r.current=!0)},[]),E.createElement(Jn.Provider,{value:s},t)});function sg({children:t}){let e=c.useMemo(()=>({register:()=>{}}),[]);return E.createElement(Jn.Provider,{value:e},t)}const og=c.createContext({});function Do(){return c.useContext(og)??{}}const xd=E.createContext(null);function Ss(t){let e=Je(),{portalContainer:n=e?null:document.body,isExiting:r}=t,[i,s]=c.useState(!1),o=c.useMemo(()=>({contain:i,setContain:s}),[i,s]),{getContainer:a}=Do();if(!t.portalContainer&&a&&(n=a()),!n)return null;let l=t.children;return t.disableFocusManagement||(l=E.createElement(Po,{restoreFocus:!0,contain:(t.shouldContainFocus||i)&&!r},l)),l=E.createElement(xd.Provider,{value:o},E.createElement(sg,null,E.createElement(Wn.Provider,{value:null},l))),Fc.createPortal(l,n)}function wd(){let e=c.useContext(xd)?.setContain;te(()=>{e?.(!0)},[e])}function ur(t){let[e,n]=Ve(t.isOpen,t.defaultOpen||!1,t.onOpenChange),[r,i]=c.useState(null);const s=c.useCallback(()=>{n(!0)},[n]),o=c.useCallback(()=>{n(!1)},[n]),a=c.useCallback(()=>{n(!e)},[n,e]);return{isOpen:e,setOpen:n,open:s,close:o,toggle:a,point:r,setPoint:i}}function dr(t,e=!0){let[n,r]=c.useState(!0),i=n&&e;return te(()=>{if(i&&t.current&&"getAnimations"in t.current)for(let s of t.current.getAnimations())s instanceof CSSTransition&&s.cancel()},[t,i]),Ed(t,i,c.useCallback(()=>r(!1),[])),i}function Xn(t,e){let[n,r]=c.useState(e?"open":"closed");switch(n){case"open":e||r("exiting");break;case"closed":case"exiting":e&&r("open");break}let i=n==="exiting";return Ed(t,i,c.useCallback(()=>{r(s=>s==="exiting"?"closed":s)},[])),i}function Ed(t,e,n){te(()=>{if(e&&t.current){if(!("getAnimations"in t.current)){n();return}let r=t.current.getAnimations();if(r.length==
Line truncated
|
||||
${n}`:e);const o=[t,i,s??""].join(`
|
||||
`),a=Cr.get(o);a&&Et.close(a);const l=Et.add({kind:t,text:i,detail:s,action:r},{timeout:r?void 0:5e3,onClose:()=>{Cr.get(o)===l&&Cr.delete(o)}});Cr.set(o,l)},Ky=(t,e,n,r)=>{const i=Yo(t,e,n);Le(i.kind,i.text,{detail:i.detail,action:r})},Fy={positive:iy,negative:Cs,info:of,neutral:null};function _y({placement:t="bottom"}){const[e,n="center"]=t.split(" "),r=ee(),[i,s]=c.useState(!1);return c.useEffect(()=>{i?Et.pauseAll():Et.resumeAll()},[i]),c.useEffect(()=>Et.subscribe(()=>{Et.visibleToasts.length===0&&s(!1)}),[]),c.useEffect(()=>{if(!i)return;const o=a=>{if(a.key!=="Escape")return;(a.target?.closest?.(".rp-toasts")||!document.querySelector(bf))&&s(!1)};return addEventListener("keydown",o),()=>removeEventListener("keydown",o)},[i]),f.jsxs(_0,{queue:Et,className:W("rp-toasts",i&&"expanded"),"data-placement":e,"data-align":n,children:[i&&f.jsx(Ne,{className:"rp-toast-underlay","aria-label":r("toast.collapse"),onPress:()=>s(!1)}),i&&f.jsxs("div",{className:"rp-toast-controls",children:[f.jsx(Ne,{className:"rp-btn sm",onPress:()=>Et.clear(),children:r("toast.clearAll")}),f.jsx(Ne,{className:"rp-btn sm",onPress:()=>s(!1),children:r("toast.collapse")})]}),f.jsx(Ay,{expanded:i,edge:e,onExpand:()=>s(!0)})]})}function Ay({expanded:t,edge:e,onExpand:n}){const r=c.useContext($i),i=r.visibleToasts;return f.jsx(Qd,{className:"rp-toast-list",children:({toast:s})=>{const o=i.indexOf(s);return f.jsx(Oy,{item:s,state:r,depth:o,count:i.length,background:!t&&o>0,more:!t&&o===0&&i.length>1?{edge:e,onExpand:n}:null})}})}function Oy({item:t,state:e,depth:n,count:r,background:i,more:s}){const o=ee(),a=Fy[t.content.kind],{text:l,detail:u,action:d}=t.content;return f.jsxs(A0,{toast:t,className:W("rp-toast",t.content.kind,i&&"background"),style:{zIndex:r-n,"--i":Math.min(n,3)},inert:i||void 0,children:[f.jsxs(O0,{className:"body",children:[a&&f.jsx("span",{className:"icon",children:f.jsx(a,{})}),f.jsxs("div",{className:"msg",children:[f.jsx(Br,{slot:"title",elementType:"div",className:"summary",children:l}),u&&f.jsx(Br,{slot:"description",elementType:"div",className:"detail",children:u})]})]}),f.jsx(Ne,{slot:"close",className:"rp-btn quiet icon close","aria-label":o("close"),children:f.jsx(zo,{})}),(s||d)&&f.jsxs("div",{className:"foot",children:[s&&f.jsxs(Ne,{className:"rp-btn sm quiet more",onPress:s.onExpand,children:[f.jsx(Jt,{className:W(s.edge==="bottom"&&"up")}),o("toast.showAllCount",{n:r})]}),d&&f.jsx(Ne,{className:"rp-btn action",onPress:()=>{d.onAction(),d.closeOnAction&&e.close(t.key)},children:d.label})]})]})}let Vn=null;const Rs=new Set,Ms=()=>Rs.forEach(t=>t());typeof window<"u"&&(addEventListener("beforeinstallprompt",t=>{t.preventDefault(),Vn=t,Ms()}),addEventListener("appinstalled",()=>{Vn=null,Ms()}));function M7(t=navigator,e=n=>matchMedia(n).matches){if(t.standalone||e("(display-mode: standalone), (display-mode: minimal-ui)"))return null;const n=/Version\/(\d+)[.\d]* (?:Mobile\/\w+ )?Safari\//.exec(t.userAgent);return n?typeof t.standalone=="boolean"&&(/iP(?:hone|ad|od)/.test(t.userAgent)||t.maxTouchPoints>1)?"ios":/Macintosh/.test(t.userAgent)&&t.maxTouchPoints<2&&Number(n[1])>=26?"mac":null:null}function N7(){const t=ee(),e=c.useSyncExternalStore(n=>(Rs.add(n),()=>Rs.delete(n)),()=>Vn,()=>null);return e?async()=>{if(Vn!==e)return!1;Vn=null,Ms();try{return await e.prompt(),(await e.userChoice).outcome==="accepted"}catch(n){return Le("negative",t("settings.installFailed"),{detail:xi(n,t)}),!1}}:null}function Ns({className:t,...e}){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:W("rp-icon",t),...e,children:f.jsx("path",{fill:"currentColor",d:"m18.53 17.47-5.083-5.084C14.417 11.186 15 9.66 15 8c0-3.86-3.14-7-7-7S1 4.14 1 8s3.14 7 7 7c1.66 0 3.185-.584 4.386-1.553l5.084 5.083c.146.147.338.22.53.22s.384-.073.53-.22c.293-.293.293-.767 0-1.06M8 13.5c-3.032 0-5.5-2.468-5.5-5.5S4.968 2.5 8 2.5s5.5 2.468 5.5 5.5-2.468 5.5-5.5 5.5"})})}function By({className:t,...e}){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:W("rp-icon",t),...e,children:[f.jsx("path",{fill:"currentColor",d:"m10.03418,16.66162C5.14258,16.66162.75,12.27295.75,10.20068c0-1.68506,2.59814-4.55029,5.34717-5.89746,1.20117-.60596,2.54736-.93506,3.89307-.95264,5.15771,0,9.25977,4.91943,9.25977,6.8501,0,2.07227-4.36035,6.46094-9.21582,6.46094Zm-.03418-11.81104c-1.11084.01465-2.23145.28906-3.23096.79346-.00244.00146-.00537.00293-.0083.00439-2.60596,1.27539-4.51074,3.75-4.51074,4.55225,0,1.14453,3.67969,4.96094,7.78418,4.96094,4.06836,0,7.71582-3.81641,7.71582-4.96094,0-1.04883-3.48145-5.3501-7.75-5.3501Zm-3.56885.12402h.00977-.00977Z"}),f.jsx("path",{fill:"currentColor",d:"m9.82907,7.64351c.22275-.63691-.47262-1.25888-1.09987-1.01025-.47319.18757-.91275.48099-1.28245.88097-1.49146,1.6136-1.20734,4.23592.75785,5.46243,1.20025.7491,2.79762.68815,3.93958-.14712.6684-.48889,
Line truncated
|
||||
`)),l=c.useRef(null),u=c.useRef(!1),d=c.useCallback(m=>(l.current=m,()=>{u.current=m.contains(document.activeElement),l.current=null}),[]);return c.useLayoutEffect(()=>{a&&s.current?.contains(document.activeElement)&&l.current?.querySelector("button")?.focus(),!a&&u.current&&s.current?.querySelector("[data-selected]")?.focus(),u.current=!1},[s,a]),f.jsxs("div",{className:"rp-segfit","data-collapsed":a||void 0,children:[f.jsxs(q0,{ref:s,className:"rp-seg","aria-label":r,isDisabled:i,selectionMode:"single",disallowEmptySelection:!0,selectedKeys:[e],onSelectionChange:m=>{const p=[...m][0];p!=null&&n(String(p))},children:[o&&f.jsx("span",{className:"rp-slider","data-still":o.still||void 0,style:{left:o.x,width:o.w}}),t.map(([m,p])=>f.jsx(G0,{id:m,className:"rp-btn",children:p},m))]}),a&&f.jsx("div",{ref:d,className:"rp-segpick",children:f.jsx(Jy,{bare:!0,label:r,value:e,onChange:n,isDisabled:i,items:t.map(([m,p])=>({id:m,label:p}))})})]})}function I7({children:t,isSelected:e,onChange:n,isDisabled:r,"aria-label":i,"aria-describedby":s}){return f.jsxs(l0,{className:"rp-switch",isSelected:e,onChange:n,isDisabled:r,"aria-label":i,"aria-describedby":s,children:[f.jsx("span",{className:"track"}),t]})}function Yy({label:t,width:e,search:n,large:r,side:i,className:s,placeholder:o,description:a,error:l,action:u,reveal:d,prefix:m,suffix:p,autoComplete:h,spellCheck:b,...y}){const g=ee(),v=c.useId(),$=l?{isInvalid:!0,validationBehavior:"aria"}:{};if(n)return f.jsxs(Jg,{...$,...y,"aria-label":t,className:W("rp-search-field",s),style:e?{width:e}:void 0,children:[f.jsxs("span",{className:W("rp-input",r&&"lg"),children:[f.jsx(Ns,{}),f.jsx(tl,{placeholder:o??t,autoComplete:h,spellCheck:b}),f.jsx(Ne,{className:"clear","aria-label":g("clear"),children:f.jsx(zo,{})})]}),l&&f.jsxs(Za,{className:"rp-field-error",children:[f.jsx(Cs,{}),l]})]});const x=f.jsxs("span",{className:W("rp-input",(i||!!u)&&"rp-grow",(m||p)&&"affixed"),children:[m&&f.jsx("span",{className:"affix",id:`${v}-prefix`,children:m}),f.jsx(tl,{placeholder:o,autoComplete:h,spellCheck:b}),p&&f.jsx("span",{className:"affix",id:`${v}-suffix`,children:p}),d&&f.jsx(Ne,{className:"reveal","aria-label":d.label,onPress:d.onToggle,children:d.shown?f.jsx(Vy,{}):f.jsx(By,{})})]});return f.jsxs(C0,{...$,...y,"aria-describedby":[m&&`${v}-prefix`,p&&`${v}-suffix`].filter(Boolean).join(" ")||void 0,className:W(i?"rp-cluster":"rp-field",s),style:e?{width:e}:void 0,children:[f.jsx(Nu,{className:"rp-label",children:t}),u?f.jsxs("div",{className:"rp-toolbar",children:[x,u]}):x,a&&f.jsx(Br,{slot:"description",className:"rp-label",children:a}),l&&f.jsxs(Za,{className:"rp-field-error",children:[f.jsx(Cs,{}),l]})]})}function j7({title:t,children:e,...n}){return f.jsxs(Dg,{...n,className:"rp-disclosure",children:[f.jsx(ho,{level:3,children:f.jsxs(Ne,{slot:"trigger",className:"rp-btn quiet rp-disclosure-trigger",children:[f.jsx(Jt,{}),t]})}),f.jsx(Kg,{className:"rp-disclosure-panel",children:f.jsx("div",{className:"rp-disclosure-content",children:e})})]})}function D7({children:t}){return f.jsx(Lg,{className:"rp-col",allowsMultipleExpanded:!0,children:t})}function na({trigger:t,title:e,children:n,footer:r,narrow:i,alert:s,isOpen:o,onOpenChange:a,hideTitle:l,locked:u,reason:d}){const m=f.jsx(Oo,{className:"rp-underlay",isDismissable:!s&&!u,isKeyboardDismissDisabled:u,isOpen:o,onOpenChange:a,children:f.jsx(Ad,{className:W("rp-modal",i&&"narrow"),children:f.jsx(Wr,{className:"rp-dialog",role:s?"alertdialog":"dialog","aria-label":l?e:void 0,children:({close:p})=>f.jsxs(hf,{reason:r?d:null,children:[!l&&f.jsx(ho,{slot:"title",children:e}),typeof n=="function"?n(p):n,r&&f.jsx("div",{className:"foot",children:r(p)})]})})})});return t?f.jsxs(Dd,{children:[t,m]}):m}function ra({trigger:t,triggerRef:e,isOpen:n,onOpenChange:r,title:i,label:s,subtitle:o,placement:a="top start",children:l}){const u=f.jsx(yi,{className:i?"rp-popover rp-popover-dialog":"rp-popover",placement:a,...t?{}:{triggerRef:e,isOpen:n,onOpenChange:r},children:i?f.jsx(Wr,{className:"rp-popover-body",children:({close:d})=>f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"rp-popover-head",children:[f.jsx(ho,{slot:"title",children:i}),o]}),l(d)]})}):f.jsx(Wr,{className:"rp-popover-note","aria-label":s,children:({close:d})=>l(d)})});return t?f.jsxs(Dd,{children:[t,u]}):u}function xf({title:t,isOpen:e,onCancel:n,confirmLabel:r,onConfirm:i,tone:s="negative",isPending:o,isDisabled:a,reason:l,error:u,children:d}){const m=ee();return f.jsxs(na,{title:t,narrow:!0,alert:s==="negative",isOpen:e,reason:l,onOpenChange:p=>{p||n()},footer:()=>f.jsxs(f.Fragment,{children:[f.jsx(ge,{onPress:n,children:m("ui.cancel")}),f.jsx(ge,{negative:s==="negative",accent:s==="accent",isDisabled:a,isPending:o,onPress:i,children:r})]}),children:[u&&f.jsx(Zo,{takeFocus:!0,children:u.text},u.id),d]})}function K7({label:t,confirmationText:e,isDisabled:n,isPending:r,onConfirm:i,onAbort:s,open:o,setOpen:a}){const l=ee(),[u,d]=c.useState(!1),[m,p]=c.useState(!1),[h,b]=c
Line truncated
|
||||
`)}),a="",l=void 0,u=[];return}if(p.startsWith(":"))return;const h=p.indexOf(":"),b=h<0?p:p.slice(0,h);let y=h<0?"":p.slice(h+1);y.startsWith(" ")&&(y=y.slice(1)),b==="event"&&(a=y),b==="data"&&u.push(y),b==="id"&&!y.includes("\0")&&(l=y)},m=()=>{i.cancel(n?.reason).catch(()=>{})};n?.addEventListener("abort",m,{once:!0});try{for(;;){const{value:p,done:h}=await i.read();n?.throwIfAborted(),r?.(),o+=s.decode(p,{stream:!h});let b=0;for(let y=0;y<o.length;y++){const g=o[y];if(!(g!=="\r"&&g!==`
|
||||
`)){if(g==="\r"&&y===o.length-1&&!h)break;d(o.slice(b,y)),g==="\r"&&o[y+1]===`
|
||||
`&&y++,b=y+1}}if(o=o.slice(b),h)break}}finally{n?.removeEventListener("abort",m),await i.cancel().catch(()=>{}),i.releaseLock()}}function Hn(t,e){return e?.throwIfAborted(),new Promise((n,r)=>{const i=()=>{clearTimeout(s),r(e?.reason)},s=setTimeout(()=>{e?.removeEventListener("abort",i),n()},Math.max(1,t)*1e3);e?.addEventListener("abort",i,{once:!0})})}const B1=3,_s=new Set,As=new Set;let Af=null;function ic(){Af=[..._s].reduce((t,e)=>t&&t.until>=e.until?t:e,null),As.forEach(t=>t())}const V1=()=>Af;function H1(t){return As.add(t),()=>void As.delete(t)}async function U1(t,e,n){if(e<=B1)return Hn(e,n);const r={status:t,until:Date.now()+e*1e3};_s.add(r),ic();try{await Hn(e,n)}finally{_s.delete(r),ic()}}const G7=["tproxy_port","tproxy_port_protect","pprof_port","so_mark_from_dae","log_level","log_file","disable_waiting_network","lan_interface","wan_interface","auto_config_kernel_parameter","data_dir","store_subscribe","tcp_check_url","tcp_check_http_method","udp_check_dns","check_interval","check_tolerance","dial_mode","nfqueue_enable","allow_insecure","sniffing_timeout","tls_implementation","utls_imitate","tls_fragment","tls_fragment_length","tls_fragment_interval","mptcp","bootstrap_resolver","fallback_resolver","bandwidth_max_tx","bandwidth_max_rx","udp_warm_node_count","preconnect_node_count","max_concurrent_dials"],z1={select:"selector",fixed:"selector",urltest:"urltest",min_moving_avg:"urltest",min_avg10:"urltest",min_last_delay:"urltest",fallback:"fallback",roundrobin:"loadbalance",loadbalance:"loadbalance",random:"random",score:"score"};function J7(t){return z1[t.toLowerCase().replace(/\(.*$/,"")]}const Y7=["select","urltest","roundrobin","fallback","score","fixed","min_moving_avg","min_avg10","min_last_delay","loadbalance"],X7=[{id:"min_moving_avg",label:"arrange.policy.fastest",description:"arrange.policy.fastestHint"},{id:"fallback",label:"arrange.policy.fallback",description:"arrange.policy.fallbackHint"},{id:"roundrobin",label:"arrange.policy.spread",description:"arrange.policy.spreadHint"},{id:"select",label:"arrange.policy.manual",description:"arrange.policy.manualHint"}],ei=["direct","block"],Z7=[...ei,...ei.map(t=>`${t}(must)`)],Pn=t=>t!=null&&ei.includes(t);function Q7(t){if(new TextEncoder().encode(t).length>2048||/[\s,]/.test(t)||!/^https?:\/\/[^/?#@]+(?:[/?#]|$)/i.test(t))return!1;try{return!!new URL(t).hostname}catch{return!1}}const q1={warm:0,unknown:1,mixed:2,cold:3},W1={tcp_connect:0,http_headers:1,http_round_trip:2,quic_handshake:3,mixed:4,unknown:5,dns_round_trip:6};function G1(t){const e=n=>(q1[n.warmth]??1)*100+(W1[n.measurement]??5)*10+(n.ip_version==="ipv4"?0:1);return t.filter(n=>n.transport==="tcp"&&n.purpose==="data").sort((n,r)=>e(n)-e(r))[0]}const J1=t=>G1(t.health),Y1=t=>t?.state==="healthy"&&t.latency_ms!=null?t.latency_ms:void 0,X1=(t,e)=>(t??1/0)-(e??1/0)||0;function Z1(t){const e=t?js(...t.outbounds.map(r=>r.download_bytes)):null,n=(t?.outbounds??[]).map(r=>({name:r.name,kind:r.kind,bytes:De(r.download_bytes),percent:sa(r.download_bytes,e)}));return n.sort((r,i)=>r.bytes===i.bytes?0:r.bytes===null?1:i.bytes===null||r.bytes>i.bytes?-1:1),{rows:n,total:e}}function Q1(t){const e=t.trim().replace(/^\[([^\]]+)\]$/,"$1");if(/^(?:0|[1-9]\d{0,2})(?:\.(?:0|[1-9]\d{0,2})){3}$/.test(e)&&e.split(".").every(n=>Number(n)<=255))return e;if(!(!e.includes(":")||!/^[\da-f:.]+$/i.test(e)))try{return new URL("http://["+e+"]/").hostname.slice(1,-1)}catch{return}}const ev=t=>Pn(t.protocol)?"builtin":"unattributed";function tv(t,e){let n=t;for(;e.some(r=>r.id===n);)n+="-";return n}const e$=(t,e)=>t.provider_id??tv(ev(t),e);function Of(t){if(t)return Q1(t.startsWith("[")?t.slice(1,t.indexOf("]")):t.split(":").length===2?t.split(":")[0]:t)}function fa(t,e){return t==="direct"?e("ui.direct"):t==="block"?e("ui.block"):t===null||t==="unknown"?e("ui.unknown"):t}const nv=(t,e)=>t.map(n=>e?.get(n)??n);function rv(t,e,n){return Pn(t.outbound)?e?fa(t.outbound,e):t.outbound:nv(t.chain,n).join(" → ")||"—"}function t$(t,e,n){if(Pn(t.outbound))return fa(t.outbound,e);const r=t.chain.at(-1);return r?n?.get(r)??r:t.outbound&&t.outbound!=="unknown"?t.outbound:"—"}const n$=(t,e,n)=>t.chain.length>1?rv(t,e,n):null,iv={starting:"lifecycle.starting",running:"lifecycle.running",reloading:"lifecycle.reloading",suspended:"lifecycle.suspended",draining:"lifecycle.draining",degraded:"lifecycle.degraded",failed:"lifecycle.failed"},sv=t=>t==="running"?"ok":t==="failed"?"err":"warn",ov=t=>t>90?"err":t>75?"warn":"ok",r$=t=>t.closed?t.skipped?"info":"positive":"negative",i$={observed:"conn.state.observed",routing:"conn.state.routing",dialing:"conn.state.dialing",active:"conn.state.active",closed:"conn.state.closed",blocked:"conn.state.blocked",failed:"conn.state.failed",unknown:"conn.state.unknown"};function av(t){return t?[...t.tcp.map(e=>({...e,network:"tcp"})),...t.udp.map(e=>({...e,network:"udp"}))]:[]}const Bf=["stream.ready","runtime.updated","flow.updated","flow.gap","operation.updated","generation.changed"],l
Line truncated
|
||||
`&&i++,o++;continue}const l=o,u=i;let d="text";if(a==="#")for(d="comment";o<t.length&&t[o]!==`
|
||||
`;)o++;else if(a==="'"||a==='"')for(d="quoted",o++;o<t.length;){const p=t[o++];if(p===`
|
||||
`&&i++,p==="\\"&&o<t.length)t[o]===`
|
||||
`&&i++,o++;else if(p===a)break}else if("{}:(),".includes(a))d="symbol",o++;else if(a==="-"&&t[o+1]===">")o+=2;else for(;o<t.length&&!/[\s{}:(),'"]/.test(t[o])&&!(t[o]==="-"&&t[o+1]===">");)o++;const m={from:l,to:o,line:u,kind:d,depth:r.length,parens:s};if(d==="symbol"&&a==="{"){let p=e.length-1;for(;p>=0&&(e[p].kind==="comment"||t.slice(e[p].from,e[p].to)===":");)p--;const h=e[p],b={name:h?on(t.slice(h.from,h.to)):"",from:h?.from??l,open:l,close:t.length,to:t.length,line:h?.line??i,endLine:i,depth:r.length,children:[]};(r.at(-1)?.children??n).push(b),r.push(b)}else if(d==="symbol"&&a==="}"){const p=r.pop();p&&(p.close=l,p.to=o,p.endLine=i)}else d==="symbol"&&a==="("?s++:d==="symbol"&&a===")"&&(s=Math.max(0,s-1));e.push(m)}return{blocks:n,tokens:e}}function u2(t){if(/[\r\n]/.test(t))return!1;let e=0;for(const n of Ie(t).tokens){if(n.kind==="comment")return!1;if(n.kind==="quoted")continue;const r=t.slice(n.from,n.to);if(r.includes("{")||r.includes("}")||(r==="("&&e++,r===")"&&--e<0))return!1}return e===0}const on=t=>/^['"]/.test(t)?t.slice(1,-1):t;function sp(t){const e=Ie(t).tokens.filter(n=>n.kind==="comment");for(const n of e.reverse())t=t.slice(0,n.from)+t.slice(n.to);return t}function xa(t,e,n){const r=[];let i;for(let s=0;s<n.length;s++){const o=n[s];if(o.from<=e.open||o.from>=e.close)continue;const a=t.slice(o.from,o.to);if(o.parens===0&&(o.kind==="comment"||i&&t.slice(i.valueTo,o.from).includes(`
|
||||
`))&&(i=void 0),o.depth!==e.depth+1||o.kind==="comment")continue;const l=n[s+1];o.parens===0&&(o.kind==="text"||o.kind==="quoted")&&l&&t.slice(l.from,l.to)===":"?(i={name:on(a),from:o.from,to:l.to,valueFrom:l.to,valueTo:l.to,value:""},r.push(i),s++):i&&(i.to=o.to,i.valueTo=o.to)}for(const s of r)s.value=t.slice(s.valueFrom,s.valueTo).trim();return r}function d2(t,e){const n=t.slice(e.open+1,e.close);return e.line===e.endLine?[n]:n.replace(/^[^\S\n]*\n/,"").replace(/\n[^\S\n]*$/,"").split(`
|
||||
`)}function $$(t,e){const n=[];let r=e.open+1;/^[^\S\n]*\n/.test(t.slice(r,e.close))&&(r=t.indexOf(`
|
||||
`,r)+1);const i=t.lastIndexOf(`
|
||||
`,e.close-1)+1,s=i>r&&/^[ \t]*$/.test(t.slice(i,e.close))?i-1:e.close;for(;r<=s;){const o=t.indexOf(`
|
||||
`,r);let a=o===-1?s:Math.min(o,s);const l=e.children.find(u=>u.from>=r&&u.from<=a);if(l){const u=t.indexOf(`
|
||||
`,l.to);a=u===-1?s:Math.min(u,s)}n.push({from:r,to:a,block:l}),r=a+1}return n}function f2(t){const{blocks:e}=Ie(t);return e.filter(n=>n.name==="include").flatMap(n=>d2(t,n).map(r=>on(sp(r).trim()))).filter(Boolean)}const dc=t=>/[*?]/.test(t);function p2(t,e){const n=t.replace(/^\.\//,"").split(/([*?])/).map(r=>r==="*"?"[^/]*":r==="?"?"[^/]":r.replace(/[.+^${}()|[\]\\]/g,"\\$&")).join("");return new RegExp("^"+n+"$").test(e)}const h2=(t,e)=>t.some(n=>p2(n,e));function fc(t,e){const n=e.startsWith("/")?e:(t??"").slice(0,(t??"").lastIndexOf("/")+1)+e,r=[];for(const i of n.split("/"))i===".."?r.pop():i&&i!=="."&&r.push(i);return"/"+r.join("/")+(r.length&&/\/\.{0,2}$/.test(n)?"/":"")}function x$(t){const e=t.find(r=>r.kind==="main");if(!e||t.some(r=>r.content===void 0))return null;const n=t.flatMap(r=>f2(r.content).map(i=>fc(e.path,i)));return r=>h2(n,fc(e.path,r))}function w$(t){for(const e of t.map(n=>n.replace(/^\.\//,""))){const n=e.lastIndexOf("/");if(n>0&&dc(e.slice(n))&&!dc(e.slice(0,n)))return e.slice(0,n+1)}return""}function op(t){return[...t].some(e=>e.charCodeAt(0)<32||e.charCodeAt(0)>=127&&e.charCodeAt(0)<=159)?"config.newSourceControl":t.startsWith("/")?"config.newSourceAbsolute":t.split("/").some(e=>e===""||e==="."||e==="..")?"config.newSourceSegments":/[^/]\.dae$/.test(t)?null:"config.newSourceExtension"}function E$(t){const e=[];for(const n of t.map(r=>r.replace(/^\.\//,""))){const r=n.indexOf("*"),i=n.slice(0,r),s=n.slice(r+1);r<0||/[*?]/.test(i+s)||!i.includes("/")||s.includes("/")||!s.endsWith(".dae")||op(i+"name"+s)||e.some(o=>o.pattern===n)||e.push({pattern:n,prefix:i,suffix:s})}return e}function S$(t,e){if(t.includes("/"))return"config.newSourceNameSlash";const n=op(e.prefix+t+e.suffix);return n==="config.newSourceControl"?"config.newSourceNameControl":n}function m2(t,e){const n=t.find(i=>i.kind==="main"),r=n?n.path.slice(0,n.path.lastIndexOf("/")+1):"";return t.find(i=>i.path===e||i.path===r+e)??null}function ap(t=!0){const e=oe();return Ee({key:["config"],every:0,fetch:n=>e.config(n)},{enabled:t})}function wa(t,e){return t.config(e)}async function lp(t){return t.content!==void 0&&await K1(t.content)===t.content_sha256}function b2(t){const[e,n]=c.useState(new Map);return c.useEffect(()=>{let r=!0;return Promise.all(t.map(async i=>[i.id,{digest:i.content_sha256,content:i.content,complete:await lp(i)}])).then(i=>{r&&n(new Map(i))}),()=>{r=!1}},[t]),c.useCallback(r=>{const i=e.get(r.id);return i&&i.digest===r.content_sha256&&i.content===r.content?i.complete:void 0},[e])}function g2(t){const e=c.useMemo(()=>t?[t]:[],[t]),n=b2(e);return t?n(t)??null:null}function y2(t,e,n,r){if(n!==e.content_sha256)return{error:t,lastRefused:r};const i=e.id+":"+e.content_sha256;return i===r?{error:new he("config.diskAhead"),lastRefused:r}:{error:t,lastRefused:i}}const pc=t=>new TextEncoder().encode(t).length,hc=t=>Sn(413,"request_too_large",`Configuration exceeds the ${t}-byte limit`,"config.tooLarge",{limit:t});function v2(t,e,n){const[r]=[{limit:t.content,size:pc(e)},{limit:t.body,size:pc(JSON.stringify(n))}].filter(i=>i.limit!==void 0).sort((i,s)=>s.size/s.limit-i.size/i.limit);return r&&{limit:r.limit,exceeded:r.size>r.limit}}async function mc(t,e,n,r){const i=v2(t,e,n);if(i?.exceeded)throw hc(i.limit);return r().catch(s=>{throw s instanceof $e&&s.status===413&&i?hc(i.limit):s})}function cp(t,e,n){return sn(t,e,n).catch(r=>{throw n.aborted||r instanceof he?r:(Nn(),new he("ui.operationUnknown"))})}async function $2(t,e,n){const r=await cp(t,await t.createConfigSource(e,"",n),n);jt(r,"reload"),n.throwIfAborted();const i=await wa(t,n).catch(()=>(n.throwIfAborted(),null));return i&&(m2(i.sources,e)?.id??null)}function P$(t){const e=oe(),{busy:n,run:r}=dt({rethrow:!0});return{busy:n!==null,create:c.useCallback(i=>r("create",async s=>({id:await $2(e,i,s).finally(t)})),[e,r,t])}}function up(t,{rethrow:e=!1}={}){const n=oe(),r=He().data,i=r?.resources.config_validate,s=i?.available===!0&&i.modes?.includes("full")===!0,o=r?.limits.max_json_body_bytes,a=r?.resources.config.max_bytes,l=i?.max_bytes,u=c.useCallback((v,$)=>mc({content:l,body:o},v.sources.map(x=>x.content??"").join(""),v,()=>n.validateConfig(v,$)),[n,l,o]),{busy:d,error:m,run:p,cancel:h}=dt({rethrow:e}),[b,y]=c.useState(null),g=c.useRef(null);return{busy:d,cancel:h,error:m,errorSource:m?b:null,validate:c.useCallback(v=>p("validate",$=>(y(v.sources.length===1?v.sources[0].id??null:null),u(v,$))),[u,p]),apply:c.useCallback((v,$)=>p("save",async x=>{if(y(v.id),!v.writable)throw new he("config.readOnly");if(!await lp(v))throw new he("config.incomplete");x.throwIfAborted();const w=typeof $=="string"?$:$(v.content);if(w===null)return;if(s&&v.kind==="main"&&v.path!=="<redacted>"){const P=await u({sources:[{id:v.id,path:v.path,content:w}],mode:"full"},x);if(x.throwIfAborted(),!P.valid)return{diagnostics:P.diagnostics}}const R=await mc({content:a,body:o},w,{content:w},()=>n.replaceConfigSource(v.id,w,Yf(v.content_sha256),x)).catch(async P=>{if(!(P instanceof $e)
Line truncated
|
||||
`,o.from-1)+1,m=t.slice(d,o.from),p=/^\s*$/.test(m)?m:" ",h=xa(t,o,i),b=o.open+1,g=t.slice(b,o.close).match(/\n([ \t]+)\S/)?.[1]??p+(p||" ");if(o.line!==o.endLine)return k2(t,o,h,g,n);const v=[b,...h.map(x=>x.from),o.close],$=v.slice(0,-1).flatMap((x,w)=>{const R=t.slice(x,v[w+1]).trim();return R?[g+R]:[]});return Pa(t.slice(0,b)+`
|
||||
`+$.map(x=>x+`
|
||||
`).join("")+p+t.slice(o.close),e,n)}const a=s.at(-1),l=a?t.slice(a.open+1,a.close).match(/\n([ \t]+)\S/)?.[1]??" ":" ",u=[`${l}${fp(e)} {`,...n.filters.map(d=>`${l}${l}filter: ${d}`),...n.policy?[`${l}${l}policy: ${n.policy}`]:[],`${l}}`].join(`
|
||||
`);if(a){const d=t.lastIndexOf(`
|
||||
`,a.close-1)+1,m=/^[ \t]*$/.test(t.slice(d,a.close))?d:a.close;return t.slice(0,m)+(t[m-1]===`
|
||||
`?"":`
|
||||
`)+u+`
|
||||
`+t.slice(m)}return`${t.replace(/\n+$/,"")}
|
||||
|
||||
group {
|
||||
${u}
|
||||
}
|
||||
`}function k2(t,e,n,r,i){const s=n.filter(p=>p.name==="filter"),o=n.filter(p=>p.name==="policy"),a=[],l=p=>t.indexOf(`
|
||||
`,p)+1,u=p=>{const h=t.lastIndexOf(`
|
||||
`,p.from-1)+1,b=l(p.to),y=/^[ \t\r]*$/.test(t.slice(h,p.from))&&b>0&&/^[ \t\r]*$/.test(t.slice(p.to,b-1));a.push(y?{from:h,to:b,text:""}:{from:p.from,to:p.to,text:""})},d=(p,h)=>{if(p.value===h)return;const b=/^\s*/.exec(t.slice(p.valueFrom,p.valueTo))[0];a.push({from:p.valueFrom+b.length,to:p.valueTo,text:(b?"":" ")+h})};s.forEach((p,h)=>h<i.filters.length?d(p,i.filters[h]):u(p)),o.slice(0,-1).forEach(u),o.length&&(i.policy?d(o.at(-1),i.policy):u(o.at(-1)));const m=[...i.filters.slice(s.length).map(p=>`${r}filter: ${p}
|
||||
`),...i.policy&&!o.length?[`${r}policy: ${i.policy}
|
||||
`]:[]].join("");if(m){const p=s.length?l(s.at(-1).to):o.length?t.lastIndexOf(`
|
||||
`,o[0].from-1)+1:l(e.open);a.push({from:p,to:p,text:m})}return a.sort((p,h)=>h.from-p.from||h.to-p.to).reduce((p,h)=>p.slice(0,h.from)+h.text+p.slice(h.to),t)}function nr(t,e){const n=Ie(t).tokens,r=n.map(o=>t.slice(o.from,o.to));if(n[0]?.kind!=="text"||r[0]!==e||r[1]!=="("||r.at(-1)!==")"||n.at(-1)?.parens!==1)return null;const i=[];let s=!0;for(let o=2;o<n.length-1;o++){const a=n[o];if(a.parens!==1)return null;if(s){if(a.kind!=="text"&&a.kind!=="quoted"||a.kind==="text"&&/[\s:]/.test(r[o]))return null;i.push(r[o])}else if(r[o]!==",")return null;s=!s}return s&&i.length?null:i}const ni=(t,e)=>t.flatMap(n=>(nr(n,e)??[]).map(on));function M$(t){return ni(t.filters,"name")}function N$(t){return{names:ni(t.filters,"name"),subtags:ni(t.filters,"subtag"),rules:t.filters.filter(e=>nr(e,"name")===null&&nr(e,"subtag")===null)}}function L$(t,e,n){return t.filters.every(r=>{const i=nr(r,e);return i!==null&&i.every(s=>on(s)===n)})}function Li(t,e,n,r,i){const s=Sa(t).find(p=>p.name===e);if(!s&&!r.length)return t;const o=new Set(i),a=new Set(ni(s?.filters??[],n).filter(p=>!o.has(p))),l=[...new Set(r)].filter(p=>!a.has(p)&&!o.has(p)),u=p=>l.map(p.length&&p.every(h=>h.startsWith("'"))?Ni:fp);let d=!l.length;const m=[];for(const p of s?.filters??[]){const h=nr(p,n);if(h===null){m.push(p);continue}const b=h.filter(g=>!o.has(on(g))),y=d?b:[...b,...u(b)];d=!0,y.length&&m.push(`${n}(${y.join(", ")})`)}return d||m.push(`${n}(${u([]).join(", ")})`),s&&m.length===s.filters.length&&m.every((p,h)=>p===s.filters[h])||s?.filters.length&&!m.length?t:Pa(t,e,{filters:m,policy:s?.policy??null})}const T2=(t,e,n)=>Li(t,e,"name",n,[]),R2=(t,e,n)=>Li(t,e,"name",[],n),M2=(t,e,n)=>Li(t,e,"subtag",n,[]),N2=(t,e,n)=>Li(t,e,"subtag",[],n);function pp(t,e){const n=[];let r=0,i=null,s=0;for(let o=0;o<t.length;o++){const a=t[o];i?a==="\\"?o++:a===i&&(i=null):a==="'"||a==='"'?i=a:a==="("?r++:a===")"?r--:r===0&&t.startsWith(e,o)&&(n.push(t.slice(s,o)),s=o+e.length,o+=e.length-1)}return n.push(t.slice(s)),n.map(o=>o.trim())}function L2(t){const e=t.startsWith("!"),n=e?t.slice(1).trim():t,r=n.startsWith("name(")?"name":n.startsWith("subtag(")?"subtag":null;if(!r||!n.endsWith(")"))return null;const i=[],s=[];for(const o of pp(n.slice(r.length+1,-1),",")){const a=/^keyword:\s*/.exec(o),l=/^regex:\s*/.exec(o),u=on((a??l?o.slice((a??l)[0].length):o).trim());if(u)if(a)s.push(d=>d.includes(u));else if(l){let d;try{d=new RegExp(u)}catch{return null}s.push(m=>d.test(m))}else i.push(u),s.push(d=>d===u)}return s.length?{call:r,negated:e,exact:i,tests:s}:null}function I2(t){const e=pp(t,"&&").map(L2);return e.every(n=>n!==null)&&e.length?e:null}function j2(t){const e=t.map(I2).filter(n=>n!==null);if(!e.length){const n=t.some(r=>r.startsWith("group("));return r=>!n&&!Pn(r.name)}return n=>e.some(r=>(!Pn(n.name)||r.some(i=>i.call==="name"&&!i.negated&&i.exact.includes(n.name)))&&r.every(i=>i.tests.some(s=>s(i.call==="name"?n.name:n.subscription_tag??""))!==i.negated))}const I$=(t,e)=>j2(t)(e);function D2(t,e){switch(e.kind){case"addNode":return T2(t,e.group,[e.value]);case"removeNode":return R2(t,e.group,[e.value]);case"addSubscription":return M2(t,e.group,[e.value]);case"removeSubscription":return N2(t,e.group,[e.value]);case"createGroup":return Sa(t).some(n=>n.name===e.group)?t:Pa(t,e.group,{filters:[],policy:e.policy})}}const j$=(t,e)=>e.reduce(D2,t),D$=["domainSuffix","domain","geosite","dip","geoip","sip","dport","sport","pname","l4proto"],yc=["qnameSuffix","qnameFull","qnameKeyword","qnameGeosite","qtype","sip"],K$={request:yc,response:[...yc,"upstream","answerIp","answerGeoip"]};function F$(t,e){const n=e.split(/[,\s]+/).map(i=>i.trim()).filter(Boolean);if(n.some(i=>K2.test(i)||i.includes(":")&&!ip(i)))return null;const r=F2(t,n);return u2(r)&&!r.includes("->")?r:null}const K2=/[()'"#{}]|&&|->/;function F2(t,e){const n=e.map(s=>s.includes(":")?Ni(s):s),r=n.join(", "),i=s=>n.map(o=>`${s}: ${o}`).join(", ");switch(t){case"domain":return`domain(${i("full")})`;case"domainSuffix":return`domain(${i("suffix")})`;case"geosite":return`domain(${i("geosite")})`;case"dip":return`dip(${r})`;case"geoip":return`dip(${i("geoip")})`;case"sip":return`sip(${r})`;case"dport":return`dport(${r})`;case"sport":return`sport(${r})`;case"pname":return`pname(${r})`;case"l4proto":return`l4proto(${r})`;case"qnameSuffix":return`qname(${i("suffix")})`;case"qnameFull":return`qname(${i("full")})`;case"qnameKeyword":return`qname(${i("keyword")})`;case"qnameGeosite":return`qname(${i("geosite")})`;case"qtype":return`qtype(${r})`;case"upstream":return`upstream(${r})`;case"answerIp":return`ip(${r})`;case"answerGeoip":return`ip(${i("geoip")})`}}function _$(t,e){const r=t.map(i=>i.id===e?.id?e.content:i.content).flatMap(i=>i===void 0?[]:Sa(i));return[...new Map(r.map(({name:i,written:s})=>[s,{name:i,written:s}])).values()]}const qs=t=>t.path==="<redacted>"||t.path==="",_2=t=>qs(t)?t.kind==="main"?"config.dae":`${t.kind}-${t.id.slice(0,8)}.dae`:t.path.split("/").pop()||"config.dae";function A$(t,e){c
Line truncated
|
||||
`,d.from-1)+1,w=i.indexOf(`
|
||||
`,m.to),R=w===-1?i.length:w+1;return{from:x,to:R,indent:i.slice(x,d.from),text:i.slice(x,R),target:{from:y.to,to:m.to}}}function O2(t,e,n){return hp(t,e,{within:r=>r.filter(i=>i.name==="routing"),fallbacks:["fallback"],target:(e.outbound??"")+(e.must?"(must)":"")},n)}const B2=t=>t.action==="upstream"||t.action==="requery"?t.upstream??"":t.action,is=(t,e)=>t.filter(n=>n.name===e),mp=(t,e)=>is(t,"dns").flatMap(n=>is(n.children,"routing")).flatMap(n=>is(n.children,e));function B$(t,e,n,r){return hp(t,e,{within:i=>mp(i,n),fallbacks:["fallback","default"],target:B2(e),foldCase:!0},r)}function V$(t,e){const n=t.flatMap(m=>m.content===void 0?[]:mp(Ie(m.content).blocks,e).map(p=>({source:m,text:m.content,block:p})));if(n.length!==1||!n[0].source.writable)return null;const{source:r,text:i,block:s}=n[0],o=i.lastIndexOf(`
|
||||
`,s.close-1)+1,a=i.slice(o,s.close);if(o<=s.open||!/^[ \t]*$/.test(a))return null;const l=i.indexOf(`
|
||||
`,s.close),u=l===-1?i.length:l+1,d=i.slice(s.open+1,s.close).match(/\n([ \t]+)\S/)?.[1]??a+(a.slice(0,a.length/s.depth)||" ");return{source:r,anchor:{from:o,to:u,indent:d,text:i.slice(o,u)}}}function H$(t,e=Ie(t)){return e.blocks.filter(n=>n.name==="dns").flatMap(n=>n.children.filter(r=>r.name==="upstream")).flatMap(n=>xa(t,n,e.tokens).map(r=>t.slice(r.from,e.tokens.find(i=>i.from===r.from).to)))}const Ca=(t,e,n=!1)=>`${t} -> ${e}${n?"(must)":""}`,U$=t=>[...t.map(e=>e.name),...ei].map(e=>({id:e,label:e}));function z$(t,e,n,r,i){return t.slice(e.from,e.to)===e.text?t.slice(0,e.from)+`${e.indent}${Ca(n,r,i)}
|
||||
`+t.slice(e.from):null}function q$(t,e,n,r){return e.target&&t.slice(e.from,e.to)===e.text?t.slice(0,e.target.from)+` ${n}${r?"(must)":""}`+t.slice(e.target.to):null}function W$(t,e){return t.slice(e.from,e.to)===e.text?t.slice(0,e.from)+t.slice(e.to):null}function V2(t,e){const n=t.content??"",r=Ie(n),i=e.map(a=>({rule:a,anchor:O2(t,a.before,r)}));if(i.some(a=>!a.anchor))return null;i.sort((a,l)=>a.anchor.from-l.anchor.from||a.rule.id-l.rule.id);let s="",o=0;for(const{rule:a,anchor:l}of i)s+=n.slice(o,l.from)+l.indent+Ca(a.condition,a.outbound,a.must)+`
|
||||
`,o=l.from;return s+n.slice(o)}function ka(t){const e=new Map;for(const n of t)e.set(n.sourceId,[...e.get(n.sourceId)??[],n]);return[...e.values()]}function vc(t,e,n,r){const i=e??(t instanceof $e&&t.status===422?t.details?.diagnostics??null:null);if(!i)return{text:Sy(Yo(t,r,r("ui.writeFailed")),r),lines:[]};const s=i.filter(a=>a.level==="error").length,o=A2(i);return{text:o?r("config.writeRestart",{n:o}):s?r("ui.writeInvalid",{n:s}):r("rule.refused"),lines:i.map(a=>{const l=Jo(Go(a.code,a.message,r),r),u=n.find(d=>d.id===a.source_id);return a.line===null?l:r("config.atFile",{file:u?_2(u):a.source_id,line:a.line,message:l})})}}function G$(t,e,n){const r=ka(t).length;return t.length?{title:n("rule.pending",{n:t.length}),files:r>1?n("rule.pendingFiles",{n:r}):null,failure:e,rows:t.map(i=>({id:i.id,line:Ca(i.condition,i.outbound,i.must),position:i.before.kind==="fallback"?n("rule.positionEnd"):n("rule.positionBefore",{n:i.before.index+1})}))}:null}function H2(t,e,n,r){return e?{text:r("rule.partial",{n:e,held:n}),lines:[t.text,...t.lines]}:t}const $c=()=>void Nn();function U2(){const t=ee(),e=up($c,{rethrow:!0}),n=dp().applying,r=c.useRef(null);c.useEffect(()=>()=>r.current?.abort(),[]);const i=async(l,u)=>{let d=[],m;try{if(d=(await wa(oe(),u)).sources,u.aborted)return;const p=d.find(b=>b.id===l[0].sourceId),h=p&&await e.apply(p,()=>m=V2(p,l));return!p||m===null?($c(),{written:!1,failure:{text:t("rule.stale"),lines:[]}}):h?h.diagnostics?{written:!1,failure:vc(null,h.diagnostics,d,t)}:{written:!0,failure:null}:void 0}catch(p){return u.aborted?void 0:{written:p instanceof he&&(p.key==="ui.writtenNotApplied"||p.key==="ui.operationUnknown"),failure:vc(p,null,d,t)}}},s=async(l,u)=>{let d=0;for(const m of ka(l)){const p=await i(m,u);if(!p)return;p.written&&$n.remove(m.map(b=>b.id));const h=p.written?m.length:0;if(p.failure)return{written:d+h,failure:H2(p.failure,d&&d+h,l.length-d-h,t)};d+=h}return{written:d,failure:null}};return{apply:async l=>{if(!$n.begin())return;const u=new AbortController;r.current=u;try{return await s(l,u.signal)}finally{r.current===u&&(r.current=null),$n.end()}},busy:n,cancel:()=>{r.current?.abort(),e.cancel()}}}function z2(){const t=ee(),{rules:e}=dp(),{apply:n,busy:r}=U2(),i=ka(e).length;return{count:e.length,label:i>1?t("rule.applyFiles",{n:e.length,files:i}):t("rule.applyPending",{n:e.length}),busy:r,apply:async()=>{const s=await n(e);s&&($n.fail(s.failure),Le(s.failure?"negative":"positive",s.failure?s.failure.text:t("rule.applied",{n:e.length})))}}}function q2(t,e,n,r){return Object.keys(Os).filter(i=>t(i)||e===i).map(i=>({id:i,label:r(Os[i]),isPending:e===i,isDisabled:!!e,onAction:()=>n(i)}))}function W2(t,e,n){const r=ee(),i=Qv(t,e,n),s=o=>void i.run(o).then(a=>{a&&Le("positive",r("ov.operationResult",{action:r(Os[o]),status:r("ov.succeeded"),id:a.operation_id}))},a=>Ky(a,r,r("ov.operationError")));return{canRun:i.canRun,busy:i.busy,run:s,actions:q2(i.canRun,i.busy,s,r)}}function G2({className:t,...e}){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:W("rp-icon",t),...e,children:f.jsx("path",{fill:"currentColor",d:"m17.13 5.734-5.75-4.472c-.812-.631-1.948-.632-2.76 0L2.87 5.735h-.002C2.324 6.157 2 6.821 2 7.511v8.239C2 16.99 3.01 18 4.25 18h11.5c1.24 0 2.25-1.01 2.25-2.25V7.51c0-.689-.324-1.353-.87-1.776M11.5 16.5h-3v-4.75c0-.413.337-.75.75-.75h1.5c.413 0 .75.337.75.75zm5-.75c0 .413-.337.75-.75.75H13v-4.75c0-1.24-1.01-2.25-2.25-2.25h-1.5C8.01 9.5 7 10.51 7 11.75v4.75H4.25c-.413 0-.75-.337-.75-.75V7.51c0-.229.108-.45.29-.592l5.75-4.47c.272-.213.65-.21.92-.002l5.75 4.472c.182.142.29.363.29.593z"})})}function bp({className:t,...e}){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:W("rp-icon",t),...e,children:f.jsx("path",{fill:"currentColor",d:"M5.313 18.748c-1.04 0-2.08-.396-2.873-1.188-1.584-1.584-1.584-4.163 0-5.747l3.906-3.906c1.585-1.584 4.162-1.583 5.747 0q.327.329.566.71c.22.35.115.814-.235 1.034-.353.222-.814.115-1.034-.235q-.152-.241-.36-.45c-.999-.998-2.625-.997-3.624.002l-3.905 3.905c-.999 1-.999 2.627 0 3.626 1.001 1.001 2.627.997 3.626 0l1.952-1.952c.293-.293.768-.293 1.06 0s.294.767 0 1.06L8.189 17.56c-.792.792-1.834 1.187-2.875 1.188m8.341-6.655 3.906-3.905c1.584-1.585 1.584-4.164 0-5.748s-4.164-1.584-5.747 0L9.86 4.393c-.293.293-.293.767 0 1.06s.768.293 1.06 0l1.953-1.952c1-.998 2.625-1 3.626 0 .999.999.999 2.626 0 3.626l-3.905 3.905c-1 1-2.625 1-3.624.001q-.208-.207-.36-.449c-.22-.35-.681-.457-1.034-.235-.35.22-.456.683-.235 1.034q.24.381.566.71c.793.792 1.833 1.188 2.874 1.188 1.04 0 2.081-.396 2.873-1.188"})})}function J2({className:t,...e}){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:W("rp-icon",t),...e,children:[f.jsx("path",{fill:"currentColor",d:"m13.527 5.49-3.002-2.997c-.293-.29
Line truncated
|
||||
`,r.from-1)+1,s=n.filter(l=>l.from>=i&&l.to<=r.from);if(s.some(l=>l.depth!==1))return[];const o=s.findIndex(l=>l.parens===0&&t.slice(l.from,l.to)==="->"),a=o===-1||o===s.length-1?"":t.slice(s[o+1].from,r.from).trim();return[{from:i,to:r.to+(t[r.to]===`
|
||||
`?1:0),target:a}]})}function D5(t){const{blocks:e,tokens:n}=Ie(t),r=Cp(t,e,n).find(i=>i.target);return r?r.target==="direct"?{mode:"direct"}:{mode:"global",target:r.target}:{mode:"rule"}}function K5(t,e){const n=Ie(t);for(const p of Cp(t,n.blocks,n.tokens).reverse())t=t.slice(0,p.from)+t.slice(p.to);if(e.mode==="rule")return t;const{blocks:r,tokens:i}=Ie(t),s=r.find(p=>p.name==="routing");if(!s)throw new he("act.modeNoRouting");const a=t.slice(s.open+1,s.close).match(/\n([ \t]+)\S/)?.[1]??" ";let l=s.open+1;t[l]===`
|
||||
`&&l++;let u=null;const d=p=>{const h=t.indexOf(`
|
||||
`,p);return t.slice(t.lastIndexOf(`
|
||||
`,p-1)+1,h===-1?void 0:h).trim()};for(let p=0;p<i.length;p++){const h=i[p];if(h.from<=s.open||h.to>s.close||h.depth!==1||h.parens!==0||t.slice(h.from,h.to)!=="->")continue;const b=i[p+1],y=i[p+2],g=i[p+3],v=i[p+4];if(!(b&&y&&g&&v&&t.slice(y.from,y.to)==="("&&t.slice(g.from,g.to)==="must"&&t.slice(v.from,v.to)===")")){u??=d(h.from);continue}if(u!==null)throw new he("act.modeInterleaved",u);const x=t.indexOf(`
|
||||
`,v.to);l=x!==-1&&x<s.close?x+1:v.to;const w=i[p+5];if(w&&w.from<l&&w.kind!=="comment")throw new he("act.modeInterleaved",d(w.from))}const m=e.mode==="direct"?"direct":e.target;return t.slice(0,l)+(t[l-1]===`
|
||||
`?"":`
|
||||
`)+`${a}l4proto(tcp, udp) -> ${m} ${Pp}
|
||||
`+t.slice(l)}const F5=(t,e)=>t.mode===e.mode&&(t.mode!=="global"||e.mode!=="global"||t.target===e.target),Nc=["ok","warn","err"];function _5(t,e,n,r){const i=sv(t),s=t?Sp(iv,t,r):n;return!t||e!=="degraded"&&e!=="failed"?{tone:i,text:s,href:null}:{tone:Nc[Math.max(Nc.indexOf(i),e==="failed"?2:1)],text:r(e==="failed"?"ov.status.datapathFailed":"ov.status.datapathDegraded",{status:s}),href:nt("overview",{card:"datapath"})}}const kp={rule:"mode.rule",direct:"mode.direct",global:"mode.global"};function A5(t,e,n,r,i,s,o=!0){const a=r?e??t:t,l=a.mode==="global"?a.target:(t.mode==="global"?t.target:n[0]?.name)??"";return{mode:o?a.mode:"",target:o?l:"",targetText:o&&l||"—",writable:r,dirty:r&&e!==null&&!F5(e,t),incomplete:a.mode==="global"&&!l,status:s(i?"act.modeReadOnly":"act.modeUnavailable"),readOnly:i&&!r,modes:["rule","direct","global"].map(u=>[u,s(kp[u])]),targets:n.map(u=>({id:u.name,label:u.name}))}}function O5({writable:t,dirty:e,incomplete:n,status:r},i,s){return i?{mode:null,global:null}:t?{mode:n?s("act.globalMissing"):e?null:s("config.noChanges"),global:null}:{mode:null,global:r}}const B5=t=>t.event!=="runtime.updated"&&t.event!=="flow.updated"&&!cv(t),V5=8;function H5(t,e){const n=[];for(const r of t){const i=dv(r,e),s=[r.event,i.key,...Object.entries(i.params??{}).map(([l,u])=>`${l}=${String(u)}`)].join("|"),o=n[n.length-1];if(o&&o.key===s){o.count+=1;continue}if(n.length===V5)break;const a=Object.fromEntries(Object.entries(i.params??{}).map(([l,u])=>[l,typeof u=="string"?fv(u):u]));n.push({id:r.id,tone:r.event==="flow.gap"?"warn":"info",kindText:e(r.event==="flow.gap"?"ui.warning":"ui.notice"),summaryText:e("ui.valuePair",{label:Sp(lv,r.event,e),value:e(i.key,a)}),key:s,count:1})}return n.map(({key:r,count:i,summaryText:s,...o})=>({...o,summaryText:i>1?e("ui.aside",{text:s,note:e("act.noticeRepeat",{n:i})}):s}))}function U5(t,e,n,r=!1){return t.down.some(i=>i!==null)||t.up.some(i=>i!==null)?"ready":e===!1?r?"loading":"unavailable":n?"empty":"loading"}function z5(t,e,n){const r=new Map;for(const o of t)r.set(o.name,(r.get(o.name)??0)+1);const i=t.map(o=>{const a=J1(o);return{id:o.id,name:o.name,label:r.get(o.name)>1?n("ui.aside",{text:o.name,note:[o.subscription_tag??o.provider_id??o.id,o.id].join(n("ui.separator"))}):o.name,tcp:Y1(a),alive:a?.state==="unavailable"?!1:a?.state==="healthy"?!0:void 0,unavailable:a?.state==="unavailable",healthError:a?.error?by(a.error,n):void 0}}),s=i.find(o=>o.id===e)??i.find(o=>o.tcp!==void 0)??i.find(o=>!Pn(o.name))??i[0];return{options:i,big:i.length>12,id:s?.id??"",name:s?.name??"",latency:s?.alive&&s.tcp!==void 0?wf(s.tcp,n):"—",tone:s?.alive?"ok":s?.unavailable?"err":"muted",status:n(s?.alive?"act.good":s?.unavailable?"act.unavailable":"act.unknown"),healthError:s?.healthError}}const q5={ok:"act.memoryOk",warn:"act.memoryHigh",err:"act.memoryNearLimit"};function W5(t,e,n,r,i="en",s){const o=sa(e?.cgroup?.current_bytes??null,e?.cgroup?.limit_bytes??null),a=o===null?null:ov(o),{tone:l,text:u}=_5(t?.lifecycle.state,s,n(r===!1?"act.modeUnavailable":"ui.loading"),n);return{status:{tone:l,text:u},download:Ds(t?.traffic.rates?.download_bytes_per_second??null,i),upload:Ds(t?.traffic.rates?.upload_bytes_per_second??null,i),connections:t?.traffic.connections.total==null?"—":En(t.traffic.connections.total,i),rss:Xt(e?.process?.rss_bytes??null,i),memoryBadge:a===null?null:{tone:a,text:n(q5[a])}}}function G5(t,e,n,r){const i=Z1(t);return{since:t?r("act.since",{t:e1(t.counter_since,e)}):"",total:Xt(i.total,e),rows:i.rows.map((s,o)=>({name:fa(s.name,r),value:s.percent===null?null:Math.round(s.percent),text:Xt(s.bytes,e),color:s.kind==="builtin"&&s.name==="block"?n.love:n.cat[o%n.cat.length]}))}}function J5(t,e,n,r,i){return j5(t,e).map((s,o)=>({name:s.name,value:s.percent===null?Xt(s.download,r):i("ui.share",{bytes:Xt(s.download,r),percent:s.percent}),pct:s.percent??0,color:n.cat[o%n.cat.length]}))}function Y5(){const t=ee(),e=oe(),n=P2(B5);return{rows:c.useMemo(()=>H5(n.records,t),[n.records,t]),total:n.records.length,error:n.error,retry:()=>void Nn().then(()=>Ov(e)),loading:!n.error&&n.available===null,empty:t(n.available===!1?"event.unavailable":"act.noIssues")}}const X5=(t,e)=>t.kind==="invalid"?{kind:"negative",text:e("ui.writeInvalid",{n:t.errors})}:t.kind==="failed"?Yo(t.error,e,e("ui.writeFailed")):null;function Z5(){const t=He().data?.resources,e=tt(t,"config",{whileLoading:!1})&&t?.config.writable===!0&&t?.config.content===!0,n=ap(tt(t,"config",{whileLoading:!1})),r=up(n.refetch,{rethrow:!0}),i=n.data?.sources.find(d=>d.kind==="main"&&d.writable)??null,s=g2(i),o=s?i:null,a=s===!1,l=c.useMemo(()=>n.error??(a?new he("config.incomplete"):null),[n.error,a]),{apply:u}=r;return{main:o,writable:e,busy:r.busy!==null,error:l,retry:n.refetch,apply:c.useCallback(async(d,m=o??void 0)=>{if(!m)return{kind:"failed",error:l??new he("config.incomplete")};try{const p=await u(m,d);return p?p.diagnostics?{kind:"invalid",errors:p.diagnostics.filter(h=>h.level==="error").length}:{k
Line truncated
|
||||
`),settingName:t=>`experimental.native_api.${t}`,redactedSections:t=>t.filter(e=>e.name==="experimental"&&e.children.some(n=>n.name==="native_api")).map(e=>({block:e,name:"experimental.native_api"}))},o3={id:"unknown",reason:()=>{},holdsCredentials:()=>!1,snippet:t=>t.map(({key:e,value:n})=>`${e}: ${n}`).join(`
|
||||
`),settingName:t=>t,redactedSections:()=>[]};function a3(t){switch(t?.api.name){case"dae/honk-native":return s3;default:return o3}}const Ic={connections:"nav.connections",flows:"rule.flows",routing_trace:"ov.r.routingTrace",dns_query:"ov.r.dnsQuery",dns_cache:"ov.r.dnsCache",dns_log:"ov.r.dnsLog",events:"nav.events",probes:"ov.r.probes",traffic_history:"ov.r.trafficHistory",memory_history:"ov.r.memoryHistory",runtime_outbounds:"ov.r.outbounds",logs:"nav.logs",providers:"nodes.providers",rules:"rule.listTitle",config:"nav.config",config_validate:"ov.r.configValidate",runtime_settings:"settings.runtime",geodata:"settings.geodata"},l3=["configNotLoaded","configReadOnly","mainReadOnly","recordOff","geodataUpdate","geodataUnreadable","notRunning","flowsIdle","notProvided"],c3={"recorder-off":"recordOff","starting-or-stopping":"notRunning","geodata-mismatch":"geodataUnreadable"},u3={"config-unloaded":{text:"ov.lim.configMissing"},"writes-off":{text:"ov.lim.configWrite",docs:["read-only","ov.lim.docsReadOnly"]},"main-file-read-only":{text:"ov.lim.mainReadOnly",docs:["read-only","ov.lim.docsReadOnly"]},"recorder-off":{text:"ov.lim.recordOff"},"no-download-urls":{text:"ov.lim.geoNoStateDb",docs:["state-db","ov.lim.docsStateDb"]},"geodata-mismatch":{text:"ov.lim.geoUnreadable"},"starting-or-stopping":{text:"ov.lim.notRunningReason"}};function d3(t,e,n,r){const i=t.resources,s=a3(e),o=v=>s.reason(v,t),a=new Map,l=(v,$,x=Ic[$])=>{const w=a.get(v)??[];w.push({id:$,label:n(x)}),a.set(v,w)},u=(v,$)=>({href:Ma(r,v),text:n($),external:!0}),d=(v,$)=>({label:n("ov.lim.why"),text:n(v),link:$}),m=v=>{const $=v.find(k=>k!==void 0),x=$&&u3[$.code];if(!x)return;const w=x.docs&&u(...x.docs),R=v.flatMap(k=>k&&"settings"in k?k.settings:[]);return R.length>0?{label:n("ov.lim.howTo"),text:n(x.text),snippet:s.snippet(R),link:w}:d(x.text,w)},p=i.config.available?i.config.writable!==!0?"configReadOnly":null:"configNotLoaded";p&&l(p,"config");const h=!i.config_validate.available&&p==="configNotLoaded";h&&l("configNotLoaded","config_validate"),(i.nodes.can_manage===!1||i.providers.can_manage===!1)&&l(p??"mainReadOnly","manage","ov.lim.manage");const b=i.runtime_settings.available&&(i.runtime_settings.fields??[]).includes("record_flows");for(const v of Object.keys(Ic)){const $=i[v];if(v==="config"||v==="config_validate"&&h)continue;const x=v==="flows"&&$.available&&i.flows.recording==="off";if(x||!$.available){const w=o(v)?.code;l((w&&c3[w])??(x?"flowsIdle":"notProvided"),v)}else v==="geodata"&&i.geodata.can_update!==!0&&l(p??"geodataUpdate",v),v==="providers"&&i.providers.can_refresh===!1&&l("notRunning","subscriptions","ov.lim.subscriptions"),v==="connections"&&i.connections.can_close===!1&&l("notProvided","close","ov.lim.close")}const y=()=>{const v=i.geodata;if(v.assets?.length===0)return d("ov.lim.geoNoAssets");const $=m([o("geodata")]);if($)return $;if(v.configurable_sources===!0)return d("ov.lim.geoNoUrl",{href:nt("settings",{card:"geodata"}),text:n("settings.geodata")})},g=(v,$)=>{const x=$.length,w=()=>$.map(R=>o(R.id));switch(v){case"configNotLoaded":return{headline:n("ov.lim.h.configNotLoaded"),named:["config"],help:m([o("config")])};case"configReadOnly":return{headline:n("ov.lim.h.configReadOnly"),named:["config"],help:m([o("config")])};case"mainReadOnly":return{headline:n("ov.lim.h.mainReadOnly"),named:["manage"],help:m([o("manage")])};case"recordOff":return{headline:n("ov.lim.h.recordOff",{n:x}),help:m(w())};case"geodataUpdate":return{headline:n("ov.lim.h.geodataUpdate"),named:["geodata"],help:y()};case"geodataUnreadable":return{headline:n("ov.lim.h.geodataUnreadable"),named:["geodata"],help:m(w())};case"notRunning":return{headline:x>1?n("ov.lim.h.notRunning",{n:x}):n($[0].id==="probes"?"ov.lim.h.probes":"ov.lim.h.subscriptions"),named:x>1?[]:[$[0].id],help:m(w())};case"flowsIdle":return{headline:n(o("flows")?.code==="recorded-on-demand"?"ov.lim.h.flowsIdle":"ov.lim.h.flowsOff"),named:["flows"],link:b?{href:nt("settings",{card:"runtime"}),text:n("settings.runtime")}:void 0};case"notProvided":{const R=w().some(k=>k?.code==="build-lacks");return{headline:n(R?"ov.lim.h.notProvided":"ov.lim.h.notProvidedOther",{n:x}),link:R?u("honk-version","ov.lim.docsVersion"):void 0}}}};return l3.flatMap(v=>{const $=a.get(v);if(!$)return[];const{named:x=[],...w}=g(v,$),R=$.filter(k=>!x.includes(k.id));return[{cause:v,...w,items:$,features:R.length>0?hy(r,$.map(k=>k.label)):void 0}]})}function f3(){const t=ee(),e=Mn(),n=ct[e],r=Ra(),i=He(),s=i.data?.resources,o=qv(tt(s,"runtime",{whileLoading:!1})),a=Zv(tt(s,"runtime_memory",{whileLoading:!1})),l=Yv(tt(s,"datapath",{whileLoading:!1})),[u,d]=c.useState("live"),m=Rc[u]??120,p=M5(i.data,a.data),h=Gv(m,i.data),b=L5(o.data),y=c.useMemo(()=>h.data?I5(h.data):[],[h.data]),g=c.useMemo(()=>Mc(b,y,m),[b,y,m]),v=c.useMemo(()=>Mc(b,y,Rc.live,void 0,24),[b,y]),$=c.useMemo(()=>[{label:t("act.download"),color:r.cat[0],values:g.down},{label:t("act.upload"),color:r.cat[3],values:g.up}],[t,r,g]),x=c.useMemo(()=>[
Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1PCEKM_Y.woff2)format("woff2");unicode-range:U+301,U+400-45F,U+490-491,U+4B0-4B1,U+2116;ascent-override:100%;descent-override:20%;line-gap-override:0%}@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1NyEKM_Y.woff2)format("woff2");unicode-range:U+102-103,U+110-111,U+128-129,U+168-169,U+1A0-1A1,U+1AF-1B0,U+300-301,U+303-304,U+308-309,U+323,U+329,U+1EA0-1EF9,U+20AB;ascent-override:100%;descent-override:20%;line-gap-override:0%}@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1NiEKM_Y.woff2)format("woff2");unicode-range:U+100-2BA,U+2BD-2C5,U+2C7-2CC,U+2CE-2D7,U+2DD-2FF,U+304,U+308,U+329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;ascent-override:100%;descent-override:20%;line-gap-override:0%}@font-face{font-family:Noto Sans TC;font-style:normal;font-weight:100 900;font-display:optional;src:url(../fonts/-nF7OG829Oofr2wohFbTp9i1OCEK.woff2)format("woff2");unicode-range:U+??,U+131,U+152-153,U+2BB-2BC,U+2C6,U+2DA,U+2DC,U+304,U+308,U+329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;ascent-override:100%;descent-override:20%;line-gap-override:0%}:root,:root[data-family=rose-pine]{--rp-base:#faf4ed;--rp-surface:#fffaf3;--rp-overlay:#f2e9e1;--rp-muted:#9893a5;--rp-subtle:#797593;--rp-text:#464261;--rp-love:#b4637a;--rp-gold:#ea9d34;--rp-rose:#d7827e;--rp-pine:#286983;--rp-foam:#56949f;--rp-iris:#907aa9;--rp-c1:var(--rp-pine);--rp-c2:var(--rp-foam);--rp-c3:var(--rp-iris);--rp-c4:var(--rp-gold);--rp-c5:var(--rp-rose);--rp-c6:var(--rp-love);--rp-c7:var(--rp-pine);--rp-c8:var(--rp-foam);--rp-hl-low:#f4ede8;--rp-hl-med:#dfdad9;--rp-hl-high:#cecacd;--rp-shadow:0 1px 2px #57527914}:root[data-family=rose-pine]{--rp-negative-text:var(--rp-text);--rp-notice-text:var(--rp-text);--rp-positive-text:var(--rp-text);--rp-accent-tile-text:var(--rp-text);--rp-info-tile-text:var(--rp-text);--rp-subtle-text:var(--rp-text)}:root[data-family=rose-pine][data-scheme=dark],:root[data-flavour=moon][data-scheme=dark]{--rp-base:#232136;--rp-surface:#2a273f;--rp-overlay:#393552;--rp-muted:#6e6a86;--rp-subtle:#908caa;--rp-text:#e0def4;--rp-love:#eb6f92;--rp-gold:#f6c177;--rp-rose:#ea9a97;--rp-pine:#3e8fb0;--rp-foam:#9ccfd8;--rp-iris:#c4a7e7;--rp-c1:var(--rp-pine);--rp-c2:var(--rp-foam);--rp-c3:var(--rp-iris);--rp-c4:var(--rp-gold);--rp-c5:var(--rp-rose);--rp-c6:var(--rp-love);--rp-c7:var(--rp-pine);--rp-c8:var(--rp-foam);--rp-hl-low:#2a283e;--rp-hl-med:#44415a;--rp-hl-high:#56526e;--rp-shadow:0 1px 2px #0000004d;--rp-line:var(--rp-hl-med);--rp-fill:var(--rp-hl-med);--rp-on-accent:#191724;--rp-accent-text:var(--rp-text);--rp-negative-text:var(--rp-negative);--rp-notice-text:var(--rp-notice);--rp-positive-text:var(--rp-positive);--rp-info-text:var(--rp-text);--rp-negative-tile-text:var(--rp-text)}:root[data-flavour=main][data-scheme=dark]{--rp-base:#191724;--rp-surface:#1f1d2e;--rp-overlay:#26233a;--rp-muted:#6e6a86;--rp-subtle:#908caa;--rp-text:#e0def4;--rp-love:#eb6f92;--rp-gold:#f6c177;--rp-rose:#ebbcba;--rp-pine:#31748f;--rp-foam:#9ccfd8;--rp-iris:#c4a7e7;--rp-c1:var(--rp-pine);--rp-c2:var(--rp-foam);--rp-c3:var(--rp-iris);--rp-c4:var(--rp-gold);--rp-c5:var(--rp-rose);--rp-c6:var(--rp-love);--rp-c7:var(--rp-pine);--rp-c8:var(--rp-foam);--rp-hl-low:#21202e;--rp-hl-med:#403d52;--rp-hl-high:#524f67;--rp-shadow:0 1px 2px #00000059;--rp-on-accent:#fff;--rp-negative-tile-text:var(--rp-negative)}:root[data-family=catppuccin]{--rp-base:#e6e9ef;--rp-surface:#eff1f5;--rp-overlay:#dce0e8;--rp-muted:#9ca0b0;--rp-subtle:#6c6f85;--rp-text:#4c4f69;--rp-love:#d20f39;--rp-gold:#df8e1d;--rp-rose:#fe640b;--rp-pine:#1e66f5;--rp-foam:#179299;--rp-iris:#8839ef;--rp-c1:#1e66f5;--rp-c2:#179299;--rp-c3:#8839ef;--rp-c4:#fe640b;--rp-c5:#40a02b;--rp-c6:#ea76cb;--rp-c7:#df8e1d;--rp-c8:#d20f39;--rp-hl-low:#dce0e8;--rp-hl-med:#ccd0da;--rp-hl-high:#bcc0cc;--rp-shadow:0 1px 2px #4c4f691a;--rp-on-accent:#fff;--rp-accent-text:var(--rp-text);--rp-negative-text:var(--rp-text);--rp-notice-text:var(--rp-text);--rp-positive-text:var(--rp-text);--rp-info-text:var(--rp-text);--rp-subtle-text:var(--rp-text)}:root[data-family=catppuccin][data-scheme=dark],:root[data-flavour=mocha][data-scheme=dark]{--rp-base:#181825;--rp-surface:#1e1e2e;--rp-overlay:#313244;--rp-muted:#6c7086;--rp-subtle:#a6adc8;--rp-text:#cdd6f4;--rp-love:#f38ba8;--rp-gold:#f9e2af;--rp-rose:#fab387;--rp-pine:#89b4fa;--rp-foam:#94e2d5;--rp-iris:#cba6f7;--rp-c1:#89b4fa;--rp-c2:#94e2d5;--rp-c3:#cba6f7;--rp-c4:#fab387;--rp-c5:#a6e3a1;--rp-c6:#f5c2e7;--rp-c7:#f9e2af;--rp-c8:#f38ba8;--rp-hl-low:#313244;--rp-hl-med:#45475a;--rp-hl-high:#585b70;--rp-shadow:0 1px 2px #00000059;--rp-on-accent:var(--rp-surface);--rp-accent-text:var(--rp-accent);--rp-negLine truncated
|
||||
@@ -1,62 +0,0 @@
|
||||
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./fonts-tc-B6Zt5HQN.css","./fonts-sc-DWPGxLPK.css","./SearchDialog-h0qVIWxg.js","./vendor-react-Bf71BWbF.js","./flows-C0byZ3sY.js","./nav-C2A1sZKm.js","./nav-D1cfWFA0.js","./nav-BIpfWn6-.js","./nav-BeFLfZq8.js","./index-ChxA9-bE.js","./geodata-DprMPspn.js","./auth-DmBaDwOI.js","./auth-BGnwk8Hi.js","./AreaChart-DtE4xcoZ.js","./layout-BRLew_nj.js","./AreaCurve-BriPYJva.js","./array-C0P64tl-.js","./Sparkline-B2EO782x.js","./Donut-BhofZH9-.js","./NodeSearch-Dmxd0d8_.js","./Virtualizer--Vfl8O3n.js","./useFilter-DZ8TXqn_.js","./ListLayout-CPapuywx.js","./Overview-Fg9wiBtP.js","./files-BxEOxSF8.js","./Table-D0NFHHNQ.js","./useGridSelectionCheckbox-BV96yL-N.js","./ActionGroup-90AzAQje.js","./DaeCode-STEiRZuV.js","./Connections-L2aJE6s8.js","./FactStrip-BgQ_tYB6.js","./ranked-FVqORIQj.js","./TimeCell-gSIuLEFc.js","./link-D6L0Eg5i.js","./outbounds-f8QoVoCV.js","./Dns-vjK8rYCH.js","./dns-DQrpG8y_.js","./Policies-wpHv6bOW.js","./policyText-CAFy3qpo.js","./PolicyPicker-DSSmYroN.js","./Rules-CSApE4tY.js","./setup-B5f1cfyO.js","./recorder-DlDpPhd4.js","./probe-C8ejAKwA.js","./Rules-l5FnUA9B.css","./Nodes-CF-Y3hZu.js","./AddCircle-Db3HxlxQ.js","./Config-BTdL4dU5.js","./vendor-editor-CF5uj9id.js","./Events-B-WlUhq0.js","./Logs-bjF3zhK-.js","./Settings-Ajzo2fTI.js","./Login-CBpAitxd.js"])))=>i.map(i=>d[i]);
|
||||
import{$ as w,r as c,c as Lp,s as Ws,a as Qt,b as kc,j as f,d as Ip}from"./vendor-react-Bf71BWbF.js";(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const s of i)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(i){const s={};return i.integrity&&(s.integrity=i.integrity),i.referrerPolicy&&(s.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?s.credentials="include":i.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function r(i){if(i.ep)return;i.ep=!0;const s=n(i);fetch(i.href,s)}})();const jp="modulepreload",Dp=function(t,e){return new URL(t,e).href},El={},pe=function(e,n,r){let i=Promise.resolve();if(n&&n.length>0){let o=function(d){return Promise.all(d.map(m=>Promise.resolve(m).then(p=>({status:"fulfilled",value:p}),p=>({status:"rejected",reason:p}))))};const l=document.getElementsByTagName("link"),a=document.querySelector("meta[property=csp-nonce]"),u=a?.nonce||a?.getAttribute("nonce");i=o(n.map(d=>{if(d=Dp(d,r),d in El)return;El[d]=!0;const m=d.endsWith(".css"),p=m?'[rel="stylesheet"]':"";if(!!r)for(let y=l.length-1;y>=0;y--){const g=l[y];if(g.href===d&&(!m||g.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${d}"]${p}`))return;const b=document.createElement("link");if(b.rel=m?"stylesheet":jp,m||(b.as="script"),b.crossOrigin="",b.href=d,u&&b.setAttribute("nonce",u),document.head.appendChild(b),m)return new Promise((y,g)=>{b.addEventListener("load",y),b.addEventListener("error",()=>g(new Error(`Unable to preload CSS for ${d}`)))})}))}function s(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return i.then(o=>{for(const l of o||[])l.status==="rejected"&&s(l.reason);return e().catch(s)})};function ot(...t){return(...e)=>{for(let n of t)typeof n=="function"&&n(...e)}}const ee=typeof document<"u"?w.useLayoutEffect:()=>{},Tc={prefix:String(Math.round(Math.random()*1e10)),current:0},Rc=w.createContext(Tc),Kp=w.createContext(!1);let Ni=new WeakMap;function Fp(t=!1){let e=c.useContext(Rc),n=c.useRef(null);if(n.current===null&&!t){let r=w.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED?.ReactCurrentOwner?.current;if(r){let i=Ni.get(r);i==null?Ni.set(r,{id:e.current,state:r.memoizedState}):r.memoizedState!==i.state&&(e.current=i.id,Ni.delete(r))}n.current=++e.current}return n.current}function _p(t){let e=c.useContext(Rc),n=Fp(!!t),r=`react-aria${e.prefix}`;return t||`${r}-${n}`}function Ap(t){let e=w.useId(),[n]=c.useState(Je()),r=n?"react-aria":`react-aria${Tc.prefix}`;return t||`${r}-${e}`}const Op=typeof w.useId=="function"?Ap:_p;function Bp(){return!1}function Vp(){return!0}function Hp(t){return()=>{}}function Je(){return typeof w.useSyncExternalStore=="function"?w.useSyncExternalStore(Hp,Bp,Vp):c.useContext(Kp)}function Up(t){let[e,n]=c.useState(t),r=c.useRef(e),i=c.useRef(null),s=c.useRef(()=>{if(!i.current)return;let l=i.current.next();if(l.done){i.current=null;return}r.current===l.value?s.current():n(l.value)});ee(()=>{r.current=e,i.current&&s.current()});let o=c.useCallback(l=>{i.current=l(r.current),s.current()},[s]);return[e,o]}let zp=!!(typeof window<"u"&&window.document&&window.document.createElement),hn=new Map,cn;typeof FinalizationRegistry<"u"&&(cn=new FinalizationRegistry(t=>{hn.delete(t)}));let Li=new WeakMap;function de(t){let[e,n]=c.useState(t),r=c.useRef(null),i=Op(e),s=c.useRef(null),o=Li.get(s);if(cn&&o!==i&&(o!=null&&cn.unregister(s),cn.register(s,i,s),Li.set(s,i)),zp){const l=hn.get(i);l&&!l.includes(r)?l.push(r):hn.set(i,[r])}return ee(()=>{let l=i;return()=>{cn&&(cn.unregister(s),Li.delete(s)),hn.delete(l)}},[i]),c.useEffect(()=>{let l=r.current;return l&&n(l),()=>{l&&(r.current=null)}}),i}function Wp(t,e){if(t===e)return t;let n=hn.get(t);if(n)return n.forEach(i=>i.current=e),e;let r=hn.get(e);return r?(r.forEach(i=>i.current=t),t):e}function rt(t=[]){let e=de(),[n,r]=Up(e),i=c.useCallback(()=>{r(function*(){yield e,yield document.getElementById(e)?e:void 0})},[e,r]);return ee(i,[e,i,...t]),n}function Mt(...t){return t.length===1&&t[0]?t[0]:e=>{let n=!1;const r=t.map(i=>{const s=Sl(i,e);return n||=typeof s=="function",s});if(n)return()=>{r.forEach((i,s)=>{typeof i=="function"?i():Sl(t[s],null)})}}}function Sl(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function A(...t){let e={...t[0]};for(let n=1;n<t.length;n++){let r=t[n];for(let i in r){let s=e[i],o=r[i];typeof s=="function"&&typeof o=="function"&&i[0]==="o"&&i[1]==="n"&&i.charCodeAt(2)>=65&&i.charCodeAt(2)<=90?e[i]=ot(s,o):(i==="className"||i==="UNSAFE_className")&&typeof s=="string"&&typeof o=="string"?e[i]=Lp(s,o):i==="id"&&s&&o?e.id=Wp(s,o):i==="ref"&&s&&o?e.ref=Mt(s,o):e[i]=o!==void 0?o:s}}retuLine truncated
|
||||
@layer {
|
||||
[${_l}] {
|
||||
touch-action: pan-x pan-y pinch-zoom;
|
||||
}
|
||||
}
|
||||
`.trim(),C.head.prepend(j)},[p]),c.useEffect(()=>{let C=g.current;return()=>{m||jl(C.target??void 0);for(let j of C.disposables)j();C.disposables=[]}},[m]),{isPressed:a||b,pressProps:A(h,V,{[_l]:!0})}}function oo(t){return t.tagName==="A"&&t.hasAttribute("href")}function Ii(t,e){const{key:n,code:r}=t,i=e,s=i.getAttribute("role");return(n==="Enter"||n===" "||n==="Spacebar"||r==="Space")&&!(i instanceof xe(i).HTMLInputElement&&!$u(i,n)||i instanceof xe(i).HTMLTextAreaElement||i.isContentEditable)&&!((s==="link"||!s&&oo(i))&&n!=="Enter")}function Dt(t,e){let n=e.clientX,r=e.clientY;return{currentTarget:t,shiftKey:e.shiftKey,ctrlKey:e.ctrlKey,metaKey:e.metaKey,altKey:e.altKey,clientX:n,clientY:r,key:e.key}}function xm(t){return t instanceof HTMLInputElement?!1:t instanceof HTMLButtonElement?t.type!=="submit"&&t.type!=="reset":!oo(t)}function Al(t,e){return Fe()&&e==="Enter"?!1:t instanceof HTMLInputElement?e==="Enter"&&(t.type==="checkbox"||t.type==="radio")?!1:!$u(t,e):xm(t)}const wm=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function $u(t,e){return t.type==="checkbox"||t.type==="radio"?e===" ":wm.has(t.type)}function Em(t,e){let{elementType:n="a",onPress:r,onPressStart:i,onPressEnd:s,onPressChange:o,onClick:l,isDisabled:a,...u}=t,d={};n!=="a"&&(d={role:"link",tabIndex:a?void 0:0});let{focusableProps:m}=Nt(t,e),{pressProps:p,isPressed:h}=Wt({onPress:r,onPressStart:i,onPressEnd:s,onPressChange:o,onClick:l,isDisabled:a,ref:e}),b=Y(u,{labelable:!0}),y=A(m,p),g=Sn(),v=si(t);return{isPressed:h,linkProps:A(b,v,{...y,...d,"aria-disabled":a||void 0,"aria-current":t["aria-current"],onClick:$=>{p.onClick?.($),Uc($,g,t.href,t.routerOptions)}})}}function Cn(t){let{isDisabled:e,onBlurWithin:n,onFocusWithin:r,onFocusWithinChange:i}=t,s=c.useRef({isFocusWithin:!1}),{addGlobalListener:o,removeAllGlobalListeners:l}=ui(),a=c.useCallback(m=>{Z(m.currentTarget,F(m))&&s.current.isFocusWithin&&!Z(m.currentTarget,m.relatedTarget)&&(s.current.isFocusWithin=!1,l(),n&&n(m),i&&i(!1))},[n,i,s,l]),u=Fc(a),d=c.useCallback(m=>{if(!Z(m.currentTarget,F(m)))return;let p=F(m);const h=ne(p),b=se(h);if(!s.current.isFocusWithin&&b===p){r&&r(m),i&&i(!0),s.current.isFocusWithin=!0,u(m);let y=m.currentTarget;o(h,"focus",g=>{let v=F(g);if(s.current.isFocusWithin&&!Z(y,v)){let $=new h.defaultView.FocusEvent("blur",{relatedTarget:v});Kc($,y);let x=Xs($);a(x)}},{capture:!0})}},[r,i,u,o,a]);return e?{focusWithinProps:{onFocus:void 0,onBlur:void 0}}:{focusWithinProps:{onFocus:d,onBlur:a}}}function Ie(t={}){let{autoFocus:e=!1,isTextInput:n,within:r}=t,i=c.useRef({isFocused:!1,isFocusVisible:e||Tt()}),[s,o]=c.useState(!1),[l,a]=c.useState(()=>i.current.isFocused&&i.current.isFocusVisible),u=c.useCallback(()=>a(i.current.isFocused&&i.current.isFocusVisible),[]),d=c.useCallback(h=>{i.current.isFocused=h,i.current.isFocusVisible=Tt(),o(h),u()},[u]);$h(h=>{i.current.isFocusVisible=h,u()},[n,s],{enabled:s,isTextInput:n});let{focusProps:m}=to({isDisabled:r,onFocusChange:d}),{focusWithinProps:p}=Cn({isDisabled:!r,onFocusWithinChange:d});return{isFocused:s,isFocusVisible:l,focusProps:r?p:m}}let cs=!1,vr=0;function Sm(){cs=!0,setTimeout(()=>{cs=!1},500)}function Ol(t){t.pointerType==="touch"&&Sm()}function Pm(){let t=ne(null);if(!(typeof t>"u"))return vr===0&&typeof PointerEvent<"u"&&t.addEventListener("pointerup",Ol),vr++,()=>{vr--,!(vr>0)&&typeof PointerEvent<"u"&&t.removeEventListener("pointerup",Ol)}}function ke(t){let{onHoverStart:e,onHoverChange:n,onHoverEnd:r,isDisabled:i}=t,[s,o]=c.useState(!1),l=c.useRef({isHovered:!1,ignoreEmulatedMouseEvents:!1,pointerType:"",target:null}).current;c.useEffect(Pm,[]);let{addGlobalListener:a,removeAllGlobalListeners:u}=ui(),{hoverProps:d,triggerHoverEnd:m}=c.useMemo(()=>{let p=(y,g)=>{if(l.pointerType=g,i||g==="touch"||l.isHovered||!Z(y.currentTarget,F(y)))return;l.isHovered=!0;let v=y.currentTarget;l.target=v,a(ne(F(y)),"pointerover",$=>{l.isHovered&&l.target&&!Z(l.target,F($))&&h($,$.pointerType)},{capture:!0}),e&&e({type:"hoverstart",target:v,pointerType:g}),n&&n(!0),o(!0)},h=(y,g)=>{let v=l.target;l.pointerType="",l.target=null,!(g==="touch"||!l.isHovered||!v)&&(l.isHovered=!1,u(),r&&r({type:"hoverend",target:v,pointerType:g}),n&&n(!1),o(!1))},b={};return typeof PointerEvent<"u"&&(b.onPointerEnter=y=>{cs&&y.pointerType==="mouse"||p(y,y.pointerType)},b.onPointerLeave=y=>{!i&&Z(y.currentTarget,F(y))&&h(y,y.pointerType)}),{hoverProps:b,triggerHoverEnd:h}},[e,n,r,i,l,a,u]);return c.useEffect(()=>{i&&m({currentTarget:l.target},l.pointerType)},[i]),{hoverProps:d,isHovered:s}}const Cm=c.createContext(null),lo=c.forwardRef(function(e,n){[e,n]=le(e,n,Cm);let r=e.href&&!e.isDisabled?"a":"span",{linkProps:i,isPressed:s}=Em({...e,elementType:r},n),o=Q[r],{hoverProps:l,isHovered:a}=ke(e),{focusProps:u,isFocused:d,isFocusVisible:m}=Ie(),p=ie({...e,defaultClassName:"react-aria-Link",values:{isCurrent:!!e["aria-current"],isDisabled:e.isDisabled||!1,isPressed:s,isHovered:a,isFocused:d,isFo
Line truncated
|
||||
@layer {
|
||||
* {
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
}`.trim(),document.head.prepend(i);let o=d=>{if(!(d.touches.length===2||n)){if(!e||e===document.documentElement||e===document.body){d.preventDefault();return}e.scrollHeight===e.clientHeight&&e.scrollWidth===e.clientWidth&&d.preventDefault()}},l=d=>{let m=F(d),p=d.relatedTarget;p&&Fn(p)?(p.focus({preventScroll:!0}),ma(p,Fn(m))):p||m.parentElement?.closest("[tabindex]")?.focus({preventScroll:!0})},a=HTMLElement.prototype.focus;Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:function(d){let m=se(),p=m!=null&&Fn(m);a.call(this,{...d,preventScroll:!0}),(!d||!d.preventScroll)&&ma(this,p)}});let u=ot(mn(document,"touchstart",r,{passive:!1,capture:!0}),mn(document,"touchmove",o,{passive:!1,capture:!0}),mn(document,"blur",l,!0));return()=>{t(),u(),i.remove(),Reflect.defineProperty(HTMLElement.prototype,"focus",{configurable:!0,writable:!0,value:a})}}function ma(t,e){e||!_n?ba(t):_n.addEventListener("resize",()=>ba(t),{once:!0})}function ba(t){let e=document.scrollingElement||document.documentElement,n=t;for(;n&&n!==e;){let r=co(n);if(r!==document.documentElement&&r!==document.body&&r!==n){let i=r.getBoundingClientRect(),s=n.getBoundingClientRect();if(s.top<i.top||s.bottom>i.top+n.clientHeight){let o=i.bottom;_n&&(o=Math.min(o,_n.offsetTop+_n.height));let l=s.top-i.top-((o-i.top)/2-s.height/2);r.scrollTo({top:Math.max(0,Math.min(r.scrollHeight-r.clientHeight,r.scrollTop+l)),behavior:"smooth"})}}n=r.parentElement}}function zb(t,e){let{triggerRef:n,popoverRef:r,groupRef:i,isNonModal:s,isKeyboardDismissDisabled:o,shouldCloseOnInteractOutside:l,...a}=t,u=a.trigger==="SubmenuTrigger",{overlayProps:d,underlayProps:m}=id({isOpen:e.isOpen,onClose:e.close,shouldCloseOnBlur:!0,isDismissable:!s||u,isKeyboardDismissDisabled:o,shouldCloseOnInteractOutside:l},i??r),{overlayProps:p,arrowProps:h,placement:b,triggerAnchorPoint:y}=rd({...a,targetRef:n,overlayRef:r,isOpen:e.isOpen,onClose:s&&!u?e.close:null,getTargetRect:a.getTargetRect??(e.point?()=>new DOMRect(e.point.x,e.point.y,0,0):void 0)});sd({isDisabled:s||!e.isOpen}),c.useEffect(()=>{if(e.isOpen&&r.current)return s?Rb(i?.current??r.current):ed([i?.current??r.current],{shouldUseInert:!0})},[s,e.isOpen,r,i]);let{focusWithinProps:g}=Cn(t);return{popoverProps:A(d,p,g),arrowProps:h,underlayProps:m,placement:b,triggerAnchorPoint:y}}var od={};od={dismiss:"Dismiss"};var ld={};ld={dismiss:"取消"};var ad={};ad={dismiss:"關閉"};var cd={};cd={"ar-AE":S,"bg-BG":S,"cs-CZ":S,"da-DK":S,"de-DE":S,"el-GR":S,"en-US":od,"es-ES":S,"et-EE":S,"fi-FI":S,"fr-FR":S,"he-IL":S,"hr-HR":S,"hu-HU":S,"it-IT":S,"ja-JP":S,"ko-KR":S,"lt-LT":S,"lv-LV":S,"nb-NO":S,"nl-NL":S,"pl-PL":S,"pt-BR":S,"pt-PT":S,"ro-RO":S,"ru-RU":S,"sk-SK":S,"sl-SI":S,"sr-SP":S,"sv-SE":S,"tr-TR":S,"uk-UA":S,"zh-CN":ld,"zh-TW":ad};function Wb(t){return t&&t.__esModule?t.default:t}function ys(t){let{onDismiss:e,...n}=t,r=en(Wb(cd),"@react-aria/overlays"),i=ir(n,r.format("dismiss")),s=()=>{e&&e()};return w.createElement(uo,null,w.createElement("button",{...i,tabIndex:-1,onClick:s,style:{width:1,height:1}}))}const ud=w.forwardRef(({children:t,...e},n)=>{let r=c.useRef(!1),i=c.useContext(qn),s=A(i||{},{...e,register(){r.current=!0,i&&i.register()}});return s.ref=we(n||i?.ref),no(i,s.ref),c.useEffect(()=>{r.current||(r.current=!0)},[]),w.createElement(qn.Provider,{value:s},t)});function qb({children:t}){let e=c.useMemo(()=>({register:()=>{}}),[]);return w.createElement(qn.Provider,{value:e},t)}const Gb=c.createContext({});function Mo(){return c.useContext(Gb)??{}}const dd=w.createContext(null);function vs(t){let e=Je(),{portalContainer:n=e?null:document.body,isExiting:r}=t,[i,s]=c.useState(!1),o=c.useMemo(()=>({contain:i,setContain:s}),[i,s]),{getContainer:l}=Mo();if(!t.portalContainer&&l&&(n=l()),!n)return null;let a=t.children;return t.disableFocusManagement||(a=w.createElement($o,{restoreFocus:!0,contain:(t.shouldContainFocus||i)&&!r},a)),a=w.createElement(dd.Provider,{value:o},w.createElement(qb,null,w.createElement(zn.Provider,{value:null},a))),kc.createPortal(a,n)}function fd(){let e=c.useContext(dd)?.setContain;ee(()=>{e?.(!0)},[e])}function ar(t){let[e,n]=Ve(t.isOpen,t.defaultOpen||!1,t.onOpenChange),[r,i]=c.useState(null);const s=c.useCallback(()=>{n(!0)},[n]),o=c.useCallback(()=>{n(!1)},[n]),l=c.useCallback(()=>{n(!e)},[n,e]);return{isOpen:e,setOpen:n,open:s,close:o,toggle:l,point:r,setPoint:i}}function cr(t,e=!0){let[n,r]=c.useState(!0),i=n&&e;return ee(()=>{if(i&&t.current&&"getAnimations"in t.current)for(let s of t.current.getAnimations())s instanceof CSSTransition&&s.cancel()},[t,i]),pd(t,i,c.useCallback(()=>r(!1),[])),i}function Jn(t,e){let[n,r]=c.useState(e?"open":"closed");switch(n){case"open":e||r("exiting");break;case"closed":case"exiting":e&&r("open");break}let i=n==="exiting";return pd(t,i,c.useCallback(()=>{r(s=>s==="exiting"?"closed":s)},[])),i}function pd(t,e,n){ee(()=>{if(e&&t.current){if(!("getAnimations"in t.current)){n();return}let r=t.current.getAnimations();if(r.length==
Line truncated
|
||||
${n}`:e);const o=[t,i,s??""].join(`
|
||||
`),l=Sr.get(o);l&&wt.close(l);const a=wt.add({kind:t,text:i,detail:s,action:r},{timeout:r?void 0:5e3,onClose:()=>{Sr.get(o)===a&&Sr.delete(o)}});Sr.set(o,a)},wy=(t,e,n,r)=>{const i=Wo(t,e,n);Le(i.kind,i.text,{detail:i.detail,action:r})},Ey={positive:W0,negative:xs,info:Jd,neutral:null};function Sy({placement:t="bottom"}){const[e,n="center"]=t.split(" "),r=te(),[i,s]=c.useState(!1);return c.useEffect(()=>{i?wt.pauseAll():wt.resumeAll()},[i]),c.useEffect(()=>wt.subscribe(()=>{wt.visibleToasts.length===0&&s(!1)}),[]),c.useEffect(()=>{if(!i)return;const o=l=>{if(l.key!=="Escape")return;(l.target?.closest?.(".rp-toasts")||!document.querySelector(sf))&&s(!1)};return addEventListener("keydown",o),()=>removeEventListener("keydown",o)},[i]),f.jsxs(C0,{queue:wt,className:q("rp-toasts",i&&"expanded"),"data-placement":e,"data-align":n,children:[i&&f.jsx(Ne,{className:"rp-toast-underlay","aria-label":r("toast.collapse"),onPress:()=>s(!1)}),i&&f.jsxs("div",{className:"rp-toast-controls",children:[f.jsx(Ne,{className:"rp-btn sm",onPress:()=>wt.clear(),children:r("toast.clearAll")}),f.jsx(Ne,{className:"rp-btn sm",onPress:()=>s(!1),children:r("toast.collapse")})]}),f.jsx(Py,{expanded:i,edge:e,onExpand:()=>s(!0)})]})}function Py({expanded:t,edge:e,onExpand:n}){const r=c.useContext(gi),i=r.visibleToasts;return f.jsx(Hd,{className:"rp-toast-list",children:({toast:s})=>{const o=i.indexOf(s);return f.jsx(Cy,{item:s,state:r,depth:o,count:i.length,background:!t&&o>0,more:!t&&o===0&&i.length>1?{edge:e,onExpand:n}:null})}})}function Cy({item:t,state:e,depth:n,count:r,background:i,more:s}){const o=te(),l=Ey[t.content.kind],{text:a,detail:u,action:d}=t.content;return f.jsxs(k0,{toast:t,className:q("rp-toast",t.content.kind,i&&"background"),style:{zIndex:r-n,"--i":Math.min(n,3)},inert:i||void 0,children:[f.jsxs(T0,{className:"body",children:[l&&f.jsx("span",{className:"icon",children:f.jsx(l,{})}),f.jsxs("div",{className:"msg",children:[f.jsx(Ar,{slot:"title",elementType:"div",className:"summary",children:a}),u&&f.jsx(Ar,{slot:"description",elementType:"div",className:"detail",children:u})]})]}),f.jsx(Ne,{slot:"close",className:"rp-btn quiet icon close","aria-label":o("close"),children:f.jsx(Oo,{})}),(s||d)&&f.jsxs("div",{className:"foot",children:[s&&f.jsxs(Ne,{className:"rp-btn sm quiet more",onPress:s.onExpand,children:[f.jsx(Jt,{className:q(s.edge==="bottom"&&"up")}),o("toast.showAllCount",{n:r})]}),d&&f.jsx(Ne,{className:"rp-btn action",onPress:()=>{d.onAction(),d.closeOnAction&&e.close(t.key)},children:d.label})]})]})}let An=null;const Ss=new Set,Ps=()=>Ss.forEach(t=>t());typeof window<"u"&&(addEventListener("beforeinstallprompt",t=>{t.preventDefault(),An=t,Ps()}),addEventListener("appinstalled",()=>{An=null,Ps()}));function g7(t=navigator,e=n=>matchMedia(n).matches){if(t.standalone||e("(display-mode: standalone), (display-mode: minimal-ui)"))return null;const n=/Version\/(\d+)[.\d]* (?:Mobile\/\w+ )?Safari\//.exec(t.userAgent);return n?typeof t.standalone=="boolean"&&(/iP(?:hone|ad|od)/.test(t.userAgent)||t.maxTouchPoints>1)?"ios":/Macintosh/.test(t.userAgent)&&t.maxTouchPoints<2&&Number(n[1])>=26?"mac":null:null}function y7(){const t=te(),e=c.useSyncExternalStore(n=>(Ss.add(n),()=>Ss.delete(n)),()=>An,()=>null);return e?async()=>{if(An!==e)return!1;An=null,Ps();try{return await e.prompt(),(await e.userChoice).outcome==="accepted"}catch(n){return Le("negative",t("settings.installFailed"),{detail:yi(n,t)}),!1}}:null}function Cs({className:t,...e}){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:f.jsx("path",{fill:"currentColor",d:"m18.53 17.47-5.083-5.084C14.417 11.186 15 9.66 15 8c0-3.86-3.14-7-7-7S1 4.14 1 8s3.14 7 7 7c1.66 0 3.185-.584 4.386-1.553l5.084 5.083c.146.147.338.22.53.22s.384-.073.53-.22c.293-.293.293-.767 0-1.06M8 13.5c-3.032 0-5.5-2.468-5.5-5.5S4.968 2.5 8 2.5s5.5 2.468 5.5 5.5-2.468 5.5-5.5 5.5"})})}function ky({className:t,...e}){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:[f.jsx("path",{fill:"currentColor",d:"m10.03418,16.66162C5.14258,16.66162.75,12.27295.75,10.20068c0-1.68506,2.59814-4.55029,5.34717-5.89746,1.20117-.60596,2.54736-.93506,3.89307-.95264,5.15771,0,9.25977,4.91943,9.25977,6.8501,0,2.07227-4.36035,6.46094-9.21582,6.46094Zm-.03418-11.81104c-1.11084.01465-2.23145.28906-3.23096.79346-.00244.00146-.00537.00293-.0083.00439-2.60596,1.27539-4.51074,3.75-4.51074,4.55225,0,1.14453,3.67969,4.96094,7.78418,4.96094,4.06836,0,7.71582-3.81641,7.71582-4.96094,0-1.04883-3.48145-5.3501-7.75-5.3501Zm-3.56885.12402h.00977-.00977Z"}),f.jsx("path",{fill:"currentColor",d:"m9.82907,7.64351c.22275-.63691-.47262-1.25888-1.09987-1.01025-.47319.18757-.91275.48099-1.28245.88097-1.49146,1.6136-1.20734,4.23592.75785,5.46243,1.20025.7491,2.79762.68815,3.93958-.14712.6684-.48889,
Line truncated
|
||||
`)),a=c.useRef(null),u=c.useRef(!1),d=c.useCallback(m=>(a.current=m,()=>{u.current=m.contains(document.activeElement),a.current=null}),[]);return c.useLayoutEffect(()=>{l&&s.current?.contains(document.activeElement)&&a.current?.querySelector("button")?.focus(),!l&&u.current&&s.current?.querySelector("[data-selected]")?.focus(),u.current=!1},[s,l]),f.jsxs("div",{className:"rp-segfit","data-collapsed":l||void 0,children:[f.jsxs(j0,{ref:s,className:"rp-seg","aria-label":r,isDisabled:i,selectionMode:"single",disallowEmptySelection:!0,selectedKeys:[e],onSelectionChange:m=>{const p=[...m][0];p!=null&&n(String(p))},children:[o&&f.jsx("span",{className:"rp-slider","data-still":o.still||void 0,style:{left:o.x,width:o.w}}),t.map(([m,p])=>f.jsx(K0,{id:m,className:"rp-btn",children:p},m))]}),l&&f.jsx("div",{ref:d,className:"rp-segpick",children:f.jsx(Dy,{bare:!0,label:r,value:e,onChange:n,isDisabled:i,items:t.map(([m,p])=>({id:m,label:p}))})})]})}function $7({children:t,isSelected:e,onChange:n,isDisabled:r,"aria-label":i,"aria-describedby":s}){return f.jsxs(Yg,{className:"rp-switch",isSelected:e,onChange:n,isDisabled:r,"aria-label":i,"aria-describedby":s,children:[f.jsx("span",{className:"track"}),t]})}function Ky({label:t,width:e,search:n,large:r,side:i,className:s,placeholder:o,description:l,error:a,action:u,reveal:d,prefix:m,suffix:p,autoComplete:h,spellCheck:b,...y}){const g=te(),v=c.useId(),$=a?{isInvalid:!0,validationBehavior:"aria"}:{};if(n)return f.jsxs(Fg,{...$,...y,"aria-label":t,className:q("rp-search-field",s),style:e?{width:e}:void 0,children:[f.jsxs("span",{className:q("rp-input",r&&"lg"),children:[f.jsx(Cs,{}),f.jsx(ql,{placeholder:o??t,autoComplete:h,spellCheck:b}),f.jsx(Ne,{className:"clear","aria-label":g("clear"),children:f.jsx(Oo,{})})]}),a&&f.jsxs(Ul,{className:"rp-field-error",children:[f.jsx(xs,{}),a]})]});const x=f.jsxs("span",{className:q("rp-input",(i||!!u)&&"rp-grow",(m||p)&&"affixed"),children:[m&&f.jsx("span",{className:"affix",id:`${v}-prefix`,children:m}),f.jsx(ql,{placeholder:o,autoComplete:h,spellCheck:b}),p&&f.jsx("span",{className:"affix",id:`${v}-suffix`,children:p}),d&&f.jsx(Ne,{className:"reveal","aria-label":d.label,onPress:d.onToggle,children:d.shown?f.jsx(Ty,{}):f.jsx(ky,{})})]});return f.jsxs(h0,{...$,...y,"aria-describedby":[m&&`${v}-prefix`,p&&`${v}-suffix`].filter(Boolean).join(" ")||void 0,className:q(i?"rp-cluster":"rp-field",s),style:e?{width:e}:void 0,children:[f.jsx(xu,{className:"rp-label",children:t}),u?f.jsxs("div",{className:"rp-toolbar",children:[x,u]}):x,l&&f.jsx(Ar,{slot:"description",className:"rp-label",children:l}),a&&f.jsxs(Ul,{className:"rp-field-error",children:[f.jsx(xs,{}),a]})]})}function x7({title:t,children:e,...n}){return f.jsxs(Eg,{...n,className:"rp-disclosure",children:[f.jsx(ao,{level:3,children:f.jsxs(Ne,{slot:"trigger",className:"rp-btn quiet rp-disclosure-trigger",children:[f.jsx(Jt,{}),t]})}),f.jsx(Sg,{className:"rp-disclosure-panel",children:f.jsx("div",{className:"rp-disclosure-content",children:e})})]})}function w7({children:t}){return f.jsx($g,{className:"rp-col",allowsMultipleExpanded:!0,children:t})}function Zo({trigger:t,title:e,children:n,footer:r,narrow:i,alert:s,isOpen:o,onOpenChange:l,hideTitle:a,locked:u,reason:d}){const m=f.jsx(Do,{className:"rp-underlay",isDismissable:!s&&!u,isKeyboardDismissDisabled:u,isOpen:o,onOpenChange:l,children:f.jsx(Rd,{className:q("rp-modal",i&&"narrow"),children:f.jsx(zr,{className:"rp-dialog",role:s?"alertdialog":"dialog","aria-label":a?e:void 0,children:({close:p})=>f.jsxs(nf,{reason:r?d:null,children:[!a&&f.jsx(ao,{slot:"title",children:e}),typeof n=="function"?n(p):n,r&&f.jsx("div",{className:"foot",children:r(p)})]})})})});return t?f.jsxs(Pd,{children:[t,m]}):m}function Qo({trigger:t,triggerRef:e,isOpen:n,onOpenChange:r,title:i,label:s,subtitle:o,placement:l="top start",children:a}){const u=f.jsx(mi,{className:i?"rp-popover rp-popover-dialog":"rp-popover",placement:l,...t?{}:{triggerRef:e,isOpen:n,onOpenChange:r},children:i?f.jsx(zr,{className:"rp-popover-body",children:({close:d})=>f.jsxs(f.Fragment,{children:[f.jsxs("div",{className:"rp-popover-head",children:[f.jsx(ao,{slot:"title",children:i}),o]}),a(d)]})}):f.jsx(zr,{className:"rp-popover-note","aria-label":s,children:({close:d})=>a(d)})});return t?f.jsxs(Pd,{children:[t,u]}):u}function uf({title:t,isOpen:e,onCancel:n,confirmLabel:r,onConfirm:i,tone:s="negative",isPending:o,isDisabled:l,reason:a,error:u,children:d}){const m=te();return f.jsxs(Zo,{title:t,narrow:!0,alert:s==="negative",isOpen:e,reason:a,onOpenChange:p=>{p||n()},footer:()=>f.jsxs(f.Fragment,{children:[f.jsx(ge,{onPress:n,children:m("ui.cancel")}),f.jsx(ge,{negative:s==="negative",accent:s==="accent",isDisabled:l,isPending:o,onPress:i,children:r})]}),children:[u&&f.jsx(Go,{takeFocus:!0,children:u.text},u.id),d]})}function E7({label:t,confirmationText:e,isDisabled:n,isPending:r,onConfirm:i,onAbort:s,open:o,setOpen:l}){const a=te(),[u,d]=c.useState(!1),[m,p]=c.useState(!1),[h,b]=c
Line truncated
|
||||
`)}),l="",a=void 0,u=[];return}if(p.startsWith(":"))return;const h=p.indexOf(":"),b=h<0?p:p.slice(0,h);let y=h<0?"":p.slice(h+1);y.startsWith(" ")&&(y=y.slice(1)),b==="event"&&(l=y),b==="data"&&u.push(y),b==="id"&&!y.includes("\0")&&(a=y)},m=()=>{i.cancel(n?.reason).catch(()=>{})};n?.addEventListener("abort",m,{once:!0});try{for(;;){const{value:p,done:h}=await i.read();n?.throwIfAborted(),r?.(),o+=s.decode(p,{stream:!h});let b=0;for(let y=0;y<o.length;y++){const g=o[y];if(!(g!=="\r"&&g!==`
|
||||
`)){if(g==="\r"&&y===o.length-1&&!h)break;d(o.slice(b,y)),g==="\r"&&o[y+1]===`
|
||||
`&&y++,b=y+1}}if(o=o.slice(b),h)break}}finally{n?.removeEventListener("abort",m),await i.cancel().catch(()=>{}),i.releaseLock()}}function On(t,e){return e?.throwIfAborted(),new Promise((n,r)=>{const i=()=>{clearTimeout(s),r(e?.reason)},s=setTimeout(()=>{e?.removeEventListener("abort",i),n()},Math.max(1,t)*1e3);e?.addEventListener("abort",i,{once:!0})})}const C1=3,Is=new Set,js=new Set;let Rf=null;function Ja(){Rf=[...Is].reduce((t,e)=>t&&t.until>=e.until?t:e,null),js.forEach(t=>t())}const k1=()=>Rf;function T1(t){return js.add(t),()=>void js.delete(t)}async function R1(t,e,n){if(e<=C1)return On(e,n);const r={status:t,until:Date.now()+e*1e3};Is.add(r),Ja();try{await On(e,n)}finally{Is.delete(r),Ja()}}const D7=["tproxy_port","tproxy_port_protect","pprof_port","so_mark_from_dae","log_level","log_file","disable_waiting_network","lan_interface","wan_interface","auto_config_kernel_parameter","data_dir","store_subscribe","tcp_check_url","tcp_check_http_method","udp_check_dns","check_interval","check_tolerance","dial_mode","nfqueue_enable","allow_insecure","sniffing_timeout","tls_implementation","utls_imitate","tls_fragment","tls_fragment_length","tls_fragment_interval","mptcp","bootstrap_resolver","fallback_resolver","bandwidth_max_tx","bandwidth_max_rx","udp_warm_node_count","preconnect_node_count","max_concurrent_dials"],M1={select:"selector",fixed:"selector",urltest:"urltest",min_moving_avg:"urltest",min_avg10:"urltest",min_last_delay:"urltest",fallback:"fallback",roundrobin:"loadbalance",loadbalance:"loadbalance",random:"random",score:"score"};function K7(t){return M1[t.toLowerCase().replace(/\(.*$/,"")]}const F7=["select","urltest","roundrobin","fallback","score","fixed","min_moving_avg","min_avg10","min_last_delay","loadbalance"],_7=[{id:"min_moving_avg",label:"arrange.policy.fastest",description:"arrange.policy.fastestHint"},{id:"fallback",label:"arrange.policy.fallback",description:"arrange.policy.fallbackHint"},{id:"roundrobin",label:"arrange.policy.spread",description:"arrange.policy.spreadHint"},{id:"select",label:"arrange.policy.manual",description:"arrange.policy.manualHint"}],Xr=["direct","block"],A7=[...Xr,...Xr.map(t=>`${t}(must)`)],En=t=>t!=null&&Xr.includes(t);function O7(t){if(new TextEncoder().encode(t).length>2048||/[\s,]/.test(t)||!/^https?:\/\/[^/?#@]+(?:[/?#]|$)/i.test(t))return!1;try{return!!new URL(t).hostname}catch{return!1}}const N1={warm:0,unknown:1,mixed:2,cold:3},L1={tcp_connect:0,http_headers:1,http_round_trip:2,quic_handshake:3,mixed:4,unknown:5,dns_round_trip:6};function I1(t){const e=n=>(N1[n.warmth]??1)*100+(L1[n.measurement]??5)*10+(n.ip_version==="ipv4"?0:1);return t.filter(n=>n.transport==="tcp"&&n.purpose==="data").sort((n,r)=>e(n)-e(r))[0]}const j1=t=>I1(t.health),D1=t=>t?.state==="healthy"&&t.latency_ms!=null?t.latency_ms:void 0,K1=(t,e)=>(t??1/0)-(e??1/0)||0;function F1(t){const e=t?Rs(...t.outbounds.map(r=>r.download_bytes)):null,n=(t?.outbounds??[]).map(r=>({name:r.name,kind:r.kind,bytes:je(r.download_bytes),percent:tl(r.download_bytes,e)}));return n.sort((r,i)=>r.bytes===i.bytes?0:r.bytes===null?1:i.bytes===null||r.bytes>i.bytes?-1:1),{rows:n,total:e}}function _1(t){const e=t.trim().replace(/^\[([^\]]+)\]$/,"$1");if(/^(?:0|[1-9]\d{0,2})(?:\.(?:0|[1-9]\d{0,2})){3}$/.test(e)&&e.split(".").every(n=>Number(n)<=255))return e;if(!(!e.includes(":")||!/^[\da-f:.]+$/i.test(e)))try{return new URL("http://["+e+"]/").hostname.slice(1,-1)}catch{return}}const A1=t=>En(t.protocol)?"builtin":"unattributed";function O1(t,e){let n=t;for(;e.some(r=>r.id===n);)n+="-";return n}const B7=(t,e)=>t.provider_id??O1(A1(t),e);function Mf(t){if(t)return _1(t.startsWith("[")?t.slice(1,t.indexOf("]")):t.split(":").length===2?t.split(":")[0]:t)}function ll(t,e){return t==="direct"?e("ui.direct"):t==="block"?e("ui.block"):t===null||t==="unknown"?e("ui.unknown"):t}const B1=(t,e)=>t.map(n=>e?.get(n)??n);function V1(t,e,n){return En(t.outbound)?e?ll(t.outbound,e):t.outbound:B1(t.chain,n).join(" → ")||"—"}function V7(t,e,n){if(En(t.outbound))return ll(t.outbound,e);const r=t.chain.at(-1);return r?n?.get(r)??r:t.outbound&&t.outbound!=="unknown"?t.outbound:"—"}const H7=(t,e,n)=>t.chain.length>1?V1(t,e,n):null,H1={starting:"lifecycle.starting",running:"lifecycle.running",reloading:"lifecycle.reloading",suspended:"lifecycle.suspended",draining:"lifecycle.draining",degraded:"lifecycle.degraded",failed:"lifecycle.failed"},U1=t=>t==="running"?"ok":t==="failed"?"err":"warn",z1=t=>t>90?"err":t>75?"warn":"ok",U7=t=>t.closed?t.skipped?"info":"positive":"negative",z7={observed:"conn.state.observed",routing:"conn.state.routing",dialing:"conn.state.dialing",active:"conn.state.active",closed:"conn.state.closed",blocked:"conn.state.blocked",failed:"conn.state.failed",unknown:"conn.state.unknown"};function W1(t){return t?[...t.tcp.map(e=>({...e,network:"tcp"})),...t.udp.map(e=>({...e,network:"udp"}))]:[]}const q1=["stream.ready","runtime.updated","flow.updated","flow.gap","operation.updated","generation.changed"],G
Line truncated
|
||||
`&&i++,o++;continue}const a=o,u=i;let d="text";if(l==="#")for(d="comment";o<t.length&&t[o]!==`
|
||||
`;)o++;else if(l==="'"||l==='"')for(d="quoted",o++;o<t.length;){const p=t[o++];if(p===`
|
||||
`&&i++,p==="\\"&&o<t.length)t[o]===`
|
||||
`&&i++,o++;else if(p===l)break}else if("{}:(),".includes(l))d="symbol",o++;else if(l==="-"&&t[o+1]===">")o+=2;else for(;o<t.length&&!/[\s{}:(),'"]/.test(t[o])&&!(t[o]==="-"&&t[o+1]===">");)o++;const m={from:a,to:o,line:u,kind:d,depth:r.length,parens:s};if(d==="symbol"&&l==="{"){let p=e.length-1;for(;p>=0&&(e[p].kind==="comment"||t.slice(e[p].from,e[p].to)===":");)p--;const h=e[p],b={name:h?sn(t.slice(h.from,h.to)):"",from:h?.from??a,open:a,close:t.length,to:t.length,line:h?.line??i,endLine:i,depth:r.length,children:[]};(r.at(-1)?.children??n).push(b),r.push(b)}else if(d==="symbol"&&l==="}"){const p=r.pop();p&&(p.close=a,p.to=o,p.endLine=i)}else d==="symbol"&&l==="("?s++:d==="symbol"&&l===")"&&(s=Math.max(0,s-1));e.push(m)}return{blocks:n,tokens:e}}function z2(t){if(/[\r\n]/.test(t))return!1;let e=0;for(const n of Oe(t).tokens){if(n.kind==="comment")return!1;if(n.kind==="quoted")continue;const r=t.slice(n.from,n.to);if(r.includes("{")||r.includes("}")||(r==="("&&e++,r===")"&&--e<0))return!1}return e===0}const sn=t=>/^['"]/.test(t)?t.slice(1,-1):t;function Yf(t){const e=Oe(t).tokens.filter(n=>n.kind==="comment");for(const n of e.reverse())t=t.slice(0,n.from)+t.slice(n.to);return t}function Xf(t,e,n){const r=[];let i;for(let s=0;s<n.length;s++){const o=n[s];if(o.from<=e.open||o.from>=e.close)continue;const l=t.slice(o.from,o.to);if(o.parens===0&&(o.kind==="comment"||i&&t.slice(i.valueTo,o.from).includes(`
|
||||
`))&&(i=void 0),o.depth!==e.depth+1||o.kind==="comment")continue;const a=n[s+1];o.parens===0&&(o.kind==="text"||o.kind==="quoted")&&a&&t.slice(a.from,a.to)===":"?(i={name:sn(l),from:o.from,to:a.to,valueFrom:a.to,valueTo:a.to,value:""},r.push(i),s++):i&&(i.to=o.to,i.valueTo=o.to)}for(const s of r)s.value=t.slice(s.valueFrom,s.valueTo).trim();return r}function W2(t,e){const n=t.slice(e.open+1,e.close);return e.line===e.endLine?[n]:n.replace(/^[^\S\n]*\n/,"").replace(/\n[^\S\n]*$/,"").split(`
|
||||
`)}function o$(t,e){const n=[];let r=e.open+1;/^[^\S\n]*\n/.test(t.slice(r,e.close))&&(r=t.indexOf(`
|
||||
`,r)+1);const i=t.lastIndexOf(`
|
||||
`,e.close-1)+1,s=i>r&&/^[ \t]*$/.test(t.slice(i,e.close))?i-1:e.close;for(;r<=s;){const o=t.indexOf(`
|
||||
`,r);let l=o===-1?s:Math.min(o,s);const a=e.children.find(u=>u.from>=r&&u.from<=l);if(a){const u=t.indexOf(`
|
||||
`,a.to);l=u===-1?s:Math.min(u,s)}n.push({from:r,to:l,block:a}),r=l+1}return n}function q2(t){const{blocks:e}=Oe(t);return e.filter(n=>n.name==="include").flatMap(n=>W2(t,n).map(r=>sn(Yf(r).trim()))).filter(Boolean)}const nc=t=>/[*?]/.test(t);function G2(t,e){const n=t.replace(/^\.\//,"").split(/([*?])/).map(r=>r==="*"?"[^/]*":r==="?"?"[^/]":r.replace(/[.+^${}()|[\]\\]/g,"\\$&")).join("");return new RegExp("^"+n+"$").test(e)}const J2=(t,e)=>t.some(n=>G2(n,e));function rc(t,e){const n=e.startsWith("/")?e:(t??"").slice(0,(t??"").lastIndexOf("/")+1)+e,r=[];for(const i of n.split("/"))i===".."?r.pop():i&&i!=="."&&r.push(i);return"/"+r.join("/")+(r.length&&/\/\.{0,2}$/.test(n)?"/":"")}function l$(t){const e=t.find(r=>r.kind==="main");if(!e||t.some(r=>r.content===void 0))return null;const n=t.flatMap(r=>q2(r.content).map(i=>rc(e.path,i)));return r=>J2(n,rc(e.path,r))}function a$(t){for(const e of t.map(n=>n.replace(/^\.\//,""))){const n=e.lastIndexOf("/");if(n>0&&nc(e.slice(n))&&!nc(e.slice(0,n)))return e.slice(0,n+1)}return""}function Zf(t){return[...t].some(e=>e.charCodeAt(0)<32||e.charCodeAt(0)>=127&&e.charCodeAt(0)<=159)?"config.newSourceControl":t.startsWith("/")?"config.newSourceAbsolute":t.split("/").some(e=>e===""||e==="."||e==="..")?"config.newSourceSegments":/[^/]\.dae$/.test(t)?null:"config.newSourceExtension"}function c$(t){const e=[];for(const n of t.map(r=>r.replace(/^\.\//,""))){const r=n.indexOf("*"),i=n.slice(0,r),s=n.slice(r+1);r<0||/[*?]/.test(i+s)||!i.includes("/")||s.includes("/")||!s.endsWith(".dae")||Zf(i+"name"+s)||e.some(o=>o.pattern===n)||e.push({pattern:n,prefix:i,suffix:s})}return e}function u$(t,e){if(t.includes("/"))return"config.newSourceNameSlash";const n=Zf(e.prefix+t+e.suffix);return n==="config.newSourceControl"?"config.newSourceNameControl":n}function Y2(t,e){const n=t.find(i=>i.kind==="main"),r=n?n.path.slice(0,n.path.lastIndexOf("/")+1):"";return t.find(i=>i.path===e||i.path===r+e)??null}function Qf(t=!0){const e=oe();return Ee({key:["config"],every:0,fetch:n=>e.config(n)},{enabled:t})}function hl(t,e){return t.config(e)}async function ep(t){return t.content!==void 0&&await x1(t.content)===t.content_sha256}function X2(t){const[e,n]=c.useState(new Map);return c.useEffect(()=>{let r=!0;return Promise.all(t.map(async i=>[i.id,{digest:i.content_sha256,content:i.content,complete:await ep(i)}])).then(i=>{r&&n(new Map(i))}),()=>{r=!1}},[t]),c.useCallback(r=>{const i=e.get(r.id);return i&&i.digest===r.content_sha256&&i.content===r.content?i.complete:void 0},[e])}function Z2(t){const e=c.useMemo(()=>t?[t]:[],[t]),n=X2(e);return t?n(t)??null:null}function Q2(t,e,n,r){if(n!==e.content_sha256)return{error:t,lastRefused:r};const i=e.id+":"+e.content_sha256;return i===r?{error:new he("config.diskAhead"),lastRefused:r}:{error:t,lastRefused:i}}const ic=t=>new TextEncoder().encode(t).length,sc=t=>wn(413,"request_too_large",`Configuration exceeds the ${t}-byte limit`,"config.tooLarge",{limit:t});function ev(t,e,n){const[r]=[{limit:t.content,size:ic(e)},{limit:t.body,size:ic(JSON.stringify(n))}].filter(i=>i.limit!==void 0).sort((i,s)=>s.size/s.limit-i.size/i.limit);return r&&{limit:r.limit,exceeded:r.size>r.limit}}async function oc(t,e,n,r){const i=ev(t,e,n);if(i?.exceeded)throw sc(i.limit);return r().catch(s=>{throw s instanceof $e&&s.status===413&&i?sc(i.limit):s})}function tp(t,e,n){return rn(t,e,n).catch(r=>{throw n.aborted||r instanceof he?r:(Rn(),new he("ui.operationUnknown"))})}async function tv(t,e,n){const r=await tp(t,await t.createConfigSource(e,"",n),n);jt(r,"reload"),n.throwIfAborted();const i=await hl(t,n).catch(()=>(n.throwIfAborted(),null));return i&&(Y2(i.sources,e)?.id??null)}function d$(t){const e=oe(),{busy:n,run:r}=dt({rethrow:!0});return{busy:n!==null,create:c.useCallback(i=>r("create",async s=>({id:await tv(e,i,s).finally(t)})),[e,r,t])}}function np(t,{rethrow:e=!1}={}){const n=oe(),r=He().data,i=r?.resources.config_validate,s=i?.available===!0&&i.modes?.includes("full")===!0,o=r?.limits.max_json_body_bytes,l=r?.resources.config.max_bytes,a=i?.max_bytes,u=c.useCallback((v,$)=>oc({content:a,body:o},v.sources.map(x=>x.content??"").join(""),v,()=>n.validateConfig(v,$)),[n,a,o]),{busy:d,error:m,run:p,cancel:h}=dt({rethrow:e}),[b,y]=c.useState(null),g=c.useRef(null);return{busy:d,cancel:h,error:m,errorSource:m?b:null,validate:c.useCallback(v=>p("validate",$=>(y(v.sources.length===1?v.sources[0].id??null:null),u(v,$))),[u,p]),apply:c.useCallback((v,$)=>p("save",async x=>{if(y(v.id),!v.writable)throw new he("config.readOnly");if(!await ep(v))throw new he("config.incomplete");x.throwIfAborted();const E=typeof $=="string"?$:$(v.content);if(E===null)return;if(s&&v.kind==="main"&&v.path!=="<redacted>"){const P=await u({sources:[{id:v.id,path:v.path,content:E}],mode:"full"},x);if(x.throwIfAborted(),!P.valid)return{diagnostics:P.diagnostics}}const R=await oc({content:l,body:o},E,{content:E},()=>n.replaceConfigSource(v.id,E,Of(v.content_sha256),x)).catch(async P=>{if(!(P instanceof $e)
Line truncated
|
||||
`,o.from-1)+1,m=t.slice(d,o.from),p=/^\s*$/.test(m)?m:" ",h=Xf(t,o,i),b=o.open+1,g=t.slice(b,o.close).match(/\n([ \t]+)\S/)?.[1]??p+(p||" ");if(o.line!==o.endLine)return av(t,o,h,g,n);const v=[b,...h.map(x=>x.from),o.close],$=v.slice(0,-1).flatMap((x,E)=>{const R=t.slice(x,v[E+1]).trim();return R?[g+R]:[]});return gl(t.slice(0,b)+`
|
||||
`+$.map(x=>x+`
|
||||
`).join("")+p+t.slice(o.close),e,n)}const l=s.at(-1),a=l?t.slice(l.open+1,l.close).match(/\n([ \t]+)\S/)?.[1]??" ":" ",u=[`${a}${ip(e)} {`,...n.filters.map(d=>`${a}${a}filter: ${d}`),...n.policy?[`${a}${a}policy: ${n.policy}`]:[],`${a}}`].join(`
|
||||
`);if(l){const d=t.lastIndexOf(`
|
||||
`,l.close-1)+1,m=/^[ \t]*$/.test(t.slice(d,l.close))?d:l.close;return t.slice(0,m)+(t[m-1]===`
|
||||
`?"":`
|
||||
`)+u+`
|
||||
`+t.slice(m)}return`${t.replace(/\n+$/,"")}
|
||||
|
||||
group {
|
||||
${u}
|
||||
}
|
||||
`}function av(t,e,n,r,i){const s=n.filter(p=>p.name==="filter"),o=n.filter(p=>p.name==="policy"),l=[],a=p=>t.indexOf(`
|
||||
`,p)+1,u=p=>{const h=t.lastIndexOf(`
|
||||
`,p.from-1)+1,b=a(p.to),y=/^[ \t\r]*$/.test(t.slice(h,p.from))&&b>0&&/^[ \t\r]*$/.test(t.slice(p.to,b-1));l.push(y?{from:h,to:b,text:""}:{from:p.from,to:p.to,text:""})},d=(p,h)=>{if(p.value===h)return;const b=/^\s*/.exec(t.slice(p.valueFrom,p.valueTo))[0];l.push({from:p.valueFrom+b.length,to:p.valueTo,text:(b?"":" ")+h})};s.forEach((p,h)=>h<i.filters.length?d(p,i.filters[h]):u(p)),o.slice(0,-1).forEach(u),o.length&&(i.policy?d(o.at(-1),i.policy):u(o.at(-1)));const m=[...i.filters.slice(s.length).map(p=>`${r}filter: ${p}
|
||||
`),...i.policy&&!o.length?[`${r}policy: ${i.policy}
|
||||
`]:[]].join("");if(m){const p=s.length?a(s.at(-1).to):o.length?t.lastIndexOf(`
|
||||
`,o[0].from-1)+1:a(e.open);l.push({from:p,to:p,text:m})}return l.sort((p,h)=>h.from-p.from||h.to-p.to).reduce((p,h)=>p.slice(0,h.from)+h.text+p.slice(h.to),t)}function er(t,e){const n=Oe(t).tokens,r=n.map(o=>t.slice(o.from,o.to));if(n[0]?.kind!=="text"||r[0]!==e||r[1]!=="("||r.at(-1)!==")"||n.at(-1)?.parens!==1)return null;const i=[];let s=!0;for(let o=2;o<n.length-1;o++){const l=n[o];if(l.parens!==1)return null;if(s){if(l.kind!=="text"&&l.kind!=="quoted"||l.kind==="text"&&/[\s:]/.test(r[o]))return null;i.push(r[o])}else if(r[o]!==",")return null;s=!s}return s&&i.length?null:i}const Qr=(t,e)=>t.flatMap(n=>(er(n,e)??[]).map(sn));function b$(t){return Qr(t.filters,"name")}function g$(t){return{names:Qr(t.filters,"name"),subtags:Qr(t.filters,"subtag"),rules:t.filters.filter(e=>er(e,"name")===null&&er(e,"subtag")===null)}}function y$(t,e,n){return t.filters.every(r=>{const i=er(r,e);return i!==null&&i.every(s=>sn(s)===n)})}function Ti(t,e,n,r,i){const s=bl(t).find(p=>p.name===e);if(!s&&!r.length)return t;const o=new Set(i),l=new Set(Qr(s?.filters??[],n).filter(p=>!o.has(p))),a=[...new Set(r)].filter(p=>!l.has(p)&&!o.has(p)),u=p=>a.map(p.length&&p.every(h=>h.startsWith("'"))?ki:ip);let d=!a.length;const m=[];for(const p of s?.filters??[]){const h=er(p,n);if(h===null){m.push(p);continue}const b=h.filter(g=>!o.has(sn(g))),y=d?b:[...b,...u(b)];d=!0,y.length&&m.push(`${n}(${y.join(", ")})`)}return d||m.push(`${n}(${u([]).join(", ")})`),s&&m.length===s.filters.length&&m.every((p,h)=>p===s.filters[h])||s?.filters.length&&!m.length?t:gl(t,e,{filters:m,policy:s?.policy??null})}const cv=(t,e,n)=>Ti(t,e,"name",n,[]),uv=(t,e,n)=>Ti(t,e,"name",[],n),dv=(t,e,n)=>Ti(t,e,"subtag",n,[]),fv=(t,e,n)=>Ti(t,e,"subtag",[],n);function sp(t,e){const n=[];let r=0,i=null,s=0;for(let o=0;o<t.length;o++){const l=t[o];i?l==="\\"?o++:l===i&&(i=null):l==="'"||l==='"'?i=l:l==="("?r++:l===")"?r--:r===0&&t.startsWith(e,o)&&(n.push(t.slice(s,o)),s=o+e.length,o+=e.length-1)}return n.push(t.slice(s)),n.map(o=>o.trim())}function pv(t){const e=t.startsWith("!"),n=e?t.slice(1).trim():t,r=n.startsWith("name(")?"name":n.startsWith("subtag(")?"subtag":null;if(!r||!n.endsWith(")"))return null;const i=[],s=[];for(const o of sp(n.slice(r.length+1,-1),",")){const l=/^keyword:\s*/.exec(o),a=/^regex:\s*/.exec(o),u=sn((l??a?o.slice((l??a)[0].length):o).trim());if(u)if(l)s.push(d=>d.includes(u));else if(a){let d;try{d=new RegExp(u)}catch{return null}s.push(m=>d.test(m))}else i.push(u),s.push(d=>d===u)}return s.length?{call:r,negated:e,exact:i,tests:s}:null}function hv(t){const e=sp(t,"&&").map(pv);return e.every(n=>n!==null)&&e.length?e:null}function mv(t){const e=t.map(hv).filter(n=>n!==null);if(!e.length){const n=t.some(r=>r.startsWith("group("));return r=>!n&&!En(r.name)}return n=>e.some(r=>(!En(n.name)||r.some(i=>i.call==="name"&&!i.negated&&i.exact.includes(n.name)))&&r.every(i=>i.tests.some(s=>s(i.call==="name"?n.name:n.subscription_tag??""))!==i.negated))}const v$=(t,e)=>mv(t)(e);function bv(t,e){switch(e.kind){case"addNode":return cv(t,e.group,[e.value]);case"removeNode":return uv(t,e.group,[e.value]);case"addSubscription":return dv(t,e.group,[e.value]);case"removeSubscription":return fv(t,e.group,[e.value]);case"createGroup":return bl(t).some(n=>n.name===e.group)?t:gl(t,e.group,{filters:[],policy:e.policy})}}const $$=(t,e)=>e.reduce(bv,t),x$=["domainSuffix","domain","geosite","dip","geoip","sip","dport","sport","pname","l4proto"];function w$(t,e){const n=e.split(/[,\s]+/).map(i=>i.trim()).filter(Boolean);if(n.some(i=>gv.test(i)||i.includes(":")&&!Jf(i)))return null;const r=yv(t,n);return z2(r)&&!r.includes("->")?r:null}const gv=/[()'"#{}]|&&|->/;function yv(t,e){const n=e.map(s=>s.includes(":")?ki(s):s),r=n.join(", "),i=s=>n.map(o=>`${s}: ${o}`).join(", ");switch(t){case"domain":return`domain(${i("full")})`;case"domainSuffix":return`domain(${i("suffix")})`;case"geosite":return`domain(${i("geosite")})`;case"dip":return`dip(${r})`;case"geoip":return`dip(${i("geoip")})`;case"sip":return`sip(${r})`;case"dport":return`dport(${r})`;case"sport":return`sport(${r})`;case"pname":return`pname(${r})`;case"l4proto":return`l4proto(${r})`}}function E$(t,e){const r=t.map(i=>i.id===e?.id?e.content:i.content).flatMap(i=>i===void 0?[]:bl(i));return[...new Map(r.map(({name:i,written:s})=>[s,{name:i,written:s}])).values()]}const Bs=t=>t.path==="<redacted>"||t.path==="",vv=t=>Bs(t)?t.kind==="main"?"config.dae":`${t.kind}-${t.id.slice(0,8)}.dae`:t.path.split("/").pop()||"config.dae";function S$(t,e){const n=t.find(i=>i.kind==="main");if(n?.content===void 0)return null;const r=[n,...t.filter(i=>i.kind==="include"&&i.content!==void 0&&!Bs(i))];return e&&!r.some(i=>i.id===e.id)?null:r.map(i=>({id:i.id,...Bs(i)?{}:{path:i.path},content:i.id===e?.id?e.content:i.content}))}const $v=t=>t.filter(e=>e.level==="error"&&e.code==="restart-required").length;function P$(t,e){if(e)return t.find(n=>n.id===e.source_id)}function xv(t,e,n){if(!e.source||e.source.source_id!==t.id||t.content===
Line truncated
|
||||
`,u.from-1)+1,$=r.indexOf(`
|
||||
`,d.to),x=$===-1?r.length:$+1;return{from:v,to:x,indent:r.slice(v,u.from),text:r.slice(v,x)}}const yl=(t,e,n=!1)=>`${t} -> ${e}${n?"(must)":""}`,C$=t=>[...t.map(e=>e.name),...Xr].map(e=>({id:e,label:e}));function k$(t,e,n,r,i){return t.slice(e.from,e.to)===e.text?t.slice(0,e.from)+`${e.indent}${yl(n,r,i)}
|
||||
`+t.slice(e.from):null}function T$(t,e){return t.slice(e.from,e.to)===e.text?t.slice(0,e.from)+t.slice(e.to):null}function wv(t,e){const n=t.content??"",r=Oe(n),i=e.map(l=>({rule:l,anchor:xv(t,l.before,r)}));if(i.some(l=>!l.anchor))return null;i.sort((l,a)=>l.anchor.from-a.anchor.from||l.rule.id-a.rule.id);let s="",o=0;for(const{rule:l,anchor:a}of i)s+=n.slice(o,a.from)+a.indent+yl(l.condition,l.outbound,l.must)+`
|
||||
`,o=a.from;return s+n.slice(o)}function vl(t){const e=new Map;for(const n of t)e.set(n.sourceId,[...e.get(n.sourceId)??[],n]);return[...e.values()]}function cc(t,e,n,r){const i=e??(t instanceof $e&&t.status===422?t.details?.diagnostics??null:null);if(!i)return{text:uy(Wo(t,r,r("ui.writeFailed")),r),lines:[]};const s=i.filter(l=>l.level==="error").length,o=$v(i);return{text:o?r("config.writeRestart",{n:o}):s?r("ui.writeInvalid",{n:s}):r("rule.refused"),lines:i.map(l=>{const a=zo(Uo(l.code,l.message,r),r),u=n.find(d=>d.id===l.source_id);return l.line===null?a:r("config.atFile",{file:u?vv(u):l.source_id,line:l.line,message:a})})}}function R$(t,e,n){const r=vl(t).length;return t.length?{title:n("rule.pending",{n:t.length}),files:r>1?n("rule.pendingFiles",{n:r}):null,failure:e,rows:t.map(i=>({id:i.id,line:yl(i.condition,i.outbound,i.must),position:i.before.kind==="fallback"?n("rule.positionEnd"):n("rule.positionBefore",{n:i.before.index+1})}))}:null}function Ev(t,e,n,r){return e?{text:r("rule.partial",{n:e,held:n}),lines:[t.text,...t.lines]}:t}const uc=()=>void Rn();function Sv(){const t=te(),e=np(uc,{rethrow:!0}),n=rp().applying,r=c.useRef(null);c.useEffect(()=>()=>r.current?.abort(),[]);const i=async(a,u)=>{let d=[],m;try{if(d=(await hl(oe(),u)).sources,u.aborted)return;const p=d.find(b=>b.id===a[0].sourceId),h=p&&await e.apply(p,()=>m=wv(p,a));return!p||m===null?(uc(),{written:!1,failure:{text:t("rule.stale"),lines:[]}}):h?h.diagnostics?{written:!1,failure:cc(null,h.diagnostics,d,t)}:{written:!0,failure:null}:void 0}catch(p){return u.aborted?void 0:{written:p instanceof he&&(p.key==="ui.writtenNotApplied"||p.key==="ui.operationUnknown"),failure:cc(p,null,d,t)}}},s=async(a,u)=>{let d=0;for(const m of vl(a)){const p=await i(m,u);if(!p)return;p.written&&yn.remove(m.map(b=>b.id));const h=p.written?m.length:0;if(p.failure)return{written:d+h,failure:Ev(p.failure,d&&d+h,a.length-d-h,t)};d+=h}return{written:d,failure:null}};return{apply:async a=>{if(!yn.begin())return;const u=new AbortController;r.current=u;try{return await s(a,u.signal)}finally{r.current===u&&(r.current=null),yn.end()}},busy:n,cancel:()=>{r.current?.abort(),e.cancel()}}}function Pv(){const t=te(),{rules:e}=rp(),{apply:n,busy:r}=Sv(),i=vl(e).length;return{count:e.length,label:i>1?t("rule.applyFiles",{n:e.length,files:i}):t("rule.applyPending",{n:e.length}),busy:r,apply:async()=>{const s=await n(e);s&&(yn.fail(s.failure),Le(s.failure?"negative":"positive",s.failure?s.failure.text:t("rule.applied",{n:e.length})))}}}function Cv(t,e,n,r){return Object.keys(Ds).filter(i=>t(i)||e===i).map(i=>({id:i,label:r(Ds[i]),isPending:e===i,isDisabled:!!e,onAction:()=>n(i)}))}function kv(t,e,n){const r=te(),i=D2(t,e,n),s=o=>void i.run(o).then(l=>{l&&Le("positive",r("ov.operationResult",{action:r(Ds[o]),status:r("ov.succeeded"),id:l.operation_id}))},l=>wy(l,r,r("ov.operationError")));return{canRun:i.canRun,busy:i.busy,run:s,actions:Cv(i.canRun,i.busy,s,r)}}function Tv({className:t,...e}){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:f.jsx("path",{fill:"currentColor",d:"m17.13 5.734-5.75-4.472c-.812-.631-1.948-.632-2.76 0L2.87 5.735h-.002C2.324 6.157 2 6.821 2 7.511v8.239C2 16.99 3.01 18 4.25 18h11.5c1.24 0 2.25-1.01 2.25-2.25V7.51c0-.689-.324-1.353-.87-1.776M11.5 16.5h-3v-4.75c0-.413.337-.75.75-.75h1.5c.413 0 .75.337.75.75zm5-.75c0 .413-.337.75-.75.75H13v-4.75c0-1.24-1.01-2.25-2.25-2.25h-1.5C8.01 9.5 7 10.51 7 11.75v4.75H4.25c-.413 0-.75-.337-.75-.75V7.51c0-.229.108-.45.29-.592l5.75-4.47c.272-.213.65-.21.92-.002l5.75 4.472c.182.142.29.363.29.593z"})})}function op({className:t,...e}){return f.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:f.jsx("path",{fill:"currentColor",d:"M5.313 18.748c-1.04 0-2.08-.396-2.873-1.188-1.584-1.584-1.584-4.163 0-5.747l3.906-3.906c1.585-1.584 4.162-1.583 5.747 0q.327.329.566.71c.22.35.115.814-.235 1.034-.353.222-.814.115-1.034-.235q-.152-.241-.36-.45c-.999-.998-2.625-.997-3.624.002l-3.905 3.905c-.999 1-.999 2.627 0 3.626 1.001 1.001 2.627.997 3.626 0l1.952-1.952c.293-.293.768-.293 1.06 0s.294.767 0 1.06L8.189 17.56c-.792.792-1.834 1.187-2.875 1.188m8.341-6.655 3.906-3.905c1.584-1.585 1.584-4.164 0-5.748s-4.164-1.584-5.747 0L9.86 4.393c-.293.293-.293.767 0 1.06s.768.293 1.06 0l1.953-1.952c1-.998 2.625-1 3.626 0 .999.999.999 2.626 0 3.626l-3.905 3.905c-1 1-2.625 1-3.624.001q-.208-.207-.36-.449c-.22-.35-.681-.457-1.034-.235-.35.22-.456.683-.235 1.034q.24.381.566.71c.793.792 1.833 1.188 2.874 1.188 1.04 0 2.081-.396 2.873-1.188"})})}function Rv({className:t,...e}){return f.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",width:20,height:20,viewBox:"0 0 20 20","aria-hidden":"true",focusable:"false",className:q("rp-icon",t),...e,children:[f.jsx("path",{fill:"currentColor",d:"m13.527 5.49-3.002-2.997c-.293-.29
Line truncated
|
||||
`,r.from-1)+1,s=n.filter(a=>a.from>=i&&a.to<=r.from);if(s.some(a=>a.depth!==1))return[];const o=s.findIndex(a=>a.parens===0&&t.slice(a.from,a.to)==="->"),l=o===-1||o===s.length-1?"":t.slice(s[o+1].from,r.from).trim();return[{from:i,to:r.to+(t[r.to]===`
|
||||
`?1:0),target:l}]})}function E5(t){const{blocks:e,tokens:n}=Oe(t),r=bp(t,e,n).find(i=>i.target);return r?r.target==="direct"?{mode:"direct"}:{mode:"global",target:r.target}:{mode:"rule"}}function S5(t,e){const n=Oe(t);for(const p of bp(t,n.blocks,n.tokens).reverse())t=t.slice(0,p.from)+t.slice(p.to);if(e.mode==="rule")return t;const{blocks:r,tokens:i}=Oe(t),s=r.find(p=>p.name==="routing");if(!s)throw new he("act.modeNoRouting");const l=t.slice(s.open+1,s.close).match(/\n([ \t]+)\S/)?.[1]??" ";let a=s.open+1;t[a]===`
|
||||
`&&a++;let u=null;const d=p=>{const h=t.indexOf(`
|
||||
`,p);return t.slice(t.lastIndexOf(`
|
||||
`,p-1)+1,h===-1?void 0:h).trim()};for(let p=0;p<i.length;p++){const h=i[p];if(h.from<=s.open||h.to>s.close||h.depth!==1||h.parens!==0||t.slice(h.from,h.to)!=="->")continue;const b=i[p+1],y=i[p+2],g=i[p+3],v=i[p+4];if(!(b&&y&&g&&v&&t.slice(y.from,y.to)==="("&&t.slice(g.from,g.to)==="must"&&t.slice(v.from,v.to)===")")){u??=d(h.from);continue}if(u!==null)throw new he("act.modeInterleaved",u);const x=t.indexOf(`
|
||||
`,v.to);a=x!==-1&&x<s.close?x+1:v.to;const E=i[p+5];if(E&&E.from<a&&E.kind!=="comment")throw new he("act.modeInterleaved",d(E.from))}const m=e.mode==="direct"?"direct":e.target;return t.slice(0,a)+(t[a-1]===`
|
||||
`?"":`
|
||||
`)+`${l}l4proto(tcp, udp) -> ${m} ${mp}
|
||||
`+t.slice(a)}const P5=(t,e)=>t.mode===e.mode&&(t.mode!=="global"||e.mode!=="global"||t.target===e.target),xc=["ok","warn","err"];function C5(t,e,n,r){const i=U1(t),s=t?hp(H1,t,r):n;return!t||e!=="degraded"&&e!=="failed"?{tone:i,text:s,href:null}:{tone:xc[Math.max(xc.indexOf(i),e==="failed"?2:1)],text:r(e==="failed"?"ov.status.datapathFailed":"ov.status.datapathDegraded",{status:s}),href:nt("overview",{card:"datapath"})}}const gp={rule:"mode.rule",direct:"mode.direct",global:"mode.global"};function k5(t,e,n,r,i,s,o=!0){const l=r?e??t:t,a=l.mode==="global"?l.target:(t.mode==="global"?t.target:n[0]?.name)??"";return{mode:o?l.mode:"",target:o?a:"",targetText:o&&a||"—",writable:r,dirty:r&&e!==null&&!P5(e,t),incomplete:l.mode==="global"&&!a,status:s(i?"act.modeReadOnly":"act.modeUnavailable"),readOnly:i&&!r,modes:["rule","direct","global"].map(u=>[u,s(gp[u])]),targets:n.map(u=>({id:u.name,label:u.name}))}}function T5({writable:t,dirty:e,incomplete:n,status:r},i,s){return i?{mode:null,global:null}:t?{mode:n?s("act.globalMissing"):e?null:s("config.noChanges"),global:null}:{mode:null,global:r}}const R5=t=>t.event!=="runtime.updated"&&t.event!=="flow.updated"&&!J1(t),M5=8;function N5(t,e){const n=[];for(const r of t){const i=X1(r,e),s=[r.event,i.key,...Object.entries(i.params??{}).map(([a,u])=>`${a}=${String(u)}`)].join("|"),o=n[n.length-1];if(o&&o.key===s){o.count+=1;continue}if(n.length===M5)break;const l=Object.fromEntries(Object.entries(i.params??{}).map(([a,u])=>[a,typeof u=="string"?Z1(u):u]));n.push({id:r.id,tone:r.event==="flow.gap"?"warn":"info",kindText:e(r.event==="flow.gap"?"ui.warning":"ui.notice"),summaryText:e("ui.valuePair",{label:hp(G1,r.event,e),value:e(i.key,l)}),key:s,count:1})}return n.map(({key:r,count:i,summaryText:s,...o})=>({...o,summaryText:i>1?e("ui.aside",{text:s,note:e("act.noticeRepeat",{n:i})}):s}))}function L5(t,e,n,r=!1){return t.down.some(i=>i!==null)||t.up.some(i=>i!==null)?"ready":e===!1?r?"loading":"unavailable":n?"empty":"loading"}function I5(t,e,n){const r=new Map;for(const o of t)r.set(o.name,(r.get(o.name)??0)+1);const i=t.map(o=>{const l=j1(o);return{id:o.id,name:o.name,label:r.get(o.name)>1?n("ui.aside",{text:o.name,note:[o.subscription_tag??o.provider_id??o.id,o.id].join(n("ui.separator"))}):o.name,tcp:D1(l),alive:l?.state==="unavailable"?!1:l?.state==="healthy"?!0:void 0,unavailable:l?.state==="unavailable",healthError:l?.error?ny(l.error,n):void 0}}),s=i.find(o=>o.id===e)??i.find(o=>o.tcp!==void 0)??i.find(o=>!En(o.name))??i[0];return{options:i,big:i.length>12,id:s?.id??"",name:s?.name??"",latency:s?.alive&&s.tcp!==void 0?df(s.tcp,n):"—",tone:s?.alive?"ok":s?.unavailable?"err":"muted",status:n(s?.alive?"act.good":s?.unavailable?"act.unavailable":"act.unknown"),healthError:s?.healthError}}const j5={ok:"act.memoryOk",warn:"act.memoryHigh",err:"act.memoryNearLimit"};function D5(t,e,n,r,i="en",s){const o=tl(e?.cgroup?.current_bytes??null,e?.cgroup?.limit_bytes??null),l=o===null?null:z1(o),{tone:a,text:u}=C5(t?.lifecycle.state,s,n(r===!1?"act.modeUnavailable":"ui.loading"),n);return{status:{tone:a,text:u},download:Ms(t?.traffic.rates?.download_bytes_per_second??null,i),upload:Ms(t?.traffic.rates?.upload_bytes_per_second??null,i),connections:t?.traffic.connections.total==null?"—":xn(t.traffic.connections.total,i),rss:Xt(e?.process?.rss_bytes??null,i),memoryBadge:l===null?null:{tone:l,text:n(j5[l])}}}function K5(t,e,n,r){const i=F1(t);return{since:t?r("act.since",{t:Oy(t.counter_since,e)}):"",total:Xt(i.total,e),rows:i.rows.map((s,o)=>({name:ll(s.name,r),value:s.percent===null?null:Math.round(s.percent),text:Xt(s.bytes,e),color:s.kind==="builtin"&&s.name==="block"?n.love:n.cat[o%n.cat.length]}))}}function F5(t,e,n,r,i){return w5(t,e).map((s,o)=>({name:s.name,value:s.percent===null?Xt(s.download,r):i("ui.share",{bytes:Xt(s.download,r),percent:s.percent}),pct:s.percent??0,color:n.cat[o%n.cat.length]}))}function _5(){const t=te(),e=oe(),n=ov(R5);return{rows:c.useMemo(()=>N5(n.records,t),[n.records,t]),total:n.records.length,error:n.error,retry:()=>void Rn().then(()=>S2(e)),loading:!n.error&&n.available===null,empty:t(n.available===!1?"event.unavailable":"act.noIssues")}}const A5=(t,e)=>t.kind==="invalid"?{kind:"negative",text:e("ui.writeInvalid",{n:t.errors})}:t.kind==="failed"?Wo(t.error,e,e("ui.writeFailed")):null;function O5(){const t=He().data?.resources,e=tt(t,"config",{whileLoading:!1})&&t?.config.writable===!0&&t?.config.content===!0,n=Qf(tt(t,"config",{whileLoading:!1})),r=np(n.refetch,{rethrow:!0}),i=n.data?.sources.find(d=>d.kind==="main"&&d.writable)??null,s=Z2(i),o=s?i:null,l=s===!1,a=c.useMemo(()=>n.error??(l?new he("config.incomplete"):null),[n.error,l]),{apply:u}=r;return{main:o,writable:e,busy:r.busy!==null,error:a,retry:n.refetch,apply:c.useCallback(async(d,m=o??void 0)=>{if(!m)return{kind:"failed",error:a??new he("config.incomplete")};try{const p=await u(m,d);return p?p.diagnostics?{kind:"invalid",errors:p.diagnostics.filter(h=>h.level==="error").length}:{k
Line truncated
|
||||
`),redactedSections:t=>t.filter(e=>e.name==="experimental"&&e.children.some(n=>n.name==="native_api")).map(e=>({block:e,name:"experimental.native_api"}))},G5={id:"unknown",reason:()=>{},holdsCredentials:()=>!1,snippet:t=>t.map(({key:e,value:n})=>`${e}: ${n}`).join(`
|
||||
`),redactedSections:()=>[]};function J5(t){switch(t?.api.name){case"dae/honk-native":return q5;default:return G5}}const Ec={connections:"nav.connections",flows:"rule.flows",routing_trace:"ov.r.routingTrace",dns_query:"ov.r.dnsQuery",dns_cache:"ov.r.dnsCache",dns_log:"ov.r.dnsLog",events:"nav.events",probes:"ov.r.probes",traffic_history:"ov.r.trafficHistory",memory_history:"ov.r.memoryHistory",runtime_outbounds:"ov.r.outbounds",logs:"nav.logs",providers:"nodes.providers",rules:"rule.listTitle",config:"nav.config",config_validate:"ov.r.configValidate",runtime_settings:"settings.runtime",geodata:"settings.geodata"},Y5=["configNotLoaded","configReadOnly","mainReadOnly","recordOff","geodataUpdate","geodataUnreadable","notRunning","flowsIdle","notProvided"],X5={"recorder-off":"recordOff","starting-or-stopping":"notRunning","geodata-mismatch":"geodataUnreadable"},Z5={"config-unloaded":{text:"ov.lim.configMissing"},"writes-off":{text:"ov.lim.configWrite",docs:["read-only","ov.lim.docsReadOnly"]},"main-file-read-only":{text:"ov.lim.mainReadOnly",docs:["read-only","ov.lim.docsReadOnly"]},"recorder-off":{text:"ov.lim.recordOff"},"no-download-urls":{text:"ov.lim.geoNoStateDb",docs:["state-db","ov.lim.docsStateDb"]},"geodata-mismatch":{text:"ov.lim.geoUnreadable"},"starting-or-stopping":{text:"ov.lim.notRunningReason"}};function Q5(t,e,n,r){const i=t.resources,s=J5(e),o=v=>s.reason(v,t),l=new Map,a=(v,$,x=Ec[$])=>{const E=l.get(v)??[];E.push({id:$,label:n(x)}),l.set(v,E)},u=(v,$)=>({href:wl(r,v),text:n($),external:!0}),d=(v,$)=>({label:n("ov.lim.why"),text:n(v),link:$}),m=v=>{const $=v.find(L=>L!==void 0),x=$&&Z5[$.code];if(!x)return;const E=x.docs&&u(...x.docs),R=v.flatMap(L=>L&&"settings"in L?L.settings:[]);return R.length>0?{label:n("ov.lim.howTo"),text:n(x.text),snippet:s.snippet(R),link:E}:d(x.text,E)},p=i.config.available?i.config.writable!==!0?"configReadOnly":null:"configNotLoaded";p&&a(p,"config");const h=!i.config_validate.available&&p==="configNotLoaded";h&&a("configNotLoaded","config_validate"),(i.nodes.can_manage===!1||i.providers.can_manage===!1)&&a(p??"mainReadOnly","manage","ov.lim.manage");const b=i.runtime_settings.available&&(i.runtime_settings.fields??[]).includes("record_flows");for(const v of Object.keys(Ec)){const $=i[v];if(v==="config"||v==="config_validate"&&h)continue;const x=v==="flows"&&$.available&&i.flows.recording==="off";if(x||!$.available){const E=o(v)?.code;a((E&&X5[E])??(x?"flowsIdle":"notProvided"),v)}else v==="geodata"&&i.geodata.can_update!==!0&&a(p??"geodataUpdate",v),v==="providers"&&i.providers.can_refresh===!1&&a("notRunning","subscriptions","ov.lim.subscriptions"),v==="connections"&&i.connections.can_close===!1&&a("notProvided","close","ov.lim.close")}const y=()=>{const v=i.geodata;if(v.assets?.length===0)return d("ov.lim.geoNoAssets");const $=m([o("geodata")]);if($)return $;if(v.configurable_sources===!0)return d("ov.lim.geoNoUrl",{href:nt("settings",{card:"geodata"}),text:n("settings.geodata")})},g=(v,$)=>{const x=$.length,E=()=>$.map(R=>o(R.id));switch(v){case"configNotLoaded":return{headline:n("ov.lim.h.configNotLoaded"),named:["config"],help:m([o("config")])};case"configReadOnly":return{headline:n("ov.lim.h.configReadOnly"),named:["config"],help:m([o("config")])};case"mainReadOnly":return{headline:n("ov.lim.h.mainReadOnly"),named:["manage"],help:m([o("manage")])};case"recordOff":return{headline:n("ov.lim.h.recordOff",{n:x}),help:m(E())};case"geodataUpdate":return{headline:n("ov.lim.h.geodataUpdate"),named:["geodata"],help:y()};case"geodataUnreadable":return{headline:n("ov.lim.h.geodataUnreadable"),named:["geodata"],help:m(E())};case"notRunning":return{headline:x>1?n("ov.lim.h.notRunning",{n:x}):n($[0].id==="probes"?"ov.lim.h.probes":"ov.lim.h.subscriptions"),named:x>1?[]:[$[0].id],help:m(E())};case"flowsIdle":return{headline:n(o("flows")?.code==="recorded-on-demand"?"ov.lim.h.flowsIdle":"ov.lim.h.flowsOff"),named:["flows"],link:b?{href:nt("settings",{card:"runtime"}),text:n("settings.runtime")}:void 0};case"notProvided":{const R=E().some(L=>L?.code==="build-lacks");return{headline:n(R?"ov.lim.h.notProvided":"ov.lim.h.notProvidedOther",{n:x}),link:R?u("honk-version","ov.lim.docsVersion"):void 0}}}};return Y5.flatMap(v=>{const $=l.get(v);if(!$)return[];const{named:x=[],...E}=g(v,$),R=$.filter(L=>!x.includes(L.id));return[{cause:v,...E,items:$,features:R.length>0?ey(r,$.map(L=>L.label)):void 0}]})}function e3(){const t=te(),e=Tn(),n=ct[e],r=xl(),i=He(),s=i.data?.resources,o=T2(tt(s,"runtime",{whileLoading:!1})),l=j2(tt(s,"runtime_memory",{whileLoading:!1})),a=L2(tt(s,"datapath",{whileLoading:!1})),[u,d]=c.useState("live"),m=vc[u]??120,p=y5(i.data,l.data),h=M2(m,i.data),b=$5(o.data),y=c.useMemo(()=>h.data?x5(h.data):[],[h.data]),g=c.useMemo(()=>$c(b,y,m),[b,y,m]),v=c.useMemo(()=>$c(b,y,vc.live,void 0,24),[b,y]),$=c.useMemo(()=>[{label:t("act.download"),color:r.cat[0],values:g.down},{label:t("act.upload"),color:r.cat[3],values:g.up}],[t,r,g]),x=c.useMemo(()=>[{label:t("act.rss
Line truncated
|
||||
@@ -1,82 +0,0 @@
|
||||
import{A as h,m as Nt,o as ct,p as Ot,q as me,t as Y,v as Dt,x as Te,y as ae,z as Ct,C as Rt,D as jt,F as Pt,G as Et,H as Lt,J as dt,K as Tt,M as Gt,N as we,O as zt,P as se,Q as Be,R as Ut,U as Ae,V as ue}from"./index-CXHBmSa5.js";import{d as re,m as Ve,v as Ft,g as Ht,a as Bt}from"./geodata-DprMPspn.js";import{mockSessionValid as Vt,refuseWithoutSession as Jt}from"./auth-DmBaDwOI.js";import"./vendor-react-Bf71BWbF.js";import"./auth-BGnwk8Hi.js";const Ie=Date.now(),B=e=>new Date(Ie-e*1e3).toISOString(),te=e=>new Date(Ie+e*1e3).toISOString(),V=B(0),K="mock-instance-1",De="40",ee={observed_at:V,profiles:["base","full_transparency"],limits:{max_request_target_bytes:4096,max_header_bytes:16384,max_json_body_bytes:65536},resources:{runtime:{available:!0},runtime_memory:{available:!0,metrics:["process.rss_bytes","cgroup.current_bytes","cgroup.limit_bytes","cgroup.events.high","cgroup.events.oom","cgroup.events.oom_kill","kernel.ebpf_bytes"]},datapath:{available:!0,kinds:["ebpf"],details:["attachments","maps"]},runtime_outbounds:{available:!0},traffic_history:{available:!0,max_window_seconds:604800,max_points:360},memory_history:{available:!0,max_window_seconds:604800,max_points:720},nodes:{available:!0,can_manage:!0},providers:{available:!0,can_refresh:!0,can_manage:!0,create_options:{update_interval:86400,user_agent:"honk/0.0.1-alpha",cache:!0},max_page_size:1e3},geodata:{available:!0,can_update:!0,assets:["geosite","geoip"],configurable_sources:!0},rules:{available:!0,max_rules:4096},config:{available:!0,content:!0,writable:!0,create:!0,max_bytes:1048576,max_sources:32},config_validate:{available:!0,modes:["syntax","full"],max_bytes:1048576,max_sources:32},logs:{available:!0,levels:["trace","debug","info","warn","error"],max_buffered_records:4096},dns_log:{available:!0,max_records:2048,max_page_size:500},runtime_settings:{available:!0,fields:["log.level","log.buffered_records","dns_log.max_records","flows.max_flows","flows.retention_seconds","record_flows","record_logs","record_dns_log","geodata"]},groups:{available:!0,config_patch:!0,selection:!0,max_patch_operations:32},probes:{available:!0,targets:["node","group"],kinds:["tcp_connect","http","dns"],purposes:["data","dns"],transports:["tcp","udp"],ip_versions:["ipv4","ipv6"],limits:{max_members_per_job:64,max_results_per_job:256,max_active_jobs:4,max_queued_jobs:16,max_concurrent_per_target:1,job_timeout_ms:3e4,per_principal_requests_per_minute:60,global_requests_per_minute:120}},connections:{available:!0,can_close:!0,max_bulk_close:200},flows:{available:!0,recording:"on",scopes:["userspace_tcp","userspace_udp","kernel_direct","kernel_block","dns_intercept","kernel_bypass"],max_flows:4096,max_steps_per_flow:64,retention_seconds:300,snapshot_ttl_seconds:60,max_page_size:1e3},routing_trace:{available:!0,resolve_modes:["none","live"],max_addresses:16,max_rule_steps:128,timeout_ms:5e3,per_principal_requests_per_minute:60,global_requests_per_minute:120},events:{available:!0,kinds:["stream.ready","runtime.updated","flow.updated","flow.gap","operation.updated","generation.changed"],retention_seconds:300,max_buffered_events:1024,max_clients:16,heartbeat_seconds:15},dns_query:{available:!0,record_types:["A","AAAA","HTTPS"],limits:{max_types_per_request:8,query_timeout_ms:5e3,max_response_bytes:65536,per_principal_requests_per_minute:60,global_requests_per_minute:120}},dns_cache:{available:!0,read:!0,delete_entry:!0,delete_name:!0,flush:!0,entry_kinds:["positive","negative"]},operations:{available:!0,retention_seconds:300},reload:{available:!0},suspend:{available:!0},resume:{available:!0}}},Wt={...ee,profiles:["base"],resources:{...ee.resources,runtime_outbounds:{available:!1},traffic_history:{available:!1},memory_history:{available:!1},logs:{available:!1},dns_log:{available:!1},runtime_settings:{available:!1},geodata:{available:!1},rules:{available:!1},nodes:{available:!0,can_manage:!1},providers:{available:!0,can_refresh:!1,can_manage:!1,max_page_size:1e3},config:{available:!1,content:!1,create:!1},config_validate:{available:!1},flows:{...ee.resources.flows,available:!1},routing_trace:{...ee.resources.routing_trace,available:!1},events:{...ee.resources.events,available:!1}}},Kt={...ee,profiles:["base"],resources:{...Object.fromEntries(Object.keys(ee.resources).map(e=>[e,{available:!1}])),runtime:{available:!0},connections:{available:!0,can_close:!1,max_bulk_close:1e3},config:{available:!1,content:!1,create:!1}}},Ge=[{id:"r1",cond:"pname(NetworkManager, systemd-resolved) && l4proto(udp) && dport(53)",target:"direct",must:!0},{id:"r2",cond:"dip(geoip: private)",target:"direct",must:!0},{id:"r3",cond:"domain(suffix: doubleclick.net)",target:"block",must:!1},{id:"r4",cond:"domain(geosite: cn)",target:"direct",must:!1},{id:"r5",cond:"domain(geosite: telegram)",target:"proxy",must:!1},{id:"r6",cond:"mac(aa:bb:cc:dd:ee:ff) && ipversion(4)",target:"direct",must:!1},{id:"r7",cond:"domain(geosite: openai)",target:"proxy",must:!1},{id:"r8",cond:"sip(10.0.0.0/24) && dport(25)",Line truncated
|
||||
tproxy_port: 12345
|
||||
log_level: info
|
||||
lan_interface: br-lan
|
||||
wan_interface: auto
|
||||
allow_insecure: false
|
||||
auto_config_kernel_parameter: true
|
||||
}
|
||||
|
||||
subscription {
|
||||
sub-c: 'https://sub.example.net/api/v1/client/subscribe?token=demo'
|
||||
}
|
||||
|
||||
node {
|
||||
'hk-01': 'vless://demo@hk-01.example.net:443?security=tls#hk-01'
|
||||
'hk-02': 'vless://demo@hk-02.example.net:443?security=tls#hk-02'
|
||||
'sg-01': 'trojan://demo@sg-01.example.net:443#sg-01'
|
||||
'jp-01': 'vless://demo@jp-01.example.net:443?security=tls#jp-01'
|
||||
'us-01': 'anytls://demo@us-01.example.net:443#us-01'
|
||||
}
|
||||
|
||||
group {
|
||||
proxy { policy: ${pe.proxy.native} }
|
||||
resilient { filter: name(hk-01, sg-01, us-01) policy: ${pe.resilient.native} }
|
||||
gaming { filter: name(jp-01, hk-02) policy: ${pe.gaming.native} }
|
||||
skylink { filter: subtag(sub-c) policy: ${pe.skylink.native} }
|
||||
}
|
||||
|
||||
dns {
|
||||
upstream {
|
||||
cloudflare: 'tls://1.1.1.1:853'
|
||||
alidns: 'udp://223.5.5.5:53'
|
||||
}
|
||||
routing {
|
||||
request { qname(geosite: cn) -> alidns; fallback: cloudflare }
|
||||
}
|
||||
}
|
||||
|
||||
routing {
|
||||
pname(NetworkManager, systemd-resolved) && l4proto(udp) && dport(53) -> direct(must)
|
||||
dip(geoip: private) -> direct(must)
|
||||
domain(suffix: doubleclick.net) -> block
|
||||
domain(geosite: cn) -> direct
|
||||
domain(geosite: telegram) -> proxy
|
||||
include rules.dae
|
||||
fallback: resilient
|
||||
}
|
||||
|
||||
include {
|
||||
config.d/*.dae
|
||||
}
|
||||
`,Yt=`# Household exceptions, kept apart from config.dae.
|
||||
# The TV never leaves through a node.
|
||||
mac(aa:bb:cc:dd:ee:ff) && ipversion(4) -> direct
|
||||
|
||||
# AI
|
||||
domain(geosite: openai) -> proxy
|
||||
sip(10.0.0.0/24) && dport(25) -> block
|
||||
`,Je=`'香港 01 IPLC': 'vless://<redacted>'
|
||||
'香港 02 BGP': 'vless://<redacted>'
|
||||
'新加坡 01 2x': 'trojan://<redacted>'
|
||||
'日本 01 2x': 'vless://<redacted>'
|
||||
`,Zt=`# Written by honk from the subscription; edits are lost on refresh.
|
||||
skylink { filter: subtag(sub-c) }
|
||||
`,qt=[{level:"warning",source_id:"src-main",line:5,column:3,span:null,code:"interface_auto",message:"wan_interface: auto is resolved at start; a changed default route needs a reload"},{level:"warning",source_id:"src-rules",line:3,column:1,span:null,code:"mac_unseen",message:"mac(aa:bb:cc:dd:ee:ff) has not been seen on the LAN since start"},{level:"info",source_id:"src-sub-c",line:1,column:null,span:null,code:"subscription_cached",message:"Subscription fetched 30 minutes ago; nodes come from the cache"}],pt=[{id:"src-main",path:"/etc/honk/config.dae",kind:"main",writable:!0,loaded_at:B(3600),content:Qt},{id:"src-rules",path:"/etc/honk/rules.dae",kind:"include",writable:!0,loaded_at:B(3600),content:Yt},{id:"src-sub-c",path:"/var/lib/honk/subscriptions/sub-c.dae",kind:"subscription",writable:!1,loaded_at:B(1800),content:Je,onDisk:Je.replaceAll("<redacted>","demo@edge.example.net:443")},{id:"src-generated",path:"/var/lib/honk/generated/skylink.dae",kind:"generated",writable:!1,loaded_at:B(1800),content:Zt}],ft=pt.map(e=>e.id==="src-rules"?{...e,content:e.content+`
|
||||
# Ads
|
||||
`+ze.map(n=>`${n.cond} -> ${n.target}
|
||||
`).join("")}:e),en=ft.map(e=>e.id==="src-rules"?{...e,content:e.content+`domain(suffix: example.org) -> direct
|
||||
`}:e);function _e(e){const n=new Map;return(o,r={})=>{const{cursor:a,limit:c=1e3,...l}=r,i=Nt([e,l]);if(!Number.isSafeInteger(c)||c<1)throw new h(400,"invalid_request","Invalid page size");for(const[b,w]of n)w.expires<=Date.now()&&n.delete(b);const[d,s,p]=a?.split(":")??[ct(),"0"],v=Number(s);let m=a?n.get(d):void 0;if(a&&(p!==void 0||!m||m.key!==i||!Number.isSafeInteger(v)||v<1||v>=m.items.length))throw new h(e==="flows"?410:400,e==="flows"?"snapshot_expired":"invalid_request","Unknown or expired cursor");if(!m){if(o.length<=c)return{items:structuredClone(o),total:o.length,next_cursor:null};m={items:structuredClone(o),key:i,expires:Date.now()+3e4},n.size>=32&&n.delete(n.keys().next().value),n.set(d,m)}const _=v+c;return{items:structuredClone(m.items.slice(v,_)),total:m.items.length,next_cursor:_<m.items.length?`${d}:${_}`:null}}}function W(e,n){if(e===void 0)throw new h(404,"resource_not_found",`${n} not found`);return e}function Re(e){const n=URL.parse(e);return n?n.origin+n.pathname+(n.search?"?[redacted]":""):null}const tn=new Set(["global","subscription","node","group","dns","routing","upstream","request","response","include"]),We=new Set(Pt),nn=new Set(jt),on=e=>e===""?0:e.replace(/\n$/,"").split(`
|
||||
`).length;async function ce({onDisk:e,...n}){const o=e??n.content;return{...n,content_sha256:await Ot(o),bytes:new TextEncoder().encode(o).length,line_count:on(o)}}function ge(e,n,o=!1){const{blocks:r}=ae(e),a=r.filter(c=>c.name===n).flatMap(c=>Ct(e,c).filter(l=>!l.block));return o&&!r.length&&a.push({from:0,to:e.length,block:void 0}),a.flatMap(({from:c,to:l})=>{const i=e.slice(0,c).split(`
|
||||
`).length;return e.slice(c,l).split(`
|
||||
`).map((d,s)=>({code:Rt(d).trim(),raw:d,line:i+s}))})}function ve(e){return[...ge(e,"include").filter(({code:n})=>n).map(({code:n,line:o})=>({path:me(n),line:o})),...ge(e,"routing",!0).flatMap(({code:n,line:o})=>{const r=/^include\s+(\S+)$/.exec(n);return r?[{path:me(r[1]),line:o}]:[]})]}const Ke=(e,n,o)=>e.filter(r=>Te(Y(n,o),Y(void 0,r.path)));function mt(e,n,o,r){const a=[],c=(s,p,v,m,_)=>a.push({level:v,source_id:e,line:s,column:p,span:null,code:m,message:_}),{blocks:l,tokens:i}=ae(n),d=s=>{s.depth===0&&!tn.has(s.name)&&c(s.line+1,1,"error","unknown_section",`Unknown section "${s.name}"`),s.close===n.length&&c(s.line+1,1,"error","section_not_closed",`Section "${s.name}" is never closed`),s.children.forEach(d)};l.forEach(d);for(const s of i)s.kind==="symbol"&&s.depth===0&&n[s.from]==="}"&&c(s.line+1,1,"error","brace_without_section","Closing brace without an open section");for(const{code:s,line:p}of ge(n,"global")){if(!s)continue;const v=/^([\w.-]+)\s*:\s*(.*)$/.exec(s);v?nn.has(v[1])||c(p,1,"error","unknown_key",`Unknown global setting "${v[1]}"`):c(p,1,"error","not_a_setting",'Expected "<key>: <value>"')}return ge(n,"routing",!0).forEach(({code:s,raw:p,line:v})=>{if(!s||/^include\s+\S+$/.test(s))return;const m=/^fallback:\s*(\S+)$/.exec(s),_=/^(.+?)\s*->\s*(\S+)$/.exec(s),b=m?.[1]??_?.[2];if(!b){c(v,1,"error","not_a_rule",'Expected "<condition> -> <outbound>", "include <file>" or "fallback: <outbound>"');return}const w=b.replace(/\(.*\)$/,"");r==="full"&&!We.has(b)&&!We.has(w)&&!o.has(w)&&c(v,p.lastIndexOf(b)+1,"error","unknown_outbound",`No group named "${w}"`),_&&!/\w\(/.test(_[1])&&c(v,1,"warning","bare_condition","Condition has no function call; it will never match")}),a}function sn(e){return new Set(ae(e).blocks.filter(n=>n.name==="group").flatMap(n=>n.children.map(o=>o.name)))}function $e(e,n,o=[]){const r=e.sources.map((l,i)=>({...l,id:l.id??`source-${i+1}`}));if(new Set(r.map(l=>l.id)).size!==r.length)throw new h(400,"invalid_request","Source IDs must be unique");const a=[];if(e.mode==="full"){const l=r[0]?.path,i=new Map([...o,...r].filter(s=>s.path).map(s=>[Y(void 0,s.path),s])),d=new Set(r.map(s=>s.path&&Y(void 0,s.path)));for(let s=0;s<r.length;s++){const p=r[s];for(const{path:v,line:m}of ve(p.content)){const _=Y(l,v);if(Dt(v)){for(const[w,N]of i)Te(_,w)&&!d.has(w)&&(d.add(w),r.push({...N,id:N.id??`source-${r.length+1}`}));continue}const b=i.get(_);b?d.has(_)||(d.add(_),r.push({...b,id:b.id??`source-${r.length+1}`})):a.push({source_id:p.id,line:m,column:1,span:null,level:"error",code:"include_not_found",message:`Include "${v}" cannot be resolved`})}}}const c=e.mode==="full"?new Set(r.flatMap(l=>[...sn(l.content)])):new Set;return a.push(...r.flatMap(l=>mt(l.id,l.content,c,e.mode))),{valid:!a.some(l=>l.level==="error"),diagnostics:a,generation_id:n,validated_at:new Date().toISOString()}}function rn(e,n,{enqueue:o,log:r,publish:a,eventData:c,trimLogs:l},i,d,s,p=!1){const v=p?Xt:Ce,m=structuredClone(v),_=()=>{const k=structuredClone(m);return e.resources.geodata.configurable_sources===!0&&(k.geodata=s.settings()),k};let b=null,w=[],N;const C=()=>N??=Promise.all([Promise.all((p?ft:pt).map(ce)),p?Promise.all(en.map(ce)):null]).then(([k,$])=>(b=k,w=$??[...k],k));let t=40,f=0;const u=k=>k.kind==="main"||k.kind==="include";function g(k,$=w){const j=[],E=$.find(U=>U.kind==="main"),H=U=>{if(j.some(M=>M.id===U.id))return;const y=U.id===k?.id?k.content:U.content;j.push({id:U.id,path:U.path,content:y});for(const{path:M}of ve(y))Ke($,E.path,M).forEach(H)};return E&&H(E),j}function A(k,$){const j=H=>new TextEncoder().encode(H).length;if(j(JSON.stringify($))>e.limits.max_json_body_bytes)throw new h(413,"request_too_large","Request body exceeds its limit");const E=e.resources.config.max_bytes;if(E!==void 0&&j(k)>E)throw new h(413,"request_too_large",`Source content exceeds ${E} bytes`)}function S(){const k=String(t+1),$=g();$.length&&d($.map(E=>E.content).join(`
|
||||
`),k),b&&(b=[...w],s.follow(G(b).rules.flatMap(E=>E.kind==="rule"?[E.expression]:[]))),t+=1,Object.assign(m,structuredClone(v),{observed_at:new Date().toISOString()}),r("info","honk::routing","Routing generation published.",{generation_id:String(t)});const j=String(t);return n.generation={...n.generation,active_id:j,config_revision:j,activated_at:new Date().toISOString()},a({id:"",event:"generation.changed",data:{...c(),generation_id:j,previous_generation_id:String(t-1)}}),j}async function O(k){await C();const $=W(w.find(E=>E.kind==="main"),"Main source"),j=await ce({...$,content:k($.content),loaded_at:new Date().toISOString()});return()=>{if(w.find(E=>E.id===$.id)!==$)throw new h(412,"stale_revision","The main source changed before activation");return w=w.map(E=>E.id===$.id?j:E),S()}}function G(k){const $=k.find(I=>I.kind==="main"),j=new Map(k.map(I=>[Y(void 0,I.path),I])),E=new Map([...ut.rules,...ze].map(I=>[I.cond+" -> "+I.target+(I.must?"(must)":""),I.id])),H=[];let U=null;const y=new Set,M=(I,P)=>{if(!y.has(I.id)){y.add(I.id),ge(I.content,"routing",P).forEach(({code:R,raw:F,line:D})=>{const T=/^include\s+(\S+)$/.exec(R);if(T){const He=j.get(Y($.path,T[1]));He&&M(He,!0);return}const L=/^fallback:\s*(\S+)$/.exec(R),X=/^(.+?)\s*->\s*(\S+)$/.exec(R);if(!L&&!X)return;const Q=F.search(/\S/),At=new TextEncoder().encode(F.slice(0,Q)).length+1,le={file:I.path.split("/").pop(),source_id:I.id,line:D,column:At};if(L){U={outbound:L[1],source:le},H.push({rule_id:"fallback",index:H.length,expression:R,outbound:L[1],must:!1,source:le,kind:"fallback"});return}const $t=X[2].endsWith("(must)"),Mt=X[2].replace(/\(must\)$/,"");H.push({rule_id:E.get(R)??`${le.file}:${le.line}`,index:H.length,expression:X[1],outbound:Mt,must:$t,source:le,kind:"rule"})});for(const{path:R}of ve(I.content))Ke(k,$.path,R).forEach(F=>M(F,!0))}};return $&&M($,!1),{rules:H,fallback:U}}const z=async()=>{await C();const{rules:k,fallback:$}=G(b);if(!$)throw new h(503,"snapshot_unavailable","The routing section has no fallback",null,null,1);return{generation_id:String(t),rules:k,fallback:$}};return{api:{rules:async k=>{if(k?.throwIfAborted(),!e.resources.rules.available)throw new h(404,"capability_not_supported","The rule list is unavailable");return z()},config:async k=>{if(k?.throwIfAborted(),!e.resources.config.available)throw new h(404,"capability_not_supported","Configuration readback is unavailable");await C();const $=b,j=String(t),E=i();return{generation_id:j,revision:j,sources:$.map(H=>e.resources.config.content?{...H}:{...H,content:void 0}),diagnostics:[...$.filter(u).flatMap(H=>mt(H.id,H.content,E,"full").filter(U=>U.level!=="error")),...p?qt:[]],secrets_redacted:!0}},validateConfig:async(k,$)=>{if($?.throwIfAborted(),!e.resources.config_validate.available)throw new h(404,"capability_not_supported","Validation is unavailable");if(!e.resources.config_validate.modes?.includes(k.mode))throw new h(400,"invalid_request",`Mode ${k.mode} is not advertised`);return k.mode==="full"&&await C(),$e(k,String(t),w.filter(u))},replaceConfigSource:async(k,$,j,E)=>{E?.throwIfAborted(),await C();const U=W(w.find(I=>I.id===k),"Configuration source");if(!e.resources.config.writable||!U.writable)throw new h(403,"permission_denied","This source is read-only");if(A($,{content:$}),!j)throw new h(428,"precondition_required","If-Match is required");if(j.replace(/^"|"$/g,"")!==U.content_sha256)throw new h(412,"stale_revision","The source changed on disk; fetch it again before retrying");const y=$e({sources:g({id:k,content:$}),mode:"full"},String(t));if(!y.valid)throw new h(422,"unsupported_value","Validation found errors; nothing was written",null,{diagnostics:y.diagnostics});const M=await ce({...U,content:$,loaded_at:new Date().toISOString()});return w=w.map(I=>I.id===k?M:I),r("info","honk::config","Configuration source replaced; reloading.",{source_id:k}),o("reload",()=>{const I=S();return{active_generation_id:I,datapath_generation_id:I}})},createConfigSource:async(k,$,j)=>{j?.throwIfAborted();const E=e.resources.config;if(!E.available||!E.create)throw new h(404,"capability_not_supported","Creating configuration sources is unavailable");if(!E.writable)throw new h(403,"permission_denied","Configuration writes are disabled");if(A($,{path:k,content:$}),Et(k)||new TextEncoder().encode(k).length>1024)throw new h(400,"invalid_request","path must be a relative .dae path with normal segments");await C();const H=W(w.find(R=>R.kind==="main"),"Main source"),U=Y(H.path,k),y=()=>{if(w.some(R=>Y(void 0,R.path)===U))throw new h(409,"state_conflict",`${k} already exists`);if(E.max_sources!==void 0&&w.length>=E.max_sources)throw new h(413,"request_too_large","Source count exceeds the advertised max_sources")};if(y(),!g().some(R=>ve(R.content).some(F=>Te(Y(H.path,F.path),U)))){const R={level:"error",source_id:H.id,line:null,column:null,span:null,code:"source-not-included"};throw new h(422,"unsupported_value","No include pattern matches the path; nothing was written",null,{diagnostic
Line truncated
|
||||
`);e=e.slice(0,l.close)+`
|
||||
`+d+`
|
||||
`+e.slice(l.close);for(const s of i.reverse())e=e.slice(0,s.from)+e.slice(s.to);return e}function Xe(e){try{return e()}catch{throw new h(422,"unsupported_value","The value cannot be written to the configuration")}}const Qe=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function hn(e,n,{enqueue:o,log:r,pending:a},c,l,i,d,s=!1){const p=_e("nodes"),v=_e("providers"),m=structuredClone(cn),{nodes:_,groups:b}=ln(Number.isFinite(n)?n:120,s);for(const t of m)t.node_count=_.filter(f=>f.provider_id===t.id).length;s&&Object.assign(m.find(t=>t.id==="sub-c"),{status:"stale",last_error:de});const w=new Map,N=new Set;return{api:{nodes:async(t,f)=>{if(f?.throwIfAborted(),!e.resources.nodes.available)throw new h(404,"capability_not_supported","Nodes are unavailable");const u=p(t?.group_id?_.filter(g=>g.group_ids.includes(t.group_id)):_,t);return{observed_at:V,nodes:u.items,next_cursor:u.next_cursor}},groups:async t=>{if(t?.throwIfAborted(),!e.resources.groups.available)throw new h(404,"capability_not_supported","Groups are unavailable");return b.map(f=>({id:f.id,name:f.name,icon:f.icon,config_revision:f.config_revision,policy:{...f.policy},member_count:f.members.length,selection:{tcp_member_id:f.runtime.selection.tcp?.member_id??null,udp_member_id:f.runtime.selection.udp?.member_id??null}}))},group:async(t,f)=>{if(f?.throwIfAborted(),!e.resources.groups.available)throw new h(404,"capability_not_supported","Groups are unavailable");return structuredClone(W(b.find(u=>u.id===t),"Group"))},selectGroup:async(t,f,u)=>{u?.throwIfAborted();const g=W(b.find(x=>x.id===t),"Group"),A=!g.capabilities.can_select&&g.capabilities.can_override;if(!g.capabilities.can_select&&!A)throw new h(404,"capability_not_supported","Group does not support manual selection");W(g.members.find(x=>x.id===f.member_id),"Group member");const S=f.network==="both"?["tcp","udp"]:[f.network];let O=!1;for(const x of S){const k=g.runtime.selection[x]?.member_id;g.runtime.selection[x]={member_id:f.member_id,resolved_leaf_node_id:ye(f.member_id,x,_,b)?.id??null,source:A?"override":"runtime"},!(k===f.member_id||!g.config.interrupt_connections)&&(O=i(t,x)||O)}const G=(w.get(t)??0n)+1n;w.set(t,G);const z={group_id:t,member_id:f.member_id,network:f.network,source:A?"override":"runtime",selection_revision:String(G),connections_interrupted:O};return f.network!=="both"&&(z.resolved_leaf_node_id=g.runtime.selection[f.network]?.resolved_leaf_node_id),z},clearGroupOverride:async(t,f,u)=>{u?.throwIfAborted();const g=W(b.find(G=>G.id===t),"Group");if(!g.capabilities.can_override)throw new h(409,"state_conflict","Group has no override to clear");const A=f==="both"?["tcp","udp"]:[f],S=an(g);for(const G of A)g.runtime.selection[G]={member_id:S,resolved_leaf_node_id:ye(S,G,_,b)?.id??null,source:"policy"};const O=(w.get(t)??0n)+1n;return w.set(t,O),{group_id:t,network:f,selection_revision:String(O),connections_interrupted:!1,selection:structuredClone(g.runtime.selection)}},patchGroup:async(t,f,u,g)=>{g?.throwIfAborted();const A=W(b.find(z=>z.id===t),"Group");if(u!=='"'+A.config_revision+'"')throw new h(412,"stale_revision","Group configuration revision changed");if(N.has(t))throw new h(409,"state_conflict","Group update is pending");const S=e.resources.groups.max_patch_operations;if(S!==void 0&&f.length>S)throw new h(413,"request_too_large","Too many patch operations");const O=mn(A,f),G=await l(z=>gn(z,A.name,O));return N.add(t),o("group_update",()=>{N.delete(t);const z=G();return{group_id:t,config_revision:z}})},startProbe:async(t,f)=>{f?.throwIfAborted();const u=e.resources.probes;if(!u.available)throw new h(404,"capability_not_supported","Probes are unavailable");const g=t.ip_version==="any"?["ipv4","ipv6"]:[t.ip_version];if(!u.targets?.includes(t.target.type)||!u.kinds?.includes(t.kind)||!u.purposes?.includes(t.purpose)||t.transport.some(x=>!u.transports?.includes(x))||g.some(x=>!u.ip_versions?.includes(x)))throw new h(422,"unsupported_value","Probe dimensions are not advertised");const A=t.target,S=A.type==="group"?W(b.find(x=>x.id===A.group_id),"Group"):void 0;if(A.type==="node"&&W(_.find(x=>x.id===A.node_id),"Node"),!t.transport.length||t.transport.some(x=>S&&!S.capabilities.probe_transports.includes(x))||t.kind!=="dns"&&(t.purpose!=="data"||t.transport.some(x=>x!=="tcp"))||t.kind==="dns"&&t.purpose!=="dns")throw new h(422,"unsupported_value","Unsupported probe dimensions");if(S&&Array.isArray(t.members)&&t.members.some(x=>!S.members.some(k=>k.id===x)))throw new h(422,"unsupported_value","Probe member is not in this group");const O=ht(t,_,b).length,G=u.limits;if(O>G.max_members_per_job||O*t.transport.length*g.length>G.max_results_per_job)throw new h(413,"request_too_large","Probe exceeds the advertised member or result limit");const z=structuredClone(t);return o("probe",()=>fn(z,_,b,new Date().toISOString()))},providers:async(t,f)=>{if(f?.throwIfAborted(),!e.resources.providers.available)throw new h(404,"capability_not_supported","Providers are unavailable");const u=e.resources.
Line truncated
|
||||
`),x=Xe(()=>z.length?` ${Be(t.name)}: {
|
||||
url: ${se(t.url)}
|
||||
${z.join("")} }
|
||||
`:` ${Be(t.name)}: ${se(t.url)}
|
||||
`),k=await l($=>$.replace(/^(subscription \{\n)/m,`$1${x}`));return r("info","honk::subscription","Subscription added.",{provider:t.name}),k(),structuredClone(W(m.find($=>$.name===t.name),"Provider"))},deleteProvider:async(t,f)=>{if(f?.throwIfAborted(),!e.resources.providers.can_manage)throw new h(404,"capability_not_supported","Provider management is unavailable");const u=m.findIndex(O=>O.id===t);if(u<0)return{deleted:0};if(m[u].kind==="inline")throw new h(404,"capability_not_supported","The inline provider is the node section itself");const g=m[u],A=Qe(g.name),S=await l(O=>O.replace(new RegExp(`^\\s*${A}:\\s*\\{\\n[\\s\\S]*?\\n\\s*\\}\\n|^\\s*${A}:.*\\n`,"m"),""));return r("info","honk::subscription","Subscription removed.",{provider:g.name}),S(),{deleted:1}},createNode:async(t,f)=>{if(f?.throwIfAborted(),!e.resources.nodes.can_manage)throw new h(404,"capability_not_supported","Node management is unavailable");const u=/^([a-z][a-z0-9+.-]*):\/\/\S+$/i.exec(t.link.trim())?.[1]?.toLowerCase();if(!u||!dn.includes(u))throw new h(422,"unsupported_value",`Unsupported share link scheme "${u??""}"`);if(_.some(S=>S.name===t.name))throw new h(409,"state_conflict",`An inline node named ${t.name} already exists`);const g=Xe(()=>` ${se(t.name)}: ${se(t.link.trim())}
|
||||
`),A=await l(S=>S.replace(/^(node \{\n)/m,`$1${g}`));return r("info","honk::config","Node added.",{node:t.name,protocol:u}),A(),structuredClone(W(_.find(S=>S.name===t.name),"Node"))},deleteNode:async(t,f)=>{if(f?.throwIfAborted(),!e.resources.nodes.can_manage)throw new h(404,"capability_not_supported","Node management is unavailable");const u=_.find(A=>A.id===t);if(!u)return{deleted:0};if(u.provider_id!=="inline")throw new h(404,"capability_not_supported","Only inline nodes can be deleted; refresh or delete the provider instead");const g=await l(A=>A.replace(new RegExp(`^\\s*'${Qe(u.name)}':.*\\n`,"m"),""));return r("info","honk::config","Node removed.",{node:u.name}),g(),{deleted:1}},geodata:async t=>{if(t?.throwIfAborted(),!e.resources.geodata.available)throw new h(404,"capability_not_supported","Geodata is unavailable");return d.status()},updateGeodata:async t=>{if(t?.throwIfAborted(),!e.resources.geodata.can_update)throw new h(404,"capability_not_supported","Geodata update is unavailable");if(a("geodata_update"))throw new h(409,"state_conflict","A geodata update is already queued or running");return o("geodata_update",()=>{const f=d.update();return r("info","honk::geodata","Geodata updated; reloading.",{assets:f.assets.map(u=>u.kind)}),c(),f})}},groupNames:()=>new Set(b.map(t=>t.name)),groupIds:()=>new Set(b.map(t=>t.id)),activate:(t,f)=>_n(t,f,_,b,m)}}const bn=[{level:"info",target:"honk::main",message:"Runtime snapshot captured.",fields:{pid:1842}},{level:"info",target:"honk::config",message:"Configuration state checked.",fields:{sources:4,generation_id:"40"}},{level:"info",target:"honk::subscription",message:"Subscription status checked.",fields:{provider:"sub-c"}},{level:"warn",target:"honk::subscription",message:"Subscription served from cache.",fields:{provider:"sub-c",age_seconds:1800}},{level:"warn",target:"honk::datapath",message:"Routing map sample delayed.",fields:{interface:"lan0"}},{level:"info",target:"honk::dns",message:"DNS listener healthy.",fields:{bind:"127.0.0.1:5353"}},{level:"info",target:"honk::routing",message:"Routing generation checked.",fields:{generation_id:"40"}},{level:"error",target:"honk::group",message:"Health check failed.",fields:{node:"jp-01",error:"connect timeout"}},{level:"info",target:"honk::api",message:"Native API request served.",fields:{listen:"127.0.0.1:9090"}}];function wn(e,n,o,r,a,c=2500,l=!1){const i=new Map;let d=0;const s=new Set,p=[],v=new Map,m=new Map,_=()=>{for(;p.length&&Date.now()-Date.parse(p[0].data.observed_at)>n.retention_seconds*1e3;)p.shift();const y=p.length?Number(p[0].id.split(":")[1])-1:d,M=S.length?Number(S[0].id.split(":")[2])-1:G;for(const[I,P]of v)(P.position<(P.stream==="events"?y:M)||P.stream==="events"&&Date.now()-P.issued>n.retention_seconds*1e3)&&(v.delete(I),m.delete(JSON.stringify([P.stream,P.filter,P.position])))},b=(y,M,I)=>{const P=JSON.stringify([y,M,I]),R=m.get(P);if(R)return R;const F=ct();return v.set(F,{stream:y,filter:M,position:I,issued:Date.now()}),m.set(P,F),F},w=(y,M,I,P)=>{if(y===void 0)return P;_();const R=v.get(y);if(!R||R.stream!==M||R.filter!==I)throw new h(409,"event_cursor_expired","The stream cursor cannot be replayed");return R.position};let N;const C=()=>({instance_id:K,observed_at:new Date().toISOString()});function t(y){y.id=`${K}:${++d}`,p.push(y),p.length>n.max_buffered_events&&p.shift(),_(),s.forEach(M=>M(y))}function f(){o.observed_at=new Date().toISOString(),t({id:"",event:"runtime.updated",data:{...C(),href:"/api/v1/runtime"}})}const u=(y,M)=>{const I="op-"+(i.size+1),P=new Date().toISOString(),R={operation_id:I,kind:y,created_at:P,started_at:P};i.set(I,{...R,finished_at:null,status:"running",result:null,error:null,retryAfter:1}),t({id:"",event:"operation.updated",data:{...C(),resource_id:I,status:"running",href:"/api/v1/operations/"+I}}),setTimeout(()=>{try{i.set(I,{...R,status:"succeeded",result:M(),error:null,finished_at:new Date().toISOString()})}catch(T){i.set(I,{...R,status:"failed",finished_at:new Date().toISOString(),result:null,error:T instanceof h?{code:T.code,message:T.message,details:T.details}:{code:"operation_failed",message:T instanceof Error?T.message:String(T)}})}const D=i.get(I);y==="reload"&&(D.status==="succeeded"||D.status==="failed")&&(o.last_reload={operation_id:I,status:D.status,finished_at:D.finished_at,error:D.error}),t({id:"",event:"operation.updated",data:{...C(),resource_id:I,status:D.status,href:"/api/v1/operations/"+I}}),f()},1e3);const F="/api/v1/operations/"+I;return{operation_id:I,kind:y,status:"queued",href:F,retryAfter:1}},g=async(y,M)=>(M?.throwIfAborted(),structuredClone(W(i.get(y),"Operation"))),A=["trace","debug","info","warn","error"],S=[],O=new Set;let G=0;function z(){const y=r().buffered_records;S.length>y&&S.splice(0,S.length-y),_()}const x=(y,M,I,P=null,R=Date.now())=>{const F={id:`${K}:logs:${++G}`,ts:new Date(R).toISOString(),level:y,target:M,message:I,fields:P};S.push(F),z(),O.forEach(D=>D(F))},k=[()=>x("info","honk::routing","Routing generation p
Line truncated
|
||||
@@ -0,0 +1,93 @@
|
||||
import{A as h,m as jt,o as ut,p as Pt,q as me,t as Q,v as Lt,x as Te,y as ne,z as pt,C as Et,D as Tt,F as Gt,G as zt,H as Ut,J as Ft,K as ft,M as Ht,N as Bt,O as we,Q as Jt,R as re,U as Be,V as Vt,W as Wt,X as Ae,Y as ue}from"./index-BNBwb-FJ.js";import{d as ie,m as Je,v as Kt,g as qt,a as Xt}from"./geodata-DprMPspn.js";import{mockSessionValid as Qt,withPasswordAuth as Yt,refuseWithoutSession as Zt}from"./auth-kokL-_Tb.js";import"./vendor-react-Bf71BWbF.js";import"./auth-TcOYUrrj.js";const Ie=Date.now(),B=e=>new Date(Ie-e*1e3).toISOString(),te=e=>new Date(Ie+e*1e3).toISOString(),J=B(0),K="mock-instance-1",Ce="40",ee={observed_at:J,profiles:["base","full_transparency"],limits:{max_request_target_bytes:4096,max_header_bytes:16384,max_json_body_bytes:65536},resources:{runtime:{available:!0},runtime_memory:{available:!0,metrics:["process.rss_bytes","cgroup.current_bytes","cgroup.limit_bytes","cgroup.events.high","cgroup.events.oom","cgroup.events.oom_kill","kernel.ebpf_bytes"]},datapath:{available:!0,kinds:["ebpf"],details:["attachments","maps"]},runtime_outbounds:{available:!0},traffic_history:{available:!0,max_window_seconds:604800,max_points:360},memory_history:{available:!0,max_window_seconds:604800,max_points:720},nodes:{available:!0,can_manage:!0},providers:{available:!0,can_refresh:!0,can_manage:!0,create_options:{update_interval:86400,user_agent:"honk/0.0.1-alpha",cache:!0},max_page_size:1e3},geodata:{available:!0,can_update:!0,assets:["geosite","geoip"],configurable_sources:!0},rules:{available:!0,max_rules:4096},config:{available:!0,content:!0,writable:!0,create:!0,max_bytes:1048576,max_sources:32},config_validate:{available:!0,modes:["syntax","full"],max_bytes:1048576,max_sources:32},logs:{available:!0,levels:["trace","debug","info","warn","error"],retention_seconds:86400,max_buffered_records:4096},dns_log:{available:!0,max_records:2048,max_page_size:500},dns_rules:{available:!0,max_rules:1024},runtime_settings:{available:!0,fields:["log.level","log.buffered_records","dns_log.max_records","flows.max_flows","flows.retention_seconds","record_flows","record_logs","record_dns_log","geodata"]},groups:{available:!0,config_patch:!0,selection:!0,max_patch_operations:32},probes:{available:!0,targets:["node","group"],kinds:["tcp_connect","http","dns"],purposes:["data","dns"],transports:["tcp","udp"],ip_versions:["ipv4","ipv6"],limits:{max_members_per_job:64,max_results_per_job:256,max_active_jobs:4,max_queued_jobs:16,max_concurrent_per_target:1,job_timeout_ms:3e4,per_principal_requests_per_minute:60,global_requests_per_minute:120}},connections:{available:!0,can_close:!0,max_bulk_close:200},flows:{available:!0,recording:"on",scopes:["userspace_tcp","userspace_udp","kernel_direct","kernel_block","dns_intercept","kernel_bypass"],max_flows:4096,max_steps_per_flow:64,retention_seconds:300,snapshot_ttl_seconds:60,max_page_size:1e3},routing_trace:{available:!0,resolve_modes:["none","live"],max_addresses:16,max_rule_steps:128,timeout_ms:5e3,per_principal_requests_per_minute:60,global_requests_per_minute:120},events:{available:!0,kinds:["stream.ready","runtime.updated","flow.updated","flow.gap","operation.updated","generation.changed"],retention_seconds:300,max_buffered_events:1024,max_clients:16,heartbeat_seconds:15},dns_query:{available:!0,record_types:["A","AAAA","HTTPS"],limits:{max_types_per_request:8,query_timeout_ms:5e3,max_response_bytes:65536,per_principal_requests_per_minute:60,global_requests_per_minute:120}},dns_cache:{available:!0,read:!0,delete_entry:!0,delete_name:!0,flush:!0,entry_kinds:["positive","negative"]},operations:{available:!0,retention_seconds:300},reload:{available:!0},suspend:{available:!0},resume:{available:!0}}},en={...ee,profiles:["base"],resources:{...ee.resources,runtime_outbounds:{available:!1},traffic_history:{available:!1},memory_history:{available:!1},logs:{available:!1},dns_log:{available:!1},dns_rules:{available:!1},runtime_settings:{available:!1},geodata:{available:!1},rules:{available:!1},nodes:{available:!0,can_manage:!1},providers:{available:!0,can_refresh:!1,can_manage:!1,max_page_size:1e3},config:{available:!1,content:!1,create:!1},config_validate:{available:!1},flows:{...ee.resources.flows,available:!1},routing_trace:{...ee.resources.routing_trace,available:!1},events:{...ee.resources.events,available:!1}}},tn={...ee,profiles:["base"],resources:{...Object.fromEntries(Object.keys(ee.resources).map(e=>[e,{available:!1}])),runtime:{available:!0},connections:{available:!0,can_close:!1,max_bulk_close:1e3},config:{available:!1,content:!1,create:!1}}},Ge=[{id:"r1",cond:"pname(NetworkManager, systemd-resolved) && l4proto(udp) && dport(53)",target:"direct",must:!0},{id:"r2",cond:"dip(geoip: private)",target:"direct",must:!0},{id:"r3",cond:"domain(suffix: doubleclick.net)",target:"block",must:!1},{id:"r4",cond:"domain(geosite: cn)",target:"direct",must:!1},{id:"r5",cond:"domain(geosite: telegram)",target:"proxy",must:!1},{id:"r6",cond:"mac(aa:bb:cc:dd:ee:ff) && ipversion(4)",target:Line truncated
|
||||
tproxy_port: 12345
|
||||
log_level: info
|
||||
lan_interface: br-lan
|
||||
wan_interface: auto
|
||||
allow_insecure: false
|
||||
auto_config_kernel_parameter: true
|
||||
}
|
||||
|
||||
subscription {
|
||||
sub-c: 'https://sub.example.net/api/v1/client/subscribe?token=demo'
|
||||
}
|
||||
|
||||
node {
|
||||
'hk-01': 'vless://demo@hk-01.example.net:443?security=tls#hk-01'
|
||||
'hk-02': 'vless://demo@hk-02.example.net:443?security=tls#hk-02'
|
||||
'sg-01': 'trojan://demo@sg-01.example.net:443#sg-01'
|
||||
'jp-01': 'vless://demo@jp-01.example.net:443?security=tls#jp-01'
|
||||
'us-01': 'anytls://demo@us-01.example.net:443#us-01'
|
||||
}
|
||||
|
||||
group {
|
||||
proxy { policy: ${pe.proxy.native} }
|
||||
resilient { filter: name(hk-01, sg-01, us-01) policy: ${pe.resilient.native} }
|
||||
gaming { filter: name(jp-01, hk-02) policy: ${pe.gaming.native} }
|
||||
skylink { filter: subtag(sub-c) policy: ${pe.skylink.native} }
|
||||
}
|
||||
|
||||
dns {
|
||||
upstream {
|
||||
cloudflare: 'tls://1.1.1.1:853'
|
||||
alidns: 'udp://223.5.5.5:53'
|
||||
}
|
||||
routing {
|
||||
request {
|
||||
qname(geosite: category-ads-all) -> reject
|
||||
qname(suffix: lan, home.arpa) -> asis
|
||||
qtype(HTTPS) && qname(geosite: cn) -> reject
|
||||
qname(geosite: cn) -> alidns
|
||||
fallback: cloudflare
|
||||
}
|
||||
response {
|
||||
upstream(cloudflare) -> accept
|
||||
ip(geoip: private) && !qname(geosite: cn) -> cloudflare
|
||||
fallback: accept
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
routing {
|
||||
pname(NetworkManager, systemd-resolved) && l4proto(udp) && dport(53) -> direct(must)
|
||||
dip(geoip: private) -> direct(must)
|
||||
domain(suffix: doubleclick.net) -> block
|
||||
domain(geosite: cn) -> direct
|
||||
domain(geosite: telegram) -> proxy
|
||||
include rules.dae
|
||||
fallback: resilient
|
||||
}
|
||||
|
||||
include {
|
||||
config.d/*.dae
|
||||
}
|
||||
`,sn=`# Household exceptions, kept apart from config.dae.
|
||||
# The TV never leaves through a node.
|
||||
mac(aa:bb:cc:dd:ee:ff) && ipversion(4) -> direct
|
||||
|
||||
# AI
|
||||
domain(geosite: openai) -> proxy
|
||||
sip(10.0.0.0/24) && dport(25) -> block
|
||||
`,Ve=`'香港 01 IPLC': 'vless://<redacted>'
|
||||
'香港 02 BGP': 'vless://<redacted>'
|
||||
'新加坡 01 2x': 'trojan://<redacted>'
|
||||
'日本 01 2x': 'vless://<redacted>'
|
||||
`,rn=`# Written by honk from the subscription; edits are lost on refresh.
|
||||
skylink { filter: subtag(sub-c) }
|
||||
`,an=[{level:"warning",source_id:"src-main",line:5,column:3,span:null,code:"interface_auto",message:"wan_interface: auto is resolved at start; a changed default route needs a reload"},{level:"warning",source_id:"src-rules",line:3,column:1,span:null,code:"mac_unseen",message:"mac(aa:bb:cc:dd:ee:ff) has not been seen on the LAN since start"},{level:"info",source_id:"src-sub-c",line:1,column:null,span:null,code:"subscription_cached",message:"Subscription fetched 30 minutes ago; nodes come from the cache"}],_t=[{id:"src-main",path:"/etc/honk/config.dae",kind:"main",writable:!0,loaded_at:B(3600),content:on},{id:"src-rules",path:"/etc/honk/rules.dae",kind:"include",writable:!0,loaded_at:B(3600),content:sn},{id:"src-sub-c",path:"/var/lib/honk/subscriptions/sub-c.dae",kind:"subscription",writable:!1,loaded_at:B(1800),content:Ve,onDisk:Ve.replaceAll("<redacted>","demo@edge.example.net:443")},{id:"src-generated",path:"/var/lib/honk/generated/skylink.dae",kind:"generated",writable:!1,loaded_at:B(1800),content:rn}],gt=_t.map(e=>e.id==="src-rules"?{...e,content:e.content+`
|
||||
# Ads
|
||||
`+ze.map(n=>`${n.cond} -> ${n.target}
|
||||
`).join("")}:e),ln=gt.map(e=>e.id==="src-rules"?{...e,content:e.content+`domain(suffix: example.org) -> direct
|
||||
`}:e);function ht(e=100){if(!Number.isSafeInteger(e)||e<1||e>1e3)throw new h(400,"invalid_request","Invalid page size");return e}function _e(e,n=1/0){const s=new Map;return(r,i={})=>{const{cursor:p,limit:l,...f}=i,a=ht(l),o=jt([e,f]);for(const[c,d]of s)d.expires<=Date.now()&&s.delete(c);const[u,b,k]=p?.split(":")??[ut(),"0"],m=Number(b),_=p?s.get(u):{items:r,key:o,expires:Date.now()+3e4};if(!_||k!==void 0||_.key!==o||!Number.isSafeInteger(m)||p&&(m<1||m>=_.items.length))throw new h(e==="flows"?410:400,e==="flows"?"snapshot_expired":"invalid_request","Unknown or expired cursor");const y=_.items.slice(m,m+a);let A=0;const S=y.findIndex(c=>(A+=JSON.stringify(c).length)>n),t=m+(S<0?y.length:Math.max(1,S));return!p&&t<r.length&&(_.items=structuredClone(r),s.size>=32&&s.delete(s.keys().next().value),s.set(u,_)),{items:structuredClone(_.items.slice(m,t)),total:_.items.length,next_cursor:t<_.items.length?`${u}:${t}`:null}}}function W(e,n){if(e===void 0)throw new h(404,"resource_not_found",`${n} not found`);return e}function Re(e){const n=URL.parse(e);return n?n.origin+n.pathname+(n.search?"?[redacted]":""):null}const cn=new Set(["global","subscription","node","group","dns","routing","upstream","request","response","include"]),We=new Set(Tt),dn=new Set(Et),un=e=>e===""?0:e.replace(/\n$/,"").split(`
|
||||
`).length;async function ce({onDisk:e,...n}){const s=e??n.content;return{...n,content_sha256:await Pt(s),bytes:new TextEncoder().encode(s).length,line_count:un(s)}}function ge(e,n,s=!1){const{blocks:r}=ne(e),i=r.filter(p=>p.name===n).flatMap(p=>pt(e,p).filter(l=>!l.block));return s&&!r.length&&i.push({from:0,to:e.length,block:void 0}),bt(e,i)}const pn=(e,n)=>bt(e,pt(e,n).filter(s=>!s.block));function bt(e,n){return n.flatMap(({from:s,to:r})=>{const i=e.slice(0,s).split(`
|
||||
`).length;return e.slice(s,r).split(`
|
||||
`).map((p,l)=>({code:Gt(p).trim(),raw:p,line:i+l}))})}function ve(e){return[...ge(e,"include").filter(({code:n})=>n).map(({code:n,line:s})=>({path:me(n),line:s})),...ge(e,"routing",!0).flatMap(({code:n,line:s})=>{const r=/^include\s+(\S+)$/.exec(n);return r?[{path:me(r[1]),line:s}]:[]})]}const Ke=(e,n,s)=>e.filter(r=>Te(Q(n,s),Q(void 0,r.path)));function wt(e,n,s,r){const i=[],p=(o,u,b,k,m)=>i.push({level:b,source_id:e,line:o,column:u,span:null,code:k,message:m}),{blocks:l,tokens:f}=ne(n),a=o=>{o.depth===0&&!cn.has(o.name)&&p(o.line+1,1,"error","unknown_section",`Unknown section "${o.name}"`),o.close===n.length&&p(o.line+1,1,"error","section_not_closed",`Section "${o.name}" is never closed`),o.children.forEach(a)};l.forEach(a);for(const o of f)o.kind==="symbol"&&o.depth===0&&n[o.from]==="}"&&p(o.line+1,1,"error","brace_without_section","Closing brace without an open section");for(const{code:o,line:u}of ge(n,"global")){if(!o)continue;const b=/^([\w.-]+)\s*:\s*(.*)$/.exec(o);b?dn.has(b[1])||p(u,1,"error","unknown_key",`Unknown global setting "${b[1]}"`):p(u,1,"error","not_a_setting",'Expected "<key>: <value>"')}return ge(n,"routing",!0).forEach(({code:o,raw:u,line:b})=>{if(!o||/^include\s+\S+$/.test(o))return;const k=/^fallback:\s*(\S+)$/.exec(o),m=/^(.+?)\s*->\s*(\S+)$/.exec(o),_=k?.[1]??m?.[2];if(!_){p(b,1,"error","not_a_rule",'Expected "<condition> -> <outbound>", "include <file>" or "fallback: <outbound>"');return}const y=_.replace(/\(.*\)$/,"");r==="full"&&!We.has(_)&&!We.has(y)&&!s.has(y)&&p(b,u.lastIndexOf(_)+1,"error","unknown_outbound",`No group named "${y}"`),m&&!/\w\(/.test(m[1])&&p(b,1,"warning","bare_condition","Condition has no function call; it will never match")}),i}function fn(e){return new Set(ne(e).blocks.filter(n=>n.name==="group").flatMap(n=>n.children.map(s=>s.name)))}function $e(e,n,s=[]){const r=e.sources.map((l,f)=>({...l,id:l.id??`source-${f+1}`}));if(new Set(r.map(l=>l.id)).size!==r.length)throw new h(400,"invalid_request","Source IDs must be unique");const i=[];if(e.mode==="full"){const l=r[0]?.path,f=new Map([...s,...r].filter(o=>o.path).map(o=>[Q(void 0,o.path),o])),a=new Set(r.map(o=>o.path&&Q(void 0,o.path)));for(let o=0;o<r.length;o++){const u=r[o];for(const{path:b,line:k}of ve(u.content)){const m=Q(l,b);if(Lt(b)){for(const[y,A]of f)Te(m,y)&&!a.has(y)&&(a.add(y),r.push({...A,id:A.id??`source-${r.length+1}`}));continue}const _=f.get(m);_?a.has(m)||(a.add(m),r.push({..._,id:_.id??`source-${r.length+1}`})):i.push({source_id:u.id,line:k,column:1,span:null,level:"error",code:"include_not_found",message:`Include "${b}" cannot be resolved`})}}}const p=e.mode==="full"?new Set(r.flatMap(l=>[...fn(l.content)])):new Set;return i.push(...r.flatMap(l=>wt(l.id,l.content,p,e.mode))),{valid:!i.some(l=>l.level==="error"),diagnostics:i,generation_id:n,validated_at:new Date().toISOString()}}const qe={request:"asis",response:"accept"},mn={request:["asis","reject"],response:["accept","reject"]};function _n(e,n){const s=e.flatMap(a=>zt(a.content)),r=a=>s.find(o=>o.toLowerCase()===a.toLowerCase())??a,i={request:[],response:[]},p={},l=(a,o)=>{const u=o.toLowerCase();return mn[a].includes(u)?{action:u,upstream:null}:{action:a==="request"?"upstream":"requery",upstream:r(o)}};for(const a of e){const{blocks:o}=ne(a.content),u=o.filter(b=>b.name==="dns").flatMap(b=>b.children.filter(k=>k.name==="routing"));for(const b of u)for(const k of b.children){const m=k.name;if(!(m!=="request"&&m!=="response"))for(const{code:_,raw:y,line:A}of pn(a.content,k)){const S=/^(?:fallback|default):\s*('[^']*'|"[^"]*"|\S+)$/.exec(_),t=/^(.+?)\s*->\s*('[^']*'|"[^"]*"|\S+)$/.exec(_);if(!S&&!t)continue;const c=new TextEncoder().encode(y.slice(0,y.search(/\S/))).length+1,d={file:a.path.split("/").pop(),source_id:a.id,line:A,column:c};S?p[m]={rule_id:`${m}:fallback`,index:0,expression:_,...l(m,S[1]),source:d,kind:"fallback"}:i[m].push({rule_id:`${m}:${d.file}:${A}`,index:i[m].length,expression:_,...l(m,t[2]),source:d,kind:"rule"})}}}const f=a=>[...i[a],{...p[a]??{rule_id:`${a}:fallback`,expression:`fallback: ${qe[a]}`,action:qe[a],upstream:null,source:null,kind:"fallback"},index:i[a].length}];return{generation_id:n,request:f("request"),response:f("response")}}function gn(e,n,{enqueue:s,log:r,publish:i,eventData:p,trimLogs:l},f,a,o,u=!1){const b=u?nn:De,k=structuredClone(b),m=()=>{const v=structuredClone(k);return e.resources.geodata.configurable_sources===!0&&(v.geodata=o.settings()),v};let _=null,y=[],A;const S=()=>A??=Promise.all([Promise.all((u?gt:_t).map(ce)),u?Promise.all(ln.map(ce)):null]).then(([v,M])=>(_=v,y=M??[...v],v));let t=40,c=0;const d=v=>v.kind==="main"||v.kind==="include";function g(v,M=y){const P=[],E=M.find(U=>U.kind==="main"),H=U=>{if(P.some(O=>O.id===U.id))return;const w=U.id===v?.id?v.content:U.content;P.push({id:U.id,path:U.path,content:w});for(const{path:O}of ve(w))Ke(M,E.path,O).forEach(H)};return E&&H(E),P}function N(v,M){const P=H=>new TextEncoder().encode(H).length;if(P(JSON.stringify(M))>e.limits.max
Line truncated
|
||||
`),v),_&&(_=[...y],o.follow(C(_).rules.flatMap(E=>E.kind==="rule"?[E.expression]:[]))),t+=1,Object.assign(k,structuredClone(b),{observed_at:new Date().toISOString()}),r("info","honk::routing","Routing generation published.",{generation_id:String(t)});const P=String(t);return n.generation={...n.generation,active_id:P,config_revision:P,activated_at:new Date().toISOString()},i({id:"",event:"generation.changed",data:{...p(),generation_id:P,previous_generation_id:String(t-1)}}),P}async function D(v){await S();const M=W(y.find(E=>E.kind==="main"),"Main source"),P=await ce({...M,content:v(M.content),loaded_at:new Date().toISOString()});return()=>{if(y.find(E=>E.id===M.id)!==M)throw new h(412,"stale_revision","The main source changed before activation");return y=y.map(E=>E.id===M.id?P:E),I()}}function C(v){const M=v.find($=>$.kind==="main"),P=new Map(v.map($=>[Q(void 0,$.path),$])),E=new Map([...mt.rules,...ze].map($=>[$.cond+" -> "+$.target+($.must?"(must)":""),$.id])),H=[];let U=null;const w=new Set,O=($,L)=>{if(!w.has($.id)){w.add($.id),ge($.content,"routing",L).forEach(({code:j,raw:F,line:R})=>{const z=/^include\s+(\S+)$/.exec(j);if(z){const He=P.get(Q(M.path,z[1]));He&&O(He,!0);return}const T=/^fallback:\s*(\S+)$/.exec(j),q=/^(.+?)\s*->\s*(\S+)$/.exec(j);if(!T&&!q)return;const X=F.search(/\S/),Ct=new TextEncoder().encode(F.slice(0,X)).length+1,le={file:$.path.split("/").pop(),source_id:$.id,line:R,column:Ct};if(T){U={outbound:T[1],source:le},H.push({rule_id:"fallback",index:H.length,expression:j,outbound:T[1],must:!1,source:le,kind:"fallback"});return}const Dt=q[2].endsWith("(must)"),Rt=q[2].replace(/\(must\)$/,"");H.push({rule_id:E.get(j)??`${le.file}:${le.line}`,index:H.length,expression:q[1],outbound:Rt,must:Dt,source:le,kind:"rule"})});for(const{path:j}of ve($.content))Ke(v,M.path,j).forEach(F=>O(F,!0))}};return M&&O(M,!1),{rules:H,fallback:U}}const G=async()=>{await S();const{rules:v,fallback:M}=C(_);if(!M)throw new h(503,"snapshot_unavailable","The routing section has no fallback",null,null,1);return{generation_id:String(t),rules:v,fallback:M}};return{api:{rules:async v=>{if(v?.throwIfAborted(),!e.resources.rules.available)throw new h(404,"capability_not_supported","The rule list is unavailable");return G()},dnsRules:async v=>{if(v?.throwIfAborted(),!e.resources.dns_rules.available)throw new h(404,"capability_not_supported","The DNS rule list is unavailable");return await S(),_n(_.filter(d),String(t))},config:async v=>{if(v?.throwIfAborted(),!e.resources.config.available)throw new h(404,"capability_not_supported","Configuration readback is unavailable");await S();const M=_,P=String(t),E=f();return{generation_id:P,revision:P,sources:M.map(H=>e.resources.config.content?{...H}:{...H,content:void 0}),diagnostics:[...M.filter(d).flatMap(H=>wt(H.id,H.content,E,"full").filter(U=>U.level!=="error")),...u?an:[]],secrets_redacted:!0}},validateConfig:async(v,M)=>{if(M?.throwIfAborted(),!e.resources.config_validate.available)throw new h(404,"capability_not_supported","Validation is unavailable");if(!e.resources.config_validate.modes?.includes(v.mode))throw new h(400,"invalid_request",`Mode ${v.mode} is not advertised`);return v.mode==="full"&&await S(),$e(v,String(t),y.filter(d))},replaceConfigSource:async(v,M,P,E)=>{E?.throwIfAborted(),await S();const U=W(y.find($=>$.id===v),"Configuration source");if(!e.resources.config.writable||!U.writable)throw new h(403,"permission_denied","This source is read-only");if(N(M,{content:M}),!P)throw new h(428,"precondition_required","If-Match is required");if(P.replace(/^"|"$/g,"")!==U.content_sha256)throw new h(412,"stale_revision","The source changed on disk; fetch it again before retrying");const w=$e({sources:g({id:v,content:M}),mode:"full"},String(t));if(!w.valid)throw new h(422,"unsupported_value","Validation found errors; nothing was written",null,{diagnostics:w.diagnostics});const O=await ce({...U,content:M,loaded_at:new Date().toISOString()});return y=y.map($=>$.id===v?O:$),r("info","honk::config","Configuration source replaced; reloading.",{source_id:v}),s("reload",()=>{const $=I();return{active_generation_id:$,datapath_generation_id:$}})},createConfigSource:async(v,M,P)=>{P?.throwIfAborted();const E=e.resources.config;if(!E.available||!E.create)throw new h(404,"capability_not_supported","Creating configuration sources is unavailable");if(!E.writable)throw new h(403,"permission_denied","Configuration writes are disabled");if(N(M,{path:v,content:M}),Ut(v)||new TextEncoder().encode(v).length>1024)throw new h(400,"invalid_request","path must be a relative .dae path with normal segments");await S();const H=W(y.find(j=>j.kind==="main"),"Main source"),U=Q(H.path,v),w=()=>{if(y.some(j=>Q(void 0,j.path)===U))throw new h(409,"state_conflict",`${v} already exists`);if(E.max_sources!==void 0&&y.length>=E.max_sources)throw new h(413,"request_too_large","Source count exceeds the advertised max_sources")};if(w(),!g().some(j=>ve(j.content).some(F=>Te(Q(H.path,F.path),U)))){const j={le
Line truncated
|
||||
`);e=e.slice(0,l.close)+`
|
||||
`+a+`
|
||||
`+e.slice(l.close);for(const o of f.reverse())e=e.slice(0,o.from)+e.slice(o.to);return e}function Xe(e){try{return e()}catch{throw new h(422,"unsupported_value","The value cannot be written to the configuration")}}const Qe=e=>e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");function $n(e,n,{enqueue:s,log:r,pending:i},p,l,f,a,o=!1){const u=_e("nodes"),b=_e("providers"),k=structuredClone(wn),{nodes:m,groups:_}=bn(Number.isFinite(n)?n:120,o);for(const t of k)t.node_count=m.filter(c=>c.provider_id===t.id).length;o&&Object.assign(k.find(t=>t.id==="sub-c"),{status:"stale",last_error:de});const y=new Map,A=new Set;return{api:{nodes:async(t,c)=>{if(c?.throwIfAborted(),!e.resources.nodes.available)throw new h(404,"capability_not_supported","Nodes are unavailable");const d=u(t?.group_id?m.filter(g=>g.group_ids.includes(t.group_id)):m,t);return{observed_at:J,nodes:d.items,next_cursor:d.next_cursor}},groups:async t=>{if(t?.throwIfAborted(),!e.resources.groups.available)throw new h(404,"capability_not_supported","Groups are unavailable");return _.map(c=>({id:c.id,name:c.name,icon:c.icon,config_revision:c.config_revision,policy:{...c.policy},member_count:c.members.length,selection:{tcp_member_id:c.runtime.selection.tcp?.member_id??null,udp_member_id:c.runtime.selection.udp?.member_id??null}}))},group:async(t,c)=>{if(c?.throwIfAborted(),!e.resources.groups.available)throw new h(404,"capability_not_supported","Groups are unavailable");return structuredClone(W(_.find(d=>d.id===t),"Group"))},selectGroup:async(t,c,d)=>{d?.throwIfAborted();const g=W(_.find(x=>x.id===t),"Group"),N=!g.capabilities.can_select&&g.capabilities.can_override;if(!g.capabilities.can_select&&!N)throw new h(404,"capability_not_supported","Group does not support manual selection");W(g.members.find(x=>x.id===c.member_id),"Group member");const I=c.network==="both"?["tcp","udp"]:[c.network];let D=!1;for(const x of I){const v=g.runtime.selection[x]?.member_id;g.runtime.selection[x]={member_id:c.member_id,resolved_leaf_node_id:ye(c.member_id,x,m,_)?.id??null,source:N?"override":"runtime"},!(v===c.member_id||!g.config.interrupt_connections)&&(D=f(t,x)||D)}const C=(y.get(t)??0n)+1n;y.set(t,C);const G={group_id:t,member_id:c.member_id,network:c.network,source:N?"override":"runtime",selection_revision:String(C),connections_interrupted:D};return c.network!=="both"&&(G.resolved_leaf_node_id=g.runtime.selection[c.network]?.resolved_leaf_node_id),G},clearGroupOverride:async(t,c,d)=>{d?.throwIfAborted();const g=W(_.find(C=>C.id===t),"Group");if(!g.capabilities.can_override)throw new h(409,"state_conflict","Group has no override to clear");const N=c==="both"?["tcp","udp"]:[c],I=hn(g);for(const C of N)g.runtime.selection[C]={member_id:I,resolved_leaf_node_id:ye(I,C,m,_)?.id??null,source:"policy"};const D=(y.get(t)??0n)+1n;return y.set(t,D),{group_id:t,network:c,selection_revision:String(D),connections_interrupted:!1,selection:structuredClone(g.runtime.selection)}},patchGroup:async(t,c,d,g)=>{g?.throwIfAborted();const N=W(_.find(G=>G.id===t),"Group");if(d!=='"'+N.config_revision+'"')throw new h(412,"stale_revision","Group configuration revision changed");if(A.has(t))throw new h(409,"state_conflict","Group update is pending");const I=e.resources.groups.max_patch_operations;if(I!==void 0&&c.length>I)throw new h(413,"request_too_large","Too many patch operations");const D=Sn(N,c),C=await l(G=>An(G,N.name,D));return A.add(t),s("group_update",()=>{A.delete(t);const G=C();return{group_id:t,config_revision:G}})},startProbe:async(t,c)=>{c?.throwIfAborted();const d=e.resources.probes;if(!d.available)throw new h(404,"capability_not_supported","Probes are unavailable");const g=t.ip_version==="any"?["ipv4","ipv6"]:[t.ip_version];if(!d.targets?.includes(t.target.type)||!d.kinds?.includes(t.kind)||!d.purposes?.includes(t.purpose)||t.transport.some(x=>!d.transports?.includes(x))||g.some(x=>!d.ip_versions?.includes(x)))throw new h(422,"unsupported_value","Probe dimensions are not advertised");const N=t.target,I=N.type==="group"?W(_.find(x=>x.id===N.group_id),"Group"):void 0;if(N.type==="node"&&W(m.find(x=>x.id===N.node_id),"Node"),!t.transport.length||t.transport.some(x=>I&&!I.capabilities.probe_transports.includes(x))||t.kind!=="dns"&&(t.purpose!=="data"||t.transport.some(x=>x!=="tcp"))||t.kind==="dns"&&t.purpose!=="dns")throw new h(422,"unsupported_value","Unsupported probe dimensions");if(I&&Array.isArray(t.members)&&t.members.some(x=>!I.members.some(v=>v.id===x)))throw new h(422,"unsupported_value","Probe member is not in this group");const D=kt(t,m,_).length,C=d.limits;if(D>C.max_members_per_job||D*t.transport.length*g.length>C.max_results_per_job)throw new h(413,"request_too_large","Probe exceeds the advertised member or result limit");const G=structuredClone(t);return s("probe",()=>xn(G,m,_,new Date().toISOString()))},providers:async(t,c)=>{if(c?.throwIfAborted(),!e.resources.providers.available)throw new h(404,"capability_not_supported","Providers are unavailable");const d=e.resources.
Line truncated
|
||||
`),x=Xe(()=>G.length?` ${Be(t.name)}: {
|
||||
url: ${re(t.url)}
|
||||
${G.join("")} }
|
||||
`:` ${Be(t.name)}: ${re(t.url)}
|
||||
`),v=await l(M=>M.replace(/^(subscription \{\n)/m,`$1${x}`));return r("info","honk::subscription","Subscription added.",{provider:t.name}),v(),structuredClone(W(k.find(M=>M.name===t.name),"Provider"))},deleteProvider:async(t,c)=>{if(c?.throwIfAborted(),!e.resources.providers.can_manage)throw new h(404,"capability_not_supported","Provider management is unavailable");const d=k.findIndex(D=>D.id===t);if(d<0)return{deleted:0};if(k[d].kind==="inline")throw new h(404,"capability_not_supported","The inline provider is the node section itself");const g=k[d],N=Qe(g.name),I=await l(D=>D.replace(new RegExp(`^\\s*${N}:\\s*\\{\\n[\\s\\S]*?\\n\\s*\\}\\n|^\\s*${N}:.*\\n`,"m"),""));return r("info","honk::subscription","Subscription removed.",{provider:g.name}),I(),{deleted:1}},createNode:async(t,c)=>{if(c?.throwIfAborted(),!e.resources.nodes.can_manage)throw new h(404,"capability_not_supported","Node management is unavailable");const d=/^([a-z][a-z0-9+.-]*):\/\/\S+$/i.exec(t.link.trim())?.[1]?.toLowerCase();if(!d||!vn.includes(d))throw new h(422,"unsupported_value",`Unsupported share link scheme "${d??""}"`);if(m.some(I=>I.name===t.name))throw new h(409,"state_conflict",`An inline node named ${t.name} already exists`);const g=Xe(()=>` ${re(t.name)}: ${re(t.link.trim())}
|
||||
`),N=await l(I=>I.replace(/^(node \{\n)/m,`$1${g}`));return r("info","honk::config","Node added.",{node:t.name,protocol:d}),N(),structuredClone(W(m.find(I=>I.name===t.name),"Node"))},deleteNode:async(t,c)=>{if(c?.throwIfAborted(),!e.resources.nodes.can_manage)throw new h(404,"capability_not_supported","Node management is unavailable");const d=m.find(N=>N.id===t);if(!d)return{deleted:0};if(d.provider_id!=="inline")throw new h(404,"capability_not_supported","Only inline nodes can be deleted; refresh or delete the provider instead");const g=await l(N=>N.replace(new RegExp(`^\\s*'${Qe(d.name)}':.*\\n`,"m"),""));return r("info","honk::config","Node removed.",{node:d.name}),g(),{deleted:1}},geodata:async t=>{if(t?.throwIfAborted(),!e.resources.geodata.available)throw new h(404,"capability_not_supported","Geodata is unavailable");return a.status()},updateGeodata:async t=>{if(t?.throwIfAborted(),!e.resources.geodata.can_update)throw new h(404,"capability_not_supported","Geodata update is unavailable");if(i("geodata_update"))throw new h(409,"state_conflict","A geodata update is already queued or running");return s("geodata_update",()=>{const c=a.update();return r("info","honk::geodata","Geodata updated; reloading.",{assets:c.assets.map(d=>d.kind)}),p(),c})}},groupNames:()=>new Set(_.map(t=>t.name)),groupIds:()=>new Set(_.map(t=>t.id)),activate:(t,c)=>In(t,c,m,_,k)}}const Nn=[{level:"info",target:"honk::main",message:"Runtime snapshot captured.",fields:{pid:1842}},{level:"info",target:"honk::config",message:"Configuration state checked.",fields:{sources:4,generation_id:"40"}},{level:"info",target:"honk::subscription",message:"Subscription status checked.",fields:{provider:"sub-c"}},{level:"warn",target:"honk::subscription",message:"Subscription served from cache.",fields:{provider:"sub-c",age_seconds:1800}},{level:"warn",target:"honk::datapath",message:"Routing map sample delayed.",fields:{interface:"lan0"}},{level:"info",target:"honk::dns",message:"DNS listener healthy.",fields:{bind:"127.0.0.1:5353"}},{level:"info",target:"honk::routing",message:"Routing generation checked.",fields:{generation_id:"40"}},{level:"error",target:"honk::group",message:"Health check failed.",fields:{node:"jp-01",error:"connect timeout"}},{level:"info",target:"honk::api",message:"Native API request served.",fields:{listen:"127.0.0.1:9090"}}];function Mn(e,n,s,r,i,p=2500,l=!1){const f=new Map;let a=0;const o=new Set,u=[],b=new Map,k=new Map,m=()=>{for(;u.length&&Date.now()-Date.parse(u[0].data.observed_at)>n.retention_seconds*1e3;)u.shift();const w=u.length?Number(u[0].id.split(":")[1])-1:a,O=I.length?Number(I[0].id.split(":")[2])-1:C;for(const[$,L]of b)(L.position<(L.stream==="events"?w:O)||L.stream==="events"&&Date.now()-L.issued>n.retention_seconds*1e3)&&(b.delete($),k.delete(JSON.stringify([L.stream,L.filter,L.position])))},_=(w,O,$)=>{const L=JSON.stringify([w,O,$]),j=k.get(L);if(j)return j;const F=ut();return b.set(F,{stream:w,filter:O,position:$,issued:Date.now()}),k.set(L,F),F},y=(w,O,$,L)=>{if(w===void 0)return L;m();const j=b.get(w);if(!j||j.stream!==O||j.filter!==$)throw new h(409,"event_cursor_expired","The stream cursor cannot be replayed");return j.position};let A;const S=()=>({instance_id:K,observed_at:new Date().toISOString()});function t(w){w.id=`${K}:${++a}`,u.push(w),u.length>n.max_buffered_events&&u.shift(),m(),o.forEach(O=>O(w))}function c(){s.observed_at=new Date().toISOString(),t({id:"",event:"runtime.updated",data:{...S(),href:"/api/v1/runtime"}})}const d=(w,O)=>{const $="op-"+(f.size+1),L=new Date().toISOString(),j={operation_id:$,kind:w,created_at:L,started_at:L};f.set($,{...j,finished_at:null,status:"running",result:null,error:null,retryAfter:1}),t({id:"",event:"operation.updated",data:{...S(),resource_id:$,status:"running",href:"/api/v1/operations/"+$}}),setTimeout(()=>{try{f.set($,{...j,status:"succeeded",result:O(),error:null,finished_at:new Date().toISOString()})}catch(z){f.set($,{...j,status:"failed",finished_at:new Date().toISOString(),result:null,error:z instanceof h?{code:z.code,message:z.message,details:z.details}:{code:"operation_failed",message:z instanceof Error?z.message:String(z)}})}const R=f.get($);w==="reload"&&(R.status==="succeeded"||R.status==="failed")&&(s.last_reload={operation_id:$,status:R.status,finished_at:R.finished_at,error:R.error}),t({id:"",event:"operation.updated",data:{...S(),resource_id:$,status:R.status,href:"/api/v1/operations/"+$}}),c()},1e3);const F="/api/v1/operations/"+$;return{operation_id:$,kind:w,status:"queued",href:F,retryAfter:1}},g=async(w,O)=>(O?.throwIfAborted(),structuredClone(W(f.get(w),"Operation"))),N=["trace","debug","info","warn","error"],I=[],D=new Set;let C=0;function G(){const w=r().buffered_records;I.length>w&&I.splice(0,I.length-w),m()}const x=(w,O,$,L=null,j=Date.now())=>{const F={id:`${K}:logs:${++C}`,ts:new Date(j).toISOString(),level:w,target:O,message:$,fields:L};I.push(F),G(),D.forEach(R=>R(F))},v=[()=>x("info","honk::routing","Routing generation p
Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
const t={kernel:"flow.v.kernel",userspace:"flow.v.userspace",matched:"flow.v.matched",other_family_trusted:"flow.v.otherFamilyTrusted",failed:"flow.v.failed",not_required:"flow.v.notRequired",unavailable:"flow.v.unavailable",pass:"flow.v.pass",redirect:"flow.v.redirect",hold:"flow.v.hold",arm_direct:"flow.v.armDirect",activate_direct:"flow.v.activateDirect",activate_proxy:"flow.v.activateProxy",drop:"flow.v.drop",started:"flow.v.started",succeeded:"flow.v.succeeded",cancelled:"flow.v.cancelled",transport_ready:"flow.v.transportReady",target_request_sent:"flow.v.targetRequestSent",target_confirmed:"flow.v.targetConfirmed",first_reply:"flow.v.firstReply",terminal:"flow.v.terminal",unknown:"ui.unknown",route_selected:"flow.v.routeSelected",no_new_routing_input:"flow.v.noNewRoutingInput",reply_received:"flow.v.replyReceived",hit:"flow.v.hit",miss:"flow.v.miss",stale:"flow.v.stale",bypass:"flow.v.bypass",hosts:"flow.v.hosts",coalesced:"flow.v.coalesced",cache:"flow.v.cache",upstream:"ui.upstream",lan:"flow.v.lan",wan:"flow.v.wan",tls_sni:"flow.v.tlsSni",http_host:"flow.v.httpHost",quic_sni:"flow.v.quicSni",dns_mapping:"flow.v.dnsMapping",explicit:"flow.v.explicit"},l=e=>e==null?"—":t[e]?{key:t[e]}:e;export{l as w};
|
||||
@@ -1 +1 @@
|
||||
import{r as m,j as g}from"./vendor-react-Bf71BWbF.js";import{eH as p}from"./index-CXHBmSa5.js";function b(t,e,s){const n=e.getBoundingClientRect(),o=s&&t.pointerType==="mouse"?Math.floor(t.clientX):t.clientX,l=s&&t.pointerType==="mouse"?Math.floor(t.clientY):t.clientY,i=o-n.left,r=l-n.top;return s?{x:Math.round(i*s.width/n.width),y:Math.round(r*s.height/n.height),width:s.width}:{x:i,y:r,width:n.width}}function C(t,e,s){const[n,o]=m.useState(null),[l,i]=m.useState(!1),[r,a]=m.useState(!1),c=n!==null&&n<t?n:null;return{onFocus:()=>{i(!0),c===null&&t&&(o(0),a(!0),e(0))},onBlur:()=>{i(!1),a(!1),s()},onPointerLeave:()=>{l||s()},onKeyDown:u=>{if(!["ArrowRight","ArrowLeft","Enter"].includes(u.key))return;if(u.preventDefault(),u.key==="Enter"){if(c===null)return;r?s():e(c),a(!r);return}const x=c===null?u.key==="ArrowRight"?0:t-1:c+(u.key==="ArrowRight"?1:-1);x<0||x>=t||(o(x),a(!0),e(x))}}}const w=(t,e)=>t===e||!!t&&!!e&&t.x===e.x&&t.y===e.y&&t.width===e.width&&t.label===e.label&&t.bounds?.x===e.bounds?.x&&t.bounds?.y===e.bounds?.y&&t.bounds?.height===e.bounds?.height&&t.bounds?.width===e.bounds?.width&&t.lines.length===e.lines.length&&t.lines.every((s,n)=>s===e.lines[n]);function k(){let t=null;const e=new Set;return{get:()=>t,set(s){w(t,s)||(t=s,e.forEach(n=>n()))},subscribe(s){return e.add(s),()=>void e.delete(s)}}}function T(){const t=m.useRef(null),[e]=m.useState(k),s=m.useCallback((o,l)=>{t.current&&e.set({...b(o,t.current),lines:l})},[e]),n=m.useCallback(()=>e.set(null),[e]);return{ref:t,tip:e,show:s,showAt:e.set,hide:n}}function R({tip:t}){const e=m.useSyncExternalStore(t.subscribe,t.get);if(!e)return null;if(e.bounds)return g.jsx(E,{tip:e});const s=e.x>e.width-120?"end":e.x<120?"start":"middle";return g.jsx("div",{className:"rp-charttip "+s,style:{left:e.x,top:e.y},"aria-hidden":"true",children:e.lines.map((n,o)=>o===0?g.jsx("b",{children:n},o):g.jsx("span",{children:n},o))})}const j=t=>t;function E({tip:t}){const[e,s]=p(j),[n,o]=m.useState(null);m.useEffect(()=>{const c=u=>{u.key==="Escape"&&o({x:t.x,y:t.y})};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t.x,t.y]),n&&(n.x!==t.x||n.y!==t.y)&&o(null);const l=t.bounds,i=(c,u,x,f)=>{const d=c+10+u>x+f?c-u-10:c+10;return Math.max(x,Math.min(d,x+f-u))},r=i(t.x,s?.width??0,l.x,l.width),a=i(t.y,s?.height??0,l.y,l.height);return g.jsx("div",{ref:e,className:"rp-charttip-bounded",style:{visibility:s&&!(n?.x===t.x&&n?.y===t.y)?"visible":"hidden",pointerEvents:"none",position:"absolute",top:0,left:0,transform:`translate(${r}px, ${a}px)`},children:g.jsxs("div",{role:"status","aria-live":"polite",className:"rp-boundedtip",style:{maxInlineSize:l.width},children:[g.jsx("p",{children:t.label}),g.jsx("ul",{children:t.lines.map((c,u)=>g.jsx("li",{children:c},u))})]})})}function z(t,e){return t.length?t[Math.min(t.length-1,Math.max(0,Math.ceil(e/100*t.length)-1))]:null}function D(t){const e=t.map(o=>Math.max(o,1));if(!e.length)return[1,10];const s=10**Math.floor(Math.log10(Math.min(...e))),n=10**Math.ceil(Math.log10(Math.max(...e)));return[s,n>s?n:s*10]}function N([t,e],s=8){const n=[];for(let l=t;l<=e;l*=10)for(const i of[1,2,5])l*i<=e&&n.push(l*i);const o=l=>Math.abs(Math.log10(l)-Math.round(Math.log10(l)))<1e-9;return n.length>s?n.filter(o):n}function P(t,[e,s]){const n=Math.min(s,Math.max(e,t));return(Math.log10(n)-Math.log10(e))/(Math.log10(s)-Math.log10(e))}function B(t,e,s){const n=t.map((c,u)=>({x:c,index:u})).sort((c,u)=>c.x-u.x),o=[],l=new Array(t.length).fill(0),i=[],r=e*2,a=s-e;for(const{x:c,index:u}of n){const x=[];for(let h=o.length-1;h>=0&&c-o[h].x<r;h--)x.push(o[h]);const f=h=>x.every(M=>(M.x-c)**2+(M.y-h)**2>=r*r-1e-6);let d=0;for(let h=0;!f(d);h++){const M=Math.ceil((h+1)/2)*(e/2);if(M>a){d=null;break}d=h%2?M:-M}if(l[u]=d,d===null){const h=i[i.length-1];h&&c-h.x<r?h.count++:i.push({x:c,count:1})}else o.push({x:c,y:d})}return{ys:l,hidden:i}}function F(t){const s=t.reduce((r,a)=>r+a,0);if(!s)return t.map(()=>0);const n=t.map(r=>r/s*100),o=n.map(Math.floor);let l=100-o.reduce((r,a)=>r+a,0);const i=n.map((r,a)=>({index:a,rest:r-o[a]})).sort((r,a)=>a.rest-r.rest||r.index-a.index);for(const{index:r}of i){if(!l)break;o[r]++,l--}for(let r=0;r<t.length;r++)if(t[r]>0&&o[r]===0){const a=o.indexOf(Math.max(...o));o[a]--,o[r]=1}return o}function I(t){const e=t.reduce((n,o)=>n+o,0),s=t.some(n=>n/e*360<6)?Math.min(6,360/t.length):0;return t.map(n=>s+n/e*(360-t.length*s))}function L(t,e){return t<=0||e<=0?0:Math.max(1,Math.ceil(t/e*5))}const y=[10,30,60,120,300,600,900,1800,3600,7200,21600,43200,86400,172800,604800,2592e3].map(t=>t*1e3);function X(t,e,s=24){const n=i=>Math.floor(e/i)-Math.floor(t/i)+1;let o=y.find(i=>n(i)<=s);o===void 0&&(o=Math.ceil((e-t)/(s-1)/y[y.length-1])*y[y.length-1]);const l=[];for(let i=Math.floor(t/o)*o;i<=e;i+=o)l.push(i);return l}function Y(t,e){return Math.log10(1+Math.max(0,Math.min(t,e)))/Math.log10(1+e)}function v(t){const e=Math.max(1e3,t*2),s=[0];for(let n=1e3;n<=e;n*=1e3)s.push(n);return{enLine truncated
|
||||
import{r as m,j as g}from"./vendor-react-Bf71BWbF.js";import{eQ as p}from"./index-BNBwb-FJ.js";function b(t,e,s){const n=e.getBoundingClientRect(),o=s&&t.pointerType==="mouse"?Math.floor(t.clientX):t.clientX,l=s&&t.pointerType==="mouse"?Math.floor(t.clientY):t.clientY,i=o-n.left,r=l-n.top;return s?{x:Math.round(i*s.width/n.width),y:Math.round(r*s.height/n.height),width:s.width}:{x:i,y:r,width:n.width}}function C(t,e,s){const[n,o]=m.useState(null),[l,i]=m.useState(!1),[r,a]=m.useState(!1),c=n!==null&&n<t?n:null;return{onFocus:()=>{i(!0),c===null&&t&&(o(0),a(!0),e(0))},onBlur:()=>{i(!1),a(!1),s()},onPointerLeave:()=>{l||s()},onKeyDown:u=>{if(!["ArrowRight","ArrowLeft","Enter"].includes(u.key))return;if(u.preventDefault(),u.key==="Enter"){if(c===null)return;r?s():e(c),a(!r);return}const x=c===null?u.key==="ArrowRight"?0:t-1:c+(u.key==="ArrowRight"?1:-1);x<0||x>=t||(o(x),a(!0),e(x))}}}const w=(t,e)=>t===e||!!t&&!!e&&t.x===e.x&&t.y===e.y&&t.width===e.width&&t.label===e.label&&t.bounds?.x===e.bounds?.x&&t.bounds?.y===e.bounds?.y&&t.bounds?.height===e.bounds?.height&&t.bounds?.width===e.bounds?.width&&t.lines.length===e.lines.length&&t.lines.every((s,n)=>s===e.lines[n]);function k(){let t=null;const e=new Set;return{get:()=>t,set(s){w(t,s)||(t=s,e.forEach(n=>n()))},subscribe(s){return e.add(s),()=>void e.delete(s)}}}function T(){const t=m.useRef(null),[e]=m.useState(k),s=m.useCallback((o,l)=>{t.current&&e.set({...b(o,t.current),lines:l})},[e]),n=m.useCallback(()=>e.set(null),[e]);return{ref:t,tip:e,show:s,showAt:e.set,hide:n}}function R({tip:t}){const e=m.useSyncExternalStore(t.subscribe,t.get);if(!e)return null;if(e.bounds)return g.jsx(E,{tip:e});const s=e.x>e.width-120?"end":e.x<120?"start":"middle";return g.jsx("div",{className:"rp-charttip "+s,style:{left:e.x,top:e.y},"aria-hidden":"true",children:e.lines.map((n,o)=>o===0?g.jsx("b",{children:n},o):g.jsx("span",{children:n},o))})}const j=t=>t;function E({tip:t}){const[e,s]=p(j),[n,o]=m.useState(null);m.useEffect(()=>{const c=u=>{u.key==="Escape"&&o({x:t.x,y:t.y})};return document.addEventListener("keydown",c),()=>document.removeEventListener("keydown",c)},[t.x,t.y]),n&&(n.x!==t.x||n.y!==t.y)&&o(null);const l=t.bounds,i=(c,u,x,f)=>{const d=c+10+u>x+f?c-u-10:c+10;return Math.max(x,Math.min(d,x+f-u))},r=i(t.x,s?.width??0,l.x,l.width),a=i(t.y,s?.height??0,l.y,l.height);return g.jsx("div",{ref:e,className:"rp-charttip-bounded",style:{visibility:s&&!(n?.x===t.x&&n?.y===t.y)?"visible":"hidden",pointerEvents:"none",position:"absolute",top:0,left:0,transform:`translate(${r}px, ${a}px)`},children:g.jsxs("div",{role:"status","aria-live":"polite",className:"rp-boundedtip",style:{maxInlineSize:l.width},children:[g.jsx("p",{children:t.label}),g.jsx("ul",{children:t.lines.map((c,u)=>g.jsx("li",{children:c},u))})]})})}function z(t,e){return t.length?t[Math.min(t.length-1,Math.max(0,Math.ceil(e/100*t.length)-1))]:null}function D(t){const e=t.map(o=>Math.max(o,1));if(!e.length)return[1,10];const s=10**Math.floor(Math.log10(Math.min(...e))),n=10**Math.ceil(Math.log10(Math.max(...e)));return[s,n>s?n:s*10]}function N([t,e],s=8){const n=[];for(let l=t;l<=e;l*=10)for(const i of[1,2,5])l*i<=e&&n.push(l*i);const o=l=>Math.abs(Math.log10(l)-Math.round(Math.log10(l)))<1e-9;return n.length>s?n.filter(o):n}function P(t,[e,s]){const n=Math.min(s,Math.max(e,t));return(Math.log10(n)-Math.log10(e))/(Math.log10(s)-Math.log10(e))}function B(t,e,s){const n=t.map((c,u)=>({x:c,index:u})).sort((c,u)=>c.x-u.x),o=[],l=new Array(t.length).fill(0),i=[],r=e*2,a=s-e;for(const{x:c,index:u}of n){const x=[];for(let h=o.length-1;h>=0&&c-o[h].x<r;h--)x.push(o[h]);const f=h=>x.every(M=>(M.x-c)**2+(M.y-h)**2>=r*r-1e-6);let d=0;for(let h=0;!f(d);h++){const M=Math.ceil((h+1)/2)*(e/2);if(M>a){d=null;break}d=h%2?M:-M}if(l[u]=d,d===null){const h=i[i.length-1];h&&c-h.x<r?h.count++:i.push({x:c,count:1})}else o.push({x:c,y:d})}return{ys:l,hidden:i}}function F(t){const s=t.reduce((r,a)=>r+a,0);if(!s)return t.map(()=>0);const n=t.map(r=>r/s*100),o=n.map(Math.floor);let l=100-o.reduce((r,a)=>r+a,0);const i=n.map((r,a)=>({index:a,rest:r-o[a]})).sort((r,a)=>a.rest-r.rest||r.index-a.index);for(const{index:r}of i){if(!l)break;o[r]++,l--}for(let r=0;r<t.length;r++)if(t[r]>0&&o[r]===0){const a=o.indexOf(Math.max(...o));o[a]--,o[r]=1}return o}function I(t){const e=t.reduce((n,o)=>n+o,0),s=t.some(n=>n/e*360<6)?Math.min(6,360/t.length):0;return t.map(n=>s+n/e*(360-t.length*s))}function L(t,e){return t<=0||e<=0?0:Math.max(1,Math.ceil(t/e*5))}const y=[10,30,60,120,300,600,900,1800,3600,7200,21600,43200,86400,172800,604800,2592e3].map(t=>t*1e3);function X(t,e,s=24){const n=i=>Math.floor(e/i)-Math.floor(t/i)+1;let o=y.find(i=>n(i)<=s);o===void 0&&(o=Math.ceil((e-t)/(s-1)/y[y.length-1])*y[y.length-1]);const l=[];for(let i=Math.floor(t/o)*o;i<=e;i+=o)l.push(i);return l}function Y(t,e){return Math.log10(1+Math.max(0,Math.min(t,e)))/Math.log10(1+e)}function v(t){const e=Math.max(1e3,t*2),s=[0];for(let n=1e3;n<=e;n*=1e3)s.push(n);return{enLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
import{h as t,cQ as l}from"./index-BNBwb-FJ.js";const a=(n,e)=>`${n}:${e}`;function o(n,e){const r=n.indexOf(":"),s=n.slice(0,r);return r>0&&e.includes(s)?{kind:s,value:n.slice(r+1)}:null}const i=(n,e)=>e&&n?t("rules",{tab:"list",rule:n}):void 0;function c(n,e=l){return n?o(n,e):null}function d(n,e="list"){return t("rules",{tab:e,add:a(n.kind,n.value)})}export{o as a,d as b,c as p,i as r,a as t};
|
||||
@@ -1 +0,0 @@
|
||||
import{h as s,cJ as a}from"./index-CXHBmSa5.js";const n=(e,t)=>`${e}:${t}`;function i(e,t){const l=e.indexOf(":"),o=e.slice(0,l);return l>0&&t.includes(o)?{kind:o,value:e.slice(l+1)}:null}const r={kernel:"flow.v.kernel",userspace:"flow.v.userspace",matched:"flow.v.matched",other_family_trusted:"flow.v.otherFamilyTrusted",failed:"flow.v.failed",not_required:"flow.v.notRequired",unavailable:"flow.v.unavailable",pass:"flow.v.pass",redirect:"flow.v.redirect",hold:"flow.v.hold",arm_direct:"flow.v.armDirect",activate_direct:"flow.v.activateDirect",activate_proxy:"flow.v.activateProxy",drop:"flow.v.drop",started:"flow.v.started",succeeded:"flow.v.succeeded",cancelled:"flow.v.cancelled",transport_ready:"flow.v.transportReady",target_request_sent:"flow.v.targetRequestSent",target_confirmed:"flow.v.targetConfirmed",first_reply:"flow.v.firstReply",terminal:"flow.v.terminal",unknown:"ui.unknown",route_selected:"flow.v.routeSelected",no_new_routing_input:"flow.v.noNewRoutingInput",reply_received:"flow.v.replyReceived",hit:"flow.v.hit",miss:"flow.v.miss",stale:"flow.v.stale",bypass:"flow.v.bypass",hosts:"flow.v.hosts",coalesced:"flow.v.coalesced",cache:"flow.v.cache",upstream:"ui.upstream",lan:"flow.v.lan",wan:"flow.v.wan",tls_sni:"flow.v.tlsSni",http_host:"flow.v.httpHost",quic_sni:"flow.v.quicSni",dns_mapping:"flow.v.dnsMapping",explicit:"flow.v.explicit"},c=e=>e==null?"—":r[e]?{key:r[e]}:e,w=(e,t)=>t&&e?s("rules",{tab:"list",rule:e}):void 0;function d(e){return e?i(e,a):null}function v(e){return s("rules",{tab:"list",add:n(e.kind,e.value)})}export{i as a,v as b,d as p,w as r,n as t,c as w};
|
||||
@@ -1 +0,0 @@
|
||||
const e={"act.noOutbounds":"This backend does not provide outbound counters","act.noConnections":"This backend does not provide connections","act.emptyHistory":"No history samples yet","act.historyRange":"History range","act.noHistory":"This backend does not provide history","act.unknown":"Unknown","act.latency":"Latency","act.upload":"Upload","act.download":"Download","act.active":"Active connections","act.memory":"Memory","act.sampling":"Sampling","act.rss":"Resident memory","act.cgroup":"cgroup used","act.truncated":"Truncated","act.memoryOk":"Normal","act.memoryHigh":"High","act.memoryNearLimit":"Near limit","act.traffic":"Traffic","act.viewDetails":"View details","act.limited":{one:"{n} feature is off",other:"{n} features are off"},"act.mode":"Outbound mode","act.global":"Global target","mode.rule":"Rule","mode.direct":"Direct","mode.global":"Global","act.modeApplied":"Outbound mode written to the configuration and reloaded: {mode}","act.modeNoRouting":"The main configuration has no routing section","act.modeInterleaved":"An ordinary rule comes before a must rule in the routing block. Move the must rules to the top of the routing block, then change the outbound mode.","act.modeReadOnly":"Read-only","act.modeWhyReadOnly":"Why is the mode read-only?","act.modeReadOnlyReason":"honk requires configuration writes and authenticated control. It marks the main source read-only if it contains a secret field or nested block in native_api or clash_api, or an active listener secret.","act.modeReadOnlyAction":"Make the main file writable by honk and keep native_api in its own include file.","act.readOnlyDocs":"Read-only sources","act.modeUnavailable":"Not provided by this backend","act.globalMissing":"Global mode needs a target group","act.viewAll":"View all","act.noticeRepeat":{one:"{n} time",other:"{n} times"},"act.since":"Since {t}","act.good":"Good","act.live":"Live","act.m10":"10 min","act.h1":"1 h","act.h6":"6 h","act.h24":"24 h","act.outUsage":"Outbound downloads","act.topDevices":"Top traffic","act.devices":"Devices","act.domains":"Domains","act.node":"Node","act.issues":"Notifications","act.noIssues":"No issues require attention","act.unavailable":"Unavailable","act.d7":"7 d","act.rankingScope":"Ranked by download totals for visible connections. Shares use all visible data.","act.rankingTruncated":"The connection list is truncated. Rankings cover only the retrieved data.","act.rankingEmpty":"No connections to rank","config.tabModules":"Modules","config.moduleOpen":"Open page","config.moduleManual":"Edit by hand","config.moduleManualTip":"Open the whole file in the Sources tab at this section","config.moduleAbsent":"Section not configured; add it to {file}.","config.moduleAbsentReadOnly":"Section not configured.","config.moduleSettings":{one:"{n} setting",other:"{n} settings"},"config.moduleSubscriptions":{one:"{n} subscription",other:"{n} subscriptions"},"config.moduleNodes":{one:"{n} node",other:"{n} nodes"},"config.moduleGroups":{one:"{n} group: {policies}",other:"{n} groups: {policies}"},"config.moduleDnsUpstreams":{one:"{n} upstream",other:"{n} upstreams"},"config.wizardPresetHelp":"All templates first connect NetworkManager, private-address and multicast traffic directly, then block remaining UDP/443 traffic. All except Global proxy also block advertisements.","config.wizardListenerPort":"Transparent proxy port","config.wizardDefaultDns":"Default DNS upstream","config.wizardChinaDns":"Mainland-China domain DNS upstream","config.wizardNetworkError":"Enter a port from 1 to 65535 and both DNS upstreams.","config.moduleDnsRequests":{one:"{n} request rule",other:"{n} request rules"},"config.moduleDnsResponses":{one:"{n} response rule",other:"{n} response rules"},"config.moduleRules":{one:"{n} rule",other:"{n} rules"},"config.generation":"Generation","config.generationHelp":"The number of the active configuration's generation. A reload that changes the active configuration starts a new generation; a reload that leaves the content unchanged keeps the current one.","config.saveValidating":"Validating…","config.revision":"Revision","config.errors":{one:"{n} error",other:"{n} errors"},"config.warnings":{one:"{n} warning",other:"{n} warnings"},"config.clean":"No diagnostics","config.redacted":"Listener secret values are redacted","config.readOnly":"Read-only","config.readOnlyHelp":"The backend does not allow configuration writes. On honk, enable experimental.native_api.config_write and set a secret or password sign-in.","config.secretSource":"Contains secrets","config.redactedSource":"Redacted","config.withheldSource":"Text not returned","config.readOnlyAttempt":"This file is read-only","config.kind.main":"Main","config.kind.include":"Include","config.kind.subscription":"Subscription","config.kind.generated":"Generated","config.validate":"Validate","config.edit":"Edit","config.save":"Apply and reload","config.noChanges":"No changes to apply","config.saveConflict":"Keep or discard your changes first","config.wLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
const e=JSON.parse(`{"about.api":"API","about.close":"Close","about.contract":"Contract commit","about.credits":"Fonts Noto Sans TC/SC (OFL); icons Adobe Spectrum (Apache-2.0); palettes from Rosé Pine, Catppuccin, Nord, Kary Pro Colors, Ant Design, Arco Design and Semi Design.","about.duck":"Pet me","about.engine":"Engine","about.license":"License","about.privacy":"doona talks only to the backend you connect it to. It collects no data and sends nothing anywhere else.","about.quack":"Honk!","about.tagline":"Web UI for {engine}","about.title":"About doona","act.active":"Active connections","act.cgroup":"cgroup used","act.d7":"7 d","act.devices":"Devices","act.domains":"Domains","act.download":"Download","act.emptyHistory":"No history samples yet","act.global":"Global target","act.globalMissing":"Global mode needs a target group","act.good":"Good","act.h1":"1 h","act.h24":"24 h","act.h6":"6 h","act.historyRange":"History range","act.issues":"Notifications","act.latency":"Latency","act.limited":{"one":"{n} feature is off","other":"{n} features are off"},"act.live":"Live","act.m10":"10 min","act.memory":"Memory","act.memoryHigh":"High","act.memoryNearLimit":"Near limit","act.memoryOk":"Normal","act.mode":"Outbound mode","act.modeApplied":"Outbound mode written to the configuration and reloaded: {mode}","act.modeInterleaved":"An ordinary rule comes before a must rule in the routing block. Move the must rules to the top of the routing block, then change the outbound mode.","act.modeNoRouting":"The main configuration has no routing section","act.modeReadOnly":"Read-only","act.modeReadOnlyAction":"Make the main file writable by honk and keep native_api in its own include file.","act.modeReadOnlyReason":"honk requires configuration writes and authenticated control. It marks the main source read-only if it contains a secret field or nested block in native_api or clash_api, or an active listener secret.","act.modeUnavailable":"Not provided by this backend","act.modeWhyReadOnly":"Why is the mode read-only?","act.noConnections":"This backend does not provide connections","act.noHistory":"This backend does not provide history","act.noIssues":"No issues require attention","act.noOutbounds":"This backend does not provide outbound counters","act.node":"Node","act.noticeRepeat":{"one":"{n} time","other":"{n} times"},"act.outUsage":"Outbound downloads","act.rankingEmpty":"No connections to rank","act.rankingScope":"Ranked by download totals for visible connections. Shares use all visible data.","act.rankingTruncated":"The connection list is truncated. Rankings cover only the retrieved data.","act.readOnlyDocs":"Read-only sources","act.rss":"Resident memory","act.sampling":"Sampling","act.since":"Since {t}","act.topDevices":"Top traffic","act.traffic":"Traffic","act.truncated":"Truncated","act.unavailable":"Unavailable","act.unknown":"Unknown","act.upload":"Upload","act.viewAll":"View all","act.viewDetails":"View details","arrange.addSelected":"Add to group","arrange.applied":{"one":"Applied {n} change and reloaded.","other":"Applied {n} changes and reloaded."},"arrange.applyNote":"Applying validates the whole configuration first, then writes and reloads; nothing is written if validation fails.","arrange.badName":"Use only letters, digits, underscores, periods and hyphens.","arrange.byName":"Nodes added by name","arrange.byRule":"Selected by rules","arrange.bySubscription":"Whole subscriptions","arrange.change.addNode":"Add node {name} to {group}","arrange.change.addSubscription":"Add the whole subscription {name} to {group}","arrange.change.createGroup":"Create group {group}","arrange.change.removeNode":"Remove node {name} from {group}","arrange.change.removeSubscription":"Remove subscription {name} from {group}","arrange.clear":"Clear selection","arrange.create":"Create","arrange.discard":"Discard all","arrange.drag":"Drag {name}","arrange.dropHint":"Drop here to add","arrange.dropInto":"Drop into group {group}","arrange.editSource":"Change them in the configuration source","arrange.emptyNew":"Group {group} has no members yet; a group without members holds every node, so add a node or subscription first.","arrange.failed":"Could not apply: {error}","arrange.groupName":"Group name","arrange.groupNameHint":"Letters, digits, underscores, periods and hyphens only.","arrange.holdsAll":"This group has no filter, so it holds every node.","arrange.lastMember":"This is the group's last filter; removing it would make the group hold every node.","arrange.memberCount":{"one":"{n} node","other":"{n} nodes"},"arrange.new":"New","arrange.newGroup":"New group","arrange.newGroupNote":"Add at least one node or subscription after creating it; a group with no members holds every node, so it cannot be applied.","arrange.noMain":"The main configuration is not fully available, so it cannot be arranged here.","arrange.nodes":"Nodes","arrange.note":"Drag a node or subscription from the right onto a group to add it, or select rows and use Add to gro
Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
const e={"act.noOutbounds":"此后端不提供出站统计","act.noConnections":"此后端不提供连接","act.emptyHistory":"暂无历史样本","act.historyRange":"历史范围","act.noHistory":"此后端不提供历史数据","act.unknown":"未知","act.latency":"延迟","act.upload":"上传","act.download":"下载","act.active":"活动连接","act.memory":"内存","act.sampling":"采样中","act.rss":"常驻内存","act.cgroup":"cgroup 已用","act.truncated":"已截断","act.memoryOk":"正常","act.memoryHigh":"偏高","act.memoryNearLimit":"接近上限","act.traffic":"流量","act.viewDetails":"查看详情","act.limited":"{n} 项功能未开启","act.mode":"出站模式","act.global":"全局目标","mode.rule":"规则","mode.direct":"直连","mode.global":"全局","act.modeApplied":"出站模式已写入配置并重载:{mode}","act.modeNoRouting":"主配置未包含 routing 区段","act.modeInterleaved":"路由区段有普通规则排在 must 规则前面。请先把 must 规则移到路由区段最前面,再切换出站模式。","act.modeReadOnly":"只读","act.modeWhyReadOnly":"查看只读原因","act.modeReadOnlyReason":"honk 须允许配置写入,且控制端已设置身份验证。主配置若含 native_api 或 clash_api 的密钥字段或嵌套区块,会标记为只读。配置含当前的监听密钥时也一样。","act.modeReadOnlyAction":"请确认 honk 对主配置文件有写入权限,并将 native_api 设置放在独立的 include 文件。","act.readOnlyDocs":"只读的配置文件","act.modeUnavailable":"此后端不提供","act.globalMissing":"全局模式须指定目标组","act.viewAll":"查看全部","act.noticeRepeat":"重复 {n} 次","act.since":"自 {t} 起","act.good":"良好","act.live":"实时","act.m10":"10 分钟","act.h1":"1 小时","act.h6":"6 小时","act.h24":"24 小时","act.outUsage":"出站下载量","act.topDevices":"流量排行","act.devices":"设备","act.domains":"域名","act.node":"节点","act.issues":"通知与问题","act.noIssues":"当前没有需要处理的问题","act.unavailable":"不可用","act.d7":"7 天","act.rankingScope":"按当前可见连接的下载量排序,占比以全部可见数据计算。","act.rankingTruncated":"连接列表已截断,排行仅涵盖已获取的数据。","act.rankingEmpty":"当前没有可排行的连接","config.tabModules":"模块","config.moduleOpen":"打开页面","config.moduleManual":"手动编辑","config.moduleManualTip":"在来源标签页打开整个文件,光标位于此区段","config.moduleAbsent":"未设置此区段;可加入 {file}。","config.moduleAbsentReadOnly":"未设置此区段。","config.moduleSettings":"{n} 项设置","config.moduleSubscriptions":"{n} 个订阅","config.moduleNodes":"{n} 个节点","config.moduleGroups":"{n} 个组:{policies}","config.moduleDnsUpstreams":"{n} 个上游","config.wizardPresetHelp":"所有模板先让 NetworkManager、私有地址及多播流量直接连接,再屏蔽其余 UDP/443 流量。除全局代理外,其他模板也屏蔽广告。","config.wizardListenerPort":"透明代理端口","config.wizardDefaultDns":"默认 DNS 上游","config.wizardChinaDns":"中国大陆域名 DNS 上游","config.wizardNetworkError":"端口须介于 1 至 65535,两个 DNS 上游均须填写。","config.moduleDnsRequests":"{n} 条请求规则","config.moduleDnsResponses":"{n} 条响应规则","config.moduleRules":"{n} 条规则","config.generation":"生效代次","config.generationHelp":"生效配置的代次编号。重载使生效配置改变时会产生新代次,内容未变的重载保持原代次。","config.saveValidating":"正在验证…","config.revision":"配置修订","config.errors":"{n} 个错误","config.warnings":"{n} 个警告","config.clean":"没有诊断","config.redacted":"后端已脱敏监听密钥的值","config.readOnly":"只读","config.readOnlyHelp":"后端未开放写入配置。honk 须启用 experimental.native_api.config_write,并设置密钥或密码登录。","config.secretSource":"含密钥","config.redactedSource":"内容已脱敏","config.withheldSource":"未返回内容","config.readOnlyAttempt":"此文件只读","config.kind.main":"主配置","config.kind.include":"引入文件","config.kind.subscription":"订阅","config.kind.generated":"引擎生成","config.validate":"校验","config.edit":"编辑","config.save":"应用并重载","config.noChanges":"没有要应用的修改","config.saveConflict":"须先保留或放弃修改","config.wizardSubsInvalid":"每个订阅都须有不重复的名称和 HTTP 或 HTTPS 网址","config.validateNoMain":"后端未返回完整的主配置,因此无法校验","config.validateOther":"校验只涵盖主配置及其引入文件,不含此文件","config.incomplete":"内容不完整或已脱敏,不能在此编辑","config.moduleEditBlocked":"另一个区段有未保存的修改,须先应用或取消","config.unquotable":"无法写入:值含单引号、换行或结尾反Line truncated
|
||||
@@ -0,0 +1 @@
|
||||
const e=JSON.parse('{"about.api":"API","about.close":"关闭","about.contract":"契约提交","about.credits":"字体 Noto Sans TC/SC(OFL);图标 Adobe Spectrum(Apache-2.0);配色来自 Rosé Pine、Catppuccin、Nord、Kary Pro Colors、Ant Design、Arco Design 与 Semi Design。","about.duck":"摸摸我","about.engine":"引擎","about.license":"许可证","about.privacy":"doona 只与你连接的后端通信,不收集数据,也不发送到其他地方。","about.quack":"嘎!","about.tagline":"{engine} 的 Web 界面","about.title":"关于 doona","act.active":"活动连接","act.cgroup":"cgroup 已用","act.d7":"7 天","act.devices":"设备","act.domains":"域名","act.download":"下载","act.emptyHistory":"暂无历史样本","act.global":"全局目标","act.globalMissing":"全局模式须指定目标组","act.good":"良好","act.h1":"1 小时","act.h24":"24 小时","act.h6":"6 小时","act.historyRange":"历史范围","act.issues":"通知与问题","act.latency":"延迟","act.limited":"{n} 项功能未开启","act.live":"实时","act.m10":"10 分钟","act.memory":"内存","act.memoryHigh":"偏高","act.memoryNearLimit":"接近上限","act.memoryOk":"正常","act.mode":"出站模式","act.modeApplied":"出站模式已写入配置并重载:{mode}","act.modeInterleaved":"路由区段有普通规则排在 must 规则前面。请先把 must 规则移到路由区段最前面,再切换出站模式。","act.modeNoRouting":"主配置未包含 routing 区段","act.modeReadOnly":"只读","act.modeReadOnlyAction":"请确认 honk 对主配置文件有写入权限,并将 native_api 设置放在独立的 include 文件。","act.modeReadOnlyReason":"honk 须允许配置写入,且控制端已设置身份验证。主配置若含 native_api 或 clash_api 的密钥字段或嵌套区块,会标记为只读。配置含当前的监听密钥时也一样。","act.modeUnavailable":"此后端不提供","act.modeWhyReadOnly":"查看只读原因","act.noConnections":"此后端不提供连接","act.noHistory":"此后端不提供历史数据","act.noIssues":"当前没有需要处理的问题","act.noOutbounds":"此后端不提供出站统计","act.node":"节点","act.noticeRepeat":"重复 {n} 次","act.outUsage":"出站下载量","act.rankingEmpty":"当前没有可排行的连接","act.rankingScope":"按当前可见连接的下载量排序,占比以全部可见数据计算。","act.rankingTruncated":"连接列表已截断,排行仅涵盖已获取的数据。","act.readOnlyDocs":"只读的配置文件","act.rss":"常驻内存","act.sampling":"采样中","act.since":"自 {t} 起","act.topDevices":"流量排行","act.traffic":"流量","act.truncated":"已截断","act.unavailable":"不可用","act.unknown":"未知","act.upload":"上传","act.viewAll":"查看全部","act.viewDetails":"查看详情","arrange.addSelected":"加入组","arrange.applied":"已应用 {n} 项更改并重载。","arrange.applyNote":"应用时会先校验整份配置,写入后重载;校验失败时不会写入。","arrange.badName":"名称只能使用英文字母、数字、下划线、句点和连字符。","arrange.byName":"按名称加入的节点","arrange.byRule":"由规则选入","arrange.bySubscription":"整个订阅","arrange.change.addNode":"将节点 {name} 加入 {group}","arrange.change.addSubscription":"将订阅 {name} 整个加入 {group}","arrange.change.createGroup":"创建组 {group}","arrange.change.removeNode":"从 {group} 移除节点 {name}","arrange.change.removeSubscription":"从 {group} 移除订阅 {name}","arrange.clear":"清除选择","arrange.create":"创建","arrange.discard":"全部放弃","arrange.drag":"拖动 {name}","arrange.dropHint":"拖动至此加入","arrange.dropInto":"拖放到组 {group}","arrange.editSource":"在配置来源中修改","arrange.emptyNew":"组 {group} 尚无成员;没有成员的组会包含所有节点,请先加入节点或订阅。","arrange.failed":"无法应用:{error}","arrange.groupName":"组名称","arrange.groupNameHint":"只能使用英文字母、数字、下划线、句点和连字符。","arrange.holdsAll":"此组没有任何筛选条件,因此包含所有节点。","arrange.lastMember":"此为组的最后一个条件;移除后组会包含所有节点。","arrange.memberCount":"{n} 个节点","arrange.new":"新建","arrange.newGroup":"新建组","arrange.newGroupNote":"创建后请加入至少一个节点或订阅;没有成员的组会包含所有节点,因此无法应用。","arrange.noMain":"主配置的内容未完整提供,无法在此编排。","arrange.nodes":"节点","arrange.note":"将右侧的节点或订阅拖动至组即可加入,也可勾选后使用下方的“加入组”。更改会先暂存,点击“检查并应用”后一次写入。","arrange.pending":"{n} 项更改尚未应用","arrange.pendingRegion":"待应用的更改","arrange.policy":"选择方式","arrange.policy.fallback":"按顺序备用","arrange.policy.fallbackLine truncated
|
||||
@@ -0,0 +1 @@
|
||||
const e=JSON.parse('{"about.api":"API","about.close":"關閉","about.contract":"契約提交","about.credits":"字型 Noto Sans TC/SC(OFL);圖示 Adobe Spectrum(Apache-2.0);配色來自 Rosé Pine、Catppuccin、Nord、Kary Pro Colors、Ant Design、Arco Design 與 Semi Design。","about.duck":"摸摸我","about.engine":"引擎","about.license":"授權","about.privacy":"doona 只與你連線的後端通訊,不收集資料,也不傳送到其他地方。","about.quack":"嘎!","about.tagline":"{engine} 的 Web 介面","about.title":"關於 doona","act.active":"活動連線","act.cgroup":"cgroup 已用","act.d7":"7 天","act.devices":"裝置","act.domains":"網域","act.download":"下載","act.emptyHistory":"尚無歷史樣本","act.global":"全域目標","act.globalMissing":"全域模式須指定目標群組","act.good":"良好","act.h1":"1 小時","act.h24":"24 小時","act.h6":"6 小時","act.historyRange":"歷史範圍","act.issues":"通知與問題","act.latency":"延遲","act.limited":"{n} 項功能未開啟","act.live":"即時","act.m10":"10 分鐘","act.memory":"記憶體","act.memoryHigh":"偏高","act.memoryNearLimit":"接近上限","act.memoryOk":"正常","act.mode":"出站模式","act.modeApplied":"出站模式已寫入組態並重載:{mode}","act.modeInterleaved":"路由區段有一般規則排在 must 規則前面。請先把 must 規則移到路由區段最前面,再切換出站模式。","act.modeNoRouting":"主組態未包含 routing 區段","act.modeReadOnly":"唯讀","act.modeReadOnlyAction":"請確認 honk 對主組態檔案有寫入權限,並將 native_api 設定放在獨立的 include 檔案。","act.modeReadOnlyReason":"honk 須允許組態寫入,且控制端已設定驗證。主組態若含 native_api 或 clash_api 的密鑰欄位或巢狀區塊,會標記為唯讀。組態含目前的監聽密鑰時也一樣。","act.modeUnavailable":"此後端不提供","act.modeWhyReadOnly":"查看唯讀原因","act.noConnections":"此後端不提供連線","act.noHistory":"此後端不提供歷史資料","act.noIssues":"目前沒有需要處理的問題","act.noOutbounds":"此後端不提供出站統計","act.node":"節點","act.noticeRepeat":"重複 {n} 次","act.outUsage":"出站下載量","act.rankingEmpty":"目前沒有可排行的連線","act.rankingScope":"依目前可見連線的下載量排序,佔比以全部可見資料計算。","act.rankingTruncated":"連線清單已截斷,排行僅涵蓋已取得的資料。","act.readOnlyDocs":"唯讀的組態檔案","act.rss":"常駐記憶體","act.sampling":"取樣中","act.since":"自 {t} 起","act.topDevices":"流量排行","act.traffic":"流量","act.truncated":"已截斷","act.unavailable":"無法使用","act.unknown":"未知","act.upload":"上傳","act.viewAll":"查看全部","act.viewDetails":"查看詳情","arrange.addSelected":"加入群組","arrange.applied":"已套用 {n} 項變更並重載。","arrange.applyNote":"套用時會先驗證整份組態,寫入後重載;驗證失敗時不會寫入。","arrange.badName":"名稱只能使用英文字母、數字、底線、句點與連字號。","arrange.byName":"依名稱加入的節點","arrange.byRule":"由規則選入","arrange.bySubscription":"整個訂閱","arrange.change.addNode":"將節點 {name} 加入 {group}","arrange.change.addSubscription":"將訂閱 {name} 整個加入 {group}","arrange.change.createGroup":"建立群組 {group}","arrange.change.removeNode":"從 {group} 移除節點 {name}","arrange.change.removeSubscription":"從 {group} 移除訂閱 {name}","arrange.clear":"清除選取","arrange.create":"建立","arrange.discard":"全部捨棄","arrange.drag":"拖曳 {name}","arrange.dropHint":"拖曳至此加入","arrange.dropInto":"拖放到群組 {group}","arrange.editSource":"在組態來源中修改","arrange.emptyNew":"群組 {group} 尚無成員;沒有成員的群組會包含所有節點,請先加入節點或訂閱。","arrange.failed":"無法套用:{error}","arrange.groupName":"群組名稱","arrange.groupNameHint":"只能使用英文字母、數字、底線、句點與連字號。","arrange.holdsAll":"此群組沒有任何篩選條件,因此包含所有節點。","arrange.lastMember":"此為群組的最後一個條件;移除後群組會包含所有節點。","arrange.memberCount":"{n} 個節點","arrange.new":"新增","arrange.newGroup":"新增群組","arrange.newGroupNote":"建立後請加入至少一個節點或訂閱;沒有成員的群組會包含所有節點,因此無法套用。","arrange.noMain":"主組態的內容未完整提供,無法在此編排。","arrange.nodes":"節點","arrange.note":"將右側的節點或訂閱拖曳至群組即可加入,亦可勾選後使用下方的「加入群組」。變更會先暫存,按「檢查並套用」後一次寫入。","arrange.pending":"{n} 項變更尚未套用","arrange.pendingRegion":"待套用的變更","arrange.policy":"選擇方式","arrange.policy.fallback":"依序Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
const e={"act.noOutbounds":"此後端不提供出站統計","act.noConnections":"此後端不提供連線","act.emptyHistory":"尚無歷史樣本","act.historyRange":"歷史範圍","act.noHistory":"此後端不提供歷史資料","act.unknown":"未知","act.latency":"延遲","act.upload":"上傳","act.download":"下載","act.active":"活動連線","act.memory":"記憶體","act.sampling":"取樣中","act.rss":"常駐記憶體","act.cgroup":"cgroup 已用","act.truncated":"已截斷","act.memoryOk":"正常","act.memoryHigh":"偏高","act.memoryNearLimit":"接近上限","act.traffic":"流量","act.viewDetails":"查看詳情","act.limited":"{n} 項功能未開啟","act.mode":"出站模式","act.global":"全域目標","mode.rule":"規則","mode.direct":"直連","mode.global":"全域","act.modeApplied":"出站模式已寫入組態並重載:{mode}","act.modeNoRouting":"主組態未包含 routing 區段","act.modeInterleaved":"路由區段有一般規則排在 must 規則前面。請先把 must 規則移到路由區段最前面,再切換出站模式。","act.modeReadOnly":"唯讀","act.modeWhyReadOnly":"查看唯讀原因","act.modeReadOnlyReason":"honk 須允許組態寫入,且控制端已設定驗證。主組態若含 native_api 或 clash_api 的密鑰欄位或巢狀區塊,會標記為唯讀。組態含目前的監聽密鑰時也一樣。","act.modeReadOnlyAction":"請確認 honk 對主組態檔案有寫入權限,並將 native_api 設定放在獨立的 include 檔案。","act.readOnlyDocs":"唯讀的組態檔案","act.modeUnavailable":"此後端不提供","act.globalMissing":"全域模式須指定目標群組","act.viewAll":"查看全部","act.noticeRepeat":"重複 {n} 次","act.since":"自 {t} 起","act.good":"良好","act.live":"即時","act.m10":"10 分鐘","act.h1":"1 小時","act.h6":"6 小時","act.h24":"24 小時","act.outUsage":"出站下載量","act.topDevices":"流量排行","act.devices":"裝置","act.domains":"網域","act.node":"節點","act.issues":"通知與問題","act.noIssues":"目前沒有需要處理的問題","act.unavailable":"無法使用","act.d7":"7 天","act.rankingScope":"依目前可見連線的下載量排序,佔比以全部可見資料計算。","act.rankingTruncated":"連線清單已截斷,排行僅涵蓋已取得的資料。","act.rankingEmpty":"目前沒有可排行的連線","config.tabModules":"模組","config.moduleOpen":"開啟頁面","config.moduleManual":"手動編輯","config.moduleManualTip":"在來源分頁開啟整個檔案,游標位於此區段","config.moduleAbsent":"未設定此區段;可加入 {file}。","config.moduleAbsentReadOnly":"未設定此區段。","config.moduleSettings":"{n} 項設定","config.moduleSubscriptions":"{n} 個訂閱","config.moduleNodes":"{n} 個節點","config.moduleGroups":"{n} 個群組:{policies}","config.moduleDnsUpstreams":"{n} 個上游","config.wizardPresetHelp":"所有範本先讓 NetworkManager、私有位址及多播流量直接連線,再封鎖其餘 UDP/443 流量。除全域代理外,其他範本亦封鎖廣告。","config.wizardListenerPort":"透明代理連接埠","config.wizardDefaultDns":"預設 DNS 上游","config.wizardChinaDns":"中國大陸網域 DNS 上游","config.wizardNetworkError":"連接埠須介於 1 至 65535,兩個 DNS 上游均須填寫。","config.moduleDnsRequests":"{n} 條請求規則","config.moduleDnsResponses":"{n} 條回應規則","config.moduleRules":"{n} 條規則","config.generation":"生效代次","config.generationHelp":"生效組態的代次編號。重載使生效組態改變時會產生新代次,內容未變的重載維持原代次。","config.saveValidating":"正在驗證…","config.revision":"組態修訂","config.errors":"{n} 個錯誤","config.warnings":"{n} 個警告","config.clean":"沒有診斷","config.redacted":"後端已遮蔽監聽密鑰的值","config.readOnly":"唯讀","config.readOnlyHelp":"後端未開放寫入組態。honk 須啟用 experimental.native_api.config_write,並設定密鑰或密碼登入。","config.secretSource":"含密鑰","config.redactedSource":"內容已遮蔽","config.withheldSource":"未回傳內容","config.readOnlyAttempt":"此檔案唯讀","config.kind.main":"主組態","config.kind.include":"引入檔","config.kind.subscription":"訂閱","config.kind.generated":"引擎產生","config.validate":"驗證","config.edit":"編輯","config.save":"套用並重載","config.noChanges":"沒有要套用的修改","config.saveConflict":"須先保留或放棄修改","config.wizardSubsInvalid":"每個訂閱都須有不重複的名稱與 HTTP 或 HTTPS 網址","config.validateNoMain":"後端未回傳完整的主組態,因此無法驗證","config.validateOther":"驗證只涵蓋主組態與其引入檔,不含此檔案","config.incomplete":"內容不完整或已遮蔽,不能在此編輯","config.moduleEditBlocked":"另一個區段有未儲存的修改,須先套用或取消","config.unquotable":"無法寫入:值含單引號、換行或結Line truncated
|
||||
@@ -1 +0,0 @@
|
||||
const i=[{id:"backend",titleKey:"settings.backend"},{id:"runtime",titleKey:"settings.runtime"},{id:"geodata",titleKey:"settings.geodata"},{id:"actions",titleKey:"settings.actions"},{id:"appearance",titleKey:"settings.appearance"},{id:"about",titleKey:"settings.about"}],s=t=>i.filter(e=>e.id!=="geodata"||n(t)),a=t=>`settings-${t}`;function d(t){return{headingId:a(t),titleKey:i.find(e=>e.id===t).titleKey}}function n(t){return t?.geodata.available===!0&&t.geodata.configurable_sources===!0&&t.runtime_settings.available&&(t.runtime_settings.fields??[]).includes("geodata")}export{d as a,a as c,n as g,s};
|
||||
@@ -1 +0,0 @@
|
||||
import{a7 as e}from"./index-CXHBmSa5.js";function d(t){return[...e(t,"dns_log",{whileLoading:!0})?[{id:"stats",titleKey:"dns.tab.stats"}]:[],...e(t,"dns_log",{whileLoading:!0})?[{id:"log",titleKey:"dns.log"}]:[],...e(t,"dns_query",{whileLoading:!0})?[{id:"query",titleKey:"dns.query"}]:[],...e(t,"dns_cache",{whileLoading:!0})?[{id:"cache",titleKey:"ui.cache"}]:[]]}export{d};
|
||||
@@ -1 +0,0 @@
|
||||
import{a7 as l}from"./index-CXHBmSa5.js";function a(e){const t=l(e,"flows",{whileLoading:!0}),i=l(e,"rules",{whileLoading:!1});return[...t?[{id:"map",titleKey:"rule.map"}]:[],...t||i?[{id:"list",titleKey:"rule.listTitle"}]:[],...t?[{id:"flows",titleKey:"rule.flows"}]:[],...l(e,"routing_trace",{whileLoading:!0})?[{id:"trace",titleKey:"rule.trace"}]:[]]}export{a as r};
|
||||
@@ -0,0 +1 @@
|
||||
const a=[{id:"backend",titleKey:"settings.backend"},{id:"runtime",titleKey:"settings.runtime"},{id:"geodata",titleKey:"settings.geodata"},{id:"appearance",titleKey:"settings.appearance"},{id:"actions",titleKey:"settings.actions"},{id:"about",titleKey:"settings.about"}],s=t=>a.filter(e=>e.id!=="geodata"||n(t)),i=t=>`settings-${t}`;function d(t){return{headingId:i(t),titleKey:a.find(e=>e.id===t).titleKey}}function n(t){return t?.geodata.available===!0&&t.geodata.configurable_sources===!0&&t.runtime_settings.available&&(t.runtime_settings.fields??[]).includes("geodata")}export{d as a,a as b,i as c,n as g,s};
|
||||
@@ -0,0 +1 @@
|
||||
import{aa as l}from"./index-BNBwb-FJ.js";function r(e){const t=l(e,"flows",{whileLoading:!0}),i=l(e,"rules",{whileLoading:!1});return[...t||i?[{id:"list",titleKey:"rule.listTitle"}]:[],...l(e,"dns_rules",{whileLoading:!1})?[{id:"dns",titleKey:"rule.dnsTitle"}]:[],...t?[{id:"map",titleKey:"rule.map"}]:[],...t?[{id:"flows",titleKey:"rule.flows"}]:[],...l(e,"routing_trace",{whileLoading:!0})?[{id:"trace",titleKey:"rule.trace"}]:[]]}export{r};
|
||||
@@ -0,0 +1 @@
|
||||
import{aa as e}from"./index-BNBwb-FJ.js";function d(t){return[...e(t,"dns_log",{whileLoading:!0})?[{id:"stats",titleKey:"dns.tab.stats"}]:[],...e(t,"dns_log",{whileLoading:!0})?[{id:"log",titleKey:"dns.log"}]:[],...e(t,"dns_cache",{whileLoading:!0})?[{id:"cache",titleKey:"ui.cache"}]:[],...e(t,"dns_query",{whileLoading:!0})?[{id:"query",titleKey:"dns.query"}]:[]]}export{d};
|
||||
@@ -1 +1 @@
|
||||
import{r as t}from"./vendor-react-Bf71BWbF.js";import{a5 as u,a9 as d,a7 as r,a8 as n}from"./index-CXHBmSa5.js";function m(){const s=u().data?.resources,e=d(r(s,"groups",{whileLoading:!1})),o=n(r(s,"nodes",{whileLoading:!1}));return t.useMemo(()=>new Map([...(e.data??[]).map(a=>[a.id,a.name]),...(o.data??[]).map(a=>[a.id,a.name])]),[e.data,o.data])}export{m as u};
|
||||
import{r as t}from"./vendor-react-Bf71BWbF.js";import{a8 as u,ac as d,aa as r,ab as n}from"./index-BNBwb-FJ.js";function m(){const s=u().data?.resources,e=d(r(s,"groups",{whileLoading:!1})),o=n(r(s,"nodes",{whileLoading:!1}));return t.useMemo(()=>new Map([...(e.data??[]).map(a=>[a.id,a.name]),...(o.data??[]).map(a=>[a.id,a.name])]),[e.data,o.data])}export{m as u};
|
||||
@@ -1 +1 @@
|
||||
import{dw as c,d5 as o,a0 as l,dx as m,cM as t}from"./index-CXHBmSa5.js";const r="select";function u(e,s){const a=o.find(n=>n.id===(e??r));return a?s(a.label):e}function p(e,s){const a=o.some(d=>d.id===(e.native??r)),n=e.native&&a?u(e.native,s):l(m,e.kind,s),i=e.native||e.kind;return n===i?{label:n}:{label:n,id:i}}function g(e,s){const a=o.map(n=>({id:n.id,label:s(n.label),desc:s(n.description)}));return{selected:e??r,items:e&&!a.some(n=>n.id===e)?[{id:e,label:e},...a]:a}}const b={invalid:"arrange.badName",taken:"arrange.takenName"};function k(e,s,a){const n=c(e,s);return n?a(b[n]):null}function P(e,s,a){return e.every(n=>a?.filters.includes(n)||t(n))&&(s===(a?.policy??null)||t(s??""))}export{P as a,k as b,g as c,p as g,u as p};
|
||||
import{dF as c,de as o,a3 as l,dG as m,cT as t}from"./index-BNBwb-FJ.js";const r="select";function u(e,s){const a=o.find(n=>n.id===(e??r));return a?s(a.label):e}function p(e,s){const a=o.some(d=>d.id===(e.native??r)),n=e.native&&a?u(e.native,s):l(m,e.kind,s),i=e.native||e.kind;return n===i?{label:n}:{label:n,id:i}}function g(e,s){const a=o.map(n=>({id:n.id,label:s(n.label),desc:s(n.description)}));return{selected:e??r,items:e&&!a.some(n=>n.id===e)?[{id:e,label:e},...a]:a}}const b={invalid:"arrange.badName",taken:"arrange.takenName"};function k(e,s,a){const n=c(e,s);return n?a(b[n]):null}function P(e,s,a){return e.every(n=>a?.filters.includes(n)||t(n))&&(s===(a?.policy??null)||t(s??""))}export{P as a,k as b,g as c,p as g,u as p};
|
||||
@@ -1 +1 @@
|
||||
import{da as a}from"./index-CXHBmSa5.js";function p(i,l,n,r){const t=i.results.filter(e=>e.member_id===l),o=t.find(e=>e.state==="healthy"&&e.latency_ms!=null);if(o)return{kind:"positive",text:r("nodes.probed",{name:n,n:a(o.latency_ms)})};if(t.length&&t.every(e=>e.state==="unavailable"))return{kind:"negative",text:r("nodes.probeFailed",{name:n})};const s=t.find(e=>e.error)?.error;return{kind:"neutral",text:s?r("nodes.probeUnknownWhy",{name:n,error:s}):r("nodes.probeUnknown",{name:n})}}export{p};
|
||||
import{dj as d}from"./index-BNBwb-FJ.js";function p(i,l,n,r){const t=i.results.filter(e=>e.member_id===l),o=t.find(e=>e.state==="healthy"&&e.latency_ms!=null);if(o)return{kind:"positive",text:r("nodes.probed",{name:n,n:d(o.latency_ms)})};if(t.length&&t.every(e=>e.state==="unavailable"))return{kind:"negative",text:r("nodes.probeFailed",{name:n})};const s=t.find(e=>e.error)?.error;return{kind:"neutral",text:s?r("nodes.probeUnknownWhy",{name:n,error:s}):r("nodes.probeUnknown",{name:n})}}export{p};
|
||||
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 23 KiB |
@@ -1 +1 @@
|
||||
import{r as f,j as s}from"./vendor-react-Bf71BWbF.js";import{u as E,aM as R,aN as L}from"./index-CXHBmSa5.js";import{u as S,l as W,b as _,c as q,d as b,C as w}from"./layout-BRLew_nj.js";const o=12;function I({label:y,points:c,marks:d=[],rows:m=[],fmt:h,maxHeight:a=160}){const r=E(),T=R(),[k,l]=L(),{ref:C,tip:P,show:g,hide:A}=S(),x=f.useMemo(()=>W(c.map(e=>e.value)),[c]),B=f.useMemo(()=>{const e=_(x,l&&l<480?4:8);return l!==null&&l<360?e.filter((t,n)=>n%2===0):e},[x,l]),u=Math.max((l??0)-o*2,1),i=e=>o+b(e,x)*u,p=c.length>400?2:c.length>120?3:4,{ys:j,hidden:D}=f.useMemo(()=>l?q(c.map(e=>o+b(e.value,x)*u),p,(a-36)/2):{ys:[],hidden:[]},[c,x,u,p,a,l]),N=Math.max(24,2*(Math.max(0,...j.map(e=>Math.abs(e??0)))+p+2)),v=N+36;return s.jsx("div",{className:"rp-swarm",ref:k,children:s.jsxs("div",{className:"rp-chart-hover",ref:C,onPointerLeave:A,children:[l!==null&&s.jsxs("svg",{width:l,height:v,role:"img","aria-label":y,"aria-describedby":T,children:[B.map(e=>{const t=i(e)>=l-o-1;return s.jsxs("g",{children:[s.jsx("line",{className:"grid",x1:i(e),x2:i(e),y1:16,y2:v-18}),s.jsx("text",{className:"tick",x:t?l:i(e),y:v-4,textAnchor:t?"end":"middle",children:h(e)})]},e)}),c.map((e,t)=>j[t]===null||j[t]===void 0?null:s.jsx("circle",{cx:i(e.value),cy:16+N/2+j[t],r:p,fill:e.color,onPointerMove:n=>g(n,e.lines)},e.id)),D.map(e=>s.jsxs("text",{className:"more",x:e.x,y:12,textAnchor:"middle",children:["+",e.count]},e.x)),d.map((e,t)=>{const n=i(e.value),M=n<96||t%2===1&&n<l-120;return s.jsxs("g",{className:"mark",children:[s.jsx("line",{x1:n,x2:n,y1:14,y2:v-18}),l>=360&&s.jsx("text",{x:n,y:10,textAnchor:M?"start":"end",dx:M?4:-4,children:e.label})]},e.label)})]}),l!==null&&m.length>0&&s.jsx("div",{className:"rp-strips",children:m.map(e=>s.jsxs("div",{className:"rp-strip-row",children:[s.jsxs("div",{className:"rp-row",children:[s.jsx("span",{className:"name",children:e.label}),s.jsx("span",{className:"rp-note",children:e.detail})]}),s.jsxs("svg",{width:l,height:20,role:"img","aria-label":r("ui.valuePair",{label:e.label,value:e.detail}),children:[s.jsx("line",{className:"grid",x1:o,x2:o+u,y1:10,y2:10}),e.points.map(t=>s.jsx("circle",{cx:i(t.value),cy:10,r:4,fill:t.color,onPointerMove:n=>g(n,t.lines)},t.id)),e.mark!==void 0&&s.jsx("line",{className:"median",x1:i(e.mark),x2:i(e.mark),y1:-2,y2:22})]})]},e.id))}),s.jsx(w,{tip:P})]})})}function J(y,c){const d=new Map;for(const a of y)d.set(a,(d.get(a)??0)+1);const m=(a,r)=>a===r?0:a===null?1:r===null||a<r?-1:1,h=[...d].map(([a,r])=>({key:a,count:r})).sort((a,r)=>r.count-a.count||m(a.key,r.key));return{top:h.slice(0,c),rest:h.slice(c).reduce((a,r)=>a+r.count,0)}}export{I as B,J as r};
|
||||
import{r as f,j as s}from"./vendor-react-Bf71BWbF.js";import{u as E,aP as R,aQ as L}from"./index-BNBwb-FJ.js";import{u as Q,l as S,b as W,c as _,d as M,C as q}from"./layout-wfdMYi2n.js";const o=12;function G({label:y,points:c,marks:d=[],rows:m=[],fmt:h,maxHeight:a=160}){const r=E(),P=R(),[T,l]=L(),{ref:k,tip:C,show:g,hide:A}=Q(),x=f.useMemo(()=>S(c.map(e=>e.value)),[c]),B=f.useMemo(()=>{const e=W(x,l&&l<480?4:8);return l!==null&&l<360?e.filter((t,n)=>n%2===0):e},[x,l]),u=Math.max((l??0)-o*2,1),i=e=>o+M(e,x)*u,p=c.length>400?2:c.length>120?3:4,{ys:j,hidden:D}=f.useMemo(()=>l?_(c.map(e=>o+M(e.value,x)*u),p,(a-36)/2):{ys:[],hidden:[]},[c,x,u,p,a,l]),N=Math.max(24,2*(Math.max(0,...j.map(e=>Math.abs(e??0)))+p+2)),v=N+36;return s.jsx("div",{className:"rp-swarm",ref:T,children:s.jsxs("div",{className:"rp-chart-hover",ref:k,onPointerLeave:A,children:[l!==null&&s.jsxs("svg",{width:l,height:v,role:"img","aria-label":y,"aria-describedby":P,children:[B.map(e=>{const t=i(e)>=l-o-1;return s.jsxs("g",{children:[s.jsx("line",{className:"grid",x1:i(e),x2:i(e),y1:16,y2:v-18}),s.jsx("text",{className:"tick",x:t?l:i(e),y:v-4,textAnchor:t?"end":"middle",children:h(e)})]},e)}),c.map((e,t)=>j[t]===null||j[t]===void 0?null:s.jsx("circle",{cx:i(e.value),cy:16+N/2+j[t],r:p,fill:e.color,onPointerMove:n=>g(n,e.lines)},e.id)),D.map(e=>s.jsxs("text",{className:"more",x:e.x,y:12,textAnchor:"middle",children:["+",e.count]},e.x)),d.map((e,t)=>{const n=i(e.value),b=n<96||t%2===1&&n<l-120;return s.jsxs("g",{className:"mark",children:[s.jsx("line",{x1:n,x2:n,y1:14,y2:v-18}),l>=360&&s.jsx("text",{x:n,y:10,textAnchor:b?"start":"end",dx:b?4:-4,children:e.label})]},e.label)})]}),l!==null&&m.length>0&&s.jsx("div",{className:"rp-strips",children:m.map(e=>s.jsxs("div",{className:"rp-strip-row",children:[s.jsxs("div",{className:"rp-row",children:[s.jsx("span",{className:"name",children:e.label}),s.jsx("span",{className:"rp-note",children:e.detail})]}),s.jsxs("svg",{width:l,height:20,role:"img","aria-label":r("ui.valuePair",{label:e.label,value:e.detail}),children:[s.jsx("line",{className:"grid",x1:o,x2:o+u,y1:10,y2:10}),e.points.map(t=>s.jsx("circle",{cx:i(t.value),cy:10,r:4,fill:t.color,onPointerMove:n=>g(n,t.lines)},t.id)),e.mark!==void 0&&s.jsx("line",{className:"median",x1:i(e.mark),x2:i(e.mark),y1:-2,y2:22})]})]},e.id))}),s.jsx(q,{tip:C})]})})}function I(y,c){const d=new Map;for(const a of y)d.set(a,(d.get(a)??0)+1);const m=(a,r)=>a===r?0:a===null?1:r===null||a<r?-1:1,h=[...d].map(([a,r])=>({key:a,count:r})).sort((a,r)=>r.count-a.count||m(a.key,r.key));return{top:h.slice(0,c),rest:h.slice(c).reduce((a,r)=>a+r.count,0)}}export{G as B,I as r};
|
||||
@@ -1,19 +1,19 @@
|
||||
import{P as h,y as E,dv as F,J as I,N as A,z as J,q as L,Q as z}from"./index-CXHBmSa5.js";const T="standard",y=["# dae presets: the local network manager, the LAN and multicast stay off the proxy","pname(NetworkManager) -> direct","dip(224.0.0.0/3, 'ff00::/8') -> direct","dip(geoip:private) -> direct","# Block UDP/443","l4proto(udp) && dport(443) -> block"],k=["# BanAD, BanProgramAD","domain(geosite:category-ads-all) -> block"],w=["# GoogleCN, SteamCN","domain(geosite:google-cn, geosite:category-games@cn) -> direct"],$=["# ChinaDomain, ChinaCompanyIp, GEOIP CN","domain(geosite:cn) -> direct","dip(geoip:cn) -> direct"],v=e=>["# Telegram",`domain(geosite:telegram) -> ${e}`,`dip(geoip:telegram) -> ${e}`],N=e=>["# ProxyMedia",`domain(geosite:youtube, geosite:netflix, geosite:disney, geosite:hbo, geosite:primevideo, geosite:twitch, geosite:spotify) -> ${e}`],S=e=>["# ProxyGFWlist",`domain(geosite:gfw) -> ${e}`],K="filter: !name('direct', 'block')",B=(e,o,n,t=n[0])=>({name:e,label:o,lines:[`filter: group(${n.map(h).join(", ")})`,K,"policy: select",`default: ${h(t)}`]}),W=(e,o,n)=>({name:e,label:o,lines:[`filter: name(regex: ${h(n)})`,"policy: min_moving_avg"]}),r={proxy:"节点选择",auto:"自动选择",hk:["香港节点","港|HK|Hong Kong|HongKong"],jp:["日本节点","日|JP|Japan|Tokyo"],us:["美国节点","美|US|United States|America"],tw:["台湾节点","台|TW|Taiwan"],sg:["狮城节点","新加坡|獅城|狮城|SG|Singapore"],kr:["韩国节点","韓|韩|KR|Korea"],telegram:"电报消息",media:"国外媒体",apple:"苹果服务",ai:"Ai平台",youtube:"油管视频",netflix:"奈飞视频",bahamut:"巴哈姆特"},C=B("proxy",r.proxy,["auto"]),_={name:"auto",label:r.auto,lines:[K,"policy: min_moving_avg"]},b=["hk","jp","us","tw","sg","kr"].map(e=>W(e,r[e][0],r[e][1])),f=(e,o,n=["proxy","auto"],t)=>B(e,o,n,t),j={global:{rules:[...y],fallback:"{group}",groups:[]},bypass:{rules:[...y,...k,...w,...$],fallback:"{group}",groups:[]},gfw:{rules:[...y,...k,...v("{group}"),...S("{group}")],fallback:"direct",groups:[]},mini:{rules:[...y,...k,...w,...v("proxy"),...N("proxy"),...S("proxy"),...$],fallback:"proxy",groups:[C,_]},standard:{rules:[...y,...k,...w,"# Microsoft","domain(geosite:microsoft) -> direct","# Apple","domain(geosite:apple) -> apple",...v("telegram"),...N("media"),...S("proxy"),...$],fallback:"proxy",groups:[C,_,f("telegram",r.telegram),f("media",r.media),f("apple",r.apple)]},full:{rules:[...y,...k,...w,"# Bing, OneDrive, Microsoft","domain(geosite:microsoft) -> direct","# Apple","domain(geosite:apple) -> direct",...v("telegram"),"# AI, OpenAi","domain(geosite:openai) -> ai","# NetEaseMusic","domain(geosite:netease) -> direct","# Epic, Origin, Sony, Steam, Nintendo","domain(geosite:category-games) -> direct","# YouTube","domain(geosite:youtube) -> youtube","# Netflix","domain(geosite:netflix) -> netflix","# Bahamut","domain(geosite:bahamut) -> bahamut","# BilibiliHMT, Bilibili","domain(geosite:bilibili) -> direct",...N("media"),...S("proxy"),...$],fallback:"proxy",groups:[B("proxy",r.proxy,["auto",...b.map(e=>e.name)]),_,...b,f("telegram",r.telegram,["proxy","auto",...b.map(e=>e.name)]),f("ai",r.ai,["proxy","auto",...b.map(e=>e.name)]),f("youtube",r.youtube,["proxy","auto",...b.map(e=>e.name)]),f("netflix",r.netflix,["proxy","auto",...b.map(e=>e.name)]),f("bahamut",r.bahamut,["tw","proxy","auto"]),f("media",r.media,["proxy","auto",...b.map(e=>e.name)])]}},Q={listenerPort:"12345",defaultDns:"tls://1.1.1.1:853",chinaDns:"udp://223.5.5.5:53"},R=e=>/^\d+$/.test(e)&&Number(e)>=1&&Number(e)<=65535;function Z(e){return R(e.listenerPort)&&!!e.defaultDns.trim()&&!!e.chinaDns.trim()}const O=e=>/^https?:\/\/\S+$/.test(e.trim());function ee(e){const o=e.map(n=>n.name.trim()||n.tag).filter(n=>!!n);return new Set(o).size===o.length&&e.every(n=>n.raw!==void 0||!!n.name.trim()&&O(n.url))}function oe(e){const o=new Set(e.map(t=>t.name.trim()||t.tag));let n=e.length+1;for(;o.has(`sub-${n}`);)n++;return`sub-${n}`}function ne(e){const{blocks:o,tokens:n}=E(e),t=[];for(const[l,c]of o.filter(i=>i.name==="subscription").entries()){const i=A(e,c,n);if(e.slice(c.open+1,c.close).trim())for(const a of J(e,c)){const m=e.slice(a.from,a.to),d=i.filter(P=>P.from>=a.from&&P.to<=a.to),g=a.block?void 0:d.length===1?d[0]:void 0,x=g&&/^(['"])(.*)\1(\([^()]*\))$/.exec(g.value),D=x?x[2]:g?L(g.value):"";g&&O(D)?t.push({name:g.name,url:D,...x?{suffix:x[3]}:{},raw:m,section:l}):t.push({name:"",url:"",raw:m,section:l,...a.block||g?{tag:a.block?.name??g.name}:{}})}}const s=I(e)[0]?.written??null,p=o.find(l=>l.name==="global"),u=p?A(e,p,n).find(l=>l.name==="lan_interface")?.value:void 0;return{subscriptions:t,group:s,rules:"keep",lanInterface:u&&u!=="auto"?u:"",...Q}}function G(e){return["subscription {",...e.subscriptions.map(H),"}"]}const H=e=>e.raw??` ${z(e.name.trim())}: ${h(e.url.trim())}${e.suffix??""}`,U="proxy";function M(e,o){const n=e.group??U,t=s=>" "+s.replaceAll("{group}",n);return["routing {",...j[o].rules.map(t),t(`fallback: ${j[Line truncated
|
||||
`);const{blocks:n}=E(e),t=[],s=n.filter(i=>i.name==="subscription");for(const[i,a]of s.entries()){const d=o.subscriptions.filter(g=>(g.section??s.length-1)===i).map(H);d.join(`
|
||||
import{R as h,y as q,dE as F,K as I,O as P,z as L,q as z,U as J}from"./index-BNBwb-FJ.js";const T="standard",y=["# dae presets: the local network manager, the LAN and multicast stay off the proxy","pname(NetworkManager) -> direct","dip(224.0.0.0/3, 'ff00::/8') -> direct","dip(geoip:private) -> direct","# Block UDP/443","l4proto(udp) && dport(443) -> block"],k=["# BanAD, BanProgramAD","domain(geosite:category-ads-all) -> block"],w=["# GoogleCN, SteamCN","domain(geosite:google-cn, geosite:category-games@cn) -> direct"],$=["# ChinaDomain, ChinaCompanyIp, GEOIP CN","domain(geosite:cn) -> direct","dip(geoip:cn) -> direct"],v=e=>["# Telegram",`domain(geosite:telegram) -> ${e}`,`dip(geoip:telegram) -> ${e}`],_=e=>["# ProxyMedia",`domain(geosite:youtube, geosite:netflix, geosite:disney, geosite:hbo, geosite:primevideo, geosite:twitch, geosite:spotify) -> ${e}`],S=e=>["# ProxyGFWlist",`domain(geosite:gfw) -> ${e}`],K="filter: !name('direct', 'block')",B=(e,o,n,t=n[0])=>({name:e,label:o,lines:[`filter: group(${n.map(h).join(", ")})`,K,"policy: select",`default: ${h(t)}`]}),R=(e,o,n)=>({name:e,label:o,lines:[`filter: name(regex: ${h(n)})`,"policy: min_moving_avg"]}),r={proxy:"节点选择",auto:"自动选择",hk:["香港节点","港|HK|Hong Kong|HongKong"],jp:["日本节点","日|JP|Japan|Tokyo"],us:["美国节点","美|US|United States|America"],tw:["台湾节点","台|TW|Taiwan"],sg:["狮城节点","新加坡|獅城|狮城|SG|Singapore"],kr:["韩国节点","韓|韩|KR|Korea"],telegram:"电报消息",media:"国外媒体",apple:"苹果服务",ai:"Ai平台",youtube:"油管视频",netflix:"奈飞视频",bahamut:"巴哈姆特"},C=B("proxy",r.proxy,["auto"]),N={name:"auto",label:r.auto,lines:[K,"policy: min_moving_avg"]},b=["hk","jp","us","tw","sg","kr"].map(e=>R(e,r[e][0],r[e][1])),f=(e,o,n=["proxy","auto"],t)=>B(e,o,n,t),j={global:{rules:[...y],fallback:"{group}",groups:[]},bypass:{rules:[...y,...k,...w,...$],fallback:"{group}",groups:[]},gfw:{rules:[...y,...k,...v("{group}"),...S("{group}")],fallback:"direct",groups:[]},mini:{rules:[...y,...k,...w,...v("proxy"),..._("proxy"),...S("proxy"),...$],fallback:"proxy",groups:[C,N]},standard:{rules:[...y,...k,...w,"# Microsoft","domain(geosite:microsoft) -> direct","# Apple","domain(geosite:apple) -> apple",...v("telegram"),..._("media"),...S("proxy"),...$],fallback:"proxy",groups:[C,N,f("telegram",r.telegram),f("media",r.media),f("apple",r.apple)]},full:{rules:[...y,...k,...w,"# Bing, OneDrive, Microsoft","domain(geosite:microsoft) -> direct","# Apple","domain(geosite:apple) -> direct",...v("telegram"),"# AI, OpenAi","domain(geosite:openai) -> ai","# NetEaseMusic","domain(geosite:netease) -> direct","# Epic, Origin, Sony, Steam, Nintendo","domain(geosite:category-games) -> direct","# YouTube","domain(geosite:youtube) -> youtube","# Netflix","domain(geosite:netflix) -> netflix","# Bahamut","domain(geosite:bahamut) -> bahamut","# BilibiliHMT, Bilibili","domain(geosite:bilibili) -> direct",..._("media"),...S("proxy"),...$],fallback:"proxy",groups:[B("proxy",r.proxy,["auto",...b.map(e=>e.name)]),N,...b,f("telegram",r.telegram,["proxy","auto",...b.map(e=>e.name)]),f("ai",r.ai,["proxy","auto",...b.map(e=>e.name)]),f("youtube",r.youtube,["proxy","auto",...b.map(e=>e.name)]),f("netflix",r.netflix,["proxy","auto",...b.map(e=>e.name)]),f("bahamut",r.bahamut,["tw","proxy","auto"]),f("media",r.media,["proxy","auto",...b.map(e=>e.name)])]}},W={listenerPort:"12345",defaultDns:"tls://1.1.1.1:853",chinaDns:"udp://223.5.5.5:53"},V=e=>/^\d+$/.test(e)&&Number(e)>=1&&Number(e)<=65535;function Z(e){return V(e.listenerPort)&&!!e.defaultDns.trim()&&!!e.chinaDns.trim()}const O=e=>/^https?:\/\/\S+$/.test(e.trim());function ee(e){const o=e.map(n=>n.name.trim()||n.tag).filter(n=>!!n);return new Set(o).size===o.length&&e.every(n=>n.raw!==void 0||!!n.name.trim()&&O(n.url))}function oe(e){const o=new Set(e.map(t=>t.name.trim()||t.tag));let n=e.length+1;for(;o.has(`sub-${n}`);)n++;return`sub-${n}`}function ne(e){const{blocks:o,tokens:n}=q(e),t=[];for(const[l,c]of o.filter(i=>i.name==="subscription").entries()){const i=P(e,c,n);if(e.slice(c.open+1,c.close).trim())for(const a of L(e,c)){const m=e.slice(a.from,a.to),d=i.filter(A=>A.from>=a.from&&A.to<=a.to),g=a.block?void 0:d.length===1?d[0]:void 0,x=g&&/^(['"])(.*)\1(\([^()]*\))$/.exec(g.value),D=x?x[2]:g?z(g.value):"";g&&O(D)?t.push({name:g.name,url:D,...x?{suffix:x[3]}:{},raw:m,section:l}):t.push({name:"",url:"",raw:m,section:l,...a.block||g?{tag:a.block?.name??g.name}:{}})}}const s=I(e)[0]?.written??null,p=o.find(l=>l.name==="global"),u=p?P(e,p,n).find(l=>l.name==="lan_interface")?.value:void 0;return{subscriptions:t,group:s,rules:"keep",lanInterface:u&&u!=="auto"?u:"",...W}}function E(e){return["subscription {",...e.subscriptions.map(U),"}"]}const U=e=>e.raw??` ${J(e.name.trim())}: ${h(e.url.trim())}${e.suffix??""}`,H="proxy";function G(e,o){const n=e.group??H,t=s=>" "+s.replaceAll("{group}",n);return["routing {",...j[o].rules.map(t),t(`fallback: ${j[Line truncated
|
||||
`);const{blocks:n}=q(e),t=[],s=n.filter(i=>i.name==="subscription");for(const[i,a]of s.entries()){const d=o.subscriptions.filter(g=>(g.section??s.length-1)===i).map(U);d.join(`
|
||||
`)!==F(e,a).join(`
|
||||
`)&&t.push({from:a.open+1,to:a.close,text:`
|
||||
`+d.join(`
|
||||
`)+`
|
||||
`})}const p=[];!s.length&&o.subscriptions.length&&p.push(G(o).join(`
|
||||
`));const u=n.find(i=>i.name==="group"),l=q(I(e).map(i=>i.name),o.rules);if(!u&&l.length)p.push(["group {",...l,"}"].join(`
|
||||
`})}const p=[];!s.length&&o.subscriptions.length&&p.push(E(o).join(`
|
||||
`));const u=n.find(i=>i.name==="group"),l=M(I(e).map(i=>i.name),o.rules);if(!u&&l.length)p.push(["group {",...l,"}"].join(`
|
||||
`));else if(u&&l.length){const i=e.lastIndexOf(`
|
||||
`,u.close-1)+1,a=!/^[ \t]*$/.test(e.slice(i,u.close));t.push({from:a?u.close:i,to:a?u.close:i,text:(a?`
|
||||
`:"")+l.join(`
|
||||
`)+`
|
||||
`})}if(o.rules!=="keep"){const i=n.filter(m=>m.name==="routing"),a=M(o,o.rules).join(`
|
||||
`})}if(o.rules!=="keep"){const i=n.filter(m=>m.name==="routing"),a=G(o,o.rules).join(`
|
||||
`);i.length?i.forEach((m,d)=>t.push({from:m.from,to:m.to,text:d===0?a:""})):p.push(a)}let c=e;for(const i of t.sort((a,m)=>m.from-a.from))c=c.slice(0,i.from)+i.text+c.slice(i.to);return p.length&&(c=c.replace(/\n$/,"")+`
|
||||
|
||||
`+p.join(`
|
||||
|
||||
`)+`
|
||||
`),c}export{O as a,U as b,Z as c,T as d,R as i,oe as n,ne as r,j as t,ee as v,te as w};
|
||||
`),c}export{O as a,H as b,Z as c,T as d,V as i,oe as n,ne as r,j as t,ee as v,te as w};
|
||||
@@ -1 +1 @@
|
||||
import{cg as p}from"./index-CXHBmSa5.js";import{r}from"./vendor-react-Bf71BWbF.js";function d(h){let a=p({usage:"search",...h}),o=r.useCallback((l,e)=>e.length===0?!0:(l=l.normalize("NFC"),e=e.normalize("NFC"),a.compare(l.slice(0,e.length),e)===0),[a]),c=r.useCallback((l,e)=>e.length===0?!0:(l=l.normalize("NFC"),e=e.normalize("NFC"),a.compare(l.slice(-e.length),e)===0),[a]),f=r.useCallback((l,e)=>{if(e.length===0)return!0;l=l.normalize("NFC"),e=e.normalize("NFC");let t=0,m=e.length;for(;t+m<=l.length;t++){let n=l.slice(t,t+m);if(a.compare(e,n)===0)return!0}return!1},[a]);return r.useMemo(()=>({startsWith:o,endsWith:c,contains:f}),[o,c,f])}export{d as $};
|
||||
import{ck as p}from"./index-BNBwb-FJ.js";import{r}from"./vendor-react-Bf71BWbF.js";function d(h){let a=p({usage:"search",...h}),o=r.useCallback((l,e)=>e.length===0?!0:(l=l.normalize("NFC"),e=e.normalize("NFC"),a.compare(l.slice(0,e.length),e)===0),[a]),c=r.useCallback((l,e)=>e.length===0?!0:(l=l.normalize("NFC"),e=e.normalize("NFC"),a.compare(l.slice(-e.length),e)===0),[a]),f=r.useCallback((l,e)=>{if(e.length===0)return!0;l=l.normalize("NFC"),e=e.normalize("NFC");let t=0,m=e.length;for(;t+m<=l.length;t++){let n=l.slice(t,t+m);if(a.compare(e,n)===0)return!0}return!1},[a]);return r.useMemo(()=>({startsWith:o,endsWith:c,contains:f}),[o,c,f])}export{d as $};
|
||||
@@ -1 +1 @@
|
||||
import{r as i}from"./vendor-react-Bf71BWbF.js";import{e7 as M,el as l,em as b,eo as D,eu as F,en as S,bB as v}from"./index-CXHBmSa5.js";function I(e,t){const u=i.useRef(!0),c=i.useRef(null);let n=M(e);i.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]),i.useEffect(()=>{let r=c.current;u.current?u.current=!1:(!r||t.some((a,o)=>!Object.is(a,r[o])))&&n(),c.current=t},t)}const k=i.createContext(null),B=i.createContext(null);var E={};E={deselectedItem:e=>`${e.item} not selected.`,select:"Select",selectedCount:(e,t)=>`${t.plural(e.count,{"=0":"No items selected",one:()=>`${t.number(e.count)} item selected`,other:()=>`${t.number(e.count)} items selected`})}.`,selectedAll:"All items selected.",selectedItem:e=>`${e.item} selected.`,longPressToSelect:"Long press to enter selection mode."};var p={};p={deselectedItem:e=>`未选择 ${e.item}。`,longPressToSelect:"长按以进入选择模式。",select:"选择",selectedAll:"已选择所有项目。",selectedCount:(e,t)=>`${t.plural(e.count,{"=0":"未选择项目",one:()=>`已选择 ${t.number(e.count)} 个项目`,other:()=>`已选择 ${t.number(e.count)} 个项目`})}。`,selectedItem:e=>`已选择 ${e.item}。`};var x={};x={deselectedItem:e=>`未選取「${e.item}」。`,longPressToSelect:"長按以進入選擇模式。",select:"選取",selectedAll:"已選取所有項目。",selectedCount:(e,t)=>`${t.plural(e.count,{"=0":"未選取任何項目",one:()=>`已選取 ${t.number(e.count)} 個項目`,other:()=>`已選取 ${t.number(e.count)} 個項目`})}。`,selectedItem:e=>`已選取「${e.item}」。`};var m={};m={"ar-AE":l,"bg-BG":l,"cs-CZ":l,"da-DK":l,"de-DE":l,"el-GR":l,"en-US":E,"es-ES":l,"et-EE":l,"fi-FI":l,"fr-FR":l,"he-IL":l,"hr-HR":l,"hu-HU":l,"it-IT":l,"ja-JP":l,"ko-KR":l,"lt-LT":l,"lv-LV":l,"nb-NO":l,"nl-NL":l,"pl-PL":l,"pt-BR":l,"pt-PT":l,"ro-RO":l,"ru-RU":l,"sk-SK":l,"sl-SI":l,"sr-SP":l,"sv-SE":l,"tr-TR":l,"uk-UA":l,"zh-CN":p,"zh-TW":x};function A(e){return e&&e.__esModule?e.default:e}function P(e,t){let{getRowText:u=o=>t.collection.getTextValue?.(o)??t.collection.getItem(o)?.textValue}=e,c=b(A(m),"@react-aria/grid"),n=t.selectionManager.rawSelection,r=i.useRef(n),a=i.useCallback(()=>{if(!t.selectionManager.isFocused||n===r.current){r.current=n;return}let o=g(n,r.current),d=g(r.current,n),h=t.selectionManager.selectionBehavior==="replace",$=[];if(t.selectionManager.selectedKeys.size===1&&h){let s=t.selectionManager.selectedKeys.keys().next().value;if(s!=null&&t.collection.getItem(s)){let f=u(s);f&&$.push(c.format("selectedItem",{item:f}))}}else if(o.size===1&&d.size===0){let s=o.keys().next().value;if(s!=null){let f=u(s);f&&$.push(c.format("selectedItem",{item:f}))}}else if(d.size===1&&o.size===0){let s=d.keys().next().value;if(s!=null&&t.collection.getItem(s)){let f=u(s);f&&$.push(c.format("deselectedItem",{item:f}))}}t.selectionManager.selectionMode==="multiple"&&($.length===0||n==="all"||n.size>1||r.current==="all"||r.current?.size>1)&&$.push(n==="all"?c.format("selectedAll"):c.format("selectedCount",{count:n.size})),$.length>0&&D($.join(" ")),r.current=n},[n,t.selectionManager.selectedKeys,t.selectionManager.isFocused,t.selectionManager.selectionBehavior,t.selectionManager.selectionMode,t.collection,u,c]);I(()=>{if(t.selectionManager.isFocused)a();else{let o=requestAnimationFrame(a);return()=>cancelAnimationFrame(o)}},[n,t.selectionManager.isFocused])}function g(e,t){let u=new Set;if(e==="all"||t==="all")return u;for(let c of e.keys())t.has(c)||u.add(c);return u}function y(e){return e&&e.__esModule?e.default:e}function K(e){let t=b(y(m),"@react-aria/grid"),u=F(),c=(u==="pointer"||u==="virtual"||u==null)&&typeof window<"u"&&"ontouchstart"in window,n=i.useMemo(()=>{let a=e.selectionManager.selectionMode,o=e.selectionManager.selectionBehavior,d;return c&&(d=t.format("longPressToSelect")),o==="replace"&&a!=="none"&&e.hasItemActions?d:void 0},[e.selectionManager.selectionMode,e.selectionManager.selectionBehavior,e.hasItemActions,t,c]);return S(n)}function C(e){return e&&e.__esModule?e.default:e}function z(e,t){let{key:u}=e,c=t.selectionManager,n=v(),r=!t.selectionManager.canSelectItem(u),a=t.selectionManager.isSelected(u),o=()=>c.toggleSelection(u);const d=b(C(m),"@react-aria/grid");return{checkboxProps:{id:n,"aria-label":d.format("select"),isSelected:a,isDisabled:r,onChange:o}}}export{K as $,P as a,z as b,k as c,B as d,I as e};
|
||||
import{r as i}from"./vendor-react-Bf71BWbF.js";import{eg as D,eu as l,ev as b,ex as M,eD as F,ew as v,bF as S}from"./index-BNBwb-FJ.js";function I(e,t){const u=i.useRef(!0),c=i.useRef(null);let n=D(e);i.useEffect(()=>(u.current=!0,()=>{u.current=!1}),[]),i.useEffect(()=>{let r=c.current;u.current?u.current=!1:(!r||t.some((a,o)=>!Object.is(a,r[o])))&&n(),c.current=t},t)}const k=i.createContext(null),P=i.createContext(null);var E={};E={deselectedItem:e=>`${e.item} not selected.`,select:"Select",selectedCount:(e,t)=>`${t.plural(e.count,{"=0":"No items selected",one:()=>`${t.number(e.count)} item selected`,other:()=>`${t.number(e.count)} items selected`})}.`,selectedAll:"All items selected.",selectedItem:e=>`${e.item} selected.`,longPressToSelect:"Long press to enter selection mode."};var p={};p={deselectedItem:e=>`未选择 ${e.item}。`,longPressToSelect:"长按以进入选择模式。",select:"选择",selectedAll:"已选择所有项目。",selectedCount:(e,t)=>`${t.plural(e.count,{"=0":"未选择项目",one:()=>`已选择 ${t.number(e.count)} 个项目`,other:()=>`已选择 ${t.number(e.count)} 个项目`})}。`,selectedItem:e=>`已选择 ${e.item}。`};var x={};x={deselectedItem:e=>`未選取「${e.item}」。`,longPressToSelect:"長按以進入選擇模式。",select:"選取",selectedAll:"已選取所有項目。",selectedCount:(e,t)=>`${t.plural(e.count,{"=0":"未選取任何項目",one:()=>`已選取 ${t.number(e.count)} 個項目`,other:()=>`已選取 ${t.number(e.count)} 個項目`})}。`,selectedItem:e=>`已選取「${e.item}」。`};var m={};m={"ar-AE":l,"bg-BG":l,"cs-CZ":l,"da-DK":l,"de-DE":l,"el-GR":l,"en-US":E,"es-ES":l,"et-EE":l,"fi-FI":l,"fr-FR":l,"he-IL":l,"hr-HR":l,"hu-HU":l,"it-IT":l,"ja-JP":l,"ko-KR":l,"lt-LT":l,"lv-LV":l,"nb-NO":l,"nl-NL":l,"pl-PL":l,"pt-BR":l,"pt-PT":l,"ro-RO":l,"ru-RU":l,"sk-SK":l,"sl-SI":l,"sr-SP":l,"sv-SE":l,"tr-TR":l,"uk-UA":l,"zh-CN":p,"zh-TW":x};function A(e){return e&&e.__esModule?e.default:e}function B(e,t){let{getRowText:u=o=>t.collection.getTextValue?.(o)??t.collection.getItem(o)?.textValue}=e,c=b(A(m),"@react-aria/grid"),n=t.selectionManager.rawSelection,r=i.useRef(n),a=i.useCallback(()=>{if(!t.selectionManager.isFocused||n===r.current){r.current=n;return}let o=g(n,r.current),d=g(r.current,n),h=t.selectionManager.selectionBehavior==="replace",$=[];if(t.selectionManager.selectedKeys.size===1&&h){let s=t.selectionManager.selectedKeys.keys().next().value;if(s!=null&&t.collection.getItem(s)){let f=u(s);f&&$.push(c.format("selectedItem",{item:f}))}}else if(o.size===1&&d.size===0){let s=o.keys().next().value;if(s!=null){let f=u(s);f&&$.push(c.format("selectedItem",{item:f}))}}else if(d.size===1&&o.size===0){let s=d.keys().next().value;if(s!=null&&t.collection.getItem(s)){let f=u(s);f&&$.push(c.format("deselectedItem",{item:f}))}}t.selectionManager.selectionMode==="multiple"&&($.length===0||n==="all"||n.size>1||r.current==="all"||r.current?.size>1)&&$.push(n==="all"?c.format("selectedAll"):c.format("selectedCount",{count:n.size})),$.length>0&&M($.join(" ")),r.current=n},[n,t.selectionManager.selectedKeys,t.selectionManager.isFocused,t.selectionManager.selectionBehavior,t.selectionManager.selectionMode,t.collection,u,c]);I(()=>{if(t.selectionManager.isFocused)a();else{let o=requestAnimationFrame(a);return()=>cancelAnimationFrame(o)}},[n,t.selectionManager.isFocused])}function g(e,t){let u=new Set;if(e==="all"||t==="all")return u;for(let c of e.keys())t.has(c)||u.add(c);return u}function y(e){return e&&e.__esModule?e.default:e}function K(e){let t=b(y(m),"@react-aria/grid"),u=F(),c=(u==="pointer"||u==="virtual"||u==null)&&typeof window<"u"&&"ontouchstart"in window,n=i.useMemo(()=>{let a=e.selectionManager.selectionMode,o=e.selectionManager.selectionBehavior,d;return c&&(d=t.format("longPressToSelect")),o==="replace"&&a!=="none"&&e.hasItemActions?d:void 0},[e.selectionManager.selectionMode,e.selectionManager.selectionBehavior,e.hasItemActions,t,c]);return v(n)}function C(e){return e&&e.__esModule?e.default:e}function z(e,t){let{key:u}=e,c=t.selectionManager,n=S(),r=!t.selectionManager.canSelectItem(u),a=t.selectionManager.isSelected(u),o=()=>c.toggleSelection(u);const d=b(C(m),"@react-aria/grid");return{checkboxProps:{id:n,"aria-label":d.format("select"),isSelected:a,isDisabled:r,onChange:o}}}export{K as $,B as a,z as b,k as c,P as d,I as e};
|
||||
@@ -1,8 +1,8 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-Hant" dir="ltr">
|
||||
<head>
|
||||
<script>// Normalize appearance before first paint. The build fills the palette list and default from src/shell/palettes.ts, and
|
||||
// the right-to-left scripts from src/i18n/direction.ts.
|
||||
<script>// Normalize appearance before first paint. The build fills the palette list and default from src/shell/palettes.ts, the
|
||||
// language locales and default from src/i18n/languages.ts, and the right-to-left scripts from src/i18n/direction.ts.
|
||||
(function () {
|
||||
var read = function (key) {
|
||||
try {
|
||||
@@ -16,13 +16,14 @@
|
||||
var lang = read('doona-lang');
|
||||
var d = document.documentElement;
|
||||
var dark = scheme === 'dark' || (scheme !== 'light' && matchMedia('(prefers-color-scheme: dark)').matches);
|
||||
var palettes = ["rose-pine/main","rose-pine/moon","catppuccin/frappe","catppuccin/macchiato","catppuccin/mocha","nord/nord","kary/kary","antd/antd","arco/arco","semi/semi","glass/glass"];
|
||||
var palettes = ["rose-pine/main","rose-pine/moon","catppuccin/frappe","catppuccin/macchiato","catppuccin/mocha","nord/nord","kary/kary","antd/antd","arco/arco","semi/semi","glass/glass","qiangguo/qiangguo"];
|
||||
var parts = (palettes.includes(palette) ? palette : "rose-pine/moon").split('/');
|
||||
d.dataset.scheme = dark ? 'dark' : 'light';
|
||||
d.dataset.family = parts[0];
|
||||
d.dataset.flavour = parts[1];
|
||||
d.dataset.wordmark = read('doona-wordmark') === 'plain' ? 'plain' : 'gradient';
|
||||
d.lang = lang === 'zh-CN' ? 'zh-CN' : lang === 'en' ? 'en-US' : 'zh-TW';
|
||||
var locales = {"zh-TW":"zh-TW","zh-CN":"zh-CN","en":"en-US"};
|
||||
d.lang = Object.hasOwn(locales, lang) ? locales[lang] : "zh-TW";
|
||||
// The direction as pageDirection in src/i18n/direction.ts decides it: right to left in the mirrored layout, else the
|
||||
// locale's text info, else its likely script.
|
||||
var mirrored = read('doona-mirror') === 'on';
|
||||
@@ -42,7 +43,7 @@
|
||||
</script>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'sha256-YWASLyBtVSX2dc4sQ2EIBJw0AXI/XMrMLfRLrwyt0N4='; connect-src 'self' http: https: ws: wss:; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https: http:; font-src 'self'">
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'sha256-b3z2oAR7ZGtNETQ8e4PzhTVKvJrOYejXRYx6jkdloe0='; connect-src 'self' http: https: ws: wss:; style-src 'self' 'unsafe-inline'; img-src 'self' data: blob: https: http:; font-src 'self'">
|
||||
<title>doona</title>
|
||||
<link rel="icon" href="./logo.svg">
|
||||
<link rel="manifest" href="./manifest.webmanifest">
|
||||
@@ -53,9 +54,9 @@
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-title" content="doona">
|
||||
<script type="module" crossorigin src="./assets/index-CXHBmSa5.js"></script>
|
||||
<script type="module" crossorigin src="./assets/index-BNBwb-FJ.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="./assets/vendor-react-Bf71BWbF.js">
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-BMPxGQXj.css">
|
||||
<link rel="stylesheet" crossorigin href="./assets/index-C8vJM6q6.css">
|
||||
</head>
|
||||
<body><div id="root"></div></body>
|
||||
</html>
|
||||
@@ -1,10 +1,11 @@
|
||||
const PREFIX = `doona-shell:${self.registration.scope}:`;
|
||||
const CACHE = PREFIX + '16b7a3b0bc887eec';
|
||||
const PRECACHE = ["assets/ActionGroup-90AzAQje.js","assets/AddCircle-Db3HxlxQ.js","assets/AreaChart-DtE4xcoZ.js","assets/AreaCurve-BriPYJva.js","assets/Arrange-Aggv2ZKG.js","assets/Arrange-Dd3j3leY.css","assets/Config-BTdL4dU5.js","assets/Connections-L2aJE6s8.js","assets/DaeCode-STEiRZuV.js","assets/Dns-vjK8rYCH.js","assets/Donut-BhofZH9-.js","assets/Events-B-WlUhq0.js","assets/FactStrip-BgQ_tYB6.js","assets/ListLayout-CPapuywx.js","assets/Login-CBpAitxd.js","assets/LoginShowcase-CwRzXrsa.js","assets/Logs-bjF3zhK-.js","assets/NodeSearch-Dmxd0d8_.js","assets/Nodes-CF-Y3hZu.js","assets/Overview-Fg9wiBtP.js","assets/Policies-wpHv6bOW.js","assets/PolicyPicker-DSSmYroN.js","assets/Rules-CSApE4tY.js","assets/Rules-l5FnUA9B.css","assets/SearchDialog-h0qVIWxg.js","assets/Settings-Ajzo2fTI.js","assets/Sparkline-B2EO782x.js","assets/Table-D0NFHHNQ.js","assets/TimeCell-gSIuLEFc.js","assets/Virtualizer--Vfl8O3n.js","assets/array-C0P64tl-.js","assets/auth-BGnwk8Hi.js","assets/auth-DmBaDwOI.js","assets/dns-DQrpG8y_.js","assets/duck-night-CbKHyiul.webp","assets/files-BxEOxSF8.js","assets/flows-C0byZ3sY.js","assets/geodata-DprMPspn.js","assets/index-BMPxGQXj.css","assets/index-CXHBmSa5.js","assets/layout-BRLew_nj.js","assets/link-D6L0Eg5i.js","assets/logo-obi05X1B.svg","assets/nav-BIpfWn6-.js","assets/nav-BeFLfZq8.js","assets/nav-C2A1sZKm.js","assets/nav-D1cfWFA0.js","assets/outbounds-f8QoVoCV.js","assets/policyText-CAFy3qpo.js","assets/probe-C8ejAKwA.js","assets/ranked-FVqORIQj.js","assets/recorder-DlDpPhd4.js","assets/setup-B5f1cfyO.js","assets/useFilter-DZ8TXqn_.js","assets/useGridSelectionCheckbox-BV96yL-N.js","assets/vendor-editor-CF5uj9id.js","assets/vendor-react-Bf71BWbF.js","index.html"];
|
||||
// Each language's catalogue and stylesheets in this build, cached only for a language a reader uses.
|
||||
const LANGUAGES = {"zh-CN":["assets/fonts-sc-DWPGxLPK.css","assets/locale-zh-CN-DVMwebSP.js"],"zh-TW":["assets/fonts-tc-B6Zt5HQN.css","assets/locale-zh-TW-uoOhY-ul.js"],"en":["assets/locale-en-C8dLKl7q.js"]};
|
||||
const CACHE = PREFIX + '7c5ed3d81a85ec8a';
|
||||
const PRECACHE = ["assets/ActionGroup-BKxDwmnT.js","assets/AddCircle-CIj8X2wL.js","assets/AreaChart-D20yx2yz.js","assets/AreaCurve-BriPYJva.js","assets/Arrange-BvqJLS4m.js","assets/Arrange-Dd3j3leY.css","assets/Config-DgoxfEHn.js","assets/Connections-B3chbGPe.js","assets/DaeCode-B8yPDjSE.js","assets/Dns-CTpwVfIj.js","assets/Donut-C-REp4Mf.js","assets/Events-M5fPrUeR.js","assets/FactStrip-n2q1T87k.js","assets/ListLayout-F74Z1Dpf.js","assets/Login-DgzaXVol.js","assets/LoginShowcase-CyHbTm5w.js","assets/Logs-sKihIR9Z.js","assets/NodeSearch-B91jhtS3.js","assets/Nodes-CnRnSpMd.js","assets/Overview-CuiLM_k-.js","assets/Policies-DiLR7S4N.js","assets/PolicyPicker-BmHzmXzJ.js","assets/Rules-DVu2iSwz.js","assets/Rules-l5FnUA9B.css","assets/SearchDialog-BrTpocW0.js","assets/Settings-DCKpUXHp.js","assets/Sparkline-D9jmRGJ6.js","assets/Table-DyWJelc_.js","assets/TimeCell-DUt0i0gi.js","assets/Virtualizer-DipGMcji.js","assets/array-C0P64tl-.js","assets/auth-TcOYUrrj.js","assets/auth-kokL-_Tb.js","assets/dns-CvJ19DpX.js","assets/duck-night-CbKHyiul.webp","assets/files-BxEOxSF8.js","assets/flows-CMFlFH_d.js","assets/geodata-DprMPspn.js","assets/index-BNBwb-FJ.js","assets/index-C8vJM6q6.css","assets/labels-Bgu_ZhL8.js","assets/layout-wfdMYi2n.js","assets/link-CIkWI7An.js","assets/logo-obi05X1B.svg","assets/nav-BeFLfZq8.js","assets/nav-D5WY5Qjf.js","assets/nav-DKmRxmdR.js","assets/nav-DuA2h3KP.js","assets/outbounds-DPmb26w8.js","assets/policyText-CmeXgUK2.js","assets/probe-BZEn7bbG.js","assets/qiangguo-gorges-dark-FlgXSNn1.webp","assets/qiangguo-gorges-light-DCWkLX37.webp","assets/qiangguo-lake-dark-B_VaUlAe.webp","assets/qiangguo-lake-light-oWll36-V.webp","assets/qiangguo-square-dark-CG0rwsS1.webp","assets/qiangguo-square-light-OU6dsCf9.webp","assets/qiangguo-taishan-dark-BI3cd4fj.webp","assets/qiangguo-taishan-light-Dip0HmJZ.webp","assets/qiangguo-wall-dark-DCO0xUUO.webp","assets/qiangguo-wall-light-BYfte2Bi.webp","assets/ranked-B09X8uKl.js","assets/recorder-DlDpPhd4.js","assets/setup-d2VGFWY1.js","assets/useFilter-jz02VVEB.js","assets/useGridSelectionCheckbox-CrCOlZv8.js","assets/vendor-editor-CF5uj9id.js","assets/vendor-react-Bf71BWbF.js","index.html"];
|
||||
// Each language's catalogue and stylesheets in this build, cached only for a language a reader uses. A partial
|
||||
// language's list holds the reference language's files too, since it loads them.
|
||||
const LANGUAGES = {"zh-TW":["assets/fonts-tc-B6Zt5HQN.css","assets/locale-zh-TW-BAWlQXtd.js"],"zh-CN":["assets/fonts-sc-DWPGxLPK.css","assets/locale-zh-CN-i45wENUR.js"],"en":["assets/locale-en-Ds2zf-Id.js"]};
|
||||
// The mock backend's chunk, cached only for a page that runs on it.
|
||||
const MOCK = ["assets/index-ChxA9-bE.js"];
|
||||
const MOCK = ["assets/index-DwWqXSpV.js"];
|
||||
const ROOT = new URL(self.registration.scope);
|
||||
|
||||
// A new build takes over on the next online load, including open dashboard tabs.
|
||||
|
||||
@@ -10,7 +10,7 @@ if [ "$dash" = "none" ]; then
|
||||
: > /etc/honk/config.d/api.dae
|
||||
fi
|
||||
|
||||
# Smooth migration from legacy /etc/honk/dashboard to /etc/honk/doona
|
||||
# Migrate legacy /etc/honk/dashboard directory
|
||||
if [ -d /etc/honk/dashboard ] && [ ! -d /etc/honk/doona ]; then
|
||||
mv /etc/honk/dashboard /etc/honk/doona
|
||||
elif [ -d /etc/honk/dashboard ] && [ -d /etc/honk/doona ]; then
|
||||
@@ -23,7 +23,7 @@ chmod -R u=rwX,go= /etc/honk 2>/dev/null || true
|
||||
chmod 700 /etc/honk /etc/honk/config.d /etc/honk/state 2>/dev/null || true
|
||||
|
||||
|
||||
# Clean any legacy clash_api or native_api from /etc/honk/config.dae to avoid conflicts
|
||||
# Clean legacy api configuration from config.dae
|
||||
if [ -f /etc/honk/config.dae ]; then
|
||||
ucode -e '
|
||||
import { readfile, writefile } from "fs";
|
||||
|
||||
@@ -29,7 +29,7 @@ mkdir -p /tmp
|
||||
: > "$LOG_FILE"
|
||||
set_status "DOWNLOADING"
|
||||
|
||||
log "Starting Dashboard deployment to: $TARGET_DIR"
|
||||
log "Deploying dashboard to: $TARGET_DIR"
|
||||
log "Download URL: $DOWNLOAD_URL"
|
||||
|
||||
download_file() {
|
||||
@@ -63,33 +63,33 @@ case "$DOWNLOAD_URL" in
|
||||
DEFAULT_TAG="v0.1.0-beta.8"
|
||||
DEFAULT_TAG_NO_V="${DEFAULT_TAG#[vV]}"
|
||||
FALLBACK_URL="${PREFIX}https://github.com/Zakkaus/doona/releases/download/${DEFAULT_TAG}/doona-${DEFAULT_TAG_NO_V}.tar.gz"
|
||||
log "Checking for latest Doona release online..."
|
||||
log "Checking latest release..."
|
||||
|
||||
RESOLVED_URL=""
|
||||
RELEASES_HTML=$(fetch_text "https://github.com/Zakkaus/doona/releases")
|
||||
LATEST_TAG=$(printf "%s" "$RELEASES_HTML" | grep -o 'releases/tag/[^"/]*' | head -n 1 | sed 's|releases/tag/||')
|
||||
|
||||
if [ -n "$LATEST_TAG" ]; then
|
||||
log "Detected latest release tag: $LATEST_TAG"
|
||||
log "Latest tag: $LATEST_TAG"
|
||||
ASSETS_HTML=$(fetch_text "https://github.com/Zakkaus/doona/releases/expanded_assets/$LATEST_TAG")
|
||||
ASSET_PATH=$(printf "%s" "$ASSETS_HTML" | grep -o '/Zakkaus/doona/releases/download/[^"]*/doona-[^"]*\.tar\.gz' | grep -v 'fonts' | head -n 1)
|
||||
if [ -n "$ASSET_PATH" ]; then
|
||||
RESOLVED_URL="https://github.com${ASSET_PATH}"
|
||||
log "Found release package: $ASSET_PATH"
|
||||
log "Found package: $ASSET_PATH"
|
||||
else
|
||||
TAG_NO_V="${LATEST_TAG#[vV]}"
|
||||
RESOLVED_URL="https://github.com/Zakkaus/doona/releases/download/${LATEST_TAG}/doona-${TAG_NO_V}.tar.gz"
|
||||
log "Standard release package URL inferred: $RESOLVED_URL"
|
||||
log "Inferred package URL: $RESOLVED_URL"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$RESOLVED_URL" ]; then
|
||||
DOWNLOAD_URL="${PREFIX}${RESOLVED_URL}"
|
||||
log "Adaptive resolution succeeded: $DOWNLOAD_URL"
|
||||
log "Resolved URL: $DOWNLOAD_URL"
|
||||
else
|
||||
log "Warning: Online tag resolution unavailable. Falling back to verified release ($DEFAULT_TAG)."
|
||||
log "Online tag resolution failed, fallback: $DEFAULT_TAG"
|
||||
DOWNLOAD_URL="$FALLBACK_URL"
|
||||
log "Fallback download URL: $DOWNLOAD_URL"
|
||||
log "Fallback URL: $DOWNLOAD_URL"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -123,7 +123,7 @@ if [ ! -s "$ARCHIVE_FILE" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Download completed successfully. Extracting archive..."
|
||||
log "Extracting archive..."
|
||||
set_status "EXTRACTING"
|
||||
EXTRACT_DIR="$TMP_DIR/extracted"
|
||||
mkdir -p "$EXTRACT_DIR"
|
||||
@@ -168,7 +168,7 @@ if [ ! -f "$DEPLOY_SRC/index.html" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
log "Deploying new files to $TARGET_DIR..."
|
||||
log "Deploying files to $TARGET_DIR..."
|
||||
mkdir -p "$TARGET_DIR"
|
||||
if [ -n "$TARGET_DIR" ] && [ "$TARGET_DIR" != "/" ] && [ "$TARGET_DIR" != "/etc" ] && [ "$TARGET_DIR" != "/tmp" ]; then
|
||||
rm -rf "${TARGET_DIR:?}"/* "${TARGET_DIR:?}"/.[!.]* 2>/dev/null || true
|
||||
@@ -178,7 +178,7 @@ rm -rf "$TARGET_DIR"/*.md "$TARGET_DIR"/LICENSE* "$TARGET_DIR"/NOTICE "$TARGET_D
|
||||
chmod -R 755 "$TARGET_DIR"
|
||||
|
||||
if [ -f "$TARGET_DIR/index.html" ]; then
|
||||
log "Installation completed successfully!"
|
||||
log "Installed successfully."
|
||||
set_status "SUCCESS"
|
||||
rm -rf "$TMP_DIR"
|
||||
exit 0
|
||||
|
||||
@@ -323,12 +323,10 @@ function switch_dashboard_api(target_type) {
|
||||
let api_file = get_api_file_path();
|
||||
let config_file = get_config_file_path();
|
||||
|
||||
// 1. Clean legacy api blocks from main config.dae to avoid read-only lock in dashboard
|
||||
clean_legacy_api_from_config(config_file);
|
||||
|
||||
system("mkdir -p /etc/honk/config.d");
|
||||
|
||||
// 2. Persist UCI dashboard option to keep UCI and api.dae in sync
|
||||
let u = cursor();
|
||||
if (u) {
|
||||
u.load("honk");
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
'require view';
|
||||
'require form';
|
||||
|
||||
// Scoped helper: auto-dismiss notification after specified timeout (default 3s)
|
||||
function showNotification(title, children, type, timeout) {
|
||||
timeout = (timeout != null) ? timeout : 3000;
|
||||
if (ui && ui.addTimeLimitedNotification) {
|
||||
|
||||
@@ -14,7 +14,7 @@ CodeMirror.defineMode("dae", function(config) {
|
||||
function tokenBase(stream, state) {
|
||||
if (stream.eatSpace()) return null;
|
||||
|
||||
// Comments (Official: comment.line, comment.block)
|
||||
// Comments
|
||||
if (stream.match("#")) {
|
||||
stream.skipToEnd();
|
||||
return "comment";
|
||||
@@ -24,12 +24,12 @@ CodeMirror.defineMode("dae", function(config) {
|
||||
return tokenBlockComment(stream, state);
|
||||
}
|
||||
|
||||
// Word Pattern (Official: bare_literal - ANTLR4 based)
|
||||
// Word pattern
|
||||
// ID: [a-zA-Z_]([a-zA-Z_]|[/\\^*.+0-9-]|[=@$!#%])*
|
||||
// NON ID: [/\\^*.+0-9-]([a-zA-Z_]|[/\\^*.+0-9-]|[=@$!#%])*
|
||||
var wordPattern = /^([a-zA-Z_][a-zA-Z_0-9\/\^*.+\-=@$!#%]*|[\/\^*.+\-0-9][a-zA-Z_0-9\/\^*.+\-=@$!#%]*)/;
|
||||
|
||||
// Outbound detection (Anything after -> or fallback:)
|
||||
// Outbound detection (after -> or fallback:)
|
||||
if (state.expectOutbound) {
|
||||
if (stream.match(wordPattern)) {
|
||||
state.expectOutbound = false;
|
||||
@@ -37,48 +37,46 @@ CodeMirror.defineMode("dae", function(config) {
|
||||
}
|
||||
}
|
||||
|
||||
// Operators (Official: keyword.operator.*)
|
||||
// Operators
|
||||
if (stream.match("->")) return "operator marker";
|
||||
if (stream.match("&&") || stream.match("!")) return "operator";
|
||||
if (stream.match(":")) return "operator";
|
||||
|
||||
// Quoted Strings (Official: quote_literal)
|
||||
// Quoted strings
|
||||
if (stream.match(/^"([^"\\]|\\.)*"/ ) || stream.match(/^'([^'\\]|\\.)*'/)) return "string";
|
||||
|
||||
// Numbers & IPs (Official: literal - styled as constants in Dracula)
|
||||
// Supports IPv4, IPv6 (including hex prefix), and CIDR notation
|
||||
// Numbers & IPs (IPv4, IPv6, CIDR)
|
||||
if (stream.match(/^([0-9]+(\.[0-9]+)+(?:\/[0-9]+)?|[a-fA-F0-9:]*::[a-fA-F0-9:]*(?:\/[0-9]+)?|[a-fA-F0-9]+(:[a-fA-F0-9]+){2,}(?:\/[0-9]+)?|[0-9]+(\.[0-9]+)?(%|[a-zA-Z]+)?)/)) return "number";
|
||||
|
||||
// Struct/Block Header (Official: storage.type.struct)
|
||||
// Block header
|
||||
if (stream.match(new RegExp(wordPattern.source.slice(1) + "\\s*(?={)"))) {
|
||||
return "keyword";
|
||||
}
|
||||
|
||||
// Tag Prefixes (Official: constant.other.id - Styled as variable-2 Cyan)
|
||||
// Tag prefixes
|
||||
if (stream.match(/^(geosite|geoip|pname|domain|dip|sip|dport|sport|l4proto|ipversion_prefer|fixed_domain_ttl)(?=\s*:)/)) {
|
||||
return "variable-2";
|
||||
}
|
||||
|
||||
// Parameters (Official: variable.parameter - Styled as variable-3 Orange)
|
||||
// Parameters
|
||||
if (stream.match(new RegExp(wordPattern.source.slice(1) + "(?=\\s*:)"))) {
|
||||
return "variable-3";
|
||||
}
|
||||
|
||||
// Functions/Matchers (Official: entity.name.function)
|
||||
// Supports (!)? prefix
|
||||
// Matcher functions
|
||||
if (stream.match(new RegExp("(!)?\\s*" + wordPattern.source.slice(1) + "\\s*(?=\\()"))) {
|
||||
return "def";
|
||||
}
|
||||
|
||||
// Official Keywords (Official: outbound)
|
||||
// Keywords
|
||||
if (stream.match(/^(block|direct)\b/)) {
|
||||
return "keyword";
|
||||
}
|
||||
|
||||
// Brackets & Annotations
|
||||
// Brackets
|
||||
if (stream.match(/^[{}()\[\]]/)) return "bracket";
|
||||
|
||||
// Fallback Word (Official: literal)
|
||||
// Fallback identifier
|
||||
if (stream.match(wordPattern)) {
|
||||
return "variable";
|
||||
}
|
||||
|
||||
@@ -168,12 +168,12 @@ return view.extend({
|
||||
'}'
|
||||
].join('\n'));
|
||||
|
||||
// State 0: Loading
|
||||
// Loading view
|
||||
var stateLoading = E('div', { 'class': 'cbi-section', 'style': 'text-align: center; padding: 30px;' }, [
|
||||
E('p', {}, E('em', {}, _('Checking Dashboard and API configuration...')))
|
||||
]);
|
||||
|
||||
// State 1: Unconfigured
|
||||
// Unconfigured view
|
||||
var quickEnableMsg = E('span', { 'style': 'margin-left: 8px;' });
|
||||
var enableBtnText = _('One-click Enable Default Native API');
|
||||
var btnQuickEnable = E('button', {
|
||||
@@ -221,7 +221,7 @@ return view.extend({
|
||||
])
|
||||
]);
|
||||
|
||||
// State: None
|
||||
// Disabled view
|
||||
var selectDashboardNone = createDashboardSelect();
|
||||
var stateNone = E('div', { 'class': 'cbi-section', 'style': 'display: none;' }, [
|
||||
E('h3', {}, _('Dashboard Disabled')),
|
||||
@@ -236,7 +236,7 @@ return view.extend({
|
||||
])
|
||||
]);
|
||||
|
||||
// State 2: Missing UI
|
||||
// Missing UI view
|
||||
var metaUiDir = E('td', {}, profile.defaultDir);
|
||||
var metaController = E('td', {}, '0.0.0.0:9527');
|
||||
var metaSecret = E('td', {}, _('(Not set)'));
|
||||
@@ -326,7 +326,7 @@ return view.extend({
|
||||
E('div', { 'style': 'margin-top: 16px;' }, [ btnStartDownload ])
|
||||
]);
|
||||
|
||||
// State 3: Ready
|
||||
// Ready view
|
||||
var httpsAlert = E('div', { 'class': 'alert-message warning', 'style': 'display: none; margin-bottom: 10px; justify-content: space-between; align-items: center;' }, [
|
||||
E('div', {}, [
|
||||
E('strong', {}, _('HTTPS access detected:') + ' '),
|
||||
@@ -659,7 +659,6 @@ return view.extend({
|
||||
|
||||
loadInfo();
|
||||
|
||||
// Background status check every 5 seconds for service running pill
|
||||
poll.add(function() {
|
||||
if (currentInfo && currentInfo.configured && currentInfo.has_ui) {
|
||||
return honk.callHonkStatus().then(function(res) {
|
||||
|
||||