@pure-ds/core 0.5.10 → 0.5.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- var yt=Object.defineProperty;var gt=(t,e)=>()=>(t&&(e=t(t=0)),e);var bt=(t,e)=>{for(var s in e)yt(t,s,{get:e[s],enumerable:!0})};var ot={};bt(ot,{AutoDefiner:()=>Pe});async function Kt(...t){let e={};t.length&&typeof t[t.length-1]=="object"&&(e=t.pop()||{});let s=t,{baseURL:n,mapper:r=d=>`${d}.js`,onError:o=(d,l)=>console.error(`[defineWebComponents] ${d}:`,l)}=e,i=n?new URL(n,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),a=d=>d.toLowerCase().replace(/(^|-)([a-z])/g,(l,u,f)=>f.toUpperCase()),c=async d=>{try{if(customElements.get(d))return{tag:d,status:"already-defined"};let l=r(d),f=await import(l instanceof URL?l.href:new URL(l,i).href),m=f?.default??f?.[a(d)];if(!m){if(customElements.get(d))return{tag:d,status:"self-defined"};throw new Error(`No export found for ${d}. Expected default export or named export "${a(d)}".`)}return customElements.get(d)?{tag:d,status:"race-already-defined"}:(customElements.define(d,m),{tag:d,status:"defined"})}catch(l){throw o(d,l),l}};return Promise.all(s.map(c))}var Pe,it=gt(()=>{Pe=class{constructor(e={}){let{baseURL:s,mapper:n,onError:r,predicate:o=()=>!0,attributeModule:i="data-module",root:a=document,scanExisting:c=!0,debounceMs:d=16,observeShadows:l=!0,enhancers:u=[],patchAttachShadow:f=!0}=e,m=new Set,$=new Set,x=new Set,g=new Map,w=new WeakMap,H=new WeakMap,A=0,D=!1,L=null,Z=p=>{if(!p||!u.length)return;let y=H.get(p);y||(y=new Set,H.set(p,y));for(let h of u)if(!(!h.selector||!h.run)&&!y.has(h.selector))try{p.matches&&p.matches(h.selector)&&(h.run(p),y.add(h.selector))}catch(v){console.warn(`[AutoDefiner] Error applying enhancer for selector "${h.selector}":`,v)}},I=(p,y)=>{if(!D&&!(!p||!p.includes("-"))&&!customElements.get(p)&&!$.has(p)&&!x.has(p)){if(y&&y.getAttribute){let h=y.getAttribute(i);h&&!g.has(p)&&g.set(p,h)}m.add(p),oe()}},oe=()=>{A||(A=setTimeout(z,d))},E=p=>{if(p){if(p.nodeType===1){let y=p,h=y.tagName?.toLowerCase();h&&h.includes("-")&&!customElements.get(h)&&o(h,y)&&I(h,y),Z(y),l&&y.shadowRoot&&M(y.shadowRoot)}p.querySelectorAll&&p.querySelectorAll("*").forEach(y=>{let h=y.tagName?.toLowerCase();h&&h.includes("-")&&!customElements.get(h)&&o(h,y)&&I(h,y),Z(y),l&&y.shadowRoot&&M(y.shadowRoot)})}},M=p=>{if(!p||w.has(p))return;E(p);let y=new MutationObserver(h=>{for(let v of h)v.addedNodes?.forEach(B=>{E(B)}),v.type==="attributes"&&v.target&&E(v.target)});y.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[i,...u.map(h=>h.selector).filter(h=>h.startsWith("data-"))]}),w.set(p,y)};async function z(){if(clearTimeout(A),A=0,!m.size)return;let p=Array.from(m);m.clear(),p.forEach(y=>$.add(y));try{let y=h=>g.get(h)??(n?n(h):`${h}.js`);await Kt(...p,{baseURL:s,mapper:y,onError:(h,v)=>{x.add(h),r?.(h,v)}})}catch{}finally{p.forEach(y=>$.delete(y))}}let S=a===document?document.documentElement:a,R=new MutationObserver(p=>{for(let y of p)y.addedNodes?.forEach(h=>{E(h)}),y.type==="attributes"&&y.target&&E(y.target)});if(R.observe(S,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[i,...u.map(p=>p.selector).filter(p=>p.startsWith("data-"))]}),l&&f&&Element.prototype.attachShadow){let p=Element.prototype.attachShadow;Element.prototype.attachShadow=function(h){let v=p.call(this,h);if(h&&h.mode==="open"){M(v);let B=this.tagName?.toLowerCase();B&&B.includes("-")&&!customElements.get(B)&&I(B,this)}return v},L=()=>Element.prototype.attachShadow=p}return c&&E(S),{stop(){D=!0,R.disconnect(),L&&L(),A&&(clearTimeout(A),A=0),w.forEach(p=>p.disconnect())},flush:z}}static async define(...e){let s={};e.length&&typeof e[e.length-1]=="object"&&(s=e.pop()||{});let n=e,{baseURL:r,mapper:o=l=>`${l}.js`,onError:i=(l,u)=>console.error(`[defineWebComponents] ${l}:`,u)}=s,a=r?new URL(r,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),c=l=>l.toLowerCase().replace(/(^|-)([a-z])/g,(u,f,m)=>m.toUpperCase()),d=async l=>{try{if(customElements.get(l))return{tag:l,status:"already-defined"};let u=o(l),m=await import(u instanceof URL?u.href:new URL(u,a).href),$=m?.default??m?.[c(l)];if(!$){if(customElements.get(l))return{tag:l,status:"self-defined"};throw new Error(`No export found for ${l}. Expected default export or named export "${c(l)}".`)}return customElements.get(l)?{tag:l,status:"race-already-defined"}:(customElements.define(l,$),{tag:l,status:"defined"})}catch(u){throw i(l,u),u}};return Promise.all(n.map(d))}}});var me=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(e={}){this._mode="static",this._staticPaths={...this._staticPaths,...e},console.log("[PDS Registry] Switched to STATIC mode",this._staticPaths)}async getStylesheet(e){if(this._mode==="live")return null;try{return(await import(this._staticPaths[e]))[e]}catch(s){console.error(`[PDS Registry] Failed to load static ${e}:`,s),console.error(`[PDS Registry] Looking for: ${this._staticPaths[e]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let n=new CSSStyleSheet;return n.replaceSync("/* Failed to load "+e+" */"),n}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},F=new me;async function Ue(t,e=[],s=null){try{let n=s?.primitivesStylesheet?s.primitivesStylesheet:await F.getStylesheet("primitives");t.adoptedStyleSheets=[n,...e]}catch(n){let r=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${r}> failed to adopt primitives:`,n),t.adoptedStyleSheets=e}}async function Oe(t,e=["primitives"],s=[],n=null){try{let o=(await Promise.all(e.map(async i=>{if(n)switch(i){case"tokens":return n.tokensStylesheet;case"primitives":return n.primitivesStylesheet;case"components":return n.componentsStylesheet;case"utilities":return n.utilitiesStylesheet;default:break}return F.getStylesheet(i)}))).filter(i=>i!==null);t.adoptedStyleSheets=[...o,...s]}catch(r){let o=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${o}> failed to adopt layers:`,r),t.adoptedStyleSheets=s}}function Ne(t){let e=new CSSStyleSheet;return e.replaceSync(t),e}var ie=globalThis,ce=ie.ShadowRoot&&(ie.ShadyCSS===void 0||ie.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qe=Symbol(),je=new WeakMap,ae=class{constructor(e,s,n){if(this._$cssResult$=!0,n!==qe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=s}get styleSheet(){let e=this.o,s=this.t;if(ce&&e===void 0){let n=s!==void 0&&s.length===1;n&&(e=je.get(s)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&je.set(s,e))}return e}toString(){return this.cssText}},He=t=>new ae(typeof t=="string"?t:t+"",void 0,qe);var Ie=(t,e)=>{if(ce)t.adoptedStyleSheets=e.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(let s of e){let n=document.createElement("style"),r=ie.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=s.cssText,t.appendChild(n)}},ye=ce?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let s="";for(let n of e.cssRules)s+=n.cssText;return He(s)})(t):t;var{is:$t,defineProperty:_t,getOwnPropertyDescriptor:wt,getOwnPropertyNames:St,getOwnPropertySymbols:At,getPrototypeOf:Et}=Object,le=globalThis,ze=le.trustedTypes,vt=ze?ze.emptyScript:"",Lt=le.reactiveElementPolyfillSupport,J=(t,e)=>t,ge={toAttribute(t,e){switch(e){case Boolean:t=t?vt:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=t!==null;break;case Number:s=t===null?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch{s=null}}return s}},Fe=(t,e)=>!$t(t,e),Be={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:Fe};Symbol.metadata??=Symbol("metadata"),le.litPropertyMetadata??=new WeakMap;var P=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,s=Be){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(e,s),!s.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,s);r!==void 0&&_t(this.prototype,e,r)}}static getPropertyDescriptor(e,s,n){let{get:r,set:o}=wt(this.prototype,e)??{get(){return this[s]},set(i){this[s]=i}};return{get:r,set(i){let a=r?.call(this);o?.call(this,i),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Be}static _$Ei(){if(this.hasOwnProperty(J("elementProperties")))return;let e=Et(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(J("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(J("properties"))){let s=this.properties,n=[...St(s),...At(s)];for(let r of n)this.createProperty(r,s[r])}let e=this[Symbol.metadata];if(e!==null){let s=litPropertyMetadata.get(e);if(s!==void 0)for(let[n,r]of s)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[s,n]of this.elementProperties){let r=this._$Eu(s,n);r!==void 0&&this._$Eh.set(r,s)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let s=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)s.unshift(ye(r))}else e!==void 0&&s.push(ye(e));return s}static _$Eu(e,s){let n=s.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,s=this.constructor.elementProperties;for(let n of s.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ie(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,s,n){this._$AK(e,n)}_$ET(e,s){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&n.reflect===!0){let o=(n.converter?.toAttribute!==void 0?n.converter:ge).toAttribute(s,n.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,s){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let o=n.getPropertyOptions(r),i=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ge;this._$Em=r;let a=i.fromAttribute(s,o.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,s,n){if(e!==void 0){let r=this.constructor,o=this[e];if(n??=r.getPropertyOptions(e),!((n.hasChanged??Fe)(o,s)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,s,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,s,{useDefault:n,reflect:r,wrapped:o},i){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,i??s??this[e]),o!==!0||i!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(s=void 0),this._$AL.set(e,s)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[r,o]of n){let{wrapped:i}=o,a=this[r];i!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,o,a)}}let e=!1,s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(s)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(s)}willUpdate(e){}_$AE(e){this._$EO?.forEach(s=>s.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(s=>this._$ET(s,this[s])),this._$EM()}updated(e){}firstUpdated(e){}};P.elementStyles=[],P.shadowRootOptions={mode:"open"},P[J("elementProperties")]=new Map,P[J("finalized")]=new Map,Lt?.({ReactiveElement:P}),(le.reactiveElementVersions??=[]).push("2.1.1");var Ee=globalThis,de=Ee.trustedTypes,We=de?de.createPolicy("lit-html",{createHTML:t=>t}):void 0,Qe="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,Xe="?"+k,Ct=`<${Xe}>`,O=document,X=()=>O.createComment(""),Y=t=>t===null||typeof t!="object"&&typeof t!="function",ve=Array.isArray,xt=t=>ve(t)||typeof t?.[Symbol.iterator]=="function",be=`[
2
- \f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ve=/-->/g,Ke=/>/g,T=RegExp(`>|${be}(?:([^\\s"'>=/]+)(${be}*=${be}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Ge=/'/g,Ze=/"/g,Ye=/^(?:script|style|textarea|title)$/i,Le=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),cs=Le(1),ls=Le(2),ds=Le(3),N=Symbol.for("lit-noChange"),_=Symbol.for("lit-nothing"),Je=new WeakMap,U=O.createTreeWalker(O,129);function et(t,e){if(!ve(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return We!==void 0?We.createHTML(e):e}var Rt=(t,e)=>{let s=t.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",i=Q;for(let a=0;a<s;a++){let c=t[a],d,l,u=-1,f=0;for(;f<c.length&&(i.lastIndex=f,l=i.exec(c),l!==null);)f=i.lastIndex,i===Q?l[1]==="!--"?i=Ve:l[1]!==void 0?i=Ke:l[2]!==void 0?(Ye.test(l[2])&&(r=RegExp("</"+l[2],"g")),i=T):l[3]!==void 0&&(i=T):i===T?l[0]===">"?(i=r??Q,u=-1):l[1]===void 0?u=-2:(u=i.lastIndex-l[2].length,d=l[1],i=l[3]===void 0?T:l[3]==='"'?Ze:Ge):i===Ze||i===Ge?i=T:i===Ve||i===Ke?i=Q:(i=T,r=void 0);let m=i===T&&t[a+1].startsWith("/>")?" ":"";o+=i===Q?c+Ct:u>=0?(n.push(d),c.slice(0,u)+Qe+c.slice(u)+k+m):c+k+(u===-2?a:m)}return[et(t,o+(t[s]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},ee=class t{constructor({strings:e,_$litType$:s},n){let r;this.parts=[];let o=0,i=0,a=e.length-1,c=this.parts,[d,l]=Rt(e,s);if(this.el=t.createElement(d,n),U.currentNode=this.el.content,s===2||s===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(r=U.nextNode())!==null&&c.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let u of r.getAttributeNames())if(u.endsWith(Qe)){let f=l[i++],m=r.getAttribute(u).split(k),$=/([.?@])?(.*)/.exec(f);c.push({type:1,index:o,name:$[2],strings:m,ctor:$[1]==="."?_e:$[1]==="?"?we:$[1]==="@"?Se:V}),r.removeAttribute(u)}else u.startsWith(k)&&(c.push({type:6,index:o}),r.removeAttribute(u));if(Ye.test(r.tagName)){let u=r.textContent.split(k),f=u.length-1;if(f>0){r.textContent=de?de.emptyScript:"";for(let m=0;m<f;m++)r.append(u[m],X()),U.nextNode(),c.push({type:2,index:++o});r.append(u[f],X())}}}else if(r.nodeType===8)if(r.data===Xe)c.push({type:2,index:o});else{let u=-1;for(;(u=r.data.indexOf(k,u+1))!==-1;)c.push({type:7,index:o}),u+=k.length-1}o++}}static createElement(e,s){let n=O.createElement("template");return n.innerHTML=e,n}};function W(t,e,s=t,n){if(e===N)return e;let r=n!==void 0?s._$Co?.[n]:s._$Cl,o=Y(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(t),r._$AT(t,s,n)),n!==void 0?(s._$Co??=[])[n]=r:s._$Cl=r),r!==void 0&&(e=W(t,r._$AS(t,e.values),r,n)),e}var $e=class{constructor(e,s){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:s},parts:n}=this._$AD,r=(e?.creationScope??O).importNode(s,!0);U.currentNode=r;let o=U.nextNode(),i=0,a=0,c=n[0];for(;c!==void 0;){if(i===c.index){let d;c.type===2?d=new te(o,o.nextSibling,this,e):c.type===1?d=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(d=new Ae(o,this,e)),this._$AV.push(d),c=n[++a]}i!==c?.index&&(o=U.nextNode(),i++)}return U.currentNode=O,r}p(e){let s=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,s),s+=n.strings.length-2):n._$AI(e[s])),s++}},te=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,s,n,r){this.type=2,this._$AH=_,this._$AN=void 0,this._$AA=e,this._$AB=s,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,s=this._$AM;return s!==void 0&&e?.nodeType===11&&(e=s.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,s=this){e=W(this,e,s),Y(e)?e===_||e==null||e===""?(this._$AH!==_&&this._$AR(),this._$AH=_):e!==this._$AH&&e!==N&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):xt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==_&&Y(this._$AH)?this._$AA.nextSibling.data=e:this.T(O.createTextNode(e)),this._$AH=e}$(e){let{values:s,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=ee.createElement(et(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(s);else{let o=new $e(r,this),i=o.u(this.options);o.p(s),this.T(i),this._$AH=o}}_$AC(e){let s=Je.get(e.strings);return s===void 0&&Je.set(e.strings,s=new ee(e)),s}k(e){ve(this._$AH)||(this._$AH=[],this._$AR());let s=this._$AH,n,r=0;for(let o of e)r===s.length?s.push(n=new t(this.O(X()),this.O(X()),this,this.options)):n=s[r],n._$AI(o),r++;r<s.length&&(this._$AR(n&&n._$AB.nextSibling,r),s.length=r)}_$AR(e=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},V=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,s,n,r,o){this.type=1,this._$AH=_,this._$AN=void 0,this.element=e,this.name=s,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=_}_$AI(e,s=this,n,r){let o=this.strings,i=!1;if(o===void 0)e=W(this,e,s,0),i=!Y(e)||e!==this._$AH&&e!==N,i&&(this._$AH=e);else{let a=e,c,d;for(e=o[0],c=0;c<o.length-1;c++)d=W(this,a[n+c],s,c),d===N&&(d=this._$AH[c]),i||=!Y(d)||d!==this._$AH[c],d===_?e=_:e!==_&&(e+=(d??"")+o[c+1]),this._$AH[c]=d}i&&!r&&this.j(e)}j(e){e===_?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},_e=class extends V{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===_?void 0:e}},we=class extends V{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==_)}},Se=class extends V{constructor(e,s,n,r,o){super(e,s,n,r,o),this.type=5}_$AI(e,s=this){if((e=W(this,e,s,0)??_)===N)return;let n=this._$AH,r=e===_&&n!==_||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==_&&(n===_||r);r&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ae=class{constructor(e,s,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=s,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){W(this,e)}};var Pt=Ee.litHtmlPolyfillSupport;Pt?.(ee,te),(Ee.litHtmlVersions??=[]).push("3.3.1");var j=(t,e,s)=>{let n=s?.renderBefore??e,r=n._$litPart$;if(r===void 0){let o=s?.renderBefore??null;n._$litPart$=r=new te(e.insertBefore(X(),o),o,void 0,s??{})}return r._$AI(t),r};var Ce=globalThis,K=class extends P{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=j(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return N}};K._$litElement$=!0,K.finalized=!0,Ce.litElementHydrateSupport?.({LitElement:K});var kt=Ce.litElementPolyfillSupport;kt?.({LitElement:K});(Ce.litElementVersions??=[]).push("4.2.1");var tt={mode:"live",preset:"default",autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster"]},log(t,e,...s){console[t](e,...s)}};async function st(t,e={}){return e={...{title:"Confirm",type:"confirm",buttons:{ok:{name:"OK",primary:!0},cancel:{name:"Cancel",cancel:!0}}},...e},new Promise(n=>{let r=document.createElement("dialog");tt.options?.liquidGlassEffects&&r.classList.add("liquid-glass"),e.size&&r.classList.add(`dialog-${e.size}`),e.type&&r.classList.add(`dialog-${e.type}`),e.class&&(Array.isArray(e.class)?r.classList.add(...e.class):r.classList.add(e.class)),e.maxHeight&&r.style.setProperty("--dialog-max-height",e.maxHeight);let o=Object.entries(e.buttons).map(([a,c])=>{let d=c.primary?"btn-primary btn-sm":"btn-outline btn-sm";return`<button type="${c.cancel?"button":"submit"}" class="${d}" value="${a}">${c.name}</button>`});if(e.useForm){let a=document.createElement("div");typeof t=="object"&&t._$litType$?j(t,a):typeof t=="string"?a.textContent=t:j(t,a);let c=a.querySelector("form");if(c){r.innerHTML=`
1
+ var gt=Object.defineProperty;var bt=(t,e)=>()=>(t&&(e=t(t=0)),e);var wt=(t,e)=>{for(var s in e)gt(t,s,{get:e[s],enumerable:!0})};var ot={};wt(ot,{AutoDefiner:()=>Pe});async function Gt(...t){let e={};t.length&&typeof t[t.length-1]=="object"&&(e=t.pop()||{});let s=t,{baseURL:n,mapper:r=d=>`${d}.js`,onError:o=(d,l)=>console.error(`[defineWebComponents] ${d}:`,l)}=e,i=n?new URL(n,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),a=d=>d.toLowerCase().replace(/(^|-)([a-z])/g,(l,u,f)=>f.toUpperCase()),c=async d=>{try{if(customElements.get(d))return{tag:d,status:"already-defined"};let l=r(d),f=await import(l instanceof URL?l.href:new URL(l,i).href),m=f?.default??f?.[a(d)];if(!m){if(customElements.get(d))return{tag:d,status:"self-defined"};throw new Error(`No export found for ${d}. Expected default export or named export "${a(d)}".`)}return customElements.get(d)?{tag:d,status:"race-already-defined"}:(customElements.define(d,m),{tag:d,status:"defined"})}catch(l){throw o(d,l),l}};return Promise.all(s.map(c))}var Pe,it=bt(()=>{Pe=class{constructor(e={}){let{baseURL:s,mapper:n,onError:r,predicate:o=()=>!0,attributeModule:i="data-module",root:a=document,scanExisting:c=!0,debounceMs:d=16,observeShadows:l=!0,enhancers:u=[],patchAttachShadow:f=!0}=e,m=new Set,w=new Set,x=new Set,g=new Map,$=new WeakMap,I=new WeakMap,A=0,D=!1,L=null,Z=p=>{if(!p||!u.length)return;let y=I.get(p);y||(y=new Set,I.set(p,y));for(let h of u)if(!(!h.selector||!h.run)&&!y.has(h.selector))try{p.matches&&p.matches(h.selector)&&(h.run(p),y.add(h.selector))}catch(v){console.warn(`[AutoDefiner] Error applying enhancer for selector "${h.selector}":`,v)}},H=(p,y)=>{if(!D&&!(!p||!p.includes("-"))&&!customElements.get(p)&&!w.has(p)&&!x.has(p)){if(y&&y.getAttribute){let h=y.getAttribute(i);h&&!g.has(p)&&g.set(p,h)}m.add(p),ie()}},ie=()=>{A||(A=setTimeout(z,d))},E=p=>{if(p){if(p.nodeType===1){let y=p,h=y.tagName?.toLowerCase();h&&h.includes("-")&&!customElements.get(h)&&o(h,y)&&H(h,y),Z(y),l&&y.shadowRoot&&M(y.shadowRoot)}p.querySelectorAll&&p.querySelectorAll("*").forEach(y=>{let h=y.tagName?.toLowerCase();h&&h.includes("-")&&!customElements.get(h)&&o(h,y)&&H(h,y),Z(y),l&&y.shadowRoot&&M(y.shadowRoot)})}},M=p=>{if(!p||$.has(p))return;E(p);let y=new MutationObserver(h=>{for(let v of h)v.addedNodes?.forEach(B=>{E(B)}),v.type==="attributes"&&v.target&&E(v.target)});y.observe(p,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[i,...u.map(h=>h.selector).filter(h=>h.startsWith("data-"))]}),$.set(p,y)};async function z(){if(clearTimeout(A),A=0,!m.size)return;let p=Array.from(m);m.clear(),p.forEach(y=>w.add(y));try{let y=h=>g.get(h)??(n?n(h):`${h}.js`);await Gt(...p,{baseURL:s,mapper:y,onError:(h,v)=>{x.add(h),r?.(h,v)}})}catch{}finally{p.forEach(y=>w.delete(y))}}let _=a===document?document.documentElement:a,R=new MutationObserver(p=>{for(let y of p)y.addedNodes?.forEach(h=>{E(h)}),y.type==="attributes"&&y.target&&E(y.target)});if(R.observe(_,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[i,...u.map(p=>p.selector).filter(p=>p.startsWith("data-"))]}),l&&f&&Element.prototype.attachShadow){let p=Element.prototype.attachShadow;Element.prototype.attachShadow=function(h){let v=p.call(this,h);if(h&&h.mode==="open"){M(v);let B=this.tagName?.toLowerCase();B&&B.includes("-")&&!customElements.get(B)&&H(B,this)}return v},L=()=>Element.prototype.attachShadow=p}return c&&E(_),{stop(){D=!0,R.disconnect(),L&&L(),A&&(clearTimeout(A),A=0),$.forEach(p=>p.disconnect())},flush:z}}static async define(...e){let s={};e.length&&typeof e[e.length-1]=="object"&&(s=e.pop()||{});let n=e,{baseURL:r,mapper:o=l=>`${l}.js`,onError:i=(l,u)=>console.error(`[defineWebComponents] ${l}:`,u)}=s,a=r?new URL(r,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),c=l=>l.toLowerCase().replace(/(^|-)([a-z])/g,(u,f,m)=>m.toUpperCase()),d=async l=>{try{if(customElements.get(l))return{tag:l,status:"already-defined"};let u=o(l),m=await import(u instanceof URL?u.href:new URL(u,a).href),w=m?.default??m?.[c(l)];if(!w){if(customElements.get(l))return{tag:l,status:"self-defined"};throw new Error(`No export found for ${l}. Expected default export or named export "${c(l)}".`)}return customElements.get(l)?{tag:l,status:"race-already-defined"}:(customElements.define(l,w),{tag:l,status:"defined"})}catch(u){throw i(l,u),u}};return Promise.all(n.map(d))}}});var me=class{constructor(){this._mode="static",this._staticPaths={tokens:"/assets/pds/styles/pds-tokens.css.js",primitives:"/assets/pds/styles/pds-primitives.css.js",components:"/assets/pds/styles/pds-components.css.js",utilities:"/assets/pds/styles/pds-utilities.css.js",styles:"/assets/pds/styles/pds-styles.css.js"}}setLiveMode(){this._mode="live"}setStaticMode(e={}){this._mode="static",this._staticPaths={...this._staticPaths,...e},console.log("[PDS Registry] Switched to STATIC mode",this._staticPaths)}async getStylesheet(e){if(this._mode==="live")return null;try{return(await import(this._staticPaths[e]))[e]}catch(s){console.error(`[PDS Registry] Failed to load static ${e}:`,s),console.error(`[PDS Registry] Looking for: ${this._staticPaths[e]}`),console.error("[PDS Registry] Make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let n=new CSSStyleSheet;return n.replaceSync("/* Failed to load "+e+" */"),n}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},F=new me;async function Ue(t,e=[],s=null){try{let n=s?.primitivesStylesheet?s.primitivesStylesheet:await F.getStylesheet("primitives");t.adoptedStyleSheets=[n,...e]}catch(n){let r=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${r}> failed to adopt primitives:`,n),t.adoptedStyleSheets=e}}async function Oe(t,e=["primitives"],s=[],n=null){try{let o=(await Promise.all(e.map(async i=>{if(n)switch(i){case"tokens":return n.tokensStylesheet;case"primitives":return n.primitivesStylesheet;case"components":return n.componentsStylesheet;case"utilities":return n.utilitiesStylesheet;default:break}return F.getStylesheet(i)}))).filter(i=>i!==null);t.adoptedStyleSheets=[...o,...s]}catch(r){let o=t.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${o}> failed to adopt layers:`,r),t.adoptedStyleSheets=s}}function Ne(t){let e=new CSSStyleSheet;return e.replaceSync(t),e}var ae=globalThis,le=ae.ShadowRoot&&(ae.ShadyCSS===void 0||ae.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,qe=Symbol(),je=new WeakMap,ce=class{constructor(e,s,n){if(this._$cssResult$=!0,n!==qe)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=s}get styleSheet(){let e=this.o,s=this.t;if(le&&e===void 0){let n=s!==void 0&&s.length===1;n&&(e=je.get(s)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&je.set(s,e))}return e}toString(){return this.cssText}},Ie=t=>new ce(typeof t=="string"?t:t+"",void 0,qe);var He=(t,e)=>{if(le)t.adoptedStyleSheets=e.map(s=>s instanceof CSSStyleSheet?s:s.styleSheet);else for(let s of e){let n=document.createElement("style"),r=ae.litNonce;r!==void 0&&n.setAttribute("nonce",r),n.textContent=s.cssText,t.appendChild(n)}},ye=le?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let s="";for(let n of e.cssRules)s+=n.cssText;return Ie(s)})(t):t;var{is:St,defineProperty:$t,getOwnPropertyDescriptor:_t,getOwnPropertyNames:At,getOwnPropertySymbols:Et,getPrototypeOf:vt}=Object,de=globalThis,ze=de.trustedTypes,Lt=ze?ze.emptyScript:"",Ct=de.reactiveElementPolyfillSupport,J=(t,e)=>t,ge={toAttribute(t,e){switch(e){case Boolean:t=t?Lt:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let s=t;switch(e){case Boolean:s=t!==null;break;case Number:s=t===null?null:Number(t);break;case Object:case Array:try{s=JSON.parse(t)}catch{s=null}}return s}},Fe=(t,e)=>!St(t,e),Be={attribute:!0,type:String,converter:ge,reflect:!1,useDefault:!1,hasChanged:Fe};Symbol.metadata??=Symbol("metadata"),de.litPropertyMetadata??=new WeakMap;var P=class extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,s=Be){if(s.state&&(s.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((s=Object.create(s)).wrapped=!0),this.elementProperties.set(e,s),!s.noAccessor){let n=Symbol(),r=this.getPropertyDescriptor(e,n,s);r!==void 0&&$t(this.prototype,e,r)}}static getPropertyDescriptor(e,s,n){let{get:r,set:o}=_t(this.prototype,e)??{get(){return this[s]},set(i){this[s]=i}};return{get:r,set(i){let a=r?.call(this);o?.call(this,i),this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??Be}static _$Ei(){if(this.hasOwnProperty(J("elementProperties")))return;let e=vt(this);e.finalize(),e.l!==void 0&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(J("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(J("properties"))){let s=this.properties,n=[...At(s),...Et(s)];for(let r of n)this.createProperty(r,s[r])}let e=this[Symbol.metadata];if(e!==null){let s=litPropertyMetadata.get(e);if(s!==void 0)for(let[n,r]of s)this.elementProperties.set(n,r)}this._$Eh=new Map;for(let[s,n]of this.elementProperties){let r=this._$Eu(s,n);r!==void 0&&this._$Eh.set(r,s)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let s=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let r of n)s.unshift(ye(r))}else e!==void 0&&s.push(ye(e));return s}static _$Eu(e,s){let n=s.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),this.renderRoot!==void 0&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map,s=this.constructor.elementProperties;for(let n of s.keys())this.hasOwnProperty(n)&&(e.set(n,this[n]),delete this[n]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return He(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,s,n){this._$AK(e,n)}_$ET(e,s){let n=this.constructor.elementProperties.get(e),r=this.constructor._$Eu(e,n);if(r!==void 0&&n.reflect===!0){let o=(n.converter?.toAttribute!==void 0?n.converter:ge).toAttribute(s,n.type);this._$Em=e,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(e,s){let n=this.constructor,r=n._$Eh.get(e);if(r!==void 0&&this._$Em!==r){let o=n.getPropertyOptions(r),i=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ge;this._$Em=r;let a=i.fromAttribute(s,o.type);this[r]=a??this._$Ej?.get(r)??a,this._$Em=null}}requestUpdate(e,s,n){if(e!==void 0){let r=this.constructor,o=this[e];if(n??=r.getPropertyOptions(e),!((n.hasChanged??Fe)(o,s)||n.useDefault&&n.reflect&&o===this._$Ej?.get(e)&&!this.hasAttribute(r._$Eu(e,n))))return;this.C(e,s,n)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(e,s,{useDefault:n,reflect:r,wrapped:o},i){n&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,i??s??this[e]),o!==!0||i!==void 0)||(this._$AL.has(e)||(this.hasUpdated||n||(s=void 0),this._$AL.set(e,s)),r===!0&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(s){Promise.reject(s)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[r,o]of this._$Ep)this[r]=o;this._$Ep=void 0}let n=this.constructor.elementProperties;if(n.size>0)for(let[r,o]of n){let{wrapped:i}=o,a=this[r];i!==!0||this._$AL.has(r)||a===void 0||this.C(r,void 0,o,a)}}let e=!1,s=this._$AL;try{e=this.shouldUpdate(s),e?(this.willUpdate(s),this._$EO?.forEach(n=>n.hostUpdate?.()),this.update(s)):this._$EM()}catch(n){throw e=!1,this._$EM(),n}e&&this._$AE(s)}willUpdate(e){}_$AE(e){this._$EO?.forEach(s=>s.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(s=>this._$ET(s,this[s])),this._$EM()}updated(e){}firstUpdated(e){}};P.elementStyles=[],P.shadowRootOptions={mode:"open"},P[J("elementProperties")]=new Map,P[J("finalized")]=new Map,Ct?.({ReactiveElement:P}),(de.reactiveElementVersions??=[]).push("2.1.1");var Ee=globalThis,ue=Ee.trustedTypes,We=ue?ue.createPolicy("lit-html",{createHTML:t=>t}):void 0,Qe="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,Xe="?"+k,xt=`<${Xe}>`,O=document,X=()=>O.createComment(""),Y=t=>t===null||typeof t!="object"&&typeof t!="function",ve=Array.isArray,Rt=t=>ve(t)||typeof t?.[Symbol.iterator]=="function",be=`[
2
+ \f\r]`,Q=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ke=/-->/g,Ve=/>/g,T=RegExp(`>|${be}(?:([^\\s"'>=/]+)(${be}*=${be}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Ge=/'/g,Ze=/"/g,Ye=/^(?:script|style|textarea|title)$/i,Le=t=>(e,...s)=>({_$litType$:t,strings:e,values:s}),ls=Le(1),ds=Le(2),us=Le(3),N=Symbol.for("lit-noChange"),S=Symbol.for("lit-nothing"),Je=new WeakMap,U=O.createTreeWalker(O,129);function et(t,e){if(!ve(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return We!==void 0?We.createHTML(e):e}var Pt=(t,e)=>{let s=t.length-1,n=[],r,o=e===2?"<svg>":e===3?"<math>":"",i=Q;for(let a=0;a<s;a++){let c=t[a],d,l,u=-1,f=0;for(;f<c.length&&(i.lastIndex=f,l=i.exec(c),l!==null);)f=i.lastIndex,i===Q?l[1]==="!--"?i=Ke:l[1]!==void 0?i=Ve:l[2]!==void 0?(Ye.test(l[2])&&(r=RegExp("</"+l[2],"g")),i=T):l[3]!==void 0&&(i=T):i===T?l[0]===">"?(i=r??Q,u=-1):l[1]===void 0?u=-2:(u=i.lastIndex-l[2].length,d=l[1],i=l[3]===void 0?T:l[3]==='"'?Ze:Ge):i===Ze||i===Ge?i=T:i===Ke||i===Ve?i=Q:(i=T,r=void 0);let m=i===T&&t[a+1].startsWith("/>")?" ":"";o+=i===Q?c+xt:u>=0?(n.push(d),c.slice(0,u)+Qe+c.slice(u)+k+m):c+k+(u===-2?a:m)}return[et(t,o+(t[s]||"<?>")+(e===2?"</svg>":e===3?"</math>":"")),n]},ee=class t{constructor({strings:e,_$litType$:s},n){let r;this.parts=[];let o=0,i=0,a=e.length-1,c=this.parts,[d,l]=Pt(e,s);if(this.el=t.createElement(d,n),U.currentNode=this.el.content,s===2||s===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(r=U.nextNode())!==null&&c.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let u of r.getAttributeNames())if(u.endsWith(Qe)){let f=l[i++],m=r.getAttribute(u).split(k),w=/([.?@])?(.*)/.exec(f);c.push({type:1,index:o,name:w[2],strings:m,ctor:w[1]==="."?Se:w[1]==="?"?$e:w[1]==="@"?_e:K}),r.removeAttribute(u)}else u.startsWith(k)&&(c.push({type:6,index:o}),r.removeAttribute(u));if(Ye.test(r.tagName)){let u=r.textContent.split(k),f=u.length-1;if(f>0){r.textContent=ue?ue.emptyScript:"";for(let m=0;m<f;m++)r.append(u[m],X()),U.nextNode(),c.push({type:2,index:++o});r.append(u[f],X())}}}else if(r.nodeType===8)if(r.data===Xe)c.push({type:2,index:o});else{let u=-1;for(;(u=r.data.indexOf(k,u+1))!==-1;)c.push({type:7,index:o}),u+=k.length-1}o++}}static createElement(e,s){let n=O.createElement("template");return n.innerHTML=e,n}};function W(t,e,s=t,n){if(e===N)return e;let r=n!==void 0?s._$Co?.[n]:s._$Cl,o=Y(e)?void 0:e._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(t),r._$AT(t,s,n)),n!==void 0?(s._$Co??=[])[n]=r:s._$Cl=r),r!==void 0&&(e=W(t,r._$AS(t,e.values),r,n)),e}var we=class{constructor(e,s){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=s}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:s},parts:n}=this._$AD,r=(e?.creationScope??O).importNode(s,!0);U.currentNode=r;let o=U.nextNode(),i=0,a=0,c=n[0];for(;c!==void 0;){if(i===c.index){let d;c.type===2?d=new te(o,o.nextSibling,this,e):c.type===1?d=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(d=new Ae(o,this,e)),this._$AV.push(d),c=n[++a]}i!==c?.index&&(o=U.nextNode(),i++)}return U.currentNode=O,r}p(e){let s=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,s),s+=n.strings.length-2):n._$AI(e[s])),s++}},te=class t{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,s,n,r){this.type=2,this._$AH=S,this._$AN=void 0,this._$AA=e,this._$AB=s,this._$AM=n,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,s=this._$AM;return s!==void 0&&e?.nodeType===11&&(e=s.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,s=this){e=W(this,e,s),Y(e)?e===S||e==null||e===""?(this._$AH!==S&&this._$AR(),this._$AH=S):e!==this._$AH&&e!==N&&this._(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):Rt(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==S&&Y(this._$AH)?this._$AA.nextSibling.data=e:this.T(O.createTextNode(e)),this._$AH=e}$(e){let{values:s,_$litType$:n}=e,r=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=ee.createElement(et(n.h,n.h[0]),this.options)),n);if(this._$AH?._$AD===r)this._$AH.p(s);else{let o=new we(r,this),i=o.u(this.options);o.p(s),this.T(i),this._$AH=o}}_$AC(e){let s=Je.get(e.strings);return s===void 0&&Je.set(e.strings,s=new ee(e)),s}k(e){ve(this._$AH)||(this._$AH=[],this._$AR());let s=this._$AH,n,r=0;for(let o of e)r===s.length?s.push(n=new t(this.O(X()),this.O(X()),this,this.options)):n=s[r],n._$AI(o),r++;r<s.length&&(this._$AR(n&&n._$AB.nextSibling,r),s.length=r)}_$AR(e=this._$AA.nextSibling,s){for(this._$AP?.(!1,!0,s);e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){this._$AM===void 0&&(this._$Cv=e,this._$AP?.(e))}},K=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,s,n,r,o){this.type=1,this._$AH=S,this._$AN=void 0,this.element=e,this.name=s,this._$AM=r,this.options=o,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=S}_$AI(e,s=this,n,r){let o=this.strings,i=!1;if(o===void 0)e=W(this,e,s,0),i=!Y(e)||e!==this._$AH&&e!==N,i&&(this._$AH=e);else{let a=e,c,d;for(e=o[0],c=0;c<o.length-1;c++)d=W(this,a[n+c],s,c),d===N&&(d=this._$AH[c]),i||=!Y(d)||d!==this._$AH[c],d===S?e=S:e!==S&&(e+=(d??"")+o[c+1]),this._$AH[c]=d}i&&!r&&this.j(e)}j(e){e===S?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Se=class extends K{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===S?void 0:e}},$e=class extends K{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==S)}},_e=class extends K{constructor(e,s,n,r,o){super(e,s,n,r,o),this.type=5}_$AI(e,s=this){if((e=W(this,e,s,0)??S)===N)return;let n=this._$AH,r=e===S&&n!==S||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==S&&(n===S||r);r&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}},Ae=class{constructor(e,s,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=s,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){W(this,e)}};var kt=Ee.litHtmlPolyfillSupport;kt?.(ee,te),(Ee.litHtmlVersions??=[]).push("3.3.1");var j=(t,e,s)=>{let n=s?.renderBefore??e,r=n._$litPart$;if(r===void 0){let o=s?.renderBefore??null;n._$litPart$=r=new te(e.insertBefore(X(),o),o,void 0,s??{})}return r._$AI(t),r};var Ce=globalThis,V=class extends P{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let s=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=j(s,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return N}};V._$litElement$=!0,V.finalized=!0,Ce.litElementHydrateSupport?.({LitElement:V});var Dt=Ce.litElementPolyfillSupport;Dt?.({LitElement:V});(Ce.litElementVersions??=[]).push("4.2.1");var tt={mode:"live",preset:"default",autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster"]},log(t,e,...s){console[t](e,...s)}};async function st(t,e={}){return e={...{title:"Confirm",type:"confirm",buttons:{ok:{name:"OK",primary:!0},cancel:{name:"Cancel",cancel:!0}}},...e},new Promise(n=>{let r=document.createElement("dialog");tt.options?.liquidGlassEffects&&r.classList.add("liquid-glass"),e.size&&r.classList.add(`dialog-${e.size}`),e.type&&r.classList.add(`dialog-${e.type}`),e.class&&(Array.isArray(e.class)?r.classList.add(...e.class):r.classList.add(e.class)),e.maxHeight&&r.style.setProperty("--dialog-max-height",e.maxHeight);let o=Object.entries(e.buttons).map(([a,c])=>{let d=c.primary?"btn-primary btn-sm":"btn-outline btn-sm";return`<button type="${c.cancel?"button":"submit"}" class="${d}" value="${a}">${c.name}</button>`});if(e.useForm){let a=document.createElement("div");typeof t=="object"&&t._$litType$?j(t,a):typeof t=="string"?a.textContent=t:j(t,a);let c=a.querySelector("form");if(c){r.innerHTML=`
4
4
  <header>
5
5
  <h2>${e.title}</h2>
6
6
  </header>
@@ -24,12 +24,12 @@ var yt=Object.defineProperty;var gt=(t,e)=>()=>(t&&(e=t(t=0)),e);var bt=(t,e)=>{
24
24
  ${o.join("")}
25
25
  </footer>
26
26
  </form>
27
- `;let a=r.querySelector("#msg-container");typeof t=="object"&&t._$litType$?j(t,a):typeof t=="string"?a.textContent=t:j(t,a)}r.addEventListener("click",a=>{a.target.closest('button[value="cancel"]')&&(r.close(),n(!1))});let i=()=>{let a=r.querySelector("form");a?a.addEventListener("submit",c=>{c.preventDefault();let d;e.useForm&&c.submitter.value==="ok"?(console.log("Found form:",a),console.log("Form elements:",a?Array.from(a.elements):"no form"),d=new FormData(a),console.log("FormData entries:",Array.from(d.entries()))):d=c.submitter.value==="ok",r.close(),n(d)}):requestAnimationFrame(i)};i(),r.addEventListener("close",()=>{setTimeout(()=>r.remove(),200)}),document.body.appendChild(r),typeof e.rendered=="function"&&e.rendered(r),r.showModal()})}async function Dt(){let t=document.querySelector("pds-toaster");return t||(t=document.createElement("pds-toaster"),document.body.appendChild(t),await customElements.whenDefined("pds-toaster")),t}async function C(t,e={}){return(await Dt()).toast(t,e)}C.success=async function(t,e={}){return C(t,{...e,type:"success"})};C.error=async function(t,e={}){return C(t,{...e,type:"error"})};C.warning=async function(t,e={}){return C(t,{...e,type:"warning"})};C.info=async function(t,e={}){return C(t,{...e,type:"information"})};var Mt=[{selector:".accordion"},{selector:"nav[data-dropdown]"},{selector:"label[data-toggle]"},{selector:'input[type="range"]'},{selector:"form[data-required]"},{selector:"fieldset[role=group][data-open]"},{selector:"button, a[class*='btn-']"}];function Tt(t){t.dataset.enhancedAccordion||(t.dataset.enhancedAccordion="true",t.addEventListener("toggle",e=>{e.target.open&&e.target.parentElement===t&&t.querySelectorAll(":scope > details[open]").forEach(s=>{s!==e.target&&(s.open=!1)})},!0))}function Ut(t){if(t.dataset.enhancedDropdown)return;t.dataset.enhancedDropdown="true";let e=t.querySelector("menu");if(!e)return;let s=t.querySelector("[data-dropdown-toggle]")||t.querySelector("button");s&&!s.hasAttribute("type")&&s.setAttribute("type","button"),e.id||(e.id=`dropdown-${Math.random().toString(36).slice(2,9)}`),e.setAttribute("role",e.getAttribute("role")||"menu"),e.hasAttribute("aria-hidden")||e.setAttribute("aria-hidden","true"),s&&(s.setAttribute("aria-haspopup","true"),s.setAttribute("aria-controls",e.id),s.setAttribute("aria-expanded","false"));let n=()=>{let a=(t.getAttribute("data-mode")||"auto").toLowerCase();if(a==="up"||a==="down")return a;let c=t.getBoundingClientRect(),d=Math.max(0,window.innerHeight-c.bottom);return Math.max(0,c.top)>d?"up":"down"},r=()=>{t.dataset.dropdownDirection=n(),e.setAttribute("aria-hidden","false"),s?.setAttribute("aria-expanded","true")},o=()=>{e.setAttribute("aria-hidden","true"),s?.setAttribute("aria-expanded","false")},i=()=>{e.getAttribute("aria-hidden")==="false"?o():r()};s?.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),i()}),document.addEventListener("click",a=>{t.contains(a.target)||o()}),t.addEventListener("keydown",a=>{a.key==="Escape"&&(o(),s?.focus())}),t.addEventListener("focusout",a=>{(!a.relatedTarget||!t.contains(a.relatedTarget))&&o()})}function Ot(t){if(t.dataset.enhancedToggle)return;t.dataset.enhancedToggle="true";let e=t.querySelector('input[type="checkbox"]');if(!e)return;t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.setAttribute("role","switch"),t.setAttribute("aria-checked",e.checked?"true":"false");let s=document.createElement("span");s.className="toggle-switch",s.setAttribute("role","presentation"),s.setAttribute("aria-hidden","true");let n=document.createElement("span");n.className="toggle-knob",s.appendChild(n),t.insertBefore(s,e.nextSibling);let r=()=>{t.setAttribute("aria-checked",e.checked?"true":"false")},o=()=>{e.disabled||(e.checked=!e.checked,r(),e.dispatchEvent(new Event("change",{bubbles:!0})))};t.addEventListener("click",i=>{i.preventDefault(),o()}),t.addEventListener("keydown",i=>{(i.key===" "||i.key==="Enter")&&(i.preventDefault(),o())}),e.addEventListener("change",r)}function Nt(t){if(t.dataset.enhancedRange)return;let e=t.closest("label"),s=e?.classList.contains("range-output"),n=t.id||`range-${Math.random().toString(36).substring(2,11)}`,r=`${n}-output`;if(t.id=n,s){let o=e.querySelector("span");if(o&&!o.classList.contains("range-output-wrapper")){let i=document.createElement("span");i.className="range-output-wrapper",i.style.display="flex",i.style.justifyContent="space-between",i.style.alignItems="center";let a=document.createElement("span");a.textContent=o.textContent,i.appendChild(a);let c=document.createElement("output");c.id=r,c.setAttribute("for",n),c.style.color="var(--surface-text-secondary, var(--color-text-secondary))",c.style.fontSize="0.875rem",c.textContent=t.value,i.appendChild(c),o.textContent="",o.appendChild(i);let d=()=>{c.textContent=t.value};t.addEventListener("input",d)}}else{let o=t.closest(".range-container");o||(o=document.createElement("div"),o.className="range-container",t.parentNode?.insertBefore(o,t),o.appendChild(t)),o.style.position="relative";let i=document.createElement("output");i.id=r,i.setAttribute("for",n),i.className="range-bubble",i.setAttribute("aria-live","polite"),o.appendChild(i);let a=()=>{let l=parseFloat(t.min)||0,u=parseFloat(t.max)||100,f=parseFloat(t.value),m=(f-l)/(u-l);i.style.left=`calc(${m*100}% )`,i.textContent=String(f)},c=()=>i.classList.add("visible"),d=()=>i.classList.remove("visible");t.addEventListener("input",a),t.addEventListener("pointerdown",c),t.addEventListener("pointerup",d),t.addEventListener("pointerleave",d),t.addEventListener("focus",c),t.addEventListener("blur",d),a()}t.dataset.enhancedRange="1"}function jt(t){if(t.dataset.enhancedRequired)return;t.dataset.enhancedRequired="true";let e=s=>{let n=s.closest("label");if(!n||n.querySelector(".required-asterisk"))return;let r=document.createElement("span");r.classList.add("required-asterisk"),r.textContent="*",r.style.marginLeft="4px",n.querySelector("span").appendChild(r);let o=s.closest("form");if(o&&!o.querySelector(".required-legend")){let i=document.createElement("small");i.classList.add("required-legend"),i.textContent="* Required fields",o.insertBefore(i,o.querySelector(".form-actions")||o.lastElementChild)}};t.querySelectorAll("[required]").forEach(s=>{e(s)})}function qt(t){if(t.dataset.enhancedOpenGroup)return;t.dataset.enhancedOpenGroup="true",t.classList.add("flex","flex-wrap","buttons");let e=document.createElement("input");e.type="text",e.placeholder="Add item...",e.classList.add("input-text","input-sm"),e.style.width="auto";let s=t.querySelector('input[type="radio"], input[type="checkbox"]');t.appendChild(e),e.addEventListener("keydown",n=>{if(n.key==="Enter"||n.key==="Tab"){let r=e.value.trim();if(r){n.preventDefault();let o=s.type==="radio"?"radio":"checkbox",i=`open-group-${Math.random().toString(36).substring(2,11)}`,a=document.createElement("label"),c=document.createElement("span");c.setAttribute("data-label",""),c.textContent=r;let d=document.createElement("input");d.type=o,d.name=s.name||t.getAttribute("data-name")||"open-group",d.value=r,d.id=i,a.appendChild(c),a.appendChild(d),t.insertBefore(a,e),e.value=""}}else if(n.key==="Backspace"&&e.value===""){n.preventDefault();let r=t.querySelectorAll("label");r.length>0&&r[r.length-1].remove()}})}function Ht(t){if(t.dataset.enhancedBtnWorking)return;t.dataset.enhancedBtnWorking="true";let e=null,s=!1;new MutationObserver(r=>{r.forEach(o=>{if(o.attributeName==="class"){let i=t.classList.contains("btn-working"),a=t.querySelector("pds-icon");if(i)if(a)e||(e=a.getAttribute("icon")),a.setAttribute("icon","circle-notch");else{let c=document.createElement("pds-icon");c.setAttribute("icon","circle-notch"),c.setAttribute("size","sm"),t.insertBefore(c,t.firstChild),s=!0}else o.oldValue?.includes("btn-working")&&a&&(s?(a.remove(),s=!1):e&&(a.setAttribute("icon",e),e=null))}})}).observe(t,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0})}var It=new Map([[".accordion",Tt],["nav[data-dropdown]",Ut],["label[data-toggle]",Ot],['input[type="range"]',Nt],["form[data-required]",jt],["fieldset[role=group][data-open]",qt],["button, a[class*='btn-']",Ht]]),xe=Mt.map(t=>({...t,run:It.get(t.selector)||(()=>{})}));var rt="pds",zt=/^([a-z][a-z0-9+\-.]*:)?\/\//i,nt=/^[a-z]:/i;function se(t=""){return t.endsWith("/")?t:`${t}/`}function Bt(t="",e=rt){let s=t.replace(/\/+$/,"");return new RegExp(`(?:^|/)${e}$`,"i").test(s)?s:`${s}/${e}`}function Ft(t){return t.replace(/^\.\/+/,"")}function Wt(t){return nt.test(t)?t.replace(nt,"").replace(/^\/+/,""):t}function Vt(t){return t.startsWith("public/")?t.substring(7):t}function Re(t,e={}){let s=e.segment||rt,n=e.defaultRoot||`/assets/${s}/`,r=t?.public&&t.public?.root||t?.static&&t.static?.root||null;if(!r||typeof r!="string")return se(n);let o=r.trim();return o?(o=o.replace(/\\/g,"/"),o=Bt(o,s),o=se(o),zt.test(o)?o:(o=Ft(o),o=Wt(o),o.startsWith("/")||(o=Vt(o),o.startsWith("/")||(o=`/${o}`),o=o.replace(/\/+/g,(i,a)=>a===0?i:"/")),se(o))):se(n)}var Gt=/^[a-z][a-z0-9+\-.]*:\/\//i,ne=(()=>{try{return import.meta.url}catch{return}})(),ue=t=>typeof t=="string"&&t.length&&!t.endsWith("/")?`${t}/`:t;function pe(t,e={}){if(!t||Gt.test(t))return t;let{preferModule:s=!0}=e,n=()=>{if(!ne)return null;try{return new URL(t,ne).href}catch{return null}},r=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(t,window.location.origin).href}catch{return null}};return(s?n()||r():r()||n())||t}var at=(()=>{if(ne)try{let t=new URL(ne);if(/\/public\/assets\/js\//.test(t.pathname))return new URL("../pds/",ne).href}catch{return}})(),ct=!1;function lt(t){ct||typeof document>"u"||(ct=!0,t.addEventListener("pds:ready",e=>{let s=e.detail?.mode;s&&document.documentElement.classList.add(`pds-${s}`,"pds-ready")}))}function dt(t={},e={}){if(!e||typeof e!="object")return t;let s=Array.isArray(t)?[...t]:{...t};for(let[n,r]of Object.entries(e))r&&typeof r=="object"&&!Array.isArray(r)?s[n]=dt(s[n]&&typeof s[n]=="object"?s[n]:{},r):s[n]=r;return s}function ke(t=""){return String(t).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function G(t){if(t==null)return t;if(typeof t=="function")return;if(typeof t!="object")return t;if(Array.isArray(t))return t.map(s=>G(s)).filter(s=>s!==void 0);let e={};for(let s in t)if(t.hasOwnProperty(s)){let n=t[s];if(typeof n!="function"){let r=G(n);r!==void 0&&(e[s]=r)}}return e}function ut(t={},e={},{presets:s,defaultLog:n}){let r=typeof t=="object"&&("colors"in t||"typography"in t||"spatialRhythm"in t||"shape"in t||"behavior"in t||"layout"in t||"advanced"in t||"a11y"in t||"components"in t||"icons"in t),o=t&&t.enhancers;o&&!Array.isArray(o)&&(o=Object.values(o));let i=o??e.enhancers??[],a=t&&t.preset,c=t&&t.design,d="preset"in(t||{})||"design"in(t||{})||"enhancers"in(t||{}),l,u=null;if(d){let f=String(a||"default").toLowerCase(),m=s?.[f]||Object.values(s||{}).find(R=>ke(R.name)===f||String(R.name||"").toLowerCase()===f);if(!m)throw new Error(`PDS preset not found: "${a||"default"}"`);u={id:m.id||ke(m.name),name:m.name||m.id||String(f)};let $=structuredClone(m);if(c&&typeof c=="object"){let R=G(c);$=dt($,structuredClone(R))}let{mode:x,autoDefine:g,applyGlobalStyles:w,manageTheme:H,themeStorageKey:A,preloadStyles:D,criticalLayers:L,managerURL:Z,manager:I,preset:oe,design:E,enhancers:M,log:z,...S}=t;l={...S,design:$,preset:u.name,log:z||n}}else if(r){let{log:f,...m}=t;l={design:structuredClone(m),log:f||n}}else{let f=s?.default||Object.values(s||{}).find(m=>ke(m.name)==="default");if(!f)throw new Error("PDS default preset not available");u={id:f.id||"default",name:f.name||"Default"},l={design:structuredClone(f),preset:u.name,log:n}}return{generatorConfig:l,enhancers:i,presetInfo:u}}function pt({manageTheme:t,themeStorageKey:e,applyResolvedTheme:s,setupSystemListenerIfNeeded:n}){let r="light",o=null;if(t&&typeof window<"u"){try{o=localStorage.getItem(e)||null}catch{o=null}try{s?.(o),n?.(o)}catch{}o?o==="system"?r=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":r=o:r=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:r,storedTheme:o}}function De(t,{resolvePublicAssetURL:e}){let s=!!(t?.public?.root||t?.static?.root),n=e(t);return!s&&at&&(n=at),ue(pe(n))}async function ht(t,{baseEnhancers:e=[]}={}){let{autoDefineBaseURL:s="/auto-define/",autoDefinePreload:n=[],autoDefineMapper:r=null,enhancers:o=[],autoDefineOverrides:i=null,autoDefinePreferModule:a=!0}=t,c=(()=>{let l=new Map;return(e||[]).forEach(u=>l.set(u.selector,u)),(o||[]).forEach(u=>l.set(u.selector,u)),Array.from(l.values())})(),d=null;if(typeof window<"u"&&typeof document<"u"){let l=null;try{let g=await Promise.resolve().then(()=>(it(),ot));l=g?.AutoDefiner||g?.default?.AutoDefiner||g?.default||null}catch(g){console.warn("AutoDefiner not available:",g?.message||g)}let u=g=>{switch(g){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${g}.js`}},{mapper:f,...m}=i&&typeof i=="object"?i:{},x={baseURL:s&&ue(pe(s,{preferModule:a})),predefine:n,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:c,onError:(g,w)=>{if(typeof g=="string"&&g.startsWith("pds-")){let A=["pds-form","pds-drawer"].includes(g),D=w?.message?.includes("#pds/lit")||w?.message?.includes("Failed to resolve module specifier");A&&D?console.error(`\u274C PDS component <${g}> requires Lit but #pds/lit is not in import map.
27
+ `;let a=r.querySelector("#msg-container");typeof t=="object"&&t._$litType$?j(t,a):typeof t=="string"?a.textContent=t:j(t,a)}r.addEventListener("click",a=>{a.target.closest('button[value="cancel"]')&&(r.close(),n(!1))});let i=()=>{let a=r.querySelector("form");a?a.addEventListener("submit",c=>{c.preventDefault();let d;e.useForm&&c.submitter.value==="ok"?(console.log("Found form:",a),console.log("Form elements:",a?Array.from(a.elements):"no form"),d=new FormData(a),console.log("FormData entries:",Array.from(d.entries()))):d=c.submitter.value==="ok",r.close(),n(d)}):requestAnimationFrame(i)};i(),r.addEventListener("close",()=>{setTimeout(()=>r.remove(),200)}),document.body.appendChild(r),typeof e.rendered=="function"&&e.rendered(r),r.showModal()})}async function Mt(){let t=document.querySelector("pds-toaster");return t||(t=document.createElement("pds-toaster"),document.body.appendChild(t),await customElements.whenDefined("pds-toaster")),t}async function C(t,e={}){return(await Mt()).toast(t,e)}C.success=async function(t,e={}){return C(t,{...e,type:"success"})};C.error=async function(t,e={}){return C(t,{...e,type:"error"})};C.warning=async function(t,e={}){return C(t,{...e,type:"warning"})};C.info=async function(t,e={}){return C(t,{...e,type:"information"})};var Tt=[{selector:".accordion"},{selector:"nav[data-dropdown]"},{selector:"label[data-toggle]"},{selector:'input[type="range"]'},{selector:"form[data-required]"},{selector:"fieldset[role=group][data-open]"},{selector:"button, a[class*='btn-']"}];function Ut(t){t.dataset.enhancedAccordion||(t.dataset.enhancedAccordion="true",t.addEventListener("toggle",e=>{e.target.open&&e.target.parentElement===t&&t.querySelectorAll(":scope > details[open]").forEach(s=>{s!==e.target&&(s.open=!1)})},!0))}function Ot(t){if(t.dataset.enhancedDropdown)return;t.dataset.enhancedDropdown="true";let e=t.querySelector("menu");if(!e)return;let s=t.querySelector("[data-dropdown-toggle]")||t.querySelector("button");s&&!s.hasAttribute("type")&&s.setAttribute("type","button"),e.id||(e.id=`dropdown-${Math.random().toString(36).slice(2,9)}`),e.setAttribute("role",e.getAttribute("role")||"menu"),e.hasAttribute("aria-hidden")||e.setAttribute("aria-hidden","true"),s&&(s.setAttribute("aria-haspopup","true"),s.setAttribute("aria-controls",e.id),s.setAttribute("aria-expanded","false"));let n=()=>{let a=(t.getAttribute("data-mode")||"auto").toLowerCase();if(a==="up"||a==="down")return a;let c=t.getBoundingClientRect(),d=Math.max(0,window.innerHeight-c.bottom);return Math.max(0,c.top)>d?"up":"down"},r=()=>{t.dataset.dropdownDirection=n(),e.setAttribute("aria-hidden","false"),s?.setAttribute("aria-expanded","true")},o=()=>{e.setAttribute("aria-hidden","true"),s?.setAttribute("aria-expanded","false")},i=()=>{e.getAttribute("aria-hidden")==="false"?o():r()};s?.addEventListener("click",a=>{a.preventDefault(),a.stopPropagation(),i()}),document.addEventListener("click",a=>{t.contains(a.target)||o()}),t.addEventListener("keydown",a=>{a.key==="Escape"&&(o(),s?.focus())}),t.addEventListener("focusout",a=>{(!a.relatedTarget||!t.contains(a.relatedTarget))&&o()})}function Nt(t){if(t.dataset.enhancedToggle)return;t.dataset.enhancedToggle="true";let e=t.querySelector('input[type="checkbox"]');if(!e)return;t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.setAttribute("role","switch"),t.setAttribute("aria-checked",e.checked?"true":"false");let s=document.createElement("span");s.className="toggle-switch",s.setAttribute("role","presentation"),s.setAttribute("aria-hidden","true");let n=document.createElement("span");n.className="toggle-knob",s.appendChild(n),t.insertBefore(s,e.nextSibling);let r=()=>{t.setAttribute("aria-checked",e.checked?"true":"false")},o=()=>{e.disabled||(e.checked=!e.checked,r(),e.dispatchEvent(new Event("change",{bubbles:!0})))};t.addEventListener("click",i=>{i.preventDefault(),o()}),t.addEventListener("keydown",i=>{(i.key===" "||i.key==="Enter")&&(i.preventDefault(),o())}),e.addEventListener("change",r)}function jt(t){if(t.dataset.enhancedRange)return;let e=t.closest("label"),s=e?.classList.contains("range-output"),n=t.id||`range-${Math.random().toString(36).substring(2,11)}`,r=`${n}-output`;if(t.id=n,s){let o=e.querySelector("span");if(o&&!o.classList.contains("range-output-wrapper")){let i=document.createElement("span");i.className="range-output-wrapper",i.style.display="flex",i.style.justifyContent="space-between",i.style.alignItems="center";let a=document.createElement("span");a.textContent=o.textContent,i.appendChild(a);let c=document.createElement("output");c.id=r,c.setAttribute("for",n),c.style.color="var(--surface-text-secondary, var(--color-text-secondary))",c.style.fontSize="0.875rem",c.textContent=t.value,i.appendChild(c),o.textContent="",o.appendChild(i);let d=()=>{c.textContent=t.value};t.addEventListener("input",d)}}else{let o=t.closest(".range-container");o||(o=document.createElement("div"),o.className="range-container",t.parentNode?.insertBefore(o,t),o.appendChild(t)),o.style.position="relative";let i=document.createElement("output");i.id=r,i.setAttribute("for",n),i.className="range-bubble",i.setAttribute("aria-live","polite"),o.appendChild(i);let a=()=>{let l=parseFloat(t.min)||0,u=parseFloat(t.max)||100,f=parseFloat(t.value),m=(f-l)/(u-l);i.style.left=`calc(${m*100}% )`,i.textContent=String(f)},c=()=>i.classList.add("visible"),d=()=>i.classList.remove("visible");t.addEventListener("input",a),t.addEventListener("pointerdown",c),t.addEventListener("pointerup",d),t.addEventListener("pointerleave",d),t.addEventListener("focus",c),t.addEventListener("blur",d),a()}t.dataset.enhancedRange="1"}function qt(t){if(t.dataset.enhancedRequired)return;t.dataset.enhancedRequired="true";let e=s=>{let n=s.closest("label");if(!n||n.querySelector(".required-asterisk"))return;let r=document.createElement("span");r.classList.add("required-asterisk"),r.textContent="*",r.style.marginLeft="4px",n.querySelector("span").appendChild(r);let o=s.closest("form");if(o&&!o.querySelector(".required-legend")){let i=document.createElement("small");i.classList.add("required-legend"),i.textContent="* Required fields",o.insertBefore(i,o.querySelector(".form-actions")||o.lastElementChild)}};t.querySelectorAll("[required]").forEach(s=>{e(s)})}function It(t){if(t.dataset.enhancedOpenGroup)return;t.dataset.enhancedOpenGroup="true",t.classList.add("flex","flex-wrap","buttons");let e=document.createElement("input");e.type="text",e.placeholder="Add item...",e.classList.add("input-text","input-sm"),e.style.width="auto";let s=t.querySelector('input[type="radio"], input[type="checkbox"]');t.appendChild(e),e.addEventListener("keydown",n=>{if(n.key==="Enter"||n.key==="Tab"){let r=e.value.trim();if(r){n.preventDefault();let o=s.type==="radio"?"radio":"checkbox",i=`open-group-${Math.random().toString(36).substring(2,11)}`,a=document.createElement("label"),c=document.createElement("span");c.setAttribute("data-label",""),c.textContent=r;let d=document.createElement("input");d.type=o,d.name=s.name||t.getAttribute("data-name")||"open-group",d.value=r,d.id=i,a.appendChild(c),a.appendChild(d),t.insertBefore(a,e),e.value=""}}else if(n.key==="Backspace"&&e.value===""){n.preventDefault();let r=t.querySelectorAll("label");r.length>0&&r[r.length-1].remove()}})}function Ht(t){if(t.dataset.enhancedBtnWorking)return;t.dataset.enhancedBtnWorking="true";let e=null,s=!1;new MutationObserver(r=>{r.forEach(o=>{if(o.attributeName==="class"){let i=t.classList.contains("btn-working"),a=t.querySelector("pds-icon");if(i)if(a)e||(e=a.getAttribute("icon")),a.setAttribute("icon","circle-notch");else{let c=document.createElement("pds-icon");c.setAttribute("icon","circle-notch"),c.setAttribute("size","sm"),t.insertBefore(c,t.firstChild),s=!0}else o.oldValue?.includes("btn-working")&&a&&(s?(a.remove(),s=!1):e&&(a.setAttribute("icon",e),e=null))}})}).observe(t,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0})}var zt=new Map([[".accordion",Ut],["nav[data-dropdown]",Ot],["label[data-toggle]",Nt],['input[type="range"]',jt],["form[data-required]",qt],["fieldset[role=group][data-open]",It],["button, a[class*='btn-']",Ht]]),xe=Tt.map(t=>({...t,run:zt.get(t.selector)||(()=>{})}));var rt="pds",Bt=/^([a-z][a-z0-9+\-.]*:)?\/\//i,nt=/^[a-z]:/i;function se(t=""){return t.endsWith("/")?t:`${t}/`}function Ft(t="",e=rt){let s=t.replace(/\/+$/,"");return new RegExp(`(?:^|/)${e}$`,"i").test(s)?s:`${s}/${e}`}function Wt(t){return t.replace(/^\.\/+/,"")}function Kt(t){return nt.test(t)?t.replace(nt,"").replace(/^\/+/,""):t}function Vt(t){return t.startsWith("public/")?t.substring(7):t}function Re(t,e={}){let s=e.segment||rt,n=e.defaultRoot||`/assets/${s}/`,r=t?.public&&t.public?.root||t?.static&&t.static?.root||null;if(!r||typeof r!="string")return se(n);let o=r.trim();return o?(o=o.replace(/\\/g,"/"),o=Ft(o,s),o=se(o),Bt.test(o)?o:(o=Wt(o),o=Kt(o),o.startsWith("/")||(o=Vt(o),o.startsWith("/")||(o=`/${o}`),o=o.replace(/\/+/g,(i,a)=>a===0?i:"/")),se(o))):se(n)}var Zt=/^[a-z][a-z0-9+\-.]*:\/\//i,ne=(()=>{try{return import.meta.url}catch{return}})(),pe=t=>typeof t=="string"&&t.length&&!t.endsWith("/")?`${t}/`:t;function he(t,e={}){if(!t||Zt.test(t))return t;let{preferModule:s=!0}=e,n=()=>{if(!ne)return null;try{return new URL(t,ne).href}catch{return null}},r=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(t,window.location.origin).href}catch{return null}};return(s?n()||r():r()||n())||t}var at=(()=>{if(ne)try{let t=new URL(ne);if(/\/public\/assets\/js\//.test(t.pathname))return new URL("../pds/",ne).href}catch{return}})(),ct=!1;function lt(t){ct||typeof document>"u"||(ct=!0,t.addEventListener("pds:ready",e=>{let s=e.detail?.mode;s&&document.documentElement.classList.add(`pds-${s}`,"pds-ready")}))}function dt(t={},e={}){if(!e||typeof e!="object")return t;let s=Array.isArray(t)?[...t]:{...t};for(let[n,r]of Object.entries(e))r&&typeof r=="object"&&!Array.isArray(r)?s[n]=dt(s[n]&&typeof s[n]=="object"?s[n]:{},r):s[n]=r;return s}function ke(t=""){return String(t).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"")}function G(t){if(t==null)return t;if(typeof t=="function")return;if(typeof t!="object")return t;if(Array.isArray(t))return t.map(s=>G(s)).filter(s=>s!==void 0);let e={};for(let s in t)if(t.hasOwnProperty(s)){let n=t[s];if(typeof n!="function"){let r=G(n);r!==void 0&&(e[s]=r)}}return e}function ut(t={},e={},{presets:s,defaultLog:n}){let r=typeof t=="object"&&("colors"in t||"typography"in t||"spatialRhythm"in t||"shape"in t||"behavior"in t||"layout"in t||"advanced"in t||"a11y"in t||"components"in t||"icons"in t),o=t&&t.enhancers;o&&!Array.isArray(o)&&(o=Object.values(o));let i=o??e.enhancers??[],a=t&&t.preset,c=t&&t.design,d="preset"in(t||{})||"design"in(t||{})||"enhancers"in(t||{}),l,u=null;if(d){let f=String(a||"default").toLowerCase(),m=s?.[f]||Object.values(s||{}).find(R=>ke(R.name)===f||String(R.name||"").toLowerCase()===f);if(!m)throw new Error(`PDS preset not found: "${a||"default"}"`);u={id:m.id||ke(m.name),name:m.name||m.id||String(f)};let w=structuredClone(m);if(c&&typeof c=="object"){let R=G(c);w=dt(w,structuredClone(R))}let{mode:x,autoDefine:g,applyGlobalStyles:$,manageTheme:I,themeStorageKey:A,preloadStyles:D,criticalLayers:L,managerURL:Z,manager:H,preset:ie,design:E,enhancers:M,log:z,..._}=t;l={..._,design:w,preset:u.name,log:z||n}}else if(r){let{log:f,...m}=t;l={design:structuredClone(m),log:f||n}}else{let f=s?.default||Object.values(s||{}).find(m=>ke(m.name)==="default");if(!f)throw new Error("PDS default preset not available");u={id:f.id||"default",name:f.name||"Default"},l={design:structuredClone(f),preset:u.name,log:n}}return{generatorConfig:l,enhancers:i,presetInfo:u}}function pt({manageTheme:t,themeStorageKey:e,applyResolvedTheme:s,setupSystemListenerIfNeeded:n}){let r="light",o=null;if(t&&typeof window<"u"){try{o=localStorage.getItem(e)||null}catch{o=null}try{s?.(o),n?.(o)}catch{}o?o==="system"?r=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":r=o:r=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:r,storedTheme:o}}function ht({PDS:t,defaultStorageKey:e="pure-ds-theme",setupSystemListenerIfNeeded:s,onApply:n}={}){return async function(o,i={}){let{storageKey:a=e,persist:c=!0}=i;if(!["light","dark","system"].includes(o))throw new Error(`Invalid theme "${o}". Must be "light", "dark", or "system".`);if(typeof window>"u")return o==="system"?"light":o;let d=o;if(o==="system"&&(d=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),document.documentElement.setAttribute("data-theme",d),c)try{localStorage.setItem(a,o)}catch{}try{s?.(o)}catch{}typeof n=="function"&&await n({theme:o,resolvedTheme:d});try{t?.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:d,requested:o,source:"programmatic"}}))}catch{}return d}}function De(t,{resolvePublicAssetURL:e}){let s=!!(t?.public?.root||t?.static?.root),n=e(t);return!s&&at&&(n=at),pe(he(n))}async function ft(t,{baseEnhancers:e=[]}={}){let{autoDefineBaseURL:s="/auto-define/",autoDefinePreload:n=[],autoDefineMapper:r=null,enhancers:o=[],autoDefineOverrides:i=null,autoDefinePreferModule:a=!0}=t,c=(()=>{let l=new Map;return(e||[]).forEach(u=>l.set(u.selector,u)),(o||[]).forEach(u=>l.set(u.selector,u)),Array.from(l.values())})(),d=null;if(typeof window<"u"&&typeof document<"u"){let l=null;try{let g=await Promise.resolve().then(()=>(it(),ot));l=g?.AutoDefiner||g?.default?.AutoDefiner||g?.default||null}catch(g){console.warn("AutoDefiner not available:",g?.message||g)}let u=g=>{switch(g){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${g}.js`}},{mapper:f,...m}=i&&typeof i=="object"?i:{},x={baseURL:s&&pe(he(s,{preferModule:a})),predefine:n,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:c,onError:(g,$)=>{if(typeof g=="string"&&g.startsWith("pds-")){let A=["pds-form","pds-drawer"].includes(g),D=$?.message?.includes("#pds/lit")||$?.message?.includes("Failed to resolve module specifier");A&&D?console.error(`\u274C PDS component <${g}> requires Lit but #pds/lit is not in import map.
28
28
  Add this to your HTML <head>:
