p&&(S=z,p=I);p>s&&(n[S]=1,Gt(t,n,s,r,S),Gt(t,n,s,S,c))}function An(t,n){for(var s=[t[0]],r=1,c=0,p=t.length;rn&&(s.push(t[r]),c=r);return cn.max.x&&(s|=2),t.yn.max.y&&(s|=8),s}function Br(t,n){var s=n.x-t.x,r=n.y-t.y;return s*s+r*r}function $n(t,n,s,r){var c=n.x,p=n.y,S=s.x-c,z=s.y-p,I=S*S+z*z,W;return I>0&&(W=((t.x-c)*S+(t.y-p)*z)/I,W>1?(c=s.x,p=s.y):W>0&&(c+=S*W,p+=z*W)),S=t.x-c,z=t.y-p,r?S*S+z*z:new et(c,p)}function Ce(t){return!dt(t[0])||typeof t[0][0]!="object"&&typeof t[0][0]<"u"}function Fi(t){return console.warn("Deprecated use of _flat, please use L.LineUtil.isFlat instead."),Ce(t)}function bi(t,n){var s,r,c,p,S,z,I,W;if(!t||t.length===0)throw new Error("latlngs not passed");Ce(t)||(console.warn("latlngs are not flat! Only the first ring will be used"),t=t[0]);var at=j([0,0]),Lt=Jt(t),Ut=Lt.getNorthWest().distanceTo(Lt.getSouthWest())*Lt.getNorthEast().distanceTo(Lt.getNorthWest());Ut<1700&&(at=qn(t));var He=t.length,Me=[];for(s=0;sr){I=(p-r)/c,W=[z.x-I*(z.x-S.x),z.y-I*(z.y-S.y)];break}var Je=n.unproject(pt(W));return j([Je.lat+at.lat,Je.lng+at.lng])}var kn={__proto__:null,simplify:Yn,pointToSegmentDistance:Ni,closestPointOnSegment:Rr,clipSegment:ls,_getEdgeIntersection:us,_getBitCode:In,_sqClosestPointOnSegment:$n,isFlat:Ce,_flat:Fi,polylineCenter:bi},Sn={project:function(t){return new et(t.lng,t.lat)},unproject:function(t){return new Bt(t.y,t.x)},bounds:new kt([-180,-90],[180,90])},Bi={R:6378137,R_MINOR:6356752314245179e-9,bounds:new kt([-2003750834279e-5,-1549657073972e-5],[2003750834279e-5,1876465623138e-5]),project:function(t){var n=Math.PI/180,s=this.R,r=t.lat*n,c=this.R_MINOR/s,p=Math.sqrt(1-c*c),S=p*Math.sin(r),z=Math.tan(Math.PI/4-r/2)/Math.pow((1-S)/(1+S),p/2);return r=-s*Math.log(Math.max(z,1e-10)),new et(t.lng*n*s,r)},unproject:function(t){for(var n=180/Math.PI,s=this.R,r=this.R_MINOR/s,c=Math.sqrt(1-r*r),p=Math.exp(-t.y/s),S=Math.PI/2-2*Math.atan(p),z=0,I=.1,W;z<15&&Math.abs(I)>1e-7;z++)W=c*Math.sin(S),W=Math.pow((1-W)/(1+W),c/2),I=Math.PI/2-2*Math.atan(p*W)-S,S+=I;return new Bt(S*n,t.x*n/s)}},Eo={__proto__:null,LonLat:Sn,Mercator:Bi,SphericalMercator:se},Vr=l({},E,{code:"EPSG:3395",projection:Bi,transformation:(function(){var t=.5/(Math.PI*Bi.R);return v(t,.5,-t,.5)})()}),Bs=l({},E,{code:"EPSG:4326",projection:Sn,transformation:v(1/180,1,-1/180,.5)}),zo=l({},C,{projection:Sn,transformation:v(1,0,-1,0),scale:function(t){return Math.pow(2,t)},zoom:function(t){return Math.log(t)/Math.LN2},distance:function(t,n){var s=n.lng-t.lng,r=n.lat-t.lat;return Math.sqrt(s*s+r*r)},infinite:!0});C.Earth=E,C.EPSG3395=Vr,C.EPSG3857=m,C.EPSG900913=M,C.EPSG4326=Bs,C.Simple=zo;var en=At.extend({options:{pane:"overlayPane",attribution:null,bubblingMouseEvents:!0},addTo:function(t){return t.addLayer(this),this},remove:function(){return this.removeFrom(this._map||this._mapToAdd)},removeFrom:function(t){return t&&t.removeLayer(this),this},getPane:function(t){return this._map.getPane(t?this.options[t]||t:this.options.pane)},addInteractiveTarget:function(t){return this._map._targets[y(t)]=this,this},removeInteractiveTarget:function(t){return delete this._map._targets[y(t)],this},getAttribution:function(){return this.options.attribution},_layerAdd:function(t){var n=t.target;if(n.hasLayer(this)){if(this._map=n,this._zoomAnimated=n._zoomAnimated,this.getEvents){var s=this.getEvents();n.on(s,this),this.once("remove",function(){n.off(s,this)},this)}this.onAdd(n),this.fire("add"),n.fire("layeradd",{layer:this})}}});Zt.include({addLayer:function(t){if(!t._layerAdd)throw new Error("The provided object is not a Layer.");var n=y(t);return this._layers[n]?this:(this._layers[n]=t,t._mapToAdd=this,t.beforeAdd&&t.beforeAdd(this),this.whenReady(t._layerAdd,t),this)},removeLayer:function(t){var n=y(t);return this._layers[n]?(this._loaded&&t.onRemove(this),delete this._layers[n],this._loaded&&(this.fire("layerremove",{layer:t}),t.fire("remove")),t._map=t._mapToAdd=null,this):this},hasLayer:function(t){return y(t)in this._layers},eachLayer:function(t,n){for(var s in this._layers)t.call(n,this._layers[s]);return this},_addLayers:function(t){t=t?dt(t)?t:[t]:[];for(var n=0,s=t.length;nthis._layersMaxZoom&&this.setZoom(this._layersMaxZoom),this.options.minZoom===void 0&&this._layersMinZoom&&this.getZoom()=2&&n[0]instanceof Bt&&n[0].equals(n[s-1])&&n.pop(),n},_setLatLngs:function(t){Xn.prototype._setLatLngs.call(this,t),Ce(this._latlngs)&&(this._latlngs=[this._latlngs])},_defaultShape:function(){return Ce(this._latlngs[0])?this._latlngs[0]:this._latlngs[0][0]},_clipPoints:function(){var t=this._renderer._bounds,n=this.options.weight,s=new et(n,n);if(t=new kt(t.min.subtract(s),t.max.add(s)),this._parts=[],!(!this._pxBounds||!this._pxBounds.intersects(t))){if(this.options.noClip){this._parts=this._rings;return}for(var r=0,c=this._rings.length,p;rt.y!=c.y>t.y&&t.x<(c.x-r.x)*(t.y-r.y)/(c.y-r.y)+r.x&&(n=!n);return n||Xn.prototype._containsPoint.call(this,t,!0)}});function Ec(t,n){return new fs(t,n)}var Qn=Pn.extend({initialize:function(t,n){Q(this,n),this._layers={},t&&this.addData(t)},addData:function(t){var n=dt(t)?t:t.features,s,r,c;if(n){for(s=0,r=n.length;s0&&c.push(c[0].slice()),c}function hs(t,n){return t.feature?l({},t.feature,{geometry:n}):No(n)}function No(t){return t.type==="Feature"||t.type==="FeatureCollection"?t:{type:"Feature",properties:{},geometry:t}}var Hr={toGeoJSON:function(t){return hs(this,{type:"Point",coordinates:Ur(this.getLatLng(),t)})}};ds.include(Hr),qt.include(Hr),H.include(Hr),Xn.include({toGeoJSON:function(t){var n=!Ce(this._latlngs),s=Do(this._latlngs,n?1:0,!1,t);return hs(this,{type:(n?"Multi":"")+"LineString",coordinates:s})}}),fs.include({toGeoJSON:function(t){var n=!Ce(this._latlngs),s=n&&!Ce(this._latlngs[0]),r=Do(this._latlngs,s?2:n?1:0,!0,t);return n||(r=[r]),hs(this,{type:(s?"Multi":"")+"Polygon",coordinates:r})}}),xi.include({toMultiPoint:function(t){var n=[];return this.eachLayer(function(s){n.push(s.toGeoJSON(t).geometry.coordinates)}),hs(this,{type:"MultiPoint",coordinates:n})},toGeoJSON:function(t){var n=this.feature&&this.feature.geometry&&this.feature.geometry.type;if(n==="MultiPoint")return this.toMultiPoint(t);var s=n==="GeometryCollection",r=[];return this.eachLayer(function(c){if(c.toGeoJSON){var p=c.toGeoJSON(t);if(s)r.push(p.geometry);else{var S=No(p);S.type==="FeatureCollection"?r.push.apply(r,S.features):r.push(S)}}}),s?hs(this,{geometries:r,type:"GeometryCollection"}):{type:"FeatureCollection",features:r}}});function Ra(t,n){return new Qn(t,n)}var zc=Ra,Ro=en.extend({options:{opacity:1,alt:"",interactive:!1,crossOrigin:!1,errorOverlayUrl:"",zIndex:1,className:""},initialize:function(t,n,s){this._url=t,this._bounds=Jt(n),Q(this,s)},onAdd:function(){this._image||(this._initImage(),this.options.opacity<1&&this._updateOpacity()),this.options.interactive&&(Pt(this._image,"leaflet-interactive"),this.addInteractiveTarget(this._image)),this.getPane().appendChild(this._image),this._reset()},onRemove:function(){Qt(this._image),this.options.interactive&&this.removeInteractiveTarget(this._image)},setOpacity:function(t){return this.options.opacity=t,this._image&&this._updateOpacity(),this},setStyle:function(t){return t.opacity&&this.setOpacity(t.opacity),this},bringToFront:function(){return this._map&&ln(this._image),this},bringToBack:function(){return this._map&&bn(this._image),this},setUrl:function(t){return this._url=t,this._image&&(this._image.src=t),this},setBounds:function(t){return this._bounds=Jt(t),this._map&&this._reset(),this},getEvents:function(){var t={zoom:this._reset,viewreset:this._reset};return this._zoomAnimated&&(t.zoomanim=this._animateZoom),t},setZIndex:function(t){return this.options.zIndex=t,this._updateZIndex(),this},getBounds:function(){return this._bounds},getElement:function(){return this._image},_initImage:function(){var t=this._url.tagName==="IMG",n=this._image=t?this._url:X("img");if(Pt(n,"leaflet-image-layer"),this._zoomAnimated&&Pt(n,"leaflet-zoom-animated"),this.options.className&&Pt(n,this.options.className),n.onselectstart=A,n.onmousemove=A,n.onload=h(this.fire,this,"load"),n.onerror=h(this._overlayOnError,this,"error"),(this.options.crossOrigin||this.options.crossOrigin==="")&&(n.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),this.options.zIndex&&this._updateZIndex(),t){this._url=n.src;return}n.src=this._url,n.alt=this.options.alt},_animateZoom:function(t){var n=this._map.getZoomScale(t.zoom),s=this._map._latLngBoundsToNewLayerBounds(this._bounds,t.zoom,t.center).min;Se(this._image,s,n)},_reset:function(){var t=this._image,n=new kt(this._map.latLngToLayerPoint(this._bounds.getNorthWest()),this._map.latLngToLayerPoint(this._bounds.getSouthEast())),s=n.getSize();ge(t,n.min),t.style.width=s.x+"px",t.style.height=s.y+"px"},_updateOpacity:function(){$e(this._image,this.options.opacity)},_updateZIndex:function(){this._image&&this.options.zIndex!==void 0&&this.options.zIndex!==null&&(this._image.style.zIndex=this.options.zIndex)},_overlayOnError:function(){this.fire("error");var t=this.options.errorOverlayUrl;t&&this._url!==t&&(this._url=t,this._image.src=t)},getCenter:function(){return this._bounds.getCenter()}}),Ac=function(t,n,s){return new Ro(t,n,s)},Fa=Ro.extend({options:{autoplay:!0,loop:!0,keepAspectRatio:!0,muted:!1,playsInline:!0},_initImage:function(){var t=this._url.tagName==="VIDEO",n=this._image=t?this._url:X("video");if(Pt(n,"leaflet-image-layer"),this._zoomAnimated&&Pt(n,"leaflet-zoom-animated"),this.options.className&&Pt(n,this.options.className),n.onselectstart=A,n.onmousemove=A,n.onloadeddata=h(this.fire,this,"load"),t){for(var s=n.getElementsByTagName("source"),r=[],c=0;c0?r:[n.src];return}dt(this._url)||(this._url=[this._url]),!this.options.keepAspectRatio&&Object.prototype.hasOwnProperty.call(n.style,"objectFit")&&(n.style.objectFit="fill"),n.autoplay=!!this.options.autoplay,n.loop=!!this.options.loop,n.muted=!!this.options.muted,n.playsInline=!!this.options.playsInline;for(var p=0;p×',It(r,"click",function(c){Le(c),this.close()},this)}},_updateLayout:function(){var t=this._contentNode,n=t.style;n.width="",n.whiteSpace="nowrap";var s=t.offsetWidth;s=Math.min(s,this.options.maxWidth),s=Math.max(s,this.options.minWidth),n.width=s+1+"px",n.whiteSpace="",n.height="";var r=t.offsetHeight,c=this.options.maxHeight,p="leaflet-popup-scrolled";c&&r>c?(n.height=c+"px",Pt(t,p)):oe(t,p),this._containerWidth=this._container.offsetWidth},_animateZoom:function(t){var n=this._map._latLngToNewLayerPoint(this._latlng,t.zoom,t.center),s=this._getAnchor();ge(this._container,n.add(s))},_adjustPan:function(){if(this.options.autoPan){if(this._map._panAnim&&this._map._panAnim.stop(),this._autopanning){this._autopanning=!1;return}var t=this._map,n=parseInt(Mi(this._container,"marginBottom"),10)||0,s=this._container.offsetHeight+n,r=this._containerWidth,c=new et(this._containerLeft,-s-this._containerBottom);c._add(En(this._container));var p=t.layerPointToContainerPoint(c),S=pt(this.options.autoPanPadding),z=pt(this.options.autoPanPaddingTopLeft||S),I=pt(this.options.autoPanPaddingBottomRight||S),W=t.getSize(),at=0,Lt=0;p.x+r+I.x>W.x&&(at=p.x+r-W.x+I.x),p.x-at-z.x<0&&(at=p.x-z.x),p.y+s+I.y>W.y&&(Lt=p.y+s-W.y+I.y),p.y-Lt-z.y<0&&(Lt=p.y-z.y),(at||Lt)&&(this.options.keepInView&&(this._autopanning=!0),t.fire("autopanstart").panBy([at,Lt]))}},_getAnchor:function(){return pt(this._source&&this._source._getPopupAnchor?this._source._getPopupAnchor():[0,0])}}),Dc=function(t,n){return new Fo(t,n)};Zt.mergeOptions({closePopupOnClick:!0}),Zt.include({openPopup:function(t,n,s){return this._initOverlay(Fo,t,n,s).openOn(this),this},closePopup:function(t){return t=arguments.length?t:this._popup,t&&t.close(),this}}),en.include({bindPopup:function(t,n){return this._popup=this._initOverlay(Fo,this._popup,t,n),this._popupHandlersAdded||(this.on({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!0),this},unbindPopup:function(){return this._popup&&(this.off({click:this._openPopup,keypress:this._onKeyPress,remove:this.closePopup,move:this._movePopup}),this._popupHandlersAdded=!1,this._popup=null),this},openPopup:function(t){return this._popup&&(this instanceof Pn||(this._popup._source=this),this._popup._prepareOpen(t||this._latlng)&&this._popup.openOn(this._map)),this},closePopup:function(){return this._popup&&this._popup.close(),this},togglePopup:function(){return this._popup&&this._popup.toggle(this),this},isPopupOpen:function(){return this._popup?this._popup.isOpen():!1},setPopupContent:function(t){return this._popup&&this._popup.setContent(t),this},getPopup:function(){return this._popup},_openPopup:function(t){if(!(!this._popup||!this._map)){wn(t);var n=t.layer||t.target;if(this._popup._source===n&&!(n instanceof f)){this._map.hasLayer(this._popup)?this.closePopup():this.openPopup(t.latlng);return}this._popup._source=n,this.openPopup(t.latlng)}},_movePopup:function(t){this._popup.setLatLng(t.latlng)},_onKeyPress:function(t){t.originalEvent.keyCode===13&&this._openPopup(t)}});var Bo=Dn.extend({options:{pane:"tooltipPane",offset:[0,0],direction:"auto",permanent:!1,sticky:!1,opacity:.9},onAdd:function(t){Dn.prototype.onAdd.call(this,t),this.setOpacity(this.options.opacity),t.fire("tooltipopen",{tooltip:this}),this._source&&(this.addEventParent(this._source),this._source.fire("tooltipopen",{tooltip:this},!0))},onRemove:function(t){Dn.prototype.onRemove.call(this,t),t.fire("tooltipclose",{tooltip:this}),this._source&&(this.removeEventParent(this._source),this._source.fire("tooltipclose",{tooltip:this},!0))},getEvents:function(){var t=Dn.prototype.getEvents.call(this);return this.options.permanent||(t.preclick=this.close),t},_initLayout:function(){var t="leaflet-tooltip",n=t+" "+(this.options.className||"")+" leaflet-zoom-"+(this._zoomAnimated?"animated":"hide");this._contentNode=this._container=X("div",n),this._container.setAttribute("role","tooltip"),this._container.setAttribute("id","leaflet-tooltip-"+y(this))},_updateLayout:function(){},_adjustPan:function(){},_setPosition:function(t){var n,s,r=this._map,c=this._container,p=r.latLngToContainerPoint(r.getCenter()),S=r.layerPointToContainerPoint(t),z=this.options.direction,I=c.offsetWidth,W=c.offsetHeight,at=pt(this.options.offset),Lt=this._getAnchor();z==="top"?(n=I/2,s=W):z==="bottom"?(n=I/2,s=0):z==="center"?(n=I/2,s=W/2):z==="right"?(n=0,s=W/2):z==="left"?(n=I,s=W/2):S.xthis.options.maxZoom||sr?this._retainParent(c,p,S,r):!1)},_retainChildren:function(t,n,s,r){for(var c=2*t;c<2*t+2;c++)for(var p=2*n;p<2*n+2;p++){var S=new et(c,p);S.z=s+1;var z=this._tileCoordsToKey(S),I=this._tiles[z];if(I&&I.active){I.retain=!0;continue}else I&&I.loaded&&(I.retain=!0);s+1this.options.maxZoom||this.options.minZoom!==void 0&&c1){this._setView(t,s);return}for(var Lt=c.min.y;Lt<=c.max.y;Lt++)for(var Ut=c.min.x;Ut<=c.max.x;Ut++){var He=new et(Ut,Lt);if(He.z=this._tileZoom,!!this._isValidTile(He)){var Me=this._tiles[this._tileCoordsToKey(He)];Me?Me.current=!0:S.push(He)}}if(S.sort(function(Je,ms){return Je.distanceTo(p)-ms.distanceTo(p)}),S.length!==0){this._loading||(this._loading=!0,this.fire("loading"));var dn=document.createDocumentFragment();for(Ut=0;Uts.max.x)||!n.wrapLat&&(t.ys.max.y))return!1}if(!this.options.bounds)return!0;var r=this._tileCoordsToBounds(t);return Jt(this.options.bounds).overlaps(r)},_keyToBounds:function(t){return this._tileCoordsToBounds(this._keyToTileCoords(t))},_tileCoordsToNwSe:function(t){var n=this._map,s=this.getTileSize(),r=t.scaleBy(s),c=r.add(s),p=n.unproject(r,t.z),S=n.unproject(c,t.z);return[p,S]},_tileCoordsToBounds:function(t){var n=this._tileCoordsToNwSe(t),s=new ae(n[0],n[1]);return this.options.noWrap||(s=this._map.wrapLatLngBounds(s)),s},_tileCoordsToKey:function(t){return t.x+":"+t.y+":"+t.z},_keyToTileCoords:function(t){var n=t.split(":"),s=new et(+n[0],+n[1]);return s.z=+n[2],s},_removeTile:function(t){var n=this._tiles[t];n&&(Qt(n.el),delete this._tiles[t],this.fire("tileunload",{tile:n.el,coords:this._keyToTileCoords(t)}))},_initTile:function(t){Pt(t,"leaflet-tile");var n=this.getTileSize();t.style.width=n.x+"px",t.style.height=n.y+"px",t.onselectstart=A,t.onmousemove=A,ft.ielt9&&this.options.opacity<1&&$e(t,this.options.opacity)},_addTile:function(t,n){var s=this._getTilePos(t),r=this._tileCoordsToKey(t),c=this.createTile(this._wrapCoords(t),h(this._tileReady,this,t));this._initTile(c),this.createTile.length<2&&Et(h(this._tileReady,this,t,null,c)),ge(c,s),this._tiles[r]={el:c,coords:t,current:!0},n.appendChild(c),this.fire("tileloadstart",{tile:c,coords:t})},_tileReady:function(t,n,s){n&&this.fire("tileerror",{error:n,tile:s,coords:t});var r=this._tileCoordsToKey(t);s=this._tiles[r],s&&(s.loaded=+new Date,this._map._fadeAnimated?($e(s.el,0),nt(this._fadeFrame),this._fadeFrame=Et(this._updateOpacity,this)):(s.active=!0,this._pruneTiles()),n||(Pt(s.el,"leaflet-tile-loaded"),this.fire("tileload",{tile:s.el,coords:t})),this._noTilesToLoad()&&(this._loading=!1,this.fire("load"),ft.ielt9||!this._map._fadeAnimated?Et(this._pruneTiles,this):setTimeout(h(this._pruneTiles,this),250)))},_getTilePos:function(t){return t.scaleBy(this.getTileSize()).subtract(this._level.origin)},_wrapCoords:function(t){var n=new et(this._wrapX?w(t.x,this._wrapX):t.x,this._wrapY?w(t.y,this._wrapY):t.y);return n.z=t.z,n},_pxBoundsToTileRange:function(t){var n=this.getTileSize();return new kt(t.min.unscaleBy(n).floor(),t.max.unscaleBy(n).ceil().subtract([1,1]))},_noTilesToLoad:function(){for(var t in this._tiles)if(!this._tiles[t].loaded)return!1;return!0}});function Fc(t){return new Zs(t)}var ps=Zs.extend({options:{minZoom:0,maxZoom:18,subdomains:"abc",errorTileUrl:"",zoomOffset:0,tms:!1,zoomReverse:!1,detectRetina:!1,crossOrigin:!1,referrerPolicy:!1},initialize:function(t,n){this._url=t,n=Q(this,n),n.detectRetina&&ft.retina&&n.maxZoom>0?(n.tileSize=Math.floor(n.tileSize/2),n.zoomReverse?(n.zoomOffset--,n.minZoom=Math.min(n.maxZoom,n.minZoom+1)):(n.zoomOffset++,n.maxZoom=Math.max(n.minZoom,n.maxZoom-1)),n.minZoom=Math.max(0,n.minZoom)):n.zoomReverse?n.minZoom=Math.min(n.maxZoom,n.minZoom):n.maxZoom=Math.max(n.minZoom,n.maxZoom),typeof n.subdomains=="string"&&(n.subdomains=n.subdomains.split("")),this.on("tileunload",this._onTileRemove)},setUrl:function(t,n){return this._url===t&&n===void 0&&(n=!0),this._url=t,n||this.redraw(),this},createTile:function(t,n){var s=document.createElement("img");return It(s,"load",h(this._tileOnLoad,this,n,s)),It(s,"error",h(this._tileOnError,this,n,s)),(this.options.crossOrigin||this.options.crossOrigin==="")&&(s.crossOrigin=this.options.crossOrigin===!0?"":this.options.crossOrigin),typeof this.options.referrerPolicy=="string"&&(s.referrerPolicy=this.options.referrerPolicy),s.alt="",s.src=this.getTileUrl(t),s},getTileUrl:function(t){var n={r:ft.retina?"@2x":"",s:this._getSubdomain(t),x:t.x,y:t.y,z:this._getZoomForUrl()};if(this._map&&!this._map.options.crs.infinite){var s=this._globalTileRange.max.y-t.y;this.options.tms&&(n.y=s),n["-y"]=s}return q(this._url,l(n,this.options))},_tileOnLoad:function(t,n){ft.ielt9?setTimeout(h(t,this,null,n),0):t(null,n)},_tileOnError:function(t,n,s){var r=this.options.errorTileUrl;r&&n.getAttribute("src")!==r&&(n.src=r),t(s,n)},_onTileRemove:function(t){t.tile.onload=null},_getZoomForUrl:function(){var t=this._tileZoom,n=this.options.maxZoom,s=this.options.zoomReverse,r=this.options.zoomOffset;return s&&(t=n-t),t+r},_getSubdomain:function(t){var n=Math.abs(t.x+t.y)%this.options.subdomains.length;return this.options.subdomains[n]},_abortLoading:function(){var t,n;for(t in this._tiles)if(this._tiles[t].coords.z!==this._tileZoom&&(n=this._tiles[t].el,n.onload=A,n.onerror=A,!n.complete)){n.src=ht;var s=this._tiles[t].coords;Qt(n),delete this._tiles[t],this.fire("tileabort",{tile:n,coords:s})}},_removeTile:function(t){var n=this._tiles[t];if(n)return n.el.setAttribute("src",ht),Zs.prototype._removeTile.call(this,t)},_tileReady:function(t,n,s){if(!(!this._map||s&&s.getAttribute("src")===ht))return Zs.prototype._tileReady.call(this,t,n,s)}});function Za(t,n){return new ps(t,n)}var Ua=ps.extend({defaultWmsParams:{service:"WMS",request:"GetMap",layers:"",styles:"",format:"image/jpeg",transparent:!1,version:"1.1.1"},options:{crs:null,uppercase:!1},initialize:function(t,n){this._url=t;var s=l({},this.defaultWmsParams);for(var r in n)r in this.options||(s[r]=n[r]);n=Q(this,n);var c=n.detectRetina&&ft.retina?2:1,p=this.getTileSize();s.width=p.x*c,s.height=p.y*c,this.wmsParams=s},onAdd:function(t){this._crs=this.options.crs||t.options.crs,this._wmsVersion=parseFloat(this.wmsParams.version);var n=this._wmsVersion>=1.3?"crs":"srs";this.wmsParams[n]=this._crs.code,ps.prototype.onAdd.call(this,t)},getTileUrl:function(t){var n=this._tileCoordsToNwSe(t),s=this._crs,r=Yt(s.project(n[0]),s.project(n[1])),c=r.min,p=r.max,S=(this._wmsVersion>=1.3&&this._crs===Bs?[c.y,c.x,p.y,p.x]:[c.x,c.y,p.x,p.y]).join(","),z=ps.prototype.getTileUrl.call(this,t);return z+Ot(this.wmsParams,z,this.options.uppercase)+(this.options.uppercase?"&BBOX=":"&bbox=")+S},setParams:function(t,n){return l(this.wmsParams,t),n||this.redraw(),this}});function Bc(t,n){return new Ua(t,n)}ps.WMS=Ua,Za.wms=Bc;var ti=en.extend({options:{padding:.1},initialize:function(t){Q(this,t),y(this),this._layers=this._layers||{}},onAdd:function(){this._container||(this._initContainer(),Pt(this._container,"leaflet-zoom-animated")),this.getPane().appendChild(this._container),this._update(),this.on("update",this._updatePaths,this)},onRemove:function(){this.off("update",this._updatePaths,this),this._destroyContainer()},getEvents:function(){var t={viewreset:this._reset,zoom:this._onZoom,moveend:this._update,zoomend:this._onZoomEnd};return this._zoomAnimated&&(t.zoomanim=this._onAnimZoom),t},_onAnimZoom:function(t){this._updateTransform(t.center,t.zoom)},_onZoom:function(){this._updateTransform(this._map.getCenter(),this._map.getZoom())},_updateTransform:function(t,n){var s=this._map.getZoomScale(n,this._zoom),r=this._map.getSize().multiplyBy(.5+this.options.padding),c=this._map.project(this._center,n),p=r.multiplyBy(-s).add(c).subtract(this._map._getNewPixelOrigin(t,n));ft.any3d?Se(this._container,p,s):ge(this._container,p)},_reset:function(){this._update(),this._updateTransform(this._center,this._zoom);for(var t in this._layers)this._layers[t]._reset()},_onZoomEnd:function(){for(var t in this._layers)this._layers[t]._project()},_updatePaths:function(){for(var t in this._layers)this._layers[t]._update()},_update:function(){var t=this.options.padding,n=this._map.getSize(),s=this._map.containerPointToLayerPoint(n.multiplyBy(-t)).round();this._bounds=new kt(s,s.add(n.multiplyBy(1+t*2)).round()),this._center=this._map.getCenter(),this._zoom=this._map.getZoom()}}),Ha=ti.extend({options:{tolerance:0},getEvents:function(){var t=ti.prototype.getEvents.call(this);return t.viewprereset=this._onViewPreReset,t},_onViewPreReset:function(){this._postponeUpdatePaths=!0},onAdd:function(){ti.prototype.onAdd.call(this),this._draw()},_initContainer:function(){var t=this._container=document.createElement("canvas");It(t,"mousemove",this._onMouseMove,this),It(t,"click dblclick mousedown mouseup contextmenu",this._onClick,this),It(t,"mouseout",this._handleMouseOut,this),t._leaflet_disable_events=!0,this._ctx=t.getContext("2d")},_destroyContainer:function(){nt(this._redrawRequest),delete this._ctx,Qt(this._container),te(this._container),delete this._container},_updatePaths:function(){if(!this._postponeUpdatePaths){var t;this._redrawBounds=null;for(var n in this._layers)t=this._layers[n],t._update();this._redraw()}},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ti.prototype._update.call(this);var t=this._bounds,n=this._container,s=t.getSize(),r=ft.retina?2:1;ge(n,t.min),n.width=r*s.x,n.height=r*s.y,n.style.width=s.x+"px",n.style.height=s.y+"px",ft.retina&&this._ctx.scale(2,2),this._ctx.translate(-t.min.x,-t.min.y),this.fire("update")}},_reset:function(){ti.prototype._reset.call(this),this._postponeUpdatePaths&&(this._postponeUpdatePaths=!1,this._updatePaths())},_initPath:function(t){this._updateDashArray(t),this._layers[y(t)]=t;var n=t._order={layer:t,prev:this._drawLast,next:null};this._drawLast&&(this._drawLast.next=n),this._drawLast=n,this._drawFirst=this._drawFirst||this._drawLast},_addPath:function(t){this._requestRedraw(t)},_removePath:function(t){var n=t._order,s=n.next,r=n.prev;s?s.prev=r:this._drawLast=r,r?r.next=s:this._drawFirst=s,delete t._order,delete this._layers[y(t)],this._requestRedraw(t)},_updatePath:function(t){this._extendRedrawBounds(t),t._project(),t._update(),this._requestRedraw(t)},_updateStyle:function(t){this._updateDashArray(t),this._requestRedraw(t)},_updateDashArray:function(t){if(typeof t.options.dashArray=="string"){var n=t.options.dashArray.split(/[, ]+/),s=[],r,c;for(c=0;c')}}catch{}return function(t){return document.createElement("<"+t+' xmlns="urn:schemas-microsoft.com:vml" class="lvml">')}})(),Vc={_initContainer:function(){this._container=X("div","leaflet-vml-container")},_update:function(){this._map._animatingZoom||(ti.prototype._update.call(this),this.fire("update"))},_initPath:function(t){var n=t._container=Us("shape");Pt(n,"leaflet-vml-shape "+(this.options.className||"")),n.coordsize="1 1",t._path=Us("path"),n.appendChild(t._path),this._updateStyle(t),this._layers[y(t)]=t},_addPath:function(t){var n=t._container;this._container.appendChild(n),t.options.interactive&&t.addInteractiveTarget(n)},_removePath:function(t){var n=t._container;Qt(n),t.removeInteractiveTarget(n),delete this._layers[y(t)]},_updateStyle:function(t){var n=t._stroke,s=t._fill,r=t.options,c=t._container;c.stroked=!!r.stroke,c.filled=!!r.fill,r.stroke?(n||(n=t._stroke=Us("stroke")),c.appendChild(n),n.weight=r.weight+"px",n.color=r.color,n.opacity=r.opacity,r.dashArray?n.dashStyle=dt(r.dashArray)?r.dashArray.join(" "):r.dashArray.replace(/( *, *)/g," "):n.dashStyle="",n.endcap=r.lineCap.replace("butt","flat"),n.joinstyle=r.lineJoin):n&&(c.removeChild(n),t._stroke=null),r.fill?(s||(s=t._fill=Us("fill")),c.appendChild(s),s.color=r.fillColor||r.color,s.opacity=r.fillOpacity):s&&(c.removeChild(s),t._fill=null)},_updateCircle:function(t){var n=t._point.round(),s=Math.round(t._radius),r=Math.round(t._radiusY||s);this._setPath(t,t._empty()?"M0 0":"AL "+n.x+","+n.y+" "+s+","+r+" 0,"+65535*360)},_setPath:function(t,n){t._path.v=n},_bringToFront:function(t){ln(t._container)},_bringToBack:function(t){bn(t._container)}},Vo=ft.vml?Us:F,Hs=ti.extend({_initContainer:function(){this._container=Vo("svg"),this._container.setAttribute("pointer-events","none"),this._rootGroup=Vo("g"),this._container.appendChild(this._rootGroup)},_destroyContainer:function(){Qt(this._container),te(this._container),delete this._container,delete this._rootGroup,delete this._svgSize},_update:function(){if(!(this._map._animatingZoom&&this._bounds)){ti.prototype._update.call(this);var t=this._bounds,n=t.getSize(),s=this._container;(!this._svgSize||!this._svgSize.equals(n))&&(this._svgSize=n,s.setAttribute("width",n.x),s.setAttribute("height",n.y)),ge(s,t.min),s.setAttribute("viewBox",[t.min.x,t.min.y,n.x,n.y].join(" ")),this.fire("update")}},_initPath:function(t){var n=t._path=Vo("path");t.options.className&&Pt(n,t.options.className),t.options.interactive&&Pt(n,"leaflet-interactive"),this._updateStyle(t),this._layers[y(t)]=t},_addPath:function(t){this._rootGroup||this._initContainer(),this._rootGroup.appendChild(t._path),t.addInteractiveTarget(t._path)},_removePath:function(t){Qt(t._path),t.removeInteractiveTarget(t._path),delete this._layers[y(t)]},_updatePath:function(t){t._project(),t._update()},_updateStyle:function(t){var n=t._path,s=t.options;n&&(s.stroke?(n.setAttribute("stroke",s.color),n.setAttribute("stroke-opacity",s.opacity),n.setAttribute("stroke-width",s.weight),n.setAttribute("stroke-linecap",s.lineCap),n.setAttribute("stroke-linejoin",s.lineJoin),s.dashArray?n.setAttribute("stroke-dasharray",s.dashArray):n.removeAttribute("stroke-dasharray"),s.dashOffset?n.setAttribute("stroke-dashoffset",s.dashOffset):n.removeAttribute("stroke-dashoffset")):n.setAttribute("stroke","none"),s.fill?(n.setAttribute("fill",s.fillColor||s.color),n.setAttribute("fill-opacity",s.fillOpacity),n.setAttribute("fill-rule",s.fillRule||"evenodd")):n.setAttribute("fill","none"))},_updatePoly:function(t,n){this._setPath(t,R(t._parts,n))},_updateCircle:function(t){var n=t._point,s=Math.max(Math.round(t._radius),1),r=Math.max(Math.round(t._radiusY),1)||s,c="a"+s+","+r+" 0 1,0 ",p=t._empty()?"M0 0":"M"+(n.x-s)+","+n.y+c+s*2+",0 "+c+-s*2+",0 ";this._setPath(t,p)},_setPath:function(t,n){t._path.setAttribute("d",n)},_bringToFront:function(t){ln(t._path)},_bringToBack:function(t){bn(t._path)}});ft.vml&&Hs.include(Vc);function Wa(t){return ft.svg||ft.vml?new Hs(t):null}Zt.include({getRenderer:function(t){var n=t.options.renderer||this._getPaneRenderer(t.options.pane)||this.options.renderer||this._renderer;return n||(n=this._renderer=this._createRenderer()),this.hasLayer(n)||this.addLayer(n),n},_getPaneRenderer:function(t){if(t==="overlayPane"||t===void 0)return!1;var n=this._paneRenderers[t];return n===void 0&&(n=this._createRenderer({pane:t}),this._paneRenderers[t]=n),n},_createRenderer:function(t){return this.options.preferCanvas&&ja(t)||Wa(t)}});var Ka=fs.extend({initialize:function(t,n){fs.prototype.initialize.call(this,this._boundsToLatLngs(t),n)},setBounds:function(t){return this.setLatLngs(this._boundsToLatLngs(t))},_boundsToLatLngs:function(t){return t=Jt(t),[t.getSouthWest(),t.getNorthWest(),t.getNorthEast(),t.getSouthEast()]}});function Zc(t,n){return new Ka(t,n)}Hs.create=Vo,Hs.pointsToPath=R,Qn.geometryToLayer=Io,Qn.coordsToLatLng=Zr,Qn.coordsToLatLngs=$o,Qn.latLngToCoords=Ur,Qn.latLngsToCoords=Do,Qn.getFeature=hs,Qn.asFeature=No,Zt.mergeOptions({boxZoom:!0});var Ga=re.extend({initialize:function(t){this._map=t,this._container=t._container,this._pane=t._panes.overlayPane,this._resetStateTimeout=0,t.on("unload",this._destroy,this)},addHooks:function(){It(this._container,"mousedown",this._onMouseDown,this)},removeHooks:function(){te(this._container,"mousedown",this._onMouseDown,this)},moved:function(){return this._moved},_destroy:function(){Qt(this._pane),delete this._pane},_resetState:function(){this._resetStateTimeout=0,this._moved=!1},_clearDeferredResetState:function(){this._resetStateTimeout!==0&&(clearTimeout(this._resetStateTimeout),this._resetStateTimeout=0)},_onMouseDown:function(t){if(!t.shiftKey||t.which!==1&&t.button!==1)return!1;this._clearDeferredResetState(),this._resetState(),gi(),$s(),this._startPoint=this._map.mouseEventToContainerPoint(t),It(document,{contextmenu:wn,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseMove:function(t){this._moved||(this._moved=!0,this._box=X("div","leaflet-zoom-box",this._container),Pt(this._container,"leaflet-crosshair"),this._map.fire("boxzoomstart")),this._point=this._map.mouseEventToContainerPoint(t);var n=new kt(this._point,this._startPoint),s=n.getSize();ge(this._box,n.min),this._box.style.width=s.x+"px",this._box.style.height=s.y+"px"},_finish:function(){this._moved&&(Qt(this._box),oe(this._container,"leaflet-crosshair")),Ei(),Ds(),te(document,{contextmenu:wn,mousemove:this._onMouseMove,mouseup:this._onMouseUp,keydown:this._onKeyDown},this)},_onMouseUp:function(t){if(!(t.which!==1&&t.button!==1)&&(this._finish(),!!this._moved)){this._clearDeferredResetState(),this._resetStateTimeout=setTimeout(h(this._resetState,this),0);var n=new ae(this._map.containerPointToLatLng(this._startPoint),this._map.containerPointToLatLng(this._point));this._map.fitBounds(n).fire("boxzoomend",{boxZoomBounds:n})}},_onKeyDown:function(t){t.keyCode===27&&(this._finish(),this._clearDeferredResetState(),this._resetState())}});Zt.addInitHook("addHandler","boxZoom",Ga),Zt.mergeOptions({doubleClickZoom:!0});var qa=re.extend({addHooks:function(){this._map.on("dblclick",this._onDoubleClick,this)},removeHooks:function(){this._map.off("dblclick",this._onDoubleClick,this)},_onDoubleClick:function(t){var n=this._map,s=n.getZoom(),r=n.options.zoomDelta,c=t.originalEvent.shiftKey?s-r:s+r;n.options.doubleClickZoom==="center"?n.setZoom(c):n.setZoomAround(t.containerPoint,c)}});Zt.addInitHook("addHandler","doubleClickZoom",qa),Zt.mergeOptions({dragging:!0,inertia:!0,inertiaDeceleration:3400,inertiaMaxSpeed:1/0,easeLinearity:.2,worldCopyJump:!1,maxBoundsViscosity:0});var Ya=re.extend({addHooks:function(){if(!this._draggable){var t=this._map;this._draggable=new Ye(t._mapPane,t._container),this._draggable.on({dragstart:this._onDragStart,drag:this._onDrag,dragend:this._onDragEnd},this),this._draggable.on("predrag",this._onPreDragLimit,this),t.options.worldCopyJump&&(this._draggable.on("predrag",this._onPreDragWrap,this),t.on("zoomend",this._onZoomEnd,this),t.whenReady(this._onZoomEnd,this))}Pt(this._map._container,"leaflet-grab leaflet-touch-drag"),this._draggable.enable(),this._positions=[],this._times=[]},removeHooks:function(){oe(this._map._container,"leaflet-grab"),oe(this._map._container,"leaflet-touch-drag"),this._draggable.disable()},moved:function(){return this._draggable&&this._draggable._moved},moving:function(){return this._draggable&&this._draggable._moving},_onDragStart:function(){var t=this._map;if(t._stop(),this._map.options.maxBounds&&this._map.options.maxBoundsViscosity){var n=Jt(this._map.options.maxBounds);this._offsetLimit=Yt(this._map.latLngToContainerPoint(n.getNorthWest()).multiplyBy(-1),this._map.latLngToContainerPoint(n.getSouthEast()).multiplyBy(-1).add(this._map.getSize())),this._viscosity=Math.min(1,Math.max(0,this._map.options.maxBoundsViscosity))}else this._offsetLimit=null;t.fire("movestart").fire("dragstart"),t.options.inertia&&(this._positions=[],this._times=[])},_onDrag:function(t){if(this._map.options.inertia){var n=this._lastTime=+new Date,s=this._lastPos=this._draggable._absPos||this._draggable._newPos;this._positions.push(s),this._times.push(n),this._prunePositions(n)}this._map.fire("move",t).fire("drag",t)},_prunePositions:function(t){for(;this._positions.length>1&&t-this._times[0]>50;)this._positions.shift(),this._times.shift()},_onZoomEnd:function(){var t=this._map.getSize().divideBy(2),n=this._map.latLngToLayerPoint([0,0]);this._initialWorldOffset=n.subtract(t).x,this._worldWidth=this._map.getPixelWorldBounds().getSize().x},_viscousLimit:function(t,n){return t-(t-n)*this._viscosity},_onPreDragLimit:function(){if(!(!this._viscosity||!this._offsetLimit)){var t=this._draggable._newPos.subtract(this._draggable._startPos),n=this._offsetLimit;t.xn.max.x&&(t.x=this._viscousLimit(t.x,n.max.x)),t.y>n.max.y&&(t.y=this._viscousLimit(t.y,n.max.y)),this._draggable._newPos=this._draggable._startPos.add(t)}},_onPreDragWrap:function(){var t=this._worldWidth,n=Math.round(t/2),s=this._initialWorldOffset,r=this._draggable._newPos.x,c=(r-n+s)%t+n-s,p=(r+n+s)%t-n-s,S=Math.abs(c+s)0?p:-p))-n;this._delta=0,this._startTime=null,S&&(t.options.scrollWheelZoom==="center"?t.setZoom(n+S):t.setZoomAround(this._lastMousePos,n+S))}});Zt.addInitHook("addHandler","scrollWheelZoom",Xa);var Uc=600;Zt.mergeOptions({tapHold:ft.touchNative&&ft.safari&&ft.mobile,tapTolerance:15});var Qa=re.extend({addHooks:function(){It(this._map._container,"touchstart",this._onDown,this)},removeHooks:function(){te(this._map._container,"touchstart",this._onDown,this)},_onDown:function(t){if(clearTimeout(this._holdTimeout),t.touches.length===1){var n=t.touches[0];this._startPos=this._newPos=new et(n.clientX,n.clientY),this._holdTimeout=setTimeout(h(function(){this._cancel(),this._isTapValid()&&(It(document,"touchend",Le),It(document,"touchend touchcancel",this._cancelClickPrevent),this._simulateEvent("contextmenu",n))},this),Uc),It(document,"touchend touchcancel contextmenu",this._cancel,this),It(document,"touchmove",this._onMove,this)}},_cancelClickPrevent:function t(){te(document,"touchend",Le),te(document,"touchend touchcancel",t)},_cancel:function(){clearTimeout(this._holdTimeout),te(document,"touchend touchcancel contextmenu",this._cancel,this),te(document,"touchmove",this._onMove,this)},_onMove:function(t){var n=t.touches[0];this._newPos=new et(n.clientX,n.clientY)},_isTapValid:function(){return this._newPos.distanceTo(this._startPos)<=this._map.options.tapTolerance},_simulateEvent:function(t,n){var s=new MouseEvent(t,{bubbles:!0,cancelable:!0,view:window,screenX:n.screenX,screenY:n.screenY,clientX:n.clientX,clientY:n.clientY});s._simulated=!0,n.target.dispatchEvent(s)}});Zt.addInitHook("addHandler","tapHold",Qa),Zt.mergeOptions({touchZoom:ft.touch,bounceAtZoomLimits:!0});var tl=re.extend({addHooks:function(){Pt(this._map._container,"leaflet-touch-zoom"),It(this._map._container,"touchstart",this._onTouchStart,this)},removeHooks:function(){oe(this._map._container,"leaflet-touch-zoom"),te(this._map._container,"touchstart",this._onTouchStart,this)},_onTouchStart:function(t){var n=this._map;if(!(!t.touches||t.touches.length!==2||n._animatingZoom||this._zooming)){var s=n.mouseEventToContainerPoint(t.touches[0]),r=n.mouseEventToContainerPoint(t.touches[1]);this._centerPoint=n.getSize()._divideBy(2),this._startLatLng=n.containerPointToLatLng(this._centerPoint),n.options.touchZoom!=="center"&&(this._pinchStartLatLng=n.containerPointToLatLng(s.add(r)._divideBy(2))),this._startDist=s.distanceTo(r),this._startZoom=n.getZoom(),this._moved=!1,this._zooming=!0,n._stop(),It(document,"touchmove",this._onTouchMove,this),It(document,"touchend touchcancel",this._onTouchEnd,this),Le(t)}},_onTouchMove:function(t){if(!(!t.touches||t.touches.length!==2||!this._zooming)){var n=this._map,s=n.mouseEventToContainerPoint(t.touches[0]),r=n.mouseEventToContainerPoint(t.touches[1]),c=s.distanceTo(r)/this._startDist;if(this._zoom=n.getScaleZoom(c,this._startZoom),!n.options.bounceAtZoomLimits&&(this._zoomn.getMaxZoom()&&c>1)&&(this._zoom=n._limitZoom(this._zoom)),n.options.touchZoom==="center"){if(this._center=this._startLatLng,c===1)return}else{var p=s._add(r)._divideBy(2)._subtract(this._centerPoint);if(c===1&&p.x===0&&p.y===0)return;this._center=n.unproject(n.project(this._pinchStartLatLng,this._zoom).subtract(p),this._zoom)}this._moved||(n._moveStart(!0,!1),this._moved=!0),nt(this._animRequest);var S=h(n._move,n,this._center,this._zoom,{pinch:!0,round:!1},void 0);this._animRequest=Et(S,this,!0),Le(t)}},_onTouchEnd:function(){if(!this._moved||!this._zooming){this._zooming=!1;return}this._zooming=!1,nt(this._animRequest),te(document,"touchmove",this._onTouchMove,this),te(document,"touchend touchcancel",this._onTouchEnd,this),this._map.options.zoomAnimation?this._map._animateZoom(this._center,this._map._limitZoom(this._zoom),!0,this._map.options.zoomSnap):this._map._resetView(this._center,this._map._limitZoom(this._zoom))}});Zt.addInitHook("addHandler","touchZoom",tl),Zt.BoxZoom=Ga,Zt.DoubleClickZoom=qa,Zt.Drag=Ya,Zt.Keyboard=Ja,Zt.ScrollWheelZoom=Xa,Zt.TapHold=Qa,Zt.TouchZoom=tl,o.Bounds=kt,o.Browser=ft,o.CRS=C,o.Canvas=Ha,o.Circle=qt,o.CircleMarker=H,o.Class=zt,o.Control=Ue,o.DivIcon=Va,o.DivOverlay=Dn,o.DomEvent=Lo,o.DomUtil=Ar,o.Draggable=Ye,o.Evented=At,o.FeatureGroup=Pn,o.GeoJSON=Qn,o.GridLayer=Zs,o.Handler=re,o.Icon=cn,o.ImageOverlay=Ro,o.LatLng=Bt,o.LatLngBounds=ae,o.Layer=en,o.LayerGroup=xi,o.LineUtil=kn,o.Map=Zt,o.Marker=ds,o.Mixin=yi,o.Path=f,o.Point=et,o.PolyUtil=Oo,o.Polygon=fs,o.Polyline=Xn,o.Popup=Fo,o.PosAnimation=Ai,o.Projection=Eo,o.Rectangle=Ka,o.Renderer=ti,o.SVG=Hs,o.SVGOverlay=Ba,o.TileLayer=ps,o.Tooltip=Bo,o.Transformation=Ge,o.Util=ut,o.VideoOverlay=Fa,o.bind=h,o.bounds=Yt,o.canvas=ja,o.circle=Mc,o.circleMarker=k,o.control=Ii,o.divIcon=Rc,o.extend=l,o.featureGroup=de,o.geoJSON=Ra,o.geoJson=zc,o.gridLayer=Fc,o.icon=Vs,o.imageOverlay=Ac,o.latLng=j,o.latLngBounds=Jt,o.layerGroup=cs,o.map=os,o.marker=b,o.point=pt,o.polygon=Ec,o.polyline=Oc,o.popup=Dc,o.rectangle=Zc,o.setOptions=Q,o.stamp=y,o.svg=Wa,o.svgOverlay=$c,o.tileLayer=Za,o.tooltip=Nc,o.transformation=v,o.version=a,o.videoOverlay=Ic;var Hc=window.L;o.noConflict=function(){return window.L=Hc,this},window.L=o}))})(Js,Js.exports)),Js.exports}var Rp=Np();const Go=$p(Rp),Ql={__name:"DeviceMap",props:{position:{type:Object,default:null},trail:{type:Array,default:()=>[]}},setup(e){const i=e,o=G(null);let a,l,d;function h(){if(!a)return;const _=i.position;if(_&&(_.lat||_.lng)){const y=[_.lat,_.lng];l?l.setLatLng(y):(l=Go.marker(y).addTo(a),a.setView(y,17))}if(d&&d.remove(),i.trail.length){const y=getComputedStyle(document.documentElement).getPropertyValue("--accent").trim()||"#3D7BF0";d=Go.polyline(i.trail,{color:y,weight:3}).addTo(a)}}return Yi(()=>{a=Go.map(o.value,{zoomControl:!0}).setView([20,0],2),Go.tileLayer("https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",{attribution:"© OpenStreetMap",maxZoom:19}).addTo(a),setTimeout(()=>a.invalidateSize(),60),h()}),Qe(()=>i.position,h,{deep:!0}),Qe(()=>i.trail,h,{deep:!0}),(_,y)=>(g(),x("div",{ref_key:"el",ref:o,class:"h-[320px] w-full rounded-lg"},null,512))}},Fp=["width","height","stroke-width"],Bp=["d"],Y={__name:"Icon",props:{name:{type:String,required:!0},size:{type:[Number,String],default:18},stroke:{type:[Number,String],default:2}},setup(e){const a=({grid:"M3 3h7v7H3zM14 3h7v7h-7zM14 14h7v7h-7zM3 14h7v7H3z",radio:"M4.9 19.1a10 10 0 0 1 0-14.2M7.8 16.2a6 6 0 0 1 0-8.4M16.2 7.8a6 6 0 0 1 0 8.4M19.1 4.9a10 10 0 0 1 0 14.2M12 13a1 1 0 1 0 0-2 1 1 0 0 0 0 2z",route:"M6 19a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM18 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM6 13V9a4 4 0 0 1 4-4h4",calendar:"M8 2v4M16 2v4M3 10h18M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z",book:"M4 19.5A2.5 2.5 0 0 1 6.5 17H20M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z",fileText:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8zM14 2v6h6M16 13H8M16 17H8M10 9H8",settings:"M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6z M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z",search:"M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16zM21 21l-4.3-4.3",plus:"M12 5v14M5 12h14",battery:"M3 8h14a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H3a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1zM22 11v2",signal:"M2 20h.01M7 20v-4M12 20v-8M17 20V8M22 20V4",clock:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM12 7v5l3 2",chevronRight:"M9 6l6 6-6 6",play:"M6 3l14 9-14 9V3z",logout:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4M16 17l5-5-5-5M21 12H9",wind:"M12.8 19.6A2 2 0 1 0 14 16H2M17.5 8a2.5 2.5 0 1 1 2 4H2M9.6 4.6A2 2 0 1 1 11 8H2",drone:"M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zM6 6 4 4M18 6l2-2M6 18l-2 2M18 18l2 2",user:"M20 21a8 8 0 1 0-16 0M12 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8z",users:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM23 21v-2a4 4 0 0 0-3-3.87M16 3.13a4 4 0 0 1 0 7.75",shield:"M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10z",sliders:"M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6",alertTriangle:"M10.29 3.86 1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0zM12 9v4M12 17h.01",download:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3",upload:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12",trash:"M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6M10 11v6M14 11v6",check:"M20 6 9 17l-5-5",mail:"M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2zM22 6l-10 7L2 6",lock:"M5 11h14a2 2 0 0 1 2 2v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-6a2 2 0 0 1 2-2zM7 11V7a5 5 0 0 1 10 0v4",monitor:"M3 4h18a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM8 21h8M12 17v4",globe:"M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18zM3 12h18M12 3a15 15 0 0 1 0 18 15 15 0 0 1 0-18z",smartphone:"M7 2h10a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H7a1 1 0 0 1-1-1V3a1 1 0 0 1 1-1zM11 18h2",image:"M4 4h16a1 1 0 0 1 1 1v14a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1zM8.5 11a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3zM21 15l-5-5L5 21",type:"M4 7V4h16v3M9 20h6M12 4v16",sun:"M12 17a5 5 0 1 0 0-10 5 5 0 0 0 0 10zM12 1v2M12 21v2M4.2 4.2l1.4 1.4M18.4 18.4l1.4 1.4M1 12h2M21 12h2M4.2 19.8l1.4-1.4M18.4 5.6l1.4-1.4",moon:"M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z",x:"M18 6 6 18M6 6l12 12",server:"M20 4H4a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2zM20 13H4a2 2 0 0 0-2 2v3a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2zM6 7.5h.01M6 16.5h.01",cloud:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9z"}[e.name]||"").split(" M").map((l,d)=>d?"M"+l:l);return(l,d)=>(g(),x("svg",{width:e.size,height:e.size,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":e.stroke,"stroke-linecap":"round","stroke-linejoin":"round",style:{flex:"none"},"aria-hidden":"true"},[(g(!0),x(ct,null,Wt($t(a),(h,_)=>(g(),x("path",{key:_,d:h},null,8,Bp))),128))],8,Fp))}},Vp=["aria-checked","disabled"],nn={__name:"Toggle",props:{modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:["update:modelValue"],setup(e,{emit:i}){const o=i;return(a,l)=>(g(),x("button",{type:"button",role:"switch","aria-checked":e.modelValue,disabled:e.disabled,class:Ct(["relative inline-flex h-6 w-11 shrink-0 items-center rounded-full transition disabled:opacity-40",e.modelValue?"bg-accent":"bg-surface-2 border border-line-strong"]),onClick:l[0]||(l[0]=d=>o("update:modelValue",!e.modelValue))},[u("span",{class:Ct(["inline-block h-4 w-4 transform rounded-full bg-white shadow-sm transition",e.modelValue?"translate-x-6":"translate-x-1"])},null,2)],10,Vp))}},Zp={class:"inline-flex rounded-[10px] border border-line bg-surface-2 p-0.5"},Up=["onClick"],hn={__name:"Segmented",props:{modelValue:{type:[String,Number],default:""},options:{type:Array,default:()=>[]}},emits:["update:modelValue"],setup(e,{emit:i}){const o=i;return(a,l)=>(g(),x("div",Zp,[(g(!0),x(ct,null,Wt(e.options,d=>(g(),x("button",{key:d.value,type:"button",class:Ct(["inline-flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-[13px] font-semibold transition",e.modelValue===d.value?"bg-surface-1 text-ink shadow-xs":"text-ink-secondary hover:text-ink"]),onClick:h=>o("update:modelValue",d.value)},[d.icon?(g(),ie(Y,{key:0,name:d.icon,size:15},null,8,["name"])):N("",!0),$(" "+P(d.label),1)],10,Up))),128))]))}},Hp={class:"text-sm font-semibold text-ink"},jp={key:0,class:"mt-0.5 text-xs text-ink-muted"},_t={__name:"Row",props:{title:{type:String,default:""},desc:{type:String,default:""},keywords:{type:String,default:""},block:{type:Boolean,default:!1}},setup(e){const i=e,o=eo("settingsSearch",{value:""}),a=xt(()=>{const l=(o.value||"").trim().toLowerCase();return l?`${i.title} ${i.desc} ${i.keywords}`.toLowerCase().includes(l):!0});return(l,d)=>a.value?(g(),x("div",{key:0,class:Ct(["border-b border-line py-4 last:border-0",e.block?"":"flex items-center justify-between gap-6"])},[u("div",{class:Ct(e.block?"mb-3":"min-w-0")},[u("div",Hp,P(e.title),1),e.desc?(g(),x("div",jp,P(e.desc),1)):N("",!0)],2),u("div",{class:Ct(e.block?"":"shrink-0")},[af(l.$slots,"default")],2)],2)):N("",!0)}},Wp=(e,i)=>{const o=e.__vccOpts||e;for(const[a,l]of i)o[a]=l;return o},Kp={class:"mx-auto max-w-[1280px] p-7"},Gp={class:"mb-5 flex flex-wrap items-end justify-between gap-4"},qp={class:"flex h-10 w-full max-w-[280px] items-center gap-2 rounded border border-line-strong bg-surface-1 px-3"},Yp={class:"grid grid-cols-[210px_1fr] gap-6 max-[760px]:grid-cols-1"},Jp={class:"flex flex-col gap-0.5 max-[760px]:flex-row max-[760px]:overflow-x-auto"},Xp=["onClick"],Qp={class:"whitespace-nowrap"},tm={class:"min-w-0"},em={key:0,class:"panel p-10 text-center text-sm text-ink-muted"},nm={key:0,class:"eyebrow mb-2 mt-5 first:mt-0 flex items-center gap-2"},im={key:1,class:"panel mb-5 p-5"},sm={class:"flex items-center gap-1"},om={class:"flex items-center gap-2"},rm={class:"font-mono text-sm text-ink"},am={class:"inline-flex items-center gap-1 rounded-full bg-amber-soft px-2 py-0.5 text-[11px] font-semibold text-amber-fg"},lm={key:0,class:"mt-2 text-xs text-ink-muted"},um={class:"grid max-w-[420px] gap-2"},cm={class:"flex items-center gap-3"},dm={key:2,class:"panel mb-5 p-5"},fm=["value"],hm=["value"],pm=["value"],mm={class:"font-mono text-sm text-ink"},gm={key:3},_m={key:0,class:"mb-5 flex items-center gap-1 overflow-x-auto border-b border-line"},vm=["onClick"],ym={key:1,class:"panel mb-5 p-5"},bm={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},xm={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},wm={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},km={key:1,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},Sm={key:4,class:"border-b border-line py-3 text-xs text-amber-fg"},Pm={key:0},Tm={key:5,class:"border-b border-line py-3 text-xs text-ink-muted"},Lm={class:"font-semibold text-ink-secondary"},Cm={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},Mm={key:7,class:"my-4 rounded-lg border border-line bg-surface-2 p-4","data-keywords":"credits usage quota remaining daily allowance rate limit"},Om={class:"flex items-center justify-between gap-3"},Em={class:"flex items-center gap-2 text-sm font-semibold text-ink"},zm={key:0,class:"text-[11px] text-ink-muted"},Am={class:"mt-2 flex items-baseline gap-1.5"},Im={class:"font-mono text-2xl font-semibold text-ink"},$m={class:"text-sm text-ink-muted"},Dm={class:"mt-2 h-2 w-full overflow-hidden rounded-full bg-line"},Nm={class:"mt-2 text-xs text-ink-muted"},Rm={class:"mt-2 text-sm text-ink"},Fm={class:"font-semibold"},Bm={class:"mt-1 text-xs text-ink-muted"},Vm={key:1,class:"mt-2 text-xs text-ink-muted"},Zm={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},Um={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Hm={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},jm={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Wm={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Km={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Gm={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},qm={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Ym={key:8,class:"border-b border-line py-3 text-xs text-amber-fg"},Jm={class:"mt-4 flex flex-wrap items-center gap-3"},Xm=["disabled"],Qm=["disabled"],tg={key:2,class:"text-xs text-danger-fg"},eg={class:"panel mb-5 p-5"},ng={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},ig={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},sg={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},og={key:1,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},rg={key:4,class:"border-b border-line py-3 text-xs text-amber-fg"},ag={key:0},lg={key:5,class:"border-b border-line py-3 text-xs text-ink-muted"},ug={class:"font-semibold text-ink-secondary"},cg={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},dg={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},fg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},hg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},pg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},mg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},gg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},_g={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},vg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},yg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},bg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},xg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},wg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},kg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Sg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Pg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Tg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Lg={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},Cg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Mg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Og={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Eg={class:"mt-4 flex flex-wrap items-center gap-3"},zg=["disabled"],Ag=["disabled"],Ig={key:2,class:"text-xs text-danger-fg"},$g={key:3,class:"text-[11px] text-ink-muted"},Dg={class:"panel mb-5 p-5"},Ng={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},Rg={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},Fg={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},Bg={key:1,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},Vg={key:4,class:"border-b border-line py-3 text-xs text-amber-fg"},Zg={key:0},Ug={key:5,class:"border-b border-line py-3 text-xs text-ink-muted"},Hg={class:"font-semibold text-ink-secondary"},jg={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},Wg={key:0,class:"inline-flex items-center gap-2 break-all font-mono text-sm text-ink"},Kg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Gg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},qg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Yg={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},Jg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},Xg={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},Qg={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},t_={key:0,class:"inline-flex items-center gap-2 font-mono text-sm text-ink"},e_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},n_={class:"mt-4 flex flex-wrap items-center gap-3"},i_=["disabled"],s_=["disabled"],o_={key:2,class:"text-xs text-danger-fg"},r_={key:3,class:"text-[11px] text-ink-muted"},a_={key:3,class:"panel mb-5 p-5"},l_={class:"mb-4 flex items-start gap-3 border-b border-line pb-4"},u_={class:"grid h-10 w-10 place-items-center rounded-lg bg-accent-soft text-accent-soft-fg"},c_={key:0,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},d_={key:1,class:"mb-4 rounded-lg border border-line bg-surface-2 px-4 py-3 text-xs text-ink-secondary"},f_={key:2,class:"mb-4 flex flex-col gap-2 border-b border-line pb-4 sm:flex-row sm:items-center sm:justify-between"},h_={key:5,class:"border-b border-line py-3 text-xs text-amber-fg"},p_={key:0},m_={key:6,class:"border-b border-line py-3 text-xs text-ink-muted"},g_={class:"font-semibold text-ink-secondary"},__={key:7,class:"border-b border-line py-3 text-xs text-ink-muted"},v_={class:"flex w-full flex-col gap-2"},y_={class:"break-all font-mono text-sm text-ink"},b_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},x_={key:1,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},w_={key:0,class:"text-xs text-ink-muted"},k_={key:1,class:"border-b border-line py-3 text-xs text-ink-muted"},S_={key:0,class:"inline-flex items-center gap-2 text-sm text-ink"},P_={key:0,class:"inline-flex items-center gap-1 rounded-full bg-surface-2 px-2 py-0.5 text-[10px] font-semibold text-ink-secondary"},T_={class:"mt-4 flex flex-wrap items-center gap-3"},L_=["disabled"],C_=["disabled"],M_={key:2,class:"text-xs text-danger-fg"},O_={key:3,class:"text-[11px] text-ink-muted"},E_={key:4,class:"panel mb-5 p-5"},z_={class:"flex items-center gap-4"},A_=["src"],I_={key:1,class:"grid h-16 w-16 place-items-center rounded-full bg-[var(--navy-800)] text-lg font-bold text-white"},$_={class:"flex gap-2"},D_={class:"btn-ghost cursor-pointer"},N_={class:"mt-1 text-right text-[11px] text-ink-muted"},R_={key:5,class:"panel mb-5 p-5"},F_={class:"flex items-center gap-3"},B_={key:0,class:"mt-4 rounded-lg border border-line bg-surface-2 p-4"},V_={class:"flex flex-wrap items-center gap-4"},Z_={class:"min-w-0"},U_={class:"mt-1 select-all font-mono text-sm font-bold text-ink"},H_={class:"mt-3 flex items-center gap-2"},j_={key:0,class:"mt-2 text-xs text-danger-fg"},W_={key:1,class:"mt-4 rounded-lg border border-line bg-surface-2 p-4"},K_={class:"mt-2 grid grid-cols-2 gap-1 font-mono text-xs text-ink-secondary sm:grid-cols-4"},G_={class:"rounded-lg border border-line bg-surface-2 p-3"},q_={class:"flex items-center gap-3"},Y_={class:"grid h-9 w-9 place-items-center rounded-full bg-accent-soft text-accent-soft-fg"},J_={class:"min-w-0 flex-1"},X_={class:"text-sm font-semibold text-ink"},Q_={class:"font-mono text-[11px] text-ink-muted"},tv={key:6,class:"mb-5"},ev={key:0,class:"panel mb-5 p-5"},nv={class:"grid max-w-[520px] gap-2"},iv={class:"flex flex-wrap gap-2"},sv=["disabled","title"],ov=["value"],rv=["value"],av={class:"flex items-center gap-2 py-1 text-sm text-ink-secondary"},lv={class:"flex items-center gap-3"},uv=["disabled"],cv={key:0,class:"text-xs text-danger-fg"},dv={key:1,class:"text-xs text-ink-muted"},fv={key:1,class:"panel mb-5 p-5"},hv={class:"grid max-w-[520px] gap-2"},pv={class:"flex flex-wrap gap-2"},mv=["value"],gv=["value"],_v={key:1,class:"text-xs text-ink-muted"},vv={class:"font-semibold text-ink-secondary"},yv={class:"flex items-center gap-3"},bv=["disabled"],xv={key:0,class:"text-xs text-danger-fg"},wv={class:"panel overflow-hidden p-0"},kv={class:"flex items-center justify-between px-5 py-4"},Sv=["disabled"],Pv={key:0,class:"px-5 pb-5 text-sm text-danger-fg"},Tv={key:1,class:"px-5 pb-8 text-sm text-ink-muted"},Lv={key:2,class:"overflow-x-auto"},Cv={class:"w-full border-collapse text-sm"},Mv={class:"text-left"},Ov={class:"px-5 py-3"},Ev={class:"text-ink"},zv={key:0,class:"ml-1.5 text-[11px] text-ink-muted"},Av={class:"px-5 py-3"},Iv={class:"px-5 py-3"},$v={class:"px-5 py-3"},Dv={class:"px-5 py-3 text-right"},Nv=["onClick"],Rv={key:1,class:"inline-flex items-center gap-1.5"},Fv=["onClick"],Bv=["onClick"],Vv={key:7,class:"mb-5"},Zv={key:0,class:"panel mb-5 p-5"},Uv={class:"grid max-w-[520px] gap-2"},Hv={class:"flex items-center gap-3"},jv={key:0,class:"text-xs text-danger-fg"},Wv={key:1,class:"panel mb-5 p-5"},Kv={class:"grid max-w-[520px] gap-2"},Gv={class:"flex items-center gap-3"},qv=["disabled"],Yv={key:0,class:"text-xs text-danger-fg"},Jv={class:"panel overflow-hidden p-0"},Xv={key:0,class:"px-5 pb-8 text-sm text-ink-muted"},Qv={key:1,class:"overflow-x-auto"},ty={class:"w-full border-collapse text-sm"},ey={class:"text-left"},ny={class:"px-5 py-3"},iy={class:"inline-flex items-center gap-2 text-ink"},sy={class:"px-5 py-3 text-ink-secondary"},oy={class:"px-5 py-3 text-right"},ry=["onClick"],ay={key:1,class:"inline-flex items-center gap-1.5"},ly=["onClick"],uy=["disabled","title","onClick"],cy={key:8,class:"mb-5"},dy={class:"panel mb-5 p-5"},fy={class:"btn-ghost cursor-pointer"},hy={key:0,class:"mt-2 text-xs text-ink-muted"},py={class:"rounded-lg border p-5",style:{"border-color":"color-mix(in srgb, var(--danger) 35%, transparent)",background:"var(--danger-soft)"}},my={class:"flex items-center gap-2 text-danger-fg"},gy={class:"mt-4 rounded-lg border border-line bg-surface-1 p-4"},_y={class:"mt-3 flex items-start gap-2 text-sm text-ink-secondary"},vy={class:"mt-3"},yy={class:"eyebrow mb-1 block"},by={class:"text-ink"},xy=["placeholder"],wy={class:"mt-4 flex flex-wrap items-center gap-3"},ky=["disabled"],Sy=["disabled"],Py={key:2,class:"text-xs text-ink-muted"},Ty={key:0,class:"mt-3 rounded border border-line bg-surface-2 px-3 py-2 text-xs text-ink-secondary"},Ly={key:0,class:"fixed bottom-5 right-5 z-20 flex items-center gap-2 rounded-lg border border-line bg-surface-1 px-4 py-2.5 text-sm text-ink shadow-md"},tu="pv.opensky.health",eu="pv.filetransfer.health",nu="pv.webdav.health",iu="pv.localstorage.health",Cy={__name:"Settings",props:{email:{type:String,default:""},role:{type:String,default:"user"},organization:{type:String,default:""},organizationName:{type:String,default:""}},emits:["logout"],setup(e,{emit:i}){const o=e,a=i,l=xt(()=>o.role==="superadmin"),d=xt(()=>o.role==="admin"||o.role==="superadmin");function h(b){return b==="superadmin"?"Superadmin":b==="admin"?"Admin":"User"}function _(b){return b==="superadmin"||b==="admin"?"shield":"user"}function y(b){return b==="superadmin"||b==="admin"?T.accent:T.neutral}const T={success:"bg-success-soft text-success-fg",warning:"bg-amber-soft text-amber-fg",danger:"bg-danger-soft text-danger-fg",accent:"bg-accent-soft text-accent-soft-fg",neutral:"bg-surface-2 text-ink-secondary"},w=xt(()=>{const b=[{id:"account",label:"Account",icon:"user",kw:"name username email password verification login credentials role"},{id:"appearance",label:"Appearance",icon:"sliders",kw:"theme light dark system language region font size accessibility date time format motion"},{id:"integrations",label:"Integrations",icon:"radio",kw:"opensky flights adsb aircraft plugin oauth credentials bounding box plan connection ftp sftp ftps file transfer server host upload download local storage folder drive isolated private read only webdav nextcloud owncloud dav url https"},{id:"profile",label:"Profile",icon:"image",kw:"avatar photo display name bio public"},{id:"security",label:"Privacy & Security",icon:"shield",kw:"two factor authentication 2fa sessions devices logout security privacy"}];return d.value&&b.push({id:"team",label:"User management",icon:"users",kw:"users team members add remove create delete role admin permissions rights organization"}),l.value&&b.push({id:"organizations",label:"Organizations",icon:"grid",kw:"organization org tenant company create rename delete members"}),b.push({id:"advanced",label:"Advanced",icon:"alertTriangle",kw:"export import data delete account danger zone",danger:!0}),b}),A=G("account"),U=G("");Iu("settingsSearch",U);const V=xt(()=>U.value.trim().length>0),rt=xt(()=>U.value.trim().toLowerCase());function Q(b){return rt.value?(b.label+" "+b.kw).toLowerCase().includes(rt.value)||Mt(b.id):!0}const Ot={account:["full name","username","email address verification verify","password change current new"],appearance:["theme light dark system","language","region","font size accessibility","reduce motion","date format","time format clock"],integrations:["opensky live flights","enable plugin","oauth client id secret","plan credits","bounding box","test connection","file transfer ftp sftp ftps","server host port username password","private key passphrase","base path directory","local storage folder drive","private isolated folder","read only access mode","webdav nextcloud owncloud dav","server url username password tls","base path directory folder"],profile:["profile photo avatar","display name","bio about","show email public"],security:["two factor authentication","active sessions devices","sign out"],team:["add user create account","members list role admin remove delete","organization org assign"],organizations:["add organization create","rename organization","delete organization members"],advanced:["export data download","import data upload","delete account permanent danger"]};function Mt(b){return rt.value?(Ot[b]||[]).some(f=>f.includes(rt.value)):!0}const q=xt(()=>V.value?w.value.filter(Q):w.value.filter(b=>b.id===A.value)),dt=xt({get:()=>qi.value,set:b=>lr(b)}),it=[{value:"light",label:"Light",icon:"sun"},{value:"dark",label:"Dark",icon:"moon"},{value:"system",label:"System",icon:"monitor"}],ht=[{value:"sm",label:"Small"},{value:"md",label:"Default"},{value:"lg",label:"Large"}],Kt=[{value:"12",label:"12-hour"},{value:"24",label:"24-hour"}],he=[["en","English"],["es","Español"],["de","Deutsch"],["fr","Français"],["pl","Polski"],["ja","日本語"]],pe=[["US","United States"],["GB","United Kingdom"],["EU","European Union"],["CA","Canada"],["AU","Australia"],["JP","Japan"]],St=[["MDY","MM/DD/YYYY"],["DMY","DD/MM/YYYY"],["YMD","YYYY/MM/DD"],["ISO","YYYY-MM-DD"]],Nt=G(Date.now());let Et=null;const nt=xt(()=>Yl(Nt.value)),ut=xe({loaded:!1,available:!1,orgEnabled:!0,allowAnonymous:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,scopes:{}}),zt=G("user"),Ft=xe({clientId:"",clientSecret:"",plan:"",bbox:""}),lt=G(""),At=G(!1),et=G(!1),ce=G(null),pt=G(null),kt=xt(()=>ce.value&&ce.value.credits||null),Yt=xt(()=>{const b=kt.value;return!b||!b.daily||b.remaining==null?null:Math.max(0,Math.min(100,Math.round(b.remaining/b.daily*100)))}),ae=xt(()=>{const b=Yt.value;return b==null?"bg-accent":b<=10?"bg-danger":b<=30?"bg-amber":"bg-success"});function Jt(b){return typeof b=="number"?b.toLocaleString():b}function Bt(){if(!pt.value)return"";const b=Math.max(0,Math.round((Date.now()-pt.value)/1e3));if(b<60)return"just now";const f=Math.round(b/60);if(f<60)return`${f} min ago`;const H=Math.round(f/60);return H<24?`${H} h ago`:`${Math.round(H/24)} d ago`}function j(){try{ce.value&&localStorage.setItem(tu,JSON.stringify({health:ce.value,ts:pt.value}))}catch{}}function C(){try{const b=localStorage.getItem(tu);if(!b)return;const f=JSON.parse(b);f&&f.health&&(ce.value=f.health,pt.value=f.ts||null)}catch{}}const E=[{value:"",label:"Not set"},{value:"anonymous",label:"Anonymous"},{value:"standard",label:"Standard"},{value:"contributor",label:"Contributor"}],_e=[{value:"user",label:"My settings",icon:"user"},{value:"org",label:"Organization",icon:"users"}],se=xt(()=>ut.isSuperadmin),Ge=xt(()=>ut.isSuperadmin?"user":zt.value),v=xt(()=>ut.scopes[Ge.value]||{editableLayer:"user",fields:{}}),m=xt(()=>Ge.value==="org");function M(b){return v.value.fields[b]||{effective:"",own:"",source:"unset",locked:!1}}function F(b){return se.value||M(b).locked}function R(b){const f=M(b).source;return f==="global"?"Set by administrator":f==="org"?"Set by your organization":""}function B(){Ft.clientId=M("clientId").own||"",Ft.clientSecret=M("clientSecret").own||"",Ft.plan=M("plan").own||"",Ft.bbox=M("bbox").own||""}function J(b){ut.available=!!b.available,ut.orgEnabled=b.orgEnabled!==!1,ut.allowAnonymous=!!b.allowAnonymous,ut.enabled=!!b.enabled,ut.canEditOrg=!!b.canEditOrg,ut.isSuperadmin=!!b.isSuperadmin,ut.scopes=b.scopes||{},zt.value==="org"&&!ut.canEditOrg&&(zt.value="user"),B(),ut.loaded=!0}Qe(zt,()=>{lt.value="",B()});async function D(){C();const{ok:b,body:f}=await qh();b&&J(f)}async function K(b){const f=m.value;f?ut.orgEnabled=b:ut.enabled=b;const{ok:H,body:k}=await Wl(f?{scope:"org",enabled:b}:{scope:"user",enabled:b});H?(J(k),jt(f?b?"OpenSky enabled for your organization.":"OpenSky disabled for your organization.":b?"OpenSky enabled.":"OpenSky disabled.")):(f?ut.orgEnabled=!b:ut.enabled=!b,jt(k.error||"Could not update."))}async function Z(){lt.value="",At.value=!0;const b={};for(const qt of["clientId","clientSecret","plan","bbox"])F(qt)||(b[qt]=Ft[qt]);const f={scope:Ge.value,config:b};m.value||(f.enabled=ut.enabled);const{ok:H,body:k}=await Wl(f);if(At.value=!1,!H){lt.value=k.error||"Could not save settings.";return}J(k),jt(m.value?"Organization OpenSky settings saved.":"OpenSky settings saved.")}async function yt(){et.value=!0,ce.value=null;const{ok:b,body:f}=await Yh();et.value=!1,ce.value=b&&f.health?f.health:{status:"down",detail:f.error||"Probe failed."},pt.value=Date.now(),j()}function st(b){return b==="ok"?T.success:b==="degraded"?T.warning:T.danger}const tt=xe({loaded:!1,available:!1,orgEnabled:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,scopes:{}}),bt=G("user"),Rt=["protocol","host","port","username","password","privateKey","keyPassphrase","hostKeyFingerprint","insecureSkipVerify","basePath"],gt=xe(Object.fromEntries(Rt.map(b=>[b,""]))),Ht=G(""),le=G(!1),me=G(!1),ve=G(null),Te=G(null),vn=[{value:"sftp",label:"SFTP"},{value:"ftps",label:"FTPS"},{value:"ftp",label:"FTP"}],ci=[{value:"false",label:"Verify certificate"},{value:"true",label:"Skip verification"}],ke=xt(()=>tt.isSuperadmin),Ie=xt(()=>tt.isSuperadmin?"user":bt.value),On=xt(()=>tt.scopes[Ie.value]||{editableLayer:"user",fields:{}}),Be=xt(()=>Ie.value==="org"),Ji=xt(()=>(Ve("protocol")?Ee("protocol").effective:gt.protocol)||"sftp");function Ee(b){return On.value.fields[b]||{effective:"",own:"",source:"unset",locked:!1}}function Ve(b){return ke.value||Ee(b).locked}function ye(b){const f=Ee(b).source;return f==="global"?"Set by administrator":f==="org"?"Set by your organization":""}function wr(b){return(vn.find(f=>f.value===b)||{}).label||b||"—"}function _o(){for(const b of Rt)gt[b]=Ee(b).own||"";gt.protocol||(gt.protocol="sftp"),gt.insecureSkipVerify||(gt.insecureSkipVerify="false")}function Cs(b){tt.available=!!b.available,tt.orgEnabled=b.orgEnabled!==!1,tt.enabled=!!b.enabled,tt.canEditOrg=!!b.canEditOrg,tt.isSuperadmin=!!b.isSuperadmin,tt.scopes=b.scopes||{},bt.value==="org"&&!tt.canEditOrg&&(bt.value="user"),_o(),tt.loaded=!0}Qe(bt,()=>{Ht.value="",_o()});function kr(){if(!Te.value)return"";const b=Math.max(0,Math.round((Date.now()-Te.value)/1e3));if(b<60)return"just now";const f=Math.round(b/60);if(f<60)return`${f} min ago`;const H=Math.round(f/60);return H<24?`${H} h ago`:`${Math.round(H/24)} d ago`}function Sr(){try{ve.value&&localStorage.setItem(eu,JSON.stringify({health:ve.value,ts:Te.value}))}catch{}}function Pr(){try{const b=localStorage.getItem(eu);if(!b)return;const f=JSON.parse(b);f&&f.health&&(ve.value=f.health,Te.value=f.ts||null)}catch{}}async function Ms(){Pr();const{ok:b,body:f}=await Jh();b&&Cs(f)}async function vo(b){const f=Be.value;f?tt.orgEnabled=b:tt.enabled=b;const{ok:H,body:k}=await Kl(f?{scope:"org",enabled:b}:{scope:"user",enabled:b});H?(Cs(k),jt(f?b?"File transfer enabled for your organization.":"File transfer disabled for your organization.":b?"File transfer enabled.":"File transfer disabled.")):(f?tt.orgEnabled=!b:tt.enabled=!b,jt(k.error||"Could not update."))}async function Tr(){Ht.value="",le.value=!0;const b={};for(const qt of Rt)Ve(qt)||(b[qt]=gt[qt]);const f={scope:Ie.value,config:b};Be.value||(f.enabled=tt.enabled);const{ok:H,body:k}=await Kl(f);if(le.value=!1,!H){Ht.value=k.error||"Could not save settings.";return}Cs(k),jt(Be.value?"Organization file-transfer settings saved.":"File-transfer settings saved.")}async function Lr(){me.value=!0,ve.value=null;const{ok:b,body:f}=await Xh();me.value=!1,ve.value=b&&f.health?f.health:{status:"down",detail:f.error||"Probe failed."},Te.value=Date.now(),Sr()}function Cr(b){return b==="ok"?T.success:b==="degraded"?T.warning:T.danger}const Vt=xe({loaded:!1,available:!1,orgEnabled:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,scopes:{}}),ft=G("user"),Xi=["baseURL","username","password","insecureSkipVerify","basePath"],ze=xe(Object.fromEntries(Xi.map(b=>[b,""]))),di=G(""),Ci=G(!1),fi=G(!1),rn=G(null),tn=G(null),yo=[{value:"false",label:"Verify certificate"},{value:"true",label:"Skip verification"}],Os=xt(()=>Vt.isSuperadmin),Es=xt(()=>Vt.isSuperadmin?"user":ft.value),Mr=xt(()=>Vt.scopes[Es.value]||{editableLayer:"user",fields:{}}),an=xt(()=>Es.value==="org");function yn(b){return Mr.value.fields[b]||{effective:"",own:"",source:"unset",locked:!1}}function hi(b){return Os.value||yn(b).locked}function Ze(b){const f=yn(b).source;return f==="global"?"Set by administrator":f==="org"?"Set by your organization":""}function bo(){for(const b of Xi)ze[b]=yn(b).own||"";ze.insecureSkipVerify||(ze.insecureSkipVerify="false")}function zs(b){Vt.available=!!b.available,Vt.orgEnabled=b.orgEnabled!==!1,Vt.enabled=!!b.enabled,Vt.canEditOrg=!!b.canEditOrg,Vt.isSuperadmin=!!b.isSuperadmin,Vt.scopes=b.scopes||{},ft.value==="org"&&!Vt.canEditOrg&&(ft.value="user"),bo(),Vt.loaded=!0}Qe(ft,()=>{di.value="",bo()});function Or(){if(!tn.value)return"";const b=Math.max(0,Math.round((Date.now()-tn.value)/1e3));if(b<60)return"just now";const f=Math.round(b/60);if(f<60)return`${f} min ago`;const H=Math.round(f/60);return H<24?`${H} h ago`:`${Math.round(H/24)} d ago`}function Er(){try{rn.value&&localStorage.setItem(nu,JSON.stringify({health:rn.value,ts:tn.value}))}catch{}}function zr(){try{const b=localStorage.getItem(nu);if(!b)return;const f=JSON.parse(b);f&&f.health&&(rn.value=f.health,tn.value=f.ts||null)}catch{}}async function As(){zr();const{ok:b,body:f}=await ep();b&&zs(f)}async function pi(b){const f=an.value;f?Vt.orgEnabled=b:Vt.enabled=b;const{ok:H,body:k}=await Gl(f?{scope:"org",enabled:b}:{scope:"user",enabled:b});H?(zs(k),jt(f?b?"WebDAV enabled for your organization.":"WebDAV disabled for your organization.":b?"WebDAV enabled.":"WebDAV disabled.")):(f?Vt.orgEnabled=!b:Vt.enabled=!b,jt(k.error||"Could not update."))}async function xo(){di.value="",Ci.value=!0;const b={};for(const qt of Xi)hi(qt)||(b[qt]=ze[qt]);const f={scope:Es.value,config:b};an.value||(f.enabled=Vt.enabled);const{ok:H,body:k}=await Gl(f);if(Ci.value=!1,!H){di.value=k.error||"Could not save settings.";return}zs(k),jt(an.value?"Organization WebDAV settings saved.":"WebDAV settings saved.")}async function wo(){fi.value=!0,rn.value=null;const{ok:b,body:f}=await np();fi.value=!1,rn.value=b&&f.health?f.health:{status:"down",detail:f.error||"Probe failed."},tn.value=Date.now(),Er()}function Mi(b){return b==="ok"?T.success:b==="degraded"?T.warning:T.danger}const X=xe({loaded:!1,available:!1,orgEnabled:!0,enabled:!1,canEditOrg:!1,isSuperadmin:!1,isOrgUser:!1,mounts:[],privateFolder:!1,privateEnabled:!1,allowPrivate:!0,rootConfigured:!1,scopes:{}}),Qt=G("user"),jn=G(""),ln=G(""),bn=G(!1),mi=G(!1),Pt=G(null),oe=G(null),Wn=G({}),Oi=[{value:"",label:"Inherit"},{value:"false",label:"Read-write"},{value:"true",label:"Read-only"}],$e=xt(()=>X.isSuperadmin),Is=xt(()=>X.isSuperadmin?"user":Qt.value),Qi=xt(()=>X.scopes[Is.value]||{editableLayer:"user",fields:{}}),Se=xt(()=>Is.value==="org");function ge(b){return Qi.value.fields[b]||{effective:"",own:"",source:"unset",locked:!1}}function En(b){return $e.value||ge(b).locked}function gi(b){const f=ge(b).source;return f==="global"?"Set by administrator":f==="org"?"Set by your organization":""}function Ei(b){return(Oi.find(f=>f.value===b)||{}).label||"Inherit"}function ts(){jn.value=ge("readOnly").own||""}function xn(b){X.available=!!b.available,X.orgEnabled=b.orgEnabled!==!1,X.enabled=!!b.enabled,X.canEditOrg=!!b.canEditOrg,X.isSuperadmin=!!b.isSuperadmin,X.isOrgUser=!!b.isOrgUser,X.mounts=Array.isArray(b.mounts)?b.mounts:[],X.privateFolder=!!b.privateFolder,X.privateEnabled=!!b.privateEnabled,X.allowPrivate=b.allowPrivate!==!1,X.rootConfigured=!!b.rootConfigured,X.scopes=b.scopes||{},Qt.value==="org"&&!X.canEditOrg&&(Qt.value="user"),ts(),X.loaded=!0}Qe(Qt,()=>{ln.value="",ts()});function $s(){if(!oe.value)return"";const b=Math.max(0,Math.round((Date.now()-oe.value)/1e3));if(b<60)return"just now";const f=Math.round(b/60);if(f<60)return`${f} min ago`;const H=Math.round(f/60);return H<24?`${H} h ago`:`${Math.round(H/24)} d ago`}function Ds(){try{Pt.value&&localStorage.setItem(iu,JSON.stringify({health:Pt.value,ts:oe.value}))}catch{}}function es(){try{const b=localStorage.getItem(iu);if(!b)return;const f=JSON.parse(b);f&&f.health&&(Pt.value=f.health,oe.value=f.ts||null)}catch{}}async function Ns(){es();const{ok:b,body:f}=await Qh();b&&xn(f)}async function ns(b){const f=Se.value;f?X.orgEnabled=b:X.enabled=b;const{ok:H,body:k}=await Ko(f?{scope:"org",enabled:b}:{scope:"user",enabled:b});H?(xn(k),jt(f?b?"Local storage enabled for your organization.":"Local storage disabled for your organization.":b?"Local storage enabled.":"Local storage disabled.")):(f?X.orgEnabled=!b:X.enabled=!b,jt(k.error||"Could not update."))}async function is(b){X.privateFolder=b;const{ok:f,body:H}=await Ko({scope:"user",privateFolder:b});f?(xn(H),jt(b?"Private folder enabled.":"Private folder disabled.")):(X.privateFolder=!b,jt(H.error||"Could not update."))}async function ko(b){X.allowPrivate=b;const{ok:f,body:H}=await Ko({scope:"org",allowPrivate:b});f?(xn(H),jt(b?"Members may now create private folders.":"Private folders disabled for your organization.")):(X.allowPrivate=!b,jt(H.error||"Could not update."))}async function Rs(){ln.value="",bn.value=!0;const b={};En("readOnly")||(b.readOnly=jn.value);const f={scope:Is.value,config:b};Se.value||(f.enabled=X.enabled);const{ok:H,body:k}=await Ko(f);if(bn.value=!1,!H){ln.value=k.error||"Could not save settings.";return}xn(k),jt(Se.value?"Organization local-storage settings saved.":"Local-storage settings saved.")}async function Ar(){mi.value=!0,Pt.value=null,Wn.value={};const{ok:b,body:f}=await tp();mi.value=!1,Pt.value=b&&f.health?f.health:{status:"down",detail:f.error||"Probe failed."};const H={};if(Array.isArray(f.mounts))for(const k of f.mounts)H[k.id]={status:k.status,detail:k.detail};Wn.value=H,oe.value=Date.now(),Ds()}function It(b){return b==="ok"?T.success:b==="degraded"?T.warning:T.danger}const un=[{id:"apis-external",label:"APIs — External",icon:"globe"},{id:"drives-external",label:"Drives — External",icon:"server"},{id:"drives-local",label:"Drives — Local",icon:"monitor"}],te=G("apis-external");function ss(b){return V.value||te.value===b}const _i=G("");let zi=null;function jt(b){_i.value=b,clearTimeout(zi),zi=setTimeout(()=>_i.value="",2200)}const we=xe({current:"",next:"",confirm:""}),zn=G(""),vi=G(!1);function Le(){if(vi.value=!1,!we.current)return zn.value="Enter your current password.";if(we.next.length<8)return zn.value="New password must be at least 8 characters.";if(we.next!==we.confirm)return zn.value="New passwords do not match.";zn.value="Validated. Connecting to the account service is pending — no password endpoint yet.",we.current=we.next=we.confirm=""}const wn=G("");function So(){wn.value="Verification link would be sent once the account service is wired up."}function Po(b){const f=b.target.files&&b.target.files[0];if(!f)return;if(f.size>1.5*1024*1024){jt("Image too large (max ~1.5 MB).");return}const H=new FileReader;H.onload=()=>{Tt.avatar=String(H.result),jt("Photo updated.")},H.readAsDataURL(f)}function Ir(){Tt.avatar="",jt("Photo removed.")}const To=xt(()=>{var H,k,qt;const f=(Tt.displayName||Tt.name||o.email||"PV").split("@")[0].split(/[.\-_ ]+/).filter(Boolean);return((((H=f[0])==null?void 0:H[0])||"P")+(((k=f[1])==null?void 0:k[0])||((qt=f[0])==null?void 0:qt[1])||"V")).toUpperCase()}),Kn=G(!1),Lo=G(""),Ai=G(""),Zt=G(""),os=G([]);function Ue(b){const f="ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";let H="";for(let k=0;kUe(4).toLowerCase()+"-"+Ue(4).toLowerCase()),Zt.value=""}function $r(){Tt.twoFactor=!1,os.value=[],Kn.value=!1}const qe=navigator.userAgent;function Dr(){return/Edg\//.test(qe)?"Edge":/OPR\//.test(qe)?"Opera":/Chrome\//.test(qe)?"Chrome":/Firefox\//.test(qe)?"Firefox":/Safari\//.test(qe)?"Safari":"Browser"}function Mo(){return/Windows/.test(qe)?"Windows":/Mac OS X/.test(qe)?"macOS":/Android/.test(qe)?"Android":/iPhone|iPad/.test(qe)?"iOS":/Linux/.test(qe)?"Linux":"Unknown OS"}const Nr=Date.now(),rs=G([]),Gn=G(!1),as=G(""),re=xe({email:"",password:"",role:"user",organization:""}),yi=G(""),$i=G(!1),Ye=G(""),Fs=xt(()=>{const b=[{value:"user",label:"User"},{value:"admin",label:"Admin"}];return l.value&&b.push({value:"superadmin",label:"Superadmin"}),b}),Di=G([]);async function qn(){if(!d.value)return;const b=await Uh();b.ok&&(Di.value=b.organizations.slice().sort((f,H)=>f.name.localeCompare(H.name)))}const Oo=xt(()=>{const b=Di.value.map(f=>({value:f.id,label:f.name}));return l.value&&b.unshift({value:"",label:"No organization"}),b});async function Yn(){if(!d.value)return;Gn.value=!0,as.value="";const b=await Fh();if(Gn.value=!1,!b.ok){as.value=b.status===403?"Manager role required.":"Could not load users.";return}rs.value=b.users.slice().sort((f,H)=>f.email.localeCompare(H.email))}function Ni(b){try{const f=b.data||{},H=Object.keys(f)[0];return H&&f[H]&&f[H].message||b.message||b.error||"Invalid input."}catch{return b.error||"Could not create user."}}async function Rr(){yi.value="";const b=re.email.trim().toLowerCase();if(!b.includes("@"))return yi.value="Enter a valid email.";if(re.password.length<8)return yi.value="Password must be at least 8 characters.";$i.value=!0;const f=l.value?re.organization:o.organization,{ok:H,body:k}=await Bh(b,re.password,re.role,f);if($i.value=!1,!H)return yi.value=Ni(k);re.email="",re.password="",re.role="user",re.organization="",jt("User created."),Yn()}async function Fr(b){const{ok:f,body:H}=await Zh(b.id);if(Ye.value="",!f)return jt(H.error||"Could not remove user.");jt("User removed."),Yn()}const Gt=xe({id:"",email:"",role:"user",verified:!1,password:"",organization:""}),An=G(""),Ri=G(!1),ls=xt(()=>!!Gt.id&&Gt.email===o.email);function us(b){Ye.value="",Gt.id=b.id,Gt.email=b.email,Gt.role=b.role||"user",Gt.verified=!!b.verified,Gt.password="",Gt.organization=b.organization||"",An.value=""}function In(){Gt.id="",An.value=""}async function Br(){An.value="";const b=Gt.email.trim().toLowerCase();if(!b.includes("@"))return An.value="Enter a valid email.";if(Gt.password&&Gt.password.length<8)return An.value="New password must be at least 8 characters (or leave blank).";const f={email:b,role:Gt.role,verified:Gt.verified};l.value&&(f.organization=Gt.organization),Gt.password&&(f.password=Gt.password),Ri.value=!0;const{ok:H,body:k}=await Vh(Gt.id,f);if(Ri.value=!1,!H)return An.value=Ni(k);jt("User updated."),In(),Yn()}const $n=xe({name:""}),Ce=G(""),Fi=G(!1),bi=G(""),kn=xe({id:"",name:""}),Sn=G(""),Bi=xt(()=>{const b={};for(const f of rs.value)f.organization&&(b[f.organization]=(b[f.organization]||0)+1);return b});async function Eo(){Ce.value="";const b=$n.name.trim();if(!b)return Ce.value="Enter an organization name.";Fi.value=!0;const{ok:f,body:H}=await Hh(b);if(Fi.value=!1,!f)return Ce.value=Ni(H);$n.name="",jt("Organization created."),qn()}function Vr(b){bi.value="",kn.id=b.id,kn.name=b.name,Sn.value=""}function Bs(){kn.id="",Sn.value=""}async function zo(){Sn.value="";const b=kn.name.trim();if(!b)return Sn.value="Enter an organization name.";const{ok:f,body:H}=await jh(kn.id,b);if(!f)return Sn.value=Ni(H);jt("Organization renamed."),Bs(),qn(),Yn()}async function en(b){const{ok:f,body:H}=await Wh(b.id);if(bi.value="",!f)return jt(H.error||"Could not delete organization.");jt("Organization deleted."),qn()}function xi(){const b={_app:"PilotVault",_kind:"settings-export",exportedAt:new Date().toISOString(),email:o.email,prefs:{...Tt},themeMode:qi.value},f=new Blob([JSON.stringify(b,null,2)],{type:"application/json"}),H=URL.createObjectURL(f),k=document.createElement("a");k.href=H,k.download=`pilotvault-settings-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(k),k.click(),k.remove(),URL.revokeObjectURL(H),jt("Settings exported.")}const cs=G("");function Pn(b){const f=b.target.files&&b.target.files[0];if(!f)return;const H=new FileReader;H.onload=()=>{try{const k=JSON.parse(String(H.result)),qt=k.prefs||k;if(!Tc(qt))throw new Error("bad shape");k.themeMode&&lr(k.themeMode),Aa(Tt.fontSize),Ia(Tt.reduceMotion),cs.value="Settings imported and applied."}catch{cs.value="That file is not a valid PilotVault settings export."}},H.readAsText(f),b.target.value=""}const de=xe({understand:!1,typed:"",cooldown:0,armed:!1,msg:""});let cn=null;const Vs=xt(()=>o.email||"DELETE MY ACCOUNT"),Jn=xt(()=>de.understand&&de.typed===Vs.value);function Ao(){Jn.value&&(de.armed=!0,de.cooldown=5,clearInterval(cn),cn=setInterval(()=>{de.cooldown--,de.cooldown<=0&&clearInterval(cn)},1e3))}Qe(Jn,b=>{!b&&de.armed&&(de.armed=!1,de.cooldown=0,clearInterval(cn))});function ds(){if(!(!de.armed||de.cooldown>0)){try{localStorage.removeItem("pv_prefs")}catch{}de.msg="Account deletion requires the account service. Local data was cleared and you were signed out.",setTimeout(()=>a("logout"),900)}}return Yi(()=>{Et=setInterval(()=>Nt.value=Date.now(),1e3),qn(),Yn(),D(),Ms(),As(),Ns()}),vr(()=>{clearInterval(Et),clearInterval(cn),clearTimeout(zi)}),(b,f)=>(g(),x("div",Kp,[u("div",Gp,[f[62]||(f[62]=u("div",null,[u("div",{class:"eyebrow"},"Preferences"),u("h2",{class:"mt-0.5 text-[22px] font-bold tracking-tightest text-ink"},"Settings")],-1)),u("div",qp,[O(Y,{name:"search",size:16,class:"text-ink-muted"}),ot(u("input",{"onUpdate:modelValue":f[0]||(f[0]=H=>U.value=H),placeholder:"Search settings…",class:"w-full border-none bg-transparent text-sm text-ink outline-none placeholder:text-ink-muted"},null,512),[[vt,U.value]]),U.value?(g(),x("button",{key:0,class:"text-ink-muted hover:text-ink","aria-label":"Clear search",onClick:f[1]||(f[1]=H=>U.value="")},[O(Y,{name:"x",size:15})])):N("",!0)])]),u("div",Yp,[ot(u("nav",Jp,[(g(!0),x(ct,null,Wt(w.value,H=>(g(),x("button",{key:H.id,class:Ct(["flex items-center gap-2.5 rounded px-3 py-2.5 text-left text-sm transition",[A.value===H.id?H.danger?"bg-danger-soft font-semibold text-danger-fg":"bg-accent-soft font-semibold text-accent-soft-fg":H.danger?"font-medium text-danger-fg hover:bg-danger-soft":"font-medium text-ink-secondary hover:bg-surface-2"]]),onClick:k=>A.value=H.id},[O(Y,{name:H.icon,size:17},null,8,["name"]),u("span",Qp,P(H.label),1)],10,Xp))),128))],512),[[oh,!V.value]]),u("div",tm,[V.value&&!q.value.length?(g(),x("div",em," No settings match “"+P(U.value)+"”. ",1)):N("",!0),(g(!0),x(ct,null,Wt(q.value,H=>(g(),x(ct,{key:H.id},[V.value?(g(),x("div",nm,[O(Y,{name:H.icon,size:14},null,8,["name"]),$(" "+P(H.label),1)])):N("",!0),H.id==="account"?(g(),x("div",im,[O(_t,{title:"Full name",desc:"Shown to your team on flights and audit logs.",keywords:"full name account"},{default:mt(()=>[ot(u("input",{"onUpdate:modelValue":f[2]||(f[2]=k=>$t(Tt).name=k),class:"field w-56",placeholder:"Jane Operator",onBlur:f[3]||(f[3]=k=>jt("Saved."))},null,544),[[vt,$t(Tt).name]])]),_:1}),O(_t,{title:"Username",desc:"Your unique handle within PilotVault.",keywords:"username handle"},{default:mt(()=>[u("div",sm,[f[63]||(f[63]=u("span",{class:"text-sm text-ink-muted"},"@",-1)),ot(u("input",{"onUpdate:modelValue":f[4]||(f[4]=k=>$t(Tt).username=k),class:"field w-48",placeholder:"jane",onBlur:f[5]||(f[5]=k=>jt("Saved."))},null,544),[[vt,$t(Tt).username]])])]),_:1}),O(_t,{title:"Email address",desc:"Used for sign-in and notifications.",keywords:"email verification verify"},{default:mt(()=>[u("div",om,[u("span",rm,P(e.email||"—"),1),u("span",am,[O(Y,{name:"mail",size:12}),f[64]||(f[64]=$(" Unverified ",-1))])])]),_:1}),O(_t,{title:"Role",desc:"Your access level in PilotVault.",keywords:"role admin user superadmin access rights permissions"},{default:mt(()=>[u("span",{class:Ct(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",y(e.role)])},[O(Y,{name:_(e.role),size:12},null,8,["name"]),$(P(h(e.role)),1)],2)]),_:1}),O(_t,{title:"Organization",desc:"The organization your account belongs to.",keywords:"organization org tenant company"},{default:mt(()=>[u("span",{class:Ct(["text-sm",e.organizationName?"text-ink":"text-ink-muted"])},P(e.organizationName||(l.value?"All organizations":"None")),3)]),_:1}),O(_t,{block:"",title:"Verify email",desc:"Confirm ownership to enable password resets and alerts.",keywords:"verify email resend"},{default:mt(()=>[u("button",{class:"btn-ghost",onClick:So},"Send verification link"),wn.value?(g(),x("p",lm,P(wn.value),1)):N("",!0)]),_:1}),O(_t,{block:"",title:"Change password",desc:"Use at least 8 characters.",keywords:"password change current new"},{default:mt(()=>[u("div",um,[ot(u("input",{"onUpdate:modelValue":f[6]||(f[6]=k=>we.current=k),type:"password",class:"field",placeholder:"Current password"},null,512),[[vt,we.current]]),ot(u("input",{"onUpdate:modelValue":f[7]||(f[7]=k=>we.next=k),type:"password",class:"field",placeholder:"New password"},null,512),[[vt,we.next]]),ot(u("input",{"onUpdate:modelValue":f[8]||(f[8]=k=>we.confirm=k),type:"password",class:"field",placeholder:"Confirm new password"},null,512),[[vt,we.confirm]]),u("div",cm,[u("button",{class:"btn-accent",onClick:Le},"Update password"),zn.value?(g(),x("span",{key:0,class:Ct(["text-xs",vi.value?"text-success-fg":"text-ink-muted"])},P(zn.value),3)):N("",!0)])])]),_:1})])):H.id==="appearance"?(g(),x("div",dm,[O(_t,{title:"Theme",desc:"Light, dark, or follow your system.",keywords:"theme light dark system appearance"},{default:mt(()=>[O(hn,{modelValue:dt.value,"onUpdate:modelValue":f[9]||(f[9]=k=>dt.value=k),options:it},null,8,["modelValue"])]),_:1}),O(_t,{title:"Font size",desc:"Scales the entire interface for readability.",keywords:"font size accessibility text"},{default:mt(()=>[O(hn,{modelValue:$t(Tt).fontSize,"onUpdate:modelValue":f[10]||(f[10]=k=>$t(Tt).fontSize=k),options:ht},null,8,["modelValue"])]),_:1}),O(_t,{title:"Reduce motion",desc:"Minimise animations and transitions.",keywords:"reduce motion accessibility animation"},{default:mt(()=>[O(nn,{modelValue:$t(Tt).reduceMotion,"onUpdate:modelValue":f[11]||(f[11]=k=>$t(Tt).reduceMotion=k)},null,8,["modelValue"])]),_:1}),O(_t,{title:"Language",desc:"Interface language.",keywords:"language locale"},{default:mt(()=>[ot(u("select",{"onUpdate:modelValue":f[12]||(f[12]=k=>$t(Tt).language=k),class:"field w-48"},[(g(),x(ct,null,Wt(he,([k,qt])=>u("option",{key:k,value:k},P(qt),9,fm)),64))],512),[[sn,$t(Tt).language]])]),_:1}),O(_t,{title:"Region",desc:"Affects number, unit and date defaults.",keywords:"region country locale"},{default:mt(()=>[ot(u("select",{"onUpdate:modelValue":f[13]||(f[13]=k=>$t(Tt).region=k),class:"field w-48"},[(g(),x(ct,null,Wt(pe,([k,qt])=>u("option",{key:k,value:k},P(qt),9,hm)),64))],512),[[sn,$t(Tt).region]])]),_:1}),O(_t,{title:"Date format",desc:"How calendar dates are displayed.",keywords:"date format"},{default:mt(()=>[ot(u("select",{"onUpdate:modelValue":f[14]||(f[14]=k=>$t(Tt).dateFormat=k),class:"field w-48"},[(g(),x(ct,null,Wt(St,([k,qt])=>u("option",{key:k,value:k},P(qt),9,pm)),64))],512),[[sn,$t(Tt).dateFormat]])]),_:1}),O(_t,{title:"Time format",desc:"12- or 24-hour clock.",keywords:"time format clock 12 24 hour"},{default:mt(()=>[O(hn,{modelValue:$t(Tt).timeFormat,"onUpdate:modelValue":f[15]||(f[15]=k=>$t(Tt).timeFormat=k),options:Kt},null,8,["modelValue"])]),_:1}),O(_t,{title:"Preview",desc:"How timestamps appear across the app.",keywords:"preview date time"},{default:mt(()=>[u("span",mm,P(nt.value),1)]),_:1}),f[65]||(f[65]=u("p",{class:"mt-3 text-xs text-ink-muted"}," Language & region are stored now; full localisation ships with the account service. ",-1))])):H.id==="integrations"?(g(),x("div",gm,[V.value?N("",!0):(g(),x("div",_m,[(g(),x(ct,null,Wt(un,k=>u("button",{key:k.id,type:"button",class:Ct(["-mb-px inline-flex items-center gap-1.5 whitespace-nowrap border-b-2 px-3 py-2 text-sm font-semibold transition",te.value===k.id?"border-accent text-ink":"border-transparent text-ink-secondary hover:text-ink"]),onClick:qt=>te.value=k.id},[O(Y,{name:k.icon,size:16},null,8,["name"]),$(P(k.label),1)],10,vm)),64))])),ss("apis-external")?(g(),x("div",ym,[u("div",bm,[u("div",xm,[O(Y,{name:"radio",size:20})]),f[66]||(f[66]=u("div",{class:"min-w-0"},[u("div",{class:"text-sm font-semibold text-ink"},"OpenSky Network"),u("div",{class:"mt-0.5 text-xs text-ink-muted"}," Live ADS-B aircraft data. Configure your own OAuth2 credentials, plan and default bounding box. ")],-1))]),ut.loaded&&!ut.available?(g(),x("div",wm,[O(Y,{name:"lock",size:14,class:"mr-1 inline"}),f[67]||(f[67]=$(" OpenSky is currently disabled by your administrator. Contact them to enable it. ",-1))])):N("",!0),ut.canEditOrg?(g(),x("div",km,[f[68]||(f[68]=u("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),O(hn,{modelValue:zt.value,"onUpdate:modelValue":f[16]||(f[16]=k=>zt.value=k),options:_e},null,8,["modelValue"])])):N("",!0),m.value?(g(),ie(_t,{key:2,title:"Enable OpenSky (organization-wide)",desc:"Turn OpenSky on or off for everyone in your organization.",keywords:"enable disable plugin opensky organization"},{default:mt(()=>[O(nn,{"model-value":ut.orgEnabled,disabled:!ut.available,"onUpdate:modelValue":K},null,8,["model-value","disabled"])]),_:1})):(g(),ie(_t,{key:3,title:"Enable OpenSky",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin opensky"},{default:mt(()=>[O(nn,{"model-value":ut.enabled,disabled:!ut.available||!ut.orgEnabled,"onUpdate:modelValue":K},null,8,["model-value","disabled"])]),_:1})),!m.value&&ut.available&&!ut.orgEnabled?(g(),x("div",Sm,[O(Y,{name:"lock",size:13,class:"mr-1 inline"}),f[70]||(f[70]=$("OpenSky is turned off for your organization",-1)),ut.canEditOrg?(g(),x("span",Pm,[...f[69]||(f[69]=[$(" — switch to ",-1),u("span",{class:"font-semibold"},"Organization",-1),$(" to turn it back on",-1)])])):N("",!0),f[71]||(f[71]=$(". ",-1))])):N("",!0),m.value?(g(),x("div",Tm,[O(Y,{name:"users",size:13,class:"mr-1 inline"}),f[72]||(f[72]=$("These are organization-wide settings — they apply to everyone in ",-1)),u("span",Lm,P(e.organizationName||"your organization"),1),f[73]||(f[73]=$(". Leave a field blank to let each user choose their own; a value set here overrides the user's. ",-1))])):se.value?(g(),x("div",Cm," As a superadmin you manage the global OpenSky configuration in the API Server panel. The effective configuration is shown below. ")):N("",!0),ut.available&&!m.value?(g(),x("div",Mm,[u("div",Om,[u("div",Em,[O(Y,{name:"signal",size:15}),f[74]||(f[74]=$("Credit usage ",-1))]),pt.value?(g(),x("span",zm,"Checked "+P(Bt()),1)):N("",!0)]),kt.value?(g(),x(ct,{key:0},[kt.value.remaining!=null?(g(),x(ct,{key:0},[u("div",Am,[u("span",Im,P(Jt(kt.value.remaining)),1),u("span",$m,"/ "+P(Jt(kt.value.daily))+" credits left today",1)]),u("div",Dm,[u("div",{class:Ct(["h-full rounded-full transition-all",ae.value]),style:Ss({width:Yt.value+"%"})},null,6)]),u("div",Nm," Used "+P(Jt(kt.value.daily-kt.value.remaining))+" today · "+P(kt.value.probeCost)+" credit"+P(kt.value.probeCost===1?"":"s")+" per query · "+P(kt.value.mode),1)],64)):(g(),x(ct,{key:1},[u("div",Rm,[f[75]||(f[75]=$("Daily allowance: ",-1)),u("span",Fm,P(Jt(kt.value.daily)),1),f[76]||(f[76]=$(" credits",-1))]),u("div",Bm,P(kt.value.probeCost)+" credit"+P(kt.value.probeCost===1?"":"s")+" per query · "+P(kt.value.mode)+". OpenSky only reports live remaining credits for authenticated requests — add OAuth2 credentials below to track usage. ",1)],64))],64)):(g(),x("div",Vm,[...f[77]||(f[77]=[$(" Run ",-1),u("span",{class:"font-semibold text-ink-secondary"},"Test connection",-1),$(" below to fetch your live OpenSky credit balance. ",-1)])]))])):N("",!0),O(_t,{title:"OpenSky plan",desc:"Your account tier — sets the daily credit allowance.",keywords:"plan tier credits"},{default:mt(()=>[F("plan")?(g(),x("span",Zm,[$(P((E.find(k=>k.value===M("plan").effective)||{}).label||M("plan").effective||"—")+" ",1),R("plan")?(g(),x("span",Um,[O(Y,{name:"lock",size:10}),$(P(R("plan")),1)])):N("",!0)])):(g(),ie(hn,{key:1,modelValue:Ft.plan,"onUpdate:modelValue":f[17]||(f[17]=k=>Ft.plan=k),options:E},null,8,["modelValue"]))]),_:1}),O(_t,{title:"Default bounding box",desc:"lamin,lomin,lamax,lomax — used for live queries and the health probe.",keywords:"bounding box bbox area"},{default:mt(()=>[F("bbox")?(g(),x("span",Hm,[$(P(M("bbox").effective||"—")+" ",1),R("bbox")?(g(),x("span",jm,[O(Y,{name:"lock",size:10}),$(P(R("bbox")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[18]||(f[18]=k=>Ft.bbox=k),class:"field w-64 font-mono",placeholder:"50.5,3.2,53.7,7.3"},null,512)),[[vt,Ft.bbox]])]),_:1}),O(_t,{title:"OAuth2 client ID",desc:"Optional — leave blank for anonymous access (lower limits).",keywords:"oauth client id credentials"},{default:mt(()=>[F("clientId")?(g(),x("span",Wm,[$(P(M("clientId").effective||"—")+" ",1),R("clientId")?(g(),x("span",Km,[O(Y,{name:"lock",size:10}),$(P(R("clientId")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[19]||(f[19]=k=>Ft.clientId=k),class:"field w-64",placeholder:"your-api-client"},null,512)),[[vt,Ft.clientId]])]),_:1}),O(_t,{title:"OAuth2 client secret",desc:"Paired with the client ID for authenticated access.",keywords:"oauth client secret credentials password"},{default:mt(()=>[F("clientSecret")?(g(),x("span",Gm,[$(P(M("clientSecret").effective||"—")+" ",1),R("clientSecret")?(g(),x("span",qm,[O(Y,{name:"lock",size:10}),$(P(R("clientSecret")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[20]||(f[20]=k=>Ft.clientSecret=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[vt,Ft.clientSecret]])]),_:1}),ut.available&&!ut.allowAnonymous?(g(),x("div",Ym," Anonymous access is disabled by the administrator — OpenSky needs OAuth2 credentials from some layer to work. ")):N("",!0),u("div",Jm,[se.value?N("",!0):(g(),x("button",{key:0,class:"btn-accent",disabled:At.value||!ut.available,onClick:Z},P(At.value?"Saving…":m.value?"Save organization settings":"Save settings"),9,Xm)),m.value?N("",!0):(g(),x("button",{key:1,class:"btn-ghost",disabled:et.value||!ut.available,onClick:yt},P(et.value?"Testing…":"Test connection"),9,Qm)),lt.value?(g(),x("span",tg,P(lt.value),1)):N("",!0),ce.value&&!m.value?(g(),x("span",{key:3,class:Ct(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",st(ce.value.status)])},[f[78]||(f[78]=u("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),$(P(ce.value.detail||ce.value.status),1)],2)):N("",!0)])])):N("",!0),ss("drives-external")?(g(),x(ct,{key:2},[u("div",eg,[u("div",ng,[u("div",ig,[O(Y,{name:"server",size:20})]),f[79]||(f[79]=u("div",{class:"min-w-0"},[u("div",{class:"text-sm font-semibold text-ink"},"File Transfer (FTP / SFTP)"),u("div",{class:"mt-0.5 text-xs text-ink-muted"}," Connect to an FTP, FTPS or SFTP server. Configure the connection your account uses for file transfers. ")],-1))]),tt.loaded&&!tt.available?(g(),x("div",sg,[O(Y,{name:"lock",size:14,class:"mr-1 inline"}),f[80]||(f[80]=$(" File transfer is currently disabled by your administrator. Contact them to enable it. ",-1))])):N("",!0),tt.canEditOrg?(g(),x("div",og,[f[81]||(f[81]=u("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),O(hn,{modelValue:bt.value,"onUpdate:modelValue":f[21]||(f[21]=k=>bt.value=k),options:_e},null,8,["modelValue"])])):N("",!0),Be.value?(g(),ie(_t,{key:2,title:"Enable file transfer (organization-wide)",desc:"Turn it on or off for everyone in your organization.",keywords:"enable disable plugin ftp sftp organization"},{default:mt(()=>[O(nn,{"model-value":tt.orgEnabled,disabled:!tt.available,"onUpdate:modelValue":vo},null,8,["model-value","disabled"])]),_:1})):(g(),ie(_t,{key:3,title:"Enable file transfer",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin ftp sftp"},{default:mt(()=>[O(nn,{"model-value":tt.enabled,disabled:!tt.available||!tt.orgEnabled,"onUpdate:modelValue":vo},null,8,["model-value","disabled"])]),_:1})),!Be.value&&tt.available&&!tt.orgEnabled?(g(),x("div",rg,[O(Y,{name:"lock",size:13,class:"mr-1 inline"}),f[83]||(f[83]=$("File transfer is turned off for your organization",-1)),tt.canEditOrg?(g(),x("span",ag,[...f[82]||(f[82]=[$(" — switch to ",-1),u("span",{class:"font-semibold"},"Organization",-1),$(" to turn it back on",-1)])])):N("",!0),f[84]||(f[84]=$(". ",-1))])):N("",!0),Be.value?(g(),x("div",lg,[O(Y,{name:"users",size:13,class:"mr-1 inline"}),f[85]||(f[85]=$("These are organization-wide settings — they apply to everyone in ",-1)),u("span",ug,P(e.organizationName||"your organization"),1),f[86]||(f[86]=$(". Leave the connection blank to let each user configure their own; a connection set here overrides the user's. ",-1))])):ke.value?(g(),x("div",cg," As a superadmin you manage the global file-transfer configuration in the API Server panel. The effective configuration is shown below. ")):N("",!0),O(_t,{title:"Protocol",desc:"SFTP (over SSH), FTPS (FTP over TLS), or plain FTP.",keywords:"protocol sftp ftps ftp"},{default:mt(()=>[Ve("protocol")?(g(),x("span",dg,[$(P(wr(Ee("protocol").effective))+" ",1),ye("protocol")?(g(),x("span",fg,[O(Y,{name:"lock",size:10}),$(P(ye("protocol")),1)])):N("",!0)])):(g(),ie(hn,{key:1,modelValue:gt.protocol,"onUpdate:modelValue":f[22]||(f[22]=k=>gt.protocol=k),options:vn},null,8,["modelValue"]))]),_:1}),O(_t,{title:"Host",desc:"Server hostname or IP address.",keywords:"host server address"},{default:mt(()=>[Ve("host")?(g(),x("span",hg,[$(P(Ee("host").effective||"—")+" ",1),ye("host")?(g(),x("span",pg,[O(Y,{name:"lock",size:10}),$(P(ye("host")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[23]||(f[23]=k=>gt.host=k),class:"field w-64",placeholder:"files.example.com"},null,512)),[[vt,gt.host]])]),_:1}),O(_t,{title:"Port",desc:"Leave blank for the protocol default (22 for SFTP, 21 for FTP/FTPS).",keywords:"port"},{default:mt(()=>[Ve("port")?(g(),x("span",mg,[$(P(Ee("port").effective||"default")+" ",1),ye("port")?(g(),x("span",gg,[O(Y,{name:"lock",size:10}),$(P(ye("port")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[24]||(f[24]=k=>gt.port=k),inputmode:"numeric",class:"field w-24 font-mono",placeholder:"22"},null,512)),[[vt,gt.port]])]),_:1}),O(_t,{title:"Username",desc:"Account used to authenticate.",keywords:"username login account"},{default:mt(()=>[Ve("username")?(g(),x("span",_g,[$(P(Ee("username").effective||"—")+" ",1),ye("username")?(g(),x("span",vg,[O(Y,{name:"lock",size:10}),$(P(ye("username")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[25]||(f[25]=k=>gt.username=k),class:"field w-64",placeholder:"user"},null,512)),[[vt,gt.username]])]),_:1}),O(_t,{title:"Password",desc:"Password auth for FTP/FTPS, or SFTP password login. Leave blank to use a key.",keywords:"password secret credentials"},{default:mt(()=>[Ve("password")?(g(),x("span",yg,[$(P(Ee("password").effective||"—")+" ",1),ye("password")?(g(),x("span",bg,[O(Y,{name:"lock",size:10}),$(P(ye("password")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[26]||(f[26]=k=>gt.password=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[vt,gt.password]])]),_:1}),Ji.value==="sftp"?(g(),ie(_t,{key:7,block:"",title:"SSH private key",desc:"PEM key for SFTP key auth — used instead of, or alongside, a password.",keywords:"private key ssh pem identity"},{default:mt(()=>[Ve("privateKey")?(g(),x("span",xg,[$(P(Ee("privateKey").effective||"—")+" ",1),ye("privateKey")?(g(),x("span",wg,[O(Y,{name:"lock",size:10}),$(P(ye("privateKey")),1)])):N("",!0)])):ot((g(),x("textarea",{key:1,"onUpdate:modelValue":f[27]||(f[27]=k=>gt.privateKey=k),rows:"3",class:"field w-full font-mono text-xs",placeholder:"-----BEGIN OPENSSH PRIVATE KEY-----"},null,512)),[[vt,gt.privateKey]])]),_:1})):N("",!0),Ji.value==="sftp"?(g(),ie(_t,{key:8,title:"Private key passphrase",desc:"Passphrase protecting the SSH private key, if any.",keywords:"passphrase key secret"},{default:mt(()=>[Ve("keyPassphrase")?(g(),x("span",kg,[$(P(Ee("keyPassphrase").effective||"—")+" ",1),ye("keyPassphrase")?(g(),x("span",Sg,[O(Y,{name:"lock",size:10}),$(P(ye("keyPassphrase")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[28]||(f[28]=k=>gt.keyPassphrase=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[vt,gt.keyPassphrase]])]),_:1})):N("",!0),Ji.value==="sftp"?(g(),ie(_t,{key:9,title:"Host key fingerprint",desc:"Optional SHA256:… fingerprint to pin the server's host key. Blank accepts any key.",keywords:"host key fingerprint verify trust"},{default:mt(()=>[Ve("hostKeyFingerprint")?(g(),x("span",Pg,[$(P(Ee("hostKeyFingerprint").effective||"—")+" ",1),ye("hostKeyFingerprint")?(g(),x("span",Tg,[O(Y,{name:"lock",size:10}),$(P(ye("hostKeyFingerprint")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[29]||(f[29]=k=>gt.hostKeyFingerprint=k),class:"field w-full font-mono text-xs",placeholder:"SHA256:…"},null,512)),[[vt,gt.hostKeyFingerprint]])]),_:1})):N("",!0),Ji.value==="ftps"?(g(),ie(_t,{key:10,title:"TLS verification",desc:"Skip only for self-signed test servers.",keywords:"tls certificate verify insecure ftps"},{default:mt(()=>[Ve("insecureSkipVerify")?(g(),x("span",Lg,[$(P(Ee("insecureSkipVerify").effective==="true"?"Skip verification":"Verify certificate")+" ",1),ye("insecureSkipVerify")?(g(),x("span",Cg,[O(Y,{name:"lock",size:10}),$(P(ye("insecureSkipVerify")),1)])):N("",!0)])):(g(),ie(hn,{key:1,modelValue:gt.insecureSkipVerify,"onUpdate:modelValue":f[30]||(f[30]=k=>gt.insecureSkipVerify=k),options:ci},null,8,["modelValue"]))]),_:1})):N("",!0),O(_t,{title:"Base path",desc:"Working directory and health-check target, e.g. /uploads.",keywords:"base path directory folder root"},{default:mt(()=>[Ve("basePath")?(g(),x("span",Mg,[$(P(Ee("basePath").effective||"—")+" ",1),ye("basePath")?(g(),x("span",Og,[O(Y,{name:"lock",size:10}),$(P(ye("basePath")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[31]||(f[31]=k=>gt.basePath=k),class:"field w-64 font-mono",placeholder:"/uploads"},null,512)),[[vt,gt.basePath]])]),_:1}),u("div",Eg,[ke.value?N("",!0):(g(),x("button",{key:0,class:"btn-accent",disabled:le.value||!tt.available,onClick:Tr},P(le.value?"Saving…":Be.value?"Save organization settings":"Save settings"),9,zg)),Be.value?N("",!0):(g(),x("button",{key:1,class:"btn-ghost",disabled:me.value||!tt.available,onClick:Lr},P(me.value?"Testing…":"Test connection"),9,Ag)),Ht.value?(g(),x("span",Ig,P(Ht.value),1)):N("",!0),Te.value&&!Be.value?(g(),x("span",$g,"Checked "+P(kr()),1)):N("",!0),ve.value&&!Be.value?(g(),x("span",{key:4,class:Ct(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",Cr(ve.value.status)])},[f[87]||(f[87]=u("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),$(P(ve.value.detail||ve.value.status),1)],2)):N("",!0)])]),u("div",Dg,[u("div",Ng,[u("div",Rg,[O(Y,{name:"cloud",size:20})]),f[88]||(f[88]=u("div",{class:"min-w-0"},[u("div",{class:"text-sm font-semibold text-ink"},"WebDAV"),u("div",{class:"mt-0.5 text-xs text-ink-muted"}," Connect to a WebDAV server (Nextcloud, ownCloud, IIS, …). Configure the connection your account uses. ")],-1))]),Vt.loaded&&!Vt.available?(g(),x("div",Fg,[O(Y,{name:"lock",size:14,class:"mr-1 inline"}),f[89]||(f[89]=$(" WebDAV is currently disabled by your administrator. Contact them to enable it. ",-1))])):N("",!0),Vt.canEditOrg?(g(),x("div",Bg,[f[90]||(f[90]=u("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),O(hn,{modelValue:ft.value,"onUpdate:modelValue":f[32]||(f[32]=k=>ft.value=k),options:_e},null,8,["modelValue"])])):N("",!0),an.value?(g(),ie(_t,{key:2,title:"Enable WebDAV (organization-wide)",desc:"Turn it on or off for everyone in your organization.",keywords:"enable disable plugin webdav organization"},{default:mt(()=>[O(nn,{"model-value":Vt.orgEnabled,disabled:!Vt.available,"onUpdate:modelValue":pi},null,8,["model-value","disabled"])]),_:1})):(g(),ie(_t,{key:3,title:"Enable WebDAV",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin webdav"},{default:mt(()=>[O(nn,{"model-value":Vt.enabled,disabled:!Vt.available||!Vt.orgEnabled,"onUpdate:modelValue":pi},null,8,["model-value","disabled"])]),_:1})),!an.value&&Vt.available&&!Vt.orgEnabled?(g(),x("div",Vg,[O(Y,{name:"lock",size:13,class:"mr-1 inline"}),f[92]||(f[92]=$("WebDAV is turned off for your organization",-1)),Vt.canEditOrg?(g(),x("span",Zg,[...f[91]||(f[91]=[$(" — switch to ",-1),u("span",{class:"font-semibold"},"Organization",-1),$(" to turn it back on",-1)])])):N("",!0),f[93]||(f[93]=$(". ",-1))])):N("",!0),an.value?(g(),x("div",Ug,[O(Y,{name:"users",size:13,class:"mr-1 inline"}),f[94]||(f[94]=$("These are organization-wide settings — they apply to everyone in ",-1)),u("span",Hg,P(e.organizationName||"your organization"),1),f[95]||(f[95]=$(". Leave the connection blank to let each user configure their own; a connection set here overrides the user's. ",-1))])):Os.value?(g(),x("div",jg," As a superadmin you manage the global WebDAV configuration in the API Server panel. The effective configuration is shown below. ")):N("",!0),O(_t,{block:"",title:"Server URL",desc:"WebDAV endpoint including scheme, e.g. https://cloud.example.com/remote.php/dav/files/alice/.",keywords:"url server address endpoint webdav host"},{default:mt(()=>[hi("baseURL")?(g(),x("span",Wg,[$(P(yn("baseURL").effective||"—")+" ",1),Ze("baseURL")?(g(),x("span",Kg,[O(Y,{name:"lock",size:10}),$(P(Ze("baseURL")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[33]||(f[33]=k=>ze.baseURL=k),class:"field w-full font-mono text-xs",placeholder:"https://cloud.example.com/remote.php/dav/files/alice/"},null,512)),[[vt,ze.baseURL]])]),_:1}),O(_t,{title:"Username",desc:"Account used to authenticate (leave blank for a public share).",keywords:"username login account"},{default:mt(()=>[hi("username")?(g(),x("span",Gg,[$(P(yn("username").effective||"—")+" ",1),Ze("username")?(g(),x("span",qg,[O(Y,{name:"lock",size:10}),$(P(Ze("username")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[34]||(f[34]=k=>ze.username=k),class:"field w-64",placeholder:"user"},null,512)),[[vt,ze.username]])]),_:1}),O(_t,{title:"Password",desc:"Password or app-specific token for HTTP Basic auth.",keywords:"password secret credentials token"},{default:mt(()=>[hi("password")?(g(),x("span",Yg,[$(P(yn("password").effective||"—")+" ",1),Ze("password")?(g(),x("span",Jg,[O(Y,{name:"lock",size:10}),$(P(Ze("password")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[35]||(f[35]=k=>ze.password=k),type:"password",class:"field w-64",placeholder:"••••••••"},null,512)),[[vt,ze.password]])]),_:1}),O(_t,{title:"TLS verification",desc:"Only affects HTTPS. Skip only for self-signed test servers.",keywords:"tls certificate verify insecure https"},{default:mt(()=>[hi("insecureSkipVerify")?(g(),x("span",Xg,[$(P(yn("insecureSkipVerify").effective==="true"?"Skip verification":"Verify certificate")+" ",1),Ze("insecureSkipVerify")?(g(),x("span",Qg,[O(Y,{name:"lock",size:10}),$(P(Ze("insecureSkipVerify")),1)])):N("",!0)])):(g(),ie(hn,{key:1,modelValue:ze.insecureSkipVerify,"onUpdate:modelValue":f[36]||(f[36]=k=>ze.insecureSkipVerify=k),options:yo},null,8,["modelValue"]))]),_:1}),O(_t,{title:"Base path",desc:"Working directory under the server URL and health-check target, e.g. /Documents.",keywords:"base path directory folder root"},{default:mt(()=>[hi("basePath")?(g(),x("span",t_,[$(P(yn("basePath").effective||"—")+" ",1),Ze("basePath")?(g(),x("span",e_,[O(Y,{name:"lock",size:10}),$(P(Ze("basePath")),1)])):N("",!0)])):ot((g(),x("input",{key:1,"onUpdate:modelValue":f[37]||(f[37]=k=>ze.basePath=k),class:"field w-64 font-mono",placeholder:"/Documents"},null,512)),[[vt,ze.basePath]])]),_:1}),u("div",n_,[Os.value?N("",!0):(g(),x("button",{key:0,class:"btn-accent",disabled:Ci.value||!Vt.available,onClick:xo},P(Ci.value?"Saving…":an.value?"Save organization settings":"Save settings"),9,i_)),an.value?N("",!0):(g(),x("button",{key:1,class:"btn-ghost",disabled:fi.value||!Vt.available,onClick:wo},P(fi.value?"Testing…":"Test connection"),9,s_)),di.value?(g(),x("span",o_,P(di.value),1)):N("",!0),tn.value&&!an.value?(g(),x("span",r_,"Checked "+P(Or()),1)):N("",!0),rn.value&&!an.value?(g(),x("span",{key:4,class:Ct(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",Mi(rn.value.status)])},[f[96]||(f[96]=u("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),$(P(rn.value.detail||rn.value.status),1)],2)):N("",!0)])])],64)):N("",!0),ss("drives-local")?(g(),x("div",a_,[u("div",l_,[u("div",u_,[O(Y,{name:"monitor",size:20})]),f[97]||(f[97]=u("div",{class:"min-w-0"},[u("div",{class:"text-sm font-semibold text-ink"},"Local Storage"),u("div",{class:"mt-0.5 text-xs text-ink-muted"}," A private folder on the server for your files. Each user has their own; members of an organization share one. ")],-1))]),X.loaded&&!X.available?(g(),x("div",c_,[O(Y,{name:"lock",size:14,class:"mr-1 inline"}),f[98]||(f[98]=$(" Local storage is currently disabled by your administrator. Contact them to enable it. ",-1))])):X.loaded&&!X.rootConfigured?(g(),x("div",d_,[O(Y,{name:"alertTriangle",size:14,class:"mr-1 inline"}),f[99]||(f[99]=$(" No storage root has been configured by your administrator yet. ",-1))])):N("",!0),X.canEditOrg?(g(),x("div",f_,[f[100]||(f[100]=u("div",{class:"text-xs text-ink-muted"},"Manage your own settings, or organization-wide settings that apply to every user.",-1)),O(hn,{modelValue:Qt.value,"onUpdate:modelValue":f[38]||(f[38]=k=>Qt.value=k),options:_e},null,8,["modelValue"])])):N("",!0),Se.value?(g(),ie(_t,{key:3,title:"Enable local storage (organization-wide)",desc:"Turn it on or off for everyone in your organization.",keywords:"enable disable plugin local storage folder organization"},{default:mt(()=>[O(nn,{"model-value":X.orgEnabled,disabled:!X.available,"onUpdate:modelValue":ns},null,8,["model-value","disabled"])]),_:1})):(g(),ie(_t,{key:4,title:"Enable local storage",desc:"Turn the plugin on for your account in the Web App.",keywords:"enable disable plugin local storage folder"},{default:mt(()=>[O(nn,{"model-value":X.enabled,disabled:!X.available||!X.orgEnabled,"onUpdate:modelValue":ns},null,8,["model-value","disabled"])]),_:1})),!Se.value&&X.available&&!X.orgEnabled?(g(),x("div",h_,[O(Y,{name:"lock",size:13,class:"mr-1 inline"}),f[102]||(f[102]=$("Local storage is turned off for your organization",-1)),X.canEditOrg?(g(),x("span",p_,[...f[101]||(f[101]=[$(" — switch to ",-1),u("span",{class:"font-semibold"},"Organization",-1),$(" to turn it back on",-1)])])):N("",!0),f[103]||(f[103]=$(". ",-1))])):N("",!0),Se.value?(g(),x("div",m_,[O(Y,{name:"users",size:13,class:"mr-1 inline"}),f[104]||(f[104]=$("These are organization-wide settings — they apply to everyone in ",-1)),u("span",g_,P(e.organizationName||"your organization"),1),f[105]||(f[105]=$(", who all share the organization folder. Members can additionally enable a private folder inside it. ",-1))])):$e.value?(g(),x("div",__," As a superadmin you manage the global storage root in the API Server panel. The effective configuration is shown below. ")):N("",!0),Se.value?(g(),ie(_t,{key:8,title:"Private folders",desc:"Let members create a private folder inside the organization folder, reachable only by them.",keywords:"private folder members allow policy organization"},{default:mt(()=>[O(nn,{"model-value":X.allowPrivate,disabled:!X.available,"onUpdate:modelValue":ko},null,8,["model-value","disabled"])]),_:1})):N("",!0),Se.value?N("",!0):(g(),x(ct,{key:9},[O(_t,{block:"",title:"Your folders",desc:"Assigned automatically and isolated — no one else can reach your private folder.",keywords:"folder directory path storage location isolated private shared"},{default:mt(()=>[u("div",v_,[(g(!0),x(ct,null,Wt(X.mounts,k=>(g(),x("div",{key:k.id,class:"flex flex-wrap items-center gap-2"},[u("span",y_,P(k.path),1),k.kind==="shared"?(g(),x("span",b_,[O(Y,{name:"users",size:10}),f[106]||(f[106]=$("Shared with your organization",-1))])):(g(),x("span",x_,[O(Y,{name:"lock",size:10}),f[107]||(f[107]=$("Private to you",-1))])),Wn.value[k.id]?(g(),x("span",{key:2,class:Ct(["inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-[10px] font-semibold",It(Wn.value[k.id].status)])},[f[108]||(f[108]=u("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),$(P(Wn.value[k.id].status),1)],2)):N("",!0)]))),128)),X.mounts.length?N("",!0):(g(),x("div",w_,P(X.rootConfigured?"No folder assigned yet.":"Waiting for the administrator to configure a storage root."),1))])]),_:1}),X.isOrgUser&&X.allowPrivate?(g(),ie(_t,{key:0,title:"My private folder",desc:"Add a private folder inside the organization folder, reachable only by you — you keep the shared folder too.",keywords:"private folder personal isolated organization inside"},{default:mt(()=>[O(nn,{"model-value":X.privateFolder,disabled:!X.available||!X.orgEnabled,"onUpdate:modelValue":is},null,8,["model-value","disabled"])]),_:1})):X.isOrgUser&&!X.allowPrivate?(g(),x("div",k_,[O(Y,{name:"lock",size:13,class:"mr-1 inline"}),f[109]||(f[109]=$("Private folders are turned off by your organization. ",-1))])):N("",!0)],64)),O(_t,{title:"Access mode",desc:"Read-only prevents uploads, deletes and folder creation.",keywords:"read only write access mode permission"},{default:mt(()=>[En("readOnly")?(g(),x("span",S_,[$(P(Ei(ge("readOnly").effective))+" ",1),gi("readOnly")?(g(),x("span",P_,[O(Y,{name:"lock",size:10}),$(P(gi("readOnly")),1)])):N("",!0)])):(g(),ie(hn,{key:1,modelValue:jn.value,"onUpdate:modelValue":f[39]||(f[39]=k=>jn.value=k),options:Oi},null,8,["modelValue"]))]),_:1}),u("div",T_,[$e.value?N("",!0):(g(),x("button",{key:0,class:"btn-accent",disabled:bn.value||!X.available,onClick:Rs},P(bn.value?"Saving…":Se.value?"Save organization settings":"Save settings"),9,L_)),Se.value?N("",!0):(g(),x("button",{key:1,class:"btn-ghost",disabled:mi.value||!X.available,onClick:Ar},P(mi.value?"Testing…":"Test folder"),9,C_)),ln.value?(g(),x("span",M_,P(ln.value),1)):N("",!0),oe.value&&!Se.value?(g(),x("span",O_,"Checked "+P($s()),1)):N("",!0),Pt.value&&!Se.value?(g(),x("span",{key:4,class:Ct(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",It(Pt.value.status)])},[f[110]||(f[110]=u("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),$(P(Pt.value.detail||Pt.value.status),1)],2)):N("",!0)])])):N("",!0)])):H.id==="profile"?(g(),x("div",E_,[O(_t,{block:"",title:"Profile photo",desc:"PNG or JPG, up to ~1.5 MB. Stored on this device.",keywords:"avatar photo picture"},{default:mt(()=>[u("div",z_,[$t(Tt).avatar?(g(),x("img",{key:0,src:$t(Tt).avatar,alt:"Avatar",class:"h-16 w-16 rounded-full object-cover"},null,8,A_)):(g(),x("div",I_,P(To.value),1)),u("div",$_,[u("label",D_,[O(Y,{name:"upload",size:15,class:"mr-1.5 inline"}),f[111]||(f[111]=$("Upload ",-1)),u("input",{type:"file",accept:"image/*",class:"hidden",onChange:Po},null,32)]),$t(Tt).avatar?(g(),x("button",{key:0,class:"btn-ghost",onClick:Ir},"Remove")):N("",!0)])])]),_:1}),O(_t,{title:"Display name",desc:"The name shown on your public profile.",keywords:"display name profile"},{default:mt(()=>[ot(u("input",{"onUpdate:modelValue":f[40]||(f[40]=k=>$t(Tt).displayName=k),class:"field w-56",placeholder:"Jane O.",onBlur:f[41]||(f[41]=k=>jt("Saved."))},null,544),[[vt,$t(Tt).displayName]])]),_:1}),O(_t,{block:"",title:"Bio",desc:"A short description others can see.",keywords:"bio about description"},{default:mt(()=>[ot(u("textarea",{"onUpdate:modelValue":f[42]||(f[42]=k=>$t(Tt).bio=k),rows:"3",maxlength:"240",class:"field w-full resize-none",placeholder:"Flight director, North yard operations…",onBlur:f[43]||(f[43]=k=>jt("Saved."))},null,544),[[vt,$t(Tt).bio]]),u("div",N_,P(($t(Tt).bio||"").length)+"/240",1)]),_:1}),O(_t,{title:"Show email on profile",desc:"Let teammates see your email address.",keywords:"show email public visibility"},{default:mt(()=>[O(nn,{modelValue:$t(Tt).showEmail,"onUpdate:modelValue":f[44]||(f[44]=k=>$t(Tt).showEmail=k)},null,8,["modelValue"])]),_:1})])):H.id==="security"?(g(),x("div",R_,[O(_t,{block:"",title:"Two-factor authentication",desc:"Require a one-time code at sign-in.",keywords:"two factor 2fa authentication security"},{default:mt(()=>[u("div",F_,[u("span",{class:Ct(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",$t(Tt).twoFactor?"bg-success-soft text-success-fg":"bg-surface-2 text-ink-secondary"])},[f[112]||(f[112]=u("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),$(P($t(Tt).twoFactor?"Enabled":"Disabled"),1)],2),!$t(Tt).twoFactor&&!Kn.value?(g(),x("button",{key:0,class:"btn-accent",onClick:Ii},"Enable 2FA")):$t(Tt).twoFactor?(g(),x("button",{key:1,class:"btn-ghost",onClick:$r},"Disable")):N("",!0)]),Kn.value?(g(),x("div",B_,[u("div",V_,[f[114]||(f[114]=u("div",{class:"grid h-28 w-28 place-items-center rounded bg-white p-2"},[u("svg",{viewBox:"0 0 100 100",class:"h-full w-full"},[u("rect",{width:"100",height:"100",fill:"#fff"}),u("g",{fill:"#0F1E3D"},[u("rect",{x:"6",y:"6",width:"24",height:"24"}),u("rect",{x:"70",y:"6",width:"24",height:"24"}),u("rect",{x:"6",y:"70",width:"24",height:"24"}),u("rect",{x:"12",y:"12",width:"12",height:"12",fill:"#fff"}),u("rect",{x:"76",y:"12",width:"12",height:"12",fill:"#fff"}),u("rect",{x:"12",y:"76",width:"12",height:"12",fill:"#fff"}),u("rect",{x:"40",y:"10",width:"8",height:"8"}),u("rect",{x:"52",y:"20",width:"8",height:"8"}),u("rect",{x:"40",y:"40",width:"8",height:"8"}),u("rect",{x:"60",y:"44",width:"8",height:"8"}),u("rect",{x:"44",y:"60",width:"8",height:"8"}),u("rect",{x:"70",y:"60",width:"8",height:"8"}),u("rect",{x:"80",y:"72",width:"8",height:"8"}),u("rect",{x:"60",y:"80",width:"8",height:"8"})])])],-1)),u("div",Z_,[f[113]||(f[113]=u("div",{class:"text-xs text-ink-secondary"},"Scan with an authenticator app, or enter this secret:",-1)),u("div",U_,P(Lo.value),1),u("div",H_,[ot(u("input",{"onUpdate:modelValue":f[45]||(f[45]=k=>Ai.value=k),inputmode:"numeric",maxlength:"6",class:"field w-28 font-mono tracking-[0.3em]",placeholder:"000000"},null,512),[[vt,Ai.value]]),u("button",{class:"btn-accent",onClick:Co},"Verify & enable")]),Zt.value?(g(),x("p",j_,P(Zt.value),1)):N("",!0)])])])):N("",!0),$t(Tt).twoFactor&&os.value.length?(g(),x("div",W_,[f[115]||(f[115]=u("div",{class:"text-xs font-semibold text-ink"},"Recovery codes",-1)),f[116]||(f[116]=u("div",{class:"mt-0.5 text-xs text-ink-muted"},"Store these somewhere safe — each works once.",-1)),u("div",K_,[(g(!0),x(ct,null,Wt(os.value,k=>(g(),x("span",{key:k,class:"select-all"},P(k),1))),128))])])):N("",!0),f[117]||(f[117]=u("p",{class:"mt-2 text-xs text-ink-muted"},"Prototype — codes are generated locally until the account service verifies them.",-1))]),_:1}),O(_t,{block:"",title:"Active sessions",desc:"Devices currently signed in to your account.",keywords:"sessions devices logout sign out remote"},{default:mt(()=>[u("div",G_,[u("div",q_,[u("div",Y_,[O(Y,{name:"monitor",size:18})]),u("div",J_,[u("div",X_,[$(P(Dr())+" on "+P(Mo())+" ",1),f[118]||(f[118]=u("span",{class:"ml-1 rounded-full bg-success-soft px-2 py-0.5 text-[10px] font-semibold text-success-fg"},"This device",-1))]),u("div",Q_,"Signed in "+P($t(Yl)($t(Nr))),1)]),u("button",{class:"btn-ghost",onClick:f[46]||(f[46]=k=>a("logout"))},"Log out")])]),f[119]||(f[119]=u("button",{class:"btn-ghost mt-2 opacity-60",disabled:"",title:"Requires the account service"}," Log out all other devices ",-1)),f[120]||(f[120]=u("p",{class:"mt-2 text-xs text-ink-muted"}," Only this session is visible from the browser; enumerating and revoking remote sessions needs the account service. ",-1))]),_:1})])):H.id==="team"?(g(),x("div",tv,[Gt.id?(g(),x("div",ev,[O(_t,{block:"",title:`Edit user — ${Gt.email}`,desc:"Update details, change role, reset password, or set verified.",keywords:"edit user update role password verified organization"},{default:mt(()=>[u("div",nv,[u("div",iv,[ot(u("input",{"onUpdate:modelValue":f[47]||(f[47]=k=>Gt.email=k),type:"email",class:"field flex-1",placeholder:"name@pilotvault.local"},null,512),[[vt,Gt.email]]),ot(u("select",{"onUpdate:modelValue":f[48]||(f[48]=k=>Gt.role=k),class:"field w-32",disabled:ls.value,title:ls.value?"You cannot change your own role":""},[(g(!0),x(ct,null,Wt(Fs.value,k=>(g(),x("option",{key:k.value,value:k.value},P(k.label),9,ov))),128))],8,sv),[[sn,Gt.role]])]),l.value?ot((g(),x("select",{key:0,"onUpdate:modelValue":f[49]||(f[49]=k=>Gt.organization=k),class:"field",title:"Organization"},[(g(!0),x(ct,null,Wt(Oo.value,k=>(g(),x("option",{key:k.value,value:k.value},P(k.label),9,rv))),128))],512)),[[sn,Gt.organization]]):N("",!0),ot(u("input",{"onUpdate:modelValue":f[50]||(f[50]=k=>Gt.password=k),type:"password",class:"field",placeholder:"New password (leave blank to keep current)"},null,512),[[vt,Gt.password]]),u("label",av,[O(nn,{modelValue:Gt.verified,"onUpdate:modelValue":f[51]||(f[51]=k=>Gt.verified=k)},null,8,["modelValue"]),f[121]||(f[121]=$(" Email verified ",-1))]),u("div",lv,[u("button",{class:"btn-accent",disabled:Ri.value,onClick:Br},P(Ri.value?"Saving…":"Save changes"),9,uv),u("button",{class:"btn-ghost",onClick:In},"Cancel"),An.value?(g(),x("span",cv,P(An.value),1)):N("",!0),ls.value?(g(),x("span",dv,"Editing your own account — role locked.")):N("",!0)])])]),_:1},8,["title"])])):(g(),x("div",fv,[O(_t,{block:"",title:"Add user",desc:"Create a new account. Admins add users within their organization; superadmins can target any.",keywords:"add user create account role admin organization"},{default:mt(()=>[u("div",hv,[u("div",pv,[ot(u("input",{"onUpdate:modelValue":f[52]||(f[52]=k=>re.email=k),type:"email",class:"field flex-1",placeholder:"name@pilotvault.local"},null,512),[[vt,re.email]]),ot(u("select",{"onUpdate:modelValue":f[53]||(f[53]=k=>re.role=k),class:"field w-32"},[(g(!0),x(ct,null,Wt(Fs.value,k=>(g(),x("option",{key:k.value,value:k.value},P(k.label),9,mv))),128))],512),[[sn,re.role]])]),l.value?ot((g(),x("select",{key:0,"onUpdate:modelValue":f[54]||(f[54]=k=>re.organization=k),class:"field",title:"Organization"},[(g(!0),x(ct,null,Wt(Oo.value,k=>(g(),x("option",{key:k.value,value:k.value},P(k.label),9,gv))),128))],512)),[[sn,re.organization]]):(g(),x("div",_v,[f[122]||(f[122]=$(" New users join your organization: ",-1)),u("span",vv,P(e.organizationName||"—"),1)])),ot(u("input",{"onUpdate:modelValue":f[55]||(f[55]=k=>re.password=k),type:"password",class:"field",placeholder:"Temporary password (min 8 chars)"},null,512),[[vt,re.password]]),u("div",yv,[u("button",{class:"btn-accent",disabled:$i.value,onClick:Rr},P($i.value?"Creating…":"Create user"),9,bv),yi.value?(g(),x("span",xv,P(yi.value),1)):N("",!0)])])]),_:1})])),u("div",wv,[u("div",kv,[f[123]||(f[123]=u("div",null,[u("div",{class:"eyebrow"},"Team"),u("div",{class:"mt-0.5 text-base font-semibold text-ink"},"All users")],-1)),u("button",{class:"btn-ghost",disabled:Gn.value,onClick:Yn},P(Gn.value?"Loading…":"Refresh"),9,Sv)]),as.value?(g(),x("div",Pv,P(as.value),1)):!rs.value.length&&!Gn.value?(g(),x("div",Tv,"No users yet.")):(g(),x("div",Lv,[u("table",Cv,[u("thead",null,[u("tr",Mv,[(g(),x(ct,null,Wt(["User","Role","Organization","Status",""],k=>u("th",{key:k,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},P(k),1)),64))])]),u("tbody",null,[(g(!0),x(ct,null,Wt(rs.value,k=>(g(),x("tr",{key:k.id,class:Ct(["border-b border-line last:border-0",Gt.id===k.id?"bg-accent-soft":""])},[u("td",Ov,[u("span",Ev,P(k.email),1),k.email===e.email?(g(),x("span",zv,"(you)")):N("",!0)]),u("td",Av,[u("span",{class:Ct(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",y(k.role||"user")])},[O(Y,{name:_(k.role||"user"),size:12},null,8,["name"]),$(P(h(k.role||"user")),1)],2)]),u("td",Iv,[u("span",{class:Ct(["text-sm",k.organizationName?"text-ink-secondary":"text-ink-muted"])},P(k.organizationName||"—"),3)]),u("td",$v,[u("span",{class:Ct(["text-xs",k.verified?"text-success-fg":"text-ink-muted"])},P(k.verified?"Verified":"Unverified"),3)]),u("td",Dv,[Ye.value===k.id?(g(),x(ct,{key:0},[f[124]||(f[124]=u("span",{class:"mr-2 text-xs text-ink-muted"},"Remove?",-1)),u("button",{class:"btn-ghost mr-1",onClick:f[56]||(f[56]=qt=>Ye.value="")},"Cancel"),u("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:qt=>Fr(k)}," Remove ",8,Nv)],64)):(g(),x("div",Rv,[u("button",{class:"btn-ghost inline-flex items-center gap-1.5",onClick:qt=>us(k)},[O(Y,{name:"settings",size:14}),f[125]||(f[125]=$(" Edit ",-1))],8,Fv),k.email!==e.email?(g(),x("button",{key:0,class:"btn-ghost inline-flex items-center gap-1.5",onClick:qt=>Ye.value=k.id},[O(Y,{name:"trash",size:14}),f[126]||(f[126]=$(" Remove ",-1))],8,Bv)):N("",!0)]))])],2))),128))])])]))])])):H.id==="organizations"?(g(),x("div",Vv,[kn.id?(g(),x("div",Zv,[O(_t,{block:"",title:"Rename organization",desc:"Update the organization's display name.",keywords:"rename organization edit"},{default:mt(()=>[u("div",Uv,[ot(u("input",{"onUpdate:modelValue":f[57]||(f[57]=k=>kn.name=k),class:"field",placeholder:"Organization name",onKeyup:Vl(zo,["enter"])},null,544),[[vt,kn.name]]),u("div",Hv,[u("button",{class:"btn-accent",onClick:zo},"Save changes"),u("button",{class:"btn-ghost",onClick:Bs},"Cancel"),Sn.value?(g(),x("span",jv,P(Sn.value),1)):N("",!0)])])]),_:1})])):(g(),x("div",Wv,[O(_t,{block:"",title:"Add organization",desc:"Create a new organization. Assign admins and users to it from User management.",keywords:"add organization create tenant company"},{default:mt(()=>[u("div",Kv,[ot(u("input",{"onUpdate:modelValue":f[58]||(f[58]=k=>$n.name=k),class:"field",placeholder:"e.g. Northwind Aerial",onKeyup:Vl(Eo,["enter"])},null,544),[[vt,$n.name]]),u("div",Gv,[u("button",{class:"btn-accent",disabled:Fi.value,onClick:Eo},P(Fi.value?"Creating…":"Create organization"),9,qv),Ce.value?(g(),x("span",Yv,P(Ce.value),1)):N("",!0)])])]),_:1})])),u("div",Jv,[u("div",{class:"flex items-center justify-between px-5 py-4"},[f[127]||(f[127]=u("div",null,[u("div",{class:"eyebrow"},"Tenancy"),u("div",{class:"mt-0.5 text-base font-semibold text-ink"},"All organizations")],-1)),u("button",{class:"btn-ghost",onClick:qn},"Refresh")]),Di.value.length?(g(),x("div",Qv,[u("table",ty,[u("thead",null,[u("tr",ey,[(g(),x(ct,null,Wt(["Organization","Members",""],k=>u("th",{key:k,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},P(k),1)),64))])]),u("tbody",null,[(g(!0),x(ct,null,Wt(Di.value,k=>(g(),x("tr",{key:k.id,class:Ct(["border-b border-line last:border-0",kn.id===k.id?"bg-accent-soft":""])},[u("td",ny,[u("span",iy,[O(Y,{name:"grid",size:14,class:"text-ink-muted"}),$(P(k.name),1)])]),u("td",sy,P(Bi.value[k.id]||0),1),u("td",oy,[bi.value===k.id?(g(),x(ct,{key:0},[f[128]||(f[128]=u("span",{class:"mr-2 text-xs text-ink-muted"},"Delete?",-1)),u("button",{class:"btn-ghost mr-1",onClick:f[59]||(f[59]=qt=>bi.value="")},"Cancel"),u("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:qt=>en(k)}," Delete ",8,ry)],64)):(g(),x("div",ay,[u("button",{class:"btn-ghost inline-flex items-center gap-1.5",onClick:qt=>Vr(k)},[O(Y,{name:"settings",size:14}),f[129]||(f[129]=$(" Rename ",-1))],8,ly),u("button",{class:"btn-ghost inline-flex items-center gap-1.5",disabled:(Bi.value[k.id]||0)>0,title:(Bi.value[k.id]||0)>0?"Reassign or remove members first":"",onClick:qt=>bi.value=k.id},[O(Y,{name:"trash",size:14}),f[130]||(f[130]=$(" Delete ",-1))],8,uy)]))])],2))),128))])])])):(g(),x("div",Xv,"No organizations yet."))])])):H.id==="advanced"?(g(),x("div",cy,[u("div",dy,[O(_t,{title:"Export data",desc:"Download your settings and profile as JSON.",keywords:"export data download backup"},{default:mt(()=>[u("button",{class:"btn-ghost",onClick:xi},[O(Y,{name:"download",size:15,class:"mr-1.5 inline"}),f[131]||(f[131]=$("Export",-1))])]),_:1}),O(_t,{block:"",title:"Import data",desc:"Restore settings from a previous export.",keywords:"import data upload restore"},{default:mt(()=>[u("label",fy,[O(Y,{name:"upload",size:15,class:"mr-1.5 inline"}),f[132]||(f[132]=$("Choose file… ",-1)),u("input",{type:"file",accept:"application/json,.json",class:"hidden",onChange:Pn},null,32)]),cs.value?(g(),x("p",hy,P(cs.value),1)):N("",!0)]),_:1})]),u("div",py,[u("div",my,[O(Y,{name:"alertTriangle",size:18}),f[133]||(f[133]=u("h3",{class:"text-sm font-bold uppercase tracking-caps"},"Danger zone",-1))]),f[138]||(f[138]=u("p",{class:"mt-1 text-xs text-ink-secondary"},"Deleting your account is permanent and cannot be undone.",-1)),u("div",gy,[f[137]||(f[137]=u("div",{class:"text-sm font-semibold text-ink"},"Delete account",-1)),u("label",_y,[ot(u("input",{"onUpdate:modelValue":f[60]||(f[60]=k=>de.understand=k),type:"checkbox",class:"mt-0.5 h-4 w-4 accent-[var(--danger)]"},null,512),[[rr,de.understand]]),f[134]||(f[134]=$(" I understand this permanently deletes my account and all associated data. ",-1))]),u("div",vy,[u("label",yy,[f[135]||(f[135]=$("Type ",-1)),u("span",by,P(Vs.value),1),f[136]||(f[136]=$(" to confirm",-1))]),ot(u("input",{"onUpdate:modelValue":f[61]||(f[61]=k=>de.typed=k),class:"field w-full max-w-[360px] font-mono",placeholder:Vs.value},null,8,xy),[[vt,de.typed]])]),u("div",wy,[de.armed?(g(),x("button",{key:1,class:"rounded bg-danger px-4 py-2.5 text-sm font-semibold text-white transition enabled:hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-50",disabled:de.cooldown>0,onClick:ds},P(de.cooldown>0?`Confirm in ${de.cooldown}s…`:"Permanently delete account"),9,Sy)):(g(),x("button",{key:0,class:"rounded bg-danger px-4 py-2.5 text-sm font-semibold text-white transition enabled:hover:brightness-110 disabled:cursor-not-allowed disabled:opacity-40",disabled:!Jn.value,onClick:Ao}," Delete account… ",8,ky)),de.armed&&de.cooldown>0?(g(),x("span",Py,"Cooling-off period — read once more.")):N("",!0)]),de.msg?(g(),x("p",Ty,P(de.msg),1)):N("",!0)])])])):N("",!0)],64))),128))])]),O(Qf,{name:"fade"},{default:mt(()=>[_i.value?(g(),x("div",Ly,[O(Y,{name:"check",size:16,class:"text-success-fg"}),$(P(_i.value),1)])):N("",!0)]),_:1})]))}},My=Wp(Cy,[["__scopeId","data-v-4fe25eb7"]]),Oy={class:"mx-auto flex max-w-[1240px] flex-col gap-5 p-7"},Ey={class:"flex flex-wrap items-center gap-3"},zy={class:"inline-flex rounded-lg border border-line bg-surface-1 p-0.5"},Ay=["onClick"],Iy={class:"ml-auto flex items-center gap-2"},$y=["href"],Dy={class:"grid grid-cols-4 gap-4 max-[900px]:grid-cols-2"},Ny={class:"eyebrow"},Ry={key:0,class:"panel border-danger/40 p-4 text-sm text-danger-fg"},Fy={key:0,class:"panel p-5"},By={class:"mb-4 flex items-center justify-between"},Vy={class:"eyebrow"},Zy={class:"grid grid-cols-3 gap-3 max-[760px]:grid-cols-1"},Uy={class:"block"},Hy={class:"block"},jy={class:"block"},Wy={class:"block"},Ky={key:0,value:""},Gy=["value"],qy={class:"block"},Yy={class:"block"},Jy={class:"block"},Xy={class:"block"},Qy={class:"block"},t1=["value"],e1={class:"block"},n1=["value"],i1={class:"block"},s1=["value"],o1={class:"block"},r1={class:"mt-3 block"},a1={key:0,class:"mt-3 grid grid-cols-2 gap-3 max-[760px]:grid-cols-1"},l1={class:"block"},u1={class:"block"},c1={class:"block"},d1={class:"block"},f1={class:"col-span-2 block max-[760px]:col-span-1"},h1={class:"mt-4 flex items-center gap-3"},p1=["disabled"],m1={key:0,class:"text-sm text-danger-fg"},g1={class:"panel overflow-hidden p-0"},_1={key:0,class:"px-5 py-12 text-center text-sm text-ink-muted"},v1={key:1,class:"grid place-items-center px-5 py-16 text-center"},y1={key:2,class:"overflow-x-auto"},b1={class:"w-full border-collapse text-sm"},x1={class:"text-left"},w1={class:"whitespace-nowrap px-5 py-3 font-mono text-ink"},k1={key:0,class:"text-ink-muted"},S1={class:"px-5 py-3 text-ink-secondary"},P1=["title"],T1={class:"px-5 py-3 font-mono text-ink-secondary"},L1={class:"px-5 py-3 text-ink-secondary"},C1={class:"px-5 py-3"},M1=["onClick"],O1={class:"whitespace-nowrap px-5 py-3 text-right"},E1=["onClick"],z1=["onClick"],A1=["onClick"],I1={key:0,class:"border-b border-line bg-surface-2"},$1={colspan:"7",class:"px-5 py-3"},D1={class:"flex flex-wrap gap-x-8 gap-y-1.5 text-xs"},N1={class:"text-ink-secondary"},R1={class:"text-ink"},F1={class:"text-ink-secondary"},B1={class:"text-ink"},V1={class:"text-ink-secondary"},Z1={class:"font-mono text-ink"},U1={key:0,class:"text-ink-secondary"},H1={class:"text-ink"},j1={key:0,class:"mt-2 space-y-1"},W1={key:1,class:"mt-2 text-xs text-success-fg"},K1={key:0,class:"panel p-5"},G1={class:"mb-4 flex items-center justify-between"},q1={class:"eyebrow"},Y1={class:"grid grid-cols-3 gap-3 max-[760px]:grid-cols-1"},J1={class:"block"},X1={class:"block"},Q1={class:"block"},tb={class:"block"},eb={class:"block"},nb={class:"block"},ib=["value"],sb={class:"mt-3 flex flex-wrap gap-6"},ob={class:"flex items-center gap-2 text-sm text-ink-secondary"},rb={class:"flex items-center gap-2 text-sm text-ink-secondary"},ab={class:"mt-4 flex items-center gap-3"},lb=["disabled"],ub={key:0,class:"text-sm text-danger-fg"},cb={class:"panel overflow-hidden p-0"},db={key:0,class:"px-5 py-12 text-center text-sm text-ink-muted"},fb={key:1,class:"grid place-items-center px-5 py-16 text-center"},hb={key:2,class:"overflow-x-auto"},pb={class:"w-full border-collapse text-sm"},mb={class:"text-left"},gb={class:"px-5 py-3 font-semibold text-ink"},_b={class:"px-5 py-3 text-ink-secondary"},vb={class:"px-5 py-3 font-mono text-ink-secondary"},yb={class:"px-5 py-3"},bb={key:1,class:"text-ink-muted"},xb={class:"px-5 py-3"},wb={class:"whitespace-nowrap px-5 py-3 text-right"},kb=["onClick"],Sb=["onClick"],Pb=["onClick"],Tb={__name:"Logbook",props:{email:{type:String,default:""},role:{type:String,default:"user"},organization:{type:String,default:""},organizationName:{type:String,default:""}},setup(e){const i=e,o={success:"bg-success-soft text-success-fg",warning:"bg-amber-soft text-amber-fg",danger:"bg-danger-soft text-danger-fg",accent:"bg-accent-soft text-accent-soft-fg",neutral:"bg-surface-2 text-ink-secondary"},a=G("flights"),l=G([]),d=G([]),h=G(!1),_=G("");async function y(){h.value=!0,_.value="";const[j,C]=await Promise.all([ip(),ap()]);(!j.ok||!C.ok)&&(_.value=j.status===503||C.status===503?"Logbook storage is not configured on the API Server (service account missing).":"Could not load the logbook."),l.value=j.drones,d.value=C.flights,h.value=!1}Yi(y);function T(j){const C=j.compliance||{};return C.exempt?{tone:"neutral",label:"Exempt"}:(C.redFlags||[]).length?{tone:"danger",label:`${C.redFlags.length} issue${C.redFlags.length>1?"s":""}`}:{tone:"success",label:"Compliant"}}const w=G("");function A(j){w.value=w.value===j?"":j}const U=[{value:"open",label:"Open"},{value:"specific",label:"Specific"},{value:"certified",label:"Certified"}],V=[{value:"commercial",label:"Commercial"},{value:"research",label:"Research"},{value:"public",label:"Public-benefit"},{value:"hobby",label:"Private hobby"},{value:"club_area",label:"Model-club area"}],rt=[{value:"",label:"Auto (from drone)"},{value:"manual",label:"Manual"},{value:"automatic",label:"Automatic (FDR)"}];function Q(){var j;return{operationDate:new Date().toISOString().slice(0,10),startTime:"",endTime:"",drone:((j=l.value[0])==null?void 0:j.id)||"",areaRoute:"",maxAltitudeAgl:"",pilotName:i.email,certificateRef:"",category:"open",purpose:"commercial",loggingPath:"",rawFdrLogUrl:"",authorisationRef:"",weather:"",airspaceRef:"",observer:"",incidents:"",notes:""}}const Ot=G(!1),Mt=G(""),q=xe(Q()),dt=G(""),it=G(!1),ht=G(!1);function Kt(){Object.assign(q,Q()),Mt.value="",dt.value="",ht.value=!1,Ot.value=!0}function he(j){Object.assign(q,{operationDate:(j.operationDate||"").slice(0,10),startTime:j.startTime||"",endTime:j.endTime||"",drone:j.drone||"",areaRoute:j.areaRoute||"",maxAltitudeAgl:j.maxAltitudeAgl||"",pilotName:j.pilotName||"",certificateRef:j.certificateRef||"",category:j.category||"open",purpose:j.purpose||"commercial",loggingPath:j.loggingPath||"",rawFdrLogUrl:j.rawFdrLogUrl||"",authorisationRef:j.authorisationRef||"",weather:j.weather||"",airspaceRef:j.airspaceRef||"",observer:j.observer||"",incidents:j.incidents||"",notes:j.notes||""}),Mt.value=j.id,dt.value="",ht.value=!!(j.weather||j.airspaceRef||j.observer||j.incidents||j.notes),Ot.value=!0}function pe(){Ot.value=!1,Mt.value=""}async function St(){var E;if(dt.value="",!q.drone){dt.value="Select a drone first (add one on the Drones tab).";return}it.value=!0;const j={...q,maxAltitudeAgl:Number(q.maxAltitudeAgl)||0},C=Mt.value?await up(Mt.value,j):await lp(j);if(it.value=!1,!C.ok){dt.value=((E=C.body)==null?void 0:E.error)||"Could not save the flight.";return}Ot.value=!1,await y()}const Nt=G("");async function Et(j){const C=await cp(j.id);Nt.value="",C.ok&&await y()}const nt=["","C0","C1","C2","C3","C4","C5","C6"];function ut(){return{name:"",model:"",serial:"",operatorNumber:"",mtomGrams:"",isToy:!1,autologsFlights:!1,cClass:""}}const zt=G(!1),Ft=G(""),lt=xe(ut()),At=G(""),et=G(!1);function ce(){Object.assign(lt,ut()),Ft.value="",At.value="",zt.value=!0}function pt(j){Object.assign(lt,{name:j.name||"",model:j.model||"",serial:j.serial||"",operatorNumber:j.operatorNumber||"",mtomGrams:j.mtomGrams||"",isToy:!!j.isToy,autologsFlights:!!j.autologsFlights,cClass:j.cClass||""}),Ft.value=j.id,At.value="",zt.value=!0}function kt(){zt.value=!1,Ft.value=""}async function Yt(){var E;if(At.value="",!lt.name.trim()){At.value="Give the drone a name.";return}et.value=!0;const j={...lt,mtomGrams:Number(lt.mtomGrams)||0},C=Ft.value?await op(Ft.value,j):await sp(j);if(et.value=!1,!C.ok){At.value=((E=C.body)==null?void 0:E.error)||"Could not save the drone.";return}zt.value=!1,await y()}const ae=G("");async function Jt(j){var E;const C=await rp(j.id);ae.value="",C.ok?await y():At.value=((E=C.body)==null?void 0:E.error)||"Could not delete the drone."}const Bt=xt(()=>{const j=d.value.length,C=d.value.filter(_e=>{var se;return(((se=_e.compliance)==null?void 0:se.redFlags)||[]).length}).length,E=d.value.filter(_e=>{var se;return(se=_e.compliance)==null?void 0:se.required}).length;return{total:j,flagged:C,required:E,fleet:l.value.length}});return(j,C)=>(g(),x("div",Oy,[u("div",Ey,[u("div",zy,[(g(),x(ct,null,Wt([["flights","Flights"],["drones","Drones"]],E=>u("button",{key:E[0],class:Ct(["rounded-md px-3.5 py-1.5 text-sm font-semibold transition",a.value===E[0]?"bg-accent-soft text-accent-soft-fg":"text-ink-secondary hover:text-ink"]),onClick:_e=>a.value=E[0]},P(E[1]),11,Ay)),64))]),u("div",Iy,[u("a",{href:$t(dp)(),class:"btn-ghost inline-flex items-center gap-2",title:"Download a compliance CSV (Trafikstyrelsen / police disclosure)"},[O(Y,{name:"download",size:15}),C[29]||(C[29]=$(" Export CSV ",-1))],8,$y),a.value==="flights"?(g(),x("button",{key:0,class:"btn-accent inline-flex items-center gap-2",onClick:Kt},[O(Y,{name:"plus",size:15}),C[30]||(C[30]=$(" Log flight ",-1))])):(g(),x("button",{key:1,class:"btn-accent inline-flex items-center gap-2",onClick:ce},[O(Y,{name:"plus",size:15}),C[31]||(C[31]=$(" Add drone ",-1))]))])]),u("div",Dy,[(g(!0),x(ct,null,Wt([{label:"Flights logged",value:Bt.value.total,tone:"neutral"},{label:"Require logbook",value:Bt.value.required,tone:"neutral"},{label:"Compliance flags",value:Bt.value.flagged,tone:Bt.value.flagged?"danger":"success"},{label:"Registered drones",value:Bt.value.fleet,tone:"neutral"}],E=>(g(),x("div",{key:E.label,class:"panel p-5"},[u("div",Ny,P(E.label),1),u("div",{class:Ct(["mt-2 text-[30px] font-bold leading-none tracking-tightest",E.tone==="danger"?"text-danger-fg":E.tone==="success"?"text-success-fg":"text-ink"])},P(E.value),3)]))),128))]),_.value?(g(),x("div",Ry,P(_.value),1)):N("",!0),a.value==="flights"?(g(),x(ct,{key:1},[Ot.value?(g(),x("div",Fy,[u("div",By,[u("div",null,[u("div",Vy,P(Mt.value?"Edit entry":"New entry"),1),C[32]||(C[32]=u("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Logbook flight (BEK 1649 §5)",-1))]),u("button",{class:"btn-icon",onClick:pe},[O(Y,{name:"x",size:16})])]),u("div",Zy,[u("label",Uy,[C[33]||(C[33]=u("span",{class:"eyebrow mb-1 block"},"Date",-1)),ot(u("input",{"onUpdate:modelValue":C[0]||(C[0]=E=>q.operationDate=E),type:"date",class:"field"},null,512),[[vt,q.operationDate]])]),u("label",Hy,[C[34]||(C[34]=u("span",{class:"eyebrow mb-1 block"},"Start",-1)),ot(u("input",{"onUpdate:modelValue":C[1]||(C[1]=E=>q.startTime=E),type:"time",class:"field"},null,512),[[vt,q.startTime]])]),u("label",jy,[C[35]||(C[35]=u("span",{class:"eyebrow mb-1 block"},"End",-1)),ot(u("input",{"onUpdate:modelValue":C[2]||(C[2]=E=>q.endTime=E),type:"time",class:"field"},null,512),[[vt,q.endTime]])]),u("label",Wy,[C[36]||(C[36]=u("span",{class:"eyebrow mb-1 block"},"Drone",-1)),ot(u("select",{"onUpdate:modelValue":C[3]||(C[3]=E=>q.drone=E),class:"field"},[l.value.length?N("",!0):(g(),x("option",Ky,"— add a drone first —")),(g(!0),x(ct,null,Wt(l.value,E=>(g(),x("option",{key:E.id,value:E.id},P(E.name)+P(E.model?` · ${E.model}`:""),9,Gy))),128))],512),[[sn,q.drone]])]),u("label",qy,[C[37]||(C[37]=u("span",{class:"eyebrow mb-1 block"},"Max altitude (m AGL)",-1)),ot(u("input",{"onUpdate:modelValue":C[4]||(C[4]=E=>q.maxAltitudeAgl=E),type:"number",min:"0",class:"field",placeholder:"120"},null,512),[[vt,q.maxAltitudeAgl]])]),u("label",Yy,[C[38]||(C[38]=u("span",{class:"eyebrow mb-1 block"},"Area / route",-1)),ot(u("input",{"onUpdate:modelValue":C[5]||(C[5]=E=>q.areaRoute=E),class:"field",placeholder:"Field N of Roskilde, grid survey"},null,512),[[vt,q.areaRoute]])]),u("label",Jy,[C[39]||(C[39]=u("span",{class:"eyebrow mb-1 block"},"Remote pilot name",-1)),ot(u("input",{"onUpdate:modelValue":C[6]||(C[6]=E=>q.pilotName=E),class:"field",placeholder:"Full name"},null,512),[[vt,q.pilotName]])]),u("label",Xy,[C[40]||(C[40]=u("span",{class:"eyebrow mb-1 block"},"Certificate ref",-1)),ot(u("input",{"onUpdate:modelValue":C[7]||(C[7]=E=>q.certificateRef=E),class:"field",placeholder:"A2 / STS cert no."},null,512),[[vt,q.certificateRef]])]),u("label",Qy,[C[41]||(C[41]=u("span",{class:"eyebrow mb-1 block"},"Logging path",-1)),ot(u("select",{"onUpdate:modelValue":C[8]||(C[8]=E=>q.loggingPath=E),class:"field"},[(g(),x(ct,null,Wt(rt,E=>u("option",{key:E.value,value:E.value},P(E.label),9,t1)),64))],512),[[sn,q.loggingPath]])]),u("label",e1,[C[42]||(C[42]=u("span",{class:"eyebrow mb-1 block"},"Category",-1)),ot(u("select",{"onUpdate:modelValue":C[9]||(C[9]=E=>q.category=E),class:"field"},[(g(),x(ct,null,Wt(U,E=>u("option",{key:E.value,value:E.value},P(E.label),9,n1)),64))],512),[[sn,q.category]])]),u("label",i1,[C[43]||(C[43]=u("span",{class:"eyebrow mb-1 block"},"Purpose",-1)),ot(u("select",{"onUpdate:modelValue":C[10]||(C[10]=E=>q.purpose=E),class:"field"},[(g(),x(ct,null,Wt(V,E=>u("option",{key:E.value,value:E.value},P(E.label),9,s1)),64))],512),[[sn,q.purpose]])]),u("label",o1,[C[44]||(C[44]=u("span",{class:"eyebrow mb-1 block"},"Authorisation ref",-1)),ot(u("input",{"onUpdate:modelValue":C[11]||(C[11]=E=>q.authorisationRef=E),class:"field",placeholder:"Specific-category ref"},null,512),[[vt,q.authorisationRef]])])]),u("label",r1,[C[45]||(C[45]=u("span",{class:"eyebrow mb-1 block"},"FDR log URL (automatic path)",-1)),ot(u("input",{"onUpdate:modelValue":C[12]||(C[12]=E=>q.rawFdrLogUrl=E),class:"field",placeholder:"Link to the stored flight-data-recorder export"},null,512),[[vt,q.rawFdrLogUrl]])]),u("button",{class:"mt-4 flex items-center gap-1.5 text-sm font-semibold text-accent",onClick:C[13]||(C[13]=E=>ht.value=!ht.value)},[O(Y,{name:ht.value?"x":"plus",size:14},null,8,["name"]),C[46]||(C[46]=$(" Operational details (weather, airspace, incidents) ",-1))]),ht.value?(g(),x("div",a1,[u("label",l1,[C[47]||(C[47]=u("span",{class:"eyebrow mb-1 block"},"Weather / wind",-1)),ot(u("input",{"onUpdate:modelValue":C[14]||(C[14]=E=>q.weather=E),class:"field",placeholder:"6 m/s NW, CAVOK"},null,512),[[vt,q.weather]])]),u("label",u1,[C[48]||(C[48]=u("span",{class:"eyebrow mb-1 block"},"Airspace / NOTAM ref",-1)),ot(u("input",{"onUpdate:modelValue":C[15]||(C[15]=E=>q.airspaceRef=E),class:"field"},null,512),[[vt,q.airspaceRef]])]),u("label",c1,[C[49]||(C[49]=u("span",{class:"eyebrow mb-1 block"},"Observer",-1)),ot(u("input",{"onUpdate:modelValue":C[16]||(C[16]=E=>q.observer=E),class:"field"},null,512),[[vt,q.observer]])]),u("label",d1,[C[50]||(C[50]=u("span",{class:"eyebrow mb-1 block"},"Incidents / anomalies",-1)),ot(u("input",{"onUpdate:modelValue":C[17]||(C[17]=E=>q.incidents=E),class:"field",placeholder:"RTH trigger, GPS dropout…"},null,512),[[vt,q.incidents]])]),u("label",f1,[C[51]||(C[51]=u("span",{class:"eyebrow mb-1 block"},"Notes",-1)),ot(u("textarea",{"onUpdate:modelValue":C[18]||(C[18]=E=>q.notes=E),rows:"2",class:"field"},null,512),[[vt,q.notes]])])])):N("",!0),u("div",h1,[u("button",{class:"btn-accent",disabled:it.value,onClick:St},P(it.value?"Saving…":Mt.value?"Save changes":"Log flight"),9,p1),u("button",{class:"btn-ghost",onClick:pe},"Cancel"),dt.value?(g(),x("span",m1,P(dt.value),1)):N("",!0)])])):N("",!0),u("div",g1,[h.value?(g(),x("div",_1,"Loading…")):d.value.length?(g(),x("div",y1,[u("table",b1,[u("thead",null,[u("tr",x1,[(g(),x(ct,null,Wt(["Date","Drone","Area / route","Alt","Pilot","Compliance",""],E=>u("th",{key:E,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},P(E),1)),64))])]),u("tbody",null,[(g(!0),x(ct,null,Wt(d.value,E=>{var _e,se,Ge,v;return g(),x(ct,{key:E.id},[u("tr",{class:Ct(["border-b border-line last:border-0",Mt.value===E.id?"bg-accent-soft":""])},[u("td",w1,[$(P((E.operationDate||"").slice(0,10))+" ",1),E.startTime?(g(),x("span",k1,P(E.startTime),1)):N("",!0)]),u("td",S1,P(E.droneName||"—"),1),u("td",{class:"max-w-[220px] truncate px-5 py-3 text-ink-secondary",title:E.areaRoute},P(E.areaRoute||"—"),9,P1),u("td",T1,P(E.maxAltitudeAgl?E.maxAltitudeAgl+" m":"—"),1),u("td",L1,P(E.pilotName||"—"),1),u("td",C1,[u("button",{class:Ct(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",o[T(E).tone]]),onClick:m=>A(E.id)},[T(E).tone==="danger"?(g(),ie(Y,{key:0,name:"alertTriangle",size:12})):T(E).tone==="success"?(g(),ie(Y,{key:1,name:"check",size:12})):N("",!0),$(" "+P(T(E).label),1)],10,M1)]),u("td",O1,[Nt.value===E.id?(g(),x(ct,{key:0},[C[54]||(C[54]=u("span",{class:"mr-2 text-xs text-ink-muted"},"Delete?",-1)),u("button",{class:"btn-ghost mr-1",onClick:C[19]||(C[19]=m=>Nt.value="")},"Cancel"),u("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:m=>Et(E)},"Delete",8,E1)],64)):(g(),x(ct,{key:1},[u("button",{class:"btn-ghost mr-1 inline-flex items-center gap-1",onClick:m=>he(E)},[O(Y,{name:"sliders",size:13}),C[55]||(C[55]=$(" Edit",-1))],8,z1),u("button",{class:"btn-ghost inline-flex items-center gap-1",onClick:m=>Nt.value=E.id},[O(Y,{name:"trash",size:13})],8,A1)],64))])],2),w.value===E.id?(g(),x("tr",I1,[u("td",$1,[u("div",D1,[u("span",N1,[C[56]||(C[56]=$("Logging path: ",-1)),u("b",R1,P(((_e=E.compliance)==null?void 0:_e.loggingPath)||"—"),1)]),u("span",F1,[C[57]||(C[57]=$("Category: ",-1)),u("b",B1,P(E.category||"—"),1)]),u("span",V1,[C[58]||(C[58]=$("Retain until: ",-1)),u("b",Z1,P((E.retentionUntil||"").slice(0,10)||"—"),1)]),(se=E.compliance)!=null&&se.exempt?(g(),x("span",U1,[C[59]||(C[59]=$("Exempt: ",-1)),u("b",H1,P(E.compliance.exemptReason),1)])):N("",!0)]),(((Ge=E.compliance)==null?void 0:Ge.redFlags)||[]).length?(g(),x("ul",j1,[(g(!0),x(ct,null,Wt(E.compliance.redFlags,(m,M)=>(g(),x("li",{key:M,class:"flex items-start gap-2 text-xs text-danger-fg"},[O(Y,{name:"alertTriangle",size:13,class:"mt-px shrink-0"}),$(" "+P(m),1)]))),128))])):(v=E.compliance)!=null&&v.exempt?N("",!0):(g(),x("div",W1,"No compliance gaps detected."))])])):N("",!0)],64)}),128))])])])):(g(),x("div",v1,[O(Y,{name:"book",size:26,class:"text-ink-muted"}),C[52]||(C[52]=u("div",{class:"mt-3 text-sm font-medium text-ink-secondary"},"No flights logged yet",-1)),C[53]||(C[53]=u("div",{class:"mt-1 text-xs text-ink-muted"},"Log your first operation to start the 5-year retention record.",-1))]))])],64)):(g(),x(ct,{key:2},[zt.value?(g(),x("div",K1,[u("div",G1,[u("div",null,[u("div",q1,P(Ft.value?"Edit drone":"New drone"),1),C[60]||(C[60]=u("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Aircraft registry",-1))]),u("button",{class:"btn-icon",onClick:kt},[O(Y,{name:"x",size:16})])]),u("div",Y1,[u("label",J1,[C[61]||(C[61]=u("span",{class:"eyebrow mb-1 block"},"Name",-1)),ot(u("input",{"onUpdate:modelValue":C[20]||(C[20]=E=>lt.name=E),class:"field",placeholder:"Mavic-01"},null,512),[[vt,lt.name]])]),u("label",X1,[C[62]||(C[62]=u("span",{class:"eyebrow mb-1 block"},"Model",-1)),ot(u("input",{"onUpdate:modelValue":C[21]||(C[21]=E=>lt.model=E),class:"field",placeholder:"DJI Mavic 3 Enterprise"},null,512),[[vt,lt.model]])]),u("label",Q1,[C[63]||(C[63]=u("span",{class:"eyebrow mb-1 block"},"Serial",-1)),ot(u("input",{"onUpdate:modelValue":C[22]||(C[22]=E=>lt.serial=E),class:"field"},null,512),[[vt,lt.serial]])]),u("label",tb,[C[64]||(C[64]=u("span",{class:"eyebrow mb-1 block"},"Operator no.",-1)),ot(u("input",{"onUpdate:modelValue":C[23]||(C[23]=E=>lt.operatorNumber=E),class:"field",placeholder:"DNK…"},null,512),[[vt,lt.operatorNumber]])]),u("label",eb,[C[65]||(C[65]=u("span",{class:"eyebrow mb-1 block"},"MTOM (grams)",-1)),ot(u("input",{"onUpdate:modelValue":C[24]||(C[24]=E=>lt.mtomGrams=E),type:"number",min:"0",class:"field",placeholder:"920"},null,512),[[vt,lt.mtomGrams]])]),u("label",nb,[C[66]||(C[66]=u("span",{class:"eyebrow mb-1 block"},"C-class",-1)),ot(u("select",{"onUpdate:modelValue":C[25]||(C[25]=E=>lt.cClass=E),class:"field"},[(g(),x(ct,null,Wt(nt,E=>u("option",{key:E,value:E},P(E||"— none —"),9,ib)),64))],512),[[sn,lt.cClass]])])]),u("div",sb,[u("label",ob,[ot(u("input",{"onUpdate:modelValue":C[26]||(C[26]=E=>lt.autologsFlights=E),type:"checkbox",class:"h-4 w-4 accent-[var(--accent)]"},null,512),[[rr,lt.autologsFlights]]),C[67]||(C[67]=$(" Auto-logs flights (onboard FDR) ",-1))]),u("label",rb,[ot(u("input",{"onUpdate:modelValue":C[27]||(C[27]=E=>lt.isToy=E),type:"checkbox",class:"h-4 w-4 accent-[var(--accent)]"},null,512),[[rr,lt.isToy]]),C[68]||(C[68]=$(" Toy drone (logbook-exempt) ",-1))])]),u("div",ab,[u("button",{class:"btn-accent",disabled:et.value,onClick:Yt},P(et.value?"Saving…":Ft.value?"Save changes":"Add drone"),9,lb),u("button",{class:"btn-ghost",onClick:kt},"Cancel"),At.value?(g(),x("span",ub,P(At.value),1)):N("",!0)])])):N("",!0),u("div",cb,[h.value?(g(),x("div",db,"Loading…")):l.value.length?(g(),x("div",hb,[u("table",pb,[u("thead",null,[u("tr",mb,[(g(),x(ct,null,Wt(["Name","Model","MTOM","Class","FDR",""],E=>u("th",{key:E,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},P(E),1)),64))])]),u("tbody",null,[(g(!0),x(ct,null,Wt(l.value,E=>(g(),x("tr",{key:E.id,class:Ct(["border-b border-line last:border-0",Ft.value===E.id?"bg-accent-soft":""])},[u("td",gb,P(E.name),1),u("td",_b,P(E.model||"—"),1),u("td",vb,P(E.mtomGrams?E.mtomGrams+" g":"—"),1),u("td",yb,[E.cClass?(g(),x("span",{key:0,class:Ct(["inline-flex rounded-full px-2 py-0.5 text-[11px] font-semibold",o.accent])},P(E.cClass),3)):(g(),x("span",bb,"—")),E.isToy?(g(),x("span",{key:2,class:Ct(["ml-1 inline-flex rounded-full px-2 py-0.5 text-[11px] font-semibold",o.neutral])},"toy",2)):N("",!0)]),u("td",xb,[u("span",{class:Ct(["text-xs",E.autologsFlights?"text-success-fg":"text-ink-muted"])},P(E.autologsFlights?"yes":"no"),3)]),u("td",wb,[ae.value===E.id?(g(),x(ct,{key:0},[C[71]||(C[71]=u("span",{class:"mr-2 text-xs text-ink-muted"},"Delete?",-1)),u("button",{class:"btn-ghost mr-1",onClick:C[28]||(C[28]=_e=>ae.value="")},"Cancel"),u("button",{class:"rounded bg-danger px-3 py-1.5 text-sm font-semibold text-white transition hover:brightness-110",onClick:_e=>Jt(E)},"Delete",8,kb)],64)):(g(),x(ct,{key:1},[u("button",{class:"btn-ghost mr-1 inline-flex items-center gap-1",onClick:_e=>pt(E)},[O(Y,{name:"sliders",size:13}),C[72]||(C[72]=$(" Edit",-1))],8,Sb),u("button",{class:"btn-ghost inline-flex items-center gap-1",onClick:_e=>ae.value=E.id},[O(Y,{name:"trash",size:13})],8,Pb)],64))])],2))),128))])])])):(g(),x("div",fb,[O(Y,{name:"drone",size:26,class:"text-ink-muted"}),C[69]||(C[69]=u("div",{class:"mt-3 text-sm font-medium text-ink-secondary"},"No drones registered",-1)),C[70]||(C[70]=u("div",{class:"mt-1 text-xs text-ink-muted"},"Register the airframes you fly to log flights against them.",-1))]))])],64))]))}},Lb={class:"grid h-full grid-cols-[248px_1fr] max-[900px]:grid-cols-1"},Cb={class:"flex flex-col border-r border-line bg-surface-1 px-4 py-5 max-[900px]:hidden"},Mb={class:"flex items-center gap-2.5 px-2 pb-5"},Ob={class:"flex flex-col gap-0.5"},Eb=["onClick"],zb={class:"mt-auto flex flex-col gap-2.5"},Ab={class:"rounded-lg bg-surface-2 p-3"},Ib={class:"flex items-center gap-2"},$b={class:"text-xs font-semibold text-ink"},Db={class:"mt-1.5 block font-mono text-[10.5px] text-ink-muted"},Nb={class:"flex items-center gap-2.5 px-2 py-1"},Rb={class:"grid h-8 w-8 place-items-center rounded-full bg-[var(--navy-800)] text-xs font-bold text-white"},Fb={class:"min-w-0 flex-1"},Bb={class:"truncate text-[13px] font-semibold text-ink"},Vb={class:"flex items-center gap-1.5 text-[11px] text-ink-muted"},Zb=["title"],Ub={class:"overflow-y-auto"},Hb={class:"sticky top-0 z-10 flex items-center gap-4 border-b border-line px-7 py-3.5",style:{background:"color-mix(in srgb, var(--bg-app) 82%, transparent)","backdrop-filter":"blur(10px)"}},jb={class:"mt-0.5 text-[22px] font-bold tracking-tightest text-ink"},Wb={class:"ml-auto flex items-center gap-3"},Kb={class:"flex h-10 w-60 items-center gap-2 rounded border border-line-strong bg-surface-1 px-3 max-[1100px]:hidden"},Gb={key:0,class:"mx-auto flex max-w-[1240px] flex-col gap-5 p-7"},qb={class:"grid grid-cols-4 gap-4 max-[1100px]:grid-cols-2 max-[560px]:grid-cols-1"},Yb={class:"flex items-center justify-between"},Jb={class:"eyebrow"},Xb={class:"mt-2.5 text-[34px] font-bold leading-none tracking-tightest text-ink"},Qb={class:"grid grid-cols-[1.6fr_1fr] gap-5 max-[1100px]:grid-cols-1"},tx={class:"panel p-5"},ex={class:"mb-3.5 flex items-center justify-between"},nx={class:"panel p-5"},ix={class:"mb-3.5 flex items-center justify-between"},sx={class:"grid place-items-center py-10 text-center"},ox={class:"panel overflow-hidden p-0"},rx={class:"flex items-center justify-between px-5 py-4"},ax={class:"flex gap-2"},lx={key:0,class:"px-5 py-12 text-center text-sm text-ink-muted"},ux={key:1,class:"overflow-x-auto"},cx={class:"w-full border-collapse text-sm"},dx={class:"text-left"},fx=["onClick"],hx={class:"px-5 py-3 font-mono font-bold text-ink"},px={class:"px-5 py-3 text-ink-secondary"},mx={class:"px-5 py-3"},gx={class:"px-5 py-3 font-mono text-ink-secondary"},_x={class:"px-5 py-3"},vx={key:0,class:"flex items-center gap-2"},yx={class:"h-1.5 w-12 overflow-hidden rounded bg-surface-2"},bx={class:"font-mono text-xs text-ink-secondary"},xx={key:1,class:"font-mono text-xs text-ink-muted"},wx={class:"px-5 py-3 font-mono text-ink-secondary"},kx={class:"px-5 py-3 text-right"},Sx=["onClick"],Px={key:1,class:"p-7"},Tx={class:"mb-4 flex flex-wrap items-center gap-3"},Lx={class:"font-mono text-mode font-bold text-ink"},Cx={key:0,class:"rounded-full bg-danger-soft px-2.5 py-0.5 font-mono text-[10px] font-bold uppercase tracking-caps text-danger-fg"},Mx={key:1,class:"ml-auto flex flex-wrap gap-1.5"},Ox=["onClick"],Ex={key:0,class:"panel grid place-items-center p-16 text-center"},zx={class:"pill"},Ax={class:"pill"},Ix={class:"pill"},$x={class:"mt-1 text-sm font-semibold text-ink"},Dx={class:"pill"},Nx={class:"mt-1 font-mono text-sm font-bold tabular text-ink"},Rx={class:"grid grid-cols-2 gap-4 max-[820px]:grid-cols-1"},Fx={class:"panel p-4"},Bx={class:"flex items-center gap-4"},Vx={class:"h-9 flex-1 overflow-hidden rounded border border-line bg-surface-2"},Zx={class:"readout"},Ux={class:"panel p-4"},Hx={class:"readout"},jx={class:"panel p-4"},Wx={class:"space-y-1.5 text-sm"},Kx={class:"flex justify-between"},Gx={class:"text-ink"},qx={class:"flex justify-between"},Yx={class:"text-ink"},Jx={class:"flex justify-between"},Xx={class:"font-mono tabular text-ink"},Qx={class:"flex justify-between"},t0={class:"font-mono tabular text-ink"},e0={class:"panel p-4"},n0={class:"space-y-1.5 text-sm"},i0={class:"flex justify-between"},s0={class:"font-mono tabular text-ink"},o0={class:"flex justify-between"},r0={class:"font-mono tabular text-ink"},a0={class:"flex justify-between"},l0={class:"font-mono tabular text-ink"},u0={class:"panel col-span-2 p-4 max-[820px]:col-span-1"},c0={class:"panel p-4"},d0={class:"flex flex-wrap gap-2"},f0={class:"mt-2 min-h-[16px] text-xs text-ink-muted"},h0={class:"panel p-4"},p0={class:"h-[180px] overflow-y-auto font-mono text-xs"},m0={class:"text-ink-muted"},g0={class:"font-semibold text-accent"},_0={class:"break-all text-ink"},v0={key:4,class:"p-7"},y0={class:"panel grid place-items-center p-16 text-center"},b0={class:"mt-3 text-sm font-medium text-ink-secondary"},x0={key:0,class:"mt-1 text-xs text-ink-muted"},w0={key:1,class:"mt-1 text-xs text-ink-muted"},k0={__name:"Dashboard",props:{email:{type:String,default:""},role:{type:String,default:"user"},organization:{type:String,default:""},organizationName:{type:String,default:""}},emits:["logout"],setup(e,{emit:i}){const o=e,a=i,l=xe({}),d=xe({}),h=G(null),_=G(!1),y=xe([]),T=G(""),w=G("Overview"),A=[["grid","Overview"],["radio","Live flights"],["route","Routes"],["calendar","Schedule"],["book","Logbook"],["fileText","Documents"],["server","Drives"],["settings","Settings"]],U=xt(()=>(A.find(([,v])=>v===w.value)||["grid"])[0]),V=G(""),rt=G(""),Q=G("");let Ot=null,Mt=null,q=!1;const dt=xt(()=>Object.keys(l).sort((v,m)=>(l[m].online?1:0)-(l[v].online?1:0)||v.localeCompare(m))),it=xt(()=>h.value?l[h.value]:null),ht=xt(()=>it.value&&it.value.telemetry||{}),Kt=xt(()=>!!(it.value&&it.value.online)),he=xt(()=>{const v=ht.value;return typeof v.latitude=="number"&&typeof v.longitude=="number"&&(v.latitude||v.longitude)?{lat:v.latitude,lng:v.longitude}:null}),pe=xt(()=>h.value&&d[h.value]||[]),St=xt(()=>{const v=ht.value;return typeof v.velocityX=="number"&&typeof v.velocityY=="number"?Math.hypot(v.velocityX,v.velocityY):null});function Nt(v){return v.online?v.connected?["In flight","success"]:["Standby","accent"]:["Offline","neutral"]}function Et(v){const m=v&&v.telemetry||{};return typeof m.velocityX=="number"&&typeof m.velocityY=="number"?Math.hypot(m.velocityX,m.velocityY):null}const nt=xt(()=>dt.value.map(v=>{const m=l[v],M=m.telemetry||{},[F,R]=Nt(m);return{id:v,mission:m.model||(m.connected?"Drone linked":m.online?"App online":"No signal"),status:F,tone:R,alt:typeof M.altitude=="number"?M.altitude.toFixed(0)+" m":"—",battery:typeof M.batteryPercent=="number"?M.batteryPercent:null,speed:Et(m)}})),ut=xt(()=>dt.value.filter(v=>l[v].online).length),zt=xt(()=>dt.value.filter(v=>l[v].online&&l[v].connected).length),Ft=xt(()=>dt.value.filter(v=>!l[v].online).length),lt=xt(()=>{const v=dt.value.map(m=>{var M;return(M=l[m].telemetry)==null?void 0:M.batteryPercent}).filter(m=>typeof m=="number");return v.length?Math.round(v.reduce((m,M)=>m+M,0)/v.length):null}),At=xt(()=>[{label:"Active flights",value:String(zt.value),delta:`${ut.value} online`,tone:"success",icon:"radio"},{label:"Avg battery",value:lt.value==null?"—":lt.value+"%",delta:lt.value==null?"no telemetry":lt.value<40?"low — watch":"nominal",tone:lt.value!=null&<.value<40?"danger":"neutral",icon:"battery"},{label:"Fleet size",value:String(dt.value.length),delta:`${zt.value} in flight`,tone:"neutral",icon:"grid"},{label:"Offline",value:String(Ft.value),delta:Ft.value?"needs attention":"all reachable",tone:Ft.value?"warning":"success",icon:"signal"}]),et={success:"bg-success-soft text-success-fg",warning:"bg-amber-soft text-amber-fg",danger:"bg-danger-soft text-danger-fg",accent:"bg-accent-soft text-accent-soft-fg",neutral:"bg-surface-2 text-ink-secondary"},ce={success:"text-success-fg",danger:"text-danger-fg",warning:"text-amber-fg",neutral:"text-ink-muted",accent:"text-accent-soft-fg"},pt=xt(()=>{var M,F,R;const m=(o.email||"PV").split("@")[0].split(/[.\-_ ]+/).filter(Boolean);return((((M=m[0])==null?void 0:M[0])||"P")+(((F=m[1])==null?void 0:F[0])||((R=m[0])==null?void 0:R[1])||"V")).toUpperCase()}),kt={superadmin:"Superadmin",admin:"Admin",user:"Operator"},Yt=xt(()=>kt[o.role]||"Operator"),ae=xt(()=>o.organizationName||(o.role==="superadmin"?"All organizations":"No organization"));function Jt(v){var M;l[v.deviceId]=v;const m=v.telemetry||{};typeof m.latitude=="number"&&typeof m.longitude=="number"&&(m.latitude||m.longitude)&&(d[v.deviceId]||(d[v.deviceId]=[]),d[v.deviceId].push([m.latitude,m.longitude]),d[v.deviceId].length>1e3&&d[v.deviceId].shift()),(!h.value||v.online&&!((M=l[h.value])!=null&&M.online))&&(h.value=v.deviceId)}function Bt(v){delete l[v],delete d[v],h.value===v&&(h.value=dt.value[0]||null)}function j(v){y.unshift({t:ql(Date.now()),tag:v.type||"?",text:JSON.stringify(C(v))}),y.length>200&&y.pop()}function C(v){const m={...v};return delete m.type,m}function E(){const v=location.protocol==="https:"?"wss":"ws";Ot=new WebSocket(`${v}://${location.host}/bff/ws`),Ot.onopen=()=>_.value=!0,Ot.onclose=()=>{_.value=!1,q||(Mt=setTimeout(E,1500))},Ot.onerror=()=>Ot&&Ot.close(),Ot.onmessage=m=>{let M;try{M=JSON.parse(m.data)}catch{return}M.type==="snapshot"?(M.devices||[]).forEach(Jt):M.type==="update"&&M.device?(Jt(M.device),M.event&&M.device.deviceId===h.value&&j(M.event)):M.type==="removed"&&M.deviceId&&Bt(M.deviceId)}}async function _e(){if(!h.value)return Q.value="No device selected.";if(!V.value.trim())return Q.value="Enter a command name.";let v;if(rt.value.trim())try{v=JSON.parse(rt.value)}catch{return Q.value="Payload is not valid JSON."}const{ok:m,body:M}=await fp(h.value,V.value.trim(),v);Q.value=m?`Sent "${V.value.trim()}".`:`Error: ${M.error||"failed"}`}function se(v,m,M=""){return typeof v=="number"?v.toFixed(m)+M:"—"}function Ge(v){h.value=v,w.value="Live flights"}return Yi(async()=>{(await Rh()).forEach(Jt),E()}),vr(()=>{q=!0,Mt&&clearTimeout(Mt),Ot&&Ot.close()}),(v,m)=>{var M,F,R,B,J;return g(),x("div",Lb,[u("aside",Cb,[u("div",Mb,[O(Cc,{size:26}),m[7]||(m[7]=u("span",{class:"text-[19px] tracking-tightest"},[u("span",{class:"font-medium text-ink-secondary"},"Pilot"),u("span",{class:"font-bold text-ink"},"Vault")],-1))]),u("nav",Ob,[(g(),x(ct,null,Wt(A,([D,K])=>u("button",{key:K,class:Ct(["flex items-center gap-3 rounded px-3 py-2.5 text-left text-sm transition",w.value===K?"bg-accent-soft font-semibold text-accent-soft-fg":"font-medium text-ink-secondary hover:bg-surface-2"]),onClick:Z=>w.value=K},[O(Y,{name:D,size:18,stroke:w.value===K?2.2:1.8},null,8,["name","stroke"]),$(" "+P(K),1)],10,Eb)),64))]),u("div",zb,[u("div",Ab,[u("div",Ib,[u("span",{class:Ct(["h-2 w-2 rounded-full",_.value?"bg-ready":"bg-caution"])},null,2),u("span",$b,P(_.value?"Link healthy":"Reconnecting…"),1)]),u("span",Db,"API gateway · "+P(_.value?"streaming":"retrying"),1)]),u("div",Nb,[u("div",Rb,P(pt.value),1),u("div",Fb,[u("div",Bb,P(e.email||"Operator"),1),u("div",Vb,[O(Y,{name:"grid",size:11,class:"shrink-0"}),u("span",{class:"truncate",title:`${Yt.value} · ${ae.value}`},P(Yt.value)+" · "+P(ae.value),9,Zb)])]),u("button",{class:"text-ink-muted transition hover:text-ink",title:"Log out","aria-label":"Log out",onClick:m[0]||(m[0]=D=>a("logout"))},[O(Y,{name:"logout",size:16})])])])]),u("main",Ub,[u("header",Hb,[u("div",null,[m[8]||(m[8]=u("div",{class:"eyebrow"},"Live operations",-1)),u("h1",jb,P(w.value),1)]),u("div",Wb,[u("div",Kb,[O(Y,{name:"search",size:16,class:"text-ink-muted"}),ot(u("input",{"onUpdate:modelValue":m[1]||(m[1]=D=>T.value=D),placeholder:"Search drones, routes…",class:"w-full border-none bg-transparent text-sm text-ink outline-none placeholder:text-ink-muted"},null,512),[[vt,T.value]])]),u("button",{class:"btn-accent flex items-center gap-2",onClick:m[2]||(m[2]=D=>w.value="Live flights")},[O(Y,{name:"radio",size:16}),m[9]||(m[9]=$(" Live flights ",-1))])])]),w.value==="Overview"?(g(),x("div",Gb,[u("div",qb,[(g(!0),x(ct,null,Wt(At.value,D=>(g(),x("div",{key:D.label,class:"panel p-5"},[u("div",Yb,[u("span",Jb,P(D.label),1),O(Y,{name:D.icon,size:16,class:"text-ink-muted"},null,8,["name"])]),u("div",Xb,P(D.value),1),u("span",{class:Ct(["mt-2 block font-mono text-[11px]",ce[D.tone]])},P(D.delta),3)]))),128))]),u("div",Qb,[u("div",tx,[u("div",ex,[m[11]||(m[11]=u("div",null,[u("div",{class:"eyebrow"},"Airspace"),u("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Live map")],-1)),zt.value?(g(),x("span",{key:0,class:Ct(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",et.success])},[m[10]||(m[10]=u("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),$(P(zt.value)+" airborne ",1)],2)):N("",!0)]),O(Ql,{position:he.value,trail:pe.value},null,8,["position","trail"])]),u("div",nx,[u("div",ix,[m[12]||(m[12]=u("div",null,[u("div",{class:"eyebrow"},"Today"),u("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Schedule")],-1)),O(Y,{name:"clock",size:16,class:"text-ink-muted"})]),u("div",sx,[O(Y,{name:"calendar",size:24,class:"text-ink-muted"}),m[13]||(m[13]=u("div",{class:"mt-2 text-sm font-medium text-ink-secondary"},"No missions scheduled",-1)),m[14]||(m[14]=u("div",{class:"mt-0.5 text-xs text-ink-muted"},"Scheduling is not wired to a backend yet.",-1))])])]),u("div",ox,[u("div",rx,[m[17]||(m[17]=u("div",null,[u("div",{class:"eyebrow"},"Fleet"),u("div",{class:"mt-0.5 text-base font-semibold text-ink"},"Aircraft status")],-1)),u("div",ax,[u("span",{class:Ct(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",et.success])},[m[15]||(m[15]=u("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),$(P(zt.value)+" in flight ",1)],2),Ft.value?(g(),x("span",{key:0,class:Ct(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",et.warning])},[m[16]||(m[16]=u("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),$(P(Ft.value)+" offline ",1)],2)):N("",!0)])]),nt.value.length?(g(),x("div",ux,[u("table",cx,[u("thead",null,[u("tr",dx,[(g(),x(ct,null,Wt(["Aircraft","Mission","Status","Alt","Battery","Speed",""],D=>u("th",{key:D,class:"border-y border-line bg-surface-2 px-5 py-2.5 font-mono text-[10.5px] font-normal uppercase tracking-caps text-ink-muted"},P(D),1)),64))])]),u("tbody",null,[(g(!0),x(ct,null,Wt(nt.value,(D,K)=>(g(),x("tr",{key:D.id,class:Ct(["cursor-pointer transition hover:bg-surface-2",KGe(D.id)},[u("td",hx,P(D.id),1),u("td",px,P(D.mission),1),u("td",mx,[u("span",{class:Ct(["inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-[11px] font-semibold",et[D.tone]])},[m[18]||(m[18]=u("span",{class:"h-1.5 w-1.5 rounded-full bg-current"},null,-1)),$(P(D.status),1)],2)]),u("td",gx,P(D.alt),1),u("td",_x,[D.battery!=null?(g(),x("div",vx,[u("div",yx,[u("div",{class:Ct(["h-full",D.battery<40?"bg-caution":"bg-ready"]),style:Ss({width:D.battery+"%"})},null,6)]),u("span",bx,P(D.battery)+"%",1)])):(g(),x("span",xx,"—"))]),u("td",wx,[$(P(D.speed==null?"—":D.speed.toFixed(1))+" ",1),m[19]||(m[19]=u("span",{class:"text-ink-muted"},"m/s",-1))]),u("td",kx,[u("button",{class:"btn-ghost inline-flex items-center gap-1.5 whitespace-nowrap",onClick:yc(Z=>Ge(D.id),["stop"])},[O(Y,{name:"play",size:14}),m[20]||(m[20]=$(" Track ",-1))],8,Sx)])],10,fx))),128))])])])):(g(),x("div",lx," No aircraft connected yet. Devices appear here as they come online. "))])])):w.value==="Live flights"?(g(),x("div",Px,[u("div",Tx,[u("span",Lx,P(h.value||"No device selected"),1),it.value&&!Kt.value?(g(),x("span",Cx,"Offline")):N("",!0),dt.value.length?(g(),x("div",Mx,[(g(!0),x(ct,null,Wt(dt.value,D=>(g(),x("button",{key:D,class:Ct(["flex items-center gap-2 rounded border px-3 py-1.5 font-mono text-xs font-bold transition",D===h.value?"border-accent bg-accent-soft text-accent-soft-fg":"border-line bg-surface-1 text-ink-secondary hover:border-line-strong"]),onClick:K=>h.value=D},[u("span",{class:Ct(["h-2 w-2 rounded-full",l[D].online?"bg-ready":"bg-ink-muted"])},null,2),$(" "+P(D),1)],10,Ox))),128))])):N("",!0)]),dt.value.length?(g(),x(ct,{key:1},[u("div",{class:Ct(["mb-4 grid gap-3",!Kt.value&&it.value?"opacity-60":""]),style:{"grid-template-columns":"repeat(auto-fit, minmax(150px, 1fr))"}},[u("div",zx,[m[23]||(m[23]=u("div",{class:"eyebrow"},"Registration",-1)),u("div",{class:Ct(["mt-1 text-sm font-semibold",Kt.value?((M=it.value)==null?void 0:M.registration)==="success"?"text-success-fg":"text-danger-fg":"text-ink"])},P(Kt.value&&((F=it.value)!=null&&F.registration)?it.value.registration:"—"),3)]),u("div",Ax,[m[24]||(m[24]=u("div",{class:"eyebrow"},"Drone link",-1)),u("div",{class:Ct(["mt-1 text-sm font-semibold",Kt.value?(R=it.value)!=null&&R.connected?"text-success-fg":"text-danger-fg":"text-ink"])},P(it.value?Kt.value?it.value.connected?"connected":"no drone":"app offline":"—"),3)]),u("div",Ix,[m[25]||(m[25]=u("div",{class:"eyebrow"},"Model",-1)),u("div",$x,P(((B=it.value)==null?void 0:B.model)||"—"),1)]),u("div",Dx,[m[26]||(m[26]=u("div",{class:"eyebrow"},"Last update",-1)),u("div",Nx,P((J=it.value)!=null&&J.lastSeenMs?$t(ql)(it.value.lastSeenMs):"—"),1)])],2),u("div",Rx,[u("div",Fx,[m[28]||(m[28]=u("div",{class:"mb-3 eyebrow"},"Battery",-1)),u("div",Bx,[u("div",Vx,[u("div",{class:Ct(["h-full transition-all",typeof ht.value.batteryPercent=="number"?ht.value.batteryPercent<20?"bg-warning":ht.value.batteryPercent<40?"bg-caution":"bg-ready":""]),style:Ss({width:(typeof ht.value.batteryPercent=="number"?ht.value.batteryPercent:0)+"%"})},null,6)]),u("div",Zx,[$(P(typeof ht.value.batteryPercent=="number"?ht.value.batteryPercent:"—"),1),m[27]||(m[27]=u("span",{class:"text-sm text-ink-secondary"},"%",-1))])])]),u("div",Ux,[m[30]||(m[30]=u("div",{class:"mb-3 eyebrow"},"Altitude",-1)),u("div",Hx,[$(P(se(ht.value.altitude,1)),1),m[29]||(m[29]=u("span",{class:"text-sm text-ink-secondary"}," m",-1))])]),u("div",jx,[m[35]||(m[35]=u("div",{class:"mb-3 eyebrow"},"Flight",-1)),u("div",Wx,[u("div",Kx,[m[31]||(m[31]=u("span",{class:"text-ink-secondary"},"Mode",-1)),u("b",Gx,P(ht.value.flightMode||"—"),1)]),u("div",qx,[m[32]||(m[32]=u("span",{class:"text-ink-secondary"},"Flying",-1)),u("b",Yx,P(ht.value.isFlying==null?"—":ht.value.isFlying?"yes":"no"),1)]),u("div",Jx,[m[33]||(m[33]=u("span",{class:"text-ink-secondary"},"GPS sats",-1)),u("b",Xx,P(ht.value.satelliteCount==null?"—":ht.value.satelliteCount),1)]),u("div",Qx,[m[34]||(m[34]=u("span",{class:"text-ink-secondary"},"Speed (H)",-1)),u("b",t0,P(St.value==null?"—":se(St.value,2," m/s")),1)])])]),u("div",e0,[m[39]||(m[39]=u("div",{class:"mb-3 eyebrow"},"Position",-1)),u("div",n0,[u("div",i0,[m[36]||(m[36]=u("span",{class:"text-ink-secondary"},"Latitude",-1)),u("b",s0,P(se(ht.value.latitude,6)),1)]),u("div",o0,[m[37]||(m[37]=u("span",{class:"text-ink-secondary"},"Longitude",-1)),u("b",r0,P(se(ht.value.longitude,6)),1)]),u("div",a0,[m[38]||(m[38]=u("span",{class:"text-ink-secondary"},"Vert. speed",-1)),u("b",l0,P(se(typeof ht.value.velocityZ=="number"?-ht.value.velocityZ:void 0,2," m/s")),1)])])]),u("div",u0,[m[40]||(m[40]=u("div",{class:"mb-3 eyebrow"},"Track",-1)),O(Ql,{position:he.value,trail:pe.value},null,8,["position","trail"])]),u("div",c0,[m[41]||(m[41]=u("div",{class:"mb-3 eyebrow"},"Send command",-1)),u("div",d0,[ot(u("input",{"onUpdate:modelValue":m[3]||(m[3]=D=>V.value=D),class:"field flex-1",placeholder:"command (e.g. startConnection)"},null,512),[[vt,V.value]]),ot(u("input",{"onUpdate:modelValue":m[4]||(m[4]=D=>rt.value=D),class:"field flex-1",placeholder:"payload JSON (optional)"},null,512),[[vt,rt.value]]),u("button",{class:"btn-accent",onClick:_e},"Send")]),u("div",f0,P(Q.value),1)]),u("div",h0,[m[42]||(m[42]=u("div",{class:"mb-3 eyebrow"},"Event log",-1)),u("div",p0,[(g(!0),x(ct,null,Wt(y,(D,K)=>(g(),x("div",{key:K,class:"border-b border-line py-1"},[u("span",m0,P(D.t),1),u("span",g0,P(D.tag),1),u("span",_0,P(D.text),1)]))),128))])])])],64)):(g(),x("div",Ex,[O(Y,{name:"radio",size:28,class:"text-ink-muted"}),m[21]||(m[21]=u("div",{class:"mt-3 text-sm font-medium text-ink-secondary"},"No aircraft online",-1)),m[22]||(m[22]=u("div",{class:"mt-1 text-xs text-ink-muted"},"Live telemetry appears here once a drone connects.",-1))]))])):w.value==="Logbook"?(g(),ie(Tb,{key:2,email:e.email,role:e.role,organization:e.organization,"organization-name":e.organizationName},null,8,["email","role","organization","organization-name"])):w.value==="Settings"?(g(),ie(My,{key:3,email:e.email,role:e.role,organization:e.organization,"organization-name":e.organizationName,onLogout:m[5]||(m[5]=D=>a("logout"))},null,8,["email","role","organization","organization-name"])):(g(),x("div",v0,[u("div",y0,[O(Y,{name:U.value,size:28,class:"text-ink-muted"},null,8,["name"]),u("div",b0,P(w.value),1),w.value==="Drives"?(g(),x("div",x0,[m[43]||(m[43]=$(" Browse and transfer files here once a drive is connected. Configure drives in ",-1)),u("button",{class:"font-semibold text-accent hover:underline",onClick:m[6]||(m[6]=D=>w.value="Settings")},"Settings → Integrations"),m[44]||(m[44]=$(". ",-1))])):(g(),x("div",w0,"This section is part of the console shell and has no backend yet."))])]))])])}}},S0={key:0,class:"h-full"},P0={key:1,class:"grid h-full place-items-center text-ink-muted text-sm"},T0={__name:"App",setup(e){const i=G(!1),o=G(null),a=G("user"),l=G(""),d=G(""),h=G("");function _(w){a.value=w&&w.role||"user",l.value=w&&w.organization||"",d.value=w&&w.organizationName||""}Yi(async()=>{h.value=(await $h()).apiBase||"";const w=await jl();w&&(o.value=w.email,_(w),await Jl()),i.value=!0});async function y(w){o.value=w,_(await jl()),await Jl()}async function T(){_p(),await Nh(),o.value=null,a.value="user",l.value="",d.value=""}return(w,A)=>i.value?(g(),x("div",S0,[o.value?(g(),ie(k0,{key:0,email:o.value,role:a.value,organization:l.value,"organization-name":d.value,onLogout:T},null,8,["email","role","organization","organization-name"])):(g(),ie(Ip,{key:1,"default-api-base":h.value,onSignedIn:y},null,8,["default-api-base"]))])):(g(),x("div",P0,"Loading…"))}};Eh(T0).mount("#app");
diff --git a/Web App/server/dist/index.html b/Web App/server/dist/index.html
index 6f0d199..3b8e629 100644
--- a/Web App/server/dist/index.html
+++ b/Web App/server/dist/index.html
@@ -35,8 +35,8 @@
})()
PilotVault — Control Panel
-
-
+
+
diff --git a/Web App/server/main.go b/Web App/server/main.go
index a0ef395..5129e18 100644
--- a/Web App/server/main.go
+++ b/Web App/server/main.go
@@ -72,6 +72,16 @@ func main() {
mux.HandleFunc("POST /bff/orgs", app.requireAuth(app.handleCreateOrg))
mux.HandleFunc("PATCH /bff/orgs/{id}", app.requireAuth(app.handleUpdateOrg))
mux.HandleFunc("DELETE /bff/orgs/{id}", app.requireAuth(app.handleDeleteOrg))
+ // Logbook — drones, flights, and the compliance CSV export (scoping upstream)
+ mux.HandleFunc("GET /bff/drones", app.requireAuth(app.handleListDrones))
+ mux.HandleFunc("POST /bff/drones", app.requireAuth(app.handleCreateDrone))
+ mux.HandleFunc("PATCH /bff/drones/{id}", app.requireAuth(app.handleUpdateDrone))
+ mux.HandleFunc("DELETE /bff/drones/{id}", app.requireAuth(app.handleDeleteDrone))
+ mux.HandleFunc("GET /bff/flights", app.requireAuth(app.handleListFlights))
+ mux.HandleFunc("POST /bff/flights", app.requireAuth(app.handleCreateFlight))
+ mux.HandleFunc("PATCH /bff/flights/{id}", app.requireAuth(app.handleUpdateFlight))
+ mux.HandleFunc("DELETE /bff/flights/{id}", app.requireAuth(app.handleDeleteFlight))
+ mux.HandleFunc("GET /bff/logbook/export", app.requireAuth(app.handleExportLogbook))
mux.HandleFunc("GET /bff/ws", app.handleWS)
mux.HandleFunc("GET /healthz", func(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, map[string]any{"status": "ok", "api": app.apiBase})
diff --git a/Web App/web/src/api.js b/Web App/web/src/api.js
index f63a067..486046c 100644
--- a/Web App/web/src/api.js
+++ b/Web App/web/src/api.js
@@ -253,6 +253,83 @@ export async function testWebDav() {
return { ok: r.ok, status: r.status, body: await r.json().catch(() => ({})) }
}
+/* ---------- Logbook: drones ---------- */
+
+export async function getDrones() {
+ try {
+ const r = await fetch('/bff/drones')
+ if (!r.ok) return { ok: false, status: r.status, drones: [] }
+ const d = await r.json()
+ return { ok: true, status: 200, drones: d.drones || [] }
+ } catch {
+ return { ok: false, status: 0, drones: [] }
+ }
+}
+
+export async function createDrone(drone) {
+ const r = await fetch('/bff/drones', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(drone),
+ })
+ return { ok: r.ok, status: r.status, body: await r.json().catch(() => ({})) }
+}
+
+export async function updateDrone(id, drone) {
+ const r = await fetch(`/bff/drones/${encodeURIComponent(id)}`, {
+ method: 'PATCH',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(drone),
+ })
+ return { ok: r.ok, status: r.status, body: await r.json().catch(() => ({})) }
+}
+
+export async function deleteDrone(id) {
+ const r = await fetch(`/bff/drones/${encodeURIComponent(id)}`, { method: 'DELETE' })
+ return { ok: r.ok, status: r.status, body: await r.json().catch(() => ({})) }
+}
+
+/* ---------- Logbook: flights ---------- */
+
+export async function getFlights() {
+ try {
+ const r = await fetch('/bff/flights')
+ if (!r.ok) return { ok: false, status: r.status, flights: [] }
+ const d = await r.json()
+ return { ok: true, status: 200, flights: d.flights || [] }
+ } catch {
+ return { ok: false, status: 0, flights: [] }
+ }
+}
+
+export async function createFlight(flight) {
+ const r = await fetch('/bff/flights', {
+ method: 'POST',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(flight),
+ })
+ return { ok: r.ok, status: r.status, body: await r.json().catch(() => ({})) }
+}
+
+export async function updateFlight(id, flight) {
+ const r = await fetch(`/bff/flights/${encodeURIComponent(id)}`, {
+ method: 'PATCH',
+ headers: { 'Content-Type': 'application/json' },
+ body: JSON.stringify(flight),
+ })
+ return { ok: r.ok, status: r.status, body: await r.json().catch(() => ({})) }
+}
+
+export async function deleteFlight(id) {
+ const r = await fetch(`/bff/flights/${encodeURIComponent(id)}`, { method: 'DELETE' })
+ return { ok: r.ok, status: r.status, body: await r.json().catch(() => ({})) }
+}
+
+// Trigger a browser download of the compliance CSV export.
+export function exportLogbookUrl() {
+ return '/bff/logbook/export'
+}
+
export async function sendCommand(id, command, payload) {
const r = await fetch(`/bff/devices/${encodeURIComponent(id)}/command`, {
method: 'POST',
diff --git a/Web App/web/src/components/Dashboard.vue b/Web App/web/src/components/Dashboard.vue
index 9faf718..a551da9 100644
--- a/Web App/web/src/components/Dashboard.vue
+++ b/Web App/web/src/components/Dashboard.vue
@@ -4,6 +4,7 @@ import DeviceMap from './DeviceMap.vue'
import BrandMark from './BrandMark.vue'
import Icon from './Icon.vue'
import Settings from './Settings.vue'
+import Logbook from './Logbook.vue'
import { getDevices, sendCommand } from '../api.js'
import { formatTime } from '../prefs.js'
@@ -627,6 +628,9 @@ onBeforeUnmount(() => {
+
+
+
diff --git a/Web App/web/src/components/Logbook.vue b/Web App/web/src/components/Logbook.vue
new file mode 100644
index 0000000..212ad60
--- /dev/null
+++ b/Web App/web/src/components/Logbook.vue
@@ -0,0 +1,551 @@
+
+
+
+
+
+
+
+
+
+
+
{{ s.label }}
+
+ {{ s.value }}
+
+
+
+
+
{{ loadErr }}
+
+
+
+
+
+
+
+
+
Loading…
+
+
+
No flights logged yet
+
Log your first operation to start the 5-year retention record.
+
+
+
+
+
+ |
+ {{ h }}
+ |
+
+
+
+
+
+ |
+ {{ (f.operationDate || '').slice(0, 10) }}
+ {{ f.startTime }}
+ |
+ {{ f.droneName || '—' }} |
+ {{ f.areaRoute || '—' }} |
+ {{ f.maxAltitudeAgl ? f.maxAltitudeAgl + ' m' : '—' }} |
+ {{ f.pilotName || '—' }} |
+
+
+ |
+
+
+ Delete?
+
+
+
+
+
+
+
+ |
+
+
+ |
+
+ Logging path: {{ f.compliance?.loggingPath || '—' }}
+ Category: {{ f.category || '—' }}
+ Retain until: {{ (f.retentionUntil || '').slice(0, 10) || '—' }}
+ Exempt: {{ f.compliance.exemptReason }}
+
+
+ No compliance gaps detected.
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Loading…
+
+
+
No drones registered
+
Register the airframes you fly to log flights against them.
+
+
+
+
+
+ |
+ {{ h }}
+ |
+
+
+
+
+ | {{ d.name }} |
+ {{ d.model || '—' }} |
+ {{ d.mtomGrams ? d.mtomGrams + ' g' : '—' }} |
+
+ {{ d.cClass }}
+ —
+ toy
+ |
+
+ {{ d.autologsFlights ? 'yes' : 'no' }}
+ |
+
+
+ Delete?
+
+
+
+
+
+
+
+ |
+
+
+
+
+
+
+
+