Files
pyMC_Repeater/repeater/web/html/assets/Configuration-Dxtpjjw4.js
T
2026-03-13 09:06:57 +00:00

3 lines
139 KiB
JavaScript

const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/leaflet-src-BtisrQHC.js","assets/_commonjsHelpers-CqkleIqs.js"])))=>i.map(i=>d[i]);
import{a as q,M as re,c as T,r as m,D as te,b as r,g as L,e,t as u,F as U,w as S,v as V,h as J,q as ee,k as H,L as K,p as o,P as we,s as G,E as ie,S as me,x as pe,f as R,y as de,d as _e,U as ce,j as D,l as ve,N as xe,V as be,T as Ce,i as W,W as ne,o as ae,u as X,X as $e,Q as Z}from"./index-BvDdpPbD.js";/* empty css */import{_ as Me}from"./ConfirmDialog.vue_vue_type_script_setup_true_lang-C9WbYecg.js";import{g as Ae,s as Se}from"./preferences-DtwbSSgO.js";const je={class:"space-y-4"},Te={key:0,class:"bg-green-100 dark:bg-green-500/20 border border-green-500/50 rounded-lg p-3"},Ne={class:"text-green-600 dark:text-green-400 text-sm"},Be={key:1,class:"bg-red-100 dark:bg-red-500/20 border border-red-500/50 rounded-lg p-3"},Ee={class:"text-red-600 dark:text-red-400 text-sm"},Le={class:"flex justify-end gap-2"},Fe=["disabled"],Pe=["disabled"],ze={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},Ve={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},De={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Ie={key:1,class:"flex items-center gap-2"},He={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Ue={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Re={key:1},Ke=["value"],Oe={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},qe={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},We={key:1},Ge=["value"],Qe={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Ye={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Xe={key:1,class:"flex items-center gap-2"},Je={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Ze={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},et={key:1},tt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},ot={class:"text-content-primary dark:text-content-primary font-mono text-sm"},rt={key:2,class:"bg-yellow-500/10 dark:bg-yellow-500/10 border border-yellow-500/30 rounded-lg p-3"},st=q({__name:"RadioSettings",setup(I){const _=re(),i=T(()=>_.stats?.config?.radio||{}),x=m(!1),g=m(!1),c=m(null),p=m(null),s=m(0),v=m(0),f=m(0),h=m(0),E=m(0),A=m(0),$=[{value:7.8,label:"7.8 kHz"},{value:10.4,label:"10.4 kHz"},{value:15.6,label:"15.6 kHz"},{value:20.8,label:"20.8 kHz"},{value:31.25,label:"31.25 kHz"},{value:41.7,label:"41.7 kHz"},{value:62.5,label:"62.5 kHz"},{value:125,label:"125 kHz"},{value:250,label:"250 kHz"},{value:500,label:"500 kHz"}];te(i,C=>{C&&!x.value&&(s.value=C.frequency?Number((C.frequency/1e6).toFixed(3)):0,v.value=C.spreading_factor??0,f.value=C.bandwidth?Number((C.bandwidth/1e3).toFixed(1)):0,h.value=C.tx_power??0,E.value=C.coding_rate??0,A.value=C.preamble_length??0)},{immediate:!0});const n=T(()=>{const C=i.value.frequency;return C?(C/1e6).toFixed(3)+" MHz":"Not set"}),t=T(()=>{const C=i.value.bandwidth;return C?(C/1e3).toFixed(1)+" kHz":"Not set"}),a=T(()=>{const C=i.value.tx_power;return C!==void 0?C+" dBm":"Not set"}),j=T(()=>{const C=i.value.coding_rate;return C?"4/"+C:"Not set"}),k=T(()=>{const C=i.value.preamble_length;return C?C+" symbols":"Not set"}),b=T(()=>i.value.spreading_factor??"Not set"),y=()=>{x.value=!0,c.value=null,p.value=null},z=()=>{x.value=!1,c.value=null;const C=i.value;s.value=C.frequency?Number((C.frequency/1e6).toFixed(3)):0,v.value=C.spreading_factor??0,f.value=C.bandwidth?Number((C.bandwidth/1e3).toFixed(1)):0,h.value=C.tx_power??0,E.value=C.coding_rate??0,A.value=C.preamble_length??0},O=async()=>{g.value=!0,c.value=null,p.value=null;try{const C={};s.value&&(C.frequency=s.value*1e6),v.value&&(C.spreading_factor=v.value),f.value&&(C.bandwidth=f.value*1e3),h.value&&(C.tx_power=h.value),E.value&&(C.coding_rate=E.value);const P=(await K.post("/update_radio_config",C)).data;P.message||P.persisted?(p.value=P.message||"Settings saved successfully",x.value=!1,await _.fetchStats(),setTimeout(()=>{p.value=null},3e3)):P.error?c.value=P.error:c.value="Unknown response from server"}catch(C){console.error("Failed to update radio settings:",C);const N=C;c.value=N.response?.data?.error||"Failed to update settings"}finally{g.value=!1}};return(C,N)=>(o(),r("div",je,[p.value?(o(),r("div",Te,[e("p",Ne,u(p.value),1)])):L("",!0),c.value?(o(),r("div",Be,[e("p",Ee,u(c.value),1)])):L("",!0),e("div",Le,[x.value?(o(),r(U,{key:1},[e("button",{onClick:z,disabled:g.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,Fe),e("button",{onClick:O,disabled:g.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},u(g.value?"Saving...":"Save Changes"),9,Pe)],64)):(o(),r("button",{key:0,onClick:y,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))]),e("div",ze,[e("div",Ve,[N[6]||(N[6]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Frequency",-1)),x.value?(o(),r("div",Ie,[S(e("input",{"onUpdate:modelValue":N[0]||(N[0]=P=>s.value=P),type:"number",step:"0.001",min:"100",max:"1000",class:"w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,s.value,void 0,{number:!0}]]),N[5]||(N[5]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"MHz",-1))])):(o(),r("div",De,u(n.value),1))]),e("div",He,[N[7]||(N[7]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Spreading Factor",-1)),x.value?(o(),r("div",Re,[S(e("select",{"onUpdate:modelValue":N[1]||(N[1]=P=>v.value=P),class:"px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},[(o(),r(U,null,J([5,6,7,8,9,10,11,12],P=>e("option",{key:P,value:P},u(P),9,Ke)),64))],512),[[ee,v.value,void 0,{number:!0}]])])):(o(),r("div",Ue,u(b.value),1))]),e("div",Oe,[N[8]||(N[8]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Bandwidth",-1)),x.value?(o(),r("div",We,[S(e("select",{"onUpdate:modelValue":N[2]||(N[2]=P=>f.value=P),class:"px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},[(o(),r(U,null,J($,P=>e("option",{key:P.value,value:P.value},u(P.label),9,Ge)),64))],512),[[ee,f.value,void 0,{number:!0}]])])):(o(),r("div",qe,u(t.value),1))]),e("div",Qe,[N[10]||(N[10]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"TX Power",-1)),x.value?(o(),r("div",Xe,[S(e("input",{"onUpdate:modelValue":N[3]||(N[3]=P=>h.value=P),type:"number",min:"2",max:"30",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,h.value,void 0,{number:!0}]]),N[9]||(N[9]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"dBm",-1))])):(o(),r("div",Ye,u(a.value),1))]),e("div",Je,[N[12]||(N[12]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Coding Rate",-1)),x.value?(o(),r("div",et,[S(e("select",{"onUpdate:modelValue":N[4]||(N[4]=P=>E.value=P),class:"px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},N[11]||(N[11]=[e("option",{value:5},"4/5",-1),e("option",{value:6},"4/6",-1),e("option",{value:7},"4/7",-1),e("option",{value:8},"4/8",-1)]),512),[[ee,E.value,void 0,{number:!0}]])])):(o(),r("div",Ze,u(j.value),1))]),e("div",tt,[N[13]||(N[13]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Preamble Length",-1)),e("span",ot,u(k.value),1)])]),x.value?(o(),r("div",rt,N[14]||(N[14]=[e("p",{class:"text-yellow-700 dark:text-yellow-400 text-xs"},[e("strong",null,"Note:"),H(" Radio hardware changes (frequency, bandwidth, spreading factor, coding rate) may require a service restart to apply. ")],-1)]))):L("",!0)]))}}),nt={class:"glass-card border border-stroke-subtle dark:border-white/20 rounded-[15px] w-full max-w-3xl max-h-[90vh] flex flex-col shadow-2xl"},at={class:"flex-1 relative min-h-[400px]"},lt={class:"p-6 border-t border-stroke-subtle dark:border-stroke/10 space-y-4"},dt={class:"grid grid-cols-2 gap-4"},it=q({__name:"LocationPicker",props:{isOpen:{type:Boolean},latitude:{},longitude:{}},emits:["close","select"],setup(I,{emit:_}){const i=I,x=_,g=m(null),c=m(i.latitude||0),p=m(i.longitude||0);let s=null,v=null;const f=async()=>{if(g.value){h();try{const n=(await me(async()=>{const{default:k}=await import("./leaflet-src-BtisrQHC.js").then(b=>b.l);return{default:k}},__vite__mapDeps([0,1]))).default;delete n.Icon.Default.prototype._getIconUrl,n.Icon.Default.mergeOptions({iconRetinaUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon-2x.png",iconUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-icon.png",shadowUrl:"https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png"}),await ie();const t=c.value||0,a=p.value||0,j=t===0&&a===0?2:13;s=n.map(g.value).setView([t,a],j);try{const k=n.tileLayer("https://{s}.basemaps.cartocdn.com/dark_nolabels/{z}/{x}/{y}{r}.png",{maxZoom:19,attribution:'&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors &copy; <a href="https://carto.com/attributions">CARTO</a>',errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="}),b=n.tileLayer("https://{s}.basemaps.cartocdn.com/dark_only_labels/{z}/{x}/{y}{r}.png",{maxZoom:19,attribution:"",errorTileUrl:"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg=="});k.addTo(s),b.addTo(s)}catch(k){console.warn("Error loading tiles:",k)}(t!==0||a!==0)&&(v=n.marker([t,a]).addTo(s)),s.on("click",k=>{c.value=k.latlng.lat,p.value=k.latlng.lng,v?v.setLatLng(k.latlng):v=n.marker(k.latlng).addTo(s)}),setTimeout(()=>{s?.invalidateSize()},200)}catch(n){console.error("Failed to initialize map:",n)}}},h=()=>{s&&(s.remove(),s=null,v=null)};te(()=>i.isOpen,async n=>{n?(await ie(),await f()):h()}),te(()=>[i.latitude,i.longitude],([n,t])=>{c.value=n,p.value=t});const E=()=>{x("select",{latitude:c.value,longitude:p.value}),x("close")},A=()=>{x("close")},$=()=>{navigator.geolocation?navigator.geolocation.getCurrentPosition(async n=>{if(c.value=n.coords.latitude,p.value=n.coords.longitude,s){s.setView([c.value,p.value],13);const t=(await me(async()=>{const{default:a}=await import("./leaflet-src-BtisrQHC.js").then(j=>j.l);return{default:a}},__vite__mapDeps([0,1]))).default;v?v.setLatLng([c.value,p.value]):v=t.marker([c.value,p.value]).addTo(s)}},n=>{console.error("Error getting location:",n),alert("Unable to get current location. Please check browser permissions.")}):alert("Geolocation is not supported by this browser.")};return we(()=>{h()}),(n,t)=>n.isOpen?(o(),r("div",{key:0,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:G(A,["self"])},[e("div",nt,[e("div",{class:"flex items-center justify-between p-6 border-b border-stroke-subtle dark:border-stroke/10"},[t[3]||(t[3]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Select Location",-1)),e("button",{onClick:A,class:"text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors"},t[2]||(t[2]=[e("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("div",at,[e("div",{ref_key:"mapContainer",ref:g,class:"absolute inset-0 rounded-b-[15px] overflow-hidden"},null,512)]),e("div",lt,[e("div",dt,[e("div",null,[t[4]||(t[4]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Latitude",-1)),S(e("input",{"onUpdate:modelValue":t[0]||(t[0]=a=>c.value=a),type:"number",step:"0.000001",class:"w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary focus:outline-none focus:border-primary",readonly:""},null,512),[[V,c.value,void 0,{number:!0}]])]),e("div",null,[t[5]||(t[5]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Longitude",-1)),S(e("input",{"onUpdate:modelValue":t[1]||(t[1]=a=>p.value=a),type:"number",step:"0.000001",class:"w-full px-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary focus:outline-none focus:border-primary",readonly:""},null,512),[[V,p.value,void 0,{number:!0}]])])]),e("div",{class:"flex gap-3"},[e("button",{onClick:$,class:"flex-1 px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm flex items-center justify-center gap-2"},t[6]||(t[6]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})],-1),H(" Use Current Location ",-1)])),e("button",{onClick:A,class:"px-6 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm"}," Cancel "),e("button",{onClick:E,class:"px-6 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Select Location ")]),t[7]||(t[7]=e("p",{class:"text-content-muted dark:text-content-muted text-xs text-center"},"Click on the map to select a location",-1))])])])):L("",!0)}}),ct=pe(it,[["__scopeId","data-v-186d3c86"]]),ut={class:"space-y-4"},mt={key:0,class:"bg-green-100 dark:bg-green-500/10 border border-green-300 dark:border-green-500/30 rounded-lg p-3"},pt={class:"text-green-700 dark:text-green-400 text-sm"},vt={key:1,class:"bg-red-100 dark:bg-red-500/10 border border-red-300 dark:border-red-500/30 rounded-lg p-3"},xt={class:"text-red-700 dark:text-red-400 text-sm"},bt={class:"flex justify-end gap-2"},kt=["disabled"],gt=["disabled"],yt={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},ft={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},ht={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm break-all"},wt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},_t={class:"text-content-primary dark:text-content-primary font-mono text-xs break-all"},Ct={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},$t={class:"text-content-primary dark:text-content-primary font-mono text-xs break-all sm:text-right sm:max-w-xs"},Mt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},At={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},St={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},jt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Tt={key:0,class:"flex justify-end"},Nt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Bt={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Et={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Lt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Ft={class:"flex flex-col py-2 gap-2"},Pt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1"},zt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4"},Vt={key:1,class:"flex items-center gap-2"},Dt=q({__name:"RepeaterSettings",setup(I){const _=re(),i=T(()=>_.stats?.config||{}),x=T(()=>i.value.repeater||{}),g=T(()=>_.stats),c=m(!1),p=m(!1),s=m(null),v=m(null),f=m(!1),h=m(""),E=m(0),A=m(0),$=m(0),n=m(1),t=T(()=>i.value.mesh||{});te([i,x,t],()=>{if(!c.value){h.value=i.value.node_name||"",E.value=x.value.latitude||0,A.value=x.value.longitude||0,$.value=x.value.send_advert_interval_hours||0;const d=t.value.path_hash_mode;n.value=d===0||d===1||d===2?d+1:1}},{immediate:!0});const a=T(()=>i.value.node_name||"Not set"),j=T(()=>g.value?.local_hash||"Not available"),k=T(()=>{const d=g.value?.public_key;return!d||d==="Not set"?"Not set":d}),b=T(()=>{const d=x.value.latitude;return d&&d!==0?d.toFixed(6):"Not set"}),y=T(()=>{const d=x.value.longitude;return d&&d!==0?d.toFixed(6):"Not set"}),z=T(()=>{const d=x.value.mode;return d?d.charAt(0).toUpperCase()+d.slice(1):"Not set"}),O=T(()=>{const d=x.value.send_advert_interval_hours;return d===void 0?"Not set":d===0?"Disabled":d+" hour"+(d!==1?"s":"")}),C=T(()=>{const d=t.value.path_hash_mode;return d===0||d===1||d===2?d+1+(d===0?" byte":" bytes"):"Not set"}),N=()=>{c.value=!0,s.value=null,v.value=null},P=()=>{c.value=!1,s.value=null,h.value=i.value.node_name||"",E.value=x.value.latitude||0,A.value=x.value.longitude||0,$.value=x.value.send_advert_interval_hours||0;const d=t.value.path_hash_mode;n.value=d===0||d===1||d===2?d+1:1},oe=async()=>{p.value=!0,s.value=null,v.value=null;try{const d={};h.value&&(d.node_name=h.value),d.latitude=E.value,d.longitude=A.value,d.flood_advert_interval_hours=$.value,d.path_hash_mode=n.value-1;const F=(await K.post("/update_radio_config",d)).data;F.message||F.persisted?(v.value=F.message||"Settings saved successfully",c.value=!1,await _.fetchStats(),setTimeout(()=>{v.value=null},3e3)):F.error?s.value=F.error:s.value="Unknown response from server"}catch(d){console.error("Failed to update repeater settings:",d);const w=d;s.value=w.response?.data?.error||"Failed to update settings"}finally{p.value=!1}},Y=()=>{f.value=!0},M=d=>{E.value=d.latitude,A.value=d.longitude};return(d,w)=>(o(),r("div",ut,[v.value?(o(),r("div",mt,[e("p",pt,u(v.value),1)])):L("",!0),s.value?(o(),r("div",vt,[e("p",xt,u(s.value),1)])):L("",!0),e("div",bt,[c.value?(o(),r(U,{key:1},[e("button",{onClick:P,disabled:p.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,kt),e("button",{onClick:oe,disabled:p.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},u(p.value?"Saving...":"Save Changes"),9,gt)],64)):(o(),r("button",{key:0,onClick:N,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))]),e("div",yt,[e("div",ft,[w[6]||(w[6]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Node Name",-1)),c.value?S((o(),r("input",{key:1,"onUpdate:modelValue":w[0]||(w[0]=F=>h.value=F),type:"text",maxlength:"50",class:"w-full sm:w-64 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary",placeholder:"Enter node name"},null,512)),[[V,h.value]]):(o(),r("div",ht,u(a.value),1))]),e("div",wt,[w[7]||(w[7]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Local Hash",-1)),e("span",_t,u(j.value),1)]),e("div",Ct,[w[8]||(w[8]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm flex-shrink-0"},"Public Key",-1)),e("span",$t,u(k.value),1)]),e("div",Mt,[w[9]||(w[9]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Latitude",-1)),c.value?S((o(),r("input",{key:1,"onUpdate:modelValue":w[1]||(w[1]=F=>E.value=F),type:"number",step:"0.000001",min:"-90",max:"90",class:"w-full sm:w-48 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,E.value,void 0,{number:!0}]]):(o(),r("div",At,u(b.value),1))]),e("div",St,[w[10]||(w[10]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Longitude",-1)),c.value?S((o(),r("input",{key:1,"onUpdate:modelValue":w[2]||(w[2]=F=>A.value=F),type:"number",step:"0.000001",min:"-180",max:"180",class:"w-full sm:w-48 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,A.value,void 0,{number:!0}]]):(o(),r("div",jt,u(y.value),1))]),c.value?(o(),r("div",Tt,[e("button",{onClick:Y,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm flex items-center gap-2",title:"Pick location on map"},w[11]||(w[11]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M17.657 16.657L13.414 20.9a1.998 1.998 0 01-2.827 0l-4.244-4.243a8 8 0 1111.314 0z"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 11a3 3 0 11-6 0 3 3 0 016 0z"})],-1),H(" Pick Location on Map ",-1)]))])):L("",!0),e("div",Nt,[w[12]||(w[12]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Mode",-1)),e("span",Bt,u(z.value),1)]),e("div",Et,[w[14]||(w[14]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Path hash length",-1)),c.value?S((o(),r("select",{key:1,"onUpdate:modelValue":w[3]||(w[3]=F=>n.value=F),class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},w[13]||(w[13]=[e("option",{value:1},"1 byte",-1),e("option",{value:2},"2 bytes",-1),e("option",{value:3},"3 bytes",-1)]),512)),[[ee,n.value,void 0,{number:!0}]]):(o(),r("div",Lt,u(C.value),1))]),e("div",Ft,[e("div",Pt,[w[16]||(w[16]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Periodic Advertisement Interval",-1)),c.value?(o(),r("div",Vt,[S(e("input",{"onUpdate:modelValue":w[4]||(w[4]=F=>$.value=F),type:"number",min:"0",max:"48",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,$.value,void 0,{number:!0}]]),w[15]||(w[15]=e("span",{class:"text-content-muted dark:text-content-muted text-sm"},"hours",-1))])):(o(),r("div",zt,u(O.value),1))]),w[17]||(w[17]=e("span",{class:"text-content-muted dark:text-content-muted text-xs"},"How often the repeater sends an advertisement packet (0 = disabled, 3-48 hours)",-1))])]),R(ct,{"is-open":f.value,latitude:E.value,longitude:A.value,onClose:w[5]||(w[5]=F=>f.value=!1),onSelect:M},null,8,["is-open","latitude","longitude"])]))}}),It={class:"space-y-4"},Ht={key:0,class:"bg-green-100 dark:bg-green-500/20 border border-green-500 dark:border-green-500/50 rounded-lg p-3 text-green-700 dark:text-green-400 text-sm"},Ut={key:1,class:"bg-red-100 dark:bg-red-500/20 border border-red-500 dark:border-red-500/50 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm"},Rt={class:"flex justify-end gap-2"},Kt=["disabled"],Ot=["disabled"],qt={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},Wt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Gt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Qt={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},Yt={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Xt=q({__name:"DutyCycle",setup(I){const _=re(),i=T(()=>_.stats?.config?.duty_cycle||{}),x=T(()=>{const n=i.value.max_airtime_percent;return typeof n=="number"?n.toFixed(1)+"%":n&&typeof n=="object"&&"parsedValue"in n?(n.parsedValue||0).toFixed(1)+"%":"Not set"}),g=T(()=>i.value.enforcement_enabled?"Enabled":"Disabled"),c=m(!1),p=m(!1),s=m(""),v=m(""),f=m(0),h=m(!0),E=()=>{const n=i.value.max_airtime_percent;typeof n=="number"?f.value=n:n&&typeof n=="object"&&"parsedValue"in n?f.value=n.parsedValue||0:f.value=6,h.value=i.value.enforcement_enabled!==!1,c.value=!0,s.value="",v.value=""},A=()=>{c.value=!1,s.value="",v.value=""},$=async()=>{p.value=!0,v.value="",s.value="";try{const t=(await de.post("/api/update_duty_cycle_config",{max_airtime_percent:f.value,enforcement_enabled:h.value})).data;t.message||t.persisted?(s.value=t.message||"Settings saved successfully",c.value=!1,await _.fetchStats(),setTimeout(()=>{s.value=""},3e3)):v.value="Failed to save settings"}catch(n){console.error("Failed to save duty cycle settings:",n),v.value=n.response?.data?.error||"Failed to save settings"}finally{p.value=!1}};return(n,t)=>(o(),r("div",It,[s.value?(o(),r("div",Ht,u(s.value),1)):L("",!0),v.value?(o(),r("div",Ut,u(v.value),1)):L("",!0),e("div",Rt,[c.value?(o(),r(U,{key:1},[e("button",{onClick:A,disabled:p.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,Kt),e("button",{onClick:$,disabled:p.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},u(p.value?"Saving...":"Save Changes"),9,Ot)],64)):(o(),r("button",{key:0,onClick:E,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))]),e("div",qt,[e("div",Wt,[t[2]||(t[2]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Max Airtime %",-1)),c.value?S((o(),r("input",{key:1,"onUpdate:modelValue":t[0]||(t[0]=a=>f.value=a),type:"number",step:"0.1",min:"0.1",max:"100",class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,f.value,void 0,{number:!0}]]):(o(),r("div",Gt,u(x.value),1))]),e("div",Qt,[t[4]||(t[4]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Enforcement",-1)),c.value?S((o(),r("select",{key:1,"onUpdate:modelValue":t[1]||(t[1]=a=>h.value=a),class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},t[3]||(t[3]=[e("option",{value:!0},"Enabled",-1),e("option",{value:!1},"Disabled",-1)]),512)),[[ee,h.value]]):(o(),r("div",Yt,u(g.value),1))])])]))}}),Jt={class:"space-y-4"},Zt={key:0,class:"bg-green-100 dark:bg-green-500/20 border border-green-500 dark:border-green-500/50 rounded-lg p-3 text-green-700 dark:text-green-400 text-sm"},eo={key:1,class:"bg-red-100 dark:bg-red-500/20 border border-red-500 dark:border-red-500/50 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm"},to={class:"flex justify-end gap-2"},oo=["disabled"],ro=["disabled"],so={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},no={class:"flex flex-col py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-2"},ao={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1"},lo={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4"},io={class:"flex flex-col py-2 gap-2"},co={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-1"},uo={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm sm:ml-4"},mo=q({__name:"TransmissionDelays",setup(I){const _=re(),i=T(()=>_.stats?.config?.delays||{}),x=T(()=>{const n=i.value.tx_delay_factor;if(n&&typeof n=="object"&&n!==null&&"parsedValue"in n){const t=n.parsedValue;if(typeof t=="number")return t.toFixed(2)+"x"}return"Not set"}),g=T(()=>{const n=i.value.direct_tx_delay_factor;return typeof n=="number"?n.toFixed(2)+"s":"Not set"}),c=m(!1),p=m(!1),s=m(""),v=m(""),f=m(0),h=m(0),E=()=>{const n=i.value.tx_delay_factor;n&&typeof n=="object"&&"parsedValue"in n?f.value=n.parsedValue||1:typeof n=="number"?f.value=n:f.value=1;const t=i.value.direct_tx_delay_factor;h.value=typeof t=="number"?t:.5,c.value=!0,s.value="",v.value=""},A=()=>{c.value=!1,s.value="",v.value=""},$=async()=>{p.value=!0,v.value="",s.value="";try{const t=(await de.post("/api/update_radio_config",{tx_delay_factor:f.value,direct_tx_delay_factor:h.value})).data;t.message||t.persisted?(s.value=t.message||"Settings saved successfully",c.value=!1,await _.fetchStats(),setTimeout(()=>{s.value=""},3e3)):v.value="Failed to save settings"}catch(n){console.error("Failed to save delay settings:",n),v.value=n.response?.data?.error||"Failed to save settings"}finally{p.value=!1}};return(n,t)=>(o(),r("div",Jt,[s.value?(o(),r("div",Zt,u(s.value),1)):L("",!0),v.value?(o(),r("div",eo,u(v.value),1)):L("",!0),e("div",to,[c.value?(o(),r(U,{key:1},[e("button",{onClick:A,disabled:p.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,oo),e("button",{onClick:$,disabled:p.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},u(p.value?"Saving...":"Save Changes"),9,ro)],64)):(o(),r("button",{key:0,onClick:E,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))]),e("div",so,[e("div",no,[e("div",ao,[t[2]||(t[2]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Flood TX Delay Factor",-1)),c.value?S((o(),r("input",{key:1,"onUpdate:modelValue":t[0]||(t[0]=a=>f.value=a),type:"number",step:"0.1",min:"0",max:"5",class:"w-full sm:w-32 px-3 py-1.5 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,f.value,void 0,{number:!0}]]):(o(),r("div",lo,u(x.value),1))]),t[3]||(t[3]=e("span",{class:"text-content-muted dark:text-content-muted text-xs"},"Multiplier for flood packet transmission delays (collision avoidance)",-1))]),e("div",io,[e("div",co,[t[4]||(t[4]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Direct TX Delay Factor",-1)),c.value?S((o(),r("input",{key:1,"onUpdate:modelValue":t[1]||(t[1]=a=>h.value=a),type:"number",step:"0.1",min:"0",max:"5",class:"w-full sm:w-32 px-3 py-1.5 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,h.value,void 0,{number:!0}]]):(o(),r("div",uo,u(g.value),1))]),t[5]||(t[5]=e("span",{class:"text-content-muted dark:text-content-muted text-xs"},"Base delay for direct-routed packet transmission (seconds)",-1))])])]))}}),ke=_e("treeState",()=>{const I=ce(new Set),_=ce({value:null}),i=s=>{I.add(s)},x=s=>{I.delete(s)};return{expandedNodes:I,selectedNodeId:_,addExpandedNode:i,removeExpandedNode:x,isNodeExpanded:s=>I.has(s),setSelectedNode:s=>{_.value=s},toggleExpanded:s=>{I.has(s)?x(s):i(s)}}}),po={class:"select-none"},vo={class:"flex-shrink-0"},xo={key:0,class:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},bo={key:1,class:"w-3.5 h-3.5 sm:w-4 sm:h-4 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ko={key:0,class:"hidden sm:flex items-center gap-1 ml-2"},go={class:"relative group"},yo=["title"],fo={key:0,class:"text-xs font-mono text-white/50 bg-white/5 px-1.5 py-0.5 rounded border border-white/10"},ho={class:"flex justify-between items-start mb-4"},wo={class:"bg-black/20 border border-white/10 rounded-md p-4 mb-4"},_o={class:"text-sm font-mono text-white/80 break-all leading-relaxed"},Co={class:"flex items-center gap-1 sm:gap-2 ml-auto flex-shrink-0"},$o={key:0,class:"hidden sm:flex items-center gap-1"},Mo=["title"],Ao={key:1,class:"hidden sm:flex items-center gap-1"},So={key:2,class:"hidden sm:inline-block px-2 py-1 bg-white/10 text-white/60 text-xs rounded-full ml-1"},jo={key:0,class:"space-y-1"},To=q({__name:"TreeNode",props:{node:{},selectedNodeId:{},level:{},disabled:{type:Boolean}},emits:["select"],setup(I,{emit:_}){const i=I,x=_,g=ke(),c=m(!1),p=T({get:()=>g.isNodeExpanded(i.node.id),set:t=>{t?g.addExpandedNode(i.node.id):g.removeExpandedNode(i.node.id)}}),s=T(()=>i.node.children.length>0);function v(t){if(!t)return"Never";const j=new Date().getTime()-t.getTime(),k=Math.floor(j/(1e3*60)),b=Math.floor(j/(1e3*60*60)),y=Math.floor(j/(1e3*60*60*24)),z=Math.floor(y/365);return k<60?`${k}m ago`:b<24?`${b}h ago`:y<365?`${y}d ago`:`${z}y ago`}function f(t){return t?t.length<=16?t:`${t.slice(0,8)}...${t.slice(-8)}`:"No key"}function h(){if(s.value){const t=!p.value;p.value=t}}function E(){x("select",i.node.id)}function A(t){x("select",t)}function $(t){t.stopPropagation(),c.value=!c.value}function n(t){t.stopPropagation(),i.node.transport_key&&window.navigator?.clipboard&&window.navigator.clipboard.writeText(i.node.transport_key)}return(t,a)=>{const j=be("TreeNode",!0);return o(),r("div",po,[e("div",{class:D(["flex flex-wrap sm:flex-nowrap items-start sm:items-center gap-1 sm:gap-2 py-2 px-2 sm:px-3 rounded-lg cursor-pointer transition-all duration-200",i.disabled?"opacity-50 cursor-not-allowed":"hover:bg-white/5",t.selectedNodeId===t.node.id&&!i.disabled?"bg-primary/20 text-primary":"text-white/80 hover:text-white",`ml-${t.level*4}`]),onClick:a[3]||(a[3]=k=>!i.disabled&&E())},[e("div",{class:"flex-shrink-0 w-3 h-3 sm:w-4 sm:h-4 flex items-center justify-center",onClick:G(h,["stop"])},[s.value?(o(),r("svg",{key:0,class:D(["w-2.5 h-2.5 sm:w-3 sm:h-3 transition-transform duration-200",p.value?"rotate-90":"rotate-0"]),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},a[4]||(a[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 5l7 7-7 7"},null,-1)]),2)):L("",!0)]),e("div",vo,[i.node.name.startsWith("#")?(o(),r("svg",xo,a[5]||(a[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",bo,a[6]||(a[6]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},null,-1)])))]),e("span",{class:D(["font-mono text-xs sm:text-sm transition-colors duration-200 break-all",t.selectedNodeId===t.node.id?"text-primary font-medium":""])},u(t.node.name),3),t.node.transport_key?(o(),r("div",ko,[e("div",go,[e("button",{onClick:$,class:"p-1 rounded hover:bg-white/10 transition-colors",title:c.value?"Hide full key":"Show full key"},a[7]||(a[7]=[e("svg",{class:"w-3 h-3 text-white/60 hover:text-white/80",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 12a3 3 0 11-6 0 3 3 0 016 0z"}),e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"})],-1)]),8,yo),c.value?L("",!0):(o(),r("span",fo,u(f(t.node.transport_key)),1)),c.value?(o(),r("div",{key:1,class:"fixed inset-0 z-[9998] flex items-center justify-center bg-black/70 backdrop-blur-md",onClick:a[2]||(a[2]=k=>c.value=!1)},[e("div",{class:"bg-black/20 border border-white/20 rounded-lg shadow-lg p-6 max-w-2xl w-full mx-4",onClick:a[1]||(a[1]=G(()=>{},["stop"]))},[e("div",ho,[a[9]||(a[9]=e("h3",{class:"text-lg font-semibold text-white"},"Transport Key",-1)),e("button",{onClick:a[0]||(a[0]=k=>c.value=!1),class:"text-white/60 hover:text-white transition-colors"},a[8]||(a[8]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("div",wo,[e("div",_o,u(t.node.transport_key),1)]),e("div",{class:"flex justify-end"},[e("button",{onClick:n,class:"px-4 py-2 bg-accent-green/20 hover:bg-accent-green/30 border border-accent-green/50 text-accent-green rounded-lg transition-colors flex items-center gap-2",title:"Copy to clipboard"},a[10]||(a[10]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})],-1),H(" Copy Key ",-1)]))])])])):L("",!0)])])):L("",!0),e("div",Co,[t.node.last_used?(o(),r("div",$o,[a[11]||(a[11]=e("svg",{class:"w-3 h-3 text-white/40",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),e("span",{class:"text-xs text-white/50",title:t.node.last_used.toLocaleString()},u(v(t.node.last_used)),9,Mo)])):(o(),r("div",Ao,a[12]||(a[12]=[e("svg",{class:"w-3 h-3 text-white/30",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})],-1),e("span",{class:"text-xs text-white/30 italic"},"Never",-1)]))),e("span",{class:D(["px-1.5 sm:px-2 py-0.5 text-[10px] sm:text-xs font-medium rounded-md transition-colors",t.node.floodPolicy==="allow"?"bg-accent-green/10 text-accent-green/90 border border-accent-green/20":"bg-accent-red/10 text-accent-red/90 border border-accent-red/20"])},u(t.node.floodPolicy==="allow"?"ALLOW":"DENY"),3),s.value?(o(),r("span",So," > "+u(t.node.children.length),1)):L("",!0)])],2),R(Ce,{"enter-active-class":"transition-all duration-300 ease-out","enter-from-class":"opacity-0 max-h-0 overflow-hidden","enter-to-class":"opacity-100 max-h-screen overflow-visible","leave-active-class":"transition-all duration-300 ease-in","leave-from-class":"opacity-100 max-h-screen overflow-visible","leave-to-class":"opacity-0 max-h-0 overflow-hidden"},{default:ve(()=>[p.value&&t.node.children.length>0?(o(),r("div",jo,[(o(!0),r(U,null,J(t.node.children,k=>(o(),xe(j,{key:k.id,node:k,"selected-node-id":t.selectedNodeId,level:t.level+1,disabled:i.disabled,onSelect:A},null,8,["node","selected-node-id","level","disabled"]))),128))])):L("",!0)]),_:1})])}}}),No=pe(To,[["__scopeId","data-v-59e9974c"]]),Bo={class:"flex items-center justify-between mb-6"},Eo={class:"text-content-secondary dark:text-content-muted text-sm mt-1"},Lo={key:0},Fo={class:"text-primary font-mono"},Po={key:1},zo={for:"keyName",class:"block text-sm font-medium text-white mb-2"},Vo={class:"flex items-center gap-2"},Do={key:0,class:"w-4 h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Io={key:1,class:"w-4 h-4 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ho={class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},Uo={class:"flex items-center gap-3 mb-2"},Ro={class:"flex items-center gap-2"},Ko={key:0,class:"w-5 h-5 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Oo={key:1,class:"w-5 h-5 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},qo={class:"text-content-secondary dark:text-content-muted text-sm"},Wo={class:"grid grid-cols-2 gap-3"},Go={class:"relative cursor-pointer group"},Qo={class:"relative cursor-pointer group"},Yo={class:"flex gap-3 pt-4"},Xo=["disabled"],Jo=q({__name:"AddKeyModal",props:{show:{type:Boolean},selectedNodeName:{},selectedNodeId:{}},emits:["close","add"],setup(I,{emit:_}){const i=I,x=_,g=m(""),c=m(""),p=m("allow"),s=T(()=>g.value.startsWith("#")),v=T(()=>({type:s.value?"Region":"Private Key",description:s.value?"Regional organizational key":"Individual assigned key"}));te(s,$=>{$?c.value="This will create a new region for organizing keys":c.value="This will create a new private key entry"},{immediate:!0});const f=T(()=>g.value.trim().length>0),h=()=>{f.value&&(x("add",{name:g.value.trim(),floodPolicy:p.value,parentId:i.selectedNodeId}),g.value="",c.value="",p.value="allow")},E=()=>{g.value="",c.value="",p.value="allow",x("close")},A=$=>{$.target===$.currentTarget&&E()};return($,n)=>$.show?(o(),r("div",{key:0,onClick:A,class:"fixed inset-0 bg-black/40 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[e("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-md border border-stroke-subtle dark:border-white/10",onClick:n[3]||(n[3]=G(()=>{},["stop"]))},[e("div",Bo,[e("div",null,[n[5]||(n[5]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Add New Entry",-1)),e("p",Eo,[i.selectedNodeName?(o(),r("span",Lo,[n[4]||(n[4]=H(" Add to: ",-1)),e("span",Fo,u(i.selectedNodeName),1)])):(o(),r("span",Po," Add to root level (#uk) "))])]),e("button",{onClick:E,class:"text-white/60 hover:text-white transition-colors"},n[6]||(n[6]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("form",{onSubmit:G(h,["prevent"]),class:"space-y-4"},[e("div",null,[e("label",zo,[e("div",Vo,[s.value?(o(),r("svg",Do,n[7]||(n[7]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",Io,n[8]||(n[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},null,-1)]))),n[9]||(n[9]=H(" Region/Key Name ",-1))])]),S(e("input",{id:"keyName","onUpdate:modelValue":n[0]||(n[0]=t=>g.value=t),type:"text",placeholder:"Enter name (prefix with # for regions)",class:"w-full px-4 py-3 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/50 focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors",autocomplete:"off"},null,512),[[V,g.value]])]),e("div",Ho,[e("div",Uo,[e("div",Ro,[s.value?(o(),r("svg",Ko,n[10]||(n[10]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",Oo,n[11]||(n[11]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1221 9z"},null,-1)]))),e("span",{class:D([s.value?"text-secondary":"text-accent-green","font-medium"])},u(v.value.type),3)]),e("div",{class:D(["flex-1 h-px",s.value?"bg-secondary/20":"bg-accent-green/20"])},null,2)]),e("p",qo,u(v.value.description),1)]),e("div",null,[n[14]||(n[14]=e("label",{class:"block text-sm font-medium text-content-primary dark:text-content-primary mb-3"},[e("div",{class:"flex items-center gap-2"},[e("svg",{class:"w-4 h-4 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})]),H(" Flood Policy ")])],-1)),e("div",Wo,[e("label",Go,[S(e("input",{type:"radio","onUpdate:modelValue":n[1]||(n[1]=t=>p.value=t),value:"allow",class:"sr-only"},null,512),[[ne,p.value]]),n[12]||(n[12]=W('<div class="flex items-center gap-3 p-3 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg group-has-[:checked]:border-accent-green/50 group-has-[:checked]:bg-accent-green/10 transition-colors"><div class="flex items-center justify-center w-4 h-4 border-2 border-stroke dark:border-stroke/30 rounded-full group-has-[:checked]:border-accent-green group-has-[:checked]:bg-accent-green transition-all"><div class="w-2 h-2 rounded-full bg-white scale-0 group-has-[:checked]:scale-100 transition-transform"></div></div><div class="flex-1"><div class="flex items-center gap-2"><svg class="w-4 h-4 text-accent-green" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg><span class="font-medium text-accent-green text-sm">Allow</span></div><p class="text-content-secondary dark:text-content-muted text-xs mt-1">Permit flooding</p></div></div>',1))]),e("label",Qo,[S(e("input",{type:"radio","onUpdate:modelValue":n[2]||(n[2]=t=>p.value=t),value:"deny",class:"sr-only"},null,512),[[ne,p.value]]),n[13]||(n[13]=W('<div class="flex items-center gap-3 p-3 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg group-has-[:checked]:border-accent-red/50 group-has-[:checked]:bg-accent-red/10 transition-colors"><div class="flex items-center justify-center w-4 h-4 border-2 border-stroke dark:border-stroke/30 rounded-full group-has-[:checked]:border-accent-red group-has-[:checked]:bg-accent-red transition-all"><div class="w-2 h-2 rounded-full bg-white scale-0 group-has-[:checked]:scale-100 transition-transform"></div></div><div class="flex-1"><div class="flex items-center gap-2"><svg class="w-4 h-4 text-accent-red" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg><span class="font-medium text-accent-red text-sm">Deny</span></div><p class="text-content-secondary dark:text-content-muted text-xs mt-1">Block flooding</p></div></div>',1))])])]),e("div",Yo,[e("button",{type:"button",onClick:E,class:"flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),e("button",{type:"submit",disabled:!f.value,class:D(["flex-1 px-4 py-3 rounded-lg transition-colors font-medium",f.value?"bg-accent-green/20 hover:bg-accent-green/30 border border-accent-green/50 text-accent-green":"bg-background-mute dark:bg-stroke/5 border border-stroke-subtle dark:border-stroke/20 text-content-muted dark:text-content-muted cursor-not-allowed"])}," Add "+u(v.value.type),11,Xo)])],32)])])):L("",!0)}}),Zo={class:"flex items-center justify-between mb-6"},er={class:"text-content-secondary dark:text-content-muted text-sm mt-1"},tr={class:"text-primary font-mono"},or={for:"keyName",class:"block text-sm font-medium text-content-secondary dark:text-content-primary mb-2"},rr={class:"flex items-center gap-2"},sr={key:0,class:"w-4 h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},nr={key:1,class:"w-4 h-4 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ar={class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},lr={class:"flex items-center gap-3 mb-2"},dr={class:"flex items-center gap-2"},ir={key:0,class:"w-5 h-5 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},cr={key:1,class:"w-5 h-5 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},ur={class:"text-content-secondary dark:text-content-muted text-sm"},mr={key:0,class:"space-y-4"},pr={key:0,class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},vr={class:"bg-background-mute dark:bg-black/20 border border-stroke-subtle dark:border-stroke/10 rounded-md p-3"},xr={class:"text-xs font-mono text-content-primary dark:text-content-primary/80 break-all"},br={key:1,class:"bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-4"},kr={class:"flex items-center justify-between"},gr={class:"text-sm text-content-secondary dark:text-content-muted"},yr={class:"text-xs text-content-muted dark:text-content-muted"},fr={class:"grid grid-cols-2 gap-3"},hr={class:"relative cursor-pointer group"},wr={class:"relative cursor-pointer group"},_r={class:"flex gap-3 pt-4"},Cr=["disabled"],$r=q({__name:"EditKeyModal",props:{show:{type:Boolean},node:{}},emits:["close","save","request-delete"],setup(I,{emit:_}){const i=I,x=_,g=m(""),c=m("allow"),p=T(()=>g.value.startsWith("#")),s=T(()=>({type:p.value?"Region":"Private Key",description:p.value?"Regional organizational key":"Individual assigned key"}));te(()=>i.node,t=>{t?(g.value=t.name,c.value=t.floodPolicy):(g.value="",c.value="allow")},{immediate:!0});const v=T(()=>g.value.trim().length>0&&i.node),f=t=>{const j=new Date().getTime()-t.getTime(),k=Math.floor(j/(1e3*60)),b=Math.floor(j/(1e3*60*60)),y=Math.floor(j/(1e3*60*60*24)),z=Math.floor(y/365);return k<60?`${k}m ago`:b<24?`${b}h ago`:y<365?`${y}d ago`:`${z}y ago`},h=t=>{window.navigator?.clipboard&&window.navigator.clipboard.writeText(t)},E=()=>{!v.value||!i.node||(x("save",{id:i.node.id,name:g.value.trim(),floodPolicy:c.value}),$())},A=()=>{i.node&&(x("request-delete",i.node),$())},$=()=>{x("close")},n=t=>{t.target===t.currentTarget&&$()};return(t,a)=>t.show?(o(),r("div",{key:0,onClick:n,class:"fixed inset-0 bg-black/50 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[e("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-lg border border-stroke-subtle dark:border-white/10",onClick:a[4]||(a[4]=G(()=>{},["stop"]))},[e("div",Zo,[e("div",null,[a[6]||(a[6]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Edit Entry",-1)),e("p",er,[a[5]||(a[5]=H(" Modify ",-1)),e("span",tr,u(t.node?.name),1)])]),e("button",{onClick:$,class:"text-white/60 hover:text-white transition-colors"},a[7]||(a[7]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),e("form",{onSubmit:G(E,["prevent"]),class:"space-y-4"},[e("div",null,[e("label",or,[e("div",rr,[p.value?(o(),r("svg",sr,a[8]||(a[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",nr,a[9]||(a[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z"},null,-1)]))),a[10]||(a[10]=H(" Region/Key Name ",-1))])]),S(e("input",{id:"keyName","onUpdate:modelValue":a[0]||(a[0]=j=>g.value=j),type:"text",placeholder:"Enter name (prefix with # for regions)",class:"w-full px-4 py-3 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/50 focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors",autocomplete:"off"},null,512),[[V,g.value]])]),e("div",ar,[e("div",lr,[e("div",dr,[p.value?(o(),r("svg",ir,a[11]||(a[11]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",cr,a[12]||(a[12]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z"},null,-1)]))),e("span",{class:D([p.value?"text-secondary":"text-accent-green","font-medium"])},u(s.value.type),3)]),e("div",{class:D(["flex-1 h-px",p.value?"bg-secondary/20":"bg-accent-green/20"])},null,2)]),e("p",ur,u(s.value.description),1)]),t.node?(o(),r("div",mr,[t.node.transport_key?(o(),r("div",pr,[a[14]||(a[14]=W('<div class="flex items-center gap-2 mb-3"><svg class="w-4 h-4 text-primary" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"></path><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z"></path></svg><span class="text-sm font-medium text-content-primary dark:text-content-primary">Transport Key</span></div>',1)),e("div",vr,[e("div",xr,u(t.node.transport_key),1),e("button",{onClick:a[1]||(a[1]=j=>h(t.node.transport_key||"")),class:"mt-2 text-xs text-accent-green hover:text-accent-green/80 flex items-center gap-1",title:"Copy to clipboard"},a[13]||(a[13]=[e("svg",{class:"w-3 h-3",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})],-1),H(" Copy Key ",-1)]))])])):L("",!0),t.node.last_used?(o(),r("div",br,[a[15]||(a[15]=e("div",{class:"flex items-center gap-2 mb-3"},[e("svg",{class:"w-4 h-4 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})]),e("span",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Last Used")],-1)),e("div",kr,[e("div",gr,u(t.node.last_used.toLocaleDateString())+" at "+u(t.node.last_used.toLocaleTimeString()),1),e("div",yr,u(f(t.node.last_used)),1)])])):L("",!0)])):L("",!0),e("div",null,[a[18]||(a[18]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-primary mb-3"},[e("div",{class:"flex items-center gap-2"},[e("svg",{class:"w-4 h-4 text-primary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"})]),H(" Flood Policy ")])],-1)),e("div",fr,[e("label",hr,[S(e("input",{type:"radio","onUpdate:modelValue":a[2]||(a[2]=j=>c.value=j),value:"allow",class:"sr-only"},null,512),[[ne,c.value]]),a[16]||(a[16]=W('<div class="flex items-center gap-3 p-3 bg-white/5 border border-white/20 rounded-lg group-has-[:checked]:border-accent-green/50 group-has-[:checked]:bg-accent-green/10 transition-colors"><div class="flex items-center justify-center w-4 h-4 border-2 border-white/30 rounded-full group-has-[:checked]:border-accent-green group-has-[:checked]:bg-accent-green transition-all"><div class="w-2 h-2 rounded-full bg-white scale-0 group-has-[:checked]:scale-100 transition-transform"></div></div><div class="flex-1"><div class="flex items-center gap-2"><svg class="w-4 h-4 text-accent-green" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path></svg><span class="font-medium text-accent-green text-sm">Allow</span></div><p class="text-content-muted dark:text-content-muted text-xs mt-1">Permit flooding</p></div></div>',1))]),e("label",wr,[S(e("input",{type:"radio","onUpdate:modelValue":a[3]||(a[3]=j=>c.value=j),value:"deny",class:"sr-only"},null,512),[[ne,c.value]]),a[17]||(a[17]=W('<div class="flex items-center gap-3 p-3 bg-gray-50 dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg group-has-[:checked]:border-accent-red/50 group-has-[:checked]:bg-accent-red/10 transition-colors"><div class="flex items-center justify-center w-4 h-4 border-2 border-stroke dark:border-stroke/30 rounded-full group-has-[:checked]:border-accent-red group-has-[:checked]:bg-accent-red transition-all"><div class="w-2 h-2 rounded-full bg-white scale-0 group-has-[:checked]:scale-100 transition-transform"></div></div><div class="flex-1"><div class="flex items-center gap-2"><svg class="w-4 h-4 text-accent-red" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"></path></svg><span class="font-medium text-accent-red text-sm">Deny</span></div><p class="text-content-muted dark:text-content-muted text-xs mt-1">Block flooding</p></div></div>',1))])])]),e("div",_r,[e("button",{type:"button",onClick:A,class:"px-4 py-3 bg-accent-red/20 hover:bg-accent-red/30 border border-accent-red/50 text-accent-red rounded-lg transition-colors"}," Delete "),e("button",{type:"button",onClick:$,class:"flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),e("button",{type:"submit",disabled:!v.value,class:D(["flex-1 px-4 py-3 rounded-lg transition-colors font-medium",v.value?"bg-accent-green/20 hover:bg-accent-green/30 border border-accent-green/50 text-accent-green":"bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 text-content-muted dark:text-content-muted/70 cursor-not-allowed"])}," Save Changes ",10,Cr)])],32)])])):L("",!0)}}),Mr={class:"flex items-center gap-3 mb-6"},Ar={class:"text-content-secondary dark:text-content-muted text-sm mt-1"},Sr={class:"text-accent-red font-mono"},jr={key:0,class:"bg-accent-red/10 border border-accent-red/30 rounded-lg p-4 mb-6"},Tr={class:"flex items-start gap-3"},Nr={class:"flex-1"},Br={class:"text-accent-red font-medium text-sm mb-2"},Er={class:"space-y-1 max-h-32 overflow-y-auto"},Lr={key:0,class:"w-3 h-3 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Fr={key:1,class:"w-3 h-3 text-accent-green",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Pr={class:"font-mono"},zr={key:0,class:"text-content-secondary dark:text-content-muted text-xs"},Vr={key:1,class:"mb-6"},Dr={class:"mb-3"},Ir={class:"relative"},Hr={class:"space-y-2 max-h-40 overflow-y-auto border border-stroke-subtle dark:border-stroke/20 rounded-lg p-3 bg-gray-50 dark:bg-white/5"},Ur={key:0,class:"text-center py-4 text-content-secondary dark:text-content-muted text-sm"},Rr={class:"relative"},Kr=["value"],Or={class:"flex items-center gap-2 flex-1"},qr={class:"text-content-primary dark:text-content-primary font-mono text-sm"},Wr={key:0,class:"ml-auto px-2 py-0.5 bg-background-mute dark:bg-stroke/10 text-content-secondary dark:text-content-muted text-xs rounded-full"},Gr={class:"flex gap-3"},Qr=q({__name:"DeleteConfirmModal",props:{show:{type:Boolean},node:{},allNodes:{}},emits:["close","delete-all","move-children"],setup(I,{emit:_}){const i=I,x=_,g=m(null),c=m(""),p=n=>{const t=[],a=j=>{for(const k of j.children)t.push(k),a(k)};return a(n),t},s=T(()=>i.node?p(i.node):[]),v=T(()=>{if(!i.node)return[];const n=new Set([i.node.id,...s.value.map(a=>a.id)]),t=a=>{const j=[];for(const k of a)k.name.startsWith("#")&&!n.has(k.id)&&j.push(k),k.children.length>0&&j.push(...t(k.children));return j};return t(i.allNodes)}),f=T(()=>{if(!c.value.trim())return v.value;const n=c.value.toLowerCase();return v.value.filter(t=>t.name.toLowerCase().includes(n))}),h=()=>{i.node&&(x("delete-all",i.node.id),A())},E=()=>{!i.node||!g.value||(x("move-children",{nodeId:i.node.id,targetParentId:g.value}),A())},A=()=>{g.value=null,c.value="",x("close")},$=n=>{n.target===n.currentTarget&&A()};return(n,t)=>n.show&&n.node?(o(),r("div",{key:0,onClick:$,class:"fixed inset-0 bg-black/80 backdrop-blur-lg z-[99999] flex items-center justify-center p-4",style:{"backdrop-filter":"blur(8px) saturate(180%)",position:"fixed",top:"0",left:"0",right:"0",bottom:"0"}},[e("div",{class:"bg-white dark:bg-surface-elevated backdrop-blur-xl rounded-[20px] p-6 w-full max-w-lg border border-stroke-subtle dark:border-white/10",onClick:t[2]||(t[2]=G(()=>{},["stop"]))},[e("div",Mr,[t[6]||(t[6]=e("svg",{class:"w-6 h-6 text-accent-red",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-2.5L13.732 4c-.77-.833-1.964-.833-2.732 0L3.732 16.5c-.77.833.192 2.5 1.732 2.5z"})],-1)),e("div",null,[t[4]||(t[4]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"Confirm Deletion",-1)),e("p",Ar,[t[3]||(t[3]=H(" Deleting ",-1)),e("span",Sr,u(n.node?.name),1)])]),e("button",{onClick:A,class:"ml-auto text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-primary transition-colors"},t[5]||(t[5]=[e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),s.value.length>0?(o(),r("div",jr,[e("div",Tr,[t[9]||(t[9]=e("svg",{class:"w-5 h-5 text-accent-red flex-shrink-0 mt-0.5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),e("div",Nr,[e("h4",Br," This will affect "+u(s.value.length)+" child "+u(s.value.length===1?"entry":"entries")+": ",1),e("div",Er,[(o(!0),r(U,null,J(s.value.slice(0,10),a=>(o(),r("div",{key:a.id,class:"flex items-center gap-2 text-xs text-content-secondary dark:text-content-primary/80"},[a.name.startsWith("#")?(o(),r("svg",Lr,t[7]||(t[7]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"},null,-1)]))):(o(),r("svg",Fr,t[8]||(t[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1721 9z"},null,-1)]))),e("span",Pr,u(a.name),1),e("span",{class:D(["px-1 py-0.5 text-xs rounded",a.floodPolicy==="allow"?"bg-accent-green/20 text-accent-green":"bg-accent-red/20 text-accent-red"])},u(a.floodPolicy),3)]))),128)),s.value.length>10?(o(),r("div",zr," ...and "+u(s.value.length-10)+" more ",1)):L("",!0)])])])])):L("",!0),s.value.length>0&&v.value.length>0?(o(),r("div",Vr,[t[13]||(t[13]=e("h4",{class:"text-content-primary dark:text-content-primary font-medium text-sm mb-3"},"Move children to another region:",-1)),e("div",Dr,[e("div",Ir,[t[10]||(t[10]=e("svg",{class:"absolute left-3 top-1/2 transform -translate-y-1/2 w-4 h-4 text-content-muted dark:text-content-muted",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"})],-1)),S(e("input",{"onUpdate:modelValue":t[0]||(t[0]=a=>c.value=a),type:"text",placeholder:"Search regions...",class:"w-full pl-9 pr-4 py-2 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/20 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-500 dark:placeholder-white/50 focus:outline-none focus:border-primary focus:ring-2 focus:ring-primary/20 transition-colors text-sm"},null,512),[[V,c.value]])])]),e("div",Hr,[f.value.length===0?(o(),r("div",Ur,u(c.value?"No regions match your search":"No available regions"),1)):L("",!0),(o(!0),r(U,null,J(f.value,a=>(o(),r("label",{key:a.id,class:"flex items-center gap-3 p-2 rounded cursor-pointer hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors group"},[e("div",Rr,[S(e("input",{type:"radio",value:a.id,"onUpdate:modelValue":t[1]||(t[1]=j=>g.value=j),class:"sr-only peer"},null,8,Kr),[[ne,g.value]]),t[11]||(t[11]=e("div",{class:"w-4 h-4 border-2 border-stroke dark:border-stroke/30 rounded-full group-hover:border-stroke dark:group-hover:border-stroke/50 peer-checked:border-primary peer-checked:bg-primary/20 transition-all"},[e("div",{class:"w-2 h-2 rounded-full bg-primary scale-0 peer-checked:scale-100 transition-transform absolute top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2"})],-1))]),e("div",Or,[t[12]||(t[12]=e("svg",{class:"w-4 h-4 text-secondary",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M7 20l4-16m2 16l4-16M6 9h14M4 15h14"})],-1)),e("span",qr,u(a.name),1),a.children.length>0?(o(),r("span",Wr,u(a.children.length),1)):L("",!0)])]))),128))])])):L("",!0),e("div",Gr,[e("button",{onClick:A,class:"flex-1 px-4 py-3 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 border border-stroke-subtle dark:border-stroke/20 text-content-primary dark:text-content-primary rounded-lg transition-colors"}," Cancel "),s.value.length>0&&g.value?(o(),r("button",{key:0,onClick:E,class:"flex-1 px-4 py-3 bg-primary/20 hover:bg-primary/30 border border-primary/50 text-primary rounded-lg transition-colors"}," Move & Delete ")):L("",!0),e("button",{onClick:h,class:"flex-1 px-4 py-3 bg-accent-red/20 hover:bg-accent-red/30 border border-accent-red/50 text-accent-red rounded-lg transition-colors font-medium"},u(s.value.length>0?"Delete All":"Delete"),1)])])])):L("",!0)}}),Yr={class:"space-y-4 sm:space-y-6"},Xr={class:"flex flex-col sm:flex-row sm:justify-between sm:items-start gap-3"},Jr={class:"flex gap-2 flex-wrap"},Zr=["disabled"],es=["disabled"],ts=["disabled"],os={class:"glass-card rounded-[15px] p-3 sm:p-4 border border-stroke-subtle dark:border-stroke/10 bg-background-mute dark:bg-white/5"},rs={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"},ss={class:"flex items-center gap-2 sm:gap-3"},ns={class:"flex bg-background-mute dark:bg-stroke/5 rounded-lg border border-stroke-subtle dark:border-stroke/20 p-0.5 sm:p-1"},as={class:"glass-card rounded-[15px] p-3 sm:p-6 border border-stroke-subtle dark:border-stroke/10"},ls={key:0,class:"flex items-center justify-center py-8"},ds={key:1,class:"text-center py-8"},is={class:"text-content-secondary dark:text-content-muted text-sm"},cs={key:2,class:"text-center py-8"},us={key:3,class:"space-y-2"},ms=q({name:"TransportKeys",__name:"TransportKeys",setup(I){const _=ke(),i=m(!1),x=m(!1),g=m(!1),c=m(null),p=m(null),s=m("deny"),v=m([]),f=m(!1),h=m(null),E=M=>{const d=new Map,w=[];return M.forEach(F=>{const se={id:F.id,name:F.name,floodPolicy:F.flood_policy,transport_key:F.transport_key,last_used:F.last_used?new Date(F.last_used*1e3):void 0,parent_id:F.parent_id,children:[]};d.set(F.id,se)}),d.forEach(F=>{F.parent_id&&d.has(F.parent_id)?d.get(F.parent_id).children.push(F):w.push(F)}),w},A=async()=>{try{f.value=!0,h.value=null;const M=await K.getTransportKeys();M.success&&M.data?v.value=E(M.data):h.value=M.error||"Failed to load transport keys"}catch(M){h.value=M instanceof Error?M.message:"Unknown error occurred",console.error("Error loading transport keys:",M)}finally{f.value=!1}};ae(()=>{A()});function $(M,d){for(const w of M){if(w.id===d)return w;if(w.children){const F=$(w.children,d);if(F)return F}}return null}function n(){const M=_.selectedNodeId.value;return M?$(v.value,M)?.name:void 0}function t(M){s.value==="deny"&&_.setSelectedNode(M)}function a(){s.value==="deny"&&(i.value=!0)}function j(){if(s.value==="deny"&&_.selectedNodeId.value){const M=$(v.value,_.selectedNodeId.value);M&&(p.value=M,g.value=!0)}}function k(){if(s.value==="deny"&&_.selectedNodeId.value){const M=$(v.value,_.selectedNodeId.value);M&&(c.value=M,x.value=!0)}}const b=async M=>{try{const d=await K.createTransportKey(M.name,M.floodPolicy,void 0,M.parentId,void 0);d.success?await A():(console.error("Failed to add transport key:",d.error),h.value=d.error||"Failed to add transport key")}catch(d){console.error("Error adding transport key:",d),h.value=d instanceof Error?d.message:"Unknown error occurred"}finally{i.value=!1}};function y(){i.value=!1}async function z(M){try{const d=M==="allow",w=await K.updateGlobalFloodPolicy(d);w.success?s.value=M:(console.error("Failed to update global flood policy:",w.error),h.value=w.error||"Failed to update global flood policy")}catch(d){console.error("Error updating global flood policy:",d),h.value=d instanceof Error?d.message:"Failed to update global flood policy"}}function O(){x.value=!1,c.value=null}async function C(M){try{const d=await K.updateTransportKey(M.id,M.name,M.floodPolicy);d.success?await A():(console.error("Failed to update transport key:",d.error),h.value=d.error||"Failed to update transport key")}catch(d){console.error("Error updating transport key:",d),h.value=d instanceof Error?d.message:"Unknown error occurred"}finally{O()}}function N(M){x.value=!1,c.value=null,p.value=M,g.value=!0}function P(){g.value=!1,p.value=null}async function oe(M){try{const d=await K.deleteTransportKey(M);d.success?(await A(),_.setSelectedNode(null)):(console.error("Failed to delete transport key:",d.error),h.value=d.error||"Failed to delete transport key")}catch(d){console.error("Error deleting transport key:",d),h.value=d instanceof Error?d.message:"Unknown error occurred"}finally{P()}}async function Y(M){try{const d=await K.deleteTransportKey(M.nodeId);d.success?(await A(),_.setSelectedNode(null)):(console.error("Failed to delete transport key:",d.error),h.value=d.error||"Failed to delete transport key")}catch(d){console.error("Error deleting transport key:",d),h.value=d instanceof Error?d.message:"Unknown error occurred"}finally{P()}}return(M,d)=>(o(),r("div",Yr,[e("div",Xr,[d[3]||(d[3]=e("div",null,[e("h3",{class:"text-base sm:text-lg font-semibold text-content-primary dark:text-content-primary mb-1 sm:mb-2"},"Regions/Keys"),e("p",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Manage regional key hierarchy")],-1)),e("div",Jr,[e("button",{onClick:a,disabled:s.value==="allow",class:D(["flex items-center gap-1.5 sm:gap-2 px-2.5 sm:px-3 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm",s.value==="allow"?"bg-background-mute dark:bg-white/5 text-content-muted dark:text-content-muted/70 border-stroke-subtle dark:border-stroke/20 cursor-not-allowed":"bg-accent-green/10 hover:bg-accent-green/20 text-accent-green border-accent-green/30"])},d[2]||(d[2]=[e("svg",{class:"w-3.5 h-3.5 sm:w-4 sm:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),H(" Add ",-1)]),10,Zr),e("button",{onClick:k,disabled:!X(_).selectedNodeId.value||s.value==="allow",class:D(["px-2.5 sm:px-4 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm",!X(_).selectedNodeId.value||s.value==="allow"?"bg-background-mute dark:bg-stroke/10 text-content-muted dark:text-content-muted/70 border-stroke-subtle dark:border-stroke/20 cursor-not-allowed":"bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border-accent-green/50"])}," Edit ",10,es),e("button",{onClick:j,disabled:!X(_).selectedNodeId.value||s.value==="allow",class:D(["px-2.5 sm:px-4 py-1.5 sm:py-2 rounded-lg border transition-colors text-xs sm:text-sm",!X(_).selectedNodeId.value||s.value==="allow"?"bg-background-mute dark:bg-stroke/10 text-content-muted dark:text-content-muted/70 border-stroke-subtle dark:border-stroke/20 cursor-not-allowed":"bg-accent-red/20 hover:bg-accent-red/30 text-accent-red border-accent-red/50"])}," Delete ",10,ts)])]),e("div",os,[e("div",rs,[d[4]||(d[4]=e("div",null,[e("h4",{class:"text-xs sm:text-sm font-medium text-content-primary dark:text-content-primary mb-1"},"Global Flood Policy (*)"),e("p",{class:"text-content-secondary dark:text-content-muted text-[10px] sm:text-xs"},"Master control for repeater flooding")],-1)),e("div",ss,[e("div",ns,[e("button",{onClick:d[0]||(d[0]=w=>z("deny")),class:D(["px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors",s.value==="deny"?"bg-accent-red/20 text-accent-red border border-accent-red/50":"text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary"])}," DENY ",2),e("button",{onClick:d[1]||(d[1]=w=>z("allow")),class:D(["px-2 sm:px-3 py-1 text-[10px] sm:text-xs font-medium rounded transition-colors",s.value==="allow"?"bg-accent-green/20 text-accent-green border border-accent-green/50":"text-content-secondary dark:text-content-muted hover:text-content-primary dark:hover:text-content-secondary"])}," ALLOW ",2)])])])]),e("div",as,[f.value?(o(),r("div",ls,d[5]||(d[5]=[e("div",{class:"animate-spin rounded-full h-8 w-8 border-b-2 border-accent-green"},null,-1),e("span",{class:"ml-2 text-content-secondary dark:text-content-muted"},"Loading transport keys...",-1)]))):h.value?(o(),r("div",ds,[d[6]||(d[6]=e("div",{class:"text-accent-red mb-2"},"⚠️ Error loading transport keys",-1)),e("div",is,u(h.value),1),e("button",{onClick:A,class:"mt-4 px-4 py-2 bg-accent-green/20 hover:bg-accent-green/30 text-accent-green border border-accent-green/50 rounded-lg transition-colors"}," Retry ")])):v.value.length===0?(o(),r("div",cs,d[7]||(d[7]=[e("div",{class:"text-content-muted dark:text-content-muted mb-2"},"📝 No transport keys found",-1),e("div",{class:"text-content-muted dark:text-content-muted/60 text-sm"},"Add your first transport key to get started",-1)]))):(o(),r("div",us,[(o(!0),r(U,null,J(v.value,w=>(o(),xe(No,{key:w.id,node:w,"selected-node-id":X(_).selectedNodeId.value,level:0,disabled:s.value==="allow",onSelect:t},null,8,["node","selected-node-id","disabled"]))),128))]))]),R(Jo,{show:i.value,"selected-node-name":n(),"selected-node-id":X(_).selectedNodeId.value||void 0,onClose:y,onAdd:b},null,8,["show","selected-node-name","selected-node-id"]),R($r,{show:x.value,node:c.value,onClose:O,onSave:C,onRequestDelete:N},null,8,["show","node"]),R(Qr,{show:g.value,node:p.value,"all-nodes":v.value,onClose:P,onDeleteAll:oe,onMoveChildren:Y},null,8,["show","node","all-nodes"])]))}}),ps={class:"space-y-4 sm:space-y-6"},vs={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"},xs={key:0,class:"bg-red-500/10 border border-red-500/30 rounded-lg p-4"},bs={class:"flex items-center gap-2 text-red-600 dark:text-red-400"},ks={key:1,class:"flex items-center justify-center py-12"},gs={key:2,class:"space-y-3"},ys={class:"flex flex-col sm:flex-row sm:items-center sm:justify-between gap-3"},fs={class:"flex-1"},hs={class:"flex items-center gap-2 sm:gap-3"},ws={class:"min-w-0 flex-1"},_s={class:"text-content-primary dark:text-content-primary font-medium text-sm sm:text-base break-all"},Cs={class:"flex flex-col sm:flex-row sm:items-center sm:gap-4 mt-1 text-xs text-content-secondary dark:text-content-muted"},$s={class:"truncate"},Ms={class:"truncate"},As=["onClick","disabled"],Ss={key:3,class:"text-center py-12"},js={class:"bg-surface dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke/20 rounded-[15px] p-6 max-w-md w-full shadow-2xl"},Ts={class:"space-y-4"},Ns={class:"flex justify-end gap-3 mt-6"},Bs=["disabled"],Es=["disabled"],Ls={class:"bg-surface dark:bg-surface-elevated border border-stroke-subtle dark:border-stroke/20 rounded-[15px] p-6 max-w-lg w-full shadow-2xl"},Fs={class:"space-y-4"},Ps={class:"flex gap-2"},zs=["value"],Vs={class:"bg-blue-500/10 border border-blue-500/30 rounded-lg p-4"},Ds={class:"block bg-blue-500/20 px-3 py-2 rounded text-xs text-blue-100 font-mono overflow-x-auto"},Is=q({name:"APITokens",__name:"APITokens",setup(I){const _=m([]),i=m(!1),x=m(null),g=m(!1),c=m(""),p=m(null),s=m(!1),v=m(!1),f=m(null),h=async()=>{i.value=!0,x.value=null;try{const b=await K.get("/auth/tokens"),y=b.data||b;_.value=y.tokens||[]}catch(b){console.error("Failed to fetch API tokens:",b),x.value=b instanceof Error?b.message:"Failed to fetch tokens"}finally{i.value=!1}},E=async()=>{if(!c.value.trim()){x.value="Token name is required";return}i.value=!0,x.value=null;try{const b=await K.post("/auth/tokens",{name:c.value.trim()}),y=b.data||b;p.value=y.token||null,g.value=!1,s.value=!0,c.value="",await h()}catch(b){console.error("Failed to create API token:",b),x.value=b instanceof Error?b.message:"Failed to create token"}finally{i.value=!1}},A=(b,y)=>{f.value={id:b,name:y},v.value=!0},$=async()=>{if(f.value){i.value=!0,x.value=null;try{await K.delete(`/auth/tokens/${f.value.id}`),await h(),v.value=!1,f.value=null}catch(b){console.error("Failed to revoke API token:",b),x.value=b instanceof Error?b.message:"Failed to revoke token"}finally{i.value=!1}}},n=()=>{g.value=!1,c.value="",x.value=null},t=()=>{s.value=!1,p.value=null},a=()=>{p.value&&navigator.clipboard.writeText(p.value)},j=b=>b?new Date(b*1e3).toLocaleString():"Never",k=T(()=>`${window.location.origin}/api/stats`);return ae(()=>{h()}),(b,y)=>(o(),r(U,null,[e("div",ps,[e("div",vs,[y[5]||(y[5]=e("div",null,[e("h2",{class:"text-lg sm:text-xl font-semibold text-content-primary dark:text-content-primary"},"API Tokens"),e("p",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm mt-1"},"Manage API tokens for machine-to-machine authentication")],-1)),e("button",{onClick:y[0]||(y[0]=z=>g.value=!0),class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors flex items-center justify-center gap-2 text-sm sm:text-base"},y[4]||(y[4]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 4v16m8-8H4"})],-1),H(" Create Token ",-1)]))]),y[20]||(y[20]=W('<div class="bg-blue-500/10 border border-blue-500/30 rounded-lg p-3 sm:p-4"><div class="flex gap-2 sm:gap-3"><svg class="w-4 h-4 sm:w-5 sm:h-5 text-blue-600 dark:text-blue-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg><div class="text-xs sm:text-sm text-blue-700 dark:text-blue-200"><p><strong>API tokens</strong> are used for machine-to-machine authentication. Include the token in the <code class="bg-blue-500/20 px-1 rounded">X-API-Key</code> header when making API requests.</p><p class="mt-2">Tokens are only shown once at creation. Store them securely.</p></div></div></div>',1)),x.value?(o(),r("div",xs,[e("div",bs,[y[6]||(y[6]=e("svg",{class:"w-5 h-5",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),H(" "+u(x.value),1)])])):L("",!0),i.value&&_.value.length===0?(o(),r("div",ks,y[7]||(y[7]=[e("div",{class:"text-center"},[e("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-primary rounded-full mx-auto mb-4"}),e("div",{class:"text-content-secondary dark:text-content-muted"},"Loading tokens...")],-1)]))):_.value.length>0?(o(),r("div",gs,[(o(!0),r(U,null,J(_.value,z=>(o(),r("div",{key:z.id,class:"bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg p-3 sm:p-4 hover:bg-stroke-subtle dark:hover:bg-white/10 transition-colors"},[e("div",ys,[e("div",fs,[e("div",hs,[y[8]||(y[8]=e("svg",{class:"w-4 h-4 sm:w-5 sm:h-5 text-primary flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})],-1)),e("div",ws,[e("h3",_s,u(z.name),1),e("div",Cs,[e("span",$s,"Created: "+u(j(z.created_at)),1),e("span",Ms,"Last used: "+u(j(z.last_used)),1)])])])]),e("button",{onClick:O=>A(z.id,z.name),disabled:i.value,class:"w-full sm:w-auto px-3 py-1.5 bg-red-100 dark:bg-red-500/20 hover:bg-red-500/30 text-red-600 dark:text-red-400 rounded-lg border border-red-500/50 transition-colors disabled:opacity-50 text-sm"}," Revoke ",8,As)])]))),128))])):(o(),r("div",Ss,[y[9]||(y[9]=e("svg",{class:"w-16 h-16 text-content-muted dark:text-content-muted/40 mx-auto mb-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"})],-1)),y[10]||(y[10]=e("h3",{class:"text-content-primary dark:text-content-primary font-medium mb-2"},"No API Tokens",-1)),y[11]||(y[11]=e("p",{class:"text-content-secondary dark:text-content-muted text-sm mb-4"},"Create a token to enable API access",-1)),e("button",{onClick:y[1]||(y[1]=z=>g.value=!0),class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors"}," Create Your First Token ")])),g.value?(o(),r("div",{key:4,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:G(n,["self"])},[e("div",js,[y[14]||(y[14]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary mb-4"},"Create API Token",-1)),e("div",Ts,[e("div",null,[y[12]||(y[12]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Token Name",-1)),S(e("input",{"onUpdate:modelValue":y[2]||(y[2]=z=>c.value=z),type:"text",placeholder:"e.g., Production Server, CI/CD Pipeline",class:"w-full px-4 py-2 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary placeholder-gray-400 dark:placeholder-white/40 focus:outline-none focus:border-primary transition-colors",onKeydown:$e(E,["enter"])},null,544),[[V,c.value]]),y[13]||(y[13]=e("p",{class:"text-xs text-content-muted dark:text-content-muted mt-1"},"Give your token a descriptive name to identify its purpose",-1))]),e("div",Ns,[e("button",{onClick:n,disabled:i.value,class:"px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/10 transition-colors disabled:opacity-50"}," Cancel ",8,Bs),e("button",{onClick:E,disabled:i.value||!c.value.trim(),class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors disabled:opacity-50"},u(i.value?"Creating...":"Create Token"),9,Es)])])])])):L("",!0),s.value&&p.value?(o(),r("div",{key:5,class:"fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-sm",onClick:G(t,["self"])},[e("div",Ls,[y[19]||(y[19]=e("h3",{class:"text-xl font-semibold text-content-primary dark:text-content-primary mb-4"},"Token Created Successfully",-1)),e("div",Fs,[y[18]||(y[18]=W('<div class="bg-yellow-500/10 border border-yellow-500/30 rounded-lg p-4"><div class="flex gap-3"><svg class="w-5 h-5 text-yellow-600 dark:text-yellow-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><div class="text-sm text-yellow-200"><strong>Save this token now!</strong> For security reasons, it will not be shown again. </div></div></div>',1)),e("div",null,[y[16]||(y[16]=e("label",{class:"block text-sm font-medium text-content-secondary dark:text-content-muted mb-2"},"Your API Token",-1)),e("div",Ps,[e("input",{value:p.value,readonly:"",class:"flex-1 px-4 py-2 bg-background-mute dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary font-mono text-sm"},null,8,zs),e("button",{onClick:a,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors flex items-center gap-2",title:"Copy to clipboard"},y[15]||(y[15]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8 16H6a2 2 0 01-2-2V6a2 2 0 012-2h8a2 2 0 012 2v2m-6 12h8a2 2 0 002-2v-8a2 2 0 00-2-2h-8a2 2 0 00-2 2v8a2 2 0 002 2z"})],-1),H(" Copy ",-1)]))])]),e("div",Vs,[y[17]||(y[17]=e("p",{class:"text-sm text-blue-200 mb-2"},[e("strong",null,"Usage Example:")],-1)),e("code",Ds,' curl -H "X-API-Key: '+u(p.value)+'" '+u(k.value),1)]),e("div",{class:"flex justify-end mt-6"},[e("button",{onClick:t,class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors"}," Done ")])])])])):L("",!0)]),R(Me,{show:v.value,title:"Revoke API Token",message:`Are you sure you want to revoke the token '${f.value?.name}'? This action cannot be undone.`,"confirm-text":"Revoke","cancel-text":"Cancel",variant:"danger",onConfirm:$,onClose:y[3]||(y[3]=z=>v.value=!1)},null,8,["show","message"])],64))}}),Hs={class:"space-y-6"},Us={class:"glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6"},Rs={class:"space-y-4"},Ks={class:"flex items-center justify-between"},Os=["disabled"],qs={class:"glass-card rounded-lg border border-stroke-subtle dark:border-stroke/10 p-6"},Ws={class:"space-y-4"},Gs={class:"space-y-3"},Qs=["checked","disabled"],Ys=["checked","disabled"],Xs={class:"flex items-start gap-3"},Js={key:0,class:"w-5 h-5 text-green-600 dark:text-green-400 flex-shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},Zs={key:1,class:"w-5 h-5 text-accent-cyan flex-shrink-0 mt-0.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},en={class:"flex-1"},tn={class:"text-sm font-medium text-content-primary dark:text-content-primary"},on={key:0,class:"text-xs text-green-600 dark:text-green-400 mt-1"},rn={key:1,class:"p-4 bg-amber-500/10 border border-amber-500/30 rounded-lg"},sn={class:"flex items-start justify-between gap-3"},nn=["disabled"],an={key:0,class:"animate-spin h-4 w-4",fill:"none",viewBox:"0 0 24 24"},ln={key:1,class:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},dn={class:"flex items-center space-x-2"},cn={key:0,class:"w-5 h-5 text-green-600 dark:text-green-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},un={key:1,class:"w-5 h-5 text-red-600 dark:text-red-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},mn=q({name:"WebSettings",__name:"WebSettings",setup(I){const _=m(!1),i=m(""),x=m(!1),g=m(!1),c=m(!1),p=m(!1),s=m(!0),v=ce({cors_enabled:!1,use_default_frontend:!0}),f=T(()=>x.value?"bg-green-500/10 border-green-600/40 dark:border-green-500/30":"bg-red-500/10 border-red-500/30");async function h(){try{s.value=!0;const k=await K.get("/check_pymc_console");k.success&&k.data&&(p.value=k.data.exists,console.log("PyMC Console exists:",p.value))}catch(k){console.error("Failed to check PyMC Console:",k),p.value=!1}finally{s.value=!1}}async function E(){try{const k=await K.get("/stats");console.log("WebSettings: Full response:",k);let b=null;if(k.success&&k.data?b=k.data:k&&"version"in k&&(b=k),b){const y=b.config?.web||{};console.log("WebSettings: webConfig:",y),v.cors_enabled=y.cors_enabled===!0,console.log("WebSettings: Set cors_enabled to:",v.cors_enabled);const z=y.web_path;v.use_default_frontend=!z||z==="",console.log("WebSettings: Set use_default_frontend to:",v.use_default_frontend,"from web_path:",z)}}catch(k){console.error("Failed to load web settings:",k),a("Failed to load settings",!1)}}async function A(){_.value=!0,i.value="";try{const k={web:{cors_enabled:v.cors_enabled}};v.use_default_frontend?k.web.web_path=null:k.web.web_path="/opt/pymc_console/web/html";const b=await K.post("/update_web_config",k);b.success?(a("Settings saved successfully",!0),g.value=!0):a(b.error||"Failed to save settings",!1)}catch(k){console.error("Failed to save web settings:",k),a(k.message||"Failed to save settings",!1)}finally{_.value=!1}}async function $(){v.cors_enabled=!v.cors_enabled,await A()}async function n(){v.use_default_frontend=!0,await A()}async function t(){v.use_default_frontend=!1,await A()}function a(k,b){i.value=k,x.value=b,setTimeout(()=>{i.value=""},5e3)}async function j(){c.value=!0,i.value="";try{const k=await K.post("/restart_service",{});k.success?(a("Service restart initiated. Page will reload...",!0),g.value=!1,setTimeout(()=>{window.location.reload()},2e3)):a(k.error||"Failed to restart service",!1)}catch(k){k.code==="ERR_NETWORK"||k.message?.includes("Network error")?(a("Service restarting... Page will reload",!0),g.value=!1,setTimeout(()=>{window.location.reload()},3e3)):(console.error("Failed to restart service:",k),a(k.message||"Failed to restart service",!1))}finally{c.value=!1}}return ae(()=>{E(),h()}),(k,b)=>(o(),r("div",Hs,[e("div",Us,[b[1]||(b[1]=e("div",{class:"flex items-start justify-between mb-4"},[e("div",null,[e("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-1"},"CORS Settings"),e("p",{class:"text-sm text-content-secondary dark:text-content-muted"},"Control cross-origin resource sharing for API access")])],-1)),e("div",Rs,[e("div",Ks,[b[0]||(b[0]=e("div",null,[e("label",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Enable CORS"),e("p",{class:"text-xs text-content-secondary dark:text-content-muted mt-1"},"Allow web frontends from different origins to access the API")],-1)),e("button",{onClick:$,disabled:_.value,class:D(["relative inline-flex h-6 w-11 items-center rounded-full transition-colors border-2",v.cors_enabled?"bg-cyan-600 dark:bg-teal-500 border-cyan-600 dark:border-teal-500":"bg-gray-400 dark:bg-gray-600 border-gray-400 dark:border-gray-600",_.value?"opacity-50 cursor-not-allowed":"cursor-pointer"])},[e("span",{class:D(["inline-block h-4 w-4 transform rounded-full bg-white transition-transform shadow-lg",v.cors_enabled?"translate-x-5":"translate-x-0.5"])},null,2)],10,Os)])])]),e("div",qs,[b[11]||(b[11]=e("div",{class:"flex items-start justify-between mb-4"},[e("div",null,[e("h3",{class:"text-lg font-semibold text-content-primary dark:text-content-primary mb-1"},"Web Frontend"),e("p",{class:"text-sm text-content-secondary dark:text-content-muted"},"Choose which web interface to use")])],-1)),e("div",Ws,[e("div",Gs,[e("label",{class:D(["flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 cursor-pointer transition-all",v.use_default_frontend?"border-accent-cyan bg-accent-cyan/10":"border-stroke-subtle dark:border-stroke/10 hover:border-accent-cyan/50"])},[e("input",{type:"radio",name:"frontend",checked:v.use_default_frontend,onChange:n,disabled:_.value,class:"mt-1 h-4 w-4 text-accent-cyan focus:ring-accent-cyan focus:ring-offset-background"},null,40,Qs),b[2]||(b[2]=e("div",{class:"flex-1"},[e("div",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Default Frontend"),e("div",{class:"text-xs text-content-secondary dark:text-content-muted mt-1"},"Built-in pyMC Repeater web interface"),e("div",{class:"text-xs text-content-muted dark:text-content-muted/60 mt-1 font-mono"},"Built-in")],-1))],2),e("label",{class:D(["flex items-start space-x-3 p-4 bg-background-mute dark:bg-background/30 rounded-lg border-2 cursor-pointer transition-all",v.use_default_frontend?"border-stroke-subtle dark:border-stroke/10 hover:border-accent-cyan/50":"border-accent-cyan bg-accent-cyan/10"])},[e("input",{type:"radio",name:"frontend",checked:!v.use_default_frontend,onChange:t,disabled:_.value,class:"mt-1 h-4 w-4 text-accent-cyan focus:ring-accent-cyan focus:ring-offset-background"},null,40,Ys),b[3]||(b[3]=W('<div class="flex-1"><div class="flex items-center justify-between"><div class="text-sm font-medium text-content-primary dark:text-content-primary">PyMC Console</div><span class="text-xs bg-orange-100 dark:bg-orange-500/20 text-orange-600 dark:text-orange-400 px-2 py-0.5 rounded-full border border-orange-500/30 font-medium">@Treehouse⚡</span></div><div class="text-xs text-content-secondary dark:text-content-muted mt-1">Alternative web interface for pyMC Repeater</div><div class="text-xs text-content-muted dark:text-content-muted/60 mt-1 font-mono">/opt/pymc_console/web/html</div></div>',1))],2)]),s.value?L("",!0):(o(),r("div",{key:0,class:D(["p-4 rounded-lg border",p.value?"bg-green-500/5 border-green-500/20":"bg-accent-cyan/5 border-accent-cyan/20"])},[e("div",Xs,[p.value?(o(),r("svg",Js,b[4]||(b[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))):(o(),r("svg",Zs,b[5]||(b[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))),e("div",en,[e("h4",tn,u(p.value?"PyMC Console has been detected":"PyMC Console Not Installed"),1),p.value?(o(),r("p",on,b[6]||(b[6]=[H(" PyMC Console is installed at ",-1),e("code",{class:"text-green-700 dark:text-green-300"},"/opt/pymc_console/web/html",-1)]))):(o(),r(U,{key:1},[b[7]||(b[7]=W('<p class="text-xs text-content-secondary dark:text-content-muted mt-1 mb-3"> PyMC Console must be installed at <code class="text-accent-cyan">/opt/pymc_console/web/html</code> before selecting this option. </p><a href="https://github.com/dmduran12/pymc_console-dist" target="_blank" rel="noopener noreferrer" class="inline-flex items-center gap-2 px-4 py-2 bg-accent-cyan/20 hover:bg-accent-cyan/30 border border-accent-cyan/50 text-accent-cyan rounded-lg text-sm font-medium transition-colors"><svg class="w-4 h-4" fill="currentColor" viewBox="0 0 24 24"><path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"></path></svg> PyMC Console Install Instructions </a>',2))],64))])])],2)),g.value?(o(),r("div",rn,[e("div",sn,[b[10]||(b[10]=W('<div class="flex items-start space-x-3 flex-1"><svg class="w-5 h-5 text-amber-600 dark:text-amber-400 flex-shrink-0 mt-0.5" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"></path></svg><div class="flex-1"><h4 class="text-sm font-medium text-amber-600 dark:text-amber-400">Service restart required</h4><p class="text-xs text-amber-700 dark:text-amber-400/80 mt-1">Web frontend changes will take effect after restarting the pymc-repeater service.</p></div></div>',1)),e("button",{onClick:j,disabled:c.value,class:"px-4 py-2 bg-amber-500 hover:bg-amber-600 disabled:bg-amber-500/50 text-white font-medium rounded-lg transition-colors disabled:cursor-not-allowed flex items-center gap-2 whitespace-nowrap"},[c.value?(o(),r("svg",an,b[8]||(b[8]=[e("circle",{class:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor","stroke-width":"4"},null,-1),e("path",{class:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"},null,-1)]))):(o(),r("svg",ln,b[9]||(b[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15"},null,-1)]))),H(" "+u(c.value?"Restarting...":"Restart Now"),1)],8,nn)])])):L("",!0)])]),i.value?(o(),r("div",{key:0,class:D(["p-4 rounded-lg border",f.value])},[e("div",dn,[x.value?(o(),r("svg",cn,b[12]||(b[12]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 13l4 4L19 7"},null,-1)]))):(o(),r("svg",un,b[13]||(b[13]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"},null,-1)]))),e("span",{class:D(x.value?"text-green-600 dark:text-green-400":"text-red-600 dark:text-red-400")},u(i.value),3)])],2)):L("",!0)]))}}),pn={class:"space-y-4"},vn={key:0,class:"bg-green-100 dark:bg-green-500/20 border border-green-500 dark:border-green-500/50 rounded-lg p-3 text-green-700 dark:text-green-400 text-sm"},xn={key:1,class:"bg-red-100 dark:bg-red-500/20 border border-red-500 dark:border-red-500/50 rounded-lg p-3 text-red-700 dark:text-red-400 text-sm"},bn={class:"flex justify-between items-center"},kn={class:"flex gap-2"},gn=["disabled"],yn={class:"flex gap-2"},fn=["disabled"],hn=["disabled"],wn={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},_n={key:0,class:"flex items-center justify-center py-4"},Cn={key:1,class:"text-center py-4"},$n={class:"grid grid-cols-2 sm:grid-cols-4 gap-3"},Mn={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},An={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},Sn={class:"text-lg font-mono text-content-primary dark:text-content-primary"},jn={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},Tn={class:"text-lg font-mono text-green-600 dark:text-green-400"},Nn={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},Bn={class:"text-lg font-mono text-red-600 dark:text-red-400"},En={key:0,class:"mt-2 p-2 bg-red-50 dark:bg-red-500/10 rounded-lg border border-red-200 dark:border-red-500/30"},Ln={key:1,class:"mt-2 p-2 bg-orange-50 dark:bg-orange-500/10 rounded-lg border border-orange-200 dark:border-orange-500/30"},Fn={class:"font-medium"},Pn={class:"font-mono text-[10px] opacity-70"},zn={class:"text-[10px]"},Vn={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},Dn={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},In={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Hn={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Un={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Rn={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Kn={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},On={key:1,class:"flex items-center gap-2"},qn={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},Wn={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Gn={key:1,class:"flex items-center gap-2"},Qn={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},Yn={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Xn={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},Jn={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},Zn={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},ea={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},ta={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},oa={key:1,class:"flex items-center gap-2"},ra={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},sa={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},na={key:1,class:"flex items-center gap-2"},aa={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 gap-1"},la={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},da={key:1,class:"flex items-center gap-2"},ia={class:"bg-background-mute dark:bg-white/5 rounded-lg p-3 sm:p-4 space-y-3"},ca={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},ua={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},ma={class:"flex flex-col sm:flex-row sm:justify-between sm:items-center py-2 border-b border-stroke-subtle dark:border-stroke/10 gap-1"},pa={key:0,class:"text-content-primary dark:text-content-primary font-mono text-sm"},va={key:1,class:"flex items-center gap-2"},xa={class:"py-2"},ba={class:"grid grid-cols-3 gap-2 mt-2"},ka={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},ga={key:0,class:"font-mono text-sm text-content-primary dark:text-content-primary"},ya={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},fa={key:0,class:"font-mono text-sm text-content-primary dark:text-content-primary"},ha={class:"text-center p-2 bg-white dark:bg-white/5 rounded-lg"},wa={key:0,class:"font-mono text-sm text-content-primary dark:text-content-primary"},_a={class:"p-6 space-y-4"},Ca={class:"flex justify-between items-start"},$a={class:"flex justify-end pt-4 border-t border-stroke-subtle dark:border-stroke/20"},Ma=q({__name:"AdvertSettings",setup(I){const _=re(),i=T(()=>_.stats?.config?.repeater||{}),x=T(()=>i.value.advert_rate_limit||{}),g=T(()=>i.value.advert_penalty_box||{}),c=T(()=>i.value.advert_adaptive||{}),p=T(()=>c.value.thresholds||{}),s=m(!1),v=m(!1),f=m(""),h=m(""),E=m(!1),A=m(!1),$=m(null),n=m(!0),t=m(2),a=m(1),j=m(10),k=m(60),b=m(!0),y=m(2),z=m(12),O=m(6),C=m(2),N=m(24),P=m(!0),oe=m(.1),Y=m(5),M=m(.05),d=m(.2),w=m(.5),F=async()=>{A.value=!0;try{const Q=await de.get("/api/advert_rate_limit_stats");Q.data?.success&&($.value=Q.data.data)}catch(Q){console.error("Failed to fetch rate limit stats:",Q)}finally{A.value=!1}};te([x,g,c],()=>{console.log("[AdvertSettings] Watch triggered, isEditing:",s.value),s.value?console.log("[AdvertSettings] Watch skipped (editing mode)"):(console.log("[AdvertSettings] Watch loading values from store"),console.log("[AdvertSettings] rateLimitConfig:",x.value),console.log("[AdvertSettings] penaltyConfig:",g.value),console.log("[AdvertSettings] adaptiveConfig:",c.value),n.value=x.value.enabled??!1,t.value=x.value.bucket_capacity??2,a.value=x.value.refill_tokens??1,j.value=Math.round((x.value.refill_interval_seconds??36e3)/3600),k.value=Math.round((x.value.min_interval_seconds??0)/60),b.value=g.value.enabled??!1,y.value=g.value.violation_threshold??2,z.value=Math.round((g.value.violation_decay_seconds??43200)/3600),O.value=Math.round((g.value.base_penalty_seconds??21600)/3600),C.value=g.value.penalty_multiplier??2,N.value=Math.round((g.value.max_penalty_seconds??86400)/3600),P.value=c.value.enabled??!1,oe.value=c.value.ewma_alpha??.1,Y.value=Math.round((c.value.hysteresis_seconds??300)/60),M.value=p.value.quiet_max??.05,d.value=p.value.normal_max??.2,w.value=p.value.busy_max??.5,console.log("[AdvertSettings] Watch loaded values:"),console.log(" rateLimitEnabled:",n.value),console.log(" minIntervalMinutes:",k.value))},{immediate:!0}),ae(()=>{F()});const se=()=>{console.log("[AdvertSettings] reloadFormValues called"),console.log("[AdvertSettings] rateLimitConfig:",x.value),console.log("[AdvertSettings] penaltyConfig:",g.value),console.log("[AdvertSettings] adaptiveConfig:",c.value),n.value=x.value.enabled??!1,t.value=x.value.bucket_capacity??2,a.value=x.value.refill_tokens??1,j.value=Math.round((x.value.refill_interval_seconds??36e3)/3600),k.value=Math.round((x.value.min_interval_seconds??0)/60),b.value=g.value.enabled??!1,y.value=g.value.violation_threshold??2,z.value=Math.round((g.value.violation_decay_seconds??43200)/3600),O.value=Math.round((g.value.base_penalty_seconds??21600)/3600),C.value=g.value.penalty_multiplier??2,N.value=Math.round((g.value.max_penalty_seconds??86400)/3600),P.value=c.value.enabled??!1,oe.value=c.value.ewma_alpha??.1,Y.value=Math.round((c.value.hysteresis_seconds??300)/60),M.value=p.value.quiet_max??.05,d.value=p.value.normal_max??.2,w.value=p.value.busy_max??.5,console.log("[AdvertSettings] Form values after reload:"),console.log(" rateLimitEnabled:",n.value),console.log(" minIntervalMinutes:",k.value),console.log(" penaltyEnabled:",b.value),console.log(" adaptiveEnabled:",P.value)},ge=()=>{s.value=!0,f.value="",h.value=""},ye=()=>{s.value=!1,f.value="",h.value="",se()},fe=async()=>{v.value=!0,h.value="",f.value="";try{const Q={rate_limit_enabled:n.value,bucket_capacity:t.value,refill_tokens:a.value,refill_interval_seconds:j.value*3600,min_interval_seconds:k.value*60,penalty_enabled:b.value,violation_threshold:y.value,violation_decay_seconds:z.value*3600,base_penalty_seconds:O.value*3600,penalty_multiplier:C.value,max_penalty_seconds:N.value*3600,adaptive_enabled:P.value,ewma_alpha:oe.value,hysteresis_seconds:Y.value*60,quiet_max:M.value,normal_max:d.value,busy_max:w.value};console.log("[AdvertSettings] Sending save request with payload:",Q);const B=(await de.post("/api/update_advert_rate_limit_config",Q)).data;console.log("[AdvertSettings] API response:",B),B.success?(f.value=B.data?.message||"Settings saved successfully",console.log("[AdvertSettings] Save successful, fetching updated config..."),await _.fetchStats(),console.log("[AdvertSettings] systemStore.fetchStats() complete"),console.log("[AdvertSettings] rateLimitConfig after fetchStats:",x.value),await F(),console.log("[AdvertSettings] fetchStats() complete"),await ie(),console.log("[AdvertSettings] nextTick() complete, calling reloadFormValues()"),se(),console.log("[AdvertSettings] reloadFormValues() complete, exiting edit mode"),s.value=!1,setTimeout(()=>{f.value=""},3e3)):(h.value=B.error||"Failed to save settings",console.error("[AdvertSettings] Save failed:",B.error))}catch(Q){console.error("Failed to save advert settings:",Q),h.value=Q.response?.data?.error||"Failed to save settings"}finally{v.value=!1}},ue=T(()=>$.value?.adaptive?.current_tier||"unknown"),he=T(()=>{switch(ue.value){case"quiet":return"bg-green-100 dark:bg-green-500/20 text-green-700 dark:text-green-400 border-green-500";case"normal":return"bg-blue-100 dark:bg-blue-500/20 text-blue-700 dark:text-blue-400 border-blue-500";case"busy":return"bg-yellow-100 dark:bg-yellow-500/20 text-yellow-700 dark:text-yellow-400 border-yellow-500";case"congested":return"bg-red-100 dark:bg-red-500/20 text-red-700 dark:text-red-400 border-red-500";default:return"bg-gray-100 dark:bg-gray-500/20 text-gray-700 dark:text-gray-400 border-gray-500"}});return(Q,l)=>(o(),r("div",pn,[f.value?(o(),r("div",vn,u(f.value),1)):L("",!0),h.value?(o(),r("div",xn,u(h.value),1)):L("",!0),e("div",bn,[e("div",kn,[e("button",{onClick:F,disabled:A.value,class:"px-3 py-1.5 text-xs bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-secondary dark:text-content-muted rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors disabled:opacity-50"},u(A.value?"Loading...":"Refresh Stats"),9,gn),e("button",{onClick:l[0]||(l[0]=B=>E.value=!0),class:"px-3 py-1.5 text-xs bg-blue-100 dark:bg-blue-500/20 hover:bg-blue-200 dark:hover:bg-blue-500/30 text-blue-700 dark:text-blue-400 rounded-lg border border-blue-500/50 transition-colors",title:"How rate limiting works"},l[19]||(l[19]=[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)]))]),e("div",yn,[s.value?(o(),r(U,{key:1},[e("button",{onClick:ye,disabled:v.value,class:"px-3 sm:px-4 py-2 bg-background-mute dark:bg-white/5 hover:bg-stroke-subtle dark:hover:bg-white/10 text-content-primary dark:text-content-primary rounded-lg border border-stroke-subtle dark:border-stroke/20 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"}," Cancel ",8,fn),e("button",{onClick:fe,disabled:v.value,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm disabled:opacity-50 disabled:cursor-not-allowed"},u(v.value?"Saving...":"Save Changes"),9,hn)],64)):(o(),r("button",{key:0,onClick:ge,class:"px-3 sm:px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors text-sm"}," Edit Settings "))])]),e("div",wn,[l[28]||(l[28]=e("h3",{class:"text-sm font-medium text-content-primary dark:text-content-primary"},"Current Status",-1)),A.value&&!$.value?(o(),r("div",_n,l[20]||(l[20]=[e("div",{class:"animate-spin w-5 h-5 border-2 border-stroke-subtle dark:border-stroke/20 border-t-cyan-500 dark:border-t-primary rounded-full"},null,-1),e("span",{class:"ml-2 text-sm text-content-muted"},"Loading stats...",-1)]))):$.value?(o(),r(U,{key:2},[e("div",$n,[e("div",Mn,[l[22]||(l[22]=e("div",{class:"text-xs text-content-muted dark:text-content-muted"},"Mesh Tier",-1)),e("div",{class:D(["mt-1 px-2 py-0.5 rounded border text-xs font-medium inline-block",he.value])},u(ue.value.toUpperCase()),3)]),e("div",An,[l[23]||(l[23]=e("div",{class:"text-xs text-content-muted dark:text-content-muted"},"Adverts/min",-1)),e("div",Sn,u($.value.metrics?.adverts_per_min_ewma?.toFixed(2)||"0.00"),1)]),e("div",jn,[l[24]||(l[24]=e("div",{class:"text-xs text-content-muted dark:text-content-muted"},"Allowed",-1)),e("div",Tn,u($.value.stats?.adverts_allowed||0),1)]),e("div",Nn,[l[25]||(l[25]=e("div",{class:"text-xs text-content-muted dark:text-content-muted"},"Dropped",-1)),e("div",Bn,u($.value.stats?.adverts_dropped||0),1)])]),Object.keys($.value.active_penalties||{}).length>0?(o(),r("div",En,[l[26]||(l[26]=e("div",{class:"text-xs font-medium text-red-700 dark:text-red-400 mb-1"},"Active Penalties",-1)),(o(!0),r(U,null,J($.value.active_penalties,(B,le)=>(o(),r("div",{key:le,class:"text-xs font-mono text-red-600 dark:text-red-400"},u(le)+"... - "+u(Math.round(B))+"s remaining ",1))),128))])):L("",!0),$.value.recent_drops&&$.value.recent_drops.length>0?(o(),r("div",Ln,[l[27]||(l[27]=e("div",{class:"text-xs font-medium text-orange-700 dark:text-orange-400 mb-1"},"Recently Dropped Adverts",-1)),(o(!0),r(U,null,J($.value.recent_drops,(B,le)=>(o(),r("div",{key:le,class:"text-xs text-orange-600 dark:text-orange-400 py-0.5"},[e("span",Fn,u(B.name),1),e("span",Pn,"("+u(B.pubkey)+"...)",1),e("span",zn," - "+u(B.reason)+" ("+u(B.seconds_ago)+"s ago)",1)]))),128))])):L("",!0)],64)):(o(),r("div",Cn,l[21]||(l[21]=[e("p",{class:"text-xs text-content-muted dark:text-content-muted"},' Stats not available. Click "Refresh Stats" to load. ',-1)])))]),e("div",Vn,[l[36]||(l[36]=e("h3",{class:"text-sm font-medium text-content-primary dark:text-content-primary flex items-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})]),H(" Token Bucket Rate Limiting ")],-1)),l[37]||(l[37]=e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Controls how many adverts each pubkey can send in a given time period.",-1)),e("div",Dn,[l[30]||(l[30]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Rate Limiting",-1)),s.value?S((o(),r("select",{key:1,"onUpdate:modelValue":l[1]||(l[1]=B=>n.value=B),class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},l[29]||(l[29]=[e("option",{value:!0},"Enabled",-1),e("option",{value:!1},"Disabled",-1)]),512)),[[ee,n.value]]):(o(),r("div",In,u(n.value?"Enabled":"Disabled"),1))]),e("div",Hn,[l[31]||(l[31]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Bucket Capacity"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Max burst size (adverts)")],-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[2]||(l[2]=B=>t.value=B),type:"number",min:"1",max:"10",class:"w-full sm:w-24 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,t.value,void 0,{number:!0}]]):(o(),r("div",Un,u(t.value),1))]),e("div",Rn,[l[33]||(l[33]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Refill Interval"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Time between token refills")],-1)),s.value?(o(),r("div",On,[S(e("input",{"onUpdate:modelValue":l[3]||(l[3]=B=>j.value=B),type:"number",min:"1",max:"48",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,j.value,void 0,{number:!0}]]),l[32]||(l[32]=e("span",{class:"text-content-muted text-sm"},"hours",-1))])):(o(),r("div",Kn,u(j.value)+" hours",1))]),e("div",qn,[l[35]||(l[35]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Minimum Interval"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Hard minimum between adverts")],-1)),s.value?(o(),r("div",Gn,[S(e("input",{"onUpdate:modelValue":l[4]||(l[4]=B=>k.value=B),type:"number",min:"0",max:"1440",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,k.value,void 0,{number:!0}]]),l[34]||(l[34]=e("span",{class:"text-content-muted text-sm"},"min",-1))])):(o(),r("div",Wn,u(k.value)+" min",1))])]),e("div",Qn,[l[47]||(l[47]=e("h3",{class:"text-sm font-medium text-content-primary dark:text-content-primary flex items-center gap-2"},[e("svg",{class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M18.364 18.364A9 9 0 005.636 5.636m12.728 12.728A9 9 0 015.636 5.636m12.728 12.728L5.636 5.636"})]),H(" Penalty Box (Repeat Offenders) ")],-1)),l[48]||(l[48]=e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Applies escalating cooldowns to pubkeys that repeatedly violate limits.",-1)),e("div",Yn,[l[39]||(l[39]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Penalty Box",-1)),s.value?S((o(),r("select",{key:1,"onUpdate:modelValue":l[5]||(l[5]=B=>b.value=B),class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},l[38]||(l[38]=[e("option",{value:!0},"Enabled",-1),e("option",{value:!1},"Disabled",-1)]),512)),[[ee,b.value]]):(o(),r("div",Xn,u(b.value?"Enabled":"Disabled"),1))]),e("div",Jn,[l[40]||(l[40]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Violation Threshold"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Violations before penalty")],-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[6]||(l[6]=B=>y.value=B),type:"number",min:"1",max:"10",class:"w-full sm:w-24 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512)),[[V,y.value,void 0,{number:!0}]]):(o(),r("div",Zn,u(y.value),1))]),e("div",ea,[l[42]||(l[42]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Base Penalty Duration"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"First penalty duration")],-1)),s.value?(o(),r("div",oa,[S(e("input",{"onUpdate:modelValue":l[7]||(l[7]=B=>O.value=B),type:"number",min:"1",max:"48",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,O.value,void 0,{number:!0}]]),l[41]||(l[41]=e("span",{class:"text-content-muted text-sm"},"hours",-1))])):(o(),r("div",ta,u(O.value)+" hours",1))]),e("div",ra,[l[44]||(l[44]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Penalty Multiplier"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Escalation factor")],-1)),s.value?(o(),r("div",na,[S(e("input",{"onUpdate:modelValue":l[8]||(l[8]=B=>C.value=B),type:"number",min:"1",max:"5",step:"0.5",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,C.value,void 0,{number:!0}]]),l[43]||(l[43]=e("span",{class:"text-content-muted text-sm"},"x",-1))])):(o(),r("div",sa,u(C.value)+"x",1))]),e("div",aa,[l[46]||(l[46]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Max Penalty Duration"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Maximum cooldown cap")],-1)),s.value?(o(),r("div",da,[S(e("input",{"onUpdate:modelValue":l[9]||(l[9]=B=>N.value=B),type:"number",min:"1",max:"168",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,N.value,void 0,{number:!0}]]),l[45]||(l[45]=e("span",{class:"text-content-muted text-sm"},"hours",-1))])):(o(),r("div",la,u(N.value)+" hours",1))])]),e("div",ia,[l[58]||(l[58]=W('<h3 class="text-sm font-medium text-content-primary dark:text-content-primary flex items-center gap-2"><svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path></svg> Adaptive Rate Limiting </h3><div class="p-3 bg-cyan-50 dark:bg-cyan-500/10 border border-cyan-200 dark:border-cyan-500/30 rounded-lg"><p class="text-xs text-cyan-700 dark:text-cyan-300 leading-relaxed"><strong>How the three systems work together:</strong> Each layer can be enabled/disabled independently and the others will still function. </p><ul class="text-xs text-cyan-700 dark:text-cyan-300 mt-2 space-y-1 ml-4 list-disc"><li><strong>Rate Limiting OFF:</strong> All limiting disabled — adverts pass through freely</li><li><strong>Adaptive OFF:</strong> Token bucket uses fixed limits (no tier scaling), penalty box still works</li><li><strong>Penalty Box OFF:</strong> Token bucket still applies, but no escalating cooldowns for repeat offenders</li></ul><p class="text-xs text-cyan-700 dark:text-cyan-300 mt-2"><strong>Decision flow when all enabled:</strong> Adaptive tier check → Penalty box check → Token bucket check → Violation recording (triggers penalty box) </p><p class="text-xs text-cyan-700 dark:text-cyan-300 mt-1"><strong>Activity tiers:</strong><span class="text-green-600 dark:text-green-400 font-medium">Quiet</span> (bypass limiting) → <span class="text-blue-600 dark:text-blue-400 font-medium">Normal</span> (lighter: 0.5x intervals) → <span class="text-yellow-600 dark:text-yellow-400 font-medium">Busy</span> (base: 1.0x intervals) → <span class="text-red-600 dark:text-red-400 font-medium">Congested</span> (stricter: 2.0x intervals) </p><p class="text-xs text-cyan-700 dark:text-cyan-300 mt-1"><strong>Note:</strong> Adaptive mode scales refill/min-interval timing; bucket capacity stays at the configured base value. </p></div>',2)),e("div",ca,[l[50]||(l[50]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Adaptive Mode",-1)),s.value?S((o(),r("select",{key:1,"onUpdate:modelValue":l[10]||(l[10]=B=>P.value=B),class:"w-full sm:w-32 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},l[49]||(l[49]=[e("option",{value:!0},"Enabled",-1),e("option",{value:!1},"Disabled",-1)]),512)),[[ee,P.value]]):(o(),r("div",ua,u(P.value?"Enabled":"Disabled"),1))]),e("div",ma,[l[52]||(l[52]=e("div",null,[e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm"},"Tier Change Delay"),e("p",{class:"text-xs text-content-muted dark:text-content-muted"},"Prevents tier flapping")],-1)),s.value?(o(),r("div",va,[S(e("input",{"onUpdate:modelValue":l[11]||(l[11]=B=>Y.value=B),type:"number",min:"0",max:"60",class:"w-20 px-3 py-1.5 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded-lg text-content-primary dark:text-content-primary text-sm focus:outline-none focus:border-primary"},null,512),[[V,Y.value,void 0,{number:!0}]]),l[51]||(l[51]=e("span",{class:"text-content-muted text-sm"},"min",-1))])):(o(),r("div",pa,u(Y.value)+" min",1))]),e("div",xa,[l[56]||(l[56]=e("span",{class:"text-content-secondary dark:text-content-muted text-xs sm:text-sm mb-2 block"},"Activity Tier Thresholds (adverts/min)",-1)),e("div",ba,[e("div",ka,[l[53]||(l[53]=e("div",{class:"text-xs text-green-600 dark:text-green-400 mb-1"},"Quiet Max",-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[12]||(l[12]=B=>M.value=B),type:"number",min:"0",max:"1",step:"0.01",class:"w-full px-2 py-1 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded text-content-primary dark:text-content-primary text-sm text-center focus:outline-none focus:border-primary"},null,512)),[[V,M.value,void 0,{number:!0}]]):(o(),r("div",ga,u(M.value),1))]),e("div",ya,[l[54]||(l[54]=e("div",{class:"text-xs text-blue-600 dark:text-blue-400 mb-1"},"Normal Max",-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[13]||(l[13]=B=>d.value=B),type:"number",min:"0",max:"5",step:"0.01",class:"w-full px-2 py-1 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded text-content-primary dark:text-content-primary text-sm text-center focus:outline-none focus:border-primary"},null,512)),[[V,d.value,void 0,{number:!0}]]):(o(),r("div",fa,u(d.value),1))]),e("div",ha,[l[55]||(l[55]=e("div",{class:"text-xs text-yellow-600 dark:text-yellow-400 mb-1"},"Busy Max",-1)),s.value?S((o(),r("input",{key:1,"onUpdate:modelValue":l[14]||(l[14]=B=>w.value=B),type:"number",min:"0",max:"10",step:"0.01",class:"w-full px-2 py-1 bg-white dark:bg-white/5 border border-stroke-subtle dark:border-stroke/10 rounded text-content-primary dark:text-content-primary text-sm text-center focus:outline-none focus:border-primary"},null,512)),[[V,w.value,void 0,{number:!0}]]):(o(),r("div",wa,u(w.value),1))])]),l[57]||(l[57]=e("p",{class:"text-xs text-content-muted dark:text-content-muted mt-2"},"Above Busy Max = Congested tier (strictest limiting)",-1))])]),E.value?(o(),r("div",{key:2,class:"fixed inset-0 bg-black/50 flex items-start justify-center z-50 p-4 overflow-y-auto",onClick:l[18]||(l[18]=G(B=>E.value=!1,["self"]))},[e("div",{class:"bg-background dark:bg-background-dark rounded-lg shadow-xl max-w-3xl w-full my-8",onClick:l[17]||(l[17]=G(()=>{},["stop"]))},[e("div",_a,[e("div",Ca,[l[60]||(l[60]=e("h2",{class:"text-xl font-semibold text-content-primary dark:text-content-primary"},"How Advert Rate Limiting Works",-1)),e("button",{onClick:l[15]||(l[15]=B=>E.value=!1),class:"text-content-muted hover:text-content-primary dark:text-content-muted dark:hover:text-content-primary"},l[59]||(l[59]=[e("svg",{class:"w-6 h-6",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M6 18L18 6M6 6l12 12"})],-1)]))]),l[61]||(l[61]=W('<div class="bg-blue-50 dark:bg-blue-500/10 rounded-lg p-4 border border-blue-200 dark:border-blue-500/30"><h3 class="font-semibold text-blue-900 dark:text-blue-400 mb-2">Why you may see the same advert more than once</h3><p class="text-sm text-blue-800 dark:text-blue-300 leading-relaxed"> Mesh traffic can reach your repeater through different paths, so duplicate advert packets are expected. </p><ul class="text-sm text-blue-800 dark:text-blue-300 mt-2 space-y-1 list-disc list-inside"><li>First copy arrives and is forwarded</li><li>Second copy arrives through another repeater path</li><li>Later copies may be dropped once limits are hit</li></ul><p class="text-sm text-blue-800 dark:text-blue-300 mt-2"> This is normal behavior and helps prevent repeated rebroadcasts from flooding the mesh. </p></div><div class="space-y-2"><h3 class="font-semibold text-content-primary dark:text-content-primary flex items-center gap-2"><svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg> Token Bucket Rate Limiting </h3><p class="text-sm text-content-secondary dark:text-content-muted leading-relaxed"> Each sender has a token bucket. Every forwarded advert uses one token. </p><ul class="text-sm text-content-secondary dark:text-content-muted space-y-1 list-disc list-inside ml-4"><li><strong>Bucket Capacity:</strong> How many adverts can pass in a burst.</li><li><strong>Refill Rate:</strong> How quickly tokens come back over time.</li><li><strong>Min Interval:</strong> Optional gap between adverts from the same sender (usually set to 0).</li></ul><div class="mt-2 p-3 bg-background-mute dark:bg-white/5 rounded text-xs font-mono text-content-muted dark:text-content-muted"> Example (capacity 2):<br> - Copy 1 forwarded (2 → 1 tokens)<br> - Copy 2 forwarded (1 → 0 tokens)<br> - Copy 3 dropped (no tokens left) </div></div><div class="space-y-2"><h3 class="font-semibold text-content-primary dark:text-content-primary flex items-center gap-2"><svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 15v2m-6 4h12a2 2 0 002-2v-6a2 2 0 00-2-2H6a2 2 0 00-2 2v6a2 2 0 002 2zm10-10V7a4 4 0 00-8 0v4h8z"></path></svg> Penalty Box (Repeat Offenders) </h3><p class="text-sm text-content-secondary dark:text-content-muted leading-relaxed"> If a sender keeps hitting the limit, it is temporarily blocked. </p><ul class="text-sm text-content-secondary dark:text-content-muted space-y-1 list-disc list-inside ml-4"><li><strong>Violation Threshold:</strong> How many hits before penalty starts.</li><li><strong>Base Penalty:</strong> First block duration.</li><li><strong>Multiplier:</strong> Repeated penalties get longer.</li><li><strong>Decay Time:</strong> Violations age out after stable behavior.</li></ul></div><div class="space-y-2"><h3 class="font-semibold text-content-primary dark:text-content-primary flex items-center gap-2"><svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 19v-6a2 2 0 00-2-2H5a2 2 0 00-2 2v6a2 2 0 002 2h2a2 2 0 002-2zm0 0V9a2 2 0 012-2h2a2 2 0 012 2v10m-6 0a2 2 0 002 2h2a2 2 0 002-2m0 0V5a2 2 0 012-2h2a2 2 0 012 2v14a2 2 0 01-2 2h-2a2 2 0 01-2-2z"></path></svg> Adaptive Mesh Activity Tiers </h3><p class="text-sm text-content-secondary dark:text-content-muted leading-relaxed"> Adaptive mode adjusts limits based on recent advert activity. </p><div class="mt-2 p-3 bg-background-mute dark:bg-white/5 rounded-lg text-sm text-content-secondary dark:text-content-muted"><span class="font-semibold">How Congestion is Measured:</span><ul class="mt-1 space-y-1 list-disc list-inside ml-2"><li><strong>What is counted:</strong> Advert packets only (not chat/data traffic)</li><li><strong>Smoothing:</strong> 60-second EWMA to avoid reacting to short spikes</li><li><strong>Score:</strong> Tier is based on adverts per minute</li><li><strong>Hysteresis:</strong> Tier changes must hold for 5 minutes</li></ul></div><div class="grid grid-cols-2 gap-2 mt-2"><div class="p-2 bg-green-50 dark:bg-green-500/10 rounded border border-green-500/30"><div class="text-xs font-semibold text-green-700 dark:text-green-400">QUIET</div><div class="text-xs text-green-600 dark:text-green-500">Activity &lt; 0.05/min</div><div class="text-xs text-green-700 dark:text-green-400 font-medium mt-1">No rate limiting</div></div><div class="p-2 bg-blue-50 dark:bg-blue-500/10 rounded border border-blue-500/30"><div class="text-xs font-semibold text-blue-700 dark:text-blue-400">NORMAL</div><div class="text-xs text-blue-600 dark:text-blue-500">Activity 0.05-0.20/min</div><div class="text-xs text-blue-700 dark:text-blue-400 font-medium mt-1">Light limiting (50%)</div></div><div class="p-2 bg-yellow-50 dark:bg-yellow-500/10 rounded border border-yellow-500/30"><div class="text-xs font-semibold text-yellow-700 dark:text-yellow-400">BUSY</div><div class="text-xs text-yellow-600 dark:text-yellow-500">Activity 0.20-0.50/min</div><div class="text-xs text-yellow-700 dark:text-yellow-400 font-medium mt-1">Standard limiting (100%)</div></div><div class="p-2 bg-red-50 dark:bg-red-500/10 rounded border border-red-500/30"><div class="text-xs font-semibold text-red-700 dark:text-red-400">CONGESTED</div><div class="text-xs text-red-600 dark:text-red-500">Activity &gt; 0.50/min</div><div class="text-xs text-red-700 dark:text-red-400 font-medium mt-1">Aggressive (200%)</div></div></div><div class="mt-2 p-3 bg-background-mute dark:bg-white/5 rounded text-xs font-mono text-content-muted dark:text-content-muted"> Quick examples:<br> - 0.02 adverts/min → <span class="text-green-600 dark:text-green-400 font-semibold">QUIET</span> (bypass)<br> - 0.35 adverts/min → <span class="text-yellow-600 dark:text-yellow-400 font-semibold">BUSY</span> (tighter limits)<br> - 0.68 adverts/min → <span class="text-red-600 dark:text-red-400 font-semibold">CONGESTED</span> (strict limits) </div></div><div class="bg-green-50 dark:bg-green-500/10 rounded-lg p-4 border border-green-200 dark:border-green-500/30"><h3 class="font-semibold text-green-900 dark:text-green-400 mb-2">Recommended starting settings</h3><ul class="text-sm text-green-800 dark:text-green-300 space-y-1 list-disc list-inside"><li><strong>Min Interval:</strong> 0 (disabled), let adaptive mode do the work</li><li><strong>Bucket Capacity:</strong> 2-3 tokens for normal mesh propagation</li><li><strong>Adaptive Mode:</strong> On</li><li><strong>Penalty Box:</strong> On</li></ul></div>',5)),e("div",$a,[e("button",{onClick:l[16]||(l[16]=B=>E.value=!1),class:"px-4 py-2 bg-primary/20 hover:bg-primary/30 text-content-primary dark:text-content-primary rounded-lg border border-primary/50 transition-colors"}," Got it! ")])])])])):L("",!0)]))}}),Aa={class:"p-3 sm:p-6 space-y-4 sm:space-y-6"},Sa={class:"glass-card rounded-[15px] z-10 p-3 sm:p-4 border border-cyan-400 dark:border-primary/30 bg-cyan-500/10 dark:bg-primary/10"},ja={class:"text-cyan-700 dark:text-primary text-sm sm:text-base"},Ta={class:"mt-1 sm:mt-2 text-cyan-600 dark:text-primary/80"},Na={class:"glass-card rounded-[15px] p-3 sm:p-6"},Ba={class:"flex overflow-x-auto border-b border-stroke-subtle dark:border-stroke/10 mb-4 sm:mb-6 -mx-3 px-3 sm:mx-0 sm:px-0 scrollbar-hide"},Ea=["onClick"],La={class:"flex items-center gap-1 sm:gap-2"},Fa={key:0,class:"w-3.5 h-3.5 sm:w-4 sm:h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Pa={key:1,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},za={key:2,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Va={key:3,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Da={key:4,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ia={key:5,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ha={key:6,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ua={key:7,class:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},Ra={class:"min-h-[400px]"},Ka={key:0,class:"flex items-center justify-center py-12"},Oa={key:1,class:"flex items-center justify-center py-12"},qa={class:"text-center"},Wa={class:"text-content-secondary dark:text-content-muted text-sm mb-4"},Ga={key:2},Za=q({name:"ConfigurationView",__name:"Configuration",setup(I){const _=re(),i=m(Ae("configuration_activeTab","radio")),x=m(!1);te(i,p=>Se("configuration_activeTab",p));const g=[{id:"radio",label:"Radio Settings",icon:"radio"},{id:"repeater",label:"Repeater Settings",icon:"repeater"},{id:"advert",label:"Advert Limits",icon:"advert"},{id:"duty",label:"Duty Cycle",icon:"duty"},{id:"delays",label:"TX Delays",icon:"delays"},{id:"transport",label:"Regions/Keys",icon:"keys"},{id:"api-tokens",label:"API Tokens",icon:"tokens"},{id:"web",label:"Web Options",icon:"web"}];ae(async()=>{try{await _.fetchStats(),x.value=!0}catch(p){console.error("Failed to load configuration data:",p),x.value=!0}});function c(p){i.value=p}return(p,s)=>{const v=be("router-link");return o(),r("div",Aa,[s[14]||(s[14]=e("div",null,[e("h1",{class:"text-xl sm:text-2xl font-bold text-content-primary dark:text-content-primary"},"Configuration"),e("p",{class:"text-content-secondary dark:text-content-muted mt-1 sm:mt-2 text-sm sm:text-base"},"System configuration and settings")],-1)),e("div",Sa,[e("div",ja,[s[3]||(s[3]=e("strong",null,"CAD Calibration Tool Available",-1)),e("p",Ta,[s[2]||(s[2]=H(" Optimize your Channel Activity Detection settings. ",-1)),R(v,{to:"/cad-calibration",class:"underline hover:text-cyan-800 dark:hover:text-primary transition-colors"},{default:ve(()=>s[1]||(s[1]=[H(" Launch CAD Calibration Tool → ",-1)])),_:1,__:[1]})])])]),e("div",Na,[e("div",Ba,[(o(),r(U,null,J(g,f=>e("button",{key:f.id,onClick:h=>c(f.id),class:D(["px-3 sm:px-4 py-2 text-xs sm:text-sm font-medium transition-colors duration-200 border-b-2 mr-3 sm:mr-6 whitespace-nowrap flex-shrink-0",i.value===f.id?"text-cyan-500 dark:text-primary border-cyan-500 dark:border-primary":"text-content-secondary dark:text-content-muted border-transparent hover:text-content-primary dark:hover:text-content-primary hover:border-stroke-subtle dark:hover:border-stroke/30"])},[e("div",La,[f.icon==="radio"?(o(),r("svg",Fa,s[4]||(s[4]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M8.111 16.404a5.5 5.5 0 017.778 0M12 20h.01m-7.08-7.071c3.904-3.905 10.236-3.905 14.141 0M1.394 9.822c5.716-5.716 14.976-5.716 20.692 0"},null,-1)]))):f.icon==="repeater"?(o(),r("svg",Pa,s[5]||(s[5]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M5 12h14M5 12l4-4m-4 4l4 4"},null,-1)]))):f.icon==="advert"?(o(),r("svg",za,s[6]||(s[6]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M3 8l7.89 5.26a2 2 0 002.22 0L21 8M5 19h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z"},null,-1)]))):f.icon==="duty"?(o(),r("svg",Va,s[7]||(s[7]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"},null,-1)]))):f.icon==="delays"?(o(),r("svg",Da,s[8]||(s[8]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 3v1m0 16v1m9-9h-1M4 12H3m15.364 6.364l-.707-.707M6.343 6.343l-.707-.707m12.728 0l-.707.707M6.343 17.657l-.707.707M16 12a4 4 0 11-8 0 4 4 0 018 0z"},null,-1)]))):f.icon==="keys"?(o(),r("svg",Ia,s[9]||(s[9]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M15 7a2 2 0 012 2m4 0a6 6 0 01-7.743 5.743L11 17H9v2H7v2H4a1 1 0 01-1-1v-2.586a1 1 0 01.293-.707l5.964-5.964A6 6 0 1121 9z"},null,-1)]))):f.icon==="tokens"?(o(),r("svg",Ha,s[10]||(s[10]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m5.618-4.016A11.955 11.955 0 0112 2.944a11.955 11.955 0 01-8.618 3.04A12.02 12.02 0 003 9c0 5.591 3.824 10.29 9 11.622 5.176-1.332 9-6.03 9-11.622 0-1.042-.133-2.052-.382-3.016z"},null,-1)]))):f.icon==="web"?(o(),r("svg",Ua,s[11]||(s[11]=[e("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9m-9 9a9 9 0 019-9"},null,-1)]))):L("",!0),H(" "+u(f.label),1)])],10,Ea)),64))]),e("div",Ra,[!x.value&&X(_).isLoading?(o(),r("div",Ka,s[12]||(s[12]=[e("div",{class:"text-center"},[e("div",{class:"animate-spin w-8 h-8 border-2 border-stroke-subtle dark:border-stroke/20 border-t-cyan-500 dark:border-t-primary rounded-full mx-auto mb-4"}),e("div",{class:"text-content-secondary dark:text-content-muted"},"Loading configuration...")],-1)]))):X(_).error&&!x.value?(o(),r("div",Oa,[e("div",qa,[s[13]||(s[13]=e("div",{class:"text-red-500 dark:text-red-400 mb-2"},"Failed to load configuration",-1)),e("div",Wa,u(X(_).error),1),e("button",{onClick:s[0]||(s[0]=f=>X(_).fetchStats()),class:"px-4 py-2 bg-cyan-500/20 dark:bg-primary/20 hover:bg-cyan-500/30 dark:hover:bg-primary/30 text-cyan-900 dark:text-white rounded-lg border border-cyan-500/50 dark:border-primary/50 transition-colors"}," Retry ")])])):(o(),r("div",Ga,[S(e("div",null,[R(st,{key:"radio-settings"})],512),[[Z,i.value==="radio"]]),S(e("div",null,[R(Dt,{key:"repeater-settings"})],512),[[Z,i.value==="repeater"]]),S(e("div",null,[R(Ma,{key:"advert-settings"})],512),[[Z,i.value==="advert"]]),S(e("div",null,[R(Xt,{key:"duty-cycle"})],512),[[Z,i.value==="duty"]]),S(e("div",null,[R(mo,{key:"transmission-delays"})],512),[[Z,i.value==="delays"]]),S(e("div",null,[R(ms,{key:"transport-keys"})],512),[[Z,i.value==="transport"]]),S(e("div",null,[R(Is,{key:"api-tokens"})],512),[[Z,i.value==="api-tokens"]]),S(e("div",null,[R(mn,{key:"web-settings"})],512),[[Z,i.value==="web"]])]))])])])}}});export{Za as default};