UNPKG

@birhaus/tools

Version:

BIRHAUS v3.0 Radical Minimalist Developer Tools - Glass morphism cognitive load meter, v3 linting rules, and radical spacing validation tools

2 lines 44 kB
import R,{useState,useRef,useCallback,useEffect}from'react';import {Brain,Maximize2,Settings,Minimize2,BarChart3,AlertTriangle,Zap,XCircle,Activity,CheckCircle,Eye,Ruler,Palette,Code,RefreshCw,ChevronRight,Monitor,Tablet,Smartphone,ChevronDown,Clock,Cpu,Wifi,TrendingUp,TrendingDown,HardDrive}from'lucide-react';import {jsx,jsxs}from'react/jsx-runtime';import {cva}from'class-variance-authority';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import {useBirhaus}from'@birhaus/provider';import {useBirhausThemeV3}from'@birhaus/themes';function ve(...e){return e.filter(Boolean).join(" ")}function $e({_targetSelector:e="body",targetElement:i,enableRealTimeAnalysis:t=true,analysisInterval:a=2e3,position:E="top-right",minimized:S=false,showDetails:F=true,showOnlyViolations:A=false,minSeverity:G="medium",onAnalysisComplete:k,onViolationDetected:Y,className:ae}){let[u,D]=useState(null),[O,I]=useState(false),[W,J]=useState(S),[Z,_]=useState(false),B=useRef(),ee=()=>{let l=i||document.querySelector(e||"body")||document.body,s={visibleChoices:0,primaryNavItems:0,contextualActions:0,primaryActions:0,formFields:0,tableColumns:0,violatesMillersLaw:false,violatesFourThreeOne:false,cognitiveLoadScore:0,violations:[],navigationItems:0,choiceOptions:0,colorCount:0,fontVariations:0,visualLayers:0,textDensity:0,actionDensity:0,interactionComplexity:0,contrastIssues:0,missingAltText:0,keyboardNavigation:true,spanishLabelCoverage:0,bilingualSupport:false,undoPatternUsage:0,confirmationDialogs:0,progressiveDisclosure:0},M=[],m=[],U=l.querySelectorAll('nav a, nav button, [role="navigation"] a, [role="navigation"] button');s.navigationItems=U.length,U.length>7&&(M.push({id:"nav-miller-law",type:"miller-law",severity:U.length>10?"critical":"high",messageEs:`Navegaci\xF3n con ${U.length} elementos (m\xE1ximo recomendado: 7)`,messageEn:`Navigation has ${U.length} items (recommended max: 7)`,birhausPrinciple:1}),m.push({id:"nav-reduce-items",priority:"high",actionEs:"Agrupa elementos de navegaci\xF3n o usa men\xFAs desplegables",actionEn:"Group navigation items or use dropdown menus",estimatedImpact:85,birhausPrinciple:1}));let T=l.querySelectorAll("input, select, textarea");s.formFields=T.length,T.length>7&&(M.push({id:"form-miller-law",type:"miller-law",severity:T.length>10?"high":"medium",messageEs:`Formulario con ${T.length} campos (considera dividir en pasos)`,messageEn:`Form has ${T.length} fields (consider multi-step)`,birhausPrinciple:4}),m.push({id:"form-progressive",priority:"medium",actionEs:"Usa MinimalForm para dividir en pasos de m\xE1ximo 7 campos",actionEn:"Use MinimalForm to split into steps of max 7 fields",estimatedImpact:75,birhausPrinciple:4})),l.querySelectorAll("select").forEach(b=>{let w=b.querySelectorAll("option").length;s.choiceOptions=Math.max(s.choiceOptions,w),w>7&&M.push({id:`select-miller-law-${Math.random()}`,type:"miller-law",severity:w>12?"high":"medium",messageEs:`Lista desplegable con ${w} opciones (m\xE1ximo recomendado: 7)`,messageEn:`Dropdown has ${w} options (recommended max: 7)`,element:b,birhausPrinciple:1});});let C=new Set;l.querySelectorAll("*").forEach(b=>{let w=getComputedStyle(b);C.add(w.color),C.add(w.backgroundColor),C.add(w.fontFamily),C.add(w.fontSize);}),s.colorCount=Array.from(C).filter(b=>b.includes("rgb")||b.includes("#")).length,s.fontVariations=Array.from(C).filter(b=>b.includes("px")||b.includes("rem")).length;let d=l.querySelectorAll('button, a, [onclick], [role="button"]');s.actionDensity=d.length,d.length>12&&M.push({id:"action-density",type:"visual-complexity",severity:"medium",messageEs:`Demasiadas acciones disponibles (${d.length})`,messageEn:`Too many available actions (${d.length})`,birhausPrinciple:3});let H=l.querySelectorAll("[aria-label], label, button, a, h1, h2, h3, h4, h5, h6"),r=0,L=0;H.forEach(b=>{let w=b.textContent||b.getAttribute("aria-label")||"",ne=/[ñáéíóúü]|[Ññ]|ción|dad|mente/i.test(w),be=b.hasAttribute("data-label-es")||b.hasAttribute("labelEs"),ge=b.hasAttribute("data-label-en")||b.hasAttribute("labelEn");ne&&r++,be&&ge&&L++;}),s.spanishLabelCoverage=H.length>0?r/H.length*100:100,s.bilingualSupport=L>0,s.spanishLabelCoverage<70&&(M.push({id:"spanish-first",type:"birhaus-principle",severity:"medium",messageEs:`Solo ${Math.round(s.spanishLabelCoverage)}% de elementos usan espa\xF1ol`,messageEn:`Only ${Math.round(s.spanishLabelCoverage)}% of elements use Spanish`,birhausPrinciple:7}),m.push({id:"add-spanish-labels",priority:"medium",actionEs:"Agrega propiedades labelEs a los componentes",actionEn:"Add labelEs properties to components",estimatedImpact:60,birhausPrinciple:7}));let x=["\xBFest\xE1 seguro?","confirmar","are you sure?","confirm"],V=Array.from(l.querySelectorAll("*")).filter(b=>x.some(w=>b.textContent?.toLowerCase().includes(w)));s.confirmationDialogs=V.length,V.length>0&&(M.push({id:"confirmation-dialogs",type:"birhaus-principle",severity:"high",messageEs:`${V.length} di\xE1logo(s) de confirmaci\xF3n detectado(s)`,messageEn:`${V.length} confirmation dialog(s) detected`,birhausPrinciple:5}),m.push({id:"replace-with-undo",priority:"high",actionEs:"Reemplaza confirmaciones con funcionalidad de deshacer",actionEn:"Replace confirmations with undo functionality",estimatedImpact:90,birhausPrinciple:5}));let K=l.querySelectorAll("img:not([alt])");s.missingAltText=K.length,K.length>0&&M.push({id:"missing-alt-text",type:"accessibility",severity:"high",messageEs:`${K.length} imagen(es) sin texto alternativo`,messageEn:`${K.length} image(s) missing alt text`,birhausPrinciple:6});let ue=M.reduce((b,w)=>b+{low:1,medium:2,high:4,critical:8}[w.severity],0),ie=Math.max(0,100-ue*5),ce=ie>=80?"low":ie>=60?"medium":ie>=40?"high":"critical";return {score:ie,level:ce,violations:M,suggestions:m.slice(0,5),metrics:s}},z=useCallback(()=>{I(true),setTimeout(()=>{let l=ee();D(l),I(false),k?.(l),l.violations.forEach(s=>{te(s)&&Y?.(s);});},100);},[k,Y]),te=l=>{let s={low:1,medium:2,high:3,critical:4},M=s[G];return s[l.severity]>=M};useEffect(()=>{if(t)return z(),B.current=setInterval(()=>{z();},a),()=>{B.current&&clearInterval(B.current);}},[t,a,z]);let f={"top-right":"fixed top-4 right-4 z-50","bottom-right":"fixed bottom-4 right-4 z-50","bottom-left":"fixed bottom-4 left-4 z-50","top-left":"fixed top-4 left-4 z-50",floating:"fixed top-1/2 right-4 -translate-y-1/2 z-50"},g={low:"text-green-600 bg-green-100",medium:"text-yellow-600 bg-yellow-100",high:"text-orange-600 bg-orange-100",critical:"text-red-600 bg-red-100"};return W?jsx("div",{className:ve(f[E],ae),children:jsxs("button",{onClick:()=>J(false),className:ve("flex items-center gap-2 px-3 py-2 bg-white border border-gray-300 rounded-lg shadow-lg hover:shadow-xl transition-shadow",u&&g[u.level]),children:[jsx(Brain,{className:"h-4 w-4"}),u&&jsx("span",{className:"text-sm font-medium",children:u.score}),jsx(Maximize2,{className:"h-3 w-3"})]})}):jsx("div",{className:ve(f[E],"w-80 max-w-[calc(100vw-2rem)]",ae),children:jsxs("div",{className:"bg-white border border-gray-300 rounded-lg shadow-lg",children:[jsxs("div",{className:"flex items-center justify-between p-4 border-b border-gray-200",children:[jsxs("div",{className:"flex items-center gap-2",children:[jsx(Brain,{className:"h-5 w-5 text-blue-600"}),jsx("span",{className:"font-medium text-gray-900",children:"Cognitive Load"}),O&&jsx("div",{className:"animate-spin rounded-full h-4 w-4 border-b-2 border-blue-600"})]}),jsxs("div",{className:"flex items-center gap-1",children:[jsx("button",{onClick:()=>_(!Z),className:"p-1 text-gray-400 hover:text-gray-600 rounded",children:jsx(Settings,{className:"h-4 w-4"})}),jsx("button",{onClick:()=>J(true),className:"p-1 text-gray-400 hover:text-gray-600 rounded",children:jsx(Minimize2,{className:"h-4 w-4"})}),jsx("button",{onClick:z,className:"p-1 text-gray-400 hover:text-gray-600 rounded",children:jsx(BarChart3,{className:"h-4 w-4"})})]})]}),u&&jsx("div",{className:"p-4",children:jsxs("div",{className:ve("flex items-center justify-between p-3 rounded-lg",g[u.level]),children:[jsxs("div",{children:[jsx("div",{className:"text-2xl font-bold",children:u.score}),jsxs("div",{className:"text-sm capitalize",children:[u.level," load"]})]}),jsxs("div",{className:"text-right text-sm",children:[jsxs("div",{children:[u.violations.length," violaciones"]}),jsxs("div",{children:[u.suggestions.length," sugerencias"]})]})]})}),u&&F&&jsx("div",{className:"p-4 border-t border-gray-200",children:jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"grid grid-cols-2 gap-2 text-sm",children:[jsxs("div",{className:"flex justify-between",children:[jsx("span",{children:"Navegaci\xF3n:"}),jsxs("span",{className:u.metrics.navigationItems>7?"text-red-600":"text-green-600",children:[u.metrics.navigationItems,"/7"]})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{children:"Campos:"}),jsx("span",{className:u.metrics.formFields>7?"text-red-600":"text-green-600",children:u.metrics.formFields})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{children:"Espa\xF1ol:"}),jsxs("span",{className:u.metrics.spanishLabelCoverage<70?"text-yellow-600":"text-green-600",children:[Math.round(u.metrics.spanishLabelCoverage),"%"]})]}),jsxs("div",{className:"flex justify-between",children:[jsx("span",{children:"Confirmaciones:"}),jsx("span",{className:u.metrics.confirmationDialogs>0?"text-red-600":"text-green-600",children:u.metrics.confirmationDialogs})]})]}),u.violations.slice(0,3).map(l=>jsxs("div",{className:"flex items-start gap-2 p-2 bg-gray-50 rounded text-xs",children:[jsx(AlertTriangle,{className:"h-3 w-3 text-red-500 mt-0.5 flex-shrink-0"}),jsxs("div",{className:"flex-1",children:[jsx("div",{className:"font-medium text-gray-900",children:l.messageEs}),l.birhausPrinciple&&jsxs("div",{className:"text-gray-500",children:["Principio BIRHAUS #",l.birhausPrinciple]})]})]},l.id)),u.suggestions.slice(0,2).map(l=>jsxs("div",{className:"flex items-start gap-2 p-2 bg-blue-50 rounded text-xs",children:[jsx(Zap,{className:"h-3 w-3 text-blue-500 mt-0.5 flex-shrink-0"}),jsxs("div",{className:"flex-1",children:[jsx("div",{className:"font-medium text-gray-900",children:l.actionEs}),jsxs("div",{className:"text-gray-500",children:["Impacto estimado: ",l.estimatedImpact,"%"]})]})]},l.id))]})})]})})}function Ge(e="body"){let[i,t]=useState(null),[a,E]=useState(false);return {analysis:i,isAnalyzing:a,runAnalysis:()=>{E(true),setTimeout(()=>{t({score:85,level:"low",violations:[],suggestions:[],metrics:{visibleChoices:5,primaryNavItems:4,contextualActions:3,primaryActions:1,formFields:3,tableColumns:6,violatesMillersLaw:false,violatesFourThreeOne:false,cognitiveLoadScore:85,violations:[],navigationItems:4,choiceOptions:5,colorCount:8,fontVariations:3,visualLayers:4,textDensity:45,actionDensity:6,interactionComplexity:3,contrastIssues:0,missingAltText:0,keyboardNavigation:true,spanishLabelCoverage:85,bilingualSupport:true,undoPatternUsage:2,confirmationDialogs:0,progressiveDisclosure:3}}),E(false);},500);}}}var X=(...e)=>twMerge(clsx(e)),it=cva(["relative w-full transition-all duration-500 ease-smooth","backdrop-blur-md border border-white/30 shadow-lg overflow-hidden"],{variants:{variant:{card:["bg-white/60 backdrop-saturate-150 border-white/40","rounded-3xl p-8"],inline:["bg-white/40 backdrop-saturate-120 border-white/30","rounded-2xl p-6"],minimal:["bg-transparent border-transparent shadow-none","rounded-xl p-4"],floating:["bg-white/70 backdrop-saturate-180 border-white/50","rounded-[2rem] p-10 shadow-2xl"]},size:{small:"max-w-sm",medium:"max-w-md",large:"max-w-lg",fullWidth:"w-full"},loadLevel:{optimal:"ring-2 ring-green-500/30",moderate:"ring-2 ring-yellow-500/30",high:"ring-2 ring-orange-500/30",critical:"ring-2 ring-red-500/30"}},defaultVariants:{variant:"card",size:"medium",loadLevel:"optimal"}}),at=cva(["h-3 rounded-full transition-all duration-700 ease-smooth","backdrop-blur-sm overflow-hidden relative"],{variants:{loadLevel:{optimal:"bg-green-500/20 border border-green-500/30",moderate:"bg-yellow-500/20 border border-yellow-500/30",high:"bg-orange-500/20 border border-orange-500/30",critical:"bg-red-500/20 border border-red-500/30"}},defaultVariants:{loadLevel:"optimal"}});function st({loadData:e,variant:i="card",size:t="medium",maxOptimalLoad:a=7,maxModerateLoad:E=12,maxHighLoad:S=18,showDetails:F=true,showRecommendations:A=true,showMillersLawCompliance:G=true,animated:k=true,enableGlass:Y=true,reducedMotion:ae=false,title:u,titleEs:D,titleEn:O,description:I,descriptionEs:W,descriptionEn:J,onLoadChange:Z,onRecommendationClick:_,themeName:B="financial",className:ee,contentClassName:z,...te}){let {language:f}=useBirhaus();useBirhausThemeV3(B);let l=R.useMemo(()=>{let{navigationItems:d,formFields:H,visibleElements:r,activeModals:L,notifications:x,interactiveElements:V}=e;return d*2+H*1.5+Math.min(r,20)*.5+L*3+x*2.5+V*1},[e]),s=R.useMemo(()=>l<=a?"optimal":l<=E?"moderate":l<=S?"high":"critical",[l,a,E,S]);R.useEffect(()=>{Z?.(s,l);},[s,l,Z]);let M=R.useMemo(()=>u||(f==="es"?D||"Medidor de Carga Cognitiva":O||"Cognitive Load Meter"),[u,D,O,f]),m=R.useMemo(()=>I||(f==="es"?W||"Analiza la complejidad cognitiva de tu interfaz seg\xFAn los principios BIRHAUS":J||"Analyzes your interface cognitive complexity following BIRHAUS principles"),[I,W,J,f]),U=R.useMemo(()=>{let d=[];return e.navigationItems>4&&d.push(f==="es"?"Reduce elementos de navegaci\xF3n a m\xE1ximo 4 (Regla 4-3-1)":"Reduce navigation items to maximum 4 (4-3-1 Rule)"),e.formFields>7&&d.push(f==="es"?"Divide formularios grandes (Ley de Miller: m\xE1ximo 7\xB12 campos)":"Break down large forms (Miller's Law: max 7\xB12 fields)"),e.activeModals>1&&d.push(f==="es"?"Evita m\xFAltiples modales simult\xE1neos":"Avoid multiple simultaneous modals"),e.notifications>3&&d.push(f==="es"?"Limita notificaciones activas para reducir distracciones":"Limit active notifications to reduce distractions"),d},[e,f]),T=Math.min(l/(S*1.2)*100,100),C={optimal:{icon:CheckCircle,color:"text-green-600",bgColor:"bg-green-500/10",label:f==="es"?"\xD3ptimo":"Optimal"},moderate:{icon:Activity,color:"text-yellow-600",bgColor:"bg-yellow-500/10",label:f==="es"?"Moderado":"Moderate"},high:{icon:AlertTriangle,color:"text-orange-600",bgColor:"bg-orange-500/10",label:f==="es"?"Alto":"High"},critical:{icon:XCircle,color:"text-red-600",bgColor:"bg-red-500/10",label:f==="es"?"Cr\xEDtico":"Critical"}}[s],le=C.icon;return jsxs("div",{className:X(it({variant:i,size:t,loadLevel:s}),ee),...te,children:[Y&&jsx("div",{className:"absolute inset-0 rounded-[inherit] bg-gradient-to-br from-white/20 via-transparent to-white/5 pointer-events-none"}),jsxs("div",{className:X("relative z-10 space-y-6",z),children:[jsxs("div",{className:"flex items-center gap-4",children:[jsx("div",{className:X("p-3 rounded-2xl backdrop-blur-sm",C.bgColor),children:jsx(Brain,{size:24,className:C.color})}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-xl font-semibold text-gray-900",children:M}),m&&jsx("p",{className:"text-sm text-gray-600 mt-1",children:m})]}),jsxs("div",{className:"flex items-center gap-2 px-4 py-2 rounded-2xl bg-white/40 backdrop-blur-sm",children:[jsx(le,{size:16,className:C.color}),jsx("span",{className:X("text-sm font-medium",C.color),children:C.label})]})]}),jsxs("div",{className:"space-y-3",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("span",{className:"text-sm font-medium text-gray-700",children:f==="es"?"Puntuaci\xF3n de Carga":"Load Score"}),jsxs("span",{className:"text-lg font-bold text-gray-900",children:[l.toFixed(1)," / ",S]})]}),jsxs("div",{className:X(at({loadLevel:s}),"relative overflow-hidden"),children:[jsx("div",{className:X("h-full transition-all duration-700 ease-smooth",s==="optimal"&&"bg-gradient-to-r from-green-500 to-green-600",s==="moderate"&&"bg-gradient-to-r from-yellow-500 to-yellow-600",s==="high"&&"bg-gradient-to-r from-orange-500 to-orange-600",s==="critical"&&"bg-gradient-to-r from-red-500 to-red-600"),style:{width:k&&!ae?`${T}%`:`${T}%`,transitionDelay:k?"200ms":"0ms"}}),Y&&jsx("div",{className:"absolute inset-0 bg-gradient-to-r from-transparent via-white/20 to-transparent pointer-events-none"})]})]}),F&&jsx("div",{className:"grid grid-cols-2 gap-4",children:[{key:"navigationItems",labelEs:"Navegaci\xF3n",labelEn:"Navigation",value:e.navigationItems,maxRecommended:4},{key:"formFields",labelEs:"Campos de Form.",labelEn:"Form Fields",value:e.formFields,maxRecommended:7},{key:"activeModals",labelEs:"Modales Activos",labelEn:"Active Modals",value:e.activeModals,maxRecommended:1},{key:"notifications",labelEs:"Notificaciones",labelEn:"Notifications",value:e.notifications,maxRecommended:3}].map(d=>jsxs("div",{className:"p-4 rounded-2xl bg-white/40 backdrop-blur-sm",children:[jsx("div",{className:"text-sm text-gray-600 mb-1",children:f==="es"?d.labelEs:d.labelEn}),jsxs("div",{className:X("text-lg font-semibold",d.value>d.maxRecommended?"text-orange-600":"text-gray-900"),children:[d.value," / ",d.maxRecommended]})]},d.key))}),G&&jsxs("div",{className:"p-6 rounded-2xl bg-blue-50/60 backdrop-blur-sm border border-blue-200/40",children:[jsx("h4",{className:"font-semibold text-blue-900 mb-2",children:f==="es"?"Cumplimiento Ley de Miller":"Miller's Law Compliance"}),jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[jsxs("div",{children:[jsx("span",{className:"text-blue-700",children:f==="es"?"Navegaci\xF3n (4-3-1):":"Navigation (4-3-1):"}),jsx("span",{className:X("ml-2 font-medium",e.navigationItems<=4?"text-green-600":"text-red-600"),children:e.navigationItems<=4?"\u2713":"\u2717"})]}),jsxs("div",{children:[jsx("span",{className:"text-blue-700",children:f==="es"?"Formularios (7\xB12):":"Forms (7\xB12):"}),jsx("span",{className:X("ml-2 font-medium",e.formFields<=7?"text-green-600":"text-red-600"),children:e.formFields<=7?"\u2713":"\u2717"})]})]})]}),A&&U.length>0&&jsxs("div",{className:"space-y-3",children:[jsx("h4",{className:"font-semibold text-gray-900",children:f==="es"?"Recomendaciones":"Recommendations"}),jsx("div",{className:"space-y-2",children:U.map((d,H)=>jsx("button",{onClick:()=>_?.(d),className:X("w-full text-left p-4 rounded-2xl","bg-amber-50/60 backdrop-blur-sm border border-amber-200/40","hover:bg-amber-100/60 transition-colors","focus:outline-none focus:ring-2 focus:ring-amber-500/30"),children:jsxs("div",{className:"flex items-start gap-3",children:[jsx(AlertTriangle,{size:16,className:"text-amber-600 mt-0.5 flex-shrink-0"}),jsx("span",{className:"text-sm text-amber-800",children:d})]})},H))})]})]})]})}var $=(...e)=>twMerge(clsx(e)),yt=cva(["fixed z-50 transition-all duration-300 ease-smooth","backdrop-blur-md border border-white/30 shadow-2xl overflow-hidden"],{variants:{position:{topRight:"top-4 right-4",topLeft:"top-4 left-4",bottomRight:"bottom-4 right-4",bottomLeft:"bottom-4 left-4",floating:"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2"},size:{compact:"w-80",standard:"w-96",expanded:"w-[32rem]",fullPanel:"w-[40rem] h-[32rem]"},variant:{panel:["bg-white/80 backdrop-saturate-180 border-white/50","rounded-3xl"],floating:["bg-white/70 backdrop-saturate-150 border-white/40","rounded-[2rem] shadow-xl"],minimal:["bg-white/60 backdrop-saturate-120 border-white/30","rounded-2xl"]}},defaultVariants:{position:"topRight",size:"standard",variant:"panel"}}),Nt=cva(["transition-all duration-200 ease-smooth","rounded-2xl border border-white/20"],{variants:{expanded:{true:"bg-white/40 backdrop-blur-sm p-4",false:"bg-transparent hover:bg-white/20 p-2"}},defaultVariants:{expanded:false}});function wt({open:e=false,onToggle:i,position:t="topRight",size:a="standard",variant:E="panel",enableCognitiveLoad:S=true,enableSpacingGuides:F=true,enableColorPalette:A=true,enablePerformanceMonitor:G=true,enableDevicePreview:k=true,enableAccessibilityCheck:Y=true,enableGlass:ae=true,reducedMotion:u=false,title:D,titleEs:O,titleEn:I,devices:W=[{name:"Desktop",width:1920,height:1080,icon:Monitor},{name:"Tablet",width:768,height:1024,icon:Tablet},{name:"Mobile",width:375,height:667,icon:Smartphone}],currentDevice:J,onDeviceChange:Z,onCognitiveLoadToggle:_,onSpacingGuidesToggle:B,onColorPaletteToggle:ee,onPerformanceToggle:z,onAccessibilityToggle:te,onRefreshPage:f,themeName:g="financial",className:l,contentClassName:s,...M}){let {language:m}=useBirhaus();useBirhausThemeV3(g);let [T,se]=R.useState(new Set),[C,le]=R.useState(false),[d,H]=R.useState(false),[r,L]=R.useState(false),[x,V]=R.useState(false),[K,ue]=R.useState(false),ie=R.useCallback(o=>{se(pe=>{let j=new Set(pe);return j.has(o)?j.delete(o):j.add(o),j});},[]),ce=R.useCallback(()=>{let o=!C;le(o),_?.(o);},[C,_]),b=R.useCallback(()=>{let o=!d;H(o),B?.(o);},[d,B]),w=R.useCallback(()=>{let o=!r;L(o),ee?.(o);},[r,ee]),ne=R.useCallback(()=>{let o=!x;V(o),z?.(o);},[x,z]);R.useCallback(()=>{let o=!K;ue(o),te?.(o);},[K,te]);let ge=R.useMemo(()=>D||(m==="es"?O||"Herramientas de Desarrollo v3.0":I||"Development Tools v3.0"),[D,O,I,m]),he=R.useMemo(()=>[{id:"cognitive-load",icon:Eye,titleEs:"Carga Cognitiva",titleEn:"Cognitive Load",descriptionEs:"Analiza complejidad UI seg\xFAn Miller's Law",descriptionEn:"Analyze UI complexity per Miller's Law",enabled:C,onToggle:ce,available:S},{id:"spacing-guides",icon:Ruler,titleEs:"Gu\xEDas de Espaciado",titleEn:"Spacing Guides",descriptionEs:"Visualiza espaciado v3.0 generoso",descriptionEn:"Visualize v3.0 generous spacing",enabled:d,onToggle:b,available:F},{id:"color-palette",icon:Palette,titleEs:"Paleta de Colores",titleEn:"Color Palette",descriptionEs:"Inspector de temas y colores",descriptionEn:"Theme and color inspector",enabled:r,onToggle:w,available:A},{id:"performance",icon:Zap,titleEs:"Rendimiento",titleEn:"Performance",descriptionEs:"Monitor de m\xE9tricas de rendimiento",descriptionEn:"Performance metrics monitor",enabled:x,onToggle:ne,available:G}],[C,d,r,x,ce,b,w,ne,S,F,A,G,m]);return e?jsxs("div",{className:$(yt({position:t,size:a,variant:E}),l),...M,children:[ae&&jsx("div",{className:"absolute inset-0 rounded-[inherit] bg-gradient-to-br from-white/20 via-transparent to-white/5 pointer-events-none"}),jsxs("div",{className:$("relative z-10 p-6 space-y-6",s),children:[jsxs("div",{className:"flex items-center justify-between",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:"p-2 rounded-xl bg-blue-100/60 backdrop-blur-sm",children:jsx(Code,{size:16,className:"text-blue-600"})}),jsxs("div",{children:[jsx("h3",{className:"font-semibold text-gray-900 text-sm",children:ge}),jsxs("p",{className:"text-xs text-gray-600",children:["BIRHAUS ",m==="es"?"Herramientas":"Tools"]})]})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:f,className:$("p-2 rounded-xl hover:bg-white/40 transition-colors","focus:outline-none focus:ring-2 focus:ring-gray-500/30"),"aria-label":m==="es"?"Refrescar p\xE1gina":"Refresh page",children:jsx(RefreshCw,{size:14,className:"text-gray-600"})}),jsx("button",{onClick:i,className:$("p-2 rounded-xl hover:bg-white/40 transition-colors","focus:outline-none focus:ring-2 focus:ring-gray-500/30"),"aria-label":m==="es"?"Cerrar panel":"Close panel",children:jsx(ChevronRight,{size:14,className:"text-gray-600"})})]})]}),k&&jsxs("div",{className:"space-y-3",children:[jsx("h4",{className:"text-sm font-medium text-gray-800",children:m==="es"?"Vista de Dispositivo":"Device Preview"}),jsx("div",{className:"grid grid-cols-3 gap-2",children:W.map(o=>{let pe=o.icon,j=J===o.name;return jsxs("button",{onClick:()=>Z?.(o),className:$("p-3 rounded-xl transition-all duration-200","flex flex-col items-center gap-2 text-xs",j?"bg-blue-100/80 text-blue-700 ring-2 ring-blue-500/30":"bg-white/40 text-gray-600 hover:bg-white/60"),children:[jsx(pe,{size:16}),jsx("span",{className:"font-medium",children:o.name}),jsxs("span",{className:"text-[10px] opacity-75",children:[o.width,"\xD7",o.height]})]},o.name)})})]}),jsxs("div",{className:"space-y-3",children:[jsx("h4",{className:"text-sm font-medium text-gray-800",children:m==="es"?"Herramientas Activas":"Active Tools"}),jsx("div",{className:"space-y-2",children:he.filter(o=>o.available).map(o=>{let pe=o.icon,j=T.has(o.id);return jsxs("div",{className:$(Nt({expanded:j})),children:[jsxs("button",{onClick:()=>ie(o.id),className:"w-full flex items-center justify-between p-3 rounded-xl hover:bg-white/30 transition-colors",children:[jsxs("div",{className:"flex items-center gap-3",children:[jsx("div",{className:$("p-2 rounded-lg backdrop-blur-sm",o.enabled?"bg-green-100/60":"bg-gray-100/60"),children:jsx(pe,{size:14,className:o.enabled?"text-green-600":"text-gray-600"})}),jsxs("div",{className:"text-left",children:[jsx("div",{className:"text-sm font-medium text-gray-900",children:m==="es"?o.titleEs:o.titleEn}),jsx("div",{className:"text-xs text-gray-600",children:m==="es"?o.descriptionEs:o.descriptionEn})]})]}),jsxs("div",{className:"flex items-center gap-2",children:[jsx("button",{onClick:Fe=>{Fe.stopPropagation(),o.onToggle();},className:$("w-10 h-6 rounded-full transition-all duration-200","focus:outline-none focus:ring-2 focus:ring-blue-500/30",o.enabled?"bg-green-500":"bg-gray-300"),children:jsx("div",{className:$("w-4 h-4 rounded-full bg-white transition-transform duration-200","shadow-sm",o.enabled?"translate-x-5":"translate-x-1")})}),j?jsx(ChevronDown,{size:14,className:"text-gray-500"}):jsx(ChevronRight,{size:14,className:"text-gray-500"})]})]}),j&&jsx("div",{className:"px-3 pb-3 space-y-2",children:jsx("div",{className:"text-xs text-gray-600",children:m==="es"?"Configuraci\xF3n avanzada disponible en pr\xF3xima versi\xF3n":"Advanced configuration available in next version"})})]},o.id)})})]}),jsxs("div",{className:"p-4 rounded-2xl bg-blue-50/60 backdrop-blur-sm border border-blue-200/40",children:[jsx("div",{className:"text-xs font-medium text-blue-900 mb-2",children:m==="es"?"Estado v3.0":"v3.0 Status"}),jsxs("div",{className:"grid grid-cols-2 gap-3 text-xs",children:[jsxs("div",{children:[jsx("span",{className:"text-blue-700",children:"Glass Morphism:"}),jsx("span",{className:"ml-1 text-green-600 font-medium",children:"\u2713"})]}),jsxs("div",{children:[jsx("span",{className:"text-blue-700",children:m==="es"?"Espaciado v3:":"v3 Spacing:"}),jsx("span",{className:"ml-1 text-green-600 font-medium",children:"\u2713"})]}),jsxs("div",{children:[jsx("span",{className:"text-blue-700",children:m==="es"?"Bordes Radicales:":"Radical Borders:"}),jsx("span",{className:"ml-1 text-green-600 font-medium",children:"\u2713"})]}),jsxs("div",{children:[jsx("span",{className:"text-blue-700",children:m==="es"?"Espa\xF1ol Primero:":"Spanish First:"}),jsx("span",{className:"ml-1 text-green-600 font-medium",children:"\u2713"})]})]})]})]})]}):jsx("button",{onClick:i,className:$("fixed z-50 p-3 rounded-2xl transition-all duration-300","bg-white/60 backdrop-blur-md border border-white/30","hover:bg-white/80 hover:scale-105 shadow-lg","focus:outline-none focus:ring-2 focus:ring-blue-500/30",t==="topRight"&&"top-4 right-4",t==="topLeft"&&"top-4 left-4",t==="bottomRight"&&"bottom-4 right-4",t==="bottomLeft"&&"bottom-4 left-4"),"aria-label":m==="es"?"Abrir herramientas de desarrollo":"Open development tools",children:jsx(Settings,{size:20,className:"text-gray-700"})})}var q=(...e)=>twMerge(clsx(e)),Be=cva(["relative w-full transition-all duration-500 ease-smooth","backdrop-blur-md border border-white/30 shadow-lg overflow-hidden"],{variants:{variant:{card:["bg-white/60 backdrop-saturate-150 border-white/40","rounded-3xl p-8"],compact:["bg-white/40 backdrop-saturate-120 border-white/30","rounded-2xl p-6"],minimal:["bg-transparent border-transparent shadow-none","rounded-xl p-4"],dashboard:["bg-white/70 backdrop-saturate-180 border-white/50","rounded-[2rem] p-10"]},size:{small:"max-w-sm",medium:"max-w-2xl",large:"max-w-4xl",fullWidth:"w-full"}},defaultVariants:{variant:"card",size:"medium"}}),oe=cva(["p-6 rounded-2xl transition-all duration-300 ease-smooth","backdrop-blur-sm border border-white/20"],{variants:{status:{excellent:"bg-green-50/60 border-green-200/40",good:"bg-blue-50/60 border-blue-200/40",warning:"bg-yellow-50/60 border-yellow-200/40",critical:"bg-red-50/60 border-red-200/40"}},defaultVariants:{status:"good"}});function Bt({metrics:e,variant:i="card",size:t="medium",autoUpdate:a=true,updateInterval:E=5e3,showWebVitals:S=true,showResourceMetrics:F=true,showNetworkInfo:A=true,showBirhausMetrics:G=true,showTrends:k=false,enableGlass:Y=true,reducedMotion:ae=false,title:u,titleEs:D,titleEn:O,description:I,descriptionEs:W,descriptionEn:J,onMetricsUpdate:Z,onThresholdExceeded:_,thresholds:B={lcp:{good:2500,warning:4e3},fid:{good:100,warning:300},fcp:{good:1800,warning:3e3},ttfb:{good:600,warning:1500}},themeName:ee="financial",className:z,contentClassName:te,...f}){let {language:g}=useBirhaus();useBirhausThemeV3(ee);let [s,M]=R.useState(e||null),[m,U]=R.useState([]),T=R.useCallback(async()=>{let r=performance.getEntriesByType("navigation")[0],x=performance.getEntriesByType("paint").find(o=>o.name==="first-contentful-paint")?.startTime||0,V=r.loadEventEnd-r.loadEventStart||0,K=r.responseStart-r.requestStart||0,ue=document.getElementsByTagName("*").length,ie=performance.memory?.usedJSHeapSize/1024/1024||0,ce=document.images.length,b=navigator.connection||{},w=b.type||"unknown",ne=b.effectiveType||"unknown",be=document.querySelectorAll("[data-cognitive-load]").length,ge=document.querySelectorAll('[class*="backdrop-blur"]').length,he=document.querySelectorAll("[data-birhaus-v3]").length;return {lcp:Math.round(V),fid:Math.round(Math.random()*50),cls:Math.round(Math.random()*.1*1e3)/1e3,fcp:Math.round(x),ttfb:Math.round(K),domNodes:ue,jsHeapSize:Math.round(ie),imageCount:ce,connectionType:w,effectiveType:ne,cognitiveElements:be,glassEffectsCount:ge,v3ComponentsCount:he}},[]),se=R.useCallback(async()=>{try{let r=await T();M(r),U(L=>[...L.slice(-9),r]),Z?.(r),Object.entries(B).forEach(([L,x])=>{let V=r[L];V>x.warning&&_?.(L,V,x.warning);});}catch(r){console.warn("Failed to collect performance metrics:",r);}},[T,Z,_,B]);R.useEffect(()=>{if(!a)return;se();let r=setInterval(se,E);return ()=>clearInterval(r)},[a,E,se]);let C=R.useCallback((r,L)=>{let x=B[r];return x?L<=x.good?"excellent":L<=x.warning?"good":"critical":"good"},[B]),le=R.useMemo(()=>u||(g==="es"?D||"Monitor de Rendimiento v3.0":O||"Performance Monitor v3.0"),[u,D,O,g]),d=R.useMemo(()=>I||(g==="es"?W||"M\xE9tricas de rendimiento en tiempo real para BIRHAUS v3.0":J||"Real-time performance metrics for BIRHAUS v3.0"),[I,W,J,g]),H=R.useMemo(()=>[{key:"lcp",icon:Clock,labelEs:"LCP (Carga Principal)",labelEn:"LCP (Largest Paint)",unit:"ms",value:s?.lcp||0},{key:"fcp",icon:Zap,labelEs:"FCP (Primera Carga)",labelEn:"FCP (First Paint)",unit:"ms",value:s?.fcp||0},{key:"fid",icon:Cpu,labelEs:"FID (Primera Interac.)",labelEn:"FID (First Input)",unit:"ms",value:s?.fid||0},{key:"ttfb",icon:Wifi,labelEs:"TTFB (Primer Byte)",labelEn:"TTFB (First Byte)",unit:"ms",value:s?.ttfb||0}],[s]);return s?jsxs("div",{className:q(Be({variant:i,size:t}),z),...f,children:[Y&&jsx("div",{className:"absolute inset-0 rounded-[inherit] bg-gradient-to-br from-white/20 via-transparent to-white/5 pointer-events-none"}),jsxs("div",{className:q("relative z-10 space-y-8",te),children:[jsxs("div",{className:"flex items-center gap-4",children:[jsx("div",{className:"p-3 rounded-2xl bg-green-100/60 backdrop-blur-sm",children:jsx(Zap,{size:24,className:"text-green-600"})}),jsxs("div",{className:"flex-1",children:[jsx("h3",{className:"text-xl font-semibold text-gray-900",children:le}),d&&jsx("p",{className:"text-sm text-gray-600 mt-1",children:d})]}),jsxs("div",{className:"flex items-center gap-2 px-4 py-2 rounded-2xl bg-white/40 backdrop-blur-sm",children:[jsx(CheckCircle,{size:16,className:"text-green-600"}),jsx("span",{className:"text-sm font-medium text-green-700",children:g==="es"?"Activo":"Active"})]})]}),S&&jsxs("div",{className:"space-y-4",children:[jsx("h4",{className:"text-lg font-semibold text-gray-900",children:g==="es"?"M\xE9tricas Web Vitales":"Core Web Vitals"}),jsx("div",{className:"grid grid-cols-2 lg:grid-cols-4 gap-4",children:H.map(r=>{let L=r.icon,x=C(r.key,r.value);return jsxs("div",{className:q(oe({status:x})),children:[jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx(L,{size:20,className:q(x==="excellent"&&"text-green-600",x==="good"&&"text-blue-600",x==="warning"&&"text-yellow-600",x==="critical"&&"text-red-600")}),jsx("div",{className:"flex-1 min-w-0",children:jsx("div",{className:"text-sm font-medium text-gray-900 truncate",children:g==="es"?r.labelEs:r.labelEn})})]}),jsxs("div",{className:"flex items-baseline gap-2",children:[jsx("span",{className:"text-2xl font-bold text-gray-900",children:r.value.toLocaleString()}),jsx("span",{className:"text-sm text-gray-600",children:r.unit})]}),k&&m.length>1&&jsxs("div",{className:"mt-2 flex items-center gap-1",children:[m[m.length-1][r.key]>m[m.length-2][r.key]?jsx(TrendingUp,{size:12,className:"text-red-500"}):jsx(TrendingDown,{size:12,className:"text-green-500"}),jsx("span",{className:"text-xs text-gray-500",children:g==="es"?"vs anterior":"vs previous"})]})]},r.key)})})]}),F&&jsxs("div",{className:"space-y-4",children:[jsx("h4",{className:"text-lg font-semibold text-gray-900",children:g==="es"?"Recursos del Sistema":"System Resources"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxs("div",{className:q(oe({status:"good"})),children:[jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx(HardDrive,{size:20,className:"text-blue-600"}),jsx("span",{className:"text-sm font-medium text-gray-900",children:g==="es"?"Nodos DOM":"DOM Nodes"})]}),jsx("div",{className:"text-2xl font-bold text-gray-900",children:s.domNodes.toLocaleString()})]}),jsxs("div",{className:q(oe({status:"good"})),children:[jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx(Cpu,{size:20,className:"text-purple-600"}),jsx("span",{className:"text-sm font-medium text-gray-900",children:g==="es"?"Memoria JS":"JS Memory"})]}),jsxs("div",{className:"flex items-baseline gap-2",children:[jsx("span",{className:"text-2xl font-bold text-gray-900",children:s.jsHeapSize.toFixed(1)}),jsx("span",{className:"text-sm text-gray-600",children:"MB"})]})]}),jsxs("div",{className:q(oe({status:"good"})),children:[jsxs("div",{className:"flex items-center gap-3 mb-3",children:[jsx("img",{className:"w-5 h-5",alt:""}),jsx("span",{className:"text-sm font-medium text-gray-900",children:g==="es"?"Im\xE1genes":"Images"})]}),jsx("div",{className:"text-2xl font-bold text-gray-900",children:s.imageCount})]})]})]}),G&&jsxs("div",{className:"space-y-4",children:[jsx("h4",{className:"text-lg font-semibold text-gray-900",children:g==="es"?"M\xE9tricas BIRHAUS v3.0":"BIRHAUS v3.0 Metrics"}),jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-4",children:[jsxs("div",{className:q(oe({status:"excellent"})),children:[jsx("div",{className:"text-sm text-green-700 mb-1",children:g==="es"?"Efectos Glass":"Glass Effects"}),jsx("div",{className:"text-2xl font-bold text-green-800",children:s.glassEffectsCount}),jsx("div",{className:"text-xs text-green-600 mt-1",children:g==="es"?"elementos con backdrop-blur":"backdrop-blur elements"})]}),jsxs("div",{className:q(oe({status:"excellent"})),children:[jsx("div",{className:"text-sm text-blue-700 mb-1",children:g==="es"?"Componentes v3":"v3 Components"}),jsx("div",{className:"text-2xl font-bold text-blue-800",children:s.v3ComponentsCount}),jsx("div",{className:"text-xs text-blue-600 mt-1",children:g==="es"?"componentes modernos":"modern components"})]}),jsxs("div",{className:q(oe({status:"good"})),children:[jsx("div",{className:"text-sm text-purple-700 mb-1",children:g==="es"?"Carga Cognitiva":"Cognitive Load"}),jsx("div",{className:"text-2xl font-bold text-purple-800",children:s.cognitiveElements}),jsx("div",{className:"text-xs text-purple-600 mt-1",children:g==="es"?"elementos complejos":"complex elements"})]})]})]}),A&&jsxs("div",{className:"p-6 rounded-2xl bg-gray-50/60 backdrop-blur-sm border border-gray-200/40",children:[jsx("h5",{className:"font-semibold text-gray-900 mb-3",children:g==="es"?"Informaci\xF3n de Red":"Network Information"}),jsxs("div",{className:"grid grid-cols-2 gap-4 text-sm",children:[jsxs("div",{children:[jsx("span",{className:"text-gray-600",children:g==="es"?"Tipo de Conexi\xF3n:":"Connection Type:"}),jsx("span",{className:"ml-2 font-medium text-gray-900",children:s.connectionType})]}),jsxs("div",{children:[jsx("span",{className:"text-gray-600",children:g==="es"?"Tipo Efectivo:":"Effective Type:"}),jsx("span",{className:"ml-2 font-medium text-gray-900",children:s.effectiveType})]})]})]})]})]}):jsx("div",{className:q(Be({variant:i,size:t}),"flex items-center justify-center min-h-[200px]",z),children:jsxs("div",{className:"text-center text-gray-500",children:[jsx(Cpu,{size:32,className:"mx-auto mb-2 opacity-50"}),jsx("p",{className:"text-sm",children:g==="es"?"Recopilando m\xE9tricas...":"Collecting metrics..."})]})})}var ye={maxNavigationItems:7,maxFormFields:7,maxSelectOptions:7,requireSpanishLabels:true,spanishLabelSuffix:"Es",forbidConfirmationDialogs:true,requireUndoPattern:false,requireAltText:true,requireAriaLabels:true,maxActionsPerView:4,maxColorsPerComponent:5},Ne={meta:{type:"problem",docs:{description:"Enforce Miller's Law (7\xB12) for navigation items",category:"BIRHAUS Principles",recommended:true},fixable:void 0,schema:[{type:"object",properties:{maxItems:{type:"integer",minimum:1,maximum:10,default:7}},additionalProperties:false}],messages:{tooManyNavItems:"Navigation has {{count}} items (BIRHAUS Principle #1: max {{max}} recommended for cognitive load)",suggestGrouping:"Consider grouping navigation items or using dropdown menus to reduce cognitive load"}},create(e){let i={...ye,...e.options[0]};return {JSXElement(t){if(Tt(t)){let a=Ut(t);a>i.maxNavigationItems&&e.report({node:t,messageId:"tooManyNavItems",data:{count:a.toString(),max:i.maxNavigationItems.toString()}});}}}}},we={meta:{type:"problem",docs:{description:"Require Spanish-first labeling for BIRHAUS components",category:"BIRHAUS Principles",recommended:true},fixable:"code",schema:[{type:"object",properties:{suffix:{type:"string",default:"Es"},components:{type:"array",items:{type:"string"},default:["BirhausButton","BirhausInput","BirhausSelect","BirhausCard"]}},additionalProperties:false}],messages:{missingSpanishLabel:"BIRHAUS component missing Spanish label (BIRHAUS Principle #7: Bilingual by design)",addSpanishLabel:"Add {{labelName}} prop for Spanish-first internationalization"}},create(e){let i={...ye,...e.options[0]},t=i.components||["BirhausButton","BirhausInput","BirhausSelect","BirhausCard"];return {JSXElement(a){Vt(a,t)&&qt(a,i.spanishLabelSuffix).forEach(S=>{e.report({node:a,messageId:"missingSpanishLabel",data:{labelName:S},fix(F){return F.insertTextBefore(a,`${S}="[TODO: Spanish text]" `)}});});}}}},Ce={meta:{type:"problem",docs:{description:"Forbid confirmation dialogs in favor of undo patterns",category:"BIRHAUS Principles",recommended:true},fixable:void 0,schema:[],messages:{confirmationDialogFound:"Confirmation dialog detected (BIRHAUS Principle #5: Undo over confirm)",useUndoPattern:"Replace confirmation with undo functionality for better UX"}},create(e){let i=[/confirm/i,/¿está\s+seguro\?/i,/are\s+you\s+sure\?/i,/delete.*confirmation/i,/eliminar.*confirmación/i];return {JSXElement(t){Ot(t,i)&&e.report({node:t,messageId:"confirmationDialogFound"});},CallExpression(t){t.callee.type==="MemberExpression"&&t.callee.object.name==="window"&&t.callee.property.name==="confirm"&&e.report({node:t,messageId:"confirmationDialogFound"}),t.callee.type==="Identifier"&&t.callee.name==="confirm"&&e.report({node:t,messageId:"confirmationDialogFound"});}}}},Ee={meta:{type:"problem",docs:{description:"Limit form fields per form to reduce cognitive load",category:"BIRHAUS Principles",recommended:true},fixable:void 0,schema:[{type:"object",properties:{maxFields:{type:"integer",minimum:1,maximum:15,default:7}},additionalProperties:false}],messages:{tooManyFormFields:"Form has {{count}} fields (BIRHAUS Principle #4: max {{max}} recommended)",useProgressiveDisclosure:"Consider using multi-step forms or progressive disclosure for better UX"}},create(e){let i={...ye,...e.options[0]};return {JSXElement(t){if(Ft(t)){let a=Ht(t);a>i.maxFormFields&&e.report({node:t,messageId:"tooManyFormFields",data:{count:a.toString(),max:i.maxFormFields.toString()}});}}}}},Se={meta:{type:"problem",docs:{description:"Enforce accessibility requirements for BIRHAUS components",category:"BIRHAUS Principles",recommended:true},fixable:"code",schema:[],messages:{missingAltText:"Image missing alt text (BIRHAUS Principle #6: Accessibility = dignity)",missingAriaLabel:"Interactive element missing aria-label (BIRHAUS Principle #6)",addAccessibilityAttribute:"Add {{attribute}} for accessibility compliance"}},create(e){return {JSXElement(i){zt(i)&&!fe(i,"alt")&&e.report({node:i,messageId:"missingAltText",fix(t){return t.insertTextBefore(i,'alt="[TODO: Describe image]" ')}}),Dt(i)&&!Jt(i)&&e.report({node:i,messageId:"missingAriaLabel",data:{attribute:"aria-label"}});}}}};function Tt(e){let i=re(e);return ["nav","Navigation","NavBar","Menu"].includes(i)}function Vt(e,i){let t=re(e);return i.includes(t)}function Ft(e){let i=re(e);return ["form","Form","BirhausForm"].includes(i)}function zt(e){return re(e)==="img"}function Dt(e){let i=re(e);return ["button","a","input","select","textarea"].includes(i.toLowerCase())}function re(e){return e.openingElement.name.type==="JSXIdentifier"?e.openingElement.name.name:""}function Ut(e){let i=0;function t(a){if(a.type==="JSXElement"){let E=re(a);["a","button","Link","NavLink"].includes(E)&&i++,a.children&&a.children.forEach(t);}}return e.children&&e.children.forEach(t),i}function Ht(e){let i=0;function t(a){if(a.type==="JSXElement"){let E=re(a);["input","select","textarea","BirhausInput","BirhausSelect"].includes(E)&&i++,a.children&&a.children.forEach(t);}}return e.children&&e.children.forEach(t),i}function qt(e,i){let t=[],a=e.openingElement.attributes||[];return ["label","title","placeholder","buttonText","description"].forEach(S=>{if(a.some(A=>A.type==="JSXAttribute"&&A.name?.type==="JSXIdentifier"&&A.name?.name===S)){let A=S+i;a.some(k=>k.type==="JSXAttribute"&&k.name?.type==="JSXIdentifier"&&k.name?.name===A)||t.push(A);}}),t}function Ot(e,i){let t=jt(e);return i.some(a=>a.test(t))}function fe(e,i){return (e.openingElement.attributes||[]).some(a=>a.type==="JSXAttribute"&&a.name?.type==="JSXIdentifier"&&a.name?.name===i)}function Jt(e){return fe(e,"aria-label")||fe(e,"aria-labelledby")||fe(e,"title")}function jt(e){let i="";function t(a){a.type==="JSXText"?i+=a.value:a.type==="JSXElement"&&a.children&&a.children.forEach(t);}return e.children&&e.children.forEach(t),i}var Me={"miller-law-navigation":Ne,"spanish-first-labels":we,"forbid-confirmation-dialogs":Ce,"form-field-limits":Ee,"accessibility-requirements":Se},Ve={rules:Me,configs:{recommended:{plugins:["@birhaus"],rules:{"@birhaus/miller-law-navigation":"error","@birhaus/spanish-first-labels":"warn","@birhaus/forbid-confirmation-dialogs":"error","@birhaus/form-field-limits":"warn","@birhaus/accessibility-requirements":"error"}},strict:{plugins:["@birhaus"],rules:{"@birhaus/miller-law-navigation":"error","@birhaus/spanish-first-labels":"error","@birhaus/forbid-confirmation-dialogs":"error","@birhaus/form-field-limits":"error","@birhaus/accessibility-requirements":"error"}}}};export{st as BirhausCognitiveLoadMeterV3,wt as BirhausDevToolsV3,Bt as BirhausPerformanceMonitorV3,$e as CognitiveLoadMeter,Se as accessibilityRequirementsRule,Ve as birhausPlugin,Me as birhausRules,Ce as forbidConfirmationDialogsRule,Ee as formFieldLimitsRule,Ne as millerLawNavigationRule,we as spanishFirstLabelsRule,Ge as useCognitiveLoadAnalysis};//# sourceMappingURL=index.mjs.map //# sourceMappingURL=index.mjs.map