@buoy-gg/env 7.0.45 → 7.0.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.createEnvSyncAdapter=createEnvSyncAdapter;exports.setToolRequiredEnvVars=setToolRequiredEnvVars;var _remoteEnv=require("../env/utils/remoteEnv");function collectEnv(){const e={};for(const[n,t]of Object.entries((0,_remoteEnv.getRemoteEnv)()??(typeof process==="undefined"?{}:process.env))){if(typeof t==="string"){e[n]=t}}return e}let toolRequiredEnvVars=[];function setToolRequiredEnvVars(e){toolRequiredEnvVars=e}function createEnvSyncAdapter(e=[]){return{version:1,getSnapshot:()=>({env:collectEnv(),requiredEnvVars:e.length>0?e:toolRequiredEnvVars}),subscribe:()=>()=>{}}}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:true});exports.createEnvSyncAdapter=createEnvSyncAdapter;exports.setToolRequiredEnvVars=setToolRequiredEnvVars;var _remoteEnv=require("../env/utils/remoteEnv");var _utils=require("../env/utils/utils");function collectEnv(){const e={};for(const[r,t]of Object.entries((0,_remoteEnv.getRemoteEnv)()??(typeof process==="undefined"?{}:process.env))){if(typeof t==="string"){e[r]=t}}return e}let toolRequiredEnvVars=[];function setToolRequiredEnvVars(e){toolRequiredEnvVars=e}function createEnvSyncAdapter(e=[]){return{version:1,getSnapshot:()=>{const r=collectEnv();const t=e.length>0?e:toolRequiredEnvVars;let n=[];try{n=(0,_utils.processEnvVars)(r,t).requiredVars.map(s=>({key:s.key,status:s.status}))}catch{n=[]}return{env:r,requiredEnvVars:t,checks:n}},subscribe:()=>()=>{}}}
@@ -1 +1 @@
1
- "use strict";import{getRemoteEnv as r}from"../env/utils/remoteEnv";function s(){const e={};for(const[o,t]of Object.entries(r()??(typeof process==="undefined"?{}:process.env))){if(typeof t==="string"){e[o]=t}}return e}let n=[];export function setToolRequiredEnvVars(e){n=e}export function createEnvSyncAdapter(e=[]){return{version:1,getSnapshot:()=>({env:s(),requiredEnvVars:e.length>0?e:n}),subscribe:()=>()=>{}}}
1
+ "use strict";import{getRemoteEnv as c}from"../env/utils/remoteEnv";import{processEnvVars as i}from"../env/utils/utils";function u(){const e={};for(const[r,t]of Object.entries(c()??(typeof process==="undefined"?{}:process.env))){if(typeof t==="string"){e[r]=t}}return e}let s=[];export function setToolRequiredEnvVars(e){s=e}export function createEnvSyncAdapter(e=[]){return{version:1,getSnapshot:()=>{const r=u();const t=e.length>0?e:s;let n=[];try{n=i(r,t).requiredVars.map(o=>({key:o.key,status:o.status}))}catch{n=[]}return{env:r,requiredEnvVars:t,checks:n}},subscribe:()=>()=>{}}}
@@ -11,6 +11,10 @@ export declare function createEnvSyncAdapter(requiredEnvVars?: RequiredEnvVar[])
11
11
  getSnapshot: () => {
12
12
  env: Record<string, string>;
13
13
  requiredEnvVars: RequiredEnvVar[];
14
+ checks: {
15
+ key: string;
16
+ status: string;
17
+ }[];
14
18
  };
15
19
  subscribe: () => () => void;
16
20
  };