29
29
  <script type="importmap">
30
30
  { "imports": { "#pds/lit": "./path/to/lit.js" } }
31
31
  <\/script>
32
- See: https://github.com/pure-ds/core#lit-components`):console.warn(`\u26A0\uFE0F PDS component <${g}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${g}>:`,w)},...m,mapper:g=>{if(customElements.get(g))return null;if(typeof r=="function")try{let w=r(g);return w===void 0?u(g):w}catch(w){return console.warn("Custom autoDefine.mapper error; falling back to default:",w?.message||w),u(g)}return u(g)}};l&&(d=new l(x),n.length>0&&typeof l.define=="function"&&await l.define(...n,{baseURL:s,mapper:x.mapper,onError:x.onError}))}return{autoDefiner:d,mergedEnhancers:c}}var Te=class extends EventTarget{},b=new Te;b.initializing=!1;b.currentPreset=null;var ft=(t="")=>String(t).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Zt=function(t="log",e,...s){if(this?.debug||this?.design?.debug||!1||t==="error"||t==="warn"){let r=console[t]||console.log;s.length>0?r(e,...s):r(e)}};async function Jt(t,e={}){if(e?.runtimeConfig===!1||typeof fetch!="function")return null;let s=e?.runtimeConfigURL||`${t}pds-runtime-config.json`;try{let n=await fetch(s,{cache:"no-store"});return n.ok?await n.json():null}catch{return null}}b.registry=F;b.adoptLayers=Oe;b.adoptPrimitives=Ue;b.createStylesheet=Ne;b.isLiveMode=()=>F.isLive;b.ask=st;b.toast=C;function mt(t){let e=typeof CustomEvent=="function";try{let s=e?new CustomEvent("pds:ready",{detail:t}):new Event("pds:ready");b.dispatchEvent(s)}catch{}if(typeof document<"u")if(e){let s={detail:t,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",s))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",s))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}Object.defineProperty(b,"currentConfig",{value:null,writable:!0,enumerable:!0,configurable:!1});typeof window<"u"&&(window.PDS=b);var Me="pure-ds-theme",q=null,re=null;function he(t){try{if(typeof document>"u")return;let e="light";t?t==="system"?e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e=t:e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",e)}catch{}}function fe(t){try{if(q&&re){try{typeof q.removeEventListener=="function"?q.removeEventListener("change",re):typeof q.removeListener=="function"&&q.removeListener(re)}catch{}q=null,re=null}if(t==="system"&&typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-color-scheme: dark)"),s=n=>{let r=n?.matches===void 0?e.matches:n.matches;try{let o=r?"dark":"light";document.documentElement.setAttribute("data-theme",o),b.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:o,source:"system"}}))}catch{}};q=e,re=s,typeof e.addEventListener=="function"?e.addEventListener("change",s):typeof e.addListener=="function"&&e.addListener(s)}}catch{}}Object.defineProperty(b,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(Me)||null}catch{return null}},set(t){try{if(typeof window>"u")return;t==null?localStorage.removeItem(Me):localStorage.setItem(Me,t),he(t),fe(t),b.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:t,source:"api"}}))}catch{}}});b._applyResolvedTheme=he;b._setupSystemListenerIfNeeded=fe;b.defaultEnhancers=xe;async function Qt(t){let e=t&&t.mode||"live",{mode:s,...n}=t||{};if(e==="static")return Xt(n);let r=De(n,{resolvePublicAssetURL:Re}),o=n?.managerURL||n?.public?.managerURL||n?.manager?.url||new URL("core/pds-manager.js",r).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:i}=await import(o);return i(b,n,{emitReady:mt,applyResolvedTheme:he,setupSystemListenerIfNeeded:fe})}b.start=Qt;async function Xt(t){if(!t||typeof t!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let e=t.applyGlobalStyles??!0,s=t.manageTheme??!0,n=t.themeStorageKey??"pure-ds-theme",r=t.staticPaths??{},o=De(t,{resolvePublicAssetURL:Re}),i=t&&t.autoDefine||null,a;i&&i.baseURL?a=ue(pe(i.baseURL,{preferModule:!1})):a=`${o}components/`;let c=i&&Array.isArray(i.predefine)&&i.predefine||[],d=i&&typeof i.mapper=="function"&&i.mapper||null;try{lt(b);let{resolvedTheme:l}=pt({manageTheme:s,themeStorageKey:n,applyResolvedTheme:he,setupSystemListenerIfNeeded:fe}),u=await Jt(o,t),f=u?.config?.design||u?.design||null,m=u?.config?.preset||u?.preset||"default",$=u?.presetId||ft(m)||"default",x=f?{[String($).toLowerCase()]:f,...String($).toLowerCase()!=="default"?{default:f}:{}}:null,g=t?.design&&typeof t.design=="object"?G(t.design):null,w=ft(t?.preset||"default")||"default",H=g?{[String(w).toLowerCase()]:g,...String(w).toLowerCase()!=="default"?{default:g}:{}}:null,A=x||t?.presets||H||{};if(!Object.keys(A||{}).length)throw new Error("PDS static mode requires preset data. Run pds:build or provide config.presets/config.design.");let D=u?.config?{...u.config,...t,preset:t?.preset||$,design:g||f||u?.config?.design}:t,L=ut(D,{},{presets:A,defaultLog:Zt}),Z=L.enhancers,I={tokens:`${o}styles/pds-tokens.css.js`,primitives:`${o}styles/pds-primitives.css.js`,components:`${o}styles/pds-components.css.js`,utilities:`${o}styles/pds-utilities.css.js`,styles:`${o}styles/pds-styles.css.js`},oe=u?.paths||{};if(r={...I,...oe,...r},b.registry.setStaticMode(r),e&&typeof document<"u")try{let S=await b.registry.getStylesheet("styles");if(S){S._pds=!0;let R=(document.adoptedStyleSheets||[]).filter(p=>p._pds!==!0);document.adoptedStyleSheets=[...R,S]}}catch(S){console.warn("Failed to apply static styles:",S)}let E=null,M=[];try{let S=await ht({autoDefineBaseURL:a,autoDefinePreload:c,autoDefineMapper:d,enhancers:Z,autoDefineOverrides:i||null,autoDefinePreferModule:!(i&&i.baseURL)},{baseEnhancers:xe});E=S.autoDefiner,M=S.mergedEnhancers||[]}catch(S){console.error("\u274C Failed to initialize AutoDefiner/Enhancers (static):",S)}let z=G(t);return b.currentConfig=Object.freeze({mode:"static",...structuredClone(z),design:structuredClone(L.generatorConfig.design),preset:L.generatorConfig.preset,theme:l,enhancers:M}),mt({mode:"static",config:L.generatorConfig,theme:l,autoDefiner:E}),{config:L.generatorConfig,theme:l,autoDefiner:E}}catch(l){throw b.dispatchEvent(new CustomEvent("pds:error",{detail:{error:l}})),l}}export{b as PDS};
32
+ See: https://github.com/pure-ds/core#lit-components`):console.warn(`\u26A0\uFE0F PDS component <${g}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${g}>:`,$)},...m,mapper:g=>{if(customElements.get(g))return null;if(typeof r=="function")try{let $=r(g);return $===void 0?u(g):$}catch($){return console.warn("Custom autoDefine.mapper error; falling back to default:",$?.message||$),u(g)}return u(g)}};l&&(d=new l(x),n.length>0&&typeof l.define=="function"&&await l.define(...n,{baseURL:s,mapper:x.mapper,onError:x.onError}))}return{autoDefiner:d,mergedEnhancers:c}}var Te=class extends EventTarget{},b=new Te;b.initializing=!1;b.currentPreset=null;var mt=(t="")=>String(t).toLowerCase().replace(/&/g," and ").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,""),Jt=function(t="log",e,...s){if(this?.debug||this?.design?.debug||!1||t==="error"||t==="warn"){let r=console[t]||console.log;s.length>0?r(e,...s):r(e)}};async function Qt(t,e={}){if(e?.runtimeConfig===!1||typeof fetch!="function")return null;let s=e?.runtimeConfigURL||`${t}pds-runtime-config.json`;try{let n=await fetch(s,{cache:"no-store"});return n.ok?await n.json():null}catch{return null}}b.registry=F;b.adoptLayers=Oe;b.adoptPrimitives=Ue;b.createStylesheet=Ne;b.isLiveMode=()=>F.isLive;b.ask=st;b.toast=C;function yt(t){let e=typeof CustomEvent=="function";try{let s=e?new CustomEvent("pds:ready",{detail:t}):new Event("pds:ready");b.dispatchEvent(s)}catch{}if(typeof document<"u")if(e){let s={detail:t,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",s))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",s))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}Object.defineProperty(b,"currentConfig",{value:null,writable:!0,enumerable:!0,configurable:!1});typeof window<"u"&&(window.PDS=b);var Me="pure-ds-theme",q=null,re=null;function fe(t){try{if(typeof document>"u")return;let e="light";t?t==="system"?e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":e=t:e=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",e)}catch{}}function oe(t){try{if(q&&re){try{typeof q.removeEventListener=="function"?q.removeEventListener("change",re):typeof q.removeListener=="function"&&q.removeListener(re)}catch{}q=null,re=null}if(t==="system"&&typeof window<"u"&&window.matchMedia){let e=window.matchMedia("(prefers-color-scheme: dark)"),s=n=>{let r=n?.matches===void 0?e.matches:n.matches;try{let o=r?"dark":"light";document.documentElement.setAttribute("data-theme",o),b.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:o,source:"system"}}))}catch{}};q=e,re=s,typeof e.addEventListener=="function"?e.addEventListener("change",s):typeof e.addListener=="function"&&e.addListener(s)}}catch{}}Object.defineProperty(b,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(Me)||null}catch{return null}},set(t){try{if(typeof window>"u")return;t==null?localStorage.removeItem(Me):localStorage.setItem(Me,t),fe(t),oe(t),b.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:t,source:"api"}}))}catch{}}});b._applyResolvedTheme=fe;b._setupSystemListenerIfNeeded=oe;b.defaultEnhancers=xe;async function Xt(t){let e=t&&t.mode||"live",{mode:s,...n}=t||{};if(e==="static")return Yt(n);let r=De(n,{resolvePublicAssetURL:Re}),o=n?.managerURL||n?.public?.managerURL||n?.manager?.url||new URL("core/pds-manager.js",r).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:i}=await import(o);return i(b,n,{emitReady:yt,applyResolvedTheme:fe,setupSystemListenerIfNeeded:oe})}b.start=Xt;async function Yt(t){if(!t||typeof t!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let e=t.applyGlobalStyles??!0,s=t.manageTheme??!0,n=t.themeStorageKey??"pure-ds-theme",r=t.staticPaths??{},o=De(t,{resolvePublicAssetURL:Re}),i=t&&t.autoDefine||null,a;i&&i.baseURL?a=pe(he(i.baseURL,{preferModule:!1})):a=`${o}components/`;let c=i&&Array.isArray(i.predefine)&&i.predefine||[],d=i&&typeof i.mapper=="function"&&i.mapper||null;try{lt(b);let{resolvedTheme:l}=pt({manageTheme:s,themeStorageKey:n,applyResolvedTheme:fe,setupSystemListenerIfNeeded:oe});b.setTheme=ht({PDS:b,defaultStorageKey:n,setupSystemListenerIfNeeded:oe});let u=await Qt(o,t),f=u?.config?.design||u?.design||null,m=u?.config?.preset||u?.preset||"default",w=u?.presetId||mt(m)||"default",x=f?{[String(w).toLowerCase()]:f,...String(w).toLowerCase()!=="default"?{default:f}:{}}:null,g=t?.design&&typeof t.design=="object"?G(t.design):null,$=mt(t?.preset||"default")||"default",I=g?{[String($).toLowerCase()]:g,...String($).toLowerCase()!=="default"?{default:g}:{}}:null,A=x||t?.presets||I||{};if(!Object.keys(A||{}).length)throw new Error("PDS static mode requires preset data. Run pds:build or provide config.presets/config.design.");let D=u?.config?{...u.config,...t,preset:t?.preset||w,design:g||f||u?.config?.design}:t,L=ut(D,{},{presets:A,defaultLog:Jt}),Z=L.enhancers,H={tokens:`${o}styles/pds-tokens.css.js`,primitives:`${o}styles/pds-primitives.css.js`,components:`${o}styles/pds-components.css.js`,utilities:`${o}styles/pds-utilities.css.js`,styles:`${o}styles/pds-styles.css.js`},ie=u?.paths||{};if(r={...H,...ie,...r},b.registry.setStaticMode(r),e&&typeof document<"u")try{let _=await b.registry.getStylesheet("styles");if(_){_._pds=!0;let R=(document.adoptedStyleSheets||[]).filter(p=>p._pds!==!0);document.adoptedStyleSheets=[...R,_]}}catch(_){console.warn("Failed to apply static styles:",_)}let E=null,M=[];try{let _=await ft({autoDefineBaseURL:a,autoDefinePreload:c,autoDefineMapper:d,enhancers:Z,autoDefineOverrides:i||null,autoDefinePreferModule:!(i&&i.baseURL)},{baseEnhancers:xe});E=_.autoDefiner,M=_.mergedEnhancers||[]}catch(_){console.error("\u274C Failed to initialize AutoDefiner/Enhancers (static):",_)}let z=G(t);return b.currentConfig=Object.freeze({mode:"static",...structuredClone(z),design:structuredClone(L.generatorConfig.design),preset:L.generatorConfig.preset,theme:l,enhancers:M}),yt({mode:"static",config:L.generatorConfig,theme:l,autoDefiner:E}),{config:L.generatorConfig,theme:l,autoDefiner:E}}catch(l){throw b.dispatchEvent(new CustomEvent("pds:error",{detail:{error:l}})),l}}export{b as PDS};
33
33
  /*! Bundled license information:
34
34
 
35
35
  @lit/reactive-element/css-tag.js:
@@ -13,6 +13,7 @@ import {
13
13
  ensureAbsoluteAssetURL,
14
14
  ensureTrailingSlash,
15
15
  attachFoucListener,
16
+ createSetTheme,
16
17
  normalizeInitConfig,
17
18
  resolveRuntimeAssetRoot,
18
19
  resolveThemeAndApply,
@@ -92,59 +93,25 @@ async function __attachLiveAPIs(PDS, { applyResolvedTheme, setupSystemListenerIf
92
93
  }
93
94
 
94
95
  // Live-only setTheme helper
95
- PDS.setTheme = async function(theme, options = {}) {
96
- const { storageKey = "pure-ds-theme", persist = true } = options;
97
-
98
- if (!["light", "dark", "system"].includes(theme)) {
99
- throw new Error(
100
- `Invalid theme "${theme}". Must be "light", "dark", or "system".`
101
- );
102
- }
103
-
104
- if (typeof window === "undefined") {
105
- return theme === "system" ? "light" : theme;
106
- }
107
-
108
- let resolvedTheme = theme;
109
-
110
- if (theme === "system") {
111
- const prefersDark =
112
- window.matchMedia &&
113
- window.matchMedia("(prefers-color-scheme: dark)").matches;
114
- resolvedTheme = prefersDark ? "dark" : "light";
115
- }
116
-
117
- document.documentElement.setAttribute("data-theme", resolvedTheme);
118
-
119
- if (persist) {
120
- localStorage.setItem(storageKey, theme);
121
- }
122
-
123
- if (PDS.registry.isLive && Generator.instance) {
124
- try {
125
- const currentGenerator = Generator.instance;
126
- if (currentGenerator && currentGenerator.configure) {
127
- const newConfig = { ...currentGenerator.config, theme: resolvedTheme };
128
- currentGenerator.configure(newConfig);
129
- await applyStyles(Generator.instance);
96
+ PDS.setTheme = createSetTheme({
97
+ PDS,
98
+ defaultStorageKey: "pure-ds-theme",
99
+ setupSystemListenerIfNeeded,
100
+ onApply: async ({ resolvedTheme }) => {
101
+ if (PDS.registry.isLive && Generator.instance) {
102
+ try {
103
+ const currentGenerator = Generator.instance;
104
+ if (currentGenerator && currentGenerator.configure) {
105
+ const newConfig = { ...currentGenerator.config, theme: resolvedTheme };
106
+ currentGenerator.configure(newConfig);
107
+ await applyStyles(Generator.instance);
108
+ }
109
+ } catch (error) {
110
+ console.warn("Failed to update styles for new theme:", error);
130
111
  }
131
- } catch (error) {
132
- console.warn("Failed to update styles for new theme:", error);
133
112
  }
134
- }
135
-
136
- PDS.dispatchEvent(
137
- new CustomEvent("pds:theme:changed", {
138
- detail: {
139
- theme: resolvedTheme,
140
- requested: theme,
141
- source: "programmatic",
142
- },
143
- })
144
- );
145
-
146
- return resolvedTheme;
147
- };
113
+ },
114
+ });
148
115
 
149
116
  // Live-only preload helper
150
117
  PDS.preloadCritical = function(config, options = {}) {
@@ -272,6 +272,66 @@ export function resolveThemeAndApply({ manageTheme, themeStorageKey, applyResolv
272
272
  return { resolvedTheme, storedTheme };
273
273
  }
274
274
 
275
+ // Internal: create a reusable setTheme helper for live/static modes
276
+ export function createSetTheme({
277
+ PDS,
278
+ defaultStorageKey = "pure-ds-theme",
279
+ setupSystemListenerIfNeeded,
280
+ onApply,
281
+ } = {}) {
282
+ return async function setTheme(theme, options = {}) {
283
+ const { storageKey = defaultStorageKey, persist = true } = options;
284
+
285
+ if (!["light", "dark", "system"].includes(theme)) {
286
+ throw new Error(
287
+ `Invalid theme "${theme}". Must be "light", "dark", or "system".`
288
+ );
289
+ }
290
+
291
+ if (typeof window === "undefined") {
292
+ return theme === "system" ? "light" : theme;
293
+ }
294
+
295
+ let resolvedTheme = theme;
296
+ if (theme === "system") {
297
+ const prefersDark =
298
+ window.matchMedia &&
299
+ window.matchMedia("(prefers-color-scheme: dark)").matches;
300
+ resolvedTheme = prefersDark ? "dark" : "light";
301
+ }
302
+
303
+ document.documentElement.setAttribute("data-theme", resolvedTheme);
304
+
305
+ if (persist) {
306
+ try {
307
+ localStorage.setItem(storageKey, theme);
308
+ } catch (e) {}
309
+ }
310
+
311
+ try {
312
+ setupSystemListenerIfNeeded?.(theme);
313
+ } catch (e) {}
314
+
315
+ if (typeof onApply === "function") {
316
+ await onApply({ theme, resolvedTheme });
317
+ }
318
+
319
+ try {
320
+ PDS?.dispatchEvent(
321
+ new CustomEvent("pds:theme:changed", {
322
+ detail: {
323
+ theme: resolvedTheme,
324
+ requested: theme,
325
+ source: "programmatic",
326
+ },
327
+ })
328
+ );
329
+ } catch (e) {}
330
+
331
+ return resolvedTheme;
332
+ };
333
+ }
334
+
275
335
  export function resolveRuntimeAssetRoot(config, { resolvePublicAssetURL }) {
276
336
  const hasCustomRoot = Boolean(config?.public?.root || config?.static?.root);
277
337
  let candidate = resolvePublicAssetURL(config);
package/src/js/pds.js CHANGED
@@ -57,6 +57,7 @@ import {
57
57
  ensureAbsoluteAssetURL,
58
58
  ensureTrailingSlash,
59
59
  attachFoucListener,
60
+ createSetTheme,
60
61
  normalizeInitConfig,
61
62
  resolveRuntimeAssetRoot,
62
63
  resolveThemeAndApply,
@@ -409,6 +410,13 @@ async function staticInit(config) {
409
410
  setupSystemListenerIfNeeded: __setupSystemListenerIfNeeded,
410
411
  });
411
412
 
413
+ // 1b) Static-mode setTheme helper (live mode overrides this later)
414
+ PDS.setTheme = createSetTheme({
415
+ PDS,
416
+ defaultStorageKey: themeStorageKey,
417
+ setupSystemListenerIfNeeded: __setupSystemListenerIfNeeded,
418
+ });
419
+
412
420
  // Normalize first-arg to allow { preset, design, enhancers }
413
421
  const runtimeConfig = await __loadRuntimeConfig(assetRootURL, config);
414
422
  const runtimeDesign =