!function r(i,n,l){function c(t,e){if(!n[t]){if(!i[t]){var o="function"==typeof require&&require;if(!e&&o)return o(t,!0);if(s)return s(t,!0);throw(e=new Error("Cannot find module '"+t+"'")).code="MODULE_NOT_FOUND",e}o=n[t]={exports:{}},i[t][0].call(o.exports,function(e){return c(i[t][1][e]||e)},o,o.exports,r,i,n,l)}return n[t].exports}for(var s="function"==typeof require&&require,e=0;e<l.length;e++)c(l[e]);return c}({1:[function(e,t,o){let{Fragment:r,useState:i}=wp.element,n=wp.blockEditor.BlockControls,l=wp.components.Button;var c=wp.plugins.registerPlugin;let s=!0===SUBlockEditorSettings.isLivePreview||1===SUBlockEditorSettings.isLivePreview||"1"===SUBlockEditorSettings.isLivePreview||"true"===SUBlockEditorSettings.isLivePreview,a=React.createElement("svg",{viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{d:"M10,3L3,3L3,21L10,21L10,17L7,17L7,7L10,7L10,3ZM14,3L21,3L21,21L14,21L14,17L17,17L17,7L14,7L14,3Z"})),d=()=>React.createElement("div",{className:"su-live-preview-popover",role:"status",style:{position:"absolute",top:"calc(100% + 12px)",left:"50%",zIndex:1e5,width:"300px",maxWidth:"calc(100vw - 32px)",padding:"16px 18px",borderRadius:"6px",background:"#0b66c3",boxShadow:"0 14px 36px rgba(11, 102, 195, 0.28)",boxSizing:"border-box",color:"#fff",fontSize:"16px",lineHeight:"1.45",textAlign:"left",transform:"translateX(-50%)",whiteSpace:"normal"}},React.createElement("span",{"aria-hidden":"true",style:{position:"absolute",top:"-7px",left:"50%",width:"14px",height:"14px",background:"#0b66c3",transform:"translateX(-50%) rotate(45deg)"}}),React.createElement("strong",{style:{display:"block",marginBottom:"6px",color:"#fff",fontSize:"18px",lineHeight:"1.3"}},SUBlockEditorL10n.livePreviewTitle),React.createElement("span",null,SUBlockEditorL10n.livePreviewDescription));let p=()=>{let{dispatch:t,select:e}=wp.data;var o=wp.blocks.createBlock,r=e("core/block-editor"),i=r.getSelectedBlockClientId();let n=i?r.getBlock(i):null;if(n){i=wp.blocks.getBlockType(n.name);if(i&&i.attributes&&(i.attributes.content||"core/shortcode"===n.name))return void window.SUG.App.insert("block",{props:{name:n.name,attributes:n.attributes,setAttributes:e=>{t("core/block-editor").updateBlockAttributes(n.clientId,e)}}})}let l=o("core/shortcode",{text:""});i=r.getBlockInsertionPoint();t("core/block-editor").insertBlock(l,i.index,i.rootClientId),t("core/block-editor").selectBlock(l.clientId),setTimeout(()=>{window.SUG.App.insert("block",{props:{name:"core/shortcode",attributes:{text:""},setAttributes:e=>{t("core/block-editor").updateBlockAttributes(l.clientId,e)}}})},100)},u=()=>{let[e,t]=i(s);return React.createElement(r,null,React.createElement(l,{icon:a,label:SUBlockEditorL10n.insertShortcode,onClick:()=>{t(!1),p()},className:"su-insert-shortcode-button"}),e&&React.createElement(d,null))};c("shortcodes-ultimate-toolbar",{render:()=>React.createElement(wp.editPost.PluginMoreMenuItem,{icon:a,onClick:p},SUBlockEditorL10n.insertShortcode)}),"on"===SUBlockEditorSettings.showToolbarButton&&wp.domReady(()=>{let e=()=>{var e,t=document.querySelector(".edit-post-header-toolbar, .editor-header__toolbar");t&&!document.querySelector(".su-insert-shortcode-button")&&((e=document.createElement("div")).className="su-insert-shortcode-button-container",e.style.display="inline-flex",e.style.alignItems="center",e.style.marginLeft="8px",e.style.position="relative",t.appendChild(e),wp.element.render(wp.element.createElement(u),e))};e(),new MutationObserver(()=>{e()}).observe(document.body,{childList:!0,subtree:!0})}),"on"===SUBlockEditorSettings.showBlockControlsButton&&wp.hooks.addFilter("editor.BlockEdit","shortcodes-ultimate/with-insert-shortcode-button",t=>e=>-1===SUBlockEditorSettings.supportedBlocks.indexOf(e.name)?React.createElement(t,e):React.createElement(r,null,React.createElement(t,e),React.createElement(n,{controls:[{icon:a,title:SUBlockEditorL10n.insertShortcode,onClick:()=>{window.SUG.App.insert("block",{props:e})}}]})))},{}]},{},[1]);
//# sourceMappingURL=index.js.map
