{
  "version": 3,
  "sources": ["../../../src/components/editor/use-adapt-editor-to-canvas.js"],
  "sourcesContent": ["import { useDispatch, useSelect, useRegistry } from '@wordpress/data';\nimport { store as blockEditorStore } from '@wordpress/block-editor';\nimport { store as editorStore } from '@wordpress/editor';\nimport { useLayoutEffect } from '@wordpress/element';\nimport { DEFAULT_DEVICE_TYPE } from '../block-editor/viewport';\n\nexport function useAdaptEditorToCanvas( canvas ) {\n\tconst { clearSelectedBlock } = useDispatch( blockEditorStore );\n\tconst {\n\t\teditPost,\n\t\tsetDeviceType,\n\t\tclosePublishSidebar,\n\t\tsetIsInserterOpened,\n\t} = useDispatch( editorStore );\n\tconst { getCurrentPost } = useSelect( editorStore );\n\tconst registry = useRegistry();\n\tuseLayoutEffect( () => {\n\t\tregistry.batch( () => {\n\t\t\tclearSelectedBlock();\n\t\t\tif ( getCurrentPost()?.type ) {\n\t\t\t\teditPost( { selection: undefined }, { undoIgnore: true } );\n\t\t\t}\n\t\t\tsetDeviceType( DEFAULT_DEVICE_TYPE );\n\t\t\tclosePublishSidebar();\n\t\t\tsetIsInserterOpened( false );\n\t\t} );\n\t}, [\n\t\tcanvas,\n\t\tregistry,\n\t\tclearSelectedBlock,\n\t\teditPost,\n\t\tsetDeviceType,\n\t\tclosePublishSidebar,\n\t\tsetIsInserterOpened,\n\t\tgetCurrentPost,\n\t] );\n}\n"],
  "mappings": ";AAAA,SAAS,aAAa,WAAW,mBAAmB;AACpD,SAAS,SAAS,wBAAwB;AAC1C,SAAS,SAAS,mBAAmB;AACrC,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AAE7B,SAAS,uBAAwB,QAAS;AAChD,QAAM,EAAE,mBAAmB,IAAI,YAAa,gBAAiB;AAC7D,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,IAAI,YAAa,WAAY;AAC7B,QAAM,EAAE,eAAe,IAAI,UAAW,WAAY;AAClD,QAAM,WAAW,YAAY;AAC7B,kBAAiB,MAAM;AACtB,aAAS,MAAO,MAAM;AACrB,yBAAmB;AACnB,UAAK,eAAe,GAAG,MAAO;AAC7B,iBAAU,EAAE,WAAW,OAAU,GAAG,EAAE,YAAY,KAAK,CAAE;AAAA,MAC1D;AACA,oBAAe,mBAAoB;AACnC,0BAAoB;AACpB,0BAAqB,KAAM;AAAA,IAC5B,CAAE;AAAA,EACH,GAAG;AAAA,IACF;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,CAAE;AACH;",
  "names": []
}
