5 lines
33 KiB
JavaScript
5 lines
33 KiB
JavaScript
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.__aioseoDynamicImportPreload__("js/vendor-draggable.f9bdaf1b.js"),window.__aioseoDynamicImportPreload__("js/vendor-other.7b559694.js"),window.__aioseoDynamicImportPreload__("js/vendor-vue-ui.de3ab35f.js"),window.__aioseoDynamicImportPreload__("css/vendor-vue-ui.dbee72c8.css")])))=>i.map(i=>d[i]);
|
|
import{h as ue,c as pe,d as we,r as He}from"../js/utils.4c41c8aa.js";import{f as c,i as y,j as s,M as A,U as k,ae as j,Q as E,R as B,a0 as $,v,B as Ae,T as W,u as ge,r as q,b as Y,n as K,aq as fe,P as Q,C as Se,as as $e,O as Be,ad as Te,S as Ee,ar as te,an as oe}from"../js/vendor-vue-ui.de3ab35f.js";import{b as me,bk as X,bl as ie,bm as Ve,bn as Ie,ap as ne,y as Oe,l as Me,bo as Le}from"../js/app-core.ae890a3f.js";import{C as xe}from"../js/Tooltip.ae7a1028.js";import{S as ye}from"../js/Info.b2b2b6e1.js";import{_ as x,a as G}from"../js/vendor-other.7b559694.js";import{_ as Re}from"../js/vendor-phone.8b9bc15d.js";import{B as le}from"../js/Input.8918dec2.js";import{S as ze}from"../js/Close.098d4b76.js";import{S as Ne}from"../js/Drag.85d6c286.js";import{S as De}from"../js/Eye.050aa9d8.js";import{_ as qe}from"../js/_plugin-vue_export-helper.eefbdd86.js";import{S as Fe}from"../js/Link.53728cdc.js";import{C as Pe}from"../js/Index.ab3bcf62.js";import{_ as se}from"../js/Button.a549093d.js";import"../js/vendor-lodash.8e35bd59.js";import"../js/Index.52399193.js";import"../js/Pencil.405b16d2.js";import"../js/Trash.d35f8063.js";const Ze=ue`
|
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M0 0h24v24H0V0zm0 0h24v24H0V0z" fill="none"/><path d="M3 9h14V7H3v2zm0 4h14v-2H3v2zm0 4h14v-2H3v2zm16 0h2v-2h-2v2zm0-10v2h2V7h-2zm0 6h2v-2h-2v2z"/></svg>
|
|
`,Ue="aioseo/table-of-contents",je="AIOSEO - Table of Contents",Qe="Automatically output a table of contents (TOC) for long posts or pages (and custom post types).",Ge="layout",Je={listStyle:{type:"string",default:"ul"},collapsibleType:{type:"string",default:"off"},collapsed:{type:"boolean",default:!1},collapsedTitle:{type:"string",default:"Show Table of Contents"},expandedTitle:{type:"string",default:"Hide Table of Contents"},mode:{type:"string",default:null},headings:{type:"array",items:{type:"object"},default:[]},reOrdered:{type:"boolean",default:!1}},Ye={multiple:!0,html:!1,reusable:!1,align:["wide","full"]},Ke={name:Ue,title:je,description:Qe,category:Ge,attributes:Je,supports:Ye},We={class:"aioseo-toc-header"},Xe={class:"aioseo-toc-header-title"},et={key:0,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},tt={key:1,width:"14",height:"2",viewBox:"0 0 14 2",fill:"none",xmlns:"http://www.w3.org/2000/svg"},ot={key:1},it={class:"aioseo-toc-header-info"},nt={key:0,class:"aioseo-toc-header-instructions"},lt={key:1,class:"aioseo-toc-header-buttons"},re={__name:"Header",props:{blockAttributes:{type:Object,required:!0},loadActions:{type:Boolean,default:!1}},emits:["showModal"],setup(t,{emit:o}){const e="all-in-one-seo-pack",i=o,n=t,l={header:G(x("%1$s Table of Contents",e),"AIOSEO"),instructions:x("Add a heading block below to begin generating the Table of Contents.",e),tooltipMainDescription:G(x("%1$s can automatically output a table of contents based on your heading tags below. Search engines sometimes use table of contents in search results or rich snippets which can help you increase your rankings.",e),"AIOSEO"),reorder:x("Reorder",e),save:x("Save",e)},m=ge(()=>n.blockAttributes.collapsibleType==="off"?"":n.blockAttributes.collapsed?n.blockAttributes.collapsedTitle:n.blockAttributes.expandedTitle),a=()=>{window.wp.data.dispatch("core/block-editor").selectBlock(null),document?.activeElement?.blur()},d=()=>{const _=!n.blockAttributes.collapsed;n.blockAttributes.collapsed=_,window.wp.data.dispatch("core/block-editor").updateBlockAttributes(n.clientId,{...n.blockAttributes,collapsed:_})};return(_,T)=>(c(),y("header",We,[s("div",Xe,[t.blockAttributes.collapsibleType==="open"||t.blockAttributes.collapsibleType==="closed"?(c(),y("div",{key:0,class:"aioseo-toc-header-collapsible",onClick:d},[t.blockAttributes.collapsed?(c(),y("svg",et,[...T[1]||(T[1]=[s("path",{d:"M6 8H0V6H6V0H8V6H14V8H8V14H6V8Z",fill:"#005AE0"},null,-1)])])):(c(),y("svg",tt,[...T[2]||(T[2]=[s("path",{d:"M0 2V0H14V2H0Z",fill:"#005AE0"},null,-1)])]))])):A("",!0),t.blockAttributes.collapsibleType==="off"?(c(),y("span",ot,k(l.header),1)):A("",!0),j(" "+k(m.value)+" ",1),t.loadActions?(c(),E(v(xe),{key:2},{tooltip:B(()=>[Ae(_.$slots,"tooltip",{},()=>[j(k(l.tooltipMainDescription),1)])]),default:B(()=>[s("div",it,[$(v(ye))])]),_:3})):A("",!0)]),t.blockAttributes?.headings?.length===0&&t.loadActions?(c(),y("div",nt,k(l.instructions),1)):A("",!0),t.blockAttributes?.headings?.length!==0&&t.loadActions?(c(),y("div",lt,[s("a",{class:"aioseo-button-link",href:"#",onClick:T[0]||(T[0]=W(F=>i("showModal"),["prevent"]))},k(l.reorder),1),s("a",{class:"aioseo-button-link aioseo-button-link--primary",href:"#",onClick:W(a,["prevent"])},k(l.save),1)])):A("",!0)]))}},st={},rt={viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",class:"aioseo-eye-off"};function ct(t,o){return c(),y("svg",rt,[...o[0]||(o[0]=[s("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"},null,-1),s("path",{d:"M12 6a9.77 9.77 0 0 1 8.82 5.5 9.647 9.647 0 0 1-2.41 3.12l1.41 1.41c1.39-1.23 2.49-2.77 3.18-4.53C21.27 7.11 17 4 12 4c-1.27 0-2.49.2-3.64.57l1.65 1.65C10.66 6.09 11.32 6 12 6zm-1.07 1.14L13 9.21c.57.25 1.03.71 1.28 1.28l2.07 2.07c.08-.34.14-.7.14-1.07C16.5 9.01 14.48 7 12 7c-.37 0-.72.05-1.07.14zM2.01 3.87l2.68 2.68A11.738 11.738 0 0 0 1 11.5C2.73 15.89 7 19 12 19c1.52 0 2.98-.29 4.32-.82l3.42 3.42 1.41-1.41L3.42 2.45 2.01 3.87zm7.5 7.5 2.61 2.61c-.04.01-.08.02-.12.02a2.5 2.5 0 0 1-2.5-2.5c0-.05.01-.08.01-.13zm-3.4-3.4 1.75 1.75a4.6 4.6 0 0 0-.36 1.78 4.507 4.507 0 0 0 6.27 4.14l.98.98c-.88.24-1.8.38-2.75.38a9.77 9.77 0 0 1-8.82-5.5c.7-1.43 1.72-2.61 2.93-3.53z",fill:"currentColor"},null,-1)])])}const at=qe(st,[["render",ct]]),dt={class:"aioseo-toc-list-item__inner"},ht={key:0,class:"aioseo-drag-handle has-icon"},ut={class:"append-icon"},pt={class:"aioseo-tooltip__header"},wt=["onClick"],be={__name:"List",props:{headings:{required:!0,type:Array},clientId:{required:!0,type:String},allowReorder:{required:!1,type:Boolean,default:!1},group:{required:!1,type:String,default:"description"},parentBlockId:{required:!1,type:String,default:""}},setup(t){const o=$e(()=>Re(()=>import("../js/vendor-draggable.f9bdaf1b.js").then(w=>w.v),__vite__mapDeps([0,1,2,3]),import.meta.url)),e="all-in-one-seo-pack",i=t,n=me(),l=q(window.wp.data.select("core/block-editor").getBlockAttributes(i.clientId)||{}),m={tooltipHeader:x("Edit HTML Anchor:",e),tooltipDescription:G(x("The HTML anchor allows %1$s to link directly to your header from this table of contents block. Feel free to edit if you want, but an anchor is required. For headings without an anchor, %1$s will automatically generate them.",e),"AIOSEO")},a=ge(()=>({tag:l.value.listStyle,animation:300,group:i.group,disabled:!i.allowReorder,ghostClass:"aioseo-drag-ghost",dragClass:"aioseo-dragging"})),d=(w,h)=>{h.editedContent=w===h.content?"":pe(w,!0,!1),window.wp.data.dispatch("core/block-editor").updateBlockAttributes(i.clientId,{...l.value,headings:i.headings})},_=w=>(w.blockClientId===i.parentBlockId?w.headings=ie(w.headings,w.editedOrder):w.headings.map(_),w),T=w=>{if(l.value.reOrdered=!0,!w?.moved?.element)return;const b=we(l.value.headings),u=ie(b.map(_));window.wp.data.dispatch("core/block-editor").updateBlockAttributes(i.clientId,{...l.value,headings:u})},F=(w,h)=>{const b=h.blockClientId;if(window.wp.data.select("core/block-editor").getBlock(b)){if(h.anchor=X(w),!w){const r=window.wp.data.select("core/block-editor").getBlockIndex(b);h.anchor=n.aioseo.data.blocks.toc.hashPrefix+X(`${h.content}-${r}`)}window.wp.data.dispatch("core/block-editor").updateBlockAttributes(b,{anchor:h.anchor})}},P=(w,h)=>w?.map(b=>b.content===h.content&&b.level===Number(h.level)&&b.anchor===h.anchor?h:b.headings?P(b.headings,h):b),Z=w=>{if(w.hidden=!w.hidden,i.group==="nested"){window.wp.data.dispatch("core/block-editor").updateBlockAttributes(i.clientId,l.value);return}window.wp.data.dispatch("core/block-editor").updateBlockAttributes(i.clientId,P(l.value.headings,w))},N=w=>{const h=w.target.closest(".aioseo-toc-list-item"),b=h?.querySelector(".row-input--anchor input");b&&(h.classList.contains("anchor-edit")?(h.classList.add("anchor-is-animating"),h.classList.remove("anchor-edit"),h.classList.remove("done"),b.addEventListener("animationend",function u(){h.classList.remove("anchor-is-animating"),h.removeEventListener("animationend",u,!1)})):(b.focus({preventScroll:!0}),h.classList.add("anchor-edit","anchor-is-animating"),b.addEventListener("animationend",function u(){h.classList.remove("anchor-is-animating"),h.classList.add("done"),b.removeEventListener("animationend",u,!1)})))};return Y(()=>{K(()=>{window.aioseoBus.$on("updateToc"+i.clientId,()=>{l.value=window.wp.data.select("core/block-editor").getBlockAttributes(i.clientId)||{}})})}),(w,h)=>{const b=fe("List",!0);return c(),E(v(o),Se({class:["aioseo-toc-list",[{orderable:t.allowReorder}]]},a.value,{handle:".aioseo-drag-handle",list:i.headings,onChange:h[0]||(h[0]=u=>T(u)),"item-key":u=>u?.id||u.blockClientId}),{item:B(({element:u})=>[s("li",{class:Q(["aioseo-toc-list-item",{"heading-hidden":u.hidden}])},[s("div",dt,[t.allowReorder?(c(),y("button",ht,[$(v(Ne))])):A("",!0),$(v(le),{class:"row-input row-input--content",modelValue:u.editedContent||u.content,"onUpdate:modelValue":r=>d(r,u),placeholder:u.content},{"append-icon":B(()=>[t.allowReorder?A("",!0):(c(),y("div",{key:0,class:"append-icon",onClick:N},[$(v(Fe))]))]),_:1},8,["modelValue","onUpdate:modelValue","placeholder"]),t.allowReorder?A("",!0):(c(),E(v(le),{key:1,class:"row-input row-input--anchor",spellcheck:!1,modelValue:u.anchor,"onUpdate:modelValue":r=>F(r,u)},{"append-icon":B(()=>[s("div",ut,[$(v(xe),null,{tooltip:B(()=>[s("p",pt,k(m.tooltipHeader),1),s("p",null,k(m.tooltipDescription),1)]),default:B(()=>[s("div",null,[$(v(ye))])]),_:1}),s("div",{onClick:N},[$(v(ze))])])]),_:1},8,["modelValue","onUpdate:modelValue"])),t.allowReorder?A("",!0):(c(),y("button",{key:2,class:Q([{active:u.hidden},"aioseo-hide-heading-toggle","has-icon"]),onClick:r=>Z(u)},[u.hidden?(c(),E(v(at),{key:0})):(c(),E(v(De),{key:1}))],10,wt)),u.headings?(c(),E(b,{key:3,class:"aioseo-toc-list-nested",headings:u.headings,"parent-block-id":u.blockClientId,allowReorder:t.allowReorder,"client-id":t.clientId,group:u.anchor},null,8,["headings","parent-block-id","allowReorder","client-id","group"])):A("",!0)])],2)]),_:1},16,["class","list","item-key"])}}},gt=["href"],ft={__name:"ListRendered",props:{headings:{required:!0,type:Array},clientId:{required:!0,type:String}},setup(t){const o=t,e=q(window.wp.data.select("core/block-editor").getBlockAttributes(o.clientId)||{});return Y(()=>{K(()=>{window.aioseoBus.$on("updateToc"+o.clientId,()=>{e.value=window.wp.data.select("core/block-editor").getBlockAttributes(o.clientId)||{}})})}),(i,n)=>{const l=fe("ListRendered",!0);return c(),y("div",null,[(c(),E(Ee(e.value.listStyle),{class:"aioseo-toc-list--rendered"},{default:B(()=>[(c(!0),y(Be,null,Te(t.headings,(m,a)=>(c(),y("li",{class:Q(["aioseo-toc-list-item--rendered",[{hidden:m.hidden}]]),key:a},[s("a",{href:`#${m.anchor}`},k(m.editedContent||m.content),9,gt),m.headings?(c(),E(l,{key:0,class:"aioseo-toc-list-nested--rendered",headings:m.headings,"client-id":t.clientId},null,8,["headings","client-id"])):A("",!0)],2))),128))]),_:1}))])}}},mt={class:"aioseo-toc-header"},xt={class:"aioseo-toc-header-title"},yt={class:"aioseo-toc-header-buttons"},bt={__name:"Reorder",props:{headings:Array,show:Boolean,clientId:String},emits:["closeModal"],setup(t){const o="all-in-one-seo-pack",e={header:G(x("%1$s Table of Contents",o),"AIOSEO"),done:x("Done",o)};return(i,n)=>(c(),E(v(Pe),{show:t.show,noHeader:"",classes:["aioseo-toc-modal"],onClose:n[1]||(n[1]=l=>i.$emit("closeModal"))},{body:B(()=>[s("header",mt,[s("div",xt,k(e.header),1),s("div",yt,[s("a",{class:"aioseo-button-link aioseo-button-link--primary",href:"#",onClick:n[0]||(n[0]=W(l=>i.$emit("closeModal"),["prevent"]))},k(e.done),1)])]),$(v(be),{headings:t.headings,"client-id":t.clientId,allowReorder:""},null,8,["headings","client-id"])]),_:1},8,["show"]))}},vt={class:"aioseo-toc-container"},kt={key:0},Ct={key:0,class:"aioseo-toc-content"},_t={key:0,class:"aioseo-toc-rendered"},Ht={key:0},At={__name:"App",props:{clientId:{type:String,required:!0}},setup(t){const o=t,e=q(window.wp.data.select("core/block-editor").getBlockAttributes(o.clientId)),i=q(!1);return Y(()=>{K(()=>{window.aioseoBus.$on("updateToc"+o.clientId,()=>{e.value=window.wp.data.select("core/block-editor").getBlockAttributes(o.clientId)})})}),(n,l)=>(c(),y("div",vt,[s("div",{class:Q(["aioseo-toc-menu",{"aioseo-toc-placeholder":e.value?.headings?.length===0}])},[$(v(re),{"block-attributes":e.value,"load-actions":!0,onShowModal:l[0]||(l[0]=m=>i.value=!0)},null,8,["block-attributes"]),e.value.collapsed?A("",!0):(c(),y("div",kt,[e.value?.headings?.length!==0?(c(),y("div",Ct,[$(v(be),{headings:e.value?.headings,"client-id":t.clientId},null,8,["headings","client-id"])])):A("",!0)])),$(v(bt),{show:i.value,headings:e.value?.headings,"client-id":t.clientId,onCloseModal:l[1]||(l[1]=m=>i.value=!1)},null,8,["show","headings","client-id"])],2),e.value?.headings?.length!==0?(c(),y("div",_t,[$(v(re),{"block-attributes":e.value},null,8,["block-attributes"]),e.value.collapsed?A("",!0):(c(),y("div",Ht,[$(v(ft),{headings:e.value?.headings,"client-id":t.clientId},null,8,["headings","client-id"])]))])):A("",!0)]))}},St={class:"aioseo-toc-select-mode"},$t={class:"aioseo-toc-header-title"},Bt={class:"aioseo-toc-select-mode__collapsible"},Tt={key:0,width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Et={key:1,width:"14",height:"2",viewBox:"0 0 14 2",fill:"none",xmlns:"http://www.w3.org/2000/svg"},Vt={key:0},It={key:1},Ot={key:0},Mt={class:"aioseo-toc-select-mode__description"},Lt={class:"aioseo-toc-select-mode__selectors"},Rt={class:"aioseo-toc-select-mode__selector"},zt={class:"aioseo-toc-select-mode__selector-title"},Nt={class:"aioseo-toc-select-mode__selector-description"},Dt={class:"aioseo-toc-select-mode__selector"},qt={class:"aioseo-toc-select-mode__selector-title"},Ft={class:"aioseo-toc-select-mode__selector-description"},Pt={__name:"SelectMode",props:{clientId:{type:String,required:!0}},setup(t){const o="all-in-one-seo-pack",e=t,i=q(window.wp.data.select("core/block-editor").getBlockAttributes(e.clientId)),n={showTableOfContents:x("Show Table of Contents",o),hideTableOfContents:x("Hide Table of Contents",o),description:x("Choose whether you want this table of contents to be standalone or synced. You can change these block settings later from the block panel.",o),standaloneTitle:x("Standalone",o),standaloneDescription:x("Each ToC block acts independently, showing the same headings across all blocks for a unified navigation.",o),syncedTitle:x("Synced",o),syncedDescription:x("Multiple ToC blocks working together, pointing to different sections of your content with their own headings.",o),enableStandalone:x("Enable Standalone",o),enableSynced:x("Enable Synced",o)},l=a=>{window.wp.data.dispatch("core/block-editor").updateBlockAttributes(e.clientId,{mode:a})},m=()=>{const a=!i.value.collapsed;i.value.collapsed=a,window.wp.data.dispatch("core/block-editor").updateBlockAttributes(e.clientId,{collapsed:a})};return Y(()=>{K(()=>{window.aioseoBus.$on("updateToc"+e.clientId,()=>{i.value=window.wp.data.select("core/block-editor").getBlockAttributes(e.clientId)})})}),(a,d)=>(c(),y("div",St,[s("div",$t,[s("div",Bt,[s("div",{class:"aioseo-toc-header-collapsible",onClick:m},[i.value.collapsed?(c(),y("svg",Tt,[...d[2]||(d[2]=[s("path",{d:"M6 8H0V6H6V0H8V6H14V8H8V14H6V8Z",fill:"#005AE0"},null,-1)])])):(c(),y("svg",Et,[...d[3]||(d[3]=[s("path",{d:"M0 2V0H14V2H0Z",fill:"#005AE0"},null,-1)])]))]),s("p",null,[i.value.collapsed?(c(),y("span",Vt,k(n.showTableOfContents),1)):(c(),y("span",It,k(n.hideTableOfContents),1))])])]),i.value.collapsed?A("",!0):(c(),y("div",Ot,[s("p",Mt,k(n.description),1),s("div",Lt,[s("div",Rt,[d[4]||(d[4]=te('<div class="aioseo-toc-select-mode__selector-icon"><svg width="80" height="80" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_171_2017)"><rect width="37.3333" height="37.3333" rx="2" fill="#1A82EA"></rect><rect x="7.29712" y="7.81384" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="7.29712" y="12.5684" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="7.29712" y="17.3229" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="7.29712" y="22.0774" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="7.29736" y="26.8322" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="12.0515" y="7.81384" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="12.0515" y="12.5684" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="12.0515" y="17.3229" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="12.0515" y="22.0774" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="12.0513" y="26.8322" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="19" y="19" width="37.3333" height="37.3333" rx="2" fill="white"></rect><rect x="22" y="22" width="37.3333" height="37.3333" rx="2" fill="#80B2FF"></rect><rect x="29.2971" y="29.814" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="29.2971" y="34.5685" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="29.2971" y="39.3229" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="29.2971" y="44.0774" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="29.2971" y="48.8322" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="34.0518" y="29.814" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="34.0518" y="34.5685" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="34.0518" y="39.3229" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="34.0518" y="44.0774" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="34.0518" y="48.8322" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="39.6667" y="39.6666" width="37.3333" height="37.3333" rx="2" fill="white"></rect><rect x="42.6667" y="42.6666" width="37.3333" height="37.3333" rx="2" fill="#99C2FF"></rect><rect x="49.9641" y="50.4806" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="49.9641" y="55.2351" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="49.9641" y="59.9896" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="49.9641" y="64.7441" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="49.9641" y="69.4985" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="54.7185" y="50.4806" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="54.7185" y="55.2351" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="54.7185" y="59.9896" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="54.7185" y="64.7441" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="54.7185" y="69.4985" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect></g><defs><clipPath id="clip0_171_2017"><rect width="80" height="80" fill="white"></rect></clipPath></defs></svg></div>',1)),s("h3",zt,k(n.standaloneTitle),1),s("p",Nt,k(n.standaloneDescription),1),$(v(se),{type:"blue",onClick:d[0]||(d[0]=_=>l("standalone")),size:"base"},{default:B(()=>[j(k(n.enableStandalone),1)]),_:1})]),s("div",Dt,[d[5]||(d[5]=te('<div class="aioseo-toc-select-mode__selector-icon"><svg width="80" height="80" viewBox="0 0 80 80" fill="none" xmlns="http://www.w3.org/2000/svg"><g clip-path="url(#clip0_171_2066)"><path d="M9.8667 40V13.6C9.8667 11.3908 11.6576 9.59998 13.8667 9.59998H66.6667C68.8758 9.59998 70.6667 11.3908 70.6667 13.6V66.4C70.6667 68.6091 68.8758 70.4 66.6667 70.4H40.2667" stroke="#141B38" stroke-linecap="round" stroke-linejoin="round" stroke-dasharray="1 2.4"></path><rect y="24.8063" width="37.0026" height="37.416" rx="2" fill="#1A82EA"></rect><rect x="7.13159" y="32.6615" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="7.13159" y="37.416" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="7.13159" y="42.1705" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="7.13159" y="46.925" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="7.13159" y="51.6797" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="11.8862" y="32.6615" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="11.8862" y="37.416" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="11.8862" y="42.1705" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="11.8862" y="46.925" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="11.8862" y="51.6797" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="42.9331" width="37.0026" height="37.416" rx="2" fill="#80B2FF"></rect><rect x="50.0647" y="7.85522" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="50.0649" y="12.6097" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="50.0649" y="17.3641" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="50.0649" y="22.1187" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="50.0649" y="26.8734" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="54.8193" y="7.85522" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="54.8191" y="12.6097" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="54.8191" y="17.3641" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="54.8191" y="22.1187" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="54.8191" y="26.8734" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="21.2666" y="39.1334" width="37.0667" height="37.8667" rx="2" fill="white"></rect><rect x="28.4304" y="47.214" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="28.4304" y="51.9685" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="28.4304" y="56.7231" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="28.4304" y="61.4777" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="28.4304" y="66.2322" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="33.1851" y="47.214" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="33.1853" y="51.9685" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="33.1853" y="56.7231" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="33.1853" y="61.4777" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="33.1853" y="66.2322" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="24.2666" y="42.1334" width="37.0667" height="37.8667" rx="2" fill="#99C2FF"></rect><rect x="31.4304" y="50.214" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="31.4304" y="54.9685" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="31.4304" y="59.7231" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="31.4304" y="64.4777" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="31.4304" y="69.2322" width="2.68734" height="2.68734" rx="1.34367" fill="white"></rect><rect x="36.1851" y="50.214" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="36.1853" y="54.9685" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="36.1853" y="59.7231" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="36.1853" y="64.4777" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><rect x="36.1853" y="69.2322" width="17.9845" height="2.68734" rx="0.413437" fill="white"></rect><circle cx="26" cy="10" r="7" fill="#00AA63"></circle><path d="M22.6667 13.3333V12.5H23.8126L23.6459 12.3541C23.2848 12.0347 23.0313 11.6701 22.8855 11.2604C22.7397 10.8507 22.6667 10.4375 22.6667 10.0208C22.6667 9.24996 22.8977 8.5642 23.3595 7.9635C23.8213 7.36281 24.4237 6.96524 25.1667 6.77079V7.64579C24.6667 7.82635 24.264 8.13364 23.9584 8.56767C23.6529 9.0017 23.5001 9.48607 23.5001 10.0208C23.5001 10.3333 23.5591 10.6371 23.6772 10.9323C23.7952 11.2274 23.9792 11.5 24.2292 11.75L24.3334 11.8541V10.8333H25.1667V13.3333H22.6667ZM26.8334 13.2291V12.3541C27.3334 12.1736 27.7362 11.8663 28.0417 11.4323C28.3473 10.9982 28.5001 10.5138 28.5001 9.97913C28.5001 9.66663 28.4411 9.36281 28.323 9.06767C28.2049 8.77253 28.0209 8.49996 27.7709 8.24996L27.6667 8.14579V9.16663H26.8334V6.66663H29.3334V7.49996H28.1876L28.3542 7.64579C28.6945 7.98607 28.9428 8.35586 29.099 8.75517C29.2553 9.15447 29.3334 9.56246 29.3334 9.97913C29.3334 10.75 29.1025 11.4357 28.6407 12.0364C28.1789 12.6371 27.5765 13.0347 26.8334 13.2291Z" fill="white"></path><circle cx="71" cy="55" r="7" fill="#00AA63"></circle><path d="M67.6667 58.3333V57.5H68.8126L68.6459 57.3541C68.2848 57.0347 68.0313 56.6701 67.8855 56.2604C67.7397 55.8507 67.6667 55.4375 67.6667 55.0208C67.6667 54.25 67.8977 53.5642 68.3595 52.9635C68.8213 52.3628 69.4237 51.9652 70.1667 51.7708V52.6458C69.6667 52.8263 69.264 53.1336 68.9584 53.5677C68.6529 54.0017 68.5001 54.4861 68.5001 55.0208C68.5001 55.3333 68.5591 55.6371 68.6772 55.9323C68.7952 56.2274 68.9792 56.5 69.2292 56.75L69.3334 56.8541V55.8333H70.1667V58.3333H67.6667ZM71.8334 58.2291V57.3541C72.3334 57.1736 72.7362 56.8663 73.0417 56.4323C73.3473 55.9982 73.5001 55.5138 73.5001 54.9791C73.5001 54.6666 73.4411 54.3628 73.323 54.0677C73.2049 53.7725 73.0209 53.5 72.7709 53.25L72.6667 53.1458V54.1666H71.8334V51.6666H74.3334V52.5H73.1876L73.3542 52.6458C73.6945 52.9861 73.9428 53.3559 74.099 53.7552C74.2553 54.1545 74.3334 54.5625 74.3334 54.9791C74.3334 55.75 74.1025 56.4357 73.6407 57.0364C73.1789 57.6371 72.5765 58.0347 71.8334 58.2291Z" fill="white"></path></g><defs><clipPath id="clip0_171_2066"><rect width="80" height="80" fill="white"></rect></clipPath></defs></svg></div>',1)),s("h3",qt,k(n.syncedTitle),1),s("p",Ft,k(n.syncedDescription),1),$(v(se),{type:"blue",onClick:d[1]||(d[1]=_=>l("synced")),size:"base"},{default:B(()=>[j(k(n.enableSynced),1)]),_:1})])])]))]))}},Zt=window.wp,{CheckboxControl:Ut,SelectControl:ce,TextControl:ae}=Zt.components,R="all-in-one-seo-pack",jt=t=>{const{setAttributes:o,attributes:{listStyle:e,collapsibleType:i,collapsedTitle:n,mode:l,expandedTitle:m},clientId:a}=t;return React.createElement(React.Fragment,null,React.createElement(ce,{label:x("List Style",R),options:[{label:"Bullets",value:"ul"},{label:"Numbers",value:"ol"}],value:e,onChange:d=>{o({listStyle:d}),window.aioseoBus.$emit("updateToc"+a)},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),React.createElement(ce,{label:x("Collapsible",R),options:[{label:"Off",value:"off"},{label:"On - Open by default",value:"open"},{label:"On - Closed by default",value:"closed"}],value:i,onChange:d=>{o({collapsibleType:d}),window.aioseoBus.$emit("updateToc"+a)},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),i!=="off"&&React.createElement(ae,{label:x("Collapsed Title",R),value:n,onChange:d=>{o({collapsedTitle:d}),window.aioseoBus.$emit("updateToc"+a)},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),i!=="off"&&React.createElement(ae,{label:x("Expanded Title",R),value:m,onChange:d=>{o({expandedTitle:d}),window.aioseoBus.$emit("updateToc"+a)},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),React.createElement(Ut,{label:x("Synced Table of Contents",R),help:x("Syncing table of contents enables you to build one unified table of contents for documents with multiple sections, even using separate ToC blocks.",R),checked:l==="synced",onChange:()=>{o({mode:l==="synced"?"standalone":"synced"}),window.aioseoBus.$emit("updateToc"+a)},__nextHasNoMarginBottom:!0}))},Qt="all-in-one-seo-pack",I=window.wp,{useState:Gt,useEffect:de}=I.element,{InspectorControls:Jt}=I.blockEditor,{PanelBody:Yt}=I.components,{useSelect:Kt}=I.data,ve=I.blockEditor.store,{isTyping:Wt}=I.data.select(ve)||{isTyping:()=>null},J={HEADING:"core/heading",FAQ:"aioseo/faq",TOC:"aioseo/table-of-contents"},z=new Map;let D=[],U=null;const Xt=t=>t.question||t.content?.text||t.content||"",eo=(t,o,e)=>typeof t=="string"&&t!==""&&o<=e,to=(t,o,e,i=[],n)=>{const l=typeof t?.anchor=="string"&&t.anchor!=="",m=t.level||t.tagName.replace("h","");if(m==="div")return null;let a=Xt(t);if(!eo(a,e,o))return null;if(a=pe(a.replace(/(<br *\/?>)+/g," "),!0),!l&&!Wt()){const _=me();t.anchor=_.aioseo.data.blocks.toc.hashPrefix+X(`${a}-${o}`)}const d=i.find(_=>_.content===a&&_.level===Number(m)&&_.anchor===(l?t.anchor:""));return{id:o,content:a,level:Number(m),anchor:l?t.anchor:"",editedOrder:d?.editedOrder??o,hidden:d?.hidden||!1,blockClientId:n}},oo=(t,o,e,i,n)=>{if(window.wp.data.select(ve).getBlockAttributes(t)?.mode!=="synced"||J.TOC!==i)return o.slice(e).map(a=>a);const m=io(o,e,n);return m===-1?o.slice(e).map(a=>a):o.slice(e,m).map(a=>a)},io=(t,o,e)=>{const n=t.slice(o+1).findIndex(l=>J.TOC===e(l));return n===-1?-1:o+1+n},no=({setAttributes:t,attributes:o,clientId:e,className:i,isSelected:n})=>{const{headings:l=[]}=o,[m,a]=Gt(o?.headings||[]),d=Ve(),_=window.wp.data.subscribe(()=>{if(!window.wp.data.select("core/block-editor").getBlock(e)){const g=z.get(e);g?.mainApp&&g.mainApp.unmount(),g?.selectedModeApp&&g.selectedModeApp.unmount(),z.delete(e),d.removeClientId(e),D=D.filter(f=>f!==e),_()}}),T=`aioseo-mode-selection-${e}`,F=Kt(r=>{const{getEditedPostAttribute:g}=r("core/editor");return g("content")},[]),P=()=>{const{getBlockAttributes:r,getBlockName:g,getBlocks:f}=I.data.select("core/block-editor"),p=f(),C=[],S=L=>{L.forEach(V=>{C.push(V.clientId),V.innerBlocks&&0<V.innerBlocks.length&&S(V.innerBlocks)})};S(p);const H=C.indexOf(e),O=oo(e,C,H,g(e),g),M=[];return O.forEach(L=>{const V=g(L);if(J.HEADING!==V&&J.FAQ!==V)return[];const Ce=r(L),_e=C.indexOf(L),ee=to(Ce,_e,H,m,L);ee&&M.push(ee)}),M},Z=r=>!r||!Array.isArray(r)?r:[...r].sort((f,p)=>f.editedOrder-p.editedOrder).map(f=>({...f,headings:Z(f.headings)})),N=r=>!r||!Array.isArray(r)?[]:[...r].sort((g,f)=>{const p=g.content.toLowerCase().localeCompare(f.content.toLowerCase());return p!==0?p:g.level!==f.level?g.level-f.level:(g.anchor||"").localeCompare(f.anchor||"")}),w=()=>{const r=Le(we(l||[])),f=P().map((S,H)=>{const O=r.find(M=>M.content===S.content&&M.level===Number(S.level)&&M.anchor===S.anchor);return{content:S.content,level:S.level,anchor:S.anchor,blockClientId:S.blockClientId,hidden:O?.hidden||!1,editedContent:O?.editedContent??"",editedOrder:O?.editedOrder??H+1,headings:O?.headings||[]}}),p=[],C=[];return f.forEach(S=>{for(;0<C.length&&C[C.length-1].level>=S.level;)C.pop();const H={...S,headings:[]};C.length===0?p.push(H):C[C.length-1].headings.push(H),C.push(H)}),o?.reOrdered?Z(p):p},h=()=>{const r=w();if(r.length===0)return;const g=N(r)?.map(p=>({content:p.content,level:p.level,anchor:p.anchor,blockClientId:p.blockClientId,hidden:p.hidden,editedContent:p.editedContent})),f=N(l)?.map(p=>({content:p.content,level:p.level,anchor:p.anchor,blockClientId:p.blockClientId,hidden:p.hidden,editedContent:p.editedContent}));b(g,f)&&(a(r),t({headings:r}),window.aioseoBus.$emit("updateToc"+e))},b=(r,g)=>{const f=S=>S.map(H=>({content:H.content,level:H.level,anchor:H.anchor,hidden:H.hidden,editedContent:H.editedContent||"",headings:H.headings?f(H.headings):[]})),p=f(r),C=f(g);return JSON.stringify(p)!==JSON.stringify(C)},u=()=>{const r=`aioseo-${e}`,g=Oe(),f=g.getElementById(r);(!D.includes(e)||f&&!f.firstChild)&&(n||g.querySelector(`[data-block="${e}"]`))&&(D.includes(e)||D.push(e),d.addClientId(e),ne({id:r,parent:document.querySelector(".block-editor"),subtree:!0,done:function(p){const C=z.get(e);C&&C.unmount(),U=oe({...At,name:"Blocks/TableOfContents",props:["clientId"]},{clientId:e}),Me(U),U.mount(p),z.set(e,U)}}))};return u(),de(()=>{o?.mode===null&&d.clientIds.length===1&&t({mode:Ie.STANDALONE}),h()},[F,o]),de(()=>{u()},[o,e]),o?.mode?React.createElement("div",{className:i},React.createElement("div",{id:`aioseo-${e}`}),React.createElement(Jt,null,React.createElement(Yt,{title:x("Table of Contents Settings",Qt)},React.createElement(jt,{attributes:o,setAttributes:t,clientId:e})))):(ne({id:T,parent:document.querySelector(".block-editor"),subtree:!0,done:function(r){const g=z.get(e);g&&g.unmount();const f=oe({...Pt,name:"Blocks/TableOfContents",props:["clientId"]},{clientId:e});f.mount(r),z.set(e,f)}}),React.createElement("div",{className:i},React.createElement("div",{id:`aioseo-mode-selection-${e}`})))},{RawHTML:he}=window.wp.element,lo=({attributes:{headings:t,listStyle:o}})=>{if(!t)return"";const e=ke(t,o);return ue`<${he}>${e}</${he}>`},ke=(t,o)=>{let e=`<${o}>`;return t.forEach(i=>{if(i.hidden)return;let n="<li>";const l=i.editedContent||i.content;n+=`<a href="#${i.anchor}">${l}</a>`,i.headings?.length&&(n+=ke(i.headings,o)),n+="</li>",e+=n}),e+=`</${o}>`,e},{name:so,title:ro,description:co,category:ao,supports:ho,attributes:uo}=Ke,po={title:ro,description:co,category:ao,supports:ho,attributes:uo,icon:Ze,edit:no,save:lo};He({name:so,settings:po});
|