"use strict";var __defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__hasOwnProp=Object.prototype.hasOwnProperty,__export=(e,r)=>{for(var o in r)__defProp(e,o,{get:r[o],enumerable:!0})},__copyProps=(e,r,o,t)=>{if(r&&"object"==typeof r||"function"==typeof r)for(let i of __getOwnPropNames(r))__hasOwnProp.call(e,i)||i===o||__defProp(e,i,{get:()=>r[i],enumerable:!(t=__getOwnPropDesc(r,i))||t.enumerable});return e},__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),full_editor_toolbar_button_exports={};__export(full_editor_toolbar_button_exports,{default:()=>FullEditorToolbarButton}),module.exports=__toCommonJS(full_editor_toolbar_button_exports);var import_element=require("@wordpress/element"),import_components=require("@wordpress/components"),import_i18n=require("@wordpress/i18n"),import_tracks=require("@woocommerce/tracks"),import_data=require("@wordpress/data"),import_core_data=require("@wordpress/core-data"),import_blocks=require("@wordpress/blocks"),import_product_editor_ui=require("../../../../store/product-editor-ui"),import_edit=require("../edit"),import_get_gutenberg_version=require("../../../../utils/get-gutenberg-version");function isGutenbergVersionWithCrashInFullEditor(){const e=(0,import_get_gutenberg_version.getGutenbergVersion)();return e>=17.9&&e<18}function shouldForceFullEditor(){return"true"===localStorage.getItem("__unsupported_force_product_editor_description_full_editor")?.trim().toLowerCase()}function FullEditorToolbarButton({label:e=(0,import_i18n.__)("Edit Product description","woocommerce"),text:r=(0,import_i18n.__)("Full editor","woocommerce")}){const{openModalEditor:o,setModalEditorBlocks:t}=(0,import_data.dispatch)(import_product_editor_ui.wooProductEditorUiStore),[i]=(0,import_core_data.useEntityProp)("postType","product","description");return(0,import_element.createElement)(import_components.ToolbarButton,{label:e,onClick:()=>{if(isGutenbergVersionWithCrashInFullEditor()){if(!shouldForceFullEditor())return void alert((0,import_i18n.__)("The version of the Gutenberg plugin installed causes a crash in the full editor. To prevent this, the full editor has been disabled.","woocommerce"));alert((0,import_i18n.__)("The version of the Gutenberg plugin installed causes a crash in the full editor. You are proceeding at your own risk and may experience crashes.","woocommerce"))}let e=(0,import_blocks.parse)(i);const r=(0,import_edit.getContentFromFreeform)(e);r&&(e=(0,import_blocks.rawHandler)({HTML:r})),t(e),(0,import_tracks.recordEvent)("product_add_description_click"),o()}},r)}