1(()=>{"use strict";const e=window.wp.element,t=window.wp.hooks,o=window.ReactJSXRuntime,r=e=>{const{fill:t="#0FA961",...r}=e;return(0,o.jsxs)("svg",{width:"25",height:"25",viewBox:"0 0 256 256",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:[(0,o.jsx)("path",{d:"M97.0156 9.74499C120.404 0.0570803 146.141 -2.47884 170.971 2.45983C195.8 7.39873 218.609 19.59 236.51 37.4911L200.307 73.6942C189.566 62.9535 175.88 55.64 160.982 52.6766C146.085 49.7134 130.643 51.233 116.609 57.0458C102.576 62.8586 90.5814 72.7032 82.1426 85.3329C73.7038 97.9625 69.1992 112.811 69.1992 128.001C69.1992 140.594 72.2983 152.952 78.166 164.007C78.2596 164.006 78.3534 164.001 78.4473 164.001C89.4146 164.001 98.5033 172.026 100.17 182.524C105.185 179.335 111.141 177.497 117.525 177.518C133.572 177.572 146.835 189.36 149.221 204.729C153.155 204.564 157.087 204.1 160.982 203.325C175.88 200.362 189.566 193.046 200.307 182.306L236.51 218.511C218.609 236.412 195.8 248.603 170.971 253.542C146.141 258.48 120.404 255.945 97.0156 246.257C73.6273 236.569 53.6369 220.163 39.5723 199.114C25.5075 178.065 18 153.317 18 128.001C18 102.685 25.5074 77.9371 39.5723 56.8876C53.6369 35.8385 73.6272 19.433 97.0156 9.74499Z",fill:t}),(0,o.jsx)("path",{d:"M164 140.001C170.627 140.001 176 145.373 176 152.001C176 158.628 170.627 164.001 164 164.001C157.373 164.001 152 158.628 152 152.001C152 145.373 157.373 140.001 164 140.001Z",fill:t}),(0,o.jsx)("path",{d:"M108 108.001C114.627 108.001 120 113.373 120 120.001C120 126.628 114.627 132.001 108 132.001C101.373 132.001 96.0004 126.628 96 120.001C96 113.373 101.373 108.001 108 108.001Z",fill:t}),(0,o.jsx)("path",{d:"M152 76.0008C158.627 76.0008 164 81.3734 164 88.0008C164 94.6279 158.627 100.001 152 100.001C145.373 100.001 140 94.6279 140 88.0008C140 81.3734 145.373 76.0008 152 76.0008Z",fill:t})]})},n=window.wp.i18n,s=window.React,i=e=>{const t=(e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,o)=>o?o.toUpperCase():t.toLowerCase()))(e);return t.charAt(0).toUpperCase()+t.slice(1)},a=(...e)=>e.filter((e,t,o)=>Boolean(e)&&""!==e.trim()&&o.indexOf(e)===t).join(" ").trim(),c=e=>{for(const t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};const d=(0,s.forwardRef)(({color:e="currentColor",size:t=24,strokeWidth:o=2,absoluteStrokeWidth:r,className:n="",children:i,iconNode:d,...u},h)=>(0,s.createElement)("svg",{ref:h,...l,width:t,height:t,stroke:e,strokeWidth:r?24*Number(o)/Number(t):o,className:a("lucide",n),...!i&&!c(u)&&{"aria-hidden":"true"},...u},[...d.map(([e,t])=>(0,s.createElement)(e,t)),...Array.isArray(i)?i:[i]])),u=(e,t)=>{const o=(0,s.forwardRef)(({className:o,...r},n)=>{return(0,s.createElement)(d,{ref:n,iconNode:t,className:a(`lucide-${c=i(e),c.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,o),...r});var c});return o.displayName=i(e),o},h=u("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]),p=u("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]),b=u("globe",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20",key:"13o1zl"}],["path",{d:"M2 12h20",key:"9i4pu4"}]]),k=u("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]),g=e=>{const t=e||"";let o,r,n;const s=/^#?([a-f\d]{3}|[a-f\d]{6})$/i.exec(t);if(s){const e=3===s[1].length?s[1].replace(/(.)/g,"$1$1"):s[1];o=parseInt(e.slice(0,2),16),r=parseInt(e.slice(2,4),16),n=parseInt(e.slice(4,6),16)}else{const e=/^rgba\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(0|1|1\.0+|0?\.\d{1,4})\s*\)$/i.exec(t.trim());if(!e)return!1;const s=parseFloat(e[4]);if(Number(e[1])>255||Number(e[2])>255||Number(e[3])>255)return!1;o=Math.round(Number(e[1])*s+255*(1-s)),r=Math.round(Number(e[2])*s+255*(1-s)),n=Math.round(Number(e[3])*s+255*(1-s))}return(.299*o+.587*r+.114*n)/255<.5},m=(e,{source:t=window.location?.hostname||"surecookie_plugin",medium:o="wordpress_plugin",campaign:r="core_plugin",content:n}={})=>
1{if(!e)return e;try{const s=new URL(e);return s.searchParams.set("utm_source",t),s.searchParams.set("utm_medium",o),s.searchParams.set("utm_campaign",r),n&&s.searchParams.set("utm_content",n),s.toString()}catch(t){return e}},f=window?.surecookieAdminData?.cookieCategories,_=(Array.isArray(f),window?.surecookieAdminData?.colorPalettes||{}),w=(Object.values(_),m("https://surecookie.com/share-usage-data/",{content:"usage_optin"}),(e,t="")=>{const o=window?.surecookieAdminData||window?.surecookieOnboardingData||window?.surecookiePublicSettings;return e&&o?.website_links?.[e]?o.website_links[e]:m(`https://surecookie.com/${t}`,{content:e})}),y=((0,n.__)("30 days","surecookie"),(0,n.__)("60 days","surecookie"),(0,n.__)("90 days","surecookie"),(0,n.__)("365 days","surecookie"),(0,n.__)("Never","surecookie"),new Set(["a","strong","em","b","i","u","s","br","hr","p","ul","ol","li","span","h1","h2","h3","h4","h5","h6","blockquote","pre"])),v={a:new Set(["href","title","target","rel"]),span:new Set(["style"]),strong:new Set,em:new Set,b:new Set,i:new Set,u:new Set,br:new Set,hr:new Set,p:new Set(["style"]),ul:new Set,ol:new Set,li:new Set},x=e=>{if(!e)return!1;const t=e.trim();if(t.startsWith("/")||t.startsWith("#")||t.startsWith("?"))return!0;try{const e=new URL(t,window.location.origin);return["http:","https:","mailto:","tel:"].includes(e.protocol)}catch{return!1}},C=e=>{if(3===e.nodeType&&e.nodeValue)e.nodeValue=e.nodeValue.replace(/\u00a0/g," ");else for(const t of[...e.childNodes])C(t)},S=(e,t)=>{if(1!==e.nodeType)return;const o=e.tagName.toLowerCase();if(!y.has(o)){for(const o of[...e.childNodes])S(o,t);const o=t.createDocumentFragment();for(;e.firstChild;)o.appendChild(e.firstChild);return void e.replaceWith(o)}for(const t of[...e.attributes]){const r=t.name.toLowerCase();(v[o]||new Set).has(r)?"a"!==o||"href"!==r||x(t.value)?"a"===o&&"target"===r&&"_blank"!==t.value&&e.removeAttribute("target"):e.removeAttribute("href"):e.removeAttribute(t.name)}if("a"===o){const t=e.getAttribute("rel")||"",o=new Set(t.split(/\s+/).map(e=>e.trim().toLowerCase()).filter(Boolean));"_blank"===e.getAttribute("target")&&(o.add("noopener"),o.add("noreferrer")),o.add("nofollow"),e.setAttribute("rel",[...o].join(" "))}for(const o of[...e.childNodes])S(o,t)},E=e=>{if(!e)return"";if("undefined"==typeof window||"undefined"==typeof DOMParser)return"";const t=String(e),o=(new DOMParser).parseFromString(`<div>${t}</div>`,"text/html"),r=o.body.firstElementChild;if(!r)return"";C(r);for(const e of[...r.childNodes])S(e,o);return r.innerHTML},N=e=>{const t=e?.hide_unused_categories;return!0===t||1===t||"1"===t},A=(e,t,o)=>{const r=Array.isArray(e)?e:[];if(!o||!Array.isArray(t)||0===t.length)return r;const n=new Set(t),s=r.filter(e=>n.has(e?.id)||!!e?.required);return s.length?s:r},j=e=>String(e??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,"""),P=({modalDescription:e,cookiePolicyUrl:t,cookiePolicyTitle:o})=>{const r=E(e||"");if(!r.includes("{cookie_policy_link}"))return r;if(!t)return r.replace(/\s*\{cookie_policy_link\}\s*/g," ").replace(/\s+/g," ").trim();const s='<a href="'+j(t)+'" target="_blank" rel="noopener noreferrer" class="surecookie-modal-policy-link">'+j(o||(0,n.__)("Cookie Policy","surecookie"))+"</a>";return r.split("{cookie_policy_link}").join(s)},O=({isOpen:t,onClose:s,onSave:i,settings:a={},isPreview:c=!1})=>{const[l,d]=(0,e.useState)({}),[u,g]=(0,e.useState)([]),[m,f]=(0,e.useState)([]),[_,y]=(0,e.useState)([]),[v,x]=(0,e.useState)([]),[C,S]=(0,e.useState)(!0),[j,O]=(0,e.useState)(""),[M,D]=(0,e.useState)("cookies"),[I,L]=(0,e.useState)(!1),T=(0,e.useRef)(null),q=(0,e.useRef)(null),R=(0,e.useRef)(null);(0,e.useEffect)(()=>{t&&R.current&&(q.current=R.current.ownerDocument.activeElement)},[t]),(0,e.useEffect)(()=>{!t&&q.current&&(q.current.focus?.(),q.current=null)},[t]),(0,e.useEffect)(()=>{const e=window.surecookiePublicSettings?.cookie_categories||{},t=a.cookie_categories&&Object.keys(a.cookie_categories).length?Object.values(a.cookie_categories):Object.values(e);g(t);const o=Object.values(a?.custom_cookies||{});
1f(o);const r={};t.forEach(e=>{r[e.id]=!!e.required});const n=localStorage.getItem("surecookie_preferences");if(n)try{const e=JSON.parse(n);t.forEach(t=>{t.required?r[t.id]=!0:void 0!==e[t.id]&&(r[t.id]=e[t.id])}),d(r)}catch(e){d(r)}else d(r);S(!1)},[a.cookie_categories,a.custom_cookies,t]),(0,e.useEffect)(()=>{t||(y([]),D("cookies"),L(!1))},[t]);const B=Boolean(a.consent_forwarding_enabled??window?.surecookiePublicSettings?.consent_forwarding_enabled),$=Boolean(a.consent_forwarding_show_sites??window?.surecookiePublicSettings?.consent_forwarding_show_sites),W=a.consent_forwarding_partner_sites??window?.surecookiePublicSettings?.consent_forwarding_partner_sites,F=Array.isArray(W)?W:W&&"object"==typeof W?Object.values(W):[],U=[...new Set(F.filter(e=>"string"==typeof e&&/^https?:\/\//i.test(e)&&e.replace(/\/+$/,"")!==window.location.origin))],z=a.consent_forwarding_description??window?.surecookiePublicSettings?.consent_forwarding_description??"",H=(0,e.useMemo)(()=>E(z||""),[z]),K=B&&$;(0,e.useEffect)(()=>{if(t&&T.current){const e=setTimeout(()=>{T.current.focus()},100);return()=>clearTimeout(e)}},[t]);const J=(0,e.useCallback)(e=>e?Array.from(e.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')):[],[]),V=(0,e.useCallback)(e=>{if(!t)return;if("Escape"===e.key)return e.preventDefault(),void s();if("Tab"!==e.key)return;const o=J(T.current);if(0===o.length)return;const r=o[0],n=o[o.length-1];e.shiftKey?T.current.ownerDocument.activeElement===r&&(e.preventDefault(),n.focus()):T.current.ownerDocument.activeElement===n&&(e.preventDefault(),r.focus())},[t,s,J]);(0,e.useEffect)(()=>(document.addEventListener("keydown",V),()=>
1document.removeEventListener("keydown",V)),[V]);const G=(0,e.useMemo)(()=>N(a),[a]),Z=(0,e.useMemo)(()=>a?.categories_in_use||window.surecookiePublicSettings?.categories_in_use||[],[a]),X=(0,e.useMemo)(()=>A(u,Z,G),[u,Z,G]),Y=(0,e.useMemo)(()=>{const e=Math.max(1,Math.min(4,X.length||4));return Array.from({length:e},(e,t)=>t+1)},[X]),Q="opt-out"===(a?.consent_model||window.surecookiePublicSettings?.consent_model||"opt-in"),ee=(0,e.useCallback)(e=>{if(!G||Q)return e;const t=new Set(X.map(e=>e.id)),o={...e};return u.forEach(e=>{t.has(e.id)||e.required||(o[e.id]=!1)}),o},[G,Q,X,u]),te=a.cookie_policy_page_url||window?.surecookiePublicSettings?.cookie_policy_page_url||"",oe=a.cookie_policy_page_title||window?.surecookiePublicSettings?.cookie_policy_page_title||"",re=a.preferences_modal_heading||window?.surecookiePublicSettings?.preferences_modal_heading||"",ne=a.preferences_modal_description||window?.surecookiePublicSettings?.preferences_modal_description||"",se=a.text_color||"var(--surecookie-banner-text-color, #374151)",ie=a.text_color||"var(--surecookie-banner-text-color, #ffffff)",ae=a.banner_bg_color||"var(--surecookie-banner-background-color, #111827)",ce="#37415126",le=(0,o.jsx)("div",{"aria-live":"polite","aria-atomic":"true",className:"surecookie-sr-only",children:j});return t?(0,o.jsxs)("div",{ref:R,children:[le,(0,o.jsx)("div",{className:"surecookie-modal-backdrop",onClick:s,children:(0,o.jsx)("div",{className:"surecookie-modal-wrapper",children:(0,o.jsxs)("div",{ref:T,role:"dialog","aria-modal":"true","aria-labelledby":"surecookie-modal-title","aria-describedby":"surecookie-modal-description",className:"surecookie-preferences-modal",style:{backgroundColor:ae,color:se,...a.banner_bg_color&&{"--surecookie-banner-background-color":a.banner_bg_color},...a.text_color&&{"--surecookie-banner-text-color":a.text_color},...a.accept_btn_color&&{"--surecookie-banner-primary-color":a.accept_btn_color},...a.decline_btn_color&&{"--surecookie-banner-secondary-color":a.decline_btn_color}},onClick:e=>e.stopPropagation(),tabIndex:"-1",children:[(0,o.jsxs)("div",{className:"surecookie-modal-header",children:[(0,o.jsxs)("div",{className:"surecookie-modal-header-text",children:[(0,o.jsx)("h2",{id:"surecookie-modal-title",className:"surecookie-modal-title",children:re}),(0,o.jsx)("div",{id:"surecookie-modal-description",className:"surecookie-modal-description",dangerouslySetInnerHTML:{__html:P({modalDescription:ne,cookiePolicyUrl:te,cookiePolicyTitle:oe})}})]}),(0,o.jsx)("button",{type:"button",className:"surecookie-modal-close-btn",onClick:s,"aria-label":(0,n.__)("Close privacy preferences dialog","surecookie"),children:(0,o.jsx)(h,{size:20,"aria-hidden":"true"})})]}),K&&(0,o.jsxs)("div",{className:"surecookie-modal-tabs",role:"tablist","aria-label":(0,n.__)("Preference sections","surecookie"),tabIndex:-1,onKeyDown:e=>{let t=null;"ArrowRight"===e.key||"ArrowLeft"===e.key?t="cookies"===M?"forwarding":"cookies":"Home"===e.key?t="cookies":"End"===e.key&&(t="forwarding"),t&&t!==M&&(e.preventDefault(),D(t),T.current?.ownerDocument?.getElementById(`surecookie-tab-btn-${t}`)?.focus())},children:[(0,o.jsx)("button",{type:"button",role:"tab","aria-selected":"cookies"===M,"aria-controls":"surecookie-tab-cookies",id:"surecookie-tab-btn-cookies",tabIndex:"cookies"===M?0:-1,className:"surecookie-modal-tab "+("cookies"===M?"active":""),onClick:()=>D("cookies"),children:(0,n.__)("Cookies","surecookie")}),(0,o.jsx)("button",{type:"button",role:"tab","aria-selected":"forwarding"===M,"aria-controls":"surecookie-tab-forwarding",id:"surecookie-tab-btn-forwarding",tabIndex:"forwarding"===M?0:-1,className:"surecookie-modal-tab "+("forwarding"===M?"active":""),onClick:()=>D("forwarding"),children:(0,n.__)("Consent Forwarding","surecookie")})]}),K&&(0,o.jsxs)("div",{id:"surecookie-tab-forwarding",role:"tabpanel","aria-labelledby":"surecookie-tab-btn-forwarding",className:"surecookie-forwarding-panel",hidden:"forwarding"!==M,children:[H&&(0,o.jsx)("div",{className:"surecookie-forwarding-description",dangerouslySetInnerHTML:{__html:H}}),U.length>0?(0,o.jsxs)("div",{className:"surecookie-forwarding-accordion",children:[(0,o.jsxs)("button",{type:"button",className:"surecookie-forwarding-toggle","aria-expanded":I,"aria-controls":"surecookie-forwarding-sites-list",onClick:()=>L(e=>!e),children:[(0,o.jsx)("span",{className:"surecookie-forwarding-count",children:(0,n.sprintf)(/* translators: %d: number of partner sites */ /* translators: %d: number of partner sites */ 2(0,n.__)("%d connected site(s)","surecookie"),U.length)}),(0,o.jsx)("span",{className:"surecookie-forwarding-chevron "+(I?"expanded":""),"aria-hidden":"true",children:(0,o.jsx)(p,{size:14,strokeWidth:2.5,focusable:"false"})})]}),(0,o.jsx)("ul",{id:"surecookie-forwarding-sites-list",className:"surecookie-forwarding-sites",hidden:!I,"aria-label":(0,n.__)("Sites that will receive your consent","surecookie"),children:I&&U.map(e=>(0,o.jsx)("li",{className:"surecookie-forwarding-site",children:(0,o.jsxs)("a",{href:e,target:"_blank",rel:"noopener noreferrer",className:"surecookie-forwarding-site-link",children:[(0,o.jsx)(b,{size:13,"aria-hidden":"true",focusable:"false",className:"surecookie-forwarding-site-globe"}),(0,o.jsx)("span",{className:"surecookie-forwarding-site-url",children:e}),(0,o.jsx)(k,{size:11,"aria-hidden":"true",focusable:"false",className:"surecookie-forwarding-site-ext"})]})},e))})]}):(0,o.jsx)("p",{className:"surecookie-forwarding-note",children:(0,n.__)("No partner sites configured.","surecookie")})]}),(0,o.jsx)("div",{id:"surecookie-tab-cookies",role:K?"tabpanel":void 0,"aria-labelledby":K?"surecookie-tab-btn-cookies":void 0,hidden:K&&"cookies"!==M,className:"surecookie-categories-wrapper",children:(0,o.jsx)("div",{className:"surecookie-categories-scroll",children:(0,o.jsxs)("div",{className:"surecookie-categories-list",role:"status","aria-live":"polite","aria-busy":C,children:[C&&Y.map(e=>(0,o.jsx)("div",{className:"surecookie-category-item",style:{borderBottomColor:ce}
2,children:(0,o.jsxs)("div",{className:"surecookie-category-header",children:[(0,o.jsxs)("div",{className:"surecookie-category-trigger",children:[(0,o.jsx)("span",{className:"surecookie-skeleton surecookie-skeleton-icon"}),(0,o.jsx)("span",{className:"surecookie-skeleton surecookie-skeleton-title"})]}),1===e?(0,o.jsx)("span",{className:"surecookie-skeleton surecookie-skeleton-badge"}):(0,o.jsx)("span",{className:"surecookie-skeleton surecookie-skeleton-toggle"})]})},e)),!C&&X.map(e=>{const t=l[e.id],r=(s=e.id,m.filter(e=>e.category===s));var s;const i=_.includes(e.id),a=`surecookie-category-details-${e.id}`,c=`surecookie-cookie-table-${e.id}`;return(0,o.jsxs)("div",{className:"surecookie-category-item",style:{borderBottomColor:ce},children:[(0,o.jsxs)("div",{className:"surecookie-category-header",children:[(0,o.jsxs)("button",{type:"button",className:"surecookie-category-trigger",onClick:()=>(e=>{y(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])})(e.id),"aria-expanded":i,"aria-controls":a,children:[(0,o.jsx)("span",{className:"surecookie-expand-icon "+(i?"expanded":""),style:{color:se},"aria-hidden":"true",children:(0,o.jsx)(p,{size:18,strokeWidth:2.5,focusable:"false"})}),(0,o.jsx)("span",{className:"surecookie-category-name",style:{color:ie},children:e.name})]}),(0,o.jsxs)("div",{className:"surecookie-category-controls",children:[!!e.required&&(0,o.jsx)("span",{className:"surecookie-always-active","aria-hidden":"true",children:(0,n.__)("Always Active","surecookie")}),(0,o.jsx)("button",{type:"button",className:"surecookie-toggle-btn",role:"switch","aria-checked":t?"true":"false","aria-label":e.required?(0,n.sprintf)(/* translators: %s: cookie category name */ /* translators: %s: cookie category name */ 3(0,n.__)("%s: always active, cannot be disabled","surecookie"),e.name):e.name,onClick:()=>(e=>{const t=u.find(t=>t.id===e);t?.required||d(t=>({...t,[e]:!t[e]}))})(e.id),"aria-disabled":!!e.required,style:{backgroundColor:t?"var(--surecookie-banner-primary-color, #2563eb)":"#D1D5DB"},children:(0,o.jsx)("span",{className:"surecookie-toggle-knob "+(t?"checked":""),"aria-hidden":"true"})})]})]}),(0,o.jsx)("div",{id:a,className:"surecookie-category-details",hidden:!i,children:i&&(0,o.jsxs)(o.Fragment,{children:[e.description&&(0,o.jsx)("p",{className:"surecookie-category-desc",children:e.description}),r.length>0&&(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("button",{type:"button",className:"surecookie-cookie-table-toggle",onClick:t=>{t.stopPropagation(),(e=>{x(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])})(e.id)},"aria-expanded":v.includes(e.id),"aria-controls":c,children:[(0,o.jsx)("span",{className:"surecookie-cookie-table-label",children:(0,n.__)("View Cookies","surecookie")}),(0,o.jsx)("span",{className:"surecookie-table-chevron "+(v.includes(e.id)?"expanded":""),"aria-hidden":"true",children:(0,o.jsx)(p,{size:16,strokeWidth:2.5,focusable:"false"})})]}),(0,o.jsx)("div",{id:c,className:"surecookie-cookie-table-wrapper",hidden:!v.includes(e.id),children:v.includes(e.id)&&(0,o.jsxs)("table",{className:"surecookie-cookie-table","aria-label":(0,n.sprintf)(/* translators: %s: cookie category name */ /* translators: %s: cookie category name */ 4(0,n.__)("%s cookies details","surecookie"),e.name),children:[(0,o.jsx)("thead",{children:(0,o.jsxs)("tr",{children:[(0,o.jsx)("th",{scope:"col",children:(0,n.__)("Name","surecookie")}),(0,o.jsx)("th",{scope:"col",children:(0,n.__)("Provider","surecookie")}),(0,o.jsx)("th",{scope:"col",children:(0,n.__)("Duration","surecookie")}),(0,o.jsx)("th",{scope:"col",children:(0,n.__)("Expiry","surecookie")})]})}),(0,o.jsx)("tbody",{children:r.map(e=>(0,o.jsxs)("tr",{children:[(0,o.jsx)("td",{children:e.name}),(0,o.jsx)("td",{children:e.provider||"-"}),(0,o.jsx)("td",{children:e.duration||"-"}),(0,o.jsx)("td",{children:e.expires||"-"})]},e.id||`${e.category}-${e.name}`))})]})})]})]})})]},e.id)})]})})}),(0,o.jsxs)("div",{className:"surecookie-modal-footer",children:[(0,o.jsxs)("div",{className:"surecookie-footer-actions",children:[(0,o.jsx)("button",{type:"button",className:"surecookie-btn-outline",onClick:c?void 0:()=>{const e={};u.forEach(t=>{e[t.id]=!0});const t=ee(e);d(t),localStorage.setItem("surecookie_preferences",JSON.stringify(t)),window.surecookieManager&&window.surecookieManager.saveConsent(t,"accepted"),O((0,n.__)("All cookies accepted.","surecookie")),i(t)},"aria-disabled":c?"true":void 0,children:(0,n.__)("Accept All","surecookie")}),(0,o.jsx)("button",{type:"button",className:"surecookie-btn-outline-secondary",onClick:c?void 0:()=>{const e={};u.forEach(t=>{e[t.id]=!!t.required}),d(e),localStorage.setItem("surecookie_preferences",JSON.stringify(e)),window.surecookieManager&&window.surecookieManager.saveConsent(e,"declined"),O((0,n.__)("Non-essential cookies rejected.","surecookie")),i(e)},"aria-disabled":c?"true":void 0,children:(0,n.__)("Reject All","surecookie")})]}),(0,o.jsx)("button",{type:"button",className:"surecookie-btn-primary",onClick:c?void 0:()=>{const e=ee(l);localStorage.setItem("surecookie_preferences",JSON.stringify(e)),window.surecookieManager&&window.surecookieManager.saveConsent(e,"partially_accepted"),O((0,n.__)("Preferences saved successfully.","surecookie")),i(e)},"aria-disabled":c?"true":void 0,children:(0,n.__)("Confirm My Choices","surecookie")})]}
4),!a.remove_branding&&(0,o.jsx)("div",{className:"surecookie-modal-footer-branding",style:{borderTopColor:"#37415126",justifyContent:"flex-end"},children:(0,o.jsxs)("a",{href:w("preferences_modal_branding"),target:"_blank",rel:"noopener noreferrer",className:"surecookie-modal-branding-content","aria-label":(0,n.__)("Powered by SureCookie (opens in new tab)","surecookie"),children:[(0,o.jsx)("span",{"aria-hidden":"true",children:(0,n.__)("Powered by","surecookie")}),(0,o.jsx)(r,{width:"10",height:"12","aria-hidden":!0,focusable:"false"}),(0,o.jsx)("span",{"aria-hidden":"true",children:"SureCookie"})]})})]})})})]}):le},M=e=>{try{window.localStorage.setItem("surecookie_preferences",JSON.stringify(e))}catch(e){}};class D extends e.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){console.warn("SureCookie: floating widget crashed and was disabled.",e)}render(){return this.state.hasError?null:this.props.children}}const I="surecookie-preferences-root",L=({publicSettings:e,showBanner:o,bannerEnabled:r})=>(0,t.applyFilters)("surecookie.floatingWidget",null,{publicSettings:e,showBanner:o,bannerEnabled:r}),T=()=>{const s=(0,e.useMemo)(()=>window.surecookiePublicSettings||{},[]),i=(0,e.useMemo)(()=>{const e=(0,t.applyFilters)("surecookie.publicSettingsResolvers",[]);return Array.isArray(e)?e.filter(e=>"function"==typeof e):[]},[]),[a,c]=(0,e.useState)(s),[l,d]=(0,e.useState)(!1),[u,h]=(0,e.useState)(!1),[p]=(0,e.useState)(()=>{if("undefined"==typeof document)return null;const e=document.getElementById(I);if(e)return e;const t=document.createElement("div");return t.id=I,document.body.appendChild(t),t}),b=(0,e.useRef)(null),k=(0,e.useRef)(null),m=(0,e.useRef)(null),[f,_]=(0,e.useState)(0===i.length),y=(0,e.useMemo)(()=>void 0===a.show_settings_btn_enabled||Boolean(a.show_settings_btn_enabled),[a.show_settings_btn_enabled]),v=Boolean(s?.is_banner_visibility_hidden),x=Boolean(s?.banner_enabled||s?.enable_banner),[C,S]=(0,e.useState)(!v&&(a.banner_enabled||a.enable_banner||!1)),j=v||x&&!C,P=a.message_heading||"",T=a.message_description??(0,n.__)("This website uses cookies to enhance your browsing experience, personalize content, provide social media features, and analyze our traffic. You can review and manage your cookie settings at any time, or accept all cookies to proceed.","surecookie"),q=(0,e.useMemo)(()=>E(T),[T]),R=!!a.consent_forwarding_enabled,B=a.consent_forwarding_description||"",$=(0,e.useMemo)(()=>E(B),[B]),W=a.notice_type||"box",F=a.notice_position||"bottom-right",U=(e=>{const t=parseInt(e,10);return Number.isFinite(t)&&t>0?t:650})(a.banner_width),z=!!a.banner_overlay_enabled,H=(0,e.useMemo)(()=>a.locale?a.locale.replace("_","-"):document.documentElement.lang||void 0,[a.locale]),K="var(--surecookie-banner-text-color, #374151)",J=a.banner_logo||"",V=(e=>{const t=e?.accept_all_enabled;return!0===t||1===t||"1"===t})(a),G=a.banner_animation||"fade",Z=a.active_law_id,X="opt-out"===(a.consent_model||"opt-in"),Y=(0,e.useMemo)(()=>({accept:(0,n.__)("Only Essential","surecookie"),accept_all:(0,n.__)("Accept All","surecookie"),decline:(0,n.__)("Decline","surecookie"),preferences:(0,n.__)("Preferences","surecookie")}),[]),Q=(e,t)=>{if(a.button_labels?.[e])return a.button_labels[e];const o=a.law_default_labels?.[e];return Z&&o?o:t||Y[e]||""},ee=Q("accept",a.accept_btn_text),te=Q("accept_all",a.accept_all_btn_text),oe=Q("decline",a.decline_btn_text),re=Q("preferences",a.preferences_btn_text),ne=(0,e.useMemo)(()=>{let e;return e=a.button_config&&Array.isArray(a.button_config)?a.button_config:X&&!a.button_config?["accept","decline"]:a.button_order||"accept_all,accept,preferences,decline",((e,{acceptAllEnabled:t})=>{const o=Array.isArray(e)?e.slice():String(e||"").split(",").map(e=>e.trim()).filter(Boolean);return t?o:o.filter(e=>"accept_all"!==e)})(e,{acceptAllEnabled:V})},[a.button_order,a.button_config,X,V]),se=(0,e.useMemo)(()=>Object.values(a.cookie_categories||{}),[a.cookie_categories]),ie=(0,e.useMemo)(()=>Object.values(a.custom_cookies||{}),[a.custom_cookies]),ae=(0,e.useMemo)(()=>a.scanned_cookies||[],[a.scanned_cookies]),ce=(0,e.useMemo)(()=>{const e=new Set(ie.map(e=>e.name)),t=ae.filter(t=>!e.has(t.name));return[...ie,...t]},[ie,ae]),le=(0,e.useMemo)(()=>
4N(a),[a]),de=(0,e.useMemo)(()=>a.categories_in_use||[],[a.categories_in_use]),ue=(0,e.useMemo)(()=>!le||X?null:new Set(A(se,de,!0).map(e=>e.id)),[le,X,se,de]);(0,e.useEffect)(()=>{if(f||0===i.length)return;let e=!1;const t=(t={})=>{e||(Object.keys(t).length>0&&(c(e=>({...e,...t})),v?S(!1):void 0!==t.banner_enabled?S(Boolean(t.banner_enabled)):void 0!==t.enable_banner&&S(Boolean(t.enable_banner))),_(!0))};(async()=>{let e={};for(const t of i)try{const o=await t({...s,...e});o&&"object"==typeof o&&(e={...e,...o})}catch(e){}t(e)})();const o=setTimeout(()=>{e||t()},4e3);return()=>{e=!0,clearTimeout(o)}},[s,f,i]),(0,e.useEffect)(()=>{if(!f)return;if(!C)return void d(!1);(()=>{if(window.surecookieManager&&window.surecookieManager.hasConsent()){if(he())return void d(!0);d(!1)}else d(!0)})();const e=()=>{!document.hidden&&C&&window.surecookieManager&&window.surecookieManager.hasConsent()&&he()&&d(!0)};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[C,ie,y,f]),(0,e.useEffect)(()=>{const e=e=>{e.detail?d(!1):C&&d(!0)};return window.addEventListener("surecookie_changed",e),()=>{window.removeEventListener("surecookie_changed",e)}},[C]),(0,e.useEffect)(()=>{const e=e=>{e.detail&&"object"==typeof e.detail&&(c(t=>({...t,...e.detail})),void 0!==e.detail.banner_enabled&&S(!v&&Boolean(e.detail.banner_enabled)))};return window.addEventListener("surecookie_settings_changed",e),()=>{window.removeEventListener("surecookie_settings_changed",e)}},[]),(0,e.useEffect)(()=>{const e=()=>{j||(b.current=k.current?.ownerDocument?.activeElement??null,X&&C?(h(!1),d(!0)):(d(!1),h(!0)))},t=t=>{document.querySelector("[data-surecookie-reconsent]")&&t.target.closest("[data-surecookie-reconsent]")&&(t.preventDefault(),e())},o=t=>{" "===t.key&&document.querySelector("[data-surecookie-reconsent]")&&t.target.closest("[data-surecookie-reconsent]")&&(t.preventDefault(),e())};return document.addEventListener("surecookie_open_preferences",e),document.addEventListener("click",t),document.addEventListener("keydown",o),()=>{document.removeEventListener("surecookie_open_preferences",e),document.removeEventListener("click",t),document.removeEventListener("keydown",o)}},[X,C,j]),(0,e.useEffect)(()=>{const e=m.current;if(!l||!e)return;const t=t=>{if("Escape"===t.key){if(z)return;return t.preventDefault(),void d(!1)}if("Tab"!==t.key)return;const o=Array.from(e.querySelectorAll('button:not([disabled]), a[href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'));if(0===o.length)return;const r=o[0],n=o[o.length-1],s=e.ownerDocument?.activeElement;t.shiftKey&&s===r?(t.preventDefault(),n.focus()):t.shiftKey||s!==n||(t.preventDefault(),r.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)},[l,z]),(0,e.useEffect)(()=>{if(!l||!m.current)return;const e=setTimeout(()=>{const e=m.current?.querySelector("button:not([disabled])");e?e.focus():m.current?.focus()},100);return()=>clearTimeout(e)},[l]),(0,e.useEffect)(()=>{const e=k.current;if(!e)return;const t=e.ownerDocument||document,o=Array.from(t.body.children),r=[e.closest("#surecookie-public-root"),p].filter(Boolean);return o.forEach(e=>{r.some(t=>e===t||e.contains(t))||(u||l&&z?(e.setAttribute("inert",""),e.setAttribute("aria-hidden","true")):l?(e.removeAttribute("inert"),e.setAttribute("aria-hidden","true")):(e.removeAttribute("inert"),e.removeAttribute("aria-hidden")))}),()=>{o.forEach(e=>{e.removeAttribute("inert"),e.removeAttribute("aria-hidden")})}},[l,u,z,p]),(0,e.useEffect)(()=>{if(!(z&&l&&C||u))return;const{body:e}=document,t=e.style.overflow;return e.style.overflow="hidden",()=>{e.style.overflow=t}},[z,l,C,u]);const he=()=>{if(!ie||0===ie.length)return!1;const e=window.surecookieManager.getConsent();if(!e||!e.preferences)return!1;const t=e.timestamp?new Date(e.timestamp):null,o=new Date;for(const r of ie)if(r.expires){const n=new Date(r.expires);if(n<o&&(!t||n>t)&&e.preferences[r.category])return!0}return!1},pe=(0,e.useCallback)(()=>{const e={};X?(se&&se.length>0?se.forEach(t=>{e[t.id]=!0}):(e.essential=!0,e.functional=!0,e.analytics=!0,e.marketing=!0,e.uncategorized=!0),M(e),window.surecookieManager&&window.surecookieManager.saveConsent(e,"accepted")):(se&&se.length>0?se.forEach(t=>{e[t.id]=!!t.required}):(e.essential=!0,e.functional=!1,e.analytics=!1,e.marketing=!1,e.uncategorized=!1),M(e),window.surecookieManager&&window.surecookieManager.saveConsent(e,"partially_accepted")),d(!1)},[se,y,X]),be=(0,e.useCallback)(()=>
4{if(!V)return;const e={};se&&se.length>0?se.forEach(t=>{e[t.id]=!ue||ue.has(t.id)||!!t.required}):(e.essential=!0,e.functional=!0,e.analytics=!0,e.marketing=!0,e.uncategorized=!0),M(e),window.surecookieManager&&window.surecookieManager.saveConsent(e,"accepted"),d(!1)},[V,se,y,ue]),ke=(0,e.useCallback)(()=>{const e={};se&&se.length>0?se.forEach(t=>{e[t.id]=!!t.required}):(e.essential=!0,e.functional=!1,e.analytics=!1,e.marketing=!1,e.uncategorized=!1),M(e),window.surecookieManager&&window.surecookieManager.saveConsent(e,"declined"),d(!1)},[se,y]),ge=(0,e.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),b.current=k.current?.ownerDocument?.activeElement??null,d(!1),h(!0)},[]),me=(0,e.useCallback)(()=>{h(!1),b.current&&(b.current.focus(),b.current=null),window.surecookieManager&&window.surecookieManager.hasConsent()||!C||d(!0)},[C]),fe=(0,e.useCallback)(()=>{h(!1),d(!1)},[y]),_e={...a.banner_bg_color&&{"--surecookie-banner-background-color":a.banner_bg_color},...a.text_color&&{"--surecookie-banner-text-color":a.text_color},...a.accept_btn_color&&{"--surecookie-banner-primary-color":a.accept_btn_color},...a.accept_btn_hover_color&&{"--surecookie-banner-primary-hover-color":a.accept_btn_hover_color},...a.decline_btn_color&&{"--surecookie-banner-secondary-color":a.decline_btn_color}};return(0,o.jsxs)("div",{ref:k,className:"surecookie-public-banner-wrapper surecookie-styles",style:_e,children:[C&&l&&z&&(0,o.jsx)("div",{className:"surecookie-banner-overlay","data-overlay":"true","aria-hidden":"true"}),C&&l&&(0,o.jsx)("div",{ref:m,role:"dialog","aria-modal":"true",lang:H,tabIndex:"-1","aria-labelledby":P?"surecookie-banner-heading":void 0,"aria-label":P?void 0:(0,n.__)("Cookie Consent","surecookie"),"aria-describedby":"surecookie-banner-description",style:{backgroundColor:"var(--surecookie-banner-background-color, #111827)",color:K,..."box"===W&&{width:`${U}px`}},className:`surecookie-public-banner surecookie-banner surecookie-container-mobile surecookie-banner-container ${"banner"===W?"surecookie-banner-container-banner":J?"surecookie-banner-container-box-with-logo":"surecookie-banner-container-box"} ${(()=>{if("banner"===W)return"top"===F?"surecookie-banner-position-top":"surecookie-banner-position-bottom";if("box"===W){const e="surecookie-banner-position-box-base";switch(F){case"bottom-left":return`${e} surecookie-banner-position-bottom-left`;case"bottom-center":return"surecookie-banner-position-bottom-center";case"bottom-right":default:return`${e} surecookie-banner-position-bottom-right`;case"middle":return"surecookie-banner-position-middle"}}return"surecookie-banner-position-bottom"})()} ${"slide"===G?"surecookie-banner-animation-slide":"surecookie-banner-animation-fade"}`,"data-banner":"true","data-dark-mode":g(a.banner_bg_color)||!a.banner_bg_color?"true":"false",children:(0,o.jsxs)("div",{className:"surecookie-banner-inner "+("box"===W?"surecookie-banner-inner-box":"surecookie-banner-inner-banner"),style:{..."box"===W&&{maxWidth:`${U}px`}},children:[J&&(0,o.jsx)("div",{className:"surecookie-banner-logo-wrapper",children:(0,o.jsx)("img",{src:J,alt:(0,n.__)("Banner logo","surecookie"),className:"surecookie-banner-logo"})}),(0,o.jsxs)("div",{className:"surecookie-content-mobile surecookie-banner-content "+("box"===W?"surecookie-banner-content-box":"surecookie-banner-content-banner"),children:[(0,o.jsxs)("div",{className:"surecookie-banner-text-wrapper",children:[P&&(0,o.jsx)("h3",{id:"surecookie-banner-heading",className:"surecookie-banner-heading",style:{color:K},children:P}),(0,o.jsxs)("div",{id:"surecookie-banner-description",className:"surecookie-banner-description",style:{color:K},children:[(0,o.jsx)("div",{dangerouslySetInnerHTML:{__html:q}}),R&&$&&(0,o.jsx)("div",{className:"surecookie-forwarding-description",dangerouslySetInnerHTML:{__html:$}})]}),"banner"===W&&!a.remove_branding&&(0,o.jsxs)("a",{href:w("banner_branding"),target:"_blank",rel:"noopener noreferrer",className:"surecookie-branding-mobile surecookie-branding",tabIndex:"-1","aria-label":(0,n.__)("Powered by SureCookie (opens in new tab)","surecookie"),children:[(0,o.jsx)("span",{"aria-hidden":"true",children:a.branding_powered_by||"Powered by"}),(0,o.jsx)(r,{width:"10",height:"12","aria-hidden":!0,focusable:"false"}),(0,o.jsx)("span",{"aria-hidden":"true",children:"SureCookie"})]})]}),(0,o.jsx)("div",{className:"surecookie-buttons-mobile surecookie-banner-buttons "+("box"===W?"surecookie-banner-buttons-box":"surecookie-banner-buttons-banner"),children:(()=>{const e={decline:(0,o.jsx)("button",{type:"button",className:"surecookie-decline-btn surecookie-button-mobile surecookie-btn-base",onClick:ke,"aria-label":(0,n.__)("Decline all non-e
4ssential cookies","surecookie"),children:oe},"decline"),preferences:(0,o.jsx)("button",{type:"button",className:"surecookie-preferences-btn surecookie-button-mobile surecookie-btn-base surecookie-btn-transparent surecookie-btn-font-semibold",onClick:ge,"aria-label":(0,n.__)("Manage cookie preferences","surecookie"),style:(t="var(--surecookie-banner-text-color, "+K+")",{color:t,...s}),children:re},"preferences"),accept:(0,o.jsx)("button",{type:"button",className:"surecookie-accept-btn surecookie-button-mobile surecookie-btn-base",onClick:pe,"aria-label":(0,n.__)("Accept only essential cookies","surecookie"),children:ee},"accept"),accept_all:V?(0,o.jsx)("button",{type:"button",className:"surecookie-accept-all-btn surecookie-button-mobile surecookie-btn-base",onClick:be,"aria-label":(0,n.__)("Accept all cookies","surecookie"),children:te},"accept_all"):null};var t,s;const i=ne.map(t=>e[t]).filter(Boolean);return"banner"===W||a.remove_branding?i:[...i,(0,o.jsxs)("a",{href:w("preferences_modal_branding"),target:"_blank",rel:"noopener noreferrer",className:"surecookie-branding-mobile surecookie-branding","aria-label":(0,n.__)("Powered by SureCookie (opens in new tab)","surecookie"),children:[(0,o.jsx)("span",{"aria-hidden":"true",children:(0,n.__)("Powered by","surecookie")}),(0,o.jsx)(r,{width:"10",height:"12","aria-hidden":!0,focusable:"false"}),(0,o.jsx)("span",{"aria-hidden":"true",children:"SureCookie"})]},"branding")]})()})]})]})}),p&&(0,e.createPortal)((0,o.jsxs)("div",{className:"surecookie-public-banner-wrapper surecookie-styles",style:_e,children:[f&&C&&(0,o.jsx)(D,{children:(0,o.jsx)(L,{publicSettings:a,showBanner:l,bannerEnabled:C})}),(0,o.jsx)(O,{isOpen:u,onClose:me,onSave:fe,settings:{banner_bg_color:a.banner_bg_color,text_color:a.text_color,accept_btn_color:a.accept_btn_color,decline_btn_color:a.decline_btn_color,preferences_btn_text_color:a.text_color,decline_btn_border_color:a.decline_btn_border_color,cookie_categories:se,custom_cookies:ce,hide_unused_categories:a.hide_unused_categories,categories_in_use:de,consent_model:a.consent_model,remove_branding:a.remove_branding,consent_forwarding_enabled:a.consent_forwarding_enabled,consent_forwarding_mode:a.consent_forwarding_mode,consent_forwarding_partner_sites:a.consent_forwarding_partner_sites,consent_forwarding_description:a.consent_forwarding_description,consent_forwarding_show_sites:a.consent_forwarding_show_sites}})]}),p)]})},q=(e,t)=>{const o=window.surecookiePublicSettings?.api?.[e];if(o)return o;const r=(()=>{const e=document.querySelector('link[rel="https://api.w.org/"]')?.href;if(e)return e;const t=document.querySelector('script[src*="/wp-content/"], script[src*="/wp-includes/"], link[href*="/wp-content/"], link[href*="/wp-includes/"]'),o=(t?.src||t?.href||"").split(/\/wp-(?:content|includes)\//)[0];return o?`${o}/?rest_route=/`:null})();return r?r+t:(console.warn("SureCookie: could not resolve the WordPress REST URL, so the consent log was not written."),null)},R=(e,t)=>{console.warn(`SureCookie: consent log request failed (HTTP ${e}).`);const o=new Error(t?.message||`Consent log request failed with status ${e}.`);throw o.status=e,t?.code&&(o.code=t.code),o},B={IFRAME:"src",EMBED:"src",OBJECT:"data",LINK:"href"},$=e=>`${e.toLowerCase()}[data-surecookie-${B[e]}]`,W=new Set(["text/javascript","module","application/javascript","application/ecmascript","text/ecmascript","importmap","speculationrules"]);function F(e,t){const o=e.getAttribute(t);if(!o||"none"===o)return null;const r=o.toLowerCase().trim();return W.has(r)?r:null}"undefined"!=typeof window&&(window.surecookieManager=new class{constructor(){this.CONSENT_COOKIE_NAME="surecookie_user_consent",this.SESSION_COOKIE_NAME="surecookie_session_id",this.CONSENT_COOKIE_EXPIRY=365,this.SESSION_COOKIE_EXPIRY=365,this.consentData=null,this.sessionId=null,this.dynamicObserver=null,this.loadConsent(),this.loadOrCreateSessionId()}loadOrCreateSessionId(){const e=this.getCookie(this.SESSION_COOKIE_NAME);return e?this.sessionId=e:(this.sessionId=this.generateUUID(),this.setCookie(this.SESSION_COOKIE_NAME,this.sessionId,this.SESSION_COOKIE_
4EXPIRY)),this.sessionId}generateUUID(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){const t=Math.floor(16*Math.random());return("x"===e?t:t%4+8).toString(16)})}getSessionId(){return this.sessionId}loadConsent(){const e=this.getCookie(this.CONSENT_COOKIE_NAME);if(e)try{this.consentData=JSON.parse(decodeURIComponent(e))}catch(e){this.consentData=null}if(this.consentData&&this.isRenewalRequired()){this.deleteCookie(this.CONSENT_COOKIE_NAME),this.consentData=null;try{"undefined"!=typeof localStorage&&localStorage.removeItem("surecookie_preferences")}catch(e){}}}isRenewalRequired(){const e=parseInt(window.surecookiePublicSettings?.consent_renewed_at,10)||0;if(!e||!this.consentData)return!1;const t=Date.parse(this.consentData.timestamp);return isNaN(t)||t<1e3*e}saveConsent(e,t="custom"){const o=this.determineAction(e,t),r=this.consentData?JSON.stringify(this.consentData.preferences):null,n=this.consentData?this.consentData.action:null,s=null!==r&&r===JSON.stringify(e)&&n===o,i={preferences:e,action:o,timestamp:(new Date).toISOString()};this.consentData=i;const a=this.getConsentDuration(),c=encodeURIComponent(JSON.stringify(i));return this.setCookie(this.CONSENT_COOKIE_NAME,c,a),s||this.saveToDatabase(e,o),this.deleteDeclinedCookies(e),this.applyConsent(),this.updateGoogleConsent(e),this.updateWpConsentApi(e),setTimeout(()=>{this.triggerConsentChange(i)},0),i}updateGoogleConsent(e){if(!window.surecookiePublicSettings?.gcm_enabled||"function"!=typeof window.gtag)return;const t={ad_storage:e.marketing?"granted":"denied",ad_user_data:e.marketing?"granted":"denied",ad_personalization:e.marketing?"granted":"denied",personalization_storage:e.marketing?"granted":"denied",analytics_storage:e.analytics?"granted":"denied",functionality_storage:e.functional?"granted":"denied",security_storage:"granted"};window.gtag("consent","update",t),window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"surecookie_consent_updated",consentState:t,surecookiePreferences:e}),window.dispatchEvent(new CustomEvent("surecookie_gcm_updated",{detail:{consentState:t,preferences:e,timestamp:Date.now()}}))}updateWpConsentApi(e){if("function"==typeof window.wp_set_consent)try{const t=window.surecookiePublicSettings?.wpConsentCategoryMap||{essential:"functional",functional:"preferences",analytics:"statistics",marketing:"marketing"},o=new Set;Object.entries(t).forEach(([t,r])=>{if(!(t in e))return;const n="essential"===t||e[t]?"allow":"deny";o.has(r)||(window.wp_set_consent(r,n),o.add(r))}),Object.keys(e).forEach(r=>{if(t[r])return;const n="marketing",s=e[r]?"allow":"deny";o.has(n)||(window.wp_set_consent(n,s),o.add(n))})}catch(e){console.error("SureCookie: WP Consent API sync failed",e)}}hasGlobalPrivacyControl(){return!0===navigator.globalPrivacyControl}getConsentDuration(){if(window.surecookiePublicSettings&&void 0!==window.surecookiePublicSettings.consent_duration_days){const e=parseInt(window.surecookiePublicSettings.consent_duration_days,10);if(!isNaN(e)&&e>=1&&e<=3650)return e}return 365}saveToDatabase(e,t){window.surecookiePublicSettings&&window.surecookiePublicSettings.consent_logging_enabled&&((e,t,o)=>{const r=q("create_log","surecookie/v1/consent-logs/create-log");if(!r)return Promise.reject(new Error("REST base unavailable."));const n=n=>fetch(r,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({preferences:JSON.stringify(e),action_type:t,session_id:o,consent_log_token:n})}),s=window.surecookiePublicSettings?.consent_log_token??"",i=e=>e.json().catch(()=>({})).then(t=>R(e.status,t));return n(s).then(e=>e.ok?e.json():403!==e.status?i(e):e.json().catch(()=>({})).then(t=>s&&"surecookie_invalid_token"===t?.code?(e=>{const t=q("token","surecookie/v1/consent-logs/token");return t?fetch(t,{method:"POST",credentials:"same-origin",headers:{"Content-Type":"application/json"},body:JSON.stringify({stale_token:e})}).then(e=>e.ok?e.json():Promise.reject(new Error(`Token exchange failed (HTTP ${e.status}).`))).then(e=>{const t=e?.token;if(!t)throw new Error("Token exchange returned no token.");return window.surecookiePublicSettings&&(window.surecookiePublicSettings.consent_log_token=t),t}):Promise.reject(new Error("REST base unavailable."))})(s).catch(()=>R(e.status,t)).then(e=>n(e)).then(e=>e.ok?e.json():i(e)):R(e.status,t))).catch(e=>{throw e.status||console.warn("SureCookie: consent log request failed (network error)."),e})})(e,t,this.sessionId).then(e=>{if(!e.success)throw e}).catch(e=>{})}getConsent(){return this.consentData}hasConsent(){return null!==this.consentData}isAllowed(e){if("quarantine"===e)return!1;const t=window.surecookiePublicSettings?.consent_model||"opt-in";return this.consentData?!0===this.consentData.preferences[e]:"opt-out"===t||"essential"===e}acceptAll(e){const t={};
4return e.forEach(e=>{t[e.id]=!0}),this.saveConsent(t,"accepted")}declineAll(e){const t={};return e.forEach(e=>{"essential"===e.id?t[e.id]=!0:t[e.id]=!1}),this.saveConsent(t,"declined")}saveCustomPreferences(e){return this.saveConsent(e,"partially_accepted")}clearConsent(){this.deleteCookie(this.CONSENT_COOKIE_NAME),this.consentData=null,this.triggerConsentChange(null)}applyConsent(){const e=window.surecookiePublicSettings?.consent_model||"opt-in";this.reflowCollapsedPlaceholders(),this.matchPlaceholderSizes(),this.consentData||"opt-out"===e?(document.querySelectorAll("script[data-consent]").forEach(e=>{const t=e.getAttribute("data-consent");this.isAllowed(t)&&this.executeScript(e)}),document.querySelectorAll('script[type="text/plain"][data-surecookie-category]').forEach(e=>{const t=e.getAttribute("data-surecookie-category");this.isAllowed(t)&&this.executeBlockedScript(e)}),document.querySelectorAll(["IFRAME","EMBED","LINK"].map($).join(", ")).forEach(e=>{const t=e.getAttribute("data-surecookie-category");this.isAllowed(t)&&this.loadBlockedUrlElement(e)}),document.querySelectorAll($("OBJECT")).forEach(e=>{const t=e.getAttribute("data-surecookie-category");this.isAllowed(t)&&this.loadBlockedObject(e)}),this.showPendingPlaceholders(),window.dispatchEvent(new CustomEvent("surecookie_applied",{detail:this.consentData}))):this.showPendingPlaceholders()}startDynamicObserver(){if(this.dynamicObserver)return;const e=["script[data-surecookie-category]","script[data-consent]",...Object.keys(B).map($)].join(", "),t=e=>{1===e.nodeType&&("SCRIPT"===e.tagName&&"text/plain"===e.getAttribute("type")?.toLowerCase()&&e.hasAttribute("data-surecookie-category")?this.isAllowed(e.getAttribute("data-surecookie-category"))&&this.executeBlockedScript(e):"SCRIPT"===e.tagName&&e.hasAttribute("data-consent")?this.isAllowed(e.getAttribute("data-consent"))&&this.executeScript(e):"IFRAME"!==e.tagName&&"EMBED"!==e.tagName&&"LINK"!==e.tagName||!e.hasAttribute(`data-surecookie-${B[e.tagName]}`)?"OBJECT"===e.tagName&&e.hasAttribute("data-surecookie-data")&&this.isAllowed(e.getAttribute("data-surecookie-category"))&&this.loadBlockedObject(e):this.isAllowed(e.getAttribute("data-surecookie-category"))?this.loadBlockedUrlElement(e):"LINK"!==e.tagName&&this.wrapRuntimeBlockedElement(e))};this.dynamicObserver=new MutationObserver(o=>{for(const r of o)for(const o of r.addedNodes)1===o.nodeType&&(o.classList?.contains("surecookie-placeholder")?(this.reflowCollapsedPlaceholders(o.parentNode||document),this.matchPlaceholderSizes(o.parentNode||document)):(this.reflowCollapsedPlaceholders(o),this.matchPlaceholderSizes(o)),t(o),o.querySelectorAll?.(e)?.forEach(t),this.restorePrestoPlaceholders(o),this.restoreElementorVideos(o));this.showPendingPlaceholders(),this.hasConsent()&&this.areAllCategoriesAllowed()&&this.stopDynamicObserver()}),this.dynamicObserver.observe(document.documentElement,{childList:!0,subtree:!0}),window.addEventListener("pagehide",()=>this.stopDynamicObserver(),{once:!0})}stopDynamicObserver(){this.dynamicObserver&&(this.dynamicObserver.disconnect(),this.dynamicObserver=null)}areAllCategoriesAllowed(){const e=window.surecookiePublicSettings?.cookie_categories||{},t=Object.values(e).map(e=>e.id);return 0!==t.length&&t.every(e=>this.isAllowed(e))}loadBlockedUrlElement(e){const t=B[e.tagName];if(!t)return;const o=e.getAttribute(`data-surecookie-${t}`);if(!o)return;e.setAttribute(t,o),e.style.display="",e.removeAttribute(`data-surecookie-${t}`),e.removeAttribute("data-surecookie-name"),e.removeAttribute("data-surecookie-category");const r=e.closest(".surecookie-placeholder");r&&r.parentNode&&r.replaceWith(e)}loadBlockedObject(e){const t=e.getAttribute("data-surecookie-data");if(!t)return;e.querySelectorAll("param[data-surecookie-param-name]").forEach(e=>{const t=e.getAttribute("data-surecookie-param-name");t&&(e.setAttribute("name",t),e.removeAttribute("data-surecookie-param-name"))}),e.setAttribute("data",t),e.removeAttribute("data-surecookie-data"),e.removeAttribute("data-surecookie-name"),e.removeAttribute("data-surecookie-category"),e.style.display="";const o=e.cloneNode(!0),r=e.closest(".surecookie-placeholder");r&&r.parentNode?r.replaceWith(o):e.parentNode?.replaceChild(o,e)}collectPlaceholderPayload(e,t){const o=Array.from(e.childNodes).filter(e=>!(e=>1===e.nodeType&&(e.classList?.contains("surecookie-placeholder-content")||e.classList?.contains("surecookie-placeholder-image")))(e));return o.some(e=>
41===e.nodeType)?(o.forEach(e=>t.appendChild(e)),o.length):0}unwrapLoosePlaceholder(e){const t=document.createDocumentFragment();return!!this.collectPlaceholderPayload(e,t)&&(e.replaceWith(t),!0)}stashedFragment(e){const t=e.getAttribute("data-surecookie-restore");if(t){const e=document.createElement("template");return e.innerHTML=t,e.content}const o=e.querySelector("template.surecookie-presto-restore");return o?o.content.cloneNode(!0):null}stashLoosePlaceholder(e){const t=document.createElement("template");return t.className="surecookie-presto-restore",!!this.collectPlaceholderPayload(e,t.content)&&(e.appendChild(t),!0)}showPendingPlaceholders(){document.querySelectorAll(".surecookie-placeholder").forEach(e=>{e.classList.add("surecookie-pending")})}restorePrestoPlaceholders(e=document){const t=[];e.matches?.(".surecookie-placeholder-presto")&&t.push(e),e.querySelectorAll?.(".surecookie-placeholder-presto")?.forEach(e=>t.push(e)),t.forEach(e=>{const t=e.getAttribute("data-surecookie-category");if(!t)return;const o=this.stashedFragment(e);this.isAllowed(t)?o?(o.querySelectorAll("script").forEach(e=>{const t=document.createElement("script");Array.from(e.attributes).forEach(e=>{t.setAttribute(e.name,e.value)}),t.textContent=e.textContent,e.parentNode.replaceChild(t,e)}),e.replaceWith(o)):this.unwrapLoosePlaceholder(e):o||this.stashLoosePlaceholder(e)})}wrapRuntimeBlockedElement(e){const t=window.surecookiePublicSettings?.placeholder,o=e.getAttribute("data-surecookie-category");if(!t?.description||!o||"quarantine"===o||e.closest(".surecookie-placeholder"))return;const r=e.getAttribute("data-surecookie-name")||"",n=t.labels?.[r]||r,s=t.colors||{},i=document.createElement("div");i.className="surecookie-styles surecookie-public-banner-wrapper surecookie-placeholder surecookie-placeholder-runtime surecookie-placeholder-"+r,i.setAttribute("data-surecookie-name",r),i.setAttribute("data-surecookie-category",o);const a=document.createElement("div");a.className="surecookie-placeholder-content",a.style.backgroundColor=s.background||"";const c=document.createElement("div");c.className="surecookie-placeholder-text",c.style.color=s.text||"",c.innerHTML=t.description.replace("{service}",n),a.appendChild(c);const l=document.createElement("button");l.type="button",l.className="surecookie-placeholder-button",l.setAttribute("data-surecookie-category",o),l.setAttribute("aria-label",(t.accept_aria||"%s").replace("%s",n)),l.style.backgroundColor=s.primary||"",l.style.color=s.primary_text||"",l.textContent=t.button||"",a.appendChild(l),i.appendChild(a);const d=e.getBoundingClientRect();i.style.width="100%",i.style.height=d.height>0?d.height+"px":"100%",i.style.minHeight="160px",e.parentNode?.insertBefore(i,e),i.appendChild(e),e.style.display="none",i.classList.add("surecookie-pending")}restoreElementorVideos(e=document){const t=[];e.matches?.("[data-surecookie-widget-type]")&&t.push(e),e.querySelectorAll?.("[data-surecookie-widget-type]")?.forEach(e=>t.push(e)),t.forEach(e=>{const t=e.querySelector(".surecookie-placeholder-elementor");if(!t)return;const o=t.getAttribute("data-surecookie-category");if(!o||!this.isAllowed(o))return;const r=document.createElement("div");r.className="elementor-video",t.replaceWith(r),e.setAttribute("data-widget_type",e.getAttribute("data-surecookie-widget-type")),e.removeAttribute("data-surecookie-widget-type"),window.elementorFrontend?.elementsHandler?.runReadyTrigger?.(e)})}reflowCollapsedPlaceholders(e=document){const t=e.querySelectorAll?.(".surecookie-placeholder:not(.surecookie-reflowed)");if(!t||0===t.length)return;const o=[];t.forEach(e=>{const t=e.parentElement;if(!t||null===t.offsetParent)return;if(t.getBoundingClientRect().height>0)return;const r=parseInt(e.getAttribute("data-surecookie-width")||"0",10),n=parseInt(e.getAttribute("data-surecookie-height")||"0",10);!Number.isFinite(r)||!Number.isFinite(n)||r<=0||n<=0||o.push({ph:e,w:r,h:n})}),o.forEach(({ph:e,w:t,h:o})=>{e.style.position="relative",e.style.width="100%",e.style.maxWidth=t+"px",e.style.height="auto",e.style.aspectRatio=t+" / "+o,e.classList.add("surecookie-reflowed")})}computedPosition(e){const t=e.ownerDocument?.defaultView;return t?.getComputedStyle?.(e)?.position||""}parentReservesHeight(e){const t=e.parentElement;return!(!t||1!==t.children.length)&&t.getBoundingClientRect().height>e.getBoundingClientRect().height}matchPlaceholderSizes(e=document){const t=e.querySelectorAll?.(".surecookie-placeholder");
4t&&0!==t.length&&t.forEach(e=>{if(null===e.offsetParent)return;const t=e.querySelector("[data-surecookie-src], [data-surecookie-data]");if(!t)return;const o=t.style.display,r=t.style.visibility;t.style.visibility="hidden",t.style.display="";const n=this.computedPosition(t),s=t.offsetHeight;if(t.style.display=o,t.style.visibility=r,("absolute"===n||"fixed"===n)&&this.parentReservesHeight(e))return e.style.position="absolute",e.style.inset="0",e.style.height="100%",e.style.minHeight="0",void(e.style.aspectRatio="auto");150!==s||t.hasAttribute("height")?s>0&&150!==s&&(e.style.height=s+"px",e.style.aspectRatio="auto"):(e.style.height="auto",e.style.aspectRatio="16 / 9")})}acceptCategoryFromPlaceholder(e){if(!e)return;const t=window.surecookiePublicSettings?.cookie_categories||{},o=this.consentData?.preferences||{},r=window.surecookiePublicSettings?.consent_model||"opt-in";if("opt-out"!==r&&this.isCategoryHidden(e))return;const n={};let s="partially_accepted";"opt-out"===r?(Object.values(t).forEach(e=>{n[e.id]=!0}),s="accepted"):Object.values(t).forEach(t=>{t.required||t.id===e?n[t.id]=!0:n[t.id]=!this.isCategoryHidden(t.id)&&(o[t.id]||!1)}),localStorage.setItem("surecookie_preferences",JSON.stringify(n)),this.saveConsent(n,s)}isCategoryHidden(e){const t=window.surecookiePublicSettings||{},o=!0===t.hide_unused_categories||1===t.hide_unused_categories||"1"===t.hide_unused_categories,r=t.categories_in_use;return!(!o||!Array.isArray(r)||0===r.length||r.includes(e))}executeScript(e){const t=document.createElement("script");Array.from(e.attributes).forEach(e=>{"data-consent"!==e.name&&"type"!==e.name&&t.setAttribute(e.name,e.value)}),e.textContent&&(t.textContent=e.textContent);const o=F(e,"data-original-type");null!==o&&t.setAttribute("type",o),e.parentNode.replaceChild(t,e)}executeBlockedScript(e){const t=document.createElement("script");Array.from(e.attributes).forEach(e=>{"type"===e.name||e.name.startsWith("data-surecookie")||t.setAttribute(e.name,e.value)});const o=F(e,"data-surecookie-original-type");null!==o&&t.setAttribute("type",o);const r=e.getAttribute("data-surecookie-src");r?t.src=r:e.textContent&&(t.textContent=e.textContent),e.parentNode.replaceChild(t,e)}triggerConsentChange(e){window.dispatchEvent(new CustomEvent("surecookie_changed",{detail:e}))}setCookie(e,t,o){const r=new Date;r.setTime(r.getTime()+24*o*60*60*1e3);let n=`${e}=${t};expires=${r.toUTCString()};path=/;SameSite=Lax`;"https:"===window.location.protocol&&(n+=";Secure"),document.cookie=n}getCookie(e){const t=e+"=",o=document.cookie.split(";");for(let e=0;e<o.length;e++){let r=o[e];for(;" "===r.charAt(0);)r=r.substring(1,r.length);if(0===r.indexOf(t))return r.substring(t.length,r.length)}return null}deleteCookie(e){document.cookie=`${e}=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;`}deleteDeclinedCookies(e){const t=window.surecookiePublicSettings?.custom_cookies;if(!t)return;const o=Array.isArray(t)?t:Object.values(t);Object.keys(e).forEach(t=>{e[t]||"essential"===t||o.filter(e=>e.category===t).forEach(e=>{this.deleteCookie(e.name)})})}getConsentSummary(){if(!this.consentData)return"No consent given";const{action:e,timestamp:t,preferences:o}=this.consentData;return{action:e,timestamp:t,allowed:Object.keys(o).filter(e=>o[e]),preferences:o}}determineAction(e,t){if("accepted"===t||"declined"===t||"partially_accepted"===t||"custom"===t)return t;const o=Object.values(e);if(o.every(e=>!0===e))return"accepted";const r=o.every(e=>!1===e),n=Object.keys(e).every(t=>"essential"===t?!0===e[t]:!1===e[t]);return r||n?"declined":"partially_accepted"}initOnLoad(){this.applyConsent();const e=this.getConsent();if(e&&(this.updateGoogleConsent(e.preferences),this.updateWpConsentApi(e.preferences)),this.hasGlobalPrivacyControl()){const e={essential:!0,functional:!1,analytics:!1,marketing:!1};this.updateGoogleConsent(e),this.updateWpConsentApi(e)}this.startDynamicObserver()}},document.addEventListener("click",e=>{const t=e.target;if(!t||"function"!=typeof t.closest)return;const o=t.closest(".surecookie-placeholder-button");if(!o)return;const r=o.getAttribute("data-surecookie-category");r&&window.surecookieManager.acceptCategoryFromPlaceholder(r)}),window.addEventListener("surecookie_applied",()=>{window.surecookieManager.restorePrestoPlaceholders(),window.surecookieManager.restoreElementorVideos()}),"loading"===document.readyState?document.addEventListener("DOMContentLoaded",()=>{window.surecookieManager.initOnLoad()}):window.surecookieManager.initOnLoad());const U="surecookie-public-root",z=()=>{let t=document.getElementById(U);t||(t=document.createElement("div"),t.id=U,document.body.appendChild(t)),(0,e.createRoot)(t).render((0,o.jsx)(T,{}))};"loading"===document.readyState?document.addEventListener("DOMContentLoaded",z):z()})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.