{
  "version": 3,
  "sources": ["../../../src/components/block-visibility/use-block-visibility.js"],
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useViewportMatch } from '@wordpress/compose';\n\n/**\n * Internal dependencies\n */\nimport { BLOCK_VISIBILITY_VIEWPORTS } from './constants';\n\n/**\n * Returns information about the current block visibility state.\n *\n * @param {Object}         options                 Parameters to avoid extra store subscriptions.\n * @param {Object|boolean} options.blockVisibility Block visibility metadata.\n * @param {string}         options.deviceType      Current device type ('desktop', 'tablet', 'mobile').\n * @param {Window?}        options.view            Window instance in which to perform viewport matching\n * @return {Object} Object with `isBlockCurrentlyHidden` (boolean) and `currentViewport` (string) properties.\n */\nexport default function useBlockVisibility( options = {} ) {\n\tconst {\n\t\tblockVisibility = undefined,\n\t\tdeviceType = BLOCK_VISIBILITY_VIEWPORTS.desktop.key,\n\t\tview = window,\n\t} = options;\n\n\tconst isLargerThanMobile = useViewportMatch( 'mobile', '>=', view ); // >= 480px\n\tconst isLargerThanTablet = useViewportMatch( 'medium', '>=', view ); // >= 782px\n\n\t/*\n\t * Priority:\n\t * 1. Device type override (Mobile/Tablet) - uses device type to determine viewport\n\t * 2. Actual window size (Desktop mode) - uses viewport detection\n\t */\n\tlet currentViewport;\n\tif ( deviceType === BLOCK_VISIBILITY_VIEWPORTS.mobile.key ) {\n\t\tcurrentViewport = BLOCK_VISIBILITY_VIEWPORTS.mobile.key;\n\t} else if ( deviceType === BLOCK_VISIBILITY_VIEWPORTS.tablet.key ) {\n\t\tcurrentViewport = BLOCK_VISIBILITY_VIEWPORTS.tablet.key;\n\t} else if ( ! isLargerThanMobile ) {\n\t\tcurrentViewport = BLOCK_VISIBILITY_VIEWPORTS.mobile.key;\n\t} else if ( isLargerThanMobile && ! isLargerThanTablet ) {\n\t\tcurrentViewport = BLOCK_VISIBILITY_VIEWPORTS.tablet.key;\n\t} else {\n\t\tcurrentViewport = BLOCK_VISIBILITY_VIEWPORTS.desktop.key;\n\t}\n\n\t// Determine if block is currently hidden.\n\tconst isBlockCurrentlyHidden =\n\t\tblockVisibility === false ||\n\t\tblockVisibility?.viewport?.[ currentViewport ] === false;\n\n\treturn { isBlockCurrentlyHidden, currentViewport };\n}\n"],
  "mappings": ";AAGA,SAAS,wBAAwB;AAKjC,SAAS,kCAAkC;AAW5B,SAAR,mBAAqC,UAAU,CAAC,GAAI;AAC1D,QAAM;AAAA,IACL,kBAAkB;AAAA,IAClB,aAAa,2BAA2B,QAAQ;AAAA,IAChD,OAAO;AAAA,EACR,IAAI;AAEJ,QAAM,qBAAqB,iBAAkB,UAAU,MAAM,IAAK;AAClE,QAAM,qBAAqB,iBAAkB,UAAU,MAAM,IAAK;AAOlE,MAAI;AACJ,MAAK,eAAe,2BAA2B,OAAO,KAAM;AAC3D,sBAAkB,2BAA2B,OAAO;AAAA,EACrD,WAAY,eAAe,2BAA2B,OAAO,KAAM;AAClE,sBAAkB,2BAA2B,OAAO;AAAA,EACrD,WAAY,CAAE,oBAAqB;AAClC,sBAAkB,2BAA2B,OAAO;AAAA,EACrD,WAAY,sBAAsB,CAAE,oBAAqB;AACxD,sBAAkB,2BAA2B,OAAO;AAAA,EACrD,OAAO;AACN,sBAAkB,2BAA2B,QAAQ;AAAA,EACtD;AAGA,QAAM,yBACL,oBAAoB,SACpB,iBAAiB,WAAY,eAAgB,MAAM;AAEpD,SAAO,EAAE,wBAAwB,gBAAgB;AAClD;",
  "names": []
}
