import{j as B,r as y,l as J}from"./vendor-react-C630P38J.js";let d=(function(e){return e.CHARSET="charset",e.CSS_TEXT="cssText",e.HREF="href",e.HTTPEQUIV="http-equiv",e.INNER_HTML="innerHTML",e.ITEM_PROP="itemprop",e.NAME="name",e.PROPERTY="property",e.REL="rel",e.SRC="src",e.TARGET="target",e})({}),f=(function(e){return e.BASE="base",e.BODY="body",e.FRAGMENT="Symbol(react.fragment)",e.HEAD="head",e.HTML="html",e.LINK="link",e.META="meta",e.NOSCRIPT="noscript",e.SCRIPT="script",e.STYLE="style",e.TITLE="title",e})({});const x={link:{rel:["amphtml","canonical","alternate"]},meta:{charset:"",name:["generator","robots","description"],property:["og:type","og:title","og:url","og:image","og:image:alt","og:description","twitter:url","twitter:title","twitter:description","twitter:image","twitter:image:alt","twitter:card","twitter:site"]},script:{type:["application/ld+json"]}},Y=Object.values(f),F={accesskey:"accessKey",charset:"charSet",class:"className",contenteditable:"contentEditable",contextmenu:"contextMenu","http-equiv":"httpEquiv",itemprop:"itemProp",tabindex:"tabIndex"},k=(()=>{const e={};for(const[r,t]of Object.entries(F))e[t]=r;return e})(),h="data-rh",W=!!(typeof window<"u"&&window.document.createElement);function A(e,r){for(let t=e.length-1;t>=0;--t){const n=e[t][1][r];if(n!==void 0)return n}}function Z(e){let r=A(e,f.TITLE);const t=A(e,"titleTemplate");if(Array.isArray(r)&&(r=r.join("")),t&&r)return t.replace(/%s/g,()=>r);const n=A(e,"defaultTitle");return(r||n)??void 0}function v(e,r){const t={};for(const n of r){const s=n[1][e];s&&Object.assign(t,s)}return t}function G(e){for(let r=e.length-1;r>=0;--r){const t=e[r][1].base;if(t!=null&&t.href||t!=null&&t.target)return t}}function tt(e,r){let t;for(const n of Object.keys(e)){const s=n;r.includes(s)&&!(t===d.REL&&e[t].toLowerCase()==="canonical")&&!(s===d.REL&&e[s].toLowerCase()==="stylesheet")&&(t=s),r.includes(s)&&(s===d.INNER_HTML||s===d.CSS_TEXT||s===d.ITEM_PROP)&&(t=s)}return t??null}function C(e,r,t){const n={};return t.map(([,s])=>s).filter(s=>Array.isArray(s[e])?!0:(typeof s[e]<"u",!1)).map(s=>s[e]).reverse().reduce((s,i)=>{const o={};i.filter(a=>{const l=tt(a,r);if(!l||!a[l])return!1;const u=a[l].toLowerCase();return n[l]||(n[l]={}),o[l]||(o[l]={}),n[l][u]?!1:(o[l][u]=!0,!0)}).reverse().forEach(a=>{s.push(a)});const c=Object.keys(o);for(const a of c){const l={...n[a],...o[a]};n[a]=l}return s},[]).reverse()}function et(e,r){for(const[,t]of e)if(t[r])return!0;return!1}function V(e){return Array.isArray(e)?e.join(""):e}function rt(e,r){var t;for(const n of Object.keys(e))if((t=r[n])!=null&&t.includes(e[n]))return!0;return!1}function w(e,r){const t={default:Array(),priority:Array()};if(e)for(const n of e)rt(n,r)?t.priority.push(n):t.default.push(n);return t}function nt(e){const r={};for(const[t,n]of Object.entries(e))r[t]=Array.isArray(n)?n.slice():n;return r}function st(e,r){const t=e;for(const[n,s]of Object.entries(r))if(Array.isArray(s)){const i=t[n];t[n]=i?i.concat(s):s}else t[n]=s}function O(e,r,t){const n=e[r];n?n.push(t):e[r]=[t]}function N(e){let r=C(f.LINK,[d.REL,d.HREF],e),t=C("meta",[d.NAME,"charSet","httpEquiv",d.PROPERTY,"itemProp"],e),n=C("script",[d.SRC,d.INNER_HTML],e);const s=et(e,"prioritizeSeoTags");let i;if(s){const o=w(r,x.link);r=o.default;const c=w(t,x.meta);t=c.default;const a=w(n,x.script);n=a.default,i={links:o.priority,meta:c.priority,script:a.priority}}return{base:G(e),bodyAttributes:v("bodyAttributes",e),defer:A(e,"defer"),encodeSpecialCharacters:A(e,"encodeSpecialCharacters")??!0,htmlAttributes:v("htmlAttributes",e),links:r,meta:t,noscript:C("noscript",[d.INNER_HTML],e),onChangeClientState:A(e,"onChangeClientState"),priority:i,script:n,style:C("style",[d.CSS_TEXT],e),title:Z(e),titleAttributes:v("titleAttributes",e)}}function it(e){return k[e]??e}function T(e,r){const t=document.head||document.querySelector(f.HEAD),n=t.querySelectorAll(`${e}[${h}]`),s=[],i=[...n],o=[];for(const c of r){const a=document.createElement(e);for(const[u,g]of Object.entries(c))if(Object.prototype.hasOwnProperty.call(c,u)){const m=k[u]??u;m===d.INNER_HTML?a.innerHTML=g:m===d.CSS_TEXT?a.styleSheet?a.styleSheet.cssText=c.cssText:a.appendChild(document.createTextNode(c.cssText)):a.setAttribute(m,g??"")}a.setAttribute(h,"true");const l={};for(const{name:u,value:g}of a.attributes)l[u]=g;s.push(l);for(let u=0;;++u){if(a.isEqualNode(i[u])){i.splice(u,1);break}if(u>=i.length){o.push(a);break}}}return i.forEach(c=>{var a;(a=c.parentNode)==null||a.removeChild(c)}),o.forEach(c=>{t.appendChild(c)}),{allTags:s,newTags:o,oldTags:i}}function P(e,r){const[t]=document.getElementsByTagName(e);if(!t)return;const n=t.getAttribute(h),s=n?n.split(","):[],i=[...s],o=[];for(const c of Object.keys(r))o.push(k[c]??c);for(const[c,a]of Object.entries(r)){const l=k[c]??c;t.getAttribute(l)!==a&&t.setAttribute(l,a??""),s.includes(l)||s.push(l);const u=i.indexOf(l);u!==-1&&i.splice(u,1)}for(let c=i.length-1;c>=0;c-=1)t.removeAttribute(i[c]);s.length===i.length?t.removeAttribute(h):t.getAttribute(h)!==o.join(",")&&t.setAttribute(h,o.join(","))}function ot(e,r){e!==void 0&&document.title!==e&&(document.title=V(e)),P(f.TITLE,r)}function q(e,r){const{base:t,bodyAttributes:n,defer:s,htmlAttributes:i,links:o,meta:c,noscript:a,onChangeClientState:l,priority:u,script:g,style:m,title:E,titleAttributes:U}=e;P(f.BODY,n??{}),P(f.HTML,i??{}),ot(E,U);const H={baseTag:T(f.BASE,t?[t]:[]),linkTags:T(f.LINK,[...(u==null?void 0:u.links)??[],...o??[]]),metaTags:T(f.META,[...(u==null?void 0:u.meta)??[],...c??[]]),noscriptTags:T(f.NOSCRIPT,a??[]),scriptTags:T(f.SCRIPT,[...(u==null?void 0:u.script)??[],...g??[]]),styleTags:T(f.STYLE,m??[])},D={baseTag:[],bodyAttributes:{},defer:s??!1,htmlAttributes:{},linkTags:[],metaTags:[],noscriptTags:[],onChangeClientState:l??(()=>{}),scriptTags:[],styleTags:[],title:E??"",titleAttributes:{}},I={},j={};Object.keys(H).forEach(S=>{const{allTags:z,newTags:K,oldTags:Q}=H[S];D[S]=z,K.length&&(I[S]=K),Q.length&&(j[S]=H[S].oldTags)}),(r||Object.keys(I).length||Object.keys(j).length)&&(l==null||l(D,I,j))}const ct=[f.NOSCRIPT,f.SCRIPT,f.STYLE],X=(e,r=!0)=>r?e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'"):e;function $(e){let r="";for(const[t,n]of Object.entries(e)){const s=it(t),i=n===void 0?s:`${s}="${n}"`;i&&r&&(r+=" "),r+=i}return r}const at=(e,r,t)=>{let n=$(r);n&&(n=` ${n}`);const s=V(e);return`${X(s,t)}`};function p(e,r,t){let n="";for(const s of r){let i="";const o=Object.entries(s);for(const[l,u]of o)if(!(l===d.INNER_HTML||l===d.CSS_TEXT)){const g=k[l]??l;let m;if(u===void 0)m=g;else{const E=typeof u=="string"?u:String(u);m=`${g}="${X(E,t)}"`}i?i+=` ${m}`:i=m}const c=s.innerHTML??s.cssText??"",a=!ct.includes(e);n+=`<${e} ${h}="true" ${i}${a?"/>":`>${c}`}`}return n}function L(e,r={}){const t={};r.addHelmetDataAttr&&(t[h]=!0),r.addKey!==void 0&&(t.key=r.addKey);for(const[n,s]of Object.entries(e)){const i=F[n]??n;switch(i){case"cssText":case"innerHTML":t.dangerouslySetInnerHTML={__html:s};break;default:t[i]=s}}return t}function lt(e,r){return[B.jsx("title",{...L(r,{addHelmetDataAttr:!0}),children:e},e)]}function ut(e,r,t){return y.createElement(e,L(r,{addHelmetDataAttr:!0,addKey:t}))}function b(e,r){const t=[];for(let n=0;n(e.state??(e.state=N(e.helmets)),e.state);return{base:{toComponent(){const t=r().base;return t?b("base",[t]):[]},toString(){const t=r();return t.base?p("base",[t.base],t.encodeSpecialCharacters):""}},bodyAttributes:{toComponent(){const t=r().bodyAttributes;return L(t??{})},toString(){const t=r().bodyAttributes;return $(t??{})}},htmlAttributes:{toComponent(){const t=r().htmlAttributes;return L(t??{})},toString(){const t=r().htmlAttributes;return $(t??{})}},link:{toComponent(){return b("link",r().links??[])},toString(){const t=r();return p("link",t.links??[],t.encodeSpecialCharacters)}},meta:{toComponent(){return b("meta",r().meta??[])},toString(){const t=r();return p("meta",t.meta??[],t.encodeSpecialCharacters)}},noscript:{toComponent(){return b("noscript",r().noscript??[])},toString(){const t=r();return p("noscript",t.noscript??[],t.encodeSpecialCharacters)}},priority:{toComponent(){var n,s,i;const t=r();return[...b("meta",((n=t.priority)==null?void 0:n.meta)??[]),...b("link",((s=t.priority)==null?void 0:s.links)??[]),...b("script",((i=t.priority)==null?void 0:i.script)??[])]},toString(){var c,a,l;const t=r(),n=p("meta",((c=t.priority)==null?void 0:c.meta)??[],t.encodeSpecialCharacters),s=p("link",((a=t.priority)==null?void 0:a.links)??[],t.encodeSpecialCharacters),i=p("script",((l=t.priority)==null?void 0:l.script)??[],t.encodeSpecialCharacters);let o=n;return s&&(o&&(o+=" "),o+=s),i&&(o&&(o+=" "),o+=i),o}},script:{toComponent(){return b("script",r().script??[])},toString(){const t=r();return p("script",t.script??[],t.encodeSpecialCharacters)}},style:{toComponent(){return b("style",r().style??[])},toString(){const t=r();return p("style",t.style??[],t.encodeSpecialCharacters)}},title:{toComponent(){const t=r();return lt(t.title??"",t.titleAttributes??{})},toString(){const t=r();return at(t.title??"",t.titleAttributes??{},t.encodeSpecialCharacters)}}}}const _=y.createContext(void 0),gt=({children:e,onServerState:r})=>{const t=y.useRef(null);if(t.current===null){const i={firstRender:!0,helmets:[],state:void 0};r&&(i.serverState??(i.serverState=ft(i)),r(i.serverState)),t.current=i}const n=t.current,[s]=y.useState(()=>({clientApply(){W&&!n.state&&(n.state=N(n.helmets),n.state.defer?n.nextAnimFrameId??(n.nextAnimFrameId=requestAnimationFrame(()=>{n.state??(n.state=N(n.helmets)),q(n.state,n.firstRender),n.firstRender=!1,delete n.nextAnimFrameId})):(n.nextAnimFrameId!==void 0&&(cancelAnimationFrame(n.nextAnimFrameId),delete n.nextAnimFrameId),q(n.state,n.firstRender),n.firstRender=!1))},update(i,o){const c=n.helmets.findIndex(a=>a[0]===i);c>=0?(delete n.state,o?n.helmets[c][1]=o:n.helmets.splice(c,1)):o&&(delete n.state,n.helmets.push([i,o]))}}));return B.jsx(_,{value:s,children:e})};function dt(e,r){if(typeof e!="string")throw Error("You may be attempting to nest components within each other, which is not allowed. Refer to our API for more information.");if(!Y.includes(e))throw Error(`Only elements types ${Y.join(", ")} are allowed. Helmet does not support rendering <${e}> elements. Refer to our API for more information.`);if(!(!r||typeof r=="string"||Array.isArray(r)))throw Error(`Helmet expects a string as a child of <${e}>. Did you forget to wrap your children in braces? ( <${e}>{\`\`} ) Refer to our API for more information.`)}function R(e){return F[e]??e}function M(e){const r=nt(e);for(const t of Object.values(e))if(Array.isArray(t)){for(const n of t)if(n)for(const s of Object.keys(n)){const i=R(s);i!==s&&(n[i]=n[s],delete n[s])}}else if(t&&typeof t=="object"){const n=t;for(const s of Object.keys(n)){const i=R(s);i!==s&&(n[i]=n[s],delete n[s])}}return y.Children.forEach(e.children,t=>{if(t==null)return;if(typeof t!="object"||!("props"in t))throw Error(`"${typeof t}" is not a valid descendant`);let n;const s={};if(t.props)for(const[o,c]of Object.entries(t.props))o==="children"?n=c:s[R(o)]=c;let{type:i}=t;switch(typeof i=="symbol"&&(i=i.toString()),dt(i,n),i){case f.BASE:r.base=s;break;case f.BODY:r.bodyAttributes=s;break;case f.FRAGMENT:st(r,M({children:n}));break;case f.HTML:r.htmlAttributes=s;break;case f.LINK:case f.META:if(n)throw Error(`<${i} /> elements are self-closing and can not contain children. Refer to our API for more information.`);O(r,i,s);break;case f.NOSCRIPT:case f.SCRIPT:n!==void 0&&(s.innerHTML=n),O(r,i,s);break;case f.STYLE:s.cssText=n,O(r,i,s);break;case f.TITLE:r.titleAttributes=s,typeof n=="string"?r.title=n:Array.isArray(n)&&(r.title=n.join(""));break;case f.HEAD:}}),delete r.children,r}const pt=e=>{const r=J.c(8),t=y.use(_);if(!t)throw Error(" component must be within a children tree");const n=y.useId();t.update(n,M(e));let s;r[0]!==t||r[1]!==n||r[2]!==e?(s=()=>{t.update(n,M(e)),t.clientApply()},r[0]=t,r[1]=n,r[2]=e,r[3]=s):s=r[3],y.useEffect(s);let i,o;return r[4]!==t||r[5]!==n?(i=()=>()=>{t.update(n,void 0),t.clientApply()},o=[t,n],r[4]=t,r[5]=n,r[6]=i,r[7]=o):(i=r[6],o=r[7]),y.useEffect(i,o),null};export{gt as H,pt as a};