import{h as F,r as T,g as M}from"../js/utils.1419d5df.js";import{c as $,G as D,t as O}from"../js/app-core.3e3b5f4b.js";import{_ as s}from"../js/vendor-other.ac1169a2.js";import"../js/vendor-vue-ui.65fbb3e9.js";import"../js/vendor-lodash.a7229f96.js";const z=F`
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14 15q.425 0 .738-.312.312-.313.312-.738t-.312-.738Q14.425 12.9 14 12.9t-.737.312q-.313.313-.313.738t.313.738Q13.575 15 14 15Zm-.75-3.2h1.5q0-.725.15-1.063.15-.337.7-.887.75-.75 1-1.213.25-.462.25-1.087 0-1.125-.788-1.837Q15.275 5 14 5q-1.025 0-1.787.575-.763.575-1.063 1.525l1.35.55q.225-.625.613-.938Q13.5 6.4 14 6.4q.6 0 .975.337.375.338.375.913 0 .35-.2.662-.2.313-.7.788-.825.725-1.012 1.137-.188.413-.188 1.563ZM8 18q-.825 0-1.412-.587Q6 16.825 6 16V4q0-.825.588-1.413Q7.175 2 8 2h12q.825 0 1.413.587Q22 3.175 22 4v12q0 .825-.587 1.413Q20.825 18 20 18Zm-4 4q-.825 0-1.412-.587Q2 20.825 2 20V6h2v14h14v2Z"/></svg>
`,W="aioseo/faq",G="AIOSEO - FAQ",P="Easily add an SEO-friendly Frequently Asked Question (FAQ) to your content.",U="aioseo",V={hidden:{type:"boolean",default:!1},question:{type:"string",selector:".aioseo-faq-block-question"},schemaBlockId:{type:"string",default:""},tagName:{type:"string",default:"h3"}},Z={html:!1,anchor:!0,align:["wide","full"],color:{link:!0,__experimentalDefaultControls:{background:!0,text:!0}},typography:{fontSize:!0,lineHeight:!0},spacing:{margin:!0,padding:!0,blockGap:!0}},j={name:W,title:G,description:P,category:U,attributes:V,supports:Z},u="all-in-one-seo-pack",K=window.wp,{PanelBody:Y,SelectControl:J,ToggleControl:X}=K.components,ee=({attributes:l,setSchemaBlockAttributes:t})=>{const{hidden:n,tagName:e}=l,a=$.getUpsellLink("faq-block",null,D.learnMore,"sidebar",!0);return React.createElement(Y,{title:s("FAQ Options",u)},React.createElement(J,{label:s("Title Wrapper",u),options:[{label:"DIV",value:"div"},{label:"H1",value:"h1"},{label:"H2",value:"h2"},{label:"H3",value:"h3"},{label:"H4",value:"h4"}],value:e,onChange:o=>t({tagName:o}),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),React.createElement("p",{className:"aioseo-visibility-label"},s("Visibility",u)),React.createElement(X,{className:"aioseo-faq-visibility",label:s("Display Block",u),help:s("You can choose to hide this block on the front-end of your site so that visitors won't see it but search engines will still see it.",u),checked:!n,onChange:()=>t({hidden:!n}),__nextHasNoMarginBottom:!0}),React.createElement("div",{className:"aioseo-alert aioseo-alert inline-upsell blue medium"},React.createElement("div",{dangerouslySetInnerHTML:{__html:s("FAQ schema is a Pro feature.",u)+" "+a}})))},N="all-in-one-seo-pack",{name:te,title:oe,description:ne,category:ae,supports:se,attributes:le}=j,{useSelect:R}=window.wp.data,{useEffect:ce}=window.wp.element,{serialize:re}=window.wp.blocks,E=window.wp,ie=E.blockEditor?.InspectorControls||E.editor.InspectorControls,{RichText:A,InnerBlocks:x}=E.blockEditor,d=[],ue=l=>{const{body:t}=document.implementation.createHTMLDocument("");t.innerHTML=l;function n(e){const a=e.childNodes;for(const o of a){if(o.nodeName?.toLowerCase().includes("comment")&&o.parentNode.removeChild(o),o.attributes)for(const{name:m,value:k}of o.attributes){const f=k.replace(/\s+/g,"").toLowerCase();(!["src","href"].includes(m)||m.startsWith("on")||f.includes("javascript:")||f.includes("data:"))&&o.removeAttribute(m)}n(o)}}return n(t),t.innerHTML.trim().replace(/\s+/g," ")},de={title:oe,description:ne,category:ae,supports:se,attributes:le,icon:z,edit:function(l){const{attributes:t,className:n,clientId:e,setAttributes:a,isSelected:o}=l,{hidden:m,question:k,tagName:f,schemaBlockId:q}=t;!d.includes(e)&&!o&&d.push(e);const g=r=>{window.requestAnimationFrame(()=>{a(r)}),window.aioseoBus.$emit("schemaBlockUpdated")};ce(()=>{(!q||1<(O().querySelectorAll(`[data-schema-block-id='${q}']`)||[]).length)&&g({schemaBlockId:M()})},[]);const c=R(r=>{const p=r("core/block-editor");if(!p)return;const{getAdjacentBlockClientId:h,getBlockAttributes:b,getBlockName:i,getClientIdsWithDescendants:w,getGlobalBlockCount:y}=p;if(d.includes(e)||2>y("aioseo/faq"))return null;const B=h(e,-1);if(i(B)==="aioseo/faq")return b(B);const _=h(e,1);if(i(_)==="aioseo/faq")return b(_);const v=w().filter(H=>i(H)==="aioseo/faq"),C=v.indexOf(e),I=v[C-1]||v[C+1];return i(I)==="aioseo/faq"?b(I):null},[e,d]);o&&!d.includes(e)&&!t.question&&c&&(d.push(e),window.requestAnimationFrame(()=>{a({backgroundColor:c.backgroundColor,textColor:c.textColor,tagName:c.tagName,hidden:c.hidden,fontSize:c.fontSize,style:c.style})}));const S=R(r=>{const p=r("core/block-editor");if(!p)return;const{getBlocks:h}=p;return(i=>{const w=h(i),y=re(w);return ue(y)})(e)},[e]);g({answer:S});const L=[["core/paragraph",{placeholder:s("Write an answer...",N)}]],Q=["core/paragraph","core/heading","core/list","core/image","core/media-text"];return React.createElement(React.Fragment,null,React.createElement("div",{"data-schema-only":m,className:n,"data-schema-block-id":q},React.createElement(ie,null,React.createElement(ee,{setSchemaBlockAttributes:g,attributes:t})),React.createElement(A,{tagName:f,placeholder:s("Write a question...",N),className:"aioseo-faq-block-question",value:k,onChange:r=>g({question:r})}),React.createElement("div",{className:"aioseo-faq-block-answer"},React.createElement(x,{template:L,allowedBlocks:Q}))))},save:function({attributes:l,className:t}){const{hidden:n,question:e,tagName:a}=l;return React.createElement("div",{"data-schema-only":n,className:t},React.createElement(A.Content,{tagName:a,className:"aioseo-faq-block-question",value:e}),React.createElement("div",{className:"aioseo-faq-block-answer"},React.createElement(x.Content,null)))}};T({name:te,settings:de});
