@pure-ds/storybook 0.7.28 → 0.7.31
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/dist/pds-reference.json +1 -1
- package/package.json +2 -2
- package/public/assets/js/app.js +9 -11
- package/public/assets/js/lit.js +2 -2
- package/public/assets/js/pds-ask.js +4 -4
- package/public/assets/js/pds-localization.js +1 -0
- package/public/assets/js/pds-manager.js +136 -122
- package/public/assets/js/pds.js +2 -2
- package/public/assets/locales/nl-NL.json +8 -0
- package/public/assets/pds/components/pds-live-edit.js +462 -1
- package/public/assets/pds/core/pds-ask.js +4 -4
- package/public/assets/pds/core/pds-localization.js +1 -0
- package/public/assets/pds/core/pds-manager.js +136 -122
- package/public/assets/pds/core.js +2 -2
- package/public/assets/pds/external/lit.js +2 -2
- package/src/js/app.js +10 -10
- package/src/js/common/ask.js +5 -4
- package/src/js/common/font-loader.js +10 -8
- package/src/js/common/localization-resource-provider.js +252 -0
- package/src/js/common/localization.js +787 -0
- package/src/js/common/msg.js +9 -90
- package/src/js/common/pds-log.js +144 -0
- package/src/js/lit.js +0 -15
- package/src/js/pds-core/pds-config.js +34 -11
- package/src/js/pds-core/pds-generator.js +24 -10
- package/src/js/pds-core/pds-live.js +7 -5
- package/src/js/pds-core/pds-registry.js +6 -4
- package/src/js/pds-core/pds-runtime.js +12 -8
- package/src/js/pds-core/pds-start-helpers.js +9 -4
- package/src/js/pds-localization.js +10 -0
- package/src/js/pds-singleton.js +49 -0
- package/src/js/pds.d.ts +150 -0
- package/src/js/pds.js +355 -40
- package/stories/getting-started.md +2 -0
package/dist/pds-reference.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pure-ds/storybook",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.31",
|
|
4
4
|
"description": "Storybook showcase for Pure Design System with live configuration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"private": false,
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"pds:build-icons": "pds-build-icons"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@pure-ds/core": "^0.7.
|
|
41
|
+
"@pure-ds/core": "^0.7.31"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@custom-elements-manifest/analyzer": "^0.11.0",
|
package/public/assets/js/app.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
var $e=Object.defineProperty;var Ie=(e,t)=>{for(var s in t)$e(e,s,{get:t[s],enumerable:!0})};var J=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(t={}){this._mode="static",this._staticPaths={...this._staticPaths,...t}}async getStylesheet(t){if(this._mode==="live")return null;try{return(await import(this._staticPaths[t]))[t]}catch(s){console.error(`[PDS Registry] Failed to load static ${t}:`,s),console.error(`[PDS Registry] Looking for: ${this._staticPaths[t]}`),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 "+t+" */"),n}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},P=new J;async function me(e,t=[],s=null){try{let n=s?.primitivesStylesheet?s.primitivesStylesheet:await P.getStylesheet("primitives");e.adoptedStyleSheets=[n,...t]}catch(n){let a=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${a}> failed to adopt primitives:`,n),e.adoptedStyleSheets=t}}async function he(e,t=["primitives"],s=[],n=null){let a=Array.isArray(s)?s.filter(Boolean):[];if(a.length){let d=(Array.isArray(e.adoptedStyleSheets)?e.adoptedStyleSheets:[]).filter(y=>!a.includes(y));e.adoptedStyleSheets=[...d,...a]}try{let d=(await Promise.all(t.map(async y=>{if(n)switch(y){case"tokens":return n.tokensStylesheet;case"primitives":return n.primitivesStylesheet;case"components":return n.componentsStylesheet;case"utilities":return n.utilitiesStylesheet;default:break}return P.getStylesheet(y)}))).filter(y=>y!==null);e.adoptedStyleSheets=[...d,...a]}catch(o){let d=e.host?.tagName?.toLowerCase()||"unknown";console.error(`[PDS Adopter] <${d}> failed to adopt layers:`,o),e.adoptedStyleSheets=a}}function ye(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var be={FontWeights:{light:300,normal:400,medium:500,semibold:600,bold:700},LineHeights:{tight:1.25,normal:1.5,relaxed:1.75},BorderWidths:{hairline:.5,thin:1,medium:2,thick:3},RadiusSizes:{none:0,small:4,medium:8,large:16,xlarge:24,xxlarge:32},ShadowDepths:{none:"none",light:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",medium:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",deep:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",extreme:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},TransitionSpeeds:{fast:150,normal:250,slow:350},AnimationEasings:{linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},TouchTargetSizes:{compact:36,standard:44,comfortable:48,spacious:56},LinkStyles:{inline:"inline",block:"block",button:"button"},FocusStyles:{ring:"ring",outline:"outline",border:"border",glow:"glow"},TabSizes:{compact:2,standard:4,wide:8},SelectIcons:{chevron:"chevron",arrow:"arrow",caret:"caret",none:"none"},IconSizes:{xs:16,sm:20,md:24,lg:32,xl:48,"2xl":64,"3xl":96}};var Z={};Ie(Z,{deepMerge:()=>ge,fragmentFromTemplateLike:()=>Ne,isObject:()=>O,parseHTML:()=>X});function O(e){return e&&typeof e=="object"&&!Array.isArray(e)}function ge(e,t){let s={...e};return O(e)&&O(t)&&Object.keys(t).forEach(n=>{O(t[n])?n in e?s[n]=ge(e[n],t[n]):Object.assign(s,{[n]:t[n]}):Object.assign(s,{[n]:t[n]})}),s}function Ne(e){let t=Array.isArray(e?.strings)?e.strings:[],s=Array.isArray(e?.values)?e.values:[],n=new Set,a=[],o=/(\s)(\.[\w-]+)=\s*$/;for(let i=0;i<t.length;i+=1){let g=t[i]??"",f=g.match(o);if(f&&i<s.length){let w=f[2].slice(1),L=`pds-val-${i}`;g=g.replace(o,`$1data-pds-prop="${w}:${L}"`),n.add(i)}a.push(g),i<s.length&&!n.has(i)&&a.push(`<!--pds-val-${i}-->`)}let d=document.createElement("template");d.innerHTML=a.join("");let y=(i,g)=>{let f=i.parentNode;if(!f)return;if(g==null){f.removeChild(i);return}let E=w=>{if(w!=null){if(w instanceof Node){f.insertBefore(w,i);return}if(Array.isArray(w)){w.forEach(L=>E(L));return}f.insertBefore(document.createTextNode(String(w)),i)}};E(g),f.removeChild(i)},S=document.createTreeWalker(d.content,NodeFilter.SHOW_COMMENT),h=[];for(;S.nextNode();){let i=S.currentNode;i?.nodeValue?.startsWith("pds-val-")&&h.push(i)}return h.forEach(i=>{let g=Number(i.nodeValue.replace("pds-val-",""));y(i,s[g])}),d.content.querySelectorAll("*").forEach(i=>{let g=i.getAttribute("data-pds-prop");if(!g)return;let[f,E]=g.split(":"),w=Number(String(E).replace("pds-val-",""));f&&Number.isInteger(w)&&(i[f]=s[w]),i.removeAttribute("data-pds-prop")}),d.content}function X(e){return new DOMParser().parseFromString(e,"text/html").body.childNodes}var Se="pds",Oe=/^([a-z][a-z0-9+\-.]*:)?\/\//i,we=/^[a-z]:/i;function U(e=""){return e.endsWith("/")?e:`${e}/`}function ze(e="",t=Se){let s=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(s)?s:`${s}/${t}`}function Fe(e){return e.replace(/^\.\/+/,"")}function We(e){return we.test(e)?e.replace(we,"").replace(/^\/+/,""):e}function Be(e){return e.startsWith("public/")?e.substring(7):e}function z(e,t={}){let s=t.segment||Se,n=t.defaultRoot||`/assets/${s}/`,a=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!a||typeof a!="string")return U(n);let o=a.trim();return o?(o=o.replace(/\\/g,"/"),o=ze(o,s),o=U(o),Oe.test(o)?o:(o=Fe(o),o=We(o),o.startsWith("/")||(o=Be(o),o.startsWith("/")||(o=`/${o}`),o=o.replace(/\/+/g,(d,y)=>y===0?d:"/")),U(o))):U(n)}async function qe(...e){let t={};e.length&&typeof e[e.length-1]=="object"&&(t=e.pop()||{});let s=e,{baseURL:n,mapper:a=h=>`${h}.js`,onError:o=(h,c)=>console.error(`[defineWebComponents] ${h}:`,c)}=t,d=n?new URL(n,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),y=h=>h.toLowerCase().replace(/(^|-)([a-z])/g,(c,i,g)=>g.toUpperCase()),S=async h=>{try{if(customElements.get(h))return{tag:h,status:"already-defined"};let c=a(h),g=await import(c instanceof URL?c.href:new URL(c,d).href),f=g?.default??g?.[y(h)];if(!f){if(customElements.get(h))return{tag:h,status:"self-defined"};throw new Error(`No export found for ${h}. Expected default export or named export "${y(h)}".`)}return customElements.get(h)?{tag:h,status:"race-already-defined"}:(customElements.define(h,f),{tag:h,status:"defined"})}catch(c){throw o(h,c),c}};return Promise.all(s.map(S))}var F=class{constructor(t={}){let{baseURL:s,mapper:n,onError:a,predicate:o=()=>!0,attributeModule:d="data-module",root:y=document,scanExisting:S=!0,debounceMs:h=16,observeShadows:c=!0,enhancers:i=[],patchAttachShadow:g=!0}=t,f=new Set,E=new Set,w=new Set,L=new Map,k=new WeakMap,_=new WeakMap,m=0,b=!1,x=null,N=l=>{if(!l||!i.length)return;let u=_.get(l);u||(u=new Set,_.set(l,u));for(let p of i)if(!(!p.selector||!p.run)&&!u.has(p.selector))try{l.matches&&l.matches(p.selector)&&(p.run(l),u.add(p.selector))}catch(v){console.warn(`[AutoDefiner] Error applying enhancer for selector "${p.selector}":`,v)}},M=(l,u)=>{if(!b&&!(!l||!l.includes("-"))&&!customElements.get(l)&&!E.has(l)&&!w.has(l)){if(u&&u.getAttribute){let p=u.getAttribute(d);p&&!L.has(l)&&L.set(l,p)}f.add(l),Ce()}},Ce=()=>{m||(m=setTimeout(pe,h))},R=l=>{if(l){if(l.nodeType===1){let u=l,p=u.tagName?.toLowerCase();p&&p.includes("-")&&!customElements.get(p)&&o(p,u)&&M(p,u),N(u),c&&u.shadowRoot&&Y(u.shadowRoot)}l.querySelectorAll&&l.querySelectorAll("*").forEach(u=>{let p=u.tagName?.toLowerCase();p&&p.includes("-")&&!customElements.get(p)&&o(p,u)&&M(p,u),N(u),c&&u.shadowRoot&&Y(u.shadowRoot)})}},Y=l=>{if(!l||k.has(l))return;R(l);let u=new MutationObserver(p=>{for(let v of p)v.addedNodes?.forEach(D=>{R(D)}),v.type==="attributes"&&v.target&&R(v.target)});u.observe(l,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[d,...i.map(p=>p.selector).filter(p=>p.startsWith("data-"))]}),k.set(l,u)};async function pe(){if(clearTimeout(m),m=0,!f.size)return;let l=Array.from(f);f.clear(),l.forEach(u=>E.add(u));try{let u=p=>L.get(p)??(n?n(p):`${p}.js`);await qe(...l,{baseURL:s,mapper:u,onError:(p,v)=>{w.add(p),a?.(p,v)}})}catch{}finally{l.forEach(u=>E.delete(u))}}let ue=y===document?document.documentElement:y,fe=new MutationObserver(l=>{for(let u of l)u.addedNodes?.forEach(p=>{R(p)}),u.type==="attributes"&&u.target&&R(u.target)});if(fe.observe(ue,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[d,...i.map(l=>l.selector).filter(l=>l.startsWith("data-"))]}),c&&g&&Element.prototype.attachShadow){let l=Element.prototype.attachShadow;Element.prototype.attachShadow=function(p){let v=l.call(this,p);if(p&&p.mode==="open"){Y(v);let D=this.tagName?.toLowerCase();D&&D.includes("-")&&!customElements.get(D)&&M(D,this)}return v},x=()=>Element.prototype.attachShadow=l}return S&&R(ue),{stop(){b=!0,fe.disconnect(),x&&x(),m&&(clearTimeout(m),m=0),k.forEach(l=>l.disconnect())},flush:pe}}static async define(...t){let s={};t.length&&typeof t[t.length-1]=="object"&&(s=t.pop()||{});let n=t,{baseURL:a,mapper:o=c=>`${c}.js`,onError:d=(c,i)=>console.error(`[defineWebComponents] ${c}:`,i)}=s,y=a?new URL(a,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),S=c=>c.toLowerCase().replace(/(^|-)([a-z])/g,(i,g,f)=>f.toUpperCase()),h=async c=>{try{if(customElements.get(c))return{tag:c,status:"already-defined"};let i=o(c),f=await import(i instanceof URL?i.href:new URL(i,y).href),E=f?.default??f?.[S(c)];if(!E){if(customElements.get(c))return{tag:c,status:"self-defined"};throw new Error(`No export found for ${c}. Expected default export or named export "${S(c)}".`)}return customElements.get(c)?{tag:c,status:"race-already-defined"}:(customElements.define(c,E),{tag:c,status:"defined"})}catch(i){throw d(c,i),i}};return Promise.all(n.map(h))}};var He=/^[a-z][a-z0-9+\-.]*:\/\//i,C=(()=>{try{return import.meta.url}catch{return}})(),W=e=>typeof e=="string"&&e.length&&!e.endsWith("/")?`${e}/`:e;function B(e,t={}){if(!e||He.test(e))return e;let{preferModule:s=!0}=t,n=()=>{if(!C)return null;try{return new URL(e,C).href}catch{return null}},a=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(e,window.location.origin).href}catch{return null}};return(s?n()||a():a()||n())||e}var Ee=(()=>{if(C)try{let e=new URL(C);if(/\/public\/assets\/js\//.test(e.pathname))return new URL("../pds/",C).href}catch{return}})(),_e=!1;function Le(e){_e||typeof document>"u"||(_e=!0,e.addEventListener("pds:ready",t=>{let s=t.detail?.mode;s&&document.documentElement.classList.add(`pds-${s}`,"pds-ready")}))}function ve({manageTheme:e,themeStorageKey:t,applyResolvedTheme:s,setupSystemListenerIfNeeded:n}){let a="light",o=null;if(e&&typeof window<"u"){try{o=localStorage.getItem(t)||null}catch{o=null}try{s?.(o),n?.(o)}catch{}o?o==="system"?a=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a=o:a=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:a,storedTheme:o}}function q(e,{resolvePublicAssetURL:t}){let s=!!(e?.public?.root||e?.static?.root),n=t(e);return!s&&Ee&&(n=Ee),W(B(n))}async function Ae(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:s="/auto-define/",autoDefinePreload:n=[],autoDefineMapper:a=null,enhancers:o=[],autoDefineOverrides:d=null,autoDefinePreferModule:y=!0}=e,S=(()=>{let c=new Map;return(t||[]).forEach(i=>c.set(i.selector,i)),(o||[]).forEach(i=>c.set(i.selector,i)),Array.from(c.values())})(),h=null;if(typeof window<"u"&&typeof document<"u"){let c=F,i=m=>{switch(m){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${m}.js`}},{mapper:g,enhancers:f,...E}=d&&typeof d=="object"?d:{},w=f?Array.isArray(f)?f:typeof f=="object"?Object.values(f):[]:[],L=(()=>{let m=new Map;return(S||[]).forEach(b=>{b?.selector&&m.set(b.selector,b)}),(w||[]).forEach(b=>{if(!b?.selector)return;let x=m.get(b.selector)||null;m.set(b.selector,{...x||{},...b,run:typeof b?.run=="function"?b.run:x?.run})}),Array.from(m.values())})(),_={baseURL:s&&W(B(s,{preferModule:y})),predefine:n,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:L,onError:(m,b)=>{if(typeof m=="string"&&m.startsWith("pds-")){let N=["pds-form","pds-drawer"].includes(m),M=b?.message?.includes("#pds/lit")||b?.message?.includes("Failed to resolve module specifier");N&&M?console.error(`\u274C PDS component <${m}> requires Lit but #pds/lit is not in import map.
|
|
2
|
-
See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`):console.warn(`\u26A0\uFE0F PDS component <${m}> not found. Assets may not be installed.`)}else console.error(`\u274C Auto-define error for <${m}>:`,b)},...E,mapper:m=>{if(customElements.get(m))return null;if(typeof a=="function")try{let b=a(m);return b===void 0?i(m):b}catch(b){return console.warn("Custom autoDefine.mapper error; falling back to default:",b?.message||b),i(m)}return i(m)}};h=new c(_),n.length>0&&typeof c.define=="function"&&await c.define(...n,{baseURL:s,mapper:_.mapper,onError:_.onError})}return{autoDefiner:h,mergedEnhancers:S}}var ee=["light","dark"],te=new Set(ee);function Ve(e){let s=(Array.isArray(e?.themes)?e.themes.map(n=>String(n).toLowerCase()):ee).filter(n=>te.has(n));return s.length?s:ee}function se(e,{preferDocument:t=!0}={}){let s=String(e||"").toLowerCase();if(te.has(s))return s;if(t&&typeof document<"u"){let n=document.documentElement?.getAttribute("data-theme");if(te.has(n))return n}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function ke(e,t){let s=se(t);return Ve(e).includes(s)}var oe=class extends EventTarget{},je="__PURE_DS_PDS_SINGLETON__",ie=typeof globalThis<"u"?globalThis:window,ne=ie?.[je],r=ne&&typeof ne.addEventListener=="function"?ne:new oe;ie&&(ie[je]=r);typeof r.initializing!="boolean"&&(r.initializing=!1);"currentPreset"in r||(r.currentPreset=null);typeof r.debug!="boolean"&&(r.debug=!1);"currentConfig"in r||(r.currentConfig=null);"compiled"in r||(r.compiled=null);var H=null,V=null,K=null,G=null;function Q(e,t){return t&&typeof t=="string"?t:`${q(r.currentConfig||{},{resolvePublicAssetURL:z})}core/${e}`}async function Ke(){return Array.isArray(r.defaultEnhancers)&&r.defaultEnhancers.length>0?r.defaultEnhancers:(G||(G=import(Q("pds-enhancers.js",r.currentConfig?.enhancersURL)).then(t=>{let s=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return r.defaultEnhancers=s,s}).catch(t=>{throw G=null,t})),G)}async function Ge(){return typeof r.ask=="function"&&r.ask!==Re?r.ask:(V||(V=import(Q("pds-ask.js",r.currentConfig?.askURL)).then(t=>{let s=t?.ask;if(typeof s!="function")throw new Error("Failed to load ask helper");return r.ask=s,s}).catch(t=>{throw V=null,t})),V)}async function I(){return typeof r.toast=="function"&&r.toast!==T?r.toast:(K||(K=import(Q("pds-toast.js",r.currentConfig?.toastURL)).then(t=>{let s=t?.toast;if(typeof s!="function")throw new Error("Failed to load toast helper");return r.toast=s,s}).catch(t=>{throw K=null,t})),K)}async function Re(...e){return(await Ge())(...e)}async function T(...e){return(await I())(...e)}T.success=async(...e)=>(await I()).success(...e);T.error=async(...e)=>(await I()).error(...e);T.warning=async(...e)=>(await I()).warning(...e);T.info=async(...e)=>(await I()).info(...e);var xe=function(e="log",t,...s){let n=!!(r.registry&&!r.registry.isLive),a=(this?.debug||this?.design?.debug||r.debug||!1)===!0;if(n){if(!r.debug)return}else if(!a&&e!=="error"&&e!=="warn")return;let o=console[e]||console.log;s.length>0?o(t,...s):o(t)};function ae(e){if(e==null)return e;if(typeof e=="function")return;if(typeof e!="object")return e;if(Array.isArray(e))return e.map(s=>ae(s)).filter(s=>s!==void 0);let t={};for(let[s,n]of Object.entries(e)){let a=ae(n);a!==void 0&&(t[s]=a)}return t}function De(e,t=new WeakSet){if(!e||typeof e!="object"||t.has(e))return e;t.add(e),Object.freeze(e);for(let s of Object.keys(e))De(e[s],t);return e}function ce(e){return e==null||typeof e!="object"?e:De(structuredClone(ae(e)))}async function Qe(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let s=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let n=await fetch(s,{cache:"no-store"});return n.ok?await n.json():null}catch{return null}}r.registry=P;r.enums=be;r.adoptLayers=he;r.adoptPrimitives=me;r.parse=X;r.createStylesheet=ye;r.isLiveMode=()=>P.isLive;r.ask=Re;r.toast=T;r.common=Z;r.AutoComplete=null;r.loadAutoComplete=async()=>{if(r.AutoComplete&&typeof r.AutoComplete.connect=="function")return r.AutoComplete;let e=Q("pds-autocomplete.js",r.currentConfig?.autoCompleteURL);return H||(H=import(e).then(t=>{let s=t?.AutoComplete||t?.default?.AutoComplete||t?.default||null;if(!s)throw new Error("AutoComplete export not found in module");return r.AutoComplete=s,s}).catch(t=>{throw H=null,t})),H};function Pe(e){let t=typeof CustomEvent=="function";try{let s=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");r.dispatchEvent(s)}catch{}if(typeof document<"u")if(t){let s={detail:e,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{}}}function Te(e={}){let t=typeof CustomEvent=="function",s={at:Date.now(),...e};try{let n=t?new CustomEvent("pds:config-changed",{detail:s}):new Event("pds:config-changed");r.dispatchEvent(n)}catch{}if(typeof document<"u")if(t){let n={detail:s,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",n))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var re="pure-ds-theme",j=null,$=null;function de(e){try{if(typeof document>"u")return;let t="light";e?e==="system"?t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t=e:t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",t)}catch{}}function le(e){try{if(j&&$){try{typeof j.removeEventListener=="function"?j.removeEventListener("change",$):typeof j.removeListener=="function"&&j.removeListener($)}catch{}j=null,$=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),s=n=>{let a=n?.matches===void 0?t.matches:n.matches;try{let o=a?"dark":"light";document.documentElement.setAttribute("data-theme",o),r.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:o,source:"system"}}))}catch{}};j=t,$=s,typeof t.addEventListener=="function"?t.addEventListener("change",s):typeof t.addListener=="function"&&t.addListener(s)}}catch{}}var Ye=Object.getOwnPropertyDescriptor(r,"theme");Ye||Object.defineProperty(r,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(re)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=r.currentConfig?.design||null,s=se(e);if(t&&!ke(t,s)){let n=t?.name||r.currentPreset?.name||r.currentConfig?.preset||"current preset";console.warn(`PDS theme "${s}" not supported by preset "${n}".`),r.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:s,preset:n}}));return}e==null?localStorage.removeItem(re):localStorage.setItem(re,e),de(e),le(e),r.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});r.defaultEnhancers=[];async function Je(e){r.initializing=!0;try{let t=e&&e.mode||"live",{mode:s,...n}=e||{};r.currentConfig=ce(n);let a;if(t==="static")a=await Xe(n);else{let d=q(n,{resolvePublicAssetURL:z}),y=n?.managerURL||n?.public?.managerURL||n?.manager?.url||new URL("core/pds-manager.js",d).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:S}=await import(y);a=await S(r,n,{emitReady:Pe,emitConfigChanged:Te,applyResolvedTheme:de,setupSystemListenerIfNeeded:le})}r.compiled=ce(a?.config||null);let o=r?.compiled?.design?.icons?.externalPath||"/assets/img/icons/";return typeof console<"u"&&typeof console.info=="function"&&console.info(`[PDS] startup ready; external icon path: ${o}`),a}finally{r.initializing=!1}}r.start=Je;async function Xe(e){if(!e||typeof e!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let t=e.applyGlobalStyles??!0,s=e.manageTheme??!0,n=e.themeStorageKey??"pure-ds-theme",a=e.staticPaths??{},o=q(e,{resolvePublicAssetURL:z}),d=e&&e.autoDefine||null,y;d&&d.baseURL?y=W(B(d.baseURL,{preferModule:!1})):y=`${o}components/`;let S=d&&Array.isArray(d.predefine)&&d.predefine||[],h=d&&typeof d.mapper=="function"&&d.mapper||null;try{Le(r);let{resolvedTheme:c}=ve({manageTheme:s,themeStorageKey:n,applyResolvedTheme:de,setupSystemListenerIfNeeded:le}),i=await Qe(o,e),g=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],f=i?.config?{...i.config,...e,design:e?.design||i.config.design,preset:e?.preset||i.config.preset}:{...e},E={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`},w=i?.paths||{};if(a={...E,...w,...a},r.registry.setStaticMode(a),t&&typeof document<"u")try{let _=await r.registry.getStylesheet("styles");if(_){_._pds=!0;let m=(document.adoptedStyleSheets||[]).filter(b=>b._pds!==!0);document.adoptedStyleSheets=[...m,_],Te({mode:"static",source:"static:styles-applied"})}}catch(_){xe.call(r,"warn","Failed to apply static styles:",_)}let L=null,k=[];try{let _=await Ke(),m=await Ae({autoDefineBaseURL:y,autoDefinePreload:S,autoDefineMapper:h,enhancers:g,autoDefineOverrides:d||null,autoDefinePreferModule:!(d&&d.baseURL)},{baseEnhancers:_});L=m.autoDefiner,k=m.mergedEnhancers||[]}catch(_){xe.call(r,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",_)}return r.compiled=ce({mode:"static",...f,theme:c,enhancers:k}),Pe({mode:"static",config:f,theme:c,autoDefiner:L}),{config:f,theme:c,autoDefiner:L}}catch(c){throw r.dispatchEvent(new CustomEvent("pds:error",{detail:{error:c}})),c}}var Me={mode:"live",liveEdit:!0,preset:"default",autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster"]},log(e,t,...s){console[e](t,...s)}};var A={name:"@pure-ds/core",shortname:"pds",version:"0.7.28",description:"Why develop a Design System when you can generate one?",repository:{type:"git",url:"git+https://github.com/Pure-Web-Foundation/pure-ds.git"},bugs:{url:"https://github.com/Pure-Web-Foundation/pure-ds/issues"},homepage:"https://puredesignsystem.z6.web.core.windows.net/",keywords:["design-system","css","web-components","lit","constructable-stylesheets","tokens","utilities","a11y"],type:"module",main:"./public/assets/pds/core.js",module:"./public/assets/pds/core.js",types:"./dist/types/pds.d.ts",bin:{"pds-build":"packages/pds-cli/bin/pds-static.js","pds-sync-assets":"packages/pds-cli/bin/sync-assets.js","pds-build-icons":"packages/pds-cli/bin/pds-build-icons.js","pds-import":"packages/pds-cli/bin/pds-import.js","pds-setup-copilot":"packages/pds-cli/bin/pds-setup-copilot.js","pds-setup-mcp":"packages/pds-cli/bin/pds-setup-mcp.js","pds-init-config":"packages/pds-cli/bin/pds-init-config.js","pds-bootstrap":"packages/pds-cli/bin/pds-bootstrap.js","pds-mcp-server":"packages/pds-cli/bin/pds-mcp-server.js","pds-mcp-health":"packages/pds-cli/bin/pds-mcp-health.js","pds-mcp-eval":"packages/pds-cli/bin/pds-mcp-eval.js"},exports:{".":{types:"./src/js/pds.d.ts",import:"./public/assets/pds/core.js"},"./pds-core":"./src/js/pds.js","./auto-define/*":"./public/auto-define/*"},files:[".github/copilot-instructions.md",".cursorrules","dist/types/","public/assets/js/","public/assets/pds/components/","public/assets/pds/templates/","public/assets/pds/core.js","public/assets/pds/core/","public/assets/pds/external/","public/assets/pds/vscode-custom-data.json","public/assets/pds/pds.css-data.json","public/assets/pds/pds-css-complete.json","public/auto-define/","public/pds/components/","public/assets/pds/icons/pds-icons.svg","packages/pds-cli/bin/","packages/pds-cli/lib/","src/js/pds.d.ts","src/js/pds.js","src/js/pds-live-manager/","src/js/pds-core/","custom-elements.json","custom-elements-manifest.config.js","pds.html-data.json","pds.css-data.json","readme.md","INTELLISENSE.md","CSS-INTELLISENSE-LIMITATION.md","CSS-INTELLISENSE-QUICK-REF.md"],scripts:{test:'echo "Error: no test specified" && exit 1',dev:"node esbuild-dev.js",prebuild:"npm run types",build:"node esbuild-build.js",types:"tsc -p tsconfig.json && node scripts/sync-types.mjs",postinstall:"node packages/pds-cli/bin/postinstall.mjs","prepds:build":"npm run types","pds:build":"node packages/pds-cli/bin/pds-static.js","pds:build-icons":"node packages/pds-cli/bin/pds-build-icons.js","pds:bootstrap":"node packages/pds-cli/bin/pds-bootstrap.js","pds:manifest":"node packages/pds-cli/bin/generate-manifest.js","pds:css-data":"node packages/pds-cli/bin/generate-css-data.js","pds:import":"node packages/pds-cli/bin/pds-import.js","pds:dx":"node packages/pds-cli/bin/pds-dx.js","pds:mcp:server":"node packages/pds-cli/bin/pds-mcp-server.js","pds:mcp:health":"node packages/pds-cli/bin/pds-mcp-health.js","pds:mcp:eval":"node packages/pds-cli/bin/pds-mcp-eval.js","storybook:generate":"cd packages/pds-storybook && npm run generate-stories","storybook:dev":"cd packages/pds-storybook && npm run storybook:dev","storybook:build":"cd packages/pds-storybook && npm run storybook:build"},author:"Marc van Neerven",license:"ISC",engines:{node:">=18"},publishConfig:{access:"public"},devDependencies:{"@custom-elements-manifest/analyzer":"^0.9.9",esbuild:"^0.19.0","fs-extra":"^11.1.1",typescript:"^5.6.3","@types/node":"^22.10.2"},dependencies:{lit:"^3.3.2","pure-web":"1.1.32"},customElements:"custom-elements.json"};await r.start(Me);var Ue=typeof A.repository=="string"?A.repository:A.repository?.url,et=Ue?Ue.replace(/^git\+/,"").replace(/\.git$/,""):"",Lt=A.homepage||et,vt=A.bugs?.url||"";document.body.innerHTML=`
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
<
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
</header>
|
|
11
|
-
</div>
|
|
1
|
+
var Xe=Object.defineProperty;var et=(e,t)=>{for(var n in t)Xe(e,n,{get:t[n],enumerable:!0})};var re=class extends EventTarget{constructor(){super(),this.mode=null,this.compiled=null,this.log=()=>{},this.logHandler=null}},_e="__PURE_DS_PDS_SINGLETON__",ie=typeof globalThis<"u"?globalThis:window,oe=ie?.[_e],o=oe&&typeof oe.addEventListener=="function"?oe:new re;ie&&(ie[_e]=o);typeof o.log!="function"&&(o.log=(e="log",t,...n)=>{if(typeof console>"u")return;let s=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;s&&(n.length>0?s(t,...n):s(t))});typeof o.logHandler!="function"&&(o.logHandler=null);var ae=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(t={}){this._mode="static",this._staticPaths={...this._staticPaths,...t}}async getStylesheet(t){if(this._mode==="live")return null;try{return(await import(this._staticPaths[t]))[t]}catch(n){o.log("error",`Registry: failed to load static ${t}:`,n),o.log("error",`Registry: looking for ${this._staticPaths[t]}`),o.log("error","Registry: make sure you've run 'npm run pds:build' and configured PDS.start() with the correct static.root path");let s=new CSSStyleSheet;return s.replaceSync("/* Failed to load "+t+" */"),s}}get mode(){return this._mode}get isLive(){return this._mode==="live"}},T=new ae;async function ve(e,t=[],n=null){try{let s=n?.primitivesStylesheet?n.primitivesStylesheet:await T.getStylesheet("primitives");e.adoptedStyleSheets=[s,...t]}catch(s){let a=e.host?.tagName?.toLowerCase()||"unknown";o.log("error",`Adopter: <${a}> failed to adopt primitives:`,s),e.adoptedStyleSheets=t}}async function Ae(e,t=["primitives"],n=[],s=null){let a=Array.isArray(n)?n.filter(Boolean):[];if(a.length){let l=(Array.isArray(e.adoptedStyleSheets)?e.adoptedStyleSheets:[]).filter(f=>!a.includes(f));e.adoptedStyleSheets=[...l,...a]}try{let l=(await Promise.all(t.map(async f=>{if(s)switch(f){case"tokens":return s.tokensStylesheet;case"primitives":return s.primitivesStylesheet;case"components":return s.componentsStylesheet;case"utilities":return s.utilitiesStylesheet;default:break}return T.getStylesheet(f)}))).filter(f=>f!==null);e.adoptedStyleSheets=[...l,...a]}catch(r){let l=e.host?.tagName?.toLowerCase()||"unknown";o.log("error",`Adopter: <${l}> failed to adopt layers:`,r),e.adoptedStyleSheets=a}}function je(e){let t=new CSSStyleSheet;return t.replaceSync(e),t}var ke={FontWeights:{light:300,normal:400,medium:500,semibold:600,bold:700},LineHeights:{tight:1.25,normal:1.5,relaxed:1.75},BorderWidths:{hairline:.5,thin:1,medium:2,thick:3},RadiusSizes:{none:0,small:4,medium:8,large:16,xlarge:24,xxlarge:32},ShadowDepths:{none:"none",light:"0 1px 2px 0 rgba(0, 0, 0, 0.05)",medium:"0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06)",deep:"0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05)",extreme:"0 25px 50px -12px rgba(0, 0, 0, 0.25)"},TransitionSpeeds:{fast:150,normal:250,slow:350},AnimationEasings:{linear:"linear",ease:"ease","ease-in":"ease-in","ease-out":"ease-out","ease-in-out":"ease-in-out",bounce:"cubic-bezier(0.68, -0.55, 0.265, 1.55)"},TouchTargetSizes:{compact:36,standard:44,comfortable:48,spacious:56},LinkStyles:{inline:"inline",block:"block",button:"button"},FocusStyles:{ring:"ring",outline:"outline",border:"border",glow:"glow"},TabSizes:{compact:2,standard:4,wide:8},SelectIcons:{chevron:"chevron",arrow:"arrow",caret:"caret",none:"none"},IconSizes:{xs:16,sm:20,md:24,lg:32,xl:48,"2xl":64,"3xl":96}};var le={};et(le,{deepMerge:()=>Pe,fragmentFromTemplateLike:()=>tt,isObject:()=>B,parseHTML:()=>ce});function B(e){return e&&typeof e=="object"&&!Array.isArray(e)}function Pe(e,t){let n={...e};return B(e)&&B(t)&&Object.keys(t).forEach(s=>{B(t[s])?s in e?n[s]=Pe(e[s],t[s]):Object.assign(n,{[s]:t[s]}):Object.assign(n,{[s]:t[s]})}),n}function tt(e){let t=Array.isArray(e?.strings)?e.strings:[],n=Array.isArray(e?.values)?e.values:[],s=new Set,a=[],r=/(\s)(\.[\w-]+)=\s*$/;for(let i=0;i<t.length;i+=1){let w=t[i]??"",h=w.match(r);if(h&&i<n.length){let S=h[2].slice(1),v=`pds-val-${i}`;w=w.replace(r,`$1data-pds-prop="${S}:${v}"`),s.add(i)}a.push(w),i<n.length&&!s.has(i)&&a.push(`<!--pds-val-${i}-->`)}let l=document.createElement("template");l.innerHTML=a.join("");let f=(i,w)=>{let h=i.parentNode;if(!h)return;if(w==null){h.removeChild(i);return}let E=S=>{if(S!=null){if(S instanceof Node){h.insertBefore(S,i);return}if(Array.isArray(S)){S.forEach(v=>E(v));return}h.insertBefore(document.createTextNode(String(S)),i)}};E(w),h.removeChild(i)},g=document.createTreeWalker(l.content,NodeFilter.SHOW_COMMENT),p=[];for(;g.nextNode();){let i=g.currentNode;i?.nodeValue?.startsWith("pds-val-")&&p.push(i)}return p.forEach(i=>{let w=Number(i.nodeValue.replace("pds-val-",""));f(i,n[w])}),l.content.querySelectorAll("*").forEach(i=>{let w=i.getAttribute("data-pds-prop");if(!w)return;let[h,E]=w.split(":"),S=Number(String(E).replace("pds-val-",""));h&&Number.isInteger(S)&&(i[h]=n[S]),i.removeAttribute("data-pds-prop")}),l.content}function ce(e){return new DOMParser().parseFromString(e,"text/html").body.childNodes}var Re="pds",nt=/^([a-z][a-z0-9+\-.]*:)?\/\//i,xe=/^[a-z]:/i;function U(e=""){return e.endsWith("/")?e:`${e}/`}function st(e="",t=Re){let n=e.replace(/\/+$/,"");return new RegExp(`(?:^|/)${t}$`,"i").test(n)?n:`${n}/${t}`}function ot(e){return e.replace(/^\.\/+/,"")}function rt(e){return xe.test(e)?e.replace(xe,"").replace(/^\/+/,""):e}function it(e){return e.startsWith("public/")?e.substring(7):e}function G(e,t={}){let n=t.segment||Re,s=t.defaultRoot||`/assets/${n}/`,a=e?.public&&e.public?.root||e?.static&&e.static?.root||null;if(!a||typeof a!="string")return U(s);let r=a.trim();return r?(r=r.replace(/\\/g,"/"),r=st(r,n),r=U(r),nt.test(r)?r:(r=ot(r),r=rt(r),r.startsWith("/")||(r=it(r),r.startsWith("/")||(r=`/${r}`),r=r.replace(/\/+/g,(l,f)=>f===0?l:"/")),U(r))):U(s)}async function at(...e){let t={};e.length&&typeof e[e.length-1]=="object"&&(t=e.pop()||{});let n=e,{baseURL:s,mapper:a=p=>`${p}.js`,onError:r=(p,c)=>console.error(`[defineWebComponents] ${p}:`,c)}=t,l=s?new URL(s,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),f=p=>p.toLowerCase().replace(/(^|-)([a-z])/g,(c,i,w)=>w.toUpperCase()),g=async p=>{try{if(customElements.get(p))return{tag:p,status:"already-defined"};let c=a(p),w=await import(c instanceof URL?c.href:new URL(c,l).href),h=w?.default??w?.[f(p)];if(!h){if(customElements.get(p))return{tag:p,status:"self-defined"};throw new Error(`No export found for ${p}. Expected default export or named export "${f(p)}".`)}return customElements.get(p)?{tag:p,status:"race-already-defined"}:(customElements.define(p,h),{tag:p,status:"defined"})}catch(c){throw r(p,c),c}};return Promise.all(n.map(g))}var V=class{constructor(t={}){let{baseURL:n,mapper:s,onError:a,predicate:r=()=>!0,attributeModule:l="data-module",root:f=document,scanExisting:g=!0,debounceMs:p=16,observeShadows:c=!0,enhancers:i=[],patchAttachShadow:w=!0}=t,h=new Set,E=new Set,S=new Set,v=new Map,P=new WeakMap,_=new WeakMap,y=0,b=!1,x=null,H=d=>{if(!d||!i.length)return;let m=_.get(d);m||(m=new Set,_.set(d,m));for(let u of i)if(!(!u.selector||!u.run)&&!m.has(u.selector))try{d.matches&&d.matches(u.selector)&&(u.run(d),m.add(u.selector))}catch(j){console.warn(`[AutoDefiner] Error applying enhancer for selector "${u.selector}":`,j)}},M=(d,m)=>{if(!b&&!(!d||!d.includes("-"))&&!customElements.get(d)&&!E.has(d)&&!S.has(d)){if(m&&m.getAttribute){let u=m.getAttribute(l);u&&!v.has(d)&&v.set(d,u)}h.add(d),Ze()}},Ze=()=>{y||(y=setTimeout(Se,p))},D=d=>{if(d){if(d.nodeType===1){let m=d,u=m.tagName?.toLowerCase();u&&u.includes("-")&&!customElements.get(u)&&r(u,m)&&M(u,m),H(m),c&&m.shadowRoot&&se(m.shadowRoot)}d.querySelectorAll&&d.querySelectorAll("*").forEach(m=>{let u=m.tagName?.toLowerCase();u&&u.includes("-")&&!customElements.get(u)&&r(u,m)&&M(u,m),H(m),c&&m.shadowRoot&&se(m.shadowRoot)})}},se=d=>{if(!d||P.has(d))return;D(d);let m=new MutationObserver(u=>{for(let j of u)j.addedNodes?.forEach(C=>{D(C)}),j.type==="attributes"&&j.target&&D(j.target)});m.observe(d,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...i.map(u=>u.selector).filter(u=>u.startsWith("data-"))]}),P.set(d,m)};async function Se(){if(clearTimeout(y),y=0,!h.size)return;let d=Array.from(h);h.clear(),d.forEach(m=>E.add(m));try{let m=u=>v.get(u)??(s?s(u):`${u}.js`);await at(...d,{baseURL:n,mapper:m,onError:(u,j)=>{S.add(u),a?.(u,j)}})}catch{}finally{d.forEach(m=>E.delete(m))}}let Le=f===document?document.documentElement:f,Ee=new MutationObserver(d=>{for(let m of d)m.addedNodes?.forEach(u=>{D(u)}),m.type==="attributes"&&m.target&&D(m.target)});if(Ee.observe(Le,{childList:!0,subtree:!0,attributes:!0,attributeFilter:[l,...i.map(d=>d.selector).filter(d=>d.startsWith("data-"))]}),c&&w&&Element.prototype.attachShadow){let d=Element.prototype.attachShadow;Element.prototype.attachShadow=function(u){let j=d.call(this,u);if(u&&u.mode==="open"){se(j);let C=this.tagName?.toLowerCase();C&&C.includes("-")&&!customElements.get(C)&&M(C,this)}return j},x=()=>Element.prototype.attachShadow=d}return g&&D(Le),{stop(){b=!0,Ee.disconnect(),x&&x(),y&&(clearTimeout(y),y=0),P.forEach(d=>d.disconnect())},flush:Se}}static async define(...t){let n={};t.length&&typeof t[t.length-1]=="object"&&(n=t.pop()||{});let s=t,{baseURL:a,mapper:r=c=>`${c}.js`,onError:l=(c,i)=>console.error(`[defineWebComponents] ${c}:`,i)}=n,f=a?new URL(a,typeof location<"u"?location.href:import.meta.url):new URL("./",import.meta.url),g=c=>c.toLowerCase().replace(/(^|-)([a-z])/g,(i,w,h)=>h.toUpperCase()),p=async c=>{try{if(customElements.get(c))return{tag:c,status:"already-defined"};let i=r(c),h=await import(i instanceof URL?i.href:new URL(i,f).href),E=h?.default??h?.[g(c)];if(!E){if(customElements.get(c))return{tag:c,status:"self-defined"};throw new Error(`No export found for ${c}. Expected default export or named export "${g(c)}".`)}return customElements.get(c)?{tag:c,status:"race-already-defined"}:(customElements.define(c,E),{tag:c,status:"defined"})}catch(i){throw l(c,i),i}};return Promise.all(s.map(p))}};var ct=/^[a-z][a-z0-9+\-.]*:\/\//i,O=(()=>{try{return import.meta.url}catch{return}})(),q=e=>typeof e=="string"&&e.length&&!e.endsWith("/")?`${e}/`:e;function J(e,t={}){if(!e||ct.test(e))return e;let{preferModule:n=!0}=t,s=()=>{if(!O)return null;try{return new URL(e,O).href}catch{return null}},a=()=>{if(typeof window>"u"||!window.location?.origin)return null;try{return new URL(e,window.location.origin).href}catch{return null}};return(n?s()||a():a()||s())||e}var De=(()=>{if(O)try{let e=new URL(O);if(/\/public\/assets\/js\//.test(e.pathname))return new URL("../pds/",O).href}catch{return}})(),Ce=!1;function Te(e){Ce||typeof document>"u"||(Ce=!0,e.addEventListener("pds:ready",t=>{let n=t.detail?.mode;n&&document.documentElement.classList.add(`pds-${n}`,"pds-ready")}))}function ze({manageTheme:e,themeStorageKey:t,applyResolvedTheme:n,setupSystemListenerIfNeeded:s}){let a="light",r=null;if(e&&typeof window<"u"){try{r=localStorage.getItem(t)||null}catch{r=null}try{n?.(r),s?.(r)}catch{}r?r==="system"?a=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":a=r:a=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}return{resolvedTheme:a,storedTheme:r}}function K(e,{resolvePublicAssetURL:t}){let n=!!(e?.public?.root||e?.static?.root),s=t(e);return!n&&De&&(s=De),q(J(s))}async function Me(e,{baseEnhancers:t=[]}={}){let{autoDefineBaseURL:n="/auto-define/",autoDefinePreload:s=[],autoDefineMapper:a=null,enhancers:r=[],autoDefineOverrides:l=null,autoDefinePreferModule:f=!0}=e,g=(()=>{let c=new Map;return(t||[]).forEach(i=>c.set(i.selector,i)),(r||[]).forEach(i=>c.set(i.selector,i)),Array.from(c.values())})(),p=null;if(typeof window<"u"&&typeof document<"u"){let c=V,i=y=>{switch(y){case"pds-tabpanel":return"pds-tabstrip.js";default:return`${y}.js`}},{mapper:w,enhancers:h,...E}=l&&typeof l=="object"?l:{},S=h?Array.isArray(h)?h:typeof h=="object"?Object.values(h):[]:[],v=(()=>{let y=new Map;return(g||[]).forEach(b=>{b?.selector&&y.set(b.selector,b)}),(S||[]).forEach(b=>{if(!b?.selector)return;let x=y.get(b.selector)||null;y.set(b.selector,{...x||{},...b,run:typeof b?.run=="function"?b.run:x?.run})}),Array.from(y.values())})(),_={baseURL:n&&q(J(n,{preferModule:f})),predefine:s,scanExisting:!0,observeShadows:!0,patchAttachShadow:!0,debounceMs:16,enhancers:v,onError:(y,b)=>{if(typeof y=="string"&&y.startsWith("pds-")){let H=["pds-form","pds-drawer"].includes(y),M=b?.message?.includes("#pds/lit")||b?.message?.includes("Failed to resolve module specifier");H&&M?o.log("error",`\u274C PDS component <${y}> requires Lit but #pds/lit is not in import map.
|
|
2
|
+
See: https://github.com/Pure-Web-Foundation/pure-ds/blob/main/readme.md#lit-components-not-working`):o.log("warn",`\u26A0\uFE0F PDS component <${y}> not found. Assets may not be installed.`)}else o.log("error",`\u274C Auto-define error for <${y}>:`,b)},...E,mapper:y=>{if(customElements.get(y))return null;if(typeof a=="function")try{let b=a(y);return b===void 0?i(y):b}catch(b){return o.log("warn","Custom autoDefine.mapper error; falling back to default:",b?.message||b),i(y)}return i(y)}};p=new c(_),s.length>0&&typeof c.define=="function"&&await c.define(...s,{baseURL:n,mapper:_.mapper,onError:_.onError})}return{autoDefiner:p,mergedEnhancers:g}}var de=["light","dark"],ue=new Set(de);function lt(e){let n=(Array.isArray(e?.themes)?e.themes.map(s=>String(s).toLowerCase()):de).filter(s=>ue.has(s));return n.length?n:de}function pe(e,{preferDocument:t=!0}={}){let n=String(e||"").toLowerCase();if(ue.has(n))return n;if(t&&typeof document<"u"){let s=document.documentElement?.getAttribute("data-theme");if(ue.has(s))return s}return typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ue(e,t){let n=pe(t);return lt(e).includes(n)}var dt=new Set(["log","warn","error","debug","info"]),ut="__PURE_DS_PDS_SINGLETON__",fe=null,me=null;function Ne(){try{let t=(typeof globalThis<"u"?globalThis:window)?.[ut];if(t&&typeof t=="object")return t}catch{return null}return null}function pt(e){return!e||typeof e!="object"?null:{mode:e.mode==="live"||e.mode==="static"?e.mode:null,debug:e.debug===!0,thisArg:e.thisArg}}function ft(e){if(typeof e!="string")return"log";let t=e.toLowerCase();return dt.has(t)?t:"log"}function mt(){if(typeof me=="function")try{let t=pt(me());if(t)return t}catch{}let e=Ne();if(e){let t=e?.mode||e?.compiled?.mode||(e?.registry?.isLive?"live":"static"),n=(e?.debug||e?.currentConfig?.debug||e?.currentConfig?.design?.debug||e?.compiled?.debug||e?.compiled?.design?.debug||!1)===!0;return{mode:t,debug:n,thisArg:e}}return{mode:null,debug:!1}}function ht(){if(typeof fe=="function")try{let t=fe();if(typeof t=="function")return t}catch{}let e=Ne();return typeof e?.logHandler=="function"?e.logHandler:null}function Oe(e,t,...n){if(typeof console>"u")return;let s=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;s&&(n.length>0?s(t,...n):s(t))}function yt(e,t){let n=t?.debug===!0;return!(t?.mode==="static"&&!n||!n&&e!=="error"&&e!=="warn")}function $e({getLogger:e,getContext:t}={}){fe=typeof e=="function"?e:null,me=typeof t=="function"?t:null}function Ie(e="log",t,...n){let s=ft(e),a=mt(),r=ht();if(r)try{r.call(a?.thisArg,s,t,...n);return}catch(l){Oe("error","Custom log handler failed:",l)}yt(s,a)&&Oe(s,t,...n)}typeof o.initializing!="boolean"&&(o.initializing=!1);"currentPreset"in o||(o.currentPreset=null);typeof o.debug!="boolean"&&(o.debug=!1);"currentConfig"in o||(o.currentConfig=null);"compiled"in o||(o.compiled=null);typeof o.logHandler!="function"&&(o.logHandler=null);"mode"in o||(o.mode=null);var Q=null,Y=null,Z=null,X=null,ee=null,A=null;$e({getLogger:()=>typeof o.logHandler=="function"?o.logHandler:null,getContext:()=>{let e=o?.mode||o?.compiled?.mode||(o?.registry?.isLive?"live":"static"),t=(o?.debug||o?.currentConfig?.debug||o?.currentConfig?.design?.debug||o?.compiled?.debug||o?.compiled?.design?.debug||!1)===!0;return{mode:e,debug:t,thisArg:o}}});o.log=(e="log",t,...n)=>{Ie(e,t,...n)};var L={locale:"en",messages:{},hasProvider:!1};function gt(e){return!!e&&typeof e!="string"&&typeof e=="object"&&"strTag"in e}function bt(e=[]){let t="";for(let n=0;n<=e.length-1;n+=1)t+=e[n],n<e.length-1&&(t+=`{${n}}`);return t}function wt(e,t){return String(e).replace(/\{(\d+)\}/g,(n,s)=>t(Number(s)))}function St(e){if(!e||typeof e!="object")return{};let t={};for(let[n,s]of Object.entries(e)){if(typeof s=="string"){t[n]=s;continue}s&&typeof s=="object"&&typeof s.content=="string"&&(t[n]=s.content)}return t}function Lt(e,...t){return{strTag:!0,strings:Array.from(e||[]),values:t,raw:Array.from(e?.raw||[])}}function Et(e){if(!e)return"";if(gt(e)){let n=bt(e.strings||[]),s=L.messages[n]||n;return wt(s,a=>e.values?.[a])}let t=String(e);return L.messages[t]||t}async function $(){return A||(ee||(ee=import(F("pds-localization.js")).then(t=>{if(typeof t?.msg!="function"||typeof t?.str!="function"||typeof t?.configureLocalization!="function"||typeof t?.loadLocale!="function"||typeof t?.setLocale!="function"||typeof t?.getLocalizationState!="function")throw new Error("Failed to load localization runtime exports");return A=t,t}).catch(t=>{throw ee=null,t})),ee)}var I=(e,t={})=>typeof A?.msg=="function"?A.msg(e,t):Et(e,t),ne=(e,...t)=>typeof A?.str=="function"?A.str(e,...t):Lt(e,...t),te=(e=null)=>{if(typeof A?.configureLocalization=="function")return A.configureLocalization(e);if(!e||typeof e!="object")return L.locale="en",L.messages={},L.hasProvider=!1,{locale:L.locale,messages:{...L.messages},hasProvider:L.hasProvider};typeof e.locale=="string"&&e.locale.trim()&&(L.locale=e.locale.trim()),Object.prototype.hasOwnProperty.call(e,"messages")&&(L.messages=St(e.messages));let t=!!(e.provider||e.translate||e.loadLocale||e.setLocale);return L.hasProvider=t,t&&$().then(n=>{n.configureLocalization(e)}).catch(()=>{}),{locale:L.locale,messages:{...L.messages},hasProvider:L.hasProvider}},We=async e=>(await $()).loadLocale(e),He=async(e,t={})=>(await $()).setLocale(e,t),Be=()=>typeof A?.getLocalizationState=="function"?A.getLocalizationState():{locale:L.locale,messages:{...L.messages},hasProvider:L.hasProvider},Ge=(e={})=>{if(typeof A?.createJSONLocalization=="function")return A.createJSONLocalization(e);let t=typeof e?.locale=="string"&&e.locale.trim()?e.locale.trim().toLowerCase():"en",n=Array.isArray(e?.locales)?e.locales.map(f=>String(f||"").trim().toLowerCase()).filter(Boolean):[],s=Array.from(new Set([t,...n])),a=null,r=async()=>(a||(a=$().then(f=>typeof f?.createJSONLocalization=="function"?f.createJSONLocalization(e):null).catch(()=>null)),a),l=async(f="loadLocale")=>{let g=await r();if(!g||typeof g!="object")return null;let p=g.provider;if(!p||typeof p!="object")return null;let c=p[f];return typeof c=="function"?c:f==="setLocale"&&typeof p.loadLocale=="function"?p.loadLocale:null};return{locale:t,locales:[...s],provider:{locales:[...s],async loadLocale(f={}){let g=await l("loadLocale");return typeof g!="function"?{}:g(f)},async setLocale(f={}){let g=await l("setLocale");return typeof g!="function"?{}:g(f)}}}};function F(e,t){return t&&typeof t=="string"?t:`${K(o.currentConfig||{},{resolvePublicAssetURL:G})}core/${e}`}async function _t(){return Array.isArray(o.defaultEnhancers)&&o.defaultEnhancers.length>0?o.defaultEnhancers:(X||(X=import(F("pds-enhancers.js",o.currentConfig?.enhancersURL)).then(t=>{let n=Array.isArray(t?.defaultPDSEnhancers)?t.defaultPDSEnhancers:[];return o.defaultEnhancers=n,n}).catch(t=>{throw X=null,t})),X)}async function vt(){return typeof o.ask=="function"&&o.ask!==Ve?o.ask:(Y||(Y=import(F("pds-ask.js",o.currentConfig?.askURL)).then(t=>{let n=t?.ask;if(typeof n!="function")throw new Error("Failed to load ask helper");return o.ask=n,n}).catch(t=>{throw Y=null,t})),Y)}async function W(){return typeof o.toast=="function"&&o.toast!==z?o.toast:(Z||(Z=import(F("pds-toast.js",o.currentConfig?.toastURL)).then(t=>{let n=t?.toast;if(typeof n!="function")throw new Error("Failed to load toast helper");return o.toast=n,n}).catch(t=>{throw Z=null,t})),Z)}async function Ve(...e){return(await vt())(...e)}async function z(...e){return(await W())(...e)}z.success=async(...e)=>(await W()).success(...e);z.error=async(...e)=>(await W()).error(...e);z.warning=async(...e)=>(await W()).warning(...e);z.info=async(...e)=>(await W()).info(...e);var Fe=function(e="log",t,...n){o.log(e,t,...n)};function ye(e){if(e==null)return e;if(typeof e=="function")return;if(typeof e!="object")return e;if(Array.isArray(e))return e.map(n=>ye(n)).filter(n=>n!==void 0);let t={};for(let[n,s]of Object.entries(e)){let a=ye(s);a!==void 0&&(t[n]=a)}return t}function qe(e,t=new WeakSet){if(!e||typeof e!="object"||t.has(e))return e;t.add(e),Object.freeze(e);for(let n of Object.keys(e))qe(e[n],t);return e}function ge(e){return e==null||typeof e!="object"?e:qe(structuredClone(ye(e)))}async function At(e,t={}){if(t?.runtimeConfig===!1||typeof fetch!="function")return null;let n=t?.runtimeConfigURL||`${e}pds-runtime-config.json`;try{let s=await fetch(n,{cache:"no-store"});return s.ok?await s.json():null}catch{return null}}o.registry=T;o.enums=ke;o.adoptLayers=Ae;o.adoptPrimitives=ve;o.parse=ce;o.createStylesheet=je;o.isLiveMode=()=>T.isLive;o.ask=Ve;o.toast=z;o.common=le;o.msg=I;o.str=ne;o.configureLocalization=te;o.loadLocale=We;o.setLocale=He;o.getLocalizationState=Be;o.createJSONLocalization=Ge;o.i18n={msg:I,str:ne,configure:te,loadLocale:We,setLocale:He,getState:Be,createJSONLocalization:Ge};o.AutoComplete=null;o.loadAutoComplete=async()=>{if(o.AutoComplete&&typeof o.AutoComplete.connect=="function")return o.AutoComplete;let e=F("pds-autocomplete.js",o.currentConfig?.autoCompleteURL);return Q||(Q=import(e).then(t=>{let n=t?.AutoComplete||t?.default?.AutoComplete||t?.default||null;if(!n)throw new Error("AutoComplete export not found in module");return o.AutoComplete=n,n}).catch(t=>{throw Q=null,t})),Q};function Je(e){let t=typeof CustomEvent=="function";try{let n=t?new CustomEvent("pds:ready",{detail:e}):new Event("pds:ready");o.dispatchEvent(n)}catch{}if(typeof document<"u")if(t){let n={detail:e,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:ready",n))}catch{}try{document.dispatchEvent(new CustomEvent("pds-ready",n))}catch{}}else{try{document.dispatchEvent(new Event("pds:ready"))}catch{}try{document.dispatchEvent(new Event("pds-ready"))}catch{}}}function Ke(e={}){let t=typeof CustomEvent=="function",n={at:Date.now(),...e};try{let s=t?new CustomEvent("pds:config-changed",{detail:n}):new Event("pds:config-changed");o.dispatchEvent(s)}catch{}if(typeof document<"u")if(t){let s={detail:n,bubbles:!0,composed:!0};try{document.dispatchEvent(new CustomEvent("pds:config-changed",s))}catch{}}else try{document.dispatchEvent(new Event("pds:config-changed"))}catch{}}var he="pure-ds-theme",R=null,N=null;function be(e){try{if(typeof document>"u")return;let t="light";e?e==="system"?t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light":t=e:t=typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",document.documentElement.setAttribute("data-theme",t)}catch{}}function we(e){try{if(R&&N){try{typeof R.removeEventListener=="function"?R.removeEventListener("change",N):typeof R.removeListener=="function"&&R.removeListener(N)}catch{}R=null,N=null}if(e==="system"&&typeof window<"u"&&window.matchMedia){let t=window.matchMedia("(prefers-color-scheme: dark)"),n=s=>{let a=s?.matches===void 0?t.matches:s.matches;try{let r=a?"dark":"light";document.documentElement.setAttribute("data-theme",r),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:r,source:"system"}}))}catch{}};R=t,N=n,typeof t.addEventListener=="function"?t.addEventListener("change",n):typeof t.addListener=="function"&&t.addListener(n)}}catch{}}var jt=Object.getOwnPropertyDescriptor(o,"theme");jt||Object.defineProperty(o,"theme",{get(){try{return typeof window>"u"?null:localStorage.getItem(he)||null}catch{return null}},set(e){try{if(typeof window>"u")return;let t=o.currentConfig?.design||null,n=pe(e);if(t&&!Ue(t,n)){let s=t?.name||o.currentPreset?.name||o.currentConfig?.preset||"current preset";o.log("warn",`PDS theme "${n}" not supported by preset "${s}".`),o.dispatchEvent(new CustomEvent("pds:theme:blocked",{detail:{theme:e,resolvedTheme:n,preset:s}}));return}e==null?localStorage.removeItem(he):localStorage.setItem(he,e),be(e),we(e),o.dispatchEvent(new CustomEvent("pds:theme:changed",{detail:{theme:e,source:"api"}}))}catch{}}});o.defaultEnhancers=[];async function kt(e){o.initializing=!0;try{let t=e&&e.mode||"live",{mode:n,...s}=e||{};o.mode=t,o.logHandler=typeof s?.log=="function"?s.log:null,o.currentConfig=ge(s);let a=s&&typeof s.localization=="object"&&s.localization?s.localization:null;a?(await $(),te(a)):te(null);let r;if(t==="static")r=await Pt(s);else{let f=K(s,{resolvePublicAssetURL:G}),g=s?.managerURL||s?.public?.managerURL||s?.manager?.url||new URL("core/pds-manager.js",f).href||new URL("./pds-manager.js",import.meta.url).href,{startLive:p}=await import(g);r=await p(o,s,{emitReady:Je,emitConfigChanged:Ke,applyResolvedTheme:be,setupSystemListenerIfNeeded:we})}o.compiled=ge(r?.config||null);let l=o?.compiled?.design?.icons?.externalPath||"/assets/img/icons/";return o.log("info",`startup ready; external icon path: ${l}`),r}finally{o.initializing=!1}}o.start=kt;async function Pt(e){if(!e||typeof e!="object")throw new Error("PDS.start({ mode: 'static', ... }) requires a valid configuration object");let t=e.applyGlobalStyles??!0,n=e.manageTheme??!0,s=e.themeStorageKey??"pure-ds-theme",a=e.staticPaths??{},r=K(e,{resolvePublicAssetURL:G}),l=e&&e.autoDefine||null,f;l&&l.baseURL?f=q(J(l.baseURL,{preferModule:!1})):f=`${r}components/`;let g=l&&Array.isArray(l.predefine)&&l.predefine||[],p=l&&typeof l.mapper=="function"&&l.mapper||null;try{Te(o);let{resolvedTheme:c}=ze({manageTheme:n,themeStorageKey:s,applyResolvedTheme:be,setupSystemListenerIfNeeded:we}),i=await At(r,e),w=Array.isArray(e?.enhancers)?e.enhancers:e?.enhancers&&typeof e.enhancers=="object"?Object.values(e.enhancers):[],h=i?.config?{...i.config,...e,design:e?.design||i.config.design,preset:e?.preset||i.config.preset}:{...e},E={tokens:`${r}styles/pds-tokens.css.js`,primitives:`${r}styles/pds-primitives.css.js`,components:`${r}styles/pds-components.css.js`,utilities:`${r}styles/pds-utilities.css.js`,styles:`${r}styles/pds-styles.css.js`},S=i?.paths||{};if(a={...E,...S,...a},o.registry.setStaticMode(a),t&&typeof document<"u")try{let _=await o.registry.getStylesheet("styles");if(_){_._pds=!0;let y=(document.adoptedStyleSheets||[]).filter(b=>b._pds!==!0);document.adoptedStyleSheets=[...y,_],Ke({mode:"static",source:"static:styles-applied"})}}catch(_){Fe.call(o,"warn","Failed to apply static styles:",_)}let v=null,P=[];try{let _=await _t(),y=await Me({autoDefineBaseURL:f,autoDefinePreload:g,autoDefineMapper:p,enhancers:w,autoDefineOverrides:l||null,autoDefinePreferModule:!(l&&l.baseURL)},{baseEnhancers:_});v=y.autoDefiner,P=y.mergedEnhancers||[]}catch(_){Fe.call(o,"error","\u274C Failed to initialize AutoDefiner/Enhancers (static):",_)}return o.compiled=ge({mode:"static",...h,theme:c,enhancers:P}),Je({mode:"static",config:h,theme:c,autoDefiner:v}),{config:h,theme:c,autoDefiner:v}}catch(c){throw o.dispatchEvent(new CustomEvent("pds:error",{detail:{error:c}})),c}}var xt=o.createJSONLocalization({locale:"en",locales:["en","nl"],aliases:{en:["en","en-US"],nl:["nl","nl-NL"]},basePath:"/assets/locales"}),Qe={mode:"live",liveEdit:!0,preset:"default",localization:xt,autoDefine:{predefine:["pds-icon","pds-drawer","pds-toaster"]},log(e,t,...n){(this?.mode||this?.compiled?.mode||"live")!=="static"&&(typeof console[e]=="function"?console[e]:console.log)(`[PDS] ${t}`,...n)}};var k={name:"@pure-ds/core",shortname:"pds",version:"0.7.31",description:"Why develop a Design System when you can generate one?",repository:{type:"git",url:"git+https://github.com/Pure-Web-Foundation/pure-ds.git"},bugs:{url:"https://github.com/Pure-Web-Foundation/pure-ds/issues"},homepage:"https://puredesignsystem.z6.web.core.windows.net/",keywords:["design-system","css","web-components","lit","constructable-stylesheets","tokens","utilities","a11y"],type:"module",main:"./public/assets/pds/core.js",module:"./public/assets/pds/core.js",types:"./dist/types/pds.d.ts",bin:{"pds-build":"packages/pds-cli/bin/pds-static.js","pds-sync-assets":"packages/pds-cli/bin/sync-assets.js","pds-build-icons":"packages/pds-cli/bin/pds-build-icons.js","pds-import":"packages/pds-cli/bin/pds-import.js","pds-setup-copilot":"packages/pds-cli/bin/pds-setup-copilot.js","pds-setup-mcp":"packages/pds-cli/bin/pds-setup-mcp.js","pds-init-config":"packages/pds-cli/bin/pds-init-config.js","pds-bootstrap":"packages/pds-cli/bin/pds-bootstrap.js","pds-mcp-server":"packages/pds-cli/bin/pds-mcp-server.js","pds-mcp-health":"packages/pds-cli/bin/pds-mcp-health.js","pds-mcp-eval":"packages/pds-cli/bin/pds-mcp-eval.js"},exports:{".":{types:"./src/js/pds.d.ts",import:"./public/assets/pds/core.js"},"./localization":{types:"./dist/types/src/js/pds-localization.d.ts",import:"./public/assets/pds/core/pds-localization.js"},"./pds-core":"./src/js/pds.js","./auto-define/*":"./public/auto-define/*"},files:[".github/copilot-instructions.md",".cursorrules","dist/types/","public/assets/js/","public/assets/pds/components/","public/assets/pds/templates/","public/assets/pds/core.js","public/assets/pds/core/","public/assets/pds/external/","public/assets/pds/vscode-custom-data.json","public/assets/pds/pds.css-data.json","public/assets/pds/pds-css-complete.json","public/auto-define/","public/pds/components/","public/assets/pds/icons/pds-icons.svg","packages/pds-cli/bin/","packages/pds-cli/lib/","src/js/pds.d.ts","src/js/pds.js","src/js/pds-live-manager/","src/js/pds-core/","custom-elements.json","custom-elements-manifest.config.js","pds.html-data.json","pds.css-data.json","LOCALIZATION.md","readme.md","INTELLISENSE.md","CSS-INTELLISENSE-LIMITATION.md","CSS-INTELLISENSE-QUICK-REF.md"],scripts:{test:'echo "Error: no test specified" && exit 1',dev:"node esbuild-dev.js",prebuild:"npm run types",build:"node esbuild-build.js",types:"tsc -p tsconfig.json && node scripts/sync-types.mjs",postinstall:"node packages/pds-cli/bin/postinstall.mjs","prepds:build":"npm run types","pds:build":"node packages/pds-cli/bin/pds-static.js","pds:build-icons":"node packages/pds-cli/bin/pds-build-icons.js","pds:bootstrap":"node packages/pds-cli/bin/pds-bootstrap.js","pds:manifest":"node packages/pds-cli/bin/generate-manifest.js","pds:css-data":"node packages/pds-cli/bin/generate-css-data.js","pds:import":"node packages/pds-cli/bin/pds-import.js","pds:dx":"node packages/pds-cli/bin/pds-dx.js","pds:mcp:server":"node packages/pds-cli/bin/pds-mcp-server.js","pds:mcp:health":"node packages/pds-cli/bin/pds-mcp-health.js","pds:mcp:eval":"node packages/pds-cli/bin/pds-mcp-eval.js","storybook:generate":"cd packages/pds-storybook && npm run generate-stories","storybook:dev":"cd packages/pds-storybook && npm run storybook:dev","storybook:build":"cd packages/pds-storybook && npm run storybook:build"},author:"Marc van Neerven",license:"ISC",engines:{node:">=18"},publishConfig:{access:"public"},devDependencies:{"@custom-elements-manifest/analyzer":"^0.9.9","@types/node":"^22.10.2",esbuild:"^0.19.0","fs-extra":"^11.1.1",typescript:"^5.6.3"},dependencies:{lit:"^3.3.2","pure-web":"1.1.32"},customElements:"custom-elements.json"};await o.start(Qe);document.documentElement.lang="en";var Ye=typeof k.repository=="string"?k.repository:k.repository?.url,Dt=Ye?Ye.replace(/^git\+/,"").replace(/\.git$/,""):"",ln=k.homepage||Dt,dn=k.bugs?.url||"";document.body.innerHTML=`
|
|
3
|
+
<div class="container text-center">
|
|
4
|
+
<img src="/assets/img/pds-logo.svg" alt="PDS Logo" width="64" height="64" />
|
|
5
|
+
<header class="container section">
|
|
6
|
+
<h1>${k.name} ${I(ne`version ${k.version}`)}</h1>
|
|
7
|
+
<small class="text-muted">${I(k.description)}</small>
|
|
8
|
+
</header>
|
|
9
|
+
</div>
|
|
12
10
|
`;
|
package/public/assets/js/lit.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
1
|
+
var j=globalThis,G=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,rt=Symbol(),Ct=new WeakMap,R=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==rt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(G&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=Ct.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&Ct.set(e,t))}return t}toString(){return this.cssText}},Et=s=>new R(typeof s=="string"?s:s+"",void 0,rt),ot=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((i,r,o)=>i+(n=>{if(n._$cssResult$===!0)return n.cssText;if(typeof n=="number")return n;throw Error("Value passed to 'css' function must be a 'css' function result: "+n+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[o+1],s[0]);return new R(e,s,rt)},xt=(s,t)=>{if(G)s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let i=document.createElement("style"),r=j.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=e.cssText,s.appendChild(i)}},nt=G?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let i of t.cssRules)e+=i.cssText;return Et(e)})(s):s;var{is:Xt,defineProperty:Ft,getOwnPropertyDescriptor:Qt,getOwnPropertyNames:te,getOwnPropertySymbols:ee,getPrototypeOf:se}=Object,z=globalThis,bt=z.trustedTypes,ie=bt?bt.emptyScript:"",re=z.reactiveElementPolyfillSupport,O=(s,t)=>s,at={toAttribute(s,t){switch(t){case Boolean:s=s?ie:null;break;case Object:case Array:s=s==null?s:JSON.stringify(s)}return s},fromAttribute(s,t){let e=s;switch(t){case Boolean:e=s!==null;break;case Number:e=s===null?null:Number(s);break;case Object:case Array:try{e=JSON.parse(s)}catch{e=null}}return e}},Pt=(s,t)=>!Xt(s,t),wt={attribute:!0,type:String,converter:at,reflect:!1,useDefault:!1,hasChanged:Pt};Symbol.metadata??=Symbol("metadata"),z.litPropertyMetadata??=new WeakMap;var g=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??=[]).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=wt){if(e.state&&(e.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=!0),this.elementProperties.set(t,e),!e.noAccessor){let i=Symbol(),r=this.getPropertyDescriptor(t,i,e);r!==void 0&&Ft(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){let{get:r,set:o}=Qt(this.prototype,t)??{get(){return this[e]},set(n){this[e]=n}};return{get:r,set(n){let l=r?.call(this);o?.call(this,n),this.requestUpdate(t,l,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??wt}static _$Ei(){if(this.hasOwnProperty(O("elementProperties")))return;let t=se(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(O("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(O("properties"))){let e=this.properties,i=[...te(e),...ee(e)];for(let r of i)this.createProperty(r,e[r])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[i,r]of e)this.elementProperties.set(i,r)}this._$Eh=new Map;for(let[e,i]of this.elementProperties){let r=this._$Eu(e,i);r!==void 0&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let i=new Set(t.flat(1/0).reverse());for(let r of i)e.unshift(nt(r))}else t!==void 0&&e.push(nt(t));return e}static _$Eu(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.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(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let i of e.keys())this.hasOwnProperty(i)&&(t.set(i,this[i]),delete this[i]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$ET(t,e){let i=this.constructor.elementProperties.get(t),r=this.constructor._$Eu(t,i);if(r!==void 0&&i.reflect===!0){let o=(i.converter?.toAttribute!==void 0?i.converter:at).toAttribute(e,i.type);this._$Em=t,o==null?this.removeAttribute(r):this.setAttribute(r,o),this._$Em=null}}_$AK(t,e){let i=this.constructor,r=i._$Eh.get(t);if(r!==void 0&&this._$Em!==r){let o=i.getPropertyOptions(r),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:at;this._$Em=r;let l=n.fromAttribute(e,o.type);this[r]=l??this._$Ej?.get(r)??l,this._$Em=null}}requestUpdate(t,e,i){if(t!==void 0){let r=this.constructor,o=this[t];if(i??=r.getPropertyOptions(t),!((i.hasChanged??Pt)(o,e)||i.useDefault&&i.reflect&&o===this._$Ej?.get(t)&&!this.hasAttribute(r._$Eu(t,i))))return;this.C(t,e,i)}this.isUpdatePending===!1&&(this._$ES=this._$EP())}C(t,e,{useDefault:i,reflect:r,wrapped:o},n){i&&!(this._$Ej??=new Map).has(t)&&(this._$Ej.set(t,n??e??this[t]),o!==!0||n!==void 0)||(this._$AL.has(t)||(this.hasUpdated||i||(e=void 0),this._$AL.set(t,e)),r===!0&&this._$Em!==t&&(this._$Eq??=new Set).add(t))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!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 i=this.constructor.elementProperties;if(i.size>0)for(let[r,o]of i){let{wrapped:n}=o,l=this[r];n!==!0||this._$AL.has(r)||l===void 0||this.C(r,void 0,o,l)}}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(i=>i.hostUpdate?.()),this.update(e)):this._$EM()}catch(i){throw t=!1,this._$EM(),i}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(t){}firstUpdated(t){}};g.elementStyles=[],g.shadowRootOptions={mode:"open"},g[O("elementProperties")]=new Map,g[O("finalized")]=new Map,re?.({ReactiveElement:g}),(z.reactiveElementVersions??=[]).push("2.1.1");var lt=globalThis,W=lt.trustedTypes,Tt=W?W.createPolicy("lit-html",{createHTML:s=>s}):void 0,ct="$lit$",y=`lit$${Math.random().toFixed(9).slice(2)}$`,dt="?"+y,oe=`<${dt}>`,b=document,L=()=>b.createComment(""),k=s=>s===null||typeof s!="object"&&typeof s!="function",pt=Array.isArray,Ot=s=>pt(s)||typeof s?.[Symbol.iterator]=="function",ht=`[
|
|
2
2
|
\f\r]`,D=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Mt=/-->/g,Ut=/>/g,E=RegExp(`>|${ht}(?:([^\\s"'>=/]+)(${ht}*=${ht}*(?:[^
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ht=/'/g,Nt=/"/g,Dt=/^(?:script|style|textarea|title)$/i,ut=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),X=ut(1),ft=ut(2),Lt=ut(3),m=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Rt=new WeakMap,x=w.createTreeWalker(w,129);function kt(s,t){if(!pt(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Tt!==void 0?Tt.createHTML(t):t}var jt=(s,t)=>{let e=s.length-1,i=[],r,o=t===2?"<svg>":t===3?"<math>":"",n=D;for(let c=0;c<e;c++){let a=s[c],l,p,h=-1,f=0;for(;f<a.length&&(n.lastIndex=f,p=n.exec(a),p!==null);)f=n.lastIndex,n===D?p[1]==="!--"?n=Mt:p[1]!==void 0?n=Ut:p[2]!==void 0?(Dt.test(p[2])&&(r=RegExp("</"+p[2],"g")),n=E):p[3]!==void 0&&(n=E):n===E?p[0]===">"?(n=r??D,h=-1):p[1]===void 0?h=-2:(h=n.lastIndex-p[2].length,l=p[1],n=p[3]===void 0?E:p[3]==='"'?Nt:Ht):n===Nt||n===Ht?n=E:n===Mt||n===Ut?n=D:(n=E,r=void 0);let u=n===E&&s[c+1].startsWith("/>")?" ":"";o+=n===D?a+ne:h>=0?(i.push(l),a.slice(0,h)+lt+a.slice(h)+y+u):a+y+(h===-2?c:u)}return[kt(s,o+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},j=class s{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let o=0,n=0,c=t.length-1,a=this.parts,[l,p]=jt(t,e);if(this.el=s.createElement(l,i),x.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=x.nextNode())!==null&&a.length<c;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(lt)){let f=p[n++],u=r.getAttribute(h).split(y),$=/([.?@])?(.*)/.exec(f);a.push({type:1,index:o,name:$[2],strings:u,ctor:$[1]==="."?q:$[1]==="?"?Z:$[1]==="@"?Y:P}),r.removeAttribute(h)}else h.startsWith(y)&&(a.push({type:6,index:o}),r.removeAttribute(h));if(Dt.test(r.tagName)){let h=r.textContent.split(y),f=h.length-1;if(f>0){r.textContent=W?W.emptyScript:"";for(let u=0;u<f;u++)r.append(h[u],L()),x.nextNode(),a.push({type:2,index:++o});r.append(h[f],L())}}}else if(r.nodeType===8)if(r.data===dt)a.push({type:2,index:o});else{let h=-1;for(;(h=r.data.indexOf(y,h+1))!==-1;)a.push({type:7,index:o}),h+=y.length-1}o++}}static createElement(t,e){let i=w.createElement("template");return i.innerHTML=t,i}};function b(s,t,e=s,i){if(t===m)return t;let r=i!==void 0?e._$Co?.[i]:e._$Cl,o=k(t)?void 0:t._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(s),r._$AT(s,e,i)),i!==void 0?(e._$Co??=[])[i]=r:e._$Cl=r),r!==void 0&&(t=b(s,r._$AS(s,t.values),r,i)),t}var K=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:i}=this._$AD,r=(t?.creationScope??w).importNode(e,!0);x.currentNode=r;let o=x.nextNode(),n=0,c=0,a=i[0];for(;a!==void 0;){if(n===a.index){let l;a.type===2?l=new U(o,o.nextSibling,this,t):a.type===1?l=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(l=new J(o,this,t)),this._$AV.push(l),a=i[++c]}n!==a?.index&&(o=x.nextNode(),n++)}return x.currentNode=w,r}p(t){let e=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}},U=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=b(this,t,e),k(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==m&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ot(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&k(this._$AH)?this._$AA.nextSibling.data=t:this.T(w.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=j.createElement(kt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(e);else{let o=new K(r,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o}}_$AC(t){let e=Rt.get(t.strings);return e===void 0&&Rt.set(t.strings,e=new j(t)),e}k(t){pt(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,i,r=0;for(let o of t)r===e.length?e.push(i=new s(this.O(L()),this.O(L()),this,this.options)):i=e[r],i._$AI(o),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let i=t.nextSibling;t.remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},P=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=d}_$AI(t,e=this,i,r){let o=this.strings,n=!1;if(o===void 0)t=b(this,t,e,0),n=!k(t)||t!==this._$AH&&t!==m,n&&(this._$AH=t);else{let c=t,a,l;for(t=o[0],a=0;a<o.length-1;a++)l=b(this,c[i+a],e,a),l===m&&(l=this._$AH[a]),n||=!k(l)||l!==this._$AH[a],l===d?t=d:t!==d&&(t+=(l??"")+o[a+1]),this._$AH[a]=l}n&&!r&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},q=class extends P{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}},Z=class extends P{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}},Y=class extends P{constructor(t,e,i,r,o){super(t,e,i,r,o),this.type=5}_$AI(t,e=this){if((t=b(this,t,e,0)??d)===m)return;let i=this._$AH,r=t===d&&i!==d||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==d&&(i===d||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},J=class{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){b(this,t)}},Vt={M:lt,P:y,A:dt,C:1,L:jt,R:K,D:Ot,V:b,I:U,H:P,N:Z,U:Y,B:q,F:J},ae=ct.litHtmlPolyfillSupport;ae?.(j,U),(ct.litHtmlVersions??=[]).push("3.3.1");var $t=(s,t,e)=>{let i=e?.renderBefore??t,r=i._$litPart$;if(r===void 0){let o=e?.renderBefore??null;i._$litPart$=r=new U(t.insertBefore(L(),o),o,void 0,e??{})}return r._$AI(s),r};var _t=globalThis,T=class extends v{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=$t(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return m}};T._$litElement$=!0,T.finalized=!0,_t.litElementHydrateSupport?.({LitElement:T});var he=_t.litElementPolyfillSupport;he?.({LitElement:T});(_t.litElementVersions??=[]).push("4.2.1");var S={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},_=s=>(...t)=>({_$litDirective$:s,values:t}),A=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:ce}=Vt,It=s=>s===null||typeof s!="object"&&typeof s!="function";var Gt=s=>s.strings===void 0,Bt=()=>document.createComment(""),H=(s,t,e)=>{let i=s._$AA.parentNode,r=t===void 0?s._$AB:t._$AA;if(e===void 0){let o=i.insertBefore(Bt(),r),n=i.insertBefore(Bt(),r);e=new ce(o,n,s,s.options)}else{let o=e._$AB.nextSibling,n=e._$AM,c=n!==s;if(c){let a;e._$AQ?.(s),e._$AM=s,e._$AP!==void 0&&(a=s._$AU)!==n._$AU&&e._$AP(a)}if(o!==r||c){let a=e._$AA;for(;a!==o;){let l=a.nextSibling;i.insertBefore(a,r),a=l}}}return e},C=(s,t,e=s)=>(s._$AI(t,e),s),le={},F=(s,t=le)=>s._$AH=t,zt=s=>s._$AH,Q=s=>{s._$AR(),s._$AA.remove()};var Wt=(s,t,e)=>{let i=new Map;for(let r=t;r<=e;r++)i.set(s[r],r);return i},Xe=_(class extends A{constructor(s){if(super(s),s.type!==S.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,t,e){let i;e===void 0?e=t:t!==void 0&&(i=t);let r=[],o=[],n=0;for(let c of s)r[n]=i?i(c,n):n,o[n]=e(c,n),n++;return{values:o,keys:r}}render(s,t,e){return this.dt(s,t,e).values}update(s,[t,e,i]){let r=zt(s),{values:o,keys:n}=this.dt(t,e,i);if(!Array.isArray(r))return this.ut=n,o;let c=this.ut??=[],a=[],l,p,h=0,f=r.length-1,u=0,$=o.length-1;for(;h<=f&&u<=$;)if(r[h]===null)h++;else if(r[f]===null)f--;else if(c[h]===n[u])a[u]=C(r[h],o[u]),h++,u++;else if(c[f]===n[$])a[$]=C(r[f],o[$]),f--,$--;else if(c[h]===n[$])a[$]=C(r[h],o[$]),H(s,a[$+1],r[h]),h++,$--;else if(c[f]===n[u])a[u]=C(r[f],o[u]),H(s,r[h],r[f]),f--,u++;else if(l===void 0&&(l=Wt(n,u,$),p=Wt(c,h,f)),l.has(c[h]))if(l.has(c[f])){let g=p.get(n[u]),it=g!==void 0?r[g]:null;if(it===null){let St=H(s,r[h]);C(St,o[u]),a[u]=St}else a[u]=C(it,o[u]),H(s,r[h],it),r[g]=null;u++}else Q(r[f]),f--;else Q(r[h]),h++;for(;u<=$;){let g=H(s,a[$+1]);C(g,o[u]),a[u++]=g}for(;h<=f;){let g=r[h++];g!==null&&Q(g)}return this.ut=n,F(s,a),m}});var os=_(class extends A{constructor(){super(...arguments),this.key=d}render(s,t){return this.key=s,t}update(s,[t,e]){return t!==this.key&&(F(s),this.key=t),e}});var ps=_(class extends A{constructor(s){if(super(s),s.type!==S.ATTRIBUTE||s.name!=="class"||s.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(t=>s[t]).join(" ")+" "}update(s,[t]){if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(let i in t)t[i]&&!this.nt?.has(i)&&this.st.add(i);return this.render(t)}let e=s.element.classList;for(let i of this.st)i in t||(e.remove(i),this.st.delete(i));for(let i in t){let r=!!t[i];r===this.st.has(i)||this.nt?.has(i)||(r?(e.add(i),this.st.add(i)):(e.remove(i),this.st.delete(i)))}return m}});var V=(s,t)=>{let e=s._$AN;if(e===void 0)return!1;for(let i of e)i._$AO?.(t,!1),V(i,t);return!0},tt=s=>{let t,e;do{if((t=s._$AM)===void 0)break;e=t._$AN,e.delete(s),s=t}while(e?.size===0)},Kt=s=>{for(let t;t=s._$AM;s=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(s))break;e.add(s),ue(t)}};function de(s){this._$AN!==void 0?(tt(this),this._$AM=s,Kt(this)):this._$AM=s}function pe(s,t=!1,e=0){let i=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(i))for(let o=e;o<i.length;o++)V(i[o],!1),tt(i[o]);else i!=null&&(V(i,!1),tt(i));else V(this,s)}var ue=s=>{s.type==S.CHILD&&(s._$AP??=pe,s._$AQ??=de)},N=class extends A{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),Kt(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(V(this,t),tt(this))}setValue(t){if(Gt(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var fe=()=>new At,At=class{},mt=new WeakMap,$e=_(class extends N{render(s){return d}update(s,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=s.options?.host,this.rt(this.ct=s.element)),d}rt(s){if(this.isConnected||(s=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=mt.get(t);e===void 0&&(e=new WeakMap,mt.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,s),s!==void 0&&this.G.call(this.ht,s)}else this.G.value=s}get lt(){return typeof this.G=="function"?mt.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var _e=s=>s??d;var et=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},st=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var qt=s=>!It(s)&&typeof s.then=="function",Zt=1073741823,gt=class extends N{constructor(){super(...arguments),this._$Cwt=Zt,this._$Cbt=[],this._$CK=new et(this),this._$CX=new st}render(...t){return t.find(e=>!qt(e))??m}update(t,e){let i=this._$Cbt,r=i.length;this._$Cbt=e;let o=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let c=0;c<e.length&&!(c>this._$Cwt);c++){let a=e[c];if(!qt(a))return this._$Cwt=c,a;c<r&&a===i[c]||(this._$Cwt=Zt,r=0,Promise.resolve(a).then(async l=>{for(;n.get();)await n.get();let p=o.deref();if(p!==void 0){let h=p._$Cbt.indexOf(a);h>-1&&h<p._$Cwt&&(p._$Cwt=h,p.setValue(l))}}))}return m}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},me=_(gt);var M=class extends A{constructor(t){if(super(t),this.it=d,t.type!==S.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===d||t==null)return this._t=void 0,this.it=t;if(t===m)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};M.directiveName="unsafeHTML",M.resultType=1;var Ae=_(M);var B=class extends M{};B.directiveName="unsafeSVG",B.resultType=2;var ge=_(B);var ve=["127.0.0.1","localhost"].includes(window.location.hostname),ye=s=>typeof s!="string"&&"strTag"in s;function Se(s){let t="";for(let e=0;e<=s.length-1;e++)t+=s[e],e<s.length-1&&(t+=`{${e}}`);return t}function Ce(s,t){return s.replace(/\{(\d+)\}/g,(e,i)=>t(i))}var Ee=(s,t,e)=>{let i=Se(s),r=Yt(i,e);return Ce(r,o=>t[o])};function Yt(s,t={}){window.__strings=window.__strings??{};let e=window.__strings[s]?.content;return!e&&ve&&console.log("\u{1F310}",s,t.desc?`(${t.desc})`:""),window.env?.DEBUG_TRANSLATIONS?`__${e??s}`:e??s}var xe=(s,t={})=>s?ye(s)?Ee(s.strings,s.values,t):Yt(s,t):"";var Xt=Symbol.for(""),we=s=>{if(s?.r===Xt)return s?._$litStatic$},be=s=>({_$litStatic$:s,r:Xt});var Jt=new Map,vt=s=>(t,...e)=>{let i=e.length,r,o,n=[],c=[],a,l=0,p=!1;for(;l<i;){for(a=t[l];l<i&&(o=e[l],(r=we(o))!==void 0);)a+=r+t[++l],p=!0;l!==i&&c.push(o),n.push(a),l++}if(l===i&&n.push(t[i]),p){let h=n.join("$$lit$$");(t=Jt.get(h))===void 0&&(n.raw=n,Jt.set(h,t=n)),e=c}return s(t,...e)},Pe=vt(X),ei=vt(ft),si=vt(Lt);var ai=X,hi=ot;var yt=class extends A{#t=null;#e=null;render(t){return d}update(t,[e]){let i=t.element;return this.#e!==i?(this.#e=i,this.#t=e,this.#s()):JSON.stringify(this.#t)!==JSON.stringify(e)&&(this.#t=e,this.#s()),d}async#s(){if(!this.#e||!this.#t)return;let t=this.#e.tagName.toLowerCase();await customElements.whenDefined(t);for(let[e,i]of Object.entries(this.#t))this.#e[e]=i}},li=_(yt);async function di(s){try{window.__strings=await fetch(`/assets/locales/${s}.json`).then(t=>t.json())}catch{window.__strings={}}}export{T as LitElement,ps as classMap,fe as createRef,hi as css,ai as html,_e as ifDefined,os as keyed,li as lazyProps,di as loadLocale,xe as msg,d as nothing,$e as ref,$t as render,Xe as repeat,Pe as staticHtml,ft as svg,Ae as unsafeHTML,ge as unsafeSVG,be as unsafeStatic,me as until};
|
|
3
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ht=/'/g,Nt=/"/g,Dt=/^(?:script|style|textarea|title)$/i,ut=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),X=ut(1),ft=ut(2),Lt=ut(3),_=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Rt=new WeakMap,x=b.createTreeWalker(b,129);function kt(s,t){if(!pt(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Tt!==void 0?Tt.createHTML(t):t}var Vt=(s,t)=>{let e=s.length-1,i=[],r,o=t===2?"<svg>":t===3?"<math>":"",n=D;for(let l=0;l<e;l++){let a=s[l],c,p,h=-1,f=0;for(;f<a.length&&(n.lastIndex=f,p=n.exec(a),p!==null);)f=n.lastIndex,n===D?p[1]==="!--"?n=Mt:p[1]!==void 0?n=Ut:p[2]!==void 0?(Dt.test(p[2])&&(r=RegExp("</"+p[2],"g")),n=E):p[3]!==void 0&&(n=E):n===E?p[0]===">"?(n=r??D,h=-1):p[1]===void 0?h=-2:(h=n.lastIndex-p[2].length,c=p[1],n=p[3]===void 0?E:p[3]==='"'?Nt:Ht):n===Nt||n===Ht?n=E:n===Mt||n===Ut?n=D:(n=E,r=void 0);let u=n===E&&s[l+1].startsWith("/>")?" ":"";o+=n===D?a+oe:h>=0?(i.push(c),a.slice(0,h)+ct+a.slice(h)+y+u):a+y+(h===-2?l:u)}return[kt(s,o+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},V=class s{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let o=0,n=0,l=t.length-1,a=this.parts,[c,p]=Vt(t,e);if(this.el=s.createElement(c,i),x.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=x.nextNode())!==null&&a.length<l;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(ct)){let f=p[n++],u=r.getAttribute(h).split(y),$=/([.?@])?(.*)/.exec(f);a.push({type:1,index:o,name:$[2],strings:u,ctor:$[1]==="."?q:$[1]==="?"?Z:$[1]==="@"?Y:P}),r.removeAttribute(h)}else h.startsWith(y)&&(a.push({type:6,index:o}),r.removeAttribute(h));if(Dt.test(r.tagName)){let h=r.textContent.split(y),f=h.length-1;if(f>0){r.textContent=W?W.emptyScript:"";for(let u=0;u<f;u++)r.append(h[u],L()),x.nextNode(),a.push({type:2,index:++o});r.append(h[f],L())}}}else if(r.nodeType===8)if(r.data===dt)a.push({type:2,index:o});else{let h=-1;for(;(h=r.data.indexOf(y,h+1))!==-1;)a.push({type:7,index:o}),h+=y.length-1}o++}}static createElement(t,e){let i=b.createElement("template");return i.innerHTML=t,i}};function w(s,t,e=s,i){if(t===_)return t;let r=i!==void 0?e._$Co?.[i]:e._$Cl,o=k(t)?void 0:t._$litDirective$;return r?.constructor!==o&&(r?._$AO?.(!1),o===void 0?r=void 0:(r=new o(s),r._$AT(s,e,i)),i!==void 0?(e._$Co??=[])[i]=r:e._$Cl=r),r!==void 0&&(t=w(s,r._$AS(s,t.values),r,i)),t}var K=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:i}=this._$AD,r=(t?.creationScope??b).importNode(e,!0);x.currentNode=r;let o=x.nextNode(),n=0,l=0,a=i[0];for(;a!==void 0;){if(n===a.index){let c;a.type===2?c=new U(o,o.nextSibling,this,t):a.type===1?c=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(c=new J(o,this,t)),this._$AV.push(c),a=i[++l]}n!==a?.index&&(o=x.nextNode(),n++)}return x.currentNode=b,r}p(t){let e=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(t,i,e),e+=i.strings.length-2):i._$AI(t[e])),e++}},U=class s{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(t,e,i,r){this.type=2,this._$AH=d,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cv=r?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=w(this,t,e),k(t)?t===d||t==null||t===""?(this._$AH!==d&&this._$AR(),this._$AH=d):t!==this._$AH&&t!==_&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Ot(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==d&&k(this._$AH)?this._$AA.nextSibling.data=t:this.T(b.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:i}=t,r=typeof i=="number"?this._$AC(t):(i.el===void 0&&(i.el=V.createElement(kt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(e);else{let o=new K(r,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o}}_$AC(t){let e=Rt.get(t.strings);return e===void 0&&Rt.set(t.strings,e=new V(t)),e}k(t){pt(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,i,r=0;for(let o of t)r===e.length?e.push(i=new s(this.O(L()),this.O(L()),this,this.options)):i=e[r],i._$AI(o),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t!==this._$AB;){let i=t.nextSibling;t.remove(),t=i}}setConnected(t){this._$AM===void 0&&(this._$Cv=t,this._$AP?.(t))}},P=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,i,r,o){this.type=1,this._$AH=d,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=o,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=d}_$AI(t,e=this,i,r){let o=this.strings,n=!1;if(o===void 0)t=w(this,t,e,0),n=!k(t)||t!==this._$AH&&t!==_,n&&(this._$AH=t);else{let l=t,a,c;for(t=o[0],a=0;a<o.length-1;a++)c=w(this,l[i+a],e,a),c===_&&(c=this._$AH[a]),n||=!k(c)||c!==this._$AH[a],c===d?t=d:t!==d&&(t+=(c??"")+o[a+1]),this._$AH[a]=c}n&&!r&&this.j(t)}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},q=class extends P{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}},Z=class extends P{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}},Y=class extends P{constructor(t,e,i,r,o){super(t,e,i,r,o),this.type=5}_$AI(t,e=this){if((t=w(this,t,e,0)??d)===_)return;let i=this._$AH,r=t===d&&i!==d||t.capture!==i.capture||t.once!==i.once||t.passive!==i.passive,o=t!==d&&(i===d||r);r&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},J=class{constructor(t,e,i){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(t){w(this,t)}},Bt={M:ct,P:y,A:dt,C:1,L:Vt,R:K,D:Ot,V:w,I:U,H:P,N:Z,U:Y,B:q,F:J},ne=lt.litHtmlPolyfillSupport;ne?.(V,U),(lt.litHtmlVersions??=[]).push("3.3.1");var $t=(s,t,e)=>{let i=e?.renderBefore??t,r=i._$litPart$;if(r===void 0){let o=e?.renderBefore??null;i._$litPart$=r=new U(t.insertBefore(L(),o),o,void 0,e??{})}return r._$AI(s),r};var mt=globalThis,T=class extends g{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=$t(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return _}};T._$litElement$=!0,T.finalized=!0,mt.litElementHydrateSupport?.({LitElement:T});var ae=mt.litElementPolyfillSupport;ae?.({LitElement:T});(mt.litElementVersions??=[]).push("4.2.1");var S={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},m=s=>(...t)=>({_$litDirective$:s,values:t}),A=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,i){this._$Ct=t,this._$AM=e,this._$Ci=i}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var{I:he}=Bt,jt=s=>s===null||typeof s!="object"&&typeof s!="function";var Gt=s=>s.strings===void 0,It=()=>document.createComment(""),H=(s,t,e)=>{let i=s._$AA.parentNode,r=t===void 0?s._$AB:t._$AA;if(e===void 0){let o=i.insertBefore(It(),r),n=i.insertBefore(It(),r);e=new he(o,n,s,s.options)}else{let o=e._$AB.nextSibling,n=e._$AM,l=n!==s;if(l){let a;e._$AQ?.(s),e._$AM=s,e._$AP!==void 0&&(a=s._$AU)!==n._$AU&&e._$AP(a)}if(o!==r||l){let a=e._$AA;for(;a!==o;){let c=a.nextSibling;i.insertBefore(a,r),a=c}}}return e},C=(s,t,e=s)=>(s._$AI(t,e),s),le={},F=(s,t=le)=>s._$AH=t,zt=s=>s._$AH,Q=s=>{s._$AR(),s._$AA.remove()};var Wt=(s,t,e)=>{let i=new Map;for(let r=t;r<=e;r++)i.set(s[r],r);return i},ze=m(class extends A{constructor(s){if(super(s),s.type!==S.CHILD)throw Error("repeat() can only be used in text expressions")}dt(s,t,e){let i;e===void 0?e=t:t!==void 0&&(i=t);let r=[],o=[],n=0;for(let l of s)r[n]=i?i(l,n):n,o[n]=e(l,n),n++;return{values:o,keys:r}}render(s,t,e){return this.dt(s,t,e).values}update(s,[t,e,i]){let r=zt(s),{values:o,keys:n}=this.dt(t,e,i);if(!Array.isArray(r))return this.ut=n,o;let l=this.ut??=[],a=[],c,p,h=0,f=r.length-1,u=0,$=o.length-1;for(;h<=f&&u<=$;)if(r[h]===null)h++;else if(r[f]===null)f--;else if(l[h]===n[u])a[u]=C(r[h],o[u]),h++,u++;else if(l[f]===n[$])a[$]=C(r[f],o[$]),f--,$--;else if(l[h]===n[$])a[$]=C(r[h],o[$]),H(s,a[$+1],r[h]),h++,$--;else if(l[f]===n[u])a[u]=C(r[f],o[u]),H(s,r[h],r[f]),f--,u++;else if(c===void 0&&(c=Wt(n,u,$),p=Wt(l,h,f)),c.has(l[h]))if(c.has(l[f])){let v=p.get(n[u]),it=v!==void 0?r[v]:null;if(it===null){let St=H(s,r[h]);C(St,o[u]),a[u]=St}else a[u]=C(it,o[u]),H(s,r[h],it),r[v]=null;u++}else Q(r[f]),f--;else Q(r[h]),h++;for(;u<=$;){let v=H(s,a[$+1]);C(v,o[u]),a[u++]=v}for(;h<=f;){let v=r[h++];v!==null&&Q(v)}return this.ut=n,F(s,a),_}});var Fe=m(class extends A{constructor(){super(...arguments),this.key=d}render(s,t){return this.key=s,t}update(s,[t,e]){return t!==this.key&&(F(s),this.key=t),e}});var os=m(class extends A{constructor(s){if(super(s),s.type!==S.ATTRIBUTE||s.name!=="class"||s.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(s){return" "+Object.keys(s).filter(t=>s[t]).join(" ")+" "}update(s,[t]){if(this.st===void 0){this.st=new Set,s.strings!==void 0&&(this.nt=new Set(s.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(let i in t)t[i]&&!this.nt?.has(i)&&this.st.add(i);return this.render(t)}let e=s.element.classList;for(let i of this.st)i in t||(e.remove(i),this.st.delete(i));for(let i in t){let r=!!t[i];r===this.st.has(i)||this.nt?.has(i)||(r?(e.add(i),this.st.add(i)):(e.remove(i),this.st.delete(i)))}return _}});var B=(s,t)=>{let e=s._$AN;if(e===void 0)return!1;for(let i of e)i._$AO?.(t,!1),B(i,t);return!0},tt=s=>{let t,e;do{if((t=s._$AM)===void 0)break;e=t._$AN,e.delete(s),s=t}while(e?.size===0)},Kt=s=>{for(let t;t=s._$AM;s=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(s))break;e.add(s),pe(t)}};function ce(s){this._$AN!==void 0?(tt(this),this._$AM=s,Kt(this)):this._$AM=s}function de(s,t=!1,e=0){let i=this._$AH,r=this._$AN;if(r!==void 0&&r.size!==0)if(t)if(Array.isArray(i))for(let o=e;o<i.length;o++)B(i[o],!1),tt(i[o]);else i!=null&&(B(i,!1),tt(i));else B(this,s)}var pe=s=>{s.type==S.CHILD&&(s._$AP??=de,s._$AQ??=ce)},N=class extends A{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,i){super._$AT(t,e,i),Kt(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(B(this,t),tt(this))}setValue(t){if(Gt(this._$Ct))this._$Ct._$AI(t,this);else{let e=[...this._$Ct._$AH];e[this._$Ci]=t,this._$Ct._$AI(e,this,0)}}disconnected(){}reconnected(){}};var ue=()=>new At,At=class{},_t=new WeakMap,fe=m(class extends N{render(s){return d}update(s,[t]){let e=t!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=t,this.ht=s.options?.host,this.rt(this.ct=s.element)),d}rt(s){if(this.isConnected||(s=void 0),typeof this.G=="function"){let t=this.ht??globalThis,e=_t.get(t);e===void 0&&(e=new WeakMap,_t.set(t,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,s),s!==void 0&&this.G.call(this.ht,s)}else this.G.value=s}get lt(){return typeof this.G=="function"?_t.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var $e=s=>s??d;var et=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},st=class{constructor(){this.Y=void 0,this.Z=void 0}get(){return this.Y}pause(){this.Y??=new Promise(t=>this.Z=t)}resume(){this.Z?.(),this.Y=this.Z=void 0}};var qt=s=>!jt(s)&&typeof s.then=="function",Zt=1073741823,vt=class extends N{constructor(){super(...arguments),this._$Cwt=Zt,this._$Cbt=[],this._$CK=new et(this),this._$CX=new st}render(...t){return t.find(e=>!qt(e))??_}update(t,e){let i=this._$Cbt,r=i.length;this._$Cbt=e;let o=this._$CK,n=this._$CX;this.isConnected||this.disconnected();for(let l=0;l<e.length&&!(l>this._$Cwt);l++){let a=e[l];if(!qt(a))return this._$Cwt=l,a;l<r&&a===i[l]||(this._$Cwt=Zt,r=0,Promise.resolve(a).then(async c=>{for(;n.get();)await n.get();let p=o.deref();if(p!==void 0){let h=p._$Cbt.indexOf(a);h>-1&&h<p._$Cwt&&(p._$Cwt=h,p.setValue(c))}}))}return _}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},me=m(vt);var M=class extends A{constructor(t){if(super(t),this.it=d,t.type!==S.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===d||t==null)return this._t=void 0,this.it=t;if(t===_)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};M.directiveName="unsafeHTML",M.resultType=1;var _e=m(M);var I=class extends M{};I.directiveName="unsafeSVG",I.resultType=2;var Ae=m(I);var Jt=Symbol.for(""),ve=s=>{if(s?.r===Jt)return s?._$litStatic$},ge=s=>({_$litStatic$:s,r:Jt});var Yt=new Map,gt=s=>(t,...e)=>{let i=e.length,r,o,n=[],l=[],a,c=0,p=!1;for(;c<i;){for(a=t[c];c<i&&(o=e[c],(r=ve(o))!==void 0);)a+=r+t[++c],p=!0;c!==i&&l.push(o),n.push(a),c++}if(c===i&&n.push(t[i]),p){let h=n.join("$$lit$$");(t=Yt.get(h))===void 0&&(n.raw=n,Yt.set(h,t=n)),e=l}return s(t,...e)},ye=gt(X),qs=gt(ft),Zs=gt(Lt);var Qs=X,ti=ot;var yt=class extends A{#t=null;#e=null;render(t){return d}update(t,[e]){let i=t.element;return this.#e!==i?(this.#e=i,this.#t=e,this.#s()):JSON.stringify(this.#t)!==JSON.stringify(e)&&(this.#t=e,this.#s()),d}async#s(){if(!this.#e||!this.#t)return;let t=this.#e.tagName.toLowerCase();await customElements.whenDefined(t);for(let[e,i]of Object.entries(this.#t))this.#e[e]=i}},si=m(yt);export{T as LitElement,os as classMap,ue as createRef,ti as css,Qs as html,$e as ifDefined,Fe as keyed,si as lazyProps,d as nothing,fe as ref,$t as render,ze as repeat,ye as staticHtml,ft as svg,_e as unsafeHTML,Ae as unsafeSVG,ge as unsafeStatic,me as until};
|
|
4
4
|
/*! Bundled license information:
|
|
5
5
|
|
|
6
6
|
@lit/reactive-element/css-tag.js:
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
function
|
|
1
|
+
function F(a){let e=Array.isArray(a?.strings)?a.strings:[],l=Array.isArray(a?.values)?a.values:[],f=new Set,y=[],v=/(\s)(\.[\w-]+)=\s*$/;for(let o=0;o<e.length;o+=1){let t=e[o]??"",d=t.match(v);if(d&&o<l.length){let n=d[2].slice(1),i=`pds-val-${o}`;t=t.replace(v,`$1data-pds-prop="${n}:${i}"`),f.add(o)}y.push(t),o<l.length&&!f.has(o)&&y.push(`<!--pds-val-${o}-->`)}let s=document.createElement("template");s.innerHTML=y.join("");let r=(o,t)=>{let d=o.parentNode;if(!d)return;if(t==null){d.removeChild(o);return}let b=n=>{if(n!=null){if(n instanceof Node){d.insertBefore(n,o);return}if(Array.isArray(n)){n.forEach(i=>b(i));return}d.insertBefore(document.createTextNode(String(n)),o)}};b(t),d.removeChild(o)},c=document.createTreeWalker(s.content,NodeFilter.SHOW_COMMENT),u=[];for(;c.nextNode();){let o=c.currentNode;o?.nodeValue?.startsWith("pds-val-")&&u.push(o)}return u.forEach(o=>{let t=Number(o.nodeValue.replace("pds-val-",""));r(o,l[t])}),s.content.querySelectorAll("*").forEach(o=>{let t=o.getAttribute("data-pds-prop");if(!t)return;let[d,b]=t.split(":"),n=Number(String(b).replace("pds-val-",""));d&&Number.isInteger(n)&&(o[d]=l[n]),o.removeAttribute("data-pds-prop")}),s.content}var x=class extends EventTarget{constructor(){super(),this.mode=null,this.compiled=null,this.log=()=>{},this.logHandler=null}},L="__PURE_DS_PDS_SINGLETON__",O=typeof globalThis<"u"?globalThis:window,E=O?.[L],h=E&&typeof E.addEventListener=="function"?E:new x;O&&(O[L]=h);typeof h.log!="function"&&(h.log=(a="log",e,...l)=>{if(typeof console>"u")return;let f=typeof console[a]=="function"?console[a].bind(console):typeof console.log=="function"?console.log.bind(console):null;f&&(l.length>0?f(e,...l):f(e))});typeof h.logHandler!="function"&&(h.logHandler=null);function T(a,e){if(e==null)return;if(typeof e=="object"&&Array.isArray(e.strings)&&Array.isArray(e.values)){a.appendChild(F(e));return}if(e instanceof Node){a.appendChild(e);return}if(Array.isArray(e)){e.forEach(f=>T(a,f));return}let l=typeof e=="string"?e:String(e);a.appendChild(document.createTextNode(l))}function V(a){if(!a)return!0;let e=!0,l=r=>{if(!r||typeof r!="object")return"<unknown>";let c=r.tagName?String(r.tagName).toLowerCase():"node",u=r.id?`#${r.id}`:"",g=typeof r.getAttribute=="function"?r.getAttribute("name"):null,o=g?`[name="${g}"]`:"";return`${c}${u}${o}`},f=(r,c)=>{if(!r||typeof r.querySelectorAll!="function")return;let u=Array.from(r.querySelectorAll(":invalid"));if(!u.length)return;let g=u.map(o=>{let t=typeof o.validationMessage=="string"?o.validationMessage:"";return`${l(o)}${t?` \u2014 ${t}`:""}`});h.log("warn",`ask.validateDialogFormTree: invalid controls in ${c}:`,g)},y=(r,c)=>{try{let u=typeof r.reportValidity=="function"?r.reportValidity():r.checkValidity?.()??!0;return u||f(r,c),u}catch(u){return h.log("error",`ask.validateDialogFormTree: validation threw in ${c}`,u),!1}};e=y(a,"host dialog form")&&e;let v=Array.from(a.querySelectorAll("form"));for(let r of v){if(r===a)continue;e=y(r,`nested light DOM form ${l(r)}`)&&e}let s=Array.from(a.querySelectorAll("*"));for(let r of s){let c=r?.shadowRoot;if(!c)continue;let u=Array.from(c.querySelectorAll("form"));for(let g of u)e=y(g,`shadow form under ${l(r)}`)&&e}return e}function k(){let a=navigator.userAgent,e=/Safari/i.test(a),l=/(Chrome|Chromium|CriOS|FxiOS|EdgiOS|OPiOS|Opera)/i.test(a);return e&&!l}function D(a){if(window.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return;let e=window.matchMedia?.("(max-width: 639px)").matches,l=a.classList.contains("dialog-no-scale-animation")?"pds-dialog-fade-enter":e?"pds-dialog-enter-mobile":"pds-dialog-enter";a.style.animation="none",a.offsetWidth,a.style.animation=`${l} var(--transition-normal) ease`,a.addEventListener("animationend",()=>{a.style.animation=""},{once:!0})}function P(a={}){return a?.liquidGlassEffects===!0}async function j(a,e={}){let l={title:"Confirm",type:"confirm",buttons:{ok:{name:"OK",primary:!0},cancel:{name:"Cancel",cancel:!0}}};e={...l,...e};let f=e.buttons&&typeof e.buttons=="object"?e.buttons:l.buttons,y=s=>{if(s==null)return{actionCode:"dismiss",actionKind:"dismiss",button:null};let r=f?.[s]??null,c=s==="ok"?"ok":s==="dismiss"?"dismiss":r?.cancel||s==="cancel"?"cancel":"custom";return{actionCode:s,actionKind:c,button:r}},v=s=>{if(typeof s>"u"||s===null||s===!0)return{allow:!0};if(s===!1)return{allow:!1};if(typeof s=="object"){let r=Object.prototype.hasOwnProperty.call(s,"result")||Object.prototype.hasOwnProperty.call(s,"value");return{allow:s.allow!==!1,hasResult:r,result:Object.prototype.hasOwnProperty.call(s,"result")?s.result:s.value}}return{allow:!!s}};return new Promise(s=>{let r=!1,c=(n,i,{shouldClose:m=!0}={})=>{if(!r&&(r=!0,s(n),!(!m||!i?.open)))try{i.close()}catch(p){h.log("warn","ask: dialog.close() failed",p)}},u=async n=>{if(n.actionKind!=="ok"||typeof e.beforeClose!="function")return{allow:!0};try{let i=await e.beforeClose(n);return v(i)}catch(i){return h.log("error","ask.beforeClose: validation failed",i),{allow:!1}}},g=({actionKind:n,form:i})=>n==="ok"?e.useForm&&i?new FormData(i):!0:!1,o=async({actionCode:n,form:i,submitter:m,originalEvent:p,bypassValidation:S=!1,shouldClose:N=!0})=>{if(r)return;let{actionKind:w,button:q}=y(n),A=i||t.querySelector("form")||null;if(e.useForm&&w==="ok"&&A&&!S&&!V(A))return;let C=g({actionKind:w,form:A}),$=await u({actionCode:n,actionKind:w,dialog:t,form:A,formData:e.useForm&&w==="ok"&&A?C:null,submitter:m,originalEvent:p,options:e,button:q,defaultResult:C});if(!$.allow)return;let M=$.hasResult?$.result:C;c(M,t,{shouldClose:N})},t=document.createElement("dialog");k()&&t.classList.add("dialog-no-scale-animation"),P(e)&&t.classList.add("liquid-glass"),e.size&&t.classList.add(`dialog-${e.size}`),e.type&&t.classList.add(`dialog-${e.type}`),e.class&&(Array.isArray(e.class)?t.classList.add(...e.class):t.classList.add(e.class)),e.maxHeight&&t.style.setProperty("--dialog-max-height",e.maxHeight);let d=Object.entries(f).map(([n,i])=>{let m=i.primary?"btn-primary btn-sm":"btn-outline btn-sm",p=i.cancel?"button":"submit",S=i.formNoValidate?" formnovalidate":"";return`<button type="${p}" class="${m}" value="${n}"${S}>${i.name}</button>`});if(e.useForm){let n=document.createElement("div");T(n,a);let i=n.querySelector("form");if(i){t.innerHTML=`
|
|
2
2
|
<header>
|
|
3
3
|
<h2>${e.title}</h2>
|
|
4
4
|
</header>
|
|
5
|
-
`;let
|
|
5
|
+
`;let m=document.createElement("article");for(m.className="dialog-body";i.firstChild;)m.appendChild(i.firstChild);i.appendChild(m);let p=document.createElement("footer");p.innerHTML=d.join(""),i.appendChild(p),t.appendChild(i)}else t.innerHTML=`
|
|
6
6
|
<header>
|
|
7
7
|
<h2>${e.title}</h2>
|
|
8
8
|
</header>
|
|
@@ -10,7 +10,7 @@ function E(i){let e=Array.isArray(i?.strings)?i.strings:[],c=Array.isArray(i?.va
|
|
|
10
10
|
<footer>
|
|
11
11
|
${d.join("")}
|
|
12
12
|
</footer>
|
|
13
|
-
`,t.querySelector("#msg-container").appendChild(
|
|
13
|
+
`,t.querySelector("#msg-container").appendChild(n)}else{t.innerHTML=`
|
|
14
14
|
<form method="dialog">
|
|
15
15
|
<header>
|
|
16
16
|
<h2>${e.title}</h2>
|
|
@@ -22,4 +22,4 @@ function E(i){let e=Array.isArray(i?.strings)?i.strings:[],c=Array.isArray(i?.va
|
|
|
22
22
|
${d.join("")}
|
|
23
23
|
</footer>
|
|
24
24
|
</form>
|
|
25
|
-
`;let
|
|
25
|
+
`;let n=t.querySelector("#msg-container");T(n,a)}t.addEventListener("click",n=>{let i=n.target.closest('button[value="cancel"]');i&&o({actionCode:"cancel",form:t.querySelector("form"),submitter:i,originalEvent:n})});let b=()=>{let n=t.querySelector("form");if(n){if(n.dataset.askSubmitBound==="true")return;n.dataset.askSubmitBound="true",n.addEventListener("submit",i=>{i.preventDefault();let m=i.submitter?.value??(e.useForm?"ok":void 0),p=!!i.submitter?.hasAttribute("formnovalidate");o({actionCode:m,form:n,submitter:i.submitter,originalEvent:i,bypassValidation:p})})}else requestAnimationFrame(b)};t.addEventListener("cancel",n=>{n.preventDefault(),o({actionCode:"dismiss",form:t.querySelector("form"),originalEvent:n})}),t.addEventListener("close",()=>{r||c(!1,t,{shouldClose:!1}),setTimeout(()=>t.remove(),200)}),document.body.appendChild(t),requestAnimationFrame(b),typeof e.rendered=="function"&&e.rendered(t),t.showModal(),requestAnimationFrame(()=>D(t))})}export{j as ask};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var q="en",r={defaultLocale:q,provider:null,messagesByLocale:new Map,loadingByLocale:new Map,observer:null,reconcileTimer:null,requestedKeys:new Set,textNodeKeyMap:new WeakMap,valueToKeys:new Map},V=e=>!!e&&typeof e!="string"&&typeof e=="object"&&"strTag"in e;function g(e){return String(e||"").trim().toLowerCase()}function C(e){let t=g(e);return t?t.split("-")[0]||t:""}function m(e){let t=g(e);return t||r.defaultLocale}function I(e){let t="";for(let n=0;n<=e.length-1;n+=1)t+=e[n],n<e.length-1&&(t+=`{${n}}`);return t}function x(e,t){return String(e).replace(/\{(\d+)\}/g,(n,o)=>t(Number(o)))}function E(e){if(!e||typeof e!="object")return{};let t={};for(let[n,o]of Object.entries(e)){if(typeof o=="string"){t[n]=o;continue}o&&typeof o=="object"&&typeof o.content=="string"&&(t[n]=o.content)}return t}function F(e){let t=e&&typeof e.provider=="object"&&e.provider?e.provider:null,n=typeof e?.translate=="function"?e.translate:typeof t?.translate=="function"?t.translate:null,o=typeof e?.loadLocale=="function"?e.loadLocale:typeof t?.loadLocale=="function"?t.loadLocale:null,a=typeof e?.setLocale=="function"?e.setLocale:typeof t?.setLocale=="function"?t.setLocale:null;return!n&&!o&&!a?null:{translate:n,loadLocale:o,setLocale:a}}function R(e){let t=g(e);if(!t)return[r.defaultLocale];let n=C(t);return!n||n===t?[t]:[t,n]}function A(e,t){let n=m(e);r.messagesByLocale.set(n,E(t))}function $(e){typeof e=="string"&&e.length>0&&r.requestedKeys.add(e)}function j(e,t){if(typeof e!="string"||!e.length)return;let n=typeof t=="string"?t:String(t||"");n.length&&(r.valueToKeys.has(n)||r.valueToKeys.set(n,new Set),r.valueToKeys.get(n).add(e))}function h(e){let t=R(e);for(let n of t)if(r.messagesByLocale.has(n))return{locale:n,messages:r.messagesByLocale.get(n)};return null}async function _(e,t="explicit"){let n=m(e),o=h(n);if(o)return o.messages;let a=n;if(r.loadingByLocale.has(a))return r.loadingByLocale.get(a);if(!r.provider)return{};let c=r.provider.loadLocale||r.provider.setLocale||null;if(typeof c!="function")return{};let l={locale:n,defaultLocale:r.defaultLocale,reason:t,loadedLocales:Array.from(r.messagesByLocale.keys()),messages:{...h(n)?.messages||{}},load:t==="set-default"||t==="explicit-load"},u;try{u=c(l)}catch{return{}}if(u&&typeof u.then=="function"){let i=u.then(f=>{let s=E(f);return A(n,s),s}).catch(()=>({})).finally(()=>{r.loadingByLocale.delete(a)});return r.loadingByLocale.set(a,i),i}let d=E(u);return A(n,d),d}function W(e){if(!e||typeof e!="object")return"";let n=typeof Element<"u"&&e instanceof Element||e?.nodeType===1?e:null;if(!n)return"";if(n.hasAttribute?.("lang"))return g(n.getAttribute("lang"));let o=n.closest?.("[lang]");return o&&o.getAttribute?g(o.getAttribute("lang")):""}function B(e={}){if(typeof e?.lang=="string"&&e.lang.trim())return m(e.lang);let t=e?.element||e?.scope||e?.host||e?.contextElement||null,n=W(t);if(n)return m(n);if(typeof document<"u"&&document.documentElement){let o=g(document.documentElement.getAttribute("lang"));if(o)return m(o)}return r.defaultLocale}function k(){let e=new Set([r.defaultLocale]);if(typeof document>"u")return e;let t=g(document.documentElement?.getAttribute?.("lang"));t&&e.add(m(t));let n=document.querySelectorAll?.("[lang]")||[];for(let o of n){let a=g(o.getAttribute("lang"));a&&e.add(m(a))}return e}async function D(e){for(let t of e)await _(t,"lang-detected")}function N(e){for(let t of Array.from(r.messagesByLocale.keys()))e.has(t)||r.messagesByLocale.delete(t)}function U(e){let t=String(e||""),n=(t.match(/^\s*/)||[""])[0],o=(t.match(/\s*$/)||[""])[0],a=n.length,c=t.length-o.length,l=c>=a?t.slice(a,c):"";return{leading:n,core:l,trailing:o}}function M(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function J(e,t){let n=typeof e=="string"?e:String(e||""),o=typeof t=="string"?t:String(t||""),a=/\{(\d+)\}/g,c=Array.from(n.matchAll(a));if(!c.length)return n===o?[]:null;let l=[],u="^",d=0;for(let s of c){let y=s.index??0;u+=M(n.slice(d,y)),u+="([\\s\\S]*?)",l.push(Number(s[1])),d=y+s[0].length}u+=M(n.slice(d)),u+="$";let i=new RegExp(u).exec(o);if(!i)return null;let f=[];for(let s=1;s<i.length;s+=1){let y=l[s-1],p=i[s];if(Object.prototype.hasOwnProperty.call(f,y)&&f[y]!==p)return null;f[y]=p}return f}function P(e,t){if(typeof e!="string"||!e.length)return[];let n=[e];for(let[,o]of r.messagesByLocale.entries()){let a=o?.[e];typeof a=="string"&&a.length&&n.push(a)}for(let o of n){let a=J(o,t);if(a)return a}return[]}function H(e){if(!e)return null;let t=r.valueToKeys.get(e);if(t&&t.size>0){for(let o of t)if(r.requestedKeys.has(o))return o}if(r.requestedKeys.has(e))return e;let n=Array.from(r.messagesByLocale.entries());for(let o of r.requestedKeys)for(let[,a]of n)if(a&&a[o]===e)return o;return null}function X(e){if(!e)return null;let t=null;for(let[n,o]of r.valueToKeys.entries()){if(typeof n!="string"||!n.length||n===e)continue;let a=e.indexOf(n);if(a!==-1)for(let c of o){if(!r.requestedKeys.has(c))continue;let l=P(c,n),u={key:c,matchedText:n,start:a,end:a+n.length,values:l};(!t||u.matchedText.length>t.matchedText.length)&&(t=u);break}}return t}async function G(e){if(!e||e.nodeType!==3)return;let t=e.parentElement||null;if(!t)return;let{leading:n,core:o,trailing:a}=U(e.nodeValue);if(!o)return;let c=r.textNodeKeyMap.get(e)||null;if((!c||!r.requestedKeys.has(c))&&(c=H(o)),!c){let s=X(o);if(!s)return;let y=B({element:t});await _(y,"text-node");let p=z(s.key,s.values,{element:t},null),L=s.values.length?x(p,T=>s.values[T]):p,w=o.slice(0,s.start)+L+o.slice(s.end),v=`${n}${w}${a}`;v!==e.nodeValue&&(e.nodeValue=v);return}r.textNodeKeyMap.set(e,c);let l=B({element:t});await _(l,"text-node");let u=P(c,o),d=z(c,u,{element:t},null),i=u.length?x(d,s=>u[s]):d,f=`${n}${i}${a}`;f!==e.nodeValue&&(e.nodeValue=f)}async function Q(){if(typeof document>"u"||r.requestedKeys.size===0)return;let e=document.body||document.documentElement;if(!e||typeof document.createTreeWalker!="function")return;let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(;t.nextNode();)n.push(t.currentNode);for(let o of n)await G(o)}async function Y(){let e=k();await D(e),await Q(),N(e)}function S(){typeof window>"u"||(r.reconcileTimer&&clearTimeout(r.reconcileTimer),r.reconcileTimer=setTimeout(()=>{r.reconcileTimer=null,Y()},16))}function Z(){if(typeof window>"u"||typeof document>"u"||(r.observer&&(r.observer.disconnect(),r.observer=null),typeof MutationObserver!="function"))return;let e=new MutationObserver(()=>{S()});e.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],childList:!0,characterData:!0,subtree:!0}),r.observer=e}function z(e,t=[],n={},o=null){let a=B(n);h(a)||_(a,"msg");let l=h(a)?.messages||{},u=h(r.defaultLocale)?.messages||{},d={key:e,values:t,options:n,locale:a,defaultLocale:r.defaultLocale,messages:l,messagesByLocale:Object.fromEntries(Array.from(r.messagesByLocale.entries())),template:o},i;typeof r.provider?.translate=="function"&&(i=r.provider.translate(d)),i==null&&(i=l[e]),i==null&&(i=u[e]),i==null&&(i=e);let f=typeof i=="string"?i:String(i);if(j(e,f),Array.isArray(t)&&t.length>0){let s=x(f,y=>t[y]);s!==f&&j(e,s)}return f}function K(){let e=h(r.defaultLocale);return{locale:r.defaultLocale,messages:{...e?.messages||{}},loadedLocales:Array.from(r.messagesByLocale.keys()),hasProvider:!!r.provider}}function ee(e=null){return r.observer&&(r.observer.disconnect(),r.observer=null),r.reconcileTimer&&(clearTimeout(r.reconcileTimer),r.reconcileTimer=null),r.defaultLocale=q,r.provider=null,r.messagesByLocale.clear(),r.loadingByLocale.clear(),r.requestedKeys.clear(),r.textNodeKeyMap=new WeakMap,r.valueToKeys.clear(),!e||typeof e!="object"||(typeof e.locale=="string"&&e.locale.trim()&&(r.defaultLocale=m(e.locale)),Object.prototype.hasOwnProperty.call(e,"messages")&&A(r.defaultLocale,e.messages),(Object.prototype.hasOwnProperty.call(e,"provider")||Object.prototype.hasOwnProperty.call(e,"translate")||Object.prototype.hasOwnProperty.call(e,"loadLocale")||Object.prototype.hasOwnProperty.call(e,"setLocale"))&&(r.provider=F(e)),Z(),S()),K()}async function te(e){let t=m(e);return await _(t,"explicit-load"),{...h(t)?.messages||{}}}async function ne(e,{load:t=!0}={}){return r.defaultLocale=m(e),t&&await _(r.defaultLocale,"set-default"),S(),r.defaultLocale}var oe=(e,t,n={})=>{let o=I(e);$(o);let a=z(o,t,n,{strings:e,values:t});return x(a,c=>t[c])},re=(e,...t)=>({strTag:!0,strings:Array.from(e),values:t,raw:Array.from(e?.raw||[])}),ae=(e,t={})=>{if(!e)return"";if(V(e))return oe(e.strings,e.values,t);let n=String(e);$(n);let o=z(n,[],t,null);return!t?.element&&!t?.scope&&!t?.host&&!t?.contextElement&&!t?.lang&&S(),o};function b(e){return String(e||"").trim().toLowerCase()}function O(e){return b(e).split("-")[0]||""}function se(e,t){let n=[],o=new Set,a=c=>{let l=b(c);!l||o.has(l)||(o.add(l),n.push(l))};return Array.isArray(e)&&e.forEach(a),a(t),n}function ce(e={}){let t={};return!e||typeof e!="object"||Object.entries(e).forEach(([n,o])=>{let a=b(n);if(!a)return;let c=[],l=new Set;Array.isArray(o)&&o.forEach(u=>{if(typeof u!="string")return;let d=u.trim();if(!d)return;let i=d.toLowerCase();l.has(i)||(l.add(i),c.push(d))}),t[a]=c}),t}function le(e){return!e||typeof e!="object"||Array.isArray(e)?{}:e}function ie(e){let t=typeof e=="string"?e.trim():"";return t?t==="/"?"":t.replace(/\/+$/,""):"/assets/locales"}function ue({locale:e,effectiveLocale:t,defaultLocale:n,aliases:o}){let a=[],c=new Set,l=f=>{if(typeof f!="string")return;let s=f.trim();if(!s)return;let y=s.toLowerCase();c.has(y)||(c.add(y),a.push(s))},u=b(e),d=O(u),i=O(t);return l(e),l(u),l(d),l(t),l(i),(o[u]||[]).forEach(l),(o[d]||[]).forEach(l),(o[t]||[]).forEach(l),(o[i]||[]).forEach(l),t!==n&&(l(n),(o[n]||[]).forEach(l)),a}function fe(e={}){let t=b(e?.locale||"en")||"en",n=se(e?.locales,t),o=new Set(n),a=ce(e?.aliases||{}),c=e?.cache instanceof Map?e.cache:new Map,l=ie(e?.basePath),u=e?.requestInit&&typeof e.requestInit=="object"?e.requestInit:{},d=f=>{let s=b(f);if(!s)return t;if(o.has(s))return s;let y=O(s);return o.has(y)?y:t},i=async({locale:f})=>{let s=d(f);if(c.has(s))return c.get(s)||{};if(typeof fetch!="function"){let L={};return c.set(s,L),L}let y=ue({locale:f,effectiveLocale:s,defaultLocale:t,aliases:a});for(let L of y)try{let w=l?`${l}/${L}.json`:`/${L}.json`,v=await fetch(w,{headers:{Accept:"application/json"},...u});if(!v.ok)continue;let T=le(await v.json());return c.set(s,T),T}catch{}let p={};return c.set(s,p),p};return{locale:t,locales:[...n],provider:{locales:[...n],loadLocale:i}}}export{ee as configureLocalization,fe as createJSONLocalization,K as getLocalizationState,te as loadLocale,ae as msg,ne as setLocale,re as str};
|