From fb73ac3a9f3aee8501a887239f8fb268709cb759 Mon Sep 17 00:00:00 2001 From: Aemeath <35622087+tickcount@users.noreply.github.com> Date: Tue, 20 Oct 2026 20:58:36 +0300 Subject: [PATCH] Dawnline 0.12.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - The portal's traffic charts show what came down and what went up apart. A device's last 7 days and "Data this month" draw each day both ways: downloads rise above a thin line, uploads hang below it, on one scale. Beside them "↓ 3.2 GB ↑ 557 MB" instead of one total; hover a day for its own, its date where "left" stands - Charts answer the pointer between their bars too, in the portal and in the admin's daily charts (a device's week, a device card's 30 days, the last 30 days): the figures no longer blink back to the total - The calendar under "Access until" plays its days in only when the row is opened, not again each time the page refreshes with it open - On a phone the page comes in from the top down: "Your access" first, then the devices - "Show key" on a router's set-up morphs to "Hide key" with its icon, and brings the keys themselves into focus (it blurred the field names) --- package/luci-app-dawnline/Makefile | 2 +- .../luci-static/resources/dawnline/app.js | 22 ++-- .../share/dawnline/portal/assets/portal.css | 2 +- .../share/dawnline/portal/assets/portal.js | 12 +- .../root/usr/share/ucode/dawnline/util.uc | 2 +- .../root/usr/share/ucode/dawnline/view.uc | 6 +- tests/ucode/view.test.uc | 7 +- web/package-lock.json | 4 +- web/package.json | 2 +- web/src/admin/device.ts | 5 +- web/src/admin/pages/overview.ts | 5 +- web/src/admin/pages/people.ts | 2 +- web/src/admin/styles/map.css | 10 +- web/src/admin/styles/overview.css | 8 +- web/src/admin/widgets/spark.ts | 6 +- web/src/admin/widgets/tiles.ts | 11 +- web/src/portal/demo/data.ts | 15 ++- web/src/portal/flows/setup-parts.ts | 16 ++- web/src/portal/i18n/portal.pot | 16 +-- web/src/portal/i18n/ru.po | 16 +-- web/src/portal/main.ts | 6 +- web/src/portal/page/access.ts | 62 ++++------- web/src/portal/page/devices.ts | 29 +++-- web/src/portal/styles/access.css | 32 ++---- web/src/portal/styles/bars.css | 104 ++++++++++++++++++ web/src/portal/styles/devices.css | 21 ---- web/src/portal/styles/index.css | 1 + web/src/portal/ui/accordion.ts | 7 +- web/src/portal/ui/bars.ts | 79 +++++++++++++ web/src/portal/ui/feedback.ts | 35 +++--- web/src/shared/types.ts | 8 +- web/tests/bars.test.ts | 40 +++++++ web/tests/demo.test.ts | 2 +- 33 files changed, 396 insertions(+), 199 deletions(-) create mode 100644 web/src/portal/styles/bars.css create mode 100644 web/src/portal/ui/bars.ts create mode 100644 web/tests/bars.test.ts diff --git a/package/luci-app-dawnline/Makefile b/package/luci-app-dawnline/Makefile index 269c72d..477d359 100644 --- a/package/luci-app-dawnline/Makefile +++ b/package/luci-app-dawnline/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-dawnline -PKG_VERSION:=0.11.0 +PKG_VERSION:=0.12.0 PKG_RELEASE:=1 PKG_LICENSE:=MIT # po//dawnline.po becomes luci-i18n-dawnline- (luci.mk), released diff --git a/package/luci-app-dawnline/htdocs/luci-static/resources/dawnline/app.js b/package/luci-app-dawnline/htdocs/luci-static/resources/dawnline/app.js index 7953e6f..8b78eb2 100644 --- a/package/luci-app-dawnline/htdocs/luci-static/resources/dawnline/app.js +++ b/package/luci-app-dawnline/htdocs/luci-static/resources/dawnline/app.js @@ -5,27 +5,27 @@ 'require poll'; 'require rpc'; 'require ui'; -var Ha=Object.create;var Go=Object.defineProperty;var za=Object.getOwnPropertyDescriptor;var Ra=Object.getOwnPropertyNames;var Ia=Object.getPrototypeOf,Ba=Object.prototype.hasOwnProperty;var Oa=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var ja=(n,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ra(e))!Ba.call(n,r)&&r!==o&&Go(n,r,{get:()=>e[r],enumerable:!(s=za(e,r))||s.enumerable});return n};var Ua=(n,e,o)=>(o=n!=null?Ha(Ia(n)):{},ja(e||!n||!n.__esModule?Go(o,"default",{value:n,enumerable:!0}):o,n));var os=Oa((ts,ns)=>{"use strict";var es=(function(){var n=function(S,$){var b=236,C=17,w=S,z=o[$],y=null,f=0,x=null,T=[],I={},Y=function(R,O){f=w*4+17,y=(function(P){for(var U=new Array(P),D=0;D=7&&ne(R),x==null&&(x=V(w,z,T)),se(x,O)},J=function(R,O){for(var P=-1;P<=7;P+=1)if(!(R+P<=-1||f<=R+P))for(var U=-1;U<=7;U+=1)O+U<=-1||f<=O+U||(0<=P&&P<=6&&(U==0||U==6)||0<=U&&U<=6&&(P==0||P==6)||2<=P&&P<=4&&2<=U&&U<=4?y[R+P][O+U]=!0:y[R+P][O+U]=!1)},te=function(){for(var R=0,O=0,P=0;P<8;P+=1){Y(!0,P);var U=r.getLostPoint(I);(P==0||R>U)&&(R=U,O=P)}return O},B=function(){for(var R=8;R>P&1)==1;y[Math.floor(P/3)][P%3+f-8-3]=U}for(var P=0;P<18;P+=1){var U=!R&&(O>>P&1)==1;y[P%3+f-8-3][Math.floor(P/3)]=U}},fe=function(R,O){for(var P=z<<3|O,U=r.getBCHTypeInfo(P),D=0;D<15;D+=1){var G=!R&&(U>>D&1)==1;D<6?y[D][8]=G:D<8?y[D+1][8]=G:y[f-15+D][8]=G}for(var D=0;D<15;D+=1){var G=!R&&(U>>D&1)==1;D<8?y[8][f-D-1]=G:D<9?y[8][15-D-1+1]=G:y[8][15-D-1]=G}y[f-8][8]=!R},se=function(R,O){for(var P=-1,U=f-1,D=7,G=0,ee=r.getMaskFunction(O),X=f-1;X>0;X-=2)for(X==6&&(X-=1);;){for(var be=0;be<2;be+=1)if(y[U][X-be]==null){var Le=!1;G>>D&1)==1);var re=ee(U,X-be);re&&(Le=!Le),y[U][X-be]=Le,D-=1,D==-1&&(G+=1,D=7)}if(U+=P,U<0||f<=U){U-=P,P=-P;break}}},j=function(R,O){for(var P=0,U=0,D=0,G=new Array(O.length),ee=new Array(O.length),X=0;X=0?jo.getAt(Uo):0}}for(var Wo=0,re=0;reX*8)throw"code length overflow. ("+D.getLengthInBits()+">"+X*8+")";for(D.getLengthInBits()+4<=X*8&&D.put(0,4);D.getLengthInBits()%8!=0;)D.putBit(!1);for(;!(D.getLengthInBits()>=X*8||(D.put(b,8),D.getLengthInBits()>=X*8));)D.put(C,8);return j(D,U)};I.addData=function(R,O){O=O||"Byte";var P=null;switch(O){case"Numeric":P=c(R);break;case"Alphanumeric":P=p(R);break;case"Byte":P=u(R);break;case"Kanji":P=k(R);break;default:throw"mode:"+O}T.push(P),x=null},I.isDark=function(R,O){if(R<0||f<=R||O<0||f<=O)throw R+","+O;return y[R][O]},I.getModuleCount=function(){return f},I.make=function(){if(w<1){for(var R=1;R<40;R++){for(var O=l.getRSBlocks(R,z),P=d(),U=0;U"u"?R*4:O;var P="";P+='";for(var D=0;D';P+=""}return P+="",P+="
",P},I.createSvgTag=function(R,O,P,U){var D={};typeof arguments[0]=="object"&&(D=arguments[0],R=D.cellSize,O=D.margin,P=D.alt,U=D.title),R=R||2,O=typeof O>"u"?R*4:O,P=typeof P=="string"?{text:P}:P||{},P.text=P.text||null,P.id=P.text?P.id||"qrcode-description":null,U=typeof U=="string"?{text:U}:U||{},U.text=U.text||null,U.id=U.text?U.id||"qrcode-title":null;var G=I.getModuleCount()*R+O*2,ee,X,be,Le,re="",Ie;for(Ie="l"+R+",0 0,"+R+" -"+R+",0 0,-"+R+"z ",re+=''+le(U.text)+"":"",re+=P.text?''+le(P.text)+"":"",re+='',re+='"u"?R*4:O;var P=I.getModuleCount()*R+O*2,U=O,D=P-O;return H(P,P,function(G,ee){if(U<=G&&G"u"?R*4:O;var U=I.getModuleCount()*R+O*2,D="";return D+="",D};var le=function(R){for(var O="",P=0;P":O+=">";break;case"&":O+="&";break;case'"':O+=""";break;default:O+=U;break}}return O},ve=function(R){var O=1;R=typeof R>"u"?O*2:R;var P=I.getModuleCount()*O+R*2,U=R,D=P-R,G,ee,X,be,Le,re={"██":"█","█ ":"▀"," █":"▄"," ":" "},Ie={"██":"▀","█ ":"▀"," █":" "," ":" "},Be="";for(G=0;G=D?Ie[Le]:re[Le];Be+=` +var Ha=Object.create;var Go=Object.defineProperty;var za=Object.getOwnPropertyDescriptor;var Ra=Object.getOwnPropertyNames;var Ia=Object.getPrototypeOf,Ba=Object.prototype.hasOwnProperty;var Oa=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports);var ja=(n,e,o,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ra(e))!Ba.call(n,r)&&r!==o&&Go(n,r,{get:()=>e[r],enumerable:!(s=za(e,r))||s.enumerable});return n};var Ua=(n,e,o)=>(o=n!=null?Ha(Ia(n)):{},ja(e||!n||!n.__esModule?Go(o,"default",{value:n,enumerable:!0}):o,n));var os=Oa((ts,ns)=>{"use strict";var es=(function(){var n=function(S,$){var b=236,C=17,y=S,z=o[$],k=null,f=0,x=null,T=[],I={},V=function(R,O){f=y*4+17,k=(function(P){for(var U=new Array(P),D=0;D=7&&ne(R),x==null&&(x=Y(y,z,T)),oe(x,O)},J=function(R,O){for(var P=-1;P<=7;P+=1)if(!(R+P<=-1||f<=R+P))for(var U=-1;U<=7;U+=1)O+U<=-1||f<=O+U||(0<=P&&P<=6&&(U==0||U==6)||0<=U&&U<=6&&(P==0||P==6)||2<=P&&P<=4&&2<=U&&U<=4?k[R+P][O+U]=!0:k[R+P][O+U]=!1)},te=function(){for(var R=0,O=0,P=0;P<8;P+=1){V(!0,P);var U=r.getLostPoint(I);(P==0||R>U)&&(R=U,O=P)}return O},B=function(){for(var R=8;R>P&1)==1;k[Math.floor(P/3)][P%3+f-8-3]=U}for(var P=0;P<18;P+=1){var U=!R&&(O>>P&1)==1;k[P%3+f-8-3][Math.floor(P/3)]=U}},fe=function(R,O){for(var P=z<<3|O,U=r.getBCHTypeInfo(P),D=0;D<15;D+=1){var G=!R&&(U>>D&1)==1;D<6?k[D][8]=G:D<8?k[D+1][8]=G:k[f-15+D][8]=G}for(var D=0;D<15;D+=1){var G=!R&&(U>>D&1)==1;D<8?k[8][f-D-1]=G:D<9?k[8][15-D-1+1]=G:k[8][15-D-1]=G}k[f-8][8]=!R},oe=function(R,O){for(var P=-1,U=f-1,D=7,G=0,ee=r.getMaskFunction(O),X=f-1;X>0;X-=2)for(X==6&&(X-=1);;){for(var be=0;be<2;be+=1)if(k[U][X-be]==null){var Le=!1;G>>D&1)==1);var re=ee(U,X-be);re&&(Le=!Le),k[U][X-be]=Le,D-=1,D==-1&&(G+=1,D=7)}if(U+=P,U<0||f<=U){U-=P,P=-P;break}}},j=function(R,O){for(var P=0,U=0,D=0,G=new Array(O.length),ee=new Array(O.length),X=0;X=0?jo.getAt(Uo):0}}for(var Wo=0,re=0;reX*8)throw"code length overflow. ("+D.getLengthInBits()+">"+X*8+")";for(D.getLengthInBits()+4<=X*8&&D.put(0,4);D.getLengthInBits()%8!=0;)D.putBit(!1);for(;!(D.getLengthInBits()>=X*8||(D.put(b,8),D.getLengthInBits()>=X*8));)D.put(C,8);return j(D,U)};I.addData=function(R,O){O=O||"Byte";var P=null;switch(O){case"Numeric":P=c(R);break;case"Alphanumeric":P=p(R);break;case"Byte":P=u(R);break;case"Kanji":P=w(R);break;default:throw"mode:"+O}T.push(P),x=null},I.isDark=function(R,O){if(R<0||f<=R||O<0||f<=O)throw R+","+O;return k[R][O]},I.getModuleCount=function(){return f},I.make=function(){if(y<1){for(var R=1;R<40;R++){for(var O=l.getRSBlocks(R,z),P=d(),U=0;U"u"?R*4:O;var P="";P+='";for(var D=0;D';P+=""}return P+="",P+="
",P},I.createSvgTag=function(R,O,P,U){var D={};typeof arguments[0]=="object"&&(D=arguments[0],R=D.cellSize,O=D.margin,P=D.alt,U=D.title),R=R||2,O=typeof O>"u"?R*4:O,P=typeof P=="string"?{text:P}:P||{},P.text=P.text||null,P.id=P.text?P.id||"qrcode-description":null,U=typeof U=="string"?{text:U}:U||{},U.text=U.text||null,U.id=U.text?U.id||"qrcode-title":null;var G=I.getModuleCount()*R+O*2,ee,X,be,Le,re="",Ie;for(Ie="l"+R+",0 0,"+R+" -"+R+",0 0,-"+R+"z ",re+=''+ie(U.text)+"":"",re+=P.text?''+ie(P.text)+"":"",re+='',re+='"u"?R*4:O;var P=I.getModuleCount()*R+O*2,U=O,D=P-O;return H(P,P,function(G,ee){if(U<=G&&G"u"?R*4:O;var U=I.getModuleCount()*R+O*2,D="";return D+="",D};var ie=function(R){for(var O="",P=0;P":O+=">";break;case"&":O+="&";break;case'"':O+=""";break;default:O+=U;break}}return O},ve=function(R){var O=1;R=typeof R>"u"?O*2:R;var P=I.getModuleCount()*O+R*2,U=R,D=P-R,G,ee,X,be,Le,re={"██":"█","█ ":"▀"," █":"▄"," ":" "},Ie={"██":"▀","█ ":"▀"," █":" "," ":" "},Be="";for(G=0;G=D?Ie[Le]:re[Le];Be+=` `}return P%2&&R>0?Be.substring(0,Be.length-P-1)+Array(P+1).join("▀"):Be.substring(0,Be.length-1)};return I.createASCII=function(R,O){if(R=R||1,R<2)return ve(O);R-=1,O=typeof O>"u"?R*2:O;var P=I.getModuleCount()*R+O*2,U=O,D=P-O,G,ee,X,be,Le=Array(R+1).join("██"),re=Array(R+1).join(" "),Ie="",Be="";for(G=0;G>>8),z.push(x&255)):z.push(C)}}return z}};var e={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},o={L:1,M:0,Q:3,H:2},s={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},r=(function(){var S=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],$=1335,b=7973,C=21522,w={},z=function(y){for(var f=0;y!=0;)f+=1,y>>>=1;return f};return w.getBCHTypeInfo=function(y){for(var f=y<<10;z(f)-z($)>=0;)f^=$<=0;)f^=b<5&&(x+=3+Y-5)}for(var T=0;T=256;)w-=255;return S[w]},C})();function i(S,$){if(typeof S.length>"u")throw S.length+"/"+$;var b=(function(){for(var w=0;w"u")throw"bad rs block @ typeNumber:"+w+"/errorCorrectionLevel:"+z;for(var f=y.length/3,x=[],T=0;T>>7-C%8&1)==1},b.put=function(C,w){for(var z=0;z>>w-z-1&1)==1)},b.getLengthInBits=function(){return $},b.putBit=function(C){var w=Math.floor($/8);S.length<=w&&S.push(0),C&&(S[w]|=128>>>$%8),$+=1},b},c=function(S){var $=e.MODE_NUMBER,b=S,C={};C.getMode=function(){return $},C.getLength=function(y){return b.length},C.write=function(y){for(var f=b,x=0;x+2>>8&255)*192+(T&255),y.put(T,13),x+=2}if(x>>8)},$.writeBytes=function(b,C,w){C=C||0,w=w||b.length;for(var z=0;z0&&(b+=","),b+=S[C];return b+="]",b},$},g=function(){var S=0,$=0,b=0,C="",w={},z=function(f){C+=String.fromCharCode(y(f&63))},y=function(f){if(!(f<0)){if(f<26)return 65+f;if(f<52)return 97+(f-26);if(f<62)return 48+(f-52);if(f==62)return 43;if(f==63)return 47}throw"n:"+f};return w.writeByte=function(f){for(S=S<<8|f&255,$+=8,b+=1;$>=6;)z(S>>>$-6),$-=6},w.flush=function(){if($>0&&(z(S<<6-$),S=0,$=0),b%3!=0)for(var f=3-b%3,x=0;x=$.length){if(w==0)return-1;throw"unexpected end of file./"+w}var f=$.charAt(b);if(b+=1,f=="=")return w=0,-1;if(f.match(/^\s$/))continue;C=C<<6|y(f.charCodeAt(0)),w+=6}var x=C>>>w-8&255;return w-=8,x};var y=function(f){if(65<=f&&f<=90)return f-65;if(97<=f&&f<=122)return f-97+26;if(48<=f&&f<=57)return f-48+52;if(f==43)return 62;if(f==47)return 63;throw"c:"+f};return z},E=function(S,$){var b=S,C=$,w=new Array(S*$),z={};z.setPixel=function(T,I,Y){w[I*b+T]=Y},z.write=function(T){T.writeString("GIF87a"),T.writeShort(b),T.writeShort(C),T.writeByte(128),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(255),T.writeByte(255),T.writeByte(255),T.writeString(","),T.writeShort(0),T.writeShort(0),T.writeShort(b),T.writeShort(C),T.writeByte(0);var I=2,Y=f(I);T.writeByte(I);for(var J=0;Y.length-J>255;)T.writeByte(255),T.writeBytes(Y,J,255),J+=255;T.writeByte(Y.length-J),T.writeBytes(Y,J,Y.length-J),T.writeByte(0),T.writeString(";")};var y=function(T){var I=T,Y=0,J=0,te={};return te.write=function(B,Q){if(B>>>Q)throw"length over";for(;Y+Q>=8;)I.writeByte(255&(B<>>=8-Y,J=0,Y=0;J=B<0&&I.writeByte(J)},te},f=function(T){for(var I=1<>6,128|a&63):a<55296||a>=57344?s.push(224|a>>12,128|a>>6&63,128|a&63):(r++,a=65536+((a&1023)<<10|o.charCodeAt(r)&1023),s.push(240|a>>18,128|a>>12&63,128|a>>6&63,128|a&63))}return s}return e(n)}})();(function(n){typeof define=="function"&&define.amd?define([],n):typeof ts=="object"&&(ns.exports=n())})(function(){return es})});function Jn(n,e){return n==null||n===!1||n===""||(Array.isArray(n)?n.forEach(o=>Jn(o,e)):e.push(n instanceof Node?n:String(n))),e}function t(n,e,o){let s=window.E,r=e!=null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Node);return!r&&o===void 0?s(n,{},Jn(e,[])):s(n,r?e:{},Jn(o,[]))}var qo={phone:'',computer:'',tablet:'',router:'',server:'',other:'',ethernet:'',bridge:'',wifi:'',tunnel:'',plus:'',chart:'',reset:'',package:'',code:'',plug:'',sunrise:'',refresh:'',archive:'',qr:'',copy:'',download:'',link:'',amnezia:'',amneziawg:'',wireguard:'',appstore:'',googleplay:'',github:'',openwrt:'',apple:'',windows:'',linux:'',eye:'',share:'',arrow:'',trash:'',edit:'',pause:'',play:'',key:'',out:'',admin:'',shield:'',shieldplus:'',lock:'',zap:'',check:'',alert:'',x:'',globe:'',home:'',open:'',file:'',network:'',moon:'',chevron:'',clock:'',calendar:'',minus:'',more:'',pin:'',activity:''};function kt(n,e="dl-icon"){let o=qo[n]??qo.phone;return``}function v(n,e="dl-icon"){let o=document.createElement("span");return o.className="dl-icon-wrap",o.innerHTML=kt(n,e),o}function q(n,e="info",o=0){let s=document.querySelector(".dl-toasts");s||(s=t("div",{class:"dl-toasts dl-root",role:"status","aria-live":"polite"}),document.body.appendChild(s));let r=e==="error"?"x":e==="warning"?"alert":e==="success"?"check":null,a=()=>{i.classList.remove("show"),setTimeout(()=>i.remove(),200)},i=t("div",{class:`dl-toast ${e}`},[r?v(r):"",t("span",{},n),e==="error"?t("button",{type:"button","aria-label":_("Close"),click:a},v("x")):""]);s.appendChild(i),requestAnimationFrame(()=>i.classList.add("show")),setTimeout(a,o||(e==="error"?8e3:e==="warning"?5e3:2600))}function Ce(n){return n instanceof Error?n.message:String(n)}async function F(n,e){try{let o=await n();return e&&q(e,"success",3500),o}catch(o){q(Ce(o),"error",1e4);return}}function Fo(n){try{let e=n();e&&typeof e.then=="function"&&e.catch(o=>q(Ce(o),"error"))}catch(e){q(Ce(e),"error")}}function Zn(){return(typeof document>"u"?"":document.documentElement.lang)||"en"}function ie(){let n=Zn();return n==="en"?"en-GB":n}function m(n,...e){let o=0;return n.replace(/%([%sd])/g,(s,r)=>r==="%"?"%":String(e[o++]??""))}function K(n,e){return n.toLocaleString(ie(),e===void 0?void 0:{minimumFractionDigits:e,maximumFractionDigits:e})}function W(n,e,o){return m(N_(n,e,o),K(n))}function ae(n,...e){let o=0;return n.split(/(%[%sd])/).filter(Boolean).map(s=>s==="%%"?"%":s==="%s"||s==="%d"?e[o++]:s)}var Qn=n=>_(n);function Ko(n){if(n&&typeof n=="object"){if(typeof n.error=="string")throw new Error(n.error);typeof n.warning=="string"&&n.warning&&q(n.warning,"warning",12e3)}return n}function Z(n,e=[]){let o=rpc.declare({object:"luci.dawnline",method:n,params:[...e,"lang"]});return async(...s)=>Ko(await o(...e.map((r,a)=>s[a]),Zn()))}var Wa=Z("logs_clear",["person","device","category","older_days"]),Ga=(n={})=>Wa(n.person??"",n.device??"",n.category??"",n.older_days??""),qa=rpc.declare({object:"luci.dawnline",method:"person_update",params:["id","name","access","device_limit","expires","expire_action","expire_warn","quota_gb","quota_period","bonus_gb","hours","note","dns_mode","paused","services","circle","home_nets","server"]});async function Fa(n,e){let s=[n,...["name","access","device_limit","expires","expire_action","expire_warn","quota_gb","quota_period","bonus_gb","hours","note","dns_mode"].map(r=>e[r]),e.paused,e.services,e.circle,e.home_nets,e.server];return Ko(await qa(...s))}var Ka=Z("status",["days"]),N={rev:Z("rev"),personUpdate:Fa,settingsGet:Z("settings_get"),portalInfo:Z("portal_info"),settingsUpdate:Z("settings_update",["values"]),serviceSet:Z("service_set",["id","name","address","ports"]),serviceDelete:Z("service_delete",["id"]),geoClear:Z("geo_clear"),events:Z("events",["limit","person","since"]),logsClear:Ga,interfaces:Z("interfaces",["id"]),serverInterfaces:Z("server_interfaces",["id","auto_wan","wan_device","auto_lan","lan_devices","lan_like","device_mesh","mesh"]),circleSet:Z("circle_set",["id","server","name","color","members"]),circleDelete:Z("circle_delete",["id"]),accessCheck:Z("access_check",["from","to"]),homeHosts:Z("home_hosts",["id"]),usageClear:Z("usage_clear",["scope","id"]),uninstall:Z("uninstall",["confirm"]),status:Ka,setupDefaults:Z("setup_defaults"),serverCreate:Z("server_create",["id","name","ifname","port","subnet","endpoint","mtu","preset","lan_zone","wan_zone","lan_like","portal_enabled","portal_port"]),serverObfuscation:Z("server_obfuscation",["id","preset"]),serverUpdate:Z("server_update",["id","values"]),serverPorts:Z("server_ports",["id"]),endpointProbe:Z("endpoint_probe",["host","id","port"]),serverDelete:Z("server_delete",["id"]),personLinks:Z("person_links",["id"]),personCreate:Z("person_create",["name","slug","server","access","device_limit","expires","quota_gb","quota_period"]),personPause:Z("person_pause",["id","paused"]),personRegen:Z("person_regen",["id","remove"]),personDelete:Z("person_delete",["id"]),personUsage:Z("person_usage",["id","days"]),deviceCreate:Z("device_create",["person","name","kind"]),deviceConfig:Z("device_config",["id"]),deviceUpdate:Z("device_update",["id","name","disabled"]),deviceDelete:Z("device_delete",["id"]),deviceRotate:Z("device_rotate",["id"]),apply:Z("apply"),health:Z("health"),healthFix:Z("health_fix",["id"]),serviceLog:Z("service_log"),serviceLogClear:Z("service_log_clear",["older_days"]),backupList:Z("backup_list"),backupCreate:Z("backup_create"),backupRestore:Z("backup_restore",["name"]),backupDelete:Z("backup_delete",["name"]),backupRead:Z("backup_read",["name"]),backupUpload:Z("backup_upload",["data"]),exportJson:Z("export"),importJson:Z("import",["data"]),updatesStatus:Z("updates_status"),updatesRun:Z("updates_run",["what"]),updatesReleases:Z("updates_releases",["page"]),updatesNotes:Z("updates_notes",["component","tag","build"]),updatesChanges:Z("updates_changes",["from","to"])};function A(n,e,o="neutral",s={}){let{disabled:r,...a}=s,i=t("button",{class:`cbi-button cbi-button-${o}`,type:"button",...a,click:async l=>{if(l.preventDefault(),l.stopPropagation(),!i.disabled){i.disabled=!0,i.classList.add("spinning");try{await e(l)}catch(d){q(Ce(d),"error")}finally{i.disabled=!1,i.classList.remove("spinning")}}}},n);return i.disabled=!!r,i}function $e(n,e,o,s="neutral",r=""){return A([v(n),t("span",{class:"dl-btn-label"},e)],o,s,{title:e,class:`cbi-button cbi-button-${s} dl-icon-btn ${r}`.trim()})}function Te(n){return document.addEventListener("luci-navigate",n),()=>document.removeEventListener("luci-navigate",n)}var _t=null;function Xn(n=!1){let e=_t;_t=null,e?.(n)}function de(n,e,o,s=""){Xn();let r=t("div",{class:`dl-modal ${s}`},e),a=t("div",{class:"button-row"},o);r.addEventListener("keydown",i=>{if(i.key==="Escape"){i.preventDefault(),i.stopPropagation(),ce();return}if(i.key!=="Enter"||i.shiftKey||i.ctrlKey||i.metaKey||i.altKey)return;let l=i.target;if(!l||["TEXTAREA","BUTTON","SELECT","A"].includes(l.tagName))return;let d=a.querySelector(".cbi-button-positive");!d||d.disabled||(i.preventDefault(),d.click())}),ui.showModal(n,[r,a])}function ce(){Xn(),ui.hideModal()}function ue(n=_("Cancel"),e=!1){return t("button",{class:`cbi-button ${e?"cbi-button-negative":"cbi-button-neutral"}`,type:"button",click:ce},n)}function me(n,e,o=_("Confirm"),s=!1){return new Promise(r=>{de(n,e,[ue()," ",t("button",{class:`cbi-button ${s?"cbi-button-negative":"cbi-button-positive"}`,type:"button",click:()=>{let a=_t;_t=null,ui.hideModal(),a?.(!0)}},o)]),_t=r})}Te(()=>{_t&&(Xn(),ui.hideModal())});async function xe(n,e=_("Copied to clipboard"),o=!1){try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(n);else{let s=t("textarea",{style:"position:fixed;opacity:0"},n);document.body.appendChild(s),s.select();let r=document.execCommand("copy");if(s.remove(),!r)throw new Error(_("Copying is blocked here. Select the text and copy it by hand."))}return q(e,"success",2500),!0}catch(s){return o||q(Ce(s),"error"),!1}}function Ne(n,e,o="text/plain"){let s=globalThis,r=typeof e=="string"?new s.Blob([e],{type:o}):e,a=URL.createObjectURL(r),i=t("a",{href:a,download:n,style:"display:none"});document.body.appendChild(i),i.click(),setTimeout(()=>{URL.revokeObjectURL(a),i.remove()},1e3)}function eo(n,e){return new Promise(o=>{let s=t("input",{type:"file",accept:n,style:"display:none"});s.addEventListener("cancel",()=>{s.remove(),o(null)}),s.addEventListener("change",()=>{let r=s.files?.[0];if(s.remove(),!r)return o(null);let a=new FileReader;a.onload=()=>{let i=String(a.result??"");o({name:r.name,data:e==="base64"?i.replace(/^data:[^,]*,/,""):i})},a.onerror=()=>o(null),e==="base64"?a.readAsDataURL(r):a.readAsText(r)}),document.body.appendChild(s),s.click()})}function Se(n,e){let o=document.querySelector(".dl-dd");if(o&&(o.dlClose?o.dlClose():o.remove(),o.dlAnchor===n))return;let s=t("div",{class:"dl-dd dl-root",role:"menu"},e.map(u=>u?t("button",{type:"button",role:"menuitem",class:u.danger?"danger":u.warn?"warn":"",click:()=>{p(),Fo(u.run)}},[u.icon??"",t("span",{},u.label)]):t("hr")));document.body.appendChild(s);let r=n.getBoundingClientRect(),a=s.offsetWidth,i=s.offsetHeight;s.style.top=`${r.bottom+6+i>window.innerHeight-8&&r.top-6-i>8?r.top-6-i:r.bottom+6}px`,s.style.left=`${Math.max(8,Math.min(r.right-a,window.innerWidth-a-8))}px`;let l=u=>{!s.contains(u.target)&&!n.contains(u.target)&&p()},d=u=>{if(u.key==="Escape"||u.key==="Tab")return p();let k=[...s.querySelectorAll("button:not([disabled])")];if(!k.length||!["ArrowDown","ArrowUp","Home","End"].includes(u.key))return;u.preventDefault();let M=k.indexOf(document.activeElement),g=u.key==="Home"?0:u.key==="End"?k.length-1:u.key==="ArrowDown"?(M+1)%k.length:(M-1+k.length)%k.length;k[g].focus({preventScroll:!0})},c=Te(p);s.dlAnchor=n,s.dlClose=p;function p(){s.remove(),c(),document.removeEventListener("mousedown",l,!0),document.removeEventListener("keydown",d,!0),window.removeEventListener("scroll",p,!0)}setTimeout(()=>{document.addEventListener("mousedown",l,!0),document.addEventListener("keydown",d,!0),window.addEventListener("scroll",p,!0)}),s.querySelector("button")?.focus({preventScroll:!0})}var gt=null,nt=null,to=0;function Ct(){gt&&(gt.style.display="none"),nt=null,clearInterval(to),to=0}function we(n,e){let o=s=>{gt??(gt=document.body.appendChild(t("div",{class:"dl-tip dl-tip-float dl-root"}))),gt.replaceChildren(...e().map(r=>typeof r=="string"?document.createTextNode(r):r)),gt.style.display="",gt.style.left=`${s.clientX}px`,gt.style.top=`${s.clientY-10}px`,nt=n,to||(to=window.setInterval(()=>{(!nt?.isConnected||!nt.getClientRects().length)&&Ct()},400))};n.addEventListener("mouseenter",o),n.addEventListener("mousemove",o),n.addEventListener("mouseleave",Ct),n.addEventListener("pointerup",s=>{s.pointerType!=="mouse"&&(nt===n?Ct():o(s))})}Te(Ct);window.addEventListener("scroll",()=>nt&&Ct(),{capture:!0,passive:!0});document.addEventListener("pointerdown",n=>{nt&&!nt.contains(n.target)&&Ct()},!0);function Ya(n,e,o){let s=0;for(;n>=o&&s=100||s===0?K(Math.round(n)):K(n,1)} ${e[s]}`}function oe(n){return Ya(!n||n<0?0:n,[_("B"),_("KB"),_("MB"),_("GB"),_("TB")],1024)}function Fe(n){let e=n*8,o=[_("bit/s"),_("kbit/s"),_("Mbit/s"),_("Gbit/s")];if(e<1e3)return`${K(Math.round(e))} ${o[0]}`;let s=e<1e6?1:e<1e9?2:3,r=e/1e3**s;return`${K(r,s===3||r<10?1:0)} ${o[s]}`}function pe(n,e=Date.now()/1e3){if(!n)return _("never");let o=Math.max(0,Math.round(e-n));return o<60?_("just now"):o<3600?m(_("%s min ago"),Math.floor(o/60)):o<86400?m(_("%s h ago"),Math.floor(o/3600)):o<86400*30?m(_("%s d ago"),Math.floor(o/86400)):new Date(n*1e3).toLocaleDateString(ie(),{day:"numeric",month:"short",year:"numeric"})}function ot(n){if(!n||n<0)return"—";let e=Math.floor(n/86400),o=Math.floor(n%86400/3600),s=Math.floor(n%3600/60);return e?m(_("%sd %sh"),e,o):o?m(_("%sh %sm"),o,s):m(_("%sm"),s)}function Ut(n){let e=new Date(n*1e3),o=new Date,s=e.toDateString()===o.toDateString(),r=e.toLocaleTimeString(ie(),{hour:"2-digit",minute:"2-digit"});return s?r:`${e.toLocaleDateString(ie(),{day:"numeric",month:"short"})} ${r}`}function Ke(n){return`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`}function Mt(n){let[e,o,s]=n.split("-").map(Number);return new Date(e,(o||1)-1,s||1,12)}function Oe(n){return(typeof n=="string"?/^\d{4}-\d{2}-\d{2}$/.test(n)?Mt(n):new Date(n):n).toLocaleDateString(ie(),{day:"numeric",month:"short",year:"numeric"})}function De(n){return n?Oe(n):""}function no(n,e){let o=s=>{let[r,a,i]=s.split("-").map(Number);return Date.UTC(r,a-1,i)};return Math.round((o(n)-o(e))/864e5)}function jt(n,e){let o=Mt(n);return o.setDate(o.getDate()+e),Ke(o)}function Lt(n,e){let[o,s,r]=n.split("-").map(Number),a=new Date(o,s-1+e,1,12),i=new Date(a.getFullYear(),a.getMonth()+1,0).getDate();return a.setDate(Math.min(r,i)),Ke(a)}function Ge(n){return n?.length?n[n.length-1].day:Ke(new Date)}function Yo(n,e,o,s,r=30){let a=n||s;return e==="day"?jt(a,o):e==="week"?jt(a,7*o):e==="month"?Lt(a,o):e==="year"?Lt(a,12*o):jt(a,r*o)}function st(n,e=Date.now()){if(!n)return null;let o=typeof e=="number"?Ke(new Date(e)):e,s=no(n,o);return s>=0?s+1:s}function rt(n,e){return e!=null&&e>0&&n.expire_warn>0&&e<=n.expire_warn}function an(n){return n<=1?_("ends today"):n===2?_("ends tomorrow"):W(n,"ends in %s day","ends in %s days")}function Et(n){return n<1024?`${K(n)} ${_("B")}`:n<1048576?`${K(n/1024,n<10240?1:0)} ${_("KB")}`:`${K(n/1048576,1)} ${_("MB")}`}function vt(n){return{lan:_("Home network"),internet:_("Internet"),both:_("Home network + Internet")}[n]}var Vo=["computer","phone","tablet","router","other"];function at(n){return{computer:_("PC"),phone:_("Phone"),tablet:_("Tablet"),router:_("Router"),other:_("Other")}[n]}function Jo(n){return{active:_("Active"),paused:_("Paused"),expired:_("Expired"),quota:_("Data limit reached"),hours:_("Outside allowed hours"),no_server:_("No server"),server_off:_("Server is turned off")}[n]}function je(n){let e=n.trim().split(/\s+/).filter(Boolean);if(!e.length)return"?";let o=e[0][0]??"",s=e.length>1?e[e.length-1][0]??"":e[0][1]??"";return(o+s).toUpperCase()}function ln(n){let e=o=>o.disabled?3:o.online?0:o.handshake?1:2;return n.map((o,s)=>[o,s]).sort((o,s)=>e(o[0])-e(s[0])||o[1]-s[1]).map(([o])=>o)}function Pe(n,e,o){return t("span",{class:`dl-pill ${n}`,title:o??null},e)}function Va(n){return n.state==="active"?"ok":n.state==="quota"||n.state==="expired"?"bad":"warn"}function Ja(n){return n.state==="server_off"&&n.paused?"paused":n.state}function Zo(n){let e=Ja(n);return e==="active"||e==="server_off"?"":Pe(Va({...n,state:e}),Jo(e))}function Qo(n){let e=n.access==="both"?["lan","inet"]:n.access==="lan"?["lan"]:["inet"],o=t("span",{class:"dl-access","aria-label":vt(n.access)},e.map(s=>t("span",{class:`dl-ibadge ${s}`},v(s==="lan"?"home":"globe"))));return we(o,()=>[t("div",{class:"dl-tip-title"},vt(n.access)),n.access==="lan"&&n.services?.length?t("div",{class:"dl-muted"},W(n.services.length,"%s home service only","%s home services only")):""]),o}function Za(n){return{active:null,paused:_("Paused"),expired:_("Access ended"),quota:_("Data limit"),hours:_("Outside hours"),server_off:_("Server off"),no_server:_("No server")}[n]}function dn(n,e,o=_("Not set up yet"),s){let r=new Date(n.handshake*1e3).toLocaleString(ie()),a=n.handshake?`${m(_("Last seen %s"),pe(n.handshake,e))} · ${r}`:"";if(n.disabled)return t("span",{class:"dl-dstat",title:a},_("Disabled"));if(n.online)return t("span",{class:"dl-dstat ok"},_("Connected"));let i=s&&Za(s.state);return i?t("span",{class:"dl-dstat warn",title:a||_("Not connected yet")},i):n.handshake?t("span",{class:"dl-dstat",title:r},m(_("Last seen %s"),pe(n.handshake,e))):t("span",{class:"dl-dstat warn",title:_("Waiting for the first connection")},o)}var cn=null;function Xo(n,e,o,s){cn?.close();let r=t("aside",{class:"dl-drawer",role:"dialog","aria-modal":"true"},[t("div",{class:"dl-drawer-head"},[n,t("button",{type:"button",class:"dl-drawer-x","aria-label":_("Close"),click:()=>c()},v("x"))]),t("div",{class:"dl-drawer-body"},e),o?t("div",{class:"dl-drawer-foot"},o):""]),a=t("div",{class:"dl-drawer-overlay dl-root",click:u=>{u.target===a&&c()}},r),i=u=>{u.key==="Escape"&&!document.body.classList.contains("modal-overlay-active")&&c()},l=!1,d=Te(()=>c());function c(){l||(l=!0,d(),document.removeEventListener("keydown",i),a.classList.remove("open"),setTimeout(()=>a.remove(),220),cn===p&&(cn=null),s())}let p={close:c,panel:r};return document.addEventListener("keydown",i),document.body.appendChild(a),requestAnimationFrame(()=>a.classList.add("open")),cn=p,p}function ge(n,e,o){return t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},n),o?t("span",{class:"dl-sub"},o):""]),t("div",{class:"dl-setrow-ctl"},e)])}function _e(n,e,o,s=e){let r=ge(n,s," "),a=r.querySelector(".dl-sub"),i=()=>{let l=o();a.textContent=l.text,a.classList.toggle("bad",l.bad),e.classList.toggle("cbi-input-invalid",l.bad)};return e.addEventListener("input",i),r.refresh=i,r.help=o,i(),r}function Ee(n,e,o,s=e){let r=t("div",{class:"dl-sub"}),a=t("div",{class:"cbi-value dl-live"},[t("div",{class:"cbi-value-title"},[t("label",{},n),r]),t("div",{class:"cbi-value-field"},s)]),i=()=>{let l=o();r.textContent=l.text,r.classList.toggle("bad",l.bad),e.classList.toggle("cbi-input-invalid",l.bad)};return e.addEventListener("input",i),e.addEventListener("change",i),a.refresh=i,a.help=o,i(),a}function Ue(n,e=[]){for(let o of n){let s=o.help?.();if(s?.bad)return s.text}for(let o of e){let s=o();if(s.bad)return s.text}return null}function Wt(n,e,o,s=""){return t("section",{class:`dl-setsec ${s}`},[t("div",{class:"dl-setsec-body"},[n?t("h3",{},n):"",...e]),o.length?t("div",{class:"dl-setsec-foot"},o):""])}function ke(n,e,o,s){return t("div",{class:"dl-group"},[t("div",{class:"dl-group-head"},[t("span",{class:"dl-group-ic"},v(n)),t("span",{class:"dl-stack"},[t("b",{},e),o?t("span",{class:"dl-sub"},o):""])]),t("div",{class:"dl-group-body"},s.filter(r=>r!==""))])}function it(n,e,o,s,r){return t("div",{class:`dl-row dl-need-row ${e}`},[e?t("span",{class:"dl-need-ic"},v(n)):v(n),t("span",{class:"dl-row-main dl-stack"},[t("b",{},o),t("span",{class:"dl-sub"},s)]),r])}function bt(n,e){let o={ok:"success",warn:"warning",error:"error",info:"notice"}[n];return t("div",{class:`alert-message ${o}`},e)}function Tt(n,e=""){let o=t("div",{class:e});return o.innerHTML=n,o}var rs=Ua(os(),1),Qa=n=>``,ss="#0a0a0a",Xa="#f2f2f2",ei={night:[ss,Xa],day:["#ffffff",ss]},ti=n=>n.length>300,St=n=>+n.toFixed(2);function oo(n,e,o,s,r){return`M${St(n+r)} ${St(e)}h${St(o-2*r)}a${r} ${r} 0 0 1 ${r} ${r}v${St(s-2*r)}a${r} ${r} 0 0 1 -${r} ${r}h-${St(o-2*r)}a${r} ${r} 0 0 1 -${r} -${r}v-${St(s-2*r)}a${r} ${r} 0 0 1 ${r} -${r}z`}function pn(n,e=3,o=!0,s="plain"){let r=ti(n),a=s!=="plain",[i,l]=a?ei[s]:["#fff","#000"],d=(0,rs.default)(0,r?"L":"H");d.addData(n,"Byte"),d.make();let c=d.getModuleCount(),p=c+e*2,u=o&&!r?Math.round(c*.22):0;u&&(c-u)%2&&u++;let k=(c-u)/2,M=k+u,g=(b,C)=>u>0&&b>=k&&b=k&&Ca&&(C<7&&b<7||C<7&&b>=c-7||C>=c-7&&b<7),E="";if(a){let b=r?.48:.42;for(let C=0;C${Qa(a?i:"#fff")}`}let $=``;return a?`${$}${S}`:`${$}${S}`}function xt(){let n=document.documentElement.getAttribute("data-darkmode");return n!=null?n==="true":window.matchMedia?.("(prefers-color-scheme: dark)").matches??!1}function un(n){let e=xt();return Tt(pn(n,3,!0,e?"night":"day"),`dl-qr${e?"":" light"}`)}function so(n){let e=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/.exec(n.trim());if(!e)return null;let[o,s,r,a]=e.slice(1,5).map(Number),i=Number(e[5]);if([o,s,r,a].some(c=>c>255)||i<8||i>30)return null;let l=o*2**24+s*2**16+r*2**8+a,d=2**(32-i);return{net:l-l%d,size:d}}var ni=(n,e)=>n.netso(n));function $t(n){return n.split("/")[0].split(".").slice(0,3).join(".")}function mn(n){return`${n.trim()}.0/24`}function ao(n,e,o){let s=n.trim(),r=/^\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(s)?so(mn(s)):null;if(!r)return{text:_("Three numbers, like 10.77.0."),bad:!0};if(!oi.some(i=>r.net>=i.net&&r.net+r.size<=i.net+i.size))return{text:_("Use a private range: 10.x.x, 172.16–31.x or 192.168.x."),bad:!0};let a=e.find(i=>{let l=so(i.cidr);return l!=null&&ni(r,l)});if(a){let i=a.cidr.endsWith("/24")?`${$t(a.cidr)}.x`:a.cidr,l=m(_("%s already uses %s."),a.name,i);return{text:o&&o!==s?`${l} ${m(_("Try %s."),o)}`:l,bad:!0}}return{text:m(_("Devices get %s – %s, the router %s."),`${s}.2`,`${s}.254`,`${s}.1`),bad:!1}}var is=(n,e)=>e.find(o=>o.from<=n&&n<=o.to)?.who??null,si=n=>Number.isInteger(n)&&n>=1&&n<=65535;function Gt(n,e,o){if(!si(n))return{text:_("Use a port from 1 to 65535."),bad:!0};let s=is(n,e);return s?{text:m(_("Used by %s. Choose another port."),s),bad:!0}:{text:o,bad:!1}}function hn(n,e,o){let s=o?m(_("HTTPS here, plain HTTP for links on IP addresses on %s."),n+1):_("HTTPS on this port, opened on WAN."),r=Gt(n,e,s);if(r.bad||!o)return r;if(n===65535)return{text:_("Links on IP addresses also need the next port: choose a lower one."),bad:!0};let a=is(n+1,e);return a?{text:m(_("Links on IP addresses also need %s, used by %s. Choose another port."),n+1,a),bad:!0}:r}var io=n=>Array.from(n).length,as=48,ri=/[<>"\\\u0000-\u001f\u007f]/,ls=(n,e)=>m(N_(n,"Up to %s character (%s now).","Up to %s characters (%s now)."),K(n),K(io(e)));function He(n,e=[],o=""){let s=n.trim();return s?io(n)>as?{text:ls(as,n),bad:!0}:ri.test(n)?{text:_('Names can’t contain < > " or \\.'),bad:!0}:e.some(r=>r.toLowerCase()===s.toLowerCase())?{text:m(_("“%s” already exists - pick another name."),s),bad:!0}:{text:o,bad:!1}:{text:_("Enter a name."),bad:!0}}function ds(n,e=[]){return io(n)>32?{text:ls(32,n),bad:!0}:He(n,e,_("Shown on the person cards."))}var ai=/^[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,ii=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function Dt(n){let e=ii.exec(n);return!!e&&e.slice(1).every(o=>Number(o)<=255)}function ro(n){return/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/.test(n)&&!/:::/.test(n)}function Pt(n,e,o=null){let s=n.trim();if(!s)return o!=null?{text:o,bad:!1}:{text:_("Enter a hostname or IP address."),bad:!0};if(/^[a-z]+:\/\//i.test(s))return{text:_("Leave out https:// - just the name."),bad:!0};if(/\/.*/.test(s))return{text:_("Just the name, without a path."),bad:!0};if(/^[^:\[]+:\d+$/.test(s))return{text:_("Just the name, without a port (the port is on AmneziaWG)."),bad:!0};if(/\s/.test(s))return{text:_("A hostname has no spaces."),bad:!0};if(s.length>253||!(ai.test(s)||Dt(s)||ro(s)))return{text:_("Use a hostname or an IP address."),bad:!0};let r=ro(s)?`[${s}]`:s;return{text:e?m(_("Devices connect to %s."),`${r}:${e}`):m(_("Links use %s."),r),bad:!1}}function cs(n,e){let o=n.split(/[ ,]+/).filter(Boolean);if(!o.length)return{text:m(_("This router (%s): queries go where your home network sends them, and home names work."),e),bad:!1};let s=o.find(a=>!Dt(a)&&!ro(a));if(s)return{text:m(_("“%s” is not an IP address. Separate several with commas."),s),bad:!0};let r=new Intl.ListFormat(ie(),{type:"conjunction"}).format(o);return{text:m(_("Devices use %s - home names and your LAN’s DNS filters no longer apply to them."),r),bad:!1}}function ps(n,e){let o=n.trim();if(!o)return{text:m(_("Automatic by device type and disguise: %s for computers and routers, %s for phones and tablets."),e.computer,e.phone),bad:!1};if(!/^\d{1,4}$/.test(o)||Number(o)<1280||Number(o)>1500)return{text:_("MTU must be 1280–1500, or empty for automatic."),bad:!0};let s=Number(o);return{text:m(_("Computers and routers get %s, phones and tablets %s."),s,Math.min(s,1280)),bad:!1}}function us(n){let e=n.trim();return e?!/^\d{1,3}$/.test(e)||Number(e)>600?{text:_("Use 0–600 seconds."),bad:!0}:Number(e)===0?{text:_("Off: NAT may close the tunnel when idle, and “Connected” lags."),bad:!1}:{text:m(_("Devices send a packet every %s s to keep NAT open (a little battery on phones)."),e),bad:!1}:{text:_("Default: a packet every 25 s keeps NAT open and “Connected” accurate."),bad:!1}}function fn(n,e=0){let o=n.trim();if(!/^\d{1,2}$/.test(o)||Number(o)<1||Number(o)>32)return{text:_("Use 1–32."),bad:!0};let s=Number(o);return e>s?{text:e-s===1?m(N_(e,"Already has %s device: remove one first, or allow more.","Already has %s devices: remove one first, or allow more."),K(e)):m(N_(e,"Already has %s device: remove %s first, or allow more.","Already has %s devices: remove %s first, or allow more."),K(e),K(e-s)),bad:!0}:{text:W(s,"They can add %s device themselves.","They can add %s devices themselves."),bad:!1}}function gn(n,e=!0){let o=n.trim();if(!o)return{text:_("Optional. No data limit."),bad:!1};let s=Number(o);return!/^\d+(\.\d+)?$/.test(o)||s<0||s>1e5?{text:_("A number of GB, up to 100000."),bad:!0}:s===0?{text:_("Optional. No data limit."),bad:!1}:{text:m(e?_("Paused after %s GB this month, resumed on the 1st."):_("Paused after %s GB in total."),K(s)),bad:!1}}function ms(n,e,o,s){let r=n.trim();if(!r)return{text:_("Optional. No end date."),bad:!1};let a=o(r,e);return a==null?{text:_("Use a date."),bad:!0}:a<0?{text:_("That date has passed: access would end at once."),bad:!0}:{text:a===1?m(_("Access ends today (%s)."),s(r)):m(N_(a,"Access ends in %s day (%s).","Access ends in %s days (%s)."),K(a),s(r)),bad:!1}}function hs(n,e=null){let o=n.trim();return o?Dt(o)?e&&!e(o)?{text:m(_("%s is not in any home network of this server: nobody would reach it."),o),bad:!1}:{text:"",bad:!1}:{text:_("Use an IPv4 address, like 192.168.1.10."),bad:!0}:{text:_("The device’s address at home."),bad:!0}}function fs(n){let e=n.split(/[ ,]+/).filter(Boolean);if(!e.length)return{text:_("All ports."),bad:!1};let o=e.find(s=>!/^\d{1,5}$/.test(s)||Number(s)<1||Number(s)>65535);return o?{text:m(_("“%s” is not a port (1–65535)."),o),bad:!0}:{text:m(N_(e.length,"Port %s.","Ports %s."),e.join(", ")),bad:!1}}function gs(n){let e=n.trim();return e?/^https?:\/\//i.test(e)?e.length>300||!/^https?:\/\/[A-Za-z0-9.-]+(:[0-9]+)?(\/[^\s"'<>]*)?$/.test(e)?{text:_("Not a usable address (no spaces or quotes)."),bad:!0}:{text:_("Wrong links are sent there instead of a “Not found”."),bad:!1}:{text:_("Must start with http:// or https://."),bad:!0}:{text:_("Wrong links get a bare “Not found”."),bad:!1}}function vs(n,e="phone.myata"){let o=n.trim();return o?/^[a-z0-9-]{1,32}(\.[a-z0-9-]{1,32})*$/.test(o)?{text:m(_("Devices get names like %s."),`${e}.${o}`),bad:!1}:{text:/[A-Z]/.test(o)?_("Lowercase only."):_("Lowercase letters, digits, dashes and dots."),bad:!0}:{text:m(_("The default, lan: devices get names like %s."),`${e}.lan`),bad:!1}}function bs(n){let e=n.trim();return e?Dt(e)?{text:m(_("%s takes over when the tunnel is down."),e),bad:!1}:{text:_("Use an IPv4 address, or leave it empty."),bad:!0}:{text:_("None: without the tunnel those devices have no DNS."),bad:!1}}function xs(n){let e=n.trim();return/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(e)?{text:m(_("Runs within an hour after %s (router time)."),e),bad:!1}:{text:_("Use HH:MM, 00:00–23:59."),bad:!0}}function lo(n,e,o,s={}){let r=0,a="",i=null;return{help:()=>{let{host:c,port:p}=n(),u=Pt(c,p,s.empty??null);return u.bad||!c.trim()?u:i&&i.host===c.trim()?{text:i.text,bad:i.bad}:{text:`${s.idle?.()||u.text} ${_("Checking where it points…")}`,bad:!1}},schedule:()=>{let{host:c}=n(),p=Pt(c,n().port,s.empty??null);p.bad||!c.trim()||c.trim()===i?.host||(clearTimeout(r),r=window.setTimeout(async()=>{let u=c.trim();a=u;try{let{id:k,port:M}=n(),g=await e(u,k,M);if(a!==u)return;i={host:u,text:g.text,bad:g.status==="error"}}catch{if(a!==u)return;i={host:u,text:p.text,bad:!1}}o()},700))}}}var co=["%d system package","%d system packages","%s (after %d repair)","%s (after %d repairs)","%s - %d repairs didn't help","%s - %s","%s - not repaired again (%d repairs didn't help)","%s has no IPv4 address.","%s is not a bridge, so Dawnline cannot join the LAN as a device.","%s needs a manual switch in Components","%s still give devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations.","%s still gives devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations.","%s · restored","Access rules","Activity","AmneziaWG is missing from the router","AmneziaWG is running again","AmneziaWG is running again · accepting connections on port %d","AmneziaWG isn't accepting connections on port %d","AmneziaWG isn't running","Backup","Browsers will refuse the portal after that. Renew it with ACME, or choose another certificate in Settings.","Choose another interface name in the server settings.","Components","Connections","DNS for Home-only devices","Dawnline didn't stop it: the router's network restarted, someone stopped it by hand, or it failed.","Firewall","Install it in Dawnline → Components.","Internet like a home device","MTU is now automatic","Missing: %s.","No LAN detected.","No free address on %s.","No free link-local range for the internal link.","No free routing table.","People","Personal links","Personal portal","Router","Servers","Speed","System packages","The new version did not answer in LuCI or its agent did not start. Try again from Components, or install it with install.sh to see why.","Traffic","Watchdog","a new build needs a manual switch in Components","answers again","are loaded again","are missing","automatic update failed","background check failed: %s","can't reach Dawnline (luci.dawnline is missing in rpcd)","can't use the network interface %s: it exists and isn't Dawnline's","certificate expires %s","certificate expires within 7 days","certificate renewed · valid until %s","couldn't be repaired: %s","couldn't be updated - the previous rules stay, and changes to access wait until they load","couldn't load - no device is loaded into the tunnels until they do","couldn't load devices into the tunnel","couldn't start","couldn't start · %d failed attempts in %d min","failed - internet goes out directly for now","failed: %s",'has an invalid interface name "%s"',"installed the %s build","installed the %s build · %s","is kept down","is kept down: its disguise needs AmneziaWG %s (installed: %s)","is kept down: its disguise needs AmneziaWG %s (installed: none)","is off","is on · traffic enters %s as %s","is ready again","isn't answering on port %d","isn't installed: no tunnel can run - install it in Dawnline → Components","isn't installed: tunnels were left as they are","isn't known to the network service - restart the network or reboot","isn't running","isn't running on this router (fw4): tunnels and the portal are closed","kernel module isn't installed: no tunnel can run - install it in Dawnline → Components","kernel module isn't loaded","loading it","loading them again","moved to word codes","netifd reads its protocol handlers when it starts; it was running before AmneziaWG was installed.","network changed - Dawnline set itself up again","nightly backup failed: %s","public address changed · %s → %s","reaches Dawnline again","reloading rpcd","restarted · version %s","restarting for the AmneziaWG update","restarting it","restoring them","rules for Dawnline are in place again","rules for Dawnline aren't loaded","rules for Dawnline were changed or removed","runs again","setting it up again","started","started with the router · version %s","started · accepting connections on port %s","started · version %s","stopped unexpectedly","stopped unexpectedly - started again","update failed","update to %s failed its check - rolled back to %s","updated automatically · %s","updated automatically · %s → %s","updated · %s","updated · %s → %s","updates available · %s","was broken - set up again (%s as %s)"];var li={connect:"connections",disconnect:"connections",roam:"connections",device_added:"people",device_removed:"people",devices_removed:"people",device_changed:"people",device_keys:"people",link_changed:"people",person_added:"people",person_removed:"people",person_changed:"people",paused:"people",resumed:"people",expiring:"people",expired_kept:"people",portal_blocked:"problems"},Nt=["connections","people","problems"];function Ye(n){return{connections:_("Connections"),people:_("People"),problems:_("Problems")}[n]}function ws(n){return{connections:_("Connects, disconnects and IP changes"),people:_("People and their devices added, changed, paused, removed"),problems:_("Blocked portal sign-ins (tunnels and services are in the service log)")}[n]}var qt=n=>li[n]??"problems";function Ft(n){return{awg:"AmneziaWG",dawnline:"Dawnline",portal:_("Portal")}[n]??n}var di=["person_added","person_removed","person_changed"];function Ve(n){return n.by?n.by:di.includes(n.type)||n.detail==="by admin"||n.detail?.endsWith(" (admin)")?"admin":n.detail?.endsWith(" (portal)")?"portal":null}function ys(n){return(n.detail??"").replace(/ \((admin|portal)\)$/,"").replace(/^by admin$/,"")}var vn=n=>n.sys?["error","repair","down"].includes(n.sys.level):qt(n.ev.type)==="problems";function bn(n){let e=n.keep_days>0?W(n.keep_days,"%s day","%s days"):_("no age limit"),o=n.persist==="off"?_("kept in memory only (lost on reboot)"):n.persist==="10min"?_("saved to flash every 10 minutes"):_("saved to flash hourly");return m(_("Kept for %s, %s, %s."),e,W(n.max,"up to %s event","up to %s events"),o)}function po(n){return{"paused by admin":_("paused by admin"),"end date reached":_("end date reached"),"data limit reached":_("data limit reached"),"outside allowed hours":_("outside allowed hours"),"no server":_("no server"),"server turned off":_("server turned off")}[n]??n}function ks(n){let e=/^(\d+) days?$/.exec(n);return e?Number(e[1]):null}function _s(n){let e={name:_("name"),access:_("access"),device_limit:_("device limit"),expires:_("end date"),expire_action:_("what happens at the end"),expire_warn:_("warning before the end"),quota_gb:_("data limit"),quota_period:_("data limit period"),bonus_gb:_("extra data"),hours:_("allowed hours"),dns_mode:_("DNS"),paused:_("pause"),services:_("home services"),circle:_("circle","setting"),home_nets:_("home networks"),server:_("server")};return n.split(", ").map(o=>{let s=/^moved to (.+)$/.exec(o)?.[1];return s?m(_("moved to %s"),s):e[o]??o.replace(/_/g," ")}).join(", ")}function Cs(n,e,o){let r={"cleared|the service log":_("You cleared the service log"),"cleared|the activity log":_("You cleared the activity log"),"exported|all settings":_("You exported all settings"),"imported|settings from a file":_("You imported settings from a file"),"restored|from a file":_("You restored a backup from a file"),"turned on|the personal portal":_("You turned on the personal portal"),"turned off|the personal portal":_("You turned off the personal portal"),"changed|the personal portal":_("You changed the personal portal"),"turned on|the watchdog":_("You turned on the watchdog"),"turned off|the watchdog":_("You turned off the watchdog"),"reset traffic history|for everyone":_("You reset traffic history for everyone")}[`${n}|${o??""}`];if(r)return{text:r,named:!1};let i={"created|server":_("You created server %s"),"changed|server":_("You changed server %s"),"removed|server":_("You removed server %s"),"turned on|server":_("You turned on server %s"),"turned off|server":_("You turned off server %s"),"added|circle":_("You added circle %s"),"changed|circle":_("You changed circle %s"),"removed|circle":_("You removed circle %s"),"restored|backup":_("You restored backup %s")}[`${n}|${e??""}`];return i?{text:i,named:!0}:n==="reset traffic history"&&/^for (.+)$/.exec(o??"")?.[1]?{text:_("You reset traffic history for %s"),named:!0}:null}var Ls=(n,e)=>n==="reset traffic history"?e.replace(/^for /,""):e;function Ms(n){let e=o=>{let s={"other addresses":_("other addresses"),certificate:_("certificate"),redirect:_("redirect"),"devices kept apart":_("devices kept apart"),"devices reach each other":_("devices reach each other"),"devices reach each other in circles":_("devices reach each other in circles"),"home network and internet path":_("home network and internet path"),"the file holds private keys":_("the file holds private keys"),"problems are only logged, nothing is repaired":_("problems are only logged, nothing is repaired"),name:_("name"),"public address":_("public address"),"AmneziaWG port":_("AmneziaWG port"),"tunnel network":_("tunnel network"),connections:Ye("connections"),people:Ye("people"),problems:Ye("problems")};if(s[o])return s[o];let r;return(r=/^port (\d+)$/.exec(o))?m(_("port %s"),r[1]):(r=/^address (.+)$/.exec(o))?m(_("address %s"),r[1]):(r=/^disguise: (.+)$/.exec(o))?m(_("disguise: %s"),r[1]):(r=/^(\d+) events?$/.exec(o))?W(Number(r[1]),"%s event","%s events"):(r=/^older than (\d+) days$/.exec(o))?W(Number(r[1]),"older than %s day","older than %s days"):(r=/^with (\d+) (person|people)$/.exec(o))?W(Number(r[1]),"with %s person","with %s people"):(r=/^(\d+) entr(y|ies)( older than (\d+) days)?$/.exec(o))?r[4]?`${W(Number(r[1]),"%s entry","%s entries")}, ${W(Number(r[4]),"older than %s day","older than %s days")}`:W(Number(r[1]),"%s entry","%s entries"):o};return n.split(" · ").map(o=>o.split(", ").map(e).join(", ")).join(" · ")}var ci=null,pi=new Set(co);function mi(){return ci??(ci=co.filter(n=>/%[sd]/.test(n)&&n.replace(/%[sd]/g,"").trim()).map(n=>({t:n,fixed:n.replace(/%[sd]/g,"").length,re:new RegExp(`^${n.split(/(%[sd])/).map(e=>e==="%s"?"(.+?)":e==="%d"?"(\\d+)":e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("")}$`)})).sort((n,e)=>e.fixed-n.fixed))}function At(n,e=0){let o=n.replace(/ — /g," - ");if(pi.has(o))return Qn(o);if(e>2)return n;for(let s of mi()){let r=s.re.exec(o);if(r)return m(Qn(s.t),...r.slice(1).map(a=>At(a,e+1)))}return o.includes(", ")?o.split(", ").map(s=>At(s,e+1)).join(", "):n}function Es(n,e=120,o=26,s=Ke(new Date)){let r=Math.max(1,...n),a=t("div",{class:"dl-spark"});return a.style.width=`${e}px`,a.style.height=`${o}px`,n.forEach((i,l)=>{let d=t("i");d.style.height=`${Math.max(6,i/r*100)}%`,i||d.classList.add("zero");let c=n.length-1-l;we(d,()=>[t("div",{class:"dl-tip-title"},c===0?_("Today"):c===1?_("Yesterday"):Mt(jt(s,-c)).toLocaleDateString(ie(),{weekday:"short",day:"numeric",month:"short"})),t("div",{class:"dl-muted"},oe(i))]),a.appendChild(d)}),a}function Ts(n){let e=n==null?"":String(n);return/^[=+\-@\t\r]/.test(e)&&(e=`'${e}`),/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function Ss(n,e,o){return[n.map(s=>Ts(o?.[s]??s)).join(","),...e.map(s=>n.map(r=>Ts(s[r])).join(","))].join(` +`}return Ie.substring(0,Ie.length-1)},I.renderTo2dContext=function(R,O){O=O||2;for(var P=I.getModuleCount(),U=0;U>>8),z.push(x&255)):z.push(C)}}return z}};var e={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},o={L:1,M:0,Q:3,H:2},s={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},r=(function(){var S=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],$=1335,b=7973,C=21522,y={},z=function(k){for(var f=0;k!=0;)f+=1,k>>>=1;return f};return y.getBCHTypeInfo=function(k){for(var f=k<<10;z(f)-z($)>=0;)f^=$<=0;)f^=b<5&&(x+=3+V-5)}for(var T=0;T=256;)y-=255;return S[y]},C})();function i(S,$){if(typeof S.length>"u")throw S.length+"/"+$;var b=(function(){for(var y=0;y"u")throw"bad rs block @ typeNumber:"+y+"/errorCorrectionLevel:"+z;for(var f=k.length/3,x=[],T=0;T>>7-C%8&1)==1},b.put=function(C,y){for(var z=0;z>>y-z-1&1)==1)},b.getLengthInBits=function(){return $},b.putBit=function(C){var y=Math.floor($/8);S.length<=y&&S.push(0),C&&(S[y]|=128>>>$%8),$+=1},b},c=function(S){var $=e.MODE_NUMBER,b=S,C={};C.getMode=function(){return $},C.getLength=function(k){return b.length},C.write=function(k){for(var f=b,x=0;x+2>>8&255)*192+(T&255),k.put(T,13),x+=2}if(x>>8)},$.writeBytes=function(b,C,y){C=C||0,y=y||b.length;for(var z=0;z0&&(b+=","),b+=S[C];return b+="]",b},$},g=function(){var S=0,$=0,b=0,C="",y={},z=function(f){C+=String.fromCharCode(k(f&63))},k=function(f){if(!(f<0)){if(f<26)return 65+f;if(f<52)return 97+(f-26);if(f<62)return 48+(f-52);if(f==62)return 43;if(f==63)return 47}throw"n:"+f};return y.writeByte=function(f){for(S=S<<8|f&255,$+=8,b+=1;$>=6;)z(S>>>$-6),$-=6},y.flush=function(){if($>0&&(z(S<<6-$),S=0,$=0),b%3!=0)for(var f=3-b%3,x=0;x=$.length){if(y==0)return-1;throw"unexpected end of file./"+y}var f=$.charAt(b);if(b+=1,f=="=")return y=0,-1;if(f.match(/^\s$/))continue;C=C<<6|k(f.charCodeAt(0)),y+=6}var x=C>>>y-8&255;return y-=8,x};var k=function(f){if(65<=f&&f<=90)return f-65;if(97<=f&&f<=122)return f-97+26;if(48<=f&&f<=57)return f-48+52;if(f==43)return 62;if(f==47)return 63;throw"c:"+f};return z},E=function(S,$){var b=S,C=$,y=new Array(S*$),z={};z.setPixel=function(T,I,V){y[I*b+T]=V},z.write=function(T){T.writeString("GIF87a"),T.writeShort(b),T.writeShort(C),T.writeByte(128),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(0),T.writeByte(255),T.writeByte(255),T.writeByte(255),T.writeString(","),T.writeShort(0),T.writeShort(0),T.writeShort(b),T.writeShort(C),T.writeByte(0);var I=2,V=f(I);T.writeByte(I);for(var J=0;V.length-J>255;)T.writeByte(255),T.writeBytes(V,J,255),J+=255;T.writeByte(V.length-J),T.writeBytes(V,J,V.length-J),T.writeByte(0),T.writeString(";")};var k=function(T){var I=T,V=0,J=0,te={};return te.write=function(B,Q){if(B>>>Q)throw"length over";for(;V+Q>=8;)I.writeByte(255&(B<>>=8-V,J=0,V=0;J=B<0&&I.writeByte(J)},te},f=function(T){for(var I=1<>6,128|a&63):a<55296||a>=57344?s.push(224|a>>12,128|a>>6&63,128|a&63):(r++,a=65536+((a&1023)<<10|o.charCodeAt(r)&1023),s.push(240|a>>18,128|a>>12&63,128|a>>6&63,128|a&63))}return s}return e(n)}})();(function(n){typeof define=="function"&&define.amd?define([],n):typeof ts=="object"&&(ns.exports=n())})(function(){return es})});function Jn(n,e){return n==null||n===!1||n===""||(Array.isArray(n)?n.forEach(o=>Jn(o,e)):e.push(n instanceof Node?n:String(n))),e}function t(n,e,o){let s=window.E,r=e!=null&&typeof e=="object"&&!Array.isArray(e)&&!(e instanceof Node);return!r&&o===void 0?s(n,{},Jn(e,[])):s(n,r?e:{},Jn(o,[]))}var qo={phone:'',computer:'',tablet:'',router:'',server:'',other:'',ethernet:'',bridge:'',wifi:'',tunnel:'',plus:'',chart:'',reset:'',package:'',code:'',plug:'',sunrise:'',refresh:'',archive:'',qr:'',copy:'',download:'',link:'',amnezia:'',amneziawg:'',wireguard:'',appstore:'',googleplay:'',github:'',openwrt:'',apple:'',windows:'',linux:'',eye:'',share:'',arrow:'',trash:'',edit:'',pause:'',play:'',key:'',out:'',admin:'',shield:'',shieldplus:'',lock:'',zap:'',check:'',alert:'',x:'',globe:'',home:'',open:'',file:'',network:'',moon:'',chevron:'',clock:'',calendar:'',minus:'',more:'',pin:'',activity:''};function kt(n,e="dl-icon"){let o=qo[n]??qo.phone;return``}function v(n,e="dl-icon"){let o=document.createElement("span");return o.className="dl-icon-wrap",o.innerHTML=kt(n,e),o}function q(n,e="info",o=0){let s=document.querySelector(".dl-toasts");s||(s=t("div",{class:"dl-toasts dl-root",role:"status","aria-live":"polite"}),document.body.appendChild(s));let r=e==="error"?"x":e==="warning"?"alert":e==="success"?"check":null,a=()=>{i.classList.remove("show"),setTimeout(()=>i.remove(),200)},i=t("div",{class:`dl-toast ${e}`},[r?v(r):"",t("span",{},n),e==="error"?t("button",{type:"button","aria-label":_("Close"),click:a},v("x")):""]);s.appendChild(i),requestAnimationFrame(()=>i.classList.add("show")),setTimeout(a,o||(e==="error"?8e3:e==="warning"?5e3:2600))}function Ce(n){return n instanceof Error?n.message:String(n)}async function F(n,e){try{let o=await n();return e&&q(e,"success",3500),o}catch(o){q(Ce(o),"error",1e4);return}}function Fo(n){try{let e=n();e&&typeof e.then=="function"&&e.catch(o=>q(Ce(o),"error"))}catch(e){q(Ce(e),"error")}}function Zn(){return(typeof document>"u"?"":document.documentElement.lang)||"en"}function le(){let n=Zn();return n==="en"?"en-GB":n}function m(n,...e){let o=0;return n.replace(/%([%sd])/g,(s,r)=>r==="%"?"%":String(e[o++]??""))}function K(n,e){return n.toLocaleString(le(),e===void 0?void 0:{minimumFractionDigits:e,maximumFractionDigits:e})}function W(n,e,o){return m(N_(n,e,o),K(n))}function ae(n,...e){let o=0;return n.split(/(%[%sd])/).filter(Boolean).map(s=>s==="%%"?"%":s==="%s"||s==="%d"?e[o++]:s)}var Qn=n=>_(n);function Ko(n){if(n&&typeof n=="object"){if(typeof n.error=="string")throw new Error(n.error);typeof n.warning=="string"&&n.warning&&q(n.warning,"warning",12e3)}return n}function Z(n,e=[]){let o=rpc.declare({object:"luci.dawnline",method:n,params:[...e,"lang"]});return async(...s)=>Ko(await o(...e.map((r,a)=>s[a]),Zn()))}var Wa=Z("logs_clear",["person","device","category","older_days"]),Ga=(n={})=>Wa(n.person??"",n.device??"",n.category??"",n.older_days??""),qa=rpc.declare({object:"luci.dawnline",method:"person_update",params:["id","name","access","device_limit","expires","expire_action","expire_warn","quota_gb","quota_period","bonus_gb","hours","note","dns_mode","paused","services","circle","home_nets","server"]});async function Fa(n,e){let s=[n,...["name","access","device_limit","expires","expire_action","expire_warn","quota_gb","quota_period","bonus_gb","hours","note","dns_mode"].map(r=>e[r]),e.paused,e.services,e.circle,e.home_nets,e.server];return Ko(await qa(...s))}var Ka=Z("status",["days"]),N={rev:Z("rev"),personUpdate:Fa,settingsGet:Z("settings_get"),portalInfo:Z("portal_info"),settingsUpdate:Z("settings_update",["values"]),serviceSet:Z("service_set",["id","name","address","ports"]),serviceDelete:Z("service_delete",["id"]),geoClear:Z("geo_clear"),events:Z("events",["limit","person","since"]),logsClear:Ga,interfaces:Z("interfaces",["id"]),serverInterfaces:Z("server_interfaces",["id","auto_wan","wan_device","auto_lan","lan_devices","lan_like","device_mesh","mesh"]),circleSet:Z("circle_set",["id","server","name","color","members"]),circleDelete:Z("circle_delete",["id"]),accessCheck:Z("access_check",["from","to"]),homeHosts:Z("home_hosts",["id"]),usageClear:Z("usage_clear",["scope","id"]),uninstall:Z("uninstall",["confirm"]),status:Ka,setupDefaults:Z("setup_defaults"),serverCreate:Z("server_create",["id","name","ifname","port","subnet","endpoint","mtu","preset","lan_zone","wan_zone","lan_like","portal_enabled","portal_port"]),serverObfuscation:Z("server_obfuscation",["id","preset"]),serverUpdate:Z("server_update",["id","values"]),serverPorts:Z("server_ports",["id"]),endpointProbe:Z("endpoint_probe",["host","id","port"]),serverDelete:Z("server_delete",["id"]),personLinks:Z("person_links",["id"]),personCreate:Z("person_create",["name","slug","server","access","device_limit","expires","quota_gb","quota_period"]),personPause:Z("person_pause",["id","paused"]),personRegen:Z("person_regen",["id","remove"]),personDelete:Z("person_delete",["id"]),personUsage:Z("person_usage",["id","days"]),deviceCreate:Z("device_create",["person","name","kind"]),deviceConfig:Z("device_config",["id"]),deviceUpdate:Z("device_update",["id","name","disabled"]),deviceDelete:Z("device_delete",["id"]),deviceRotate:Z("device_rotate",["id"]),apply:Z("apply"),health:Z("health"),healthFix:Z("health_fix",["id"]),serviceLog:Z("service_log"),serviceLogClear:Z("service_log_clear",["older_days"]),backupList:Z("backup_list"),backupCreate:Z("backup_create"),backupRestore:Z("backup_restore",["name"]),backupDelete:Z("backup_delete",["name"]),backupRead:Z("backup_read",["name"]),backupUpload:Z("backup_upload",["data"]),exportJson:Z("export"),importJson:Z("import",["data"]),updatesStatus:Z("updates_status"),updatesRun:Z("updates_run",["what"]),updatesReleases:Z("updates_releases",["page"]),updatesNotes:Z("updates_notes",["component","tag","build"]),updatesChanges:Z("updates_changes",["from","to"])};function A(n,e,o="neutral",s={}){let{disabled:r,...a}=s,i=t("button",{class:`cbi-button cbi-button-${o}`,type:"button",...a,click:async l=>{if(l.preventDefault(),l.stopPropagation(),!i.disabled){i.disabled=!0,i.classList.add("spinning");try{await e(l)}catch(d){q(Ce(d),"error")}finally{i.disabled=!1,i.classList.remove("spinning")}}}},n);return i.disabled=!!r,i}function $e(n,e,o,s="neutral",r=""){return A([v(n),t("span",{class:"dl-btn-label"},e)],o,s,{title:e,class:`cbi-button cbi-button-${s} dl-icon-btn ${r}`.trim()})}function Te(n){return document.addEventListener("luci-navigate",n),()=>document.removeEventListener("luci-navigate",n)}var _t=null;function Xn(n=!1){let e=_t;_t=null,e?.(n)}function de(n,e,o,s=""){Xn();let r=t("div",{class:`dl-modal ${s}`},e),a=t("div",{class:"button-row"},o);r.addEventListener("keydown",i=>{if(i.key==="Escape"){i.preventDefault(),i.stopPropagation(),ce();return}if(i.key!=="Enter"||i.shiftKey||i.ctrlKey||i.metaKey||i.altKey)return;let l=i.target;if(!l||["TEXTAREA","BUTTON","SELECT","A"].includes(l.tagName))return;let d=a.querySelector(".cbi-button-positive");!d||d.disabled||(i.preventDefault(),d.click())}),ui.showModal(n,[r,a])}function ce(){Xn(),ui.hideModal()}function ue(n=_("Cancel"),e=!1){return t("button",{class:`cbi-button ${e?"cbi-button-negative":"cbi-button-neutral"}`,type:"button",click:ce},n)}function me(n,e,o=_("Confirm"),s=!1){return new Promise(r=>{de(n,e,[ue()," ",t("button",{class:`cbi-button ${s?"cbi-button-negative":"cbi-button-positive"}`,type:"button",click:()=>{let a=_t;_t=null,ui.hideModal(),a?.(!0)}},o)]),_t=r})}Te(()=>{_t&&(Xn(),ui.hideModal())});async function xe(n,e=_("Copied to clipboard"),o=!1){try{if(navigator.clipboard&&window.isSecureContext)await navigator.clipboard.writeText(n);else{let s=t("textarea",{style:"position:fixed;opacity:0"},n);document.body.appendChild(s),s.select();let r=document.execCommand("copy");if(s.remove(),!r)throw new Error(_("Copying is blocked here. Select the text and copy it by hand."))}return q(e,"success",2500),!0}catch(s){return o||q(Ce(s),"error"),!1}}function Ne(n,e,o="text/plain"){let s=globalThis,r=typeof e=="string"?new s.Blob([e],{type:o}):e,a=URL.createObjectURL(r),i=t("a",{href:a,download:n,style:"display:none"});document.body.appendChild(i),i.click(),setTimeout(()=>{URL.revokeObjectURL(a),i.remove()},1e3)}function eo(n,e){return new Promise(o=>{let s=t("input",{type:"file",accept:n,style:"display:none"});s.addEventListener("cancel",()=>{s.remove(),o(null)}),s.addEventListener("change",()=>{let r=s.files?.[0];if(s.remove(),!r)return o(null);let a=new FileReader;a.onload=()=>{let i=String(a.result??"");o({name:r.name,data:e==="base64"?i.replace(/^data:[^,]*,/,""):i})},a.onerror=()=>o(null),e==="base64"?a.readAsDataURL(r):a.readAsText(r)}),document.body.appendChild(s),s.click()})}function Se(n,e){let o=document.querySelector(".dl-dd");if(o&&(o.dlClose?o.dlClose():o.remove(),o.dlAnchor===n))return;let s=t("div",{class:"dl-dd dl-root",role:"menu"},e.map(u=>u?t("button",{type:"button",role:"menuitem",class:u.danger?"danger":u.warn?"warn":"",click:()=>{p(),Fo(u.run)}},[u.icon??"",t("span",{},u.label)]):t("hr")));document.body.appendChild(s);let r=n.getBoundingClientRect(),a=s.offsetWidth,i=s.offsetHeight;s.style.top=`${r.bottom+6+i>window.innerHeight-8&&r.top-6-i>8?r.top-6-i:r.bottom+6}px`,s.style.left=`${Math.max(8,Math.min(r.right-a,window.innerWidth-a-8))}px`;let l=u=>{!s.contains(u.target)&&!n.contains(u.target)&&p()},d=u=>{if(u.key==="Escape"||u.key==="Tab")return p();let w=[...s.querySelectorAll("button:not([disabled])")];if(!w.length||!["ArrowDown","ArrowUp","Home","End"].includes(u.key))return;u.preventDefault();let M=w.indexOf(document.activeElement),g=u.key==="Home"?0:u.key==="End"?w.length-1:u.key==="ArrowDown"?(M+1)%w.length:(M-1+w.length)%w.length;w[g].focus({preventScroll:!0})},c=Te(p);s.dlAnchor=n,s.dlClose=p;function p(){s.remove(),c(),document.removeEventListener("mousedown",l,!0),document.removeEventListener("keydown",d,!0),window.removeEventListener("scroll",p,!0)}setTimeout(()=>{document.addEventListener("mousedown",l,!0),document.addEventListener("keydown",d,!0),window.addEventListener("scroll",p,!0)}),s.querySelector("button")?.focus({preventScroll:!0})}var gt=null,nt=null,to=0;function Ct(){gt&&(gt.style.display="none"),nt=null,clearInterval(to),to=0}function we(n,e){let o=s=>{gt??(gt=document.body.appendChild(t("div",{class:"dl-tip dl-tip-float dl-root"}))),gt.replaceChildren(...e().map(r=>typeof r=="string"?document.createTextNode(r):r)),gt.style.display="",gt.style.left=`${s.clientX}px`,gt.style.top=`${s.clientY-10}px`,nt=n,to||(to=window.setInterval(()=>{(!nt?.isConnected||!nt.getClientRects().length)&&Ct()},400))};n.addEventListener("mouseenter",o),n.addEventListener("mousemove",o),n.addEventListener("mouseleave",Ct),n.addEventListener("pointerup",s=>{s.pointerType!=="mouse"&&(nt===n?Ct():o(s))})}Te(Ct);window.addEventListener("scroll",()=>nt&&Ct(),{capture:!0,passive:!0});document.addEventListener("pointerdown",n=>{nt&&!nt.contains(n.target)&&Ct()},!0);function Ya(n,e,o){let s=0;for(;n>=o&&s=100||s===0?K(Math.round(n)):K(n,1)} ${e[s]}`}function se(n){return Ya(!n||n<0?0:n,[_("B"),_("KB"),_("MB"),_("GB"),_("TB")],1024)}function Fe(n){let e=n*8,o=[_("bit/s"),_("kbit/s"),_("Mbit/s"),_("Gbit/s")];if(e<1e3)return`${K(Math.round(e))} ${o[0]}`;let s=e<1e6?1:e<1e9?2:3,r=e/1e3**s;return`${K(r,s===3||r<10?1:0)} ${o[s]}`}function pe(n,e=Date.now()/1e3){if(!n)return _("never");let o=Math.max(0,Math.round(e-n));return o<60?_("just now"):o<3600?m(_("%s min ago"),Math.floor(o/60)):o<86400?m(_("%s h ago"),Math.floor(o/3600)):o<86400*30?m(_("%s d ago"),Math.floor(o/86400)):new Date(n*1e3).toLocaleDateString(le(),{day:"numeric",month:"short",year:"numeric"})}function ot(n){if(!n||n<0)return"—";let e=Math.floor(n/86400),o=Math.floor(n%86400/3600),s=Math.floor(n%3600/60);return e?m(_("%sd %sh"),e,o):o?m(_("%sh %sm"),o,s):m(_("%sm"),s)}function Ut(n){let e=new Date(n*1e3),o=new Date,s=e.toDateString()===o.toDateString(),r=e.toLocaleTimeString(le(),{hour:"2-digit",minute:"2-digit"});return s?r:`${e.toLocaleDateString(le(),{day:"numeric",month:"short"})} ${r}`}function Ke(n){return`${n.getFullYear()}-${String(n.getMonth()+1).padStart(2,"0")}-${String(n.getDate()).padStart(2,"0")}`}function Mt(n){let[e,o,s]=n.split("-").map(Number);return new Date(e,(o||1)-1,s||1,12)}function Oe(n){return(typeof n=="string"?/^\d{4}-\d{2}-\d{2}$/.test(n)?Mt(n):new Date(n):n).toLocaleDateString(le(),{day:"numeric",month:"short",year:"numeric"})}function De(n){return n?Oe(n):""}function no(n,e){let o=s=>{let[r,a,i]=s.split("-").map(Number);return Date.UTC(r,a-1,i)};return Math.round((o(n)-o(e))/864e5)}function jt(n,e){let o=Mt(n);return o.setDate(o.getDate()+e),Ke(o)}function Lt(n,e){let[o,s,r]=n.split("-").map(Number),a=new Date(o,s-1+e,1,12),i=new Date(a.getFullYear(),a.getMonth()+1,0).getDate();return a.setDate(Math.min(r,i)),Ke(a)}function Ge(n){return n?.length?n[n.length-1].day:Ke(new Date)}function Yo(n,e,o,s,r=30){let a=n||s;return e==="day"?jt(a,o):e==="week"?jt(a,7*o):e==="month"?Lt(a,o):e==="year"?Lt(a,12*o):jt(a,r*o)}function st(n,e=Date.now()){if(!n)return null;let o=typeof e=="number"?Ke(new Date(e)):e,s=no(n,o);return s>=0?s+1:s}function rt(n,e){return e!=null&&e>0&&n.expire_warn>0&&e<=n.expire_warn}function an(n){return n<=1?_("ends today"):n===2?_("ends tomorrow"):W(n,"ends in %s day","ends in %s days")}function Et(n){return n<1024?`${K(n)} ${_("B")}`:n<1048576?`${K(n/1024,n<10240?1:0)} ${_("KB")}`:`${K(n/1048576,1)} ${_("MB")}`}function vt(n){return{lan:_("Home network"),internet:_("Internet"),both:_("Home network + Internet")}[n]}var Vo=["computer","phone","tablet","router","other"];function at(n){return{computer:_("PC"),phone:_("Phone"),tablet:_("Tablet"),router:_("Router"),other:_("Other")}[n]}function Jo(n){return{active:_("Active"),paused:_("Paused"),expired:_("Expired"),quota:_("Data limit reached"),hours:_("Outside allowed hours"),no_server:_("No server"),server_off:_("Server is turned off")}[n]}function je(n){let e=n.trim().split(/\s+/).filter(Boolean);if(!e.length)return"?";let o=e[0][0]??"",s=e.length>1?e[e.length-1][0]??"":e[0][1]??"";return(o+s).toUpperCase()}function ln(n){let e=o=>o.disabled?3:o.online?0:o.handshake?1:2;return n.map((o,s)=>[o,s]).sort((o,s)=>e(o[0])-e(s[0])||o[1]-s[1]).map(([o])=>o)}function Pe(n,e,o){return t("span",{class:`dl-pill ${n}`,title:o??null},e)}function Va(n){return n.state==="active"?"ok":n.state==="quota"||n.state==="expired"?"bad":"warn"}function Ja(n){return n.state==="server_off"&&n.paused?"paused":n.state}function Zo(n){let e=Ja(n);return e==="active"||e==="server_off"?"":Pe(Va({...n,state:e}),Jo(e))}function Qo(n){let e=n.access==="both"?["lan","inet"]:n.access==="lan"?["lan"]:["inet"],o=t("span",{class:"dl-access","aria-label":vt(n.access)},e.map(s=>t("span",{class:`dl-ibadge ${s}`},v(s==="lan"?"home":"globe"))));return we(o,()=>[t("div",{class:"dl-tip-title"},vt(n.access)),n.access==="lan"&&n.services?.length?t("div",{class:"dl-muted"},W(n.services.length,"%s home service only","%s home services only")):""]),o}function Za(n){return{active:null,paused:_("Paused"),expired:_("Access ended"),quota:_("Data limit"),hours:_("Outside hours"),server_off:_("Server off"),no_server:_("No server")}[n]}function dn(n,e,o=_("Not set up yet"),s){let r=new Date(n.handshake*1e3).toLocaleString(le()),a=n.handshake?`${m(_("Last seen %s"),pe(n.handshake,e))} · ${r}`:"";if(n.disabled)return t("span",{class:"dl-dstat",title:a},_("Disabled"));if(n.online)return t("span",{class:"dl-dstat ok"},_("Connected"));let i=s&&Za(s.state);return i?t("span",{class:"dl-dstat warn",title:a||_("Not connected yet")},i):n.handshake?t("span",{class:"dl-dstat",title:r},m(_("Last seen %s"),pe(n.handshake,e))):t("span",{class:"dl-dstat warn",title:_("Waiting for the first connection")},o)}var cn=null;function Xo(n,e,o,s){cn?.close();let r=t("aside",{class:"dl-drawer",role:"dialog","aria-modal":"true"},[t("div",{class:"dl-drawer-head"},[n,t("button",{type:"button",class:"dl-drawer-x","aria-label":_("Close"),click:()=>c()},v("x"))]),t("div",{class:"dl-drawer-body"},e),o?t("div",{class:"dl-drawer-foot"},o):""]),a=t("div",{class:"dl-drawer-overlay dl-root",click:u=>{u.target===a&&c()}},r),i=u=>{u.key==="Escape"&&!document.body.classList.contains("modal-overlay-active")&&c()},l=!1,d=Te(()=>c());function c(){l||(l=!0,d(),document.removeEventListener("keydown",i),a.classList.remove("open"),setTimeout(()=>a.remove(),220),cn===p&&(cn=null),s())}let p={close:c,panel:r};return document.addEventListener("keydown",i),document.body.appendChild(a),requestAnimationFrame(()=>a.classList.add("open")),cn=p,p}function ge(n,e,o){return t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},n),o?t("span",{class:"dl-sub"},o):""]),t("div",{class:"dl-setrow-ctl"},e)])}function _e(n,e,o,s=e){let r=ge(n,s," "),a=r.querySelector(".dl-sub"),i=()=>{let l=o();a.textContent=l.text,a.classList.toggle("bad",l.bad),e.classList.toggle("cbi-input-invalid",l.bad)};return e.addEventListener("input",i),r.refresh=i,r.help=o,i(),r}function Ee(n,e,o,s=e){let r=t("div",{class:"dl-sub"}),a=t("div",{class:"cbi-value dl-live"},[t("div",{class:"cbi-value-title"},[t("label",{},n),r]),t("div",{class:"cbi-value-field"},s)]),i=()=>{let l=o();r.textContent=l.text,r.classList.toggle("bad",l.bad),e.classList.toggle("cbi-input-invalid",l.bad)};return e.addEventListener("input",i),e.addEventListener("change",i),a.refresh=i,a.help=o,i(),a}function Ue(n,e=[]){for(let o of n){let s=o.help?.();if(s?.bad)return s.text}for(let o of e){let s=o();if(s.bad)return s.text}return null}function Wt(n,e,o,s=""){return t("section",{class:`dl-setsec ${s}`},[t("div",{class:"dl-setsec-body"},[n?t("h3",{},n):"",...e]),o.length?t("div",{class:"dl-setsec-foot"},o):""])}function ke(n,e,o,s){return t("div",{class:"dl-group"},[t("div",{class:"dl-group-head"},[t("span",{class:"dl-group-ic"},v(n)),t("span",{class:"dl-stack"},[t("b",{},e),o?t("span",{class:"dl-sub"},o):""])]),t("div",{class:"dl-group-body"},s.filter(r=>r!==""))])}function it(n,e,o,s,r){return t("div",{class:`dl-row dl-need-row ${e}`},[e?t("span",{class:"dl-need-ic"},v(n)):v(n),t("span",{class:"dl-row-main dl-stack"},[t("b",{},o),t("span",{class:"dl-sub"},s)]),r])}function bt(n,e){let o={ok:"success",warn:"warning",error:"error",info:"notice"}[n];return t("div",{class:`alert-message ${o}`},e)}function Tt(n,e=""){let o=t("div",{class:e});return o.innerHTML=n,o}var rs=Ua(os(),1),Qa=n=>``,ss="#0a0a0a",Xa="#f2f2f2",ei={night:[ss,Xa],day:["#ffffff",ss]},ti=n=>n.length>300,St=n=>+n.toFixed(2);function oo(n,e,o,s,r){return`M${St(n+r)} ${St(e)}h${St(o-2*r)}a${r} ${r} 0 0 1 ${r} ${r}v${St(s-2*r)}a${r} ${r} 0 0 1 -${r} ${r}h-${St(o-2*r)}a${r} ${r} 0 0 1 -${r} -${r}v-${St(s-2*r)}a${r} ${r} 0 0 1 ${r} -${r}z`}function pn(n,e=3,o=!0,s="plain"){let r=ti(n),a=s!=="plain",[i,l]=a?ei[s]:["#fff","#000"],d=(0,rs.default)(0,r?"L":"H");d.addData(n,"Byte"),d.make();let c=d.getModuleCount(),p=c+e*2,u=o&&!r?Math.round(c*.22):0;u&&(c-u)%2&&u++;let w=(c-u)/2,M=w+u,g=(b,C)=>u>0&&b>=w&&b=w&&Ca&&(C<7&&b<7||C<7&&b>=c-7||C>=c-7&&b<7),E="";if(a){let b=r?.48:.42;for(let C=0;C${Qa(a?i:"#fff")}`}let $=``;return a?`${$}${S}`:`${$}${S}`}function xt(){let n=document.documentElement.getAttribute("data-darkmode");return n!=null?n==="true":window.matchMedia?.("(prefers-color-scheme: dark)").matches??!1}function un(n){let e=xt();return Tt(pn(n,3,!0,e?"night":"day"),`dl-qr${e?"":" light"}`)}function so(n){let e=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\/(\d{1,2})$/.exec(n.trim());if(!e)return null;let[o,s,r,a]=e.slice(1,5).map(Number),i=Number(e[5]);if([o,s,r,a].some(c=>c>255)||i<8||i>30)return null;let l=o*2**24+s*2**16+r*2**8+a,d=2**(32-i);return{net:l-l%d,size:d}}var ni=(n,e)=>n.netso(n));function $t(n){return n.split("/")[0].split(".").slice(0,3).join(".")}function mn(n){return`${n.trim()}.0/24`}function ao(n,e,o){let s=n.trim(),r=/^\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(s)?so(mn(s)):null;if(!r)return{text:_("Three numbers, like 10.77.0."),bad:!0};if(!oi.some(i=>r.net>=i.net&&r.net+r.size<=i.net+i.size))return{text:_("Use a private range: 10.x.x, 172.16–31.x or 192.168.x."),bad:!0};let a=e.find(i=>{let l=so(i.cidr);return l!=null&&ni(r,l)});if(a){let i=a.cidr.endsWith("/24")?`${$t(a.cidr)}.x`:a.cidr,l=m(_("%s already uses %s."),a.name,i);return{text:o&&o!==s?`${l} ${m(_("Try %s."),o)}`:l,bad:!0}}return{text:m(_("Devices get %s – %s, the router %s."),`${s}.2`,`${s}.254`,`${s}.1`),bad:!1}}var is=(n,e)=>e.find(o=>o.from<=n&&n<=o.to)?.who??null,si=n=>Number.isInteger(n)&&n>=1&&n<=65535;function Gt(n,e,o){if(!si(n))return{text:_("Use a port from 1 to 65535."),bad:!0};let s=is(n,e);return s?{text:m(_("Used by %s. Choose another port."),s),bad:!0}:{text:o,bad:!1}}function hn(n,e,o){let s=o?m(_("HTTPS here, plain HTTP for links on IP addresses on %s."),n+1):_("HTTPS on this port, opened on WAN."),r=Gt(n,e,s);if(r.bad||!o)return r;if(n===65535)return{text:_("Links on IP addresses also need the next port: choose a lower one."),bad:!0};let a=is(n+1,e);return a?{text:m(_("Links on IP addresses also need %s, used by %s. Choose another port."),n+1,a),bad:!0}:r}var io=n=>Array.from(n).length,as=48,ri=/[<>"\\\u0000-\u001f\u007f]/,ls=(n,e)=>m(N_(n,"Up to %s character (%s now).","Up to %s characters (%s now)."),K(n),K(io(e)));function He(n,e=[],o=""){let s=n.trim();return s?io(n)>as?{text:ls(as,n),bad:!0}:ri.test(n)?{text:_('Names can’t contain < > " or \\.'),bad:!0}:e.some(r=>r.toLowerCase()===s.toLowerCase())?{text:m(_("“%s” already exists - pick another name."),s),bad:!0}:{text:o,bad:!1}:{text:_("Enter a name."),bad:!0}}function ds(n,e=[]){return io(n)>32?{text:ls(32,n),bad:!0}:He(n,e,_("Shown on the person cards."))}var ai=/^[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/,ii=/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function Dt(n){let e=ii.exec(n);return!!e&&e.slice(1).every(o=>Number(o)<=255)}function ro(n){return/^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$/.test(n)&&!/:::/.test(n)}function Pt(n,e,o=null){let s=n.trim();if(!s)return o!=null?{text:o,bad:!1}:{text:_("Enter a hostname or IP address."),bad:!0};if(/^[a-z]+:\/\//i.test(s))return{text:_("Leave out https:// - just the name."),bad:!0};if(/\/.*/.test(s))return{text:_("Just the name, without a path."),bad:!0};if(/^[^:\[]+:\d+$/.test(s))return{text:_("Just the name, without a port (the port is on AmneziaWG)."),bad:!0};if(/\s/.test(s))return{text:_("A hostname has no spaces."),bad:!0};if(s.length>253||!(ai.test(s)||Dt(s)||ro(s)))return{text:_("Use a hostname or an IP address."),bad:!0};let r=ro(s)?`[${s}]`:s;return{text:e?m(_("Devices connect to %s."),`${r}:${e}`):m(_("Links use %s."),r),bad:!1}}function cs(n,e){let o=n.split(/[ ,]+/).filter(Boolean);if(!o.length)return{text:m(_("This router (%s): queries go where your home network sends them, and home names work."),e),bad:!1};let s=o.find(a=>!Dt(a)&&!ro(a));if(s)return{text:m(_("“%s” is not an IP address. Separate several with commas."),s),bad:!0};let r=new Intl.ListFormat(le(),{type:"conjunction"}).format(o);return{text:m(_("Devices use %s - home names and your LAN’s DNS filters no longer apply to them."),r),bad:!1}}function ps(n,e){let o=n.trim();if(!o)return{text:m(_("Automatic by device type and disguise: %s for computers and routers, %s for phones and tablets."),e.computer,e.phone),bad:!1};if(!/^\d{1,4}$/.test(o)||Number(o)<1280||Number(o)>1500)return{text:_("MTU must be 1280–1500, or empty for automatic."),bad:!0};let s=Number(o);return{text:m(_("Computers and routers get %s, phones and tablets %s."),s,Math.min(s,1280)),bad:!1}}function us(n){let e=n.trim();return e?!/^\d{1,3}$/.test(e)||Number(e)>600?{text:_("Use 0–600 seconds."),bad:!0}:Number(e)===0?{text:_("Off: NAT may close the tunnel when idle, and “Connected” lags."),bad:!1}:{text:m(_("Devices send a packet every %s s to keep NAT open (a little battery on phones)."),e),bad:!1}:{text:_("Default: a packet every 25 s keeps NAT open and “Connected” accurate."),bad:!1}}function fn(n,e=0){let o=n.trim();if(!/^\d{1,2}$/.test(o)||Number(o)<1||Number(o)>32)return{text:_("Use 1–32."),bad:!0};let s=Number(o);return e>s?{text:e-s===1?m(N_(e,"Already has %s device: remove one first, or allow more.","Already has %s devices: remove one first, or allow more."),K(e)):m(N_(e,"Already has %s device: remove %s first, or allow more.","Already has %s devices: remove %s first, or allow more."),K(e),K(e-s)),bad:!0}:{text:W(s,"They can add %s device themselves.","They can add %s devices themselves."),bad:!1}}function gn(n,e=!0){let o=n.trim();if(!o)return{text:_("Optional. No data limit."),bad:!1};let s=Number(o);return!/^\d+(\.\d+)?$/.test(o)||s<0||s>1e5?{text:_("A number of GB, up to 100000."),bad:!0}:s===0?{text:_("Optional. No data limit."),bad:!1}:{text:m(e?_("Paused after %s GB this month, resumed on the 1st."):_("Paused after %s GB in total."),K(s)),bad:!1}}function ms(n,e,o,s){let r=n.trim();if(!r)return{text:_("Optional. No end date."),bad:!1};let a=o(r,e);return a==null?{text:_("Use a date."),bad:!0}:a<0?{text:_("That date has passed: access would end at once."),bad:!0}:{text:a===1?m(_("Access ends today (%s)."),s(r)):m(N_(a,"Access ends in %s day (%s).","Access ends in %s days (%s)."),K(a),s(r)),bad:!1}}function hs(n,e=null){let o=n.trim();return o?Dt(o)?e&&!e(o)?{text:m(_("%s is not in any home network of this server: nobody would reach it."),o),bad:!1}:{text:"",bad:!1}:{text:_("Use an IPv4 address, like 192.168.1.10."),bad:!0}:{text:_("The device’s address at home."),bad:!0}}function fs(n){let e=n.split(/[ ,]+/).filter(Boolean);if(!e.length)return{text:_("All ports."),bad:!1};let o=e.find(s=>!/^\d{1,5}$/.test(s)||Number(s)<1||Number(s)>65535);return o?{text:m(_("“%s” is not a port (1–65535)."),o),bad:!0}:{text:m(N_(e.length,"Port %s.","Ports %s."),e.join(", ")),bad:!1}}function gs(n){let e=n.trim();return e?/^https?:\/\//i.test(e)?e.length>300||!/^https?:\/\/[A-Za-z0-9.-]+(:[0-9]+)?(\/[^\s"'<>]*)?$/.test(e)?{text:_("Not a usable address (no spaces or quotes)."),bad:!0}:{text:_("Wrong links are sent there instead of a “Not found”."),bad:!1}:{text:_("Must start with http:// or https://."),bad:!0}:{text:_("Wrong links get a bare “Not found”."),bad:!1}}function vs(n,e="phone.myata"){let o=n.trim();return o?/^[a-z0-9-]{1,32}(\.[a-z0-9-]{1,32})*$/.test(o)?{text:m(_("Devices get names like %s."),`${e}.${o}`),bad:!1}:{text:/[A-Z]/.test(o)?_("Lowercase only."):_("Lowercase letters, digits, dashes and dots."),bad:!0}:{text:m(_("The default, lan: devices get names like %s."),`${e}.lan`),bad:!1}}function bs(n){let e=n.trim();return e?Dt(e)?{text:m(_("%s takes over when the tunnel is down."),e),bad:!1}:{text:_("Use an IPv4 address, or leave it empty."),bad:!0}:{text:_("None: without the tunnel those devices have no DNS."),bad:!1}}function xs(n){let e=n.trim();return/^([01]?[0-9]|2[0-3]):[0-5][0-9]$/.test(e)?{text:m(_("Runs within an hour after %s (router time)."),e),bad:!1}:{text:_("Use HH:MM, 00:00–23:59."),bad:!0}}function lo(n,e,o,s={}){let r=0,a="",i=null;return{help:()=>{let{host:c,port:p}=n(),u=Pt(c,p,s.empty??null);return u.bad||!c.trim()?u:i&&i.host===c.trim()?{text:i.text,bad:i.bad}:{text:`${s.idle?.()||u.text} ${_("Checking where it points…")}`,bad:!1}},schedule:()=>{let{host:c}=n(),p=Pt(c,n().port,s.empty??null);p.bad||!c.trim()||c.trim()===i?.host||(clearTimeout(r),r=window.setTimeout(async()=>{let u=c.trim();a=u;try{let{id:w,port:M}=n(),g=await e(u,w,M);if(a!==u)return;i={host:u,text:g.text,bad:g.status==="error"}}catch{if(a!==u)return;i={host:u,text:p.text,bad:!1}}o()},700))}}}var co=["%d system package","%d system packages","%s (after %d repair)","%s (after %d repairs)","%s - %d repairs didn't help","%s - %s","%s - not repaired again (%d repairs didn't help)","%s has no IPv4 address.","%s is not a bridge, so Dawnline cannot join the LAN as a device.","%s needs a manual switch in Components","%s still give devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations.","%s still gives devices the old address: set the public address in the server settings (a DDNS name keeps working), then devices need new configurations.","%s · restored","Access rules","Activity","AmneziaWG is missing from the router","AmneziaWG is running again","AmneziaWG is running again · accepting connections on port %d","AmneziaWG isn't accepting connections on port %d","AmneziaWG isn't running","Backup","Browsers will refuse the portal after that. Renew it with ACME, or choose another certificate in Settings.","Choose another interface name in the server settings.","Components","Connections","DNS for Home-only devices","Dawnline didn't stop it: the router's network restarted, someone stopped it by hand, or it failed.","Firewall","Install it in Dawnline → Components.","Internet like a home device","MTU is now automatic","Missing: %s.","No LAN detected.","No free address on %s.","No free link-local range for the internal link.","No free routing table.","People","Personal links","Personal portal","Router","Servers","Speed","System packages","The new version did not answer in LuCI or its agent did not start. Try again from Components, or install it with install.sh to see why.","Traffic","Watchdog","a new build needs a manual switch in Components","answers again","are loaded again","are missing","automatic update failed","background check failed: %s","can't reach Dawnline (luci.dawnline is missing in rpcd)","can't use the network interface %s: it exists and isn't Dawnline's","certificate expires %s","certificate expires within 7 days","certificate renewed · valid until %s","couldn't be repaired: %s","couldn't be updated - the previous rules stay, and changes to access wait until they load","couldn't load - no device is loaded into the tunnels until they do","couldn't load devices into the tunnel","couldn't start","couldn't start · %d failed attempts in %d min","failed - internet goes out directly for now","failed: %s",'has an invalid interface name "%s"',"installed the %s build","installed the %s build · %s","is kept down","is kept down: its disguise needs AmneziaWG %s (installed: %s)","is kept down: its disguise needs AmneziaWG %s (installed: none)","is off","is on · traffic enters %s as %s","is ready again","isn't answering on port %d","isn't installed: no tunnel can run - install it in Dawnline → Components","isn't installed: tunnels were left as they are","isn't known to the network service - restart the network or reboot","isn't running","isn't running on this router (fw4): tunnels and the portal are closed","kernel module isn't installed: no tunnel can run - install it in Dawnline → Components","kernel module isn't loaded","loading it","loading them again","moved to word codes","netifd reads its protocol handlers when it starts; it was running before AmneziaWG was installed.","network changed - Dawnline set itself up again","nightly backup failed: %s","public address changed · %s → %s","reaches Dawnline again","reloading rpcd","restarted · version %s","restarting for the AmneziaWG update","restarting it","restoring them","rules for Dawnline are in place again","rules for Dawnline aren't loaded","rules for Dawnline were changed or removed","runs again","setting it up again","started","started with the router · version %s","started · accepting connections on port %s","started · version %s","stopped unexpectedly","stopped unexpectedly - started again","update failed","update to %s failed its check - rolled back to %s","updated automatically · %s","updated automatically · %s → %s","updated · %s","updated · %s → %s","updates available · %s","was broken - set up again (%s as %s)"];var li={connect:"connections",disconnect:"connections",roam:"connections",device_added:"people",device_removed:"people",devices_removed:"people",device_changed:"people",device_keys:"people",link_changed:"people",person_added:"people",person_removed:"people",person_changed:"people",paused:"people",resumed:"people",expiring:"people",expired_kept:"people",portal_blocked:"problems"},Nt=["connections","people","problems"];function Ye(n){return{connections:_("Connections"),people:_("People"),problems:_("Problems")}[n]}function ws(n){return{connections:_("Connects, disconnects and IP changes"),people:_("People and their devices added, changed, paused, removed"),problems:_("Blocked portal sign-ins (tunnels and services are in the service log)")}[n]}var qt=n=>li[n]??"problems";function Ft(n){return{awg:"AmneziaWG",dawnline:"Dawnline",portal:_("Portal")}[n]??n}var di=["person_added","person_removed","person_changed"];function Ve(n){return n.by?n.by:di.includes(n.type)||n.detail==="by admin"||n.detail?.endsWith(" (admin)")?"admin":n.detail?.endsWith(" (portal)")?"portal":null}function ys(n){return(n.detail??"").replace(/ \((admin|portal)\)$/,"").replace(/^by admin$/,"")}var vn=n=>n.sys?["error","repair","down"].includes(n.sys.level):qt(n.ev.type)==="problems";function bn(n){let e=n.keep_days>0?W(n.keep_days,"%s day","%s days"):_("no age limit"),o=n.persist==="off"?_("kept in memory only (lost on reboot)"):n.persist==="10min"?_("saved to flash every 10 minutes"):_("saved to flash hourly");return m(_("Kept for %s, %s, %s."),e,W(n.max,"up to %s event","up to %s events"),o)}function po(n){return{"paused by admin":_("paused by admin"),"end date reached":_("end date reached"),"data limit reached":_("data limit reached"),"outside allowed hours":_("outside allowed hours"),"no server":_("no server"),"server turned off":_("server turned off")}[n]??n}function ks(n){let e=/^(\d+) days?$/.exec(n);return e?Number(e[1]):null}function _s(n){let e={name:_("name"),access:_("access"),device_limit:_("device limit"),expires:_("end date"),expire_action:_("what happens at the end"),expire_warn:_("warning before the end"),quota_gb:_("data limit"),quota_period:_("data limit period"),bonus_gb:_("extra data"),hours:_("allowed hours"),dns_mode:_("DNS"),paused:_("pause"),services:_("home services"),circle:_("circle","setting"),home_nets:_("home networks"),server:_("server")};return n.split(", ").map(o=>{let s=/^moved to (.+)$/.exec(o)?.[1];return s?m(_("moved to %s"),s):e[o]??o.replace(/_/g," ")}).join(", ")}function Cs(n,e,o){let r={"cleared|the service log":_("You cleared the service log"),"cleared|the activity log":_("You cleared the activity log"),"exported|all settings":_("You exported all settings"),"imported|settings from a file":_("You imported settings from a file"),"restored|from a file":_("You restored a backup from a file"),"turned on|the personal portal":_("You turned on the personal portal"),"turned off|the personal portal":_("You turned off the personal portal"),"changed|the personal portal":_("You changed the personal portal"),"turned on|the watchdog":_("You turned on the watchdog"),"turned off|the watchdog":_("You turned off the watchdog"),"reset traffic history|for everyone":_("You reset traffic history for everyone")}[`${n}|${o??""}`];if(r)return{text:r,named:!1};let i={"created|server":_("You created server %s"),"changed|server":_("You changed server %s"),"removed|server":_("You removed server %s"),"turned on|server":_("You turned on server %s"),"turned off|server":_("You turned off server %s"),"added|circle":_("You added circle %s"),"changed|circle":_("You changed circle %s"),"removed|circle":_("You removed circle %s"),"restored|backup":_("You restored backup %s")}[`${n}|${e??""}`];return i?{text:i,named:!0}:n==="reset traffic history"&&/^for (.+)$/.exec(o??"")?.[1]?{text:_("You reset traffic history for %s"),named:!0}:null}var Ls=(n,e)=>n==="reset traffic history"?e.replace(/^for /,""):e;function Ms(n){let e=o=>{let s={"other addresses":_("other addresses"),certificate:_("certificate"),redirect:_("redirect"),"devices kept apart":_("devices kept apart"),"devices reach each other":_("devices reach each other"),"devices reach each other in circles":_("devices reach each other in circles"),"home network and internet path":_("home network and internet path"),"the file holds private keys":_("the file holds private keys"),"problems are only logged, nothing is repaired":_("problems are only logged, nothing is repaired"),name:_("name"),"public address":_("public address"),"AmneziaWG port":_("AmneziaWG port"),"tunnel network":_("tunnel network"),connections:Ye("connections"),people:Ye("people"),problems:Ye("problems")};if(s[o])return s[o];let r;return(r=/^port (\d+)$/.exec(o))?m(_("port %s"),r[1]):(r=/^address (.+)$/.exec(o))?m(_("address %s"),r[1]):(r=/^disguise: (.+)$/.exec(o))?m(_("disguise: %s"),r[1]):(r=/^(\d+) events?$/.exec(o))?W(Number(r[1]),"%s event","%s events"):(r=/^older than (\d+) days$/.exec(o))?W(Number(r[1]),"older than %s day","older than %s days"):(r=/^with (\d+) (person|people)$/.exec(o))?W(Number(r[1]),"with %s person","with %s people"):(r=/^(\d+) entr(y|ies)( older than (\d+) days)?$/.exec(o))?r[4]?`${W(Number(r[1]),"%s entry","%s entries")}, ${W(Number(r[4]),"older than %s day","older than %s days")}`:W(Number(r[1]),"%s entry","%s entries"):o};return n.split(" · ").map(o=>o.split(", ").map(e).join(", ")).join(" · ")}var ci=null,pi=new Set(co);function mi(){return ci??(ci=co.filter(n=>/%[sd]/.test(n)&&n.replace(/%[sd]/g,"").trim()).map(n=>({t:n,fixed:n.replace(/%[sd]/g,"").length,re:new RegExp(`^${n.split(/(%[sd])/).map(e=>e==="%s"?"(.+?)":e==="%d"?"(\\d+)":e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join("")}$`)})).sort((n,e)=>e.fixed-n.fixed))}function At(n,e=0){let o=n.replace(/ — /g," - ");if(pi.has(o))return Qn(o);if(e>2)return n;for(let s of mi()){let r=s.re.exec(o);if(r)return m(Qn(s.t),...r.slice(1).map(a=>At(a,e+1)))}return o.includes(", ")?o.split(", ").map(s=>At(s,e+1)).join(", "):n}function Es(n,e=120,o=26,s=Ke(new Date)){let r=Math.max(1,...n),a=t("div",{class:"dl-spark"});return a.style.width=`${e}px`,a.style.height=`${o}px`,n.forEach((i,l)=>{let d=t("i");d.style.height=`${Math.max(6,i/r*100)}%`,i||d.classList.add("zero");let c=t("span",{},[d]),p=n.length-1-l;we(c,()=>[t("div",{class:"dl-tip-title"},p===0?_("Today"):p===1?_("Yesterday"):Mt(jt(s,-p)).toLocaleDateString(le(),{weekday:"short",day:"numeric",month:"short"})),t("div",{class:"dl-muted"},se(i))]),a.appendChild(c)}),a}function Ts(n){let e=n==null?"":String(n);return/^[=+\-@\t\r]/.test(e)&&(e=`'${e}`),/[",\r\n]/.test(e)?`"${e.replace(/"/g,'""')}"`:e}function Ss(n,e,o){return[n.map(s=>Ts(o?.[s]??s)).join(","),...e.map(s=>n.map(r=>Ts(s[r])).join(","))].join(` `)}function hi(n){let e=new Map(n.people.map(s=>[s.id,s.name])),o=new Map(n.people.flatMap(s=>s.devices.map(r=>[r.id,r.name])));return{people:e,devices:o}}function Qe(n,e,o,s="",r=[]){let a=hi(n),i=[...e.map(u=>({ts:u.ts,category:qt(u.type),type:u.type,person:u.person?a.people.get(u.person)??u.pname??u.person:"",device:u.device?a.devices.get(u.device)??u.dname??u.device:"",detail:u.detail??"",where:u.where??"",by:Ve(u)??""})),...r.map(u=>({ts:u.ts,category:"system",type:`${u.src}.${u.level}`,person:"",device:"",detail:`${u.who?`${u.who} `:""}${u.msg}${u.detail?` -${u.detail}`:""}`,where:Ft(u.src),by:""}))].sort((u,k)=>u.ts-k.ts).map(({ts:u,...k})=>({time:new Date(u*1e3).toISOString(),...k})),l=new Date().toISOString().slice(0,10),d=`dawnline-activity${s?`-${s}`:""}-${l}.${o}`;if(o==="json"){Ne(d,JSON.stringify(i,null,2),"application/json");return}let c=["time","category","type","person","device","detail","where","by"],p={time:_("Time"),category:_("Category"),type:_("Type"),person:_("Person"),device:_("Device"),detail:_("Detail"),where:_("Where"),by:_("By")};Ne(d,Ss(c,i,p),"text/csv")}var fi=["","7","30","90"],gi=n=>n?W(Number(n),"Older than %s day","Older than %s days"):_("Everything"),Ps=n=>n?W(n,"%s event removed","%s events removed"):_("Nothing matched");function lt(n,e,o,s,r,a=!1){let i=t("select",{class:"cbi-input-select"},[t("option",{value:""},_("All categories")),...Nt.map(d=>t("option",{value:d,selected:d===r?"selected":null},Ye(d))),a?t("option",{value:"system",selected:r==="system"?"selected":null},_("System")):""]),l=t("select",{class:"cbi-input-select"},fi.map(d=>t("option",{value:d},gi(d))));de(n,[t("p",{class:"dl-muted"},`${e} ${_("This cannot be undone; export first if you want a copy.")}`),t("label",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},_("Category")),i]),t("label",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},_("Which events")),l])],[ue()," ",A(_("Clear"),async()=>{let d=0;if(i.value!=="system")try{d+=(await N.logsClear({...o,category:i.value,older_days:l.value})).removed}catch(c){q(Ce(c),"error",1e4);return}if(a&&(i.value==="system"||i.value===""))try{d+=(await N.serviceLogClear(l.value)).removed}catch(c){ce();let p=m(_("The service log was not cleared: %s"),Ce(c));q(i.value==="system"?p:`${m(_("Activity: %s."),Ps(d).toLowerCase())} ${p}`,"error",1e4),s();return}ce(),q(Ps(d),"success",3e3),s()},"negative")])}function Ht(n,e,o,s){let r=n==="device"?m(_("Clears %s's daily and monthly traffic history. Their person's totals and data limit are not changed."),o):n==="person"?m(_("Clears %s's traffic history and that of their devices. Their data limit starts again from zero."),o):_("Clears traffic history for everyone. Data limits start again from zero.");de(n==="all"?_("Reset all traffic history?"):m(_("Reset traffic history for %s?"),o),[t("p",{class:"dl-muted"},r)],[ue()," ",A(_("Reset"),async()=>{await F(()=>N.usageClear(n,e),_("Traffic history reset"))&&(ce(),s())},"negative")])}function ye(n,e,o){let s=t("button",{type:"button",role:"switch",class:`dl-switch${n?" on":""}`,"aria-checked":n?"true":"false","aria-label":e,click:()=>{let r=!s.classList.contains("on");uo(s,r),o?.(r)}},t("i"));return s}function uo(n,e){n.classList.toggle("on",e),n.setAttribute("aria-checked",e?"true":"false")}var ze=n=>n.classList.contains("on");function Me(n,e,o={}){n.some(([a])=>a===e)||(n=[...n,[e,e]]);let s=t("div",{class:`dl-seg${o.cls?` ${o.cls}`:""}`,role:"radiogroup","aria-label":o.label??null,"data-value":e}),r=()=>s.querySelectorAll(":scope > button").forEach(a=>{let i=a.dataset.v===s.dataset.value;a.classList.toggle("on",i),a.setAttribute("aria-checked",i?"true":"false")});for(let[a,i]of n)s.appendChild(t("button",{type:"button",role:"radio","data-v":a,click:()=>{a!==s.dataset.value&&(o.optimistic!==!1&&(s.dataset.value=a,r()),o.onChange?.(a))}},i));return r(),s}function Xe(n,e,o,s={}){return t("button",{type:"button",...s,class:`dl-chipbtn${e?" on":""}${s.class?` ${s.class}`:""}`,"aria-pressed":e?"true":"false",click:o},n)}function xn(n,e){n.classList.toggle("on",e),n.setAttribute("aria-pressed",e?"true":"false")}function he(n,e={}){return t("input",{type:"text",class:"cbi-input-text",value:n,...e})}var vi={jc:"0",jmin:"0",jmax:"0",s1:"0",s2:"0",s3:"0",s4:"0",h1:"1",h2:"2",h3:"3",h4:"4",i1:"",i2:"",i3:"",i4:"",i5:""},bi={header_protection_key:"HeaderProtectionKey",content_padding_addition:"ContentPaddingAddition",rekey_after_time:"RekeyAfterTime",rekey_timeout:"RekeyTimeout",reject_after_time:"RejectAfterTime",keepalive_timeout:"KeepaliveTimeout",max_handshake_attempts:"MaxHandshakeAttempts",random_trailers:"RandomTrailers",disable_cookies:"DisableCookies"};function xi(n){let e={};for(let[o,s]of Object.entries(bi))n[o]!=null&&n[o]!==""&&(e[s]=String(n[o]));return e}function wi(n,e){let o=n.amnezia,s=o.obfuscation??{},r=d=>s[d]!=null&&s[d]!==""?String(s[d]):vi[d],a=o.host.replace(/^\[(.*)\]$/,"$1"),i={H1:r("h1"),H2:r("h2"),H3:r("h3"),H4:r("h4"),I1:r("i1"),I2:r("i2"),I3:r("i3"),I4:r("i4"),I5:r("i5"),Jc:r("jc"),Jmin:r("jmin"),Jmax:r("jmax"),S1:r("s1"),S2:r("s2"),S3:r("s3"),S4:r("s4"),...xi(s),allowed_ips:o.allowed_ips,client_ip:o.client_ip,client_priv_key:o.client_priv_key,client_pub_key:o.client_pub_key,config:n.conf.replace(/\r?\n/g,`\r -`),hostName:a,mtu:o.mtu,persistent_keep_alive:o.persistent_keep_alive,port:Number(o.port),psk_key:o.psk_key,server_pub_key:o.server_pub_key},l={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(i),port:String(o.port),protocol_version:s.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:e,hostName:a};return o.dns[0]&&(l.dns1=o.dns[0]),o.dns[1]&&(l.dns2=o.dns[1]),l}function yi(n){let e="";for(let o=0;o"u")return null;try{let o=new e.Blob([n]).stream().pipeThrough(new e.CompressionStream("deflate")),s=new Uint8Array(await new e.Response(o).arrayBuffer()),r=new Uint8Array(4+s.length);return new DataView(r.buffer).setUint32(0,n.length,!1),r.set(s,4),r}catch{return null}}async function mo(n,e,o=!0){let s=new TextEncoder().encode(JSON.stringify(wi(n,e))),r=o?await ki(s):null;return`vpn://${yi(r??s)}`}function Ds(){return[{id:"off",title:_("Off"),ic:"zap",stealth:0,speed:4,text:_("Plain WireGuard-compatible traffic. Fastest, but easy to recognise and block."),apps:_("Any WireGuard app"),short:_("Any WireGuard app")},{id:"balanced",title:_("Balanced"),ic:"shield",stealth:3,speed:4,needs:"v2",text:_("AmneziaWG 2.0: junk packets, padded packets and a first packet that looks like DNS. For networks that learned to spot 1.0-style junk."),apps:_("AmneziaVPN 4.8.12 or newer, AmneziaWG 2.0+ apps"),short:_("AmneziaWG 2.0+ apps")},{id:"max",title:_("Maximum"),ic:"lock",stealth:4,speed:3,needs:"v3",text:_("AmneziaWG 3.1: encrypted packet headers, random tails and sizes, jittered timing, and a first packet that looks like DNS."),apps:_("Apps with AmneziaWG 3.1 (current AmneziaVPN)"),short:_("AmneziaWG 3.1 apps")}]}var Kt=n=>Ds().find(e=>e.id===n),wn=n=>n.v3?"max":n.v2?"balanced":"off",Yt=n=>n==="standard"?_("Standard (old)"):n==="strong"?_("Strong (old)"):null;function _i(n,e){return e?n==="v2"?_("Needs AmneziaWG 2.0 or newer on the router (kmod-amneziawg and amneziawg-tools from July 2025 on)."):_("Needs AmneziaWG 3.1 on the router (kmod-amneziawg and amneziawg-tools 3.1)."):n==="v2"?_("Needs AmneziaWG on the router."):_("Needs AmneziaWG 3.1 on the router: install it first.")}function $s(n,e){return t("span",{class:"dl-dots",title:m(_("%s: %s of 4"),e,n)},[t("span",{class:"dl-dots-label"},e),t("span",{class:"dl-dots-row"},[0,1,2,3].map(o=>t("i",{class:odom.content(a,Ds().map(l=>{let d=!l.needs||n[l.needs],c=l.id===e;return t("button",{type:"button",role:"radio","aria-checked":c?"true":"false","aria-disabled":d?null:"true",class:`dl-method${c?" on":""}${d?"":" off"}`,click:()=>{!d||c||(e=l.id,i(),o(l.id))}},[t("div",{class:"dl-method-head"},[t("span",{class:"dl-method-ic"},v(l.ic)),t("b",{},l.title),l.id===s?t("span",{class:"dl-pill ok"},_("Current")):""]),t("p",{},l.text),t("div",{class:"dl-method-meters"},[$s(l.stealth,_("Stealth")),$s(l.speed,_("Speed"))]),t("div",{class:"dl-method-foot"},d?[v(l.id==="off"?"wireguard":"amneziawg"),t("span",{},l.apps)]:[v("alert"),t("span",{},_i(l.needs,r))])])}));return i(),a}function As(n,e){return t("div",{class:"dl-corehead"},[t("h3",{},n),e?t("span",{class:"dl-sub"},e):""])}var Ns=[["jc","Jc"],["jmin","Jmin"],["jmax","Jmax"],["s1","S1"],["s2","S2"],["s3","S3"],["s4","S4"],["h1","H1"],["h2","H2"],["h3","H3"],["h4","H4"],["i1","I1"],["i2","I2"],["i3","I3"],["i4","I4"],["i5","I5"],["header_protection_key","HeaderProtectionKey"],["content_padding_addition","ContentPaddingAddition"],["rekey_after_time","RekeyAfterTime"],["rekey_timeout","RekeyTimeout"],["reject_after_time","RejectAfterTime"],["keepalive_timeout","KeepaliveTimeout"],["max_handshake_attempts","MaxHandshakeAttempts"],["random_trailers","RandomTrailers"],["disable_cookies","DisableCookies"]];function Ci(n){let e=c=>n[c]!=null&&n[c]!=="",o=Ns.filter(([c])=>e(c));if(!o.length)return null;let s=(c,p)=>t("span",{class:"dl-pv"},[t("i",{},p),t("b",{},c==="header_protection_key"?`${n[c].slice(0,6)}••••`:n[c])]),r=(c,p,u,k)=>{let M=Ns.filter(([g])=>k.includes(g)&&e(g));return M.length?t("div",{class:"dl-pgroup"},[t("div",{class:"dl-pgroup-head"},[v(p),t("b",{},c)]),t("p",{},u),t("div",{class:"dl-pvals"},M.map(([g,h])=>s(g,h)))]):""},a=Number(n.jc||0),i=(n.i1??"").includes("0x8580")?_("A first packet shaped like a DNS answer."):_("Extra packets sent before the handshake."),l=o.map(([c,p])=>`${p} = ${n[c]}`).join(` +${u.detail}`:""}`,where:Ft(u.src),by:""}))].sort((u,w)=>u.ts-w.ts).map(({ts:u,...w})=>({time:new Date(u*1e3).toISOString(),...w})),l=new Date().toISOString().slice(0,10),d=`dawnline-activity${s?`-${s}`:""}-${l}.${o}`;if(o==="json"){Ne(d,JSON.stringify(i,null,2),"application/json");return}let c=["time","category","type","person","device","detail","where","by"],p={time:_("Time"),category:_("Category"),type:_("Type"),person:_("Person"),device:_("Device"),detail:_("Detail"),where:_("Where"),by:_("By")};Ne(d,Ss(c,i,p),"text/csv")}var fi=["","7","30","90"],gi=n=>n?W(Number(n),"Older than %s day","Older than %s days"):_("Everything"),Ps=n=>n?W(n,"%s event removed","%s events removed"):_("Nothing matched");function lt(n,e,o,s,r,a=!1){let i=t("select",{class:"cbi-input-select"},[t("option",{value:""},_("All categories")),...Nt.map(d=>t("option",{value:d,selected:d===r?"selected":null},Ye(d))),a?t("option",{value:"system",selected:r==="system"?"selected":null},_("System")):""]),l=t("select",{class:"cbi-input-select"},fi.map(d=>t("option",{value:d},gi(d))));de(n,[t("p",{class:"dl-muted"},`${e} ${_("This cannot be undone; export first if you want a copy.")}`),t("label",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},_("Category")),i]),t("label",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},_("Which events")),l])],[ue()," ",A(_("Clear"),async()=>{let d=0;if(i.value!=="system")try{d+=(await N.logsClear({...o,category:i.value,older_days:l.value})).removed}catch(c){q(Ce(c),"error",1e4);return}if(a&&(i.value==="system"||i.value===""))try{d+=(await N.serviceLogClear(l.value)).removed}catch(c){ce();let p=m(_("The service log was not cleared: %s"),Ce(c));q(i.value==="system"?p:`${m(_("Activity: %s."),Ps(d).toLowerCase())} ${p}`,"error",1e4),s();return}ce(),q(Ps(d),"success",3e3),s()},"negative")])}function Ht(n,e,o,s){let r=n==="device"?m(_("Clears %s's daily and monthly traffic history. Their person's totals and data limit are not changed."),o):n==="person"?m(_("Clears %s's traffic history and that of their devices. Their data limit starts again from zero."),o):_("Clears traffic history for everyone. Data limits start again from zero.");de(n==="all"?_("Reset all traffic history?"):m(_("Reset traffic history for %s?"),o),[t("p",{class:"dl-muted"},r)],[ue()," ",A(_("Reset"),async()=>{await F(()=>N.usageClear(n,e),_("Traffic history reset"))&&(ce(),s())},"negative")])}function ye(n,e,o){let s=t("button",{type:"button",role:"switch",class:`dl-switch${n?" on":""}`,"aria-checked":n?"true":"false","aria-label":e,click:()=>{let r=!s.classList.contains("on");uo(s,r),o?.(r)}},t("i"));return s}function uo(n,e){n.classList.toggle("on",e),n.setAttribute("aria-checked",e?"true":"false")}var ze=n=>n.classList.contains("on");function Me(n,e,o={}){n.some(([a])=>a===e)||(n=[...n,[e,e]]);let s=t("div",{class:`dl-seg${o.cls?` ${o.cls}`:""}`,role:"radiogroup","aria-label":o.label??null,"data-value":e}),r=()=>s.querySelectorAll(":scope > button").forEach(a=>{let i=a.dataset.v===s.dataset.value;a.classList.toggle("on",i),a.setAttribute("aria-checked",i?"true":"false")});for(let[a,i]of n)s.appendChild(t("button",{type:"button",role:"radio","data-v":a,click:()=>{a!==s.dataset.value&&(o.optimistic!==!1&&(s.dataset.value=a,r()),o.onChange?.(a))}},i));return r(),s}function Xe(n,e,o,s={}){return t("button",{type:"button",...s,class:`dl-chipbtn${e?" on":""}${s.class?` ${s.class}`:""}`,"aria-pressed":e?"true":"false",click:o},n)}function xn(n,e){n.classList.toggle("on",e),n.setAttribute("aria-pressed",e?"true":"false")}function he(n,e={}){return t("input",{type:"text",class:"cbi-input-text",value:n,...e})}var vi={jc:"0",jmin:"0",jmax:"0",s1:"0",s2:"0",s3:"0",s4:"0",h1:"1",h2:"2",h3:"3",h4:"4",i1:"",i2:"",i3:"",i4:"",i5:""},bi={header_protection_key:"HeaderProtectionKey",content_padding_addition:"ContentPaddingAddition",rekey_after_time:"RekeyAfterTime",rekey_timeout:"RekeyTimeout",reject_after_time:"RejectAfterTime",keepalive_timeout:"KeepaliveTimeout",max_handshake_attempts:"MaxHandshakeAttempts",random_trailers:"RandomTrailers",disable_cookies:"DisableCookies"};function xi(n){let e={};for(let[o,s]of Object.entries(bi))n[o]!=null&&n[o]!==""&&(e[s]=String(n[o]));return e}function wi(n,e){let o=n.amnezia,s=o.obfuscation??{},r=d=>s[d]!=null&&s[d]!==""?String(s[d]):vi[d],a=o.host.replace(/^\[(.*)\]$/,"$1"),i={H1:r("h1"),H2:r("h2"),H3:r("h3"),H4:r("h4"),I1:r("i1"),I2:r("i2"),I3:r("i3"),I4:r("i4"),I5:r("i5"),Jc:r("jc"),Jmin:r("jmin"),Jmax:r("jmax"),S1:r("s1"),S2:r("s2"),S3:r("s3"),S4:r("s4"),...xi(s),allowed_ips:o.allowed_ips,client_ip:o.client_ip,client_priv_key:o.client_priv_key,client_pub_key:o.client_pub_key,config:n.conf.replace(/\r?\n/g,`\r +`),hostName:a,mtu:o.mtu,persistent_keep_alive:o.persistent_keep_alive,port:Number(o.port),psk_key:o.psk_key,server_pub_key:o.server_pub_key},l={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(i),port:String(o.port),protocol_version:s.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:e,hostName:a};return o.dns[0]&&(l.dns1=o.dns[0]),o.dns[1]&&(l.dns2=o.dns[1]),l}function yi(n){let e="";for(let o=0;o"u")return null;try{let o=new e.Blob([n]).stream().pipeThrough(new e.CompressionStream("deflate")),s=new Uint8Array(await new e.Response(o).arrayBuffer()),r=new Uint8Array(4+s.length);return new DataView(r.buffer).setUint32(0,n.length,!1),r.set(s,4),r}catch{return null}}async function mo(n,e,o=!0){let s=new TextEncoder().encode(JSON.stringify(wi(n,e))),r=o?await ki(s):null;return`vpn://${yi(r??s)}`}function Ds(){return[{id:"off",title:_("Off"),ic:"zap",stealth:0,speed:4,text:_("Plain WireGuard-compatible traffic. Fastest, but easy to recognise and block."),apps:_("Any WireGuard app"),short:_("Any WireGuard app")},{id:"balanced",title:_("Balanced"),ic:"shield",stealth:3,speed:4,needs:"v2",text:_("AmneziaWG 2.0: junk packets, padded packets and a first packet that looks like DNS. For networks that learned to spot 1.0-style junk."),apps:_("AmneziaVPN 4.8.12 or newer, AmneziaWG 2.0+ apps"),short:_("AmneziaWG 2.0+ apps")},{id:"max",title:_("Maximum"),ic:"lock",stealth:4,speed:3,needs:"v3",text:_("AmneziaWG 3.1: encrypted packet headers, random tails and sizes, jittered timing, and a first packet that looks like DNS."),apps:_("Apps with AmneziaWG 3.1 (current AmneziaVPN)"),short:_("AmneziaWG 3.1 apps")}]}var Kt=n=>Ds().find(e=>e.id===n),wn=n=>n.v3?"max":n.v2?"balanced":"off",Yt=n=>n==="standard"?_("Standard (old)"):n==="strong"?_("Strong (old)"):null;function _i(n,e){return e?n==="v2"?_("Needs AmneziaWG 2.0 or newer on the router (kmod-amneziawg and amneziawg-tools from July 2025 on)."):_("Needs AmneziaWG 3.1 on the router (kmod-amneziawg and amneziawg-tools 3.1)."):n==="v2"?_("Needs AmneziaWG on the router."):_("Needs AmneziaWG 3.1 on the router: install it first.")}function $s(n,e){return t("span",{class:"dl-dots",title:m(_("%s: %s of 4"),e,n)},[t("span",{class:"dl-dots-label"},e),t("span",{class:"dl-dots-row"},[0,1,2,3].map(o=>t("i",{class:odom.content(a,Ds().map(l=>{let d=!l.needs||n[l.needs],c=l.id===e;return t("button",{type:"button",role:"radio","aria-checked":c?"true":"false","aria-disabled":d?null:"true",class:`dl-method${c?" on":""}${d?"":" off"}`,click:()=>{!d||c||(e=l.id,i(),o(l.id))}},[t("div",{class:"dl-method-head"},[t("span",{class:"dl-method-ic"},v(l.ic)),t("b",{},l.title),l.id===s?t("span",{class:"dl-pill ok"},_("Current")):""]),t("p",{},l.text),t("div",{class:"dl-method-meters"},[$s(l.stealth,_("Stealth")),$s(l.speed,_("Speed"))]),t("div",{class:"dl-method-foot"},d?[v(l.id==="off"?"wireguard":"amneziawg"),t("span",{},l.apps)]:[v("alert"),t("span",{},_i(l.needs,r))])])}));return i(),a}function As(n,e){return t("div",{class:"dl-corehead"},[t("h3",{},n),e?t("span",{class:"dl-sub"},e):""])}var Ns=[["jc","Jc"],["jmin","Jmin"],["jmax","Jmax"],["s1","S1"],["s2","S2"],["s3","S3"],["s4","S4"],["h1","H1"],["h2","H2"],["h3","H3"],["h4","H4"],["i1","I1"],["i2","I2"],["i3","I3"],["i4","I4"],["i5","I5"],["header_protection_key","HeaderProtectionKey"],["content_padding_addition","ContentPaddingAddition"],["rekey_after_time","RekeyAfterTime"],["rekey_timeout","RekeyTimeout"],["reject_after_time","RejectAfterTime"],["keepalive_timeout","KeepaliveTimeout"],["max_handshake_attempts","MaxHandshakeAttempts"],["random_trailers","RandomTrailers"],["disable_cookies","DisableCookies"]];function Ci(n){let e=c=>n[c]!=null&&n[c]!=="",o=Ns.filter(([c])=>e(c));if(!o.length)return null;let s=(c,p)=>t("span",{class:"dl-pv"},[t("i",{},p),t("b",{},c==="header_protection_key"?`${n[c].slice(0,6)}••••`:n[c])]),r=(c,p,u,w)=>{let M=Ns.filter(([g])=>w.includes(g)&&e(g));return M.length?t("div",{class:"dl-pgroup"},[t("div",{class:"dl-pgroup-head"},[v(p),t("b",{},c)]),t("p",{},u),t("div",{class:"dl-pvals"},M.map(([g,h])=>s(g,h)))]):""},a=Number(n.jc||0),i=(n.i1??"").includes("0x8580")?_("A first packet shaped like a DNS answer."):_("Extra packets sent before the handshake."),l=o.map(([c,p])=>`${p} = ${n[c]}`).join(` `),d=t("div",{class:"dl-pgrid"},[r(_("Junk packets"),"zap",a?m(N_(a,"%s random packet of %s–%s bytes before each handshake.","%s random packets of %s–%s bytes before each handshake."),K(a),n.jmin,n.jmax):_("No junk packets."),["jc","jmin","jmax"]),r(_("Padding"),"archive",_("Random bytes in front of handshake, cookie and data packets, so their sizes do not match WireGuard."),["s1","s2","s3","s4"]),r(_("Packet types"),"key",_("The values that replace WireGuard’s recognisable message types."),["h1","h2","h3","h4"]),r(_("Signatures"),"globe",i,["i1","i2","i3","i4","i5"]),r(_("Protection"),"lock",_("AmneziaWG 3.1: encrypted headers, random tails and extra padding on data packets."),["header_protection_key","content_padding_addition","random_trailers","disable_cookies"]),r(_("Timing"),"clock",_("Handshake and key timers vary within these ranges instead of WireGuard’s fixed values."),["rekey_after_time","rekey_timeout","reject_after_time","keepalive_timeout","max_handshake_attempts"])]);return t("details",{class:"dl-params"},[t("summary",{},[v("chevron"),t("span",{},_("Current parameters")),t("span",{class:"dl-pcount"},String(o.length)),t("span",{class:"dl-spacer"}),t("button",{type:"button",class:"dl-linkbtn",click:c=>{c.preventDefault(),xe(l,_("Parameters copied"))}},_("Copy as config"))]),d])}function Hs(n,e){if(/^\s*\[.+\]\s*$/.test(n))return t("span",{class:"dl-conf-sec"},n);let o=/^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(n);if(!o)return document.createTextNode(n);let s=/^(\s*)(PrivateKey|PresharedKey)\b/.test(n);return t("span",{},[t("span",{class:"dl-conf-k"},o[1])," ",s&&!e?t("span",{class:"dl-conf-mask"},"••••••••••••••••"):o[2]])}function Li(n){let e=!1,o=t("pre",{class:"dl-conf"}),s=()=>dom.content(o,n.conf.split(` `).flatMap((i,l)=>l?[` -`,Hs(i,e)]:[Hs(i,e)])),r=t("button",{type:"button",class:"dl-chipbtn",click:i=>{i.preventDefault(),e=!e,dom.content(r,[v(e?"x":"key"),e?_("Hide key"):_("Show key")]),s()}},[v("key"),_("Show key")]);s();let a=new Blob([n.conf]).size;return t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-filecard"},[t("span",{class:"dl-filecard-ic"},".conf"),t("span",{class:"dl-stack"},[t("span",{class:"dl-mono dl-ellipsis"},n.filename),t("span",{class:"dl-sub"},`AmneziaWG · ${W(a,"%s byte","%s bytes")}`)]),A([v("download")," ",_("Download")],()=>Ne(n.filename,n.conf,"application/octet-stream"),"positive")]),t("details",{class:"dl-params"},[t("summary",{},[v("chevron"),t("span",{},_("Configuration")),t("span",{class:"dl-spacer"}),r,t("button",{type:"button",class:"dl-chipbtn",click:i=>{i.preventDefault(),xe(n.conf,_("Configuration copied"))}},[v("copy"),_("Copy")])]),o])])}function ho(n){let e=n.amnezia.obfuscation??{},o={h1:"1",h2:"2",h3:"3",h4:"4"};return Object.entries(e).every(([s,r])=>r==null||r===""||r===(o[s]??"0"))}async function Mi(n,e="file"){if(!n.has_private_key)return t("div",{class:"dl-hint"},_("This device generated its own keys in the browser, so its full configuration only exists on that device."));let o=await mo(n,n.server),s={qr:()=>t("div",{class:"dl-qr-pane"},[un(n.conf),t("span",{class:"dl-sub"},ho(n)?_("Scan with AmneziaVPN or any WireGuard app on the device."):_("Scan with AmneziaVPN or AmneziaWG on the device."))]),key:()=>t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-linkbox"},[t("span",{class:"dl-mono"},o),A(_("Copy"),()=>xe(o,_("Key copied")))]),t("span",{class:"dl-sub"},m(_("AmneziaVPN → %s. Keep it private."),["+",_("Insert","AmneziaVPN app"),_("Continue","AmneziaVPN app")].join(" → ")))]),file:()=>Li(n)},r=t("div",{class:"dl-connect-body"}),a=t("div",{class:"dl-seg"}),i=l=>{a.querySelectorAll("button").forEach(d=>d.classList.toggle("on",d.dataset.id===l)),dom.content(r,s[l]())};for(let[l,d]of[["file",_("File")],["key",_("Key")],["qr",_("QR code")]])a.appendChild(t("button",{type:"button","data-id":l,click:()=>i(l)},d));return i(e),t("div",{class:"dl-stack gap12"},[a,r])}async function Ei(n,e,o,s){let r=Kt(o),i=n.st.people.filter(d=>d.server===e.id).reduce((d,c)=>d+c.devices.length,0);await me(s?_("Generate new disguise values?"):m(_("Switch to %s?"),r.title),[W(i,"%s AmneziaWG device stops connecting until it imports its configuration again (from their personal link or from you).","%s AmneziaWG devices stop connecting until they import their configuration again (from their personal link or from you)."),o==="max"?_("They need an app with AmneziaWG 3.1."):o==="balanced"?_("They need an app with AmneziaWG 2.0 or newer."):"",n.st.servers.length===1&&i?_("To keep the old disguise for some people, add a second server and move them there."):""].filter(Boolean).join(" "),s?_("Generate and apply"):_("Switch and apply"),!0)&&await F(()=>N.serverObfuscation(e.id,o),s?_("New values applied"):m(_("%s applied"),r.title))&&(q(_("Devices are marked “Update config” until they import again."),"info",6e3),await n.refresh())}function Ti(n,e){let o=n.st,s=he(String(e.port),{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),r=he(e.mtu?String(e.mtu):"",{placeholder:_("Auto"),inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),a=he(String(e.keepalive??""),{placeholder:"25",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),i=Kt(e.preset)?e.preset:void 0,l=i??wn(o.awg),d=A("",()=>Ei(n,e,l,l===i),"neutral"),c=()=>dom.content(d,l===i?[v("reset")," ",_("Generate new values")]:[m(_("Switch to %s"),Kt(l).title)]);c();let p=o.awg_state?.tools!==!1,u=[],k=_e(_("UDP port"),s,()=>Gt(Number(s.value),u,[_("Opened on the WAN firewall automatically."),Number(s.value)===4500?_("4500 is IPsec’s port: most networks let it through."):""].filter(Boolean).join(" ")));N.serverPorts(e.id).then(h=>{u=h.udp_taken??[],k.refresh()}).catch(()=>{});let M=_e("MTU",r,()=>ps(r.value,e.mtus)),g=_e(_("Keep-alive"),a,()=>us(a.value));return Wt("",[As("AmneziaWG",e.ifname),ke("globe",_("Listening"),_("Where devices reach this core from the internet"),[k]),ke("file",_("In every device configuration"),_("Changing these marks devices “Update config” until they import again"),[M,g]),ke("shield",_("Disguise"),_("So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard"),[Yt(e.preset)?bt("warn",ae(_("%s is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to %s or %s: devices import their configuration again."),t("b",{},Yt(e.preset)),t("b",{},_("Balanced")),t("b",{},_("Maximum")))):"",yn(o.awg,l,h=>{l=h,c()},i,p),p&&!o.awg.v3?bt("info",ae(_("This router runs an older AmneziaWG. %s becomes available with kmod-amneziawg and amneziawg-tools 3.1."),t("b",{},_("Maximum")))):"",Ci(e.obf??{})??"",t("div",{class:"dl-row-end"},[t("span",{class:"dl-sub"},_("Applies at once: every AmneziaWG device imports its configuration again.")),d])]),t("details",{class:"dl-params"},[t("summary",{},[v("chevron"),t("span",{},_("Tunnel")),t("span",{class:"dl-pcount"},"3")]),t("div",{class:"dl-params-body"},[ge(_("Interface"),t("span",{class:"dl-mono"},`${e.ifname} · ${m(_("router %s"),e.address)}`)),ge(_("Tunnel subnet"),t("span",{class:"dl-mono"},e.subnet),_("Device addresses come from it.")),ge(_("Server public key"),t("span",{class:"dl-keyrow"},[t("code",{class:"dl-mono"},e.public_key),A([v("copy")],()=>xe(e.public_key,_("Public key copied")),"neutral",{title:_("Copy"),class:"cbi-button cbi-button-neutral dl-icon-only sm"})]))])])],[t("span",{class:"dl-sub"},_("Port, MTU and keep-alive apply at once.")),A(_("Save"),()=>{let h=Ue([k,M,g]);if(h){q(h,"warning");return}return n.save({port:s.value,mtu:r.value,keepalive:a.value},_("AmneziaWG saved"))},"positive")])}function Si(n){let e=Kt(n.preset),o=n.obf??{},s=(i,l)=>t("span",{class:`dl-segs ${l}`},[0,1,2,3].map(d=>t("i",{class:d+o[i]).map(i=>`${i.toUpperCase()} ${o[i]}`);return a.length&&r.push(a.slice(0,2).join(" · ")+(a.length>2?` +${a.length-2}`:"")),["h1","h2","h3","h4"].some(i=>o[i]&&o[i]!==String(["h1","h2","h3","h4"].indexOf(i)+1))&&r.push(_("H1–H4 random")),o.i1&&r.push(/0x(8580|0100)0001/.test(o.i1)?_("DNS-like first packets"):_("Signature packets")),o.header_protection_key&&r.push(_("Encrypted headers")),r.length||r.push(e?.id==="off"?_("Plain WireGuard"):_("No values yet")),t("div",{class:"dl-bento-tile dl-disg"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},_("Disguise")),t("a",{href:`${L.url("admin/network/dawnline/server")}?server=${encodeURIComponent(n.id)}§ion=awg`},_("Change"))]),t("div",{class:"dl-disg-id"},[t("span",{class:`dl-disg-ic${e?.id==="off"?" off":""}`},v(e?.ic??"shield")),t("span",{class:"dl-stack"},[t("b",{},e?e.title:Yt(n.preset)??_("Custom","disguise")),t("span",{class:"dl-sub"},e?e.short:Yt(n.preset)?_("Switch to Balanced or Maximum"):_("Set by hand"))])]),e?t("div",{class:"dl-disg-meters"},[t("span",{},_("Stealth")),s(e.stealth,"acc"),t("span",{},_("Speed")),s(e.speed,"ok")]):"",t("div",{class:"dl-disg-chips"},r.map(i=>t("span",{},i)))])}var fo={id:"awg",label:"AmneziaWG",settingsCard:Ti,overviewTile:Si,connectBlock:Mi,qrText:n=>n.conf,appKey:{get label(){return _("Copy AmneziaVPN config")},make:n=>mo(n,n.server)},file:{get label(){return _("Download AmneziaWG config")},make:n=>({name:n.filename,text:n.conf})}};var Pi={awg:fo};function qe(n){return Pi[n?.core||"awg"]??fo}function zt(n,e){return qe(n.find(o=>o.id===e))}var $i=2,Vt=new Set,go=null,kn=null;async function zs(){if(document.visibilityState!=="visible"||!Vt.size)return;let n=await N.rev().catch(()=>null);if(!n)return;let e=go!=null&&n.rev!==go;go=n.rev,n.version&&(kn&&n.version!==kn?(q(m(_("Dawnline was updated to %s: reload the page."),n.version),"warning",15e3),kn=null):kn??(kn=n.version)),e&&Vt.forEach(o=>o())}function _n(n){return Vt.add(n),poll.add(zs,$i),()=>{Vt.delete(n),Vt.size||poll.remove(zs)}}function Bs(n,e,o,s,r=0){let a=[],i=null,l=p=>{i&&p>i.from&&a.push({...i,to:p}),i=null},d=n.filter(p=>p.device===e).sort((p,u)=>p.ts-u.ts);for(let p of d)if(p.type==="connect")l(p.ts),p.detail&&(i={ip:p.detail,from:p.ts,to:p.ts,live:!1});else if(p.type==="roam"){let u=p.detail?.split("→")[1]?.trim();l(p.ts),u&&(i={ip:u,from:p.ts,to:p.ts,live:!1})}else p.type==="disconnect"&&l(p.ts);let c=i;return c&&s?a.push({...c,to:Math.max(o,c.from),live:!0}):l(Math.min(o,r)),a}function et(n){return`${n.city||`${n.lat.toFixed(1)},${n.lon.toFixed(1)}`}|${n.cc}`}function Os(n,e,o,s){let r=new Map;for(let i of e)(i.device===o||!r.has(i.ip))&&r.set(i.ip,i);let a=[];for(let i of n){let l=r.get(i.ip);!l||i.to<=s||a.push({key:et(l),point:l,from:Math.max(i.from,s),to:i.to,live:i.live})}return a}function js(n){let e=new Map,o=0;for(let s of n)e.set(s.key,(e.get(s.key)??0)+(s.to-s.from)),o+=s.to-s.from;return new Map([...e].map(([s,r])=>[s,o?r/o:0]))}function Rs(n,e=2700){let o=[];for(let s of n){let r=o[o.length-1];if(r&&s.key!==r.key&&!s.live&&s.to-s.from{a&&(o.push({kind:"move",k:a,start:s,ms:e}),s+=e);let i=Math.min(1100,Math.max(350,(r.to-r.from)/3600*45));o.push({kind:"stay",k:a,start:s,ms:i}),s+=i}),{steps:o,total:s}}function qs(n,e,o){let s=e.findIndex(l=>o>=l.start&&oo>=i.from&&oi.kind==="stay"&&i.k===s),a=n[s];return r.start+r.ms*Math.min(.999,Math.max(0,(o-a.from)/Math.max(1,a.to-a.from)))}var Di=n=>n<=0?0:n>=1?1:n<.5?2*n*n:1-(-2*n+2)**2/2;function Ks(n){return-vo/2+(1+vo)*Di((n-Is)/(1-Is))}var Ys=n=>n+Ws>=1;function Vs(n){return["interpolate",["linear"],["abs",["-",["get","pos"],n]],0,1,Ws,1,vo/2,0]}function Js(n,e){let o=n==="24h"?86400:n==="7d"?604800:2592e3,s=e-o,r=[],a=(l,d)=>{let c=(l-s)/o;c>.02&&c<.98&&r.push([c,d])},i=new Date(s*1e3);if(n==="24h")for(i.setMinutes(0,0,0);i.getTime()/1e3<=e;)i.getHours()%6===0&&a(i.getTime()/1e3,`${String(i.getHours()).padStart(2,"0")}:00`),i.setHours(i.getHours()+1);else if(n==="7d")for(i.setHours(12,0,0,0);i.getTime()/1e3<=e;i.setDate(i.getDate()+1))a(i.getTime()/1e3,i.toLocaleDateString(ie(),{weekday:"short"}));else{let l=new Date(e*1e3);l.setHours(0,0,0,0);for(let d=0;d<5;d++){let c=new Date(l);c.setDate(l.getDate()-7*d),a(c.getTime()/1e3,c.toLocaleDateString(ie(),{day:"numeric",month:"short"}))}r.reverse()}return r}var Cn=n=>new Date(n*1e3).toLocaleTimeString(ie(),{hour:"2-digit",minute:"2-digit"});function Zs(n,e){let o=s=>new Date(s*1e3).toDateString();return o(n)===o(e)?_("Today"):o(n)===o(e-86400)?_("Yesterday"):new Date(n*1e3).toLocaleDateString(ie(),{weekday:"short",day:"numeric",month:"short"})}var xo="https://unpkg.com/maplibre-gl@6.14.0/dist",Qs={module:"sha384-q26X6R1yFeg0QR9SHHn6U3Nb0ddRRTtwxsahubv5R89/v5nijKpk9KviUp9ZLySk",css:"sha384-1TZtfVz7qtwR5vD7cMwjGT+9uiK4lqE3pbUOPwYO6OCpb+TYP0S9vLIhG02JCU04"},Xs="https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",er="https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",Ai={online:0,"24h":86400,"7d":7*86400,"30d":30*86400},Jt=null;function Ni(n){if(n.appendChild(t("link",{rel:"stylesheet",href:`${xo}/maplibre-gl.css`,integrity:Qs.css,crossorigin:"anonymous"})),Jt)return Jt;let e=`${xo}/maplibre-gl.mjs`;return Jt=new Promise((s,r)=>{let a=t("link",{rel:"modulepreload",href:e,integrity:Qs.module,crossorigin:"anonymous"});a.addEventListener("load",()=>s()),a.addEventListener("error",()=>r(new Error("integrity"))),document.head.appendChild(a)}).then(()=>import(e)).then(s=>(s.getWorkerUrl()||s.setWorkerUrl(`${xo}/maplibre-gl-worker.mjs`),s),s=>{throw Jt=null,new Error(s?.message==="integrity"?_("The map library from the CDN is not the expected file: not loading it."):_("Could not load the map library (no internet access from this browser?)"))}),Jt}var Hi=10,tr=30,zi=62,Ri=4,nr=4.5,Ii=7,Ln="#3b82f6",wo="#8a8a8a";function or(n,e,o=.2,s=64){let[r,a]=n,[i,l]=e,d=i-r,c=d>180?i-360:d<-180?i+360:i,p=c-r,u=l-a,k=Math.hypot(p,u);if(k===0||o===0)return[n,[c,l]];let M=-u/k,g=p/k,h=k*o,E=(r+c)/2+M*h,H=(a+l)/2+g*h,S=[],$=Math.max(2,Math.floor(s));for(let b=0;b<=$;b+=1){let C=b/$,w=1-C;S.push([w*w*r+2*w*C*E+C*C*c,w*w*a+2*w*C*H+C*C*l])}return S}function yo(n,e){let o=new Map;for(let s of n.geo.points){if(n.person&&s.person!==n.person||n.device&&s.device!==n.device||(e==="online"?!s.online:n.now-s.ts>Ai[e]))continue;let r=n.device?et(s):n.person?`${s.device}|${s.city}|${s.cc}`:s.device,a=o.get(r);(!a||s.online&&!a.online||s.online===a.online&&s.ts>a.ts)&&o.set(r,s)}return[...o.values()]}function ko(n,e){let o=0;return yo(n,e).sort((s,r)=>Number(r.online)-Number(s.online)||r.ts-s.ts).map(s=>({...s,n:s.online?0:++o}))}var dt=class{constructor(e,o="online",s=380){this.cb=e;this.map=null;this.gl=null;this.markers=[];this.popup=null;this.theme=null;this.resize=null;this.fitBlind=!1;this.data=null;this.fitted=!1;this.fitKey=null;this.people=[];this.slots=[];this.merged=[];this.piles=new Map;this.dock=null;this.dockKey="";this.dockQuiet=!1;this.piledKeys=new Set;this.foldedKeys=new Set;this.targetZoom=null;this.before=null;this.hiddenKey="";this.focused=null;this.dead=!1;this.places=new Map;this.replaying=null;this.bandDots=[];this.range=o,this.status=t("div",{class:"dl-map-status"}),this.card=t("div",{class:"dl-map-card","aria-live":"polite"}),this.el=t("div",{class:"dl-geomap",style:`height:${s}px`},[this.status,this.card])}async mount(e){this.data=e;try{this.gl=await Ni(this.el)}catch(s){this.status.textContent=s.message;return}if(this.dead)return;this.map=new this.gl.Map({container:this.el,style:xt()?Xs:er,center:[e.geo.home?.lon??20,e.geo.home?.lat??50],zoom:1,renderWorldCopies:!1,attributionControl:{compact:!0},minZoom:1}),this.map.on("style.load",()=>this.layers()),this.map.on("move",()=>this.declutter()),this.map.once("idle",()=>{let s=this.el.querySelector(".maplibregl-ctrl-attrib");s?.classList.remove("maplibregl-compact-show"),s?.removeAttribute("open")}),this.resize=new ResizeObserver(()=>{!this.map||!this.el.clientWidth||!this.el.clientHeight||(this.map.resize(),this.fitBlind&&(this.fitKey=null,this.draw()))}),this.resize.observe(this.el);let o=xt();this.theme=new MutationObserver(()=>{!this.map||xt()===o||(o=xt(),this.map.setStyle(o?Xs:er))}),this.theme.observe(document.documentElement,{attributes:!0,attributeFilter:["data-darkmode"]})}layers(){if(this.map){this.hiddenKey="",this.map.setProjection({type:"globe"}),this.map.addSource("dl-areas",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),this.map.addLayer({id:"dl-area",type:"circle",source:"dl-areas",paint:{"circle-radius":["interpolate",["exponential",2],["zoom"],2,6,6,26,9,140,12,900],"circle-color":["case",["get","online"],Ln,wo],"circle-opacity":["case",["get","online"],.12,.06],"circle-stroke-width":1,"circle-stroke-color":["case",["get","online"],Ln,wo],"circle-stroke-opacity":["case",["get","online"],.35,.15]}}),this.map.addSource("dl-band",{type:"geojson",data:{type:"FeatureCollection",features:this.bandDots}}),this.map.addLayer({id:"dl-band",type:"circle",source:"dl-band",paint:{"circle-radius":1.4,"circle-color":Ln,"circle-opacity":0}}),this.map.addSource("dl-arcs",{type:"geojson",data:{type:"FeatureCollection",features:[]}});for(let e of[!1,!0])this.map.addLayer({id:e?"dl-arc-live":"dl-arc-recent",type:"line",source:"dl-arcs",filter:["==",["get","online"],e],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":e?Ln:wo,"line-width":2,"line-opacity":.85,"line-dasharray":[2,2]}});this.draw()}}setRange(e){this.range=e,this.fitKey=null,this.draw()}update(e){this.data=e,this.draw()}destroy(){this.dead=!0,this.dropCard();for(let e of this.piles.values())e.marker.remove();this.piles.clear(),this.theme?.disconnect(),this.resize?.disconnect(),this.map?.remove(),this.map=null}groups(e){let o=new Map;for(let s of e){let r=`${s.person}|${et(s)}`,a=o.get(r);a||(a={key:r,person:s.person,lat:s.lat,lon:s.lon,city:s.city,country:s.country,cc:s.cc,asn:s.asn,org:s.org,online:!1,ts:0,points:[]},o.set(r,a)),a.points.push(s),a.online||(a.online=s.online),a.ts=Math.max(a.ts,s.ts)}return[...o.values()]}draw(){if(!this.map||!this.data||!this.map.getSource("dl-arcs"))return;let e=this.data,o=this.groups(yo(e,this.range)),s=e.person||e.device?null:e.geo.home;for(let d of this.markers)d.remove();this.markers=[];let r=e.person||e.device?null:Oi(o,s),a=o.map(d=>({g:d,at:r?.get(d.key)??[d.lon,d.lat]}));if(this.slots=[],this.map.getSource("dl-areas").setData({type:"FeatureCollection",features:a.map(({g:d})=>({type:"Feature",properties:{online:d.online,key:d.key},geometry:{type:"Point",coordinates:[d.lon,d.lat]}}))}),this.map.getSource("dl-arcs").setData({type:"FeatureCollection",features:s?a.map(({g:d,at:c})=>({type:"Feature",properties:{online:d.online,person:d.person,key:d.key},geometry:{type:"LineString",coordinates:or([s.lon,s.lat],c)}})):[]}),s){let d=t("span",{class:"dl-mk-host"});d.innerHTML=`${kt("server","dl-mk-host-ic")}`,this.dock=d.appendChild(t("span",{class:"dl-mk-dock"})),this.dockQuiet=this.dockKey!=="",this.dockKey="";let c=t("div",{class:"dl-mk-hub",title:`${_("Home router")}${s.city?` · ${s.city}`:""}${s.org?` · ${s.org}`:""}`},[d,t("span",{class:"dl-mk-label chip"},s.city||_("Home"))]);c.addEventListener("mouseenter",()=>this.showMerged(s.city)),c.addEventListener("mouseleave",()=>this.focus(this.focused)),c.addEventListener("click",()=>this.zoomToMerged()),this.add(c,[s.lon,s.lat],!0)}let i=new Map(e.device?ko(e,this.range).map(d=>[et(d),d.n]):[]);this.people=[],this.places.clear();for(let{g:d,at:c}of a){let p=d.points.length,u=e.people.find(h=>h.id===d.person);if(e.person){let h=e.device?this.deviceMarker(d,c,u,i.get(et(d))??0):this.placeMarker(d,c,u);this.add(h,c);continue}let k=d.points.map(h=>u?.devices.find(E=>E.id===h.device)?.kind??"other"),M=t("span",{class:"dl-mk-badge"});M.innerHTML=p<=2?k.map(h=>kt(h,"dl-mk-badge-ic")).join(""):String(p);let g=t("button",{type:"button",class:`dl-mk${d.online?" online":""}`,"aria-label":d.city?m(N_(p,"%s: %s device in %s","%s: %s devices in %s"),u?.name??_("Someone"),K(p),d.city):m(N_(p,"%s: %s device in an unknown city","%s: %s devices in an unknown city"),u?.name??_("Someone"),K(p))},[t("span",{class:"dl-mk-av"},[je(u?.name??"?"),M]),t("span",{class:"dl-mk-label below"},d.city||d.cc||"?")]);g.addEventListener("mouseenter",()=>this.focus(d.person)),g.addEventListener("mouseleave",()=>this.focus(null)),this.people.push({el:g,person:d.person}),g.addEventListener("click",h=>{h.stopPropagation(),this.openPopup(d,c,g)}),this.add(g,c,!1,u?.name??_("Someone"),`${d.city||d.cc||"?"} · ${d.online?_("now"):pe(d.ts,e.now)}`,d.key,d)}this.declutter();let l=a.map(d=>d.g.key).sort().join(";");if(l!==this.fitKey&&!this.popup){let d=this.fitted&&!this.fitBlind;if(this.fitBlind=!this.el.clientWidth||!this.el.clientHeight,this.fitKey=l,this.fitted=!0,s&&!a.length){let c={center:[s.lon,s.lat],zoom:12};d?this.glide(12,()=>this.map.flyTo({...c,duration:1200})):this.map.jumpTo(c)}else{let c=a.map(p=>p.at);s&&(c.length===0||this.range!=="online"||a.some(p=>p.g.online))&&c.push([s.lon,s.lat]),this.fit(c,d)}}this.status.textContent=a.length||s?"":_("No locations yet"),this.status.style.display=this.status.textContent?"":"none",this.focus(this.focused&&this.people.some(d=>d.person===this.focused)?this.focused:null)}add(e,o,s=!1,r,a,i,l){i&&this.foldedKeys.has(i)&&e.classList.add("merged"),i&&this.piledKeys.has(i)&&e.classList.add("piled"),e.dataset.key=i??"",e.classList.add("dl-mk-new"),requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove("dl-mk-new")));let d=new this.gl.Marker({element:e}).setLngLat(o).addTo(this.map);this.markers.push(d),this.slots.push({marker:d,el:e,at:o,fixed:s,who:r,where:a,g:l})}declutter(){if(!this.map)return;let e=this.map.getZoom();this.el.classList.toggle("dl-lod-far",e=nr&&e{let l=this.map.project(i.at),d=i.el.querySelector(":scope > .dl-mk-host, :scope > .dl-mk-av, :scope > .dl-mk-tile");return{x:l.x,y:l.y,r:(d?.offsetWidth||24)/2+3,fixed:i.fixed}}),s=o.filter(i=>i.fixed);this.merged=[],this.foldedKeys.clear();let r=this.targetZoom==null?1:Math.min(1,2**(this.targetZoom-this.map.getZoom()));o.forEach((i,l)=>{if(i.fixed)return;let d=this.slots[l],c=d.el.classList.contains("merged")?12:6,p=s.find(u=>Math.hypot(u.x-i.x,u.y-i.y)*r{let c=this.slots[d];!c||c.fixed||(o[d].fixed&&([i,l]=[0,0]),c.marker.setOffset([i,l]),Ui(c.el,i,l))})}closePopup(e=!1){let o=this.popup;if(!o||o.card.classList.contains("leaving"))return;o.card.classList.add("leaving"),setTimeout(()=>{this.popup===o&&this.dropCard()},140);let s=this.before;if(this.before=null,!s)return;let r=()=>this.map?.flyTo({...s,duration:800});if(!e)return r();let a=!1,i=()=>{a||(a=!0,window.removeEventListener("pointerup",i,!0),window.removeEventListener("pointercancel",i,!0),setTimeout(r,0))};window.addEventListener("pointerup",i,!0),window.addEventListener("pointercancel",i,!0),setTimeout(i,1500)}dropCard(){this.popup?.off(),this.popup?.card.remove(),this.popup=null}showMerged(e){this.merged.length&&(dom.content(this.card,[t("div",{class:"dl-map-card-head"},[t("b",{},e?m(_("Near %s"),e):_("Near the server")),` · ${_("click to zoom in")}`]),...this.merged.map(o=>t("div",{class:"dl-map-card-row"},[t("span",{},o.who),t("span",{class:"dl-faint"},o.where)]))]),this.card.classList.add("on"))}paintDock(){let e=this.dock;if(!e)return;let o=this.merged.map(r=>`${r.key}:${r.online?1:0}`).join("|");if(o===this.dockKey)return;this.dockKey=o,e.parentElement?.classList.toggle("docked",this.merged.length>0);let s=this.slots.find(r=>r.fixed).at;this.merged.length&&rr(e,this.merged,this.faceActions(()=>[s]),this.dockQuiet),this.dockQuiet=!1}faceActions(e){return{click:(o,s)=>this.openFace(o,s,e()),hover:o=>this.focus(o?.g?.person??null)}}pileUp(e){let o=new Set;if(!this.data?.person&&!this.data?.device){let s=e.flatMap((l,d)=>!l.fixed&&this.slots[d].el.querySelector(":scope > .dl-mk-av")?[d]:[]),r=new Map(s.map(l=>[l,l])),a=l=>r.get(l)===l?l:a(r.get(l));for(let l of s)for(let d of s){if(d<=l)continue;let c=this.slots[l].el.classList.contains("piled")&&this.slots[d].el.classList.contains("piled");Math.hypot(e[l].x-e[d].x,e[l].y-e[d].y)this.slots[h]),c=d.map(sr),p=c.map(h=>h.key).sort().join(",");o.add(p);let u=[d.reduce((h,E)=>h+E.at[0],0)/d.length,d.reduce((h,E)=>h+E.at[1],0)/d.length],k=this.piles.get(p);if(!k){let h=t("span",{class:"dl-mk-pile-box"}),E=[...new Set(d.map($=>$.g?.city||$.g?.cc||"?"))],H=t("div",{class:"dl-mk-pile"},[h,t("span",{class:"dl-mk-label below"},E.length===1?E[0]:W(d.length,"%s person","%s people"))]);k={marker:new this.gl.Marker({element:H}).setLngLat(u).addTo(this.map),el:H,box:h,faces:c},H.addEventListener("mouseleave",()=>this.focus(this.focused));let S=k;H.addEventListener("click",$=>{$.stopPropagation(),this.zoomInTo(S.faces.map(b=>b.at),!1)}),this.piles.set(p,k)}k.faces=c;let M=k;rr(k.box,c,this.faceActions(()=>M.faces.map(h=>h.at)));for(let h of l)this.slots[h].el.classList.add("piled"),Object.assign(e[h],{r:0,fixed:!0});let g=this.map.project(u);e.push({x:g.x,y:g.y,r:(k.el.offsetWidth||60)/2+3,fixed:!0})}}this.piledKeys=new Set(this.slots.filter(s=>s.el.classList.contains("piled")).map(s=>s.el.dataset.key??"")),this.slots.forEach((s,r)=>{(!e[r].fixed||s.fixed||s.el.classList.contains("merged"))&&s.el.classList.remove("piled")});for(let[s,r]of this.piles)o.has(s)||(this.piles.delete(s),r.el.classList.add("out"),setTimeout(()=>r.marker.remove(),200))}zoomToMerged(){!this.map||!this.merged.length||this.zoomInTo([this.slots.find(e=>e.fixed).at,...this.merged.map(e=>e.at)],!1)}openFace(e,o,s){if(!e.g)return;if(s.every(a=>Mn(a,e.at)<1))return this.openPopup(e.g,e.at,o);let r=()=>{let a=this.slots.find(i=>i.el.dataset.key===e.key);a?.g&&!a.el.classList.contains("merged")&&!a.el.classList.contains("piled")&&this.openPopup(a.g,a.at,a.el)};this.zoomInTo(this.nearby(e.at),!0)?this.map.once("moveend",r):r()}nearby(e){return[e,...this.slots.filter(o=>!o.fixed&&o.at!==e&&Mn(o.at,e)<=tr).map(o=>o.at)]}zoomInTo(e,o){let s=new this.gl.LngLatBounds;for(let p of e)s.extend(p);let r=e.some(p=>e.some(u=>Mn(p,u)>tr)),a=this.map.cameraForBounds(s,{padding:50,maxZoom:r?12:Hi}),i=this.map.getZoom(),l=e.map(p=>this.map.project(p)),d=0;l.forEach((p,u)=>l.slice(u+1).forEach(k=>{let M=Math.hypot(p.x-k.x,p.y-k.y),g=i+Math.log2(zi/Math.max(M,1e-6));g<=12&&(d=Math.max(d,g))}));let c=Math.min(12,Math.max(a?.zoom??0,d));return c<=i+.05?!1:(o&&!this.before&&(this.before={center:this.map.getCenter().toArray(),zoom:i}),this.map.flyTo({center:a?.center??s.getCenter(),zoom:c,duration:800}),!0)}placeMarker(e,o,s){let r=this.data.now,a=[...e.points].sort((u,k)=>Number(k.online)-Number(u.online)||k.ts-u.ts)[0],i=s?.devices.find(u=>u.id===a.device)?.kind??"other",l=e.points.length,d=t("span",{class:"dl-mk-tile"});d.innerHTML=kt(i,"dl-mk-tile-ic")+(l>1?`${l}`:"");let c=e.online?_("now"):pe(e.ts,r),p=t("button",{type:"button",class:`dl-mk place${e.online?" online":""}`,style:e.online?null:`--dl-mk-fade:${Math.max(.4,1-.6*(r-e.ts)/(30*86400)).toFixed(2)}`,"aria-label":e.city?m(N_(l,"%s device in %s, %s","%s devices in %s, %s"),K(l),e.city,c):m(N_(l,"%s device in an unknown city, %s","%s devices in an unknown city, %s"),K(l),c)},[d,t("span",{class:"dl-mk-label below"},[e.city||e.cc||"?",t("span",{class:"dl-mk-when"},c)])]);return p.addEventListener("click",u=>{u.stopPropagation(),this.openPopup(e,o,p)}),p}deviceMarker(e,o,s,r){let a=s?.devices.find(p=>p.id===e.points[0].device)?.kind??"other",i=t("span",{class:"dl-mk-tile"}),l=t("span",{class:"dl-mk-label below"}),d=t("button",{type:"button",class:"dl-mk place step"},[i,l]);d.addEventListener("click",p=>{p.stopPropagation(),this.openPopup(e,o,d)});let c=et(e);return this.places.set(c,{el:d,tile:i,label:l,when:null,g:e,n:r,kind:a}),this.paintPlace(c,!1),d}paintPlace(e,o){let s=this.places.get(e);if(!s)return;let r=this.replaying,a=r?r.active===e:s.g.online,i=s.el.classList.contains("online"),l=s.g.city||s.g.cc||"?";s.el.classList.toggle("online",a),s.el.classList.toggle("faded",!!r&&!a),s.tile.classList.toggle("sm",!a),a||!s.n?s.tile.innerHTML=kt(s.kind,"dl-mk-tile-ic"):s.tile.textContent=String(s.n),s.when=null,a?(s.when=t("span",{class:`dl-mk-when${r?" inline":""}`},r?r.when:_("now")),s.label.replaceChildren(l,r?" · ":"",s.when)):s.label.replaceChildren(`${l} · ${s.g.online?_("now"):pe(s.g.ts,this.data.now)}`);let d=a?r?r.when:_("now"):s.g.online?_("now"):pe(s.g.ts,this.data.now);s.el.setAttribute("aria-label",`${s.n?`${s.n}: `:""}${s.g.city||_("an unknown city")}, ${d}`),o&&a&&!i&&(s.el.classList.remove("arrive"),s.el.offsetWidth,s.el.classList.add("arrive"),setTimeout(()=>s.el.classList.remove("arrive"),500))}replay(e,o=!0){let s=this.replaying;if(this.replaying=e,s&&e&&s.active===e.active){let r=e.active?this.places.get(e.active):null;r?.when&&(r.when.textContent=e.when);return}for(let r of this.places.keys())r!==e?.active&&this.paintPlace(r,o);e?.active&&this.paintPlace(e.active,o),this.declutter(),setTimeout(()=>this.declutter(),320)}hoverPlace(e){for(let[o,s]of this.places)s.el.classList.toggle("hl",o===e)}band(e,o){if(this.bandDots=[],this.map&&e&&o){let s=or(e,o),r=s.map(c=>this.map.project(c)),a=[0];for(let c=1;ca[d]?(p-a[d])/(a[d+1]-a[d]):0,k=[s[d][0]+(s[d+1][0]-s[d][0])*u,s[d][1]+(s[d+1][1]-s[d][1])*u];this.bandDots.push({type:"Feature",properties:{pos:c/l},geometry:{type:"Point",coordinates:k}})}}this.map?.getLayer("dl-band")&&(this.map.setPaintProperty("dl-band","circle-opacity",0),this.map.getSource("dl-band").setData({type:"FeatureCollection",features:this.bandDots}))}bandAt(e){this.map?.getLayer("dl-band")&&this.map.setPaintProperty("dl-band","circle-opacity",Vs(e))}focus(e){this.focused=e;for(let i of this.people)i.el.classList.toggle("dim",!!e&&i.person!==e),i.el.classList.toggle("hl",i.person===e);let o=e?["case",["==",["get","person"],e],.85,.15]:.85;for(let i of["dl-arc-live","dl-arc-recent"])this.map?.getLayer(i)&&this.map.setPaintProperty(i,"line-opacity",o);if(this.card.classList.toggle("on",!!e),!e||!this.data)return;let s=this.data,r=s.people.find(i=>i.id===e),a=yo(s,this.range).filter(i=>i.person===e).sort((i,l)=>Number(l.online)-Number(i.online)||l.ts-i.ts);dom.content(this.card,[t("div",{class:"dl-map-card-head"},[t("b",{},r?.name??e),` · ${W(a.length,"%s device","%s devices")}`]),...a.map(i=>t("div",{class:"dl-map-card-row"},[t("span",{},r?.devices.find(l=>l.id===i.device)?.name??_("Device")),t("span",{class:"dl-faint"},`${i.city||i.cc||"?"} · ${i.online?_("now"):pe(i.ts,s.now)}`)]))])}fit(e,o=!1){if(!e.length)return;let s=(p,u)=>{let k=Math.PI/180,M=(u[1]-p[1])*k,g=(u[0]-p[0])*k,h=Math.sin(M/2)**2+Math.cos(p[1]*k)*Math.cos(u[1]*k)*Math.sin(g/2)**2;return 12742*Math.asin(Math.sqrt(h))},r=[e.reduce((p,u)=>p+u[0],0)/e.length,e.reduce((p,u)=>p+u[1],0)/e.length],a=e;if(e.length>=5){let p=[...e].sort((u,k)=>s(r,u)-s(r,k));a=p.slice(0,Math.ceil(p.length*.9))}let i=new this.gl.LngLatBounds(a[0],a[0]);a.forEach(p=>i.extend(p));let l=this.el.clientHeight||380,d=!!this.data?.person,c={padding:{top:this.data?.device?Math.min(56,l/4):Math.min(60,l/5),bottom:d?Math.min(52,l/4):Math.min(40,l/8),left:48,right:48},maxZoom:this.data?.person?11:12};o?this.glide(this.map.cameraForBounds(i,c)?.zoom??null,()=>this.map.fitBounds(i,{...c,duration:1200})):this.map.fitBounds(i,{...c,duration:0})}glide(e,o){this.targetZoom=e,this.declutter(),this.map.once("moveend",()=>{this.targetZoom=null,this.declutter()}),o()}openPopup(e,o,s){let r=this.data,a=[e.city,e.cc||e.country].filter(Boolean).join(", "),i=[...new Set(e.points.map(b=>b.person))],l=i.length===1?r.people.find(b=>b.id===i[0])?.name:void 0,d=e.points.sort((b,C)=>Number(C.online)-Number(b.online)||C.ts-b.ts).map(b=>{let C=r.people.find(z=>z.id===b.person),w=C?.devices.find(z=>z.id===b.device);return t("button",{type:"button",class:"dl-pop-row",click:()=>this.cb.openDevice(b.person,b.device)},[t("span",{class:`dl-pop-dot${b.online?" on":""}`}),t("span",{class:"dl-pop-name"},[t("b",{},C?.name??b.person),` · ${w?.name??_("device")}`]),t("span",{class:"dl-faint dl-nowrap"},b.online?_("now"):pe(b.ts,r.now))])}),c=t("div",{class:"dl-pop"},[t("div",{class:"dl-pop-head"},[t("span",{class:"dl-pop-net"},v("globe")),t("div",{class:"dl-stack"},[t("strong",{},e.org||_("Unknown network")),t("span",{class:"dl-faint"},[e.asn?`AS${e.asn} · `:"",a?`${a} · ${_("approximate")}`:_("approximate location")])])]),t("div",{class:"dl-pop-list"},d),i.length===1?t("div",{class:"dl-pop-actions"},[t("button",{type:"button",class:"cbi-button cbi-button-positive important",click:()=>this.cb.openPerson(i[0])},l?m(_("Open %s"),l):_("Open person"))]):""]);this.zoomInTo(this.nearby(o),!0),this.dropCard();let p=t("div",{class:"dl-root dl-popcard",role:"dialog"},[t("span",{class:"dl-popcard-tip"}),c]);document.body.appendChild(p);let u=this.el,k=s?.querySelector(".dl-mk-av, .dl-mk-tile")??s??null,M=()=>{if(!k)return;let b=k.getBoundingClientRect(),C=u.getBoundingClientRect(),w=b.left+b.width/2,z=b.top+b.height/2;p.classList.toggle("away",wC.right||zC.bottom);let y=p.offsetWidth,f=p.offsetHeight,x=b.top-f-12>=8||b.top>window.innerHeight-b.bottom,T=Math.min(Math.max(8,w-y/2),window.innerWidth-y-8);p.classList.toggle("above",x),p.classList.toggle("below",!x),p.style.left=`${T}px`,p.style.top=`${x?b.top-f-12:b.bottom+12}px`,p.style.setProperty("--tip-x",`${w-T}px`)},g=b=>{b.target?.closest(".dl-popcard, .maplibregl-marker")||this.closePopup(!0)},h=b=>{b.key==="Escape"&&this.closePopup()},E=b=>{b.target instanceof Element&&b.target.closest(".dl-popcard")||this.closePopup()},H=()=>this.closePopup();this.map.on("move",M),window.addEventListener("scroll",E,{capture:!0,passive:!0}),window.addEventListener("resize",M),document.addEventListener("pointerdown",g,!0),document.addEventListener("keydown",h);let S=Te(H);window.addEventListener("pagehide",H),this.popup={card:p,off:()=>{this.map?.off("move",M),window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",M),document.removeEventListener("pointerdown",g,!0),document.removeEventListener("keydown",h),S(),window.removeEventListener("pagehide",H)}};let $=window.setInterval(()=>{if(this.popup?.card!==p)return clearInterval($);(!u.isConnected||!u.getClientRects().length)&&this.dropCard()},400);M()}};function Bi(n,e=6){let o=n.map(s=>({x:s.x,y:s.y}));for(let s=0;s<16;s++){let r=!1;for(let a=0;a[s.x-n[r].x,s.y-n[r].y])}function Oi(n,e){let o=new Map,s=e?[[e.lon,e.lat]]:[],r=a=>s.some(i=>Mn(a,i)<1.3);for(let a of[...n].sort((i,l)=>i.key>>12)/1048575),d=(i&4095)/4096*2*Math.PI,c=[a.lon,a.lat];for(let p=0;p<24;p++){let u=d+p*2.39996,k=Math.min(8,l+p*.25);if(c=[a.lon+k*Math.sin(u)/(111.32*Math.cos(a.lat*Math.PI/180)),a.lat+k*Math.cos(u)/111.32],!r(c))break}s.push(c),o.set(a.key,c)}return o}function ji(n){let e=2166136261;for(let o=0;o>>0}function sr(n){return{key:n.el.dataset.key??"",who:n.who??_("Someone"),where:n.where??"",online:!!n.g?.online,at:n.at,badge:n.el.querySelector(".dl-mk-badge")?.innerHTML??"",g:n.g}}function rr(n,e,o,s=!1){let r=e.length>3,a=()=>[...n.children].filter(g=>!g.classList.contains("out")),i=new Map(a().map(g=>[g,g.getBoundingClientRect().left])),l=n.getBoundingClientRect().width,d=new Map;n.querySelectorAll(".dl-mk-face:not(.out)").forEach(g=>d.set(g.dataset.key??"",g));let c=n.querySelector(".dl-mk-more:not(.out)"),p=g=>{Object.assign(g.style,{position:"absolute",left:`${g.offsetLeft}px`,top:`${g.offsetTop}px`,transform:""}),g.classList.add("out"),setTimeout(()=>g.remove(),200)},u=[];for(let g of e.slice(0,r?2:3)){let h=d.get(g.key);if(d.delete(g.key),!h){let S=t("button",{type:"button",class:`dl-mk-face${s?"":" in"}`,"data-key":g.key},[t("span",{class:"dl-mk-av"},je(g.who)),t("span",{class:"dl-mk-badge"})]);S.addEventListener("animationend",()=>S.classList.remove("in"),{once:!0}),h=S}let E=h,H=E.querySelector(".dl-mk-badge");H.innerHTML!==g.badge&&(H.innerHTML=g.badge),E.title=`${g.who} · ${g.where}`,E.setAttribute("aria-label",`${g.who}, ${g.where}`),E.classList.toggle("on",g.online),E.onclick=S=>{S.stopPropagation(),o.click(g,E)},E.onmouseenter=()=>o.hover(g),E.onmouseleave=()=>o.hover(null),u.push(E)}for(let g of d.values())p(g);if(r){if(!c){c=t("span",{class:`dl-mk-more${s?"":" in"}`});let g=c;g.addEventListener("animationend",()=>g.classList.remove("in"),{once:!0})}c.textContent=`+${e.length-2}`,u.push(c)}else c&&p(c);let k=null;for(let g of u)(k?k.nextElementSibling:n.firstElementChild)!==g&&(k?k.after(g):n.prepend(g)),k=g;for(let g of u){let h=i.get(g);if(h==null)continue;let E=h-g.getBoundingClientRect().left;Math.abs(E)<.5||(g.style.transition="none",g.style.transform=`translateX(${E}px)`,g.offsetWidth,g.style.transition="",g.style.transform="")}n.style.width="";let M=n.getBoundingClientRect().width;if(l&&Math.abs(M-l)>.5){n.style.width=`${l}px`,n.offsetWidth,n.style.width=`${M}px`;let g=()=>{n.style.width="",n.removeEventListener("transitionend",g)};n.addEventListener("transitionend",g),setTimeout(g,400)}}function Mn(n,e){let o=Math.PI/180,s=Math.sin((e[1]-n[1])*o/2)**2+Math.cos(n[1]*o)*Math.cos(e[1]*o)*Math.sin((e[0]-n[0])*o/2)**2;return 12742*Math.asin(Math.min(1,Math.sqrt(s)))}function Ui(n,e,o){let s=n.querySelector(":scope > .dl-mk-ptr"),r=Math.hypot(e,o);if(r<1){s?.remove();return}s||(s=t("span",{class:"dl-mk-ptr"},[t("i",{class:"line"}),t("i",{class:"spot"})]),n.prepend(s));let a=s.firstElementChild,i=s.lastElementChild;a.style.width=`${r}px`,a.style.transform=`rotate(${Math.atan2(-o,-e)}rad)`,i.style.transform=`translate(${-e}px, ${-o}px)`}function Rt(n,e,o=!0){let s=[["online",_("Online now")],["24h",_("24h")],["7d",_("7 days")],["30d",_("30 days")]],r=t("div",{class:"dl-seg",role:"tablist"});for(let[a,i]of s)a==="online"&&!o||r.appendChild(t("button",{type:"button",role:"tab",class:a===n?"on":"","data-v":a,click:()=>{r.querySelectorAll("button").forEach(l=>l.classList.toggle("on",l.dataset.v===a)),e(a)}},i));return r}var ar={"24h":86400,"7d":7*86400,"30d":30*86400},_o=(n,e)=>`${(n/e*100).toFixed(3)}%`,En=class{constructor(e,o,s){this.map=e;this.range=o;this.el=t("div",{class:"dl-dplaces"});this.controls=t("div",{class:"dl-map-replay"});this.pending=null;this.rows=new Map;this.st=[];this.steps=[];this.total=0;this.ms=0;this.stepI=-1;this.on=!1;this.playing=!1;this.raf=0;this.last=0;this.endTimer=0;this.play=t("button",{type:"button",class:"dl-map-btn"});this.chip=t("span",{class:"dl-map-chip"});this.stop=t("button",{type:"button",class:"dl-map-btn",title:_("Back to now"),"aria-label":_("Back to now")},v("x"));this.reduced=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;this.data=s,this.play.addEventListener("click",()=>this.toggle()),this.stop.addEventListener("click",()=>this.end()),this.paint()}mapData(){let e=this.data;return{geo:e.geo,people:[e.person],now:e.now,person:e.person.id,device:e.device.id}}update(e){let o={...this.pending??this.data,...e};if(this.on){this.pending=o;return}this.data=o,this.map.update(this.mapData()),this.paint()}setRange(e){this.end(),this.range=e,this.map.setRange(e),this.paint()}destroy(){cancelAnimationFrame(this.raf),clearTimeout(this.endTimer)}paint(){let e=this.data,o=ar[this.range],s=e.now-o,r=Os(Bs(e.events??[],e.device.id,e.now,e.device.online,e.device.handshake),e.geo.points,e.device.id,s),a=js(r);this.st=Us(r);let i=ko(this.mapData(),this.range),l=r.length>0;this.el.classList.toggle("strips",l),this.el.classList.toggle("can-replay",this.st.length>1),this.rows.clear(),dom.content(this.el,i.length?[...i.map(d=>{let c=et(d),p=a.get(c),u=l?t("div",{class:`dl-dplace-strip${d.online?" live":""}`},r.filter(M=>M.key===c).map(M=>t("i",{style:`left:${_o(M.from-s,o)};width:${_o(M.to-M.from,o)}`}))):"",k=t("div",{class:"dl-dplace-row"},[t("span",{class:`dl-dplace-n${d.online?" live":""}`},d.online?v(e.device.kind):String(d.n)),t("span",{class:"dl-row-main dl-stack"},[t("span",{},[d.city||d.cc||_("Unknown city"),d.org?t("span",{class:"dl-muted"},` · ${d.org}`):""]),t("span",{class:"dl-faint"},[t("span",{class:"dl-mono"},d.ip),p!=null?` · ${m(_("%s%% of the time"),p>0&&p<.005?"<1":Math.round(p*100))}`:""])]),t("span",{class:d.online?"dl-dplace-now":"dl-faint dl-nowrap"},d.online?_("now"):pe(d.ts,e.now)),u]);if(k.addEventListener("mouseenter",()=>this.map.hoverPlace(c)),k.addEventListener("mouseleave",()=>this.map.hoverPlace(null)),u){let M=g=>{let h=u.getBoundingClientRect();this.seek(s+o*Math.min(1,Math.max(0,(g.clientX-h.left)/h.width)))};u.addEventListener("pointerdown",g=>{u.setPointerCapture(g.pointerId),M(g)}),u.addEventListener("pointermove",g=>g.buttons&&M(g))}return this.rows.set(c,k),k}),l?t("div",{class:"dl-dplace-axis"},Js(this.range,e.now).map(([d,c])=>t("span",{style:`left:${(d*100).toFixed(2)}%`},c))):""]:t("div",{class:"dl-sub"},_("No locations in this period."))),this.paintControls()}paintControls(){dom.content(this.play,v(this.playing?"pause":"play")),this.play.title=this.playing?_("Pause","replay"):_("Replay this period"),this.play.setAttribute("aria-label",this.play.title),dom.content(this.controls,this.on?[this.play,this.chip,this.stop]:this.st.length>1?[this.play]:[])}begin(){this.on=!0,{steps:this.steps,total:this.total}=Gs(this.st,this.reduced?400:bo),this.ms=0,this.stepI=-1,this.map.replay({active:null,when:""},!0)}toggle(){if(this.playing){this.playing=!1,cancelAnimationFrame(this.raf),this.paintControls();return}clearTimeout(this.endTimer),(!this.on||this.ms>=this.total)&&this.begin(),this.playing=!0,this.last=performance.now(),this.paintControls(),this.raf=requestAnimationFrame(e=>this.frame(e))}frame(e){if(this.playing){if(this.ms=Math.min(this.total,this.ms+(e-this.last)),this.last=e,this.show(!0),this.msthis.frame(o));return}this.playing=!1,this.paintControls(),this.endTimer=window.setTimeout(()=>this.end(),1500)}}seek(e){this.st.length<2||(clearTimeout(this.endTimer),this.on||this.begin(),this.ms=Fs(this.st,this.steps,e),this.stepI=-1,this.show(!1),this.paintControls())}show(e){let o=qs(this.st,this.steps,this.ms),s=this.st[o.step.k];if(o.step.kind==="move"){let i=this.st[o.step.k-1];o.i!==this.stepI&&(this.map.replay({active:null,when:""},e),this.map.band([i.point.lon,i.point.lat],[s.point.lon,s.point.lat]));let l=Ks(o.q);this.reduced||this.map.bandAt(l),(this.reduced?o.q>=.5:Ys(l))&&this.map.replay({active:s.key,when:Cn(o.t)},e)}else o.i!==this.stepI&&this.map.band(),this.map.replay({active:s.key,when:Cn(o.t)},e);this.stepI=o.i;let r=this.data,a=r.now-ar[this.range];this.el.classList.add("replay"),this.el.style.setProperty("--at",_o(o.t-a,r.now-a));for(let[i,l]of this.rows)l.classList.toggle("cur",i===s.key);this.chip.textContent=`${Zs(o.t,r.now)}, ${Cn(o.t)} · ${s.point.city||s.point.cc||"?"}`}end(){if(cancelAnimationFrame(this.raf),clearTimeout(this.endTimer),!!this.on){this.on=!1,this.playing=!1,this.ms=0,this.stepI=-1,this.map.band(),this.map.replay(null,!1),this.el.classList.remove("replay");for(let e of this.rows.values())e.classList.remove("cur");this.pending?(this.data=this.pending,this.pending=null,this.map.update(this.mapData()),this.paint()):this.paintControls()}}};function It(n){return`${L.url("admin/network/dawnline/server")}?${n?`server=${encodeURIComponent(n)}&`:""}section=people`}function Re(n,e){return`${L.url("admin/network/dawnline/person")}?id=${encodeURIComponent(n)}${e?`&device=${encodeURIComponent(e)}`:""}`}function Wi(n){return n?new Date(n*1e3).toLocaleString(ie(),{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function Co(n,e,o=!1){return t("div",{class:"dl-kvrow"},[t("span",{class:"dl-kvrow-k"},n),t("button",{type:"button",class:`dl-kvrow-v copy${o?" dl-mono":""}`,title:_("Copy"),click:()=>xe(e,m(_("%s copied"),n))},[t("span",{},e),v("copy")])])}function Tn(n,e){return t("div",{class:"dl-kvrow"},[t("span",{class:"dl-kvrow-k"},n),t("span",{class:"dl-kvrow-v"},e)])}var ir={connect:["ok","plug"],disconnect:["","plug"],roam:["","network"],device_added:["ok","plus"],device_removed:["","trash"],device_keys:["","reset"]};function Gi(n){let e=s=>t("span",{class:"dl-muted"},s),o=Ve(n)==="portal"?_("on the portal"):Ve(n)==="admin"?_("by you"):"";switch(n.type){case"connect":return[...n.detail?ae(_("Connected from %s"),e(n.detail)):[_("Connected")],n.where?e(` · ${n.where}`):""];case"disconnect":return[_("Went offline")];case"roam":return[_("Changed network"),e(` · ${n.detail??""}`)];case"device_added":return o?ae(_("Added %s"),e(o)):[_("Added")];case"device_removed":return o?ae(_("Removed %s"),e(o)):[_("Removed")];default:return o?ae(_("New keys %s"),e(o)):[_("New keys")]}}function qi(n,e,o){let s=n.filter(r=>r.device===e&&ir[r.type]).reverse().slice(0,12);return s.length?t("div",{class:"dl-dev-log"},s.map(r=>{let[a,i]=ir[r.type],l=new Date(r.ts*1e3);return t("div",{class:`dl-dev-log-row${Ve(r)==="admin"?" dl-ev-by-admin":""}`},[Ve(r)==="admin"?t("span",{class:"dl-ev-tile",title:_("Done by you in LuCI")},v("admin")):t("span",{class:`dl-ev-tile ev ${a}`},v(i)),t("span",{class:"dl-row-main"},Gi(r)),t("span",{class:"dl-faint dl-nowrap",title:l.toLocaleString(ie())},pe(r.ts,o))])})):t("div",{class:"dl-sub"},_("No activity yet."))}async function lr(n,e,o){let s=await N.status(1).catch(()=>null),r=s?.people.find(i=>i.id===n),a=r?.devices.find(i=>i.id===e);s&&r&&a&&Je(r,a,{...o,geo:s.geo,now:s.now,today:Ge(s.series),core:zt(s.servers,r.server)})}async function Je(n,e,o){let s=await F(()=>N.deviceConfig(e.id));if(!s)return;let r=o.core??qe(null),a=e,i=n,l=o.geo,d=o.now,c=o.today??Ke(new Date),p=await r.connectBlock(s,e.kind==="phone"||e.kind==="tablet"?"qr":"file"),u=t("div",{class:"dl-drawer-title"}),k=t("div",{}),M=t("div",{}),g=t("div",{},t("div",{class:"dl-sub"},_("Loading…"))),h=[],E=se=>{h=se.filter(j=>j.device===a.id),dom.content(g,qi(se,a.id,d)),b?.update({events:se})},H=async(se=!1)=>{let j=o.events?.();if(j&&!se)return E(j);let V=await N.events(2e3,n.id).catch(()=>null);V&&E(V.events)},S="30d",$=null,b=null,C=()=>{dom.content(u,[t("span",{class:`dl-dcard-ic${a.online?" on":""}`},v(a.kind)),t("div",{class:"dl-stack"},[t("div",{class:"dl-title-row"},[t("h3",{},a.name),A([v("edit")],()=>y(),"neutral",{title:_("Rename"),class:"cbi-button cbi-button-neutral dl-icon-only sm"})]),t("span",{class:"dl-sub"},`${i.name} · ${at(a.kind)}`)])]);let se=a.spark.reduce((j,V)=>j+V,0);dom.content(k,t("div",{class:"dl-dstats"},[t("div",{class:"dl-dstats-cell wide"},[t("span",{class:"dl-metric-label"},_("Status")),dn(a,d,_("Waiting for the first connection"),i)]),t("div",{class:"dl-dstats-cell"},[t("span",{class:"dl-metric-label"},_("This month")),t("b",{},oe(a.month[0]+a.month[1])),t("span",{class:"dl-sub dl-mono"},`↓ ${oe(a.month[1])} ↑ ${oe(a.month[0])}`)]),t("div",{class:"dl-dstats-cell"},[t("span",{class:"dl-metric-label"},_("Last 7 days")),t("b",{},oe(se)),Es(a.spark,120,22,c)])])),dom.content(M,t("div",{class:"dl-kv2"},[Co(_("Tunnel address"),a.address),a.hostname&&i.access!=="internet"?Co(_("Local address"),a.hostname):"",a.endpoint&&!l?.points.some(j=>j.device===a.id&&j.ip===a.endpoint)?Tn(_("Client IP"),a.endpoint):"",Tn(_("Total"),t("span",{class:"dl-kv-act"},[`↓ ${oe(a.total[1])} · ↑ ${oe(a.total[0])}`,t("button",{type:"button",class:"dl-linkbtn danger",click:()=>Ht("device",a.id,a.name,()=>setTimeout(z,300))},_("Reset"))])),Tn(_("Added"),`${Wi(a.created)} · ${a.created_by==="portal"?_("from the portal"):_("by you")}`),s.amnezia.client_pub_key?Co(_("Public key"),s.amnezia.client_pub_key):Tn(_("Public key"),"—")])),dom.content(f,[A([v(a.disabled?"play":"pause")," ",a.disabled?_("Enable"):_("Disable")],async()=>{await F(()=>N.deviceUpdate(a.id,void 0,!a.disabled),a.disabled?_("Device enabled"):_("Device disabled"))&&await z()},"neutral",a.disabled?{}:{class:"cbi-button cbi-button-neutral dl-btn-warn"}),A([v("key")," ",_("New keys")],async()=>{if(!await me(_("Generate new keys?"),_("The current configuration on this device stops working until it is imported again."),_("Generate"),!0))return;await F(()=>N.deviceRotate(a.id),_("New keys generated"))&&(o.refresh(),fe.close(),await lr(i.id,a.id,o))}),t("span",{class:"dl-spacer"}),A([v("trash")," ",_("Remove")],async()=>{await me(m(_("Remove %s?"),a.name),_("The device is disconnected immediately and its configuration stops working."),_("Remove"),!0)&&await F(()=>N.deviceDelete(a.id),_("Device removed"))&&(fe.close(),o.refresh())},"negative")])},w=async()=>{let se=await N.status(1).catch(()=>null),j=se?.people.find(le=>le.id===i.id),V=j?.devices.find(le=>le.id===a.id);!se||!j||!V||(i=j,a=V,l=se.geo,d=se.now,c=Ge(se.series),C(),b?.update({geo:se.geo,now:se.now,person:i,device:a}))},z=async()=>{await w(),o.refresh()},y=()=>{let se=t("input",{type:"text",class:"cbi-input-text",value:a.name,maxlength:48}),j=i.devices.filter(le=>le.id!==a.id).map(le=>le.name),V=Ee(_("Name"),se,()=>He(se.value,j,_("Shown in the portal and in the app.")));de(m(_("Rename %s"),a.name),[V],[ue()," ",A(_("Save"),async()=>{let le=V.help();if(le.bad){q(le.text,"warning");return}await F(()=>N.deviceUpdate(a.id,se.value,void 0),_("Renamed"))&&(ce(),await z())},"positive")]),setTimeout(()=>se.select(),50)},f=t("div",{class:"dl-drawer-actions"}),x=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},_("Connect","section"))]),a.config_stale?t("div",{class:"dl-note warn"},[v("alert"),t("span",{},_("This device has an older configuration: networks or DNS changed since it was set up. Import it again with the QR code, key or file below."))]):"",p]),T=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},_("Activity")),t("div",{class:"dl-dsec-actions"},[t("button",{type:"button",class:"dl-linkbtn",click:()=>Qe({people:[i]},h,"csv",a.id)},_("Export")),t("button",{type:"button",class:"dl-linkbtn danger",click:()=>lt(m(_("Clear %s's activity"),a.name),m(_("Removes events about %s."),a.name),{device:a.id},()=>{H(!0),o.refresh()})},_("Clear")),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},_("All activity"))])]),g]),I=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},t("h4",{},_("Details","section"))),M]),Y="";if(l?.enabled){$=new dt({openPerson:j=>location.href=Re(j),openDevice:(j,V)=>location.href=Re(j,V)},S,220);let se=b=new En($,S,{geo:l,now:d??Date.now()/1e3,person:i,device:a,events:o.events?.()??null});Y=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},_("Locations")),Rt(S,j=>{S=j,se.setRange(j)},!1)]),t("div",{class:"dl-dmap"},[$.el,se.controls]),se.el])}let J=!a.handshake||a.config_stale,te=t("div",{class:"dl-stack gap16"},J?[k,x,I,Y,T]:[k,I,Y,T,x]);H();let B=()=>{w(),H()},Q=_n(B),ne=window.setInterval(B,3e4),fe=Xo(u,te,f,()=>{clearInterval(ne),Q(),b?.destroy(),$?.destroy()});C(),$&&b&&requestAnimationFrame(()=>b&&$?.mount(b.mapData()))}function dr(n,e,o,s){let r=s.core??qe(null),a=()=>F(()=>N.deviceConfig(o.id)),i=[{label:_("Show QR code"),icon:v("qr"),run:async()=>{let l=await a();l&&de(`${o.name} · ${_("QR code")}`,t("div",{class:"dl-qr-pane"},[un(r.qrText(l)),t("span",{class:"dl-sub"},ho(l)?_("Scan with AmneziaVPN or any WireGuard app on the device."):_("Scan with AmneziaVPN or AmneziaWG on the device."))]),ue(_("Close")))}},{label:r.file.label,icon:v("download"),run:async()=>{let l=await a();if(!l)return;let d=r.file.make(l);Ne(d.name,d.text,"application/octet-stream")}},r.appKey?{label:r.appKey.label,icon:v("copy"),run:async()=>{let l=await a();l&&xe(await r.appKey.make(l),_("Key copied"))}}:null,null,{label:_("Rename"),icon:v("edit"),run:()=>Je(e,o,s)},{label:_("New keys"),icon:v("key"),run:async()=>{await me(_("Generate new keys?"),_("The current configuration on this device stops working until it is imported again."),_("Generate"),!0)&&await F(()=>N.deviceRotate(o.id),_("New keys generated"))&&s.refresh()}},{label:o.disabled?_("Enable"):_("Disable"),icon:v(o.disabled?"play":"pause"),warn:!o.disabled,run:async()=>{await F(()=>N.deviceUpdate(o.id,void 0,!o.disabled),o.disabled?_("Device enabled"):_("Device disabled"))&&s.refresh()}},{label:_("Delete"),icon:v("trash"),danger:!0,run:async()=>{await me(m(_("Remove %s?"),o.name),_("The device is disconnected immediately and its configuration stops working."),_("Remove"),!0)&&await F(()=>N.deviceDelete(o.id),_("Device removed"))&&s.refresh()}}];Se(n,i)}function ct(n,e){let o=n.devices.map(c=>c.name),s=c=>{let p=at(c),u=1,k=p;for(;o.some(M=>M.toLowerCase()===k.toLowerCase());)k=`${p} ${++u}`;return k},r="phone",a=t("input",{type:"text",class:"cbi-input-text",placeholder:s(r),maxlength:48}),i=Ee(_("Name"),a,()=>a.value.trim()?He(a.value,o,_("Shown in the portal and in the app.")):{text:m(_("Named after its type: %s."),s(r)),bad:!1}),l=t("div",{class:"dl-kinds",role:"radiogroup","aria-label":_("Type")},Vo.map(c=>t("button",{type:"button",role:"radio",class:c===r?"on":"","aria-checked":c===r?"true":"false","data-kind":c,click:()=>{r=c,l.querySelectorAll("button").forEach(p=>{let u=p.dataset.kind===c;p.classList.toggle("on",u),p.setAttribute("aria-checked",u?"true":"false")}),a.placeholder=s(c),i.refresh()}},[v(c),t("span",{},at(c))]))),d=n.devices.length>=n.device_limit;de(m(_("Add a device for %s"),n.name),[d?t("p",{class:"dl-hint"},m(N_(n.device_limit,"%s already has %s of %s device. As admin you can still add one.","%s already has %s of %s devices. As admin you can still add one."),n.name,K(n.devices.length),K(n.device_limit))):"",t("div",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},_("Type")),l]),i],[ue()," ",A(_("Add device"),async()=>{let c=i.help();if(c.bad){q(c.text,"warning");return}let p=a.value.trim()||s(r),u=await F(()=>N.deviceCreate(n.id,p,r));u&&(ce(),q(m(_("%s added"),p),"success",3e3),e.refresh(),await lr(n.id,u.id,e))},"positive")]),setTimeout(()=>a.focus(),50)}var tt=1080,Qt=1512,Ze=96,Fi="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",Ki="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",Zt=n=>n.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e]);function Yi(n,e,o){let s=new URL(o),r=s.pathname.slice(1),a=m(_("Hi, %s"),n.name),i=Math.min(92,Math.floor((tt-2*Ze)/(.58*a.length))),l=tt-2*Ze,d=392,c=40,p=pn(o,2).replace("`${E}`;return``+u(Ze+82,Ze+42,36,"#a3a3a3",Zt(e))+u(Ze,276,i,"#ffffff",Zt(a),'font-weight="600"')+u(Ze,340,40,"#8a8a8a",Zt(m(_("Scan to connect to %s"),e)))+``+p+`${Zt(r)}`+u(tt/2,d+l+156,34,"#737373",Zt(s.host),'text-anchor="middle"')+""}async function Vi(n){let e=new Image;e.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`,await e.decode();let o=document.createElement("canvas");return o.width=tt,o.height=Qt,o.getContext("2d").drawImage(e,0,0,tt,Qt),new Promise((s,r)=>o.toBlob(a=>a?s(a):r(new Error(_("Could not draw the card"))),"image/png"))}async function cr(n){let e=await F(()=>N.personLinks(n));return e?e.link?{link:e.link,links:e.links??[]}:(q(_("The personal portal is off. Turn it on in Settings."),"warning"),null):null}async function Sn(n){let e=await cr(n);e&&await xe(e.link,_("Personal link copied"))}async function Xt(n,e,o={}){let s=n.link,r=n.links;if(s===void 0){let h=await cr(n.id);if(!h)return;s=h.link,r=h.links}if(!s){q(_("The personal portal is off. Turn it on in Settings."),"warning");return}let a=s,i=await F(()=>Vi(Yi(n,e,a)));if(!i)return;let l=new File([i],`${n.id}-invite.png`,{type:"image/png"}),d=URL.createObjectURL(i),c=navigator,p=!!c.canShare?.({files:[l]}),u=!p&&typeof c.share=="function"&&(c.canShare?.({url:a})??!0),k=()=>{URL.revokeObjectURL(d),ce()},M=async h=>{try{await c.share(h)}catch{}},g=p?A([v("link")," ",_("Share card")],()=>M({files:[l],title:m(_("Invite %s"),n.name)}),"positive"):u?A([v("link")," ",_("Share link")],()=>M({url:a,title:m(_("Invite %s"),n.name),text:_("Your personal VPN link")}),"positive"):A([v("download")," ",_("Download card")],()=>Ne(l.name,i),"positive");de(o.title??m(_("Invite %s"),n.name),t("div",{class:"dl-invite"},[t("img",{src:d,alt:m(_("Invite card for %s"),n.name)}),t("div",{class:"dl-invite-side"},[t("p",{class:"dl-muted"},o.lead??m(_("Send %s the card or the link. They open it, add their devices and connect - no account needed."),n.name)),t("button",{type:"button",class:"dl-invite-link",title:_("Copy link"),click:()=>xe(a,_("Personal link copied"))},[t("span",{},a.replace(/^https:\/\//,"")),v("copy")]),...(r??[]).filter(h=>h!==a).map(h=>t("button",{type:"button",class:"dl-invite-link alt",title:_("Copy this link"),click:()=>xe(h,_("Link copied"))},[t("span",{},h.replace(/^https?:\/\//,"")),t("span",{class:`dl-pill ${h.startsWith("http:")?"warn":""}`},h.startsWith("http:")?"HTTP":_("Also")),v("copy")])),t("ol",{class:"dl-invite-steps"},[t("li",{},ae(_("Install %s on the device"),t("b",{},"AmneziaVPN"))),t("li",{},_("Open the link or scan the code")),t("li",{},_("Add the device and connect"))]),t("div",{class:"dl-invite-actions"},[g,A([v("copy")," ",_("Copy link")],()=>xe(a,_("Personal link copied")))])])]),[t("button",{class:"cbi-button cbi-button-neutral",click:k},_("Done"))],"wide")}function en(n,e){let o=n.servers.find(d=>d.id===e)??n.servers[0],s=n.people.filter(d=>d.server===o.id),r=new Set(s.map(d=>d.id)),a=s.flatMap(d=>d.devices),i=d=>s.reduce((c,p)=>{let u=d(p);return[c[0]+u[0],c[1]+u[1]]},[0,0]),l=o.series?.[o.series.length-1];return{...n,servers:[o],people:s,series:o.series??n.series,events:n.events.filter(d=>d.person?r.has(d.person):!0),geo:{...n.geo,points:n.geo.points.filter(d=>r.has(d.person))},totals:{people:s.length,devices:a.length,online:a.filter(d=>d.online).length,active:s.filter(d=>d.state==="active").length,today:l?[l.rx,l.tx]:[0,0],month:i(d=>d.month)}}}var pr=3,Lo=class{constructor(){this.n=0;this.shown=0}next(){return++this.n}take(e){return e{let k=e.next(),M=null;try{M=await n.fetch(u),o>=pr&&q(_("The router answers again."),"success",3e3),o=0}catch{return++o===pr&&q(_("The router is not answering: what you see may be out of date."),"warning",8e3),null}return M==null||!e.take(k)?null:(n.apply(M,p),M)},r=(p=!1)=>s(p,!1),a=()=>document.visibilityState==="visible",i=()=>a()&&(n.active?.()??!0)?s(!0,!1):Promise.resolve(null);poll.add(i,n.every);let l=n.live?_n(()=>void(a()&&(n.active?.()??!0)&&s(!0,!0))):null,d=()=>{poll.remove(i),l?.(),c()},c=Te(d);return{refresh:r,claim:()=>e.claim(),stop:d}}function Bt(n){let e=document.activeElement;return!!n&&!!e&&e!==document.body&&n.contains(e)}function Ae(n,e,o=!1){return o&&Bt(n)?!1:(dom.content(n,e),!0)}function ur(n,e){let o=n,s=[{v:"internet",ic:"globe",text:_("Browse the internet through your router. No access to devices at home.")},{v:"lan",ic:"home",text:_("Reach devices at home (NAS, printer, cameras). Internet stays on their own connection.")},{v:"both",ic:"shield",text:_("Home devices and the internet, all through your router.")}],r=t("div",{class:"dl-choices"},s.map(a=>t("button",{type:"button",class:`dl-choice${a.v===o?" selected":""}`,"data-v":a.v,click:()=>{o=a.v,r.querySelectorAll(".dl-choice").forEach(i=>i.classList.toggle("selected",i.dataset.v===a.v)),e?.(a.v)}},[t("span",{class:"dl-choice-title"},[v(a.ic),vt(a.v)]),t("span",{class:"dl-choice-text"},a.text)])));return{el:r,get:()=>o}}function Mo(n){try{return localStorage.getItem(n)}catch{return null}}function Eo(n,e){try{localStorage.setItem(n,e)}catch{}}function Ji(n){let e=n.devices.length,o=Math.max(1,n.device_limit,e),s=Math.min(160,o*22+(o-1)*3);return t("div",{class:"dl-slotbar",title:m(N_(n.device_limit,"%s of %s device","%s of %s devices"),e,n.device_limit)},[t("span",{class:"dl-slotbar-segs",style:`width: ${s}px`},Array.from({length:o},(r,a)=>t("i",{class:a>=n.device_limit?"over":an.state==="server_off"?n.paused:!["active","quota","expired"].includes(n.state),To=n=>n.state==="server_off"?n.paused:n.state!=="active",hr=n=>To(n)?n.state==="server_off"?"paused":n.state:null;function Zi(n,e){let o=st(n.expires,e);return n.state==="quota"||n.state==="expired"||rt(n,o)||!!n.quota_limit&&n.quota_used>=n.quota_limit*.9}function fr(n,e){return Lt(n&&no(n,e)>=0?n:e,1)}var gr=n=>n.people.map(e=>e.id).sort().join(" "),vr=!1,wt=class{constructor(){this.list=t("div",{class:"dl-plist",role:"list"});this.filter=["all","online","attention","paused"].find(e=>e===(new URLSearchParams(location.search).get("filter")??Mo("dl.people.filter")))??"all";this.sort=["seen","name","usage"].find(e=>e===Mo("dl.people.sort"))??"seen";this.query="";this.noFooter=!0;this.serverId=null;this.el=null}async load(){return N.status(30)}scope(e){return this.serverId?en(e,this.serverId):e}embed(e,o){return this.serverId=o,this.render(e)}person(e){return this.st.people.find(o=>o.id===e)}get today(){return Ge(this.st.series)}deviceOpts(e){return{refresh:()=>this.refresh(),geo:this.st.geo,now:this.st.now,today:this.today,core:zt(this.st.servers,e.server)}}take(e,o){let s=this.scope(e),r=gr(s)!==gr(this.st);this.st=s,r?this.rebuild():(this.paintCards(o),this.decorate(o))}async update(){await this.poller?.refresh()}async refresh(){this.poller?.claim();let e=await N.status(30).catch(()=>null);e&&(this.st=this.scope(e),this.rebuild())}rebuild(){let e=new Map;for(let s of Array.from(this.list.children))s.dataset.sid&&e.set(s.dataset.sid,s);let o=this.st.people.map(s=>{let r=e.get(s.id)??t("div",{class:"dl-card",role:"listitem","data-sid":s.id});return this.renderCard(r,s.id)});dom.content(this.list,o.length?o:t("div",{class:"dl-plist-none"},this.st.servers.length?_("No people yet. Add someone and send them their personal link."):_("Set up the server first, then add people."))),this.decorate()}paintCards(e=!1){for(let o of this.st.people){let s=this.card(o.id);s&&!(e&&Bt(s))&&this.renderCard(s,o.id)}}card(e){return this.list.querySelector(`[data-sid="${CSS.escape(e)}"]`)}render(e){let o=this.scope(e);this.st=o;let s=this,r=t("select",{class:"dl-select","aria-label":_("Sort"),change:d=>{s.sort=d.target.value,Eo("dl.people.sort",s.sort),s.decorate()}},[t("option",{value:"seen",selected:s.sort==="seen"?"selected":null},_("Last seen","sort")),t("option",{value:"name",selected:s.sort==="name"?"selected":null},_("Name","sort")),t("option",{value:"usage",selected:s.sort==="usage"?"selected":null},_("Usage","sort"))]),a=t("input",{type:"search",class:"cbi-input-text dl-people-find",placeholder:_("Find…"),"aria-label":_("Find a person or device"),hidden:o.people.length>8?null:"hidden",input:d=>{s.query=d.target.value.trim().toLowerCase(),s.decorate()}}),i=d=>{let c=d.target;d.key==="/"&&!a.hidden&&!["INPUT","TEXTAREA","SELECT"].includes(c?.tagName)&&!c?.isContentEditable&&(d.preventDefault(),a.focus())};document.addEventListener("keydown",i),Te(()=>document.removeEventListener("keydown",i));let l=t("div",{class:"dl-root"},[s.serverId?"":t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},_("People")),t("span",{class:"dl-muted dl-people-count"},this.countText())]),o.servers.length?A([v("plus"),` ${_("Add person")}`],()=>s.openCreate(),"add"):""]),o.servers.length?"":t("div",{class:"alert-message warning"},ae(_("No server yet. %s before adding people."),t("a",{href:L.url("admin/network/dawnline/server")},_("Run the setup wizard")))),t("div",{class:"dl-toolbar"},[t("div",{class:"dl-seg dl-people-tabs",role:"tablist"}),t("div",{class:"dl-toolbar-end"},[a,r,s.serverId?A([v("plus"),` ${_("Add person")}`],()=>s.openCreate(),"add"):""])]),this.list]);return this.el=l,this.rebuild(),this.poller??(this.poller=pt({fetch:()=>N.status(30),every:30,live:!0,active:()=>!!s.el?.isConnected,apply:(d,c)=>s.take(d,c)})),!vr&&new URLSearchParams(location.search).get("add")&&(vr=!0,setTimeout(()=>s.openCreate(),100)),Promise.resolve(l)}countText(){let e=this.st.totals;return[W(e.people,"%s person","%s people"),W(e.devices,"%s device","%s devices"),m(_("%s online"),K(e.online))].join(" · ")}decorate(e=!1){let o=this.el?.querySelector(".dl-people-count");o&&(o.textContent=this.countText());let s=this.st.people,r=this.today,a=h=>Zi(h,r),i={all:s.length,online:s.filter(h=>h.online>0).length,attention:s.filter(a).length,paused:s.filter(h=>mr(h)).length},l=this.el?.querySelector(".dl-people-tabs");if(l&&!(e&&Bt(l))){let h={all:_("All"),online:_("Online"),attention:_("Needs attention"),paused:_("Paused")};dom.content(l,Object.keys(h).map(E=>t("button",{type:"button",role:"tab",class:E===this.filter?"on":"",click:()=>{this.filter=E,Eo("dl.people.filter",E),this.decorate()}},[h[E],t("b",{class:E==="attention"&&i[E]?"warn":""},String(i[E]))])))}let d=this.query,c=h=>[h.name,h.note??"",...h.devices.flatMap(E=>[E.name,E.address,E.hostname,E.endpoint])].join(" ").toLowerCase(),p=h=>!(this.filter==="online"&&!h.online||this.filter==="attention"&&!a(h)||this.filter==="paused"&&!mr(h)||d&&!c(h).includes(d)),u=h=>hr(h)==="paused"?2:To(h)?1:0,k=[...s].sort((h,E)=>u(h)-u(E)||(this.sort==="name"?h.name.localeCompare(E.name):this.sort==="usage"?E.month[0]+E.month[1]-(h.month[0]+h.month[1]):E.online-h.online||E.last_seen-h.last_seen)),M=0;for(let h of k){let E=this.card(h.id);if(!E)continue;this.list.appendChild(E),E.classList.toggle("dl-off",To(h));let H=p(h);E.classList.toggle("dl-filtered",!H),H&&M++}let g=this.el?.querySelector(".dl-people-none")??null;s.length&&!M?(g??(g=t("div",{class:"dl-empty dl-people-none"},t("p",{},_("No one here right now.")))),g.previousElementSibling!==this.list&&this.list.after(g)):g?.remove()}async quick(e,o,s){await F(()=>N.personUpdate(e.id,o),s)&&await this.update()}renderCard(e,o){let s=this.person(o);if(!s)return dom.content(e,t("em",{},_("This person was just removed."))),e;let r=this.today,a=st(s.expires,r),i=Math.max(0,s.device_limit-s.devices.length),l=s.has_link??this.st.settings.portal_enabled,d=[],c=hr(s);if(s.expires&&c!=="expired"){let g=rt(s,a),h=a!=null&&a<0;d.push(t("span",{class:`dl-pill-ic${h?" bad":g?" warn":""}`,title:m(_("Access ends %s"),De(s.expires))},[v("calendar"),h?m(_("ended %s"),De(s.expires)):g?an(a):m(_("until %s"),De(s.expires))]))}s.hours&&c!=="hours"&&d.push(t("span",{class:"dl-pill-ic",title:_("Allowed hours")},[v("clock"),s.hours.replace("-","–")]));let p=ln(s.devices).map(g=>t("button",{type:"button",class:`dl-chip${g.disabled?" disabled":""}${g.online?" live":""}`,title:[at(g.kind),g.address,g.online?m(_("online from %s"),g.endpoint):g.handshake?m(_("seen %s"),pe(g.handshake,this.st.now)):""].filter(Boolean).join(" · "),click:h=>{h.preventDefault(),Je(s,g,this.deviceOpts(s))}},[v(g.kind),t("span",{class:"dl-chip-name"},g.name),!g.handshake&&!g.disabled?t("span",{class:"dl-chip-tag"},_("not set up")):""]));p.push(t("button",{type:"button",class:"dl-chip add",title:i>0?_("Add device"):_("Over the limit: admins can still add"),click:g=>{g.preventDefault(),ct(s,this.deviceOpts(s))}},[v("plus"),_("Add device")]));let u=[];s.expires&&rt(s,a)&&c!=="expired"&&u.push(t("button",{type:"button",class:"dl-fix",click:()=>this.quick(s,{expires:fr(s.expires,r)},_("Extended by 1 month"))},_("Extend 1 month")));let k=$e("more",_("More"),g=>Se(g.currentTarget,[{label:_("Open"),icon:v("open"),run:()=>{location.href=Re(s.id)}},l?{label:_("Invite card"),icon:v("qr"),run:()=>Xt(s,this.st.servers.find(h=>h.id===s.server)?.name??_("Home"))}:null,i>0?{label:_("Add device"),icon:v("plus"),run:()=>ct(s,this.deviceOpts(s))}:null,null,{label:s.paused?_("Resume"):_("Pause"),icon:v(s.paused?"play":"pause"),warn:!s.paused,run:()=>this.togglePause(s)},{label:_("Delete"),icon:v("trash"),danger:!0,run:()=>this.remove(s.id)}].filter((h,E,H)=>h||E>0&&H[E-1])),"neutral","dl-icon-only"),M=t("div",{class:"dl-pcard-actions"},[l?$e("link",_("Copy link"),()=>Sn(s.id),"neutral","dl-icon-only"):"",k]);return dom.content(e,t("div",{class:"dl-pcard"},[t("div",{class:"dl-pcard-main"},[t("div",{class:"dl-pcard-top"},[t("span",{class:`dl-avatar${s.online?" online":""}`},je(s.name)),t("div",{class:"dl-pcard-who"},[t("div",{class:"dl-card-head"},[t("a",{class:"dl-card-name",href:Re(s.id)},s.name),Qo(s),...d]),Ji(s)])]),t("div",{class:"dl-chips"},p),u.length?t("div",{class:"dl-fixes"},u):""]),this.usageSide(s,M),c?this.stopStrip(s,c):""])),e}stopStrip(e,o){let s=this.today,r=Lt(`${s.slice(0,8)}01`,1),a=()=>this.quick(e,{bonus_gb:String((e.bonus_gb||0)+10)},_("+10 GB this month")),i={paused:["pause","warn",_("Paused"),_("Devices can’t connect until you resume"),["play",_("Resume"),()=>this.togglePause(e)]],quota:e.quota_period==="month"?["chart","bad",_("Data limit reached"),m(_("Paused until it resets on %s"),De(r)),["plus",_("+10 GB this month"),a]]:["chart","bad",_("Data limit reached"),_("Paused until the limit is raised"),["edit",_("Change limit"),()=>location.href=Re(e.id)]],expired:["calendar","bad",m(_("Access ended %s"),De(e.expires)),_("Devices can’t connect"),["calendar",_("Extend 1 month"),()=>this.quick(e,{expires:fr(e.expires,s)},_("Extended by 1 month"))]],hours:["clock","warn",_("Outside allowed hours"),m(_("Access %s (router time)"),e.hours.replace("-","–")),null],no_server:["alert","warn",_("No server"),_("Choose a server on their page"),null]},[l,d,c,p,u]=i[o];return t("div",{class:`dl-pstrip ${d}`},[t("span",{class:`dl-need-ic ${d}`},v(l)),t("span",{class:"dl-pstrip-text"},[t("b",{},c),t("span",{class:"dl-faint"},p)]),u?A([v(u[0]),` ${u[1]}`],u[2]):""])}usageSide(e,o){let s=e.quota_used||e.month[0]+e.month[1],r=e.quota_limit?Math.min(100,e.quota_used/e.quota_limit*100):0,a=e.devices.reduce((p,u)=>p+(u.spark[u.spark.length-1]??0),0),i=e.rate?.[e.rate.length-1],l=e.online&&i&&this.st.now-i[0]<180,d=t("div",{class:`dl-usebar${r>=100?" bad":r>=90?" warn":""}`});if(e.quota_limit){let p=t("i",{class:"fill"});p.style.width=`${r}%`,d.appendChild(p),we(d,()=>[t("div",{class:"dl-tip-title"},m(_("%s%% used"),K(r,1))),t("div",{class:"dl-muted"},`${m(_("%s of %s"),oe(e.quota_used),oe(e.quota_limit))} · ${m(_("%s left"),oe(Math.max(0,e.quota_limit-e.quota_used)))}`),t("div",{class:"dl-faint"},e.quota_period==="total"?_("In total"):[_("This month"),e.bonus_gb?m(_("includes +%s GB extra"),K(e.bonus_gb)):""].filter(Boolean).join(" · "))])}else{let p=e.devices.map(u=>({d:u,v:u.month[0]+u.month[1]})).filter(u=>u.v>0).sort((u,k)=>k.v-u.v);p.forEach((u,k)=>{let M=t("i",{class:`c${Math.min(k,4)}`});M.style.flexGrow=String(u.v),d.appendChild(M)}),p.length&&we(d,()=>[t("div",{class:"dl-tip-title"},_("This month by device")),...p.map((u,k)=>t("div",{class:"dl-tip-row"},[t("span",{class:`dl-swatch c${Math.min(k,4)}`}),t("span",{},u.d.name),t("b",{},oe(u.v))]))])}let c=e.quota_limit?m(_("%s left"),oe(Math.max(0,e.quota_limit-e.quota_used))):_("no limit");return t("div",{class:"dl-pside"},[t("div",{class:"dl-pside-top"},[l?t("span",{class:"dl-pside-state live"},_("Online")):t("span",{class:"dl-pside-state"},e.online?_("Online"):e.last_seen?_("Offline"):_("Never connected")),o]),t("div",{class:"dl-use-num"},[t("b",{class:s?"":"dl-faint"},oe(s)),t("span",{class:"dl-faint"},e.quota_limit?m(_("of %s"),oe(e.quota_limit)):e.quota_period==="total"&&e.quota_gb?_("in total"):_("this month"))]),d,l?t("div",{class:"dl-use-live",title:_("Right now")},[`↓ ${Fe(i[2])}`,t("span",{class:"dl-faint"},`↑ ${Fe(i[1])}`)]):t("div",{class:"dl-faint dl-pside-foot"},a?`${m(_("today %s"),oe(a))} · ${c}`:c)])}async togglePause(e){await F(()=>N.personPause(e.id,!e.paused),m(e.paused?_("%s resumed"):_("%s paused"),e.name))&&await this.refresh()}async remove(e){let o=this.person(e);await me(m(_("Remove %s?"),o?.name??e),W(o?.devices.length??0,"%s device is disconnected immediately and the personal link stops working. Usage history is kept in backups.","All %s devices are disconnected immediately and the personal link stops working. Usage history is kept in backups."),_("Remove"),!0)&&await F(()=>N.personDelete(e),_("Person removed"))&&await this.refresh()}openCreate(){let e=this.st;if(!e.servers.length){q(_("Set up the server first."),"warning");return}let o=t("input",{type:"text",class:"cbi-input-text",placeholder:_("e.g. Myata"),maxlength:48}),s=(()=>{try{return JSON.parse(Mo("dl.person.last")??"{}")}catch{return{}}})(),r=ur(s.access??"internet"),a=t("input",{type:"number",class:"cbi-input-text",min:1,max:32,value:e.settings.default_device_limit}),i=t("input",{type:"date",class:"cbi-input-text"}),l=t("input",{type:"number",class:"cbi-input-text",min:0,step:"any",placeholder:_("Unlimited"),value:s.quota??""}),d=(S,$)=>t("button",{type:"button",class:"cbi-button cbi-button-neutral",click:()=>{i.value=$?Lt(Ge(e.series),$):"",i.dispatchEvent(new Event("change"))}},S),c=e.servers[0],p=!this.serverId&&e.servers.length>1?t("select",{class:"cbi-input-select"},e.servers.map(S=>t("option",{value:S.id},S.name))):null,u=(S,$,b)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},S),t("div",{class:"cbi-value-field"},[$,b?t("div",{class:"cbi-value-description"},b):""])]),k=Ge(e.series),M=Ee(_("Name","person"),o,()=>He(o.value,[],_("Shown in their portal and apps."))),g=Ee(_("Devices"),a,()=>fn(a.value)),h=Ee(_("End date"),i,()=>ms(i.value,k,st,De),t("div",{class:"dl-actions"},[i,d(_("1 month"),1),d(_("3 months"),3),d(_("1 year"),12),d(_("None","end date"),0)])),E=Ee(_("Monthly data (GB)"),l,()=>gn(l.value));i.addEventListener("change",()=>h.refresh());let H=e.settings.portal_enabled;de(_("Add person"),[M,p?u(_("Server"),p):"",t("div",{class:"cbi-value dl-block"},[t("label",{class:"cbi-value-title"},_("Access")),t("div",{class:"cbi-value-field"},r.el)]),g,h,E],[ue()," ",A(H?_("Create and copy link"):_("Create"),async()=>{let S=Ue([M,g,h,E]);if(S){q(S,"warning");return}let $=await F(()=>N.personCreate(o.value.trim(),"",p?.value??c.id,r.get(),a.value.trim(),i.value,l.value.trim(),"month"));$&&(Eo("dl.person.last",JSON.stringify({access:r.get(),quota:l.value.trim()})),$.link&&await xe($.link,_("Personal link copied"),!0),this.showCreated($.id,o.value.trim(),$.link,e.servers.find(b=>b.id===(p?.value??c.id))?.name??c.name),await this.refresh())},"positive")]),setTimeout(()=>o.focus(),50)}showCreated(e,o,s,r){if(s){Xt({id:e,name:o,link:s},r,{title:m(_("%s is ready"),o),lead:m(_("Send %s the card or the link. They open it, add their devices and connect - no account needed."),o)});return}let a=this.person(e);de(m(_("%s is ready"),o),[t("p",{},_("Created. Turn on the personal portal in Settings to get a link, or add devices for them here."))],[t("button",{class:"cbi-button cbi-button-neutral",click:ce},_("Done"))," ",t("a",{class:"cbi-button cbi-button-neutral",href:`${L.url("admin/network/dawnline/settings")}?section=portal`},_("Open Settings"))," ",a?A(_("Add device"),()=>{ce(),ct(a,this.deviceOpts(a))},"positive"):""])}};var Pn=["#3a83f7","#a78bfa","#f472b6","#f59e0b","#10b981","#22d3ee","#ef4444","#84cc16"],So=n=>t("i",{class:"dl-circle-dot",style:`background:${Pn[n?.color??0]??Pn[0]}`}),ut=n=>n.access==="both"||n.access==="lan"&&!n.services?.length;function br(n,e,o){let s=he(n?.name??e.name??"",{placeholder:_("NAS")}),r=he(n?.address??e.address??"",{placeholder:"192.168.1.10",class:"cbi-input-text dl-mono"}),a=he((n?.ports??e.ports??[]).join(", "),{placeholder:_("All ports, or e.g. 445, 5000"),class:"cbi-input-text dl-mono"}),i=Ee(_("Name","circle or service"),s,()=>He(s.value,[],_("Shown to people who may reach it."))),l=Ee(_("Address"),r,()=>hs(r.value)),d=Ee(_("Ports"),a,()=>fs(a.value));de(n?m(_("Edit %s"),n.name):_("Add service"),[i,l,d],[ue()," ",A(_("Save"),async()=>{let c=Ue([i,l,d]);if(c){q(c,"warning");return}let p=a.value.split(/[ ,]+/).filter(Boolean);await F(()=>N.serviceSet(n?.id??"",s.value,r.value,p),_("Saved"))&&(ce(),o())},"positive")])}function Qi(){let n=_("Web"),e=_("Printer");return{_smb:"SMB",_afpovertcp:"AFP",_http:n,_https:n,_ssh:"SSH",_sftp:"SFTP","_sftp-ssh":"SFTP",_ipp:e,_ipps:e,_printer:e,"_pdl-datastream":e,_airplay:"AirPlay",_raop:"AirPlay",_rfb:_("Screen sharing"),_googlecast:"Cast",_hap:"HomeKit",_rdp:_("Remote desktop"),_ftp:"FTP"}}function Xi(n){let e=Qi(),o=new Map;for(let s of n.services){let r=e[s.type.split(".")[0]];!r||!s.port||(o.get(r)??o.set(r,new Set).get(r)).add(String(s.port))}return o.size?[...o].map(([s,r])=>[s,[...r].sort((a,i)=>+a-+i)]):[[_("Web"),["80","443"]],["SMB",["445"]],["SSH",["22"]]]}function xr(n,e,o){let s=n,r=null,a=!1,i=null,l=new Set,d=t("div",{class:"dl-list"}),c=t("div",{class:"dl-stack gap8"},t("span",{class:"dl-sub"},_("Looking for devices at home…"))),p=()=>{let h=s.services;dom.content(d,h.length?h.map(E=>t("div",{class:"dl-row"},[v("home"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},E.name),t("span",{class:"dl-mono dl-faint"},`${E.address} · ${E.ports.length?m(_("ports %s"),E.ports.join(", ")):_("all ports")}`)]),A(_("Edit"),()=>br(E,{},o)),A([v("trash")],async()=>{await me(m(_("Remove %s?"),E.name),_("People limited to this service lose access to it."),_("Remove"),!0)&&await F(()=>N.serviceDelete(E.id),_("Removed"))&&await o()},"neutral",{title:_("Remove"),"aria-label":m(_("Remove %s"),E.name)})])):[t("div",{class:"dl-row dl-muted"},_("No services yet: pick ports of a device below."))])};async function u(h,E){if(!l.has(h.address)){l.add(h.address),M();try{let H=s.services.find($=>$.address===h.address);(E===null?H&&await F(()=>N.serviceDelete(H.id),m(_("%s removed"),H.name)):await F(()=>N.serviceSet(H?.id??"",H?.name??(h.name||h.address),h.address,E),H?m(_("%s updated"),H.name):m(_("%s added"),h.name||h.address)))&&await o()}finally{l.delete(h.address),M()}}}function k(h){let E=s.services.find(C=>C.address===h.address),H=!!E&&!E.ports.length,S=new Set(E?.ports??[]),$=l.has(h.address),b=(C,w,z)=>Xe(C,w,z,{disabled:$?"disabled":null,"aria-busy":$?"true":null});return t("div",{class:"dl-row"},[v(h.services.some(C=>C.type.startsWith("_ipp")||C.type.startsWith("_printer"))?"file":"computer"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},h.name||h.address),t("span",{class:"dl-mono dl-faint"},h.address)]),t("div",{class:"dl-chips-row dl-host-ports"},[b(_("All ports"),H,()=>u(h,H?null:[])),...Xi(h).map(([C,w])=>{let z=!H&&w.every(y=>S.has(y));return b(`${C} ${w.join(", ")}`,z,()=>{let y=new Set(H?[]:S);for(let f of w)z?y.delete(f):y.add(f);u(h,y.size?[...y]:null)})})])])}function M(){if(a)return dom.content(c,t("span",{class:"dl-sub"},_("Couldn't read the devices at home.")));if(!r)return;let h=r;if(!h.hosts.length)return dom.content(c,t("span",{class:"dl-sub"},_("No devices found in the home network right now.")));let E=t("details",{class:"dl-params",open:i??!s.services.length?"":null},[t("summary",{},[v("chevron"),t("span",{},_("Add from devices at home")),t("span",{class:"dl-pcount"},String(h.hosts.length))]),t("div",{class:"dl-params-body"},[t("span",{class:"dl-sub"},h.mdns?_("Ports they announce over Bonjour. Pick what to open, or all ports."):_("Devices that got an address from this router. Pick the ports to open, or all ports.")),t("div",{class:"dl-list"},h.hosts.map(k))])]);E.addEventListener("toggle",()=>i=E.open),dom.content(c,E)}return N.homeHosts(e).then(h=>{r=h,M()}).catch(()=>{a=!0,M()}),p(),{el:t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-iflead"},[t("div",{class:"dl-iflead-row"},[t("b",{},_("Home services")),A([v("plus")," ",_("Add service")],()=>br(null,{},o))]),t("span",{class:"dl-sub"},_("Home-only people can be limited to these instead of whole networks (chosen on their page). Shared by all servers."))]),d,c]),update(h){s=h,p(),M()}}}function $n(n,e,o,s){let r=new Set(n.circles.filter(h=>h.server===e).map(h=>h.color)),a=o?.color??Pn.findIndex((h,E)=>!r.has(E));a<0&&(a=0);let i=he(o?.name??"",{placeholder:_("Family")}),l=n.people.filter(h=>h.server===e).sort((h,E)=>h.name.localeCompare(E.name)),d=new Set(l.filter(h=>o&&h.circle===o.id).map(h=>h.id)),c=t("div",{class:"dl-swatches",role:"radiogroup","aria-label":_("Colour")}),p=()=>dom.content(c,Pn.map((h,E)=>t("button",{type:"button",role:"radio",class:`dl-swatch${E===a?" on":""}`,style:`--sw:${h}`,"aria-checked":E===a?"true":"false","aria-label":m(_("Colour %s"),E+1),click:()=>{a=E,p()}})));p();let u=t("div",{class:"dl-chips-row"},l.map(h=>{let E=h.circle&&h.circle!==o?.id?n.circles.find(H=>H.id===h.circle):void 0;return t("button",{type:"button",class:`dl-chipbtn${d.has(h.id)?" on":""}`,title:ut(h)?E?m(_("Now in %s"),E.name):"":m(_("%s has no home access: their devices aren't reachable anyway"),h.name),click:H=>{d.delete(h.id)||d.add(h.id),H.currentTarget.classList.toggle("on",d.has(h.id))}},[h.name,ut(h)?E?t("b",{},E.name):"":t("b",{},_("internet"))])})),k=(h,E)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},h),t("div",{class:"cbi-value-field"},E)]),M=n.circles.filter(h=>h.server===e&&h.id!==o?.id).map(h=>h.name),g=Ee(_("Name","circle or service"),i,()=>ds(i.value,M));de(o?m(_("Edit %s"),o.name):_("New circle"),[g,k(_("Colour"),c),k(_("People"),u),t("p",{class:"dl-sub"},_("Devices of people in one circle reach each other. A person is in one circle at a time."))],[o?A(_("Delete"),async()=>{await F(()=>N.circleDelete(o.id),m(_("%s deleted"),o.name))&&(ce(),s())},"negative"):"",t("span",{class:"dl-spacer"}),ue()," ",A(_("Save"),async()=>{let h=g.help();if(h.bad){q(h.text,"warning");return}await F(()=>N.circleSet(o?.id??"",e,i.value,a,[...d]),_("Saved"))&&(ce(),s())},"positive")],"dl-circle-modal")}function wr(n,e,o){let s=n.circles.filter(r=>r.server===e);return t("div",{class:"dl-chips-row dl-circles"},[...s.map(r=>{let a=n.people.filter(i=>i.circle===r.id).map(i=>i.name);return t("button",{type:"button",class:"dl-chip",title:m(_("Edit %s"),r.name),click:()=>$n(n,e,r,o)},[So(r),t("b",{},r.name),t("span",{class:"dl-faint"},a.length?a.join(", "):_("nobody yet"))])}),t("button",{type:"button",class:"dl-chip add",title:_("New circle"),"aria-label":_("New circle"),click:()=>$n(n,e,null,o)},v("plus"))])}function Po(n,e){let o=n.people.filter(p=>p.server===e.id),s=(p="")=>t("span",{class:"dl-yes"},[v("check"),p]),r=()=>t("span",{class:"dl-faint"},"—"),a=p=>{let u=new Set(p.map(M=>M.access==="lan"&&M.services?.length?"services":M.home_nets?.length?"some":"all"));u.size||u.add("all");let k={all:_("all networks"),some:_("their networks"),services:_("services")};return s([...u].map(M=>k[M]).join(" / "))},i=()=>e.mesh==="off"?r():e.mesh==="circles"?s(_("circle")):s(),l=e.lan_like?_("like home"):_("direct"),d=(p,u,k)=>t("tr",{},[t("td",{},[t("b",{},p),t("div",{class:"dl-sub"},W(u.length,"%s person","%s people"))]),...k.map(M=>t("td",{},M))]),c=p=>o.filter(u=>u.access===p);return t("section",{class:"dl-setsec"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Who reaches what")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},_("From the rules on this server"))]),t("div",{class:"dl-reach-wrap"},t("table",{class:"dl-table dl-reach"},[t("tr",{},["",_("Internet"),_("Home"),_("This router"),_("Each other")].map(p=>t("th",{},p))),d(_("Internet"),c("internet"),[s(l),r(),t("span",{class:"dl-faint"},"DNS"),r()]),d(_("Home"),c("lan"),[t("span",{class:"dl-faint"},_("their own")),a(c("lan")),s(),i()]),d(_("Both"),c("both"),[s(l),a(c("both")),s(),i()])])),t("p",{class:"dl-sub"},_("Home devices reach the devices of people with home access, on the networks those people reach. Paused, ended and over-the-limit people reach nothing."))])])}function yr(n,e){let o=n.people.filter(c=>c.server===e.id).flatMap(c=>c.devices.map(p=>({id:p.id,label:`${c.name} · ${p.name}`}))).sort((c,p)=>c.label.localeCompare(p.label)),s="@addr",r=(c,p)=>{let u=t("select",{class:"cbi-input-select","aria-label":c},[...o.map(h=>t("option",{value:h.id,selected:h.id===p?"selected":null},h.label)),t("option",{value:s,selected:p===s?"selected":null},_("Address"))]),k=he("",{placeholder:c,class:"cbi-input-text dl-mono"}),M=t("div",{class:"dl-check-end"},[u,k]),g=()=>k.hidden=u.value!==s;return u.addEventListener("change",g),g(),{el:M,value:()=>u.value===s?k.value.trim():u.value}},a=r("10.0.1.11",o[0]?.id??s),i=r("10.0.1.20:445",s),l=t("div",{class:"dl-stack gap8"}),d=async()=>{let c=await F(()=>N.accessCheck(a.value(),i.value()));if(!c)return;let p=c.steps.findIndex(u=>!u.ok);dom.content(l,[t("div",{class:`dl-verdict ${c.ok?"ok":"bad"}`},[t("b",{},c.ok?_("Allowed"):_("Blocked")),t("span",{class:"dl-sub"},c.ok?_("Every step lets it through"):m(_("Stops at step %s of %s"),p+1,c.steps.length))]),t("ul",{class:"dl-checks"},c.steps.map(u=>t("li",{},[t("span",{class:`dl-check-icon ${u.ok?"ok":"error"}`},v(u.ok?"check":"x")),t("div",{class:"dl-check-body"},[t("div",{class:"dl-check-title"},u.title),u.detail?t("div",{class:"dl-check-detail"},u.detail):""])])))])};return t("section",{class:"dl-setsec"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Check access")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},_("Why something does or does not connect"))]),t("div",{class:"dl-check-form"},[a.el,t("span",{class:"dl-faint"},"→"),i.el,A(_("Check"),d)]),l])])}function Dn(n){return n==="app"?"Dawnline":n==="amneziawg"?"AmneziaWG":n==="packages"||n==="pkgs"?_("System packages"):void 0}function mt(n){return(n.startsWith("check")?n.slice(6)||"all":n).split(/[:@ ]/)[0]}function An(n){return mt(n.action==="check"?`check:${n.component??""}`:n.component??"")}function kr(n){return n=Math.max(0,Math.floor(n)),`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function _r(n,e){return!n?.from&&!n?.to?e:n.from&&n.to&&n.from!==n.to?`${n.from} → ${n.to}`:n.to??n.from??e}function Cr(n,e){let o=n.check?.components??{},s=e==="all"?["app","amneziawg","packages"]:[e],r=[],a;for(let l of s){let d=o[l];if(d){if(d.error)return{tone:"warn",text:d.error};l==="packages"&&d.updates?r.push(W(d.updates,"%s system package","%s system packages")):l!=="packages"&&d.update&&d.installed&&d.latest&&(r.push(`${Dn(l)} ${d.latest}`),e!=="all"&&(a=d.latest))}}if(r.length)return{tone:"acc",text:m(_("Update available: %s"),r.join(", ")),update:a};let i=s.length===1?o[s[0]]:null;return i?.status==="dev"?{tone:"acc",text:m(_("Installed version is newer than the release (%s)"),i.latest)}:i?.note?{tone:"warn",text:i.note}:{tone:"ok",text:s.length>1?_("Everything is up to date"):_("Latest version is installed")}}function Lr(n,e,o,s){return e?n.id===e:o&&n.id===o?!1:n.state==="running"||s>0&&n.started>=s}var $o=n=>new Promise(e=>setTimeout(e,n));async function tn(n,e,o){let s=o?An(o):mt(n),r=o?o.action==="check":n.startsWith("check"),a=Date.now(),i=t("b",{},Dn(s)??(s==="all"?_("All components"):"Dawnline")),l=t("span",{class:"dl-pill dl-mono"},e.version??""),d=t("span",{class:"dl-pill info",hidden:!0}),c=t("span",{},"0:00"),p=t("pre",{class:"dl-log"},_("Operation started. Waiting for log output…")),u=t("div",{}),k=t("div",{class:"dl-op-actions"}),M=[],g=x=>dom.content(k,x),h=(x=!1)=>ue(_("Close"),x);de(e.title,t("div",{class:"dl-op"},[t("div",{class:"dl-op-head"},[i,e.version?l:"",d,t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint dl-op-timer"},[v("clock"),c])]),t("div",{class:"dl-op-loghead"},[t("b",{},_("Operation log")),$e("copy",_("Copy log"),()=>xe(M.join(` -`),_("Log copied")))]),p,u]),[k],"wide"),g([t("button",{class:"cbi-button cbi-button-neutral spinning",type:"button",disabled:"disabled"},r?_("Checking…"):_("Working…"))]);let E=o??null,H=o?.id,S,$=0,b=x=>{H!==x.id&&(H=x.id,e.onJob?.(x))};if(o)e.onJob?.(o);else try{let x=await N.updatesStatus().catch(()=>null);S=x?.job?.id,$=x?.now??0;let T=await N.updatesRun(n);T.job&&T.job.state==="running"&&T.job.id!==S&&(E=T.job,b(T.job))}catch(x){return M=[Ce(x)],p.textContent=M[0],dom.content(u,t("div",{class:"dl-comp-status warn"},[v("alert"),t("span",{},Ce(x))])),g([h(!0)]),q(Ce(x),"error"),null}let C=null,w=0;for(;;){if(await $o(1e3),C=await N.updatesStatus().catch(()=>null),!C){if(++w>60)break;continue}w=0;let x=C.job;if(!x||!Lr(x,H,S,$)){if(Date.now()-a>15e3)break;continue}if(b(x),E=x,x.log.length){M=x.log;let T=p.scrollTop+p.clientHeight>=p.scrollHeight-8;p.textContent=M.join(` +`,Hs(i,e)]:[Hs(i,e)])),r=t("button",{type:"button",class:"dl-chipbtn",click:i=>{i.preventDefault(),e=!e,dom.content(r,[v(e?"x":"key"),e?_("Hide key"):_("Show key")]),s()}},[v("key"),_("Show key")]);s();let a=new Blob([n.conf]).size;return t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-filecard"},[t("span",{class:"dl-filecard-ic"},".conf"),t("span",{class:"dl-stack"},[t("span",{class:"dl-mono dl-ellipsis"},n.filename),t("span",{class:"dl-sub"},`AmneziaWG · ${W(a,"%s byte","%s bytes")}`)]),A([v("download")," ",_("Download")],()=>Ne(n.filename,n.conf,"application/octet-stream"),"positive")]),t("details",{class:"dl-params"},[t("summary",{},[v("chevron"),t("span",{},_("Configuration")),t("span",{class:"dl-spacer"}),r,t("button",{type:"button",class:"dl-chipbtn",click:i=>{i.preventDefault(),xe(n.conf,_("Configuration copied"))}},[v("copy"),_("Copy")])]),o])])}function ho(n){let e=n.amnezia.obfuscation??{},o={h1:"1",h2:"2",h3:"3",h4:"4"};return Object.entries(e).every(([s,r])=>r==null||r===""||r===(o[s]??"0"))}async function Mi(n,e="file"){if(!n.has_private_key)return t("div",{class:"dl-hint"},_("This device generated its own keys in the browser, so its full configuration only exists on that device."));let o=await mo(n,n.server),s={qr:()=>t("div",{class:"dl-qr-pane"},[un(n.conf),t("span",{class:"dl-sub"},ho(n)?_("Scan with AmneziaVPN or any WireGuard app on the device."):_("Scan with AmneziaVPN or AmneziaWG on the device."))]),key:()=>t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-linkbox"},[t("span",{class:"dl-mono"},o),A(_("Copy"),()=>xe(o,_("Key copied")))]),t("span",{class:"dl-sub"},m(_("AmneziaVPN → %s. Keep it private."),["+",_("Insert","AmneziaVPN app"),_("Continue","AmneziaVPN app")].join(" → ")))]),file:()=>Li(n)},r=t("div",{class:"dl-connect-body"}),a=t("div",{class:"dl-seg"}),i=l=>{a.querySelectorAll("button").forEach(d=>d.classList.toggle("on",d.dataset.id===l)),dom.content(r,s[l]())};for(let[l,d]of[["file",_("File")],["key",_("Key")],["qr",_("QR code")]])a.appendChild(t("button",{type:"button","data-id":l,click:()=>i(l)},d));return i(e),t("div",{class:"dl-stack gap12"},[a,r])}async function Ei(n,e,o,s){let r=Kt(o),i=n.st.people.filter(d=>d.server===e.id).reduce((d,c)=>d+c.devices.length,0);await me(s?_("Generate new disguise values?"):m(_("Switch to %s?"),r.title),[W(i,"%s AmneziaWG device stops connecting until it imports its configuration again (from their personal link or from you).","%s AmneziaWG devices stop connecting until they import their configuration again (from their personal link or from you)."),o==="max"?_("They need an app with AmneziaWG 3.1."):o==="balanced"?_("They need an app with AmneziaWG 2.0 or newer."):"",n.st.servers.length===1&&i?_("To keep the old disguise for some people, add a second server and move them there."):""].filter(Boolean).join(" "),s?_("Generate and apply"):_("Switch and apply"),!0)&&await F(()=>N.serverObfuscation(e.id,o),s?_("New values applied"):m(_("%s applied"),r.title))&&(q(_("Devices are marked “Update config” until they import again."),"info",6e3),await n.refresh())}function Ti(n,e){let o=n.st,s=he(String(e.port),{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),r=he(e.mtu?String(e.mtu):"",{placeholder:_("Auto"),inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),a=he(String(e.keepalive??""),{placeholder:"25",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),i=Kt(e.preset)?e.preset:void 0,l=i??wn(o.awg),d=A("",()=>Ei(n,e,l,l===i),"neutral"),c=()=>dom.content(d,l===i?[v("reset")," ",_("Generate new values")]:[m(_("Switch to %s"),Kt(l).title)]);c();let p=o.awg_state?.tools!==!1,u=[],w=_e(_("UDP port"),s,()=>Gt(Number(s.value),u,[_("Opened on the WAN firewall automatically."),Number(s.value)===4500?_("4500 is IPsec’s port: most networks let it through."):""].filter(Boolean).join(" ")));N.serverPorts(e.id).then(h=>{u=h.udp_taken??[],w.refresh()}).catch(()=>{});let M=_e("MTU",r,()=>ps(r.value,e.mtus)),g=_e(_("Keep-alive"),a,()=>us(a.value));return Wt("",[As("AmneziaWG",e.ifname),ke("globe",_("Listening"),_("Where devices reach this core from the internet"),[w]),ke("file",_("In every device configuration"),_("Changing these marks devices “Update config” until they import again"),[M,g]),ke("shield",_("Disguise"),_("So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard"),[Yt(e.preset)?bt("warn",ae(_("%s is AmneziaWG 1.0 junk only, which networks learned to spot; it is not offered any more. Switch to %s or %s: devices import their configuration again."),t("b",{},Yt(e.preset)),t("b",{},_("Balanced")),t("b",{},_("Maximum")))):"",yn(o.awg,l,h=>{l=h,c()},i,p),p&&!o.awg.v3?bt("info",ae(_("This router runs an older AmneziaWG. %s becomes available with kmod-amneziawg and amneziawg-tools 3.1."),t("b",{},_("Maximum")))):"",Ci(e.obf??{})??"",t("div",{class:"dl-row-end"},[t("span",{class:"dl-sub"},_("Applies at once: every AmneziaWG device imports its configuration again.")),d])]),t("details",{class:"dl-params"},[t("summary",{},[v("chevron"),t("span",{},_("Tunnel")),t("span",{class:"dl-pcount"},"3")]),t("div",{class:"dl-params-body"},[ge(_("Interface"),t("span",{class:"dl-mono"},`${e.ifname} · ${m(_("router %s"),e.address)}`)),ge(_("Tunnel subnet"),t("span",{class:"dl-mono"},e.subnet),_("Device addresses come from it.")),ge(_("Server public key"),t("span",{class:"dl-keyrow"},[t("code",{class:"dl-mono"},e.public_key),A([v("copy")],()=>xe(e.public_key,_("Public key copied")),"neutral",{title:_("Copy"),class:"cbi-button cbi-button-neutral dl-icon-only sm"})]))])])],[t("span",{class:"dl-sub"},_("Port, MTU and keep-alive apply at once.")),A(_("Save"),()=>{let h=Ue([w,M,g]);if(h){q(h,"warning");return}return n.save({port:s.value,mtu:r.value,keepalive:a.value},_("AmneziaWG saved"))},"positive")])}function Si(n){let e=Kt(n.preset),o=n.obf??{},s=(i,l)=>t("span",{class:`dl-segs ${l}`},[0,1,2,3].map(d=>t("i",{class:d+o[i]).map(i=>`${i.toUpperCase()} ${o[i]}`);return a.length&&r.push(a.slice(0,2).join(" · ")+(a.length>2?` +${a.length-2}`:"")),["h1","h2","h3","h4"].some(i=>o[i]&&o[i]!==String(["h1","h2","h3","h4"].indexOf(i)+1))&&r.push(_("H1–H4 random")),o.i1&&r.push(/0x(8580|0100)0001/.test(o.i1)?_("DNS-like first packets"):_("Signature packets")),o.header_protection_key&&r.push(_("Encrypted headers")),r.length||r.push(e?.id==="off"?_("Plain WireGuard"):_("No values yet")),t("div",{class:"dl-bento-tile dl-disg"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},_("Disguise")),t("a",{href:`${L.url("admin/network/dawnline/server")}?server=${encodeURIComponent(n.id)}§ion=awg`},_("Change"))]),t("div",{class:"dl-disg-id"},[t("span",{class:`dl-disg-ic${e?.id==="off"?" off":""}`},v(e?.ic??"shield")),t("span",{class:"dl-stack"},[t("b",{},e?e.title:Yt(n.preset)??_("Custom","disguise")),t("span",{class:"dl-sub"},e?e.short:Yt(n.preset)?_("Switch to Balanced or Maximum"):_("Set by hand"))])]),e?t("div",{class:"dl-disg-meters"},[t("span",{},_("Stealth")),s(e.stealth,"acc"),t("span",{},_("Speed")),s(e.speed,"ok")]):"",t("div",{class:"dl-disg-chips"},r.map(i=>t("span",{},i)))])}var fo={id:"awg",label:"AmneziaWG",settingsCard:Ti,overviewTile:Si,connectBlock:Mi,qrText:n=>n.conf,appKey:{get label(){return _("Copy AmneziaVPN config")},make:n=>mo(n,n.server)},file:{get label(){return _("Download AmneziaWG config")},make:n=>({name:n.filename,text:n.conf})}};var Pi={awg:fo};function qe(n){return Pi[n?.core||"awg"]??fo}function zt(n,e){return qe(n.find(o=>o.id===e))}var $i=2,Vt=new Set,go=null,kn=null;async function zs(){if(document.visibilityState!=="visible"||!Vt.size)return;let n=await N.rev().catch(()=>null);if(!n)return;let e=go!=null&&n.rev!==go;go=n.rev,n.version&&(kn&&n.version!==kn?(q(m(_("Dawnline was updated to %s: reload the page."),n.version),"warning",15e3),kn=null):kn??(kn=n.version)),e&&Vt.forEach(o=>o())}function _n(n){return Vt.add(n),poll.add(zs,$i),()=>{Vt.delete(n),Vt.size||poll.remove(zs)}}function Bs(n,e,o,s,r=0){let a=[],i=null,l=p=>{i&&p>i.from&&a.push({...i,to:p}),i=null},d=n.filter(p=>p.device===e).sort((p,u)=>p.ts-u.ts);for(let p of d)if(p.type==="connect")l(p.ts),p.detail&&(i={ip:p.detail,from:p.ts,to:p.ts,live:!1});else if(p.type==="roam"){let u=p.detail?.split("→")[1]?.trim();l(p.ts),u&&(i={ip:u,from:p.ts,to:p.ts,live:!1})}else p.type==="disconnect"&&l(p.ts);let c=i;return c&&s?a.push({...c,to:Math.max(o,c.from),live:!0}):l(Math.min(o,r)),a}function et(n){return`${n.city||`${n.lat.toFixed(1)},${n.lon.toFixed(1)}`}|${n.cc}`}function Os(n,e,o,s){let r=new Map;for(let i of e)(i.device===o||!r.has(i.ip))&&r.set(i.ip,i);let a=[];for(let i of n){let l=r.get(i.ip);!l||i.to<=s||a.push({key:et(l),point:l,from:Math.max(i.from,s),to:i.to,live:i.live})}return a}function js(n){let e=new Map,o=0;for(let s of n)e.set(s.key,(e.get(s.key)??0)+(s.to-s.from)),o+=s.to-s.from;return new Map([...e].map(([s,r])=>[s,o?r/o:0]))}function Rs(n,e=2700){let o=[];for(let s of n){let r=o[o.length-1];if(r&&s.key!==r.key&&!s.live&&s.to-s.from{a&&(o.push({kind:"move",k:a,start:s,ms:e}),s+=e);let i=Math.min(1100,Math.max(350,(r.to-r.from)/3600*45));o.push({kind:"stay",k:a,start:s,ms:i}),s+=i}),{steps:o,total:s}}function qs(n,e,o){let s=e.findIndex(l=>o>=l.start&&oo>=i.from&&oi.kind==="stay"&&i.k===s),a=n[s];return r.start+r.ms*Math.min(.999,Math.max(0,(o-a.from)/Math.max(1,a.to-a.from)))}var Di=n=>n<=0?0:n>=1?1:n<.5?2*n*n:1-(-2*n+2)**2/2;function Ks(n){return-vo/2+(1+vo)*Di((n-Is)/(1-Is))}var Ys=n=>n+Ws>=1;function Vs(n){return["interpolate",["linear"],["abs",["-",["get","pos"],n]],0,1,Ws,1,vo/2,0]}function Js(n,e){let o=n==="24h"?86400:n==="7d"?604800:2592e3,s=e-o,r=[],a=(l,d)=>{let c=(l-s)/o;c>.02&&c<.98&&r.push([c,d])},i=new Date(s*1e3);if(n==="24h")for(i.setMinutes(0,0,0);i.getTime()/1e3<=e;)i.getHours()%6===0&&a(i.getTime()/1e3,`${String(i.getHours()).padStart(2,"0")}:00`),i.setHours(i.getHours()+1);else if(n==="7d")for(i.setHours(12,0,0,0);i.getTime()/1e3<=e;i.setDate(i.getDate()+1))a(i.getTime()/1e3,i.toLocaleDateString(le(),{weekday:"short"}));else{let l=new Date(e*1e3);l.setHours(0,0,0,0);for(let d=0;d<5;d++){let c=new Date(l);c.setDate(l.getDate()-7*d),a(c.getTime()/1e3,c.toLocaleDateString(le(),{day:"numeric",month:"short"}))}r.reverse()}return r}var Cn=n=>new Date(n*1e3).toLocaleTimeString(le(),{hour:"2-digit",minute:"2-digit"});function Zs(n,e){let o=s=>new Date(s*1e3).toDateString();return o(n)===o(e)?_("Today"):o(n)===o(e-86400)?_("Yesterday"):new Date(n*1e3).toLocaleDateString(le(),{weekday:"short",day:"numeric",month:"short"})}var xo="https://unpkg.com/maplibre-gl@6.14.0/dist",Qs={module:"sha384-q26X6R1yFeg0QR9SHHn6U3Nb0ddRRTtwxsahubv5R89/v5nijKpk9KviUp9ZLySk",css:"sha384-1TZtfVz7qtwR5vD7cMwjGT+9uiK4lqE3pbUOPwYO6OCpb+TYP0S9vLIhG02JCU04"},Xs="https://basemaps.cartocdn.com/gl/dark-matter-gl-style/style.json",er="https://basemaps.cartocdn.com/gl/positron-gl-style/style.json",Ai={online:0,"24h":86400,"7d":7*86400,"30d":30*86400},Jt=null;function Ni(n){if(n.appendChild(t("link",{rel:"stylesheet",href:`${xo}/maplibre-gl.css`,integrity:Qs.css,crossorigin:"anonymous"})),Jt)return Jt;let e=`${xo}/maplibre-gl.mjs`;return Jt=new Promise((s,r)=>{let a=t("link",{rel:"modulepreload",href:e,integrity:Qs.module,crossorigin:"anonymous"});a.addEventListener("load",()=>s()),a.addEventListener("error",()=>r(new Error("integrity"))),document.head.appendChild(a)}).then(()=>import(e)).then(s=>(s.getWorkerUrl()||s.setWorkerUrl(`${xo}/maplibre-gl-worker.mjs`),s),s=>{throw Jt=null,new Error(s?.message==="integrity"?_("The map library from the CDN is not the expected file: not loading it."):_("Could not load the map library (no internet access from this browser?)"))}),Jt}var Hi=10,tr=30,zi=62,Ri=4,nr=4.5,Ii=7,Ln="#3b82f6",wo="#8a8a8a";function or(n,e,o=.2,s=64){let[r,a]=n,[i,l]=e,d=i-r,c=d>180?i-360:d<-180?i+360:i,p=c-r,u=l-a,w=Math.hypot(p,u);if(w===0||o===0)return[n,[c,l]];let M=-u/w,g=p/w,h=w*o,E=(r+c)/2+M*h,H=(a+l)/2+g*h,S=[],$=Math.max(2,Math.floor(s));for(let b=0;b<=$;b+=1){let C=b/$,y=1-C;S.push([y*y*r+2*y*C*E+C*C*c,y*y*a+2*y*C*H+C*C*l])}return S}function yo(n,e){let o=new Map;for(let s of n.geo.points){if(n.person&&s.person!==n.person||n.device&&s.device!==n.device||(e==="online"?!s.online:n.now-s.ts>Ai[e]))continue;let r=n.device?et(s):n.person?`${s.device}|${s.city}|${s.cc}`:s.device,a=o.get(r);(!a||s.online&&!a.online||s.online===a.online&&s.ts>a.ts)&&o.set(r,s)}return[...o.values()]}function ko(n,e){let o=0;return yo(n,e).sort((s,r)=>Number(r.online)-Number(s.online)||r.ts-s.ts).map(s=>({...s,n:s.online?0:++o}))}var dt=class{constructor(e,o="online",s=380){this.cb=e;this.map=null;this.gl=null;this.markers=[];this.popup=null;this.theme=null;this.resize=null;this.fitBlind=!1;this.data=null;this.fitted=!1;this.fitKey=null;this.people=[];this.slots=[];this.merged=[];this.piles=new Map;this.dock=null;this.dockKey="";this.dockQuiet=!1;this.piledKeys=new Set;this.foldedKeys=new Set;this.targetZoom=null;this.before=null;this.hiddenKey="";this.focused=null;this.dead=!1;this.places=new Map;this.replaying=null;this.bandDots=[];this.range=o,this.status=t("div",{class:"dl-map-status"}),this.card=t("div",{class:"dl-map-card","aria-live":"polite"}),this.el=t("div",{class:"dl-geomap",style:`height:${s}px`},[this.status,this.card])}async mount(e){this.data=e;try{this.gl=await Ni(this.el)}catch(s){this.status.textContent=s.message;return}if(this.dead)return;this.map=new this.gl.Map({container:this.el,style:xt()?Xs:er,center:[e.geo.home?.lon??20,e.geo.home?.lat??50],zoom:1,renderWorldCopies:!1,attributionControl:{compact:!0},minZoom:1}),this.map.on("style.load",()=>this.layers()),this.map.on("move",()=>this.declutter()),this.map.once("idle",()=>{let s=this.el.querySelector(".maplibregl-ctrl-attrib");s?.classList.remove("maplibregl-compact-show"),s?.removeAttribute("open")}),this.resize=new ResizeObserver(()=>{!this.map||!this.el.clientWidth||!this.el.clientHeight||(this.map.resize(),this.fitBlind&&(this.fitKey=null,this.draw()))}),this.resize.observe(this.el);let o=xt();this.theme=new MutationObserver(()=>{!this.map||xt()===o||(o=xt(),this.map.setStyle(o?Xs:er))}),this.theme.observe(document.documentElement,{attributes:!0,attributeFilter:["data-darkmode"]})}layers(){if(this.map){this.hiddenKey="",this.map.setProjection({type:"globe"}),this.map.addSource("dl-areas",{type:"geojson",data:{type:"FeatureCollection",features:[]}}),this.map.addLayer({id:"dl-area",type:"circle",source:"dl-areas",paint:{"circle-radius":["interpolate",["exponential",2],["zoom"],2,6,6,26,9,140,12,900],"circle-color":["case",["get","online"],Ln,wo],"circle-opacity":["case",["get","online"],.12,.06],"circle-stroke-width":1,"circle-stroke-color":["case",["get","online"],Ln,wo],"circle-stroke-opacity":["case",["get","online"],.35,.15]}}),this.map.addSource("dl-band",{type:"geojson",data:{type:"FeatureCollection",features:this.bandDots}}),this.map.addLayer({id:"dl-band",type:"circle",source:"dl-band",paint:{"circle-radius":1.4,"circle-color":Ln,"circle-opacity":0}}),this.map.addSource("dl-arcs",{type:"geojson",data:{type:"FeatureCollection",features:[]}});for(let e of[!1,!0])this.map.addLayer({id:e?"dl-arc-live":"dl-arc-recent",type:"line",source:"dl-arcs",filter:["==",["get","online"],e],layout:{"line-join":"round","line-cap":"round"},paint:{"line-color":e?Ln:wo,"line-width":2,"line-opacity":.85,"line-dasharray":[2,2]}});this.draw()}}setRange(e){this.range=e,this.fitKey=null,this.draw()}update(e){this.data=e,this.draw()}destroy(){this.dead=!0,this.dropCard();for(let e of this.piles.values())e.marker.remove();this.piles.clear(),this.theme?.disconnect(),this.resize?.disconnect(),this.map?.remove(),this.map=null}groups(e){let o=new Map;for(let s of e){let r=`${s.person}|${et(s)}`,a=o.get(r);a||(a={key:r,person:s.person,lat:s.lat,lon:s.lon,city:s.city,country:s.country,cc:s.cc,asn:s.asn,org:s.org,online:!1,ts:0,points:[]},o.set(r,a)),a.points.push(s),a.online||(a.online=s.online),a.ts=Math.max(a.ts,s.ts)}return[...o.values()]}draw(){if(!this.map||!this.data||!this.map.getSource("dl-arcs"))return;let e=this.data,o=this.groups(yo(e,this.range)),s=e.person||e.device?null:e.geo.home;for(let d of this.markers)d.remove();this.markers=[];let r=e.person||e.device?null:Oi(o,s),a=o.map(d=>({g:d,at:r?.get(d.key)??[d.lon,d.lat]}));if(this.slots=[],this.map.getSource("dl-areas").setData({type:"FeatureCollection",features:a.map(({g:d})=>({type:"Feature",properties:{online:d.online,key:d.key},geometry:{type:"Point",coordinates:[d.lon,d.lat]}}))}),this.map.getSource("dl-arcs").setData({type:"FeatureCollection",features:s?a.map(({g:d,at:c})=>({type:"Feature",properties:{online:d.online,person:d.person,key:d.key},geometry:{type:"LineString",coordinates:or([s.lon,s.lat],c)}})):[]}),s){let d=t("span",{class:"dl-mk-host"});d.innerHTML=`${kt("server","dl-mk-host-ic")}`,this.dock=d.appendChild(t("span",{class:"dl-mk-dock"})),this.dockQuiet=this.dockKey!=="",this.dockKey="";let c=t("div",{class:"dl-mk-hub",title:`${_("Home router")}${s.city?` · ${s.city}`:""}${s.org?` · ${s.org}`:""}`},[d,t("span",{class:"dl-mk-label chip"},s.city||_("Home"))]);c.addEventListener("mouseenter",()=>this.showMerged(s.city)),c.addEventListener("mouseleave",()=>this.focus(this.focused)),c.addEventListener("click",()=>this.zoomToMerged()),this.add(c,[s.lon,s.lat],!0)}let i=new Map(e.device?ko(e,this.range).map(d=>[et(d),d.n]):[]);this.people=[],this.places.clear();for(let{g:d,at:c}of a){let p=d.points.length,u=e.people.find(h=>h.id===d.person);if(e.person){let h=e.device?this.deviceMarker(d,c,u,i.get(et(d))??0):this.placeMarker(d,c,u);this.add(h,c);continue}let w=d.points.map(h=>u?.devices.find(E=>E.id===h.device)?.kind??"other"),M=t("span",{class:"dl-mk-badge"});M.innerHTML=p<=2?w.map(h=>kt(h,"dl-mk-badge-ic")).join(""):String(p);let g=t("button",{type:"button",class:`dl-mk${d.online?" online":""}`,"aria-label":d.city?m(N_(p,"%s: %s device in %s","%s: %s devices in %s"),u?.name??_("Someone"),K(p),d.city):m(N_(p,"%s: %s device in an unknown city","%s: %s devices in an unknown city"),u?.name??_("Someone"),K(p))},[t("span",{class:"dl-mk-av"},[je(u?.name??"?"),M]),t("span",{class:"dl-mk-label below"},d.city||d.cc||"?")]);g.addEventListener("mouseenter",()=>this.focus(d.person)),g.addEventListener("mouseleave",()=>this.focus(null)),this.people.push({el:g,person:d.person}),g.addEventListener("click",h=>{h.stopPropagation(),this.openPopup(d,c,g)}),this.add(g,c,!1,u?.name??_("Someone"),`${d.city||d.cc||"?"} · ${d.online?_("now"):pe(d.ts,e.now)}`,d.key,d)}this.declutter();let l=a.map(d=>d.g.key).sort().join(";");if(l!==this.fitKey&&!this.popup){let d=this.fitted&&!this.fitBlind;if(this.fitBlind=!this.el.clientWidth||!this.el.clientHeight,this.fitKey=l,this.fitted=!0,s&&!a.length){let c={center:[s.lon,s.lat],zoom:12};d?this.glide(12,()=>this.map.flyTo({...c,duration:1200})):this.map.jumpTo(c)}else{let c=a.map(p=>p.at);s&&(c.length===0||this.range!=="online"||a.some(p=>p.g.online))&&c.push([s.lon,s.lat]),this.fit(c,d)}}this.status.textContent=a.length||s?"":_("No locations yet"),this.status.style.display=this.status.textContent?"":"none",this.focus(this.focused&&this.people.some(d=>d.person===this.focused)?this.focused:null)}add(e,o,s=!1,r,a,i,l){i&&this.foldedKeys.has(i)&&e.classList.add("merged"),i&&this.piledKeys.has(i)&&e.classList.add("piled"),e.dataset.key=i??"",e.classList.add("dl-mk-new"),requestAnimationFrame(()=>requestAnimationFrame(()=>e.classList.remove("dl-mk-new")));let d=new this.gl.Marker({element:e}).setLngLat(o).addTo(this.map);this.markers.push(d),this.slots.push({marker:d,el:e,at:o,fixed:s,who:r,where:a,g:l})}declutter(){if(!this.map)return;let e=this.map.getZoom();this.el.classList.toggle("dl-lod-far",e=nr&&e{let l=this.map.project(i.at),d=i.el.querySelector(":scope > .dl-mk-host, :scope > .dl-mk-av, :scope > .dl-mk-tile");return{x:l.x,y:l.y,r:(d?.offsetWidth||24)/2+3,fixed:i.fixed}}),s=o.filter(i=>i.fixed);this.merged=[],this.foldedKeys.clear();let r=this.targetZoom==null?1:Math.min(1,2**(this.targetZoom-this.map.getZoom()));o.forEach((i,l)=>{if(i.fixed)return;let d=this.slots[l],c=d.el.classList.contains("merged")?12:6,p=s.find(u=>Math.hypot(u.x-i.x,u.y-i.y)*r{let c=this.slots[d];!c||c.fixed||(o[d].fixed&&([i,l]=[0,0]),c.marker.setOffset([i,l]),Ui(c.el,i,l))})}closePopup(e=!1){let o=this.popup;if(!o||o.card.classList.contains("leaving"))return;o.card.classList.add("leaving"),setTimeout(()=>{this.popup===o&&this.dropCard()},140);let s=this.before;if(this.before=null,!s)return;let r=()=>this.map?.flyTo({...s,duration:800});if(!e)return r();let a=!1,i=()=>{a||(a=!0,window.removeEventListener("pointerup",i,!0),window.removeEventListener("pointercancel",i,!0),setTimeout(r,0))};window.addEventListener("pointerup",i,!0),window.addEventListener("pointercancel",i,!0),setTimeout(i,1500)}dropCard(){this.popup?.off(),this.popup?.card.remove(),this.popup=null}showMerged(e){this.merged.length&&(dom.content(this.card,[t("div",{class:"dl-map-card-head"},[t("b",{},e?m(_("Near %s"),e):_("Near the server")),` · ${_("click to zoom in")}`]),...this.merged.map(o=>t("div",{class:"dl-map-card-row"},[t("span",{},o.who),t("span",{class:"dl-faint"},o.where)]))]),this.card.classList.add("on"))}paintDock(){let e=this.dock;if(!e)return;let o=this.merged.map(r=>`${r.key}:${r.online?1:0}`).join("|");if(o===this.dockKey)return;this.dockKey=o,e.parentElement?.classList.toggle("docked",this.merged.length>0);let s=this.slots.find(r=>r.fixed).at;this.merged.length&&rr(e,this.merged,this.faceActions(()=>[s]),this.dockQuiet),this.dockQuiet=!1}faceActions(e){return{click:(o,s)=>this.openFace(o,s,e()),hover:o=>this.focus(o?.g?.person??null)}}pileUp(e){let o=new Set;if(!this.data?.person&&!this.data?.device){let s=e.flatMap((l,d)=>!l.fixed&&this.slots[d].el.querySelector(":scope > .dl-mk-av")?[d]:[]),r=new Map(s.map(l=>[l,l])),a=l=>r.get(l)===l?l:a(r.get(l));for(let l of s)for(let d of s){if(d<=l)continue;let c=this.slots[l].el.classList.contains("piled")&&this.slots[d].el.classList.contains("piled");Math.hypot(e[l].x-e[d].x,e[l].y-e[d].y)this.slots[h]),c=d.map(sr),p=c.map(h=>h.key).sort().join(",");o.add(p);let u=[d.reduce((h,E)=>h+E.at[0],0)/d.length,d.reduce((h,E)=>h+E.at[1],0)/d.length],w=this.piles.get(p);if(!w){let h=t("span",{class:"dl-mk-pile-box"}),E=[...new Set(d.map($=>$.g?.city||$.g?.cc||"?"))],H=t("div",{class:"dl-mk-pile"},[h,t("span",{class:"dl-mk-label below"},E.length===1?E[0]:W(d.length,"%s person","%s people"))]);w={marker:new this.gl.Marker({element:H}).setLngLat(u).addTo(this.map),el:H,box:h,faces:c},H.addEventListener("mouseleave",()=>this.focus(this.focused));let S=w;H.addEventListener("click",$=>{$.stopPropagation(),this.zoomInTo(S.faces.map(b=>b.at),!1)}),this.piles.set(p,w)}w.faces=c;let M=w;rr(w.box,c,this.faceActions(()=>M.faces.map(h=>h.at)));for(let h of l)this.slots[h].el.classList.add("piled"),Object.assign(e[h],{r:0,fixed:!0});let g=this.map.project(u);e.push({x:g.x,y:g.y,r:(w.el.offsetWidth||60)/2+3,fixed:!0})}}this.piledKeys=new Set(this.slots.filter(s=>s.el.classList.contains("piled")).map(s=>s.el.dataset.key??"")),this.slots.forEach((s,r)=>{(!e[r].fixed||s.fixed||s.el.classList.contains("merged"))&&s.el.classList.remove("piled")});for(let[s,r]of this.piles)o.has(s)||(this.piles.delete(s),r.el.classList.add("out"),setTimeout(()=>r.marker.remove(),200))}zoomToMerged(){!this.map||!this.merged.length||this.zoomInTo([this.slots.find(e=>e.fixed).at,...this.merged.map(e=>e.at)],!1)}openFace(e,o,s){if(!e.g)return;if(s.every(a=>Mn(a,e.at)<1))return this.openPopup(e.g,e.at,o);let r=()=>{let a=this.slots.find(i=>i.el.dataset.key===e.key);a?.g&&!a.el.classList.contains("merged")&&!a.el.classList.contains("piled")&&this.openPopup(a.g,a.at,a.el)};this.zoomInTo(this.nearby(e.at),!0)?this.map.once("moveend",r):r()}nearby(e){return[e,...this.slots.filter(o=>!o.fixed&&o.at!==e&&Mn(o.at,e)<=tr).map(o=>o.at)]}zoomInTo(e,o){let s=new this.gl.LngLatBounds;for(let p of e)s.extend(p);let r=e.some(p=>e.some(u=>Mn(p,u)>tr)),a=this.map.cameraForBounds(s,{padding:50,maxZoom:r?12:Hi}),i=this.map.getZoom(),l=e.map(p=>this.map.project(p)),d=0;l.forEach((p,u)=>l.slice(u+1).forEach(w=>{let M=Math.hypot(p.x-w.x,p.y-w.y),g=i+Math.log2(zi/Math.max(M,1e-6));g<=12&&(d=Math.max(d,g))}));let c=Math.min(12,Math.max(a?.zoom??0,d));return c<=i+.05?!1:(o&&!this.before&&(this.before={center:this.map.getCenter().toArray(),zoom:i}),this.map.flyTo({center:a?.center??s.getCenter(),zoom:c,duration:800}),!0)}placeMarker(e,o,s){let r=this.data.now,a=[...e.points].sort((u,w)=>Number(w.online)-Number(u.online)||w.ts-u.ts)[0],i=s?.devices.find(u=>u.id===a.device)?.kind??"other",l=e.points.length,d=t("span",{class:"dl-mk-tile"});d.innerHTML=kt(i,"dl-mk-tile-ic")+(l>1?`${l}`:"");let c=e.online?_("now"):pe(e.ts,r),p=t("button",{type:"button",class:`dl-mk place${e.online?" online":""}`,style:e.online?null:`--dl-mk-fade:${Math.max(.4,1-.6*(r-e.ts)/(30*86400)).toFixed(2)}`,"aria-label":e.city?m(N_(l,"%s device in %s, %s","%s devices in %s, %s"),K(l),e.city,c):m(N_(l,"%s device in an unknown city, %s","%s devices in an unknown city, %s"),K(l),c)},[d,t("span",{class:"dl-mk-label below"},[e.city||e.cc||"?",t("span",{class:"dl-mk-when"},c)])]);return p.addEventListener("click",u=>{u.stopPropagation(),this.openPopup(e,o,p)}),p}deviceMarker(e,o,s,r){let a=s?.devices.find(p=>p.id===e.points[0].device)?.kind??"other",i=t("span",{class:"dl-mk-tile"}),l=t("span",{class:"dl-mk-label below"}),d=t("button",{type:"button",class:"dl-mk place step"},[i,l]);d.addEventListener("click",p=>{p.stopPropagation(),this.openPopup(e,o,d)});let c=et(e);return this.places.set(c,{el:d,tile:i,label:l,when:null,g:e,n:r,kind:a}),this.paintPlace(c,!1),d}paintPlace(e,o){let s=this.places.get(e);if(!s)return;let r=this.replaying,a=r?r.active===e:s.g.online,i=s.el.classList.contains("online"),l=s.g.city||s.g.cc||"?";s.el.classList.toggle("online",a),s.el.classList.toggle("faded",!!r&&!a),s.tile.classList.toggle("sm",!a),a||!s.n?s.tile.innerHTML=kt(s.kind,"dl-mk-tile-ic"):s.tile.textContent=String(s.n),s.when=null,a?(s.when=t("span",{class:`dl-mk-when${r?" inline":""}`},r?r.when:_("now")),s.label.replaceChildren(l,r?" · ":"",s.when)):s.label.replaceChildren(`${l} · ${s.g.online?_("now"):pe(s.g.ts,this.data.now)}`);let d=a?r?r.when:_("now"):s.g.online?_("now"):pe(s.g.ts,this.data.now);s.el.setAttribute("aria-label",`${s.n?`${s.n}: `:""}${s.g.city||_("an unknown city")}, ${d}`),o&&a&&!i&&(s.el.classList.remove("arrive"),s.el.offsetWidth,s.el.classList.add("arrive"),setTimeout(()=>s.el.classList.remove("arrive"),500))}replay(e,o=!0){let s=this.replaying;if(this.replaying=e,s&&e&&s.active===e.active){let r=e.active?this.places.get(e.active):null;r?.when&&(r.when.textContent=e.when);return}for(let r of this.places.keys())r!==e?.active&&this.paintPlace(r,o);e?.active&&this.paintPlace(e.active,o),this.declutter(),setTimeout(()=>this.declutter(),320)}hoverPlace(e){for(let[o,s]of this.places)s.el.classList.toggle("hl",o===e)}band(e,o){if(this.bandDots=[],this.map&&e&&o){let s=or(e,o),r=s.map(c=>this.map.project(c)),a=[0];for(let c=1;ca[d]?(p-a[d])/(a[d+1]-a[d]):0,w=[s[d][0]+(s[d+1][0]-s[d][0])*u,s[d][1]+(s[d+1][1]-s[d][1])*u];this.bandDots.push({type:"Feature",properties:{pos:c/l},geometry:{type:"Point",coordinates:w}})}}this.map?.getLayer("dl-band")&&(this.map.setPaintProperty("dl-band","circle-opacity",0),this.map.getSource("dl-band").setData({type:"FeatureCollection",features:this.bandDots}))}bandAt(e){this.map?.getLayer("dl-band")&&this.map.setPaintProperty("dl-band","circle-opacity",Vs(e))}focus(e){this.focused=e;for(let i of this.people)i.el.classList.toggle("dim",!!e&&i.person!==e),i.el.classList.toggle("hl",i.person===e);let o=e?["case",["==",["get","person"],e],.85,.15]:.85;for(let i of["dl-arc-live","dl-arc-recent"])this.map?.getLayer(i)&&this.map.setPaintProperty(i,"line-opacity",o);if(this.card.classList.toggle("on",!!e),!e||!this.data)return;let s=this.data,r=s.people.find(i=>i.id===e),a=yo(s,this.range).filter(i=>i.person===e).sort((i,l)=>Number(l.online)-Number(i.online)||l.ts-i.ts);dom.content(this.card,[t("div",{class:"dl-map-card-head"},[t("b",{},r?.name??e),` · ${W(a.length,"%s device","%s devices")}`]),...a.map(i=>t("div",{class:"dl-map-card-row"},[t("span",{},r?.devices.find(l=>l.id===i.device)?.name??_("Device")),t("span",{class:"dl-faint"},`${i.city||i.cc||"?"} · ${i.online?_("now"):pe(i.ts,s.now)}`)]))])}fit(e,o=!1){if(!e.length)return;let s=(p,u)=>{let w=Math.PI/180,M=(u[1]-p[1])*w,g=(u[0]-p[0])*w,h=Math.sin(M/2)**2+Math.cos(p[1]*w)*Math.cos(u[1]*w)*Math.sin(g/2)**2;return 12742*Math.asin(Math.sqrt(h))},r=[e.reduce((p,u)=>p+u[0],0)/e.length,e.reduce((p,u)=>p+u[1],0)/e.length],a=e;if(e.length>=5){let p=[...e].sort((u,w)=>s(r,u)-s(r,w));a=p.slice(0,Math.ceil(p.length*.9))}let i=new this.gl.LngLatBounds(a[0],a[0]);a.forEach(p=>i.extend(p));let l=this.el.clientHeight||380,d=!!this.data?.person,c={padding:{top:this.data?.device?Math.min(56,l/4):Math.min(60,l/5),bottom:d?Math.min(52,l/4):Math.min(40,l/8),left:48,right:48},maxZoom:this.data?.person?11:12};o?this.glide(this.map.cameraForBounds(i,c)?.zoom??null,()=>this.map.fitBounds(i,{...c,duration:1200})):this.map.fitBounds(i,{...c,duration:0})}glide(e,o){this.targetZoom=e,this.declutter(),this.map.once("moveend",()=>{this.targetZoom=null,this.declutter()}),o()}openPopup(e,o,s){let r=this.data,a=[e.city,e.cc||e.country].filter(Boolean).join(", "),i=[...new Set(e.points.map(b=>b.person))],l=i.length===1?r.people.find(b=>b.id===i[0])?.name:void 0,d=e.points.sort((b,C)=>Number(C.online)-Number(b.online)||C.ts-b.ts).map(b=>{let C=r.people.find(z=>z.id===b.person),y=C?.devices.find(z=>z.id===b.device);return t("button",{type:"button",class:"dl-pop-row",click:()=>this.cb.openDevice(b.person,b.device)},[t("span",{class:`dl-pop-dot${b.online?" on":""}`}),t("span",{class:"dl-pop-name"},[t("b",{},C?.name??b.person),` · ${y?.name??_("device")}`]),t("span",{class:"dl-faint dl-nowrap"},b.online?_("now"):pe(b.ts,r.now))])}),c=t("div",{class:"dl-pop"},[t("div",{class:"dl-pop-head"},[t("span",{class:"dl-pop-net"},v("globe")),t("div",{class:"dl-stack"},[t("strong",{},e.org||_("Unknown network")),t("span",{class:"dl-faint"},[e.asn?`AS${e.asn} · `:"",a?`${a} · ${_("approximate")}`:_("approximate location")])])]),t("div",{class:"dl-pop-list"},d),i.length===1?t("div",{class:"dl-pop-actions"},[t("button",{type:"button",class:"cbi-button cbi-button-positive important",click:()=>this.cb.openPerson(i[0])},l?m(_("Open %s"),l):_("Open person"))]):""]);this.zoomInTo(this.nearby(o),!0),this.dropCard();let p=t("div",{class:"dl-root dl-popcard",role:"dialog"},[t("span",{class:"dl-popcard-tip"}),c]);document.body.appendChild(p);let u=this.el,w=s?.querySelector(".dl-mk-av, .dl-mk-tile")??s??null,M=()=>{if(!w)return;let b=w.getBoundingClientRect(),C=u.getBoundingClientRect(),y=b.left+b.width/2,z=b.top+b.height/2;p.classList.toggle("away",yC.right||zC.bottom);let k=p.offsetWidth,f=p.offsetHeight,x=b.top-f-12>=8||b.top>window.innerHeight-b.bottom,T=Math.min(Math.max(8,y-k/2),window.innerWidth-k-8);p.classList.toggle("above",x),p.classList.toggle("below",!x),p.style.left=`${T}px`,p.style.top=`${x?b.top-f-12:b.bottom+12}px`,p.style.setProperty("--tip-x",`${y-T}px`)},g=b=>{b.target?.closest(".dl-popcard, .maplibregl-marker")||this.closePopup(!0)},h=b=>{b.key==="Escape"&&this.closePopup()},E=b=>{b.target instanceof Element&&b.target.closest(".dl-popcard")||this.closePopup()},H=()=>this.closePopup();this.map.on("move",M),window.addEventListener("scroll",E,{capture:!0,passive:!0}),window.addEventListener("resize",M),document.addEventListener("pointerdown",g,!0),document.addEventListener("keydown",h);let S=Te(H);window.addEventListener("pagehide",H),this.popup={card:p,off:()=>{this.map?.off("move",M),window.removeEventListener("scroll",E,!0),window.removeEventListener("resize",M),document.removeEventListener("pointerdown",g,!0),document.removeEventListener("keydown",h),S(),window.removeEventListener("pagehide",H)}};let $=window.setInterval(()=>{if(this.popup?.card!==p)return clearInterval($);(!u.isConnected||!u.getClientRects().length)&&this.dropCard()},400);M()}};function Bi(n,e=6){let o=n.map(s=>({x:s.x,y:s.y}));for(let s=0;s<16;s++){let r=!1;for(let a=0;a[s.x-n[r].x,s.y-n[r].y])}function Oi(n,e){let o=new Map,s=e?[[e.lon,e.lat]]:[],r=a=>s.some(i=>Mn(a,i)<1.3);for(let a of[...n].sort((i,l)=>i.key>>12)/1048575),d=(i&4095)/4096*2*Math.PI,c=[a.lon,a.lat];for(let p=0;p<24;p++){let u=d+p*2.39996,w=Math.min(8,l+p*.25);if(c=[a.lon+w*Math.sin(u)/(111.32*Math.cos(a.lat*Math.PI/180)),a.lat+w*Math.cos(u)/111.32],!r(c))break}s.push(c),o.set(a.key,c)}return o}function ji(n){let e=2166136261;for(let o=0;o>>0}function sr(n){return{key:n.el.dataset.key??"",who:n.who??_("Someone"),where:n.where??"",online:!!n.g?.online,at:n.at,badge:n.el.querySelector(".dl-mk-badge")?.innerHTML??"",g:n.g}}function rr(n,e,o,s=!1){let r=e.length>3,a=()=>[...n.children].filter(g=>!g.classList.contains("out")),i=new Map(a().map(g=>[g,g.getBoundingClientRect().left])),l=n.getBoundingClientRect().width,d=new Map;n.querySelectorAll(".dl-mk-face:not(.out)").forEach(g=>d.set(g.dataset.key??"",g));let c=n.querySelector(".dl-mk-more:not(.out)"),p=g=>{Object.assign(g.style,{position:"absolute",left:`${g.offsetLeft}px`,top:`${g.offsetTop}px`,transform:""}),g.classList.add("out"),setTimeout(()=>g.remove(),200)},u=[];for(let g of e.slice(0,r?2:3)){let h=d.get(g.key);if(d.delete(g.key),!h){let S=t("button",{type:"button",class:`dl-mk-face${s?"":" in"}`,"data-key":g.key},[t("span",{class:"dl-mk-av"},je(g.who)),t("span",{class:"dl-mk-badge"})]);S.addEventListener("animationend",()=>S.classList.remove("in"),{once:!0}),h=S}let E=h,H=E.querySelector(".dl-mk-badge");H.innerHTML!==g.badge&&(H.innerHTML=g.badge),E.title=`${g.who} · ${g.where}`,E.setAttribute("aria-label",`${g.who}, ${g.where}`),E.classList.toggle("on",g.online),E.onclick=S=>{S.stopPropagation(),o.click(g,E)},E.onmouseenter=()=>o.hover(g),E.onmouseleave=()=>o.hover(null),u.push(E)}for(let g of d.values())p(g);if(r){if(!c){c=t("span",{class:`dl-mk-more${s?"":" in"}`});let g=c;g.addEventListener("animationend",()=>g.classList.remove("in"),{once:!0})}c.textContent=`+${e.length-2}`,u.push(c)}else c&&p(c);let w=null;for(let g of u)(w?w.nextElementSibling:n.firstElementChild)!==g&&(w?w.after(g):n.prepend(g)),w=g;for(let g of u){let h=i.get(g);if(h==null)continue;let E=h-g.getBoundingClientRect().left;Math.abs(E)<.5||(g.style.transition="none",g.style.transform=`translateX(${E}px)`,g.offsetWidth,g.style.transition="",g.style.transform="")}n.style.width="";let M=n.getBoundingClientRect().width;if(l&&Math.abs(M-l)>.5){n.style.width=`${l}px`,n.offsetWidth,n.style.width=`${M}px`;let g=()=>{n.style.width="",n.removeEventListener("transitionend",g)};n.addEventListener("transitionend",g),setTimeout(g,400)}}function Mn(n,e){let o=Math.PI/180,s=Math.sin((e[1]-n[1])*o/2)**2+Math.cos(n[1]*o)*Math.cos(e[1]*o)*Math.sin((e[0]-n[0])*o/2)**2;return 12742*Math.asin(Math.min(1,Math.sqrt(s)))}function Ui(n,e,o){let s=n.querySelector(":scope > .dl-mk-ptr"),r=Math.hypot(e,o);if(r<1){s?.remove();return}s||(s=t("span",{class:"dl-mk-ptr"},[t("i",{class:"line"}),t("i",{class:"spot"})]),n.prepend(s));let a=s.firstElementChild,i=s.lastElementChild;a.style.width=`${r}px`,a.style.transform=`rotate(${Math.atan2(-o,-e)}rad)`,i.style.transform=`translate(${-e}px, ${-o}px)`}function Rt(n,e,o=!0){let s=[["online",_("Online now")],["24h",_("24h")],["7d",_("7 days")],["30d",_("30 days")]],r=t("div",{class:"dl-seg",role:"tablist"});for(let[a,i]of s)a==="online"&&!o||r.appendChild(t("button",{type:"button",role:"tab",class:a===n?"on":"","data-v":a,click:()=>{r.querySelectorAll("button").forEach(l=>l.classList.toggle("on",l.dataset.v===a)),e(a)}},i));return r}var ar={"24h":86400,"7d":7*86400,"30d":30*86400},_o=(n,e)=>`${(n/e*100).toFixed(3)}%`,En=class{constructor(e,o,s){this.map=e;this.range=o;this.el=t("div",{class:"dl-dplaces"});this.controls=t("div",{class:"dl-map-replay"});this.pending=null;this.rows=new Map;this.st=[];this.steps=[];this.total=0;this.ms=0;this.stepI=-1;this.on=!1;this.playing=!1;this.raf=0;this.last=0;this.endTimer=0;this.play=t("button",{type:"button",class:"dl-map-btn"});this.chip=t("span",{class:"dl-map-chip"});this.stop=t("button",{type:"button",class:"dl-map-btn",title:_("Back to now"),"aria-label":_("Back to now")},v("x"));this.reduced=window.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1;this.data=s,this.play.addEventListener("click",()=>this.toggle()),this.stop.addEventListener("click",()=>this.end()),this.paint()}mapData(){let e=this.data;return{geo:e.geo,people:[e.person],now:e.now,person:e.person.id,device:e.device.id}}update(e){let o={...this.pending??this.data,...e};if(this.on){this.pending=o;return}this.data=o,this.map.update(this.mapData()),this.paint()}setRange(e){this.end(),this.range=e,this.map.setRange(e),this.paint()}destroy(){cancelAnimationFrame(this.raf),clearTimeout(this.endTimer)}paint(){let e=this.data,o=ar[this.range],s=e.now-o,r=Os(Bs(e.events??[],e.device.id,e.now,e.device.online,e.device.handshake),e.geo.points,e.device.id,s),a=js(r);this.st=Us(r);let i=ko(this.mapData(),this.range),l=r.length>0;this.el.classList.toggle("strips",l),this.el.classList.toggle("can-replay",this.st.length>1),this.rows.clear(),dom.content(this.el,i.length?[...i.map(d=>{let c=et(d),p=a.get(c),u=l?t("div",{class:`dl-dplace-strip${d.online?" live":""}`},r.filter(M=>M.key===c).map(M=>t("i",{style:`left:${_o(M.from-s,o)};width:${_o(M.to-M.from,o)}`}))):"",w=t("div",{class:"dl-dplace-row"},[t("span",{class:`dl-dplace-n${d.online?" live":""}`},d.online?v(e.device.kind):String(d.n)),t("span",{class:"dl-row-main dl-stack"},[t("span",{},[d.city||d.cc||_("Unknown city"),d.org?t("span",{class:"dl-muted"},` · ${d.org}`):""]),t("span",{class:"dl-faint"},[t("span",{class:"dl-mono"},d.ip),p!=null?` · ${m(_("%s%% of the time"),p>0&&p<.005?"<1":Math.round(p*100))}`:""])]),t("span",{class:d.online?"dl-dplace-now":"dl-faint dl-nowrap"},d.online?_("now"):pe(d.ts,e.now)),u]);if(w.addEventListener("mouseenter",()=>this.map.hoverPlace(c)),w.addEventListener("mouseleave",()=>this.map.hoverPlace(null)),u){let M=g=>{let h=u.getBoundingClientRect();this.seek(s+o*Math.min(1,Math.max(0,(g.clientX-h.left)/h.width)))};u.addEventListener("pointerdown",g=>{u.setPointerCapture(g.pointerId),M(g)}),u.addEventListener("pointermove",g=>g.buttons&&M(g))}return this.rows.set(c,w),w}),l?t("div",{class:"dl-dplace-axis"},Js(this.range,e.now).map(([d,c])=>t("span",{style:`left:${(d*100).toFixed(2)}%`},c))):""]:t("div",{class:"dl-sub"},_("No locations in this period."))),this.paintControls()}paintControls(){dom.content(this.play,v(this.playing?"pause":"play")),this.play.title=this.playing?_("Pause","replay"):_("Replay this period"),this.play.setAttribute("aria-label",this.play.title),dom.content(this.controls,this.on?[this.play,this.chip,this.stop]:this.st.length>1?[this.play]:[])}begin(){this.on=!0,{steps:this.steps,total:this.total}=Gs(this.st,this.reduced?400:bo),this.ms=0,this.stepI=-1,this.map.replay({active:null,when:""},!0)}toggle(){if(this.playing){this.playing=!1,cancelAnimationFrame(this.raf),this.paintControls();return}clearTimeout(this.endTimer),(!this.on||this.ms>=this.total)&&this.begin(),this.playing=!0,this.last=performance.now(),this.paintControls(),this.raf=requestAnimationFrame(e=>this.frame(e))}frame(e){if(this.playing){if(this.ms=Math.min(this.total,this.ms+(e-this.last)),this.last=e,this.show(!0),this.msthis.frame(o));return}this.playing=!1,this.paintControls(),this.endTimer=window.setTimeout(()=>this.end(),1500)}}seek(e){this.st.length<2||(clearTimeout(this.endTimer),this.on||this.begin(),this.ms=Fs(this.st,this.steps,e),this.stepI=-1,this.show(!1),this.paintControls())}show(e){let o=qs(this.st,this.steps,this.ms),s=this.st[o.step.k];if(o.step.kind==="move"){let i=this.st[o.step.k-1];o.i!==this.stepI&&(this.map.replay({active:null,when:""},e),this.map.band([i.point.lon,i.point.lat],[s.point.lon,s.point.lat]));let l=Ks(o.q);this.reduced||this.map.bandAt(l),(this.reduced?o.q>=.5:Ys(l))&&this.map.replay({active:s.key,when:Cn(o.t)},e)}else o.i!==this.stepI&&this.map.band(),this.map.replay({active:s.key,when:Cn(o.t)},e);this.stepI=o.i;let r=this.data,a=r.now-ar[this.range];this.el.classList.add("replay"),this.el.style.setProperty("--at",_o(o.t-a,r.now-a));for(let[i,l]of this.rows)l.classList.toggle("cur",i===s.key);this.chip.textContent=`${Zs(o.t,r.now)}, ${Cn(o.t)} · ${s.point.city||s.point.cc||"?"}`}end(){if(cancelAnimationFrame(this.raf),clearTimeout(this.endTimer),!!this.on){this.on=!1,this.playing=!1,this.ms=0,this.stepI=-1,this.map.band(),this.map.replay(null,!1),this.el.classList.remove("replay");for(let e of this.rows.values())e.classList.remove("cur");this.pending?(this.data=this.pending,this.pending=null,this.map.update(this.mapData()),this.paint()):this.paintControls()}}};function It(n){return`${L.url("admin/network/dawnline/server")}?${n?`server=${encodeURIComponent(n)}&`:""}section=people`}function Re(n,e){return`${L.url("admin/network/dawnline/person")}?id=${encodeURIComponent(n)}${e?`&device=${encodeURIComponent(e)}`:""}`}function Wi(n){return n?new Date(n*1e3).toLocaleString(le(),{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"}):"—"}function Co(n,e,o=!1){return t("div",{class:"dl-kvrow"},[t("span",{class:"dl-kvrow-k"},n),t("button",{type:"button",class:`dl-kvrow-v copy${o?" dl-mono":""}`,title:_("Copy"),click:()=>xe(e,m(_("%s copied"),n))},[t("span",{},e),v("copy")])])}function Tn(n,e){return t("div",{class:"dl-kvrow"},[t("span",{class:"dl-kvrow-k"},n),t("span",{class:"dl-kvrow-v"},e)])}var ir={connect:["ok","plug"],disconnect:["","plug"],roam:["","network"],device_added:["ok","plus"],device_removed:["","trash"],device_keys:["","reset"]};function Gi(n){let e=s=>t("span",{class:"dl-muted"},s),o=Ve(n)==="portal"?_("on the portal"):Ve(n)==="admin"?_("by you"):"";switch(n.type){case"connect":return[...n.detail?ae(_("Connected from %s"),e(n.detail)):[_("Connected")],n.where?e(` · ${n.where}`):""];case"disconnect":return[_("Went offline")];case"roam":return[_("Changed network"),e(` · ${n.detail??""}`)];case"device_added":return o?ae(_("Added %s"),e(o)):[_("Added")];case"device_removed":return o?ae(_("Removed %s"),e(o)):[_("Removed")];default:return o?ae(_("New keys %s"),e(o)):[_("New keys")]}}function qi(n,e,o){let s=n.filter(r=>r.device===e&&ir[r.type]).reverse().slice(0,12);return s.length?t("div",{class:"dl-dev-log"},s.map(r=>{let[a,i]=ir[r.type],l=new Date(r.ts*1e3);return t("div",{class:`dl-dev-log-row${Ve(r)==="admin"?" dl-ev-by-admin":""}`},[Ve(r)==="admin"?t("span",{class:"dl-ev-tile",title:_("Done by you in LuCI")},v("admin")):t("span",{class:`dl-ev-tile ev ${a}`},v(i)),t("span",{class:"dl-row-main"},Gi(r)),t("span",{class:"dl-faint dl-nowrap",title:l.toLocaleString(le())},pe(r.ts,o))])})):t("div",{class:"dl-sub"},_("No activity yet."))}async function lr(n,e,o){let s=await N.status(1).catch(()=>null),r=s?.people.find(i=>i.id===n),a=r?.devices.find(i=>i.id===e);s&&r&&a&&Je(r,a,{...o,geo:s.geo,now:s.now,today:Ge(s.series),core:zt(s.servers,r.server)})}async function Je(n,e,o){let s=await F(()=>N.deviceConfig(e.id));if(!s)return;let r=o.core??qe(null),a=e,i=n,l=o.geo,d=o.now,c=o.today??Ke(new Date),p=await r.connectBlock(s,e.kind==="phone"||e.kind==="tablet"?"qr":"file"),u=t("div",{class:"dl-drawer-title"}),w=t("div",{}),M=t("div",{}),g=t("div",{},t("div",{class:"dl-sub"},_("Loading…"))),h=[],E=oe=>{h=oe.filter(j=>j.device===a.id),dom.content(g,qi(oe,a.id,d)),b?.update({events:oe})},H=async(oe=!1)=>{let j=o.events?.();if(j&&!oe)return E(j);let Y=await N.events(2e3,n.id).catch(()=>null);Y&&E(Y.events)},S="30d",$=null,b=null,C=()=>{dom.content(u,[t("span",{class:`dl-dcard-ic${a.online?" on":""}`},v(a.kind)),t("div",{class:"dl-stack"},[t("div",{class:"dl-title-row"},[t("h3",{},a.name),A([v("edit")],()=>k(),"neutral",{title:_("Rename"),class:"cbi-button cbi-button-neutral dl-icon-only sm"})]),t("span",{class:"dl-sub"},`${i.name} · ${at(a.kind)}`)])]);let oe=a.spark.map(([Y,ie])=>Y+ie),j=oe.reduce((Y,ie)=>Y+ie,0);dom.content(w,t("div",{class:"dl-dstats"},[t("div",{class:"dl-dstats-cell wide"},[t("span",{class:"dl-metric-label"},_("Status")),dn(a,d,_("Waiting for the first connection"),i)]),t("div",{class:"dl-dstats-cell"},[t("span",{class:"dl-metric-label"},_("This month")),t("b",{},se(a.month[0]+a.month[1])),t("span",{class:"dl-sub dl-mono"},`↓ ${se(a.month[1])} ↑ ${se(a.month[0])}`)]),t("div",{class:"dl-dstats-cell"},[t("span",{class:"dl-metric-label"},_("Last 7 days")),t("b",{},se(j)),Es(oe,120,22,c)])])),dom.content(M,t("div",{class:"dl-kv2"},[Co(_("Tunnel address"),a.address),a.hostname&&i.access!=="internet"?Co(_("Local address"),a.hostname):"",a.endpoint&&!l?.points.some(Y=>Y.device===a.id&&Y.ip===a.endpoint)?Tn(_("Client IP"),a.endpoint):"",Tn(_("Total"),t("span",{class:"dl-kv-act"},[`↓ ${se(a.total[1])} · ↑ ${se(a.total[0])}`,t("button",{type:"button",class:"dl-linkbtn danger",click:()=>Ht("device",a.id,a.name,()=>setTimeout(z,300))},_("Reset"))])),Tn(_("Added"),`${Wi(a.created)} · ${a.created_by==="portal"?_("from the portal"):_("by you")}`),s.amnezia.client_pub_key?Co(_("Public key"),s.amnezia.client_pub_key):Tn(_("Public key"),"—")])),dom.content(f,[A([v(a.disabled?"play":"pause")," ",a.disabled?_("Enable"):_("Disable")],async()=>{await F(()=>N.deviceUpdate(a.id,void 0,!a.disabled),a.disabled?_("Device enabled"):_("Device disabled"))&&await z()},"neutral",a.disabled?{}:{class:"cbi-button cbi-button-neutral dl-btn-warn"}),A([v("key")," ",_("New keys")],async()=>{if(!await me(_("Generate new keys?"),_("The current configuration on this device stops working until it is imported again."),_("Generate"),!0))return;await F(()=>N.deviceRotate(a.id),_("New keys generated"))&&(o.refresh(),fe.close(),await lr(i.id,a.id,o))}),t("span",{class:"dl-spacer"}),A([v("trash")," ",_("Remove")],async()=>{await me(m(_("Remove %s?"),a.name),_("The device is disconnected immediately and its configuration stops working."),_("Remove"),!0)&&await F(()=>N.deviceDelete(a.id),_("Device removed"))&&(fe.close(),o.refresh())},"negative")])},y=async()=>{let oe=await N.status(1).catch(()=>null),j=oe?.people.find(ie=>ie.id===i.id),Y=j?.devices.find(ie=>ie.id===a.id);!oe||!j||!Y||(i=j,a=Y,l=oe.geo,d=oe.now,c=Ge(oe.series),C(),b?.update({geo:oe.geo,now:oe.now,person:i,device:a}))},z=async()=>{await y(),o.refresh()},k=()=>{let oe=t("input",{type:"text",class:"cbi-input-text",value:a.name,maxlength:48}),j=i.devices.filter(ie=>ie.id!==a.id).map(ie=>ie.name),Y=Ee(_("Name"),oe,()=>He(oe.value,j,_("Shown in the portal and in the app.")));de(m(_("Rename %s"),a.name),[Y],[ue()," ",A(_("Save"),async()=>{let ie=Y.help();if(ie.bad){q(ie.text,"warning");return}await F(()=>N.deviceUpdate(a.id,oe.value,void 0),_("Renamed"))&&(ce(),await z())},"positive")]),setTimeout(()=>oe.select(),50)},f=t("div",{class:"dl-drawer-actions"}),x=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},_("Connect","section"))]),a.config_stale?t("div",{class:"dl-note warn"},[v("alert"),t("span",{},_("This device has an older configuration: networks or DNS changed since it was set up. Import it again with the QR code, key or file below."))]):"",p]),T=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},_("Activity")),t("div",{class:"dl-dsec-actions"},[t("button",{type:"button",class:"dl-linkbtn",click:()=>Qe({people:[i]},h,"csv",a.id)},_("Export")),t("button",{type:"button",class:"dl-linkbtn danger",click:()=>lt(m(_("Clear %s's activity"),a.name),m(_("Removes events about %s."),a.name),{device:a.id},()=>{H(!0),o.refresh()})},_("Clear")),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},_("All activity"))])]),g]),I=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},t("h4",{},_("Details","section"))),M]),V="";if(l?.enabled){$=new dt({openPerson:j=>location.href=Re(j),openDevice:(j,Y)=>location.href=Re(j,Y)},S,220);let oe=b=new En($,S,{geo:l,now:d??Date.now()/1e3,person:i,device:a,events:o.events?.()??null});V=t("section",{class:"dl-dsec"},[t("div",{class:"dl-dsec-head"},[t("h4",{},_("Locations")),Rt(S,j=>{S=j,oe.setRange(j)},!1)]),t("div",{class:"dl-dmap"},[$.el,oe.controls]),oe.el])}let J=!a.handshake||a.config_stale,te=t("div",{class:"dl-stack gap16"},J?[w,x,I,V,T]:[w,I,V,T,x]);H();let B=()=>{y(),H()},Q=_n(B),ne=window.setInterval(B,3e4),fe=Xo(u,te,f,()=>{clearInterval(ne),Q(),b?.destroy(),$?.destroy()});C(),$&&b&&requestAnimationFrame(()=>b&&$?.mount(b.mapData()))}function dr(n,e,o,s){let r=s.core??qe(null),a=()=>F(()=>N.deviceConfig(o.id)),i=[{label:_("Show QR code"),icon:v("qr"),run:async()=>{let l=await a();l&&de(`${o.name} · ${_("QR code")}`,t("div",{class:"dl-qr-pane"},[un(r.qrText(l)),t("span",{class:"dl-sub"},ho(l)?_("Scan with AmneziaVPN or any WireGuard app on the device."):_("Scan with AmneziaVPN or AmneziaWG on the device."))]),ue(_("Close")))}},{label:r.file.label,icon:v("download"),run:async()=>{let l=await a();if(!l)return;let d=r.file.make(l);Ne(d.name,d.text,"application/octet-stream")}},r.appKey?{label:r.appKey.label,icon:v("copy"),run:async()=>{let l=await a();l&&xe(await r.appKey.make(l),_("Key copied"))}}:null,null,{label:_("Rename"),icon:v("edit"),run:()=>Je(e,o,s)},{label:_("New keys"),icon:v("key"),run:async()=>{await me(_("Generate new keys?"),_("The current configuration on this device stops working until it is imported again."),_("Generate"),!0)&&await F(()=>N.deviceRotate(o.id),_("New keys generated"))&&s.refresh()}},{label:o.disabled?_("Enable"):_("Disable"),icon:v(o.disabled?"play":"pause"),warn:!o.disabled,run:async()=>{await F(()=>N.deviceUpdate(o.id,void 0,!o.disabled),o.disabled?_("Device enabled"):_("Device disabled"))&&s.refresh()}},{label:_("Delete"),icon:v("trash"),danger:!0,run:async()=>{await me(m(_("Remove %s?"),o.name),_("The device is disconnected immediately and its configuration stops working."),_("Remove"),!0)&&await F(()=>N.deviceDelete(o.id),_("Device removed"))&&s.refresh()}}];Se(n,i)}function ct(n,e){let o=n.devices.map(c=>c.name),s=c=>{let p=at(c),u=1,w=p;for(;o.some(M=>M.toLowerCase()===w.toLowerCase());)w=`${p} ${++u}`;return w},r="phone",a=t("input",{type:"text",class:"cbi-input-text",placeholder:s(r),maxlength:48}),i=Ee(_("Name"),a,()=>a.value.trim()?He(a.value,o,_("Shown in the portal and in the app.")):{text:m(_("Named after its type: %s."),s(r)),bad:!1}),l=t("div",{class:"dl-kinds",role:"radiogroup","aria-label":_("Type")},Vo.map(c=>t("button",{type:"button",role:"radio",class:c===r?"on":"","aria-checked":c===r?"true":"false","data-kind":c,click:()=>{r=c,l.querySelectorAll("button").forEach(p=>{let u=p.dataset.kind===c;p.classList.toggle("on",u),p.setAttribute("aria-checked",u?"true":"false")}),a.placeholder=s(c),i.refresh()}},[v(c),t("span",{},at(c))]))),d=n.devices.length>=n.device_limit;de(m(_("Add a device for %s"),n.name),[d?t("p",{class:"dl-hint"},m(N_(n.device_limit,"%s already has %s of %s device. As admin you can still add one.","%s already has %s of %s devices. As admin you can still add one."),n.name,K(n.devices.length),K(n.device_limit))):"",t("div",{class:"dl-fld"},[t("span",{class:"dl-fld-label"},_("Type")),l]),i],[ue()," ",A(_("Add device"),async()=>{let c=i.help();if(c.bad){q(c.text,"warning");return}let p=a.value.trim()||s(r),u=await F(()=>N.deviceCreate(n.id,p,r));u&&(ce(),q(m(_("%s added"),p),"success",3e3),e.refresh(),await lr(n.id,u.id,e))},"positive")]),setTimeout(()=>a.focus(),50)}var tt=1080,Qt=1512,Ze=96,Fi="-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",Ki="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace",Zt=n=>n.replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e]);function Yi(n,e,o){let s=new URL(o),r=s.pathname.slice(1),a=m(_("Hi, %s"),n.name),i=Math.min(92,Math.floor((tt-2*Ze)/(.58*a.length))),l=tt-2*Ze,d=392,c=40,p=pn(o,2).replace("`${E}`;return``+u(Ze+82,Ze+42,36,"#a3a3a3",Zt(e))+u(Ze,276,i,"#ffffff",Zt(a),'font-weight="600"')+u(Ze,340,40,"#8a8a8a",Zt(m(_("Scan to connect to %s"),e)))+``+p+`${Zt(r)}`+u(tt/2,d+l+156,34,"#737373",Zt(s.host),'text-anchor="middle"')+""}async function Vi(n){let e=new Image;e.src=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(n)}`,await e.decode();let o=document.createElement("canvas");return o.width=tt,o.height=Qt,o.getContext("2d").drawImage(e,0,0,tt,Qt),new Promise((s,r)=>o.toBlob(a=>a?s(a):r(new Error(_("Could not draw the card"))),"image/png"))}async function cr(n){let e=await F(()=>N.personLinks(n));return e?e.link?{link:e.link,links:e.links??[]}:(q(_("The personal portal is off. Turn it on in Settings."),"warning"),null):null}async function Sn(n){let e=await cr(n);e&&await xe(e.link,_("Personal link copied"))}async function Xt(n,e,o={}){let s=n.link,r=n.links;if(s===void 0){let h=await cr(n.id);if(!h)return;s=h.link,r=h.links}if(!s){q(_("The personal portal is off. Turn it on in Settings."),"warning");return}let a=s,i=await F(()=>Vi(Yi(n,e,a)));if(!i)return;let l=new File([i],`${n.id}-invite.png`,{type:"image/png"}),d=URL.createObjectURL(i),c=navigator,p=!!c.canShare?.({files:[l]}),u=!p&&typeof c.share=="function"&&(c.canShare?.({url:a})??!0),w=()=>{URL.revokeObjectURL(d),ce()},M=async h=>{try{await c.share(h)}catch{}},g=p?A([v("link")," ",_("Share card")],()=>M({files:[l],title:m(_("Invite %s"),n.name)}),"positive"):u?A([v("link")," ",_("Share link")],()=>M({url:a,title:m(_("Invite %s"),n.name),text:_("Your personal VPN link")}),"positive"):A([v("download")," ",_("Download card")],()=>Ne(l.name,i),"positive");de(o.title??m(_("Invite %s"),n.name),t("div",{class:"dl-invite"},[t("img",{src:d,alt:m(_("Invite card for %s"),n.name)}),t("div",{class:"dl-invite-side"},[t("p",{class:"dl-muted"},o.lead??m(_("Send %s the card or the link. They open it, add their devices and connect - no account needed."),n.name)),t("button",{type:"button",class:"dl-invite-link",title:_("Copy link"),click:()=>xe(a,_("Personal link copied"))},[t("span",{},a.replace(/^https:\/\//,"")),v("copy")]),...(r??[]).filter(h=>h!==a).map(h=>t("button",{type:"button",class:"dl-invite-link alt",title:_("Copy this link"),click:()=>xe(h,_("Link copied"))},[t("span",{},h.replace(/^https?:\/\//,"")),t("span",{class:`dl-pill ${h.startsWith("http:")?"warn":""}`},h.startsWith("http:")?"HTTP":_("Also")),v("copy")])),t("ol",{class:"dl-invite-steps"},[t("li",{},ae(_("Install %s on the device"),t("b",{},"AmneziaVPN"))),t("li",{},_("Open the link or scan the code")),t("li",{},_("Add the device and connect"))]),t("div",{class:"dl-invite-actions"},[g,A([v("copy")," ",_("Copy link")],()=>xe(a,_("Personal link copied")))])])]),[t("button",{class:"cbi-button cbi-button-neutral",click:w},_("Done"))],"wide")}function en(n,e){let o=n.servers.find(d=>d.id===e)??n.servers[0],s=n.people.filter(d=>d.server===o.id),r=new Set(s.map(d=>d.id)),a=s.flatMap(d=>d.devices),i=d=>s.reduce((c,p)=>{let u=d(p);return[c[0]+u[0],c[1]+u[1]]},[0,0]),l=o.series?.[o.series.length-1];return{...n,servers:[o],people:s,series:o.series??n.series,events:n.events.filter(d=>d.person?r.has(d.person):!0),geo:{...n.geo,points:n.geo.points.filter(d=>r.has(d.person))},totals:{people:s.length,devices:a.length,online:a.filter(d=>d.online).length,active:s.filter(d=>d.state==="active").length,today:l?[l.rx,l.tx]:[0,0],month:i(d=>d.month)}}}var pr=3,Lo=class{constructor(){this.n=0;this.shown=0}next(){return++this.n}take(e){return e{let w=e.next(),M=null;try{M=await n.fetch(u),o>=pr&&q(_("The router answers again."),"success",3e3),o=0}catch{return++o===pr&&q(_("The router is not answering: what you see may be out of date."),"warning",8e3),null}return M==null||!e.take(w)?null:(n.apply(M,p),M)},r=(p=!1)=>s(p,!1),a=()=>document.visibilityState==="visible",i=()=>a()&&(n.active?.()??!0)?s(!0,!1):Promise.resolve(null);poll.add(i,n.every);let l=n.live?_n(()=>void(a()&&(n.active?.()??!0)&&s(!0,!0))):null,d=()=>{poll.remove(i),l?.(),c()},c=Te(d);return{refresh:r,claim:()=>e.claim(),stop:d}}function Bt(n){let e=document.activeElement;return!!n&&!!e&&e!==document.body&&n.contains(e)}function Ae(n,e,o=!1){return o&&Bt(n)?!1:(dom.content(n,e),!0)}function ur(n,e){let o=n,s=[{v:"internet",ic:"globe",text:_("Browse the internet through your router. No access to devices at home.")},{v:"lan",ic:"home",text:_("Reach devices at home (NAS, printer, cameras). Internet stays on their own connection.")},{v:"both",ic:"shield",text:_("Home devices and the internet, all through your router.")}],r=t("div",{class:"dl-choices"},s.map(a=>t("button",{type:"button",class:`dl-choice${a.v===o?" selected":""}`,"data-v":a.v,click:()=>{o=a.v,r.querySelectorAll(".dl-choice").forEach(i=>i.classList.toggle("selected",i.dataset.v===a.v)),e?.(a.v)}},[t("span",{class:"dl-choice-title"},[v(a.ic),vt(a.v)]),t("span",{class:"dl-choice-text"},a.text)])));return{el:r,get:()=>o}}function Mo(n){try{return localStorage.getItem(n)}catch{return null}}function Eo(n,e){try{localStorage.setItem(n,e)}catch{}}function Ji(n){let e=n.devices.length,o=Math.max(1,n.device_limit,e),s=Math.min(160,o*22+(o-1)*3);return t("div",{class:"dl-slotbar",title:m(N_(n.device_limit,"%s of %s device","%s of %s devices"),e,n.device_limit)},[t("span",{class:"dl-slotbar-segs",style:`width: ${s}px`},Array.from({length:o},(r,a)=>t("i",{class:a>=n.device_limit?"over":an.state==="server_off"?n.paused:!["active","quota","expired"].includes(n.state),To=n=>n.state==="server_off"?n.paused:n.state!=="active",hr=n=>To(n)?n.state==="server_off"?"paused":n.state:null;function Zi(n,e){let o=st(n.expires,e);return n.state==="quota"||n.state==="expired"||rt(n,o)||!!n.quota_limit&&n.quota_used>=n.quota_limit*.9}function fr(n,e){return Lt(n&&no(n,e)>=0?n:e,1)}var gr=n=>n.people.map(e=>e.id).sort().join(" "),vr=!1,wt=class{constructor(){this.list=t("div",{class:"dl-plist",role:"list"});this.filter=["all","online","attention","paused"].find(e=>e===(new URLSearchParams(location.search).get("filter")??Mo("dl.people.filter")))??"all";this.sort=["seen","name","usage"].find(e=>e===Mo("dl.people.sort"))??"seen";this.query="";this.noFooter=!0;this.serverId=null;this.el=null}async load(){return N.status(30)}scope(e){return this.serverId?en(e,this.serverId):e}embed(e,o){return this.serverId=o,this.render(e)}person(e){return this.st.people.find(o=>o.id===e)}get today(){return Ge(this.st.series)}deviceOpts(e){return{refresh:()=>this.refresh(),geo:this.st.geo,now:this.st.now,today:this.today,core:zt(this.st.servers,e.server)}}take(e,o){let s=this.scope(e),r=gr(s)!==gr(this.st);this.st=s,r?this.rebuild():(this.paintCards(o),this.decorate(o))}async update(){await this.poller?.refresh()}async refresh(){this.poller?.claim();let e=await N.status(30).catch(()=>null);e&&(this.st=this.scope(e),this.rebuild())}rebuild(){let e=new Map;for(let s of Array.from(this.list.children))s.dataset.sid&&e.set(s.dataset.sid,s);let o=this.st.people.map(s=>{let r=e.get(s.id)??t("div",{class:"dl-card",role:"listitem","data-sid":s.id});return this.renderCard(r,s.id)});dom.content(this.list,o.length?o:t("div",{class:"dl-plist-none"},this.st.servers.length?_("No people yet. Add someone and send them their personal link."):_("Set up the server first, then add people."))),this.decorate()}paintCards(e=!1){for(let o of this.st.people){let s=this.card(o.id);s&&!(e&&Bt(s))&&this.renderCard(s,o.id)}}card(e){return this.list.querySelector(`[data-sid="${CSS.escape(e)}"]`)}render(e){let o=this.scope(e);this.st=o;let s=this,r=t("select",{class:"dl-select","aria-label":_("Sort"),change:d=>{s.sort=d.target.value,Eo("dl.people.sort",s.sort),s.decorate()}},[t("option",{value:"seen",selected:s.sort==="seen"?"selected":null},_("Last seen","sort")),t("option",{value:"name",selected:s.sort==="name"?"selected":null},_("Name","sort")),t("option",{value:"usage",selected:s.sort==="usage"?"selected":null},_("Usage","sort"))]),a=t("input",{type:"search",class:"cbi-input-text dl-people-find",placeholder:_("Find…"),"aria-label":_("Find a person or device"),hidden:o.people.length>8?null:"hidden",input:d=>{s.query=d.target.value.trim().toLowerCase(),s.decorate()}}),i=d=>{let c=d.target;d.key==="/"&&!a.hidden&&!["INPUT","TEXTAREA","SELECT"].includes(c?.tagName)&&!c?.isContentEditable&&(d.preventDefault(),a.focus())};document.addEventListener("keydown",i),Te(()=>document.removeEventListener("keydown",i));let l=t("div",{class:"dl-root"},[s.serverId?"":t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},_("People")),t("span",{class:"dl-muted dl-people-count"},this.countText())]),o.servers.length?A([v("plus"),` ${_("Add person")}`],()=>s.openCreate(),"add"):""]),o.servers.length?"":t("div",{class:"alert-message warning"},ae(_("No server yet. %s before adding people."),t("a",{href:L.url("admin/network/dawnline/server")},_("Run the setup wizard")))),t("div",{class:"dl-toolbar"},[t("div",{class:"dl-seg dl-people-tabs",role:"tablist"}),t("div",{class:"dl-toolbar-end"},[a,r,s.serverId?A([v("plus"),` ${_("Add person")}`],()=>s.openCreate(),"add"):""])]),this.list]);return this.el=l,this.rebuild(),this.poller??(this.poller=pt({fetch:()=>N.status(30),every:30,live:!0,active:()=>!!s.el?.isConnected,apply:(d,c)=>s.take(d,c)})),!vr&&new URLSearchParams(location.search).get("add")&&(vr=!0,setTimeout(()=>s.openCreate(),100)),Promise.resolve(l)}countText(){let e=this.st.totals;return[W(e.people,"%s person","%s people"),W(e.devices,"%s device","%s devices"),m(_("%s online"),K(e.online))].join(" · ")}decorate(e=!1){let o=this.el?.querySelector(".dl-people-count");o&&(o.textContent=this.countText());let s=this.st.people,r=this.today,a=h=>Zi(h,r),i={all:s.length,online:s.filter(h=>h.online>0).length,attention:s.filter(a).length,paused:s.filter(h=>mr(h)).length},l=this.el?.querySelector(".dl-people-tabs");if(l&&!(e&&Bt(l))){let h={all:_("All"),online:_("Online"),attention:_("Needs attention"),paused:_("Paused")};dom.content(l,Object.keys(h).map(E=>t("button",{type:"button",role:"tab",class:E===this.filter?"on":"",click:()=>{this.filter=E,Eo("dl.people.filter",E),this.decorate()}},[h[E],t("b",{class:E==="attention"&&i[E]?"warn":""},String(i[E]))])))}let d=this.query,c=h=>[h.name,h.note??"",...h.devices.flatMap(E=>[E.name,E.address,E.hostname,E.endpoint])].join(" ").toLowerCase(),p=h=>!(this.filter==="online"&&!h.online||this.filter==="attention"&&!a(h)||this.filter==="paused"&&!mr(h)||d&&!c(h).includes(d)),u=h=>hr(h)==="paused"?2:To(h)?1:0,w=[...s].sort((h,E)=>u(h)-u(E)||(this.sort==="name"?h.name.localeCompare(E.name):this.sort==="usage"?E.month[0]+E.month[1]-(h.month[0]+h.month[1]):E.online-h.online||E.last_seen-h.last_seen)),M=0;for(let h of w){let E=this.card(h.id);if(!E)continue;this.list.appendChild(E),E.classList.toggle("dl-off",To(h));let H=p(h);E.classList.toggle("dl-filtered",!H),H&&M++}let g=this.el?.querySelector(".dl-people-none")??null;s.length&&!M?(g??(g=t("div",{class:"dl-empty dl-people-none"},t("p",{},_("No one here right now.")))),g.previousElementSibling!==this.list&&this.list.after(g)):g?.remove()}async quick(e,o,s){await F(()=>N.personUpdate(e.id,o),s)&&await this.update()}renderCard(e,o){let s=this.person(o);if(!s)return dom.content(e,t("em",{},_("This person was just removed."))),e;let r=this.today,a=st(s.expires,r),i=Math.max(0,s.device_limit-s.devices.length),l=s.has_link??this.st.settings.portal_enabled,d=[],c=hr(s);if(s.expires&&c!=="expired"){let g=rt(s,a),h=a!=null&&a<0;d.push(t("span",{class:`dl-pill-ic${h?" bad":g?" warn":""}`,title:m(_("Access ends %s"),De(s.expires))},[v("calendar"),h?m(_("ended %s"),De(s.expires)):g?an(a):m(_("until %s"),De(s.expires))]))}s.hours&&c!=="hours"&&d.push(t("span",{class:"dl-pill-ic",title:_("Allowed hours")},[v("clock"),s.hours.replace("-","–")]));let p=ln(s.devices).map(g=>t("button",{type:"button",class:`dl-chip${g.disabled?" disabled":""}${g.online?" live":""}`,title:[at(g.kind),g.address,g.online?m(_("online from %s"),g.endpoint):g.handshake?m(_("seen %s"),pe(g.handshake,this.st.now)):""].filter(Boolean).join(" · "),click:h=>{h.preventDefault(),Je(s,g,this.deviceOpts(s))}},[v(g.kind),t("span",{class:"dl-chip-name"},g.name),!g.handshake&&!g.disabled?t("span",{class:"dl-chip-tag"},_("not set up")):""]));p.push(t("button",{type:"button",class:"dl-chip add",title:i>0?_("Add device"):_("Over the limit: admins can still add"),click:g=>{g.preventDefault(),ct(s,this.deviceOpts(s))}},[v("plus"),_("Add device")]));let u=[];s.expires&&rt(s,a)&&c!=="expired"&&u.push(t("button",{type:"button",class:"dl-fix",click:()=>this.quick(s,{expires:fr(s.expires,r)},_("Extended by 1 month"))},_("Extend 1 month")));let w=$e("more",_("More"),g=>Se(g.currentTarget,[{label:_("Open"),icon:v("open"),run:()=>{location.href=Re(s.id)}},l?{label:_("Invite card"),icon:v("qr"),run:()=>Xt(s,this.st.servers.find(h=>h.id===s.server)?.name??_("Home"))}:null,i>0?{label:_("Add device"),icon:v("plus"),run:()=>ct(s,this.deviceOpts(s))}:null,null,{label:s.paused?_("Resume"):_("Pause"),icon:v(s.paused?"play":"pause"),warn:!s.paused,run:()=>this.togglePause(s)},{label:_("Delete"),icon:v("trash"),danger:!0,run:()=>this.remove(s.id)}].filter((h,E,H)=>h||E>0&&H[E-1])),"neutral","dl-icon-only"),M=t("div",{class:"dl-pcard-actions"},[l?$e("link",_("Copy link"),()=>Sn(s.id),"neutral","dl-icon-only"):"",w]);return dom.content(e,t("div",{class:"dl-pcard"},[t("div",{class:"dl-pcard-main"},[t("div",{class:"dl-pcard-top"},[t("span",{class:`dl-avatar${s.online?" online":""}`},je(s.name)),t("div",{class:"dl-pcard-who"},[t("div",{class:"dl-card-head"},[t("a",{class:"dl-card-name",href:Re(s.id)},s.name),Qo(s),...d]),Ji(s)])]),t("div",{class:"dl-chips"},p),u.length?t("div",{class:"dl-fixes"},u):""]),this.usageSide(s,M),c?this.stopStrip(s,c):""])),e}stopStrip(e,o){let s=this.today,r=Lt(`${s.slice(0,8)}01`,1),a=()=>this.quick(e,{bonus_gb:String((e.bonus_gb||0)+10)},_("+10 GB this month")),i={paused:["pause","warn",_("Paused"),_("Devices can’t connect until you resume"),["play",_("Resume"),()=>this.togglePause(e)]],quota:e.quota_period==="month"?["chart","bad",_("Data limit reached"),m(_("Paused until it resets on %s"),De(r)),["plus",_("+10 GB this month"),a]]:["chart","bad",_("Data limit reached"),_("Paused until the limit is raised"),["edit",_("Change limit"),()=>location.href=Re(e.id)]],expired:["calendar","bad",m(_("Access ended %s"),De(e.expires)),_("Devices can’t connect"),["calendar",_("Extend 1 month"),()=>this.quick(e,{expires:fr(e.expires,s)},_("Extended by 1 month"))]],hours:["clock","warn",_("Outside allowed hours"),m(_("Access %s (router time)"),e.hours.replace("-","–")),null],no_server:["alert","warn",_("No server"),_("Choose a server on their page"),null]},[l,d,c,p,u]=i[o];return t("div",{class:`dl-pstrip ${d}`},[t("span",{class:`dl-need-ic ${d}`},v(l)),t("span",{class:"dl-pstrip-text"},[t("b",{},c),t("span",{class:"dl-faint"},p)]),u?A([v(u[0]),` ${u[1]}`],u[2]):""])}usageSide(e,o){let s=e.quota_used||e.month[0]+e.month[1],r=e.quota_limit?Math.min(100,e.quota_used/e.quota_limit*100):0,a=e.devices.reduce((p,u)=>p+(u.spark[u.spark.length-1]??[0,0]).reduce((w,M)=>w+M),0),i=e.rate?.[e.rate.length-1],l=e.online&&i&&this.st.now-i[0]<180,d=t("div",{class:`dl-usebar${r>=100?" bad":r>=90?" warn":""}`});if(e.quota_limit){let p=t("i",{class:"fill"});p.style.width=`${r}%`,d.appendChild(p),we(d,()=>[t("div",{class:"dl-tip-title"},m(_("%s%% used"),K(r,1))),t("div",{class:"dl-muted"},`${m(_("%s of %s"),se(e.quota_used),se(e.quota_limit))} · ${m(_("%s left"),se(Math.max(0,e.quota_limit-e.quota_used)))}`),t("div",{class:"dl-faint"},e.quota_period==="total"?_("In total"):[_("This month"),e.bonus_gb?m(_("includes +%s GB extra"),K(e.bonus_gb)):""].filter(Boolean).join(" · "))])}else{let p=e.devices.map(u=>({d:u,v:u.month[0]+u.month[1]})).filter(u=>u.v>0).sort((u,w)=>w.v-u.v);p.forEach((u,w)=>{let M=t("i",{class:`c${Math.min(w,4)}`});M.style.flexGrow=String(u.v),d.appendChild(M)}),p.length&&we(d,()=>[t("div",{class:"dl-tip-title"},_("This month by device")),...p.map((u,w)=>t("div",{class:"dl-tip-row"},[t("span",{class:`dl-swatch c${Math.min(w,4)}`}),t("span",{},u.d.name),t("b",{},se(u.v))]))])}let c=e.quota_limit?m(_("%s left"),se(Math.max(0,e.quota_limit-e.quota_used))):_("no limit");return t("div",{class:"dl-pside"},[t("div",{class:"dl-pside-top"},[l?t("span",{class:"dl-pside-state live"},_("Online")):t("span",{class:"dl-pside-state"},e.online?_("Online"):e.last_seen?_("Offline"):_("Never connected")),o]),t("div",{class:"dl-use-num"},[t("b",{class:s?"":"dl-faint"},se(s)),t("span",{class:"dl-faint"},e.quota_limit?m(_("of %s"),se(e.quota_limit)):e.quota_period==="total"&&e.quota_gb?_("in total"):_("this month"))]),d,l?t("div",{class:"dl-use-live",title:_("Right now")},[`↓ ${Fe(i[2])}`,t("span",{class:"dl-faint"},`↑ ${Fe(i[1])}`)]):t("div",{class:"dl-faint dl-pside-foot"},a?`${m(_("today %s"),se(a))} · ${c}`:c)])}async togglePause(e){await F(()=>N.personPause(e.id,!e.paused),m(e.paused?_("%s resumed"):_("%s paused"),e.name))&&await this.refresh()}async remove(e){let o=this.person(e);await me(m(_("Remove %s?"),o?.name??e),W(o?.devices.length??0,"%s device is disconnected immediately and the personal link stops working. Usage history is kept in backups.","All %s devices are disconnected immediately and the personal link stops working. Usage history is kept in backups."),_("Remove"),!0)&&await F(()=>N.personDelete(e),_("Person removed"))&&await this.refresh()}openCreate(){let e=this.st;if(!e.servers.length){q(_("Set up the server first."),"warning");return}let o=t("input",{type:"text",class:"cbi-input-text",placeholder:_("e.g. Myata"),maxlength:48}),s=(()=>{try{return JSON.parse(Mo("dl.person.last")??"{}")}catch{return{}}})(),r=ur(s.access??"internet"),a=t("input",{type:"number",class:"cbi-input-text",min:1,max:32,value:e.settings.default_device_limit}),i=t("input",{type:"date",class:"cbi-input-text"}),l=t("input",{type:"number",class:"cbi-input-text",min:0,step:"any",placeholder:_("Unlimited"),value:s.quota??""}),d=(S,$)=>t("button",{type:"button",class:"cbi-button cbi-button-neutral",click:()=>{i.value=$?Lt(Ge(e.series),$):"",i.dispatchEvent(new Event("change"))}},S),c=e.servers[0],p=!this.serverId&&e.servers.length>1?t("select",{class:"cbi-input-select"},e.servers.map(S=>t("option",{value:S.id},S.name))):null,u=(S,$,b)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},S),t("div",{class:"cbi-value-field"},[$,b?t("div",{class:"cbi-value-description"},b):""])]),w=Ge(e.series),M=Ee(_("Name","person"),o,()=>He(o.value,[],_("Shown in their portal and apps."))),g=Ee(_("Devices"),a,()=>fn(a.value)),h=Ee(_("End date"),i,()=>ms(i.value,w,st,De),t("div",{class:"dl-actions"},[i,d(_("1 month"),1),d(_("3 months"),3),d(_("1 year"),12),d(_("None","end date"),0)])),E=Ee(_("Monthly data (GB)"),l,()=>gn(l.value));i.addEventListener("change",()=>h.refresh());let H=e.settings.portal_enabled;de(_("Add person"),[M,p?u(_("Server"),p):"",t("div",{class:"cbi-value dl-block"},[t("label",{class:"cbi-value-title"},_("Access")),t("div",{class:"cbi-value-field"},r.el)]),g,h,E],[ue()," ",A(H?_("Create and copy link"):_("Create"),async()=>{let S=Ue([M,g,h,E]);if(S){q(S,"warning");return}let $=await F(()=>N.personCreate(o.value.trim(),"",p?.value??c.id,r.get(),a.value.trim(),i.value,l.value.trim(),"month"));$&&(Eo("dl.person.last",JSON.stringify({access:r.get(),quota:l.value.trim()})),$.link&&await xe($.link,_("Personal link copied"),!0),this.showCreated($.id,o.value.trim(),$.link,e.servers.find(b=>b.id===(p?.value??c.id))?.name??c.name),await this.refresh())},"positive")]),setTimeout(()=>o.focus(),50)}showCreated(e,o,s,r){if(s){Xt({id:e,name:o,link:s},r,{title:m(_("%s is ready"),o),lead:m(_("Send %s the card or the link. They open it, add their devices and connect - no account needed."),o)});return}let a=this.person(e);de(m(_("%s is ready"),o),[t("p",{},_("Created. Turn on the personal portal in Settings to get a link, or add devices for them here."))],[t("button",{class:"cbi-button cbi-button-neutral",click:ce},_("Done"))," ",t("a",{class:"cbi-button cbi-button-neutral",href:`${L.url("admin/network/dawnline/settings")}?section=portal`},_("Open Settings"))," ",a?A(_("Add device"),()=>{ce(),ct(a,this.deviceOpts(a))},"positive"):""])}};var Pn=["#3a83f7","#a78bfa","#f472b6","#f59e0b","#10b981","#22d3ee","#ef4444","#84cc16"],So=n=>t("i",{class:"dl-circle-dot",style:`background:${Pn[n?.color??0]??Pn[0]}`}),ut=n=>n.access==="both"||n.access==="lan"&&!n.services?.length;function br(n,e,o){let s=he(n?.name??e.name??"",{placeholder:_("NAS")}),r=he(n?.address??e.address??"",{placeholder:"192.168.1.10",class:"cbi-input-text dl-mono"}),a=he((n?.ports??e.ports??[]).join(", "),{placeholder:_("All ports, or e.g. 445, 5000"),class:"cbi-input-text dl-mono"}),i=Ee(_("Name","circle or service"),s,()=>He(s.value,[],_("Shown to people who may reach it."))),l=Ee(_("Address"),r,()=>hs(r.value)),d=Ee(_("Ports"),a,()=>fs(a.value));de(n?m(_("Edit %s"),n.name):_("Add service"),[i,l,d],[ue()," ",A(_("Save"),async()=>{let c=Ue([i,l,d]);if(c){q(c,"warning");return}let p=a.value.split(/[ ,]+/).filter(Boolean);await F(()=>N.serviceSet(n?.id??"",s.value,r.value,p),_("Saved"))&&(ce(),o())},"positive")])}function Qi(){let n=_("Web"),e=_("Printer");return{_smb:"SMB",_afpovertcp:"AFP",_http:n,_https:n,_ssh:"SSH",_sftp:"SFTP","_sftp-ssh":"SFTP",_ipp:e,_ipps:e,_printer:e,"_pdl-datastream":e,_airplay:"AirPlay",_raop:"AirPlay",_rfb:_("Screen sharing"),_googlecast:"Cast",_hap:"HomeKit",_rdp:_("Remote desktop"),_ftp:"FTP"}}function Xi(n){let e=Qi(),o=new Map;for(let s of n.services){let r=e[s.type.split(".")[0]];!r||!s.port||(o.get(r)??o.set(r,new Set).get(r)).add(String(s.port))}return o.size?[...o].map(([s,r])=>[s,[...r].sort((a,i)=>+a-+i)]):[[_("Web"),["80","443"]],["SMB",["445"]],["SSH",["22"]]]}function xr(n,e,o){let s=n,r=null,a=!1,i=null,l=new Set,d=t("div",{class:"dl-list"}),c=t("div",{class:"dl-stack gap8"},t("span",{class:"dl-sub"},_("Looking for devices at home…"))),p=()=>{let h=s.services;dom.content(d,h.length?h.map(E=>t("div",{class:"dl-row"},[v("home"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},E.name),t("span",{class:"dl-mono dl-faint"},`${E.address} · ${E.ports.length?m(_("ports %s"),E.ports.join(", ")):_("all ports")}`)]),A(_("Edit"),()=>br(E,{},o)),A([v("trash")],async()=>{await me(m(_("Remove %s?"),E.name),_("People limited to this service lose access to it."),_("Remove"),!0)&&await F(()=>N.serviceDelete(E.id),_("Removed"))&&await o()},"neutral",{title:_("Remove"),"aria-label":m(_("Remove %s"),E.name)})])):[t("div",{class:"dl-row dl-muted"},_("No services yet: pick ports of a device below."))])};async function u(h,E){if(!l.has(h.address)){l.add(h.address),M();try{let H=s.services.find($=>$.address===h.address);(E===null?H&&await F(()=>N.serviceDelete(H.id),m(_("%s removed"),H.name)):await F(()=>N.serviceSet(H?.id??"",H?.name??(h.name||h.address),h.address,E),H?m(_("%s updated"),H.name):m(_("%s added"),h.name||h.address)))&&await o()}finally{l.delete(h.address),M()}}}function w(h){let E=s.services.find(C=>C.address===h.address),H=!!E&&!E.ports.length,S=new Set(E?.ports??[]),$=l.has(h.address),b=(C,y,z)=>Xe(C,y,z,{disabled:$?"disabled":null,"aria-busy":$?"true":null});return t("div",{class:"dl-row"},[v(h.services.some(C=>C.type.startsWith("_ipp")||C.type.startsWith("_printer"))?"file":"computer"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},h.name||h.address),t("span",{class:"dl-mono dl-faint"},h.address)]),t("div",{class:"dl-chips-row dl-host-ports"},[b(_("All ports"),H,()=>u(h,H?null:[])),...Xi(h).map(([C,y])=>{let z=!H&&y.every(k=>S.has(k));return b(`${C} ${y.join(", ")}`,z,()=>{let k=new Set(H?[]:S);for(let f of y)z?k.delete(f):k.add(f);u(h,k.size?[...k]:null)})})])])}function M(){if(a)return dom.content(c,t("span",{class:"dl-sub"},_("Couldn't read the devices at home.")));if(!r)return;let h=r;if(!h.hosts.length)return dom.content(c,t("span",{class:"dl-sub"},_("No devices found in the home network right now.")));let E=t("details",{class:"dl-params",open:i??!s.services.length?"":null},[t("summary",{},[v("chevron"),t("span",{},_("Add from devices at home")),t("span",{class:"dl-pcount"},String(h.hosts.length))]),t("div",{class:"dl-params-body"},[t("span",{class:"dl-sub"},h.mdns?_("Ports they announce over Bonjour. Pick what to open, or all ports."):_("Devices that got an address from this router. Pick the ports to open, or all ports.")),t("div",{class:"dl-list"},h.hosts.map(w))])]);E.addEventListener("toggle",()=>i=E.open),dom.content(c,E)}return N.homeHosts(e).then(h=>{r=h,M()}).catch(()=>{a=!0,M()}),p(),{el:t("div",{class:"dl-stack gap8"},[t("div",{class:"dl-iflead"},[t("div",{class:"dl-iflead-row"},[t("b",{},_("Home services")),A([v("plus")," ",_("Add service")],()=>br(null,{},o))]),t("span",{class:"dl-sub"},_("Home-only people can be limited to these instead of whole networks (chosen on their page). Shared by all servers."))]),d,c]),update(h){s=h,p(),M()}}}function $n(n,e,o,s){let r=new Set(n.circles.filter(h=>h.server===e).map(h=>h.color)),a=o?.color??Pn.findIndex((h,E)=>!r.has(E));a<0&&(a=0);let i=he(o?.name??"",{placeholder:_("Family")}),l=n.people.filter(h=>h.server===e).sort((h,E)=>h.name.localeCompare(E.name)),d=new Set(l.filter(h=>o&&h.circle===o.id).map(h=>h.id)),c=t("div",{class:"dl-swatches",role:"radiogroup","aria-label":_("Colour")}),p=()=>dom.content(c,Pn.map((h,E)=>t("button",{type:"button",role:"radio",class:`dl-swatch${E===a?" on":""}`,style:`--sw:${h}`,"aria-checked":E===a?"true":"false","aria-label":m(_("Colour %s"),E+1),click:()=>{a=E,p()}})));p();let u=t("div",{class:"dl-chips-row"},l.map(h=>{let E=h.circle&&h.circle!==o?.id?n.circles.find(H=>H.id===h.circle):void 0;return t("button",{type:"button",class:`dl-chipbtn${d.has(h.id)?" on":""}`,title:ut(h)?E?m(_("Now in %s"),E.name):"":m(_("%s has no home access: their devices aren't reachable anyway"),h.name),click:H=>{d.delete(h.id)||d.add(h.id),H.currentTarget.classList.toggle("on",d.has(h.id))}},[h.name,ut(h)?E?t("b",{},E.name):"":t("b",{},_("internet"))])})),w=(h,E)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},h),t("div",{class:"cbi-value-field"},E)]),M=n.circles.filter(h=>h.server===e&&h.id!==o?.id).map(h=>h.name),g=Ee(_("Name","circle or service"),i,()=>ds(i.value,M));de(o?m(_("Edit %s"),o.name):_("New circle"),[g,w(_("Colour"),c),w(_("People"),u),t("p",{class:"dl-sub"},_("Devices of people in one circle reach each other. A person is in one circle at a time."))],[o?A(_("Delete"),async()=>{await F(()=>N.circleDelete(o.id),m(_("%s deleted"),o.name))&&(ce(),s())},"negative"):"",t("span",{class:"dl-spacer"}),ue()," ",A(_("Save"),async()=>{let h=g.help();if(h.bad){q(h.text,"warning");return}await F(()=>N.circleSet(o?.id??"",e,i.value,a,[...d]),_("Saved"))&&(ce(),s())},"positive")],"dl-circle-modal")}function wr(n,e,o){let s=n.circles.filter(r=>r.server===e);return t("div",{class:"dl-chips-row dl-circles"},[...s.map(r=>{let a=n.people.filter(i=>i.circle===r.id).map(i=>i.name);return t("button",{type:"button",class:"dl-chip",title:m(_("Edit %s"),r.name),click:()=>$n(n,e,r,o)},[So(r),t("b",{},r.name),t("span",{class:"dl-faint"},a.length?a.join(", "):_("nobody yet"))])}),t("button",{type:"button",class:"dl-chip add",title:_("New circle"),"aria-label":_("New circle"),click:()=>$n(n,e,null,o)},v("plus"))])}function Po(n,e){let o=n.people.filter(p=>p.server===e.id),s=(p="")=>t("span",{class:"dl-yes"},[v("check"),p]),r=()=>t("span",{class:"dl-faint"},"—"),a=p=>{let u=new Set(p.map(M=>M.access==="lan"&&M.services?.length?"services":M.home_nets?.length?"some":"all"));u.size||u.add("all");let w={all:_("all networks"),some:_("their networks"),services:_("services")};return s([...u].map(M=>w[M]).join(" / "))},i=()=>e.mesh==="off"?r():e.mesh==="circles"?s(_("circle")):s(),l=e.lan_like?_("like home"):_("direct"),d=(p,u,w)=>t("tr",{},[t("td",{},[t("b",{},p),t("div",{class:"dl-sub"},W(u.length,"%s person","%s people"))]),...w.map(M=>t("td",{},M))]),c=p=>o.filter(u=>u.access===p);return t("section",{class:"dl-setsec"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Who reaches what")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},_("From the rules on this server"))]),t("div",{class:"dl-reach-wrap"},t("table",{class:"dl-table dl-reach"},[t("tr",{},["",_("Internet"),_("Home"),_("This router"),_("Each other")].map(p=>t("th",{},p))),d(_("Internet"),c("internet"),[s(l),r(),t("span",{class:"dl-faint"},"DNS"),r()]),d(_("Home"),c("lan"),[t("span",{class:"dl-faint"},_("their own")),a(c("lan")),s(),i()]),d(_("Both"),c("both"),[s(l),a(c("both")),s(),i()])])),t("p",{class:"dl-sub"},_("Home devices reach the devices of people with home access, on the networks those people reach. Paused, ended and over-the-limit people reach nothing."))])])}function yr(n,e){let o=n.people.filter(c=>c.server===e.id).flatMap(c=>c.devices.map(p=>({id:p.id,label:`${c.name} · ${p.name}`}))).sort((c,p)=>c.label.localeCompare(p.label)),s="@addr",r=(c,p)=>{let u=t("select",{class:"cbi-input-select","aria-label":c},[...o.map(h=>t("option",{value:h.id,selected:h.id===p?"selected":null},h.label)),t("option",{value:s,selected:p===s?"selected":null},_("Address"))]),w=he("",{placeholder:c,class:"cbi-input-text dl-mono"}),M=t("div",{class:"dl-check-end"},[u,w]),g=()=>w.hidden=u.value!==s;return u.addEventListener("change",g),g(),{el:M,value:()=>u.value===s?w.value.trim():u.value}},a=r("10.0.1.11",o[0]?.id??s),i=r("10.0.1.20:445",s),l=t("div",{class:"dl-stack gap8"}),d=async()=>{let c=await F(()=>N.accessCheck(a.value(),i.value()));if(!c)return;let p=c.steps.findIndex(u=>!u.ok);dom.content(l,[t("div",{class:`dl-verdict ${c.ok?"ok":"bad"}`},[t("b",{},c.ok?_("Allowed"):_("Blocked")),t("span",{class:"dl-sub"},c.ok?_("Every step lets it through"):m(_("Stops at step %s of %s"),p+1,c.steps.length))]),t("ul",{class:"dl-checks"},c.steps.map(u=>t("li",{},[t("span",{class:`dl-check-icon ${u.ok?"ok":"error"}`},v(u.ok?"check":"x")),t("div",{class:"dl-check-body"},[t("div",{class:"dl-check-title"},u.title),u.detail?t("div",{class:"dl-check-detail"},u.detail):""])])))])};return t("section",{class:"dl-setsec"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Check access")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},_("Why something does or does not connect"))]),t("div",{class:"dl-check-form"},[a.el,t("span",{class:"dl-faint"},"→"),i.el,A(_("Check"),d)]),l])])}function Dn(n){return n==="app"?"Dawnline":n==="amneziawg"?"AmneziaWG":n==="packages"||n==="pkgs"?_("System packages"):void 0}function mt(n){return(n.startsWith("check")?n.slice(6)||"all":n).split(/[:@ ]/)[0]}function An(n){return mt(n.action==="check"?`check:${n.component??""}`:n.component??"")}function kr(n){return n=Math.max(0,Math.floor(n)),`${Math.floor(n/60)}:${String(n%60).padStart(2,"0")}`}function _r(n,e){return!n?.from&&!n?.to?e:n.from&&n.to&&n.from!==n.to?`${n.from} → ${n.to}`:n.to??n.from??e}function Cr(n,e){let o=n.check?.components??{},s=e==="all"?["app","amneziawg","packages"]:[e],r=[],a;for(let l of s){let d=o[l];if(d){if(d.error)return{tone:"warn",text:d.error};l==="packages"&&d.updates?r.push(W(d.updates,"%s system package","%s system packages")):l!=="packages"&&d.update&&d.installed&&d.latest&&(r.push(`${Dn(l)} ${d.latest}`),e!=="all"&&(a=d.latest))}}if(r.length)return{tone:"acc",text:m(_("Update available: %s"),r.join(", ")),update:a};let i=s.length===1?o[s[0]]:null;return i?.status==="dev"?{tone:"acc",text:m(_("Installed version is newer than the release (%s)"),i.latest)}:i?.note?{tone:"warn",text:i.note}:{tone:"ok",text:s.length>1?_("Everything is up to date"):_("Latest version is installed")}}function Lr(n,e,o,s){return e?n.id===e:o&&n.id===o?!1:n.state==="running"||s>0&&n.started>=s}var $o=n=>new Promise(e=>setTimeout(e,n));async function tn(n,e,o){let s=o?An(o):mt(n),r=o?o.action==="check":n.startsWith("check"),a=Date.now(),i=t("b",{},Dn(s)??(s==="all"?_("All components"):"Dawnline")),l=t("span",{class:"dl-pill dl-mono"},e.version??""),d=t("span",{class:"dl-pill info",hidden:!0}),c=t("span",{},"0:00"),p=t("pre",{class:"dl-log"},_("Operation started. Waiting for log output…")),u=t("div",{}),w=t("div",{class:"dl-op-actions"}),M=[],g=x=>dom.content(w,x),h=(x=!1)=>ue(_("Close"),x);de(e.title,t("div",{class:"dl-op"},[t("div",{class:"dl-op-head"},[i,e.version?l:"",d,t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint dl-op-timer"},[v("clock"),c])]),t("div",{class:"dl-op-loghead"},[t("b",{},_("Operation log")),$e("copy",_("Copy log"),()=>xe(M.join(` +`),_("Log copied")))]),p,u]),[w],"wide"),g([t("button",{class:"cbi-button cbi-button-neutral spinning",type:"button",disabled:"disabled"},r?_("Checking…"):_("Working…"))]);let E=o??null,H=o?.id,S,$=0,b=x=>{H!==x.id&&(H=x.id,e.onJob?.(x))};if(o)e.onJob?.(o);else try{let x=await N.updatesStatus().catch(()=>null);S=x?.job?.id,$=x?.now??0;let T=await N.updatesRun(n);T.job&&T.job.state==="running"&&T.job.id!==S&&(E=T.job,b(T.job))}catch(x){return M=[Ce(x)],p.textContent=M[0],dom.content(u,t("div",{class:"dl-comp-status warn"},[v("alert"),t("span",{},Ce(x))])),g([h(!0)]),q(Ce(x),"error"),null}let C=null,y=0;for(;;){if(await $o(1e3),C=await N.updatesStatus().catch(()=>null),!C){if(++y>60)break;continue}y=0;let x=C.job;if(!x||!Lr(x,H,S,$)){if(Date.now()-a>15e3)break;continue}if(b(x),E=x,x.log.length){M=x.log;let T=p.scrollTop+p.clientHeight>=p.scrollHeight-8;p.textContent=M.join(` `),T&&(p.scrollTop=p.scrollHeight)}if(l.textContent=_r(x,e.version??""),!l.isConnected&&l.textContent&&i.after(l),c.textContent=kr((x.finished??C.now)-x.started),x.state==="running"){d.hidden=!x.phase,d.textContent=x.phase;continue}break}if(p.scrollTop=p.scrollHeight,d.hidden=!1,!E||E.state==="running")return d.className="dl-pill warn",d.textContent=_("No answer"),dom.content(u,t("div",{class:"dl-comp-status warn"},[v("alert"),t("span",{},_("The router stopped answering. The job may still finish: reopen Components in a minute."))])),g([h()]),e.onDone?.(C),E;if(E.state==="failed")return d.className="dl-pill bad",d.textContent=_("Failed"),dom.content(u,t("div",{class:"dl-comp-status bad"},[v("x"),t("span",{},[t("b",{},(E.error??_("Operation failed")).replace(/\.$/,"")),r?"":`. ${_("Nothing else was changed.")}`])])),g([A(_("Copy log"),()=>xe(M.join(` -`),_("Log copied"))),h(!0)]),q(`${Dn(s)??_("Update","noun")}: ${E.error??_("failed")}`,"error"),e.onDone?.(C),E;if(d.className="dl-pill ok",d.textContent=_("Finished"),r&&C){let x=Cr(C,s);if(dom.content(u,t("div",{class:`dl-comp-status ${x.tone}`},[v(x.tone==="ok"?"check":x.tone==="warn"?"alert":"download"),t("span",{},x.text)])),q(x.text,x.tone==="warn"?"warning":"success"),e.onDone?.(C),x.update&&e.onUpdate){let T=C;g([h(),A(m(_("Update to %s"),x.update),()=>e.onUpdate(T),"positive")])}else g([h()]),x.tone==="ok"&&setTimeout(()=>u.isConnected&&ce(),1200);return E}let z=/^app:(lang:|nolang$)/.exec(E.component??"");if(z){let x=()=>{ui.menu?.flushCache(),location.reload()};return dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},[t("b",{},z[1]==="nolang"?_("The translation is removed."):_("The translation is installed."))," ",_("Reloading the page…")])])),g([h(),A(_("Reload now"),x,"positive")]),await $o(4e3),u.isConnected&&x(),E}if(s==="app"&&E.to){let x=E.to,T=t("span",{},_("Waiting for the router to restart its services…"));dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},[t("b",{},m(_("Dawnline %s is installed."),x))," ",T])]));let I=()=>{ui.menu?.flushCache(),location.reload()};g([h(),A(_("Reload now"),I,"positive")]),q(m(_("Dawnline updated to %s"),x),"success",6e3);for(let Y=1;Y<=30;Y++)if(T.textContent=m(_("Waiting for the router to restart its services (%s of 30)…"),Y),await $o(1500),(await N.updatesStatus().catch(()=>null))?.version===x)return T.textContent=_("Services are back. Reloading…"),setTimeout(I,800),E;return T.textContent=_("Services restarted. Reload the page to use the new version."),E}let y=[...E.result?.pkgs?.updated??[],...E.result?.pkgs?.installed??[]],f=s==="pkgs"?y.length?m(_("Updated %s"),y.join(", ")):_("Updated system packages"):s==="amneziawg"?E.to?m(_("AmneziaWG %s is installed"),E.to):_("AmneziaWG is installed"):_("Operation completed");return dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},f)])),g([h()]),q(f,"success"),e.onDone?.(C),E}function el(n){return{https:[_("Install HTTPS for the portal?"),_("Installing HTTPS for the portal")],acme:[_("Install ACME certificates?"),_("Installing ACME certificates")],home:[_("Install the home-like link?"),_("Installing the home-like link")],awg:[_("Install AmneziaWG?"),_("Installing AmneziaWG")]}[n]}async function Mr(n,e,o,s){let[r,a]=el(e);return!await me(r,o,_("Install"))||(await tn(n,{title:a}))?.state!=="done"?!1:(setTimeout(()=>s?.(),4e3),!0)}function Nn(n){return Mr("amneziawg:auto","awg",_("Dawnline installs the AmneziaWG build made for this firmware and loads it. If the network service has to restart to learn it, connections drop for a few seconds."),n)}async function nn(n,e,o){return n==="awg"?Nn(o):e.length?Mr(`pkgs:${e.join(",")}`,n,m(_("%s from the OpenWrt feeds. Dawnline sets the rest up when they arrive."),e.join(", ")),o):!0}async function Er(n,e){if(n==="awg")return Nn(e);let o=await F(()=>N.updatesStatus());return o?nn(n,o.needs?.[n]??[],e):!1}var tl=()=>[["wan","WAN"],["ethernet","Ethernet"],["wifi","Wi-Fi"],["vpn",_("VPN & tunnels")],["other",_("Other")]],nl={wan:"globe",ethernet:"ethernet",bridge:"bridge",wifi:"wifi",vpn:"tunnel",other:"link"};function Tr(n,e,o){let s=n.id,r=e,a=t("div",{class:"dl-stack gap16"},t("section",{class:"dl-setsec"},t("div",{class:"dl-setsec-body"},t("p",{class:"dl-muted"},_("Loading interfaces…"))))),i,l=!0,d="",c=!0,p=!0,u="all",k=!1,M=xr(r,s,o),g=new Set,h="",E=()=>JSON.stringify([p,l,l?"":d,c,[...g].sort()]),H=()=>i.detected.lan||i.saved.lan||"",S=()=>(l?i.detected.wan||i.saved.wan:d)||"",$=()=>new Map(i.devices.map(B=>[B.name,B])),b=()=>{let B=$();return[...c&&H()?[H()]:[],...[...g].filter(ne=>ne!==H())].filter(ne=>ne!==S()).map(ne=>B.get(ne)??{name:ne,nets:[],missing:!0})},C=(B,Q)=>{i=B,Q&&(l=B.config.auto_wan,d=B.config.wan_device||B.detected.wan||B.saved.wan||"",c=B.config.auto_lan,p=B.config.lan_like,u=B.config.mesh??(B.config.device_mesh?"all":"off"),g=new Set(B.config.lan_devices),h=E()),J()},w=async B=>{let Q=await N.interfaces(s).catch(ne=>(q(ne.message,"error"),null));Q&&C(Q,B)};function z(B){let Q=c&&B.name===H(),ne=!!B.own||!!B.master||B.name===S()||Q;return Q||g.has(B.name)||!ne&&(B.nets.length>0||!!B.missing)}function y(B){let Q=c&&B.name===H(),ne=B.name===S(),fe=!Q&&g.has(B.name),j=!(!!B.own||!!B.master||ne||Q)&&(B.nets.length>0||fe||!!B.missing),V=(fe||Q)&&!B.zone&&!B.missing,le=B.missing?_("Not present right now"):B.own?_("This server"):B.master?m(_("Port of %s"),B.master):ne?`${_("Internet")}${B.zone?` · ${m(_("zone %s"),B.zone)}`:""}`:B.nets.length?B.nets.join(", "):_("No IPv4 network"),ve=t("button",{type:"button",class:`dl-if${fe?" sel":""}${Q?" auto":""}${!j&&!fe&&!Q?" off":""}${V?" warn":""}`,"aria-pressed":fe||Q?"true":"false","aria-disabled":j?null:"true",click:()=>{j&&(g.has(B.name)?g.delete(B.name):g.add(B.name),J())}},[t("span",{class:"dl-if-ic"},v(nl[B.kind]??"link")),t("span",{class:"dl-if-main"},[t("span",{class:"dl-if-name"},B.name),t("span",{class:"dl-if-sub"},le)]),Q?t("span",{class:"dl-if-badge ok"},_("Auto")):fe?t("span",{class:"dl-if-check"},v("check")):""]);return we(ve,()=>[t("div",{class:"dl-tip-title"},B.name),t("div",{class:"dl-muted"},[B.logical?m(_("Interface %s"),B.logical):_("No netifd interface")," · ",B.zone?m(_("zone %s"),B.zone):_("no firewall zone")]),B.members.length?t("div",{class:"dl-muted"},m(_("Ports: %s"),B.members.join(", "))):"",B.nets.length?t("div",{class:"dl-mono"},B.nets.join(", ")):"",V?t("div",{class:"dl-warn"},_("Not in a firewall zone: the firewall rejects this traffic.")):"",B.master?t("div",{class:"dl-muted"},m(_("Choose %s to include it."),B.master)):""]),ve}function f(){let B=i.like_home;return!p||!i.config.lan_like||!n.enabled?"":!i.needs?.length&&B.active&&B.bridged?"ok":"warn"}function x(){let B=i.like_home;return p?i.needs?.length?[t("span",{class:"dl-warn"},m(_("Needs %s."),new Intl.ListFormat(ie(),{type:"conjunction"}).format(i.needs)))," ",_("Until they are installed, internet traffic goes straight to the WAN.")]:i.config.lan_like?n.enabled?B.active&&B.bridged?ae(_("Internet traffic enters %s as %s, so whatever handles home traffic (proxies, filters, DNS) handles it too."),t("span",{class:"dl-mono"},B.dev??""),t("span",{class:"dl-mono"},B.address??"")):[t("span",{class:"dl-warn"},m(_("Not working: %s"),B.error??_("the link is down")))," ",_("Internet traffic goes straight to the WAN for now.")]:[_("Internet traffic enters the router from your LAN, so whatever handles home traffic (proxies, filters, DNS) handles it too.")]:[_("Internet traffic will enter the router from your LAN, so it is handled like any home device. Save to turn on.")]:[_("Off: internet traffic goes straight to the WAN, past whatever handles home traffic on this router.")]}let T=B=>({off:_("Devices of different people never reach each other; a person's own devices don't either."),all:_("Devices of people with home access reach each other, like home devices do. Internet-only people never."),circles:_("Within a circle: family sees family, guests see guests. Everyone reaches their own devices. Internet-only people never.")})[B];function I(B,Q,ne,fe,se="",j){return t("div",{class:j?"dl-setrow head":"dl-setrow"},[t("div",{class:"dl-lh-main"},[t("span",{class:`dl-need-ic ${se}`},v(B)),t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},Q),t("span",{class:"dl-sub"},ne),j??""])]),t("div",{class:"dl-setrow-ctl"},fe)])}let Y=(B,Q)=>{let ne=fe=>t("span",{class:"dl-mono"},fe);return B?t("span",{},[" ",...Q&&Q!==B?ae(_("Now: %s, was %s."),ne(B),ne(Q)):ae(_("Now: %s."),ne(B))]):t("span",{},[" ",...Q?ae(_("Not found now: using %s."),ne(Q)):[_("Not found.")]])};function J(){let B=t("select",{class:"cbi-input-select","aria-label":_("Internet interface"),change:D=>{d=D.target.value,J()}},i.devices.filter(D=>!D.own&&!D.master&&D.zone&&!D.missing).map(D=>t("option",{value:D.name,selected:D.name===d?"selected":null},`${D.name} · ${m(_("zone %s"),D.zone)}`))),ne=b().flatMap(D=>D.nets.map(G=>[G,D.name])),fe=JSON.parse(E()),se=JSON.parse(h),j=(...D)=>D.some(G=>JSON.stringify(fe[G])!==JSON.stringify(se[G])),V=j(0,1,2),le=j(3,4),ve=D=>A(_("Save"),async()=>{let G=await F(()=>N.serverInterfaces(s,l,l?"":d,c,[...g],p,u!=="off",u),_("Access saved"));G&&(C(G,!0),G.nets_changed&&G.lan_only&&q(W(G.lan_only,"%s person has Home-only access: their devices need the configuration again to reach the new networks.","%s people have Home-only access: their devices need the configuration again to reach the new networks."),"warning",1e4))},"positive",{disabled:!D}),R=t("section",{class:"dl-setsec dl-ifcard"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Internet")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},_("People with Internet or Both"))]),I("home",_("Internet like a home device"),x(),[p&&i.needs?.length?A(_("Install"),()=>nn("home",i.needs,()=>w(!1)),"positive"):"",ye(p,_("Internet like a home device"),D=>{p=D,J()})],f()),I("globe",_("Auto-detect WAN"),[_("The interface with the default route: the server port opens there and Internet access leaves through it."),Y(i.detected.wan,i.saved.wan)],[l?"":B,ye(l,_("Auto-detect WAN"),D=>{l=D,J()})])]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub"},p?[_("Internet like a home device"),S()?[" · ",...ae(_("leaves through %s"),t("span",{class:"dl-mono"},S()))]:""]:S()?ae(_("Internet straight to %s"),t("span",{class:"dl-mono"},S())):_("No WAN found")),ve(V)])]),O=Me([["off",_("Off")],["all",_("Everyone")],["circles",_("Circles")]],u,{label:_("Devices reach each other"),cls:"sm",optimistic:!1,onChange:async D=>{let G={off:_("Off"),all:_("Everyone"),circles:_("Circles")}[D];await F(()=>N.serverUpdate(s,{mesh:D}),m(_("Devices reach each other: %s"),G))&&(u=D,i.config.mesh=D,J(),await o())}}),P=t("section",{class:"dl-setsec dl-ifcard"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Home network")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},_("People with Home or Both")),A([v("reset")," ",_("Rescan")],()=>w(!1),"neutral",{title:_("Read the interfaces again")})]),I("network",_("Networks"),_("Everyone with home access reaches these, unless their page leaves one out; their devices can be reached from here too. Click one to add or remove it."),"","",te()),I("link",_("Devices reach each other"),T(u),O,"",u==="circles"?wr(r,s,o):void 0),M.el]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub dl-if-summary"},ne.length?ae(_("Home access reaches %s"),t("span",{},ne.flatMap(([D,G],ee)=>[ee?", ":"",t("span",{class:"dl-mono"},D),` (${G})`]))):_("No home network: Home access reaches nothing but this router.")),ve(le)])]),U=window.scrollY;a.style.minHeight=`${a.offsetHeight}px`,dom.content(a,[R,P]),a.style.minHeight="",window.scrollTo({top:U})}function te(){let B=i.devices.filter(z),Q=i.devices.filter(ne=>!z(ne));return t("div",{class:"dl-stack gap8 dl-netpick"},[B.length?t("div",{class:"dl-ifgrid"},B.map(y)):t("span",{class:"dl-warn"},_("No home network: Home access reaches nothing but this router.")),t("label",{class:"dl-boxrow"},[t("span",{class:"dl-stack"},[t("span",{},_("Auto-detect LAN")),t("span",{class:"dl-sub"},[_("Adds the LAN this router uses."),Y(i.detected.lan,i.saved.lan)])]),ye(c,_("Auto-detect LAN"),ne=>{c=ne,J()})]),Q.length?t("details",{class:"dl-params",open:k?"":null,toggle:ne=>k=ne.currentTarget.open},[t("summary",{},[v("chevron"),t("span",{},_("Other interfaces")),t("span",{class:"dl-pcount"},String(Q.length))]),t("div",{class:"dl-params-body"},[t("span",{class:"dl-sub"},_("The WAN, this server, ports and Wi-Fi of a bridge (they come with it) and interfaces without an IPv4 network.")),...tl().map(([ne,fe])=>{let se=Q.filter(j=>j.category===ne);return se.length?t("div",{class:"dl-ifgroup"},[t("h4",{},fe),t("div",{class:"dl-ifgrid"},se.map(y))]):""})])]):""])}return w(!0),{el:a,update(B){r=B,M.update(B),i&&J()}}}var ol={connect:"ok",disconnect:"",roam:"",device_added:"ok",device_removed:"",person_added:"",person_removed:"",paused:"warn",resumed:"ok",expiring:"warn",expired_kept:"",portal_blocked:"bad",person_changed:"",devices_removed:"warn"},sl={devices_removed:"trash",link_changed:"link",person_added:"plus",person_removed:"trash",person_changed:"edit",paused:"pause",resumed:"play",expiring:"calendar",expired_kept:"calendar"};function rl(n,e){return e.device?n.people.flatMap(s=>s.devices).find(s=>s.id===e.device)?.kind??e.dkind??"other":sl[e.type]??"activity"}var al=n=>/^\d{4}-\d{2}-\d{2}$/.test(n)?Oe(n):n;function Do(n,e){let o=n.people.find(h=>h.id===e.person),s=o?.name??e.pname??e.person??"",r=o?.devices.find(h=>h.id===e.device)?.name??e.dname??"",a=h=>t("b",{},h),i=h=>t("span",{class:"dl-muted"},h),l=h=>t("span",{class:"dl-mono"},h),d=h=>e.hosts?.[h]?[t("span",{class:"dl-ev-host"},[t("b",{},e.hosts[h]),t("span",{class:"dl-faint"},` (${h})`)])]:[l(h)],c=(h,...E)=>ae(h,...E).map(H=>typeof H=="string"?i(H):H),p=(h,...E)=>{let H=_("You");return h.startsWith(`${H} `)?[t("span",{class:"dl-you"},H),...c(h.slice(H.length),...E)]:c(h,...E)},u=a(r?`${s} · ${r}`:s),k=ys(e),M=a(k||r||_("a device")),g=Ve(e);if(g==="admin")switch(e.type){case"device_added":return p(_("You added device %s for %s"),M,a(s));case"device_removed":return p(_("You removed device %s from %s"),M,a(s));case"paused":return p(_("You paused person %s"),a(s));case"resumed":return p(_("You resumed person %s"),a(s));case"device_changed":{let h=a(r||_("a device"));return k.startsWith("renamed from ")?[...p(_("You renamed device %s of %s"),h,a(s)),i(` · ${m(_("was %s"),k.slice(13))}`)]:k==="turned off"?p(_("You turned off device %s of %s"),h,a(s)):k==="turned on"?p(_("You turned on device %s of %s"),h,a(s)):[...p(_("You changed device %s of %s"),h,a(s)),...k?[i(` · ${k}`)]:[]]}case"device_keys":return[...p(_("You issued new keys for device %s of %s"),M,a(s)),i(` · ${_("it needs its new configuration")}`)];case"link_changed":return[...p(_("You issued a new link for person %s"),a(s)),i(` · ${_("the old link stopped working")}`)]}switch(e.type){case"connect":return[...e.detail?c(_("Device %s connected from %s"),u,t("span",{},d(e.detail))):c(_("Device %s connected"),u),...e.where?[i(` · ${e.where}`)]:[]];case"disconnect":return c(_("Device %s went offline"),u);case"roam":return c(_("Device %s changed network %s"),u,t("span",{},(e.detail??"").split(" → ").flatMap((h,E)=>E?[i(" → "),...d(h)]:d(h))));case"device_added":return c(g==="portal"?_("Person %s added device %s on their portal"):_("Person %s added device %s"),a(s),M);case"device_removed":return c(g==="portal"?_("Person %s removed device %s on their portal"):_("Person %s removed device %s"),a(s),M);case"device_keys":return c(_("Person %s issued new keys for device %s on their portal"),a(s),M);case"person_added":return p(_("You added person %s"),a(e.detail??s));case"person_removed":return p(_("You removed person %s"),a(e.detail??s));case"person_changed":return[...p(_("You changed person %s"),a(s)),...k?[i(` · ${_s(k)}`)]:[]];case"expiring":{let h=ks(e.detail??"");return h!=null?c(N_(h,"Person %s’s access ends in %s day","Person %s’s access ends in %s days"),a(s),i(K(h))):c(_("Person %s’s access ends in a few days"),a(s))}case"expired_kept":return c(_("Person %s’s end date passed (%s) · access kept"),a(s),i(al(e.detail??"")));case"paused":return e.detail?c(_("Person %s paused - %s"),a(s),i(po(e.detail))):c(_("Person %s paused"),a(s));case"resumed":return e.detail&&e.detail!=="active"?c(_("Person %s resumed - %s"),a(s),i(po(e.detail))):c(_("Person %s resumed"),a(s));case"portal_blocked":return c(_("%s blocked %s for 15 min after too many wrong codes"),t("b",{class:"dl-sys-src"},_("Personal portal")),e.detail==="all Cloudflare visitors"?i(_("all Cloudflare visitors")):l(e.detail??""));case"devices_removed":return c(_("Person %s - all devices removed, end date reached"),a(s));default:return[i(`${e.type}${e.detail?`: ${e.detail}`:""}`)]}}var il={portal_blocked:["globe","bad"]};function ll(n,e){if(n.servers.length<2||!e.person)return"";let o=n.people.find(r=>r.id===e.person),s=o&&n.servers.find(r=>r.id===o.server);return s?t("span",{class:"dl-ev-srv",title:_("Server")},s.name):""}function ht(n,e,o={}){let s=il[e.type],r=Ve(e);return t("div",{class:`dl-row${r==="admin"?" dl-ev-by-admin":s?` dl-ev-by-system ${s[1]}`:""}`},[r==="admin"?t("span",{class:"dl-ev-tile",title:_("Done by you in LuCI")},v("admin")):s?t("span",{class:"dl-ev-tile sys"},v(s[0])):t("span",{class:`dl-ev-tile ev ${ol[e.type]??""}`},v(rl(n,e))),t("span",{class:"dl-row-main"},Do(n,e)),o.server===!1?"":ll(n,e),t("span",{class:"dl-faint dl-nowrap",title:new Date(e.ts*1e3).toLocaleString(ie())},o.time??pe(e.ts,n.now))])}var dl={info:"",up:"ok",down:"warn",repair:"warn",error:"bad"},cl={awg:"tunnel",dawnline:"sunrise",portal:"globe"};function pl(n){return{info:_("info"),up:_("up"),down:_("down"),repair:_("repair"),error:_("error")}[n]??n}function ul(n){let e=Cs(n.msg,n.kind,n.who),o=_("You");if(!e)return[t("span",{class:"dl-you"},o),t("span",{class:"dl-muted"},` ${n.msg} `),n.kind?t("span",{class:"dl-ev-kind"},`${n.kind} `):"",n.who?t("b",{},n.who):""];let s=(e.named?ae(e.text,t("b",{},Ls(n.msg,n.who??""))):[e.text]).map(a=>typeof a=="string"?t("span",{class:"dl-muted"},a):a),r=s[0]?.textContent??"";return r.startsWith(`${o} `)?[t("span",{class:"dl-you"},o),t("span",{class:"dl-muted"},r.slice(o.length)),...s.slice(1)]:s}var Sr=n=>n.split(` +`),_("Log copied"))),h(!0)]),q(`${Dn(s)??_("Update","noun")}: ${E.error??_("failed")}`,"error"),e.onDone?.(C),E;if(d.className="dl-pill ok",d.textContent=_("Finished"),r&&C){let x=Cr(C,s);if(dom.content(u,t("div",{class:`dl-comp-status ${x.tone}`},[v(x.tone==="ok"?"check":x.tone==="warn"?"alert":"download"),t("span",{},x.text)])),q(x.text,x.tone==="warn"?"warning":"success"),e.onDone?.(C),x.update&&e.onUpdate){let T=C;g([h(),A(m(_("Update to %s"),x.update),()=>e.onUpdate(T),"positive")])}else g([h()]),x.tone==="ok"&&setTimeout(()=>u.isConnected&&ce(),1200);return E}let z=/^app:(lang:|nolang$)/.exec(E.component??"");if(z){let x=()=>{ui.menu?.flushCache(),location.reload()};return dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},[t("b",{},z[1]==="nolang"?_("The translation is removed."):_("The translation is installed."))," ",_("Reloading the page…")])])),g([h(),A(_("Reload now"),x,"positive")]),await $o(4e3),u.isConnected&&x(),E}if(s==="app"&&E.to){let x=E.to,T=t("span",{},_("Waiting for the router to restart its services…"));dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},[t("b",{},m(_("Dawnline %s is installed."),x))," ",T])]));let I=()=>{ui.menu?.flushCache(),location.reload()};g([h(),A(_("Reload now"),I,"positive")]),q(m(_("Dawnline updated to %s"),x),"success",6e3);for(let V=1;V<=30;V++)if(T.textContent=m(_("Waiting for the router to restart its services (%s of 30)…"),V),await $o(1500),(await N.updatesStatus().catch(()=>null))?.version===x)return T.textContent=_("Services are back. Reloading…"),setTimeout(I,800),E;return T.textContent=_("Services restarted. Reload the page to use the new version."),E}let k=[...E.result?.pkgs?.updated??[],...E.result?.pkgs?.installed??[]],f=s==="pkgs"?k.length?m(_("Updated %s"),k.join(", ")):_("Updated system packages"):s==="amneziawg"?E.to?m(_("AmneziaWG %s is installed"),E.to):_("AmneziaWG is installed"):_("Operation completed");return dom.content(u,t("div",{class:"dl-comp-status ok"},[v("check"),t("span",{},f)])),g([h()]),q(f,"success"),e.onDone?.(C),E}function el(n){return{https:[_("Install HTTPS for the portal?"),_("Installing HTTPS for the portal")],acme:[_("Install ACME certificates?"),_("Installing ACME certificates")],home:[_("Install the home-like link?"),_("Installing the home-like link")],awg:[_("Install AmneziaWG?"),_("Installing AmneziaWG")]}[n]}async function Mr(n,e,o,s){let[r,a]=el(e);return!await me(r,o,_("Install"))||(await tn(n,{title:a}))?.state!=="done"?!1:(setTimeout(()=>s?.(),4e3),!0)}function Nn(n){return Mr("amneziawg:auto","awg",_("Dawnline installs the AmneziaWG build made for this firmware and loads it. If the network service has to restart to learn it, connections drop for a few seconds."),n)}async function nn(n,e,o){return n==="awg"?Nn(o):e.length?Mr(`pkgs:${e.join(",")}`,n,m(_("%s from the OpenWrt feeds. Dawnline sets the rest up when they arrive."),e.join(", ")),o):!0}async function Er(n,e){if(n==="awg")return Nn(e);let o=await F(()=>N.updatesStatus());return o?nn(n,o.needs?.[n]??[],e):!1}var tl=()=>[["wan","WAN"],["ethernet","Ethernet"],["wifi","Wi-Fi"],["vpn",_("VPN & tunnels")],["other",_("Other")]],nl={wan:"globe",ethernet:"ethernet",bridge:"bridge",wifi:"wifi",vpn:"tunnel",other:"link"};function Tr(n,e,o){let s=n.id,r=e,a=t("div",{class:"dl-stack gap16"},t("section",{class:"dl-setsec"},t("div",{class:"dl-setsec-body"},t("p",{class:"dl-muted"},_("Loading interfaces…"))))),i,l=!0,d="",c=!0,p=!0,u="all",w=!1,M=xr(r,s,o),g=new Set,h="",E=()=>JSON.stringify([p,l,l?"":d,c,[...g].sort()]),H=()=>i.detected.lan||i.saved.lan||"",S=()=>(l?i.detected.wan||i.saved.wan:d)||"",$=()=>new Map(i.devices.map(B=>[B.name,B])),b=()=>{let B=$();return[...c&&H()?[H()]:[],...[...g].filter(ne=>ne!==H())].filter(ne=>ne!==S()).map(ne=>B.get(ne)??{name:ne,nets:[],missing:!0})},C=(B,Q)=>{i=B,Q&&(l=B.config.auto_wan,d=B.config.wan_device||B.detected.wan||B.saved.wan||"",c=B.config.auto_lan,p=B.config.lan_like,u=B.config.mesh??(B.config.device_mesh?"all":"off"),g=new Set(B.config.lan_devices),h=E()),J()},y=async B=>{let Q=await N.interfaces(s).catch(ne=>(q(ne.message,"error"),null));Q&&C(Q,B)};function z(B){let Q=c&&B.name===H(),ne=!!B.own||!!B.master||B.name===S()||Q;return Q||g.has(B.name)||!ne&&(B.nets.length>0||!!B.missing)}function k(B){let Q=c&&B.name===H(),ne=B.name===S(),fe=!Q&&g.has(B.name),j=!(!!B.own||!!B.master||ne||Q)&&(B.nets.length>0||fe||!!B.missing),Y=(fe||Q)&&!B.zone&&!B.missing,ie=B.missing?_("Not present right now"):B.own?_("This server"):B.master?m(_("Port of %s"),B.master):ne?`${_("Internet")}${B.zone?` · ${m(_("zone %s"),B.zone)}`:""}`:B.nets.length?B.nets.join(", "):_("No IPv4 network"),ve=t("button",{type:"button",class:`dl-if${fe?" sel":""}${Q?" auto":""}${!j&&!fe&&!Q?" off":""}${Y?" warn":""}`,"aria-pressed":fe||Q?"true":"false","aria-disabled":j?null:"true",click:()=>{j&&(g.has(B.name)?g.delete(B.name):g.add(B.name),J())}},[t("span",{class:"dl-if-ic"},v(nl[B.kind]??"link")),t("span",{class:"dl-if-main"},[t("span",{class:"dl-if-name"},B.name),t("span",{class:"dl-if-sub"},ie)]),Q?t("span",{class:"dl-if-badge ok"},_("Auto")):fe?t("span",{class:"dl-if-check"},v("check")):""]);return we(ve,()=>[t("div",{class:"dl-tip-title"},B.name),t("div",{class:"dl-muted"},[B.logical?m(_("Interface %s"),B.logical):_("No netifd interface")," · ",B.zone?m(_("zone %s"),B.zone):_("no firewall zone")]),B.members.length?t("div",{class:"dl-muted"},m(_("Ports: %s"),B.members.join(", "))):"",B.nets.length?t("div",{class:"dl-mono"},B.nets.join(", ")):"",Y?t("div",{class:"dl-warn"},_("Not in a firewall zone: the firewall rejects this traffic.")):"",B.master?t("div",{class:"dl-muted"},m(_("Choose %s to include it."),B.master)):""]),ve}function f(){let B=i.like_home;return!p||!i.config.lan_like||!n.enabled?"":!i.needs?.length&&B.active&&B.bridged?"ok":"warn"}function x(){let B=i.like_home;return p?i.needs?.length?[t("span",{class:"dl-warn"},m(_("Needs %s."),new Intl.ListFormat(le(),{type:"conjunction"}).format(i.needs)))," ",_("Until they are installed, internet traffic goes straight to the WAN.")]:i.config.lan_like?n.enabled?B.active&&B.bridged?ae(_("Internet traffic enters %s as %s, so whatever handles home traffic (proxies, filters, DNS) handles it too."),t("span",{class:"dl-mono"},B.dev??""),t("span",{class:"dl-mono"},B.address??"")):[t("span",{class:"dl-warn"},m(_("Not working: %s"),B.error??_("the link is down")))," ",_("Internet traffic goes straight to the WAN for now.")]:[_("Internet traffic enters the router from your LAN, so whatever handles home traffic (proxies, filters, DNS) handles it too.")]:[_("Internet traffic will enter the router from your LAN, so it is handled like any home device. Save to turn on.")]:[_("Off: internet traffic goes straight to the WAN, past whatever handles home traffic on this router.")]}let T=B=>({off:_("Devices of different people never reach each other; a person's own devices don't either."),all:_("Devices of people with home access reach each other, like home devices do. Internet-only people never."),circles:_("Within a circle: family sees family, guests see guests. Everyone reaches their own devices. Internet-only people never.")})[B];function I(B,Q,ne,fe,oe="",j){return t("div",{class:j?"dl-setrow head":"dl-setrow"},[t("div",{class:"dl-lh-main"},[t("span",{class:`dl-need-ic ${oe}`},v(B)),t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},Q),t("span",{class:"dl-sub"},ne),j??""])]),t("div",{class:"dl-setrow-ctl"},fe)])}let V=(B,Q)=>{let ne=fe=>t("span",{class:"dl-mono"},fe);return B?t("span",{},[" ",...Q&&Q!==B?ae(_("Now: %s, was %s."),ne(B),ne(Q)):ae(_("Now: %s."),ne(B))]):t("span",{},[" ",...Q?ae(_("Not found now: using %s."),ne(Q)):[_("Not found.")]])};function J(){let B=t("select",{class:"cbi-input-select","aria-label":_("Internet interface"),change:D=>{d=D.target.value,J()}},i.devices.filter(D=>!D.own&&!D.master&&D.zone&&!D.missing).map(D=>t("option",{value:D.name,selected:D.name===d?"selected":null},`${D.name} · ${m(_("zone %s"),D.zone)}`))),ne=b().flatMap(D=>D.nets.map(G=>[G,D.name])),fe=JSON.parse(E()),oe=JSON.parse(h),j=(...D)=>D.some(G=>JSON.stringify(fe[G])!==JSON.stringify(oe[G])),Y=j(0,1,2),ie=j(3,4),ve=D=>A(_("Save"),async()=>{let G=await F(()=>N.serverInterfaces(s,l,l?"":d,c,[...g],p,u!=="off",u),_("Access saved"));G&&(C(G,!0),G.nets_changed&&G.lan_only&&q(W(G.lan_only,"%s person has Home-only access: their devices need the configuration again to reach the new networks.","%s people have Home-only access: their devices need the configuration again to reach the new networks."),"warning",1e4))},"positive",{disabled:!D}),R=t("section",{class:"dl-setsec dl-ifcard"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Internet")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},_("People with Internet or Both"))]),I("home",_("Internet like a home device"),x(),[p&&i.needs?.length?A(_("Install"),()=>nn("home",i.needs,()=>y(!1)),"positive"):"",ye(p,_("Internet like a home device"),D=>{p=D,J()})],f()),I("globe",_("Auto-detect WAN"),[_("The interface with the default route: the server port opens there and Internet access leaves through it."),V(i.detected.wan,i.saved.wan)],[l?"":B,ye(l,_("Auto-detect WAN"),D=>{l=D,J()})])]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub"},p?[_("Internet like a home device"),S()?[" · ",...ae(_("leaves through %s"),t("span",{class:"dl-mono"},S()))]:""]:S()?ae(_("Internet straight to %s"),t("span",{class:"dl-mono"},S())):_("No WAN found")),ve(Y)])]),O=Me([["off",_("Off")],["all",_("Everyone")],["circles",_("Circles")]],u,{label:_("Devices reach each other"),cls:"sm",optimistic:!1,onChange:async D=>{let G={off:_("Off"),all:_("Everyone"),circles:_("Circles")}[D];await F(()=>N.serverUpdate(s,{mesh:D}),m(_("Devices reach each other: %s"),G))&&(u=D,i.config.mesh=D,J(),await o())}}),P=t("section",{class:"dl-setsec dl-ifcard"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Home network")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-sub"},_("People with Home or Both")),A([v("reset")," ",_("Rescan")],()=>y(!1),"neutral",{title:_("Read the interfaces again")})]),I("network",_("Networks"),_("Everyone with home access reaches these, unless their page leaves one out; their devices can be reached from here too. Click one to add or remove it."),"","",te()),I("link",_("Devices reach each other"),T(u),O,"",u==="circles"?wr(r,s,o):void 0),M.el]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub dl-if-summary"},ne.length?ae(_("Home access reaches %s"),t("span",{},ne.flatMap(([D,G],ee)=>[ee?", ":"",t("span",{class:"dl-mono"},D),` (${G})`]))):_("No home network: Home access reaches nothing but this router.")),ve(ie)])]),U=window.scrollY;a.style.minHeight=`${a.offsetHeight}px`,dom.content(a,[R,P]),a.style.minHeight="",window.scrollTo({top:U})}function te(){let B=i.devices.filter(z),Q=i.devices.filter(ne=>!z(ne));return t("div",{class:"dl-stack gap8 dl-netpick"},[B.length?t("div",{class:"dl-ifgrid"},B.map(k)):t("span",{class:"dl-warn"},_("No home network: Home access reaches nothing but this router.")),t("label",{class:"dl-boxrow"},[t("span",{class:"dl-stack"},[t("span",{},_("Auto-detect LAN")),t("span",{class:"dl-sub"},[_("Adds the LAN this router uses."),V(i.detected.lan,i.saved.lan)])]),ye(c,_("Auto-detect LAN"),ne=>{c=ne,J()})]),Q.length?t("details",{class:"dl-params",open:w?"":null,toggle:ne=>w=ne.currentTarget.open},[t("summary",{},[v("chevron"),t("span",{},_("Other interfaces")),t("span",{class:"dl-pcount"},String(Q.length))]),t("div",{class:"dl-params-body"},[t("span",{class:"dl-sub"},_("The WAN, this server, ports and Wi-Fi of a bridge (they come with it) and interfaces without an IPv4 network.")),...tl().map(([ne,fe])=>{let oe=Q.filter(j=>j.category===ne);return oe.length?t("div",{class:"dl-ifgroup"},[t("h4",{},fe),t("div",{class:"dl-ifgrid"},oe.map(k))]):""})])]):""])}return y(!0),{el:a,update(B){r=B,M.update(B),i&&J()}}}var ol={connect:"ok",disconnect:"",roam:"",device_added:"ok",device_removed:"",person_added:"",person_removed:"",paused:"warn",resumed:"ok",expiring:"warn",expired_kept:"",portal_blocked:"bad",person_changed:"",devices_removed:"warn"},sl={devices_removed:"trash",link_changed:"link",person_added:"plus",person_removed:"trash",person_changed:"edit",paused:"pause",resumed:"play",expiring:"calendar",expired_kept:"calendar"};function rl(n,e){return e.device?n.people.flatMap(s=>s.devices).find(s=>s.id===e.device)?.kind??e.dkind??"other":sl[e.type]??"activity"}var al=n=>/^\d{4}-\d{2}-\d{2}$/.test(n)?Oe(n):n;function Do(n,e){let o=n.people.find(h=>h.id===e.person),s=o?.name??e.pname??e.person??"",r=o?.devices.find(h=>h.id===e.device)?.name??e.dname??"",a=h=>t("b",{},h),i=h=>t("span",{class:"dl-muted"},h),l=h=>t("span",{class:"dl-mono"},h),d=h=>e.hosts?.[h]?[t("span",{class:"dl-ev-host"},[t("b",{},e.hosts[h]),t("span",{class:"dl-faint"},` (${h})`)])]:[l(h)],c=(h,...E)=>ae(h,...E).map(H=>typeof H=="string"?i(H):H),p=(h,...E)=>{let H=_("You");return h.startsWith(`${H} `)?[t("span",{class:"dl-you"},H),...c(h.slice(H.length),...E)]:c(h,...E)},u=a(r?`${s} · ${r}`:s),w=ys(e),M=a(w||r||_("a device")),g=Ve(e);if(g==="admin")switch(e.type){case"device_added":return p(_("You added device %s for %s"),M,a(s));case"device_removed":return p(_("You removed device %s from %s"),M,a(s));case"paused":return p(_("You paused person %s"),a(s));case"resumed":return p(_("You resumed person %s"),a(s));case"device_changed":{let h=a(r||_("a device"));return w.startsWith("renamed from ")?[...p(_("You renamed device %s of %s"),h,a(s)),i(` · ${m(_("was %s"),w.slice(13))}`)]:w==="turned off"?p(_("You turned off device %s of %s"),h,a(s)):w==="turned on"?p(_("You turned on device %s of %s"),h,a(s)):[...p(_("You changed device %s of %s"),h,a(s)),...w?[i(` · ${w}`)]:[]]}case"device_keys":return[...p(_("You issued new keys for device %s of %s"),M,a(s)),i(` · ${_("it needs its new configuration")}`)];case"link_changed":return[...p(_("You issued a new link for person %s"),a(s)),i(` · ${_("the old link stopped working")}`)]}switch(e.type){case"connect":return[...e.detail?c(_("Device %s connected from %s"),u,t("span",{},d(e.detail))):c(_("Device %s connected"),u),...e.where?[i(` · ${e.where}`)]:[]];case"disconnect":return c(_("Device %s went offline"),u);case"roam":return c(_("Device %s changed network %s"),u,t("span",{},(e.detail??"").split(" → ").flatMap((h,E)=>E?[i(" → "),...d(h)]:d(h))));case"device_added":return c(g==="portal"?_("Person %s added device %s on their portal"):_("Person %s added device %s"),a(s),M);case"device_removed":return c(g==="portal"?_("Person %s removed device %s on their portal"):_("Person %s removed device %s"),a(s),M);case"device_keys":return c(_("Person %s issued new keys for device %s on their portal"),a(s),M);case"person_added":return p(_("You added person %s"),a(e.detail??s));case"person_removed":return p(_("You removed person %s"),a(e.detail??s));case"person_changed":return[...p(_("You changed person %s"),a(s)),...w?[i(` · ${_s(w)}`)]:[]];case"expiring":{let h=ks(e.detail??"");return h!=null?c(N_(h,"Person %s’s access ends in %s day","Person %s’s access ends in %s days"),a(s),i(K(h))):c(_("Person %s’s access ends in a few days"),a(s))}case"expired_kept":return c(_("Person %s’s end date passed (%s) · access kept"),a(s),i(al(e.detail??"")));case"paused":return e.detail?c(_("Person %s paused - %s"),a(s),i(po(e.detail))):c(_("Person %s paused"),a(s));case"resumed":return e.detail&&e.detail!=="active"?c(_("Person %s resumed - %s"),a(s),i(po(e.detail))):c(_("Person %s resumed"),a(s));case"portal_blocked":return c(_("%s blocked %s for 15 min after too many wrong codes"),t("b",{class:"dl-sys-src"},_("Personal portal")),e.detail==="all Cloudflare visitors"?i(_("all Cloudflare visitors")):l(e.detail??""));case"devices_removed":return c(_("Person %s - all devices removed, end date reached"),a(s));default:return[i(`${e.type}${e.detail?`: ${e.detail}`:""}`)]}}var il={portal_blocked:["globe","bad"]};function ll(n,e){if(n.servers.length<2||!e.person)return"";let o=n.people.find(r=>r.id===e.person),s=o&&n.servers.find(r=>r.id===o.server);return s?t("span",{class:"dl-ev-srv",title:_("Server")},s.name):""}function ht(n,e,o={}){let s=il[e.type],r=Ve(e);return t("div",{class:`dl-row${r==="admin"?" dl-ev-by-admin":s?` dl-ev-by-system ${s[1]}`:""}`},[r==="admin"?t("span",{class:"dl-ev-tile",title:_("Done by you in LuCI")},v("admin")):s?t("span",{class:"dl-ev-tile sys"},v(s[0])):t("span",{class:`dl-ev-tile ev ${ol[e.type]??""}`},v(rl(n,e))),t("span",{class:"dl-row-main"},Do(n,e)),o.server===!1?"":ll(n,e),t("span",{class:"dl-faint dl-nowrap",title:new Date(e.ts*1e3).toLocaleString(le())},o.time??pe(e.ts,n.now))])}var dl={info:"",up:"ok",down:"warn",repair:"warn",error:"bad"},cl={awg:"tunnel",dawnline:"sunrise",portal:"globe"};function pl(n){return{info:_("info"),up:_("up"),down:_("down"),repair:_("repair"),error:_("error")}[n]??n}function ul(n){let e=Cs(n.msg,n.kind,n.who),o=_("You");if(!e)return[t("span",{class:"dl-you"},o),t("span",{class:"dl-muted"},` ${n.msg} `),n.kind?t("span",{class:"dl-ev-kind"},`${n.kind} `):"",n.who?t("b",{},n.who):""];let s=(e.named?ae(e.text,t("b",{},Ls(n.msg,n.who??""))):[e.text]).map(a=>typeof a=="string"?t("span",{class:"dl-muted"},a):a),r=s[0]?.textContent??"";return r.startsWith(`${o} `)?[t("span",{class:"dl-you"},o),t("span",{class:"dl-muted"},r.slice(o.length)),...s.slice(1)]:s}var Sr=n=>n.split(` `).map(e=>At(e)).join(` -`);function Hn(n,e,o,s){let r=n.by==="admin",a=At(n.msg),i=t("div",{class:`dl-row dl-slog-row ${r?"dl-ev-by-admin":`dl-ev-by-system ${dl[n.level]??""}`}${n.detail?" has-detail":""}`},[r?t("span",{class:"dl-ev-tile",title:_("Done by you in LuCI")},v("admin")):t("span",{class:"dl-ev-tile sys",title:pl(n.level)},v(cl[n.src]??"zap")),t("span",{class:"dl-row-main"},r?[...ul(n),n.note?t("span",{class:"dl-muted"},` · ${Ms(n.note)}`):"",n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},v("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},Sr(n.detail)):""]:[n.src==="awg"&&n.who&&n.who!=="AmneziaWG"?t("span",{class:"dl-ev-kind"},`${_("Server")} `):"",t("b",{class:"dl-sys-src",title:Ft(n.src)},n.who?n.src==="awg"?n.who:At(n.who):Ft(n.src)),/^[:,]/.test(a)?"":" ",t("span",{class:"dl-muted"},a),n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},v("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},Sr(n.detail)):""]),t("span",{class:"dl-faint dl-nowrap",title:new Date(n.ts*1e3).toLocaleString(ie())},s)]);return n.detail&&i.addEventListener("click",l=>{l.target.closest("pre")||o()}),i}function Pr(n){let e=new Date(n*1e3),o=new Date,s=new Date;if(s.setDate(o.getDate()-1),e.toDateString()===o.toDateString())return _("Today");if(e.toDateString()===s.toDateString())return _("Yesterday");let r=e.toLocaleDateString(ie(),{weekday:"long",day:"numeric",month:"long"});return r.charAt(0).toLocaleUpperCase(ie())+r.slice(1)}var Ot=n=>Mt(n).toLocaleDateString(ie(),{day:"numeric",month:"short"});function zn(n,e,o,s=!1){let r=n.slice(-15),a=r[r.length-1],i=a&&e-a[0]<180,l=i?a[2]:0,d=i?a[1]:0,[c,p]=o,u=200,k=40,M=Math.max(1,...r.map($=>Math.max($[1],$[2]))),g=$=>r.map((b,C)=>`${r.length>1?C/(r.length-1)*u:u},${k-2-b[$]/M*(k-6)}`),h=g(2),E=g(1),H=r.length>1&&!s?Tt(``):t("div",{class:"dl-speed-wait"},[t("i"),s?"":t("span",{},_("Collecting… 1 point a minute"))]),S=($,b,C,w)=>t("div",{class:"dl-speed-col"},[t("span",{class:"dl-sub"},[t("span",{class:C},b),` ${$}`]),s?t("span",{class:"dl-speed-val off"},"—"):t("span",{class:"dl-speed-val"},Fe(w))]);return r.length>1&&!s&&we(H,()=>{let $=r[r.length-1];return[t("div",{class:"dl-tip-title"},new Date($[0]*1e3).toLocaleTimeString(ie(),{hour:"2-digit",minute:"2-digit"})),t("div",{},`↓ ${Fe($[2])} · ↑ ${Fe($[1])}`)]}),t("div",{class:"dl-bento-tile"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},_("Speed now")),s?"":t("span",{class:"dl-sub"},_("last 15 min"))]),t("div",{class:"dl-speed-cols"},[S(_("Download","speed"),"↓","dl-dn",l),S(_("Upload","speed"),"↑","dl-up",d)]),H,t("div",{class:"dl-speed-today"},[t("span",{},ae(_("Today %s"),t("b",{},oe(c+p)))),t("span",{},[t("span",{class:"dl-dn"},"↓"),` ${oe(p)} `,t("span",{class:"dl-up"},"↑"),` ${oe(c)}`])])])}function Rn(n,e){let o=n.slice(-30),s=o.map(d=>d.rx+d.tx),r=Math.max(1,...s),a=s.reduce((d,c)=>d+c,0),i=s.reduce((d,c,p)=>c>s[d]?p:d,0),l=t("div",{class:"dl-bento-bars"},o.map((d,c)=>{let p=s[c],u=t("i",{class:c===o.length-1?"hi":"",style:`height:${Math.max(4,p/r*100)}%`});return we(u,()=>[t("div",{class:"dl-tip-title"},c===o.length-1?`${_("Today")} · ${Ot(d.day)}`:Ot(d.day)),t("div",{},oe(p)),t("div",{class:"dl-muted dl-mono"},`↓ ${oe(d.tx)} ↑ ${oe(d.rx)}`)]),u}));return t("div",{class:"dl-bento-tile month"},[t("div",{class:"dl-bento-head"},[t("span",{},[t("span",{class:"dl-metric-label"},_("Last 30 days")),t("b",{class:"dl-bento-total"},oe(a))]),s[i]>0?t("span",{class:"dl-sub"},`${m(_("peak %s"),oe(s[i]))} · ${Ot(o[i].day)}`):""]),o.length?l:t("p",{class:"dl-muted"},_("No traffic yet.")),t("div",{class:"dl-bento-head"},[t("span",{class:"dl-sub"},o.length?Ot(o[0].day):""),t("span",{class:"dl-sub"},e),t("span",{class:"dl-sub"},_("today"))])])}function $r(n){let e=n.slice(-30),o=e.map(r=>r.rx+r.tx),s=Math.max(1,...o);return t("div",{class:"dl-dbars"},e.map((r,a)=>{let i=t("i",{class:`${o[a]?"":"zero"}${a===e.length-1?" hi":""}`});return i.style.height=`${Math.max(8,o[a]/s*100)}%`,we(i,()=>[t("div",{class:"dl-tip-title"},a===e.length-1?`${_("Today")} · ${Ot(r.day)}`:Ot(r.day)),t("div",{},oe(o[a]))]),i}))}function Dr(n){return{apply:_("Repair"),sync:_("Reload devices"),restart:_("Restart service"),netrestart:_("Restart network"),updates:_("Open Components")}[n]??_("Fix")}async function In(n){return n==="netrestart"&&!await me(_("Restart the network?"),_("Every interface restarts. Connections drop for a few seconds."),_("Restart network"))?null:await F(()=>N.healthFix(n),_("Done"))??null}function Ao(n,e,o,s="action"){let r=n.fix;return r?r.startsWith("install:")?A(_("Install"),()=>Er(r.slice(8),o),s):r==="updates"?t("a",{class:`cbi-button cbi-button-${s}`,href:L.url("admin/network/dawnline/updates")},Dr(r)):A(Dr(r),()=>e(r),s):""}function ml(n){return/^(awg|up_|peers_|fw_|reply_|port_|subnet_)/.test(n)?"shield":/^(portal|cert)/.test(n)?"link":/^(ep_|home_|resolver)/.test(n)?"globe":n==="clock"?"clock":n==="agent"?"activity":n==="flash"?"download":n==="nft"?"lock":n==="data"?"users":"alert"}function Ar(n,e,o,s=3){let r=n.filter(i=>i.status==="error"||i.status==="warn").sort((i,l)=>i.status===l.status?0:i.status==="error"?-1:1);if(!r.length)return"";let a=r.length-s;return t("div",{class:"dl-list dl-notices"},[...r.slice(0,s).map(i=>it(ml(i.id),i.status==="error"?"bad":"warn",i.problem??i.title,i.detail,Ao(i,e,o,i.status==="error"?"positive":"neutral"))),a>0?t("a",{class:"dl-row dl-notices-more",href:L.url("admin/network/dawnline/diagnostics")},[m(_("%s more in Diagnostics"),K(a)),t("span",{class:"dl-spacer"}),"→"]):""])}function hl(n){let e=[],o=(l,d)=>t("a",{href:l},d),s=()=>o(L.url("admin/network/dawnline/diagnostics"),_("Open Diagnostics")),r=Ge(n.series),a=!!n.awg_state&&!n.awg_state.ok;for(let l of n.servers)l.enabled&&l.blocked?e.push({tone:"bad",text:[l.blocked," ",s()]}):l.enabled&&!l.up&&!a&&e.push({tone:"bad",text:[m(_("Tunnel %s is down."),l.ifname)," ",s()]});for(let l of n.people){let d=()=>o(Re(l.id),l.name);if(l.state==="quota")e.push({tone:"warn",text:ae(_("%s reached the data limit."),d())});else if(l.state==="expired")e.push({tone:"warn",text:ae(_("%s’s access has ended."),d())});else{let c=st(l.expires,r);rt(l,c)?e.push({tone:"",text:ae(_("%s’s access %s."),d(),an(c))}):c!=null&&c<0&&l.expire_action==="notify"&&e.push({tone:"",text:ae(_("%s’s end date passed (%s) · access kept."),d(),De(l.expires))}),l.quota_limit&&l.quota_used>=l.quota_limit*.9&&e.push({tone:"",text:ae(_("%s has used 90% of the data limit."),d())})}}let i=n.people.flatMap(l=>l.devices.filter(d=>d.config_stale).map(d=>[l,d]));i.length&&e.push({tone:"warn",text:i.length===1?ae(_("%s needs its configuration again."),o(Re(i[0][0].id,i[0][1].id),`${i[0][0].name} · ${i[0][1].name}`)):[W(i.length,"%s device needs its configuration again (networks or DNS changed).","%s devices need their configuration again (networks or DNS changed).")]});for(let l of n.servers)n.wan&&Dt(l.endpoint)&&l.endpoint!==n.wan&&e.push({tone:"warn",text:[m(_("Public address changed: %s still gives devices %s, the router is %s now."),l.name,l.endpoint,n.wan)," ",t("button",{type:"button",class:"dl-fix",click:async d=>{let c=d.currentTarget;c.disabled=!0,await F(()=>N.serverUpdate(l.id,{endpoint:n.wan}),m(_("%s uses %s now - devices need their configuration again"),l.name,n.wan)),c.disabled=!1}},_("Use the new address"))," ",_("A DDNS name would follow it by itself.")]});return n.servers.some(l=>l.lan_like)&&n.like_home.error&&e.push({tone:"warn",text:[m(_("Internet through the LAN is off: %s"),n.like_home.error)," ",o(L.url("admin/network/dawnline/diagnostics"),_("Details"))]}),!n.settings.portal_enabled&&!n.people.length&&e.push({tone:"",text:[_("The personal portal is off.")," ",o(L.url("admin/network/dawnline/settings"),_("Turn on"))]}),e}var Bn=class{constructor(e,o){this.srvId=e;this.go=o;this.el=t("div",{class:"dl-srvov"});this.map=null;this.mapOn=null;this.range="online";this.parts={};this.healthAt=0}mount(e){this.st=en(e,this.srvId);for(let o of["health","bento","map","side","activity"])this.parts[o]=t("div",{});return dom.content(this.el,[this.parts.health,this.parts.bento,this.parts.map,t("div",{class:"dl-grid2"},[this.parts.activity,this.parts.side])]),this.paint(),this.loadHealth(),this.el}update(e,o=!1){this.st=en(e,this.srvId),this.paint(o),Date.now()-this.healthAt>6e4&&this.loadHealth()}async loadHealth(){this.healthAt=Date.now();let e=await N.health().catch(()=>null);if(!e)return;let o=()=>void this.loadHealth(),s=async r=>{await In(r)&&(o(),r==="netrestart"&&setTimeout(o,5e3))};Ae(this.parts.health,Ar(e.checks,r=>void s(r),o),!0)}mapData(){return{geo:this.st.geo,people:this.st.people,now:this.st.now}}paintMap(){let e=this.st.geo.enabled;if(e===this.mapOn&&(!e||this.map)){this.map?.update(this.mapData());return}this.mapOn=e,dom.content(this.parts.map,this.mapCard())}mapCard(){let e=this.st,o=t("div",{class:"dl-panel-head pad"},[t("div",{class:"dl-stack"},[t("h3",{},_("Where people connect from")),t("span",{class:"dl-sub"},_("City-level, from the client IP · locations cached on the router"))]),t("span",{class:"dl-spacer"}),Rt(this.range,l=>{this.range=l,this.map?.setRange(l)})]);if(this.map?.destroy(),this.map=null,!e.geo.enabled)return t("div",{class:"dl-panel flush"},[o,t("div",{class:"dl-map-off"},ae(_("Locations are off. %s."),t("a",{href:L.url("admin/network/dawnline/settings")},_("Turn them on in Settings"))))]);let s=this.map=new dt({openPerson:l=>location.href=Re(l),openDevice:(l,d)=>location.href=Re(l,d)},this.range),r=Te(()=>{r(),s.destroy(),this.map===s&&(this.map=null)}),a=t("div",{class:"dl-map-legend"},[t("span",{},[t("i",{class:"line live"}),_("Live tunnel")]),t("span",{},[t("i",{class:"line"}),_("Seen recently")])]),i=t("div",{class:"dl-map-wrap"},[s.el,a]);return requestAnimationFrame(()=>s.mount(this.mapData())),t("div",{class:"dl-panel flush"},[o,i])}paint(e=!1){let o=this.st,s=o.servers[0];this.paintMap(),Ae(this.parts.bento,t("div",{class:"dl-bento"},[this.onlineTile(),this.speedTile(),qe(s).overviewTile(s),this.monthTile()]),e);let r=hl(o);Ae(this.parts.side,t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Needs attention")),t("span",{class:"dl-spacer"}),t("a",{href:L.url("admin/network/dawnline/diagnostics")},_("Health"))]),r.length?r.slice(0,8).map(i=>t("div",{class:"dl-attn-item dl-row"},[t("span",{class:`dl-ev-dot ${i.tone}`}),t("span",{},i.text),i.action??""])):t("div",{class:"dl-row dl-muted"},[v("check"),_("All good. Nothing needs you right now.")])]),e);let a=[...o.events].reverse().slice(0,8);Ae(this.parts.activity,t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Activity")),t("span",{class:"dl-spacer"}),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},_("View all"))]),a.length?a.map(i=>ht(o,i)):t("div",{class:"dl-row dl-muted"},_("Nothing yet. Connections, new devices and pauses appear here."))]),e)}onlineTile(){let e=this.st,o=e.servers[0]?!e.servers[0].enabled:!1,s=12,r=H=>H.spark[H.spark.length-1]??0,a=H=>e.geo.points.find(S=>S.device===H.id&&S.city)?.city,i=H=>/^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(H.endpoint??""),l=(H,S=!1)=>i(H)?S&&H.endpoint?`LAN · ${H.endpoint}`:"LAN":a(H)??"",d=H=>[...e.events].reverse().find(S=>S.type==="connect"&&S.device===H.id)?.ts??0,c=e.people.map(H=>({p:H,devs:H.devices.filter(S=>S.online).sort((S,$)=>r($)-r(S))})).filter(H=>H.devs.length).sort((H,S)=>S.devs.reduce(($,b)=>$+r(b),0)-H.devs.reduce(($,b)=>$+r(b),0)),p=c.length<=2,u=({p:H,devs:S})=>{let $=S.map(d).filter(Boolean),b=$.length?Math.min(...$):0,C=(H.rate??[]).slice(-15),w=C[C.length-1],z=w&&e.now-w[0]<180?w:null,y=200,f=30,x=Math.max(1,...C.map(te=>Math.max(te[1],te[2]))),T=te=>C.map((B,Q)=>`${C.length>1?Q/(C.length-1)*y:y},${f-2-B[te]/x*(f-6)}`),I=C.length>1?Tt(``):"",Y=!z||z[1]<64&&z[2]<64,J=H.access==="both"?["home","globe"]:H.access==="lan"?["home"]:["globe"];return[t("div",{class:"dl-hc"},[t("div",{class:"dl-hc-head"},[t("span",{class:"dl-onl-av sm"},je(H.name)),t("span",{class:"dl-stack"},[t("b",{},H.name),t("span",{class:"dl-hc-since"},b?m(_("online for %s"),ot(Math.max(60,e.now-b))):_("online"))]),t("span",{class:"dl-hc-reach"},J.map(te=>t("span",{class:`dl-ibadge ${te==="home"?"lan":"inet"}`},v(te))))]),t("div",{class:"dl-hc-speed"},[t("div",{class:"dl-hc-speed-row"},Y?[t("span",{class:"dl-faint"},_("Idle right now"))]:[t("span",{},[t("span",{class:"dl-dn"},"↓"),` ${Fe(z[2])}`]),t("span",{},[t("span",{class:"dl-up"},"↑"),` ${Fe(z[1])}`]),t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint"},_("15 min"))]),I]),t("div",{class:"dl-hc-devs"},S.map(te=>t("span",{class:"dl-hc-dev"},[v(te.kind),te.name,l(te)?[" · ",l(te,!0)]:""]))),t("div",{class:"dl-hc-foot"},[t("span",{class:"dl-faint"},`${m(_("%s today"),oe(S.reduce((te,B)=>te+r(B),0)))} · ${m(_("%s this month"),oe(H.month[0]+H.month[1]))}`)])])]},k=H=>{let{p:S,devs:$}=H,b=t("span",{class:"dl-onl-dev"},$.length>1?String($.length):v($[0].kind)),C=t("a",{class:`dl-onl-p${p?"":" sm"}`,href:Re(S.id),"aria-label":m(_("%s, online"),S.name)},[t("span",{class:"dl-onl-av"},[je(S.name),b]),p?t("span",{class:"dl-onl-name"},S.name):"",p?t("span",{class:"dl-onl-meta"},[...$.slice(0,3).map(w=>v(w.kind)),$.length>3?`+${$.length-3}`:"",l($[0])?t("span",{},[" · ",l($[0])]):""]):""]);return we(C,()=>u(H)),C},M=t("b",{class:`dl-onl-count${c.length?"":" none"}`},String(c.length)),g=c.reduce((H,S)=>H+S.devs.length,0);c.length&&we(M,()=>[`${W(c.length,"%s person","%s people")} · ${W(g,"%s device","%s devices")}`]);let h=c.length>s?c.slice(0,s-1):c,E=e.people.flatMap(H=>H.devices.map(S=>({p:H,d:S}))).filter(H=>H.d.handshake).sort((H,S)=>S.d.handshake-H.d.handshake)[0];return t("div",{class:"dl-bento-tile online"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},_("Online")),M]),c.length?t("div",{class:`dl-onl-row${p?"":" grid"}`},[...h.map(k),c.length>s?t("a",{class:"dl-onl-p sm more",href:`${L.url("admin/network/dawnline/server")}?server=${encodeURIComponent(this.srvId)}§ion=people&filter=online`,title:_("Everyone online"),click:H=>{this.go&&(H.preventDefault(),this.go("people","online"))}},[t("span",{class:"dl-onl-av"},`+${c.length-h.length}`)]):""]):t("div",{class:"dl-onl-empty"},[t("span",{},o?_("The server is turned off"):_("Nobody is connected")),E?t("span",{class:"dl-sub"},m(_("Last: %s, %s"),E.p.name,pe(E.d.handshake,e.now))):t("span",{class:"dl-sub"},o?_("Devices connect once it is on"):_("No device has connected yet"))])])}speedTile(){let e=this.st.servers[0];return zn(e?.rate??[],this.st.now,this.st.totals.today,e?!e.enabled:!1)}monthTile(){let e=[...this.st.people].map(o=>[o,o.month[0]+o.month[1]]).filter(([,o])=>o>0).sort((o,s)=>s[1]-o[1]).slice(0,2);return Rn(this.st.series,e.length?m(_("Most: %s"),e.map(([o,s])=>`${o.name} ${oe(s)}`).join(" · ")):"")}};var Nr=["overview","people","connection","access","awg"],fl=n=>({overview:_("Overview"),people:_("People"),connection:_("Connection"),access:_("Access")})[n],gl={general:"connection",network:"connection",interfaces:"access",advanced:"awg",disguise:"awg",tunnel:"awg",core:"awg"},No=(n,e)=>{let o=new URLSearchParams;n&&o.set("server",n),e&&e!=="overview"&&o.set("section",e);let s=o.toString();return`${L.url("admin/network/dawnline/server")}${s?`?${s}`:""}`},on=class{constructor(){this.noFooter=!0;this.root=t("div",{class:"dl-root"});this.section="overview";this.srvId="";this.ov={};this.pp={};this.tabsEl=t("div",{});this.headEl=t("div",{});this.secEl=t("div",{});this.bodyEl=t("div",{class:"dl-srvbody"})}async load(){let e=await N.status(31),o=e.servers.length?null:await N.setupDefaults();return[e,o]}render([e,o]){if(this.st=e,!e.servers.length&&o)return this.wizard(o);let s=new URLSearchParams(location.search),r=s.get("section")??"",a=gl[r]??r;return Nr.includes(a)&&(this.section=a),this.srvId=(e.servers.find(i=>i.id===s.get("server"))??e.servers[0]).id,dom.content(this.root,[this.tabsEl,this.headEl,this.secEl,this.bodyEl]),this.paint(),this.poller?.stop(),this.poller=pt({fetch:()=>N.status(31),every:30,live:!0,active:()=>this.section==="overview"&&this.root.isConnected,apply:(i,l)=>{i.servers.length&&(this.st=i,this.paintHead(l),this.ov[this.current().id]?.update(i,l))}}),this.root}paintHead(e=!1){Ae(this.headEl,this.head(this.current()),e),(!e||!Bt(this.tabsEl))&&this.paintTabs()}async refreshStatus(){let e=await N.status(31).catch(()=>null);return e?.servers.length?(this.st=e,this.paintHead(),e):null}current(){return this.st.servers.find(e=>e.id===this.srvId)??this.st.servers[0]}async refresh(){let e=await N.status(31).catch(()=>null);e&&(this.st=e,e.servers.length?this.paint():location.href=No())}paint(){this.paintTabs(),dom.content(this.headEl,this.head(this.current())),this.paintSections(),this.showSection(this.section)}paintTabs(){let e=this.current();dom.content(this.tabsEl,t("div",{class:"dl-srvtabs",role:"tablist","aria-label":_("Servers")},[...this.st.servers.map(o=>t("button",{type:"button",role:"tab",class:`dl-srvtab${o.id===e.id?" on":""}`,"aria-selected":o.id===e.id?"true":"false",click:()=>{o.id!==this.srvId&&(this.srvId=o.id,this.paint())}},[t("i",{class:`dot ${o.enabled?o.up?"ok":"bad":"warn"}`}),t("b",{},o.name)])),t("button",{type:"button",class:"dl-srvtab add",click:()=>this.addServer()},[v("plus"),_("Add server")])]))}paintSections(){let e=qe(this.current());dom.content(this.secEl,t("div",{class:"dl-seg dl-srvsections",role:"tablist","aria-label":_("Server")},Nr.map(o=>t("button",{type:"button",role:"tab","data-section":o,class:o===this.section?"on":"","aria-selected":o===this.section?"true":"false",click:()=>this.showSection(o)},o==="awg"?e.label:fl(o)))))}go(e,o){let s=this.pp[this.current().id];if(o&&s)s.filter=o,s.el&&s.decorate();else if(o){let r=this.pp[this.current().id]=new wt;r.filter=o}this.showSection(e),window.scrollTo({top:0,behavior:"smooth"})}detachKept(){let e=[...Object.values(this.ov).map(o=>o.el),...Object.values(this.pp).map(o=>o.el)];for(let o of e)o&&this.bodyEl.contains(o)&&o.remove()}showSection(e){this.section=e,this.secEl.querySelectorAll("[data-section]").forEach(i=>{let l=i.dataset.section===e;i.classList.toggle("on",l),i.setAttribute("aria-selected",l?"true":"false")});let o=this.st,s=this.current(),a={overview:()=>{let i=this.ov[s.id];return i?(i.update(o),i.el):(this.ov[s.id]=new Bn(s.id,(l,d)=>this.go(l,d))).mount(o)},people:()=>{var c,p;let i=this.pp[s.id];if(i?.el)return i.update(),i.el;let l=t("div",{},t("p",{class:"dl-muted"},_("Loading people…")));return((c=this.pp)[p=s.id]??(c[p]=new wt)).embed(o,s.id).then(u=>{l.isConnected?dom.content(l,u):l.replaceChildren(u)}).catch(u=>{delete this.pp[s.id],dom.content(l,t("p",{class:"dl-muted"},m(_("Couldn't show people: %s"),Ce(u))))}),l},connection:()=>this.connection(s),access:()=>this.access(s),awg:()=>this.awg(s)}[e]();this.detachKept(),dom.content(this.bodyEl,a)}head(e){let o=(a,i)=>t("span",{class:"dl-addrbar-seg"},[v(a),...i]),s=e.endpoint||"—",r=t("div",{class:"dl-actions"},[e.enabled?"":A([v("play"),` ${_("Turn on")}`],()=>this.save(e,{enabled:"1"},_("Server turned on")),"add")]);return t("div",{class:"dl-srvpagehead"},[t("div",{class:"dl-title-row"},[t("h2",{class:"dl-h1"},e.name),t("span",{class:`dl-pill ${e.enabled?e.up?"ok":"bad":"warn"}`},e.enabled?e.up?_("Running"):e.blocked?_("Can’t start"):_("Not running"):_("Turned off")),t("span",{class:"dl-spacer"}),r]),t("div",{class:"dl-addrbar"},[t("button",{type:"button",class:"dl-addrbar-seg main",title:_("Copy address"),click:()=>xe(s,_("Address copied"))},[v("globe"),t("span",{class:"dl-mono"},s),v("copy")]),o(qe(e).id==="awg"?"amneziawg":"tunnel",[t("span",{class:"dl-mono"},`${qe(e).label} :${e.port}`)]),e.up?o("clock",[m(_("up %s"),ot(e.uptime))]):""]),e.blocked?t("div",{class:"dl-note warn"},[v("alert"),t("span",{},e.blocked)]):""])}async save(e,o,s=_("Saved")){await F(()=>N.serverUpdate(e.id,o),s)&&await this.refresh()}connection(e){let o=he(e.name,{placeholder:_("Home")}),s=he(e.endpoint,{placeholder:"vpn.example.com",class:"cbi-input-text dl-mono"}),r=he(e.dns.join(", "),{placeholder:_("This router (recommended)"),class:"cbi-input-text dl-mono"}),a=this.st.people.filter(M=>M.server===e.id).length,i=A([v(e.enabled?"pause":"play"),` ${e.enabled?_("Turn off"):_("Turn on")}`],async()=>{e.enabled&&!await me(m(_("Turn off %s?"),e.name),W(a,"The tunnel stops and %s person is disconnected until you turn it back on. Nothing is deleted.","The tunnel stops and %s people are disconnected until you turn it back on. Nothing is deleted."),_("Turn off"),!0)||await this.save(e,{enabled:e.enabled?"0":"1"},e.enabled?_("Server turned off"):_("Server turned on"))},e.enabled?"negative":"positive"),l=this.st.settings.portal_host,d=_e(_("Name"),o,()=>He(o.value,[],_("Shown to people in their portal and apps."))),c=lo(()=>({host:s.value,port:e.port,id:e.id}),(M,g,h)=>N.endpointProbe(M,g,h),()=>p.refresh(),{empty:l?m(_("Empty = the portal’s address (%s)."),l):_("Empty = the portal’s address.")}),p=_e(_("Public address"),s,c.help);s.addEventListener("input",c.schedule),c.schedule();let u=e.reached?m(_("Reached from the internet %s."),pe(e.reached,this.st.now)):_("Never reached from the internet yet - test with a phone on mobile data."),k=_e(_("DNS for devices"),r,()=>cs(r.value,e.address));return t("div",{class:"dl-stack gap16"},[Wt(_("Connection"),[t("p",{class:"dl-muted"},_("The name people see, where devices find the router, and DNS. The port is on AmneziaWG.")),ke("router",_("Server"),_("What people see"),[d]),ke("globe",_("Devices connect to"),_("A DDNS name keeps links working when your IP changes; not through Cloudflare (use a DNS-only name or an IP)"),[p,t("div",{class:`dl-sub ${e.reached?"ok":"warn"}`},u)]),ke("file",_("For every device"),_("Changing it marks devices “Update config” until they import again"),[k])],[t("span"),A(_("Save"),()=>{let M=Ue([d,p,k]);if(M){q(M,"warning");return}return this.save(e,{name:o.value,endpoint:s.value,dns:r.value})},"positive")]),Wt(_("Danger zone"),[t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},e.enabled?_("Turn off this server"):_("This server is off")),t("span",{class:"dl-sub"},e.enabled?_("Stops the tunnel and disconnects everyone on it. Settings and people are kept."):_("Nobody can connect. Turn it on to bring the tunnel back."))]),t("div",{class:"dl-setrow-ctl"},i)]),t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},_("Change the tunnel network")),t("span",{class:"dl-sub"},m(_("Devices have %s addresses now. A new range when it clashes with a network you connect to; every device then needs its configuration again."),`${$t(e.subnet)}.x`))]),t("div",{class:"dl-setrow-ctl"},A([v("edit"),` ${_("Change")}`],()=>this.changeSubnet(e),"negative"))]),t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},_("Remove server")),t("span",{class:"dl-sub"},W(a,"Removes the tunnel, its firewall rules and %s person with all their devices. A backup is made first.","Removes the tunnel, its firewall rules and %s people with all their devices. A backup is made first."))]),t("div",{class:"dl-setrow-ctl"},A([v("trash"),` ${_("Remove")}`],()=>this.remove(e),"negative"))])],[],"danger")])}access(e){let o=Po(this.st,e),s=Tr(e,this.st,async()=>{let r=await this.refreshStatus();if(!r)return;let a=r.servers.find(l=>l.id===e.id)??e;s.update(r);let i=Po(r,a);o.replaceWith(i),o=i});return t("div",{class:"dl-stack gap16"},[s.el,t("div",{class:"dl-health-cols"},[o,yr(this.st,e)])])}awg(e){let o={st:this.st,save:(s,r)=>this.save(e,s,r),refresh:()=>this.refresh()};return t("div",{class:"dl-stack gap16"},[qe(e).settingsCard(o,e)])}async addServer(){let e=await F(()=>N.setupDefaults());e&&dom.content(this.root,this.wizard(e,!0,()=>{dom.content(this.root,[this.tabsEl,this.headEl,this.secEl,this.bodyEl]),this.paint()}))}async changeSubnet(e){let o=await F(()=>N.serverPorts(e.id));if(!o)return;let s=o.networks??[],r=this.st.people.filter(l=>l.server===e.id).reduce((l,d)=>l+d.devices.length,0),a=he($t(e.subnet),{class:"cbi-input-text dl-mono dl-w-range"}),i=_e(_("Address range"),a,()=>ao(a.value,s,""));de(_("Change the tunnel network"),[i,t("p",{class:"dl-muted"},r?W(r,"%s device gets a new address and stops connecting until it imports its configuration again (from their personal link or from you).","%s devices get new addresses and stop connecting until they import their configuration again (from their personal link or from you)."):_("No devices on this server yet: nothing else changes."))],[ue()," ",A(_("Change"),async()=>{let l=i.help();if(l.bad){q(l.text,"warning");return}let d=mn(a.value);if(d===e.subnet){ce();return}await F(()=>N.serverUpdate(e.id,{subnet:d}),_("Tunnel network changed"))&&(ce(),r&&q(_("Devices are marked “Update config” until they import again."),"info",6e3),await this.refresh())},"negative")]),setTimeout(()=>a.select(),50)}async remove(e){let o=this.st.people.filter(s=>s.server===e.id);de(m(_("Remove %s?"),e.name),[t("p",{},W(o.length,"This removes the tunnel, its firewall rules and %s person with all their devices. A backup is made first.","This removes the tunnel, its firewall rules and %s people with all their devices. A backup is made first."))],[ue()," ",A(_("Remove"),async()=>{ce(),await F(()=>N.serverDelete(e.id),_("Server removed"))&&setTimeout(()=>{location.href=No()},800)},"negative")])}wizard(e,o=!1,s){let r={id:e.id,name:e.name,endpoint:e.endpoint,port:e.port,range:$t(e.subnet),preset:wn(e.awg),portal:!1,portal_port:e.portal_port||8443,lan_like:!0,lan_zone:e.lan_zone,wan_zone:e.wan_zone},a=0,i=!o&&r.portal_port===r.port,l=()=>/^\d{1,3}(\.\d{1,3}){3}$/.test(r.endpoint),d=()=>Gt(r.port,e.udp_taken??[],r.port===4500?`${_("Opened on the WAN firewall automatically.")} ${_("4500 is IPsec’s port: most networks let it through.")}`:_("Opened on the WAN firewall automatically.")),c={ddns:_("From your DDNS name."),cert:_("From your Let’s Encrypt certificate."),wan:_("Your WAN address now - it may change; a DDNS name is better."),portal:_("The portal’s address.")},p=lo(()=>({host:r.endpoint,port:r.port}),(x,T,I)=>N.endpointProbe(x,"",I),()=>u?.refresh(),{idle:()=>r.endpoint===e.endpoint&&e.endpoint_from?c[e.endpoint_from]??"":""}),u=null,k=e.wan_kind==="cgnat"||e.wan_kind==="private"?it("alert","warn",e.wan_kind==="cgnat"?_("Your router has no public address (CGNAT)"):m(_("Your router is behind another router (WAN %s)"),e.wan_ip),e.wan_kind==="cgnat"?_("The ISP shares one address: devices can only connect if the ISP gives you a public address or IPv6. Ask them, or use a DDNS name that points at an IPv6 address."):_("Forward the UDP port on the upstream router to this one and use a DDNS name or that router’s public address here."),""):"",M=e.awg_state?.tools&&e.awg_state.handler===!1?t("div",{class:"dl-note warn"},[v("alert"),t("span",{},_("Creating the server restarts the network for a few seconds: AmneziaWG was installed after the network started."))]):"",g=()=>ao(r.range,e.networks??[],$t(e.subnet)),h=()=>hn(r.portal_port,e.tcp_taken??[],l()),E=t("div",{class:"dl-wizard"}),H=(x,T={})=>{let I=he(String(r[x]),T);return I.addEventListener("input",()=>{x==="port"||x==="portal_port"?r[x]=I.value.trim()===""?0:Number(I.value):r[x]=I.value.trim(),x==="port"&&i&&(r.portal_port=r.port),x==="portal_port"&&(i=r.portal_port===r.port)}),I},S={id:"server",title:_("Server"),render:()=>t("div",{class:"dl-wizard-groups"},[t("p",{class:"dl-muted"},o?_("One more server: another port or disguise for networks where the first does not get through, or its own home access rules. People are moved between servers from their page."):_("Where devices connect to. A hostname that always points at your router (DDNS) keeps links working when your IP changes.")),ke("router",_("Server"),_("What people see"),[_e(_("Name"),H("name"),()=>He(r.name,[],_("Shown to people in their portal and apps.")))]),ke("globe",_("Devices connect to"),_("A hostname or IP address of your router on the internet; not through Cloudflare (use a DNS-only name or an IP). IPv6 works too, and is the way out of CGNAT"),[(()=>{let x=H("endpoint",{placeholder:"vpn.example.com",class:"cbi-input-text dl-mono"});return u=_e(_("Public address"),x,p.help),x.addEventListener("input",p.schedule),p.schedule(),u})()]),k,M]),check:()=>{let x=He(r.name);if(x.bad)return m(_("Name: %s"),x.text);let T=Pt(r.endpoint,r.port);return T.bad?m(_("Public address: %s"),T.text):null}},$={id:"awg",title:"AmneziaWG",render:()=>t("div",{class:"dl-wizard-groups"},[ke("globe",_("Listening"),_("Where devices reach AmneziaWG from the internet"),[_e(_("UDP port"),H("port",{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),d)]),ke("network",_("Tunnel network"),_("Addresses devices get inside the tunnel"),[(()=>{let x=H("range",{class:"cbi-input-text dl-w-range dl-mono","aria-label":_("First three numbers of the device addresses")});return _e(_("Device addresses"),x,g,t("span",{class:"dl-suffixed"},[x,t("span",{class:"dl-mono"},".x")]))})()]),ke("shield",_("Disguise"),_("So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard"),[yn(e.awg,r.preset,x=>r.preset=x,void 0,e.awg_state?.tools!==!1)])]),check:()=>{let x=d();if(x.bad)return m(_("UDP port: %s"),x.text);let T=g();return T.bad?m(_("Device addresses: %s"),T.text):null}},b={id:"portal",title:_("Portal"),render:()=>{let x=H("portal_port",{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),T=_e(_("Listening port"),x,h);T.hidden=!r.portal;let I=Me([["off",_("Off")],["on",_("On")]],r.portal?"on":"off",{label:_("Personal portal"),onChange:Y=>{r.portal=Y==="on",T.hidden=!r.portal}});return t("div",{class:"dl-wizard-groups"},[ke("home",_("Internet like a home device"),_("How devices reach the internet"),[ge(_("Through the home network"),ye(r.lan_like,_("Internet like a home device"),Y=>r.lan_like=Y),_("Whatever handles home traffic on this router (proxies, filters, DNS) handles theirs too. Change it later under Servers → Access."))]),ke("link",_("Personal portal"),_("A page where each person adds their own devices with their personal link"),[ge(_("Portal"),I,_("Off: only you add devices, from LuCI. On: people manage their devices within the limits you set.")),T])])},check:()=>{if(!r.portal)return null;let x=h();return x.bad?m(_("Portal port: %s"),x.text):null}},C=()=>[S,$,o?null:b].filter(x=>x!=null),w=e.awg_state,z=w?.missing??[],y=z.length?t("div",{class:"dl-list dl-notices"},[it("shield","bad",_("AmneziaWG isn’t installed"),m(_("The tunnel needs %s. Install the build made for this firmware, then create the server."),new Intl.ListFormat(ie(),{type:"conjunction"}).format(z)),A(_("Install"),()=>Nn(()=>location.reload()),"positive"))]):w&&!w.loaded?t("div",{class:"dl-list dl-notices"},[it("shield","warn",_("AmneziaWG’s kernel module doesn’t load on this firmware"),_("Try another build in Components, or update OpenWrt. The server can’t start until it loads."),t("a",{class:"cbi-button cbi-button-neutral",href:L.url("admin/network/dawnline/updates")},_("Open Components")))]):"",f=()=>{let x=C();a>=x.length&&(a=x.length-1),dom.content(E,[t("h2",{},o?_("Add a server"):_("Set up Dawnline")),y,t("div",{class:"dl-steps"},x.map((T,I)=>t("span",{class:`dl-step${I===a?" current":I0?A(_("Back"),()=>{a--,f()}):s?A(_("Cancel"),s):"",t("span",{class:"dl-spacer"}),a{let T=x[a].check?.();if(T){q(T,"warning");return}a++,f()},"positive"):A(_("Create server"),async()=>{for(let I of x){let Y=I.check?.();if(Y){q(Y,"warning");return}}let T=await F(()=>N.serverCreate(r.id,r.name,e.ifname,r.port,mn(r.range),r.endpoint,e.mtu,r.preset,r.lan_zone,r.wan_zone,r.lan_like,o?void 0:r.portal,o?void 0:r.portal_port),_("Server created"));T&&(T.network_restart&&q(_("Restarting the network so it knows AmneziaWG: back in a few seconds")),setTimeout(()=>{location.href=No(T.id)},T.network_restart?1e4:1500))},"positive",{disabled:z.length>0,title:z.length?_("Install AmneziaWG first"):null})])])};return f(),E}};function ft(n){let e={el:n(),refresh(){let o=n();e.el.replaceWith(o),e.el=o}};return e}function We(n,e,o,s,r="",a=[]){return t("section",{class:`dl-setsec ${r}`,id:`dl-set-${n}`},[t("div",{class:"dl-setsec-body"},[a.length?t("div",{class:"dl-setsec-head"},[t("h3",{},e),t("span",{class:"dl-spacer"}),...a]):t("h3",{},e),...o]),s.length?t("div",{class:"dl-setsec-foot"},s):""])}function Hr(n){let e=n.filter(r=>r.status!=="skip"),o=e.filter(r=>r.status==="error"||r.status==="warn"),s=e.some(r=>r.status==="error")?"error":o.length?"warn":"ok";return{bad:o,worst:s}}function zr(n){let e=n.d.settings,o=n.d.effective,s=n.d.cert,r=ye(o.portal_enabled,_("Enable portal")),a=he(e.portal_port,{placeholder:"8443",inputmode:"numeric",class:"cbi-input-text dl-w-port"}),i=he(e.portal_redirect,{placeholder:_("Show “Not found”"),class:"cbi-input-text dl-mono"}),l=he("",{placeholder:_("vpn.example.com or an IP"),"aria-label":_("Other address")}),d=j=>/^\d{1,3}(\.\d{1,3}){3}$/.test(j),c=[o.portal_host,...o.portal_alt??[]].filter((j,V,le)=>j&&le.indexOf(j)===V),p=!!n.portal,u=[],k=j=>{j&&!u.some(V=>V.host===j)&&u.push({host:j,kind:d(j)?"ip":"name",ips:[],here:!1,cloudflare:!1,cert:!1})},M=j=>{u=[...j,...u.filter(V=>!j.some(le=>le.host===V.host))],!c.length&&j[0]&&(c=[j[0].host])};n.portal&&M(n.portal.candidates),c.forEach(k);let g=j=>j.kind==="ip"?t("span",{class:"dl-addr-warn"},[v("alert"),_("Plain HTTP: the link and VPN keys travel unencrypted")]):t("span",{class:"dl-sub"},j.cloudflare?_("Behind Cloudflare · often stalls in Russia"):j.ips.length?j.here?j.cert?_("Points at this router · Let’s Encrypt certificate"):_("Points at this router · no certificate yet"):m(_("Points at %s, not this router"),j.ips.join(", ")):p?_("Your address"):_("Checking where it points…")),h=t("div",{class:"dl-addr-opts",role:"group","aria-label":_("Portal addresses")}),E=j=>{c.includes(j)?c.length>1&&(c=c.filter(V=>V!==j)):c=[...c,j],H(),b()},H=()=>dom.content(h,[...u.map(j=>{let V=c.includes(j.host),le=c[0]===j.host;return t("div",{class:`dl-addr-opt${V?" on":""}`,role:"checkbox","aria-checked":V?"true":"false",tabindex:"0",click:()=>E(j.host),keydown:ve=>{(ve.key===" "||ve.key==="Enter")&&(ve.preventDefault(),E(j.host))}},[t("i",{class:"dl-addr-check"},V?v("check"):""),t("span",{class:"dl-stack"},[t("span",{class:"dl-mono"},j.host),g(j)]),le?t("span",{class:"dl-pill info"},_("Main")):V?t("button",{type:"button",class:"dl-linkbtn",click:ve=>{ve.stopPropagation(),c=[j.host,...c.filter(R=>R!==j.host)],H(),b()}},_("Make main")):j.cloudflare?t("span",{class:"dl-pill warn"},"Cloudflare"):j.kind==="ip"?t("span",{class:"dl-pill"},"IP"):j.here&&j.cert?t("span",{class:"dl-pill ok"},_("Recommended")):""])}),t("div",{class:"dl-addr-opt other"},[t("i",{class:"dl-addr-check"},v("plus")),l,A(_("Add"),()=>{let j=l.value.trim().toLowerCase();if(!j)return;let V=Pt(j);if(V.bad){q(V.text,"warning");return}k(j),c.includes(j)||(c=[...c,j]),l.value="",H(),b()})])]);l.addEventListener("keydown",j=>{j.key==="Enter"&&(j.preventDefault(),l.nextElementSibling?.click())});let S=t("div",{class:"dl-links"}),$=()=>{},b=()=>{$();let j=Number(a.value)||o.portal_port;dom.content(S,c.map((V,le)=>{let ve=d(V),R=ve?j+1:j,O=`${ve?"http":"https"}://${V}${R===(ve?80:443)?"":`:${R}`}/`;return t("div",{class:"dl-link-row"},[t("span",{class:`dl-link-ic ${ve?"warn":"ok"}`},v(ve?"alert":"lock")),t("span",{class:"dl-mono dl-link-url"},[O,t("b",{},"kamiro-telosu-bavine")]),le===0?t("span",{class:"dl-pill info"},_("Main")):ve?t("span",{class:"dl-pill warn"},"HTTP"):""])}))};H(),b(),a.addEventListener("input",()=>b());let C={portal:_("Portal running"),portal_dns:_("Points here"),portal_reply:_("Answers reach visitors"),portal_http:_("Plain HTTP"),cert:_("Certificate")},w=n.d.needs??{https:[],acme:[],home:[]},z=j=>{if(!o.portal_enabled)return t("div",{hidden:!0});if(!j)return ke("check",_("Ready to share"),_("The portal’s checks from Health"),[t("p",{class:"dl-muted dl-loading"},_("Running checks…"))]);let V=j.filter(P=>P.status!=="skip");if(!V.length)return t("div",{hidden:!0});let{bad:le,worst:ve}=Hr(j),R=t("div",{class:"dl-ready-details",hidden:!0},V.map(P=>t("div",{class:`dl-ready-item ${P.status}`},[v(P.status==="ok"?"check":"alert"),t("span",{class:"dl-stack"},[t("span",{},P.title),t("span",{class:"dl-sub"},P.detail)])]))),O=t("div",{class:"dl-stack gap8"},[t("div",{class:`dl-ready-sum ${ve}`},[v(ve==="ok"?"check":"alert"),t("span",{class:"dl-stack"},[t("b",{},ve==="ok"?W(V.length,"All %s check passed","All %s checks passed"):m(N_(V.length,"%s of %s check passed","%s of %s checks passed"),K(V.length-le.length),K(V.length))),le.length?t("span",{class:"dl-sub"},le.map(P=>P.detail).join(" ")):t("span",{class:"dl-sub"},_("Links will open for the people you send them to."))]),t("button",{type:"button",class:"dl-linkbtn",click:P=>{R.hidden=!R.hidden,P.currentTarget.textContent=R.hidden?_("Details"):_("Hide")}},_("Details"))]),t("div",{class:"dl-chips-row"},V.map(P=>t("span",{class:`dl-check-chip ${P.status}`,title:P.detail},[v(P.status==="ok"?"check":"alert"),C[P.id]??P.title]))),R]);return ke("check",_("Ready to share"),_("The portal’s checks from Health"),[O])},y=j=>{if(!o.portal_enabled||!j&&!w.https.length)return t("span",{hidden:!0});if(w.https.length)return t("span",{class:"dl-pill bad"},_("Can’t start"));let{worst:V}=Hr(j);return t("span",{class:`dl-pill ${V==="ok"?"ok":V==="error"?"bad":"warn"}`},V==="error"?_("Needs attention"):_("Ready"))},f=z(n.portal?.checks??null),x=y(n.portal?.checks??null);n.portalFill=j=>{p=!0,M(j.candidates),H(),b();let V=z(j.checks);f.replaceWith(V),f=V;let le=y(j.checks);x.replaceWith(le),x=le};let T=s&&!s.self_signed&&s.expires?Oe(s.expires):"",I=_e(_("Listening port"),a,()=>hn(a.value.trim()===""?o.portal_port:Number(a.value),n.d.tcp_taken??[],c.some(d)));$=I.refresh;let Y=_e(_("Unknown links"),i,()=>gs(i.value)),J=!!(e.portal_cert&&e.portal_key),te=s?J?_("Your files"):s.self_signed?_("Self-signed"):"Let’s Encrypt":_("Portal is off"),B=()=>{let j=he(e.portal_cert,{placeholder:"/etc/ssl/…/fullchain.crt"}),V=he(e.portal_key,{placeholder:"/etc/ssl/…/key"});de(_("Use your own certificate"),[t("p",{class:"dl-muted"},_("Paths on the router. Leave both empty to pick a certificate automatically.")),ge(_("Certificate file"),j),ge(_("Key file"),V)],[ue()," ",A(_("Save"),()=>{ce(),n.save({portal_cert:j.value.trim(),portal_key:V.value.trim()},_("Certificate saved"),"portal")},"positive")])},Q=(j,V,le,ve,R,O)=>it(j,V,le,ve,A(O,()=>nn(R,w[R],()=>n.reload("portal")),"positive")),ne=w.https.length?Q("lock","bad",_("HTTPS isn’t available on this router"),m(_("The portal needs %s. It can’t start without them."),new Intl.ListFormat(ie(),{type:"conjunction"}).format(w.https)),"https",_("Install")):"",fe=w.acme.length&&(!s||s.self_signed)?Q("lock","",_("Free certificate from Let’s Encrypt"),e.portal_host?m(_("ACME isn’t installed. With it the router gets a certificate for %s and browsers stop warning."),e.portal_host):_("ACME isn’t installed. With it the router gets a certificate and browsers stop warning."),"acme",_("Install ACME")):"",se=[t("div",{class:"dl-row"},[v("lock"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},[te,T?t("span",{class:"dl-faint"},` · ${m(_("until %s"),T)}`):""]),t("span",{class:"dl-sub dl-ellipsis",title:s?.path??""},s?s.self_signed?_("Made by the router: browsers warn until a certificate covers the address."):`${J?_("Your files"):_("Found automatically")} · ${s.path}`:_("Turn the portal on to see its certificate."))])]),t("div",{class:"dl-row"},[v("file"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},_("Your own files")),t("span",{class:"dl-sub"},J?`${e.portal_cert} · ${e.portal_key}`:_("Not set: the certificate is picked automatically."))]),J?A(_("Reset"),()=>n.save({portal_cert:"",portal_key:""},_("Automatic certificate"),"portal"),"negative"):"",A(J?_("Change"):_("Use files"),B)]),fe];return We("portal",_("Personal portal"),[t("span",{class:"dl-muted"},_("A page where each person adds and manages their devices with their personal link.")),ne?t("div",{class:"dl-list"},[ne]):"",ke("network",_("Port"),_("How the portal listens (80 and 443 stay free)"),[I]),ke("edit",_("Appearance"),_("What people see"),[Y]),ke("link",_("Addresses"),_("Pick one or more; the first is the main link"),[h,t("div",{class:"dl-stack gap8"},[S,t("span",{class:"dl-sub"},_("Example code; each person gets their own three words."))])]),ke("lock",_("Certificate"),_("Used for HTTPS links"),se),f],[t("span"),A(_("Save"),()=>{let j=Ue([I,Y]);if(j){q(j,"warning");return}return n.save({portal_enabled:ze(r)?"1":"0",portal_host:c[0]??"",portal_alt:c.slice(1),portal_port:a.value,portal_redirect:i.value.trim()},_("Saved"),"portal")},"positive")],"",[x,r])}function Rr(n){let e=n.d.settings,o=n.d.effective,s=he(e.default_device_limit,{placeholder:"3",inputmode:"numeric",class:"cbi-input-text dl-w-port"}),r=ye(o.hostnames,_("Device hostnames")),a=he(e.domain,{placeholder:"lan",class:"cbi-input-text dl-w-port"}),i=he(e.home_dns_fallback==="none"?"":e.home_dns_fallback||o.home_dns_fallback||"",{placeholder:_("None"),inputmode:"decimal",class:"cbi-input-text dl-w-ip dl-mono"}),l=_e(_("Devices per person"),s,()=>{if(!s.value.trim())return{text:_("The default, 3. Pre-filled when you add someone."),bad:!1};let p=fn(s.value);return p.bad?p:{text:_("Pre-filled when you add someone."),bad:!1}}),d=_e(_("Device hostnames"),a,()=>vs(a.value),t("div",{class:"dl-hostport"},[r,t("span",{class:"dl-faint dl-mono"},"phone.myata."),a])),c=_e(_("Fallback DNS"),i,()=>{let p=bs(i.value);return p.bad?p:{text:m(_("For Home-only devices using home names: %s"),p.text),bad:!1}});return We("defaults",_("New people"),[l,d,c],[t("span"),A(_("Save"),()=>{let p=Ue([l,d,c]);if(p){q(p,"warning");return}return n.save({default_device_limit:s.value,hostnames:ze(r)?"1":"0",domain:a.value,home_dns_fallback:i.value},_("Saved"),"defaults")},"positive")])}function Ir(n){let e=n.d.effective,o=ye(e.geo_enabled,_("Locations")),s=t("select",{class:"cbi-input-select"},[t("option",{value:"ipwho.is",selected:e.geo_provider!=="ipapi.co"?"selected":null},m(_("%s (fallback: %s)"),"ipwho.is","ipapi.co")),t("option",{value:"ipapi.co",selected:e.geo_provider==="ipapi.co"?"selected":null},m(_("%s (fallback: %s)"),"ipapi.co","ipwho.is"))]);return We("map",_("Map & locations"),[t("div",{class:"dl-setrow head"},[t("span",{class:"dl-muted"},_("Show where people connect from on the Overview and person pages, at city level.")),o]),ge(_("Provider"),s)],[t("span",{class:"dl-sub"},_("The router sends each new client IP to the provider once and caches the city. Map tiles load in your browser from CARTO; people never see the map.")),A(_("Save"),()=>n.save({geo_enabled:ze(o)?"1":"0",geo_provider:s.value},_("Saved"),"map"),"positive")])}var vl=()=>[["app","Dawnline"],["amneziawg","AmneziaWG"],["packages",_("System packages")]];function Br(n){let e=n.d.effective.updates,o=ye(e.check,_("Check automatically"),g=>M(g,ze(r))),s=Me([["6h",_("Every 6 h")],["12h",_("Every 12 h")],["1d",_("Daily")],["7d",_("Weekly")]],e.interval,{label:_("How often"),cls:"sm"}),r=ye(e.auto,_("Install automatically"),g=>M(ze(o),g)),a=he(e.time,{placeholder:"04:00",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono","aria-label":_("Time")}),i=Me([["scheduled",_("At a set time")],["immediate",_("As soon as found")]],e.mode,{label:_("When"),cls:"sm",onChange:g=>a.hidden=g!=="scheduled"});a.hidden=e.mode!=="scheduled";let l=new Set(e.targets),d=t("div",{class:"dl-chips-row"},vl().map(([g,h])=>{let E=Xe(h,l.has(g),()=>{l.delete(g)||l.add(g),xn(E,l.has(g))});return E})),c=ye(e.keep,_("Keep the previous version")),p=ye(e.mirrors,_("GitHub mirrors")),u=ge(_("How often"),s),k=[ge(_("When"),t("div",{class:"dl-hostport"},[i,a]),_("A set time keeps tunnel restarts out of the evening; the run happens within an hour of it.")),ge(_("Components"),d,_("AmneziaWG is off by default: a new kernel module restarts every tunnel."))],M=(g,h)=>{u.hidden=!g;for(let E of k)E.hidden=!h};return M(e.check,e.auto),We("updates",_("Updates"),[t("span",{class:"dl-muted"},_("How Dawnline keeps its components current. Every Dawnline update makes a backup of the settings first.")),ge(_("Check automatically"),o,_("Looks for new versions in the background; Components shows what it found and the service log names it.")),u,ge(_("Install automatically"),r,_("Downloads and installs new versions of the components below.")),...k,ge(_("Keep the previous version"),c,_("Saves the replaced Dawnline or AmneziaWG package on flash, so Roll back works without internet. Under 1 MB.")),ge(_("GitHub mirrors"),p,_("When GitHub is unreachable, download through mirrors. Checksums are still verified."))],[t("span",{class:"dl-sub"},_("Run a check or an update by hand in Components.")),A(_("Save"),()=>{if(i.dataset.value==="scheduled"){let g=xs(a.value);if(g.bad){q(m(_("Time: %s"),g.text),"warning");return}}return n.save({update_check:ze(o)?"1":"0",update_interval:s.dataset.value,update_auto:ze(r)?"1":"0",update_mode:i.dataset.value,update_time:a.value.trim(),update_targets:[...l],update_keep:ze(c)?"1":"0",update_mirrors:ze(p)?"1":"0"},_("Saved"),"updates")},"positive")])}function Or(n){let e=n.d.logs,o=e.policy,s=Me([["7",W(7,"%s day","%s days")],["30",W(30,"%s day","%s days")],["90",W(90,"%s day","%s days")],["365",W(1,"%s year","%s years")],["0",_("No limit","retention")]],String(o.keep_days),{label:_("Keep activity"),cls:"sm"}),r=Me([["500",K(500)],["2000",K(2e3)],["5000",K(5e3)],["20000",K(2e4)]],String(o.max),{label:_("Maximum events"),cls:"sm"}),a=Me([["10min",_("Every 10 min")],["hourly",_("Hourly")],["off",_("Memory only")]],o.persist,{label:_("Save to flash"),cls:"sm"}),i=Me([["31",W(1,"%s month","%s months")],["62",W(2,"%s month","%s months")],["180",W(6,"%s month","%s months")],["365",W(1,"%s year","%s years")],["730",W(2,"%s year","%s years")]],String(o.usage_days),{label:_("Daily traffic"),cls:"sm"}),l=Me([["12",W(1,"%s year","%s years")],["24",W(2,"%s year","%s years")],["60",W(5,"%s year","%s years")],["120",W(10,"%s year","%s years")]],String(o.usage_months),{label:_("Monthly traffic"),cls:"sm"}),d=new Set(o.categories),c=t("div",{class:"dl-chips-row"},Nt.map(M=>{let g=Xe([Ye(M),t("b",{},K(e.by_category[M]??0))],d.has(M),()=>{d.delete(M)||d.add(M),xn(g,d.has(M))},{title:ws(M)});return g})),p=e.oldest?Oe(new Date(e.oldest*1e3)):"",u=(M,g,h,E)=>t("div",{class:"dl-row"},[v(M),t("span",{class:"dl-row-main dl-stack"},[t("b",{},g),t("span",{class:"dl-sub"},h)]),...E]),k=M=>A(M.toUpperCase(),async()=>{let[g,h]=await Promise.all([N.status(1),N.events(2e4)]);Qe(g,h.events,M)},"neutral",{title:m(_("Download the log as %s"),M.toUpperCase())});return We("logs",_("Logs & history"),[t("p",{class:"dl-muted"},bn(o)),ge(_("Keep activity"),s,_("Older events are removed automatically.")),ge(_("Maximum size"),r,_("Newest events are kept when the log is full.")),ge(_("Record"),c,_("Switched-off categories are not logged from now on.")),ge(_("Save to flash"),a,_("The log lives in memory and is copied to flash. Memory only saves flash writes but is lost on reboot.")),ge(_("Daily traffic"),i,_("Per-day history behind the charts.")),ge(_("Monthly traffic"),l,_("Per-month totals; data limits use the current month.")),t("h4",{class:"dl-setsub"},_("Stored data")),t("div",{class:"dl-list"},[u("activity",_("Activity log"),e.events?`${m(_("%s since %s"),W(e.events,"%s event","%s events"),p)} · ${o.persist==="off"?m(_("%s in memory"),Et(e.log_ram)):m(_("%s in memory, %s on flash"),Et(e.log_ram),Et(e.log_flash))}`:_("Empty"),[k("csv"),k("json"),A(_("Clear"),()=>lt(_("Clear activity"),_("Removes events from the log on the router."),{},()=>n.reload("logs")),"negative")]),u("chart",_("Traffic history"),e.usage_days?`${m(_("%s since %s"),W(e.usage_days,"%s day","%s days"),Oe(e.usage_since))} · ${m(_("%s on flash"),Et(e.usage_flash))}`:_("Empty"),[A(_("Reset"),()=>Ht("all","","",()=>setTimeout(()=>n.reload("logs"),300)),"negative")]),u("pin",_("Location cache"),`${W(n.d.geo_cached,"%s address","%s addresses")} · ${m(_("%s on flash"),Et(e.geo_flash))}`,[A(_("Clear"),async()=>{await F(()=>N.geoClear(),_("Location cache cleared"))&&await n.reload("logs")},"negative")])])],[t("span",{class:"dl-sub"},_("Clear one person or device from their own page.")),A(_("Save"),()=>n.save({log_keep_days:s.dataset.value,log_max:r.dataset.value,log_persist:a.dataset.value,usage_keep_days:i.dataset.value,usage_keep_months:l.dataset.value,log_category:[...d]},_("Saved"),"logs"),"positive")])}function bl(n){return{manual:_("Manual"),auto:_("Nightly"),"pre-restore":_("Before restore"),"pre-import":_("Before import"),"pre-delete":_("Before removing a server"),"pre-update":_("Before update")}[n]??n}var jr=3;function Ho(n){let e=new Date(n*1e3),o=e.toLocaleTimeString(ie(),{hour:"2-digit",minute:"2-digit"}),s=Math.round((new Date(new Date().toDateString()).getTime()-new Date(e.toDateString()).getTime())/864e5);return s===0?m(_("Today, %s"),o):s===1?m(_("Yesterday, %s"),o):`${e.toLocaleDateString(ie(),{day:"numeric",month:"short"})}, ${o}`}async function xl(n){let e=await F(()=>N.backupRead(n.name));if(!e)return;let o=atob(e.data),s=new Uint8Array(o.length);for(let a=0;axl(n),"neutral","dl-icon-only"),$e("more",_("More"),o=>Se(o.currentTarget,[{label:_("Restore"),icon:v("reset"),run:async()=>{await me(_("Restore this backup?"),m(_("Everything returns to %s. The current state is backed up first."),Ho(n.created)),_("Restore"),!0)&&await F(()=>N.backupRestore(n.name),_("Restored"))&&e(!0)}},{label:_("Delete"),icon:v("trash"),danger:!0,run:async()=>{await me(_("Delete this backup?"),m(_("The backup from %s is removed from the router."),Ho(n.created)),_("Delete"),!0)&&await F(()=>N.backupDelete(n.name),_("Backup deleted"))&&e()}}]),"neutral","dl-icon-only")])])}function Wr(n,e){let o=n.slice(0,jr).map(d=>Ur(d,e)),s=n.slice(jr),r=n.length?t("div",{class:"dl-list"},[...o,s.length?t("details",{class:"dl-bk-older"},[t("summary",{},[v("chevron"),W(s.length,"%s older backup","%s older backups")]),...s.map(d=>Ur(d,e))]):""]):t("div",{class:"dl-list"},[t("div",{class:"dl-row dl-muted"},_("No backups yet."))]),a=A(_("Restore from file"),async()=>{let d=await eo(".tar.gz,.tgz,application/gzip","base64");if(!d)return;await me(_("Restore from file?"),m(_("Replace the current Dawnline configuration with %s? The current state is backed up first."),d.name),_("Restore"),!0)&&await F(()=>N.backupUpload(d.data),_("Restored"))&&e(!0)}),i=A(_("Export JSON"),async()=>{let d=await F(()=>N.exportJson());d&&Ne(`dawnline-export-${new Date().toISOString().slice(0,10)}.json`,JSON.stringify(d,null,2),"application/json")}),l=A(_("Import JSON"),async()=>{let d=await eo(".json,application/json","text");if(!d)return;let c;try{c=JSON.parse(d.data)}catch{q(_("Not a JSON file."),"error");return}await me(_("Import?"),_("This replaces the whole Dawnline configuration on this router. The current state is backed up first."),_("Import"),!0)&&await F(()=>N.importJson(c),_("Imported"))&&e(!0)});return t("section",{class:"dl-setsec",id:"dl-set-backups"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-setsec-head"},[t("div",{class:"dl-stack"},[t("h3",{},_("Backups")),t("span",{class:"dl-sub"},_("Nightly when something changed, and before every restore, import or update. The last 10 are kept."))]),t("span",{class:"dl-spacer"}),A([v("plus")," ",_("Back up now")],async()=>{await F(()=>N.backupCreate(),_("Backup created"))&&e()},"positive")]),r]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub"},_("Backups contain private keys: keep downloads safe. JSON moves everything except usage history to another router.")),t("span",{class:"dl-row-actions dl-bk-actions"},[a,i,l])])])}var zo="remove";function wl(){let n=he("",{placeholder:zo}),e=A(_("Remove Dawnline"),async()=>{await F(()=>N.uninstall(n.value.trim()),_("Dawnline removed"))&&(ce(),setTimeout(()=>location.reload(),800))},"negative",{disabled:!0});n.addEventListener("input",()=>{e.disabled=n.value.trim()!==zo}),de(_("Remove Dawnline?"),[t("p",{},m(_("Everyone is disconnected and the tunnel, firewall rules and portal are removed. A backup is made first. Type “%s” to confirm."),zo)),n],[ue()," ",e])}function Gr(){return We("danger",_("Remove Dawnline from this router"),[t("p",{class:"dl-muted"},_("Deletes the tunnel, firewall rules, access table and hostnames Dawnline created, and stops the service. People and keys are kept in a backup."))],[t("span"),A(_("Remove"),()=>wl(),"negative")],"danger")}var On=class{constructor(){this.root=t("div",{class:"dl-settings-main"});this.backups=[];this.portal=null;this.portalSeq=0;this.cards={}}load(){return N.settingsGet()}render(e){this.d=e,this.cards={portal:ft(()=>zr(this)),defaults:ft(()=>Rr(this)),map:ft(()=>Ir(this)),updates:ft(()=>Br(this)),logs:ft(()=>Or(this)),backups:ft(()=>Wr(this.backups,r=>this.loadBackups(r))),danger:ft(()=>Gr())};let o=["portal","defaults","map","updates","logs","backups","danger"];dom.content(this.root,o.map(r=>this.cards[r].el)),this.loadBackups().then(()=>{new URLSearchParams(location.search).get("section")==="backups"&&document.getElementById("dl-set-backups")?.scrollIntoView({block:"start"})}),this.loadPortal();let s=new URLSearchParams(location.search).get("section");return s&&s!=="backups"&&requestAnimationFrame(()=>document.getElementById(`dl-set-${s}`)?.scrollIntoView({block:"start"})),t("div",{},[t("div",{class:"dl-pagehead"},[t("h2",{class:"dl-h1"},_("Settings"))]),this.root])}async save(e,o,s){let r=await F(()=>N.settingsUpdate(e),o);r&&(this.d=r,this.cards[s].refresh(),s==="portal"&&this.loadPortal())}async loadPortal(){let e=++this.portalSeq,o=await N.portalInfo().catch(()=>null);e===this.portalSeq&&(this.portal=o??this.portal??{candidates:[],checks:[]},this.portalFill?.(this.portal))}async loadBackups(e=!1){e&&await this.reload();let o=await N.backupList().catch(()=>null);o&&(this.backups=o.backups,this.cards.backups?.refresh())}async reload(e){let o=await N.settingsGet().catch(()=>null);if(o){if(this.d=o,e)this.cards[e].refresh();else for(let s of Object.values(this.cards))s.refresh();(!e||e==="portal")&&this.loadPortal()}}};function qr(n,e=!1){return n&&(e?/^https?:\/\//i:/^https:\/\//i).test(n)?n:null}function Fr(n){let e=[],o=l=>{let d=[],c=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\((https?:\/\/[^)\s]+)\))|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?])/g,p=0;for(let u;u=c.exec(l);)u.index>p&&d.push(l.slice(p,u.index)),u[1]?d.push(t("code",{},u[1].slice(1,-1))):u[2]?d.push(t("b",{},u[2].slice(2,-2))):u[3]?d.push(t("a",{href:u[4],target:"_blank",rel:"noopener"},u[3].replace(/^\[|\]\(.*$/g,""))):u[5]&&d.push(t("a",{href:u[5],target:"_blank",rel:"noopener"},u[5].replace(/^https?:\/\/(github\.com\/)?/,""))),p=u.index+u[0].length;return p{r.length&&e.push(t("p",{},o(r.join(" ")))),r=[],s=null};for(let l of n.replace(/\r/g,"").split(` +`);function Hn(n,e,o,s){let r=n.by==="admin",a=At(n.msg),i=t("div",{class:`dl-row dl-slog-row ${r?"dl-ev-by-admin":`dl-ev-by-system ${dl[n.level]??""}`}${n.detail?" has-detail":""}`},[r?t("span",{class:"dl-ev-tile",title:_("Done by you in LuCI")},v("admin")):t("span",{class:"dl-ev-tile sys",title:pl(n.level)},v(cl[n.src]??"zap")),t("span",{class:"dl-row-main"},r?[...ul(n),n.note?t("span",{class:"dl-muted"},` · ${Ms(n.note)}`):"",n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},v("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},Sr(n.detail)):""]:[n.src==="awg"&&n.who&&n.who!=="AmneziaWG"?t("span",{class:"dl-ev-kind"},`${_("Server")} `):"",t("b",{class:"dl-sys-src",title:Ft(n.src)},n.who?n.src==="awg"?n.who:At(n.who):Ft(n.src)),/^[:,]/.test(a)?"":" ",t("span",{class:"dl-muted"},a),n.detail?t("span",{class:`dl-slog-more${e?" open":""}`},v("chevron")):"",n.detail&&e?t("pre",{class:"dl-slog-detail"},Sr(n.detail)):""]),t("span",{class:"dl-faint dl-nowrap",title:new Date(n.ts*1e3).toLocaleString(le())},s)]);return n.detail&&i.addEventListener("click",l=>{l.target.closest("pre")||o()}),i}function Pr(n){let e=new Date(n*1e3),o=new Date,s=new Date;if(s.setDate(o.getDate()-1),e.toDateString()===o.toDateString())return _("Today");if(e.toDateString()===s.toDateString())return _("Yesterday");let r=e.toLocaleDateString(le(),{weekday:"long",day:"numeric",month:"long"});return r.charAt(0).toLocaleUpperCase(le())+r.slice(1)}var Ot=n=>Mt(n).toLocaleDateString(le(),{day:"numeric",month:"short"});function zn(n,e,o,s=!1){let r=n.slice(-15),a=r[r.length-1],i=a&&e-a[0]<180,l=i?a[2]:0,d=i?a[1]:0,[c,p]=o,u=200,w=40,M=Math.max(1,...r.map($=>Math.max($[1],$[2]))),g=$=>r.map((b,C)=>`${r.length>1?C/(r.length-1)*u:u},${w-2-b[$]/M*(w-6)}`),h=g(2),E=g(1),H=r.length>1&&!s?Tt(``):t("div",{class:"dl-speed-wait"},[t("i"),s?"":t("span",{},_("Collecting… 1 point a minute"))]),S=($,b,C,y)=>t("div",{class:"dl-speed-col"},[t("span",{class:"dl-sub"},[t("span",{class:C},b),` ${$}`]),s?t("span",{class:"dl-speed-val off"},"—"):t("span",{class:"dl-speed-val"},Fe(y))]);return r.length>1&&!s&&we(H,()=>{let $=r[r.length-1];return[t("div",{class:"dl-tip-title"},new Date($[0]*1e3).toLocaleTimeString(le(),{hour:"2-digit",minute:"2-digit"})),t("div",{},`↓ ${Fe($[2])} · ↑ ${Fe($[1])}`)]}),t("div",{class:"dl-bento-tile"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},_("Speed now")),s?"":t("span",{class:"dl-sub"},_("last 15 min"))]),t("div",{class:"dl-speed-cols"},[S(_("Download","speed"),"↓","dl-dn",l),S(_("Upload","speed"),"↑","dl-up",d)]),H,t("div",{class:"dl-speed-today"},[t("span",{},ae(_("Today %s"),t("b",{},se(c+p)))),t("span",{},[t("span",{class:"dl-dn"},"↓"),` ${se(p)} `,t("span",{class:"dl-up"},"↑"),` ${se(c)}`])])])}function Rn(n,e){let o=n.slice(-30),s=o.map(d=>d.rx+d.tx),r=Math.max(1,...s),a=s.reduce((d,c)=>d+c,0),i=s.reduce((d,c,p)=>c>s[d]?p:d,0),l=t("div",{class:"dl-bento-bars"},o.map((d,c)=>{let p=s[c],u=t("i",{class:c===o.length-1?"hi":"",style:`height:${Math.max(4,p/r*100)}%`}),w=t("span",{},[u]);return we(w,()=>[t("div",{class:"dl-tip-title"},c===o.length-1?`${_("Today")} · ${Ot(d.day)}`:Ot(d.day)),t("div",{},se(p)),t("div",{class:"dl-muted dl-mono"},`↓ ${se(d.tx)} ↑ ${se(d.rx)}`)]),w}));return t("div",{class:"dl-bento-tile month"},[t("div",{class:"dl-bento-head"},[t("span",{},[t("span",{class:"dl-metric-label"},_("Last 30 days")),t("b",{class:"dl-bento-total"},se(a))]),s[i]>0?t("span",{class:"dl-sub"},`${m(_("peak %s"),se(s[i]))} · ${Ot(o[i].day)}`):""]),o.length?l:t("p",{class:"dl-muted"},_("No traffic yet.")),t("div",{class:"dl-bento-head"},[t("span",{class:"dl-sub"},o.length?Ot(o[0].day):""),t("span",{class:"dl-sub"},e),t("span",{class:"dl-sub"},_("today"))])])}function $r(n){let e=n.slice(-30),o=e.map(r=>r.rx+r.tx),s=Math.max(1,...o);return t("div",{class:"dl-dbars"},e.map((r,a)=>{let i=t("i",{class:`${o[a]?"":"zero"}${a===e.length-1?" hi":""}`});i.style.height=`${Math.max(8,o[a]/s*100)}%`;let l=t("span",{},[i]);return we(l,()=>[t("div",{class:"dl-tip-title"},a===e.length-1?`${_("Today")} · ${Ot(r.day)}`:Ot(r.day)),t("div",{},se(o[a]))]),l}))}function Dr(n){return{apply:_("Repair"),sync:_("Reload devices"),restart:_("Restart service"),netrestart:_("Restart network"),updates:_("Open Components")}[n]??_("Fix")}async function In(n){return n==="netrestart"&&!await me(_("Restart the network?"),_("Every interface restarts. Connections drop for a few seconds."),_("Restart network"))?null:await F(()=>N.healthFix(n),_("Done"))??null}function Ao(n,e,o,s="action"){let r=n.fix;return r?r.startsWith("install:")?A(_("Install"),()=>Er(r.slice(8),o),s):r==="updates"?t("a",{class:`cbi-button cbi-button-${s}`,href:L.url("admin/network/dawnline/updates")},Dr(r)):A(Dr(r),()=>e(r),s):""}function ml(n){return/^(awg|up_|peers_|fw_|reply_|port_|subnet_)/.test(n)?"shield":/^(portal|cert)/.test(n)?"link":/^(ep_|home_|resolver)/.test(n)?"globe":n==="clock"?"clock":n==="agent"?"activity":n==="flash"?"download":n==="nft"?"lock":n==="data"?"users":"alert"}function Ar(n,e,o,s=3){let r=n.filter(i=>i.status==="error"||i.status==="warn").sort((i,l)=>i.status===l.status?0:i.status==="error"?-1:1);if(!r.length)return"";let a=r.length-s;return t("div",{class:"dl-list dl-notices"},[...r.slice(0,s).map(i=>it(ml(i.id),i.status==="error"?"bad":"warn",i.problem??i.title,i.detail,Ao(i,e,o,i.status==="error"?"positive":"neutral"))),a>0?t("a",{class:"dl-row dl-notices-more",href:L.url("admin/network/dawnline/diagnostics")},[m(_("%s more in Diagnostics"),K(a)),t("span",{class:"dl-spacer"}),"→"]):""])}function hl(n){let e=[],o=(l,d)=>t("a",{href:l},d),s=()=>o(L.url("admin/network/dawnline/diagnostics"),_("Open Diagnostics")),r=Ge(n.series),a=!!n.awg_state&&!n.awg_state.ok;for(let l of n.servers)l.enabled&&l.blocked?e.push({tone:"bad",text:[l.blocked," ",s()]}):l.enabled&&!l.up&&!a&&e.push({tone:"bad",text:[m(_("Tunnel %s is down."),l.ifname)," ",s()]});for(let l of n.people){let d=()=>o(Re(l.id),l.name);if(l.state==="quota")e.push({tone:"warn",text:ae(_("%s reached the data limit."),d())});else if(l.state==="expired")e.push({tone:"warn",text:ae(_("%s’s access has ended."),d())});else{let c=st(l.expires,r);rt(l,c)?e.push({tone:"",text:ae(_("%s’s access %s."),d(),an(c))}):c!=null&&c<0&&l.expire_action==="notify"&&e.push({tone:"",text:ae(_("%s’s end date passed (%s) · access kept."),d(),De(l.expires))}),l.quota_limit&&l.quota_used>=l.quota_limit*.9&&e.push({tone:"",text:ae(_("%s has used 90% of the data limit."),d())})}}let i=n.people.flatMap(l=>l.devices.filter(d=>d.config_stale).map(d=>[l,d]));i.length&&e.push({tone:"warn",text:i.length===1?ae(_("%s needs its configuration again."),o(Re(i[0][0].id,i[0][1].id),`${i[0][0].name} · ${i[0][1].name}`)):[W(i.length,"%s device needs its configuration again (networks or DNS changed).","%s devices need their configuration again (networks or DNS changed).")]});for(let l of n.servers)n.wan&&Dt(l.endpoint)&&l.endpoint!==n.wan&&e.push({tone:"warn",text:[m(_("Public address changed: %s still gives devices %s, the router is %s now."),l.name,l.endpoint,n.wan)," ",t("button",{type:"button",class:"dl-fix",click:async d=>{let c=d.currentTarget;c.disabled=!0,await F(()=>N.serverUpdate(l.id,{endpoint:n.wan}),m(_("%s uses %s now - devices need their configuration again"),l.name,n.wan)),c.disabled=!1}},_("Use the new address"))," ",_("A DDNS name would follow it by itself.")]});return n.servers.some(l=>l.lan_like)&&n.like_home.error&&e.push({tone:"warn",text:[m(_("Internet through the LAN is off: %s"),n.like_home.error)," ",o(L.url("admin/network/dawnline/diagnostics"),_("Details"))]}),!n.settings.portal_enabled&&!n.people.length&&e.push({tone:"",text:[_("The personal portal is off.")," ",o(L.url("admin/network/dawnline/settings"),_("Turn on"))]}),e}var Bn=class{constructor(e,o){this.srvId=e;this.go=o;this.el=t("div",{class:"dl-srvov"});this.map=null;this.mapOn=null;this.range="online";this.parts={};this.healthAt=0}mount(e){this.st=en(e,this.srvId);for(let o of["health","bento","map","side","activity"])this.parts[o]=t("div",{});return dom.content(this.el,[this.parts.health,this.parts.bento,this.parts.map,t("div",{class:"dl-grid2"},[this.parts.activity,this.parts.side])]),this.paint(),this.loadHealth(),this.el}update(e,o=!1){this.st=en(e,this.srvId),this.paint(o),Date.now()-this.healthAt>6e4&&this.loadHealth()}async loadHealth(){this.healthAt=Date.now();let e=await N.health().catch(()=>null);if(!e)return;let o=()=>void this.loadHealth(),s=async r=>{await In(r)&&(o(),r==="netrestart"&&setTimeout(o,5e3))};Ae(this.parts.health,Ar(e.checks,r=>void s(r),o),!0)}mapData(){return{geo:this.st.geo,people:this.st.people,now:this.st.now}}paintMap(){let e=this.st.geo.enabled;if(e===this.mapOn&&(!e||this.map)){this.map?.update(this.mapData());return}this.mapOn=e,dom.content(this.parts.map,this.mapCard())}mapCard(){let e=this.st,o=t("div",{class:"dl-panel-head pad"},[t("div",{class:"dl-stack"},[t("h3",{},_("Where people connect from")),t("span",{class:"dl-sub"},_("City-level, from the client IP · locations cached on the router"))]),t("span",{class:"dl-spacer"}),Rt(this.range,l=>{this.range=l,this.map?.setRange(l)})]);if(this.map?.destroy(),this.map=null,!e.geo.enabled)return t("div",{class:"dl-panel flush"},[o,t("div",{class:"dl-map-off"},ae(_("Locations are off. %s."),t("a",{href:L.url("admin/network/dawnline/settings")},_("Turn them on in Settings"))))]);let s=this.map=new dt({openPerson:l=>location.href=Re(l),openDevice:(l,d)=>location.href=Re(l,d)},this.range),r=Te(()=>{r(),s.destroy(),this.map===s&&(this.map=null)}),a=t("div",{class:"dl-map-legend"},[t("span",{},[t("i",{class:"line live"}),_("Live tunnel")]),t("span",{},[t("i",{class:"line"}),_("Seen recently")])]),i=t("div",{class:"dl-map-wrap"},[s.el,a]);return requestAnimationFrame(()=>s.mount(this.mapData())),t("div",{class:"dl-panel flush"},[o,i])}paint(e=!1){let o=this.st,s=o.servers[0];this.paintMap(),Ae(this.parts.bento,t("div",{class:"dl-bento"},[this.onlineTile(),this.speedTile(),qe(s).overviewTile(s),this.monthTile()]),e);let r=hl(o);Ae(this.parts.side,t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Needs attention")),t("span",{class:"dl-spacer"}),t("a",{href:L.url("admin/network/dawnline/diagnostics")},_("Health"))]),r.length?r.slice(0,8).map(i=>t("div",{class:"dl-attn-item dl-row"},[t("span",{class:`dl-ev-dot ${i.tone}`}),t("span",{},i.text),i.action??""])):t("div",{class:"dl-row dl-muted"},[v("check"),_("All good. Nothing needs you right now.")])]),e);let a=[...o.events].reverse().slice(0,8);Ae(this.parts.activity,t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Activity")),t("span",{class:"dl-spacer"}),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},_("View all"))]),a.length?a.map(i=>ht(o,i)):t("div",{class:"dl-row dl-muted"},_("Nothing yet. Connections, new devices and pauses appear here."))]),e)}onlineTile(){let e=this.st,o=e.servers[0]?!e.servers[0].enabled:!1,s=12,r=H=>{let[S,$]=H.spark[H.spark.length-1]??[0,0];return S+$},a=H=>e.geo.points.find(S=>S.device===H.id&&S.city)?.city,i=H=>/^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(H.endpoint??""),l=(H,S=!1)=>i(H)?S&&H.endpoint?`LAN · ${H.endpoint}`:"LAN":a(H)??"",d=H=>[...e.events].reverse().find(S=>S.type==="connect"&&S.device===H.id)?.ts??0,c=e.people.map(H=>({p:H,devs:H.devices.filter(S=>S.online).sort((S,$)=>r($)-r(S))})).filter(H=>H.devs.length).sort((H,S)=>S.devs.reduce(($,b)=>$+r(b),0)-H.devs.reduce(($,b)=>$+r(b),0)),p=c.length<=2,u=({p:H,devs:S})=>{let $=S.map(d).filter(Boolean),b=$.length?Math.min(...$):0,C=(H.rate??[]).slice(-15),y=C[C.length-1],z=y&&e.now-y[0]<180?y:null,k=200,f=30,x=Math.max(1,...C.map(te=>Math.max(te[1],te[2]))),T=te=>C.map((B,Q)=>`${C.length>1?Q/(C.length-1)*k:k},${f-2-B[te]/x*(f-6)}`),I=C.length>1?Tt(``):"",V=!z||z[1]<64&&z[2]<64,J=H.access==="both"?["home","globe"]:H.access==="lan"?["home"]:["globe"];return[t("div",{class:"dl-hc"},[t("div",{class:"dl-hc-head"},[t("span",{class:"dl-onl-av sm"},je(H.name)),t("span",{class:"dl-stack"},[t("b",{},H.name),t("span",{class:"dl-hc-since"},b?m(_("online for %s"),ot(Math.max(60,e.now-b))):_("online"))]),t("span",{class:"dl-hc-reach"},J.map(te=>t("span",{class:`dl-ibadge ${te==="home"?"lan":"inet"}`},v(te))))]),t("div",{class:"dl-hc-speed"},[t("div",{class:"dl-hc-speed-row"},V?[t("span",{class:"dl-faint"},_("Idle right now"))]:[t("span",{},[t("span",{class:"dl-dn"},"↓"),` ${Fe(z[2])}`]),t("span",{},[t("span",{class:"dl-up"},"↑"),` ${Fe(z[1])}`]),t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint"},_("15 min"))]),I]),t("div",{class:"dl-hc-devs"},S.map(te=>t("span",{class:"dl-hc-dev"},[v(te.kind),te.name,l(te)?[" · ",l(te,!0)]:""]))),t("div",{class:"dl-hc-foot"},[t("span",{class:"dl-faint"},`${m(_("%s today"),se(S.reduce((te,B)=>te+r(B),0)))} · ${m(_("%s this month"),se(H.month[0]+H.month[1]))}`)])])]},w=H=>{let{p:S,devs:$}=H,b=t("span",{class:"dl-onl-dev"},$.length>1?String($.length):v($[0].kind)),C=t("a",{class:`dl-onl-p${p?"":" sm"}`,href:Re(S.id),"aria-label":m(_("%s, online"),S.name)},[t("span",{class:"dl-onl-av"},[je(S.name),b]),p?t("span",{class:"dl-onl-name"},S.name):"",p?t("span",{class:"dl-onl-meta"},[...$.slice(0,3).map(y=>v(y.kind)),$.length>3?`+${$.length-3}`:"",l($[0])?t("span",{},[" · ",l($[0])]):""]):""]);return we(C,()=>u(H)),C},M=t("b",{class:`dl-onl-count${c.length?"":" none"}`},String(c.length)),g=c.reduce((H,S)=>H+S.devs.length,0);c.length&&we(M,()=>[`${W(c.length,"%s person","%s people")} · ${W(g,"%s device","%s devices")}`]);let h=c.length>s?c.slice(0,s-1):c,E=e.people.flatMap(H=>H.devices.map(S=>({p:H,d:S}))).filter(H=>H.d.handshake).sort((H,S)=>S.d.handshake-H.d.handshake)[0];return t("div",{class:"dl-bento-tile online"},[t("div",{class:"dl-bento-head"},[t("span",{class:"dl-metric-label"},_("Online")),M]),c.length?t("div",{class:`dl-onl-row${p?"":" grid"}`},[...h.map(w),c.length>s?t("a",{class:"dl-onl-p sm more",href:`${L.url("admin/network/dawnline/server")}?server=${encodeURIComponent(this.srvId)}§ion=people&filter=online`,title:_("Everyone online"),click:H=>{this.go&&(H.preventDefault(),this.go("people","online"))}},[t("span",{class:"dl-onl-av"},`+${c.length-h.length}`)]):""]):t("div",{class:"dl-onl-empty"},[t("span",{},o?_("The server is turned off"):_("Nobody is connected")),E?t("span",{class:"dl-sub"},m(_("Last: %s, %s"),E.p.name,pe(E.d.handshake,e.now))):t("span",{class:"dl-sub"},o?_("Devices connect once it is on"):_("No device has connected yet"))])])}speedTile(){let e=this.st.servers[0];return zn(e?.rate??[],this.st.now,this.st.totals.today,e?!e.enabled:!1)}monthTile(){let e=[...this.st.people].map(o=>[o,o.month[0]+o.month[1]]).filter(([,o])=>o>0).sort((o,s)=>s[1]-o[1]).slice(0,2);return Rn(this.st.series,e.length?m(_("Most: %s"),e.map(([o,s])=>`${o.name} ${se(s)}`).join(" · ")):"")}};var Nr=["overview","people","connection","access","awg"],fl=n=>({overview:_("Overview"),people:_("People"),connection:_("Connection"),access:_("Access")})[n],gl={general:"connection",network:"connection",interfaces:"access",advanced:"awg",disguise:"awg",tunnel:"awg",core:"awg"},No=(n,e)=>{let o=new URLSearchParams;n&&o.set("server",n),e&&e!=="overview"&&o.set("section",e);let s=o.toString();return`${L.url("admin/network/dawnline/server")}${s?`?${s}`:""}`},on=class{constructor(){this.noFooter=!0;this.root=t("div",{class:"dl-root"});this.section="overview";this.srvId="";this.ov={};this.pp={};this.tabsEl=t("div",{});this.headEl=t("div",{});this.secEl=t("div",{});this.bodyEl=t("div",{class:"dl-srvbody"})}async load(){let e=await N.status(31),o=e.servers.length?null:await N.setupDefaults();return[e,o]}render([e,o]){if(this.st=e,!e.servers.length&&o)return this.wizard(o);let s=new URLSearchParams(location.search),r=s.get("section")??"",a=gl[r]??r;return Nr.includes(a)&&(this.section=a),this.srvId=(e.servers.find(i=>i.id===s.get("server"))??e.servers[0]).id,dom.content(this.root,[this.tabsEl,this.headEl,this.secEl,this.bodyEl]),this.paint(),this.poller?.stop(),this.poller=pt({fetch:()=>N.status(31),every:30,live:!0,active:()=>this.section==="overview"&&this.root.isConnected,apply:(i,l)=>{i.servers.length&&(this.st=i,this.paintHead(l),this.ov[this.current().id]?.update(i,l))}}),this.root}paintHead(e=!1){Ae(this.headEl,this.head(this.current()),e),(!e||!Bt(this.tabsEl))&&this.paintTabs()}async refreshStatus(){let e=await N.status(31).catch(()=>null);return e?.servers.length?(this.st=e,this.paintHead(),e):null}current(){return this.st.servers.find(e=>e.id===this.srvId)??this.st.servers[0]}async refresh(){let e=await N.status(31).catch(()=>null);e&&(this.st=e,e.servers.length?this.paint():location.href=No())}paint(){this.paintTabs(),dom.content(this.headEl,this.head(this.current())),this.paintSections(),this.showSection(this.section)}paintTabs(){let e=this.current();dom.content(this.tabsEl,t("div",{class:"dl-srvtabs",role:"tablist","aria-label":_("Servers")},[...this.st.servers.map(o=>t("button",{type:"button",role:"tab",class:`dl-srvtab${o.id===e.id?" on":""}`,"aria-selected":o.id===e.id?"true":"false",click:()=>{o.id!==this.srvId&&(this.srvId=o.id,this.paint())}},[t("i",{class:`dot ${o.enabled?o.up?"ok":"bad":"warn"}`}),t("b",{},o.name)])),t("button",{type:"button",class:"dl-srvtab add",click:()=>this.addServer()},[v("plus"),_("Add server")])]))}paintSections(){let e=qe(this.current());dom.content(this.secEl,t("div",{class:"dl-seg dl-srvsections",role:"tablist","aria-label":_("Server")},Nr.map(o=>t("button",{type:"button",role:"tab","data-section":o,class:o===this.section?"on":"","aria-selected":o===this.section?"true":"false",click:()=>this.showSection(o)},o==="awg"?e.label:fl(o)))))}go(e,o){let s=this.pp[this.current().id];if(o&&s)s.filter=o,s.el&&s.decorate();else if(o){let r=this.pp[this.current().id]=new wt;r.filter=o}this.showSection(e),window.scrollTo({top:0,behavior:"smooth"})}detachKept(){let e=[...Object.values(this.ov).map(o=>o.el),...Object.values(this.pp).map(o=>o.el)];for(let o of e)o&&this.bodyEl.contains(o)&&o.remove()}showSection(e){this.section=e,this.secEl.querySelectorAll("[data-section]").forEach(i=>{let l=i.dataset.section===e;i.classList.toggle("on",l),i.setAttribute("aria-selected",l?"true":"false")});let o=this.st,s=this.current(),a={overview:()=>{let i=this.ov[s.id];return i?(i.update(o),i.el):(this.ov[s.id]=new Bn(s.id,(l,d)=>this.go(l,d))).mount(o)},people:()=>{var c,p;let i=this.pp[s.id];if(i?.el)return i.update(),i.el;let l=t("div",{},t("p",{class:"dl-muted"},_("Loading people…")));return((c=this.pp)[p=s.id]??(c[p]=new wt)).embed(o,s.id).then(u=>{l.isConnected?dom.content(l,u):l.replaceChildren(u)}).catch(u=>{delete this.pp[s.id],dom.content(l,t("p",{class:"dl-muted"},m(_("Couldn't show people: %s"),Ce(u))))}),l},connection:()=>this.connection(s),access:()=>this.access(s),awg:()=>this.awg(s)}[e]();this.detachKept(),dom.content(this.bodyEl,a)}head(e){let o=(a,i)=>t("span",{class:"dl-addrbar-seg"},[v(a),...i]),s=e.endpoint||"—",r=t("div",{class:"dl-actions"},[e.enabled?"":A([v("play"),` ${_("Turn on")}`],()=>this.save(e,{enabled:"1"},_("Server turned on")),"add")]);return t("div",{class:"dl-srvpagehead"},[t("div",{class:"dl-title-row"},[t("h2",{class:"dl-h1"},e.name),t("span",{class:`dl-pill ${e.enabled?e.up?"ok":"bad":"warn"}`},e.enabled?e.up?_("Running"):e.blocked?_("Can’t start"):_("Not running"):_("Turned off")),t("span",{class:"dl-spacer"}),r]),t("div",{class:"dl-addrbar"},[t("button",{type:"button",class:"dl-addrbar-seg main",title:_("Copy address"),click:()=>xe(s,_("Address copied"))},[v("globe"),t("span",{class:"dl-mono"},s),v("copy")]),o(qe(e).id==="awg"?"amneziawg":"tunnel",[t("span",{class:"dl-mono"},`${qe(e).label} :${e.port}`)]),e.up?o("clock",[m(_("up %s"),ot(e.uptime))]):""]),e.blocked?t("div",{class:"dl-note warn"},[v("alert"),t("span",{},e.blocked)]):""])}async save(e,o,s=_("Saved")){await F(()=>N.serverUpdate(e.id,o),s)&&await this.refresh()}connection(e){let o=he(e.name,{placeholder:_("Home")}),s=he(e.endpoint,{placeholder:"vpn.example.com",class:"cbi-input-text dl-mono"}),r=he(e.dns.join(", "),{placeholder:_("This router (recommended)"),class:"cbi-input-text dl-mono"}),a=this.st.people.filter(M=>M.server===e.id).length,i=A([v(e.enabled?"pause":"play"),` ${e.enabled?_("Turn off"):_("Turn on")}`],async()=>{e.enabled&&!await me(m(_("Turn off %s?"),e.name),W(a,"The tunnel stops and %s person is disconnected until you turn it back on. Nothing is deleted.","The tunnel stops and %s people are disconnected until you turn it back on. Nothing is deleted."),_("Turn off"),!0)||await this.save(e,{enabled:e.enabled?"0":"1"},e.enabled?_("Server turned off"):_("Server turned on"))},e.enabled?"negative":"positive"),l=this.st.settings.portal_host,d=_e(_("Name"),o,()=>He(o.value,[],_("Shown to people in their portal and apps."))),c=lo(()=>({host:s.value,port:e.port,id:e.id}),(M,g,h)=>N.endpointProbe(M,g,h),()=>p.refresh(),{empty:l?m(_("Empty = the portal’s address (%s)."),l):_("Empty = the portal’s address.")}),p=_e(_("Public address"),s,c.help);s.addEventListener("input",c.schedule),c.schedule();let u=e.reached?m(_("Reached from the internet %s."),pe(e.reached,this.st.now)):_("Never reached from the internet yet - test with a phone on mobile data."),w=_e(_("DNS for devices"),r,()=>cs(r.value,e.address));return t("div",{class:"dl-stack gap16"},[Wt(_("Connection"),[t("p",{class:"dl-muted"},_("The name people see, where devices find the router, and DNS. The port is on AmneziaWG.")),ke("router",_("Server"),_("What people see"),[d]),ke("globe",_("Devices connect to"),_("A DDNS name keeps links working when your IP changes; not through Cloudflare (use a DNS-only name or an IP)"),[p,t("div",{class:`dl-sub ${e.reached?"ok":"warn"}`},u)]),ke("file",_("For every device"),_("Changing it marks devices “Update config” until they import again"),[w])],[t("span"),A(_("Save"),()=>{let M=Ue([d,p,w]);if(M){q(M,"warning");return}return this.save(e,{name:o.value,endpoint:s.value,dns:r.value})},"positive")]),Wt(_("Danger zone"),[t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},e.enabled?_("Turn off this server"):_("This server is off")),t("span",{class:"dl-sub"},e.enabled?_("Stops the tunnel and disconnects everyone on it. Settings and people are kept."):_("Nobody can connect. Turn it on to bring the tunnel back."))]),t("div",{class:"dl-setrow-ctl"},i)]),t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},_("Change the tunnel network")),t("span",{class:"dl-sub"},m(_("Devices have %s addresses now. A new range when it clashes with a network you connect to; every device then needs its configuration again."),`${$t(e.subnet)}.x`))]),t("div",{class:"dl-setrow-ctl"},A([v("edit"),` ${_("Change")}`],()=>this.changeSubnet(e),"negative"))]),t("div",{class:"dl-setrow"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-setrow-label"},_("Remove server")),t("span",{class:"dl-sub"},W(a,"Removes the tunnel, its firewall rules and %s person with all their devices. A backup is made first.","Removes the tunnel, its firewall rules and %s people with all their devices. A backup is made first."))]),t("div",{class:"dl-setrow-ctl"},A([v("trash"),` ${_("Remove")}`],()=>this.remove(e),"negative"))])],[],"danger")])}access(e){let o=Po(this.st,e),s=Tr(e,this.st,async()=>{let r=await this.refreshStatus();if(!r)return;let a=r.servers.find(l=>l.id===e.id)??e;s.update(r);let i=Po(r,a);o.replaceWith(i),o=i});return t("div",{class:"dl-stack gap16"},[s.el,t("div",{class:"dl-health-cols"},[o,yr(this.st,e)])])}awg(e){let o={st:this.st,save:(s,r)=>this.save(e,s,r),refresh:()=>this.refresh()};return t("div",{class:"dl-stack gap16"},[qe(e).settingsCard(o,e)])}async addServer(){let e=await F(()=>N.setupDefaults());e&&dom.content(this.root,this.wizard(e,!0,()=>{dom.content(this.root,[this.tabsEl,this.headEl,this.secEl,this.bodyEl]),this.paint()}))}async changeSubnet(e){let o=await F(()=>N.serverPorts(e.id));if(!o)return;let s=o.networks??[],r=this.st.people.filter(l=>l.server===e.id).reduce((l,d)=>l+d.devices.length,0),a=he($t(e.subnet),{class:"cbi-input-text dl-mono dl-w-range"}),i=_e(_("Address range"),a,()=>ao(a.value,s,""));de(_("Change the tunnel network"),[i,t("p",{class:"dl-muted"},r?W(r,"%s device gets a new address and stops connecting until it imports its configuration again (from their personal link or from you).","%s devices get new addresses and stop connecting until they import their configuration again (from their personal link or from you)."):_("No devices on this server yet: nothing else changes."))],[ue()," ",A(_("Change"),async()=>{let l=i.help();if(l.bad){q(l.text,"warning");return}let d=mn(a.value);if(d===e.subnet){ce();return}await F(()=>N.serverUpdate(e.id,{subnet:d}),_("Tunnel network changed"))&&(ce(),r&&q(_("Devices are marked “Update config” until they import again."),"info",6e3),await this.refresh())},"negative")]),setTimeout(()=>a.select(),50)}async remove(e){let o=this.st.people.filter(s=>s.server===e.id);de(m(_("Remove %s?"),e.name),[t("p",{},W(o.length,"This removes the tunnel, its firewall rules and %s person with all their devices. A backup is made first.","This removes the tunnel, its firewall rules and %s people with all their devices. A backup is made first."))],[ue()," ",A(_("Remove"),async()=>{ce(),await F(()=>N.serverDelete(e.id),_("Server removed"))&&setTimeout(()=>{location.href=No()},800)},"negative")])}wizard(e,o=!1,s){let r={id:e.id,name:e.name,endpoint:e.endpoint,port:e.port,range:$t(e.subnet),preset:wn(e.awg),portal:!1,portal_port:e.portal_port||8443,lan_like:!0,lan_zone:e.lan_zone,wan_zone:e.wan_zone},a=0,i=!o&&r.portal_port===r.port,l=()=>/^\d{1,3}(\.\d{1,3}){3}$/.test(r.endpoint),d=()=>Gt(r.port,e.udp_taken??[],r.port===4500?`${_("Opened on the WAN firewall automatically.")} ${_("4500 is IPsec’s port: most networks let it through.")}`:_("Opened on the WAN firewall automatically.")),c={ddns:_("From your DDNS name."),cert:_("From your Let’s Encrypt certificate."),wan:_("Your WAN address now - it may change; a DDNS name is better."),portal:_("The portal’s address.")},p=lo(()=>({host:r.endpoint,port:r.port}),(x,T,I)=>N.endpointProbe(x,"",I),()=>u?.refresh(),{idle:()=>r.endpoint===e.endpoint&&e.endpoint_from?c[e.endpoint_from]??"":""}),u=null,w=e.wan_kind==="cgnat"||e.wan_kind==="private"?it("alert","warn",e.wan_kind==="cgnat"?_("Your router has no public address (CGNAT)"):m(_("Your router is behind another router (WAN %s)"),e.wan_ip),e.wan_kind==="cgnat"?_("The ISP shares one address: devices can only connect if the ISP gives you a public address or IPv6. Ask them, or use a DDNS name that points at an IPv6 address."):_("Forward the UDP port on the upstream router to this one and use a DDNS name or that router’s public address here."),""):"",M=e.awg_state?.tools&&e.awg_state.handler===!1?t("div",{class:"dl-note warn"},[v("alert"),t("span",{},_("Creating the server restarts the network for a few seconds: AmneziaWG was installed after the network started."))]):"",g=()=>ao(r.range,e.networks??[],$t(e.subnet)),h=()=>hn(r.portal_port,e.tcp_taken??[],l()),E=t("div",{class:"dl-wizard"}),H=(x,T={})=>{let I=he(String(r[x]),T);return I.addEventListener("input",()=>{x==="port"||x==="portal_port"?r[x]=I.value.trim()===""?0:Number(I.value):r[x]=I.value.trim(),x==="port"&&i&&(r.portal_port=r.port),x==="portal_port"&&(i=r.portal_port===r.port)}),I},S={id:"server",title:_("Server"),render:()=>t("div",{class:"dl-wizard-groups"},[t("p",{class:"dl-muted"},o?_("One more server: another port or disguise for networks where the first does not get through, or its own home access rules. People are moved between servers from their page."):_("Where devices connect to. A hostname that always points at your router (DDNS) keeps links working when your IP changes.")),ke("router",_("Server"),_("What people see"),[_e(_("Name"),H("name"),()=>He(r.name,[],_("Shown to people in their portal and apps.")))]),ke("globe",_("Devices connect to"),_("A hostname or IP address of your router on the internet; not through Cloudflare (use a DNS-only name or an IP). IPv6 works too, and is the way out of CGNAT"),[(()=>{let x=H("endpoint",{placeholder:"vpn.example.com",class:"cbi-input-text dl-mono"});return u=_e(_("Public address"),x,p.help),x.addEventListener("input",p.schedule),p.schedule(),u})()]),w,M]),check:()=>{let x=He(r.name);if(x.bad)return m(_("Name: %s"),x.text);let T=Pt(r.endpoint,r.port);return T.bad?m(_("Public address: %s"),T.text):null}},$={id:"awg",title:"AmneziaWG",render:()=>t("div",{class:"dl-wizard-groups"},[ke("globe",_("Listening"),_("Where devices reach AmneziaWG from the internet"),[_e(_("UDP port"),H("port",{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),d)]),ke("network",_("Tunnel network"),_("Addresses devices get inside the tunnel"),[(()=>{let x=H("range",{class:"cbi-input-text dl-w-range dl-mono","aria-label":_("First three numbers of the device addresses")});return _e(_("Device addresses"),x,g,t("span",{class:"dl-suffixed"},[x,t("span",{class:"dl-mono"},".x")]))})()]),ke("shield",_("Disguise"),_("So networks that block VPNs do not recognise the tunnel. Off = plain WireGuard"),[yn(e.awg,r.preset,x=>r.preset=x,void 0,e.awg_state?.tools!==!1)])]),check:()=>{let x=d();if(x.bad)return m(_("UDP port: %s"),x.text);let T=g();return T.bad?m(_("Device addresses: %s"),T.text):null}},b={id:"portal",title:_("Portal"),render:()=>{let x=H("portal_port",{inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono"}),T=_e(_("Listening port"),x,h);T.hidden=!r.portal;let I=Me([["off",_("Off")],["on",_("On")]],r.portal?"on":"off",{label:_("Personal portal"),onChange:V=>{r.portal=V==="on",T.hidden=!r.portal}});return t("div",{class:"dl-wizard-groups"},[ke("home",_("Internet like a home device"),_("How devices reach the internet"),[ge(_("Through the home network"),ye(r.lan_like,_("Internet like a home device"),V=>r.lan_like=V),_("Whatever handles home traffic on this router (proxies, filters, DNS) handles theirs too. Change it later under Servers → Access."))]),ke("link",_("Personal portal"),_("A page where each person adds their own devices with their personal link"),[ge(_("Portal"),I,_("Off: only you add devices, from LuCI. On: people manage their devices within the limits you set.")),T])])},check:()=>{if(!r.portal)return null;let x=h();return x.bad?m(_("Portal port: %s"),x.text):null}},C=()=>[S,$,o?null:b].filter(x=>x!=null),y=e.awg_state,z=y?.missing??[],k=z.length?t("div",{class:"dl-list dl-notices"},[it("shield","bad",_("AmneziaWG isn’t installed"),m(_("The tunnel needs %s. Install the build made for this firmware, then create the server."),new Intl.ListFormat(le(),{type:"conjunction"}).format(z)),A(_("Install"),()=>Nn(()=>location.reload()),"positive"))]):y&&!y.loaded?t("div",{class:"dl-list dl-notices"},[it("shield","warn",_("AmneziaWG’s kernel module doesn’t load on this firmware"),_("Try another build in Components, or update OpenWrt. The server can’t start until it loads."),t("a",{class:"cbi-button cbi-button-neutral",href:L.url("admin/network/dawnline/updates")},_("Open Components")))]):"",f=()=>{let x=C();a>=x.length&&(a=x.length-1),dom.content(E,[t("h2",{},o?_("Add a server"):_("Set up Dawnline")),k,t("div",{class:"dl-steps"},x.map((T,I)=>t("span",{class:`dl-step${I===a?" current":I0?A(_("Back"),()=>{a--,f()}):s?A(_("Cancel"),s):"",t("span",{class:"dl-spacer"}),a{let T=x[a].check?.();if(T){q(T,"warning");return}a++,f()},"positive"):A(_("Create server"),async()=>{for(let I of x){let V=I.check?.();if(V){q(V,"warning");return}}let T=await F(()=>N.serverCreate(r.id,r.name,e.ifname,r.port,mn(r.range),r.endpoint,e.mtu,r.preset,r.lan_zone,r.wan_zone,r.lan_like,o?void 0:r.portal,o?void 0:r.portal_port),_("Server created"));T&&(T.network_restart&&q(_("Restarting the network so it knows AmneziaWG: back in a few seconds")),setTimeout(()=>{location.href=No(T.id)},T.network_restart?1e4:1500))},"positive",{disabled:z.length>0,title:z.length?_("Install AmneziaWG first"):null})])])};return f(),E}};function ft(n){let e={el:n(),refresh(){let o=n();e.el.replaceWith(o),e.el=o}};return e}function We(n,e,o,s,r="",a=[]){return t("section",{class:`dl-setsec ${r}`,id:`dl-set-${n}`},[t("div",{class:"dl-setsec-body"},[a.length?t("div",{class:"dl-setsec-head"},[t("h3",{},e),t("span",{class:"dl-spacer"}),...a]):t("h3",{},e),...o]),s.length?t("div",{class:"dl-setsec-foot"},s):""])}function Hr(n){let e=n.filter(r=>r.status!=="skip"),o=e.filter(r=>r.status==="error"||r.status==="warn"),s=e.some(r=>r.status==="error")?"error":o.length?"warn":"ok";return{bad:o,worst:s}}function zr(n){let e=n.d.settings,o=n.d.effective,s=n.d.cert,r=ye(o.portal_enabled,_("Enable portal")),a=he(e.portal_port,{placeholder:"8443",inputmode:"numeric",class:"cbi-input-text dl-w-port"}),i=he(e.portal_redirect,{placeholder:_("Show “Not found”"),class:"cbi-input-text dl-mono"}),l=he("",{placeholder:_("vpn.example.com or an IP"),"aria-label":_("Other address")}),d=j=>/^\d{1,3}(\.\d{1,3}){3}$/.test(j),c=[o.portal_host,...o.portal_alt??[]].filter((j,Y,ie)=>j&&ie.indexOf(j)===Y),p=!!n.portal,u=[],w=j=>{j&&!u.some(Y=>Y.host===j)&&u.push({host:j,kind:d(j)?"ip":"name",ips:[],here:!1,cloudflare:!1,cert:!1})},M=j=>{u=[...j,...u.filter(Y=>!j.some(ie=>ie.host===Y.host))],!c.length&&j[0]&&(c=[j[0].host])};n.portal&&M(n.portal.candidates),c.forEach(w);let g=j=>j.kind==="ip"?t("span",{class:"dl-addr-warn"},[v("alert"),_("Plain HTTP: the link and VPN keys travel unencrypted")]):t("span",{class:"dl-sub"},j.cloudflare?_("Behind Cloudflare · often stalls in Russia"):j.ips.length?j.here?j.cert?_("Points at this router · Let’s Encrypt certificate"):_("Points at this router · no certificate yet"):m(_("Points at %s, not this router"),j.ips.join(", ")):p?_("Your address"):_("Checking where it points…")),h=t("div",{class:"dl-addr-opts",role:"group","aria-label":_("Portal addresses")}),E=j=>{c.includes(j)?c.length>1&&(c=c.filter(Y=>Y!==j)):c=[...c,j],H(),b()},H=()=>dom.content(h,[...u.map(j=>{let Y=c.includes(j.host),ie=c[0]===j.host;return t("div",{class:`dl-addr-opt${Y?" on":""}`,role:"checkbox","aria-checked":Y?"true":"false",tabindex:"0",click:()=>E(j.host),keydown:ve=>{(ve.key===" "||ve.key==="Enter")&&(ve.preventDefault(),E(j.host))}},[t("i",{class:"dl-addr-check"},Y?v("check"):""),t("span",{class:"dl-stack"},[t("span",{class:"dl-mono"},j.host),g(j)]),ie?t("span",{class:"dl-pill info"},_("Main")):Y?t("button",{type:"button",class:"dl-linkbtn",click:ve=>{ve.stopPropagation(),c=[j.host,...c.filter(R=>R!==j.host)],H(),b()}},_("Make main")):j.cloudflare?t("span",{class:"dl-pill warn"},"Cloudflare"):j.kind==="ip"?t("span",{class:"dl-pill"},"IP"):j.here&&j.cert?t("span",{class:"dl-pill ok"},_("Recommended")):""])}),t("div",{class:"dl-addr-opt other"},[t("i",{class:"dl-addr-check"},v("plus")),l,A(_("Add"),()=>{let j=l.value.trim().toLowerCase();if(!j)return;let Y=Pt(j);if(Y.bad){q(Y.text,"warning");return}w(j),c.includes(j)||(c=[...c,j]),l.value="",H(),b()})])]);l.addEventListener("keydown",j=>{j.key==="Enter"&&(j.preventDefault(),l.nextElementSibling?.click())});let S=t("div",{class:"dl-links"}),$=()=>{},b=()=>{$();let j=Number(a.value)||o.portal_port;dom.content(S,c.map((Y,ie)=>{let ve=d(Y),R=ve?j+1:j,O=`${ve?"http":"https"}://${Y}${R===(ve?80:443)?"":`:${R}`}/`;return t("div",{class:"dl-link-row"},[t("span",{class:`dl-link-ic ${ve?"warn":"ok"}`},v(ve?"alert":"lock")),t("span",{class:"dl-mono dl-link-url"},[O,t("b",{},"kamiro-telosu-bavine")]),ie===0?t("span",{class:"dl-pill info"},_("Main")):ve?t("span",{class:"dl-pill warn"},"HTTP"):""])}))};H(),b(),a.addEventListener("input",()=>b());let C={portal:_("Portal running"),portal_dns:_("Points here"),portal_reply:_("Answers reach visitors"),portal_http:_("Plain HTTP"),cert:_("Certificate")},y=n.d.needs??{https:[],acme:[],home:[]},z=j=>{if(!o.portal_enabled)return t("div",{hidden:!0});if(!j)return ke("check",_("Ready to share"),_("The portal’s checks from Health"),[t("p",{class:"dl-muted dl-loading"},_("Running checks…"))]);let Y=j.filter(P=>P.status!=="skip");if(!Y.length)return t("div",{hidden:!0});let{bad:ie,worst:ve}=Hr(j),R=t("div",{class:"dl-ready-details",hidden:!0},Y.map(P=>t("div",{class:`dl-ready-item ${P.status}`},[v(P.status==="ok"?"check":"alert"),t("span",{class:"dl-stack"},[t("span",{},P.title),t("span",{class:"dl-sub"},P.detail)])]))),O=t("div",{class:"dl-stack gap8"},[t("div",{class:`dl-ready-sum ${ve}`},[v(ve==="ok"?"check":"alert"),t("span",{class:"dl-stack"},[t("b",{},ve==="ok"?W(Y.length,"All %s check passed","All %s checks passed"):m(N_(Y.length,"%s of %s check passed","%s of %s checks passed"),K(Y.length-ie.length),K(Y.length))),ie.length?t("span",{class:"dl-sub"},ie.map(P=>P.detail).join(" ")):t("span",{class:"dl-sub"},_("Links will open for the people you send them to."))]),t("button",{type:"button",class:"dl-linkbtn",click:P=>{R.hidden=!R.hidden,P.currentTarget.textContent=R.hidden?_("Details"):_("Hide")}},_("Details"))]),t("div",{class:"dl-chips-row"},Y.map(P=>t("span",{class:`dl-check-chip ${P.status}`,title:P.detail},[v(P.status==="ok"?"check":"alert"),C[P.id]??P.title]))),R]);return ke("check",_("Ready to share"),_("The portal’s checks from Health"),[O])},k=j=>{if(!o.portal_enabled||!j&&!y.https.length)return t("span",{hidden:!0});if(y.https.length)return t("span",{class:"dl-pill bad"},_("Can’t start"));let{worst:Y}=Hr(j);return t("span",{class:`dl-pill ${Y==="ok"?"ok":Y==="error"?"bad":"warn"}`},Y==="error"?_("Needs attention"):_("Ready"))},f=z(n.portal?.checks??null),x=k(n.portal?.checks??null);n.portalFill=j=>{p=!0,M(j.candidates),H(),b();let Y=z(j.checks);f.replaceWith(Y),f=Y;let ie=k(j.checks);x.replaceWith(ie),x=ie};let T=s&&!s.self_signed&&s.expires?Oe(s.expires):"",I=_e(_("Listening port"),a,()=>hn(a.value.trim()===""?o.portal_port:Number(a.value),n.d.tcp_taken??[],c.some(d)));$=I.refresh;let V=_e(_("Unknown links"),i,()=>gs(i.value)),J=!!(e.portal_cert&&e.portal_key),te=s?J?_("Your files"):s.self_signed?_("Self-signed"):"Let’s Encrypt":_("Portal is off"),B=()=>{let j=he(e.portal_cert,{placeholder:"/etc/ssl/…/fullchain.crt"}),Y=he(e.portal_key,{placeholder:"/etc/ssl/…/key"});de(_("Use your own certificate"),[t("p",{class:"dl-muted"},_("Paths on the router. Leave both empty to pick a certificate automatically.")),ge(_("Certificate file"),j),ge(_("Key file"),Y)],[ue()," ",A(_("Save"),()=>{ce(),n.save({portal_cert:j.value.trim(),portal_key:Y.value.trim()},_("Certificate saved"),"portal")},"positive")])},Q=(j,Y,ie,ve,R,O)=>it(j,Y,ie,ve,A(O,()=>nn(R,y[R],()=>n.reload("portal")),"positive")),ne=y.https.length?Q("lock","bad",_("HTTPS isn’t available on this router"),m(_("The portal needs %s. It can’t start without them."),new Intl.ListFormat(le(),{type:"conjunction"}).format(y.https)),"https",_("Install")):"",fe=y.acme.length&&(!s||s.self_signed)?Q("lock","",_("Free certificate from Let’s Encrypt"),e.portal_host?m(_("ACME isn’t installed. With it the router gets a certificate for %s and browsers stop warning."),e.portal_host):_("ACME isn’t installed. With it the router gets a certificate and browsers stop warning."),"acme",_("Install ACME")):"",oe=[t("div",{class:"dl-row"},[v("lock"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},[te,T?t("span",{class:"dl-faint"},` · ${m(_("until %s"),T)}`):""]),t("span",{class:"dl-sub dl-ellipsis",title:s?.path??""},s?s.self_signed?_("Made by the router: browsers warn until a certificate covers the address."):`${J?_("Your files"):_("Found automatically")} · ${s.path}`:_("Turn the portal on to see its certificate."))])]),t("div",{class:"dl-row"},[v("file"),t("span",{class:"dl-row-main dl-stack"},[t("b",{},_("Your own files")),t("span",{class:"dl-sub"},J?`${e.portal_cert} · ${e.portal_key}`:_("Not set: the certificate is picked automatically."))]),J?A(_("Reset"),()=>n.save({portal_cert:"",portal_key:""},_("Automatic certificate"),"portal"),"negative"):"",A(J?_("Change"):_("Use files"),B)]),fe];return We("portal",_("Personal portal"),[t("span",{class:"dl-muted"},_("A page where each person adds and manages their devices with their personal link.")),ne?t("div",{class:"dl-list"},[ne]):"",ke("network",_("Port"),_("How the portal listens (80 and 443 stay free)"),[I]),ke("edit",_("Appearance"),_("What people see"),[V]),ke("link",_("Addresses"),_("Pick one or more; the first is the main link"),[h,t("div",{class:"dl-stack gap8"},[S,t("span",{class:"dl-sub"},_("Example code; each person gets their own three words."))])]),ke("lock",_("Certificate"),_("Used for HTTPS links"),oe),f],[t("span"),A(_("Save"),()=>{let j=Ue([I,V]);if(j){q(j,"warning");return}return n.save({portal_enabled:ze(r)?"1":"0",portal_host:c[0]??"",portal_alt:c.slice(1),portal_port:a.value,portal_redirect:i.value.trim()},_("Saved"),"portal")},"positive")],"",[x,r])}function Rr(n){let e=n.d.settings,o=n.d.effective,s=he(e.default_device_limit,{placeholder:"3",inputmode:"numeric",class:"cbi-input-text dl-w-port"}),r=ye(o.hostnames,_("Device hostnames")),a=he(e.domain,{placeholder:"lan",class:"cbi-input-text dl-w-port"}),i=he(e.home_dns_fallback==="none"?"":e.home_dns_fallback||o.home_dns_fallback||"",{placeholder:_("None"),inputmode:"decimal",class:"cbi-input-text dl-w-ip dl-mono"}),l=_e(_("Devices per person"),s,()=>{if(!s.value.trim())return{text:_("The default, 3. Pre-filled when you add someone."),bad:!1};let p=fn(s.value);return p.bad?p:{text:_("Pre-filled when you add someone."),bad:!1}}),d=_e(_("Device hostnames"),a,()=>vs(a.value),t("div",{class:"dl-hostport"},[r,t("span",{class:"dl-faint dl-mono"},"phone.myata."),a])),c=_e(_("Fallback DNS"),i,()=>{let p=bs(i.value);return p.bad?p:{text:m(_("For Home-only devices using home names: %s"),p.text),bad:!1}});return We("defaults",_("New people"),[l,d,c],[t("span"),A(_("Save"),()=>{let p=Ue([l,d,c]);if(p){q(p,"warning");return}return n.save({default_device_limit:s.value,hostnames:ze(r)?"1":"0",domain:a.value,home_dns_fallback:i.value},_("Saved"),"defaults")},"positive")])}function Ir(n){let e=n.d.effective,o=ye(e.geo_enabled,_("Locations")),s=t("select",{class:"cbi-input-select"},[t("option",{value:"ipwho.is",selected:e.geo_provider!=="ipapi.co"?"selected":null},m(_("%s (fallback: %s)"),"ipwho.is","ipapi.co")),t("option",{value:"ipapi.co",selected:e.geo_provider==="ipapi.co"?"selected":null},m(_("%s (fallback: %s)"),"ipapi.co","ipwho.is"))]);return We("map",_("Map & locations"),[t("div",{class:"dl-setrow head"},[t("span",{class:"dl-muted"},_("Show where people connect from on the Overview and person pages, at city level.")),o]),ge(_("Provider"),s)],[t("span",{class:"dl-sub"},_("The router sends each new client IP to the provider once and caches the city. Map tiles load in your browser from CARTO; people never see the map.")),A(_("Save"),()=>n.save({geo_enabled:ze(o)?"1":"0",geo_provider:s.value},_("Saved"),"map"),"positive")])}var vl=()=>[["app","Dawnline"],["amneziawg","AmneziaWG"],["packages",_("System packages")]];function Br(n){let e=n.d.effective.updates,o=ye(e.check,_("Check automatically"),g=>M(g,ze(r))),s=Me([["6h",_("Every 6 h")],["12h",_("Every 12 h")],["1d",_("Daily")],["7d",_("Weekly")]],e.interval,{label:_("How often"),cls:"sm"}),r=ye(e.auto,_("Install automatically"),g=>M(ze(o),g)),a=he(e.time,{placeholder:"04:00",inputmode:"numeric",class:"cbi-input-text dl-w-port dl-mono","aria-label":_("Time")}),i=Me([["scheduled",_("At a set time")],["immediate",_("As soon as found")]],e.mode,{label:_("When"),cls:"sm",onChange:g=>a.hidden=g!=="scheduled"});a.hidden=e.mode!=="scheduled";let l=new Set(e.targets),d=t("div",{class:"dl-chips-row"},vl().map(([g,h])=>{let E=Xe(h,l.has(g),()=>{l.delete(g)||l.add(g),xn(E,l.has(g))});return E})),c=ye(e.keep,_("Keep the previous version")),p=ye(e.mirrors,_("GitHub mirrors")),u=ge(_("How often"),s),w=[ge(_("When"),t("div",{class:"dl-hostport"},[i,a]),_("A set time keeps tunnel restarts out of the evening; the run happens within an hour of it.")),ge(_("Components"),d,_("AmneziaWG is off by default: a new kernel module restarts every tunnel."))],M=(g,h)=>{u.hidden=!g;for(let E of w)E.hidden=!h};return M(e.check,e.auto),We("updates",_("Updates"),[t("span",{class:"dl-muted"},_("How Dawnline keeps its components current. Every Dawnline update makes a backup of the settings first.")),ge(_("Check automatically"),o,_("Looks for new versions in the background; Components shows what it found and the service log names it.")),u,ge(_("Install automatically"),r,_("Downloads and installs new versions of the components below.")),...w,ge(_("Keep the previous version"),c,_("Saves the replaced Dawnline or AmneziaWG package on flash, so Roll back works without internet. Under 1 MB.")),ge(_("GitHub mirrors"),p,_("When GitHub is unreachable, download through mirrors. Checksums are still verified."))],[t("span",{class:"dl-sub"},_("Run a check or an update by hand in Components.")),A(_("Save"),()=>{if(i.dataset.value==="scheduled"){let g=xs(a.value);if(g.bad){q(m(_("Time: %s"),g.text),"warning");return}}return n.save({update_check:ze(o)?"1":"0",update_interval:s.dataset.value,update_auto:ze(r)?"1":"0",update_mode:i.dataset.value,update_time:a.value.trim(),update_targets:[...l],update_keep:ze(c)?"1":"0",update_mirrors:ze(p)?"1":"0"},_("Saved"),"updates")},"positive")])}function Or(n){let e=n.d.logs,o=e.policy,s=Me([["7",W(7,"%s day","%s days")],["30",W(30,"%s day","%s days")],["90",W(90,"%s day","%s days")],["365",W(1,"%s year","%s years")],["0",_("No limit","retention")]],String(o.keep_days),{label:_("Keep activity"),cls:"sm"}),r=Me([["500",K(500)],["2000",K(2e3)],["5000",K(5e3)],["20000",K(2e4)]],String(o.max),{label:_("Maximum events"),cls:"sm"}),a=Me([["10min",_("Every 10 min")],["hourly",_("Hourly")],["off",_("Memory only")]],o.persist,{label:_("Save to flash"),cls:"sm"}),i=Me([["31",W(1,"%s month","%s months")],["62",W(2,"%s month","%s months")],["180",W(6,"%s month","%s months")],["365",W(1,"%s year","%s years")],["730",W(2,"%s year","%s years")]],String(o.usage_days),{label:_("Daily traffic"),cls:"sm"}),l=Me([["12",W(1,"%s year","%s years")],["24",W(2,"%s year","%s years")],["60",W(5,"%s year","%s years")],["120",W(10,"%s year","%s years")]],String(o.usage_months),{label:_("Monthly traffic"),cls:"sm"}),d=new Set(o.categories),c=t("div",{class:"dl-chips-row"},Nt.map(M=>{let g=Xe([Ye(M),t("b",{},K(e.by_category[M]??0))],d.has(M),()=>{d.delete(M)||d.add(M),xn(g,d.has(M))},{title:ws(M)});return g})),p=e.oldest?Oe(new Date(e.oldest*1e3)):"",u=(M,g,h,E)=>t("div",{class:"dl-row"},[v(M),t("span",{class:"dl-row-main dl-stack"},[t("b",{},g),t("span",{class:"dl-sub"},h)]),...E]),w=M=>A(M.toUpperCase(),async()=>{let[g,h]=await Promise.all([N.status(1),N.events(2e4)]);Qe(g,h.events,M)},"neutral",{title:m(_("Download the log as %s"),M.toUpperCase())});return We("logs",_("Logs & history"),[t("p",{class:"dl-muted"},bn(o)),ge(_("Keep activity"),s,_("Older events are removed automatically.")),ge(_("Maximum size"),r,_("Newest events are kept when the log is full.")),ge(_("Record"),c,_("Switched-off categories are not logged from now on.")),ge(_("Save to flash"),a,_("The log lives in memory and is copied to flash. Memory only saves flash writes but is lost on reboot.")),ge(_("Daily traffic"),i,_("Per-day history behind the charts.")),ge(_("Monthly traffic"),l,_("Per-month totals; data limits use the current month.")),t("h4",{class:"dl-setsub"},_("Stored data")),t("div",{class:"dl-list"},[u("activity",_("Activity log"),e.events?`${m(_("%s since %s"),W(e.events,"%s event","%s events"),p)} · ${o.persist==="off"?m(_("%s in memory"),Et(e.log_ram)):m(_("%s in memory, %s on flash"),Et(e.log_ram),Et(e.log_flash))}`:_("Empty"),[w("csv"),w("json"),A(_("Clear"),()=>lt(_("Clear activity"),_("Removes events from the log on the router."),{},()=>n.reload("logs")),"negative")]),u("chart",_("Traffic history"),e.usage_days?`${m(_("%s since %s"),W(e.usage_days,"%s day","%s days"),Oe(e.usage_since))} · ${m(_("%s on flash"),Et(e.usage_flash))}`:_("Empty"),[A(_("Reset"),()=>Ht("all","","",()=>setTimeout(()=>n.reload("logs"),300)),"negative")]),u("pin",_("Location cache"),`${W(n.d.geo_cached,"%s address","%s addresses")} · ${m(_("%s on flash"),Et(e.geo_flash))}`,[A(_("Clear"),async()=>{await F(()=>N.geoClear(),_("Location cache cleared"))&&await n.reload("logs")},"negative")])])],[t("span",{class:"dl-sub"},_("Clear one person or device from their own page.")),A(_("Save"),()=>n.save({log_keep_days:s.dataset.value,log_max:r.dataset.value,log_persist:a.dataset.value,usage_keep_days:i.dataset.value,usage_keep_months:l.dataset.value,log_category:[...d]},_("Saved"),"logs"),"positive")])}function bl(n){return{manual:_("Manual"),auto:_("Nightly"),"pre-restore":_("Before restore"),"pre-import":_("Before import"),"pre-delete":_("Before removing a server"),"pre-update":_("Before update")}[n]??n}var jr=3;function Ho(n){let e=new Date(n*1e3),o=e.toLocaleTimeString(le(),{hour:"2-digit",minute:"2-digit"}),s=Math.round((new Date(new Date().toDateString()).getTime()-new Date(e.toDateString()).getTime())/864e5);return s===0?m(_("Today, %s"),o):s===1?m(_("Yesterday, %s"),o):`${e.toLocaleDateString(le(),{day:"numeric",month:"short"})}, ${o}`}async function xl(n){let e=await F(()=>N.backupRead(n.name));if(!e)return;let o=atob(e.data),s=new Uint8Array(o.length);for(let a=0;axl(n),"neutral","dl-icon-only"),$e("more",_("More"),o=>Se(o.currentTarget,[{label:_("Restore"),icon:v("reset"),run:async()=>{await me(_("Restore this backup?"),m(_("Everything returns to %s. The current state is backed up first."),Ho(n.created)),_("Restore"),!0)&&await F(()=>N.backupRestore(n.name),_("Restored"))&&e(!0)}},{label:_("Delete"),icon:v("trash"),danger:!0,run:async()=>{await me(_("Delete this backup?"),m(_("The backup from %s is removed from the router."),Ho(n.created)),_("Delete"),!0)&&await F(()=>N.backupDelete(n.name),_("Backup deleted"))&&e()}}]),"neutral","dl-icon-only")])])}function Wr(n,e){let o=n.slice(0,jr).map(d=>Ur(d,e)),s=n.slice(jr),r=n.length?t("div",{class:"dl-list"},[...o,s.length?t("details",{class:"dl-bk-older"},[t("summary",{},[v("chevron"),W(s.length,"%s older backup","%s older backups")]),...s.map(d=>Ur(d,e))]):""]):t("div",{class:"dl-list"},[t("div",{class:"dl-row dl-muted"},_("No backups yet."))]),a=A(_("Restore from file"),async()=>{let d=await eo(".tar.gz,.tgz,application/gzip","base64");if(!d)return;await me(_("Restore from file?"),m(_("Replace the current Dawnline configuration with %s? The current state is backed up first."),d.name),_("Restore"),!0)&&await F(()=>N.backupUpload(d.data),_("Restored"))&&e(!0)}),i=A(_("Export JSON"),async()=>{let d=await F(()=>N.exportJson());d&&Ne(`dawnline-export-${new Date().toISOString().slice(0,10)}.json`,JSON.stringify(d,null,2),"application/json")}),l=A(_("Import JSON"),async()=>{let d=await eo(".json,application/json","text");if(!d)return;let c;try{c=JSON.parse(d.data)}catch{q(_("Not a JSON file."),"error");return}await me(_("Import?"),_("This replaces the whole Dawnline configuration on this router. The current state is backed up first."),_("Import"),!0)&&await F(()=>N.importJson(c),_("Imported"))&&e(!0)});return t("section",{class:"dl-setsec",id:"dl-set-backups"},[t("div",{class:"dl-setsec-body"},[t("div",{class:"dl-setsec-head"},[t("div",{class:"dl-stack"},[t("h3",{},_("Backups")),t("span",{class:"dl-sub"},_("Nightly when something changed, and before every restore, import or update. The last 10 are kept."))]),t("span",{class:"dl-spacer"}),A([v("plus")," ",_("Back up now")],async()=>{await F(()=>N.backupCreate(),_("Backup created"))&&e()},"positive")]),r]),t("div",{class:"dl-setsec-foot"},[t("span",{class:"dl-sub"},_("Backups contain private keys: keep downloads safe. JSON moves everything except usage history to another router.")),t("span",{class:"dl-row-actions dl-bk-actions"},[a,i,l])])])}var zo="remove";function wl(){let n=he("",{placeholder:zo}),e=A(_("Remove Dawnline"),async()=>{await F(()=>N.uninstall(n.value.trim()),_("Dawnline removed"))&&(ce(),setTimeout(()=>location.reload(),800))},"negative",{disabled:!0});n.addEventListener("input",()=>{e.disabled=n.value.trim()!==zo}),de(_("Remove Dawnline?"),[t("p",{},m(_("Everyone is disconnected and the tunnel, firewall rules and portal are removed. A backup is made first. Type “%s” to confirm."),zo)),n],[ue()," ",e])}function Gr(){return We("danger",_("Remove Dawnline from this router"),[t("p",{class:"dl-muted"},_("Deletes the tunnel, firewall rules, access table and hostnames Dawnline created, and stops the service. People and keys are kept in a backup."))],[t("span"),A(_("Remove"),()=>wl(),"negative")],"danger")}var On=class{constructor(){this.root=t("div",{class:"dl-settings-main"});this.backups=[];this.portal=null;this.portalSeq=0;this.cards={}}load(){return N.settingsGet()}render(e){this.d=e,this.cards={portal:ft(()=>zr(this)),defaults:ft(()=>Rr(this)),map:ft(()=>Ir(this)),updates:ft(()=>Br(this)),logs:ft(()=>Or(this)),backups:ft(()=>Wr(this.backups,r=>this.loadBackups(r))),danger:ft(()=>Gr())};let o=["portal","defaults","map","updates","logs","backups","danger"];dom.content(this.root,o.map(r=>this.cards[r].el)),this.loadBackups().then(()=>{new URLSearchParams(location.search).get("section")==="backups"&&document.getElementById("dl-set-backups")?.scrollIntoView({block:"start"})}),this.loadPortal();let s=new URLSearchParams(location.search).get("section");return s&&s!=="backups"&&requestAnimationFrame(()=>document.getElementById(`dl-set-${s}`)?.scrollIntoView({block:"start"})),t("div",{},[t("div",{class:"dl-pagehead"},[t("h2",{class:"dl-h1"},_("Settings"))]),this.root])}async save(e,o,s){let r=await F(()=>N.settingsUpdate(e),o);r&&(this.d=r,this.cards[s].refresh(),s==="portal"&&this.loadPortal())}async loadPortal(){let e=++this.portalSeq,o=await N.portalInfo().catch(()=>null);e===this.portalSeq&&(this.portal=o??this.portal??{candidates:[],checks:[]},this.portalFill?.(this.portal))}async loadBackups(e=!1){e&&await this.reload();let o=await N.backupList().catch(()=>null);o&&(this.backups=o.backups,this.cards.backups?.refresh())}async reload(e){let o=await N.settingsGet().catch(()=>null);if(o){if(this.d=o,e)this.cards[e].refresh();else for(let s of Object.values(this.cards))s.refresh();(!e||e==="portal")&&this.loadPortal()}}};function qr(n,e=!1){return n&&(e?/^https?:\/\//i:/^https:\/\//i).test(n)?n:null}function Fr(n){let e=[],o=l=>{let d=[],c=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\((https?:\/\/[^)\s]+)\))|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?])/g,p=0;for(let u;u=c.exec(l);)u.index>p&&d.push(l.slice(p,u.index)),u[1]?d.push(t("code",{},u[1].slice(1,-1))):u[2]?d.push(t("b",{},u[2].slice(2,-2))):u[3]?d.push(t("a",{href:u[4],target:"_blank",rel:"noopener"},u[3].replace(/^\[|\]\(.*$/g,""))):u[5]&&d.push(t("a",{href:u[5],target:"_blank",rel:"noopener"},u[5].replace(/^https?:\/\/(github\.com\/)?/,""))),p=u.index+u[0].length;return p{r.length&&e.push(t("p",{},o(r.join(" ")))),r=[],s=null};for(let l of n.replace(/\r/g,"").split(` `)){let d=l.trimEnd();if(a){/^```/.test(d.trim())?(e.push(t("pre",{},a.join(` `))),a=null):a.push(l);continue}if(/^```/.test(d.trim())){i(),a=[];continue}let c=/^(#{1,6})\s+(.*)$/.exec(d),p=/^\s*[-*+]\s+(.*)$/.exec(d)??/^\s*\d+[.)]\s+(.*)$/.exec(d);c?(i(),e.push(t("h5",{},o(c[2])))):p?(r.length&&i(),s||(s=t("ul",{}),e.push(s)),s.appendChild(t("li",{},o(p[1])))):d.trim()?(s&&(s=null),r.push(d.trim())):i()}return a&&e.push(t("pre",{},a.join(` `))),i(),e}function Kr(n){let e=[],o=!1;for(let s of n.replace(/\r/g,"").split(` `)){let r=/^#{1,6}\s+(.*)$/.exec(s);if(r){if(o=/^install\b/i.test(r[1].trim()),/^what.s new$/i.test(r[1].trim()))continue}else/^\*\*Full Changelog\*\*/.test(s)&&(o=!1);o||e.push(s)}return e.join(` `).replace(/\n{3,}/g,` -`).trim()}async function sn(n,e,o,s){let r=t("div",{class:"dl-notes"},t("p",{class:"dl-muted dl-loading"},_("Loading release notes…"))),a=t("div",{class:"dl-op-head"}),i="";de(o,[a,r],[A([v("copy")," ",_("Copy")],()=>xe(i,_("Release notes copied")))," ",ue(_("Close"))],"wide");try{let l=await N.updatesNotes(n,e,s??"");i=Kr(l.body||"");let d=qr(l.url);dom.content(a,[l.published?t("span",{class:"dl-pill"},Oe(l.published)):"",l.prerelease?t("span",{class:"dl-pill warn"},_("Pre-release")):"",t("span",{class:"dl-spacer"}),d?t("a",{href:d,target:"_blank",rel:"noopener",class:"dl-linkbtn"},[_("On GitHub")," ",v("open")]):""]),dom.content(r,i.trim()?Fr(i):t("p",{class:"dl-muted"},_("This release has no notes.")))}catch(l){dom.content(r,t("p",{class:"dl-muted"},Ce(l)))}}function yl(n){let e={"6h":_("checks every 6 h"),"12h":_("checks every 12 h"),"1d":_("checks daily"),"7d":_("checks weekly")};return e[n]??e["1d"]}var Ro=n=>n?Oe(n):"";function kl(n){let e=/^(.{20,}?)(?:;\s|:\s)/.exec(n)?.[1];return e||(n.length<=90?n:`${n.slice(0,90).replace(/[\s,;:]+\S*$/,"")}…`)}function Vr(n,e){let o=n.st,s=o.policy,r=o.kept?.app,a=e?.update&&e.tag?e.tag:o.version,i=k=>()=>sn("app",k,m(_("What’s new in Dawnline %s"),k.replace(/^v/,""))),l=e?.tag&&(e.update||e.status==="latest")?_l(n,e.tag,e.update?o.version:""):null,d=e?.tag??a,c=s.check&&o.auto?.check?o.auto.check+({"6h":6,"12h":12,"1d":24,"7d":168}[s.interval]??24)*3600:0,p=(k,M)=>t("div",{class:"dl-stack gap4"},[t("span",{class:"dl-metric-label"},k),t("span",{class:"dl-comp-side-v"},M)]),u=[{label:_("What’s new"),ic:"file",run:i(a)},{label:_("Open on GitHub"),ic:"globe",run:()=>window.open(`https://github.com/${o.repo}`,"_blank","noopener")},null,{label:m(_("Reinstall %s"),o.version),ic:"reset",warn:!0,run:()=>n.op("app:reinstall",_("Reinstalling Dawnline"),o.version)},r?{label:m(_("Roll back to %s"),r.version),ic:"archive",warn:!0,run:async()=>{await me(m(_("Roll back to Dawnline %s?"),r.version),m(_("The copy kept on the router replaces %s. A backup of the settings is made first."),o.version),_("Roll back"))&&n.op("app:rollback",_("Rolling back Dawnline"),o.version)}}:null];return t("section",{class:"dl-panel flush dl-comp-hero"},[t("div",{class:"dl-comp-hero-main"},[t("div",{class:"dl-comp-hero-head"},[t("span",{class:"dl-group-ic"},v("sunrise")),t("b",{class:"dl-comp-name"},"Dawnline"),n.state("app",e,e?.latest??""),t("span",{class:"dl-spacer"}),n.round(()=>n.op("check:app",_("Checking Dawnline"),o.version),u,!0)]),t("div",{class:"dl-comp-verrow"},[t("div",{class:"dl-stack"},[t("div",{class:"dl-comp-big"},[o.version,e?.update?t("small",{},`→ ${e.latest}`):e?.status==="dev"&&e.latest?t("small",{class:"dl-faint"},m(_("release %s"),e.latest)):""]),t("span",{class:"dl-faint dl-comp-meta"},e?.error?"":e?.update?e.published?m(_("released %s"),Ro(e.published)):"":e?.status==="dev"?_("ahead of the latest release"):e?[_("latest release"),e.published?m(_("released %s"),Ro(e.published)):""].filter(Boolean).join(" · "):_("not checked yet"))])]),l?.items.length?t("div",{class:"dl-stack gap4"},[t("ul",{class:"dl-comp-bullets"},l.items.map(k=>t("li",{},k))),l.total>l.items.length?t("button",{type:"button",class:"dl-linkbtn dl-comp-more",click:i(d)},W(l.total-l.items.length,"+%s more in What’s new","+%s more in What’s new")):""]):"",e?.error?t("p",{class:"dl-sub dl-comp-lead dl-upd-bad"},e.error):"",e?.update?t("div",{class:"dl-comp-btns"},[A(_("Update now"),()=>n.op("app",_("Updating Dawnline"),o.version),"positive",{disabled:n.busy}),A(_("What’s new"),i(a))]):"",Ll(n),Cl(n)]),t("div",{class:"dl-comp-hero-side"},[p(_("Source"),[v("globe"),t("a",{href:`https://github.com/${o.repo}`,target:"_blank",rel:"noopener"},o.repo)]),p(_("Auto-update"),[s.auto?Pe("ok",_("On")):Pe("",_("Off")),t("span",{class:"dl-muted"},s.auto?s.mode==="immediate"?_("as soon as found"):m(s.interval==="7d"?_("weekly at %s"):_("daily at %s"),s.time):s.check?yl(s.interval):_("checks off"))]),p(_("Last check"),o.check?[pe(o.check.time,o.now),c>o.now?t("span",{class:"dl-faint"},`· ${m(_("next in %s"),ot(c-o.now))}`):""]:[_("Never")]),p(_("Rollback"),r?[t("span",{class:"dl-mono"},r.version),t("span",{class:"dl-faint"},_("kept on flash"))]:[t("span",{class:"dl-muted"},s.keep?_("Kept after the next update"):_("Off"))])])])}function _l(n,e,o){if(n.notes.has(e))return n.notes.get(e)??null;n.notes.set(e,null);let s=r=>r.replace(/\*\*|`|\[([^\]]+)\]\([^)]*\)/g,(a,i)=>i??"").trim();return(async()=>{let a=((await N.updatesNotes("app",e,"").catch(()=>null))?.body??"").split(` -`).map(l=>/^\s*[-*+]\s+(.*)$/.exec(l)?.[1]).filter(l=>!!l);a.length||(a=(await N.updatesChanges(o,e).catch(()=>null))?.items??[]);let i={items:a.slice(0,3).map(l=>kl(s(l))),total:a.length};n.notes.set(e,i),i.items.length&&n.root.isConnected&&n.paint()})(),null}function jn(n){return n==="ru"?_("Russian translation"):n}function Cl(n){let e=(n.st.translations??[]).includes("ru"),o=ye(e,jn("ru"),r=>{n.op(r?"app:lang:ru":"app:nolang",r?_("Adding the Russian translation"):_("Removing the Russian translation"),n.st.version)});o.disabled=n.busy;let s=t("details",{class:"dl-params dl-comp-fold",open:n.langOpen?"open":null},[t("summary",{},[v("chevron"),t("span",{},_("Translation")),t("span",{class:"dl-sub"},e?_("Russian"):_("English only"))]),t("div",{class:"dl-params-body"},[t("div",{class:"dl-list"},[t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},jn("ru")),t("span",{class:"dl-sub"},_("LuCI pages for Dawnline"))]),t("span",{class:"dl-comp-bact"},o)])])])]);return s.addEventListener("toggle",()=>n.langOpen=s.open),s}function Ll(n){let e=t("div",{class:"dl-params-body"}),o=t("details",{class:"dl-params dl-comp-vers",open:n.versOpen?"open":null},[t("summary",{},[v("chevron"),t("span",{},_("Versions")),t("span",{class:"dl-sub"},_("install any release"))]),e]);return o.addEventListener("toggle",()=>{n.versOpen=o.open,n.versOpen&&Un(n,e)}),n.versOpen&&Un(n,e),o}async function Un(n,e){let o=he("",{placeholder:_("Tag, e.g. 0.3.1"),class:"cbi-input-text dl-mono","aria-label":_("Release tag")}),s=p=>{if(p=p.trim(),!/^v?[0-9][0-9A-Za-z.+~-]{0,40}$/.test(p))return q(_("Enter a release tag like 0.3.1"),"warning");Yr(n,p)};o.addEventListener("keydown",p=>{p.key==="Enter"&&(p.preventDefault(),s(o.value))});let r=t("div",{class:"dl-comp-tag"},[o,A(_("Install"),()=>s(o.value),"neutral",{disabled:n.busy})]),a=n.versPage,i=p=>{n.versPage=Math.max(1,n.versPage+p),Un(n,e)},l=p=>t("div",{class:"dl-comp-pager"},[t("button",{type:"button",class:"dl-linkbtn",disabled:a<=1?"disabled":null,click:()=>i(-1)},_("← Newer")),t("span",{class:"dl-faint"},m(_("Page %s"),a)),t("button",{type:"button",class:"dl-linkbtn",disabled:p?null:"disabled",click:()=>i(1)},_("Older →"))]),d=n.versCache.get(a);if(!d){dom.content(e,[r,t("p",{class:"dl-muted dl-loading"},_("Loading versions…"))]);try{d=(await N.updatesReleases(a)).releases}catch(p){if(a!==n.versPage||!e.isConnected)return;dom.content(e,[r,t("div",{class:"dl-row-actions"},[t("span",{class:"dl-muted"},m(_("Failed to load versions: %s"),Ce(p))),A(_("Try again"),()=>Un(n,e))]),l(!1)]);return}if(n.versCache.set(a,d),a!==n.versPage||!e.isConnected)return}if(!d.length)return dom.content(e,[r,t("p",{class:"dl-muted"},a>1?_("No more versions."):_("No versions found.")),l(!1)]);let c=n.st.version;dom.content(e,[r,...d.map(p=>{let u=p.tag.replace(/^v/,"");return t("div",{class:"dl-comp-ver"},[t("span",{class:"dl-mono"},u),t("span",{class:"dl-sub"},Ro(p.published)),p.prerelease?Pe("warn",_("Pre-release")):"",t("span",{class:"dl-comp-ic"},$e("file",_("What’s new"),()=>sn("app",p.tag,m(_("What’s new in Dawnline %s"),u)))),u===c?Pe("ok",_("Installed")):A(_("Install"),()=>Yr(n,p.tag),"neutral",{disabled:n.busy})])}),l(d.length>=5)])}async function Yr(n,e){let o=e.replace(/^v/,"");o.localeCompare(n.st.version,void 0,{numeric:!0})<0&&!await me(m(_("Install Dawnline %s?"),o),m(_("It is older than %s. A backup of the settings is made first; restore it from Settings if something looks wrong."),n.st.version),_("Install"))||n.op(`app@${e}`,m(_("Installing Dawnline %s"),o),n.st.version)}function Jr(n,e){let o=n.st,s=o.kept?.amneziawg,r=e?.sources??{},a=Object.keys(r),i=e?.current??null,l=i?r[i]:void 0,d=!!e?.ru,c=o.needs?.awg??[],p=c.length?null:e?.installed??null,u=[];i&&p&&u.push({label:_("Reinstall this build"),warn:!0,ic:"reset",run:()=>n.op(`amneziawg:${i}${d?":ru":""}`,_("Reinstalling AmneziaWG"),p)}),s&&u.push({label:m(_("Roll back to %s"),s.version),ic:"archive",warn:!0,run:async()=>{await me(m(_("Roll back AmneziaWG to %s?"),s.version),_("The build kept on the router is installed again. Every AmneziaWG tunnel restarts for a few seconds."),_("Roll back"))&&n.op("amneziawg:rollback",_("Rolling back AmneziaWG"),p??void 0)}});let k=[e?.release?{label:_("What’s new"),ic:"file",run:()=>sn("amneziawg",e.release,m(_("What’s new in the %s build"),l?.label??"AmneziaWG"),i??"slava")}:null,{label:_("Open on GitHub"),ic:"globe",run:()=>window.open(`https://github.com/${l?.repo??"Slava-Shchipunov/awg-openwrt"}`,"_blank","noopener")},...u.length?[null,...u]:[]].filter((y,f,x)=>y!==null||f>0&&x[f-1]!==null),M=o.tunnels??[],g=M.length?M.length===1?m(_("Switching restarts the tunnel for a few seconds: %s. Devices keep their configurations."),M[0]):m(N_(M.length,"Switching restarts %s tunnel for a few seconds: %s. Devices keep their configurations.","Switching restarts %s tunnels for a few seconds: %s. Devices keep their configurations."),K(M.length),M.join(", ")):_("Switching takes a few seconds. Devices keep their configurations."),h=M.length>1?m(_("%s and %s"),M.slice(0,-1).join(", "),M[M.length-1]):M[0],E=M.length?m(_("Switching restarts %s for a few seconds."),h):_("Switching takes a few seconds."),H=async y=>{let f=r[y];await me(p?m(_("Switch to AmneziaWG %s?"),f.gen):m(_("Install AmneziaWG %s?"),f.gen),[m(_("The %s build, %s."),f.label,f.version),g,f.gen==="3.1"?_("Devices need AmneziaVPN 3.1 or newer."):""].filter(Boolean).join(" "),p?_("Switch"):_("Install"))&&n.op(`amneziawg:${y}${d?":ru":""}`,p?m(_("Switching to AmneziaWG %s"),f.gen):_("Installing AmneziaWG"),p??void 0)},S=y=>{let f=r[y],x=i===y&&!!p;return t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},f.gen?`AmneziaWG ${f.gen}`:"AmneziaWG"),t("span",{class:"dl-sub"},`${f.label} · ${f.gen==="3.1"?"AmneziaVPN 3.1+":_("every app")}`)]),t("span",{class:"dl-mono dl-faint dl-comp-bver"},f.version??_("none yet")),t("span",{class:"dl-comp-bact"},x?Pe("ok",_("Active","build")):f.version?A(p?_("Switch"):_("Install"),()=>H(y),p?"neutral":"positive",{disabled:n.busy}):Pe("",_("No build")))])},$=a.map(y=>r[y]?.newer?m(_("%s moves to %s with OpenWrt %s."),r[y].label,r[y].newer.gen,r[y].newer.tag.replace(/^v/,"")):"").filter(Boolean),b=ye(d,_("Russian translation"),y=>{i&&n.op(`amneziawg:${i}${y?":ru":""}`,y?_("Adding the Russian translation"):_("Removing the Russian translation"),p??void 0)});b.disabled=!i||!p||n.busy;let C=n.awgOpen??!p,w=t("details",{class:"dl-params dl-comp-fold",open:C?"open":null},[t("summary",{},[v("chevron"),t("span",{},_("Build and translation"))]),t("div",{class:"dl-params-body"},[t("div",{class:"dl-list"},[...a.length?a.map(S):[t("div",{class:"dl-row"},t("span",{class:"dl-sub"},_("Check for updates to see the builds for this router.")))],t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},_("Russian translation")),t("span",{class:"dl-sub"},_("LuCI pages for AmneziaWG"))]),t("span",{class:"dl-comp-bact"},b)])]),p&&a.length||$.length?t("div",{class:`dl-comp-status ${p&&a.length?"warn":"acc"}`},[v(p&&a.length?"alert":"download"),t("span",{},[p&&a.length?t("b",{},E):"",...$.map(y=>` ${y}`)])]):""])]);w.addEventListener("toggle",()=>n.awgOpen=w.open);let z=[];return e?.update&&p&&i?z.push(A(m(_("Update to %s"),e.latest),()=>n.op(`amneziawg:${i}${d?":ru":""}`,_("Updating AmneziaWG"),p),"neutral",{disabled:n.busy})):z.push((e||c.length)&&!p?Pe("warn",_("Not installed")):n.state("amneziawg",e,e?.latest??"")),z.push(n.round(()=>n.op("check:amneziawg",_("Checking AmneziaWG"),p??void 0),k)),[n.row("shield","AmneziaWG",[p?`${p}${e?.release?` · ${m(_("%s build"),e.release)}`:""}`:c.length?m(_("missing %s"),c.join(", ")):e?_("not installed"):_("version not checked")],z),t("div",{class:"dl-comp-foldwrap"},w)]}function Ml(){return[{title:_("Home-like link"),sub:_("Policy routing and the veth pair"),pkgs:["ip-full","kmod-veth"],feature:"home"},{title:_("HTTPS for the portal"),sub:_("OpenSSL for uhttpd"),pkgs:["libustream-openssl","openssl-util"],feature:"https"},{title:_("Certificates (ACME)"),sub:_("Let’s Encrypt certificate for the portal"),pkgs:["acme","acme-acmesh-dnsapi"],feature:"acme",optional:!0}]}var Io={home:"network",https:"lock",acme:"file"};function Zr(n,e){let o=n.st,s=e?.pkgs??{},r=Ml().filter(c=>c.feature==="home"?o.home:o.portal),a=async(c,p,u=c)=>{await me(m(_("Update %s?"),p),m(_("%s from the OpenWrt feeds. Services that use them restart for a moment."),u.join(", ")),_("Update"))&&n.op(`pkgs:${c.join(",")}`,m(_("Updating %s"),p))},i=[{label:_("Check system packages"),ic:"refresh",run:()=>n.op("check:packages",_("Checking system packages"))},{label:_("Open the OpenWrt package list"),ic:"globe",run:()=>window.open("https://openwrt.org/packages/start","_blank","noopener")}],l=0;return{rows:r.map(c=>{let p=c.pkgs.filter(h=>s[h]?.installed),u=[...new Set(p.flatMap(h=>[...s[h]?.latest?[h]:[],...s[h]?.with??[]]))],k=o.needs?.[c.feature]??c.pkgs.filter(h=>!s[h]?.installed),M=p.find(h=>s[h]?.latest),g=p.map(h=>`${h} ${s[h]?.installed??""}`).join(", ");return k.length?n.row(Io[c.feature],c.title,[c.optional?_("not installed"):m(_("missing %s"),k.join(", "))],[A(_("Install"),()=>n.op(`pkgs:${k.join(",")}`,m(_("Installing %s"),c.title)),c.optional?"neutral":"positive",{disabled:n.busy}),t("span",{class:"dl-comp-ic"},n.more(i))]):e&&u.length?(l++,n.row(Io[c.feature],c.title,M?[`${s[M].installed} → ${s[M].latest}`,u.length>1?` · +${u.length-1}`:""]:[u.join(", ")],[A(_("Update"),()=>a(p.filter(h=>s[h]?.latest||s[h]?.with?.length),c.title,u),"neutral",{disabled:n.busy}),t("span",{class:"dl-comp-ic"},n.more(i))])):n.row(Io[c.feature],c.title,[g||c.sub],[n.state("pkgs",e,""),t("span",{class:"dl-comp-ic"},n.more(i))])}),updates:l,total:r.length}}function El(n){return n==="app"?"Dawnline":n==="amneziawg"?"AmneziaWG":n==="pkgs"?_("System packages"):_("Components")}function Tl(n){let e=/^(\d+) system packages?$/.exec(n)?.[1];return e?W(Number(e),"%s system package","%s system packages"):n}function Qr(n){let e=n.st,o=r=>{let a=mt(r.component??"app"),i=t("b",{},El(a)),l="ok",d="check",c;if(r.kind==="found")l="accent",d="download",c=ae(r.auto?_("%s found by the automatic check"):_("%s found by a check"),t("b",{},(r.items??[]).map(Tl).join(", ")));else if(r.state==="failed")l="bad",d="x",c=[...ae(r.kind==="install"?_("%s update failed"):_("%s check failed"),i),r.error?` · ${r.error}`:""];else if(/^app:(lang:|nolang$)/.test(r.component??"")){let p=/^app:lang:(.+)$/.exec(r.component??"")?.[1];c=p?ae(_("%s added by you"),t("b",{},jn(p))):[_("Translation removed by you")]}else{let p=r.from&&r.to&&r.from!==r.to?`${r.from} → ${r.to}`:r.to??"";c=[...p?ae(r.auto?_("%s %s automatically"):_("%s %s by you"),i,p):ae(r.auto?_("%s updated automatically"):_("%s updated by you"),i),r.took?` · ${ot(r.took)}`:""]}return t("div",{class:"dl-row"},[t("span",{class:`dl-ev-tile ev ${l}`},v(d)),t("span",{class:"dl-row-main"},c),t("span",{class:"dl-faint dl-nowrap",title:new Date(r.ts*1e3).toLocaleString(ie())},pe(r.ts,e.now))])},s=e.history??[];return t("section",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Activity")),t("span",{class:"dl-spacer"}),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},_("All in Log →"))]),s.length?t("div",{},s.slice(0,8).map(o)):t("p",{class:"dl-sub dl-comp-empty"},_("Updates, and checks that found something, show up here."))])}var Wn=class{constructor(){this.root=t("div",{class:"dl-upd"});this.following=null;this.versOpen=!1;this.versPage=1;this.versCache=new Map;this.notes=new Map;this.awgOpen=null;this.langOpen=!1}load(){return N.updatesStatus()}render(e){return this.st=e,this.paint(),e.job?.state==="running"&&this.follow(e.job),poll.add(async()=>{if(!this.root.isConnected)return;let o=await N.updatesStatus().catch(()=>null);if(!o)return;let s=this.st;this.st=o,o.job?.state==="running"&&this.following!=="starting"&&o.job.id!==this.following&&this.follow(o.job),(o.job?.id!==s.job?.id||o.job?.state!==s.job?.state||o.job?.phase!==s.job?.phase||o.check?.time!==s.check?.time)&&this.paint()},5),this.root}get busy(){return this.st.job?.state==="running"}async refresh(e){this.st=e??await N.updatesStatus().catch(()=>null)??this.st,this.paint()}async op(e,o,s){if(this.busy||this.following==="starting"){q(_("Another component action is already running"),"warning");return}this.following="starting",this.paint();let r=mt(e),a=await tn(e,{title:o,version:s,onJob:i=>this.following=i.id,onDone:i=>this.refresh(i),onUpdate:i=>{let l=i.check?.components??{};r==="amneziawg"&&l.amneziawg?.current?this.op(`amneziawg:${l.amneziawg.current}${l.amneziawg.ru?":ru":""}`,_("Updating AmneziaWG"),l.amneziawg.installed??void 0):this.op("app",_("Updating Dawnline"),this.st.version)}});this.following==="starting"&&(this.following=a?.id??null),this.refresh()}async follow(e){this.following=e.id;let o={app:[_("Checking Dawnline"),_("Automatic update: Dawnline"),_("Updating Dawnline")],amneziawg:[_("Checking AmneziaWG"),_("Automatic update: AmneziaWG"),_("Updating AmneziaWG")],pkgs:[_("Checking system packages"),_("Automatic update: system packages"),_("Updating system packages")],all:[_("Checking components"),_("Automatic update: components"),_("Updating components")]};await tn(null,{title:(o[An(e)]??o.all)[e.action==="check"?0:e.auto?1:2],onDone:s=>this.refresh(s)},e)}paint(){let e=this.st,o=e.check?.components??{},s=e.firmware,r=Zr(this,o.packages),a=(e.needs?.awg??[]).length>0,l=(!a&&o.amneziawg?.update&&o.amneziawg.installed?1:0)+r.updates;dom.content(this.root,[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},_("Components")),t("span",{class:"dl-faint"},[s?.version?`OpenWrt ${s.version} · ${s.target}`:"",e.check?m(_("checked %s"),pe(e.check.time,e.now)):_("not checked yet")].filter(Boolean).join(" · "))]),t("div",{class:"dl-row-actions"},[t("a",{class:"cbi-button cbi-button-neutral dl-icon-btn",href:`${L.url("admin/network/dawnline/settings")}?section=updates`},[v("edit")," ",_("Settings")]),A([v("refresh")," ",_("Check all")],()=>this.op("check",_("Checking all components")),"neutral",{disabled:this.busy})])]),Vr(this,o.app),t("div",{class:"dl-comp-cols"},[t("section",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Components")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint dl-comp-count"},a?l?`${_("AmneziaWG not installed")} · ${W(l,"%s update","%s updates")}`:_("AmneziaWG not installed"):!o.amneziawg&&!o.packages?"":l?m(N_(l,"%s of %s needs an update","%s of %s need an update"),K(l),K(1+r.total)):_("Everything is up to date"))]),t("div",{},[...Jr(this,o.amneziawg),...r.rows])]),Qr(this)])])}state(e,o,s){let r=this.st.job;if(r?.state==="running"){let a=l=>l==="packages"?"pkgs":l,i=r.action==="check"?[a(r.component||"all")]:(r.component??"").split(" ").map(l=>a(mt(l)));if(i.includes(e)||i.includes("all"))return t("button",{type:"button",class:"dl-pill info dl-comp-run",title:_("Show progress"),click:()=>this.follow(r)},[r.action==="check"?_("Checking…"):_("Updating…")])}return o?o.error?Pe("warn",_("Check failed"),o.error):o.update?Pe("info",_("Update available")):o.status==="dev"?Pe("info",_("Newer than release"),m(_("The latest release is %s"),s)):Pe("ok",_("Up to date")):Pe("",_("Not checked"))}more(e){let o=A([v("more")],()=>Se(o,e.filter((s,r,a)=>s!==null||r>0&&rs?{label:s.label,icon:v(s.ic),warn:s.warn,run:s.run}:null)),"neutral",{title:_("More"),"aria-label":_("More")});return o}round(e,o,s=!1){let r=this.busy?" is-busy":"",a;return s?a=A([v("refresh")," ",_("Check")],e,"neutral",{class:`cbi-button cbi-button-neutral dl-comp-check${r}`,"aria-label":_("Check for updates")}):(a=$e("refresh",_("Check for updates"),e,"neutral",r.trim()),a.removeAttribute("title"),a.setAttribute("aria-label",_("Check for updates")),we(a,()=>[_("Check for updates")])),t("span",{class:"dl-comp-ic"},[a,this.more(o)])}row(e,o,s,r){return t("div",{class:"dl-row"},[t("span",{class:"dl-group-ic"},v(e)),t("span",{class:"dl-row-main dl-stack"},[t("b",{},o),t("span",{class:"dl-mono dl-faint dl-comp-sub"},s)]),...r])}};var Xr=(n,e)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},n),t("div",{class:"cbi-value-field"},e)]);function ea(n){let e=n.st.servers.find(o=>o.id===n.p.server)?.name??_("Home");Xt(n.p,e)}async function ta(n){let e=n.p,o=e.code_set??0,s=e.devices.filter(l=>l.created_by==="portal"&&l.created>=o),r=s.map(l=>t("input",{type:"checkbox",id:`dl-rm-${l.id}`,checked:"checked","data-id":l.id})),a=[t("p",{},_("The old link stops working right away."))];s.length&&a.push(t("p",{},_("Devices added through the old link keep working until they are removed. Remove them too:")),t("div",{class:"dl-checklist"},s.map((l,d)=>t("label",{for:`dl-rm-${l.id}`},[r[d],` ${l.name}`]))));let i=async()=>{let l=r.filter(c=>c.checked).map(c=>c.dataset.id),d=await F(()=>N.personRegen(e.id,l),l.length?W(l.length,"New link created, %s device removed","New link created, %s devices removed"):_("New link created"));d&&(ce(),l.length&&await n.refresh(),d.link&&await xe(d.link,_("New link copied")))};de(_("Create a new link?"),a,[ue()," ",A(_("Create new link"),i,"negative")])}function Bo(n){let e=t("textarea",{class:"cbi-input-textarea dl-note-input",rows:3,maxlength:500,placeholder:_("Only you see this")},n.p.note??"");de(_("Note"),[e],[ue()," ",A(_("Save"),async()=>{ce(),await n.patch({note:e.value.trim()},e.value.trim()?_("Note saved"):_("Note removed"))},"positive")]),setTimeout(()=>e.focus(),50)}function na(n){let e=n.p,o=t("select",{class:"cbi-input-select"},[t("option",{value:"pause",selected:e.expire_action==="pause"?"selected":null},_("Pause access")),t("option",{value:"notify",selected:e.expire_action==="notify"?"selected":null},_("Keep access")),t("option",{value:"remove",selected:e.expire_action==="remove"?"selected":null},_("Remove their devices"))]),s=t("select",{class:"cbi-input-select"},[0,1,3,7,14].map(r=>t("option",{value:r,selected:e.expire_warn===r?"selected":null},r?W(r,"%s day before","%s days before"):_("Don’t warn"))));de(_("When access ends"),[Xr(_("Then"),o),t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},_("Warn")),t("div",{class:"cbi-value-field"},[s,t("div",{class:"cbi-value-description"},_("Shown in their portal and on the Overview."))])])],[ue()," ",A(_("Save"),async()=>{ce(),await n.patch({expire_action:o.value,expire_warn:s.value},_("Saved"))},"positive")])}function oa(n){let e=t("input",{type:"text",class:"cbi-input-text",value:n.p.name,maxlength:48}),o=Ee(_("Name","person"),e,()=>He(e.value,[],_("Shown in their portal and apps.")));de(_("Rename"),[o],[ue()," ",A(_("Save"),async()=>{let s=o.help();if(s.bad){q(s.text,"warning");return}await n.patch({name:e.value.trim()},_("Renamed"))&&ce()},"positive")]),setTimeout(()=>e.select(),50)}function sa(n){let e=n.p,o=n.st.servers.filter(a=>a.id!==e.server),s=t("select",{class:"cbi-input-select"},o.map(a=>t("option",{value:a.id},`${a.name} · ${a.endpoint||_("no address")}:${a.port}`))),r=e.devices.length;de(m(_("Move %s to another server"),e.name),[Xr(_("Server"),s),t("p",{class:"dl-muted"},r?W(r,"%s device gets a new address and stops connecting until it imports its configuration again (from the personal link or from you). Circles and home networks of the old server are left behind.","%s devices get new addresses and stop connecting until they import their configuration again (from the personal link or from you). Circles and home networks of the old server are left behind."):_("They have no devices yet: nothing else changes."))],[ue()," ",A(_("Move"),async()=>{await n.patch({server:s.value},m(_("Moved to %s"),o.find(a=>a.id===s.value)?.name??_("the server")))&&(ce(),r&&q(_("Devices are marked “Update config” until they import again."),"info",6e3))},"positive")])}async function ra(n){let e=n.p;await me(m(_("Delete %s?"),e.name),W(e.devices.length,"%s device is disconnected immediately and the personal link stops working.","All %s devices are disconnected immediately and the personal link stops working."),_("Delete"),!0)&&await F(()=>N.personDelete(e.id),_("Deleted"))&&(location.href=It(e.server))}function aa(n){let e=n.p,o=n.st,s=e.online?_("online now"):e.last_seen?m(_("last seen %s"),pe(e.last_seen,o.now)):_("never connected"),r=e.created?m(_("Added %s","date"),De(Ke(new Date(e.created*1e3)))):"",a=e.has_link??o.settings.portal_enabled,i=[{label:_("Rename"),icon:v("edit"),run:()=>oa(n)},{label:e.note?_("Edit note"):_("Add note"),icon:v("file"),run:()=>Bo(n)},...o.servers.length>1?[{label:_("Move to server…"),icon:v("server"),run:()=>sa(n)}]:[],...a?[null,{label:_("Invite card"),icon:v("qr"),run:()=>ea(n)},{label:_("New link"),icon:v("key"),run:()=>ta(n)}]:[],null,...e.paused?[]:[{label:_("Pause"),icon:v("pause"),warn:!0,run:()=>n.patch({paused:!0},_("Paused"))}],{label:_("Delete"),icon:v("trash"),danger:!0,run:()=>ra(n)}];return t("div",{class:"dl-person-head"},[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-person-id"},[t("span",{class:`dl-avatar lg${e.online?" online":""}`},je(e.name)),t("div",{class:"dl-stack"},[t("div",{class:"dl-title-row"},[t("h2",{class:"dl-h1"},e.name),Zo(e)]),t("span",{class:"dl-faint",title:r},`${m(N_(e.device_limit,"%s of %s device","%s of %s devices"),e.devices.length,e.device_limit)} · ${s}`)])]),t("div",{class:"dl-pcard-actions"},[e.paused?A([v("play"),` ${_("Resume")}`],()=>n.patch({paused:!1},_("Resumed")),"add"):"",a?$e("link",_("Copy link"),()=>Sn(e.id),"neutral","dl-icon-only"):"",$e("more",_("More"),l=>Se(l.currentTarget,i),"neutral","dl-icon-only")])]),e.note?t("button",{type:"button",class:"dl-pnote",title:_("Edit note"),click:()=>Bo(n)},[v("file"),t("span",{},e.note)]):""])}function ia(n){let e=n.p,o=n.series[n.series.length-1];return t("div",{class:`dl-person-live${e.online?"":" solo"}`},[e.online?zn(e.rate??[],n.st.now,o?[o.rx,o.tx]:[0,0]):"",Rn(n.series,m(_("%s this month"),oe(e.month[0]+e.month[1])))])}async function Sl(n,e){let o=await F(()=>N.deviceConfig(e.id));o&&de(m(_("Set up %s"),e.name),[await n.core.connectBlock(o,"qr")],[ue(_("Close"))])}async function Pl(n,e){let o=await F(()=>N.deviceConfig(e.id));if(!o)return;if(!o.has_private_key){q(_("This device made its own keys in the browser; its configuration only exists there."),"warning");return}let s=n.core.file.make(o);Ne(s.name,s.text,"application/octet-stream")}function la(n){let e=n.p,o=n.st.now,s=d=>Je(e,d,n.deviceOpts()),r=d=>c=>{c.target.closest("button:not(.dl-dcard-title), a")||s(d)},a=d=>A([v("more")],c=>dr(c.currentTarget,e,d,n.deviceOpts()),"neutral",{title:_("QR, file, key, rename, new keys, remove"),class:"cbi-button cbi-button-neutral dl-icon-only"}),i=ln(e.devices).map(d=>{let c=t("div",{class:"dl-dcard-head"},[t("span",{class:"dl-dcard-ic"},v(d.kind)),t("button",{type:"button",class:"dl-dcard-title",click:()=>s(d)},[t("b",{},d.name),dn(d,o,void 0,e),d.config_stale?t("span",{class:"dl-pill warn dl-stale"},_("Update config")):""]),a(d)]),p=t("div",{class:"dl-dcard-trend"},[t("div",{class:"dl-stack"},[t("b",{},oe(d.month[0]+d.month[1])),t("span",{class:"dl-sub"},_("this month"))]),$r(n.devSeries[d.id]??[])]);return t("article",{class:`dl-dcard clickable${d.online?" online":""}${d.disabled?" off":""}`,click:r(d)},[c,d.handshake?p:d.disabled?t("div",{class:"dl-sub"},`${at(d.kind)} · ${m(d.created_by==="portal"?_("created %s in the portal."):_("created %s by you."),pe(d.created,o))}`):t("div",{class:"dl-chips-row"},[t("button",{type:"button",class:"dl-chipbtn",click:()=>Sl(n,d)},[v("qr"),_("Show QR")]),t("button",{type:"button",class:"dl-chipbtn",click:()=>Pl(n,d)},[v("download"),_("Config")])])])}),l=e.devices.length>=e.device_limit;return i.push(t("button",{type:"button",class:"dl-dslot add",click:()=>ct(e,n.deviceOpts())},[t("span",{class:"dl-dslot-ic"},v("plus")),t("span",{class:"dl-stack"},[t("b",{},_("Add device")),t("span",{class:"dl-sub"},l?`${_("Over the limit")} · ${m(_("%s of %s"),e.devices.length,e.device_limit)}`:m(_("%s of %s"),e.devices.length,e.device_limit))])])),t("section",{class:"dl-devsec"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Devices")),t("span",{class:"dl-sub"},m(_("%s online"),K(e.online)))]),t("div",{class:"dl-dgrid"},i)])}function da(n){let e=n.p,o=Me([["device",_("Device’s own DNS")],["home",_("Home names")]],e.dns_mode,{label:"DNS",cls:"sm",optimistic:!1,onChange:r=>n.patch({dns_mode:r},r==="home"?_("Home names on - devices need their configuration again"):_("Device DNS - devices need their configuration again"))}),s=n.st.settings.home_dns_fallback;return t("div",{class:"dl-stack gap4 dl-dnspick"},[t("div",{class:"dl-row-actions"},[t("span",{class:"dl-sub"},"DNS"),o]),t("span",{class:"dl-sub"},e.dns_mode==="home"?s?ae(_("Names like %s work. Internet names are resolved at home, so they depend on the tunnel (%s takes over when it is down)."),t("span",{class:"dl-mono"},`nas.${n.st.settings.domain}`),t("span",{class:"dl-mono"},s)):ae(_("Names like %s work. Internet names are resolved at home, so they depend on the tunnel - with no fallback set, they stop when it is down."),t("span",{class:"dl-mono"},`nas.${n.st.settings.domain}`)):_("Internet keeps working exactly as without the VPN. Reach home devices by IP address."))])}function ca(n){let e=n.p,s=n.st.servers.find(a=>a.id===e.server)?.home??[];if(s.length<2)return"";let r=new Set(e.home_nets?.length?e.home_nets:s.map(a=>a.dev));return t("div",{class:"dl-stack gap4"},[t("div",{class:"dl-chips-row"},s.map(a=>Xe(a.dev,r.has(a.dev),()=>{let i=new Set(r);if(i.delete(a.dev)||i.add(a.dev),!i.size)return q(_("Keep at least one network, or choose Internet only."),"warning",5e3);let l=i.size===s.length?[]:[...i];n.patch({home_nets:l},l.length?m(_("%s reaches %s"),e.name,l.join(", ")):m(_("%s reaches every home network"),e.name))},{title:a.nets.join(", ")}))),t("span",{class:"dl-sub"},e.home_nets?.length?m(_("Home networks %s reaches. Networks added to the server later stay out."),e.name):m(_("Home networks %s reaches: all of them. Untick one to keep %s out of it."),e.name,e.name))])}function pa(n){let e=new Set(n.p.services??[]);return t("div",{class:"dl-stack gap4"},[t("div",{class:"dl-chips-row"},n.st.services.map(o=>Xe(o.name,e.has(o.id),()=>{let s=new Set(e);s.delete(o.id)||s.add(o.id),n.patch({services:[...s]},s.size?_("Home services updated"):_("Whole home network"))},{title:`${o.address}${o.ports.length?` · ${o.ports.join(", ")}`:""}`}))),t("span",{class:"dl-sub"},e.size?_("Only the selected services at home."):_("Whole home network. Pick services to narrow it down."))])}function ua(n){let e=n.p,o=n.st;if(o.servers.find(c=>c.id===e.server)?.mesh!=="circles"||!ut(e))return"";let r=o.circles.filter(c=>c.server===e.server),a=r.find(c=>c.id===e.circle),i=a?o.people.filter(c=>c.id!==e.id&&c.circle===a.id&&ut(c)).map(c=>c.name):[],l=t("button",{type:"button",class:"dl-chipbtn",click:()=>Se(l,[...r.map(c=>({label:c.name,icon:So(c),run:()=>c.id!==e.circle&&n.patch({circle:c.id},m(_("%s is in %s"),e.name,c.name))})),e.circle?{label:_("No circle"),icon:v("x"),run:()=>n.patch({circle:""},m(_("%s is in no circle"),e.name))}:null,{label:_("New circle"),icon:v("plus"),run:()=>$n(o,e.server,null,()=>n.refresh())}])},_("Change")),d=a?o.people.filter(c=>c.circle===a.id&&ut(c)):[e];return t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},_("Devices see each other")),l]),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},a?a.name:_("No circle")),t("span",{class:"dl-avstack",title:d.map(c=>c.name).join(", ")},d.slice(0,5).map(c=>t("span",{class:"dl-avatar sm"},je(c.name))))]),t("span",{class:"dl-sub"},a?i.length?[e.name,...i].join(", "):m(_("Nobody else in %s yet"),a.name):m(_("Only %s's own devices"),e.name))])}function ma(n){let e=n.p,o=n.st.now,s=t("div",{class:"dl-slots"});for(let i=0;i=e.device_limit,c=t("i",{class:d?"over":l?"used":""});we(c,()=>[t("div",{class:"dl-tip-title"},l?`${l.name}${d?` · ${_("over the limit")}`:""}`:_("Free slot")),t("div",{class:"dl-muted"},l?l.online?_("Connected"):l.handshake?m(_("Last seen %s"),pe(l.handshake,o)):_("Not set up yet"):_("They can add a device here"))]),s.appendChild(c)}let r=Math.max(1,e.devices.length),a=t("button",{type:"button","aria-label":_("Allow fewer devices"),disabled:e.device_limit<=r?"disabled":null,click:()=>n.patch({device_limit:String(e.device_limit-1)})},"−");return e.device_limit<=r&&e.devices.length>1&&we(a,()=>[t("div",{class:"dl-tip-title"},W(e.devices.length,"%s device in use","%s devices in use")),t("div",{class:"dl-muted"},_("Remove a device first to lower the limit"))]),t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},_("Devices")),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},[String(e.devices.length),t("span",{class:"dl-faint"},` / ${e.device_limit}`)]),t("div",{class:"dl-stepper"},[a,t("button",{type:"button","aria-label":_("Allow more devices"),disabled:e.device_limit>=32?"disabled":null,click:()=>n.patch({device_limit:String(e.device_limit+1)})},"+")])]),s])}function $l(n){return{internet:_("Browse the internet through your router. No access to devices at home, and home cannot reach theirs."),lan:_("Reach devices at home, and home reaches theirs. Internet stays on their own connection."),both:_("Home devices and the internet, all through your router. Home reaches their devices too.")}[n]}var ha=/^([01]\d|2[0-3]):[0-5]\d$/;function Dl(n){let e=n.p,o=n.today,s=st(e.expires,o),r=t("input",{type:"date",class:"dl-date-hidden",value:e.expires,tabindex:"-1","aria-hidden":"true"});r.addEventListener("change",()=>r.value&&n.patch({expires:r.value},m(_("Access until %s"),De(r.value))));let a=(c,p)=>{let u=Yo(e.expires&&(s??-1)>=0?e.expires:"",c,p,o);n.patch({expires:u},m(_("Access until %s"),De(u)))},i=[["week",1,_("+1 week")],["month",1,_("+1 month")],["month",3,_("+3 months")],["year",1,_("+1 year")]].map(([c,p,u])=>t("button",{type:"button",class:"dl-chipbtn",click:()=>a(c,p)},u)),l=t("span",{class:"dl-datechip"},[t("button",{type:"button",class:"dl-chipbtn",click:()=>{r.focus({preventScroll:!0});try{r.showPicker()}catch{}}},[v("calendar"),e.expires?De(e.expires):_("Date")]),r]),d={pause:_("pause access"),notify:_("keep access"),remove:_("remove their devices")}[e.expire_action];return t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},_("Access ends")),e.expires?t("span",{class:s!=null&&s<0?"dl-bad":rt(e,s)?"dl-warn":"dl-ok"},s!=null&&s<0?_("ended"):W(s??0,"%s day left","%s days left")):t("span",{class:"dl-faint"},_("no end date"))]),t("div",{class:"dl-chips-row"},[...i,l,e.expires?t("button",{type:"button",class:"dl-chipbtn",click:()=>n.patch({expires:""},_("No end date"))},_("No end")):""]),t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},e.expire_warn?m(N_(e.expire_warn,"When it ends: %s, warn %s day before","When it ends: %s, warn %s days before"),d,K(e.expire_warn)):m(_("When it ends: %s"),d)),t("a",{href:"#",click:c=>{c.preventDefault(),na(n)}},_("Change"))])])}function Al(n){let e=n.p,o=e.quota_used||e.month[0]+e.month[1],s=e.quota_limit?Math.min(100,e.quota_used/e.quota_limit*100):0,r=t("div",{class:`dl-meter${s>=100?" bad":s>=90?" warn":""}`},[t("i"),e.quota_limit?t("span",{class:"mark",title:_("Alert at 90%")}):""]);r.firstChild.style.width=`${s}%`,e.quota_limit&&we(r,()=>[t("div",{class:"dl-tip-title"},m(_("%s%% used"),K(s,1))),t("div",{class:"dl-muted"},`${m(_("%s of %s"),oe(e.quota_used),oe(e.quota_limit))} · ${m(_("%s left"),oe(Math.max(0,e.quota_limit-e.quota_used)))}`),t("div",{class:"dl-faint"},_("Alert at 90%"))]);let a=Me([["month",_("Monthly")],["total",_("Total")]],e.quota_period,{label:_("Data limit period"),cls:"sm",optimistic:!1,onChange:l=>n.patch({quota_period:l})}),i=[10,50,100].map(l=>t("button",{type:"button",class:`dl-chipbtn${e.quota_gb===l?" on":""}`,click:()=>n.patch({quota_gb:String(l)},m(_("Data limit %s GB"),K(l)))},`${K(l)} ${_("GB")}`));return i.push(t("button",{type:"button",class:`dl-chipbtn${e.quota_gb?"":" on"}`,click:()=>n.patch({quota_gb:""},_("No data limit"))},_("Unlimited"))),i.push(t("button",{type:"button",class:"dl-chipbtn",click:()=>{let l=t("input",{type:"number",class:"cbi-input-text dl-w-port",min:0,step:"any",value:e.quota_gb?String(e.quota_gb):""}),d=Ee(_("Data limit (GB)"),l,()=>gn(l.value,e.quota_period==="month"));de(_("Data limit"),[d],[ue()," ",A(_("Save"),async()=>{let c=d.help();if(c.bad){q(c.text,"warning");return}let p=l.value.trim();await n.patch({quota_gb:p},p&&Number(p)>0?m(_("Data limit %s GB"),K(Number(p))):_("No data limit"))&&ce()},"positive")]),setTimeout(()=>l.select(),50)}},_("Custom"))),t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},_("Data")),a]),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},[oe(o),e.quota_limit?t("span",{class:"dl-faint"},` ${m(_("of %s"),oe(e.quota_limit))}`):t("span",{class:"dl-faint"},` · ${_("no limit")}`)]),e.quota_period==="month"?t("span",{class:"dl-sub"},_("resets on the 1st")):""]),e.quota_limit?r:"",t("div",{class:"dl-chips-row"},i),e.quota_gb&&e.quota_period==="month"?t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},e.bonus_gb?m(_("Includes +%s GB extra this month"),K(e.bonus_gb)):_("Need a little more this month?")),t("a",{href:"#",click:l=>{l.preventDefault(),n.patch({bonus_gb:String((e.bonus_gb||0)+10)},_("+10 GB this month"))}},_("+10 GB this month"))]):"",t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},m(_("%s in total"),oe(e.total[0]+e.total[1]))),t("button",{type:"button",class:"dl-linkbtn danger",click:()=>Ht("person",e.id,e.name,()=>setTimeout(()=>n.refresh(),300))},_("Reset usage"))])])}function Nl(n){let e=n.p,o=!!e.hours,[s,r]=(e.hours||"07:00-23:00").split("-"),a=t("input",{type:"time",class:"cbi-input-text",value:s,"aria-label":_("From")}),i=t("input",{type:"time",class:"cbi-input-text",value:r,"aria-label":_("To")}),l=t("div",{class:"dl-tile2-row"},[a,t("span",{class:"dl-faint"},_("to","time range")),i]),d=()=>{let k=`${a.value}-${i.value}`;if(k!==e.hours){if(!ha.test(a.value)||!ha.test(i.value))return q(_("Enter both times, like 07:00 and 23:00."),"warning");if(a.value===i.value)return q(_("The start and the end must differ."),"warning");n.patch({hours:k},m(_("Allowed %s–%s"),a.value,i.value))}};l.addEventListener("focusout",k=>{l.contains(k.relatedTarget)||d()});for(let k of[a,i])k.addEventListener("keydown",M=>{M.key==="Enter"&&(M.preventDefault(),d())});let c=t("button",{type:"button",role:"switch","aria-checked":o?"true":"false",class:`dl-switch${o?" on":""}`,"aria-label":_("Limit hours"),click:()=>{if(o)return n.patch({hours:""},_("Any time"));c.classList.add("on"),c.setAttribute("aria-checked","true"),p.textContent=_("Set the hours, then press Enter"),u.appendChild(l),a.focus()}},t("i")),p=t("span",{},o?m(_("%s – %s (router time)"),s,r):_("Any time")),u=t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-row"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-tile2-label"},_("Allowed hours")),p]),c]),o?l:""]);return u}function fa(n){let e=n.p,o=Me(["internet","lan","both"].map(s=>[s,[v(s==="internet"?"globe":s==="lan"?"home":"shield"),s==="internet"?_("Internet"):s==="lan"?_("Home"):_("Both")]]),e.access,{label:_("Access"),cls:"wide",optimistic:!1,onChange:s=>n.patch({access:s},m(_("Access: %s"),vt(s)))});return t("section",{class:"dl-devsec","aria-label":_("Access and limits")},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Access & limits"))]),t("div",{class:"dl-panel"},[t("div",{class:"dl-stack gap8"},[t("span",{class:"dl-tile2-label"},_("Can reach")),o,t("span",{class:"dl-sub"},$l(e.access)),e.access==="lan"&&n.st.services.length?pa(n):"",ut(e)?ca(n):"",e.access==="lan"?da(n):""]),t("div",{class:"dl-tiles2"},[ma(n),ua(n),Dl(n),Al(n),Nl(n)])])])}function Hl(n){let e=n.st,o=t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Locations")),t("span",{class:"dl-spacer"}),e.geo.enabled?Rt("30d",r=>n.map?.setRange(r),!1):"",A(_("Hide"),()=>{n.mapOpen=!1,n.map?.destroy(),n.map=null,n.paintPlaces()},"neutral")]);if(!e.geo.enabled)return t("div",{class:"dl-panel flush"},[o,t("div",{class:"dl-map-off"},ae(_("Locations are off. %s."),t("a",{href:L.url("admin/network/dawnline/settings")},_("Turn them on in Settings"))))]);let s=new dt({openPerson:()=>{},openDevice:(r,a)=>{let i=n.p.devices.find(l=>l.id===a);i&&Je(n.p,i,n.deviceOpts())}},"30d",280);return n.map=s,requestAnimationFrame(()=>s.mount(n.mapData())),t("div",{class:"dl-panel flush"},[o,s.el])}function ga(n){let e=n.st;if(!e.geo.enabled)return t("div",{class:"dl-places"},[v("pin"),t("div",{class:"dl-stack"},[t("span",{},_("Locations are off")),t("span",{class:"dl-sub"},_("City-level, from the client IP"))]),t("span",{class:"dl-spacer"}),t("a",{class:"cbi-button cbi-button-neutral",href:L.url("admin/network/dawnline/settings")},_("Turn on"))]);if(n.mapOpen)return n.map&&n.parts.places.contains(n.map.el)?null:Hl(n);let o=e.now-30*86400,s=e.geo.points.filter(i=>i.person===n.p.id&&i.ts>=o).sort((i,l)=>l.ts-i.ts),r=[...new Set(s.map(i=>i.city||i.country).filter(Boolean))],a=s[0];return t("div",{class:"dl-places"},[v("pin"),t("div",{class:"dl-stack"},[t("span",{},a?a.city||a.country:_("No locations yet")),t("span",{class:"dl-sub"},a?[W(r.length,"%s place in 30 days","%s places in 30 days"),a.org].filter(Boolean).join(" · "):_("Shown after a device connects"))]),t("span",{class:"dl-spacer"}),s.length?A(_("Show map"),()=>{n.mapOpen=!0,n.paintPlaces()},"neutral"):""])}function va(n){let e=n.p,o=n.st,s=n.events.filter(l=>l.person===e.id),r=[],a=[...s].reverse();for(let l=0;l1){let u=p.querySelector(".dl-row-main");dom.content(u,[...Do(o,d).slice(0,3),t("span",{class:"dl-muted"},W(c,"%s time","%s times"))]),u.title=a.slice(l,l+c).map(k=>k.detail??"").join(` -`)}r.push(p),l+=c-1}let i=A([v("more")],()=>Se(i,[{label:_("Export CSV"),icon:v("download"),run:()=>Qe(o,s,"csv",e.id)},{label:_("Export JSON"),icon:v("download"),run:()=>Qe(o,s,"json",e.id)},null,{label:m(_("Clear %s's activity"),e.name),icon:v("trash"),danger:!0,run:()=>lt(m(_("Clear %s's activity"),e.name),m(_("Removes events about %s and their devices."),e.name),{person:e.id},()=>n.refresh())}]),"neutral",{title:_("Export or clear"),class:"cbi-button cbi-button-neutral dl-icon-only"});return t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Activity")),t("span",{class:"dl-sub"},s.length>10?m(_("latest 10 of %s"),K(s.length)):""),t("span",{class:"dl-spacer"}),i]),r.length?r:t("div",{class:"dl-row dl-muted"},_("Nothing yet."))])}var Gn=class{constructor(){this.id="";this.events=[];this.mapOpen=!1;this.map=null;this.parts={};this.series=[];this.devSeries={};this.ticks=0;this.fullNext=!1}async fetch(e){let[o,s,r]=await Promise.all([N.status(30),e?N.events(2e3,this.id).catch(()=>null):Promise.resolve(null),e?N.personUsage(this.id,30).catch(()=>null):Promise.resolve(null)]);return{st:o,ev:s?.events??null,use:r}}async load(){return this.id=new URLSearchParams(location.search).get("id")??"",this.fetch(!0)}render(e){this.take(e);let o=this.st.people.find(i=>i.id===this.id);if(!o)return t("div",{class:"dl-empty"},[t("h3",{},_("Person not found")),t("p",{},_("They may have been removed.")),t("a",{class:"cbi-button",href:L.url("admin/network/dawnline/server")},_("Back to Servers"))]);this.p=o;for(let i of["crumbs","head","devices","traffic","places","activity","limits"])this.parts[i]=t("div",{});this.parts.devices.className="dl-person-devices";let s=t("div",{},[this.parts.crumbs,this.parts.head,t("div",{class:"dl-grid-person"},[t("div",{class:"dl-col"},[this.parts.devices,this.parts.traffic,this.parts.places,this.parts.activity]),t("div",{class:"dl-col"},[this.parts.limits])])]);this.paint();let r=new URLSearchParams(location.search),a=r.get("device")&&o.devices.find(i=>i.id===r.get("device"));return a?setTimeout(()=>Je(this.p,a,this.deviceOpts()),50):r.get("add")&&setTimeout(()=>ct(this.p,this.deviceOpts()),50),this.poller=pt({fetch:i=>{let l=i||this.fullNext||++this.ticks%4===0;return this.fullNext=!1,this.fetch(l)},every:15,live:!0,active:()=>s.isConnected,apply:(i,l)=>this.apply(i,l)}),s}take(e){this.st=e.st,e.ev&&(this.events=e.ev),e.use&&(this.series=e.use.person,this.devSeries=e.use.devices)}apply(e,o){this.take(e);let s=this.st.people.find(r=>r.id===this.id);if(!s){o||(location.href=It(this.p?.server));return}this.p=s,this.paint(o),this.map?.update(this.mapData())}async refresh(){this.fullNext=!0,await this.poller?.refresh()}async patch(e,o){var a;this.poller?.claim();let s=await F(()=>N.personUpdate(this.p.id,e),o);if(!s)return!1;this.poller?.claim();let r=this.st.people.findIndex(i=>i.id===this.p.id);return(a=s.person).rate??(a.rate=this.p.rate),r>=0&&(this.st.people[r]=s.person),this.p=s.person,this.paint(),!0}get today(){return Ge(this.series.length?this.series:this.st.series)}get core(){return zt(this.st.servers,this.p.server)}deviceOpts(){return{refresh:()=>this.refresh(),geo:this.st.geo,now:this.st.now,today:this.today,core:this.core,events:()=>this.events}}mapData(){return{geo:this.st.geo,people:this.st.people,now:this.st.now,person:this.p.id}}crumbs(){let e=this.p;return t("nav",{class:"dl-crumbs","aria-label":_("Breadcrumb")},[t("a",{href:It(e.server)},this.st.servers.find(o=>o.id===e.server)?.name??_("Servers")),t("span",{},"/"),t("a",{href:It(e.server)},_("People")),t("span",{},"/"),t("span",{},e.name)])}paint(e=!1){Ae(this.parts.crumbs,this.crumbs(),e),Ae(this.parts.head,aa(this),e),Ae(this.parts.traffic,ia(this),e),Ae(this.parts.devices,la(this),e),Ae(this.parts.limits,fa(this),e),this.paintPlaces(e),Ae(this.parts.activity,va(this),e)}paintPlaces(e=!1){let o=ga(this);o&&Ae(this.parts.places,o,e&&!this.mapOpen)}};var zl={ok:"check",warn:"alert",error:"x",skip:"pause"},qn=class{constructor(e,o,s,r){this.el=t("div",{});this.wdEl=t("div",{});this.checksEl=t("div",{class:"dl-panel"});this.recentEl=t("div",{class:"dl-panel flush dl-recent"});this.checks=null;this.summary=t("div",{});this.open=new Set;this.st=e,this.sl=o,this.events=s,this.toLog=r,dom.content(this.el,[this.summary,this.wdEl,t("div",{class:"dl-health-cols"},[this.checksEl,this.recentEl])]),this.paintChecks(),this.paintLive(o,s)}async run(e){let o=e?await In(e):await N.health().catch(()=>null);o&&(this.take(o),e==="netrestart"&&setTimeout(()=>this.el.isConnected&&void this.run(),5e3))}take(e){this.checks=e.checks,this.paintChecks(),this.paintLive(e,this.events)}paintChecks(){let e=this.checks;if(!e){dom.content(this.summary,""),dom.content(this.checksEl,[t("div",{class:"dl-panel-head"},[t("h3",{},_("Checks"))]),t("p",{class:"dl-muted dl-loading"},_("Running checks…"))]);return}let o=e.filter(i=>i.status==="error").length,s=e.filter(i=>i.status==="warn").length;dom.content(this.summary,o?bt("error",W(o,"%s problem needs attention.","%s problems need attention.")):s?bt("warn",W(s,"%s warning.","%s warnings.")):bt("ok",_("All checks passed.")));let r=new Map;for(let i of this.sl.watchdog.repairs)r.set(i.id,Math.max(r.get(i.id)??0,i.ts));let a=()=>this.run();dom.content(this.checksEl,[t("div",{class:"dl-panel-head"},[t("h3",{},_("Checks")),t("span",{class:"dl-spacer"}),A(_("Run again"),a)]),t("ul",{class:"dl-checks"},e.map(i=>t("li",{},[t("span",{class:`dl-check-icon ${i.status}`},v(zl[i.status])),t("div",{class:"dl-check-body"},[t("div",{class:"dl-check-title"},i.title),t("div",{class:"dl-check-detail"},i.detail),r.has(i.id)?t("div",{class:"dl-check-repaired"},m(_("Repaired by the watchdog at %s"),Ut(r.get(i.id)))):""]),Ao(i,l=>void this.run(l),a)])))])}paintLive(e,o){this.sl=e,this.events=o;let s=e.watchdog,r=s.beat!=null&&s.now-s.beat>180,a=s.repairs.filter(d=>s.now-d.ts<86400),i=a[a.length-1],l=ye(s.enabled,_("Watchdog repairs"),async d=>{await F(()=>N.settingsUpdate({watchdog:d?"1":"0"}),d?_("Watchdog on"):_("Watchdog off"))||uo(l,!d);let p=await N.serviceLog().catch(()=>null);p&&this.paintLive(p,this.events)});dom.content(this.wdEl,t("div",{class:"dl-panel dl-wd"},[t("div",{class:"dl-wd-head"},[t("span",{class:`dl-wd-tile${s.enabled?"":" off"}`},v("shield")),t("div",{class:"dl-stack"},[t("span",{class:"dl-wd-title"},_("Watchdog")),t("span",{class:"dl-sub"},s.enabled?_("Every minute it checks the tunnels and services and repairs what it can on its own."):_("Off: problems are only written to the log. Nothing is repaired on its own."))]),t("span",{class:"dl-spacer"}),l]),t("div",{class:"dl-wd-foot"},[t("div",{class:"dl-wd-chips"},s.targets.map(d=>t("span",{class:`dl-check-chip${d.ok?"":" error"}`,title:d.ok?_("OK"):d.tries?`${_("Not working")} · ${W(d.tries,"%s repair","%s repairs")}`:_("Not working")},[v(d.ok?"check":"x"),d.name]))),t("span",{class:`dl-sub${r?" dl-warn-text":""}`},r?m(_("The agent has not checked in for %s min; cron restarts it after 5."),K(Math.round((s.now-s.beat)/60))):[s.last?m(_("Looked %s"),pe(s.last,s.now)):_("Starts within a minute")," · ",a.length?m(N_(a.length,"%s repair today, last %s at %s","%s repairs today, last %s at %s"),K(a.length),i.name,Ut(i.ts)):_("no repairs today")])])])),this.paintRecent()}paintRecent(){let e=(this.sl.watchdog.now||Date.now()/1e3)-604800,o=[...this.events.map(r=>({ts:r.ts,ev:r})),...this.sl.log.map(r=>({ts:r.ts,sys:r}))].filter(r=>r.ts>=e&&vn(r)).sort((r,a)=>a.ts-r.ts),s=t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Recent problems")),t("span",{class:"dl-spacer"}),o.length?t("a",{href:"#",click:r=>(r.preventDefault(),this.toLog())},`${_("All in Log")} →`):""]);if(!o.length){dom.content(this.recentEl,[s,t("div",{class:"dl-recent-empty"},[t("span",{class:"dl-check-icon ok"},v("check")),_("No problems in the last 7 days.")])]);return}dom.content(this.recentEl,[s,...o.slice(0,8).map(r=>{if(r.sys){let a=r.sys,i=`${a.ts}|${a.msg}`;return Hn(a,this.open.has(i),()=>{this.open.delete(i)||this.open.add(i),this.paintRecent()},Ut(a.ts))}return ht(this.st,r.ev,{time:Ut(r.ts)})})])}};var Fn=300,Rl=["all","connections","people","system","problems"],Kn=class{constructor(e,o,s){this.events=[];this.system=[];this.kind="all";this.shown=Fn;this.open=new Set;this.list=t("div",{});this.sub="";this.tabs=t("div",{class:"dl-seg",role:"tablist"});this.st=e,this.take(o),this.system=s,this.el=t("div",{},[t("div",{class:"dl-toolbar"},[this.tabs]),this.list]),this.paint()}actions(){let e=()=>this.kind==="all"?"":this.kind,o=a=>()=>{let i=this.filtered().reverse();Qe(this.st,i.filter(l=>l.ev).map(l=>l.ev),a,e(),i.filter(l=>l.sys).map(l=>l.sys))},s=A([v("download"),` ${_("Export")}`],()=>Se(s,[{label:_("CSV (spreadsheet)"),icon:v("download"),run:o("csv")},{label:"JSON",icon:v("download"),run:o("json")}])),r=A([v("trash"),` ${_("Clear")}`],()=>lt(_("Clear the log"),_("Removes events from the log on the router."),{},()=>this.reload(),this.kind==="all"?void 0:this.kind,!0));return[s,r]}take(e){this.events=e.events,this.policy=e.policy;let o=Nt.filter(r=>!e.policy.categories.includes(r)),s=bn(e.policy);this.sub=o.length?`${s} ${m(_("Not recorded: %s."),o.map(r=>Ye(r).toLowerCase()).join(", "))}`:s}async reload(){let[e,o]=await Promise.all([N.events(2e4).catch(()=>null),N.serviceLog().catch(()=>null)]);e&&this.take(e),o&&(this.system=o.log),this.paint()}items(){return[...this.events.map(e=>({ts:e.ts,ev:e})),...this.system.map(e=>({ts:e.ts,sys:e}))].sort((e,o)=>o.ts-e.ts)}matches(e,o){return o==="all"?!0:o==="problems"?vn(e):o==="system"?!!e.sys:!!e.ev&&qt(e.ev.type)===o}filtered(){return this.items().filter(e=>this.matches(e,this.kind))}paintTabs(e){dom.content(this.tabs,Rl.map(o=>t("button",{type:"button",role:"tab",class:o===this.kind?"on":"","aria-selected":o===this.kind?"true":"false",click:()=>this.show(o)},[o==="all"?_("All"):o==="system"?_("System"):Ye(o),t("b",{},String(e.filter(s=>this.matches(s,o)).length))])))}show(e){this.kind=e,this.shown=Fn,this.paint()}paint(){this.paintTabs(this.items());let e=this.filtered();if(!e.length){dom.content(this.list,t("div",{class:"dl-empty"},[t("p",{},this.events.length||this.system.length?_("No events match."):_("The log is empty."))]));return}let o=[],s="",r=null;for(let a of e.slice(0,this.shown)){let i=Pr(a.ts);i!==s&&(s=i,r=t("div",{class:"dl-panel flush"},t("div",{class:"dl-panel-head pad"},t("h3",{},i))),o.push(r));let l=new Date(a.ts*1e3).toLocaleTimeString(ie(),{hour:"2-digit",minute:"2-digit"});if(a.sys){let d=`${a.sys.ts}|${a.sys.msg}`;r.appendChild(Hn(a.sys,this.open.has(d),()=>{this.open.delete(d)||this.open.add(d),this.paint()},l))}else r.appendChild(ht(this.st,a.ev,{time:l}))}e.length>this.shown&&o.push(t("div",{class:"dl-more-row"},A(m(_("Show %s more of %s"),K(Math.min(Fn,e.length-this.shown)),K(e.length-this.shown)),()=>{this.shown+=Fn,this.paint()}))),dom.content(this.list,o)}};var Il=["health","log"],Bl=n=>n==="log"?_("Log"):_("Health"),Oo=2e4,Yn=class{constructor(){this.tab=new URLSearchParams(location.search).get("tab")==="log"?"log":"health";this.segEl=t("div",{class:"dl-seg dl-srvsections dl-diag-tabs",role:"tablist","aria-label":_("Diagnostics")});this.subEl=t("span",{class:"dl-muted"});this.actionsEl=t("div",{class:"dl-row-actions"});this.bodyEl=t("div",{});this.eventsAt=0}load(){return this.eventsAt=Date.now(),Promise.all([N.status(1),N.events(Oo),N.serviceLog()])}render([e,o,s]){return this.log=new Kn(e,o,s.log),this.health=new qn(e,s,o.events,()=>{this.show("log"),this.log.show("problems")}),this.show(this.tab),pt({fetch:async()=>{let r=this.tab==="log",[a,i]=await Promise.all([N.serviceLog().catch(()=>null),r?N.events(Oo).catch(()=>null):Promise.resolve(null)]);return a||i?{n:a,e:i}:null},every:10,active:()=>this.bodyEl.isConnected,apply:({n:r,e:a})=>this.take(r,a)}),t("div",{},[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},_("Diagnostics")),this.subEl]),this.actionsEl]),this.segEl,this.bodyEl])}take(e,o){o&&(this.log.take(o),this.eventsAt=Date.now()),e&&(this.log.system=e.log),e&&this.health.paintLive(e,o?.events??this.health.events),this.tab==="log"&&this.log.paint()}show(e){this.tab=e,dom.content(this.segEl,Il.map(o=>t("button",{type:"button",role:"tab",class:o===e?"on":"","aria-selected":o===e?"true":"false",click:()=>o!==this.tab&&this.show(o)},Bl(o)))),this.bodyEl.replaceChildren(e==="log"?this.log.el:this.health.el),this.subEl.textContent=e==="log"?this.log.sub:_("Everything Dawnline depends on, checked live. The watchdog repairs what it can on its own."),dom.content(this.actionsEl,e==="log"?this.log.actions():""),e==="log"?(this.log.paint(),Date.now()-this.eventsAt>1e4&&N.events(Oo).then(o=>this.take(null,o)).catch(()=>null)):this.health.checks||this.health.run()}};var ba=":root{--dl-card: var(--panel-bg, var(--background-color-high, transparent));--dl-elevated: var(--elevated, var(--background-color-high, Canvas));--dl-line: var(--border, var(--border-color-medium, color-mix(in srgb, currentColor 14%, transparent)));--dl-soft: var(--muted, color-mix(in srgb, currentColor 5%, transparent));--dl-soft-hover: var(--soft-hover, color-mix(in srgb, currentColor 10%, transparent));--dl-fg: var(--foreground, var(--text-color-highest, inherit));--dl-fg-muted: var(--muted-foreground, color-mix(in srgb, currentColor 65%, transparent));--dl-fg-faint: var(--text-tertiary, color-mix(in srgb, currentColor 50%, transparent));--dl-accent: var(--accent, #3a83f7);--dl-ok: var(--success, #00a240);--dl-warn: var(--warning, #e25507);--dl-bad: var(--danger, #e02e2a);--dl-ok-wash: var(--success-a15, color-mix(in srgb, #00a240 15%, transparent));--dl-warn-wash: var(--warning-a15, color-mix(in srgb, #e25507 15%, transparent));--dl-bad-wash: var(--destructive-a15, color-mix(in srgb, #e02e2a 15%, transparent));--dl-info-wash: var(--info-a15, color-mix(in srgb, #3a83f7 15%, transparent));--dl-info: var(--info, #2c67c5);--dl-track: var(--foreground-a10, color-mix(in srgb, currentColor 10%, transparent));--dl-chart-1: var(--chart-blue, #3a83f7);--dl-chart-2: var(--chart-green, #00a240);--dl-ring: var(--ring, #3a83f7);--dl-primary: var(--primary, #0d0d0d);--dl-primary-fg: var(--primary-foreground, #fff);--dl-mono: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);--dl-shadow: var(--shadow-sm, none);--dl-radius: 16px}.dl-root,.dl-modal{cursor:default}:is(.dl-root,.dl-modal) :is(input:not([type=checkbox],[type=radio],[type=range],[type=button],[type=submit]),textarea,[contenteditable=true]){cursor:text}.dl-icon-wrap{display:inline-flex;align-items:center;justify-content:center;line-height:0}.dl-icon{width:16px;height:16px}.dl-icon-btn{display:inline-flex!important;align-items:center;gap:6px}.dl-muted{color:var(--dl-fg-muted)}.dl-faint,.dl-sep{color:var(--dl-fg-faint)}.dl-nowrap{white-space:nowrap}.dl-mono{font-family:var(--dl-mono);font-size:13px}.dl-spacer{flex:1}.dl-pill{display:inline-flex;align-items:center;gap:4px;height:20px;padding:0 8px;border-radius:999px;font-size:12px;line-height:20px;font-weight:500;white-space:nowrap;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pill.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-pill.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-pill.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-pill.accent{background:var(--dl-info-wash);color:var(--dl-info)}.dl-pill.off{opacity:.75}.dl-panel{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:16px;margin:0 0 16px;min-width:0;box-shadow:var(--dl-shadow)}.dl-panel-head{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin:0 0 12px}.dl-panel-head h3{margin:0!important;padding:0;font-size:16px;line-height:24px;font-weight:500;border:0;background:none}.dl-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;margin:0 0 16px}.dl-tile{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:14px 16px;min-width:0;box-shadow:var(--dl-shadow)}.dl-tile-label{font-size:12px;line-height:16px;font-weight:500;color:var(--dl-fg-faint)}.dl-tile-value{font-size:24px;line-height:32px;font-weight:500;margin-top:4px;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;letter-spacing:-.01em}.dl-tile-sub{font-size:12px;line-height:16px;color:var(--dl-fg-muted);margin-top:2px;font-variant-numeric:tabular-nums}.dl-grid2{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(0,1fr);gap:0 16px}@media(max-width:960px){.dl-grid2{grid-template-columns:minmax(0,1fr)}}.dl-chart{display:block;width:100%;height:120px}.dl-bar-down{fill:var(--dl-chart-1)}.dl-bar-up{fill:var(--dl-chart-2);opacity:.8}.dl-legend{display:flex;gap:16px;font-size:12px;color:var(--dl-fg-muted);margin-top:8px}.dl-legend i{display:inline-block;width:8px;height:8px;border-radius:999px;margin-right:6px;vertical-align:0}.dl-legend .down{background:var(--dl-chart-1)}.dl-legend .up{background:var(--dl-chart-2)}.dl-events{list-style:none;margin:0;padding:0}.dl-events li{display:flex;gap:12px;align-items:baseline;padding:8px 0;border-top:1px solid var(--dl-line);font-size:14px;line-height:20px;min-width:0}.dl-events li:first-child{border-top:0;padding-top:0}.dl-ev-time{flex:0 0 88px;color:var(--dl-fg-faint);font-variant-numeric:tabular-nums;white-space:nowrap;font-size:13px}.dl-ev-dot{flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);transform:translateY(-2px)}.dl-ev-dot.ok{background:var(--dl-ok)}.dl-ev-dot.warn{background:var(--dl-warn)}.dl-ev-dot.bad{background:var(--dl-bad)}.dl-ev-dot.accent{background:var(--dl-accent)}.dl-row>.dl-ev-dot,.dl-dev-log-row>.dl-ev-dot{margin:0 4px}.dl-ev-tile{flex:none;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;margin:-2px -4px;border-radius:7px;background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent);align-self:center}.dl-ev-tile .dl-icon-wrap{display:inline-flex}.dl-ev-tile .dl-icon{width:14px;height:14px}.dl-row.dl-ev-by-admin{background:color-mix(in srgb,var(--dl-accent) 6%,transparent)}.dl-you{color:var(--dl-accent);font-weight:500}.dl-ev-kind{color:var(--dl-fg-faint)}.dl-slotbar{display:flex;align-items:center;gap:8px;margin:8px 0 0 44px}.dl-slotbar-segs{display:flex;gap:3px;flex:none;max-width:100%}.dl-slotbar-segs i{flex:1;min-width:2px;display:block;height:4px;border-radius:2px;background:var(--dl-soft-hover)}.dl-slotbar-segs i.used{background:var(--dl-fg-muted)}.dl-slotbar-text{font-size:12px;color:var(--dl-fg-faint);font-variant-numeric:tabular-nums}.dl-slotbar-segs i.over{background:color-mix(in srgb,var(--dl-warn) 80%,transparent)}.dl-ev-srv{flex:none;font-size:11px;line-height:18px;padding:0 8px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);white-space:nowrap}.dl-ev-by-system{--sys: var(--dl-fg-muted)}.dl-ev-by-system.ok{--sys: var(--dl-ok)}.dl-ev-by-system.warn{--sys: var(--dl-warn)}.dl-ev-by-system.bad{--sys: var(--dl-bad)}.dl-ev-tile.ev{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-ev-tile.ev.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-ev-tile.ev.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-ev-tile.ev.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-ev-tile.ev.accent{background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent)}.dl-ev-tile.sys{background:color-mix(in srgb,var(--sys) 16%,transparent);color:var(--sys)}.dl-row.dl-ev-by-system{background:color-mix(in srgb,var(--sys) 6%,transparent)}.dl-sys-src{color:var(--sys)}.dl-ev-by-system:not(.ok):not(.warn):not(.bad) .dl-sys-src{color:var(--dl-fg)}.dl-ev-text{min-width:0;overflow-wrap:anywhere}.dl-server{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px}.dl-server-name{font-size:16px;line-height:24px;font-weight:500}.dl-kv{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:6px 24px;margin:12px 0 0;font-size:14px;line-height:20px}.dl-kv dt{color:var(--dl-fg-muted);font-weight:400;margin:0}.dl-kv dd{margin:0;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}";var xa='.dl-plist{display:block}.dl-plist>.dl-card{display:block;margin:0 0 12px;padding:16px;min-width:0;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);box-shadow:var(--dl-shadow)}.dl-plist>.dl-card.dl-filtered{display:none}.dl-plist>.dl-card.dl-off :is(.dl-card-name,.dl-avatar,.dl-access,.dl-slotbar,.dl-chips,.dl-pill-ic,.dl-use-num,.dl-pside-foot,.dl-pside-state){opacity:.45}.dl-plist>.dl-card.dl-off .dl-usebar i{background:var(--dl-fg-faint)}.dl-plist>.dl-card.dl-off .dl-chip-tag{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pcard:has(>.dl-pstrip){row-gap:14px}.dl-pstrip{grid-column:1 / -1;display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin:0 -16px -16px;padding:10px 16px;border-top:1px solid var(--dl-line);border-radius:0 0 var(--dl-radius) var(--dl-radius);font-size:14px;line-height:20px}.dl-pstrip.warn{background:color-mix(in srgb,var(--dl-warn) 7%,transparent)}.dl-pstrip.bad{background:color-mix(in srgb,var(--dl-bad) 7%,transparent)}.dl-pstrip-text{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;gap:0 8px}.dl-pstrip-text b{font-weight:500}.dl-pstrip>.cbi-button{flex:none;height:32px!important}.dl-plist-none{color:var(--dl-fg-muted);text-align:center;padding:28px 16px;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius)}.dl-card-head{display:flex;align-items:center;flex-wrap:wrap;gap:6px 8px}.dl-avatar{flex:0 0 auto;width:32px;height:32px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;color:var(--dl-fg);background:var(--dl-soft);position:relative;margin-right:4px;letter-spacing:.02em}.dl-avatar.online:after{content:"";position:absolute;right:-1px;bottom:-1px;width:9px;height:9px;border-radius:50%;background:var(--dl-ok);box-shadow:0 0 0 2px var(--dl-card)}.dl-card-name{font-size:16px;line-height:24px;font-weight:500}.dl-card-slug{font-size:13px;color:var(--dl-fg-faint);font-family:var(--dl-mono)}.dl-quota{margin:8px 0 0 44px;max-width:320px;height:6px;border-radius:999px;background:var(--dl-track);overflow:hidden}.dl-quota>i{display:block;height:100%;background:var(--dl-accent);border-radius:999px}.dl-quota.warn>i{background:var(--dl-warn)}.dl-quota.bad>i{background:var(--dl-bad)}.dl-chips{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0 0 44px}.dl-chip{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:6px;max-width:240px;height:28px;padding:0 12px 0 10px;border-radius:999px;font-size:13px;background:var(--dl-soft);color:var(--dl-fg);transition:background .15s}.dl-chip:hover{background:var(--dl-soft-hover)}.dl-chip:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-chip .dl-icon{width:14px;height:14px;color:var(--dl-fg-muted)}.dl-chip.add{background:transparent;border:1px dashed color-mix(in srgb,var(--dl-fg) 28%,transparent);color:var(--dl-fg-muted)}.dl-chip.add:hover{background:var(--dl-soft);color:var(--dl-fg);border-color:color-mix(in srgb,var(--dl-fg) 45%,transparent)}.dl-chip.add:hover .dl-icon{color:var(--dl-fg)}.dl-chip.disabled .dl-chip-name{text-decoration:line-through;color:var(--dl-fg-faint)}.dl-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-dot{flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);opacity:.6}.dl-dot.online{background:var(--dl-ok);opacity:1;box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-empty{text-align:center;padding:40px 16px;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius)}.dl-empty .dl-icon-wrap{width:40px;height:40px;border-radius:12px;background:var(--dl-soft);margin-bottom:12px}.dl-empty .dl-icon{width:20px;height:20px}.dl-empty h3{margin:0 0 4px!important;font-size:16px;font-weight:500}.dl-empty p{margin:0 0 16px;color:var(--dl-fg-muted);font-size:14px}.dl-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin:0 0 16px}.dl-toolbar .dl-muted{font-size:13px}@media(max-width:640px){.dl-slotbar,.dl-chips,.dl-quota{margin-left:0}.dl-btn-label{display:none}}.cbi-value.dl-block{display:block!important}.cbi-value.dl-block>.cbi-value-title{display:block;width:auto;float:none;text-align:left;padding:0 0 8px}.cbi-value.dl-block>.cbi-value-field{display:block;width:100%;margin:0}.dl-people-find{width:160px;min-width:0}.dl-people-find[hidden]{display:none}';var wa="#modal_overlay{z-index:1100!important}.dl-dd{position:fixed;z-index:1200;min-width:200px;padding:4px;border-radius:12px;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:0 12px 32px #0000004d;display:flex;flex-direction:column}.dl-dd button{all:unset;cursor:pointer;display:flex;align-items:center;gap:10px;padding:7px 10px;border-radius:8px;font-size:13px;color:var(--dl-fg)}.dl-dd button .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted)}.dl-dd button:hover,.dl-dd button:focus-visible{background:var(--dl-soft)}.dl-dd button.danger,.dl-dd button.danger .dl-icon{color:var(--dl-bad, #e5484d)}.dl-dd button.warn,.dl-dd button.warn .dl-icon{color:var(--dl-warn)}.dl-dd hr{border:0;border-top:1px solid var(--dl-line);margin:4px 0}.dl-chipbtn b{font-weight:500;font-size:11px;margin-left:6px;opacity:.6}.dl-setsub{margin:20px 0 8px!important;font-size:13px;font-weight:500;color:var(--dl-fg)}.dl-row-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.dl-more-row{display:flex;justify-content:center;padding:8px 0 16px}.dl-dsec-actions{display:flex;align-items:center;gap:12px}.dl-kv-act{display:inline-flex;align-items:center;gap:12px;flex-wrap:wrap}.dl-linkbtn,.dl-bento-head a,.dl-bento-foot a,.dl-panel-head a,.dl-dsec-head a,.dl-tile2-foot a{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:4px;height:26px;padding:0 9px;margin:-4px -6px;border-radius:8px;font-size:12px;font-weight:500;color:var(--dl-fg-muted);text-decoration:none!important;white-space:nowrap;transition:background .12s,color .12s}.dl-bento-head a,.dl-bento-foot a,.dl-panel-head a,.dl-dsec-head a,.dl-tile2-foot a{color:var(--dl-accent)}.dl-linkbtn:hover,.dl-bento-head a:hover,.dl-bento-foot a:hover,.dl-panel-head a:hover,.dl-dsec-head a:hover,.dl-tile2-foot a:hover{background:var(--dl-soft);color:var(--dl-fg);text-decoration:none!important}.dl-bento-head a:hover,.dl-bento-foot a:hover,.dl-panel-head a:hover,.dl-dsec-head a:hover,.dl-tile2-foot a:hover{background:color-mix(in srgb,var(--dl-accent) 12%,transparent);color:var(--dl-accent)}.dl-linkbtn:focus-visible,.dl-bento-head a:focus-visible,.dl-bento-foot a:focus-visible,.dl-panel-head a:focus-visible{outline:2px solid var(--dl-ring);outline-offset:1px}.dl-linkbtn.danger:hover{color:var(--dl-bad);background:var(--dl-bad-wash)}.dl-ifcards{display:flex;flex-direction:column;gap:20px;margin:24px 0}.dl-ifcard .dl-setsec-body{gap:14px}.dl-iflead{display:flex;flex-direction:column;gap:2px;padding-top:14px;border-top:1px solid var(--dl-line)}.dl-iflead b{font-size:14px;font-weight:500}.dl-ifgroup h4{margin:0 0 8px!important;padding:0!important;font-size:11px!important;font-weight:500!important;letter-spacing:.06em;text-transform:uppercase;color:var(--dl-fg-muted);border:0!important;background:none!important}.dl-ifgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:8px}.dl-if{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:10px;min-height:52px;padding:8px 12px 8px 10px;min-width:0;border:1px solid var(--dl-line);border-radius:10px;background:var(--dl-card);transition:background .15s,border-color .15s}.dl-if:hover{background:var(--dl-soft)}.dl-if:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-if-ic{width:30px;height:30px;border-radius:8px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-if-ic .dl-icon{width:16px;height:16px}.dl-if-main{display:flex;flex-direction:column;min-width:0;flex:1}.dl-if-name{font-size:13.5px;font-weight:500;color:var(--dl-fg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-if-sub{font:11px/16px var(--dl-mono);color:var(--dl-fg-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-if.sel{border-color:var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 9%,transparent)}.dl-if.sel .dl-if-ic{background:color-mix(in srgb,var(--dl-accent) 18%,transparent);color:var(--dl-accent)}.dl-if-check{color:var(--dl-accent);display:inline-flex}.dl-if-check .dl-icon{width:16px;height:16px}.dl-if.auto{border-color:color-mix(in srgb,var(--dl-ok) 55%,transparent);background:var(--dl-ok-wash);cursor:default}.dl-if.auto .dl-if-ic{background:color-mix(in srgb,var(--dl-ok) 18%,transparent);color:var(--dl-ok)}.dl-if-badge{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;flex:0 0 auto}.dl-if-badge.ok{color:var(--dl-ok)}.dl-if.off{cursor:default;opacity:.5}.dl-if.off:hover{background:var(--dl-card)}.dl-if.warn{border-color:color-mix(in srgb,var(--dl-warn) 60%,transparent)}.dl-if-wanctl{gap:10px;align-items:center}.dl-if-wanctl select{max-width:240px}.dl-if-summary{min-width:0;line-height:18px}.dl-warn{color:var(--dl-warn)}.dl-w-ip{width:160px}.dl-dnspick{padding-top:8px;border-top:1px solid var(--dl-line)}.dl-dnspick .dl-row-actions{gap:10px}.dl-note{display:flex;gap:8px;align-items:flex-start;padding:10px 12px;border-radius:10px;font-size:12.5px;line-height:18px;margin:0 0 10px;background:var(--dl-soft)}.dl-note.warn{background:var(--dl-warn-wash, color-mix(in srgb, var(--dl-warn) 14%, transparent))}.dl-note .dl-icon{width:15px;height:15px;flex:0 0 auto;margin-top:1px;color:var(--dl-warn)}.dl-stale{align-self:flex-start;margin-top:4px;font-size:10.5px}.dl-root .cbi-button.dl-btn-warn,.dl-btn-warn.cbi-button{background:var(--dl-warn-wash)!important;color:var(--dl-warn)!important;border-color:color-mix(in srgb,var(--dl-warn) 35%,transparent)!important}.dl-root .cbi-button.dl-btn-warn:hover,.dl-btn-warn.cbi-button:hover{background:color-mix(in srgb,var(--dl-warn) 24%,transparent)!important}.dl-btn-warn .dl-icon{color:var(--dl-warn)}.dl-srvtabs{display:flex;flex-wrap:wrap;gap:6px;padding:4px;margin:0 0 20px;border-radius:12px;background:var(--dl-soft);width:fit-content;max-width:100%}.dl-srvtab{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:8px;height:34px;padding:0 14px;border-radius:9px;font-size:13px;color:var(--dl-fg-muted);text-decoration:none!important;white-space:nowrap}.dl-srvtab b{font-weight:500}.dl-srvtab i.dot{width:7px;height:7px;border-radius:50%;background:var(--dl-fg-faint);flex:0 0 auto}.dl-srvtab i.dot.ok{background:var(--dl-ok);animation:dl-srv-pulse 2s ease-out infinite}.dl-srvtab i.dot.bad{background:var(--dl-bad)}.dl-srvtab i.dot.warn{background:var(--dl-warn)}@keyframes dl-srv-pulse{0%{box-shadow:0 0 color-mix(in srgb,var(--dl-ok) 55%,transparent)}70%,to{box-shadow:0 0 0 6px transparent}}@media(prefers-reduced-motion:reduce){.dl-srvtab i.dot.ok{animation:none}}.dl-srvtab:hover{color:var(--dl-fg);background:var(--dl-soft-hover)}.dl-srvtab.on{background:var(--dl-card);color:var(--dl-fg);box-shadow:0 1px 2px #0000002e,inset 0 0 0 1px var(--dl-line)}.dl-srvtab:focus-visible{outline:2px solid var(--dl-ring);outline-offset:1px}.dl-srvtab.add{color:var(--dl-fg-muted)}.dl-srvtab.add .dl-icon{width:14px;height:14px}.dl-srvhead{display:flex;flex-direction:column;gap:14px;margin:0 0 20px}.dl-srvhead .dl-title-row{display:flex;align-items:center;gap:10px}.dl-srvhead .dl-h1{margin:0!important}.dl-metrics.compact .dl-metric{padding:14px 18px}.dl-metrics.compact .dl-metric-value{display:flex;align-items:center;gap:6px;font-size:18px;line-height:26px;min-width:0}.dl-metrics.compact .dl-metric-value>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.dl-metrics.compact .dl-metric-value .dl-mono{font-size:15px}.dl-metrics.compact .cbi-button{flex:0 0 auto}.dl-srvsections{margin:0 0 16px}.dl-srvbody>.dl-setsec,.dl-srvbody>.dl-ifcards{margin:0}.dl-srvbody .dl-ifcards{margin:0}.dl-metric-ic{display:inline-flex;align-items:center;gap:8px;font-size:16px}.dl-metric-ic .dl-icon{width:18px;height:18px;color:var(--dl-accent)}.dl-keyrow{display:inline-flex;align-items:center;gap:8px;min-width:0}.dl-keyrow code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;background:none;padding:0}.dl-params{border:1px solid var(--dl-line);border-radius:12px;background:var(--dl-card)}.dl-params>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;padding:10px 14px;font-size:13px;color:var(--dl-fg);user-select:none}.dl-params>summary::-webkit-details-marker{display:none}.dl-params>summary>.dl-icon-wrap{display:inline-flex;color:var(--dl-fg-muted);transition:transform .15s}.dl-params>summary>.dl-icon-wrap .dl-icon{width:15px;height:15px}.dl-params[open]>summary>.dl-icon-wrap{transform:rotate(90deg)}.dl-params>summary:focus{outline:none}.dl-params>summary:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px;border-radius:12px}.dl-params>summary:hover{background:var(--dl-soft);border-radius:12px}.dl-pcount{font-size:11px;padding:0 6px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:10px;padding:4px 14px 14px}.dl-pgroup{display:flex;flex-direction:column;gap:6px;padding:12px;border-radius:10px;background:var(--dl-soft);min-width:0}.dl-pgroup-head{display:flex;align-items:center;gap:8px;font-size:13px}.dl-pgroup-head b{font-weight:500}.dl-pgroup-head .dl-icon{width:14px;height:14px;color:var(--dl-fg-muted)}.dl-pgroup p{margin:0!important;font-size:12px;line-height:17px;color:var(--dl-fg-muted)}.dl-pvals{display:flex;flex-wrap:wrap;gap:4px;margin-top:2px}.dl-pv{display:inline-flex;align-items:stretch;max-width:100%;border-radius:6px;overflow:hidden;font:500 11.5px/22px var(--dl-mono);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-pv i{font-style:normal;padding:0 6px;background:var(--dl-card);color:var(--dl-fg-faint)}.dl-pv b{font-weight:500;padding:0 7px;color:var(--dl-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}";var ya=".dl-methods{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px}.dl-method{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;gap:10px;padding:14px;border-radius:12px;border:1px solid var(--dl-line);background:var(--dl-card);transition:border-color .15s,background .15s;min-width:0}.dl-method:hover{background:var(--dl-soft)}.dl-method:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-method.on{border-color:var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 8%,transparent);box-shadow:inset 0 0 0 1px var(--dl-accent)}.dl-method.off{cursor:not-allowed;opacity:.55}.dl-method.off:hover{background:var(--dl-card)}.dl-method-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px}.dl-method-head .dl-pill{flex:none}.dl-method-head b{font-weight:500;font-size:14.5px;flex:1}.dl-method-ic{width:32px;height:32px;border-radius:9px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;color:var(--dl-fg-muted);flex:0 0 auto}.dl-method-ic .dl-icon{width:17px;height:17px}.dl-method.on .dl-method-ic{background:color-mix(in srgb,var(--dl-accent) 18%,transparent);color:var(--dl-accent)}.dl-method p{margin:0!important;font-size:12.5px;line-height:18px;color:var(--dl-fg-muted);flex:1}.dl-method-meters{display:flex;gap:16px}.dl-dots{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--dl-fg-faint)}.dl-dots-row{display:inline-flex;gap:3px}.dl-dots-row i{width:6px;height:6px;border-radius:50%;background:var(--dl-line)}.dl-dots-row i.on{background:var(--dl-fg-muted)}.dl-method.on .dl-dots-row i.on{background:var(--dl-accent)}.dl-method-foot{display:flex;align-items:center;gap:6px;font-size:11.5px;color:var(--dl-fg-faint);padding-top:8px;border-top:1px solid var(--dl-line)}.dl-method-foot .dl-icon{width:13px;height:13px;flex:0 0 auto}.dl-method.off .dl-method-foot{color:var(--dl-warn)}.dl-ibadge{display:inline-flex;align-items:center;gap:3px;height:22px;padding:0 6px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);flex:0 0 auto}.dl-ibadge .dl-icon{width:13px;height:13px}.dl-ibadge.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-ibadge.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-access{display:inline-flex;gap:4px;flex:0 0 auto}.dl-ibadge.lan{background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent)}.dl-ibadge.inet{background:var(--dl-ok-wash);color:var(--dl-ok)}";var ka=".dl-addrbar{display:inline-flex;align-items:stretch;flex-wrap:nowrap;max-width:100%;margin-top:4px;border:1px solid var(--dl-line);border-radius:10px;background:var(--dl-card);overflow:hidden}.dl-addrbar-seg{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;gap:7px;padding:6px 12px;font-size:13px;color:var(--dl-fg-muted);border-left:1px solid var(--dl-line);white-space:nowrap;min-width:0}.dl-addrbar-seg:first-child{border-left:0}.dl-addrbar-seg .dl-icon{width:14px;height:14px;color:var(--dl-fg-faint);flex:0 0 auto}.dl-addrbar-seg .dl-mono{font-size:12.5px}.dl-addrbar-seg.main{cursor:pointer;color:var(--dl-fg)}.dl-addrbar-seg.main:hover{background:var(--dl-soft)}.dl-addrbar-seg.main:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px}.dl-addrbar-seg.main>.dl-icon-wrap:last-child .dl-icon{opacity:.7}.dl-bento{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:auto auto;gap:10px;margin:0 0 20px}.dl-person-devices{margin-bottom:16px}.dl-person-head{display:flex;flex-direction:column;margin:0 0 20px}.dl-person-head>.dl-pagehead{margin-bottom:0;align-items:flex-start}.dl-pnote{all:unset;box-sizing:border-box;cursor:pointer;align-self:flex-start;display:inline-flex;align-items:flex-start;gap:6px;margin:10px 0 0 62px;max-width:60ch;padding:6px 12px 6px 10px;border-radius:10px;font-size:13px;line-height:18px;white-space:pre-line;background:var(--dl-soft);color:var(--dl-fg);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-pnote:hover{background:var(--dl-soft-hover)}.dl-pnote .dl-icon{width:14px;height:14px;flex:none;margin-top:2px;color:var(--dl-fg-muted)}.dl-note-input{width:100%;box-sizing:border-box;min-height:80px;resize:vertical}.dl-dcard-trend{display:flex;align-items:flex-end;gap:12px;min-width:0}.dl-dcard-trend>.dl-stack{flex:none}.dl-dcard-trend b{font-size:16px;font-weight:500;font-variant-numeric:tabular-nums}.dl-dbars{flex:1;min-width:0;height:32px;display:flex;align-items:flex-end;gap:2px}.dl-dbars i{flex:1;min-width:0;border-radius:2px;background:var(--dl-chart-1);opacity:.55}.dl-dbars i.zero{background:var(--dl-track);opacity:1}.dl-dbars i.hi{opacity:1}.dl-dbars i:hover{opacity:1;filter:brightness(1.2)}.dl-datechip{position:relative;display:inline-flex}.dl-date-hidden{position:absolute!important;left:0;bottom:0;width:1px!important;min-width:0!important;height:1px!important;opacity:0;pointer-events:none;border:0!important;padding:0!important;margin:0!important}.dl-chipbtn .dl-icon{width:13px;height:13px}.dl-chipbtn:has(.dl-icon){display:inline-flex;align-items:center;gap:5px}.dl-places{display:flex;align-items:center;gap:12px;padding:12px 16px;border:1px solid var(--dl-line);border-radius:var(--dl-radius);background:var(--dl-card);font-size:14px}.dl-places>.dl-icon{width:18px;height:18px;color:var(--dl-fg-muted);flex:none}.dl-person-live{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}.dl-person-live .dl-bento-head{flex-wrap:nowrap;white-space:nowrap;min-width:0}.dl-person-live .dl-bento-head>*{min-width:0;overflow:hidden;text-overflow:ellipsis}.dl-person-live .dl-bento-head>:first-child{flex:none}.dl-person-live.solo{grid-template-columns:minmax(0,1fr)}.dl-person-live:not(.solo) .dl-bento-tile.month>.dl-bento-head:first-child{flex-wrap:wrap;row-gap:2px}.dl-person-live:not(.solo) .dl-bento-tile.month>.dl-bento-head:first-child>.dl-sub{flex-basis:100%}.dl-person-live>.dl-bento-tile,.dl-person-live>.dl-bento-tile.month{grid-column:auto;grid-row:auto}@media(max-width:760px){.dl-person-live{grid-template-columns:minmax(0,1fr)}}.dl-bento-tile{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:14px 16px;display:flex;flex-direction:column;gap:10px;min-width:0;box-shadow:var(--dl-shadow)}.dl-bento-tile.month{grid-column:1 / -1}.dl-onl-count{font-size:13px;line-height:22px;min-width:22px;padding:0 8px;border-radius:999px;background:var(--dl-soft);text-align:center;font-weight:500;font-variant-numeric:tabular-nums}.dl-onl-count.none{color:var(--dl-fg-faint)}.dl-onl-row{flex:1;display:flex;align-items:center;justify-content:center;gap:12px;min-width:0}.dl-onl-p{display:flex;flex-direction:column;align-items:center;gap:5px;width:104px;min-width:0;padding:6px 2px;border-radius:12px;color:var(--dl-fg)!important;text-decoration:none!important}.dl-onl-p:hover{background:var(--dl-soft)}.dl-onl-av{position:relative;width:42px;height:42px;border-radius:50%;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;font-size:13px;font-weight:500;box-shadow:0 0 0 2px var(--dl-ok)}.dl-onl-p.more .dl-onl-av{box-shadow:0 0 0 1px var(--dl-line);color:var(--dl-fg-muted)}.dl-onl-dev{position:absolute;right:-6.5px;bottom:-6.5px;width:20px;height:20px;border-radius:8.5px;border:1.5px solid transparent;background:var(--dl-card);display:inline-flex;align-items:center;justify-content:center;font-size:10px;color:var(--dl-fg-muted)}.dl-onl-dev .dl-icon-wrap{display:inline-flex}.dl-onl-dev .dl-icon{width:12px;height:12px}.dl-onl-name{font-size:12.5px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-onl-p .dl-sub{font-size:11px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-onl-row.grid{flex-wrap:wrap;align-content:center;gap:10px 8px;max-height:108px;overflow:hidden}.dl-onl-p.sm{width:auto;padding:4px}.dl-onl-p:hover .dl-onl-dev{background:linear-gradient(var(--dl-soft),var(--dl-soft)),var(--dl-card)}.dl-onl-p.sm:hover{background:none}.dl-onl-p.sm:hover .dl-onl-dev{background:var(--dl-card)}.dl-onl-p.sm .dl-onl-av{transition:box-shadow .15s ease}.dl-onl-p.sm:hover .dl-onl-av{box-shadow:0 0 0 2px var(--dl-ok),0 0 0 6px var(--dl-soft)}.dl-onl-p.sm.more:hover .dl-onl-av{box-shadow:0 0 0 1px var(--dl-line),0 0 0 6px var(--dl-soft)}.dl-onl-p.sm .dl-onl-av{width:36px;height:36px;font-size:11.5px}.dl-onl-meta{display:inline-flex;align-items:center;gap:3px;font-size:11px;color:var(--dl-fg-faint);max-width:100%;white-space:nowrap;overflow:hidden}.dl-onl-meta .dl-icon-wrap{display:inline-flex}.dl-onl-meta .dl-icon{width:12px;height:12px}.dl-onl-av.sm{width:34px;height:34px;font-size:11.5px}.dl-tip-float:has(.dl-hc){padding:0;white-space:normal;border-radius:16px}.dl-hc{width:280px;padding:14px;display:flex;flex-direction:column;gap:10px}.dl-hc-head{display:flex;align-items:center;gap:10px}.dl-hc-head .dl-stack{flex:1;min-width:0}.dl-hc-head b{font-size:14px;font-weight:500}.dl-hc-since{font-size:11.5px;color:var(--dl-ok)}.dl-hc-reach{display:inline-flex;gap:4px}.dl-hc-speed{border-radius:12px;background:var(--dl-soft);padding:10px 12px;display:flex;flex-direction:column;gap:6px}.dl-hc-speed-row{display:flex;align-items:baseline;gap:12px;font-size:13px;font-variant-numeric:tabular-nums}.dl-hc-chart{display:block;width:100%;height:30px}.dl-hc-chart .area{fill:color-mix(in srgb,var(--dl-chart-1) 16%,transparent)}.dl-hc-chart .dn{fill:none;stroke:var(--dl-chart-1);stroke-width:1.5;vector-effect:non-scaling-stroke}.dl-hc-chart .up{fill:none;stroke:var(--dl-ok);stroke-width:1.2;vector-effect:non-scaling-stroke}.dl-hc-devs{display:flex;flex-wrap:wrap;gap:6px}.dl-hc-dev{display:inline-flex;align-items:center;gap:5px;height:24px;padding:0 9px;border-radius:999px;background:var(--dl-soft);font-size:11.5px}.dl-hc-dev .dl-icon-wrap{display:inline-flex}.dl-hc-dev .dl-icon{width:12px;height:12px;color:var(--dl-fg-muted)}.dl-hc-foot{display:flex;align-items:center;gap:8px;font-size:11.5px}.dl-disg-id{display:flex;align-items:center;gap:10px}.dl-disg-id b{font-size:16px;font-weight:500}.dl-disg-ic{width:36px;height:36px;border-radius:11px;background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-disg-ic .dl-icon-wrap{display:inline-flex}.dl-disg-ic .dl-icon{width:18px;height:18px}.dl-disg-ic.off{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-disg-meters{display:grid;grid-template-columns:auto 1fr;gap:6px 10px;align-items:center;font-size:12px;color:var(--dl-fg-muted)}.dl-segs{display:inline-flex;gap:3px}.dl-segs i{width:18px;height:5px;border-radius:3px;background:var(--dl-track)}.dl-segs.acc i.on{background:var(--dl-accent)}.dl-segs.ok i.on{background:var(--dl-ok)}.dl-disg-chips{margin-top:auto;display:flex;flex-wrap:wrap;gap:5px}.dl-disg-chips span{font:11px/20px var(--dl-mono);padding:0 8px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);white-space:nowrap}.dl-onl-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;font-size:13px;text-align:center}.dl-bento-head{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0}.dl-bento-head.start{justify-content:flex-start}.dl-bento-big{font-family:inherit;font-size:28px;line-height:34px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-bento-big small{font-size:13px;font-weight:400;color:var(--dl-fg-faint);letter-spacing:0}.dl-avstack{display:inline-flex}.dl-avstack .dl-avatar{margin-left:-7px;box-shadow:0 0 0 2px var(--dl-card)}.dl-avstack .dl-avatar:first-child{margin-left:0}.dl-avatar.more{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-bento-list{display:flex;flex-direction:column;gap:2px}.dl-bento-row{display:flex;align-items:center;gap:10px;padding:8px;margin:0 -8px;border-radius:10px;color:var(--dl-fg)!important;text-decoration:none!important;min-width:0;transition:background .12s}.dl-bento-row:hover{background:var(--dl-soft)}.dl-bento-row:hover b{text-decoration:none}.dl-bento-row:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px}.dl-bento-row-main{display:flex;flex-direction:column;gap:1px;flex:1;min-width:0}.dl-bento-row-main b{font-weight:500;font-size:13.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-bento-row-main .dl-sub{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-bento-row.off b{color:var(--dl-fg-muted);font-weight:400}.dl-bento-row-val{display:flex;flex-direction:column;align-items:flex-end;font-size:13px;font-variant-numeric:tabular-nums;white-space:nowrap}.dl-bento-row-val small{font-size:11px;color:var(--dl-fg-faint)}.dl-bento-sep{font-size:11px;color:var(--dl-fg-faint);padding:12px 0 4px}.dl-bento-devs{display:inline-flex;gap:3px;color:var(--dl-fg-faint)}.dl-bento-devs .dl-icon{width:13px;height:13px}.dl-bento-devs .on{color:var(--dl-ok)}.dl-bento-foot{display:flex;align-items:center;gap:10px;margin-top:auto;padding-top:10px;border-top:1px solid var(--dl-line);color:var(--dl-fg)!important;text-decoration:none!important}.dl-bento-foot.split,.dl-bento-foot.end{justify-content:space-between}.dl-bento-foot.end>a:only-child{margin-left:auto}.dl-bento-empty{display:flex;align-items:center;gap:10px;padding:14px 0;font-size:13.5px;color:var(--dl-fg-muted)}.dl-bento-empty .dl-icon{width:18px;height:18px}.dl-split{display:flex;height:6px;border-radius:3px;overflow:hidden;background:var(--dl-soft)}.dl-split i{display:block;height:100%}.dl-split i.dn{background:var(--dl-accent)}.dl-split i.up{background:var(--dl-ok)}.dl-dn{color:var(--dl-accent)}.dl-up{color:var(--dl-ok)}.dl-bento-method{display:flex;align-items:center;gap:8px;font-size:18px;font-weight:500}.dl-bento-method .dl-icon{width:20px;height:20px;color:var(--dl-accent)}.dl-meter{display:inline-flex;gap:3px}.dl-meter i{width:16px;height:4px;border-radius:2px;background:var(--dl-line)}.dl-meter i.on{background:var(--dl-accent)}.dl-bento-total{font-size:16px;font-weight:500;margin-left:8px}.dl-bento-bars{display:flex;align-items:flex-end;gap:3px;height:54px}.dl-bento-bars i{flex:1;min-width:0;border-radius:3px 3px 0 0;background:var(--dl-soft-hover);transition:background .15s}.dl-bento-bars i.future{height:4px;background:var(--dl-soft)}.dl-bento-bars i:hover{background:var(--dl-fg-faint)}.dl-bento-bars i.hi{background:var(--dl-accent)}@media(max-width:700px){.dl-addrbar{flex-wrap:wrap}}@media(max-width:900px){.dl-bento{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.dl-bento-tile.online{grid-column:span 2}}@media(max-width:560px){.dl-bento{grid-template-columns:minmax(0,1fr)}.dl-bento-tile.online,.dl-bento-tile.month{grid-column:auto}}.dl-srvpagehead{display:flex;flex-direction:column;align-items:flex-start;gap:10px;margin:0 0 20px}.dl-srvpagehead>.dl-title-row{display:flex;align-items:center;gap:10px;width:100%;flex-wrap:wrap}.dl-srvpagehead .dl-actions{margin:0;flex-wrap:wrap}.dl-toolbar-end{display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:nowrap;min-width:0}@media(max-width:640px){.dl-toolbar-end{flex-wrap:wrap;width:100%}}.dl-notices{margin:0 0 16px}.dl-notices .dl-need-row .dl-sub{overflow-wrap:anywhere}.dl-notices-more{font-size:13px;color:var(--dl-fg-muted);text-decoration:none}.dl-notices-more:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-speed-cols{display:grid;grid-template-columns:1fr 1fr;gap:12px}.dl-speed-col{display:flex;flex-direction:column;gap:2px;min-width:0}.dl-speed-val{font-size:20px;line-height:26px;font-weight:500;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-speed-today{display:flex;justify-content:space-between;gap:10px;font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;font-variant-numeric:tabular-nums}.dl-speed-today b{font-weight:500;color:var(--dl-fg)}.dl-speed-chart{display:block;width:100%;height:44px}.dl-speed-chart .area{fill:color-mix(in srgb,var(--dl-accent) 16%,transparent)}.dl-speed-chart .line{fill:none;stroke:var(--dl-accent);stroke-width:1.5;vector-effect:non-scaling-stroke}.dl-speed-chart .line.up{stroke:var(--dl-ok);stroke-width:1.2;opacity:.85}.dl-speed-wait{height:44px;display:flex;flex-direction:column;justify-content:flex-end;gap:6px;font-size:11px;color:var(--dl-fg-faint)}.dl-speed-wait i{display:block;height:1px;background:var(--dl-line);order:2}.dl-speed-val.off{color:var(--dl-fg-faint)}.dl-fld{display:flex;flex-direction:column;gap:8px;margin:0 0 16px}.dl-fld-label{font-size:13px;font-weight:500;color:var(--dl-fg)}.dl-fld .cbi-input-text{width:100%;box-sizing:border-box}.dl-kinds{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}.dl-kinds button{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;height:68px;border-radius:10px;border:1px solid var(--dl-line);color:var(--dl-fg-muted);font-size:12px;font-weight:500;text-align:center;min-width:0}.dl-kinds button .dl-icon{width:20px;height:20px}.dl-kinds button:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-kinds button:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-kinds button.on{border-color:var(--dl-accent);color:var(--dl-fg);background:color-mix(in srgb,var(--dl-accent) 10%,transparent);box-shadow:inset 0 0 0 1px var(--dl-accent)}.dl-kinds button.on .dl-icon{color:var(--dl-accent)}.dl-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:8px}.dl-choice{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;gap:4px;padding:12px 14px;border-radius:12px;background:var(--dl-card);box-shadow:inset 0 0 0 1px var(--dl-line);transition:background .15s,box-shadow .15s}.dl-choice:hover{background:var(--dl-soft)}.dl-choice:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-choice.selected{box-shadow:inset 0 0 0 2px var(--dl-accent);background:var(--accent-a10, color-mix(in srgb, var(--dl-accent) 8%, transparent))}.dl-choice-title{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:var(--dl-fg)}.dl-choice-text{font-size:12px;line-height:16px;color:var(--dl-fg-muted)}.dl-attn-item>.cbi-button{margin-left:auto;flex:none;align-self:center}";var _a='.dl-steps{display:flex;align-items:center;gap:8px;margin:0 0 16px;flex-wrap:wrap}.dl-step{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:var(--dl-fg-faint)}.dl-step b{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:50%;background:var(--dl-soft);font-size:12px;font-weight:600}.dl-step.current{color:var(--dl-fg)}.dl-step.current b{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-step.done{color:var(--dl-fg-muted)}.dl-step.done b{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-step+.dl-step:before{content:"";width:24px;height:1px;background:var(--dl-line)}.dl-wizard .dl-panel>div{display:flex;flex-direction:column;gap:16px}.dl-wizard .dl-panel>div>p{margin:0!important;color:var(--dl-fg-muted)}.dl-wizard .dl-panel>div>.cbi-value{margin:0}.dl-wizard h4{font-size:14px;font-weight:500;margin:8px 0 -6px!important}.dl-wizard h4:first-child{margin-top:0!important}.dl-modal .cbi-tabmenu{margin-bottom:16px}.dl-modal .cbi-value.dl-live>.cbi-value-title{display:flex;flex-direction:column;gap:2px;text-align:left}.dl-modal .cbi-value.dl-live>.cbi-value-title>.dl-sub{white-space:normal}.dl-checklist{display:flex;flex-direction:column;gap:6px;margin:4px 0 8px}.dl-checklist label{display:flex;align-items:center;gap:8px;font-size:14px;cursor:pointer}.dl-checklist input{margin:0}.dl-invite{display:grid;grid-template-columns:250px minmax(0,1fr);gap:22px;align-items:start}.dl-invite img{display:block;width:100%;border-radius:18px;box-shadow:0 0 0 1px var(--dl-line)}.dl-invite-side{display:flex;flex-direction:column;gap:14px;min-width:0}.dl-invite-side>p{margin:0!important}.dl-invite-link{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:10px;min-width:0;padding:11px 14px;border-radius:12px;background:var(--dl-soft);font:13px/18px var(--dl-mono);color:var(--dl-fg)}.dl-invite-link>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-invite-link>.dl-icon-wrap{flex:none;display:inline-flex}.dl-invite-link .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted);flex:none}.dl-invite-link:hover{background:var(--dl-soft-hover)}.dl-invite-link.alt{padding:8px 14px;font-size:12px;color:var(--dl-fg-muted)}.dl-invite-link>.dl-pill{flex:none}.dl-invite-steps{margin:0;padding-left:20px;list-style:decimal!important;font-size:13px;line-height:24px;color:var(--dl-fg-muted)}.dl-invite-steps b{color:var(--dl-fg);font-weight:500}.dl-invite-steps li{display:list-item!important;list-style:inherit!important;padding-left:4px}.dl-invite-actions{display:flex;gap:8px;flex-wrap:wrap}.modal:has(.dl-modal.wide){max-width:min(760px,94vw)!important;width:100%!important}@media(max-width:640px){.dl-invite{grid-template-columns:minmax(0,1fr)}.dl-invite img{max-width:260px;margin:0 auto}}.dl-toasts{position:fixed;left:50%;bottom:max(24px,env(safe-area-inset-bottom));transform:translate(-50%);z-index:100000;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none}.dl-toast{pointer-events:auto;display:inline-flex;align-items:center;gap:8px;max-width:min(520px,92vw);padding:10px 16px;border-radius:999px;background:var(--dl-fg);color:var(--dl-card);font-size:13px;line-height:18px;box-shadow:0 10px 30px #0000004d;opacity:0;transform:translateY(12px);transition:opacity .18s,transform .18s}.dl-toast.show{opacity:1;transform:none}.dl-toast .dl-icon-wrap{display:inline-flex}.dl-toast .dl-icon{width:15px;height:15px}.dl-toast.success .dl-icon{color:var(--dl-ok)}.dl-toast.error{background:var(--dl-bad);color:#fff}.dl-toast.error .dl-icon{color:#fff}.dl-toast.warning{background:var(--dl-warn);color:#111}.dl-toast.warning .dl-icon{color:#111}.dl-toast button{all:unset;cursor:pointer;display:inline-flex;margin-left:4px;opacity:.8}.dl-toast button:hover{opacity:1}';var Ca=".dl-setblock{display:flex;flex-direction:column;gap:8px;margin:0}.dl-addr-opts{display:flex;flex-direction:column;gap:6px}.dl-addr-opt{all:unset;box-sizing:border-box;cursor:pointer;display:grid;grid-template-columns:16px minmax(0,1fr) auto;gap:12px;align-items:center;padding:10px 14px;border-radius:12px;box-shadow:inset 0 0 0 1px var(--dl-line);min-width:0}.dl-addr-opt:hover{background:var(--dl-soft)}.dl-addr-opt.on{box-shadow:inset 0 0 0 1.5px var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 7%,transparent)}.dl-addr-opt .dl-mono{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-addr-opt .dl-stack{min-width:0}.dl-addr-opt input{width:100%}.dl-addr-opt.other{cursor:default}.dl-addr-opt.other:hover{background:none}.dl-addr-opt.other input{width:100%}.dl-addr-check{width:16px;height:16px;border-radius:5px;box-shadow:inset 0 0 0 1.5px var(--dl-fg-faint);display:inline-flex;align-items:center;justify-content:center}.dl-addr-check .dl-icon-wrap{display:inline-flex}.dl-addr-check .dl-icon{width:12px;height:12px}.dl-addr-opt.on .dl-addr-check{background:var(--dl-accent);box-shadow:none;color:#fff}.dl-addr-opt.other .dl-addr-check{box-shadow:none;color:var(--dl-fg-muted)}.dl-addr-warn{display:inline-flex;align-items:center;gap:5px;font-size:12px;line-height:17px;color:var(--dl-warn)}.dl-addr-warn .dl-icon-wrap{display:inline-flex}.dl-addr-warn .dl-icon{width:13px;height:13px}.dl-pill.info{background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent)}.dl-links{border-radius:12px;background:var(--dl-soft);overflow:hidden}.dl-link-row{display:grid;grid-template-columns:18px minmax(0,1fr) auto;gap:10px;align-items:center;padding:11px 14px}.dl-link-row+.dl-link-row{border-top:1px solid var(--dl-line)}.dl-link-ic{display:inline-flex}.dl-link-ic .dl-icon{width:15px;height:15px}.dl-link-ic.ok .dl-icon{color:var(--dl-ok)}.dl-link-ic.warn .dl-icon{color:var(--dl-warn)}.dl-link-url{font-size:13px;color:var(--dl-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-link-url b{font-weight:500;color:var(--dl-accent)}@media(max-width:640px){.dl-link-url,.dl-addr-opt .dl-mono,.dl-filecard .dl-ellipsis,.dl-invite-link>span:first-child{white-space:normal;overflow-wrap:anywhere}}.dl-ready-sum{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:12px}.dl-ready-sum>.dl-icon-wrap{display:inline-flex}.dl-ready-sum>.dl-icon-wrap .dl-icon{width:18px;height:18px}.dl-ready-sum .dl-stack{flex:1;min-width:0}.dl-ready-sum b{font-weight:500;font-size:13px}.dl-ready-sum.ok{background:var(--dl-ok-wash)}.dl-ready-sum.ok b,.dl-ready-sum.ok .dl-icon{color:var(--dl-ok)}.dl-ready-sum.warn{background:var(--dl-warn-wash)}.dl-ready-sum.warn b,.dl-ready-sum.warn .dl-icon{color:var(--dl-warn)}.dl-ready-sum.error{background:var(--dl-bad-wash)}.dl-ready-sum.error b,.dl-ready-sum.error .dl-icon{color:var(--dl-bad)}.dl-check-chip{display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-soft);font-size:12px;color:var(--dl-fg-muted)}.dl-check-chip .dl-icon-wrap{display:inline-flex}.dl-check-chip .dl-icon{width:13px;height:13px;color:var(--dl-ok)}.dl-check-chip.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-check-chip.warn .dl-icon{color:var(--dl-warn)}.dl-check-chip.error{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-check-chip.error .dl-icon{color:var(--dl-bad)}.dl-ready-details{display:flex;flex-direction:column;gap:8px;padding:4px 2px}.dl-ready-details[hidden]{display:none}.dl-ready-item{display:flex;align-items:flex-start;gap:8px;font-size:13px;line-height:18px;min-width:0}.dl-ready-item .dl-icon-wrap{display:inline-flex;margin-top:1px}.dl-ready-item .dl-icon{width:15px;height:15px}.dl-ready-item.ok .dl-icon{color:var(--dl-ok)}.dl-ready-item.warn .dl-icon{color:var(--dl-warn)}.dl-ready-item.error .dl-icon{color:var(--dl-bad)}.dl-params-body{display:flex;flex-direction:column;gap:14px;padding:6px 14px 14px}.dl-params-body>.dl-setrow{margin:0;padding:0}.dl-pgrid.flush{padding:0;grid-template-columns:repeat(2,minmax(0,1fr))}@media(max-width:640px){.dl-pgrid.flush{grid-template-columns:minmax(0,1fr)}}.dl-qr-pane{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center}.dl-qr{width:min(280px,72vw);aspect-ratio:1;background:#0a0a0a;border-radius:18px;overflow:hidden}.dl-qr.light{background:#fff;box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-qr svg{display:block;width:100%;height:100%}.dl-filecard{display:flex;align-items:center;gap:12px;padding:12px;border-radius:14px;background:var(--dl-soft);min-width:0}.dl-filecard>.dl-stack{flex:1;min-width:0}.dl-filecard-ic{width:40px;height:46px;border-radius:8px;flex:none;display:inline-flex;align-items:center;justify-content:center;font:10px var(--dl-mono);color:var(--dl-fg-muted);background:var(--dl-card);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-params>.dl-conf{margin:0;border-top:1px solid var(--dl-line);border-radius:0 0 12px 12px;background:none}.dl-conf-sec{color:var(--dl-accent)}.dl-conf-k{color:var(--dl-fg-faint)}.dl-conf-mask{padding:0 6px;border-radius:4px;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-params>summary .dl-chipbtn{height:26px;font-size:12px}.dl-conf{white-space:pre-wrap;word-break:break-all;max-height:22em;overflow:auto;font-family:var(--dl-mono);font-size:12px;line-height:18px;margin:0;padding:12px;border-radius:12px;background:var(--dl-soft)}.dl-key{width:100%;box-sizing:border-box;font-family:var(--dl-mono);font-size:12px;word-break:break-all;min-height:7em}.dl-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:12px 0 0}.dl-link-box{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.dl-link-box input{flex:1 1 18em;min-width:0;font-family:var(--dl-mono);font-size:12px}.dl-hint{font-size:12px;line-height:16px;color:var(--dl-fg-muted);margin:8px 0}.dl-divider{border:0;border-top:1px solid var(--dl-line);margin:16px 0}";var La=".dl-checks{list-style:none;margin:0;padding:0}.dl-checks li{display:flex;align-items:center;gap:12px;padding:12px 0;border-top:1px solid var(--dl-line)}.dl-checks li:first-child{border-top:0;padding-top:0}.dl-checks li:last-child{padding-bottom:0}.dl-check-icon{flex:0 0 auto;width:28px;height:28px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center}.dl-check-icon .dl-icon{width:14px;height:14px}.dl-check-icon.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-check-icon.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-check-icon.error{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-check-icon.skip{background:var(--dl-soft);color:var(--dl-fg-faint)}.dl-check-body{flex:1;min-width:0}.dl-check-title{font-size:14px;line-height:20px;font-weight:500}.dl-check-detail{font-size:12px;line-height:16px;color:var(--dl-fg-muted);overflow-wrap:anywhere}.dl-check-repaired{margin-top:2px;font-size:12px;line-height:16px;color:var(--dl-warn)}.dl-wd{margin:0 0 16px;display:flex;flex-direction:column;gap:14px}.dl-wd-head{display:flex;align-items:center;gap:12px;min-width:0}.dl-wd-head>.dl-stack{min-width:0}.dl-wd-title{font-size:16px;line-height:24px;font-weight:500}.dl-wd-tile{flex:none;width:36px;height:36px;border-radius:10px;display:inline-flex;align-items:center;justify-content:center;background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-wd-tile.off{background:var(--dl-soft);color:var(--dl-fg-faint)}.dl-wd-tile .dl-icon{width:18px;height:18px}.dl-wd-foot{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;padding-top:14px;border-top:1px solid var(--dl-line)}.dl-wd-chips{display:flex;flex-wrap:wrap;gap:6px;flex:1 1 auto;min-width:0}.dl-wd-chips .dl-check-chip.error .dl-icon{color:var(--dl-bad)}.dl-warn-text{color:var(--dl-warn)!important}.dl-health-cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(440px,100%),1fr));gap:16px;align-items:start}.dl-health-cols>.dl-panel{margin:0;min-width:0}.dl-recent{display:flex;flex-direction:column}.dl-recent .dl-panel-head a{font-size:13px}.dl-recent-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:32px 16px;color:var(--dl-fg-muted);font-size:13px;border-top:1px solid var(--dl-line)}.dl-loading{margin:0;font-size:13px}.dl-diag-tabs{margin:0 0 16px}.dl-row.dl-slog-row{align-items:baseline}.dl-slog-row .dl-ev-tile{align-self:flex-start;margin-top:-1px}.dl-slog-row.has-detail{cursor:pointer}.dl-row.dl-slog-row.has-detail:hover{background:color-mix(in srgb,var(--sys) 11%,transparent)}.dl-slog-more{display:inline-flex;vertical-align:-2px;margin-left:6px;color:var(--dl-fg-faint);transform:rotate(90deg);transition:transform .15s}.dl-slog-more .dl-icon{width:14px;height:14px}.dl-slog-more.open{transform:rotate(-90deg)}.dl-slog-detail{margin:8px 0 2px;padding:8px 10px;border-radius:8px;background:var(--dl-soft);font-family:var(--dl-mono);font-size:12px;line-height:17px;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--dl-fg-muted);cursor:text}.dl-table{width:100%;border-collapse:collapse;font-size:14px;line-height:20px}.dl-table th{text-align:left;font-weight:500;color:var(--dl-fg-faint);padding:0 8px 8px;border-bottom:1px solid var(--dl-line)}.dl-table td{padding:10px 8px;border-bottom:1px solid var(--dl-line);vertical-align:middle}.dl-table th:first-child,.dl-table td:first-child{padding-left:0}.dl-table th:last-child,.dl-table td:last-child{padding-right:0}.dl-table tr:last-child td{border-bottom:0}.dl-table .dl-right{text-align:right;white-space:nowrap}.dl-log{max-height:18em;overflow:auto;font-family:var(--dl-mono);font-size:12px;line-height:18px;margin:8px 0 0;padding:12px;white-space:pre-wrap;border-radius:12px;background:var(--dl-soft)}";var Ma=".dl-pagehead{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:0 0 20px}.dl-h1{margin:0!important;padding:0!important;font-size:24px!important;line-height:32px!important;font-weight:500!important;border:0!important}.dl-title-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.dl-stack{display:flex;flex-direction:column;gap:2px;min-width:0}.dl-stack.gap4{gap:4px}.dl-stack.gap8{gap:8px}.dl-sub{font-size:12px;line-height:16px;color:var(--dl-fg-muted)}.dl-ok{color:var(--dl-ok)}.dl-warn{color:var(--dl-warn)}.dl-bad{color:var(--dl-bad)}.dl-icon-only{width:auto!important;min-width:0!important;aspect-ratio:1 / 1;padding:0!important;justify-content:center;display:inline-flex!important;align-items:center;border-radius:999px!important}.dl-panel.flush{padding:0;overflow:hidden}.dl-panel-head.pad{padding:16px 16px 12px;margin:0}.dl-col{display:flex;flex-direction:column;gap:16px;min-width:0}.dl-col>.dl-panel,.dl-col>section.dl-panel{margin:0}.dl-crumbs{display:flex;gap:8px;align-items:center;font-size:14px;margin:0 0 16px;color:var(--dl-fg-faint)}.dl-crumbs a{color:var(--dl-fg-faint)}.dl-crumbs a:hover{color:var(--dl-fg)}.dl-crumbs span:last-child{color:var(--dl-fg)}.dl-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);margin:0 0 16px;box-shadow:var(--dl-shadow)}.dl-metric{display:flex;flex-direction:column;gap:4px;padding:16px 20px;min-width:0}.dl-metric+.dl-metric{border-left:1px solid var(--dl-line)}.dl-metric-label{font-size:12px;font-weight:500;color:var(--dl-fg-faint)}.dl-metric-value{font-size:28px;line-height:36px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums;white-space:nowrap}.dl-metric-value .dl-faint{font-size:16px}.dl-metric-sub{font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media(max-width:900px){.dl-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.dl-metric:nth-child(3){border-left:0}.dl-metric:nth-child(n+3){border-top:1px solid var(--dl-line)}}.dl-seg{display:inline-flex;gap:2px;padding:3px;border-radius:999px;background:var(--dl-soft);flex-wrap:wrap}.dl-seg button{all:unset;cursor:pointer;display:inline-flex;align-items:center;gap:6px;padding:4px 12px;border-radius:999px;font-size:13px;font-weight:500;color:var(--dl-fg-muted);white-space:nowrap}.dl-seg button:hover{color:var(--dl-fg)}.dl-seg button.on{background:var(--dl-soft-hover);color:var(--dl-fg)}.dl-seg.dl-srvsections{flex-wrap:nowrap;max-width:100%;overflow-x:auto;scrollbar-width:none}.dl-seg.dl-srvsections::-webkit-scrollbar{display:none}.dl-seg.dl-srvsections button{flex:none;white-space:nowrap}.dl-seg button:focus-visible{outline:2px solid var(--dl-ring)}.dl-seg button b{font-weight:500;font-size:11px;padding:0 6px;border-radius:999px;background:var(--dl-soft)}.dl-seg button b.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-seg.sm button{padding:2px 9px;font-size:11px}.dl-seg.wide{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border-radius:12px;padding:4px}.dl-seg.wide button{flex-direction:column;justify-content:center;padding:8px 6px;border-radius:9px;gap:3px}.dl-seg.wide button.on{background:var(--dl-primary);color:var(--dl-primary-fg)}";var Ea=`.dl-geomap{position:relative;border-top:1px solid var(--dl-line);background:transparent}.dl-map-status{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--dl-fg-muted);font-size:13px;z-index:1;pointer-events:none}.dl-map-wrap{position:relative}.dl-map-legend{position:absolute;left:12px;bottom:12px;display:flex;gap:12px;align-items:center;padding:6px 12px;border-radius:999px;font-size:12px;background:color-mix(in srgb,var(--dl-card) 88%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);z-index:2}.dl-map-legend span{display:inline-flex;align-items:center;gap:6px;color:var(--dl-fg-muted)}.dl-map-legend i.line{width:14px;height:0;border-top:2px dashed #8a8a8a}.dl-map-legend i.line.live{border-top-color:#3b82f6}.dl-map-off{padding:32px 16px;text-align:center;color:var(--dl-fg-muted);border-top:1px solid var(--dl-line)}.dl-mk{all:unset;cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;transition:opacity .2s}.dl-mk-hub{position:relative;display:flex;align-items:center;justify-content:center}.dl-mk-host{box-sizing:border-box;width:40px;height:40px;border-radius:11px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059}.dl-mk-host-tile{width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;background:var(--dl-fg);color:var(--background, var(--dl-elevated))}.dl-mk-host-ic{width:14px;height:14px}.dl-mk-av{position:relative;box-sizing:border-box;width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:500;line-height:1;border:2px solid #8a8a8a;background:var(--dl-elevated);color:var(--dl-fg-muted);transition:box-shadow .2s}.dl-mk.online .dl-mk-av{border-color:#3b82f6;background:color-mix(in srgb,#3b82f6 22%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk-badge{position:absolute;left:16px;bottom:-6px;height:16px;min-width:16px;padding:0 3px;border-radius:8px;border:2px solid var(--dl-elevated);background:#6b6b6b;color:#fff;display:flex;align-items:center;justify-content:center;gap:1px;font-size:9px;font-weight:600;white-space:nowrap;box-sizing:content-box}.dl-mk.online .dl-mk-badge{background:#3b82f6}.dl-mk-badge-ic{width:10px;height:10px;stroke-width:2.2}.dl-mk-badge:has(>svg:only-child){width:16px;min-width:0;padding:0}.dl-mk-tile{position:relative;width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--dl-fg) 18%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk.place.online .dl-mk-tile{background:#3b82f6;color:#fff;box-shadow:0 2px 8px #3b82f659}.dl-mk-tile-ic{width:14px;height:14px}.dl-mk-tile-n{position:absolute;right:-5px;top:-5px;min-width:14px;height:14px;padding:0 3px;box-sizing:border-box;border-radius:7px;background:var(--dl-fg);color:var(--dl-elevated);font-size:9px;font-weight:600;line-height:14px;text-align:center}.dl-mk-when{display:block;text-align:center;color:var(--dl-fg-faint);font-weight:400}.dl-mk.place.online .dl-mk-when{color:#3b82f6}.dl-mk-tile.sm{width:18px;height:18px;border-radius:5px;font-size:9px;font-weight:600}.dl-dmap{border:1px solid var(--dl-line);border-radius:12px;overflow:hidden}.dl-dmap .dl-geomap{border-top:0}.dl-dplaces{display:flex;flex-direction:column;margin-top:4px}.dl-dplace-row{display:flex;align-items:center;gap:10px;padding:9px 2px;border-top:1px solid var(--dl-line);font-size:13px}.dl-dplace-row:first-child{border-top:0}.dl-dplace-n{flex:0 0 auto;width:20px;height:20px;border-radius:5px;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:600;background:color-mix(in srgb,var(--dl-fg) 18%,var(--dl-elevated));color:var(--dl-fg)}.dl-dplace-n.live{background:#3b82f6;color:#fff}.dl-dplace-n .dl-icon{width:12px;height:12px}.dl-dplace-now{color:#3b82f6}.dl-dplaces.strips .dl-dplace-row{position:relative;display:grid;grid-template-columns:20px minmax(0,1fr) auto;column-gap:10px;row-gap:9px;margin:0 -10px;padding:11px 10px;border-top:0;border-radius:10px;transition:background .15s}.dl-dplaces.strips .dl-dplace-row+.dl-dplace-row:before{content:"";position:absolute;left:10px;right:10px;top:0;height:1px;background:var(--dl-line)}.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur){background:var(--dl-soft)}.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur):before,.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur)+.dl-dplace-row:before{opacity:0}.dl-dplace-strip{grid-column:2 / 4;position:relative;height:6px;border-radius:3px;background:var(--dl-track)}.dl-dplaces.can-replay .dl-dplace-strip{cursor:ew-resize;touch-action:none}.dl-dplace-strip i{position:absolute;top:0;bottom:0;min-width:2px;border-radius:2px;background:#8a8a8a}.dl-dplace-strip.live i{background:#3b82f6}.dl-dplaces.replay .dl-dplace-strip:after{content:"";position:absolute;left:var(--at);top:-4px;bottom:-4px;width:2px;margin-left:-1px;border-radius:1px;background:var(--dl-fg);box-shadow:0 0 0 2px var(--dialog-bg, var(--dl-elevated));pointer-events:none}.dl-dplace-axis{position:relative;height:16px;margin:4px 0 0 30px;font-size:11px;line-height:16px;color:var(--dl-fg-faint)}.dl-dplace-axis span{position:absolute;top:0;transform:translate(-50%);white-space:nowrap}.dl-dmap{position:relative}.dl-map-replay{position:absolute;left:10px;top:10px;z-index:3;display:flex;align-items:center;gap:6px}.dl-map-btn{all:unset;box-sizing:border-box;cursor:pointer;width:28px;height:28px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg)}.dl-map-btn:hover{background:color-mix(in srgb,var(--dl-fg) 8%,var(--dl-elevated))}.dl-map-btn:focus-visible{outline:2px solid var(--dl-ring)}.dl-map-btn .dl-icon{width:13px;height:13px}.dl-map-chip{display:inline-flex;align-items:center;height:28px;box-sizing:border-box;padding:0 10px;border-radius:8px;font-size:11.5px;white-space:nowrap;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg);font-variant-numeric:tabular-nums}.dl-mk.step .dl-mk-tile{transition:width .3s cubic-bezier(.2,.8,.2,1),height .3s cubic-bezier(.2,.8,.2,1),border-radius .3s,background-color .3s,color .3s,box-shadow .3s,transform .24s}.dl-mk.step .dl-mk-tile.sm .dl-mk-tile-ic{width:11px;height:11px}.dl-mk.step.faded>*{opacity:.5}.dl-mk.step:is(.online,.hl){z-index:2}.dl-mk.step.hl .dl-mk-tile{box-shadow:0 0 0 3px color-mix(in srgb,#3b82f6 55%,transparent)}.dl-mk.step.arrive .dl-mk-tile{animation:dl-mk-arrive .45s cubic-bezier(.2,.8,.2,1)}@keyframes dl-mk-arrive{0%{transform:scale(.8)}55%{transform:scale(1.12)}to{transform:scale(1)}}.dl-mk-when.inline{display:inline}.dl-mk>*{transition:opacity .15s;opacity:var(--dl-mk-fade, 1)}.dl-mk.merged,.dl-mk.piled{pointer-events:none}.dl-mk.dl-mk-new>*{transition:none}.dl-mk.merged>*,.dl-mk.piled>*{opacity:0}.dl-mk-hub{cursor:default}.dl-mk-host{position:relative}.dl-mk-host{transition:border-radius .22s ease,border-right-color .22s ease}.dl-mk-host.docked{border-top-right-radius:0;border-bottom-right-radius:0;border-right-color:transparent}.dl-mk-dock{position:absolute;left:100%;top:-1px;height:40px;box-sizing:border-box;display:flex;align-items:center;gap:6px;padding:0 10px 0 2px;border:1px solid var(--dl-line);border-left:0;border-radius:0 11px 11px 0;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059;pointer-events:none;opacity:0;clip-path:inset(-24px 100% -24px 0);transition:clip-path .28s cubic-bezier(.2,.8,.2,1),opacity .2s ease}.dl-mk-host.docked .dl-mk-dock{pointer-events:auto;opacity:1;clip-path:inset(-24px -24px -24px 0)}.dl-mk-new .dl-mk-host,.dl-mk-new .dl-mk-dock{transition:none}.dl-mk-pile{position:relative;display:flex;justify-content:center}.dl-mk-pile-box{box-sizing:border-box;height:40px;display:flex;align-items:center;gap:6px;padding:0 10px 0 6px;border-radius:20px;cursor:zoom-in;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059;animation:dl-plate-in .26s cubic-bezier(.2,.8,.2,1) both;transition:opacity .18s ease,transform .18s ease}.dl-mk-pile.out{pointer-events:none}.dl-mk-pile.out>*{opacity:0;transform:scale(.85);transition:opacity .18s ease,transform .18s ease}@keyframes dl-plate-in{0%{opacity:0;transform:scale(.85)}}.dl-mk-face{all:unset;position:relative;display:flex;cursor:pointer;transition:transform .18s ease,opacity .18s ease}.dl-mk-face>.dl-mk-badge{position:relative;left:auto;bottom:-8px;margin-left:-12px;align-self:center}.dl-mk-face.on .dl-mk-av{border-color:#3b82f6;background:color-mix(in srgb,#3b82f6 22%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk-face.on .dl-mk-badge{background:#3b82f6}.dl-mk-face:hover .dl-mk-av{box-shadow:0 0 0 4px #3b82f640}.dl-mk-face.in{animation:dl-dock-in .24s cubic-bezier(.2,.8,.2,1) both}.dl-mk-face.out{transform:scale(.4);opacity:0;pointer-events:none}@keyframes dl-dock-in{0%{transform:scale(.4);opacity:0}}.dl-mk-more{font-size:11px;font-weight:600;color:var(--dl-fg-muted)}.dl-mk-av,.dl-mk-tile{transition:box-shadow .2s,transform .24s cubic-bezier(.2,.8,.2,1)}.dl-mk.merged .dl-mk-av,.dl-mk.merged .dl-mk-tile,.dl-mk.piled .dl-mk-av{transform:scale(.5)}.dl-mk-host,.dl-mk-dock,.dl-mk-pile-box{transition-property:border-radius,border-right-color,clip-path,opacity,height,width,padding,gap}.dl-mk-dock,.dl-mk-pile-box{transition-duration:.22s;transition-timing-function:cubic-bezier(.2,.8,.2,1)}.dl-mk-pile-box{position:relative}.dl-mk-more{transition:transform .22s cubic-bezier(.2,.8,.2,1),opacity .18s ease}.dl-mk-more.in{animation:dl-dock-in .24s ease both}.dl-mk-more.out{transform:scale(.4);opacity:0}.dl-mk-face .dl-mk-av{transition:box-shadow .2s,transform .24s cubic-bezier(.2,.8,.2,1),width .2s ease,height .2s ease,font-size .2s ease}.dl-mk-face{transition:transform .22s cubic-bezier(.2,.8,.2,1),opacity .18s ease,margin .2s ease}.dl-mk-face>.dl-mk-badge{max-width:48px;overflow:hidden;transition:opacity .2s ease,transform .2s ease,max-width .22s ease,margin .22s ease,padding .22s ease,border-width .22s ease,height .22s ease,min-width .22s ease,width .22s ease,bottom .22s ease}.dl-lod-far .dl-mk-host{width:32px;height:32px;border-radius:9px}.dl-lod-far .dl-mk-host.docked{border-radius:9px 0 0 9px}.dl-lod-far .dl-mk-host-tile{width:20px;height:20px;border-radius:6px}.dl-lod-far .dl-mk-host-ic{width:11px;height:11px}.dl-lod-far .dl-mk-dock{height:32px;gap:0;padding:0 4px 0 0;border-radius:0 9px 9px 0}.dl-lod-far .dl-mk-pile-box{height:32px;gap:0;padding:0 4px;border-radius:16px}.dl-lod-far .dl-mk-face+.dl-mk-face{margin-left:-6px}.dl-lod-far .dl-mk-face .dl-mk-av{width:22px;height:22px;font-size:8px;box-shadow:0 0 0 2px var(--dl-elevated)}.dl-lod-far .dl-mk-face>.dl-mk-badge{max-width:0;min-width:0;padding:0;margin-left:0;border-width:0;opacity:0;transform:scale(.5);pointer-events:none}.dl-lod-far .dl-mk-more{margin-left:4px;font-size:10px}.dl-mk-label{transition:opacity .2s ease}.dl-lod-far .dl-mk:not(.step) .dl-mk-label{opacity:0}.dl-lod-mid .dl-mk-host{width:36px;height:36px}.dl-lod-mid .dl-mk-dock,.dl-lod-mid .dl-mk-pile-box{height:36px}.dl-lod-mid .dl-mk-face .dl-mk-av{width:24px;height:24px;font-size:9px}.dl-lod-mid .dl-mk-face>.dl-mk-badge{height:12px;min-width:12px;margin-left:-10px;bottom:-7px}.dl-lod-mid .dl-mk-face>.dl-mk-badge:has(>svg:only-child){width:12px}.dl-lod-mid .dl-mk-face>.dl-mk-badge .dl-mk-badge-ic{width:8px;height:8px}@media(prefers-reduced-motion:reduce){.dl-mk-dock,.dl-mk-pile-box,.dl-mk-face,.dl-mk-av,.dl-mk-tile,.dl-mk.step .dl-mk-tile,.dl-mk-host,.dl-mk-face>.dl-mk-badge{transition:none;animation:none}}.dl-mk-hub:has(.dl-mk-host.docked) .dl-mk-host{cursor:zoom-in}.dl-mk-ptr{position:absolute;left:50%;top:50%;width:0;height:0;z-index:-1;pointer-events:none}.dl-mk-ptr .line{position:absolute;left:0;top:-.5px;height:1px;background:var(--dl-fg-faint);transform-origin:0 50%}.dl-mk-ptr .spot{position:absolute;left:-3.5px;top:-3.5px;width:7px;height:7px;border-radius:50%;box-sizing:border-box;border:1.5px solid #fff;background:#8a8a8a}.dl-mk.online .dl-mk-ptr .spot,.dl-mk.place.online .dl-mk-ptr .spot{background:#3b82f6}.dl-mk.dim>*{opacity:.18}.dl-mk.hl .dl-mk-av{box-shadow:0 0 0 4px #3b82f640}.dl-mk-label{position:absolute;left:50%;bottom:100%;margin-bottom:4px;transform:translate(-50%);white-space:nowrap;pointer-events:none;font-size:10px;line-height:14px;font-weight:500;color:var(--dl-fg)}.dl-mk-label.below{bottom:auto;top:100%;margin:4px 0 0}.dl-mk-label.chip{padding:2px 6px;border-radius:4px;font-size:11px;line-height:16px;font-weight:600;background:color-mix(in srgb,var(--background, var(--dl-card)) 80%,transparent);backdrop-filter:blur(8px)}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact{margin:0 10px 10px 0;min-height:28px;padding:0;border-radius:8px;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg-muted);box-shadow:none;font-size:11px;line-height:26px}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show){width:28px;height:28px;box-sizing:border-box}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact.maplibregl-compact-show{padding:0 32px 0 10px}.dl-geomap .maplibregl-ctrl-attrib a{color:var(--dl-fg-muted)}.dl-geomap .maplibregl-ctrl-attrib-button{top:0;right:0;width:26px;height:26px;margin:0;border-radius:8px;background:none}.dl-geomap .maplibregl-ctrl-attrib-button:after{content:"";position:absolute;inset:5px;background:var(--dl-fg);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm-1.2 8.2h2.4V17h-2.4v-6.8ZM12 6a1.4 1.4 0 1 0 0 2.8A1.4 1.4 0 0 0 12 6Z'/%3E%3C/svg%3E") center / contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm-1.2 8.2h2.4V17h-2.4v-6.8ZM12 6a1.4 1.4 0 1 0 0 2.8A1.4 1.4 0 0 0 12 6Z'/%3E%3C/svg%3E") center / contain no-repeat}.dl-geomap .maplibregl-ctrl-attrib-button:focus{outline:none;box-shadow:none}.dl-geomap .maplibregl-ctrl-attrib-button:focus-visible{outline:2px solid var(--dl-ring)}.dl-map-card{position:absolute;right:12px;top:12px;z-index:3;min-width:200px;max-width:260px;padding:10px 12px;border-radius:10px;font-size:12px;line-height:20px;background:var(--dl-elevated);color:var(--dl-fg);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4));opacity:0;transition:opacity .2s;pointer-events:none}.dl-map-card.on{opacity:1}.dl-map-card-head b{font-weight:500}.dl-map-card-row{display:flex;justify-content:space-between;gap:12px;white-space:nowrap}.dl-popcard{position:fixed;z-index:2100;width:max-content;max-width:300px;padding:12px;border-radius:12px;box-sizing:border-box;background:var(--dl-elevated);color:var(--dl-fg);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4))}.dl-popcard.away{visibility:hidden}.dl-popcard.leaving{pointer-events:none}.dl-popcard-tip{position:absolute;left:var(--tip-x, 50%);width:10px;height:10px;margin-left:-6px;box-sizing:border-box;background:var(--dl-elevated);border:solid var(--dl-line);transform:rotate(45deg)}.dl-popcard.above .dl-popcard-tip{bottom:-6px;border-width:0 1px 1px 0}.dl-popcard.below .dl-popcard-tip{top:-6px;border-width:1px 0 0 1px}.dl-popcard.above{transform-origin:var(--tip-x, 50%) 100%}.dl-popcard.below{transform-origin:var(--tip-x, 50%) 0}@media(prefers-reduced-motion:no-preference){.dl-popcard{animation:dl-pop-in .16s ease-out}.dl-popcard.leaving{animation:dl-pop-out .14s ease-in forwards}}@keyframes dl-pop-in{0%{opacity:0;transform:scale(.94)}to{opacity:1;transform:none}}@keyframes dl-pop-out{0%{opacity:1;transform:none}to{opacity:0;transform:scale(.94)}}.dl-pop{display:flex;flex-direction:column;gap:4px;font-size:12px;line-height:18px;min-width:210px}.dl-pop-head{display:flex;align-items:center;gap:8px;font-size:13px;margin-bottom:2px}.dl-pop-net{width:30px;height:30px;border-radius:9px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-pop-list{display:flex;flex-direction:column;margin:6px 0 0;max-height:116px;overflow-y:auto}.dl-pop-row{all:unset;cursor:pointer;display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:8px}.dl-pop-row:hover{background:var(--dl-soft)}.dl-pop-row:focus{outline:none}.dl-pop-row:focus-visible{outline:2px solid var(--dl-ring)}.dl-pop-name{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-pop-name b{font-weight:500}.dl-pop-dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);flex:0 0 auto}.dl-pop-dot.on{background:var(--dl-ok);box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-pop-actions{display:flex;gap:6px;margin-top:8px;padding-top:8px;border-top:1px solid var(--dl-line)}.dl-pop-actions .cbi-button{flex:1;height:28px!important;font-size:12px!important;justify-content:center}.dl-chartbox{position:relative}.dl-bars{display:flex;align-items:flex-end;gap:4px;border-bottom:1px solid var(--dl-line)}.dl-bar{flex:1;height:100%;display:flex;flex-direction:column-reverse;gap:1px;cursor:default;min-width:3px}.dl-bar i{display:block;border-radius:3px 3px 0 0}.dl-bar i.down{background:var(--dl-chart-1)}.dl-bar i.up{background:var(--dl-chart-2);opacity:.75;border-radius:3px 3px 0 0}.dl-bar:hover i{filter:brightness(1.25)}.dl-bar.empty{background:linear-gradient(to top,var(--dl-line) 2px,transparent 2px)}.dl-tip{position:absolute;top:-8px;transform:translate(-50%,-100%);padding:8px 10px;border-radius:10px;font-size:12px;line-height:18px;white-space:nowrap;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4));pointer-events:none;z-index:3}.dl-tip-title{font-weight:500}.dl-tip-float{position:fixed;z-index:2000;color:var(--dl-fg)}.dl-spark i:hover{opacity:1;filter:brightness(1.25)}.dl-meter,.dl-slots{cursor:default}.dl-axis{display:flex;justify-content:space-between;font-size:12px;color:var(--dl-fg-faint);margin-top:6px}.dl-legend i.down{background:var(--dl-chart-1)}.dl-legend i.up{background:var(--dl-chart-2)}.dl-spark{display:flex;align-items:flex-end;gap:2px;flex:0 0 auto}.dl-spark i{flex:1;display:block;border-radius:2px 2px 0 0;background:var(--dl-chart-1);opacity:.85}.dl-spark i.zero{opacity:.22}`;var Ta=`.dl-row{display:flex;align-items:center;gap:12px;padding:12px 16px;border-top:1px solid var(--dl-line);font-size:14px;line-height:20px;min-width:0}.dl-row.link{color:inherit;text-decoration:none}.dl-row.link:hover{background:var(--dl-soft)}.dl-row-main{flex:1;min-width:0;overflow-wrap:anywhere}.dl-row-main b{font-weight:500}.dl-attn{display:flex;flex-direction:column;gap:10px;padding:16px;border-top:1px solid var(--dl-line)}.dl-attn-item{display:flex;gap:10px;align-items:baseline;font-size:13px;color:var(--dl-fg-muted)}.dl-avatar.sm{width:26px;height:26px;font-size:10px;margin:0}.dl-avatar.lg{width:48px;height:48px;font-size:15px;margin:0}.dl-avatar.lg.online:after{width:12px;height:12px}.dl-list{border:1px solid var(--dl-line);border-radius:12px;overflow:hidden}.dl-list>.dl-row:first-child{border-top:0}.dl-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.dl-row-main.dl-stack{min-width:0}.dl-person-id{display:flex;align-items:center;gap:14px;min-width:0}.dl-grid-person{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(0,1fr);gap:16px;align-items:start}@media(max-width:1000px){.dl-grid-person{grid-template-columns:minmax(0,1fr)}}.dl-devsec{display:flex;flex-direction:column;gap:12px}.dl-devsec .dl-panel-head{margin:0}.dl-dgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.dl-dcard>.dl-dcard-head+*{margin-top:auto}@media(max-width:700px){.dl-dgrid{grid-template-columns:minmax(0,1fr)}}.dl-dgrid>.dl-dslot.add:only-child{grid-column:1 / -1}.dl-dcard{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:12px;min-width:0;box-shadow:var(--dl-shadow)}.dl-dcard.online{border-color:color-mix(in srgb,var(--dl-ok) 35%,transparent)}.dl-dcard.off{opacity:.7}.dl-dcard-head{display:flex;align-items:center;gap:12px}.dl-dcard-ic{width:40px;height:40px;border-radius:12px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-dcard-ic .dl-icon{width:20px;height:20px}.dl-dcard.online .dl-dcard-ic{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-dcard-title{all:unset;cursor:pointer;flex:1;min-width:0;display:flex;flex-direction:column}.dl-dcard-title b{font-weight:500;font-size:15px}.dl-dstat{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;min-width:0}.dl-dstat i.dot{flex:none}.dl-dstat.ok{color:var(--dl-ok)}.dl-dstat.warn{color:var(--dl-warn)}.dl-dstat i.dot,.dl-savebar i.dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint)}.dl-dstat i.dot.ok{background:var(--dl-ok);box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-dstat i.dot.warn{background:var(--dl-warn)}.dl-dcard-use{display:flex;align-items:flex-end;justify-content:space-between;gap:12px}.dl-dcard-foot{padding-top:10px;border-top:1px solid var(--dl-line);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-dslot.add{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:14px;min-height:0;border:1px dashed color-mix(in srgb,currentColor 18%,transparent);border-radius:14px;text-align:center;color:var(--dl-fg-muted);transition:background .15s,border-color .15s,color .15s}.dl-dslot.add .dl-stack{align-items:center}.dl-dslot.add:hover{border-color:color-mix(in srgb,currentColor 35%,transparent);color:var(--dl-fg)}.dl-dslot.add:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-dslot.add b{font-weight:500}.dl-dslot.add:hover{background:var(--dl-soft)}.dl-dslot-ic{width:36px;height:36px;border-radius:999px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-dslot.add:hover .dl-dslot-ic{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-tiles2{display:grid;gap:10px;margin-top:16px}.dl-tile2{border:1px solid var(--dl-line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:10px;min-width:0}.dl-tile2-label{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;font-weight:500;color:var(--dl-fg-faint)}.dl-tile2-row{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.dl-tile2-value{font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums}.dl-tile2-value .dl-faint{font-size:14px;font-weight:400}.dl-tile2-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:10px;border-top:1px solid var(--dl-line);font-size:12px}.dl-stepper{display:inline-flex;align-items:stretch;height:32px;border:1px solid var(--input, var(--dl-line));border-radius:8px;overflow:hidden}.dl-stepper button{all:unset;cursor:pointer;width:32px;display:inline-flex;align-items:center;justify-content:center;font-size:16px;color:var(--dl-fg)}.dl-stepper button:hover{background:var(--dl-soft)}.dl-stepper button[disabled]{opacity:.35;cursor:not-allowed}.dl-stepper+.dl-stepper{margin-left:4px}.dl-step-select{border:0!important;border-left:1px solid var(--input, var(--dl-line))!important;border-right:1px solid var(--input, var(--dl-line))!important;border-radius:0!important;background:transparent!important;color:inherit;font:500 13px inherit;padding:0 10px!important;height:100%!important;min-width:0!important}.dl-slots{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:3px}.dl-slots i{height:4px;border-radius:999px;background:var(--dl-track);display:block}.dl-slots i.used{background:var(--dl-fg)}.dl-slots i.over{background:color-mix(in srgb,var(--dl-warn) 80%,transparent)}.dl-date{display:flex;align-items:center;gap:8px;flex:1 1 150px;min-width:0;box-sizing:border-box;height:34px;padding:0 10px;border:1px solid var(--input, var(--dl-line));border-radius:8px;color:var(--dl-fg-faint)}.dl-date input{border:0!important;background:transparent!important;box-shadow:none!important;padding:0!important;height:32px!important;color:var(--dl-fg);flex:1;min-width:0!important;width:100%!important}.dl-meter{position:relative;height:6px;border-radius:999px;background:var(--dl-track)}.dl-meter>i{display:block;height:100%;border-radius:999px;background:var(--dl-accent)}.dl-meter.warn>i{background:var(--dl-warn)}.dl-meter.bad>i{background:var(--dl-bad)}.dl-meter .mark{position:absolute;left:90%;top:-3px;width:1px;height:12px;background:var(--dl-warn)}.dl-meter.sm{height:4px}.dl-chips-row{display:flex;flex-wrap:wrap;gap:4px}.dl-chipbtn{all:unset;cursor:pointer;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-soft);font-size:12px;font-weight:500;display:inline-flex;align-items:center}.dl-chipbtn:hover{background:var(--dl-soft-hover)}.dl-chipbtn.on{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-switch{all:unset;cursor:pointer;position:relative;width:32px;height:20px;border-radius:999px;background:var(--switch-off, var(--dl-track));flex:0 0 auto;transition:background .15s}.dl-switch i{position:absolute;left:2px;top:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:left .15s;box-shadow:0 1px 2px #0000004d}.dl-switch.on{background:var(--dl-accent)}.dl-switch.on i{left:14px}.dl-switch:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-linkbox{display:flex;align-items:center;gap:8px;height:36px;padding:0 4px 0 12px;border:1px solid var(--input, var(--dl-line));border-radius:8px;background:var(--input-bg, transparent)}.dl-linkbox .dl-mono{flex:1;min-width:0;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--dl-fg-muted)}.dl-linkbox .cbi-button{height:28px!important}.dl-pcard{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:20px;align-items:stretch;min-width:0}.dl-pcard-main{min-width:0}.dl-pcard-top{display:flex;align-items:center;gap:12px;min-width:0}.dl-pcard-top .dl-avatar{margin-right:0}.dl-pcard-who{flex:1;min-width:0}.dl-pcard-who .dl-slotbar{margin:3px 0 0}.dl-pside{display:flex;flex-direction:column;justify-content:space-between;gap:8px;padding-left:20px;border-left:1px solid var(--dl-line);min-width:0}.dl-pside-top{display:flex;align-items:center;justify-content:space-between;gap:8px}.dl-pside-state{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--dl-fg-muted)}.dl-pside-state.live{color:var(--dl-ok)}.dl-pside-foot{font-size:12px}.dl-pside .dl-use-num b{font-size:20px}.dl-none{display:none!important}.dl-pcard-actions{display:flex;gap:6px;flex:0 0 auto}.dl-pcard-actions .cbi-button{height:32px!important}.dl-icon-only .dl-btn-label{display:none}.dl-pill-ic{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 8px;border-radius:999px;font-size:12px;white-space:nowrap;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pill-ic .dl-icon{width:12px;height:12px}.dl-pill-ic.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-pill-ic.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-use-num{display:flex;align-items:baseline;gap:6px;white-space:nowrap}.dl-use-num b{font-size:15px;font-weight:500}.dl-use-live{display:flex;align-items:center;gap:8px;font-size:12px;font-variant-numeric:tabular-nums}.dl-usebar{display:flex;gap:2px;height:6px;border-radius:999px;overflow:hidden;background:var(--dl-track)}.dl-usebar i{display:block;height:100%;min-width:3px;flex:0 1 0}.dl-usebar i.fill{flex:none;min-width:0;border-radius:999px;background:var(--dl-accent)}.dl-usebar.warn i.fill{background:var(--dl-warn)}.dl-usebar.bad i.fill{background:var(--dl-bad)}.dl-usebar .c0,.dl-swatch.c0{background:var(--dl-chart-1)}.dl-usebar .c1,.dl-swatch.c1{background:#8b7cf6}.dl-usebar .c2,.dl-swatch.c2{background:#2fb889}.dl-usebar .c3,.dl-swatch.c3{background:#d9a03f}.dl-usebar .c4,.dl-swatch.c4{background:var(--dl-fg-faint)}.dl-tip-row{display:flex;align-items:center;gap:8px;min-width:160px}.dl-tip-row b{margin-left:auto;font-weight:500}.dl-swatch{width:8px;height:8px;border-radius:2px;flex:none}.dl-card-name{color:var(--dl-fg)!important;text-decoration:none}.dl-card-name:hover{text-decoration:underline}.dl-chip-tag{font-size:11px;line-height:18px;padding:0 6px;border-radius:999px;background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-chip.live{background:var(--dl-ok-wash);color:color-mix(in srgb,var(--dl-ok) 35%,var(--dl-fg))}.dl-chip.live:hover{background:color-mix(in srgb,var(--dl-ok) 22%,transparent)}.dl-chip.live .dl-icon{color:var(--dl-ok)}.dl-fixes{display:flex;gap:6px;flex-wrap:wrap;margin:10px 0 0 44px}.dl-fix{all:unset;cursor:pointer;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-info-wash);color:var(--dl-info);font-size:12px;font-weight:500;display:inline-flex;align-items:center}.dl-fix:hover{filter:brightness(1.15)}@media(max-width:760px){.dl-pcard{grid-template-columns:1fr}.dl-pside{padding:12px 0 0;border-left:0;border-top:1px solid var(--dl-line)}.dl-fixes{margin-left:0}}.dl-select{height:34px!important;border-radius:999px!important;min-width:136px!important;width:auto!important;padding:0 34px 0 14px!important;appearance:none!important;-webkit-appearance:none!important;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8f98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")!important;background-repeat:no-repeat!important;background-position:right 12px center!important;background-size:14px!important}.dl-savebar{position:fixed;left:50%;bottom:24px;transform:translate(-50%,160%);opacity:0;transition:transform .25s cubic-bezier(.2,.8,.2,1),opacity .2s;display:flex;align-items:center;gap:10px;padding:8px 8px 8px 18px;border-radius:999px;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:var(--shadow-2xl, 0 16px 32px -8px rgba(0,0,0,.5));z-index:60;pointer-events:none}.dl-savebar.show{transform:translate(-50%);opacity:1;pointer-events:auto}.dl-savebar-text{display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:500}`;var Sa=".dl-toast strong{display:block;font-weight:500}.dl-toast div{opacity:.8;font-size:13px}.dl-drawer-overlay{position:fixed;inset:0;z-index:900;display:flex;justify-content:flex-end;background:transparent;transition:background .2s}.dl-drawer-overlay.open{background:var(--scrim, rgba(0,0,0,.45))}.dl-drawer{width:min(520px,100%);height:100%;display:flex;flex-direction:column;background:var(--dialog-bg, var(--dl-elevated));color:var(--dl-fg);border-left:1px solid var(--dl-line);box-shadow:var(--shadow-2xl, -16px 0 32px -8px rgba(0,0,0,.5));transform:translate(100%);transition:transform .22s cubic-bezier(.2,.8,.2,1)}.dl-drawer-overlay.open .dl-drawer{transform:none}.dl-drawer-head{display:flex;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid var(--dl-line)}.dl-drawer-title{flex:1;min-width:0;display:flex;align-items:center;gap:12px}.dl-drawer-title h3{margin:0!important;padding:0!important;border:0!important;font-size:18px!important;line-height:26px;font-weight:500!important}.dl-drawer-x{all:unset;cursor:pointer;width:32px;height:32px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:var(--dl-fg-muted)}.dl-drawer-x:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-drawer-body{flex:1;overflow:auto;padding:20px}.dl-drawer-foot{padding:12px 20px;border-top:1px solid var(--dl-line)}.dl-drawer-actions{display:flex;align-items:center;gap:8px}.dl-dcard-ic.on{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-icon-only.sm{width:28px;height:28px!important}.dl-stack.gap12{gap:12px}.dl-stack.gap16{gap:16px}.dl-dstats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));border:1px solid var(--dl-line);border-radius:14px;overflow:hidden}.dl-dstats-cell{display:flex;flex-direction:column;gap:4px;padding:12px 14px;min-width:0}.dl-dstats-cell.wide{grid-column:span 2;border-bottom:1px solid var(--dl-line)}.dl-dstats-cell+.dl-dstats-cell:not(.wide):last-child{border-left:1px solid var(--dl-line)}.dl-dstats-cell b{font-size:16px;font-weight:500;font-variant-numeric:tabular-nums}.dl-dstats-cell .dl-dstat{font-size:14px}.dl-dsec{border:1px solid var(--dl-line);border-radius:14px;padding:16px;display:flex;flex-direction:column;gap:12px}.dl-dsec-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.dl-dsec-head h4{margin:0!important;padding:0!important;font-size:14px!important;font-weight:500!important;border:0!important}.dl-dstat i.dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);display:inline-block}.dl-connect-body{min-height:60px}.dl-connect-body .dl-qr{width:min(240px,70vw)}.dl-kv2{display:flex;flex-direction:column}.dl-kvrow{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:9px 0;border-top:1px solid var(--dl-line);font-size:13px;min-width:0}.dl-kvrow:first-child{border-top:0;padding-top:0}.dl-kvrow-k{color:var(--dl-fg-muted);flex:0 0 auto}.dl-kvrow-v{min-width:0;text-align:right;overflow-wrap:anywhere}.dl-kvrow-v.copy{all:unset;cursor:pointer;display:inline-flex;align-items:center;gap:6px;min-width:0;color:var(--dl-fg)}.dl-kvrow-v.copy span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-kvrow-v.copy .dl-icon{width:13px;height:13px;color:var(--dl-fg-faint)}.dl-kvrow-v.copy:hover .dl-icon{color:var(--dl-fg)}@media(max-width:560px){.dl-drawer{width:100%}.dl-dstats{grid-template-columns:minmax(0,1fr)}.dl-dstats-cell.wide{grid-column:auto}.dl-dstats-cell+.dl-dstats-cell:not(.wide):last-child{border-left:0;border-top:1px solid var(--dl-line)}}.dl-dev-log{display:flex;flex-direction:column}.dl-dev-log-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-top:1px solid var(--dl-line);font-size:13px;line-height:20px;min-width:0}.dl-dev-log-row:first-child{border-top:0;padding-top:0}.dl-dev-log-row .dl-row-main{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}";var Pa=".dl-settings-main{min-width:0;display:flex;flex-direction:column;gap:20px}.dl-setsec{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);overflow:hidden;scroll-margin-top:88px;box-shadow:var(--dl-shadow)}.dl-setsec-body{padding:20px;display:flex;flex-direction:column;gap:14px}.dl-setsec-body h3{margin:0!important;padding:0!important;font-size:18px!important;line-height:26px;font-weight:500!important;border:0!important}.dl-setsec-body p{margin:0}.dl-setsec-head{display:flex;align-items:center;gap:10px}.dl-group{border:1px solid var(--dl-line);border-radius:14px;padding:2px 16px}.dl-group-head{display:flex;align-items:center;gap:12px;padding:14px 0 10px}.dl-group-head b{font-size:15px;font-weight:500}.dl-group-ic{width:32px;height:32px;border-radius:10px;background:var(--dl-soft);color:var(--dl-fg-muted);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-group-ic .dl-icon-wrap{display:inline-flex}.dl-group-ic .dl-icon{width:16px;height:16px}.dl-group-body>*{padding:12px 0;margin:0!important}.dl-group-body>*+*:not(.alert-message):not(.dl-params){border-top:1px solid var(--dl-line)}.dl-group-body>.alert-message,.dl-group-body>.dl-params{margin:12px 0!important}.dl-group-body>.alert-message{padding:10px 14px}.dl-group-body>.dl-params{padding:0}.dl-group-body>.alert-message+*,.dl-group-body>.dl-params+*{border-top:0}.dl-group-body>.dl-row{border-left:0;border-right:0;border-bottom:0;padding-left:0;padding-right:0;background:none}.dl-group-body>.dl-row:first-child{border-top:0}.dl-setsec-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 16px;padding:12px 20px;border-top:1px solid var(--dl-line);background:var(--dl-soft)}.dl-setsec.danger{border-color:color-mix(in srgb,var(--dl-bad) 40%,transparent)}.dl-setsec.danger .dl-setsec-foot{background:color-mix(in srgb,var(--dl-bad) 6%,transparent)}.dl-setrow{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,420px);align-items:center;gap:8px 24px}.dl-setrow.head{display:flex;justify-content:space-between;gap:16px}.dl-setrow-label{font-size:14px;font-weight:500}.dl-setrow-ctl{display:flex;justify-content:flex-end;min-width:0}.dl-setrow-ctl .dl-chips-row{justify-content:flex-end}.dl-setrow-ctl>input{width:100%}.dl-hostport{display:flex;align-items:center;gap:8px;flex:1;min-width:0;justify-content:flex-end}.dl-hostport input{flex:1;min-width:0}.dl-root input.dl-w-port,.dl-hostport input.dl-w-port{flex:0 0 90px;width:90px}.dl-root input.dl-w-range{flex:0 0 130px;width:130px}.dl-setrow .dl-sub.bad{color:var(--dl-bad)}.dl-suffixed{display:inline-flex;align-items:center;gap:6px}.dl-suffixed>span{color:var(--dl-fg-muted)}.dl-more summary{cursor:pointer;color:var(--dl-fg-muted);font-size:13px;margin-bottom:10px}.dl-more .dl-setrow+.dl-setrow{margin-top:10px}@media(max-width:760px){.dl-setrow:not(.head){grid-template-columns:minmax(0,1fr)}.dl-setrow-ctl,.dl-setrow-ctl .dl-chips-row{justify-content:flex-start}}.dl-need-ic{width:30px;height:30px;border-radius:9px;background:var(--dl-soft);color:var(--dl-fg-muted);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-need-ic .dl-icon-wrap{display:inline-flex}.dl-need-ic .dl-icon{width:15px;height:15px}.dl-need-row.bad .dl-need-ic,.dl-need-ic.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-need-row.warn .dl-need-ic,.dl-need-ic.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-need-ic.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-lh-main{display:flex;align-items:flex-start;gap:12px;min-width:0}.dl-lh-main>.dl-need-ic{margin-top:1px}.dl-sub .dl-mono{font-size:.92em}.dl-need-row>.cbi-button{flex:none}.dl-bk-row .dl-group-ic{width:30px;height:30px}.dl-bk-older>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;padding:11px 16px;border-top:1px solid var(--dl-line);font-size:13px;color:var(--dl-fg-muted);user-select:none}.dl-bk-older>summary::-webkit-details-marker{display:none}.dl-bk-older>summary:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-bk-older>summary .dl-icon-wrap{display:inline-flex;transition:transform .15s}.dl-bk-older>summary .dl-icon{width:14px;height:14px}.dl-bk-older[open]>summary .dl-icon-wrap{transform:rotate(90deg)}#dl-set-backups .dl-setsec-head h3+.dl-sub{margin-top:2px}#dl-set-backups .dl-setsec-foot>.dl-sub{flex:1 1 260px}.dl-bk-actions{flex:0 1 auto;justify-content:flex-end}@media(max-width:640px){#dl-set-backups .dl-setsec-foot>.dl-sub{flex-basis:100%}.dl-bk-actions{justify-content:flex-start}}.dl-upd{display:flex;flex-direction:column;gap:16px}.dl-upd>.dl-pagehead{margin:0 0 4px}.dl-upd-bad{color:var(--dl-bad)}";var $a=".dl-comp-hero{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr)}.dl-comp-hero-main{padding:20px;display:flex;flex-direction:column;gap:12px;min-width:0}.dl-comp-hero-side{padding:20px;border-left:1px solid var(--dl-line);display:flex;flex-direction:column;gap:14px;min-width:0}.dl-comp-name{font-size:16px;font-weight:500}.dl-comp-hero-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-width:0}.dl-comp-hero-head .dl-spacer{flex:1}.dl-comp-big{font-family:var(--dl-mono);font-size:26px;line-height:34px;letter-spacing:-.02em;display:flex;align-items:baseline;gap:10px}.dl-comp-big small{font-size:14px;color:var(--dl-accent)}.dl-comp-big small.dl-faint{color:var(--dl-fg-faint)}.dl-comp-verrow{display:flex;align-items:center;gap:4px 12px;flex-wrap:wrap;min-width:0}.dl-comp-verrow .dl-spacer{flex:1}.dl-comp-meta{font-size:13px}.dl-comp-bullets{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:4px;color:var(--dl-fg-muted);font-size:13px}.dl-comp-bullets li{list-style:disc}.dl-comp-lead{margin:0}.dl-comp-more{align-self:flex-start;font-size:12px;color:var(--dl-fg-faint);margin-left:18px;padding:0!important}.dl-comp-more:hover{color:var(--dl-accent);background:none!important;text-decoration:underline;text-underline-offset:2px}.dl-comp-hero-main>.dl-comp-vers{margin-top:auto}.dl-comp-btns{display:flex;gap:8px;flex-wrap:nowrap;align-items:center;flex:none}.dl-comp-side-v{display:flex;align-items:center;gap:8px;font-size:14px;min-width:0;flex-wrap:wrap}.dl-comp-side-v .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted)}.dl-comp-side-v a{color:inherit;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-side-v a:hover{color:var(--dl-accent)}.dl-comp-cols{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:16px;align-items:start}.dl-comp-cols>.dl-panel>div>.dl-row:first-child{border-top:1px solid var(--dl-line)}.dl-comp-count{font-size:13px}.dl-comp-sub{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-ic{display:inline-flex;gap:4px;flex:none}.dl-comp-ic .cbi-button{width:30px;height:30px;padding:0!important;justify-content:center;border-radius:999px!important}.dl-comp-ic .dl-btn-label{display:none}.dl-comp-ic .dl-icon{width:14px;height:14px}.dl-comp-ic .is-busy{pointer-events:none;opacity:.5}.dl-comp-ic .cbi-button.dl-comp-check{width:auto;padding:0 12px 0 10px!important;gap:6px;display:inline-flex;align-items:center;font-size:13px}.dl-row>.dl-pill,.dl-row>.cbi-button,.dl-row>.dl-comp-ic{flex:none}button.dl-pill.dl-comp-run{all:unset;display:inline-flex;align-items:center;height:20px;padding:0 8px;border-radius:999px;font-size:12px;cursor:pointer;background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent)}.dl-comp-foldwrap{padding:0 16px 14px 60px}.dl-comp-fold .dl-params-body{gap:12px}.dl-comp-fold .dl-list>.dl-row{padding:10px 14px}.dl-comp-bver{font-size:12px;width:130px;text-align:right;flex:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-bact{width:84px;flex:none;display:flex;justify-content:flex-end}.dl-comp-warn{display:flex;align-items:flex-start;gap:8px;font-size:12px;line-height:18px;color:var(--dl-fg-muted)}.dl-comp-warn .dl-icon-wrap{display:inline-flex;flex:none;margin-top:2px}.dl-comp-warn .dl-icon{width:14px;height:14px;color:var(--dl-warn)}.dl-comp-empty{margin:0;padding:4px 16px 16px}@media(max-width:760px){.dl-comp-hero,.dl-comp-cols{grid-template-columns:minmax(0,1fr)}.dl-comp-hero-side{border-left:0;border-top:1px solid var(--dl-line)}.dl-comp-foldwrap{padding-left:16px}.dl-comp-bver{display:none}}.dl-comp-status{display:flex;align-items:center;gap:8px;font-size:13px;padding:9px 12px;border-radius:10px;background:var(--dl-soft);min-width:0}.dl-comp-status>.dl-icon-wrap{display:inline-flex;flex:none}.dl-comp-status .dl-icon{width:15px;height:15px}.dl-comp-status.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-comp-status.acc{background:color-mix(in srgb,var(--dl-accent) 12%,transparent);color:var(--dl-accent)}.dl-comp-status.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-comp-status.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-comp-status b{font-weight:600}.dl-comp-vers .dl-params-body{gap:0;padding:4px 14px 12px}.dl-comp-tag{display:flex;gap:6px;padding:6px 0 10px}.dl-comp-tag input{flex:1;min-width:0}.dl-comp-ver{display:flex;align-items:center;gap:8px;padding:7px 0;border-top:1px solid var(--dl-line);font-size:13px}.dl-comp-ver .dl-mono{min-width:52px}.dl-comp-ver .dl-sub{flex:1}.dl-comp-ver .cbi-button:not(.dl-icon-btn){height:26px!important;font-size:12px!important}.dl-comp-pager{display:flex;align-items:center;justify-content:space-between;padding-top:10px;border-top:1px solid var(--dl-line);font-size:12px}.dl-comp-pager .dl-linkbtn[disabled]{opacity:.4;cursor:default}.dl-comp-vers .dl-loading,.dl-comp-vers .dl-params-body>p{padding:6px 0 10px}.dl-op-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:14px}.dl-op-head .dl-spacer{flex:1}.dl-op-timer{display:inline-flex;align-items:center;gap:5px;font-variant-numeric:tabular-nums}.dl-op-timer .dl-icon,.dl-op-head .dl-linkbtn .dl-icon{width:14px;height:14px}.dl-op-loghead{display:flex;align-items:center;justify-content:space-between}.dl-op-loghead b{font-weight:500;font-size:13px}.dl-op .dl-log{max-height:16em;min-height:12em;margin-top:8px}.dl-op .dl-comp-status{margin:14px 0 0}.dl-op-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;width:100%}.dl-notes{max-height:55vh;overflow:auto;border-radius:12px;background:var(--dl-soft);padding:14px 16px;font-size:13px;line-height:20px;overflow-wrap:anywhere}.dl-notes h5{margin:10px 0 6px;font-size:14px;font-weight:500}.dl-notes h5:first-child{margin-top:0}.dl-notes p{margin:0 0 8px}.dl-notes ul{margin:0 0 10px;padding-left:18px}.dl-notes li{list-style:disc}.dl-notes code{font-family:var(--dl-mono);font-size:12px;padding:1px 5px;border-radius:6px;background:var(--dl-soft-hover)}.dl-notes pre{font-family:var(--dl-mono);font-size:12px;padding:10px;border-radius:8px;background:var(--dl-soft-hover);white-space:pre-wrap;margin:0 0 10px}.dl-notes a{color:var(--dl-accent)}";var Da=".dl-chip.static{cursor:default}.dl-chip.static:hover{background:var(--dl-soft)}.dl-chip.static .dl-chip-name{font-weight:500}.dl-setrow.head .dl-chips-row{margin-top:8px}.dl-setrow.head>.dl-lh-main,.dl-setrow.head>.dl-lh-main>.dl-stack{flex:1 1 auto;min-width:0}.dl-setrow.head>.dl-setrow-ctl:empty{display:none}.dl-setrow.head:has(>.dl-lh-main){align-items:flex-start}.dl-setrow.head>.dl-setrow-ctl{align-items:center;min-height:30px}.dl-netpick{margin-top:10px}.dl-boxrow{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0;padding:10px 14px;border:1px solid var(--dl-line);border-radius:12px;font-size:13px;cursor:pointer}.dl-boxrow>.dl-switch{flex:none}.dl-ifpick{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--dl-line);border-radius:14px}.dl-iflead-row{display:flex;align-items:center;justify-content:space-between;gap:12px}.dl-host-ports{justify-content:flex-end}@media(max-width:760px){.dl-host-ports{justify-content:flex-start}}.dl-circle-dot{display:inline-block;width:8px;height:8px;border-radius:50%;flex:none}.dl-circles .dl-chip b{font-weight:500}.dl-circle-name{display:inline-flex;align-items:center;gap:8px;font-size:14px;font-weight:500}.dl-w400{font-weight:400}.dl-swatches{display:flex;flex-wrap:wrap;gap:8px}.dl-swatch{all:unset;cursor:pointer;width:22px;height:22px;border-radius:50%;background:var(--sw);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dl-fg) 12%,transparent)}.dl-swatch.on{box-shadow:0 0 0 2px var(--dl-card),0 0 0 4px var(--sw)}.dl-swatch:focus-visible{outline:2px solid var(--dl-ring);outline-offset:3px}.dl-circle-modal .dl-chipbtn b{margin-left:6px;font-weight:500;font-size:11px;opacity:.6}.dl-reach td:first-child b{font-weight:500}.dl-ev-host{white-space:nowrap}.dl-ev-host b{font-weight:500;color:var(--dl-fg)}.dl-reach{font-size:13px}.dl-reach th,.dl-reach td{white-space:nowrap;padding-left:6px;padding-right:6px}.dl-reach-wrap{overflow-x:auto}.dl-yes{display:inline-flex;align-items:center;gap:4px;color:var(--dl-ok)}.dl-yes .dl-icon-wrap{display:inline-flex}.dl-yes .dl-icon{width:14px;height:14px}.dl-check-form{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr) auto;align-items:start;gap:8px}.dl-check-form>.dl-faint{line-height:36px}.dl-check-end{display:flex;flex-direction:column;gap:6px;min-width:0}.dl-check-end>*{width:100%!important;min-width:0}@media(max-width:560px){.dl-check-form{grid-template-columns:minmax(0,1fr)}.dl-check-form>.dl-faint{display:none}}.dl-verdict{display:flex;align-items:baseline;gap:10px;padding:10px 12px;border-radius:12px}.dl-verdict b{font-weight:500}.dl-verdict.ok{background:var(--dl-ok-wash)}.dl-verdict.ok b{color:var(--dl-ok)}.dl-verdict.bad{background:var(--dl-bad-wash)}.dl-verdict.bad b{color:var(--dl-bad)}.dl-corehead{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 4px}.dl-corehead h3{margin:0!important}.dl-row-end{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.dl-dcard.clickable{cursor:pointer}.dl-dcard.clickable:hover{border-color:color-mix(in srgb,var(--dl-fg) 22%,transparent)}";var td=[ba,xa,wa,ya,ka,_a,Ca,La,Ma,Ea,Ta,Sa,Pa,$a,Da].join(` +`).trim()}async function sn(n,e,o,s){let r=t("div",{class:"dl-notes"},t("p",{class:"dl-muted dl-loading"},_("Loading release notes…"))),a=t("div",{class:"dl-op-head"}),i="";de(o,[a,r],[A([v("copy")," ",_("Copy")],()=>xe(i,_("Release notes copied")))," ",ue(_("Close"))],"wide");try{let l=await N.updatesNotes(n,e,s??"");i=Kr(l.body||"");let d=qr(l.url);dom.content(a,[l.published?t("span",{class:"dl-pill"},Oe(l.published)):"",l.prerelease?t("span",{class:"dl-pill warn"},_("Pre-release")):"",t("span",{class:"dl-spacer"}),d?t("a",{href:d,target:"_blank",rel:"noopener",class:"dl-linkbtn"},[_("On GitHub")," ",v("open")]):""]),dom.content(r,i.trim()?Fr(i):t("p",{class:"dl-muted"},_("This release has no notes.")))}catch(l){dom.content(r,t("p",{class:"dl-muted"},Ce(l)))}}function yl(n){let e={"6h":_("checks every 6 h"),"12h":_("checks every 12 h"),"1d":_("checks daily"),"7d":_("checks weekly")};return e[n]??e["1d"]}var Ro=n=>n?Oe(n):"";function kl(n){let e=/^(.{20,}?)(?:;\s|:\s)/.exec(n)?.[1];return e||(n.length<=90?n:`${n.slice(0,90).replace(/[\s,;:]+\S*$/,"")}…`)}function Vr(n,e){let o=n.st,s=o.policy,r=o.kept?.app,a=e?.update&&e.tag?e.tag:o.version,i=w=>()=>sn("app",w,m(_("What’s new in Dawnline %s"),w.replace(/^v/,""))),l=e?.tag&&(e.update||e.status==="latest")?_l(n,e.tag,e.update?o.version:""):null,d=e?.tag??a,c=s.check&&o.auto?.check?o.auto.check+({"6h":6,"12h":12,"1d":24,"7d":168}[s.interval]??24)*3600:0,p=(w,M)=>t("div",{class:"dl-stack gap4"},[t("span",{class:"dl-metric-label"},w),t("span",{class:"dl-comp-side-v"},M)]),u=[{label:_("What’s new"),ic:"file",run:i(a)},{label:_("Open on GitHub"),ic:"globe",run:()=>window.open(`https://github.com/${o.repo}`,"_blank","noopener")},null,{label:m(_("Reinstall %s"),o.version),ic:"reset",warn:!0,run:()=>n.op("app:reinstall",_("Reinstalling Dawnline"),o.version)},r?{label:m(_("Roll back to %s"),r.version),ic:"archive",warn:!0,run:async()=>{await me(m(_("Roll back to Dawnline %s?"),r.version),m(_("The copy kept on the router replaces %s. A backup of the settings is made first."),o.version),_("Roll back"))&&n.op("app:rollback",_("Rolling back Dawnline"),o.version)}}:null];return t("section",{class:"dl-panel flush dl-comp-hero"},[t("div",{class:"dl-comp-hero-main"},[t("div",{class:"dl-comp-hero-head"},[t("span",{class:"dl-group-ic"},v("sunrise")),t("b",{class:"dl-comp-name"},"Dawnline"),n.state("app",e,e?.latest??""),t("span",{class:"dl-spacer"}),n.round(()=>n.op("check:app",_("Checking Dawnline"),o.version),u,!0)]),t("div",{class:"dl-comp-verrow"},[t("div",{class:"dl-stack"},[t("div",{class:"dl-comp-big"},[o.version,e?.update?t("small",{},`→ ${e.latest}`):e?.status==="dev"&&e.latest?t("small",{class:"dl-faint"},m(_("release %s"),e.latest)):""]),t("span",{class:"dl-faint dl-comp-meta"},e?.error?"":e?.update?e.published?m(_("released %s"),Ro(e.published)):"":e?.status==="dev"?_("ahead of the latest release"):e?[_("latest release"),e.published?m(_("released %s"),Ro(e.published)):""].filter(Boolean).join(" · "):_("not checked yet"))])]),l?.items.length?t("div",{class:"dl-stack gap4"},[t("ul",{class:"dl-comp-bullets"},l.items.map(w=>t("li",{},w))),l.total>l.items.length?t("button",{type:"button",class:"dl-linkbtn dl-comp-more",click:i(d)},W(l.total-l.items.length,"+%s more in What’s new","+%s more in What’s new")):""]):"",e?.error?t("p",{class:"dl-sub dl-comp-lead dl-upd-bad"},e.error):"",e?.update?t("div",{class:"dl-comp-btns"},[A(_("Update now"),()=>n.op("app",_("Updating Dawnline"),o.version),"positive",{disabled:n.busy}),A(_("What’s new"),i(a))]):"",Ll(n),Cl(n)]),t("div",{class:"dl-comp-hero-side"},[p(_("Source"),[v("globe"),t("a",{href:`https://github.com/${o.repo}`,target:"_blank",rel:"noopener"},o.repo)]),p(_("Auto-update"),[s.auto?Pe("ok",_("On")):Pe("",_("Off")),t("span",{class:"dl-muted"},s.auto?s.mode==="immediate"?_("as soon as found"):m(s.interval==="7d"?_("weekly at %s"):_("daily at %s"),s.time):s.check?yl(s.interval):_("checks off"))]),p(_("Last check"),o.check?[pe(o.check.time,o.now),c>o.now?t("span",{class:"dl-faint"},`· ${m(_("next in %s"),ot(c-o.now))}`):""]:[_("Never")]),p(_("Rollback"),r?[t("span",{class:"dl-mono"},r.version),t("span",{class:"dl-faint"},_("kept on flash"))]:[t("span",{class:"dl-muted"},s.keep?_("Kept after the next update"):_("Off"))])])])}function _l(n,e,o){if(n.notes.has(e))return n.notes.get(e)??null;n.notes.set(e,null);let s=r=>r.replace(/\*\*|`|\[([^\]]+)\]\([^)]*\)/g,(a,i)=>i??"").trim();return(async()=>{let a=((await N.updatesNotes("app",e,"").catch(()=>null))?.body??"").split(` +`).map(l=>/^\s*[-*+]\s+(.*)$/.exec(l)?.[1]).filter(l=>!!l);a.length||(a=(await N.updatesChanges(o,e).catch(()=>null))?.items??[]);let i={items:a.slice(0,3).map(l=>kl(s(l))),total:a.length};n.notes.set(e,i),i.items.length&&n.root.isConnected&&n.paint()})(),null}function jn(n){return n==="ru"?_("Russian translation"):n}function Cl(n){let e=(n.st.translations??[]).includes("ru"),o=ye(e,jn("ru"),r=>{n.op(r?"app:lang:ru":"app:nolang",r?_("Adding the Russian translation"):_("Removing the Russian translation"),n.st.version)});o.disabled=n.busy;let s=t("details",{class:"dl-params dl-comp-fold",open:n.langOpen?"open":null},[t("summary",{},[v("chevron"),t("span",{},_("Translation")),t("span",{class:"dl-sub"},e?_("Russian"):_("English only"))]),t("div",{class:"dl-params-body"},[t("div",{class:"dl-list"},[t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},jn("ru")),t("span",{class:"dl-sub"},_("LuCI pages for Dawnline"))]),t("span",{class:"dl-comp-bact"},o)])])])]);return s.addEventListener("toggle",()=>n.langOpen=s.open),s}function Ll(n){let e=t("div",{class:"dl-params-body"}),o=t("details",{class:"dl-params dl-comp-vers",open:n.versOpen?"open":null},[t("summary",{},[v("chevron"),t("span",{},_("Versions")),t("span",{class:"dl-sub"},_("install any release"))]),e]);return o.addEventListener("toggle",()=>{n.versOpen=o.open,n.versOpen&&Un(n,e)}),n.versOpen&&Un(n,e),o}async function Un(n,e){let o=he("",{placeholder:_("Tag, e.g. 0.3.1"),class:"cbi-input-text dl-mono","aria-label":_("Release tag")}),s=p=>{if(p=p.trim(),!/^v?[0-9][0-9A-Za-z.+~-]{0,40}$/.test(p))return q(_("Enter a release tag like 0.3.1"),"warning");Yr(n,p)};o.addEventListener("keydown",p=>{p.key==="Enter"&&(p.preventDefault(),s(o.value))});let r=t("div",{class:"dl-comp-tag"},[o,A(_("Install"),()=>s(o.value),"neutral",{disabled:n.busy})]),a=n.versPage,i=p=>{n.versPage=Math.max(1,n.versPage+p),Un(n,e)},l=p=>t("div",{class:"dl-comp-pager"},[t("button",{type:"button",class:"dl-linkbtn",disabled:a<=1?"disabled":null,click:()=>i(-1)},_("← Newer")),t("span",{class:"dl-faint"},m(_("Page %s"),a)),t("button",{type:"button",class:"dl-linkbtn",disabled:p?null:"disabled",click:()=>i(1)},_("Older →"))]),d=n.versCache.get(a);if(!d){dom.content(e,[r,t("p",{class:"dl-muted dl-loading"},_("Loading versions…"))]);try{d=(await N.updatesReleases(a)).releases}catch(p){if(a!==n.versPage||!e.isConnected)return;dom.content(e,[r,t("div",{class:"dl-row-actions"},[t("span",{class:"dl-muted"},m(_("Failed to load versions: %s"),Ce(p))),A(_("Try again"),()=>Un(n,e))]),l(!1)]);return}if(n.versCache.set(a,d),a!==n.versPage||!e.isConnected)return}if(!d.length)return dom.content(e,[r,t("p",{class:"dl-muted"},a>1?_("No more versions."):_("No versions found.")),l(!1)]);let c=n.st.version;dom.content(e,[r,...d.map(p=>{let u=p.tag.replace(/^v/,"");return t("div",{class:"dl-comp-ver"},[t("span",{class:"dl-mono"},u),t("span",{class:"dl-sub"},Ro(p.published)),p.prerelease?Pe("warn",_("Pre-release")):"",t("span",{class:"dl-comp-ic"},$e("file",_("What’s new"),()=>sn("app",p.tag,m(_("What’s new in Dawnline %s"),u)))),u===c?Pe("ok",_("Installed")):A(_("Install"),()=>Yr(n,p.tag),"neutral",{disabled:n.busy})])}),l(d.length>=5)])}async function Yr(n,e){let o=e.replace(/^v/,"");o.localeCompare(n.st.version,void 0,{numeric:!0})<0&&!await me(m(_("Install Dawnline %s?"),o),m(_("It is older than %s. A backup of the settings is made first; restore it from Settings if something looks wrong."),n.st.version),_("Install"))||n.op(`app@${e}`,m(_("Installing Dawnline %s"),o),n.st.version)}function Jr(n,e){let o=n.st,s=o.kept?.amneziawg,r=e?.sources??{},a=Object.keys(r),i=e?.current??null,l=i?r[i]:void 0,d=!!e?.ru,c=o.needs?.awg??[],p=c.length?null:e?.installed??null,u=[];i&&p&&u.push({label:_("Reinstall this build"),warn:!0,ic:"reset",run:()=>n.op(`amneziawg:${i}${d?":ru":""}`,_("Reinstalling AmneziaWG"),p)}),s&&u.push({label:m(_("Roll back to %s"),s.version),ic:"archive",warn:!0,run:async()=>{await me(m(_("Roll back AmneziaWG to %s?"),s.version),_("The build kept on the router is installed again. Every AmneziaWG tunnel restarts for a few seconds."),_("Roll back"))&&n.op("amneziawg:rollback",_("Rolling back AmneziaWG"),p??void 0)}});let w=[e?.release?{label:_("What’s new"),ic:"file",run:()=>sn("amneziawg",e.release,m(_("What’s new in the %s build"),l?.label??"AmneziaWG"),i??"slava")}:null,{label:_("Open on GitHub"),ic:"globe",run:()=>window.open(`https://github.com/${l?.repo??"Slava-Shchipunov/awg-openwrt"}`,"_blank","noopener")},...u.length?[null,...u]:[]].filter((k,f,x)=>k!==null||f>0&&x[f-1]!==null),M=o.tunnels??[],g=M.length?M.length===1?m(_("Switching restarts the tunnel for a few seconds: %s. Devices keep their configurations."),M[0]):m(N_(M.length,"Switching restarts %s tunnel for a few seconds: %s. Devices keep their configurations.","Switching restarts %s tunnels for a few seconds: %s. Devices keep their configurations."),K(M.length),M.join(", ")):_("Switching takes a few seconds. Devices keep their configurations."),h=M.length>1?m(_("%s and %s"),M.slice(0,-1).join(", "),M[M.length-1]):M[0],E=M.length?m(_("Switching restarts %s for a few seconds."),h):_("Switching takes a few seconds."),H=async k=>{let f=r[k];await me(p?m(_("Switch to AmneziaWG %s?"),f.gen):m(_("Install AmneziaWG %s?"),f.gen),[m(_("The %s build, %s."),f.label,f.version),g,f.gen==="3.1"?_("Devices need AmneziaVPN 3.1 or newer."):""].filter(Boolean).join(" "),p?_("Switch"):_("Install"))&&n.op(`amneziawg:${k}${d?":ru":""}`,p?m(_("Switching to AmneziaWG %s"),f.gen):_("Installing AmneziaWG"),p??void 0)},S=k=>{let f=r[k],x=i===k&&!!p;return t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},f.gen?`AmneziaWG ${f.gen}`:"AmneziaWG"),t("span",{class:"dl-sub"},`${f.label} · ${f.gen==="3.1"?"AmneziaVPN 3.1+":_("every app")}`)]),t("span",{class:"dl-mono dl-faint dl-comp-bver"},f.version??_("none yet")),t("span",{class:"dl-comp-bact"},x?Pe("ok",_("Active","build")):f.version?A(p?_("Switch"):_("Install"),()=>H(k),p?"neutral":"positive",{disabled:n.busy}):Pe("",_("No build")))])},$=a.map(k=>r[k]?.newer?m(_("%s moves to %s with OpenWrt %s."),r[k].label,r[k].newer.gen,r[k].newer.tag.replace(/^v/,"")):"").filter(Boolean),b=ye(d,_("Russian translation"),k=>{i&&n.op(`amneziawg:${i}${k?":ru":""}`,k?_("Adding the Russian translation"):_("Removing the Russian translation"),p??void 0)});b.disabled=!i||!p||n.busy;let C=n.awgOpen??!p,y=t("details",{class:"dl-params dl-comp-fold",open:C?"open":null},[t("summary",{},[v("chevron"),t("span",{},_("Build and translation"))]),t("div",{class:"dl-params-body"},[t("div",{class:"dl-list"},[...a.length?a.map(S):[t("div",{class:"dl-row"},t("span",{class:"dl-sub"},_("Check for updates to see the builds for this router.")))],t("div",{class:"dl-row"},[t("span",{class:"dl-row-main dl-stack"},[t("b",{},_("Russian translation")),t("span",{class:"dl-sub"},_("LuCI pages for AmneziaWG"))]),t("span",{class:"dl-comp-bact"},b)])]),p&&a.length||$.length?t("div",{class:`dl-comp-status ${p&&a.length?"warn":"acc"}`},[v(p&&a.length?"alert":"download"),t("span",{},[p&&a.length?t("b",{},E):"",...$.map(k=>` ${k}`)])]):""])]);y.addEventListener("toggle",()=>n.awgOpen=y.open);let z=[];return e?.update&&p&&i?z.push(A(m(_("Update to %s"),e.latest),()=>n.op(`amneziawg:${i}${d?":ru":""}`,_("Updating AmneziaWG"),p),"neutral",{disabled:n.busy})):z.push((e||c.length)&&!p?Pe("warn",_("Not installed")):n.state("amneziawg",e,e?.latest??"")),z.push(n.round(()=>n.op("check:amneziawg",_("Checking AmneziaWG"),p??void 0),w)),[n.row("shield","AmneziaWG",[p?`${p}${e?.release?` · ${m(_("%s build"),e.release)}`:""}`:c.length?m(_("missing %s"),c.join(", ")):e?_("not installed"):_("version not checked")],z),t("div",{class:"dl-comp-foldwrap"},y)]}function Ml(){return[{title:_("Home-like link"),sub:_("Policy routing and the veth pair"),pkgs:["ip-full","kmod-veth"],feature:"home"},{title:_("HTTPS for the portal"),sub:_("OpenSSL for uhttpd"),pkgs:["libustream-openssl","openssl-util"],feature:"https"},{title:_("Certificates (ACME)"),sub:_("Let’s Encrypt certificate for the portal"),pkgs:["acme","acme-acmesh-dnsapi"],feature:"acme",optional:!0}]}var Io={home:"network",https:"lock",acme:"file"};function Zr(n,e){let o=n.st,s=e?.pkgs??{},r=Ml().filter(c=>c.feature==="home"?o.home:o.portal),a=async(c,p,u=c)=>{await me(m(_("Update %s?"),p),m(_("%s from the OpenWrt feeds. Services that use them restart for a moment."),u.join(", ")),_("Update"))&&n.op(`pkgs:${c.join(",")}`,m(_("Updating %s"),p))},i=[{label:_("Check system packages"),ic:"refresh",run:()=>n.op("check:packages",_("Checking system packages"))},{label:_("Open the OpenWrt package list"),ic:"globe",run:()=>window.open("https://openwrt.org/packages/start","_blank","noopener")}],l=0;return{rows:r.map(c=>{let p=c.pkgs.filter(h=>s[h]?.installed),u=[...new Set(p.flatMap(h=>[...s[h]?.latest?[h]:[],...s[h]?.with??[]]))],w=o.needs?.[c.feature]??c.pkgs.filter(h=>!s[h]?.installed),M=p.find(h=>s[h]?.latest),g=p.map(h=>`${h} ${s[h]?.installed??""}`).join(", ");return w.length?n.row(Io[c.feature],c.title,[c.optional?_("not installed"):m(_("missing %s"),w.join(", "))],[A(_("Install"),()=>n.op(`pkgs:${w.join(",")}`,m(_("Installing %s"),c.title)),c.optional?"neutral":"positive",{disabled:n.busy}),t("span",{class:"dl-comp-ic"},n.more(i))]):e&&u.length?(l++,n.row(Io[c.feature],c.title,M?[`${s[M].installed} → ${s[M].latest}`,u.length>1?` · +${u.length-1}`:""]:[u.join(", ")],[A(_("Update"),()=>a(p.filter(h=>s[h]?.latest||s[h]?.with?.length),c.title,u),"neutral",{disabled:n.busy}),t("span",{class:"dl-comp-ic"},n.more(i))])):n.row(Io[c.feature],c.title,[g||c.sub],[n.state("pkgs",e,""),t("span",{class:"dl-comp-ic"},n.more(i))])}),updates:l,total:r.length}}function El(n){return n==="app"?"Dawnline":n==="amneziawg"?"AmneziaWG":n==="pkgs"?_("System packages"):_("Components")}function Tl(n){let e=/^(\d+) system packages?$/.exec(n)?.[1];return e?W(Number(e),"%s system package","%s system packages"):n}function Qr(n){let e=n.st,o=r=>{let a=mt(r.component??"app"),i=t("b",{},El(a)),l="ok",d="check",c;if(r.kind==="found")l="accent",d="download",c=ae(r.auto?_("%s found by the automatic check"):_("%s found by a check"),t("b",{},(r.items??[]).map(Tl).join(", ")));else if(r.state==="failed")l="bad",d="x",c=[...ae(r.kind==="install"?_("%s update failed"):_("%s check failed"),i),r.error?` · ${r.error}`:""];else if(/^app:(lang:|nolang$)/.test(r.component??"")){let p=/^app:lang:(.+)$/.exec(r.component??"")?.[1];c=p?ae(_("%s added by you"),t("b",{},jn(p))):[_("Translation removed by you")]}else{let p=r.from&&r.to&&r.from!==r.to?`${r.from} → ${r.to}`:r.to??"";c=[...p?ae(r.auto?_("%s %s automatically"):_("%s %s by you"),i,p):ae(r.auto?_("%s updated automatically"):_("%s updated by you"),i),r.took?` · ${ot(r.took)}`:""]}return t("div",{class:"dl-row"},[t("span",{class:`dl-ev-tile ev ${l}`},v(d)),t("span",{class:"dl-row-main"},c),t("span",{class:"dl-faint dl-nowrap",title:new Date(r.ts*1e3).toLocaleString(le())},pe(r.ts,e.now))])},s=e.history??[];return t("section",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Activity")),t("span",{class:"dl-spacer"}),t("a",{href:`${L.url("admin/network/dawnline/diagnostics")}?tab=log`},_("All in Log →"))]),s.length?t("div",{},s.slice(0,8).map(o)):t("p",{class:"dl-sub dl-comp-empty"},_("Updates, and checks that found something, show up here."))])}var Wn=class{constructor(){this.root=t("div",{class:"dl-upd"});this.following=null;this.versOpen=!1;this.versPage=1;this.versCache=new Map;this.notes=new Map;this.awgOpen=null;this.langOpen=!1}load(){return N.updatesStatus()}render(e){return this.st=e,this.paint(),e.job?.state==="running"&&this.follow(e.job),poll.add(async()=>{if(!this.root.isConnected)return;let o=await N.updatesStatus().catch(()=>null);if(!o)return;let s=this.st;this.st=o,o.job?.state==="running"&&this.following!=="starting"&&o.job.id!==this.following&&this.follow(o.job),(o.job?.id!==s.job?.id||o.job?.state!==s.job?.state||o.job?.phase!==s.job?.phase||o.check?.time!==s.check?.time)&&this.paint()},5),this.root}get busy(){return this.st.job?.state==="running"}async refresh(e){this.st=e??await N.updatesStatus().catch(()=>null)??this.st,this.paint()}async op(e,o,s){if(this.busy||this.following==="starting"){q(_("Another component action is already running"),"warning");return}this.following="starting",this.paint();let r=mt(e),a=await tn(e,{title:o,version:s,onJob:i=>this.following=i.id,onDone:i=>this.refresh(i),onUpdate:i=>{let l=i.check?.components??{};r==="amneziawg"&&l.amneziawg?.current?this.op(`amneziawg:${l.amneziawg.current}${l.amneziawg.ru?":ru":""}`,_("Updating AmneziaWG"),l.amneziawg.installed??void 0):this.op("app",_("Updating Dawnline"),this.st.version)}});this.following==="starting"&&(this.following=a?.id??null),this.refresh()}async follow(e){this.following=e.id;let o={app:[_("Checking Dawnline"),_("Automatic update: Dawnline"),_("Updating Dawnline")],amneziawg:[_("Checking AmneziaWG"),_("Automatic update: AmneziaWG"),_("Updating AmneziaWG")],pkgs:[_("Checking system packages"),_("Automatic update: system packages"),_("Updating system packages")],all:[_("Checking components"),_("Automatic update: components"),_("Updating components")]};await tn(null,{title:(o[An(e)]??o.all)[e.action==="check"?0:e.auto?1:2],onDone:s=>this.refresh(s)},e)}paint(){let e=this.st,o=e.check?.components??{},s=e.firmware,r=Zr(this,o.packages),a=(e.needs?.awg??[]).length>0,l=(!a&&o.amneziawg?.update&&o.amneziawg.installed?1:0)+r.updates;dom.content(this.root,[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},_("Components")),t("span",{class:"dl-faint"},[s?.version?`OpenWrt ${s.version} · ${s.target}`:"",e.check?m(_("checked %s"),pe(e.check.time,e.now)):_("not checked yet")].filter(Boolean).join(" · "))]),t("div",{class:"dl-row-actions"},[t("a",{class:"cbi-button cbi-button-neutral dl-icon-btn",href:`${L.url("admin/network/dawnline/settings")}?section=updates`},[v("edit")," ",_("Settings")]),A([v("refresh")," ",_("Check all")],()=>this.op("check",_("Checking all components")),"neutral",{disabled:this.busy})])]),Vr(this,o.app),t("div",{class:"dl-comp-cols"},[t("section",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Components")),t("span",{class:"dl-spacer"}),t("span",{class:"dl-faint dl-comp-count"},a?l?`${_("AmneziaWG not installed")} · ${W(l,"%s update","%s updates")}`:_("AmneziaWG not installed"):!o.amneziawg&&!o.packages?"":l?m(N_(l,"%s of %s needs an update","%s of %s need an update"),K(l),K(1+r.total)):_("Everything is up to date"))]),t("div",{},[...Jr(this,o.amneziawg),...r.rows])]),Qr(this)])])}state(e,o,s){let r=this.st.job;if(r?.state==="running"){let a=l=>l==="packages"?"pkgs":l,i=r.action==="check"?[a(r.component||"all")]:(r.component??"").split(" ").map(l=>a(mt(l)));if(i.includes(e)||i.includes("all"))return t("button",{type:"button",class:"dl-pill info dl-comp-run",title:_("Show progress"),click:()=>this.follow(r)},[r.action==="check"?_("Checking…"):_("Updating…")])}return o?o.error?Pe("warn",_("Check failed"),o.error):o.update?Pe("info",_("Update available")):o.status==="dev"?Pe("info",_("Newer than release"),m(_("The latest release is %s"),s)):Pe("ok",_("Up to date")):Pe("",_("Not checked"))}more(e){let o=A([v("more")],()=>Se(o,e.filter((s,r,a)=>s!==null||r>0&&rs?{label:s.label,icon:v(s.ic),warn:s.warn,run:s.run}:null)),"neutral",{title:_("More"),"aria-label":_("More")});return o}round(e,o,s=!1){let r=this.busy?" is-busy":"",a;return s?a=A([v("refresh")," ",_("Check")],e,"neutral",{class:`cbi-button cbi-button-neutral dl-comp-check${r}`,"aria-label":_("Check for updates")}):(a=$e("refresh",_("Check for updates"),e,"neutral",r.trim()),a.removeAttribute("title"),a.setAttribute("aria-label",_("Check for updates")),we(a,()=>[_("Check for updates")])),t("span",{class:"dl-comp-ic"},[a,this.more(o)])}row(e,o,s,r){return t("div",{class:"dl-row"},[t("span",{class:"dl-group-ic"},v(e)),t("span",{class:"dl-row-main dl-stack"},[t("b",{},o),t("span",{class:"dl-mono dl-faint dl-comp-sub"},s)]),...r])}};var Xr=(n,e)=>t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},n),t("div",{class:"cbi-value-field"},e)]);function ea(n){let e=n.st.servers.find(o=>o.id===n.p.server)?.name??_("Home");Xt(n.p,e)}async function ta(n){let e=n.p,o=e.code_set??0,s=e.devices.filter(l=>l.created_by==="portal"&&l.created>=o),r=s.map(l=>t("input",{type:"checkbox",id:`dl-rm-${l.id}`,checked:"checked","data-id":l.id})),a=[t("p",{},_("The old link stops working right away."))];s.length&&a.push(t("p",{},_("Devices added through the old link keep working until they are removed. Remove them too:")),t("div",{class:"dl-checklist"},s.map((l,d)=>t("label",{for:`dl-rm-${l.id}`},[r[d],` ${l.name}`]))));let i=async()=>{let l=r.filter(c=>c.checked).map(c=>c.dataset.id),d=await F(()=>N.personRegen(e.id,l),l.length?W(l.length,"New link created, %s device removed","New link created, %s devices removed"):_("New link created"));d&&(ce(),l.length&&await n.refresh(),d.link&&await xe(d.link,_("New link copied")))};de(_("Create a new link?"),a,[ue()," ",A(_("Create new link"),i,"negative")])}function Bo(n){let e=t("textarea",{class:"cbi-input-textarea dl-note-input",rows:3,maxlength:500,placeholder:_("Only you see this")},n.p.note??"");de(_("Note"),[e],[ue()," ",A(_("Save"),async()=>{ce(),await n.patch({note:e.value.trim()},e.value.trim()?_("Note saved"):_("Note removed"))},"positive")]),setTimeout(()=>e.focus(),50)}function na(n){let e=n.p,o=t("select",{class:"cbi-input-select"},[t("option",{value:"pause",selected:e.expire_action==="pause"?"selected":null},_("Pause access")),t("option",{value:"notify",selected:e.expire_action==="notify"?"selected":null},_("Keep access")),t("option",{value:"remove",selected:e.expire_action==="remove"?"selected":null},_("Remove their devices"))]),s=t("select",{class:"cbi-input-select"},[0,1,3,7,14].map(r=>t("option",{value:r,selected:e.expire_warn===r?"selected":null},r?W(r,"%s day before","%s days before"):_("Don’t warn"))));de(_("When access ends"),[Xr(_("Then"),o),t("div",{class:"cbi-value"},[t("label",{class:"cbi-value-title"},_("Warn")),t("div",{class:"cbi-value-field"},[s,t("div",{class:"cbi-value-description"},_("Shown in their portal and on the Overview."))])])],[ue()," ",A(_("Save"),async()=>{ce(),await n.patch({expire_action:o.value,expire_warn:s.value},_("Saved"))},"positive")])}function oa(n){let e=t("input",{type:"text",class:"cbi-input-text",value:n.p.name,maxlength:48}),o=Ee(_("Name","person"),e,()=>He(e.value,[],_("Shown in their portal and apps.")));de(_("Rename"),[o],[ue()," ",A(_("Save"),async()=>{let s=o.help();if(s.bad){q(s.text,"warning");return}await n.patch({name:e.value.trim()},_("Renamed"))&&ce()},"positive")]),setTimeout(()=>e.select(),50)}function sa(n){let e=n.p,o=n.st.servers.filter(a=>a.id!==e.server),s=t("select",{class:"cbi-input-select"},o.map(a=>t("option",{value:a.id},`${a.name} · ${a.endpoint||_("no address")}:${a.port}`))),r=e.devices.length;de(m(_("Move %s to another server"),e.name),[Xr(_("Server"),s),t("p",{class:"dl-muted"},r?W(r,"%s device gets a new address and stops connecting until it imports its configuration again (from the personal link or from you). Circles and home networks of the old server are left behind.","%s devices get new addresses and stop connecting until they import their configuration again (from the personal link or from you). Circles and home networks of the old server are left behind."):_("They have no devices yet: nothing else changes."))],[ue()," ",A(_("Move"),async()=>{await n.patch({server:s.value},m(_("Moved to %s"),o.find(a=>a.id===s.value)?.name??_("the server")))&&(ce(),r&&q(_("Devices are marked “Update config” until they import again."),"info",6e3))},"positive")])}async function ra(n){let e=n.p;await me(m(_("Delete %s?"),e.name),W(e.devices.length,"%s device is disconnected immediately and the personal link stops working.","All %s devices are disconnected immediately and the personal link stops working."),_("Delete"),!0)&&await F(()=>N.personDelete(e.id),_("Deleted"))&&(location.href=It(e.server))}function aa(n){let e=n.p,o=n.st,s=e.online?_("online now"):e.last_seen?m(_("last seen %s"),pe(e.last_seen,o.now)):_("never connected"),r=e.created?m(_("Added %s","date"),De(Ke(new Date(e.created*1e3)))):"",a=e.has_link??o.settings.portal_enabled,i=[{label:_("Rename"),icon:v("edit"),run:()=>oa(n)},{label:e.note?_("Edit note"):_("Add note"),icon:v("file"),run:()=>Bo(n)},...o.servers.length>1?[{label:_("Move to server…"),icon:v("server"),run:()=>sa(n)}]:[],...a?[null,{label:_("Invite card"),icon:v("qr"),run:()=>ea(n)},{label:_("New link"),icon:v("key"),run:()=>ta(n)}]:[],null,...e.paused?[]:[{label:_("Pause"),icon:v("pause"),warn:!0,run:()=>n.patch({paused:!0},_("Paused"))}],{label:_("Delete"),icon:v("trash"),danger:!0,run:()=>ra(n)}];return t("div",{class:"dl-person-head"},[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-person-id"},[t("span",{class:`dl-avatar lg${e.online?" online":""}`},je(e.name)),t("div",{class:"dl-stack"},[t("div",{class:"dl-title-row"},[t("h2",{class:"dl-h1"},e.name),Zo(e)]),t("span",{class:"dl-faint",title:r},`${m(N_(e.device_limit,"%s of %s device","%s of %s devices"),e.devices.length,e.device_limit)} · ${s}`)])]),t("div",{class:"dl-pcard-actions"},[e.paused?A([v("play"),` ${_("Resume")}`],()=>n.patch({paused:!1},_("Resumed")),"add"):"",a?$e("link",_("Copy link"),()=>Sn(e.id),"neutral","dl-icon-only"):"",$e("more",_("More"),l=>Se(l.currentTarget,i),"neutral","dl-icon-only")])]),e.note?t("button",{type:"button",class:"dl-pnote",title:_("Edit note"),click:()=>Bo(n)},[v("file"),t("span",{},e.note)]):""])}function ia(n){let e=n.p,o=n.series[n.series.length-1];return t("div",{class:`dl-person-live${e.online?"":" solo"}`},[e.online?zn(e.rate??[],n.st.now,o?[o.rx,o.tx]:[0,0]):"",Rn(n.series,m(_("%s this month"),se(e.month[0]+e.month[1])))])}async function Sl(n,e){let o=await F(()=>N.deviceConfig(e.id));o&&de(m(_("Set up %s"),e.name),[await n.core.connectBlock(o,"qr")],[ue(_("Close"))])}async function Pl(n,e){let o=await F(()=>N.deviceConfig(e.id));if(!o)return;if(!o.has_private_key){q(_("This device made its own keys in the browser; its configuration only exists there."),"warning");return}let s=n.core.file.make(o);Ne(s.name,s.text,"application/octet-stream")}function la(n){let e=n.p,o=n.st.now,s=d=>Je(e,d,n.deviceOpts()),r=d=>c=>{c.target.closest("button:not(.dl-dcard-title), a")||s(d)},a=d=>A([v("more")],c=>dr(c.currentTarget,e,d,n.deviceOpts()),"neutral",{title:_("QR, file, key, rename, new keys, remove"),class:"cbi-button cbi-button-neutral dl-icon-only"}),i=ln(e.devices).map(d=>{let c=t("div",{class:"dl-dcard-head"},[t("span",{class:"dl-dcard-ic"},v(d.kind)),t("button",{type:"button",class:"dl-dcard-title",click:()=>s(d)},[t("b",{},d.name),dn(d,o,void 0,e),d.config_stale?t("span",{class:"dl-pill warn dl-stale"},_("Update config")):""]),a(d)]),p=t("div",{class:"dl-dcard-trend"},[t("div",{class:"dl-stack"},[t("b",{},se(d.month[0]+d.month[1])),t("span",{class:"dl-sub"},_("this month"))]),$r(n.devSeries[d.id]??[])]);return t("article",{class:`dl-dcard clickable${d.online?" online":""}${d.disabled?" off":""}`,click:r(d)},[c,d.handshake?p:d.disabled?t("div",{class:"dl-sub"},`${at(d.kind)} · ${m(d.created_by==="portal"?_("created %s in the portal."):_("created %s by you."),pe(d.created,o))}`):t("div",{class:"dl-chips-row"},[t("button",{type:"button",class:"dl-chipbtn",click:()=>Sl(n,d)},[v("qr"),_("Show QR")]),t("button",{type:"button",class:"dl-chipbtn",click:()=>Pl(n,d)},[v("download"),_("Config")])])])}),l=e.devices.length>=e.device_limit;return i.push(t("button",{type:"button",class:"dl-dslot add",click:()=>ct(e,n.deviceOpts())},[t("span",{class:"dl-dslot-ic"},v("plus")),t("span",{class:"dl-stack"},[t("b",{},_("Add device")),t("span",{class:"dl-sub"},l?`${_("Over the limit")} · ${m(_("%s of %s"),e.devices.length,e.device_limit)}`:m(_("%s of %s"),e.devices.length,e.device_limit))])])),t("section",{class:"dl-devsec"},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Devices")),t("span",{class:"dl-sub"},m(_("%s online"),K(e.online)))]),t("div",{class:"dl-dgrid"},i)])}function da(n){let e=n.p,o=Me([["device",_("Device’s own DNS")],["home",_("Home names")]],e.dns_mode,{label:"DNS",cls:"sm",optimistic:!1,onChange:r=>n.patch({dns_mode:r},r==="home"?_("Home names on - devices need their configuration again"):_("Device DNS - devices need their configuration again"))}),s=n.st.settings.home_dns_fallback;return t("div",{class:"dl-stack gap4 dl-dnspick"},[t("div",{class:"dl-row-actions"},[t("span",{class:"dl-sub"},"DNS"),o]),t("span",{class:"dl-sub"},e.dns_mode==="home"?s?ae(_("Names like %s work. Internet names are resolved at home, so they depend on the tunnel (%s takes over when it is down)."),t("span",{class:"dl-mono"},`nas.${n.st.settings.domain}`),t("span",{class:"dl-mono"},s)):ae(_("Names like %s work. Internet names are resolved at home, so they depend on the tunnel - with no fallback set, they stop when it is down."),t("span",{class:"dl-mono"},`nas.${n.st.settings.domain}`)):_("Internet keeps working exactly as without the VPN. Reach home devices by IP address."))])}function ca(n){let e=n.p,s=n.st.servers.find(a=>a.id===e.server)?.home??[];if(s.length<2)return"";let r=new Set(e.home_nets?.length?e.home_nets:s.map(a=>a.dev));return t("div",{class:"dl-stack gap4"},[t("div",{class:"dl-chips-row"},s.map(a=>Xe(a.dev,r.has(a.dev),()=>{let i=new Set(r);if(i.delete(a.dev)||i.add(a.dev),!i.size)return q(_("Keep at least one network, or choose Internet only."),"warning",5e3);let l=i.size===s.length?[]:[...i];n.patch({home_nets:l},l.length?m(_("%s reaches %s"),e.name,l.join(", ")):m(_("%s reaches every home network"),e.name))},{title:a.nets.join(", ")}))),t("span",{class:"dl-sub"},e.home_nets?.length?m(_("Home networks %s reaches. Networks added to the server later stay out."),e.name):m(_("Home networks %s reaches: all of them. Untick one to keep %s out of it."),e.name,e.name))])}function pa(n){let e=new Set(n.p.services??[]);return t("div",{class:"dl-stack gap4"},[t("div",{class:"dl-chips-row"},n.st.services.map(o=>Xe(o.name,e.has(o.id),()=>{let s=new Set(e);s.delete(o.id)||s.add(o.id),n.patch({services:[...s]},s.size?_("Home services updated"):_("Whole home network"))},{title:`${o.address}${o.ports.length?` · ${o.ports.join(", ")}`:""}`}))),t("span",{class:"dl-sub"},e.size?_("Only the selected services at home."):_("Whole home network. Pick services to narrow it down."))])}function ua(n){let e=n.p,o=n.st;if(o.servers.find(c=>c.id===e.server)?.mesh!=="circles"||!ut(e))return"";let r=o.circles.filter(c=>c.server===e.server),a=r.find(c=>c.id===e.circle),i=a?o.people.filter(c=>c.id!==e.id&&c.circle===a.id&&ut(c)).map(c=>c.name):[],l=t("button",{type:"button",class:"dl-chipbtn",click:()=>Se(l,[...r.map(c=>({label:c.name,icon:So(c),run:()=>c.id!==e.circle&&n.patch({circle:c.id},m(_("%s is in %s"),e.name,c.name))})),e.circle?{label:_("No circle"),icon:v("x"),run:()=>n.patch({circle:""},m(_("%s is in no circle"),e.name))}:null,{label:_("New circle"),icon:v("plus"),run:()=>$n(o,e.server,null,()=>n.refresh())}])},_("Change")),d=a?o.people.filter(c=>c.circle===a.id&&ut(c)):[e];return t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},_("Devices see each other")),l]),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},a?a.name:_("No circle")),t("span",{class:"dl-avstack",title:d.map(c=>c.name).join(", ")},d.slice(0,5).map(c=>t("span",{class:"dl-avatar sm"},je(c.name))))]),t("span",{class:"dl-sub"},a?i.length?[e.name,...i].join(", "):m(_("Nobody else in %s yet"),a.name):m(_("Only %s's own devices"),e.name))])}function ma(n){let e=n.p,o=n.st.now,s=t("div",{class:"dl-slots"});for(let i=0;i=e.device_limit,c=t("i",{class:d?"over":l?"used":""});we(c,()=>[t("div",{class:"dl-tip-title"},l?`${l.name}${d?` · ${_("over the limit")}`:""}`:_("Free slot")),t("div",{class:"dl-muted"},l?l.online?_("Connected"):l.handshake?m(_("Last seen %s"),pe(l.handshake,o)):_("Not set up yet"):_("They can add a device here"))]),s.appendChild(c)}let r=Math.max(1,e.devices.length),a=t("button",{type:"button","aria-label":_("Allow fewer devices"),disabled:e.device_limit<=r?"disabled":null,click:()=>n.patch({device_limit:String(e.device_limit-1)})},"−");return e.device_limit<=r&&e.devices.length>1&&we(a,()=>[t("div",{class:"dl-tip-title"},W(e.devices.length,"%s device in use","%s devices in use")),t("div",{class:"dl-muted"},_("Remove a device first to lower the limit"))]),t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},_("Devices")),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},[String(e.devices.length),t("span",{class:"dl-faint"},` / ${e.device_limit}`)]),t("div",{class:"dl-stepper"},[a,t("button",{type:"button","aria-label":_("Allow more devices"),disabled:e.device_limit>=32?"disabled":null,click:()=>n.patch({device_limit:String(e.device_limit+1)})},"+")])]),s])}function $l(n){return{internet:_("Browse the internet through your router. No access to devices at home, and home cannot reach theirs."),lan:_("Reach devices at home, and home reaches theirs. Internet stays on their own connection."),both:_("Home devices and the internet, all through your router. Home reaches their devices too.")}[n]}var ha=/^([01]\d|2[0-3]):[0-5]\d$/;function Dl(n){let e=n.p,o=n.today,s=st(e.expires,o),r=t("input",{type:"date",class:"dl-date-hidden",value:e.expires,tabindex:"-1","aria-hidden":"true"});r.addEventListener("change",()=>r.value&&n.patch({expires:r.value},m(_("Access until %s"),De(r.value))));let a=(c,p)=>{let u=Yo(e.expires&&(s??-1)>=0?e.expires:"",c,p,o);n.patch({expires:u},m(_("Access until %s"),De(u)))},i=[["week",1,_("+1 week")],["month",1,_("+1 month")],["month",3,_("+3 months")],["year",1,_("+1 year")]].map(([c,p,u])=>t("button",{type:"button",class:"dl-chipbtn",click:()=>a(c,p)},u)),l=t("span",{class:"dl-datechip"},[t("button",{type:"button",class:"dl-chipbtn",click:()=>{r.focus({preventScroll:!0});try{r.showPicker()}catch{}}},[v("calendar"),e.expires?De(e.expires):_("Date")]),r]),d={pause:_("pause access"),notify:_("keep access"),remove:_("remove their devices")}[e.expire_action];return t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},_("Access ends")),e.expires?t("span",{class:s!=null&&s<0?"dl-bad":rt(e,s)?"dl-warn":"dl-ok"},s!=null&&s<0?_("ended"):W(s??0,"%s day left","%s days left")):t("span",{class:"dl-faint"},_("no end date"))]),t("div",{class:"dl-chips-row"},[...i,l,e.expires?t("button",{type:"button",class:"dl-chipbtn",click:()=>n.patch({expires:""},_("No end date"))},_("No end")):""]),t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},e.expire_warn?m(N_(e.expire_warn,"When it ends: %s, warn %s day before","When it ends: %s, warn %s days before"),d,K(e.expire_warn)):m(_("When it ends: %s"),d)),t("a",{href:"#",click:c=>{c.preventDefault(),na(n)}},_("Change"))])])}function Al(n){let e=n.p,o=e.quota_used||e.month[0]+e.month[1],s=e.quota_limit?Math.min(100,e.quota_used/e.quota_limit*100):0,r=t("div",{class:`dl-meter${s>=100?" bad":s>=90?" warn":""}`},[t("i"),e.quota_limit?t("span",{class:"mark",title:_("Alert at 90%")}):""]);r.firstChild.style.width=`${s}%`,e.quota_limit&&we(r,()=>[t("div",{class:"dl-tip-title"},m(_("%s%% used"),K(s,1))),t("div",{class:"dl-muted"},`${m(_("%s of %s"),se(e.quota_used),se(e.quota_limit))} · ${m(_("%s left"),se(Math.max(0,e.quota_limit-e.quota_used)))}`),t("div",{class:"dl-faint"},_("Alert at 90%"))]);let a=Me([["month",_("Monthly")],["total",_("Total")]],e.quota_period,{label:_("Data limit period"),cls:"sm",optimistic:!1,onChange:l=>n.patch({quota_period:l})}),i=[10,50,100].map(l=>t("button",{type:"button",class:`dl-chipbtn${e.quota_gb===l?" on":""}`,click:()=>n.patch({quota_gb:String(l)},m(_("Data limit %s GB"),K(l)))},`${K(l)} ${_("GB")}`));return i.push(t("button",{type:"button",class:`dl-chipbtn${e.quota_gb?"":" on"}`,click:()=>n.patch({quota_gb:""},_("No data limit"))},_("Unlimited"))),i.push(t("button",{type:"button",class:"dl-chipbtn",click:()=>{let l=t("input",{type:"number",class:"cbi-input-text dl-w-port",min:0,step:"any",value:e.quota_gb?String(e.quota_gb):""}),d=Ee(_("Data limit (GB)"),l,()=>gn(l.value,e.quota_period==="month"));de(_("Data limit"),[d],[ue()," ",A(_("Save"),async()=>{let c=d.help();if(c.bad){q(c.text,"warning");return}let p=l.value.trim();await n.patch({quota_gb:p},p&&Number(p)>0?m(_("Data limit %s GB"),K(Number(p))):_("No data limit"))&&ce()},"positive")]),setTimeout(()=>l.select(),50)}},_("Custom"))),t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-label"},[t("span",{},_("Data")),a]),t("div",{class:"dl-tile2-row"},[t("span",{class:"dl-tile2-value"},[se(o),e.quota_limit?t("span",{class:"dl-faint"},` ${m(_("of %s"),se(e.quota_limit))}`):t("span",{class:"dl-faint"},` · ${_("no limit")}`)]),e.quota_period==="month"?t("span",{class:"dl-sub"},_("resets on the 1st")):""]),e.quota_limit?r:"",t("div",{class:"dl-chips-row"},i),e.quota_gb&&e.quota_period==="month"?t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},e.bonus_gb?m(_("Includes +%s GB extra this month"),K(e.bonus_gb)):_("Need a little more this month?")),t("a",{href:"#",click:l=>{l.preventDefault(),n.patch({bonus_gb:String((e.bonus_gb||0)+10)},_("+10 GB this month"))}},_("+10 GB this month"))]):"",t("div",{class:"dl-tile2-foot"},[t("span",{class:"dl-muted"},m(_("%s in total"),se(e.total[0]+e.total[1]))),t("button",{type:"button",class:"dl-linkbtn danger",click:()=>Ht("person",e.id,e.name,()=>setTimeout(()=>n.refresh(),300))},_("Reset usage"))])])}function Nl(n){let e=n.p,o=!!e.hours,[s,r]=(e.hours||"07:00-23:00").split("-"),a=t("input",{type:"time",class:"cbi-input-text",value:s,"aria-label":_("From")}),i=t("input",{type:"time",class:"cbi-input-text",value:r,"aria-label":_("To")}),l=t("div",{class:"dl-tile2-row"},[a,t("span",{class:"dl-faint"},_("to","time range")),i]),d=()=>{let w=`${a.value}-${i.value}`;if(w!==e.hours){if(!ha.test(a.value)||!ha.test(i.value))return q(_("Enter both times, like 07:00 and 23:00."),"warning");if(a.value===i.value)return q(_("The start and the end must differ."),"warning");n.patch({hours:w},m(_("Allowed %s–%s"),a.value,i.value))}};l.addEventListener("focusout",w=>{l.contains(w.relatedTarget)||d()});for(let w of[a,i])w.addEventListener("keydown",M=>{M.key==="Enter"&&(M.preventDefault(),d())});let c=t("button",{type:"button",role:"switch","aria-checked":o?"true":"false",class:`dl-switch${o?" on":""}`,"aria-label":_("Limit hours"),click:()=>{if(o)return n.patch({hours:""},_("Any time"));c.classList.add("on"),c.setAttribute("aria-checked","true"),p.textContent=_("Set the hours, then press Enter"),u.appendChild(l),a.focus()}},t("i")),p=t("span",{},o?m(_("%s – %s (router time)"),s,r):_("Any time")),u=t("div",{class:"dl-tile2"},[t("div",{class:"dl-tile2-row"},[t("div",{class:"dl-stack"},[t("span",{class:"dl-tile2-label"},_("Allowed hours")),p]),c]),o?l:""]);return u}function fa(n){let e=n.p,o=Me(["internet","lan","both"].map(s=>[s,[v(s==="internet"?"globe":s==="lan"?"home":"shield"),s==="internet"?_("Internet"):s==="lan"?_("Home"):_("Both")]]),e.access,{label:_("Access"),cls:"wide",optimistic:!1,onChange:s=>n.patch({access:s},m(_("Access: %s"),vt(s)))});return t("section",{class:"dl-devsec","aria-label":_("Access and limits")},[t("div",{class:"dl-panel-head"},[t("h3",{},_("Access & limits"))]),t("div",{class:"dl-panel"},[t("div",{class:"dl-stack gap8"},[t("span",{class:"dl-tile2-label"},_("Can reach")),o,t("span",{class:"dl-sub"},$l(e.access)),e.access==="lan"&&n.st.services.length?pa(n):"",ut(e)?ca(n):"",e.access==="lan"?da(n):""]),t("div",{class:"dl-tiles2"},[ma(n),ua(n),Dl(n),Al(n),Nl(n)])])])}function Hl(n){let e=n.st,o=t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Locations")),t("span",{class:"dl-spacer"}),e.geo.enabled?Rt("30d",r=>n.map?.setRange(r),!1):"",A(_("Hide"),()=>{n.mapOpen=!1,n.map?.destroy(),n.map=null,n.paintPlaces()},"neutral")]);if(!e.geo.enabled)return t("div",{class:"dl-panel flush"},[o,t("div",{class:"dl-map-off"},ae(_("Locations are off. %s."),t("a",{href:L.url("admin/network/dawnline/settings")},_("Turn them on in Settings"))))]);let s=new dt({openPerson:()=>{},openDevice:(r,a)=>{let i=n.p.devices.find(l=>l.id===a);i&&Je(n.p,i,n.deviceOpts())}},"30d",280);return n.map=s,requestAnimationFrame(()=>s.mount(n.mapData())),t("div",{class:"dl-panel flush"},[o,s.el])}function ga(n){let e=n.st;if(!e.geo.enabled)return t("div",{class:"dl-places"},[v("pin"),t("div",{class:"dl-stack"},[t("span",{},_("Locations are off")),t("span",{class:"dl-sub"},_("City-level, from the client IP"))]),t("span",{class:"dl-spacer"}),t("a",{class:"cbi-button cbi-button-neutral",href:L.url("admin/network/dawnline/settings")},_("Turn on"))]);if(n.mapOpen)return n.map&&n.parts.places.contains(n.map.el)?null:Hl(n);let o=e.now-30*86400,s=e.geo.points.filter(i=>i.person===n.p.id&&i.ts>=o).sort((i,l)=>l.ts-i.ts),r=[...new Set(s.map(i=>i.city||i.country).filter(Boolean))],a=s[0];return t("div",{class:"dl-places"},[v("pin"),t("div",{class:"dl-stack"},[t("span",{},a?a.city||a.country:_("No locations yet")),t("span",{class:"dl-sub"},a?[W(r.length,"%s place in 30 days","%s places in 30 days"),a.org].filter(Boolean).join(" · "):_("Shown after a device connects"))]),t("span",{class:"dl-spacer"}),s.length?A(_("Show map"),()=>{n.mapOpen=!0,n.paintPlaces()},"neutral"):""])}function va(n){let e=n.p,o=n.st,s=n.events.filter(l=>l.person===e.id),r=[],a=[...s].reverse();for(let l=0;l1){let u=p.querySelector(".dl-row-main");dom.content(u,[...Do(o,d).slice(0,3),t("span",{class:"dl-muted"},W(c,"%s time","%s times"))]),u.title=a.slice(l,l+c).map(w=>w.detail??"").join(` +`)}r.push(p),l+=c-1}let i=A([v("more")],()=>Se(i,[{label:_("Export CSV"),icon:v("download"),run:()=>Qe(o,s,"csv",e.id)},{label:_("Export JSON"),icon:v("download"),run:()=>Qe(o,s,"json",e.id)},null,{label:m(_("Clear %s's activity"),e.name),icon:v("trash"),danger:!0,run:()=>lt(m(_("Clear %s's activity"),e.name),m(_("Removes events about %s and their devices."),e.name),{person:e.id},()=>n.refresh())}]),"neutral",{title:_("Export or clear"),class:"cbi-button cbi-button-neutral dl-icon-only"});return t("div",{class:"dl-panel flush"},[t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Activity")),t("span",{class:"dl-sub"},s.length>10?m(_("latest 10 of %s"),K(s.length)):""),t("span",{class:"dl-spacer"}),i]),r.length?r:t("div",{class:"dl-row dl-muted"},_("Nothing yet."))])}var Gn=class{constructor(){this.id="";this.events=[];this.mapOpen=!1;this.map=null;this.parts={};this.series=[];this.devSeries={};this.ticks=0;this.fullNext=!1}async fetch(e){let[o,s,r]=await Promise.all([N.status(30),e?N.events(2e3,this.id).catch(()=>null):Promise.resolve(null),e?N.personUsage(this.id,30).catch(()=>null):Promise.resolve(null)]);return{st:o,ev:s?.events??null,use:r}}async load(){return this.id=new URLSearchParams(location.search).get("id")??"",this.fetch(!0)}render(e){this.take(e);let o=this.st.people.find(i=>i.id===this.id);if(!o)return t("div",{class:"dl-empty"},[t("h3",{},_("Person not found")),t("p",{},_("They may have been removed.")),t("a",{class:"cbi-button",href:L.url("admin/network/dawnline/server")},_("Back to Servers"))]);this.p=o;for(let i of["crumbs","head","devices","traffic","places","activity","limits"])this.parts[i]=t("div",{});this.parts.devices.className="dl-person-devices";let s=t("div",{},[this.parts.crumbs,this.parts.head,t("div",{class:"dl-grid-person"},[t("div",{class:"dl-col"},[this.parts.devices,this.parts.traffic,this.parts.places,this.parts.activity]),t("div",{class:"dl-col"},[this.parts.limits])])]);this.paint();let r=new URLSearchParams(location.search),a=r.get("device")&&o.devices.find(i=>i.id===r.get("device"));return a?setTimeout(()=>Je(this.p,a,this.deviceOpts()),50):r.get("add")&&setTimeout(()=>ct(this.p,this.deviceOpts()),50),this.poller=pt({fetch:i=>{let l=i||this.fullNext||++this.ticks%4===0;return this.fullNext=!1,this.fetch(l)},every:15,live:!0,active:()=>s.isConnected,apply:(i,l)=>this.apply(i,l)}),s}take(e){this.st=e.st,e.ev&&(this.events=e.ev),e.use&&(this.series=e.use.person,this.devSeries=e.use.devices)}apply(e,o){this.take(e);let s=this.st.people.find(r=>r.id===this.id);if(!s){o||(location.href=It(this.p?.server));return}this.p=s,this.paint(o),this.map?.update(this.mapData())}async refresh(){this.fullNext=!0,await this.poller?.refresh()}async patch(e,o){var a;this.poller?.claim();let s=await F(()=>N.personUpdate(this.p.id,e),o);if(!s)return!1;this.poller?.claim();let r=this.st.people.findIndex(i=>i.id===this.p.id);return(a=s.person).rate??(a.rate=this.p.rate),r>=0&&(this.st.people[r]=s.person),this.p=s.person,this.paint(),!0}get today(){return Ge(this.series.length?this.series:this.st.series)}get core(){return zt(this.st.servers,this.p.server)}deviceOpts(){return{refresh:()=>this.refresh(),geo:this.st.geo,now:this.st.now,today:this.today,core:this.core,events:()=>this.events}}mapData(){return{geo:this.st.geo,people:this.st.people,now:this.st.now,person:this.p.id}}crumbs(){let e=this.p;return t("nav",{class:"dl-crumbs","aria-label":_("Breadcrumb")},[t("a",{href:It(e.server)},this.st.servers.find(o=>o.id===e.server)?.name??_("Servers")),t("span",{},"/"),t("a",{href:It(e.server)},_("People")),t("span",{},"/"),t("span",{},e.name)])}paint(e=!1){Ae(this.parts.crumbs,this.crumbs(),e),Ae(this.parts.head,aa(this),e),Ae(this.parts.traffic,ia(this),e),Ae(this.parts.devices,la(this),e),Ae(this.parts.limits,fa(this),e),this.paintPlaces(e),Ae(this.parts.activity,va(this),e)}paintPlaces(e=!1){let o=ga(this);o&&Ae(this.parts.places,o,e&&!this.mapOpen)}};var zl={ok:"check",warn:"alert",error:"x",skip:"pause"},qn=class{constructor(e,o,s,r){this.el=t("div",{});this.wdEl=t("div",{});this.checksEl=t("div",{class:"dl-panel"});this.recentEl=t("div",{class:"dl-panel flush dl-recent"});this.checks=null;this.summary=t("div",{});this.open=new Set;this.st=e,this.sl=o,this.events=s,this.toLog=r,dom.content(this.el,[this.summary,this.wdEl,t("div",{class:"dl-health-cols"},[this.checksEl,this.recentEl])]),this.paintChecks(),this.paintLive(o,s)}async run(e){let o=e?await In(e):await N.health().catch(()=>null);o&&(this.take(o),e==="netrestart"&&setTimeout(()=>this.el.isConnected&&void this.run(),5e3))}take(e){this.checks=e.checks,this.paintChecks(),this.paintLive(e,this.events)}paintChecks(){let e=this.checks;if(!e){dom.content(this.summary,""),dom.content(this.checksEl,[t("div",{class:"dl-panel-head"},[t("h3",{},_("Checks"))]),t("p",{class:"dl-muted dl-loading"},_("Running checks…"))]);return}let o=e.filter(i=>i.status==="error").length,s=e.filter(i=>i.status==="warn").length;dom.content(this.summary,o?bt("error",W(o,"%s problem needs attention.","%s problems need attention.")):s?bt("warn",W(s,"%s warning.","%s warnings.")):bt("ok",_("All checks passed.")));let r=new Map;for(let i of this.sl.watchdog.repairs)r.set(i.id,Math.max(r.get(i.id)??0,i.ts));let a=()=>this.run();dom.content(this.checksEl,[t("div",{class:"dl-panel-head"},[t("h3",{},_("Checks")),t("span",{class:"dl-spacer"}),A(_("Run again"),a)]),t("ul",{class:"dl-checks"},e.map(i=>t("li",{},[t("span",{class:`dl-check-icon ${i.status}`},v(zl[i.status])),t("div",{class:"dl-check-body"},[t("div",{class:"dl-check-title"},i.title),t("div",{class:"dl-check-detail"},i.detail),r.has(i.id)?t("div",{class:"dl-check-repaired"},m(_("Repaired by the watchdog at %s"),Ut(r.get(i.id)))):""]),Ao(i,l=>void this.run(l),a)])))])}paintLive(e,o){this.sl=e,this.events=o;let s=e.watchdog,r=s.beat!=null&&s.now-s.beat>180,a=s.repairs.filter(d=>s.now-d.ts<86400),i=a[a.length-1],l=ye(s.enabled,_("Watchdog repairs"),async d=>{await F(()=>N.settingsUpdate({watchdog:d?"1":"0"}),d?_("Watchdog on"):_("Watchdog off"))||uo(l,!d);let p=await N.serviceLog().catch(()=>null);p&&this.paintLive(p,this.events)});dom.content(this.wdEl,t("div",{class:"dl-panel dl-wd"},[t("div",{class:"dl-wd-head"},[t("span",{class:`dl-wd-tile${s.enabled?"":" off"}`},v("shield")),t("div",{class:"dl-stack"},[t("span",{class:"dl-wd-title"},_("Watchdog")),t("span",{class:"dl-sub"},s.enabled?_("Every minute it checks the tunnels and services and repairs what it can on its own."):_("Off: problems are only written to the log. Nothing is repaired on its own."))]),t("span",{class:"dl-spacer"}),l]),t("div",{class:"dl-wd-foot"},[t("div",{class:"dl-wd-chips"},s.targets.map(d=>t("span",{class:`dl-check-chip${d.ok?"":" error"}`,title:d.ok?_("OK"):d.tries?`${_("Not working")} · ${W(d.tries,"%s repair","%s repairs")}`:_("Not working")},[v(d.ok?"check":"x"),d.name]))),t("span",{class:`dl-sub${r?" dl-warn-text":""}`},r?m(_("The agent has not checked in for %s min; cron restarts it after 5."),K(Math.round((s.now-s.beat)/60))):[s.last?m(_("Looked %s"),pe(s.last,s.now)):_("Starts within a minute")," · ",a.length?m(N_(a.length,"%s repair today, last %s at %s","%s repairs today, last %s at %s"),K(a.length),i.name,Ut(i.ts)):_("no repairs today")])])])),this.paintRecent()}paintRecent(){let e=(this.sl.watchdog.now||Date.now()/1e3)-604800,o=[...this.events.map(r=>({ts:r.ts,ev:r})),...this.sl.log.map(r=>({ts:r.ts,sys:r}))].filter(r=>r.ts>=e&&vn(r)).sort((r,a)=>a.ts-r.ts),s=t("div",{class:"dl-panel-head pad"},[t("h3",{},_("Recent problems")),t("span",{class:"dl-spacer"}),o.length?t("a",{href:"#",click:r=>(r.preventDefault(),this.toLog())},`${_("All in Log")} →`):""]);if(!o.length){dom.content(this.recentEl,[s,t("div",{class:"dl-recent-empty"},[t("span",{class:"dl-check-icon ok"},v("check")),_("No problems in the last 7 days.")])]);return}dom.content(this.recentEl,[s,...o.slice(0,8).map(r=>{if(r.sys){let a=r.sys,i=`${a.ts}|${a.msg}`;return Hn(a,this.open.has(i),()=>{this.open.delete(i)||this.open.add(i),this.paintRecent()},Ut(a.ts))}return ht(this.st,r.ev,{time:Ut(r.ts)})})])}};var Fn=300,Rl=["all","connections","people","system","problems"],Kn=class{constructor(e,o,s){this.events=[];this.system=[];this.kind="all";this.shown=Fn;this.open=new Set;this.list=t("div",{});this.sub="";this.tabs=t("div",{class:"dl-seg",role:"tablist"});this.st=e,this.take(o),this.system=s,this.el=t("div",{},[t("div",{class:"dl-toolbar"},[this.tabs]),this.list]),this.paint()}actions(){let e=()=>this.kind==="all"?"":this.kind,o=a=>()=>{let i=this.filtered().reverse();Qe(this.st,i.filter(l=>l.ev).map(l=>l.ev),a,e(),i.filter(l=>l.sys).map(l=>l.sys))},s=A([v("download"),` ${_("Export")}`],()=>Se(s,[{label:_("CSV (spreadsheet)"),icon:v("download"),run:o("csv")},{label:"JSON",icon:v("download"),run:o("json")}])),r=A([v("trash"),` ${_("Clear")}`],()=>lt(_("Clear the log"),_("Removes events from the log on the router."),{},()=>this.reload(),this.kind==="all"?void 0:this.kind,!0));return[s,r]}take(e){this.events=e.events,this.policy=e.policy;let o=Nt.filter(r=>!e.policy.categories.includes(r)),s=bn(e.policy);this.sub=o.length?`${s} ${m(_("Not recorded: %s."),o.map(r=>Ye(r).toLowerCase()).join(", "))}`:s}async reload(){let[e,o]=await Promise.all([N.events(2e4).catch(()=>null),N.serviceLog().catch(()=>null)]);e&&this.take(e),o&&(this.system=o.log),this.paint()}items(){return[...this.events.map(e=>({ts:e.ts,ev:e})),...this.system.map(e=>({ts:e.ts,sys:e}))].sort((e,o)=>o.ts-e.ts)}matches(e,o){return o==="all"?!0:o==="problems"?vn(e):o==="system"?!!e.sys:!!e.ev&&qt(e.ev.type)===o}filtered(){return this.items().filter(e=>this.matches(e,this.kind))}paintTabs(e){dom.content(this.tabs,Rl.map(o=>t("button",{type:"button",role:"tab",class:o===this.kind?"on":"","aria-selected":o===this.kind?"true":"false",click:()=>this.show(o)},[o==="all"?_("All"):o==="system"?_("System"):Ye(o),t("b",{},String(e.filter(s=>this.matches(s,o)).length))])))}show(e){this.kind=e,this.shown=Fn,this.paint()}paint(){this.paintTabs(this.items());let e=this.filtered();if(!e.length){dom.content(this.list,t("div",{class:"dl-empty"},[t("p",{},this.events.length||this.system.length?_("No events match."):_("The log is empty."))]));return}let o=[],s="",r=null;for(let a of e.slice(0,this.shown)){let i=Pr(a.ts);i!==s&&(s=i,r=t("div",{class:"dl-panel flush"},t("div",{class:"dl-panel-head pad"},t("h3",{},i))),o.push(r));let l=new Date(a.ts*1e3).toLocaleTimeString(le(),{hour:"2-digit",minute:"2-digit"});if(a.sys){let d=`${a.sys.ts}|${a.sys.msg}`;r.appendChild(Hn(a.sys,this.open.has(d),()=>{this.open.delete(d)||this.open.add(d),this.paint()},l))}else r.appendChild(ht(this.st,a.ev,{time:l}))}e.length>this.shown&&o.push(t("div",{class:"dl-more-row"},A(m(_("Show %s more of %s"),K(Math.min(Fn,e.length-this.shown)),K(e.length-this.shown)),()=>{this.shown+=Fn,this.paint()}))),dom.content(this.list,o)}};var Il=["health","log"],Bl=n=>n==="log"?_("Log"):_("Health"),Oo=2e4,Yn=class{constructor(){this.tab=new URLSearchParams(location.search).get("tab")==="log"?"log":"health";this.segEl=t("div",{class:"dl-seg dl-srvsections dl-diag-tabs",role:"tablist","aria-label":_("Diagnostics")});this.subEl=t("span",{class:"dl-muted"});this.actionsEl=t("div",{class:"dl-row-actions"});this.bodyEl=t("div",{});this.eventsAt=0}load(){return this.eventsAt=Date.now(),Promise.all([N.status(1),N.events(Oo),N.serviceLog()])}render([e,o,s]){return this.log=new Kn(e,o,s.log),this.health=new qn(e,s,o.events,()=>{this.show("log"),this.log.show("problems")}),this.show(this.tab),pt({fetch:async()=>{let r=this.tab==="log",[a,i]=await Promise.all([N.serviceLog().catch(()=>null),r?N.events(Oo).catch(()=>null):Promise.resolve(null)]);return a||i?{n:a,e:i}:null},every:10,active:()=>this.bodyEl.isConnected,apply:({n:r,e:a})=>this.take(r,a)}),t("div",{},[t("div",{class:"dl-pagehead"},[t("div",{class:"dl-stack"},[t("h2",{class:"dl-h1"},_("Diagnostics")),this.subEl]),this.actionsEl]),this.segEl,this.bodyEl])}take(e,o){o&&(this.log.take(o),this.eventsAt=Date.now()),e&&(this.log.system=e.log),e&&this.health.paintLive(e,o?.events??this.health.events),this.tab==="log"&&this.log.paint()}show(e){this.tab=e,dom.content(this.segEl,Il.map(o=>t("button",{type:"button",role:"tab",class:o===e?"on":"","aria-selected":o===e?"true":"false",click:()=>o!==this.tab&&this.show(o)},Bl(o)))),this.bodyEl.replaceChildren(e==="log"?this.log.el:this.health.el),this.subEl.textContent=e==="log"?this.log.sub:_("Everything Dawnline depends on, checked live. The watchdog repairs what it can on its own."),dom.content(this.actionsEl,e==="log"?this.log.actions():""),e==="log"?(this.log.paint(),Date.now()-this.eventsAt>1e4&&N.events(Oo).then(o=>this.take(null,o)).catch(()=>null)):this.health.checks||this.health.run()}};var ba=":root{--dl-card: var(--panel-bg, var(--background-color-high, transparent));--dl-elevated: var(--elevated, var(--background-color-high, Canvas));--dl-line: var(--border, var(--border-color-medium, color-mix(in srgb, currentColor 14%, transparent)));--dl-soft: var(--muted, color-mix(in srgb, currentColor 5%, transparent));--dl-soft-hover: var(--soft-hover, color-mix(in srgb, currentColor 10%, transparent));--dl-fg: var(--foreground, var(--text-color-highest, inherit));--dl-fg-muted: var(--muted-foreground, color-mix(in srgb, currentColor 65%, transparent));--dl-fg-faint: var(--text-tertiary, color-mix(in srgb, currentColor 50%, transparent));--dl-accent: var(--accent, #3a83f7);--dl-ok: var(--success, #00a240);--dl-warn: var(--warning, #e25507);--dl-bad: var(--danger, #e02e2a);--dl-ok-wash: var(--success-a15, color-mix(in srgb, #00a240 15%, transparent));--dl-warn-wash: var(--warning-a15, color-mix(in srgb, #e25507 15%, transparent));--dl-bad-wash: var(--destructive-a15, color-mix(in srgb, #e02e2a 15%, transparent));--dl-info-wash: var(--info-a15, color-mix(in srgb, #3a83f7 15%, transparent));--dl-info: var(--info, #2c67c5);--dl-track: var(--foreground-a10, color-mix(in srgb, currentColor 10%, transparent));--dl-chart-1: var(--chart-blue, #3a83f7);--dl-chart-2: var(--chart-green, #00a240);--dl-ring: var(--ring, #3a83f7);--dl-primary: var(--primary, #0d0d0d);--dl-primary-fg: var(--primary-foreground, #fff);--dl-mono: var(--font-mono, ui-monospace, Menlo, Consolas, monospace);--dl-shadow: var(--shadow-sm, none);--dl-radius: 16px}.dl-root,.dl-modal{cursor:default}:is(.dl-root,.dl-modal) :is(input:not([type=checkbox],[type=radio],[type=range],[type=button],[type=submit]),textarea,[contenteditable=true]){cursor:text}.dl-icon-wrap{display:inline-flex;align-items:center;justify-content:center;line-height:0}.dl-icon{width:16px;height:16px}.dl-icon-btn{display:inline-flex!important;align-items:center;gap:6px}.dl-muted{color:var(--dl-fg-muted)}.dl-faint,.dl-sep{color:var(--dl-fg-faint)}.dl-nowrap{white-space:nowrap}.dl-mono{font-family:var(--dl-mono);font-size:13px}.dl-spacer{flex:1}.dl-pill{display:inline-flex;align-items:center;gap:4px;height:20px;padding:0 8px;border-radius:999px;font-size:12px;line-height:20px;font-weight:500;white-space:nowrap;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pill.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-pill.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-pill.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-pill.accent{background:var(--dl-info-wash);color:var(--dl-info)}.dl-pill.off{opacity:.75}.dl-panel{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:16px;margin:0 0 16px;min-width:0;box-shadow:var(--dl-shadow)}.dl-panel-head{display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin:0 0 12px}.dl-panel-head h3{margin:0!important;padding:0;font-size:16px;line-height:24px;font-weight:500;border:0;background:none}.dl-tiles{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px;margin:0 0 16px}.dl-tile{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:14px 16px;min-width:0;box-shadow:var(--dl-shadow)}.dl-tile-label{font-size:12px;line-height:16px;font-weight:500;color:var(--dl-fg-faint)}.dl-tile-value{font-size:24px;line-height:32px;font-weight:500;margin-top:4px;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;letter-spacing:-.01em}.dl-tile-sub{font-size:12px;line-height:16px;color:var(--dl-fg-muted);margin-top:2px;font-variant-numeric:tabular-nums}.dl-grid2{display:grid;grid-template-columns:minmax(0,1.45fr) minmax(0,1fr);gap:0 16px}@media(max-width:960px){.dl-grid2{grid-template-columns:minmax(0,1fr)}}.dl-chart{display:block;width:100%;height:120px}.dl-bar-down{fill:var(--dl-chart-1)}.dl-bar-up{fill:var(--dl-chart-2);opacity:.8}.dl-legend{display:flex;gap:16px;font-size:12px;color:var(--dl-fg-muted);margin-top:8px}.dl-legend i{display:inline-block;width:8px;height:8px;border-radius:999px;margin-right:6px;vertical-align:0}.dl-legend .down{background:var(--dl-chart-1)}.dl-legend .up{background:var(--dl-chart-2)}.dl-events{list-style:none;margin:0;padding:0}.dl-events li{display:flex;gap:12px;align-items:baseline;padding:8px 0;border-top:1px solid var(--dl-line);font-size:14px;line-height:20px;min-width:0}.dl-events li:first-child{border-top:0;padding-top:0}.dl-ev-time{flex:0 0 88px;color:var(--dl-fg-faint);font-variant-numeric:tabular-nums;white-space:nowrap;font-size:13px}.dl-ev-dot{flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);transform:translateY(-2px)}.dl-ev-dot.ok{background:var(--dl-ok)}.dl-ev-dot.warn{background:var(--dl-warn)}.dl-ev-dot.bad{background:var(--dl-bad)}.dl-ev-dot.accent{background:var(--dl-accent)}.dl-row>.dl-ev-dot,.dl-dev-log-row>.dl-ev-dot{margin:0 4px}.dl-ev-tile{flex:none;display:inline-flex;align-items:center;justify-content:center;width:22px;height:22px;margin:-2px -4px;border-radius:7px;background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent);align-self:center}.dl-ev-tile .dl-icon-wrap{display:inline-flex}.dl-ev-tile .dl-icon{width:14px;height:14px}.dl-row.dl-ev-by-admin{background:color-mix(in srgb,var(--dl-accent) 6%,transparent)}.dl-you{color:var(--dl-accent);font-weight:500}.dl-ev-kind{color:var(--dl-fg-faint)}.dl-slotbar{display:flex;align-items:center;gap:8px;margin:8px 0 0 44px}.dl-slotbar-segs{display:flex;gap:3px;flex:none;max-width:100%}.dl-slotbar-segs i{flex:1;min-width:2px;display:block;height:4px;border-radius:2px;background:var(--dl-soft-hover)}.dl-slotbar-segs i.used{background:var(--dl-fg-muted)}.dl-slotbar-text{font-size:12px;color:var(--dl-fg-faint);font-variant-numeric:tabular-nums}.dl-slotbar-segs i.over{background:color-mix(in srgb,var(--dl-warn) 80%,transparent)}.dl-ev-srv{flex:none;font-size:11px;line-height:18px;padding:0 8px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);white-space:nowrap}.dl-ev-by-system{--sys: var(--dl-fg-muted)}.dl-ev-by-system.ok{--sys: var(--dl-ok)}.dl-ev-by-system.warn{--sys: var(--dl-warn)}.dl-ev-by-system.bad{--sys: var(--dl-bad)}.dl-ev-tile.ev{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-ev-tile.ev.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-ev-tile.ev.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-ev-tile.ev.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-ev-tile.ev.accent{background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent)}.dl-ev-tile.sys{background:color-mix(in srgb,var(--sys) 16%,transparent);color:var(--sys)}.dl-row.dl-ev-by-system{background:color-mix(in srgb,var(--sys) 6%,transparent)}.dl-sys-src{color:var(--sys)}.dl-ev-by-system:not(.ok):not(.warn):not(.bad) .dl-sys-src{color:var(--dl-fg)}.dl-ev-text{min-width:0;overflow-wrap:anywhere}.dl-server{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px}.dl-server-name{font-size:16px;line-height:24px;font-weight:500}.dl-kv{display:grid;grid-template-columns:max-content minmax(0,1fr);gap:6px 24px;margin:12px 0 0;font-size:14px;line-height:20px}.dl-kv dt{color:var(--dl-fg-muted);font-weight:400;margin:0}.dl-kv dd{margin:0;overflow-wrap:anywhere;font-variant-numeric:tabular-nums}";var xa='.dl-plist{display:block}.dl-plist>.dl-card{display:block;margin:0 0 12px;padding:16px;min-width:0;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);box-shadow:var(--dl-shadow)}.dl-plist>.dl-card.dl-filtered{display:none}.dl-plist>.dl-card.dl-off :is(.dl-card-name,.dl-avatar,.dl-access,.dl-slotbar,.dl-chips,.dl-pill-ic,.dl-use-num,.dl-pside-foot,.dl-pside-state){opacity:.45}.dl-plist>.dl-card.dl-off .dl-usebar i{background:var(--dl-fg-faint)}.dl-plist>.dl-card.dl-off .dl-chip-tag{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pcard:has(>.dl-pstrip){row-gap:14px}.dl-pstrip{grid-column:1 / -1;display:flex;align-items:center;flex-wrap:wrap;gap:8px 12px;margin:0 -16px -16px;padding:10px 16px;border-top:1px solid var(--dl-line);border-radius:0 0 var(--dl-radius) var(--dl-radius);font-size:14px;line-height:20px}.dl-pstrip.warn{background:color-mix(in srgb,var(--dl-warn) 7%,transparent)}.dl-pstrip.bad{background:color-mix(in srgb,var(--dl-bad) 7%,transparent)}.dl-pstrip-text{flex:1;min-width:0;display:flex;flex-wrap:wrap;align-items:baseline;gap:0 8px}.dl-pstrip-text b{font-weight:500}.dl-pstrip>.cbi-button{flex:none;height:32px!important}.dl-plist-none{color:var(--dl-fg-muted);text-align:center;padding:28px 16px;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius)}.dl-card-head{display:flex;align-items:center;flex-wrap:wrap;gap:6px 8px}.dl-avatar{flex:0 0 auto;width:32px;height:32px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:12px;font-weight:600;color:var(--dl-fg);background:var(--dl-soft);position:relative;margin-right:4px;letter-spacing:.02em}.dl-avatar.online:after{content:"";position:absolute;right:-1px;bottom:-1px;width:9px;height:9px;border-radius:50%;background:var(--dl-ok);box-shadow:0 0 0 2px var(--dl-card)}.dl-card-name{font-size:16px;line-height:24px;font-weight:500}.dl-card-slug{font-size:13px;color:var(--dl-fg-faint);font-family:var(--dl-mono)}.dl-quota{margin:8px 0 0 44px;max-width:320px;height:6px;border-radius:999px;background:var(--dl-track);overflow:hidden}.dl-quota>i{display:block;height:100%;background:var(--dl-accent);border-radius:999px}.dl-quota.warn>i{background:var(--dl-warn)}.dl-quota.bad>i{background:var(--dl-bad)}.dl-chips{display:flex;flex-wrap:wrap;gap:6px;margin:12px 0 0 44px}.dl-chip{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:6px;max-width:240px;height:28px;padding:0 12px 0 10px;border-radius:999px;font-size:13px;background:var(--dl-soft);color:var(--dl-fg);transition:background .15s}.dl-chip:hover{background:var(--dl-soft-hover)}.dl-chip:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-chip .dl-icon{width:14px;height:14px;color:var(--dl-fg-muted)}.dl-chip.add{background:transparent;border:1px dashed color-mix(in srgb,var(--dl-fg) 28%,transparent);color:var(--dl-fg-muted)}.dl-chip.add:hover{background:var(--dl-soft);color:var(--dl-fg);border-color:color-mix(in srgb,var(--dl-fg) 45%,transparent)}.dl-chip.add:hover .dl-icon{color:var(--dl-fg)}.dl-chip.disabled .dl-chip-name{text-decoration:line-through;color:var(--dl-fg-faint)}.dl-chip-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-dot{flex:0 0 auto;width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);opacity:.6}.dl-dot.online{background:var(--dl-ok);opacity:1;box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-empty{text-align:center;padding:40px 16px;background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius)}.dl-empty .dl-icon-wrap{width:40px;height:40px;border-radius:12px;background:var(--dl-soft);margin-bottom:12px}.dl-empty .dl-icon{width:20px;height:20px}.dl-empty h3{margin:0 0 4px!important;font-size:16px;font-weight:500}.dl-empty p{margin:0 0 16px;color:var(--dl-fg-muted);font-size:14px}.dl-toolbar{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin:0 0 16px}.dl-toolbar .dl-muted{font-size:13px}@media(max-width:640px){.dl-slotbar,.dl-chips,.dl-quota{margin-left:0}.dl-btn-label{display:none}}.cbi-value.dl-block{display:block!important}.cbi-value.dl-block>.cbi-value-title{display:block;width:auto;float:none;text-align:left;padding:0 0 8px}.cbi-value.dl-block>.cbi-value-field{display:block;width:100%;margin:0}.dl-people-find{width:160px;min-width:0}.dl-people-find[hidden]{display:none}';var wa="#modal_overlay{z-index:1100!important}.dl-dd{position:fixed;z-index:1200;min-width:200px;padding:4px;border-radius:12px;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:0 12px 32px #0000004d;display:flex;flex-direction:column}.dl-dd button{all:unset;cursor:pointer;display:flex;align-items:center;gap:10px;padding:7px 10px;border-radius:8px;font-size:13px;color:var(--dl-fg)}.dl-dd button .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted)}.dl-dd button:hover,.dl-dd button:focus-visible{background:var(--dl-soft)}.dl-dd button.danger,.dl-dd button.danger .dl-icon{color:var(--dl-bad, #e5484d)}.dl-dd button.warn,.dl-dd button.warn .dl-icon{color:var(--dl-warn)}.dl-dd hr{border:0;border-top:1px solid var(--dl-line);margin:4px 0}.dl-chipbtn b{font-weight:500;font-size:11px;margin-left:6px;opacity:.6}.dl-setsub{margin:20px 0 8px!important;font-size:13px;font-weight:500;color:var(--dl-fg)}.dl-row-actions{display:flex;flex-wrap:wrap;gap:8px;align-items:center}.dl-more-row{display:flex;justify-content:center;padding:8px 0 16px}.dl-dsec-actions{display:flex;align-items:center;gap:12px}.dl-kv-act{display:inline-flex;align-items:center;gap:12px;flex-wrap:wrap}.dl-linkbtn,.dl-bento-head a,.dl-bento-foot a,.dl-panel-head a,.dl-dsec-head a,.dl-tile2-foot a{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:4px;height:26px;padding:0 9px;margin:-4px -6px;border-radius:8px;font-size:12px;font-weight:500;color:var(--dl-fg-muted);text-decoration:none!important;white-space:nowrap;transition:background .12s,color .12s}.dl-bento-head a,.dl-bento-foot a,.dl-panel-head a,.dl-dsec-head a,.dl-tile2-foot a{color:var(--dl-accent)}.dl-linkbtn:hover,.dl-bento-head a:hover,.dl-bento-foot a:hover,.dl-panel-head a:hover,.dl-dsec-head a:hover,.dl-tile2-foot a:hover{background:var(--dl-soft);color:var(--dl-fg);text-decoration:none!important}.dl-bento-head a:hover,.dl-bento-foot a:hover,.dl-panel-head a:hover,.dl-dsec-head a:hover,.dl-tile2-foot a:hover{background:color-mix(in srgb,var(--dl-accent) 12%,transparent);color:var(--dl-accent)}.dl-linkbtn:focus-visible,.dl-bento-head a:focus-visible,.dl-bento-foot a:focus-visible,.dl-panel-head a:focus-visible{outline:2px solid var(--dl-ring);outline-offset:1px}.dl-linkbtn.danger:hover{color:var(--dl-bad);background:var(--dl-bad-wash)}.dl-ifcards{display:flex;flex-direction:column;gap:20px;margin:24px 0}.dl-ifcard .dl-setsec-body{gap:14px}.dl-iflead{display:flex;flex-direction:column;gap:2px;padding-top:14px;border-top:1px solid var(--dl-line)}.dl-iflead b{font-size:14px;font-weight:500}.dl-ifgroup h4{margin:0 0 8px!important;padding:0!important;font-size:11px!important;font-weight:500!important;letter-spacing:.06em;text-transform:uppercase;color:var(--dl-fg-muted);border:0!important;background:none!important}.dl-ifgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(210px,1fr));gap:8px}.dl-if{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:10px;min-height:52px;padding:8px 12px 8px 10px;min-width:0;border:1px solid var(--dl-line);border-radius:10px;background:var(--dl-card);transition:background .15s,border-color .15s}.dl-if:hover{background:var(--dl-soft)}.dl-if:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-if-ic{width:30px;height:30px;border-radius:8px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-if-ic .dl-icon{width:16px;height:16px}.dl-if-main{display:flex;flex-direction:column;min-width:0;flex:1}.dl-if-name{font-size:13.5px;font-weight:500;color:var(--dl-fg);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-if-sub{font:11px/16px var(--dl-mono);color:var(--dl-fg-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-if.sel{border-color:var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 9%,transparent)}.dl-if.sel .dl-if-ic{background:color-mix(in srgb,var(--dl-accent) 18%,transparent);color:var(--dl-accent)}.dl-if-check{color:var(--dl-accent);display:inline-flex}.dl-if-check .dl-icon{width:16px;height:16px}.dl-if.auto{border-color:color-mix(in srgb,var(--dl-ok) 55%,transparent);background:var(--dl-ok-wash);cursor:default}.dl-if.auto .dl-if-ic{background:color-mix(in srgb,var(--dl-ok) 18%,transparent);color:var(--dl-ok)}.dl-if-badge{display:inline-flex;align-items:center;gap:5px;font-size:10.5px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;flex:0 0 auto}.dl-if-badge.ok{color:var(--dl-ok)}.dl-if.off{cursor:default;opacity:.5}.dl-if.off:hover{background:var(--dl-card)}.dl-if.warn{border-color:color-mix(in srgb,var(--dl-warn) 60%,transparent)}.dl-if-wanctl{gap:10px;align-items:center}.dl-if-wanctl select{max-width:240px}.dl-if-summary{min-width:0;line-height:18px}.dl-warn{color:var(--dl-warn)}.dl-w-ip{width:160px}.dl-dnspick{padding-top:8px;border-top:1px solid var(--dl-line)}.dl-dnspick .dl-row-actions{gap:10px}.dl-note{display:flex;gap:8px;align-items:flex-start;padding:10px 12px;border-radius:10px;font-size:12.5px;line-height:18px;margin:0 0 10px;background:var(--dl-soft)}.dl-note.warn{background:var(--dl-warn-wash, color-mix(in srgb, var(--dl-warn) 14%, transparent))}.dl-note .dl-icon{width:15px;height:15px;flex:0 0 auto;margin-top:1px;color:var(--dl-warn)}.dl-stale{align-self:flex-start;margin-top:4px;font-size:10.5px}.dl-root .cbi-button.dl-btn-warn,.dl-btn-warn.cbi-button{background:var(--dl-warn-wash)!important;color:var(--dl-warn)!important;border-color:color-mix(in srgb,var(--dl-warn) 35%,transparent)!important}.dl-root .cbi-button.dl-btn-warn:hover,.dl-btn-warn.cbi-button:hover{background:color-mix(in srgb,var(--dl-warn) 24%,transparent)!important}.dl-btn-warn .dl-icon{color:var(--dl-warn)}.dl-srvtabs{display:flex;flex-wrap:wrap;gap:6px;padding:4px;margin:0 0 20px;border-radius:12px;background:var(--dl-soft);width:fit-content;max-width:100%}.dl-srvtab{all:unset;box-sizing:border-box;cursor:pointer;display:inline-flex;align-items:center;gap:8px;height:34px;padding:0 14px;border-radius:9px;font-size:13px;color:var(--dl-fg-muted);text-decoration:none!important;white-space:nowrap}.dl-srvtab b{font-weight:500}.dl-srvtab i.dot{width:7px;height:7px;border-radius:50%;background:var(--dl-fg-faint);flex:0 0 auto}.dl-srvtab i.dot.ok{background:var(--dl-ok);animation:dl-srv-pulse 2s ease-out infinite}.dl-srvtab i.dot.bad{background:var(--dl-bad)}.dl-srvtab i.dot.warn{background:var(--dl-warn)}@keyframes dl-srv-pulse{0%{box-shadow:0 0 color-mix(in srgb,var(--dl-ok) 55%,transparent)}70%,to{box-shadow:0 0 0 6px transparent}}@media(prefers-reduced-motion:reduce){.dl-srvtab i.dot.ok{animation:none}}.dl-srvtab:hover{color:var(--dl-fg);background:var(--dl-soft-hover)}.dl-srvtab.on{background:var(--dl-card);color:var(--dl-fg);box-shadow:0 1px 2px #0000002e,inset 0 0 0 1px var(--dl-line)}.dl-srvtab:focus-visible{outline:2px solid var(--dl-ring);outline-offset:1px}.dl-srvtab.add{color:var(--dl-fg-muted)}.dl-srvtab.add .dl-icon{width:14px;height:14px}.dl-srvhead{display:flex;flex-direction:column;gap:14px;margin:0 0 20px}.dl-srvhead .dl-title-row{display:flex;align-items:center;gap:10px}.dl-srvhead .dl-h1{margin:0!important}.dl-metrics.compact .dl-metric{padding:14px 18px}.dl-metrics.compact .dl-metric-value{display:flex;align-items:center;gap:6px;font-size:18px;line-height:26px;min-width:0}.dl-metrics.compact .dl-metric-value>span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.dl-metrics.compact .dl-metric-value .dl-mono{font-size:15px}.dl-metrics.compact .cbi-button{flex:0 0 auto}.dl-srvsections{margin:0 0 16px}.dl-srvbody>.dl-setsec,.dl-srvbody>.dl-ifcards{margin:0}.dl-srvbody .dl-ifcards{margin:0}.dl-metric-ic{display:inline-flex;align-items:center;gap:8px;font-size:16px}.dl-metric-ic .dl-icon{width:18px;height:18px;color:var(--dl-accent)}.dl-keyrow{display:inline-flex;align-items:center;gap:8px;min-width:0}.dl-keyrow code{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:12px;background:none;padding:0}.dl-params{border:1px solid var(--dl-line);border-radius:12px;background:var(--dl-card)}.dl-params>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;padding:10px 14px;font-size:13px;color:var(--dl-fg);user-select:none}.dl-params>summary::-webkit-details-marker{display:none}.dl-params>summary>.dl-icon-wrap{display:inline-flex;color:var(--dl-fg-muted);transition:transform .15s}.dl-params>summary>.dl-icon-wrap .dl-icon{width:15px;height:15px}.dl-params[open]>summary>.dl-icon-wrap{transform:rotate(90deg)}.dl-params>summary:focus{outline:none}.dl-params>summary:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px;border-radius:12px}.dl-params>summary:hover{background:var(--dl-soft);border-radius:12px}.dl-pcount{font-size:11px;padding:0 6px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:10px;padding:4px 14px 14px}.dl-pgroup{display:flex;flex-direction:column;gap:6px;padding:12px;border-radius:10px;background:var(--dl-soft);min-width:0}.dl-pgroup-head{display:flex;align-items:center;gap:8px;font-size:13px}.dl-pgroup-head b{font-weight:500}.dl-pgroup-head .dl-icon{width:14px;height:14px;color:var(--dl-fg-muted)}.dl-pgroup p{margin:0!important;font-size:12px;line-height:17px;color:var(--dl-fg-muted)}.dl-pvals{display:flex;flex-wrap:wrap;gap:4px;margin-top:2px}.dl-pv{display:inline-flex;align-items:stretch;max-width:100%;border-radius:6px;overflow:hidden;font:500 11.5px/22px var(--dl-mono);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-pv i{font-style:normal;padding:0 6px;background:var(--dl-card);color:var(--dl-fg-faint)}.dl-pv b{font-weight:500;padding:0 7px;color:var(--dl-fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}";var ya=".dl-methods{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:10px}.dl-method{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;gap:10px;padding:14px;border-radius:12px;border:1px solid var(--dl-line);background:var(--dl-card);transition:border-color .15s,background .15s;min-width:0}.dl-method:hover{background:var(--dl-soft)}.dl-method:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-method.on{border-color:var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 8%,transparent);box-shadow:inset 0 0 0 1px var(--dl-accent)}.dl-method.off{cursor:not-allowed;opacity:.55}.dl-method.off:hover{background:var(--dl-card)}.dl-method-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px 10px}.dl-method-head .dl-pill{flex:none}.dl-method-head b{font-weight:500;font-size:14.5px;flex:1}.dl-method-ic{width:32px;height:32px;border-radius:9px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;color:var(--dl-fg-muted);flex:0 0 auto}.dl-method-ic .dl-icon{width:17px;height:17px}.dl-method.on .dl-method-ic{background:color-mix(in srgb,var(--dl-accent) 18%,transparent);color:var(--dl-accent)}.dl-method p{margin:0!important;font-size:12.5px;line-height:18px;color:var(--dl-fg-muted);flex:1}.dl-method-meters{display:flex;gap:16px}.dl-dots{display:inline-flex;align-items:center;gap:6px;font-size:11px;color:var(--dl-fg-faint)}.dl-dots-row{display:inline-flex;gap:3px}.dl-dots-row i{width:6px;height:6px;border-radius:50%;background:var(--dl-line)}.dl-dots-row i.on{background:var(--dl-fg-muted)}.dl-method.on .dl-dots-row i.on{background:var(--dl-accent)}.dl-method-foot{display:flex;align-items:center;gap:6px;font-size:11.5px;color:var(--dl-fg-faint);padding-top:8px;border-top:1px solid var(--dl-line)}.dl-method-foot .dl-icon{width:13px;height:13px;flex:0 0 auto}.dl-method.off .dl-method-foot{color:var(--dl-warn)}.dl-ibadge{display:inline-flex;align-items:center;gap:3px;height:22px;padding:0 6px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);flex:0 0 auto}.dl-ibadge .dl-icon{width:13px;height:13px}.dl-ibadge.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-ibadge.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-access{display:inline-flex;gap:4px;flex:0 0 auto}.dl-ibadge.lan{background:color-mix(in srgb,var(--dl-accent) 16%,transparent);color:var(--dl-accent)}.dl-ibadge.inet{background:var(--dl-ok-wash);color:var(--dl-ok)}";var ka=".dl-addrbar{display:inline-flex;align-items:stretch;flex-wrap:nowrap;max-width:100%;margin-top:4px;border:1px solid var(--dl-line);border-radius:10px;background:var(--dl-card);overflow:hidden}.dl-addrbar-seg{all:unset;box-sizing:border-box;display:inline-flex;align-items:center;gap:7px;padding:6px 12px;font-size:13px;color:var(--dl-fg-muted);border-left:1px solid var(--dl-line);white-space:nowrap;min-width:0}.dl-addrbar-seg:first-child{border-left:0}.dl-addrbar-seg .dl-icon{width:14px;height:14px;color:var(--dl-fg-faint);flex:0 0 auto}.dl-addrbar-seg .dl-mono{font-size:12.5px}.dl-addrbar-seg.main{cursor:pointer;color:var(--dl-fg)}.dl-addrbar-seg.main:hover{background:var(--dl-soft)}.dl-addrbar-seg.main:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px}.dl-addrbar-seg.main>.dl-icon-wrap:last-child .dl-icon{opacity:.7}.dl-bento{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));grid-template-rows:auto auto;gap:10px;margin:0 0 20px}.dl-person-devices{margin-bottom:16px}.dl-person-head{display:flex;flex-direction:column;margin:0 0 20px}.dl-person-head>.dl-pagehead{margin-bottom:0;align-items:flex-start}.dl-pnote{all:unset;box-sizing:border-box;cursor:pointer;align-self:flex-start;display:inline-flex;align-items:flex-start;gap:6px;margin:10px 0 0 62px;max-width:60ch;padding:6px 12px 6px 10px;border-radius:10px;font-size:13px;line-height:18px;white-space:pre-line;background:var(--dl-soft);color:var(--dl-fg);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-pnote:hover{background:var(--dl-soft-hover)}.dl-pnote .dl-icon{width:14px;height:14px;flex:none;margin-top:2px;color:var(--dl-fg-muted)}.dl-note-input{width:100%;box-sizing:border-box;min-height:80px;resize:vertical}.dl-dcard-trend{display:flex;align-items:flex-end;gap:12px;min-width:0}.dl-dcard-trend>.dl-stack{flex:none}.dl-dcard-trend b{font-size:16px;font-weight:500;font-variant-numeric:tabular-nums}.dl-dbars{flex:1;min-width:0;height:32px;display:flex;align-items:flex-end;--dl-gap: 2px}.dl-dbars i{flex:1;min-width:0;border-radius:2px;background:var(--dl-chart-1);opacity:.55}.dl-dbars i.zero{background:var(--dl-track);opacity:1}.dl-dbars i.hi{opacity:1}.dl-dbars>span:hover i{opacity:1;filter:brightness(1.2)}.dl-datechip{position:relative;display:inline-flex}.dl-date-hidden{position:absolute!important;left:0;bottom:0;width:1px!important;min-width:0!important;height:1px!important;opacity:0;pointer-events:none;border:0!important;padding:0!important;margin:0!important}.dl-chipbtn .dl-icon{width:13px;height:13px}.dl-chipbtn:has(.dl-icon){display:inline-flex;align-items:center;gap:5px}.dl-places{display:flex;align-items:center;gap:12px;padding:12px 16px;border:1px solid var(--dl-line);border-radius:var(--dl-radius);background:var(--dl-card);font-size:14px}.dl-places>.dl-icon{width:18px;height:18px;color:var(--dl-fg-muted);flex:none}.dl-person-live{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}.dl-person-live .dl-bento-head{flex-wrap:nowrap;white-space:nowrap;min-width:0}.dl-person-live .dl-bento-head>*{min-width:0;overflow:hidden;text-overflow:ellipsis}.dl-person-live .dl-bento-head>:first-child{flex:none}.dl-person-live.solo{grid-template-columns:minmax(0,1fr)}.dl-person-live:not(.solo) .dl-bento-tile.month>.dl-bento-head:first-child{flex-wrap:wrap;row-gap:2px}.dl-person-live:not(.solo) .dl-bento-tile.month>.dl-bento-head:first-child>.dl-sub{flex-basis:100%}.dl-person-live>.dl-bento-tile,.dl-person-live>.dl-bento-tile.month{grid-column:auto;grid-row:auto}@media(max-width:760px){.dl-person-live{grid-template-columns:minmax(0,1fr)}}.dl-bento-tile{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);padding:14px 16px;display:flex;flex-direction:column;gap:10px;min-width:0;box-shadow:var(--dl-shadow)}.dl-bento-tile.month{grid-column:1 / -1}.dl-onl-count{font-size:13px;line-height:22px;min-width:22px;padding:0 8px;border-radius:999px;background:var(--dl-soft);text-align:center;font-weight:500;font-variant-numeric:tabular-nums}.dl-onl-count.none{color:var(--dl-fg-faint)}.dl-onl-row{flex:1;display:flex;align-items:center;justify-content:center;gap:12px;min-width:0}.dl-onl-p{display:flex;flex-direction:column;align-items:center;gap:5px;width:104px;min-width:0;padding:6px 2px;border-radius:12px;color:var(--dl-fg)!important;text-decoration:none!important}.dl-onl-p:hover{background:var(--dl-soft)}.dl-onl-av{position:relative;width:42px;height:42px;border-radius:50%;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;font-size:13px;font-weight:500;box-shadow:0 0 0 2px var(--dl-ok)}.dl-onl-p.more .dl-onl-av{box-shadow:0 0 0 1px var(--dl-line);color:var(--dl-fg-muted)}.dl-onl-dev{position:absolute;right:-6.5px;bottom:-6.5px;width:20px;height:20px;border-radius:8.5px;border:1.5px solid transparent;background:var(--dl-card);display:inline-flex;align-items:center;justify-content:center;font-size:10px;color:var(--dl-fg-muted)}.dl-onl-dev .dl-icon-wrap{display:inline-flex}.dl-onl-dev .dl-icon{width:12px;height:12px}.dl-onl-name{font-size:12.5px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-onl-p .dl-sub{font-size:11px;max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-onl-row.grid{flex-wrap:wrap;align-content:center;gap:10px 8px;max-height:108px;overflow:hidden}.dl-onl-p.sm{width:auto;padding:4px}.dl-onl-p:hover .dl-onl-dev{background:linear-gradient(var(--dl-soft),var(--dl-soft)),var(--dl-card)}.dl-onl-p.sm:hover{background:none}.dl-onl-p.sm:hover .dl-onl-dev{background:var(--dl-card)}.dl-onl-p.sm .dl-onl-av{transition:box-shadow .15s ease}.dl-onl-p.sm:hover .dl-onl-av{box-shadow:0 0 0 2px var(--dl-ok),0 0 0 6px var(--dl-soft)}.dl-onl-p.sm.more:hover .dl-onl-av{box-shadow:0 0 0 1px var(--dl-line),0 0 0 6px var(--dl-soft)}.dl-onl-p.sm .dl-onl-av{width:36px;height:36px;font-size:11.5px}.dl-onl-meta{display:inline-flex;align-items:center;gap:3px;font-size:11px;color:var(--dl-fg-faint);max-width:100%;white-space:nowrap;overflow:hidden}.dl-onl-meta .dl-icon-wrap{display:inline-flex}.dl-onl-meta .dl-icon{width:12px;height:12px}.dl-onl-av.sm{width:34px;height:34px;font-size:11.5px}.dl-tip-float:has(.dl-hc){padding:0;white-space:normal;border-radius:16px}.dl-hc{width:280px;padding:14px;display:flex;flex-direction:column;gap:10px}.dl-hc-head{display:flex;align-items:center;gap:10px}.dl-hc-head .dl-stack{flex:1;min-width:0}.dl-hc-head b{font-size:14px;font-weight:500}.dl-hc-since{font-size:11.5px;color:var(--dl-ok)}.dl-hc-reach{display:inline-flex;gap:4px}.dl-hc-speed{border-radius:12px;background:var(--dl-soft);padding:10px 12px;display:flex;flex-direction:column;gap:6px}.dl-hc-speed-row{display:flex;align-items:baseline;gap:12px;font-size:13px;font-variant-numeric:tabular-nums}.dl-hc-chart{display:block;width:100%;height:30px}.dl-hc-chart .area{fill:color-mix(in srgb,var(--dl-chart-1) 16%,transparent)}.dl-hc-chart .dn{fill:none;stroke:var(--dl-chart-1);stroke-width:1.5;vector-effect:non-scaling-stroke}.dl-hc-chart .up{fill:none;stroke:var(--dl-ok);stroke-width:1.2;vector-effect:non-scaling-stroke}.dl-hc-devs{display:flex;flex-wrap:wrap;gap:6px}.dl-hc-dev{display:inline-flex;align-items:center;gap:5px;height:24px;padding:0 9px;border-radius:999px;background:var(--dl-soft);font-size:11.5px}.dl-hc-dev .dl-icon-wrap{display:inline-flex}.dl-hc-dev .dl-icon{width:12px;height:12px;color:var(--dl-fg-muted)}.dl-hc-foot{display:flex;align-items:center;gap:8px;font-size:11.5px}.dl-disg-id{display:flex;align-items:center;gap:10px}.dl-disg-id b{font-size:16px;font-weight:500}.dl-disg-ic{width:36px;height:36px;border-radius:11px;background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-disg-ic .dl-icon-wrap{display:inline-flex}.dl-disg-ic .dl-icon{width:18px;height:18px}.dl-disg-ic.off{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-disg-meters{display:grid;grid-template-columns:auto 1fr;gap:6px 10px;align-items:center;font-size:12px;color:var(--dl-fg-muted)}.dl-segs{display:inline-flex;gap:3px}.dl-segs i{width:18px;height:5px;border-radius:3px;background:var(--dl-track)}.dl-segs.acc i.on{background:var(--dl-accent)}.dl-segs.ok i.on{background:var(--dl-ok)}.dl-disg-chips{margin-top:auto;display:flex;flex-wrap:wrap;gap:5px}.dl-disg-chips span{font:11px/20px var(--dl-mono);padding:0 8px;border-radius:999px;background:var(--dl-soft);color:var(--dl-fg-muted);white-space:nowrap}.dl-onl-empty{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:4px;font-size:13px;text-align:center}.dl-bento-head{display:flex;align-items:center;justify-content:space-between;gap:10px;min-width:0}.dl-bento-head.start{justify-content:flex-start}.dl-bento-big{font-family:inherit;font-size:28px;line-height:34px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-bento-big small{font-size:13px;font-weight:400;color:var(--dl-fg-faint);letter-spacing:0}.dl-avstack{display:inline-flex}.dl-avstack .dl-avatar{margin-left:-7px;box-shadow:0 0 0 2px var(--dl-card)}.dl-avstack .dl-avatar:first-child{margin-left:0}.dl-avatar.more{background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-bento-list{display:flex;flex-direction:column;gap:2px}.dl-bento-row{display:flex;align-items:center;gap:10px;padding:8px;margin:0 -8px;border-radius:10px;color:var(--dl-fg)!important;text-decoration:none!important;min-width:0;transition:background .12s}.dl-bento-row:hover{background:var(--dl-soft)}.dl-bento-row:hover b{text-decoration:none}.dl-bento-row:focus-visible{outline:2px solid var(--dl-ring);outline-offset:-2px}.dl-bento-row-main{display:flex;flex-direction:column;gap:1px;flex:1;min-width:0}.dl-bento-row-main b{font-weight:500;font-size:13.5px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-bento-row-main .dl-sub{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-bento-row.off b{color:var(--dl-fg-muted);font-weight:400}.dl-bento-row-val{display:flex;flex-direction:column;align-items:flex-end;font-size:13px;font-variant-numeric:tabular-nums;white-space:nowrap}.dl-bento-row-val small{font-size:11px;color:var(--dl-fg-faint)}.dl-bento-sep{font-size:11px;color:var(--dl-fg-faint);padding:12px 0 4px}.dl-bento-devs{display:inline-flex;gap:3px;color:var(--dl-fg-faint)}.dl-bento-devs .dl-icon{width:13px;height:13px}.dl-bento-devs .on{color:var(--dl-ok)}.dl-bento-foot{display:flex;align-items:center;gap:10px;margin-top:auto;padding-top:10px;border-top:1px solid var(--dl-line);color:var(--dl-fg)!important;text-decoration:none!important}.dl-bento-foot.split,.dl-bento-foot.end{justify-content:space-between}.dl-bento-foot.end>a:only-child{margin-left:auto}.dl-bento-empty{display:flex;align-items:center;gap:10px;padding:14px 0;font-size:13.5px;color:var(--dl-fg-muted)}.dl-bento-empty .dl-icon{width:18px;height:18px}.dl-split{display:flex;height:6px;border-radius:3px;overflow:hidden;background:var(--dl-soft)}.dl-split i{display:block;height:100%}.dl-split i.dn{background:var(--dl-accent)}.dl-split i.up{background:var(--dl-ok)}.dl-dn{color:var(--dl-accent)}.dl-up{color:var(--dl-ok)}.dl-bento-method{display:flex;align-items:center;gap:8px;font-size:18px;font-weight:500}.dl-bento-method .dl-icon{width:20px;height:20px;color:var(--dl-accent)}.dl-meter{display:inline-flex;gap:3px}.dl-meter i{width:16px;height:4px;border-radius:2px;background:var(--dl-line)}.dl-meter i.on{background:var(--dl-accent)}.dl-bento-total{font-size:16px;font-weight:500;margin-left:8px}.dl-bento-bars{display:flex;align-items:flex-end;height:54px;--dl-gap: 3px}.dl-bento-bars i{flex:1;min-width:0;border-radius:3px 3px 0 0;background:var(--dl-soft-hover);transition:background .15s}.dl-bento-bars i.future{height:4px;background:var(--dl-soft)}.dl-bento-bars>span:hover i:not(.hi){background:var(--dl-fg-faint)}.dl-bento-bars i.hi{background:var(--dl-accent)}@media(max-width:700px){.dl-addrbar{flex-wrap:wrap}}@media(max-width:900px){.dl-bento{grid-template-columns:minmax(0,1fr) minmax(0,1fr)}.dl-bento-tile.online{grid-column:span 2}}@media(max-width:560px){.dl-bento{grid-template-columns:minmax(0,1fr)}.dl-bento-tile.online,.dl-bento-tile.month{grid-column:auto}}.dl-srvpagehead{display:flex;flex-direction:column;align-items:flex-start;gap:10px;margin:0 0 20px}.dl-srvpagehead>.dl-title-row{display:flex;align-items:center;gap:10px;width:100%;flex-wrap:wrap}.dl-srvpagehead .dl-actions{margin:0;flex-wrap:wrap}.dl-toolbar-end{display:flex;align-items:center;gap:8px;margin-left:auto;flex-wrap:nowrap;min-width:0}@media(max-width:640px){.dl-toolbar-end{flex-wrap:wrap;width:100%}}.dl-notices{margin:0 0 16px}.dl-notices .dl-need-row .dl-sub{overflow-wrap:anywhere}.dl-notices-more{font-size:13px;color:var(--dl-fg-muted);text-decoration:none}.dl-notices-more:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-speed-cols{display:grid;grid-template-columns:1fr 1fr;gap:12px}.dl-speed-col{display:flex;flex-direction:column;gap:2px;min-width:0}.dl-speed-val{font-size:20px;line-height:26px;font-weight:500;font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-speed-today{display:flex;justify-content:space-between;gap:10px;font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;font-variant-numeric:tabular-nums}.dl-speed-today b{font-weight:500;color:var(--dl-fg)}.dl-speed-chart{display:block;width:100%;height:44px}.dl-speed-chart .area{fill:color-mix(in srgb,var(--dl-accent) 16%,transparent)}.dl-speed-chart .line{fill:none;stroke:var(--dl-accent);stroke-width:1.5;vector-effect:non-scaling-stroke}.dl-speed-chart .line.up{stroke:var(--dl-ok);stroke-width:1.2;opacity:.85}.dl-speed-wait{height:44px;display:flex;flex-direction:column;justify-content:flex-end;gap:6px;font-size:11px;color:var(--dl-fg-faint)}.dl-speed-wait i{display:block;height:1px;background:var(--dl-line);order:2}.dl-speed-val.off{color:var(--dl-fg-faint)}.dl-fld{display:flex;flex-direction:column;gap:8px;margin:0 0 16px}.dl-fld-label{font-size:13px;font-weight:500;color:var(--dl-fg)}.dl-fld .cbi-input-text{width:100%;box-sizing:border-box}.dl-kinds{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px}.dl-kinds button{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:6px;height:68px;border-radius:10px;border:1px solid var(--dl-line);color:var(--dl-fg-muted);font-size:12px;font-weight:500;text-align:center;min-width:0}.dl-kinds button .dl-icon{width:20px;height:20px}.dl-kinds button:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-kinds button:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-kinds button.on{border-color:var(--dl-accent);color:var(--dl-fg);background:color-mix(in srgb,var(--dl-accent) 10%,transparent);box-shadow:inset 0 0 0 1px var(--dl-accent)}.dl-kinds button.on .dl-icon{color:var(--dl-accent)}.dl-choices{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:8px}.dl-choice{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;gap:4px;padding:12px 14px;border-radius:12px;background:var(--dl-card);box-shadow:inset 0 0 0 1px var(--dl-line);transition:background .15s,box-shadow .15s}.dl-choice:hover{background:var(--dl-soft)}.dl-choice:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-choice.selected{box-shadow:inset 0 0 0 2px var(--dl-accent);background:var(--accent-a10, color-mix(in srgb, var(--dl-accent) 8%, transparent))}.dl-choice-title{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:var(--dl-fg)}.dl-choice-text{font-size:12px;line-height:16px;color:var(--dl-fg-muted)}.dl-attn-item>.cbi-button{margin-left:auto;flex:none;align-self:center}";var _a='.dl-steps{display:flex;align-items:center;gap:8px;margin:0 0 16px;flex-wrap:wrap}.dl-step{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:var(--dl-fg-faint)}.dl-step b{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:50%;background:var(--dl-soft);font-size:12px;font-weight:600}.dl-step.current{color:var(--dl-fg)}.dl-step.current b{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-step.done{color:var(--dl-fg-muted)}.dl-step.done b{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-step+.dl-step:before{content:"";width:24px;height:1px;background:var(--dl-line)}.dl-wizard .dl-panel>div{display:flex;flex-direction:column;gap:16px}.dl-wizard .dl-panel>div>p{margin:0!important;color:var(--dl-fg-muted)}.dl-wizard .dl-panel>div>.cbi-value{margin:0}.dl-wizard h4{font-size:14px;font-weight:500;margin:8px 0 -6px!important}.dl-wizard h4:first-child{margin-top:0!important}.dl-modal .cbi-tabmenu{margin-bottom:16px}.dl-modal .cbi-value.dl-live>.cbi-value-title{display:flex;flex-direction:column;gap:2px;text-align:left}.dl-modal .cbi-value.dl-live>.cbi-value-title>.dl-sub{white-space:normal}.dl-checklist{display:flex;flex-direction:column;gap:6px;margin:4px 0 8px}.dl-checklist label{display:flex;align-items:center;gap:8px;font-size:14px;cursor:pointer}.dl-checklist input{margin:0}.dl-invite{display:grid;grid-template-columns:250px minmax(0,1fr);gap:22px;align-items:start}.dl-invite img{display:block;width:100%;border-radius:18px;box-shadow:0 0 0 1px var(--dl-line)}.dl-invite-side{display:flex;flex-direction:column;gap:14px;min-width:0}.dl-invite-side>p{margin:0!important}.dl-invite-link{all:unset;box-sizing:border-box;cursor:pointer;display:flex;align-items:center;gap:10px;min-width:0;padding:11px 14px;border-radius:12px;background:var(--dl-soft);font:13px/18px var(--dl-mono);color:var(--dl-fg)}.dl-invite-link>span:first-child{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-invite-link>.dl-icon-wrap{flex:none;display:inline-flex}.dl-invite-link .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted);flex:none}.dl-invite-link:hover{background:var(--dl-soft-hover)}.dl-invite-link.alt{padding:8px 14px;font-size:12px;color:var(--dl-fg-muted)}.dl-invite-link>.dl-pill{flex:none}.dl-invite-steps{margin:0;padding-left:20px;list-style:decimal!important;font-size:13px;line-height:24px;color:var(--dl-fg-muted)}.dl-invite-steps b{color:var(--dl-fg);font-weight:500}.dl-invite-steps li{display:list-item!important;list-style:inherit!important;padding-left:4px}.dl-invite-actions{display:flex;gap:8px;flex-wrap:wrap}.modal:has(.dl-modal.wide){max-width:min(760px,94vw)!important;width:100%!important}@media(max-width:640px){.dl-invite{grid-template-columns:minmax(0,1fr)}.dl-invite img{max-width:260px;margin:0 auto}}.dl-toasts{position:fixed;left:50%;bottom:max(24px,env(safe-area-inset-bottom));transform:translate(-50%);z-index:100000;display:flex;flex-direction:column;align-items:center;gap:8px;pointer-events:none}.dl-toast{pointer-events:auto;display:inline-flex;align-items:center;gap:8px;max-width:min(520px,92vw);padding:10px 16px;border-radius:999px;background:var(--dl-fg);color:var(--dl-card);font-size:13px;line-height:18px;box-shadow:0 10px 30px #0000004d;opacity:0;transform:translateY(12px);transition:opacity .18s,transform .18s}.dl-toast.show{opacity:1;transform:none}.dl-toast .dl-icon-wrap{display:inline-flex}.dl-toast .dl-icon{width:15px;height:15px}.dl-toast.success .dl-icon{color:var(--dl-ok)}.dl-toast.error{background:var(--dl-bad);color:#fff}.dl-toast.error .dl-icon{color:#fff}.dl-toast.warning{background:var(--dl-warn);color:#111}.dl-toast.warning .dl-icon{color:#111}.dl-toast button{all:unset;cursor:pointer;display:inline-flex;margin-left:4px;opacity:.8}.dl-toast button:hover{opacity:1}';var Ca=".dl-setblock{display:flex;flex-direction:column;gap:8px;margin:0}.dl-addr-opts{display:flex;flex-direction:column;gap:6px}.dl-addr-opt{all:unset;box-sizing:border-box;cursor:pointer;display:grid;grid-template-columns:16px minmax(0,1fr) auto;gap:12px;align-items:center;padding:10px 14px;border-radius:12px;box-shadow:inset 0 0 0 1px var(--dl-line);min-width:0}.dl-addr-opt:hover{background:var(--dl-soft)}.dl-addr-opt.on{box-shadow:inset 0 0 0 1.5px var(--dl-accent);background:color-mix(in srgb,var(--dl-accent) 7%,transparent)}.dl-addr-opt .dl-mono{font-size:13px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-addr-opt .dl-stack{min-width:0}.dl-addr-opt input{width:100%}.dl-addr-opt.other{cursor:default}.dl-addr-opt.other:hover{background:none}.dl-addr-opt.other input{width:100%}.dl-addr-check{width:16px;height:16px;border-radius:5px;box-shadow:inset 0 0 0 1.5px var(--dl-fg-faint);display:inline-flex;align-items:center;justify-content:center}.dl-addr-check .dl-icon-wrap{display:inline-flex}.dl-addr-check .dl-icon{width:12px;height:12px}.dl-addr-opt.on .dl-addr-check{background:var(--dl-accent);box-shadow:none;color:#fff}.dl-addr-opt.other .dl-addr-check{box-shadow:none;color:var(--dl-fg-muted)}.dl-addr-warn{display:inline-flex;align-items:center;gap:5px;font-size:12px;line-height:17px;color:var(--dl-warn)}.dl-addr-warn .dl-icon-wrap{display:inline-flex}.dl-addr-warn .dl-icon{width:13px;height:13px}.dl-pill.info{background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent)}.dl-links{border-radius:12px;background:var(--dl-soft);overflow:hidden}.dl-link-row{display:grid;grid-template-columns:18px minmax(0,1fr) auto;gap:10px;align-items:center;padding:11px 14px}.dl-link-row+.dl-link-row{border-top:1px solid var(--dl-line)}.dl-link-ic{display:inline-flex}.dl-link-ic .dl-icon{width:15px;height:15px}.dl-link-ic.ok .dl-icon{color:var(--dl-ok)}.dl-link-ic.warn .dl-icon{color:var(--dl-warn)}.dl-link-url{font-size:13px;color:var(--dl-fg-muted);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-link-url b{font-weight:500;color:var(--dl-accent)}@media(max-width:640px){.dl-link-url,.dl-addr-opt .dl-mono,.dl-filecard .dl-ellipsis,.dl-invite-link>span:first-child{white-space:normal;overflow-wrap:anywhere}}.dl-ready-sum{display:flex;align-items:center;gap:12px;padding:12px 14px;border-radius:12px}.dl-ready-sum>.dl-icon-wrap{display:inline-flex}.dl-ready-sum>.dl-icon-wrap .dl-icon{width:18px;height:18px}.dl-ready-sum .dl-stack{flex:1;min-width:0}.dl-ready-sum b{font-weight:500;font-size:13px}.dl-ready-sum.ok{background:var(--dl-ok-wash)}.dl-ready-sum.ok b,.dl-ready-sum.ok .dl-icon{color:var(--dl-ok)}.dl-ready-sum.warn{background:var(--dl-warn-wash)}.dl-ready-sum.warn b,.dl-ready-sum.warn .dl-icon{color:var(--dl-warn)}.dl-ready-sum.error{background:var(--dl-bad-wash)}.dl-ready-sum.error b,.dl-ready-sum.error .dl-icon{color:var(--dl-bad)}.dl-check-chip{display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-soft);font-size:12px;color:var(--dl-fg-muted)}.dl-check-chip .dl-icon-wrap{display:inline-flex}.dl-check-chip .dl-icon{width:13px;height:13px;color:var(--dl-ok)}.dl-check-chip.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-check-chip.warn .dl-icon{color:var(--dl-warn)}.dl-check-chip.error{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-check-chip.error .dl-icon{color:var(--dl-bad)}.dl-ready-details{display:flex;flex-direction:column;gap:8px;padding:4px 2px}.dl-ready-details[hidden]{display:none}.dl-ready-item{display:flex;align-items:flex-start;gap:8px;font-size:13px;line-height:18px;min-width:0}.dl-ready-item .dl-icon-wrap{display:inline-flex;margin-top:1px}.dl-ready-item .dl-icon{width:15px;height:15px}.dl-ready-item.ok .dl-icon{color:var(--dl-ok)}.dl-ready-item.warn .dl-icon{color:var(--dl-warn)}.dl-ready-item.error .dl-icon{color:var(--dl-bad)}.dl-params-body{display:flex;flex-direction:column;gap:14px;padding:6px 14px 14px}.dl-params-body>.dl-setrow{margin:0;padding:0}.dl-pgrid.flush{padding:0;grid-template-columns:repeat(2,minmax(0,1fr))}@media(max-width:640px){.dl-pgrid.flush{grid-template-columns:minmax(0,1fr)}}.dl-qr-pane{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center}.dl-qr{width:min(280px,72vw);aspect-ratio:1;background:#0a0a0a;border-radius:18px;overflow:hidden}.dl-qr.light{background:#fff;box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-qr svg{display:block;width:100%;height:100%}.dl-filecard{display:flex;align-items:center;gap:12px;padding:12px;border-radius:14px;background:var(--dl-soft);min-width:0}.dl-filecard>.dl-stack{flex:1;min-width:0}.dl-filecard-ic{width:40px;height:46px;border-radius:8px;flex:none;display:inline-flex;align-items:center;justify-content:center;font:10px var(--dl-mono);color:var(--dl-fg-muted);background:var(--dl-card);box-shadow:inset 0 0 0 1px var(--dl-line)}.dl-params>.dl-conf{margin:0;border-top:1px solid var(--dl-line);border-radius:0 0 12px 12px;background:none}.dl-conf-sec{color:var(--dl-accent)}.dl-conf-k{color:var(--dl-fg-faint)}.dl-conf-mask{padding:0 6px;border-radius:4px;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-params>summary .dl-chipbtn{height:26px;font-size:12px}.dl-conf{white-space:pre-wrap;word-break:break-all;max-height:22em;overflow:auto;font-family:var(--dl-mono);font-size:12px;line-height:18px;margin:0;padding:12px;border-radius:12px;background:var(--dl-soft)}.dl-key{width:100%;box-sizing:border-box;font-family:var(--dl-mono);font-size:12px;word-break:break-all;min-height:7em}.dl-actions{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin:12px 0 0}.dl-link-box{display:flex;gap:6px;align-items:center;flex-wrap:wrap}.dl-link-box input{flex:1 1 18em;min-width:0;font-family:var(--dl-mono);font-size:12px}.dl-hint{font-size:12px;line-height:16px;color:var(--dl-fg-muted);margin:8px 0}.dl-divider{border:0;border-top:1px solid var(--dl-line);margin:16px 0}";var La=".dl-checks{list-style:none;margin:0;padding:0}.dl-checks li{display:flex;align-items:center;gap:12px;padding:12px 0;border-top:1px solid var(--dl-line)}.dl-checks li:first-child{border-top:0;padding-top:0}.dl-checks li:last-child{padding-bottom:0}.dl-check-icon{flex:0 0 auto;width:28px;height:28px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center}.dl-check-icon .dl-icon{width:14px;height:14px}.dl-check-icon.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-check-icon.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-check-icon.error{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-check-icon.skip{background:var(--dl-soft);color:var(--dl-fg-faint)}.dl-check-body{flex:1;min-width:0}.dl-check-title{font-size:14px;line-height:20px;font-weight:500}.dl-check-detail{font-size:12px;line-height:16px;color:var(--dl-fg-muted);overflow-wrap:anywhere}.dl-check-repaired{margin-top:2px;font-size:12px;line-height:16px;color:var(--dl-warn)}.dl-wd{margin:0 0 16px;display:flex;flex-direction:column;gap:14px}.dl-wd-head{display:flex;align-items:center;gap:12px;min-width:0}.dl-wd-head>.dl-stack{min-width:0}.dl-wd-title{font-size:16px;line-height:24px;font-weight:500}.dl-wd-tile{flex:none;width:36px;height:36px;border-radius:10px;display:inline-flex;align-items:center;justify-content:center;background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-wd-tile.off{background:var(--dl-soft);color:var(--dl-fg-faint)}.dl-wd-tile .dl-icon{width:18px;height:18px}.dl-wd-foot{display:flex;align-items:center;flex-wrap:wrap;gap:8px 16px;padding-top:14px;border-top:1px solid var(--dl-line)}.dl-wd-chips{display:flex;flex-wrap:wrap;gap:6px;flex:1 1 auto;min-width:0}.dl-wd-chips .dl-check-chip.error .dl-icon{color:var(--dl-bad)}.dl-warn-text{color:var(--dl-warn)!important}.dl-health-cols{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(440px,100%),1fr));gap:16px;align-items:start}.dl-health-cols>.dl-panel{margin:0;min-width:0}.dl-recent{display:flex;flex-direction:column}.dl-recent .dl-panel-head a{font-size:13px}.dl-recent-empty{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:32px 16px;color:var(--dl-fg-muted);font-size:13px;border-top:1px solid var(--dl-line)}.dl-loading{margin:0;font-size:13px}.dl-diag-tabs{margin:0 0 16px}.dl-row.dl-slog-row{align-items:baseline}.dl-slog-row .dl-ev-tile{align-self:flex-start;margin-top:-1px}.dl-slog-row.has-detail{cursor:pointer}.dl-row.dl-slog-row.has-detail:hover{background:color-mix(in srgb,var(--sys) 11%,transparent)}.dl-slog-more{display:inline-flex;vertical-align:-2px;margin-left:6px;color:var(--dl-fg-faint);transform:rotate(90deg);transition:transform .15s}.dl-slog-more .dl-icon{width:14px;height:14px}.dl-slog-more.open{transform:rotate(-90deg)}.dl-slog-detail{margin:8px 0 2px;padding:8px 10px;border-radius:8px;background:var(--dl-soft);font-family:var(--dl-mono);font-size:12px;line-height:17px;white-space:pre-wrap;overflow-wrap:anywhere;color:var(--dl-fg-muted);cursor:text}.dl-table{width:100%;border-collapse:collapse;font-size:14px;line-height:20px}.dl-table th{text-align:left;font-weight:500;color:var(--dl-fg-faint);padding:0 8px 8px;border-bottom:1px solid var(--dl-line)}.dl-table td{padding:10px 8px;border-bottom:1px solid var(--dl-line);vertical-align:middle}.dl-table th:first-child,.dl-table td:first-child{padding-left:0}.dl-table th:last-child,.dl-table td:last-child{padding-right:0}.dl-table tr:last-child td{border-bottom:0}.dl-table .dl-right{text-align:right;white-space:nowrap}.dl-log{max-height:18em;overflow:auto;font-family:var(--dl-mono);font-size:12px;line-height:18px;margin:8px 0 0;padding:12px;white-space:pre-wrap;border-radius:12px;background:var(--dl-soft)}";var Ma=".dl-pagehead{display:flex;align-items:flex-end;justify-content:space-between;gap:16px;flex-wrap:wrap;margin:0 0 20px}.dl-h1{margin:0!important;padding:0!important;font-size:24px!important;line-height:32px!important;font-weight:500!important;border:0!important}.dl-title-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.dl-stack{display:flex;flex-direction:column;gap:2px;min-width:0}.dl-stack.gap4{gap:4px}.dl-stack.gap8{gap:8px}.dl-sub{font-size:12px;line-height:16px;color:var(--dl-fg-muted)}.dl-ok{color:var(--dl-ok)}.dl-warn{color:var(--dl-warn)}.dl-bad{color:var(--dl-bad)}.dl-icon-only{width:auto!important;min-width:0!important;aspect-ratio:1 / 1;padding:0!important;justify-content:center;display:inline-flex!important;align-items:center;border-radius:999px!important}.dl-panel.flush{padding:0;overflow:hidden}.dl-panel-head.pad{padding:16px 16px 12px;margin:0}.dl-col{display:flex;flex-direction:column;gap:16px;min-width:0}.dl-col>.dl-panel,.dl-col>section.dl-panel{margin:0}.dl-crumbs{display:flex;gap:8px;align-items:center;font-size:14px;margin:0 0 16px;color:var(--dl-fg-faint)}.dl-crumbs a{color:var(--dl-fg-faint)}.dl-crumbs a:hover{color:var(--dl-fg)}.dl-crumbs span:last-child{color:var(--dl-fg)}.dl-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);margin:0 0 16px;box-shadow:var(--dl-shadow)}.dl-metric{display:flex;flex-direction:column;gap:4px;padding:16px 20px;min-width:0}.dl-metric+.dl-metric{border-left:1px solid var(--dl-line)}.dl-metric-label{font-size:12px;font-weight:500;color:var(--dl-fg-faint)}.dl-metric-value{font-size:28px;line-height:36px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums;white-space:nowrap}.dl-metric-value .dl-faint{font-size:16px}.dl-metric-sub{font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}@media(max-width:900px){.dl-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.dl-metric:nth-child(3){border-left:0}.dl-metric:nth-child(n+3){border-top:1px solid var(--dl-line)}}.dl-seg{display:inline-flex;gap:2px;padding:3px;border-radius:999px;background:var(--dl-soft);flex-wrap:wrap}.dl-seg button{all:unset;cursor:pointer;display:inline-flex;align-items:center;gap:6px;padding:4px 12px;border-radius:999px;font-size:13px;font-weight:500;color:var(--dl-fg-muted);white-space:nowrap}.dl-seg button:hover{color:var(--dl-fg)}.dl-seg button.on{background:var(--dl-soft-hover);color:var(--dl-fg)}.dl-seg.dl-srvsections{flex-wrap:nowrap;max-width:100%;overflow-x:auto;scrollbar-width:none}.dl-seg.dl-srvsections::-webkit-scrollbar{display:none}.dl-seg.dl-srvsections button{flex:none;white-space:nowrap}.dl-seg button:focus-visible{outline:2px solid var(--dl-ring)}.dl-seg button b{font-weight:500;font-size:11px;padding:0 6px;border-radius:999px;background:var(--dl-soft)}.dl-seg button b.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-seg.sm button{padding:2px 9px;font-size:11px}.dl-seg.wide{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));border-radius:12px;padding:4px}.dl-seg.wide button{flex-direction:column;justify-content:center;padding:8px 6px;border-radius:9px;gap:3px}.dl-seg.wide button.on{background:var(--dl-primary);color:var(--dl-primary-fg)}";var Ea=`.dl-geomap{position:relative;border-top:1px solid var(--dl-line);background:transparent}.dl-map-status{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;color:var(--dl-fg-muted);font-size:13px;z-index:1;pointer-events:none}.dl-map-wrap{position:relative}.dl-map-legend{position:absolute;left:12px;bottom:12px;display:flex;gap:12px;align-items:center;padding:6px 12px;border-radius:999px;font-size:12px;background:color-mix(in srgb,var(--dl-card) 88%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);z-index:2}.dl-map-legend span{display:inline-flex;align-items:center;gap:6px;color:var(--dl-fg-muted)}.dl-map-legend i.line{width:14px;height:0;border-top:2px dashed #8a8a8a}.dl-map-legend i.line.live{border-top-color:#3b82f6}.dl-map-off{padding:32px 16px;text-align:center;color:var(--dl-fg-muted);border-top:1px solid var(--dl-line)}.dl-mk{all:unset;cursor:pointer;position:relative;display:flex;align-items:center;justify-content:center;transition:opacity .2s}.dl-mk-hub{position:relative;display:flex;align-items:center;justify-content:center}.dl-mk-host{box-sizing:border-box;width:40px;height:40px;border-radius:11px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059}.dl-mk-host-tile{width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;background:var(--dl-fg);color:var(--background, var(--dl-elevated))}.dl-mk-host-ic{width:14px;height:14px}.dl-mk-av{position:relative;box-sizing:border-box;width:28px;height:28px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:500;line-height:1;border:2px solid #8a8a8a;background:var(--dl-elevated);color:var(--dl-fg-muted);transition:box-shadow .2s}.dl-mk.online .dl-mk-av{border-color:#3b82f6;background:color-mix(in srgb,#3b82f6 22%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk-badge{position:absolute;left:16px;bottom:-6px;height:16px;min-width:16px;padding:0 3px;border-radius:8px;border:2px solid var(--dl-elevated);background:#6b6b6b;color:#fff;display:flex;align-items:center;justify-content:center;gap:1px;font-size:9px;font-weight:600;white-space:nowrap;box-sizing:content-box}.dl-mk.online .dl-mk-badge{background:#3b82f6}.dl-mk-badge-ic{width:10px;height:10px;stroke-width:2.2}.dl-mk-badge:has(>svg:only-child){width:16px;min-width:0;padding:0}.dl-mk-tile{position:relative;width:26px;height:26px;border-radius:7px;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--dl-fg) 18%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk.place.online .dl-mk-tile{background:#3b82f6;color:#fff;box-shadow:0 2px 8px #3b82f659}.dl-mk-tile-ic{width:14px;height:14px}.dl-mk-tile-n{position:absolute;right:-5px;top:-5px;min-width:14px;height:14px;padding:0 3px;box-sizing:border-box;border-radius:7px;background:var(--dl-fg);color:var(--dl-elevated);font-size:9px;font-weight:600;line-height:14px;text-align:center}.dl-mk-when{display:block;text-align:center;color:var(--dl-fg-faint);font-weight:400}.dl-mk.place.online .dl-mk-when{color:#3b82f6}.dl-mk-tile.sm{width:18px;height:18px;border-radius:5px;font-size:9px;font-weight:600}.dl-dmap{border:1px solid var(--dl-line);border-radius:12px;overflow:hidden}.dl-dmap .dl-geomap{border-top:0}.dl-dplaces{display:flex;flex-direction:column;margin-top:4px}.dl-dplace-row{display:flex;align-items:center;gap:10px;padding:9px 2px;border-top:1px solid var(--dl-line);font-size:13px}.dl-dplace-row:first-child{border-top:0}.dl-dplace-n{flex:0 0 auto;width:20px;height:20px;border-radius:5px;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:600;background:color-mix(in srgb,var(--dl-fg) 18%,var(--dl-elevated));color:var(--dl-fg)}.dl-dplace-n.live{background:#3b82f6;color:#fff}.dl-dplace-n .dl-icon{width:12px;height:12px}.dl-dplace-now{color:#3b82f6}.dl-dplaces.strips .dl-dplace-row{position:relative;display:grid;grid-template-columns:20px minmax(0,1fr) auto;column-gap:10px;row-gap:9px;margin:0 -10px;padding:11px 10px;border-top:0;border-radius:10px;transition:background .15s}.dl-dplaces.strips .dl-dplace-row+.dl-dplace-row:before{content:"";position:absolute;left:10px;right:10px;top:0;height:1px;background:var(--dl-line)}.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur){background:var(--dl-soft)}.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur):before,.dl-dplaces.strips .dl-dplace-row:is(:hover,.cur)+.dl-dplace-row:before{opacity:0}.dl-dplace-strip{grid-column:2 / 4;position:relative;height:6px;border-radius:3px;background:var(--dl-track)}.dl-dplaces.can-replay .dl-dplace-strip{cursor:ew-resize;touch-action:none}.dl-dplace-strip i{position:absolute;top:0;bottom:0;min-width:2px;border-radius:2px;background:#8a8a8a}.dl-dplace-strip.live i{background:#3b82f6}.dl-dplaces.replay .dl-dplace-strip:after{content:"";position:absolute;left:var(--at);top:-4px;bottom:-4px;width:2px;margin-left:-1px;border-radius:1px;background:var(--dl-fg);box-shadow:0 0 0 2px var(--dialog-bg, var(--dl-elevated));pointer-events:none}.dl-dplace-axis{position:relative;height:16px;margin:4px 0 0 30px;font-size:11px;line-height:16px;color:var(--dl-fg-faint)}.dl-dplace-axis span{position:absolute;top:0;transform:translate(-50%);white-space:nowrap}.dl-dmap{position:relative}.dl-map-replay{position:absolute;left:10px;top:10px;z-index:3;display:flex;align-items:center;gap:6px}.dl-map-btn{all:unset;box-sizing:border-box;cursor:pointer;width:28px;height:28px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg)}.dl-map-btn:hover{background:color-mix(in srgb,var(--dl-fg) 8%,var(--dl-elevated))}.dl-map-btn:focus-visible{outline:2px solid var(--dl-ring)}.dl-map-btn .dl-icon{width:13px;height:13px}.dl-map-chip{display:inline-flex;align-items:center;height:28px;box-sizing:border-box;padding:0 10px;border-radius:8px;font-size:11.5px;white-space:nowrap;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg);font-variant-numeric:tabular-nums}.dl-mk.step .dl-mk-tile{transition:width .3s cubic-bezier(.2,.8,.2,1),height .3s cubic-bezier(.2,.8,.2,1),border-radius .3s,background-color .3s,color .3s,box-shadow .3s,transform .24s}.dl-mk.step .dl-mk-tile.sm .dl-mk-tile-ic{width:11px;height:11px}.dl-mk.step.faded>*{opacity:.5}.dl-mk.step:is(.online,.hl){z-index:2}.dl-mk.step.hl .dl-mk-tile{box-shadow:0 0 0 3px color-mix(in srgb,#3b82f6 55%,transparent)}.dl-mk.step.arrive .dl-mk-tile{animation:dl-mk-arrive .45s cubic-bezier(.2,.8,.2,1)}@keyframes dl-mk-arrive{0%{transform:scale(.8)}55%{transform:scale(1.12)}to{transform:scale(1)}}.dl-mk-when.inline{display:inline}.dl-mk>*{transition:opacity .15s;opacity:var(--dl-mk-fade, 1)}.dl-mk.merged,.dl-mk.piled{pointer-events:none}.dl-mk.dl-mk-new>*{transition:none}.dl-mk.merged>*,.dl-mk.piled>*{opacity:0}.dl-mk-hub{cursor:default}.dl-mk-host{position:relative}.dl-mk-host{transition:border-radius .22s ease,border-right-color .22s ease}.dl-mk-host.docked{border-top-right-radius:0;border-bottom-right-radius:0;border-right-color:transparent}.dl-mk-dock{position:absolute;left:100%;top:-1px;height:40px;box-sizing:border-box;display:flex;align-items:center;gap:6px;padding:0 10px 0 2px;border:1px solid var(--dl-line);border-left:0;border-radius:0 11px 11px 0;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059;pointer-events:none;opacity:0;clip-path:inset(-24px 100% -24px 0);transition:clip-path .28s cubic-bezier(.2,.8,.2,1),opacity .2s ease}.dl-mk-host.docked .dl-mk-dock{pointer-events:auto;opacity:1;clip-path:inset(-24px -24px -24px 0)}.dl-mk-new .dl-mk-host,.dl-mk-new .dl-mk-dock{transition:none}.dl-mk-pile{position:relative;display:flex;justify-content:center}.dl-mk-pile-box{box-sizing:border-box;height:40px;display:flex;align-items:center;gap:6px;padding:0 10px 0 6px;border-radius:20px;cursor:zoom-in;background:color-mix(in srgb,var(--dl-elevated) 60%,transparent);border:1px solid var(--dl-line);backdrop-filter:blur(6px);box-shadow:0 6px 16px #00000059;animation:dl-plate-in .26s cubic-bezier(.2,.8,.2,1) both;transition:opacity .18s ease,transform .18s ease}.dl-mk-pile.out{pointer-events:none}.dl-mk-pile.out>*{opacity:0;transform:scale(.85);transition:opacity .18s ease,transform .18s ease}@keyframes dl-plate-in{0%{opacity:0;transform:scale(.85)}}.dl-mk-face{all:unset;position:relative;display:flex;cursor:pointer;transition:transform .18s ease,opacity .18s ease}.dl-mk-face>.dl-mk-badge{position:relative;left:auto;bottom:-8px;margin-left:-12px;align-self:center}.dl-mk-face.on .dl-mk-av{border-color:#3b82f6;background:color-mix(in srgb,#3b82f6 22%,var(--dl-elevated));color:var(--dl-fg)}.dl-mk-face.on .dl-mk-badge{background:#3b82f6}.dl-mk-face:hover .dl-mk-av{box-shadow:0 0 0 4px #3b82f640}.dl-mk-face.in{animation:dl-dock-in .24s cubic-bezier(.2,.8,.2,1) both}.dl-mk-face.out{transform:scale(.4);opacity:0;pointer-events:none}@keyframes dl-dock-in{0%{transform:scale(.4);opacity:0}}.dl-mk-more{font-size:11px;font-weight:600;color:var(--dl-fg-muted)}.dl-mk-av,.dl-mk-tile{transition:box-shadow .2s,transform .24s cubic-bezier(.2,.8,.2,1)}.dl-mk.merged .dl-mk-av,.dl-mk.merged .dl-mk-tile,.dl-mk.piled .dl-mk-av{transform:scale(.5)}.dl-mk-host,.dl-mk-dock,.dl-mk-pile-box{transition-property:border-radius,border-right-color,clip-path,opacity,height,width,padding,gap}.dl-mk-dock,.dl-mk-pile-box{transition-duration:.22s;transition-timing-function:cubic-bezier(.2,.8,.2,1)}.dl-mk-pile-box{position:relative}.dl-mk-more{transition:transform .22s cubic-bezier(.2,.8,.2,1),opacity .18s ease}.dl-mk-more.in{animation:dl-dock-in .24s ease both}.dl-mk-more.out{transform:scale(.4);opacity:0}.dl-mk-face .dl-mk-av{transition:box-shadow .2s,transform .24s cubic-bezier(.2,.8,.2,1),width .2s ease,height .2s ease,font-size .2s ease}.dl-mk-face{transition:transform .22s cubic-bezier(.2,.8,.2,1),opacity .18s ease,margin .2s ease}.dl-mk-face>.dl-mk-badge{max-width:48px;overflow:hidden;transition:opacity .2s ease,transform .2s ease,max-width .22s ease,margin .22s ease,padding .22s ease,border-width .22s ease,height .22s ease,min-width .22s ease,width .22s ease,bottom .22s ease}.dl-lod-far .dl-mk-host{width:32px;height:32px;border-radius:9px}.dl-lod-far .dl-mk-host.docked{border-radius:9px 0 0 9px}.dl-lod-far .dl-mk-host-tile{width:20px;height:20px;border-radius:6px}.dl-lod-far .dl-mk-host-ic{width:11px;height:11px}.dl-lod-far .dl-mk-dock{height:32px;gap:0;padding:0 4px 0 0;border-radius:0 9px 9px 0}.dl-lod-far .dl-mk-pile-box{height:32px;gap:0;padding:0 4px;border-radius:16px}.dl-lod-far .dl-mk-face+.dl-mk-face{margin-left:-6px}.dl-lod-far .dl-mk-face .dl-mk-av{width:22px;height:22px;font-size:8px;box-shadow:0 0 0 2px var(--dl-elevated)}.dl-lod-far .dl-mk-face>.dl-mk-badge{max-width:0;min-width:0;padding:0;margin-left:0;border-width:0;opacity:0;transform:scale(.5);pointer-events:none}.dl-lod-far .dl-mk-more{margin-left:4px;font-size:10px}.dl-mk-label{transition:opacity .2s ease}.dl-lod-far .dl-mk:not(.step) .dl-mk-label{opacity:0}.dl-lod-mid .dl-mk-host{width:36px;height:36px}.dl-lod-mid .dl-mk-dock,.dl-lod-mid .dl-mk-pile-box{height:36px}.dl-lod-mid .dl-mk-face .dl-mk-av{width:24px;height:24px;font-size:9px}.dl-lod-mid .dl-mk-face>.dl-mk-badge{height:12px;min-width:12px;margin-left:-10px;bottom:-7px}.dl-lod-mid .dl-mk-face>.dl-mk-badge:has(>svg:only-child){width:12px}.dl-lod-mid .dl-mk-face>.dl-mk-badge .dl-mk-badge-ic{width:8px;height:8px}@media(prefers-reduced-motion:reduce){.dl-mk-dock,.dl-mk-pile-box,.dl-mk-face,.dl-mk-av,.dl-mk-tile,.dl-mk.step .dl-mk-tile,.dl-mk-host,.dl-mk-face>.dl-mk-badge{transition:none;animation:none}}.dl-mk-hub:has(.dl-mk-host.docked) .dl-mk-host{cursor:zoom-in}.dl-mk-ptr{position:absolute;left:50%;top:50%;width:0;height:0;z-index:-1;pointer-events:none}.dl-mk-ptr .line{position:absolute;left:0;top:-.5px;height:1px;background:var(--dl-fg-faint);transform-origin:0 50%}.dl-mk-ptr .spot{position:absolute;left:-3.5px;top:-3.5px;width:7px;height:7px;border-radius:50%;box-sizing:border-box;border:1.5px solid #fff;background:#8a8a8a}.dl-mk.online .dl-mk-ptr .spot,.dl-mk.place.online .dl-mk-ptr .spot{background:#3b82f6}.dl-mk.dim>*{opacity:.18}.dl-mk.hl .dl-mk-av{box-shadow:0 0 0 4px #3b82f640}.dl-mk-label{position:absolute;left:50%;bottom:100%;margin-bottom:4px;transform:translate(-50%);white-space:nowrap;pointer-events:none;font-size:10px;line-height:14px;font-weight:500;color:var(--dl-fg)}.dl-mk-label.below{bottom:auto;top:100%;margin:4px 0 0}.dl-mk-label.chip{padding:2px 6px;border-radius:4px;font-size:11px;line-height:16px;font-weight:600;background:color-mix(in srgb,var(--background, var(--dl-card)) 80%,transparent);backdrop-filter:blur(8px)}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact{margin:0 10px 10px 0;min-height:28px;padding:0;border-radius:8px;background:var(--dl-elevated);border:1px solid var(--dl-line);color:var(--dl-fg-muted);box-shadow:none;font-size:11px;line-height:26px}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact:not(.maplibregl-compact-show){width:28px;height:28px;box-sizing:border-box}.dl-geomap .maplibregl-ctrl-bottom-right .maplibregl-ctrl-attrib.maplibregl-compact.maplibregl-compact-show{padding:0 32px 0 10px}.dl-geomap .maplibregl-ctrl-attrib a{color:var(--dl-fg-muted)}.dl-geomap .maplibregl-ctrl-attrib-button{top:0;right:0;width:26px;height:26px;margin:0;border-radius:8px;background:none}.dl-geomap .maplibregl-ctrl-attrib-button:after{content:"";position:absolute;inset:5px;background:var(--dl-fg);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm-1.2 8.2h2.4V17h-2.4v-6.8ZM12 6a1.4 1.4 0 1 0 0 2.8A1.4 1.4 0 0 0 12 6Z'/%3E%3C/svg%3E") center / contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm-1.2 8.2h2.4V17h-2.4v-6.8ZM12 6a1.4 1.4 0 1 0 0 2.8A1.4 1.4 0 0 0 12 6Z'/%3E%3C/svg%3E") center / contain no-repeat}.dl-geomap .maplibregl-ctrl-attrib-button:focus{outline:none;box-shadow:none}.dl-geomap .maplibregl-ctrl-attrib-button:focus-visible{outline:2px solid var(--dl-ring)}.dl-map-card{position:absolute;right:12px;top:12px;z-index:3;min-width:200px;max-width:260px;padding:10px 12px;border-radius:10px;font-size:12px;line-height:20px;background:var(--dl-elevated);color:var(--dl-fg);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4));opacity:0;transition:opacity .2s;pointer-events:none}.dl-map-card.on{opacity:1}.dl-map-card-head b{font-weight:500}.dl-map-card-row{display:flex;justify-content:space-between;gap:12px;white-space:nowrap}.dl-popcard{position:fixed;z-index:2100;width:max-content;max-width:300px;padding:12px;border-radius:12px;box-sizing:border-box;background:var(--dl-elevated);color:var(--dl-fg);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4))}.dl-popcard.away{visibility:hidden}.dl-popcard.leaving{pointer-events:none}.dl-popcard-tip{position:absolute;left:var(--tip-x, 50%);width:10px;height:10px;margin-left:-6px;box-sizing:border-box;background:var(--dl-elevated);border:solid var(--dl-line);transform:rotate(45deg)}.dl-popcard.above .dl-popcard-tip{bottom:-6px;border-width:0 1px 1px 0}.dl-popcard.below .dl-popcard-tip{top:-6px;border-width:1px 0 0 1px}.dl-popcard.above{transform-origin:var(--tip-x, 50%) 100%}.dl-popcard.below{transform-origin:var(--tip-x, 50%) 0}@media(prefers-reduced-motion:no-preference){.dl-popcard{animation:dl-pop-in .16s ease-out}.dl-popcard.leaving{animation:dl-pop-out .14s ease-in forwards}}@keyframes dl-pop-in{0%{opacity:0;transform:scale(.94)}to{opacity:1;transform:none}}@keyframes dl-pop-out{0%{opacity:1;transform:none}to{opacity:0;transform:scale(.94)}}.dl-pop{display:flex;flex-direction:column;gap:4px;font-size:12px;line-height:18px;min-width:210px}.dl-pop-head{display:flex;align-items:center;gap:8px;font-size:13px;margin-bottom:2px}.dl-pop-net{width:30px;height:30px;border-radius:9px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-pop-list{display:flex;flex-direction:column;margin:6px 0 0;max-height:116px;overflow-y:auto}.dl-pop-row{all:unset;cursor:pointer;display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:8px}.dl-pop-row:hover{background:var(--dl-soft)}.dl-pop-row:focus{outline:none}.dl-pop-row:focus-visible{outline:2px solid var(--dl-ring)}.dl-pop-name{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-pop-name b{font-weight:500}.dl-pop-dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);flex:0 0 auto}.dl-pop-dot.on{background:var(--dl-ok);box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-pop-actions{display:flex;gap:6px;margin-top:8px;padding-top:8px;border-top:1px solid var(--dl-line)}.dl-pop-actions .cbi-button{flex:1;height:28px!important;font-size:12px!important;justify-content:center}.dl-chartbox{position:relative}.dl-bars{display:flex;align-items:flex-end;gap:4px;border-bottom:1px solid var(--dl-line)}.dl-bar{flex:1;height:100%;display:flex;flex-direction:column-reverse;gap:1px;cursor:default;min-width:3px}.dl-bar i{display:block;border-radius:3px 3px 0 0}.dl-bar i.down{background:var(--dl-chart-1)}.dl-bar i.up{background:var(--dl-chart-2);opacity:.75;border-radius:3px 3px 0 0}.dl-bar:hover i{filter:brightness(1.25)}.dl-bar.empty{background:linear-gradient(to top,var(--dl-line) 2px,transparent 2px)}.dl-tip{position:absolute;top:-8px;transform:translate(-50%,-100%);padding:8px 10px;border-radius:10px;font-size:12px;line-height:18px;white-space:nowrap;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4));pointer-events:none;z-index:3}.dl-tip-title{font-weight:500}.dl-tip-float{position:fixed;z-index:2000;color:var(--dl-fg)}.dl-meter,.dl-slots{cursor:default}.dl-axis{display:flex;justify-content:space-between;font-size:12px;color:var(--dl-fg-faint);margin-top:6px}.dl-legend i.down{background:var(--dl-chart-1)}.dl-legend i.up{background:var(--dl-chart-2)}.dl-spark{display:flex;align-items:flex-end;flex:0 0 auto;--dl-gap: 2px}.dl-spark i{flex:1;display:block;border-radius:2px 2px 0 0;background:var(--dl-chart-1);opacity:.85}.dl-spark i.zero{opacity:.22}.dl-spark>span:hover i:not(.zero){opacity:1;filter:brightness(1.25)}.dl-spark>span,.dl-dbars>span,.dl-bento-bars>span{flex:1;min-width:0;height:100%;display:flex;align-items:flex-end;padding:0 calc(var(--dl-gap) / 2)}.dl-spark>span:first-child,.dl-dbars>span:first-child,.dl-bento-bars>span:first-child{padding-left:0}.dl-spark>span:last-child,.dl-dbars>span:last-child,.dl-bento-bars>span:last-child{padding-right:0}`;var Ta=`.dl-row{display:flex;align-items:center;gap:12px;padding:12px 16px;border-top:1px solid var(--dl-line);font-size:14px;line-height:20px;min-width:0}.dl-row.link{color:inherit;text-decoration:none}.dl-row.link:hover{background:var(--dl-soft)}.dl-row-main{flex:1;min-width:0;overflow-wrap:anywhere}.dl-row-main b{font-weight:500}.dl-attn{display:flex;flex-direction:column;gap:10px;padding:16px;border-top:1px solid var(--dl-line)}.dl-attn-item{display:flex;gap:10px;align-items:baseline;font-size:13px;color:var(--dl-fg-muted)}.dl-avatar.sm{width:26px;height:26px;font-size:10px;margin:0}.dl-avatar.lg{width:48px;height:48px;font-size:15px;margin:0}.dl-avatar.lg.online:after{width:12px;height:12px}.dl-list{border:1px solid var(--dl-line);border-radius:12px;overflow:hidden}.dl-list>.dl-row:first-child{border-top:0}.dl-ellipsis{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}.dl-row-main.dl-stack{min-width:0}.dl-person-id{display:flex;align-items:center;gap:14px;min-width:0}.dl-grid-person{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(0,1fr);gap:16px;align-items:start}@media(max-width:1000px){.dl-grid-person{grid-template-columns:minmax(0,1fr)}}.dl-devsec{display:flex;flex-direction:column;gap:12px}.dl-devsec .dl-panel-head{margin:0}.dl-dgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.dl-dcard>.dl-dcard-head+*{margin-top:auto}@media(max-width:700px){.dl-dgrid{grid-template-columns:minmax(0,1fr)}}.dl-dgrid>.dl-dslot.add:only-child{grid-column:1 / -1}.dl-dcard{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:12px;min-width:0;box-shadow:var(--dl-shadow)}.dl-dcard.online{border-color:color-mix(in srgb,var(--dl-ok) 35%,transparent)}.dl-dcard.off{opacity:.7}.dl-dcard-head{display:flex;align-items:center;gap:12px}.dl-dcard-ic{width:40px;height:40px;border-radius:12px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-dcard-ic .dl-icon{width:20px;height:20px}.dl-dcard.online .dl-dcard-ic{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-dcard-title{all:unset;cursor:pointer;flex:1;min-width:0;display:flex;flex-direction:column}.dl-dcard-title b{font-weight:500;font-size:15px}.dl-dstat{display:inline-flex;align-items:center;gap:6px;font-size:12px;color:var(--dl-fg-muted);white-space:nowrap;min-width:0}.dl-dstat i.dot{flex:none}.dl-dstat.ok{color:var(--dl-ok)}.dl-dstat.warn{color:var(--dl-warn)}.dl-dstat i.dot,.dl-savebar i.dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint)}.dl-dstat i.dot.ok{background:var(--dl-ok);box-shadow:0 0 0 3px var(--dl-ok-wash)}.dl-dstat i.dot.warn{background:var(--dl-warn)}.dl-dcard-use{display:flex;align-items:flex-end;justify-content:space-between;gap:12px}.dl-dcard-foot{padding-top:10px;border-top:1px solid var(--dl-line);font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dl-dslot.add{all:unset;box-sizing:border-box;cursor:pointer;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:10px;padding:14px;min-height:0;border:1px dashed color-mix(in srgb,currentColor 18%,transparent);border-radius:14px;text-align:center;color:var(--dl-fg-muted);transition:background .15s,border-color .15s,color .15s}.dl-dslot.add .dl-stack{align-items:center}.dl-dslot.add:hover{border-color:color-mix(in srgb,currentColor 35%,transparent);color:var(--dl-fg)}.dl-dslot.add:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-dslot.add b{font-weight:500}.dl-dslot.add:hover{background:var(--dl-soft)}.dl-dslot-ic{width:36px;height:36px;border-radius:999px;background:var(--dl-soft);display:inline-flex;align-items:center;justify-content:center;flex:0 0 auto;color:var(--dl-fg-muted)}.dl-dslot.add:hover .dl-dslot-ic{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-tiles2{display:grid;gap:10px;margin-top:16px}.dl-tile2{border:1px solid var(--dl-line);border-radius:14px;padding:14px;display:flex;flex-direction:column;gap:10px;min-width:0}.dl-tile2-label{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:12px;font-weight:500;color:var(--dl-fg-faint)}.dl-tile2-row{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-wrap:wrap}.dl-tile2-value{font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.01em;font-variant-numeric:tabular-nums}.dl-tile2-value .dl-faint{font-size:14px;font-weight:400}.dl-tile2-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;padding-top:10px;border-top:1px solid var(--dl-line);font-size:12px}.dl-stepper{display:inline-flex;align-items:stretch;height:32px;border:1px solid var(--input, var(--dl-line));border-radius:8px;overflow:hidden}.dl-stepper button{all:unset;cursor:pointer;width:32px;display:inline-flex;align-items:center;justify-content:center;font-size:16px;color:var(--dl-fg)}.dl-stepper button:hover{background:var(--dl-soft)}.dl-stepper button[disabled]{opacity:.35;cursor:not-allowed}.dl-stepper+.dl-stepper{margin-left:4px}.dl-step-select{border:0!important;border-left:1px solid var(--input, var(--dl-line))!important;border-right:1px solid var(--input, var(--dl-line))!important;border-radius:0!important;background:transparent!important;color:inherit;font:500 13px inherit;padding:0 10px!important;height:100%!important;min-width:0!important}.dl-slots{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:3px}.dl-slots i{height:4px;border-radius:999px;background:var(--dl-track);display:block}.dl-slots i.used{background:var(--dl-fg)}.dl-slots i.over{background:color-mix(in srgb,var(--dl-warn) 80%,transparent)}.dl-date{display:flex;align-items:center;gap:8px;flex:1 1 150px;min-width:0;box-sizing:border-box;height:34px;padding:0 10px;border:1px solid var(--input, var(--dl-line));border-radius:8px;color:var(--dl-fg-faint)}.dl-date input{border:0!important;background:transparent!important;box-shadow:none!important;padding:0!important;height:32px!important;color:var(--dl-fg);flex:1;min-width:0!important;width:100%!important}.dl-meter{position:relative;height:6px;border-radius:999px;background:var(--dl-track)}.dl-meter>i{display:block;height:100%;border-radius:999px;background:var(--dl-accent)}.dl-meter.warn>i{background:var(--dl-warn)}.dl-meter.bad>i{background:var(--dl-bad)}.dl-meter .mark{position:absolute;left:90%;top:-3px;width:1px;height:12px;background:var(--dl-warn)}.dl-meter.sm{height:4px}.dl-chips-row{display:flex;flex-wrap:wrap;gap:4px}.dl-chipbtn{all:unset;cursor:pointer;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-soft);font-size:12px;font-weight:500;display:inline-flex;align-items:center}.dl-chipbtn:hover{background:var(--dl-soft-hover)}.dl-chipbtn.on{background:var(--dl-primary);color:var(--dl-primary-fg)}.dl-switch{all:unset;cursor:pointer;position:relative;width:32px;height:20px;border-radius:999px;background:var(--switch-off, var(--dl-track));flex:0 0 auto;transition:background .15s}.dl-switch i{position:absolute;left:2px;top:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:left .15s;box-shadow:0 1px 2px #0000004d}.dl-switch.on{background:var(--dl-accent)}.dl-switch.on i{left:14px}.dl-switch:focus-visible{outline:2px solid var(--dl-ring);outline-offset:2px}.dl-linkbox{display:flex;align-items:center;gap:8px;height:36px;padding:0 4px 0 12px;border:1px solid var(--input, var(--dl-line));border-radius:8px;background:var(--input-bg, transparent)}.dl-linkbox .dl-mono{flex:1;min-width:0;font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--dl-fg-muted)}.dl-linkbox .cbi-button{height:28px!important}.dl-pcard{display:grid;grid-template-columns:minmax(0,1fr) 260px;gap:20px;align-items:stretch;min-width:0}.dl-pcard-main{min-width:0}.dl-pcard-top{display:flex;align-items:center;gap:12px;min-width:0}.dl-pcard-top .dl-avatar{margin-right:0}.dl-pcard-who{flex:1;min-width:0}.dl-pcard-who .dl-slotbar{margin:3px 0 0}.dl-pside{display:flex;flex-direction:column;justify-content:space-between;gap:8px;padding-left:20px;border-left:1px solid var(--dl-line);min-width:0}.dl-pside-top{display:flex;align-items:center;justify-content:space-between;gap:8px}.dl-pside-state{display:inline-flex;align-items:center;gap:6px;font-size:13px;color:var(--dl-fg-muted)}.dl-pside-state.live{color:var(--dl-ok)}.dl-pside-foot{font-size:12px}.dl-pside .dl-use-num b{font-size:20px}.dl-none{display:none!important}.dl-pcard-actions{display:flex;gap:6px;flex:0 0 auto}.dl-pcard-actions .cbi-button{height:32px!important}.dl-icon-only .dl-btn-label{display:none}.dl-pill-ic{display:inline-flex;align-items:center;gap:4px;height:22px;padding:0 8px;border-radius:999px;font-size:12px;white-space:nowrap;background:var(--dl-soft);color:var(--dl-fg-muted)}.dl-pill-ic .dl-icon{width:12px;height:12px}.dl-pill-ic.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-pill-ic.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-use-num{display:flex;align-items:baseline;gap:6px;white-space:nowrap}.dl-use-num b{font-size:15px;font-weight:500}.dl-use-live{display:flex;align-items:center;gap:8px;font-size:12px;font-variant-numeric:tabular-nums}.dl-usebar{display:flex;gap:2px;height:6px;border-radius:999px;overflow:hidden;background:var(--dl-track)}.dl-usebar i{display:block;height:100%;min-width:3px;flex:0 1 0}.dl-usebar i.fill{flex:none;min-width:0;border-radius:999px;background:var(--dl-accent)}.dl-usebar.warn i.fill{background:var(--dl-warn)}.dl-usebar.bad i.fill{background:var(--dl-bad)}.dl-usebar .c0,.dl-swatch.c0{background:var(--dl-chart-1)}.dl-usebar .c1,.dl-swatch.c1{background:#8b7cf6}.dl-usebar .c2,.dl-swatch.c2{background:#2fb889}.dl-usebar .c3,.dl-swatch.c3{background:#d9a03f}.dl-usebar .c4,.dl-swatch.c4{background:var(--dl-fg-faint)}.dl-tip-row{display:flex;align-items:center;gap:8px;min-width:160px}.dl-tip-row b{margin-left:auto;font-weight:500}.dl-swatch{width:8px;height:8px;border-radius:2px;flex:none}.dl-card-name{color:var(--dl-fg)!important;text-decoration:none}.dl-card-name:hover{text-decoration:underline}.dl-chip-tag{font-size:11px;line-height:18px;padding:0 6px;border-radius:999px;background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-chip.live{background:var(--dl-ok-wash);color:color-mix(in srgb,var(--dl-ok) 35%,var(--dl-fg))}.dl-chip.live:hover{background:color-mix(in srgb,var(--dl-ok) 22%,transparent)}.dl-chip.live .dl-icon{color:var(--dl-ok)}.dl-fixes{display:flex;gap:6px;flex-wrap:wrap;margin:10px 0 0 44px}.dl-fix{all:unset;cursor:pointer;height:26px;padding:0 10px;border-radius:999px;background:var(--dl-info-wash);color:var(--dl-info);font-size:12px;font-weight:500;display:inline-flex;align-items:center}.dl-fix:hover{filter:brightness(1.15)}@media(max-width:760px){.dl-pcard{grid-template-columns:1fr}.dl-pside{padding:12px 0 0;border-left:0;border-top:1px solid var(--dl-line)}.dl-fixes{margin-left:0}}.dl-select{height:34px!important;border-radius:999px!important;min-width:136px!important;width:auto!important;padding:0 34px 0 14px!important;appearance:none!important;-webkit-appearance:none!important;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b8f98' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")!important;background-repeat:no-repeat!important;background-position:right 12px center!important;background-size:14px!important}.dl-savebar{position:fixed;left:50%;bottom:24px;transform:translate(-50%,160%);opacity:0;transition:transform .25s cubic-bezier(.2,.8,.2,1),opacity .2s;display:flex;align-items:center;gap:10px;padding:8px 8px 8px 18px;border-radius:999px;background:var(--dl-elevated);border:1px solid var(--dl-line);box-shadow:var(--shadow-2xl, 0 16px 32px -8px rgba(0,0,0,.5));z-index:60;pointer-events:none}.dl-savebar.show{transform:translate(-50%);opacity:1;pointer-events:auto}.dl-savebar-text{display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:500}`;var Sa=".dl-toast strong{display:block;font-weight:500}.dl-toast div{opacity:.8;font-size:13px}.dl-drawer-overlay{position:fixed;inset:0;z-index:900;display:flex;justify-content:flex-end;background:transparent;transition:background .2s}.dl-drawer-overlay.open{background:var(--scrim, rgba(0,0,0,.45))}.dl-drawer{width:min(520px,100%);height:100%;display:flex;flex-direction:column;background:var(--dialog-bg, var(--dl-elevated));color:var(--dl-fg);border-left:1px solid var(--dl-line);box-shadow:var(--shadow-2xl, -16px 0 32px -8px rgba(0,0,0,.5));transform:translate(100%);transition:transform .22s cubic-bezier(.2,.8,.2,1)}.dl-drawer-overlay.open .dl-drawer{transform:none}.dl-drawer-head{display:flex;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid var(--dl-line)}.dl-drawer-title{flex:1;min-width:0;display:flex;align-items:center;gap:12px}.dl-drawer-title h3{margin:0!important;padding:0!important;border:0!important;font-size:18px!important;line-height:26px;font-weight:500!important}.dl-drawer-x{all:unset;cursor:pointer;width:32px;height:32px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;color:var(--dl-fg-muted)}.dl-drawer-x:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-drawer-body{flex:1;overflow:auto;padding:20px}.dl-drawer-foot{padding:12px 20px;border-top:1px solid var(--dl-line)}.dl-drawer-actions{display:flex;align-items:center;gap:8px}.dl-dcard-ic.on{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-icon-only.sm{width:28px;height:28px!important}.dl-stack.gap12{gap:12px}.dl-stack.gap16{gap:16px}.dl-dstats{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));border:1px solid var(--dl-line);border-radius:14px;overflow:hidden}.dl-dstats-cell{display:flex;flex-direction:column;gap:4px;padding:12px 14px;min-width:0}.dl-dstats-cell.wide{grid-column:span 2;border-bottom:1px solid var(--dl-line)}.dl-dstats-cell+.dl-dstats-cell:not(.wide):last-child{border-left:1px solid var(--dl-line)}.dl-dstats-cell b{font-size:16px;font-weight:500;font-variant-numeric:tabular-nums}.dl-dstats-cell .dl-dstat{font-size:14px}.dl-dsec{border:1px solid var(--dl-line);border-radius:14px;padding:16px;display:flex;flex-direction:column;gap:12px}.dl-dsec-head{display:flex;align-items:center;justify-content:space-between;gap:12px}.dl-dsec-head h4{margin:0!important;padding:0!important;font-size:14px!important;font-weight:500!important;border:0!important}.dl-dstat i.dot{width:6px;height:6px;border-radius:50%;background:var(--dl-fg-faint);display:inline-block}.dl-connect-body{min-height:60px}.dl-connect-body .dl-qr{width:min(240px,70vw)}.dl-kv2{display:flex;flex-direction:column}.dl-kvrow{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:9px 0;border-top:1px solid var(--dl-line);font-size:13px;min-width:0}.dl-kvrow:first-child{border-top:0;padding-top:0}.dl-kvrow-k{color:var(--dl-fg-muted);flex:0 0 auto}.dl-kvrow-v{min-width:0;text-align:right;overflow-wrap:anywhere}.dl-kvrow-v.copy{all:unset;cursor:pointer;display:inline-flex;align-items:center;gap:6px;min-width:0;color:var(--dl-fg)}.dl-kvrow-v.copy span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-kvrow-v.copy .dl-icon{width:13px;height:13px;color:var(--dl-fg-faint)}.dl-kvrow-v.copy:hover .dl-icon{color:var(--dl-fg)}@media(max-width:560px){.dl-drawer{width:100%}.dl-dstats{grid-template-columns:minmax(0,1fr)}.dl-dstats-cell.wide{grid-column:auto}.dl-dstats-cell+.dl-dstats-cell:not(.wide):last-child{border-left:0;border-top:1px solid var(--dl-line)}}.dl-dev-log{display:flex;flex-direction:column}.dl-dev-log-row{display:flex;align-items:center;gap:10px;padding:8px 0;border-top:1px solid var(--dl-line);font-size:13px;line-height:20px;min-width:0}.dl-dev-log-row:first-child{border-top:0;padding-top:0}.dl-dev-log-row .dl-row-main{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}";var Pa=".dl-settings-main{min-width:0;display:flex;flex-direction:column;gap:20px}.dl-setsec{background:var(--dl-card);border:1px solid var(--dl-line);border-radius:var(--dl-radius);overflow:hidden;scroll-margin-top:88px;box-shadow:var(--dl-shadow)}.dl-setsec-body{padding:20px;display:flex;flex-direction:column;gap:14px}.dl-setsec-body h3{margin:0!important;padding:0!important;font-size:18px!important;line-height:26px;font-weight:500!important;border:0!important}.dl-setsec-body p{margin:0}.dl-setsec-head{display:flex;align-items:center;gap:10px}.dl-group{border:1px solid var(--dl-line);border-radius:14px;padding:2px 16px}.dl-group-head{display:flex;align-items:center;gap:12px;padding:14px 0 10px}.dl-group-head b{font-size:15px;font-weight:500}.dl-group-ic{width:32px;height:32px;border-radius:10px;background:var(--dl-soft);color:var(--dl-fg-muted);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-group-ic .dl-icon-wrap{display:inline-flex}.dl-group-ic .dl-icon{width:16px;height:16px}.dl-group-body>*{padding:12px 0;margin:0!important}.dl-group-body>*+*:not(.alert-message):not(.dl-params){border-top:1px solid var(--dl-line)}.dl-group-body>.alert-message,.dl-group-body>.dl-params{margin:12px 0!important}.dl-group-body>.alert-message{padding:10px 14px}.dl-group-body>.dl-params{padding:0}.dl-group-body>.alert-message+*,.dl-group-body>.dl-params+*{border-top:0}.dl-group-body>.dl-row{border-left:0;border-right:0;border-bottom:0;padding-left:0;padding-right:0;background:none}.dl-group-body>.dl-row:first-child{border-top:0}.dl-setsec-foot{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 16px;padding:12px 20px;border-top:1px solid var(--dl-line);background:var(--dl-soft)}.dl-setsec.danger{border-color:color-mix(in srgb,var(--dl-bad) 40%,transparent)}.dl-setsec.danger .dl-setsec-foot{background:color-mix(in srgb,var(--dl-bad) 6%,transparent)}.dl-setrow{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,420px);align-items:center;gap:8px 24px}.dl-setrow.head{display:flex;justify-content:space-between;gap:16px}.dl-setrow-label{font-size:14px;font-weight:500}.dl-setrow-ctl{display:flex;justify-content:flex-end;min-width:0}.dl-setrow-ctl .dl-chips-row{justify-content:flex-end}.dl-setrow-ctl>input{width:100%}.dl-hostport{display:flex;align-items:center;gap:8px;flex:1;min-width:0;justify-content:flex-end}.dl-hostport input{flex:1;min-width:0}.dl-root input.dl-w-port,.dl-hostport input.dl-w-port{flex:0 0 90px;width:90px}.dl-root input.dl-w-range{flex:0 0 130px;width:130px}.dl-setrow .dl-sub.bad{color:var(--dl-bad)}.dl-suffixed{display:inline-flex;align-items:center;gap:6px}.dl-suffixed>span{color:var(--dl-fg-muted)}.dl-more summary{cursor:pointer;color:var(--dl-fg-muted);font-size:13px;margin-bottom:10px}.dl-more .dl-setrow+.dl-setrow{margin-top:10px}@media(max-width:760px){.dl-setrow:not(.head){grid-template-columns:minmax(0,1fr)}.dl-setrow-ctl,.dl-setrow-ctl .dl-chips-row{justify-content:flex-start}}.dl-need-ic{width:30px;height:30px;border-radius:9px;background:var(--dl-soft);color:var(--dl-fg-muted);display:inline-flex;align-items:center;justify-content:center;flex:none}.dl-need-ic .dl-icon-wrap{display:inline-flex}.dl-need-ic .dl-icon{width:15px;height:15px}.dl-need-row.bad .dl-need-ic,.dl-need-ic.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-need-row.warn .dl-need-ic,.dl-need-ic.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-need-ic.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-lh-main{display:flex;align-items:flex-start;gap:12px;min-width:0}.dl-lh-main>.dl-need-ic{margin-top:1px}.dl-sub .dl-mono{font-size:.92em}.dl-need-row>.cbi-button{flex:none}.dl-bk-row .dl-group-ic{width:30px;height:30px}.dl-bk-older>summary{list-style:none;cursor:pointer;display:flex;align-items:center;gap:8px;padding:11px 16px;border-top:1px solid var(--dl-line);font-size:13px;color:var(--dl-fg-muted);user-select:none}.dl-bk-older>summary::-webkit-details-marker{display:none}.dl-bk-older>summary:hover{background:var(--dl-soft);color:var(--dl-fg)}.dl-bk-older>summary .dl-icon-wrap{display:inline-flex;transition:transform .15s}.dl-bk-older>summary .dl-icon{width:14px;height:14px}.dl-bk-older[open]>summary .dl-icon-wrap{transform:rotate(90deg)}#dl-set-backups .dl-setsec-head h3+.dl-sub{margin-top:2px}#dl-set-backups .dl-setsec-foot>.dl-sub{flex:1 1 260px}.dl-bk-actions{flex:0 1 auto;justify-content:flex-end}@media(max-width:640px){#dl-set-backups .dl-setsec-foot>.dl-sub{flex-basis:100%}.dl-bk-actions{justify-content:flex-start}}.dl-upd{display:flex;flex-direction:column;gap:16px}.dl-upd>.dl-pagehead{margin:0 0 4px}.dl-upd-bad{color:var(--dl-bad)}";var $a=".dl-comp-hero{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr)}.dl-comp-hero-main{padding:20px;display:flex;flex-direction:column;gap:12px;min-width:0}.dl-comp-hero-side{padding:20px;border-left:1px solid var(--dl-line);display:flex;flex-direction:column;gap:14px;min-width:0}.dl-comp-name{font-size:16px;font-weight:500}.dl-comp-hero-head{display:flex;align-items:center;gap:10px;flex-wrap:wrap;min-width:0}.dl-comp-hero-head .dl-spacer{flex:1}.dl-comp-big{font-family:var(--dl-mono);font-size:26px;line-height:34px;letter-spacing:-.02em;display:flex;align-items:baseline;gap:10px}.dl-comp-big small{font-size:14px;color:var(--dl-accent)}.dl-comp-big small.dl-faint{color:var(--dl-fg-faint)}.dl-comp-verrow{display:flex;align-items:center;gap:4px 12px;flex-wrap:wrap;min-width:0}.dl-comp-verrow .dl-spacer{flex:1}.dl-comp-meta{font-size:13px}.dl-comp-bullets{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:4px;color:var(--dl-fg-muted);font-size:13px}.dl-comp-bullets li{list-style:disc}.dl-comp-lead{margin:0}.dl-comp-more{align-self:flex-start;font-size:12px;color:var(--dl-fg-faint);margin-left:18px;padding:0!important}.dl-comp-more:hover{color:var(--dl-accent);background:none!important;text-decoration:underline;text-underline-offset:2px}.dl-comp-hero-main>.dl-comp-vers{margin-top:auto}.dl-comp-btns{display:flex;gap:8px;flex-wrap:nowrap;align-items:center;flex:none}.dl-comp-side-v{display:flex;align-items:center;gap:8px;font-size:14px;min-width:0;flex-wrap:wrap}.dl-comp-side-v .dl-icon{width:15px;height:15px;color:var(--dl-fg-muted)}.dl-comp-side-v a{color:inherit;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-side-v a:hover{color:var(--dl-accent)}.dl-comp-cols{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:16px;align-items:start}.dl-comp-cols>.dl-panel>div>.dl-row:first-child{border-top:1px solid var(--dl-line)}.dl-comp-count{font-size:13px}.dl-comp-sub{font-size:11px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-ic{display:inline-flex;gap:4px;flex:none}.dl-comp-ic .cbi-button{width:30px;height:30px;padding:0!important;justify-content:center;border-radius:999px!important}.dl-comp-ic .dl-btn-label{display:none}.dl-comp-ic .dl-icon{width:14px;height:14px}.dl-comp-ic .is-busy{pointer-events:none;opacity:.5}.dl-comp-ic .cbi-button.dl-comp-check{width:auto;padding:0 12px 0 10px!important;gap:6px;display:inline-flex;align-items:center;font-size:13px}.dl-row>.dl-pill,.dl-row>.cbi-button,.dl-row>.dl-comp-ic{flex:none}button.dl-pill.dl-comp-run{all:unset;display:inline-flex;align-items:center;height:20px;padding:0 8px;border-radius:999px;font-size:12px;cursor:pointer;background:color-mix(in srgb,var(--dl-accent) 14%,transparent);color:var(--dl-accent)}.dl-comp-foldwrap{padding:0 16px 14px 60px}.dl-comp-fold .dl-params-body{gap:12px}.dl-comp-fold .dl-list>.dl-row{padding:10px 14px}.dl-comp-bver{font-size:12px;width:130px;text-align:right;flex:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.dl-comp-bact{width:84px;flex:none;display:flex;justify-content:flex-end}.dl-comp-warn{display:flex;align-items:flex-start;gap:8px;font-size:12px;line-height:18px;color:var(--dl-fg-muted)}.dl-comp-warn .dl-icon-wrap{display:inline-flex;flex:none;margin-top:2px}.dl-comp-warn .dl-icon{width:14px;height:14px;color:var(--dl-warn)}.dl-comp-empty{margin:0;padding:4px 16px 16px}@media(max-width:760px){.dl-comp-hero,.dl-comp-cols{grid-template-columns:minmax(0,1fr)}.dl-comp-hero-side{border-left:0;border-top:1px solid var(--dl-line)}.dl-comp-foldwrap{padding-left:16px}.dl-comp-bver{display:none}}.dl-comp-status{display:flex;align-items:center;gap:8px;font-size:13px;padding:9px 12px;border-radius:10px;background:var(--dl-soft);min-width:0}.dl-comp-status>.dl-icon-wrap{display:inline-flex;flex:none}.dl-comp-status .dl-icon{width:15px;height:15px}.dl-comp-status.ok{background:var(--dl-ok-wash);color:var(--dl-ok)}.dl-comp-status.acc{background:color-mix(in srgb,var(--dl-accent) 12%,transparent);color:var(--dl-accent)}.dl-comp-status.warn{background:var(--dl-warn-wash);color:var(--dl-warn)}.dl-comp-status.bad{background:var(--dl-bad-wash);color:var(--dl-bad)}.dl-comp-status b{font-weight:600}.dl-comp-vers .dl-params-body{gap:0;padding:4px 14px 12px}.dl-comp-tag{display:flex;gap:6px;padding:6px 0 10px}.dl-comp-tag input{flex:1;min-width:0}.dl-comp-ver{display:flex;align-items:center;gap:8px;padding:7px 0;border-top:1px solid var(--dl-line);font-size:13px}.dl-comp-ver .dl-mono{min-width:52px}.dl-comp-ver .dl-sub{flex:1}.dl-comp-ver .cbi-button:not(.dl-icon-btn){height:26px!important;font-size:12px!important}.dl-comp-pager{display:flex;align-items:center;justify-content:space-between;padding-top:10px;border-top:1px solid var(--dl-line);font-size:12px}.dl-comp-pager .dl-linkbtn[disabled]{opacity:.4;cursor:default}.dl-comp-vers .dl-loading,.dl-comp-vers .dl-params-body>p{padding:6px 0 10px}.dl-op-head{display:flex;align-items:center;gap:8px;flex-wrap:wrap;margin-bottom:14px}.dl-op-head .dl-spacer{flex:1}.dl-op-timer{display:inline-flex;align-items:center;gap:5px;font-variant-numeric:tabular-nums}.dl-op-timer .dl-icon,.dl-op-head .dl-linkbtn .dl-icon{width:14px;height:14px}.dl-op-loghead{display:flex;align-items:center;justify-content:space-between}.dl-op-loghead b{font-weight:500;font-size:13px}.dl-op .dl-log{max-height:16em;min-height:12em;margin-top:8px}.dl-op .dl-comp-status{margin:14px 0 0}.dl-op-actions{display:flex;gap:8px;justify-content:flex-end;flex-wrap:wrap;width:100%}.dl-notes{max-height:55vh;overflow:auto;border-radius:12px;background:var(--dl-soft);padding:14px 16px;font-size:13px;line-height:20px;overflow-wrap:anywhere}.dl-notes h5{margin:10px 0 6px;font-size:14px;font-weight:500}.dl-notes h5:first-child{margin-top:0}.dl-notes p{margin:0 0 8px}.dl-notes ul{margin:0 0 10px;padding-left:18px}.dl-notes li{list-style:disc}.dl-notes code{font-family:var(--dl-mono);font-size:12px;padding:1px 5px;border-radius:6px;background:var(--dl-soft-hover)}.dl-notes pre{font-family:var(--dl-mono);font-size:12px;padding:10px;border-radius:8px;background:var(--dl-soft-hover);white-space:pre-wrap;margin:0 0 10px}.dl-notes a{color:var(--dl-accent)}";var Da=".dl-chip.static{cursor:default}.dl-chip.static:hover{background:var(--dl-soft)}.dl-chip.static .dl-chip-name{font-weight:500}.dl-setrow.head .dl-chips-row{margin-top:8px}.dl-setrow.head>.dl-lh-main,.dl-setrow.head>.dl-lh-main>.dl-stack{flex:1 1 auto;min-width:0}.dl-setrow.head>.dl-setrow-ctl:empty{display:none}.dl-setrow.head:has(>.dl-lh-main){align-items:flex-start}.dl-setrow.head>.dl-setrow-ctl{align-items:center;min-height:30px}.dl-netpick{margin-top:10px}.dl-boxrow{display:flex;align-items:center;justify-content:space-between;gap:16px;margin:0;padding:10px 14px;border:1px solid var(--dl-line);border-radius:12px;font-size:13px;cursor:pointer}.dl-boxrow>.dl-switch{flex:none}.dl-ifpick{display:flex;flex-direction:column;gap:12px;padding:14px;border:1px solid var(--dl-line);border-radius:14px}.dl-iflead-row{display:flex;align-items:center;justify-content:space-between;gap:12px}.dl-host-ports{justify-content:flex-end}@media(max-width:760px){.dl-host-ports{justify-content:flex-start}}.dl-circle-dot{display:inline-block;width:8px;height:8px;border-radius:50%;flex:none}.dl-circles .dl-chip b{font-weight:500}.dl-circle-name{display:inline-flex;align-items:center;gap:8px;font-size:14px;font-weight:500}.dl-w400{font-weight:400}.dl-swatches{display:flex;flex-wrap:wrap;gap:8px}.dl-swatch{all:unset;cursor:pointer;width:22px;height:22px;border-radius:50%;background:var(--sw);box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--dl-fg) 12%,transparent)}.dl-swatch.on{box-shadow:0 0 0 2px var(--dl-card),0 0 0 4px var(--sw)}.dl-swatch:focus-visible{outline:2px solid var(--dl-ring);outline-offset:3px}.dl-circle-modal .dl-chipbtn b{margin-left:6px;font-weight:500;font-size:11px;opacity:.6}.dl-reach td:first-child b{font-weight:500}.dl-ev-host{white-space:nowrap}.dl-ev-host b{font-weight:500;color:var(--dl-fg)}.dl-reach{font-size:13px}.dl-reach th,.dl-reach td{white-space:nowrap;padding-left:6px;padding-right:6px}.dl-reach-wrap{overflow-x:auto}.dl-yes{display:inline-flex;align-items:center;gap:4px;color:var(--dl-ok)}.dl-yes .dl-icon-wrap{display:inline-flex}.dl-yes .dl-icon{width:14px;height:14px}.dl-check-form{display:grid;grid-template-columns:minmax(0,1fr) auto minmax(0,1fr) auto;align-items:start;gap:8px}.dl-check-form>.dl-faint{line-height:36px}.dl-check-end{display:flex;flex-direction:column;gap:6px;min-width:0}.dl-check-end>*{width:100%!important;min-width:0}@media(max-width:560px){.dl-check-form{grid-template-columns:minmax(0,1fr)}.dl-check-form>.dl-faint{display:none}}.dl-verdict{display:flex;align-items:baseline;gap:10px;padding:10px 12px;border-radius:12px}.dl-verdict b{font-weight:500}.dl-verdict.ok{background:var(--dl-ok-wash)}.dl-verdict.ok b{color:var(--dl-ok)}.dl-verdict.bad{background:var(--dl-bad-wash)}.dl-verdict.bad b{color:var(--dl-bad)}.dl-corehead{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:0 0 4px}.dl-corehead h3{margin:0!important}.dl-row-end{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap}.dl-dcard.clickable{cursor:pointer}.dl-dcard.clickable:hover{border-color:color-mix(in srgb,var(--dl-fg) 22%,transparent)}";var td=[ba,xa,wa,ya,ka,_a,Ca,La,Ma,Ea,Ta,Sa,Pa,$a,Da].join(` `);function Aa(){let n=document.createElement("style");return n.dataset.dawnline="1",n.textContent=td,n}function yt(n){return()=>{let e=new n;return Object.assign({load:()=>e.load(),render:async s=>{let r=await e.render(s),a=document.createElement("div");return a.className="dl-root",a.append(Aa(),r),a},addFooter(){return e.noFooter?document.createElement("div"):this.super("addFooter",[])}},{handleSave:null,handleSaveApply:null,handleReset:null})}}var Jb=yt(on),Zb=yt(wt),Qb=yt(on),Xb=yt(On),e0=yt(Gn),t0=yt(Yn),n0=yt(Wn);function Na(n){return()=>({load:()=>(ui.menu?.flushCache(),location.replace(`${L.url("admin/network/dawnline/diagnostics")}${n?`?tab=${n}`:""}`),new Promise(()=>{})),render:()=>document.createElement("div"),handleSave:null,handleSaveApply:null,handleReset:null})}var o0=Na(""),s0=Na("log");return baseclass.extend({ activity: s0, diagnostics: t0, health: o0, overview: Jb, people: Zb, person: e0, server: Qb, settings: Xb, updates: n0 }); diff --git a/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.css b/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.css index 906d4b4..14b1b18 100644 --- a/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.css +++ b/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.css @@ -1 +1 @@ -@font-face{font-family:Geist;src:url(geist-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-21FF,U+2212,U+2215}@font-face{font-family:Geist;src:url(geist-cyrillic-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Geist Mono;src:url(geist-mono-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap}:root{color-scheme:dark;--bg: #080808;--raised: #121212;--field: #161616;--knob: #232323;--seg: rgba(237, 237, 237, .05);--seg-shadow: none;--line: rgba(255, 255, 255, .06);--text: #ededed;--text-2: #8c8c8a;--text-3: #4f4f4e;--accent: #4eafff;--accent-ink: #ffffff;--accent-soft: rgba(78, 175, 255, .13);--ok: #57d64b;--ok-soft: rgba(87, 214, 75, .14);--warn: #ff8a3d;--bad: #ff5c5c;--bad-soft: rgba(255, 92, 92, .13);--sel-bg: rgba(131, 209, 255, .25);--sel-fg: #64c6ff;--scrim: rgba(8, 8, 8, .8);--line-glass: rgba(255, 255, 255, .07);--pop-shadow: 0 18px 48px -14px rgba(0, 0, 0, .75);--sheet-shadow: 0 24px 64px -16px rgba(0, 0, 0, .6);--bar: rgba(237, 237, 237, .13);--toast: #232323;--toast-fg: #ededed;--qr-bg: #0a0a0a;--gi-a: rgba(255, 255, 255, .58);--gi-b: rgba(255, 255, 255, .14);--gi-rim: rgba(255, 255, 255, .5);--gi-edge: rgba(0, 0, 0, 0);--gi-detail: #ffffff;--t-grey-a: #cfcfcd;--t-grey-b: #5a5a59;--t-blue-a: #a6d9ff;--t-blue-b: #1d84e6;--t-green-a: #a8f29c;--t-green-b: #3aa32c;--t-red-a: #ffadad;--t-red-b: #dc3a3a;--t-orange-a: #ffc08f;--t-orange-b: #ec6a12;--font: Geist, -apple-system, system-ui, "Segoe UI", sans-serif;--mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;--r-sheet: 36px;--r-card: 28px;--r-row: 20px;--r-field: 16px;--r-tile: 12px;--ease-out: cubic-bezier(.23, 1, .32, 1);--gutter-l: max(16px, env(safe-area-inset-left, 0px));--gutter-r: max(16px, env(safe-area-inset-right, 0px))}@media(prefers-color-scheme:light){:root{color-scheme:light;--bg: #f2f2f1;--raised: #ffffff;--field: #f3f3f2;--knob: #e8e8e7;--seg: #ffffff;--seg-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .05);--line: rgba(0, 0, 0, .07);--text: #0b0b0b;--text-2: #6d6d6b;--text-3: #a6a6a4;--accent: #2b9dff;--accent-soft: rgba(43, 157, 255, .12);--ok: #33a328;--ok-soft: rgba(51, 163, 40, .12);--warn: #ee6a12;--bad: #e5484d;--bad-soft: rgba(229, 72, 77, .1);--sel-bg: rgba(78, 175, 255, .22);--sel-fg: #0a76cf;--scrim: rgba(236, 236, 235, .62);--line-glass: rgba(0, 0, 0, .07);--pop-shadow: 0 18px 44px -14px rgba(0, 0, 0, .2);--sheet-shadow: 0 24px 64px -18px rgba(0, 0, 0, .22);--bar: rgba(11, 11, 11, .11);--toast: #0b0b0b;--toast-fg: #f2f2f1;--qr-bg: #ffffff;--gi-a: rgba(250, 250, 249, .72);--gi-b: rgba(206, 206, 204, .5);--gi-rim: rgba(255, 255, 255, .9);--gi-edge: rgba(0, 0, 0, .11);--gi-detail: rgba(28, 28, 28, .72);--t-grey-a: #a9a9a7;--t-grey-b: #3d3d3c;--t-blue-a: #7cc4ff;--t-blue-b: #0a6fd6;--t-green-a: #82e070;--t-green-b: #2e8a22;--t-red-a: #ff9090;--t-red-b: #c92a2a}}*{box-sizing:border-box}html{-webkit-text-size-adjust:100%;scrollbar-gutter:stable}body{margin:0;background:var(--bg);color:var(--text);font:400 15px/22px var(--font);letter-spacing:-.011em;-webkit-font-smoothing:antialiased;min-height:100vh;min-height:100dvh;cursor:default}body.locked{overflow:hidden}input,textarea,.linkrow .mono,.conf{cursor:text}::selection{background:var(--sel-bg);color:var(--sel-fg)}button{font:inherit;color:inherit;letter-spacing:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;-webkit-tap-highlight-color:transparent}button:disabled{cursor:default}a{color:inherit;text-decoration:none}:focus{outline:none}:focus-visible{outline:2px solid color-mix(in srgb,var(--accent) 65%,transparent);outline-offset:2px}[hidden]{display:none!important}.offscreen{position:fixed;left:-9999px;top:0;opacity:0}.mono{font-family:var(--mono);letter-spacing:0}.num{font-variant-numeric:tabular-nums}.ok-t{color:var(--ok)}.warn-t{color:var(--warn)}.bad-t{color:var(--bad)}.here-t{color:var(--accent)}.i{width:18px;height:18px;flex:none}.gi{width:24px;height:24px;flex:none;overflow:visible;--ta: var(--t-grey-a);--tb: var(--t-grey-b)}.gi.t-blue{--ta: var(--t-blue-a);--tb: var(--t-blue-b)}.gi.t-green{--ta: var(--t-green-a);--tb: var(--t-green-b)}.gi.t-red{--ta: var(--t-red-a);--tb: var(--t-red-b)}.gi.t-orange{--ta: var(--t-orange-a);--tb: var(--t-orange-b)}.gi .ta{stop-color:var(--ta)}.gi .tb{stop-color:var(--tb)}.gi .fa{stop-color:var(--gi-a)}.gi .fb{stop-color:var(--gi-b)}.gi .fc{stop-color:var(--ta);stop-opacity:.28}.gi .ge{stroke:var(--gi-edge)}.gi .gr{stroke:var(--gi-rim)}.gi .gd{stroke:var(--gi-detail)}.gi .gdf{color:var(--gi-detail)}.knob{width:32px;height:32px;border-radius:50%;background:var(--knob);color:var(--text);display:grid;place-items:center;flex:none;transition:transform .15s var(--ease-out),background-color .15s}.knob:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.knob:active{transform:scale(.8)}.knob .i{width:16px;height:16px}.knob.back .i{transform:rotate(180deg)}.knob[aria-expanded=true]{background:color-mix(in srgb,var(--knob),var(--text) 10%)}.btn{height:48px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:0 20px;font-size:16px;font-weight:500;letter-spacing:-.015em;user-select:none;-webkit-user-select:none;transition:transform .2s var(--ease-out),background-color .2s var(--ease-out),color .2s var(--ease-out)}.btn:active{transform:scale(.95)}.btn.block{width:100%}.btn.sm{height:40px;font-size:15px;padding:0 16px}.btn.accent{background:var(--accent);color:var(--accent-ink);font-weight:600}.btn.accent:hover{background:color-mix(in srgb,var(--accent) 82%,transparent)}.btn.tint{background:var(--accent-soft);color:var(--accent);font-weight:600}.btn.tint:hover{background:color-mix(in srgb,var(--accent) 20%,transparent)}.btn.tint:active{background:color-mix(in srgb,var(--accent) 24%,transparent)}.btn.soft{background:var(--knob);color:var(--text)}.btn.soft:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.btn.red{background:var(--bad);color:#fff;font-weight:600}.busy{position:relative}.orb{position:absolute;inset:0;margin:auto;width:28px;height:28px;overflow:hidden;contain:strict;pointer-events:none}.orb i{position:absolute;left:50%;top:50%;width:7px;height:7px;margin:-3.5px 0 0 -3.5px;border-radius:50%;background:currentColor;animation:orb-converge 1.8s linear infinite both}.orb i:nth-child(2){animation:orb-breathe 1.8s ease-in-out infinite both}@keyframes orb-converge{0%{transform:translateY(-5px) scale(1);filter:blur(0);animation-timing-function:linear}10%{transform:translateY(-5px) scale(1);filter:blur(0);animation-timing-function:cubic-bezier(.55,0,1,.45)}22%{transform:translate(2.15px,-1.25px) scale(.72);filter:blur(.8px);animation-timing-function:cubic-bezier(.33,1,.68,1)}33%{transform:translate(4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:linear}43%{transform:translate(4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:cubic-bezier(.55,0,1,.45)}55%{transform:translateY(2.5px) scale(.72);filter:blur(.8px);animation-timing-function:cubic-bezier(.33,1,.68,1)}66%{transform:translate(-4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:linear}77%{transform:translate(-4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:cubic-bezier(.55,0,1,.45)}88%{transform:translate(-2.15px,-1.25px) scale(.72);filter:blur(.8px);animation-timing-function:cubic-bezier(.33,1,.68,1)}to{transform:translateY(-5px) scale(1);filter:blur(0)}}@keyframes orb-breathe{0%,to{opacity:.16;filter:blur(2.4px);transform:scale(1.2)}50%{opacity:.32;filter:blur(1.6px);transform:scale(.98)}}.field{height:48px;border-radius:var(--r-field);background:var(--field);display:flex;align-items:center;gap:12px;padding:0 4px 0 16px;overflow:hidden;transition:box-shadow .2s var(--ease-out)}.field:focus-within{box-shadow:inset 0 0 0 1.5px color-mix(in srgb,var(--text) 16%,transparent)}.field input{flex:1;min-width:0;border:0;outline:0;background:transparent;padding:0;font:500 16px/24px var(--font);color:var(--text);letter-spacing:-.012em}.field input::placeholder{color:var(--text-3)}.go{width:48px;height:40px;border-radius:12px;background:var(--knob);color:var(--text-3);display:grid;place-items:center;flex:none;transition:background-color .2s var(--ease-out),color .2s var(--ease-out),transform .2s var(--ease-out)}.go .i{width:20px;height:20px}.go.ready{background:var(--accent);color:var(--accent-ink)}.go.ready:active{transform:scale(.9)}.go:not(.ready){cursor:not-allowed}.seg{position:relative;display:flex;align-items:center;height:48px;padding:0 4px;border-radius:var(--r-field);background:var(--field)}.seg-pill{position:absolute;left:0;top:4px;height:40px;border-radius:12px;background:var(--seg);box-shadow:var(--seg-shadow);pointer-events:none}.seg-b{position:relative;z-index:1;height:40px;font-size:16px;font-weight:500;color:var(--text-3);white-space:nowrap;transition:color .2s var(--ease-out)}.seg-b.on{color:var(--text)}.seg-b:not(.on):hover{color:var(--text-2)}.appseg .seg-b{flex:0 0 56px;display:flex;align-items:center;justify-content:center;justify-content:safe center;gap:8px;padding:0 18px;overflow:hidden}.appseg .seg-b.on{flex:1 1 56px}.appseg .seg-b .i{width:20px;height:20px}.appseg .seg-l{max-width:0;opacity:0;margin-left:-8px;overflow:hidden;white-space:nowrap}.appseg .seg-b.on .seg-l{max-width:180px;opacity:1;margin-left:0}.appseg{container-type:inline-size}@container (max-width: 300px){.appseg .seg-b{flex-basis:44px;padding:0 12px}}.kinds{display:grid;grid-template-columns:repeat(var(--n, 4),minmax(0,1fr));gap:8px;position:relative;container-type:inline-size}.kind{position:relative;z-index:1;display:flex;flex-direction:column;align-items:center;gap:8px;min-width:0;color:var(--text-3);font-size:12px;line-height:16px;font-weight:500;transition:color .2s var(--ease-out)}.kind-tile{width:100%;height:56px;border-radius:14px;background:var(--field);display:grid;place-items:center;transition:background-color .2s var(--ease-out),transform .2s var(--ease-out),box-shadow .22s var(--ease-out)}.kind.on .kind-tile{box-shadow:inset 0 0 0 1.5px var(--accent)}.kind-lbl{white-space:nowrap}.kind:hover .kind-tile,.kind:focus-visible .kind-tile{background:var(--knob)}.kind:active .kind-tile{transform:scale(.94)}.kind:focus-visible{outline:none}.kind:focus-visible .kind-lbl,.kind.on{color:var(--text)}.kind .gi{width:26px;height:26px;filter:grayscale(1);opacity:.55;transition:filter .26s var(--ease-out),opacity .26s var(--ease-out)}.kind.on .gi{filter:none;opacity:1}@container (max-width: 330px){.kind-tile{height:50px}.kind{font-size:11.5px}}.or{display:flex;align-items:center;gap:12px;margin:22px 0;color:var(--text-3);font-size:12px;font-weight:500;letter-spacing:.06em}.or:before,.or:after{content:"";flex:1;height:1px;background:var(--line)}.badge{width:100%;text-align:left;display:flex;align-items:center;gap:12px;height:60px;padding:0 14px 0 12px;border-radius:18px;background:var(--field);transition:background-color .2s,transform .2s var(--ease-out)}.badge:hover{background:var(--knob)}.badge:active{transform:scale(.98)}.badge .b-ic{width:36px;height:36px;border-radius:10px;background:var(--text);color:var(--raised);display:grid;place-items:center;flex:none}.badge .b-ic .i{width:20px;height:20px}.badge .b-t{flex:1;min-width:0;display:flex;flex-direction:column}.badge .b-top{font-size:12px;line-height:16px;color:var(--text-2)}.badge .b-main{font-size:15px;line-height:20px;font-weight:500}.badge>.i{color:var(--text-3);width:16px;height:16px}.badge.primary .b-ic{background:var(--accent-soft);color:var(--accent)}.badges2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.badges2 .badge{padding:0 10px;gap:10px}.badges2 .badge>.i{display:none}.badges2 .b-ic{width:32px;height:32px}.hint{margin:0;font-size:13px;line-height:18px;color:var(--text-2)}.hint a,.hint button{color:var(--accent);font-weight:500}.howto{margin:0;padding:0;list-style:none;display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:13px;color:var(--text-2)}.howto li{display:inline-flex;align-items:center;gap:6px}.howto li+li:before{content:"\203a";color:var(--text-3)}.howto b{color:var(--text);font-weight:500}.linkrow{display:flex;align-items:center;gap:8px;height:44px;padding:0 4px 0 14px;border-radius:14px;background:color-mix(in srgb,var(--knob) 72%,var(--field))}.view>.linkrow{background:var(--field)}.linkrow .mono{flex:1;min-width:0;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;user-select:all}.linkrow .knob{width:36px;height:36px;border-radius:10px;background:transparent}.linkrow .knob:hover{background:var(--knob)}.qrbox{position:relative;width:148px;height:148px;flex:none;border-radius:18px;overflow:hidden;background:var(--qr-bg)}.qrbox.light{box-shadow:inset 0 0 0 1px var(--line)}.qrbox.big{width:208px;height:208px;border-radius:24px;align-self:center}.qrbox.big+.linkrow{margin-top:16px}.qrbox.dense{width:100%;max-width:none;height:auto;aspect-ratio:1;align-self:stretch;border-radius:22px}.qrbox svg{display:block;width:100%;height:100%}.qrbox>svg.old{position:absolute;inset:0}.coderow{display:flex;gap:14px;align-items:flex-start}.coderow.stacked{flex-direction:column;align-items:stretch}.coderow .side{position:relative;display:flex;flex-direction:column;gap:8px;min-width:0;font-size:14px;line-height:20px;color:var(--text-2)}.coderow .side b{color:var(--text);font-weight:500}.side .words{display:flex;flex-direction:column;gap:8px}.side .words.old{position:absolute;left:0;right:0;top:0;pointer-events:none}.side .arr{color:var(--text-2);font-weight:400;margin:0 6px}@media(max-width:380px){.coderow{flex-direction:column}}@media(prefers-reduced-motion:reduce){.orb i{animation:none;opacity:.3;filter:blur(1.4px)}.orb i:first-child{opacity:1;filter:none}}.mt{position:relative}.mt-ib{display:inline-block;white-space:nowrap}.mt-new{white-space:nowrap}.mt-old{position:absolute;white-space:nowrap;pointer-events:none}.mt-new.w,.mt-old.w{white-space:inherit}.mt-new i,.mt-old i{font-style:normal;display:inline-block;white-space:pre}.acc{display:flex;flex-direction:column}.acc-row{background:var(--raised);overflow:hidden;border-radius:0;padding:0 8px;transition:background-color .15s}.acc-row.rt{border-top-left-radius:var(--r-row);border-top-right-radius:var(--r-row)}.acc-row.rb{border-bottom-left-radius:var(--r-row);border-bottom-right-radius:var(--r-row)}.acc-row.open{margin-block:10px}.acc-row.open:first-child{margin-top:0}.acc-row.open:last-child{margin-bottom:0}.acc-row:not(.open):not(.still):hover{background:color-mix(in srgb,var(--raised),var(--knob) 40%)}.acc-head{width:100%;display:flex;align-items:center;gap:10px;height:52px;padding:0 6px 0 8px;text-align:left}.acc-row.still .acc-head{cursor:default;padding-right:10px}.acc-head .gi{width:22px;height:22px}.acc-title{flex:1;min-width:0;font-size:15px;font-weight:500;letter-spacing:-.02em;display:flex;align-items:center;gap:8px}.acc-title .t{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.acc-val{display:flex;align-items:center;gap:8px;color:var(--text-2);font-size:14px;white-space:nowrap;transition:opacity .2s var(--ease-out),filter .2s var(--ease-out),transform .26s var(--ease-out)}.acc-val>span{display:inline-flex;align-items:center;gap:8px}.acc-row.open .acc-val.hide-open{opacity:0;filter:blur(4px);transform:translate(8px);pointer-events:none}.acc-chev{width:16px;height:16px;color:var(--text-2);transform:rotate(90deg);transition:transform var(--spring-soft-dur, .47s) var(--spring-soft, ease)}.acc-row.open .acc-chev{transform:rotate(-90deg)}.acc-body{display:none;padding:0 8px 16px 40px}.acc-row.open .acc-body,.acc-row.closing .acc-body{display:flex;flex-direction:column;gap:12px}.acc .desc{margin:0;font-size:14px;line-height:20px;opacity:.6}.acc.inset .acc-row{background:var(--field)}.acc.inset .acc-row:not(.open):not(.still):hover{background:color-mix(in srgb,var(--field),var(--knob) 50%)}.acc.inset .acc-body{padding-left:8px}.acc.inset .seg{background:color-mix(in srgb,var(--knob) 65%,var(--field))}@media(prefers-reduced-motion:reduce){.acc-chev{transition:none}}.edge-fade{position:fixed;left:0;right:0;z-index:30;pointer-events:none}.edge-fade.top{top:0;height:calc(80px + env(safe-area-inset-top,0px));opacity:0;transition:opacity .2s;background:linear-gradient(var(--bg) 0%,color-mix(in srgb,var(--bg) 75%,transparent) 50%,transparent 100%);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);-webkit-mask-image:linear-gradient(#000 0%,rgba(0,0,0,.88) 44%,transparent 100%);mask-image:linear-gradient(#000 0%,rgba(0,0,0,.88) 44%,transparent 100%)}body.scrolled .edge-fade.top{opacity:1}.edge-fade.bot{bottom:0;height:calc(96px + env(safe-area-inset-bottom,0px));background:linear-gradient(to top in oklab,var(--bg) 0%,transparent 100%)}.crumbs{display:flex;align-items:center;gap:10px;height:32px;margin:0 0 32px}.cr-mark{width:32px;height:32px;display:grid;place-items:center;flex:none}.logo{width:24px;height:24px;flex:none;overflow:hidden}.logo .sun,.logo .bar{fill:var(--text)}.cr-path{flex:1;min-width:0;display:flex;align-items:center;gap:6px;font-size:15px;line-height:22px;letter-spacing:-.15px;color:var(--text-2)}.cr-path span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cr-path .cur{color:var(--text);font-weight:500}.cr-path .i{width:14px;height:14px}.cr-lang{display:inline-flex;align-items:center;gap:4px;height:32px;padding:0 8px 0 12px;border-radius:999px;background:var(--knob);color:var(--text);font-size:14px;font-weight:500;letter-spacing:-.01em;flex:none;transition:transform .15s var(--ease-out),background-color .15s}.cr-lang:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.cr-lang:active{transform:scale(.94)}.cr-lang[aria-expanded=true]{background:color-mix(in srgb,var(--knob),var(--text) 10%)}.cr-down{width:14px;height:14px;color:var(--text-2);transform:rotate(90deg);transition:transform .2s var(--ease-out)}.cr-lang[aria-expanded=true] .cr-down{transform:rotate(-90deg)}.page{max-width:1072px;margin:0 auto;padding-left:var(--gutter-l);padding-right:var(--gutter-r);padding-block:calc(40px + env(safe-area-inset-top,0px)) 112px}.cols{display:grid;gap:40px}.cols>.access{order:-1}@media(min-width:960px){.cols{grid-template-columns:minmax(0,1fr) 384px;gap:36px;align-items:start}.cols>.access{order:0;position:sticky;top:calc(84px + env(safe-area-inset-top,0px))}}.sec-head{display:flex;align-items:baseline;gap:8px;padding:0 4px 12px}.sec-head h2{margin:0;font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.025em}.sec-head .aside{color:var(--text-3);font-size:14px;font-weight:500}.sec-head .aside.warn-t{color:var(--warn)}.note-s{margin:12px 4px 0;color:var(--text-3);font-size:13px;line-height:18px}.notice{display:flex;align-items:center;gap:14px;padding:14px 18px 14px 14px;border-radius:24px;background:var(--raised);margin:0 0 22px}.notice .gi{width:36px;height:36px}.notice .t{display:flex;flex-direction:column;min-width:0}.notice b{font-weight:500;font-size:15px;line-height:22px;letter-spacing:-.02em}.notice span{color:var(--text-2);font-size:14px;line-height:20px}.notice.warn{background:color-mix(in srgb,var(--warn) 10%,var(--raised));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--warn) 22%,transparent)}.notice.bad{background:color-mix(in srgb,var(--bad) 10%,var(--raised));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--bad) 22%,transparent)}.page.single{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;align-items:center;justify-content:center;padding-block:calc(24px + env(safe-area-inset-top,0px)) calc(24px + env(safe-area-inset-bottom,0px))}.page.single .crumbs{position:relative;left:12px;max-width:calc(100% - 84px);margin:0 0 16px}.page.single .cr-mark{position:absolute;right:calc(100% + 10px);top:0}.page.single .page-body{width:100%;max-width:400px}.page.single .gone{margin:0}.gone{max-width:400px;margin:12vh auto 0;padding:32px 24px 28px;border-radius:var(--r-sheet);background:var(--raised);text-align:center;display:flex;flex-direction:column;align-items:center}.gone .gi{width:56px;height:56px;margin-bottom:16px}.gone h1{margin:0;font-size:22px;line-height:28px;font-weight:500;letter-spacing:-.03em}.gone p{margin:6px 0 0;color:var(--text-2);text-wrap:balance}.dgrid{display:grid;gap:10px;grid-template-columns:minmax(0,1fr)}@media(min-width:560px){.dgrid{grid-template-columns:repeat(2,minmax(0,1fr))}}.dev{background:var(--raised);border-radius:var(--r-card);padding:8px;display:flex;flex-direction:column;gap:8px;min-width:0}.dev.is-here{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 32%,transparent)}.dev.off{opacity:.5}.dev-top{display:flex;align-items:center;gap:12px;padding:8px 6px 6px 10px}.dev-top .gi{width:32px;height:32px}.dev-id{flex:1;min-width:0;display:flex;flex-direction:column}.dev-name{font-size:16px;line-height:22px;font-weight:500;letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dev-stat{font-size:13px;line-height:18px;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dev-stat.ok-t{color:var(--ok)}.dev-stat.warn-t{color:var(--warn)}.dev-stat.here-t{color:var(--accent)}.dev-use{margin-top:auto;background:var(--field);border-radius:var(--r-row);padding:12px 14px 12px 16px;display:flex;align-items:flex-end;justify-content:space-between;gap:12px;min-height:66px}.use-txt{display:flex;flex-direction:column;min-width:0}.use-lbl{font-size:13px;line-height:18px;color:var(--text-2);white-space:nowrap}.use-val{font-size:17px;line-height:24px;font-weight:500;letter-spacing:-.02em}.spark{display:flex;align-items:flex-end;gap:4px;height:34px}.spark i{width:6px;border-radius:3px;background:var(--bar);transition:background-color .15s}.spark i.today{background:var(--accent)}.spark i:hover{background:var(--text-2)}.spark i.today:hover{background:color-mix(in srgb,var(--accent) 75%,var(--text))}.dev .setup-btn{margin-top:auto}.upd-pill{display:inline-flex;align-items:center;align-self:center;gap:6px;height:32px;padding:0 12px 0 10px;border-radius:999px;flex:none;background:color-mix(in srgb,var(--warn) 14%,transparent);color:var(--warn);font-size:13px;font-weight:600;transition:background-color .15s,transform .15s var(--ease-out)}.upd-pill:hover{background:color-mix(in srgb,var(--warn) 22%,transparent)}.upd-pill:active{transform:scale(.94)}.upd-pill .i{width:14px;height:14px}.dev.add{align-items:center;justify-content:center;min-height:144px;gap:10px;color:var(--text-2);font-weight:500;transition:background-color .2s var(--ease-out),transform .2s var(--ease-out)}.dev.add:hover{background:color-mix(in srgb,var(--raised),var(--knob) 45%)}.dev.add:active{transform:scale(.98)}.dev.add .gi{width:36px;height:36px}.dev.first{grid-column:1 / -1;align-items:center;text-align:center;padding:28px 24px 24px;gap:6px}.dev.first .gi{width:44px;height:44px;margin-bottom:8px}.dev.first b{font-size:18px;line-height:24px;font-weight:500;letter-spacing:-.02em}.dev.first p{margin:0 0 14px;color:var(--text-2);font-size:14px;line-height:20px;max-width:34ch;text-wrap:balance}.dev.first .btn{max-width:320px}.reach2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.reach-tile{position:relative;display:flex;flex-direction:column;gap:1px;padding:12px 12px 12px 14px;border-radius:16px;background:var(--field);min-width:0}.reach-tile .rt-ic{width:28px;height:28px;margin-bottom:10px}.reach-tile b{font-size:14px;line-height:20px;font-weight:500;letter-spacing:-.015em}.reach-tile .rt-sub{font-size:12px;line-height:16px;color:var(--text-2)}.reach-tile .rt-mark{position:absolute;top:12px;right:12px;width:20px;height:20px;border-radius:50%;display:grid;place-items:center;background:var(--ok-soft);color:var(--ok)}.reach-tile .rt-mark .i{width:12px;height:12px;stroke-width:2.4}.reach-tile.off b{color:var(--text-2)}.reach-tile.off .rt-sub{color:var(--text-3)}.reach-tile.off .rt-ic{opacity:.45}.reach-tile.off .rt-mark{background:var(--knob);color:var(--text-3)}.lbl-s{font-size:12px;font-weight:500;color:var(--text-2)}.names{display:flex;flex-wrap:wrap;gap:6px}.namechip{display:inline-flex;align-items:center;gap:8px;height:32px;padding:0 10px 0 12px;border-radius:10px;background:var(--field);font-family:var(--mono);font-size:13px;letter-spacing:0;transition:background-color .15s,transform .15s var(--ease-out)}.namechip:hover{background:var(--knob)}.namechip:active{transform:scale(.96)}.namechip .faint{color:var(--text-3)}.namechip .i{width:14px;height:14px;color:var(--text-2)}.ring{width:16px;height:16px;transform:rotate(-90deg)}.ring .trk{stroke:var(--bar)}.ring .arc{stroke:var(--accent)}.ring .arc.warn{stroke:var(--warn)}.ring .arc.bad{stroke:var(--bad)}.month{display:flex;flex-direction:column;gap:8px}.mbars{display:flex;align-items:flex-end;gap:3px;height:64px}.mbars i{flex:1;border-radius:2.5px;background:var(--bar);min-height:3px;transition:background-color .12s}.mbars i.future{background:color-mix(in srgb,var(--bar) 45%,transparent)}.mbars i.today{background:var(--accent)}.mbars i:not(.future):hover{background:var(--text-2)}.month-axis{position:relative;display:flex;justify-content:space-between;font-size:11px;color:var(--text-3);font-weight:500}.month-axis .td{position:absolute;transform:translate(-50%);color:var(--accent)}.month-axis .hide{visibility:hidden}.month-read{display:flex;justify-content:space-between;align-items:baseline;margin-top:10px;font-size:13px;color:var(--text-2)}.month-read b{color:var(--text);font-weight:500;font-size:15px;letter-spacing:-.02em}.meter{height:6px;border-radius:3px;background:var(--bar);overflow:hidden}.meter>i{display:block;height:100%;border-radius:3px;background:var(--accent)}.meter>i.warn{background:var(--warn)}.meter>i.bad{background:var(--bad)}.until{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 16px;border-radius:16px;background:var(--field)}.until-num{display:flex;flex-direction:column;min-width:0}.until-num b{font-size:36px;line-height:40px;font-weight:600;letter-spacing:-.045em}.until-num span{font-size:13px;line-height:18px;color:var(--text-2)}.until-num .until-sub{margin-top:8px;font-size:12px;color:var(--text-3)}.until.soon .until-num b{color:var(--warn)}.cal{display:flex;flex-direction:column;gap:6px;flex:none}.cal-h,.cal-g{display:grid;grid-template-columns:repeat(7,10px);gap:5px}.cal-h span{font-size:9px;line-height:10px;font-weight:600;color:var(--text-3);text-align:center}.cal-g i{width:10px;height:10px;border-radius:3px;background:color-mix(in srgb,var(--text) 16%,transparent)}.cal-g i.past{background:color-mix(in srgb,var(--text) 5%,transparent)}.cal-g i.today{background:var(--accent)}.cal-g i.end{background:transparent;box-shadow:inset 0 0 0 1.5px var(--accent)}.cal-g i.after{background:transparent}.until.soon .cal-g i.today{background:var(--warn)}.until.soon .cal-g i.end{box-shadow:inset 0 0 0 1.5px var(--warn)}.acc-row.open .cal-g i{animation:cal-in .36s var(--ease-out) backwards;animation-delay:calc(var(--i) * 7ms)}@keyframes cal-in{0%{opacity:0;transform:scale(.4)}}.hours{display:flex;flex-direction:column;gap:8px;padding:14px 16px;border-radius:16px;background:var(--field)}.hours-top{display:flex;justify-content:space-between;align-items:baseline;font-size:13px;color:var(--text-2)}.hours-top b{color:var(--text);font-weight:500;font-size:15px;letter-spacing:-.02em}.hours-bar{position:relative;height:8px;border-radius:4px;background:color-mix(in srgb,var(--text) 8%,transparent)}.hours-bar i{position:absolute;top:0;bottom:0;border-radius:4px;background:color-mix(in srgb,var(--ok) 70%,transparent)}.hours-now{position:absolute;top:-4px;width:2px;height:16px;margin-left:-1px;border-radius:1px;background:var(--text);box-shadow:0 0 0 2px var(--field)}.hours-now.out{background:var(--warn)}.hours-axis{display:flex;justify-content:space-between;font-size:10px;color:var(--text-3);font-weight:500}@media(prefers-reduced-motion:reduce){.acc-row.open .cal-g i{animation:none}}.sheet-root{position:fixed;inset:0;z-index:50;display:none}.sheet-root.open{display:block}.scrim{position:absolute;inset:0;background:var(--scrim);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.sheet{position:absolute;left:var(--gutter-l);right:var(--gutter-r);bottom:calc(16px + env(safe-area-inset-bottom,0px));margin:0 auto;max-width:400px;max-height:calc(100% - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));background:var(--raised);border-radius:var(--r-sheet);box-shadow:var(--sheet-shadow);overflow:hidden;display:flex;flex-direction:column}@media(min-width:760px){.sheet-root.open{display:flex;align-items:center;justify-content:center}.sheet{position:relative;left:auto;right:auto;bottom:auto;margin:0;width:calc(100% - var(--gutter-l) - var(--gutter-r))}}.sheet .x{position:absolute;z-index:3;right:22px;top:22px}.vp{position:relative;overflow:hidden;flex:none}.sheet-scroll{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}.view{padding:0 24px 24px;display:flex;flex-direction:column}.vhead{display:flex;align-items:center;gap:12px;height:76px;padding-right:44px;flex:none;cursor:grab;touch-action:none}.vhead h2{flex:1;margin:0;font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.vhead.center h2{text-align:center}.vhead.with-acts{padding-right:126px}.vsub{margin:-16px 0 18px;color:var(--text-2);font-size:14px;line-height:20px}.vhead.center+.vsub{text-align:center;margin:-6px auto 24px;max-width:32ch;text-wrap:balance}.kinds-note{margin:14px 2px 16px}.view>.hint.bad-t{margin-top:8px}.secure-note{margin-top:12px;text-align:center}.sheet-acts{position:absolute;z-index:3;top:22px;right:58px}.hpill{position:relative;display:flex;gap:2px}.hp-b{display:grid;place-items:center;width:38px;height:32px;background:var(--knob);color:var(--text);transition:background-color .15s,transform .15s var(--ease-out)}.hp-b:first-of-type{border-radius:16px 6px 6px 16px}.hp-b:last-of-type{border-radius:6px 16px 16px 6px}.hp-b .i{width:16px;height:16px}.hp-b:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.hp-b:active{transform:scale(.94)}.hp-b.done{color:var(--ok)}.hp-tip{position:absolute;z-index:4;left:0;top:calc(100% + 8px);height:26px;padding:0 10px;display:flex;align-items:center;border-radius:999px;background:var(--toast);color:var(--toast-fg);font:500 12px/1 var(--font);letter-spacing:-.1px;white-space:nowrap;box-shadow:0 0 0 1px var(--line-glass),var(--pop-shadow);opacity:0;pointer-events:none;overflow:hidden;transform-origin:50% 0}.hp-tip.on{opacity:1}.hp-tip .tt{position:relative;display:inline-flex;justify-content:center;white-space:nowrap}.hp-tip .tt-m{position:absolute;left:0;top:0;visibility:hidden;white-space:nowrap}.sheet .x,.sheet-acts{transition:transform .15s var(--ease-out),background-color .15s,opacity .24s var(--ease-out),filter .24s var(--ease-out),scale .24s var(--ease-out)}.sheet.arrived .x,.sheet.arrived .sheet-acts,.sheet.asks .x{opacity:0;filter:blur(3px);scale:.9;pointer-events:none}.center-col,.ask{display:flex;flex-direction:column}.center-col{align-items:center;text-align:center}.ask{align-items:flex-start;text-align:left;padding-top:24px}.center-col.secure{padding-top:4px}:is(.center-col,.ask) .gi.xl{width:64px;height:64px;margin:8px 0 16px}.ask .gi.xl{margin:0 0 18px}:is(.center-col,.ask) h3{margin:0;font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.5px}:is(.center-col,.ask) p{margin:6px 0 22px;color:var(--text-2);font-size:15px;line-height:21px}.center-col p{max-width:30ch;text-wrap:balance}.ask p{text-wrap:pretty}.center-col.secure p{margin-top:0}.btnrow{display:flex;gap:8px;width:100%}.btnrow .btn{flex:1}.btnrow2{display:grid;gap:8px}.btnrow2 .btn{width:100%}.setup{display:flex;flex-direction:column}.setup .notice{margin:0 0 16px}.steps-gap{height:22px}.step{display:flex;gap:12px}.step+.step{margin-top:20px}.step-n{width:24px;height:24px;border-radius:50%;background:var(--knob);font-size:13px;font-weight:600;display:grid;place-items:center;flex:none}.step-b{flex:1;min-width:0;display:flex;flex-direction:column;gap:10px}.step-t{font-size:16px;line-height:24px;font-weight:500;letter-spacing:-.02em}.step-box{display:flex;flex-direction:column;gap:10px}.way{display:flex;flex-direction:column;padding:12px 14px;border-radius:20px;background:var(--field);margin-bottom:18px}.way-row{display:flex;align-items:center;gap:10px}.way-end{width:34px;height:34px;border-radius:11px;background:var(--knob);display:grid;place-items:center;flex:none;color:var(--text-2);transition:background-color .4s var(--ease-out),color .4s var(--ease-out)}.way-end .i{width:17px;height:17px}.way-end.home{color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,transparent)}.way-track{position:relative;flex:1;height:8px}.way-track:before,.way-glow,.way-fill{content:"";position:absolute;inset:0;-webkit-mask:radial-gradient(circle,#000 1.4px,transparent 1.9px) 0 50% / 9px 8px repeat-x;mask:radial-gradient(circle,#000 1.4px,transparent 1.9px) 0 50% / 9px 8px repeat-x}.way-track:before{background:var(--text-3);opacity:.8}.way-glow{overflow:hidden;transition:opacity .2s var(--ease-out)}.way-glow i{position:absolute;inset:0;background:linear-gradient(90deg,transparent 32%,var(--accent) 50%,transparent 68%);transform:translate(-70%);animation:way-run 2s cubic-bezier(.45,0,.55,1) infinite}@keyframes way-run{0%{transform:translate(-70%)}72%,to{transform:translate(70%)}}.way-fill{background:var(--ok);clip-path:inset(0 100% 0 0);transition:clip-path .7s var(--ease-out) 80ms}.way.done .way-fill{clip-path:inset(0)}.way.done .way-glow,.way.stopped .way-glow{opacity:0}.way.done .way-end{color:var(--ok);background:var(--ok-soft)}.way.done .way-end.home{transition-delay:.6s}.way.done .way-end.home .i{animation:way-pop .42s var(--spring-bouncy, ease) .6s backwards}@keyframes way-pop{0%{transform:scale(.6)}to{transform:none}}.way-text{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:30px;margin-top:10px;text-align:center}.way-text .t{display:flex;flex-direction:column;align-items:center;min-width:0}.way-text b{position:relative;display:inline-flex;justify-content:center;white-space:nowrap;font-weight:500;font-size:14px;line-height:20px;transition:color .3s var(--ease-out)}.way-text .ws{color:var(--text-2);font-size:13px;line-height:18px}.way.done .way-text b{color:var(--ok)}.filecard{display:flex;flex-direction:column;gap:10px;padding:12px;border-radius:18px;background:var(--field)}.fc-row{display:flex;align-items:center;gap:12px;min-width:0}.filecard-ic{width:38px;height:46px;border-radius:9px;background:var(--knob);font:600 10px/1 var(--mono);display:grid;place-items:center;color:var(--text-2);flex:none}.filecard .t{flex:1;min-width:0;display:flex;flex-direction:column}.filecard .t .mono{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.filecard .t span:last-child{font-size:12px;color:var(--text-2);line-height:16px}.confbar{display:flex;gap:8px}.conf{margin:0;padding:12px 14px;border-radius:14px;background:var(--field);font:12px/18px var(--mono);max-height:16rem;overflow:auto;white-space:pre;color:var(--text-2)}.conf .k{color:var(--text)}.conf .sec{color:var(--accent)}.conf .mask{color:var(--text-3);letter-spacing:1px}.osm{white-space:normal}.osm-ic{display:inline-grid;width:1.05em;height:1.05em;margin-right:.25em;vertical-align:-.16em}.osm-ic>svg{grid-area:1 / 1;width:100%;height:100%}.osm-ic .eye{fill:var(--field)}.osm-p{display:inline-block;white-space:pre}.scanline{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:.3em}.scanline .osm{white-space:nowrap}@media(max-width:440px){.scanline{flex-direction:column;align-items:flex-start}}.way-text b .mt-old{color:var(--text-2)}@media(prefers-reduced-motion:reduce){.way-glow{display:none}.way-fill{transition:none}.way.done .way-end.home .i{animation:none}}.menu{position:fixed;z-index:60;min-width:224px;padding:6px;border-radius:20px;background:var(--field);box-shadow:var(--pop-shadow),inset 0 0 0 1px var(--line)}.menu-hl{position:absolute;left:6px;right:6px;top:6px;height:40px;border-radius:14px;background:var(--knob);opacity:0;transition:opacity .15s var(--ease-out);pointer-events:none}.menu-hl.moving{transition:opacity .15s var(--ease-out),transform var(--spring-quick-dur, .3s) var(--spring-quick, ease-out),background-color .15s}.menu-hl.bad{background:var(--bad-soft)}.menu-hl.warn{background:color-mix(in srgb,var(--warn) 13%,transparent)}.mi{position:relative;z-index:1;display:flex;align-items:center;gap:12px;width:100%;height:40px;padding:0 12px;border-radius:14px;font-size:14px;font-weight:500;text-align:left}.mi .i{width:16px;height:16px;color:var(--text-2)}.mi .i.off{visibility:hidden}.mi.warn,.mi.warn .i{color:var(--warn)}.mi.bad,.mi.bad .i{color:var(--bad)}.menu-sep{height:1px;margin:6px 12px;background:var(--line)}.toasts{position:fixed;left:0;right:0;height:42px;bottom:calc(24px + env(safe-area-inset-bottom,0px));z-index:70;display:flex;justify-content:center;align-items:flex-end;pointer-events:none;padding-left:var(--gutter-l);padding-right:var(--gutter-r)}.toast{position:absolute;display:flex;align-items:center;gap:8px;height:42px;padding:0 18px 0 13px;border-radius:999px;background:var(--toast);color:var(--toast-fg);font-size:14px;font-weight:500;box-shadow:var(--pop-shadow);white-space:nowrap}.toast .i{width:18px;height:18px;color:var(--ok)}.toast.bad .i{color:var(--bad)} +@font-face{font-family:Geist;src:url(geist-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2190-21FF,U+2212,U+2215}@font-face{font-family:Geist;src:url(geist-cyrillic-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap;unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Geist Mono;src:url(geist-mono-latin-wght-normal.woff2) format("woff2");font-weight:100 900;font-display:swap}:root{color-scheme:dark;--bg: #080808;--raised: #121212;--field: #161616;--knob: #232323;--seg: rgba(237, 237, 237, .05);--seg-shadow: none;--line: rgba(255, 255, 255, .06);--text: #ededed;--text-2: #8c8c8a;--text-3: #4f4f4e;--accent: #4eafff;--accent-ink: #ffffff;--accent-soft: rgba(78, 175, 255, .13);--ok: #57d64b;--ok-soft: rgba(87, 214, 75, .14);--warn: #ff8a3d;--bad: #ff5c5c;--bad-soft: rgba(255, 92, 92, .13);--sel-bg: rgba(131, 209, 255, .25);--sel-fg: #64c6ff;--scrim: rgba(8, 8, 8, .8);--line-glass: rgba(255, 255, 255, .07);--pop-shadow: 0 18px 48px -14px rgba(0, 0, 0, .75);--sheet-shadow: 0 24px 64px -16px rgba(0, 0, 0, .6);--bar: rgba(237, 237, 237, .13);--toast: #232323;--toast-fg: #ededed;--qr-bg: #0a0a0a;--gi-a: rgba(255, 255, 255, .58);--gi-b: rgba(255, 255, 255, .14);--gi-rim: rgba(255, 255, 255, .5);--gi-edge: rgba(0, 0, 0, 0);--gi-detail: #ffffff;--t-grey-a: #cfcfcd;--t-grey-b: #5a5a59;--t-blue-a: #a6d9ff;--t-blue-b: #1d84e6;--t-green-a: #a8f29c;--t-green-b: #3aa32c;--t-red-a: #ffadad;--t-red-b: #dc3a3a;--t-orange-a: #ffc08f;--t-orange-b: #ec6a12;--font: Geist, -apple-system, system-ui, "Segoe UI", sans-serif;--mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;--r-sheet: 36px;--r-card: 28px;--r-row: 20px;--r-field: 16px;--r-tile: 12px;--ease-out: cubic-bezier(.23, 1, .32, 1);--gutter-l: max(16px, env(safe-area-inset-left, 0px));--gutter-r: max(16px, env(safe-area-inset-right, 0px))}@media(prefers-color-scheme:light){:root{color-scheme:light;--bg: #f2f2f1;--raised: #ffffff;--field: #f3f3f2;--knob: #e8e8e7;--seg: #ffffff;--seg-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 .5px rgba(0, 0, 0, .05);--line: rgba(0, 0, 0, .07);--text: #0b0b0b;--text-2: #6d6d6b;--text-3: #a6a6a4;--accent: #2b9dff;--accent-soft: rgba(43, 157, 255, .12);--ok: #33a328;--ok-soft: rgba(51, 163, 40, .12);--warn: #ee6a12;--bad: #e5484d;--bad-soft: rgba(229, 72, 77, .1);--sel-bg: rgba(78, 175, 255, .22);--sel-fg: #0a76cf;--scrim: rgba(236, 236, 235, .62);--line-glass: rgba(0, 0, 0, .07);--pop-shadow: 0 18px 44px -14px rgba(0, 0, 0, .2);--sheet-shadow: 0 24px 64px -18px rgba(0, 0, 0, .22);--bar: rgba(11, 11, 11, .11);--toast: #0b0b0b;--toast-fg: #f2f2f1;--qr-bg: #ffffff;--gi-a: rgba(250, 250, 249, .72);--gi-b: rgba(206, 206, 204, .5);--gi-rim: rgba(255, 255, 255, .9);--gi-edge: rgba(0, 0, 0, .11);--gi-detail: rgba(28, 28, 28, .72);--t-grey-a: #a9a9a7;--t-grey-b: #3d3d3c;--t-blue-a: #7cc4ff;--t-blue-b: #0a6fd6;--t-green-a: #82e070;--t-green-b: #2e8a22;--t-red-a: #ff9090;--t-red-b: #c92a2a}}*{box-sizing:border-box}html{-webkit-text-size-adjust:100%;scrollbar-gutter:stable}body{margin:0;background:var(--bg);color:var(--text);font:400 15px/22px var(--font);letter-spacing:-.011em;-webkit-font-smoothing:antialiased;min-height:100vh;min-height:100dvh;cursor:default}body.locked{overflow:hidden}input,textarea,.linkrow .mono,.conf{cursor:text}::selection{background:var(--sel-bg);color:var(--sel-fg)}button{font:inherit;color:inherit;letter-spacing:inherit;background:none;border:0;padding:0;margin:0;cursor:pointer;-webkit-tap-highlight-color:transparent}button:disabled{cursor:default}a{color:inherit;text-decoration:none}:focus{outline:none}:focus-visible{outline:2px solid color-mix(in srgb,var(--accent) 65%,transparent);outline-offset:2px}[hidden]{display:none!important}.offscreen{position:fixed;left:-9999px;top:0;opacity:0}.mono{font-family:var(--mono);letter-spacing:0}.num{font-variant-numeric:tabular-nums}.ok-t{color:var(--ok)}.warn-t{color:var(--warn)}.bad-t{color:var(--bad)}.here-t{color:var(--accent)}.i{width:18px;height:18px;flex:none}.gi{width:24px;height:24px;flex:none;overflow:visible;--ta: var(--t-grey-a);--tb: var(--t-grey-b)}.gi.t-blue{--ta: var(--t-blue-a);--tb: var(--t-blue-b)}.gi.t-green{--ta: var(--t-green-a);--tb: var(--t-green-b)}.gi.t-red{--ta: var(--t-red-a);--tb: var(--t-red-b)}.gi.t-orange{--ta: var(--t-orange-a);--tb: var(--t-orange-b)}.gi .ta{stop-color:var(--ta)}.gi .tb{stop-color:var(--tb)}.gi .fa{stop-color:var(--gi-a)}.gi .fb{stop-color:var(--gi-b)}.gi .fc{stop-color:var(--ta);stop-opacity:.28}.gi .ge{stroke:var(--gi-edge)}.gi .gr{stroke:var(--gi-rim)}.gi .gd{stroke:var(--gi-detail)}.gi .gdf{color:var(--gi-detail)}.knob{width:32px;height:32px;border-radius:50%;background:var(--knob);color:var(--text);display:grid;place-items:center;flex:none;transition:transform .15s var(--ease-out),background-color .15s}.knob:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.knob:active{transform:scale(.8)}.knob .i{width:16px;height:16px}.knob.back .i{transform:rotate(180deg)}.knob[aria-expanded=true]{background:color-mix(in srgb,var(--knob),var(--text) 10%)}.btn{height:48px;border-radius:999px;display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:0 20px;font-size:16px;font-weight:500;letter-spacing:-.015em;user-select:none;-webkit-user-select:none;transition:transform .2s var(--ease-out),background-color .2s var(--ease-out),color .2s var(--ease-out)}.btn:active{transform:scale(.95)}.btn.block{width:100%}.btn.sm{height:40px;font-size:15px;padding:0 16px}.btn.accent{background:var(--accent);color:var(--accent-ink);font-weight:600}.btn.accent:hover{background:color-mix(in srgb,var(--accent) 82%,transparent)}.btn.tint{background:var(--accent-soft);color:var(--accent);font-weight:600}.btn.tint:hover{background:color-mix(in srgb,var(--accent) 20%,transparent)}.btn.tint:active{background:color-mix(in srgb,var(--accent) 24%,transparent)}.btn.soft{background:var(--knob);color:var(--text)}.btn.soft:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.btn.red{background:var(--bad);color:#fff;font-weight:600}.busy{position:relative}.orb{position:absolute;inset:0;margin:auto;width:28px;height:28px;overflow:hidden;contain:strict;pointer-events:none}.orb i{position:absolute;left:50%;top:50%;width:7px;height:7px;margin:-3.5px 0 0 -3.5px;border-radius:50%;background:currentColor;animation:orb-converge 1.8s linear infinite both}.orb i:nth-child(2){animation:orb-breathe 1.8s ease-in-out infinite both}@keyframes orb-converge{0%{transform:translateY(-5px) scale(1);filter:blur(0);animation-timing-function:linear}10%{transform:translateY(-5px) scale(1);filter:blur(0);animation-timing-function:cubic-bezier(.55,0,1,.45)}22%{transform:translate(2.15px,-1.25px) scale(.72);filter:blur(.8px);animation-timing-function:cubic-bezier(.33,1,.68,1)}33%{transform:translate(4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:linear}43%{transform:translate(4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:cubic-bezier(.55,0,1,.45)}55%{transform:translateY(2.5px) scale(.72);filter:blur(.8px);animation-timing-function:cubic-bezier(.33,1,.68,1)}66%{transform:translate(-4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:linear}77%{transform:translate(-4.3px,2.5px) scale(1);filter:blur(0);animation-timing-function:cubic-bezier(.55,0,1,.45)}88%{transform:translate(-2.15px,-1.25px) scale(.72);filter:blur(.8px);animation-timing-function:cubic-bezier(.33,1,.68,1)}to{transform:translateY(-5px) scale(1);filter:blur(0)}}@keyframes orb-breathe{0%,to{opacity:.16;filter:blur(2.4px);transform:scale(1.2)}50%{opacity:.32;filter:blur(1.6px);transform:scale(.98)}}.field{height:48px;border-radius:var(--r-field);background:var(--field);display:flex;align-items:center;gap:12px;padding:0 4px 0 16px;overflow:hidden;transition:box-shadow .2s var(--ease-out)}.field:focus-within{box-shadow:inset 0 0 0 1.5px color-mix(in srgb,var(--text) 16%,transparent)}.field input{flex:1;min-width:0;border:0;outline:0;background:transparent;padding:0;font:500 16px/24px var(--font);color:var(--text);letter-spacing:-.012em}.field input::placeholder{color:var(--text-3)}.go{width:48px;height:40px;border-radius:12px;background:var(--knob);color:var(--text-3);display:grid;place-items:center;flex:none;transition:background-color .2s var(--ease-out),color .2s var(--ease-out),transform .2s var(--ease-out)}.go .i{width:20px;height:20px}.go.ready{background:var(--accent);color:var(--accent-ink)}.go.ready:active{transform:scale(.9)}.go:not(.ready){cursor:not-allowed}.seg{position:relative;display:flex;align-items:center;height:48px;padding:0 4px;border-radius:var(--r-field);background:var(--field)}.seg-pill{position:absolute;left:0;top:4px;height:40px;border-radius:12px;background:var(--seg);box-shadow:var(--seg-shadow);pointer-events:none}.seg-b{position:relative;z-index:1;height:40px;font-size:16px;font-weight:500;color:var(--text-3);white-space:nowrap;transition:color .2s var(--ease-out)}.seg-b.on{color:var(--text)}.seg-b:not(.on):hover{color:var(--text-2)}.appseg .seg-b{flex:0 0 56px;display:flex;align-items:center;justify-content:center;justify-content:safe center;gap:8px;padding:0 18px;overflow:hidden}.appseg .seg-b.on{flex:1 1 56px}.appseg .seg-b .i{width:20px;height:20px}.appseg .seg-l{max-width:0;opacity:0;margin-left:-8px;overflow:hidden;white-space:nowrap}.appseg .seg-b.on .seg-l{max-width:180px;opacity:1;margin-left:0}.appseg{container-type:inline-size}@container (max-width: 300px){.appseg .seg-b{flex-basis:44px;padding:0 12px}}.kinds{display:grid;grid-template-columns:repeat(var(--n, 4),minmax(0,1fr));gap:8px;position:relative;container-type:inline-size}.kind{position:relative;z-index:1;display:flex;flex-direction:column;align-items:center;gap:8px;min-width:0;color:var(--text-3);font-size:12px;line-height:16px;font-weight:500;transition:color .2s var(--ease-out)}.kind-tile{width:100%;height:56px;border-radius:14px;background:var(--field);display:grid;place-items:center;transition:background-color .2s var(--ease-out),transform .2s var(--ease-out),box-shadow .22s var(--ease-out)}.kind.on .kind-tile{box-shadow:inset 0 0 0 1.5px var(--accent)}.kind-lbl{white-space:nowrap}.kind:hover .kind-tile,.kind:focus-visible .kind-tile{background:var(--knob)}.kind:active .kind-tile{transform:scale(.94)}.kind:focus-visible{outline:none}.kind:focus-visible .kind-lbl,.kind.on{color:var(--text)}.kind .gi{width:26px;height:26px;filter:grayscale(1);opacity:.55;transition:filter .26s var(--ease-out),opacity .26s var(--ease-out)}.kind.on .gi{filter:none;opacity:1}@container (max-width: 330px){.kind-tile{height:50px}.kind{font-size:11.5px}}.or{display:flex;align-items:center;gap:12px;margin:22px 0;color:var(--text-3);font-size:12px;font-weight:500;letter-spacing:.06em}.or:before,.or:after{content:"";flex:1;height:1px;background:var(--line)}.badge{width:100%;text-align:left;display:flex;align-items:center;gap:12px;height:60px;padding:0 14px 0 12px;border-radius:18px;background:var(--field);transition:background-color .2s,transform .2s var(--ease-out)}.badge:hover{background:var(--knob)}.badge:active{transform:scale(.98)}.badge .b-ic{width:36px;height:36px;border-radius:10px;background:var(--text);color:var(--raised);display:grid;place-items:center;flex:none}.badge .b-ic .i{width:20px;height:20px}.badge .b-t{flex:1;min-width:0;display:flex;flex-direction:column}.badge .b-top{font-size:12px;line-height:16px;color:var(--text-2)}.badge .b-main{font-size:15px;line-height:20px;font-weight:500}.badge>.i{color:var(--text-3);width:16px;height:16px}.badge.primary .b-ic{background:var(--accent-soft);color:var(--accent)}.badges2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.badges2 .badge{padding:0 10px;gap:10px}.badges2 .badge>.i{display:none}.badges2 .b-ic{width:32px;height:32px}.hint{margin:0;font-size:13px;line-height:18px;color:var(--text-2)}.hint a,.hint button{color:var(--accent);font-weight:500}.howto{margin:0;padding:0;list-style:none;display:flex;flex-wrap:wrap;align-items:center;gap:6px;font-size:13px;color:var(--text-2)}.howto li{display:inline-flex;align-items:center;gap:6px}.howto li+li:before{content:"\203a";color:var(--text-3)}.howto b{color:var(--text);font-weight:500}.linkrow{display:flex;align-items:center;gap:8px;height:44px;padding:0 4px 0 14px;border-radius:14px;background:color-mix(in srgb,var(--knob) 72%,var(--field))}.view>.linkrow{background:var(--field)}.linkrow .mono{flex:1;min-width:0;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;user-select:all}.linkrow .knob{width:36px;height:36px;border-radius:10px;background:transparent}.linkrow .knob:hover{background:var(--knob)}.qrbox{position:relative;width:148px;height:148px;flex:none;border-radius:18px;overflow:hidden;background:var(--qr-bg)}.qrbox.light{box-shadow:inset 0 0 0 1px var(--line)}.qrbox.big{width:208px;height:208px;border-radius:24px;align-self:center}.qrbox.big+.linkrow{margin-top:16px}.qrbox.dense{width:100%;max-width:none;height:auto;aspect-ratio:1;align-self:stretch;border-radius:22px}.qrbox svg{display:block;width:100%;height:100%}.qrbox>svg.old{position:absolute;inset:0}.coderow{display:flex;gap:14px;align-items:flex-start}.coderow.stacked{flex-direction:column;align-items:stretch}.coderow .side{position:relative;display:flex;flex-direction:column;gap:8px;min-width:0;font-size:14px;line-height:20px;color:var(--text-2)}.coderow .side b{color:var(--text);font-weight:500}.side .words{display:flex;flex-direction:column;gap:8px}.side .words.old{position:absolute;left:0;right:0;top:0;pointer-events:none}.side .arr{color:var(--text-2);font-weight:400;margin:0 6px}@media(max-width:380px){.coderow{flex-direction:column}}@media(prefers-reduced-motion:reduce){.orb i{animation:none;opacity:.3;filter:blur(1.4px)}.orb i:first-child{opacity:1;filter:none}}.mt{position:relative}.mt-ib{display:inline-block;white-space:nowrap}.mt-new{white-space:nowrap}.mt-old{position:absolute;white-space:nowrap;pointer-events:none}.mt-new.w,.mt-old.w{white-space:inherit}.mt-new i,.mt-old i{font-style:normal;display:inline-block;white-space:pre}.bars{--gap: 3px;position:relative;display:flex;flex:none;margin-inline:calc(var(--gap) / -2)}.bars-week{--gap: 4px}.bars .col{display:flex;flex-direction:column;padding-inline:calc(var(--gap) / 2)}.bars-month .col{flex:1;min-width:0}.bars .half{display:flex;flex-direction:column}.bars .half.top{justify-content:flex-end;margin-bottom:3px}.bars i{display:block;border-radius:2.5px;transition:background-color .12s}.bars-week i{width:6px;border-radius:3px;transition-duration:.15s}.bars .dn{background:color-mix(in srgb,var(--text) 24%,transparent)}.bars .up{background:color-mix(in srgb,var(--text) 11%,transparent)}.bars .today .dn{background:var(--accent)}.bars .today .up{background:color-mix(in srgb,var(--accent) 45%,transparent)}.bars .col:not(.future):hover .dn{background:var(--text-2)}.bars .col:not(.future):hover .up{background:color-mix(in srgb,var(--text-2) 50%,transparent)}.bars .today:hover .dn{background:color-mix(in srgb,var(--accent) 75%,var(--text))}.bars .future i{height:3px;background:color-mix(in srgb,var(--bar) 45%,transparent)}.bars .axis{position:absolute;left:calc(var(--gap) / 2);right:calc(var(--gap) / 2);height:1px;background:var(--line);pointer-events:none}.ud{display:inline-flex;align-items:center;gap:10px;white-space:nowrap}.ud>span{display:inline-flex;align-items:center;gap:2px}.ud .i{width:.8em;height:.8em;stroke-width:2.2;color:var(--text-2)}.ud-dn .i{transform:rotate(90deg)}.ud-up{color:var(--text-2)}.ud-up .i{transform:rotate(-90deg);color:var(--text-3)}.acc{display:flex;flex-direction:column}.acc-row{background:var(--raised);overflow:hidden;border-radius:0;padding:0 8px;transition:background-color .15s}.acc-row.rt{border-top-left-radius:var(--r-row);border-top-right-radius:var(--r-row)}.acc-row.rb{border-bottom-left-radius:var(--r-row);border-bottom-right-radius:var(--r-row)}.acc-row.open{margin-block:10px}.acc-row.open:first-child{margin-top:0}.acc-row.open:last-child{margin-bottom:0}.acc-row:not(.open):not(.still):hover{background:color-mix(in srgb,var(--raised),var(--knob) 40%)}.acc-head{width:100%;display:flex;align-items:center;gap:10px;height:52px;padding:0 6px 0 8px;text-align:left}.acc-row.still .acc-head{cursor:default;padding-right:10px}.acc-head .gi{width:22px;height:22px}.acc-title{flex:1;min-width:0;font-size:15px;font-weight:500;letter-spacing:-.02em;display:flex;align-items:center;gap:8px}.acc-title .t{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.acc-val{display:flex;align-items:center;gap:8px;color:var(--text-2);font-size:14px;white-space:nowrap;transition:opacity .2s var(--ease-out),filter .2s var(--ease-out),transform .26s var(--ease-out)}.acc-val>span{display:inline-flex;align-items:center;gap:8px}.acc-row.open .acc-val.hide-open{opacity:0;filter:blur(4px);transform:translate(8px);pointer-events:none}.acc-chev{width:16px;height:16px;color:var(--text-2);transform:rotate(90deg);transition:transform var(--spring-soft-dur, .47s) var(--spring-soft, ease)}.acc-row.open .acc-chev{transform:rotate(-90deg)}.acc-body{display:none;padding:0 8px 16px 40px}.acc-row.open .acc-body,.acc-row.closing .acc-body{display:flex;flex-direction:column;gap:12px}.acc .desc{margin:0;font-size:14px;line-height:20px;opacity:.6}.acc.inset .acc-row{background:var(--field)}.acc.inset .acc-row:not(.open):not(.still):hover{background:color-mix(in srgb,var(--field),var(--knob) 50%)}.acc.inset .acc-body{padding-left:8px}.acc.inset .seg{background:color-mix(in srgb,var(--knob) 65%,var(--field))}@media(prefers-reduced-motion:reduce){.acc-chev{transition:none}}.edge-fade{position:fixed;left:0;right:0;z-index:30;pointer-events:none}.edge-fade.top{top:0;height:calc(80px + env(safe-area-inset-top,0px));opacity:0;transition:opacity .2s;background:linear-gradient(var(--bg) 0%,color-mix(in srgb,var(--bg) 75%,transparent) 50%,transparent 100%);-webkit-backdrop-filter:blur(12px);backdrop-filter:blur(12px);-webkit-mask-image:linear-gradient(#000 0%,rgba(0,0,0,.88) 44%,transparent 100%);mask-image:linear-gradient(#000 0%,rgba(0,0,0,.88) 44%,transparent 100%)}body.scrolled .edge-fade.top{opacity:1}.edge-fade.bot{bottom:0;height:calc(96px + env(safe-area-inset-bottom,0px));background:linear-gradient(to top in oklab,var(--bg) 0%,transparent 100%)}.crumbs{display:flex;align-items:center;gap:10px;height:32px;margin:0 0 32px}.cr-mark{width:32px;height:32px;display:grid;place-items:center;flex:none}.logo{width:24px;height:24px;flex:none;overflow:hidden}.logo .sun,.logo .bar{fill:var(--text)}.cr-path{flex:1;min-width:0;display:flex;align-items:center;gap:6px;font-size:15px;line-height:22px;letter-spacing:-.15px;color:var(--text-2)}.cr-path span{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.cr-path .cur{color:var(--text);font-weight:500}.cr-path .i{width:14px;height:14px}.cr-lang{display:inline-flex;align-items:center;gap:4px;height:32px;padding:0 8px 0 12px;border-radius:999px;background:var(--knob);color:var(--text);font-size:14px;font-weight:500;letter-spacing:-.01em;flex:none;transition:transform .15s var(--ease-out),background-color .15s}.cr-lang:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.cr-lang:active{transform:scale(.94)}.cr-lang[aria-expanded=true]{background:color-mix(in srgb,var(--knob),var(--text) 10%)}.cr-down{width:14px;height:14px;color:var(--text-2);transform:rotate(90deg);transition:transform .2s var(--ease-out)}.cr-lang[aria-expanded=true] .cr-down{transform:rotate(-90deg)}.page{max-width:1072px;margin:0 auto;padding-left:var(--gutter-l);padding-right:var(--gutter-r);padding-block:calc(40px + env(safe-area-inset-top,0px)) 112px}.cols{display:grid;gap:40px}.cols>.access{order:-1}@media(min-width:960px){.cols{grid-template-columns:minmax(0,1fr) 384px;gap:36px;align-items:start}.cols>.access{order:0;position:sticky;top:calc(84px + env(safe-area-inset-top,0px))}}.sec-head{display:flex;align-items:baseline;gap:8px;padding:0 4px 12px}.sec-head h2{margin:0;font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.025em}.sec-head .aside{color:var(--text-3);font-size:14px;font-weight:500}.sec-head .aside.warn-t{color:var(--warn)}.note-s{margin:12px 4px 0;color:var(--text-3);font-size:13px;line-height:18px}.notice{display:flex;align-items:center;gap:14px;padding:14px 18px 14px 14px;border-radius:24px;background:var(--raised);margin:0 0 22px}.notice .gi{width:36px;height:36px}.notice .t{display:flex;flex-direction:column;min-width:0}.notice b{font-weight:500;font-size:15px;line-height:22px;letter-spacing:-.02em}.notice span{color:var(--text-2);font-size:14px;line-height:20px}.notice.warn{background:color-mix(in srgb,var(--warn) 10%,var(--raised));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--warn) 22%,transparent)}.notice.bad{background:color-mix(in srgb,var(--bad) 10%,var(--raised));box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--bad) 22%,transparent)}.page.single{min-height:100vh;min-height:100dvh;display:flex;flex-direction:column;align-items:center;justify-content:center;padding-block:calc(24px + env(safe-area-inset-top,0px)) calc(24px + env(safe-area-inset-bottom,0px))}.page.single .crumbs{position:relative;left:12px;max-width:calc(100% - 84px);margin:0 0 16px}.page.single .cr-mark{position:absolute;right:calc(100% + 10px);top:0}.page.single .page-body{width:100%;max-width:400px}.page.single .gone{margin:0}.gone{max-width:400px;margin:12vh auto 0;padding:32px 24px 28px;border-radius:var(--r-sheet);background:var(--raised);text-align:center;display:flex;flex-direction:column;align-items:center}.gone .gi{width:56px;height:56px;margin-bottom:16px}.gone h1{margin:0;font-size:22px;line-height:28px;font-weight:500;letter-spacing:-.03em}.gone p{margin:6px 0 0;color:var(--text-2);text-wrap:balance}.dgrid{display:grid;gap:10px;grid-template-columns:minmax(0,1fr)}@media(min-width:560px){.dgrid{grid-template-columns:repeat(2,minmax(0,1fr))}}.dev{background:var(--raised);border-radius:var(--r-card);padding:8px;display:flex;flex-direction:column;gap:8px;min-width:0}.dev.is-here{box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--accent) 32%,transparent)}.dev.off{opacity:.5}.dev-top{display:flex;align-items:center;gap:12px;padding:8px 6px 6px 10px}.dev-top .gi{width:32px;height:32px}.dev-id{flex:1;min-width:0;display:flex;flex-direction:column}.dev-name{font-size:16px;line-height:22px;font-weight:500;letter-spacing:-.02em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dev-stat{font-size:13px;line-height:18px;color:var(--text-2);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.dev-stat.ok-t{color:var(--ok)}.dev-stat.warn-t{color:var(--warn)}.dev-stat.here-t{color:var(--accent)}.dev-use{margin-top:auto;background:var(--field);border-radius:var(--r-row);padding:12px 14px 12px 16px;display:flex;align-items:flex-end;justify-content:space-between;gap:12px;min-height:66px}.use-txt{display:flex;flex-direction:column;min-width:0}.use-lbl{font-size:13px;line-height:18px;color:var(--text-2);white-space:nowrap}.use-val{font-size:17px;line-height:24px;font-weight:500;letter-spacing:-.02em}.dev .setup-btn{margin-top:auto}.upd-pill{display:inline-flex;align-items:center;align-self:center;gap:6px;height:32px;padding:0 12px 0 10px;border-radius:999px;flex:none;background:color-mix(in srgb,var(--warn) 14%,transparent);color:var(--warn);font-size:13px;font-weight:600;transition:background-color .15s,transform .15s var(--ease-out)}.upd-pill:hover{background:color-mix(in srgb,var(--warn) 22%,transparent)}.upd-pill:active{transform:scale(.94)}.upd-pill .i{width:14px;height:14px}.dev.add{align-items:center;justify-content:center;min-height:144px;gap:10px;color:var(--text-2);font-weight:500;transition:background-color .2s var(--ease-out),transform .2s var(--ease-out)}.dev.add:hover{background:color-mix(in srgb,var(--raised),var(--knob) 45%)}.dev.add:active{transform:scale(.98)}.dev.add .gi{width:36px;height:36px}.dev.first{grid-column:1 / -1;align-items:center;text-align:center;padding:28px 24px 24px;gap:6px}.dev.first .gi{width:44px;height:44px;margin-bottom:8px}.dev.first b{font-size:18px;line-height:24px;font-weight:500;letter-spacing:-.02em}.dev.first p{margin:0 0 14px;color:var(--text-2);font-size:14px;line-height:20px;max-width:34ch;text-wrap:balance}.dev.first .btn{max-width:320px}.reach2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}.reach-tile{position:relative;display:flex;flex-direction:column;gap:1px;padding:12px 12px 12px 14px;border-radius:16px;background:var(--field);min-width:0}.reach-tile .rt-ic{width:28px;height:28px;margin-bottom:10px}.reach-tile b{font-size:14px;line-height:20px;font-weight:500;letter-spacing:-.015em}.reach-tile .rt-sub{font-size:12px;line-height:16px;color:var(--text-2)}.reach-tile .rt-mark{position:absolute;top:12px;right:12px;width:20px;height:20px;border-radius:50%;display:grid;place-items:center;background:var(--ok-soft);color:var(--ok)}.reach-tile .rt-mark .i{width:12px;height:12px;stroke-width:2.4}.reach-tile.off b{color:var(--text-2)}.reach-tile.off .rt-sub{color:var(--text-3)}.reach-tile.off .rt-ic{opacity:.45}.reach-tile.off .rt-mark{background:var(--knob);color:var(--text-3)}.lbl-s{font-size:12px;font-weight:500;color:var(--text-2)}.names{display:flex;flex-wrap:wrap;gap:6px}.namechip{display:inline-flex;align-items:center;gap:8px;height:32px;padding:0 10px 0 12px;border-radius:10px;background:var(--field);font-family:var(--mono);font-size:13px;letter-spacing:0;transition:background-color .15s,transform .15s var(--ease-out)}.namechip:hover{background:var(--knob)}.namechip:active{transform:scale(.96)}.namechip .faint{color:var(--text-3)}.namechip .i{width:14px;height:14px;color:var(--text-2)}.ring{width:16px;height:16px;transform:rotate(-90deg)}.ring .trk{stroke:var(--bar)}.ring .arc{stroke:var(--accent)}.ring .arc.warn{stroke:var(--warn)}.ring .arc.bad{stroke:var(--bad)}.month{display:flex;flex-direction:column;gap:8px}.month-axis{position:relative;display:flex;justify-content:space-between;font-size:11px;color:var(--text-3);font-weight:500}.month-axis .td{position:absolute;transform:translate(-50%);color:var(--accent)}.month-axis .hide{visibility:hidden}.month-read{display:flex;justify-content:space-between;align-items:baseline;margin-top:10px;font-size:13px;color:var(--text-2)}.month-read>*{white-space:nowrap}.month-read .ud{color:var(--text);font-weight:500;font-size:15px;letter-spacing:-.02em}.meter{height:6px;border-radius:3px;background:var(--bar);overflow:hidden}.meter>i{display:block;height:100%;border-radius:3px;background:var(--accent)}.meter>i.warn{background:var(--warn)}.meter>i.bad{background:var(--bad)}.until{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 16px;border-radius:16px;background:var(--field)}.until-num{display:flex;flex-direction:column;min-width:0}.until-num b{font-size:36px;line-height:40px;font-weight:600;letter-spacing:-.045em}.until-num span{font-size:13px;line-height:18px;color:var(--text-2)}.until-num .until-sub{margin-top:8px;font-size:12px;color:var(--text-3)}.until.soon .until-num b{color:var(--warn)}.cal{display:flex;flex-direction:column;gap:6px;flex:none}.cal-h,.cal-g{display:grid;grid-template-columns:repeat(7,10px);gap:5px}.cal-h span{font-size:9px;line-height:10px;font-weight:600;color:var(--text-3);text-align:center}.cal-g i{width:10px;height:10px;border-radius:3px;background:color-mix(in srgb,var(--text) 16%,transparent)}.cal-g i.past{background:color-mix(in srgb,var(--text) 5%,transparent)}.cal-g i.today{background:var(--accent)}.cal-g i.end{background:transparent;box-shadow:inset 0 0 0 1.5px var(--accent)}.cal-g i.after{background:transparent}.until.soon .cal-g i.today{background:var(--warn)}.until.soon .cal-g i.end{box-shadow:inset 0 0 0 1.5px var(--warn)}.acc-row.opened .cal-g i{animation:cal-in .36s var(--ease-out) backwards;animation-delay:calc(var(--i) * 7ms)}@keyframes cal-in{0%{opacity:0;transform:scale(.4)}}.hours{display:flex;flex-direction:column;gap:8px;padding:14px 16px;border-radius:16px;background:var(--field)}.hours-top{display:flex;justify-content:space-between;align-items:baseline;font-size:13px;color:var(--text-2)}.hours-top b{color:var(--text);font-weight:500;font-size:15px;letter-spacing:-.02em}.hours-bar{position:relative;height:8px;border-radius:4px;background:color-mix(in srgb,var(--text) 8%,transparent)}.hours-bar i{position:absolute;top:0;bottom:0;border-radius:4px;background:color-mix(in srgb,var(--ok) 70%,transparent)}.hours-now{position:absolute;top:-4px;width:2px;height:16px;margin-left:-1px;border-radius:1px;background:var(--text);box-shadow:0 0 0 2px var(--field)}.hours-now.out{background:var(--warn)}.hours-axis{display:flex;justify-content:space-between;font-size:10px;color:var(--text-3);font-weight:500}@media(prefers-reduced-motion:reduce){.acc-row.opened .cal-g i{animation:none}}.sheet-root{position:fixed;inset:0;z-index:50;display:none}.sheet-root.open{display:block}.scrim{position:absolute;inset:0;background:var(--scrim);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px)}.sheet{position:absolute;left:var(--gutter-l);right:var(--gutter-r);bottom:calc(16px + env(safe-area-inset-bottom,0px));margin:0 auto;max-width:400px;max-height:calc(100% - 32px - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px));background:var(--raised);border-radius:var(--r-sheet);box-shadow:var(--sheet-shadow);overflow:hidden;display:flex;flex-direction:column}@media(min-width:760px){.sheet-root.open{display:flex;align-items:center;justify-content:center}.sheet{position:relative;left:auto;right:auto;bottom:auto;margin:0;width:calc(100% - var(--gutter-l) - var(--gutter-r))}}.sheet .x{position:absolute;z-index:3;right:22px;top:22px}.vp{position:relative;overflow:hidden;flex:none}.sheet-scroll{flex:1 1 auto;min-height:0;overflow-y:auto;overscroll-behavior:contain}.view{padding:0 24px 24px;display:flex;flex-direction:column}.vhead{display:flex;align-items:center;gap:12px;height:76px;padding-right:44px;flex:none;cursor:grab;touch-action:none}.vhead h2{flex:1;margin:0;font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.5px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.vhead.center h2{text-align:center}.vhead.with-acts{padding-right:126px}.vsub{margin:-16px 0 18px;color:var(--text-2);font-size:14px;line-height:20px}.vhead.center+.vsub{text-align:center;margin:-6px auto 24px;max-width:32ch;text-wrap:balance}.kinds-note{margin:14px 2px 16px}.view>.hint.bad-t{margin-top:8px}.secure-note{margin-top:12px;text-align:center}.sheet-acts{position:absolute;z-index:3;top:22px;right:58px}.hpill{position:relative;display:flex;gap:2px}.hp-b{display:grid;place-items:center;width:38px;height:32px;background:var(--knob);color:var(--text);transition:background-color .15s,transform .15s var(--ease-out)}.hp-b:first-of-type{border-radius:16px 6px 6px 16px}.hp-b:last-of-type{border-radius:6px 16px 16px 6px}.hp-b .i{width:16px;height:16px}.hp-b:hover{background:color-mix(in srgb,var(--knob),var(--text) 6%)}.hp-b:active{transform:scale(.94)}.hp-b.done{color:var(--ok)}.hp-tip{position:absolute;z-index:4;left:0;top:calc(100% + 8px);height:26px;padding:0 10px;display:flex;align-items:center;border-radius:999px;background:var(--toast);color:var(--toast-fg);font:500 12px/1 var(--font);letter-spacing:-.1px;white-space:nowrap;box-shadow:0 0 0 1px var(--line-glass),var(--pop-shadow);opacity:0;pointer-events:none;overflow:hidden;transform-origin:50% 0}.hp-tip.on{opacity:1}.hp-tip .tt{position:relative;display:inline-flex;justify-content:center;white-space:nowrap}.hp-tip .tt-m{position:absolute;left:0;top:0;visibility:hidden;white-space:nowrap}.sheet .x,.sheet-acts{transition:transform .15s var(--ease-out),background-color .15s,opacity .24s var(--ease-out),filter .24s var(--ease-out),scale .24s var(--ease-out)}.sheet.arrived .x,.sheet.arrived .sheet-acts,.sheet.asks .x{opacity:0;filter:blur(3px);scale:.9;pointer-events:none}.center-col,.ask{display:flex;flex-direction:column}.center-col{align-items:center;text-align:center}.ask{align-items:flex-start;text-align:left;padding-top:24px}.center-col.secure{padding-top:4px}:is(.center-col,.ask) .gi.xl{width:64px;height:64px;margin:8px 0 16px}.ask .gi.xl{margin:0 0 18px}:is(.center-col,.ask) h3{margin:0;font-size:20px;line-height:28px;font-weight:500;letter-spacing:-.5px}:is(.center-col,.ask) p{margin:6px 0 22px;color:var(--text-2);font-size:15px;line-height:21px}.center-col p{max-width:30ch;text-wrap:balance}.ask p{text-wrap:pretty}.center-col.secure p{margin-top:0}.btnrow{display:flex;gap:8px;width:100%}.btnrow .btn{flex:1}.btnrow2{display:grid;gap:8px}.btnrow2 .btn{width:100%}.setup{display:flex;flex-direction:column}.setup .notice{margin:0 0 16px}.steps-gap{height:22px}.step{display:flex;gap:12px}.step+.step{margin-top:20px}.step-n{width:24px;height:24px;border-radius:50%;background:var(--knob);font-size:13px;font-weight:600;display:grid;place-items:center;flex:none}.step-b{flex:1;min-width:0;display:flex;flex-direction:column;gap:10px}.step-t{font-size:16px;line-height:24px;font-weight:500;letter-spacing:-.02em}.step-box{display:flex;flex-direction:column;gap:10px}.way{display:flex;flex-direction:column;padding:12px 14px;border-radius:20px;background:var(--field);margin-bottom:18px}.way-row{display:flex;align-items:center;gap:10px}.way-end{width:34px;height:34px;border-radius:11px;background:var(--knob);display:grid;place-items:center;flex:none;color:var(--text-2);transition:background-color .4s var(--ease-out),color .4s var(--ease-out)}.way-end .i{width:17px;height:17px}.way-end.home{color:var(--accent);background:color-mix(in srgb,var(--accent) 14%,transparent)}.way-track{position:relative;flex:1;height:8px}.way-track:before,.way-glow,.way-fill{content:"";position:absolute;inset:0;-webkit-mask:radial-gradient(circle,#000 1.4px,transparent 1.9px) 0 50% / 9px 8px repeat-x;mask:radial-gradient(circle,#000 1.4px,transparent 1.9px) 0 50% / 9px 8px repeat-x}.way-track:before{background:var(--text-3);opacity:.8}.way-glow{overflow:hidden;transition:opacity .2s var(--ease-out)}.way-glow i{position:absolute;inset:0;background:linear-gradient(90deg,transparent 32%,var(--accent) 50%,transparent 68%);transform:translate(-70%);animation:way-run 2s cubic-bezier(.45,0,.55,1) infinite}@keyframes way-run{0%{transform:translate(-70%)}72%,to{transform:translate(70%)}}.way-fill{background:var(--ok);clip-path:inset(0 100% 0 0);transition:clip-path .7s var(--ease-out) 80ms}.way.done .way-fill{clip-path:inset(0)}.way.done .way-glow,.way.stopped .way-glow{opacity:0}.way.done .way-end{color:var(--ok);background:var(--ok-soft)}.way.done .way-end.home{transition-delay:.6s}.way.done .way-end.home .i{animation:way-pop .42s var(--spring-bouncy, ease) .6s backwards}@keyframes way-pop{0%{transform:scale(.6)}to{transform:none}}.way-text{display:flex;flex-direction:column;align-items:center;justify-content:center;min-height:30px;margin-top:10px;text-align:center}.way-text .t{display:flex;flex-direction:column;align-items:center;min-width:0}.way-text b{position:relative;display:inline-flex;justify-content:center;white-space:nowrap;font-weight:500;font-size:14px;line-height:20px;transition:color .3s var(--ease-out)}.way-text .ws{color:var(--text-2);font-size:13px;line-height:18px}.way.done .way-text b{color:var(--ok)}.filecard{display:flex;flex-direction:column;gap:10px;padding:12px;border-radius:18px;background:var(--field)}.fc-row{display:flex;align-items:center;gap:12px;min-width:0}.filecard-ic{width:38px;height:46px;border-radius:9px;background:var(--knob);font:600 10px/1 var(--mono);display:grid;place-items:center;color:var(--text-2);flex:none}.filecard .t{flex:1;min-width:0;display:flex;flex-direction:column}.filecard .t .mono{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.filecard .t span:last-child{font-size:12px;color:var(--text-2);line-height:16px}.confbar{display:flex;gap:8px}.conf{margin:0;padding:12px 14px;border-radius:14px;background:var(--field);font:12px/18px var(--mono);max-height:16rem;overflow:auto;white-space:pre;color:var(--text-2)}.conf .k{color:var(--text)}.conf .sec{color:var(--accent)}.conf .mask{color:var(--text-3);letter-spacing:1px}.osm{white-space:normal}.osm-ic{display:inline-grid;width:1.05em;height:1.05em;margin-right:.25em;vertical-align:-.16em}.osm-ic>svg{grid-area:1 / 1;width:100%;height:100%}.osm-ic .eye{fill:var(--field)}.osm-p{display:inline-block;white-space:pre}.scanline{display:flex;flex-wrap:wrap;align-items:baseline;column-gap:.3em}.scanline .osm{white-space:nowrap}@media(max-width:440px){.scanline{flex-direction:column;align-items:flex-start}}.way-text b .mt-old{color:var(--text-2)}@media(prefers-reduced-motion:reduce){.way-glow{display:none}.way-fill{transition:none}.way.done .way-end.home .i{animation:none}}.menu{position:fixed;z-index:60;min-width:224px;padding:6px;border-radius:20px;background:var(--field);box-shadow:var(--pop-shadow),inset 0 0 0 1px var(--line)}.menu-hl{position:absolute;left:6px;right:6px;top:6px;height:40px;border-radius:14px;background:var(--knob);opacity:0;transition:opacity .15s var(--ease-out);pointer-events:none}.menu-hl.moving{transition:opacity .15s var(--ease-out),transform var(--spring-quick-dur, .3s) var(--spring-quick, ease-out),background-color .15s}.menu-hl.bad{background:var(--bad-soft)}.menu-hl.warn{background:color-mix(in srgb,var(--warn) 13%,transparent)}.mi{position:relative;z-index:1;display:flex;align-items:center;gap:12px;width:100%;height:40px;padding:0 12px;border-radius:14px;font-size:14px;font-weight:500;text-align:left}.mi .i{width:16px;height:16px;color:var(--text-2)}.mi .i.off{visibility:hidden}.mi.warn,.mi.warn .i{color:var(--warn)}.mi.bad,.mi.bad .i{color:var(--bad)}.menu-sep{height:1px;margin:6px 12px;background:var(--line)}.toasts{position:fixed;left:0;right:0;height:42px;bottom:calc(24px + env(safe-area-inset-bottom,0px));z-index:70;display:flex;justify-content:center;align-items:flex-end;pointer-events:none;padding-left:var(--gutter-l);padding-right:var(--gutter-r)}.toast{position:absolute;display:flex;align-items:center;gap:8px;height:42px;padding:0 18px 0 13px;border-radius:999px;background:var(--toast);color:var(--toast-fg);font-size:14px;font-weight:500;box-shadow:var(--pop-shadow);white-space:nowrap}.toast .i{width:18px;height:18px;color:var(--ok)}.toast.bad .i{color:var(--bad)} diff --git a/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.js b/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.js index 6527714..5b48163 100644 --- a/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.js +++ b/package/luci-app-dawnline/root/usr/share/dawnline/portal/assets/portal.js @@ -1,6 +1,6 @@ -"use strict";(()=>{var li=Object.create;var tr=Object.defineProperty;var ci=Object.getOwnPropertyDescriptor;var di=Object.getOwnPropertyNames;var ui=Object.getPrototypeOf,pi=Object.prototype.hasOwnProperty;var fi=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var hi=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of di(t))!pi.call(e,o)&&o!==n&&tr(e,o,{get:()=>t[o],enumerable:!(r=ci(t,o))||r.enumerable});return e};var mi=(e,t,n)=>(n=e!=null?li(ui(e)):{},hi(t||!e||!e.__esModule?tr(n,"default",{value:e,enumerable:!0}):n,e));var Ur=fi((zr,Kr)=>{"use strict";var Wr=(function(){var e=function(d,v){var a=236,h=17,p=d,A=n[v],u=null,l=0,E=null,x=[],C={},I=function(w,k){l=p*4+17,u=(function(y){for(var L=new Array(y),S=0;S=7&&le(w),E==null&&(E=ie(p,A,x)),Y(E,k)},G=function(w,k){for(var y=-1;y<=7;y+=1)if(!(w+y<=-1||l<=w+y))for(var L=-1;L<=7;L+=1)k+L<=-1||l<=k+L||(0<=y&&y<=6&&(L==0||L==6)||0<=L&&L<=6&&(y==0||y==6)||2<=y&&y<=4&&2<=L&&L<=4?u[w+y][k+L]=!0:u[w+y][k+L]=!1)},V=function(){for(var w=0,k=0,y=0;y<8;y+=1){I(!0,y);var L=o.getLostPoint(C);(y==0||w>L)&&(w=L,k=y)}return k},J=function(){for(var w=8;w>y&1)==1;u[Math.floor(y/3)][y%3+l-8-3]=L}for(var y=0;y<18;y+=1){var L=!w&&(k>>y&1)==1;u[y%3+l-8-3][Math.floor(y/3)]=L}},ue=function(w,k){for(var y=A<<3|k,L=o.getBCHTypeInfo(y),S=0;S<15;S+=1){var H=!w&&(L>>S&1)==1;S<6?u[S][8]=H:S<8?u[S+1][8]=H:u[l-15+S][8]=H}for(var S=0;S<15;S+=1){var H=!w&&(L>>S&1)==1;S<8?u[8][l-S-1]=H:S<9?u[8][15-S-1+1]=H:u[8][15-S-1]=H}u[l-8][8]=!w},Y=function(w,k){for(var y=-1,L=l-1,S=7,H=0,K=o.getMaskFunction(k),W=l-1;W>0;W-=2)for(W==6&&(W-=1);;){for(var X=0;X<2;X+=1)if(u[L][W-X]==null){var se=!1;H>>S&1)==1);var U=K(L,W-X);U&&(se=!se),u[L][W-X]=se,S-=1,S==-1&&(H+=1,S=7)}if(L+=y,L<0||l<=L){L-=y,y=-y;break}}},ee=function(w,k){for(var y=0,L=0,S=0,H=new Array(k.length),K=new Array(k.length),W=0;W=0?Xn.getAt(Zn):0}}for(var er=0,U=0;UW*8)throw"code length overflow. ("+S.getLengthInBits()+">"+W*8+")";for(S.getLengthInBits()+4<=W*8&&S.put(0,4);S.getLengthInBits()%8!=0;)S.putBit(!1);for(;!(S.getLengthInBits()>=W*8||(S.put(a,8),S.getLengthInBits()>=W*8));)S.put(h,8);return ee(S,L)};C.addData=function(w,k){k=k||"Byte";var y=null;switch(k){case"Numeric":y=f(w);break;case"Alphanumeric":y=T(w);break;case"Byte":y=M(w);break;case"Kanji":y=b(w);break;default:throw"mode:"+k}x.push(y),E=null},C.isDark=function(w,k){if(w<0||l<=w||k<0||l<=k)throw w+","+k;return u[w][k]},C.getModuleCount=function(){return l},C.make=function(){if(p<1){for(var w=1;w<40;w++){for(var k=m.getRSBlocks(w,A),y=g(),L=0;L";for(var S=0;S';y+=""}return y+="",y+="",y},C.createSvgTag=function(w,k,y,L){var S={};typeof arguments[0]=="object"&&(S=arguments[0],w=S.cellSize,k=S.margin,y=S.alt,L=S.title),w=w||2,k=typeof k=="undefined"?w*4:k,y=typeof y=="string"?{text:y}:y||{},y.text=y.text||null,y.id=y.text?y.id||"qrcode-description":null,L=typeof L=="string"?{text:L}:L||{},L.text=L.text||null,L.id=L.text?L.id||"qrcode-title":null;var H=C.getModuleCount()*w+k*2,K,W,X,se,U="",ye;for(ye="l"+w+",0 0,"+w+" -"+w+",0 0,-"+w+"z ",U+=''+ne(L.text)+"":"",U+=y.text?''+ne(y.text)+"":"",U+='',U+='":k+=">";break;case"&":k+="&";break;case'"':k+=""";break;default:k+=L;break}}return k},Bt=function(w){var k=1;w=typeof w=="undefined"?k*2:w;var y=C.getModuleCount()*k+w*2,L=w,S=y-w,H,K,W,X,se,U={"██":"█","█ ":"▀"," █":"▄"," ":" "},ye={"██":"▀","█ ":"▀"," █":" "," ":" "},be="";for(H=0;H=S?ye[se]:U[se];be+=` -`}return y%2&&w>0?be.substring(0,be.length-y-1)+Array(y+1).join("▀"):be.substring(0,be.length-1)};return C.createASCII=function(w,k){if(w=w||1,w<2)return Bt(k);w-=1,k=typeof k=="undefined"?w*2:k;var y=C.getModuleCount()*w+k*2,L=k,S=y-k,H,K,W,X,se=Array(w+1).join("██"),U=Array(w+1).join(" "),ye="",be="";for(H=0;H>>8),A.push(E&255)):A.push(h)}}return A}};var t={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},r={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o=(function(){var d=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],v=1335,a=7973,h=21522,p={},A=function(u){for(var l=0;u!=0;)l+=1,u>>>=1;return l};return p.getBCHTypeInfo=function(u){for(var l=u<<10;A(l)-A(v)>=0;)l^=v<=0;)l^=a<5&&(E+=3+I-5)}for(var x=0;x=256;)p-=255;return d[p]},h})();function c(d,v){if(typeof d.length=="undefined")throw d.length+"/"+v;var a=(function(){for(var p=0;p>>7-h%8&1)==1},a.put=function(h,p){for(var A=0;A>>p-A-1&1)==1)},a.getLengthInBits=function(){return v},a.putBit=function(h){var p=Math.floor(v/8);d.length<=p&&d.push(0),h&&(d[p]|=128>>>v%8),v+=1},a},f=function(d){var v=t.MODE_NUMBER,a=d,h={};h.getMode=function(){return v},h.getLength=function(u){return a.length},h.write=function(u){for(var l=a,E=0;E+2>>8&255)*192+(x&255),u.put(x,13),E+=2}if(E>>8)},v.writeBytes=function(a,h,p){h=h||0,p=p||a.length;for(var A=0;A0&&(a+=","),a+=d[h];return a+="]",a},v},B=function(){var d=0,v=0,a=0,h="",p={},A=function(l){h+=String.fromCharCode(u(l&63))},u=function(l){if(!(l<0)){if(l<26)return 65+l;if(l<52)return 97+(l-26);if(l<62)return 48+(l-52);if(l==62)return 43;if(l==63)return 47}throw"n:"+l};return p.writeByte=function(l){for(d=d<<8|l&255,v+=8,a+=1;v>=6;)A(d>>>v-6),v-=6},p.flush=function(){if(v>0&&(A(d<<6-v),d=0,v=0),a%3!=0)for(var l=3-a%3,E=0;E=v.length){if(p==0)return-1;throw"unexpected end of file./"+p}var l=v.charAt(a);if(a+=1,l=="=")return p=0,-1;if(l.match(/^\s$/))continue;h=h<<6|u(l.charCodeAt(0)),p+=6}var E=h>>>p-8&255;return p-=8,E};var u=function(l){if(65<=l&&l<=90)return l-65;if(97<=l&&l<=122)return l-97+26;if(48<=l&&l<=57)return l-48+52;if(l==43)return 62;if(l==47)return 63;throw"c:"+l};return A},R=function(d,v){var a=d,h=v,p=new Array(d*v),A={};A.setPixel=function(x,C,I){p[C*a+x]=I},A.write=function(x){x.writeString("GIF87a"),x.writeShort(a),x.writeShort(h),x.writeByte(128),x.writeByte(0),x.writeByte(0),x.writeByte(0),x.writeByte(0),x.writeByte(0),x.writeByte(255),x.writeByte(255),x.writeByte(255),x.writeString(","),x.writeShort(0),x.writeShort(0),x.writeShort(a),x.writeShort(h),x.writeByte(0);var C=2,I=l(C);x.writeByte(C);for(var G=0;I.length-G>255;)x.writeByte(255),x.writeBytes(I,G,255),G+=255;x.writeByte(I.length-G),x.writeBytes(I,G,I.length-G),x.writeByte(0),x.writeString(";")};var u=function(x){var C=x,I=0,G=0,V={};return V.write=function(J,re){if(J>>>re)throw"length over";for(;I+re>=8;)C.writeByte(255&(J<>>=8-I,G=0,I=0;G=J<0&&C.writeByte(G)},V},l=function(x){for(var C=1<>6,128|s&63):s<55296||s>=57344?r.push(224|s>>12,128|s>>6&63,128|s&63):(o++,s=65536+((s&1023)<<10|n.charCodeAt(o)&1023),r.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|s&63))}return r}return t(e)}})();(function(e){typeof define=="function"&&define.amd?define([],e):typeof zr=="object"&&(Kr.exports=e())})(function(){return Wr})});var nr={s:{'"%s" already exists.':"Устройство «%s» уже есть.",'"%s" is already taken.':"Идентификатор «%s» уже занят.","%s (Android: %s)":"%s (на Android: %s)","%s (router time)":"%s (по времени роутера)","%s can't use the network interface %s: it exists and isn't Dawnline's.":"Сервер %s не может использовать сетевой интерфейс %s: он уже существует и создан не Dawnline.","%s connected":"Подключено: %s","%s d ago":"%s дн. назад","%s h ago":"%s ч назад",'%s has an invalid interface name "%s".':"У сервера %s недопустимое имя интерфейса «%s».","%s has no room for every device on %s.":"В подсети %s не хватит адресов для всех устройств сервера %s.","%s in total":"%s всего","%s is kept down.":"Сервер %s остановлен.","%s is kept down: its disguise needs AmneziaWG %s (installed: %s).":"Сервер %s остановлен: для его маскировки нужен AmneziaWG %s (установлен %s).","%s is kept down: its disguise needs AmneziaWG %s (installed: none).":"Сервер %s остановлен: для его маскировки нужен AmneziaWG %s (не установлен).","%s left":"осталось %s","%s min ago":"%s мин назад","%s must be a number or range":"%s: нужно число или диапазон","%s of %s":"%s из %s","%s of %s GB":"%s из %s ГБ","%s of %s GB this month":"%s из %s ГБ в этом месяце","%s of %s in total.":"Всего %s из %s.","%s on %s":"%s за %s","%s options":"Действия с устройством %s","%s this month":"%s в этом месяце","%s used":"%s использовано","%s your time":"%s по вашему времени","%sd %sh":"%s д %s ч","%sh %sm":"%s ч %s мин","%sm":"%s мин","A total for your whole access, it does not reset.":"Считается за весь срок доступа и не обнуляется.","APK file on":"APK-файл на","Access %s":"Доступ %s","Access ended":"Доступ закончился","Access must be lan, internet or both.":"Доступ должен быть lan, internet или both.","Access paused":"Доступ на паузе","Access until":"Доступ до",Active:"Активен","WireGuard appAdd Tunnel":"Добавить туннель","Add a device":"Добавить устройство","Add device":"Добавить устройство","Add it from the device":"Добавить с самого устройства","Add the connection":"Добавьте подключение","Add this device":"Добавить это устройство","Add this phone":"Добавить этот телефон","Add your first device":"Добавьте первое устройство","Adding devices isn't available right now: the VPN server isn't ready. Ask whoever sent you this link.":"Сейчас добавить устройство нельзя: VPN-сервер не готов. Обратитесь к тому, кто прислал вам эту ссылку.","Address copied":"Адрес скопирован","Already has the app":"Приложение уже установлено","AmneziaWG is not installed (%s): install it in Dawnline → Components.":"AmneziaWG не установлен (%s): установите его в Dawnline → Компоненты.","AmneziaWG is not installed: install it in Dawnline → Components.":"AmneziaWG не установлен: установите его в Dawnline → Компоненты.","Android phone":"Телефон Android","Android tablet":"Планшет Android","Ask for a new one.":"Попросите новую.",B:"Б",Back:"Назад",Breadcrumb:"Навигационная цепочка",Cancel:"Отмена","Circle %s: server %s does not exist.":"Круг %s: сервера %s нет.",Close:"Закрыть","Close this and open it again to keep checking.":"Закройте окно и откройте его снова, чтобы проверить ещё раз.",Configuration:"Конфигурация","Configuration copied":"Конфигурация скопирована","Confirm the import and connect":"Подтвердите импорт и подключитесь",Connect:"Подключить",Connected:"Подключено","Connected, no data left":"Подключено, трафик закончился","Connected, outside your hours":"Подключено, вне часов доступа","Connection settings only travel encrypted":"Настройки подключения передаются только в зашифрованном виде","AmneziaVPN appContinue":"Продолжить",Copied:"Скопировано",Copy:"Скопировать","Copy %s":"Скопировать %s","Copy %s config":"Скопировать конфигурацию %s","Copy IP address":"Скопировать IP-адрес","Copy local address":"Скопировать локальный адрес","Copy or save the connection":"Скопировать или сохранить подключение","Copy the configuration":"Скопировать конфигурацию","Copy the key":"Скопировать ключ","in a sentenceCopy the key":"Скопируйте ключ","Copy the link":"Скопировать ссылку","Copying is blocked here. Select the text and copy it by hand.":"Копирование здесь заблокировано. Выделите текст и скопируйте его вручную.","Create connection":"Создать подключение","WireGuard appCreate from QR code":"Создать из QR-кода","WireGuard appCreate from file or archive":"Создать из файла или архива","Cross-site request refused.":"Запрос с другого сайта отклонён.","Data limit must be a positive number of GB.":"Лимит трафика должен быть положительным числом ГБ.","Data limit reached":"Лимит трафика исчерпан","Data this month":"Трафик за месяц","Data used":"Трафик всего","Device %s of %s: address %s is also used by device %s of %s.":"Устройство %s (%s): адрес %s уже занят устройством %s (%s).","Device %s of %s: address %s is not a plain IPv4 address.":"Устройство %s (%s): адрес %s не является обычным IPv4-адресом.","Device %s of %s: address %s is outside %s's tunnel %s.":"Устройство %s (%s): адрес %s вне туннеля сервера %s (%s).","Device %s of %s: address %s is the router's own address on %s.":"Устройство %s (%s): адрес %s принадлежит самому роутеру на сервере %s.","Device %s of %s: address (none) is not a plain IPv4 address.":"Устройство %s (%s): нет IPv4-адреса.","Device %s of %s: the preshared key is not a key.":"Устройство %s (%s): общий ключ (PSK) некорректен.","Device %s of %s: the private key is not a key.":"Устройство %s (%s): приватный ключ некорректен.","Device %s of %s: the public key is not a key.":"Устройство %s (%s): публичный ключ некорректен.","Device %s: person %s does not exist.":"Устройство %s: человека %s нет.","Device limit must be between 1 and 32.":"Лимит устройств: от 1 до 32.","Device limit reached (%d).":"Достигнут лимит устройств (%d).","Device name":"Имя устройства","Device not found.":"Устройство не найдено.","Device removed":"Устройство удалено","Devices at home":"Устройства дома","Devices at home and on this VPN reach yours as %s":"Устройства дома и в этом VPN обращаются к вашим по адресу %s",Disabled:"Отключено",Download:"Скачать","Download %s config":"Скачать конфигурацию %s","Download for Linux":"Скачать для Linux","Download for Mac":"Скачать для Mac","Download for Windows":"Скачать для Windows","Download from":"Скачать с сайта","Download on the":"Загрузите в","Download the file":"Скачать файл","Download the key":"Скачать ключ","End date must be YYYY-MM-DD.":"Дата окончания должна быть в формате ГГГГ-ММ-ДД.","Endpoint must be a hostname or IP address.":"Адрес сервера должен быть именем хоста или IP-адресом.","Ends %s":"Закончится %s","Enter a device name (up to 48 characters).":"Введите название устройства (до 48 символов).",Expired:"Срок истёк","Extra data must be a positive number of GB.":"Дополнительный трафик должен быть положительным числом ГБ.","For computers and routers":"Для компьютеров и роутеров",GB:"ГБ","Gbit/s":"Гбит/с","Get %s":"Установите %s","Get %s on the %s and come back here.":"Установите %s на %s и вернитесь сюда.","Get %s on the router":"Установите %s на роутер","Get it on":"Доступно в","Hide key":"Скрыть ключ","Home network":"Домашняя сеть","Home network + Internet":"Домашняя сеть и интернет","Hours must look like 07:00-23:00.":"Часы доступа указываются так: 07:00-23:00.","Hours, router time":"Часы доступа, время роутера","Hours, your time":"Часы доступа, ваше время","IP address copied":"IP-адрес скопирован","WireGuard appImport Tunnel(s) from File…":"Импорт туннелей из файла…","WireGuard appImport from file or archive":"Импорт из файла или архива","Import the configuration":"Импортируйте конфигурацию","WireGuard appImport tunnel(s) from file…":"Импорт туннелей из файла…","In %s:":"В %s:",Included:"Есть доступ","AmneziaVPN appInsert":"Вставить","Install from":"Установить с сайта","Interface name: 1-12 lowercase letters, digits or _.":"Имя интерфейса: 1–12 строчных латинских букв, цифр или _.",Internet:"Интернет","Invalid JSON.":"Некорректный JSON.","Invalid public key.":"Недопустимый публичный ключ.","It ended on %s.":"Доступ закончился %s.","It gets new keys and its current settings stop working. Set it up again with the new ones that open next.":"Устройство получит новые ключи, а текущие настройки перестанут работать. Настройте его заново с новыми - они откроются следом.","It gets new keys. This device is connected through its current settings: it disconnects a few seconds after you confirm. Add the new ones that open next.":"Устройство получит новые ключи. Сейчас вы подключены через его текущие настройки: через несколько секунд после подтверждения связь прервётся. Добавьте новые - они откроются следом.","Its connection stops working at once. You can add it again later.":"Подключение сразу перестанет работать. Устройство можно будет добавить снова.","Its settings changed: update the connection":"Настройки изменились: обновите подключение",KB:"КБ","Key copied":"Ключ скопирован","Key generation failed (is amneziawg-tools installed?).":"Не удалось создать ключ (установлен ли amneziawg-tools?).","Key generation failed (no random data).":"Не удалось создать ключ (нет случайных данных).","Key generation failed.":"Не удалось создать ключ.",Language:"Язык","Last 7 days":"За 7 дней","Last connected %s":"В сети %s","Link copied":"Ссылка скопирована","Linux PC":"Компьютер с Linux",MB:"МБ","Mbit/s":"Мбит/с","Method not allowed.":"Метод не поддерживается.",Mobile:"Мобильный","Monthly data must be a positive number of GB.":"Месячный лимит трафика должен быть положительным числом ГБ.",Name:"Имя","No connection yet":"Подключения пока нет","No data limit. The count starts again on the 1st.":"Лимита трафика нет. Счёт начинается заново 1-го числа.","No end date":"Бессрочно","No free address left on %s.":"На сервере %s не осталось свободных адресов.","No free addresses left in the server subnet.":"В подсети сервера не осталось свободных адресов.","No limit":"Без лимита","No server":"Нет сервера","No server yet":"Сервера пока нет","Not found.":"Не найден.","Not included":"Нет доступа","Not on the %s right now?":"Открыли на другом %s?","Not set up yet":"Ещё не настроено","Nothing gets through until it resets.":"Ничего не проходит, пока лимит не обнулится.","Nothing opened? %s and add it in the app.":"Ничего не открылось? %s и добавьте его в приложении.","Now, %s":"Сейчас %s",OR:"ИЛИ","Official release on GitHub":"Официальная версия на GitHub","On %s.":"Дата окончания - %s.","On GitHub":"На GitHub","Only the admin can turn devices off.":"Отключать устройства может только администратор.","stepOpen %s":"Откройте %s","Open %s.":"Доступ открыт %s.","Open a terminal in the folder with the file":"Откройте терминал в папке с файлом","Open in AmneziaVPN":"Открыть в AmneziaVPN","Open on another device":"Открыть на другом устройстве","Open on the device":"Открыть на устройстве","Open securely":"Открыть по HTTPS","Open the link securely":"Откройте защищённую ссылку","Open this link on the %s to set it up there.":"Откройте эту ссылку на %s, чтобы настроить его там.","Open this link over HTTPS to get the connection settings.":"Чтобы получить настройки подключения, откройте эту ссылку по HTTPS.","Open this page in Safari or Chrome: the store opens from here, but the app handoff does not.":"Откройте эту страницу в Safari или Chrome: магазин отсюда откроется, а передача в приложение - нет.","Open your link on the %s":"Откройте свою ссылку на %s","OpenWrt packages":"Пакеты OpenWrt","OpenWrt packages + kmod":"Пакеты OpenWrt + kmod",Other:"Другое","Other devices at home reach yours as %s":"Другие устройства дома обращаются к вашим по адресу %s","Out of data":"Трафик закончился","Outside allowed hours":"Вне часов доступа","Outside your hours":"Вне часов доступа",PC:"Компьютер",Paused:"На паузе","Person %s: circle %s does not exist.":"Человек %s: круга %s нет.","Person %s: has the same personal link as %s.":"Человек %s: личная ссылка совпадает со ссылкой человека %s.","Person %s: home service %s does not exist.":"Человек %s: домашнего сервиса %s нет.","Person %s: server %s does not exist.":"Человек %s: сервера %s нет.",Phone:"Телефон","Phones and tablets get a smaller packet size that suits mobile networks.":"У телефонов и планшетов пакеты меньше - так лучше для мобильных сетей.","Pick AmneziaVPN in the share sheet. Not there? %s and add it in the app.":"Выберите AmneziaVPN в меню «Поделиться». Его там нет? %s и добавьте его в приложении.","Pick the file and connect":"Выберите файл и подключитесь","Point its camera at the code: the link opens there.":"Наведите камеру устройства на код - ссылка откроется на нём.","Point its camera at the code: this page opens there.":"Наведите камеру устройства на код - там откроется эта страница.","Point its camera at the code: your page opens there with this device ready to add.":"Наведите камеру устройства на код - там откроется ваша страница, и его можно будет сразу добавить.","Port must be 1-65535.":"Порт: от 1 до 65535.","QR code":"QR-код","AmneziaVPN appQR code":"QR-код",Reconnect:"Переподключить","Reconnect %s?":"Переподключить «%s»?",Remove:"Удалить","Remove %s?":"Удалить «%s»?",Rename:"Переименовать","Rename %s":"Переименовать «%s»",Renamed:"Переименовано","Request failed (%s)":"Не удалось выполнить запрос (%s)","Request too large.":"Слишком большой запрос.","Resets on the 1st.":"Обнуляется 1-го числа.",Router:"Роутер",Run:"Выполните",Save:"Сохранить","WireGuard appScan from QR code":"Сканировать QR-код","Send it to the %s":"Отправить на %s","Send it to the %s in a message or a note, then in AmneziaVPN: %s.":"Отправьте его на %s в сообщении или заметке, затем в AmneziaVPN: %s.","Send it to the %s, then import %s in %s.":"Отправьте его на %s, затем импортируйте %s в %s.","Send to AmneziaVPN":"Отправить в AmneziaVPN","Server is disabled":"Сервер выключен","Server is turned off":"Сервер выключен","Set up %s":"Настроить %s","Set up a server first.":"Сначала настройте сервер.","Settings changed":"Настройки изменились","Settings changed, update needed":"Настройки изменились, нужно обновить","Share as a file":"Поделиться файлом","Share file":"Поделиться файлом","Share the file":"Поделиться файлом","Share the link":"Поделиться ссылкой","Show key":"Показать ключ","Straight into %s":"Сразу в %s","Subnet must look like 10.77.0.0/24.":"Подсеть указывается так: 10.77.0.0/24.","Subnet overlaps %s.":"Подсеть пересекается с %s.",TB:"ТБ",Tablet:"Планшет","Tap “%s” and connect":"Нажмите «%s» и подключитесь","The APK is for phones without Google Play, or where the store hides the app.":"APK - для телефонов без Google Play или если магазин скрывает приложение.","The admin has turned this device off.":"Администратор отключил это устройство.","The app goes on the %s.":"Приложение ставится на %s.","The browser may warn that the certificate is not trusted: it is this router’s own. Choose to continue (“Advanced” → “Proceed”).":"Браузер может предупредить, что сертификату нельзя доверять: это собственный сертификат роутера. Продолжите переход («Дополнительные» → «Перейти на сайт»).","The connection":"Подключение","The connection as one key":"Подключение одним ключом","The id may use lowercase letters, digits and underscores.":"В идентификаторе можно использовать строчные латинские буквы, цифры и подчёркивания.","The packages and the file for OpenWrt":"Пакеты и файл для OpenWrt","The page could not load":"Не удалось загрузить страницу","The person has no server.":"У человека нет сервера.","Then come back here and tap":"Затем вернитесь сюда и нажмите","Then import it in the app":"Затем импортируйте его в приложении","This device":"Это устройство","This key is already in use.":"Этот ключ уже используется.","This link no longer works":"Эта ссылка больше не работает","This page is open without encryption. To add or set up a device, open the same link over HTTPS:":"Эта страница открыта без шифрования. Чтобы добавить или настроить устройство, откройте ту же ссылку по HTTPS:","Through the router":"Через роутер",Today:"Сегодня","Too many changes in a short time. Try again in a few minutes.":"Слишком много изменений за короткое время. Попробуйте ещё раз через несколько минут.","Two steps, about a minute":"Два шага, около минуты","Two steps, about a minute: get the app, then add the connection.":"Два шага, около минуты: установите приложение, затем добавьте подключение.","Unknown DNS choice.":"Неизвестный вариант DNS.","Unknown action.":"Неизвестное действие.","Unknown circle.":"Неизвестный круг.","Unknown device.":"Неизвестное устройство.","Unknown end action.":"Неизвестное действие по окончании доступа.","Unknown person.":"Неизвестный человек.","Unknown server.":"Неизвестный сервер.","Unknown service %s.":"Неизвестный сервис %s.",Update:"Обновить","Update the connection":"Обновить подключение","Waiting for the connection":"Ждём подключения","Warning must be 0-60 days.":"Предупреждать можно за 0–60 дней.","What is it?":"Что это за устройство?","Windows PC":"Компьютер с Windows",Yesterday:"Вчера","You already have a device with this name.":"У вас уже есть устройство с таким именем.","You haven’t been added to one.":"Вас ещё не добавили ни на один сервер.","Your access":"Ваш доступ","Your access has ended.":"Ваш доступ закончился.","Your access is paused.":"Ваш доступ на паузе.","Your devices":"Ваши устройства","Your devices can’t connect until it’s enabled again.":"Ваши устройства не подключатся, пока его снова не включат.","Your devices can’t connect until it’s extended.":"Ваши устройства не подключатся, пока доступ не продлят.","Your devices can’t connect until it’s resumed.":"Ваши устройства не подключатся, пока доступ не возобновят.","bit/s":"бит/с",computer:"компьютер","on thecomputer":"компьютере",device:"устройство","on thedevice":"устройстве",ended:"закончился","ends today":"закончится сегодня","ends tomorrow":"закончится завтра","h1-h4 must be distinct":"h1-h4 должны быть разными","just now":"только что","kbit/s":"кбит/с",name:"имя",never:"никогда","no limit":"без лимита",phone:"телефон","on thephone":"телефоне",router:"роутер","on therouter":"роутере",tablet:"планшет","on thetablet":"планшете","this device":"это устройство"},p:{"%s already has %d device. Remove one first to lower the limit to %d.":["%s: уже %d устройство. Чтобы снизить лимит до %d, сначала удалите одно из них.","%s: уже %d устройства. Чтобы снизить лимит до %d, сначала удалите одно из них.","%s: уже %d устройств. Чтобы снизить лимит до %d, сначала удалите одно из них."],"%s day":["%s день","%s дня","%s дней"],"%s of %s slot free":["Свободно %s из %s места","Свободно %s из %s мест","Свободно %s из %s мест"],"You have reached your limit of %s device":["Достигнут лимит - %s устройство","Достигнут лимит - %s устройства","Достигнут лимит - %s устройств"],"You have reached your limit of %s device. Remove one to add another.":["Достигнут лимит - %s устройство. Удалите одно, чтобы добавить новое.","Достигнут лимит - %s устройства. Удалите одно, чтобы добавить новое.","Достигнут лимит - %s устройств. Удалите одно, чтобы добавить новое."],"day left":["день остался","дня осталось","дней осталось"],"ends in %s day":["закончится через %s день","закончится через %s дня","закончится через %s дней"]}};var It=[{code:"en",name:"English"},{code:"ru",name:"Русский"}],vi={ru:[nr]},rr={en:e=>e!==1?1:0,ru:e=>e%10===1&&e%100!==11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},ir="dl.lang";function yi(e,t){var r,o;let n=s=>s&&It.some(c=>c.code===s)?s:null;return(o=(r=n(e))!=null?r:t.map(s=>n(s.toLowerCase().split(/[-_]/)[0])).find(Boolean))!=null?o:"en"}var ot="en",xn=[],sr=[],ar=(e,t)=>t?`${t}${e}`:e;function lr(e,t){let n=ar(e,t);for(let r of xn)if(n in r.s)return r.s[n];return e}function bi(e,t,n,r){var c,m,g;let o=ar(t,r),s=(c=xn.find(f=>o in f.p))==null?void 0:c.p[o];return(g=s==null?void 0:s[((m=rr[ot])!=null?m:rr.en)(e)])!=null?g:e===1?t:n}var Je=()=>ot,cr=e=>lr(e);function wn(e,t=!0){var n;if(ot=It.some(r=>r.code===e)?e:"en",xn=(n=vi[ot])!=null?n:[],document.documentElement.lang=ot,t)try{localStorage.setItem(ir,ot)}catch{}sr.forEach(r=>r())}function dr(e){sr.push(e)}function xi(){try{return localStorage.getItem(ir)}catch{return null}}Object.assign(globalThis,{_:lr,N_:bi});var or;wn(yi(xi(),(or=navigator.languages)!=null&&or.length?navigator.languages:[navigator.language]),!1);var ur={phone:'',computer:'',tablet:'',router:'',server:'',other:'',ethernet:'',bridge:'',wifi:'',tunnel:'',plus:'',chart:'',reset:'',package:'',code:'',plug:'',sunrise:'',refresh:'',archive:'',qr:'',copy:'',download:'',link:'',amnezia:'',amneziawg:'',wireguard:'',appstore:'',googleplay:'',github:'',openwrt:'',apple:'',windows:'',linux:'',eye:'',share:'',arrow:'',trash:'',edit:'',pause:'',play:'',key:'',out:'',admin:'',shield:'',shieldplus:'',lock:'',zap:'',check:'',alert:'',x:'',globe:'',home:'',open:'',file:'',network:'',moon:'',chevron:'',clock:'',calendar:'',minus:'',more:'',pin:'',activity:''};function Gt(e,t="dl-icon"){var r;let n=(r=ur[e])!=null?r:ur.phone;return``}function pr(e,t){let n=r=>{r==null||r===!1||(Array.isArray(r)?r.forEach(n):e.appendChild(typeof r=="string"?document.createTextNode(r):r))};t.forEach(n)}function i(e,t={},...n){let r=document.createElement(e);for(let[o,s]of Object.entries(t))s==null||s===!1||(o.startsWith("on")&&typeof s=="function"?r.addEventListener(o.slice(2),s):o==="class"?r.className=String(s):s===!0?r.setAttribute(o,""):r.setAttribute(o,String(s)));return pr(r,n),r}function We(e,...t){e.replaceChildren(),pr(e,t)}function Re(e){let t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstElementChild}var z=(e,t="i")=>Re(Gt(e,t));var Se=()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;function it(e,t,n=1){let r=Math.sqrt(e/n),o=t/(2*Math.sqrt(e*n)),s=f=>{if(o<.999){let O=r*Math.sqrt(1-o*o);return 1-Math.exp(-o*r*f)*(Math.cos(O*f)+o*r/O*Math.sin(O*f))}if(o<=1.001)return 1-Math.exp(-r*f)*(1+r*f);let T=Math.sqrt(o*o-1),M=-r*(o-T),b=-r*(o+T);return 1-(b*Math.exp(M*f)-M*Math.exp(b*f))/(b-M)},c=0;for(let f=0;f<3;f+=.004)Math.abs(1-s(f))>.0015&&(c=f);c+=.004;let m=[];for(let f=0;f<=64;f++)m.push(+s(c*f/64).toFixed(4));m[64]=1;let g=Math.round(c*1e3);return{duration:g,easing:`linear(${m.join(", ")})`,at:f=>f>=g?1:s(f/1e3)}}var Le=it(300,20),q=it(300,35),xe=it(520,24),hr=it(520,46),Ae=it(380,28),fr=it(900,60),j="cubic-bezier(0.23, 1, 0.32, 1)",Z="cubic-bezier(0.55, 0, 1, 0.45)",Mn="cubic-bezier(0.32, 0.72, 0, 1)";function mr(e){e.style.setProperty("--spring-bouncy",Le.easing),e.style.setProperty("--spring-bouncy-dur",`${Le.duration}ms`),e.style.setProperty("--spring-smooth",q.easing),e.style.setProperty("--spring-smooth-dur",`${q.duration}ms`),e.style.setProperty("--spring-soft",Ae.easing),e.style.setProperty("--spring-soft-dur",`${Ae.duration}ms`),e.style.setProperty("--spring-quick",fr.easing),e.style.setProperty("--spring-quick-dur",`${fr.duration}ms`)}function $(e,t,n){var r;return Se()?t.some(o=>"opacity"in o)?e.animate(t.map(o=>"opacity"in o?{opacity:o.opacity}:{}),{duration:Math.min(Number((r=n.duration)!=null?r:200),160),easing:"ease-out",fill:n.fill}):e.animate(t,{...n,duration:0,delay:0}):e.animate(t,n)}function gr(e,t){return e<=0||t<=0?0:(1-1/(e*.55/t+1))*t}function vr(e,t,n){return e<=0||t<-.1?!1:t>.4||e>n/3}function wi(){return(typeof document=="undefined"?"":document.documentElement.lang)||"en"}function _e(){let e=wi();return e==="en"?"en-GB":e}function N(e,...t){let n=0;return e.replace(/%([%sd])/g,(r,o)=>{var s;return o==="%"?"%":String((s=t[n++])!=null?s:"")})}function we(e,t){return e.toLocaleString(_e(),t===void 0?void 0:{minimumFractionDigits:t,maximumFractionDigits:t})}function ze(e,t,n){return N(N_(e,t,n),we(e))}function Ke(e,...t){let n=0;return e.split(/(%[%sd])/).filter(Boolean).map(r=>r==="%%"?"%":r==="%s"||r==="%d"?t[n++]:r)}function Mi(e,t,n){let r=0;for(;e>=n&&r=100||r===0?we(Math.round(e)):we(e,1)} ${t[r]}`}function Me(e){return Mi(!e||e<0?0:e,[_("B"),_("KB"),_("MB"),_("GB"),_("TB")],1024)}function yr(e,t=Date.now()/1e3){if(!e)return _("never");let n=Math.max(0,Math.round(t-e));return n<60?_("just now"):n<3600?N(_("%s min ago"),Math.floor(n/60)):n<86400?N(_("%s h ago"),Math.floor(n/3600)):n<86400*30?N(_("%s d ago"),Math.floor(n/86400)):new Date(e*1e3).toLocaleDateString(_e(),{day:"numeric",month:"short",year:"numeric"})}function Wt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Pe(e){let[t,n,r]=e.split("-").map(Number);return new Date(t,(n||1)-1,r||1,12)}function ki(e){return(typeof e=="string"?/^\d{4}-\d{2}-\d{2}$/.test(e)?Pe(e):new Date(e):e).toLocaleDateString(_e(),{day:"numeric",month:"short",year:"numeric"})}function zt(e){return e?ki(e):""}function Ci(e,t){let n=r=>{let[o,s,c]=r.split("-").map(Number);return Date.UTC(o,s-1,c)};return Math.round((n(e)-n(t))/864e5)}function st(e,t){let n=Pe(e);return n.setDate(n.getDate()+t),Wt(n)}function Kt(e,t=Date.now()){if(!e)return null;let n=typeof t=="number"?Wt(new Date(t)):t,r=Ci(e,n);return r>=0?r+1:r}function wt(e,t){return t!=null&&t>0&&e.expire_warn>0&&t<=e.expire_warn}function br(e){return e<=1?_("ends today"):e===2?_("ends tomorrow"):ze(e,"ends in %s day","ends in %s days")}function xr(e){return{lan:_("Home network"),internet:_("Internet"),both:_("Home network + Internet")}[e]}function Ut(e){return{computer:_("PC"),phone:_("Phone"),tablet:_("Tablet"),router:_("Router"),other:_("Other")}[e]}function qt(e){let t=n=>n.disabled?3:n.online?0:n.handshake?1:2;return e.map((n,r)=>[n,r]).sort((n,r)=>t(n[0])-t(r[0])||n[1]-r[1]).map(([n])=>n)}var ce={vpn:"AmneziaVPN",awg:"AmneziaWG",wg:"WireGuard"};function Mr(e,t=0){return/iPhone|iPad|iPod/.test(e)||/Macintosh/.test(e)&&t>1?"ios":/Android/.test(e)?"android":/Windows/.test(e)?"windows":/Mac OS X|Macintosh/.test(e)?"mac":/CrOS/.test(e)?"unknown":/Linux|X11/.test(e)?"linux":"unknown"}var kr=e=>/Telegram|FBAN|FBAV|Instagram|VKClient|Line\//i.test(e);function Cr(e,t){return e==="router"||t==="unknown"?!1:e==="phone"||e==="tablet"?t==="ios"||t==="android":e==="computer"?t==="windows"||t==="mac"||t==="linux":!0}function _r(e){let t=[{id:"vpn",name:ce.vpn},{id:"awg",name:ce.awg}];return e==="off"&&t.push({id:"wg",name:ce.wg}),t}var Ft="https://github.com/amnezia-vpn/amnezia-client/releases/latest",wr=e=>({href:e,top:_("APK file on"),main:"GitHub",mark:"github",why:_("The APK is for phones without Google Play, or where the store hides the app.")});function Er(e,t){var c;let n=_("Download on the"),r=_("Get it on"),o=_("Official release on GitHub");return(c={vpn:{ios:{href:"https://apps.apple.com/app/amneziavpn/id1600529900",top:n,main:"App Store",mark:"appstore"},android:{href:"https://play.google.com/store/apps/details?id=org.amnezia.vpn",top:r,main:"Google Play",mark:"googleplay",alt:wr(Ft)},windows:{href:Ft,top:o,main:_("Download for Windows"),mark:"windows"},mac:{href:Ft,top:o,main:_("Download for Mac"),mark:"apple"},linux:{href:Ft,top:o,main:_("Download for Linux"),mark:"linux"}},awg:{ios:{href:"https://apps.apple.com/us/app/amneziawg/id6478942365",top:n,main:"App Store",mark:"appstore"},android:{href:"https://play.google.com/store/apps/details?id=org.amnezia.awg",top:r,main:"Google Play",mark:"googleplay",alt:wr("https://github.com/amnezia-vpn/amneziawg-android/releases")},windows:{href:"https://github.com/amnezia-vpn/amneziawg-windows-client/releases",top:o,main:_("Download for Windows"),mark:"windows"},mac:{href:"https://apps.apple.com/us/app/amneziawg/id6478942365",top:n,main:"Mac App Store",mark:"appstore"},linux:{href:"https://github.com/amnezia-vpn/amneziawg-tools",top:_("On GitHub"),main:"amneziawg-tools",mark:"linux"}},wg:{ios:{href:"https://apps.apple.com/app/wireguard/id1441195209",top:n,main:"App Store",mark:"appstore"},android:{href:"https://play.google.com/store/apps/details?id=com.wireguard.android",top:r,main:"Google Play",mark:"googleplay"},windows:{href:"https://www.wireguard.com/install/",top:_("Download from"),main:"wireguard.com",mark:"windows"},mac:{href:"https://apps.apple.com/app/wireguard/id1451685025",top:n,main:"Mac App Store",mark:"appstore"},linux:{href:"https://www.wireguard.com/install/",top:_("Install from"),main:"wireguard.com",mark:"linux"}}}[e][t])!=null?c:null}var Tr=e=>e==="wg"?{href:"https://openwrt.org/docs/guide-user/services/vpn/wireguard/start",top:_("OpenWrt packages"),main:"wireguard-tools",mark:"openwrt"}:{href:"https://openwrt.org/packages/start",top:_("OpenWrt packages + kmod"),main:"amneziawg-tools",mark:"openwrt"},kn=e=>e==="android",kt=e=>`${e.replace(/\.conf$/i,"")}.vpn`,Ue=(...e)=>e.join(" → ");function Mt(e){return{ios:{file:Ue("+",_("Create from file or archive","WireGuard app")),qr:Ue("+",_("Create from QR code","WireGuard app"))},android:{file:Ue("+",_("Import from file or archive","WireGuard app")),qr:Ue("+",_("Scan from QR code","WireGuard app"))},mac:{file:Ue("+",_("Import Tunnel(s) from File…","WireGuard app"))},windows:{file:Ue(_("Add Tunnel","WireGuard app"),_("Import tunnel(s) from file…","WireGuard app"))}}[e]}function Ct(e,t="unknown"){var r;if(e==="vpn")return Ue("+",_("QR code","AmneziaVPN app"));let n=(r=Mt(t))==null?void 0:r.qr;return n!=null?n:N(_("%s (Android: %s)"),Mt("ios").qr,Mt("android").qr.replace(/^.* → /,""))}function Vt(e,t="unknown"){var n;return e==="vpn"?Ue("+",_("Insert","AmneziaVPN app")):((n=Mt(t))!=null?n:Mt("android")).file}var Lr=()=>N(_("Tap “%s” and connect"),_("Continue","AmneziaVPN app"));function Ar(e,t,n,r){if(t==="linux")return[[_("Open a terminal in the folder with the file"),""],[`${_("Run")} `,`sudo ${e==="wg"?"wg-quick":"awg-quick"} up ./${n}`]];let o=Vt(e,t);return[[N(_("Open %s","step"),ce[e]),""],[o.replace(/ → [^→]*$/," → "),o.replace(/^.* → /,"")],[r?_("Confirm the import and connect"):_("Pick the file and connect"),""]]}function Sr(e){return{ios:"iPhone / iPad",android:"Android",windows:"Windows",mac:"Mac",linux:"Linux",unknown:_("this device")}[e]}var Pr=(e,t)=>`${e}#setup=${t}`;function $r(e){var t,n;return(n=(t=/^#setup=(d_[0-9a-f]{8})$/.exec(e))==null?void 0:t[1])!=null?n:null}var Dr=e=>`${e}#add`,Hr=e=>e==="#add",Cn=(e,t=!1)=>(t?{phone:_("phone","on the"),tablet:_("tablet","on the"),computer:_("computer","on the"),router:_("router","on the"),other:_("device","on the")}:{phone:_("phone"),tablet:_("tablet"),computer:_("computer"),router:_("router"),other:_("device")})[e];var oe=null,pe=()=>oe;function ke(e){oe=e}var _i=document.getElementById("app"),Or,at=(Or=_i.dataset.base)!=null?Or:"",Rr=/^\/[a-z]{6}-[a-z]{6}-[a-z]{6}$/.test(at)?at.slice(1):"",lt=()=>location.origin+location.pathname,Be=()=>{var e;return(e=oe==null?void 0:oe.today)!=null?e:Wt(new Date)},ct=()=>{var e;return(e=oe==null?void 0:oe.now)!=null?e:Date.now()/1e3},Yt=()=>Mr(navigator.userAgent,navigator.maxTouchPoints),Ei=()=>(oe==null?void 0:oe.server.awg_disguise)===!1,Br=()=>{var e;return(e=oe==null?void 0:oe.server.preset)!=null?e:Ei()?"off":"max"},Nr=()=>(oe==null?void 0:oe.https_url)||null,Xe=()=>(oe==null?void 0:oe.server.name)||"Dawnline",Ir=()=>{};function Gr(e){Ir=e}var Ee=(e={})=>Ir(e);var qe=class extends Error{constructor(n,r,o){super(r);this.status=n;this.httpsUrl=o}};async function fe(e,t){let n=await fetch(`${at}/api/${e}`,{method:t===void 0?"GET":"POST",credentials:"omit",headers:t===void 0?{"Accept-Language":Je()}:{"Content-Type":"application/json","Accept-Language":Je()},body:t===void 0?void 0:JSON.stringify(t),cache:"no-store"}),r=null;try{r=await n.json()}catch{}if(!n.ok)throw new qe(n.status,r!=null&&r.error?cr(r.error):N(_("Request failed (%s)"),n.status),(r==null?void 0:r.https_url)||void 0);return r}var jt=e=>e instanceof qe&&(e.status===404||e.status===401);var Fr=mi(Ur(),1),Ti=e=>``,qr="#0a0a0a",Li="#f2f2f2",Ai={night:[qr,Li],day:["#ffffff",qr]},En=e=>e.length>300,dt=e=>+e.toFixed(2);function _n(e,t,n,r,o){return`M${dt(e+o)} ${dt(t)}h${dt(n-2*o)}a${o} ${o} 0 0 1 ${o} ${o}v${dt(r-2*o)}a${o} ${o} 0 0 1 -${o} ${o}h-${dt(n-2*o)}a${o} ${o} 0 0 1 -${o} -${o}v-${dt(r-2*o)}a${o} ${o} 0 0 1 ${o} -${o}z`}function Vr(e,t=3,n=!0,r="plain"){let o=En(e),s=r!=="plain",[c,m]=s?Ai[r]:["#fff","#000"],g=(0,Fr.default)(0,o?"L":"H");g.addData(e,"Byte"),g.make();let f=g.getModuleCount(),T=f+t*2,M=n&&!o?Math.round(f*.22):0;M&&(f-M)%2&&M++;let b=(f-M)/2,O=b+M,B=(a,h)=>M>0&&a>=b&&a=b&&hs&&(h<7&&a<7||h<7&&a>=f-7||h>=f-7&&a<7),R="";if(s){let a=o?.48:.42;for(let h=0;h${Ti(s?c:"#fff")}`}let v=``;return s?`${v}${d}`:`${v}${d}`}var Yr={opacity:1,filter:"blur(0px)",transform:"none"},Si={opacity:0,filter:"blur(5px)",transform:"scale(.86)"},jr={opacity:0,filter:"blur(5px)",transform:"scale(.6)"},Qr={duration:180,easing:Z,fill:"forwards"},Qt={duration:340,delay:70,easing:j,fill:"backwards"},Jr=Qt.delay+Qt.duration,Jt=new WeakMap;function Tn(e){let t=getComputedStyle(e);return{opacity:t.opacity,filter:t.filter==="none"?"blur(0px)":t.filter,transform:t.transform}}function Xr(e){var t;for(let n of[...e.childNodes])n.nodeType===Node.TEXT_NODE&&((t=n.textContent)!=null&&t.trim())&&n.replaceWith(i("span",{},n.textContent));return[...e.children].filter(n=>!n.classList.contains("orb"))}function Zr(e,t){var r;let n=(r=Jt.get(e))!=null?r:[];Jt.set(e,t),n.forEach(o=>o.cancel())}function eo(e){var o;(o=e.querySelector(":scope > .orb"))==null||o.remove();let t=Xr(e),n=t.map(Tn),r=i("span",{class:"orb","aria-hidden":"true"},i("i"),i("i"));e.append(r),e.classList.add("busy"),e.setAttribute("aria-busy","true"),Zr(e,[...t.map((s,c)=>$(s,[n[c],Si],Qr)),$(r,[jr,Yr],Qt)])}function to(e){let t=e.querySelector(":scope > .orb"),n=Xr(e),r=[...t?[$(t,[Tn(t),jr],Qr)]:[],...n.map(o=>$(o,[Tn(o),Yr],Qt))];Zr(e,r),e.removeAttribute("aria-busy"),Promise.all(r.map(o=>o.finished)).then(()=>{Jt.get(e)===r&&(Jt.delete(e),r.forEach(o=>o.cancel()),t==null||t.remove(),e.classList.remove("busy"))},()=>{})}var no=e=>[...e].map(t=>i("i",{},t)),ut=new WeakMap,_t=e=>{var t,n,r;return(r=(n=(t=ut.get(e))==null?void 0:t.text)!=null?n:e.textContent)!=null?r:""};function Sn(e){let t=document.createRange();return t.selectNodeContents(e),t.getBoundingClientRect()}function ro(e){var s;let t=e.firstChild;if(!t||t.nodeType!==Node.TEXT_NODE)return[];let n=document.createRange(),r=[],o=0;for(let c of(s=t.textContent)!=null?s:"")n.setStart(t,o),n.setEnd(t,o+c.length),r.push(n.getBoundingClientRect().left),o+=c.length;return r.map(c=>c-r[0])}function oo(e,t){let n=[...e.children];if(!n.length)return;let r=n[0].getBoundingClientRect().left;n.forEach((o,s)=>{if(!s||t[s]===void 0)return;let c=r+t[s]-o.getBoundingClientRect().left;Math.abs(c)>.01&&(o.style.marginLeft=`${c}px`)})}function Pi(e,t){let n=0;for(;nnew Array(s.length+1).fill(0));for(let g=o.length-1;g>=0;g--)for(let f=s.length-1;f>=0;f--)c[g][f]=o[g]===s[f]?c[g+1][f+1]+1:Math.max(c[g+1][f],c[g][f+1]);let m=[];for(let g=0;g=c[g][f+1]?g++:f++;for(let g=r;g>0;g--)m.push([e.length-g,t.length-g]);return m}function Xt(e){let t=ut.get(e);t&&(clearTimeout(t.timer),ut.delete(e),e.getAnimations().forEach(n=>n.cancel()),e.classList.remove("mt","mt-ib"),e.textContent=t.text)}function Ne(e,t){Xt(e),e.textContent=t}function te(e,t,n=_t(e),r={}){var le,ue;let{whole:o=!1,at:s}=r,c=((le=r.glide)!=null?le:!0)&&!s,m=ut.has(e)?e.getBoundingClientRect().width:null;if(Xt(e),n===t||Se()||!e.getClientRects().length){e.textContent=t;return}let g=getComputedStyle(e),f=o&&g.display==="inline";g.display==="inline"&&!o&&e.classList.add("mt-ib"),g.position==="static"&&e.classList.add("mt");let T=null,M=s!=null?s:null,b=[];M||(e.textContent=n,T=e.getBoundingClientRect(),M=Sn(e),b=ro(e)),e.textContent=t;let O=e.getBoundingClientRect(),B=ro(e),D=(ue=m!=null?m:T==null?void 0:T.width)!=null?ue:O.width,R=c&&!f&&!!T&&Math.abs(O.width-D)>.5,P=!R||!T||Math.abs(O.left-T.left)<.5?"start":Math.abs(O.right-T.right)<.5?"end":"middle",d=i("span",{class:o?"mt-new w":"mt-new"},o?t:no(t)),v=i("span",{class:o?"mt-old w":"mt-old","aria-hidden":"true"},o?n:no(n));o&&(v.style.width=`${M.width+1}px`),e.replaceChildren(d,v),R&&$(e,[{width:`${D}px`},{width:`${O.width}px`}],{duration:q.duration,easing:q.easing,fill:"forwards"});let a=e.getBoundingClientRect(),h=(Y,ee)=>{v.style.top=`${ee}px`,P==="end"?v.style.right=`${-Y}px`:P==="middle"?(v.style.left="50%",v.style.translate=`calc(-50% + ${Y}px) 0`):v.style.left=`${Y}px`},p=P==="end"?M.right-a.right:P==="middle"?(M.left+M.right-a.left-a.right)/2:M.left-a.left;h(p,M.top-a.top);let A=Sn(v);if(h(p+M.left-A.left,M.top-a.top+M.top-A.top),o){$(v,[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}],{duration:180,easing:Z,fill:"forwards"}),$(d,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}],{duration:280,delay:60,easing:j,fill:"backwards"});let Y=Math.max(340,R?q.duration:0)+40;ut.set(e,{text:t,timer:window.setTimeout(()=>Xt(e),Y)});return}oo(d,B),oo(v,b);let u=[...v.children],l=[...d.children],E=Pi([...n],[...t]),x=new Set(E.map(([Y])=>Y)),C=new Set(E.map(([,Y])=>Y));E.forEach(([Y,ee])=>{let ie=u[Y].getBoundingClientRect(),ne=l[ee].getBoundingClientRect();u[Y].style.visibility="hidden",(Math.abs(ie.left-ne.left)>.5||Math.abs(ie.top-ne.top)>.5)&&$(l[ee],[{transform:`translate(${ie.left-ne.left}px, ${ie.top-ne.top}px)`},{transform:"none"}],{duration:q.duration,easing:q.easing})});let I=u.filter((Y,ee)=>!x.has(ee)),G=l.filter((Y,ee)=>!C.has(ee)),V=Math.min(12,160/Math.max(1,I.length)),J=Math.min(22,260/Math.max(1,G.length));I.forEach((Y,ee)=>$(Y,[{opacity:1,filter:"blur(0px)",transform:"none"},{opacity:0,filter:"blur(4px)",transform:"translateY(-0.45em)"}],{duration:220,delay:ee*V,easing:Z,fill:"forwards"})),G.forEach((Y,ee)=>$(Y,[{opacity:0,filter:"blur(4px)",transform:"translateY(0.45em)"},{opacity:1,filter:"blur(0px)",transform:"none"}],{duration:380,delay:120+ee*J,easing:j,fill:"backwards"}));let re=Math.max(220+I.length*V,G.length?120+G.length*J+380:0,R||E.length?q.duration:0)+40;ut.set(e,{text:t,timer:window.setTimeout(()=>Xt(e),re)})}function Zt(e){return new Map([...e.querySelectorAll("[data-t]")].map(t=>[t.dataset.t,_t(t)]))}function en(e,t){e.querySelectorAll("[data-t]").forEach(n=>{var s;let r=t.get(n.dataset.t),o=(s=n.textContent)!=null?s:"";r!==void 0&&r!==o&&te(n,o,r)})}var io=e=>`${e.tagName}.${[...e.classList].filter(t=>t!=="mt"&&t!=="mt-ib").join(" ")}`,so=e=>e.outerHTML.replace(/\bgl\d+/g,"gl");function $i(e){let t=new Map,n=(r,o)=>r.childNodes.forEach((s,c)=>{var T,M;let m=`${o}/${c}`;if(s.nodeType===Node.TEXT_NODE){if((T=s.textContent)!=null&&T.trim()){let b=document.createRange();b.selectNodeContents(s);let O=b.getBoundingClientRect();t.set(m,{kind:"#text",text:s.textContent,svg:"",at:O,words:O,node:s})}return}if(!(s instanceof Element))return;let g=s instanceof SVGElement?so(s):"",f=s instanceof HTMLElement&&!g?Sn((M=s.querySelector(":scope > .mt-new"))!=null?M:s):null;t.set(m,{kind:io(s),text:s instanceof HTMLElement?_t(s):"",svg:g,at:s.getBoundingClientRect(),words:f,node:s}),g||n(s,m)});return n(e,""),t}var Ln=e=>$(e,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}],{duration:280,delay:60,easing:j,fill:"backwards"});function tn(e,t){var O;let n=$i(e),r=e.getBoundingClientRect();if(We(e,t),!n.size||Se())return;let o=e.getBoundingClientRect(),s=B=>B&&new DOMRect(B.left-r.left+o.left,B.top-r.top+o.top,B.width,B.height),c=[],m=[],g=new Set,f=(B,D,R)=>{var v;let P=B.parentElement,d=R?(v=n.get(R))==null?void 0:v.at:r;D!=null&&D.at&&D.node instanceof Element&&m.push(P&&d?[D.node,D.at,P,d]:[D.node,D.at,e,r]),c.push(()=>Ln(B))},T=(B,D,R)=>{let P=B.getBoundingClientRect(),d=D.left-r.left-(P.left-o.left),v=D.top-r.top-(P.top-o.top),a=d-R[0],h=v-R[1];return(Math.abs(a)>.5||Math.abs(h)>.5)&&$(B,[{transform:`translate(${a}px, ${h}px)`},{transform:"none"}],{duration:q.duration,easing:q.easing}),[d,v]},M=(B,D,R)=>[...B.childNodes].forEach((P,d)=>{var A,u;let v=`${D}/${d}`;g.add(v);let a=n.get(v);if(P.nodeType===Node.TEXT_NODE){let l=(A=P.textContent)!=null?A:"";if(!l.trim()||(a==null?void 0:a.kind)==="#text"&&a.text===l)return;let E=i("span",{},l);P.replaceWith(E),a!=null&&a.at&&T(E,a.at,R),c.push(()=>{var x;return(a==null?void 0:a.kind)==="#text"&&l.length<=40&&a.text.length<=40?te(E,l,a.text,{whole:!0,at:(x=s(a.words))!=null?x:void 0}):Ln(E)});return}if(!(P instanceof Element))return;let h=P.getBoundingClientRect();if(!a||a.kind!==io(P)||a.at&&Math.abs(a.at.height-h.height)>1&&!(P instanceof SVGElement))return f(P,a,D);let p=a.at?T(P,a.at,R):R;if(P instanceof SVGElement){a.svg!==so(P)&&c.push(()=>Ln(P));return}if(!P.children.length&&P instanceof HTMLElement){let l=(u=P.textContent)!=null?u:"";l!==a.text&&c.push(()=>{var E;return l.length<=40&&a.text.length<=40?te(P,l,a.text,{whole:!0,at:(E=s(a.words))!=null?E:void 0}):f(P,a,D)});return}M(P,v,p)});M(e,"",[0,0]);for(let[B,D]of n)!g.has(B)&&B.lastIndexOf("/")===0&&D.at&&D.node instanceof Element&&m.push([D.node,D.at,e,r]);c.forEach(B=>B());let b=new Map;for(let[,,B]of m)!b.has(B)&&getComputedStyle(B).position==="static"&&B.classList.add("mt"),b.set(B,((O=b.get(B))!=null?O:0)+1);for(let[B,D,R,P]of m){let d=B;d.style.position="absolute",d.style.margin="0",d.style.left=`${D.left-P.left-R.clientLeft}px`,d.style.top=`${D.top-P.top-R.clientTop}px`,d.style.width=`${D.width}px`,d.style.pointerEvents="none",d.setAttribute("aria-hidden","true"),R.appendChild(d),$(d,[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}],{duration:180,easing:Z,fill:"forwards"}).onfinish=()=>{d.remove();let v=b.get(R)-1;b.set(R,v),v||R.classList.remove("mt")}}}var Di='',An=()=>[z("apple"),Re(Di)];function Hi(e,t){if(e===t)return["",e,e,""];let n=e.split(" "),r=t.split(" "),o=0;for(;og?d[2]:d[1],T=d=>i("span",{class:"osm-p"},d),M=()=>{c=o.findIndex(d=>d[1]!==d[2]),c<0&&(g=0),s=o.map(d=>({pre:T(d[0]),word:T(f(d)),suf:T(d[3])})),m=c>=0?i("span",{class:"osm-ic"},An()[g]):null,n.replaceChildren(...s.flatMap((d,v)=>[v?i("span",{class:"arr"},"›"):null,d.pre,v===c?m:null,d.word,d.suf]).filter(d=>!!d))},b={width:"1.05em",marginRight:"0.25em"},O=d=>$(d,[{opacity:1,filter:"blur(0px)",...b},{opacity:0,filter:"blur(3px)",width:"0px",marginRight:"0px"}],{duration:220,easing:Z,fill:"forwards"}).onfinish=()=>d.remove(),B=d=>$(d,[{opacity:0,filter:"blur(3px)",width:"0px",marginRight:"0px"},{opacity:1,filter:"blur(0px)",...b}],{duration:q.duration,easing:q.easing}),D=(d,v)=>{r.setAttribute("aria-label",(d===v?d:N(_("%s (Android: %s)"),d,v.split(" → ").pop())).replace(/ → /g," › "));let a=d.split(" → "),h=v.split(" → "),p=a.map((u,l)=>{var E;return Hi(u,(E=h[l])!=null?E:u)});if(!s.length||p.length!==o.length)return o=p,M();let A=c;o=p,c=o.findIndex(u=>u[1]!==u[2]),c<0&&(g=0),o.forEach((u,l)=>{te(s[l].pre,u[0],void 0,{whole:!0}),te(s[l].word,f(u),void 0,{whole:!0}),te(s[l].suf,u[3],void 0,{whole:!0})}),c!==A&&(m&&O(m),m=c>=0?i("span",{class:"osm-ic"},An()[g]):null,m&&(s[c].word.before(m),B(m)))};D(e,t);let R=()=>{if(!r.isConnected)return clearInterval(P);if(c<0||!m||!r.offsetParent)return;g=1-g,te(s[c].word,f(o[c]));let d=m.firstElementChild,v=An()[g];if(Se()){d.replaceWith(v);return}m.appendChild(v),$(d,[{opacity:1,filter:"blur(0px)",transform:"none"},{opacity:0,filter:"blur(3px)",transform:"scale(.5) rotate(-40deg)"}],{duration:200,easing:Z,fill:"forwards"}).onfinish=()=>d.remove(),$(v,[{opacity:0,filter:"blur(3px)",transform:"scale(.5) rotate(40deg)"},{opacity:1,filter:"blur(0px)",transform:"none"}],{duration:xe.duration,delay:80,easing:xe.easing,fill:"backwards"})},P=window.setInterval(R,3e3);return{el:r,set:D}}var nn=null,Et=null,lo=0,co=(e,t,n)=>$(e,t,{duration:n,easing:Z,fill:"forwards"}).onfinish=()=>e.remove();function Ce(e,t=!1){nn!=null||(nn=document.body.appendChild(i("div",{class:"toasts"}))),Et&&co(Et,[{opacity:1},{opacity:0,transform:"scale(.96)",filter:"blur(4px)"}],140);let n=i("div",{class:`toast${t?" bad":""}`,role:"status"},z(t?"alert":"check"),i("span",{},e));nn.appendChild(n),Et=n,$(n,[{opacity:0,transform:"translateY(18px) scale(.9)",filter:"blur(6px)"},{opacity:1,transform:"none",filter:"none"}],{duration:Le.duration,easing:Le.easing}),clearTimeout(lo),lo=window.setTimeout(()=>{Et===n&&(Et=null,co(n,[{opacity:1},{opacity:0,transform:"translateY(6px) scale(.96)",filter:"blur(4px)"}],180))},2400)}function Oi(e){var s;if(e.classList.contains("copied"))return;let t=e.querySelector("svg.i"),n=e.querySelector(".lbl, .b-main"),r=n?_t(n):"";e.classList.add("copied");let o=null;t&&(o=z("check",(s=t.getAttribute("class"))!=null?s:"i"),t.replaceWith(o),$(o,[{opacity:0,transform:"scale(.6)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:xe.duration,easing:xe.easing})),n&&te(n,_("Copied")),setTimeout(()=>{o&&t&&o.replaceWith(t),n&&te(n,r),e.classList.remove("copied")},1600)}async function he(e,t=_("Copied"),n){try{await navigator.clipboard.writeText(e)}catch{let r=i("textarea",{class:"offscreen"},e);document.body.appendChild(r),r.select();let o=document.execCommand("copy");if(r.remove(),!o)return Ce(_("Copying is blocked here. Select the text and copy it by hand."),!0)}n instanceof Element&&Oi(n),Ce(t)}function Ze(e,t){var o;let n=navigator;if(Yt()!=="ios"||typeof n.share!="function"||typeof File=="undefined")return null;let r=new File([t],e,{type:"application/octet-stream"});return(o=n.canShare)!=null&&o.call(n,{files:[r]})?async()=>{try{await n.share({files:[r]})}catch(s){(s==null?void 0:s.name)!=="AbortError"&&rn(e,t)}}:null}function rn(e,t){let n=URL.createObjectURL(new Blob([t],{type:"application/octet-stream"})),r=i("a",{href:n,download:e,class:"offscreen"});document.body.appendChild(r),r.click(),setTimeout(()=>{URL.revokeObjectURL(n),r.remove()},1e3)}function Tt(e,t){let n=Ze(e,t);n?n():rn(e,t)}async function et(e,t){if(e.disabled)return;e.disabled=!0,eo(e);let n=performance.now();try{await t()}finally{let r=Se()?0:Jr-(performance.now()-n);r>0&&await new Promise(o=>setTimeout(o,r)),to(e),e.disabled=!1}}var Pn=matchMedia("(prefers-color-scheme: light)"),Ri=()=>Pn.matches?"day":"night";function $n(e,t){var n,r;e.dataset.qr=t,e.classList.toggle("dense",En(t)),e.classList.toggle("light",Pn.matches),e.innerHTML=Vr(t,3,!0,Ri()),e.dataset.mods=String((r=(n=e.firstElementChild)==null?void 0:n.viewBox.baseVal.width)!=null?r:0)}function Lt(e,t=!1){let n=i("div",{class:`qrbox${t?" big":""}`});return $n(n,e),n}Pn.addEventListener("change",()=>document.querySelectorAll(".qrbox[data-qr]").forEach(e=>{var t;(t=e.querySelector("svg.old"))==null||t.remove(),$n(e,e.dataset.qr)}));function Dn(e,t){let n=Lt(e),r=i("div",{class:"words"},t),o=i("div",{class:"side"},r),s=i("div",{class:`coderow${n.classList.contains("dense")?" stacked":""}`},n,o);return{el:s,swap(c,m){let g=n.dataset.qr===c?null:n.querySelector("svg");if(g){$n(n,c),s.classList.toggle("stacked",n.classList.contains("dense"));let T=n.querySelector("svg");g.classList.add("old"),n.appendChild(g),$(T,[{opacity:0},{opacity:1}],{duration:200,easing:j}),$(g,[{opacity:1},{opacity:0}],{duration:220,delay:110,easing:Z,fill:"forwards"}).onfinish=()=>g.remove()}if(!m)return;let f=r;r=i("div",{class:"words"},m),o.appendChild(r),f.classList.add("old"),$(r,[{opacity:0,filter:"blur(3px)"},{opacity:1,filter:"blur(0px)"}],{duration:220,easing:j}),$(f,[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(3px)"}],{duration:200,delay:90,easing:Z,fill:"forwards"}).onfinish=()=>f.remove()}}}function pt(e){let t=typeof navigator.share=="function";return i("div",{class:"linkrow"},i("span",{class:"mono"},e.replace(/^https?:\/\//,"")),i("button",{type:"button",class:"knob","aria-label":_("Copy the link"),onclick:n=>he(e,_("Link copied"),n.currentTarget)},z("copy")),t?i("button",{type:"button",class:"knob","aria-label":_("Share the link"),onclick:()=>navigator.share({url:e,title:Xe()}).catch(()=>{})},z("share")):null)}var tt=null,Ie=null,At=()=>!!tt;function $e(e=!1){let t=tt;if(t){if(tt=null,Ie==null||Ie.setAttribute("aria-expanded","false"),Ie=null,e){t.remove();return}$(t,[{opacity:1},{opacity:0,transform:"scale(.96)",filter:"blur(3px)"}],{duration:120,easing:Z,fill:"forwards"}).onfinish=()=>t.remove()}}function on(e,t){var f,T;if(Ie===e&&tt)return $e();$e(!0);let n=t.filter((M,b)=>M||b>0&&t[b-1]&&t.slice(b+1).some(Boolean)),r=i("span",{class:"menu-hl"}),o=i("div",{class:"menu",role:"menu"},r);for(let M of n){if(!M){o.appendChild(i("div",{class:"menu-sep"}));continue}let b=i("button",{type:"button",role:M.checked===void 0?"menuitem":"menuitemradio","aria-checked":M.checked===void 0?null:String(M.checked),class:`mi ${(f=M.tone)!=null?f:""}`,onclick:()=>{$e(),M.run()}},M.checked===void 0?z((T=M.icon)!=null?T:""):z("check",M.checked?"i":"i off"),i("span",{},M.label));b.addEventListener("pointerenter",()=>{var O;r.className=`menu-hl${r.style.opacity==="1"?" moving":""} ${(O=M.tone)!=null?O:""}`,r.style.transform=`translateY(${b.offsetTop-6}px)`,r.style.opacity="1"}),o.appendChild(b)}o.addEventListener("pointerleave",()=>r.style.opacity="0"),document.body.appendChild(o);let s=e.getBoundingClientRect(),c=o.offsetWidth,m=o.offsetHeight,g=s.bottom+8+m{let t=e.target;tt&&!tt.contains(t)&&!(Ie!=null&&Ie.contains(t))&&$e()});addEventListener("scroll",()=>$e(),{passive:!0});var de,De,F,Hn,mt,Ve,ae,Fe=[],sn=null,On=null,St=!1,ft=null,He=()=>!!(de!=null&&de.classList.contains("open")),gt=400,uo=80,Bi=3.2,vt=()=>matchMedia("(min-width: 760px)").matches,ht=gt,Rn=null;function yt(){var o;if(!de||!He())return null;if(!vt())return F.style.maxWidth&&(F.style.maxWidth=""),ht=gt,null;let e=[...ae.querySelectorAll(".qrbox.dense")].find(s=>{let c=s.closest(".acc-row");return s.offsetWidth&&(!c||c.classList.contains("open"))&&!s.closest(".leaving")}),t=gt;if(e){let s=Math.min(innerWidth-32-uo,innerHeight-120);t=Math.max(gt,Math.round(Math.min(+((o=e.dataset.mods)!=null?o:0)*Bi,s)+uo))}let n=e&&e!==Rn?e:null;if(Rn=e!=null?e:null,Math.abs(t-ht)<8)return n?{from:t,want:t,reveal:n}:null;let r=parseFloat(getComputedStyle(F).maxWidth)||ht;return ht=t,F.getAnimations().filter(s=>{var c;return(c=s.effect)==null?void 0:c.getKeyframes().some(m=>"maxWidth"in m)}).forEach(s=>s.cancel()),F.style.maxWidth=`${t}px`,{from:r,want:t,reveal:n}}function bt(e){if(!e)return;Math.abs(e.from-e.want)>1&&$(F,[{maxWidth:`${e.from}px`},{maxWidth:`${e.want}px`}],{duration:q.duration,easing:q.easing});let t=e.reveal;t&&setTimeout(()=>{if(!t.isConnected)return;let n=Ve.getBoundingClientRect(),r=t.getBoundingClientRect(),o=r.bottom>n.bottom-16?r.bottom-n.bottom+16:r.topme()},z("x")),mt=i("div",{class:"sheet-acts"}),ae=i("div",{class:"vp"}),Ve=i("div",{class:"sheet-scroll"},ae),F=i("div",{class:"sheet",role:"dialog","aria-modal":"true"},Hn,mt,Ve),De=i("div",{class:"scrim",onclick:()=>me()}),de=i("div",{class:"sheet-root","aria-hidden":"true"},De,F),document.body.appendChild(de),new ResizeObserver(()=>bt(yt())).observe(ae),Gi()}function po(e){F.setAttribute("aria-label",e.label),Hn.setAttribute("aria-label",_("Close")),F.setAttribute("role",e.asks?"alertdialog":"dialog"),F.classList.toggle("asks",!!e.asks)}function an(){let e=On;On=null,e==null||e()}function fo(e){On=e}function nt(e){sn=e}function ge(e){if(de||Ni(),$e(!0),an(),He()){Fe=[e],Bn(e());return}ft=document.activeElement instanceof HTMLElement?document.activeElement:null,Fe=[e],sn=null,ht=gt,Rn=null,F.style.maxWidth="",F.classList.remove("arrived");let t=e();ae.replaceChildren(t.el),ho(t,!1),po(t),de.classList.add("open"),de.setAttribute("aria-hidden","false"),document.body.classList.add("locked");let n=yt();if(n&&bt({...n,from:n.want}),F.getAnimations().forEach(r=>r.cancel()),De.getAnimations().forEach(r=>r.cancel()),F.style.transform="",vt()?$(F,[{opacity:0,transform:"scale(.9)",filter:"blur(4px)"},{opacity:1,transform:"none",filter:"none"}],{duration:Ae.duration,easing:Ae.easing}):$(F,[{transform:"translateY(calc(100% + 40px))"},{transform:"none"}],{duration:500,easing:Mn}),$(De,[{opacity:0},{opacity:1}],vt()?{duration:Ae.duration,easing:Ae.easing}:{duration:420,easing:"ease-out"}),!St)try{history.pushState({sheet:!0},""),St=!0}catch{}}function me(e=!1){if(!He()||de.dataset.closing)return;an(),St&&(St=!1,history.back()),document.body.classList.remove("locked");let t=()=>{de.classList.remove("open"),de.setAttribute("aria-hidden","true"),delete de.dataset.closing,F.style.transform="",De.style.opacity="",F.getAnimations().forEach(s=>s.cancel()),De.getAnimations().forEach(s=>s.cancel()),ae.getAnimations().forEach(s=>s.cancel()),ae.replaceChildren(),mt.replaceChildren(),F.classList.remove("arrived"),F.style.maxWidth="",ht=gt,Fe=[],ft!=null&&ft.isConnected&&ft.focus({preventScroll:!0}),ft=null;let o=sn;sn=null,o==null||o()};if(e)return t();de.dataset.closing="1";let n=getComputedStyle(F).transform;F.getAnimations().forEach(o=>o.cancel()),$(De,[{opacity:getComputedStyle(De).opacity},{opacity:0}],vt()?{duration:120,easing:Z,fill:"forwards"}:{duration:320,easing:"ease-out",fill:"forwards"});let r=n==="none"?"none":n;$(F,vt()?[{opacity:1,transform:r,filter:"blur(0px)"},{opacity:0,transform:`${r==="none"?"":r} scale(.96)`.trim(),filter:"blur(3px)"}]:[{transform:r},{transform:"translateY(calc(100% + 40px))"}],vt()?{duration:120,easing:Z,fill:"forwards"}:{duration:420,easing:Mn,fill:"forwards"}).onfinish=t}addEventListener("popstate",()=>{He()&&(St=!1,me())});function ho(e,t=!0){var o;let n=(o=e.acts)!=null?o:null,r=mt.firstElementChild;if(n!==r){if(!t||r&&n&&r.dataset.key===n.dataset.key)return mt.replaceChildren(...n?[n]:[]);r&&(Object.assign(r.style,{position:"absolute",right:"0",top:"0",pointerEvents:"none"}),$(r,[{opacity:1,transform:"none",filter:"none"},{opacity:0,transform:"scale(.9)",filter:"blur(3px)"}],{duration:180,easing:"cubic-bezier(.2,0,0,1)",fill:"forwards"}).onfinish=()=>r.remove()),n&&(mt.appendChild(n),$(n,[{opacity:0,transform:"scale(.9)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:260,delay:110,easing:"cubic-bezier(.2,0,0,1)",fill:"backwards"}))}}function Bn(e){po(e),ho(e),F.classList.remove("arrived");let t=[...ae.children],n=ae.getBoundingClientRect().height;ae.getAnimations().forEach(s=>s.cancel()),t.forEach(s=>{s.classList.add("leaving"),Object.assign(s.style,{position:"absolute",left:"0",right:"0",top:"0",pointerEvents:"none"}),s.inert=!0}),ae.appendChild(e.el),e.el.style.pointerEvents="none",setTimeout(()=>e.el.style.pointerEvents="",320),Ve.scrollTop=0;let r=yt(),o=e.el.getBoundingClientRect().height;$(ae,[{height:`${n}px`},{height:`${o}px`}],{duration:360,easing:"cubic-bezier(.25,1,.5,1)"}),bt(r),t.forEach(s=>$(s,[{opacity:1,transform:"none",filter:"none"},{opacity:0,transform:"scale(.96)",filter:"blur(2px)"}],{duration:200,easing:"cubic-bezier(.2,0,0,1)",fill:"forwards"}).onfinish=()=>s.remove()),$(e.el,[{opacity:0,transform:"scale(.96)",filter:"blur(4px)"},{opacity:1,transform:"none",filter:"none"}],{duration:280,delay:110,easing:"cubic-bezier(.2,0,0,1)",fill:"backwards"})}function ln(e){if(!He())return ge(e);an(),Fe.push(e),Bn(e())}function Ii(){Fe.length<2||(an(),Fe.pop(),Bn(Fe[Fe.length-1]()))}function mo(e,t=[]){if(!He())return e();let n=ae.getBoundingClientRect().height;ae.getAnimations().forEach(g=>g.cancel());let r=ae.lastElementChild,o=new Map;r==null||r.querySelectorAll("*").forEach(g=>{(!(g instanceof SVGElement)||g instanceof SVGSVGElement)&&o.set(g,g.getBoundingClientRect())}),e();let s=yt(),c=ae.getBoundingClientRect().height;Math.abs(c-n)>1&&$(ae,[{height:`${n}px`},{height:`${c}px`}],{duration:q.duration,easing:q.easing}),bt(s);let m=new Set;for(let[g,f]of o){if(!g.isConnected||!f.width||!f.height)continue;let T=g.getBoundingClientRect();if(!T.width||!T.height)continue;let M=f.left-T.left,b=f.top-T.top;if(Math.abs(M)<.5&&Math.abs(b)<.5)continue;m.add(g);let O=g.parentElement;for(;O&&O!==r&&!m.has(O);)O=O.parentElement;O&&O!==r||$(g,[{transform:`translate(${M}px, ${b}px)`},{transform:"none"}],{duration:q.duration,easing:q.easing})}for(let g of t)g&&$(g,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,easing:j})}function go(){F==null||F.classList.add("arrived")}var vo=()=>Ve==null?void 0:Ve.scrollTo({top:0,behavior:"smooth"}),Nn=e=>He()&&ae.contains(e)&&!e.closest(".leaving");function Gi(){let e=null;F.addEventListener("pointerdown",n=>{let r=n.target;!r.closest(".vhead")||r.closest("button, a, input")||(e={y:n.clientY,t:performance.now(),dy:0,v:0},F.setPointerCapture(n.pointerId))}),F.addEventListener("pointermove",n=>{if(!e)return;let r=n.clientY-e.y,o=performance.now(),s=r>0?r:-gr(-r,F.offsetHeight);e.v=(s-e.dy)/Math.max(1,o-e.t),e.dy=s,e.t=o,F.style.transform=`translateY(${s}px)`,De.style.opacity=String(Math.max(0,1-Math.max(0,s)/420))});let t=()=>{if(!e)return;let{dy:n,v:r}=e;if(e=null,vr(n,r,F.offsetHeight))return me();let o=F.style.transform;F.style.transform="",De.style.opacity="",n!==0&&$(F,[{transform:o},{transform:"none"}],{duration:q.duration,easing:q.easing})};F.addEventListener("pointerup",t),F.addEventListener("pointercancel",t)}function Te(e,t={}){return i("div",{class:`vhead${t.back?" center":""}${t.acts?" with-acts":""}`},t.back?i("button",{type:"button",class:"knob back","aria-label":_("Back"),onclick:Ii},z("chevron")):null,i("h2",{},e))}var Ge=e=>i("p",{class:"vsub"},e),Ye=(...e)=>i("p",{class:"hint"},...e);function yo(){ge(()=>{let e=lt();return{el:i("div",{class:"view"},Te(_("Open on another device")),Ge(_("Point its camera at the code: this page opens there.")),Lt(e,!0),pt(e)),label:_("Open on another device")}})}var Wi='',dn=null,Pt=null,cn=null;function In(e){if(Pt)return Pt;dn=i("header",{class:"crumbs"}),Pt=i("div",{class:"page-body"}),e.replaceChildren(i("div",{class:"edge-fade top","aria-hidden":"true"}),i("div",{class:"edge-fade bot","aria-hidden":"true"}),cn=i("main",{class:"page"},dn,Pt));let t=()=>document.body.classList.toggle("scrolled",scrollY>2);return addEventListener("scroll",t,{passive:!0}),t(),Pt}function Gn(e){cn==null||cn.classList.toggle("single",e)}function zi(){let e=i("button",{type:"button",class:"cr-lang","aria-label":_("Language"),"aria-haspopup":"menu","aria-expanded":"false"},i("span",{},Je().toUpperCase()),z("chevron","i cr-down"));return e.addEventListener("click",()=>on(e,It.map(t=>({label:t.name,checked:t.code===Je(),run:()=>t.code!==Je()&&wn(t.code)})))),e}function Wn(e=!1,t=!1){var o;if(!dn)return;let n=e?null:(o=pe())==null?void 0:o.person,r=i("span",{class:n?"":"cur","aria-current":n?null:"page"},Xe());dn.replaceChildren(i("span",{class:"cr-mark"},Re(Wi)),i("nav",{class:"cr-path","aria-label":_("Breadcrumb")},r,n?[z("chevron"),i("span",{class:"cur","aria-current":"page"},n.name)]:null),...t?[]:[zi()],...n&&!t?[i("button",{type:"button",class:"knob cr-qr","aria-label":_("Open on another device"),onclick:yo},z("qr"))]:[])}function xo(e,t,n=10){let r=m=>(Pe(m).getDay()+6)%7,o=st(e,-r(e)),s=st(t,6-r(t)),c=[];for(let m=o;m<=s;m=st(m,1))if(c.push({day:m,kind:mn*7)return null;return c}var Ki=/^([01]?\d|2[0-3]):([0-5]\d)$/;function bo(e){let t=Ki.exec(e.trim());return t?+t[1]*60+ +t[2]:null}var $t=e=>(e%1440+1440)%1440,rt=e=>`${String(Math.floor($t(e)/60)).padStart(2,"0")}:${String($t(e)%60).padStart(2,"0")}`;function un(e,t,n){let[r,o]=e.split("-"),s=bo(r!=null?r:""),c=bo(o!=null?o:"");if(s==null||c==null)return null;let m=t==null?0:n-t;return{from:$t(s+m),to:$t(c+m),yours:t!=null}}var wo=e=>e.from$t(Math.floor(e/60)+t);function ko(e){let t=Pe(e);return{days:new Date(t.getFullYear(),t.getMonth()+1,0).getDate(),day:t.getDate()}}var Co={phone:{b:'',f:'',d:''},mobile:{b:'',f:'',d:''},tablet:{b:'',f:'',d:''},computer:{b:'',f:'',d:''},router:{b:'',f:'',d:''},other:{b:'',f:'',d:""},plus:{b:'',f:'',d:''},globe:{b:'',f:'',d:''},home:{b:'',f:'',d:''},shield:{b:'',f:'',d:''},chart:{b:'',f:'',d:''},calendar:{b:'',f:'',d:''},clock:{b:'',f:'',d:''},pause:{b:'',f:'',d:''},server:{b:'',f:'',d:''},link:{b:'',f:'',d:''},key:{b:'',f:'',d:''},lock:{b:'',f:'',d:''},check:{b:'',f:'',d:''},trash:{b:'',f:'',d:''},refresh:{b:'',f:'',d:''},app:{b:'',f:'',d:null},file:{b:'',f:'',d:''}},Ui=()=>Gt("amnezia","").replace(/^]*>/,"").replace(/<\/svg>$/,""),qi=0;function Fi(e,t="grey",n="gi"){var c;let r=(c=Co[e])!=null?c:Co.other,o=`gl${++qi}`,s=r.d===null?`${Ui()}`:`${r.d}`;return``}var Q=(e,t="grey",n="gi")=>Re(Fi(e,t,n));function pn(e,t,n,r){return i("div",{class:`notice ${e}`},Q(t,e==="bad"?"red":"orange"),i("div",{class:"t"},n?i("b",{},n):null,i("span",{},r)))}function Vi(e){var r;let t=un(e,(r=pe())==null?void 0:r.tz_offset,-new Date().getTimezoneOffset());if(!t)return N(_("%s (router time)"),e.replace("-","–"));let n=`${rt(t.from)}–${rt(t.to)}`;return N(t.yours?_("%s your time"):_("%s (router time)"),n)}function zn(e){switch(e.state){case"server_off":return["server",_("Server is disabled"),_("Your devices can’t connect until it’s enabled again.")];case"no_server":return["server",_("No server yet"),_("You haven’t been added to one.")];case"quota":return["chart",_("Out of data"),_("Nothing gets through until it resets.")];case"expired":return["calendar",_("Access ended"),_("Your devices can’t connect until it’s extended.")];case"hours":return["clock",_("Outside your hours"),N(_("Open %s."),Vi(e.hours))];default:return["pause",_("Access paused"),_("Your devices can’t connect until it’s resumed.")]}}function _o(e){if(e.state!=="active")return pn(e.state==="quota"||e.state==="expired"?"bad":"warn",...zn(e));let t=Kt(e.expires,Be());return wt(e,t)?pn("warn","calendar",N(_("Access %s"),br(t)),N(_("On %s."),zt(e.expires))):null}function Yi(e){let t=i("div",{class:"view"},Te(_("Open the link securely")),Ge(_("Connection settings only travel encrypted")),i("div",{class:"center-col secure"},Q("lock","blue","gi xl"),i("p",{},_("This page is open without encryption. To add or set up a device, open the same link over HTTPS:"))),i("a",{class:"btn accent block",href:e},z("lock"),i("span",{},_("Open securely"))),Ye(_("The browser may warn that the certificate is not trusted: it is this router’s own. Choose to continue (“Advanced” → “Proceed”).")));return t.lastElementChild.classList.add("secure-note"),{el:t,label:_("Open the link securely")}}var Dt=e=>ge(()=>Yi(e));function xt(){let e=Nr();return e?(Dt(e),!0):!1}var ji={jc:"0",jmin:"0",jmax:"0",s1:"0",s2:"0",s3:"0",s4:"0",h1:"1",h2:"2",h3:"3",h4:"4",i1:"",i2:"",i3:"",i4:"",i5:""},Qi={header_protection_key:"HeaderProtectionKey",content_padding_addition:"ContentPaddingAddition",rekey_after_time:"RekeyAfterTime",rekey_timeout:"RekeyTimeout",reject_after_time:"RejectAfterTime",keepalive_timeout:"KeepaliveTimeout",max_handshake_attempts:"MaxHandshakeAttempts",random_trailers:"RandomTrailers",disable_cookies:"DisableCookies"};function Ji(e){let t={};for(let[n,r]of Object.entries(Qi))e[n]!=null&&e[n]!==""&&(t[r]=String(e[n]));return t}function Xi(e,t){var g;let n=e.amnezia,r=(g=n.obfuscation)!=null?g:{},o=f=>r[f]!=null&&r[f]!==""?String(r[f]):ji[f],s=n.host.replace(/^\[(.*)\]$/,"$1"),c={H1:o("h1"),H2:o("h2"),H3:o("h3"),H4:o("h4"),I1:o("i1"),I2:o("i2"),I3:o("i3"),I4:o("i4"),I5:o("i5"),Jc:o("jc"),Jmin:o("jmin"),Jmax:o("jmax"),S1:o("s1"),S2:o("s2"),S3:o("s3"),S4:o("s4"),...Ji(r),allowed_ips:n.allowed_ips,client_ip:n.client_ip,client_priv_key:n.client_priv_key,client_pub_key:n.client_pub_key,config:e.conf.replace(/\r?\n/g,`\r -`),hostName:s,mtu:n.mtu,persistent_keep_alive:n.persistent_keep_alive,port:Number(n.port),psk_key:n.psk_key,server_pub_key:n.server_pub_key},m={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(c),port:String(n.port),protocol_version:r.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:t,hostName:s};return n.dns[0]&&(m.dns1=n.dns[0]),n.dns[1]&&(m.dns2=n.dns[1]),m}function Zi(e){let t="";for(let n=0;ne.replace(/^vpn:\/\//,"");var To=["height","marginTop","marginBottom","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"];function je(e,t={}){let n=i("div",{class:`acc${t.inset?" inset":""}`}),r=e.map((f,T)=>{var P;let M=f.body.filter(d=>!!d),b=!M.length,O=[f.icon,i("span",{class:"acc-title"},i("span",{class:"t"},f.title),(P=f.tag)!=null?P:null),f.val?i("span",{class:`acc-val${f.valHide?" hide-open":""}`},f.val):null],B=T===t.open&&!b,D=b?i("div",{class:"acc-head"},...O):i("button",{type:"button",class:"acc-head","aria-expanded":String(B),onclick:()=>g(R)},...O,z("chevron","i acc-chev")),R=i("div",{class:`acc-row${b?" still":""}${B?" open":""}`},D,i("div",{class:"acc-body"},...M));return n.appendChild(R),R}),o=f=>f.querySelector(".acc-body"),s=()=>r.forEach((f,T)=>{let M=f.classList.contains("open");f.classList.toggle("rt",T===0||M||r[T-1].classList.contains("open")),f.classList.toggle("rb",T===r.length-1||M||r[T+1].classList.contains("open"))}),c=f=>{let T=getComputedStyle(f),M={};for(let b of To)M[b]=b==="height"?`${f.getBoundingClientRect().height}px`:T[b];return M},m=()=>r.forEach(f=>{var T;return(T=f.querySelector("button.acc-head"))==null?void 0:T.setAttribute("aria-expanded",String(f.classList.contains("open")))});function g(f){var B;let T=r.map(c);r.forEach(D=>D.getAnimations().forEach(R=>R.cancel())),r.forEach(D=>o(D).getAnimations().forEach(R=>R.cancel()));let M=!f.classList.contains("open"),b=r.filter(D=>D.classList.contains("open")&&(D===f||M));r.forEach(D=>{D.classList.remove("closing"),D!==f&&D.classList.remove("open")}),f.classList.toggle("open",M),s();let O=yt();r.forEach((D,R)=>{let P=c(D);To.some(d=>T[R][d]!==P[d])&&(b.includes(D)&&D.classList.add("closing"),$(D,[T[R],P],{duration:Ae.duration,easing:Ae.easing}).onfinish=()=>D.classList.remove("closing"))}),b.forEach(D=>$(o(D),[{opacity:1},{opacity:0,filter:"blur(2px)"}],{duration:160,easing:Z,fill:"forwards"})),M&&$(o(f),[{opacity:0,filter:"blur(2px)"},{opacity:1,filter:"blur(0px)"}],{duration:300,easing:"cubic-bezier(0,0,.58,1)"}),bt(O),m(),(B=t.onToggle)==null||B.call(t,r.indexOf(f),M,!1)}return s(),{el:n,openIndex:()=>r.findIndex(f=>f.classList.contains("open")),setOpen(f){r.forEach((T,M)=>T.classList.toggle("open",M===f&&!T.classList.contains("still"))),s(),m(),r.forEach((T,M)=>{var b;return(b=t.onToggle)==null?void 0:b.call(t,M,T.classList.contains("open"),!0)})}}}function Lo(e,t,n){let r=i("span",{class:"seg-pill"}),o=i("div",{class:"seg appseg",role:"tablist"},r),s=e.map(b=>{let O=i("button",{type:"button",class:"seg-b",role:"tab","aria-label":b.label,title:b.label,onclick:()=>M(b.value)},z(b.icon),i("span",{class:"seg-l"},b.label));return O.dataset.v=b.value,o.appendChild(O),O}),c=b=>b.querySelector(".seg-l"),m=()=>s.forEach(b=>{let O=b.dataset.v===t;b.classList.toggle("on",O),b.setAttribute("aria-selected",String(O))}),g=()=>{let b=s.find(O=>O.dataset.v===t);return b&&b.offsetWidth?[b.offsetLeft,o.clientWidth-b.offsetLeft-b.offsetWidth]:null},f=()=>{let b=g();b&&(r.style.left=`${b[0]}px`,r.style.right=`${b[1]}px`)},T=0;function M(b){if(b===t)return;let O=s.findIndex(C=>C.dataset.v===t),B=s.findIndex(C=>C.dataset.v===b),D=getComputedStyle(r),R=parseFloat(D.left)||0,P=parseFloat(D.right)||0,d=s.map(C=>parseFloat(getComputedStyle(C).flexGrow)||0),v=c(s[O]),a=v.getBoundingClientRect().width;[...s,...s.map(c)].forEach(C=>C.getAnimations().forEach(I=>I.cancel())),t=b,m(),s.forEach((C,I)=>{let G=I===B?1:0;d[I]!==G&&$(C,[{flexGrow:d[I]},{flexGrow:G}],{duration:q.duration,easing:q.easing})}),$(v,[{opacity:1,maxWidth:`${a}px`,marginLeft:"0px"},{opacity:0,maxWidth:"0px",marginLeft:"-8px"}],{duration:220,easing:"ease-out"}),$(c(s[B]),[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,delay:70,easing:j,fill:"backwards"});let h=B>O,p=Se()?q:hr,A=performance.now(),u=Math.max(q.duration,p.duration),l=h?q:p,E=h?p:q;cancelAnimationFrame(T);let x=()=>{let C=Se()?u:performance.now()-A,I=g();if(!I){T=0;return}r.style.left=`${R+(I[0]-R)*l.at(C)}px`,r.style.right=`${P+(I[1]-P)*E.at(C)}px`,T=C{T||f()}).observe(o),{el:o,sync(b){b!==t&&(t=b,m(),f())}}}var Po={vpn:"amnezia",awg:"amneziawg",wg:"wireguard"},$o=e=>`dl.app.${e.id}`;function Do(e){try{let t=localStorage.getItem($o(e));return t==="vpn"||t==="awg"||t==="wg"?t:null}catch{return null}}function Ho(e,t){try{localStorage.setItem($o(e),t)}catch{}}function Qe(e,t=!1){var s,c;let n=[i("span",{class:"b-ic"},z(e.mark)),i("span",{class:"b-t"},i("span",{class:"b-top"},e.top),i("span",{class:"b-main"},e.main)),z(e.onclick||(s=e.href)!=null&&s.startsWith("vpn:")?"chevron":"open")],r=`badge${t?" primary":""}`;if(e.onclick)return i("button",{type:"button",class:r,onclick:e.onclick},n);let o=(c=e.href)==null?void 0:c.startsWith("vpn:");return i("a",{class:r,href:e.href,target:o?null:"_blank",rel:"noopener noreferrer"},n)}function Oo(e,t,n){let r=n?Tr(e):Er(e,t);return r?r.alt?[i("div",{class:"badges2"},Qe(r),Qe(r.alt)),Ye(r.alt.why)]:[Qe(r)]:[Ye(N(_("Get %s on the %s and come back here."),ce[e],Sr(t)))]}var Ao=e=>i("ol",{class:"howto"},e.map(([t,n])=>i("li",{},t.replace(/ → $/," ›"),n?[" ",i("b",{},n)]:null))),ts=(e,t)=>i("button",{type:"button",onclick:t},e);function Ro(e){let t=e.app(),n=ce[t],r=e.pf==="ios"||e.pf==="android",o=e.same()&&r,s=g=>he(e.key,_("Key copied"),g.currentTarget),c=t==="vpn"&&o&&!kn(e.pf)?Ze(kt(e.cfg.filename),e.key):null;if(t==="vpn"&&o&&(kn(e.pf)||c))return[Qe(c?{top:_("Then come back here and tap"),main:_("Send to AmneziaVPN"),mark:"amnezia",onclick:()=>void c()}:{href:e.key,top:_("Then come back here and tap"),main:_("Open in AmneziaVPN"),mark:"amnezia"},!0),Ye(...Ke(c?_("Pick AmneziaVPN in the share sheet. Not there? %s and add it in the app."):_("Nothing opened? %s and add it in the app."),ts(_("Copy the key","in a sentence"),s)))];if(t==="vpn"){let g=Vt("vpn");return[Qe({top:_("The connection as one key"),main:_("Copy the key"),mark:"copy",onclick:s},!0),Ao([[N(_("Open %s","step"),n),""],[g.replace(/ → [^→]*$/," → "),g.replace(/^.* → /,"")],[Lr(),""]])]}let m=r?Ze(e.cfg.filename,e.cfg.conf):null;return[Qe(m?{top:e.same()?N(_("Straight into %s"),n):N(_("Send it to the %s"),e.there),main:_("Share the file"),mark:"share",onclick:()=>void m()}:{top:_("Then import it in the app"),main:_("Download the file"),mark:"download",onclick:()=>rn(e.cfg.filename,e.cfg.conf)},!0),Ao(Ar(t,e.pf,e.cfg.filename,!!m&&e.same()))]}function Bo(e){let t=e.app(),n=(o,s,c)=>i("button",{type:"button",class:"btn soft sm",onclick:c},z(o),i("span",{class:"lbl"},s));if(t==="vpn"){let o=kt(e.cfg.filename),s=!!Ze(o,e.key);return[i("p",{class:"desc"},N(_("Send it to the %s in a message or a note, then in AmneziaVPN: %s."),e.there,Vt("vpn").replace(/ → /g," › "))),i("div",{class:"btnrow2"},n("copy",_("Copy the key"),c=>he(e.key,_("Key copied"),c.currentTarget)),n(s?"share":"download",s?_("Share as a file"):_("Download the key"),()=>Tt(o,e.key)))]}let r=!!Ze(e.cfg.filename,e.cfg.conf);return[i("p",{class:"desc"},...Ke(_("Send it to the %s, then import %s in %s."),e.there,i("b",{},e.cfg.filename),ce[t])),i("div",{class:"btnrow2"},n(r?"share":"download",r?_("Share the file"):_("Download the file"),()=>Tt(e.cfg.filename,e.cfg.conf)),n("copy",_("Copy the configuration"),o=>he(e.cfg.conf,_("Configuration copied"),o.currentTarget)))]}function So(e,t){if(/^\s*\[.+\]\s*$/.test(e))return i("span",{class:"sec"},e);let n=/^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(e);if(!n)return document.createTextNode(e);let r=/^(\s*)(PrivateKey|PresharedKey)\b/.test(e);return i("span",{},i("span",{class:"k"},n[1])," ",r&&!t?i("span",{class:"mask"},"••••••••••••••••"):n[2])}function No(e){let t=!1,n=i("pre",{class:"conf"}),r=()=>n.replaceChildren(...e.conf.split(` -`).flatMap((f,T)=>T?[` -`,So(f,t)]:[So(f,t)]));r();let o=!!Ze(e.filename,e.conf),s=i("button",{type:"button",class:"btn soft sm",onclick:()=>{t=!t,s.replaceChildren(z(t?"x":"key"),i("span",{},t?_("Hide key"):_("Show key"))),r(),n.querySelectorAll(".mask, .k").forEach(f=>$(f,[{filter:"blur(4px)",opacity:.4},{filter:"none",opacity:1}],{duration:320,easing:j}))}},z("key"),i("span",{},_("Show key"))),c=i("button",{type:"button",class:"btn soft sm",onclick:f=>he(e.conf,_("Configuration copied"),f.currentTarget)},z("copy"),i("span",{class:"lbl"},_("Copy"))),m=i("div",{class:"filecard"},i("div",{class:"fc-row"},i("span",{class:"filecard-ic"},".conf"),i("span",{class:"t"},i("span",{class:"mono"},e.filename),i("span",{},_("For computers and routers")))),i("button",{type:"button",class:"btn accent sm block",onclick:()=>Tt(e.filename,e.conf)},z(o?"open":"download"),i("span",{},o?_("Share file"):_("Download")))),g=je([{icon:Q("file"),title:_("Configuration"),body:[i("div",{class:"confbar"},s,c),n]}],{inset:!0});return i("div",{class:"step-box"},m,g.el)}function Io(e){let t=i("span",{class:"osm-p"},ce[e]),n=ao(Ct(e,"ios"),Ct(e,"android"));return{el:i("span",{class:"scanline"},i("span",{},...Ke(_("In %s:"),t)),n.el),set(r){te(t,ce[r],void 0,{whole:!0}),n.set(Ct(r,"ios"),Ct(r,"android"))}}}function Go(e){let t=i("span",{class:"tt"}),n=i("span",{class:"tt-m"}),r=i("span",{class:"hp-tip","aria-hidden":"true"},t,n),o=i("button",{type:"button",class:"hp-b",onclick:()=>Tt(e().file,e().text)},z("download")),s=i("button",{type:"button",class:"hp-b"},z("copy")),c=i("div",{class:"hpill",role:"group","aria-label":_("The connection"),"data-key":"conn"},o,s,r),m=null,g=0,f=0,T=a=>{var h;return a===s&&s.classList.contains("done")?_("Copied"):(h=a.getAttribute("aria-label"))!=null?h:""},M=(a,h)=>{n.textContent=h;let p=n.offsetWidth+20;return Math.min(a.offsetLeft+a.offsetWidth/2,c.offsetWidth+46-p/2)},b=a=>`translateX(${a}px) translateX(-50%)`,O=a=>{let h=getComputedStyle(r).transform;r.getAnimations().forEach(p=>p.cancel()),r.style.transform=b(a),$(r,[{transform:h},{transform:b(a)}],{duration:q.duration,easing:q.easing})},B=a=>te(t,a),D=a=>{if(clearTimeout(g),m===a&&r.classList.contains("on"))return;if(m=a,r.classList.contains("on")){let p=T(a);return O(M(a,p)),B(p)}let h=()=>{let p=T(a);Ne(t,p);let A=M(a,p);r.getAnimations().forEach(u=>u.cancel()),r.style.transform=b(A),r.classList.add("on"),$(r,[{opacity:0,transform:`${b(A)} translateY(-3px) scale(.96)`,filter:"blur(3px)"},{opacity:1,transform:b(A),filter:"blur(0px)"}],{duration:220,easing:j})};performance.now(){clearTimeout(g),m=null,r.classList.contains("on")&&(f=performance.now()+500,r.classList.remove("on"),$(r,[{opacity:1},{opacity:0}],{duration:120,easing:"ease-out"}))};for(let a of[o,s])a.addEventListener("pointerenter",h=>{h.pointerType==="mouse"&&D(a)}),a.addEventListener("focus",()=>{a.matches(":focus-visible")&&D(a)}),a.addEventListener("blur",R);c.addEventListener("pointerleave",R);let P=a=>{let h=z(a);s.querySelector("svg").replaceWith(h),$(h,[{opacity:0,transform:"scale(.6)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:xe.duration,easing:xe.easing})},d=()=>{if(m!==s||!r.classList.contains("on"))return;let a=T(s);O(M(s,a)),B(a)},v=0;return s.addEventListener("click",()=>{let a=e();he(a.text,a.msg),clearTimeout(v),s.classList.contains("done")||(s.classList.add("done"),P("check"),d()),v=window.setTimeout(()=>{s.classList.remove("done"),P("copy"),d()},1600)}),{el:c,sync(){let a=e().app;o.setAttribute("aria-label",N(_("Download %s config"),a)),s.setAttribute("aria-label",N(_("Copy %s config"),a))}}}function zo(e){let t=i("b",{},_("Waiting for the connection")),n=i("span",{class:"ws",hidden:!0}),r=i("div",{class:"way",role:"status","aria-live":"polite"},i("div",{class:"way-row"},i("span",{class:"way-end"},z(e.kind)),i("span",{class:"way-track"},i("span",{class:"way-glow"},i("i")),i("span",{class:"way-fill"})),i("span",{class:"way-end home"},z("server"))),i("div",{class:"way-text"},i("span",{class:"t"},t,n)));return{el:r,connected(){r.classList.add("done"),te(t,N(_("%s connected"),e.name))},gaveUp(){r.classList.add("stopped"),te(t,_("No connection yet")),n.textContent=_("Close this and open it again to keep checking."),n.hidden=!1,$(t.parentElement,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,easing:j})}}}function Ko(e,t=4){window.setTimeout(async()=>{var n;try{let r=await fe("state");ke(r),At()||Ee(),!((n=r.person.devices.find(o=>o.id===e))!=null&&n.online)&&t>1&&Ko(e,t-1)}catch{}},1500)}function Uo(e,t,n){let r=ct(),o=0,s=0,c=!1,m=Date.now(),g=async()=>{if(o=0,!c){if(Date.now()-m>6e5){c=!0,n();return}if(document.hidden)return f();try{let M=await fe("state");ke(M);let b=M.person.devices.find(O=>O.id===e.id);if(b&&b.handshake>r){c=!0,t(),b.online||Ko(e.id);return}}catch(M){if(jt(M)){c=!0;return}}s++,f()}},f=()=>{!c&&!o&&(o=window.setTimeout(g,s<6?5e3:s<12?15e3:3e4))},T=()=>{!document.hidden&&!c&&!o&&g()};return document.addEventListener("visibilitychange",T),f(),()=>{c=!0,o&&clearTimeout(o),document.removeEventListener("visibilitychange",T)}}var Wo=e=>new Promise(t=>setTimeout(t,e));async function qo(e,t,n){e.connected(),go(),vo(),await Wo(400),Nn(e.el)&&(t.style.overflow="hidden",$(t,[{height:`${t.offsetHeight}px`,opacity:1,filter:"none"},{height:"0px",opacity:0,filter:"blur(4px)"}],{duration:520,easing:j,fill:"forwards"}),$(e.el,[{marginBottom:"18px"},{marginBottom:"0px"}],{duration:520,easing:j,fill:"forwards"}),await Wo(2400),Nn(e.el)&&(nt(()=>Ee({flash:n.id})),me()))}async function ns(e){try{return await fe(`devices/${e.id}/config`)}catch(t){return t instanceof qe&&t.httpsUrl?Dt(t.httpsUrl):Ce(t.message,!0),null}}async function fn(e,t){if(xt())return;let n=async()=>{let r=await ns(e);if(!r)return;let o=await Kn(r,r.server);ge(()=>Vo(e,r,o))};t instanceof HTMLButtonElement?await et(t,n):await n()}async function hn(e,t){let n=await Kn(t,t.server);ln(()=>Vo(e,t,n))}function Fo(e,t,n){return i("div",{class:"step"},i("span",{class:"step-n"},e),i("div",{class:"step-b"},typeof t=="string"?i("span",{class:"step-t"},t):t,n))}function rs(e,t,n){let r=e.hidden?0:e.getBoundingClientRect().height;if(e.getAnimations().forEach(m=>m.cancel()),n){e.hidden=t;return}e.style.overflow="hidden",e.hidden=!1;let o=t?0:e.getBoundingClientRect().height,[s,c]=t?[1,0]:[0,1];$(e,[{height:`${r}px`,opacity:s,filter:`blur(${4-s*4}px)`},{height:`${o}px`,opacity:c,filter:`blur(${4-c*4}px)`}],{duration:q.duration,easing:q.easing}).onfinish=()=>{e.style.overflow="",e.hidden=t}}function Vo(e,t,n){var Y,ee;let r=Yt(),o=_r(Br()),s=e.kind==="phone"||e.kind==="tablet",c=e.kind==="router",m=Cr(e.kind,r),g=m?"same":c?"router":s?"away":"pc-away",f=Cn(e.kind),T=Cn(e.kind,!0),M=o.filter(ie=>!c||ie.id!=="vpn"),b=(Y=Do(e))!=null?Y:c?"awg":"vpn";M.some(ie=>ie.id===b)||(b=M[0].id);let O={d:e,cfg:t,key:n,pf:r,there:f,app:()=>b,same:()=>m},B=[],D=()=>{if(M.length<2)return null;let ie=Lo(M.map(ne=>({value:ne.id,label:ne.name,icon:Po[ne.id]})),b,ne=>{b=ne,Ho(e,ne),B.forEach(Bt=>Bt.sync(ne)),mo(l)});return B.push(ie),ie.el},R=i("span",{class:"step-t"}),P=i("div",{class:"step-box"}),d=i("div",{class:"step-box"}),v=i("div",{class:"step-box"}),a=i("div",{class:"step-box"}),h=null,p=null,A=null,u=g==="away"?Go(()=>({...b==="vpn"?{text:n,msg:_("Key copied"),file:kt(t.filename)}:{text:t.conf,msg:_("Configuration copied"),file:t.filename},app:ce[b]})):null;function l(){te(R,c?N(_("Get %s on the router"),ce[b]):N(_("Get %s"),ce[b]),void 0,{whole:!0}),tn(P,Oo(b,r,c)),c?d.firstChild||We(d,No(t)):tn(d,Ro(O));let ie=b==="vpn"?Eo(n):t.conf;h&&p&&h.el.isConnected?A!==b&&(h.swap(ie),p.set(b)):(p=Io(b),h=Dn(ie,[p.el]),v.replaceChildren(h.el)),A=b,tn(a,Bo(O)),u==null||u.sync()}l();let E=Pr(lt(),e.id),x=()=>[s?Dn(E,[i("span",{},_("Point its camera at the code: the link opens there."))]).el:i("p",{class:"desc"},N(_("Open this link on the %s to set it up there."),T)),pt(E)],C=()=>Fo("1",R,[D(),P]),I=()=>Fo("2",c?_("Import the configuration"):_("Add the connection"),[d]),G=i("div",{class:"setup"});if(kr(navigator.userAgent)&&G.appendChild(pn("warn","shield",null,_("Open this page in Safari or Chrome: the store opens from here, but the app handoff does not."))),g==="same"){let ie=i("div",{class:"steps-wrap"},i("div",{class:"steps-gap"}),C(),I()),ne=je([{icon:Q("link"),title:N(_("Not on the %s right now?"),T),body:x()}],{inset:!0,onToggle:(Bt,w,k)=>rs(ie,w,k)});G.append(ne.el,ie)}else g==="router"?G.append(C(),I()):g==="away"?G.appendChild(je([{icon:Q("link"),title:N(_("Open your link on the %s"),T),body:x()},{icon:Q("app"),title:_("Already has the app"),body:[D(),v]}],{inset:!0,open:1}).el):G.appendChild(je([{icon:Q("link"),title:N(_("Open your link on the %s"),T),body:x()},{icon:Q("key"),title:_("Copy or save the connection"),body:[D(),a]}],{inset:!0,open:0}).el);let V=zo(e),J=!1;fo(Uo(e,()=>{J||(J=!0,qo(V,G,e))},V.gaveUp)),nt(()=>Ee());let re=g==="same"?_("Two steps, about a minute"):c?_("The packages and the file for OpenWrt"):N(_("The app goes on the %s."),f),le=N(_("Set up %s"),e.name);return{el:i("div",{class:"view"},Te(le,{acts:!!u}),Ge(re),V.el,G),label:le,acts:(ee=u==null?void 0:u.el)!=null?ee:null}}var ve=navigator.userAgent,Qo=/iPad/.test(ve)||/Macintosh/.test(ve)&&navigator.maxTouchPoints>1;function Ot(){return Qo||/Tablet/i.test(ve)||/Android/.test(ve)&&!/Mobile/.test(ve)?"tablet":/Android|iPhone|Mobile/i.test(ve)?"phone":"computer"}var os=[[/^SM-S93/,"Galaxy S25"],[/^SM-S92/,"Galaxy S24"],[/^SM-S91/,"Galaxy S23"],[/^SM-S90/,"Galaxy S22"],[/^SM-G99/,"Galaxy S21"],[/^SM-F9/,"Galaxy Z Fold"],[/^SM-F7/,"Galaxy Z Flip"],[/^SM-A5/,"Galaxy A5x"],[/^SM-A3/,"Galaxy A3x"],[/^SM-X/,"Galaxy Tab"]],Un="",is=(async()=>{var t;let e=navigator.userAgentData;if(!e||!/Android/.test(ve))return"";try{let n=((t=(await e.getHighEntropyValues(["model"])).model)!=null?t:"").trim();if(!n||n==="K")return"";let r=os.find(([o])=>o.test(n));Un=r?`${r[1]} (${n})`:/^SM-/.test(n)?`Galaxy ${n}`:n}catch{}return Un})();function ss(e){return/iPhone/.test(ve)?"iPhone":Qo?"iPad":/Android/.test(ve)?Un||(e==="tablet"?_("Android tablet"):_("Android phone")):/CrOS/.test(ve)?"Chromebook":/Mac OS X/.test(ve)?"Mac":/Windows/.test(ve)?_("Windows PC"):/Linux/.test(ve)?_("Linux PC"):Ut(e)}var Yo=e=>e==="mobile"?_("Mobile"):Ut(e),Ht=e=>e==="phone"||e==="tablet"?"mobile":e,jo=e=>e!=="mobile"?e:Ot()==="tablet"?"tablet":"phone";function Rt(){let e=pe();if(!(!e||e.locked)){if(!e.can_add)return Ce(ze(e.person.device_limit,"You have reached your limit of %s device","You have reached your limit of %s devices"),!0);xt()||ge(as)}}function as(){let e=pe(),t=e.person,n=["computer","mobile","router","other"].filter(d=>e.kinds.some(v=>Ht(v)===d)),r=n.includes(Ht(Ot()))?Ht(Ot()):n[0],o=!1,s=new Set(t.devices.map(d=>d.name.toLowerCase())),c=d=>{let v=d===Ht(Ot())?ss(jo(d)):Ut(d==="mobile"?"phone":d);if(!s.has(v.toLowerCase()))return v;for(let a=2;a<20;a++)if(!s.has(`${v} ${a}`.toLowerCase()))return`${v} ${a}`;return v},m=i("div",{class:"kinds",role:"radiogroup","aria-label":_("What is it?")});m.style.setProperty("--n",String(n.length));let g=n.map(d=>{let v=i("button",{type:"button",class:"kind",role:"radio","aria-label":Yo(d),onclick:()=>O(d)},i("span",{class:"kind-tile"},Q(d,"blue")),i("span",{class:"kind-lbl"},Yo(d)));return m.appendChild(v),v}),f=i("input",{type:"text",maxlength:48,required:!0,"aria-label":_("Name"),autocomplete:"off"}),T=i("button",{class:"go ready",type:"submit","aria-label":_("Create connection")},z("arrow")),M=i("p",{class:"hint bad-t",hidden:!0}),b=d=>{if(!M.hidden)return te(M,d);M.textContent=d,M.hidden=!1,$(M,[{opacity:0,transform:"translateY(-4px)"},{opacity:1,transform:"none"}],{duration:220,easing:j})};f.value=c(r),f.addEventListener("input",()=>{o=!0,T.classList.toggle("ready",!!f.value.trim()),M.hidden=!0}),is.then(()=>{!o&&r===Ht(Ot())&&(f.value=c(r))});function O(d){r=d,g.forEach((v,a)=>{let h=n[a]===d;v.classList.toggle("on",h),v.setAttribute("aria-checked",String(h))}),o||(f.value=c(d),T.classList.add("ready"))}O(r);let B=i("form",{class:"field",autocomplete:"off"},f,T);B.addEventListener("submit",d=>{d.preventDefault();let v=f.value.trim();if(v){if(s.has(v.toLowerCase()))return b(_("You already have a device with this name."));et(T,async()=>{try{let a=await fe("devices",{name:v,kind:jo(r)});ke(a.state),Ee({pop:a.id});let h=a.state.person.devices.find(p=>p.id===a.id);await hn(h,a.config)}catch(a){if(a instanceof qe&&a.httpsUrl)return Dt(a.httpsUrl);b(a.message)}})}});let D=i("button",{type:"button",class:"btn soft block",onclick:()=>ln(ls)},z("qr"),i("span",{},_("Add it from the device"))),R=t.device_limit-t.devices.length,P=i("div",{class:"view"},Te(_("Add a device")),Ge(N(N_(t.device_limit,"%s of %s slot free","%s of %s slots free"),we(R),we(t.device_limit))),m,Ye(_("Phones and tablets get a smaller packet size that suits mobile networks.")),B,M,i("div",{class:"or"},_("OR")),D);return P.querySelector(".hint").classList.add("kinds-note"),{el:P,label:_("Add a device")}}function ls(){let e=Dr(lt());return{el:i("div",{class:"view"},Te(_("Open on the device"),{back:!0}),Ge(_("Point its camera at the code: your page opens there with this device ready to add.")),Lt(e,!0),pt(e)),label:_("Open on the device")}}function Jo(e){let t=i("button",{type:"button",class:`btn ${e.cls}`,onclick:r=>et(r.currentTarget,e.run)},i("span",{},e.action));return{el:i("div",{class:"view"},i("div",{class:"ask"},Q(e.icon,e.tone,"gi xl"),i("h3",{},e.title),i("p",{},e.text),i("div",{class:"btnrow"},i("button",{type:"button",class:"btn soft",onclick:()=>me()},_("Cancel")),t))),label:e.title,asks:!0}}function Xo(e){ge(()=>{let t=i("input",{type:"text",maxlength:48,"aria-label":_("Device name"),autocomplete:"off"});t.value=e.name;let n=i("button",{class:"go",type:"submit","aria-label":_("Save")},z("check"));t.addEventListener("input",()=>n.classList.toggle("ready",!!t.value.trim()&&t.value.trim()!==e.name));let r=i("form",{class:"field",autocomplete:"off"},t,n);r.addEventListener("submit",s=>{s.preventDefault();let c=t.value.trim();!c||c===e.name||et(n,async()=>{try{let m=await fe(`devices/${e.id}`,{action:"rename",name:c});ke(m.state),nt(()=>{Ee(),Ce(_("Renamed"))}),me()}catch(m){Ce(m.message,!0)}})}),setTimeout(()=>t.select(),60);let o=N(_("Rename %s"),e.name);return{el:i("div",{class:"view"},Te(o),r),label:o}})}function qn(e){var n;if(xt())return;let t=((n=pe())==null?void 0:n.here)===e.id;ge(()=>Jo({icon:"refresh",tone:"orange",title:N(_("Reconnect %s?"),e.name),text:t?_("It gets new keys. This device is connected through its current settings: it disconnects a few seconds after you confirm. Add the new ones that open next."):_("It gets new keys and its current settings stop working. Set it up again with the new ones that open next."),action:_("Reconnect"),cls:"accent",run:async()=>{var r;try{let o=await fe(`devices/${e.id}`,{action:"reconnect"});ke(o.state),Ee(),await hn((r=o.state.person.devices.find(s=>s.id===e.id))!=null?r:{...e,handshake:0},o.config)}catch(o){Ce(o.message,!0)}}}))}function Zo(e){ge(()=>Jo({icon:"trash",tone:"red",title:N(_("Remove %s?"),e.name),text:_("Its connection stops working at once. You can add it again later."),action:_("Remove"),cls:"red",run:async()=>{try{let t=await fe(`devices/${e.id}`,{action:"delete"});ke(t.state),nt(()=>{let n=document.querySelector(`.dev[data-id="${CSS.escape(e.id)}"]`),r=()=>{Ee(),Ce(_("Device removed"))};if(!n)return r();$(n,[{opacity:1,transform:"none",filter:"none"},{opacity:0,transform:"scale(.9)",filter:"blur(6px)"}],{duration:220,easing:Z,fill:"forwards"}).onfinish=r}),me()}catch(t){Ce(t.message,!0)}}}))}var Fn=(e,t)=>e.access!=="internet"&&e.state==="active"&&!t.disabled;function cs(e,t){return e.disabled?["",_("Disabled")]:e.config_stale&&e.handshake?["warn-t",_("Settings changed")]:e.online&&t.state==="quota"?["warn-t",_("Connected, no data left")]:e.online&&t.state==="hours"?["warn-t",_("Connected, outside your hours")]:e.online?["ok-t",_("Connected")]:e.handshake?["",N(_("Last connected %s"),yr(e.handshake,ct()))]:["warn-t",_("Not set up yet")]}function ds(e,t){return[...Fn(t.person,e)?[{label:_("Copy IP address"),icon:"copy",run:()=>he(e.address,_("IP address copied"))},...e.hostname?[{label:_("Copy local address"),icon:"home",run:()=>he(e.hostname,_("Address copied"))}]:[],null]:[],...e.disabled?[]:[{label:_("Rename"),icon:"edit",run:()=>Xo(e)},{label:_("Reconnect"),icon:"refresh",tone:"warn",run:()=>qn(e)},{label:_("Remove"),icon:"trash",tone:"bad",run:()=>Zo(e)}]]}function us(e){return e===0?_("Today"):e===1?_("Yesterday"):Pe(st(Be(),-e)).toLocaleDateString(_e(),{weekday:"short",day:"numeric",month:"short"})}function ps(e,t){let n=e.spark.reduce((c,m)=>c+m,0),r=i("span",{class:"use-lbl"},_("Last 7 days")),o=i("span",{class:"use-val num","data-t":`${e.id}:use`},Me(n)),s;if(t)s=i("button",{type:"button",class:"upd-pill","aria-label":_("Update the connection"),title:_("Its settings changed: update the connection"),onclick:()=>qn(e)},z("refresh"),i("span",{},_("Update")));else{let c=Math.max(1,...e.spark);s=i("div",{class:"spark"}),e.spark.forEach((m,g)=>{let f=e.spark.length-1-g,T=i("i",{class:f===0?"today":""});T.style.height=`${Math.max(3,Math.round(m/c*34))}px`,T.addEventListener("pointerenter",()=>{Ne(r,us(f)),Ne(o,Me(m))}),T.addEventListener("pointerleave",()=>{Ne(r,_("Last 7 days")),Ne(o,Me(n))}),s.appendChild(T)})}return i("div",{class:"dev-use"},i("div",{class:"use-txt"},r,o),s)}function fs(e,t){let n=t.person,r=!!t.locked,o=t.here===e.id,[s,c]=o?["here-t",_("This device")]:cs(e,n),m=!e.handshake&&!e.disabled,g=e.config_stale&&!m&&!r&&!e.disabled,f=!o&&e.handshake&&!e.online&&!e.disabled&&!e.config_stale?new Date(e.handshake*1e3).toLocaleString(_e()):g?_("Settings changed, update needed"):c,T=ds(e,t),M=r||!T.length?null:i("button",{type:"button",class:"knob more","aria-label":N(_("%s options"),e.name),"aria-haspopup":"menu","aria-expanded":"false"},z("more"));return M==null||M.addEventListener("click",()=>on(M,T)),i("article",{class:`dev${o?" is-here":""}${e.disabled?" off":""}`,"data-id":e.id},i("div",{class:"dev-top"},Q(e.kind,o?"blue":"grey"),i("div",{class:"dev-id"},i("span",{class:"dev-name","data-t":`${e.id}:name`},e.name),i("span",{class:`dev-stat ${s}`,title:f,"data-t":`${e.id}:stat`},c)),M),m&&r?null:m?i("button",{type:"button",class:"btn tint block setup-btn","aria-label":N(_("Set up %s"),e.name),onclick:b=>fn(e,b.currentTarget)},z("qr"),i("span",{},_("Connect"))):ps(e,g))}var hs=e=>i("div",{class:"dev first","data-id":"first"},Q("plus","blue"),i("b",{},_("Add your first device")),i("p",{},_("Two steps, about a minute: get the app, then add the connection.")),i("button",{type:"button",class:"btn accent block",onclick:Rt},z("plus"),i("span",{},e?_("Add this phone"):_("Add this device")))),ms=()=>i("button",{type:"button",class:"dev add","data-id":"add",onclick:Rt},Q("plus"),i("span",{},_("Add device")));function ei(){return i("section",{class:"devices",id:"devices","aria-label":_("Your devices")},i("div",{class:"sec-head"},i("h2",{},_("Your devices")),i("span",{class:"aside num"})),i("div",{class:"dgrid"}),i("p",{class:"note-s limit",hidden:!0}))}function ti(e,t,n={}){let r=t.person,o=e.querySelector(".dgrid"),s=o.childElementCount>0,c=new Map([...o.querySelectorAll("[data-id]")].map(P=>[P.dataset.id,P.getBoundingClientRect()])),m=Zt(o),f=qt(r.devices).sort((P,d)=>+(d.id===t.here)-+(P.id===t.here)).map(P=>fs(P,t)),T=t.locked?0:Math.max(0,r.device_limit-r.devices.length),M=matchMedia("(max-width: 959px)").matches||/Android|iPhone|iPad/.test(navigator.userAgent);!r.devices.length&&T?f.push(hs(M)):t.can_add&&!t.locked&&f.push(ms()),o.classList.toggle("empty",!r.devices.length),o.replaceChildren(...f);for(let P of f){let d=c.get(P.dataset.id),v=P.getBoundingClientRect();P.dataset.id===n.pop?$(P,[{opacity:0,transform:"scale(.9)",filter:"blur(6px)"},{opacity:1,transform:"none",filter:"none"}],{duration:Le.duration,easing:Le.easing}):d&&(d.left!==v.left||d.top!==v.top)?$(P,[{transform:`translate(${d.left-v.left}px, ${d.top-v.top}px)`},{transform:"none"}],{duration:q.duration,easing:q.easing}):!d&&s&&$(P,[{opacity:0,transform:"scale(.9)",filter:"blur(6px)"},{opacity:getComputedStyle(P).opacity,transform:"none",filter:"none"}],{duration:q.duration,delay:60,easing:q.easing,fill:"backwards"}),P.dataset.id===n.flash&&P.animate([{boxShadow:"inset 0 0 0 1.5px var(--ok)"},{boxShadow:"inset 0 0 0 1.5px transparent"}],{duration:1800,easing:"ease-out"})}s&&en(o,m);let b=e.querySelector(".sec-head .aside"),O=N(_("%s of %s"),we(r.devices.length),we(r.device_limit));s?te(b,O):b.textContent=O,b.classList.toggle("warn-t",r.devices.length>r.device_limit);let B=e.querySelector(".limit"),D=B.hidden,R=t.can_add||!!t.locked;if(B.textContent=ze(r.device_limit,"You have reached your limit of %s device. Remove one to add another.","You have reached your limit of %s devices. Remove one to add another."),B.getAnimations().forEach(P=>P.cancel()),s&&!D&&R){let P=$(B,[{opacity:1,filter:"none"},{opacity:0,filter:"blur(4px)"}],{duration:200,easing:Z,fill:"forwards"});P.onfinish=()=>{B.hidden=!0,P.cancel()}}else B.hidden=R,s&&D&&!R&&$(B,[{opacity:0,transform:"translateY(6px)",filter:"blur(4px)"},{opacity:1,transform:"none",filter:"none"}],{duration:420,easing:j})}var Vn=e=>i("p",{class:"desc"},e),gn=(e,t)=>`${(e/t*100).toFixed(2)}%`,ni=e=>Pe(e).toLocaleDateString(_e(),{day:"numeric",month:"short"});function gs(e){let t=(n,r,o,s)=>i("div",{class:`reach-tile${n?"":" off"}`},Q(r,n?"blue":"grey","gi rt-ic"),i("b",{},o),i("span",{class:"rt-sub"},n?s:_("Not included")),i("span",{class:"rt-mark","aria-label":n?_("Included"):_("Not included")},z(n?"check":"minus")));return i("div",{class:"reach2"},t(e!=="internet","home",_("Home network"),_("Devices at home")),t(e!=="lan","globe",_("Internet"),_("Through the router")))}function vs(e,t){let n=qt(e.devices).filter(m=>m.hostname&&Fn(e,m));if(!n.length)return[];let r=n[0].hostname,o=r.indexOf("."),s=o>0?r.slice(o):"",c=i("span",{class:"mono"},`${_("name")}${s}`);return[i("span",{class:"lbl-s"},...Ke(t?_("Devices at home and on this VPN reach yours as %s"):_("Other devices at home reach yours as %s"),c)),i("div",{class:"names"},n.map(m=>{let g=m.hostname.indexOf(".");return i("button",{type:"button",class:"namechip",title:m.name,"aria-label":N(_("Copy %s"),m.hostname),onclick:f=>he(m.hostname,_("Address copied"),f.currentTarget)},i("span",{},g>0?[m.hostname.slice(0,g),i("span",{class:"faint"},m.hostname.slice(g))]:m.hostname),z("copy"))}))]}function ys(e){let t=2*Math.PI*6,n=e>=100?" bad":e>=90?" warn":"";return Re(``)}function bs(e){let t=i("i",{class:e>=100?"bad":e>=90?"warn":""});return t.style.width=`${e.toFixed(1)}%`,i("div",{class:"meter"},t)}function xs(e,t,n){var B,D;let{days:r,day:o}=ko(Be()),s=(B=e.month_days)!=null?B:[],c=Math.max(1,...s),m=R=>ni(`${Be().slice(0,8)}${String(R).padStart(2,"0")}`),g=i("b",{class:"num","data-t":"m-used"},Me(t)),f=i("span",{class:"mread"}),T=(R,P)=>{Ne(g,Me(R)),f.replaceChildren(...P?Ke(_("%s on %s"),g,m(P)):Ke(_("%s used"),g))};T(t);let M=i("div",{class:"mbars"});for(let R=0;R=o){M.appendChild(i("i",{class:"future"}));continue}let P=(D=s[R])!=null?D:0,d=i("i",{class:R===o-1?"today":""});d.style.height=`${Math.max(3,Math.round(P/c*64))}px`,d.addEventListener("pointerenter",()=>T(P,R+1)),d.addEventListener("pointerleave",()=>T(t)),M.appendChild(d)}let b=i("span",{class:"td"},_("Today"));b.style.left=gn(o-.5,r);let O=i("div",{class:"month-axis"},i("span",{class:o<=4?"hide":""},m(1)),b,i("span",{class:o>=r-3?"hide":""},m(r)));return i("div",{class:"month"},M,O,i("div",{class:"month-read"},f,i("span",{class:`num${e.state==="quota"?" bad-t":""}`,"data-t":"m-left"},e.quota_limit?N(_("%s left"),Me(Math.max(0,e.quota_limit-t))):_("No limit"))),e.quota_limit?bs(n):null)}function ws(e,t){let n=c=>Pe(c).toLocaleDateString(_e(),{weekday:"short",day:"numeric",month:"short"}),r=Array.from({length:7},(c,m)=>new Date(2024,0,1+m,12).toLocaleDateString(_e(),{weekday:"narrow"})),o=xo(Be(),e.expires),s=o?i("div",{class:"cal","aria-hidden":"true"},i("div",{class:"cal-h"},r.map(c=>i("span",{},c))),i("div",{class:"cal-g"},o.map((c,m)=>{let g=i("i",{class:c.kind,title:n(c.day)});return g.style.setProperty("--i",String(m)),g}))):null;return i("div",{class:`until${wt(e,t)?" soon":""}`},i("div",{class:"until-num"},i("b",{class:"num"},we(t)),i("span",{},N_(t,"day left","days left")),i("span",{class:"until-sub"},N(_("Ends %s"),n(e.expires)))),s)}function Ms(e,t){let n=-new Date().getTimezoneOffset(),r=un(e,t,n);if(!r)return null;let o=Mo(ct(),r.yours?n:t!=null?t:n),s=wo(r),c=s.some(([f,T])=>o>=f&&oi("span",{},f))))}function ks(e,t=1){let n=e.person,r=n.quota_used||n.month[0]+n.month[1],o=n.quota_limit?Math.min(100,r/n.quota_limit*100):0,s=n.quota_period==="total"&&!!n.quota_gb,c=Kt(n.expires,Be()),m=n.expires?i("span",{class:"until-val"},i("span",{class:"num","data-t":"until-date"},ni(n.expires)),c!=null?i("span",{class:`num ${c<0?"bad-t":wt(n,c)?"warn-t":"ok-t"}`,"data-t":"until-left"},c>=0?ze(c,"%s day","%s days"):_("ended")):null):i("span",{},_("No end date")),g=[n.expires?c!=null&&c<0?Vn(N(_("It ended on %s."),zt(n.expires))):ws(n,c!=null?c:0):null,n.hours?Ms(n.hours,e.tz_offset):null];return je([{icon:Q(n.access==="internet"?"globe":n.access==="lan"?"home":"shield"),title:xr(n.access),body:[gs(n.access),...vs(n,!!e.server.device_mesh)]},{icon:Q("chart"),title:s?_("Data used"):_("Data this month"),val:i("span",{class:"data-val"},n.quota_limit?ys(o):null,i("span",{class:"num","data-t":"data-val"},`${Me(r)} ${n.quota_limit?`/ ${Me(n.quota_limit)}`:`· ${_("no limit")}`}`)),valHide:!0,body:[s?Vn(N(_("%s of %s in total."),Me(r),Me(n.quota_limit))):xs(n,r,o),Vn(n.quota_limit?s?_("A total for your whole access, it does not reset."):_("Resets on the 1st."):_("No data limit. The count starts again on the 1st."))]},{icon:Q("calendar"),title:_("Access until"),val:m,valHide:!!n.expires&&(c!=null?c:0)>=0,body:g}],{open:t})}function ri(){return i("section",{class:"access",id:"access","aria-label":_("Your access")},i("div",{class:"sec-head"},i("h2",{},_("Your access"))),i("div",{class:"acc-slot"}))}var mn=null;function oi(e,t){let n=ks(t,mn?mn.openIndex():1),r=Zt(e);e.querySelector(".acc-slot").replaceChildren(n.el),mn&&en(e,r),mn=n}mr(document.documentElement);var vn=document.getElementById("app"),Oe=null,Yn=!1,yn=()=>{};function ii(){let e=[...vn.querySelectorAll(".crumbs, .notice, .sec-head, .dgrid > *, .note-s:not([hidden]), .acc-slot .acc-row, .gone")],t=e.map(n=>getComputedStyle(n).opacity);e.forEach((n,r)=>$(n,[{opacity:0,transform:"translateY(10px)",filter:"blur(4px)"},{opacity:t[r],transform:"none",filter:"none"}],{duration:520,delay:60+r*40,easing:j,fill:"backwards"})),vn.querySelectorAll(".logo .sun").forEach(n=>$(n,[{transform:"translateY(7px)"},{transform:"none"}],{duration:900,delay:150,easing:j,fill:"backwards"})),Yn=!0}function jn(e={}){let t=pe();if(!t)return;if(yn=jn,t.person.state==="paused"){document.title=Xe();let[r,o,s]=zn(t.person);return Qn(r,o,s,!1,"orange")}let n=In(vn);Gn(!1),Wn(),document.title=Xe(),Oe||(Oe={notice:i("div",{class:"notice-slot"}),devices:ei(),access:ri()},We(n,Oe.notice,i("div",{class:"cols"},Oe.devices,Oe.access))),We(Oe.notice,_o(t.person)),ti(Oe.devices,t,e),oi(Oe.access,t),Yn||ii()}Gr(jn);function Qn(e,t,n,r=!1,o="grey"){Oe=null;let s=In(vn);Gn(!0),Wn(r,!0),We(s,i("div",{class:"gone"},Q(e,o),i("h1",{},t),i("p",{},n))),Yn||ii()}function Jn(){ke(null),me(!0),yn=Jn,Qn("key",_("This link no longer works"),_("Ask for a new one."),!0)}function si(e){yn=()=>si(e),Qn("server",_("The page could not load"),e)}function ai(){let e=pe(),t=$r(location.hash),n=Hr(location.hash);if(!e||!t&&!n)return;if(history.replaceState(null,"",location.pathname+location.search),n)return Rt();let r=e.person.devices.find(o=>o.id===t);r&&!r.handshake&&!r.disabled&&!e.locked&&fn(r)}addEventListener("hashchange",ai);async function Cs(){try{ke(await fe("state")),!He()&&!At()&&jn(),ai()}catch(e){jt(e)?Jn():pe()||si(e.message)}}dr(()=>{$e(!0),Oe=null,yn()});document.addEventListener("keydown",e=>{e.key==="Escape"&&(At()?$e(!0):He()&&me(!0))});!at||!Rr?Jn():Cs();})(); +"use strict";(()=>{var fs=Object.create;var or=Object.defineProperty;var hs=Object.getOwnPropertyDescriptor;var ms=Object.getOwnPropertyNames;var gs=Object.getPrototypeOf,vs=Object.prototype.hasOwnProperty;var ys=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var bs=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of ms(t))!vs.call(e,o)&&o!==n&&or(e,o,{get:()=>t[o],enumerable:!(r=hs(t,o))||r.enumerable});return e};var xs=(e,t,n)=>(n=e!=null?fs(gs(e)):{},bs(t||!e||!e.__esModule?or(n,"default",{value:e,enumerable:!0}):n,e));var Vr=ys((qr,Fr)=>{"use strict";var Kr=(function(){var e=function(d,v){var a=236,h=17,p=d,A=n[v],u=null,c=0,T=null,w=[],C={},I=function(M,k){c=p*4+17,u=(function(y){for(var L=new Array(y),S=0;S=7&&le(M),T==null&&(T=se(p,A,w)),Y(T,k)},G=function(M,k){for(var y=-1;y<=7;y+=1)if(!(M+y<=-1||c<=M+y))for(var L=-1;L<=7;L+=1)k+L<=-1||c<=k+L||(0<=y&&y<=6&&(L==0||L==6)||0<=L&&L<=6&&(y==0||y==6)||2<=y&&y<=4&&2<=L&&L<=4?u[M+y][k+L]=!0:u[M+y][k+L]=!1)},V=function(){for(var M=0,k=0,y=0;y<8;y+=1){I(!0,y);var L=o.getLostPoint(C);(y==0||M>L)&&(M=L,k=y)}return k},J=function(){for(var M=8;M>y&1)==1;u[Math.floor(y/3)][y%3+c-8-3]=L}for(var y=0;y<18;y+=1){var L=!M&&(k>>y&1)==1;u[y%3+c-8-3][Math.floor(y/3)]=L}},ue=function(M,k){for(var y=A<<3|k,L=o.getBCHTypeInfo(y),S=0;S<15;S+=1){var B=!M&&(L>>S&1)==1;S<6?u[S][8]=B:S<8?u[S+1][8]=B:u[c-15+S][8]=B}for(var S=0;S<15;S+=1){var B=!M&&(L>>S&1)==1;S<8?u[8][c-S-1]=B:S<9?u[8][15-S-1+1]=B:u[8][15-S-1]=B}u[c-8][8]=!M},Y=function(M,k){for(var y=-1,L=c-1,S=7,B=0,U=o.getMaskFunction(k),z=c-1;z>0;z-=2)for(z==6&&(z-=1);;){for(var X=0;X<2;X+=1)if(u[L][z-X]==null){var ie=!1;B>>S&1)==1);var K=U(L,z-X);K&&(ie=!ie),u[L][z-X]=ie,S-=1,S==-1&&(B+=1,S=7)}if(L+=y,L<0||c<=L){L-=y,y=-y;break}}},te=function(M,k){for(var y=0,L=0,S=0,B=new Array(k.length),U=new Array(k.length),z=0;z=0?tr.getAt(nr):0}}for(var rr=0,K=0;Kz*8)throw"code length overflow. ("+S.getLengthInBits()+">"+z*8+")";for(S.getLengthInBits()+4<=z*8&&S.put(0,4);S.getLengthInBits()%8!=0;)S.putBit(!1);for(;!(S.getLengthInBits()>=z*8||(S.put(a,8),S.getLengthInBits()>=z*8));)S.put(h,8);return te(S,L)};C.addData=function(M,k){k=k||"Byte";var y=null;switch(k){case"Numeric":y=f(M);break;case"Alphanumeric":y=E(M);break;case"Byte":y=x(M);break;case"Kanji":y=b(M);break;default:throw"mode:"+k}w.push(y),T=null},C.isDark=function(M,k){if(M<0||c<=M||k<0||c<=k)throw M+","+k;return u[M][k]},C.getModuleCount=function(){return c},C.make=function(){if(p<1){for(var M=1;M<40;M++){for(var k=m.getRSBlocks(M,A),y=g(),L=0;L";for(var S=0;S';y+=""}return y+="",y+="",y},C.createSvgTag=function(M,k,y,L){var S={};typeof arguments[0]=="object"&&(S=arguments[0],M=S.cellSize,k=S.margin,y=S.alt,L=S.title),M=M||2,k=typeof k=="undefined"?M*4:k,y=typeof y=="string"?{text:y}:y||{},y.text=y.text||null,y.id=y.text?y.id||"qrcode-description":null,L=typeof L=="string"?{text:L}:L||{},L.text=L.text||null,L.id=L.text?L.id||"qrcode-title":null;var B=C.getModuleCount()*M+k*2,U,z,X,ie,K="",ye;for(ye="l"+M+",0 0,"+M+" -"+M+",0 0,-"+M+"z ",K+=''+ne(L.text)+"":"",K+=y.text?''+ne(y.text)+"":"",K+='',K+='":k+=">";break;case"&":k+="&";break;case'"':k+=""";break;default:k+=L;break}}return k},Rt=function(M){var k=1;M=typeof M=="undefined"?k*2:M;var y=C.getModuleCount()*k+M*2,L=M,S=y-M,B,U,z,X,ie,K={"██":"█","█ ":"▀"," █":"▄"," ":" "},ye={"██":"▀","█ ":"▀"," █":" "," ":" "},be="";for(B=0;B=S?ye[ie]:K[ie];be+=` +`}return y%2&&M>0?be.substring(0,be.length-y-1)+Array(y+1).join("▀"):be.substring(0,be.length-1)};return C.createASCII=function(M,k){if(M=M||1,M<2)return Rt(k);M-=1,k=typeof k=="undefined"?M*2:k;var y=C.getModuleCount()*M+k*2,L=k,S=y-k,B,U,z,X,ie=Array(M+1).join("██"),K=Array(M+1).join(" "),ye="",be="";for(B=0;B>>8),A.push(T&255)):A.push(h)}}return A}};var t={MODE_NUMBER:1,MODE_ALPHA_NUM:2,MODE_8BIT_BYTE:4,MODE_KANJI:8},n={L:1,M:0,Q:3,H:2},r={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7},o=(function(){var d=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],v=1335,a=7973,h=21522,p={},A=function(u){for(var c=0;u!=0;)c+=1,u>>>=1;return c};return p.getBCHTypeInfo=function(u){for(var c=u<<10;A(c)-A(v)>=0;)c^=v<=0;)c^=a<5&&(T+=3+I-5)}for(var w=0;w=256;)p-=255;return d[p]},h})();function l(d,v){if(typeof d.length=="undefined")throw d.length+"/"+v;var a=(function(){for(var p=0;p>>7-h%8&1)==1},a.put=function(h,p){for(var A=0;A>>p-A-1&1)==1)},a.getLengthInBits=function(){return v},a.putBit=function(h){var p=Math.floor(v/8);d.length<=p&&d.push(0),h&&(d[p]|=128>>>v%8),v+=1},a},f=function(d){var v=t.MODE_NUMBER,a=d,h={};h.getMode=function(){return v},h.getLength=function(u){return a.length},h.write=function(u){for(var c=a,T=0;T+2>>8&255)*192+(w&255),u.put(w,13),T+=2}if(T>>8)},v.writeBytes=function(a,h,p){h=h||0,p=p||a.length;for(var A=0;A0&&(a+=","),a+=d[h];return a+="]",a},v},H=function(){var d=0,v=0,a=0,h="",p={},A=function(c){h+=String.fromCharCode(u(c&63))},u=function(c){if(!(c<0)){if(c<26)return 65+c;if(c<52)return 97+(c-26);if(c<62)return 48+(c-52);if(c==62)return 43;if(c==63)return 47}throw"n:"+c};return p.writeByte=function(c){for(d=d<<8|c&255,v+=8,a+=1;v>=6;)A(d>>>v-6),v-=6},p.flush=function(){if(v>0&&(A(d<<6-v),d=0,v=0),a%3!=0)for(var c=3-a%3,T=0;T=v.length){if(p==0)return-1;throw"unexpected end of file./"+p}var c=v.charAt(a);if(a+=1,c=="=")return p=0,-1;if(c.match(/^\s$/))continue;h=h<<6|u(c.charCodeAt(0)),p+=6}var T=h>>>p-8&255;return p-=8,T};var u=function(c){if(65<=c&&c<=90)return c-65;if(97<=c&&c<=122)return c-97+26;if(48<=c&&c<=57)return c-48+52;if(c==43)return 62;if(c==47)return 63;throw"c:"+c};return A},R=function(d,v){var a=d,h=v,p=new Array(d*v),A={};A.setPixel=function(w,C,I){p[C*a+w]=I},A.write=function(w){w.writeString("GIF87a"),w.writeShort(a),w.writeShort(h),w.writeByte(128),w.writeByte(0),w.writeByte(0),w.writeByte(0),w.writeByte(0),w.writeByte(0),w.writeByte(255),w.writeByte(255),w.writeByte(255),w.writeString(","),w.writeShort(0),w.writeShort(0),w.writeShort(a),w.writeShort(h),w.writeByte(0);var C=2,I=c(C);w.writeByte(C);for(var G=0;I.length-G>255;)w.writeByte(255),w.writeBytes(I,G,255),G+=255;w.writeByte(I.length-G),w.writeBytes(I,G,I.length-G),w.writeByte(0),w.writeString(";")};var u=function(w){var C=w,I=0,G=0,V={};return V.write=function(J,re){if(J>>>re)throw"length over";for(;I+re>=8;)C.writeByte(255&(J<>>=8-I,G=0,I=0;G=J<0&&C.writeByte(G)},V},c=function(w){for(var C=1<>6,128|i&63):i<55296||i>=57344?r.push(224|i>>12,128|i>>6&63,128|i&63):(o++,i=65536+((i&1023)<<10|n.charCodeAt(o)&1023),r.push(240|i>>18,128|i>>12&63,128|i>>6&63,128|i&63))}return r}return t(e)}})();(function(e){typeof define=="function"&&define.amd?define([],e):typeof qr=="object"&&(Fr.exports=e())})(function(){return Kr})});var sr={s:{'"%s" already exists.':"Устройство «%s» уже есть.",'"%s" is already taken.':"Идентификатор «%s» уже занят.","%s (Android: %s)":"%s (на Android: %s)","%s (router time)":"%s (по времени роутера)","%s can't use the network interface %s: it exists and isn't Dawnline's.":"Сервер %s не может использовать сетевой интерфейс %s: он уже существует и создан не Dawnline.","%s connected":"Подключено: %s","%s d ago":"%s дн. назад","%s h ago":"%s ч назад",'%s has an invalid interface name "%s".':"У сервера %s недопустимое имя интерфейса «%s».","%s has no room for every device on %s.":"В подсети %s не хватит адресов для всех устройств сервера %s.","%s in total":"%s всего","%s is kept down.":"Сервер %s остановлен.","%s is kept down: its disguise needs AmneziaWG %s (installed: %s).":"Сервер %s остановлен: для его маскировки нужен AmneziaWG %s (установлен %s).","%s is kept down: its disguise needs AmneziaWG %s (installed: none).":"Сервер %s остановлен: для его маскировки нужен AmneziaWG %s (не установлен).","%s left":"осталось %s","%s min ago":"%s мин назад","%s must be a number or range":"%s: нужно число или диапазон","%s of %s":"%s из %s","%s of %s GB":"%s из %s ГБ","%s of %s GB this month":"%s из %s ГБ в этом месяце","%s of %s in total.":"Всего %s из %s.","%s options":"Действия с устройством %s","%s this month":"%s в этом месяце","%s your time":"%s по вашему времени","%sd %sh":"%s д %s ч","%sh %sm":"%s ч %s мин","%sm":"%s мин","A total for your whole access, it does not reset.":"Считается за весь срок доступа и не обнуляется.","APK file on":"APK-файл на","Access %s":"Доступ %s","Access ended":"Доступ закончился","Access must be lan, internet or both.":"Доступ должен быть lan, internet или both.","Access paused":"Доступ на паузе","Access until":"Доступ до",Active:"Активен","WireGuard appAdd Tunnel":"Добавить туннель","Add a device":"Добавить устройство","Add device":"Добавить устройство","Add it from the device":"Добавить с самого устройства","Add the connection":"Добавьте подключение","Add this device":"Добавить это устройство","Add this phone":"Добавить этот телефон","Add your first device":"Добавьте первое устройство","Adding devices isn't available right now: the VPN server isn't ready. Ask whoever sent you this link.":"Сейчас добавить устройство нельзя: VPN-сервер не готов. Обратитесь к тому, кто прислал вам эту ссылку.","Address copied":"Адрес скопирован","Already has the app":"Приложение уже установлено","AmneziaWG is not installed (%s): install it in Dawnline → Components.":"AmneziaWG не установлен (%s): установите его в Dawnline → Компоненты.","AmneziaWG is not installed: install it in Dawnline → Components.":"AmneziaWG не установлен: установите его в Dawnline → Компоненты.","Android phone":"Телефон Android","Android tablet":"Планшет Android","Ask for a new one.":"Попросите новую.",B:"Б",Back:"Назад",Breadcrumb:"Навигационная цепочка",Cancel:"Отмена","Circle %s: server %s does not exist.":"Круг %s: сервера %s нет.",Close:"Закрыть","Close this and open it again to keep checking.":"Закройте окно и откройте его снова, чтобы проверить ещё раз.",Configuration:"Конфигурация","Configuration copied":"Конфигурация скопирована","Confirm the import and connect":"Подтвердите импорт и подключитесь",Connect:"Подключить",Connected:"Подключено","Connected, no data left":"Подключено, трафик закончился","Connected, outside your hours":"Подключено, вне часов доступа","Connection settings only travel encrypted":"Настройки подключения передаются только в зашифрованном виде","AmneziaVPN appContinue":"Продолжить",Copied:"Скопировано",Copy:"Скопировать","Copy %s":"Скопировать %s","Copy %s config":"Скопировать конфигурацию %s","Copy IP address":"Скопировать IP-адрес","Copy local address":"Скопировать локальный адрес","Copy or save the connection":"Скопировать или сохранить подключение","Copy the configuration":"Скопировать конфигурацию","Copy the key":"Скопировать ключ","in a sentenceCopy the key":"Скопируйте ключ","Copy the link":"Скопировать ссылку","Copying is blocked here. Select the text and copy it by hand.":"Копирование здесь заблокировано. Выделите текст и скопируйте его вручную.","Create connection":"Создать подключение","WireGuard appCreate from QR code":"Создать из QR-кода","WireGuard appCreate from file or archive":"Создать из файла или архива","Cross-site request refused.":"Запрос с другого сайта отклонён.","Data limit must be a positive number of GB.":"Лимит трафика должен быть положительным числом ГБ.","Data limit reached":"Лимит трафика исчерпан","Data this month":"Трафик за месяц","Data used":"Трафик всего","Device %s of %s: address %s is also used by device %s of %s.":"Устройство %s (%s): адрес %s уже занят устройством %s (%s).","Device %s of %s: address %s is not a plain IPv4 address.":"Устройство %s (%s): адрес %s не является обычным IPv4-адресом.","Device %s of %s: address %s is outside %s's tunnel %s.":"Устройство %s (%s): адрес %s вне туннеля сервера %s (%s).","Device %s of %s: address %s is the router's own address on %s.":"Устройство %s (%s): адрес %s принадлежит самому роутеру на сервере %s.","Device %s of %s: address (none) is not a plain IPv4 address.":"Устройство %s (%s): нет IPv4-адреса.","Device %s of %s: the preshared key is not a key.":"Устройство %s (%s): общий ключ (PSK) некорректен.","Device %s of %s: the private key is not a key.":"Устройство %s (%s): приватный ключ некорректен.","Device %s of %s: the public key is not a key.":"Устройство %s (%s): публичный ключ некорректен.","Device %s: person %s does not exist.":"Устройство %s: человека %s нет.","Device limit must be between 1 and 32.":"Лимит устройств: от 1 до 32.","Device limit reached (%d).":"Достигнут лимит устройств (%d).","Device name":"Имя устройства","Device not found.":"Устройство не найдено.","Device removed":"Устройство удалено","Devices at home":"Устройства дома","Devices at home and on this VPN reach yours as %s":"Устройства дома и в этом VPN обращаются к вашим по адресу %s",Disabled:"Отключено",Download:"Скачать","Download %s config":"Скачать конфигурацию %s","Download for Linux":"Скачать для Linux","Download for Mac":"Скачать для Mac","Download for Windows":"Скачать для Windows","Download from":"Скачать с сайта","Download on the":"Загрузите в","Download the file":"Скачать файл","Download the key":"Скачать ключ",Downloaded:"Получено","End date must be YYYY-MM-DD.":"Дата окончания должна быть в формате ГГГГ-ММ-ДД.","Endpoint must be a hostname or IP address.":"Адрес сервера должен быть именем хоста или IP-адресом.","Ends %s":"Закончится %s","Enter a device name (up to 48 characters).":"Введите название устройства (до 48 символов).",Expired:"Срок истёк","Extra data must be a positive number of GB.":"Дополнительный трафик должен быть положительным числом ГБ.","For computers and routers":"Для компьютеров и роутеров",GB:"ГБ","Gbit/s":"Гбит/с","Get %s":"Установите %s","Get %s on the %s and come back here.":"Установите %s на %s и вернитесь сюда.","Get %s on the router":"Установите %s на роутер","Get it on":"Доступно в","Hide key":"Скрыть ключ","Home network":"Домашняя сеть","Home network + Internet":"Домашняя сеть и интернет","Hours must look like 07:00-23:00.":"Часы доступа указываются так: 07:00-23:00.","Hours, router time":"Часы доступа, время роутера","Hours, your time":"Часы доступа, ваше время","IP address copied":"IP-адрес скопирован","WireGuard appImport Tunnel(s) from File…":"Импорт туннелей из файла…","WireGuard appImport from file or archive":"Импорт из файла или архива","Import the configuration":"Импортируйте конфигурацию","WireGuard appImport tunnel(s) from file…":"Импорт туннелей из файла…","In %s:":"В %s:",Included:"Есть доступ","AmneziaVPN appInsert":"Вставить","Install from":"Установить с сайта","Interface name: 1-12 lowercase letters, digits or _.":"Имя интерфейса: 1–12 строчных латинских букв, цифр или _.",Internet:"Интернет","Invalid JSON.":"Некорректный JSON.","Invalid public key.":"Недопустимый публичный ключ.","It ended on %s.":"Доступ закончился %s.","It gets new keys and its current settings stop working. Set it up again with the new ones that open next.":"Устройство получит новые ключи, а текущие настройки перестанут работать. Настройте его заново с новыми - они откроются следом.","It gets new keys. This device is connected through its current settings: it disconnects a few seconds after you confirm. Add the new ones that open next.":"Устройство получит новые ключи. Сейчас вы подключены через его текущие настройки: через несколько секунд после подтверждения связь прервётся. Добавьте новые - они откроются следом.","Its connection stops working at once. You can add it again later.":"Подключение сразу перестанет работать. Устройство можно будет добавить снова.","Its settings changed: update the connection":"Настройки изменились: обновите подключение",KB:"КБ","Key copied":"Ключ скопирован","Key generation failed (is amneziawg-tools installed?).":"Не удалось создать ключ (установлен ли amneziawg-tools?).","Key generation failed (no random data).":"Не удалось создать ключ (нет случайных данных).","Key generation failed.":"Не удалось создать ключ.",Language:"Язык","Last 7 days":"За 7 дней","Last connected %s":"В сети %s","Link copied":"Ссылка скопирована","Linux PC":"Компьютер с Linux",MB:"МБ","Mbit/s":"Мбит/с","Method not allowed.":"Метод не поддерживается.",Mobile:"Мобильный","Monthly data must be a positive number of GB.":"Месячный лимит трафика должен быть положительным числом ГБ.",Name:"Имя","No connection yet":"Подключения пока нет","No data limit. The count starts again on the 1st.":"Лимита трафика нет. Счёт начинается заново 1-го числа.","No end date":"Бессрочно","No free address left on %s.":"На сервере %s не осталось свободных адресов.","No free addresses left in the server subnet.":"В подсети сервера не осталось свободных адресов.","No limit":"Без лимита","No server":"Нет сервера","No server yet":"Сервера пока нет","Not found.":"Не найден.","Not included":"Нет доступа","Not on the %s right now?":"Открыли на другом %s?","Not set up yet":"Ещё не настроено","Nothing gets through until it resets.":"Ничего не проходит, пока лимит не обнулится.","Nothing opened? %s and add it in the app.":"Ничего не открылось? %s и добавьте его в приложении.","Now, %s":"Сейчас %s",OR:"ИЛИ","Official release on GitHub":"Официальная версия на GitHub","On %s.":"Дата окончания - %s.","On GitHub":"На GitHub","Only the admin can turn devices off.":"Отключать устройства может только администратор.","stepOpen %s":"Откройте %s","Open %s.":"Доступ открыт %s.","Open a terminal in the folder with the file":"Откройте терминал в папке с файлом","Open in AmneziaVPN":"Открыть в AmneziaVPN","Open on another device":"Открыть на другом устройстве","Open on the device":"Открыть на устройстве","Open securely":"Открыть по HTTPS","Open the link securely":"Откройте защищённую ссылку","Open this link on the %s to set it up there.":"Откройте эту ссылку на %s, чтобы настроить его там.","Open this link over HTTPS to get the connection settings.":"Чтобы получить настройки подключения, откройте эту ссылку по HTTPS.","Open this page in Safari or Chrome: the store opens from here, but the app handoff does not.":"Откройте эту страницу в Safari или Chrome: магазин отсюда откроется, а передача в приложение - нет.","Open your link on the %s":"Откройте свою ссылку на %s","OpenWrt packages":"Пакеты OpenWrt","OpenWrt packages + kmod":"Пакеты OpenWrt + kmod",Other:"Другое","Other devices at home reach yours as %s":"Другие устройства дома обращаются к вашим по адресу %s","Out of data":"Трафик закончился","Outside allowed hours":"Вне часов доступа","Outside your hours":"Вне часов доступа",PC:"Компьютер",Paused:"На паузе","Person %s: circle %s does not exist.":"Человек %s: круга %s нет.","Person %s: has the same personal link as %s.":"Человек %s: личная ссылка совпадает со ссылкой человека %s.","Person %s: home service %s does not exist.":"Человек %s: домашнего сервиса %s нет.","Person %s: server %s does not exist.":"Человек %s: сервера %s нет.",Phone:"Телефон","Phones and tablets get a smaller packet size that suits mobile networks.":"У телефонов и планшетов пакеты меньше - так лучше для мобильных сетей.","Pick AmneziaVPN in the share sheet. Not there? %s and add it in the app.":"Выберите AmneziaVPN в меню «Поделиться». Его там нет? %s и добавьте его в приложении.","Pick the file and connect":"Выберите файл и подключитесь","Point its camera at the code: the link opens there.":"Наведите камеру устройства на код - ссылка откроется на нём.","Point its camera at the code: this page opens there.":"Наведите камеру устройства на код - там откроется эта страница.","Point its camera at the code: your page opens there with this device ready to add.":"Наведите камеру устройства на код - там откроется ваша страница, и его можно будет сразу добавить.","Port must be 1-65535.":"Порт: от 1 до 65535.","QR code":"QR-код","AmneziaVPN appQR code":"QR-код",Reconnect:"Переподключить","Reconnect %s?":"Переподключить «%s»?",Remove:"Удалить","Remove %s?":"Удалить «%s»?",Rename:"Переименовать","Rename %s":"Переименовать «%s»",Renamed:"Переименовано","Request failed (%s)":"Не удалось выполнить запрос (%s)","Request too large.":"Слишком большой запрос.","Resets on the 1st.":"Обнуляется 1-го числа.",Router:"Роутер",Run:"Выполните",Save:"Сохранить","WireGuard appScan from QR code":"Сканировать QR-код","Send it to the %s":"Отправить на %s","Send it to the %s in a message or a note, then in AmneziaVPN: %s.":"Отправьте его на %s в сообщении или заметке, затем в AmneziaVPN: %s.","Send it to the %s, then import %s in %s.":"Отправьте его на %s, затем импортируйте %s в %s.","Send to AmneziaVPN":"Отправить в AmneziaVPN","Server is disabled":"Сервер выключен","Server is turned off":"Сервер выключен","Set up %s":"Настроить %s","Set up a server first.":"Сначала настройте сервер.","Settings changed":"Настройки изменились","Settings changed, update needed":"Настройки изменились, нужно обновить","Share as a file":"Поделиться файлом","Share file":"Поделиться файлом","Share the file":"Поделиться файлом","Share the link":"Поделиться ссылкой","Show key":"Показать ключ","Straight into %s":"Сразу в %s","Subnet must look like 10.77.0.0/24.":"Подсеть указывается так: 10.77.0.0/24.","Subnet overlaps %s.":"Подсеть пересекается с %s.",TB:"ТБ",Tablet:"Планшет","Tap “%s” and connect":"Нажмите «%s» и подключитесь","The APK is for phones without Google Play, or where the store hides the app.":"APK - для телефонов без Google Play или если магазин скрывает приложение.","The admin has turned this device off.":"Администратор отключил это устройство.","The app goes on the %s.":"Приложение ставится на %s.","The browser may warn that the certificate is not trusted: it is this router’s own. Choose to continue (“Advanced” → “Proceed”).":"Браузер может предупредить, что сертификату нельзя доверять: это собственный сертификат роутера. Продолжите переход («Дополнительные» → «Перейти на сайт»).","The connection":"Подключение","The connection as one key":"Подключение одним ключом","The id may use lowercase letters, digits and underscores.":"В идентификаторе можно использовать строчные латинские буквы, цифры и подчёркивания.","The packages and the file for OpenWrt":"Пакеты и файл для OpenWrt","The page could not load":"Не удалось загрузить страницу","The person has no server.":"У человека нет сервера.","Then come back here and tap":"Затем вернитесь сюда и нажмите","Then import it in the app":"Затем импортируйте его в приложении","This device":"Это устройство","This key is already in use.":"Этот ключ уже используется.","This link no longer works":"Эта ссылка больше не работает","This page is open without encryption. To add or set up a device, open the same link over HTTPS:":"Эта страница открыта без шифрования. Чтобы добавить или настроить устройство, откройте ту же ссылку по HTTPS:","Through the router":"Через роутер",Today:"Сегодня","Too many changes in a short time. Try again in a few minutes.":"Слишком много изменений за короткое время. Попробуйте ещё раз через несколько минут.","Two steps, about a minute":"Два шага, около минуты","Two steps, about a minute: get the app, then add the connection.":"Два шага, около минуты: установите приложение, затем добавьте подключение.","Unknown DNS choice.":"Неизвестный вариант DNS.","Unknown action.":"Неизвестное действие.","Unknown circle.":"Неизвестный круг.","Unknown device.":"Неизвестное устройство.","Unknown end action.":"Неизвестное действие по окончании доступа.","Unknown person.":"Неизвестный человек.","Unknown server.":"Неизвестный сервер.","Unknown service %s.":"Неизвестный сервис %s.",Update:"Обновить","Update the connection":"Обновить подключение",Uploaded:"Отправлено","Waiting for the connection":"Ждём подключения","Warning must be 0-60 days.":"Предупреждать можно за 0–60 дней.","What is it?":"Что это за устройство?","Windows PC":"Компьютер с Windows",Yesterday:"Вчера","You already have a device with this name.":"У вас уже есть устройство с таким именем.","You haven’t been added to one.":"Вас ещё не добавили ни на один сервер.","Your access":"Ваш доступ","Your access has ended.":"Ваш доступ закончился.","Your access is paused.":"Ваш доступ на паузе.","Your devices":"Ваши устройства","Your devices can’t connect until it’s enabled again.":"Ваши устройства не подключатся, пока его снова не включат.","Your devices can’t connect until it’s extended.":"Ваши устройства не подключатся, пока доступ не продлят.","Your devices can’t connect until it’s resumed.":"Ваши устройства не подключатся, пока доступ не возобновят.","bit/s":"бит/с",computer:"компьютер","on thecomputer":"компьютере",device:"устройство","on thedevice":"устройстве",ended:"закончился","ends today":"закончится сегодня","ends tomorrow":"закончится завтра","h1-h4 must be distinct":"h1-h4 должны быть разными","just now":"только что","kbit/s":"кбит/с",name:"имя",never:"никогда","no limit":"без лимита",phone:"телефон","on thephone":"телефоне",router:"роутер","on therouter":"роутере",tablet:"планшет","on thetablet":"планшете","this device":"это устройство"},p:{"%s already has %d device. Remove one first to lower the limit to %d.":["%s: уже %d устройство. Чтобы снизить лимит до %d, сначала удалите одно из них.","%s: уже %d устройства. Чтобы снизить лимит до %d, сначала удалите одно из них.","%s: уже %d устройств. Чтобы снизить лимит до %d, сначала удалите одно из них."],"%s day":["%s день","%s дня","%s дней"],"%s of %s slot free":["Свободно %s из %s места","Свободно %s из %s мест","Свободно %s из %s мест"],"You have reached your limit of %s device":["Достигнут лимит - %s устройство","Достигнут лимит - %s устройства","Достигнут лимит - %s устройств"],"You have reached your limit of %s device. Remove one to add another.":["Достигнут лимит - %s устройство. Удалите одно, чтобы добавить новое.","Достигнут лимит - %s устройства. Удалите одно, чтобы добавить новое.","Достигнут лимит - %s устройств. Удалите одно, чтобы добавить новое."],"day left":["день остался","дня осталось","дней осталось"],"ends in %s day":["закончится через %s день","закончится через %s дня","закончится через %s дней"]}};var It=[{code:"en",name:"English"},{code:"ru",name:"Русский"}],Ms={ru:[sr]},ir={en:e=>e!==1?1:0,ru:e=>e%10===1&&e%100!==11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2},lr="dl.lang";function ks(e,t){var r,o;let n=i=>i&&It.some(l=>l.code===i)?i:null;return(o=(r=n(e))!=null?r:t.map(i=>n(i.toLowerCase().split(/[-_]/)[0])).find(Boolean))!=null?o:"en"}var rt="en",Mn=[],cr=[],dr=(e,t)=>t?`${t}${e}`:e;function ur(e,t){let n=dr(e,t);for(let r of Mn)if(n in r.s)return r.s[n];return e}function Cs(e,t,n,r){var l,m,g;let o=dr(t,r),i=(l=Mn.find(f=>o in f.p))==null?void 0:l.p[o];return(g=i==null?void 0:i[((m=ir[rt])!=null?m:ir.en)(e)])!=null?g:e===1?t:n}var Qe=()=>rt,pr=e=>ur(e);function kn(e,t=!0){var n;if(rt=It.some(r=>r.code===e)?e:"en",Mn=(n=Ms[rt])!=null?n:[],document.documentElement.lang=rt,t)try{localStorage.setItem(lr,rt)}catch{}cr.forEach(r=>r())}function fr(e){cr.push(e)}function _s(){try{return localStorage.getItem(lr)}catch{return null}}Object.assign(globalThis,{_:ur,N_:Cs});var ar;kn(ks(_s(),(ar=navigator.languages)!=null&&ar.length?navigator.languages:[navigator.language]),!1);var hr={phone:'',computer:'',tablet:'',router:'',server:'',other:'',ethernet:'',bridge:'',wifi:'',tunnel:'',plus:'',chart:'',reset:'',package:'',code:'',plug:'',sunrise:'',refresh:'',archive:'',qr:'',copy:'',download:'',link:'',amnezia:'',amneziawg:'',wireguard:'',appstore:'',googleplay:'',github:'',openwrt:'',apple:'',windows:'',linux:'',eye:'',share:'',arrow:'',trash:'',edit:'',pause:'',play:'',key:'',out:'',admin:'',shield:'',shieldplus:'',lock:'',zap:'',check:'',alert:'',x:'',globe:'',home:'',open:'',file:'',network:'',moon:'',chevron:'',clock:'',calendar:'',minus:'',more:'',pin:'',activity:''};function Gt(e,t="dl-icon"){var r;let n=(r=hr[e])!=null?r:hr.phone;return``}function mr(e,t){let n=r=>{r==null||r===!1||(Array.isArray(r)?r.forEach(n):e.appendChild(typeof r=="string"?document.createTextNode(r):r))};t.forEach(n)}function s(e,t={},...n){let r=document.createElement(e);for(let[o,i]of Object.entries(t))i==null||i===!1||(o.startsWith("on")&&typeof i=="function"?r.addEventListener(o.slice(2),i):o==="class"?r.className=String(i):i===!0?r.setAttribute(o,""):r.setAttribute(o,String(i)));return mr(r,n),r}function We(e,...t){e.replaceChildren(),mr(e,t)}function Be(e){let t=document.createElement("template");return t.innerHTML=e.trim(),t.content.firstElementChild}var W=(e,t="i")=>Be(Gt(e,t));var Ae=()=>typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches;function ot(e,t,n=1){let r=Math.sqrt(e/n),o=t/(2*Math.sqrt(e*n)),i=f=>{if(o<.999){let O=r*Math.sqrt(1-o*o);return 1-Math.exp(-o*r*f)*(Math.cos(O*f)+o*r/O*Math.sin(O*f))}if(o<=1.001)return 1-Math.exp(-r*f)*(1+r*f);let E=Math.sqrt(o*o-1),x=-r*(o-E),b=-r*(o+E);return 1-(b*Math.exp(x*f)-x*Math.exp(b*f))/(b-x)},l=0;for(let f=0;f<3;f+=.004)Math.abs(1-i(f))>.0015&&(l=f);l+=.004;let m=[];for(let f=0;f<=64;f++)m.push(+i(l*f/64).toFixed(4));m[64]=1;let g=Math.round(l*1e3);return{duration:g,easing:`linear(${m.join(", ")})`,at:f=>f>=g?1:i(f/1e3)}}var Te=ot(300,20),q=ot(300,35),xe=ot(520,24),vr=ot(520,46),Le=ot(380,28),gr=ot(900,60),j="cubic-bezier(0.23, 1, 0.32, 1)",Z="cubic-bezier(0.55, 0, 1, 0.45)",Cn="cubic-bezier(0.32, 0.72, 0, 1)";function yr(e){e.style.setProperty("--spring-bouncy",Te.easing),e.style.setProperty("--spring-bouncy-dur",`${Te.duration}ms`),e.style.setProperty("--spring-smooth",q.easing),e.style.setProperty("--spring-smooth-dur",`${q.duration}ms`),e.style.setProperty("--spring-soft",Le.easing),e.style.setProperty("--spring-soft-dur",`${Le.duration}ms`),e.style.setProperty("--spring-quick",gr.easing),e.style.setProperty("--spring-quick-dur",`${gr.duration}ms`)}function $(e,t,n){var r;return Ae()?t.some(o=>"opacity"in o)?e.animate(t.map(o=>"opacity"in o?{opacity:o.opacity}:{}),{duration:Math.min(Number((r=n.duration)!=null?r:200),160),easing:"ease-out",fill:n.fill}):e.animate(t,{...n,duration:0,delay:0}):e.animate(t,n)}function br(e,t){return e<=0||t<=0?0:(1-1/(e*.55/t+1))*t}function xr(e,t,n){return e<=0||t<-.1?!1:t>.4||e>n/3}function Es(){return(typeof document=="undefined"?"":document.documentElement.lang)||"en"}function Ce(){let e=Es();return e==="en"?"en-GB":e}function N(e,...t){let n=0;return e.replace(/%([%sd])/g,(r,o)=>{var i;return o==="%"?"%":String((i=t[n++])!=null?i:"")})}function we(e,t){return e.toLocaleString(Ce(),t===void 0?void 0:{minimumFractionDigits:t,maximumFractionDigits:t})}function ze(e,t,n){return N(N_(e,t,n),we(e))}function st(e,...t){let n=0;return e.split(/(%[%sd])/).filter(Boolean).map(r=>r==="%%"?"%":r==="%s"||r==="%d"?t[n++]:r)}function Ts(e,t,n){let r=0;for(;e>=n&&r=100||r===0?we(Math.round(e)):we(e,1)} ${t[r]}`}function Re(e){return Ts(!e||e<0?0:e,[_("B"),_("KB"),_("MB"),_("GB"),_("TB")],1024)}function wr(e,t=Date.now()/1e3){if(!e)return _("never");let n=Math.max(0,Math.round(t-e));return n<60?_("just now"):n<3600?N(_("%s min ago"),Math.floor(n/60)):n<86400?N(_("%s h ago"),Math.floor(n/3600)):n<86400*30?N(_("%s d ago"),Math.floor(n/86400)):new Date(e*1e3).toLocaleDateString(Ce(),{day:"numeric",month:"short",year:"numeric"})}function Wt(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}function Se(e){let[t,n,r]=e.split("-").map(Number);return new Date(t,(n||1)-1,r||1,12)}function Ls(e){return(typeof e=="string"?/^\d{4}-\d{2}-\d{2}$/.test(e)?Se(e):new Date(e):e).toLocaleDateString(Ce(),{day:"numeric",month:"short",year:"numeric"})}function zt(e){return e?Ls(e):""}function As(e,t){let n=r=>{let[o,i,l]=r.split("-").map(Number);return Date.UTC(o,i-1,l)};return Math.round((n(e)-n(t))/864e5)}function it(e,t){let n=Se(e);return n.setDate(n.getDate()+t),Wt(n)}function Ut(e,t=Date.now()){if(!e)return null;let n=typeof t=="number"?Wt(new Date(t)):t,r=As(e,n);return r>=0?r+1:r}function wt(e,t){return t!=null&&t>0&&e.expire_warn>0&&t<=e.expire_warn}function Mr(e){return e<=1?_("ends today"):e===2?_("ends tomorrow"):ze(e,"ends in %s day","ends in %s days")}function kr(e){return{lan:_("Home network"),internet:_("Internet"),both:_("Home network + Internet")}[e]}function Kt(e){return{computer:_("PC"),phone:_("Phone"),tablet:_("Tablet"),router:_("Router"),other:_("Other")}[e]}function qt(e){let t=n=>n.disabled?3:n.online?0:n.handshake?1:2;return e.map((n,r)=>[n,r]).sort((n,r)=>t(n[0])-t(r[0])||n[1]-r[1]).map(([n])=>n)}var ce={vpn:"AmneziaVPN",awg:"AmneziaWG",wg:"WireGuard"};function _r(e,t=0){return/iPhone|iPad|iPod/.test(e)||/Macintosh/.test(e)&&t>1?"ios":/Android/.test(e)?"android":/Windows/.test(e)?"windows":/Mac OS X|Macintosh/.test(e)?"mac":/CrOS/.test(e)?"unknown":/Linux|X11/.test(e)?"linux":"unknown"}var Er=e=>/Telegram|FBAN|FBAV|Instagram|VKClient|Line\//i.test(e);function Tr(e,t){return e==="router"||t==="unknown"?!1:e==="phone"||e==="tablet"?t==="ios"||t==="android":e==="computer"?t==="windows"||t==="mac"||t==="linux":!0}function Lr(e){let t=[{id:"vpn",name:ce.vpn},{id:"awg",name:ce.awg}];return e==="off"&&t.push({id:"wg",name:ce.wg}),t}var Ft="https://github.com/amnezia-vpn/amnezia-client/releases/latest",Cr=e=>({href:e,top:_("APK file on"),main:"GitHub",mark:"github",why:_("The APK is for phones without Google Play, or where the store hides the app.")});function Ar(e,t){var l;let n=_("Download on the"),r=_("Get it on"),o=_("Official release on GitHub");return(l={vpn:{ios:{href:"https://apps.apple.com/app/amneziavpn/id1600529900",top:n,main:"App Store",mark:"appstore"},android:{href:"https://play.google.com/store/apps/details?id=org.amnezia.vpn",top:r,main:"Google Play",mark:"googleplay",alt:Cr(Ft)},windows:{href:Ft,top:o,main:_("Download for Windows"),mark:"windows"},mac:{href:Ft,top:o,main:_("Download for Mac"),mark:"apple"},linux:{href:Ft,top:o,main:_("Download for Linux"),mark:"linux"}},awg:{ios:{href:"https://apps.apple.com/us/app/amneziawg/id6478942365",top:n,main:"App Store",mark:"appstore"},android:{href:"https://play.google.com/store/apps/details?id=org.amnezia.awg",top:r,main:"Google Play",mark:"googleplay",alt:Cr("https://github.com/amnezia-vpn/amneziawg-android/releases")},windows:{href:"https://github.com/amnezia-vpn/amneziawg-windows-client/releases",top:o,main:_("Download for Windows"),mark:"windows"},mac:{href:"https://apps.apple.com/us/app/amneziawg/id6478942365",top:n,main:"Mac App Store",mark:"appstore"},linux:{href:"https://github.com/amnezia-vpn/amneziawg-tools",top:_("On GitHub"),main:"amneziawg-tools",mark:"linux"}},wg:{ios:{href:"https://apps.apple.com/app/wireguard/id1441195209",top:n,main:"App Store",mark:"appstore"},android:{href:"https://play.google.com/store/apps/details?id=com.wireguard.android",top:r,main:"Google Play",mark:"googleplay"},windows:{href:"https://www.wireguard.com/install/",top:_("Download from"),main:"wireguard.com",mark:"windows"},mac:{href:"https://apps.apple.com/app/wireguard/id1451685025",top:n,main:"Mac App Store",mark:"appstore"},linux:{href:"https://www.wireguard.com/install/",top:_("Install from"),main:"wireguard.com",mark:"linux"}}}[e][t])!=null?l:null}var Sr=e=>e==="wg"?{href:"https://openwrt.org/docs/guide-user/services/vpn/wireguard/start",top:_("OpenWrt packages"),main:"wireguard-tools",mark:"openwrt"}:{href:"https://openwrt.org/packages/start",top:_("OpenWrt packages + kmod"),main:"amneziawg-tools",mark:"openwrt"},_n=e=>e==="android",kt=e=>`${e.replace(/\.conf$/i,"")}.vpn`,Ue=(...e)=>e.join(" → ");function Mt(e){return{ios:{file:Ue("+",_("Create from file or archive","WireGuard app")),qr:Ue("+",_("Create from QR code","WireGuard app"))},android:{file:Ue("+",_("Import from file or archive","WireGuard app")),qr:Ue("+",_("Scan from QR code","WireGuard app"))},mac:{file:Ue("+",_("Import Tunnel(s) from File…","WireGuard app"))},windows:{file:Ue(_("Add Tunnel","WireGuard app"),_("Import tunnel(s) from file…","WireGuard app"))}}[e]}function Ct(e,t="unknown"){var r;if(e==="vpn")return Ue("+",_("QR code","AmneziaVPN app"));let n=(r=Mt(t))==null?void 0:r.qr;return n!=null?n:N(_("%s (Android: %s)"),Mt("ios").qr,Mt("android").qr.replace(/^.* → /,""))}function Vt(e,t="unknown"){var n;return e==="vpn"?Ue("+",_("Insert","AmneziaVPN app")):((n=Mt(t))!=null?n:Mt("android")).file}var Pr=()=>N(_("Tap “%s” and connect"),_("Continue","AmneziaVPN app"));function Dr(e,t,n,r){if(t==="linux")return[[_("Open a terminal in the folder with the file"),""],[`${_("Run")} `,`sudo ${e==="wg"?"wg-quick":"awg-quick"} up ./${n}`]];let o=Vt(e,t);return[[N(_("Open %s","step"),ce[e]),""],[o.replace(/ → [^→]*$/," → "),o.replace(/^.* → /,"")],[r?_("Confirm the import and connect"):_("Pick the file and connect"),""]]}function $r(e){return{ios:"iPhone / iPad",android:"Android",windows:"Windows",mac:"Mac",linux:"Linux",unknown:_("this device")}[e]}var Hr=(e,t)=>`${e}#setup=${t}`;function Or(e){var t,n;return(n=(t=/^#setup=(d_[0-9a-f]{8})$/.exec(e))==null?void 0:t[1])!=null?n:null}var Br=e=>`${e}#add`,Rr=e=>e==="#add",En=(e,t=!1)=>(t?{phone:_("phone","on the"),tablet:_("tablet","on the"),computer:_("computer","on the"),router:_("router","on the"),other:_("device","on the")}:{phone:_("phone"),tablet:_("tablet"),computer:_("computer"),router:_("router"),other:_("device")})[e];var oe=null,pe=()=>oe;function Me(e){oe=e}var Ss=document.getElementById("app"),Nr,at=(Nr=Ss.dataset.base)!=null?Nr:"",Ir=/^\/[a-z]{6}-[a-z]{6}-[a-z]{6}$/.test(at)?at.slice(1):"",lt=()=>location.origin+location.pathname,Ne=()=>{var e;return(e=oe==null?void 0:oe.today)!=null?e:Wt(new Date)},ct=()=>{var e;return(e=oe==null?void 0:oe.now)!=null?e:Date.now()/1e3},Yt=()=>_r(navigator.userAgent,navigator.maxTouchPoints),Ps=()=>(oe==null?void 0:oe.server.awg_disguise)===!1,Gr=()=>{var e;return(e=oe==null?void 0:oe.server.preset)!=null?e:Ps()?"off":"max"},Wr=()=>(oe==null?void 0:oe.https_url)||null,Je=()=>(oe==null?void 0:oe.server.name)||"Dawnline",zr=()=>{};function Ur(e){zr=e}var _e=(e={})=>zr(e);var Ke=class extends Error{constructor(n,r,o){super(r);this.status=n;this.httpsUrl=o}};async function fe(e,t){let n=await fetch(`${at}/api/${e}`,{method:t===void 0?"GET":"POST",credentials:"omit",headers:t===void 0?{"Accept-Language":Qe()}:{"Content-Type":"application/json","Accept-Language":Qe()},body:t===void 0?void 0:JSON.stringify(t),cache:"no-store"}),r=null;try{r=await n.json()}catch{}if(!n.ok)throw new Ke(n.status,r!=null&&r.error?pr(r.error):N(_("Request failed (%s)"),n.status),(r==null?void 0:r.https_url)||void 0);return r}var jt=e=>e instanceof Ke&&(e.status===404||e.status===401);var jr=xs(Vr(),1),Ds=e=>``,Yr="#0a0a0a",$s="#f2f2f2",Hs={night:[Yr,$s],day:["#ffffff",Yr]},Ln=e=>e.length>300,dt=e=>+e.toFixed(2);function Tn(e,t,n,r,o){return`M${dt(e+o)} ${dt(t)}h${dt(n-2*o)}a${o} ${o} 0 0 1 ${o} ${o}v${dt(r-2*o)}a${o} ${o} 0 0 1 -${o} ${o}h-${dt(n-2*o)}a${o} ${o} 0 0 1 -${o} -${o}v-${dt(r-2*o)}a${o} ${o} 0 0 1 ${o} -${o}z`}function Qr(e,t=3,n=!0,r="plain"){let o=Ln(e),i=r!=="plain",[l,m]=i?Hs[r]:["#fff","#000"],g=(0,jr.default)(0,o?"L":"H");g.addData(e,"Byte"),g.make();let f=g.getModuleCount(),E=f+t*2,x=n&&!o?Math.round(f*.22):0;x&&(f-x)%2&&x++;let b=(f-x)/2,O=b+x,H=(a,h)=>x>0&&a>=b&&a=b&&hi&&(h<7&&a<7||h<7&&a>=f-7||h>=f-7&&a<7),R="";if(i){let a=o?.48:.42;for(let h=0;h${Ds(i?l:"#fff")}`}let v=``;return i?`${v}${d}`:`${v}${d}`}var Jr={opacity:1,filter:"blur(0px)",transform:"none"},Os={opacity:0,filter:"blur(5px)",transform:"scale(.86)"},Xr={opacity:0,filter:"blur(5px)",transform:"scale(.6)"},Zr={duration:180,easing:Z,fill:"forwards"},Qt={duration:340,delay:70,easing:j,fill:"backwards"},eo=Qt.delay+Qt.duration,Jt=new WeakMap;function An(e){let t=getComputedStyle(e);return{opacity:t.opacity,filter:t.filter==="none"?"blur(0px)":t.filter,transform:t.transform}}function to(e){var t;for(let n of[...e.childNodes])n.nodeType===Node.TEXT_NODE&&((t=n.textContent)!=null&&t.trim())&&n.replaceWith(s("span",{},n.textContent));return[...e.children].filter(n=>!n.classList.contains("orb"))}function no(e,t){var r;let n=(r=Jt.get(e))!=null?r:[];Jt.set(e,t),n.forEach(o=>o.cancel())}function ro(e){var o;(o=e.querySelector(":scope > .orb"))==null||o.remove();let t=to(e),n=t.map(An),r=s("span",{class:"orb","aria-hidden":"true"},s("i"),s("i"));e.append(r),e.classList.add("busy"),e.setAttribute("aria-busy","true"),no(e,[...t.map((i,l)=>$(i,[n[l],Os],Zr)),$(r,[Xr,Jr],Qt)])}function oo(e){let t=e.querySelector(":scope > .orb"),n=to(e),r=[...t?[$(t,[An(t),Xr],Zr)]:[],...n.map(o=>$(o,[An(o),Jr],Qt))];no(e,r),e.removeAttribute("aria-busy"),Promise.all(r.map(o=>o.finished)).then(()=>{Jt.get(e)===r&&(Jt.delete(e),r.forEach(o=>o.cancel()),t==null||t.remove(),e.classList.remove("busy"))},()=>{})}var so=e=>[...e].map(t=>s("i",{},t)),ut=new WeakMap,_t=e=>{var t,n,r;return(r=(n=(t=ut.get(e))==null?void 0:t.text)!=null?n:e.textContent)!=null?r:""};function Dn(e){let t=document.createRange();return t.selectNodeContents(e),t.getBoundingClientRect()}function io(e){var i;let t=e.firstChild;if(!t||t.nodeType!==Node.TEXT_NODE)return[];let n=document.createRange(),r=[],o=0;for(let l of(i=t.textContent)!=null?i:"")n.setStart(t,o),n.setEnd(t,o+l.length),r.push(n.getBoundingClientRect().left),o+=l.length;return r.map(l=>l-r[0])}function ao(e,t){let n=[...e.children];if(!n.length)return;let r=n[0].getBoundingClientRect().left;n.forEach((o,i)=>{if(!i||t[i]===void 0)return;let l=r+t[i]-o.getBoundingClientRect().left;Math.abs(l)>.01&&(o.style.marginLeft=`${l}px`)})}function Bs(e,t){let n=0;for(;nnew Array(i.length+1).fill(0));for(let g=o.length-1;g>=0;g--)for(let f=i.length-1;f>=0;f--)l[g][f]=o[g]===i[f]?l[g+1][f+1]+1:Math.max(l[g+1][f],l[g][f+1]);let m=[];for(let g=0;g=l[g][f+1]?g++:f++;for(let g=r;g>0;g--)m.push([e.length-g,t.length-g]);return m}function Xt(e){let t=ut.get(e);t&&(clearTimeout(t.timer),ut.delete(e),e.getAnimations().forEach(n=>n.cancel()),e.classList.remove("mt","mt-ib"),e.textContent=t.text)}function Pe(e,t){Xt(e),e.textContent=t}function ee(e,t,n=_t(e),r={}){var le,ue;let{whole:o=!1,at:i}=r,l=((le=r.glide)!=null?le:!0)&&!i,m=ut.has(e)?e.getBoundingClientRect().width:null;if(Xt(e),n===t||Ae()||!e.getClientRects().length){e.textContent=t;return}let g=getComputedStyle(e),f=o&&g.display==="inline";g.display==="inline"&&!o&&e.classList.add("mt-ib"),g.position==="static"&&e.classList.add("mt");let E=null,x=i!=null?i:null,b=[];x||(e.textContent=n,E=e.getBoundingClientRect(),x=Dn(e),b=io(e)),e.textContent=t;let O=e.getBoundingClientRect(),H=io(e),P=(ue=m!=null?m:E==null?void 0:E.width)!=null?ue:O.width,R=l&&!f&&!!E&&Math.abs(O.width-P)>.5,D=!R||!E||Math.abs(O.left-E.left)<.5?"start":Math.abs(O.right-E.right)<.5?"end":"middle",d=s("span",{class:o?"mt-new w":"mt-new"},o?t:so(t)),v=s("span",{class:o?"mt-old w":"mt-old","aria-hidden":"true"},o?n:so(n));o&&(v.style.width=`${x.width+1}px`),e.replaceChildren(d,v),R&&$(e,[{width:`${P}px`},{width:`${O.width}px`}],{duration:q.duration,easing:q.easing,fill:"forwards"});let a=e.getBoundingClientRect(),h=(Y,te)=>{v.style.top=`${te}px`,D==="end"?v.style.right=`${-Y}px`:D==="middle"?(v.style.left="50%",v.style.translate=`calc(-50% + ${Y}px) 0`):v.style.left=`${Y}px`},p=D==="end"?x.right-a.right:D==="middle"?(x.left+x.right-a.left-a.right)/2:x.left-a.left;h(p,x.top-a.top);let A=Dn(v);if(h(p+x.left-A.left,x.top-a.top+x.top-A.top),o){$(v,[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}],{duration:180,easing:Z,fill:"forwards"}),$(d,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}],{duration:280,delay:60,easing:j,fill:"backwards"});let Y=Math.max(340,R?q.duration:0)+40;ut.set(e,{text:t,timer:window.setTimeout(()=>Xt(e),Y)});return}ao(d,H),ao(v,b);let u=[...v.children],c=[...d.children],T=Bs([...n],[...t]),w=new Set(T.map(([Y])=>Y)),C=new Set(T.map(([,Y])=>Y));T.forEach(([Y,te])=>{let se=u[Y].getBoundingClientRect(),ne=c[te].getBoundingClientRect();u[Y].style.visibility="hidden",(Math.abs(se.left-ne.left)>.5||Math.abs(se.top-ne.top)>.5)&&$(c[te],[{transform:`translate(${se.left-ne.left}px, ${se.top-ne.top}px)`},{transform:"none"}],{duration:q.duration,easing:q.easing})});let I=u.filter((Y,te)=>!w.has(te)),G=c.filter((Y,te)=>!C.has(te)),V=Math.min(12,160/Math.max(1,I.length)),J=Math.min(22,260/Math.max(1,G.length));I.forEach((Y,te)=>$(Y,[{opacity:1,filter:"blur(0px)",transform:"none"},{opacity:0,filter:"blur(4px)",transform:"translateY(-0.45em)"}],{duration:220,delay:te*V,easing:Z,fill:"forwards"})),G.forEach((Y,te)=>$(Y,[{opacity:0,filter:"blur(4px)",transform:"translateY(0.45em)"},{opacity:1,filter:"blur(0px)",transform:"none"}],{duration:380,delay:120+te*J,easing:j,fill:"backwards"}));let re=Math.max(220+I.length*V,G.length?120+G.length*J+380:0,R||T.length?q.duration:0)+40;ut.set(e,{text:t,timer:window.setTimeout(()=>Xt(e),re)})}function Zt(e){return new Map([...e.querySelectorAll("[data-t]")].map(t=>[t.dataset.t,_t(t)]))}function en(e,t){e.querySelectorAll("[data-t]").forEach(n=>{var i;let r=t.get(n.dataset.t),o=(i=n.textContent)!=null?i:"";r!==void 0&&r!==o&&ee(n,o,r)})}var lo=e=>`${e.tagName}.${[...e.classList].filter(t=>t!=="mt"&&t!=="mt-ib").join(" ")}`,co=e=>e.outerHTML.replace(/\bgl\d+/g,"gl");function Rs(e){let t=new Map,n=(r,o)=>r.childNodes.forEach((i,l)=>{var E,x;let m=`${o}/${l}`;if(i.nodeType===Node.TEXT_NODE){if((E=i.textContent)!=null&&E.trim()){let b=document.createRange();b.selectNodeContents(i);let O=b.getBoundingClientRect();t.set(m,{kind:"#text",text:i.textContent,svg:"",at:O,words:O,node:i})}return}if(!(i instanceof Element))return;let g=i instanceof SVGElement?co(i):"",f=i instanceof HTMLElement&&!g?Dn((x=i.querySelector(":scope > .mt-new"))!=null?x:i):null;t.set(m,{kind:lo(i),text:i instanceof HTMLElement?_t(i):"",svg:g,at:i.getBoundingClientRect(),words:f,node:i}),g||n(i,m)});return n(e,""),t}var Sn=e=>$(e,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"blur(0px)"}],{duration:280,delay:60,easing:j,fill:"backwards"});function tn(e,t){var O;let n=Rs(e),r=e.getBoundingClientRect();if(We(e,t),!n.size||Ae())return;let o=e.getBoundingClientRect(),i=H=>H&&new DOMRect(H.left-r.left+o.left,H.top-r.top+o.top,H.width,H.height),l=[],m=[],g=new Set,f=(H,P,R)=>{var v;let D=H.parentElement,d=R?(v=n.get(R))==null?void 0:v.at:r;P!=null&&P.at&&P.node instanceof Element&&m.push(D&&d?[P.node,P.at,D,d]:[P.node,P.at,e,r]),l.push(()=>Sn(H))},E=(H,P,R)=>{let D=H.getBoundingClientRect(),d=P.left-r.left-(D.left-o.left),v=P.top-r.top-(D.top-o.top),a=d-R[0],h=v-R[1];return(Math.abs(a)>.5||Math.abs(h)>.5)&&$(H,[{transform:`translate(${a}px, ${h}px)`},{transform:"none"}],{duration:q.duration,easing:q.easing}),[d,v]},x=(H,P,R)=>[...H.childNodes].forEach((D,d)=>{var A,u;let v=`${P}/${d}`;g.add(v);let a=n.get(v);if(D.nodeType===Node.TEXT_NODE){let c=(A=D.textContent)!=null?A:"";if(!c.trim()||(a==null?void 0:a.kind)==="#text"&&a.text===c)return;let T=s("span",{},c);D.replaceWith(T),a!=null&&a.at&&E(T,a.at,R),l.push(()=>{var w;return(a==null?void 0:a.kind)==="#text"&&c.length<=40&&a.text.length<=40?ee(T,c,a.text,{whole:!0,at:(w=i(a.words))!=null?w:void 0}):Sn(T)});return}if(!(D instanceof Element))return;let h=D.getBoundingClientRect();if(!a||a.kind!==lo(D)||a.at&&Math.abs(a.at.height-h.height)>1&&!(D instanceof SVGElement))return f(D,a,P);let p=a.at?E(D,a.at,R):R;if(D instanceof SVGElement){a.svg!==co(D)&&l.push(()=>Sn(D));return}if(!D.children.length&&D instanceof HTMLElement){let c=(u=D.textContent)!=null?u:"";c!==a.text&&l.push(()=>{var T;return c.length<=40&&a.text.length<=40?ee(D,c,a.text,{whole:!0,at:(T=i(a.words))!=null?T:void 0}):f(D,a,P)});return}x(D,v,p)});x(e,"",[0,0]);for(let[H,P]of n)!g.has(H)&&H.lastIndexOf("/")===0&&P.at&&P.node instanceof Element&&m.push([P.node,P.at,e,r]);l.forEach(H=>H());let b=new Map;for(let[,,H]of m)!b.has(H)&&getComputedStyle(H).position==="static"&&H.classList.add("mt"),b.set(H,((O=b.get(H))!=null?O:0)+1);for(let[H,P,R,D]of m){let d=H;d.style.position="absolute",d.style.margin="0",d.style.left=`${P.left-D.left-R.clientLeft}px`,d.style.top=`${P.top-D.top-R.clientTop}px`,d.style.width=`${P.width}px`,d.style.pointerEvents="none",d.setAttribute("aria-hidden","true"),R.appendChild(d),$(d,[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(4px)"}],{duration:180,easing:Z,fill:"forwards"}).onfinish=()=>{d.remove();let v=b.get(R)-1;b.set(R,v),v||R.classList.remove("mt")}}}var Ns='',Pn=()=>[W("apple"),Be(Ns)];function Is(e,t){if(e===t)return["",e,e,""];let n=e.split(" "),r=t.split(" "),o=0;for(;og?d[2]:d[1],E=d=>s("span",{class:"osm-p"},d),x=()=>{l=o.findIndex(d=>d[1]!==d[2]),l<0&&(g=0),i=o.map(d=>({pre:E(d[0]),word:E(f(d)),suf:E(d[3])})),m=l>=0?s("span",{class:"osm-ic"},Pn()[g]):null,n.replaceChildren(...i.flatMap((d,v)=>[v?s("span",{class:"arr"},"›"):null,d.pre,v===l?m:null,d.word,d.suf]).filter(d=>!!d))},b={width:"1.05em",marginRight:"0.25em"},O=d=>$(d,[{opacity:1,filter:"blur(0px)",...b},{opacity:0,filter:"blur(3px)",width:"0px",marginRight:"0px"}],{duration:220,easing:Z,fill:"forwards"}).onfinish=()=>d.remove(),H=d=>$(d,[{opacity:0,filter:"blur(3px)",width:"0px",marginRight:"0px"},{opacity:1,filter:"blur(0px)",...b}],{duration:q.duration,easing:q.easing}),P=(d,v)=>{r.setAttribute("aria-label",(d===v?d:N(_("%s (Android: %s)"),d,v.split(" → ").pop())).replace(/ → /g," › "));let a=d.split(" → "),h=v.split(" → "),p=a.map((u,c)=>{var T;return Is(u,(T=h[c])!=null?T:u)});if(!i.length||p.length!==o.length)return o=p,x();let A=l;o=p,l=o.findIndex(u=>u[1]!==u[2]),l<0&&(g=0),o.forEach((u,c)=>{ee(i[c].pre,u[0],void 0,{whole:!0}),ee(i[c].word,f(u),void 0,{whole:!0}),ee(i[c].suf,u[3],void 0,{whole:!0})}),l!==A&&(m&&O(m),m=l>=0?s("span",{class:"osm-ic"},Pn()[g]):null,m&&(i[l].word.before(m),H(m)))};P(e,t);let R=()=>{if(!r.isConnected)return clearInterval(D);if(l<0||!m||!r.offsetParent)return;g=1-g,ee(i[l].word,f(o[l]));let d=m.firstElementChild,v=Pn()[g];if(Ae()){d.replaceWith(v);return}m.appendChild(v),$(d,[{opacity:1,filter:"blur(0px)",transform:"none"},{opacity:0,filter:"blur(3px)",transform:"scale(.5) rotate(-40deg)"}],{duration:200,easing:Z,fill:"forwards"}).onfinish=()=>d.remove(),$(v,[{opacity:0,filter:"blur(3px)",transform:"scale(.5) rotate(40deg)"},{opacity:1,filter:"blur(0px)",transform:"none"}],{duration:xe.duration,delay:80,easing:xe.easing,fill:"backwards"})},D=window.setInterval(R,3e3);return{el:r,set:P}}var nn=null,Et=null,po=0,fo=(e,t,n)=>$(e,t,{duration:n,easing:Z,fill:"forwards"}).onfinish=()=>e.remove();function ke(e,t=!1){nn!=null||(nn=document.body.appendChild(s("div",{class:"toasts"}))),Et&&fo(Et,[{opacity:1},{opacity:0,transform:"scale(.96)",filter:"blur(4px)"}],140);let n=s("div",{class:`toast${t?" bad":""}`,role:"status"},W(t?"alert":"check"),s("span",{},e));nn.appendChild(n),Et=n,$(n,[{opacity:0,transform:"translateY(18px) scale(.9)",filter:"blur(6px)"},{opacity:1,transform:"none",filter:"none"}],{duration:Te.duration,easing:Te.easing}),clearTimeout(po),po=window.setTimeout(()=>{Et===n&&(Et=null,fo(n,[{opacity:1},{opacity:0,transform:"translateY(6px) scale(.96)",filter:"blur(4px)"}],180))},2400)}function $n(e,t){var r;let n=W(t,(r=e.getAttribute("class"))!=null?r:"i");return e.replaceWith(n),$(n,[{opacity:0,transform:"scale(.6)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:xe.duration,easing:xe.easing}),n}function Gs(e){if(e.classList.contains("copied"))return;let t=e.querySelector("svg.i"),n=e.querySelector(".lbl, .b-main"),r=n?_t(n):"";e.classList.add("copied");let o=t?$n(t,"check"):null;n&&ee(n,_("Copied")),setTimeout(()=>{o&&t&&o.replaceWith(t),n&&ee(n,r),e.classList.remove("copied")},1600)}async function he(e,t=_("Copied"),n){try{await navigator.clipboard.writeText(e)}catch{let r=s("textarea",{class:"offscreen"},e);document.body.appendChild(r),r.select();let o=document.execCommand("copy");if(r.remove(),!o)return ke(_("Copying is blocked here. Select the text and copy it by hand."),!0)}n instanceof Element&&Gs(n),ke(t)}function Xe(e,t){var o;let n=navigator;if(Yt()!=="ios"||typeof n.share!="function"||typeof File=="undefined")return null;let r=new File([t],e,{type:"application/octet-stream"});return(o=n.canShare)!=null&&o.call(n,{files:[r]})?async()=>{try{await n.share({files:[r]})}catch(i){(i==null?void 0:i.name)!=="AbortError"&&rn(e,t)}}:null}function rn(e,t){let n=URL.createObjectURL(new Blob([t],{type:"application/octet-stream"})),r=s("a",{href:n,download:e,class:"offscreen"});document.body.appendChild(r),r.click(),setTimeout(()=>{URL.revokeObjectURL(n),r.remove()},1e3)}function Tt(e,t){let n=Xe(e,t);n?n():rn(e,t)}async function Ze(e,t){if(e.disabled)return;e.disabled=!0,ro(e);let n=performance.now();try{await t()}finally{let r=Ae()?0:eo-(performance.now()-n);r>0&&await new Promise(o=>setTimeout(o,r)),oo(e),e.disabled=!1}}var Hn=matchMedia("(prefers-color-scheme: light)"),Ws=()=>Hn.matches?"day":"night";function On(e,t){var n,r;e.dataset.qr=t,e.classList.toggle("dense",Ln(t)),e.classList.toggle("light",Hn.matches),e.innerHTML=Qr(t,3,!0,Ws()),e.dataset.mods=String((r=(n=e.firstElementChild)==null?void 0:n.viewBox.baseVal.width)!=null?r:0)}function Lt(e,t=!1){let n=s("div",{class:`qrbox${t?" big":""}`});return On(n,e),n}Hn.addEventListener("change",()=>document.querySelectorAll(".qrbox[data-qr]").forEach(e=>{var t;(t=e.querySelector("svg.old"))==null||t.remove(),On(e,e.dataset.qr)}));function Bn(e,t){let n=Lt(e),r=s("div",{class:"words"},t),o=s("div",{class:"side"},r),i=s("div",{class:`coderow${n.classList.contains("dense")?" stacked":""}`},n,o);return{el:i,swap(l,m){let g=n.dataset.qr===l?null:n.querySelector("svg");if(g){On(n,l),i.classList.toggle("stacked",n.classList.contains("dense"));let E=n.querySelector("svg");g.classList.add("old"),n.appendChild(g),$(E,[{opacity:0},{opacity:1}],{duration:200,easing:j}),$(g,[{opacity:1},{opacity:0}],{duration:220,delay:110,easing:Z,fill:"forwards"}).onfinish=()=>g.remove()}if(!m)return;let f=r;r=s("div",{class:"words"},m),o.appendChild(r),f.classList.add("old"),$(r,[{opacity:0,filter:"blur(3px)"},{opacity:1,filter:"blur(0px)"}],{duration:220,easing:j}),$(f,[{opacity:1,filter:"blur(0px)"},{opacity:0,filter:"blur(3px)"}],{duration:200,delay:90,easing:Z,fill:"forwards"}).onfinish=()=>f.remove()}}}function pt(e){let t=typeof navigator.share=="function";return s("div",{class:"linkrow"},s("span",{class:"mono"},e.replace(/^https?:\/\//,"")),s("button",{type:"button",class:"knob","aria-label":_("Copy the link"),onclick:n=>he(e,_("Link copied"),n.currentTarget)},W("copy")),t?s("button",{type:"button",class:"knob","aria-label":_("Share the link"),onclick:()=>navigator.share({url:e,title:Je()}).catch(()=>{})},W("share")):null)}var et=null,Ie=null,At=()=>!!et;function De(e=!1){let t=et;if(t){if(et=null,Ie==null||Ie.setAttribute("aria-expanded","false"),Ie=null,e){t.remove();return}$(t,[{opacity:1},{opacity:0,transform:"scale(.96)",filter:"blur(3px)"}],{duration:120,easing:Z,fill:"forwards"}).onfinish=()=>t.remove()}}function on(e,t){var f,E;if(Ie===e&&et)return De();De(!0);let n=t.filter((x,b)=>x||b>0&&t[b-1]&&t.slice(b+1).some(Boolean)),r=s("span",{class:"menu-hl"}),o=s("div",{class:"menu",role:"menu"},r);for(let x of n){if(!x){o.appendChild(s("div",{class:"menu-sep"}));continue}let b=s("button",{type:"button",role:x.checked===void 0?"menuitem":"menuitemradio","aria-checked":x.checked===void 0?null:String(x.checked),class:`mi ${(f=x.tone)!=null?f:""}`,onclick:()=>{De(),x.run()}},x.checked===void 0?W((E=x.icon)!=null?E:""):W("check",x.checked?"i":"i off"),s("span",{},x.label));b.addEventListener("pointerenter",()=>{var O;r.className=`menu-hl${r.style.opacity==="1"?" moving":""} ${(O=x.tone)!=null?O:""}`,r.style.transform=`translateY(${b.offsetTop-6}px)`,r.style.opacity="1"}),o.appendChild(b)}o.addEventListener("pointerleave",()=>r.style.opacity="0"),document.body.appendChild(o);let i=e.getBoundingClientRect(),l=o.offsetWidth,m=o.offsetHeight,g=i.bottom+8+m{let t=e.target;et&&!et.contains(t)&&!(Ie!=null&&Ie.contains(t))&&De()});addEventListener("scroll",()=>De(),{passive:!0});var de,$e,F,Rn,mt,Fe,ae,qe=[],sn=null,Nn=null,St=!1,ft=null,He=()=>!!(de!=null&&de.classList.contains("open")),gt=400,ho=80,zs=3.2,vt=()=>matchMedia("(min-width: 760px)").matches,ht=gt,In=null;function yt(){var o;if(!de||!He())return null;if(!vt())return F.style.maxWidth&&(F.style.maxWidth=""),ht=gt,null;let e=[...ae.querySelectorAll(".qrbox.dense")].find(i=>{let l=i.closest(".acc-row");return i.offsetWidth&&(!l||l.classList.contains("open"))&&!i.closest(".leaving")}),t=gt;if(e){let i=Math.min(innerWidth-32-ho,innerHeight-120);t=Math.max(gt,Math.round(Math.min(+((o=e.dataset.mods)!=null?o:0)*zs,i)+ho))}let n=e&&e!==In?e:null;if(In=e!=null?e:null,Math.abs(t-ht)<8)return n?{from:t,want:t,reveal:n}:null;let r=parseFloat(getComputedStyle(F).maxWidth)||ht;return ht=t,F.getAnimations().filter(i=>{var l;return(l=i.effect)==null?void 0:l.getKeyframes().some(m=>"maxWidth"in m)}).forEach(i=>i.cancel()),F.style.maxWidth=`${t}px`,{from:r,want:t,reveal:n}}function bt(e){if(!e)return;Math.abs(e.from-e.want)>1&&$(F,[{maxWidth:`${e.from}px`},{maxWidth:`${e.want}px`}],{duration:q.duration,easing:q.easing});let t=e.reveal;t&&setTimeout(()=>{if(!t.isConnected)return;let n=Fe.getBoundingClientRect(),r=t.getBoundingClientRect(),o=r.bottom>n.bottom-16?r.bottom-n.bottom+16:r.topme()},W("x")),mt=s("div",{class:"sheet-acts"}),ae=s("div",{class:"vp"}),Fe=s("div",{class:"sheet-scroll"},ae),F=s("div",{class:"sheet",role:"dialog","aria-modal":"true"},Rn,mt,Fe),$e=s("div",{class:"scrim",onclick:()=>me()}),de=s("div",{class:"sheet-root","aria-hidden":"true"},$e,F),document.body.appendChild(de),new ResizeObserver(()=>bt(yt())).observe(ae),qs()}function mo(e){F.setAttribute("aria-label",e.label),Rn.setAttribute("aria-label",_("Close")),F.setAttribute("role",e.asks?"alertdialog":"dialog"),F.classList.toggle("asks",!!e.asks)}function an(){let e=Nn;Nn=null,e==null||e()}function go(e){Nn=e}function tt(e){sn=e}function ge(e){if(de||Us(),De(!0),an(),He()){qe=[e],Gn(e());return}ft=document.activeElement instanceof HTMLElement?document.activeElement:null,qe=[e],sn=null,ht=gt,In=null,F.style.maxWidth="",F.classList.remove("arrived");let t=e();ae.replaceChildren(t.el),vo(t,!1),mo(t),de.classList.add("open"),de.setAttribute("aria-hidden","false"),document.body.classList.add("locked");let n=yt();if(n&&bt({...n,from:n.want}),F.getAnimations().forEach(r=>r.cancel()),$e.getAnimations().forEach(r=>r.cancel()),F.style.transform="",vt()?$(F,[{opacity:0,transform:"scale(.9)",filter:"blur(4px)"},{opacity:1,transform:"none",filter:"none"}],{duration:Le.duration,easing:Le.easing}):$(F,[{transform:"translateY(calc(100% + 40px))"},{transform:"none"}],{duration:500,easing:Cn}),$($e,[{opacity:0},{opacity:1}],vt()?{duration:Le.duration,easing:Le.easing}:{duration:420,easing:"ease-out"}),!St)try{history.pushState({sheet:!0},""),St=!0}catch{}}function me(e=!1){if(!He()||de.dataset.closing)return;an(),St&&(St=!1,history.back()),document.body.classList.remove("locked");let t=()=>{de.classList.remove("open"),de.setAttribute("aria-hidden","true"),delete de.dataset.closing,F.style.transform="",$e.style.opacity="",F.getAnimations().forEach(i=>i.cancel()),$e.getAnimations().forEach(i=>i.cancel()),ae.getAnimations().forEach(i=>i.cancel()),ae.replaceChildren(),mt.replaceChildren(),F.classList.remove("arrived"),F.style.maxWidth="",ht=gt,qe=[],ft!=null&&ft.isConnected&&ft.focus({preventScroll:!0}),ft=null;let o=sn;sn=null,o==null||o()};if(e)return t();de.dataset.closing="1";let n=getComputedStyle(F).transform;F.getAnimations().forEach(o=>o.cancel()),$($e,[{opacity:getComputedStyle($e).opacity},{opacity:0}],vt()?{duration:120,easing:Z,fill:"forwards"}:{duration:320,easing:"ease-out",fill:"forwards"});let r=n==="none"?"none":n;$(F,vt()?[{opacity:1,transform:r,filter:"blur(0px)"},{opacity:0,transform:`${r==="none"?"":r} scale(.96)`.trim(),filter:"blur(3px)"}]:[{transform:r},{transform:"translateY(calc(100% + 40px))"}],vt()?{duration:120,easing:Z,fill:"forwards"}:{duration:420,easing:Cn,fill:"forwards"}).onfinish=t}addEventListener("popstate",()=>{He()&&(St=!1,me())});function vo(e,t=!0){var o;let n=(o=e.acts)!=null?o:null,r=mt.firstElementChild;if(n!==r){if(!t||r&&n&&r.dataset.key===n.dataset.key)return mt.replaceChildren(...n?[n]:[]);r&&(Object.assign(r.style,{position:"absolute",right:"0",top:"0",pointerEvents:"none"}),$(r,[{opacity:1,transform:"none",filter:"none"},{opacity:0,transform:"scale(.9)",filter:"blur(3px)"}],{duration:180,easing:"cubic-bezier(.2,0,0,1)",fill:"forwards"}).onfinish=()=>r.remove()),n&&(mt.appendChild(n),$(n,[{opacity:0,transform:"scale(.9)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:260,delay:110,easing:"cubic-bezier(.2,0,0,1)",fill:"backwards"}))}}function Gn(e){mo(e),vo(e),F.classList.remove("arrived");let t=[...ae.children],n=ae.getBoundingClientRect().height;ae.getAnimations().forEach(i=>i.cancel()),t.forEach(i=>{i.classList.add("leaving"),Object.assign(i.style,{position:"absolute",left:"0",right:"0",top:"0",pointerEvents:"none"}),i.inert=!0}),ae.appendChild(e.el),e.el.style.pointerEvents="none",setTimeout(()=>e.el.style.pointerEvents="",320),Fe.scrollTop=0;let r=yt(),o=e.el.getBoundingClientRect().height;$(ae,[{height:`${n}px`},{height:`${o}px`}],{duration:360,easing:"cubic-bezier(.25,1,.5,1)"}),bt(r),t.forEach(i=>$(i,[{opacity:1,transform:"none",filter:"none"},{opacity:0,transform:"scale(.96)",filter:"blur(2px)"}],{duration:200,easing:"cubic-bezier(.2,0,0,1)",fill:"forwards"}).onfinish=()=>i.remove()),$(e.el,[{opacity:0,transform:"scale(.96)",filter:"blur(4px)"},{opacity:1,transform:"none",filter:"none"}],{duration:280,delay:110,easing:"cubic-bezier(.2,0,0,1)",fill:"backwards"})}function ln(e){if(!He())return ge(e);an(),qe.push(e),Gn(e())}function Ks(){qe.length<2||(an(),qe.pop(),Gn(qe[qe.length-1]()))}function yo(e,t=[]){if(!He())return e();let n=ae.getBoundingClientRect().height;ae.getAnimations().forEach(g=>g.cancel());let r=ae.lastElementChild,o=new Map;r==null||r.querySelectorAll("*").forEach(g=>{(!(g instanceof SVGElement)||g instanceof SVGSVGElement)&&o.set(g,g.getBoundingClientRect())}),e();let i=yt(),l=ae.getBoundingClientRect().height;Math.abs(l-n)>1&&$(ae,[{height:`${n}px`},{height:`${l}px`}],{duration:q.duration,easing:q.easing}),bt(i);let m=new Set;for(let[g,f]of o){if(!g.isConnected||!f.width||!f.height)continue;let E=g.getBoundingClientRect();if(!E.width||!E.height)continue;let x=f.left-E.left,b=f.top-E.top;if(Math.abs(x)<.5&&Math.abs(b)<.5)continue;m.add(g);let O=g.parentElement;for(;O&&O!==r&&!m.has(O);)O=O.parentElement;O&&O!==r||$(g,[{transform:`translate(${x}px, ${b}px)`},{transform:"none"}],{duration:q.duration,easing:q.easing})}for(let g of t)g&&$(g,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,easing:j})}function bo(){F==null||F.classList.add("arrived")}var xo=()=>Fe==null?void 0:Fe.scrollTo({top:0,behavior:"smooth"}),Wn=e=>He()&&ae.contains(e)&&!e.closest(".leaving");function qs(){let e=null;F.addEventListener("pointerdown",n=>{let r=n.target;!r.closest(".vhead")||r.closest("button, a, input")||(e={y:n.clientY,t:performance.now(),dy:0,v:0},F.setPointerCapture(n.pointerId))}),F.addEventListener("pointermove",n=>{if(!e)return;let r=n.clientY-e.y,o=performance.now(),i=r>0?r:-br(-r,F.offsetHeight);e.v=(i-e.dy)/Math.max(1,o-e.t),e.dy=i,e.t=o,F.style.transform=`translateY(${i}px)`,$e.style.opacity=String(Math.max(0,1-Math.max(0,i)/420))});let t=()=>{if(!e)return;let{dy:n,v:r}=e;if(e=null,xr(n,r,F.offsetHeight))return me();let o=F.style.transform;F.style.transform="",$e.style.opacity="",n!==0&&$(F,[{transform:o},{transform:"none"}],{duration:q.duration,easing:q.easing})};F.addEventListener("pointerup",t),F.addEventListener("pointercancel",t)}function Ee(e,t={}){return s("div",{class:`vhead${t.back?" center":""}${t.acts?" with-acts":""}`},t.back?s("button",{type:"button",class:"knob back","aria-label":_("Back"),onclick:Ks},W("chevron")):null,s("h2",{},e))}var Ge=e=>s("p",{class:"vsub"},e),Ve=(...e)=>s("p",{class:"hint"},...e);function wo(){ge(()=>{let e=lt();return{el:s("div",{class:"view"},Ee(_("Open on another device")),Ge(_("Point its camera at the code: this page opens there.")),Lt(e,!0),pt(e)),label:_("Open on another device")}})}var Fs='',dn=null,Pt=null,cn=null;function zn(e){if(Pt)return Pt;dn=s("header",{class:"crumbs"}),Pt=s("div",{class:"page-body"}),e.replaceChildren(s("div",{class:"edge-fade top","aria-hidden":"true"}),s("div",{class:"edge-fade bot","aria-hidden":"true"}),cn=s("main",{class:"page"},dn,Pt));let t=()=>document.body.classList.toggle("scrolled",scrollY>2);return addEventListener("scroll",t,{passive:!0}),t(),Pt}function Un(e){cn==null||cn.classList.toggle("single",e)}function Vs(){let e=s("button",{type:"button",class:"cr-lang","aria-label":_("Language"),"aria-haspopup":"menu","aria-expanded":"false"},s("span",{},Qe().toUpperCase()),W("chevron","i cr-down"));return e.addEventListener("click",()=>on(e,It.map(t=>({label:t.name,checked:t.code===Qe(),run:()=>t.code!==Qe()&&kn(t.code)})))),e}function Kn(e=!1,t=!1){var o;if(!dn)return;let n=e?null:(o=pe())==null?void 0:o.person,r=s("span",{class:n?"":"cur","aria-current":n?null:"page"},Je());dn.replaceChildren(s("span",{class:"cr-mark"},Be(Fs)),s("nav",{class:"cr-path","aria-label":_("Breadcrumb")},r,n?[W("chevron"),s("span",{class:"cur","aria-current":"page"},n.name)]:null),...t?[]:[Vs()],...n&&!t?[s("button",{type:"button",class:"knob cr-qr","aria-label":_("Open on another device"),onclick:wo},W("qr"))]:[])}function ko(e,t,n=10){let r=m=>(Se(m).getDay()+6)%7,o=it(e,-r(e)),i=it(t,6-r(t)),l=[];for(let m=o;m<=i;m=it(m,1))if(l.push({day:m,kind:mn*7)return null;return l}var Ys=/^([01]?\d|2[0-3]):([0-5]\d)$/;function Mo(e){let t=Ys.exec(e.trim());return t?+t[1]*60+ +t[2]:null}var Dt=e=>(e%1440+1440)%1440,nt=e=>`${String(Math.floor(Dt(e)/60)).padStart(2,"0")}:${String(Dt(e)%60).padStart(2,"0")}`;function un(e,t,n){let[r,o]=e.split("-"),i=Mo(r!=null?r:""),l=Mo(o!=null?o:"");if(i==null||l==null)return null;let m=t==null?0:n-t;return{from:Dt(i+m),to:Dt(l+m),yours:t!=null}}var Co=e=>e.fromDt(Math.floor(e/60)+t);function Eo(e){let t=Se(e);return{days:new Date(t.getFullYear(),t.getMonth()+1,0).getDate(),day:t.getDate()}}var To={phone:{b:'',f:'',d:''},mobile:{b:'',f:'',d:''},tablet:{b:'',f:'',d:''},computer:{b:'',f:'',d:''},router:{b:'',f:'',d:''},other:{b:'',f:'',d:""},plus:{b:'',f:'',d:''},globe:{b:'',f:'',d:''},home:{b:'',f:'',d:''},shield:{b:'',f:'',d:''},chart:{b:'',f:'',d:''},calendar:{b:'',f:'',d:''},clock:{b:'',f:'',d:''},pause:{b:'',f:'',d:''},server:{b:'',f:'',d:''},link:{b:'',f:'',d:''},key:{b:'',f:'',d:''},lock:{b:'',f:'',d:''},check:{b:'',f:'',d:''},trash:{b:'',f:'',d:''},refresh:{b:'',f:'',d:''},app:{b:'',f:'',d:null},file:{b:'',f:'',d:''}},js=()=>Gt("amnezia","").replace(/^]*>/,"").replace(/<\/svg>$/,""),Qs=0;function Js(e,t="grey",n="gi"){var l;let r=(l=To[e])!=null?l:To.other,o=`gl${++Qs}`,i=r.d===null?`${js()}`:`${r.d}`;return``}var Q=(e,t="grey",n="gi")=>Be(Js(e,t,n));function pn(e,t,n,r){return s("div",{class:`notice ${e}`},Q(t,e==="bad"?"red":"orange"),s("div",{class:"t"},n?s("b",{},n):null,s("span",{},r)))}function Xs(e){var r;let t=un(e,(r=pe())==null?void 0:r.tz_offset,-new Date().getTimezoneOffset());if(!t)return N(_("%s (router time)"),e.replace("-","–"));let n=`${nt(t.from)}–${nt(t.to)}`;return N(t.yours?_("%s your time"):_("%s (router time)"),n)}function qn(e){switch(e.state){case"server_off":return["server",_("Server is disabled"),_("Your devices can’t connect until it’s enabled again.")];case"no_server":return["server",_("No server yet"),_("You haven’t been added to one.")];case"quota":return["chart",_("Out of data"),_("Nothing gets through until it resets.")];case"expired":return["calendar",_("Access ended"),_("Your devices can’t connect until it’s extended.")];case"hours":return["clock",_("Outside your hours"),N(_("Open %s."),Xs(e.hours))];default:return["pause",_("Access paused"),_("Your devices can’t connect until it’s resumed.")]}}function Lo(e){if(e.state!=="active")return pn(e.state==="quota"||e.state==="expired"?"bad":"warn",...qn(e));let t=Ut(e.expires,Ne());return wt(e,t)?pn("warn","calendar",N(_("Access %s"),Mr(t)),N(_("On %s."),zt(e.expires))):null}var Ao=3,So=e=>e.reduce((t,[n,r])=>[t[0]+n,t[1]+r],[0,0]);function Zs(e,t){let n=Math.max(1,...e.map(l=>l[1])),r=Math.max(1,...e.map(l=>l[0])),o=Math.round((t-Ao)*Math.min(.8,Math.max(.55,n/(n+r)))),i=t-Ao-o;return{top:o,bottom:i,scale:Math.min(o/n,i/r)}}function fn(e,t,n,r=0){let{top:o,bottom:i,scale:l}=Zs(e,n),m=(E,x,b,O)=>{let H=s("i",{class:O});H.style.height=`${Math.max(2,Math.round(b*l))}px`;let P=s("div",{class:`half ${E}`},H);return P.style.height=`${x}px`,P},g=s("div",{class:`bars ${t}`,"aria-hidden":"true"});g.style.height=`${n}px`;let f=e.map(([E,x],b)=>g.appendChild(s("div",{class:`col${b===e.length-1?" today":""}`},m("top",o,x,"dn"),m("bottom",i,E,"up"))));for(let E=0;Es("span",{class:o,title:i},W("arrow"),s("span",{class:"offscreen"},i),l),n=s("span",{class:"num","data-t":`${e}:dn`}),r=s("span",{class:"num","data-t":`${e}:up`});return{el:s("span",{class:"ud"},t("ud-dn",_("Downloaded"),n),t("ud-up",_("Uploaded"),r)),set([o,i]){Pe(n,Re(i)),Pe(r,Re(o))}}}function ei(e){let t=s("div",{class:"view"},Ee(_("Open the link securely")),Ge(_("Connection settings only travel encrypted")),s("div",{class:"center-col secure"},Q("lock","blue","gi xl"),s("p",{},_("This page is open without encryption. To add or set up a device, open the same link over HTTPS:"))),s("a",{class:"btn accent block",href:e},W("lock"),s("span",{},_("Open securely"))),Ve(_("The browser may warn that the certificate is not trusted: it is this router’s own. Choose to continue (“Advanced” → “Proceed”).")));return t.lastElementChild.classList.add("secure-note"),{el:t,label:_("Open the link securely")}}var $t=e=>ge(()=>ei(e));function xt(){let e=Wr();return e?($t(e),!0):!1}var ti={jc:"0",jmin:"0",jmax:"0",s1:"0",s2:"0",s3:"0",s4:"0",h1:"1",h2:"2",h3:"3",h4:"4",i1:"",i2:"",i3:"",i4:"",i5:""},ni={header_protection_key:"HeaderProtectionKey",content_padding_addition:"ContentPaddingAddition",rekey_after_time:"RekeyAfterTime",rekey_timeout:"RekeyTimeout",reject_after_time:"RejectAfterTime",keepalive_timeout:"KeepaliveTimeout",max_handshake_attempts:"MaxHandshakeAttempts",random_trailers:"RandomTrailers",disable_cookies:"DisableCookies"};function ri(e){let t={};for(let[n,r]of Object.entries(ni))e[n]!=null&&e[n]!==""&&(t[r]=String(e[n]));return t}function oi(e,t){var g;let n=e.amnezia,r=(g=n.obfuscation)!=null?g:{},o=f=>r[f]!=null&&r[f]!==""?String(r[f]):ti[f],i=n.host.replace(/^\[(.*)\]$/,"$1"),l={H1:o("h1"),H2:o("h2"),H3:o("h3"),H4:o("h4"),I1:o("i1"),I2:o("i2"),I3:o("i3"),I4:o("i4"),I5:o("i5"),Jc:o("jc"),Jmin:o("jmin"),Jmax:o("jmax"),S1:o("s1"),S2:o("s2"),S3:o("s3"),S4:o("s4"),...ri(r),allowed_ips:n.allowed_ips,client_ip:n.client_ip,client_priv_key:n.client_priv_key,client_pub_key:n.client_pub_key,config:e.conf.replace(/\r?\n/g,`\r +`),hostName:i,mtu:n.mtu,persistent_keep_alive:n.persistent_keep_alive,port:Number(n.port),psk_key:n.psk_key,server_pub_key:n.server_pub_key},m={containers:[{container:"amnezia-awg",awg:{isThirdPartyConfig:!0,last_config:JSON.stringify(l),port:String(n.port),protocol_version:r.header_protection_key?"3.1":"2",transport_proto:"udp"}}],defaultContainer:"amnezia-awg",description:t,hostName:i};return n.dns[0]&&(m.dns1=n.dns[0]),n.dns[1]&&(m.dns2=n.dns[1]),m}function si(e){let t="";for(let n=0;ne.replace(/^vpn:\/\//,"");var Do=["height","marginTop","marginBottom","borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"];function Ye(e,t={}){let n=s("div",{class:`acc${t.inset?" inset":""}`}),r=e.map((f,E)=>{var D;let x=f.body.filter(d=>!!d),b=!x.length,O=[f.icon,s("span",{class:"acc-title"},s("span",{class:"t"},f.title),(D=f.tag)!=null?D:null),f.val?s("span",{class:`acc-val${f.valHide?" hide-open":""}`},f.val):null],H=E===t.open&&!b,P=b?s("div",{class:"acc-head"},...O):s("button",{type:"button",class:"acc-head","aria-expanded":String(H),onclick:()=>g(R)},...O,W("chevron","i acc-chev")),R=s("div",{class:`acc-row${b?" still":""}${H?" open":""}`},P,s("div",{class:"acc-body"},...x));return n.appendChild(R),R}),o=f=>f.querySelector(".acc-body"),i=()=>r.forEach((f,E)=>{let x=f.classList.contains("open");f.classList.toggle("rt",E===0||x||r[E-1].classList.contains("open")),f.classList.toggle("rb",E===r.length-1||x||r[E+1].classList.contains("open"))}),l=f=>{let E=getComputedStyle(f),x={};for(let b of Do)x[b]=b==="height"?`${f.getBoundingClientRect().height}px`:E[b];return x},m=()=>r.forEach(f=>{var E;return(E=f.querySelector("button.acc-head"))==null?void 0:E.setAttribute("aria-expanded",String(f.classList.contains("open")))});function g(f){var H;let E=r.map(l);r.forEach(P=>P.getAnimations().forEach(R=>R.cancel())),r.forEach(P=>o(P).getAnimations().forEach(R=>R.cancel()));let x=!f.classList.contains("open"),b=r.filter(P=>P.classList.contains("open")&&(P===f||x));r.forEach(P=>{P.classList.remove("closing"),P!==f&&P.classList.remove("open","opened")}),f.classList.toggle("open",x),f.classList.toggle("opened",x),i();let O=yt();r.forEach((P,R)=>{let D=l(P);Do.some(d=>E[R][d]!==D[d])&&(b.includes(P)&&P.classList.add("closing"),$(P,[E[R],D],{duration:Le.duration,easing:Le.easing}).onfinish=()=>P.classList.remove("closing"))}),b.forEach(P=>$(o(P),[{opacity:1},{opacity:0,filter:"blur(2px)"}],{duration:160,easing:Z,fill:"forwards"})),x&&$(o(f),[{opacity:0,filter:"blur(2px)"},{opacity:1,filter:"blur(0px)"}],{duration:300,easing:"cubic-bezier(0,0,.58,1)"}),bt(O),m(),(H=t.onToggle)==null||H.call(t,r.indexOf(f),x,!1)}return i(),{el:n,openIndex:()=>r.findIndex(f=>f.classList.contains("open")),setOpen(f){r.forEach((E,x)=>E.classList.toggle("open",x===f&&!E.classList.contains("still"))),i(),m(),r.forEach((E,x)=>{var b;return(b=t.onToggle)==null?void 0:b.call(t,x,E.classList.contains("open"),!0)})}}}function $o(e,t,n){let r=s("span",{class:"seg-pill"}),o=s("div",{class:"seg appseg",role:"tablist"},r),i=e.map(b=>{let O=s("button",{type:"button",class:"seg-b",role:"tab","aria-label":b.label,title:b.label,onclick:()=>x(b.value)},W(b.icon),s("span",{class:"seg-l"},b.label));return O.dataset.v=b.value,o.appendChild(O),O}),l=b=>b.querySelector(".seg-l"),m=()=>i.forEach(b=>{let O=b.dataset.v===t;b.classList.toggle("on",O),b.setAttribute("aria-selected",String(O))}),g=()=>{let b=i.find(O=>O.dataset.v===t);return b&&b.offsetWidth?[b.offsetLeft,o.clientWidth-b.offsetLeft-b.offsetWidth]:null},f=()=>{let b=g();b&&(r.style.left=`${b[0]}px`,r.style.right=`${b[1]}px`)},E=0;function x(b){if(b===t)return;let O=i.findIndex(C=>C.dataset.v===t),H=i.findIndex(C=>C.dataset.v===b),P=getComputedStyle(r),R=parseFloat(P.left)||0,D=parseFloat(P.right)||0,d=i.map(C=>parseFloat(getComputedStyle(C).flexGrow)||0),v=l(i[O]),a=v.getBoundingClientRect().width;[...i,...i.map(l)].forEach(C=>C.getAnimations().forEach(I=>I.cancel())),t=b,m(),i.forEach((C,I)=>{let G=I===H?1:0;d[I]!==G&&$(C,[{flexGrow:d[I]},{flexGrow:G}],{duration:q.duration,easing:q.easing})}),$(v,[{opacity:1,maxWidth:`${a}px`,marginLeft:"0px"},{opacity:0,maxWidth:"0px",marginLeft:"-8px"}],{duration:220,easing:"ease-out"}),$(l(i[H]),[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,delay:70,easing:j,fill:"backwards"});let h=H>O,p=Ae()?q:vr,A=performance.now(),u=Math.max(q.duration,p.duration),c=h?q:p,T=h?p:q;cancelAnimationFrame(E);let w=()=>{let C=Ae()?u:performance.now()-A,I=g();if(!I){E=0;return}r.style.left=`${R+(I[0]-R)*c.at(C)}px`,r.style.right=`${D+(I[1]-D)*T.at(C)}px`,E=C{E||f()}).observe(o),{el:o,sync(b){b!==t&&(t=b,m(),f())}}}var Bo={vpn:"amnezia",awg:"amneziawg",wg:"wireguard"},Ro=e=>`dl.app.${e.id}`;function No(e){try{let t=localStorage.getItem(Ro(e));return t==="vpn"||t==="awg"||t==="wg"?t:null}catch{return null}}function Io(e,t){try{localStorage.setItem(Ro(e),t)}catch{}}function je(e,t=!1){var i,l;let n=[s("span",{class:"b-ic"},W(e.mark)),s("span",{class:"b-t"},s("span",{class:"b-top"},e.top),s("span",{class:"b-main"},e.main)),W(e.onclick||(i=e.href)!=null&&i.startsWith("vpn:")?"chevron":"open")],r=`badge${t?" primary":""}`;if(e.onclick)return s("button",{type:"button",class:r,onclick:e.onclick},n);let o=(l=e.href)==null?void 0:l.startsWith("vpn:");return s("a",{class:r,href:e.href,target:o?null:"_blank",rel:"noopener noreferrer"},n)}function Go(e,t,n){let r=n?Sr(e):Ar(e,t);return r?r.alt?[s("div",{class:"badges2"},je(r),je(r.alt)),Ve(r.alt.why)]:[je(r)]:[Ve(N(_("Get %s on the %s and come back here."),ce[e],$r(t)))]}var Ho=e=>s("ol",{class:"howto"},e.map(([t,n])=>s("li",{},t.replace(/ → $/," ›"),n?[" ",s("b",{},n)]:null))),ai=(e,t)=>s("button",{type:"button",onclick:t},e);function Wo(e){let t=e.app(),n=ce[t],r=e.pf==="ios"||e.pf==="android",o=e.same()&&r,i=g=>he(e.key,_("Key copied"),g.currentTarget),l=t==="vpn"&&o&&!_n(e.pf)?Xe(kt(e.cfg.filename),e.key):null;if(t==="vpn"&&o&&(_n(e.pf)||l))return[je(l?{top:_("Then come back here and tap"),main:_("Send to AmneziaVPN"),mark:"amnezia",onclick:()=>void l()}:{href:e.key,top:_("Then come back here and tap"),main:_("Open in AmneziaVPN"),mark:"amnezia"},!0),Ve(...st(l?_("Pick AmneziaVPN in the share sheet. Not there? %s and add it in the app."):_("Nothing opened? %s and add it in the app."),ai(_("Copy the key","in a sentence"),i)))];if(t==="vpn"){let g=Vt("vpn");return[je({top:_("The connection as one key"),main:_("Copy the key"),mark:"copy",onclick:i},!0),Ho([[N(_("Open %s","step"),n),""],[g.replace(/ → [^→]*$/," → "),g.replace(/^.* → /,"")],[Pr(),""]])]}let m=r?Xe(e.cfg.filename,e.cfg.conf):null;return[je(m?{top:e.same()?N(_("Straight into %s"),n):N(_("Send it to the %s"),e.there),main:_("Share the file"),mark:"share",onclick:()=>void m()}:{top:_("Then import it in the app"),main:_("Download the file"),mark:"download",onclick:()=>rn(e.cfg.filename,e.cfg.conf)},!0),Ho(Dr(t,e.pf,e.cfg.filename,!!m&&e.same()))]}function zo(e){let t=e.app(),n=(o,i,l)=>s("button",{type:"button",class:"btn soft sm",onclick:l},W(o),s("span",{class:"lbl"},i));if(t==="vpn"){let o=kt(e.cfg.filename),i=!!Xe(o,e.key);return[s("p",{class:"desc"},N(_("Send it to the %s in a message or a note, then in AmneziaVPN: %s."),e.there,Vt("vpn").replace(/ → /g," › "))),s("div",{class:"btnrow2"},n("copy",_("Copy the key"),l=>he(e.key,_("Key copied"),l.currentTarget)),n(i?"share":"download",i?_("Share as a file"):_("Download the key"),()=>Tt(o,e.key)))]}let r=!!Xe(e.cfg.filename,e.cfg.conf);return[s("p",{class:"desc"},...st(_("Send it to the %s, then import %s in %s."),e.there,s("b",{},e.cfg.filename),ce[t])),s("div",{class:"btnrow2"},n(r?"share":"download",r?_("Share the file"):_("Download the file"),()=>Tt(e.cfg.filename,e.cfg.conf)),n("copy",_("Copy the configuration"),o=>he(e.cfg.conf,_("Configuration copied"),o.currentTarget)))]}function Oo(e,t){if(/^\s*\[.+\]\s*$/.test(e))return s("span",{class:"sec"},e);let n=/^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(e);if(!n)return document.createTextNode(e);let o=/^(\s*)(PrivateKey|PresharedKey)\b/.test(e)?t?s("span",{class:"secret"},n[2]):s("span",{class:"mask"},"••••••••••••••••"):n[2];return s("span",{},s("span",{class:"k"},n[1])," ",o)}function Uo(e){let t=!1,n=s("pre",{class:"conf"}),r=()=>n.replaceChildren(...e.conf.split(` +`).flatMap((x,b)=>b?[` +`,Oo(x,t)]:[Oo(x,t)]));r();let o=!!Xe(e.filename,e.conf),i=W("key"),l=s("span",{},_("Show key")),m=s("button",{type:"button",class:"btn soft sm",onclick:()=>{t=!t,i=$n(i,t?"x":"key"),ee(l,t?_("Hide key"):_("Show key")),r(),n.querySelectorAll(".mask, .secret").forEach(x=>$(x,[{filter:"blur(4px)",opacity:.4},{filter:"none",opacity:1}],{duration:320,easing:j}))}},i,l),g=s("button",{type:"button",class:"btn soft sm",onclick:x=>he(e.conf,_("Configuration copied"),x.currentTarget)},W("copy"),s("span",{class:"lbl"},_("Copy"))),f=s("div",{class:"filecard"},s("div",{class:"fc-row"},s("span",{class:"filecard-ic"},".conf"),s("span",{class:"t"},s("span",{class:"mono"},e.filename),s("span",{},_("For computers and routers")))),s("button",{type:"button",class:"btn accent sm block",onclick:()=>Tt(e.filename,e.conf)},W(o?"open":"download"),s("span",{},o?_("Share file"):_("Download")))),E=Ye([{icon:Q("file"),title:_("Configuration"),body:[s("div",{class:"confbar"},m,g),n]}],{inset:!0});return s("div",{class:"step-box"},f,E.el)}function Ko(e){let t=s("span",{class:"osm-p"},ce[e]),n=uo(Ct(e,"ios"),Ct(e,"android"));return{el:s("span",{class:"scanline"},s("span",{},...st(_("In %s:"),t)),n.el),set(r){ee(t,ce[r],void 0,{whole:!0}),n.set(Ct(r,"ios"),Ct(r,"android"))}}}function qo(e){let t=s("span",{class:"tt"}),n=s("span",{class:"tt-m"}),r=s("span",{class:"hp-tip","aria-hidden":"true"},t,n),o=s("button",{type:"button",class:"hp-b",onclick:()=>Tt(e().file,e().text)},W("download")),i=s("button",{type:"button",class:"hp-b"},W("copy")),l=s("div",{class:"hpill",role:"group","aria-label":_("The connection"),"data-key":"conn"},o,i,r),m=null,g=0,f=0,E=a=>{var h;return a===i&&i.classList.contains("done")?_("Copied"):(h=a.getAttribute("aria-label"))!=null?h:""},x=(a,h)=>{n.textContent=h;let p=n.offsetWidth+20;return Math.min(a.offsetLeft+a.offsetWidth/2,l.offsetWidth+46-p/2)},b=a=>`translateX(${a}px) translateX(-50%)`,O=a=>{let h=getComputedStyle(r).transform;r.getAnimations().forEach(p=>p.cancel()),r.style.transform=b(a),$(r,[{transform:h},{transform:b(a)}],{duration:q.duration,easing:q.easing})},H=a=>ee(t,a),P=a=>{if(clearTimeout(g),m===a&&r.classList.contains("on"))return;if(m=a,r.classList.contains("on")){let p=E(a);return O(x(a,p)),H(p)}let h=()=>{let p=E(a);Pe(t,p);let A=x(a,p);r.getAnimations().forEach(u=>u.cancel()),r.style.transform=b(A),r.classList.add("on"),$(r,[{opacity:0,transform:`${b(A)} translateY(-3px) scale(.96)`,filter:"blur(3px)"},{opacity:1,transform:b(A),filter:"blur(0px)"}],{duration:220,easing:j})};performance.now(){clearTimeout(g),m=null,r.classList.contains("on")&&(f=performance.now()+500,r.classList.remove("on"),$(r,[{opacity:1},{opacity:0}],{duration:120,easing:"ease-out"}))};for(let a of[o,i])a.addEventListener("pointerenter",h=>{h.pointerType==="mouse"&&P(a)}),a.addEventListener("focus",()=>{a.matches(":focus-visible")&&P(a)}),a.addEventListener("blur",R);l.addEventListener("pointerleave",R);let D=a=>{let h=W(a);i.querySelector("svg").replaceWith(h),$(h,[{opacity:0,transform:"scale(.6)",filter:"blur(3px)"},{opacity:1,transform:"none",filter:"none"}],{duration:xe.duration,easing:xe.easing})},d=()=>{if(m!==i||!r.classList.contains("on"))return;let a=E(i);O(x(i,a)),H(a)},v=0;return i.addEventListener("click",()=>{let a=e();he(a.text,a.msg),clearTimeout(v),i.classList.contains("done")||(i.classList.add("done"),D("check"),d()),v=window.setTimeout(()=>{i.classList.remove("done"),D("copy"),d()},1600)}),{el:l,sync(){let a=e().app;o.setAttribute("aria-label",N(_("Download %s config"),a)),i.setAttribute("aria-label",N(_("Copy %s config"),a))}}}function Vo(e){let t=s("b",{},_("Waiting for the connection")),n=s("span",{class:"ws",hidden:!0}),r=s("div",{class:"way",role:"status","aria-live":"polite"},s("div",{class:"way-row"},s("span",{class:"way-end"},W(e.kind)),s("span",{class:"way-track"},s("span",{class:"way-glow"},s("i")),s("span",{class:"way-fill"})),s("span",{class:"way-end home"},W("server"))),s("div",{class:"way-text"},s("span",{class:"t"},t,n)));return{el:r,connected(){r.classList.add("done"),ee(t,N(_("%s connected"),e.name))},gaveUp(){r.classList.add("stopped"),ee(t,_("No connection yet")),n.textContent=_("Close this and open it again to keep checking."),n.hidden=!1,$(t.parentElement,[{opacity:0,filter:"blur(4px)"},{opacity:1,filter:"none"}],{duration:280,easing:j})}}}function Yo(e,t=4){window.setTimeout(async()=>{var n;try{let r=await fe("state");Me(r),At()||_e(),!((n=r.person.devices.find(o=>o.id===e))!=null&&n.online)&&t>1&&Yo(e,t-1)}catch{}},1500)}function jo(e,t,n){let r=ct(),o=0,i=0,l=!1,m=Date.now(),g=async()=>{if(o=0,!l){if(Date.now()-m>6e5){l=!0,n();return}if(document.hidden)return f();try{let x=await fe("state");Me(x);let b=x.person.devices.find(O=>O.id===e.id);if(b&&b.handshake>r){l=!0,t(),b.online||Yo(e.id);return}}catch(x){if(jt(x)){l=!0;return}}i++,f()}},f=()=>{!l&&!o&&(o=window.setTimeout(g,i<6?5e3:i<12?15e3:3e4))},E=()=>{!document.hidden&&!l&&!o&&g()};return document.addEventListener("visibilitychange",E),f(),()=>{l=!0,o&&clearTimeout(o),document.removeEventListener("visibilitychange",E)}}var Fo=e=>new Promise(t=>setTimeout(t,e));async function Qo(e,t,n){e.connected(),bo(),xo(),await Fo(400),Wn(e.el)&&(t.style.overflow="hidden",$(t,[{height:`${t.offsetHeight}px`,opacity:1,filter:"none"},{height:"0px",opacity:0,filter:"blur(4px)"}],{duration:520,easing:j,fill:"forwards"}),$(e.el,[{marginBottom:"18px"},{marginBottom:"0px"}],{duration:520,easing:j,fill:"forwards"}),await Fo(2400),Wn(e.el)&&(tt(()=>_e({flash:n.id})),me()))}async function li(e){try{return await fe(`devices/${e.id}/config`)}catch(t){return t instanceof Ke&&t.httpsUrl?$t(t.httpsUrl):ke(t.message,!0),null}}async function mn(e,t){if(xt())return;let n=async()=>{let r=await li(e);if(!r)return;let o=await Fn(r,r.server);ge(()=>Xo(e,r,o))};t instanceof HTMLButtonElement?await Ze(t,n):await n()}async function gn(e,t){let n=await Fn(t,t.server);ln(()=>Xo(e,t,n))}function Jo(e,t,n){return s("div",{class:"step"},s("span",{class:"step-n"},e),s("div",{class:"step-b"},typeof t=="string"?s("span",{class:"step-t"},t):t,n))}function ci(e,t,n){let r=e.hidden?0:e.getBoundingClientRect().height;if(e.getAnimations().forEach(m=>m.cancel()),n){e.hidden=t;return}e.style.overflow="hidden",e.hidden=!1;let o=t?0:e.getBoundingClientRect().height,[i,l]=t?[1,0]:[0,1];$(e,[{height:`${r}px`,opacity:i,filter:`blur(${4-i*4}px)`},{height:`${o}px`,opacity:l,filter:`blur(${4-l*4}px)`}],{duration:q.duration,easing:q.easing}).onfinish=()=>{e.style.overflow="",e.hidden=t}}function Xo(e,t,n){var Y,te;let r=Yt(),o=Lr(Gr()),i=e.kind==="phone"||e.kind==="tablet",l=e.kind==="router",m=Tr(e.kind,r),g=m?"same":l?"router":i?"away":"pc-away",f=En(e.kind),E=En(e.kind,!0),x=o.filter(se=>!l||se.id!=="vpn"),b=(Y=No(e))!=null?Y:l?"awg":"vpn";x.some(se=>se.id===b)||(b=x[0].id);let O={d:e,cfg:t,key:n,pf:r,there:f,app:()=>b,same:()=>m},H=[],P=()=>{if(x.length<2)return null;let se=$o(x.map(ne=>({value:ne.id,label:ne.name,icon:Bo[ne.id]})),b,ne=>{b=ne,Io(e,ne),H.forEach(Rt=>Rt.sync(ne)),yo(c)});return H.push(se),se.el},R=s("span",{class:"step-t"}),D=s("div",{class:"step-box"}),d=s("div",{class:"step-box"}),v=s("div",{class:"step-box"}),a=s("div",{class:"step-box"}),h=null,p=null,A=null,u=g==="away"?qo(()=>({...b==="vpn"?{text:n,msg:_("Key copied"),file:kt(t.filename)}:{text:t.conf,msg:_("Configuration copied"),file:t.filename},app:ce[b]})):null;function c(){ee(R,l?N(_("Get %s on the router"),ce[b]):N(_("Get %s"),ce[b]),void 0,{whole:!0}),tn(D,Go(b,r,l)),l?d.firstChild||We(d,Uo(t)):tn(d,Wo(O));let se=b==="vpn"?Po(n):t.conf;h&&p&&h.el.isConnected?A!==b&&(h.swap(se),p.set(b)):(p=Ko(b),h=Bn(se,[p.el]),v.replaceChildren(h.el)),A=b,tn(a,zo(O)),u==null||u.sync()}c();let T=Hr(lt(),e.id),w=()=>[i?Bn(T,[s("span",{},_("Point its camera at the code: the link opens there."))]).el:s("p",{class:"desc"},N(_("Open this link on the %s to set it up there."),E)),pt(T)],C=()=>Jo("1",R,[P(),D]),I=()=>Jo("2",l?_("Import the configuration"):_("Add the connection"),[d]),G=s("div",{class:"setup"});if(Er(navigator.userAgent)&&G.appendChild(pn("warn","shield",null,_("Open this page in Safari or Chrome: the store opens from here, but the app handoff does not."))),g==="same"){let se=s("div",{class:"steps-wrap"},s("div",{class:"steps-gap"}),C(),I()),ne=Ye([{icon:Q("link"),title:N(_("Not on the %s right now?"),E),body:w()}],{inset:!0,onToggle:(Rt,M,k)=>ci(se,M,k)});G.append(ne.el,se)}else g==="router"?G.append(C(),I()):g==="away"?G.appendChild(Ye([{icon:Q("link"),title:N(_("Open your link on the %s"),E),body:w()},{icon:Q("app"),title:_("Already has the app"),body:[P(),v]}],{inset:!0,open:1}).el):G.appendChild(Ye([{icon:Q("link"),title:N(_("Open your link on the %s"),E),body:w()},{icon:Q("key"),title:_("Copy or save the connection"),body:[P(),a]}],{inset:!0,open:0}).el);let V=Vo(e),J=!1;go(jo(e,()=>{J||(J=!0,Qo(V,G,e))},V.gaveUp)),tt(()=>_e());let re=g==="same"?_("Two steps, about a minute"):l?_("The packages and the file for OpenWrt"):N(_("The app goes on the %s."),f),le=N(_("Set up %s"),e.name);return{el:s("div",{class:"view"},Ee(le,{acts:!!u}),Ge(re),V.el,G),label:le,acts:(te=u==null?void 0:u.el)!=null?te:null}}var ve=navigator.userAgent,ts=/iPad/.test(ve)||/Macintosh/.test(ve)&&navigator.maxTouchPoints>1;function Ot(){return ts||/Tablet/i.test(ve)||/Android/.test(ve)&&!/Mobile/.test(ve)?"tablet":/Android|iPhone|Mobile/i.test(ve)?"phone":"computer"}var di=[[/^SM-S93/,"Galaxy S25"],[/^SM-S92/,"Galaxy S24"],[/^SM-S91/,"Galaxy S23"],[/^SM-S90/,"Galaxy S22"],[/^SM-G99/,"Galaxy S21"],[/^SM-F9/,"Galaxy Z Fold"],[/^SM-F7/,"Galaxy Z Flip"],[/^SM-A5/,"Galaxy A5x"],[/^SM-A3/,"Galaxy A3x"],[/^SM-X/,"Galaxy Tab"]],Vn="",ui=(async()=>{var t;let e=navigator.userAgentData;if(!e||!/Android/.test(ve))return"";try{let n=((t=(await e.getHighEntropyValues(["model"])).model)!=null?t:"").trim();if(!n||n==="K")return"";let r=di.find(([o])=>o.test(n));Vn=r?`${r[1]} (${n})`:/^SM-/.test(n)?`Galaxy ${n}`:n}catch{}return Vn})();function pi(e){return/iPhone/.test(ve)?"iPhone":ts?"iPad":/Android/.test(ve)?Vn||(e==="tablet"?_("Android tablet"):_("Android phone")):/CrOS/.test(ve)?"Chromebook":/Mac OS X/.test(ve)?"Mac":/Windows/.test(ve)?_("Windows PC"):/Linux/.test(ve)?_("Linux PC"):Kt(e)}var Zo=e=>e==="mobile"?_("Mobile"):Kt(e),Ht=e=>e==="phone"||e==="tablet"?"mobile":e,es=e=>e!=="mobile"?e:Ot()==="tablet"?"tablet":"phone";function Bt(){let e=pe();if(!(!e||e.locked)){if(!e.can_add)return ke(ze(e.person.device_limit,"You have reached your limit of %s device","You have reached your limit of %s devices"),!0);xt()||ge(fi)}}function fi(){let e=pe(),t=e.person,n=["computer","mobile","router","other"].filter(d=>e.kinds.some(v=>Ht(v)===d)),r=n.includes(Ht(Ot()))?Ht(Ot()):n[0],o=!1,i=new Set(t.devices.map(d=>d.name.toLowerCase())),l=d=>{let v=d===Ht(Ot())?pi(es(d)):Kt(d==="mobile"?"phone":d);if(!i.has(v.toLowerCase()))return v;for(let a=2;a<20;a++)if(!i.has(`${v} ${a}`.toLowerCase()))return`${v} ${a}`;return v},m=s("div",{class:"kinds",role:"radiogroup","aria-label":_("What is it?")});m.style.setProperty("--n",String(n.length));let g=n.map(d=>{let v=s("button",{type:"button",class:"kind",role:"radio","aria-label":Zo(d),onclick:()=>O(d)},s("span",{class:"kind-tile"},Q(d,"blue")),s("span",{class:"kind-lbl"},Zo(d)));return m.appendChild(v),v}),f=s("input",{type:"text",maxlength:48,required:!0,"aria-label":_("Name"),autocomplete:"off"}),E=s("button",{class:"go ready",type:"submit","aria-label":_("Create connection")},W("arrow")),x=s("p",{class:"hint bad-t",hidden:!0}),b=d=>{if(!x.hidden)return ee(x,d);x.textContent=d,x.hidden=!1,$(x,[{opacity:0,transform:"translateY(-4px)"},{opacity:1,transform:"none"}],{duration:220,easing:j})};f.value=l(r),f.addEventListener("input",()=>{o=!0,E.classList.toggle("ready",!!f.value.trim()),x.hidden=!0}),ui.then(()=>{!o&&r===Ht(Ot())&&(f.value=l(r))});function O(d){r=d,g.forEach((v,a)=>{let h=n[a]===d;v.classList.toggle("on",h),v.setAttribute("aria-checked",String(h))}),o||(f.value=l(d),E.classList.add("ready"))}O(r);let H=s("form",{class:"field",autocomplete:"off"},f,E);H.addEventListener("submit",d=>{d.preventDefault();let v=f.value.trim();if(v){if(i.has(v.toLowerCase()))return b(_("You already have a device with this name."));Ze(E,async()=>{try{let a=await fe("devices",{name:v,kind:es(r)});Me(a.state),_e({pop:a.id});let h=a.state.person.devices.find(p=>p.id===a.id);await gn(h,a.config)}catch(a){if(a instanceof Ke&&a.httpsUrl)return $t(a.httpsUrl);b(a.message)}})}});let P=s("button",{type:"button",class:"btn soft block",onclick:()=>ln(hi)},W("qr"),s("span",{},_("Add it from the device"))),R=t.device_limit-t.devices.length,D=s("div",{class:"view"},Ee(_("Add a device")),Ge(N(N_(t.device_limit,"%s of %s slot free","%s of %s slots free"),we(R),we(t.device_limit))),m,Ve(_("Phones and tablets get a smaller packet size that suits mobile networks.")),H,x,s("div",{class:"or"},_("OR")),P);return D.querySelector(".hint").classList.add("kinds-note"),{el:D,label:_("Add a device")}}function hi(){let e=Br(lt());return{el:s("div",{class:"view"},Ee(_("Open on the device"),{back:!0}),Ge(_("Point its camera at the code: your page opens there with this device ready to add.")),Lt(e,!0),pt(e)),label:_("Open on the device")}}function ns(e){let t=s("button",{type:"button",class:`btn ${e.cls}`,onclick:r=>Ze(r.currentTarget,e.run)},s("span",{},e.action));return{el:s("div",{class:"view"},s("div",{class:"ask"},Q(e.icon,e.tone,"gi xl"),s("h3",{},e.title),s("p",{},e.text),s("div",{class:"btnrow"},s("button",{type:"button",class:"btn soft",onclick:()=>me()},_("Cancel")),t))),label:e.title,asks:!0}}function rs(e){ge(()=>{let t=s("input",{type:"text",maxlength:48,"aria-label":_("Device name"),autocomplete:"off"});t.value=e.name;let n=s("button",{class:"go",type:"submit","aria-label":_("Save")},W("check"));t.addEventListener("input",()=>n.classList.toggle("ready",!!t.value.trim()&&t.value.trim()!==e.name));let r=s("form",{class:"field",autocomplete:"off"},t,n);r.addEventListener("submit",i=>{i.preventDefault();let l=t.value.trim();!l||l===e.name||Ze(n,async()=>{try{let m=await fe(`devices/${e.id}`,{action:"rename",name:l});Me(m.state),tt(()=>{_e(),ke(_("Renamed"))}),me()}catch(m){ke(m.message,!0)}})}),setTimeout(()=>t.select(),60);let o=N(_("Rename %s"),e.name);return{el:s("div",{class:"view"},Ee(o),r),label:o}})}function Yn(e){var n;if(xt())return;let t=((n=pe())==null?void 0:n.here)===e.id;ge(()=>ns({icon:"refresh",tone:"orange",title:N(_("Reconnect %s?"),e.name),text:t?_("It gets new keys. This device is connected through its current settings: it disconnects a few seconds after you confirm. Add the new ones that open next."):_("It gets new keys and its current settings stop working. Set it up again with the new ones that open next."),action:_("Reconnect"),cls:"accent",run:async()=>{var r;try{let o=await fe(`devices/${e.id}`,{action:"reconnect"});Me(o.state),_e(),await gn((r=o.state.person.devices.find(i=>i.id===e.id))!=null?r:{...e,handshake:0},o.config)}catch(o){ke(o.message,!0)}}}))}function os(e){ge(()=>ns({icon:"trash",tone:"red",title:N(_("Remove %s?"),e.name),text:_("Its connection stops working at once. You can add it again later."),action:_("Remove"),cls:"red",run:async()=>{try{let t=await fe(`devices/${e.id}`,{action:"delete"});Me(t.state),tt(()=>{let n=document.querySelector(`.dev[data-id="${CSS.escape(e.id)}"]`),r=()=>{_e(),ke(_("Device removed"))};if(!n)return r();$(n,[{opacity:1,transform:"none",filter:"none"},{opacity:0,transform:"scale(.9)",filter:"blur(6px)"}],{duration:220,easing:Z,fill:"forwards"}).onfinish=r}),me()}catch(t){ke(t.message,!0)}}}))}var jn=(e,t)=>e.access!=="internet"&&e.state==="active"&&!t.disabled;function mi(e,t){return e.disabled?["",_("Disabled")]:e.config_stale&&e.handshake?["warn-t",_("Settings changed")]:e.online&&t.state==="quota"?["warn-t",_("Connected, no data left")]:e.online&&t.state==="hours"?["warn-t",_("Connected, outside your hours")]:e.online?["ok-t",_("Connected")]:e.handshake?["",N(_("Last connected %s"),wr(e.handshake,ct()))]:["warn-t",_("Not set up yet")]}function gi(e,t){return[...jn(t.person,e)?[{label:_("Copy IP address"),icon:"copy",run:()=>he(e.address,_("IP address copied"))},...e.hostname?[{label:_("Copy local address"),icon:"home",run:()=>he(e.hostname,_("Address copied"))}]:[],null]:[],...e.disabled?[]:[{label:_("Rename"),icon:"edit",run:()=>rs(e)},{label:_("Reconnect"),icon:"refresh",tone:"warn",run:()=>Yn(e)},{label:_("Remove"),icon:"trash",tone:"bad",run:()=>os(e)}]]}function vi(e){return e===0?_("Today"):e===1?_("Yesterday"):Se(it(Ne(),-e)).toLocaleDateString(Ce(),{weekday:"short",day:"numeric",month:"short"})}function yi(e,t){let n=So(e.spark),r=s("span",{class:"use-lbl"},_("Last 7 days")),o=hn(e.id);o.set(n);let i;if(t)i=s("button",{type:"button",class:"upd-pill","aria-label":_("Update the connection"),title:_("Its settings changed: update the connection"),onclick:()=>Yn(e)},W("refresh"),s("span",{},_("Update")));else{let l=fn(e.spark,"bars-week",34);i=l.el,l.cols.forEach((m,g)=>{let f=e.spark.length-1-g;m.addEventListener("pointerenter",()=>{Pe(r,vi(f)),o.set(e.spark[g])}),m.addEventListener("pointerleave",()=>{Pe(r,_("Last 7 days")),o.set(n)})})}return s("div",{class:"dev-use"},s("div",{class:"use-txt"},r,s("span",{class:"use-val"},o.el)),i)}function bi(e,t){let n=t.person,r=!!t.locked,o=t.here===e.id,[i,l]=o?["here-t",_("This device")]:mi(e,n),m=!e.handshake&&!e.disabled,g=e.config_stale&&!m&&!r&&!e.disabled,f=!o&&e.handshake&&!e.online&&!e.disabled&&!e.config_stale?new Date(e.handshake*1e3).toLocaleString(Ce()):g?_("Settings changed, update needed"):l,E=gi(e,t),x=r||!E.length?null:s("button",{type:"button",class:"knob more","aria-label":N(_("%s options"),e.name),"aria-haspopup":"menu","aria-expanded":"false"},W("more"));return x==null||x.addEventListener("click",()=>on(x,E)),s("article",{class:`dev${o?" is-here":""}${e.disabled?" off":""}`,"data-id":e.id},s("div",{class:"dev-top"},Q(e.kind,o?"blue":"grey"),s("div",{class:"dev-id"},s("span",{class:"dev-name","data-t":`${e.id}:name`},e.name),s("span",{class:`dev-stat ${i}`,title:f,"data-t":`${e.id}:stat`},l)),x),m&&r?null:m?s("button",{type:"button",class:"btn tint block setup-btn","aria-label":N(_("Set up %s"),e.name),onclick:b=>mn(e,b.currentTarget)},W("qr"),s("span",{},_("Connect"))):yi(e,g))}var xi=e=>s("div",{class:"dev first","data-id":"first"},Q("plus","blue"),s("b",{},_("Add your first device")),s("p",{},_("Two steps, about a minute: get the app, then add the connection.")),s("button",{type:"button",class:"btn accent block",onclick:Bt},W("plus"),s("span",{},e?_("Add this phone"):_("Add this device")))),wi=()=>s("button",{type:"button",class:"dev add","data-id":"add",onclick:Bt},Q("plus"),s("span",{},_("Add device")));function ss(){return s("section",{class:"devices",id:"devices","aria-label":_("Your devices")},s("div",{class:"sec-head"},s("h2",{},_("Your devices")),s("span",{class:"aside num"})),s("div",{class:"dgrid"}),s("p",{class:"note-s limit",hidden:!0}))}function is(e,t,n={}){let r=t.person,o=e.querySelector(".dgrid"),i=o.childElementCount>0,l=new Map([...o.querySelectorAll("[data-id]")].map(D=>[D.dataset.id,D.getBoundingClientRect()])),m=Zt(o),f=qt(r.devices).sort((D,d)=>+(d.id===t.here)-+(D.id===t.here)).map(D=>bi(D,t)),E=t.locked?0:Math.max(0,r.device_limit-r.devices.length),x=matchMedia("(max-width: 959px)").matches||/Android|iPhone|iPad/.test(navigator.userAgent);!r.devices.length&&E?f.push(xi(x)):t.can_add&&!t.locked&&f.push(wi()),o.classList.toggle("empty",!r.devices.length),o.replaceChildren(...f);for(let D of f){let d=l.get(D.dataset.id),v=D.getBoundingClientRect();D.dataset.id===n.pop?$(D,[{opacity:0,transform:"scale(.9)",filter:"blur(6px)"},{opacity:1,transform:"none",filter:"none"}],{duration:Te.duration,easing:Te.easing}):d&&(d.left!==v.left||d.top!==v.top)?$(D,[{transform:`translate(${d.left-v.left}px, ${d.top-v.top}px)`},{transform:"none"}],{duration:q.duration,easing:q.easing}):!d&&i&&$(D,[{opacity:0,transform:"scale(.9)",filter:"blur(6px)"},{opacity:getComputedStyle(D).opacity,transform:"none",filter:"none"}],{duration:q.duration,delay:60,easing:q.easing,fill:"backwards"}),D.dataset.id===n.flash&&D.animate([{boxShadow:"inset 0 0 0 1.5px var(--ok)"},{boxShadow:"inset 0 0 0 1.5px transparent"}],{duration:1800,easing:"ease-out"})}i&&en(o,m);let b=e.querySelector(".sec-head .aside"),O=N(_("%s of %s"),we(r.devices.length),we(r.device_limit));i?ee(b,O):b.textContent=O,b.classList.toggle("warn-t",r.devices.length>r.device_limit);let H=e.querySelector(".limit"),P=H.hidden,R=t.can_add||!!t.locked;if(H.textContent=ze(r.device_limit,"You have reached your limit of %s device. Remove one to add another.","You have reached your limit of %s devices. Remove one to add another."),H.getAnimations().forEach(D=>D.cancel()),i&&!P&&R){let D=$(H,[{opacity:1,filter:"none"},{opacity:0,filter:"blur(4px)"}],{duration:200,easing:Z,fill:"forwards"});D.onfinish=()=>{H.hidden=!0,D.cancel()}}else H.hidden=R,i&&P&&!R&&$(H,[{opacity:0,transform:"translateY(6px)",filter:"blur(4px)"},{opacity:1,transform:"none",filter:"none"}],{duration:420,easing:j})}var Qn=e=>s("p",{class:"desc"},e),yn=(e,t)=>`${(e/t*100).toFixed(2)}%`,as=e=>Se(e).toLocaleDateString(Ce(),{day:"numeric",month:"short"});function Mi(e){let t=(n,r,o,i)=>s("div",{class:`reach-tile${n?"":" off"}`},Q(r,n?"blue":"grey","gi rt-ic"),s("b",{},o),s("span",{class:"rt-sub"},n?i:_("Not included")),s("span",{class:"rt-mark","aria-label":n?_("Included"):_("Not included")},W(n?"check":"minus")));return s("div",{class:"reach2"},t(e!=="internet","home",_("Home network"),_("Devices at home")),t(e!=="lan","globe",_("Internet"),_("Through the router")))}function ki(e,t){let n=qt(e.devices).filter(m=>m.hostname&&jn(e,m));if(!n.length)return[];let r=n[0].hostname,o=r.indexOf("."),i=o>0?r.slice(o):"",l=s("span",{class:"mono"},`${_("name")}${i}`);return[s("span",{class:"lbl-s"},...st(t?_("Devices at home and on this VPN reach yours as %s"):_("Other devices at home reach yours as %s"),l)),s("div",{class:"names"},n.map(m=>{let g=m.hostname.indexOf(".");return s("button",{type:"button",class:"namechip",title:m.name,"aria-label":N(_("Copy %s"),m.hostname),onclick:f=>he(m.hostname,_("Address copied"),f.currentTarget)},s("span",{},g>0?[m.hostname.slice(0,g),s("span",{class:"faint"},m.hostname.slice(g))]:m.hostname),W("copy"))}))]}function Ci(e){let t=2*Math.PI*6,n=e>=100?" bad":e>=90?" warn":"";return Be(``)}function _i(e){let t=s("i",{class:e>=100?"bad":e>=90?"warn":""});return t.style.width=`${e.toFixed(1)}%`,s("div",{class:"meter"},t)}function Ei(e,t,n){let{days:r,day:o}=Eo(Ne()),i=Array.from({length:o},(H,P)=>{var R,D;return(D=(R=e.month_days)==null?void 0:R[P])!=null?D:[0,0]}),l=H=>as(`${Ne().slice(0,8)}${String(H).padStart(2,"0")}`),m=hn("m"),g=e.quota_limit?N(_("%s left"),Re(Math.max(0,e.quota_limit-t))):_("No limit"),f=s("span",{class:"num","data-t":"m-left"},g),E=(H,P)=>{m.set(H),Pe(f,P?l(P):g),f.classList.toggle("bad-t",!P&&e.state==="quota")};E(e.month);let x=fn(i,"bars-month",64,r-o);x.cols.forEach((H,P)=>{H.addEventListener("pointerenter",()=>E(i[P],P+1)),H.addEventListener("pointerleave",()=>E(e.month))});let b=s("span",{class:"td"},_("Today"));b.style.left=yn(o-.5,r);let O=s("div",{class:"month-axis"},s("span",{class:o<=4?"hide":""},l(1)),b,s("span",{class:o>=r-3?"hide":""},l(r)));return s("div",{class:"month"},x.el,O,s("div",{class:"month-read"},m.el,f),e.quota_limit?_i(n):null)}function Ti(e,t){let n=l=>Se(l).toLocaleDateString(Ce(),{weekday:"short",day:"numeric",month:"short"}),r=Array.from({length:7},(l,m)=>new Date(2024,0,1+m,12).toLocaleDateString(Ce(),{weekday:"narrow"})),o=ko(Ne(),e.expires),i=o?s("div",{class:"cal","aria-hidden":"true"},s("div",{class:"cal-h"},r.map(l=>s("span",{},l))),s("div",{class:"cal-g"},o.map((l,m)=>{let g=s("i",{class:l.kind,title:n(l.day)});return g.style.setProperty("--i",String(m)),g}))):null;return s("div",{class:`until${wt(e,t)?" soon":""}`},s("div",{class:"until-num"},s("b",{class:"num"},we(t)),s("span",{},N_(t,"day left","days left")),s("span",{class:"until-sub"},N(_("Ends %s"),n(e.expires)))),i)}function Li(e,t){let n=-new Date().getTimezoneOffset(),r=un(e,t,n);if(!r)return null;let o=_o(ct(),r.yours?n:t!=null?t:n),i=Co(r),l=i.some(([f,E])=>o>=f&&os("span",{},f))))}function Ai(e,t=1){let n=e.person,r=n.quota_used||n.month[0]+n.month[1],o=n.quota_limit?Math.min(100,r/n.quota_limit*100):0,i=n.quota_period==="total"&&!!n.quota_gb,l=Ut(n.expires,Ne()),m=n.expires?s("span",{class:"until-val"},s("span",{class:"num","data-t":"until-date"},as(n.expires)),l!=null?s("span",{class:`num ${l<0?"bad-t":wt(n,l)?"warn-t":"ok-t"}`,"data-t":"until-left"},l>=0?ze(l,"%s day","%s days"):_("ended")):null):s("span",{},_("No end date")),g=[n.expires?l!=null&&l<0?Qn(N(_("It ended on %s."),zt(n.expires))):Ti(n,l!=null?l:0):null,n.hours?Li(n.hours,e.tz_offset):null];return Ye([{icon:Q(n.access==="internet"?"globe":n.access==="lan"?"home":"shield"),title:kr(n.access),body:[Mi(n.access),...ki(n,!!e.server.device_mesh)]},{icon:Q("chart"),title:i?_("Data used"):_("Data this month"),val:s("span",{class:"data-val"},n.quota_limit?Ci(o):null,s("span",{class:"num","data-t":"data-val"},`${Re(r)} ${n.quota_limit?`/ ${Re(n.quota_limit)}`:`· ${_("no limit")}`}`)),valHide:!0,body:[i?Qn(N(_("%s of %s in total."),Re(r),Re(n.quota_limit))):Ei(n,r,o),Qn(n.quota_limit?i?_("A total for your whole access, it does not reset."):_("Resets on the 1st."):_("No data limit. The count starts again on the 1st."))]},{icon:Q("calendar"),title:_("Access until"),val:m,valHide:!!n.expires&&(l!=null?l:0)>=0,body:g}],{open:t})}function ls(){return s("section",{class:"access",id:"access","aria-label":_("Your access")},s("div",{class:"sec-head"},s("h2",{},_("Your access"))),s("div",{class:"acc-slot"}))}var vn=null;function cs(e,t){let n=Ai(t,vn?vn.openIndex():1),r=Zt(e);e.querySelector(".acc-slot").replaceChildren(n.el),vn&&en(e,r),vn=n}yr(document.documentElement);var bn=document.getElementById("app"),Oe=null,Jn=!1,xn=()=>{};function ds(){let e=[...bn.querySelectorAll(".crumbs, .notice, .sec-head, .dgrid > *, .note-s:not([hidden]), .acc-slot .acc-row, .gone")].map(n=>({el:n,at:n.getBoundingClientRect()})).sort((n,r)=>Math.round(n.at.top)-Math.round(r.at.top)||n.at.left-r.at.left).map(n=>n.el),t=e.map(n=>getComputedStyle(n).opacity);e.forEach((n,r)=>$(n,[{opacity:0,transform:"translateY(10px)",filter:"blur(4px)"},{opacity:t[r],transform:"none",filter:"none"}],{duration:520,delay:60+r*40,easing:j,fill:"backwards"})),bn.querySelectorAll(".logo .sun").forEach(n=>$(n,[{transform:"translateY(7px)"},{transform:"none"}],{duration:900,delay:150,easing:j,fill:"backwards"})),Jn=!0}function Xn(e={}){let t=pe();if(!t)return;if(xn=Xn,t.person.state==="paused"){document.title=Je();let[r,o,i]=qn(t.person);return Zn(r,o,i,!1,"orange")}let n=zn(bn);Un(!1),Kn(),document.title=Je(),Oe||(Oe={notice:s("div",{class:"notice-slot"}),devices:ss(),access:ls()},We(n,Oe.notice,s("div",{class:"cols"},Oe.devices,Oe.access))),We(Oe.notice,Lo(t.person)),is(Oe.devices,t,e),cs(Oe.access,t),Jn||ds()}Ur(Xn);function Zn(e,t,n,r=!1,o="grey"){Oe=null;let i=zn(bn);Un(!0),Kn(r,!0),We(i,s("div",{class:"gone"},Q(e,o),s("h1",{},t),s("p",{},n))),Jn||ds()}function er(){Me(null),me(!0),xn=er,Zn("key",_("This link no longer works"),_("Ask for a new one."),!0)}function us(e){xn=()=>us(e),Zn("server",_("The page could not load"),e)}function ps(){let e=pe(),t=Or(location.hash),n=Rr(location.hash);if(!e||!t&&!n)return;if(history.replaceState(null,"",location.pathname+location.search),n)return Bt();let r=e.person.devices.find(o=>o.id===t);r&&!r.handshake&&!r.disabled&&!e.locked&&mn(r)}addEventListener("hashchange",ps);async function Si(){try{Me(await fe("state")),!He()&&!At()&&Xn(),ps()}catch(e){jt(e)?er():pe()||us(e.message)}}fr(()=>{De(!0),Oe=null,xn()});document.addEventListener("keydown",e=>{e.key==="Escape"&&(At()?De(!0):He()&&me(!0))});!at||!Ir?er():Si();})(); diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/util.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/util.uc index 59c6b02..8b87517 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/util.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/util.uc @@ -5,7 +5,7 @@ import { open, readfile, writefile, rename, mkdir, stat, unlink, popen, lsdir } from 'fs'; import { _ } from 'dawnline.i18n'; -export const VERSION = '0.11.0'; +export const VERSION = '0.12.0'; /** GitHub repository with Dawnline releases (updates and the installer). */ export const REPO = 'tickcount/luci-app-dawnline'; export const RUN_DIR = '/var/run/dawnline'; diff --git a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/view.uc b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/view.uc index a697fa2..e97b87f 100644 --- a/package/luci-app-dawnline/root/usr/share/ucode/dawnline/view.uc +++ b/package/luci-app-dawnline/root/usr/share/ucode/dawnline/view.uc @@ -6,17 +6,17 @@ import * as live from 'dawnline.live'; import * as awg from 'dawnline.awg'; import { day_key_ago, month_key } from 'dawnline.util'; -/** Daily totals (rx+tx) for the last `n` days, oldest first. */ +/** Each day's [rx, tx] for the last `n` days, oldest first: the charts draw what came and what went apart. */ export function spark(rec, n) { let out = []; for (let i = n - 1; i >= 0; i--) { let v = rec?.days?.[day_key_ago(i)]; - push(out, v ? v[0] + v[1] : 0); + push(out, v ? [ v[0], v[1] ] : [ 0, 0 ]); } return out; }; -/** Daily totals (rx+tx) from the 1st of this month to today, oldest first (the portal's month chart). */ +/** Each day's [rx, tx] from the 1st of this month to today, oldest first (the portal's month chart). */ export function month_days(rec) { return spark(rec, +substr(day_key_ago(0), 8, 2)); }; diff --git a/tests/ucode/view.test.uc b/tests/ucode/view.test.uc index b868375..1fe76c2 100644 --- a/tests/ucode/view.test.uc +++ b/tests/ucode/view.test.uc @@ -31,8 +31,9 @@ test('month_days', () => { days[day_key_ago(n)] = [ 100, 100 ]; let s = view.month_days({ days }); eq(length(s), n, 'one bar a day, from the 1st to today'); - eq(s[n - 1], 12, 'today last, received and sent together'); - eq(s[0], n > 1 ? 3 : 12, 'the 1st first'); + eq(s[n - 1], [ 5, 7 ], 'today last, received and sent apart'); + eq(s[0], n > 1 ? [ 1, 2 ] : [ 5, 7 ], 'the 1st first'); eq(length(view.month_days(null)), n, 'no usage yet: zeros'); - eq(view.month_days(null)[0], 0, 'a day without traffic is zero'); + eq(view.month_days(null)[0], [ 0, 0 ], 'a day without traffic is zero both ways'); + eq(view.spark({ days }, 1), [ [ 5, 7 ] ], 'the week the same way, today last'); }); diff --git a/web/package-lock.json b/web/package-lock.json index 0aaaae5..2bf8cb7 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -1,12 +1,12 @@ { "name": "dawnline-web", - "version": "0.11.0", + "version": "0.12.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "dawnline-web", - "version": "0.11.0", + "version": "0.12.0", "license": "MIT", "dependencies": { "qrcode-generator": "1.4.4" diff --git a/web/package.json b/web/package.json index 8887b7d..96237b4 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "dawnline-web", - "version": "0.11.0", + "version": "0.12.0", "private": true, "license": "MIT", "type": "module", diff --git a/web/src/admin/device.ts b/web/src/admin/device.ts index 2d9d28f..a6719e6 100644 --- a/web/src/admin/device.ts +++ b/web/src/admin/device.ts @@ -177,7 +177,8 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) { E('span', { class: 'dl-sub' }, `${p.name} · ${kindLabel(d.kind)}`), ]), ]); - const week = d.spark.reduce((a, b) => a + b, 0); + const days = d.spark.map(([rx, tx]) => rx + tx); + const week = days.reduce((a, b) => a + b, 0); dom.content( stats, E('div', { class: 'dl-dstats' }, [ @@ -193,7 +194,7 @@ export async function openDevice(person: Person, dev: Device, o: DeviceOpts) { E('div', { class: 'dl-dstats-cell' }, [ E('span', { class: 'dl-metric-label' }, _('Last 7 days')), E('b', {}, bytes(week)), - spark(d.spark, 120, 22, today), + spark(days, 120, 22, today), ]), ]), ); diff --git a/web/src/admin/pages/overview.ts b/web/src/admin/pages/overview.ts index d37f3ff..504dd31 100644 --- a/web/src/admin/pages/overview.ts +++ b/web/src/admin/pages/overview.ts @@ -306,7 +306,10 @@ export class ServerOverview { const st = this.st; const off = st.servers[0] ? !st.servers[0].enabled : false; const CAP = 12; - const today = (d: Device) => d.spark[d.spark.length - 1] ?? 0; + const today = (d: Device) => { + const [rx, tx] = d.spark[d.spark.length - 1] ?? [0, 0]; + return rx + tx; + }; const cityOf = (d: Device) => st.geo.points.find((g) => g.device === d.id && g.city)?.city; const home = (d: Device) => /^(10\.|192\.168\.|172\.(1[6-9]|2\d|3[01])\.)/.test(d.endpoint ?? ''); // Where a device is: its city, or "LAN" when it connects from the home network (the hover diff --git a/web/src/admin/pages/people.ts b/web/src/admin/pages/people.ts index c36b6de..a1972ba 100644 --- a/web/src/admin/pages/people.ts +++ b/web/src/admin/pages/people.ts @@ -600,7 +600,7 @@ export class PeoplePage { usageSide(p: Person, actions: HTMLElement): HTMLElement { const used = p.quota_used || p.month[0] + p.month[1]; const pct = p.quota_limit ? Math.min(100, (p.quota_used / p.quota_limit) * 100) : 0; - const today = p.devices.reduce((a, d) => a + (d.spark[d.spark.length - 1] ?? 0), 0); + const today = p.devices.reduce((a, d) => a + (d.spark[d.spark.length - 1] ?? [0, 0]).reduce((x, y) => x + y), 0); const r = p.rate?.[p.rate.length - 1]; const live = p.online && r && this.st.now - r[0] < 180; diff --git a/web/src/admin/styles/map.css b/web/src/admin/styles/map.css index 0775907..901393a 100644 --- a/web/src/admin/styles/map.css +++ b/web/src/admin/styles/map.css @@ -243,10 +243,16 @@ background: var(--dl-elevated); border: 1px solid var(--dl-line); box-shadow: var(--shadow-xl, 0 8px 16px -4px rgba(0,0,0,.4)); pointer-events: none; z-index: 3; } .dl-tip-title { font-weight: 500; } .dl-tip-float { position: fixed; z-index: 2000; color: var(--dl-fg); } -.dl-spark i:hover { opacity: 1; filter: brightness(1.25); } .dl-meter, .dl-slots { cursor: default; } .dl-axis { display: flex; justify-content: space-between; font-size: 12px; color: var(--dl-fg-faint); margin-top: 6px; } .dl-legend i.down { background: var(--dl-chart-1); } .dl-legend i.up { background: var(--dl-chart-2); } -.dl-spark { display: flex; align-items: flex-end; gap: 2px; flex: 0 0 auto; } +.dl-spark { display: flex; align-items: flex-end; flex: 0 0 auto; --dl-gap: 2px; } .dl-spark i { flex: 1; display: block; border-radius: 2px 2px 0 0; background: var(--dl-chart-1); opacity: .85; } .dl-spark i.zero { opacity: .22; } +.dl-spark > span:hover i:not(.zero) { opacity: 1; filter: brightness(1.25); } +/* A day's column in the daily charts (spark, a device card's bars, the last 30 days): the chart's full height and + half the gap on either side, so its tooltip answers above a short bar and between two bars. The outer columns + keep no outer half, so the bars stand where a plain gap would put them. */ +.dl-spark > span, .dl-dbars > span, .dl-bento-bars > span { flex: 1; min-width: 0; height: 100%; display: flex; align-items: flex-end; padding: 0 calc(var(--dl-gap) / 2); } +.dl-spark > span:first-child, .dl-dbars > span:first-child, .dl-bento-bars > span:first-child { padding-left: 0; } +.dl-spark > span:last-child, .dl-dbars > span:last-child, .dl-bento-bars > span:last-child { padding-right: 0; } diff --git a/web/src/admin/styles/overview.css b/web/src/admin/styles/overview.css index 35a0a8e..cdb7f11 100644 --- a/web/src/admin/styles/overview.css +++ b/web/src/admin/styles/overview.css @@ -25,11 +25,11 @@ .dl-dcard-trend { display: flex; align-items: flex-end; gap: 12px; min-width: 0; } .dl-dcard-trend > .dl-stack { flex: none; } .dl-dcard-trend b { font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; } -.dl-dbars { flex: 1; min-width: 0; height: 32px; display: flex; align-items: flex-end; gap: 2px; } +.dl-dbars { flex: 1; min-width: 0; height: 32px; display: flex; align-items: flex-end; --dl-gap: 2px; } .dl-dbars i { flex: 1; min-width: 0; border-radius: 2px; background: var(--dl-chart-1); opacity: .55; } .dl-dbars i.zero { background: var(--dl-track); opacity: 1; } .dl-dbars i.hi { opacity: 1; } -.dl-dbars i:hover { opacity: 1; filter: brightness(1.2); } +.dl-dbars > span:hover i { opacity: 1; filter: brightness(1.2); } .dl-datechip { position: relative; display: inline-flex; } .dl-date-hidden { position: absolute !important; left: 0; bottom: 0; width: 1px !important; min-width: 0 !important; height: 1px !important; opacity: 0; pointer-events: none; border: 0 !important; padding: 0 !important; margin: 0 !important; } .dl-chipbtn .dl-icon { width: 13px; height: 13px; } @@ -147,10 +147,10 @@ .dl-meter i { width: 16px; height: 4px; border-radius: 2px; background: var(--dl-line); } .dl-meter i.on { background: var(--dl-accent); } .dl-bento-total { font-size: 16px; font-weight: 500; margin-left: 8px; } -.dl-bento-bars { display: flex; align-items: flex-end; gap: 3px; height: 54px; } +.dl-bento-bars { display: flex; align-items: flex-end; height: 54px; --dl-gap: 3px; } .dl-bento-bars i { flex: 1; min-width: 0; border-radius: 3px 3px 0 0; background: var(--dl-soft-hover); transition: background .15s; } .dl-bento-bars i.future { height: 4px; background: var(--dl-soft); } -.dl-bento-bars i:hover { background: var(--dl-fg-faint); } +.dl-bento-bars > span:hover i:not(.hi) { background: var(--dl-fg-faint); } .dl-bento-bars i.hi { background: var(--dl-accent); } @media (max-width: 700px) { .dl-addrbar { flex-wrap: wrap; } } @media (max-width: 900px) { .dl-bento { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } .dl-bento-tile.online { grid-column: span 2; } } diff --git a/web/src/admin/widgets/spark.ts b/web/src/admin/widgets/spark.ts index 157168c..a1bff92 100644 --- a/web/src/admin/widgets/spark.ts +++ b/web/src/admin/widgets/spark.ts @@ -15,8 +15,10 @@ export function spark(values: number[], width = 120, height = 26, today = isoDay const b = E('i'); b.style.height = `${Math.max(6, (v / max) * 100)}%`; if (!v) b.classList.add('zero'); + // The day's column carries the tooltip: it answers above a short bar and between two bars. + const col = E('span', {}, [b]); const back = values.length - 1 - i; - attachTip(b, () => [ + attachTip(col, () => [ E( 'div', { class: 'dl-tip-title' }, @@ -28,7 +30,7 @@ export function spark(values: number[], width = 120, height = 26, today = isoDay ), E('div', { class: 'dl-muted' }, bytes(v)), ]); - el.appendChild(b); + el.appendChild(col); }); return el; } diff --git a/web/src/admin/widgets/tiles.ts b/web/src/admin/widgets/tiles.ts index 05ae7ab..83f3e9b 100644 --- a/web/src/admin/widgets/tiles.ts +++ b/web/src/admin/widgets/tiles.ts @@ -75,12 +75,14 @@ export function daysTile(series: DayUsage[], note: string): HTMLElement { days.map((d, i) => { const v = vals[i]; const bar = E('i', { class: i === days.length - 1 ? 'hi' : '', style: `height:${Math.max(4, (v / max) * 100)}%` }); - attachTip(bar, () => [ + // The day's column carries the tooltip: it answers above a short bar and between two bars. + const col = E('span', {}, [bar]); + attachTip(col, () => [ E('div', { class: 'dl-tip-title' }, i === days.length - 1 ? `${_('Today')} · ${dayLabel(d.day)}` : dayLabel(d.day)), E('div', {}, bytes(v)), E('div', { class: 'dl-muted dl-mono' }, `↓ ${bytes(d.tx)} ↑ ${bytes(d.rx)}`), ]); - return bar; + return col; }), ); return E('div', { class: 'dl-bento-tile month' }, [ @@ -108,11 +110,12 @@ export function dayBars(series: DayUsage[]): HTMLElement { days.map((x, i) => { const bar = E('i', { class: `${vals[i] ? '' : 'zero'}${i === days.length - 1 ? ' hi' : ''}` }); bar.style.height = `${Math.max(8, (vals[i] / max) * 100)}%`; - attachTip(bar, () => [ + const col = E('span', {}, [bar]); + attachTip(col, () => [ E('div', { class: 'dl-tip-title' }, i === days.length - 1 ? `${_('Today')} · ${dayLabel(x.day)}` : dayLabel(x.day)), E('div', {}, bytes(vals[i])), ]); - return bar; + return col; }), ); } diff --git a/web/src/portal/demo/data.ts b/web/src/portal/demo/data.ts index bf16ebf..0105dc1 100644 --- a/web/src/portal/demo/data.ts +++ b/web/src/portal/demo/data.ts @@ -4,7 +4,7 @@ // scenario picker is picker.ts). import type { State } from '../state'; -import type { Device, Kind, Person } from '../../shared/types'; +import type { Device, Kind, Pair, Person } from '../../shared/types'; export const GB = 2 ** 30; const HOUR = 3600; @@ -109,8 +109,11 @@ const label = (s: string) => /** How busy each day of the week is, Monday first. */ const WEEK = [0.9, 1.15, 0.8, 1.05, 1.3, 0.75, 1.1]; -/** The month so far, day by day, adding up to `total` bytes (today only partly gone). */ -export function monthDays(total: number, t: number): number[] { +/** A day split into what the devices sent and received: about a tenth sent, more on a day something backed up. */ +const split = (v: number, sent: number): Pair => [Math.round(v * sent), v - Math.round(v * sent)]; + +/** The month so far, day by day as [rx, tx], adding up to `total` bytes (today only partly gone). */ +export function monthDays(total: number, t: number): Pair[] { const d = new Date(t * 1000); const days = d.getDate(); const w = Array.from({ length: days }, (_, i) => { @@ -118,7 +121,7 @@ export function monthDays(total: number, t: number): number[] { return WEEK[wd] * (i === days - 1 ? 0.45 : 1) * (0.85 + ((i * 37) % 11) / 30); }); const sum = w.reduce((a, b) => a + b, 0); - return w.map((x) => Math.round((x / sum) * total)); + return w.map((x, i) => split(Math.round((x / sum) * total), i % 11 === 4 ? 0.4 : 0.08 + ((i * 17) % 9) / 100)); } /** A window of the day that leaves `t` out (the visitor's hours): the hours scenario is outside it. */ @@ -149,7 +152,9 @@ function device(d: DemoDevice, t: number, st: Person['state']): Device { active: true, month: [Math.round(month / 8), Math.round((month * 7) / 8)], total: [Math.round(month / 4), Math.round((month * 7) / 4)], - spark: [0.8, 1.3, 0.6, 1.1, 1.6, 0.9, 1].map((f) => (hs ? Math.round(((month / 4) * f) / 7) : 0)), + spark: [0.8, 1.3, 0.6, 1.1, 1.6, 0.9, 1].map((f, i) => + split(hs ? Math.round(((month / 4) * f) / 7) : 0, [0.1, 0.14, 0.08, 0.35, 0.11, 0.09, 0.12][i]), + ), hostname: `${label(d.name)}.user.lan`, browser_key: false, config_stale: d.stale, diff --git a/web/src/portal/flows/setup-parts.ts b/web/src/portal/flows/setup-parts.ts index c9f2420..e80c8b3 100644 --- a/web/src/portal/flows/setup-parts.ts +++ b/web/src/portal/flows/setup-parts.ts @@ -24,7 +24,7 @@ import { type Store, } from '../setup'; import { accordion } from '../ui/accordion'; -import { copy, download, sendFile, shareFile } from '../ui/feedback'; +import { copy, download, sendFile, shareFile, swapIcon } from '../ui/feedback'; import { glass } from '../ui/glass'; import { menuLine, morphText, setText } from '../ui/morph'; import { hint } from '../ui/sheet'; @@ -206,7 +206,8 @@ function confLine(line: string, reveal: boolean): Node { const m = /^(\s*[A-Za-z0-9]+\s*=)\s*(.*)$/.exec(line); if (!m) return document.createTextNode(line); const secret = /^(\s*)(PrivateKey|PresharedKey)\b/.test(line); - return h('span', {}, h('span', { class: 'k' }, m[1]), ' ', secret && !reveal ? h('span', { class: 'mask' }, '••••••••••••••••') : m[2]); + const value = !secret ? m[2] : reveal ? h('span', { class: 'secret' }, m[2]) : h('span', { class: 'mask' }, '••••••••••••••••'); + return h('span', {}, h('span', { class: 'k' }, m[1]), ' ', value); } /** The .conf for a router: a file card to download (or share), and the configuration folded, its keys hidden. */ @@ -217,6 +218,8 @@ export function filePane(cfg: ClientConfig): HTMLElement { pre.replaceChildren(...cfg.conf.split('\n').flatMap((l, i) => (i ? ['\n', confLine(l, reveal)] : [confLine(l, reveal)]))); paint(); const share = !!shareFile(cfg.filename, cfg.conf); + let icon = ic('key'); + const label = h('span', {}, _('Show key')); const eye = h( 'button', { @@ -224,10 +227,11 @@ export function filePane(cfg: ClientConfig): HTMLElement { class: 'btn soft sm', onclick: () => { reveal = !reveal; - eye.replaceChildren(ic(reveal ? 'x' : 'key'), h('span', {}, reveal ? _('Hide key') : _('Show key'))); + icon = swapIcon(icon, reveal ? 'x' : 'key'); + morphText(label, reveal ? _('Hide key') : _('Show key')); paint(); // A key shown comes into focus out of a blur; hidden again, the mask fades back. - pre.querySelectorAll('.mask, .k').forEach((x) => + pre.querySelectorAll('.mask, .secret').forEach((x) => play( x, [ @@ -239,8 +243,8 @@ export function filePane(cfg: ClientConfig): HTMLElement { ); }, }, - ic('key'), - h('span', {}, _('Show key')), + icon, + label, ); const cp = h( 'button', diff --git a/web/src/portal/i18n/portal.pot b/web/src/portal/i18n/portal.pot index 733ffb8..18cc529 100644 --- a/web/src/portal/i18n/portal.pot +++ b/web/src/portal/i18n/portal.pot @@ -109,10 +109,6 @@ msgid_plural "%s of %s slots free" msgstr[0] "" msgstr[1] "" -#: web/src/portal/page/access.ts -msgid "%s on %s" -msgstr "" - #: web/src/portal/page/devices.ts msgid "%s options" msgstr "" @@ -121,10 +117,6 @@ msgstr "" msgid "%s this month" msgstr "" -#: web/src/portal/page/access.ts -msgid "%s used" -msgstr "" - #: web/src/portal/page/notices.ts msgid "%s your time" msgstr "" @@ -494,6 +486,10 @@ msgstr "" msgid "Download the key" msgstr "" +#: web/src/portal/ui/bars.ts +msgid "Downloaded" +msgstr "" + #: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc msgid "End date must be YYYY-MM-DD." msgstr "" @@ -1208,6 +1204,10 @@ msgstr "" msgid "Update the connection" msgstr "" +#: web/src/portal/ui/bars.ts +msgid "Uploaded" +msgstr "" + #: web/src/portal/flows/wait.ts msgid "Waiting for the connection" msgstr "" diff --git a/web/src/portal/i18n/ru.po b/web/src/portal/i18n/ru.po index d1a6d8e..7605bb3 100644 --- a/web/src/portal/i18n/ru.po +++ b/web/src/portal/i18n/ru.po @@ -114,10 +114,6 @@ msgstr[0] "Свободно %s из %s места" msgstr[1] "Свободно %s из %s мест" msgstr[2] "Свободно %s из %s мест" -#: web/src/portal/page/access.ts -msgid "%s on %s" -msgstr "%s за %s" - #: web/src/portal/page/devices.ts msgid "%s options" msgstr "Действия с устройством %s" @@ -126,10 +122,6 @@ msgstr "Действия с устройством %s" msgid "%s this month" msgstr "%s в этом месяце" -#: web/src/portal/page/access.ts -msgid "%s used" -msgstr "%s использовано" - #: web/src/portal/page/notices.ts msgid "%s your time" msgstr "%s по вашему времени" @@ -499,6 +491,10 @@ msgstr "Скачать файл" msgid "Download the key" msgstr "Скачать ключ" +#: web/src/portal/ui/bars.ts +msgid "Downloaded" +msgstr "Получено" + #: package/luci-app-dawnline/root/usr/share/ucode/dawnline/core.uc msgid "End date must be YYYY-MM-DD." msgstr "Дата окончания должна быть в формате ГГГГ-ММ-ДД." @@ -1213,6 +1209,10 @@ msgstr "Обновить" msgid "Update the connection" msgstr "Обновить подключение" +#: web/src/portal/ui/bars.ts +msgid "Uploaded" +msgstr "Отправлено" + #: web/src/portal/flows/wait.ts msgid "Waiting for the connection" msgstr "Ждём подключения" diff --git a/web/src/portal/main.ts b/web/src/portal/main.ts index 7f129b2..7b4b3f7 100644 --- a/web/src/portal/main.ts +++ b/web/src/portal/main.ts @@ -33,7 +33,11 @@ let redraw: () => void = () => {}; /** The first paint comes in: the blocks rise one after the other, the sun rises behind its line. */ function intro() { - const els = [...app.querySelectorAll('.crumbs, .notice, .sec-head, .dgrid > *, .note-s:not([hidden]), .acc-slot .acc-row, .gone')]; + // In the order they stand on screen, top to bottom and then left to right: on a phone "Your access" comes before the devices. + const els = [...app.querySelectorAll('.crumbs, .notice, .sec-head, .dgrid > *, .note-s:not([hidden]), .acc-slot .acc-row, .gone')] + .map((el) => ({ el, at: el.getBoundingClientRect() })) + .sort((a, b) => Math.round(a.at.top) - Math.round(b.at.top) || a.at.left - b.at.left) + .map((x) => x.el); // Each block rises to its own opacity: a card the admin disabled is dimmed all the way, not at the end. const own = els.map((el) => getComputedStyle(el).opacity); els.forEach((el, i) => diff --git a/web/src/portal/page/access.ts b/web/src/portal/page/access.ts index a151eec..fbe024e 100644 --- a/web/src/portal/page/access.ts +++ b/web/src/portal/page/access.ts @@ -4,13 +4,14 @@ // the month day by day inside; and until when, as the days left over a // calendar of the weeks, with the admin's hours as a bar of the day. -import type { Person } from '../../shared/types'; +import type { Pair, Person } from '../../shared/types'; import { accessLabel, byDeviceState, bytes, date, daysLeft, endsSoon, parseDay } from '../../shared/format'; import { fill, fmt, locale, num, plural } from '../../shared/i18n'; import { h, ic, markup } from '../dom'; import { calendar, clockOf, hoursFor, minuteAt, monthOf, stretches } from '../days'; import { now, today, type State } from '../state'; import { accordion, type Accordion } from '../ui/accordion'; +import { bars, upDown } from '../ui/bars'; import { copy } from '../ui/feedback'; import { glass } from '../ui/glass'; import { morphChanged, setText, textsOf } from '../ui/morph'; @@ -93,34 +94,27 @@ function meter(pct: number): HTMLElement { return h('div', { class: 'meter' }, i); } -/** The month as one bar a day (today in blue, days to come faint), and the total under it. */ +/** The month a day at a time, down and up (today in blue, days to come flat), what came and went under it. */ function month(p: Person, used: number, pct: number): HTMLElement { const { days, day } = monthOf(today()); - const series = p.month_days ?? []; - const max = Math.max(1, ...series); + const series = Array.from({ length: day }, (_x, i): Pair => p.month_days?.[i] ?? [0, 0]); const short = (d: number) => dayMonth(`${today().slice(0, 8)}${String(d).padStart(2, '0')}`); - // The total, and a bar under the pointer in its place, at once: no morph while the pointer moves. - const total = h('b', { class: 'num', 'data-t': 'm-used' }, bytes(used)); - const read = h('span', { class: 'mread' }); - /** The month's total, or (`d`) one day's: the number in its sentence. */ - const say = (v: number, d?: number) => { - setText(total, bytes(v)); - read.replaceChildren(...(d ? fill(_('%s on %s'), total, short(d)) : fill(_('%s used'), total))); + // The month's down and up; a day under the pointer puts its own in their place and its date where "left" stands, + // at once: no morph while the pointer moves. + const read = upDown('m'); + const left = p.quota_limit ? fmt(_('%s left'), bytes(Math.max(0, p.quota_limit - used))) : _('No limit'); + const side = h('span', { class: 'num', 'data-t': 'm-left' }, left); + const say = (v: Pair, d?: number) => { + read.set(v); + setText(side, d ? short(d) : left); + side.classList.toggle('bad-t', !d && p.state === 'quota'); }; - say(used); - const bars = h('div', { class: 'mbars' }); - for (let i = 0; i < days; i++) { - if (i >= day) { - bars.appendChild(h('i', { class: 'future' })); - continue; - } - const v = series[i] ?? 0; - const b = h('i', { class: i === day - 1 ? 'today' : '' }); - b.style.height = `${Math.max(3, Math.round((v / max) * 64))}px`; - b.addEventListener('pointerenter', () => say(v, i + 1)); - b.addEventListener('pointerleave', () => say(used)); - bars.appendChild(b); - } + say(p.month); + const chart = bars(series, 'bars-month', 64, days - day); + chart.cols.forEach((col, i) => { + col.addEventListener('pointerenter', () => say(series[i], i + 1)); + col.addEventListener('pointerleave', () => say(p.month)); + }); // "Today" under its bar; the month's ends step aside when it comes close. const td = h('span', { class: 'td' }, _('Today')); td.style.left = pc(day - 0.5, days); @@ -131,23 +125,7 @@ function month(p: Person, used: number, pct: number): HTMLElement { td, h('span', { class: day >= days - 3 ? 'hide' : '' }, short(days)), ); - return h( - 'div', - { class: 'month' }, - bars, - axis, - h( - 'div', - { class: 'month-read' }, - read, - h( - 'span', - { class: `num${p.state === 'quota' ? ' bad-t' : ''}`, 'data-t': 'm-left' }, - p.quota_limit ? fmt(_('%s left'), bytes(Math.max(0, p.quota_limit - used))) : _('No limit'), - ), - ), - p.quota_limit ? meter(pct) : null, - ); + return h('div', { class: 'month' }, chart.el, axis, h('div', { class: 'month-read' }, read.el, side), p.quota_limit ? meter(pct) : null); } /** The days left as a number over a calendar of the weeks to the end (the last day ringed). */ diff --git a/web/src/portal/page/devices.ts b/web/src/portal/page/devices.ts index 21c2084..a86582e 100644 --- a/web/src/portal/page/devices.ts +++ b/web/src/portal/page/devices.ts @@ -5,11 +5,12 @@ // flows/. import type { Device, Person } from '../../shared/types'; -import { addDays, ago, byDeviceState, bytes, parseDay } from '../../shared/format'; +import { addDays, ago, byDeviceState, parseDay } from '../../shared/format'; import { fmt, locale, num, plural } from '../../shared/i18n'; import { h, ic } from '../dom'; import { BOUNCY, EASE_IN, EASE_OUT, SMOOTH, play } from '../motion'; import { now, today, type RepaintOpts, type State } from '../state'; +import { bars, sumDays, upDown } from '../ui/bars'; import { copy } from '../ui/feedback'; import { glass } from '../ui/glass'; import { openMenu, type MenuItem } from '../ui/menu'; @@ -63,11 +64,12 @@ function dayName(back: number): string { return parseDay(addDays(today(), -back)).toLocaleDateString(locale(), { weekday: 'short', day: 'numeric', month: 'short' }); } -/** Last 7 days as a number and bars; a bar under the pointer puts its own day in the number's place. */ +/** Last 7 days down and up over their bars; a day under the pointer puts its own numbers in their place. */ function usage(d: Device, stale: boolean): HTMLElement { - const week = d.spark.reduce((a, b) => a + b, 0); + const week = sumDays(d.spark); const lbl = h('span', { class: 'use-lbl' }, _('Last 7 days')); - const val = h('span', { class: 'use-val num', 'data-t': `${d.id}:use` }, bytes(week)); + const val = upDown(d.id); + val.set(week); let side: HTMLElement; if (stale) side = h( @@ -83,25 +85,22 @@ function usage(d: Device, stale: boolean): HTMLElement { h('span', {}, _('Update')), ); else { - const max = Math.max(1, ...d.spark); - side = h('div', { class: 'spark' }); - d.spark.forEach((v, i) => { + const chart = bars(d.spark, 'bars-week', 34); + side = chart.el; + chart.cols.forEach((col, i) => { const back = d.spark.length - 1 - i; - const b = h('i', { class: back === 0 ? 'today' : '' }); - b.style.height = `${Math.max(3, Math.round((v / max) * 34))}px`; // What the pointer reads off the bars changes at once: no morph while it moves. - b.addEventListener('pointerenter', () => { + col.addEventListener('pointerenter', () => { setText(lbl, dayName(back)); - setText(val, bytes(v)); + val.set(d.spark[i]); }); - b.addEventListener('pointerleave', () => { + col.addEventListener('pointerleave', () => { setText(lbl, _('Last 7 days')); - setText(val, bytes(week)); + val.set(week); }); - side.appendChild(b); }); } - return h('div', { class: 'dev-use' }, h('div', { class: 'use-txt' }, lbl, val), side); + return h('div', { class: 'dev-use' }, h('div', { class: 'use-txt' }, lbl, h('span', { class: 'use-val' }, val.el)), side); } function card(d: Device, st: State): HTMLElement { diff --git a/web/src/portal/styles/access.css b/web/src/portal/styles/access.css index 32d53a1..fa4b95a 100644 --- a/web/src/portal/styles/access.css +++ b/web/src/portal/styles/access.css @@ -125,28 +125,6 @@ flex-direction: column; gap: 8px; } -.mbars { - display: flex; - align-items: flex-end; - gap: 3px; - height: 64px; -} -.mbars i { - flex: 1; - border-radius: 2.5px; - background: var(--bar); - min-height: 3px; - transition: background-color 120ms; -} -.mbars i.future { - background: color-mix(in srgb, var(--bar) 45%, transparent); -} -.mbars i.today { - background: var(--accent); -} -.mbars i:not(.future):hover { - background: var(--text-2); -} .month-axis { position: relative; display: flex; @@ -171,7 +149,10 @@ font-size: 13px; color: var(--text-2); } -.month-read b { +.month-read > * { + white-space: nowrap; +} +.month-read .ud { color: var(--text); font-weight: 500; font-size: 15px; @@ -273,7 +254,8 @@ .until.soon .cal-g i.end { box-shadow: inset 0 0 0 1.5px var(--warn); } -.acc-row.open .cal-g i { +/* The days come in when the person opens the row, not when a repaint rebuilds it open. */ +.acc-row.opened .cal-g i { animation: cal-in 360ms var(--ease-out) backwards; animation-delay: calc(var(--i) * 7ms); } @@ -339,7 +321,7 @@ } @media (prefers-reduced-motion: reduce) { - .acc-row.open .cal-g i { + .acc-row.opened .cal-g i { animation: none; } } diff --git a/web/src/portal/styles/bars.css b/web/src/portal/styles/bars.css new file mode 100644 index 0000000..8729632 --- /dev/null +++ b/web/src/portal/styles/bars.css @@ -0,0 +1,104 @@ +/* Traffic by day, both ways (ui/bars.ts): downloads rise above a hairline, uploads hang below it, + today in accent; a device card's week and the month in "Your access". Beside them, "↓ 3.9 GB ↑ 819 MB". + The columns meet: each takes half the gap on either side, so the pointer reads a day in the gaps too, and + the row gives the outer halves back so the bars stand where a plain gap would put them. */ + +.bars { + --gap: 3px; + position: relative; + display: flex; + flex: none; + margin-inline: calc(var(--gap) / -2); +} +.bars-week { + --gap: 4px; +} +.bars .col { + display: flex; + flex-direction: column; + padding-inline: calc(var(--gap) / 2); +} +.bars-month .col { + flex: 1; + min-width: 0; +} +.bars .half { + display: flex; + flex-direction: column; +} +.bars .half.top { + justify-content: flex-end; + margin-bottom: 3px; +} +.bars i { + display: block; + border-radius: 2.5px; + transition: background-color 120ms; +} +.bars-week i { + width: 6px; + border-radius: 3px; + transition-duration: 150ms; +} +.bars .dn { + background: color-mix(in srgb, var(--text) 24%, transparent); +} +.bars .up { + background: color-mix(in srgb, var(--text) 11%, transparent); +} +.bars .today .dn { + background: var(--accent); +} +.bars .today .up { + background: color-mix(in srgb, var(--accent) 45%, transparent); +} +.bars .col:not(.future):hover .dn { + background: var(--text-2); +} +.bars .col:not(.future):hover .up { + background: color-mix(in srgb, var(--text-2) 50%, transparent); +} +.bars .today:hover .dn { + background: color-mix(in srgb, var(--accent) 75%, var(--text)); +} +.bars .future i { + height: 3px; + background: color-mix(in srgb, var(--bar) 45%, transparent); +} +.bars .axis { + position: absolute; + left: calc(var(--gap) / 2); + right: calc(var(--gap) / 2); + height: 1px; + background: var(--line); + pointer-events: none; +} + +/* ↓ down ↑ up: the arrows are the line icon turned; the upload one step quieter. */ +.ud { + display: inline-flex; + align-items: center; + gap: 10px; + white-space: nowrap; +} +.ud > span { + display: inline-flex; + align-items: center; + gap: 2px; +} +.ud .i { + width: 0.8em; + height: 0.8em; + stroke-width: 2.2; + color: var(--text-2); +} +.ud-dn .i { + transform: rotate(90deg); +} +.ud-up { + color: var(--text-2); +} +.ud-up .i { + transform: rotate(-90deg); + color: var(--text-3); +} diff --git a/web/src/portal/styles/devices.css b/web/src/portal/styles/devices.css index 9c414d9..21798f8 100644 --- a/web/src/portal/styles/devices.css +++ b/web/src/portal/styles/devices.css @@ -97,27 +97,6 @@ font-weight: 500; letter-spacing: -0.02em; } -.spark { - display: flex; - align-items: flex-end; - gap: 4px; - height: 34px; -} -.spark i { - width: 6px; - border-radius: 3px; - background: var(--bar); - transition: background-color 150ms; -} -.spark i.today { - background: var(--accent); -} -.spark i:hover { - background: var(--text-2); -} -.spark i.today:hover { - background: color-mix(in srgb, var(--accent) 75%, var(--text)); -} .dev .setup-btn { margin-top: auto; } diff --git a/web/src/portal/styles/index.css b/web/src/portal/styles/index.css index 78e9921..1a7b576 100644 --- a/web/src/portal/styles/index.css +++ b/web/src/portal/styles/index.css @@ -4,6 +4,7 @@ @import './base.css'; @import './controls.css'; @import './morph.css'; +@import './bars.css'; @import './accordion.css'; @import './page.css'; @import './devices.css'; diff --git a/web/src/portal/ui/accordion.ts b/web/src/portal/ui/accordion.ts index ebc142c..a11a7f0 100644 --- a/web/src/portal/ui/accordion.ts +++ b/web/src/portal/ui/accordion.ts @@ -2,7 +2,9 @@ // closed and share their rounded ends; an open row lifts out with 10 px gaps // and its own corners. One row open at a time. A row with nothing to open is a // plain head: no chevron, no click. Inside the sheet it tells the sheet first, -// so a code that comes into view gets its width. +// so a code that comes into view gets its width. A row the person opens is +// `.opened` until it closes: what enters inside it (the calendar's days) keys on +// that, so a repaint that rebuilds the row open doesn't play it again. import { h, ic } from '../dom'; import { EASE_IN, SOFT, play } from '../motion'; @@ -98,9 +100,10 @@ export function accordion( const closing = rows.filter((x) => x.classList.contains('open') && (x === r || willOpen)); rows.forEach((x) => { x.classList.remove('closing'); - if (x !== r) x.classList.remove('open'); + if (x !== r) x.classList.remove('open', 'opened'); }); r.classList.toggle('open', willOpen); + r.classList.toggle('opened', willOpen); corners(); const plan = planWidth(); rows.forEach((x, i) => { diff --git a/web/src/portal/ui/bars.ts b/web/src/portal/ui/bars.ts new file mode 100644 index 0000000..7f0509d --- /dev/null +++ b/web/src/portal/ui/bars.ts @@ -0,0 +1,79 @@ +// Traffic by day, both ways: what a device received rises above a hairline and +// what it sent hangs below, on one scale, so a day of uploads shows as itself +// rather than as a cap on the downloads. The hairline sits where the two +// directions' peaks share the height. Beside the bars, "↓ 3.9 GB ↑ 819 MB". +// A day is the router's [rx, tx]: rx came from the device (its upload), tx went +// to it (its download). + +import type { Pair } from '../../shared/types'; +import { bytes } from '../../shared/format'; +import { h, ic } from '../dom'; +import { setText } from './morph'; + +/** Between the halves, the hairline in the middle of it. */ +const GAP = 3; + +/** Days added up: what came and what went over all of them. */ +export const sumDays = (days: Pair[]): Pair => days.reduce((a, [rx, tx]) => [a[0] + rx, a[1] + tx], [0, 0]); + +/** + * Where the hairline sits and how many px a byte is: each direction's peak gets + * its share of the height, the downloads keeping 55–80% of it, so a quiet + * upload still shows and a busy one does not flatten the rest. + */ +export function mirror(days: Pair[], height: number): { top: number; bottom: number; scale: number } { + const down = Math.max(1, ...days.map((d) => d[1])); + const up = Math.max(1, ...days.map((d) => d[0])); + const top = Math.round((height - GAP) * Math.min(0.8, Math.max(0.55, down / (down + up)))); + const bottom = height - GAP - top; + return { top, bottom, scale: Math.min(top / down, bottom / up) }; +} + +export interface Bars { + el: HTMLElement; + /** A column a day, for what the pointer reads off them. */ + cols: HTMLElement[]; +} + +/** A column a day, today last (in accent); `future`: the days still to come, flat on the hairline. */ +export function bars(days: Pair[], cls: string, height: number, future = 0): Bars { + const { top, bottom, scale } = mirror(days, height); + const half = (side: string, px: number, v: number, what: string) => { + const bar = h('i', { class: what }); + bar.style.height = `${Math.max(2, Math.round(v * scale))}px`; + const el = h('div', { class: `half ${side}` }, bar); + el.style.height = `${px}px`; + return el; + }; + const el = h('div', { class: `bars ${cls}`, 'aria-hidden': 'true' }); + el.style.height = `${height}px`; + const cols = days.map(([rx, tx], i) => + el.appendChild( + h('div', { class: `col${i === days.length - 1 ? ' today' : ''}` }, half('top', top, tx, 'dn'), half('bottom', bottom, rx, 'up')), + ), + ); + for (let i = 0; i < future; i++) el.appendChild(h('div', { class: 'col future' }, h('i'))).style.paddingTop = `${top - 2}px`; + el.appendChild(h('span', { class: 'axis' })).style.top = `${top + 1}px`; + return { el, cols }; +} + +export interface UpDown { + el: HTMLElement; + /** Show these, at once (a repaint morphs them by their keys). */ + set(day: Pair): void; +} + +/** "↓ 3.9 GB ↑ 819 MB"; `key` names the two numbers for the repaint's morph. */ +export function upDown(key: string): UpDown { + const side = (cls: string, name: string, num: HTMLElement) => + h('span', { class: cls, title: name }, ic('arrow'), h('span', { class: 'offscreen' }, name), num); + const dn = h('span', { class: 'num', 'data-t': `${key}:dn` }); + const up = h('span', { class: 'num', 'data-t': `${key}:up` }); + return { + el: h('span', { class: 'ud' }, side('ud-dn', _('Downloaded'), dn), side('ud-up', _('Uploaded'), up)), + set([rx, tx]) { + setText(dn, bytes(tx)); + setText(up, bytes(rx)); + }, + }; +} diff --git a/web/src/portal/ui/feedback.ts b/web/src/portal/ui/feedback.ts index 78bdbfe..b38f0fb 100644 --- a/web/src/portal/ui/feedback.ts +++ b/web/src/portal/ui/feedback.ts @@ -41,6 +41,24 @@ export function toast(msg: string, bad = false) { }, 2400); } +/** An icon that changes in place: the new one pops in where the old one stood. */ +export function swapIcon(icon: Element, name: string): Element { + const next = ic(name, icon.getAttribute('class') ?? 'i'); + icon.replaceWith(next); + play( + next, + [ + { opacity: 0, transform: 'scale(.6)', filter: 'blur(3px)' }, + { opacity: 1, transform: 'none', filter: 'none' }, + ], + { + duration: POP.duration, + easing: POP.easing, + }, + ); + return next; +} + /** * The control that copied says so for a moment: its icon turns into a check * and its "Copy…" label (`.lbl`, a badge's main line) into "Copied". Every @@ -53,22 +71,7 @@ function copied(from: Element) { const label = from.querySelector('.lbl, .b-main'); const was = label ? textOf(label) : ''; from.classList.add('copied'); - let check: Element | null = null; - if (icon) { - check = ic('check', icon.getAttribute('class') ?? 'i'); - icon.replaceWith(check); - play( - check, - [ - { opacity: 0, transform: 'scale(.6)', filter: 'blur(3px)' }, - { opacity: 1, transform: 'none', filter: 'none' }, - ], - { - duration: POP.duration, - easing: POP.easing, - }, - ); - } + const check = icon ? swapIcon(icon, 'check') : null; if (label) morphText(label, _('Copied')); setTimeout(() => { if (check && icon) check.replaceWith(icon); diff --git a/web/src/shared/types.ts b/web/src/shared/types.ts index d39544a..86c43f4 100644 --- a/web/src/shared/types.ts +++ b/web/src/shared/types.ts @@ -19,8 +19,8 @@ export interface Device { active: boolean; month: Pair; total: Pair; - /** Daily totals (rx+tx) for the last 7 days, oldest first. */ - spark: number[]; + /** Each day's [rx, tx] for the last 7 days, oldest first. */ + spark: Pair[]; hostname: string; browser_key: boolean; /** Its configuration changed (networks, DNS, keys...) since it was last shown or downloaded. */ @@ -52,8 +52,8 @@ export interface Person { online: number; last_seen: number; devices: Device[]; - /** Daily totals (rx+tx) from the 1st of this month to today, oldest first; portal only. */ - month_days?: number[]; + /** Each day's [rx, tx] from the 1st of this month to today, oldest first; portal only. */ + month_days?: Pair[]; /** Throughput, one point a minute (last 15): [ts, rx, tx] in bytes/s (rx = from devices); admin only. */ rate?: [number, number, number][]; // admin only (the personal link itself comes from person_links, not the status) diff --git a/web/tests/bars.test.ts b/web/tests/bars.test.ts new file mode 100644 index 0000000..48e51a1 --- /dev/null +++ b/web/tests/bars.test.ts @@ -0,0 +1,40 @@ +import { describe, expect, it } from 'vitest'; +import type { Pair } from '../src/shared/types'; +import { mirror, sumDays } from '../src/portal/ui/bars'; + +/** [rx, tx]: what the device sent, what it received. */ +const days: Pair[] = [ + [10, 90], + [40, 60], + [5, 120], +]; + +describe('mirrored bars', () => { + it('splits the height between the two directions around the hairline', () => { + const m = mirror(days, 64); + expect(m.top + m.bottom + 3).toBe(64); + }); + + it('fits both peaks on one scale, the tighter one filling its half', () => { + const m = mirror(days, 64); + expect(120 * m.scale).toBeLessThanOrEqual(m.top); + expect(40 * m.scale).toBeLessThanOrEqual(m.bottom); + expect(Math.max(120 * m.scale - m.top, 40 * m.scale - m.bottom)).toBeCloseTo(0); + }); + + it('keeps 55–80% of the height for downloads, however lopsided the days', () => { + expect(mirror([[0, 100]], 64).top).toBe(Math.round(61 * 0.8)); + expect(mirror([[100, 1]], 64).top).toBe(Math.round(61 * 0.55)); + }); + + it('draws a month without traffic', () => { + const m = mirror([[0, 0]], 34); + expect(Number.isFinite(m.scale)).toBe(true); + expect(m.top).toBeGreaterThan(m.bottom); + }); + + it('adds the days up both ways', () => { + expect(sumDays(days)).toEqual([55, 270]); + expect(sumDays([])).toEqual([0, 0]); + }); +}); diff --git a/web/tests/demo.test.ts b/web/tests/demo.test.ts index 6b678c3..8592132 100644 --- a/web/tests/demo.test.ts +++ b/web/tests/demo.test.ts @@ -102,7 +102,7 @@ describe('demo data', () => { const t = new Date(2026, 9, 19, 12).getTime() / 1000; const days = monthDays(1000, t); expect(days).toHaveLength(19); - expect(Math.abs(days.reduce((a, b) => a + b, 0) - 1000)).toBeLessThanOrEqual(19); + expect(Math.abs(days.reduce((a, [rx, tx]) => a + rx + tx, 0) - 1000)).toBeLessThanOrEqual(19); }); it('keeps the hours scenario outside its window', () => {