Files

3 lines
7.2 KiB
JavaScript
Raw Permalink Normal View History

2026-08-29 21:22:26 -05:00
/*! This file is auto-generated */
var wp;(wp||={}).reusableBlocks=(()=>{var Da=Object.create;var E=Object.defineProperty;var Ea=Object.getOwnPropertyDescriptor;var Ua=Object.getOwnPropertyNames;var ja=Object.getPrototypeOf,Ma=Object.prototype.hasOwnProperty;var d=(a,t)=>()=>(t||a((t={exports:{}}).exports,t),t.exports),H=(a,t)=>{for(var o in t)E(a,o,{get:t[o],enumerable:!0})},Y=(a,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ua(t))!Ma.call(a,s)&&s!==o&&E(a,s,{get:()=>t[s],enumerable:!(r=Ea(t,s))||r.enumerable});return a};var e=(a,t,o)=>(o=a!=null?Da(ja(a)):{},Y(t||!a||!a.__esModule?E(o,"default",{value:a,enumerable:!0}):o,a)),Ia=a=>Y(E({},"__esModule",{value:!0}),a);var R=d((Wa,Z)=>{Z.exports=window.wp.data});var C=d((Qa,$)=>{$.exports=window.wp.blockEditor});var U=d((Xa,aa)=>{aa.exports=window.wp.blocks});var j=d((Ya,ta)=>{ta.exports=window.wp.i18n});var q=d((tt,fa)=>{fa.exports=window.wp.element});var G=d((et,la)=>{la.exports=window.wp.components});var ma=d((ot,sa)=>{sa.exports=window.wp.primitives});var S=d((rt,ua)=>{ua.exports=window.ReactJSXRuntime});var ia=d((mt,da)=>{da.exports=window.wp.notices});var W=d((ut,pa)=>{pa.exports=window.wp.coreData});var ga=d((nt,ba)=>{ba.exports=window.wp.url});var qa={};H(qa,{ReusableBlocksMenuItems:()=>xa,store:()=>k});var M=e(R(),1);var O={};H(O,{__experimentalConvertBlockToStatic:()=>Aa,__experimentalConvertBlocksToReusable:()=>Na,__experimentalDeleteReusableBlock:()=>Va,__experimentalSetEditingReusableBlock:()=>za});var g=e(C(),1),h=e(U(),1),ea=e(j(),1),Aa=a=>({registry:t})=>{let o=t.select(g.store).getBlock(a),r=t.select("core").getEditedEntityRecord("postType","wp_block",o.attributes.ref),s=(0,h.parse)(typeof r.content=="function"?r.content(r):r.content);t.dispatch(g.store).replaceBlocks(o.clientId,s)},Na=(a,t,o)=>async({registry:r,dispatch:s})=>{let c=o==="unsynced"?{wp_pattern_sync_status:o}:void 0,u={title:t||(0,ea.__)("Untitled pattern block"),content:(0,h.serialize)(r.select(g.store).getBlocksByClientId(a)),status:"publish",meta:c},w=await r.dispatch("core").saveEntityRecord("postType","wp_block",u);if(o==="unsynced")return;let i=(0,h.createBlock)("core/block",{ref:w.id});r.dispatch(g.store).replaceBlocks(a,i),s.__experimentalSetEditingReusableBlock(i.clientId,!0)},Va=a=>async({registry:t})=>{if(!t.select("core").getEditedEntityRecord("postType","wp_block",a))return;let c=t.select(g.store).getBlocks().filter(u=>(0,h.isReusableBlock)(u)&&u.attributes.ref===a).map(u=>u.clientId);c.length&&t.dispatch(g.store).removeBlocks(c),await t.dispatch("core").deleteEntityRecord("postType","wp_block",a)};function za(a,t){return{type:"SET_EDITING_REUSABLE_BLOCK",clientId:a,isEditing:t}}var oa=e(R(),1);function Fa(a={},t){return t?.type==="SET_EDITING_REUSABLE_BLOCK"?{...a,[t.clientId]:t.isEditing}:a}var ra=(0,oa.combineReducers)({isEditingReusableBlock:Fa});var P={};H(P,{__experimentalIsEditingReusableBlock:()=>Ha});function Ha(a,t){return a.isEditingReusableBlock[t]}var Oa="core/reusable-blocks",k=(0,M.createReduxStore)(Oa,{actions:O,reducer:ra,selectors:P});(0,M.register)(k);var _a=e(C(),1);var A=e(U(),1),na=e(C(),1),B=e(q(),1),l=e(G(),1);var I=e(ma(),1),J=e(S(),1),K=(0,J.jsx)(I.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,J.jsx)(I.Path,{d:"M21.3 10.8l-5.6-5.6c-.7-.7-1.8-.7-2.5 0l-5.6 5.6c-.7.7-.7 1.8 0 2.5l5.6 5.6c.3.3.8.5 1.2.5s.9-.2 1.2-.5l5.6-5.6c.8-.7.8-1.9.1-2.5zm-1 1.4l-5.6 5.6c-.1.1-.3.1-.4 0l-5.6-5.6c-.1-.1-.1-.3 0-.4l5.6-5.6s.1-.1.2-.1.1 0 .2.1l5.6 5.6c.1.1.1.3 0 .4zm-16.6-.4L10 5.5l-1-1-6.3 6.3c-.7.7-.7 1.8 0 2.5L9 19.5l1.1-1.1-6.3-6.3c-.2 0-.2-.2-.1-.3z"})});var L=e(R(),1),f=e(j(),1),ca=e(ia(),1),Q=e(W(),1);var m=e(S(),1);function ha({clientIds:a,rootClientId:t,onClose:o}){let[r,s]=(0,B.useState)(void 0),[c,u]=(0,B.useState)(!1),[w,i]=(0,B.useState)(""),V=(0,L.useSelect)(n=>{let{canUser:z}=n(Q.store),{getBlocksByClientId:Ca,canInsertBlockType:Sa,getBlockRootClientId:La}=n(na.store),Ta=t||(a.length>0?La(a[0]):void 0),x=Ca(a)??[];return!(x.length===1&&x[0]&&(0,A.isReusableBlock)(x[0])&&!!n(Q.store).getEntityRecord("postType","wp_block",x[0].attributes.ref))&