@pure-ds/core 0.7.30 → 0.7.33
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/.github/copilot-instructions.md +20 -11
- package/LOCALIZATION.md +197 -0
- package/dist/types/pds.config.d.ts +1 -1
- package/dist/types/pds.config.d.ts.map +1 -1
- package/dist/types/pds.d.ts +150 -0
- package/dist/types/public/assets/pds/components/pds-form.d.ts +2 -2
- package/dist/types/public/assets/pds/components/pds-form.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-omnibox.d.ts +2 -2
- package/dist/types/public/assets/pds/components/pds-omnibox.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-rating.d.ts +1 -119
- package/dist/types/public/assets/pds/components/pds-rating.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-treeview.d.ts.map +1 -1
- package/dist/types/public/assets/pds/components/pds-upload.d.ts.map +1 -1
- package/dist/types/src/js/common/ask.d.ts.map +1 -1
- package/dist/types/src/js/common/font-loader.d.ts.map +1 -1
- package/dist/types/src/js/common/localization-resource-provider.d.ts +49 -0
- package/dist/types/src/js/common/localization-resource-provider.d.ts.map +1 -0
- package/dist/types/src/js/common/localization.d.ts +25 -0
- package/dist/types/src/js/common/localization.d.ts.map +1 -0
- package/dist/types/src/js/common/msg.d.ts +1 -2
- package/dist/types/src/js/common/msg.d.ts.map +1 -1
- package/dist/types/src/js/common/pds-log.d.ts +3 -0
- package/dist/types/src/js/common/pds-log.d.ts.map +1 -0
- package/dist/types/src/js/lit.d.ts +0 -7
- package/dist/types/src/js/lit.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-config.d.ts +51 -0
- package/dist/types/src/js/pds-core/pds-config.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-enhancers.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-live.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-registry.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-runtime.d.ts.map +1 -1
- package/dist/types/src/js/pds-core/pds-start-helpers.d.ts.map +1 -1
- package/dist/types/src/js/pds-localization.d.ts +3 -0
- package/dist/types/src/js/pds-localization.d.ts.map +1 -0
- package/dist/types/src/js/pds-singleton.d.ts +13 -0
- package/dist/types/src/js/pds-singleton.d.ts.map +1 -0
- package/dist/types/src/js/pds.d.ts +9 -1
- package/dist/types/src/js/pds.d.ts.map +1 -1
- package/package.json +10 -4
- package/packages/pds-cli/README.md +2 -0
- package/packages/pds-cli/lib/pds-mcp-core.js +2 -2
- package/public/assets/js/app.js +9 -11
- package/public/assets/js/lit.js +3 -94
- package/public/assets/js/pds-ask.js +4 -4
- package/public/assets/js/pds-enhancers.js +1 -1
- package/public/assets/js/pds-localization.js +1 -0
- package/public/assets/js/pds-manager.js +118 -118
- package/public/assets/js/pds.js +2 -2
- package/public/assets/pds/components/pds-calendar.js +4 -4
- package/public/assets/pds/components/pds-daterange.js +11 -8
- package/public/assets/pds/components/pds-form.js +22 -22
- package/public/assets/pds/components/pds-live-edit.js +503 -42
- package/public/assets/pds/components/pds-live-importer.js +66 -66
- package/public/assets/pds/components/pds-live-template-canvas.js +3 -3
- package/public/assets/pds/components/pds-omnibox.js +4 -4
- package/public/assets/pds/components/pds-rating.js +5 -3
- package/public/assets/pds/components/pds-tags.js +5 -5
- package/public/assets/pds/components/pds-theme.js +4 -4
- package/public/assets/pds/components/pds-toaster.js +6 -6
- package/public/assets/pds/components/pds-treeview.js +8 -4
- package/public/assets/pds/components/pds-upload.js +7 -6
- package/public/assets/pds/core/pds-ask.js +4 -4
- package/public/assets/pds/core/pds-enhancers.js +1 -1
- package/public/assets/pds/core/pds-localization.js +1 -0
- package/public/assets/pds/core/pds-manager.js +118 -118
- package/public/assets/pds/core.js +2 -2
- package/public/assets/pds/external/lit.js +3 -94
- package/readme.md +34 -6
- package/src/js/common/ask.js +530 -0
- package/src/js/common/common.js +122 -0
- package/src/js/common/font-loader.js +202 -0
- package/src/js/common/localization-resource-provider.js +274 -0
- package/src/js/common/localization.js +839 -0
- package/src/js/common/msg.js +9 -0
- package/src/js/common/pds-core/pds.d.ts +128 -0
- package/src/js/common/pds-log.js +144 -0
- package/src/js/common/toast.js +122 -0
- package/src/js/pds-core/pds-config.js +51 -10
- package/src/js/pds-core/pds-enhancers.js +5 -3
- 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-singleton.js +49 -0
- package/src/js/pds.d.ts +150 -0
- package/src/js/pds.js +420 -40
package/public/assets/js/lit.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
var
|
|
2
|
-
\f\r]`,
|
|
3
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),Ut=/'/g,Nt=/"/g,Dt=/^(?:script|style|textarea|title)$/i,ft=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),F=ft(1),mt=ft(2),It=ft(3),_=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Rt=new WeakMap,C=w.createTreeWalker(w,129);function kt(s,t){if(!ut(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return Mt!==void 0?Mt.createHTML(t):t}var jt=(s,t)=>{let e=s.length-1,i=[],r,o=t===2?"<svg>":t===3?"<math>":"",n=O;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===O?p[1]==="!--"?n=Lt:p[1]!==void 0?n=Ht: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??O,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:Ut):n===Nt||n===Ut?n=E:n===Lt||n===Ht?n=O:(n=E,r=void 0);let u=n===E&&s[l+1].startsWith("/>")?" ":"";o+=n===O?a+he:h>=0?(i.push(c),a.slice(0,h)+dt+a.slice(h)+y+u):a+y+(h===-2?l:u)}return[kt(s,o+(s[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),i]},k=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]=jt(t,e);if(this.el=s.createElement(c,i),C.currentNode=this.el.content,e===2||e===3){let h=this.el.content.firstChild;h.replaceWith(...h.childNodes)}for(;(r=C.nextNode())!==null&&a.length<l;){if(r.nodeType===1){if(r.hasAttributes())for(let h of r.getAttributeNames())if(h.endsWith(dt)){let f=p[n++],u=r.getAttribute(h).split(y),m=/([.?@])?(.*)/.exec(f);a.push({type:1,index:o,name:m[2],strings:u,ctor:m[1]==="."?K:m[1]==="?"?Z:m[1]==="@"?X:T}),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],D()),C.nextNode(),a.push({type:2,index:++o});r.append(h[f],D())}}}else if(r.nodeType===8)if(r.data===pt)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===_)return t;let r=i!==void 0?e._$Co?.[i]:e._$Cl,o=I(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 q=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);C.currentNode=r;let o=C.nextNode(),n=0,l=0,a=i[0];for(;a!==void 0;){if(n===a.index){let c;a.type===2?c=new L(o,o.nextSibling,this,t):a.type===1?c=new a.ctor(o,a.name,a.strings,this,t):a.type===6&&(c=new Y(o,this,t)),this._$AV.push(c),a=i[++l]}n!==a?.index&&(o=C.nextNode(),n++)}return C.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++}},L=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),I(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&&I(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=k.createElement(kt(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===r)this._$AH.p(e);else{let o=new q(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 k(t)),e}k(t){ut(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(D()),this.O(D()),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))}},T=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=!I(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=b(this,l[i+a],e,a),c===_&&(c=this._$AH[a]),n||=!I(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??"")}},K=class extends T{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===d?void 0:t}},Z=class extends T{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d)}},X=class extends T{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)===_)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)}},Y=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:dt,P:y,A:pt,C:1,L:jt,R:q,D:Ot,V:b,I:L,H:T,N:Z,U:X,B:K,F:Y},le=ct.litHtmlPolyfillSupport;le?.(k,L),(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 L(t.insertBefore(D(),o),o,void 0,e??{})}return r._$AI(s),r};var _t=globalThis,P=class extends A{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 _}};P._$litElement$=!0,P.finalized=!0,_t.litElementHydrateSupport?.({LitElement:P});var ce=_t.litElementPolyfillSupport;ce?.({LitElement:P});(_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}),g=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:de}=Vt,zt=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 de(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},x=(s,t,e=s)=>(s._$AI(t,e),s),pe={},J=(s,t=pe)=>s._$AH=t,Wt=s=>s._$AH,Q=s=>{s._$AR(),s._$AA.remove()};var qt=(s,t,e)=>{let i=new Map;for(let r=t;r<=e;r++)i.set(s[r],r);return i},ns=$(class extends g{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=Wt(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,m=o.length-1;for(;h<=f&&u<=m;)if(r[h]===null)h++;else if(r[f]===null)f--;else if(l[h]===n[u])a[u]=x(r[h],o[u]),h++,u++;else if(l[f]===n[m])a[m]=x(r[f],o[m]),f--,m--;else if(l[h]===n[m])a[m]=x(r[h],o[m]),H(s,a[m+1],r[h]),h++,m--;else if(l[f]===n[u])a[u]=x(r[f],o[u]),H(s,r[h],r[f]),f--,u++;else if(c===void 0&&(c=qt(n,u,m),p=qt(l,h,f)),c.has(l[h]))if(c.has(l[f])){let v=p.get(n[u]),rt=v!==void 0?r[v]:null;if(rt===null){let xt=H(s,r[h]);x(xt,o[u]),a[u]=xt}else a[u]=x(rt,o[u]),H(s,r[h],rt),r[v]=null;u++}else Q(r[f]),f--;else Q(r[h]),h++;for(;u<=m;){let v=H(s,a[m+1]);x(v,o[u]),a[u++]=v}for(;h<=f;){let v=r[h++];v!==null&&Q(v)}return this.ut=n,J(s,a),_}});var fs=$(class extends g{constructor(){super(...arguments),this.key=d}render(s,t){return this.key=s,t}update(s,[t,e]){return t!==this.key&&(J(s),this.key=t),e}});var ys=$(class extends g{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 j=(s,t)=>{let e=s._$AN;if(e===void 0)return!1;for(let i of e)i._$AO?.(t,!1),j(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),me(t)}};function ue(s){this._$AN!==void 0?(tt(this),this._$AM=s,Kt(this)):this._$AM=s}function fe(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++)j(i[o],!1),tt(i[o]);else i!=null&&(j(i,!1),tt(i));else j(this,s)}var me=s=>{s.type==S.CHILD&&(s._$AP??=fe,s._$AQ??=ue)},U=class extends g{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&&(j(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 $e=()=>new vt,vt=class{},gt=new WeakMap,_e=$(class extends U{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=gt.get(t);e===void 0&&(e=new WeakMap,gt.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"?gt.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 ge=s=>s??d;var ve=(s,...t)=>({strTag:!0,strings:s,values:t}),Ae=ve;var et=class{constructor(){this.settled=!1,this.promise=new Promise((t,e)=>{this._resolve=t,this._reject=e})}resolve(t){this.settled=!0,this._resolve(t)}reject(t){this.settled=!0,this._reject(t)}};var xe=[];for(let s=0;s<256;s++)xe[s]=(s>>4&15).toString(16)+(s&15).toString(16);var Ce=new et;Ce.resolve();var st=class{constructor(t){this.G=t}disconnect(){this.G=void 0}reconnect(t){this.G=t}deref(){return this.G}},it=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 Xt=s=>!zt(s)&&typeof s.then=="function",Yt=1073741823,At=class extends U{constructor(){super(...arguments),this._$Cwt=Yt,this._$Cbt=[],this._$CK=new st(this),this._$CX=new it}render(...t){return t.find(e=>!Xt(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(!Xt(a))return this._$Cwt=l,a;l<r&&a===i[l]||(this._$Cwt=Yt,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()}},we=$(At);var M=class extends g{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 be=$(M);var V=class extends M{};V.directiveName="unsafeSVG",V.resultType=2;var Te=$(V);var Pe=["127.0.0.1","localhost"].includes(window.location.hostname),Me=s=>typeof s!="string"&&"strTag"in s;function Le(s){let t="";for(let e=0;e<=s.length-1;e++)t+=s[e],e<s.length-1&&(t+=`{${e}}`);return t}function He(s,t){return s.replace(/\{(\d+)\}/g,(e,i)=>t(i))}var Ue=(s,t,e)=>{let i=Le(s),r=Ft(i,e);return He(r,o=>t[o])};function Ft(s,t={}){window.__strings=window.__strings??{};let e=window.__strings[s]?.content;return!e&&Pe&&console.log("\u{1F310}",s,t.desc?`(${t.desc})`:""),window.env?.DEBUG_TRANSLATIONS?`__${e??s}`:e??s}var Ne=(s,t={})=>s?Me(s)?Ue(s.strings,s.values,t):Ft(s,t):"";var Qt=Symbol.for(""),Re=s=>{if(s?.r===Qt)return s?._$litStatic$},Oe=s=>({_$litStatic$:s,r:Qt});var Jt=new Map,yt=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=Re(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=Jt.get(h))===void 0&&(n.raw=n,Jt.set(h,t=n)),e=l}return s(t,...e)},De=yt(F),Fi=yt(mt),Ji=yt(It);var ir=F,rr=nt;var St=class extends g{#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}},nr=$(St);async function ar(s){try{window.__strings=await fetch(`/assets/locales/${s}.json`).then(t=>t.json())}catch{window.__strings={}}}export{P as LitElement,ys as classMap,$e as createRef,rr as css,ir as html,ge as ifDefined,fs as keyed,nr as lazyProps,ar as loadLocale,Ne as msg,d as nothing,_e as ref,$t as render,ns as repeat,De as staticHtml,Ae as str,mt as svg,be as unsafeHTML,Te as unsafeSVG,Oe as unsafeStatic,we as until};
|
|
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
|
+
\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),_=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:
|
|
@@ -94,97 +94,6 @@ lit-html/directives/if-defined.js:
|
|
|
94
94
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
95
95
|
*)
|
|
96
96
|
|
|
97
|
-
@lit/localize/internal/locale-status-event.js:
|
|
98
|
-
(**
|
|
99
|
-
* @license
|
|
100
|
-
* Copyright 2021 Google LLC
|
|
101
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
102
|
-
*)
|
|
103
|
-
|
|
104
|
-
@lit/localize/internal/str-tag.js:
|
|
105
|
-
(**
|
|
106
|
-
* @license
|
|
107
|
-
* Copyright 2021 Google LLC
|
|
108
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
109
|
-
*)
|
|
110
|
-
|
|
111
|
-
@lit/localize/internal/types.js:
|
|
112
|
-
(**
|
|
113
|
-
* @license
|
|
114
|
-
* Copyright 2021 Google LLC
|
|
115
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
116
|
-
*)
|
|
117
|
-
|
|
118
|
-
@lit/localize/internal/default-msg.js:
|
|
119
|
-
(**
|
|
120
|
-
* @license
|
|
121
|
-
* Copyright 2021 Google LLC
|
|
122
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
123
|
-
*)
|
|
124
|
-
|
|
125
|
-
@lit/localize/internal/localized-controller.js:
|
|
126
|
-
(**
|
|
127
|
-
* @license
|
|
128
|
-
* Copyright 2021 Google LLC
|
|
129
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
130
|
-
*)
|
|
131
|
-
|
|
132
|
-
@lit/localize/internal/localized-decorator.js:
|
|
133
|
-
(**
|
|
134
|
-
* @license
|
|
135
|
-
* Copyright 2021 Google LLC
|
|
136
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
137
|
-
*)
|
|
138
|
-
|
|
139
|
-
@lit/localize/internal/deferred.js:
|
|
140
|
-
(**
|
|
141
|
-
* @license
|
|
142
|
-
* Copyright 2020 Google LLC
|
|
143
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
144
|
-
*)
|
|
145
|
-
|
|
146
|
-
@lit/localize/internal/fnv1a64.js:
|
|
147
|
-
(**
|
|
148
|
-
* @license
|
|
149
|
-
* Copyright 2014 Travis Webb
|
|
150
|
-
* SPDX-License-Identifier: MIT
|
|
151
|
-
*)
|
|
152
|
-
|
|
153
|
-
@lit/localize/internal/id-generation.js:
|
|
154
|
-
(**
|
|
155
|
-
* @license
|
|
156
|
-
* Copyright 2020 Google LLC
|
|
157
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
158
|
-
*)
|
|
159
|
-
|
|
160
|
-
@lit/localize/internal/runtime-msg.js:
|
|
161
|
-
(**
|
|
162
|
-
* @license
|
|
163
|
-
* Copyright 2021 Google LLC
|
|
164
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
165
|
-
*)
|
|
166
|
-
|
|
167
|
-
@lit/localize/init/runtime.js:
|
|
168
|
-
(**
|
|
169
|
-
* @license
|
|
170
|
-
* Copyright 2021 Google LLC
|
|
171
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
172
|
-
*)
|
|
173
|
-
|
|
174
|
-
@lit/localize/init/transform.js:
|
|
175
|
-
(**
|
|
176
|
-
* @license
|
|
177
|
-
* Copyright 2021 Google LLC
|
|
178
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
179
|
-
*)
|
|
180
|
-
|
|
181
|
-
@lit/localize/lit-localize.js:
|
|
182
|
-
(**
|
|
183
|
-
* @license
|
|
184
|
-
* Copyright 2020 Google LLC
|
|
185
|
-
* SPDX-License-Identifier: BSD-3-Clause
|
|
186
|
-
*)
|
|
187
|
-
|
|
188
97
|
lit-html/directives/private-async-helpers.js:
|
|
189
98
|
(**
|
|
190
99
|
* @license
|
|
@@ -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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var T=[{selector:".accordion"},{selector:"nav[data-dropdown]"},{selector:"label[data-toggle]"},{selector:"label[data-color]"},{selector:'input[type="range"]'},{selector:"form[data-required]"},{selector:"fieldset[role=group][data-open]"},{selector:"[data-clip]"},{selector:"button, a[class*='btn-']"}];function $(t){t.dataset.enhancedAccordion||(t.dataset.enhancedAccordion="true",t.addEventListener("toggle",e=>{e.target.open&&e.target.parentElement===t&&t.querySelectorAll(":scope > details[open]").forEach(n=>{n!==e.target&&(n.open=!1)})},!0))}function U(t){if(t.dataset.enhancedDropdown)return;t.dataset.enhancedDropdown="true";let e=t.lastElementChild;if(!e)return;let n=t.querySelector("[data-dropdown-toggle]")||t.querySelector("button");n&&!n.hasAttribute("type")&&n.setAttribute("type","button"),e.id||(e.id=`dropdown-${Math.random().toString(36).slice(2,9)}`);let a=e.tagName?.toLowerCase()==="menu",i=8;a&&!e.hasAttribute("role")&&e.setAttribute("role","menu"),e.hasAttribute("aria-hidden")||e.setAttribute("aria-hidden","true"),n&&(n.setAttribute("aria-haspopup","true"),n.setAttribute("aria-controls",e.id),n.setAttribute("aria-expanded","false"));let u=()=>{let r=e.getAttribute("style");e.style.visibility="hidden",e.style.display="inline-block",e.style.pointerEvents="none";let c=e.getBoundingClientRect(),p=Math.max(e.offsetWidth||0,e.scrollWidth||0,c.width||0,1),d=Math.max(e.offsetHeight||0,e.scrollHeight||0,c.height||0,1);return r===null?e.removeAttribute("style"):e.setAttribute("style",r),{width:p,height:d}},s=()=>{let r=(t.getAttribute("data-direction")||t.getAttribute("data-dropdown-direction")||t.getAttribute("data-mode")||"auto").toLowerCase();if(r==="up"||r==="down")return r;let c=(n||t).getBoundingClientRect(),{height:p}=u(),d=Math.max(0,window.innerHeight-c.bottom),g=Math.max(0,c.top),v=d>=p,b=g>=p;return v&&!b?"down":b&&!v?"up":v&&b?"down":g>d?"up":"down"},o=()=>{let r=(t.getAttribute("data-align")||t.getAttribute("data-dropdown-align")||"auto").toLowerCase();if(r==="left"||r==="right"||r==="start"||r==="end")return r==="start"?"left":r==="end"?"right":r;let c=(n||t).getBoundingClientRect(),{width:p}=u(),d=Math.max(0,window.innerWidth-c.left),g=Math.max(0,c.right),v=d>=p,b=g>=p;return v&&!b?"left":b&&!v?"right":v&&b?"left":g>d?"right":"left"},f=(r,c=8)=>{let p=getComputedStyle(t).getPropertyValue(r).trim();if(!p)return c;let d=document.createElement("span");d.style.position="fixed",d.style.visibility="hidden",d.style.pointerEvents="none",d.style.height=p,document.body.appendChild(d);let g=Number.parseFloat(getComputedStyle(d).height);return d.remove(),Number.isFinite(g)?g:c},l=()=>{e.style.removeProperty("position"),e.style.removeProperty("left"),e.style.removeProperty("top"),e.style.removeProperty("right"),e.style.removeProperty("bottom"),e.style.removeProperty("margin-top"),e.style.removeProperty("margin-bottom"),e.style.removeProperty("max-width"),e.style.removeProperty("max-inline-size"),e.style.removeProperty("max-height"),e.style.removeProperty("overflow")},h=r=>{if(!r)return null;if(r.parentElement)return r.parentElement;let c=r.getRootNode?.();return c instanceof ShadowRoot?c.host:null},A=()=>{let r=h(e);for(;r&&r!==document.documentElement;){let c=getComputedStyle(r),p=c.contain||"",d=c.willChange||"";if(c.transform!=="none"||c.perspective!=="none"||c.filter!=="none"||c.backdropFilter!=="none"||p.includes("paint")||p.includes("layout")||p.includes("strict")||p.includes("content")||d.includes("transform")||d.includes("perspective")||d.includes("filter"))return!0;r=h(r)}return!1},m=()=>{e.getAttribute("aria-hidden")==="false"&&(l(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{E()})}))},E=()=>{if(e.getAttribute("aria-hidden")!=="false")return;if(A()){l();return}let r=(n||t).getBoundingClientRect(),c=window.visualViewport,p=c?.width||document.documentElement?.clientWidth||window.innerWidth,d=c?.height||document.documentElement?.clientHeight||window.innerHeight,g=c?.offsetLeft||0,v=c?.offsetTop||0,b=Math.max(1,p-i*2),H=Math.max(1,d-i*2);e.style.maxWidth=`${Math.round(b)}px`,e.style.maxInlineSize=`${Math.round(b)}px`,e.style.maxHeight=`${Math.round(H)}px`,e.style.overflow="auto";let{width:S,height:M}=u(),P=f("--spacing-2",8),R=s(),O=o();t.dataset.dropdownDirection=R,t.dataset.dropdownAlign=O;let k=O==="right"?r.right-S:r.left;S>=b-1?k=g+i:k=Math.max(g+i,Math.min(k,g+p-S-i));let q=R==="up"?r.top-P-M:r.bottom+P;q=Math.max(v+i,Math.min(q,v+d-M-i)),e.style.position="fixed",e.style.left=`${Math.round(k)}px`,e.style.top=`${Math.round(q)}px`,e.style.right="auto",e.style.bottom="auto",e.style.marginTop="0",e.style.marginBottom="0"},y=null,D=()=>{y||(y=()=>E(),window.addEventListener("resize",y),window.addEventListener("scroll",y,!0))},F=()=>{y&&(window.removeEventListener("resize",y),window.removeEventListener("scroll",y,!0),y=null)},x=null,w=null,B=()=>{x||typeof document>"u"||(x=()=>{e.getAttribute("aria-hidden")==="false"&&(t.dataset.dropdownDirection=s(),t.dataset.dropdownAlign=o(),w!==null&&cancelAnimationFrame(w),w=requestAnimationFrame(()=>{w=null,e.getAttribute("aria-hidden")==="false"&&E()}))},document.addEventListener("pds:config-changed",x))},I=()=>{!x||typeof document>"u"||(document.removeEventListener("pds:config-changed",x),x=null,w!==null&&(cancelAnimationFrame(w),w=null))},C=null,N=()=>{t.dataset.dropdownDirection=s(),t.dataset.dropdownAlign=o(),e.setAttribute("aria-hidden","false"),n?.setAttribute("aria-expanded","true"),D(),B(),m(),C||(C=r=>{(r.composedPath?r.composedPath():[r.target]).some(d=>d===t)||L()},setTimeout(()=>{document.addEventListener("click",C)},0))},L=()=>{e.setAttribute("aria-hidden","true"),n?.setAttribute("aria-expanded","false"),F(),I(),l(),C&&(document.removeEventListener("click",C),C=null)},W=()=>{e.getAttribute("aria-hidden")==="false"?L():N()};n?.addEventListener("click",r=>{r.preventDefault(),r.stopPropagation(),W()}),t.addEventListener("keydown",r=>{r.key==="Escape"&&(L(),n?.focus())}),t.addEventListener("focusout",r=>{r.relatedTarget&&((r.composedPath?r.composedPath():[r.relatedTarget]).some(d=>d===t)||L())})}function z(t){if(t.dataset.enhancedToggle)return;t.dataset.enhancedToggle="true";let e=t.querySelector('input[type="checkbox"]');if(!e)return;t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.setAttribute("role","switch"),t.setAttribute("aria-checked",e.checked?"true":"false");let n=document.createElement("span");n.className="toggle-switch",n.setAttribute("role","presentation"),n.setAttribute("aria-hidden","true");let a=document.createElement("span");a.className="toggle-knob",n.appendChild(a),t.insertBefore(n,e.nextSibling);let i=()=>{t.setAttribute("aria-checked",e.checked?"true":"false")},u=()=>{e.disabled||(e.checked=!e.checked,i(),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0})))};t.addEventListener("click",s=>{s.preventDefault(),u()}),t.addEventListener("keydown",s=>{(s.key===" "||s.key==="Enter")&&(s.preventDefault(),u())}),e.addEventListener("change",i)}function V(t){if(t.dataset.enhancedColorInput)return;let e=t.querySelector('input[type="color"]');if(!e)return;t.dataset.enhancedColorInput="true";let n=t.querySelector(":scope > .color-control"),a=t.querySelector(":scope > .color-control > .color-swatch"),i=t.querySelector(":scope > .color-control > output");n||(n=document.createElement("span"),n.className="color-control",e.before(n)),a||(a=document.createElement("span"),a.className="color-swatch",n.appendChild(a)),e.parentElement!==a&&a.appendChild(e),i||(i=document.createElement("output"),n.appendChild(i));let u=()=>{if(e.dataset.colorUnset==="1"){i.value="",i.textContent="not set",n.dataset.value="",n.dataset.unset="1",a.dataset.unset="1";return}i.value=e.value,i.textContent=e.value,n.dataset.value=e.value,delete n.dataset.unset,delete a.dataset.unset};u();let s=()=>{e.dataset.colorUnset==="1"&&(e.dataset.colorUnset="0"),u()};e.addEventListener("input",s,{passive:!0}),e.addEventListener("change",s,{passive:!0})}function j(t){if(t.dataset.enhancedRange)return;let e=s=>{if(t.dataset.enhancedRangeProgrammatic)return;t.dataset.enhancedRangeProgrammatic="1";let o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),"value")||Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");o?.get&&o?.set&&Object.defineProperty(t,"value",{configurable:!0,enumerable:o.enumerable,get(){return o.get.call(this)},set(l){o.set.call(this,l),s()}}),new MutationObserver(l=>{l.some(A=>{let m=A.attributeName;return m==="value"||m==="min"||m==="max"})&&s()}).observe(t,{attributes:!0,attributeFilter:["value","min","max"]})},n=t.closest("label"),a=n?.classList.contains("range-output"),i=t.id||`range-${Math.random().toString(36).substring(2,11)}`,u=`${i}-output`;if(t.id=i,a){let s=n.querySelector("span");if(s&&!s.classList.contains("range-output-wrapper")){let o=document.createElement("span");o.className="range-output-wrapper",o.style.display="flex",o.style.justifyContent="space-between",o.style.alignItems="center";let f=document.createElement("span");f.textContent=s.textContent,o.appendChild(f);let l=document.createElement("output");l.id=u,l.setAttribute("for",i),l.style.color="var(--surface-text-secondary, var(--color-text-secondary))",l.style.fontSize="0.875rem",l.textContent=t.value,o.appendChild(l),s.textContent="",s.appendChild(o);let h=()=>{l.textContent=t.value};t.addEventListener("input",h),t.addEventListener("change",h),e(h),h()}}else{let s=t.closest(".range-container");s||(s=document.createElement("div"),s.className="range-container",t.parentNode?.insertBefore(s,t),s.appendChild(t)),s.style.position="relative";let o=document.createElement("output");o.id=u,o.setAttribute("for",i),o.className="range-bubble",o.setAttribute("aria-live","polite"),s.appendChild(o);let f=()=>{let A=parseFloat(t.min)||0,m=parseFloat(t.max)||100,E=parseFloat(t.value),y=(E-A)/(m-A);o.style.left=`calc(${y*100}% )`,o.textContent=String(E)},l=()=>o.classList.add("visible"),h=()=>o.classList.remove("visible");t.addEventListener("input",f),t.addEventListener("pointerdown",l),t.addEventListener("pointerup",h),t.addEventListener("pointerleave",h),t.addEventListener("focus",l),t.addEventListener("blur",h),t.addEventListener("change",f),e(f),f()}t.dataset.enhancedRange="1"}function G(t){if(t.dataset.enhancedRequired)return;t.dataset.enhancedRequired="true";let e=n=>{let a;if(n.closest("[role$=group]")?a=n.closest("[role$=group]").querySelector("legend"):a=n.closest("label"),!a||a.querySelector(".required-asterisk"))return;let i=document.createElement("span");i.classList.add("required-asterisk"),i.textContent="*",i.style.marginLeft="4px";let u=a.querySelector("span, [data-label]");if(u)u.appendChild(i);else{let o=a.querySelector("input, select, textarea");o?a.insertBefore(i,o):a.appendChild(i)}let s=n.closest("form");if(s&&!s.querySelector(".required-legend")){let o=document.createElement("small");o.classList.add("required-legend"),o.textContent="* Required fields",s.insertBefore(o,s.querySelector(".form-actions")||s.lastElementChild)}};t.querySelectorAll("[required]").forEach(n=>{e(n)})}function _(t){if(t.dataset.enhancedOpenGroup)return;t.dataset.enhancedOpenGroup="true",t.classList.add("flex","flex-wrap","buttons");let e=document.createElement("input");e.type="text",e.placeholder="Add item...",e.classList.add("input-text","input-sm"),e.style.width="auto";let n=()=>t.querySelector('input[type="radio"], input[type="checkbox"]');t.appendChild(e),e.addEventListener("keydown",a=>{if(a.key==="Enter"||a.key==="Tab"){let i=e.value.trim();if(i){a.preventDefault();let u=n(),s=u?.type==="radio"?"radio":"checkbox",o=`open-group-${Math.random().toString(36).substring(2,11)}`,f=document.createElement("label"),l=document.createElement("span");l.setAttribute("data-label",""),l.textContent=i;let h=document.createElement("input");h.type=s,h.name=u?.name||t.getAttribute("data-name")||"open-group",h.value=i,h.id=o,f.appendChild(l),f.appendChild(h),t.insertBefore(f,e),e.value=""}}else if(a.key==="Backspace"&&e.value===""){a.preventDefault();let i=t.querySelectorAll("label");i.length>0&&i[i.length-1].remove()}})}function J(t){if(t.dataset.enhancedClip)return;t.dataset.enhancedClip="true",t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),t.hasAttribute("role")||t.setAttribute("role","button");let e=()=>{let a=t.getAttribute("data-clip-open")==="true";t.setAttribute("aria-expanded",a?"true":"false")},n=()=>{let a=t.getAttribute("data-clip-open")==="true";t.setAttribute("data-clip-open",a?"false":"true"),e()};t.addEventListener("click",a=>{a.defaultPrevented||n()}),t.addEventListener("keydown",a=>{(a.key===" "||a.key==="Enter")&&(a.preventDefault(),n())}),e()}function K(t){if(t.dataset.enhancedBtnWorking)return;t.dataset.enhancedBtnWorking="true";let e=null,n=!1;new MutationObserver(i=>{i.forEach(u=>{if(u.attributeName==="class"){let s=t.classList.contains("btn-working"),o=t.querySelector("pds-icon");if(s)if(o)e||(e=o.getAttribute("icon")),o.setAttribute("icon","circle-notch");else{let f=document.createElement("pds-icon");f.setAttribute("icon","circle-notch"),f.setAttribute("size","sm"),t.insertBefore(f,t.firstChild),n=!0}else u.oldValue?.includes("btn-working")&&o&&(n?(o.remove(),n=!1):e&&(o.setAttribute("icon",e),e=null))}})}).observe(t,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0})}var Q=new Map([[".accordion",$],["nav[data-dropdown]",U],["label[data-toggle]",z],["label[data-color]",V],['input[type="range"]',j],["form[data-required]",G],["fieldset[role=group][data-open]",_],["[data-clip]",J],["button, a[class*='btn-']",K]]),X=T.map(t=>({...t,run:Q.get(t.selector)||(()=>{})}));export{X as defaultPDSEnhancers};
|
|
1
|
+
var se=new Set(["log","warn","error","debug","info"]),ie="__PURE_DS_PDS_SINGLETON__",V=null,H=null;function G(){try{let t=(typeof globalThis<"u"?globalThis:window)?.[ie];if(t&&typeof t=="object")return t}catch{return null}return null}function ce(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 le(e){if(typeof e!="string")return"log";let t=e.toLowerCase();return se.has(t)?t:"log"}function ue(){if(typeof H=="function")try{let t=ce(H());if(t)return t}catch{}let e=G();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 de(){if(typeof V=="function")try{let t=V();if(typeof t=="function")return t}catch{}let e=G();return typeof e?.logHandler=="function"?e.logHandler:null}function U(e,t,...n){if(typeof console>"u")return;let o=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;o&&(n.length>0?o(t,...n):o(t))}function fe(e,t){let n=t?.debug===!0;return!(t?.mode==="static"&&!n||!n&&e!=="error"&&e!=="warn")}function X(e="log",t,...n){let o=le(e),r=ue(),s=de();if(s)try{s.call(r?.thisArg,o,t,...n);return}catch(i){U("error","Custom log handler failed:",i)}fe(o,r)&&U(o,t,...n)}var pe="en",u={defaultLocale:pe,provider:null,messagesByLocale:new Map,loadingByLocale:new Map,observer:null,reconcileTimer:null,requestedKeys:new Set,textNodeKeyMap:new WeakMap,valueToKeys:new Map,missingWarnings:new Set},ge=e=>!!e&&typeof e!="string"&&typeof e=="object"&&"strTag"in e;function E(e){return String(e||"").trim().toLowerCase()}function he(e){let t=E(e);return t?t.split("-")[0]||t:""}function S(e){let t=E(e);return t||u.defaultLocale}function ye(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 O(e,t){return String(e).replace(/\{(\d+)\}/g,(n,o)=>t(Number(o)))}function K(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 me(e){let t=E(e);if(!t)return[u.defaultLocale];let n=he(t);return!n||n===t?[t]:[t,n]}function Y(e,t){let n=S(e);u.messagesByLocale.set(n,K(t))}function Z(e){typeof e=="string"&&e.length>0&&u.requestedKeys.add(e)}function J(e,t){if(typeof e!="string"||!e.length)return;let n=typeof t=="string"?t:String(t||"");n.length&&(u.valueToKeys.has(n)||u.valueToKeys.set(n,new Set),u.valueToKeys.get(n).add(e))}function M(e){let t=me(e);for(let n of t)if(u.messagesByLocale.has(n))return{locale:n,messages:u.messagesByLocale.get(n)};return null}async function B(e,t="explicit"){let n=S(e),o=M(n);if(o)return o.messages;let r=n;if(u.loadingByLocale.has(r))return u.loadingByLocale.get(r);if(!u.provider)return{};let s=u.provider.loadLocale||u.provider.setLocale||null;if(typeof s!="function")return{};let i={locale:n,defaultLocale:u.defaultLocale,reason:t,loadedLocales:Array.from(u.messagesByLocale.keys()),messages:{...M(n)?.messages||{}},load:t==="set-default"||t==="explicit-load"},a;try{a=s(i)}catch{return{}}if(a&&typeof a.then=="function"){let c=a.then(f=>{let p=K(f);return Y(n,p),p}).catch(()=>({})).finally(()=>{u.loadingByLocale.delete(r)});return u.loadingByLocale.set(r,c),c}let d=K(a);return Y(n,d),d}function be(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 E(n.getAttribute("lang"));let o=n.closest?.("[lang]");return o&&o.getAttribute?E(o.getAttribute("lang")):""}function $(e={}){if(typeof e?.lang=="string"&&e.lang.trim())return S(e.lang);let t=e?.element||e?.scope||e?.host||e?.contextElement||null,n=be(t);if(n)return S(n);if(typeof document<"u"&&document.documentElement){let o=E(document.documentElement.getAttribute("lang"));if(o)return S(o)}return u.defaultLocale}function ve(){let e=new Set([u.defaultLocale]);if(typeof document>"u")return e;let t=E(document.documentElement?.getAttribute?.("lang"));t&&e.add(S(t));let n=document.querySelectorAll?.("[lang]")||[];for(let o of n){let r=E(o.getAttribute("lang"));r&&e.add(S(r))}return e}async function Le(e){for(let t of e)await B(t,"lang-detected")}function we(e){for(let t of Array.from(u.messagesByLocale.keys()))e.has(t)||u.messagesByLocale.delete(t)}function xe(e){let t=String(e||""),n=(t.match(/^\s*/)||[""])[0],o=(t.match(/\s*$/)||[""])[0],r=n.length,s=t.length-o.length,i=s>=r?t.slice(r,s):"";return{leading:n,core:i,trailing:o}}function Q(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function _e(e,t){let n=typeof e=="string"?e:String(e||""),o=typeof t=="string"?t:String(t||""),r=/\{(\d+)\}/g,s=Array.from(n.matchAll(r));if(!s.length)return n===o?[]:null;let i=[],a="^",d=0;for(let p of s){let y=p.index??0;a+=Q(n.slice(d,y)),a+="([\\s\\S]*?)",i.push(Number(p[1])),d=y+p[0].length}a+=Q(n.slice(d)),a+="$";let c=new RegExp(a).exec(o);if(!c)return null;let f=[];for(let p=1;p<c.length;p+=1){let y=i[p-1],v=c[p];if(Object.prototype.hasOwnProperty.call(f,y)&&f[y]!==v)return null;f[y]=v}return f}function ee(e,t){if(typeof e!="string"||!e.length)return[];let n=[e];for(let[,o]of u.messagesByLocale.entries()){let r=o?.[e];typeof r=="string"&&r.length&&n.push(r)}for(let o of n){let r=_e(o,t);if(r)return r}return[]}function Ee(e){if(!e)return null;let t=u.valueToKeys.get(e);if(t&&t.size>0){for(let o of t)if(u.requestedKeys.has(o))return o}if(u.requestedKeys.has(e))return e;let n=Array.from(u.messagesByLocale.entries());for(let o of u.requestedKeys)for(let[,r]of n)if(r&&r[o]===e)return o;return null}function Ae(e){if(!e)return null;let t=null;for(let[n,o]of u.valueToKeys.entries()){if(typeof n!="string"||!n.length||n===e)continue;let r=e.indexOf(n);if(r!==-1)for(let s of o){if(!u.requestedKeys.has(s))continue;let i=ee(s,n),a={key:s,matchedText:n,start:r,end:r+n.length,values:i};(!t||a.matchedText.length>t.matchedText.length)&&(t=a);break}}return t}async function Se(e){if(!e||e.nodeType!==3)return;let t=e.parentElement||null;if(!t)return;let{leading:n,core:o,trailing:r}=xe(e.nodeValue);if(!o)return;let s=u.textNodeKeyMap.get(e)||null;if((!s||!u.requestedKeys.has(s))&&(s=Ee(o)),!s){let p=Ae(o);if(!p)return;let y=$({element:t});await B(y,"text-node");let v=R(p.key,p.values,{element:t},null),b=p.values.length?O(v,_=>p.values[_]):v,T=o.slice(0,p.start)+b+o.slice(p.end),k=`${n}${T}${r}`;k!==e.nodeValue&&(e.nodeValue=k);return}u.textNodeKeyMap.set(e,s);let i=$({element:t});await B(i,"text-node");let a=ee(s,o),d=R(s,a,{element:t},null),c=a.length?O(d,p=>a[p]):d,f=`${n}${c}${r}`;f!==e.nodeValue&&(e.nodeValue=f)}async function Ce(){if(typeof document>"u"||u.requestedKeys.size===0)return;let e=document.body||document.documentElement;if(!e||typeof document.createTreeWalker!="function")return;let t=[],n=new Set,o=s=>{!s||n.has(s)||(n.add(s),t.push(s))};o(e);for(let s=0;s<t.length;s+=1){let i=t[s];if(!i||typeof i.querySelectorAll!="function")continue;let a=i.querySelectorAll("*");for(let d of a){let c=d?.shadowRoot;c&&o(c)}}let r=[];for(let s of t){let i=document.createTreeWalker(s,NodeFilter.SHOW_TEXT);for(;i.nextNode();)r.push(i.currentNode)}for(let s of r)await Se(s)}async function Te(){let e=ve();await Le(e),await Ce(),we(e)}function Me(){typeof window>"u"||(u.reconcileTimer&&clearTimeout(u.reconcileTimer),u.reconcileTimer=setTimeout(()=>{u.reconcileTimer=null,Te()},16))}function R(e,t=[],n={},o=null){let r=$(n),s=M(r);s||B(r,"msg");let i=M(r)?.messages||{},a=M(u.defaultLocale)?.messages||{},d={key:e,values:t,options:n,locale:r,defaultLocale:u.defaultLocale,messages:i,messagesByLocale:Object.fromEntries(Array.from(u.messagesByLocale.entries())),template:o},c,f=!!s,p=r===u.defaultLocale;typeof u.provider?.translate=="function"&&(c=u.provider.translate(d));let y=null;if(c==null&&(c=i[e]),c==null&&(c=a[e],y=c==null?null:"default"),c==null&&(c=e,y="key"),f&&!p&&y){let b=`${r}::${e}`;u.missingWarnings.has(b)||(u.missingWarnings.add(b),X("warn",`[i18n] Missing translation for locale "${r}" and key "${e}"; using ${y} fallback.`))}let v=typeof c=="string"?c:String(c);if(J(e,v),Array.isArray(t)&&t.length>0){let b=O(v,T=>t[T]);b!==v&&J(e,b)}return v}var ke=(e,t,n={})=>{let o=ye(e);Z(o);let r=R(o,t,n,{strings:e,values:t});return O(r,s=>t[s])};var D=(e,t={})=>{if(!e)return"";if(ge(e))return ke(e.strings,e.values,t);let n=String(e);Z(n);let o=R(n,[],t,null);return!t?.element&&!t?.scope&&!t?.host&&!t?.contextElement&&!t?.lang&&Me(),o};var qe=[{selector:".accordion"},{selector:"nav[data-dropdown]"},{selector:"label[data-toggle]"},{selector:"label[data-color]"},{selector:'input[type="range"]'},{selector:"form[data-required]"},{selector:"fieldset[role=group][data-open]"},{selector:"[data-clip]"},{selector:"button, a[class*='btn-']"}];function Pe(e){e.dataset.enhancedAccordion||(e.dataset.enhancedAccordion="true",e.addEventListener("toggle",t=>{t.target.open&&t.target.parentElement===e&&e.querySelectorAll(":scope > details[open]").forEach(n=>{n!==t.target&&(n.open=!1)})},!0))}function Oe(e){if(e.dataset.enhancedDropdown)return;e.dataset.enhancedDropdown="true";let t=e.lastElementChild;if(!t)return;let n=e.querySelector("[data-dropdown-toggle]")||e.querySelector("button");n&&!n.hasAttribute("type")&&n.setAttribute("type","button"),t.id||(t.id=`dropdown-${Math.random().toString(36).slice(2,9)}`);let o=t.tagName?.toLowerCase()==="menu",r=8;o&&!t.hasAttribute("role")&&t.setAttribute("role","menu"),t.hasAttribute("aria-hidden")||t.setAttribute("aria-hidden","true"),n&&(n.setAttribute("aria-haspopup","true"),n.setAttribute("aria-controls",t.id),n.setAttribute("aria-expanded","false"));let s=()=>{let l=t.getAttribute("style");t.style.visibility="hidden",t.style.display="inline-block",t.style.pointerEvents="none";let g=t.getBoundingClientRect(),m=Math.max(t.offsetWidth||0,t.scrollWidth||0,g.width||0,1),h=Math.max(t.offsetHeight||0,t.scrollHeight||0,g.height||0,1);return l===null?t.removeAttribute("style"):t.setAttribute("style",l),{width:m,height:h}},i=()=>{let l=(e.getAttribute("data-direction")||e.getAttribute("data-dropdown-direction")||e.getAttribute("data-mode")||"auto").toLowerCase();if(l==="up"||l==="down")return l;let g=(n||e).getBoundingClientRect(),{height:m}=s(),h=Math.max(0,window.innerHeight-g.bottom),L=Math.max(0,g.top),x=h>=m,w=L>=m;return x&&!w?"down":w&&!x?"up":x&&w?"down":L>h?"up":"down"},a=()=>{let l=(e.getAttribute("data-align")||e.getAttribute("data-dropdown-align")||"auto").toLowerCase();if(l==="left"||l==="right"||l==="start"||l==="end")return l==="start"?"left":l==="end"?"right":l;let g=(n||e).getBoundingClientRect(),{width:m}=s(),h=Math.max(0,window.innerWidth-g.left),L=Math.max(0,g.right),x=h>=m,w=L>=m;return x&&!w?"left":w&&!x?"right":x&&w?"left":L>h?"right":"left"},d=(l,g=8)=>{let m=getComputedStyle(e).getPropertyValue(l).trim();if(!m)return g;let h=document.createElement("span");h.style.position="fixed",h.style.visibility="hidden",h.style.pointerEvents="none",h.style.height=m,document.body.appendChild(h);let L=Number.parseFloat(getComputedStyle(h).height);return h.remove(),Number.isFinite(L)?L:g},c=()=>{t.style.removeProperty("position"),t.style.removeProperty("left"),t.style.removeProperty("top"),t.style.removeProperty("right"),t.style.removeProperty("bottom"),t.style.removeProperty("margin-top"),t.style.removeProperty("margin-bottom"),t.style.removeProperty("max-width"),t.style.removeProperty("max-inline-size"),t.style.removeProperty("max-height"),t.style.removeProperty("overflow")},f=l=>{if(!l)return null;if(l.parentElement)return l.parentElement;let g=l.getRootNode?.();return g instanceof ShadowRoot?g.host:null},p=()=>{let l=f(t);for(;l&&l!==document.documentElement;){let g=getComputedStyle(l),m=g.contain||"",h=g.willChange||"";if(g.transform!=="none"||g.perspective!=="none"||g.filter!=="none"||g.backdropFilter!=="none"||m.includes("paint")||m.includes("layout")||m.includes("strict")||m.includes("content")||h.includes("transform")||h.includes("perspective")||h.includes("filter"))return!0;l=f(l)}return!1},y=()=>{t.getAttribute("aria-hidden")==="false"&&(c(),requestAnimationFrame(()=>{requestAnimationFrame(()=>{v()})}))},v=()=>{if(t.getAttribute("aria-hidden")!=="false")return;if(p()){c();return}let l=(n||e).getBoundingClientRect(),g=window.visualViewport,m=g?.width||document.documentElement?.clientWidth||window.innerWidth,h=g?.height||document.documentElement?.clientHeight||window.innerHeight,L=g?.offsetLeft||0,x=g?.offsetTop||0,w=Math.max(1,m-r*2),ae=Math.max(1,h-r*2);t.style.maxWidth=`${Math.round(w)}px`,t.style.maxInlineSize=`${Math.round(w)}px`,t.style.maxHeight=`${Math.round(ae)}px`,t.style.overflow="auto";let{width:z,height:I}=s(),W=d("--spacing-2",8),j=i(),N=a();e.dataset.dropdownDirection=j,e.dataset.dropdownAlign=N;let P=N==="right"?l.right-z:l.left;z>=w-1?P=L+r:P=Math.max(L+r,Math.min(P,L+m-z-r));let F=j==="up"?l.top-W-I:l.bottom+W;F=Math.max(x+r,Math.min(F,x+h-I-r)),t.style.position="fixed",t.style.left=`${Math.round(P)}px`,t.style.top=`${Math.round(F)}px`,t.style.right="auto",t.style.bottom="auto",t.style.marginTop="0",t.style.marginBottom="0"},b=null,T=()=>{b||(b=()=>v(),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0))},k=()=>{b&&(window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0),b=null)},_=null,A=null,te=()=>{_||typeof document>"u"||(_=()=>{t.getAttribute("aria-hidden")==="false"&&(e.dataset.dropdownDirection=i(),e.dataset.dropdownAlign=a(),A!==null&&cancelAnimationFrame(A),A=requestAnimationFrame(()=>{A=null,t.getAttribute("aria-hidden")==="false"&&v()}))},document.addEventListener("pds:config-changed",_))},ne=()=>{!_||typeof document>"u"||(document.removeEventListener("pds:config-changed",_),_=null,A!==null&&(cancelAnimationFrame(A),A=null))},C=null,oe=()=>{e.dataset.dropdownDirection=i(),e.dataset.dropdownAlign=a(),t.setAttribute("aria-hidden","false"),n?.setAttribute("aria-expanded","true"),T(),te(),y(),C||(C=l=>{(l.composedPath?l.composedPath():[l.target]).some(h=>h===e)||q()},setTimeout(()=>{document.addEventListener("click",C)},0))},q=()=>{t.setAttribute("aria-hidden","true"),n?.setAttribute("aria-expanded","false"),k(),ne(),c(),C&&(document.removeEventListener("click",C),C=null)},re=()=>{t.getAttribute("aria-hidden")==="false"?q():oe()};n?.addEventListener("click",l=>{l.preventDefault(),l.stopPropagation(),re()}),e.addEventListener("keydown",l=>{l.key==="Escape"&&(q(),n?.focus())}),e.addEventListener("focusout",l=>{l.relatedTarget&&((l.composedPath?l.composedPath():[l.relatedTarget]).some(h=>h===e)||q())})}function Be(e){if(e.dataset.enhancedToggle)return;e.dataset.enhancedToggle="true";let t=e.querySelector('input[type="checkbox"]');if(!t)return;e.hasAttribute("tabindex")||e.setAttribute("tabindex","0"),e.setAttribute("role","switch"),e.setAttribute("aria-checked",t.checked?"true":"false");let n=document.createElement("span");n.className="toggle-switch",n.setAttribute("role","presentation"),n.setAttribute("aria-hidden","true");let o=document.createElement("span");o.className="toggle-knob",n.appendChild(o),e.insertBefore(n,t.nextSibling);let r=()=>{e.setAttribute("aria-checked",t.checked?"true":"false")},s=()=>{t.disabled||(t.checked=!t.checked,r(),t.dispatchEvent(new Event("input",{bubbles:!0})),t.dispatchEvent(new Event("change",{bubbles:!0})))};e.addEventListener("click",i=>{i.preventDefault(),s()}),e.addEventListener("keydown",i=>{(i.key===" "||i.key==="Enter")&&(i.preventDefault(),s())}),t.addEventListener("change",r)}function Re(e){if(e.dataset.enhancedColorInput)return;let t=e.querySelector('input[type="color"]');if(!t)return;e.dataset.enhancedColorInput="true";let n=e.querySelector(":scope > .color-control"),o=e.querySelector(":scope > .color-control > .color-swatch"),r=e.querySelector(":scope > .color-control > output");n||(n=document.createElement("span"),n.className="color-control",t.before(n)),o||(o=document.createElement("span"),o.className="color-swatch",n.appendChild(o)),t.parentElement!==o&&o.appendChild(t),r||(r=document.createElement("output"),n.appendChild(r));let s=()=>{if(t.dataset.colorUnset==="1"){r.value="",r.textContent=D("not set"),n.dataset.value="",n.dataset.unset="1",o.dataset.unset="1";return}r.value=t.value,r.textContent=t.value,n.dataset.value=t.value,delete n.dataset.unset,delete o.dataset.unset};s();let i=()=>{t.dataset.colorUnset==="1"&&(t.dataset.colorUnset="0"),s()};t.addEventListener("input",i,{passive:!0}),t.addEventListener("change",i,{passive:!0})}function De(e){if(e.dataset.enhancedRange)return;let t=i=>{if(e.dataset.enhancedRangeProgrammatic)return;e.dataset.enhancedRangeProgrammatic="1";let a=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),"value")||Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");a?.get&&a?.set&&Object.defineProperty(e,"value",{configurable:!0,enumerable:a.enumerable,get(){return a.get.call(this)},set(c){a.set.call(this,c),i()}}),new MutationObserver(c=>{c.some(p=>{let y=p.attributeName;return y==="value"||y==="min"||y==="max"})&&i()}).observe(e,{attributes:!0,attributeFilter:["value","min","max"]})},n=e.closest("label"),o=n?.classList.contains("range-output"),r=e.id||`range-${Math.random().toString(36).substring(2,11)}`,s=`${r}-output`;if(e.id=r,o){let i=n.querySelector("span");if(i&&!i.classList.contains("range-output-wrapper")){let a=document.createElement("span");a.className="range-output-wrapper",a.style.display="flex",a.style.justifyContent="space-between",a.style.alignItems="center";let d=document.createElement("span");d.textContent=i.textContent,a.appendChild(d);let c=document.createElement("output");c.id=s,c.setAttribute("for",r),c.style.color="var(--surface-text-secondary, var(--color-text-secondary))",c.style.fontSize="0.875rem",c.textContent=e.value,a.appendChild(c),i.textContent="",i.appendChild(a);let f=()=>{c.textContent=e.value};e.addEventListener("input",f),e.addEventListener("change",f),t(f),f()}}else{let i=e.closest(".range-container");i||(i=document.createElement("div"),i.className="range-container",e.parentNode?.insertBefore(i,e),i.appendChild(e)),i.style.position="relative";let a=document.createElement("output");a.id=s,a.setAttribute("for",r),a.className="range-bubble",a.setAttribute("aria-live","polite"),i.appendChild(a);let d=()=>{let p=parseFloat(e.min)||0,y=parseFloat(e.max)||100,v=parseFloat(e.value),b=(v-p)/(y-p);a.style.left=`calc(${b*100}% )`,a.textContent=String(v)},c=()=>a.classList.add("visible"),f=()=>a.classList.remove("visible");e.addEventListener("input",d),e.addEventListener("pointerdown",c),e.addEventListener("pointerup",f),e.addEventListener("pointerleave",f),e.addEventListener("focus",c),e.addEventListener("blur",f),e.addEventListener("change",d),t(d),d()}e.dataset.enhancedRange="1"}function ze(e){if(e.dataset.enhancedRequired)return;e.dataset.enhancedRequired="true";let t=n=>{let o;if(n.closest("[role$=group]")?o=n.closest("[role$=group]").querySelector("legend"):o=n.closest("label"),!o||o.querySelector(".required-asterisk"))return;let r=document.createElement("span");r.classList.add("required-asterisk"),r.textContent="*",r.style.marginLeft="4px";let s=o.querySelector("span, [data-label]");if(s)s.appendChild(r);else{let a=o.querySelector("input, select, textarea");a?o.insertBefore(r,a):o.appendChild(r)}let i=n.closest("form");if(i&&!i.querySelector(".required-legend")){let a=document.createElement("small");a.classList.add("required-legend"),a.textContent=D("* Required fields"),i.insertBefore(a,i.querySelector(".form-actions")||i.lastElementChild)}};e.querySelectorAll("[required]").forEach(n=>{t(n)})}function Fe(e){if(e.dataset.enhancedOpenGroup)return;e.dataset.enhancedOpenGroup="true",e.classList.add("flex","flex-wrap","buttons");let t=document.createElement("input");t.type="text",t.placeholder=D("Add item..."),t.classList.add("input-text","input-sm"),t.style.width="auto";let n=()=>e.querySelector('input[type="radio"], input[type="checkbox"]');e.appendChild(t),t.addEventListener("keydown",o=>{if(o.key==="Enter"||o.key==="Tab"){let r=t.value.trim();if(r){o.preventDefault();let s=n(),i=s?.type==="radio"?"radio":"checkbox",a=`open-group-${Math.random().toString(36).substring(2,11)}`,d=document.createElement("label"),c=document.createElement("span");c.setAttribute("data-label",""),c.textContent=r;let f=document.createElement("input");f.type=i,f.name=s?.name||e.getAttribute("data-name")||"open-group",f.value=r,f.id=a,d.appendChild(c),d.appendChild(f),e.insertBefore(d,t),t.value=""}}else if(o.key==="Backspace"&&t.value===""){o.preventDefault();let r=e.querySelectorAll("label");r.length>0&&r[r.length-1].remove()}})}function Ke(e){if(e.dataset.enhancedClip)return;e.dataset.enhancedClip="true",e.hasAttribute("tabindex")||e.setAttribute("tabindex","0"),e.hasAttribute("role")||e.setAttribute("role","button");let t=()=>{let o=e.getAttribute("data-clip-open")==="true";e.setAttribute("aria-expanded",o?"true":"false")},n=()=>{let o=e.getAttribute("data-clip-open")==="true";e.setAttribute("data-clip-open",o?"false":"true"),t()};e.addEventListener("click",o=>{o.defaultPrevented||n()}),e.addEventListener("keydown",o=>{(o.key===" "||o.key==="Enter")&&(o.preventDefault(),n())}),t()}function $e(e){if(e.dataset.enhancedBtnWorking)return;e.dataset.enhancedBtnWorking="true";let t=null,n=!1;new MutationObserver(r=>{r.forEach(s=>{if(s.attributeName==="class"){let i=e.classList.contains("btn-working"),a=e.querySelector("pds-icon");if(i)if(a)t||(t=a.getAttribute("icon")),a.setAttribute("icon","circle-notch");else{let d=document.createElement("pds-icon");d.setAttribute("icon","circle-notch"),d.setAttribute("size","sm"),e.insertBefore(d,e.firstChild),n=!0}else s.oldValue?.includes("btn-working")&&a&&(n?(a.remove(),n=!1):t&&(a.setAttribute("icon",t),t=null))}})}).observe(e,{attributes:!0,attributeFilter:["class"],attributeOldValue:!0})}var Ie=new Map([[".accordion",Pe],["nav[data-dropdown]",Oe],["label[data-toggle]",Be],["label[data-color]",Re],['input[type="range"]',De],["form[data-required]",ze],["fieldset[role=group][data-open]",Fe],["[data-clip]",Ke],["button, a[class*='btn-']",$e]]),We=qe.map(e=>({...e,run:Ie.get(e.selector)||(()=>{})}));export{We as defaultPDSEnhancers};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var W=new Set(["log","warn","error","debug","info"]),F="__PURE_DS_PDS_SINGLETON__",j=null,M=null;function q(){try{let t=(typeof globalThis<"u"?globalThis:window)?.[F];if(t&&typeof t=="object")return t}catch{return null}return null}function k(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 N(e){if(typeof e!="string")return"log";let t=e.toLowerCase();return W.has(t)?t:"log"}function U(){if(typeof M=="function")try{let t=k(M());if(t)return t}catch{}let e=q();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 G(){if(typeof j=="function")try{let t=j();if(typeof t=="function")return t}catch{}let e=q();return typeof e?.logHandler=="function"?e.logHandler:null}function P(e,t,...n){if(typeof console>"u")return;let o=typeof console[e]=="function"?console[e].bind(console):typeof console.log=="function"?console.log.bind(console):null;o&&(n.length>0?o(t,...n):o(t))}function H(e,t){let n=t?.debug===!0;return!(t?.mode==="static"&&!n||!n&&e!=="error"&&e!=="warn")}function $(e="log",t,...n){let o=N(e),s=U(),l=G();if(l)try{l.call(s?.thisArg,o,t,...n);return}catch(a){P("error","Custom log handler failed:",a)}H(o,s)&&P(o,t,...n)}var D="en",r={defaultLocale:D,provider:null,messagesByLocale:new Map,loadingByLocale:new Map,observer:null,reconcileTimer:null,requestedKeys:new Set,textNodeKeyMap:new WeakMap,valueToKeys:new Map,missingWarnings:new Set},J=e=>!!e&&typeof e!="string"&&typeof e=="object"&&"strTag"in e;function _(e){return String(e||"").trim().toLowerCase()}function X(e){let t=_(e);return t?t.split("-")[0]||t:""}function m(e){let t=_(e);return t||r.defaultLocale}function Y(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 T(e,t){return String(e).replace(/\{(\d+)\}/g,(n,o)=>t(Number(o)))}function A(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 Q(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,s=typeof e?.setLocale=="function"?e.setLocale:typeof t?.setLocale=="function"?t.setLocale:null;return!n&&!o&&!s?null:{translate:n,loadLocale:o,setLocale:s}}function Z(e){let t=_(e);if(!t)return[r.defaultLocale];let n=X(t);return!n||n===t?[t]:[t,n]}function E(e,t){let n=m(e);r.messagesByLocale.set(n,A(t))}function R(e){typeof e=="string"&&e.length>0&&r.requestedKeys.add(e)}function C(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 b(e){let t=Z(e);for(let n of t)if(r.messagesByLocale.has(n))return{locale:n,messages:r.messagesByLocale.get(n)};return null}async function S(e,t="explicit"){let n=m(e),o=b(n);if(o)return o.messages;let s=n;if(r.loadingByLocale.has(s))return r.loadingByLocale.get(s);if(!r.provider)return{};let l=r.provider.loadLocale||r.provider.setLocale||null;if(typeof l!="function")return{};let a={locale:n,defaultLocale:r.defaultLocale,reason:t,loadedLocales:Array.from(r.messagesByLocale.keys()),messages:{...b(n)?.messages||{}},load:t==="set-default"||t==="explicit-load"},u;try{u=l(a)}catch{return{}}if(u&&typeof u.then=="function"){let i=u.then(g=>{let c=A(g);return E(n,c),c}).catch(()=>({})).finally(()=>{r.loadingByLocale.delete(s)});return r.loadingByLocale.set(s,i),i}let d=A(u);return E(n,d),d}function ee(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 _(n.getAttribute("lang"));let o=n.closest?.("[lang]");return o&&o.getAttribute?_(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=ee(t);if(n)return m(n);if(typeof document<"u"&&document.documentElement){let o=_(document.documentElement.getAttribute("lang"));if(o)return m(o)}return r.defaultLocale}function te(){let e=new Set([r.defaultLocale]);if(typeof document>"u")return e;let t=_(document.documentElement?.getAttribute?.("lang"));t&&e.add(m(t));let n=document.querySelectorAll?.("[lang]")||[];for(let o of n){let s=_(o.getAttribute("lang"));s&&e.add(m(s))}return e}async function ne(e){for(let t of e)await S(t,"lang-detected")}function oe(e){for(let t of Array.from(r.messagesByLocale.keys()))e.has(t)||r.messagesByLocale.delete(t)}function re(e){let t=String(e||""),n=(t.match(/^\s*/)||[""])[0],o=(t.match(/\s*$/)||[""])[0],s=n.length,l=t.length-o.length,a=l>=s?t.slice(s,l):"";return{leading:n,core:a,trailing:o}}function V(e){return String(e||"").replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function se(e,t){let n=typeof e=="string"?e:String(e||""),o=typeof t=="string"?t:String(t||""),s=/\{(\d+)\}/g,l=Array.from(n.matchAll(s));if(!l.length)return n===o?[]:null;let a=[],u="^",d=0;for(let c of l){let f=c.index??0;u+=V(n.slice(d,f)),u+="([\\s\\S]*?)",a.push(Number(c[1])),d=f+c[0].length}u+=V(n.slice(d)),u+="$";let i=new RegExp(u).exec(o);if(!i)return null;let g=[];for(let c=1;c<i.length;c+=1){let f=a[c-1],y=i[c];if(Object.prototype.hasOwnProperty.call(g,f)&&g[f]!==y)return null;g[f]=y}return g}function I(e,t){if(typeof e!="string"||!e.length)return[];let n=[e];for(let[,o]of r.messagesByLocale.entries()){let s=o?.[e];typeof s=="string"&&s.length&&n.push(s)}for(let o of n){let s=se(o,t);if(s)return s}return[]}function le(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[,s]of n)if(s&&s[o]===e)return o;return null}function ce(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 s=e.indexOf(n);if(s!==-1)for(let l of o){if(!r.requestedKeys.has(l))continue;let a=I(l,n),u={key:l,matchedText:n,start:s,end:s+n.length,values:a};(!t||u.matchedText.length>t.matchedText.length)&&(t=u);break}}return t}async function ae(e){if(!e||e.nodeType!==3)return;let t=e.parentElement||null;if(!t)return;let{leading:n,core:o,trailing:s}=re(e.nodeValue);if(!o)return;let l=r.textNodeKeyMap.get(e)||null;if((!l||!r.requestedKeys.has(l))&&(l=le(o)),!l){let c=ce(o);if(!c)return;let f=B({element:t});await S(f,"text-node");let y=x(c.key,c.values,{element:t},null),p=c.values.length?T(y,w=>c.values[w]):y,L=o.slice(0,c.start)+p+o.slice(c.end),h=`${n}${L}${s}`;h!==e.nodeValue&&(e.nodeValue=h);return}r.textNodeKeyMap.set(e,l);let a=B({element:t});await S(a,"text-node");let u=I(l,o),d=x(l,u,{element:t},null),i=u.length?T(d,c=>u[c]):d,g=`${n}${i}${s}`;g!==e.nodeValue&&(e.nodeValue=g)}async function ie(){if(typeof document>"u"||r.requestedKeys.size===0)return;let e=document.body||document.documentElement;if(!e||typeof document.createTreeWalker!="function")return;let t=[],n=new Set,o=l=>{!l||n.has(l)||(n.add(l),t.push(l))};o(e);for(let l=0;l<t.length;l+=1){let a=t[l];if(!a||typeof a.querySelectorAll!="function")continue;let u=a.querySelectorAll("*");for(let d of u){let i=d?.shadowRoot;i&&o(i)}}let s=[];for(let l of t){let a=document.createTreeWalker(l,NodeFilter.SHOW_TEXT);for(;a.nextNode();)s.push(a.currentNode)}for(let l of s)await ae(l)}async function ue(){let e=te();await ne(e),await ie(),oe(e)}function z(){typeof window>"u"||(r.reconcileTimer&&clearTimeout(r.reconcileTimer),r.reconcileTimer=setTimeout(()=>{r.reconcileTimer=null,ue()},16))}function fe(){if(typeof window>"u"||typeof document>"u"||(r.observer&&(r.observer.disconnect(),r.observer=null),typeof MutationObserver!="function"))return;let e=new MutationObserver(()=>{z()});e.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"],childList:!0,characterData:!0,subtree:!0}),r.observer=e}function x(e,t=[],n={},o=null){let s=B(n),l=b(s);l||S(s,"msg");let a=b(s)?.messages||{},u=b(r.defaultLocale)?.messages||{},d={key:e,values:t,options:n,locale:s,defaultLocale:r.defaultLocale,messages:a,messagesByLocale:Object.fromEntries(Array.from(r.messagesByLocale.entries())),template:o},i,g=!!l,c=s===r.defaultLocale;typeof r.provider?.translate=="function"&&(i=r.provider.translate(d));let f=null;if(i==null&&(i=a[e]),i==null&&(i=u[e],f=i==null?null:"default"),i==null&&(i=e,f="key"),g&&!c&&f){let p=`${s}::${e}`;r.missingWarnings.has(p)||(r.missingWarnings.add(p),$("warn",`[i18n] Missing translation for locale "${s}" and key "${e}"; using ${f} fallback.`))}let y=typeof i=="string"?i:String(i);if(C(e,y),Array.isArray(t)&&t.length>0){let p=T(y,L=>t[L]);p!==y&&C(e,p)}return y}function K(){let e=b(r.defaultLocale);return{locale:r.defaultLocale,messages:{...e?.messages||{}},loadedLocales:Array.from(r.messagesByLocale.keys()),hasProvider:!!r.provider}}function de(e=null){return r.observer&&(r.observer.disconnect(),r.observer=null),r.reconcileTimer&&(clearTimeout(r.reconcileTimer),r.reconcileTimer=null),r.defaultLocale=D,r.provider=null,r.messagesByLocale.clear(),r.loadingByLocale.clear(),r.requestedKeys.clear(),r.textNodeKeyMap=new WeakMap,r.valueToKeys.clear(),r.missingWarnings.clear(),!e||typeof e!="object"||(typeof e.locale=="string"&&e.locale.trim()&&(r.defaultLocale=m(e.locale)),Object.prototype.hasOwnProperty.call(e,"messages")&&E(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=Q(e)),fe(),z()),K()}async function ge(e){let t=m(e);return await S(t,"explicit-load"),{...b(t)?.messages||{}}}async function pe(e,{load:t=!0}={}){return r.defaultLocale=m(e),t&&await S(r.defaultLocale,"set-default"),z(),r.defaultLocale}var ye=(e,t,n={})=>{let o=Y(e);R(o);let s=x(o,t,n,{strings:e,values:t});return T(s,l=>t[l])},me=(e,...t)=>({strTag:!0,strings:Array.from(e),values:t,raw:Array.from(e?.raw||[])}),Le=(e,t={})=>{if(!e)return"";if(J(e))return ye(e.strings,e.values,t);let n=String(e);R(n);let o=x(n,[],t,null);return!t?.element&&!t?.scope&&!t?.host&&!t?.contextElement&&!t?.lang&&z(),o};function v(e){return String(e||"").trim().toLowerCase()}function O(e){return v(e).split("-")[0]||""}function he(e,t){let n=[],o=new Set,s=l=>{let a=v(l);!a||o.has(a)||(o.add(a),n.push(a))};return Array.isArray(e)&&e.forEach(s),s(t),n}function _e(e={}){let t={};return!e||typeof e!="object"||Object.entries(e).forEach(([n,o])=>{let s=v(n);if(!s)return;let l=[],a=new Set;Array.isArray(o)&&o.forEach(u=>{if(typeof u!="string")return;let d=u.trim();if(!d)return;let i=d.toLowerCase();a.has(i)||(a.add(i),l.push(d))}),t[s]=l}),t}function be(e){return!e||typeof e!="object"||Array.isArray(e)?{}:e}function we(e){let t=typeof e=="string"?e.trim():"";return t?t==="/"?"":t.replace(/\/+$/,""):"/assets/locales"}function Se({locale:e,effectiveLocale:t,defaultLocale:n,aliases:o}){let s=[],l=new Set,a=c=>{if(typeof c!="string")return;let f=c.trim();if(!f)return;let y=f.toLowerCase();l.has(y)||(l.add(y),s.push(f))},u=c=>{let f=Array.isArray(o?.[c])?o[c]:[];if(!f.length)return;[...f].sort((p,L)=>{let h=String(p||"").includes("-"),w=String(L||"").includes("-");return h===w?0:h?-1:1}).forEach(a)},d=v(e),i=O(d),g=O(t);return u(d),u(i),u(t),u(g),a(e),a(d),a(i),a(t),a(g),t!==n&&(u(n),a(n)),s}function ve(e={}){let t=v(e?.locale||"en")||"en",n=he(e?.locales,t),o=new Set(n),s=_e(e?.aliases||{}),l=e?.cache instanceof Map?e.cache:new Map,a=we(e?.basePath),u=e?.requestInit&&typeof e.requestInit=="object"?e.requestInit:{},d=g=>{let c=v(g);if(!c)return t;if(o.has(c))return c;let f=O(c);return o.has(f)?f:t},i=async({locale:g})=>{let c=d(g);if(l.has(c))return l.get(c)||{};if(c===t){let p={};return l.set(c,p),p}if(typeof fetch!="function"){let p={};return l.set(c,p),p}let f=Se({locale:g,effectiveLocale:c,defaultLocale:t,aliases:s});for(let p of f)try{let L=a?`${a}/${p}.json`:`/${p}.json`,h=await fetch(L,{headers:{Accept:"application/json"},...u});if(!h.ok)continue;let w=be(await h.json());return l.set(c,w),w}catch{}let y={};return l.set(c,y),y};return{locale:t,locales:[...n],provider:{locales:[...n],loadLocale:i}}}export{de as configureLocalization,ve as createJSONLocalization,K as getLocalizationState,ge as loadLocale,Le as msg,pe as setLocale,me as str};
|