{
  "version": 3,
  "sources": ["ssg:https://framer.com/m/final-nTgm.js@Bs9TqxHd7TduJ7MUA4hx"],
  "sourcesContent": ["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsOnFramerCanvas}from\"framer\";import{useEffect,useRef}from\"react\";import{useErrorAlert}from\"https://framerusercontent.com/modules/uaC9hWf3ec7HqMv3sXMc/CvMGzbirJDY4adFEJwd3/Hooks.js\";import{useCollectionStore}from\"https://framerusercontent.com/modules/oaAH7umUjUOTeKmykfom/QUgwaKJzm3ppWZi5RkAd/Stores.js\";import{findActiveFilter}from\"https://framerusercontent.com/modules/NktNXvnf4m4T7jKQcOHx/tE0GTXnTLinhu2bnx5vZ/Utilities.js\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n *\n * @framerDisableUnlink\n */export default function UncodeShared(props){var _collection_fieldsByName__cmsFieldName_activeFilters,_collection_fieldsByName__cmsFieldName;const{_collectionName,_cmsFieldName,_filterIsActive,_onApplyFilter,_onReset,_preserveFilter,condition,hasError:hasComponentError,fieldsPlusComponent,value}=props;const collectionName=_collectionName===null||_collectionName===void 0?void 0:_collectionName.trim();const cmsFieldName=_cmsFieldName===null||_cmsFieldName===void 0?void 0:_cmsFieldName.trim();const[store,setStore]=useCollectionStore();const collection=store===null||store===void 0?void 0:store[collectionName];const collectionIsInitialized=!!collection;const isOnFramerCanvas=useIsOnFramerCanvas();const{addErrorMessage,hasError:hasBaseError}=useErrorAlert({alertDelay:1e3});const needsTransitionCheckRef=useRef(true);const hasError=hasBaseError||hasComponentError// error handling for base requirements, all components require the _collectionName, _cmsFieldName\n;useEffect(()=>{const component=collectionName&&cmsFieldName?`for '${collectionName}: ${cmsFieldName}' `:\"\";if(!collectionName)addErrorMessage(`${fieldsPlusComponent} requires the 'Collection Name'.`);if(!cmsFieldName)addErrorMessage(`${fieldsPlusComponent} requires the 'Field Name'.`);},[collectionName,cmsFieldName,_onApplyFilter,_onReset])// applies an removes filters while keeping the variants in sync\n;useEffect(()=>{if(!isOnFramerCanvas&&collectionIsInitialized&&!needsTransitionCheckRef.current&&!hasError){var _collection_fieldsByName__cmsFieldName_activeFilters;const hasThisFilter=!!((_collection_fieldsByName__cmsFieldName_activeFilters=collection.fieldsByName[_cmsFieldName].activeFilters)===null||_collection_fieldsByName__cmsFieldName_activeFilters===void 0?void 0:_collection_fieldsByName__cmsFieldName_activeFilters.find(currentFilter=>findActiveFilter({currentFilter,target:{value,condition}})))// apply the filter if it's not already active, or remove it if it's currently active\n;if(_filterIsActive&&!hasThisFilter){setStore(prev=>({...prev,[collectionName]:{...prev[collectionName],renderKey:Math.floor(Math.random()*1e5),fieldsByName:{...prev[collectionName].fieldsByName,[_cmsFieldName]:{...prev[collectionName].fieldsByName[_cmsFieldName],activeFilters:[...prev[collectionName].fieldsByName[_cmsFieldName].activeFilters,{value,condition}]}}}}));}else if(!_filterIsActive&&hasThisFilter){setStore(prev=>({...prev,[collectionName]:{...prev[collectionName],renderKey:Math.floor(Math.random()*1e5),fieldsByName:{...prev[collectionName].fieldsByName,[_cmsFieldName]:{...prev[collectionName].fieldsByName[_cmsFieldName],activeFilters:prev[collectionName].fieldsByName[_cmsFieldName].activeFilters.filter(currentFilter=>!findActiveFilter({currentFilter,target:{value,condition}}))}}}}));}}},[collectionIsInitialized,_filterIsActive])// when the filter is cleared externally, this syncs the variant back to inactive/reset\n;useEffect(()=>{if(!isOnFramerCanvas&&collectionIsInitialized&&!needsTransitionCheckRef.current&&!hasError){var _collection_fieldsByName__cmsFieldName_activeFilters,_collection_fieldsByName__cmsFieldName;const isClear=(collection===null||collection===void 0?void 0:(_collection_fieldsByName__cmsFieldName=collection.fieldsByName[_cmsFieldName])===null||_collection_fieldsByName__cmsFieldName===void 0?void 0:(_collection_fieldsByName__cmsFieldName_activeFilters=_collection_fieldsByName__cmsFieldName.activeFilters)===null||_collection_fieldsByName__cmsFieldName_activeFilters===void 0?void 0:_collection_fieldsByName__cmsFieldName_activeFilters.length)===0;if(isClear&&_filterIsActive)_onReset===null||_onReset===void 0?void 0:_onReset();}},[_cmsFieldName,(collection===null||collection===void 0?void 0:(_collection_fieldsByName__cmsFieldName=collection.fieldsByName[_cmsFieldName])===null||_collection_fieldsByName__cmsFieldName===void 0?void 0:(_collection_fieldsByName__cmsFieldName_activeFilters=_collection_fieldsByName__cmsFieldName.activeFilters)===null||_collection_fieldsByName__cmsFieldName_activeFilters===void 0?void 0:_collection_fieldsByName__cmsFieldName_activeFilters.length)===0])// on initial mount, check if transition is needed to sync variant states\n;useEffect(()=>{if(!isOnFramerCanvas&&collectionIsInitialized&&!hasError){var _collection_fieldsByName__cmsFieldName_activeFilters,_collection_fieldsByName__cmsFieldName;needsTransitionCheckRef.current=false;const hasThisFilter=!!((_collection_fieldsByName__cmsFieldName=collection.fieldsByName[_cmsFieldName])===null||_collection_fieldsByName__cmsFieldName===void 0?void 0:(_collection_fieldsByName__cmsFieldName_activeFilters=_collection_fieldsByName__cmsFieldName.activeFilters)===null||_collection_fieldsByName__cmsFieldName_activeFilters===void 0?void 0:_collection_fieldsByName__cmsFieldName_activeFilters.find(currentFilter=>findActiveFilter({currentFilter,target:{value,condition}})))// sync the variant\n;// if this filter is inactive, but the collection has this filter applied, then transition\nif(!_filterIsActive&&hasThisFilter)_onApplyFilter===null||_onApplyFilter===void 0?void 0:_onApplyFilter()// otherwise, if this filter is active, but the collection doesn't have this filter applied, then transition\n;if(_filterIsActive&&!hasThisFilter)_onReset===null||_onReset===void 0?void 0:_onReset();}return()=>{if(!isOnFramerCanvas&&collectionIsInitialized&&!hasError&&!_preserveFilter){setStore(prev=>({...prev,[collectionName]:{...prev[collectionName],renderKey:Math.floor(Math.random()*1e5),fieldsByName:{...prev[collectionName].fieldsByName,[_cmsFieldName]:{...prev[collectionName].fieldsByName[_cmsFieldName],activeFilters:prev[collectionName].fieldsByName[_cmsFieldName].activeFilters.filter(currentFilter=>!findActiveFilter({currentFilter,target:{value,condition}}))}}}}));}};},[collectionIsInitialized,hasError,value]);return /*#__PURE__*/_jsx(_Fragment,{});}UncodeShared.displayName=\"Base Filter\";addPropertyControls(UncodeShared,{_onApplyFilter:{type:ControlType.EventHandler,title:\"Aplicar\"},_onReset:{type:ControlType.EventHandler,title:\"Remover\"},_filterIsActive:{type:ControlType.Boolean,title:\"Filter\",defaultValue:false,description:\"Apply the filter.\",hidden:()=>true},_preserveFilter:{type:ControlType.Boolean,title:\"Preserve\",defaultValue:true,hidden:()=>true,description:\"Mant\\xe9m o filtro ativo quando se navega entre p\\xe1ginas, caso contr\\xe1rio, o filtro sempre ser\\xe1 reiniciado / Keeps the filter active when browsing between pages, otherwise the filter will always be reset..\"},_collectionName:{type:ControlType.String,title:\"Collection Name\",defaultValue:\"\",description:\"Deve corresponder exatamente ao nome da cole\\xe7\\xe3o / Must match exactly as the collection is named.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./final.map"],
  "mappings": "sNAAAA,IAKkB,SAARC,EAA8BC,EAAM,CAAC,IAAIC,EAAqDC,EAAuC,GAAK,CAAC,gBAAAC,EAAgB,cAAAC,EAAc,gBAAAC,EAAgB,eAAAC,EAAe,SAAAC,EAAS,gBAAAC,EAAgB,UAAAC,EAAU,SAASC,EAAkB,oBAAAC,EAAoB,MAAAC,CAAK,EAAEZ,EAAYa,EAAuEV,GAAgB,KAAK,EAAQW,EAAiEV,GAAc,KAAK,EAAO,CAACW,EAAMC,CAAQ,EAAEC,EAAmB,EAAQC,EAA+CH,IAAMF,CAAc,EAAQM,EAAwB,CAAC,CAACD,EAAiBE,EAAiBC,EAAoB,EAAO,CAAC,gBAAAC,EAAgB,SAASC,CAAY,EAAEC,EAAc,CAAC,WAAW,GAAG,CAAC,EAAQC,EAAwBC,EAAO,EAAI,EAAQC,EAASJ,GAAcb,EACn1B,OAAAkB,EAA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AGoB,EAAKpB,CAAc,EAAE,UAAU,KAAK,MAAM,KAAK,OAAO,EAAE,GAAG,EAAE,aAAa,CAAC,GAAGoB,EAAKpB,CAAc,EAAE,aAAa,CAACT,CAAa,EAAE,CAAC,GAAG6B,EAAKpB,CAAc,EAAE,aAAaT,CAAa,EAAE,cAAc6B,EAAKpB,CAAc,EAAE,aAAaT,CAAa,EAAE,cAAc,OAAO2B,GAAe,CAACC,EAAiB,CAAC,cAAAD,EAAc,OAAO,CAAC,MAAAnB,EAAM,UAAAH,CAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAG,CAAE,EAAE,CAACU,EAAwBQ,EAASf,CAAK,CAAC,EAAsBsB,EAAKC,EAAU,CAAC,CAAC,CAAE,CAACpC,EAAa,YAAY,cAAcqC,EAAoBrC,EAAa,CAAC,eAAe,CAAC,KAAKsC,EAAY,aAAa,MAAM,SAAS,EAAE,SAAS,CAAC,KAAKA,EAAY,aAAa,MAAM,SAAS,EAAE,gBAAgB,CAAC,KAAKA,EAAY,QAAQ,MAAM,SAAS,aAAa,GAAM,YAAY,oBAAoB,OAAO,IAAI,EAAI,EAAE,gBAAgB,CAAC,KAAKA,EAAY,QAAQ,MAAM,WAAW,aAAa,GAAK,OAAO,IAAI,GAAK,YAAY,sNAAsN,EAAE,gBAAgB,CAAC,KAAKA,EAAY,OAAO,MAAM,kBAAkB,aAAa,GAAG,YAAY,wGAAwG,CAAC,CAAC",
  "names": ["init_ssg_sandbox_shims", "UncodeShared", "props", "_collection_fieldsByName__cmsFieldName_activeFilters", "_collection_fieldsByName__cmsFieldName", "_collectionName", "_cmsFieldName", "_filterIsActive", "_onApplyFilter", "_onReset", "_preserveFilter", "condition", "hasComponentError", "fieldsPlusComponent", "value", "collectionName", "cmsFieldName", "store", "setStore", "useCollectionStore", "collection", "collectionIsInitialized", "isOnFramerCanvas", "useIsOnFramerCanvas", "addErrorMessage", "hasBaseError", "useErrorAlert", "needsTransitionCheckRef", "pe", "hasError", "ue", "component", "hasThisFilter", "currentFilter", "findActiveFilter", "prev", "p", "l", "addPropertyControls", "ControlType"]
}
