vanilla-breeze 0.7.0 → 0.7.2
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.
- package/custom-elements.json +7054 -6296
- package/dist/cdn/components/activity-feed.js +1 -1
- package/dist/cdn/components/data-table.js +1 -1
- package/dist/cdn/components/manifest.json +8 -4
- package/dist/cdn/components/settings-panel.js +1 -1
- package/dist/cdn/components/site-map.js +1 -1
- package/dist/cdn/components/social-feed.js +5 -0
- package/dist/cdn/components/theme-picker.js +14 -7
- package/dist/cdn/packs/manifest.json +2 -2
- package/dist/cdn/packs/ui.full.css +1 -1
- package/dist/cdn/packs/ui.full.js +15 -8
- package/dist/cdn/themes/8bit.tokens.json +1 -1
- package/dist/cdn/themes/alpha1999-dark.tokens.json +1 -1
- package/dist/cdn/themes/alpha1999.tokens.json +1 -1
- package/dist/cdn/themes/art-deco-dark.tokens.json +1 -1
- package/dist/cdn/themes/art-deco.tokens.json +1 -1
- package/dist/cdn/themes/bauhaus-dark.tokens.json +1 -1
- package/dist/cdn/themes/bauhaus.tokens.json +1 -1
- package/dist/cdn/themes/brutalist-dark.tokens.json +1 -1
- package/dist/cdn/themes/brutalist.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-frappe.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte-dark.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-latte.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-macchiato.tokens.json +1 -1
- package/dist/cdn/themes/catppuccin-mocha.tokens.json +1 -1
- package/dist/cdn/themes/classic-dark.tokens.json +1 -1
- package/dist/cdn/themes/classic.tokens.json +1 -1
- package/dist/cdn/themes/claymorphism-dark.tokens.json +1 -1
- package/dist/cdn/themes/claymorphism.tokens.json +1 -1
- package/dist/cdn/themes/clinical-dark.tokens.json +1 -1
- package/dist/cdn/themes/clinical.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore-dark.tokens.json +1 -1
- package/dist/cdn/themes/cottagecore.tokens.json +1 -1
- package/dist/cdn/themes/cyber.tokens.json +1 -1
- package/dist/cdn/themes/dawn-dark.tokens.json +1 -1
- package/dist/cdn/themes/dawn.tokens.json +1 -1
- package/dist/cdn/themes/dracula.tokens.json +1 -1
- package/dist/cdn/themes/dusk.tokens.json +1 -1
- package/dist/cdn/themes/editorial-dark.tokens.json +1 -1
- package/dist/cdn/themes/editorial.tokens.json +1 -1
- package/dist/cdn/themes/financial-dark.tokens.json +1 -1
- package/dist/cdn/themes/financial.tokens.json +1 -1
- package/dist/cdn/themes/genai.tokens.json +1 -1
- package/dist/cdn/themes/glassmorphism-dark.tokens.json +1 -1
- package/dist/cdn/themes/glassmorphism.tokens.json +1 -1
- package/dist/cdn/themes/government-dark.tokens.json +1 -1
- package/dist/cdn/themes/government.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox-dark.tokens.json +1 -1
- package/dist/cdn/themes/gruvbox.tokens.json +1 -1
- package/dist/cdn/themes/high-noon-dark.tokens.json +1 -1
- package/dist/cdn/themes/high-noon.tokens.json +1 -1
- package/dist/cdn/themes/journal-dark.tokens.json +1 -1
- package/dist/cdn/themes/journal.tokens.json +1 -1
- package/dist/cdn/themes/kawaii-dark.tokens.json +1 -1
- package/dist/cdn/themes/kawaii.tokens.json +1 -1
- package/dist/cdn/themes/magna-dark.tokens.json +1 -1
- package/dist/cdn/themes/magna.tokens.json +1 -1
- package/dist/cdn/themes/midnight.tokens.json +1 -1
- package/dist/cdn/themes/minimal-dark.tokens.json +1 -1
- package/dist/cdn/themes/minimal.tokens.json +1 -1
- package/dist/cdn/themes/modern-dark.tokens.json +1 -1
- package/dist/cdn/themes/modern.tokens.json +1 -1
- package/dist/cdn/themes/nes-dark.tokens.json +1 -1
- package/dist/cdn/themes/nes.tokens.json +1 -1
- package/dist/cdn/themes/neumorphism-dark.tokens.json +1 -1
- package/dist/cdn/themes/neumorphism.tokens.json +1 -1
- package/dist/cdn/themes/nord-dark.tokens.json +1 -1
- package/dist/cdn/themes/nord.tokens.json +1 -1
- package/dist/cdn/themes/organic-dark.tokens.json +1 -1
- package/dist/cdn/themes/organic.tokens.json +1 -1
- package/dist/cdn/themes/rose-pine-dark.tokens.json +1 -1
- package/dist/cdn/themes/rose-pine.tokens.json +1 -1
- package/dist/cdn/themes/rough-dark.tokens.json +1 -1
- package/dist/cdn/themes/rough.tokens.json +1 -1
- package/dist/cdn/themes/solarized-dark.tokens.json +1 -1
- package/dist/cdn/themes/solarized.tokens.json +1 -1
- package/dist/cdn/themes/startup-dark.tokens.json +1 -1
- package/dist/cdn/themes/startup.tokens.json +1 -1
- package/dist/cdn/themes/super2026-dark.tokens.json +1 -1
- package/dist/cdn/themes/super2026.tokens.json +1 -1
- package/dist/cdn/themes/swiss-dark.tokens.json +1 -1
- package/dist/cdn/themes/swiss.tokens.json +1 -1
- package/dist/cdn/themes/terminal.tokens.json +1 -1
- package/dist/cdn/themes/tokyo-night-dark.tokens.json +1 -1
- package/dist/cdn/themes/tokyo-night.tokens.json +1 -1
- package/dist/cdn/themes/vaporwave-dark.tokens.json +1 -1
- package/dist/cdn/themes/vaporwave.tokens.json +1 -1
- package/dist/cdn/themes/win9x-dark.tokens.json +1 -1
- package/dist/cdn/themes/win9x.tokens.json +1 -1
- package/dist/cdn/vanilla-breeze-autoload.js +52 -52
- package/dist/cdn/vanilla-breeze-core.css +1 -1
- package/dist/cdn/vanilla-breeze-core.js +44 -44
- package/dist/cdn/vanilla-breeze-extras.js +36 -33
- package/dist/cdn/vanilla-breeze.css +1 -1
- package/dist/cdn/vanilla-breeze.js +168 -158
- package/package.json +4 -4
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var D=window.matchMedia("(prefers-reduced-motion: reduce)");var T=new Map;function L(l,e,s={}){let t=s.priority??10,r={impl:e,bundle:s.bundle,contract:s.contract,priority:t},i=T.get(l);if(customElements.get(l)){if(!i||i.priority>=t){i&&i.priority===t&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${l}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=t){i.priority===t&&console.warn(`[VB Bundle] Tag <${l}> already registered by "${i.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}T.set(l,r),customElements.define(l,e)}var w=class extends HTMLElement{#d=[];#r;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#d)e();this.#d=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,s,t,r){e.addEventListener(s,t,r),this.#d.push(()=>e.removeEventListener(s,t,r))}_reinit(){for(let e of this.#d)e();this.#d=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,s){this.#r||(this.#r=this.attachInternals());let t=this.#r.states;try{s?t.add(e):t.delete(e)}catch{let r=`--${e}`;s?t.add(r):t.delete(r)}}_adoptInternals(e){this.#r||(this.#r=e)}#s(){return this.constructor.formAssociated&&this.#r?this.#r:null}get validity(){return this.#s()?.validity}get validationMessage(){return this.#s()?.validationMessage??""}get willValidate(){return this.#s()?.willValidate??!1}get form(){return this.#s()?.form??null}checkValidity(){return this.#s()?.checkValidity()??!0}reportValidity(){return this.#s()?.reportValidity()??!0}};var N=0;function M(l,e,s="vb-vt"){if(!l?.isConnected||typeof document>"u"||!("startViewTransition"in document)||matchMedia("(prefers-reduced-motion: reduce)").matches)return e(),null;let t=`${s}-${++N}`;l.style.viewTransitionName=t;let r=document.startViewTransition(e);return r.finished.finally(()=>{l.style.viewTransitionName===t&&(l.style.viewTransitionName="")}),r}var x={layout:{label:"Layout",cssClass:"sm-badge--layout"},section:{label:"Section",cssClass:"sm-badge--section"},dashboard:{label:"Dashboard",cssClass:"sm-badge--dashboard"},page:{label:"Page",cssClass:"sm-badge--page"},modal:{label:"Modal",cssClass:"sm-badge--modal"},redirect:{label:"Redirect",cssClass:"sm-badge--redirect"}},S={draft:{label:"Draft",cssClass:"sm-status--draft"},ready:{label:"Ready",cssClass:"sm-status--ready"},live:{label:"Live",cssClass:"sm-status--live"},deprecated:{label:"Deprecated",cssClass:"sm-status--deprecated"}};function B(l){if(typeof l!="string"||!l.trim())return null;try{let e=new URL(l,document.baseURI);return e.protocol==="http:"||e.protocol==="https:"?l:null}catch{return null}}var P=0,$=class l extends w{static get observedAttributes(){return["src","collapsed","title","data-view","data-orientation","data-detail"]}#d=`sm-${++P}`;#r=!1;#s=null;#i=null;#t=null;#u=null;#a=0;#o=0;setup(){if((this.getAttribute("mode")||"nav-enhance")!=="ia-tree"){this.#ft();return}let e=this.getAttribute("src");if(e&&!this.querySelector("nav")){this._loadSrc(e);return}let s=this.querySelector(":scope > nav");if(!s)return;if(this.#a=0,this.#o=0,this.#M(s.querySelector("ul"),0),this.dataset.view==="visual"){this.#N(),this.#ot(s),this.dispatchEvent(new CustomEvent("site-map:ready",{bubbles:!0,detail:{nodeCount:this.#a,depth:this.#o}}));return}this.#B(s.querySelector("ul"),0),this.#N(),s.classList.add("sm-tree");let t=this.getAttribute("title")||"Site map";!s.hasAttribute("aria-label")&&!s.hasAttribute("aria-labelledby")&&(s.setAttribute("aria-label",t),s.setAttribute("data-sm-labelled",""));let r=s.querySelector("ul");r&&(r.setAttribute("role","tree"),r.setAttribute("aria-label",t)),this.#s=s,this.hasAttribute("collapsed")&&this.#P();let i=s.querySelector('a[aria-current="page"]')?.closest('li[role="treeitem"]')??null,n=i&&this.#y().includes(i)?i:s.querySelector('li[role="treeitem"]');n&&(n.setAttribute("tabindex","0"),this.#u=n),this.listen(s,"keydown",a=>this.#rt(a)),this.listen(s,"click",a=>this.#st(a)),this.dispatchEvent(new CustomEvent("site-map:ready",{bubbles:!0,detail:{nodeCount:this.#a,depth:this.#o}}))}teardown(){if((this.getAttribute("mode")||"nav-enhance")!=="ia-tree"){this.#mt();return}if(this.#t){this.#t.remove(),this.#t=null;let e=this.querySelector(":scope > nav");e&&(e.hidden=!1,e.removeAttribute("aria-hidden"))}if(this.#e=null,this.#c=null,this.#i&&(this.#i.remove(),this.#i=null),this.#s){this.#s.classList.remove("sm-tree"),this.#s.hasAttribute("data-sm-labelled")&&(this.#s.removeAttribute("aria-label"),this.#s.removeAttribute("data-sm-labelled"));let e=this.#s.querySelector('ul[role="tree"]');e?.removeAttribute("role"),e?.removeAttribute("aria-label")}this.querySelectorAll(".sm-node-content").forEach(e=>{let s=e.querySelector(":scope > a");s&&(s.removeAttribute("tabindex"),e.before(s)),e.remove()}),this.querySelectorAll(".sm-toggle").forEach(e=>e.remove()),this.querySelectorAll('li[role="treeitem"]').forEach(e=>{e.removeAttribute("role"),e.removeAttribute("aria-expanded"),e.removeAttribute("tabindex")}),this.querySelectorAll('ul[role="group"]').forEach(e=>{e.removeAttribute("role"),e.classList.remove("sm-subtree","sm-collapsed")}),this.#s=null,this.#$=!1,this.#u=null,this.#a=0,this.#o=0}attributeChangedCallback(e,s,t){if(!(s===t||!this.isConnected||!this.hasAttribute("data-upgraded"))){if((this.getAttribute("mode")||"nav-enhance")!=="ia-tree"){e==="src"&&t&&this.#_();return}switch(e){case"src":t&&this._loadSrc(t);break;case"title":case"collapsed":case"data-view":this.#r||this._reinit();break;case"data-orientation":case"data-detail":!this.#r&&this.#e&&(this.#O(),this.#l());break}}}#M(e,s){if(!e)return;let t=e.querySelectorAll(":scope > li");for(let r of t){this.#a++;let i=s+1;i>this.#o&&(this.#o=i);let n=r.querySelector(":scope > ul");n&&this.#M(n,i)}}#B(e,s){if(!e)return;s>0&&(e.setAttribute("role","group"),e.classList.add("sm-subtree"));let t=[...e.querySelectorAll(":scope > li")];for(let r of t){let i=!!r.querySelector(":scope > ul"),n=r.querySelector(":scope > a"),a=r.getAttribute("data-page-type")||"page",u=r.getAttribute("data-template")||"",h=r.getAttribute("data-status")||"";r.setAttribute("role","treeitem"),r.setAttribute("tabindex","-1");let f=document.createElement("span");if(f.className="sm-node-content",i){r.setAttribute("aria-expanded","true");let c=document.createElement("button");c.className="sm-toggle",c.setAttribute("type","button"),c.setAttribute("aria-hidden","true"),c.setAttribute("tabindex","-1"),c.textContent="\u25BE",f.appendChild(c)}else{let c=document.createElement("span");c.className="sm-leaf-marker",c.setAttribute("aria-hidden","true"),f.appendChild(c)}if(h&&S[h]){let c=document.createElement("span");c.className=`sm-status-dot ${S[h].cssClass}`,c.setAttribute("title",S[h].label),c.setAttribute("aria-hidden","true"),f.appendChild(c);let g=document.createElement("span");g.className="visually-hidden",g.textContent=`${S[h].label}: `,f.appendChild(g)}if(n&&(n.setAttribute("tabindex","-1"),f.appendChild(n)),x[a]){let c=document.createElement("span");c.className=`sm-badge ${x[a].cssClass}`,c.textContent=x[a].label,f.appendChild(c)}if(u){let c=document.createElement("span");c.className="sm-badge sm-badge--template",c.textContent=u,f.appendChild(c)}r.insertBefore(f,r.firstChild);let o=r.querySelector(":scope > ul");o&&this.#B(o,s+1)}}#N(){let e=this.getAttribute("title");if(!e&&this.#a===0)return;if(this.#i=document.createElement("div"),this.#i.className="sm-header",e){let r=document.createElement("h2");r.className="sm-title",r.textContent=e,this.#i.appendChild(r)}let s=document.createElement("span");s.className="sm-summary",s.textContent=`${this.#a} pages \xB7 ${this.#o} levels deep`,this.#i.appendChild(s);let t=document.createElement("button");t.className="sm-toggle-all",t.setAttribute("type","button"),t.textContent="Collapse all",t.addEventListener("click",()=>{this.querySelectorAll('li[aria-expanded="true"]').length>0?(this.#P(),t.textContent="Expand all"):(this.#et(),t.textContent="Collapse all")}),this.#i.appendChild(t),this.insertBefore(this.#i,this.firstChild)}#P(){let e=this.querySelectorAll("li[aria-expanded]");for(let s of e){s.setAttribute("aria-expanded","false");let t=s.querySelector(":scope > ul");t&&t.classList.add("sm-collapsed");let r=s.querySelector(":scope > .sm-node-content > .sm-toggle");r&&(r.textContent="\u25B8")}this.#H()}#H(){let e=this.#u;if(!e||!this.#s)return;let s=this.#y();if(s.includes(e))return;let t=e.parentElement?.closest('li[role="treeitem"]');for(;t&&!s.includes(t);)t=t.parentElement?.closest('li[role="treeitem"]');let r=t??s[0]??null;if(!r)return;let i=e.contains(document.activeElement);e.setAttribute("tabindex","-1"),r.setAttribute("tabindex","0"),this.#u=r,i&&r.focus()}#et(){let e=this.querySelectorAll("li[aria-expanded]");for(let s of e){s.setAttribute("aria-expanded","true");let t=s.querySelector(":scope > ul");t&&t.classList.remove("sm-collapsed");let r=s.querySelector(":scope > .sm-node-content > .sm-toggle");r&&(r.textContent="\u25BE")}}#g(e){let s=e.getAttribute("aria-expanded")==="true";e.setAttribute("aria-expanded",s?"false":"true");let t=e.querySelector(":scope > ul");t&&t.classList.toggle("sm-collapsed",s);let r=e.querySelector(":scope > .sm-node-content > .sm-toggle");r&&(r.textContent=s?"\u25B8":"\u25BE"),s&&this.#H()}#st(e){let s=e.target;if(s.closest(".sm-toggle")){e.preventDefault();let i=s.closest('li[role="treeitem"]');i&&this.#g(i);return}let t=s.closest('li[role="treeitem"]');if(!t)return;this.#h(t);let r=s.closest("a");r&&this.dispatchEvent(new CustomEvent("site-map:select",{bubbles:!0,detail:{href:r.getAttribute("href")||"",pageType:t.getAttribute("data-page-type")||"page",template:t.getAttribute("data-template")||""}}))}#rt(e){let s=e.target,t=s.closest('li[role="treeitem"]');if(!t||e.key==="Enter"&&s.closest("a")&&s!==t||e.altKey||e.ctrlKey||e.metaKey)return;let r=this.matches(":dir(rtl)"),i=e.key;r&&i==="ArrowRight"?i="ArrowLeft":r&&i==="ArrowLeft"&&(i="ArrowRight");let n=!1;switch(i){case"ArrowDown":n=!0,this.#it(t);break;case"ArrowUp":n=!0,this.#nt(t);break;case"ArrowRight":if(n=!0,t.getAttribute("aria-expanded")==="false")this.#g(t);else if(t.getAttribute("aria-expanded")==="true"){let a=t.querySelector(':scope > ul > li[role="treeitem"]');a&&this.#h(a)}break;case"ArrowLeft":if(n=!0,t.getAttribute("aria-expanded")==="true")this.#g(t);else{let a=t.parentElement?.closest('li[role="treeitem"]');a&&this.#h(a)}break;case"Enter":{n=!0;let a=t.querySelector(":scope > .sm-node-content > a[href]");a?a.click():t.hasAttribute("aria-expanded")&&this.#g(t);break}case" ":{n=!0,t.hasAttribute("aria-expanded")?this.#g(t):t.querySelector(":scope > .sm-node-content > a[href]")?.click();break}case"Home":n=!0;{let a=this.querySelector('li[role="treeitem"]');a&&this.#h(a)}break;case"End":n=!0;{let a=this.#y();a.length&&this.#h(a[a.length-1])}break}n&&(e.preventDefault(),e.stopPropagation())}#y(){let e=[],s=r=>{if(!r)return;let i=[...r.querySelectorAll(':scope > li[role="treeitem"]')];for(let n of i)if(e.push(n),n.getAttribute("aria-expanded")==="true"){let a=n.querySelector(":scope > ul");a&&s(a)}},t=this.querySelector("nav > ul");return s(t),e}#it(e){let s=this.#y(),t=s.indexOf(e);t>=0&&t<s.length-1&&this.#h(s[t+1])}#nt(e){let s=this.#y(),t=s.indexOf(e);t>0&&this.#h(s[t-1])}#h(e){this.#u&&this.#u.setAttribute("tabindex","-1"),e.setAttribute("tabindex","0"),e.focus(),this.#u=e}static#v="http://www.w3.org/2000/svg";static#p=150;static#f=70;static#I=30;static#w=50;static#at=20;#z(e){let s=[];for(let t of e.querySelectorAll(":scope > li")){let r=t.querySelector(":scope > a"),i=t.querySelector(":scope > ul");s.push({label:r?.textContent?.trim()||t.firstChild?.textContent?.trim()||"",href:r?.getAttribute("href")||"",anchor:r?.hasAttribute("href")?r:null,pageType:t.getAttribute("data-page-type")||"page",template:t.getAttribute("data-template")||"",status:t.getAttribute("data-status")||"",children:i?this.#z(i):[],x:0,y:0,subtreeWidth:0,collapsed:!1,childCount:0})}return s}#D(e,s=0){let t=l.#p,r=l.#f,i=l.#I,n=l.#w;for(let a of e)a.childCount=this.#F(a),a.children.length>0&&!a.collapsed?(this.#D(a.children,s+1),a.subtreeWidth=a.children.reduce((u,h)=>u+h.subtreeWidth,0)+i*(a.children.length-1)):a.subtreeWidth=t,a.subtreeWidth=Math.max(a.subtreeWidth,t)}#F(e){let s=0;for(let t of e.children)s+=1+this.#F(t);return s}#V(e,s,t){let r=l.#p,i=l.#f,n=l.#I,a=l.#w,u=s;for(let h of e)h.x=u+(h.subtreeWidth-r)/2,h.y=t,h.children.length>0&&!h.collapsed&&this.#V(h.children,u,t+i+a),u+=h.subtreeWidth+n}#ot(e){e.hidden=!0,e.setAttribute("aria-hidden","true");let s=e.querySelector("ul");s&&(this.#e=this.#z(s),this.#l())}#e=null;#n=1;get#S(){return this.dataset.orientation==="horizontal"?"horizontal":"vertical"}get#A(){return Math.min(4,Math.max(0,parseInt(this.dataset.detail||"2",10)))}static#x={zoomIn:'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/>',zoomOut:'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/>',reset:'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',flip:'<path d="M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3"/><path d="M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3"/><path d="M4 12H2"/><path d="M10 12H8"/><path d="M16 12h-2"/><path d="M22 12h-2"/>'};static#E=["Shape","Shape + Title","Full","Full + Status","Wireframe"];#lt(e){let s=this.#t?.querySelector(".sm-visual-scroll"),t=this.#t?.querySelector('svg[role="tree"]'),r={nodeId:null,rectTop:0,rectLeft:0,focusId:this.#c};if(!s||!t)return r;let i=e||this.#c;if(!i)return r;let a=t.querySelector(`[data-node-id="${i}"]`)?.querySelector("rect");if(!a)return r;let u=a.getBoundingClientRect(),h=s.getBoundingClientRect();return r.nodeId=i,r.rectTop=u.top-h.top,r.rectLeft=u.left-h.left,r}#W(e,s){let t=this.#t?.querySelector(".sm-visual-scroll"),r=this.#t?.querySelector('svg[role="tree"]');if(!t||!r)return;if(e.nodeId){let u=r.querySelector(`[data-node-id="${e.nodeId}"]`)?.querySelector("rect");if(u){let h=u.getBoundingClientRect(),f=t.getBoundingClientRect(),o=h.top-f.top-e.rectTop,c=h.left-f.left-e.rectLeft;t.scrollTop+=o,t.scrollLeft+=c}}let i=e.focusId&&r.querySelector(`[data-node-id="${e.focusId}"]`)?e.focusId:"0",n=r.querySelector(`[data-node-id="${i}"]`);n&&this.#j(n),s&&r.focus({preventScroll:!0})}#l(e={}){if(!this.#e)return;let s=this.#lt(e.anchorId||null),t=this.#t?.querySelector(".sm-visual-scroll")??null,r=!!t&&t.contains(document.activeElement),i=l.#v,n=l.#p,a=l.#f,u=l.#at,h=this.#S==="horizontal";this.#D(this.#e),this.#V(this.#e,u,u);let f=this.#G(this.#e),o=f.maxX+n+u,c=f.maxY+a+u;h&&([o,c]=[c,o]);let g=this.#t?.querySelector(".sm-visual-summary");this.#t||(this.#t=document.createElement("div"),this.#t.className="sm-visual",this.#t.appendChild(this.#ct()),g=document.createElement("div"),g.className="sm-visual-summary",this.#t.appendChild(g),this.appendChild(this.#t));let p=document.createElement("div");p.className="sm-visual-scroll";let b=document.createElementNS(i,"svg");b.setAttribute("viewBox",`0 0 ${o} ${c}`),b.setAttribute("width",String(o)),b.setAttribute("height",String(c)),b.setAttribute("class",`sm-vsvg${this.#A>=4?" sm-vsvg--wireframe":""}`);let y=document.createElement("div");if(y.className="sm-visual-zoom",y.style.width=`${Math.round(o*this.#n)}px`,y.style.height=`${Math.round(c*this.#n)}px`,b.style.transform=`scale(${this.#n})`,b.style.transformOrigin="0 0",h){let v=document.createElementNS(i,"g");v.setAttribute("transform",`rotate(90 0 0) translate(0 -${c})`),this.#q(v,this.#e),this.#k(v,this.#e),b.appendChild(v)}else this.#q(b,this.#e),this.#k(b,this.#e);if(y.appendChild(b),p.appendChild(y),g){let v=Math.round(this.#n*100);g.textContent=`${this.#a} pages \xB7 ${this.#o} levels \xB7 ${v}%`}b.setAttribute("tabindex","0"),b.setAttribute("role","tree"),b.setAttribute("aria-label",`Site map${this.getAttribute("title")?": "+this.getAttribute("title"):""}`),b.addEventListener("keydown",v=>this.#ut(v)),b.addEventListener("click",v=>{let q=v.target,k=q.closest("[data-toggle]");if(k){let C=k.getAttribute("data-toggle");C&&this.#T(C);return}let E=q.closest("[data-node-id]");if(E){let C=E.getAttribute("data-node-id");C&&this.#m(C),this.dispatchEvent(new CustomEvent("site-map:select",{bubbles:!0,detail:{href:E.getAttribute("data-href")||"",pageType:E.getAttribute("data-page-type")||"page",template:E.getAttribute("data-template")||""}}))}});let d=this.#t,m=()=>{t&&t.isConnected?t.replaceWith(p):d.insertBefore(p,d.querySelector(".sm-visual-summary"))},A=null;t?.isConnected?A=M(this,m,"sm-vt"):m(),A?A.updateCallbackDone.then(()=>this.#W(s,r)):this.#W(s,r),this.#pt(d,b)}#O(){let e=this.#t?.querySelector(".sm-vtoolbar");if(!e)return;let s=e.querySelector("[data-sm-flip]"),t=this.#S==="horizontal"?"Vertical":"Horizontal";s?.setAttribute("aria-label",t),s?.setAttribute("title",t);let r=e.querySelector(".sm-vtoolbar-slider");r&&(r.value=String(this.#A));let i=e.querySelector(".sm-vtoolbar-detail-label");i&&(i.textContent=l.#E[this.#A])}#R(e,s){this.#r=!0,this.dataset[e]=s,this.#r=!1}#ct(){let e=document.createElement("div");e.className="sm-vtoolbar",e.setAttribute("role","group"),e.setAttribute("aria-label","Site map controls");let s=g=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${g}</svg>`,t=this.#C(s(l.#x.zoomIn),"Zoom in",()=>{this.#n=Math.min(3,this.#n+.25),this.#l()});e.appendChild(t);let r=this.#C(s(l.#x.zoomOut),"Zoom out",()=>{this.#n=Math.max(.25,this.#n-.25),this.#l()});e.appendChild(r);let i=this.#C(s(l.#x.reset),"Reset zoom",()=>{this.#n=1,this.#l()});e.appendChild(i);let n=document.createElement("span");n.className="sm-vtoolbar-sep",e.appendChild(n);let a=this.#S==="horizontal"?"Vertical":"Horizontal",u=this.#C(s(l.#x.flip),a,()=>{this.#R("orientation",this.#S==="horizontal"?"vertical":"horizontal"),this.#O(),this.#l()});u.setAttribute("data-sm-flip",""),e.appendChild(u),e.appendChild(n.cloneNode());let h=this.#A,f=document.createElement("label");f.className="sm-vtoolbar-detail",f.textContent="Detail ";let o=document.createElement("input");o.type="range",o.min="0",o.max="4",o.value=String(h),o.setAttribute("aria-label","Detail level"),o.className="sm-vtoolbar-slider",f.appendChild(o);let c=document.createElement("span");return c.className="sm-vtoolbar-detail-label",c.textContent=l.#E[h],f.appendChild(c),o.addEventListener("input",()=>{this.#R("detail",o.value),c.textContent=l.#E[parseInt(o.value,10)],o.setAttribute("aria-valuetext",c.textContent),this.#l()}),o.setAttribute("aria-valuetext",l.#E[h]),e.appendChild(f),e}#C(e,s,t){let r=document.createElement("button");return r.type="button",r.className="sm-vtoolbar-btn",r.innerHTML=e,r.setAttribute("aria-label",s),r.setAttribute("title",s),r.addEventListener("click",t),r}#c=null;#U(e,s=""){let t=[];for(let r=0;r<e.length;r++){let i=e[r],n=s?`${s}-${r}`:String(r);t.push(n),i.children.length>0&&!i.collapsed&&t.push(...this.#U(i.children,n))}return t}#dt(e){let s=e.lastIndexOf("-");return s>0?e.slice(0,s):null}#gt(e){let s=this.#b(e,this.#e);return!s||s.collapsed||s.children.length===0?null:`${e}-0`}#m(e){if(!e||!this.#t)return;let s=this.#t.querySelector('svg[role="tree"]');if(!s)return;let t=s.querySelector(`[data-node-id="${e}"]`);if(!t)return;this.#j(t),this.#c=e;let r=t.querySelector("rect"),i=this.#t?.querySelector(".sm-visual-scroll");if(r&&i){let n=r.getBoundingClientRect(),a=i.getBoundingClientRect();(n.left<a.left||n.right>a.right||n.top<a.top||n.bottom>a.bottom)&&r.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}#j(e){let s=e.closest("svg");if(!s)return;s.querySelectorAll(".sm-vfocus-ring").forEach(i=>i.remove()),s.querySelectorAll('[data-node-id][aria-selected="true"]').forEach(i=>i.setAttribute("aria-selected","false"));let t=l.#v,r=e.querySelector("rect");if(r){let i=document.createElementNS(t,"rect");i.setAttribute("x",String(parseFloat(r.getAttribute("x")??"0")-3)),i.setAttribute("y",String(parseFloat(r.getAttribute("y")??"0")-3)),i.setAttribute("width",String(parseFloat(r.getAttribute("width")??"0")+6)),i.setAttribute("height",String(parseFloat(r.getAttribute("height")??"0")+6)),i.setAttribute("rx","11"),i.setAttribute("class","sm-vfocus-ring"),i.setAttribute("aria-hidden","true"),e.parentNode?.insertBefore(i,e)}e.setAttribute("aria-selected","true"),e.id&&s.setAttribute("aria-activedescendant",e.id),this.#c=e.getAttribute("data-node-id")}#ut(e){if(!this.#e)return;let s=this.#c||"0",t=!1;switch(e.key){case"ArrowDown":{t=!0;let r=this.#b(s,this.#e);r&&r.children.length>0&&!r.collapsed&&this.#m(`${s}-0`);break}case"ArrowUp":{t=!0;let r=this.#dt(s);r&&this.#m(r);break}case"ArrowRight":{t=!0;let r=this.#Y(s,1);r&&this.#m(r);break}case"ArrowLeft":{t=!0;let r=this.#Y(s,-1);r&&this.#m(r);break}case"Enter":{t=!0;let r=this.#b(s,this.#e);r?.anchor?this.dispatchEvent(new CustomEvent("site-map:select",{bubbles:!0,cancelable:!0,detail:{href:r.href,pageType:r.pageType,template:r.template}}))&&r.anchor.click():r&&r.children.length>0&&this.#T(s);break}case" ":{t=!0;let r=this.#b(s,this.#e);r&&r.children.length>0&&this.#T(s);break}case"Home":{t=!0,this.#m("0");break}case"End":{t=!0;let r=this.#U(this.#e);r.length&&this.#m(r[r.length-1]);break}}t&&(e.preventDefault(),e.stopPropagation())}#Y(e,s){let t=e.split("-").map(Number),r=t[t.length-1]+s;if(r<0)return null;let i=t.length>1?t.slice(0,-1).join("-"):null,n=i?this.#b(i,this.#e):null,a=n?n.children:this.#e;if(!a||r>=a.length)return null;let u=[...t];return u[u.length-1]=r,u.join("-")}#$=!1;#ht={dragging:!1,startX:0,startY:0,scrollLeft:0,scrollTop:0,moved:!1};#pt(e,s){if(s.style.cursor="grab",this.#$)return;this.#$=!0;let t=this.#ht;this.listen(this,"pointerdown",r=>{let i=r;if(i.target.closest("button, [data-toggle], .sm-vtoolbar, input"))return;let n=this.querySelector(".sm-visual-scroll");if(!n)return;t.dragging=!0,t.moved=!1,t.startX=i.clientX,t.startY=i.clientY,t.scrollLeft=n.scrollLeft,t.scrollTop=n.scrollTop;let a=this.querySelector('svg[role="tree"]');a&&(a.style.cursor="grabbing")}),this.listen(window,"pointermove",r=>{if(!t.dragging)return;let i=r,n=i.clientX-t.startX,a=i.clientY-t.startY;(Math.abs(n)>3||Math.abs(a)>3)&&(t.moved=!0);let u=this.querySelector(".sm-visual-scroll");u&&(u.scrollLeft=t.scrollLeft-n,u.scrollTop=t.scrollTop-a)}),this.listen(window,"pointerup",()=>{if(!t.dragging)return;t.dragging=!1;let r=this.querySelector('svg[role="tree"]');r&&(r.style.cursor="grab")}),this.listen(this,"click",r=>{t.moved&&(r.stopPropagation(),t.moved=!1)},{capture:!0})}#G(e){let s=0,t=0;for(let r of e)if(r.x+l.#p>s&&(s=r.x+l.#p),r.y+l.#f>t&&(t=r.y+l.#f),r.children.length>0&&!r.collapsed){let i=this.#G(r.children);i.maxX>s&&(s=i.maxX),i.maxY>t&&(t=i.maxY)}return{maxX:s,maxY:t}}#q(e,s){let t=l.#v,r=l.#p,i=l.#f,n=l.#w;for(let a of s){if(a.children.length===0||a.collapsed)continue;let u=a.x+r/2,h=a.y+i,f=h+n/2;for(let o of a.children){let c=o.x+r/2,g=o.y,p=document.createElementNS(t,"path");p.setAttribute("d",`M ${u} ${h} L ${u} ${f} L ${c} ${f} L ${c} ${g}`),p.setAttribute("class","sm-vedge"),p.setAttribute("aria-hidden","true"),e.appendChild(p)}this.#q(e,a.children)}}#k(e,s,t=""){let r=l.#v,i=l.#p,n=l.#f,a=this.#A,u=a>=4,h=t?t.split("-").length+1:1;for(let f=0;f<s.length;f++){let o=s[f],c=t?`${t}-${f}`:String(f),g=x[o.pageType]?o.pageType:"page",p=document.createElementNS(r,"g");p.setAttribute("class",`sm-vnode sm-vnode--${g}`),p.id=`${this.#d}-n-${c}`,p.setAttribute("role","treeitem"),p.setAttribute("aria-level",String(h)),p.setAttribute("aria-setsize",String(s.length)),p.setAttribute("aria-posinset",String(f+1)),p.setAttribute("aria-selected","false"),o.children.length>0&&p.setAttribute("aria-expanded",o.collapsed?"false":"true");let b=o.status&&S[o.status]?`, ${S[o.status].label}`:"";p.setAttribute("aria-label",`${o.label||o.href||"Untitled"}, ${x[g].label}${o.template?`, ${o.template}`:""}${b}`),p.setAttribute("data-node-id",c),p.setAttribute("data-href",o.href),p.setAttribute("data-page-type",o.pageType),p.setAttribute("data-template",o.template),p.style.cursor="pointer";let y=document.createElementNS(r,"rect");if(y.setAttribute("x",String(o.x)),y.setAttribute("y",String(o.y)),y.setAttribute("width",String(i)),y.setAttribute("height",String(n)),y.setAttribute("rx","8"),y.setAttribute("class","sm-vbox"),(u||o.pageType==="modal")&&y.setAttribute("stroke-dasharray","6 3"),p.appendChild(y),a>=1){let d=document.createElementNS(r,"text");d.setAttribute("x",String(o.x+i/2)),d.setAttribute("y",String(a===1?o.y+n/2+5:o.y+24)),d.setAttribute("text-anchor","middle"),d.setAttribute("font-size","13"),d.setAttribute("font-weight","600"),d.setAttribute("class","sm-vlabel"),d.textContent=o.label.length>18?o.label.slice(0,17)+"\u2026":o.label,p.appendChild(d)}if(a>=2){let d=document.createElementNS(r,"text");if(d.setAttribute("x",String(o.x+i/2)),d.setAttribute("y",String(o.y+40)),d.setAttribute("text-anchor","middle"),d.setAttribute("font-size","9"),d.setAttribute("font-weight","700"),d.setAttribute("class","sm-vtype"),d.textContent=(x[o.pageType]?.label||o.pageType).toUpperCase(),p.appendChild(d),o.template){let m=document.createElementNS(r,"text");m.setAttribute("x",String(o.x+i/2)),m.setAttribute("y",String(o.y+54)),m.setAttribute("text-anchor","middle"),m.setAttribute("font-size","9"),m.setAttribute("class","sm-vtemplate"),m.textContent=o.template,p.appendChild(m)}}if(a>=3&&o.status&&S[o.status]){let d=document.createElementNS(r,"circle");d.setAttribute("cx",String(o.x+i/2)),d.setAttribute("cy",String(o.y+n-8)),d.setAttribute("r","4"),d.setAttribute("class",`sm-vstatus sm-vstatus--${o.status}`),p.appendChild(d)}if(u)for(let d=0;d<2;d++){let m=document.createElementNS(r,"line");m.setAttribute("x1",String(o.x+12)),m.setAttribute("x2",String(o.x+i-12)),m.setAttribute("y1",String(o.y+n-22+d*8)),m.setAttribute("y2",String(o.y+n-22+d*8)),m.setAttribute("class","sm-vwire"),p.appendChild(m)}if(o.children.length>0){let d=document.createElementNS(r,"g");d.setAttribute("data-toggle",c),d.setAttribute("class","sm-vtoggle"),d.setAttribute("aria-hidden","true");let m=document.createElementNS(r,"circle");m.setAttribute("cx",String(o.x+i/2)),m.setAttribute("cy",String(o.y+n+10)),m.setAttribute("r","10"),d.appendChild(m);let A=document.createElementNS(r,"text");A.setAttribute("x",String(o.x+i/2)),A.setAttribute("y",String(o.y+n+14)),A.setAttribute("text-anchor","middle"),A.setAttribute("font-size","11"),A.setAttribute("font-weight","700"),A.textContent=o.collapsed?`+${o.childCount}`:"\u2212",d.appendChild(A),p.appendChild(d)}e.appendChild(p),o.children.length>0&&!o.collapsed&&this.#k(e,o.children,c)}}#T(e){let s=this.#b(e,this.#e);s&&(s.collapsed=!s.collapsed,this.#c||(this.#c=e),this.#l({anchorId:e}))}#b(e,s){if(!s)return null;let t=e.split("-").map(Number),r=s,i=null;for(let n of t){if(!r||n>=r.length)return null;i=r[n],r=i.children}return i}async _loadSrc(e){if(e)try{let s=await fetch(e);if(!s.ok)throw new Error(`HTTP ${s.status}`);let t=await s.json();t.title&&!this.getAttribute("title")&&(this.#r=!0,this.setAttribute("title",String(t.title)),this.#r=!1),this._setPages(t.pages||[])}catch(s){console.warn(`[site-map] Failed to load src="${e}":`,s)}}get pages(){let s=this.querySelector(":scope > nav")?.querySelector("ul");return s?this.#X(s):[]}set pages(e){this._setPages(Array.isArray(e)?e:[]),this.dispatchEvent(new CustomEvent("site-map:pages-changed",{detail:{pages:this.pages,source:"property"},bubbles:!0}))}_setPages(e){for(;this.firstChild;)this.firstChild.remove();let s=document.createElement("nav"),t=document.createElement("ul");this.#K(t,e),s.appendChild(t),this.appendChild(s),this._reinit()}#X(e){let s=[];for(let t of e.querySelectorAll(":scope > li")){let r=t.querySelector(":scope > a, :scope > .sm-node-content > a"),i=t.querySelector(":scope > ul"),n={label:r?.textContent?.trim()||"",href:r?.getAttribute("href")||void 0,pageType:t.getAttribute("data-page-type")||void 0,template:t.getAttribute("data-template")||void 0,status:t.getAttribute("data-status")||void 0};i&&(n.children=this.#X(i)),s.push(n)}return s}#K(e,s){for(let t of s){let r=document.createElement("li");t.pageType&&r.setAttribute("data-page-type",t.pageType),t.template&&r.setAttribute("data-template",t.template),t.status&&r.setAttribute("data-status",t.status);let i=document.createElement("a"),n=B(t.href);if(n&&i.setAttribute("href",n),i.textContent=String(t.label??""),r.appendChild(i),t.children&&t.children.length>0){let a=document.createElement("ul");this.#K(a,t.children),r.appendChild(a)}e.appendChild(r)}}#ft(){this.#Z(),this.#L(),this.#Q(),this.getAttribute("src")&&this.#_()}#J(){return this.querySelector(":scope > nav:not([data-sitemap-controls])")}#mt(){this.querySelector(":scope > [data-sitemap-controls]")?.remove()}#Z(){let e=this.getAttribute("current")||window.location.pathname,s=this.querySelectorAll("a");for(let t of s){if(!t.hasAttribute("href"))continue;new URL(t.href,window.location.origin).pathname===e&&t.setAttribute("aria-current","page")}}#L(){let e=this.querySelector('[aria-current="page"]');if(!e)return;let s=e.parentElement;for(;s&&s!==this;)s.tagName==="DETAILS"&&(s.open=!0),s=s.parentElement}#Q(){if(this.querySelector(":scope > [data-sitemap-controls]")?.remove(),!this.querySelector("details"))return;let e=()=>this.querySelectorAll("details"),s=document.createElement("nav");s.setAttribute("data-sitemap-controls",""),s.setAttribute("aria-label",this.getAttribute("data-label-controls")??"Sitemap controls");let t=document.createElement("button");t.type="button",t.className="small secondary",t.textContent=this.getAttribute("data-label-expand")??"Expand all",this.listen(t,"click",()=>{for(let n of e())n.open=!0});let r=document.createElement("button");r.type="button",r.className="small secondary",r.textContent=this.getAttribute("data-label-collapse")??"Collapse all",this.listen(r,"click",()=>{for(let n of e())n.open=!1;this.#L()}),s.append(t,r);let i=this.#J();i?i.before(s):this.prepend(s)}async#_(){let e=this.getAttribute("src");if(e)try{let s=await fetch(e);if(!s.ok)return;let t=await s.json();this.#bt(t)}catch{}}#bt(e){if(!e||!Array.isArray(e.children))return;let s=this.#J(),t=document.createElement("nav");t.setAttribute("aria-label",s?.getAttribute("aria-label")||"Full site map"),t.append(this.#tt(e.children)),s?s.replaceWith(t):this.append(t),this.#Z(),this.#L(),this.#Q()}#tt(e){let s=document.createElement("ul");for(let t of e){let r=document.createElement("li");if(t.children?.length){let i=document.createElement("details"),n=document.createElement("summary");n.textContent=String(t.title??""),i.append(n),i.append(this.#tt(t.children)),r.append(i)}else{let i=document.createElement("a"),n=B(t.href||t.path);n&&i.setAttribute("href",n),i.textContent=String(t.title??""),r.append(i)}s.append(r)}return s}};L("site-map",$);export{$ as SiteMap};
|
|
1
|
+
var I=window.matchMedia("(prefers-reduced-motion: reduce)");var T=new Map;function L(c,e,s={}){let t=s.priority??10,r={impl:e,bundle:s.bundle,contract:s.contract,priority:t},i=T.get(c);if(customElements.get(c)){if(!i||i.priority>=t){i&&i.priority===t&&i.impl!==e&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${i.bundle}" (priority ${i.priority}). Skipping "${s.bundle}".`);return}console.warn(`[VB Bundle] Tag <${c}> defined by "${i.bundle}" cannot be replaced (customElements.define is permanent). "${s.bundle}" has higher priority but arrived late.`);return}if(i&&i.priority>=t){i.priority===t&&console.warn(`[VB Bundle] Tag <${c}> already registered by "${i.bundle}". Skipping "${s.bundle}" (first wins at equal priority).`);return}T.set(c,r),customElements.define(c,e)}var q=class extends HTMLElement{#u=[];#r;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#u)e();this.#u=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,s,t,r){e.addEventListener(s,t,r),this.#u.push(()=>e.removeEventListener(s,t,r))}_reinit(){for(let e of this.#u)e();this.#u=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,s){this.#r||(this.#r=this.attachInternals());let t=this.#r.states;try{s?t.add(e):t.delete(e)}catch{let r=`--${e}`;s?t.add(r):t.delete(r)}}_adoptInternals(e){this.#r||(this.#r=e)}#s(){return this.constructor.formAssociated&&this.#r?this.#r:null}get validity(){return this.#s()?.validity}get validationMessage(){return this.#s()?.validationMessage??""}get willValidate(){return this.#s()?.willValidate??!1}get form(){return this.#s()?.form??null}checkValidity(){return this.#s()?.checkValidity()??!0}reportValidity(){return this.#s()?.reportValidity()??!0}};var N=0;function M(c,e,s="vb-vt"){if(!c?.isConnected||typeof document>"u"||!("startViewTransition"in document)||matchMedia("(prefers-reduced-motion: reduce)").matches)return e(),null;let t=`${s}-${++N}`;c.style.viewTransitionName=t;let r=document.startViewTransition(e);return r.finished.finally(()=>{c.style.viewTransitionName===t&&(c.style.viewTransitionName="")}),r}var E={layout:{label:"Layout",cssClass:"sm-badge--layout"},section:{label:"Section",cssClass:"sm-badge--section"},dashboard:{label:"Dashboard",cssClass:"sm-badge--dashboard"},page:{label:"Page",cssClass:"sm-badge--page"},modal:{label:"Modal",cssClass:"sm-badge--modal"},redirect:{label:"Redirect",cssClass:"sm-badge--redirect"}},S={draft:{label:"Draft",cssClass:"sm-status--draft"},ready:{label:"Ready",cssClass:"sm-status--ready"},live:{label:"Live",cssClass:"sm-status--live"},deprecated:{label:"Deprecated",cssClass:"sm-status--deprecated"}};function B(c){if(typeof c!="string"||!c.trim())return null;try{let e=new URL(c,document.baseURI);return e.protocol==="http:"||e.protocol==="https:"?c:null}catch{return null}}var P=0,k=class c extends q{static get observedAttributes(){return["src","collapsed","title","data-view","data-orientation","data-detail"]}#u=`sm-${++P}`;#r=!1;#s=null;#i=null;#t=null;#h=null;#a=0;#l=0;setup(){if((this.getAttribute("mode")||"nav-enhance")!=="ia-tree"){this.#mt();return}let e=this.getAttribute("src");if(e&&!this.querySelector("nav")){this._loadSrc(e);return}let s=this.querySelector(":scope > nav");if(!s)return;if(this.#a=0,this.#l=0,this.#M(s.querySelector("ul"),0),this.dataset.view==="visual"){this.#N(),this.#lt(s),this.dispatchEvent(new CustomEvent("site-map:ready",{bubbles:!0,detail:{nodeCount:this.#a,depth:this.#l}}));return}this.#B(s.querySelector("ul"),0),this.#N(),s.classList.add("sm-tree");let t=this.getAttribute("title")||"Site map";!s.hasAttribute("aria-label")&&!s.hasAttribute("aria-labelledby")&&(s.setAttribute("aria-label",t),s.setAttribute("data-sm-labelled",""));let r=s.querySelector("ul");r&&(r.setAttribute("role","tree"),r.setAttribute("aria-label",t)),this.#s=s,this.hasAttribute("collapsed")&&this.#P();let i=s.querySelector('a[aria-current="page"]')?.closest('li[role="treeitem"]')??null,n=i&&this.#A().includes(i)?i:s.querySelector('li[role="treeitem"]');n&&(n.setAttribute("tabindex","0"),this.#h=n),this.listen(s,"keydown",a=>this.#rt(a)),this.listen(s,"click",a=>this.#st(a)),this.dispatchEvent(new CustomEvent("site-map:ready",{bubbles:!0,detail:{nodeCount:this.#a,depth:this.#l}}))}teardown(){if((this.getAttribute("mode")||"nav-enhance")!=="ia-tree"){this.#bt();return}if(this.#t){this.#t.remove(),this.#t=null;let e=this.querySelector(":scope > nav");e&&(e.hidden=!1,e.removeAttribute("aria-hidden"))}if(this.#e=null,this.#d=null,this.#i&&(this.#i.remove(),this.#i=null),this.#s){this.#s.classList.remove("sm-tree"),this.#s.hasAttribute("data-sm-labelled")&&(this.#s.removeAttribute("aria-label"),this.#s.removeAttribute("data-sm-labelled"));let e=this.#s.querySelector('ul[role="tree"]');e?.removeAttribute("role"),e?.removeAttribute("aria-label")}this.querySelectorAll(".sm-node-content").forEach(e=>{let s=e.querySelector(":scope > a");s&&(s.removeAttribute("tabindex"),e.before(s)),e.remove()}),this.querySelectorAll(".sm-toggle").forEach(e=>e.remove()),this.querySelectorAll('li[role="treeitem"]').forEach(e=>{e.removeAttribute("role"),e.removeAttribute("aria-expanded"),e.removeAttribute("tabindex")}),this.querySelectorAll('ul[role="group"]').forEach(e=>{e.removeAttribute("role"),e.classList.remove("sm-subtree","sm-collapsed")}),this.#s=null,this.#q=!1,this.#h=null,this.#a=0,this.#l=0}attributeChangedCallback(e,s,t){if(!(s===t||!this.isConnected||!this.hasAttribute("data-upgraded"))){if((this.getAttribute("mode")||"nav-enhance")!=="ia-tree"){e==="src"&&t&&this.#_();return}switch(e){case"src":t&&this._loadSrc(t);break;case"title":case"collapsed":case"data-view":this.#r||this._reinit();break;case"data-orientation":case"data-detail":!this.#r&&this.#e&&(this.#W(),this.#c());break}}}#M(e,s){if(!e)return;let t=e.querySelectorAll(":scope > li");for(let r of t){this.#a++;let i=s+1;i>this.#l&&(this.#l=i);let n=r.querySelector(":scope > ul");n&&this.#M(n,i)}}#B(e,s){if(!e)return;s>0&&(e.setAttribute("role","group"),e.classList.add("sm-subtree"));let t=[...e.querySelectorAll(":scope > li")];for(let r of t){let i=!!r.querySelector(":scope > ul"),n=r.querySelector(":scope > a"),a=r.getAttribute("data-page-type")||"page",l=r.getAttribute("data-template")||"",p=r.getAttribute("data-status")||"";r.setAttribute("role","treeitem"),r.setAttribute("tabindex","-1");let h=document.createElement("span");if(h.className="sm-node-content",i){r.setAttribute("aria-expanded","true");let d=document.createElement("button");d.className="sm-toggle",d.setAttribute("type","button"),d.setAttribute("aria-hidden","true"),d.setAttribute("tabindex","-1"),d.textContent="\u25BE",h.appendChild(d)}else{let d=document.createElement("span");d.className="sm-leaf-marker",d.setAttribute("aria-hidden","true"),h.appendChild(d)}if(p&&S[p]){let d=document.createElement("span");d.className=`sm-status-dot ${S[p].cssClass}`,d.setAttribute("title",S[p].label),d.setAttribute("aria-hidden","true"),h.appendChild(d);let g=document.createElement("span");g.className="visually-hidden",g.textContent=`${S[p].label}: `,h.appendChild(g)}if(n&&(n.setAttribute("tabindex","-1"),h.appendChild(n)),E[a]){let d=document.createElement("span");d.className=`sm-badge ${E[a].cssClass}`,d.textContent=E[a].label,h.appendChild(d)}if(l){let d=document.createElement("span");d.className="sm-badge sm-badge--template",d.textContent=l,h.appendChild(d)}r.insertBefore(h,r.firstChild);let o=r.querySelector(":scope > ul");o&&this.#B(o,s+1)}}#N(){let e=this.getAttribute("title");if(!e&&this.#a===0)return;if(this.#i=document.createElement("div"),this.#i.className="sm-header",e){let r=document.createElement("h2");r.className="sm-title",r.textContent=e,this.#i.appendChild(r)}let s=document.createElement("span");s.className="sm-summary",s.textContent=`${this.#a} pages \xB7 ${this.#l} levels deep`,this.#i.appendChild(s);let t=document.createElement("button");t.className="sm-toggle-all",t.setAttribute("type","button"),t.textContent="Collapse all",t.addEventListener("click",()=>{this.querySelectorAll('li[aria-expanded="true"]').length>0?(this.#P(),t.textContent="Expand all"):(this.#et(),t.textContent="Collapse all")}),this.#i.appendChild(t),this.insertBefore(this.#i,this.firstChild)}#P(){let e=this.querySelectorAll("li[aria-expanded]");for(let s of e){s.setAttribute("aria-expanded","false");let t=s.querySelector(":scope > ul");t&&t.classList.add("sm-collapsed");let r=s.querySelector(":scope > .sm-node-content > .sm-toggle");r&&(r.textContent="\u25B8")}this.#z()}#z(){let e=this.#h;if(!e||!this.#s)return;let s=this.#A();if(s.includes(e))return;let t=e.parentElement?.closest('li[role="treeitem"]');for(;t&&!s.includes(t);)t=t.parentElement?.closest('li[role="treeitem"]');let r=t??s[0]??null;if(!r)return;let i=e.contains(document.activeElement);e.setAttribute("tabindex","-1"),r.setAttribute("tabindex","0"),this.#h=r,i&&r.focus()}#et(){let e=this.querySelectorAll("li[aria-expanded]");for(let s of e){s.setAttribute("aria-expanded","true");let t=s.querySelector(":scope > ul");t&&t.classList.remove("sm-collapsed");let r=s.querySelector(":scope > .sm-node-content > .sm-toggle");r&&(r.textContent="\u25BE")}}#y(e){let s=e.getAttribute("aria-expanded")==="true";e.setAttribute("aria-expanded",s?"false":"true");let t=e.querySelector(":scope > ul");t&&t.classList.toggle("sm-collapsed",s);let r=e.querySelector(":scope > .sm-node-content > .sm-toggle");r&&(r.textContent=s?"\u25B8":"\u25BE"),s&&this.#z()}#st(e){let s=e.target;if(s.closest(".sm-toggle")){e.preventDefault();let i=s.closest('li[role="treeitem"]');i&&this.#y(i);return}let t=s.closest('li[role="treeitem"]');if(!t)return;this.#p(t);let r=s.closest("a");r&&this.dispatchEvent(new CustomEvent("site-map:select",{bubbles:!0,detail:{href:r.getAttribute("href")||"",pageType:t.getAttribute("data-page-type")||"page",template:t.getAttribute("data-template")||""}}))}#rt(e){let s=e.target,t=s.closest('li[role="treeitem"]');if(!t||e.key==="Enter"&&s.closest("a")&&s!==t||e.altKey||e.ctrlKey||e.metaKey)return;let r=this.matches(":dir(rtl)"),i=e.key;r&&i==="ArrowRight"?i="ArrowLeft":r&&i==="ArrowLeft"&&(i="ArrowRight");let n=!1;switch(i){case"ArrowDown":n=!0,this.#it(t);break;case"ArrowUp":n=!0,this.#nt(t);break;case"ArrowRight":if(n=!0,t.getAttribute("aria-expanded")==="false")this.#y(t);else if(t.getAttribute("aria-expanded")==="true"){let a=t.querySelector(':scope > ul > li[role="treeitem"]');a&&this.#p(a)}break;case"ArrowLeft":if(n=!0,t.getAttribute("aria-expanded")==="true")this.#y(t);else{let a=t.parentElement?.closest('li[role="treeitem"]');a&&this.#p(a)}break;case"Enter":{n=!0;let a=t.querySelector(":scope > .sm-node-content > a[href]");a?a.click():t.hasAttribute("aria-expanded")&&this.#y(t);break}case" ":{n=!0,t.hasAttribute("aria-expanded")?this.#y(t):t.querySelector(":scope > .sm-node-content > a[href]")?.click();break}case"Home":n=!0;{let a=this.querySelector('li[role="treeitem"]');a&&this.#p(a)}break;case"End":n=!0;{let a=this.#A();a.length&&this.#p(a[a.length-1])}break}n&&(e.preventDefault(),e.stopPropagation())}#A(){let e=[],s=r=>{if(!r)return;let i=[...r.querySelectorAll(':scope > li[role="treeitem"]')];for(let n of i)if(e.push(n),n.getAttribute("aria-expanded")==="true"){let a=n.querySelector(":scope > ul");a&&s(a)}},t=this.querySelector("nav > ul");return s(t),e}#it(e){let s=this.#A(),t=s.indexOf(e);t>=0&&t<s.length-1&&this.#p(s[t+1])}#nt(e){let s=this.#A(),t=s.indexOf(e);t>0&&this.#p(s[t-1])}#p(e){this.#h&&this.#h.setAttribute("tabindex","-1"),e.setAttribute("tabindex","0"),e.focus(),this.#h=e}static#S="http://www.w3.org/2000/svg";static#f=150;static#m=70;static#H=30;static#w=50;static#ot=20;static#at={ArrowRight:"ArrowDown",ArrowLeft:"ArrowUp",ArrowDown:"ArrowRight",ArrowUp:"ArrowLeft"};#D(e){let s=[];for(let t of e.querySelectorAll(":scope > li")){let r=t.querySelector(":scope > a"),i=t.querySelector(":scope > ul");s.push({label:r?.textContent?.trim()||t.firstChild?.textContent?.trim()||"",href:r?.getAttribute("href")||"",anchor:r?.hasAttribute("href")?r:null,pageType:t.getAttribute("data-page-type")||"page",template:t.getAttribute("data-template")||"",status:t.getAttribute("data-status")||"",children:i?this.#D(i):[],x:0,y:0,subtreeWidth:0,collapsed:!1,childCount:0})}return s}#I(e,s=0){let t=c.#f,r=c.#m,i=c.#H,n=c.#w,a=this.#o==="horizontal"?r:t;for(let l of e)l.childCount=this.#F(l),l.children.length>0&&!l.collapsed?(this.#I(l.children,s+1),l.subtreeWidth=l.children.reduce((p,h)=>p+h.subtreeWidth,0)+i*(l.children.length-1)):l.subtreeWidth=a,l.subtreeWidth=Math.max(l.subtreeWidth,a)}#F(e){let s=0;for(let t of e.children)s+=1+this.#F(t);return s}#$(e,s,t){let r=c.#f,i=c.#m,n=c.#H,a=c.#w;if(this.#o==="horizontal"){let p=t;for(let h of e)h.x=s,h.y=p+(h.subtreeWidth-i)/2,h.children.length>0&&!h.collapsed&&this.#$(h.children,s+r+a,p),p+=h.subtreeWidth+n;return}let l=s;for(let p of e)p.x=l+(p.subtreeWidth-r)/2,p.y=t,p.children.length>0&&!p.collapsed&&this.#$(p.children,l,t+i+a),l+=p.subtreeWidth+n}#lt(e){e.hidden=!0,e.setAttribute("aria-hidden","true");let s=e.querySelector("ul");s&&(this.#e=this.#D(s),this.#c())}#e=null;#n=1;get#o(){return this.dataset.orientation==="horizontal"?"horizontal":"vertical"}get#v(){return Math.min(4,Math.max(0,parseInt(this.dataset.detail||"2",10)))}static#x={zoomIn:'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/>',zoomOut:'<circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/>',reset:'<path d="M15 3h6v6"/><path d="m21 3-7 7"/><path d="m3 21 7-7"/><path d="M9 21H3v-6"/>',flip:'<path d="M21 8V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v3"/><path d="M21 16v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-3"/><path d="M4 12H2"/><path d="M10 12H8"/><path d="M16 12h-2"/><path d="M22 12h-2"/>'};static#E=["Shape","Shape + Title","Full","Full + Status","Wireframe"];#ct(e){let s=this.#t?.querySelector(".sm-visual-scroll"),t=this.#t?.querySelector('svg[role="tree"]'),r={nodeId:null,rectTop:0,rectLeft:0,focusId:this.#d};if(!s||!t)return r;let i=e||this.#d;if(!i)return r;let a=t.querySelector(`[data-node-id="${i}"]`)?.querySelector("rect");if(!a)return r;let l=a.getBoundingClientRect(),p=s.getBoundingClientRect();return r.nodeId=i,r.rectTop=l.top-p.top,r.rectLeft=l.left-p.left,r}#V(e,s){let t=this.#t?.querySelector(".sm-visual-scroll"),r=this.#t?.querySelector('svg[role="tree"]');if(!t||!r)return;if(e.nodeId){let l=r.querySelector(`[data-node-id="${e.nodeId}"]`)?.querySelector("rect");if(l){let p=l.getBoundingClientRect(),h=t.getBoundingClientRect(),o=p.top-h.top-e.rectTop,d=p.left-h.left-e.rectLeft;t.scrollTop+=o,t.scrollLeft+=d}}let i=e.focusId&&r.querySelector(`[data-node-id="${e.focusId}"]`)?e.focusId:"0",n=r.querySelector(`[data-node-id="${i}"]`);n&&this.#U(n),s&&r.focus({preventScroll:!0})}#c(e={}){if(!this.#e)return;let s=this.#ct(e.anchorId||null),t=this.#t?.querySelector(".sm-visual-scroll")??null,r=!!t&&t.contains(document.activeElement),i=c.#S,n=c.#f,a=c.#m,l=c.#ot,p=this.#o==="horizontal";this.#I(this.#e),this.#$(this.#e,l,l);let h=this.#Y(this.#e),o=h.maxX+(p?l+24:n+l),d=h.maxY+(p?l:a+l),g=this.#t?.querySelector(".sm-visual-summary");this.#t||(this.#t=document.createElement("div"),this.#t.className="sm-visual",this.#t.appendChild(this.#dt()),g=document.createElement("div"),g.className="sm-visual-summary",this.#t.appendChild(g),this.appendChild(this.#t));let f=document.createElement("div");f.className="sm-visual-scroll";let m=document.createElementNS(i,"svg");m.setAttribute("viewBox",`0 0 ${o} ${d}`),m.setAttribute("width",String(o)),m.setAttribute("height",String(d)),m.setAttribute("class",`sm-vsvg${this.#v>=4?" sm-vsvg--wireframe":""}`);let y=document.createElement("div");if(y.className="sm-visual-zoom",y.style.width=`${Math.round(o*this.#n)}px`,y.style.height=`${Math.round(d*this.#n)}px`,m.style.transform=`scale(${this.#n})`,m.style.transformOrigin="0 0",this.#k(m,this.#e),this.#X(m,this.#e),y.appendChild(m),f.appendChild(y),g){let v=Math.round(this.#n*100);g.textContent=`${this.#a} pages \xB7 ${this.#l} levels \xB7 ${v}%`}m.setAttribute("tabindex","0"),m.setAttribute("role","tree"),m.setAttribute("aria-label",`Site map${this.getAttribute("title")?": "+this.getAttribute("title"):""}`),m.addEventListener("keydown",v=>this.#ht(v)),m.addEventListener("click",v=>{let C=v.target,A=C.closest("[data-toggle]");if(A){let $=A.getAttribute("data-toggle");$&&this.#T($);return}let w=C.closest("[data-node-id]");if(w){let $=w.getAttribute("data-node-id");$&&this.#b($),this.dispatchEvent(new CustomEvent("site-map:select",{bubbles:!0,detail:{href:w.getAttribute("data-href")||"",pageType:w.getAttribute("data-page-type")||"page",template:w.getAttribute("data-template")||""}}))}});let u=this.#t,b=()=>{t&&t.isConnected?t.replaceWith(f):u.insertBefore(f,u.querySelector(".sm-visual-summary"))},x=null;t?.isConnected?x=M(this,b,"sm-vt"):b(),x?x.updateCallbackDone.then(()=>this.#V(s,r)):this.#V(s,r),this.#ft(u,m)}#W(){let e=this.#t?.querySelector(".sm-vtoolbar");if(!e)return;let s=e.querySelector("[data-sm-flip]"),t=this.#o==="horizontal"?"Vertical":"Horizontal";s?.setAttribute("aria-label",t),s?.setAttribute("title",t);let r=e.querySelector(".sm-vtoolbar-slider");r&&(r.value=String(this.#v));let i=e.querySelector(".sm-vtoolbar-detail-label");i&&(i.textContent=c.#E[this.#v])}#R(e,s){this.#r=!0,this.dataset[e]=s,this.#r=!1}#dt(){let e=document.createElement("div");e.className="sm-vtoolbar",e.setAttribute("role","group"),e.setAttribute("aria-label","Site map controls");let s=g=>`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${g}</svg>`,t=this.#C(s(c.#x.zoomIn),"Zoom in",()=>{this.#n=Math.min(3,this.#n+.25),this.#c()});e.appendChild(t);let r=this.#C(s(c.#x.zoomOut),"Zoom out",()=>{this.#n=Math.max(.25,this.#n-.25),this.#c()});e.appendChild(r);let i=this.#C(s(c.#x.reset),"Reset zoom",()=>{this.#n=1,this.#c()});e.appendChild(i);let n=document.createElement("span");n.className="sm-vtoolbar-sep",e.appendChild(n);let a=this.#o==="horizontal"?"Vertical":"Horizontal",l=this.#C(s(c.#x.flip),a,()=>{this.#R("orientation",this.#o==="horizontal"?"vertical":"horizontal"),this.#W(),this.#c()});l.setAttribute("data-sm-flip",""),e.appendChild(l),e.appendChild(n.cloneNode());let p=this.#v,h=document.createElement("label");h.className="sm-vtoolbar-detail",h.textContent="Detail ";let o=document.createElement("input");o.type="range",o.min="0",o.max="4",o.value=String(p),o.setAttribute("aria-label","Detail level"),o.className="sm-vtoolbar-slider",h.appendChild(o);let d=document.createElement("span");return d.className="sm-vtoolbar-detail-label",d.textContent=c.#E[p],h.appendChild(d),o.addEventListener("input",()=>{this.#R("detail",o.value),d.textContent=c.#E[parseInt(o.value,10)],o.setAttribute("aria-valuetext",d.textContent),this.#c()}),o.setAttribute("aria-valuetext",c.#E[p]),e.appendChild(h),e}#C(e,s,t){let r=document.createElement("button");return r.type="button",r.className="sm-vtoolbar-btn",r.innerHTML=e,r.setAttribute("aria-label",s),r.setAttribute("title",s),r.addEventListener("click",t),r}#d=null;#O(e,s=""){let t=[];for(let r=0;r<e.length;r++){let i=e[r],n=s?`${s}-${r}`:String(r);t.push(n),i.children.length>0&&!i.collapsed&&t.push(...this.#O(i.children,n))}return t}#ut(e){let s=e.lastIndexOf("-");return s>0?e.slice(0,s):null}#yt(e){let s=this.#g(e,this.#e);return!s||s.collapsed||s.children.length===0?null:`${e}-0`}#b(e){if(!e||!this.#t)return;let s=this.#t.querySelector('svg[role="tree"]');if(!s)return;let t=s.querySelector(`[data-node-id="${e}"]`);if(!t)return;this.#U(t),this.#d=e;let r=t.querySelector("rect"),i=this.#t?.querySelector(".sm-visual-scroll");if(r&&i){let n=r.getBoundingClientRect(),a=i.getBoundingClientRect();(n.left<a.left||n.right>a.right||n.top<a.top||n.bottom>a.bottom)&&r.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}}#U(e){let s=e.closest("svg");if(!s)return;s.querySelectorAll(".sm-vfocus-ring").forEach(i=>i.remove()),s.querySelectorAll('[data-node-id][aria-selected="true"]').forEach(i=>i.setAttribute("aria-selected","false"));let t=c.#S,r=e.querySelector("rect");if(r){let i=document.createElementNS(t,"rect");i.setAttribute("x",String(parseFloat(r.getAttribute("x")??"0")-3)),i.setAttribute("y",String(parseFloat(r.getAttribute("y")??"0")-3)),i.setAttribute("width",String(parseFloat(r.getAttribute("width")??"0")+6)),i.setAttribute("height",String(parseFloat(r.getAttribute("height")??"0")+6)),i.setAttribute("rx","11"),i.setAttribute("class","sm-vfocus-ring"),i.setAttribute("aria-hidden","true"),e.parentNode?.insertBefore(i,e)}e.setAttribute("aria-selected","true"),e.id&&s.setAttribute("aria-activedescendant",e.id),this.#d=e.getAttribute("data-node-id")}#ht(e){if(!this.#e)return;let s=this.#d||"0",t=!1;switch(this.#o==="horizontal"?c.#at[e.key]??e.key:e.key){case"ArrowDown":{t=!0;let i=this.#g(s,this.#e);i&&i.children.length>0&&!i.collapsed&&this.#b(`${s}-0`);break}case"ArrowUp":{t=!0;let i=this.#ut(s);i&&this.#b(i);break}case"ArrowRight":{t=!0;let i=this.#j(s,1);i&&this.#b(i);break}case"ArrowLeft":{t=!0;let i=this.#j(s,-1);i&&this.#b(i);break}case"Enter":{t=!0;let i=this.#g(s,this.#e);i?.anchor?this.dispatchEvent(new CustomEvent("site-map:select",{bubbles:!0,cancelable:!0,detail:{href:i.href,pageType:i.pageType,template:i.template}}))&&i.anchor.click():i&&i.children.length>0&&this.#T(s);break}case" ":{t=!0;let i=this.#g(s,this.#e);i&&i.children.length>0&&this.#T(s);break}case"Home":{t=!0,this.#b("0");break}case"End":{t=!0;let i=this.#O(this.#e);i.length&&this.#b(i[i.length-1]);break}}t&&(e.preventDefault(),e.stopPropagation())}#j(e,s){let t=e.split("-").map(Number),r=t[t.length-1]+s;if(r<0)return null;let i=t.length>1?t.slice(0,-1).join("-"):null,n=i?this.#g(i,this.#e):null,a=n?n.children:this.#e;if(!a||r>=a.length)return null;let l=[...t];return l[l.length-1]=r,l.join("-")}#q=!1;#pt={dragging:!1,startX:0,startY:0,scrollLeft:0,scrollTop:0,moved:!1};#ft(e,s){if(s.style.cursor="grab",this.#q)return;this.#q=!0;let t=this.#pt;this.listen(this,"pointerdown",r=>{let i=r;if(i.target.closest("button, [data-toggle], .sm-vtoolbar, input"))return;let n=this.querySelector(".sm-visual-scroll");if(!n)return;t.dragging=!0,t.moved=!1,t.startX=i.clientX,t.startY=i.clientY,t.scrollLeft=n.scrollLeft,t.scrollTop=n.scrollTop;let a=this.querySelector('svg[role="tree"]');a&&(a.style.cursor="grabbing")}),this.listen(window,"pointermove",r=>{if(!t.dragging)return;let i=r,n=i.clientX-t.startX,a=i.clientY-t.startY;(Math.abs(n)>3||Math.abs(a)>3)&&(t.moved=!0);let l=this.querySelector(".sm-visual-scroll");l&&(l.scrollLeft=t.scrollLeft-n,l.scrollTop=t.scrollTop-a)}),this.listen(window,"pointerup",()=>{if(!t.dragging)return;t.dragging=!1;let r=this.querySelector('svg[role="tree"]');r&&(r.style.cursor="grab")}),this.listen(this,"click",r=>{t.moved&&(r.stopPropagation(),t.moved=!1)},{capture:!0})}#Y(e){let s=0,t=0;for(let r of e)if(r.x+c.#f>s&&(s=r.x+c.#f),r.y+c.#m>t&&(t=r.y+c.#m),r.children.length>0&&!r.collapsed){let i=this.#Y(r.children);i.maxX>s&&(s=i.maxX),i.maxY>t&&(t=i.maxY)}return{maxX:s,maxY:t}}#k(e,s){let t=c.#S,r=c.#f,i=c.#m,n=c.#w,a=this.#o==="horizontal";for(let l of s){if(l.children.length===0||l.collapsed)continue;if(a){let d=l.x+r,g=l.y+i/2,f=d+n/2;for(let m of l.children){let y=m.y+i/2,u=document.createElementNS(t,"path");u.setAttribute("d",`M ${d} ${g} L ${f} ${g} L ${f} ${y} L ${m.x} ${y}`),u.setAttribute("class","sm-vedge"),u.setAttribute("aria-hidden","true"),e.appendChild(u)}this.#k(e,l.children);continue}let p=l.x+r/2,h=l.y+i,o=h+n/2;for(let d of l.children){let g=d.x+r/2,f=d.y,m=document.createElementNS(t,"path");m.setAttribute("d",`M ${p} ${h} L ${p} ${o} L ${g} ${o} L ${g} ${f}`),m.setAttribute("class","sm-vedge"),m.setAttribute("aria-hidden","true"),e.appendChild(m)}this.#k(e,l.children)}}#X(e,s,t=""){let r=c.#S,i=c.#f,n=c.#m,a=this.#v,l=a>=4,p=t?t.split("-").length+1:1;for(let h=0;h<s.length;h++){let o=s[h],d=t?`${t}-${h}`:String(h),g=E[o.pageType]?o.pageType:"page",f=document.createElementNS(r,"g");f.setAttribute("class",`sm-vnode sm-vnode--${g}`),f.id=`${this.#u}-n-${d}`,f.setAttribute("role","treeitem"),f.setAttribute("aria-level",String(p)),f.setAttribute("aria-setsize",String(s.length)),f.setAttribute("aria-posinset",String(h+1)),f.setAttribute("aria-selected","false"),o.children.length>0&&f.setAttribute("aria-expanded",o.collapsed?"false":"true");let m=o.status&&S[o.status]?`, ${S[o.status].label}`:"";f.setAttribute("aria-label",`${o.label||o.href||"Untitled"}, ${E[g].label}${o.template?`, ${o.template}`:""}${m}`),f.setAttribute("data-node-id",d),f.setAttribute("data-href",o.href),f.setAttribute("data-page-type",o.pageType),f.setAttribute("data-template",o.template),f.style.cursor="pointer";let y=document.createElementNS(r,"rect");if(y.setAttribute("x",String(o.x)),y.setAttribute("y",String(o.y)),y.setAttribute("width",String(i)),y.setAttribute("height",String(n)),y.setAttribute("rx","8"),y.setAttribute("class","sm-vbox"),(l||o.pageType==="modal")&&y.setAttribute("stroke-dasharray","6 3"),f.appendChild(y),a>=1){let u=document.createElementNS(r,"text");u.setAttribute("x",String(o.x+i/2)),u.setAttribute("y",String(a===1?o.y+n/2+5:o.y+24)),u.setAttribute("text-anchor","middle"),u.setAttribute("font-size","13"),u.setAttribute("font-weight","600"),u.setAttribute("class","sm-vlabel"),u.textContent=o.label.length>18?o.label.slice(0,17)+"\u2026":o.label,f.appendChild(u)}if(a>=2){let u=document.createElementNS(r,"text");if(u.setAttribute("x",String(o.x+i/2)),u.setAttribute("y",String(o.y+40)),u.setAttribute("text-anchor","middle"),u.setAttribute("font-size","9"),u.setAttribute("font-weight","700"),u.setAttribute("class","sm-vtype"),u.textContent=(E[o.pageType]?.label||o.pageType).toUpperCase(),f.appendChild(u),o.template){let b=document.createElementNS(r,"text");b.setAttribute("x",String(o.x+i/2)),b.setAttribute("y",String(o.y+54)),b.setAttribute("text-anchor","middle"),b.setAttribute("font-size","9"),b.setAttribute("class","sm-vtemplate"),b.textContent=o.template,f.appendChild(b)}}if(a>=3&&o.status&&S[o.status]){let u=document.createElementNS(r,"circle");u.setAttribute("cx",String(o.x+i/2)),u.setAttribute("cy",String(o.y+n-8)),u.setAttribute("r","4"),u.setAttribute("class",`sm-vstatus sm-vstatus--${o.status}`),f.appendChild(u)}if(l)for(let u=0;u<2;u++){let b=document.createElementNS(r,"line");b.setAttribute("x1",String(o.x+12)),b.setAttribute("x2",String(o.x+i-12)),b.setAttribute("y1",String(o.y+n-22+u*8)),b.setAttribute("y2",String(o.y+n-22+u*8)),b.setAttribute("class","sm-vwire"),f.appendChild(b)}if(o.children.length>0){let u=document.createElementNS(r,"g");u.setAttribute("data-toggle",d),u.setAttribute("class","sm-vtoggle"),u.setAttribute("aria-hidden","true");let b=document.createElementNS(r,"circle"),x=this.#o==="horizontal",v=x?o.x+i+10:o.x+i/2,C=x?o.y+n/2:o.y+n+10;b.setAttribute("cx",String(v)),b.setAttribute("cy",String(C)),b.setAttribute("r","10"),u.appendChild(b);let A=document.createElementNS(r,"text");A.setAttribute("x",String(v)),A.setAttribute("y",String(C+4)),A.setAttribute("text-anchor","middle"),A.setAttribute("font-size","11"),A.setAttribute("font-weight","700"),A.textContent=o.collapsed?`+${o.childCount}`:"\u2212",u.appendChild(A),f.appendChild(u)}e.appendChild(f),o.children.length>0&&!o.collapsed&&this.#X(e,o.children,d)}}#T(e){let s=this.#g(e,this.#e);s&&(s.collapsed=!s.collapsed,this.#d||(this.#d=e),this.#c({anchorId:e}))}#g(e,s){if(!s)return null;let t=e.split("-").map(Number),r=s,i=null;for(let n of t){if(!r||n>=r.length)return null;i=r[n],r=i.children}return i}async _loadSrc(e){if(e)try{let s=await fetch(e);if(!s.ok)throw new Error(`HTTP ${s.status}`);let t=await s.json();t.title&&!this.getAttribute("title")&&(this.#r=!0,this.setAttribute("title",String(t.title)),this.#r=!1),this._setPages(t.pages||[])}catch(s){console.warn(`[site-map] Failed to load src="${e}":`,s)}}get pages(){let s=this.querySelector(":scope > nav")?.querySelector("ul");return s?this.#G(s):[]}set pages(e){this._setPages(Array.isArray(e)?e:[]),this.dispatchEvent(new CustomEvent("site-map:pages-changed",{detail:{pages:this.pages,source:"property"},bubbles:!0}))}_setPages(e){for(;this.firstChild;)this.firstChild.remove();let s=document.createElement("nav"),t=document.createElement("ul");this.#K(t,e),s.appendChild(t),this.appendChild(s),this._reinit()}#G(e){let s=[];for(let t of e.querySelectorAll(":scope > li")){let r=t.querySelector(":scope > a, :scope > .sm-node-content > a"),i=t.querySelector(":scope > ul"),n={label:r?.textContent?.trim()||"",href:r?.getAttribute("href")||void 0,pageType:t.getAttribute("data-page-type")||void 0,template:t.getAttribute("data-template")||void 0,status:t.getAttribute("data-status")||void 0};i&&(n.children=this.#G(i)),s.push(n)}return s}#K(e,s){for(let t of s){let r=document.createElement("li");t.pageType&&r.setAttribute("data-page-type",t.pageType),t.template&&r.setAttribute("data-template",t.template),t.status&&r.setAttribute("data-status",t.status);let i=document.createElement("a"),n=B(t.href);if(n&&i.setAttribute("href",n),i.textContent=String(t.label??""),r.appendChild(i),t.children&&t.children.length>0){let a=document.createElement("ul");this.#K(a,t.children),r.appendChild(a)}e.appendChild(r)}}#mt(){this.#Z(),this.#L(),this.#Q(),this.getAttribute("src")&&this.#_()}#J(){return this.querySelector(":scope > nav:not([data-sitemap-controls])")}#bt(){this.querySelector(":scope > [data-sitemap-controls]")?.remove()}#Z(){let e=this.getAttribute("current")||window.location.pathname,s=this.querySelectorAll("a");for(let t of s){if(!t.hasAttribute("href"))continue;new URL(t.href,window.location.origin).pathname===e&&t.setAttribute("aria-current","page")}}#L(){let e=this.querySelector('[aria-current="page"]');if(!e)return;let s=e.parentElement;for(;s&&s!==this;)s.tagName==="DETAILS"&&(s.open=!0),s=s.parentElement}#Q(){if(this.querySelector(":scope > [data-sitemap-controls]")?.remove(),!this.querySelector("details"))return;let e=()=>this.querySelectorAll("details"),s=document.createElement("nav");s.setAttribute("data-sitemap-controls",""),s.setAttribute("aria-label",this.getAttribute("data-label-controls")??"Sitemap controls");let t=document.createElement("button");t.type="button",t.className="small secondary",t.textContent=this.getAttribute("data-label-expand")??"Expand all",this.listen(t,"click",()=>{for(let n of e())n.open=!0});let r=document.createElement("button");r.type="button",r.className="small secondary",r.textContent=this.getAttribute("data-label-collapse")??"Collapse all",this.listen(r,"click",()=>{for(let n of e())n.open=!1;this.#L()}),s.append(t,r);let i=this.#J();i?i.before(s):this.prepend(s)}async#_(){let e=this.getAttribute("src");if(e)try{let s=await fetch(e);if(!s.ok)return;let t=await s.json();this.#gt(t)}catch{}}#gt(e){if(!e||!Array.isArray(e.children))return;let s=this.#J(),t=document.createElement("nav");t.setAttribute("aria-label",s?.getAttribute("aria-label")||"Full site map"),t.append(this.#tt(e.children)),s?s.replaceWith(t):this.append(t),this.#Z(),this.#L(),this.#Q()}#tt(e){let s=document.createElement("ul");for(let t of e){let r=document.createElement("li");if(t.children?.length){let i=document.createElement("details"),n=document.createElement("summary");n.textContent=String(t.title??""),i.append(n),i.append(this.#tt(t.children)),r.append(i)}else{let i=document.createElement("a"),n=B(t.href||t.path);n&&i.setAttribute("href",n),i.textContent=String(t.title??""),r.append(i)}s.append(r)}return s}};L("site-map",k);export{k as SiteMap};
|
|
2
2
|
//# sourceMappingURL=site-map.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
var _t=window.matchMedia("(prefers-reduced-motion: reduce)");var q=new Map;function S(e,t,r={}){let n=r.priority??10,s={impl:t,bundle:r.bundle,contract:r.contract,priority:n},o=q.get(e);if(customElements.get(e)){if(!o||o.priority>=n){o&&o.priority===n&&o.impl!==t&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${o.bundle}" (priority ${o.priority}). Skipping "${r.bundle}".`);return}console.warn(`[VB Bundle] Tag <${e}> defined by "${o.bundle}" cannot be replaced (customElements.define is permanent). "${r.bundle}" has higher priority but arrived late.`);return}if(o&&o.priority>=n){o.priority===n&&console.warn(`[VB Bundle] Tag <${e}> already registered by "${o.bundle}". Skipping "${r.bundle}" (first wins at equal priority).`);return}q.set(e,s),customElements.define(e,t)}var v=class extends HTMLElement{#e=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let t of this.#e)t();this.#e=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(t,r,n,s){t.addEventListener(r,n,s),this.#e.push(()=>t.removeEventListener(r,n,s))}_reinit(){for(let t of this.#e)t();this.#e=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(t,r){this.#t||(this.#t=this.attachInternals());let n=this.#t.states;try{r?n.add(t):n.delete(t)}catch{let s=`--${t}`;r?n.add(s):n.delete(s)}}_adoptInternals(t){this.#t||(this.#t=t)}#r(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#r()?.validity}get validationMessage(){return this.#r()?.validationMessage??""}get willValidate(){return this.#r()?.willValidate??!1}get form(){return this.#r()?.form??null}checkValidity(){return this.#r()?.checkValidity()??!0}reportValidity(){return this.#r()?.reportValidity()??!0}};function E(e){let t=(Date.now()-e.getTime())/1e3;if(Number.isNaN(t)||t<0)return null;if(t<60)return"just now";if(t<3600){let n=Math.floor(t/60);return`${n} minute${n!==1?"s":""} ago`}if(t<86400){let n=Math.floor(t/3600);return`${n} hour${n!==1?"s":""} ago`}if(t<2592e3){let n=Math.floor(t/86400);return`${n} day${n!==1?"s":""} ago`}if(t<31536e3){let n=Math.floor(t/2592e3);return`${n} month${n!==1?"s":""} ago`}let r=Math.floor(t/31536e3);return`${r} year${r!==1?"s":""} ago`}function U(e=document){for(let t of e.querySelectorAll("time[data-relative]")){if(t.closest("page-info"))continue;let r=t.getAttribute("datetime");if(!r)continue;let n=new Date(r),s=t.closest("[lang]")?.getAttribute("lang")||"",o=s&&!/^en\b/i.test(s)?et(n,s):E(n);o&&(t.textContent=o)}}function et(e,t){let r=(Date.now()-e.getTime())/1e3;if(Number.isNaN(r)||r<0)return null;let n;try{n=new Intl.RelativeTimeFormat(t,{numeric:"auto"})}catch{return E(e)}return r<60?n.format(0,"second"):r<3600?n.format(-Math.floor(r/60),"minute"):r<86400?n.format(-Math.floor(r/3600),"hour"):r<2592e3?n.format(-Math.floor(r/86400),"day"):r<31536e3?n.format(-Math.floor(r/2592e3),"month"):n.format(-Math.floor(r/31536e3),"year")}var C=typeof document<"u"?document.documentElement:null,H;function N(){U(),H||(H=setInterval(()=>U(),6e4))}C&&!C.hasAttribute("data-vb-time-relative-init")&&(C.setAttribute("data-vb-time-relative-init",""),document.readyState==="loading"?document.addEventListener("DOMContentLoaded",N,{once:!0}):N());function M(e){let t=new Date(e);return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function rt(e){let t=new Date(e),r=(t.getDay()+6)%7,n=new Date(t);n.setDate(t.getDate()-r);let s=new Date(n);s.setDate(n.getDate()+3);let o=new Date(s.getFullYear(),0,1),i=Math.ceil(((s.getTime()-o.getTime())/864e5+1)/7);return`${s.getFullYear()}-W${String(i).padStart(2,"0")}`}function nt(e){let t=M(new Date),r=M(new Date(Date.now()-864e5));if(e===t)return"Today";if(e===r)return"Yesterday";let[n,s,o]=e.split("-").map(Number);return new Date(n,s-1,o).toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"})}function B(e){return e.nodeType===1&&e.matches("article[data-activity]")}function st(e){return`Week of ${e.replace("-W",", week ")}`}var it='a[href], area[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), summary, iframe, [contenteditable=""], [contenteditable="true"], [tabindex]:not([tabindex="-1"])',ot=0,T=class extends v{static observedAttributes=["data-infinite"];#e=null;#t=null;#r=null;#a=null;#i=null;#o=`activity-feed-${++ot}`;#h=0;#n=!1;#c=0;#d=!0;setup(){let t=this.getAttribute("role");return this.#d=t===null||t==="feed"||t==="group",!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&this.setAttribute("aria-label","Recent activity"),this.#n=!1,this.setAttribute("aria-busy","false"),this.#s().forEach(r=>this.#f(r)),this.hasAttribute("data-infinite")&&this.#w(),this.#u(),this.#A(),this.#e=new MutationObserver(r=>{let n=!1,s=!1;for(let o of r){for(let i of o.addedNodes)B(i)&&(this.#f(i),n=!0,s=!0);for(let i of o.removedNodes)B(i)&&(n=!0)}n&&(this.#u(),this.#A()),s&&this.#n&&this.#b()}),this.#e.observe(this,{childList:!0}),this.#a=setInterval(()=>this.#y(),6e4),this.listen(this,"keydown",this.#S),this.listen(this,"focusin",this.#$),!0}teardown(){this.#a!==null&&clearInterval(this.#a),this.#a=null,this.#e?.disconnect(),this.#e=null,this.#E(),this.#n=!1,this.setAttribute("aria-busy","false")}attributeChangedCallback(t,r,n){!this.hasAttribute("data-upgraded")||r===null==(n===null)||t==="data-infinite"&&(n!==null?this.#w():(this.#E(),this.#n&&this.#b()),this.#u())}#s(){return[...this.querySelectorAll(":scope > article[data-activity]")]}#f(t){if(t.dataset.decorated==="")return;t.dataset.decorated="",t.setAttribute("tabindex","-1");let r=`${this.#o}-e${++this.#h}`,n=t.querySelector(":scope > time[datetime]");n?.remove();let s=t.dataset.time||n?.getAttribute("datetime")||"";s&&!t.dataset.time&&(t.dataset.time=s);let o=document.createElement("div");for(o.className="activity-body",o.id=`${r}-body`;t.firstChild;)o.appendChild(t.firstChild);t.appendChild(o),!t.hasAttribute("aria-label")&&!t.hasAttribute("aria-labelledby")&&t.setAttribute("aria-labelledby",o.id);let i=t.dataset.activityAvatar,c=t.dataset.activityIcon;if(i||c){let l=document.createElement("div");if(l.className="activity-rail",l.setAttribute("aria-hidden","true"),i){let a=document.createElement("user-avatar"),u=document.createElement("img");u.src=i,u.alt="",u.loading="lazy",u.decoding="async",a.appendChild(u),l.appendChild(a)}else{let a=document.createElement("icon-wc");a.setAttribute("name",c||""),l.appendChild(a)}t.prepend(l)}if(s){let l=n||document.createElement("time");l.classList.add("activity-time"),l.setAttribute("datetime",s),l.id||(l.id=`${r}-time`),l.setAttribute("title",this.#l(s)),l.textContent=E(new Date(s))||l.textContent||s,t.appendChild(l)}}#y(){for(let t of this.querySelectorAll(":scope > article[data-activity] > time.activity-time")){let r=t.getAttribute("datetime");if(!r)continue;let n=E(new Date(r));n&&(t.textContent=n)}}#l(t){try{return new Date(t).toLocaleString()}catch{return t}}#u(){this.querySelectorAll(":scope > [data-activity-heading]").forEach(o=>o.remove());let t=this.#s(),r=this.#t?"-1":String(t.length),n=this.getAttribute("data-group")||"none",s=null;t.forEach((o,i)=>{o.setAttribute("aria-posinset",String(i+1)),o.setAttribute("aria-setsize",r);let c=[];if(n!=="none"&&o.dataset.time){let a=n==="week"?rt(o.dataset.time):M(o.dataset.time);if(a!==s){let u=document.createElement("h3");u.setAttribute("data-activity-heading",""),u.setAttribute("aria-hidden","true"),u.id=`${this.#o}-g-${a}`,u.className="activity-heading",u.textContent=n==="week"?st(a):nt(a),this.insertBefore(u,o),c.push(u.id),s=a}}let l=o.querySelector(":scope > time.activity-time");l?.id&&c.push(l.id),c.length?o.setAttribute("aria-describedby",c.join(" ")):o.removeAttribute("aria-describedby")}),this.#g(),this.#p()}#p(){let t=this.#t;t&&t.parentNode===this&&this.lastElementChild!==t&&this.appendChild(t)}#g(){let t=this.#s(),r=t.find(n=>n.getAttribute("tabindex")==="0")||t[0];for(let n of t)n.setAttribute("tabindex",n===r?"0":"-1")}#m(t){for(let r of this.#s())r.setAttribute("tabindex",r===t?"0":"-1")}#v(t){let n=(t instanceof Element?t:null)?.closest("article[data-activity]")??null;return n&&n.parentElement===this?n:null}#$=t=>{let r=this.#v(t.target);r&&r.getAttribute("tabindex")!=="0"&&this.#m(r)};#A(){let t=this.#s().length;t===0?this.#i||(this.#i=document.createElement("p"),this.#i.className="activity-empty",this.#i.textContent=this.getAttribute("data-empty-text")||"No recent activity",this.appendChild(this.#i),this.#p()):(this.#i?.remove(),this.#i=null),this.#d&&this.setAttribute("role",t===0?"group":"feed")}#S=t=>{let r=t.target;if(r.isContentEditable||r.matches?.("input, textarea, select"))return;let n=this.#s(),s=this.#v(t.target),o=s?n.indexOf(s):-1;if(o===-1)return;if(t.ctrlKey&&(t.key==="Home"||t.key==="End")){let l=this.#x(t.key==="Home"?"before":"after");l&&(t.preventDefault(),l.focus());return}if(t.altKey||t.ctrlKey||t.metaKey)return;let i=o;switch(t.key){case"PageDown":i=Math.min(n.length-1,o+1);break;case"PageUp":i=Math.max(0,o-1);break;default:return}t.preventDefault();let c=n[i];c&&(this.#m(c),c.focus())};#x(t){let r=[...document.querySelectorAll(it)].filter(s=>!this.contains(s)&&(s.checkVisibility?.()??!0));return t==="after"?r.find(s=>this.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_FOLLOWING)||null:r.filter(s=>this.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_PRECEDING).at(-1)||null}#w(){this.#t||!("IntersectionObserver"in window)||(this.querySelectorAll(":scope > .activity-sentinel").forEach(t=>t.remove()),this.#t=document.createElement("div"),this.#t.className="activity-sentinel",this.#t.setAttribute("aria-hidden","true"),this.appendChild(this.#t),this.#r=new IntersectionObserver(t=>{t.some(r=>r.isIntersecting)&&this.#k()},{rootMargin:"200px"}),this.#r.observe(this.#t))}#E(){this.#r?.disconnect(),this.#r=null,this.#t?.remove(),this.#t=null}#k(){if(this.#n)return;this.#n=!0,this.setAttribute("aria-busy","true");let t=++this.#c,r=()=>{this.#n&&t===this.#c&&this.#b()};this.dispatchEvent(new CustomEvent("activity-feed:load-more",{bubbles:!0,detail:{done:r}}))}#b(){this.#n=!1,this.setAttribute("aria-busy","false"),this.#r&&this.#t&&(this.#r.unobserve(this.#t),this.#r.observe(this.#t))}addEntry(t,r={}){let n=document.createElement("article");if(n.setAttribute("data-activity",""),n.dataset.time=t.time,t.avatar&&(n.dataset.activityAvatar=t.avatar),t.icon&&(n.dataset.activityIcon=t.icon),n.innerHTML=t.html,r.prepend){let s=this.#s()[0];s?this.insertBefore(n,s):this.appendChild(n)}else this.#t?this.insertBefore(n,this.#t):this.appendChild(n);return n}removeEntry(t){t?.matches?.("article[data-activity]")&&t.remove()}clear(){this.#s().forEach(t=>t.remove())}get entries(){return this.#s()}get loading(){return this.#n}};S("activity-feed",T);var d=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),h=e=>e==null?"":String(e),at=e=>h(e).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");function y(e){if(typeof e!="string"||!e)return null;try{let t=new URL(e);return t.protocol==="https:"?t.href:null}catch{return null}}function I(e){if(typeof e!="string"||!e)return null;let t=new Date(e);return Number.isNaN(t.getTime())?null:t.toISOString()}var F=e=>h(e).trim().replace(/^#+/,"").toLowerCase();function _(e){let t=[];for(let r of e){let n=F(r);n&&!t.includes(n)&&t.push(n)}return t}var b=e=>Number.isFinite(Number(e))?Number(e):0;function D({name:e,handle:t,avatar:r,url:n}){let s={name:h(e||t),handle:h(t)},o=y(r);o&&(s.avatar=o);let i=y(n);return i&&(s.url=i),s}function x(e,t){let r=y(e);return r?{url:r,alt:h(t)}:void 0}function O({id:e,service:t,source:r,url:n,date:s,text:o,tags:i,reposted:c,author:l,image:a,counts:u,release:f}){let g=y(n);if(!g||!s)return null;let m={id:e,service:t,source:r,url:g,date:s,text:h(o),tags:i,reposted:!!c,author:l};return a&&(m.image=a),u&&(m.counts=u),f&&(m.release=f),m}function z(e){if(!d(e))return;let t=h(e.$type);if(t.startsWith("app.bsky.embed.external#view")&&d(e.external))return x(e.external.thumb,e.external.title);if(t.startsWith("app.bsky.embed.images#view")&&Array.isArray(e.images)&&d(e.images[0]))return x(e.images[0].thumb||e.images[0].fullsize,e.images[0].alt);if(t.startsWith("app.bsky.embed.recordWithMedia#view"))return z(e.media)}function Y(e,t){let r=d(e)&&Array.isArray(e.feed)?e.feed:[],n=[];for(let o of r){if(!d(o)||!d(o.post))continue;let{post:i}=o,c=d(i.record)?i.record:{},l=d(o.reason)&&o.reason.$type==="app.bsky.feed.defs#reasonRepost";if(!l&&(c.reply||o.reply))continue;let a=d(i.author)?i.author:{},u=h(a.handle||a.did),f=h(i.uri).split("/").pop();if(!u||!f)continue;let g=(Array.isArray(c.facets)?c.facets:[]).flatMap(p=>d(p)&&Array.isArray(p.features)?p.features:[]).filter(p=>d(p)&&p.$type==="app.bsky.richtext.facet#tag").map(p=>p.tag),m=O({id:`bluesky:${i.uri}`,service:"bluesky",source:t.key,url:`https://bsky.app/profile/${encodeURIComponent(u)}/post/${encodeURIComponent(f)}`,date:I(l?o.reason.indexedAt:c.createdAt||i.indexedAt),text:c.text,tags:_([...g,...Array.isArray(c.tags)?c.tags:[]]),reposted:l,author:D({name:a.displayName,handle:`@${u}`,avatar:a.avatar,url:`https://bsky.app/profile/${encodeURIComponent(u)}`}),image:z(i.embed),counts:{replies:b(i.replyCount),reposts:b(i.repostCount),likes:b(i.likeCount)}});m&&n.push(m)}let s=d(e)&&typeof e.cursor=="string"&&e.cursor?e.cursor:null;return{items:n,cursor:s}}var ct={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:"\xA0"};function lt(e){return e.replace(/&(#[xX][0-9a-fA-F]+|#[0-9]+|[a-zA-Z]+);/g,(t,r)=>{if(r[0]==="#"){let s=r[1]==="x"||r[1]==="X"?parseInt(r.slice(2),16):parseInt(r.slice(1),10);return s>0&&s<=1114111?String.fromCodePoint(s):t}let n=ct[r.toLowerCase()];return n===void 0?t:n})}function ut(e){let t=h(e).replace(/<br\s*\/?>/gi,`
|
|
2
|
+
`).replace(/<\/p>\s*<p(?:\s[^>]*)?>/gi,`
|
|
3
|
+
`).replace(/<[^<>]*>/g,"");return lt(t).trim()}function dt(e){try{return new URL(e).host}catch{return""}}function ft(e){let t=h(e.acct||e.username);if(!t)return"";if(t.includes("@"))return`@${t}`;let r=dt(e.url);return r?`@${t}@${r}`:`@${t}`}function ht(e){let t=(Array.isArray(e.media_attachments)?e.media_attachments:[]).find(r=>d(r)&&(r.type==="image"||r.type==="gifv"));if(t)return x(t.preview_url||t.url,t.description);if(d(e.card))return x(e.card.image,e.card.title)}function V(e,t){let r=Array.isArray(e)?e:[],n=[];for(let i of r){if(!d(i))continue;let c=d(i.reblog),l=c?i.reblog:i;if(!c&&i.in_reply_to_id)continue;let a=d(l.account)?l.account:{},u=O({id:`mastodon:${l.uri||l.id}`,service:"mastodon",source:t.key,url:l.url||l.uri,date:I(i.created_at),text:ut(l.content),tags:_((Array.isArray(l.tags)?l.tags:[]).map(f=>d(f)?f.name:f)),reposted:c,author:D({name:a.display_name||a.username,handle:ft(a),avatar:a.avatar,url:a.url}),image:ht(l),counts:{replies:b(l.replies_count),reposts:b(l.reblogs_count),likes:b(l.favourites_count)}});u&&n.push(u)}let s=r[r.length-1],o=d(s)&&s.id!==void 0&&s.id!==null?String(s.id):null;return{items:n,cursor:o}}function G(e,t,r){if(!d(e)||e.draft||e.prerelease||e.id===void 0||e.id===null)return null;let n=h(e.tag_name),s=h(t&&t.name),o=d(e.author)?e.author:{},i=h(o.login||r.handle),c={repo:s,tag:n},l=y(t&&t.html_url);return l&&(c.repoUrl=l),c.description=t&&t.description!=null?h(t.description):null,c.language=t&&t.language!=null?h(t.language):null,O({id:`github:${e.id}`,service:"github",source:r.key,url:e.html_url,date:I(e.published_at),text:`Released ${s} ${n}`,tags:[],reposted:!1,author:D({name:i,handle:i,avatar:o.avatar_url,url:o.html_url||(i?`https://github.com/${encodeURIComponent(i)}`:null)}),release:c})}function K(e,t,r){return(Array.isArray(e)?e:[]).map(n=>G(n,t,r)).filter(Boolean)}function W(e,t){let r=[];for(let n of Array.isArray(e)?e:[]){if(!d(n)||n.type!=="ReleaseEvent"||!d(n.payload)||n.payload.action!=="published"||!d(n.payload.release))continue;let s=h(d(n.repo)?n.repo.name:"");if(!s)continue;let o=d(n.actor)?n.actor:{},i=d(n.payload.release.author)||!o.login?n.payload.release:{...n.payload.release,author:{login:o.login,avatar_url:o.avatar_url}},c={name:s.split("/").pop(),html_url:`https://github.com/${s.split("/").map(encodeURIComponent).join("/")}`,description:null,language:null},l=G(i,c,t);l&&r.push(l)}return r}function R(e,t){let r=_(Array.isArray(t)?t:[]);if(!r.length)return!0;let n=d(e)&&Array.isArray(e.tags)?e.tags.map(F):[];return r.some(s=>n.includes(s))}function X(e,{tags:t,limit:r}={}){let n=(Array.isArray(e)?e:[]).flatMap(i=>Array.isArray(i)?i:[]).filter(i=>d(i)&&y(i.url)&&R(i,t));n.sort((i,c)=>i.date!==c.date?i.date<c.date?1:-1:i.id<c.id?-1:i.id>c.id?1:0);let s=new Set,o=[];for(let i of n)s.has(i.id)||(s.add(i.id),o.push(i));return Number.isInteger(r)&&r>0?o.slice(0,r):o}var pt=new Intl.DateTimeFormat("en",{dateStyle:"medium",timeZone:"UTC"});function mt(e){let t=new Date(e);return Number.isNaN(t.getTime())?"":pt.format(t)}var j={mastodon:["replies","boosts","favourites"],default:["replies","reposts","likes"]};function yt(e){let t=j[e.service]||j.default,r=e.counts,n=[r.replies,r.reposts,r.likes];return`<ul class="social-feed-counts">${["\u21A9","\u27F2","\u2661"].map((i,c)=>`<li><span aria-hidden="true">${i}</span> ${b(n[c])}<span class="visually-hidden"> ${t[c]}</span></li>`).join("")}</ul>`}function J(e,{hideCounts:t=!1,serviceName:r}={}){if(!d(e))return"";let n=y(e.url);if(!n)return"";let s=at,o=d(e.author)?e.author:{},i=[`<article data-activity data-id="${s(e.id)}" data-service="${s(e.service)}">`],c=y(o.avatar);c&&i.push(`<img class="social-feed-avatar" src="${s(c)}" alt="" width="40" height="40" loading="lazy">`),i.push(`<header class="social-feed-head"><b>${s(o.name||o.handle)}</b> <span class="social-feed-handle">${s(o.handle)}</span> <a class="social-feed-permalink" href="${s(n)}"><time datetime="${s(e.date)}">${s(mt(e.date))}</time></a> <span class="social-feed-source">${s(r||e.service)}</span></header>`),e.reposted&&i.push('<p class="social-feed-reposted">Reposted</p>'),i.push(`<p class="social-feed-text">${s(e.text).replace(/\r?\n/g,"<br>")}</p>`);let l=d(e.image)?y(e.image.url):null;if(l&&i.push(`<a class="social-feed-image" href="${s(n)}"><img src="${s(l)}" alt="${s(e.image.alt)}" loading="lazy"></a>`),d(e.release)){let a=e.release,u=y(a.repoUrl),f=u?` href="${s(u)}"`:"";i.push(`<div class="social-feed-release"><a${f}>${s(a.repo)}</a> <span>${s(a.description)}</span> <span>${s(a.language)}</span></div>`)}return!t&&d(e.counts)&&i.push(yt(e)),i.push("</article>"),i.join(`
|
|
4
|
+
`)}var gt=3,bt=10;async function A(e,{fetch:t,timeoutMs:r=5e3,headers:n}){let s=new AbortController,o,i=new Promise((l,a)=>{o=setTimeout(()=>{s.abort(),a(new Error(`Timed out after ${r} ms: ${e}`))},r)}),c=(async()=>{let l;try{l=await t(e,{headers:n,signal:s.signal})}catch(a){throw new Error(`Request failed for ${e}: ${a&&a.message?a.message:a}`)}if(!l||!l.ok)throw new Error(`HTTP ${l?l.status:"error"} for ${e}`);try{return await l.json()}catch{throw new Error(`Bad JSON from ${e}`)}})();c.catch(()=>{});try{return await Promise.race([c,i])}finally{clearTimeout(o)}}var w=(e,t)=>{if(!e)throw new Error(`Unexpected response shape from ${t}`)};function vt(e){let[t,r]=String(e).replace(/^@/,"").split("@");return{user:t,instance:r}}async function At(e,t){let r=e.did||e.handle,n=`https://public.api.bsky.app/xrpc/app.bsky.feed.getAuthorFeed?actor=${encodeURIComponent(r)}&filter=posts_no_replies&limit=30`;t.cursor&&(n+=`&cursor=${encodeURIComponent(t.cursor)}`);let s=await A(n,t);w(s&&typeof s=="object"&&Array.isArray(s.feed),n);let{items:o,cursor:i}=Y(s,e);return{items:o,cursor:i,done:!i}}async function wt(e,t){let{user:r,instance:n}=vt(e.handle);if(!r||!n)throw new Error(`Bad Mastodon handle: ${e.handle}`);if(!e.mastodonId){let l=`https://${n}/api/v1/accounts/lookup?acct=${encodeURIComponent(r)}`,a=await A(l,t);w(a&&a.id!==void 0&&a.id!==null&&a.id!=="",l),e.mastodonId=String(a.id)}let s=`https://${n}/api/v1/accounts/${encodeURIComponent(e.mastodonId)}/statuses?exclude_replies=true&limit=40`;t.cursor&&(s+=`&max_id=${encodeURIComponent(t.cursor)}`);let o=await A(s,t);w(Array.isArray(o),s);let{items:i,cursor:c}=V(o,e);return{items:i,cursor:c,done:!c}}async function Et(e,t){let r=encodeURIComponent(e.handle),n={...t.headers||{}};t.token&&t.mode!=="browser"&&(n.Authorization=`Bearer ${t.token}`);let s={...t,headers:n};if(t.mode==="browser"){let a=`https://api.github.com/users/${r}/events/public?per_page=30`,u=await A(a,s);return w(Array.isArray(u),a),{items:W(u,e),cursor:null,done:!0}}let o=`https://api.github.com/users/${r}/repos?sort=pushed&per_page=10`,i=await A(o,s);w(Array.isArray(i),o);let c=i.filter(a=>a&&typeof a=="object"&&!a.fork&&!a.archived&&a.name).slice(0,bt);return{items:(await Promise.all(c.map(async a=>{let u=`https://api.github.com/repos/${r}/${encodeURIComponent(a.name)}/releases?per_page=5`,f=await A(u,s);return w(Array.isArray(f),u),K(f,a,e)}))).flat(),cursor:null,done:!0}}async function P(e,{fetch:t,cursor:r,timeoutMs:n=5e3,token:s,mode:o="build",headers:i}={}){if(typeof t!="function")throw new Error("fetchAccountPage needs a fetch function");let c={fetch:t,cursor:r,timeoutMs:n,token:s,mode:o,headers:i};switch(e.service){case"bluesky":return At(e,c);case"mastodon":return wt(e,c);case"github":return Et(e,c);default:throw new Error(`No feed for service: ${e.service}`)}}async function Z(e,{fetch:t,tags:r,want:n=12,token:s,mode:o="build",cursor:i=null,timeoutMs:c,headers:l}={}){let a=[],u=0,f=i,g=!1;for(let m=0;m<gt&&!g;m++){let p=await P(e,{fetch:t,cursor:f,token:s,mode:o,timeoutMs:c,headers:l});if(a.push(...p.items),u+=p.items.filter(tt=>R(tt,r)).length,f=p.cursor,g=p.done,u>=n)break}return{items:a,cursor:f,done:g}}var $t={bluesky:"Bluesky",mastodon:"Mastodon",github:"GitHub"},St=/^\d+(\.\d+)?(rem|em|px|vh)$/,xt=12,k=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),$=e=>typeof e=="string"&&Date.parse(e)||0,kt=(e,t)=>$(t.date)-$(e.date),Q=(e,t)=>globalThis.fetch(e,t);function Ct(e){let t=e.querySelector(":scope > script.social-feed-state");if(!t)return null;let r;try{r=JSON.parse(t.textContent||"")}catch{return null}if(!k(r))return null;let n=(Array.isArray(r.accounts)?r.accounts:[]).filter(i=>k(i)&&typeof i.key=="string"&&typeof i.service=="string"&&typeof i.handle=="string").map(i=>{let c={key:i.key,service:i.service,handle:i.handle,done:i.done===!0};return typeof i.did=="string"&&i.did&&(c.did=i.did),typeof i.cursor=="string"&&i.cursor&&(c.cursor=i.cursor),c}),s=(Array.isArray(r.tags)?r.tags:[]).filter(i=>typeof i=="string"),o=(Array.isArray(r.buffer)?r.buffer:[]).filter(i=>k(i)&&typeof i.id=="string");return{accounts:n,tags:s,buffer:o}}var L=class extends v{static observedAttributes=["accounts","tags","items","height","hide-counts"];#e=null;#t=Promise.resolve();#r=null;setup(){return document.readyState==="loading"&&!this.querySelector(":scope > script.social-feed-state")?this.listen(document,"DOMContentLoaded",()=>this.#a(),{once:!0}):this.#a(),this.listen(this,"activity-feed:load-more",this.#g),!0}teardown(){}attributeChangedCallback(t,r,n){t==="height"&&r!==n&&this.#i()}get refreshed(){return this.#r||Promise.resolve()}#a(){this.#i();let t=this.#o();t&&!t.hasAttribute("tabindex")&&t.setAttribute("tabindex","0"),this.#e||(this.#e=Ct(this)),this.#e&&t&&!this.#r&&(this.#r=this.#n(()=>this.#p()))}#i(){let t=(this.getAttribute("height")||"").trim();St.test(t)&&this.style.setProperty("--social-feed-height",t)}#o(){return this.querySelector(":scope > activity-feed")}#h(){let t=(this.getAttribute("items")||"").trim(),r=/^\d+$/.test(t)?Number(t):NaN;return r>=1&&r<=50?r:xt}#n(t){let r=this.#t.then(t).catch(()=>{});return this.#t=r,r}#c(){let t=new Map,r=this.#o();if(!r)return t;for(let n of r.querySelectorAll(":scope > article[data-activity][data-id]"))t.set(n.getAttribute("data-id"),n);return t}#d(t){return $(t.querySelector("time[datetime]")?.getAttribute("datetime"))}#s(t,r){let n=J(t,{hideCounts:r,serviceName:$t[t.service]||t.service});if(!n)return null;let s=document.createElement("template");return s.innerHTML=n,s.content.firstElementChild}#f(t){let r=this.#o(),n=r&&this.#s(t,this.hasAttribute("hide-counts"));if(!r||!n)return!1;let s=$(t.date),o=[...r.querySelectorAll(":scope > article[data-activity]")],i=o.find(c=>this.#d(c)<s);return i?r.insertBefore(n,i):o.length?o[o.length-1].after(n):r.prepend(n),!0}#y(t,r){if(this.hasAttribute("hide-counts")||!k(r.counts))return;let n=this.#s(r,!1)?.querySelector(".social-feed-counts");if(!n)return;let s=t.querySelector(".social-feed-counts");s?s.replaceWith(n):(t.querySelector(":scope > .activity-body")||t).append(n)}#l(t,r){let n=this.#e?.tags||[];return X(t,{tags:n}).filter(s=>typeof s.id=="string"&&!r.has(s.id)).sort(kt)}#u(){let t=this.#o(),r=this.#e;if(!t||!r)return;let n=!!t.querySelector(":scope > article[data-activity]");n&&this.querySelector(":scope > .social-feed-empty")?.remove(),!(r.buffer.length>0||r.accounts.some(o=>!o.done))||!n?t.removeAttribute("data-infinite"):t.hasAttribute("data-infinite")||t.setAttribute("data-infinite","")}async#p(){let t=this.#e;if(!t)return;let r=await Promise.all(t.accounts.map(async a=>{try{let u=await P(a,{fetch:Q,mode:"browser"});return!a.cursor&&!a.done&&(u.cursor&&(a.cursor=u.cursor),a.done=u.done),u.items}catch{return a.done=!0,[]}})),n=this.#c();for(let a of r)for(let u of a){let f=n.get(u.id);f&&this.#y(f,u)}let s=this.#l(r,n),o=[...n.values()].map(a=>this.#d(a)),i=o.length?Math.min(...o):null,c=i===null?s.slice(0,this.#h()):s.filter(a=>$(a.date)>i),l=new Set(c.map(a=>a.id));for(let a of c)this.#f(a);t.buffer=this.#l([s.filter(a=>!l.has(a.id)),t.buffer],this.#c()),this.#u()}#g=t=>{let r=t.detail?.done;this.#n(()=>this.#m()).finally(()=>{typeof r=="function"&&r()})};async#m(){let t=this.#e;if(!t){this.#o()?.removeAttribute("data-infinite");return}let r=this.#h(),n=this.#l([t.buffer],this.#c()),s=n.slice(0,r);n=n.slice(r);let o=r-s.length;if(o>0){let i=t.tags,c=await Promise.all(t.accounts.filter(u=>!u.done).map(async u=>{try{let f=await Z(u,{fetch:Q,tags:i,want:o,mode:"browser",cursor:u.cursor||null});return f.cursor?u.cursor=f.cursor:delete u.cursor,u.done=f.done,f.items}catch{return u.done=!0,[]}})),l=new Set(s.map(u=>u.id)),a=this.#l([...c,n],this.#c()).filter(u=>!l.has(u.id));s.push(...a.slice(0,o)),n=a.slice(o)}for(let i of s)this.#f(i);t.buffer=n,this.#u()}};S("social-feed",L);export{L as SocialFeed};
|
|
5
|
+
//# sourceMappingURL=social-feed.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var w=new Map,z=new Map;var te=null;function U(){if(typeof window<"u"&&window.__VB_THEME_BASE)return String(window.__VB_THEME_BASE).replace(/\/$/,"");if(te)return te;if(typeof document<"u"){let t=document.querySelectorAll('script[src*="vanilla-breeze"]');for(let e of t){let a=e.getAttribute("src");if(a){let r=a.lastIndexOf("/");if(r!==-1)return a.slice(0,r)}}}return"/cdn"}var ae=new Set(["default","a11y-high-contrast","a11y-large-text","a11y-dyslexia","modern","minimal","classic"]),ke=new Set(["kawaii","memphis"]);function W(t){return typeof CSS<"u"&&CSS.escape?CSS.escape(t):String(t).replace(/["\\]/g,"\\$&")}function re(t){document.querySelectorAll(`link[data-vb-theme-preload="${W(t)}"]`).forEach(e=>e.remove())}function R(t){return ke.has(t)}function se(t,e){return`${e}/themes/${t}.css`}function ne(t,e){if(!R(t))return Promise.resolve();if(z.has(t))return z.get(t);let a=import(`${e}/packs/${t}.full.js`).catch(()=>{});return z.set(t,a),a}function Be(t,e){let a=U(),r=()=>{(R(e)||t.hasAttribute("data-vb-pack"))&&ne(e,a)};return t.getAttribute("data-vb-theme-state")==="error"?Promise.reject(new Error(`Failed to load theme: ${e}`)):t.getAttribute("data-vb-theme-state")==="ready"||t.sheet?(r(),Promise.resolve()):new Promise((s,n)=>{let i=()=>{t.setAttribute("data-vb-theme-state","ready"),m(),r(),s(void 0)},c=()=>{t.setAttribute("data-vb-theme-state","error"),w.delete(e),m(),n(new Error(`Failed to load theme: ${e}`))},m=()=>{t.removeEventListener("load",i),t.removeEventListener("error",c)};t.addEventListener("load",i,{once:!0}),t.addEventListener("error",c,{once:!0})})}async function M(t){if(!t||ae.has(t))return;if(w.has(t))return w.get(t);if(typeof document<"u"){let r=document.querySelector(`link[data-vb-theme="${W(t)}"]`);if(r){let s=Be(r,t);return w.set(t,s),s}}let e=U(),a=R(t)?Ce(t,e):Ae(t,e);return w.set(t,a),a}function ie(t){if(!t||ae.has(t)||R(t)||w.has(t)||typeof document>"u")return;let e=W(t);if(document.querySelector(`link[data-vb-theme="${e}"], link[data-vb-theme-preload="${e}"]`))return;let r=U(),s=se(t,r),n=document.createElement("link");n.rel="preload",n.as="style",n.href=s,n.setAttribute("data-vb-theme-preload",t),document.head.appendChild(n)}async function Ae(t,e){let a=se(t,e);return new Promise((r,s)=>{re(t);let n=document.createElement("link");n.rel="stylesheet",n.href=a,n.setAttribute("data-vb-theme",t),n.setAttribute("data-vb-theme-state","loading"),n.onload=()=>{n.setAttribute("data-vb-theme-state","ready"),r()},n.onerror=()=>{n.setAttribute("data-vb-theme-state","error"),n.remove(),w.delete(t),s(new Error(`Failed to load theme: ${t}`))},document.head.appendChild(n)})}function Ce(t,e){let a=`${e}/packs/${t}.theme.css`,r=`${e}/packs/${t}.effects.css`;return new Promise((s,n)=>{re(t);let i=document.createElement("link");i.rel="stylesheet",i.href=a,i.setAttribute("data-vb-theme",t),i.setAttribute("data-vb-pack",t),i.setAttribute("data-vb-theme-state","loading"),i.onload=()=>{i.setAttribute("data-vb-theme-state","ready");let c=document.createElement("link");c.rel="stylesheet",c.href=r,c.setAttribute("data-vb-pack-effects",t),document.head.appendChild(c),ne(t,e),s()},i.onerror=()=>{i.setAttribute("data-vb-theme-state","error"),i.remove(),w.delete(t),n(new Error(`Failed to load pack: ${t}`))},document.head.appendChild(i)})}var Le=window.matchMedia("(prefers-reduced-motion: reduce)");var oe=new Map;function ce(t,e,a={}){let r=a.priority??10,s={impl:e,bundle:a.bundle,contract:a.contract,priority:r},n=oe.get(t);if(customElements.get(t)){if(!n||n.priority>=r){n&&n.priority===r&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${a.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${a.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=r){n.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${n.bundle}". Skipping "${a.bundle}" (first wins at equal priority).`);return}oe.set(t,s),customElements.define(t,e)}var O=class extends HTMLElement{#s=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#s)e();this.#s=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,a,r,s){e.addEventListener(a,r,s),this.#s.push(()=>e.removeEventListener(a,r,s))}_reinit(){for(let e of this.#s)e();this.#s=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,a){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{a?r.add(e):r.delete(e)}catch{let s=`--${e}`;a?r.add(s):r.delete(s)}}_adoptInternals(e){this.#t||(this.#t=e)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};var de=[{id:"auto",name:"Auto",icon:"monitor"},{id:"light",name:"Light",icon:"sun"},{id:"dark",name:"Dark",icon:"moon"}],he=[{id:"default",name:"Default",swatchBg:"#3b82f6",seeds:{}},{id:"ocean",name:"Ocean",swatchBg:"#0891b2",seeds:{"--hue-primary":200,"--hue-secondary":180,"--hue-accent":45,"--lightness-primary":"50%","--chroma-primary":.15,"--lightness-secondary":"45%","--chroma-secondary":.1,"--lightness-accent":"70%","--chroma-accent":.15},seedsDark:{"--lightness-primary":"60%","--chroma-primary":.12}},{id:"forest",name:"Forest",swatchBg:"#059669",seeds:{"--hue-primary":145,"--hue-secondary":90,"--hue-accent":30,"--lightness-primary":"45%","--chroma-primary":.15,"--lightness-secondary":"55%","--chroma-secondary":.12,"--lightness-accent":"65%","--chroma-accent":.16},seedsDark:{"--lightness-primary":"58%","--chroma-primary":.12}},{id:"sunset",name:"Sunset",swatchBg:"#ea580c",seeds:{"--hue-primary":25,"--hue-secondary":0,"--hue-accent":280,"--lightness-primary":"57%","--chroma-primary":.2,"--lightness-secondary":"55%","--chroma-secondary":.18,"--lightness-accent":"55%","--chroma-accent":.18},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.16}},{id:"rose",name:"Rose",swatchBg:"#e11d48",seeds:{"--hue-primary":350,"--hue-secondary":330,"--hue-accent":200,"--lightness-primary":"55%","--chroma-primary":.18,"--lightness-secondary":"50%","--chroma-secondary":.14,"--lightness-accent":"60%","--chroma-accent":.12},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.14}},{id:"lavender",name:"Lavender",swatchBg:"#a855f7",seeds:{"--hue-primary":280,"--hue-secondary":300,"--hue-accent":60,"--lightness-primary":"55%","--chroma-primary":.14,"--lightness-secondary":"50%","--chroma-secondary":.12,"--lightness-accent":"70%","--chroma-accent":.14},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.12}},{id:"coral",name:"Coral",swatchBg:"#f97316",seeds:{"--hue-primary":15,"--hue-secondary":25,"--hue-accent":180,"--lightness-primary":"57%","--chroma-primary":.18,"--lightness-secondary":"55%","--chroma-secondary":.15,"--lightness-accent":"55%","--chroma-accent":.12},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.15}},{id:"slate",name:"Slate",swatchBg:"#64748b",seeds:{"--hue-primary":220,"--hue-secondary":210,"--hue-accent":45,"--lightness-primary":"48%","--chroma-primary":.1,"--lightness-secondary":"45%","--chroma-secondary":.06,"--lightness-accent":"68%","--chroma-accent":.15},seedsDark:{"--lightness-primary":"60%","--chroma-primary":.08}},{id:"emerald",name:"Emerald",swatchBg:"#10b981",seeds:{"--hue-primary":160,"--hue-secondary":140,"--hue-accent":30,"--lightness-primary":"50%","--chroma-primary":.15,"--lightness-secondary":"48%","--chroma-secondary":.12,"--lightness-accent":"65%","--chroma-accent":.16},seedsDark:{"--lightness-primary":"60%","--chroma-primary":.12}},{id:"amber",name:"Amber",swatchBg:"#f59e0b",seeds:{"--hue-primary":45,"--hue-secondary":30,"--hue-accent":240,"--lightness-primary":"56%","--chroma-primary":.16,"--lightness-secondary":"55%","--chroma-secondary":.15,"--lightness-accent":"52%","--chroma-accent":.14},seedsDark:{"--lightness-primary":"68%","--chroma-primary":.14}},{id:"indigo",name:"Indigo",swatchBg:"#6366f1",seeds:{"--hue-primary":250,"--hue-secondary":270,"--hue-accent":35,"--lightness-primary":"48%","--chroma-primary":.18,"--lightness-secondary":"45%","--chroma-secondary":.14,"--lightness-accent":"68%","--chroma-accent":.16},seedsDark:{"--lightness-primary":"62%","--chroma-primary":.14}}],le=[{id:"default",name:"Default",hue:210,shape:"balanced",character:"The default",swatchBg:"#3b82f6",tier:"core"},{id:"modern",name:"Modern",hue:270,shape:"rounded",character:"Vibrant & elevated",swatchBg:"#6366f1",tier:"core"},{id:"minimal",name:"Minimal",hue:240,shape:"sharp",character:"Clean & flat",swatchBg:"#71717a",tier:"core"},{id:"classic",name:"Classic",hue:220,shape:"subtle",character:"Serif & elegant",swatchBg:"#92400e",tier:"core"}],K=[{id:"swiss",name:"Swiss",icon:"grid-3x3",character:"Precision grid",swatchBg:"#ff3e00",swatchFg:"white",tier:"showcase",category:"Design"},{id:"brutalist",name:"Brutalist",icon:"square",character:"Raw, industrial",swatchBg:"#1a1a1a",swatchFg:"#f5f5f5",tier:"showcase",category:"Design"},{id:"art-deco",name:"Art Deco",icon:"crown",character:"1920s luxury",swatchBg:"#1A1A1A",swatchFg:"#C9A84C",tier:"showcase",category:"Design"},{id:"editorial",name:"Editorial",icon:"newspaper",character:"Magazine elegance",swatchBg:"#1a1a1a",swatchFg:"#c9a227",tier:"showcase",category:"Content"},{id:"genai",name:"GenAI",icon:"sparkles",character:"AI aesthetic",swatchBg:"#1a0a2e",swatchFg:"#a855f7",tier:"showcase",category:"Modern"},{id:"glassmorphism",name:"Glass",icon:"glass-water",character:"Frosted surfaces",swatchBg:"#667eea",swatchFg:"#ffffff",tier:"showcase",category:"Modern"},{id:"startup",name:"Startup",icon:"rocket",character:"SaaS energy",swatchBg:"#4f46e5",swatchFg:"#ffffff",tier:"showcase",category:"Modern"},{id:"organic",name:"Organic",icon:"leaf",character:"Natural, handcrafted",swatchBg:"#2d5016",swatchFg:"#faf5e6",tier:"showcase",category:"Creative"},{id:"rough",name:"Rough",icon:"pencil",character:"Hand-drawn sketch",swatchBg:"#f5f0e8",swatchFg:"#3a3a3a",tier:"showcase",category:"Creative"},{id:"cyber",name:"Cyber",icon:"zap",character:"Neon futuristic",swatchBg:"#0a0a1a",swatchFg:"#00ff88",tier:"showcase",category:"Creative"},{id:"journal",name:"Journal",icon:"notebook-pen",character:"Dot-grid bullet journal",swatchBg:"#f3ecdc",swatchFg:"#27313f",tier:"showcase",category:"Creative"},{id:"vaporwave",name:"Vaporwave",icon:"radio",character:"Neon dreamy",swatchBg:"#2b0040",swatchFg:"#ff6ad5",tier:"showcase",category:"Aesthetic"},{id:"neumorphism",name:"Neumorph",icon:"circle",character:"Soft embossed",swatchBg:"#e0e0e0",swatchFg:"#a0a0a0",tier:"showcase",category:"Aesthetic"},{id:"bauhaus",name:"Bauhaus",icon:"shapes",character:"Geometric",swatchBg:"#F1FAEE",swatchFg:"#E63946",tier:"showcase",category:"Aesthetic"},{id:"claymorphism",name:"Clay",icon:"circle-dot",character:"Puffy 3D",swatchBg:"#f0f0f5",swatchFg:"#FF6B9D",tier:"showcase",category:"Aesthetic"},{id:"alpha1999",name:"Alpha1999",icon:"orbit",character:"Space retro-fi",swatchBg:"#0a0a14",swatchFg:"#d4880f",tier:"showcase",category:"Signature"},{id:"super2026",name:"Super2026",icon:"triangle",character:"Supergraphic bold",swatchBg:"#f5f0e6",swatchFg:"#c23616",tier:"showcase",category:"Signature"},{id:"magna",name:"Magna",icon:"orbit",character:"Odyssey 2 retro",swatchBg:"#0d0b14",swatchFg:"#f97316",tier:"showcase",category:"Signature"},{id:"win9x",name:"Win9x",icon:"monitor",character:"Classic desktop",swatchBg:"#008080",swatchFg:"#c0c0c0",tier:"showcase",category:"OS Styles"},{id:"nes",name:"NES",icon:"joystick",character:"Console pixels",swatchBg:"#bcbcbc",swatchFg:"#e40521",tier:"showcase",category:"OS Styles"},{id:"8bit",name:"8-Bit",icon:"gamepad-2",character:"Retro pixel art",swatchBg:"#000080",swatchFg:"#ffff00",tier:"showcase",category:"OS Styles"}],X=[{id:"nord",name:"Nord",icon:"snowflake",character:"Arctic calm",swatchBg:"#2E3440",swatchFg:"#81A1C1",tier:"community",category:"Editor Palettes"},{id:"solarized",name:"Solarized",icon:"sun-dim",character:"Engineered precision",swatchBg:"#002B36",swatchFg:"#268BD2",tier:"community",category:"Editor Palettes"},{id:"dracula",name:"Dracula",icon:"moon-star",character:"Dark elegance",swatchBg:"#282A36",swatchFg:"#BD93F9",tier:"community",category:"Editor Palettes"},{id:"catppuccin-mocha",name:"Catppuccin",icon:"coffee",character:"Warm pastels",swatchBg:"#1E1E2E",swatchFg:"#CBA6F7",tier:"community",category:"Editor Palettes"},{id:"catppuccin-latte",name:"Ctp Latte",icon:"coffee",character:"Cozy daytime",swatchBg:"#eff1f5",swatchFg:"#8839ef",tier:"community",category:"Editor Palettes"},{id:"catppuccin-frappe",name:"Ctp Frapp\xE9",icon:"coffee",character:"Cool twilight",swatchBg:"#303446",swatchFg:"#ca9ee6",tier:"community",category:"Editor Palettes"},{id:"catppuccin-macchiato",name:"Ctp Macchiato",icon:"coffee",character:"Deep blue",swatchBg:"#24273a",swatchFg:"#c6a0f6",tier:"community",category:"Editor Palettes"},{id:"gruvbox",name:"Gruvbox",icon:"palette",character:"Retro warmth",swatchBg:"#282828",swatchFg:"#ebdbb2",tier:"community",category:"Editor Palettes"},{id:"tokyo-night",name:"Tokyo Night",icon:"moon",character:"Night-owl vibes",swatchBg:"#1a1b26",swatchFg:"#7aa2f7",tier:"community",category:"Editor Palettes"},{id:"rose-pine",name:"Ros\xE9 Pine",icon:"flower-2",character:"Muted elegance",swatchBg:"#191724",swatchFg:"#ebbcba",tier:"community",category:"Editor Palettes"},{id:"cottagecore",name:"Cottagecore",icon:"flower-2",character:"Pastoral",swatchBg:"#fdf8f0",swatchFg:"#7d8c6d",tier:"community",category:"Niche"},{id:"terminal",name:"Terminal",icon:"terminal",character:"Retro CRT",swatchBg:"#0d1117",swatchFg:"#00ff00",tier:"community",category:"Niche"},{id:"clinical",name:"Clinical",icon:"heart-pulse",character:"Sterile precision",swatchBg:"#ffffff",swatchFg:"#0077b6",tier:"community",category:"Industry"},{id:"financial",name:"Financial",icon:"landmark",character:"Navy + gold",swatchBg:"#1b2a4a",swatchFg:"#c9a84c",tier:"community",category:"Industry"},{id:"government",name:"Government",icon:"shield",character:"Official",swatchBg:"#002868",swatchFg:"#bf0a30",tier:"community",category:"Industry"},{id:"dawn",name:"Dawn",icon:"sunrise",character:"Golden morning",swatchBg:"#fef3e2",swatchFg:"#d4a574",tier:"community",category:"Mood/Time"},{id:"dusk",name:"Dusk",icon:"sunset",character:"Twilight",swatchBg:"#1a1b2e",swatchFg:"#e5a858",tier:"community",category:"Mood/Time"},{id:"midnight",name:"Midnight",icon:"moon",character:"Deep night",swatchBg:"#0d1117",swatchFg:"#58a6ff",tier:"community",category:"Mood/Time"},{id:"high-noon",name:"High Noon",icon:"sun",character:"Maximum bright",swatchBg:"#ffffff",swatchFg:"#e63946",tier:"community",category:"Mood/Time"}],ue=[{id:"kawaii",name:"Kawaii",icon:"heart",character:"Cute aesthetic",swatchBg:"#ffb7c5",swatchFg:"#ff69b4",tier:"showcase",category:"Packs"},{id:"memphis",name:"Memphis",icon:"star",character:"Bold patterns",swatchBg:"#FFF8F0",swatchFg:"#d03040",tier:"showcase",category:"Packs"}];var Ie=[...K,...X],He=[...le,...K,...X,...ue],E=t=>K.filter(e=>e.category===t),F=[{label:"Style",themes:le,tier:"core"},{label:"Design",themes:E("Design"),tier:"showcase"},{label:"Content",themes:E("Content"),tier:"showcase"},{label:"Modern",themes:E("Modern"),tier:"showcase"},{label:"Creative",themes:E("Creative"),tier:"showcase"},{label:"Aesthetic",themes:E("Aesthetic"),tier:"showcase"},{label:"Signature",themes:E("Signature"),tier:"showcase"},{label:"OS Styles",themes:E("OS Styles"),tier:"showcase"},{label:"Packs",themes:ue,tier:"showcase"},{label:"More Themes",themes:X,tier:"community"}];function $e(){let t=globalThis.localStorage;if(!t)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(e){return t.getItem(e)},async setRaw(e,a){t.setItem(e,a)},async removeRaw(e){t.removeItem(e)},async keys(e){let a=[];for(let r=0;r<t.length;r++){let s=t.key(r);s&&s.startsWith(e)&&a.push(s)}return a}}}var I="__vbStoreBackend",H=globalThis;function p(){return H[I]||(H[I]=$e()),H[I]}function Y(t,e){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof e!="string"||!e)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${t}:${e}`}function me(t){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${t}:`}function fe(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"&&typeof e.timestamp=="number")return e}catch{}return null}var A={configure(t={}){H[I]=t.backend??null},async set(t,e,a){let r={data:a,timestamp:Date.now()};await p().setRaw(Y(t,e),JSON.stringify(r))},async get(t,e,a){let r=await p().getRaw(Y(t,e));if(r==null)return null;let s=fe(r);return!s||a?.maxAge!=null&&Date.now()-s.timestamp>a.maxAge?null:s.data},async remove(t,e){await p().removeRaw(Y(t,e))},async list(t){let e=me(t),a=await p().keys(e),r=[];for(let s of a){let n=await p().getRaw(s);if(n==null)continue;let i=fe(n);i&&r.push({key:s.slice(e.length),data:i.data,timestamp:i.timestamp})}return r},async clear(t){let e=me(t),a=await p().keys(e);for(let r of a)await p().removeRaw(r)},async clearAll(){let t=await p().keys("vb:");for(let e of t)await p().removeRaw(e)},async setMany(t,e){for(let[a,r]of e)await A.set(t,a,r)}};if(typeof window<"u"){let t=window.VB??(window.VB={});t.store??=A}var V="theme",q="current",ve=2,G={accent:"data-accent",borderStyle:"data-border-style",iconSet:"data-icon-set",fluid:"data-fluid",backdrop:"data-backdrop",backdropChrome:"data-backdrop-chrome"},u={mode:"auto",brand:"default",accent:null,borderStyle:null,iconSet:null,fluid:null,backdrop:null,backdropChrome:null,pageBgType:"",pageBgColor:"",pageBgGradStart:"",pageBgGradEnd:"",pageBgGradDir:""};function pe(t){if(!t||typeof t!="object")return null;let e={...t};if(!(Number(e.v)>=ve))for(let a of Object.keys(G))(e[a]===""||a==="accent"&&e[a]==="default")&&(e[a]=null);return e}function b(t,e){return t??e??""}var J=null;function f(){if(J)return J;let t=document.documentElement,e=window.__vbAuthoredRoot,a=s=>{if(e&&typeof e=="object"){if(s in e)return e[s]??null;if(s==="data-mode")return null}return t.getAttribute(s)},r={theme:a("data-theme"),mode:a("data-mode"),themeSource:a("data-theme-source")};for(let[s,n]of Object.entries(G))r[s]=a(n);return J=r,r}function Te(t){try{let e=document.createElement("canvas");e.width=e.height=1;let a=e.getContext("2d",{willReadFrequently:!0});if(!a)return t;a.fillStyle=t,a.fillRect(0,0,1,1);let[r,s,n]=a.getImageData(0,0,1,1).data;return"#"+[r,s,n].map(i=>i.toString(16).padStart(2,"0")).join("")}catch{return t}}function j(t,e){let a=(t||"").split(/\s+/).filter(Boolean);return e==="site"?a[0]&&!a[0].startsWith("a11y-")?a[0]:"":a.find(r=>!r.startsWith("a11y-"))||""}function Me(t,e,a,r=!1){let s=(t||"").split(/\s+/).filter(n=>n&&n!==e&&n!==a);return a!=="default"?[a,...s].join(" "):(r&&s.length?["default",...s]:s).join(" ")}function ge(t){return t==="light"||t==="dark"?t:null}function ye(t,e,a){return e||(t==="light"||t==="dark"?t:a?"dark":"light")}function we(t,e,a){let r=j(e,a);return a==="site"&&r?r:t?.brand&&t.brand!==u.brand?t.brand:r||u.brand}var be=["--hue-primary","--hue-secondary","--hue-accent","--lightness-primary","--chroma-primary","--lightness-secondary","--chroma-secondary","--lightness-accent","--chroma-accent"],o=null,x="",N="",C=null,S=null,g={_initPromise:null,async init(){return this._initPromise?this._initPromise:(this._initPromise=(async()=>{let t=pe(await A.get(V,q));o=t?{...u,...t}:{...u},S=f().themeSource??null,x=j(f().theme??"",S),N=j(document.documentElement.dataset.theme||"",S),C=ge(f().mode),o.brand=we(t,f().theme??"",S);try{await M(o.brand)}catch{o.brand!==x&&(o.brand=x||u.brand)}return this.apply(o),this._watchSystemPreference(),this._watchRootAttributes(),this._watchCrossDocumentStorage(),o})(),this._initPromise)},_watchCrossDocumentStorage(){typeof window>"u"||window.addEventListener("storage",async t=>{if(t.key!==`vb:${V}:${q}`||!t.newValue)return;let e;try{let r=JSON.parse(t.newValue);e=pe(r?.data)}catch{return}if(!e)return;let a={...u,...o,...e};if(a.brand=we(e,f().theme??"",S),a.brand&&a.brand!==o?.brand)try{await M(a.brand)}catch{a.brand=x||u.brand}o=a,this.apply(o||{})})},load(){return o?{...o}:{...u}},save(t){let e={...o??u,...t,v:ve};return o=e,A.set(V,q,e).catch(()=>{}),e},apply({mode:t="auto",brand:e="default",borderStyle:a=null,iconSet:r=null,fluid:s=null,backdrop:n=null,backdropChrome:i=null,pageBgType:c="",pageBgColor:m="",pageBgGradStart:k="",pageBgGradEnd:v="",pageBgGradDir:T=""}={}){let h=document.documentElement,d=f(),y=ye(t,C,window.matchMedia("(prefers-color-scheme: dark)").matches);h.dataset.mode=y;let _=S==="site",B=Me(h.dataset.theme||"",N,e,_);B?h.dataset.theme=B:delete h.dataset.theme,N=e==="default"&&!B.startsWith("default")?"":e;let P=a||d.borderStyle||this._readCSSHint("--theme-border-style");this._setRootAttr("data-border-style",P&&P!=="clean"?P:"");let D=r||d.iconSet||this._readCSSHint("--theme-icon-set");this._setRootAttr("data-icon-set",D&&D!=="lucide"?D:"");let Z=b(s,d.fluid);this._setRootAttr("data-fluid",Z,!0);let ee=b(n,d.backdrop);this._setRootAttr("data-backdrop",ee,!0);let L=b(i,d.backdropChrome);if(this._setRootAttr("data-backdrop-chrome",L&&L!=="card"?L:""),c==="color"&&m)h.style.setProperty("--page-bg-color",m),h.style.removeProperty("--page-bg-gradient");else if(c==="gradient"&&k&&v){let Se=T||"to bottom";h.style.setProperty("--page-bg-gradient",`linear-gradient(${Se}, ${k}, ${v})`),h.style.removeProperty("--page-bg-color")}else h.style.removeProperty("--page-bg-color"),h.style.removeProperty("--page-bg-gradient");this._applyAccent(this.load().accent);let Ee=this.getState().accent;this._syncThemeColor(),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{mode:t,brand:e,accent:Ee,borderStyle:P,iconSet:D,fluid:Z,backdrop:ee,backdropChrome:L,pageBgType:c,effectiveMode:y}}))},_setRootAttr(t,e,a=!1){let r=document.documentElement;e?r.setAttribute(t,e):a&&this._authoredHas(t)?r.setAttribute(t,""):r.removeAttribute(t)},_authoredHas(t){let e=Object.keys(G).find(r=>G[r]===t);return e?this.load()[e]==null&&f()[e]!=null:!1},_syncThemeColor(){let t=document.querySelectorAll('meta[name="theme-color"]');if(!t.length)return;let e=s=>!s||s==="transparent"||/^rgba\(.*,\s*0\)$/.test(s),a=getComputedStyle(document.documentElement).backgroundColor;if(e(a)){let s=document.createElement("span");s.style.setProperty("position","absolute"),s.style.setProperty("background-color","var(--color-background)"),(document.body||document.documentElement).append(s),a=getComputedStyle(s).backgroundColor,s.remove()}if(e(a))return;let r=Te(a);t.forEach(s=>{s.removeAttribute("media"),s.setAttribute("content",r)})},setMode(t){C=null;let e=this.save({mode:t});this.apply(e)},async setBrand(t){try{await M(t)}catch(a){console.warn(`[VB] Theme "${t}" failed to load, using default`,a),t="default"}let e=this.save({brand:t});this.apply(e)},setAccent(t){this.save({accent:t}),this._applyAccent(t),this._syncThemeColor(),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{...this.getState()}}))},setBorderStyle(t){let e=this.save({borderStyle:t});this.apply(e)},setIconSet(t){let e=this.save({iconSet:t});this.apply(e)},setFluid(t){let e=this.save({fluid:t});this.apply(e)},setBackdrop(t){let e=this.save({backdrop:t});this.apply(e)},setBackdropChrome(t){let e=this.save({backdropChrome:t});this.apply(e)},setPageBg({type:t="",color:e="",gradStart:a="",gradEnd:r="",gradDir:s=""}={}){let n=this.save({pageBgType:t,pageBgColor:e,pageBgGradStart:a,pageBgGradEnd:r,pageBgGradDir:s});this.apply(n)},getEffectiveMode(){let{mode:t}=this.load();return ye(t,C,window.matchMedia("(prefers-color-scheme: dark)").matches)},getState(){let{mode:t,brand:e,accent:a,borderStyle:r,iconSet:s,fluid:n,backdrop:i,backdropChrome:c,pageBgType:m,pageBgColor:k,pageBgGradStart:v,pageBgGradEnd:T,pageBgGradDir:h}=this.load(),d=typeof document>"u"?{}:f(),y=(_,B)=>B==null&&d[_]===""?"default":b(B,d[_]);return{mode:t,brand:e,accent:b(a,d.accent)||"default",borderStyle:b(r,d.borderStyle),iconSet:b(s,d.iconSet),fluid:y("fluid",n),backdrop:y("backdrop",i),backdropChrome:b(c,d.backdropChrome),pageBgType:m,pageBgColor:k,pageBgGradStart:v,pageBgGradEnd:T,pageBgGradDir:h,effectiveMode:this.getEffectiveMode()}},toggleMode(){let e=this.getEffectiveMode()==="dark"?"light":"dark";this.setMode(e)},reset(){o={...u,brand:x||u.brand},C=ge(f().mode),A.remove(V,q).catch(()=>{});let t=document.documentElement;t.style.removeProperty("--page-bg-color"),t.style.removeProperty("--page-bg-gradient");for(let e of be)t.style.removeProperty(e);this.apply(o)},_readCSSHint(t){return getComputedStyle(document.documentElement).getPropertyValue(t).trim()},_applyAccent(t){let e=document.documentElement;for(let r of be)e.style.removeProperty(r);if(t==null){let r=f().accent;r?e.dataset.accent=r:delete e.dataset.accent;return}let a=he.find(r=>r.id===t);if(!a||!a.seeds||Object.keys(a.seeds).length===0){delete e.dataset.accent;return}e.dataset.accent=a.id},_watchRootAttributes(){this._rootObserver||(this._rootObserver=new MutationObserver(t=>{for(let e of t)e.attributeName==="data-theme"?this._syncFromDataTheme():e.attributeName==="data-mode"&&this._syncFromDataMode()}),this._rootObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","data-mode"]}))},_syncFromDataTheme(){if(!o)return;let t=document.documentElement.dataset.theme||"",e=t.split(/\s+/).filter(Boolean),a=j(t,S)||"default";a!==o.brand&&(o.brand=a,M(a).catch(()=>{}),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{...this.getState()}})))},_syncFromDataMode(){if(!o)return;let t=document.documentElement.dataset.mode||"auto",e=this.getEffectiveMode();t!==e&&(C=null,o.mode=t,this._syncThemeColor(),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{...this.getState()}})))},_watchSystemPreference(){window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{let e=this.load();e.mode==="auto"&&this.apply(e)})}};if(typeof window<"u"){let t=window.VB??(window.VB={});t.themeManager??=g}var $=new Map;for(let t of F)for(let e of t.themes)$.set(e.id,e);var Fe={panel:"Theme settings",trigger:"Theme settings",mode:"Color Mode",theme:"Theme"},l=t=>String(t??"").replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e]),xe=0,Q=class t extends O{static#s=200;#t;#e;#a=!1;#r=!1;#l=!1;#p=F;#d=null;#v=++xe;#u=0;#o=!1;#n=()=>this.#b();setup(){return this.#r=this.getAttribute("variant")==="inline",this.#l=this.hasAttribute("swatches"),this.#p=this.#E(),this.#S(++this.#u),!0}#E(){let e=(this.getAttribute("themes")||"").split(/\s+/).filter(Boolean);if(!e.length)return F;let a=[...new Set(e)].map(r=>$.get(r)).filter(Boolean);return a.length?[{label:this.#c("theme"),themes:a,tier:"core"}]:F}async#S(e){await g.init(),!(!this.isConnected||e!==this.#u||this.#e)&&(this.#k(),this.#T(),this.#w(),this.listen(window,"vb:theme-change",this.#R))}teardown(){this.#u++,window.removeEventListener("scroll",this.#n,{capture:!0}),window.removeEventListener("resize",this.#n),this.#f(),this.#a=!1,this.#o=!1,this.removeAttribute("open"),this.#t?.setAttribute("aria-expanded","false"),this.#e?.remove(),this.#e=null}#k(){this.#r||(this.#t=this.querySelector(":scope > [data-trigger]"),this.#t||(this.#t=this.querySelector(":scope > button")),this.#t||(this.#t=document.createElement("button"),this.#t.type="button",this.#t.setAttribute("data-trigger",""),this.#t.innerHTML=`
|
|
1
|
+
var w=new Map,z=new Map;var te=null;function U(){if(typeof window<"u"&&window.__VB_THEME_BASE)return String(window.__VB_THEME_BASE).replace(/\/$/,"");if(te)return te;if(typeof document<"u"){let t=document.querySelectorAll('script[src*="vanilla-breeze"]');for(let e of t){let a=e.getAttribute("src");if(a){let r=a.lastIndexOf("/");if(r!==-1)return a.slice(0,r)}}}return"/cdn"}var ae=new Set(["default","a11y-high-contrast","a11y-large-text","a11y-dyslexia","modern","minimal","classic"]),ke=new Set(["kawaii","memphis"]);function W(t){return typeof CSS<"u"&&CSS.escape?CSS.escape(t):String(t).replace(/["\\]/g,"\\$&")}function re(t){document.querySelectorAll(`link[data-vb-theme-preload="${W(t)}"]`).forEach(e=>e.remove())}function R(t){return ke.has(t)}function se(t,e){return`${e}/themes/${t}.css`}function ne(t,e){if(!R(t))return Promise.resolve();if(z.has(t))return z.get(t);let a=import(`${e}/packs/${t}.full.js`).catch(()=>{});return z.set(t,a),a}function Be(t,e){let a=U(),r=()=>{(R(e)||t.hasAttribute("data-vb-pack"))&&ne(e,a)};return t.getAttribute("data-vb-theme-state")==="error"?Promise.reject(new Error(`Failed to load theme: ${e}`)):t.getAttribute("data-vb-theme-state")==="ready"||t.sheet?(r(),Promise.resolve()):new Promise((s,n)=>{let i=()=>{t.setAttribute("data-vb-theme-state","ready"),m(),r(),s(void 0)},c=()=>{t.setAttribute("data-vb-theme-state","error"),w.delete(e),m(),n(new Error(`Failed to load theme: ${e}`))},m=()=>{t.removeEventListener("load",i),t.removeEventListener("error",c)};t.addEventListener("load",i,{once:!0}),t.addEventListener("error",c,{once:!0})})}async function M(t){if(!t||ae.has(t))return;if(w.has(t))return w.get(t);if(typeof document<"u"){let r=document.querySelector(`link[data-vb-theme="${W(t)}"]`);if(r){let s=Be(r,t);return w.set(t,s),s}}let e=U(),a=R(t)?Ce(t,e):Ae(t,e);return w.set(t,a),a}function ie(t){if(!t||ae.has(t)||R(t)||w.has(t)||typeof document>"u")return;let e=W(t);if(document.querySelector(`link[data-vb-theme="${e}"], link[data-vb-theme-preload="${e}"]`))return;let r=U(),s=se(t,r),n=document.createElement("link");n.rel="preload",n.as="style",n.href=s,n.setAttribute("data-vb-theme-preload",t),document.head.appendChild(n)}async function Ae(t,e){let a=se(t,e);return new Promise((r,s)=>{re(t);let n=document.createElement("link");n.rel="stylesheet",n.href=a,n.setAttribute("data-vb-theme",t),n.setAttribute("data-vb-theme-state","loading"),n.onload=()=>{n.setAttribute("data-vb-theme-state","ready"),r()},n.onerror=()=>{n.setAttribute("data-vb-theme-state","error"),n.remove(),w.delete(t),s(new Error(`Failed to load theme: ${t}`))},document.head.appendChild(n)})}function Ce(t,e){let a=`${e}/packs/${t}.theme.css`,r=`${e}/packs/${t}.effects.css`;return new Promise((s,n)=>{re(t);let i=document.createElement("link");i.rel="stylesheet",i.href=a,i.setAttribute("data-vb-theme",t),i.setAttribute("data-vb-pack",t),i.setAttribute("data-vb-theme-state","loading"),i.onload=()=>{i.setAttribute("data-vb-theme-state","ready");let c=document.createElement("link");c.rel="stylesheet",c.href=r,c.setAttribute("data-vb-pack-effects",t),document.head.appendChild(c),ne(t,e),s()},i.onerror=()=>{i.setAttribute("data-vb-theme-state","error"),i.remove(),w.delete(t),n(new Error(`Failed to load pack: ${t}`))},document.head.appendChild(i)})}var Le=window.matchMedia("(prefers-reduced-motion: reduce)");var oe=new Map;function ce(t,e,a={}){let r=a.priority??10,s={impl:e,bundle:a.bundle,contract:a.contract,priority:r},n=oe.get(t);if(customElements.get(t)){if(!n||n.priority>=r){n&&n.priority===r&&n.impl!==e&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${n.bundle}" (priority ${n.priority}). Skipping "${a.bundle}".`);return}console.warn(`[VB Bundle] Tag <${t}> defined by "${n.bundle}" cannot be replaced (customElements.define is permanent). "${a.bundle}" has higher priority but arrived late.`);return}if(n&&n.priority>=r){n.priority===r&&console.warn(`[VB Bundle] Tag <${t}> already registered by "${n.bundle}". Skipping "${a.bundle}" (first wins at equal priority).`);return}oe.set(t,s),customElements.define(t,e)}var O=class extends HTMLElement{#s=[];#t;constructor(){super(),this.hasAttribute("data-upgraded")&&this.removeAttribute("data-upgraded")}connectedCallback(){this.hasAttribute("data-upgraded")||this.setup()!==!1&&(this.setAttribute("data-upgraded",""),queueMicrotask(()=>{this.dispatchEvent(new CustomEvent(`${this.localName}:upgraded`,{bubbles:!0}))}))}disconnectedCallback(){for(let e of this.#s)e();this.#s=[],this.removeAttribute("data-upgraded"),this.teardown()}listen(e,a,r,s){e.addEventListener(a,r,s),this.#s.push(()=>e.removeEventListener(a,r,s))}_reinit(){for(let e of this.#s)e();this.#s=[],this.teardown(),this.removeAttribute("data-upgraded"),this.isConnected&&this.setup()!==!1&&this.setAttribute("data-upgraded","")}setup(){}teardown(){}setState(e,a){this.#t||(this.#t=this.attachInternals());let r=this.#t.states;try{a?r.add(e):r.delete(e)}catch{let s=`--${e}`;a?r.add(s):r.delete(s)}}_adoptInternals(e){this.#t||(this.#t=e)}#e(){return this.constructor.formAssociated&&this.#t?this.#t:null}get validity(){return this.#e()?.validity}get validationMessage(){return this.#e()?.validationMessage??""}get willValidate(){return this.#e()?.willValidate??!1}get form(){return this.#e()?.form??null}checkValidity(){return this.#e()?.checkValidity()??!0}reportValidity(){return this.#e()?.reportValidity()??!0}};var de=[{id:"auto",name:"Auto",icon:"monitor"},{id:"light",name:"Light",icon:"sun"},{id:"dark",name:"Dark",icon:"moon"}],he=[{id:"default",name:"Default",swatchBg:"#3b82f6",seeds:{}},{id:"ocean",name:"Ocean",swatchBg:"#0891b2",seeds:{"--hue-primary":200,"--hue-secondary":180,"--hue-accent":45,"--lightness-primary":"50%","--chroma-primary":.15,"--lightness-secondary":"45%","--chroma-secondary":.1,"--lightness-accent":"70%","--chroma-accent":.15},seedsDark:{"--lightness-primary":"60%","--chroma-primary":.12}},{id:"forest",name:"Forest",swatchBg:"#059669",seeds:{"--hue-primary":145,"--hue-secondary":90,"--hue-accent":30,"--lightness-primary":"45%","--chroma-primary":.15,"--lightness-secondary":"55%","--chroma-secondary":.12,"--lightness-accent":"65%","--chroma-accent":.16},seedsDark:{"--lightness-primary":"58%","--chroma-primary":.12}},{id:"sunset",name:"Sunset",swatchBg:"#ea580c",seeds:{"--hue-primary":25,"--hue-secondary":0,"--hue-accent":280,"--lightness-primary":"57%","--chroma-primary":.2,"--lightness-secondary":"55%","--chroma-secondary":.18,"--lightness-accent":"55%","--chroma-accent":.18},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.16}},{id:"rose",name:"Rose",swatchBg:"#e11d48",seeds:{"--hue-primary":350,"--hue-secondary":330,"--hue-accent":200,"--lightness-primary":"55%","--chroma-primary":.18,"--lightness-secondary":"50%","--chroma-secondary":.14,"--lightness-accent":"60%","--chroma-accent":.12},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.14}},{id:"lavender",name:"Lavender",swatchBg:"#a855f7",seeds:{"--hue-primary":280,"--hue-secondary":300,"--hue-accent":60,"--lightness-primary":"55%","--chroma-primary":.14,"--lightness-secondary":"50%","--chroma-secondary":.12,"--lightness-accent":"70%","--chroma-accent":.14},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.12}},{id:"coral",name:"Coral",swatchBg:"#f97316",seeds:{"--hue-primary":15,"--hue-secondary":25,"--hue-accent":180,"--lightness-primary":"57%","--chroma-primary":.18,"--lightness-secondary":"55%","--chroma-secondary":.15,"--lightness-accent":"55%","--chroma-accent":.12},seedsDark:{"--lightness-primary":"65%","--chroma-primary":.15}},{id:"slate",name:"Slate",swatchBg:"#64748b",seeds:{"--hue-primary":220,"--hue-secondary":210,"--hue-accent":45,"--lightness-primary":"48%","--chroma-primary":.1,"--lightness-secondary":"45%","--chroma-secondary":.06,"--lightness-accent":"68%","--chroma-accent":.15},seedsDark:{"--lightness-primary":"60%","--chroma-primary":.08}},{id:"emerald",name:"Emerald",swatchBg:"#10b981",seeds:{"--hue-primary":160,"--hue-secondary":140,"--hue-accent":30,"--lightness-primary":"50%","--chroma-primary":.15,"--lightness-secondary":"48%","--chroma-secondary":.12,"--lightness-accent":"65%","--chroma-accent":.16},seedsDark:{"--lightness-primary":"60%","--chroma-primary":.12}},{id:"amber",name:"Amber",swatchBg:"#f59e0b",seeds:{"--hue-primary":45,"--hue-secondary":30,"--hue-accent":240,"--lightness-primary":"56%","--chroma-primary":.16,"--lightness-secondary":"55%","--chroma-secondary":.15,"--lightness-accent":"52%","--chroma-accent":.14},seedsDark:{"--lightness-primary":"68%","--chroma-primary":.14}},{id:"indigo",name:"Indigo",swatchBg:"#6366f1",seeds:{"--hue-primary":250,"--hue-secondary":270,"--hue-accent":35,"--lightness-primary":"48%","--chroma-primary":.18,"--lightness-secondary":"45%","--chroma-secondary":.14,"--lightness-accent":"68%","--chroma-accent":.16},seedsDark:{"--lightness-primary":"62%","--chroma-primary":.14}}],le=[{id:"default",name:"Default",hue:210,shape:"balanced",character:"The default",swatchBg:"#3b82f6",tier:"core"},{id:"modern",name:"Modern",hue:270,shape:"rounded",character:"Vibrant & elevated",swatchBg:"#6366f1",tier:"core"},{id:"minimal",name:"Minimal",hue:240,shape:"sharp",character:"Clean & flat",swatchBg:"#71717a",tier:"core"},{id:"classic",name:"Classic",hue:220,shape:"subtle",character:"Serif & elegant",swatchBg:"#92400e",tier:"core"}],K=[{id:"swiss",name:"Swiss",icon:"grid-3x3",character:"Precision grid",swatchBg:"#ff3e00",swatchFg:"white",tier:"showcase",category:"Design"},{id:"brutalist",name:"Brutalist",icon:"square",character:"Raw, industrial",swatchBg:"#1a1a1a",swatchFg:"#f5f5f5",tier:"showcase",category:"Design"},{id:"art-deco",name:"Art Deco",icon:"crown",character:"1920s luxury",swatchBg:"#1A1A1A",swatchFg:"#C9A84C",tier:"showcase",category:"Design"},{id:"editorial",name:"Editorial",icon:"newspaper",character:"Magazine elegance",swatchBg:"#1a1a1a",swatchFg:"#c9a227",tier:"showcase",category:"Content"},{id:"genai",name:"GenAI",icon:"sparkles",character:"AI aesthetic",swatchBg:"#1a0a2e",swatchFg:"#a855f7",tier:"showcase",category:"Modern"},{id:"glassmorphism",name:"Glass",icon:"glass-water",character:"Frosted surfaces",swatchBg:"#667eea",swatchFg:"#ffffff",tier:"showcase",category:"Modern"},{id:"startup",name:"Startup",icon:"rocket",character:"SaaS energy",swatchBg:"#4f46e5",swatchFg:"#ffffff",tier:"showcase",category:"Modern"},{id:"organic",name:"Organic",icon:"leaf",character:"Natural, handcrafted",swatchBg:"#2d5016",swatchFg:"#faf5e6",tier:"showcase",category:"Creative"},{id:"rough",name:"Rough",icon:"pencil",character:"Hand-drawn sketch",swatchBg:"#f5f0e8",swatchFg:"#3a3a3a",tier:"showcase",category:"Creative"},{id:"cyber",name:"Cyber",icon:"zap",character:"Neon futuristic",swatchBg:"#0a0a1a",swatchFg:"#00ff88",tier:"showcase",category:"Creative"},{id:"journal",name:"Journal",icon:"notebook-pen",character:"Dot-grid bullet journal",swatchBg:"#f3ecdc",swatchFg:"#27313f",tier:"showcase",category:"Creative"},{id:"vaporwave",name:"Vaporwave",icon:"radio",character:"Neon dreamy",swatchBg:"#2b0040",swatchFg:"#ff6ad5",tier:"showcase",category:"Aesthetic"},{id:"neumorphism",name:"Neumorph",icon:"circle",character:"Soft embossed",swatchBg:"#e0e0e0",swatchFg:"#a0a0a0",tier:"showcase",category:"Aesthetic"},{id:"bauhaus",name:"Bauhaus",icon:"shapes",character:"Geometric",swatchBg:"#F1FAEE",swatchFg:"#E63946",tier:"showcase",category:"Aesthetic"},{id:"claymorphism",name:"Clay",icon:"circle-dot",character:"Puffy 3D",swatchBg:"#f0f0f5",swatchFg:"#FF6B9D",tier:"showcase",category:"Aesthetic"},{id:"alpha1999",name:"Alpha1999",icon:"orbit",character:"Space retro-fi",swatchBg:"#0a0a14",swatchFg:"#d4880f",tier:"showcase",category:"Signature"},{id:"super2026",name:"Super2026",icon:"triangle",character:"Supergraphic bold",swatchBg:"#f5f0e6",swatchFg:"#c23616",tier:"showcase",category:"Signature"},{id:"magna",name:"Magna",icon:"orbit",character:"Odyssey 2 retro",swatchBg:"#0d0b14",swatchFg:"#f97316",tier:"showcase",category:"Signature"},{id:"win9x",name:"Win9x",icon:"monitor",character:"Classic desktop",swatchBg:"#008080",swatchFg:"#c0c0c0",tier:"showcase",category:"OS Styles"},{id:"nes",name:"NES",icon:"joystick",character:"Console pixels",swatchBg:"#bcbcbc",swatchFg:"#e40521",tier:"showcase",category:"OS Styles"},{id:"8bit",name:"8-Bit",icon:"gamepad-2",character:"Retro pixel art",swatchBg:"#000080",swatchFg:"#ffff00",tier:"showcase",category:"OS Styles"}],X=[{id:"nord",name:"Nord",icon:"snowflake",character:"Arctic calm",swatchBg:"#2E3440",swatchFg:"#81A1C1",tier:"community",category:"Editor Palettes"},{id:"solarized",name:"Solarized",icon:"sun-dim",character:"Engineered precision",swatchBg:"#002B36",swatchFg:"#268BD2",tier:"community",category:"Editor Palettes"},{id:"dracula",name:"Dracula",icon:"moon-star",character:"Dark elegance",swatchBg:"#282A36",swatchFg:"#BD93F9",tier:"community",category:"Editor Palettes"},{id:"catppuccin-mocha",name:"Catppuccin",icon:"coffee",character:"Warm pastels",swatchBg:"#1E1E2E",swatchFg:"#CBA6F7",tier:"community",category:"Editor Palettes"},{id:"catppuccin-latte",name:"Ctp Latte",icon:"coffee",character:"Cozy daytime",swatchBg:"#eff1f5",swatchFg:"#8839ef",tier:"community",category:"Editor Palettes"},{id:"catppuccin-frappe",name:"Ctp Frapp\xE9",icon:"coffee",character:"Cool twilight",swatchBg:"#303446",swatchFg:"#ca9ee6",tier:"community",category:"Editor Palettes"},{id:"catppuccin-macchiato",name:"Ctp Macchiato",icon:"coffee",character:"Deep blue",swatchBg:"#24273a",swatchFg:"#c6a0f6",tier:"community",category:"Editor Palettes"},{id:"gruvbox",name:"Gruvbox",icon:"palette",character:"Retro warmth",swatchBg:"#282828",swatchFg:"#ebdbb2",tier:"community",category:"Editor Palettes"},{id:"tokyo-night",name:"Tokyo Night",icon:"moon",character:"Night-owl vibes",swatchBg:"#1a1b26",swatchFg:"#7aa2f7",tier:"community",category:"Editor Palettes"},{id:"rose-pine",name:"Ros\xE9 Pine",icon:"flower-2",character:"Muted elegance",swatchBg:"#191724",swatchFg:"#ebbcba",tier:"community",category:"Editor Palettes"},{id:"cottagecore",name:"Cottagecore",icon:"flower-2",character:"Pastoral",swatchBg:"#fdf8f0",swatchFg:"#7d8c6d",tier:"community",category:"Niche"},{id:"terminal",name:"Terminal",icon:"terminal",character:"Retro CRT",swatchBg:"#0d1117",swatchFg:"#00ff00",tier:"community",category:"Niche"},{id:"clinical",name:"Clinical",icon:"heart-pulse",character:"Sterile precision",swatchBg:"#ffffff",swatchFg:"#0077b6",tier:"community",category:"Industry"},{id:"financial",name:"Financial",icon:"landmark",character:"Navy + gold",swatchBg:"#1b2a4a",swatchFg:"#c9a84c",tier:"community",category:"Industry"},{id:"government",name:"Government",icon:"shield",character:"Official",swatchBg:"#002868",swatchFg:"#bf0a30",tier:"community",category:"Industry"},{id:"dawn",name:"Dawn",icon:"sunrise",character:"Golden morning",swatchBg:"#fef3e2",swatchFg:"#d4a574",tier:"community",category:"Mood/Time"},{id:"dusk",name:"Dusk",icon:"sunset",character:"Twilight",swatchBg:"#1a1b2e",swatchFg:"#e5a858",tier:"community",category:"Mood/Time"},{id:"midnight",name:"Midnight",icon:"moon",character:"Deep night",swatchBg:"#0d1117",swatchFg:"#58a6ff",tier:"community",category:"Mood/Time"},{id:"high-noon",name:"High Noon",icon:"sun",character:"Maximum bright",swatchBg:"#ffffff",swatchFg:"#e63946",tier:"community",category:"Mood/Time"}],ue=[{id:"kawaii",name:"Kawaii",icon:"heart",character:"Cute aesthetic",swatchBg:"#ffb7c5",swatchFg:"#ff69b4",tier:"showcase",category:"Packs"},{id:"memphis",name:"Memphis",icon:"star",character:"Bold patterns",swatchBg:"#FFF8F0",swatchFg:"#d03040",tier:"showcase",category:"Packs"}];var Ie=[...K,...X],He=[...le,...K,...X,...ue],E=t=>K.filter(e=>e.category===t),F=[{label:"Style",themes:le,tier:"core"},{label:"Design",themes:E("Design"),tier:"showcase"},{label:"Content",themes:E("Content"),tier:"showcase"},{label:"Modern",themes:E("Modern"),tier:"showcase"},{label:"Creative",themes:E("Creative"),tier:"showcase"},{label:"Aesthetic",themes:E("Aesthetic"),tier:"showcase"},{label:"Signature",themes:E("Signature"),tier:"showcase"},{label:"OS Styles",themes:E("OS Styles"),tier:"showcase"},{label:"Packs",themes:ue,tier:"showcase"},{label:"More Themes",themes:X,tier:"community"}];function $e(){let t=globalThis.localStorage;if(!t)throw new Error("VBStore: localStorage is not available in this environment");return{async getRaw(e){return t.getItem(e)},async setRaw(e,a){t.setItem(e,a)},async removeRaw(e){t.removeItem(e)},async keys(e){let a=[];for(let r=0;r<t.length;r++){let s=t.key(r);s&&s.startsWith(e)&&a.push(s)}return a}}}var I="__vbStoreBackend",H=globalThis;function p(){return H[I]||(H[I]=$e()),H[I]}function Y(t,e){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");if(typeof e!="string"||!e)throw new TypeError("VBStore: key must be a non-empty string");return`vb:${t}:${e}`}function me(t){if(typeof t!="string"||!t)throw new TypeError("VBStore: namespace must be a non-empty string");return`vb:${t}:`}function fe(t){try{let e=JSON.parse(t);if(e&&typeof e=="object"&&typeof e.timestamp=="number")return e}catch{}return null}var A={configure(t={}){H[I]=t.backend??null},async set(t,e,a){let r={data:a,timestamp:Date.now()};await p().setRaw(Y(t,e),JSON.stringify(r))},async get(t,e,a){let r=await p().getRaw(Y(t,e));if(r==null)return null;let s=fe(r);return!s||a?.maxAge!=null&&Date.now()-s.timestamp>a.maxAge?null:s.data},async remove(t,e){await p().removeRaw(Y(t,e))},async list(t){let e=me(t),a=await p().keys(e),r=[];for(let s of a){let n=await p().getRaw(s);if(n==null)continue;let i=fe(n);i&&r.push({key:s.slice(e.length),data:i.data,timestamp:i.timestamp})}return r},async clear(t){let e=me(t),a=await p().keys(e);for(let r of a)await p().removeRaw(r)},async clearAll(){let t=await p().keys("vb:");for(let e of t)await p().removeRaw(e)},async setMany(t,e){for(let[a,r]of e)await A.set(t,a,r)}};if(typeof window<"u"){let t=window.VB??(window.VB={});t.store??=A}var V="theme",q="current",ve=2,G={accent:"data-accent",borderStyle:"data-border-style",iconSet:"data-icon-set",fluid:"data-fluid",backdrop:"data-backdrop",backdropChrome:"data-backdrop-chrome"},u={mode:"auto",brand:"default",accent:null,borderStyle:null,iconSet:null,fluid:null,backdrop:null,backdropChrome:null,pageBgType:"",pageBgColor:"",pageBgGradStart:"",pageBgGradEnd:"",pageBgGradDir:""};function pe(t){if(!t||typeof t!="object")return null;let e={...t};if(!(Number(e.v)>=ve))for(let a of Object.keys(G))(e[a]===""||a==="accent"&&e[a]==="default")&&(e[a]=null);return e}function b(t,e){return t??e??""}var J=null;function f(){if(J)return J;let t=document.documentElement,e=window.__vbAuthoredRoot,a=s=>{if(e&&typeof e=="object"){if(s in e)return e[s]??null;if(s==="data-mode")return null}return t.getAttribute(s)},r={theme:a("data-theme"),mode:a("data-mode"),themeSource:a("data-theme-source")};for(let[s,n]of Object.entries(G))r[s]=a(n);return J=r,r}function Te(t){try{let e=document.createElement("canvas");e.width=e.height=1;let a=e.getContext("2d",{willReadFrequently:!0});if(!a)return t;a.fillStyle=t,a.fillRect(0,0,1,1);let[r,s,n]=a.getImageData(0,0,1,1).data;return"#"+[r,s,n].map(i=>i.toString(16).padStart(2,"0")).join("")}catch{return t}}function j(t,e){let a=(t||"").split(/\s+/).filter(Boolean);return e==="site"?a[0]&&!a[0].startsWith("a11y-")?a[0]:"":a.find(r=>!r.startsWith("a11y-"))||""}function Me(t,e,a,r=!1){let s=(t||"").split(/\s+/).filter(n=>n&&n!==e&&n!==a);return a!=="default"?[a,...s].join(" "):(r&&s.length?["default",...s]:s).join(" ")}function ge(t){return t==="light"||t==="dark"?t:null}function ye(t,e,a){return e||(t==="light"||t==="dark"?t:a?"dark":"light")}function we(t,e,a){let r=j(e,a);return a==="site"&&r?r:t?.brand&&t.brand!==u.brand?t.brand:r||u.brand}var be=["--hue-primary","--hue-secondary","--hue-accent","--lightness-primary","--chroma-primary","--lightness-secondary","--chroma-secondary","--lightness-accent","--chroma-accent"],o=null,x="",N="",C=null,S=null,g={_initPromise:null,async init(){return this._initPromise?this._initPromise:(this._initPromise=(async()=>{let t=pe(await A.get(V,q));o=t?{...u,...t}:{...u},S=f().themeSource??null,x=j(f().theme??"",S),N=j(document.documentElement.dataset.theme||"",S),C=ge(f().mode),o.brand=we(t,f().theme??"",S);try{await M(o.brand)}catch{o.brand!==x&&(o.brand=x||u.brand)}return this.apply(o),this._watchSystemPreference(),this._watchRootAttributes(),this._watchCrossDocumentStorage(),o})(),this._initPromise)},_watchCrossDocumentStorage(){typeof window>"u"||window.addEventListener("storage",async t=>{if(t.key!==`vb:${V}:${q}`||!t.newValue)return;let e;try{let r=JSON.parse(t.newValue);e=pe(r?.data)}catch{return}if(!e)return;let a={...u,...o,...e};if(a.brand=we(e,f().theme??"",S),a.brand&&a.brand!==o?.brand)try{await M(a.brand)}catch{a.brand=x||u.brand}o=a,this.apply(o||{})})},load(){return o?{...o}:{...u}},save(t){let e={...o??u,...t,v:ve};return o=e,A.set(V,q,e).catch(()=>{}),e},apply({mode:t="auto",brand:e="default",borderStyle:a=null,iconSet:r=null,fluid:s=null,backdrop:n=null,backdropChrome:i=null,pageBgType:c="",pageBgColor:m="",pageBgGradStart:k="",pageBgGradEnd:v="",pageBgGradDir:T=""}={}){let h=document.documentElement,d=f(),y=ye(t,C,window.matchMedia("(prefers-color-scheme: dark)").matches);h.dataset.mode=y;let _=S==="site",B=Me(h.dataset.theme||"",N,e,_);B?h.dataset.theme=B:delete h.dataset.theme,N=e==="default"&&!B.startsWith("default")?"":e;let P=a||d.borderStyle||this._readCSSHint("--theme-border-style");this._setRootAttr("data-border-style",P&&P!=="clean"?P:"");let D=r||d.iconSet||this._readCSSHint("--theme-icon-set");this._setRootAttr("data-icon-set",D&&D!=="lucide"?D:"");let Z=b(s,d.fluid);this._setRootAttr("data-fluid",Z,!0);let ee=b(n,d.backdrop);this._setRootAttr("data-backdrop",ee,!0);let L=b(i,d.backdropChrome);if(this._setRootAttr("data-backdrop-chrome",L&&L!=="card"?L:""),c==="color"&&m)h.style.setProperty("--page-bg-color",m),h.style.removeProperty("--page-bg-gradient");else if(c==="gradient"&&k&&v){let Se=T||"to bottom";h.style.setProperty("--page-bg-gradient",`linear-gradient(${Se}, ${k}, ${v})`),h.style.removeProperty("--page-bg-color")}else h.style.removeProperty("--page-bg-color"),h.style.removeProperty("--page-bg-gradient");this._applyAccent(this.load().accent);let Ee=this.getState().accent;this._syncThemeColor(),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{mode:t,brand:e,accent:Ee,borderStyle:P,iconSet:D,fluid:Z,backdrop:ee,backdropChrome:L,pageBgType:c,effectiveMode:y}}))},_setRootAttr(t,e,a=!1){let r=document.documentElement;e?r.setAttribute(t,e):a&&this._authoredHas(t)?r.setAttribute(t,""):r.removeAttribute(t)},_authoredHas(t){let e=Object.keys(G).find(r=>G[r]===t);return e?this.load()[e]==null&&f()[e]!=null:!1},_syncThemeColor(){let t=document.querySelectorAll('meta[name="theme-color"]');if(!t.length)return;let e=s=>!s||s==="transparent"||/^rgba\(.*,\s*0\)$/.test(s),a=getComputedStyle(document.documentElement).backgroundColor;if(e(a)){let s=document.createElement("span");s.style.setProperty("position","absolute"),s.style.setProperty("background-color","var(--color-background)"),(document.body||document.documentElement).append(s),a=getComputedStyle(s).backgroundColor,s.remove()}if(e(a))return;let r=Te(a);t.forEach(s=>{s.removeAttribute("media"),s.setAttribute("content",r)})},setMode(t){C=null;let e=this.save({mode:t});this.apply(e)},async setBrand(t){try{await M(t)}catch(a){console.warn(`[VB] Theme "${t}" failed to load, using default`,a),t="default"}let e=this.save({brand:t});this.apply(e)},setAccent(t){this.save({accent:t}),this._applyAccent(t),this._syncThemeColor(),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{...this.getState()}}))},setBorderStyle(t){let e=this.save({borderStyle:t});this.apply(e)},setIconSet(t){let e=this.save({iconSet:t});this.apply(e)},setFluid(t){let e=this.save({fluid:t});this.apply(e)},setBackdrop(t){let e=this.save({backdrop:t});this.apply(e)},setBackdropChrome(t){let e=this.save({backdropChrome:t});this.apply(e)},setPageBg({type:t="",color:e="",gradStart:a="",gradEnd:r="",gradDir:s=""}={}){let n=this.save({pageBgType:t,pageBgColor:e,pageBgGradStart:a,pageBgGradEnd:r,pageBgGradDir:s});this.apply(n)},getEffectiveMode(){let{mode:t}=this.load();return ye(t,C,window.matchMedia("(prefers-color-scheme: dark)").matches)},getState(){let{mode:t,brand:e,accent:a,borderStyle:r,iconSet:s,fluid:n,backdrop:i,backdropChrome:c,pageBgType:m,pageBgColor:k,pageBgGradStart:v,pageBgGradEnd:T,pageBgGradDir:h}=this.load(),d=typeof document>"u"?{}:f(),y=(_,B)=>B==null&&d[_]===""?"default":b(B,d[_]);return{mode:t,brand:e,accent:b(a,d.accent)||"default",borderStyle:b(r,d.borderStyle),iconSet:b(s,d.iconSet),fluid:y("fluid",n),backdrop:y("backdrop",i),backdropChrome:b(c,d.backdropChrome),pageBgType:m,pageBgColor:k,pageBgGradStart:v,pageBgGradEnd:T,pageBgGradDir:h,effectiveMode:this.getEffectiveMode()}},toggleMode(){let e=this.getEffectiveMode()==="dark"?"light":"dark";this.setMode(e)},reset(){o={...u,brand:x||u.brand},C=ge(f().mode),A.remove(V,q).catch(()=>{});let t=document.documentElement;t.style.removeProperty("--page-bg-color"),t.style.removeProperty("--page-bg-gradient");for(let e of be)t.style.removeProperty(e);this.apply(o)},_readCSSHint(t){return getComputedStyle(document.documentElement).getPropertyValue(t).trim()},_applyAccent(t){let e=document.documentElement;for(let r of be)e.style.removeProperty(r);if(t==null){let r=f().accent;r?e.dataset.accent=r:delete e.dataset.accent;return}let a=he.find(r=>r.id===t);if(!a||!a.seeds||Object.keys(a.seeds).length===0){delete e.dataset.accent;return}e.dataset.accent=a.id},_watchRootAttributes(){this._rootObserver||(this._rootObserver=new MutationObserver(t=>{for(let e of t)e.attributeName==="data-theme"?this._syncFromDataTheme():e.attributeName==="data-mode"&&this._syncFromDataMode()}),this._rootObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","data-mode"]}))},_syncFromDataTheme(){if(!o)return;let t=document.documentElement.dataset.theme||"",e=t.split(/\s+/).filter(Boolean),a=j(t,S)||"default";a!==o.brand&&(o.brand=a,M(a).catch(()=>{}),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{...this.getState()}})))},_syncFromDataMode(){if(!o)return;let t=document.documentElement.dataset.mode||"auto",e=this.getEffectiveMode();t!==e&&(C=null,o.mode=t,this._syncThemeColor(),window.dispatchEvent(new CustomEvent("vb:theme-change",{detail:{...this.getState()}})))},_watchSystemPreference(){window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{let e=this.load();e.mode==="auto"&&this.apply(e)})}};if(typeof window<"u"){let t=window.VB??(window.VB={});t.themeManager??=g}var $=new Map;for(let t of F)for(let e of t.themes)$.set(e.id,e);var Fe={panel:"Theme settings",trigger:"Theme settings",mode:"Color Mode",theme:"Theme"},l=t=>String(t??"").replace(/[&<>"']/g,e=>({"&":"&","<":"<",">":">",'"':""","'":"'"})[e]),xe=0,Q=class t extends O{static#s=200;#t;#e;#a=!1;#r=!1;#f=!1;#p=F;#d=null;#v=++xe;#l=0;#o=!1;#n=()=>this.#b();setup(){return this.#r=this.getAttribute("variant")==="inline",this.#f=this.hasAttribute("swatches"),this.#p=this.#E(),this.#S(++this.#l),!0}#E(){let e=(this.getAttribute("themes")||"").split(/\s+/).filter(Boolean);if(!e.length)return F;let a=[...new Set(e)].map(r=>$.get(r)).filter(Boolean);return a.length?[{label:this.#c("theme"),themes:a,tier:"core"}]:F}async#S(e){await g.init(),!(!this.isConnected||e!==this.#l||this.#e)&&(this.#k(),this.#T(),this.#w(),this.listen(window,"vb:theme-change",this.#R))}teardown(){this.#l++,window.removeEventListener("scroll",this.#n,{capture:!0}),window.removeEventListener("resize",this.#n),this.#m(),this.#a=!1,this.#o=!1,this.removeAttribute("open"),this.#t?.setAttribute("aria-expanded","false"),this.#e?.remove(),this.#e=null}#k(){this.#r||(this.#t=this.querySelector(":scope > [data-trigger]"),this.#t||(this.#t=this.querySelector(":scope > button")),this.#t||(this.#t=document.createElement("button"),this.#t.type="button",this.#t.setAttribute("data-trigger",""),this.#t.innerHTML=`
|
|
2
2
|
<icon-wc name="palette" label="${l(this.#c("trigger"))}"></icon-wc>
|
|
3
3
|
`,this.prepend(this.#t)),this.#t.setAttribute("aria-haspopup","dialog"),this.#t.setAttribute("aria-expanded","false")),this.#e=document.createElement("div"),this.#e.className="panel",this.#e.setAttribute("role",this.#r?"group":"dialog"),this.#e.setAttribute("aria-label",this.#c("panel")),this.#r||(this.#e.id=`theme-panel-${crypto.randomUUID().slice(0,8)}`,this.#t.setAttribute("aria-controls",this.#e.id)),this.#e.innerHTML=this.#B(),this.appendChild(this.#e)}#c(e){return this.getAttribute(`data-label-${e}`)||Fe[e]}#i(e){return`theme-${e}-${this.#v}`}#B(){let{mode:e,brand:a}=g.getState(),r=l(this.#c("mode")),s=l(this.#c("theme"));return`
|
|
4
4
|
<fieldset class="section" role="radiogroup">
|
|
@@ -16,14 +16,21 @@ var w=new Map,z=new Map;var te=null;function U(){if(typeof window<"u"&&window.__
|
|
|
16
16
|
</div>
|
|
17
17
|
</fieldset>
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
${this.#f?`
|
|
20
|
+
<fieldset class="section">
|
|
21
|
+
<legend>${s} <span class="theme-name" aria-hidden="true"></span></legend>
|
|
22
|
+
${this.#C(a)}
|
|
23
|
+
</fieldset>
|
|
24
|
+
`:`
|
|
25
|
+
<div class="section">
|
|
26
|
+
<label class="section-label" for="${this.#i("select")}">${s}</label>
|
|
27
|
+
${this.#A(a)}
|
|
28
|
+
</div>
|
|
29
|
+
`}
|
|
23
30
|
`}#g(e){let a=this.#p.filter(n=>n.themes.length);if(a.some(n=>n.themes.some(i=>i.id===e)))return a;let r=$.get(e),s=a[a.length-1];return!r||!s?a:[...a.slice(0,-1),{label:s.label,tier:s.tier,themes:[...s.themes,r]}]}#A(e){let a=this.#g(e),r=s=>s.map(n=>`
|
|
24
31
|
<option value="${l(n.id)}" ${e===n.id?"selected":""}>${l(n.name)}</option>
|
|
25
32
|
`).join("");return`
|
|
26
|
-
<select class="theme-select" name="theme-brand-select"
|
|
33
|
+
<select class="theme-select" name="theme-brand-select" id="${this.#i("select")}">
|
|
27
34
|
${a.length===1?r(a[0].themes):a.map(s=>`
|
|
28
35
|
<optgroup label="${l(s.label)}">${r(s.themes)}</optgroup>
|
|
29
36
|
`).join("")}
|
|
@@ -53,5 +60,5 @@ var w=new Map,z=new Map;var te=null;function U(){if(typeof window<"u"&&window.__
|
|
|
53
60
|
<span class="visually-hidden">${l(e.name)}</span>
|
|
54
61
|
</span>
|
|
55
62
|
</label>
|
|
56
|
-
`}#T(){this.#e.querySelectorAll('input[data-field="mode"]').forEach(r=>{r.addEventListener("change",this.#P)}),this.#e.querySelectorAll('input[data-field="brand"]').forEach(r=>{r.addEventListener("change",this.#D),r.addEventListener("focus",this.#y),r.closest("label")?.addEventListener("pointerenter",this.#y)});let e=this.#e.querySelector(".themes");e?.addEventListener("pointerleave",()=>this.#h()),e?.addEventListener("focusout",()=>this.#h());let a=this.#e.querySelector('select[name="theme-brand-select"]');a&&a.addEventListener("change",this.#L),this.#e.addEventListener("pointerdown",()=>{this.#o=!0}),this.#e.addEventListener("keydown",()=>{this.#o=!1}),this.#r||(this.listen(this.#t,"click",this.#F),this.listen(document,"click",this.#x),this.listen(document,"keydown",this.#_),this.listen(this,"focusout",this.#M))}#M=e=>{let a=e.relatedTarget;this.#a&&a instanceof Node&&!this.contains(a)&&this.close()};#F=e=>{e.stopPropagation(),this.toggle()};#x=e=>{this.#a&&!this.contains(e.target)&&this.close()};#_=e=>{e.key==="Escape"&&this.#a&&(e.preventDefault(),this.close(),this.#t?.focus())};#P=e=>{g.setMode(e.target.value),this.#
|
|
63
|
+
`}#T(){this.#e.querySelectorAll('input[data-field="mode"]').forEach(r=>{r.addEventListener("change",this.#P)}),this.#e.querySelectorAll('input[data-field="brand"]').forEach(r=>{r.addEventListener("change",this.#D),r.addEventListener("focus",this.#y),r.closest("label")?.addEventListener("pointerenter",this.#y)});let e=this.#e.querySelector(".themes");e?.addEventListener("pointerleave",()=>this.#h()),e?.addEventListener("focusout",()=>this.#h());let a=this.#e.querySelector('select[name="theme-brand-select"]');a&&a.addEventListener("change",this.#L),this.#e.addEventListener("pointerdown",()=>{this.#o=!0}),this.#e.addEventListener("keydown",()=>{this.#o=!1}),this.#r||(this.listen(this.#t,"click",this.#F),this.listen(document,"click",this.#x),this.listen(document,"keydown",this.#_),this.listen(this,"focusout",this.#M))}#M=e=>{let a=e.relatedTarget;this.#a&&a instanceof Node&&!this.contains(a)&&this.close()};#F=e=>{e.stopPropagation(),this.toggle()};#x=e=>{this.#a&&!this.contains(e.target)&&this.close()};#_=e=>{e.key==="Escape"&&this.#a&&(e.preventDefault(),this.close(),this.#t?.focus())};#P=e=>{g.setMode(e.target.value),this.#u()};#y=e=>{let a=e.currentTarget,r=a instanceof HTMLInputElement?a:a.querySelector('input[data-field="brand"]');r?.value&&(ie(r.value),this.#h(r.value))};#h(e=g.getState().brand){let a=this.#e?.querySelector(".theme-name");a&&(a.textContent=$.get(e)?.name??e)}#D=async e=>{let a=e.target.closest(".swatch-cell");a&&a.setAttribute("aria-busy","true");try{await g.setBrand(e.target.value)}catch{console.warn("[VB] Theme load failed, using default")}finally{a&&a.removeAttribute("aria-busy")}this.#u()};#L=async e=>{let a=e.target;a.disabled=!0;try{await g.setBrand(a.value)}catch{console.warn("[VB] Theme load failed, using default")}finally{a.disabled=!1}this.#u()};#u(){this.#r||!this.#o||(this.#m(),this.#d=setTimeout(()=>{this.close(),this.#t?.focus()},t.#s))}#m(){this.#d&&(clearTimeout(this.#d),this.#d=null)}#R=()=>{this.#w()};#w(){if(!this.#e)return;let{mode:e,brand:a}=g.getState(),r=this.#e.querySelector(`input[data-field="mode"][value="${e}"]`);r&&(r.checked=!0);let s=this.#e.querySelector(`input[data-field="brand"][value="${a}"]`);s&&(s.checked=!0),this.#h();let n=this.#e.querySelector('select[name="theme-brand-select"]');n&&(![...n.options].some(i=>i.value===a)&&$.has(a)&&n.add(new Option($.get(a).name,a)),n.value=a),s&&this.#a&&s.closest(".swatch-cell")?.scrollIntoView({block:"nearest"})}open(){this.#r||this.#a||(this.#a=!0,this.setAttribute("open",""),this.#t?.setAttribute("aria-expanded","true"),requestAnimationFrame(()=>{if(this.#b(),window.addEventListener("scroll",this.#n,{capture:!0,passive:!0}),window.addEventListener("resize",this.#n,{passive:!0}),!this.#a||!this.#e)return;(this.#e.querySelector('input[type="radio"]:checked')||this.#e.querySelector("input, select, button, summary, a[href]"))?.focus(),this.#e.querySelector('input[data-field="brand"]:checked')?.closest(".swatch-cell")?.scrollIntoView({block:"nearest"})}),this.dispatchEvent(new CustomEvent("theme-picker:open",{bubbles:!0})))}#b(){if(!this.#t||!this.#e)return;let e=this.#t.getBoundingClientRect(),a=this.#e.getBoundingClientRect(),r=window.visualViewport||{width:window.innerWidth,height:window.innerHeight},s=r.height,n=r.width,i=8,c=16,m=s-e.bottom-c,k=e.top-c,v=e.height+i;m<a.height&&k>m?(v=-a.height-i,this.#e.dataset.position="top"):delete this.#e.dataset.position;let T=n-e.right,h=e.right-a.width;if(this.#e.style.setProperty("--panel-top",`${v}px`),h<c){let d=0,y=e.left+a.width+c;y>n&&(d=n-y),e.left+d<c&&(d=c-e.left),this.#e.style.setProperty("--panel-left",`${d}px`),this.#e.style.setProperty("--panel-right","auto")}else{let d=Math.max(0,c-T);this.#e.style.setProperty("--panel-left","auto"),this.#e.style.setProperty("--panel-right",`${d}px`)}}close(){this.#r||!this.#a||(this.#m(),this.#o=!1,this.#a=!1,this.removeAttribute("open"),this.#t?.setAttribute("aria-expanded","false"),window.removeEventListener("scroll",this.#n,{capture:!0}),window.removeEventListener("resize",this.#n),this.dispatchEvent(new CustomEvent("theme-picker:close",{bubbles:!0})))}toggle(){this.#a?this.close():this.open()}get isOpen(){return this.#a}};ce("theme-picker",Q);export{Q as ThemePicker};
|
|
57
64
|
//# sourceMappingURL=theme-picker.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
theme-picker:not(:defined){display:block}theme-picker{display:inline-block;position:relative;&[variant=inline]{display:block}&[open] .panel{opacity:1;visibility:visible;transform:translateY(0);transition:opacity var(--motion-enter-duration) var(--ease-out),visibility 0s,transform var(--motion-enter-duration) var(--ease-out)}&[variant=inline] .panel{position:static;opacity:1;visibility:visible;transform:none;box-shadow:none;border:none;padding:0;background:transparent;inline-size:auto}&[variant=inline] .themes{max-block-size:none}}@scope(theme-picker){.panel{--panel-top: calc(100% + var(--size-xs));--panel-left: auto;--panel-right: 0px;position:absolute;top:var(--panel-top);left:var(--panel-left);right:var(--panel-right);z-index:1000;inline-size:16rem;text-align:start;padding:var(--size-m);background:var(--color-surface-overlay);border:var(--border-width-thin) solid var(--color-border);border-radius:var(--radius-m);box-shadow:var(--shadow-m);opacity:0;visibility:hidden;transform:translateY(-.25rem);transition:opacity var(--motion-exit-duration) var(--ease-out),visibility var(--motion-exit-duration) var(--ease-out),transform var(--motion-exit-duration) var(--ease-out);&[data-position=top]{transform:translateY(.25rem)}}.section{margin:0;padding:0;border:none;border-radius:0}.section+.section{margin-block-start:var(--size-m)}.section>legend{padding:0;padding-inline:0;margin-block-end:var(--size-s);font-size:var(--font-size-s);font-weight:var(--font-weight-medium);color:var(--color-text-muted)}.theme-name{color:var(--color-text);&:not(:empty):before{content:"\b7\a0";color:var(--color-text-muted)}}.themes{max-block-size:min(22rem,50vh);overflow-y:auto;overscroll-behavior:contain;padding:var(--size-2xs);margin:calc(-1 * var(--size-2xs))}.swatch-grid{display:flex;flex-wrap:wrap;gap:var(--size-xs)}:scope:not([variant=inline]) .themes,:scope[themes] .themes{display:flex;flex-wrap:wrap;gap:var(--size-xs);.theme-category,.swatch-grid{display:contents}.category-label{display:none}}.swatch-cell{cursor:var(--cursor-custom-pointer, pointer);& input[type=radio]{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.swatch-visual{display:flex;align-items:center;justify-content:center;inline-size:2rem;block-size:2rem;border-radius:var(--radius-s);background:var(--swatch-bg);color:var(--swatch-fg, white);border:var(--border-width-thin) solid oklch(0 0 0 / .15);transition:transform var(--duration-fast) var(--ease-default),border-color var(--duration-fast) var(--ease-default);& icon-wc{font-size:.875rem}}&:hover .swatch-visual{transform:scale(1.1);border-color:var(--color-text-muted)}& input:focus-visible+.swatch-visual{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset)}& input:checked+.swatch-visual{outline:2px solid var(--color-primary);outline-offset:2px;border-color:transparent}&[aria-busy=true] .swatch-visual{opacity:.5;pointer-events:none}}.theme-select{display:block;inline-size:100%;padding:var(--size-xs) var(--size-s);font:inherit;font-size:var(--font-size-s);color:var(--color-text);background-color:var(--color-surface);border:var(--border-width-thin) solid var(--color-border);border-radius:var(--radius-s);cursor:var(--cursor-custom-pointer, pointer);&:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset)}}@supports (appearance: base-select){.theme-select:not([multiple]){display:flex;align-items:center}}.segmented{display:grid;grid-template-columns:repeat(var(--seg-count, 3),1fr);grid-template-rows:auto auto;border:var(--border-width-thin) solid var(--color-border);border-radius:var(--radius-s);overflow:hidden}.seg{display:grid;grid-template-rows:subgrid;grid-row:span 2;cursor:var(--cursor-custom-pointer, pointer);position:relative;& input[type=radio]{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.seg-visual{display:grid;grid-template-rows:subgrid;grid-row:span 2;align-items:center;justify-items:center;gap:var(--size-3xs, 2px);padding:var(--size-2xs) var(--size-xs);min-block-size:2.5rem;text-align:center;font-size:var(--font-size-s);line-height:1.2;transition:background-color var(--duration-fast) var(--ease-default),color var(--duration-fast) var(--ease-default)}& icon-wc{flex-shrink:0;font-size:1em}&:not(:last-child) .seg-visual{border-inline-end:var(--border-width-thin) solid var(--color-border)}&:hover .seg-visual{background:var(--color-surface-alt)}& input:checked+.seg-visual{background:var(--color-primary);color:#fff}& input:focus-visible+.seg-visual{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset)}}.theme-category{+.theme-category{margin-block-start:var(--size-s)}}.category-label{display:block;font-size:var(--font-size-xs);font-weight:var(--font-weight-medium);color:var(--color-text-muted);text-transform:uppercase;letter-spacing:.05em;margin-block-end:var(--size-2xs)}}@media(prefers-reduced-motion:reduce){@scope(theme-picker){.panel{transition:none;transform:none}.swatch-visual,.seg-visual{transition:none}}}@media(forced-colors:active){@scope(theme-picker){.panel{border-color:CanvasText}.seg input:checked+.seg-visual{forced-color-adjust:none;background:Highlight;color:HighlightText;& icon-wc{color:HighlightText}}.swatch-visual{forced-color-adjust:none;border-color:CanvasText}.swatch-cell input:checked+.swatch-visual{outline:3px solid Highlight;outline-offset:2px}.swatch-cell input:focus-visible+.swatch-visual,.seg input:focus-visible+.seg-visual{outline:2px dashed CanvasText;outline-offset:4px}}}
|
|
1
|
+
theme-picker:not(:defined){display:block}theme-picker{display:inline-block;position:relative;&[variant=inline]{display:block}&[open] .panel{opacity:1;visibility:visible;transform:translateY(0);transition:opacity var(--motion-enter-duration) var(--ease-out),visibility 0s,transform var(--motion-enter-duration) var(--ease-out)}&[variant=inline] .panel{position:static;opacity:1;visibility:visible;transform:none;box-shadow:none;border:none;padding:0;background:transparent;inline-size:auto}&[variant=inline] .themes{max-block-size:none}}@scope(theme-picker){.panel{--panel-top: calc(100% + var(--size-xs));--panel-left: auto;--panel-right: 0px;position:absolute;top:var(--panel-top);left:var(--panel-left);right:var(--panel-right);z-index:1000;inline-size:16rem;text-align:start;padding:var(--size-m);background:var(--color-surface-overlay);border:var(--border-width-thin) solid var(--color-border);border-radius:var(--radius-m);box-shadow:var(--shadow-m);opacity:0;visibility:hidden;transform:translateY(-.25rem);transition:opacity var(--motion-exit-duration) var(--ease-out),visibility var(--motion-exit-duration) var(--ease-out),transform var(--motion-exit-duration) var(--ease-out);&[data-position=top]{transform:translateY(.25rem)}}.section{margin:0;padding:0;border:none;border-radius:0}.section+.section{margin-block-start:var(--size-m)}.section>legend,.section>.section-label{display:block;padding:0;padding-inline:0;margin-block-end:var(--size-s);font-size:var(--font-size-s);font-weight:var(--font-weight-medium);color:var(--color-text-muted)}.theme-name{color:var(--color-text);&:not(:empty):before{content:"\b7\a0";color:var(--color-text-muted)}}.themes{max-block-size:min(22rem,50vh);overflow-y:auto;overscroll-behavior:contain;padding:var(--size-2xs);margin:calc(-1 * var(--size-2xs))}.swatch-grid{display:flex;flex-wrap:wrap;gap:var(--size-xs)}:scope:not([variant=inline]) .themes,:scope[themes] .themes{display:flex;flex-wrap:wrap;gap:var(--size-xs);.theme-category,.swatch-grid{display:contents}.category-label{display:none}}.swatch-cell{cursor:var(--cursor-custom-pointer, pointer);& input[type=radio]{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.swatch-visual{display:flex;align-items:center;justify-content:center;inline-size:2rem;block-size:2rem;border-radius:var(--radius-s);background:var(--swatch-bg);color:var(--swatch-fg, white);border:var(--border-width-thin) solid oklch(0 0 0 / .15);transition:transform var(--duration-fast) var(--ease-default),border-color var(--duration-fast) var(--ease-default);& icon-wc{font-size:.875rem}}&:hover .swatch-visual{transform:scale(1.1);border-color:var(--color-text-muted)}& input:focus-visible+.swatch-visual{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset)}& input:checked+.swatch-visual{outline:2px solid var(--color-primary);outline-offset:2px;border-color:transparent}&[aria-busy=true] .swatch-visual{opacity:.5;pointer-events:none}}.theme-select{display:block;inline-size:100%;padding:var(--size-xs) var(--size-s);font:inherit;font-size:var(--font-size-s);color:var(--color-text);background-color:var(--color-surface);border:var(--border-width-thin) solid var(--color-border);border-radius:var(--radius-s);cursor:var(--cursor-custom-pointer, pointer);&:focus-visible{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset)}}@supports (appearance: base-select){.theme-select:not([multiple]){display:flex;align-items:center}}.segmented{display:grid;grid-template-columns:repeat(var(--seg-count, 3),1fr);grid-template-rows:auto auto;border:var(--border-width-thin) solid var(--color-border);border-radius:var(--radius-s);overflow:hidden}.seg{display:grid;grid-template-rows:subgrid;grid-row:span 2;cursor:var(--cursor-custom-pointer, pointer);position:relative;& input[type=radio]{position:absolute;inline-size:1px;block-size:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}.seg-visual{display:grid;grid-template-rows:subgrid;grid-row:span 2;align-items:center;justify-items:center;gap:var(--size-3xs, 2px);padding:var(--size-2xs) var(--size-xs);min-block-size:2.5rem;text-align:center;font-size:var(--font-size-s);line-height:1.2;transition:background-color var(--duration-fast) var(--ease-default),color var(--duration-fast) var(--ease-default)}& icon-wc{flex-shrink:0;font-size:1em}&:not(:last-child) .seg-visual{border-inline-end:var(--border-width-thin) solid var(--color-border)}&:hover .seg-visual{background:var(--color-surface-alt)}& input:checked+.seg-visual{background:var(--color-primary);color:#fff}& input:focus-visible+.seg-visual{outline:var(--focus-ring-width) solid var(--focus-ring-color);outline-offset:var(--focus-ring-offset)}}.theme-category{+.theme-category{margin-block-start:var(--size-s)}}.category-label{display:block;font-size:var(--font-size-xs);font-weight:var(--font-weight-medium);color:var(--color-text-muted);text-transform:uppercase;letter-spacing:.05em;margin-block-end:var(--size-2xs)}}@media(prefers-reduced-motion:reduce){@scope(theme-picker){.panel{transition:none;transform:none}.swatch-visual,.seg-visual{transition:none}}}@media(forced-colors:active){@scope(theme-picker){.panel{border-color:CanvasText}.seg input:checked+.seg-visual{forced-color-adjust:none;background:Highlight;color:HighlightText;& icon-wc{color:HighlightText}}.swatch-visual{forced-color-adjust:none;border-color:CanvasText}.swatch-cell input:checked+.swatch-visual{outline:3px solid Highlight;outline-offset:2px}.swatch-cell input:focus-visible+.swatch-visual,.seg input:focus-visible+.seg-visual{outline:2px dashed CanvasText;outline-offset:4px}}}
|
|
2
2
|
/*# sourceMappingURL=ui.full.css.map */
|