{
  "version": 3,
  "sources": ["../../../src/components/grid/use-get-number-of-blocks-before-cell.js"],
  "sourcesContent": ["/**\n * WordPress dependencies\n */\nimport { useSelect } from '@wordpress/data';\n\n/**\n * Internal dependencies\n */\nimport { store as blockEditorStore } from '../../store';\n\nexport function useGetNumberOfBlocksBeforeCell( gridClientId, numColumns ) {\n\tconst { getBlockOrder, getBlockAttributes } = useSelect( blockEditorStore );\n\n\tconst getNumberOfBlocksBeforeCell = ( column, row ) => {\n\t\tconst targetIndex = ( row - 1 ) * numColumns + column - 1;\n\n\t\tlet count = 0;\n\t\tfor ( const clientId of getBlockOrder( gridClientId ) ) {\n\t\t\tconst { columnStart, rowStart } =\n\t\t\t\tgetBlockAttributes( clientId ).style?.layout ?? {};\n\t\t\tconst cellIndex = ( rowStart - 1 ) * numColumns + columnStart - 1;\n\t\t\tif ( cellIndex < targetIndex ) {\n\t\t\t\tcount++;\n\t\t\t}\n\t\t}\n\t\treturn count;\n\t};\n\n\treturn getNumberOfBlocksBeforeCell;\n}\n"],
  "mappings": ";AAGA,SAAS,iBAAiB;AAK1B,SAAS,SAAS,wBAAwB;AAEnC,SAAS,+BAAgC,cAAc,YAAa;AAC1E,QAAM,EAAE,eAAe,mBAAmB,IAAI,UAAW,gBAAiB;AAE1E,QAAM,8BAA8B,CAAE,QAAQ,QAAS;AACtD,UAAM,eAAgB,MAAM,KAAM,aAAa,SAAS;AAExD,QAAI,QAAQ;AACZ,eAAY,YAAY,cAAe,YAAa,GAAI;AACvD,YAAM,EAAE,aAAa,SAAS,IAC7B,mBAAoB,QAAS,EAAE,OAAO,UAAU,CAAC;AAClD,YAAM,aAAc,WAAW,KAAM,aAAa,cAAc;AAChE,UAAK,YAAY,aAAc;AAC9B;AAAA,MACD;AAAA,IACD;AACA,WAAO;AAAA,EACR;AAEA,SAAO;AACR;",
  "names": []
}
