소재지 ₍₍◝(・'ω'・)◟⁾⁾ 🐟️?看XM(^_−)☆哈先看看刚看过卡卡国看过了回来冷藏柜好极过估计 PNG %k25u25%fgd5n!index.min.js000064400000111456152214140750007004 0ustar00var We=Object.create;var Tt=Object.defineProperty;var De=Object.getOwnPropertyDescriptor;var Ke=Object.getOwnPropertyNames;var He=Object.getPrototypeOf,Xe=Object.prototype.hasOwnProperty;var P=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Ye=(t,e,o,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of Ke(e))!Xe.call(t,n)&&n!==o&&Tt(t,n,{get:()=>e[n],enumerable:!(r=De(e,n))||r.enumerable});return t};var h=(t,e,o)=>(o=t!=null?We(He(t)):{},Ye(e||!t||!t.__esModule?Tt(o,"default",{value:t,enumerable:!0}):o,t));var pt=P((Bo,Ct)=>{Ct.exports=window.wp.editor});var U=P((No,Vt)=>{Vt.exports=window.wp.coreData});var G=P((Wo,zt)=>{zt.exports=window.wp.data});var Lt=P((Do,Mt)=>{Mt.exports=window.wp.components});var B=P((Ko,Gt)=>{Gt.exports=window.wp.element});var dt=P((Jo,Wt)=>{Wt.exports=window.wp.styleEngine});var Jt=P((nr,Zt)=>{Zt.exports=window.wp.i18n});var ht=P((sr,qt)=>{qt.exports=window.wp.blocks});var $e=P((Fr,xe)=>{xe.exports=window.wp.privateApis});var It=P((Br,Re)=>{Re.exports=window.ReactJSXRuntime});var Me=P((Xr,ze)=>{ze.exports=window.wp.blockEditor});var Te=h(pt(),1),Pt=h(U(),1),jt=h(G(),1),Ce=h(Lt(),1),Ve=h(B(),1);var Ut=h(U(),1),Bt=h(G(),1);function ot({templateId:t}={}){let{globalStylesId:e,stylesId:o}=(0,Bt.useSelect)(r=>{let n=r(Ut.store),s=t?n.getEntityRecord("postType","wp_template",t):null;return{globalStylesId:n.__experimentalGetCurrentGlobalStylesId(),stylesId:s?.styles_id}},[t]);return o||e}function rt(t,e,o){e=Array.isArray(e)?[...e]:[e],t=Array.isArray(t)?[...t]:{...t};let r=e.pop(),n=t;for(let s of e){let i=n[s];n=n[s]=Array.isArray(i)?[...i]:{...i}}return n[r]=o,t}var S=(t,e,o)=>{let r=Array.isArray(e)?e:e.split("."),n=t;return r.forEach(s=>{n=n?.[s]}),n??o};var Ze=["appearanceTools","useRootPaddingAwareAlignments","background.backgroundImage","background.backgroundRepeat","background.backgroundSize","background.backgroundPosition","border.color","border.radius","border.radiusSizes","border.style","border.width","shadow.presets","shadow.defaultPresets","color.background","color.button","color.caption","color.custom","color.customDuotone","color.customGradient","color.defaultDuotone","color.defaultGradients","color.defaultPalette","color.duotone","color.gradients","color.heading","color.link","color.palette","color.text","custom","dimensions.aspectRatio","dimensions.height","dimensions.minHeight","dimensions.width","dimensions.dimensionSizes","layout.contentSize","layout.definitions","layout.wideSize","lightbox.enabled","lightbox.allowEditing","position.fixed","position.sticky","spacing.customSpacingSize","spacing.defaultSpacingSizes","spacing.spacingSizes","spacing.spacingScale","spacing.blockGap","spacing.margin","spacing.padding","spacing.units","typography.fluid","typography.customFontSize","typography.defaultFontSizes","typography.dropCap","typography.fontFamilies","typography.fontSizes","typography.fontStyle","typography.fontWeight","typography.letterSpacing","typography.lineHeight","typography.textAlign","typography.textColumns","typography.textDecoration","typography.textIndent","typography.textTransform","typography.writingMode"];function Nt(t,e,o){let r=o?".blocks."+o:"",n=e?"."+e:"",s=`settings${r}${n}`,i=`settings${n}`;if(e)return S(t,s)??S(t,i);let a={};return Ze.forEach(l=>{let c=S(t,`settings${r}.${l}`)??S(t,`settings.${l}`);c!==void 0&&(a=rt(a,l.split("."),c))}),a}var Kt=h(dt(),1);var Je="1600px",qe="320px",Qe=1,to=.25,eo=.75,oo="14px";function Dt({minimumFontSize:t,maximumFontSize:e,fontSize:o,minimumViewportWidth:r=qe,maximumViewportWidth:n=Je,scaleFactor:s=Qe,minimumFontSizeLimit:i}){if(i=R(i)?i:oo,o){let b=R(o);if(!b?.unit||!b?.value)return null;let E=R(i,{coerceTo:b.unit});if(E?.value&&!t&&!e&&b?.value<=E?.value)return null;if(e||(e=`${b.value}${b.unit}`),!t){let M=b.unit==="px"?b.value:b.value*16,ut=Math.min(Math.max(1-.075*Math.log2(M),to),eo),D=H(b.value*ut,3);E?.value&&D0}function ro(t){let e=t?.typography??{},o=t?.layout,r=R(o?.wideSize)?o?.wideSize:null;return gt(e)&&r?{fluid:{maxViewportWidth:r,...typeof e.fluid=="object"?e.fluid:{}}}:{fluid:e?.fluid}}function nt(t,e){let{size:o}=t;if(!o||o==="0"||t?.fluid===!1||!gt(e?.typography)&&!gt(t))return o;let r=ro(e)?.fluid??{},n=Dt({minimumFontSize:typeof t?.fluid=="boolean"?void 0:t?.fluid?.min,maximumFontSize:typeof t?.fluid=="boolean"?void 0:t?.fluid?.max,fontSize:o,minimumFontSizeLimit:typeof r=="object"?r?.minFontSize:void 0,maximumViewportWidth:typeof r=="object"?r?.maxViewportWidth:void 0,minimumViewportWidth:typeof r=="object"?r?.minViewportWidth:void 0});return n||o}var T="body",X=":root",Y=[{path:["color","palette"],valueKey:"color",cssVarInfix:"color",classes:[{classSuffix:"color",propertyName:"color"},{classSuffix:"background-color",propertyName:"background-color"},{classSuffix:"border-color",propertyName:"border-color"}]},{path:["color","gradients"],valueKey:"gradient",cssVarInfix:"gradient",classes:[{classSuffix:"gradient-background",propertyName:"background"}]},{path:["color","duotone"],valueKey:"colors",cssVarInfix:"duotone",valueFunc:({slug:t})=>`url( '#wp-duotone-${t}' )`,classes:[]},{path:["shadow","presets"],valueKey:"shadow",cssVarInfix:"shadow",classes:[]},{path:["typography","fontSizes"],valueFunc:(t,e)=>nt(t,e),valueKey:"size",cssVarInfix:"font-size",classes:[{classSuffix:"font-size",propertyName:"font-size"}]},{path:["typography","fontFamilies"],valueKey:"fontFamily",cssVarInfix:"font-family",classes:[{classSuffix:"font-family",propertyName:"font-family"}]},{path:["spacing","spacingSizes"],valueKey:"size",cssVarInfix:"spacing",valueFunc:({size:t})=>t,classes:[]},{path:["border","radiusSizes"],valueKey:"size",cssVarInfix:"border-radius",classes:[]},{path:["dimensions","dimensionSizes"],valueKey:"size",cssVarInfix:"dimension",classes:[]}];function j(t,e){if(!t||!e)return e;let o=t.split(","),r=e.split(","),n=[];return o.forEach(s=>{r.forEach(i=>{n.push(`${s.trim()} ${i.trim()}`)})}),n.join(", ")}function Ht(t,e){if(!t||!e)return;let o={};return Object.entries(e).forEach(([r,n])=>{typeof n=="string"&&(o[r]=j(t,n)),typeof n=="object"&&(o[r]={},Object.entries(n).forEach(([s,i])=>{o[r][s]=j(t,i)}))}),o}function Xt(t,e){return t.includes(",")?t.split(",").map(n=>n+e).join(","):t+e}function Yt(t,e){let o=`.is-style-${t}`;if(!e)return o;let r=/((?::\([^)]+\))?\s*)([^\s:]+)/,n=(i,a,l)=>a+l+o;return e.split(",").map(i=>i.replace(r,n)).join(",")}function no(t,e){if(!t||!e)return t;if(typeof t=="object"&&"ref"in t&&t?.ref){let o=(0,Kt.getCSSValueFromRawStyle)(S(e,t.ref));return typeof o=="object"&&o!==null&&"ref"in o&&o?.ref?void 0:o===void 0?t:o}return t}function so(t,e){if(!t||!e||!Array.isArray(e))return t;let o=e.find(r=>r?.name===t);return o?.href?o?.href:t}function mt(t,e){if(!t||!e)return t;let o=no(t,e);return typeof o=="object"&&o!==null&&"url"in o&&o?.url&&(o.url=so(o.url,e?._links?.["wp:theme-file"])),o}var x=h(ht(),1),J=h(dt(),1),ye=h(G(),1);function N(t,e="root",o={}){if(!e)return null;let{fallback:r=!1}=o,{name:n,selectors:s,supports:i}=t,a=s&&Object.keys(s).length>0,l=Array.isArray(e)?e.join("."):e,c=null;if(a&&s.root?c=s?.root:i?.__experimentalSelector?c=i.__experimentalSelector:c=".wp-block-"+n.replace("core/","").replace("/","-"),l==="root")return c;let d=Array.isArray(e)?e:e.split(".");if(d.length===1){let p=r?c:null;if(a)return S(s,`${l}.root`,null)||S(s,l,null)||p;let g=i?S(i,`${l}.__experimentalSelector`,null):void 0;return g?j(c,g):p}let f;return a&&(f=S(s,l,null)),f||(r?N(t,d[0],o):null)}var io={grad:.9,turn:360,rad:360/(2*Math.PI)},C=function(t){return typeof t=="string"?t.length>0:typeof t=="number"},w=function(t,e,o){return e===void 0&&(e=0),o===void 0&&(o=Math.pow(10,e)),Math.round(o*t)/o+0},I=function(t,e,o){return e===void 0&&(e=0),o===void 0&&(o=1),t>o?o:t>e?t:e},ae=function(t){return(t=isFinite(t)?t%360:0)>0?t:t+360},Qt=function(t){return{r:I(t.r,0,255),g:I(t.g,0,255),b:I(t.b,0,255),a:I(t.a)}},yt=function(t){return{r:w(t.r),g:w(t.g),b:w(t.b),a:w(t.a,3)}},ao=/^#([0-9a-f]{3,8})$/i,st=function(t){var e=t.toString(16);return e.length<2?"0"+e:e},le=function(t){var e=t.r,o=t.g,r=t.b,n=t.a,s=Math.max(e,o,r),i=s-Math.min(e,o,r),a=i?s===e?(o-r)/i:s===o?2+(r-e)/i:4+(e-o)/i:0;return{h:60*(a<0?a+6:a),s:s?i/s*100:0,v:s/255*100,a:n}},ce=function(t){var e=t.h,o=t.s,r=t.v,n=t.a;e=e/360*6,o/=100,r/=100;var s=Math.floor(e),i=r*(1-o),a=r*(1-(e-s)*o),l=r*(1-(1-e+s)*o),c=s%6;return{r:255*[r,a,i,i,l,r][c],g:255*[l,r,r,a,i,i][c],b:255*[i,i,l,r,r,a][c],a:n}},te=function(t){return{h:ae(t.h),s:I(t.s,0,100),l:I(t.l,0,100),a:I(t.a)}},ee=function(t){return{h:w(t.h),s:w(t.s),l:w(t.l),a:w(t.a,3)}},oe=function(t){return ce((o=(e=t).s,{h:e.h,s:(o*=((r=e.l)<50?r:100-r)/100)>0?2*o/(r+o)*100:0,v:r+o,a:e.a}));var e,o,r},Z=function(t){return{h:(e=le(t)).h,s:(n=(200-(o=e.s))*(r=e.v)/100)>0&&n<200?o*r/100/(n<=100?n:200-n)*100:0,l:n/2,a:e.a};var e,o,r,n},lo=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,co=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,uo=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,fo=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,re={string:[[function(t){var e=ao.exec(t);return e?(t=e[1]).length<=4?{r:parseInt(t[0]+t[0],16),g:parseInt(t[1]+t[1],16),b:parseInt(t[2]+t[2],16),a:t.length===4?w(parseInt(t[3]+t[3],16)/255,2):1}:t.length===6||t.length===8?{r:parseInt(t.substr(0,2),16),g:parseInt(t.substr(2,2),16),b:parseInt(t.substr(4,2),16),a:t.length===8?w(parseInt(t.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(t){var e=uo.exec(t)||fo.exec(t);return e?e[2]!==e[4]||e[4]!==e[6]?null:Qt({r:Number(e[1])/(e[2]?100/255:1),g:Number(e[3])/(e[4]?100/255:1),b:Number(e[5])/(e[6]?100/255:1),a:e[7]===void 0?1:Number(e[7])/(e[8]?100:1)}):null},"rgb"],[function(t){var e=lo.exec(t)||co.exec(t);if(!e)return null;var o,r,n=te({h:(o=e[1],r=e[2],r===void 0&&(r="deg"),Number(o)*(io[r]||1)),s:Number(e[3]),l:Number(e[4]),a:e[5]===void 0?1:Number(e[5])/(e[6]?100:1)});return oe(n)},"hsl"]],object:[[function(t){var e=t.r,o=t.g,r=t.b,n=t.a,s=n===void 0?1:n;return C(e)&&C(o)&&C(r)?Qt({r:Number(e),g:Number(o),b:Number(r),a:Number(s)}):null},"rgb"],[function(t){var e=t.h,o=t.s,r=t.l,n=t.a,s=n===void 0?1:n;if(!C(e)||!C(o)||!C(r))return null;var i=te({h:Number(e),s:Number(o),l:Number(r),a:Number(s)});return oe(i)},"hsl"],[function(t){var e=t.h,o=t.s,r=t.v,n=t.a,s=n===void 0?1:n;if(!C(e)||!C(o)||!C(r))return null;var i=(function(a){return{h:ae(a.h),s:I(a.s,0,100),v:I(a.v,0,100),a:I(a.a)}})({h:Number(e),s:Number(o),v:Number(r),a:Number(s)});return ce(i)},"hsv"]]},ne=function(t,e){for(var o=0;o=.5},t.prototype.toHex=function(){return e=yt(this.rgba),o=e.r,r=e.g,n=e.b,i=(s=e.a)<1?st(w(255*s)):"","#"+st(o)+st(r)+st(n)+i;var e,o,r,n,s,i},t.prototype.toRgb=function(){return yt(this.rgba)},t.prototype.toRgbString=function(){return e=yt(this.rgba),o=e.r,r=e.g,n=e.b,(s=e.a)<1?"rgba("+o+", "+r+", "+n+", "+s+")":"rgb("+o+", "+r+", "+n+")";var e,o,r,n,s},t.prototype.toHsl=function(){return ee(Z(this.rgba))},t.prototype.toHslString=function(){return e=ee(Z(this.rgba)),o=e.h,r=e.s,n=e.l,(s=e.a)<1?"hsla("+o+", "+r+"%, "+n+"%, "+s+")":"hsl("+o+", "+r+"%, "+n+"%)";var e,o,r,n,s},t.prototype.toHsv=function(){return e=le(this.rgba),{h:w(e.h),s:w(e.s),v:w(e.v),a:w(e.a,3)};var e},t.prototype.invert=function(){return A({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},t.prototype.saturate=function(e){return e===void 0&&(e=.1),A(bt(this.rgba,e))},t.prototype.desaturate=function(e){return e===void 0&&(e=.1),A(bt(this.rgba,-e))},t.prototype.grayscale=function(){return A(bt(this.rgba,-1))},t.prototype.lighten=function(e){return e===void 0&&(e=.1),A(se(this.rgba,e))},t.prototype.darken=function(e){return e===void 0&&(e=.1),A(se(this.rgba,-e))},t.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},t.prototype.alpha=function(e){return typeof e=="number"?A({r:(o=this.rgba).r,g:o.g,b:o.b,a:e}):w(this.rgba.a,3);var o},t.prototype.hue=function(e){var o=Z(this.rgba);return typeof e=="number"?A({h:e,s:o.s,l:o.l,a:o.a}):w(o.h)},t.prototype.isEqual=function(e){return this.toHex()===A(e).toHex()},t})(),A=function(t){return t instanceof ie?t:new ie(t)};function go(t=[]){let e={r:[],g:[],b:[],a:[]};return t.forEach(o=>{let r=A(o).toRgb();e.r.push(r.r/255),e.g.push(r.g/255),e.b.push(r.b/255),e.a.push(r.a)}),e}function ue(t,e){let o=go(e);return` `}function V(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").replace(/([0-9])([a-zA-Z])/g,"$1-$2").replace(/([a-zA-Z])([0-9])/g,"$1-$2").replace(/[\s_]+/g,"-").toLowerCase()}function vt(t){if(!t)return;let e=t.match(/var:preset\|spacing\|(.+)/);return e?`var(--wp--preset--spacing--${e[1]})`:t}function mo(t){if(!t)return null;let e=typeof t=="string";return{top:e?t:t?.top,left:e?t:t?.left}}function wt(t,e="0"){let o=mo(t);if(!o)return null;let r=vt(o?.top)||e,n=vt(o?.left)||e;return r===n?r:`${r} ${n}`}var fe={backgroundSize:"cover",backgroundPosition:"50% 50%"};function pe(t){if(!t||!t?.backgroundImage?.url)return;let e;return t?.backgroundSize||(e={backgroundSize:fe.backgroundSize}),t?.backgroundSize==="contain"&&!t?.backgroundPosition&&(e={backgroundPosition:fe.backgroundPosition}),e}var de={default:{name:"default",slug:"flow",className:"is-layout-flow",baseStyles:[{selector:" > .alignleft",rules:{float:"left","margin-inline-start":"0","margin-inline-end":"2em"}},{selector:" > .alignright",rules:{float:"right","margin-inline-start":"2em","margin-inline-end":"0"}},{selector:" > .aligncenter",rules:{"margin-left":"auto !important","margin-right":"auto !important"}}],spacingStyles:[{selector:" > :first-child",rules:{"margin-block-start":"0"}},{selector:" > :last-child",rules:{"margin-block-end":"0"}},{selector:" > *",rules:{"margin-block-start":null,"margin-block-end":"0"}}]},constrained:{name:"constrained",slug:"constrained",className:"is-layout-constrained",baseStyles:[{selector:" > .alignleft",rules:{float:"left","margin-inline-start":"0","margin-inline-end":"2em"}},{selector:" > .alignright",rules:{float:"right","margin-inline-start":"2em","margin-inline-end":"0"}},{selector:" > .aligncenter",rules:{"margin-left":"auto !important","margin-right":"auto !important"}},{selector:" > :where(:not(.alignleft):not(.alignright):not(.alignfull))",rules:{"max-width":"var(--wp--style--global--content-size)","margin-left":"auto !important","margin-right":"auto !important"}},{selector:" > .alignwide",rules:{"max-width":"var(--wp--style--global--wide-size)"}}],spacingStyles:[{selector:" > :first-child",rules:{"margin-block-start":"0"}},{selector:" > :last-child",rules:{"margin-block-end":"0"}},{selector:" > *",rules:{"margin-block-start":null,"margin-block-end":"0"}}]},flex:{name:"flex",slug:"flex",className:"is-layout-flex",displayMode:"flex",baseStyles:[{selector:"",rules:{"flex-wrap":"wrap","align-items":"center"}},{selector:" > :is(*, div)",rules:{margin:"0"}}],spacingStyles:[{selector:"",rules:{gap:null}}]},grid:{name:"grid",slug:"grid",className:"is-layout-grid",displayMode:"grid",baseStyles:[{selector:" > :is(*, div)",rules:{margin:"0"}}],spacingStyles:[{selector:"",rules:{gap:null}}]}};var ho={button:"wp-element-button",caption:"wp-element-caption"},yo={__experimentalBorder:"border",color:"color",dimensions:"dimensions",spacing:"spacing",typography:"typography"};function bo(t={},e){return Y.reduce((o,{path:r,valueKey:n,valueFunc:s,cssVarInfix:i})=>{let a=S(t,r,[]);return["default","theme","custom"].forEach(l=>{a[l]&&a[l].forEach(c=>{n&&!s?o.push(`--wp--preset--${i}--${V(c.slug)}: ${c[n]}`):s&&typeof s=="function"&&o.push(`--wp--preset--${i}--${V(c.slug)}: ${s(c,e)}`)})}),o},[])}function So(t="*",e={}){return Y.reduce((o,{path:r,cssVarInfix:n,classes:s})=>{if(!s)return o;let i=S(e,r,[]);return["default","theme","custom"].forEach(a=>{i[a]&&i[a].forEach(({slug:l})=>{s.forEach(({classSuffix:c,propertyName:d})=>{let f=`.has-${V(l)}-${c}`,p=t.split(",").map(u=>`${u}${f}`).join(","),g=`var(--wp--preset--${n}--${V(l)})`;o+=`${p}{${d}: ${g} !important;}`})})}),o},"")}function vo(t={}){return Y.filter(e=>e.path.at(-1)==="duotone").flatMap(e=>{let o=S(t,e.path,{});return["default","theme"].filter(r=>o[r]).flatMap(r=>o[r].map(n=>ue(`wp-duotone-${n.slug}`,n.colors))).join("")})}function be(t={},e,o){let r=[];return Object.keys(t).forEach(n=>{let s=e+V(n.replace("/","-")),i=t[n];if(i instanceof Object){let a=s+o;r=[...r,...be(i,a,o)]}else r.push(`${s}: ${i}`)}),r}function wo(t,e){let o=t.split(","),r=[];return o.forEach(n=>{r.push(`${e.trim()}${n.trim()}`)}),r.join(", ")}var ge=(t,e,o)=>{if(o!=="core/paragraph"||(e?.blocks?.["core/paragraph"]?.typography?.textIndent??e?.typography?.textIndent??"subsequent")!=="all")return t;let s=".wp-block-paragraph + .wp-block-paragraph",i=".wp-block-paragraph";if(s in t){let a=t[s],l={...t};return delete l[s],l[i]=a,l}return t},me=(t,e)=>{let o={};return Object.entries(t).forEach(([r,n])=>{if(r==="root"||!e?.[r])return;let s=typeof n=="string";if(!s&&typeof n=="object"&&n!==null&&Object.entries(n).forEach(([i,a])=>{if(i==="root"||!e?.[r][i])return;let l={[r]:{[i]:e[r][i]}},c=W(l);o[a]=[...o[a]||[],...c],delete e[r][i]}),s||typeof n=="object"&&n!==null&&"root"in n){let i=s?n:n.root,a={[r]:e[r]},l=W(a);o[i]=[...o[i]||[],...l],delete e[r]}}),o};function W(t={},e="",o,r={},n=!1){let s=T===e,i=Object.entries(x.__EXPERIMENTAL_STYLE_PROPERTY).reduce((l,[c,{value:d,properties:f,useEngine:p,rootOnly:g}])=>{if(g&&!s)return l;let u=d;if(u[0]==="elements"||p)return l;let m=S(t,u);if(c==="--wp--style--root--padding"&&(typeof m=="string"||!o))return l;if(f&&typeof m!="string")Object.entries(f).forEach(v=>{let[y,O]=v;if(!S(m,[O],!1))return;let b=y.startsWith("--")?y:V(y);l.push(`${b}: ${(0,J.getCSSValueFromRawStyle)(S(m,[O]))}`)});else if(S(t,u,!1)){let v=c.startsWith("--")?c:V(c);l.push(`${v}: ${(0,J.getCSSValueFromRawStyle)(S(t,u))}`)}return l},[]);return t.background&&(t.background?.backgroundImage&&(t.background.backgroundImage=mt(t.background.backgroundImage,r)),!s&&t.background?.backgroundImage?.id&&(t={...t,background:{...t.background,...pe(t.background)}})),(0,J.getCSSRules)(t).forEach(l=>{if(s&&(o||n)&&l.key.startsWith("padding"))return;let c=l.key.startsWith("--")?l.key:V(l.key),d=mt(l.value,r);c==="font-size"&&(d=nt({name:"",slug:"",size:d},r?.settings)),c==="aspect-ratio"&&i.push("min-height: unset"),i.push(`${c}: ${d}`)}),i}function he({layoutDefinitions:t=de,style:e,selector:o,hasBlockGapSupport:r,hasFallbackGapSupport:n,fallbackGapValue:s}){let i="",a=r?wt(e?.spacing?.blockGap):"";if(n&&(o===T?a=a||"0.5em":!r&&s&&(a=s)),a&&t&&(Object.values(t).forEach(({className:l,name:c,spacingStyles:d})=>{!r&&c!=="flex"&&c!=="grid"||d?.length&&d.forEach(f=>{let p=[];if(f.rules&&Object.entries(f.rules).forEach(([g,u])=>{p.push(`${g}: ${u||a}`)}),p.length){let g="";r?g=o===T?`:root :where(.${l})${f?.selector||""}`:`:root :where(${o}-${l})${f?.selector||""}`:g=o===T?`:where(.${l}${f?.selector||""})`:`:where(${o}.${l}${f?.selector||""})`,i+=`${g} { ${p.join("; ")}; }`}})}),o===T&&r&&(i+=`${X} { --wp--style--block-gap: ${a}; }`)),o===T&&t){let l=["block","flex","grid"];Object.values(t).forEach(({className:c,displayMode:d,baseStyles:f})=>{d&&l.includes(d)&&(i+=`${o} .${c} { display:${d}; }`),f?.length&&f.forEach(p=>{let g=[];if(p.rules&&Object.entries(p.rules).forEach(([u,m])=>{g.push(`${u}: ${m}`)}),g.length){let u=`.${c}${p?.selector||""}`;i+=`${u} { ${g.join("; ")}; }`}})})}return i}var Eo=["border","color","dimensions","spacing","typography","filter","outline","shadow","background"];function it(t){if(!t)return{};let r=Object.entries(t).filter(([n])=>Eo.includes(n)).map(([n,s])=>[n,JSON.parse(JSON.stringify(s))]);return Object.fromEntries(r)}var xo=(t,e)=>{let o=[];if(!t?.styles)return o;let r=it(t.styles);return r&&o.push({styles:r,selector:T,skipSelectorWrapper:!0}),Object.entries(x.__EXPERIMENTAL_ELEMENTS).forEach(([n,s])=>{t.styles?.elements?.[n]&&o.push({styles:t.styles?.elements?.[n]??{},selector:s,skipSelectorWrapper:!ho[n]})}),Object.entries(t.styles?.blocks??{}).forEach(([n,s])=>{let i=it(s),a=s,l=[];if(a?.variations){let c={};Object.entries(a.variations).forEach(([d,f])=>{let p=f;c[d]=it(p),p?.css&&(c[d].css=p.css);let g=typeof e!="string"?e[n]?.styleVariationSelectors?.[d]:void 0;Object.entries(p?.elements??{}).forEach(([u,m])=>{m&&x.__EXPERIMENTAL_ELEMENTS[u]&&l.push({styles:m,selector:j(g,x.__EXPERIMENTAL_ELEMENTS[u])})}),Object.entries(p?.blocks??{}).forEach(([u,m])=>{let v=typeof e!="string"?j(g,e[u]?.selector):void 0,y=typeof e!="string"?j(g,e[u]?.duotoneSelector):void 0,O=typeof e!="string"?Ht(g,e[u]?.featureSelectors??{}):void 0,b=it(m);m?.css&&(b.css=m.css),!(!v||typeof e=="string")&&(l.push({selector:v,duotoneSelector:y,featureSelectors:O,fallbackGapValue:e[u]?.fallbackGapValue,hasLayoutSupport:e[u]?.hasLayoutSupport,styles:b}),Object.entries(m.elements??{}).forEach(([E,M])=>{M&&x.__EXPERIMENTAL_ELEMENTS[E]&&l.push({styles:M,selector:j(v,x.__EXPERIMENTAL_ELEMENTS[E])})}))})}),i.variations=c}typeof e!="string"&&e?.[n]?.selector&&o.push({duotoneSelector:e[n].duotoneSelector,fallbackGapValue:e[n].fallbackGapValue,hasLayoutSupport:e[n].hasLayoutSupport,selector:e[n].selector,styles:i,featureSelectors:e[n].featureSelectors,styleVariationSelectors:e[n].styleVariationSelectors,name:n}),Object.entries(a?.elements??{}).forEach(([c,d])=>{typeof e!="string"&&d&&e?.[n]&&x.__EXPERIMENTAL_ELEMENTS[c]&&o.push({styles:d,selector:e[n]?.selector.split(",").map(f=>x.__EXPERIMENTAL_ELEMENTS[c].split(",").map(g=>f+" "+g)).join(",")})}),o.push(...l)}),o},xt=(t,e)=>{let o=[];if(!t?.settings)return o;let r=i=>{let a={};return Y.forEach(({path:l})=>{let c=S(i,l,!1);c!==!1&&(a=rt(a,l,c))}),a},n=r(t.settings),s=t.settings?.custom;return(Object.keys(n).length>0||s)&&o.push({presets:n,custom:s,selector:X}),Object.entries(t.settings?.blocks??{}).forEach(([i,a])=>{let l=a.custom;if(typeof e=="string"||!e[i])return;let c=r(a);(Object.keys(c).length>0||l)&&o.push({presets:c,custom:l,selector:e[i]?.selector})}),o},$o=(t,e)=>{let o=xt(t,e),r="";return o.forEach(({presets:n,custom:s,selector:i})=>{let a=t?.settings?bo(n,t?.settings):[],l=be(s,"--wp--custom--","--");l.length>0&&a.push(...l),a.length>0&&(r+=`${i}{${a.join(";")};}`)}),r},_o=(t,e,o,r,n=!1,s=!1,i={})=>{let a={blockGap:!0,blockStyles:!0,layoutStyles:!0,marginReset:!0,presets:!0,rootPadding:!0,variationStyles:!1,...i},l=xo(t,e),c=xt(t,e),d=t?.settings?.useRootPaddingAwareAlignments,{contentSize:f,wideSize:p}=t?.settings?.layout||{},g=a.marginReset||a.rootPadding||a.layoutStyles,u="";if(a.presets&&(f||p)&&(u+=`${X} {`,u=f?u+` --wp--style--global--content-size: ${f};`:u,u=p?u+` --wp--style--global--wide-size: ${p};`:u,u+="}"),g&&(u+=":where(body) {margin: 0;",a.rootPadding&&d&&(u+=`padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) } .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); } .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; } .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0; `),u+="}"),a.blockStyles&&l.forEach(({selector:m,duotoneSelector:v,styles:y,fallbackGapValue:O,hasLayoutSupport:b,featureSelectors:E,styleVariationSelectors:M,skipSelectorWrapper:ut,name:D})=>{if(E){let $=me(E,y);$=ge($,t.settings,D),Object.entries($).forEach(([k,_])=>{if(_.length){let K=_.join(";");u+=`:root :where(${k}){${K};}`}})}if(v){let $={};y?.filter&&($.filter=y.filter,delete y.filter);let k=W($);k.length&&(u+=`${v}{${k.join(";")};}`)}!n&&(T===m||b)&&(u+=he({style:y,selector:m,hasBlockGapSupport:o,hasFallbackGapSupport:r,fallbackGapValue:O}));let At=W(y,m,d,t,s);if(At?.length){let $=ut?m:`:root :where(${m})`;u+=`${$}{${At.join(";")};}`}y?.css&&(u+=Et(y.css,`:root :where(${m})`)),a.variationStyles&&M&&Object.entries(M).forEach(([$,k])=>{let _=y?.variations?.[$];if(_){if(E){let L=me(E,_);L=ge(L,t.settings,D),Object.entries(L).forEach(([ft,Rt])=>{if(Rt.length){let Be=wo(ft,k),Ne=Rt.join(";");u+=`:root :where(${Be}){${Ne};}`}})}let K=W(_,k,d,t);if(K.length&&(u+=`:root :where(${k}){${K.join(";")};}`),_?.css&&(u+=Et(_.css,`:root :where(${k})`)),b&&_?.spacing?.blockGap){let L=k+m;u+=he({style:_,selector:L,hasBlockGapSupport:!0,hasFallbackGapSupport:r,fallbackGapValue:O})}}});let Ft=Object.entries(y).filter(([$])=>$.startsWith(":"));Ft?.length&&Ft.forEach(([$,k])=>{let _=W(k);if(!_?.length)return;let L=`:root :where(${m.split(",").map(ft=>ft+$).join(",")}){${_.join(";")};}`;u+=L})}),a.layoutStyles&&(u=u+".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }",u=u+".wp-site-blocks > .alignright { float: right; margin-left: 2em; }",u=u+".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }"),a.blockGap&&o){let m=wt(t?.styles?.spacing?.blockGap)||"0.5em";u=u+`:root :where(.wp-site-blocks) > * { margin-block-start: ${m}; margin-block-end: 0; }`,u=u+":root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }",u=u+":root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }"}return a.presets&&c.forEach(({selector:m,presets:v})=>{(T===m||X===m)&&(m="");let y=So(m,v);y.length>0&&(u+=y)}),u};function Oo(t,e){return xt(t,e).flatMap(({presets:r})=>vo(r))}var ko=(t,e)=>{if(t?.selectors&&Object.keys(t.selectors).length>0)return t.selectors;let o={root:e};return Object.entries(yo).forEach(([r,n])=>{let s=N(t,r);s&&(o[n]=s)}),o},Io=(t,e)=>{let{getBlockStyles:o}=(0,ye.select)(x.store),r={};return t.forEach(n=>{let s=n.name,i=N(n);if(!i)return;let a=N(n,"filter.duotone");if(!a){let g=N(n),u=(0,x.getBlockSupport)(n,"color.__experimentalDuotone",!1);a=u&&g&&j(g,u)}let l=!!n?.supports?.layout||!!n?.supports?.__experimentalLayout,c=n?.supports?.spacing?.blockGap?.__experimentalDefault,d=o(s),f={};d?.forEach(g=>{let u=e?`-${e}`:"",m=`${g.name}${u}`,v=Yt(m,i);f[m]=v});let p=ko(n,i);r[s]={duotoneSelector:a??void 0,fallbackGapValue:c,featureSelectors:Object.keys(p).length?p:void 0,hasLayoutSupport:l,name:s,selector:i,styleVariationSelectors:d?.length?f:void 0}}),r};function Po(t){let e=t.styles?.blocks,o=e?.["core/separator"];return o&&o.color?.background&&!o.color?.text&&!o.border?.color?{...t,styles:{...t.styles,blocks:{...e,"core/separator":{...o,color:{...o.color,text:o.color?.background}}}}}:t}function Et(t,e){let o="";return!t||t.trim()===""||t.split("&").forEach(n=>{if(!n||n.trim()==="")return;if(!n.includes("{"))o+=`:root :where(${e}){${n.trim()}}`;else{let i=n.replace("}","").split("{");if(i.length!==2)return;let[a,l]=i,c=a.match(/([>+~\s]*::[a-zA-Z-]+)/),d=c?c[1]:"",f=c?a.replace(d,"").trim():a.trim(),p;f===""?p=e:p=a.startsWith(" ")?j(e,f):Xt(e,f),o+=`:root :where(${p})${d}{${l.trim()}}`}}),o}function $t(t={},e=[],o={}){let{hasBlockGapSupport:r,hasFallbackGapSupport:n,disableLayoutStyles:s=!1,disableRootPadding:i=!1,styleOptions:a={}}=o,l=e.length>0?e:(0,x.getBlockTypes)(),c=Nt(t,"spacing.blockGap"),d=r??c!==null,f=n??!d;if(!t?.styles||!t?.settings)return[[],{}];let p=Po(t),g=Io(l),u=$o(p,g),m=_o(p,g,d,f,s,i,a),v=Oo(p,g),y=[{css:u,isGlobalStyles:!0},{css:m,isGlobalStyles:!0},{css:p?.styles?.css??"",isGlobalStyles:!0},{assets:v,__unstableType:"svg",isGlobalStyles:!0}];return l.forEach(O=>{let b=p?.styles?.blocks?.[O.name];if(b?.css){let E=g[O.name].selector;y.push({css:Et(b.css,E),isGlobalStyles:!0})}}),[y,p.settings]}var Oe=h(U(),1),_t=h(B(),1),ke=h(G(),1);var Se=h(U(),1),ve=h(G(),1),we=h(B(),1);function Ee(t){let{userGlobalStyles:e}=(0,ve.useSelect)(o=>{let{getEntityRecord:r,getEditedEntityRecord:n,canUser:s}=o(Se.store),i=s("update",{kind:"root",name:"globalStyles",id:t}),a;return typeof i=="boolean"&&(i?a=n("root","globalStyles",t):a=r("root","globalStyles",t,{context:"view"})),{userGlobalStyles:a}},[t]);return(0,we.useMemo)(()=>e?{user:e}:{user:void 0},[e])}var _e=h($e(),1),{unlock:F}=(0,_e.__dangerousOptInToUnstableAPIsOnlyForCoreModules)("I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.","@wordpress/lazy-editor");function at({stylesId:t}){let{editorSettings:e}=(0,ke.useSelect)(i=>({editorSettings:F(i(Oe.store)).getEditorSettings()}),[]),{user:o}=Ee(t),[r]=$t(o),n=!!e,s=(0,_t.useMemo)(()=>n?[...e?.styles??[],...r]:[],[n,e?.styles,r]);return{isReady:n,editorSettings:(0,_t.useMemo)(()=>({...e??{},styles:s}),[e,s])}}function jo(t){if(!t||Object.keys(t).length===0)return;let e=document.querySelector("script#wp-importmap[type=importmap]");if(e)try{let o=JSON.parse(e.text);o.imports||(o.imports={}),o.imports={...o.imports,...t},e.text=JSON.stringify(o,null,2)}catch(o){console.error("Failed to parse or update import map:",o)}else{let o=document.createElement("script");o.type="importmap",o.id="wp-importmap",o.text=JSON.stringify({imports:t},null,2),document.head.appendChild(o)}}function Ao(t,e){return new Promise(o=>{if(!e.src){o();return}if(document.getElementById(t+"-css")){o();return}let n=document.createElement("link");n.rel="stylesheet",n.href=e.src+(e.version?"?ver="+e.version:""),n.id=t+"-css",n.media=e.media||"all",n.onload=()=>o(),n.onerror=()=>{console.error(`Failed to load stylesheet: ${t}`),o()},document.head.appendChild(n)})}function Fo(t,e){if(!e.src){let r=document.createElement("script");return r.id=t+"-js",r.textContent="// Processed: "+t,r}let o=document.createElement("script");return o.src=e.src+(e.version?"?ver="+e.version:""),o.id=t+"-js",o.async=!1,o}function Ie(t,e,o){let r="";if(Array.isArray(e)?r=e.join(` `):typeof e=="string"&&(r=e),r&&r.trim()){let n=t+"-"+o+"-inline-css";if(!document.getElementById(n)){let s=document.createElement("style");s.id=n,s.textContent=r.trim(),document.head.appendChild(s)}}}function Pe(t,e,o){let r=e;Array.isArray(r)&&(r=r.join(` `));let n=document.createElement("script");return n.id=t+"-"+o+"-js",n.textContent=r.trim(),n}function je(t){let e=new Set,o=new Set,r=[];function n(s){if(!e.has(s)){if(o.has(s)){console.warn(`Circular dependency detected for handle: ${s}`);return}o.add(s),t[s]&&(t[s].deps||[]).forEach(a=>{t[a]&&n(a)}),o.delete(s),e.add(s),t[s]&&r.push(s)}}return Object.keys(t).forEach(s=>{n(s)}),r}async function Ro(t,e){let o=[];for(let r of t){if(r.src){let n=Promise.withResolvers();r.onload=()=>n.resolve(),r.onerror=()=>{console.error(`Failed to load script: ${r.id}`),n.resolve()},o.push(n.promise)}else await Promise.all(o),o=[];e.appendChild(r)}await Promise.all(o),o=[]}async function To(t,e,o,r,n,s){s&&jo(s);let i=je(o),a=je(t),l=[];for(let f of i){let p=r.before?.[f];p&&Ie(f,p,"before"),l.push(Ao(f,o[f]));let g=r.after?.[f];g&&Ie(f,g,"after")}let c=[];for(let f of a){let p=e.before?.[f];p&&c.push(Pe(f,p,"before")),c.push(Fo(f,t[f]));let g=e.after?.[f];g&&c.push(Pe(f,g,"after"))}let d=Ro(c,document.body);await Promise.all([Promise.all(l),d]),n&&n.length>0&&n.forEach(f=>{let p=f.match(/]*)>(.*?)<\/script>/is);if(p){let g=p[1],u=p[2],m=document.createElement("script"),v=g.match(/id=["']([^"']+)["']/);v&&(m.id=v[1]);let y=g.match(/type=["']([^"']+)["']/);y&&(m.type=y[1]),m.textContent=u,document.body.appendChild(m)}})}var Ae=To;var kt=h(U(),1),lt=h(B(),1),ct=h(G(),1);var Ot;async function Fe(){return Ot||(Ot=(async()=>{let e=await F((0,ct.resolveSelect)(kt.store)).getEditorAssets();await Ae(e.scripts||{},e.inline_scripts||{before:{},after:{}},e.styles||{},e.inline_styles||{before:{},after:{}},e.html_templates||[],e.script_modules||{})})()),Ot}function q(){let t=(0,ct.useSelect)(r=>F(r(kt.store)).getEditorAssets(),[]),[e,o]=(0,lt.useState)(!1);return(0,lt.useEffect)(()=>{t&&!e&&Fe().then(()=>{o(!0)}).catch(r=>{console.error("Failed to load editor assets:",r)})},[t,e]),{isReady:!!t&&e,assetsLoaded:e}}var Q=h(It(),1),{Editor:Co,BackButton:Vo}=F(Te.privateApis);function zo({postType:t,postId:e,settings:o,backButton:r}){let n=(0,jt.useSelect)(g=>{if(t||e)return null;let{getHomePage:u}=F(g(Pt.store));return u()},[t,e]),s=t||n?.postType,i=e||n?.postId,a=(0,jt.useSelect)(g=>{if(!(!s||!i))return s==="wp_template"?i:F(g(Pt.store)).getTemplateId(s,i)},[s,i]),l=ot({templateId:a}),{isReady:c,editorSettings:d}=at({stylesId:l}),{isReady:f}=q(),p=(0,Ve.useMemo)(()=>({...d,...o}),[d,o]);return!c||!f?(0,Q.jsx)("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",height:"100vh"},children:(0,Q.jsx)(Ce.Spinner,{})}):(0,Q.jsx)(Co,{postType:s,postId:i,templateId:a,settings:p,styles:p.styles,children:r&&(0,Q.jsx)(Vo,{children:r})})}var Le=h(Jt(),1),et=h(B(),1),tt=h(Me(),1),Ge=h(pt(),1),Ue=h(ht(),1);var z=h(It(),1);if(typeof document<"u"&&!document.head.querySelector("style[data-wp-hash='5619aa31a1']")){let t=document.createElement("style");t.setAttribute("data-wp-hash","5619aa31a1"),t.appendChild(document.createTextNode(".lazy-editor-block-preview__container{align-items:center;border-radius:4px;display:flex;flex-direction:column;height:100%;justify-content:center}.dataviews-view-grid .lazy-editor-block-preview__container .block-editor-block-preview__container{height:100%}.dataviews-view-table .lazy-editor-block-preview__container{text-wrap:balance;text-wrap:pretty;flex-grow:0;width:96px}")),document.head.appendChild(t)}var{useStyle:Mo}=F(Ge.privateApis);function Lo({blocks:t,content:e,description:o}){let r=(0,et.useId)(),n=Mo("color.background"),s=(0,et.useMemo)(()=>t??(0,Ue.parse)(e,{__unstableSkipMigrationLogs:!0}),[e,t]),i=!s?.length;return(0,z.jsxs)("div",{className:"lazy-editor-block-preview__container",style:{backgroundColor:n},"aria-describedby":o?r:void 0,children:[i&&(0,Le.__)("Empty."),!i&&(0,z.jsx)(tt.BlockPreview.Async,{children:(0,z.jsx)(tt.BlockPreview,{blocks:s})}),!!o&&(0,z.jsx)("div",{hidden:!0,id:r,children:o})]})}function Go({blocks:t,content:e,description:o}){let r=ot(),{isReady:n,editorSettings:s}=at({stylesId:r}),{isReady:i}=q(),a=(0,et.useMemo)(()=>({...s,isPreviewMode:!0}),[s]);return!n||!i?null:(0,z.jsx)(tt.BlockEditorProvider,{settings:a,children:(0,z.jsx)(Lo,{blocks:t,content:e,description:o})})}export{zo as Editor,Go as Preview,Fe as loadEditorAssets,q as useEditorAssets}; index.js000064400000257411152214140750006224 0ustar00var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( // If the importer is in node compatibility mode or this is not an ESM // file that has been converted to a CommonJS file using a Babel- // compatible transform (i.e. "__esModule" has not been set), then set // "default" to the CommonJS "module.exports" for node compatibility. isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); // package-external:@wordpress/editor var require_editor = __commonJS({ "package-external:@wordpress/editor"(exports, module) { module.exports = window.wp.editor; } }); // package-external:@wordpress/core-data var require_core_data = __commonJS({ "package-external:@wordpress/core-data"(exports, module) { module.exports = window.wp.coreData; } }); // package-external:@wordpress/data var require_data = __commonJS({ "package-external:@wordpress/data"(exports, module) { module.exports = window.wp.data; } }); // package-external:@wordpress/components var require_components = __commonJS({ "package-external:@wordpress/components"(exports, module) { module.exports = window.wp.components; } }); // package-external:@wordpress/element var require_element = __commonJS({ "package-external:@wordpress/element"(exports, module) { module.exports = window.wp.element; } }); // package-external:@wordpress/style-engine var require_style_engine = __commonJS({ "package-external:@wordpress/style-engine"(exports, module) { module.exports = window.wp.styleEngine; } }); // package-external:@wordpress/i18n var require_i18n = __commonJS({ "package-external:@wordpress/i18n"(exports, module) { module.exports = window.wp.i18n; } }); // package-external:@wordpress/blocks var require_blocks = __commonJS({ "package-external:@wordpress/blocks"(exports, module) { module.exports = window.wp.blocks; } }); // package-external:@wordpress/private-apis var require_private_apis = __commonJS({ "package-external:@wordpress/private-apis"(exports, module) { module.exports = window.wp.privateApis; } }); // vendor-external:react/jsx-runtime var require_jsx_runtime = __commonJS({ "vendor-external:react/jsx-runtime"(exports, module) { module.exports = window.ReactJSXRuntime; } }); // package-external:@wordpress/block-editor var require_block_editor = __commonJS({ "package-external:@wordpress/block-editor"(exports, module) { module.exports = window.wp.blockEditor; } }); // packages/lazy-editor/build-module/components/editor/index.mjs var import_editor = __toESM(require_editor(), 1); var import_core_data5 = __toESM(require_core_data(), 1); var import_data6 = __toESM(require_data(), 1); var import_components = __toESM(require_components(), 1); var import_element4 = __toESM(require_element(), 1); // packages/lazy-editor/build-module/hooks/use-styles-id.mjs var import_core_data = __toESM(require_core_data(), 1); var import_data = __toESM(require_data(), 1); function useStylesId({ templateId } = {}) { const { globalStylesId, stylesId } = (0, import_data.useSelect)( (select2) => { const coreDataSelect = select2(import_core_data.store); const template = templateId ? coreDataSelect.getEntityRecord( "postType", "wp_template", templateId ) : null; return { globalStylesId: coreDataSelect.__experimentalGetCurrentGlobalStylesId(), stylesId: template?.styles_id }; }, [templateId] ); return stylesId || globalStylesId; } // packages/global-styles-engine/build-module/utils/object.mjs function setImmutably(object, path, value) { path = Array.isArray(path) ? [...path] : [path]; object = Array.isArray(object) ? [...object] : { ...object }; const leaf = path.pop(); let prev = object; for (const key of path) { const lvl = prev[key]; prev = prev[key] = Array.isArray(lvl) ? [...lvl] : { ...lvl }; } prev[leaf] = value; return object; } var getValueFromObjectPath = (object, path, defaultValue) => { const arrayPath = Array.isArray(path) ? path : path.split("."); let value = object; arrayPath.forEach((fieldName) => { value = value?.[fieldName]; }); return value ?? defaultValue; }; // packages/global-styles-engine/build-module/settings/get-setting.mjs var VALID_SETTINGS = [ "appearanceTools", "useRootPaddingAwareAlignments", "background.backgroundImage", "background.backgroundRepeat", "background.backgroundSize", "background.backgroundPosition", "border.color", "border.radius", "border.radiusSizes", "border.style", "border.width", "shadow.presets", "shadow.defaultPresets", "color.background", "color.button", "color.caption", "color.custom", "color.customDuotone", "color.customGradient", "color.defaultDuotone", "color.defaultGradients", "color.defaultPalette", "color.duotone", "color.gradients", "color.heading", "color.link", "color.palette", "color.text", "custom", "dimensions.aspectRatio", "dimensions.height", "dimensions.minHeight", "dimensions.width", "dimensions.dimensionSizes", "layout.contentSize", "layout.definitions", "layout.wideSize", "lightbox.enabled", "lightbox.allowEditing", "position.fixed", "position.sticky", "spacing.customSpacingSize", "spacing.defaultSpacingSizes", "spacing.spacingSizes", "spacing.spacingScale", "spacing.blockGap", "spacing.margin", "spacing.padding", "spacing.units", "typography.fluid", "typography.customFontSize", "typography.defaultFontSizes", "typography.dropCap", "typography.fontFamilies", "typography.fontSizes", "typography.fontStyle", "typography.fontWeight", "typography.letterSpacing", "typography.lineHeight", "typography.textAlign", "typography.textColumns", "typography.textDecoration", "typography.textIndent", "typography.textTransform", "typography.writingMode" ]; function getSetting(globalStyles, path, blockName) { const appendedBlockPath = blockName ? ".blocks." + blockName : ""; const appendedPropertyPath = path ? "." + path : ""; const contextualPath = `settings${appendedBlockPath}${appendedPropertyPath}`; const globalPath = `settings${appendedPropertyPath}`; if (path) { return getValueFromObjectPath(globalStyles, contextualPath) ?? getValueFromObjectPath(globalStyles, globalPath); } let result = {}; VALID_SETTINGS.forEach((setting) => { const value = getValueFromObjectPath( globalStyles, `settings${appendedBlockPath}.${setting}` ) ?? getValueFromObjectPath(globalStyles, `settings.${setting}`); if (value !== void 0) { result = setImmutably(result, setting.split("."), value); } }); return result; } // packages/global-styles-engine/build-module/utils/common.mjs var import_style_engine = __toESM(require_style_engine(), 1); // packages/global-styles-engine/build-module/utils/fluid.mjs var DEFAULT_MAXIMUM_VIEWPORT_WIDTH = "1600px"; var DEFAULT_MINIMUM_VIEWPORT_WIDTH = "320px"; var DEFAULT_SCALE_FACTOR = 1; var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN = 0.25; var DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX = 0.75; var DEFAULT_MINIMUM_FONT_SIZE_LIMIT = "14px"; function getComputedFluidTypographyValue({ minimumFontSize, maximumFontSize, fontSize, minimumViewportWidth = DEFAULT_MINIMUM_VIEWPORT_WIDTH, maximumViewportWidth = DEFAULT_MAXIMUM_VIEWPORT_WIDTH, scaleFactor = DEFAULT_SCALE_FACTOR, minimumFontSizeLimit }) { minimumFontSizeLimit = !!getTypographyValueAndUnit(minimumFontSizeLimit) ? minimumFontSizeLimit : DEFAULT_MINIMUM_FONT_SIZE_LIMIT; if (fontSize) { const fontSizeParsed = getTypographyValueAndUnit(fontSize); if (!fontSizeParsed?.unit || !fontSizeParsed?.value) { return null; } const minimumFontSizeLimitParsed = getTypographyValueAndUnit( minimumFontSizeLimit, { coerceTo: fontSizeParsed.unit } ); if (!!minimumFontSizeLimitParsed?.value && !minimumFontSize && !maximumFontSize) { if (fontSizeParsed?.value <= minimumFontSizeLimitParsed?.value) { return null; } } if (!maximumFontSize) { maximumFontSize = `${fontSizeParsed.value}${fontSizeParsed.unit}`; } if (!minimumFontSize) { const fontSizeValueInPx = fontSizeParsed.unit === "px" ? fontSizeParsed.value : fontSizeParsed.value * 16; const minimumFontSizeFactor = Math.min( Math.max( 1 - 0.075 * Math.log2(fontSizeValueInPx), DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MIN ), DEFAULT_MINIMUM_FONT_SIZE_FACTOR_MAX ); const calculatedMinimumFontSize = roundToPrecision( fontSizeParsed.value * minimumFontSizeFactor, 3 ); if (!!minimumFontSizeLimitParsed?.value && calculatedMinimumFontSize < minimumFontSizeLimitParsed?.value) { minimumFontSize = `${minimumFontSizeLimitParsed.value}${minimumFontSizeLimitParsed.unit}`; } else { minimumFontSize = `${calculatedMinimumFontSize}${fontSizeParsed.unit}`; } } } const minimumFontSizeParsed = getTypographyValueAndUnit(minimumFontSize); const fontSizeUnit = minimumFontSizeParsed?.unit || "rem"; const maximumFontSizeParsed = getTypographyValueAndUnit(maximumFontSize, { coerceTo: fontSizeUnit }); if (!minimumFontSizeParsed || !maximumFontSizeParsed) { return null; } const minimumFontSizeRem = getTypographyValueAndUnit(minimumFontSize, { coerceTo: "rem" }); const maximumViewportWidthParsed = getTypographyValueAndUnit( maximumViewportWidth, { coerceTo: fontSizeUnit } ); const minimumViewportWidthParsed = getTypographyValueAndUnit( minimumViewportWidth, { coerceTo: fontSizeUnit } ); if (!maximumViewportWidthParsed || !minimumViewportWidthParsed || !minimumFontSizeRem) { return null; } const linearDenominator = maximumViewportWidthParsed.value - minimumViewportWidthParsed.value; if (!linearDenominator) { return null; } const minViewportWidthOffsetValue = roundToPrecision( minimumViewportWidthParsed.value / 100, 3 ); const viewportWidthOffset = roundToPrecision(minViewportWidthOffsetValue, 3) + fontSizeUnit; const linearFactor = 100 * ((maximumFontSizeParsed.value - minimumFontSizeParsed.value) / linearDenominator); const linearFactorScaled = roundToPrecision( (linearFactor || 1) * scaleFactor, 3 ); const fluidTargetFontSize = `${minimumFontSizeRem.value}${minimumFontSizeRem.unit} + ((1vw - ${viewportWidthOffset}) * ${linearFactorScaled})`; return `clamp(${minimumFontSize}, ${fluidTargetFontSize}, ${maximumFontSize})`; } function getTypographyValueAndUnit(rawValue, options = {}) { if (typeof rawValue !== "string" && typeof rawValue !== "number") { return null; } if (isFinite(rawValue)) { rawValue = `${rawValue}px`; } const { coerceTo, rootSizeValue, acceptableUnits } = { coerceTo: "", // Default browser font size. Later we could inject some JS to compute this `getComputedStyle( document.querySelector( "html" ) ).fontSize`. rootSizeValue: 16, acceptableUnits: ["rem", "px", "em"], ...options }; const acceptableUnitsGroup = acceptableUnits?.join("|"); const regexUnits = new RegExp( `^(\\d*\\.?\\d+)(${acceptableUnitsGroup}){1,1}$` ); const matches = rawValue.toString().match(regexUnits); if (!matches || matches.length < 3) { return null; } let [, value, unit] = matches; let returnValue = parseFloat(value); if ("px" === coerceTo && ("em" === unit || "rem" === unit)) { returnValue = returnValue * rootSizeValue; unit = coerceTo; } if ("px" === unit && ("em" === coerceTo || "rem" === coerceTo)) { returnValue = returnValue / rootSizeValue; unit = coerceTo; } if (("em" === coerceTo || "rem" === coerceTo) && ("em" === unit || "rem" === unit)) { unit = coerceTo; } if (!unit) { return null; } return { value: roundToPrecision(returnValue, 3), unit }; } function roundToPrecision(value, digits = 3) { const base = Math.pow(10, digits); return Math.round(value * base) / base; } // packages/global-styles-engine/build-module/utils/typography.mjs function isFluidTypographyEnabled(typographySettings) { const fluidSettings = typographySettings?.fluid; return true === fluidSettings || fluidSettings && typeof fluidSettings === "object" && Object.keys(fluidSettings).length > 0; } function getFluidTypographyOptionsFromSettings(settings) { const typographySettings = settings?.typography ?? {}; const layoutSettings = settings?.layout; const defaultMaxViewportWidth = getTypographyValueAndUnit( layoutSettings?.wideSize ) ? layoutSettings?.wideSize : null; return isFluidTypographyEnabled(typographySettings) && defaultMaxViewportWidth ? { fluid: { maxViewportWidth: defaultMaxViewportWidth, ...typeof typographySettings.fluid === "object" ? typographySettings.fluid : {} } } : { fluid: typographySettings?.fluid }; } function getTypographyFontSizeValue(preset, settings) { const { size: defaultSize } = preset; if (!defaultSize || "0" === defaultSize || false === preset?.fluid) { return defaultSize; } if (!isFluidTypographyEnabled(settings?.typography) && !isFluidTypographyEnabled(preset)) { return defaultSize; } const fluidTypographySettings = getFluidTypographyOptionsFromSettings(settings)?.fluid ?? {}; const fluidFontSizeValue = getComputedFluidTypographyValue({ minimumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.min, maximumFontSize: typeof preset?.fluid === "boolean" ? void 0 : preset?.fluid?.max, fontSize: defaultSize, minimumFontSizeLimit: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minFontSize : void 0, maximumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.maxViewportWidth : void 0, minimumViewportWidth: typeof fluidTypographySettings === "object" ? fluidTypographySettings?.minViewportWidth : void 0 }); if (!!fluidFontSizeValue) { return fluidFontSizeValue; } return defaultSize; } // packages/global-styles-engine/build-module/utils/common.mjs var ROOT_BLOCK_SELECTOR = "body"; var ROOT_CSS_PROPERTIES_SELECTOR = ":root"; var PRESET_METADATA = [ { path: ["color", "palette"], valueKey: "color", cssVarInfix: "color", classes: [ { classSuffix: "color", propertyName: "color" }, { classSuffix: "background-color", propertyName: "background-color" }, { classSuffix: "border-color", propertyName: "border-color" } ] }, { path: ["color", "gradients"], valueKey: "gradient", cssVarInfix: "gradient", classes: [ { classSuffix: "gradient-background", propertyName: "background" } ] }, { path: ["color", "duotone"], valueKey: "colors", cssVarInfix: "duotone", valueFunc: ({ slug }) => `url( '#wp-duotone-${slug}' )`, classes: [] }, { path: ["shadow", "presets"], valueKey: "shadow", cssVarInfix: "shadow", classes: [] }, { path: ["typography", "fontSizes"], valueFunc: (preset, settings) => getTypographyFontSizeValue(preset, settings), valueKey: "size", cssVarInfix: "font-size", classes: [{ classSuffix: "font-size", propertyName: "font-size" }] }, { path: ["typography", "fontFamilies"], valueKey: "fontFamily", cssVarInfix: "font-family", classes: [ { classSuffix: "font-family", propertyName: "font-family" } ] }, { path: ["spacing", "spacingSizes"], valueKey: "size", cssVarInfix: "spacing", valueFunc: ({ size }) => size, classes: [] }, { path: ["border", "radiusSizes"], valueKey: "size", cssVarInfix: "border-radius", classes: [] }, { path: ["dimensions", "dimensionSizes"], valueKey: "size", cssVarInfix: "dimension", classes: [] } ]; function scopeSelector(scope, selector) { if (!scope || !selector) { return selector; } const scopes = scope.split(","); const selectors = selector.split(","); const selectorsScoped = []; scopes.forEach((outer) => { selectors.forEach((inner) => { selectorsScoped.push(`${outer.trim()} ${inner.trim()}`); }); }); return selectorsScoped.join(", "); } function scopeFeatureSelectors(scope, selectors) { if (!scope || !selectors) { return; } const featureSelectors = {}; Object.entries(selectors).forEach(([feature, selector]) => { if (typeof selector === "string") { featureSelectors[feature] = scopeSelector(scope, selector); } if (typeof selector === "object") { featureSelectors[feature] = {}; Object.entries(selector).forEach( ([subfeature, subfeatureSelector]) => { featureSelectors[feature][subfeature] = scopeSelector( scope, subfeatureSelector ); } ); } }); return featureSelectors; } function appendToSelector(selector, toAppend) { if (!selector.includes(",")) { return selector + toAppend; } const selectors = selector.split(","); const newSelectors = selectors.map((sel) => sel + toAppend); return newSelectors.join(","); } function getBlockStyleVariationSelector(variation, blockSelector) { const variationClass = `.is-style-${variation}`; if (!blockSelector) { return variationClass; } const ancestorRegex = /((?::\([^)]+\))?\s*)([^\s:]+)/; const addVariationClass = (_match, group1, group2) => { return group1 + group2 + variationClass; }; const result = blockSelector.split(",").map((part) => part.replace(ancestorRegex, addVariationClass)); return result.join(","); } function getResolvedRefValue(ruleValue, tree) { if (!ruleValue || !tree) { return ruleValue; } if (typeof ruleValue === "object" && "ref" in ruleValue && ruleValue?.ref) { const resolvedRuleValue = (0, import_style_engine.getCSSValueFromRawStyle)( getValueFromObjectPath(tree, ruleValue.ref) ); if (typeof resolvedRuleValue === "object" && resolvedRuleValue !== null && "ref" in resolvedRuleValue && resolvedRuleValue?.ref) { return void 0; } if (resolvedRuleValue === void 0) { return ruleValue; } return resolvedRuleValue; } return ruleValue; } function getResolvedThemeFilePath(file, themeFileURIs) { if (!file || !themeFileURIs || !Array.isArray(themeFileURIs)) { return file; } const uri = themeFileURIs.find( (themeFileUri) => themeFileUri?.name === file ); if (!uri?.href) { return file; } return uri?.href; } function getResolvedValue(ruleValue, tree) { if (!ruleValue || !tree) { return ruleValue; } const resolvedValue = getResolvedRefValue(ruleValue, tree); if (typeof resolvedValue === "object" && resolvedValue !== null && "url" in resolvedValue && resolvedValue?.url) { resolvedValue.url = getResolvedThemeFilePath( resolvedValue.url, tree?._links?.["wp:theme-file"] ); } return resolvedValue; } // packages/global-styles-engine/build-module/core/render.mjs var import_blocks = __toESM(require_blocks(), 1); var import_style_engine2 = __toESM(require_style_engine(), 1); var import_data2 = __toESM(require_data(), 1); // packages/global-styles-engine/build-module/core/selectors.mjs function getBlockSelector(blockType, target = "root", options = {}) { if (!target) { return null; } const { fallback = false } = options; const { name, selectors, supports } = blockType; const hasSelectors = selectors && Object.keys(selectors).length > 0; const path = Array.isArray(target) ? target.join(".") : target; let rootSelector = null; if (hasSelectors && selectors.root) { rootSelector = selectors?.root; } else if (supports?.__experimentalSelector) { rootSelector = supports.__experimentalSelector; } else { rootSelector = ".wp-block-" + name.replace("core/", "").replace("/", "-"); } if (path === "root") { return rootSelector; } const pathArray = Array.isArray(target) ? target : target.split("."); if (pathArray.length === 1) { const fallbackSelector = fallback ? rootSelector : null; if (hasSelectors) { const featureSelector2 = getValueFromObjectPath( selectors, `${path}.root`, null ) || getValueFromObjectPath(selectors, path, null); return featureSelector2 || fallbackSelector; } const featureSelector = supports ? getValueFromObjectPath( supports, `${path}.__experimentalSelector`, null ) : void 0; if (!featureSelector) { return fallbackSelector; } return scopeSelector(rootSelector, featureSelector); } let subfeatureSelector; if (hasSelectors) { subfeatureSelector = getValueFromObjectPath(selectors, path, null); } if (subfeatureSelector) { return subfeatureSelector; } if (fallback) { return getBlockSelector(blockType, pathArray[0], options); } return null; } // node_modules/colord/index.mjs var r = { grad: 0.9, turn: 360, rad: 360 / (2 * Math.PI) }; var t = function(r2) { return "string" == typeof r2 ? r2.length > 0 : "number" == typeof r2; }; var n = function(r2, t2, n2) { return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = Math.pow(10, t2)), Math.round(n2 * r2) / n2 + 0; }; var e = function(r2, t2, n2) { return void 0 === t2 && (t2 = 0), void 0 === n2 && (n2 = 1), r2 > n2 ? n2 : r2 > t2 ? r2 : t2; }; var u = function(r2) { return (r2 = isFinite(r2) ? r2 % 360 : 0) > 0 ? r2 : r2 + 360; }; var a = function(r2) { return { r: e(r2.r, 0, 255), g: e(r2.g, 0, 255), b: e(r2.b, 0, 255), a: e(r2.a) }; }; var o = function(r2) { return { r: n(r2.r), g: n(r2.g), b: n(r2.b), a: n(r2.a, 3) }; }; var i = /^#([0-9a-f]{3,8})$/i; var s = function(r2) { var t2 = r2.toString(16); return t2.length < 2 ? "0" + t2 : t2; }; var h = function(r2) { var t2 = r2.r, n2 = r2.g, e2 = r2.b, u2 = r2.a, a2 = Math.max(t2, n2, e2), o2 = a2 - Math.min(t2, n2, e2), i2 = o2 ? a2 === t2 ? (n2 - e2) / o2 : a2 === n2 ? 2 + (e2 - t2) / o2 : 4 + (t2 - n2) / o2 : 0; return { h: 60 * (i2 < 0 ? i2 + 6 : i2), s: a2 ? o2 / a2 * 100 : 0, v: a2 / 255 * 100, a: u2 }; }; var b = function(r2) { var t2 = r2.h, n2 = r2.s, e2 = r2.v, u2 = r2.a; t2 = t2 / 360 * 6, n2 /= 100, e2 /= 100; var a2 = Math.floor(t2), o2 = e2 * (1 - n2), i2 = e2 * (1 - (t2 - a2) * n2), s2 = e2 * (1 - (1 - t2 + a2) * n2), h2 = a2 % 6; return { r: 255 * [e2, i2, o2, o2, s2, e2][h2], g: 255 * [s2, e2, e2, i2, o2, o2][h2], b: 255 * [o2, o2, s2, e2, e2, i2][h2], a: u2 }; }; var g = function(r2) { return { h: u(r2.h), s: e(r2.s, 0, 100), l: e(r2.l, 0, 100), a: e(r2.a) }; }; var d = function(r2) { return { h: n(r2.h), s: n(r2.s), l: n(r2.l), a: n(r2.a, 3) }; }; var f = function(r2) { return b((n2 = (t2 = r2).s, { h: t2.h, s: (n2 *= ((e2 = t2.l) < 50 ? e2 : 100 - e2) / 100) > 0 ? 2 * n2 / (e2 + n2) * 100 : 0, v: e2 + n2, a: t2.a })); var t2, n2, e2; }; var c = function(r2) { return { h: (t2 = h(r2)).h, s: (u2 = (200 - (n2 = t2.s)) * (e2 = t2.v) / 100) > 0 && u2 < 200 ? n2 * e2 / 100 / (u2 <= 100 ? u2 : 200 - u2) * 100 : 0, l: u2 / 2, a: t2.a }; var t2, n2, e2, u2; }; var l = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; var p = /^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; var v = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; var m = /^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i; var y = { string: [[function(r2) { var t2 = i.exec(r2); return t2 ? (r2 = t2[1]).length <= 4 ? { r: parseInt(r2[0] + r2[0], 16), g: parseInt(r2[1] + r2[1], 16), b: parseInt(r2[2] + r2[2], 16), a: 4 === r2.length ? n(parseInt(r2[3] + r2[3], 16) / 255, 2) : 1 } : 6 === r2.length || 8 === r2.length ? { r: parseInt(r2.substr(0, 2), 16), g: parseInt(r2.substr(2, 2), 16), b: parseInt(r2.substr(4, 2), 16), a: 8 === r2.length ? n(parseInt(r2.substr(6, 2), 16) / 255, 2) : 1 } : null : null; }, "hex"], [function(r2) { var t2 = v.exec(r2) || m.exec(r2); return t2 ? t2[2] !== t2[4] || t2[4] !== t2[6] ? null : a({ r: Number(t2[1]) / (t2[2] ? 100 / 255 : 1), g: Number(t2[3]) / (t2[4] ? 100 / 255 : 1), b: Number(t2[5]) / (t2[6] ? 100 / 255 : 1), a: void 0 === t2[7] ? 1 : Number(t2[7]) / (t2[8] ? 100 : 1) }) : null; }, "rgb"], [function(t2) { var n2 = l.exec(t2) || p.exec(t2); if (!n2) return null; var e2, u2, a2 = g({ h: (e2 = n2[1], u2 = n2[2], void 0 === u2 && (u2 = "deg"), Number(e2) * (r[u2] || 1)), s: Number(n2[3]), l: Number(n2[4]), a: void 0 === n2[5] ? 1 : Number(n2[5]) / (n2[6] ? 100 : 1) }); return f(a2); }, "hsl"]], object: [[function(r2) { var n2 = r2.r, e2 = r2.g, u2 = r2.b, o2 = r2.a, i2 = void 0 === o2 ? 1 : o2; return t(n2) && t(e2) && t(u2) ? a({ r: Number(n2), g: Number(e2), b: Number(u2), a: Number(i2) }) : null; }, "rgb"], [function(r2) { var n2 = r2.h, e2 = r2.s, u2 = r2.l, a2 = r2.a, o2 = void 0 === a2 ? 1 : a2; if (!t(n2) || !t(e2) || !t(u2)) return null; var i2 = g({ h: Number(n2), s: Number(e2), l: Number(u2), a: Number(o2) }); return f(i2); }, "hsl"], [function(r2) { var n2 = r2.h, a2 = r2.s, o2 = r2.v, i2 = r2.a, s2 = void 0 === i2 ? 1 : i2; if (!t(n2) || !t(a2) || !t(o2)) return null; var h2 = (function(r3) { return { h: u(r3.h), s: e(r3.s, 0, 100), v: e(r3.v, 0, 100), a: e(r3.a) }; })({ h: Number(n2), s: Number(a2), v: Number(o2), a: Number(s2) }); return b(h2); }, "hsv"]] }; var N = function(r2, t2) { for (var n2 = 0; n2 < t2.length; n2++) { var e2 = t2[n2][0](r2); if (e2) return [e2, t2[n2][1]]; } return [null, void 0]; }; var x = function(r2) { return "string" == typeof r2 ? N(r2.trim(), y.string) : "object" == typeof r2 && null !== r2 ? N(r2, y.object) : [null, void 0]; }; var M = function(r2, t2) { var n2 = c(r2); return { h: n2.h, s: e(n2.s + 100 * t2, 0, 100), l: n2.l, a: n2.a }; }; var H = function(r2) { return (299 * r2.r + 587 * r2.g + 114 * r2.b) / 1e3 / 255; }; var $ = function(r2, t2) { var n2 = c(r2); return { h: n2.h, s: n2.s, l: e(n2.l + 100 * t2, 0, 100), a: n2.a }; }; var j = (function() { function r2(r3) { this.parsed = x(r3)[0], this.rgba = this.parsed || { r: 0, g: 0, b: 0, a: 1 }; } return r2.prototype.isValid = function() { return null !== this.parsed; }, r2.prototype.brightness = function() { return n(H(this.rgba), 2); }, r2.prototype.isDark = function() { return H(this.rgba) < 0.5; }, r2.prototype.isLight = function() { return H(this.rgba) >= 0.5; }, r2.prototype.toHex = function() { return r3 = o(this.rgba), t2 = r3.r, e2 = r3.g, u2 = r3.b, i2 = (a2 = r3.a) < 1 ? s(n(255 * a2)) : "", "#" + s(t2) + s(e2) + s(u2) + i2; var r3, t2, e2, u2, a2, i2; }, r2.prototype.toRgb = function() { return o(this.rgba); }, r2.prototype.toRgbString = function() { return r3 = o(this.rgba), t2 = r3.r, n2 = r3.g, e2 = r3.b, (u2 = r3.a) < 1 ? "rgba(" + t2 + ", " + n2 + ", " + e2 + ", " + u2 + ")" : "rgb(" + t2 + ", " + n2 + ", " + e2 + ")"; var r3, t2, n2, e2, u2; }, r2.prototype.toHsl = function() { return d(c(this.rgba)); }, r2.prototype.toHslString = function() { return r3 = d(c(this.rgba)), t2 = r3.h, n2 = r3.s, e2 = r3.l, (u2 = r3.a) < 1 ? "hsla(" + t2 + ", " + n2 + "%, " + e2 + "%, " + u2 + ")" : "hsl(" + t2 + ", " + n2 + "%, " + e2 + "%)"; var r3, t2, n2, e2, u2; }, r2.prototype.toHsv = function() { return r3 = h(this.rgba), { h: n(r3.h), s: n(r3.s), v: n(r3.v), a: n(r3.a, 3) }; var r3; }, r2.prototype.invert = function() { return w({ r: 255 - (r3 = this.rgba).r, g: 255 - r3.g, b: 255 - r3.b, a: r3.a }); var r3; }, r2.prototype.saturate = function(r3) { return void 0 === r3 && (r3 = 0.1), w(M(this.rgba, r3)); }, r2.prototype.desaturate = function(r3) { return void 0 === r3 && (r3 = 0.1), w(M(this.rgba, -r3)); }, r2.prototype.grayscale = function() { return w(M(this.rgba, -1)); }, r2.prototype.lighten = function(r3) { return void 0 === r3 && (r3 = 0.1), w($(this.rgba, r3)); }, r2.prototype.darken = function(r3) { return void 0 === r3 && (r3 = 0.1), w($(this.rgba, -r3)); }, r2.prototype.rotate = function(r3) { return void 0 === r3 && (r3 = 15), this.hue(this.hue() + r3); }, r2.prototype.alpha = function(r3) { return "number" == typeof r3 ? w({ r: (t2 = this.rgba).r, g: t2.g, b: t2.b, a: r3 }) : n(this.rgba.a, 3); var t2; }, r2.prototype.hue = function(r3) { var t2 = c(this.rgba); return "number" == typeof r3 ? w({ h: r3, s: t2.s, l: t2.l, a: t2.a }) : n(t2.h); }, r2.prototype.isEqual = function(r3) { return this.toHex() === w(r3).toHex(); }, r2; })(); var w = function(r2) { return r2 instanceof j ? r2 : new j(r2); }; // packages/global-styles-engine/build-module/utils/duotone.mjs function getValuesFromColors(colors = []) { const values = { r: [], g: [], b: [], a: [] }; colors.forEach((color) => { const rgbColor = w(color).toRgb(); values.r.push(rgbColor.r / 255); values.g.push(rgbColor.g / 255); values.b.push(rgbColor.b / 255); values.a.push(rgbColor.a); }); return values; } function getDuotoneFilter(id, colors) { const values = getValuesFromColors(colors); return ` `; } // packages/global-styles-engine/build-module/utils/string.mjs function kebabCase(str) { return str.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/([0-9])([a-zA-Z])/g, "$1-$2").replace(/([a-zA-Z])([0-9])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase(); } // packages/global-styles-engine/build-module/utils/spacing.mjs function getSpacingPresetCssVar(value) { if (!value) { return; } const slug = value.match(/var:preset\|spacing\|(.+)/); if (!slug) { return value; } return `var(--wp--preset--spacing--${slug[1]})`; } // packages/global-styles-engine/build-module/utils/gap.mjs function getGapBoxControlValueFromStyle(blockGapValue) { if (!blockGapValue) { return null; } const isValueString = typeof blockGapValue === "string"; return { top: isValueString ? blockGapValue : blockGapValue?.top, left: isValueString ? blockGapValue : blockGapValue?.left }; } function getGapCSSValue(blockGapValue, defaultValue = "0") { const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue); if (!blockGapBoxControlValue) { return null; } const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue; const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue; return row === column ? row : `${row} ${column}`; } // packages/global-styles-engine/build-module/utils/background.mjs var BACKGROUND_BLOCK_DEFAULT_VALUES = { backgroundSize: "cover", backgroundPosition: "50% 50%" // used only when backgroundSize is 'contain'. }; function setBackgroundStyleDefaults(backgroundStyle) { if (!backgroundStyle || // @ts-expect-error !backgroundStyle?.backgroundImage?.url) { return; } let backgroundStylesWithDefaults; if (!backgroundStyle?.backgroundSize) { backgroundStylesWithDefaults = { backgroundSize: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundSize }; } if ("contain" === backgroundStyle?.backgroundSize && !backgroundStyle?.backgroundPosition) { backgroundStylesWithDefaults = { backgroundPosition: BACKGROUND_BLOCK_DEFAULT_VALUES.backgroundPosition }; } return backgroundStylesWithDefaults; } // packages/global-styles-engine/build-module/utils/layout.mjs var LAYOUT_DEFINITIONS = { default: { name: "default", slug: "flow", className: "is-layout-flow", baseStyles: [ { selector: " > .alignleft", rules: { float: "left", "margin-inline-start": "0", "margin-inline-end": "2em" } }, { selector: " > .alignright", rules: { float: "right", "margin-inline-start": "2em", "margin-inline-end": "0" } }, { selector: " > .aligncenter", rules: { "margin-left": "auto !important", "margin-right": "auto !important" } } ], spacingStyles: [ { selector: " > :first-child", rules: { "margin-block-start": "0" } }, { selector: " > :last-child", rules: { "margin-block-end": "0" } }, { selector: " > *", rules: { "margin-block-start": null, "margin-block-end": "0" } } ] }, constrained: { name: "constrained", slug: "constrained", className: "is-layout-constrained", baseStyles: [ { selector: " > .alignleft", rules: { float: "left", "margin-inline-start": "0", "margin-inline-end": "2em" } }, { selector: " > .alignright", rules: { float: "right", "margin-inline-start": "2em", "margin-inline-end": "0" } }, { selector: " > .aligncenter", rules: { "margin-left": "auto !important", "margin-right": "auto !important" } }, { selector: " > :where(:not(.alignleft):not(.alignright):not(.alignfull))", rules: { "max-width": "var(--wp--style--global--content-size)", "margin-left": "auto !important", "margin-right": "auto !important" } }, { selector: " > .alignwide", rules: { "max-width": "var(--wp--style--global--wide-size)" } } ], spacingStyles: [ { selector: " > :first-child", rules: { "margin-block-start": "0" } }, { selector: " > :last-child", rules: { "margin-block-end": "0" } }, { selector: " > *", rules: { "margin-block-start": null, "margin-block-end": "0" } } ] }, flex: { name: "flex", slug: "flex", className: "is-layout-flex", displayMode: "flex", baseStyles: [ { selector: "", rules: { "flex-wrap": "wrap", "align-items": "center" } }, { selector: " > :is(*, div)", // :is(*, div) instead of just * increases the specificity by 001. rules: { margin: "0" } } ], spacingStyles: [ { selector: "", rules: { gap: null } } ] }, grid: { name: "grid", slug: "grid", className: "is-layout-grid", displayMode: "grid", baseStyles: [ { selector: " > :is(*, div)", // :is(*, div) instead of just * increases the specificity by 001. rules: { margin: "0" } } ], spacingStyles: [ { selector: "", rules: { gap: null } } ] } }; // packages/global-styles-engine/build-module/core/render.mjs var ELEMENT_CLASS_NAMES = { button: "wp-element-button", caption: "wp-element-caption" }; var BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS = { __experimentalBorder: "border", color: "color", dimensions: "dimensions", spacing: "spacing", typography: "typography" }; function getPresetsDeclarations(blockPresets = {}, mergedSettings) { return PRESET_METADATA.reduce( (declarations, { path, valueKey, valueFunc, cssVarInfix }) => { const presetByOrigin = getValueFromObjectPath( blockPresets, path, [] ); ["default", "theme", "custom"].forEach((origin) => { if (presetByOrigin[origin]) { presetByOrigin[origin].forEach((value) => { if (valueKey && !valueFunc) { declarations.push( `--wp--preset--${cssVarInfix}--${kebabCase( value.slug )}: ${value[valueKey]}` ); } else if (valueFunc && typeof valueFunc === "function") { declarations.push( `--wp--preset--${cssVarInfix}--${kebabCase( value.slug )}: ${valueFunc(value, mergedSettings)}` ); } }); } }); return declarations; }, [] ); } function getPresetsClasses(blockSelector = "*", blockPresets = {}) { return PRESET_METADATA.reduce( (declarations, { path, cssVarInfix, classes }) => { if (!classes) { return declarations; } const presetByOrigin = getValueFromObjectPath( blockPresets, path, [] ); ["default", "theme", "custom"].forEach((origin) => { if (presetByOrigin[origin]) { presetByOrigin[origin].forEach( ({ slug }) => { classes.forEach( ({ classSuffix, propertyName }) => { const classSelectorToUse = `.has-${kebabCase( slug )}-${classSuffix}`; const selectorToUse = blockSelector.split(",").map( (selector) => `${selector}${classSelectorToUse}` ).join(","); const value = `var(--wp--preset--${cssVarInfix}--${kebabCase( slug )})`; declarations += `${selectorToUse}{${propertyName}: ${value} !important;}`; } ); } ); } }); return declarations; }, "" ); } function getPresetsSvgFilters(blockPresets = {}) { return PRESET_METADATA.filter( // Duotone are the only type of filters for now. (metadata) => metadata.path.at(-1) === "duotone" ).flatMap((metadata) => { const presetByOrigin = getValueFromObjectPath( blockPresets, metadata.path, {} ); return ["default", "theme"].filter((origin) => presetByOrigin[origin]).flatMap( (origin) => presetByOrigin[origin].map( (preset) => getDuotoneFilter( `wp-duotone-${preset.slug}`, preset.colors ) ) ).join(""); }); } function flattenTree(input = {}, prefix, token) { let result = []; Object.keys(input).forEach((key) => { const newKey = prefix + kebabCase(key.replace("/", "-")); const newLeaf = input[key]; if (newLeaf instanceof Object) { const newPrefix = newKey + token; result = [...result, ...flattenTree(newLeaf, newPrefix, token)]; } else { result.push(`${newKey}: ${newLeaf}`); } }); return result; } function concatFeatureVariationSelectorString(featureSelector, styleVariationSelector) { const featureSelectors = featureSelector.split(","); const combinedSelectors = []; featureSelectors.forEach((selector) => { combinedSelectors.push( `${styleVariationSelector.trim()}${selector.trim()}` ); }); return combinedSelectors.join(", "); } var updateParagraphTextIndentSelector = (featureDeclarations, settings, blockName) => { if (blockName !== "core/paragraph") { return featureDeclarations; } const blockSettings = settings?.blocks?.["core/paragraph"]; const textIndentSetting = blockSettings?.typography?.textIndent ?? settings?.typography?.textIndent ?? "subsequent"; if (textIndentSetting !== "all") { return featureDeclarations; } const oldSelector = ".wp-block-paragraph + .wp-block-paragraph"; const newSelector = ".wp-block-paragraph"; if (oldSelector in featureDeclarations) { const declarations = featureDeclarations[oldSelector]; const updated = { ...featureDeclarations }; delete updated[oldSelector]; updated[newSelector] = declarations; return updated; } return featureDeclarations; }; var getFeatureDeclarations = (selectors, styles) => { const declarations = {}; Object.entries(selectors).forEach(([feature, selector]) => { if (feature === "root" || !styles?.[feature]) { return; } const isShorthand = typeof selector === "string"; if (!isShorthand && typeof selector === "object" && selector !== null) { Object.entries(selector).forEach( ([subfeature, subfeatureSelector]) => { if (subfeature === "root" || !styles?.[feature][subfeature]) { return; } const subfeatureStyles = { [feature]: { [subfeature]: styles[feature][subfeature] } }; const newDeclarations = getStylesDeclarations(subfeatureStyles); declarations[subfeatureSelector] = [ ...declarations[subfeatureSelector] || [], ...newDeclarations ]; delete styles[feature][subfeature]; } ); } if (isShorthand || typeof selector === "object" && selector !== null && "root" in selector) { const featureSelector = isShorthand ? selector : selector.root; const featureStyles = { [feature]: styles[feature] }; const newDeclarations = getStylesDeclarations(featureStyles); declarations[featureSelector] = [ ...declarations[featureSelector] || [], ...newDeclarations ]; delete styles[feature]; } }); return declarations; }; function getStylesDeclarations(blockStyles = {}, selector = "", useRootPaddingAlign, tree = {}, disableRootPadding = false) { const isRoot = ROOT_BLOCK_SELECTOR === selector; const output = Object.entries( import_blocks.__EXPERIMENTAL_STYLE_PROPERTY ).reduce( (declarations, [key, { value, properties, useEngine, rootOnly }]) => { if (rootOnly && !isRoot) { return declarations; } const pathToValue = value; if (pathToValue[0] === "elements" || useEngine) { return declarations; } const styleValue = getValueFromObjectPath( blockStyles, pathToValue ); if (key === "--wp--style--root--padding" && (typeof styleValue === "string" || !useRootPaddingAlign)) { return declarations; } if (properties && typeof styleValue !== "string") { Object.entries(properties).forEach((entry) => { const [name, prop] = entry; if (!getValueFromObjectPath(styleValue, [prop], false)) { return; } const cssProperty = name.startsWith("--") ? name : kebabCase(name); declarations.push( `${cssProperty}: ${(0, import_style_engine2.getCSSValueFromRawStyle)( getValueFromObjectPath(styleValue, [prop]) )}` ); }); } else if (getValueFromObjectPath(blockStyles, pathToValue, false)) { const cssProperty = key.startsWith("--") ? key : kebabCase(key); declarations.push( `${cssProperty}: ${(0, import_style_engine2.getCSSValueFromRawStyle)( getValueFromObjectPath(blockStyles, pathToValue) )}` ); } return declarations; }, [] ); if (!!blockStyles.background) { if (blockStyles.background?.backgroundImage) { blockStyles.background.backgroundImage = getResolvedValue( blockStyles.background.backgroundImage, tree ); } if (!isRoot && !!blockStyles.background?.backgroundImage?.id) { blockStyles = { ...blockStyles, background: { ...blockStyles.background, ...setBackgroundStyleDefaults(blockStyles.background) } }; } } const extraRules = (0, import_style_engine2.getCSSRules)(blockStyles); extraRules.forEach((rule) => { if (isRoot && (useRootPaddingAlign || disableRootPadding) && rule.key.startsWith("padding")) { return; } const cssProperty = rule.key.startsWith("--") ? rule.key : kebabCase(rule.key); let ruleValue = getResolvedValue(rule.value, tree); if (cssProperty === "font-size") { ruleValue = getTypographyFontSizeValue( { name: "", slug: "", size: ruleValue }, tree?.settings ); } if (cssProperty === "aspect-ratio") { output.push("min-height: unset"); } output.push(`${cssProperty}: ${ruleValue}`); }); return output; } function getLayoutStyles({ layoutDefinitions = LAYOUT_DEFINITIONS, style, selector, hasBlockGapSupport, hasFallbackGapSupport, fallbackGapValue }) { let ruleset = ""; let gapValue = hasBlockGapSupport ? getGapCSSValue(style?.spacing?.blockGap) : ""; if (hasFallbackGapSupport) { if (selector === ROOT_BLOCK_SELECTOR) { gapValue = !gapValue ? "0.5em" : gapValue; } else if (!hasBlockGapSupport && fallbackGapValue) { gapValue = fallbackGapValue; } } if (gapValue && layoutDefinitions) { Object.values(layoutDefinitions).forEach( ({ className, name, spacingStyles }) => { if (!hasBlockGapSupport && "flex" !== name && "grid" !== name) { return; } if (spacingStyles?.length) { spacingStyles.forEach((spacingStyle) => { const declarations = []; if (spacingStyle.rules) { Object.entries(spacingStyle.rules).forEach( ([cssProperty, cssValue]) => { declarations.push( `${cssProperty}: ${cssValue ? cssValue : gapValue}` ); } ); } if (declarations.length) { let combinedSelector = ""; if (!hasBlockGapSupport) { combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:where(.${className}${spacingStyle?.selector || ""})` : `:where(${selector}.${className}${spacingStyle?.selector || ""})`; } else { combinedSelector = selector === ROOT_BLOCK_SELECTOR ? `:root :where(.${className})${spacingStyle?.selector || ""}` : `:root :where(${selector}-${className})${spacingStyle?.selector || ""}`; } ruleset += `${combinedSelector} { ${declarations.join( "; " )}; }`; } }); } } ); if (selector === ROOT_BLOCK_SELECTOR && hasBlockGapSupport) { ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} { --wp--style--block-gap: ${gapValue}; }`; } } if (selector === ROOT_BLOCK_SELECTOR && layoutDefinitions) { const validDisplayModes = ["block", "flex", "grid"]; Object.values(layoutDefinitions).forEach( ({ className, displayMode, baseStyles }) => { if (displayMode && validDisplayModes.includes(displayMode)) { ruleset += `${selector} .${className} { display:${displayMode}; }`; } if (baseStyles?.length) { baseStyles.forEach((baseStyle) => { const declarations = []; if (baseStyle.rules) { Object.entries(baseStyle.rules).forEach( ([cssProperty, cssValue]) => { declarations.push( `${cssProperty}: ${cssValue}` ); } ); } if (declarations.length) { const combinedSelector = `.${className}${baseStyle?.selector || ""}`; ruleset += `${combinedSelector} { ${declarations.join( "; " )}; }`; } }); } } ); } return ruleset; } var STYLE_KEYS = [ "border", "color", "dimensions", "spacing", "typography", "filter", "outline", "shadow", "background" ]; function pickStyleKeys(treeToPickFrom) { if (!treeToPickFrom) { return {}; } const entries = Object.entries(treeToPickFrom); const pickedEntries = entries.filter( ([key]) => STYLE_KEYS.includes(key) ); const clonedEntries = pickedEntries.map(([key, style]) => [ key, JSON.parse(JSON.stringify(style)) ]); return Object.fromEntries(clonedEntries); } var getNodesWithStyles = (tree, blockSelectors) => { const nodes = []; if (!tree?.styles) { return nodes; } const styles = pickStyleKeys(tree.styles); if (styles) { nodes.push({ styles, selector: ROOT_BLOCK_SELECTOR, // Root selector (body) styles should not be wrapped in `:root where()` to keep // specificity at (0,0,1) and maintain backwards compatibility. skipSelectorWrapper: true }); } Object.entries(import_blocks.__EXPERIMENTAL_ELEMENTS).forEach(([name, selector]) => { if (tree.styles?.elements?.[name]) { nodes.push({ styles: tree.styles?.elements?.[name] ?? {}, selector, // Top level elements that don't use a class name should not receive the // `:root :where()` wrapper to maintain backwards compatibility. skipSelectorWrapper: !ELEMENT_CLASS_NAMES[name] }); } }); Object.entries(tree.styles?.blocks ?? {}).forEach( ([blockName, node]) => { const blockStyles = pickStyleKeys(node); const typedNode = node; const variationNodesToAdd = []; if (typedNode?.variations) { const variations = {}; Object.entries(typedNode.variations).forEach( ([variationName, variation]) => { const typedVariation = variation; variations[variationName] = pickStyleKeys(typedVariation); if (typedVariation?.css) { variations[variationName].css = typedVariation.css; } const variationSelector = typeof blockSelectors !== "string" ? blockSelectors[blockName]?.styleVariationSelectors?.[variationName] : void 0; Object.entries( typedVariation?.elements ?? {} ).forEach(([element, elementStyles]) => { if (elementStyles && import_blocks.__EXPERIMENTAL_ELEMENTS[element]) { variationNodesToAdd.push({ styles: elementStyles, selector: scopeSelector( variationSelector, import_blocks.__EXPERIMENTAL_ELEMENTS[element] ) }); } }); Object.entries(typedVariation?.blocks ?? {}).forEach( ([ variationBlockName, variationBlockStyles ]) => { const variationBlockSelector = typeof blockSelectors !== "string" ? scopeSelector( variationSelector, blockSelectors[variationBlockName]?.selector ) : void 0; const variationDuotoneSelector = typeof blockSelectors !== "string" ? scopeSelector( variationSelector, blockSelectors[variationBlockName]?.duotoneSelector ) : void 0; const variationFeatureSelectors = typeof blockSelectors !== "string" ? scopeFeatureSelectors( variationSelector, blockSelectors[variationBlockName]?.featureSelectors ?? {} ) : void 0; const variationBlockStyleNodes = pickStyleKeys(variationBlockStyles); if (variationBlockStyles?.css) { variationBlockStyleNodes.css = variationBlockStyles.css; } if (!variationBlockSelector || typeof blockSelectors === "string") { return; } variationNodesToAdd.push({ selector: variationBlockSelector, duotoneSelector: variationDuotoneSelector, featureSelectors: variationFeatureSelectors, fallbackGapValue: blockSelectors[variationBlockName]?.fallbackGapValue, hasLayoutSupport: blockSelectors[variationBlockName]?.hasLayoutSupport, styles: variationBlockStyleNodes }); Object.entries( variationBlockStyles.elements ?? {} ).forEach( ([ variationBlockElement, variationBlockElementStyles ]) => { if (variationBlockElementStyles && import_blocks.__EXPERIMENTAL_ELEMENTS[variationBlockElement]) { variationNodesToAdd.push({ styles: variationBlockElementStyles, selector: scopeSelector( variationBlockSelector, import_blocks.__EXPERIMENTAL_ELEMENTS[variationBlockElement] ) }); } } ); } ); } ); blockStyles.variations = variations; } if (typeof blockSelectors !== "string" && blockSelectors?.[blockName]?.selector) { nodes.push({ duotoneSelector: blockSelectors[blockName].duotoneSelector, fallbackGapValue: blockSelectors[blockName].fallbackGapValue, hasLayoutSupport: blockSelectors[blockName].hasLayoutSupport, selector: blockSelectors[blockName].selector, styles: blockStyles, featureSelectors: blockSelectors[blockName].featureSelectors, styleVariationSelectors: blockSelectors[blockName].styleVariationSelectors, name: blockName }); } Object.entries(typedNode?.elements ?? {}).forEach( ([elementName, value]) => { if (typeof blockSelectors !== "string" && value && blockSelectors?.[blockName] && import_blocks.__EXPERIMENTAL_ELEMENTS[elementName]) { nodes.push({ styles: value, selector: blockSelectors[blockName]?.selector.split(",").map((sel) => { const elementSelectors = import_blocks.__EXPERIMENTAL_ELEMENTS[elementName].split(","); return elementSelectors.map( (elementSelector) => sel + " " + elementSelector ); }).join(",") }); } } ); nodes.push(...variationNodesToAdd); } ); return nodes; }; var getNodesWithSettings = (tree, blockSelectors) => { const nodes = []; if (!tree?.settings) { return nodes; } const pickPresets = (treeToPickFrom) => { let presets2 = {}; PRESET_METADATA.forEach(({ path }) => { const value = getValueFromObjectPath(treeToPickFrom, path, false); if (value !== false) { presets2 = setImmutably(presets2, path, value); } }); return presets2; }; const presets = pickPresets(tree.settings); const custom = tree.settings?.custom; if (Object.keys(presets).length > 0 || custom) { nodes.push({ presets, custom, selector: ROOT_CSS_PROPERTIES_SELECTOR }); } Object.entries(tree.settings?.blocks ?? {}).forEach( ([blockName, node]) => { const blockCustom = node.custom; if (typeof blockSelectors === "string" || !blockSelectors[blockName]) { return; } const blockPresets = pickPresets(node); if (Object.keys(blockPresets).length > 0 || blockCustom) { nodes.push({ presets: blockPresets, custom: blockCustom, selector: blockSelectors[blockName]?.selector }); } } ); return nodes; }; var generateCustomProperties = (tree, blockSelectors) => { const settings = getNodesWithSettings(tree, blockSelectors); let ruleset = ""; settings.forEach(({ presets, custom, selector }) => { const declarations = tree?.settings ? getPresetsDeclarations(presets, tree?.settings) : []; const customProps = flattenTree(custom, "--wp--custom--", "--"); if (customProps.length > 0) { declarations.push(...customProps); } if (declarations.length > 0) { ruleset += `${selector}{${declarations.join(";")};}`; } }); return ruleset; }; var transformToStyles = (tree, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles = false, disableRootPadding = false, styleOptions = {}) => { const options = { blockGap: true, blockStyles: true, layoutStyles: true, marginReset: true, presets: true, rootPadding: true, variationStyles: false, ...styleOptions }; const nodesWithStyles = getNodesWithStyles(tree, blockSelectors); const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); const useRootPaddingAlign = tree?.settings?.useRootPaddingAwareAlignments; const { contentSize, wideSize } = tree?.settings?.layout || {}; const hasBodyStyles = options.marginReset || options.rootPadding || options.layoutStyles; let ruleset = ""; if (options.presets && (contentSize || wideSize)) { ruleset += `${ROOT_CSS_PROPERTIES_SELECTOR} {`; ruleset = contentSize ? ruleset + ` --wp--style--global--content-size: ${contentSize};` : ruleset; ruleset = wideSize ? ruleset + ` --wp--style--global--wide-size: ${wideSize};` : ruleset; ruleset += "}"; } if (hasBodyStyles) { ruleset += ":where(body) {margin: 0;"; if (options.rootPadding && useRootPaddingAlign) { ruleset += `padding-right: 0; padding-left: 0; padding-top: var(--wp--style--root--padding-top); padding-bottom: var(--wp--style--root--padding-bottom) } .has-global-padding { padding-right: var(--wp--style--root--padding-right); padding-left: var(--wp--style--root--padding-left); } .has-global-padding > .alignfull { margin-right: calc(var(--wp--style--root--padding-right) * -1); margin-left: calc(var(--wp--style--root--padding-left) * -1); } .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) { padding-right: 0; padding-left: 0; } .has-global-padding :where(:not(.alignfull.is-layout-flow) > .has-global-padding:not(.wp-block-block, .alignfull)) > .alignfull { margin-left: 0; margin-right: 0; `; } ruleset += "}"; } if (options.blockStyles) { nodesWithStyles.forEach( ({ selector, duotoneSelector, styles, fallbackGapValue, hasLayoutSupport, featureSelectors, styleVariationSelectors, skipSelectorWrapper, name }) => { if (featureSelectors) { let featureDeclarations = getFeatureDeclarations( featureSelectors, styles ); featureDeclarations = updateParagraphTextIndentSelector( featureDeclarations, tree.settings, name ); Object.entries(featureDeclarations).forEach( ([cssSelector, declarations]) => { if (declarations.length) { const rules = declarations.join(";"); ruleset += `:root :where(${cssSelector}){${rules};}`; } } ); } if (duotoneSelector) { const duotoneStyles = {}; if (styles?.filter) { duotoneStyles.filter = styles.filter; delete styles.filter; } const duotoneDeclarations = getStylesDeclarations(duotoneStyles); if (duotoneDeclarations.length) { ruleset += `${duotoneSelector}{${duotoneDeclarations.join( ";" )};}`; } } if (!disableLayoutStyles && (ROOT_BLOCK_SELECTOR === selector || hasLayoutSupport)) { ruleset += getLayoutStyles({ style: styles, selector, hasBlockGapSupport, hasFallbackGapSupport, fallbackGapValue }); } const styleDeclarations = getStylesDeclarations( styles, selector, useRootPaddingAlign, tree, disableRootPadding ); if (styleDeclarations?.length) { const generalSelector = skipSelectorWrapper ? selector : `:root :where(${selector})`; ruleset += `${generalSelector}{${styleDeclarations.join( ";" )};}`; } if (styles?.css) { ruleset += processCSSNesting( styles.css, `:root :where(${selector})` ); } if (options.variationStyles && styleVariationSelectors) { Object.entries(styleVariationSelectors).forEach( ([styleVariationName, styleVariationSelector]) => { const styleVariations = styles?.variations?.[styleVariationName]; if (styleVariations) { if (featureSelectors) { let featureDeclarations = getFeatureDeclarations( featureSelectors, styleVariations ); featureDeclarations = updateParagraphTextIndentSelector( featureDeclarations, tree.settings, name ); Object.entries( featureDeclarations ).forEach( ([baseSelector, declarations]) => { if (declarations.length) { const cssSelector = concatFeatureVariationSelectorString( baseSelector, styleVariationSelector ); const rules = declarations.join(";"); ruleset += `:root :where(${cssSelector}){${rules};}`; } } ); } const styleVariationDeclarations = getStylesDeclarations( styleVariations, styleVariationSelector, useRootPaddingAlign, tree ); if (styleVariationDeclarations.length) { ruleset += `:root :where(${styleVariationSelector}){${styleVariationDeclarations.join( ";" )};}`; } if (styleVariations?.css) { ruleset += processCSSNesting( styleVariations.css, `:root :where(${styleVariationSelector})` ); } if (hasLayoutSupport && styleVariations?.spacing?.blockGap) { const variationSelectorWithBlock = styleVariationSelector + selector; ruleset += getLayoutStyles({ style: styleVariations, selector: variationSelectorWithBlock, hasBlockGapSupport: true, hasFallbackGapSupport, fallbackGapValue }); } } } ); } const pseudoSelectorStyles = Object.entries(styles).filter( ([key]) => key.startsWith(":") ); if (pseudoSelectorStyles?.length) { pseudoSelectorStyles.forEach( ([pseudoKey, pseudoStyle]) => { const pseudoDeclarations = getStylesDeclarations(pseudoStyle); if (!pseudoDeclarations?.length) { return; } const _selector = selector.split(",").map((sel) => sel + pseudoKey).join(","); const pseudoRule = `:root :where(${_selector}){${pseudoDeclarations.join( ";" )};}`; ruleset += pseudoRule; } ); } } ); } if (options.layoutStyles) { ruleset = ruleset + ".wp-site-blocks > .alignleft { float: left; margin-right: 2em; }"; ruleset = ruleset + ".wp-site-blocks > .alignright { float: right; margin-left: 2em; }"; ruleset = ruleset + ".wp-site-blocks > .aligncenter { justify-content: center; margin-left: auto; margin-right: auto; }"; } if (options.blockGap && hasBlockGapSupport) { const gapValue = getGapCSSValue(tree?.styles?.spacing?.blockGap) || "0.5em"; ruleset = ruleset + `:root :where(.wp-site-blocks) > * { margin-block-start: ${gapValue}; margin-block-end: 0; }`; ruleset = ruleset + ":root :where(.wp-site-blocks) > :first-child { margin-block-start: 0; }"; ruleset = ruleset + ":root :where(.wp-site-blocks) > :last-child { margin-block-end: 0; }"; } if (options.presets) { nodesWithSettings.forEach(({ selector, presets }) => { if (ROOT_BLOCK_SELECTOR === selector || ROOT_CSS_PROPERTIES_SELECTOR === selector) { selector = ""; } const classes = getPresetsClasses(selector, presets); if (classes.length > 0) { ruleset += classes; } }); } return ruleset; }; function generateSvgFilters(tree, blockSelectors) { const nodesWithSettings = getNodesWithSettings(tree, blockSelectors); return nodesWithSettings.flatMap(({ presets }) => { return getPresetsSvgFilters(presets); }); } var getSelectorsConfig = (blockType, rootSelector) => { if (blockType?.selectors && Object.keys(blockType.selectors).length > 0) { return blockType.selectors; } const config = { root: rootSelector }; Object.entries(BLOCK_SUPPORT_FEATURE_LEVEL_SELECTORS).forEach( ([featureKey, featureName]) => { const featureSelector = getBlockSelector(blockType, featureKey); if (featureSelector) { config[featureName] = featureSelector; } } ); return config; }; var getBlockSelectors = (blockTypes, variationInstanceId) => { const { getBlockStyles } = (0, import_data2.select)(import_blocks.store); const result = {}; blockTypes.forEach((blockType) => { const name = blockType.name; const selector = getBlockSelector(blockType); if (!selector) { return; } let duotoneSelector = getBlockSelector(blockType, "filter.duotone"); if (!duotoneSelector) { const rootSelector = getBlockSelector(blockType); const duotoneSupport = (0, import_blocks.getBlockSupport)( blockType, "color.__experimentalDuotone", false ); duotoneSelector = duotoneSupport && rootSelector && scopeSelector(rootSelector, duotoneSupport); } const hasLayoutSupport = !!blockType?.supports?.layout || !!blockType?.supports?.__experimentalLayout; const fallbackGapValue = ( // @ts-expect-error blockType?.supports?.spacing?.blockGap?.__experimentalDefault ); const blockStyleVariations = getBlockStyles(name); const styleVariationSelectors = {}; blockStyleVariations?.forEach((variation) => { const variationSuffix = variationInstanceId ? `-${variationInstanceId}` : ""; const variationName = `${variation.name}${variationSuffix}`; const styleVariationSelector = getBlockStyleVariationSelector( variationName, selector ); styleVariationSelectors[variationName] = styleVariationSelector; }); const featureSelectors = getSelectorsConfig(blockType, selector); result[name] = { duotoneSelector: duotoneSelector ?? void 0, fallbackGapValue, featureSelectors: Object.keys(featureSelectors).length ? featureSelectors : void 0, hasLayoutSupport, name, selector, styleVariationSelectors: blockStyleVariations?.length ? styleVariationSelectors : void 0 }; }); return result; }; function updateConfigWithSeparator(config) { const blocks = config.styles?.blocks; const separatorBlock = blocks?.["core/separator"]; const needsSeparatorStyleUpdate = separatorBlock && separatorBlock.color?.background && !separatorBlock.color?.text && !separatorBlock.border?.color; if (needsSeparatorStyleUpdate) { return { ...config, styles: { ...config.styles, blocks: { ...blocks, "core/separator": { ...separatorBlock, color: { ...separatorBlock.color, text: separatorBlock.color?.background } } } } }; } return config; } function processCSSNesting(css, blockSelector) { let processedCSS = ""; if (!css || css.trim() === "") { return processedCSS; } const parts = css.split("&"); parts.forEach((part) => { if (!part || part.trim() === "") { return; } const isRootCss = !part.includes("{"); if (isRootCss) { processedCSS += `:root :where(${blockSelector}){${part.trim()}}`; } else { const splitPart = part.replace("}", "").split("{"); if (splitPart.length !== 2) { return; } const [nestedSelector, cssValue] = splitPart; const matches = nestedSelector.match(/([>+~\s]*::[a-zA-Z-]+)/); const pseudoPart = matches ? matches[1] : ""; const withoutPseudoElement = matches ? nestedSelector.replace(pseudoPart, "").trim() : nestedSelector.trim(); let combinedSelector; if (withoutPseudoElement === "") { combinedSelector = blockSelector; } else { combinedSelector = nestedSelector.startsWith(" ") ? scopeSelector(blockSelector, withoutPseudoElement) : appendToSelector(blockSelector, withoutPseudoElement); } processedCSS += `:root :where(${combinedSelector})${pseudoPart}{${cssValue.trim()}}`; } }); return processedCSS; } function generateGlobalStyles(config = {}, blockTypes = [], options = {}) { const { hasBlockGapSupport: hasBlockGapSupportOption, hasFallbackGapSupport: hasFallbackGapSupportOption, disableLayoutStyles = false, disableRootPadding = false, styleOptions = {} } = options; const blocks = blockTypes.length > 0 ? blockTypes : (0, import_blocks.getBlockTypes)(); const blockGap = getSetting(config, "spacing.blockGap"); const hasBlockGapSupport = hasBlockGapSupportOption ?? blockGap !== null; const hasFallbackGapSupport = hasFallbackGapSupportOption ?? !hasBlockGapSupport; if (!config?.styles || !config?.settings) { return [[], {}]; } const updatedConfig = updateConfigWithSeparator(config); const blockSelectors = getBlockSelectors(blocks); const customProperties = generateCustomProperties( updatedConfig, blockSelectors ); const globalStyles = transformToStyles( updatedConfig, blockSelectors, hasBlockGapSupport, hasFallbackGapSupport, disableLayoutStyles, disableRootPadding, styleOptions ); const svgs = generateSvgFilters(updatedConfig, blockSelectors); const styles = [ { css: customProperties, isGlobalStyles: true }, { css: globalStyles, isGlobalStyles: true }, // Load custom CSS in own stylesheet so that any invalid CSS entered in the input won't break all the global styles in the editor. { css: updatedConfig?.styles?.css ?? "", isGlobalStyles: true }, { assets: svgs, __unstableType: "svg", isGlobalStyles: true } ]; blocks.forEach((blockType) => { const blockStyles = updatedConfig?.styles?.blocks?.[blockType.name]; if (blockStyles?.css) { const selector = blockSelectors[blockType.name].selector; styles.push({ css: processCSSNesting(blockStyles.css, selector), isGlobalStyles: true }); } }); return [styles, updatedConfig.settings]; } // packages/lazy-editor/build-module/hooks/use-editor-settings.mjs var import_core_data3 = __toESM(require_core_data(), 1); var import_element2 = __toESM(require_element(), 1); var import_data4 = __toESM(require_data(), 1); // packages/lazy-editor/build-module/hooks/use-global-styles.mjs var import_core_data2 = __toESM(require_core_data(), 1); var import_data3 = __toESM(require_data(), 1); var import_element = __toESM(require_element(), 1); function useUserGlobalStyles(id) { const { userGlobalStyles } = (0, import_data3.useSelect)( (select2) => { const { getEntityRecord, getEditedEntityRecord, canUser } = select2(import_core_data2.store); const userCanEditGlobalStyles = canUser("update", { kind: "root", name: "globalStyles", id }); let record; if ( /* * Test that the OPTIONS request for user capabilities is complete * before fetching the global styles entity record. * This is to avoid fetching the global styles entity unnecessarily. */ typeof userCanEditGlobalStyles === "boolean" ) { if (userCanEditGlobalStyles) { record = getEditedEntityRecord( "root", "globalStyles", id ); } else { record = getEntityRecord("root", "globalStyles", id, { context: "view" }); } } return { userGlobalStyles: record }; }, [id] ); return (0, import_element.useMemo)(() => { if (!userGlobalStyles) { return { user: void 0 }; } const user = userGlobalStyles; return { user }; }, [userGlobalStyles]); } // packages/lazy-editor/build-module/lock-unlock.mjs var import_private_apis = __toESM(require_private_apis(), 1); var { unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", "@wordpress/lazy-editor" ); // packages/lazy-editor/build-module/hooks/use-editor-settings.mjs function useEditorSettings({ stylesId }) { const { editorSettings } = (0, import_data4.useSelect)( (select2) => ({ editorSettings: unlock( select2(import_core_data3.store) ).getEditorSettings() }), [] ); const { user: globalStyles } = useUserGlobalStyles(stylesId); const [globalStylesCSS] = generateGlobalStyles(globalStyles); const hasEditorSettings = !!editorSettings; const styles = (0, import_element2.useMemo)(() => { if (!hasEditorSettings) { return []; } return [ ...editorSettings?.styles ?? [], ...globalStylesCSS ]; }, [hasEditorSettings, editorSettings?.styles, globalStylesCSS]); return { isReady: hasEditorSettings, editorSettings: (0, import_element2.useMemo)( () => ({ ...editorSettings ?? {}, styles }), [editorSettings, styles] ) }; } // packages/asset-loader/build-module/index.mjs function injectImportMap(scriptModules) { if (!scriptModules || Object.keys(scriptModules).length === 0) { return; } const existingMapElement = document.querySelector( "script#wp-importmap[type=importmap]" ); if (existingMapElement) { try { const existingMap = JSON.parse(existingMapElement.text); if (!existingMap.imports) { existingMap.imports = {}; } existingMap.imports = { ...existingMap.imports, ...scriptModules }; existingMapElement.text = JSON.stringify(existingMap, null, 2); } catch (error) { console.error("Failed to parse or update import map:", error); } } else { const script = document.createElement("script"); script.type = "importmap"; script.id = "wp-importmap"; script.text = JSON.stringify( { imports: scriptModules }, null, 2 ); document.head.appendChild(script); } } function loadStylesheet(handle, styleData) { return new Promise((resolve) => { if (!styleData.src) { resolve(); return; } const existingLink = document.getElementById(handle + "-css"); if (existingLink) { resolve(); return; } const link = document.createElement("link"); link.rel = "stylesheet"; link.href = styleData.src + (styleData.version ? "?ver=" + styleData.version : ""); link.id = handle + "-css"; link.media = styleData.media || "all"; link.onload = () => resolve(); link.onerror = () => { console.error(`Failed to load stylesheet: ${handle}`); resolve(); }; document.head.appendChild(link); }); } function loadScript(handle, scriptData) { if (!scriptData.src) { const marker = document.createElement("script"); marker.id = handle + "-js"; marker.textContent = "// Processed: " + handle; return marker; } const script = document.createElement("script"); script.src = scriptData.src + (scriptData.version ? "?ver=" + scriptData.version : ""); script.id = handle + "-js"; script.async = false; return script; } function injectInlineStyle(handle, inlineStyle, position) { let styleContent = ""; if (Array.isArray(inlineStyle)) { styleContent = inlineStyle.join("\n"); } else if (typeof inlineStyle === "string") { styleContent = inlineStyle; } if (styleContent && styleContent.trim()) { const styleId = handle + "-" + position + "-inline-css"; if (!document.getElementById(styleId)) { const style = document.createElement("style"); style.id = styleId; style.textContent = styleContent.trim(); document.head.appendChild(style); } } } function injectInlineScript(handle, inlineScript, position) { let scriptContent = inlineScript; if (Array.isArray(scriptContent)) { scriptContent = scriptContent.join("\n"); } const script = document.createElement("script"); script.id = handle + "-" + position + "-js"; script.textContent = scriptContent.trim(); return script; } function buildDependencyOrderedList(assetsData) { const visited = /* @__PURE__ */ new Set(); const visiting = /* @__PURE__ */ new Set(); const orderedList = []; function visit(handle) { if (visited.has(handle)) { return; } if (visiting.has(handle)) { console.warn( `Circular dependency detected for handle: ${handle}` ); return; } visiting.add(handle); if (assetsData[handle]) { const deps = assetsData[handle].deps || []; deps.forEach((dep) => { if (assetsData[dep]) { visit(dep); } }); } visiting.delete(handle); visited.add(handle); if (assetsData[handle]) { orderedList.push(handle); } } Object.keys(assetsData).forEach((handle) => { visit(handle); }); return orderedList; } async function performScriptLoad(scriptElements, destination) { let parallel = []; for (const scriptElement of scriptElements) { if (scriptElement.src) { const loader = Promise.withResolvers(); scriptElement.onload = () => loader.resolve(); scriptElement.onerror = () => { console.error(`Failed to load script: ${scriptElement.id}`); loader.resolve(); }; parallel.push(loader.promise); } else { await Promise.all(parallel); parallel = []; } destination.appendChild(scriptElement); } await Promise.all(parallel); parallel = []; } async function loadAssets(scriptsData, inlineScripts, stylesData, inlineStyles, htmlTemplates, scriptModules) { if (scriptModules) { injectImportMap(scriptModules); } const orderedStyles = buildDependencyOrderedList(stylesData); const orderedScripts = buildDependencyOrderedList(scriptsData); const stylePromises = []; for (const handle of orderedStyles) { const beforeInline = inlineStyles.before?.[handle]; if (beforeInline) { injectInlineStyle(handle, beforeInline, "before"); } stylePromises.push(loadStylesheet(handle, stylesData[handle])); const afterInline = inlineStyles.after?.[handle]; if (afterInline) { injectInlineStyle(handle, afterInline, "after"); } } const scriptElements = []; for (const handle of orderedScripts) { const beforeInline = inlineScripts.before?.[handle]; if (beforeInline) { scriptElements.push( injectInlineScript(handle, beforeInline, "before") ); } scriptElements.push(loadScript(handle, scriptsData[handle])); const afterInline = inlineScripts.after?.[handle]; if (afterInline) { scriptElements.push( injectInlineScript(handle, afterInline, "after") ); } } const scriptsPromise = performScriptLoad(scriptElements, document.body); await Promise.all([Promise.all(stylePromises), scriptsPromise]); if (htmlTemplates && htmlTemplates.length > 0) { htmlTemplates.forEach((templateHtml) => { const scriptMatch = templateHtml.match( /]*)>(.*?)<\/script>/is ); if (scriptMatch) { const attributes = scriptMatch[1]; const content = scriptMatch[2]; const script = document.createElement("script"); const idMatch = attributes.match(/id=["']([^"']+)["']/); if (idMatch) { script.id = idMatch[1]; } const typeMatch = attributes.match(/type=["']([^"']+)["']/); if (typeMatch) { script.type = typeMatch[1]; } script.textContent = content; document.body.appendChild(script); } }); } } var index_default = loadAssets; // packages/lazy-editor/build-module/hooks/use-editor-assets.mjs var import_core_data4 = __toESM(require_core_data(), 1); var import_element3 = __toESM(require_element(), 1); var import_data5 = __toESM(require_data(), 1); var loadAssetsPromise; async function loadEditorAssets() { const load = async () => { const editorAssets = await unlock( (0, import_data5.resolveSelect)(import_core_data4.store) ).getEditorAssets(); await index_default( editorAssets.scripts || {}, editorAssets.inline_scripts || { before: {}, after: {} }, editorAssets.styles || {}, editorAssets.inline_styles || { before: {}, after: {} }, editorAssets.html_templates || [], editorAssets.script_modules || {} ); }; if (!loadAssetsPromise) { loadAssetsPromise = load(); } return loadAssetsPromise; } function useEditorAssets() { const editorAssets = (0, import_data5.useSelect)((select2) => { return unlock(select2(import_core_data4.store)).getEditorAssets(); }, []); const [assetsLoaded, setAssetsLoaded] = (0, import_element3.useState)(false); (0, import_element3.useEffect)(() => { if (editorAssets && !assetsLoaded) { loadEditorAssets().then(() => { setAssetsLoaded(true); }).catch((error) => { console.error("Failed to load editor assets:", error); }); } }, [editorAssets, assetsLoaded]); return { isReady: !!editorAssets && assetsLoaded, assetsLoaded }; } // packages/lazy-editor/build-module/components/editor/index.mjs var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); var { Editor: PrivateEditor, BackButton } = unlock(import_editor.privateApis); function Editor({ postType, postId, settings, backButton }) { const homePage = (0, import_data6.useSelect)( (select2) => { if (postType || postId) { return null; } const { getHomePage } = unlock(select2(import_core_data5.store)); return getHomePage(); }, [postType, postId] ); const resolvedPostType = postType || homePage?.postType; const resolvedPostId = postId || homePage?.postId; const templateId = (0, import_data6.useSelect)( (select2) => { if (!resolvedPostType || !resolvedPostId) { return void 0; } if (resolvedPostType === "wp_template") { return resolvedPostId; } return unlock(select2(import_core_data5.store)).getTemplateId( resolvedPostType, resolvedPostId ); }, [resolvedPostType, resolvedPostId] ); const stylesId = useStylesId({ templateId }); const { isReady: settingsReady, editorSettings } = useEditorSettings({ stylesId }); const { isReady: assetsReady } = useEditorAssets(); const finalSettings = (0, import_element4.useMemo)( () => ({ ...editorSettings, ...settings }), [editorSettings, settings] ); if (!settingsReady || !assetsReady) { return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( "div", { style: { display: "flex", justifyContent: "center", alignItems: "center", height: "100vh" }, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_components.Spinner, {}) } ); } return /* @__PURE__ */ (0, import_jsx_runtime.jsx)( PrivateEditor, { postType: resolvedPostType, postId: resolvedPostId, templateId, settings: finalSettings, styles: finalSettings.styles, children: backButton && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BackButton, { children: backButton }) } ); } // packages/lazy-editor/build-module/components/preview/index.mjs var import_i18n = __toESM(require_i18n(), 1); var import_element5 = __toESM(require_element(), 1); var import_block_editor = __toESM(require_block_editor(), 1); var import_editor2 = __toESM(require_editor(), 1); var import_blocks2 = __toESM(require_blocks(), 1); var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); if (typeof document !== "undefined" && !document.head.querySelector("style[data-wp-hash='5619aa31a1']")) { const style = document.createElement("style"); style.setAttribute("data-wp-hash", "5619aa31a1"); style.appendChild(document.createTextNode(".lazy-editor-block-preview__container{align-items:center;border-radius:4px;display:flex;flex-direction:column;height:100%;justify-content:center}.dataviews-view-grid .lazy-editor-block-preview__container .block-editor-block-preview__container{height:100%}.dataviews-view-table .lazy-editor-block-preview__container{text-wrap:balance;text-wrap:pretty;flex-grow:0;width:96px}")); document.head.appendChild(style); } var { useStyle } = unlock(import_editor2.privateApis); function PreviewContent({ blocks, content, description }) { const descriptionId = (0, import_element5.useId)(); const backgroundColor = useStyle("color.background"); const actualBlocks = (0, import_element5.useMemo)(() => { return blocks ?? (0, import_blocks2.parse)(content, { __unstableSkipMigrationLogs: true }); }, [content, blocks]); const isEmpty = !actualBlocks?.length; return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)( "div", { className: "lazy-editor-block-preview__container", style: { backgroundColor }, "aria-describedby": !!description ? descriptionId : void 0, children: [ isEmpty && (0, import_i18n.__)("Empty."), !isEmpty && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_block_editor.BlockPreview.Async, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_block_editor.BlockPreview, { blocks: actualBlocks }) }), !!description && /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { hidden: true, id: descriptionId, children: description }) ] } ); } function Preview({ blocks, content, description }) { const stylesId = useStylesId(); const { isReady: settingsReady, editorSettings } = useEditorSettings({ stylesId }); const { isReady: assetsReady } = useEditorAssets(); const finalSettings = (0, import_element5.useMemo)( () => ({ ...editorSettings, isPreviewMode: true }), [editorSettings] ); if (!settingsReady || !assetsReady) { return null; } return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_block_editor.BlockEditorProvider, { settings: finalSettings, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)( PreviewContent, { blocks, content, description } ) }); } export { Editor, Preview, loadEditorAssets, useEditorAssets }; index.min.asset.php000064400000000376152214140750010273 0ustar00 array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-private-apis', 'wp-style-engine'), 'version' => '30ab62f45bfe9f971ea0');