@customviews-js/customviews 1.1.11 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  /*!
2
- * @customviews-js/customviews v1.1.11
2
+ * @customviews-js/customviews v1.2.0
3
3
  * (c) 2025 Chan Ger Teck
4
4
  * Released under the MIT License.
5
5
  */
6
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).CustomViews={})}(this,function(e){"use strict";class t{static STORAGE_KEYS={STATE:"customviews-state",TAB_NAV_VISIBILITY:"cv-tab-navs-visible"};isStorageAvailable(){return"undefined"!=typeof window&&void 0!==window.localStorage}persistState(e){if(this.isStorageAvailable())try{localStorage.setItem(t.STORAGE_KEYS.STATE,JSON.stringify(e))}catch(e){console.warn("Failed to persist state:",e)}}getPersistedState(){if(!this.isStorageAvailable())return null;try{const e=localStorage.getItem(t.STORAGE_KEYS.STATE);return e?JSON.parse(e):null}catch(e){return console.warn("Failed to parse persisted state:",e),null}}clearAll(){this.isStorageAvailable()&&(localStorage.removeItem(t.STORAGE_KEYS.STATE),localStorage.removeItem(t.STORAGE_KEYS.TAB_NAV_VISIBILITY))}persistTabNavVisibility(e){if(this.isStorageAvailable())try{localStorage.setItem(t.STORAGE_KEYS.TAB_NAV_VISIBILITY,e?"true":"false")}catch(e){console.warn("Failed to persist tab nav visibility:",e)}}getPersistedTabNavVisibility(){if(!this.isStorageAvailable())return null;try{const e=localStorage.getItem(t.STORAGE_KEYS.TAB_NAV_VISIBILITY);return null===e?null:"true"===e}catch(e){return console.warn("Failed to get persisted tab nav visibility:",e),null}}hasPersistedData(){return!!this.isStorageAvailable()&&!!this.getPersistedState()}}class n{static parseURL(){const e=new URLSearchParams(window.location.search).get("view");let t=null;if(e)try{t=this.decodeState(e)}catch(e){console.warn("Failed to decode view state from URL:",e)}return t}static updateURL(e){if("undefined"==typeof window||!window.history)return;const t=new URL(window.location.href);if(t.searchParams.delete("view"),e){const n=this.encodeState(e);n&&t.searchParams.set("view",n)}const n=t.pathname+(t.search||"")+(t.hash||"");window.history.replaceState({},"",n)}static clearURL(){this.updateURL(null)}static generateShareableURL(e){const t=new URL(window.location.href);if(t.searchParams.delete("view"),e){const n=this.encodeState(e);n&&t.searchParams.set("view",n)}return t.toString()}static encodeState(e){try{const t={};e.toggles&&e.toggles.length>0&&(t.t=e.toggles),e.tabs&&Object.keys(e.tabs).length>0&&(t.g=Object.entries(e.tabs));const n=JSON.stringify(t);let o;o="function"==typeof btoa?btoa(n):Buffer.from(n,"utf-8").toString("base64");return o.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}catch(e){return console.warn("Failed to encode state:",e),null}}static decodeState(e){try{let t,n=e.replace(/-/g,"+").replace(/_/g,"/");for(;n.length%4;)n+="=";t="function"==typeof atob?atob(n):Buffer.from(n,"base64").toString("utf-8");const o=JSON.parse(t);if(!o||"object"!=typeof o)throw new Error("Invalid compact state structure");const r={toggles:Array.isArray(o.t)?o.t:[]};if(Array.isArray(o.g)){r.tabs={};for(const[e,t]of o.g)"string"==typeof e&&"string"==typeof t&&(r.tabs[e]=t)}return r}catch(e){return console.warn("Failed to decode view state:",e),null}}}class o{hiddenToggles=new Set;setToggleVisibility(e,t){const n=this.hiddenToggles.has(e),o=!t;return o&&!n?(this.hiddenToggles.add(e),!0):!(o||!n)&&(this.hiddenToggles.delete(e),!0)}hideAll(e){for(const t of e)this.setToggleVisibility(t,!1)}showAll(e){for(const t of e)this.setToggleVisibility(t,!0)}getHiddenToggles(){return Array.from(this.hiddenToggles)}filterVisibleToggles(e){return e.filter(e=>!this.hiddenToggles.has(e))}applyElementVisibility(e,t){t?(e.classList.remove("cv-hidden"),e.classList.add("cv-visible")):(e.classList.add("cv-hidden"),e.classList.remove("cv-visible"))}}const r="cv-tabgroup",i="cv-tab",s="cv-tabs-nav",a="cv-hide-tab-navs",c="cv-tabs-nav-hidden";class l{static splitTabIds(e){return e.split(/[\s|]+/).filter(e=>""!==e.trim()).map(e=>e.trim())}static applyTabSelections(e,t,n){e.querySelectorAll(r).forEach(e=>{const o=e.getAttribute("id");let r;if(o)r=this.resolveActiveTabForGroup(o,t,n,e);else{const t=Array.from(e.children).filter(e=>e.tagName.toLowerCase()===i)[0];if(t){const e=t.getAttribute("id")||t.getAttribute("data-cv-internal-id")||"",n=this.splitTabIds(e);r=n[0]||null}else r=null}Array.from(e.children).filter(e=>e.tagName.toLowerCase()===i).forEach(e=>{const t=e.getAttribute("id")||e.getAttribute("data-cv-internal-id");if(!t)return;const n=this.splitTabIds(t).includes(r||"");this.applyTabVisibility(e,n)})})}static resolveActiveTabForGroup(e,t,n,o){if(t[e])return t[e];if(n){const t=n.find(t=>t.id===e);if(t){const e=t.tabs[0];if(e)return e.id}}const r=Array.from(o.children).find(e=>e.tagName.toLowerCase()===i);if(r){const e=r.getAttribute("id")||r.getAttribute("data-cv-internal-id")||"";return this.splitTabIds(e)[0]||null}return null}static applyTabVisibility(e,t){t?(e.classList.remove("cv-hidden"),e.classList.add("cv-visible")):(e.classList.add("cv-hidden"),e.classList.remove("cv-visible"))}static extractTabContent(e){let t=e.querySelector(":scope > cv-tab-header");if(!t)return null;return{headerHTML:t.innerHTML.trim(),bodyEl:e.querySelector(":scope > cv-tab-body")}}static buildNavs(e,t,n,o){e.querySelectorAll('cv-tabgroup[nav="auto"], cv-tabgroup:not([nav])').forEach(r=>{const l=r.getAttribute("id")||null;let d=r.querySelector(`.${s}`);if(d)return;const g=Array.from(r.children).filter(e=>e.tagName.toLowerCase()===i);if(0===g.length)return;d=document.createElement("ul"),d.className=`${s} nav-tabs`,d.setAttribute("role","tablist");!e.classList.contains(a)?d.setAttribute("aria-hidden","false"):(d.classList.add(c),d.setAttribute("aria-hidden","true")),r.insertBefore(d,r.firstChild),g.forEach((e,i)=>{let s=e.getAttribute("id");s||(s=`${l}-tab-${i}`,e.setAttribute("data-cv-internal-id",s));const a=this.splitTabIds(s),c=a[0]||s,g=this.extractTabContent(e);let h="";if(g&&g.headerHTML)h=g.headerHTML;else{const n=e.getAttribute("header")||"";if(n)h=n;else{const n=l?this.getTabLabel(c,l,t):null;h=n||(e.getAttribute("id")?c:`Tab ${i+1}`)}}const u=document.createElement("li");u.className="nav-item";const p=document.createElement("a");p.className="nav-link",p.href="#",p.setAttribute("data-tab-id",c),p.setAttribute("data-raw-tab-id",s),l&&p.setAttribute("data-group-id",l),p.setAttribute("role","tab");const v=document.createElement("span");v.className="cv-tab-header-container";const b=document.createElement("span");b.className="cv-tab-header-text",b.innerHTML=h;const m=document.createElement("span");m.className="cv-tab-pin-icon",m.innerHTML=function(e=!1){return`\n <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" opacity="${e?"1":"0.6"}" xmlns="http://www.w3.org/2000/svg">\n <g transform="rotate(45 8 8)">\n <path d="M10.5 2H12V0H4V2H5.5V6L4 7.5V9H7.2V15H8.8V9H12V7.5L10.5 6V2Z"/>\n </g>\n </svg>\n `.trim()}(!0),m.style.display="none",v.appendChild(b),v.appendChild(m),p.appendChild(v);const w=l?this.resolveActiveTabForGroup(l,{},t,r):0===i?c:null;a.includes(w||"")?(p.classList.add("active"),p.setAttribute("aria-selected","true")):p.setAttribute("aria-selected","false"),n&&p.addEventListener("click",e=>{e.preventDefault(),n(l||"",c,r)}),o&&l&&p.addEventListener("dblclick",e=>{e.preventDefault(),o(l,c,r)}),p.setAttribute("title","Double click to change switch tabs across all groups"),u.appendChild(p),d.appendChild(u)});const h=document.createElement("div");h.className="cv-tabgroup-bottom-border",r.appendChild(h)})}static setNavsVisibility(e,t){t?e.classList.remove(a):e.classList.add(a);e.querySelectorAll(`.${s}`).forEach(e=>{t?(e.classList.remove(c),e.setAttribute("aria-hidden","false")):(e.classList.add(c),e.setAttribute("aria-hidden","true"))});e.querySelectorAll(".cv-tabgroup-bottom-border").forEach(e=>{t?e.classList.remove("cv-hidden"):e.classList.add("cv-hidden")})}static areNavsVisible(e){return!e.classList.contains(a)}static getTabLabel(e,t,n){if(!n)return null;const o=n.find(e=>e.id===t);if(!o)return null;const r=o.tabs.find(t=>t.id===e);return r?.label||null}static updateNavActiveState(e,t){e.querySelectorAll(".nav-link").forEach(e=>{const n=e.getAttribute("data-raw-tab-id");if(!n)return;this.splitTabIds(n).includes(t)?(e.classList.add("active"),e.setAttribute("aria-selected","true")):(e.classList.remove("active"),e.setAttribute("aria-selected","false"))})}static updateAllNavActiveStates(e,t,n){e.querySelectorAll(r).forEach(e=>{const o=e.getAttribute("id");if(!o)return;const r=this.resolveActiveTabForGroup(o,t,n,e);if(!r)return;e.querySelectorAll(".nav-link").forEach(e=>{const t=e.getAttribute("data-raw-tab-id");if(!t)return;this.splitTabIds(t).includes(r)?(e.classList.add("active"),e.setAttribute("aria-selected","true")):(e.classList.remove("active"),e.setAttribute("aria-selected","false"))})})}static applyTabLocalOnly(e,t){Array.from(e.children).filter(e=>e.tagName.toLowerCase()===i).forEach(e=>{const n=e.getAttribute("id")||e.getAttribute("data-cv-internal-id");if(!n)return;const o=this.splitTabIds(n).includes(t);this.applyTabVisibility(e,o)})}static groupHasTab(e,t){return Array.from(e.children).filter(e=>e.tagName.toLowerCase()===i).some(e=>{const n=e.getAttribute("id")||e.getAttribute("data-cv-internal-id")||"";return this.splitTabIds(n).includes(t)})}static getTabgroupsWithId(e,t,n){const o=[];return Array.from(e.querySelectorAll(`${r}[id="${t}"]`)).forEach(e=>{this.groupHasTab(e,n)&&o.push(e)}),o}static updatePinIcons(e,t){e.querySelectorAll(r).forEach(e=>{const n=e.getAttribute("id");if(!n)return;const o=t[n];e.querySelectorAll(".nav-link").forEach(e=>{const t=e.getAttribute("data-raw-tab-id"),n=e.querySelector(".cv-tab-pin-icon");if(!n||!t)return;const r=this.splitTabIds(t),i=o&&r.includes(o);n.style.display=i?"inline-block":"none"})})}}class d{assets;baseURL;constructor(e,t=""){this.assets=e,this.baseURL=t,this.validate()||console.warn("Invalid assets:",this.assets)}validate(){return Object.values(this.assets).every(e=>e.src||e.content)}get(e){const t=this.assets[e];if(t)return this.baseURL&&t.src?{...t,src:this.prependBaseURL(t.src)}:t}prependBaseURL(e){if(e.startsWith("http://")||e.startsWith("https://"))return e;return(this.baseURL.endsWith("/")?this.baseURL.slice(0,-1):this.baseURL)+(e.startsWith("/")?e:"/"+e)}loadFromJSON(e){this.assets=e}loadAdditionalAssets(e){this.assets={...this.assets,...e}}}function g(e,t,n){const o=n.get(t);if(!o)return;const r=o.type||function(e){return e.src?"image":e.content&&/<[^>]+>/.test(e.content)?"html":"text"}(o);switch(r){case"image":!function(e,t){if(!t.src)return;e.innerHTML="";const n=document.createElement("img");n.src=t.src,n.alt=t.alt||"",t.className&&(n.className=t.className),t.style&&n.setAttribute("style",t.style),n.style.maxWidth=n.style.maxWidth||"100%",n.style.height=n.style.height||"auto",n.style.display=n.style.display||"block",e.appendChild(n)}(e,o);break;case"text":!function(e,t){null!=t.content&&(e.textContent=t.content),t.className&&(e.className=t.className),t.style&&e.setAttribute("style",t.style)}(e,o);break;case"html":!function(e,t){null!=t.content&&(e.innerHTML=t.content),t.className&&(e.className=t.className),t.style&&e.setAttribute("style",t.style)}(e,o);break;default:e.innerHTML=o.content||String(o),console.warn("[CustomViews] Unknown asset type:",r)}}const h="[data-cv-toggle], [data-customviews-toggle], cv-toggle";class u{static applyToggles(e,t){e.querySelectorAll(h).forEach(e=>{const n=this.getToggleCategories(e).some(e=>t.includes(e));this.applyToggleVisibility(e,n)})}static renderAssets(e,t,n){e.querySelectorAll(h).forEach(e=>{const o=this.getToggleCategories(e),r=this.getToggleId(e);r&&o.some(e=>t.includes(e))&&g(e,r,n)})}static getToggleCategories(e){if("cv-toggle"===e.tagName.toLowerCase()){return(e.getAttribute("category")||"").split(/\s+/).filter(Boolean)}return(e.dataset.cvToggle||e.dataset.customviewsToggle||"").split(/\s+/).filter(Boolean)}static getToggleId(e){return e.dataset.cvId||e.dataset.customviewsId||e.getAttribute("data-cv-id")||e.getAttribute("data-customviews-id")||void 0}static applyToggleVisibility(e,t){t?(e.classList.remove("cv-hidden"),e.classList.add("cv-visible")):(e.classList.add("cv-hidden"),e.classList.remove("cv-visible"))}}class p{static findHighestVisibleTabGroup(){let e=0;const t=document.querySelector("header");let n=!1;if(t){const o=window.getComputedStyle(t);n=["fixed","sticky"].includes(o.position),n&&(e=t.getBoundingClientRect().height)}const o=e,r=Array.from(document.querySelectorAll("cv-tabgroup")).filter(e=>!n||!t||e.closest("header")!==t);let i=null,s=1/0;for(const e of r){const t=e.getBoundingClientRect();t.bottom>o&&t.top<window.innerHeight&&t.top<s&&(i=e,s=t.top)}return i}static scrollToTabGroup(e){let t=0;const n=document.querySelector("header");if(n){const e=window.getComputedStyle(n);["fixed","sticky"].includes(e.position)&&(t=n.getBoundingClientRect().height)}const o=e.getBoundingClientRect().top+window.scrollY-t-20;window.scrollTo({top:o,behavior:"smooth"})}static handleScrollAnchor(e){requestAnimationFrame(()=>{const{element:t,top:n}=e,o=t.getBoundingClientRect().top-n;Math.abs(o)>1&&window.scrollBy({top:o,behavior:"instant"})})}}class v{rootEl;assetsManager;persistenceManager;visibilityManager;config;stateChangeListeners=[];showUrlEnabled;lastAppliedState=null;constructor(e){this.assetsManager=e.assetsManager,this.config=e.config,this.rootEl=e.rootEl||document.body,this.persistenceManager=new t,this.visibilityManager=new o,this.showUrlEnabled=e.showUrl??!1,this.lastAppliedState=this.cloneState(this.getComputedDefaultState())}getConfig(){return this.config}getTabGroups(){return this.config.tabGroups}getComputedDefaultState(){const e=this.config?.defaultState;if(void 0!==e)return e;const t={};this.config.tabGroups?.length&&this.config.tabGroups.forEach(e=>{if(e.tabs&&e.tabs.length>0){const n=e.tabs[0];n?.id&&(t[e.id]=n.id)}});return{toggles:[...this.config.allToggles||[]],tabs:t}}getCurrentActiveTabs(){if(this.lastAppliedState?.tabs)return{...this.lastAppliedState.tabs};const e=this.persistenceManager.getPersistedState();return e?.tabs?{...e.tabs}:this.getComputedDefaultState().tabs||{}}setActiveTab(e,t,n){if(n){l.applyTabLocalOnly(n,t),l.updateNavActiveState(n,t);const o=new CustomEvent("customviews:tab-change",{detail:{groupId:e,tabId:t,synced:!1},bubbles:!0});document.dispatchEvent(o)}}async init(){!function(){if("undefined"==typeof document)return;if(document.querySelector("#cv-core-styles"))return;const e=document.createElement("style");e.id="cv-core-styles",e.textContent="\n\n/* Core toggle visibility transitions */\n[data-cv-toggle], [data-customviews-toggle], cv-toggle {\n transition: opacity 150ms ease,\n transform 150ms ease,\n max-height 200ms ease,\n margin 150ms ease;\n will-change: opacity, transform, max-height, margin;\n}\n\n.cv-visible {\n opacity: 1 !important;\n transform: translateY(0) !important;\n max-height: var(--cv-max-height, 9999px) !important;\n}\n\n.cv-hidden {\n opacity: 0 !important;\n transform: translateY(-4px) !important;\n pointer-events: none !important;\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n border-top-width: 0 !important;\n border-bottom-width: 0 !important;\n max-height: 0 !important;\n margin-top: 0 !important;\n margin-bottom: 0 !important;\n overflow: hidden !important;\n}\n\n\n\n/* Tab navigation styles - Bootstrap-style tabs matching MarkBind */\n.cv-tabs-nav {\n display: flex;\n flex-wrap: wrap;\n padding-left: 0;\n margin-top: 0.5rem;\n margin-bottom: 1rem;\n list-style: none;\n border-bottom: 1px solid #dee2e6;\n\n align-items: stretch;\n}\n\n.cv-tabs-nav .nav-item {\n margin-bottom: -1px;\n list-style: none;\n display: flex; /* was inline-block → make flex to stretch height */\n align-items: stretch; /* stretch link to full height */\n}\n\n.cv-tabs-nav .nav-link {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0.5rem 1rem;\n color: #495057;\n text-decoration: none;\n background-color: transparent;\n border: 1px solid transparent;\n border-top-left-radius: 0.25rem;\n border-top-right-radius: 0.25rem;\n transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;\n cursor: pointer;\n min-height: 2.5rem;\n box-sizing: border-box;\n}\n\n.cv-tabs-nav .nav-link p {\n margin: 0; /* remove default margins */\n display: inline; /* or inline-block */\n}\n\n/* Tab header container with pin icon */\n.cv-tab-header-container {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n.cv-tab-header-text {\n flex: 1;\n}\n\n.cv-tab-pin-icon {\n display: inline-block;\n line-height: 0;\n flex-shrink: 0;\n}\n\n.cv-tab-pin-icon svg {\n vertical-align: middle;\n width: 14px;\n height: 14px;\n}\n\n.cv-tabs-nav .nav-link:hover,\n.cv-tabs-nav .nav-link:focus {\n border-color: #e9ecef #e9ecef #dee2e6;\n isolation: isolate;\n}\n\n.cv-tabs-nav .nav-link.active {\n color: #495057;\n background-color: #fff;\n border-color: #dee2e6 #dee2e6 #fff;\n}\n\n.cv-tabs-nav .nav-link:focus {\n outline: 0;\n box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);\n}\n\n/* Legacy button-based nav (deprecated, kept for compatibility) */\n.cv-tabs-nav-item {\n background: none;\n border: none;\n border-bottom: 2px solid transparent;\n padding: 0.5rem 1rem;\n cursor: pointer;\n font-size: 1rem;\n color: #6c757d;\n transition: color 150ms ease, border-color 150ms ease;\n}\n\n.cv-tabs-nav-item:hover {\n color: #495057;\n border-bottom-color: #dee2e6;\n}\n\n.cv-tabs-nav-item.active {\n color: #007bff;\n border-bottom-color: #007bff;\n font-weight: 500;\n}\n\n.cv-tabs-nav-item:focus {\n outline: 2px solid #007bff;\n outline-offset: 2px;\n}\n\n/* Tab panel base styles */\ncv-tab {\n display: block;\n}\n\n/* Hide cv-tab-header source element; content is extracted to nav link */\ncv-tab-header {\n display: none !important;\n}\n\n/* Allow cv-tab-body to flow naturally */\ncv-tab-body {\n display: block;\n}\n\n/* Override visibility for tab panels - use display instead of collapse animation */\ncv-tab.cv-hidden {\n display: none !important;\n}\n\ncv-tab.cv-visible {\n display: block !important;\n}\n\ncv-tabgroup {\n display: block;\n margin-bottom: 1.5rem;\n}\n\n/* Bottom border line for tab groups */\n.cv-tabgroup-bottom-border {\n border-bottom: 1px solid #dee2e6;\n margin-top: 1rem;\n}\n\n/* Tab content wrapper */\n.cv-tab-content {\n padding: 1rem 0;\n}\n\n/* Viewer-controlled nav visibility: hide nav containers when requested */\n.cv-tabs-nav-hidden {\n display: none !important;\n}\n\n/* Print-friendly: hide tab navigation when printing to reduce clutter */\n@media print {\n .cv-tabs-nav {\n display: none !important;\n }\n}\n\n",document.head.appendChild(e)}(),l.buildNavs(this.rootEl,this.config.tabGroups,(e,t,n)=>{this.setActiveTab(e,t,n)},(e,t,n)=>{const o=n.querySelector(".cv-tabs-nav"),r=o instanceof HTMLElement?o:n,i=r.getBoundingClientRect().top,s=this.getCurrentActiveTabs();s[e]=t;const a={toggles:this.getCurrentActiveToggles(),tabs:s};this.applyState(a,{scrollAnchor:{element:r,top:i}})});const e=this.persistenceManager.getPersistedTabNavVisibility();null!==e&&l.setNavsVisibility(this.rootEl,e),window.addEventListener("popstate",()=>{this.loadAndCallApplyState()}),this.loadAndCallApplyState()}async loadAndCallApplyState(){const e=n.parseURL();if(e)return void this.applyState(e);const t=this.persistenceManager.getPersistedState();t?this.applyState(t):this.renderState(this.getComputedDefaultState())}applyState(e,t){let o=null;"widget"===t?.source&&(o=p.findHighestVisibleTabGroup());const r=this.cloneState(e);this.renderState(r),this.persistenceManager.persistState(r),this.showUrlEnabled?n.updateURL(r):n.clearURL(),o&&queueMicrotask(()=>{p.scrollToTabGroup(o)}),t?.scrollAnchor&&p.handleScrollAnchor(t.scrollAnchor)}renderState(e){this.lastAppliedState=this.cloneState(e);const t=e?.toggles||[],n=this.visibilityManager.filterVisibleToggles(t);u.applyToggles(this.rootEl,n),u.renderAssets(this.rootEl,n,this.assetsManager),l.applyTabSelections(this.rootEl,e.tabs||{},this.config.tabGroups),l.updateAllNavActiveStates(this.rootEl,e.tabs||{},this.config.tabGroups),l.updatePinIcons(this.rootEl,e.tabs||{}),this.notifyStateChangeListeners()}resetToDefault(){this.persistenceManager.clearAll(),this.config?this.renderState(this.getComputedDefaultState()):console.warn("No configuration loaded, cannot reset to default state"),l.setNavsVisibility(this.rootEl,!0),n.clearURL()}getCurrentActiveToggles(){return this.lastAppliedState?this.lastAppliedState.toggles||[]:this.config&&this.getComputedDefaultState().toggles||[]}clearPersistence(){this.persistenceManager.clearAll(),this.config?this.renderState(this.getComputedDefaultState()):console.warn("No configuration loaded, cannot reset to default state"),n.clearURL()}setOption(e,t){switch(e){case"showUrl":{const e=Boolean(t);if(this.showUrlEnabled===e)return;if(this.showUrlEnabled=e,e){const e=this.getTrackedStateSnapshot();n.updateURL(e)}else n.clearURL();break}default:console.warn(`[CustomViews] Unknown option '${e}' passed to setOption`)}}addStateChangeListener(e){this.stateChangeListeners.push(e)}removeStateChangeListener(e){const t=this.stateChangeListeners.indexOf(e);t>-1&&this.stateChangeListeners.splice(t,1)}notifyStateChangeListeners(){this.stateChangeListeners.forEach(e=>{try{e()}catch(e){console.warn("Error in state change listener:",e)}})}persistTabNavVisibility(e){this.persistenceManager.persistTabNavVisibility(e)}getPersistedTabNavVisibility(){return this.persistenceManager.getPersistedTabNavVisibility()}cloneState(e){return e?JSON.parse(JSON.stringify(e)):{}}getTrackedStateSnapshot(){return this.lastAppliedState?this.cloneState(this.lastAppliedState):this.config?this.cloneState(this.getComputedDefaultState()):{}}}function b(e,t){if(!t)return e;if(e.startsWith("http://")||e.startsWith("https://"))return e;return(t.endsWith("/")?t.slice(0,-1):t)+(e.startsWith("/")?e:"/"+e)}class m extends HTMLElement{connectedCallback(){}}class w extends HTMLElement{connectedCallback(){setTimeout(()=>{const e=new CustomEvent("cv:tabgroup-ready",{bubbles:!0,detail:{groupId:this.getAttribute("id")}});this.dispatchEvent(e)},0)}}class C extends HTMLElement{connectedCallback(){}}class f extends HTMLElement{connectedCallback(){}}class y extends HTMLElement{connectedCallback(){}}class k{static async init(e){let t;customElements.get("cv-tab")||customElements.define("cv-tab",m),customElements.get("cv-tabgroup")||customElements.define("cv-tabgroup",w),customElements.get("cv-toggle")||customElements.define("cv-toggle",C),customElements.get("cv-tab-header")||customElements.define("cv-tab-header",f),customElements.get("cv-tab-body")||customElements.define("cv-tab-body",y);const n=e.baseURL||"";if(e.assetsJsonPath){const o=b(e.assetsJsonPath,n);try{const e=await(await fetch(o)).json();t=new d(e,n)}catch(e){console.error(`[CustomViews] Failed to load assets JSON from ${o}:`,e),t=new d({},n)}}else t=new d({},n);let o;e.config?o=e.config:(console.error("No config provided, using minimal default config"),o={allToggles:[],defaultState:{}});const r={assetsManager:t,config:o,rootEl:e.rootEl};void 0!==e.showUrl&&(r.showUrl=e.showUrl);const i=new v(r);return i.init(),i}}class x{core;container;widgetIcon=null;options;modal=null;constructor(e){this.core=e.core,this.container=e.container||document.body,this.options={core:e.core,container:this.container,position:e.position||"middle-left",theme:e.theme||"light",showReset:e.showReset??!0,title:e.title||"Customize View",description:e.description||"",showWelcome:e.showWelcome??!1,welcomeTitle:e.welcomeTitle||"Site Customization",welcomeMessage:e.welcomeMessage||'This site is powered by Custom Views. Use the widget on the side (⚙) to customize your experience. Your preferences will be saved and can be shared via URL.<br><br>Learn more at <a href="https://github.com/customviews-js/customviews" target="_blank">customviews GitHub</a>.',showTabGroups:e.showTabGroups??!0}}render(){return this.widgetIcon=this.createWidgetIcon(),this.attachEventListeners(),document.body.appendChild(this.widgetIcon),this.options.showWelcome&&this.showWelcomeModalIfFirstVisit(),this.widgetIcon}createWidgetIcon(){const e=document.createElement("div");return e.className=`cv-widget-icon cv-widget-${this.options.position}`,e.innerHTML="⚙",e.title=this.options.title,e.setAttribute("aria-label","Open Custom Views"),function(){if(document.querySelector("#cv-widget-styles"))return;const e=document.createElement("style");e.id="cv-widget-styles",e.textContent="\n/* Rounded rectangle widget icon styles */\n.cv-widget-icon {\n position: fixed;\n /* Slightly transparent by default so the widget is subtle at the page edge */\n background: rgba(255, 255, 255, 0.92);\n color: rgba(0, 0, 0, 0.9);\n opacity: 0.6;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 18px;\n font-weight: bold;\n cursor: pointer;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n z-index: 9998;\n transition: all 0.3s ease;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n}\n\n.cv-widget-icon:hover {\n /* Become fully opaque on hover to improve readability */\n background: rgba(255, 255, 255, 1);\n color: rgba(0, 0, 0, 1);\n opacity: 1;\n}\n\n/* Top-right: rounded end on left, sticks out leftward on hover */\n.cv-widget-top-right {\n top: 20px;\n right: 0;\n border-radius: 18px 0 0 18px;\n padding-left: 8px;\n justify-content: flex-start;\n}\n\n/* Top-left: rounded end on right, sticks out rightward on hover */\n.cv-widget-top-left {\n top: 20px;\n left: 0;\n border-radius: 0 18px 18px 0;\n padding-right: 8px;\n justify-content: flex-end;\n}\n\n/* Bottom-right: rounded end on left, sticks out leftward on hover */\n.cv-widget-bottom-right {\n bottom: 20px;\n right: 0;\n border-radius: 18px 0 0 18px;\n padding-left: 8px;\n justify-content: flex-start;\n}\n\n/* Bottom-left: rounded end on right, sticks out rightward on hover */\n.cv-widget-bottom-left {\n bottom: 20px;\n left: 0;\n border-radius: 0 18px 18px 0;\n padding-right: 8px;\n justify-content: flex-end;\n}\n\n/* Middle-left: rounded end on right, sticks out rightward on hover */\n.cv-widget-middle-left {\n top: 50%;\n left: 0;\n transform: translateY(-50%);\n border-radius: 0 18px 18px 0;\n padding-right: 8px;\n justify-content: flex-end;\n}\n\n/* Middle-right: rounded end on left, sticks out leftward on hover */\n.cv-widget-middle-right {\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n border-radius: 18px 0 0 18px;\n padding-left: 8px;\n justify-content: flex-start;\n}\n\n.cv-widget-top-right,\n.cv-widget-middle-right,\n.cv-widget-bottom-right,\n.cv-widget-top-left,\n.cv-widget-middle-left,\n.cv-widget-bottom-left {\n height: 36px;\n width: 36px;\n}\n\n.cv-widget-middle-right:hover,\n.cv-widget-top-right:hover,\n.cv-widget-bottom-right:hover,\n.cv-widget-top-left:hover,\n.cv-widget-middle-left:hover,\n.cv-widget-bottom-left:hover {\n width: 55px;\n}\n\n/* Modal content styles */\n.cv-widget-section {\n margin-bottom: 16px;\n}\n\n.cv-widget-section:last-child {\n margin-bottom: 0;\n}\n\n.cv-widget-section label {\n display: block;\n margin-bottom: 4px;\n font-weight: 500;\n color: #555;\n}\n\n.cv-widget-profile-select,\n.cv-widget-state-select {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid #ddd;\n border-radius: 4px;\n background: white;\n font-size: 14px;\n}\n\n.cv-widget-profile-select:focus,\n.cv-widget-state-select:focus {\n outline: none;\n border-color: #007bff;\n box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);\n}\n\n.cv-widget-profile-select:disabled,\n.cv-widget-state-select:disabled {\n background: #f8f9fa;\n color: #6c757d;\n cursor: not-allowed;\n}\n\n.cv-widget-current {\n margin: 16px 0;\n padding: 12px;\n background: #f8f9fa;\n border-radius: 4px;\n border-left: 4px solid #007bff;\n}\n\n.cv-widget-current label {\n font-size: 12px;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n color: #666;\n margin-bottom: 4px;\n}\n\n.cv-widget-current-view {\n font-weight: 500;\n color: #333;\n}\n\n.cv-widget-reset {\n width: 100%;\n padding: 8px 16px;\n background: #dc3545;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 500;\n}\n\n.cv-widget-reset:hover {\n background: #c82333;\n}\n\n.cv-widget-reset:active {\n background: #bd2130;\n}\n\n/* Responsive design for mobile */\n@media (max-width: 768px) {\n .cv-widget-top-right,\n .cv-widget-top-left {\n top: 10px;\n }\n\n .cv-widget-bottom-right,\n .cv-widget-bottom-left {\n bottom: 10px;\n }\n\n /* All widgets stay flush with screen edges */\n .cv-widget-top-right,\n .cv-widget-bottom-right,\n .cv-widget-middle-right {\n right: 0;\n }\n\n .cv-widget-top-left,\n .cv-widget-bottom-left,\n .cv-widget-middle-left {\n left: 0;\n }\n\n /* Slightly smaller on mobile */\n .cv-widget-icon {\n width: 60px;\n height: 32px;\n }\n\n .cv-widget-icon:hover {\n width: 75px;\n }\n}\n\n/* Modal styles */\n.cv-widget-modal-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10002;\n animation: fadeIn 0.2s ease;\n}\n\n@keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n.cv-widget-modal {\n background: white;\n border-radius: 0.75rem;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n max-width: 32rem;\n width: 90vw;\n max-height: 80vh;\n animation: slideIn 0.2s ease;\n display: flex;\n flex-direction: column;\n}\n\n@keyframes slideIn {\n from { \n opacity: 0;\n transform: scale(0.9) translateY(-20px);\n }\n to { \n opacity: 1;\n transform: scale(1) translateY(0);\n }\n}\n\n.cv-modal-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.5rem 1rem;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n}\n\n.cv-modal-header-content {\n display: flex;\n align-items: center;\n gap: 0.75rem;\n}\n\n.cv-modal-icon {\n position: relative;\n width: 1rem;\n height: 1rem;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n}\n\n.cv-modal-icon-svg {\n width: 100%;\n height: 100%;\n opacity: 1;\n}\n\n.cv-modal-title {\n font-size: 1.125rem;\n font-weight: bold;\n color: rgba(0, 0, 0, 0.9);\n margin: 0;\n}\n\n.cv-modal-close {\n width: 2rem;\n height: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n background: transparent;\n border: none;\n color: rgba(0, 0, 0, 0.6);\n cursor: pointer;\n transition: all 0.2s ease;\n}\n\n.cv-modal-close:hover {\n background: rgba(62, 132, 244, 0.1);\n color: #3e84f4;\n}\n\n.cv-modal-close-icon {\n width: 1.25rem;\n height: 1.25rem;\n}\n\n.cv-modal-main {\n padding: 1rem;\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n overflow-y: auto;\n max-height: calc(80vh - 8rem);\n}\n\n.cv-modal-description {\n font-size: 0.875rem;\n color: rgba(0, 0, 0, 0.8);\n margin: 0;\n line-height: 1.4;\n}\n\n.cv-content-section,\n.cv-tab-groups-section {\n display: flex;\n flex-direction: column;\n gap: 0.75rem;\n}\n\n.cv-section-heading {\n font-size: 1rem;\n font-weight: bold;\n color: rgba(0, 0, 0, 0.9);\n margin: 0;\n}\n\n.cv-widget-modal-actions {\n margin-top: 20px;\n padding-top: 16px;\n border-top: 1px solid #e9ecef;\n}\n\n.cv-widget-restore {\n width: 100%;\n padding: 10px 16px;\n background: #28a745;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 500;\n}\n\n.cv-widget-restore:hover {\n background: #218838;\n}\n\n.cv-widget-create-state {\n width: 100%;\n padding: 10px 16px;\n background: #007bff;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 500;\n margin-bottom: 10px;\n}\n\n.cv-widget-create-state:hover {\n background: #0056b3;\n}\n\n.cv-widget-theme-dark .cv-widget-modal {\n background: #101722;\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-modal-header {\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-modal-title {\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-modal-close {\n color: rgba(255, 255, 255, 0.6);\n}\n\n.cv-widget-theme-dark .cv-modal-close:hover {\n background: rgba(62, 132, 244, 0.2);\n color: #3e84f4;\n}\n\n.cv-widget-theme-dark .cv-modal-description {\n color: rgba(255, 255, 255, 0.8);\n}\n\n.cv-widget-theme-dark .cv-section-heading {\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-toggles-container\n.cv-widget-theme-dark .cv-tabgroups-container {\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-toggle-card,\n.cv-widget-theme-dark .cv-tabgroup-card {\n background: #101722;\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-toggle-title,\n.cv-widget-theme-dark .cv-tabgroup-title {\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-toggle-description,\n.cv-widget-theme-dark .cv-tabgroup-description {\n color: rgba(255, 255, 255, 0.6);\n}\n\n.cv-widget-theme-dark .cv-toggle-slider {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.cv-widget-theme-dark .cv-tab-group-description {\n color: rgba(255, 255, 255, 0.8);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-select {\n background: #101722;\n border-color: rgba(255, 255, 255, 0.2);\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-modal-footer {\n border-color: rgba(255, 255, 255, 0.1);\n background: #101722;\n}\n\n.cv-widget-theme-dark .cv-reset-btn {\n color: #e2e8f0;\n background: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-reset-btn:hover {\n background: rgba(255, 255, 255, 0.2);\n}\n\n/* Custom state creator styles */\n.cv-custom-state-modal {\n max-width: 500px;\n}\n\n.cv-custom-state-form .cv-section-header {\n font-size: 16px;\n font-weight: 600;\n color: #333;\n border-bottom: 1px solid #e9ecef;\n padding-bottom: 5px;\n}\n\n.cv-custom-state-form p {\n font-size: 15px;\n line-height: 1.6;\n color: #555;\n margin-bottom: 24px;\n text-align: justify;\n}\n\n.cv-custom-state-section {\n margin-bottom: 16px;\n}\n\n.cv-custom-state-section label {\n display: block;\n margin-bottom: 4px;\n font-weight: 500;\n color: #555;\n}\n\n.cv-custom-state-input {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid #ddd;\n border-radius: 4px;\n background: white;\n font-size: 14px;\n}\n\n.cv-custom-state-input:focus {\n outline: none;\n border-color: #007bff;\n box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);\n}\n\n/* Toggles Container */\n.cv-toggles-container {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n border-radius: 0.5rem;\n border: 1px solid rgba(0, 0, 0, 0.1);\n overflow: hidden;\n}\n\n.cv-toggle-card,\n.cv-tabgroup-card {\n background: white;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n}\n\n.cv-toggle-card:last-child {\n border-bottom: none;\n}\n\n.cv-toggle-content {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.75rem;\n}\n\n.cv-toggle-title {\n font-weight: 500;\n font-size: 0.875rem;\n color: rgba(0, 0, 0, 0.9);\n margin: 0 0 0.125rem 0;\n}\n\n.cv-toggle-description {\n font-size: 0.75rem;\n color: rgba(0, 0, 0, 0.6);\n margin: 0;\n}\n\n.cv-toggle-label{\n position: relative;\n display: inline-block;\n width: 2.75rem;\n height: 1.5rem;\n cursor: pointer;\n}\n\n.cv-toggle-input {\n opacity: 0;\n width: 0;\n height: 0;\n}\n\n.cv-toggle-slider {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.2);\n border-radius: 9999px;\n transition: background-color 0.2s ease;\n}\n\n.cv-toggle-slider:before {\n position: absolute;\n content: \"\";\n height: 1rem;\n width: 1rem;\n left: 0.25rem;\n bottom: 0.25rem;\n background: white;\n border-radius: 50%;\n transition: transform 0.2s ease;\n}\n\n.cv-toggle-input:checked + .cv-toggle-slider {\n background: #3e84f4;\n}\n\n.cv-toggle-input:checked + .cv-toggle-slider:before {\n transform: translateX(1.25rem);\n}\n\n/* Dark theme toggle switch styles */\n.cv-widget-theme-dark .cv-toggle-switch {\n background: #4a5568;\n}\n\n.cv-widget-theme-dark .cv-toggle-switch:hover {\n background: #5a6578;\n}\n\n.cv-widget-theme-dark .cv-toggle-switch.cv-toggle-active {\n background: #63b3ed;\n}\n\n.cv-widget-theme-dark .cv-toggle-switch.cv-toggle-active:hover {\n background: #4299e1;\n}\n\n/* Tab Groups Container */\n.cv-tab-groups-list {\n display: flex;\n flex-direction: column;\n gap: 1px;\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-radius: 0.5rem;\n overflow: hidden;\n}\n\n/* Tab Group Card - Header (Navigation Headers toggle) */\n.cv-tabgroup-card.cv-tabgroup-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.75rem;\n border-bottom: 0px;\n}\n\n.cv-tabgroup-card.cv-tabgroup-header .cv-tabgroup-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n gap: 1rem;\n}\n\n/* Navigation toggle icon container */\n.cv-nav-toggle-container {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n.cv-nav-icon {\n width: 2rem;\n height: 2rem;\n color: rgba(0, 0, 0, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n transition: color 0.2s ease;\n}\n\n/* Logo box - centered grey box on its own row */\n.cv-tabgroup-logo-box {\n width: 3.5rem;\n height: 3.5rem;\n background: rgba(0, 0, 0, 0.08);\n border-radius: 0.5rem;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n margin-bottom: 0.5rem;\n}\n\n/* Title container for title alignment (without icon) */\n.cv-tabgroup-title-container {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n/* Hover state for icon - apply to the entire tabgroup-row */\n.cv-tabgroup-card.cv-tabgroup-header:hover .cv-nav-icon {\n color: #3e84f4;\n}\n\n.cv-widget-theme-dark .cv-nav-icon {\n color: rgba(255, 255, 255, 0.8);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-header:hover .cv-nav-icon {\n color: #60a5fa;\n}\n\n/* Tab Group Card - Items */\n.cv-tabgroup-card.cv-tabgroup-item {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem;\n background: white;\n border-bottom: 1px solid rgba(0, 0, 0, 0.05);\n}\n\n.cv-tabgroup-card.cv-tabgroup-item:last-child {\n border-bottom: none;\n}\n\n/* Tab Group Info */\n.cv-tabgroup-info {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n}\n\n.cv-tabgroup-title {\n font-weight: 500;\n font-size: 0.875rem;\n color: rgba(0, 0, 0, 0.9);\n margin: 0 0 0 0;\n}\n\n.cv-tabgroup-description {\n font-size: 0.75rem;\n color: rgba(0, 0, 0, 0.6);\n margin: 0;\n line-height: 1.3;\n}\n\n/* Tab Group Label (for select dropdowns) */\n.cv-tabgroup-label {\n font-size: 0.875rem;\n color: rgba(0, 0, 0, 0.8);\n margin: 0;\n line-height: 1.4;\n font-weight: 500;\n display: block;\n cursor: pointer;\n}\n\n/* Tab Group Select */\n.cv-tabgroup-select {\n width: 100%;\n border-radius: 0.5rem;\n background: white;\n border: 1px solid rgba(0, 0, 0, 0.15);\n color: rgba(0, 0, 0, 0.9);\n padding: 0.5rem 0.75rem;\n font-size: 0.875rem;\n cursor: pointer;\n transition: all 0.15s ease;\n font-family: inherit;\n}\n\n.cv-tabgroup-select:hover {\n border-color: rgba(0, 0, 0, 0.25);\n}\n\n.cv-tabgroup-select:focus {\n outline: none;\n border-color: #3e84f4;\n box-shadow: 0 0 0 2px rgba(62, 132, 244, 0.2);\n}\n\n/* Modern Toggle Switch */\n.cv-toggle-switch {\n position: relative;\n display: inline-flex;\n align-items: center;\n width: 44px;\n height: 24px;\n background: rgba(0, 0, 0, 0.1);\n border-radius: 9999px;\n padding: 2px;\n box-sizing: border-box;\n cursor: pointer;\n transition: background-color 0.2s ease;\n border: none;\n}\n\n.cv-toggle-switch input {\n display: none;\n}\n\n.cv-toggle-switch .cv-switch-bg {\n position: absolute;\n inset: 0;\n border-radius: 9999px;\n background: rgba(0, 0, 0, 0.1);\n transition: background-color 0.2s ease;\n pointer-events: none;\n}\n\n.cv-toggle-switch .cv-switch-knob {\n position: relative;\n width: 20px;\n height: 20px;\n background: white;\n border-radius: 50%;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);\n transition: transform 0.2s ease;\n z-index: 1;\n}\n\n.cv-toggle-switch input:checked + .cv-switch-bg {\n background: #3e84f4;\n}\n\n.cv-toggle-switch input:checked ~ .cv-switch-knob {\n transform: translateX(20px);\n}\n\n/* Dark Theme - Tab Groups */\n.cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-header {\n background: #101722;\n border-bottom-color: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-item {\n background: #101722;\n border-bottom-color: rgba(255, 255, 255, 0.05);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-title {\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-tabgroup-description {\n color: rgba(255, 255, 255, 0.6);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-label {\n color: rgba(255, 255, 255, 0.8);\n}\n\n.cv-widget-theme-dark .cv-tab-groups-list {\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-select {\n background: #101722;\n border-color: rgba(255, 255, 255, 0.15);\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-tabgroup-select:hover {\n border-color: rgba(255, 255, 255, 0.25);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-select:focus {\n border-color: #60a5fa;\n box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);\n}\n\n/* Dark Theme - Toggle Switch */\n.cv-widget-theme-dark .cv-toggle-switch .cv-switch-bg {\n background: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-toggle-switch .cv-switch-knob {\n background: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-toggle-switch input:checked + .cv-switch-bg {\n background: #63b3ed;\n}\n\n.cv-modal-footer {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0.75rem;\n border-top: 1px solid rgba(0, 0, 0, 0.1);\n}\n\n.cv-reset-btn,\n.cv-share-btn {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.375rem 0.75rem;\n border-radius: 0.5rem;\n font-weight: 600;\n font-size: 0.875rem;\n cursor: pointer;\n transition: all 0.2s ease;\n border: none;\n}\n\n.cv-reset-btn {\n color: rgba(0, 0, 0, 0.9);\n background: rgba(0, 0, 0, 0.1);\n}\n\n.cv-reset-btn:hover {\n background: rgba(0, 0, 0, 0.2);\n}\n\n.cv-share-btn {\n color: white;\n background: #3e84f4;\n}\n\n.cv-share-btn:hover {\n background: rgba(62, 132, 244, 0.9);\n}\n\n.cv-btn-icon {\n width: 1rem;\n height: 1rem;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n}\n\n/* Dark theme custom state styles */\n/* Welcome modal styles */\n.cv-welcome-modal {\n max-width: 32rem;\n width: 90vw;\n background: white;\n border-radius: 0.75rem;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n animation: slideIn 0.2s ease;\n display: flex;\n flex-direction: column;\n}\n\n.cv-modal-main {\n padding: 1rem;\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n overflow-y: auto;\n max-height: calc(80vh - 8rem);\n}\n\n.cv-welcome-message {\n font-size: 0.875rem;\n color: rgba(0, 0, 0, 0.8);\n margin: 0;\n line-height: 1.4;\n text-align: center;\n}\n\n.cv-welcome-message a {\n color: #3e84f4;\n text-align: justify;\n text-decoration: none;\n}\n\n.cv-welcome-message a:hover {\n text-decoration: underline;\n}\n\n.cv-welcome-widget-preview {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 1rem;\n padding: 1rem;\n background: #f8f9fa;\n border-radius: 0.5rem;\n margin: 1rem 0;\n}\n\n.cv-welcome-widget-icon {\n width: 2rem;\n height: 2rem;\n background: rgba(62, 132, 244, 0.1);\n border-radius: 9999px;\n display: flex;\n align-items: center;\n justify-content: center;\n animation: cv-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n color: #3e84f4;\n}\n\n.cv-welcome-widget-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: rgba(0, 0, 0, 0.8);\n margin: 0;\n}\n\n.cv-welcome-got-it {\n width: 100%;\n background: #3e84f4;\n color: white;\n font-weight: 600;\n padding: 0.75rem 1rem;\n border-radius: 0.5rem;\n border: none;\n cursor: pointer;\n font-size: 0.875rem;\n transition: background-color 0.2s ease;\n outline: none;\n}\n\n.cv-welcome-got-it:hover {\n background: rgba(62, 132, 244, 0.9);\n}\n\n.cv-welcome-got-it:focus {\n box-shadow: 0 0 0 2px rgba(62, 132, 244, 0.5);\n}\n\n/* Animations */\n@keyframes cv-pulse {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.5;\n }\n}\n\n/* Dark theme welcome modal styles */\n.cv-widget-theme-dark .cv-welcome-modal {\n background: #101722;\n}\n\n.cv-widget-theme-dark .cv-welcome-message {\n color: rgba(255, 255, 255, 0.8);\n}\n\n.cv-widget-theme-dark .cv-welcome-message a {\n color: #60a5fa;\n}\n\n.cv-widget-theme-dark .cv-welcome-widget-preview {\n background: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-welcome-widget-label {\n color: #e2e8f0;\n}\n\n/* Dark theme logo box */\n.cv-widget-theme-dark .cv-tabgroup-logo-box {\n background: rgba(255, 255, 255, 0.1);\n}\n\n/* Spinning animation for reset button icon */\n@keyframes cv-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(-360deg);\n }\n}\n\n.cv-spinning {\n animation: cv-spin 0.6s ease-in-out;\n}\n\n/* Hide widget icon in print view */\n@media print {\n .cv-widget-icon {\n display: none !important;\n }\n}\n",document.head.appendChild(e)}(),e}destroy(){this.widgetIcon&&(this.widgetIcon.remove(),this.widgetIcon=null),this.modal&&(this.modal.remove(),this.modal=null)}attachEventListeners(){this.widgetIcon&&this.widgetIcon.addEventListener("click",()=>this.openStateModal())}closeModal(){this.modal&&(this.modal.remove(),this.modal=null)}openStateModal(){const e=this.core.getConfig(),t=e?.allToggles||[];this.createCustomStateModal(t)}createCustomStateModal(e){this.closeModal(),this.modal=document.createElement("div"),this.modal.className="cv-widget-modal-overlay",this.applyThemeToModal();const t=e.map(e=>`\n <div class="cv-toggle-card">\n <div class="cv-toggle-content">\n <div>\n <p class="cv-toggle-title">${this.formatToggleName(e)}</p>\n </div>\n <label class="cv-toggle-label">\n <input class="cv-toggle-input" type="checkbox" data-toggle="${e}"/>\n <span class="cv-toggle-slider"></span>\n </label>\n </div>\n </div>\n `).join(""),n=this.core.getTabGroups();let o="";if(this.options.showTabGroups&&n&&n.length>0){const e=l.areNavsVisible(document.body);o=`\n <div class="cv-tabgroup-card cv-tabgroup-header">\n <div class="cv-tabgroup-row">\n <div class="cv-tabgroup-logo-box" id="cv-nav-icon-box">\n <div class="cv-nav-icon" id="cv-nav-icon">${e?'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62.0001" x2="77" y2="62.0001" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8888" x2="77" y2="77.8888" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4454" x2="221" y2="97.4454" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n <line x1="247.5" y1="43.0001" x2="247.5" y2="13.0001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M185 12.5001L247 12.5001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <line x1="204.09" y1="36.6095" x2="181.698" y2="10.0228" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M125 9.50012L181 9.50012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M144.305 35.2579L120.095 6.56679" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M120 6.50037L64 6.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M87.1957 36.1024L59 2.50008" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M59 2.50037L3 2.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M2.5 38.5001L2.5 3.00012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n </svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181" fill="currentColor">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62" x2="77" y2="62" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8887" x2="77" y2="77.8887" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4453" x2="221" y2="97.4453" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n </svg>'}</div>\n </div>\n <div class="cv-tabgroup-info">\n <div class="cv-tabgroup-title-container">\n <p class="cv-tabgroup-title">Navigation Headers</p>\n </div>\n <p class="cv-tabgroup-description">Show or hide navigation headers</p>\n </div>\n <label class="cv-toggle-switch cv-nav-toggle">\n <input class="cv-nav-pref-input" type="checkbox" ${e?"checked":""} aria-label="Show or hide navigation headers" />\n <span class="cv-switch-bg"></span>\n <span class="cv-switch-knob"></span>\n </label>\n </div>\n </div>\n <div class="cv-tab-groups-list">\n ${n.map(e=>`\n <div class="cv-tabgroup-card cv-tabgroup-item">\n <label class="cv-tabgroup-label" for="tab-group-${e.id}">\n ${e.label||e.id}\n </label>\n <select id="tab-group-${e.id}" class="cv-tabgroup-select" data-group-id="${e.id}">\n ${e.tabs.map(e=>`<option value="${e.id}">${e.label||e.id}</option>`).join("")}\n </select>\n </div>\n `).join("")}\n </div>\n `}this.modal.innerHTML=`\n <div class="cv-widget-modal cv-custom-state-modal">\n <header class="cv-modal-header">\n <div class="cv-modal-header-content">\n <div class="cv-modal-icon">\n <svg class="cv-modal-icon-svg" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M12 8.00002C9.79085 8.00002 7.99999 9.79088 7.99999 12C7.99999 14.2092 9.79085 16 12 16C14.2091 16 16 14.2092 16 12C16 9.79088 14.2091 8.00002 12 8.00002ZM9.99999 12C9.99999 10.8955 10.8954 10 12 10C13.1046 10 14 10.8955 14 12C14 13.1046 13.1046 14 12 14C10.8954 14 9.99999 13.1046 9.99999 12Z" fill="#0F1729"/>\n <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M10.7673 1.01709C10.9925 0.999829 11.2454 0.99993 11.4516 1.00001L12.5484 1.00001C12.7546 0.99993 13.0075 0.999829 13.2327 1.01709C13.4989 1.03749 13.8678 1.08936 14.2634 1.26937C14.7635 1.49689 15.1915 1.85736 15.5007 2.31147C15.7454 2.67075 15.8592 3.0255 15.9246 3.2843C15.9799 3.50334 16.0228 3.75249 16.0577 3.9557L16.1993 4.77635L16.2021 4.77788C16.2369 4.79712 16.2715 4.81659 16.306 4.8363L16.3086 4.83774L17.2455 4.49865C17.4356 4.42978 17.6693 4.34509 17.8835 4.28543C18.1371 4.2148 18.4954 4.13889 18.9216 4.17026C19.4614 4.20998 19.9803 4.39497 20.4235 4.70563C20.7734 4.95095 21.0029 5.23636 21.1546 5.4515C21.2829 5.63326 21.4103 5.84671 21.514 6.02029L22.0158 6.86003C22.1256 7.04345 22.2594 7.26713 22.3627 7.47527C22.4843 7.7203 22.6328 8.07474 22.6777 8.52067C22.7341 9.08222 22.6311 9.64831 22.3803 10.1539C22.1811 10.5554 21.9171 10.8347 21.7169 11.0212C21.5469 11.1795 21.3428 11.3417 21.1755 11.4746L20.5 12L21.1755 12.5254C21.3428 12.6584 21.5469 12.8205 21.7169 12.9789C21.9171 13.1653 22.1811 13.4446 22.3802 13.8461C22.631 14.3517 22.7341 14.9178 22.6776 15.4794C22.6328 15.9253 22.4842 16.2797 22.3626 16.5248C22.2593 16.7329 22.1255 16.9566 22.0158 17.14L21.5138 17.9799C21.4102 18.1535 21.2828 18.3668 21.1546 18.5485C21.0028 18.7637 20.7734 19.0491 20.4234 19.2944C19.9803 19.6051 19.4613 19.7901 18.9216 19.8298C18.4954 19.8612 18.1371 19.7852 17.8835 19.7146C17.6692 19.6549 17.4355 19.5703 17.2454 19.5014L16.3085 19.1623L16.306 19.1638C16.2715 19.1835 16.2369 19.2029 16.2021 19.2222L16.1993 19.2237L16.0577 20.0443C16.0228 20.2475 15.9799 20.4967 15.9246 20.7157C15.8592 20.9745 15.7454 21.3293 15.5007 21.6886C15.1915 22.1427 14.7635 22.5032 14.2634 22.7307C13.8678 22.9107 13.4989 22.9626 13.2327 22.983C13.0074 23.0002 12.7546 23.0001 12.5484 23H11.4516C11.2454 23.0001 10.9925 23.0002 10.7673 22.983C10.5011 22.9626 10.1322 22.9107 9.73655 22.7307C9.23648 22.5032 8.80849 22.1427 8.49926 21.6886C8.25461 21.3293 8.14077 20.9745 8.07542 20.7157C8.02011 20.4967 7.97723 20.2475 7.94225 20.0443L7.80068 19.2237L7.79791 19.2222C7.7631 19.2029 7.72845 19.1835 7.69396 19.1637L7.69142 19.1623L6.75458 19.5014C6.5645 19.5702 6.33078 19.6549 6.11651 19.7146C5.86288 19.7852 5.50463 19.8611 5.07841 19.8298C4.53866 19.7901 4.01971 19.6051 3.57654 19.2944C3.2266 19.0491 2.99714 18.7637 2.84539 18.5485C2.71718 18.3668 2.58974 18.1534 2.4861 17.9798L1.98418 17.14C1.87447 16.9566 1.74067 16.7329 1.63737 16.5248C1.51575 16.2797 1.36719 15.9253 1.32235 15.4794C1.26588 14.9178 1.36897 14.3517 1.61976 13.8461C1.81892 13.4446 2.08289 13.1653 2.28308 12.9789C2.45312 12.8205 2.65717 12.6584 2.82449 12.5254L3.47844 12.0054V11.9947L2.82445 11.4746C2.65712 11.3417 2.45308 11.1795 2.28304 11.0212C2.08285 10.8347 1.81888 10.5554 1.61972 10.1539C1.36893 9.64832 1.26584 9.08224 1.3223 8.52069C1.36714 8.07476 1.51571 7.72032 1.63732 7.47528C1.74062 7.26715 1.87443 7.04347 1.98414 6.86005L2.48605 6.02026C2.58969 5.84669 2.71714 5.63326 2.84534 5.45151C2.9971 5.23637 3.22655 4.95096 3.5765 4.70565C4.01966 4.39498 4.53862 4.20999 5.07837 4.17027C5.50458 4.1389 5.86284 4.21481 6.11646 4.28544C6.33072 4.34511 6.56444 4.4298 6.75451 4.49867L7.69141 4.83775L7.69394 4.8363C7.72844 4.8166 7.7631 4.79712 7.79791 4.77788L7.80068 4.77635L7.94225 3.95571C7.97723 3.7525 8.02011 3.50334 8.07542 3.2843C8.14077 3.0255 8.25461 2.67075 8.49926 2.31147C8.80849 1.85736 9.23648 1.49689 9.73655 1.26937C10.1322 1.08936 10.5011 1.03749 10.7673 1.01709ZM14.0938 4.3363C14.011 3.85634 13.9696 3.61637 13.8476 3.43717C13.7445 3.2858 13.6019 3.16564 13.4352 3.0898C13.2378 3.00002 12.9943 3.00002 12.5073 3.00002H11.4927C11.0057 3.00002 10.7621 3.00002 10.5648 3.0898C10.3981 3.16564 10.2555 3.2858 10.1524 3.43717C10.0304 3.61637 9.98895 3.85634 9.90615 4.3363L9.75012 5.24064C9.69445 5.56333 9.66662 5.72467 9.60765 5.84869C9.54975 5.97047 9.50241 6.03703 9.40636 6.13166C9.30853 6.22804 9.12753 6.3281 8.76554 6.52822C8.73884 6.54298 8.71227 6.55791 8.68582 6.57302C8.33956 6.77078 8.16643 6.86966 8.03785 6.90314C7.91158 6.93602 7.83293 6.94279 7.70289 6.93196C7.57049 6.92094 7.42216 6.86726 7.12551 6.7599L6.11194 6.39308C5.66271 6.2305 5.43809 6.14921 5.22515 6.16488C5.04524 6.17811 4.87225 6.23978 4.72453 6.34333C4.5497 6.46589 4.42715 6.67094 4.18206 7.08103L3.72269 7.84965C3.46394 8.2826 3.33456 8.49907 3.31227 8.72078C3.29345 8.90796 3.32781 9.09665 3.41141 9.26519C3.51042 9.4648 3.7078 9.62177 4.10256 9.9357L4.82745 10.5122C5.07927 10.7124 5.20518 10.8126 5.28411 10.9199C5.36944 11.036 5.40583 11.1114 5.44354 11.2504C5.47844 11.379 5.47844 11.586 5.47844 12C5.47844 12.414 5.47844 12.621 5.44354 12.7497C5.40582 12.8887 5.36944 12.9641 5.28413 13.0801C5.20518 13.1875 5.07927 13.2876 4.82743 13.4879L4.10261 14.0643C3.70785 14.3783 3.51047 14.5352 3.41145 14.7349C3.32785 14.9034 3.29349 15.0921 3.31231 15.2793C3.33461 15.501 3.46398 15.7174 3.72273 16.1504L4.1821 16.919C4.4272 17.3291 4.54974 17.5342 4.72457 17.6567C4.8723 17.7603 5.04528 17.8219 5.2252 17.8352C5.43813 17.8508 5.66275 17.7695 6.11199 17.607L7.12553 17.2402C7.42216 17.1328 7.5705 17.0791 7.7029 17.0681C7.83294 17.0573 7.91159 17.064 8.03786 17.0969C8.16644 17.1304 8.33956 17.2293 8.68582 17.427C8.71228 17.4421 8.73885 17.4571 8.76554 17.4718C9.12753 17.6719 9.30853 17.772 9.40635 17.8684C9.50241 17.963 9.54975 18.0296 9.60765 18.1514C9.66662 18.2754 9.69445 18.4367 9.75012 18.7594L9.90615 19.6637C9.98895 20.1437 10.0304 20.3837 10.1524 20.5629C10.2555 20.7142 10.3981 20.8344 10.5648 20.9102C10.7621 21 11.0057 21 11.4927 21H12.5073C12.9943 21 13.2378 21 13.4352 20.9102C13.6019 20.8344 13.7445 20.7142 13.8476 20.5629C13.9696 20.3837 14.011 20.1437 14.0938 19.6637L14.2499 18.7594C14.3055 18.4367 14.3334 18.2754 14.3923 18.1514C14.4502 18.0296 14.4976 17.963 14.5936 17.8684C14.6915 17.772 14.8725 17.6719 15.2344 17.4718C15.2611 17.4571 15.2877 17.4421 15.3141 17.427C15.6604 17.2293 15.8335 17.1304 15.9621 17.0969C16.0884 17.064 16.167 17.0573 16.2971 17.0681C16.4295 17.0791 16.5778 17.1328 16.8744 17.2402L17.888 17.607C18.3372 17.7696 18.5619 17.8509 18.7748 17.8352C18.9547 17.8219 19.1277 17.7603 19.2754 17.6567C19.4502 17.5342 19.5728 17.3291 19.8179 16.919L20.2773 16.1504C20.536 15.7175 20.6654 15.501 20.6877 15.2793C20.7065 15.0921 20.6721 14.9034 20.5885 14.7349C20.4895 14.5353 20.2921 14.3783 19.8974 14.0643L19.1726 13.4879C18.9207 13.2876 18.7948 13.1875 18.7159 13.0801C18.6306 12.9641 18.5942 12.8887 18.5564 12.7497C18.5215 12.6211 18.5215 12.414 18.5215 12C18.5215 11.586 18.5215 11.379 18.5564 11.2504C18.5942 11.1114 18.6306 11.036 18.7159 10.9199C18.7948 10.8126 18.9207 10.7124 19.1725 10.5122L19.8974 9.9357C20.2922 9.62176 20.4896 9.46479 20.5886 9.26517C20.6722 9.09664 20.7065 8.90795 20.6877 8.72076C20.6654 8.49906 20.5361 8.28259 20.2773 7.84964L19.8179 7.08102C19.5728 6.67093 19.4503 6.46588 19.2755 6.34332C19.1277 6.23977 18.9548 6.1781 18.7748 6.16486C18.5619 6.14919 18.3373 6.23048 17.888 6.39307L16.8745 6.75989C16.5778 6.86725 16.4295 6.92093 16.2971 6.93195C16.167 6.94278 16.0884 6.93601 15.9621 6.90313C15.8335 6.86965 15.6604 6.77077 15.3142 6.57302C15.2877 6.55791 15.2611 6.54298 15.2345 6.52822C14.8725 6.3281 14.6915 6.22804 14.5936 6.13166C14.4976 6.03703 14.4502 5.97047 14.3923 5.84869C14.3334 5.72467 14.3055 5.56332 14.2499 5.24064L14.0938 4.3363Z" fill="#0F1729"/>\n</svg>\n </div>\n <div class="cv-modal-title">${this.options.title}</div>\n </div>\n <button class="cv-modal-close" aria-label="Close modal">\n <svg class="cv-modal-close-icon" fill="currentColor" height="20px" viewBox="0 0 256 256" width="20px" xmlns="http://www.w3.org/2000/svg">\n <path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>\n </svg>\n </button>\n </header>\n <main class="cv-modal-main">\n ${this.options.description?`<p class="cv-modal-description">${this.options.description}</p>`:""}\n \n ${e.length?`\n <div class="cv-content-section">\n <div class="cv-section-heading">Toggles</div>\n <div class="cv-toggles-container">\n ${t}\n </div>\n </div>\n `:""}\n \n ${this.options.showTabGroups&&n&&n.length>0?`\n <div class="cv-content-section">\n <div class="cv-section-heading">Tab Groups</div>\n <div class="cv-tabgroups-container">\n ${o}\n </div>\n </div>\n `:""}\n </main>\n\n <footer class="cv-modal-footer">\n ${this.options.showReset?'\n <button class="cv-reset-btn">\n <span class="cv-reset-btn-icon"><svg class="cv-btn-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path d="M22.719 12A10.719 10.719 0 0 1 1.28 12h.838a9.916 9.916 0 1 0 1.373-5H8v1H2V2h1v4.2A10.71 10.71 0 0 1 22.719 12z"/><path fill="none" d="M0 0h24v24H0z"/>\n </svg></span>\n <span>Reset to Default</span>\n </button>\n ':""}\n <button class="cv-share-btn">\n <span>Copy Shareable URL</span>\n <span class="cv-share-btn-icon"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18" viewBox="0 0 18 18" version="1.1" fill="currentColor">\n <g id="surface1">\n <path d="M 11.273438 0 L 2.546875 0 C 1.746094 0 1.089844 0.613281 1.089844\n 1.363281 L 1.089844 10.910156 L 2.546875 10.910156 L 2.546875 1.363281 L 11.273438\n 1.363281 Z M 13.453125 2.726562 L 5.453125 2.726562 C 4.65625 2.726562 4 3.339844 4\n 4.089844 L 4 13.636719 C 4 14.386719 4.65625 15 5.453125 15 L 13.453125 15 C 14.253906\n 15 14.910156 14.386719 14.910156 13.636719 L 14.910156 4.089844 C 14.910156 3.339844\n 14.253906 2.726562 13.453125 2.726562 Z M 13.453125 13.636719 L 5.453125 13.636719 L\n 5.453125 4.089844 L 13.453125 4.089844 Z M 13.453125 13.636719 "></path>\n </g>\n </svg></span>\n </button>\n </footer>\n </div>\n `,document.body.appendChild(this.modal),this.attachStateModalEventListeners(),this.loadCurrentStateIntoForm()}attachStateModalEventListeners(){if(!this.modal)return;const e=this.modal.querySelector(".cv-modal-close");e&&e.addEventListener("click",()=>{this.closeModal()});const t=this.modal.querySelector(".cv-share-btn");t&&t.addEventListener("click",()=>{this.copyShareableURL();const e=t.querySelector(".cv-share-btn-icon");if(e){const t=e.innerHTML;e.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="2 2 22 22" fill="currentColor">\n <path d="M 19.28125 5.28125 L 9 15.5625 L 4.71875 11.28125 L 3.28125 12.71875 L 8.28125 17.71875 \n L 9 18.40625 L 9.71875 17.71875 L 20.71875 6.71875 Z"></path>\n </svg>',setTimeout(()=>{e.innerHTML=t},3e3)}});const n=this.modal.querySelector(".cv-reset-btn");n&&n.addEventListener("click",()=>{const e=n.querySelector(".cv-reset-btn-icon");e&&e.classList.add("cv-spinning"),this.core.resetToDefault(),this.loadCurrentStateIntoForm(),setTimeout(()=>{e&&e.classList.remove("cv-spinning")},600)});this.modal.querySelectorAll(".cv-toggle-input").forEach(e=>{e.addEventListener("change",()=>{const e=this.getCurrentCustomStateFromModal();this.core.applyState(e,{source:"widget"})})});this.modal.querySelectorAll(".cv-tabgroup-select").forEach(e=>{e.addEventListener("change",()=>{const t=e.dataset.groupId,n=e.value;if(t&&n){const e=this.core.getCurrentActiveTabs();e[t]=n;const o={toggles:this.core.getCurrentActiveToggles(),tabs:e};this.core.applyState(o,{source:"widget"})}})});const o=this.modal.querySelector(".cv-nav-pref-input"),r=this.modal?.querySelector("#cv-nav-icon"),i=this.modal?.querySelector(".cv-tabgroup-card.cv-tabgroup-header");if(o&&r&&i){const e=(e,t=!1)=>{r.innerHTML=t?'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62.0001" x2="77" y2="62.0001" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8888" x2="77" y2="77.8888" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4454" x2="221" y2="97.4454" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n <path d="M245 37.0001V39.5001H250V37.0001H247.5H245ZM250 13.0001C250 11.6194 248.881 10.5001 247.5 10.5001C246.119 10.5001 245 11.6194 245 13.0001H247.5H250ZM250 31.0001C250 29.6194 248.881 28.5001 247.5 28.5001C246.119 28.5001 245 29.6194 245 31.0001H247.5H250ZM245 19.0001C245 20.3808 246.119 21.5001 247.5 21.5001C248.881 21.5001 250 20.3808 250 19.0001H247.5H245ZM247.5 37.0001H250V31.0001H247.5H245V37.0001H247.5ZM247.5 19.0001H250V13.0001H247.5H245V19.0001H247.5Z" fill="currentColor"/>\n <line x1="204.09" y1="36.6095" x2="181.698" y2="10.0228" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M125 9.50012L181 9.50012" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M144.305 35.2579L120.095 6.56679" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M120 6.50037L64 6.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M87.1957 36.1024L59 2.50008" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M59 2.50037L3 2.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M2.5 38.5001L2.5 3.00012" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M185 12.5001L247 12.5001" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n </svg>':e?'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62.0001" x2="77" y2="62.0001" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8888" x2="77" y2="77.8888" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4454" x2="221" y2="97.4454" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n <line x1="247.5" y1="43.0001" x2="247.5" y2="13.0001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M185 12.5001L247 12.5001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <line x1="204.09" y1="36.6095" x2="181.698" y2="10.0228" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M125 9.50012L181 9.50012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M144.305 35.2579L120.095 6.56679" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M120 6.50037L64 6.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M87.1957 36.1024L59 2.50008" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M59 2.50037L3 2.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M2.5 38.5001L2.5 3.00012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n </svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181" fill="currentColor">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62" x2="77" y2="62" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8887" x2="77" y2="77.8887" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4453" x2="221" y2="97.4453" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n </svg>'};i.addEventListener("mouseenter",()=>{e(o.checked,!0)}),i.addEventListener("mouseleave",()=>{e(o.checked,!1)}),o.addEventListener("change",()=>{const t=o.checked;e(t,!1),this.core.persistTabNavVisibility(t);try{const e=document.body;l.setNavsVisibility(e,t)}catch(e){console.error("Failed to set tab nav visibility:",e)}})}this.modal.addEventListener("click",e=>{e.target===this.modal&&this.closeModal()});const s=e=>{"Escape"===e.key&&(this.closeModal(),document.removeEventListener("keydown",s))};document.addEventListener("keydown",s)}applyThemeToModal(){this.modal&&("dark"===this.options.theme?this.modal.classList.add("cv-widget-theme-dark"):this.modal.classList.remove("cv-widget-theme-dark"))}getCurrentCustomStateFromModal(){if(!this.modal)return{};const e=[];this.modal.querySelectorAll(".cv-toggle-input").forEach(t=>{const n=t.dataset.toggle;n&&t.checked&&e.push(n)});const t=this.modal.querySelectorAll(".cv-tabgroup-select"),n={};t.forEach(e=>{const t=e.dataset.groupId;t&&(n[t]=e.value)});const o={toggles:e};return Object.keys(n).length>0&&(o.tabs=n),o}copyShareableURL(){const e=this.getCurrentCustomStateFromModal(),t=n.generateShareableURL(e);navigator.clipboard.writeText(t).then(()=>{console.log("Shareable URL copied to clipboard!")}).catch(()=>{console.error("Failed to copy URL!")})}loadCurrentStateIntoForm(){if(!this.modal)return;const e=this.core.getCurrentActiveToggles();this.modal.querySelectorAll(".cv-toggle-input").forEach(e=>{e.checked=!1}),e.forEach(e=>{const t=this.modal?.querySelector(`[data-toggle="${e}"]`);t&&(t.checked=!0)});const t=this.core.getCurrentActiveTabs();this.modal.querySelectorAll(".cv-tabgroup-select").forEach(e=>{const n=e.dataset.groupId;n&&t[n]&&(e.value=t[n])});const n=(()=>{const e=this.core.getPersistedTabNavVisibility();return null!==e?e:l.areNavsVisible(document.body)})(),o=this.modal.querySelector(".cv-nav-pref-input"),r=this.modal?.querySelector("#cv-nav-icon");o&&(o.checked=n,l.setNavsVisibility(document.body,n),r&&(r.innerHTML=n?'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62.0001" x2="77" y2="62.0001" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8888" x2="77" y2="77.8888" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4454" x2="221" y2="97.4454" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n <line x1="247.5" y1="43.0001" x2="247.5" y2="13.0001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M185 12.5001L247 12.5001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <line x1="204.09" y1="36.6095" x2="181.698" y2="10.0228" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M125 9.50012L181 9.50012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M144.305 35.2579L120.095 6.56679" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M120 6.50037L64 6.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M87.1957 36.1024L59 2.50008" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M59 2.50037L3 2.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M2.5 38.5001L2.5 3.00012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n </svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181" fill="currentColor">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62" x2="77" y2="62" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8887" x2="77" y2="77.8887" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4453" x2="221" y2="97.4453" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n </svg>'))}formatToggleName(e){return e.charAt(0).toUpperCase()+e.slice(1)}showWelcomeModalIfFirstVisit(){const e="cv-welcome-shown";if(!localStorage.getItem(e)){(null!==document.querySelector("cv-tabgroup")||null!==document.querySelector("cv-tab")||null!==document.querySelector("cv-toggle")||null!==document.querySelector("[data-cv-toggle]"))&&(setTimeout(()=>{this.createWelcomeModal()},500),localStorage.setItem(e,"true"))}}createWelcomeModal(){this.modal||(this.modal=document.createElement("div"),this.modal.className="cv-widget-modal-overlay cv-welcome-modal-overlay",this.applyThemeToModal(),this.modal.innerHTML=`\n <div class="cv-widget-modal cv-welcome-modal">\n <header class="cv-modal-header">\n <div class="cv-modal-header-content">\n <div class="cv-modal-icon">\n <svg class="cv-modal-icon-svg" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M12 8.00002C9.79085 8.00002 7.99999 9.79088 7.99999 12C7.99999 14.2092 9.79085 16 12 16C14.2091 16 16 14.2092 16 12C16 9.79088 14.2091 8.00002 12 8.00002ZM9.99999 12C9.99999 10.8955 10.8954 10 12 10C13.1046 10 14 10.8955 14 12C14 13.1046 13.1046 14 12 14C10.8954 14 9.99999 13.1046 9.99999 12Z" fill="#0F1729"/>\n <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M10.7673 1.01709C10.9925 0.999829 11.2454 0.99993 11.4516 1.00001L12.5484 1.00001C12.7546 0.99993 13.0075 0.999829 13.2327 1.01709C13.4989 1.03749 13.8678 1.08936 14.2634 1.26937C14.7635 1.49689 15.1915 1.85736 15.5007 2.31147C15.7454 2.67075 15.8592 3.0255 15.9246 3.2843C15.9799 3.50334 16.0228 3.75249 16.0577 3.9557L16.1993 4.77635L16.2021 4.77788C16.2369 4.79712 16.2715 4.81659 16.306 4.8363L16.3086 4.83774L17.2455 4.49865C17.4356 4.42978 17.6693 4.34509 17.8835 4.28543C18.1371 4.2148 18.4954 4.13889 18.9216 4.17026C19.4614 4.20998 19.9803 4.39497 20.4235 4.70563C20.7734 4.95095 21.0029 5.23636 21.1546 5.4515C21.2829 5.63326 21.4103 5.84671 21.514 6.02029L22.0158 6.86003C22.1256 7.04345 22.2594 7.26713 22.3627 7.47527C22.4843 7.7203 22.6328 8.07474 22.6777 8.52067C22.7341 9.08222 22.6311 9.64831 22.3803 10.1539C22.1811 10.5554 21.9171 10.8347 21.7169 11.0212C21.5469 11.1795 21.3428 11.3417 21.1755 11.4746L20.5 12L21.1755 12.5254C21.3428 12.6584 21.5469 12.8205 21.7169 12.9789C21.9171 13.1653 22.1811 13.4446 22.3802 13.8461C22.631 14.3517 22.7341 14.9178 22.6776 15.4794C22.6328 15.9253 22.4842 16.2797 22.3626 16.5248C22.2593 16.7329 22.1255 16.9566 22.0158 17.14L21.5138 17.9799C21.4102 18.1535 21.2828 18.3668 21.1546 18.5485C21.0028 18.7637 20.7734 19.0491 20.4234 19.2944C19.9803 19.6051 19.4613 19.7901 18.9216 19.8298C18.4954 19.8612 18.1371 19.7852 17.8835 19.7146C17.6692 19.6549 17.4355 19.5703 17.2454 19.5014L16.3085 19.1623L16.306 19.1638C16.2715 19.1835 16.2369 19.2029 16.2021 19.2222L16.1993 19.2237L16.0577 20.0443C16.0228 20.2475 15.9799 20.4967 15.9246 20.7157C15.8592 20.9745 15.7454 21.3293 15.5007 21.6886C15.1915 22.1427 14.7635 22.5032 14.2634 22.7307C13.8678 22.9107 13.4989 22.9626 13.2327 22.983C13.0074 23.0002 12.7546 23.0001 12.5484 23H11.4516C11.2454 23.0001 10.9925 23.0002 10.7673 22.983C10.5011 22.9626 10.1322 22.9107 9.73655 22.7307C9.23648 22.5032 8.80849 22.1427 8.49926 21.6886C8.25461 21.3293 8.14077 20.9745 8.07542 20.7157C8.02011 20.4967 7.97723 20.2475 7.94225 20.0443L7.80068 19.2237L7.79791 19.2222C7.7631 19.2029 7.72845 19.1835 7.69396 19.1637L7.69142 19.1623L6.75458 19.5014C6.5645 19.5702 6.33078 19.6549 6.11651 19.7146C5.86288 19.7852 5.50463 19.8611 5.07841 19.8298C4.53866 19.7901 4.01971 19.6051 3.57654 19.2944C3.2266 19.0491 2.99714 18.7637 2.84539 18.5485C2.71718 18.3668 2.58974 18.1534 2.4861 17.9798L1.98418 17.14C1.87447 16.9566 1.74067 16.7329 1.63737 16.5248C1.51575 16.2797 1.36719 15.9253 1.32235 15.4794C1.26588 14.9178 1.36897 14.3517 1.61976 13.8461C1.81892 13.4446 2.08289 13.1653 2.28308 12.9789C2.45312 12.8205 2.65717 12.6584 2.82449 12.5254L3.47844 12.0054V11.9947L2.82445 11.4746C2.65712 11.3417 2.45308 11.1795 2.28304 11.0212C2.08285 10.8347 1.81888 10.5554 1.61972 10.1539C1.36893 9.64832 1.26584 9.08224 1.3223 8.52069C1.36714 8.07476 1.51571 7.72032 1.63732 7.47528C1.74062 7.26715 1.87443 7.04347 1.98414 6.86005L2.48605 6.02026C2.58969 5.84669 2.71714 5.63326 2.84534 5.45151C2.9971 5.23637 3.22655 4.95096 3.5765 4.70565C4.01966 4.39498 4.53862 4.20999 5.07837 4.17027C5.50458 4.1389 5.86284 4.21481 6.11646 4.28544C6.33072 4.34511 6.56444 4.4298 6.75451 4.49867L7.69141 4.83775L7.69394 4.8363C7.72844 4.8166 7.7631 4.79712 7.79791 4.77788L7.80068 4.77635L7.94225 3.95571C7.97723 3.7525 8.02011 3.50334 8.07542 3.2843C8.14077 3.0255 8.25461 2.67075 8.49926 2.31147C8.80849 1.85736 9.23648 1.49689 9.73655 1.26937C10.1322 1.08936 10.5011 1.03749 10.7673 1.01709ZM14.0938 4.3363C14.011 3.85634 13.9696 3.61637 13.8476 3.43717C13.7445 3.2858 13.6019 3.16564 13.4352 3.0898C13.2378 3.00002 12.9943 3.00002 12.5073 3.00002H11.4927C11.0057 3.00002 10.7621 3.00002 10.5648 3.0898C10.3981 3.16564 10.2555 3.2858 10.1524 3.43717C10.0304 3.61637 9.98895 3.85634 9.90615 4.3363L9.75012 5.24064C9.69445 5.56333 9.66662 5.72467 9.60765 5.84869C9.54975 5.97047 9.50241 6.03703 9.40636 6.13166C9.30853 6.22804 9.12753 6.3281 8.76554 6.52822C8.73884 6.54298 8.71227 6.55791 8.68582 6.57302C8.33956 6.77078 8.16643 6.86966 8.03785 6.90314C7.91158 6.93602 7.83293 6.94279 7.70289 6.93196C7.57049 6.92094 7.42216 6.86726 7.12551 6.7599L6.11194 6.39308C5.66271 6.2305 5.43809 6.14921 5.22515 6.16488C5.04524 6.17811 4.87225 6.23978 4.72453 6.34333C4.5497 6.46589 4.42715 6.67094 4.18206 7.08103L3.72269 7.84965C3.46394 8.2826 3.33456 8.49907 3.31227 8.72078C3.29345 8.90796 3.32781 9.09665 3.41141 9.26519C3.51042 9.4648 3.7078 9.62177 4.10256 9.9357L4.82745 10.5122C5.07927 10.7124 5.20518 10.8126 5.28411 10.9199C5.36944 11.036 5.40583 11.1114 5.44354 11.2504C5.47844 11.379 5.47844 11.586 5.47844 12C5.47844 12.414 5.47844 12.621 5.44354 12.7497C5.40582 12.8887 5.36944 12.9641 5.28413 13.0801C5.20518 13.1875 5.07927 13.2876 4.82743 13.4879L4.10261 14.0643C3.70785 14.3783 3.51047 14.5352 3.41145 14.7349C3.32785 14.9034 3.29349 15.0921 3.31231 15.2793C3.33461 15.501 3.46398 15.7174 3.72273 16.1504L4.1821 16.919C4.4272 17.3291 4.54974 17.5342 4.72457 17.6567C4.8723 17.7603 5.04528 17.8219 5.2252 17.8352C5.43813 17.8508 5.66275 17.7695 6.11199 17.607L7.12553 17.2402C7.42216 17.1328 7.5705 17.0791 7.7029 17.0681C7.83294 17.0573 7.91159 17.064 8.03786 17.0969C8.16644 17.1304 8.33956 17.2293 8.68582 17.427C8.71228 17.4421 8.73885 17.4571 8.76554 17.4718C9.12753 17.6719 9.30853 17.772 9.40635 17.8684C9.50241 17.963 9.54975 18.0296 9.60765 18.1514C9.66662 18.2754 9.69445 18.4367 9.75012 18.7594L9.90615 19.6637C9.98895 20.1437 10.0304 20.3837 10.1524 20.5629C10.2555 20.7142 10.3981 20.8344 10.5648 20.9102C10.7621 21 11.0057 21 11.4927 21H12.5073C12.9943 21 13.2378 21 13.4352 20.9102C13.6019 20.8344 13.7445 20.7142 13.8476 20.5629C13.9696 20.3837 14.011 20.1437 14.0938 19.6637L14.2499 18.7594C14.3055 18.4367 14.3334 18.2754 14.3923 18.1514C14.4502 18.0296 14.4976 17.963 14.5936 17.8684C14.6915 17.772 14.8725 17.6719 15.2344 17.4718C15.2611 17.4571 15.2877 17.4421 15.3141 17.427C15.6604 17.2293 15.8335 17.1304 15.9621 17.0969C16.0884 17.064 16.167 17.0573 16.2971 17.0681C16.4295 17.0791 16.5778 17.1328 16.8744 17.2402L17.888 17.607C18.3372 17.7696 18.5619 17.8509 18.7748 17.8352C18.9547 17.8219 19.1277 17.7603 19.2754 17.6567C19.4502 17.5342 19.5728 17.3291 19.8179 16.919L20.2773 16.1504C20.536 15.7175 20.6654 15.501 20.6877 15.2793C20.7065 15.0921 20.6721 14.9034 20.5885 14.7349C20.4895 14.5353 20.2921 14.3783 19.8974 14.0643L19.1726 13.4879C18.9207 13.2876 18.7948 13.1875 18.7159 13.0801C18.6306 12.9641 18.5942 12.8887 18.5564 12.7497C18.5215 12.6211 18.5215 12.414 18.5215 12C18.5215 11.586 18.5215 11.379 18.5564 11.2504C18.5942 11.1114 18.6306 11.036 18.7159 10.9199C18.7948 10.8126 18.9207 10.7124 19.1725 10.5122L19.8974 9.9357C20.2922 9.62176 20.4896 9.46479 20.5886 9.26517C20.6722 9.09664 20.7065 8.90795 20.6877 8.72076C20.6654 8.49906 20.5361 8.28259 20.2773 7.84964L19.8179 7.08102C19.5728 6.67093 19.4503 6.46588 19.2755 6.34332C19.1277 6.23977 18.9548 6.1781 18.7748 6.16486C18.5619 6.14919 18.3373 6.23048 17.888 6.39307L16.8745 6.75989C16.5778 6.86725 16.4295 6.92093 16.2971 6.93195C16.167 6.94278 16.0884 6.93601 15.9621 6.90313C15.8335 6.86965 15.6604 6.77077 15.3142 6.57302C15.2877 6.55791 15.2611 6.54298 15.2345 6.52822C14.8725 6.3281 14.6915 6.22804 14.5936 6.13166C14.4976 6.03703 14.4502 5.97047 14.3923 5.84869C14.3334 5.72467 14.3055 5.56332 14.2499 5.24064L14.0938 4.3363Z" fill="#0F1729"/>\n</svg>\n </div>\n <h1 class="cv-modal-title">${this.options.welcomeTitle}</h1>\n </div>\n </header>\n <div class="cv-modal-main">\n <p class="cv-welcome-message">${this.options.welcomeMessage}</p>\n \n <div class="cv-welcome-widget-preview">\n <div class="cv-welcome-widget-icon">\n <svg class="cv-modal-icon-svg" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M12 8.00002C9.79085 8.00002 7.99999 9.79088 7.99999 12C7.99999 14.2092 9.79085 16 12 16C14.2091 16 16 14.2092 16 12C16 9.79088 14.2091 8.00002 12 8.00002ZM9.99999 12C9.99999 10.8955 10.8954 10 12 10C13.1046 10 14 10.8955 14 12C14 13.1046 13.1046 14 12 14C10.8954 14 9.99999 13.1046 9.99999 12Z" fill="#0F1729"/>\n <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M10.7673 1.01709C10.9925 0.999829 11.2454 0.99993 11.4516 1.00001L12.5484 1.00001C12.7546 0.99993 13.0075 0.999829 13.2327 1.01709C13.4989 1.03749 13.8678 1.08936 14.2634 1.26937C14.7635 1.49689 15.1915 1.85736 15.5007 2.31147C15.7454 2.67075 15.8592 3.0255 15.9246 3.2843C15.9799 3.50334 16.0228 3.75249 16.0577 3.9557L16.1993 4.77635L16.2021 4.77788C16.2369 4.79712 16.2715 4.81659 16.306 4.8363L16.3086 4.83774L17.2455 4.49865C17.4356 4.42978 17.6693 4.34509 17.8835 4.28543C18.1371 4.2148 18.4954 4.13889 18.9216 4.17026C19.4614 4.20998 19.9803 4.39497 20.4235 4.70563C20.7734 4.95095 21.0029 5.23636 21.1546 5.4515C21.2829 5.63326 21.4103 5.84671 21.514 6.02029L22.0158 6.86003C22.1256 7.04345 22.2594 7.26713 22.3627 7.47527C22.4843 7.7203 22.6328 8.07474 22.6777 8.52067C22.7341 9.08222 22.6311 9.64831 22.3803 10.1539C22.1811 10.5554 21.9171 10.8347 21.7169 11.0212C21.5469 11.1795 21.3428 11.3417 21.1755 11.4746L20.5 12L21.1755 12.5254C21.3428 12.6584 21.5469 12.8205 21.7169 12.9789C21.9171 13.1653 22.1811 13.4446 22.3802 13.8461C22.631 14.3517 22.7341 14.9178 22.6776 15.4794C22.6328 15.9253 22.4842 16.2797 22.3626 16.5248C22.2593 16.7329 22.1255 16.9566 22.0158 17.14L21.5138 17.9799C21.4102 18.1535 21.2828 18.3668 21.1546 18.5485C21.0028 18.7637 20.7734 19.0491 20.4234 19.2944C19.9803 19.6051 19.4613 19.7901 18.9216 19.8298C18.4954 19.8612 18.1371 19.7852 17.8835 19.7146C17.6692 19.6549 17.4355 19.5703 17.2454 19.5014L16.3085 19.1623L16.306 19.1638C16.2715 19.1835 16.2369 19.2029 16.2021 19.2222L16.1993 19.2237L16.0577 20.0443C16.0228 20.2475 15.9799 20.4967 15.9246 20.7157C15.8592 20.9745 15.7454 21.3293 15.5007 21.6886C15.1915 22.1427 14.7635 22.5032 14.2634 22.7307C13.8678 22.9107 13.4989 22.9626 13.2327 22.983C13.0074 23.0002 12.7546 23.0001 12.5484 23H11.4516C11.2454 23.0001 10.9925 23.0002 10.7673 22.983C10.5011 22.9626 10.1322 22.9107 9.73655 22.7307C9.23648 22.5032 8.80849 22.1427 8.49926 21.6886C8.25461 21.3293 8.14077 20.9745 8.07542 20.7157C8.02011 20.4967 7.97723 20.2475 7.94225 20.0443L7.80068 19.2237L7.79791 19.2222C7.7631 19.2029 7.72845 19.1835 7.69396 19.1637L7.69142 19.1623L6.75458 19.5014C6.5645 19.5702 6.33078 19.6549 6.11651 19.7146C5.86288 19.7852 5.50463 19.8611 5.07841 19.8298C4.53866 19.7901 4.01971 19.6051 3.57654 19.2944C3.2266 19.0491 2.99714 18.7637 2.84539 18.5485C2.71718 18.3668 2.58974 18.1534 2.4861 17.9798L1.98418 17.14C1.87447 16.9566 1.74067 16.7329 1.63737 16.5248C1.51575 16.2797 1.36719 15.9253 1.32235 15.4794C1.26588 14.9178 1.36897 14.3517 1.61976 13.8461C1.81892 13.4446 2.08289 13.1653 2.28308 12.9789C2.45312 12.8205 2.65717 12.6584 2.82449 12.5254L3.47844 12.0054V11.9947L2.82445 11.4746C2.65712 11.3417 2.45308 11.1795 2.28304 11.0212C2.08285 10.8347 1.81888 10.5554 1.61972 10.1539C1.36893 9.64832 1.26584 9.08224 1.3223 8.52069C1.36714 8.07476 1.51571 7.72032 1.63732 7.47528C1.74062 7.26715 1.87443 7.04347 1.98414 6.86005L2.48605 6.02026C2.58969 5.84669 2.71714 5.63326 2.84534 5.45151C2.9971 5.23637 3.22655 4.95096 3.5765 4.70565C4.01966 4.39498 4.53862 4.20999 5.07837 4.17027C5.50458 4.1389 5.86284 4.21481 6.11646 4.28544C6.33072 4.34511 6.56444 4.4298 6.75451 4.49867L7.69141 4.83775L7.69394 4.8363C7.72844 4.8166 7.7631 4.79712 7.79791 4.77788L7.80068 4.77635L7.94225 3.95571C7.97723 3.7525 8.02011 3.50334 8.07542 3.2843C8.14077 3.0255 8.25461 2.67075 8.49926 2.31147C8.80849 1.85736 9.23648 1.49689 9.73655 1.26937C10.1322 1.08936 10.5011 1.03749 10.7673 1.01709ZM14.0938 4.3363C14.011 3.85634 13.9696 3.61637 13.8476 3.43717C13.7445 3.2858 13.6019 3.16564 13.4352 3.0898C13.2378 3.00002 12.9943 3.00002 12.5073 3.00002H11.4927C11.0057 3.00002 10.7621 3.00002 10.5648 3.0898C10.3981 3.16564 10.2555 3.2858 10.1524 3.43717C10.0304 3.61637 9.98895 3.85634 9.90615 4.3363L9.75012 5.24064C9.69445 5.56333 9.66662 5.72467 9.60765 5.84869C9.54975 5.97047 9.50241 6.03703 9.40636 6.13166C9.30853 6.22804 9.12753 6.3281 8.76554 6.52822C8.73884 6.54298 8.71227 6.55791 8.68582 6.57302C8.33956 6.77078 8.16643 6.86966 8.03785 6.90314C7.91158 6.93602 7.83293 6.94279 7.70289 6.93196C7.57049 6.92094 7.42216 6.86726 7.12551 6.7599L6.11194 6.39308C5.66271 6.2305 5.43809 6.14921 5.22515 6.16488C5.04524 6.17811 4.87225 6.23978 4.72453 6.34333C4.5497 6.46589 4.42715 6.67094 4.18206 7.08103L3.72269 7.84965C3.46394 8.2826 3.33456 8.49907 3.31227 8.72078C3.29345 8.90796 3.32781 9.09665 3.41141 9.26519C3.51042 9.4648 3.7078 9.62177 4.10256 9.9357L4.82745 10.5122C5.07927 10.7124 5.20518 10.8126 5.28411 10.9199C5.36944 11.036 5.40583 11.1114 5.44354 11.2504C5.47844 11.379 5.47844 11.586 5.47844 12C5.47844 12.414 5.47844 12.621 5.44354 12.7497C5.40582 12.8887 5.36944 12.9641 5.28413 13.0801C5.20518 13.1875 5.07927 13.2876 4.82743 13.4879L4.10261 14.0643C3.70785 14.3783 3.51047 14.5352 3.41145 14.7349C3.32785 14.9034 3.29349 15.0921 3.31231 15.2793C3.33461 15.501 3.46398 15.7174 3.72273 16.1504L4.1821 16.919C4.4272 17.3291 4.54974 17.5342 4.72457 17.6567C4.8723 17.7603 5.04528 17.8219 5.2252 17.8352C5.43813 17.8508 5.66275 17.7695 6.11199 17.607L7.12553 17.2402C7.42216 17.1328 7.5705 17.0791 7.7029 17.0681C7.83294 17.0573 7.91159 17.064 8.03786 17.0969C8.16644 17.1304 8.33956 17.2293 8.68582 17.427C8.71228 17.4421 8.73885 17.4571 8.76554 17.4718C9.12753 17.6719 9.30853 17.772 9.40635 17.8684C9.50241 17.963 9.54975 18.0296 9.60765 18.1514C9.66662 18.2754 9.69445 18.4367 9.75012 18.7594L9.90615 19.6637C9.98895 20.1437 10.0304 20.3837 10.1524 20.5629C10.2555 20.7142 10.3981 20.8344 10.5648 20.9102C10.7621 21 11.0057 21 11.4927 21H12.5073C12.9943 21 13.2378 21 13.4352 20.9102C13.6019 20.8344 13.7445 20.7142 13.8476 20.5629C13.9696 20.3837 14.011 20.1437 14.0938 19.6637L14.2499 18.7594C14.3055 18.4367 14.3334 18.2754 14.3923 18.1514C14.4502 18.0296 14.4976 17.963 14.5936 17.8684C14.6915 17.772 14.8725 17.6719 15.2344 17.4718C15.2611 17.4571 15.2877 17.4421 15.3141 17.427C15.6604 17.2293 15.8335 17.1304 15.9621 17.0969C16.0884 17.064 16.167 17.0573 16.2971 17.0681C16.4295 17.0791 16.5778 17.1328 16.8744 17.2402L17.888 17.607C18.3372 17.7696 18.5619 17.8509 18.7748 17.8352C18.9547 17.8219 19.1277 17.7603 19.2754 17.6567C19.4502 17.5342 19.5728 17.3291 19.8179 16.919L20.2773 16.1504C20.536 15.7175 20.6654 15.501 20.6877 15.2793C20.7065 15.0921 20.6721 14.9034 20.5885 14.7349C20.4895 14.5353 20.2921 14.3783 19.8974 14.0643L19.1726 13.4879C18.9207 13.2876 18.7948 13.1875 18.7159 13.0801C18.6306 12.9641 18.5942 12.8887 18.5564 12.7497C18.5215 12.6211 18.5215 12.414 18.5215 12C18.5215 11.586 18.5215 11.379 18.5564 11.2504C18.5942 11.1114 18.6306 11.036 18.7159 10.9199C18.7948 10.8126 18.9207 10.7124 19.1725 10.5122L19.8974 9.9357C20.2922 9.62176 20.4896 9.46479 20.5886 9.26517C20.6722 9.09664 20.7065 8.90795 20.6877 8.72076C20.6654 8.49906 20.5361 8.28259 20.2773 7.84964L19.8179 7.08102C19.5728 6.67093 19.4503 6.46588 19.2755 6.34332C19.1277 6.23977 18.9548 6.1781 18.7748 6.16486C18.5619 6.14919 18.3373 6.23048 17.888 6.39307L16.8745 6.75989C16.5778 6.86725 16.4295 6.92093 16.2971 6.93195C16.167 6.94278 16.0884 6.93601 15.9621 6.90313C15.8335 6.86965 15.6604 6.77077 15.3142 6.57302C15.2877 6.55791 15.2611 6.54298 15.2345 6.52822C14.8725 6.3281 14.6915 6.22804 14.5936 6.13166C14.4976 6.03703 14.4502 5.97047 14.3923 5.84869C14.3334 5.72467 14.3055 5.56332 14.2499 5.24064L14.0938 4.3363Z" fill="#0F1729"/>\n</svg>\n </div>\n <p class="cv-welcome-widget-label">Look for this widget</p>\n </div>\n \n <button class="cv-welcome-got-it">Got it!</button>\n </div>\n </div>\n `,document.body.appendChild(this.modal),this.attachWelcomeModalEventListeners())}attachWelcomeModalEventListeners(){if(!this.modal)return;const e=this.modal.querySelector(".cv-welcome-got-it");e&&e.addEventListener("click",()=>{this.closeModal()}),this.modal.addEventListener("click",e=>{e.target===this.modal&&this.closeModal()});const t=e=>{"Escape"===e.key&&(this.closeModal(),document.removeEventListener("keydown",t))};document.addEventListener("keydown",t)}}"undefined"!=typeof window&&(window.CustomViews=k,window.CustomViewsWidget=x,"undefined"!=typeof window&&(window.__customViewsInitialized?console.info("[CustomViews] Auto-init skipped: already initialized."):document.addEventListener("DOMContentLoaded",async function(){if(!window.__customViewsInitInProgress&&!window.__customViewsInitialized){window.__customViewsInitInProgress=!0;try{let e=document.currentScript;if(!e||!e.hasAttribute("data-base-url")){const t=document.querySelector("script[data-base-url]");if(t)e=t;else for(const t of document.scripts){const n=t.src||"";if(/(?:custom[-_]views|@customviews-js\/customviews)(?:\.min)?\.(?:esm\.)?js($|\?)/i.test(n)){e=t;break}}}let t,n="",o="/customviews.config.json";e&&(n=e.getAttribute("data-base-url")||"",o=e.getAttribute("data-config-path")||o);try{const e=b(o,n);console.log(`[CustomViews] Loading config from: ${e}`);const r=await fetch(e);r.ok?(t=await r.json(),console.log("[CustomViews] Config loaded successfully")):(console.warn(`[CustomViews] Config file not found at ${e}. Using defaults.`),t={config:{allToggles:[],defaultState:{}},widget:{enabled:!0}})}catch(e){return void console.error("[CustomViews] Error loading config file:",e)}const r=n||t.baseURL||"",i={config:t.config,assetsJsonPath:t.assetsJsonPath,baseURL:r};void 0!==t.showUrl&&(i.showUrl=t.showUrl);const s=await k.init(i);if(!s)return void console.error("[CustomViews] Failed to initialize core.");let a;window.customViewsInstance={core:s},!1!==t.widget?.enabled?(a=new x({core:s,...t.widget}),a.render(),window.customViewsInstance.widget=a,console.log("[CustomViews] Widget initialized and rendered")):console.log("[CustomViews] Widget disabled in config - skipping initialization");const c=new CustomEvent("customviews:ready",{detail:{core:s,widget:a}});document.dispatchEvent(c),window.__customViewsInitialized=!0,window.__customViewsInitInProgress=!1}catch(e){window.__customViewsInitInProgress=!1,console.error("[CustomViews] Auto-initialization error:",e)}}}))),e.AssetsManager=d,e.CustomViews=k,e.CustomViewsCore=v,e.CustomViewsWidget=x,e.PersistenceManager=t,e.URLStateManager=n});
6
+ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).CustomViews={})}(this,function(t){"use strict";class e{static STORAGE_KEYS={STATE:"customviews-state",TAB_NAV_VISIBILITY:"cv-tab-navs-visible"};isStorageAvailable(){return"undefined"!=typeof window&&void 0!==window.localStorage}persistState(t){if(this.isStorageAvailable())try{localStorage.setItem(e.STORAGE_KEYS.STATE,JSON.stringify(t))}catch(t){console.warn("Failed to persist state:",t)}}getPersistedState(){if(!this.isStorageAvailable())return null;try{const t=localStorage.getItem(e.STORAGE_KEYS.STATE);return t?JSON.parse(t):null}catch(t){return console.warn("Failed to parse persisted state:",t),null}}clearAll(){this.isStorageAvailable()&&(localStorage.removeItem(e.STORAGE_KEYS.STATE),localStorage.removeItem(e.STORAGE_KEYS.TAB_NAV_VISIBILITY))}persistTabNavVisibility(t){if(this.isStorageAvailable())try{localStorage.setItem(e.STORAGE_KEYS.TAB_NAV_VISIBILITY,t?"true":"false")}catch(t){console.warn("Failed to persist tab nav visibility:",t)}}getPersistedTabNavVisibility(){if(!this.isStorageAvailable())return null;try{const t=localStorage.getItem(e.STORAGE_KEYS.TAB_NAV_VISIBILITY);return null===t?null:"true"===t}catch(t){return console.warn("Failed to get persisted tab nav visibility:",t),null}}hasPersistedData(){return!!this.isStorageAvailable()&&!!this.getPersistedState()}}class n{static parseURL(){const t=new URLSearchParams(window.location.search).get("view");let e=null;if(t)try{e=this.decodeState(t)}catch(t){console.warn("Failed to decode view state from URL:",t)}return e}static updateURL(t){if("undefined"==typeof window||!window.history)return;const e=new URL(window.location.href);if(e.searchParams.delete("view"),t){const n=this.encodeState(t);n&&e.searchParams.set("view",n)}const n=e.pathname+(e.search||"")+(e.hash||"");window.history.replaceState({},"",n)}static clearURL(){this.updateURL(null)}static generateShareableURL(t){const e=new URL(window.location.href);if(e.searchParams.delete("view"),t){const n=this.encodeState(t);n&&e.searchParams.set("view",n)}return e.toString()}static encodeState(t){try{const e={};t.toggles&&t.toggles.length>0&&(e.t=t.toggles),t.tabs&&Object.keys(t.tabs).length>0&&(e.g=Object.entries(t.tabs));const n=JSON.stringify(e);let o;o="function"==typeof btoa?btoa(n):Buffer.from(n,"utf-8").toString("base64");return o.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}catch(t){return console.warn("Failed to encode state:",t),null}}static decodeState(t){try{let e,n=t.replace(/-/g,"+").replace(/_/g,"/");for(;n.length%4;)n+="=";e="function"==typeof atob?atob(n):Buffer.from(n,"base64").toString("utf-8");const o=JSON.parse(e);if(!o||"object"!=typeof o)throw new Error("Invalid compact state structure");const r={toggles:Array.isArray(o.t)?o.t:[]};if(Array.isArray(o.g)){r.tabs={};for(const[t,e]of o.g)"string"==typeof t&&"string"==typeof e&&(r.tabs[t]=e)}return r}catch(t){return console.warn("Failed to decode view state:",t),null}}}class o{hiddenToggles=new Set;setToggleVisibility(t,e){const n=this.hiddenToggles.has(t),o=!e;return o&&!n?(this.hiddenToggles.add(t),!0):!(o||!n)&&(this.hiddenToggles.delete(t),!0)}hideAll(t){for(const e of t)this.setToggleVisibility(e,!1)}showAll(t){for(const e of t)this.setToggleVisibility(e,!0)}getHiddenToggles(){return Array.from(this.hiddenToggles)}filterVisibleToggles(t){return t.filter(t=>!this.hiddenToggles.has(t))}applyElementVisibility(t,e){e?(t.classList.remove("cv-hidden"),t.classList.add("cv-visible")):(t.classList.add("cv-hidden"),t.classList.remove("cv-visible"))}}const r="cv-tab",i="cv-tabs-nav",s="cv-hide-tab-navs",a="cv-tabs-nav-hidden";class c{static splitTabIds(t){return t.split(/[\s|]+/).filter(t=>""!==t.trim()).map(t=>t.trim())}static applyTabSelections(t,e,n){t.forEach(t=>{const o=t.getAttribute("id");let i;if(o)i=this.resolveActiveTabForGroup(o,e,n,t);else{const e=Array.from(t.children).filter(t=>t.tagName.toLowerCase()===r)[0];if(e){const t=e.getAttribute("id")||e.getAttribute("data-cv-internal-id")||"",n=this.splitTabIds(t);i=n[0]||null}else i=null}Array.from(t.children).filter(t=>t.tagName.toLowerCase()===r).forEach(t=>{const e=t.getAttribute("id")||t.getAttribute("data-cv-internal-id");if(!e)return;const n=this.splitTabIds(e).includes(i||"");this.applyTabVisibility(t,n)})})}static resolveActiveTabForGroup(t,e,n,o){if(e[t])return e[t];if(n){const e=n.find(e=>e.id===t);if(e){const t=e.tabs[0];if(t)return t.id}}const i=Array.from(o.children).find(t=>t.tagName.toLowerCase()===r);if(i){const t=i.getAttribute("id")||i.getAttribute("data-cv-internal-id")||"";return this.splitTabIds(t)[0]||null}return null}static applyTabVisibility(t,e){e?(t.classList.remove("cv-hidden"),t.classList.add("cv-visible")):(t.classList.add("cv-hidden"),t.classList.remove("cv-visible"))}static extractTabContent(t){let e=t.querySelector(":scope > cv-tab-header");if(!e)return null;return{headerHTML:e.innerHTML.trim(),bodyEl:t.querySelector(":scope > cv-tab-body")}}static buildNavs(t,e,n,o){const c=document.body;t.forEach(t=>{if(t.hasAttribute("data-cv-initialized"))return;if(t.setAttribute("data-cv-initialized","true"),!t.matches('cv-tabgroup[nav="auto"], cv-tabgroup:not([nav])'))return;const l=t.getAttribute("id")||null;let d=t.querySelector(`.${i}`);if(d)return;const g=Array.from(t.children).filter(t=>t.tagName.toLowerCase()===r);if(0===g.length)return;d=document.createElement("ul"),d.className=`${i} nav-tabs`,d.setAttribute("role","tablist");!c.classList.contains(s)?d.setAttribute("aria-hidden","false"):(d.classList.add(a),d.setAttribute("aria-hidden","true")),t.insertBefore(d,t.firstChild),g.forEach((r,i)=>{let s=r.getAttribute("id");s||(s=`${l}-tab-${i}`,r.setAttribute("data-cv-internal-id",s));const a=this.splitTabIds(s),c=a[0]||s,g=this.extractTabContent(r);let h="";if(g&&g.headerHTML)h=g.headerHTML;else{const t=r.getAttribute("header")||"";if(t)h=t;else{const t=l?this.getTabLabel(c,l,e):null;h=t||(r.getAttribute("id")?c:`Tab ${i+1}`)}}const u=document.createElement("li");u.className="nav-item";const p=document.createElement("a");p.className="nav-link",p.href="#",p.setAttribute("data-tab-id",c),p.setAttribute("data-raw-tab-id",s),l&&p.setAttribute("data-group-id",l),p.setAttribute("role","tab");const v=document.createElement("span");v.className="cv-tab-header-container";const b=document.createElement("span");b.className="cv-tab-header-text",b.innerHTML=h;const m=document.createElement("span");m.className="cv-tab-pin-icon",m.innerHTML=function(t=!1){return`\n <svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor" opacity="${t?"1":"0.6"}" xmlns="http://www.w3.org/2000/svg">\n <g transform="rotate(45 8 8)">\n <path d="M10.5 2H12V0H4V2H5.5V6L4 7.5V9H7.2V15H8.8V9H12V7.5L10.5 6V2Z"/>\n </g>\n </svg>\n `.trim()}(!0),m.style.display="none",v.appendChild(b),v.appendChild(m),p.appendChild(v);const w=l?this.resolveActiveTabForGroup(l,{},e,t):0===i?c:null;a.includes(w||"")?(p.classList.add("active"),p.setAttribute("aria-selected","true")):p.setAttribute("aria-selected","false"),n&&p.addEventListener("click",e=>{e.preventDefault(),n(l||"",c,t)}),o&&l&&p.addEventListener("dblclick",e=>{e.preventDefault(),o(l,c,t)}),p.setAttribute("title","Double click to change switch tabs across all groups"),u.appendChild(p),d.appendChild(u)});const h=document.createElement("div");h.className="cv-tabgroup-bottom-border",t.appendChild(h)})}static setNavsVisibility(t,e){e?t.classList.remove(s):t.classList.add(s);t.querySelectorAll(`.${i}`).forEach(t=>{e?(t.classList.remove(a),t.setAttribute("aria-hidden","false")):(t.classList.add(a),t.setAttribute("aria-hidden","true"))});t.querySelectorAll(".cv-tabgroup-bottom-border").forEach(t=>{e?t.classList.remove("cv-hidden"):t.classList.add("cv-hidden")})}static areNavsVisible(t){return!t.classList.contains(s)}static getTabLabel(t,e,n){if(!n)return null;const o=n.find(t=>t.id===e);if(!o)return null;const r=o.tabs.find(e=>e.id===t);return r?.label||null}static updateNavActiveState(t,e){t.querySelectorAll(".nav-link").forEach(t=>{const n=t.getAttribute("data-raw-tab-id");if(!n)return;this.splitTabIds(n).includes(e)?(t.classList.add("active"),t.setAttribute("aria-selected","true")):(t.classList.remove("active"),t.setAttribute("aria-selected","false"))})}static updateAllNavActiveStates(t,e,n){t.forEach(t=>{const o=t.getAttribute("id");if(!o)return;const r=this.resolveActiveTabForGroup(o,e,n,t);if(!r)return;t.querySelectorAll(".nav-link").forEach(t=>{const e=t.getAttribute("data-raw-tab-id");if(!e)return;this.splitTabIds(e).includes(r)?(t.classList.add("active"),t.setAttribute("aria-selected","true")):(t.classList.remove("active"),t.setAttribute("aria-selected","false"))})})}static applyTabLocalOnly(t,e){Array.from(t.children).filter(t=>t.tagName.toLowerCase()===r).forEach(t=>{const n=t.getAttribute("id")||t.getAttribute("data-cv-internal-id");if(!n)return;const o=this.splitTabIds(n).includes(e);this.applyTabVisibility(t,o)})}static groupHasTab(t,e){return Array.from(t.children).filter(t=>t.tagName.toLowerCase()===r).some(t=>{const n=t.getAttribute("id")||t.getAttribute("data-cv-internal-id")||"";return this.splitTabIds(n).includes(e)})}static getTabgroupsWithId(t,e,n){const o=[];return Array.from(t.querySelectorAll(`cv-tabgroup[id="${e}"]`)).forEach(t=>{this.groupHasTab(t,n)&&o.push(t)}),o}static updatePinIcons(t,e){t.forEach(t=>{const n=t.getAttribute("id");if(!n)return;const o=e[n];t.querySelectorAll(".nav-link").forEach(t=>{const e=t.getAttribute("data-raw-tab-id"),n=t.querySelector(".cv-tab-pin-icon");if(!n||!e)return;const r=this.splitTabIds(e),i=o&&r.includes(o);n.style.display=i?"inline-block":"none"})})}}class l{assets;baseURL;constructor(t,e=""){this.assets=t,this.baseURL=e,this.validate()||console.warn("Invalid assets:",this.assets)}validate(){return Object.values(this.assets).every(t=>t.src||t.content)}get(t){const e=this.assets[t];if(e)return this.baseURL&&e.src?{...e,src:this.prependBaseURL(e.src)}:e}prependBaseURL(t){if(t.startsWith("http://")||t.startsWith("https://"))return t;return(this.baseURL.endsWith("/")?this.baseURL.slice(0,-1):this.baseURL)+(t.startsWith("/")?t:"/"+t)}loadFromJSON(t){this.assets=t}loadAdditionalAssets(t){this.assets={...this.assets,...t}}}function d(t,e,n){const o=n.get(e);if(!o)return;const r=o.type||function(t){return t.src?"image":t.content&&/<[^>]+>/.test(t.content)?"html":"text"}(o);switch(r){case"image":!function(t,e){if(!e.src)return;t.innerHTML="";const n=document.createElement("img");n.src=e.src,n.alt=e.alt||"",e.className&&(n.className=e.className),e.style&&n.setAttribute("style",e.style),n.style.maxWidth=n.style.maxWidth||"100%",n.style.height=n.style.height||"auto",n.style.display=n.style.display||"block",t.appendChild(n)}(t,o);break;case"text":!function(t,e){null!=e.content&&(t.textContent=e.content),e.className&&(t.className=e.className),e.style&&t.setAttribute("style",e.style)}(t,o);break;case"html":!function(t,e){null!=e.content&&(t.innerHTML=e.content),e.className&&(t.className=e.className),e.style&&t.setAttribute("style",e.style)}(t,o);break;default:t.innerHTML=o.content||String(o),console.warn("[CustomViews] Unknown asset type:",r)}}class g{static applyToggles(t,e){t.forEach(t=>{const n=this.getToggleCategories(t).some(t=>e.includes(t));this.applyToggleVisibility(t,n)})}static renderAssets(t,e,n){t.forEach(t=>{const o=this.getToggleCategories(t),r=this.getToggleId(t),i="true"===t.dataset.cvRendered;r&&!i&&o.some(t=>e.includes(t))&&(d(t,r,n),t.dataset.cvRendered="true")})}static getToggleCategories(t){if("cv-toggle"===t.tagName.toLowerCase()){return(t.getAttribute("category")||"").split(/\s+/).filter(Boolean)}return(t.dataset.cvToggle||t.dataset.customviewsToggle||"").split(/\s+/).filter(Boolean)}static getToggleId(t){return t.dataset.cvId||t.dataset.customviewsId||t.getAttribute("data-cv-id")||t.getAttribute("data-customviews-id")||void 0}static applyToggleVisibility(t,e){e?(t.classList.remove("cv-hidden"),t.classList.add("cv-visible")):(t.classList.add("cv-hidden"),t.classList.remove("cv-visible"))}static initializeToggles(t,e,n){const o=[];t.matches("[data-cv-toggle], [data-customviews-toggle], cv-toggle")&&o.push(t),t.querySelectorAll("[data-cv-toggle], [data-customviews-toggle], cv-toggle").forEach(t=>o.push(t)),0!==o.length&&(this.applyToggles(o,e),this.renderAssets(o,e,n))}}class h{static findHighestVisibleTabGroup(){let t=0;const e=document.querySelector("header");let n=!1;if(e){const o=window.getComputedStyle(e);n=["fixed","sticky"].includes(o.position),n&&(t=e.getBoundingClientRect().height)}const o=t,r=Array.from(document.querySelectorAll("cv-tabgroup")).filter(t=>!n||!e||t.closest("header")!==e);let i=null,s=1/0;for(const t of r){const e=t.getBoundingClientRect();e.bottom>o&&e.top<window.innerHeight&&e.top<s&&(i=t,s=e.top)}return i}static scrollToTabGroup(t){let e=0;const n=document.querySelector("header");if(n){const t=window.getComputedStyle(n);["fixed","sticky"].includes(t.position)&&(e=n.getBoundingClientRect().height)}const o=t.getBoundingClientRect().top+window.scrollY-e-20;window.scrollTo({top:o,behavior:"smooth"})}static handleScrollAnchor(t){requestAnimationFrame(()=>{const{element:e,top:n}=t,o=e.getBoundingClientRect().top-n;Math.abs(o)>1&&window.scrollBy({top:o,behavior:"instant"})})}}const u="[data-cv-toggle], [data-customviews-toggle], cv-toggle",p="cv-tabgroup";class v{rootEl;assetsManager;persistenceManager;visibilityManager;observer=null;componentRegistry={toggles:new Set,tabGroups:new Set};config;stateChangeListeners=[];showUrlEnabled;lastAppliedState=null;constructor(t){this.assetsManager=t.assetsManager,this.config=t.config,this.rootEl=t.rootEl||document.body,this.persistenceManager=new e,this.visibilityManager=new o,this.showUrlEnabled=t.showUrl??!1,this.lastAppliedState=this.cloneState(this.getComputedDefaultState())}scan(t){let e=!1;const n=Array.from(t.querySelectorAll(u));t.matches(u)&&n.unshift(t),n.forEach(t=>{this.componentRegistry.toggles.has(t)||(this.componentRegistry.toggles.add(t),e=!0)});const o=Array.from(t.querySelectorAll(p));return t.matches(p)&&o.unshift(t),o.forEach(t=>{this.componentRegistry.tabGroups.has(t)||(this.componentRegistry.tabGroups.add(t),e=!0)}),e}unscan(t){const e=Array.from(t.querySelectorAll(u));t.matches(u)&&e.unshift(t),e.forEach(t=>{this.componentRegistry.toggles.delete(t)});const n=Array.from(t.querySelectorAll(p));t.matches(p)&&n.unshift(t),n.forEach(t=>{this.componentRegistry.tabGroups.delete(t)})}getConfig(){return this.config}getTabGroups(){return this.config.tabGroups}getComputedDefaultState(){const t=this.config?.defaultState;if(void 0!==t)return t;const e={};this.config.tabGroups?.length&&this.config.tabGroups.forEach(t=>{if(t.tabs&&t.tabs.length>0){const n=t.tabs[0];n?.id&&(e[t.id]=n.id)}});return{toggles:this.config.toggles?.map(t=>t.id)||[],tabs:e}}getCurrentActiveTabs(){if(this.lastAppliedState?.tabs)return{...this.lastAppliedState.tabs};const t=this.persistenceManager.getPersistedState();return t?.tabs?{...t.tabs}:this.getComputedDefaultState().tabs||{}}setActiveTab(t,e,n){if(n){c.applyTabLocalOnly(n,e),c.updateNavActiveState(n,e);const o=new CustomEvent("customviews:tab-change",{detail:{groupId:t,tabId:e,synced:!1},bubbles:!0});document.dispatchEvent(o)}}async init(){!function(){if("undefined"==typeof document)return;if(document.querySelector("#cv-core-styles"))return;const t=document.createElement("style");t.id="cv-core-styles",t.textContent="\n\n/* Core toggle visibility transitions */\n[data-cv-toggle], [data-customviews-toggle], cv-toggle {\n transition: opacity 150ms ease,\n transform 150ms ease,\n max-height 200ms ease,\n margin 150ms ease;\n will-change: opacity, transform, max-height, margin;\n}\n\n.cv-visible {\n opacity: 1 !important;\n transform: translateY(0) !important;\n max-height: var(--cv-max-height, 9999px) !important;\n}\n\n.cv-hidden {\n opacity: 0 !important;\n transform: translateY(-4px) !important;\n pointer-events: none !important;\n padding-top: 0 !important;\n padding-bottom: 0 !important;\n border-top-width: 0 !important;\n border-bottom-width: 0 !important;\n max-height: 0 !important;\n margin-top: 0 !important;\n margin-bottom: 0 !important;\n overflow: hidden !important;\n}\n\n\n\n/* Tab navigation styles - Bootstrap-style tabs matching MarkBind */\n.cv-tabs-nav {\n display: flex;\n flex-wrap: wrap;\n padding-left: 0;\n margin-top: 0.5rem;\n margin-bottom: 1rem;\n list-style: none;\n border-bottom: 1px solid #dee2e6;\n\n align-items: stretch;\n}\n\n.cv-tabs-nav .nav-item {\n margin-bottom: -1px;\n list-style: none;\n display: flex; /* was inline-block → make flex to stretch height */\n align-items: stretch; /* stretch link to full height */\n}\n\n.cv-tabs-nav .nav-link {\n display: flex;\n align-items: center;\n justify-content: center;\n padding: 0.5rem 1rem;\n color: #495057;\n text-decoration: none;\n background-color: transparent;\n border: 1px solid transparent;\n border-top-left-radius: 0.25rem;\n border-top-right-radius: 0.25rem;\n transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;\n cursor: pointer;\n min-height: 2.5rem;\n box-sizing: border-box;\n}\n\n.cv-tabs-nav .nav-link p {\n margin: 0; /* remove default margins */\n display: inline; /* or inline-block */\n}\n\n/* Tab header container with pin icon */\n.cv-tab-header-container {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n.cv-tab-header-text {\n flex: 1;\n}\n\n.cv-tab-pin-icon {\n display: inline-block;\n line-height: 0;\n flex-shrink: 0;\n}\n\n.cv-tab-pin-icon svg {\n vertical-align: middle;\n width: 14px;\n height: 14px;\n}\n\n.cv-tabs-nav .nav-link:hover,\n.cv-tabs-nav .nav-link:focus {\n border-color: #e9ecef #e9ecef #dee2e6;\n isolation: isolate;\n}\n\n.cv-tabs-nav .nav-link.active {\n color: #495057;\n background-color: #fff;\n border-color: #dee2e6 #dee2e6 #fff;\n}\n\n.cv-tabs-nav .nav-link:focus {\n outline: 0;\n box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);\n}\n\n/* Legacy button-based nav (deprecated, kept for compatibility) */\n.cv-tabs-nav-item {\n background: none;\n border: none;\n border-bottom: 2px solid transparent;\n padding: 0.5rem 1rem;\n cursor: pointer;\n font-size: 1rem;\n color: #6c757d;\n transition: color 150ms ease, border-color 150ms ease;\n}\n\n.cv-tabs-nav-item:hover {\n color: #495057;\n border-bottom-color: #dee2e6;\n}\n\n.cv-tabs-nav-item.active {\n color: #007bff;\n border-bottom-color: #007bff;\n font-weight: 500;\n}\n\n.cv-tabs-nav-item:focus {\n outline: 2px solid #007bff;\n outline-offset: 2px;\n}\n\n/* Tab panel base styles */\ncv-tab {\n display: block;\n}\n\n/* Hide cv-tab-header source element; content is extracted to nav link */\ncv-tab-header {\n display: none !important;\n}\n\n/* Allow cv-tab-body to flow naturally */\ncv-tab-body {\n display: block;\n}\n\n/* Override visibility for tab panels - use display instead of collapse animation */\ncv-tab.cv-hidden {\n display: none !important;\n}\n\ncv-tab.cv-visible {\n display: block !important;\n}\n\ncv-tabgroup {\n display: block;\n margin-bottom: 1.5rem;\n}\n\n/* Bottom border line for tab groups */\n.cv-tabgroup-bottom-border {\n border-bottom: 1px solid #dee2e6;\n margin-top: 1rem;\n}\n\n/* Tab content wrapper */\n.cv-tab-content {\n padding: 1rem 0;\n}\n\n/* Viewer-controlled nav visibility: hide nav containers when requested */\n.cv-tabs-nav-hidden {\n display: none !important;\n}\n\n/* Print-friendly: hide tab navigation when printing to reduce clutter */\n@media print {\n .cv-tabs-nav {\n display: none !important;\n }\n}\n\n",document.head.appendChild(t)}(),this.scan(this.rootEl),this.initializeNewComponents();const t=this.persistenceManager.getPersistedTabNavVisibility();null!==t&&c.setNavsVisibility(this.rootEl,t),window.addEventListener("popstate",()=>{this.loadAndCallApplyState()}),this.loadAndCallApplyState(),this.initObserver()}initializeNewComponents(){c.buildNavs(Array.from(this.componentRegistry.tabGroups),this.config.tabGroups,(t,e,n)=>{this.setActiveTab(t,e,n)},(t,e,n)=>{const o=n.querySelector(".cv-tabs-nav"),r=o instanceof HTMLElement?o:n,i=r.getBoundingClientRect().top,s=this.getCurrentActiveTabs();s[t]=e;const a={toggles:this.getCurrentActiveToggles(),tabs:s};this.applyState(a,{scrollAnchor:{element:r,top:i}})})}initObserver(){this.observer=new MutationObserver(t=>{let e=!1;for(const n of t)"childList"===n.type&&(n.addedNodes.forEach(t=>{t instanceof Element&&this.scan(t)&&(e=!0)}),n.removedNodes.forEach(t=>{t instanceof Element&&this.unscan(t)}));e&&(this.initializeNewComponents(),this.lastAppliedState&&this.renderState(this.lastAppliedState))}),this.rootEl&&this.observer.observe(this.rootEl,{childList:!0,subtree:!0})}async loadAndCallApplyState(){const t=n.parseURL();if(t)return void this.applyState(t);const e=this.persistenceManager.getPersistedState();e?this.applyState(e):this.renderState(this.getComputedDefaultState())}applyState(t,e){let o=null;"widget"===e?.source&&(o=h.findHighestVisibleTabGroup());const r=this.cloneState(t);this.renderState(r),this.persistenceManager.persistState(r),this.showUrlEnabled?n.updateURL(r):n.clearURL(),o&&queueMicrotask(()=>{h.scrollToTabGroup(o)}),e?.scrollAnchor&&h.handleScrollAnchor(e.scrollAnchor)}renderState(t){this.observer?.disconnect(),this.lastAppliedState=this.cloneState(t);const e=t?.toggles||[],n=this.visibilityManager.filterVisibleToggles(e),o=Array.from(this.componentRegistry.toggles),r=Array.from(this.componentRegistry.tabGroups);g.applyToggles(o,n),g.renderAssets(o,n,this.assetsManager),c.applyTabSelections(r,t.tabs||{},this.config.tabGroups),c.updateAllNavActiveStates(r,t.tabs||{},this.config.tabGroups),c.updatePinIcons(r,t.tabs||{}),this.notifyStateChangeListeners(),this.observer?.observe(document.body,{childList:!0,subtree:!0})}resetToDefault(){this.persistenceManager.clearAll(),this.config?this.renderState(this.getComputedDefaultState()):console.warn("No configuration loaded, cannot reset to default state"),c.setNavsVisibility(this.rootEl,!0),n.clearURL()}getCurrentActiveToggles(){return this.lastAppliedState?this.lastAppliedState.toggles||[]:this.config&&this.getComputedDefaultState().toggles||[]}clearPersistence(){this.persistenceManager.clearAll(),this.config?this.renderState(this.getComputedDefaultState()):console.warn("No configuration loaded, cannot reset to default state"),n.clearURL()}setOption(t,e){switch(t){case"showUrl":{const t=Boolean(e);if(this.showUrlEnabled===t)return;if(this.showUrlEnabled=t,t){const t=this.getTrackedStateSnapshot();n.updateURL(t)}else n.clearURL();break}default:console.warn(`[CustomViews] Unknown option '${t}' passed to setOption`)}}addStateChangeListener(t){this.stateChangeListeners.push(t)}removeStateChangeListener(t){const e=this.stateChangeListeners.indexOf(t);e>-1&&this.stateChangeListeners.splice(e,1)}notifyStateChangeListeners(){this.stateChangeListeners.forEach(t=>{try{t()}catch(t){console.warn("Error in state change listener:",t)}})}persistTabNavVisibility(t){this.persistenceManager.persistTabNavVisibility(t)}getPersistedTabNavVisibility(){return this.persistenceManager.getPersistedTabNavVisibility()}cloneState(t){return t?JSON.parse(JSON.stringify(t)):{}}getTrackedStateSnapshot(){return this.lastAppliedState?this.cloneState(this.lastAppliedState):this.config?this.cloneState(this.getComputedDefaultState()):{}}}function b(t,e){if(!e)return t;if(t.startsWith("http://")||t.startsWith("https://"))return t;return(e.endsWith("/")?e.slice(0,-1):e)+(t.startsWith("/")?t:"/"+t)}class m extends HTMLElement{connectedCallback(){}}class w extends HTMLElement{connectedCallback(){setTimeout(()=>{const t=new CustomEvent("cv:tabgroup-ready",{bubbles:!0,detail:{groupId:this.getAttribute("id")}});this.dispatchEvent(t)},0)}}class C extends HTMLElement{connectedCallback(){}}class f extends HTMLElement{connectedCallback(){}}class y extends HTMLElement{connectedCallback(){}}class k{static async init(t){let e;customElements.get("cv-tab")||customElements.define("cv-tab",m),customElements.get("cv-tabgroup")||customElements.define("cv-tabgroup",w),customElements.get("cv-toggle")||customElements.define("cv-toggle",C),customElements.get("cv-tab-header")||customElements.define("cv-tab-header",f),customElements.get("cv-tab-body")||customElements.define("cv-tab-body",y);const n=t.baseURL||"";if(t.assetsJsonPath){const o=b(t.assetsJsonPath,n);try{const t=await(await fetch(o)).json();e=new l(t,n)}catch(t){console.error(`[CustomViews] Failed to load assets JSON from ${o}:`,t),e=new l({},n)}}else e=new l({},n);let o;t.config?o=t.config:(console.error("No config provided, using minimal default config"),o={toggles:[],defaultState:{}});const r={assetsManager:e,config:o,rootEl:t.rootEl};void 0!==t.showUrl&&(r.showUrl=t.showUrl);const i=new v(r);return i.init(),i}}class x{core;container;widgetIcon=null;options;_hasVisibleConfig=!1;pageToggleIds=new Set;pageTabIds=new Set;stateModal=null;constructor(t){this.core=t.core,this.container=t.container||document.body,this.options={core:t.core,container:this.container,position:t.position||"middle-left",theme:t.theme||"light",showReset:t.showReset??!0,title:t.title||"Customize View",description:t.description||"",showWelcome:t.showWelcome??!1,welcomeTitle:t.welcomeTitle||"Site Customization",welcomeMessage:t.welcomeMessage||'This site is powered by Custom Views. Use the widget on the side (⚙) to customize your experience. Your preferences will be saved and can be shared via URL.<br><br>Learn more at <a href="https://github.com/customviews-js/customviews" target="_blank">customviews GitHub</a>.',showTabGroups:t.showTabGroups??!0};const e=this.core.getConfig(),n=(e?.toggles||[]).filter(t=>!t.isLocal||!!document.querySelector(`[data-cv-toggle="${t.id}"], [data-cv-toggle-group-id="${t.id}"]`)),o=(this.core.getTabGroups()||[]).filter(t=>!t.isLocal||!!document.querySelector(`cv-tabgroup[id="${t.id}"]`));(n.length>0||this.options.showTabGroups&&o.length>0)&&(this._hasVisibleConfig=!0);const r=document.querySelector("[data-cv-page-local-toggles]")?.getAttribute("data-cv-page-local-toggles")||"";this.pageToggleIds=new Set(r.split(",").map(t=>t.trim()).filter(t=>t));const i=document.querySelector("[data-cv-page-local-tabs]")?.getAttribute("data-cv-page-local-tabs")||"";this.pageTabIds=new Set(i.split(",").map(t=>t.trim()).filter(t=>t))}renderModalIcon(){if(this._hasVisibleConfig)return this.widgetIcon=this.createWidgetIcon(),this.attachEventListeners(),document.body.appendChild(this.widgetIcon),this.options.showWelcome&&this.showWelcomeModalIfFirstVisit(),this.widgetIcon}createWidgetIcon(){const t=document.createElement("div");return t.className=`cv-widget-icon cv-widget-${this.options.position}`,t.innerHTML="⚙",t.title=this.options.title,t.setAttribute("aria-label","Open Custom Views"),function(){if(document.querySelector("#cv-widget-styles"))return;const t=document.createElement("style");t.id="cv-widget-styles",t.textContent="\n/* Rounded rectangle widget icon styles */\n.cv-widget-icon {\n position: fixed;\n /* Slightly transparent by default so the widget is subtle at the page edge */\n background: rgba(255, 255, 255, 0.92);\n color: rgba(0, 0, 0, 0.9);\n opacity: 0.6;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 18px;\n font-weight: bold;\n cursor: pointer;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n z-index: 9998;\n transition: all 0.3s ease;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;\n}\n\n.cv-widget-icon:hover {\n /* Become fully opaque on hover to improve readability */\n background: rgba(255, 255, 255, 1);\n color: rgba(0, 0, 0, 1);\n opacity: 1;\n}\n\n/* Top-right: rounded end on left, sticks out leftward on hover */\n.cv-widget-top-right {\n top: 20px;\n right: 0;\n border-radius: 18px 0 0 18px;\n padding-left: 8px;\n justify-content: flex-start;\n}\n\n/* Top-left: rounded end on right, sticks out rightward on hover */\n.cv-widget-top-left {\n top: 20px;\n left: 0;\n border-radius: 0 18px 18px 0;\n padding-right: 8px;\n justify-content: flex-end;\n}\n\n/* Bottom-right: rounded end on left, sticks out leftward on hover */\n.cv-widget-bottom-right {\n bottom: 20px;\n right: 0;\n border-radius: 18px 0 0 18px;\n padding-left: 8px;\n justify-content: flex-start;\n}\n\n/* Bottom-left: rounded end on right, sticks out rightward on hover */\n.cv-widget-bottom-left {\n bottom: 20px;\n left: 0;\n border-radius: 0 18px 18px 0;\n padding-right: 8px;\n justify-content: flex-end;\n}\n\n/* Middle-left: rounded end on right, sticks out rightward on hover */\n.cv-widget-middle-left {\n top: 50%;\n left: 0;\n transform: translateY(-50%);\n border-radius: 0 18px 18px 0;\n padding-right: 8px;\n justify-content: flex-end;\n}\n\n/* Middle-right: rounded end on left, sticks out leftward on hover */\n.cv-widget-middle-right {\n top: 50%;\n right: 0;\n transform: translateY(-50%);\n border-radius: 18px 0 0 18px;\n padding-left: 8px;\n justify-content: flex-start;\n}\n\n.cv-widget-top-right,\n.cv-widget-middle-right,\n.cv-widget-bottom-right,\n.cv-widget-top-left,\n.cv-widget-middle-left,\n.cv-widget-bottom-left {\n height: 36px;\n width: 36px;\n}\n\n.cv-widget-middle-right:hover,\n.cv-widget-top-right:hover,\n.cv-widget-bottom-right:hover,\n.cv-widget-top-left:hover,\n.cv-widget-middle-left:hover,\n.cv-widget-bottom-left:hover {\n width: 55px;\n}\n\n/* Modal content styles */\n.cv-widget-section {\n margin-bottom: 16px;\n}\n\n.cv-widget-section:last-child {\n margin-bottom: 0;\n}\n\n.cv-widget-section label {\n display: block;\n margin-bottom: 4px;\n font-weight: 500;\n color: #555;\n}\n\n.cv-widget-profile-select,\n.cv-widget-state-select {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid #ddd;\n border-radius: 4px;\n background: white;\n font-size: 14px;\n}\n\n.cv-widget-profile-select:focus,\n.cv-widget-state-select:focus {\n outline: none;\n border-color: #007bff;\n box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);\n}\n\n.cv-widget-profile-select:disabled,\n.cv-widget-state-select:disabled {\n background: #f8f9fa;\n color: #6c757d;\n cursor: not-allowed;\n}\n\n.cv-widget-current {\n margin: 16px 0;\n padding: 12px;\n background: #f8f9fa;\n border-radius: 4px;\n border-left: 4px solid #007bff;\n}\n\n.cv-widget-current label {\n font-size: 12px;\n text-transform: uppercase;\n letter-spacing: 0.5px;\n color: #666;\n margin-bottom: 4px;\n}\n\n.cv-widget-current-view {\n font-weight: 500;\n color: #333;\n}\n\n.cv-widget-reset {\n width: 100%;\n padding: 8px 16px;\n background: #dc3545;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 500;\n}\n\n.cv-widget-reset:hover {\n background: #c82333;\n}\n\n.cv-widget-reset:active {\n background: #bd2130;\n}\n\n/* Responsive design for mobile */\n@media (max-width: 768px) {\n .cv-widget-top-right,\n .cv-widget-top-left {\n top: 10px;\n }\n\n .cv-widget-bottom-right,\n .cv-widget-bottom-left {\n bottom: 10px;\n }\n\n /* All widgets stay flush with screen edges */\n .cv-widget-top-right,\n .cv-widget-bottom-right,\n .cv-widget-middle-right {\n right: 0;\n }\n\n .cv-widget-top-left,\n .cv-widget-bottom-left,\n .cv-widget-middle-left {\n left: 0;\n }\n\n /* Slightly smaller on mobile */\n .cv-widget-icon {\n width: 60px;\n height: 32px;\n }\n\n .cv-widget-icon:hover {\n width: 75px;\n }\n}\n\n/* Modal styles */\n.cv-widget-modal-overlay {\n position: fixed;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.5);\n display: flex;\n align-items: center;\n justify-content: center;\n z-index: 10002;\n animation: fadeIn 0.2s ease;\n}\n\n.cv-widget-modal-overlay.cv-hidden {\n display: none;\n}\n\n@keyframes fadeIn {\n from { opacity: 0; }\n to { opacity: 1; }\n}\n\n.cv-widget-modal {\n background: white;\n border-radius: 0.75rem;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n max-width: 32rem;\n width: 90vw;\n max-height: 80vh;\n animation: slideIn 0.2s ease;\n display: flex;\n flex-direction: column;\n}\n\n@keyframes slideIn {\n from { \n opacity: 0;\n transform: scale(0.9) translateY(-20px);\n }\n to { \n opacity: 1;\n transform: scale(1) translateY(0);\n }\n}\n\n.cv-modal-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.5rem 1rem;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n}\n\n.cv-modal-header-content {\n display: flex;\n align-items: center;\n gap: 0.75rem;\n}\n\n.cv-modal-icon {\n position: relative;\n width: 1rem;\n height: 1rem;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n}\n\n.cv-modal-icon-svg {\n width: 100%;\n height: 100%;\n opacity: 1;\n}\n\n.cv-modal-title {\n font-size: 1.125rem;\n font-weight: bold;\n color: rgba(0, 0, 0, 0.9);\n margin: 0;\n}\n\n.cv-modal-close {\n width: 2rem;\n height: 2rem;\n display: flex;\n align-items: center;\n justify-content: center;\n border-radius: 9999px;\n background: transparent;\n border: none;\n color: rgba(0, 0, 0, 0.6);\n cursor: pointer;\n transition: all 0.2s ease;\n}\n\n.cv-modal-close:hover {\n background: rgba(62, 132, 244, 0.1);\n color: #3e84f4;\n}\n\n.cv-modal-close-icon {\n width: 1.25rem;\n height: 1.25rem;\n}\n\n.cv-modal-main {\n padding: 1rem;\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n overflow-y: auto;\n max-height: calc(80vh - 8rem);\n}\n\n.cv-modal-description {\n font-size: 0.875rem;\n color: rgba(0, 0, 0, 0.8);\n margin: 0;\n line-height: 1.4;\n}\n\n.cv-content-section,\n.cv-tab-groups-section {\n display: flex;\n flex-direction: column;\n gap: 0.75rem;\n}\n\n.cv-section-heading {\n font-size: 1rem;\n font-weight: bold;\n color: rgba(0, 0, 0, 0.9);\n margin: 0;\n}\n\n.cv-widget-modal-actions {\n margin-top: 20px;\n padding-top: 16px;\n border-top: 1px solid #e9ecef;\n}\n\n.cv-widget-restore {\n width: 100%;\n padding: 10px 16px;\n background: #28a745;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 500;\n}\n\n.cv-widget-restore:hover {\n background: #218838;\n}\n\n.cv-widget-create-state {\n width: 100%;\n padding: 10px 16px;\n background: #007bff;\n color: white;\n border: none;\n border-radius: 4px;\n cursor: pointer;\n font-size: 14px;\n font-weight: 500;\n margin-bottom: 10px;\n}\n\n.cv-widget-create-state:hover {\n background: #0056b3;\n}\n\n.cv-widget-theme-dark .cv-widget-modal {\n background: #101722;\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-modal-header {\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-modal-title {\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-modal-close {\n color: rgba(255, 255, 255, 0.6);\n}\n\n.cv-widget-theme-dark .cv-modal-close:hover {\n background: rgba(62, 132, 244, 0.2);\n color: #3e84f4;\n}\n\n.cv-widget-theme-dark .cv-modal-description {\n color: rgba(255, 255, 255, 0.8);\n}\n\n.cv-widget-theme-dark .cv-section-heading {\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-toggles-container\n.cv-widget-theme-dark .cv-tabgroups-container {\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-toggle-card,\n.cv-widget-theme-dark .cv-tabgroup-card {\n background: #101722;\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-toggle-title,\n.cv-widget-theme-dark .cv-tabgroup-title {\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-toggle-description,\n.cv-widget-theme-dark .cv-tabgroup-description {\n color: rgba(255, 255, 255, 0.6);\n}\n\n.cv-widget-theme-dark .cv-toggle-slider {\n background: rgba(255, 255, 255, 0.2);\n}\n\n.cv-widget-theme-dark .cv-tab-group-description {\n color: rgba(255, 255, 255, 0.8);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-select {\n background: #101722;\n border-color: rgba(255, 255, 255, 0.2);\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-modal-footer {\n border-color: rgba(255, 255, 255, 0.1);\n background: #101722;\n}\n\n.cv-widget-theme-dark .cv-reset-btn {\n color: #e2e8f0;\n background: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-reset-btn:hover {\n background: rgba(255, 255, 255, 0.2);\n}\n\n/* Custom state creator styles */\n.cv-custom-state-modal {\n max-width: 500px;\n}\n\n.cv-custom-state-form .cv-section-header {\n font-size: 16px;\n font-weight: 600;\n color: #333;\n border-bottom: 1px solid #e9ecef;\n padding-bottom: 5px;\n}\n\n.cv-custom-state-form p {\n font-size: 15px;\n line-height: 1.6;\n color: #555;\n margin-bottom: 24px;\n text-align: justify;\n}\n\n.cv-custom-state-section {\n margin-bottom: 16px;\n}\n\n.cv-custom-state-section label {\n display: block;\n margin-bottom: 4px;\n font-weight: 500;\n color: #555;\n}\n\n.cv-custom-state-input {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid #ddd;\n border-radius: 4px;\n background: white;\n font-size: 14px;\n}\n\n.cv-custom-state-input:focus {\n outline: none;\n border-color: #007bff;\n box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);\n}\n\n/* Toggles Container */\n.cv-toggles-container {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n border-radius: 0.5rem;\n border: 1px solid rgba(0, 0, 0, 0.1);\n overflow: hidden;\n}\n\n.cv-toggle-card,\n.cv-tabgroup-card {\n background: white;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n}\n\n.cv-toggle-card:last-child {\n border-bottom: none;\n}\n\n.cv-toggle-content {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.75rem;\n}\n\n.cv-toggle-title {\n font-weight: 500;\n font-size: 0.875rem;\n color: rgba(0, 0, 0, 0.9);\n margin: 0 0 0.125rem 0;\n}\n\n.cv-toggle-description {\n font-size: 0.75rem;\n color: rgba(0, 0, 0, 0.6);\n margin: 0;\n}\n\n.cv-toggle-label{\n position: relative;\n display: inline-block;\n width: 2.75rem;\n height: 1.5rem;\n cursor: pointer;\n}\n\n.cv-toggle-input {\n opacity: 0;\n width: 0;\n height: 0;\n}\n\n.cv-toggle-slider {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n background: rgba(0, 0, 0, 0.2);\n border-radius: 9999px;\n transition: background-color 0.2s ease;\n}\n\n.cv-toggle-slider:before {\n position: absolute;\n content: \"\";\n height: 1rem;\n width: 1rem;\n left: 0.25rem;\n bottom: 0.25rem;\n background: white;\n border-radius: 50%;\n transition: transform 0.2s ease;\n}\n\n.cv-toggle-input:checked + .cv-toggle-slider {\n background: #3e84f4;\n}\n\n.cv-toggle-input:checked + .cv-toggle-slider:before {\n transform: translateX(1.25rem);\n}\n\n/* Dark theme toggle switch styles */\n.cv-widget-theme-dark .cv-toggle-switch {\n background: #4a5568;\n}\n\n.cv-widget-theme-dark .cv-toggle-switch:hover {\n background: #5a6578;\n}\n\n.cv-widget-theme-dark .cv-toggle-switch.cv-toggle-active {\n background: #63b3ed;\n}\n\n.cv-widget-theme-dark .cv-toggle-switch.cv-toggle-active:hover {\n background: #4299e1;\n}\n\n/* Tab Groups Container */\n.cv-tab-groups-list {\n display: flex;\n flex-direction: column;\n gap: 1px;\n border: 1px solid rgba(0, 0, 0, 0.1);\n border-radius: 0.5rem;\n overflow: hidden;\n}\n\n/* Tab Group Card - Header (Navigation Headers toggle) */\n.cv-tabgroup-card.cv-tabgroup-header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n padding: 0.75rem;\n border-bottom: 0px;\n}\n\n.cv-tabgroup-card.cv-tabgroup-header .cv-tabgroup-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n width: 100%;\n gap: 1rem;\n}\n\n/* Navigation toggle icon container */\n.cv-nav-toggle-container {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n.cv-nav-icon {\n width: 2rem;\n height: 2rem;\n color: rgba(0, 0, 0, 0.8);\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n transition: color 0.2s ease;\n}\n\n/* Logo box - centered grey box on its own row */\n.cv-tabgroup-logo-box {\n width: 3.5rem;\n height: 3.5rem;\n background: rgba(0, 0, 0, 0.08);\n border-radius: 0.5rem;\n display: flex;\n align-items: center;\n justify-content: center;\n flex-shrink: 0;\n margin-bottom: 0.5rem;\n}\n\n/* Title container for title alignment (without icon) */\n.cv-tabgroup-title-container {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n}\n\n/* Hover state for icon - apply to the entire tabgroup-row */\n.cv-tabgroup-card.cv-tabgroup-header:hover .cv-nav-icon {\n color: #3e84f4;\n}\n\n.cv-widget-theme-dark .cv-nav-icon {\n color: rgba(255, 255, 255, 0.8);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-header:hover .cv-nav-icon {\n color: #60a5fa;\n}\n\n/* Tab Group Card - Items */\n.cv-tabgroup-card.cv-tabgroup-item {\n display: flex;\n flex-direction: column;\n gap: 0.5rem;\n padding: 0.75rem;\n background: white;\n border-bottom: 1px solid rgba(0, 0, 0, 0.05);\n}\n\n.cv-tabgroup-card.cv-tabgroup-item:last-child {\n border-bottom: none;\n}\n\n/* Tab Group Info */\n.cv-tabgroup-info {\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 0.25rem;\n}\n\n.cv-tabgroup-title {\n font-weight: 500;\n font-size: 0.875rem;\n color: rgba(0, 0, 0, 0.9);\n margin: 0 0 0 0;\n}\n\n.cv-tabgroup-description {\n font-size: 0.75rem;\n color: rgba(0, 0, 0, 0.6);\n margin: 0;\n line-height: 1.3;\n}\n\n/* Tab Group Label (for select dropdowns) */\n.cv-tabgroup-label {\n font-size: 0.875rem;\n color: rgba(0, 0, 0, 0.8);\n margin: 0;\n line-height: 1.4;\n font-weight: 500;\n display: block;\n cursor: pointer;\n}\n\n/* Tab Group Select */\n.cv-tabgroup-select {\n width: 100%;\n border-radius: 0.5rem;\n background: white;\n border: 1px solid rgba(0, 0, 0, 0.15);\n color: rgba(0, 0, 0, 0.9);\n padding: 0.5rem 0.75rem;\n font-size: 0.875rem;\n cursor: pointer;\n transition: all 0.15s ease;\n font-family: inherit;\n}\n\n.cv-tabgroup-select:hover {\n border-color: rgba(0, 0, 0, 0.25);\n}\n\n.cv-tabgroup-select:focus {\n outline: none;\n border-color: #3e84f4;\n box-shadow: 0 0 0 2px rgba(62, 132, 244, 0.2);\n}\n\n/* Modern Toggle Switch */\n.cv-toggle-switch {\n position: relative;\n display: inline-flex;\n align-items: center;\n width: 44px;\n height: 24px;\n background: rgba(0, 0, 0, 0.1);\n border-radius: 9999px;\n padding: 2px;\n box-sizing: border-box;\n cursor: pointer;\n transition: background-color 0.2s ease;\n border: none;\n}\n\n.cv-toggle-switch input {\n display: none;\n}\n\n.cv-toggle-switch .cv-switch-bg {\n position: absolute;\n inset: 0;\n border-radius: 9999px;\n background: rgba(0, 0, 0, 0.1);\n transition: background-color 0.2s ease;\n pointer-events: none;\n}\n\n.cv-toggle-switch .cv-switch-knob {\n position: relative;\n width: 20px;\n height: 20px;\n background: white;\n border-radius: 50%;\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);\n transition: transform 0.2s ease;\n z-index: 1;\n}\n\n.cv-toggle-switch input:checked + .cv-switch-bg {\n background: #3e84f4;\n}\n\n.cv-toggle-switch input:checked ~ .cv-switch-knob {\n transform: translateX(20px);\n}\n\n/* Dark Theme - Tab Groups */\n.cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-header {\n background: #101722;\n border-bottom-color: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-card.cv-tabgroup-item {\n background: #101722;\n border-bottom-color: rgba(255, 255, 255, 0.05);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-title {\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-tabgroup-description {\n color: rgba(255, 255, 255, 0.6);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-label {\n color: rgba(255, 255, 255, 0.8);\n}\n\n.cv-widget-theme-dark .cv-tab-groups-list {\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-select {\n background: #101722;\n border-color: rgba(255, 255, 255, 0.15);\n color: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-tabgroup-select:hover {\n border-color: rgba(255, 255, 255, 0.25);\n}\n\n.cv-widget-theme-dark .cv-tabgroup-select:focus {\n border-color: #60a5fa;\n box-shadow: 0 0 0 2px rgba(96, 165, 250, 0.2);\n}\n\n/* Dark Theme - Toggle Switch */\n.cv-widget-theme-dark .cv-toggle-switch .cv-switch-bg {\n background: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-toggle-switch .cv-switch-knob {\n background: #e2e8f0;\n}\n\n.cv-widget-theme-dark .cv-toggle-switch input:checked + .cv-switch-bg {\n background: #63b3ed;\n}\n\n.cv-modal-footer {\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 0.75rem;\n border-top: 1px solid rgba(0, 0, 0, 0.1);\n}\n\n.cv-reset-btn,\n.cv-share-btn {\n display: flex;\n align-items: center;\n gap: 0.5rem;\n padding: 0.375rem 0.75rem;\n border-radius: 0.5rem;\n font-weight: 600;\n font-size: 0.875rem;\n cursor: pointer;\n transition: all 0.2s ease;\n border: none;\n}\n\n.cv-reset-btn {\n color: rgba(0, 0, 0, 0.9);\n background: rgba(0, 0, 0, 0.1);\n}\n\n.cv-reset-btn:hover {\n background: rgba(0, 0, 0, 0.2);\n}\n\n.cv-share-btn {\n color: white;\n background: #3e84f4;\n}\n\n.cv-share-btn:hover {\n background: rgba(62, 132, 244, 0.9);\n}\n\n.cv-btn-icon {\n width: 1rem;\n height: 1rem;\n display: flex;\n align-items: center;\n justify-content: center;\n transition: transform 0.2s ease;\n}\n\n/* Dark theme custom state styles */\n/* Welcome modal styles */\n.cv-welcome-modal {\n max-width: 32rem;\n width: 90vw;\n background: white;\n border-radius: 0.75rem;\n box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);\n animation: slideIn 0.2s ease;\n display: flex;\n flex-direction: column;\n}\n\n.cv-modal-main {\n padding: 1rem;\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: 1rem;\n overflow-y: auto;\n max-height: calc(80vh - 8rem);\n}\n\n.cv-welcome-message {\n font-size: 0.875rem;\n color: rgba(0, 0, 0, 0.8);\n margin: 0;\n line-height: 1.4;\n text-align: center;\n}\n\n.cv-welcome-message a {\n color: #3e84f4;\n text-align: justify;\n text-decoration: none;\n}\n\n.cv-welcome-message a:hover {\n text-decoration: underline;\n}\n\n.cv-welcome-widget-preview {\n display: flex;\n align-items: center;\n justify-content: center;\n gap: 1rem;\n padding: 1rem;\n background: #f8f9fa;\n border-radius: 0.5rem;\n margin: 1rem 0;\n}\n\n.cv-welcome-widget-icon {\n width: 2rem;\n height: 2rem;\n background: rgba(62, 132, 244, 0.1);\n border-radius: 9999px;\n display: flex;\n align-items: center;\n justify-content: center;\n animation: cv-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n color: #3e84f4;\n}\n\n.cv-welcome-widget-label {\n font-size: 0.875rem;\n font-weight: 500;\n color: rgba(0, 0, 0, 0.8);\n margin: 0;\n}\n\n.cv-welcome-got-it {\n width: 100%;\n background: #3e84f4;\n color: white;\n font-weight: 600;\n padding: 0.75rem 1rem;\n border-radius: 0.5rem;\n border: none;\n cursor: pointer;\n font-size: 0.875rem;\n transition: background-color 0.2s ease;\n outline: none;\n}\n\n.cv-welcome-got-it:hover {\n background: rgba(62, 132, 244, 0.9);\n}\n\n.cv-welcome-got-it:focus {\n box-shadow: 0 0 0 2px rgba(62, 132, 244, 0.5);\n}\n\n/* Animations */\n@keyframes cv-pulse {\n 0%, 100% {\n opacity: 1;\n }\n 50% {\n opacity: 0.5;\n }\n}\n\n/* Dark theme welcome modal styles */\n.cv-widget-theme-dark .cv-welcome-modal {\n background: #101722;\n}\n\n.cv-widget-theme-dark .cv-welcome-message {\n color: rgba(255, 255, 255, 0.8);\n}\n\n.cv-widget-theme-dark .cv-welcome-message a {\n color: #60a5fa;\n}\n\n.cv-widget-theme-dark .cv-welcome-widget-preview {\n background: rgba(255, 255, 255, 0.1);\n}\n\n.cv-widget-theme-dark .cv-welcome-widget-label {\n color: #e2e8f0;\n}\n\n/* Dark theme logo box */\n.cv-widget-theme-dark .cv-tabgroup-logo-box {\n background: rgba(255, 255, 255, 0.1);\n}\n\n/* Spinning animation for reset button icon */\n@keyframes cv-spin {\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(-360deg);\n }\n}\n\n.cv-spinning {\n animation: cv-spin 0.6s ease-in-out;\n}\n\n/* Hide widget icon in print view */\n@media print {\n .cv-widget-icon {\n display: none !important;\n }\n}\n",document.head.appendChild(t)}(),t}destroy(){this.widgetIcon&&(this.widgetIcon.remove(),this.widgetIcon=null),this.stateModal&&(this.stateModal.remove(),this.stateModal=null)}attachEventListeners(){this.widgetIcon&&this.widgetIcon.addEventListener("click",()=>this.openStateModal())}closeModal(){this.stateModal&&this.stateModal.classList.add("cv-hidden")}openStateModal(){this.stateModal||this._createStateModal(),this._updateStateModalContent(),this.stateModal.classList.remove("cv-hidden")}_createStateModal(){this.stateModal=document.createElement("div"),this.stateModal.className="cv-widget-modal-overlay cv-hidden",this.applyThemeToModal(),document.body.appendChild(this.stateModal),this._attachStateModalFrameEventListeners()}_updateStateModalContent(){if(!this.stateModal)return;const t=this.pageToggleIds,e=this.pageTabIds,n=this.core.getConfig(),o=(n?.toggles||[]).filter(e=>!e.isLocal||(t.has(e.id)||!!document.querySelector(`[data-cv-toggle="${e.id}"], [data-cv-toggle-group-id="${e.id}"]`))),r=o.map(t=>`\n <div class="cv-toggle-card">\n <div class="cv-toggle-content">\n <div>\n <p class="cv-toggle-title">${t.label||t.id}</p>\n </div>\n <label class="cv-toggle-label">\n <input class="cv-toggle-input" type="checkbox" data-toggle="${t.id}"/>\n <span class="cv-toggle-slider"></span>\n </label>\n </div>\n </div>\n `).join(""),i=(this.core.getTabGroups()||[]).filter(t=>!t.isLocal||(e.has(t.id)||!!document.querySelector(`cv-tabgroup[id="${t.id}"]`)));let s="";if(this.options.showTabGroups&&i&&i.length>0){const t=c.areNavsVisible(document.body);s=`\n <div class="cv-tabgroup-card cv-tabgroup-header">\n <div class="cv-tabgroup-row">\n <div class="cv-tabgroup-logo-box" id="cv-nav-icon-box">\n <div class="cv-nav-icon" id="cv-nav-icon">${t?'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62.0001" x2="77" y2="62.0001" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8888" x2="77" y2="77.8888" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4454" x2="221" y2="97.4454" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n <line x1="247.5" y1="43.0001" x2="247.5" y2="13.0001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M185 12.5001L247 12.5001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <line x1="204.09" y1="36.6095" x2="181.698" y2="10.0228" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M125 9.50012L181 9.50012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M144.305 35.2579L120.095 6.56679" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M120 6.50037L64 6.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M87.1957 36.1024L59 2.50008" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M59 2.50037L3 2.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M2.5 38.5001L2.5 3.00012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n </svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181" fill="currentColor">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62" x2="77" y2="62" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8887" x2="77" y2="77.8887" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4453" x2="221" y2="97.4453" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n </svg>'}</div>\n </div>\n <div class="cv-tabgroup-info">\n <div class="cv-tabgroup-title-container">\n <p class="cv-tabgroup-title">Navigation Headers</p>\n </div>\n <p class="cv-tabgroup-description">Show or hide navigation headers</p>\n </div>\n <label class="cv-toggle-switch cv-nav-toggle">\n <input class="cv-nav-pref-input" type="checkbox" ${t?"checked":""} aria-label="Show or hide navigation headers" />\n <span class="cv-switch-bg"></span>\n <span class="cv-switch-knob"></span>\n </label>\n </div>\n </div>\n <div class="cv-tab-groups-list">\n ${i.map(t=>`\n <div class="cv-tabgroup-card cv-tabgroup-item">\n <label class="cv-tabgroup-label" for="tab-group-${t.id}">\n ${t.label||t.id}\n </label>\n <select id="tab-group-${t.id}" class="cv-tabgroup-select" data-group-id="${t.id}">\n ${t.tabs.map(t=>`<option value="${t.id}">${t.label||t.id}</option>`).join("")}\n </select>\n </div>\n `).join("")}\n </div>\n `}this.stateModal.innerHTML=`\n <div class="cv-widget-modal cv-custom-state-modal">\n <header class="cv-modal-header">\n <div class="cv-modal-header-content">\n <div class="cv-modal-icon">\n <svg class="cv-modal-icon-svg" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M12 8.00002C9.79085 8.00002 7.99999 9.79088 7.99999 12C7.99999 14.2092 9.79085 16 12 16C14.2091 16 16 14.2092 16 12C16 9.79088 14.2091 8.00002 12 8.00002ZM9.99999 12C9.99999 10.8955 10.8954 10 12 10C13.1046 10 14 10.8955 14 12C14 13.1046 13.1046 14 12 14C10.8954 14 9.99999 13.1046 9.99999 12Z" fill="#0F1729"/>\n <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M10.7673 1.01709C10.9925 0.999829 11.2454 0.99993 11.4516 1.00001L12.5484 1.00001C12.7546 0.99993 13.0075 0.999829 13.2327 1.01709C13.4989 1.03749 13.8678 1.08936 14.2634 1.26937C14.7635 1.49689 15.1915 1.85736 15.5007 2.31147C15.7454 2.67075 15.8592 3.0255 15.9246 3.2843C15.9799 3.50334 16.0228 3.75249 16.0577 3.9557L16.1993 4.77635L16.2021 4.77788C16.2369 4.79712 16.2715 4.81659 16.306 4.8363L16.3086 4.83774L17.2455 4.49865C17.4356 4.42978 17.6693 4.34509 17.8835 4.28543C18.1371 4.2148 18.4954 4.13889 18.9216 4.17026C19.4614 4.20998 19.9803 4.39497 20.4235 4.70563C20.7734 4.95095 21.0029 5.23636 21.1546 5.4515C21.2829 5.63326 21.4103 5.84671 21.514 6.02029L22.0158 6.86003C22.1256 7.04345 22.2594 7.26713 22.3627 7.47527C22.4843 7.7203 22.6328 8.07474 22.6777 8.52067C22.7341 9.08222 22.6311 9.64831 22.3803 10.1539C22.1811 10.5554 21.9171 10.8347 21.7169 11.0212C21.5469 11.1795 21.3428 11.3417 21.1755 11.4746L20.5 12L21.1755 12.5254C21.3428 12.6584 21.5469 12.8205 21.7169 12.9789C21.9171 13.1653 22.1811 13.4446 22.3802 13.8461C22.631 14.3517 22.7341 14.9178 22.6776 15.4794C22.6328 15.9253 22.4842 16.2797 22.3626 16.5248C22.2593 16.7329 22.1255 16.9566 22.0158 17.14L21.5138 17.9799C21.4102 18.1535 21.2828 18.3668 21.1546 18.5485C21.0028 18.7637 20.7734 19.0491 20.4234 19.2944C19.9803 19.6051 19.4613 19.7901 18.9216 19.8298C18.4954 19.8612 18.1371 19.7852 17.8835 19.7146C17.6692 19.6549 17.4355 19.5703 17.2454 19.5014L16.3085 19.1623L16.306 19.1638C16.2715 19.1835 16.2369 19.2029 16.2021 19.2222L16.1993 19.2237L16.0577 20.0443C16.0228 20.2475 15.9799 20.4967 15.9246 20.7157C15.8592 20.9745 15.7454 21.3293 15.5007 21.6886C15.1915 22.1427 14.7635 22.5032 14.2634 22.7307C13.8678 22.9107 13.4989 22.9626 13.2327 22.983C13.0074 23.0002 12.7546 23.0001 12.5484 23H11.4516C11.2454 23.0001 10.9925 23.0002 10.7673 22.983C10.5011 22.9626 10.1322 22.9107 9.73655 22.7307C9.23648 22.5032 8.80849 22.1427 8.49926 21.6886C8.25461 21.3293 8.14077 20.9745 8.07542 20.7157C8.02011 20.4967 7.97723 20.2475 7.94225 20.0443L7.80068 19.2237L7.79791 19.2222C7.7631 19.2029 7.72845 19.1835 7.69396 19.1637L7.69142 19.1623L6.75458 19.5014C6.5645 19.5702 6.33078 19.6549 6.11651 19.7146C5.86288 19.7852 5.50463 19.8611 5.07841 19.8298C4.53866 19.7901 4.01971 19.6051 3.57654 19.2944C3.2266 19.0491 2.99714 18.7637 2.84539 18.5485C2.71718 18.3668 2.58974 18.1534 2.4861 17.9798L1.98418 17.14C1.87447 16.9566 1.74067 16.7329 1.63737 16.5248C1.51575 16.2797 1.36719 15.9253 1.32235 15.4794C1.26588 14.9178 1.36897 14.3517 1.61976 13.8461C1.81892 13.4446 2.08289 13.1653 2.28308 12.9789C2.45312 12.8205 2.65717 12.6584 2.82449 12.5254L3.47844 12.0054V11.9947L2.82445 11.4746C2.65712 11.3417 2.45308 11.1795 2.28304 11.0212C2.08285 10.8347 1.81888 10.5554 1.61972 10.1539C1.36893 9.64832 1.26584 9.08224 1.3223 8.52069C1.36714 8.07476 1.51571 7.72032 1.63732 7.47528C1.74062 7.26715 1.87443 7.04347 1.98414 6.86005L2.48605 6.02026C2.58969 5.84669 2.71714 5.63326 2.84534 5.45151C2.9971 5.23637 3.22655 4.95096 3.5765 4.70565C4.01966 4.39498 4.53862 4.20999 5.07837 4.17027C5.50458 4.1389 5.86284 4.21481 6.11646 4.28544C6.33072 4.34511 6.56444 4.4298 6.75451 4.49867L7.69141 4.83775L7.69394 4.8363C7.72844 4.8166 7.7631 4.79712 7.79791 4.77788L7.80068 4.77635L7.94225 3.95571C7.97723 3.7525 8.02011 3.50334 8.07542 3.2843C8.14077 3.0255 8.25461 2.67075 8.49926 2.31147C8.80849 1.85736 9.23648 1.49689 9.73655 1.26937C10.1322 1.08936 10.5011 1.03749 10.7673 1.01709ZM14.0938 4.3363C14.011 3.85634 13.9696 3.61637 13.8476 3.43717C13.7445 3.2858 13.6019 3.16564 13.4352 3.0898C13.2378 3.00002 12.9943 3.00002 12.5073 3.00002H11.4927C11.0057 3.00002 10.7621 3.00002 10.5648 3.0898C10.3981 3.16564 10.2555 3.2858 10.1524 3.43717C10.0304 3.61637 9.98895 3.85634 9.90615 4.3363L9.75012 5.24064C9.69445 5.56333 9.66662 5.72467 9.60765 5.84869C9.54975 5.97047 9.50241 6.03703 9.40636 6.13166C9.30853 6.22804 9.12753 6.3281 8.76554 6.52822C8.73884 6.54298 8.71227 6.55791 8.68582 6.57302C8.33956 6.77078 8.16643 6.86966 8.03785 6.90314C7.91158 6.93602 7.83293 6.94279 7.70289 6.93196C7.57049 6.92094 7.42216 6.86726 7.12551 6.7599L6.11194 6.39308C5.66271 6.2305 5.43809 6.14921 5.22515 6.16488C5.04524 6.17811 4.87225 6.23978 4.72453 6.34333C4.5497 6.46589 4.42715 6.67094 4.18206 7.08103L3.72269 7.84965C3.46394 8.2826 3.33456 8.49907 3.31227 8.72078C3.29345 8.90796 3.32781 9.09665 3.41141 9.26519C3.51042 9.4648 3.7078 9.62177 4.10256 9.9357L4.82745 10.5122C5.07927 10.7124 5.20518 10.8126 5.28411 10.9199C5.36944 11.036 5.40583 11.1114 5.44354 11.2504C5.47844 11.379 5.47844 11.586 5.47844 12C5.47844 12.414 5.47844 12.621 5.44354 12.7497C5.40582 12.8887 5.36944 12.9641 5.28413 13.0801C5.20518 13.1875 5.07927 13.2876 4.82743 13.4879L4.10261 14.0643C3.70785 14.3783 3.51047 14.5352 3.41145 14.7349C3.32785 14.9034 3.29349 15.0921 3.31231 15.2793C3.33461 15.501 3.46398 15.7174 3.72273 16.1504L4.1821 16.919C4.4272 17.3291 4.54974 17.5342 4.72457 17.6567C4.8723 17.7603 5.04528 17.8219 5.2252 17.8352C5.43813 17.8508 5.66275 17.7695 6.11199 17.607L7.12553 17.2402C7.42216 17.1328 7.5705 17.0791 7.7029 17.0681C7.83294 17.0573 7.91159 17.064 8.03786 17.0969C8.16644 17.1304 8.33956 17.2293 8.68582 17.427C8.71228 17.4421 8.73885 17.4571 8.76554 17.4718C9.12753 17.6719 9.30853 17.772 9.40635 17.8684C9.50241 17.963 9.54975 18.0296 9.60765 18.1514C9.66662 18.2754 9.69445 18.4367 9.75012 18.7594L9.90615 19.6637C9.98895 20.1437 10.0304 20.3837 10.1524 20.5629C10.2555 20.7142 10.3981 20.8344 10.5648 20.9102C10.7621 21 11.0057 21 11.4927 21H12.5073C12.9943 21 13.2378 21 13.4352 20.9102C13.6019 20.8344 13.7445 20.7142 13.8476 20.5629C13.9696 20.3837 14.011 20.1437 14.0938 19.6637L14.2499 18.7594C14.3055 18.4367 14.3334 18.2754 14.3923 18.1514C14.4502 18.0296 14.4976 17.963 14.5936 17.8684C14.6915 17.772 14.8725 17.6719 15.2344 17.4718C15.2611 17.4571 15.2877 17.4421 15.3141 17.427C15.6604 17.2293 15.8335 17.1304 15.9621 17.0969C16.0884 17.064 16.167 17.0573 16.2971 17.0681C16.4295 17.0791 16.5778 17.1328 16.8744 17.2402L17.888 17.607C18.3372 17.7696 18.5619 17.8509 18.7748 17.8352C18.9547 17.8219 19.1277 17.7603 19.2754 17.6567C19.4502 17.5342 19.5728 17.3291 19.8179 16.919L20.2773 16.1504C20.536 15.7175 20.6654 15.501 20.6877 15.2793C20.7065 15.0921 20.6721 14.9034 20.5885 14.7349C20.4895 14.5353 20.2921 14.3783 19.8974 14.0643L19.1726 13.4879C18.9207 13.2876 18.7948 13.1875 18.7159 13.0801C18.6306 12.9641 18.5942 12.8887 18.5564 12.7497C18.5215 12.6211 18.5215 12.414 18.5215 12C18.5215 11.586 18.5215 11.379 18.5564 11.2504C18.5942 11.1114 18.6306 11.036 18.7159 10.9199C18.7948 10.8126 18.9207 10.7124 19.1725 10.5122L19.8974 9.9357C20.2922 9.62176 20.4896 9.46479 20.5886 9.26517C20.6722 9.09664 20.7065 8.90795 20.6877 8.72076C20.6654 8.49906 20.5361 8.28259 20.2773 7.84964L19.8179 7.08102C19.5728 6.67093 19.4503 6.46588 19.2755 6.34332C19.1277 6.23977 18.9548 6.1781 18.7748 6.16486C18.5619 6.14919 18.3373 6.23048 17.888 6.39307L16.8745 6.75989C16.5778 6.86725 16.4295 6.92093 16.2971 6.93195C16.167 6.94278 16.0884 6.93601 15.9621 6.90313C15.8335 6.86965 15.6604 6.77077 15.3142 6.57302C15.2877 6.55791 15.2611 6.54298 15.2345 6.52822C14.8725 6.3281 14.6915 6.22804 14.5936 6.13166C14.4976 6.03703 14.4502 5.97047 14.3923 5.84869C14.3334 5.72467 14.3055 5.56332 14.2499 5.24064L14.0938 4.3363Z" fill="#0F1729"/>\n</svg>\n </div>\n <div class="cv-modal-title">${this.options.title}</div>\n </div>\n <button class="cv-modal-close" aria-label="Close modal">\n <svg class="cv-modal-close-icon" fill="currentColor" height="20px" viewBox="0 0 256 256" width="20px" xmlns="http://www.w3.org/2000/svg">\n <path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>\n </svg>\n </button>\n </header>\n <main class="cv-modal-main">\n ${this.options.description?`<p class="cv-modal-description">${this.options.description}</p>`:""}\n \n ${o.length?`\n <div class="cv-content-section">\n <div class="cv-section-heading">Toggles</div>\n <div class="cv-toggles-container">\n ${r}\n </div>\n </div>\n `:""}\n \n ${this.options.showTabGroups&&i&&i.length>0?`\n <div class="cv-content-section">\n <div class="cv-section-heading">Tab Groups</div>\n <div class="cv-tabgroups-container">\n ${s}\n </div>\n </div>\n `:""}\n </main>\n\n <footer class="cv-modal-footer">\n ${this.options.showReset?'\n <button class="cv-reset-btn">\n <span class="cv-reset-btn-icon"><svg class="cv-btn-icon" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path d="M22.719 12A10.719 10.719 0 0 1 1.28 12h.838a9.916 9.916 0 1 0 1.373-5H8v1H2V2h1v4.2A10.71 10.71 0 0 1 22.719 12z"/><path fill="none" d="M0 0h24v24H0z"/>\n </svg></span>\n <span>Reset to Default</span>\n </button>\n ':""}\n <button class="cv-share-btn">\n <span>Copy Shareable URL</span>\n <span class="cv-share-btn-icon"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="18" height="18" viewBox="0 0 18 18" version="1.1" fill="currentColor">\n <g id="surface1">\n <path d="M 11.273438 0 L 2.546875 0 C 1.746094 0 1.089844 0.613281 1.089844\n 1.363281 L 1.089844 10.910156 L 2.546875 10.910156 L 2.546875 1.363281 L 11.273438\n 1.363281 Z M 13.453125 2.726562 L 5.453125 2.726562 C 4.65625 2.726562 4 3.339844 4\n 4.089844 L 4 13.636719 C 4 14.386719 4.65625 15 5.453125 15 L 13.453125 15 C 14.253906\n 15 14.910156 14.386719 14.910156 13.636719 L 14.910156 4.089844 C 14.910156 3.339844\n 14.253906 2.726562 13.453125 2.726562 Z M 13.453125 13.636719 L 5.453125 13.636719 L\n 5.453125 4.089844 L 13.453125 4.089844 Z M 13.453125 13.636719 "></path>\n </g>\n </svg></span>\n </button>\n </footer>\n </div>\n `,this._attachStateModalContentEventListeners(),this.loadCurrentStateIntoForm()}_attachStateModalFrameEventListeners(){if(!this.stateModal)return;this.stateModal.addEventListener("click",t=>{const e=t.target;if(e.closest(".cv-modal-close"))this.closeModal();else{if(e.closest(".cv-share-btn")){this.copyShareableURL();const t=e.closest(".cv-share-btn"),n=t?.querySelector(".cv-share-btn-icon");if(n){const t=n.innerHTML;n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="2 2 22 22" fill="currentColor">\n <path d="M 19.28125 5.28125 L 9 15.5625 L 4.71875 11.28125 L 3.28125 12.71875 L 8.28125 17.71875 \n L 9 18.40625 L 9.71875 17.71875 L 20.71875 6.71875 Z"></path>\n </svg>',setTimeout(()=>{n.innerHTML=t},3e3)}return}if(e.closest(".cv-reset-btn")){const t=e.closest(".cv-reset-btn"),n=t?.querySelector(".cv-reset-btn-icon");return n&&n.classList.add("cv-spinning"),this.core.resetToDefault(),this.loadCurrentStateIntoForm(),void setTimeout(()=>{n&&n.classList.remove("cv-spinning")},600)}t.target===this.stateModal&&this.closeModal()}});document.addEventListener("keydown",t=>{"Escape"===t.key&&this.closeModal()})}_attachStateModalContentEventListeners(){if(!this.stateModal)return;this.stateModal.querySelectorAll(".cv-toggle-input").forEach(t=>{t.addEventListener("change",()=>{const t=this.getCurrentCustomStateFromModal();this.core.applyState(t,{source:"widget"})})});this.stateModal.querySelectorAll(".cv-tabgroup-select").forEach(t=>{t.addEventListener("change",()=>{const e=t.dataset.groupId,n=t.value;if(e&&n){const t=this.core.getCurrentActiveTabs();t[e]=n;const o={toggles:this.core.getCurrentActiveToggles(),tabs:t};this.core.applyState(o,{source:"widget"})}})});const t=this.stateModal.querySelector(".cv-nav-pref-input"),e=this.stateModal?.querySelector("#cv-nav-icon"),n=this.stateModal?.querySelector(".cv-tabgroup-card.cv-tabgroup-header");if(t&&e&&n){const o=(t,n=!1)=>{e.innerHTML=n?'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62.0001" x2="77" y2="62.0001" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8888" x2="77" y2="77.8888" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4454" x2="221" y2="97.4454" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n <path d="M245 37.0001V39.5001H250V37.0001H247.5H245ZM250 13.0001C250 11.6194 248.881 10.5001 247.5 10.5001C246.119 10.5001 245 11.6194 245 13.0001H247.5H250ZM250 31.0001C250 29.6194 248.881 28.5001 247.5 28.5001C246.119 28.5001 245 29.6194 245 31.0001H247.5H250ZM245 19.0001C245 20.3808 246.119 21.5001 247.5 21.5001C248.881 21.5001 250 20.3808 250 19.0001H247.5H245ZM247.5 37.0001H250V31.0001H247.5H245V37.0001H247.5ZM247.5 19.0001H250V13.0001H247.5H245V19.0001H247.5Z" fill="currentColor"/>\n <line x1="204.09" y1="36.6095" x2="181.698" y2="10.0228" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M125 9.50012L181 9.50012" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M144.305 35.2579L120.095 6.56679" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M120 6.50037L64 6.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M87.1957 36.1024L59 2.50008" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M59 2.50037L3 2.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M2.5 38.5001L2.5 3.00012" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n <path d="M185 12.5001L247 12.5001" stroke="currentColor" stroke-width="5" stroke-linecap="round" stroke-dasharray="10 10"/>\n </svg>':t?'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62.0001" x2="77" y2="62.0001" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8888" x2="77" y2="77.8888" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4454" x2="221" y2="97.4454" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n <line x1="247.5" y1="43.0001" x2="247.5" y2="13.0001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M185 12.5001L247 12.5001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <line x1="204.09" y1="36.6095" x2="181.698" y2="10.0228" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M125 9.50012L181 9.50012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M144.305 35.2579L120.095 6.56679" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M120 6.50037L64 6.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M87.1957 36.1024L59 2.50008" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M59 2.50037L3 2.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M2.5 38.5001L2.5 3.00012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n </svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181" fill="currentColor">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62" x2="77" y2="62" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8887" x2="77" y2="77.8887" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4453" x2="221" y2="97.4453" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n </svg>'};n.addEventListener("mouseenter",()=>o(t.checked,!0)),n.addEventListener("mouseleave",()=>o(t.checked,!1)),t.addEventListener("change",()=>{const e=t.checked;o(e,!1),this.core.persistTabNavVisibility(e);try{c.setNavsVisibility(document.body,e)}catch(t){console.error("Failed to set tab nav visibility:",t)}})}}applyThemeToModal(){this.stateModal&&("dark"===this.options.theme?this.stateModal.classList.add("cv-widget-theme-dark"):this.stateModal.classList.remove("cv-widget-theme-dark"))}getCurrentCustomStateFromModal(){if(!this.stateModal)return{};const t=[];this.stateModal.querySelectorAll(".cv-toggle-input").forEach(e=>{const n=e.dataset.toggle;n&&e.checked&&t.push(n)});const e=this.stateModal.querySelectorAll(".cv-tabgroup-select"),n={};e.forEach(t=>{const e=t.dataset.groupId;e&&(n[e]=t.value)});const o={toggles:t};return Object.keys(n).length>0&&(o.tabs=n),o}copyShareableURL(){const t=this.getCurrentCustomStateFromModal(),e=n.generateShareableURL(t);navigator.clipboard.writeText(e).then(()=>{console.log("Shareable URL copied to clipboard!")}).catch(()=>{console.error("Failed to copy URL!")})}loadCurrentStateIntoForm(){if(!this.stateModal)return;const t=this.core.getCurrentActiveToggles();this.stateModal.querySelectorAll(".cv-toggle-input").forEach(t=>{t.checked=!1}),t.forEach(t=>{const e=this.stateModal?.querySelector(`[data-toggle="${t}"]`);e&&(e.checked=!0)});const e=this.core.getCurrentActiveTabs();this.stateModal.querySelectorAll(".cv-tabgroup-select").forEach(t=>{const n=t.dataset.groupId;n&&e[n]&&(t.value=e[n])});const n=(()=>{const t=this.core.getPersistedTabNavVisibility();return null!==t?t:c.areNavsVisible(document.body)})(),o=this.stateModal.querySelector(".cv-nav-pref-input"),r=this.stateModal?.querySelector("#cv-nav-icon");o&&(o.checked=n,c.setNavsVisibility(document.body,n),r&&(r.innerHTML=n?'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62.0001" x2="77" y2="62.0001" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8888" x2="77" y2="77.8888" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4454" x2="221" y2="97.4454" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n <line x1="247.5" y1="43.0001" x2="247.5" y2="13.0001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M185 12.5001L247 12.5001" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <line x1="204.09" y1="36.6095" x2="181.698" y2="10.0228" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M125 9.50012L181 9.50012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M144.305 35.2579L120.095 6.56679" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M120 6.50037L64 6.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M87.1957 36.1024L59 2.50008" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M59 2.50037L3 2.50037" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n <path d="M2.5 38.5001L2.5 3.00012" stroke="currentColor" stroke-width="5" stroke-linecap="round"/>\n </svg>':'<svg xmlns="http://www.w3.org/2000/svg" width="250" height="181" viewBox="0 0 250 181" fill="currentColor">\n <rect y="34.5001" width="250" height="146" rx="4" stroke="currentColor" stroke-width="10" fill="none"/>\n <line x1="27" y1="62" x2="77" y2="62" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="77.8887" x2="77" y2="77.8887" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="97.4453" x2="221" y2="97.4453" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="114.555" x2="221" y2="114.555" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="132.889" x2="221" y2="132.889" stroke="currentColor" stroke-width="5"/>\n <line x1="27" y1="150" x2="221" y2="150" stroke="currentColor" stroke-width="5"/>\n </svg>'))}showWelcomeModalIfFirstVisit(){if(!this._hasVisibleConfig)return;const t="cv-welcome-shown";localStorage.getItem(t)||(setTimeout(()=>{this.createWelcomeModal()},500),localStorage.setItem(t,"true"))}createWelcomeModal(){if(this.stateModal&&!this.stateModal.classList.contains("cv-hidden"))return;const t=document.createElement("div");t.className="cv-widget-modal-overlay cv-welcome-modal-overlay","dark"===this.options.theme&&t.classList.add("cv-widget-theme-dark"),t.innerHTML=`\n <div class="cv-widget-modal cv-welcome-modal">\n <header class="cv-modal-header">\n <div class="cv-modal-header-content">\n <div class="cv-modal-icon">\n <svg class="cv-modal-icon-svg" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M12 8.00002C9.79085 8.00002 7.99999 9.79088 7.99999 12C7.99999 14.2092 9.79085 16 12 16C14.2091 16 16 14.2092 16 12C16 9.79088 14.2091 8.00002 12 8.00002ZM9.99999 12C9.99999 10.8955 10.8954 10 12 10C13.1046 10 14 10.8955 14 12C14 13.1046 13.1046 14 12 14C10.8954 14 9.99999 13.1046 9.99999 12Z" fill="#0F1729"/>\n <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M10.7673 1.01709C10.9925 0.999829 11.2454 0.99993 11.4516 1.00001L12.5484 1.00001C12.7546 0.99993 13.0075 0.999829 13.2327 1.01709C13.4989 1.03749 13.8678 1.08936 14.2634 1.26937C14.7635 1.49689 15.1915 1.85736 15.5007 2.31147C15.7454 2.67075 15.8592 3.0255 15.9246 3.2843C15.9799 3.50334 16.0228 3.75249 16.0577 3.9557L16.1993 4.77635L16.2021 4.77788C16.2369 4.79712 16.2715 4.81659 16.306 4.8363L16.3086 4.83774L17.2455 4.49865C17.4356 4.42978 17.6693 4.34509 17.8835 4.28543C18.1371 4.2148 18.4954 4.13889 18.9216 4.17026C19.4614 4.20998 19.9803 4.39497 20.4235 4.70563C20.7734 4.95095 21.0029 5.23636 21.1546 5.4515C21.2829 5.63326 21.4103 5.84671 21.514 6.02029L22.0158 6.86003C22.1256 7.04345 22.2594 7.26713 22.3627 7.47527C22.4843 7.7203 22.6328 8.07474 22.6777 8.52067C22.7341 9.08222 22.6311 9.64831 22.3803 10.1539C22.1811 10.5554 21.9171 10.8347 21.7169 11.0212C21.5469 11.1795 21.3428 11.3417 21.1755 11.4746L20.5 12L21.1755 12.5254C21.3428 12.6584 21.5469 12.8205 21.7169 12.9789C21.9171 13.1653 22.1811 13.4446 22.3802 13.8461C22.631 14.3517 22.7341 14.9178 22.6776 15.4794C22.6328 15.9253 22.4842 16.2797 22.3626 16.5248C22.2593 16.7329 22.1255 16.9566 22.0158 17.14L21.5138 17.9799C21.4102 18.1535 21.2828 18.3668 21.1546 18.5485C21.0028 18.7637 20.7734 19.0491 20.4234 19.2944C19.9803 19.6051 19.4613 19.7901 18.9216 19.8298C18.4954 19.8612 18.1371 19.7852 17.8835 19.7146C17.6692 19.6549 17.4355 19.5703 17.2454 19.5014L16.3085 19.1623L16.306 19.1638C16.2715 19.1835 16.2369 19.2029 16.2021 19.2222L16.1993 19.2237L16.0577 20.0443C16.0228 20.2475 15.9799 20.4967 15.9246 20.7157C15.8592 20.9745 15.7454 21.3293 15.5007 21.6886C15.1915 22.1427 14.7635 22.5032 14.2634 22.7307C13.8678 22.9107 13.4989 22.9626 13.2327 22.983C13.0074 23.0002 12.7546 23.0001 12.5484 23H11.4516C11.2454 23.0001 10.9925 23.0002 10.7673 22.983C10.5011 22.9626 10.1322 22.9107 9.73655 22.7307C9.23648 22.5032 8.80849 22.1427 8.49926 21.6886C8.25461 21.3293 8.14077 20.9745 8.07542 20.7157C8.02011 20.4967 7.97723 20.2475 7.94225 20.0443L7.80068 19.2237L7.79791 19.2222C7.7631 19.2029 7.72845 19.1835 7.69396 19.1637L7.69142 19.1623L6.75458 19.5014C6.5645 19.5702 6.33078 19.6549 6.11651 19.7146C5.86288 19.7852 5.50463 19.8611 5.07841 19.8298C4.53866 19.7901 4.01971 19.6051 3.57654 19.2944C3.2266 19.0491 2.99714 18.7637 2.84539 18.5485C2.71718 18.3668 2.58974 18.1534 2.4861 17.9798L1.98418 17.14C1.87447 16.9566 1.74067 16.7329 1.63737 16.5248C1.51575 16.2797 1.36719 15.9253 1.32235 15.4794C1.26588 14.9178 1.36897 14.3517 1.61976 13.8461C1.81892 13.4446 2.08289 13.1653 2.28308 12.9789C2.45312 12.8205 2.65717 12.6584 2.82449 12.5254L3.47844 12.0054V11.9947L2.82445 11.4746C2.65712 11.3417 2.45308 11.1795 2.28304 11.0212C2.08285 10.8347 1.81888 10.5554 1.61972 10.1539C1.36893 9.64832 1.26584 9.08224 1.3223 8.52069C1.36714 8.07476 1.51571 7.72032 1.63732 7.47528C1.74062 7.26715 1.87443 7.04347 1.98414 6.86005L2.48605 6.02026C2.58969 5.84669 2.71714 5.63326 2.84534 5.45151C2.9971 5.23637 3.22655 4.95096 3.5765 4.70565C4.01966 4.39498 4.53862 4.20999 5.07837 4.17027C5.50458 4.1389 5.86284 4.21481 6.11646 4.28544C6.33072 4.34511 6.56444 4.4298 6.75451 4.49867L7.69141 4.83775L7.69394 4.8363C7.72844 4.8166 7.7631 4.79712 7.79791 4.77788L7.80068 4.77635L7.94225 3.95571C7.97723 3.7525 8.02011 3.50334 8.07542 3.2843C8.14077 3.0255 8.25461 2.67075 8.49926 2.31147C8.80849 1.85736 9.23648 1.49689 9.73655 1.26937C10.1322 1.08936 10.5011 1.03749 10.7673 1.01709ZM14.0938 4.3363C14.011 3.85634 13.9696 3.61637 13.8476 3.43717C13.7445 3.2858 13.6019 3.16564 13.4352 3.0898C13.2378 3.00002 12.9943 3.00002 12.5073 3.00002H11.4927C11.0057 3.00002 10.7621 3.00002 10.5648 3.0898C10.3981 3.16564 10.2555 3.2858 10.1524 3.43717C10.0304 3.61637 9.98895 3.85634 9.90615 4.3363L9.75012 5.24064C9.69445 5.56333 9.66662 5.72467 9.60765 5.84869C9.54975 5.97047 9.50241 6.03703 9.40636 6.13166C9.30853 6.22804 9.12753 6.3281 8.76554 6.52822C8.73884 6.54298 8.71227 6.55791 8.68582 6.57302C8.33956 6.77078 8.16643 6.86966 8.03785 6.90314C7.91158 6.93602 7.83293 6.94279 7.70289 6.93196C7.57049 6.92094 7.42216 6.86726 7.12551 6.7599L6.11194 6.39308C5.66271 6.2305 5.43809 6.14921 5.22515 6.16488C5.04524 6.17811 4.87225 6.23978 4.72453 6.34333C4.5497 6.46589 4.42715 6.67094 4.18206 7.08103L3.72269 7.84965C3.46394 8.2826 3.33456 8.49907 3.31227 8.72078C3.29345 8.90796 3.32781 9.09665 3.41141 9.26519C3.51042 9.4648 3.7078 9.62177 4.10256 9.9357L4.82745 10.5122C5.07927 10.7124 5.20518 10.8126 5.28411 10.9199C5.36944 11.036 5.40583 11.1114 5.44354 11.2504C5.47844 11.379 5.47844 11.586 5.47844 12C5.47844 12.414 5.47844 12.621 5.44354 12.7497C5.40582 12.8887 5.36944 12.9641 5.28413 13.0801C5.20518 13.1875 5.07927 13.2876 4.82743 13.4879L4.10261 14.0643C3.70785 14.3783 3.51047 14.5352 3.41145 14.7349C3.32785 14.9034 3.29349 15.0921 3.31231 15.2793C3.33461 15.501 3.46398 15.7174 3.72273 16.1504L4.1821 16.919C4.4272 17.3291 4.54974 17.5342 4.72457 17.6567C4.8723 17.7603 5.04528 17.8219 5.2252 17.8352C5.43813 17.8508 5.66275 17.7695 6.11199 17.607L7.12553 17.2402C7.42216 17.1328 7.5705 17.0791 7.7029 17.0681C7.83294 17.0573 7.91159 17.064 8.03786 17.0969C8.16644 17.1304 8.33956 17.2293 8.68582 17.427C8.71228 17.4421 8.73885 17.4571 8.76554 17.4718C9.12753 17.6719 9.30853 17.772 9.40635 17.8684C9.50241 17.963 9.54975 18.0296 9.60765 18.1514C9.66662 18.2754 9.69445 18.4367 9.75012 18.7594L9.90615 19.6637C9.98895 20.1437 10.0304 20.3837 10.1524 20.5629C10.2555 20.7142 10.3981 20.8344 10.5648 20.9102C10.7621 21 11.0057 21 11.4927 21H12.5073C12.9943 21 13.2378 21 13.4352 20.9102C13.6019 20.8344 13.7445 20.7142 13.8476 20.5629C13.9696 20.3837 14.011 20.1437 14.0938 19.6637L14.2499 18.7594C14.3055 18.4367 14.3334 18.2754 14.3923 18.1514C14.4502 18.0296 14.4976 17.963 14.5936 17.8684C14.6915 17.772 14.8725 17.6719 15.2344 17.4718C15.2611 17.4571 15.2877 17.4421 15.3141 17.427C15.6604 17.2293 15.8335 17.1304 15.9621 17.0969C16.0884 17.064 16.167 17.0573 16.2971 17.0681C16.4295 17.0791 16.5778 17.1328 16.8744 17.2402L17.888 17.607C18.3372 17.7696 18.5619 17.8509 18.7748 17.8352C18.9547 17.8219 19.1277 17.7603 19.2754 17.6567C19.4502 17.5342 19.5728 17.3291 19.8179 16.919L20.2773 16.1504C20.536 15.7175 20.6654 15.501 20.6877 15.2793C20.7065 15.0921 20.6721 14.9034 20.5885 14.7349C20.4895 14.5353 20.2921 14.3783 19.8974 14.0643L19.1726 13.4879C18.9207 13.2876 18.7948 13.1875 18.7159 13.0801C18.6306 12.9641 18.5942 12.8887 18.5564 12.7497C18.5215 12.6211 18.5215 12.414 18.5215 12C18.5215 11.586 18.5215 11.379 18.5564 11.2504C18.5942 11.1114 18.6306 11.036 18.7159 10.9199C18.7948 10.8126 18.9207 10.7124 19.1725 10.5122L19.8974 9.9357C20.2922 9.62176 20.4896 9.46479 20.5886 9.26517C20.6722 9.09664 20.7065 8.90795 20.6877 8.72076C20.6654 8.49906 20.5361 8.28259 20.2773 7.84964L19.8179 7.08102C19.5728 6.67093 19.4503 6.46588 19.2755 6.34332C19.1277 6.23977 18.9548 6.1781 18.7748 6.16486C18.5619 6.14919 18.3373 6.23048 17.888 6.39307L16.8745 6.75989C16.5778 6.86725 16.4295 6.92093 16.2971 6.93195C16.167 6.94278 16.0884 6.93601 15.9621 6.90313C15.8335 6.86965 15.6604 6.77077 15.3142 6.57302C15.2877 6.55791 15.2611 6.54298 15.2345 6.52822C14.8725 6.3281 14.6915 6.22804 14.5936 6.13166C14.4976 6.03703 14.4502 5.97047 14.3923 5.84869C14.3334 5.72467 14.3055 5.56332 14.2499 5.24064L14.0938 4.3363Z" fill="#0F1729"/>\n</svg>\n </div>\n <h1 class="cv-modal-title">${this.options.welcomeTitle}</h1>\n </div>\n </header>\n <div class="cv-modal-main">\n <p class="cv-welcome-message">${this.options.welcomeMessage}</p>\n \n <div class="cv-welcome-widget-preview">\n <div class="cv-welcome-widget-icon">\n <svg class="cv-modal-icon-svg" fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">\n <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M12 8.00002C9.79085 8.00002 7.99999 9.79088 7.99999 12C7.99999 14.2092 9.79085 16 12 16C14.2091 16 16 14.2092 16 12C16 9.79088 14.2091 8.00002 12 8.00002ZM9.99999 12C9.99999 10.8955 10.8954 10 12 10C13.1046 10 14 10.8955 14 12C14 13.1046 13.1046 14 12 14C10.8954 14 9.99999 13.1046 9.99999 12Z" fill="#0F1729"/>\n <path xmlns="http://www.w3.org/2000/svg" fill-rule="evenodd" clip-rule="evenodd" d="M10.7673 1.01709C10.9925 0.999829 11.2454 0.99993 11.4516 1.00001L12.5484 1.00001C12.7546 0.99993 13.0075 0.999829 13.2327 1.01709C13.4989 1.03749 13.8678 1.08936 14.2634 1.26937C14.7635 1.49689 15.1915 1.85736 15.5007 2.31147C15.7454 2.67075 15.8592 3.0255 15.9246 3.2843C15.9799 3.50334 16.0228 3.75249 16.0577 3.9557L16.1993 4.77635L16.2021 4.77788C16.2369 4.79712 16.2715 4.81659 16.306 4.8363L16.3086 4.83774L17.2455 4.49865C17.4356 4.42978 17.6693 4.34509 17.8835 4.28543C18.1371 4.2148 18.4954 4.13889 18.9216 4.17026C19.4614 4.20998 19.9803 4.39497 20.4235 4.70563C20.7734 4.95095 21.0029 5.23636 21.1546 5.4515C21.2829 5.63326 21.4103 5.84671 21.514 6.02029L22.0158 6.86003C22.1256 7.04345 22.2594 7.26713 22.3627 7.47527C22.4843 7.7203 22.6328 8.07474 22.6777 8.52067C22.7341 9.08222 22.6311 9.64831 22.3803 10.1539C22.1811 10.5554 21.9171 10.8347 21.7169 11.0212C21.5469 11.1795 21.3428 11.3417 21.1755 11.4746L20.5 12L21.1755 12.5254C21.3428 12.6584 21.5469 12.8205 21.7169 12.9789C21.9171 13.1653 22.1811 13.4446 22.3802 13.8461C22.631 14.3517 22.7341 14.9178 22.6776 15.4794C22.6328 15.9253 22.4842 16.2797 22.3626 16.5248C22.2593 16.7329 22.1255 16.9566 22.0158 17.14L21.5138 17.9799C21.4102 18.1535 21.2828 18.3668 21.1546 18.5485C21.0028 18.7637 20.7734 19.0491 20.4234 19.2944C19.9803 19.6051 19.4613 19.7901 18.9216 19.8298C18.4954 19.8612 18.1371 19.7852 17.8835 19.7146C17.6692 19.6549 17.4355 19.5703 17.2454 19.5014L16.3085 19.1623L16.306 19.1638C16.2715 19.1835 16.2369 19.2029 16.2021 19.2222L16.1993 19.2237L16.0577 20.0443C16.0228 20.2475 15.9799 20.4967 15.9246 20.7157C15.8592 20.9745 15.7454 21.3293 15.5007 21.6886C15.1915 22.1427 14.7635 22.5032 14.2634 22.7307C13.8678 22.9107 13.4989 22.9626 13.2327 22.983C13.0074 23.0002 12.7546 23.0001 12.5484 23H11.4516C11.2454 23.0001 10.9925 23.0002 10.7673 22.983C10.5011 22.9626 10.1322 22.9107 9.73655 22.7307C9.23648 22.5032 8.80849 22.1427 8.49926 21.6886C8.25461 21.3293 8.14077 20.9745 8.07542 20.7157C8.02011 20.4967 7.97723 20.2475 7.94225 20.0443L7.80068 19.2237L7.79791 19.2222C7.7631 19.2029 7.72845 19.1835 7.69396 19.1637L7.69142 19.1623L6.75458 19.5014C6.5645 19.5702 6.33078 19.6549 6.11651 19.7146C5.86288 19.7852 5.50463 19.8611 5.07841 19.8298C4.53866 19.7901 4.01971 19.6051 3.57654 19.2944C3.2266 19.0491 2.99714 18.7637 2.84539 18.5485C2.71718 18.3668 2.58974 18.1534 2.4861 17.9798L1.98418 17.14C1.87447 16.9566 1.74067 16.7329 1.63737 16.5248C1.51575 16.2797 1.36719 15.9253 1.32235 15.4794C1.26588 14.9178 1.36897 14.3517 1.61976 13.8461C1.81892 13.4446 2.08289 13.1653 2.28308 12.9789C2.45312 12.8205 2.65717 12.6584 2.82449 12.5254L3.47844 12.0054V11.9947L2.82445 11.4746C2.65712 11.3417 2.45308 11.1795 2.28304 11.0212C2.08285 10.8347 1.81888 10.5554 1.61972 10.1539C1.36893 9.64832 1.26584 9.08224 1.3223 8.52069C1.36714 8.07476 1.51571 7.72032 1.63732 7.47528C1.74062 7.26715 1.87443 7.04347 1.98414 6.86005L2.48605 6.02026C2.58969 5.84669 2.71714 5.63326 2.84534 5.45151C2.9971 5.23637 3.22655 4.95096 3.5765 4.70565C4.01966 4.39498 4.53862 4.20999 5.07837 4.17027C5.50458 4.1389 5.86284 4.21481 6.11646 4.28544C6.33072 4.34511 6.56444 4.4298 6.75451 4.49867L7.69141 4.83775L7.69394 4.8363C7.72844 4.8166 7.7631 4.79712 7.79791 4.77788L7.80068 4.77635L7.94225 3.95571C7.97723 3.7525 8.02011 3.50334 8.07542 3.2843C8.14077 3.0255 8.25461 2.67075 8.49926 2.31147C8.80849 1.85736 9.23648 1.49689 9.73655 1.26937C10.1322 1.08936 10.5011 1.03749 10.7673 1.01709ZM14.0938 4.3363C14.011 3.85634 13.9696 3.61637 13.8476 3.43717C13.7445 3.2858 13.6019 3.16564 13.4352 3.0898C13.2378 3.00002 12.9943 3.00002 12.5073 3.00002H11.4927C11.0057 3.00002 10.7621 3.00002 10.5648 3.0898C10.3981 3.16564 10.2555 3.2858 10.1524 3.43717C10.0304 3.61637 9.98895 3.85634 9.90615 4.3363L9.75012 5.24064C9.69445 5.56333 9.66662 5.72467 9.60765 5.84869C9.54975 5.97047 9.50241 6.03703 9.40636 6.13166C9.30853 6.22804 9.12753 6.3281 8.76554 6.52822C8.73884 6.54298 8.71227 6.55791 8.68582 6.57302C8.33956 6.77078 8.16643 6.86966 8.03785 6.90314C7.91158 6.93602 7.83293 6.94279 7.70289 6.93196C7.57049 6.92094 7.42216 6.86726 7.12551 6.7599L6.11194 6.39308C5.66271 6.2305 5.43809 6.14921 5.22515 6.16488C5.04524 6.17811 4.87225 6.23978 4.72453 6.34333C4.5497 6.46589 4.42715 6.67094 4.18206 7.08103L3.72269 7.84965C3.46394 8.2826 3.33456 8.49907 3.31227 8.72078C3.29345 8.90796 3.32781 9.09665 3.41141 9.26519C3.51042 9.4648 3.7078 9.62177 4.10256 9.9357L4.82745 10.5122C5.07927 10.7124 5.20518 10.8126 5.28411 10.9199C5.36944 11.036 5.40583 11.1114 5.44354 11.2504C5.47844 11.379 5.47844 11.586 5.47844 12C5.47844 12.414 5.47844 12.621 5.44354 12.7497C5.40582 12.8887 5.36944 12.9641 5.28413 13.0801C5.20518 13.1875 5.07927 13.2876 4.82743 13.4879L4.10261 14.0643C3.70785 14.3783 3.51047 14.5352 3.41145 14.7349C3.32785 14.9034 3.29349 15.0921 3.31231 15.2793C3.33461 15.501 3.46398 15.7174 3.72273 16.1504L4.1821 16.919C4.4272 17.3291 4.54974 17.5342 4.72457 17.6567C4.8723 17.7603 5.04528 17.8219 5.2252 17.8352C5.43813 17.8508 5.66275 17.7695 6.11199 17.607L7.12553 17.2402C7.42216 17.1328 7.5705 17.0791 7.7029 17.0681C7.83294 17.0573 7.91159 17.064 8.03786 17.0969C8.16644 17.1304 8.33956 17.2293 8.68582 17.427C8.71228 17.4421 8.73885 17.4571 8.76554 17.4718C9.12753 17.6719 9.30853 17.772 9.40635 17.8684C9.50241 17.963 9.54975 18.0296 9.60765 18.1514C9.66662 18.2754 9.69445 18.4367 9.75012 18.7594L9.90615 19.6637C9.98895 20.1437 10.0304 20.3837 10.1524 20.5629C10.2555 20.7142 10.3981 20.8344 10.5648 20.9102C10.7621 21 11.0057 21 11.4927 21H12.5073C12.9943 21 13.2378 21 13.4352 20.9102C13.6019 20.8344 13.7445 20.7142 13.8476 20.5629C13.9696 20.3837 14.011 20.1437 14.0938 19.6637L14.2499 18.7594C14.3055 18.4367 14.3334 18.2754 14.3923 18.1514C14.4502 18.0296 14.4976 17.963 14.5936 17.8684C14.6915 17.772 14.8725 17.6719 15.2344 17.4718C15.2611 17.4571 15.2877 17.4421 15.3141 17.427C15.6604 17.2293 15.8335 17.1304 15.9621 17.0969C16.0884 17.064 16.167 17.0573 16.2971 17.0681C16.4295 17.0791 16.5778 17.1328 16.8744 17.2402L17.888 17.607C18.3372 17.7696 18.5619 17.8509 18.7748 17.8352C18.9547 17.8219 19.1277 17.7603 19.2754 17.6567C19.4502 17.5342 19.5728 17.3291 19.8179 16.919L20.2773 16.1504C20.536 15.7175 20.6654 15.501 20.6877 15.2793C20.7065 15.0921 20.6721 14.9034 20.5885 14.7349C20.4895 14.5353 20.2921 14.3783 19.8974 14.0643L19.1726 13.4879C18.9207 13.2876 18.7948 13.1875 18.7159 13.0801C18.6306 12.9641 18.5942 12.8887 18.5564 12.7497C18.5215 12.6211 18.5215 12.414 18.5215 12C18.5215 11.586 18.5215 11.379 18.5564 11.2504C18.5942 11.1114 18.6306 11.036 18.7159 10.9199C18.7948 10.8126 18.9207 10.7124 19.1725 10.5122L19.8974 9.9357C20.2922 9.62176 20.4896 9.46479 20.5886 9.26517C20.6722 9.09664 20.7065 8.90795 20.6877 8.72076C20.6654 8.49906 20.5361 8.28259 20.2773 7.84964L19.8179 7.08102C19.5728 6.67093 19.4503 6.46588 19.2755 6.34332C19.1277 6.23977 18.9548 6.1781 18.7748 6.16486C18.5619 6.14919 18.3373 6.23048 17.888 6.39307L16.8745 6.75989C16.5778 6.86725 16.4295 6.92093 16.2971 6.93195C16.167 6.94278 16.0884 6.93601 15.9621 6.90313C15.8335 6.86965 15.6604 6.77077 15.3142 6.57302C15.2877 6.55791 15.2611 6.54298 15.2345 6.52822C14.8725 6.3281 14.6915 6.22804 14.5936 6.13166C14.4976 6.03703 14.4502 5.97047 14.3923 5.84869C14.3334 5.72467 14.3055 5.56332 14.2499 5.24064L14.0938 4.3363Z" fill="#0F1729"/>\n</svg>\n </div>\n <p class="cv-welcome-widget-label">Look for this widget</p>\n </div>\n \n <button class="cv-welcome-got-it">Got it!</button>\n </div>\n </div>\n `,document.body.appendChild(t),this.attachWelcomeModalEventListeners(t)}attachWelcomeModalEventListeners(t){const e=()=>{t.remove(),document.removeEventListener("keydown",o)},n=t.querySelector(".cv-welcome-got-it");n&&n.addEventListener("click",e),t.addEventListener("click",n=>{n.target===t&&e()});const o=t=>{"Escape"===t.key&&e()};document.addEventListener("keydown",o)}}"undefined"!=typeof window&&(window.CustomViews=k,window.CustomViewsWidget=x,"undefined"!=typeof window&&(window.__customViewsInitialized?console.info("[CustomViews] Auto-init skipped: already initialized."):document.addEventListener("DOMContentLoaded",async function(){if(!window.__customViewsInitInProgress&&!window.__customViewsInitialized){window.__customViewsInitInProgress=!0;try{let t=document.currentScript;if(!t||!t.hasAttribute("data-base-url")){const e=document.querySelector("script[data-base-url]");if(e)t=e;else for(const e of document.scripts){const n=e.src||"";if(/(?:custom[-_]views|@customviews-js\/customviews)(?:\.min)?\.(?:esm\.)?js($|\?)/i.test(n)){t=e;break}}}let e,n="",o="/customviews.config.json";t&&(n=t.getAttribute("data-base-url")||"",o=t.getAttribute("data-config-path")||o);try{const t=b(o,n);console.log(`[CustomViews] Loading config from: ${t}`);const r=await fetch(t);r.ok?(e=await r.json(),console.log("[CustomViews] Config loaded successfully")):(console.warn(`[CustomViews] Config file not found at ${t}. Using defaults.`),e={config:{toggles:[],defaultState:{}},widget:{enabled:!0}})}catch(t){return void console.error("[CustomViews] Error loading config file:",t)}const r=n||e.baseURL||"",i={config:e.config,assetsJsonPath:e.assetsJsonPath,baseURL:r};void 0!==e.showUrl&&(i.showUrl=e.showUrl);const s=await k.init(i);if(!s)return void console.error("[CustomViews] Failed to initialize core.");let a;window.customViewsInstance={core:s},!1!==e.widget?.enabled?(a=new x({core:s,...e.widget}),a.renderModalIcon(),window.customViewsInstance.widget=a,console.log("[CustomViews] Widget initialized and rendered")):console.log("[CustomViews] Widget disabled in config - skipping initialization");const c=new CustomEvent("customviews:ready",{detail:{core:s,widget:a}});document.dispatchEvent(c),window.__customViewsInitialized=!0,window.__customViewsInitInProgress=!1}catch(t){window.__customViewsInitInProgress=!1,console.error("[CustomViews] Auto-initialization error:",t)}}}))),t.AssetsManager=l,t.CustomViews=k,t.CustomViewsCore=v,t.CustomViewsWidget=x,t.PersistenceManager=e,t.URLStateManager=n});
7
7
  //# sourceMappingURL=custom-views.min.js.map