{
  "version": 3,
  "sources": ["../../../src/slot-fill/bubbles-virtually/use-slot-fills.ts"],
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useContext, useMemo, useSyncExternalStore } from '@wordpress/element';\n/**\n * Internal dependencies\n */\nimport SlotFillContext from '../context';\nfunction useObservableValueWithSelector(map, name, selector) {\n  const subscribe = useMemo(() => listener => map.subscribe(name, listener), [map, name]);\n  const getValue = () => selector(map.get(name));\n  return useSyncExternalStore(subscribe, getValue, getValue);\n}\nfunction getLength(array) {\n  return array?.length;\n}\nexport default function useSlotFills(name) {\n  const registry = useContext(SlotFillContext);\n  const length = useObservableValueWithSelector(registry.fills, name, getLength);\n  // callers expect an opaque array with length `length`, so create that array\n  const fills = useMemo(() => {\n    return length !== undefined ? Array.from({\n      length\n    }) : undefined;\n  }, [length]);\n  return fills;\n}"],
  "mappings": ";AAGA,SAAS,YAAY,SAAS,4BAA4B;AAI1D,OAAO,qBAAqB;AAC5B,SAAS,+BAA+B,KAAK,MAAM,UAAU;AAC3D,QAAM,YAAY,QAAQ,MAAM,cAAY,IAAI,UAAU,MAAM,QAAQ,GAAG,CAAC,KAAK,IAAI,CAAC;AACtF,QAAM,WAAW,MAAM,SAAS,IAAI,IAAI,IAAI,CAAC;AAC7C,SAAO,qBAAqB,WAAW,UAAU,QAAQ;AAC3D;AACA,SAAS,UAAU,OAAO;AACxB,SAAO,OAAO;AAChB;AACe,SAAR,aAA8B,MAAM;AACzC,QAAM,WAAW,WAAW,eAAe;AAC3C,QAAM,SAAS,+BAA+B,SAAS,OAAO,MAAM,SAAS;AAE7E,QAAM,QAAQ,QAAQ,MAAM;AAC1B,WAAO,WAAW,SAAY,MAAM,KAAK;AAAA,MACvC;AAAA,IACF,CAAC,IAAI;AAAA,EACP,GAAG,CAAC,MAAM,CAAC;AACX,SAAO;AACT;",
  "names": []
}
