{"version":3,"file":"Broadcast3.C9IIcLEd.mjs","names":["filteredItems","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/xsmD1HxBzBAEuyDRMP5F/Nxslc9s3CyVNcMERcklc/Broadcast3.js"],"sourcesContent":["// Broadcast 3.1 - Completely rewritten with unique ID and navigation fix\n// Use Broadcaster3 override on your CMS list/grid container\nimport{jsx as _jsx}from\"react/jsx-runtime\";// NEW unique identifier - completely different from old Broadcast.tsx\nconst BROADCAST_ID=\"outline: 2px dashed transparent\";// Clean up all global state - called on each page navigation\nfunction cleanupGlobalState(){console.log(\"Broadcast3: Cleaning up global state\");window.allBroadcastItems=[];window.paginationConfig=undefined;window.paginationComponentExists=false;window.__broadcast3Initialized__=false;// Reset filter selections\nif(window.__msfSelections__){window.__msfSelections__={country:[],airline:[],obt:[]};}}function applyPagination(broadcaster){if(!window.allBroadcastItems||window.allBroadcastItems.length===0){console.log(\"Broadcast3: No items to paginate\");return;}// If no pagination config exists or is disabled, show ALL filtered items\nif(!window.paginationConfig?.isEnabled){console.log(\"Broadcast3: No pagination - showing ALL filtered items\");const filteredItems=window.allBroadcastItems.filter(item=>{const filterAttributes=item.getAttributeNames().filter(name=>name.startsWith(\"data-filter-\"));if(filterAttributes.length>0){return filterAttributes.every(attr=>item.getAttribute(attr)===\"match\");}return true;});// Hide all items first\nwindow.allBroadcastItems.forEach(item=>{item.style.display=\"none\";});// Show ALL filtered items\nfilteredItems.forEach(item=>{item.style.display=\"\";});console.log(`Broadcast3: Showing ${filteredItems.length} filtered items`);return;}// Pagination is enabled\nconst{itemsPerPage,currentPage,mode}=window.paginationConfig;const filteredItems=window.allBroadcastItems.filter(item=>{const filterAttributes=item.getAttributeNames().filter(name=>name.startsWith(\"data-filter-\"));if(filterAttributes.length>0){return filterAttributes.every(attr=>item.getAttribute(attr)===\"match\");}return true;});let itemsToShow=[];if(mode===\"pagination\"){const startIndex=(currentPage-1)*itemsPerPage;const endIndex=startIndex+itemsPerPage;itemsToShow=filteredItems.slice(startIndex,endIndex);}else if(mode===\"loadMore\"||mode===\"autoScroll\"){const totalItemsToShow=currentPage*itemsPerPage;itemsToShow=filteredItems.slice(0,totalItemsToShow);}else{itemsToShow=filteredItems;}// Hide ALL items first\nwindow.allBroadcastItems.forEach(item=>{item.style.display=\"none\";});// Show selected items\nitemsToShow.forEach(item=>{item.style.display=\"\";});console.log(`Broadcast3: Applied ${mode} pagination: showing ${itemsToShow.length} items`);}function initializeGlobalPagination(){if(typeof window===\"undefined\")return;window.updatePagination=function(config){console.log(\"Broadcast3: updatePagination called with:\",config);if(config.isEnabled){if(!window.paginationConfig){window.paginationConfig={itemsPerPage:config.itemsPerPage||12,currentPage:config.currentPage||1,isEnabled:true,mode:config.mode||\"pagination\"};}else{Object.assign(window.paginationConfig,{itemsPerPage:config.itemsPerPage||window.paginationConfig.itemsPerPage,currentPage:config.currentPage||window.paginationConfig.currentPage,isEnabled:config.isEnabled??window.paginationConfig.isEnabled,mode:config.mode||window.paginationConfig.mode});}window.paginationComponentExists=true;}else{window.paginationConfig=undefined;window.paginationComponentExists=false;}// Find broadcaster with NEW identifier\nconst broadcasterElements=document.querySelectorAll(`[style*=\"outline: 2px dashed transparent\"]`);if(broadcasterElements.length>0){applyPagination(broadcasterElements[0]);}};}// Initialize pagination function\ninitializeGlobalPagination();export function Broadcaster3(){return{style:{outline:\"2px dashed transparent\"},animate:{scale:1,transition:{duration:.1}},onAnimationComplete(){console.log(\"Broadcast3: Initializing...\");// Always clean up first to handle SPA navigation\ncleanupGlobalState();// Re-initialize pagination function\ninitializeGlobalPagination();// Small delay to ensure DOM is ready after navigation\nsetTimeout(()=>{const broadcasterElements=document.querySelectorAll(`[style*=\"outline: 2px dashed transparent\"]`);console.log(\"Broadcast3: Found broadcaster elements:\",broadcasterElements.length);if(broadcasterElements.length>0){const broadcaster=broadcasterElements[0];// Store all items\nwindow.allBroadcastItems=Array.from(broadcaster.children);console.log(`Broadcast3: Stored ${window.allBroadcastItems.length} items`);// Mark as initialized\nwindow.__broadcast3Initialized__=true;// Apply initial display\napplyPagination(broadcaster);}else{console.log(\"Broadcast3: No broadcaster found!\");}},50);}};}export function BroadcastListener3(){return{animate:{scale:1,transition:{duration:.1}},onAnimationComplete(){console.log(\"Broadcast3: Listener activated\");},onTap(){console.log(\"Broadcast3: Removing last item\");if(window.allBroadcastItems&&window.allBroadcastItems.length>0){const lastItem=window.allBroadcastItems.pop();if(lastItem&&lastItem.parentNode){lastItem.parentNode.removeChild(lastItem);const broadcasterElements=document.querySelectorAll(`[style*=\"outline: 2px dashed transparent\"]`);if(broadcasterElements.length>0){applyPagination(broadcasterElements[0]);}}}}};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withBroadcaster3(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...Broadcaster3(props)});};}withBroadcaster3.displayName=\"Broadcaster3\";export function withBroadcastListener3(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...BroadcastListener3(props)});};}withBroadcastListener3.displayName=\"BroadcastListener3\";\nexport const __FramerMetadata__ = {\"exports\":{\"BroadcastListener3\":{\"type\":\"override\",\"name\":\"BroadcastListener3\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"Broadcaster3\":{\"type\":\"override\",\"name\":\"Broadcaster3\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withBroadcaster3\":{\"type\":\"reactHoc\",\"name\":\"withBroadcaster3\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"withBroadcastListener3\":{\"type\":\"reactHoc\",\"name\":\"withBroadcastListener3\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Broadcast3.map"],"mappings":"4KAIA,SAAS,GAAoB,CAAC,QAAQ,IAAI,uCAAuC,CAAC,E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