|
1
|
|
-(()=>{"use strict";var t={5338:(t,e,r)=>{var o=r(5795);e.H=o.createRoot,o.hydrateRoot},5795:t=>{t.exports=window.ReactDOM}},e={};const r=window.React;var o=function r(o){var a=e[o];if(void 0!==a)return a.exports;var n=e[o]={exports:{}};return t[o](n,n.exports,r),n.exports}(5338);const a=({attributes:t})=>{const{emoji:e,height:o,align:a,emojiSize:n,density:i,animationStyle:s}=t,c=(0,r.useRef)(null);(0,r.useEffect)((()=>{if(c.current){const t=setTimeout((()=>{l(c.current,e,o,n,i)}),50);return()=>clearTimeout(t)}}),[e,o,a,n,i]);const l=(t,e,r,o,a)=>{t.innerHTML="";const n=(t=>{const e={small:{fontSize:2.5,overlap:-1},medium:{fontSize:3.75,overlap:-1.4},large:{fontSize:5,overlap:-1.8},xlarge:{fontSize:6.5,overlap:-2.3}};return e[t]||e.medium})(o),i=(t=>{const e={sparse:{overlapFactor:.5,rowMargin:-2,emojisExtra:2},normal:{overlapFactor:.65,rowMargin:-3,emojisExtra:4},dense:{overlapFactor:.75,rowMargin:-3.5,emojisExtra:6}};return e[t]||e.normal})(a),s=t.offsetWidth,c=Math.ceil(s/(60*i.overlapFactor))+i.emojisExtra;for(let r=0;r<4;r++){const o=document.createElement("div");o.className="b-blocks-emoji-stack-iemoji-row",r>0&&(o.style.marginTop=`${i.rowMargin}rem`);for(let t=0;t<c;t++){const r=document.createElement("span");r.textContent=e,r.className="b-blocks-emoji-stack-item";const a=60*Math.random()-30,i=20*Math.random()-10;r.style.fontSize=`${n.fontSize}rem`,r.style.marginRight=`${n.overlap}rem`,r.style.setProperty("--b-blocks-emoji-stack-separator-rotation",`${a}deg`),r.style.setProperty("--b-blocks-emoji-stack-separator-index",t),r.style.transform=`rotate(${a}deg) translateY(${i}px)`,o.appendChild(r)}t.appendChild(o)}};return(0,r.createElement)("div",{className:"b-blocks-emoji-stack-separator-container "+(s?`b-blocks-emoji-stack-separator-animation-${s}`:"")},(0,r.createElement)("div",{ref:c,className:"b-blocks-emoji-stack-container"}))},n="linear-gradient(135deg, #0040E3, #18D4FD)",i=(t,e,r=!1)=>{return null==(o=e)||""===o||Array.isArray(o)&&0===o.length||"object"==typeof o&&0===Object.keys(o).length||"string"==typeof o&&""===o.trim()||"number"==typeof o&&0===o?"":`${t}: ${e}${r?" !important":""};`;var o},s=(t,e=!0,r=!0,o=!0)=>{const{type:a="solid",color:s="",gradient:c=n,image:l={},position:m="center center",attachment:d="",repeat:p="no-repeat",size:u="",overlayColor:b=""}=t||{};return"gradient"===a&&r?i("background",c):"image"===a&&o?`background: url(${l?.url});\n\t\t\t\t${i("background-color",b)}\n\t\t\t\t${i("background-position",m)}\n\t\t\t\t${i("background-size",u)}\n\t\t\t\t${i("background-repeat",p)}\n\t\t\t\t${i("background-attachment",d)}\n\t\t\t\t${i("background-repeat",p)}\n\t\t\t\tbackground-blend-mode: overlay;`:e&&i("background",s)},c=t=>{if(!t)return"";const e=t=>{const{color:e="#000000",style:r="solid",width:o="0px"}=t;return`${o} ${r} ${e}`};return"object"!=typeof t||Array.isArray(t)?"":t.hasOwnProperty("top")||t.hasOwnProperty("right")||t.hasOwnProperty("bottom")||t.hasOwnProperty("left")?["top","right","bottom","left"].map((r=>t[r]?`border-${r}: ${e(t[r])};`:"")).join(" ").trim():i("border",e(t))},l=t=>{if(!t)return"";if("string"==typeof t)return t;if("object"==typeof t&&!Array.isArray(t)){const e=["top","right","bottom","left"];return e.map((e=>t[e]||"")).every((t=>!t))?"":e.map((e=>t[e]||"0")).join(" ")}return""},m=({attributes:t,id:e})=>{const{background:o,height:a,padding:n,margin:m,border:d,borderRadius:p}=t,u=`#${e} .b-blocks-emoji-stack-separator-container`;return(0,r.createElement)("style",{dangerouslySetInnerHTML:{__html:`\n ${u}{\n ${s(o)}\n ${i("height",a)}\n ${i("padding",l(n))}\n ${i("margin",l(m))}\n ${c(d)}\n ${i("border-radius",l(p))}\n }\n `}})};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-emoji-stack-separator").forEach((t=>{let e={};try{const r=t.dataset.attributes;r&&"undefined"!==r&&""!==r&&(e=JSON.parse(r))}catch(t){console.warn("Emoji Stack Separator: Invalid attributes JSON",t)}(0,o.H)(t).render((0,r.createElement)(r.Fragment,null,(0,r.createElement)(m,{attributes:e,id:t.id}),(0,r.createElement)(a,{attributes:e}))),t?.removeAttribute("data-attributes")}))}))})(); |
|
1
|
+(()=>{"use strict";const t=window.ReactDOM,e=window.React,r=window.ReactJSXRuntime,o=({attributes:t})=>{const{emoji:o,height:s,align:i,emojiSize:a,density:n,animationStyle:l}=t,c=(0,e.useRef)(null);(0,e.useEffect)((()=>{if(c.current){const t=setTimeout((()=>{d(c.current,o,s,a,n)}),50);return()=>clearTimeout(t)}}),[o,s,i,a,n]);const d=(t,e,r,o,s)=>{t.innerHTML="";const i=(t=>{const e={small:{fontSize:2.5,overlap:-1},medium:{fontSize:3.75,overlap:-1.4},large:{fontSize:5,overlap:-1.8},xlarge:{fontSize:6.5,overlap:-2.3}};return e[t]||e.medium})(o),a=(t=>{const e={sparse:{overlapFactor:.5,rowMargin:-2,emojisExtra:2},normal:{overlapFactor:.65,rowMargin:-3,emojisExtra:4},dense:{overlapFactor:.75,rowMargin:-3.5,emojisExtra:6}};return e[t]||e.normal})(s),n=t.offsetWidth,l=Math.ceil(n/(60*a.overlapFactor))+a.emojisExtra;for(let r=0;r<4;r++){const o=document.createElement("div");o.className="b-blocks-emoji-stack-iemoji-row",r>0&&(o.style.marginTop=`${a.rowMargin}rem`);for(let t=0;t<l;t++){const r=document.createElement("span");r.textContent=e,r.className="b-blocks-emoji-stack-item";const s=60*Math.random()-30,a=20*Math.random()-10;r.style.fontSize=`${i.fontSize}rem`,r.style.marginRight=`${i.overlap}rem`,r.style.setProperty("--b-blocks-emoji-stack-separator-rotation",`${s}deg`),r.style.setProperty("--b-blocks-emoji-stack-separator-index",t),r.style.transform=`rotate(${s}deg) translateY(${a}px)`,o.appendChild(r)}t.appendChild(o)}};return(0,r.jsx)("div",{className:"b-blocks-emoji-stack-separator-container "+(l?`b-blocks-emoji-stack-separator-animation-${l}`:""),children:(0,r.jsx)("div",{ref:c,className:"b-blocks-emoji-stack-container"})})};new class{constructor(t={}){this.defaultOptions={allowedTags:["svg","g","path","rect","circle","ellipse","line","polyline","polygon","text","tspan","defs","clipPath","mask","linearGradient","radialGradient","stop","style","title","desc"],allowedAttributes:["id","class","style","transform","xmlns","xmlns:xlink","version","baseProfile","xml:space","d","x","y","width","height","cx","cy","r","rx","ry","points","x1","y1","x2","y2","viewBox","preserveAspectRatio","overflow","fill","fill-opacity","fill-rule","stroke","stroke-width","stroke-linecap","stroke-linejoin","stroke-opacity","stroke-dasharray","stroke-dashoffset","stroke-miterlimit","opacity","color","paint-order","vector-effect","shape-rendering","display","visibility","clip-path","clip-rule","clipPathUnits","mask","maskUnits","maskContentUnits","offset","stop-color","stop-opacity","gradientUnits","gradientTransform","spreadMethod","fx","fy","fr","dx","dy","text-anchor","dominant-baseline","alignment-baseline","font-family","font-size","font-style","font-weight","letter-spacing","word-spacing","textLength","lengthAdjust","role","focusable","aria-hidden","aria-label","aria-labelledby","aria-describedby"],allowedProtocols:["http","https","data"],removeScripts:!0,removeEvents:!0,removeExternalResources:!0,sanitizeStyle:!0},this.options={...this.defaultOptions,...t},this.allowedTagSet=new Set(this.options.allowedTags.map((t=>t.toLowerCase()))),this.allowedAttributeSet=new Set(this.options.allowedAttributes.map((t=>t.toLowerCase())))}sanitize(t){if("string"!=typeof t||""===t.trim())return"";const e=(new DOMParser).parseFromString(t,"image/svg+xml"),r=e.documentElement;return!r||"svg"!==r.localName.toLowerCase()||e.getElementsByTagName("parsererror").length?"":(this.removeScripts(e),this.sanitizeElements(e),(new XMLSerializer).serializeToString(e.documentElement))}async sanitizeFile(t){const e=await fetch(t),r=await e.text();return this.sanitize(`${r}`)}removeScripts(t){this.options.removeScripts&&Array.from(t.querySelectorAll("*")).forEach((t=>{t.localName.toLowerCase().includes("script")&&t.remove()}))}sanitizeElements(t){Array.from(t.querySelectorAll("*")).forEach((t=>{const e=t.localName.toLowerCase();this.allowedTagSet.has(e)?("style"===e&&this.options.sanitizeStyle&&(t.textContent=this.sanitizeCss(t.textContent)),this.sanitizeAttributes(t)):t.remove()}))}sanitizeAttributes(t){Array.from(t.attributes).forEach((e=>{const r=e.name,o=r.toLowerCase(),s=e.value;if(this.options.removeEvents&&o.startsWith("on"))return void t.removeAttribute(r);if(this.options.removeExternalResources&&("href"===o||o.endsWith(":href"))&&!this.isAllowedUrl(s))return void t.removeAttribute(r);const i=o.replace("xlink:","");this.allowedAttributeSet.has(o)||this.allowedAttributeSet.has(i)?this.options.removeExternalResources&&this.hasExternalUrl(s)?t.removeAttribute(r):"style"===o&&this.options.sanitizeStyle&&t.setAttribute(r,this.sanitizeCss(s)):t.removeAttribute(r)}))}hasExternalUrl(t){return!("string"!=typeof t||!/url\s*\(/i.test(t))&&Array.from(t.matchAll(/url\s*\(\s*['"]?([^'")]*)/gi)).some((([,t])=>!t.trim().startsWith("#")))}isAllowedUrl(t){const e=String(t||"").trim();if(e.startsWith("#"))return!0;if(/^data:/i.test(e))return this.options.allowedProtocols.includes("data")&&/^data:image\/(png|jpe?g|gif|webp);base64,/i.test(e);try{return this.options.allowedProtocols.includes(new URL(e).protocol.replace(":",""))}catch{return!1}}sanitizeCss(t){return String(t||"").replace(/expression\s*\(/gi,"").replace(/javascript:/gi,"").replace(/behavior\s*:/gi,"").replace(/binding\s*:/gi,"").replace(/@import[^;]*;?/gi,"").replace(/url\s*\(\s*(['"]?)(?!#)[^)]*\)/gi,"none")}};const s="linear-gradient(135deg, #0040E3, #18D4FD)",i=t=>{const e=(t=>{try{const e=new URL(t);return["http:","https:"].includes(e.protocol)?e.toString():null}catch(e){return"string"==typeof t&&t.startsWith("/")&&!t.startsWith("//")?t:null}})(t);return e?`url('${e.replace(/['"()]/g,"")}')`:"none"},a=(t,e)=>{return null==(r=e)||""===r||Array.isArray(r)&&0===r.length||"object"==typeof r&&0===Object.keys(r).length||"string"==typeof r&&""===r.trim()||"number"==typeof r&&0===r?"":`${t}: ${e};`;var r},n=(t,e=!0,r=!0,o=!0)=>{const{type:n="solid",color:l="",gradient:c=s,image:d={},position:p="center center",attachment:m="",repeat:u="no-repeat",size:h="",overlayColor:g=""}=t||{};return"gradient"===n&&r?a("background",c):"image"===n&&o?`background: ${i(d?.url)};\n\t\t\t\t${a("background-color",g)}\n\t\t\t\t${a("background-position",p)}\n\t\t\t\t${a("background-size",h)}\n\t\t\t\t${a("background-repeat",u)}\n\t\t\t\t${a("background-attachment",m)}\n\t\t\t\t${a("background-repeat",u)}\n\t\t\t\tbackground-blend-mode: overlay;`:e&&a("background",l)},l=t=>{if(!t)return"";const e=t=>{const{color:e="#000000",style:r="solid",width:o="0px"}=t;return`${o} ${r} ${e}`};return"object"!=typeof t||Array.isArray(t)?"":t.hasOwnProperty("top")||t.hasOwnProperty("right")||t.hasOwnProperty("bottom")||t.hasOwnProperty("left")?["top","right","bottom","left"].map((r=>t[r]?`border-${r}: ${e(t[r])};`:"")).join(" ").trim():a("border",e(t))},c=t=>{if(!t)return"";if("string"==typeof t)return t;if("object"==typeof t&&!Array.isArray(t)){const e=["top","right","bottom","left"];return e.map((e=>t[e]||"")).every((t=>!t))?"":e.map((e=>t[e]||"0")).join(" ")}return""},d=({attributes:t,id:e})=>{const{background:o,height:s,padding:i,margin:d,border:p,borderRadius:m}=t,u=`#${e} .b-blocks-emoji-stack-separator-container`;return(0,r.jsx)("style",{dangerouslySetInnerHTML:{__html:`\n ${u}{\n ${n(o)}\n ${a("height",s)}\n ${a("padding",c(i))}\n ${a("margin",c(d))}\n ${l(p)}\n ${a("border-radius",c(m))}\n }\n `}})};document.addEventListener("DOMContentLoaded",(()=>{document.querySelectorAll(".wp-block-b-blocks-emoji-stack-separator").forEach((e=>{let s={};try{const t=e.dataset.attributes;t&&"undefined"!==t&&""!==t&&(s=JSON.parse(t))}catch(t){console.warn("Emoji Stack Separator: Invalid attributes JSON",t)}(0,t.createRoot)(e).render((0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(d,{attributes:s,id:e.id}),(0,r.jsx)(o,{attributes:s})]})),e?.removeAttribute("data-attributes")}))}))})(); |