import{useState as e}from"react";import{useIsomorphicLayoutEffect as t}from"@gem-sdk/core";import{scanSubscriptionBlocks as r}from"../helpers/scanSubscriptionBlocks.js";let s=s=>{let[o,i]=e(()=>({hasOneTimeBlock:!1,hasSubscriptionBlock:!1,hasBoth:!1}));return t(()=>{let e=s.current;if(!e)return;let t=()=>{i(t=>{let s=r(e);return t.hasOneTimeBlock===s.hasOneTimeBlock&&t.hasSubscriptionBlock===s.hasSubscriptionBlock?t:s})};t();let o=new MutationObserver(t);return o.observe(e,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["data-selling-type"]}),()=>{o.disconnect()}},[s]),o};export{s as useProductOfferSubscriptionBlocksObserver};
