@cas-smartdesign/snackbar 3.0.1

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.
@@ -0,0 +1,12 @@
1
+ <svg id="svg3363" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" height="32" width="32">
2
+ <style>
3
+ .st0{fill:#ff0017}
4
+ </style>
5
+ <g id="layer1" transform="translate(0 -40)">
6
+ <path class="st0"
7
+ d="M16 42.2c7.6 0 13.8 6.2 13.8 13.8S23.6 69.8 16 69.8 2.2 63.6 2.2 56 8.4 42.2 16 42.2m0-1.2C7.7 41 1 47.7 1 56s6.7 15 15 15 15-6.7 15-15-6.7-15-15-15z"
8
+ id="path3854" />
9
+ <path id="rect3856" class="st0" d="M15 48h2v12h-2z" />
10
+ <path id="rect3860" class="st0" d="M15 63h2v2h-2z" />
11
+ </g>
12
+ </svg>
@@ -0,0 +1,26 @@
1
+ <!doctype html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
+ <meta http-equiv="X-UA-Compatible" content="ie=edge" />
7
+ <title>Snackbar</title>
8
+ <style>
9
+ .markdown-body {
10
+ box-sizing: border-box;
11
+ min-width: 200px;
12
+ max-width: 980px;
13
+ margin: 0 auto !important;
14
+ padding-bottom: 45px;
15
+ }
16
+ </style>
17
+ <script type="module" crossorigin src="./doc.mjs"></script>
18
+ <link rel="stylesheet" crossorigin href="./doc.css">
19
+ </head>
20
+ <body>
21
+ <div class="markdown-body">
22
+ <div id="markdown-container"></div>
23
+ <div id="examples"></div>
24
+ </div>
25
+ </body>
26
+ </html>
@@ -0,0 +1,39 @@
1
+ import { LitElement, TemplateResult } from "lit";
2
+ import type { VerticalPosition, HorizontalPosition, ISnackbar, IAnimationParams } from "./types";
3
+ declare global {
4
+ interface HTMLElementTagNameMap {
5
+ [SnackbarProvider.ID]: SnackbarProvider;
6
+ }
7
+ }
8
+ declare class SnackbarProvider extends LitElement {
9
+ static readonly ID = "sd-snackbar-provider";
10
+ static ensureDefined: () => void;
11
+ verticalPosition: VerticalPosition;
12
+ horizontalPosition: HorizontalPosition;
13
+ maxStack: number;
14
+ animationIn: IAnimationParams;
15
+ animationOut: IAnimationParams;
16
+ shouldCloseOldest: boolean;
17
+ private _queue;
18
+ private _rendered;
19
+ static get styles(): import("lit").CSSResult[];
20
+ render(): TemplateResult;
21
+ renderSnackbars(): void;
22
+ open(snackbar: ISnackbar): void;
23
+ close(snackId?: string): void;
24
+ private renderSnackbar;
25
+ private renderSnackbarContent;
26
+ private updateQueue;
27
+ private requestOldestSnackbarClose;
28
+ private requestSnackbarClose;
29
+ private closeSnackbar;
30
+ private removeSnackbarAndUpdate;
31
+ private removeSnackbarFromQueue;
32
+ private removeSnackbarFromRendered;
33
+ private setupTimeoutForAutoHideSnackbar;
34
+ private prepareSnackbarForRender;
35
+ private listenForMouseMove;
36
+ private handleWindowMouseMove;
37
+ private setupAction;
38
+ }
39
+ export { SnackbarProvider };
@@ -0,0 +1,99 @@
1
+ var window;(window||={})["@cas-smartdesign/snackbar"]=(()=>{var st=Object.defineProperty;var Qt=Object.getOwnPropertyDescriptor;var Wt=Object.getOwnPropertyNames;var Kt=Object.prototype.hasOwnProperty;var Jt=(s,t)=>{for(var e in t)st(s,e,{get:t[e],enumerable:!0})},Gt=(s,t,e,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Wt(t))!Kt.call(s,r)&&r!==e&&st(s,r,{get:()=>t[r],enumerable:!(i=Qt(t,r))||i.enumerable});return s};var Yt=s=>Gt(st({},"__esModule",{value:!0}),s);var de={};Jt(de,{Snackbar:()=>Ft,SnackbarProvider:()=>he});var q=window,z=q.ShadowRoot&&(q.ShadyCSS===void 0||q.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,it=Symbol(),ft=new WeakMap,R=class{constructor(t,e,i){if(this._$cssResult$=!0,i!==it)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(z&&t===void 0){let i=e!==void 0&&e.length===1;i&&(t=ft.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),i&&ft.set(e,t))}return t}toString(){return this.cssText}},M=s=>new R(typeof s=="string"?s:s+"",void 0,it),B=(s,...t)=>{let e=s.length===1?s[0]:t.reduce((i,r,n)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+s[n+1],s[0]);return new R(e,s,it)},rt=(s,t)=>{z?s.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet):t.forEach(e=>{let i=document.createElement("style"),r=q.litNonce;r!==void 0&&i.setAttribute("nonce",r),i.textContent=e.cssText,s.appendChild(i)})},j=z?s=>s:s=>s instanceof CSSStyleSheet?(t=>{let e="";for(let i of t.cssRules)e+=i.cssText;return M(e)})(s):s;var nt,V=window,_t=V.trustedTypes,Zt=_t?_t.emptyScript:"",At=V.reactiveElementPolyfillSupport,at={toAttribute(s,t){switch(t){case Boolean:s=s?Zt: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}},gt=(s,t)=>t!==s&&(t==t||s==s),ot={attribute:!0,type:String,converter:at,reflect:!1,hasChanged:gt},lt="finalized",_=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var e;this.finalize(),((e=this.h)!==null&&e!==void 0?e:this.h=[]).push(t)}static get observedAttributes(){this.finalize();let t=[];return this.elementProperties.forEach((e,i)=>{let r=this._$Ep(i,e);r!==void 0&&(this._$Ev.set(r,i),t.push(r))}),t}static createProperty(t,e=ot){if(e.state&&(e.attribute=!1),this.finalize(),this.elementProperties.set(t,e),!e.noAccessor&&!this.prototype.hasOwnProperty(t)){let i=typeof t=="symbol"?Symbol():"__"+t,r=this.getPropertyDescriptor(t,i,e);r!==void 0&&Object.defineProperty(this.prototype,t,r)}}static getPropertyDescriptor(t,e,i){return{get(){return this[e]},set(r){let n=this[t];this[e]=r,this.requestUpdate(t,n,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||ot}static finalize(){if(this.hasOwnProperty(lt))return!1;this[lt]=!0;let t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let e=this.properties,i=[...Object.getOwnPropertyNames(e),...Object.getOwnPropertySymbols(e)];for(let r of i)this.createProperty(r,e[r])}return this.elementStyles=this.finalizeStyles(this.styles),!0}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(j(r))}else t!==void 0&&e.push(j(t));return e}static _$Ep(t,e){let i=e.attribute;return i===!1?void 0:typeof i=="string"?i:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(e=>e(this))}addController(t){var e,i;((e=this._$ES)!==null&&e!==void 0?e:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((i=t.hostConnected)===null||i===void 0||i.call(t))}removeController(t){var e;(e=this._$ES)===null||e===void 0||e.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,e)=>{this.hasOwnProperty(e)&&(this._$Ei.set(e,this[e]),delete this[e])})}createRenderRoot(){var t;let e=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return rt(e,this.constructor.elementStyles),e}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostConnected)===null||i===void 0?void 0:i.call(e)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(e=>{var i;return(i=e.hostDisconnected)===null||i===void 0?void 0:i.call(e)})}attributeChangedCallback(t,e,i){this._$AK(t,i)}_$EO(t,e,i=ot){var r;let n=this.constructor._$Ep(t,i);if(n!==void 0&&i.reflect===!0){let o=(((r=i.converter)===null||r===void 0?void 0:r.toAttribute)!==void 0?i.converter:at).toAttribute(e,i.type);this._$El=t,o==null?this.removeAttribute(n):this.setAttribute(n,o),this._$El=null}}_$AK(t,e){var i;let r=this.constructor,n=r._$Ev.get(t);if(n!==void 0&&this._$El!==n){let o=r.getPropertyOptions(n),h=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?o.converter:at;this._$El=n,this[n]=h.fromAttribute(e,o.type),this._$El=null}}requestUpdate(t,e,i){let r=!0;t!==void 0&&(((i=i||this.constructor.getPropertyOptions(t)).hasChanged||gt)(this[t],e)?(this._$AL.has(t)||this._$AL.set(t,e),i.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,i))):r=!1),!this.isUpdatePending&&r&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((r,n)=>this[n]=r),this._$Ei=void 0);let e=!1,i=this._$AL;try{e=this.shouldUpdate(i),e?(this.willUpdate(i),(t=this._$ES)===null||t===void 0||t.forEach(r=>{var n;return(n=r.hostUpdate)===null||n===void 0?void 0:n.call(r)}),this.update(i)):this._$Ek()}catch(r){throw e=!1,this._$Ek(),r}e&&this._$AE(i)}willUpdate(t){}_$AE(t){var e;(e=this._$ES)===null||e===void 0||e.forEach(i=>{var r;return(r=i.hostUpdated)===null||r===void 0?void 0:r.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((e,i)=>this._$EO(i,this[i],e)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};_[lt]=!0,_.elementProperties=new Map,_.elementStyles=[],_.shadowRootOptions={mode:"open"},At?.({ReactiveElement:_}),((nt=V.reactiveElementVersions)!==null&&nt!==void 0?nt:V.reactiveElementVersions=[]).push("1.6.3");var ht,F=window,P=F.trustedTypes,yt=P?P.createPolicy("lit-html",{createHTML:s=>s}):void 0,Q="$lit$",A=`lit$${(Math.random()+"").slice(9)}$`,ct="?"+A,Xt=`<${ct}>`,C=document,D=()=>C.createComment(""),I=s=>s===null||typeof s!="object"&&typeof s!="function",wt=Array.isArray,Pt=s=>wt(s)||typeof s?.[Symbol.iterator]=="function",dt=`[
2
+ \f\r]`,N=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,St=/-->/g,bt=/>/g,b=RegExp(`>|${dt}(?:([^\\s"'>=/]+)(${dt}*=${dt}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Et=/'/g,Ct=/"/g,Tt=/^(?:script|style|textarea|title)$/i,Ut=s=>(t,...e)=>({_$litType$:s,strings:t,values:e}),U=Ut(1),me=Ut(2),g=Symbol.for("lit-noChange"),$=Symbol.for("lit-nothing"),xt=new WeakMap,E=C.createTreeWalker(C,129,null,!1);function Ht(s,t){if(!Array.isArray(s)||!s.hasOwnProperty("raw"))throw Error("invalid template strings array");return yt!==void 0?yt.createHTML(t):t}var Ot=(s,t)=>{let e=s.length-1,i=[],r,n=t===2?"<svg>":"",o=N;for(let h=0;h<e;h++){let a=s[h],l,c,p=-1,d=0;for(;d<a.length&&(o.lastIndex=d,c=o.exec(a),c!==null);)d=o.lastIndex,o===N?c[1]==="!--"?o=St:c[1]!==void 0?o=bt:c[2]!==void 0?(Tt.test(c[2])&&(r=RegExp("</"+c[2],"g")),o=b):c[3]!==void 0&&(o=b):o===b?c[0]===">"?(o=r??N,p=-1):c[1]===void 0?p=-2:(p=o.lastIndex-c[2].length,l=c[1],o=c[3]===void 0?b:c[3]==='"'?Ct:Et):o===Ct||o===Et?o=b:o===St||o===bt?o=N:(o=b,r=void 0);let u=o===b&&s[h+1].startsWith("/>")?" ":"";n+=o===N?a+Xt:p>=0?(i.push(l),a.slice(0,p)+Q+a.slice(p)+A+u):a+A+(p===-2?(i.push(void 0),h):u)}return[Ht(s,n+(s[e]||"<?>")+(t===2?"</svg>":"")),i]},L=class s{constructor({strings:t,_$litType$:e},i){let r;this.parts=[];let n=0,o=0,h=t.length-1,a=this.parts,[l,c]=Ot(t,e);if(this.el=s.createElement(l,i),E.currentNode=this.el.content,e===2){let p=this.el.content,d=p.firstChild;d.remove(),p.append(...d.childNodes)}for(;(r=E.nextNode())!==null&&a.length<h;){if(r.nodeType===1){if(r.hasAttributes()){let p=[];for(let d of r.getAttributeNames())if(d.endsWith(Q)||d.startsWith(A)){let u=c[o++];if(p.push(d),u!==void 0){let v=r.getAttribute(u.toLowerCase()+Q).split(A),m=/([.?@])?(.*)/.exec(u);a.push({type:1,index:n,name:m[2],strings:v,ctor:m[1]==="."?K:m[1]==="?"?J:m[1]==="@"?G:k})}else a.push({type:6,index:n})}for(let d of p)r.removeAttribute(d)}if(Tt.test(r.tagName)){let p=r.textContent.split(A),d=p.length-1;if(d>0){r.textContent=P?P.emptyScript:"";for(let u=0;u<d;u++)r.append(p[u],D()),E.nextNode(),a.push({type:2,index:++n});r.append(p[d],D())}}}else if(r.nodeType===8)if(r.data===ct)a.push({type:2,index:n});else{let p=-1;for(;(p=r.data.indexOf(A,p+1))!==-1;)a.push({type:7,index:n}),p+=A.length-1}n++}}static createElement(t,e){let i=C.createElement("template");return i.innerHTML=t,i}};function x(s,t,e=s,i){var r,n,o,h;if(t===g)return t;let a=i!==void 0?(r=e._$Co)===null||r===void 0?void 0:r[i]:e._$Cl,l=I(t)?void 0:t._$litDirective$;return a?.constructor!==l&&((n=a?._$AO)===null||n===void 0||n.call(a,!1),l===void 0?a=void 0:(a=new l(s),a._$AT(s,e,i)),i!==void 0?((o=(h=e)._$Co)!==null&&o!==void 0?o:h._$Co=[])[i]=a:e._$Cl=a),a!==void 0&&(t=x(s,a._$AS(s,t.values),a,i)),t}var W=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){var e;let{el:{content:i},parts:r}=this._$AD,n=((e=t?.creationScope)!==null&&e!==void 0?e:C).importNode(i,!0);E.currentNode=n;let o=E.nextNode(),h=0,a=0,l=r[0];for(;l!==void 0;){if(h===l.index){let c;l.type===2?c=new T(o,o.nextSibling,this,t):l.type===1?c=new l.ctor(o,l.name,l.strings,this,t):l.type===6&&(c=new Y(o,this,t)),this._$AV.push(c),l=r[++a]}h!==l?.index&&(o=E.nextNode(),h++)}return E.currentNode=C,n}v(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++}},T=class s{constructor(t,e,i,r){var n;this.type=2,this._$AH=$,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=i,this.options=r,this._$Cp=(n=r?.isConnected)===null||n===void 0||n}get _$AU(){var t,e;return(e=(t=this._$AM)===null||t===void 0?void 0:t._$AU)!==null&&e!==void 0?e:this._$Cp}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=x(this,t,e),I(t)?t===$||t==null||t===""?(this._$AH!==$&&this._$AR(),this._$AH=$):t!==this._$AH&&t!==g&&this._(t):t._$litType$!==void 0?this.g(t):t.nodeType!==void 0?this.$(t):Pt(t)?this.T(t):this._(t)}k(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}$(t){this._$AH!==t&&(this._$AR(),this._$AH=this.k(t))}_(t){this._$AH!==$&&I(this._$AH)?this._$AA.nextSibling.data=t:this.$(C.createTextNode(t)),this._$AH=t}g(t){var e;let{values:i,_$litType$:r}=t,n=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=L.createElement(Ht(r.h,r.h[0]),this.options)),r);if(((e=this._$AH)===null||e===void 0?void 0:e._$AD)===n)this._$AH.v(i);else{let o=new W(n,this),h=o.u(this.options);o.v(i),this.$(h),this._$AH=o}}_$AC(t){let e=xt.get(t.strings);return e===void 0&&xt.set(t.strings,e=new L(t)),e}T(t){wt(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,i,r=0;for(let n of t)r===e.length?e.push(i=new s(this.k(D()),this.k(D()),this,this.options)):i=e[r],i._$AI(n),r++;r<e.length&&(this._$AR(i&&i._$AB.nextSibling,r),e.length=r)}_$AR(t=this._$AA.nextSibling,e){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){var e;this._$AM===void 0&&(this._$Cp=t,(e=this._$AP)===null||e===void 0||e.call(this,t))}},k=class{constructor(t,e,i,r,n){this.type=1,this._$AH=$,this._$AN=void 0,this.element=t,this.name=e,this._$AM=r,this.options=n,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=$}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,e=this,i,r){let n=this.strings,o=!1;if(n===void 0)t=x(this,t,e,0),o=!I(t)||t!==this._$AH&&t!==g,o&&(this._$AH=t);else{let h=t,a,l;for(t=n[0],a=0;a<n.length-1;a++)l=x(this,h[i+a],e,a),l===g&&(l=this._$AH[a]),o||(o=!I(l)||l!==this._$AH[a]),l===$?t=$:t!==$&&(t+=(l??"")+n[a+1]),this._$AH[a]=l}o&&!r&&this.j(t)}j(t){t===$?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},K=class extends k{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===$?void 0:t}},te=P?P.emptyScript:"",J=class extends k{constructor(){super(...arguments),this.type=4}j(t){t&&t!==$?this.element.setAttribute(this.name,te):this.element.removeAttribute(this.name)}},G=class extends k{constructor(t,e,i,r,n){super(t,e,i,r,n),this.type=5}_$AI(t,e=this){var i;if((t=(i=x(this,t,e,0))!==null&&i!==void 0?i:$)===g)return;let r=this._$AH,n=t===$&&r!==$||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==$&&(r===$||n);n&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){var e,i;typeof this._$AH=="function"?this._$AH.call((i=(e=this.options)===null||e===void 0?void 0:e.host)!==null&&i!==void 0?i: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){x(this,t)}},Rt={O:Q,P:A,A:ct,C:1,M:Ot,L:W,R:Pt,D:x,I:T,V:k,H:J,N:G,U:K,F:Y},kt=F.litHtmlPolyfillSupport;kt?.(L,T),((ht=F.litHtmlVersions)!==null&&ht!==void 0?ht:F.litHtmlVersions=[]).push("2.8.0");var Z=(s,t,e)=>{var i,r;let n=(i=e?.renderBefore)!==null&&i!==void 0?i:t,o=n._$litPart$;if(o===void 0){let h=(r=e?.renderBefore)!==null&&r!==void 0?r:null;n._$litPart$=o=new T(t.insertBefore(D(),h),h,void 0,e??{})}return o._$AI(s),o};var ut,pt;var y=class extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,e;let i=super.createRenderRoot();return(t=(e=this.renderOptions).renderBefore)!==null&&t!==void 0||(e.renderBefore=i.firstChild),i}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Z(e,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return g}};y.finalized=!0,y._$litElement$=!0,(ut=globalThis.litElementHydrateSupport)===null||ut===void 0||ut.call(globalThis,{LitElement:y});var Mt=globalThis.litElementPolyfillSupport;Mt?.({LitElement:y});((pt=globalThis.litElementVersions)!==null&&pt!==void 0?pt:globalThis.litElementVersions=[]).push("3.3.3");var ee=(s,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(e){e.createProperty(t.key,s)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(e){e.createProperty(t.key,s)}},se=(s,t,e)=>{t.constructor.createProperty(e,s)};function vt(s){return(t,e)=>e!==void 0?se(s,t,e):ee(s,t)}var Nt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Dt=s=>(...t)=>({_$litDirective$:s,values:t}),X=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:ie}=Rt;var It=()=>document.createComment(""),H=(s,t,e)=>{var i;let r=s._$AA.parentNode,n=t===void 0?s._$AB:t._$AA;if(e===void 0){let o=r.insertBefore(It(),n),h=r.insertBefore(It(),n);e=new ie(o,h,s,s.options)}else{let o=e._$AB.nextSibling,h=e._$AM,a=h!==s;if(a){let l;(i=e._$AQ)===null||i===void 0||i.call(e,s),e._$AM=s,e._$AP!==void 0&&(l=s._$AU)!==h._$AU&&e._$AP(l)}if(o!==n||a){let l=e._$AA;for(;l!==o;){let c=l.nextSibling;r.insertBefore(l,n),l=c}}}return e},S=(s,t,e=s)=>(s._$AI(t,e),s),re={},Lt=(s,t=re)=>s._$AH=t,qt=s=>s._$AH,tt=s=>{var t;(t=s._$AP)===null||t===void 0||t.call(s,!1,!0);let e=s._$AA,i=s._$AB.nextSibling;for(;e!==i;){let r=e.nextSibling;e.remove(),e=r}};var zt=(s,t,e)=>{let i=new Map;for(let r=t;r<=e;r++)i.set(s[r],r);return i},Bt=Dt(class extends X{constructor(s){if(super(s),s.type!==Nt.CHILD)throw Error("repeat() can only be used in text expressions")}ct(s,t,e){let i;e===void 0?e=t:t!==void 0&&(i=t);let r=[],n=[],o=0;for(let h of s)r[o]=i?i(h,o):o,n[o]=e(h,o),o++;return{values:n,keys:r}}render(s,t,e){return this.ct(s,t,e).values}update(s,[t,e,i]){var r;let n=qt(s),{values:o,keys:h}=this.ct(t,e,i);if(!Array.isArray(n))return this.ut=h,o;let a=(r=this.ut)!==null&&r!==void 0?r:this.ut=[],l=[],c,p,d=0,u=n.length-1,v=0,m=o.length-1;for(;d<=u&&v<=m;)if(n[d]===null)d++;else if(n[u]===null)u--;else if(a[d]===h[v])l[v]=S(n[d],o[v]),d++,v++;else if(a[u]===h[m])l[m]=S(n[u],o[m]),u--,m--;else if(a[d]===h[m])l[m]=S(n[d],o[m]),H(s,l[m+1],n[d]),d++,m--;else if(a[u]===h[v])l[v]=S(n[u],o[v]),H(s,n[d],n[u]),u--,v++;else if(c===void 0&&(c=zt(h,v,m),p=zt(a,d,u)),c.has(a[d]))if(c.has(a[u])){let f=p.get(h[v]),et=f!==void 0?n[f]:null;if(et===null){let mt=H(s,n[d]);S(mt,o[v]),l[v]=mt}else l[v]=S(et,o[v]),H(s,n[d],et),n[f]=null;v++}else tt(n[u]),u--;else tt(n[d]),d++;for(;v<=m;){let f=H(s,l[m+1]);S(f,o[v]),l[v++]=f}for(;d<=u;){let f=n[d++];f!==null&&tt(f)}return this.ut=h,Lt(s,l),g}});var jt=s=>s??$;var ne=":host{display:block;contain:layout;margin-top:6px;margin-bottom:6px;position:relative;transition:height var(--sd-snackbar-height-transition-duration, .4s)}.root{display:flex;width:100%;height:100%}",oe=":host{position:fixed;display:flex;flex-direction:column;box-sizing:border-box;max-height:100%;contain:layout}:host([vertical-position=bottom]){flex-direction:column-reverse;bottom:var(--sd-snackbar-vertical-offset, 14px)}:host([vertical-position=top]){top:var(--sd-snackbar-vertical-offset, 14px)}:host([horizontal-position=left]){left:var(--sd-snackbar-horizontal-offset, 20px)}:host([horizontal-position=center]){left:50%;transform:translate(-50%)}:host([horizontal-position=right]){right:var(--sd-snackbar-horizontal-offset, 20px)}",ae=Object.defineProperty,le=Object.getOwnPropertyDescriptor,Vt=(s,t,e,i)=>{for(var r=i>1?void 0:i?le(t,e):t,n=s.length-1,o;n>=0;n--)(o=s[n])&&(r=(i?o(t,e,r):o(r))||r);return i&&r&&ae(t,e,r),r},w,$t=(w=class extends y{constructor(){super(...arguments),this.verticalPosition="bottom",this.horizontalPosition="left",this.maxStack=3,this.shouldCloseOldest=!1,this._queue=[],this._rendered=[]}static get styles(){return[B`
4
+ ${M(oe)}
5
+ `]}render(){return this.renderSnackbars(),U` <slot></slot> `}renderSnackbars(){Z(U`
6
+ ${Bt(this._rendered,({id:s})=>s,s=>this.renderSnackbar(s))}
7
+ `,this)}open(s){this._queue.push({snackbar:s,direction:"in"}),this.updateQueue()}close(s){s?this.requestSnackbarClose(s):this._rendered.forEach(({id:t})=>this.requestSnackbarClose(t))}renderSnackbar({message:s,options:t={}}){var e;return U`
8
+ <sd-snackbar
9
+ class="${jt(((e=t.classNames)==null?void 0:e.length)>0?t.classNames.join(" "):void 0)}"
10
+ .animationIn="${this.animationIn}"
11
+ .animationOut="${this.animationOut}"
12
+ >
13
+ ${this.renderSnackbarContent(s,t?.closeAction)}
14
+ </sd-snackbar>
15
+ `}renderSnackbarContent(s,t){return U` ${s}${t||""} `}updateQueue(){if(this._queue.length===0)return;let{direction:s,snackbar:t}=this._queue[0];s==="in"?this._rendered.length===this.maxStack?this.requestOldestSnackbarClose():(this.prepareSnackbarForRender(t),this._rendered.push(t),this.renderSnackbars(),this._queue.shift(),this.updateQueue()):this.requestSnackbarClose(t.id)}requestOldestSnackbarClose(){let s=this._rendered.find(({requestClose:t,options:e})=>!t&&e?.autoHideDuration);s&&(s.requestClose=!0,this._queue.unshift({snackbar:s,direction:"out"}),this.updateQueue())}requestSnackbarClose(s){let t=this._rendered.findIndex(e=>e.id===s);if(t!==-1){let e=this._rendered[t];e.closing||(e.requestClose=!0,window.clearTimeout(e.timer),this.closeSnackbar(t))}}closeSnackbar(s){var t;let e=this._rendered[s],i=this.children.item(s);i&&(e.closing=!0,(t=e.options)!=null&&t.waitOnHover&&i.matches(":hover")?i.addEventListener("mouseleave",()=>{i.close().then(()=>{this.removeSnackbarAndUpdate(e)})}):i.close().then(()=>{this.removeSnackbarAndUpdate(e)}))}removeSnackbarAndUpdate(s){this.removeSnackbarFromQueue(s),this.removeSnackbarFromRendered(s),this.requestUpdate(),this.updateComplete.then(()=>this.updateQueue())}removeSnackbarFromQueue(s){let t=this._queue.findIndex(({snackbar:e})=>e.id===s.id);t!==-1&&this._queue.splice(t,1)}removeSnackbarFromRendered(s){let t=this._rendered.findIndex(e=>e.id==s.id);t!==-1&&this._rendered.splice(t,1)}setupTimeoutForAutoHideSnackbar(s){s.timer=window.setTimeout(()=>{this._queue.push({snackbar:s,direction:"out"}),this.updateQueue()},s.options.autoHideDuration)}prepareSnackbarForRender(s){let{options:t,message:e}=s;if(e.slot="message",t){let{autoHideDuration:i,waitForMouseMove:r}=t;i&&(r?this.listenForMouseMove(s):this.setupTimeoutForAutoHideSnackbar(s)),this.setupAction(s)}}listenForMouseMove(s){window.addEventListener("mousemove",this.handleWindowMouseMove.bind(this,s),{once:!0})}handleWindowMouseMove(s){this.setupTimeoutForAutoHideSnackbar(s)}setupAction(s){let{options:{closeAction:t}}=s;t&&(t.addEventListener("click",()=>{this._queue.unshift({snackbar:s,direction:"out"}),this.updateQueue()}),t.slot="action")}},w.ID="sd-snackbar-provider",w.ensureDefined=()=>{Ft.ensureDefined(),customElements.get(w.ID)||customElements.define(w.ID,w)},w);Vt([vt({type:String,reflect:!0,attribute:"vertical-position"})],$t.prototype,"verticalPosition",2);Vt([vt({type:String,reflect:!0,attribute:"horizontal-position"})],$t.prototype,"horizontalPosition",2);var he=$t,O=class extends y{static get styles(){return[B`
16
+ ${M(ne)}
17
+ `]}firstUpdated(t){if(super.firstUpdated(t),this.animationIn){let{keyframes:e,options:i}=this.animationIn;this.animate(e,i)}}close(){return new Promise(t=>{if(this.animationOut){let{keyframes:e,options:i}=this.animationOut,r=this.animate(e,i);r.onfinish=()=>{this.collapse(),this.addEventListener("transitionend",({propertyName:n})=>{n==="height"&&t()})}}else this.collapse(),t()})}render(){return U`
18
+ <div class="root">
19
+ <div class="message">
20
+ <slot name="message"></slot>
21
+ </div>
22
+ <div class="action">
23
+ <slot name="action"></slot>
24
+ </div>
25
+ </div>
26
+ `}collapse(){this.style.height="0",this.style.opacity="0"}};O.ID="sd-snackbar",O.ensureDefined=()=>{customElements.get(O.ID)||customElements.define(O.ID,O)};var Ft=O;return Yt(de);})();
27
+ /*! Bundled license information:
28
+
29
+ @lit/reactive-element/css-tag.js:
30
+ (**
31
+ * @license
32
+ * Copyright 2019 Google LLC
33
+ * SPDX-License-Identifier: BSD-3-Clause
34
+ *)
35
+
36
+ @lit/reactive-element/reactive-element.js:
37
+ (**
38
+ * @license
39
+ * Copyright 2017 Google LLC
40
+ * SPDX-License-Identifier: BSD-3-Clause
41
+ *)
42
+
43
+ lit-html/lit-html.js:
44
+ (**
45
+ * @license
46
+ * Copyright 2017 Google LLC
47
+ * SPDX-License-Identifier: BSD-3-Clause
48
+ *)
49
+
50
+ lit-element/lit-element.js:
51
+ (**
52
+ * @license
53
+ * Copyright 2017 Google LLC
54
+ * SPDX-License-Identifier: BSD-3-Clause
55
+ *)
56
+
57
+ lit-html/is-server.js:
58
+ (**
59
+ * @license
60
+ * Copyright 2022 Google LLC
61
+ * SPDX-License-Identifier: BSD-3-Clause
62
+ *)
63
+
64
+ @lit/reactive-element/decorators/property.js:
65
+ (**
66
+ * @license
67
+ * Copyright 2017 Google LLC
68
+ * SPDX-License-Identifier: BSD-3-Clause
69
+ *)
70
+
71
+ lit-html/directive.js:
72
+ (**
73
+ * @license
74
+ * Copyright 2017 Google LLC
75
+ * SPDX-License-Identifier: BSD-3-Clause
76
+ *)
77
+
78
+ lit-html/directive-helpers.js:
79
+ (**
80
+ * @license
81
+ * Copyright 2020 Google LLC
82
+ * SPDX-License-Identifier: BSD-3-Clause
83
+ *)
84
+
85
+ lit-html/directives/repeat.js:
86
+ (**
87
+ * @license
88
+ * Copyright 2017 Google LLC
89
+ * SPDX-License-Identifier: BSD-3-Clause
90
+ *)
91
+
92
+ lit-html/directives/if-defined.js:
93
+ (**
94
+ * @license
95
+ * Copyright 2018 Google LLC
96
+ * SPDX-License-Identifier: BSD-3-Clause
97
+ *)
98
+ */
99
+ //# sourceMappingURL=snackbar-with-externals.js.map