var wp;(wp||={}).blockDirectory=(()=>{var ga=Object.create;var X=Object.defineProperty;var _a=Object.getOwnPropertyDescriptor;var ka=Object.getOwnPropertyNames;var va=Object.getPrototypeOf,xa=Object.prototype.hasOwnProperty;var p=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Q=(t,e)=>{for(var a in e)X(t,a,{get:e[a],enumerable:!0})},At=(t,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let l of ka(e))!xa.call(t,l)&&l!==a&&X(t,l,{get:()=>e[l],enumerable:!(r=_a(e,l))||r.enumerable});return t};var o=(t,e,a)=>(a=t!=null?ga(va(t)):{},At(e||!t||!t.__esModule?X(a,"default",{value:t,enumerable:!0}):a,t)),Ba=t=>At(X({},"__esModule",{value:!0}),t);var Mt=p((mr,Ft)=>{Ft.exports=window.wp.plugins});var zt=p((cr,Ut)=>{Ut.exports=window.wp.hooks});var E=p((pr,$t)=>{$t.exports=window.wp.blocks});var _=p((br,Ht)=>{Ht.exports=window.wp.data});var N=p((hr,Vt)=>{Vt.exports=window.wp.element});var wt=p((yr,qt)=>{qt.exports=window.wp.editor});var P=p((gr,Kt)=>{Kt.exports=window.wp.blockEditor});var g=p((_r,Gt)=>{Gt.exports=window.wp.i18n});var tt=p((kr,Jt)=>{Jt.exports=window.wp.apiFetch});var Xt=p((vr,Zt)=>{Zt.exports=window.wp.notices});var te=p((xr,Qt)=>{Qt.exports=window.wp.url});var be=p((qr,pe)=>{pe.exports=window.wp.compose});var j=p((Wr,he)=>{he.exports=window.wp.components});var Tt=p((Yr,ye)=>{ye.exports=window.wp.coreData});var ke=p((Gr,_e)=>{_e.exports=window.wp.htmlEntities});var st=p((Zr,ve)=>{ve.exports=window.wp.primitives});var m=p((Xr,xe)=>{xe.exports=window.ReactJSXRuntime});var Ue=p((Eo,Me)=>{Me.exports=window.wp.a11y});var ur={};Q(ur,{store:()=>d});var pa=o(Mt()),ba=o(zt());var ue=o(E()),W=o(_()),de=o(N()),me=o(wt());var ot=o(_());var Wt=o(_()),Ta=(t={},e)=>{switch(e.type){case"FETCH_DOWNLOADABLE_BLOCKS":return{...t,[e.filterValue]:{isRequesting:!0}};case"RECEIVE_DOWNLOADABLE_BLOCKS":return{...t,[e.filterValue]:{results:e.downloadableBlocks,isRequesting:!1}}}return t},Ea=(t={installedBlockTypes:[],isInstalling:{}},e)=>{switch(e.type){case"ADD_INSTALLED_BLOCK_TYPE":return{...t,installedBlockTypes:[...t.installedBlockTypes,e.item]};case"REMOVE_INSTALLED_BLOCK_TYPE":return{...t,installedBlockTypes:t.installedBlockTypes.filter(a=>a.name!==e.item.name)};case"SET_INSTALLING_BLOCK":return{...t,isInstalling:{...t.isInstalling,[e.blockId]:e.isInstalling}}}return t},Sa=(t={},e)=>{switch(e.type){case"SET_ERROR_NOTICE":return{...t,[e.blockId]:{message:e.message,isFatal:e.isFatal}};case"CLEAR_ERROR_NOTICE":let{[e.blockId]:a,...r}=t;return r}return t},Yt=(0,Wt.combineReducers)({downloadableBlocks:Ta,blockManagement:Ea,errorNotices:Sa});var gt={};Q(gt,{getDownloadableBlocks:()=>La,getErrorNoticeForBlock:()=>Ra,getErrorNotices:()=>ja,getInstalledBlockTypes:()=>q,getNewBlockTypes:()=>Ca,getUnusedBlockTypes:()=>Da,isInstalling:()=>Na,isRequestingDownloadableBlocks:()=>Ia});var A=o(_()),H=o(P()),V=[];function Ia(t,e){return t.downloadableBlocks[e]?.isRequesting??!1}function La(t,e){return t.downloadableBlocks[e]?.results??V}function q(t){return t.blockManagement.installedBlockTypes}var Ca=(0,A.createRegistrySelector)(t=>(0,A.createSelector)(e=>{let a=q(e);if(!a.length)return V;let{getBlockName:r,getClientIdsWithDescendants:l}=t(H.store),f=a.map(i=>i.name),s=l().flatMap(i=>{let u=r(i);return f.includes(u)?u:[]}),n=a.filter(i=>s.includes(i.name));return n.length>0?n:V},e=>[q(e),t(H.store).getClientIdsWithDescendants()])),Da=(0,A.createRegistrySelector)(t=>(0,A.createSelector)(e=>{let a=q(e);if(!a.length)return V;let{getBlockName:r,getClientIdsWithDescendants:l}=t(H.store),f=a.map(i=>i.name),s=l().flatMap(i=>{let u=r(i);return f.includes(u)?u:[]}),n=a.filter(i=>!s.includes(i.name));return n.length>0?n:V},e=>[q(e),t(H.store).getClientIdsWithDescendants()]));function Na(t,e){return t.blockManagement.isInstalling[e]||!1}function ja(t){return t.errorNotices}function Ra(t,e){return t.errorNotices[e]}var vt={};Q(vt,{addInstalledBlockType:()=>Fa,clearErrorNotice:()=>$a,fetchDownloadableBlocks:()=>kt,installBlockType:()=>Pa,receiveDownloadableBlocks:()=>rt,removeInstalledBlockType:()=>Ma,setErrorNotice:()=>za,setIsInstalling:()=>Ua,uninstallBlockType:()=>Aa});var at=o(E()),B=o(g()),F=o(tt()),et=o(Xt()),re=o(te());var ee=o(tt()),Oa=t=>new Promise((e,a)=>{let r=document.createElement(t.nodeName);["id","rel","src","href","type"].forEach(l=>{t[l]&&(r[l]=t[l])}),t.innerHTML&&r.appendChild(document.createTextNode(t.innerHTML)),r.onload=()=>e(!0),r.onerror=()=>a(new Error("Error loading asset.")),document.body.appendChild(r),(r.nodeName.toLowerCase()==="link"||r.nodeName.toLowerCase()==="script"&&!r.src)&&e()});async function ae(){let e=await(await(0,ee.default)({url:document.location.href,parse:!1})).text(),a=new window.DOMParser().parseFromString(e,"text/html"),r=Array.from(a.querySelectorAll('link[rel="stylesheet"],script')).filter(l=>l.id&&!document.getElementById(l.id));for(let l of r)await Oa(l)}function _t(t){if(!t)return!1;let e=t.links["wp:plugin"]||t.links.self;return e&&e.length?e[0].href:!1}function kt(t){return{type:"FETCH_DOWNLOADABLE_BLOCKS",filterValue:t}}function rt(t,e){return{type:"RECEIVE_DOWNLOADABLE_BLOCKS",downloadableBlocks:t,filterValue:e}}var Pa=t=>async({registry:e,dispatch:a})=>{let{id:r,name:l}=t,f=!1;a.clearErrorNotice(r);try{a.setIsInstalling(r,!0);let s=_t(t),n={};s?await(0,F.default)({method:"PUT",url:s,data:{status:"active"}}):n=(await(0,F.default)({method:"POST",path:"wp/v2/plugins",data:{slug:r,status:"active"}}))._links,a.addInstalledBlockType({...t,links:{...t.links,...n}});let i=["api_version","title","category","parent","ancestor","icon","description","keywords","attributes","provides_context","uses_context","selectors","supports","styles","example","variations","allowed_blocks","block_hooks"];if(await(0,F.default)({path:(0,re.addQueryArgs)(`/wp/v2/block-types/${l}`,{_fields:i})}).catch(()=>{}).then(c=>{c&&(0,at.unstable__bootstrapServerSideBlockDefinitions)({[l]:Object.fromEntries(Object.entries(c).filter(([y])=>i.includes(y)))})}),await ae(),!e.select(at.store).getBlockTypes().some(c=>c.name===l))throw new Error((0,B.__)("Error registering block. Try reloading the page."));e.dispatch(et.store).createInfoNotice((0,B.sprintf)((0,B.__)("Block %s installed and added."),t.title),{speak:!0,type:"snackbar"}),f=!0}catch(s){let n=s.message||(0,B.__)("An error occurred."),i=s instanceof Error,u={folder_exists:(0,B.__)("This block is already installed. Try reloading the page."),unable_to_connect_to_filesystem:(0,B.__)("Error installing block. You can reload the page and try again.")};u[s.code]&&(i=!0,n=u[s.code]),a.setErrorNotice(r,n,i),e.dispatch(et.store).createErrorNotice(n,{speak:!0,isDismissible:!0})}return a.setIsInstalling(r,!1),f},Aa=t=>async({registry:e,dispatch:a})=>{try{let r=_t(t);await(0,F.default)({method:"PUT",url:r,data:{status:"inactive"}}),await(0,F.default)({method:"DELETE",url:r}),a.removeInstalledBlockType(t)}catch(r){e.dispatch(et.store).createErrorNotice(r.message||(0,B.__)("An error occurred."))}};function Fa(t){return{type:"ADD_INSTALLED_BLOCK_TYPE",item:t}}function Ma(t){return{type:"REMOVE_INSTALLED_BLOCK_TYPE",item:t}}function Ua(t,e){return{type:"SET_INSTALLING_BLOCK",blockId:t,isInstalling:e}}function za(t,e,a=!1){return{type:"SET_ERROR_NOTICE",blockId:t,message:e,isFatal:a}}function $a(t){return{type:"CLEAR_ERROR_NOTICE",blockId:t}}var Bt={};Q(Bt,{getDownloadableBlocks:()=>Wa});var M=function(){return M=Object.assign||function(e){for(var a,r=1,l=arguments.length;r0&&a>="0"&&a<="9"?"_"+a+r:""+a.toUpperCase()+r}function fe(t,e){return e===void 0&&(e={}),se(t,M({delimiter:"",transform:xt},e))}function qa(t,e){return e===0?t.toLowerCase():xt(t,e)}function ie(t,e){return e===void 0&&(e={}),fe(t,M({transform:qa},e))}var ne=o(tt());var Wa=t=>async({dispatch:e})=>{if(t)try{e(kt(t));let r=(await(0,ne.default)({path:`wp/v2/block-directory/search?term=${t}`})).map(l=>Object.fromEntries(Object.entries(l).map(([f,s])=>[ie(f),s])));e(rt(r,t))}catch{e(rt([],t))}};var Ya="core/block-directory",Ka={reducer:Yt,selectors:gt,actions:vt,resolvers:Bt},d=(0,ot.createReduxStore)(Ya,Ka);(0,ot.register)(d);function ce(){let{uninstallBlockType:t}=(0,W.useDispatch)(d),e=(0,W.useSelect)(r=>{let{isAutosavingPost:l,isSavingPost:f}=r(me.store);return f()&&!l()},[]),a=(0,W.useSelect)(r=>r(d).getUnusedBlockTypes(),[]);return(0,de.useEffect)(()=>{e&&a.length&&a.forEach(r=>{t(r),(0,ue.unregisterBlockType)(r.name)})},[e]),null}var Ze=o(P()),Xe=o(be()),Qe=o(N());var qe=o(g()),We=o(j()),Ye=o(Tt()),Ke=o(_()),Ge=o(E());var Re=o(g()),Oe=o(j()),Pe=o(E()),Ae=o(_());function we(t){var e,a,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var l=t.length;for(e=0;e(0,lt.cloneElement)(t,{width:e,height:e,...a,ref:r}));var ft=o(st()),Et=o(m()),St=(0,Et.jsx)(ft.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Et.jsx)(ft.Path,{fillRule:"evenodd",d:"M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z",clipRule:"evenodd"})});var it=o(st()),It=o(m()),Lt=(0,It.jsx)(it.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,It.jsx)(it.Path,{d:"M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z"})});var nt=o(st()),Ct=o(m()),Dt=(0,Ct.jsx)(nt.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,Ct.jsx)(nt.Path,{d:"M9.518 8.783a.25.25 0 00.188-.137l2.069-4.192a.25.25 0 01.448 0l2.07 4.192a.25.25 0 00.187.137l4.626.672a.25.25 0 01.139.427l-3.347 3.262a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.363.264l-4.137-2.176a.25.25 0 00-.233 0l-4.138 2.175a.25.25 0 01-.362-.263l.79-4.607a.25.25 0 00-.072-.222L4.753 9.882a.25.25 0 01.14-.427l4.625-.672zM12 14.533c.28 0 .559.067.814.2l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39v7.143z"})});var U=o(m());function Ja({rating:t}){let e=Math.round(t/.5)*.5,a=Math.floor(t),r=Math.ceil(t-a),l=5-(a+r);return(0,U.jsxs)("span",{"aria-label":(0,ut.sprintf)((0,ut.__)("%s out of 5 stars"),e),children:[Array.from({length:a}).map((f,s)=>(0,U.jsx)(Y,{className:"block-directory-block-ratings__star-full",icon:Lt,size:16},`full_stars_${s}`)),Array.from({length:r}).map((f,s)=>(0,U.jsx)(Y,{className:"block-directory-block-ratings__star-half-full",icon:Dt,size:16},`half_stars_${s}`)),Array.from({length:l}).map((f,s)=>(0,U.jsx)(Y,{className:"block-directory-block-ratings__star-empty",icon:St,size:16},`empty_stars_${s}`))]})}var Be=Ja;var Nt=o(m()),Za=({rating:t})=>(0,Nt.jsx)("span",{className:"block-directory-block-ratings",children:(0,Nt.jsx)(Be,{rating:t})}),Te=Za;var Ee=o(P()),jt=o(m());function Xa({icon:t}){let e="block-directory-downloadable-block-icon";return t.match(/\.(jpeg|jpg|gif|png|svg)(?:\?.*)?$/)!==null?(0,jt.jsx)("img",{className:e,src:t,alt:""}):(0,jt.jsx)(Ee.BlockIcon,{className:e,icon:t,showColors:!0})}var dt=Xa;var Se=o(g()),Ie=o(_());var mt=o(m()),Qa=({block:t})=>{let e=(0,Ie.useSelect)(a=>a(d).getErrorNoticeForBlock(t.id),[t]);return e?(0,mt.jsx)("div",{className:"block-directory-downloadable-block-notice",children:(0,mt.jsxs)("div",{className:"block-directory-downloadable-block-notice__content",children:[e.message,e.isFatal?" "+(0,Se.__)("Try reloading the page."):null]})}):null},Le=Qa;var b=o(m());function tr({title:t,rating:e,ratingCount:a},{hasNotice:r,isInstalled:l,isInstalling:f}){let s=Math.round(e/.5)*.5;return!l&&r?(0,w.sprintf)("Retry installing %s.",(0,S.decodeEntities)(t)):l?(0,w.sprintf)("Add %s.",(0,S.decodeEntities)(t)):f?(0,w.sprintf)("Installing %s.",(0,S.decodeEntities)(t)):a<1?(0,w.sprintf)("Install %s.",(0,S.decodeEntities)(t)):(0,w.sprintf)((0,w._n)("Install %1$s. %2$s stars with %3$s review.","Install %1$s. %2$s stars with %3$s reviews.",a),(0,S.decodeEntities)(t),s,a)}function er({item:t,onClick:e}){let{author:a,description:r,icon:l,rating:f,title:s}=t,n=!!(0,De.getBlockType)(t.name),{hasNotice:i,isInstalling:u,isInstallable:c}=(0,Ne.useSelect)($=>{let{getErrorNoticeForBlock:ha,isInstalling:ya}=$(d),yt=ha(t.id),wa=yt&&yt.isFatal;return{hasNotice:!!yt,isInstalling:ya(t.id),isInstallable:!wa}},[t]),y="";n?y=(0,w.__)("Installed!"):u&&(y=(0,w.__)("Installing\u2026"));let x=tr(t,{hasNotice:i,isInstalled:n,isInstalling:u});return(0,b.jsx)(I.Tooltip,{placement:"top",text:x,children:(0,b.jsxs)(I.Composite.Item,{className:ge("block-directory-downloadable-block-list-item",u&&"is-installing"),accessibleWhenDisabled:!0,disabled:u||!c,onClick:$=>{$.preventDefault(),e()},"aria-label":x,type:"button",role:"option",children:[(0,b.jsxs)("div",{className:"block-directory-downloadable-block-list-item__icon",children:[(0,b.jsx)(dt,{icon:l,title:s}),u?(0,b.jsx)("span",{className:"block-directory-downloadable-block-list-item__spinner",children:(0,b.jsx)(I.Spinner,{})}):(0,b.jsx)(Te,{rating:f})]}),(0,b.jsxs)("span",{className:"block-directory-downloadable-block-list-item__details",children:[(0,b.jsx)("span",{className:"block-directory-downloadable-block-list-item__title",children:(0,Ce.createInterpolateElement)((0,w.sprintf)((0,w.__)("%1$s by %2$s"),(0,S.decodeEntities)(s),a),{span:(0,b.jsx)("span",{className:"block-directory-downloadable-block-list-item__author"})})}),i?(0,b.jsx)(Le,{block:t}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)("span",{className:"block-directory-downloadable-block-list-item__desc",children:y||(0,S.decodeEntities)(r)}),c&&!(n||u)&&(0,b.jsx)(I.VisuallyHidden,{children:(0,w.__)("Install block")})]})]})]})})}var je=er;var Rt=o(m()),ar=()=>{};function rr({items:t,onHover:e=ar,onSelect:a}){let{installBlockType:r}=(0,Ae.useDispatch)(d);return t.length?(0,Rt.jsx)(Oe.Composite,{role:"listbox",className:"block-directory-downloadable-blocks-list","aria-label":(0,Re.__)("Blocks available for install"),children:t.map(l=>(0,Rt.jsx)(je,{onClick:()=>{(0,Pe.getBlockType)(l.name)?a(l):r(l).then(f=>{f&&a(l)}),e(null)},onHover:e,item:l},l.id))}):null}var Fe=rr;var L=o(g()),ze=o(N()),$e=o(Ue()),k=o(m());function or({children:t,downloadableItems:e,hasLocalBlocks:a}){let r=e.length;return(0,ze.useEffect)(()=>{(0,$e.speak)((0,L.sprintf)((0,L._n)("%d additional block is available to install.","%d additional blocks are available to install.",r),r))},[r]),(0,k.jsxs)(k.Fragment,{children:[!a&&(0,k.jsx)("p",{className:"block-directory-downloadable-blocks-panel__no-local",children:(0,L.__)("No results available from your installed blocks.")}),(0,k.jsx)("div",{className:"block-editor-inserter__quick-inserter-separator"}),(0,k.jsxs)("div",{className:"block-directory-downloadable-blocks-panel",children:[(0,k.jsxs)("div",{className:"block-directory-downloadable-blocks-panel__header",children:[(0,k.jsx)("h2",{className:"block-directory-downloadable-blocks-panel__title",children:(0,L.__)("Available to install")}),(0,k.jsx)("p",{className:"block-directory-downloadable-blocks-panel__description",children:(0,L.__)("Select a block to install and add it to your post.")})]}),t]})]})}var He=or;var ct=o(g()),pt=o(j()),v=o(m());function lr(){return(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)("div",{className:"block-editor-inserter__no-results",children:(0,v.jsx)("p",{children:(0,ct.__)("No results found.")})}),(0,v.jsx)("div",{className:"block-editor-inserter__tips",children:(0,v.jsxs)(pt.Tip,{children:[(0,ct.__)("Interested in creating your own block?"),(0,v.jsx)("br",{}),(0,v.jsxs)(pt.ExternalLink,{href:"https://developer.wordpress.org/block-editor/",children:[(0,ct.__)("Get started here"),"."]})]})})]})}var Ot=lr;var h=o(m()),Ve=[],sr=t=>(0,Ke.useSelect)(e=>{let{getDownloadableBlocks:a,isRequestingDownloadableBlocks:r,getInstalledBlockTypes:l}=e(d),f=e(Ye.store).canUser("read","block-directory/search"),s=Ve;if(f){s=a(t);let n=l(),i=s.filter(({name:u})=>{let c=n.some(x=>x.name===u),y=(0,Ge.getBlockType)(u);return c||!y});i.length!==s.length&&(s=i),s.length===0&&(s=Ve)}return{hasPermission:f,downloadableBlocks:s,isLoading:r(t)}},[t]);function Je({onSelect:t,onHover:e,hasLocalBlocks:a,isTyping:r,filterValue:l}){let{hasPermission:f,downloadableBlocks:s,isLoading:n}=sr(l);return f===void 0||n||r?(0,h.jsxs)(h.Fragment,{children:[f&&!a&&(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)("p",{className:"block-directory-downloadable-blocks-panel__no-local",children:(0,qe.__)("No results available from your installed blocks.")}),(0,h.jsx)("div",{className:"block-editor-inserter__quick-inserter-separator"})]}),(0,h.jsx)("div",{className:"block-directory-downloadable-blocks-panel has-blocks-loading",children:(0,h.jsx)(We.Spinner,{})})]}):f===!1?a?null:(0,h.jsx)(Ot,{}):s.length===0?a?null:(0,h.jsx)(Ot,{}):(0,h.jsx)(He,{downloadableItems:s,hasLocalBlocks:a,children:(0,h.jsx)(Fe,{items:s,onSelect:t,onHover:e})})}var Pt=o(m());function fr(){let[t,e]=(0,Qe.useState)(""),a=(0,Xe.debounce)(e,400);return(0,Pt.jsx)(Ze.__unstableInserterMenuExtension,{children:({onSelect:r,onHover:l,filterValue:f,hasItems:s})=>(t!==f&&a(f),t?(0,Pt.jsx)(Je,{onSelect:r,onHover:l,filterValue:t,hasLocalBlocks:s,isTyping:f!==t}):null)})}var ta=fr;var K=o(g()),aa=o(_()),ra=o(wt());var bt=o(g());var C=o(m());function ea({items:t}){return t.length?(0,C.jsx)("ul",{className:"block-directory-compact-list",children:t.map(({icon:e,id:a,title:r,author:l})=>(0,C.jsxs)("li",{className:"block-directory-compact-list__item",children:[(0,C.jsx)(dt,{icon:e,title:r}),(0,C.jsxs)("div",{className:"block-directory-compact-list__item-details",children:[(0,C.jsx)("div",{className:"block-directory-compact-list__item-title",children:r}),(0,C.jsx)("div",{className:"block-directory-compact-list__item-author",children:(0,bt.sprintf)((0,bt.__)("By %s"),l)})]})]},a))}):null}var G=o(m());function oa(){let t=(0,aa.useSelect)(e=>e(d).getNewBlockTypes(),[]);return t.length?(0,G.jsxs)(ra.PluginPrePublishPanel,{title:(0,K.sprintf)((0,K._n)("Added: %d block","Added: %d blocks",t.length),t.length),initialOpen:!0,children:[(0,G.jsx)("p",{className:"installed-blocks-pre-publish-panel__copy",children:(0,K._n)("The following block has been added to your site.","The following blocks have been added to your site.",t.length)}),(0,G.jsx)(ea,{items:t})]}):null}var R=o(g()),na=o(j()),ua=o(E()),da=o(N()),Z=o(_()),ma=o(Tt()),O=o(P());var ht=o(g()),la=o(j()),z=o(E()),J=o(_()),sa=o(P());var fa=o(m());function ia({attributes:t,block:e,clientId:a}){let r=(0,J.useSelect)(s=>s(d).isInstalling(e.id),[e.id]),{installBlockType:l}=(0,J.useDispatch)(d),{replaceBlock:f}=(0,J.useDispatch)(sa.store);return(0,fa.jsx)(la.Button,{__next40pxDefaultSize:!0,onClick:()=>l(e).then(s=>{if(s){let n=(0,z.getBlockType)(e.name),[i]=(0,z.parse)(t.originalContent);i&&n&&f(a,(0,z.createBlock)(n.name,i.attributes,i.innerBlocks))}}),accessibleWhenDisabled:!0,disabled:r,isBusy:r,variant:"primary",children:(0,ht.sprintf)((0,ht.__)("Install %s"),e.title)})}var T=o(m()),ir=t=>e=>{let{originalName:a}=e.attributes,{block:r,hasPermission:l}=(0,Z.useSelect)(f=>{let{getDownloadableBlocks:s}=f(d),n=s("block:"+a).filter(({name:i})=>a===i);return{hasPermission:f(ma.store).canUser("read","block-directory/search"),block:n.length&&n[0]}},[a]);return!l||!r?(0,T.jsx)(t,{...e}):(0,T.jsx)(nr,{...e,originalBlock:r})},nr=({originalBlock:t,...e})=>{let{originalName:a,originalUndelimitedContent:r,clientId:l}=e.attributes,{replaceBlock:f}=(0,Z.useDispatch)(O.store),s=()=>{f(e.clientId,(0,ua.createBlock)("core/html",{content:r}))},n=!!r,i=(0,Z.useSelect)(y=>{let{canInsertBlockType:x,getBlockRootClientId:$}=y(O.store);return x("core/html",$(l))},[l]),u=(0,R.sprintf)((0,R.__)("Your site doesn\u2019t include support for the %s block. You can try installing the block or remove it entirely."),t.title||a),c=[(0,T.jsx)(ia,{block:t,attributes:e.attributes,clientId:e.clientId},"install")];return n&&i&&(u=(0,R.sprintf)((0,R.__)("Your site doesn\u2019t include support for the %s block. You can try installing the block, convert it to a Custom HTML block, or remove it entirely."),t.title||a),c.push((0,T.jsx)(na.Button,{__next40pxDefaultSize:!0,onClick:s,variant:"tertiary",children:(0,R.__)("Keep as HTML")},"convert"))),(0,T.jsxs)("div",{...(0,O.useBlockProps)(),children:[(0,T.jsx)(O.Warning,{actions:c,children:u}),(0,T.jsx)(da.RawHTML,{children:r})]})},ca=ir;var D=o(m());(0,pa.registerPlugin)("block-directory",{icon:void 0,render(){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(ce,{}),(0,D.jsx)(ta,{}),(0,D.jsx)(oa,{})]})}});(0,ba.addFilter)("blocks.registerBlockType","block-directory/fallback",(t,e)=>(e!=="core/missing"||(t.edit=ca(t.edit)),t));return Ba(ur);})();