{"version":3,"file":"FormationFilter.BaUDfndI.mjs","names":["useRef","useCallback","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","ce","init_jsx_runtime","ne","J","de","withFormationFilter","withFilterPlaceholder","Component","withAreaFilter","rootRef","observerRef","applyRef","attachRef","node","forwardedRef","warnedMissingUnset","apply","root","select","options","noneOptions","option","selectedNone","unset","placeholderLabel","setter","overrideName","observer","props","init_FormationFilter"],"sources":["https:/framerusercontent.com/modules/0AvDncx6AAOCKDeXw19g/1MB2eoH3AAn8HzddgaKa/FormationFilter.js"],"sourcesContent":["/**\n * Override the existing bound native select without replacing CMS/URL binding,\n * styling, refs, or handlers. Hide/disable only the literal CMS case \"None\";\n * preserve Carreras, Cursos, Diplomaturas and all option values. Rename the\n * existing empty/unset option to \"Tipo de formación\" for withFormationFilter,\n * or \"Área de estudio\" for withAreaFilter, using a reusable label helper.\n * Preserve the existing implementation and manual edits. Reset a selected None\n * using the native value setter and a bubbling change. Observe regenerated\n * options locally with checked writes and cleanup; never invent an unset value.\n */import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useCallback,useEffect,useRef}from\"react\";export function withFormationFilter(Component){return withFilterPlaceholder(Component,\"Tipo de formaci\\xf3n\",\"withFormationFilter\");}export function withAreaFilter(Component){return withFilterPlaceholder(Component,\"\\xc1rea de estudio\",\"withAreaFilter\");}function withFilterPlaceholder(Component,placeholderLabel,overrideName){return /*#__PURE__*/forwardRef(function FormationFilter(props,forwardedRef){const rootRef=useRef(null);const observerRef=useRef(null);const applyRef=useRef(null);const attachRef=useCallback(node=>{rootRef.current=node;observerRef.current?.disconnect();if(node&&observerRef.current){observerRef.current.observe(node,{subtree:true,childList:true,characterData:true,attributes:true,attributeFilter:[\"value\",\"selected\",\"label\",\"hidden\",\"disabled\"]});applyRef.current?.();}if(typeof forwardedRef===\"function\")forwardedRef(node);else if(forwardedRef){forwardedRef.current=node;}},[forwardedRef]);useEffect(()=>{if(typeof window===\"undefined\")return;let warnedMissingUnset=false;const apply=()=>{const root=rootRef.current;if(!root)return;const select=root.tagName===\"SELECT\"?root:root.querySelector(\"select\");if(!select)return;const options=Array.from(select.options);const noneOptions=options.filter(option=>option.text.trim()===\"None\");const selectedNone=noneOptions.some(option=>option.selected);// Only the existing empty value is a known safe unset binding.\nconst unset=options.find(option=>option.value===\"\"&&!noneOptions.includes(option));for(const option of noneOptions){if(!option.hidden)option.hidden=true;if(!option.disabled)option.disabled=true;}if(unset){// Setting text without an explicit value would change its value.\nif(!unset.hasAttribute(\"value\"))unset.setAttribute(\"value\",\"\");if(unset.text!==placeholderLabel){unset.text=placeholderLabel;}if(unset.hasAttribute(\"label\")&&unset.label!==placeholderLabel){unset.label=placeholderLabel;}if(selectedNone){const setter=Object.getOwnPropertyDescriptor(window.HTMLSelectElement.prototype,\"value\")?.set;if(setter){setter.call(select,unset.value);select.dispatchEvent(new window.Event(\"change\",{bubbles:true}));}}}else if(noneOptions.length&&!warnedMissingUnset){warnedMissingUnset=true;console.warn(`${overrideName}: no existing empty/unset option; `+\"cannot rename a reset option or safely reset None. \"+\"No binding value was invented.\");}};applyRef.current=apply;if(typeof MutationObserver!==\"undefined\"){const observer=new MutationObserver(apply);observerRef.current=observer;if(rootRef.current){observer.observe(rootRef.current,{subtree:true,childList:true,characterData:true,attributes:true,attributeFilter:[\"value\",\"selected\",\"label\",\"hidden\",\"disabled\"]});}}apply();return()=>{observerRef.current?.disconnect();observerRef.current=null;applyRef.current=null;};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:attachRef});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withFormationFilter\":{\"type\":\"reactHoc\",\"name\":\"withFormationFilter\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withAreaFilter\":{\"type\":\"reactHoc\",\"name\":\"withAreaFilter\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FormationFilter.map"],"mappings":"A,qJASyG,SAAgBW,E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