{"version":3,"file":"UseSlotHub.B0_C6cmR.mjs","names":["isValidElement"],"sources":["https:/framerusercontent.com/modules/1W7noyth7QLNnPL2T0WL/AvXgAMN6S2ZQyL4rhDOT/UseSlotHub.js"],"sourcesContent":["import{isValidElement}from\"react\";// ═══════════════════════════════════════════════════════════════════════════════\n// USE SLOT HUB\n//\n// Extracts ComponentInstance slots from a SlotHub ReactNode.\n// Framer wraps ComponentInstance in 2 layers before the actual component:\n//   depth 0: Framer container { children }\n//   depth 1: Framer node wrapper { children, nodeId, ... }\n//   depth 2: SlotHub { slot0, slot1, ..., slotN }\n//\n// Usage:\n//   const slots = extractSlots(hubSlotNode)\n//   // slots[0] = ReactNode (Rive component)\n//   // slots[1] = ReactNode (Lottie component)\n//   // ...\n// ═══════════════════════════════════════════════════════════════════════════════\nconst MAX_UNWRAP_DEPTH=6;const MAX_SLOTS=30;/**\n * Unwrap Framer's wrapper layers to find the actual component element.\n * Returns the first element whose props contain `slot0`.\n */function findHubElement(node){let current=node;// Normalize Framer's array wrapping\nif(Array.isArray(current)&&current.length>0)current=current[0];for(let depth=0;depth<MAX_UNWRAP_DEPTH;depth++){if(!/*#__PURE__*/isValidElement(current))return null;const el=current;// Check if this element has slot props\nif(el.props.slot0!==undefined)return el;// Go deeper via children\nconst ch=el.props.children;if(/*#__PURE__*/isValidElement(ch)){current=ch;}else if(Array.isArray(ch)&&ch.length>0){current=ch.find(isValidElement)||null;if(!current)return null;}else{return null;}}return null;}/**\n * Normalize a slot value: Framer wraps ComponentInstance in an array.\n */function normalizeSlot(val){if(/*#__PURE__*/isValidElement(val))return val;if(Array.isArray(val)&&val.length>0&&/*#__PURE__*/isValidElement(val[0]))return val[0];return null;}/**\n * Extract all slot ReactNodes from a SlotHub ComponentInstance.\n * Returns an array where index = slot number, value = ReactNode or null.\n */export function extractSlots(hubNode){const hubEl=findHubElement(hubNode);if(!hubEl)return[];const slots=[];for(let i=0;i<MAX_SLOTS;i++){const val=hubEl.props[`slot${i}`];if(val===undefined)break;// no more slots defined\nslots.push(normalizeSlot(val));}return slots;}/**\n * Extract a single slot by index.\n */export function extractSlot(hubNode,index){const hubEl=findHubElement(hubNode);if(!hubEl)return null;return normalizeSlot(hubEl.props[`slot${index}`]);}/**\n * Get the count of occupied (non-null) slots.\n */export function countSlots(hubNode){const slots=extractSlots(hubNode);return slots.filter(Boolean).length;}\nexport const __FramerMetadata__ = {\"exports\":{\"extractSlot\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"extractSlots\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"countSlots\":{\"type\":\"function\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./UseSlotHub.map"],"mappings":"oGAkBG,SAAS,EAAe,EAAK,CAAC,IAAI,EAAQ,EAC1C,MAAM,QAAQ,CAAO,GAAG,EAAQ,OAAO,IAAE,EAAQ,EAAQ,IAAG,IAAI,IAAI,EAAM,EAAE,EAAM,EAAiB,IAAQ,CAAC,GAAG,CAAc,EAAe,CAAO,EAAE,OAAO,KAAK,IAAM,EAAG,EAC7K,GAAG,EAAG,MAAM,QAAQ,IAAA,GAAU,OAAO,EACrC,IAAM,EAAG,EAAG,MAAM,SAAS,GAAgB,EAAe,CAAE,EAAG,EAAQ,OAAS,GAAG,MAAM,QAAQ,CAAE,GAAG,EAAG,OAAO,EAAyC,IAAtC,EAAQ,EAAG,KAAKA,CAAc,GAAG,KAAQ,CAAC,EAAQ,OAAO,IAAA,MAAW,OAAO,IAAM,CAAC,OAAO,IAAK,CAE9M,SAAS,EAAc,EAAI,CAAuI,OAAtH,EAAe,CAAG,EAAS,EAAO,MAAM,QAAQ,CAAG,GAAG,EAAI,OAAO,GAAgB,EAAe,EAAI,EAAE,EAAS,EAAI,GAAU,IAAK,CAG9K,SAAgB,EAAa,EAAQ,CAAC,IAAM,EAAM,EAAe,CAAO,EAAE,GAAG,CAAC,EAAM,MAAM,CAAC,EAAE,IAAM,EAAM,CAAC,EAAE,IAAI,IAAI,EAAE,EAAE,EAAE,EAAU,IAAI,CAAC,IAAM,EAAI,EAAM,MAAM,OAAO,KAAK,GAAG,IAAM,IAAA,GAAU,MACjM,EAAM,KAAK,EAAc,CAAG,CAAC,CAAE,CAAC,OAAO,CAAM,qBA3BZ,EAe3B,EAAiB,EAAQ,EAAU"}