{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/Uua6HH41VQEb0xszmKqn/FNuqrhvI3eUEvq6YuFtE/FC_CatalogResultCounter.js"],
  "sourcesContent": ["/*\n * Framer Commerce\n * Confidential and Proprietary - All Rights Reserved\n * Unauthorized use, reproduction, distribution, or disclosure of this\n * source code or any related information is strictly prohibited.\n *\n * This software is the exclusive property of Framer Commerce (\"Company\").\n * It is considered highly confidential and proprietary information.\n *\n * Any use, copying, modification, distribution, or sharing of this software,\n * in whole or in part, without the express written permission of the Company\n * is strictly prohibited and may result in legal action.\n *\n * DISCLAIMER: This software does not provide any express or\n * implied warranties, including, but not limited to, the implied warranties\n * of merchantability and fitness for a particular purpose. In no event shall\n * Framer Commerce be liable for any direct, indirect, incidental, special,\n * exemplary, or consequential damages (including, but not limited to, procurement\n * of substitute goods or services; loss of use, data, or profits; or business\n * interruption) however caused and on any theory of liability, whether in\n * contract, strict liability, or tort (including negligence or otherwise)\n * arising in any way out of the use of this software, even if advised of\n * the possibility of such damage.\n *\n * Any unauthorized possession, use, copying, distribution, or dissemination\n * of this software will be considered a breach of confidentiality and may\n * result in legal action.\n *\n * For inquiries, contact:\n * Framer Commerce\n * Email: hello@framercommerce.com\n *\n * \u00A9 2025 Butter Supply Inc. All Rights Reserved.\n */import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect,useState}from\"react\";/**\n * @framerIntrinsicWidth 100%\n * @framerIntrinsicHeight auto\n * @framerSupportedLayoutWidth fixed | fill\n * @framerSupportedLayoutHeight fixed | auto\n */// Helper function for consistent logging\nconst logDebug=(component,action,data)=>{console.log(`\uD83D\uDD0D [${component}] ${action}:`,data);};/**\n * @framerDisableUnlink\n */export default function FC_CatalogResultCounter(props){const{content,font,color,transform}=props;// State for search term and result count\nconst[searchTerm,setSearchTerm]=useState(\"\");const[resultCount,setResultCount]=useState(0);// Detect if we're in canvas\nconst isCanvas=()=>{if(typeof window===\"undefined\")return false;try{return window.document?.location?.href.includes(\"framer\")||window.document?.location?.pathname.includes(\"preview\")||!window.document?.location?.host||window.parent!==window;}catch(e){return true;}};// Apply text transform\nconst getTransformedText=(text,transform)=>{switch(transform){case\"Uppercase\":return text.toUpperCase();case\"Lowercase\":return text.toLowerCase();case\"Capitalize\":return text.split(\" \").map(word=>word.charAt(0).toUpperCase()+word.slice(1).toLowerCase()).join(\" \");default:return text;}};// Replace placeholders with actual values\nconst getFormattedText=text=>{const term=isCanvas()&&!searchTerm?\"term\":searchTerm;return text.replace(/\\{\\{term\\}\\}/g,term).replace(/\\{\\{\\#\\}\\}/g,resultCount.toString());};// Get the appropriate text content based on state\nconst getDisplayText=()=>{return content;};// Listen for search events\nuseEffect(()=>{const handleSearchChange=e=>{logDebug(\"SearchResults\",\"Received search event\",e.detail);// Handle different event types\nconst term=e.detail.term||e.detail.search;setSearchTerm(term);if(e.detail.term===\"\"&&e.detail.count){setResultCount(e.detail.count);}};const handleResultsChange=e=>{logDebug(\"SearchResults\",\"Received results count\",e.detail);setResultCount(e.detail.count||0);if(e.detail.search===\"\"){setResultCount(e.detail.count);}};// Check URL for initial search term\nconst updateSearchFromURL=()=>{if(typeof window!==\"undefined\"){const urlParams=new URLSearchParams(window.location.search);const searchParam=urlParams.get(\"search\");if(searchParam){setSearchTerm(searchParam);}}};// Initial URL check\nupdateSearchFromURL();// Listen for URL changes\nwindow.addEventListener(\"popstate\",updateSearchFromURL);// Listen for all search-related events\ndocument.addEventListener(\"product-search-change\",handleSearchChange);document.addEventListener(\"product-search-results\",handleSearchChange);document.addEventListener(\"filter-navigation\",handleSearchChange);document.addEventListener(\"product-search-results\",handleResultsChange);return()=>{window.removeEventListener(\"popstate\",updateSearchFromURL);document.removeEventListener(\"product-search-change\",handleSearchChange);document.removeEventListener(\"filter-navigation\",handleSearchChange);document.removeEventListener(\"product-search-results\",handleResultsChange);};},[]);// Container style\nconst containerStyle={width:\"100%\",height:\"100%\",display:\"flex\",alignItems:\"center\"};// Text style\nconst textStyle={...font,color:color,textTransform:transform.toLowerCase()};return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,children:/*#__PURE__*/_jsx(\"span\",{style:textStyle,children:getTransformedText(getFormattedText(getDisplayText()),transform)})});}FC_CatalogResultCounter.defaultProps={content:\"{{#}} items\",font:{family:\"Inter\",fontSize:16,weight:400},color:\"#000000\",transform:\"None\"};addPropertyControls(FC_CatalogResultCounter,{content:{type:ControlType.String,title:\"Text\",defaultValue:\"{{#}} items\",description:\"Use {{#}} for item count. \\n \\n If on a dedicated Search page, use {{term}} for the search value.\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"#000000\"},transform:{type:ControlType.Enum,title:\"Transform\",options:[\"None\",\"Uppercase\",\"Lowercase\",\"Capitalize\"],defaultValue:\"None\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"FC_CatalogResultCounter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./FC_CatalogResultCounter.map"],
  "mappings": "gJAuCA,IAAMA,EAAS,CAACC,EAAUC,EAAOC,IAAO,CAAC,QAAQ,IAAI,cAAOF,CAAS,KAAKC,CAAM,IAAIC,CAAI,CAAE,EAExE,SAARC,EAAyCC,EAAM,CAAC,GAAK,CAAC,QAAAC,EAAQ,KAAAC,EAAK,MAAAC,EAAM,UAAAC,CAAS,EAAEJ,EACzF,CAACK,EAAWC,CAAa,EAAEC,EAAS,EAAE,EAAO,CAACC,EAAYC,CAAc,EAAEF,EAAS,CAAC,EACnFG,EAAS,IAAI,CAAC,GAAG,OAAOC,EAAS,IAAY,MAAO,GAAM,GAAG,CAAC,OAAOA,EAAO,UAAU,UAAU,KAAK,SAAS,QAAQ,GAAGA,EAAO,UAAU,UAAU,SAAS,SAAS,SAAS,GAAG,CAACA,EAA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AwBH,CAAkB,EAAE,SAAS,iBAAiB,yBAAyBA,CAAkB,EAAE,SAAS,iBAAiB,oBAAoBA,CAAkB,EAAE,SAAS,iBAAiB,yBAAyBE,CAAmB,EAAQ,IAAI,CAACV,EAAO,oBAAoB,WAAWW,CAAmB,EAAE,SAAS,oBAAoB,wBAAwBH,CAAkB,EAAE,SAAS,oBAAoB,oBAAoBA,CAAkB,EAAE,SAAS,oBAAoB,yBAAyBE,CAAmB,CAAE,CAAE,EAAE,CAAC,CAAC,EAC5jB,IAAMG,EAAe,CAAC,MAAM,OAAO,OAAO,OAAO,QAAQ,OAAO,WAAW,QAAQ,EAC7EC,EAAU,CAAC,GAAGvB,EAAK,MAAMC,EAAM,cAAcC,EAAU,YAAY,CAAC,EAAE,OAAoBsB,EAAK,MAAM,CAAC,MAAMF,EAAe,SAAsBE,EAAK,OAAO,CAAC,MAAMD,EAAU,SAASb,EAAmBG,EAAiBE,EAAe,CAAC,EAAEb,CAAS,CAAC,CAAC,CAAC,CAAC,CAAE,CAACL,EAAwB,aAAa,CAAC,QAAQ,cAAc,KAAK,CAAC,OAAO,QAAQ,SAAS,GAAG,OAAO,GAAG,EAAE,MAAM,UAAU,UAAU,MAAM,EAAE4B,EAAoB5B,EAAwB,CAAC,QAAQ,CAAC,KAAK6B,EAAY,OAAO,MAAM,OAAO,aAAa,cAAc,YAAY;AAAA;AAAA,mEAAmG,EAAE,KAAK,CAAC,KAAKA,EAAY,KAAK,MAAM,OAAO,SAAS,UAAU,EAAE,MAAM,CAAC,KAAKA,EAAY,MAAM,MAAM,QAAQ,aAAa,SAAS,EAAE,UAAU,CAAC,KAAKA,EAAY,KAAK,MAAM,YAAY,QAAQ,CAAC,OAAO,YAAY,YAAY,YAAY,EAAE,aAAa,MAAM,CAAC,CAAC",
  "names": ["logDebug", "component", "action", "data", "FC_CatalogResultCounter", "props", "content", "font", "color", "transform", "searchTerm", "setSearchTerm", "ye", "resultCount", "setResultCount", "isCanvas", "window", "getTransformedText", "text", "word", "getFormattedText", "term", "getDisplayText", "ue", "handleSearchChange", "e", "handleResultsChange", "updateSearchFromURL", "searchParam", "containerStyle", "textStyle", "p", "addPropertyControls", "ControlType"]
}
