{"version":3,"file":"FormationFilter.rlbNLPti.mjs","names":["useRef","useCallback"],"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":"qJASyG,SAAgB,EAAoB,EAAU,CAAC,OAAO,EAAsB,EAAU,oBAAuB,qBAAqB,CAAE,CAAC,SAAgB,EAAe,EAAU,CAAC,OAAO,EAAsB,EAAU,kBAAqB,gBAAgB,CAAE,CAAC,SAAS,EAAsB,EAAU,EAAiB,EAAa,CAAC,OAAoB,EAAW,SAAyB,EAAM,EAAa,CAAC,IAA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