import{F as x,i as _,G as v}from"./index.6205915e.js";import{l as d}from"./helpers.7981a424.js";var w=function(n,o,s,e){var i;o[0]=0;for(var t=1;t<o.length;t++){var r=o[t++],a=o[t]?(o[0]|=r?1:2,s[o[t++]]):o[++t];r===3?e[0]=a:r===4?e[1]=Object.assign(e[1]||{},a):r===5?(e[1]=e[1]||{})[o[++t]]=a:r===6?e[1][o[++t]]+=a+"":r?(i=n.apply(a,w(n,a,s,["",null])),e.push(i),a[0]?o[0]|=2:(o[t-2]=0,o[t]=i)):e.push(a)}return e},y=new Map;function T(n){var o=y.get(this);return o||(o=new Map,y.set(this,o)),(o=w(this,o.get(n)||(o.set(n,o=function(s){for(var e,i,t=1,r="",a="",c=[0],u=function(l){t===1&&(l||(r=r.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?c.push(0,l,r):t===3&&(l||r)?(c.push(3,l,r),t=2):t===2&&r==="..."&&l?c.push(4,l,0):t===2&&r&&!l?c.push(5,0,!0,r):t>=5&&((r||!l&&t===5)&&(c.push(t,0,r,i),t=6),l&&(c.push(t,l,0,i),t=6)),r=""},f=0;f<s.length;f++){f&&(t===1&&u(),u(f));for(var p=0;p<s[f].length;p++)e=s[f][p],t===1?e==="<"?(u(),c=[c],t=3):r+=e:t===4?r==="--"&&e===">"?(t=1,r=""):r=e+r[0]:a?e===a?a="":r+=e:e==='"'||e==="'"?a=e:e===">"?(u(),t=1):t&&(e==="="?(t=5,i=r,r=""):e==="/"&&(t<5||s[f][p+1]===">")?(u(),t===3&&(c=c[0]),t=c,(c=c[0]).push(2,0,t),t=0):e===" "||e==="	"||e===`
`||e==="\r"?(u(),t=2):r+=e),t===3&&r==="!--"&&(t=4,c=c[0])}return u(),c}(n)),o),arguments,[])).length>1?o:o[0]}const I=T.bind(window.wp.element.createElement),A=n=>Object.prototype.toString.call(n).slice(8,-1).toLowerCase(),m=n=>{const o=c=>{for(const u in n)Object.prototype.hasOwnProperty.call(n,u)&&(c[u]=m(n[u]))},s=()=>{const c={};return o(c),c},e=()=>n.map(function(c){return m(c)}),i=()=>{const c=new Map;for(const[u,f]of n)c.set(u,m(f));return c},t=()=>{const c=new Set;for(const u of n)c.add(m(u));return c},r=()=>{const c=n.bind(void 0);return o(c),c},a=A(n);return a==="object"?s():a==="array"?e():a==="map"?i():a==="set"?t():a==="function"?r():n},L=(n,o=!1,s=!0)=>{const{body:e}=document.implementation.createHTMLDocument("");e.innerHTML=n;const i=e.getElementsByTagName("*");let t=i.length;for(;t--;){const a=i[t];if(a.tagName==="SCRIPT")a.parentNode.removeChild(a);else{let c=a.attributes.length;for(;c--;){const{name:u}=a.attributes[c];u.startsWith("on")&&a.removeAttribute(u)}}}const r=o?e.textContent:e.innerHTML;return s?r.trim():r},M=()=>"aioseo-"+new Date().getTime().toString(36),h=(n,o=!1)=>{const s=_();return!n||!s.tags?n:(s.tags.forEach(e=>{if(e.id==="custom_field"){const a=new RegExp(`#${e.id}-([a-zA-Z0-9_-]+)`,"g");n=n.replace(a,(c,u)=>v(u));return}if(e.id==="tax_name"){const a=new RegExp(`#${e.id}-([a-zA-Z0-9_-]+)`,"g");n=n.replace(a,`[${e.name} - $1]`);return}const i=new RegExp(`#${e.id}(?![a-zA-Z0-9_])`,"g"),t=n.match(i),r=s.liveTags[e.id]||e.value;t&&(n=n.replace(i,"%|%"+r))}),n=n.replace(/%\|%/g,"").replace(/<(?:.|\n)*?>/gm," "),o||(n=n.replace(/\s/g," ")),d(d(n)))},C=(n,o)=>(n=parseFloat(n||"").toFixed(2),isNaN(n)?"":new Intl.NumberFormat("en-US",{style:"currency",currency:o||"USD"}).format(n)),E=(n,o)=>{const s=o.findIndex(e=>e.id===n);s!==-1&&(o[s].app.unmount(),o.splice(s,1))},{registerBlockCollection:g,registerBlockType:S}=window.wp.blocks,F=n=>{var e;if(!n||!x())return;const{name:o,settings:s}=n;if(s!=null&&s.icon&&!((e=s==null?void 0:s.icon)!=null&&e.foreground)){const i={foreground:"#141B38",src:s.icon};s.icon=i}typeof g=="function"&&s.category==="aioseo"&&(s.category="widgets"),typeof g!="function"&&s.category!=="aioseo"&&(s.category="aioseo"),S(o,s)};export{L as c,m as d,C as f,M as g,I as h,E as m,h as p,F as r};