package/lib/web/index.mjs CHANGED
@@ -1 +1 @@
1
- "use client";var oe=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var ke=Object.prototype.hasOwnProperty;var Ie=(e,a)=>{for(var r in a)oe(e,r,{get:a[r],enumerable:true})},ie=(e,a,r,n)=>{if(a&&typeof a=="object"||typeof a=="function")for(let t of Ve(a))!ke.call(e,t)&&t!==r&&oe(e,t,{get:()=>a[t],enumerable:!(n=Te(a,t))||n.enumerable});return e},Ee=(e,a,r)=>(ie(e,a,"default"),r&&ie(r,a,"default"));typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{EnvIcon as Le}from"@buoy-gg/floating-tools-core/web";import{JsModal as Ae,devToolsStorageKeys as se,ModalHeader as M,HeaderSearchButton as qe,displayValue as De,buoyColors as j,night as K,windowDragProps as _e,ToolEmptyState as Re,resolveListEmptyState as Be,monoFont as le}from"@buoy-gg/shared-ui/web";import{useCallback as Me,useState as Y,useRef as je,useEffect as ce,useMemo as P}from"react";var de={};Ie(de,{AccessibilityInfo:()=>Fe,ActivityIndicator:()=>Mt,Alert:()=>Wt,Animated:()=>Oe,AppRegistry:()=>He,AppState:()=>$e,Appearance:()=>ze,BackHandler:()=>Ke,Button:()=>jt,CheckBox:()=>lt,Clipboard:()=>Ge,DeviceEventEmitter:()=>Tt,Dimensions:()=>Ue,Easing:()=>Je,FlatList:()=>ct,I18nManager:()=>Ye,Image:()=>dt,ImageBackground:()=>ut,InteractionManager:()=>Qe,Keyboard:()=>Xe,KeyboardAvoidingView:()=>pt,LayoutAnimation:()=>Ze,Linking:()=>et,LogBox:()=>St,Modal:()=>Rt,NativeEventEmitter:()=>tt,NativeModules:()=>Ne,PanResponder:()=>rt,Picker:()=>yt,PixelRatio:()=>at,Platform:()=>nt,Pressable:()=>_t,ProgressBar:()=>ht,RefreshControl:()=>bt,SafeAreaView:()=>gt,ScrollView:()=>ue,SectionList:()=>ft,Share:()=>ot,StatusBar:()=>mt,StyleSheet:()=>W,Switch:()=>Bt,Text:()=>y,TextInput:()=>At,Touchable:()=>vt,TouchableHighlight:()=>qt,TouchableNativeFeedback:()=>xt,TouchableOpacity:()=>G,TouchableWithoutFeedback:()=>Dt,UIManager:()=>it,Vibration:()=>st,View:()=>p,VirtualizedList:()=>Ct,YellowBox:()=>wt,findNodeHandle:()=>Pt,unstable_createElement:()=>We,useColorScheme:()=>Vt,useLocaleContext:()=>kt,useWindowDimensions:()=>It});Ee(de,Pe);import*as Pe from"react-native-web";import{unstable_createElement as We,NativeModules as Ne,AccessibilityInfo as Fe,Animated as Oe,Appearance as ze,AppRegistry as He,AppState as $e,BackHandler as Ke,Clipboard as Ge,Dimensions as Ue,Easing as Je,I18nManager as Ye,Keyboard as Xe,InteractionManager as Qe,LayoutAnimation as Ze,Linking as et,NativeEventEmitter as tt,PanResponder as rt,PixelRatio as at,Platform as nt,Share as ot,StyleSheet as W,UIManager as it,Vibration as st,CheckBox as lt,FlatList as ct,Image as dt,ImageBackground as ut,KeyboardAvoidingView as pt,Picker as yt,ProgressBar as ht,RefreshControl as bt,SafeAreaView as gt,SectionList as ft,StatusBar as mt,Touchable as vt,TouchableNativeFeedback as xt,VirtualizedList as Ct,YellowBox as wt,LogBox as St,DeviceEventEmitter as Tt,useColorScheme as Vt,useLocaleContext as kt,useWindowDimensions as It}from"react-native-web";import*as g from"react-native-web";import{createElement as Et,forwardRef as Lt}from"react";function x(e){let a=Lt((n,t)=>{let{accessibilityState:o,accessibilityValue:s,...i}=n;for(let d of["busy","checked","disabled","expanded","selected"])o?.[d]!==void 0&&i[`aria-${d}`]===void 0&&(i[`aria-${d}`]=o[d]);for(let[d,c]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))s?.[d]!==void 0&&i[`aria-${c}`]===void 0&&(i[`aria-${c}`]=s[d]);return Et(e,{...i,ref:t})}),r=e.State;return r&&Object.assign(a,{State:r}),a.displayName=e.displayName??e.name??"NativeWebView",a}var p=x(g.View),y=x(g.Text),At=x(g.TextInput),G=x(g.TouchableOpacity),qt=x(g.TouchableHighlight),Dt=x(g.TouchableWithoutFeedback),_t=x(g.Pressable),ue=x(g.ScrollView),Rt=x(g.Modal),Bt=x(g.Switch),Mt=x(g.ActivityIndicator),jt=x(g.Button),Pt=g.findNodeHandle,Wt={alert(e,a,r,n){if(typeof document>"u")return;let t=document.createElement("dialog");t.dataset.buoyRoot="",t.setAttribute("aria-label",e),t.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let o=document.createElement("h2");if(o.textContent=e,o.style.cssText="font-size:18px;margin:0 0 12px",t.appendChild(o),a){let c=document.createElement("p");c.textContent=a,c.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",t.appendChild(c)}let s=document.createElement("div");s.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let i=r?.length?r:[{text:"OK"}],d=()=>{t.close?.(),t.remove()};for(let c of i){let l=document.createElement("button");l.type="button",l.textContent=c.text??"OK",l.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${c.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,l.onclick=()=>{d(),c.onPress?.()},s.appendChild(l)}t.addEventListener("cancel",c=>{c.preventDefault(),n?.cancelable!==false&&(d(),n?.onDismiss?.())}),t.appendChild(s),document.body.appendChild(t),t.showModal?t.showModal():t.setAttribute("open","")}};import{CompactRow as Nt,night as T,monoFont as pe}from"@buoy-gg/shared-ui/web";import{jsx as V,jsxs as q}from"react/jsx-runtime";function Ft({stats:e,healthPercentage:a,healthStatus:r,healthColor:n,activeFilter:t="all",onFilterChange:o}){let s=e.wrongValueCount+e.wrongTypeCount;return q(p,{style:u.container,children:[V(Nt,{statusDotColor:n,statusLabel:"System",statusSublabel:r.toLowerCase(),primaryText:"Environment Configuration",secondaryText:`${a}% healthy`,testID:"buoy-env-health",statusSublabelTestID:"buoy-env-health-status",accessibilityLabel:`Environment configuration ${r.toLowerCase()}, ${a}% healthy`,customBadge:V(p,{style:[u.percentBadge,{borderColor:n+"40",backgroundColor:n+"10"}],children:q(y,{style:[u.percentText,{color:n}],testID:"buoy-env-health-percent",children:[a,"%"]})})}),q(p,{style:u.statsGrid,children:[q(G,{style:[u.statCard,t==="all"&&u.statCardActive],onPress:()=>o?.("all"),activeOpacity:.8,testID:"buoy-env-filter-all",accessibilityRole:"button",accessibilityLabel:"Show all variables",accessibilityState:{selected:t==="all"},children:[V(y,{style:[u.statValue,t==="all"&&u.statValueActive],testID:"buoy-env-filter-all-count",children:e.requiredCount+e.optionalCount}),V(y,{style:[u.statLabel,t==="all"&&u.statLabelActive],children:"ALL"})]}),q(G,{style:[u.statCard,t==="missing"&&u.statCardActive],onPress:()=>o?.("missing"),activeOpacity:.8,testID:"buoy-env-filter-missing",accessibilityRole:"button",accessibilityLabel:"Show missing variables",accessibilityState:{selected:t==="missing"},children:[V(y,{style:[u.statValue,t==="missing"&&u.statValueActive],testID:"buoy-env-filter-missing-count",children:e.missingCount}),V(y,{style:[u.statLabel,t==="missing"&&u.statLabelActive],children:"MISSING"})]}),q(G,{style:[u.statCard,t==="issues"&&u.statCardActive],onPress:()=>o?.("issues"),activeOpacity:.8,testID:"buoy-env-filter-issues",accessibilityRole:"button",accessibilityLabel:"Show variables with issues",accessibilityState:{selected:t==="issues"},children:[V(y,{style:[u.statValue,t==="issues"&&u.statValueActive],testID:"buoy-env-filter-issues-count",children:s}),V(y,{style:[u.statLabel,t==="issues"&&u.statLabelActive],children:"ISSUES"})]})]})]})}var u=W.create({container:{gap:8},statsGrid:{flexDirection:"row",gap:8,paddingHorizontal:4},statCard:{flex:1,backgroundColor:T.color.surface,borderRadius:10,borderWidth:1,borderColor:T.color.border,padding:12,alignItems:"center",justifyContent:"center",minHeight:64},statCardActive:{borderColor:T.color.accentBorderStrong,backgroundColor:T.color.accentSoft},statValue:{fontSize:22,fontWeight:"700",fontFamily:pe,lineHeight:26,color:T.color.text},statValueActive:{color:T.color.accent},statLabel:{fontSize:9,color:T.color.textTertiary,marginTop:4,textTransform:"uppercase",letterSpacing:.5,fontWeight:"600"},statLabelActive:{color:T.color.accent},percentBadge:{paddingHorizontal:8,paddingVertical:4,borderRadius:6,borderWidth:1},percentText:{fontSize:14,fontWeight:"700",fontFamily:pe}});import{useMemo as ye}from"react";var he=null;function Ot(e){he=e}function be(){return he}function zt({envFilter:e=()=>true}={}){let a=be()??(typeof process>"u"?{}:process.env),r=ye(()=>n=>{let t=a[n];if(t===void 0)return null;try{if(t.startsWith("{")||t.startsWith("["))return JSON.parse(t);if(t.toLowerCase()==="true")return true;if(t.toLowerCase()==="false")return false;if(/^\d+$/.test(t)){let o=parseInt(t,10);return isNaN(o)?t:o}if(/^\d*\.\d+$/.test(t)){let o=parseFloat(t);return isNaN(o)?t:o}return t}catch{return t}},[a]);return ye(()=>Object.keys(a).filter(n=>{let t=a[n];return e(n,t)}).map(n=>({key:n,data:r(n)})),[e,r,a])}function X(e){let a=typeof e;if(a==="boolean")return"boolean";if(a==="number")return"number";if(Array.isArray(e))return"array";if(a==="object"&&e!==null)return"object";if(a==="string"){let r=e;if(r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]"))try{let t=JSON.parse(r);return Array.isArray(t)?"array":"object"}catch{return"string"}let n=r.toLowerCase();return n==="true"||n==="false"||n==="enabled"||n==="disabled"||n==="yes"||n==="no"||n==="on"||n==="off"?"boolean":!isNaN(Number(r))&&r.trim()!==""?"number":r.startsWith("http://")||r.startsWith("https://")?"url":r.includes(",")?"array":"string"}return"unknown"}var Ht=class{constructor(e){this.key=e}exists(){return this.key}withValue(e){return this.expectedValue=e,delete this.expectedType,this}withType(e){return this.expectedType=e,delete this.expectedValue,this}withDescription(e){return this.description=e,this}build(){return this.expectedValue!==void 0?this.description?{key:this.key,expectedValue:this.expectedValue,description:this.description}:{key:this.key,expectedValue:this.expectedValue}:this.expectedType!==void 0?this.description?{key:this.key,expectedType:this.expectedType,description:this.description}:{key:this.key,expectedType:this.expectedType}:this.key}};function $t(e){return new Ht(e)}function Kt(e){return e}var ge=(e,a)=>{let r=[],n=[],t=new Set;return a?.forEach(o=>{let s=typeof o=="string"?o:o.key,i=typeof o=="object"&&"expectedValue"in o?o.expectedValue:void 0,d=typeof o=="object"&&"expectedType"in o?o.expectedType:void 0,c=typeof o=="object"&&"description"in o?o.description:void 0;t.add(s);let l=e[s],I=l!==void 0,w;if(!I)w="required_missing";else if(i){let E=false;i==="sk_*"?E=l.startsWith("sk_"):i==="production or development"?E=l==="production"||l==="development":E=l===i,w=E?"required_present":"required_wrong_value"}else d&&X(l).toLowerCase()!==d.toLowerCase()?w="required_wrong_type":w="required_present";r.push({key:s,value:l,expectedValue:i,expectedType:d,description:c,status:w,category:"required"})}),Object.entries(e).forEach(([o,s])=>{t.has(o)||n.push({key:o,value:s,status:"optional_present",category:"optional"})}),r.sort((o,s)=>{let i={required_missing:0,required_wrong_value:1,required_wrong_type:2,required_present:3,optional_present:4};return i[o.status]!==i[s.status]?i[o.status]-i[s.status]:o.key.localeCompare(s.key)}),n.sort((o,s)=>o.key.localeCompare(s.key)),{requiredVars:r,optionalVars:n}},fe=(e,a,r)=>{let n=Object.keys(r).length,t=e.length,o=e.filter(l=>l.status==="required_missing").length,s=e.filter(l=>l.status==="required_wrong_value").length,i=e.filter(l=>l.status==="required_wrong_type").length,d=e.filter(l=>l.status==="required_present").length,c=a.length;return{totalCount:n,requiredCount:t,missingCount:o,wrongValueCount:s,wrongTypeCount:i,presentRequiredCount:d,optionalCount:c}};import{useCallback as Gt,useState as Ut}from"react";import{CompactRow as Jt,TypeBadge as Q,buoyColors as D,night as Z,monoFont as ee}from"@buoy-gg/shared-ui/web";import{Fragment as Yt,jsx as C,jsxs as A}from"react/jsx-runtime";var Xt=(e,a)=>{switch(e){case"required_present":return{label:"Valid",color:D.success,sublabel:"Required"};case"required_missing":return{label:"Missing",color:D.error,sublabel:"Required"};case"required_wrong_value":return{label:"Wrong",color:D.warning,sublabel:"Invalid value"};case"required_wrong_type":return{label:"Type Error",color:D.info,sublabel:"Wrong type"};case"optional_present":return{label:"Set",color:D.textSecondary,sublabel:"Optional"}}};var Qt=e=>e==null?"undefined":typeof e=="string"?e:String(e);function Zt({envVar:e,isExpanded:a,onPress:r}){let n=Xt(e.status,e.expectedType),t=e.value!==void 0&&e.value!==null,o=e.key.split("_").map(d=>d.toLowerCase()).join(" \u203A "),s=`buoy-env-row-${e.key}`,i=A(p,{style:h.expandedContainer,children:[A(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Value:"}),C(y,{style:h.expandedValue,numberOfLines:3,testID:`${s}-value`,children:Qt(e.value)||"undefined"})]}),e.status==="required_wrong_type"&&e.expectedType&&A(Yt,{children:[A(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Type:"}),C(Q,{type:X(e.value),testID:`${s}-actual-type`})]}),A(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Expected:"}),C(Q,{type:e.expectedType,testID:`${s}-expected-type`})]})]}),e.status==="required_wrong_value"&&e.expectedValue&&A(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Expected:"}),C(y,{style:h.expandedExpected,testID:`${s}-expected-value`,children:String(e.expectedValue)})]}),e.description&&A(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Info:"}),C(y,{style:h.expandedDescription,testID:`${s}-description`,children:e.description})]})]});return C(Jt,{statusDotColor:n.color,statusLabel:n.label,statusSublabel:n.sublabel,primaryText:o,secondaryText:void 0,expandedContent:i,isExpanded:a,expandedGlowColor:n.color,customBadge:e.expectedType?C(Q,{type:e.expectedType,testID:`${s}-type-badge`}):void 0,showChevron:true,onPress:r?()=>r(e):void 0,testID:s,statusTestID:`${s}-status`,statusSublabelTestID:`${s}-category`,accessibilityLabel:`${e.key}, ${n.label}, ${n.sublabel}`})}var h=W.create({expandedContainer:{gap:6},expandedRow:{flexDirection:"row",alignItems:"center",gap:8},expandedLabel:{fontSize:10,color:Z.color.textTertiary,fontWeight:"600",minWidth:60,fontFamily:ee},expandedValue:{fontSize:11,color:Z.color.textSecondary,fontFamily:ee,flex:1},expandedExpected:{fontSize:11,color:D.warning,fontFamily:ee,flex:1},expandedDescription:{fontSize:11,color:Z.color.textSecondary,flex:1}});import{SectionHeader as _,night as N,monoFont as er}from"@buoy-gg/shared-ui/web";import{jsx as k,jsxs as U}from"react/jsx-runtime";function tr({title:e,count:a,vars:r,emptyMessage:n}){let[t,o]=Ut(null),s=Gt(i=>{o(d=>d===i.key?null:i.key)},[]);return r.length===0&&e==="Required Variables"?U(p,{style:F.sectionContainer,children:[U(_,{children:[k(_.Title,{children:e}),k(_.Badge,{count:0,color:N.color.accent})]}),k(p,{style:F.emptySection,children:k(y,{style:F.emptySectionText,children:n})})]}):r.length===0?null:U(p,{style:F.sectionContainer,children:[e!==""&&U(_,{children:[k(_.Title,{children:e}),k(_.Badge,{count:a,color:N.color.accent})]}),k(p,{style:F.sectionContent,children:r.map(i=>k(Zt,{envVar:i,isExpanded:t===i.key,onPress:s},i.key))})]})}var F=W.create({sectionContainer:{gap:8},sectionContent:{},emptySection:{padding:20,backgroundColor:N.color.accent+"08",borderRadius:8,borderWidth:1,borderColor:N.color.accent+"20",alignItems:"center"},emptySectionText:{color:N.color.accent,fontSize:11,textAlign:"center",fontFamily:er,opacity:.8,letterSpacing:.5}});import{jsx as b,jsxs as O}from"react/jsx-runtime";function te({visible:e,onClose:a,requiredEnvVars:r,onBack:n,onMinimize:t,enableSharedModalDimensions:o=false,inline:s=false}){let[i,d]=Y("all"),[c,l]=Y(false),[I,w]=Y(""),E=je(null),xe=Me(f=>{},[]);ce(()=>{c&&E.current&&E.current.focus()},[c]),ce(()=>{w(""),l(false)},[i]);let re=zt(),z=P(()=>{let f={};return re.forEach(({key:m,data:v})=>{v!=null&&(f[m]=typeof v=="string"?v:De(v))}),f},[re]),{requiredVars:H,optionalVars:R}=P(()=>ge(z,r),[z,r]),$=P(()=>r===void 0?{totalCount:0,requiredCount:0,optionalCount:0,presentRequiredCount:0,missingCount:0,wrongValueCount:0,wrongTypeCount:0}:fe(H,R,z),[r,H,R,z]),B=P(()=>[...H,...R].sort((f,m)=>{let v={required_missing:1,required_wrong_type:2,required_wrong_value:3,required_present:4,optional_present:5};return(v[f.status]||999)-(v[m.status]||999)}),[H,R]),J=P(()=>{let f=[];switch(i){case"all":f=B;break;case"missing":f=B.filter(m=>m.status==="required_missing");break;case"issues":f=B.filter(m=>m.status==="required_wrong_type"||m.status==="required_wrong_value");break}if(I){let m=I.toLowerCase();f=f.filter(v=>v.key.toLowerCase().includes(m)||v.description?.toLowerCase().includes(m)||typeof v.value=="string"&&v.value.toLowerCase().includes(m))}return f},[B,R,i,I]),L=$.requiredCount>0?Math.round($.presentRequiredCount/$.requiredCount*100):100,Ce=L===100?"HEALTHY":L>=75?"WARNING":L>=50?"ERROR":"CRITICAL",we=L===100?j.success:L>=75?j.warning:L>=50?j.error:j.error;if(!e)return null;let Se=o?se.modal.root():se.env.modal(),ae=O(M,{children:[n&&b(M.Navigation,{onBack:n}),b(M.Content,{title:c?"":"Environment Variables",noMargin:c,children:c&&b(M.Search,{value:I,onChangeText:w,onCancel:()=>{l(false),w("")},placeholder:"Search env keys...",accessibilityLabel:"Search env keys",testID:"buoy-env-search",containerTestID:"buoy-env-search-field",clearTestID:"buoy-env-search-clear"})}),b(M.Actions,{children:!c&&b(qe,{onPress:()=>l(true),testID:"buoy-env-search-open",accessibilityLabel:"Search env keys"})})]}),ne=O(ue,{style:S.scrollContainer,contentContainerStyle:S.contentContainer,showsVerticalScrollIndicator:false,testID:"buoy-env-scroll",children:[b(Ft,{stats:$,healthPercentage:L,healthStatus:Ce,healthColor:we,activeFilter:i,onFilterChange:d}),J.length>0?O(p,{style:S.varsSection,children:[O(p,{style:S.sectionHeader,children:[b(y,{style:S.sectionTitle,testID:"buoy-env-section-title",children:i==="all"?"ALL VARIABLES":i==="missing"?"MISSING VARIABLES":"ISSUES TO FIX"}),b(p,{style:S.countBadge,children:b(y,{style:S.countText,testID:"buoy-env-section-count",children:J.length})})]}),b(tr,{title:"",count:0,vars:J,emptyMessage:""})]}):b(Re,{testID:"buoy-env-empty",...Be({subject:"variables",verb:"declared",search:I,total:B.length,waiting:{otto:"keys",title:"No variables",message:`No ${i==="all"?"":i} variables found`}})})]});return s?O(p,{style:S.inlineRoot,children:[b(p,{style:S.inlineHeader,..._e,children:ae}),ne]}):b(Ae,{visible:e,onClose:a,onMinimize:t,persistenceKey:Se,header:{customContent:ae,showToggleButton:true},onModeChange:xe,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},children:ne})}function rr({requiredEnvVars:e}){return b(te,{inline:true,visible:true,requiredEnvVars:e,onClose:()=>{}})}var S=W.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:j.border,backgroundColor:"transparent"},scrollContainer:{flex:1,backgroundColor:"transparent"},contentContainer:{padding:8,paddingBottom:24},varsSection:{marginTop:16},sectionHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8,paddingHorizontal:8},sectionTitle:{fontSize:10,fontWeight:"700",color:K.color.textTertiary,letterSpacing:1.2,fontFamily:le},countBadge:{backgroundColor:K.color.accent+"15",paddingHorizontal:8,paddingVertical:2,borderRadius:9999,borderWidth:1,borderColor:K.color.accent+"40"},countText:{fontSize:10,fontWeight:"500",color:K.color.accent,fontFamily:le}});function ar(){let e={};for(let[a,r]of Object.entries(be()??(typeof process>"u"?{}:process.env)))typeof r=="string"&&(e[a]=r);return e}var me=[];function nr(e){me=e}function or(e=[]){return{version:1,getSnapshot:()=>({env:ar(),requiredEnvVars:e.length>0?e:me}),subscribe:()=>()=>{}}}import{createToolFactory as ir,defineToolPreset as sr}from"@buoy-gg/shared-ui/web";import{jsx as lr}from"react/jsx-runtime";var ve=sr({id:"env",name:"ENV",description:"Environment variables debugger",slot:"both",icon:({size:e})=>lr(Le,{size:e}),component:te,props:{requiredEnvVars:[],enableSharedModalDimensions:true}}),cr=ir(ve,e=>(nr(e.requiredEnvVars||[]),{requiredEnvVars:e.requiredEnvVars||[],enableSharedModalDimensions:e.enableSharedModalDimensions??true}));export{rr as EnvToolView,te as EnvVarsModal,fe as calculateStats,or as createEnvSyncAdapter,cr as createEnvTool,Kt as createEnvVarConfig,ve as envToolPreset,$t as envVar,X as getEnvVarType,ge as processEnvVars,Ot as setRemoteEnv};
1
+ "use client";var se=Object.defineProperty;var Te=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var ke=Object.prototype.hasOwnProperty;var Ie=(e,n)=>{for(var r in n)se(e,r,{get:n[r],enumerable:true})},ie=(e,n,r,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let t of Ve(n))!ke.call(e,t)&&t!==r&&se(e,t,{get:()=>n[t],enumerable:!(a=Te(n,t))||a.enumerable});return e},Ee=(e,n,r)=>(ie(e,n,"default"),r&&ie(r,n,"default"));typeof window<"u"&&typeof globalThis.global>"u"&&(globalThis.global=globalThis);import{EnvIcon as Le}from"@buoy-gg/floating-tools-core/web";import{JsModal as qe,devToolsStorageKeys as le,ModalHeader as M,HeaderSearchButton as Ae,displayValue as De,buoyColors as j,night as K,windowDragProps as _e,ToolEmptyState as Re,resolveListEmptyState as Be,monoFont as ce}from"@buoy-gg/shared-ui/web";import{useCallback as Me,useState as Y,useRef as je,useEffect as de,useMemo as P}from"react";var ue={};Ie(ue,{AccessibilityInfo:()=>Fe,ActivityIndicator:()=>Mt,Alert:()=>Wt,Animated:()=>Oe,AppRegistry:()=>He,AppState:()=>$e,Appearance:()=>ze,BackHandler:()=>Ke,Button:()=>jt,CheckBox:()=>lt,Clipboard:()=>Ge,DeviceEventEmitter:()=>Tt,Dimensions:()=>Ue,Easing:()=>Je,FlatList:()=>ct,I18nManager:()=>Ye,Image:()=>dt,ImageBackground:()=>ut,InteractionManager:()=>Qe,Keyboard:()=>Xe,KeyboardAvoidingView:()=>pt,LayoutAnimation:()=>Ze,Linking:()=>et,LogBox:()=>St,Modal:()=>Rt,NativeEventEmitter:()=>tt,NativeModules:()=>Ne,PanResponder:()=>rt,Picker:()=>yt,PixelRatio:()=>at,Platform:()=>nt,Pressable:()=>_t,ProgressBar:()=>ht,RefreshControl:()=>bt,SafeAreaView:()=>gt,ScrollView:()=>pe,SectionList:()=>ft,Share:()=>ot,StatusBar:()=>mt,StyleSheet:()=>W,Switch:()=>Bt,Text:()=>y,TextInput:()=>qt,Touchable:()=>vt,TouchableHighlight:()=>At,TouchableNativeFeedback:()=>xt,TouchableOpacity:()=>G,TouchableWithoutFeedback:()=>Dt,UIManager:()=>st,Vibration:()=>it,View:()=>p,VirtualizedList:()=>Ct,YellowBox:()=>wt,findNodeHandle:()=>Pt,unstable_createElement:()=>We,useColorScheme:()=>Vt,useLocaleContext:()=>kt,useWindowDimensions:()=>It});Ee(ue,Pe);import*as Pe from"react-native-web";import{unstable_createElement as We,NativeModules as Ne,AccessibilityInfo as Fe,Animated as Oe,Appearance as ze,AppRegistry as He,AppState as $e,BackHandler as Ke,Clipboard as Ge,Dimensions as Ue,Easing as Je,I18nManager as Ye,Keyboard as Xe,InteractionManager as Qe,LayoutAnimation as Ze,Linking as et,NativeEventEmitter as tt,PanResponder as rt,PixelRatio as at,Platform as nt,Share as ot,StyleSheet as W,UIManager as st,Vibration as it,CheckBox as lt,FlatList as ct,Image as dt,ImageBackground as ut,KeyboardAvoidingView as pt,Picker as yt,ProgressBar as ht,RefreshControl as bt,SafeAreaView as gt,SectionList as ft,StatusBar as mt,Touchable as vt,TouchableNativeFeedback as xt,VirtualizedList as Ct,YellowBox as wt,LogBox as St,DeviceEventEmitter as Tt,useColorScheme as Vt,useLocaleContext as kt,useWindowDimensions as It}from"react-native-web";import*as g from"react-native-web";import{createElement as Et,forwardRef as Lt}from"react";function x(e){let n=Lt((a,t)=>{let{accessibilityState:o,accessibilityValue:i,...s}=a;for(let d of["busy","checked","disabled","expanded","selected"])o?.[d]!==void 0&&s[`aria-${d}`]===void 0&&(s[`aria-${d}`]=o[d]);for(let[d,c]of Object.entries({min:"valuemin",max:"valuemax",now:"valuenow",text:"valuetext"}))i?.[d]!==void 0&&s[`aria-${c}`]===void 0&&(s[`aria-${c}`]=i[d]);return Et(e,{...s,ref:t})}),r=e.State;return r&&Object.assign(n,{State:r}),n.displayName=e.displayName??e.name??"NativeWebView",n}var p=x(g.View),y=x(g.Text),qt=x(g.TextInput),G=x(g.TouchableOpacity),At=x(g.TouchableHighlight),Dt=x(g.TouchableWithoutFeedback),_t=x(g.Pressable),pe=x(g.ScrollView),Rt=x(g.Modal),Bt=x(g.Switch),Mt=x(g.ActivityIndicator),jt=x(g.Button),Pt=g.findNodeHandle,Wt={alert(e,n,r,a){if(typeof document>"u")return;let t=document.createElement("dialog");t.dataset.buoyRoot="",t.setAttribute("aria-label",e),t.style.cssText="position:fixed;inset:0;margin:auto;width:min(440px,90vw);padding:24px;border:1px solid #475569;border-radius:14px;background:#17212e;color:#f1f5f9;font:14px system-ui;box-shadow:0 20px 80px #0008;z-index:2147483647";let o=document.createElement("h2");if(o.textContent=e,o.style.cssText="font-size:18px;margin:0 0 12px",t.appendChild(o),n){let c=document.createElement("p");c.textContent=n,c.style.cssText="line-height:1.5;white-space:pre-wrap;margin:0 0 20px",t.appendChild(c)}let i=document.createElement("div");i.style.cssText="display:flex;justify-content:flex-end;flex-wrap:wrap;gap:8px";let s=r?.length?r:[{text:"OK"}],d=()=>{t.close?.(),t.remove()};for(let c of s){let l=document.createElement("button");l.type="button",l.textContent=c.text??"OK",l.style.cssText=`padding:9px 14px;border:1px solid #64748b;border-radius:7px;color:white;background:${c.style==="destructive"?"#a52b38":"#283a4d"};cursor:pointer;font:inherit`,l.onclick=()=>{d(),c.onPress?.()},i.appendChild(l)}t.addEventListener("cancel",c=>{c.preventDefault(),a?.cancelable!==false&&(d(),a?.onDismiss?.())}),t.appendChild(i),document.body.appendChild(t),t.showModal?t.showModal():t.setAttribute("open","")}};import{CompactRow as Nt,night as T,monoFont as ye}from"@buoy-gg/shared-ui/web";import{jsx as V,jsxs as A}from"react/jsx-runtime";function Ft({stats:e,healthPercentage:n,healthStatus:r,healthColor:a,activeFilter:t="all",onFilterChange:o}){let i=e.wrongValueCount+e.wrongTypeCount;return A(p,{style:u.container,children:[V(Nt,{statusDotColor:a,statusLabel:"System",statusSublabel:r.toLowerCase(),primaryText:"Environment Configuration",secondaryText:`${n}% healthy`,testID:"buoy-env-health",statusSublabelTestID:"buoy-env-health-status",accessibilityLabel:`Environment configuration ${r.toLowerCase()}, ${n}% healthy`,customBadge:V(p,{style:[u.percentBadge,{borderColor:a+"40",backgroundColor:a+"10"}],children:A(y,{style:[u.percentText,{color:a}],testID:"buoy-env-health-percent",children:[n,"%"]})})}),A(p,{style:u.statsGrid,children:[A(G,{style:[u.statCard,t==="all"&&u.statCardActive],onPress:()=>o?.("all"),activeOpacity:.8,testID:"buoy-env-filter-all",accessibilityRole:"button",accessibilityLabel:"Show all variables",accessibilityState:{selected:t==="all"},children:[V(y,{style:[u.statValue,t==="all"&&u.statValueActive],testID:"buoy-env-filter-all-count",children:e.requiredCount+e.optionalCount}),V(y,{style:[u.statLabel,t==="all"&&u.statLabelActive],children:"ALL"})]}),A(G,{style:[u.statCard,t==="missing"&&u.statCardActive],onPress:()=>o?.("missing"),activeOpacity:.8,testID:"buoy-env-filter-missing",accessibilityRole:"button",accessibilityLabel:"Show missing variables",accessibilityState:{selected:t==="missing"},children:[V(y,{style:[u.statValue,t==="missing"&&u.statValueActive],testID:"buoy-env-filter-missing-count",children:e.missingCount}),V(y,{style:[u.statLabel,t==="missing"&&u.statLabelActive],children:"MISSING"})]}),A(G,{style:[u.statCard,t==="issues"&&u.statCardActive],onPress:()=>o?.("issues"),activeOpacity:.8,testID:"buoy-env-filter-issues",accessibilityRole:"button",accessibilityLabel:"Show variables with issues",accessibilityState:{selected:t==="issues"},children:[V(y,{style:[u.statValue,t==="issues"&&u.statValueActive],testID:"buoy-env-filter-issues-count",children:i}),V(y,{style:[u.statLabel,t==="issues"&&u.statLabelActive],children:"ISSUES"})]})]})]})}var u=W.create({container:{gap:8},statsGrid:{flexDirection:"row",gap:8,paddingHorizontal:4},statCard:{flex:1,backgroundColor:T.color.surface,borderRadius:10,borderWidth:1,borderColor:T.color.border,padding:12,alignItems:"center",justifyContent:"center",minHeight:64},statCardActive:{borderColor:T.color.accentBorderStrong,backgroundColor:T.color.accentSoft},statValue:{fontSize:22,fontWeight:"700",fontFamily:ye,lineHeight:26,color:T.color.text},statValueActive:{color:T.color.accent},statLabel:{fontSize:9,color:T.color.textTertiary,marginTop:4,textTransform:"uppercase",letterSpacing:.5,fontWeight:"600"},statLabelActive:{color:T.color.accent},percentBadge:{paddingHorizontal:8,paddingVertical:4,borderRadius:6,borderWidth:1},percentText:{fontSize:14,fontWeight:"700",fontFamily:ye}});import{useMemo as he}from"react";var be=null;function Ot(e){be=e}function ge(){return be}function zt({envFilter:e=()=>true}={}){let n=ge()??(typeof process>"u"?{}:process.env),r=he(()=>a=>{let t=n[a];if(t===void 0)return null;try{if(t.startsWith("{")||t.startsWith("["))return JSON.parse(t);if(t.toLowerCase()==="true")return true;if(t.toLowerCase()==="false")return false;if(/^\d+$/.test(t)){let o=parseInt(t,10);return isNaN(o)?t:o}if(/^\d*\.\d+$/.test(t)){let o=parseFloat(t);return isNaN(o)?t:o}return t}catch{return t}},[n]);return he(()=>Object.keys(n).filter(a=>{let t=n[a];return e(a,t)}).map(a=>({key:a,data:r(a)})),[e,r,n])}function X(e){let n=typeof e;if(n==="boolean")return"boolean";if(n==="number")return"number";if(Array.isArray(e))return"array";if(n==="object"&&e!==null)return"object";if(n==="string"){let r=e;if(r.startsWith("{")&&r.endsWith("}")||r.startsWith("[")&&r.endsWith("]"))try{let t=JSON.parse(r);return Array.isArray(t)?"array":"object"}catch{return"string"}let a=r.toLowerCase();return a==="true"||a==="false"||a==="enabled"||a==="disabled"||a==="yes"||a==="no"||a==="on"||a==="off"?"boolean":!isNaN(Number(r))&&r.trim()!==""?"number":r.startsWith("http://")||r.startsWith("https://")?"url":r.includes(",")?"array":"string"}return"unknown"}var Ht=class{constructor(e){this.key=e}exists(){return this.key}withValue(e){return this.expectedValue=e,delete this.expectedType,this}withType(e){return this.expectedType=e,delete this.expectedValue,this}withDescription(e){return this.description=e,this}build(){return this.expectedValue!==void 0?this.description?{key:this.key,expectedValue:this.expectedValue,description:this.description}:{key:this.key,expectedValue:this.expectedValue}:this.expectedType!==void 0?this.description?{key:this.key,expectedType:this.expectedType,description:this.description}:{key:this.key,expectedType:this.expectedType}:this.key}};function $t(e){return new Ht(e)}function Kt(e){return e}var Q=(e,n)=>{let r=[],a=[],t=new Set;return n?.forEach(o=>{let i=typeof o=="string"?o:o.key,s=typeof o=="object"&&"expectedValue"in o?o.expectedValue:void 0,d=typeof o=="object"&&"expectedType"in o?o.expectedType:void 0,c=typeof o=="object"&&"description"in o?o.description:void 0;t.add(i);let l=e[i],I=l!==void 0,w;if(!I)w="required_missing";else if(s){let E=false;s==="sk_*"?E=l.startsWith("sk_"):s==="production or development"?E=l==="production"||l==="development":E=l===s,w=E?"required_present":"required_wrong_value"}else d&&X(l).toLowerCase()!==d.toLowerCase()?w="required_wrong_type":w="required_present";r.push({key:i,value:l,expectedValue:s,expectedType:d,description:c,status:w,category:"required"})}),Object.entries(e).forEach(([o,i])=>{t.has(o)||a.push({key:o,value:i,status:"optional_present",category:"optional"})}),r.sort((o,i)=>{let s={required_missing:0,required_wrong_value:1,required_wrong_type:2,required_present:3,optional_present:4};return s[o.status]!==s[i.status]?s[o.status]-s[i.status]:o.key.localeCompare(i.key)}),a.sort((o,i)=>o.key.localeCompare(i.key)),{requiredVars:r,optionalVars:a}},fe=(e,n,r)=>{let a=Object.keys(r).length,t=e.length,o=e.filter(l=>l.status==="required_missing").length,i=e.filter(l=>l.status==="required_wrong_value").length,s=e.filter(l=>l.status==="required_wrong_type").length,d=e.filter(l=>l.status==="required_present").length,c=n.length;return{totalCount:a,requiredCount:t,missingCount:o,wrongValueCount:i,wrongTypeCount:s,presentRequiredCount:d,optionalCount:c}};import{useCallback as Gt,useState as Ut}from"react";import{CompactRow as Jt,TypeBadge as Z,buoyColors as D,night as ee,monoFont as te}from"@buoy-gg/shared-ui/web";import{Fragment as Yt,jsx as C,jsxs as q}from"react/jsx-runtime";var Xt=(e,n)=>{switch(e){case"required_present":return{label:"Valid",color:D.success,sublabel:"Required"};case"required_missing":return{label:"Missing",color:D.error,sublabel:"Required"};case"required_wrong_value":return{label:"Wrong",color:D.warning,sublabel:"Invalid value"};case"required_wrong_type":return{label:"Type Error",color:D.info,sublabel:"Wrong type"};case"optional_present":return{label:"Set",color:D.textSecondary,sublabel:"Optional"}}};var Qt=e=>e==null?"undefined":typeof e=="string"?e:String(e);function Zt({envVar:e,isExpanded:n,onPress:r}){let a=Xt(e.status,e.expectedType),t=e.value!==void 0&&e.value!==null,o=e.key.split("_").map(d=>d.toLowerCase()).join(" \u203A "),i=`buoy-env-row-${e.key}`,s=q(p,{style:h.expandedContainer,children:[q(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Value:"}),C(y,{style:h.expandedValue,numberOfLines:3,testID:`${i}-value`,children:Qt(e.value)||"undefined"})]}),e.status==="required_wrong_type"&&e.expectedType&&q(Yt,{children:[q(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Type:"}),C(Z,{type:X(e.value),testID:`${i}-actual-type`})]}),q(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Expected:"}),C(Z,{type:e.expectedType,testID:`${i}-expected-type`})]})]}),e.status==="required_wrong_value"&&e.expectedValue&&q(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Expected:"}),C(y,{style:h.expandedExpected,testID:`${i}-expected-value`,children:String(e.expectedValue)})]}),e.description&&q(p,{style:h.expandedRow,children:[C(y,{style:h.expandedLabel,children:"Info:"}),C(y,{style:h.expandedDescription,testID:`${i}-description`,children:e.description})]})]});return C(Jt,{statusDotColor:a.color,statusLabel:a.label,statusSublabel:a.sublabel,primaryText:o,secondaryText:void 0,expandedContent:s,isExpanded:n,expandedGlowColor:a.color,customBadge:e.expectedType?C(Z,{type:e.expectedType,testID:`${i}-type-badge`}):void 0,showChevron:true,onPress:r?()=>r(e):void 0,testID:i,statusTestID:`${i}-status`,statusSublabelTestID:`${i}-category`,accessibilityLabel:`${e.key}, ${a.label}, ${a.sublabel}`})}var h=W.create({expandedContainer:{gap:6},expandedRow:{flexDirection:"row",alignItems:"center",gap:8},expandedLabel:{fontSize:10,color:ee.color.textTertiary,fontWeight:"600",minWidth:60,fontFamily:te},expandedValue:{fontSize:11,color:ee.color.textSecondary,fontFamily:te,flex:1},expandedExpected:{fontSize:11,color:D.warning,fontFamily:te,flex:1},expandedDescription:{fontSize:11,color:ee.color.textSecondary,flex:1}});import{SectionHeader as _,night as N,monoFont as er}from"@buoy-gg/shared-ui/web";import{jsx as k,jsxs as U}from"react/jsx-runtime";function tr({title:e,count:n,vars:r,emptyMessage:a}){let[t,o]=Ut(null),i=Gt(s=>{o(d=>d===s.key?null:s.key)},[]);return r.length===0&&e==="Required Variables"?U(p,{style:F.sectionContainer,children:[U(_,{children:[k(_.Title,{children:e}),k(_.Badge,{count:0,color:N.color.accent})]}),k(p,{style:F.emptySection,children:k(y,{style:F.emptySectionText,children:a})})]}):r.length===0?null:U(p,{style:F.sectionContainer,children:[e!==""&&U(_,{children:[k(_.Title,{children:e}),k(_.Badge,{count:n,color:N.color.accent})]}),k(p,{style:F.sectionContent,children:r.map(s=>k(Zt,{envVar:s,isExpanded:t===s.key,onPress:i},s.key))})]})}var F=W.create({sectionContainer:{gap:8},sectionContent:{},emptySection:{padding:20,backgroundColor:N.color.accent+"08",borderRadius:8,borderWidth:1,borderColor:N.color.accent+"20",alignItems:"center"},emptySectionText:{color:N.color.accent,fontSize:11,textAlign:"center",fontFamily:er,opacity:.8,letterSpacing:.5}});import{jsx as b,jsxs as O}from"react/jsx-runtime";function re({visible:e,onClose:n,requiredEnvVars:r,onBack:a,onMinimize:t,enableSharedModalDimensions:o=false,inline:i=false}){let[s,d]=Y("all"),[c,l]=Y(false),[I,w]=Y(""),E=je(null),xe=Me(f=>{},[]);de(()=>{c&&E.current&&E.current.focus()},[c]),de(()=>{w(""),l(false)},[s]);let ae=zt(),z=P(()=>{let f={};return ae.forEach(({key:m,data:v})=>{v!=null&&(f[m]=typeof v=="string"?v:De(v))}),f},[ae]),{requiredVars:H,optionalVars:R}=P(()=>Q(z,r),[z,r]),$=P(()=>r===void 0?{totalCount:0,requiredCount:0,optionalCount:0,presentRequiredCount:0,missingCount:0,wrongValueCount:0,wrongTypeCount:0}:fe(H,R,z),[r,H,R,z]),B=P(()=>[...H,...R].sort((f,m)=>{let v={required_missing:1,required_wrong_type:2,required_wrong_value:3,required_present:4,optional_present:5};return(v[f.status]||999)-(v[m.status]||999)}),[H,R]),J=P(()=>{let f=[];switch(s){case"all":f=B;break;case"missing":f=B.filter(m=>m.status==="required_missing");break;case"issues":f=B.filter(m=>m.status==="required_wrong_type"||m.status==="required_wrong_value");break}if(I){let m=I.toLowerCase();f=f.filter(v=>v.key.toLowerCase().includes(m)||v.description?.toLowerCase().includes(m)||typeof v.value=="string"&&v.value.toLowerCase().includes(m))}return f},[B,R,s,I]),L=$.requiredCount>0?Math.round($.presentRequiredCount/$.requiredCount*100):100,Ce=L===100?"HEALTHY":L>=75?"WARNING":L>=50?"ERROR":"CRITICAL",we=L===100?j.success:L>=75?j.warning:L>=50?j.error:j.error;if(!e)return null;let Se=o?le.modal.root():le.env.modal(),ne=O(M,{children:[a&&b(M.Navigation,{onBack:a}),b(M.Content,{title:c?"":"Environment Variables",noMargin:c,children:c&&b(M.Search,{value:I,onChangeText:w,onCancel:()=>{l(false),w("")},placeholder:"Search env keys...",accessibilityLabel:"Search env keys",testID:"buoy-env-search",containerTestID:"buoy-env-search-field",clearTestID:"buoy-env-search-clear"})}),b(M.Actions,{children:!c&&b(Ae,{onPress:()=>l(true),testID:"buoy-env-search-open",accessibilityLabel:"Search env keys"})})]}),oe=O(pe,{style:S.scrollContainer,contentContainerStyle:S.contentContainer,showsVerticalScrollIndicator:false,testID:"buoy-env-scroll",children:[b(Ft,{stats:$,healthPercentage:L,healthStatus:Ce,healthColor:we,activeFilter:s,onFilterChange:d}),J.length>0?O(p,{style:S.varsSection,children:[O(p,{style:S.sectionHeader,children:[b(y,{style:S.sectionTitle,testID:"buoy-env-section-title",children:s==="all"?"ALL VARIABLES":s==="missing"?"MISSING VARIABLES":"ISSUES TO FIX"}),b(p,{style:S.countBadge,children:b(y,{style:S.countText,testID:"buoy-env-section-count",children:J.length})})]}),b(tr,{title:"",count:0,vars:J,emptyMessage:""})]}):b(Re,{testID:"buoy-env-empty",...Be({subject:"variables",verb:"declared",search:I,total:B.length,waiting:{otto:"keys",title:"No variables",message:`No ${s==="all"?"":s} variables found`}})})]});return i?O(p,{style:S.inlineRoot,children:[b(p,{style:S.inlineHeader,..._e,children:ne}),oe]}):b(qe,{visible:e,onClose:n,onMinimize:t,persistenceKey:Se,header:{customContent:ne,showToggleButton:true},onModeChange:xe,enablePersistence:true,initialMode:"bottomSheet",enableGlitchEffects:true,styles:{},children:oe})}function rr({requiredEnvVars:e}){return b(re,{inline:true,visible:true,requiredEnvVars:e,onClose:()=>{}})}var S=W.create({inlineRoot:{flex:1,minHeight:0,backgroundColor:"transparent"},inlineHeader:{paddingHorizontal:12,paddingVertical:8,borderBottomWidth:1,borderBottomColor:j.border,backgroundColor:"transparent"},scrollContainer:{flex:1,backgroundColor:"transparent"},contentContainer:{padding:8,paddingBottom:24},varsSection:{marginTop:16},sectionHeader:{flexDirection:"row",justifyContent:"space-between",alignItems:"center",marginBottom:8,paddingHorizontal:8},sectionTitle:{fontSize:10,fontWeight:"700",color:K.color.textTertiary,letterSpacing:1.2,fontFamily:ce},countBadge:{backgroundColor:K.color.accent+"15",paddingHorizontal:8,paddingVertical:2,borderRadius:9999,borderWidth:1,borderColor:K.color.accent+"40"},countText:{fontSize:10,fontWeight:"500",color:K.color.accent,fontFamily:ce}});function ar(){let e={};for(let[n,r]of Object.entries(ge()??(typeof process>"u"?{}:process.env)))typeof r=="string"&&(e[n]=r);return e}var me=[];function nr(e){me=e}function or(e=[]){return{version:1,getSnapshot:()=>{let n=ar(),r=e.length>0?e:me,a=[];try{a=Q(n,r).requiredVars.map(t=>({key:t.key,status:t.status}))}catch{a=[]}return{env:n,requiredEnvVars:r,checks:a}},subscribe:()=>()=>{}}}import{createToolFactory as sr,defineToolPreset as ir}from"@buoy-gg/shared-ui/web";import{jsx as lr}from"react/jsx-runtime";var ve=ir({id:"env",name:"ENV",description:"Environment variables debugger",slot:"both",icon:({size:e})=>lr(Le,{size:e}),component:re,props:{requiredEnvVars:[],enableSharedModalDimensions:true}}),cr=sr(ve,e=>(nr(e.requiredEnvVars||[]),{requiredEnvVars:e.requiredEnvVars||[],enableSharedModalDimensions:e.enableSharedModalDimensions??true}));export{rr as EnvToolView,re as EnvVarsModal,fe as calculateStats,or as createEnvSyncAdapter,cr as createEnvTool,Kt as createEnvVarConfig,ve as envToolPreset,$t as envVar,X as getEnvVarType,Q as processEnvVars,Ot as setRemoteEnv};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buoy-gg/env",
3
- "version": "7.0.45",
3
+ "version": "7.0.46",
4
4
  "description": "Environment variable inspector for React Native with runtime-visible values, required-variable checks, and type validation.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",
@@ -34,8 +34,8 @@
34
34
  ],
35
35
  "sideEffects": false,
36
36
  "dependencies": {
37
- "@buoy-gg/floating-tools-core": "^7.0.45",
38
- "@buoy-gg/shared-ui": "^7.0.45"
37
+ "@buoy-gg/floating-tools-core": "^7.0.46",
38
+ "@buoy-gg/shared-ui": "^7.0.46"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": "*"