{
  "version": 3,
  "sources": ["../../src/gallery/shared.js"],
  "sourcesContent": ["export function defaultColumnsNumber( imageCount ) {\n\treturn imageCount ? Math.min( 3, imageCount ) : 3;\n}\n\n/**\n * Whether a value is a plain object (and not an array).\n *\n * @param {*} value The value to check.\n * @return {boolean} Whether the value is a plain object.\n */\nexport function isObject( value ) {\n\treturn !! value && typeof value === 'object' && ! Array.isArray( value );\n}\n\n/**\n * Whether the Gallery should use its default Flex layout behavior.\n *\n * Gallery blocks created before layout variations existed do not have an\n * explicit layout attribute. Treat missing and malformed layout data as Flex\n * so existing galleries keep their current appearance.\n *\n * @param {*} layout The Gallery layout attribute.\n * @return {boolean} Whether the Gallery uses its Flex layout.\n */\nexport function isGalleryFlexLayout( layout ) {\n\tconst layoutType = isObject( layout ) ? layout.type : undefined;\n\n\treturn (\n\t\ttypeof layoutType !== 'string' ||\n\t\tlayoutType === '' ||\n\t\tlayoutType === 'flex'\n\t);\n}\n\nexport const pickRelevantMediaFiles = ( image, sizeSlug = 'large' ) => {\n\tconst imageProps = Object.fromEntries(\n\t\tObject.entries( image ?? {} ).filter( ( [ key ] ) =>\n\t\t\t[ 'alt', 'id', 'link' ].includes( key )\n\t\t)\n\t);\n\n\timageProps.url =\n\t\timage?.sizes?.[ sizeSlug ]?.url ||\n\t\timage?.media_details?.sizes?.[ sizeSlug ]?.source_url ||\n\t\timage?.url ||\n\t\timage?.source_url;\n\tconst fullUrl =\n\t\timage?.sizes?.full?.url ||\n\t\timage?.media_details?.sizes?.full?.source_url;\n\tif ( fullUrl ) {\n\t\timageProps.fullUrl = fullUrl;\n\t}\n\treturn imageProps;\n};\n"],
  "mappings": ";AAAO,SAAS,qBAAsB,YAAa;AAClD,SAAO,aAAa,KAAK,IAAK,GAAG,UAAW,IAAI;AACjD;AAQO,SAAS,SAAU,OAAQ;AACjC,SAAO,CAAC,CAAE,SAAS,OAAO,UAAU,YAAY,CAAE,MAAM,QAAS,KAAM;AACxE;AAYO,SAAS,oBAAqB,QAAS;AAC7C,QAAM,aAAa,SAAU,MAAO,IAAI,OAAO,OAAO;AAEtD,SACC,OAAO,eAAe,YACtB,eAAe,MACf,eAAe;AAEjB;AAEO,IAAM,yBAAyB,CAAE,OAAO,WAAW,YAAa;AACtE,QAAM,aAAa,OAAO;AAAA,IACzB,OAAO,QAAS,SAAS,CAAC,CAAE,EAAE;AAAA,MAAQ,CAAE,CAAE,GAAI,MAC7C,CAAE,OAAO,MAAM,MAAO,EAAE,SAAU,GAAI;AAAA,IACvC;AAAA,EACD;AAEA,aAAW,MACV,OAAO,QAAS,QAAS,GAAG,OAC5B,OAAO,eAAe,QAAS,QAAS,GAAG,cAC3C,OAAO,OACP,OAAO;AACR,QAAM,UACL,OAAO,OAAO,MAAM,OACpB,OAAO,eAAe,OAAO,MAAM;AACpC,MAAK,SAAU;AACd,eAAW,UAAU;AAAA,EACtB;AACA,SAAO;AACR;",
  "names": []
}
