(()=>{"use strict";var e={n:t=>{var n=t&&t.__esModule?()=>t.default:()=>t;return e.d(n,{a:n}),n},d:(t,n)=>{for(var s in n)e.o(n,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:n[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.React,n=window.wp.data,s=window.wp.domReady;var a=e.n(s);const i=window.wp.element,r=window.yoast.uiLibrary,o=window.lodash,l=window.yoast.reduxJsToolkit,c="adminUrl",d=(0,l.createSlice)({name:c,initialState:"",reducers:{setAdminUrl:(e,{payload:t})=>t}}),u=(d.getInitialState,{selectAdminUrl:e=>(0,o.get)(e,c,"")});u.selectAdminLink=(0,l.createSelector)([u.selectAdminUrl,(e,t)=>t],((e,t="")=>{try{return new URL(t,e).href}catch(t){return e}})),d.actions,d.reducer;const m=window.wp.apiFetch;var p=e.n(m);const y="hasConsent",g=`${y}/storeConsent`,w=(0,l.createSlice)({name:y,initialState:{hasConsent:!1,endpoint:"yoast/v1/ai_generator/consent"},reducers:{giveAiGeneratorConsent:(e,{payload:t})=>{e.hasConsent=t},setAiGeneratorConsentEndpoint:(e,{payload:t})=>{e.endpoint=t}}}),h=w.getInitialState,v={selectHasAiGeneratorConsent:e=>(0,o.get)(e,[y,"hasConsent"],w.getInitialState().hasConsent),selectAiGeneratorConsentEndpoint:e=>(0,o.get)(e,[y,"endpoint"],w.getInitialState().endpoint)},S={...w.actions,storeAiGeneratorConsent:function*(e,t){try{yield{type:g,payload:{consent:e,endpoint:t}}}catch(e){return!1}return yield{type:`${y}/giveAiGeneratorConsent`,payload:e},!0}},E={[g]:async({payload:e})=>await p()({path:e.endpoint,method:"POST",data:{consent:e.consent},parse:!1})},b=w.reducer,f=window.wp.url,I="linkParams",C=(0,l.createSlice)({name:I,initialState:{},reducers:{setLinkParams:(e,{payload:t})=>t}}),x=C.getInitialState,k={selectLinkParam:(e,t,n={})=>(0,o.get)(e,`${I}.${t}`,n),selectLinkParams:e=>(0,o.get)(e,I,{})};k.selectLink=(0,l.createSelector)([k.selectLinkParams,(e,t)=>t,(e,t,n={})=>n],((e,t,n)=>(0,f.addQueryArgs)(t,{...e,...n})));const P=C.actions,L=C.reducer,$=(0,l.createSlice)({name:"notifications",initialState:{},reducers:{addNotification:{reducer:(e,{payload:t})=>{e[t.id]={id:t.id,variant:t.variant,size:t.size,title:t.title,description:t.description}},prepare:({id:e,variant:t="info",size:n="default",title:s,description:a})=>({payload:{id:e||(0,l.nanoid)(),variant:t,size:n,title:s||"",description:a}})},removeNotification:(e,{payload:t})=>(0,o.omit)(e,t)}}),_=($.getInitialState,$.actions,$.reducer,"pluginUrl"),N=(0,l.createSlice)({name:_,initialState:"",reducers:{setPluginUrl:(e,{payload:t})=>t}}),A=N.getInitialState,R={selectPluginUrl:e=>(0,o.get)(e,_,"")};R.selectImageLink=(0,l.createSelector)([R.selectPluginUrl,(e,t,n="images")=>n,(e,t)=>t],((e,t,n)=>[(0,o.trimEnd)(e,"/"),(0,o.trim)(t,"/"),(0,o.trimStart)(n,"/")].join("/")));const O=N.actions,T=N.reducer,U="request",M="success",B="error",W="idle",q="wistiaEmbedPermission",z=(0,l.createSlice)({name:q,initialState:{value:!1,status:W,error:{}},reducers:{setWistiaEmbedPermissionValue:(e,{payload:t})=>{e.value=Boolean(t)}},extraReducers:e=>{e.addCase(`${q}/${U}`,(e=>{e.status="loading"})),e.addCase(`${q}/${M}`,((e,{payload:t})=>{e.status="success",e.value=Boolean(t&&t.value)})),e.addCase(`${q}/${B}`,((e,{payload:t})=>{e.status="error",e.value=Boolean(t&&t.value),e.error={code:(0,o.get)(t,"error.code",500),message:(0,o.get)(t,"error.message","Unknown")}}))}}),j=z.getInitialState,G={selectWistiaEmbedPermission:e=>(0,o.get)(e,q,{value:!1,status:W}),selectWistiaEmbedPermissionValue:e=>(0,o.get)(e,[q,"value"],!1),selectWistiaEmbedPermissionStatus:e=>(0,o.get)(e,[q,"status"],W),selectWistiaEmbedPermissionError:e=>(0,o.get)(e,[q,"error"],{})},F={...z.actions,setWistiaEmbedPermission:function*(e){yield{type:`${q}/${U}`};try{return yield{type:q,payload:e},{type:`${q}/${M}`,payload:{value:e}}}catch(t){return{type:`${q}/${B}`,payload:{error:t,value:e}}}}},Y={[q]:async({payload:e})=>p()({path:"/yoast/v1/wistia_embed_permission",method:"POST",data:{value:Boolean(e)}})},H=z.reducer;var J;const V=(0,l.createSlice)({name:"documentTitle",initialState:(0,o.defaultTo)(null===(J=document)||void 0===J?void 0:J.title,""),reducers:{setDocumentTitle:(e,{payload:t})=>t}}),D=(V.getInitialState,V.actions,V.reducer,window.wp.i18n),Q=window.yoast.propTypes;var K=e.n(Q);const X=t.forwardRef((function(e,n){return t.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:2,stroke:"currentColor","aria-hidden":"true",ref:n},e),t.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 3v4M3 5h4M6 17v4m-2-2h4m5-16l2.286 6.857L21 12l-5.714 2.143L13 21l-2.286-6.857L5 12l5.714-2.143L13 3z"}))})),Z=({thumbnail:e,buttonLink:n,buttonLabel:s=(0,D.__)("Join the waitlist","wordpress-seo"),productName:a=(0,D.sprintf)(/* translators: %1$s expands to Yoast AI brand insights. */
(0,D.__)("Introducing %1$s","wordpress-seo"),"Yoast AI brand insights"),description:i=(0,D.__)("Track visibility, control perception, and stay ahead - tools to manage your AI presence are coming soon!","wordpress-seo")})=>{const{onClose:o,initialFocus:l}=(0,r.useModalContext)();return(0,t.createElement)(t.Fragment,null,(0,t.createElement)("div",{className:"yst-px-10 yst-pt-10 yst-introduction-gradient yst-text-center"},(0,t.createElement)("img",{className:"yst-w-full yst-h-auto yst-rounded-md yst-drop-shadow-md",alt:(0,D.__)("Web chart showing aspects of brand visibility in AI responses","wordpress-seo"),loading:"lazy",decoding:"async",...e}),(0,t.createElement)("div",{className:"yst-mt-6 yst-text-xs yst-font-medium yst-flex yst-flex-col yst-items-center"},(0,t.createElement)("span",{className:"yst-introduction-modal-uppercase yst-flex yst-gap-2 yst-items-center"},(0,t.createElement)("span",{className:"yst-ai-insights-icon"}),a))),(0,t.createElement)("div",{className:"yst-px-10 yst-pb-4 yst-flex yst-flex-col yst-items-center"},(0,t.createElement)("div",{className:"yst-mt-4 yst-mx-1.5 yst-text-center"},(0,t.createElement)("h3",{className:"yst-text-slate-900 yst-text-lg yst-font-medium"},(0,D.__)("How does your brand show up in AI responses?","wordpress-seo")),(0,t.createElement)("div",{className:"yst-mt-2 yst-text-slate-600 yst-text-sm"},(0,t.createElement)("p",null,i))),(0,t.createElement)("div",{className:"yst-w-full yst-flex yst-mt-6"},(0,t.createElement)(r.Button,{as:"a",className:"yst-grow yst-border-slate-200 yst-ai-insights-waitlist-button",size:"extra-large",variant:"upsell",href:n,target:"_blank",ref:l},(0,t.createElement)(X,{className:"yst--ms-1 yst-me-2 yst-h-5 yst-w-5 yst-text-white"}),s,(0,t.createElement)("span",{className:"yst-sr-only"},/* translators: Hidden accessibility text. */
(0,D.__)("(Opens in a new browser tab)","wordpress-seo")))),(0,t.createElement)(r.Button,{className:"yst-mt-2",variant:"tertiary",onClick:o},(0,D.__)("Close","wordpress-seo"))))};Z.propTypes={buttonLink:K().string.isRequired,thumbnail:K().shape({src:K().string.isRequired,width:K().string,height:K().string}).isRequired,buttonLabel:K().string,productName:K().string,description:K().string,ctbId:K().string};const ee="yoast-seo/introductions",te=({children:e})=>{const[n,s]=(0,i.useState)(!0),a=(0,i.useRef)(null),o=(0,i.useCallback)((()=>s(!1)),[]);return(0,t.createElement)(r.Modal,{className:"yst-introduction-modal yst-h-[calc(100vh - 1rem)] sm:yst-h-[calc(100vh - 2rem)] md:yst-h-[calc(100vh - 5rem)]) yst-overflow-y-auto",isOpen:n,onClose:o,initialFocus:a},(0,t.createElement)(r.Modal.Panel,{className:"yst-max-w-lg yst-p-0 yst-rounded-3xl"},e))};te.propTypes={children:K().node.isRequired};const ne=()=>{const e=(0,n.useSelect)((e=>e(ee).selectImageLink("ai-brand-insights-pre-launch.png")),[]),s=(0,n.useSelect)((e=>e(ee).selectLink("https://yoa.st/ai-brand-insights-introduction-pre-launch/")),[]),a=(0,i.useMemo)((()=>({src:e,width:"432",height:"243"})),[e]);return(0,t.createElement)(te,null,(0,t.createElement)(Z,{buttonLink:s,thumbnail:a}))},se=window.wp.hooks;window.YoastSEO=window.YoastSEO||{};const ae=(0,i.createContext)({}),ie=({children:e,initialComponents:s})=>{const[a,r]=(0,i.useState)(s),l=(0,n.useSelect)((e=>e(ee).selectIntroductions()),[]),c=(0,i.useCallback)(((e,t)=>{(0,o.find)(l,{id:e})&&r((n=>({...n,[e]:t})))}),[l,r]);return(0,i.useEffect)((()=>{window.YoastSEO._registerIntroductionComponent=c,(0,se.doAction)("yoast.introductions.ready")}),[c]),(0,t.createElement)(ae.Provider,{value:a},e)};ie.propTypes={children:K().node.isRequired,initialComponents:K().object.isRequired};const re=()=>{const e=(0,n.useSelect)((e=>e(ee).selectCurrentIntroduction()),[]),s=(0,i.useContext)(ae),a=(0,i.useMemo)((()=>null==s?void 0:s[null==e?void 0:e.id]),[e,s]);return a?(0,t.createElement)(a,null):null},oe="introductions",le=(0,l.createEntityAdapter)({selectId:e=>e.id,sortComparer:(e,t)=>e.priority===t.priority?0:e.priority<t.priority?-1:1}),ce=e=>({id:e.id||(0,l.nanoid)(),priority:e.priority||0}),de=(0,l.createSlice)({name:oe,initialState:le.getInitialState({current:0}),reducers:{addIntroduction:{reducer:le.addOne,prepare:e=>({payload:ce(e)})},addIntroductions:{reducer:le.addMany,prepare:e=>({payload:(0,o.map)(e,ce)})},setIntroductions:{reducer:le.setAll,prepare:e=>({payload:(0,o.map)(e,ce)})}}}),ue=de.getInitialState,me=le.getSelectors((e=>(0,o.get)(e,oe,{}))),pe={selectCurrentIntroductionIndex:e=>(0,o.get)(e,[oe,"current"],0),selectIntroduction:me.selectById,selectIntroductions:me.selectAll};pe.selectCurrentIntroduction=(0,l.createSelector)([pe.selectCurrentIntroductionIndex,pe.selectIntroductions],((e,t)=>t[e]));const ye=de.actions,ge=de.reducer,we="wpseoIntroductions";a()((()=>{const e=(0,o.get)(window,`${we}.introductions`,[]);if((0,o.isEmpty)(e))return;((e={})=>{(0,n.register)((e=>(0,n.createReduxStore)(ee,{actions:{...ye,...P,...O,...F,...S},selectors:{...pe,...k,...R,...G,...v},initialState:(0,o.merge)({},{[oe]:ue(),[I]:x(),[_]:A(),[q]:j(),[y]:h()},e),reducer:(0,n.combineReducers)({[oe]:ge,[I]:L,[_]:T,[q]:H,[y]:b}),controls:{...Y,...E}}))(e))})({[I]:(0,o.get)(window,`${we}.linkParams`,{}),[_]:(0,o.get)(window,`${we}.pluginUrl`,""),[q]:{value:"1"===(0,o.get)(window,`${we}.wistiaEmbedPermission`,!1)}}),(0,n.dispatch)(ee).setIntroductions(e);const s={isRtl:Boolean((0,o.get)(window,`${we}.isRtl`,!1))},a={"ai-brand-insights-pre-launch":ne},l=document.createElement("div");l.id="wpseo-introductions",document.body.appendChild(l),(0,i.createRoot)(l).render((0,t.createElement)(r.Root,{context:s},(0,t.createElement)(ie,{initialComponents:a},(0,t.createElement)(re,null))))}))})();