import{h as F,r as T,g as $}from"../js/utils.cf16d856.js";import{y as D}from"../js/app-core.a6d808ce.js";import{_ as r}from"../js/vendor-other.7b559694.js";import"../js/vendor-vue-ui.de3ab35f.js";import"../js/vendor-lodash.8e35bd59.js";const M=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>
`,O="aioseo/faq",z="AIOSEO - FAQ",W="Easily add an SEO-friendly Frequently Asked Question (FAQ) to your content.",P="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}},U={name:O,title:z,description:W,category:P,attributes:V,supports:Z},p="aioseo-pro",j=window.wp,{PanelBody:G,SelectControl:K,ToggleControl:Y}=j.components,J=({attributes:s,setSchemaBlockAttributes:t})=>{const{hidden:n,tagName:e}=s;return React.createElement(G,{title:r("FAQ Options",p)},React.createElement(K,{label:r("Title Wrapper",p),options:[{label:"DIV",value:"div"},{label:"H1",value:"h1"},{label:"H2",value:"h2"},{label:"H3",value:"h3"},{label:"H4",value:"h4"}],value:e,onChange:a=>t({tagName:a}),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),React.createElement("p",{className:"aioseo-visibility-label"},r("Visibility",p)),React.createElement(Y,{className:"aioseo-faq-visibility",label:r("Display Block",p),help:r("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.",p),checked:!n,onChange:()=>t({hidden:!n}),__nextHasNoMarginBottom:!0}))},N="all-in-one-seo-pack",{name:X,title:ee,description:te,category:oe,supports:ne,attributes:ae}=U,{useSelect:x}=window.wp.data,{useEffect:se}=window.wp.element,{serialize:ce}=window.wp.blocks,E=window.wp,le=E.blockEditor?.InspectorControls||E.editor.InspectorControls,{RichText:A,InnerBlocks:R}=E.blockEditor,u=[],re=s=>{const{body:t}=document.implementation.createHTMLDocument("");t.innerHTML=s;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:d,value:k}of o.attributes){const f=k.replace(/\s+/g,"").toLowerCase();(!["src","href"].includes(d)||d.startsWith("on")||f.includes("javascript:")||f.includes("data:"))&&o.removeAttribute(d)}n(o)}}return n(t),t.innerHTML.trim().replace(/\s+/g," ")},ie={title:ee,description:te,category:oe,supports:ne,attributes:ae,icon:M,edit:function(s){const{attributes:t,className:n,clientId:e,setAttributes:a,isSelected:o}=s,{hidden:d,question:k,tagName:f,schemaBlockId:q}=t;!u.includes(e)&&!o&&u.push(e);const h=l=>{window.requestAnimationFrame(()=>{a(l)}),window.aioseoBus.$emit("schemaBlockUpdated")};se(()=>{(!q||1<(D().querySelectorAll(`[data-schema-block-id='${q}']`)||[]).length)&&h({schemaBlockId:$()})},[]);const c=x(l=>{const m=l("core/block-editor");if(!m)return;const{getAdjacentBlockClientId:g,getBlockAttributes:b,getBlockName:i,getClientIdsWithDescendants:w,getGlobalBlockCount:y}=m;if(u.includes(e)||2>y("aioseo/faq"))return null;const B=g(e,-1);if(i(B)==="aioseo/faq")return b(B);const C=g(e,1);if(i(C)==="aioseo/faq")return b(C);const v=w().filter(L=>i(L)==="aioseo/faq"),_=v.indexOf(e),I=v[_-1]||v[_+1];return i(I)==="aioseo/faq"?b(I):null},[e,u]);o&&!u.includes(e)&&!t.question&&c&&(u.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=x(l=>{const m=l("core/block-editor");if(!m)return;const{getBlocks:g}=m;return(i=>{const w=g(i),y=ce(w);return re(y)})(e)},[e]);h({answer:S});const Q=[["core/paragraph",{placeholder:r("Write an answer...",N)}]],H=["core/paragraph","core/heading","core/list","core/image","core/media-text"];return React.createElement(React.Fragment,null,React.createElement("div",{"data-schema-only":d,className:n,"data-schema-block-id":q},React.createElement(le,null,React.createElement(J,{setSchemaBlockAttributes:h,attributes:t})),React.createElement(A,{tagName:f,placeholder:r("Write a question...",N),className:"aioseo-faq-block-question",value:k,onChange:l=>h({question:l})}),React.createElement("div",{className:"aioseo-faq-block-answer"},React.createElement(R,{template:Q,allowedBlocks:H}))))},save:function({attributes:s,className:t}){const{hidden:n,question:e,tagName:a}=s;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(R.Content,null)))}};T({name:X,settings:ie});
