{"version":3,"file":"FilterAndSearch.nQJb3P_a.mjs","names":["useState","React","e"],"sources":["https:/framerusercontent.com/modules/xrX60ttDWuyGlWWPuKdo/jU2E2XzEXXQP95ydsGvS/FilterAndSearch.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import React,{useState,useEffect}from\"react\";//\n// GLOBAL FILTER STATE\n//\nlet currentFilters={entity:\"all\",country:\"all\",search:\"\",visibleCards:new Set,entityOptions:new Set,countryOptions:new Set};//\n// UTILITY — NORMALISE STRINGS\n//\nconst normalise=v=>(v||\"\").toString().toLowerCase().trim();/* -------------------------------------------------------------------------- *//*                              ENTITY DROPDOWN                               *//* -------------------------------------------------------------------------- */export function EntityDropdown(Component){return props=>{const[isOpen,setIsOpen]=useState(false);const[selected,setSelected]=useState(\"Entity (All)\");const[options,setOptions]=useState([\"Entity (All)\"]);const dropdownRef=React.useRef(null);useEffect(()=>{const updateOptions=()=>{setOptions([\"Entity (All)\",...Array.from(currentFilters.entityOptions).sort()]);};updateOptions();const interval=setInterval(updateOptions,300);return()=>clearInterval(interval);},[]);const handleSelect=option=>{setSelected(option);setIsOpen(false);const clean=option.toLowerCase().includes(\"(all)\")?\"all\":normalise(option);currentFilters.entity=clean;setTimeout(()=>{window.dispatchEvent(new CustomEvent(\"entityFilter\",{detail:{...currentFilters}}));},50);};return /*#__PURE__*/_jsxs(\"div\",{ref:dropdownRef,style:{position:\"relative\",width:\"100%\",minWidth:\"150px\"},children:[/*#__PURE__*/_jsxs(\"button\",{onClick:e=>{e.stopPropagation();setIsOpen(!isOpen);},style:{width:\"100%\",padding:\"16px\",backgroundColor:\"#1e3a5f\",color:\"white\",border:\"1px solid rgba(255, 255, 255, 0.2)\",borderRadius:\"4px\",cursor:\"pointer\",textAlign:\"left\",fontSize:\"14px\",display:\"flex\",justifyContent:\"space-between\",alignItems:\"center\",fontFamily:\"inherit\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{textTransform:\"capitalize\"},children:selected}),/*#__PURE__*/_jsx(\"span\",{style:{transform:isOpen?\"rotate(180deg)\":\"rotate(0deg)\",transition:\"transform 0.3s ease\",color:\"#899091\"},children:\"▼\"})]}),isOpen&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"100%\",left:0,right:0,backgroundColor:\"#1e3a5f\",border:\"1px solid rgba(255, 255, 255, 0.2)\",borderTop:\"none\",borderRadius:\"0 0 4px 4px\",maxHeight:\"400px\",overflowY:\"auto\",zIndex:1e3,marginTop:\"2px\"},children:options.map((option,idx)=>/*#__PURE__*/_jsx(\"div\",{onClick:()=>handleSelect(option),style:{padding:\"12px 16px\",cursor:\"pointer\",color:\"white\",borderBottom:idx<options.length-1?\"1px solid rgba(255, 255, 255, 0.1)\":\"none\",transition:\"background 0.2s ease\"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=\"rgba(255, 255, 255, 0.1)\";},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=\"transparent\";},children:/*#__PURE__*/_jsx(\"span\",{style:{textTransform:\"capitalize\"},children:option})},option))})]});};}/* -------------------------------------------------------------------------- *//*                              COUNTRY DROPDOWN                              *//* -------------------------------------------------------------------------- */export function CountryDropdown(Component){return props=>{const[isOpen,setIsOpen]=useState(false);const[selected,setSelected]=useState(\"Country (All)\");const[options,setOptions]=useState([\"Country (All)\"]);const dropdownRef=React.useRef(null);useEffect(()=>{const updateOptions=()=>{setOptions([\"Country (All)\",...Array.from(currentFilters.countryOptions).sort()]);};updateOptions();const interval=setInterval(updateOptions,300);return()=>clearInterval(interval);},[]);const handleSelect=option=>{setSelected(option);setIsOpen(false);const clean=option.toLowerCase().includes(\"(all)\")?\"all\":normalise(option);currentFilters.country=clean;setTimeout(()=>{window.dispatchEvent(new CustomEvent(\"entityFilter\",{detail:{...currentFilters}}));},50);};return /*#__PURE__*/_jsxs(\"div\",{ref:dropdownRef,style:{position:\"relative\",width:\"100%\",minWidth:\"150px\"},children:[/*#__PURE__*/_jsxs(\"button\",{onClick:e=>{e.stopPropagation();setIsOpen(!isOpen);},style:{width:\"100%\",padding:\"16px\",backgroundColor:\"#1e3a5f\",color:\"white\",border:\"1px solid rgba(255, 255, 255, 0.2)\",borderRadius:\"4px\",cursor:\"pointer\",textAlign:\"left\",fontSize:\"14px\",display:\"flex\",justifyContent:\"space-between\",alignItems:\"center\",fontFamily:\"inherit\"},children:[/*#__PURE__*/_jsx(\"span\",{style:{textTransform:\"capitalize\"},children:selected}),/*#__PURE__*/_jsx(\"span\",{style:{transform:isOpen?\"rotate(180deg)\":\"rotate(0deg)\",transition:\"transform 0.3s ease\",color:\"#899091\"},children:\"▼\"})]}),isOpen&&/*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",top:\"100%\",left:0,right:0,backgroundColor:\"#1e3a5f\",border:\"1px solid rgba(255, 255, 255, 0.2)\",borderTop:\"none\",borderRadius:\"0 0 4px 4px\",maxHeight:\"400px\",overflowY:\"auto\",zIndex:1e3,marginTop:\"2px\"},children:options.map((option,idx)=>/*#__PURE__*/_jsx(\"div\",{onClick:()=>handleSelect(option),style:{padding:\"12px 16px\",cursor:\"pointer\",color:\"white\",borderBottom:idx<options.length-1?\"1px solid rgba(255, 255, 255, 0.1)\":\"none\",transition:\"background 0.2s ease\"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor=\"rgba(255, 255, 255, 0.1)\";},onMouseLeave:e=>{e.currentTarget.style.backgroundColor=\"transparent\";},children:/*#__PURE__*/_jsx(\"span\",{style:{textTransform:\"capitalize\"},children:option})},option))})]});};}/* -------------------------------------------------------------------------- *//*                                   SEARCH                                   *//* -------------------------------------------------------------------------- */export function SearchInput(Component){return props=>{const handleChange=e=>{currentFilters.search=normalise(e.target.value);window.dispatchEvent(new CustomEvent(\"entityFilter\",{detail:{...currentFilters}}));props.onChange?.(e);};return /*#__PURE__*/_jsx(Component,{...props,onChange:handleChange});};}/* -------------------------------------------------------------------------- *//*                                NO RESULTS                                   *//* -------------------------------------------------------------------------- */export function NoResultsMessage(Component){return props=>{const[show,setShow]=useState(false);const ref=React.useRef(null);useEffect(()=>{const handler=event=>{const count=event.detail?.count||0;setShow(count===0);};window.addEventListener(\"visibleCountChanged\",handler);return()=>window.removeEventListener(\"visibleCountChanged\",handler);},[]);useEffect(()=>{if(ref.current){ref.current.style.display=show?\"\":\"none\";}},[show]);return /*#__PURE__*/_jsx(Component,{...props,ref:ref,style:{display:\"none\"}});};}/* -------------------------------------------------------------------------- *//*                              PERSON CARD (FADE + STAGGER)                  *//* -------------------------------------------------------------------------- */export function PersonCard(Component){return props=>{const[activeFilters,setActiveFilters]=useState({entity:\"all\",country:\"all\",search:\"\"});const componentRef=React.useRef(null);const cardId=React.useRef(Math.random().toString());const indexRef=React.useRef(0);const entityRaw=props.Entity||props.entity||props.EntityName||props.Name;const entityName=normalise(typeof entityRaw===\"string\"?entityRaw:entityRaw?.name||entityRaw?.Name);const countryRaw=props.Country||props.country||props.CountryName||props.Location;const countryName=normalise(typeof countryRaw===\"string\"?countryRaw:countryRaw?.name||countryRaw?.Name);useEffect(()=>{if(entityName)currentFilters.entityOptions.add(entityName);if(countryName)currentFilters.countryOptions.add(countryName);},[entityName,countryName]);useEffect(()=>{const handler=event=>{const f=event.detail;setActiveFilters({entity:normalise(f.entity),country:normalise(f.country),search:normalise(f.search)});};window.addEventListener(\"entityFilter\",handler);return()=>window.removeEventListener(\"entityFilter\",handler);},[]);const firstName=props.firstName||props.FirstName||props[\"First Name\"]||\"\";const lastName=props.lastName||props.LastName||props[\"Last Name\"]||\"\";const role=props.Role||props.role||\"\";const fullName=normalise(firstName+\" \"+lastName);const roleLower=normalise(role);const entityMatches=activeFilters.entity===\"all\"||activeFilters.entity===\"\"||entityName===activeFilters.entity;const countryMatches=activeFilters.country===\"all\"||activeFilters.country===\"\"||countryName===activeFilters.country;const searchMatches=!activeFilters.search||fullName.includes(activeFilters.search)||roleLower.includes(activeFilters.search);const shouldShow=entityMatches&&countryMatches&&searchMatches;useEffect(()=>{const el=componentRef.current;if(!el)return;const wrapper=el.parentElement?.parentElement;if(!wrapper)return;const itemIndex=indexRef.current;const delay=itemIndex*40;wrapper.style.transition=\"opacity 0.25s ease, transform 0.25s ease\";wrapper.style.transitionDelay=shouldShow?`${delay}ms`:\"0ms\";if(!shouldShow){wrapper.style.opacity=\"0\";wrapper.style.transform=\"scale(0.98)\";setTimeout(()=>{wrapper.style.display=\"none\";currentFilters.visibleCards.delete(cardId.current);emitVisibleCount();},250);}else{wrapper.style.display=\"\";wrapper.style.opacity=\"0\";wrapper.style.transform=\"scale(0.98)\";setTimeout(()=>{wrapper.style.opacity=\"1\";wrapper.style.transform=\"scale(1)\";currentFilters.visibleCards.add(cardId.current);emitVisibleCount();},10);}},[shouldShow]);const emitVisibleCount=()=>{window.dispatchEvent(new CustomEvent(\"visibleCountChanged\",{detail:{count:currentFilters.visibleCards.size}}));};return /*#__PURE__*/_jsx(Component,{...props,ref:componentRef});};}\nexport const __FramerMetadata__ = {\"exports\":{\"PersonCard\":{\"type\":\"reactHoc\",\"name\":\"PersonCard\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"CountryDropdown\":{\"type\":\"reactHoc\",\"name\":\"CountryDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"EntityDropdown\":{\"type\":\"reactHoc\",\"name\":\"EntityDropdown\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"NoResultsMessage\":{\"type\":\"reactHoc\",\"name\":\"NoResultsMessage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"SearchInput\":{\"type\":\"reactHoc\",\"name\":\"SearchInput\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FilterAndSearch.map"],"mappings":"gJAM2S,SAAgB,EAAe,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAO,GAAWA,EAAS,GAAM,CAAM,CAAC,EAAS,GAAaA,EAAS,eAAe,CAAM,CAAC,EAAQ,GAAYA,EAAS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