{
  "version": 3,
  "sources": ["../../src/store/utils.ts"],
  "sourcesContent": ["/**\n * Helper util to return a value from a certain path of the object.\n * Path is specified as either:\n * - a string of properties, separated by dots, for example: \"x.y\".\n * - an array of properties, for example `[ 'x', 'y' ]`.\n * You can also specify a default value in case the result is nullish.\n *\n * @param object       Input object.\n * @param path         Path to the object property.\n * @param defaultValue Default value if the value at the specified path is nullish.\n * @return Value of the object property at the specified path.\n */\nexport const getValueFromObjectPath = (\n\tobject: Record< string, unknown >,\n\tpath: string | string[],\n\tdefaultValue?: unknown\n): unknown => {\n\tconst normalizedPath = Array.isArray( path ) ? path : path.split( '.' );\n\tlet value: unknown = object;\n\tnormalizedPath.forEach( ( fieldName ) => {\n\t\tvalue = ( value as Record< string, unknown > )?.[ fieldName ];\n\t} );\n\treturn value ?? defaultValue;\n};\n\nfunction isObject(\n\tcandidate: unknown\n): candidate is Record< string, unknown > {\n\treturn (\n\t\ttypeof candidate === 'object' &&\n\t\tcandidate !== null &&\n\t\tcandidate.constructor === Object\n\t);\n}\n\n/**\n * Determine whether a set of object properties matches a given object.\n *\n * Given an object of block attributes and an object of variation attributes,\n * this function checks recursively whether all the variation attributes are\n * present in the block attributes object.\n *\n * @param blockAttributes     The object to inspect.\n * @param variationAttributes The object of property values to match.\n * @return Whether the block attributes match the variation attributes.\n */\nexport function matchesAttributes(\n\tblockAttributes: unknown,\n\tvariationAttributes: unknown\n): boolean {\n\tif ( isObject( blockAttributes ) && isObject( variationAttributes ) ) {\n\t\treturn Object.entries( variationAttributes ).every(\n\t\t\t( [ key, value ] ) =>\n\t\t\t\tmatchesAttributes( blockAttributes?.[ key ], value )\n\t\t);\n\t}\n\n\treturn blockAttributes === variationAttributes;\n}\n"],
  "mappings": ";AAYO,IAAM,yBAAyB,CACrC,QACA,MACA,iBACa;AACb,QAAM,iBAAiB,MAAM,QAAS,IAAK,IAAI,OAAO,KAAK,MAAO,GAAI;AACtE,MAAI,QAAiB;AACrB,iBAAe,QAAS,CAAE,cAAe;AACxC,YAAU,QAAwC,SAAU;AAAA,EAC7D,CAAE;AACF,SAAO,SAAS;AACjB;AAEA,SAAS,SACR,WACyC;AACzC,SACC,OAAO,cAAc,YACrB,cAAc,QACd,UAAU,gBAAgB;AAE5B;AAaO,SAAS,kBACf,iBACA,qBACU;AACV,MAAK,SAAU,eAAgB,KAAK,SAAU,mBAAoB,GAAI;AACrE,WAAO,OAAO,QAAS,mBAAoB,EAAE;AAAA,MAC5C,CAAE,CAAE,KAAK,KAAM,MACd,kBAAmB,kBAAmB,GAAI,GAAG,KAAM;AAAA,IACrD;AAAA,EACD;AAEA,SAAO,oBAAoB;AAC5B;",
  "names": []
}
