{
  "version": 3,
  "sources": ["../../../src/api/parser/apply-built-in-validation-fixes.ts"],
  "sourcesContent": ["/**\n * Internal dependencies\n */\nimport { fixCustomClassname } from './fix-custom-classname';\nimport { fixGlobalAttribute } from './fix-global-attribute';\nimport type { Block, BlockAttribute, BlockType } from '../../types';\n\nconst ARIA_LABEL_ATTR_SCHEMA: BlockAttribute = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tselector: '[data-aria-label] > *',\n\tattribute: 'aria-label',\n};\n\nconst ANCHOR_ATTR_SCHEMA: BlockAttribute = {\n\ttype: 'string',\n\tsource: 'attribute',\n\tselector: '[data-anchor] > *',\n\tattribute: 'id',\n};\n\n/**\n * Attempts to fix block invalidation by applying build-in validation fixes\n * like moving all extra classNames to the className attribute.\n *\n * @param block     block object.\n * @param blockType Block type. This is normalize not necessary and\n *                  can be inferred from the block name,\n *                  but it's here for performance reasons.\n *\n * @return Fixed block object\n */\nexport function applyBuiltInValidationFixes(\n\tblock: Block,\n\tblockType: BlockType\n): Block {\n\tconst { attributes, originalContent } = block;\n\tlet updatedBlockAttributes = attributes;\n\n\t// Fix block invalidation for className attribute.\n\tupdatedBlockAttributes = fixCustomClassname(\n\t\tattributes,\n\t\tblockType,\n\t\toriginalContent ?? ''\n\t);\n\t// Fix block invalidation for ariaLabel attribute.\n\tupdatedBlockAttributes = fixGlobalAttribute(\n\t\tupdatedBlockAttributes,\n\t\tblockType,\n\t\toriginalContent ?? '',\n\t\t'ariaLabel',\n\t\t'data-aria-label',\n\t\tARIA_LABEL_ATTR_SCHEMA\n\t);\n\t// Fix block invalidation for anchor attribute.\n\tupdatedBlockAttributes = fixGlobalAttribute(\n\t\tupdatedBlockAttributes,\n\t\tblockType,\n\t\toriginalContent ?? '',\n\t\t'anchor',\n\t\t'data-anchor',\n\t\tANCHOR_ATTR_SCHEMA\n\t);\n\n\treturn {\n\t\t...block,\n\t\tattributes: updatedBlockAttributes,\n\t};\n}\n"],
  "mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kCAAmC;AACnC,kCAAmC;AAGnC,IAAM,yBAAyC;AAAA,EAC9C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,WAAW;AACZ;AAEA,IAAM,qBAAqC;AAAA,EAC1C,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,WAAW;AACZ;AAaO,SAAS,4BACf,OACA,WACQ;AACR,QAAM,EAAE,YAAY,gBAAgB,IAAI;AACxC,MAAI,yBAAyB;AAG7B,+BAAyB;AAAA,IACxB;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,EACpB;AAEA,+BAAyB;AAAA,IACxB;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,+BAAyB;AAAA,IACxB;AAAA,IACA;AAAA,IACA,mBAAmB;AAAA,IACnB;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,SAAO;AAAA,IACN,GAAG;AAAA,IACH,YAAY;AAAA,EACb;AACD;",
  "names": []
}
