@lambforge/agent-chat 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,8 +1,8 @@
1
- (()=>{var pa=Object.create;var At=Object.defineProperty;var yo=Object.getOwnPropertyDescriptor;var fa=Object.getOwnPropertyNames;var da=Object.getPrototypeOf,ha=Object.prototype.hasOwnProperty;var x=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(n){throw t=[n],n}};var xe=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},j=(r,e)=>{for(var t in e)At(r,t,{get:e[t],enumerable:!0})},bo=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of fa(e))!ha.call(r,o)&&o!==t&&At(r,o,{get:()=>e[o],enumerable:!(n=yo(e,o))||n.enumerable});return r};var mn=(r,e,t)=>(t=r!=null?pa(da(r)):{},bo(e||!r||!r.__esModule?At(t,"default",{value:r,enumerable:!0}):t,r)),C=r=>bo(At({},"__esModule",{value:!0}),r),F=(r,e,t,n)=>{for(var o=n>1?void 0:n?yo(e,t):e,i=r.length-1,s;i>=0;i--)(s=r[i])&&(o=(n?s(e,t,o):s(o))||o);return n&&o&&At(e,t,o),o};var zr={};j(zr,{_$LH:()=>pt,html:()=>bi,noChange:()=>S,nothing:()=>E,render:()=>Te,svg:()=>xi});function Ve(r,e,t=r,n){var o,i,s,a;if(e===S)return e;let l=n!==void 0?(o=t._$Co)===null||o===void 0?void 0:o[n]:t._$Cl,c=Dt(e)?void 0:e._$litDirective$;return l?.constructor!==c&&((i=l?._$AO)===null||i===void 0||i.call(l,!1),c===void 0?l=void 0:(l=new c(r),l._$AT(r,t,n)),n!==void 0?((s=(a=t)._$Co)!==null&&s!==void 0?s:a._$Co=[])[n]=l:t._$Cl=l),l!==void 0&&(e=Ve(r,l._$AS(r,e.values),l,n)),e}var Ln,Lr,lt,li,$e,Un,Ga,ct,Ut,Dt,mi,vi,Lt,ci,ui,Be,pi,fi,gi,yi,bi,xi,S,E,di,at,wi,Nt,Ur,ut,Ke,Dr,Ja,Nr,Fr,qr,pt,hi,Te,U=x(()=>{Lr=window,lt=Lr.trustedTypes,li=lt?lt.createPolicy("lit-html",{createHTML:r=>r}):void 0,$e=`lit$${(Math.random()+"").slice(9)}$`,Un="?"+$e,Ga=`<${Un}>`,ct=document,Ut=(r="")=>ct.createComment(r),Dt=r=>r===null||typeof r!="object"&&typeof r!="function",mi=Array.isArray,vi=r=>mi(r)||typeof r?.[Symbol.iterator]=="function",Lt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ci=/-->/g,ui=/>/g,Be=RegExp(`>|[
1
+ (()=>{var ga=Object.create;var kt=Object.defineProperty;var $o=Object.getOwnPropertyDescriptor;var va=Object.getOwnPropertyNames;var ba=Object.getPrototypeOf,ya=Object.prototype.hasOwnProperty;var x=(r,e,t)=>()=>{if(t)throw t[0];try{return r&&(e=r(r=0)),e}catch(n){throw t=[n],n}};var xe=(r,e)=>()=>{try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}},M=(r,e)=>{for(var t in e)kt(r,t,{get:e[t],enumerable:!0})},_o=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of va(e))!ya.call(r,o)&&o!==t&&kt(r,o,{get:()=>e[o],enumerable:!(n=$o(e,o))||n.enumerable});return r};var yn=(r,e,t)=>(t=r!=null?ga(ba(r)):{},_o(e||!r||!r.__esModule?kt(t,"default",{value:r,enumerable:!0}):t,r)),C=r=>_o(kt({},"__esModule",{value:!0}),r),q=(r,e,t,n)=>{for(var o=n>1?void 0:n?$o(e,t):e,i=r.length-1,s;i>=0;i--)(s=r[i])&&(o=(n?s(e,t,o):s(o))||o);return n&&o&&kt(e,t,o),o};var Kr={};M(Kr,{_$LH:()=>ht,html:()=>Si,noChange:()=>A,nothing:()=>E,render:()=>Te,svg:()=>Ai});function Ve(r,e,t=r,n){var o,i,s,a;if(e===A)return e;let l=n!==void 0?(o=t._$Co)===null||o===void 0?void 0:o[n]:t._$Cl,c=Ht(e)?void 0:e._$litDirective$;return l?.constructor!==c&&((i=l?._$AO)===null||i===void 0||i.call(l,!1),c===void 0?l=void 0:(l=new c(r),l._$AT(r,t,n)),n!==void 0?((s=(a=t)._$Co)!==null&&s!==void 0?s:a._$Co=[])[n]=l:t._$Cl=l),l!==void 0&&(e=Ve(r,l._$AS(r,e.values),l,n)),e}var Nn,Dr,pt,fi,_e,qn,tl,dt,qt,Ht,xi,wi,Nt,hi,mi,Be,gi,vi,$i,_i,Si,Ai,A,E,bi,ut,Ei,zt,Nr,ft,Ye,qr,rl,Hr,zr,Wr,ht,yi,Te,U=x(()=>{Dr=window,pt=Dr.trustedTypes,fi=pt?pt.createPolicy("lit-html",{createHTML:r=>r}):void 0,_e=`lit$${(Math.random()+"").slice(9)}$`,qn="?"+_e,tl=`<${qn}>`,dt=document,qt=(r="")=>dt.createComment(r),Ht=r=>r===null||typeof r!="object"&&typeof r!="function",xi=Array.isArray,wi=r=>xi(r)||typeof r?.[Symbol.iterator]=="function",Nt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,hi=/-->/g,mi=/>/g,Be=RegExp(`>|[
2
2
  \f\r](?:([^\\s"'>=/]+)([
3
3
  \f\r]*=[
4
4
  \f\r]*(?:[^
5
- \f\r"'\`<>=]|("|')|))|$)`,"g"),pi=/'/g,fi=/"/g,gi=/^(?:script|style|textarea|title)$/i,yi=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),bi=yi(1),xi=yi(2),S=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),di=new WeakMap,at=ct.createTreeWalker(ct,129,null,!1),wi=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":"",s=Lt;for(let l=0;l<t;l++){let c=r[l],u,p,d=-1,f=0;for(;f<c.length&&(s.lastIndex=f,p=s.exec(c),p!==null);)f=s.lastIndex,s===Lt?p[1]==="!--"?s=ci:p[1]!==void 0?s=ui:p[2]!==void 0?(gi.test(p[2])&&(o=RegExp("</"+p[2],"g")),s=Be):p[3]!==void 0&&(s=Be):s===Be?p[0]===">"?(s=o??Lt,d=-1):p[1]===void 0?d=-2:(d=s.lastIndex-p[2].length,u=p[1],s=p[3]===void 0?Be:p[3]==='"'?fi:pi):s===fi||s===pi?s=Be:s===ci||s===ui?s=Lt:(s=Be,o=void 0);let v=s===Be&&r[l+1].startsWith("/>")?" ":"";i+=s===Lt?c+Ga:d>=0?(n.push(u),c.slice(0,d)+"$lit$"+c.slice(d)+$e+v):c+$e+(d===-2?(n.push(void 0),l):v)}let a=i+(r[t]||"<?>")+(e===2?"</svg>":"");if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return[li!==void 0?li.createHTML(a):a,n]},Nt=class r{constructor({strings:e,_$litType$:t},n){let o;this.parts=[];let i=0,s=0,a=e.length-1,l=this.parts,[c,u]=wi(e,t);if(this.el=r.createElement(c,n),at.currentNode=this.el.content,t===2){let p=this.el.content,d=p.firstChild;d.remove(),p.append(...d.childNodes)}for(;(o=at.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes()){let p=[];for(let d of o.getAttributeNames())if(d.endsWith("$lit$")||d.startsWith($e)){let f=u[s++];if(p.push(d),f!==void 0){let v=o.getAttribute(f.toLowerCase()+"$lit$").split($e),h=/([.?@])?(.*)/.exec(f);l.push({type:1,index:i,name:h[2],strings:v,ctor:h[1]==="."?Dr:h[1]==="?"?Nr:h[1]==="@"?Fr:Ke})}else l.push({type:6,index:i})}for(let d of p)o.removeAttribute(d)}if(gi.test(o.tagName)){let p=o.textContent.split($e),d=p.length-1;if(d>0){o.textContent=lt?lt.emptyScript:"";for(let f=0;f<d;f++)o.append(p[f],Ut()),at.nextNode(),l.push({type:2,index:++i});o.append(p[d],Ut())}}}else if(o.nodeType===8)if(o.data===Un)l.push({type:2,index:i});else{let p=-1;for(;(p=o.data.indexOf($e,p+1))!==-1;)l.push({type:7,index:i}),p+=$e.length-1}i++}}static createElement(e,t){let n=ct.createElement("template");return n.innerHTML=e,n}};Ur=class{constructor(e,t){this.u=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(e){var t;let{el:{content:n},parts:o}=this._$AD,i=((t=e?.creationScope)!==null&&t!==void 0?t:ct).importNode(n,!0);at.currentNode=i;let s=at.nextNode(),a=0,l=0,c=o[0];for(;c!==void 0;){if(a===c.index){let u;c.type===2?u=new ut(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new qr(s,this,e)),this.u.push(u),c=o[++l]}a!==c?.index&&(s=at.nextNode(),a++)}return i}p(e){let t=0;for(let n of this.u)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},ut=class r{constructor(e,t,n,o){var i;this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=o,this._$Cm=(i=o?.isConnected)===null||i===void 0||i}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cm}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ve(this,e,t),Dt(e)?e===E||e==null||e===""?(this._$AH!==E&&this._$AR(),this._$AH=E):e!==this._$AH&&e!==S&&this.g(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):vi(e)?this.k(e):this.g(e)}O(e,t=this._$AB){return this._$AA.parentNode.insertBefore(e,t)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}g(e){this._$AH!==E&&Dt(this._$AH)?this._$AA.nextSibling.data=e:this.T(ct.createTextNode(e)),this._$AH=e}$(e){var t;let{values:n,_$litType$:o}=e,i=typeof o=="number"?this._$AC(e):(o.el===void 0&&(o.el=Nt.createElement(o.h,this.options)),o);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===i)this._$AH.p(n);else{let s=new Ur(i,this),a=s.v(this.options);s.p(n),this.T(a),this._$AH=s}}_$AC(e){let t=di.get(e.strings);return t===void 0&&di.set(e.strings,t=new Nt(e)),t}k(e){mi(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,o=0;for(let i of e)o===t.length?t.push(n=new r(this.O(Ut()),this.O(Ut()),this,this.options)):n=t[o],n._$AI(i),o++;o<t.length&&(this._$AR(n&&n._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,t);e&&e!==this._$AB;){let o=e.nextSibling;e.remove(),e=o}}setConnected(e){var t;this._$AM===void 0&&(this._$Cm=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},Ke=class{constructor(e,t,n,o,i){this.type=1,this._$AH=E,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=E}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,n,o){let i=this.strings,s=!1;if(i===void 0)e=Ve(this,e,t,0),s=!Dt(e)||e!==this._$AH&&e!==S,s&&(this._$AH=e);else{let a=e,l,c;for(e=i[0],l=0;l<i.length-1;l++)c=Ve(this,a[n+l],t,l),c===S&&(c=this._$AH[l]),s||(s=!Dt(c)||c!==this._$AH[l]),c===E?e=E:e!==E&&(e+=(c??"")+i[l+1]),this._$AH[l]=c}s&&!o&&this.j(e)}j(e){e===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Dr=class extends Ke{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===E?void 0:e}},Ja=lt?lt.emptyScript:"",Nr=class extends Ke{constructor(){super(...arguments),this.type=4}j(e){e&&e!==E?this.element.setAttribute(this.name,Ja):this.element.removeAttribute(this.name)}},Fr=class extends Ke{constructor(e,t,n,o,i){super(e,t,n,o,i),this.type=5}_$AI(e,t=this){var n;if((e=(n=Ve(this,e,t,0))!==null&&n!==void 0?n:E)===S)return;let o=this._$AH,i=e===E&&o!==E||e.capture!==o.capture||e.once!==o.once||e.passive!==o.passive,s=e!==E&&(o===E||i);i&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,n;typeof this._$AH=="function"?this._$AH.call((n=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}},qr=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Ve(this,e)}},pt={P:"$lit$",A:$e,M:Un,C:1,L:wi,R:Ur,D:vi,V:Ve,I:ut,H:Ke,N:Nr,U:Fr,B:Dr,F:qr},hi=Lr.litHtmlPolyfillSupport;hi?.(Nt,ut),((Ln=Lr.litHtmlVersions)!==null&&Ln!==void 0?Ln:Lr.litHtmlVersions=[]).push("2.5.0");Te=(r,e,t)=>{var n,o;let i=(n=t?.renderBefore)!==null&&n!==void 0?n:e,s=i._$litPart$;if(s===void 0){let a=(o=t?.renderBefore)!==null&&o!==void 0?o:null;i._$litPart$=s=new ut(e.insertBefore(Ut(),a),a,void 0,t??{})}return s._$AI(r),s}});var $i=xe(ft=>{"use strict";var Za=ft&&ft.__setFunctionName||function(r,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(r,"name",{configurable:!0,value:t?"".concat(t," ",e):e})};Object.defineProperty(ft,"__esModule",{value:!0});ft.Component=void 0;var _i=(U(),C(zr)),Xa=(r,e,t)=>(window.customElements.define(r,e,t),e),Qa=(r,e,t)=>{let{kind:n,elements:o}=e;return{kind:n,elements:o,finisher(i){window.customElements.define(r,i,t)}}},el=r=>typeof r=="function",tl=(r,e={})=>t=>{var n,o;if(!((n=window._excluded_components)===null||n===void 0)&&n.includes(e.selector))return t;if(!r||r&&r.indexOf("-")<=0)throw new Error(`You need at least 1 dash in the custom element name! ${t}`);e.styles=e.styles||[],e.components=e.components||[];let i=t.prototype.OnInit||function(){},s=t.prototype.OnDestroy||function(){},a=t.prototype.OnUpdate||function(){},l=t.prototype.OnUpdateFirst||function(){},c=t.prototype.connectedCallback||function(){},u=t.prototype.disconnectedCallback||function(){},p=t.prototype.update||function(){},d=t.prototype.firstUpdated||function(){};e.template||(e.template=t.prototype.render||(()=>(0,_i.html)``)),e.style&&e.styles.push(e.style);let f=(o=class extends t{static is(){return r}getTemplateResult(){return this}OnInit(){if(e.container&&((0,_i.render)(e.template.call(this),e.container),e.style)){let h=document.createElement("style");h.type="text/css",h.styleSheet?h.styleSheet.cssText=e.style.toString():h.appendChild(document.createTextNode(e.style.toString())),e.container.prepend(h)}return i.call(this)}disconnectedCallback(){var h;s.call(this),u.call(this),(h=this._registry)===null||h===void 0||h.unsubscribe(),this._registry=null}connectedCallback(){var h,m;if(c.call(this),i.call(this),el(e.registry)&&(this._registry=e.registry.call(this)),!((h=e.modifiers)===null||h===void 0)&&h.length)for(let w of e.modifiers){if(!w)throw new Error(`Provided null value inside modifiers for component "${e.selector}"`);if(!w.options)throw new Error(`Missing options for attribute inside ${e.selector}`);if(!(!((m=w.options)===null||m===void 0)&&m.selector))throw new Error(`Missing attribute selector inside component "${e.selector}"`);if(!this._registry&&typeof w.options.registry=="function"&&(this._registry=w.options.registry.call(this)),!this._registry)throw new Error(`Missing attribute registry for attribute "${w.options.selector}" and no default registry specified inside component "${e.selector}"`);this._registry.define(w.options.selector,w)}}render(){return e.template.call(this)}update(){p.call(this),a.call(this)}firstUpdated(){d.call(this),l.call(this)}},Za(o,"ModifiedClass"),o.styles=e.styles,o),v=window.customElements.get(r);return v?(console.error(`** IMPORTANT!!! **
5
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),gi=/'/g,vi=/"/g,$i=/^(?:script|style|textarea|title)$/i,_i=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),Si=_i(1),Ai=_i(2),A=Symbol.for("lit-noChange"),E=Symbol.for("lit-nothing"),bi=new WeakMap,ut=dt.createTreeWalker(dt,129,null,!1),Ei=(r,e)=>{let t=r.length-1,n=[],o,i=e===2?"<svg>":"",s=Nt;for(let l=0;l<t;l++){let c=r[l],u,p,f=-1,d=0;for(;d<c.length&&(s.lastIndex=d,p=s.exec(c),p!==null);)d=s.lastIndex,s===Nt?p[1]==="!--"?s=hi:p[1]!==void 0?s=mi:p[2]!==void 0?($i.test(p[2])&&(o=RegExp("</"+p[2],"g")),s=Be):p[3]!==void 0&&(s=Be):s===Be?p[0]===">"?(s=o??Nt,f=-1):p[1]===void 0?f=-2:(f=s.lastIndex-p[2].length,u=p[1],s=p[3]===void 0?Be:p[3]==='"'?vi:gi):s===vi||s===gi?s=Be:s===hi||s===mi?s=Nt:(s=Be,o=void 0);let g=s===Be&&r[l+1].startsWith("/>")?" ":"";i+=s===Nt?c+tl:f>=0?(n.push(u),c.slice(0,f)+"$lit$"+c.slice(f)+_e+g):c+_e+(f===-2?(n.push(void 0),l):g)}let a=i+(r[t]||"<?>")+(e===2?"</svg>":"");if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return[fi!==void 0?fi.createHTML(a):a,n]},zt=class r{constructor({strings:e,_$litType$:t},n){let o;this.parts=[];let i=0,s=0,a=e.length-1,l=this.parts,[c,u]=Ei(e,t);if(this.el=r.createElement(c,n),ut.currentNode=this.el.content,t===2){let p=this.el.content,f=p.firstChild;f.remove(),p.append(...f.childNodes)}for(;(o=ut.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes()){let p=[];for(let f of o.getAttributeNames())if(f.endsWith("$lit$")||f.startsWith(_e)){let d=u[s++];if(p.push(f),d!==void 0){let g=o.getAttribute(d.toLowerCase()+"$lit$").split(_e),h=/([.?@])?(.*)/.exec(d);l.push({type:1,index:i,name:h[2],strings:g,ctor:h[1]==="."?qr:h[1]==="?"?Hr:h[1]==="@"?zr:Ye})}else l.push({type:6,index:i})}for(let f of p)o.removeAttribute(f)}if($i.test(o.tagName)){let p=o.textContent.split(_e),f=p.length-1;if(f>0){o.textContent=pt?pt.emptyScript:"";for(let d=0;d<f;d++)o.append(p[d],qt()),ut.nextNode(),l.push({type:2,index:++i});o.append(p[f],qt())}}}else if(o.nodeType===8)if(o.data===qn)l.push({type:2,index:i});else{let p=-1;for(;(p=o.data.indexOf(_e,p+1))!==-1;)l.push({type:7,index:i}),p+=_e.length-1}i++}}static createElement(e,t){let n=dt.createElement("template");return n.innerHTML=e,n}};Nr=class{constructor(e,t){this.u=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}v(e){var t;let{el:{content:n},parts:o}=this._$AD,i=((t=e?.creationScope)!==null&&t!==void 0?t:dt).importNode(n,!0);ut.currentNode=i;let s=ut.nextNode(),a=0,l=0,c=o[0];for(;c!==void 0;){if(a===c.index){let u;c.type===2?u=new ft(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new Wr(s,this,e)),this.u.push(u),c=o[++l]}a!==c?.index&&(s=ut.nextNode(),a++)}return i}p(e){let t=0;for(let n of this.u)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},ft=class r{constructor(e,t,n,o){var i;this.type=2,this._$AH=E,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=o,this._$Cm=(i=o?.isConnected)===null||i===void 0||i}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cm}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=Ve(this,e,t),Ht(e)?e===E||e==null||e===""?(this._$AH!==E&&this._$AR(),this._$AH=E):e!==this._$AH&&e!==A&&this.g(e):e._$litType$!==void 0?this.$(e):e.nodeType!==void 0?this.T(e):wi(e)?this.k(e):this.g(e)}O(e,t=this._$AB){return this._$AA.parentNode.insertBefore(e,t)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}g(e){this._$AH!==E&&Ht(this._$AH)?this._$AA.nextSibling.data=e:this.T(dt.createTextNode(e)),this._$AH=e}$(e){var t;let{values:n,_$litType$:o}=e,i=typeof o=="number"?this._$AC(e):(o.el===void 0&&(o.el=zt.createElement(o.h,this.options)),o);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===i)this._$AH.p(n);else{let s=new Nr(i,this),a=s.v(this.options);s.p(n),this.T(a),this._$AH=s}}_$AC(e){let t=bi.get(e.strings);return t===void 0&&bi.set(e.strings,t=new zt(e)),t}k(e){xi(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,o=0;for(let i of e)o===t.length?t.push(n=new r(this.O(qt()),this.O(qt()),this,this.options)):n=t[o],n._$AI(i),o++;o<t.length&&(this._$AR(n&&n._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,t);e&&e!==this._$AB;){let o=e.nextSibling;e.remove(),e=o}}setConnected(e){var t;this._$AM===void 0&&(this._$Cm=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},Ye=class{constructor(e,t,n,o,i){this.type=1,this._$AH=E,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=i,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=E}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,n,o){let i=this.strings,s=!1;if(i===void 0)e=Ve(this,e,t,0),s=!Ht(e)||e!==this._$AH&&e!==A,s&&(this._$AH=e);else{let a=e,l,c;for(e=i[0],l=0;l<i.length-1;l++)c=Ve(this,a[n+l],t,l),c===A&&(c=this._$AH[l]),s||(s=!Ht(c)||c!==this._$AH[l]),c===E?e=E:e!==E&&(e+=(c??"")+i[l+1]),this._$AH[l]=c}s&&!o&&this.j(e)}j(e){e===E?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},qr=class extends Ye{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===E?void 0:e}},rl=pt?pt.emptyScript:"",Hr=class extends Ye{constructor(){super(...arguments),this.type=4}j(e){e&&e!==E?this.element.setAttribute(this.name,rl):this.element.removeAttribute(this.name)}},zr=class extends Ye{constructor(e,t,n,o,i){super(e,t,n,o,i),this.type=5}_$AI(e,t=this){var n;if((e=(n=Ve(this,e,t,0))!==null&&n!==void 0?n:E)===A)return;let o=this._$AH,i=e===E&&o!==E||e.capture!==o.capture||e.once!==o.once||e.passive!==o.passive,s=e!==E&&(o===E||i);i&&this.element.removeEventListener(this.name,this,o),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,n;typeof this._$AH=="function"?this._$AH.call((n=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}},Wr=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){Ve(this,e)}},ht={P:"$lit$",A:_e,M:qn,C:1,L:Ei,R:Nr,D:wi,V:Ve,I:ft,H:Ye,N:Hr,U:zr,B:qr,F:Wr},yi=Dr.litHtmlPolyfillSupport;yi?.(zt,ft),((Nn=Dr.litHtmlVersions)!==null&&Nn!==void 0?Nn:Dr.litHtmlVersions=[]).push("2.5.0");Te=(r,e,t)=>{var n,o;let i=(n=t?.renderBefore)!==null&&n!==void 0?n:e,s=i._$litPart$;if(s===void 0){let a=(o=t?.renderBefore)!==null&&o!==void 0?o:null;i._$litPart$=s=new ft(e.insertBefore(qt(),a),a,void 0,t??{})}return s._$AI(r),s}});var ki=xe(mt=>{"use strict";var nl=mt&&mt.__setFunctionName||function(r,e,t){return typeof e=="symbol"&&(e=e.description?"[".concat(e.description,"]"):""),Object.defineProperty(r,"name",{configurable:!0,value:t?"".concat(t," ",e):e})};Object.defineProperty(mt,"__esModule",{value:!0});mt.Component=void 0;var Ci=(U(),C(Kr)),ol=(r,e,t)=>(window.customElements.define(r,e,t),e),il=(r,e,t)=>{let{kind:n,elements:o}=e;return{kind:n,elements:o,finisher(i){window.customElements.define(r,i,t)}}},sl=r=>typeof r=="function",al=(r,e={})=>t=>{var n,o;if(!((n=window._excluded_components)===null||n===void 0)&&n.includes(e.selector))return t;if(!r||r&&r.indexOf("-")<=0)throw new Error(`You need at least 1 dash in the custom element name! ${t}`);e.styles=e.styles||[],e.components=e.components||[];let i=t.prototype.OnInit||function(){},s=t.prototype.OnDestroy||function(){},a=t.prototype.OnUpdate||function(){},l=t.prototype.OnUpdateFirst||function(){},c=t.prototype.connectedCallback||function(){},u=t.prototype.disconnectedCallback||function(){},p=t.prototype.update||function(){},f=t.prototype.firstUpdated||function(){};e.template||(e.template=t.prototype.render||(()=>(0,Ci.html)``)),e.style&&e.styles.push(e.style);let d=(o=class extends t{static is(){return r}getTemplateResult(){return this}OnInit(){if(e.container&&((0,Ci.render)(e.template.call(this),e.container),e.style)){let h=document.createElement("style");h.type="text/css",h.styleSheet?h.styleSheet.cssText=e.style.toString():h.appendChild(document.createTextNode(e.style.toString())),e.container.prepend(h)}return i.call(this)}disconnectedCallback(){var h;s.call(this),u.call(this),(h=this._registry)===null||h===void 0||h.unsubscribe(),this._registry=null}connectedCallback(){var h,m;if(c.call(this),i.call(this),sl(e.registry)&&(this._registry=e.registry.call(this)),!((h=e.modifiers)===null||h===void 0)&&h.length)for(let w of e.modifiers){if(!w)throw new Error(`Provided null value inside modifiers for component "${e.selector}"`);if(!w.options)throw new Error(`Missing options for attribute inside ${e.selector}`);if(!(!((m=w.options)===null||m===void 0)&&m.selector))throw new Error(`Missing attribute selector inside component "${e.selector}"`);if(!this._registry&&typeof w.options.registry=="function"&&(this._registry=w.options.registry.call(this)),!this._registry)throw new Error(`Missing attribute registry for attribute "${w.options.selector}" and no default registry specified inside component "${e.selector}"`);this._registry.define(w.options.selector,w)}}render(){return e.template.call(this)}update(){p.call(this),a.call(this)}firstUpdated(){f.call(this),l.call(this)}},nl(o,"ModifiedClass"),o.styles=e.styles,o),g=window.customElements.get(r);return g?(console.error(`** IMPORTANT!!! **
6
6
  ------------------------------------------
7
7
  < ${r} > </${r}> Component re-defined multiple times and it is already registered inside customElements registry
8
8
  Possible Solutions:
@@ -12,28 +12,28 @@ Possible Solutions:
12
12
 
13
13
  ** If this is Server Side Rendering you can ignore this message **
14
14
  ------------------------------------------
15
- `),v):(typeof f=="function"?Xa(r,f,{extends:e.extends}):Qa(r,f,{extends:e.extends}),f)},rl=r=>tl(r.selector,r);ft.Component=rl});var Si=xe(Ai=>{"use strict";Object.defineProperty(Ai,"__esModule",{value:!0})});var Ci=xe(Oe=>{"use strict";var nl=Oe&&Oe.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,o)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Ei=Oe&&Oe.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&nl(e,r,t)};Object.defineProperty(Oe,"__esModule",{value:!0});Ei($i(),Oe);Ei(Si(),Oe)});var Dn={};j(Dn,{Directive:()=>L,PartType:()=>O,directive:()=>T});var O,T,L,N=x(()=>{O={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},T=r=>(...e)=>({_$litDirective$:r,values:e}),L=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}});var Oi={};j(Oi,{TemplateResultType:()=>il,clearPart:()=>zt,getCommittedValue:()=>dt,getDirectiveClass:()=>al,insertPart:()=>ie,isDirectiveResult:()=>sl,isPrimitive:()=>Ft,isSingleExpression:()=>Ye,isTemplateResult:()=>ke,removePart:()=>qt,setChildPartValue:()=>pe,setCommittedValue:()=>ge});var ol,Ft,il,ke,sl,al,Ye,Ti,ie,pe,ll,ge,dt,qt,zt,ye=x(()=>{U();({I:ol}=pt),Ft=r=>r===null||typeof r!="object"&&typeof r!="function",il={HTML:1,SVG:2},ke=(r,e)=>e===void 0?r?._$litType$!==void 0:r?._$litType$===e,sl=r=>r?._$litDirective$!==void 0,al=r=>r?._$litDirective$,Ye=r=>r.strings===void 0,Ti=()=>document.createComment(""),ie=(r,e,t)=>{var n;let o=r._$AA.parentNode,i=e===void 0?r._$AB:e._$AA;if(t===void 0){let s=o.insertBefore(Ti(),i),a=o.insertBefore(Ti(),i);t=new ol(s,a,r,r.options)}else{let s=t._$AB.nextSibling,a=t._$AM,l=a!==r;if(l){let c;(n=t._$AQ)===null||n===void 0||n.call(t,r),t._$AM=r,t._$AP!==void 0&&(c=r._$AU)!==a._$AU&&t._$AP(c)}if(s!==i||l){let c=t._$AA;for(;c!==s;){let u=c.nextSibling;o.insertBefore(c,i),c=u}}}return t},pe=(r,e,t=r)=>(r._$AI(e,t),r),ll={},ge=(r,e=ll)=>r._$AH=e,dt=r=>r._$AH,qt=r=>{var e;(e=r._$AP)===null||e===void 0||e.call(r,!1,!0);let t=r._$AA,n=r._$AB.nextSibling;for(;t!==n;){let o=t.nextSibling;t.remove(),t=o}},zt=r=>{r._$AR()}});var Nn={};j(Nn,{AsyncDirective:()=>Ae,Directive:()=>L,PartType:()=>O,directive:()=>T});function cl(r){this._$AN!==void 0?(Hr(this),this._$AM=r,ki(this)):this._$AM=r}function ul(r,e=!1,t=0){let n=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(n))for(let i=t;i<n.length;i++)Ht(n[i],!1),Hr(n[i]);else n!=null&&(Ht(n,!1),Hr(n));else Ht(this,r)}var Ht,Hr,ki,pl,Ae,ht=x(()=>{ye();N();N();Ht=(r,e)=>{var t,n;let o=r._$AN;if(o===void 0)return!1;for(let i of o)(n=(t=i)._$AO)===null||n===void 0||n.call(t,e,!1),Ht(i,e);return!0},Hr=r=>{let e,t;do{if((e=r._$AM)===void 0)break;t=e._$AN,t.delete(r),r=e}while(t?.size===0)},ki=r=>{for(let e;e=r._$AM;r=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(r))break;t.add(r),pl(e)}};pl=r=>{var e,t,n,o;r.type==O.CHILD&&((e=(n=r)._$AP)!==null&&e!==void 0||(n._$AP=ul),(t=(o=r)._$AQ)!==null&&t!==void 0||(o._$AQ=cl))},Ae=class extends L{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),ki(this),this.isConnected=e._$AU}_$AO(e,t=!0){var n,o;e!==this.isConnected&&(this.isConnected=e,e?(n=this.reconnected)===null||n===void 0||n.call(this):(o=this.disconnected)===null||o===void 0||o.call(this)),t&&(Ht(this,e),Hr(this))}setValue(e){if(Ye(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}});var Pi=xe(Wr=>{"use strict";Object.defineProperty(Wr,"__esModule",{value:!0});Wr.async=void 0;var fl=(N(),C(Dn)),dl=(ht(),C(Nn)),hl=(U(),C(zr)),Fn=class extends dl.AsyncDirective{render(e){return"then"in e?(Promise.resolve(e).then(t=>this.setValue(t)),""):(this.observable!==e&&(this.unsubscribe(),this.observable=e,this.isConnected&&this.subscribe(e)),hl.noChange)}subscribe(e){this.subscription=e.subscribe(t=>{this.setValue(t)})}disconnected(){this.unsubscribe()}unsubscribe(){this.subscription&&this.subscription.unsubscribe()}reconnected(){this.subscribe(this.observable)}};Wr.async=(0,fl.directive)(Fn)});var Mi={};j(Mi,{digestForTemplateResult:()=>Ri,hydrate:()=>qn});var ml,vl,Ii,Wt,gl,qn,yl,bl,xl,Ri,zn=x(()=>{U();N();ye();({R:ml,D:vl,V:Ii,I:Wt,F:gl}=pt),qn=(r,e,t={})=>{if(e._$litPart$!==void 0)throw Error("container already contains a live render");let n,o,i=[],s=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT,null,!1),a;for(;(a=s.nextNode())!==null;){let l=a.data;if(l.startsWith("lit-part")){if(i.length===0&&n!==void 0)throw Error("there must be only one root part per container");o=yl(r,a,i,t),n!=null||(n=o)}else if(l.startsWith("lit-node"))xl(a,i,t);else if(l.startsWith("/lit-part")){if(i.length===1&&o!==n)throw Error("internal error");o=bl(a,o,i)}}console.assert(n!==void 0,"there should be exactly one root part in a render container"),e._$litPart$=n},yl=(r,e,t,n)=>{let o,i;if(t.length===0)i=new Wt(e,null,void 0,n),o=r;else{let s=t[t.length-1];if(s.type==="template-instance")i=new Wt(e,null,s.instance,n),s.instance.u.push(i),o=s.result.values[s.instancePartIndex++],s.templatePartIndex++;else if(s.type==="iterable"){i=new Wt(e,null,s.part,n);let a=s.iterator.next();if(a.done)throw o=void 0,s.done=!0,Error("Unhandled shorter than expected iterable");o=a.value,s.part._$AH.push(i)}else i=new Wt(e,null,s.part,n)}if(o=Ii(i,o),o===S)t.push({part:i,type:"leaf"});else if(Ft(o))t.push({part:i,type:"leaf"}),i._$AH=o;else if(ke(o)){let s="lit-part "+Ri(o);if(e.data!==s)throw Error("Hydration value mismatch: Unexpected TemplateResult rendered to part");{let a=Wt.prototype._$AC(o),l=new ml(a,i);t.push({type:"template-instance",instance:l,part:i,templatePartIndex:0,instancePartIndex:0,result:o}),i._$AH=l}}else vl(o)?(t.push({part:i,type:"iterable",value:o,iterator:o[Symbol.iterator](),done:!1}),i._$AH=[]):(t.push({part:i,type:"leaf"}),i._$AH=o??"");return i},bl=(r,e,t)=>{if(e===void 0)throw Error("unbalanced part marker");e._$AB=r;let n=t.pop();if(n.type==="iterable"&&!n.iterator.next().done)throw Error("unexpected longer than expected iterable");if(t.length>0)return t[t.length-1].part},xl=(r,e,t)=>{var n;let o=/lit-node (\d+)/.exec(r.data),i=parseInt(o[1]),s=(n=r.previousElementSibling)!==null&&n!==void 0?n:r.parentElement;if(s===null)throw Error("could not find node for attribute parts");s.removeAttribute("defer-hydration");let a=e[e.length-1];if(a.type!=="template-instance")throw Error("internal error");{let l=a.instance;for(;;){let c=l._$AD.parts[a.templatePartIndex];if(c===void 0||c.type!==O.ATTRIBUTE&&c.type!==O.ELEMENT||c.index!==i)break;if(c.type===O.ATTRIBUTE){let u=new c.ctor(s,c.name,c.strings,a.instance,t),p=Ye(u)?a.result.values[a.instancePartIndex]:a.result.values,d=!(u.type===O.EVENT||u.type===O.PROPERTY);u._$AI(p,u,a.instancePartIndex,d),a.instancePartIndex+=c.strings.length-1,l.u.push(u)}else{let u=new gl(s,a.instance,t);Ii(u,a.result.values[a.instancePartIndex++]),l.u.push(u)}a.templatePartIndex++}}},Ri=r=>{let e=new Uint32Array(2).fill(5381);for(let t of r.strings)for(let n=0;n<t.length;n++)e[n%2]=33*e[n%2]^t.charCodeAt(n);return btoa(String.fromCharCode(...new Uint8Array(e.buffer)))}});var wl={};var ji=x(()=>{U();zn();globalThis.litElementHydrateSupport=({LitElement:r})=>{let e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),"observedAttributes").get;Object.defineProperty(r,"observedAttributes",{get(){return[...e.call(this),"defer-hydration"]}});let t=r.prototype.attributeChangedCallback;r.prototype.attributeChangedCallback=function(s,a,l){s==="defer-hydration"&&l===null&&n.call(this),t.call(this,s,a,l)};let n=r.prototype.connectedCallback;r.prototype.connectedCallback=function(){this.hasAttribute("defer-hydration")||n.call(this)};let o=r.prototype.createRenderRoot;r.prototype.createRenderRoot=function(){return this.shadowRoot?(this._$AG=!0,this.shadowRoot):o.call(this)};let i=Object.getPrototypeOf(r.prototype).update;r.prototype.update=function(s){let a=this.render();i.call(this,s),this._$AG?(this._$AG=!1,qn(a,this.renderRoot,this.renderOptions)):Te(a,this.renderRoot,this.renderOptions)}}});var Li=xe(()=>{(function(r){typeof define=="function"&&define.amd?define(r):r()})((function(){"use strict";var r,e=new Set,t=new Map;(r=globalThis.litHtmlPolyfillSupport)!==null&&r!==void 0||(globalThis.litHtmlPolyfillSupport=function(n,o){if(window.ShadyCSS!==void 0&&(!window.ShadyCSS.nativeShadow||window.ShadyCSS.ApplyShim)){var i=function(f){return f!==void 0&&!e.has(f)},s=function(f){var v=t.get(f);return v===void 0&&t.set(f,v=[]),v},a=new Map,l=n.createElement;n.createElement=function(f,v){var h=l.call(n,f,v),m=v?.scope;if(m!==void 0&&(window.ShadyCSS.nativeShadow||window.ShadyCSS.prepareTemplateDom(h,m),i(m))){var w=s(m),G=h.content.querySelectorAll("style");w.push.apply(w,Array.from(G).map((function(ae){var be;return(be=ae.parentNode)===null||be===void 0||be.removeChild(ae),ae.textContent})))}return h};var c=document.createDocumentFragment(),u=document.createComment(""),p=o.prototype,d=p._$AI;p._$AI=function(f,v){var h,m;v===void 0&&(v=this);var w=this._$AA.parentNode,G=(h=this.options)===null||h===void 0?void 0:h.scope;if(w instanceof ShadowRoot&&i(G)){var ae=this._$AA,be=this._$AB;c.appendChild(u),this._$AA=u,this._$AB=null,d.call(this,f,v);var je=f?._$litType$?this._$AH._$AD.el:document.createElement("template");if((function(nr,or){var ir,vo=s(nr),go=vo.length!==0;go&&((ir=document.createElement("style")).textContent=vo.join(`
16
- `),or.content.appendChild(ir)),e.add(nr),t.delete(nr),window.ShadyCSS.prepareTemplateStyles(or,nr),go&&window.ShadyCSS.nativeShadow&&(ir=or.content.querySelector("style"))!==null&&or.content.appendChild(ir)})(G,je),c.removeChild(u),(m=window.ShadyCSS)===null||m===void 0?void 0:m.nativeShadow){var Le=je.content.querySelector("style");Le!==null&&c.appendChild(Le.cloneNode(!0))}w.insertBefore(c,be),this._$AA=ae,this._$AB=be}else d.call(this,f,v)},p._$AC=function(f){var v,h=(v=this.options)===null||v===void 0?void 0:v.scope,m=a.get(h);m===void 0&&a.set(h,m=new Map);var w=m.get(f.strings);return w===void 0&&m.set(f.strings,w=new n(f,this.options)),w}}})}))});var Br,Bt,Hn,Ui,mt,Wn,Di,Vr,Vt,Bn=x(()=>{Br=window,Bt=Br.ShadowRoot&&(Br.ShadyCSS===void 0||Br.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Hn=Symbol(),Ui=new WeakMap,mt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Hn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Bt&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Ui.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Ui.set(t,e))}return e}toString(){return this.cssText}},Wn=r=>new mt(typeof r=="string"?r:r+"",void 0,Hn),Di=(r,...e)=>{let t=r.length===1?r[0]:e.reduce(((n,o,i)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+r[i+1]),r[0]);return new mt(t,r,Hn)},Vr=(r,e)=>{Bt?r.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((t=>{let n=document.createElement("style"),o=Br.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}))},Vt=Bt?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Wn(t)})(r):r});var Vn,Kr,Ni,_l,Fi,Yr,Yn,Kn,fe,Gr=x(()=>{Bn();Bn();Kr=window,Ni=Kr.trustedTypes,_l=Ni?Ni.emptyScript:"",Fi=Kr.reactiveElementPolyfillSupport,Yr={toAttribute(r,e){switch(e){case Boolean:r=r?_l:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Yn=(r,e)=>e!==r&&(e==e||r==r),Kn={attribute:!0,type:String,converter:Yr,reflect:!1,hasChanged:Yn},fe=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach(((t,n)=>{let o=this._$Ep(n,t);o!==void 0&&(this._$Ev.set(o,n),e.push(o))})),e}static createProperty(e,t=Kn){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,o=this.getPropertyDescriptor(e,n,t);o!==void 0&&Object.defineProperty(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(o){let i=this[e];this[t]=o,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Kn}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,n=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let o of n)this.createProperty(o,t[o])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let o of n)t.unshift(Vt(o))}else e!==void 0&&t.push(Vt(e));return t}static _$Ep(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach((t=>t(this)))}addController(e){var t,n;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return Vr(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach((t=>{var n;return(n=t.hostConnected)===null||n===void 0?void 0:n.call(t)}))}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach((t=>{var n;return(n=t.hostDisconnected)===null||n===void 0?void 0:n.call(t)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=Kn){var o;let i=this.constructor._$Ep(e,n);if(i!==void 0&&n.reflect===!0){let s=(((o=n.converter)===null||o===void 0?void 0:o.toAttribute)!==void 0?n.converter:Yr).toAttribute(t,n.type);this._$El=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$El=null}}_$AK(e,t){var n;let o=this.constructor,i=o._$Ev.get(e);if(i!==void 0&&this._$El!==i){let s=o.getPropertyOptions(i),a=typeof s.converter=="function"?{fromAttribute:s.converter}:((n=s.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?s.converter:Yr;this._$El=i,this[i]=a.fromAttribute(t,s.type),this._$El=null}}requestUpdate(e,t,n){let o=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Yn)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((o,i)=>this[i]=o)),this._$Ei=void 0);let t=!1,n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach((o=>{var i;return(i=o.hostUpdate)===null||i===void 0?void 0:i.call(o)})),this.update(n)):this._$Ek()}catch(o){throw t=!1,this._$Ek(),o}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach((n=>{var o;return(o=n.hostUpdated)===null||o===void 0?void 0:o.call(n)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach(((t,n)=>this._$EO(n,this[n],t))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};fe.finalized=!0,fe.elementProperties=new Map,fe.elementStyles=[],fe.shadowRootOptions={mode:"open"},Fi?.({ReactiveElement:fe}),((Vn=Kr.reactiveElementVersions)!==null&&Vn!==void 0?Vn:Kr.reactiveElementVersions=[]).push("1.5.0")});var Gn,Jn,zi,Pe,qi,Hi,Wi=x(()=>{Gr();Gr();U();U();zi=fe,Pe=class extends fe{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let n=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=n.firstChild),n}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Te(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return S}};Pe.finalized=!0,Pe._$litElement$=!0,(Gn=globalThis.litElementHydrateSupport)===null||Gn===void 0||Gn.call(globalThis,{LitElement:Pe});qi=globalThis.litElementPolyfillSupport;qi?.({LitElement:Pe});Hi={_$AK:(r,e,t)=>{r._$AK(e,t)},_$AL:r=>r._$AL};((Jn=globalThis.litElementVersions)!==null&&Jn!==void 0?Jn:globalThis.litElementVersions=[]).push("3.2.2")});var $l,Al,ee,Ie=x(()=>{$l=(r,e,t)=>{Object.defineProperty(e,t,r)},Al=(r,e)=>({kind:"method",placement:"prototype",key:e.key,descriptor:r}),ee=({finisher:r,descriptor:e})=>(t,n)=>{var o;if(n===void 0){let i=(o=t.originalKey)!==null&&o!==void 0?o:t.key,s=e!=null?{kind:"method",placement:"prototype",key:i,descriptor:e(t.key)}:{...t,key:i};return r!=null&&(s.finisher=function(a){r(a,i)}),s}{let i=t.constructor;e!==void 0&&Object.defineProperty(t,n,e(n)),r?.(i,n)}}});var Sl,Bi=x(()=>{Sl=r=>e=>typeof e=="function"?((t,n)=>(customElements.define(t,n),n))(r,e):((t,n)=>{let{kind:o,elements:i}=n;return{kind:o,elements:i,finisher(s){customElements.define(t,s)}}})(r,e)});function Zn(r){return(e,t)=>t!==void 0?((n,o,i)=>{o.constructor.createProperty(i,n)})(r,e,t):El(r,e)}var El,Xn=x(()=>{El=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}}});function Cl(r){return Zn({...r,state:!0})}var Vi=x(()=>{Xn();});function Tl(r){return ee({finisher:(e,t)=>{Object.assign(e.prototype[t],r)}})}var Ki=x(()=>{Ie();});function Ol(r,e){return ee({descriptor:t=>{let n={get(){var o,i;return(i=(o=this.renderRoot)===null||o===void 0?void 0:o.querySelector(r))!==null&&i!==void 0?i:null},enumerable:!0,configurable:!0};if(e){let o=typeof t=="symbol"?Symbol():"__"+t;n.get=function(){var i,s;return this[o]===void 0&&(this[o]=(s=(i=this.renderRoot)===null||i===void 0?void 0:i.querySelector(r))!==null&&s!==void 0?s:null),this[o]}}return n}})}var Yi=x(()=>{Ie();});function kl(r){return ee({descriptor:e=>({get(){var t,n;return(n=(t=this.renderRoot)===null||t===void 0?void 0:t.querySelectorAll(r))!==null&&n!==void 0?n:[]},enumerable:!0,configurable:!0})})}var Gi=x(()=>{Ie();});function Pl(r){return ee({descriptor:e=>({async get(){var t;return await this.updateComplete,(t=this.renderRoot)===null||t===void 0?void 0:t.querySelector(r)},enumerable:!0,configurable:!0})})}var Ji=x(()=>{Ie();});function eo(r){let{slot:e,selector:t}=r??{};return ee({descriptor:n=>({get(){var o;let i="slot"+(e?`[name=${e}]`:":not([name])"),s=(o=this.renderRoot)===null||o===void 0?void 0:o.querySelector(i),a=s!=null?Il(s,r):[];return t?a.filter((l=>l.matches(t))):a},enumerable:!0,configurable:!0})})}var Qn,Il,to=x(()=>{Ie();Il=((Qn=window.HTMLSlotElement)===null||Qn===void 0?void 0:Qn.prototype.assignedElements)!=null?(r,e)=>r.assignedElements(e):(r,e)=>r.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE))});function Rl(r,e,t){let n,o=r;return typeof r=="object"?(o=r.slot,n=r):n={flatten:e},t?eo({slot:o,flatten:e,selector:t}):ee({descriptor:i=>({get(){var s,a;let l="slot"+(o?`[name=${o}]`:":not([name])"),c=(s=this.renderRoot)===null||s===void 0?void 0:s.querySelector(l);return(a=c?.assignedNodes(n))!==null&&a!==void 0?a:[]},enumerable:!0,configurable:!0})})}var Zi=x(()=>{Ie();to();});var Xi={};j(Xi,{CSSResult:()=>mt,LitElement:()=>Pe,ReactiveElement:()=>fe,UpdatingElement:()=>zi,_$LE:()=>Hi,_$LH:()=>pt,adoptStyles:()=>Vr,css:()=>Di,customElement:()=>Sl,decorateProperty:()=>ee,defaultConverter:()=>Yr,eventOptions:()=>Tl,getCompatibleStyle:()=>Vt,html:()=>bi,legacyPrototypeMethod:()=>$l,noChange:()=>S,notEqual:()=>Yn,nothing:()=>E,property:()=>Zn,query:()=>Ol,queryAll:()=>kl,queryAssignedElements:()=>eo,queryAssignedNodes:()=>Rl,queryAsync:()=>Pl,render:()=>Te,standardPrototypeMethod:()=>Al,state:()=>Cl,supportsAdoptingStyleSheets:()=>Bt,svg:()=>xi,unsafeCSS:()=>Wn});var Qi=x(()=>{Gr();U();Wi();Ie();Bi();Xn();Vi();Ki();Yi();Gi();Ji();to();Zi();console.warn("The main 'lit-element' module entrypoint is deprecated. Please update your imports to use the 'lit' package: 'lit' and 'lit/decorators.ts' or import from 'lit-element/lit-element.ts'. See https://lit.dev/msg/deprecated-import-path for more information.")});var es={};j(es,{classMap:()=>Ml});var Ml,ts=x(()=>{U();N();Ml=T(class extends L{constructor(r){var e;if(super(r),r.type!==O.ATTRIBUTE||r.name!=="class"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter((e=>r[e])).join(" ")+" "}update(r,[e]){var t,n;if(this.nt===void 0){this.nt=new Set,r.strings!==void 0&&(this.st=new Set(r.strings.join(" ").split(/\s/).filter((i=>i!==""))));for(let i in e)e[i]&&!(!((t=this.st)===null||t===void 0)&&t.has(i))&&this.nt.add(i);return this.render(e)}let o=r.element.classList;this.nt.forEach((i=>{i in e||(o.remove(i),this.nt.delete(i))}));for(let i in e){let s=!!e[i];s===this.nt.has(i)||!((n=this.st)===null||n===void 0)&&n.has(i)||(s?(o.add(i),this.nt.add(i)):(o.remove(i),this.nt.delete(i)))}return S}})});var rs,vt,gt,ro=x(()=>{rs=async(r,e)=>{for await(let t of r)if(await e(t)===!1)return},vt=class{constructor(e){this.Y=e}disconnect(){this.Y=void 0}reconnect(e){this.Y=e}deref(){return this.Y}},gt=class{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){var e;(e=this.Z)!==null&&e!==void 0||(this.Z=new Promise((t=>this.q=t)))}resume(){var e;(e=this.q)===null||e===void 0||e.call(this),this.Z=this.q=void 0}}});var ns={};j(ns,{AsyncReplaceDirective:()=>yt,asyncReplace:()=>jl});var yt,jl,no=x(()=>{U();ht();ro();N();yt=class extends Ae{constructor(){super(...arguments),this._$CK=new vt(this),this._$CX=new gt}render(e,t){return S}update(e,[t,n]){if(this.isConnected||this.disconnected(),t===this._$CJ)return;this._$CJ=t;let o=0,{_$CK:i,_$CX:s}=this;return rs(t,(async a=>{for(;s.get();)await s.get();let l=i.deref();if(l!==void 0){if(l._$CJ!==t)return!1;n!==void 0&&(a=n(a,o)),l.commitValue(a,o),o++}return!0})),S}commitValue(e,t){this.setValue(e)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},jl=T(yt)});var os={};j(os,{asyncAppend:()=>Ll});var Ll,is=x(()=>{N();no();ye();Ll=T(class extends yt{constructor(r){if(super(r),r.type!==O.CHILD)throw Error("asyncAppend can only be used in child expressions")}update(r,e){return this._$Ctt=r,super.update(r,e)}commitValue(r,e){e===0&&zt(this._$Ctt);let t=ie(this._$Ctt);pe(t,r)}})});var ss={};j(ss,{cache:()=>Ul});var Ul,as=x(()=>{U();N();ye();Ul=T(class extends L{constructor(r){super(r),this.et=new WeakMap}render(r){return[r]}update(r,[e]){if(ke(this.it)&&(!ke(e)||this.it.strings!==e.strings)){let t=dt(r).pop(),n=this.et.get(this.it.strings);if(n===void 0){let o=document.createDocumentFragment();n=Te(E,o),n.setConnected(!1),this.et.set(this.it.strings,n)}ge(n,[t]),ie(n,void 0,t)}if(ke(e)){if(!ke(this.it)||this.it.strings!==e.strings){let t=this.et.get(e.strings);if(t!==void 0){let n=dt(t).pop();zt(r),ie(r,void 0,n),ge(r,[n])}}this.it=e}else this.it=void 0;return this.render(e)}})});var ls={};j(ls,{guard:()=>Nl});var Dl,Nl,cs=x(()=>{U();N();Dl={},Nl=T(class extends L{constructor(){super(...arguments),this.ot=Dl}render(r,e){return e()}update(r,[e,t]){if(Array.isArray(e)){if(Array.isArray(this.ot)&&this.ot.length===e.length&&e.every(((n,o)=>n===this.ot[o])))return S}else if(this.ot===e)return S;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,t)}})});var us={};j(us,{ifDefined:()=>Fl});var Fl,ps=x(()=>{U();Fl=r=>r??E});var fs={};j(fs,{live:()=>ql});var ql,ds=x(()=>{U();N();ye();ql=T(class extends L{constructor(r){if(super(r),r.type!==O.PROPERTY&&r.type!==O.ATTRIBUTE&&r.type!==O.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Ye(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(r,[e]){if(e===S||e===E)return e;let t=r.element,n=r.name;if(r.type===O.PROPERTY){if(e===t[n])return S}else if(r.type===O.BOOLEAN_ATTRIBUTE){if(!!e===t.hasAttribute(n))return S}else if(r.type===O.ATTRIBUTE&&t.getAttribute(n)===e+"")return S;return ge(r),e}})});var hs={};j(hs,{createRef:()=>zl,ref:()=>Hl});var zl,io,oo,Hl,ms=x(()=>{U();ht();N();zl=()=>new io,io=class{},oo=new WeakMap,Hl=T(class extends Ae{render(r){return E}update(r,[e]){var t;let n=e!==this.Y;return n&&this.Y!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=e,this.dt=(t=r.options)===null||t===void 0?void 0:t.host,this.rt(this.ct=r.element)),E}rt(r){var e;if(typeof this.Y=="function"){let t=(e=this.dt)!==null&&e!==void 0?e:globalThis,n=oo.get(t);n===void 0&&(n=new WeakMap,oo.set(t,n)),n.get(this.Y)!==void 0&&this.Y.call(this.dt,void 0),n.set(this.Y,r),r!==void 0&&this.Y.call(this.dt,r)}else this.Y.value=r}get lt(){var r,e,t;return typeof this.Y=="function"?(e=oo.get((r=this.dt)!==null&&r!==void 0?r:globalThis))===null||e===void 0?void 0:e.get(this.Y):(t=this.Y)===null||t===void 0?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}})});var gs={};j(gs,{repeat:()=>Wl});var vs,Wl,ys=x(()=>{U();N();ye();vs=(r,e,t)=>{let n=new Map;for(let o=e;o<=t;o++)n.set(r[o],o);return n},Wl=T(class extends L{constructor(r){if(super(r),r.type!==O.CHILD)throw Error("repeat() can only be used in text expressions")}ht(r,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);let o=[],i=[],s=0;for(let a of r)o[s]=n?n(a,s):s,i[s]=t(a,s),s++;return{values:i,keys:o}}render(r,e,t){return this.ht(r,e,t).values}update(r,[e,t,n]){var o;let i=dt(r),{values:s,keys:a}=this.ht(e,t,n);if(!Array.isArray(i))return this.ut=a,s;let l=(o=this.ut)!==null&&o!==void 0?o:this.ut=[],c=[],u,p,d=0,f=i.length-1,v=0,h=s.length-1;for(;d<=f&&v<=h;)if(i[d]===null)d++;else if(i[f]===null)f--;else if(l[d]===a[v])c[v]=pe(i[d],s[v]),d++,v++;else if(l[f]===a[h])c[h]=pe(i[f],s[h]),f--,h--;else if(l[d]===a[h])c[h]=pe(i[d],s[h]),ie(r,c[h+1],i[d]),d++,h--;else if(l[f]===a[v])c[v]=pe(i[f],s[v]),ie(r,i[d],i[f]),f--,v++;else if(u===void 0&&(u=vs(a,v,h),p=vs(l,d,f)),u.has(l[d]))if(u.has(l[f])){let m=p.get(a[v]),w=m!==void 0?i[m]:null;if(w===null){let G=ie(r,i[d]);pe(G,s[v]),c[v]=G}else c[v]=pe(w,s[v]),ie(r,i[d],w),i[m]=null;v++}else qt(i[f]),f--;else qt(i[d]),d++;for(;v<=h;){let m=ie(r,c[h+1]);pe(m,s[v]),c[v++]=m}for(;d<=f;){let m=i[d++];m!==null&&qt(m)}return this.ut=a,ge(r,c),S}})});var bs={};j(bs,{styleMap:()=>Bl});var Bl,xs=x(()=>{U();N();Bl=T(class extends L{constructor(r){var e;if(super(r),r.type!==O.ATTRIBUTE||r.name!=="style"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce(((e,t)=>{let n=r[t];return n==null?e:e+`${t=t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`}),"")}update(r,[e]){let{style:t}=r.element;if(this.vt===void 0){this.vt=new Set;for(let n in e)this.vt.add(n);return this.render(e)}this.vt.forEach((n=>{e[n]==null&&(this.vt.delete(n),n.includes("-")?t.removeProperty(n):t[n]="")}));for(let n in e){let o=e[n];o!=null&&(this.vt.add(n),n.includes("-")?t.setProperty(n,o):t[n]=o)}return S}})});var ws={};j(ws,{templateContent:()=>Vl});var Vl,_s=x(()=>{U();N();Vl=T(class extends L{constructor(r){if(super(r),r.type!==O.CHILD)throw Error("templateContent can only be used in child bindings")}render(r){return this.ft===r?S:(this.ft=r,document.importNode(r.content,!0))}})});var $s={};j($s,{UnsafeHTMLDirective:()=>Re,unsafeHTML:()=>Kl});var Re,Kl,so=x(()=>{U();N();Re=class extends L{constructor(e){if(super(e),this.it=E,e.type!==O.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===E||e==null)return this._t=void 0,this.it=e;if(e===S)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};Re.directiveName="unsafeHTML",Re.resultType=1;Kl=T(Re)});var As={};j(As,{unsafeSVG:()=>Yl});var Kt,Yl,Ss=x(()=>{N();so();Kt=class extends Re{};Kt.directiveName="unsafeSVG",Kt.resultType=2;Yl=T(Kt)});var Cs={};j(Cs,{UntilDirective:()=>Jr,until:()=>Gl});var Es,Jr,Gl,Ts=x(()=>{U();ye();ht();ro();N();Es=r=>!Ft(r)&&typeof r.then=="function",Jr=class extends Ae{constructor(){super(...arguments),this._$Cwt=1073741823,this._$Cyt=[],this._$CK=new vt(this),this._$CX=new gt}render(...e){var t;return(t=e.find((n=>!Es(n))))!==null&&t!==void 0?t:S}update(e,t){let n=this._$Cyt,o=n.length;this._$Cyt=t;let i=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<t.length&&!(a>this._$Cwt);a++){let l=t[a];if(!Es(l))return this._$Cwt=a,l;a<o&&l===n[a]||(this._$Cwt=1073741823,o=0,Promise.resolve(l).then((async c=>{for(;s.get();)await s.get();let u=i.deref();if(u!==void 0){let p=u._$Cyt.indexOf(l);p>-1&&p<u._$Cwt&&(u._$Cwt=p,u.setValue(c))}})))}return S}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},Gl=T(Jr)});var Os={};j(Os,{choose:()=>Jl});var Jl,ks=x(()=>{Jl=(r,e,t)=>{for(let n of e)if(n[0]===r)return(0,n[1])();return t?.()}});var Ps={};j(Ps,{join:()=>Zl});function*Zl(r,e){let t=typeof e=="function";if(r!==void 0){let n=-1;for(let o of r)n>-1&&(yield t?e(n):e),n++,yield o}}var Is=x(()=>{});var Rs={};j(Rs,{keyed:()=>Xl});var Xl,Ms=x(()=>{U();N();ye();Xl=T(class extends L{constructor(){super(...arguments),this.key=E}render(r,e){return this.key=r,e}update(r,[e,t]){return e!==this.key&&(ge(r),this.key=e),t}})});var js={};j(js,{map:()=>Ql});function*Ql(r,e){if(r!==void 0){let t=0;for(let n of r)yield e(n,t++)}}var Ls=x(()=>{});var Us={};j(Us,{range:()=>ec});function*ec(r,e,t=1){let n=e===void 0?0:r;e!=null||(e=r);for(let o=n;t>0?o<e:e<o;o+=t)yield o}var Ds=x(()=>{});var Ns={};j(Ns,{when:()=>tc});function tc(r,e,t){return r?e():t?.()}var Fs=x(()=>{});var Yt=xe(A=>{"use strict";var rc=A&&A.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,o)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),k=A&&A.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&rc(e,r,t)};Object.defineProperty(A,"__esModule",{value:!0});k(Ci(),A);k(Pi(),A);k((U(),C(zr)),A);k((N(),C(Dn)),A);k((zn(),C(Mi)),A);k((ji(),C(wl)),A);k(Li(),A);k((ye(),C(Oi)),A);k((ht(),C(Nn)),A);k((Qi(),C(Xi)),A);k((ts(),C(es)),A);k((is(),C(os)),A);k((no(),C(ns)),A);k((as(),C(ss)),A);k((cs(),C(ls)),A);k((ps(),C(us)),A);k((ds(),C(fs)),A);k((ms(),C(hs)),A);k((ys(),C(gs)),A);k((xs(),C(bs)),A);k((_s(),C(ws)),A);k((so(),C($s)),A);k((Ss(),C(As)),A);k((Ts(),C(Cs)),A);k((ks(),C(Os)),A);k((Is(),C(Ps)),A);k((Ms(),C(Rs)),A);k((Ls(),C(js)),A);k((Ds(),C(Us)),A);k((Fs(),C(Ns)),A)});var qs=xe(de=>{"use strict";var Gt=de&&de.__decorate||function(r,e,t,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(s=r[a])&&(i=(o<3?s(i):o>3?s(e,t,i):s(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},Zr=de&&de.__metadata||function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},nc=de&&de.__awaiter||function(r,e,t,n){function o(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?i(u.value):o(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})};Object.defineProperty(de,"__esModule",{value:!0});de.Renderer=void 0;var W=Yt();function oc(r){return function(e){if(!window.customElements.get(r.selector))return(0,W.Component)(r)(e)}}var Ge=class extends W.LitElement{constructor(){super(...arguments),this.options={state:{},render:(e,t,n)=>(0,W.html)` ${e} `,style:(0,W.css)``,styles:[],deepCloneState:!1,loading:()=>(0,W.html)``,error:e=>(0,W.html)`${e?.message}`},this.loading=!0,this.state={}}OnUpdateFirst(){var e,t,n;return nc(this,void 0,void 0,function*(){!((e=this.options)===null||e===void 0)&&e.style&&(0,W.adoptStyles)(this.shadowRoot,[this.options.style]),!((n=(t=this.options)===null||t===void 0?void 0:t.styles)===null||n===void 0)&&n.length&&(0,W.adoptStyles)(this.shadowRoot,this.options.styles),this.options.state=yield this.options.state,this.options.state&&(this.isObservable(this.options.state)?this.subscription=this.options.state.subscribe(o=>{this.state=o,this.loading=!1,this.dispatchEvent(new CustomEvent("onData",{detail:o}))},o=>{this.state=null,this.error=o,this.loading=!1,this.dispatchEvent(new CustomEvent("onError",{detail:o}))}):(this.loading=!1,this.state=this.options.state),yield this.updateComplete,yield new Promise(requestAnimationFrame),this.dispatchEvent(new CustomEvent("loaded")))})}isObservable(e){return this.isFunction(e.lift)&&this.isFunction(e.subscribe)}isFunction(e){return typeof e=="function"}OnDestroy(){this.subscription&&this.subscription.unsubscribe()}renderContent(){if(!this.error&&this.options.render){let e=this.options.render(this.options.deepCloneState?JSON.parse(JSON.stringify(this.state)):this.state,t=>this.state=Object.assign({},t),this.shadowRoot);return e?.strings?e:(0,W.html)``}return this.state}};de.Renderer=Ge;Gt([(0,W.property)({type:Object}),Zr("design:type",Object)],Ge.prototype,"options",void 0);Gt([(0,W.property)({type:Boolean}),Zr("design:type",Object)],Ge.prototype,"loading",void 0);Gt([(0,W.property)({type:Object}),Zr("design:type",Error)],Ge.prototype,"error",void 0);Gt([(0,W.property)(),Zr("design:type",Object)],Ge.prototype,"state",void 0);de.Renderer=Ge=Gt([oc({selector:"r-renderer",template(){return(0,W.html)`
15
+ `),g):(typeof d=="function"?ol(r,d,{extends:e.extends}):il(r,d,{extends:e.extends}),d)},ll=r=>al(r.selector,r);mt.Component=ll});var Ii=xe(Ti=>{"use strict";Object.defineProperty(Ti,"__esModule",{value:!0})});var Pi=xe(Ie=>{"use strict";var cl=Ie&&Ie.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,o)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),Oi=Ie&&Ie.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&cl(e,r,t)};Object.defineProperty(Ie,"__esModule",{value:!0});Oi(ki(),Ie);Oi(Ii(),Ie)});var Hn={};M(Hn,{Directive:()=>L,PartType:()=>T,directive:()=>k});var T,k,L,D=x(()=>{T={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},k=r=>(...e)=>({_$litDirective$:r,values:e}),L=class{constructor(e){}get _$AU(){return this._$AM._$AU}_$AT(e,t,n){this._$Ct=e,this._$AM=t,this._$Ci=n}_$AS(e,t){return this.update(e,t)}update(e,t){return this.render(...t)}}});var Ri={};M(Ri,{TemplateResultType:()=>pl,clearPart:()=>Bt,getCommittedValue:()=>gt,getDirectiveClass:()=>fl,insertPart:()=>se,isDirectiveResult:()=>dl,isPrimitive:()=>Wt,isSingleExpression:()=>Ge,isTemplateResult:()=>Oe,removePart:()=>Kt,setChildPartValue:()=>pe,setCommittedValue:()=>ve});var ul,Wt,pl,Oe,dl,fl,Ge,ji,se,pe,hl,ve,gt,Kt,Bt,be=x(()=>{U();({I:ul}=ht),Wt=r=>r===null||typeof r!="object"&&typeof r!="function",pl={HTML:1,SVG:2},Oe=(r,e)=>e===void 0?r?._$litType$!==void 0:r?._$litType$===e,dl=r=>r?._$litDirective$!==void 0,fl=r=>r?._$litDirective$,Ge=r=>r.strings===void 0,ji=()=>document.createComment(""),se=(r,e,t)=>{var n;let o=r._$AA.parentNode,i=e===void 0?r._$AB:e._$AA;if(t===void 0){let s=o.insertBefore(ji(),i),a=o.insertBefore(ji(),i);t=new ul(s,a,r,r.options)}else{let s=t._$AB.nextSibling,a=t._$AM,l=a!==r;if(l){let c;(n=t._$AQ)===null||n===void 0||n.call(t,r),t._$AM=r,t._$AP!==void 0&&(c=r._$AU)!==a._$AU&&t._$AP(c)}if(s!==i||l){let c=t._$AA;for(;c!==s;){let u=c.nextSibling;o.insertBefore(c,i),c=u}}}return t},pe=(r,e,t=r)=>(r._$AI(e,t),r),hl={},ve=(r,e=hl)=>r._$AH=e,gt=r=>r._$AH,Kt=r=>{var e;(e=r._$AP)===null||e===void 0||e.call(r,!1,!0);let t=r._$AA,n=r._$AB.nextSibling;for(;t!==n;){let o=t.nextSibling;t.remove(),t=o}},Bt=r=>{r._$AR()}});var zn={};M(zn,{AsyncDirective:()=>Se,Directive:()=>L,PartType:()=>T,directive:()=>k});function ml(r){this._$AN!==void 0?(Br(this),this._$AM=r,Mi(this)):this._$AM=r}function gl(r,e=!1,t=0){let n=this._$AH,o=this._$AN;if(o!==void 0&&o.size!==0)if(e)if(Array.isArray(n))for(let i=t;i<n.length;i++)Vt(n[i],!1),Br(n[i]);else n!=null&&(Vt(n,!1),Br(n));else Vt(this,r)}var Vt,Br,Mi,vl,Se,vt=x(()=>{be();D();D();Vt=(r,e)=>{var t,n;let o=r._$AN;if(o===void 0)return!1;for(let i of o)(n=(t=i)._$AO)===null||n===void 0||n.call(t,e,!1),Vt(i,e);return!0},Br=r=>{let e,t;do{if((e=r._$AM)===void 0)break;t=e._$AN,t.delete(r),r=e}while(t?.size===0)},Mi=r=>{for(let e;e=r._$AM;r=e){let t=e._$AN;if(t===void 0)e._$AN=t=new Set;else if(t.has(r))break;t.add(r),vl(e)}};vl=r=>{var e,t,n,o;r.type==T.CHILD&&((e=(n=r)._$AP)!==null&&e!==void 0||(n._$AP=gl),(t=(o=r)._$AQ)!==null&&t!==void 0||(o._$AQ=ml))},Se=class extends L{constructor(){super(...arguments),this._$AN=void 0}_$AT(e,t,n){super._$AT(e,t,n),Mi(this),this.isConnected=e._$AU}_$AO(e,t=!0){var n,o;e!==this.isConnected&&(this.isConnected=e,e?(n=this.reconnected)===null||n===void 0||n.call(this):(o=this.disconnected)===null||o===void 0||o.call(this)),t&&(Vt(this,e),Br(this))}setValue(e){if(Ge(this._$Ct))this._$Ct._$AI(e,this);else{let t=[...this._$Ct._$AH];t[this._$Ci]=e,this._$Ct._$AI(t,this,0)}}disconnected(){}reconnected(){}}});var Li=xe(Vr=>{"use strict";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.async=void 0;var bl=(D(),C(Hn)),yl=(vt(),C(zn)),xl=(U(),C(Kr)),Wn=class extends yl.AsyncDirective{render(e){return"then"in e?(Promise.resolve(e).then(t=>this.setValue(t)),""):(this.observable!==e&&(this.unsubscribe(),this.observable=e,this.isConnected&&this.subscribe(e)),xl.noChange)}subscribe(e){this.subscription=e.subscribe(t=>{this.setValue(t)})}disconnected(){this.unsubscribe()}unsubscribe(){this.subscription&&this.subscription.unsubscribe()}reconnected(){this.subscribe(this.observable)}};Vr.async=(0,bl.directive)(Wn)});var Di={};M(Di,{digestForTemplateResult:()=>Fi,hydrate:()=>Kn});var wl,$l,Ui,Yt,_l,Kn,Sl,Al,El,Fi,Bn=x(()=>{U();D();be();({R:wl,D:$l,V:Ui,I:Yt,F:_l}=ht),Kn=(r,e,t={})=>{if(e._$litPart$!==void 0)throw Error("container already contains a live render");let n,o,i=[],s=document.createTreeWalker(e,NodeFilter.SHOW_COMMENT,null,!1),a;for(;(a=s.nextNode())!==null;){let l=a.data;if(l.startsWith("lit-part")){if(i.length===0&&n!==void 0)throw Error("there must be only one root part per container");o=Sl(r,a,i,t),n!=null||(n=o)}else if(l.startsWith("lit-node"))El(a,i,t);else if(l.startsWith("/lit-part")){if(i.length===1&&o!==n)throw Error("internal error");o=Al(a,o,i)}}console.assert(n!==void 0,"there should be exactly one root part in a render container"),e._$litPart$=n},Sl=(r,e,t,n)=>{let o,i;if(t.length===0)i=new Yt(e,null,void 0,n),o=r;else{let s=t[t.length-1];if(s.type==="template-instance")i=new Yt(e,null,s.instance,n),s.instance.u.push(i),o=s.result.values[s.instancePartIndex++],s.templatePartIndex++;else if(s.type==="iterable"){i=new Yt(e,null,s.part,n);let a=s.iterator.next();if(a.done)throw o=void 0,s.done=!0,Error("Unhandled shorter than expected iterable");o=a.value,s.part._$AH.push(i)}else i=new Yt(e,null,s.part,n)}if(o=Ui(i,o),o===A)t.push({part:i,type:"leaf"});else if(Wt(o))t.push({part:i,type:"leaf"}),i._$AH=o;else if(Oe(o)){let s="lit-part "+Fi(o);if(e.data!==s)throw Error("Hydration value mismatch: Unexpected TemplateResult rendered to part");{let a=Yt.prototype._$AC(o),l=new wl(a,i);t.push({type:"template-instance",instance:l,part:i,templatePartIndex:0,instancePartIndex:0,result:o}),i._$AH=l}}else $l(o)?(t.push({part:i,type:"iterable",value:o,iterator:o[Symbol.iterator](),done:!1}),i._$AH=[]):(t.push({part:i,type:"leaf"}),i._$AH=o??"");return i},Al=(r,e,t)=>{if(e===void 0)throw Error("unbalanced part marker");e._$AB=r;let n=t.pop();if(n.type==="iterable"&&!n.iterator.next().done)throw Error("unexpected longer than expected iterable");if(t.length>0)return t[t.length-1].part},El=(r,e,t)=>{var n;let o=/lit-node (\d+)/.exec(r.data),i=parseInt(o[1]),s=(n=r.previousElementSibling)!==null&&n!==void 0?n:r.parentElement;if(s===null)throw Error("could not find node for attribute parts");s.removeAttribute("defer-hydration");let a=e[e.length-1];if(a.type!=="template-instance")throw Error("internal error");{let l=a.instance;for(;;){let c=l._$AD.parts[a.templatePartIndex];if(c===void 0||c.type!==T.ATTRIBUTE&&c.type!==T.ELEMENT||c.index!==i)break;if(c.type===T.ATTRIBUTE){let u=new c.ctor(s,c.name,c.strings,a.instance,t),p=Ge(u)?a.result.values[a.instancePartIndex]:a.result.values,f=!(u.type===T.EVENT||u.type===T.PROPERTY);u._$AI(p,u,a.instancePartIndex,f),a.instancePartIndex+=c.strings.length-1,l.u.push(u)}else{let u=new _l(s,a.instance,t);Ui(u,a.result.values[a.instancePartIndex++]),l.u.push(u)}a.templatePartIndex++}}},Fi=r=>{let e=new Uint32Array(2).fill(5381);for(let t of r.strings)for(let n=0;n<t.length;n++)e[n%2]=33*e[n%2]^t.charCodeAt(n);return btoa(String.fromCharCode(...new Uint8Array(e.buffer)))}});var Cl={};var Ni=x(()=>{U();Bn();globalThis.litElementHydrateSupport=({LitElement:r})=>{let e=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),"observedAttributes").get;Object.defineProperty(r,"observedAttributes",{get(){return[...e.call(this),"defer-hydration"]}});let t=r.prototype.attributeChangedCallback;r.prototype.attributeChangedCallback=function(s,a,l){s==="defer-hydration"&&l===null&&n.call(this),t.call(this,s,a,l)};let n=r.prototype.connectedCallback;r.prototype.connectedCallback=function(){this.hasAttribute("defer-hydration")||n.call(this)};let o=r.prototype.createRenderRoot;r.prototype.createRenderRoot=function(){return this.shadowRoot?(this._$AG=!0,this.shadowRoot):o.call(this)};let i=Object.getPrototypeOf(r.prototype).update;r.prototype.update=function(s){let a=this.render();i.call(this,s),this._$AG?(this._$AG=!1,Kn(a,this.renderRoot,this.renderOptions)):Te(a,this.renderRoot,this.renderOptions)}}});var qi=xe(()=>{(function(r){typeof define=="function"&&define.amd?define(r):r()})((function(){"use strict";var r,e=new Set,t=new Map;(r=globalThis.litHtmlPolyfillSupport)!==null&&r!==void 0||(globalThis.litHtmlPolyfillSupport=function(n,o){if(window.ShadyCSS!==void 0&&(!window.ShadyCSS.nativeShadow||window.ShadyCSS.ApplyShim)){var i=function(d){return d!==void 0&&!e.has(d)},s=function(d){var g=t.get(d);return g===void 0&&t.set(d,g=[]),g},a=new Map,l=n.createElement;n.createElement=function(d,g){var h=l.call(n,d,g),m=g?.scope;if(m!==void 0&&(window.ShadyCSS.nativeShadow||window.ShadyCSS.prepareTemplateDom(h,m),i(m))){var w=s(m),Z=h.content.querySelectorAll("style");w.push.apply(w,Array.from(Z).map((function(le){var ye;return(ye=le.parentNode)===null||ye===void 0||ye.removeChild(le),le.textContent})))}return h};var c=document.createDocumentFragment(),u=document.createComment(""),p=o.prototype,f=p._$AI;p._$AI=function(d,g){var h,m;g===void 0&&(g=this);var w=this._$AA.parentNode,Z=(h=this.options)===null||h===void 0?void 0:h.scope;if(w instanceof ShadowRoot&&i(Z)){var le=this._$AA,ye=this._$AB;c.appendChild(u),this._$AA=u,this._$AB=null,f.call(this,d,g);var Me=d?._$litType$?this._$AH._$AD.el:document.createElement("template");if((function(sr,ar){var lr,xo=s(sr),wo=xo.length!==0;wo&&((lr=document.createElement("style")).textContent=xo.join(`
16
+ `),ar.content.appendChild(lr)),e.add(sr),t.delete(sr),window.ShadyCSS.prepareTemplateStyles(ar,sr),wo&&window.ShadyCSS.nativeShadow&&(lr=ar.content.querySelector("style"))!==null&&ar.content.appendChild(lr)})(Z,Me),c.removeChild(u),(m=window.ShadyCSS)===null||m===void 0?void 0:m.nativeShadow){var Le=Me.content.querySelector("style");Le!==null&&c.appendChild(Le.cloneNode(!0))}w.insertBefore(c,ye),this._$AA=le,this._$AB=ye}else f.call(this,d,g)},p._$AC=function(d){var g,h=(g=this.options)===null||g===void 0?void 0:g.scope,m=a.get(h);m===void 0&&a.set(h,m=new Map);var w=m.get(d.strings);return w===void 0&&m.set(d.strings,w=new n(d,this.options)),w}}})}))});var Yr,Gt,Vn,Hi,bt,Yn,zi,Gr,Jt,Gn=x(()=>{Yr=window,Gt=Yr.ShadowRoot&&(Yr.ShadyCSS===void 0||Yr.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Vn=Symbol(),Hi=new WeakMap,bt=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==Vn)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Gt&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Hi.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Hi.set(t,e))}return e}toString(){return this.cssText}},Yn=r=>new bt(typeof r=="string"?r:r+"",void 0,Vn),zi=(r,...e)=>{let t=r.length===1?r[0]:e.reduce(((n,o,i)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+r[i+1]),r[0]);return new bt(t,r,Vn)},Gr=(r,e)=>{Gt?r.adoptedStyleSheets=e.map((t=>t instanceof CSSStyleSheet?t:t.styleSheet)):e.forEach((t=>{let n=document.createElement("style"),o=Yr.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=t.cssText,r.appendChild(n)}))},Jt=Gt?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Yn(t)})(r):r});var Jn,Jr,Wi,kl,Ki,Zr,Xn,Zn,de,Xr=x(()=>{Gn();Gn();Jr=window,Wi=Jr.trustedTypes,kl=Wi?Wi.emptyScript:"",Ki=Jr.reactiveElementPolyfillSupport,Zr={toAttribute(r,e){switch(e){case Boolean:r=r?kl:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Xn=(r,e)=>e!==r&&(e==e||r==r),Zn={attribute:!0,type:String,converter:Zr,reflect:!1,hasChanged:Xn},de=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this.u()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach(((t,n)=>{let o=this._$Ep(n,t);o!==void 0&&(this._$Ev.set(o,n),e.push(o))})),e}static createProperty(e,t=Zn){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,o=this.getPropertyDescriptor(e,n,t);o!==void 0&&Object.defineProperty(this.prototype,e,o)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(o){let i=this[e];this[t]=o,this.requestUpdate(e,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Zn}static finalize(){if(this.hasOwnProperty("finalized"))return!1;this.finalized=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,n=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let o of n)this.createProperty(o,t[o])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let o of n)t.unshift(Jt(o))}else e!==void 0&&t.push(Jt(e));return t}static _$Ep(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}u(){var e;this._$E_=new Promise((t=>this.enableUpdating=t)),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach((t=>t(this)))}addController(e){var t,n;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach(((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])}))}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return Gr(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach((t=>{var n;return(n=t.hostConnected)===null||n===void 0?void 0:n.call(t)}))}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach((t=>{var n;return(n=t.hostDisconnected)===null||n===void 0?void 0:n.call(t)}))}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=Zn){var o;let i=this.constructor._$Ep(e,n);if(i!==void 0&&n.reflect===!0){let s=(((o=n.converter)===null||o===void 0?void 0:o.toAttribute)!==void 0?n.converter:Zr).toAttribute(t,n.type);this._$El=e,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$El=null}}_$AK(e,t){var n;let o=this.constructor,i=o._$Ev.get(e);if(i!==void 0&&this._$El!==i){let s=o.getPropertyOptions(i),a=typeof s.converter=="function"?{fromAttribute:s.converter}:((n=s.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?s.converter:Zr;this._$El=i,this[i]=a.fromAttribute(t,s.type),this._$El=null}}requestUpdate(e,t,n){let o=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Xn)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach(((o,i)=>this[i]=o)),this._$Ei=void 0);let t=!1,n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach((o=>{var i;return(i=o.hostUpdate)===null||i===void 0?void 0:i.call(o)})),this.update(n)):this._$Ek()}catch(o){throw t=!1,this._$Ek(),o}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach((n=>{var o;return(o=n.hostUpdated)===null||o===void 0?void 0:o.call(n)})),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach(((t,n)=>this._$EO(n,this[n],t))),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};de.finalized=!0,de.elementProperties=new Map,de.elementStyles=[],de.shadowRootOptions={mode:"open"},Ki?.({ReactiveElement:de}),((Jn=Jr.reactiveElementVersions)!==null&&Jn!==void 0?Jn:Jr.reactiveElementVersions=[]).push("1.5.0")});var Qn,eo,Vi,Pe,Bi,Yi,Gi=x(()=>{Xr();Xr();U();U();Vi=de,Pe=class extends de{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let n=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=n.firstChild),n}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Te(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return A}};Pe.finalized=!0,Pe._$litElement$=!0,(Qn=globalThis.litElementHydrateSupport)===null||Qn===void 0||Qn.call(globalThis,{LitElement:Pe});Bi=globalThis.litElementPolyfillSupport;Bi?.({LitElement:Pe});Yi={_$AK:(r,e,t)=>{r._$AK(e,t)},_$AL:r=>r._$AL};((eo=globalThis.litElementVersions)!==null&&eo!==void 0?eo:globalThis.litElementVersions=[]).push("3.2.2")});var Tl,Il,ne,je=x(()=>{Tl=(r,e,t)=>{Object.defineProperty(e,t,r)},Il=(r,e)=>({kind:"method",placement:"prototype",key:e.key,descriptor:r}),ne=({finisher:r,descriptor:e})=>(t,n)=>{var o;if(n===void 0){let i=(o=t.originalKey)!==null&&o!==void 0?o:t.key,s=e!=null?{kind:"method",placement:"prototype",key:i,descriptor:e(t.key)}:{...t,key:i};return r!=null&&(s.finisher=function(a){r(a,i)}),s}{let i=t.constructor;e!==void 0&&Object.defineProperty(t,n,e(n)),r?.(i,n)}}});var Ol,Ji=x(()=>{Ol=r=>e=>typeof e=="function"?((t,n)=>(customElements.define(t,n),n))(r,e):((t,n)=>{let{kind:o,elements:i}=n;return{kind:o,elements:i,finisher(s){customElements.define(t,s)}}})(r,e)});function to(r){return(e,t)=>t!==void 0?((n,o,i)=>{o.constructor.createProperty(i,n)})(r,e,t):Pl(r,e)}var Pl,ro=x(()=>{Pl=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}}});function jl(r){return to({...r,state:!0})}var Zi=x(()=>{ro();});function Rl(r){return ne({finisher:(e,t)=>{Object.assign(e.prototype[t],r)}})}var Xi=x(()=>{je();});function Ml(r,e){return ne({descriptor:t=>{let n={get(){var o,i;return(i=(o=this.renderRoot)===null||o===void 0?void 0:o.querySelector(r))!==null&&i!==void 0?i:null},enumerable:!0,configurable:!0};if(e){let o=typeof t=="symbol"?Symbol():"__"+t;n.get=function(){var i,s;return this[o]===void 0&&(this[o]=(s=(i=this.renderRoot)===null||i===void 0?void 0:i.querySelector(r))!==null&&s!==void 0?s:null),this[o]}}return n}})}var Qi=x(()=>{je();});function Ll(r){return ne({descriptor:e=>({get(){var t,n;return(n=(t=this.renderRoot)===null||t===void 0?void 0:t.querySelectorAll(r))!==null&&n!==void 0?n:[]},enumerable:!0,configurable:!0})})}var es=x(()=>{je();});function Ul(r){return ne({descriptor:e=>({async get(){var t;return await this.updateComplete,(t=this.renderRoot)===null||t===void 0?void 0:t.querySelector(r)},enumerable:!0,configurable:!0})})}var ts=x(()=>{je();});function oo(r){let{slot:e,selector:t}=r??{};return ne({descriptor:n=>({get(){var o;let i="slot"+(e?`[name=${e}]`:":not([name])"),s=(o=this.renderRoot)===null||o===void 0?void 0:o.querySelector(i),a=s!=null?Fl(s,r):[];return t?a.filter((l=>l.matches(t))):a},enumerable:!0,configurable:!0})})}var no,Fl,io=x(()=>{je();Fl=((no=window.HTMLSlotElement)===null||no===void 0?void 0:no.prototype.assignedElements)!=null?(r,e)=>r.assignedElements(e):(r,e)=>r.assignedNodes(e).filter((t=>t.nodeType===Node.ELEMENT_NODE))});function Dl(r,e,t){let n,o=r;return typeof r=="object"?(o=r.slot,n=r):n={flatten:e},t?oo({slot:o,flatten:e,selector:t}):ne({descriptor:i=>({get(){var s,a;let l="slot"+(o?`[name=${o}]`:":not([name])"),c=(s=this.renderRoot)===null||s===void 0?void 0:s.querySelector(l);return(a=c?.assignedNodes(n))!==null&&a!==void 0?a:[]},enumerable:!0,configurable:!0})})}var rs=x(()=>{je();io();});var ns={};M(ns,{CSSResult:()=>bt,LitElement:()=>Pe,ReactiveElement:()=>de,UpdatingElement:()=>Vi,_$LE:()=>Yi,_$LH:()=>ht,adoptStyles:()=>Gr,css:()=>zi,customElement:()=>Ol,decorateProperty:()=>ne,defaultConverter:()=>Zr,eventOptions:()=>Rl,getCompatibleStyle:()=>Jt,html:()=>Si,legacyPrototypeMethod:()=>Tl,noChange:()=>A,notEqual:()=>Xn,nothing:()=>E,property:()=>to,query:()=>Ml,queryAll:()=>Ll,queryAssignedElements:()=>oo,queryAssignedNodes:()=>Dl,queryAsync:()=>Ul,render:()=>Te,standardPrototypeMethod:()=>Il,state:()=>jl,supportsAdoptingStyleSheets:()=>Gt,svg:()=>Ai,unsafeCSS:()=>Yn});var os=x(()=>{Xr();U();Gi();je();Ji();ro();Zi();Xi();Qi();es();ts();io();rs();console.warn("The main 'lit-element' module entrypoint is deprecated. Please update your imports to use the 'lit' package: 'lit' and 'lit/decorators.ts' or import from 'lit-element/lit-element.ts'. See https://lit.dev/msg/deprecated-import-path for more information.")});var is={};M(is,{classMap:()=>Nl});var Nl,ss=x(()=>{U();D();Nl=k(class extends L{constructor(r){var e;if(super(r),r.type!==T.ATTRIBUTE||r.name!=="class"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return" "+Object.keys(r).filter((e=>r[e])).join(" ")+" "}update(r,[e]){var t,n;if(this.nt===void 0){this.nt=new Set,r.strings!==void 0&&(this.st=new Set(r.strings.join(" ").split(/\s/).filter((i=>i!==""))));for(let i in e)e[i]&&!(!((t=this.st)===null||t===void 0)&&t.has(i))&&this.nt.add(i);return this.render(e)}let o=r.element.classList;this.nt.forEach((i=>{i in e||(o.remove(i),this.nt.delete(i))}));for(let i in e){let s=!!e[i];s===this.nt.has(i)||!((n=this.st)===null||n===void 0)&&n.has(i)||(s?(o.add(i),this.nt.add(i)):(o.remove(i),this.nt.delete(i)))}return A}})});var as,yt,xt,so=x(()=>{as=async(r,e)=>{for await(let t of r)if(await e(t)===!1)return},yt=class{constructor(e){this.Y=e}disconnect(){this.Y=void 0}reconnect(e){this.Y=e}deref(){return this.Y}},xt=class{constructor(){this.Z=void 0,this.q=void 0}get(){return this.Z}pause(){var e;(e=this.Z)!==null&&e!==void 0||(this.Z=new Promise((t=>this.q=t)))}resume(){var e;(e=this.q)===null||e===void 0||e.call(this),this.Z=this.q=void 0}}});var ls={};M(ls,{AsyncReplaceDirective:()=>wt,asyncReplace:()=>ql});var wt,ql,ao=x(()=>{U();vt();so();D();wt=class extends Se{constructor(){super(...arguments),this._$CK=new yt(this),this._$CX=new xt}render(e,t){return A}update(e,[t,n]){if(this.isConnected||this.disconnected(),t===this._$CJ)return;this._$CJ=t;let o=0,{_$CK:i,_$CX:s}=this;return as(t,(async a=>{for(;s.get();)await s.get();let l=i.deref();if(l!==void 0){if(l._$CJ!==t)return!1;n!==void 0&&(a=n(a,o)),l.commitValue(a,o),o++}return!0})),A}commitValue(e,t){this.setValue(e)}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},ql=k(wt)});var cs={};M(cs,{asyncAppend:()=>Hl});var Hl,us=x(()=>{D();ao();be();Hl=k(class extends wt{constructor(r){if(super(r),r.type!==T.CHILD)throw Error("asyncAppend can only be used in child expressions")}update(r,e){return this._$Ctt=r,super.update(r,e)}commitValue(r,e){e===0&&Bt(this._$Ctt);let t=se(this._$Ctt);pe(t,r)}})});var ps={};M(ps,{cache:()=>zl});var zl,ds=x(()=>{U();D();be();zl=k(class extends L{constructor(r){super(r),this.et=new WeakMap}render(r){return[r]}update(r,[e]){if(Oe(this.it)&&(!Oe(e)||this.it.strings!==e.strings)){let t=gt(r).pop(),n=this.et.get(this.it.strings);if(n===void 0){let o=document.createDocumentFragment();n=Te(E,o),n.setConnected(!1),this.et.set(this.it.strings,n)}ve(n,[t]),se(n,void 0,t)}if(Oe(e)){if(!Oe(this.it)||this.it.strings!==e.strings){let t=this.et.get(e.strings);if(t!==void 0){let n=gt(t).pop();Bt(r),se(r,void 0,n),ve(r,[n])}}this.it=e}else this.it=void 0;return this.render(e)}})});var fs={};M(fs,{guard:()=>Kl});var Wl,Kl,hs=x(()=>{U();D();Wl={},Kl=k(class extends L{constructor(){super(...arguments),this.ot=Wl}render(r,e){return e()}update(r,[e,t]){if(Array.isArray(e)){if(Array.isArray(this.ot)&&this.ot.length===e.length&&e.every(((n,o)=>n===this.ot[o])))return A}else if(this.ot===e)return A;return this.ot=Array.isArray(e)?Array.from(e):e,this.render(e,t)}})});var ms={};M(ms,{ifDefined:()=>Bl});var Bl,gs=x(()=>{U();Bl=r=>r??E});var vs={};M(vs,{live:()=>Vl});var Vl,bs=x(()=>{U();D();be();Vl=k(class extends L{constructor(r){if(super(r),r.type!==T.PROPERTY&&r.type!==T.ATTRIBUTE&&r.type!==T.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!Ge(r))throw Error("`live` bindings can only contain a single expression")}render(r){return r}update(r,[e]){if(e===A||e===E)return e;let t=r.element,n=r.name;if(r.type===T.PROPERTY){if(e===t[n])return A}else if(r.type===T.BOOLEAN_ATTRIBUTE){if(!!e===t.hasAttribute(n))return A}else if(r.type===T.ATTRIBUTE&&t.getAttribute(n)===e+"")return A;return ve(r),e}})});var ys={};M(ys,{createRef:()=>Yl,ref:()=>Gl});var Yl,co,lo,Gl,xs=x(()=>{U();vt();D();Yl=()=>new co,co=class{},lo=new WeakMap,Gl=k(class extends Se{render(r){return E}update(r,[e]){var t;let n=e!==this.Y;return n&&this.Y!==void 0&&this.rt(void 0),(n||this.lt!==this.ct)&&(this.Y=e,this.dt=(t=r.options)===null||t===void 0?void 0:t.host,this.rt(this.ct=r.element)),E}rt(r){var e;if(typeof this.Y=="function"){let t=(e=this.dt)!==null&&e!==void 0?e:globalThis,n=lo.get(t);n===void 0&&(n=new WeakMap,lo.set(t,n)),n.get(this.Y)!==void 0&&this.Y.call(this.dt,void 0),n.set(this.Y,r),r!==void 0&&this.Y.call(this.dt,r)}else this.Y.value=r}get lt(){var r,e,t;return typeof this.Y=="function"?(e=lo.get((r=this.dt)!==null&&r!==void 0?r:globalThis))===null||e===void 0?void 0:e.get(this.Y):(t=this.Y)===null||t===void 0?void 0:t.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}})});var $s={};M($s,{repeat:()=>Jl});var ws,Jl,_s=x(()=>{U();D();be();ws=(r,e,t)=>{let n=new Map;for(let o=e;o<=t;o++)n.set(r[o],o);return n},Jl=k(class extends L{constructor(r){if(super(r),r.type!==T.CHILD)throw Error("repeat() can only be used in text expressions")}ht(r,e,t){let n;t===void 0?t=e:e!==void 0&&(n=e);let o=[],i=[],s=0;for(let a of r)o[s]=n?n(a,s):s,i[s]=t(a,s),s++;return{values:i,keys:o}}render(r,e,t){return this.ht(r,e,t).values}update(r,[e,t,n]){var o;let i=gt(r),{values:s,keys:a}=this.ht(e,t,n);if(!Array.isArray(i))return this.ut=a,s;let l=(o=this.ut)!==null&&o!==void 0?o:this.ut=[],c=[],u,p,f=0,d=i.length-1,g=0,h=s.length-1;for(;f<=d&&g<=h;)if(i[f]===null)f++;else if(i[d]===null)d--;else if(l[f]===a[g])c[g]=pe(i[f],s[g]),f++,g++;else if(l[d]===a[h])c[h]=pe(i[d],s[h]),d--,h--;else if(l[f]===a[h])c[h]=pe(i[f],s[h]),se(r,c[h+1],i[f]),f++,h--;else if(l[d]===a[g])c[g]=pe(i[d],s[g]),se(r,i[f],i[d]),d--,g++;else if(u===void 0&&(u=ws(a,g,h),p=ws(l,f,d)),u.has(l[f]))if(u.has(l[d])){let m=p.get(a[g]),w=m!==void 0?i[m]:null;if(w===null){let Z=se(r,i[f]);pe(Z,s[g]),c[g]=Z}else c[g]=pe(w,s[g]),se(r,i[f],w),i[m]=null;g++}else Kt(i[d]),d--;else Kt(i[f]),f++;for(;g<=h;){let m=se(r,c[h+1]);pe(m,s[g]),c[g++]=m}for(;f<=d;){let m=i[f++];m!==null&&Kt(m)}return this.ut=a,ve(r,c),A}})});var Ss={};M(Ss,{styleMap:()=>Zl});var Zl,As=x(()=>{U();D();Zl=k(class extends L{constructor(r){var e;if(super(r),r.type!==T.ATTRIBUTE||r.name!=="style"||((e=r.strings)===null||e===void 0?void 0:e.length)>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce(((e,t)=>{let n=r[t];return n==null?e:e+`${t=t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${n};`}),"")}update(r,[e]){let{style:t}=r.element;if(this.vt===void 0){this.vt=new Set;for(let n in e)this.vt.add(n);return this.render(e)}this.vt.forEach((n=>{e[n]==null&&(this.vt.delete(n),n.includes("-")?t.removeProperty(n):t[n]="")}));for(let n in e){let o=e[n];o!=null&&(this.vt.add(n),n.includes("-")?t.setProperty(n,o):t[n]=o)}return A}})});var Es={};M(Es,{templateContent:()=>Xl});var Xl,Cs=x(()=>{U();D();Xl=k(class extends L{constructor(r){if(super(r),r.type!==T.CHILD)throw Error("templateContent can only be used in child bindings")}render(r){return this.ft===r?A:(this.ft=r,document.importNode(r.content,!0))}})});var ks={};M(ks,{UnsafeHTMLDirective:()=>Re,unsafeHTML:()=>Ql});var Re,Ql,uo=x(()=>{U();D();Re=class extends L{constructor(e){if(super(e),this.it=E,e.type!==T.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===E||e==null)return this._t=void 0,this.it=e;if(e===A)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};Re.directiveName="unsafeHTML",Re.resultType=1;Ql=k(Re)});var Ts={};M(Ts,{unsafeSVG:()=>ec});var Zt,ec,Is=x(()=>{D();uo();Zt=class extends Re{};Zt.directiveName="unsafeSVG",Zt.resultType=2;ec=k(Zt)});var Ps={};M(Ps,{UntilDirective:()=>Qr,until:()=>tc});var Os,Qr,tc,js=x(()=>{U();be();vt();so();D();Os=r=>!Wt(r)&&typeof r.then=="function",Qr=class extends Se{constructor(){super(...arguments),this._$Cwt=1073741823,this._$Cyt=[],this._$CK=new yt(this),this._$CX=new xt}render(...e){var t;return(t=e.find((n=>!Os(n))))!==null&&t!==void 0?t:A}update(e,t){let n=this._$Cyt,o=n.length;this._$Cyt=t;let i=this._$CK,s=this._$CX;this.isConnected||this.disconnected();for(let a=0;a<t.length&&!(a>this._$Cwt);a++){let l=t[a];if(!Os(l))return this._$Cwt=a,l;a<o&&l===n[a]||(this._$Cwt=1073741823,o=0,Promise.resolve(l).then((async c=>{for(;s.get();)await s.get();let u=i.deref();if(u!==void 0){let p=u._$Cyt.indexOf(l);p>-1&&p<u._$Cwt&&(u._$Cwt=p,u.setValue(c))}})))}return A}disconnected(){this._$CK.disconnect(),this._$CX.pause()}reconnected(){this._$CK.reconnect(this),this._$CX.resume()}},tc=k(Qr)});var Rs={};M(Rs,{choose:()=>rc});var rc,Ms=x(()=>{rc=(r,e,t)=>{for(let n of e)if(n[0]===r)return(0,n[1])();return t?.()}});var Ls={};M(Ls,{join:()=>nc});function*nc(r,e){let t=typeof e=="function";if(r!==void 0){let n=-1;for(let o of r)n>-1&&(yield t?e(n):e),n++,yield o}}var Us=x(()=>{});var Fs={};M(Fs,{keyed:()=>oc});var oc,Ds=x(()=>{U();D();be();oc=k(class extends L{constructor(){super(...arguments),this.key=E}render(r,e){return this.key=r,e}update(r,[e,t]){return e!==this.key&&(ve(r),this.key=e),t}})});var Ns={};M(Ns,{map:()=>ic});function*ic(r,e){if(r!==void 0){let t=0;for(let n of r)yield e(n,t++)}}var qs=x(()=>{});var Hs={};M(Hs,{range:()=>sc});function*sc(r,e,t=1){let n=e===void 0?0:r;e!=null||(e=r);for(let o=n;t>0?o<e:e<o;o+=t)yield o}var zs=x(()=>{});var Ws={};M(Ws,{when:()=>ac});function ac(r,e,t){return r?e():t?.()}var Ks=x(()=>{});var Xt=xe(S=>{"use strict";var lc=S&&S.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,o)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),I=S&&S.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&lc(e,r,t)};Object.defineProperty(S,"__esModule",{value:!0});I(Pi(),S);I(Li(),S);I((U(),C(Kr)),S);I((D(),C(Hn)),S);I((Bn(),C(Di)),S);I((Ni(),C(Cl)),S);I(qi(),S);I((be(),C(Ri)),S);I((vt(),C(zn)),S);I((os(),C(ns)),S);I((ss(),C(is)),S);I((us(),C(cs)),S);I((ao(),C(ls)),S);I((ds(),C(ps)),S);I((hs(),C(fs)),S);I((gs(),C(ms)),S);I((bs(),C(vs)),S);I((xs(),C(ys)),S);I((_s(),C($s)),S);I((As(),C(Ss)),S);I((Cs(),C(Es)),S);I((uo(),C(ks)),S);I((Is(),C(Ts)),S);I((js(),C(Ps)),S);I((Ms(),C(Rs)),S);I((Us(),C(Ls)),S);I((Ds(),C(Fs)),S);I((qs(),C(Ns)),S);I((zs(),C(Hs)),S);I((Ks(),C(Ws)),S)});var Bs=xe(fe=>{"use strict";var Qt=fe&&fe.__decorate||function(r,e,t,n){var o=arguments.length,i=o<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(r,e,t,n);else for(var a=r.length-1;a>=0;a--)(s=r[a])&&(i=(o<3?s(i):o>3?s(e,t,i):s(e,t))||i);return o>3&&i&&Object.defineProperty(e,t,i),i},en=fe&&fe.__metadata||function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},cc=fe&&fe.__awaiter||function(r,e,t,n){function o(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?i(u.value):o(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})};Object.defineProperty(fe,"__esModule",{value:!0});fe.Renderer=void 0;var K=Xt();function uc(r){return function(e){if(!window.customElements.get(r.selector))return(0,K.Component)(r)(e)}}var Je=class extends K.LitElement{constructor(){super(...arguments),this.options={state:{},render:(e,t,n)=>(0,K.html)` ${e} `,style:(0,K.css)``,styles:[],deepCloneState:!1,loading:()=>(0,K.html)``,error:e=>(0,K.html)`${e?.message}`},this.loading=!0,this.state={}}OnUpdateFirst(){var e,t,n;return cc(this,void 0,void 0,function*(){!((e=this.options)===null||e===void 0)&&e.style&&(0,K.adoptStyles)(this.shadowRoot,[this.options.style]),!((n=(t=this.options)===null||t===void 0?void 0:t.styles)===null||n===void 0)&&n.length&&(0,K.adoptStyles)(this.shadowRoot,this.options.styles),this.options.state=yield this.options.state,this.options.state&&(this.isObservable(this.options.state)?this.subscription=this.options.state.subscribe(o=>{this.state=o,this.loading=!1,this.dispatchEvent(new CustomEvent("onData",{detail:o}))},o=>{this.state=null,this.error=o,this.loading=!1,this.dispatchEvent(new CustomEvent("onError",{detail:o}))}):(this.loading=!1,this.state=this.options.state),yield this.updateComplete,yield new Promise(requestAnimationFrame),this.dispatchEvent(new CustomEvent("loaded")))})}isObservable(e){return this.isFunction(e.lift)&&this.isFunction(e.subscribe)}isFunction(e){return typeof e=="function"}OnDestroy(){this.subscription&&this.subscription.unsubscribe()}renderContent(){if(!this.error&&this.options.render){let e=this.options.render(this.options.deepCloneState?JSON.parse(JSON.stringify(this.state)):this.state,t=>this.state=Object.assign({},t),this.shadowRoot);return e?.strings?e:(0,K.html)``}return this.state}};fe.Renderer=Je;Qt([(0,K.property)({type:Object}),en("design:type",Object)],Je.prototype,"options",void 0);Qt([(0,K.property)({type:Boolean}),en("design:type",Object)],Je.prototype,"loading",void 0);Qt([(0,K.property)({type:Object}),en("design:type",Error)],Je.prototype,"error",void 0);Qt([(0,K.property)(),en("design:type",Object)],Je.prototype,"state",void 0);fe.Renderer=Je=Qt([uc({selector:"r-renderer",template(){return(0,K.html)`
17
17
  ${this.loading?"":this.renderContent()}
18
- ${this.loading?(0,W.html)`
19
- ${this.isFunction(this.options.loading)?this.options.loading():(0,W.html)``}
18
+ ${this.loading?(0,K.html)`
19
+ ${this.isFunction(this.options.loading)?this.options.loading():(0,K.html)``}
20
20
  `:""}
21
- ${this.error?(0,W.html)`
22
- ${this.isFunction(this.options.error)?this.options.error(this.error):(0,W.html)` ${this.error} `}
21
+ ${this.error?(0,K.html)`
22
+ ${this.isFunction(this.options.error)?this.options.error(this.error):(0,K.html)` ${this.error} `}
23
23
  `:""}
24
- `}})],Ge)});var zs=xe(Je=>{"use strict";var ic=Je&&Je.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,o)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),sc=Je&&Je.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&ic(e,r,t)};Object.defineProperty(Je,"__esModule",{value:!0});sc(qs(),Je)});var Ws=xe(he=>{"use strict";var ac=he&&he.__awaiter||function(r,e,t,n){function o(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?i(u.value):o(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})};Object.defineProperty(he,"__esModule",{value:!0});he.Component=he.Partial=he.DefineDependencies=void 0;zs();var Hs=Yt(),lc=(...r)=>e=>{for(let[t,n]of r.entries())Object.defineProperty(r,t,{get:()=>e?.has(n)?e.get(n):n});return r};he.DefineDependencies=lc;function cc(){var r;return ac(this,void 0,void 0,function*(){yield this.updateComplete,yield new Promise(requestAnimationFrame),(r=this.OnRendererLoaded)===null||r===void 0||r.call(this)})}var uc=r=>(e=[])=>(t=()=>({}))=>(n=()=>null)=>(o=()=>null)=>(i=()=>t)=>(0,Hs.Component)(Object.assign(Object.assign({},r),{template(){return(0,Hs.html)`
24
+ `}})],Je)});var Vs=xe(Ze=>{"use strict";var pc=Ze&&Ze.__createBinding||(Object.create?(function(r,e,t,n){n===void 0&&(n=t);var o=Object.getOwnPropertyDescriptor(e,t);(!o||("get"in o?!e.__esModule:o.writable||o.configurable))&&(o={enumerable:!0,get:function(){return e[t]}}),Object.defineProperty(r,n,o)}):(function(r,e,t,n){n===void 0&&(n=t),r[n]=e[t]})),dc=Ze&&Ze.__exportStar||function(r,e){for(var t in r)t!=="default"&&!Object.prototype.hasOwnProperty.call(e,t)&&pc(e,r,t)};Object.defineProperty(Ze,"__esModule",{value:!0});dc(Bs(),Ze)});var Gs=xe(he=>{"use strict";var fc=he&&he.__awaiter||function(r,e,t,n){function o(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?i(u.value):o(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})};Object.defineProperty(he,"__esModule",{value:!0});he.Component=he.Partial=he.DefineDependencies=void 0;Vs();var Ys=Xt(),hc=(...r)=>e=>{for(let[t,n]of r.entries())Object.defineProperty(r,t,{get:()=>e?.has(n)?e.get(n):n});return r};he.DefineDependencies=hc;function mc(){var r;return fc(this,void 0,void 0,function*(){yield this.updateComplete,yield new Promise(requestAnimationFrame),(r=this.OnRendererLoaded)===null||r===void 0||r.call(this)})}var gc=r=>(e=[])=>(t=()=>({}))=>(n=()=>null)=>(o=()=>null)=>(i=()=>t)=>(0,Ys.Component)(Object.assign(Object.assign({},r),{template(){return(0,Ys.html)`
25
25
  <r-renderer
26
26
  style="display: contents;"
27
- @loaded=${cc.bind(this)}
27
+ @loaded=${mc.bind(this)}
28
28
  .options=${{state:t.bind(this).call(this,e),loading:n.bind(this),style:r.style,styles:r.styles,error:o.bind(this),deepCloneState:r.deepCloneState,render:(s,a,l)=>(this.shadowRoot.append(l),i(e).bind(this).call(this,s,a,l))}}
29
29
  ></r-renderer>
30
- `}}));he.Partial=uc;function pc({Settings:r,Providers:e,State:t,Render:n,Loading:o,Error:i}){return(0,he.Partial)(r)(e)(t)(o)(i)(n)}he.Component=pc});var vn=function(r,e){return vn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},vn(r,e)};function V(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");vn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function xo(r,e,t,n){function o(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?i(u.value):o(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})}function sr(r,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(u){return l([c,u])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(t=0)),t;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,o=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1],i=c;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(c);break}i[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(u){c=[6,u],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function we(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function q(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return i}function z(r,e,t){if(t||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return r.concat(i||Array.prototype.slice.call(e))}function Ue(r){return this instanceof Ue?(this.v=r,this):new Ue(r)}function wo(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(f){return function(v){return Promise.resolve(v).then(f,p)}}function a(f,v){n[f]&&(o[f]=function(h){return new Promise(function(m,w){i.push([f,h,m,w])>1||l(f,h)})},v&&(o[f]=v(o[f])))}function l(f,v){try{c(n[f](v))}catch(h){d(i[0][3],h)}}function c(f){f.value instanceof Ue?Promise.resolve(f.value.v).then(u,p):d(i[0][2],f)}function u(f){l("next",f)}function p(f){l("throw",f)}function d(f,v){f(v),i.shift(),i.length&&l(i[0][0],i[0][1])}}function _o(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof we=="function"?we(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=r[i]&&function(s){return new Promise(function(a,l){s=r[i](s),o(a,l,s.done,s.value)})}}function o(i,s,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},s)}}function y(r){return typeof r=="function"}function ar(r){var e=function(n){Error.call(n),n.stack=new Error().stack},t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var lr=ar(function(r){return function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
30
+ `}}));he.Partial=gc;function vc({Settings:r,Providers:e,State:t,Render:n,Loading:o,Error:i}){return(0,he.Partial)(r)(e)(t)(o)(i)(n)}he.Component=vc});var xn=function(r,e){return xn=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(t[o]=n[o])},xn(r,e)};function Y(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");xn(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}function So(r,e,t,n){function o(i){return i instanceof t?i:new t(function(s){s(i)})}return new(t||(t=Promise))(function(i,s){function a(u){try{c(n.next(u))}catch(p){s(p)}}function l(u){try{c(n.throw(u))}catch(p){s(p)}}function c(u){u.done?i(u.value):o(u.value).then(a,l)}c((n=n.apply(r,e||[])).next())})}function cr(r,e){var t={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},n,o,i,s=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(c){return function(u){return l([c,u])}}function l(c){if(n)throw new TypeError("Generator is already executing.");for(;s&&(s=0,c[0]&&(t=0)),t;)try{if(n=1,o&&(i=c[0]&2?o.return:c[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,c[1])).done)return i;switch(o=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return t.label++,{value:c[1],done:!1};case 5:t.label++,o=c[1],c=[0];continue;case 7:c=t.ops.pop(),t.trys.pop();continue;default:if(i=t.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){t=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){t.label=c[1];break}if(c[0]===6&&t.label<i[1]){t.label=i[1],i=c;break}if(i&&t.label<i[2]){t.label=i[2],t.ops.push(c);break}i[2]&&t.ops.pop(),t.trys.pop();continue}c=e.call(r,t)}catch(u){c=[6,u],o=0}finally{n=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function we(r){var e=typeof Symbol=="function"&&Symbol.iterator,t=e&&r[e],n=0;if(t)return t.call(r);if(r&&typeof r.length=="number")return{next:function(){return r&&n>=r.length&&(r=void 0),{value:r&&r[n++],done:!r}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function H(r,e){var t=typeof Symbol=="function"&&r[Symbol.iterator];if(!t)return r;var n=t.call(r),o,i=[],s;try{for(;(e===void 0||e-- >0)&&!(o=n.next()).done;)i.push(o.value)}catch(a){s={error:a}}finally{try{o&&!o.done&&(t=n.return)&&t.call(n)}finally{if(s)throw s.error}}return i}function z(r,e,t){if(t||arguments.length===2)for(var n=0,o=e.length,i;n<o;n++)(i||!(n in e))&&(i||(i=Array.prototype.slice.call(e,0,n)),i[n]=e[n]);return r.concat(i||Array.prototype.slice.call(e))}function Ue(r){return this instanceof Ue?(this.v=r,this):new Ue(r)}function Ao(r,e,t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var n=t.apply(r,e||[]),o,i=[];return o=Object.create((typeof AsyncIterator=="function"?AsyncIterator:Object).prototype),a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(d){return function(g){return Promise.resolve(g).then(d,p)}}function a(d,g){n[d]&&(o[d]=function(h){return new Promise(function(m,w){i.push([d,h,m,w])>1||l(d,h)})},g&&(o[d]=g(o[d])))}function l(d,g){try{c(n[d](g))}catch(h){f(i[0][3],h)}}function c(d){d.value instanceof Ue?Promise.resolve(d.value.v).then(u,p):f(i[0][2],d)}function u(d){l("next",d)}function p(d){l("throw",d)}function f(d,g){d(g),i.shift(),i.length&&l(i[0][0],i[0][1])}}function Eo(r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=r[Symbol.asyncIterator],t;return e?e.call(r):(r=typeof we=="function"?we(r):r[Symbol.iterator](),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(i){t[i]=r[i]&&function(s){return new Promise(function(a,l){s=r[i](s),o(a,l,s.done,s.value)})}}function o(i,s,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},s)}}function b(r){return typeof r=="function"}function ur(r){var e=function(n){Error.call(n),n.stack=new Error().stack},t=r(e);return t.prototype=Object.create(Error.prototype),t.prototype.constructor=t,t}var pr=ur(function(r){return function(t){r(this),this.message=t?t.length+` errors occurred during unsubscription:
31
31
  `+t.map(function(n,o){return o+1+") "+n.toString()}).join(`
32
- `):"",this.name="UnsubscriptionError",this.errors=t}});function De(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var X=(function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var e,t,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=we(s),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this)}}catch(h){e={error:h}}finally{try{l&&!l.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else s.remove(this);var u=this.initialTeardown;if(y(u))try{u()}catch(h){i=h instanceof lr?h.errors:[h]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var d=we(p),f=d.next();!f.done;f=d.next()){var v=f.value;try{$o(v)}catch(h){i=i??[],h instanceof lr?i=z(z([],q(i)),q(h.errors)):i.push(h)}}}catch(h){n={error:h}}finally{try{f&&!f.done&&(o=d.return)&&o.call(d)}finally{if(n)throw n.error}}}if(i)throw new lr(i)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)$o(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&De(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&De(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=(function(){var e=new r;return e.closed=!0,e})(),r})();var gn=X.EMPTY;function cr(r){return r instanceof X||r&&"closed"in r&&y(r.remove)&&y(r.add)&&y(r.unsubscribe)}function $o(r){y(r)?r():r.unsubscribe()}var le={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var tt={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var o=tt.delegate;return o?.setTimeout?o.setTimeout.apply(o,z([r,e],q(t))):setTimeout.apply(void 0,z([r,e],q(t)))},clearTimeout:function(r){var e=tt.delegate;return(e?.clearTimeout||clearTimeout)(r)},delegate:void 0};function ur(r){tt.setTimeout(function(){var e=le.onUnhandledError;if(e)e(r);else throw r})}function ce(){}var Ao=(function(){return yn("C",void 0,void 0)})();function So(r){return yn("E",void 0,r)}function Eo(r){return yn("N",r,void 0)}function yn(r,e,t){return{kind:r,value:e,error:t}}var Ne=null;function rt(r){if(le.useDeprecatedSynchronousErrorHandling){var e=!Ne;if(e&&(Ne={errorThrown:!1,error:null}),r(),e){var t=Ne,n=t.errorThrown,o=t.error;if(Ne=null,n)throw o}}else r()}function Co(r){le.useDeprecatedSynchronousErrorHandling&&Ne&&(Ne.errorThrown=!0,Ne.error=r)}var St=(function(r){V(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,cr(t)&&t.add(n)):n.destination=ya,n}return e.create=function(t,n,o){return new Fe(t,n,o)},e.prototype.next=function(t){this.isStopped?xn(Eo(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?xn(So(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?xn(Ao,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(X);var ma=Function.prototype.bind;function bn(r,e){return ma.call(r,e)}var va=(function(){function r(e){this.partialObserver=e}return r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){pr(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){pr(n)}else pr(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){pr(t)}},r})(),Fe=(function(r){V(e,r);function e(t,n,o){var i=r.call(this)||this,s;if(y(t)||!t)s={next:t??void 0,error:n??void 0,complete:o??void 0};else{var a;i&&le.useDeprecatedNextContext?(a=Object.create(t),a.unsubscribe=function(){return i.unsubscribe()},s={next:t.next&&bn(t.next,a),error:t.error&&bn(t.error,a),complete:t.complete&&bn(t.complete,a)}):s=t}return i.destination=new va(s),i}return e})(St);function pr(r){le.useDeprecatedSynchronousErrorHandling?Co(r):ur(r)}function ga(r){throw r}function xn(r,e){var t=le.onStoppedNotification;t&&tt.setTimeout(function(){return t(r,e)})}var ya={closed:!0,next:ce,error:ga,complete:ce};var nt=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function Q(r){return r}function wn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return _n(r)}function _n(r){return r.length===0?Q:r.length===1?r[0]:function(t){return r.reduce(function(n,o){return o(n)},t)}}var _=(function(){function r(e){e&&(this._subscribe=e)}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var o=this,i=xa(e)?e:new Fe(e,t,n);return rt(function(){var s=o,a=s.operator,l=s.source;i.add(a?a.call(i,l):l?o._subscribe(i):o._trySubscribe(i))}),i},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=To(t),new t(function(o,i){var s=new Fe({next:function(a){try{e(a)}catch(l){i(l),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[nt]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return _n(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=To(e),new e(function(n,o){var i;t.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},r.create=function(e){return new r(e)},r})();function To(r){var e;return(e=r??le.Promise)!==null&&e!==void 0?e:Promise}function ba(r){return r&&y(r.next)&&y(r.error)&&y(r.complete)}function xa(r){return r&&r instanceof St||ba(r)&&cr(r)}function wa(r){return y(r?.lift)}function b(r){return function(e){if(wa(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function $(r,e,t,n,o){return new _a(r,e,t,n,o)}var _a=(function(r){V(e,r);function e(t,n,o,i,s,a){var l=r.call(this,t)||this;return l.onFinalize=s,l.shouldUnsubscribe=a,l._next=n?function(c){try{n(c)}catch(u){t.error(u)}}:r.prototype._next,l._error=i?function(c){try{i(c)}catch(u){t.error(u)}finally{this.unsubscribe()}}:r.prototype._error,l._complete=o?function(){try{o()}catch(c){t.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,l}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e})(St);var Oo=ar(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var re=(function(r){V(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var n=new ko(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new Oo},e.prototype.next=function(t){var n=this;rt(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=we(n.currentObservers),a=s.next();!a.done;a=s.next()){var l=a.value;l.next(t)}}catch(c){o={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},e.prototype.error=function(t){var n=this;rt(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var o=n.observers;o.length;)o.shift().error(t)}})},e.prototype.complete=function(){var t=this;rt(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?gn:(this.currentObservers=null,a.push(t),new X(function(){n.currentObservers=null,De(a,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?t.error(i):s&&t.complete()},e.prototype.asObservable=function(){var t=new _;return t.source=this,t},e.create=function(t,n){return new ko(t,n)},e})(_);var ko=(function(r){V(e,r);function e(t,n){var o=r.call(this)||this;return o.destination=t,o.source=n,o}return e.prototype.next=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,t)},e.prototype.error=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&o!==void 0?o:gn},e})(re);var Et={now:function(){return(Et.delegate||Date).now()},delegate:void 0};var Po=(function(r){V(e,r);function e(t,n,o){t===void 0&&(t=1/0),n===void 0&&(n=1/0),o===void 0&&(o=Et);var i=r.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return e.prototype.next=function(t){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,l=n._windowTime;o||(i.push(t),!s&&i.push(a.now()+l)),this._trimBuffer(),r.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(t),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),l=0;l<a.length&&!t.closed;l+=i?1:2)t.next(a[l]);return this._checkFinalizedStatuses(t),n},e.prototype._trimBuffer=function(){var t=this,n=t._bufferSize,o=t._timestampProvider,i=t._buffer,s=t._infiniteTimeWindow,a=(s?1:2)*n;if(n<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var l=o.now(),c=0,u=1;u<i.length&&i[u]<=l;u+=2)c=u;c&&i.splice(0,c+1)}},e})(re);var Io=(function(r){V(e,r);function e(t,n){return r.call(this)||this}return e.prototype.schedule=function(t,n){return n===void 0&&(n=0),this},e})(X);var Ct={setInterval:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var o=Ct.delegate;return o?.setInterval?o.setInterval.apply(o,z([r,e],q(t))):setInterval.apply(void 0,z([r,e],q(t)))},clearInterval:function(r){var e=Ct.delegate;return(e?.clearInterval||clearInterval)(r)},delegate:void 0};var Ro=(function(r){V(e,r);function e(t,n){var o=r.call(this,t,n)||this;return o.scheduler=t,o.work=n,o.pending=!1,o}return e.prototype.schedule=function(t,n){var o;if(n===void 0&&(n=0),this.closed)return this;this.state=t;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,n)),this.pending=!0,this.delay=n,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(s,this.id,n),this},e.prototype.requestAsyncId=function(t,n,o){return o===void 0&&(o=0),Ct.setInterval(t.flush.bind(t,this),o)},e.prototype.recycleAsyncId=function(t,n,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return n;n!=null&&Ct.clearInterval(n)},e.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(t,n);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,n){var o=!1,i;try{this.work(t)}catch(s){o=!0,i=s||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),i},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,o=t.scheduler,i=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,De(i,this),n!=null&&(this.id=this.recycleAsyncId(o,n,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e})(Io);var $n=(function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return r.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},r.now=Et.now,r})();var Mo=(function(r){V(e,r);function e(t,n){n===void 0&&(n=$n.now);var o=r.call(this,t,n)||this;return o.actions=[],o._active=!1,o}return e.prototype.flush=function(t){var n=this.actions;if(this._active){n.push(t);return}var o;this._active=!0;do if(o=t.execute(t.state,t.delay))break;while(t=n.shift());if(this._active=!1,o){for(;t=n.shift();)t.unsubscribe();throw o}},e})($n);var $a=new Mo(Ro),jo=$a;var ue=new _(function(r){return r.complete()});function fr(r){return r&&y(r.schedule)}function An(r){return r[r.length-1]}function dr(r){return y(An(r))?r.pop():void 0}function me(r){return fr(An(r))?r.pop():void 0}function Lo(r,e){return typeof An(r)=="number"?r.pop():e}var hr=(function(r){return r&&typeof r.length=="number"&&typeof r!="function"});function mr(r){return y(r?.then)}function vr(r){return y(r[nt])}function gr(r){return Symbol.asyncIterator&&y(r?.[Symbol.asyncIterator])}function yr(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Aa(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var br=Aa();function xr(r){return y(r?.[br])}function wr(r){return wo(this,arguments,function(){var t,n,o,i;return sr(this,function(s){switch(s.label){case 0:t=r.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Ue(t.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,Ue(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Ue(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function _r(r){return y(r?.getReader)}function I(r){if(r instanceof _)return r;if(r!=null){if(vr(r))return Sa(r);if(hr(r))return Ea(r);if(mr(r))return Ca(r);if(gr(r))return Uo(r);if(xr(r))return Ta(r);if(_r(r))return Oa(r)}throw yr(r)}function Sa(r){return new _(function(e){var t=r[nt]();if(y(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Ea(r){return new _(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}function Ca(r){return new _(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,ur)})}function Ta(r){return new _(function(e){var t,n;try{for(var o=we(r),i=o.next();!i.done;i=o.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(a){t={error:a}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}e.complete()})}function Uo(r){return new _(function(e){ka(r,e).catch(function(t){return e.error(t)})})}function Oa(r){return Uo(wr(r))}function ka(r,e){var t,n,o,i;return xo(this,void 0,void 0,function(){var s,a;return sr(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),t=_o(r),l.label=1;case 1:return[4,t.next()];case 2:if(n=l.sent(),!!n.done)return[3,4];if(s=n.value,e.next(s),e.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=l.sent(),o={error:a},[3,11];case 6:return l.trys.push([6,,9,10]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function J(r,e,t,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=e.schedule(function(){t(),o?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(i),!o)return i}function $r(r,e){return e===void 0&&(e=0),b(function(t,n){t.subscribe($(n,function(o){return J(n,r,function(){return n.next(o)},e)},function(){return J(n,r,function(){return n.complete()},e)},function(o){return J(n,r,function(){return n.error(o)},e)}))})}function Ar(r,e){return e===void 0&&(e=0),b(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}function Do(r,e){return I(r).pipe(Ar(e),$r(e))}function No(r,e){return I(r).pipe(Ar(e),$r(e))}function Fo(r,e){return new _(function(t){var n=0;return e.schedule(function(){n===r.length?t.complete():(t.next(r[n++]),t.closed||this.schedule())})})}function qo(r,e){return new _(function(t){var n;return J(t,e,function(){n=r[br](),J(t,e,function(){var o,i,s;try{o=n.next(),i=o.value,s=o.done}catch(a){t.error(a);return}s?t.complete():t.next(i)},0,!0)}),function(){return y(n?.return)&&n.return()}})}function Sr(r,e){if(!r)throw new Error("Iterable cannot be null");return new _(function(t){J(t,e,function(){var n=r[Symbol.asyncIterator]();J(t,e,function(){n.next().then(function(o){o.done?t.complete():t.next(o.value)})},0,!0)})})}function zo(r,e){return Sr(wr(r),e)}function Ho(r,e){if(r!=null){if(vr(r))return Do(r,e);if(hr(r))return Fo(r,e);if(mr(r))return No(r,e);if(gr(r))return Sr(r,e);if(xr(r))return qo(r,e);if(_r(r))return zo(r,e)}throw yr(r)}function B(r,e){return e?Ho(r,e):I(r)}function R(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r);return B(r,t)}function Tt(r,e){var t=y(r)?r:function(){return r},n=function(o){return o.error(t())};return new _(e?function(o){return e.schedule(n,0,o)}:n)}function Ot(r){return!!r&&(r instanceof _||y(r.lift)&&y(r.subscribe))}function Wo(r){return r instanceof Date&&!isNaN(r)}function P(r,e){return b(function(t,n){var o=0;t.subscribe($(n,function(i){n.next(r.call(e,i,o++))}))})}var Pa=Array.isArray;function Ia(r,e){return Pa(e)?r.apply(void 0,z([],q(e))):r(e)}function Bo(r){return P(function(e){return Ia(r,e)})}var Ra=Array.isArray,Ma=Object.getPrototypeOf,ja=Object.prototype,La=Object.keys;function Vo(r){if(r.length===1){var e=r[0];if(Ra(e))return{args:e,keys:null};if(Ua(e)){var t=La(e);return{args:t.map(function(n){return e[n]}),keys:t}}}return{args:r,keys:null}}function Ua(r){return r&&typeof r=="object"&&Ma(r)===ja}function Ko(r,e){return r.reduce(function(t,n,o){return t[n]=e[o],t},{})}function Sn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r),n=dr(r),o=Vo(r),i=o.args,s=o.keys;if(i.length===0)return B([],t);var a=new _(Da(i,t,s?function(l){return Ko(s,l)}:Q));return n?a.pipe(Bo(n)):a}function Da(r,e,t){return t===void 0&&(t=Q),function(n){Yo(e,function(){for(var o=r.length,i=new Array(o),s=o,a=o,l=function(u){Yo(e,function(){var p=B(r[u],e),d=!1;p.subscribe($(n,function(f){i[u]=f,d||(d=!0,a--),a||n.next(t(i.slice()))},function(){--s||n.complete()}))},n)},c=0;c<o;c++)l(c)},n)}}function Yo(r,e,t){r?J(t,r,e):e()}function Go(r,e,t,n,o,i,s,a){var l=[],c=0,u=0,p=!1,d=function(){p&&!l.length&&!c&&e.complete()},f=function(h){return c<n?v(h):l.push(h)},v=function(h){i&&e.next(h),c++;var m=!1;I(t(h,u++)).subscribe($(e,function(w){o?.(w),i?f(w):e.next(w)},function(){m=!0},void 0,function(){if(m)try{c--;for(var w=function(){var G=l.shift();s?J(e,s,function(){return v(G)}):v(G)};l.length&&c<n;)w();d()}catch(G){e.error(G)}}))};return r.subscribe($(e,f,function(){p=!0,d()})),function(){a?.()}}function ne(r,e,t){return t===void 0&&(t=1/0),y(e)?ne(function(n,o){return P(function(i,s){return e(n,i,o,s)})(I(r(n,o)))},t):(typeof e=="number"&&(t=e),b(function(n,o){return Go(n,o,r,t)}))}function Er(r){return r===void 0&&(r=1/0),ne(Q,r)}function Jo(){return Er(1)}function Se(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Jo()(B(r,me(r)))}function Ee(r){return new _(function(e){I(r()).subscribe(e)})}function Cr(r,e,t){r===void 0&&(r=0),t===void 0&&(t=jo);var n=-1;return e!=null&&(fr(e)?t=e:n=e),new _(function(o){var i=Wo(r)?+r-t.now():r;i<0&&(i=0);var s=0;return t.schedule(function(){o.closed||(o.next(s++),0<=n?this.schedule(void 0,n):o.complete())},i)})}function Ce(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r),n=Lo(r,1/0),o=r;return o.length?o.length===1?I(o[0]):Er(n)(B(o,t)):ue}var En=new _(ce);function ve(r,e){return b(function(t,n){var o=0;t.subscribe($(n,function(i){return r.call(e,i,o++)&&n.next(i)}))})}function Z(r){return b(function(e,t){var n=null,o=!1,i;n=e.subscribe($(t,void 0,void 0,function(s){i=I(r(s,Z(r)(e))),n?(n.unsubscribe(),n=null,i.subscribe(t)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(t))})}function Tr(r,e,t,n,o){return function(i,s){var a=t,l=e,c=0;i.subscribe($(s,function(u){var p=c++;l=a?r(l,u,p):(a=!0,u),n&&s.next(l)},o&&(function(){a&&s.next(l),s.complete()})))}}function Zo(r,e){return b(Tr(r,e,arguments.length>=2,!1,!0))}var Na=function(r,e){return r.push(e),r};function Cn(){return b(function(r,e){Zo(Na,[])(r).subscribe(e)})}function qe(r,e){return y(e)?ne(r,e,1):ne(r,1)}function ze(r){return r<=0?function(){return ue}:b(function(e,t){var n=0;e.subscribe($(t,function(o){++n<=r&&(t.next(o),r<=n&&t.complete())}))})}function ot(){return b(function(r,e){r.subscribe($(e,ce))})}function Tn(r,e){return e===void 0&&(e=Q),r=r??Fa,b(function(t,n){var o,i=!0;t.subscribe($(n,function(s){var a=e(s);(i||!r(o,a))&&(i=!1,o=a,n.next(s))}))})}function Fa(r,e){return r===e}function On(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return function(t){return Se(t,R.apply(void 0,z([],q(r))))}}function Or(r,e){return e?function(t){return t.pipe(Or(function(n,o){return I(r(n,o)).pipe(P(function(i,s){return e(n,i,o,s)}))}))}:b(function(t,n){var o=0,i=null,s=!1;t.subscribe($(n,function(a){i||(i=$(n,void 0,function(){i=null,s&&n.complete()}),I(r(a,o++)).subscribe(i))},function(){s=!0,!i&&n.complete()}))})}function kt(r){return b(function(e,t){try{e.subscribe(t)}finally{t.add(r)}})}function kn(r,e){return b(Tr(r,e,arguments.length>=2,!0))}function Pt(r){r===void 0&&(r={});var e=r.connector,t=e===void 0?function(){return new re}:e,n=r.resetOnError,o=n===void 0?!0:n,i=r.resetOnComplete,s=i===void 0?!0:i,a=r.resetOnRefCountZero,l=a===void 0?!0:a;return function(c){var u,p,d,f=0,v=!1,h=!1,m=function(){p?.unsubscribe(),p=void 0},w=function(){m(),u=d=void 0,v=h=!1},G=function(){var ae=u;w(),ae?.unsubscribe()};return b(function(ae,be){f++,!h&&!v&&m();var je=d=d??t();be.add(function(){f--,f===0&&!h&&!v&&(p=Pn(G,l))}),je.subscribe(be),!u&&f>0&&(u=new Fe({next:function(Le){return je.next(Le)},error:function(Le){h=!0,m(),p=Pn(w,o,Le),je.error(Le)},complete:function(){v=!0,m(),p=Pn(w,s),je.complete()}}),I(ae).subscribe(u))})(c)}}function Pn(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];if(e===!0){r();return}if(e!==!1){var o=new Fe({next:function(){o.unsubscribe(),r()}});return I(e.apply(void 0,z([],q(t)))).subscribe(o)}}function it(r,e,t){var n,o,i,s,a=!1;return r&&typeof r=="object"?(n=r.bufferSize,s=n===void 0?1/0:n,o=r.windowTime,e=o===void 0?1/0:o,i=r.refCount,a=i===void 0?!1:i,t=r.scheduler):s=r??1/0,Pt({connector:function(){return new Po(s,e,t)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:a})}function In(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r);return b(function(n,o){(t?Se(r,n,t):Se(r,n)).subscribe(o)})}function H(r,e){return b(function(t,n){var o=null,i=0,s=!1,a=function(){return s&&!o&&n.complete()};t.subscribe($(n,function(l){o?.unsubscribe();var c=0,u=i++;I(r(l,u)).subscribe(o=$(n,function(p){return n.next(e?e(l,p,u,c++):p)},function(){o=null,a()}))},function(){s=!0,a()}))})}function He(r){return b(function(e,t){I(r).subscribe($(t,function(){return t.complete()},ce)),!t.closed&&e.subscribe(t)})}function It(r,e){return e===void 0&&(e=!1),b(function(t,n){var o=0;t.subscribe($(n,function(i){var s=r(i,o++);(s||e)&&n.next(i),!s&&n.complete()}))})}function _e(r,e,t){var n=y(r)||e||t?{next:r,error:e,complete:t}:r;return n?b(function(o,i){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var a=!0;o.subscribe($(i,function(l){var c;(c=n.next)===null||c===void 0||c.call(n,l),i.next(l)},function(){var l;a=!1,(l=n.complete)===null||l===void 0||l.call(n),i.complete()},function(l){var c;a=!1,(c=n.error)===null||c===void 0||c.call(n,l),i.error(l)},function(){var l,c;a&&((l=n.unsubscribe)===null||l===void 0||l.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):Q}function Rn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=dr(r);return b(function(n,o){for(var i=r.length,s=new Array(i),a=r.map(function(){return!1}),l=!1,c=function(p){I(r[p]).subscribe($(o,function(d){s[p]=d,!l&&!a[p]&&(a[p]=!0,(l=a.every(Q))&&(a=null))},ce))},u=0;u<i;u++)c(u);n.subscribe($(o,function(p){if(l){var d=z([p],q(s));o.next(t?t.apply(void 0,z([],q(d))):d)}}))})}var qa=["limit-reached","cap-reached","agent-unavailable","session-expired","credential-expired","aborted","internal","attachments-off","attachments-unsupported","attachment-invalid","attachment-too-large","attachment-limit","attachment-missing","attachment-not-uploaded"],M=class extends Error{constructor(t,n,o){super(t);this.code=n;this.status=o;this.name="LambforgeError"}};function Rt(r,e){let t=r?.[0]??{},n=String(t.message??"Request failed"),o=n.match(/^([a-z-]+):/)?.[1];return o&&qa.includes(o)?new M(n,o,e):n==="session-expired"?new M(n,"session-expired",e):t.extensions?.code==="UNAUTHENTICATED"||/not authorized|unauthorized|invalid sign-in token/i.test(n)?new M(n,"unauthorized",e):new M(n,"bad-request",e)}var Pr=["image/png","image/jpeg","image/webp","image/gif","application/pdf","text/plain","text/csv","text/markdown","application/json","application/yaml"],kr=1024*1024,st={imageBytes:5*kr,pdfBytes:10*kr,textBytes:1*kr,perMessage:5,bytesPerMessage:15*kr},za={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",pdf:"application/pdf",txt:"text/plain",csv:"text/csv",md:"text/markdown",markdown:"text/markdown",json:"application/json",yaml:"application/yaml",yml:"application/yaml"},Ir=r=>za[String(r??"").split(".").pop()?.toLowerCase()??""];function Mn(r){if(r.length>st.perMessage)return"attachment-limit";let e=0;for(let t of r){let n=t.type||Ir(t.name);if(!n||!Pr.includes(n))return"attachment-invalid";let o=n.startsWith("image/")?st.imageBytes:n==="application/pdf"?st.pdfBytes:st.textBytes;if(t.size>o)return"attachment-too-large";e+=t.size}return e>st.bytesPerMessage?"attachment-limit":null}var Ha=r=>typeof Blob<"u"&&r instanceof Blob,Wa=r=>{let e=r.replace(/^data:[^,]*;base64,/,""),t=globalThis.Buffer;if(t)return new Uint8Array(t.from(e,"base64"));let n=atob(e),o=new Uint8Array(n.length);for(let i=0;i<n.length;i++)o[i]=n.charCodeAt(i);return o};function Xo(r){if(Ha(r))return{body:r,size:r.size,type:r.type||void 0};if(typeof r=="string"){let e=Wa(r),t=r.match(/^data:([^;,]+)[;,]/)?.[1];return{body:e,size:e.byteLength,type:t}}if(r instanceof ArrayBuffer)return{body:new Uint8Array(r),size:r.byteLength};if(r instanceof Uint8Array)return{body:r,size:r.byteLength};throw new M("Attachment data must be a Blob, File, ArrayBuffer, Uint8Array / Buffer or base64 string","bad-request")}function Qo(r,e,t,n){return Ee(()=>{let o=n??globalThis.fetch;if(!o)throw new M("No fetch available","network");return o(r.uploadUrl,{method:r.method||"PUT",headers:{"Content-Type":r.contentType},body:e.body})}).pipe(P(o=>{if(o.status<200||o.status>=300)throw new M(`Uploading ${t} failed (${o.status})`,"network",o.status);return r}))}var Mt=`id name type description instructions tools isActive modelName mcpLambdaId mcpLambdaName createdAt updatedAt
33
- embed { published identity allowedOrigins welcome suggestions showToolDetails maxMessagesPerConversation maxMessageLength allowAttachments retentionDays publishedAt }`,ri="id name description welcome suggestions allowAttachments",jn=`token expiresAt agents { ${ri} }`,ei="id agentId title messageCount lastSeq answering lastMessageAt createdAt",Ba="id role text attachments { id name mimeType size } toolCalls { name status } createdAt",ti="conversationId seq type runId data createdAt",oe={listAgents:`query ($projectId: String!) { listProjectAgents(projectId: $projectId) { ${Mt} } }`,getAgent:`query ($id: String!) { getProjectAgent(id: $id) { ${Mt} } }`,createAgent:`mutation ($projectId: String!, $payload: CreateProjectAgentInput!) { createProjectAgent(projectId: $projectId, payload: $payload) { ${Mt} } }`,updateAgent:`mutation ($id: String!, $payload: UpdateProjectAgentInput!) { updateProjectAgent(id: $id, payload: $payload) { ${Mt} } }`,deleteAgent:"mutation ($id: String!) { deleteProjectAgent(id: $id) }",updateEmbed:`mutation ($agentId: String!, $embed: AgentEmbedInput!) { updateAgentEmbed(agentId: $agentId, embed: $embed) { ${Mt} } }`,createSession:`mutation ($subject: String!, $agents: [String], $claims: JSON, $ttlSeconds: Int, $origin: String) { createAgentSession(subject: $subject, agents: $agents, claims: $claims, ttlSeconds: $ttlSeconds, origin: $origin) { ${jn} } }`,exchangeSession:`mutation ($projectId: String!, $token: String!, $agents: [String]) { exchangeAgentSession(projectId: $projectId, token: $token, agents: $agents) { ${jn} } }`,anonymousSession:`mutation ($deviceId: String!, $turnstileToken: String!, $agents: [String]) { createAnonymousAgentSession(deviceId: $deviceId, turnstileToken: $turnstileToken, agents: $agents) { ${jn} } }`,sessionAgents:`query { sessionAgents { ${ri} } }`,conversations:`query ($agent: String) { agentConversations(agent: $agent) { ${ei} } }`,conversation:`query ($id: String!) { agentConversation(id: $id) { ${ei} messages { ${Ba} } } }`,events:`query ($conversationId: String!, $afterSeq: Int) { agentConversationEvents(conversationId: $conversationId, afterSeq: $afterSeq) { ${ti} } }`,send:"mutation ($agent: String!, $conversationId: String, $text: String!, $credential: String, $attachments: [String!]) { sendAgentMessage(agent: $agent, conversationId: $conversationId, text: $text, credential: $credential, attachments: $attachments) { conversationId runId seq } }",uploadAttachment:"mutation ($agent: String!, $name: String!, $mimeType: String!, $size: Int!) { createAgentAttachmentUpload(agent: $agent, name: $name, mimeType: $mimeType, size: $size) { id uploadUrl method contentType expiresAt maxBytes } }",abort:"mutation ($conversationId: String!) { abortAgentRun(conversationId: $conversationId) }",liveEvents:`subscription ($conversationId: String!) { agentEvents(conversationId: $conversationId) { ${ti} } }`};var Rr="https://api.lambforge.com",Va=r=>`${r.replace(/\/+$/,"")}/graphql`,ni=r=>`${r.replace(/\/+$/,"").replace(/^http/,"ws")}/subscriptions`;function jt(r,e,t,n,o){return new _(i=>{let s=new AbortController,a=r.fetch??globalThis.fetch;if(!a){i.error(new M("No fetch available","network"));return}return a(Va(r.url),{method:"POST",headers:{"content-type":"application/json",...e?{authorization:e}:{}},body:JSON.stringify({query:t,variables:n}),signal:s.signal}).then(async l=>{let c;try{c=await l.json()}catch{throw new M(`Lambforge answered ${l.status}`,l.status===401?"unauthorized":"network",l.status)}if(c.errors?.length)throw Rt(c.errors,l.status);if(!c.data||!(o in c.data))throw new M(`Lambforge answered ${l.status} without ${o}`,"network",l.status);i.next(c.data[o]),i.complete()}).catch(l=>{s.signal.aborted||i.error(l instanceof M?l:new M(String(l?.message??l),"network"))}),()=>s.abort()})}var oi=["graphql-ws","graphql-transport-ws"];function ii(r){return new _(e=>{let n=!1,o=new r.WebSocket(r.url,oi),i=()=>o.protocol==="graphql-transport-ws",s=l=>{o.readyState===1&&o.send(JSON.stringify(l))},a=l=>{if(!n){n=!0,e.error(l);try{o.close(1e3)}catch{}}};return o.onopen=()=>s({type:"connection_init",payload:r.connectionParams}),o.onmessage=l=>{let c;try{c=JSON.parse(String(l.data))}catch{return}switch(c.type){case"connection_ack":s({id:"1",type:i()?"subscribe":"start",payload:{query:r.query,variables:r.variables}}),r.onStarted?.();return;case"ping":s({type:"pong"});return;case"next":case"data":{let u=c.payload;if(u?.errors?.length){a(Rt(u.errors));return}u?.data&&e.next(u.data[r.field]);return}case"error":a(Rt(Array.isArray(c.payload)?c.payload:[c.payload]));return;case"connection_error":a(new M(String(c.payload?.message??"connection refused"),"unauthorized"));return;case"complete":if(n)return;n=!0,e.complete(),o.close(1e3);return;default:return}},o.onclose=l=>{if(n)return;let c=l?.code===4401||l?.code===4403;a(new M(`connection closed${l?.code?` (${l.code}${l.reason?` ${l.reason}`:""})`:""}`,c?"unauthorized":"network"))},o.onerror=()=>{},()=>{n||(n=!0,s({id:"1",type:i()?"complete":"stop"})),o.onmessage=o.onclose=o.onerror=o.onopen=null;try{o.close(1e3)}catch{}}})}var Mr=r=>Ee(()=>{let e=r();return Ot(e)?e.pipe(ze(1)):B(Promise.resolve(e))}),Ka=6e4,si="lambforge.agents.device",Ya=15e3,We=class{constructor(e){this.options=e;this.current=null;this.pending$=null;if([e.getToken,e.exchange,e.anonymous].filter(Boolean).length!==1)throw new M("AgentClient: give exactly one of getToken, exchange or anonymous","bad-request");if(e.anonymous&&!e.anonymous.publishableKey.startsWith("lfp_"))throw new M("AgentClient: anonymous visitors need a publishable key (lfp_...)","bad-request");this.endpoint={url:e.url??Rr,fetch:e.fetch}}token$(){return this.current&&Date.now()<this.current.renewAt?R(this.current.token):(this.pending$||(this.pending$=this.session$().pipe(_e(e=>{let t=e.expiresAt?Date.parse(e.expiresAt):NaN;this.current={token:e.token,renewAt:Number.isFinite(t)?Math.max(Date.now()+3e4,t-Ka):Date.now()+50*6e4}}),P(e=>e.token),kt(()=>this.pending$=null),it(1))),this.pending$)}invalidate(){this.current=null}credential$(){let e=this.options,t=e.credential===!1?null:e.credential??(e.exchange?e.exchange.idToken:null);return t?Mr(t).pipe(P(n=>n||void 0)):R(void 0)}session$(){let e=this.options;if(e.getToken)return Mr(e.getToken).pipe(P(n=>typeof n=="string"?{token:n}:n));if(e.exchange){let{projectId:n,idToken:o,agents:i}=e.exchange;return Mr(o).pipe(H(s=>jt(this.endpoint,null,oe.exchangeSession,{projectId:n,token:s,agents:i},"exchangeAgentSession")))}let t=e.anonymous;return Mr(t.turnstileToken).pipe(H(n=>jt(this.endpoint,t.publishableKey,oe.anonymousSession,{deviceId:t.deviceId??ai(),turnstileToken:n,agents:t.agents},"createAnonymousAgentSession")))}call$(e,t,n){let o=()=>this.token$().pipe(H(i=>jt(this.endpoint,i,e,t,n)));return o().pipe(Z(i=>i?.code!=="session-expired"&&i?.code!=="unauthorized"?Tt(()=>i):(this.invalidate(),o())))}uploadAttachment(e,t){return Ee(()=>{let n=Xo(t.data),o=t.mimeType||n.type||Ir(t.name);if(!o)throw new M(`Attachment ${t.name}: give its mimeType`,"bad-request");return this.call$(oe.uploadAttachment,{agent:e,name:t.name,mimeType:o,size:n.size},"createAgentAttachmentUpload").pipe(H(i=>Qo(i,n,t.name,this.options.fetch)))})}agents(){return this.call$(oe.sessionAgents,{},"sessionAgents")}conversations(e){return this.call$(oe.conversations,{agent:e},"agentConversations")}agent(e){return{conversation:t=>new jr(this,e,t??null),conversations:()=>this.conversations(e)}}events(e,t=0){return new _(n=>{let o=t,i=new Map,s=new X,a=!1,l=!1,c=()=>{for(;i.has(o+1);){let m=i.get(o+1);i.delete(o+1),o=m.seq,n.next(m)}},u=m=>{if(m){if(m.type==="delta"){n.next(m);return}m.seq<=o||(i.set(m.seq,m),c(),i.size&&p())}},p=()=>{if(a){l=!0;return}a=!0,s.add(this.call$(oe.events,{conversationId:e,afterSeq:o},"agentConversationEvents").subscribe({next:m=>{m.forEach(w=>i.set(w.seq,w)),c(),i.size&&!m.length&&(o=Math.min(...i.keys())-1,c())},error:m=>{a=!1,n.error(m)},complete:()=>{a=!1,l&&(l=!1,p())}}))},d=this.webSocket();if(!d)return p(),s.add(Cr(this.options.pollIntervalMs??1500,this.options.pollIntervalMs??1500).subscribe(()=>p())),s;let f=0,v=!1,h=()=>{s.add(this.token$().pipe(H(m=>ii({url:ni(this.endpoint.url),WebSocket:d,connectionParams:{agentSession:m},query:oe.liveEvents,variables:{conversationId:e},field:"agentEvents",onStarted:()=>{f=0,v=!1,p()}}))).subscribe({next:u,error:m=>{if(m?.code==="unauthorized"&&!v){v=!0,this.invalidate(),h();return}if(m?.code!=="network"){n.error(m);return}let w=Math.min(Ya,1e3*2**f++);s.add(Cr(w*(.75+Math.random()/2)).subscribe(h))},complete:()=>n.complete()}))};return h(),s})}webSocket(){return this.options.WebSocket===!1?null:this.options.WebSocket??(globalThis.WebSocket||null)}},jr=class{constructor(e,t,n){this.client=e;this.agent=t;this.id=n}send(e,t={}){let n=t.credential!==void 0?R(t.credential):this.client.credential$();return(t.attachments?.length?B(t.attachments).pipe(qe(i=>this.client.uploadAttachment(this.agent,i)),P(i=>i.id),Cn()):R([])).pipe(H(i=>n.pipe(P(s=>({credential:s,attachments:[...t.attachmentIds??[],...i]})))),H(({credential:i,attachments:s})=>this.client.call$(oe.send,{agent:this.agent,conversationId:this.id,text:e,credential:i,...s.length?{attachments:s}:{}},"sendAgentMessage"))).pipe(_e(i=>this.id=i.conversationId),H(i=>this.client.events(i.conversationId,Math.max(0,i.seq-2)).pipe(It(s=>!((s.type==="done"||s.type==="error")&&s.runId===i.runId),!0))))}events(e){return this.id?e===void 0?this.history().pipe(H(t=>this.client.events(this.id,t.lastSeq??0))):this.client.events(this.id,e):Tt(()=>new M("No conversation yet - send a message first","bad-request"))}history(){return this.id?this.client.call$(oe.conversation,{id:this.id},"agentConversation"):Tt(()=>new M("No conversation yet - send a message first","bad-request"))}abort(){return this.id?this.client.call$(oe.abort,{conversationId:this.id},"abortAgentRun"):R(!1)}};function ai(){let r=globalThis.localStorage;try{let t=r?.getItem(si);if(t&&/^[A-Za-z0-9_-]{16,128}$/.test(t))return t}catch{}let e=globalThis.crypto.randomUUID().replace(/-/g,"");try{r?.setItem(si,e)}catch{}return e}var ua=mn(Ws()),g=mn(Yt());var se=mn(Yt()),fc=/^(https?:|mailto:)/i,ao=/^\s*[-*+]\s+/,Xr=/^\s*\d+[.)]\s+/,dc=/^```\s*([\w+-]*)\s*$/,Bs=/^(#{1,6})\s+(.*)$/;function Jt(r){let e=[],t=String(r??"").replace(/\r\n?/g,`
32
+ `):"",this.name="UnsubscriptionError",this.errors=t}});function Fe(r,e){if(r){var t=r.indexOf(e);0<=t&&r.splice(t,1)}}var Q=(function(){function r(e){this.initialTeardown=e,this.closed=!1,this._parentage=null,this._finalizers=null}return r.prototype.unsubscribe=function(){var e,t,n,o,i;if(!this.closed){this.closed=!0;var s=this._parentage;if(s)if(this._parentage=null,Array.isArray(s))try{for(var a=we(s),l=a.next();!l.done;l=a.next()){var c=l.value;c.remove(this)}}catch(h){e={error:h}}finally{try{l&&!l.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}else s.remove(this);var u=this.initialTeardown;if(b(u))try{u()}catch(h){i=h instanceof pr?h.errors:[h]}var p=this._finalizers;if(p){this._finalizers=null;try{for(var f=we(p),d=f.next();!d.done;d=f.next()){var g=d.value;try{Co(g)}catch(h){i=i??[],h instanceof pr?i=z(z([],H(i)),H(h.errors)):i.push(h)}}}catch(h){n={error:h}}finally{try{d&&!d.done&&(o=f.return)&&o.call(f)}finally{if(n)throw n.error}}}if(i)throw new pr(i)}},r.prototype.add=function(e){var t;if(e&&e!==this)if(this.closed)Co(e);else{if(e instanceof r){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=(t=this._finalizers)!==null&&t!==void 0?t:[]).push(e)}},r.prototype._hasParent=function(e){var t=this._parentage;return t===e||Array.isArray(t)&&t.includes(e)},r.prototype._addParent=function(e){var t=this._parentage;this._parentage=Array.isArray(t)?(t.push(e),t):t?[t,e]:e},r.prototype._removeParent=function(e){var t=this._parentage;t===e?this._parentage=null:Array.isArray(t)&&Fe(t,e)},r.prototype.remove=function(e){var t=this._finalizers;t&&Fe(t,e),e instanceof r&&e._removeParent(this)},r.EMPTY=(function(){var e=new r;return e.closed=!0,e})(),r})();var wn=Q.EMPTY;function dr(r){return r instanceof Q||r&&"closed"in r&&b(r.remove)&&b(r.add)&&b(r.unsubscribe)}function Co(r){b(r)?r():r.unsubscribe()}var ce={onUnhandledError:null,onStoppedNotification:null,Promise:void 0,useDeprecatedSynchronousErrorHandling:!1,useDeprecatedNextContext:!1};var ot={setTimeout:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var o=ot.delegate;return o?.setTimeout?o.setTimeout.apply(o,z([r,e],H(t))):setTimeout.apply(void 0,z([r,e],H(t)))},clearTimeout:function(r){var e=ot.delegate;return(e?.clearTimeout||clearTimeout)(r)},delegate:void 0};function fr(r){ot.setTimeout(function(){var e=ce.onUnhandledError;if(e)e(r);else throw r})}function ue(){}var ko=(function(){return $n("C",void 0,void 0)})();function To(r){return $n("E",void 0,r)}function Io(r){return $n("N",r,void 0)}function $n(r,e,t){return{kind:r,value:e,error:t}}var De=null;function it(r){if(ce.useDeprecatedSynchronousErrorHandling){var e=!De;if(e&&(De={errorThrown:!1,error:null}),r(),e){var t=De,n=t.errorThrown,o=t.error;if(De=null,n)throw o}}else r()}function Oo(r){ce.useDeprecatedSynchronousErrorHandling&&De&&(De.errorThrown=!0,De.error=r)}var Tt=(function(r){Y(e,r);function e(t){var n=r.call(this)||this;return n.isStopped=!1,t?(n.destination=t,dr(t)&&t.add(n)):n.destination=_a,n}return e.create=function(t,n,o){return new Ne(t,n,o)},e.prototype.next=function(t){this.isStopped?Sn(Io(t),this):this._next(t)},e.prototype.error=function(t){this.isStopped?Sn(To(t),this):(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped?Sn(ko,this):(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,r.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e})(Q);var xa=Function.prototype.bind;function _n(r,e){return xa.call(r,e)}var wa=(function(){function r(e){this.partialObserver=e}return r.prototype.next=function(e){var t=this.partialObserver;if(t.next)try{t.next(e)}catch(n){hr(n)}},r.prototype.error=function(e){var t=this.partialObserver;if(t.error)try{t.error(e)}catch(n){hr(n)}else hr(e)},r.prototype.complete=function(){var e=this.partialObserver;if(e.complete)try{e.complete()}catch(t){hr(t)}},r})(),Ne=(function(r){Y(e,r);function e(t,n,o){var i=r.call(this)||this,s;if(b(t)||!t)s={next:t??void 0,error:n??void 0,complete:o??void 0};else{var a;i&&ce.useDeprecatedNextContext?(a=Object.create(t),a.unsubscribe=function(){return i.unsubscribe()},s={next:t.next&&_n(t.next,a),error:t.error&&_n(t.error,a),complete:t.complete&&_n(t.complete,a)}):s=t}return i.destination=new wa(s),i}return e})(Tt);function hr(r){ce.useDeprecatedSynchronousErrorHandling?Oo(r):fr(r)}function $a(r){throw r}function Sn(r,e){var t=ce.onStoppedNotification;t&&ot.setTimeout(function(){return t(r,e)})}var _a={closed:!0,next:ue,error:$a,complete:ue};var st=(function(){return typeof Symbol=="function"&&Symbol.observable||"@@observable"})();function ee(r){return r}function An(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return En(r)}function En(r){return r.length===0?ee:r.length===1?r[0]:function(t){return r.reduce(function(n,o){return o(n)},t)}}var $=(function(){function r(e){e&&(this._subscribe=e)}return r.prototype.lift=function(e){var t=new r;return t.source=this,t.operator=e,t},r.prototype.subscribe=function(e,t,n){var o=this,i=Aa(e)?e:new Ne(e,t,n);return it(function(){var s=o,a=s.operator,l=s.source;i.add(a?a.call(i,l):l?o._subscribe(i):o._trySubscribe(i))}),i},r.prototype._trySubscribe=function(e){try{return this._subscribe(e)}catch(t){e.error(t)}},r.prototype.forEach=function(e,t){var n=this;return t=Po(t),new t(function(o,i){var s=new Ne({next:function(a){try{e(a)}catch(l){i(l),s.unsubscribe()}},error:i,complete:o});n.subscribe(s)})},r.prototype._subscribe=function(e){var t;return(t=this.source)===null||t===void 0?void 0:t.subscribe(e)},r.prototype[st]=function(){return this},r.prototype.pipe=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return En(e)(this)},r.prototype.toPromise=function(e){var t=this;return e=Po(e),new e(function(n,o){var i;t.subscribe(function(s){return i=s},function(s){return o(s)},function(){return n(i)})})},r.create=function(e){return new r(e)},r})();function Po(r){var e;return(e=r??ce.Promise)!==null&&e!==void 0?e:Promise}function Sa(r){return r&&b(r.next)&&b(r.error)&&b(r.complete)}function Aa(r){return r&&r instanceof Tt||Sa(r)&&dr(r)}function Ea(r){return b(r?.lift)}function y(r){return function(e){if(Ea(e))return e.lift(function(t){try{return r(t,this)}catch(n){this.error(n)}});throw new TypeError("Unable to lift unknown Observable type")}}function _(r,e,t,n,o){return new Ca(r,e,t,n,o)}var Ca=(function(r){Y(e,r);function e(t,n,o,i,s,a){var l=r.call(this,t)||this;return l.onFinalize=s,l.shouldUnsubscribe=a,l._next=n?function(c){try{n(c)}catch(u){t.error(u)}}:r.prototype._next,l._error=i?function(c){try{i(c)}catch(u){t.error(u)}finally{this.unsubscribe()}}:r.prototype._error,l._complete=o?function(){try{o()}catch(c){t.error(c)}finally{this.unsubscribe()}}:r.prototype._complete,l}return e.prototype.unsubscribe=function(){var t;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var n=this.closed;r.prototype.unsubscribe.call(this),!n&&((t=this.onFinalize)===null||t===void 0||t.call(this))}},e})(Tt);var jo=ur(function(r){return function(){r(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}});var oe=(function(r){Y(e,r);function e(){var t=r.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return e.prototype.lift=function(t){var n=new Ro(this,this);return n.operator=t,n},e.prototype._throwIfClosed=function(){if(this.closed)throw new jo},e.prototype.next=function(t){var n=this;it(function(){var o,i;if(n._throwIfClosed(),!n.isStopped){n.currentObservers||(n.currentObservers=Array.from(n.observers));try{for(var s=we(n.currentObservers),a=s.next();!a.done;a=s.next()){var l=a.value;l.next(t)}}catch(c){o={error:c}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(o)throw o.error}}}})},e.prototype.error=function(t){var n=this;it(function(){if(n._throwIfClosed(),!n.isStopped){n.hasError=n.isStopped=!0,n.thrownError=t;for(var o=n.observers;o.length;)o.shift().error(t)}})},e.prototype.complete=function(){var t=this;it(function(){if(t._throwIfClosed(),!t.isStopped){t.isStopped=!0;for(var n=t.observers;n.length;)n.shift().complete()}})},e.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(e.prototype,"observed",{get:function(){var t;return((t=this.observers)===null||t===void 0?void 0:t.length)>0},enumerable:!1,configurable:!0}),e.prototype._trySubscribe=function(t){return this._throwIfClosed(),r.prototype._trySubscribe.call(this,t)},e.prototype._subscribe=function(t){return this._throwIfClosed(),this._checkFinalizedStatuses(t),this._innerSubscribe(t)},e.prototype._innerSubscribe=function(t){var n=this,o=this,i=o.hasError,s=o.isStopped,a=o.observers;return i||s?wn:(this.currentObservers=null,a.push(t),new Q(function(){n.currentObservers=null,Fe(a,t)}))},e.prototype._checkFinalizedStatuses=function(t){var n=this,o=n.hasError,i=n.thrownError,s=n.isStopped;o?t.error(i):s&&t.complete()},e.prototype.asObservable=function(){var t=new $;return t.source=this,t},e.create=function(t,n){return new Ro(t,n)},e})($);var Ro=(function(r){Y(e,r);function e(t,n){var o=r.call(this)||this;return o.destination=t,o.source=n,o}return e.prototype.next=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.next)===null||o===void 0||o.call(n,t)},e.prototype.error=function(t){var n,o;(o=(n=this.destination)===null||n===void 0?void 0:n.error)===null||o===void 0||o.call(n,t)},e.prototype.complete=function(){var t,n;(n=(t=this.destination)===null||t===void 0?void 0:t.complete)===null||n===void 0||n.call(t)},e.prototype._subscribe=function(t){var n,o;return(o=(n=this.source)===null||n===void 0?void 0:n.subscribe(t))!==null&&o!==void 0?o:wn},e})(oe);var It={now:function(){return(It.delegate||Date).now()},delegate:void 0};var Mo=(function(r){Y(e,r);function e(t,n,o){t===void 0&&(t=1/0),n===void 0&&(n=1/0),o===void 0&&(o=It);var i=r.call(this)||this;return i._bufferSize=t,i._windowTime=n,i._timestampProvider=o,i._buffer=[],i._infiniteTimeWindow=!0,i._infiniteTimeWindow=n===1/0,i._bufferSize=Math.max(1,t),i._windowTime=Math.max(1,n),i}return e.prototype.next=function(t){var n=this,o=n.isStopped,i=n._buffer,s=n._infiniteTimeWindow,a=n._timestampProvider,l=n._windowTime;o||(i.push(t),!s&&i.push(a.now()+l)),this._trimBuffer(),r.prototype.next.call(this,t)},e.prototype._subscribe=function(t){this._throwIfClosed(),this._trimBuffer();for(var n=this._innerSubscribe(t),o=this,i=o._infiniteTimeWindow,s=o._buffer,a=s.slice(),l=0;l<a.length&&!t.closed;l+=i?1:2)t.next(a[l]);return this._checkFinalizedStatuses(t),n},e.prototype._trimBuffer=function(){var t=this,n=t._bufferSize,o=t._timestampProvider,i=t._buffer,s=t._infiniteTimeWindow,a=(s?1:2)*n;if(n<1/0&&a<i.length&&i.splice(0,i.length-a),!s){for(var l=o.now(),c=0,u=1;u<i.length&&i[u]<=l;u+=2)c=u;c&&i.splice(0,c+1)}},e})(oe);var Lo=(function(r){Y(e,r);function e(t,n){return r.call(this)||this}return e.prototype.schedule=function(t,n){return n===void 0&&(n=0),this},e})(Q);var Ot={setInterval:function(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var o=Ot.delegate;return o?.setInterval?o.setInterval.apply(o,z([r,e],H(t))):setInterval.apply(void 0,z([r,e],H(t)))},clearInterval:function(r){var e=Ot.delegate;return(e?.clearInterval||clearInterval)(r)},delegate:void 0};var Uo=(function(r){Y(e,r);function e(t,n){var o=r.call(this,t,n)||this;return o.scheduler=t,o.work=n,o.pending=!1,o}return e.prototype.schedule=function(t,n){var o;if(n===void 0&&(n=0),this.closed)return this;this.state=t;var i=this.id,s=this.scheduler;return i!=null&&(this.id=this.recycleAsyncId(s,i,n)),this.pending=!0,this.delay=n,this.id=(o=this.id)!==null&&o!==void 0?o:this.requestAsyncId(s,this.id,n),this},e.prototype.requestAsyncId=function(t,n,o){return o===void 0&&(o=0),Ot.setInterval(t.flush.bind(t,this),o)},e.prototype.recycleAsyncId=function(t,n,o){if(o===void 0&&(o=0),o!=null&&this.delay===o&&this.pending===!1)return n;n!=null&&Ot.clearInterval(n)},e.prototype.execute=function(t,n){if(this.closed)return new Error("executing a cancelled action");this.pending=!1;var o=this._execute(t,n);if(o)return o;this.pending===!1&&this.id!=null&&(this.id=this.recycleAsyncId(this.scheduler,this.id,null))},e.prototype._execute=function(t,n){var o=!1,i;try{this.work(t)}catch(s){o=!0,i=s||new Error("Scheduled action threw falsy error")}if(o)return this.unsubscribe(),i},e.prototype.unsubscribe=function(){if(!this.closed){var t=this,n=t.id,o=t.scheduler,i=o.actions;this.work=this.state=this.scheduler=null,this.pending=!1,Fe(i,this),n!=null&&(this.id=this.recycleAsyncId(o,n,null)),this.delay=null,r.prototype.unsubscribe.call(this)}},e})(Lo);var Cn=(function(){function r(e,t){t===void 0&&(t=r.now),this.schedulerActionCtor=e,this.now=t}return r.prototype.schedule=function(e,t,n){return t===void 0&&(t=0),new this.schedulerActionCtor(this,e).schedule(n,t)},r.now=It.now,r})();var Fo=(function(r){Y(e,r);function e(t,n){n===void 0&&(n=Cn.now);var o=r.call(this,t,n)||this;return o.actions=[],o._active=!1,o}return e.prototype.flush=function(t){var n=this.actions;if(this._active){n.push(t);return}var o;this._active=!0;do if(o=t.execute(t.state,t.delay))break;while(t=n.shift());if(this._active=!1,o){for(;t=n.shift();)t.unsubscribe();throw o}},e})(Cn);var ka=new Fo(Uo),Do=ka;var ie=new $(function(r){return r.complete()});function mr(r){return r&&b(r.schedule)}function kn(r){return r[r.length-1]}function gr(r){return b(kn(r))?r.pop():void 0}function me(r){return mr(kn(r))?r.pop():void 0}function No(r,e){return typeof kn(r)=="number"?r.pop():e}var vr=(function(r){return r&&typeof r.length=="number"&&typeof r!="function"});function br(r){return b(r?.then)}function yr(r){return b(r[st])}function xr(r){return Symbol.asyncIterator&&b(r?.[Symbol.asyncIterator])}function wr(r){return new TypeError("You provided "+(r!==null&&typeof r=="object"?"an invalid object":"'"+r+"'")+" where a stream was expected. You can provide an Observable, Promise, ReadableStream, Array, AsyncIterable, or Iterable.")}function Ta(){return typeof Symbol!="function"||!Symbol.iterator?"@@iterator":Symbol.iterator}var $r=Ta();function _r(r){return b(r?.[$r])}function Sr(r){return Ao(this,arguments,function(){var t,n,o,i;return cr(this,function(s){switch(s.label){case 0:t=r.getReader(),s.label=1;case 1:s.trys.push([1,,9,10]),s.label=2;case 2:return[4,Ue(t.read())];case 3:return n=s.sent(),o=n.value,i=n.done,i?[4,Ue(void 0)]:[3,5];case 4:return[2,s.sent()];case 5:return[4,Ue(o)];case 6:return[4,s.sent()];case 7:return s.sent(),[3,2];case 8:return[3,10];case 9:return t.releaseLock(),[7];case 10:return[2]}})})}function Ar(r){return b(r?.getReader)}function j(r){if(r instanceof $)return r;if(r!=null){if(yr(r))return Ia(r);if(vr(r))return Oa(r);if(br(r))return Pa(r);if(xr(r))return qo(r);if(_r(r))return ja(r);if(Ar(r))return Ra(r)}throw wr(r)}function Ia(r){return new $(function(e){var t=r[st]();if(b(t.subscribe))return t.subscribe(e);throw new TypeError("Provided object does not correctly implement Symbol.observable")})}function Oa(r){return new $(function(e){for(var t=0;t<r.length&&!e.closed;t++)e.next(r[t]);e.complete()})}function Pa(r){return new $(function(e){r.then(function(t){e.closed||(e.next(t),e.complete())},function(t){return e.error(t)}).then(null,fr)})}function ja(r){return new $(function(e){var t,n;try{for(var o=we(r),i=o.next();!i.done;i=o.next()){var s=i.value;if(e.next(s),e.closed)return}}catch(a){t={error:a}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}e.complete()})}function qo(r){return new $(function(e){Ma(r,e).catch(function(t){return e.error(t)})})}function Ra(r){return qo(Sr(r))}function Ma(r,e){var t,n,o,i;return So(this,void 0,void 0,function(){var s,a;return cr(this,function(l){switch(l.label){case 0:l.trys.push([0,5,6,11]),t=Eo(r),l.label=1;case 1:return[4,t.next()];case 2:if(n=l.sent(),!!n.done)return[3,4];if(s=n.value,e.next(s),e.closed)return[2];l.label=3;case 3:return[3,1];case 4:return[3,11];case 5:return a=l.sent(),o={error:a},[3,11];case 6:return l.trys.push([6,,9,10]),n&&!n.done&&(i=t.return)?[4,i.call(t)]:[3,8];case 7:l.sent(),l.label=8;case 8:return[3,10];case 9:if(o)throw o.error;return[7];case 10:return[7];case 11:return e.complete(),[2]}})})}function X(r,e,t,n,o){n===void 0&&(n=0),o===void 0&&(o=!1);var i=e.schedule(function(){t(),o?r.add(this.schedule(null,n)):this.unsubscribe()},n);if(r.add(i),!o)return i}function Er(r,e){return e===void 0&&(e=0),y(function(t,n){t.subscribe(_(n,function(o){return X(n,r,function(){return n.next(o)},e)},function(){return X(n,r,function(){return n.complete()},e)},function(o){return X(n,r,function(){return n.error(o)},e)}))})}function Cr(r,e){return e===void 0&&(e=0),y(function(t,n){n.add(r.schedule(function(){return t.subscribe(n)},e))})}function Ho(r,e){return j(r).pipe(Cr(e),Er(e))}function zo(r,e){return j(r).pipe(Cr(e),Er(e))}function Wo(r,e){return new $(function(t){var n=0;return e.schedule(function(){n===r.length?t.complete():(t.next(r[n++]),t.closed||this.schedule())})})}function Ko(r,e){return new $(function(t){var n;return X(t,e,function(){n=r[$r](),X(t,e,function(){var o,i,s;try{o=n.next(),i=o.value,s=o.done}catch(a){t.error(a);return}s?t.complete():t.next(i)},0,!0)}),function(){return b(n?.return)&&n.return()}})}function kr(r,e){if(!r)throw new Error("Iterable cannot be null");return new $(function(t){X(t,e,function(){var n=r[Symbol.asyncIterator]();X(t,e,function(){n.next().then(function(o){o.done?t.complete():t.next(o.value)})},0,!0)})})}function Bo(r,e){return kr(Sr(r),e)}function Vo(r,e){if(r!=null){if(yr(r))return Ho(r,e);if(vr(r))return Wo(r,e);if(br(r))return zo(r,e);if(xr(r))return kr(r,e);if(_r(r))return Ko(r,e);if(Ar(r))return Bo(r,e)}throw wr(r)}function V(r,e){return e?Vo(r,e):j(r)}function O(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r);return V(r,t)}function at(r,e){var t=b(r)?r:function(){return r},n=function(o){return o.error(t())};return new $(e?function(o){return e.schedule(n,0,o)}:n)}function Pt(r){return!!r&&(r instanceof $||b(r.lift)&&b(r.subscribe))}function Yo(r){return r instanceof Date&&!isNaN(r)}function P(r,e){return y(function(t,n){var o=0;t.subscribe(_(n,function(i){n.next(r.call(e,i,o++))}))})}var La=Array.isArray;function Ua(r,e){return La(e)?r.apply(void 0,z([],H(e))):r(e)}function Go(r){return P(function(e){return Ua(r,e)})}var Fa=Array.isArray,Da=Object.getPrototypeOf,Na=Object.prototype,qa=Object.keys;function Jo(r){if(r.length===1){var e=r[0];if(Fa(e))return{args:e,keys:null};if(Ha(e)){var t=qa(e);return{args:t.map(function(n){return e[n]}),keys:t}}}return{args:r,keys:null}}function Ha(r){return r&&typeof r=="object"&&Da(r)===Na}function Zo(r,e){return r.reduce(function(t,n,o){return t[n]=e[o],t},{})}function Tn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r),n=gr(r),o=Jo(r),i=o.args,s=o.keys;if(i.length===0)return V([],t);var a=new $(za(i,t,s?function(l){return Zo(s,l)}:ee));return n?a.pipe(Go(n)):a}function za(r,e,t){return t===void 0&&(t=ee),function(n){Xo(e,function(){for(var o=r.length,i=new Array(o),s=o,a=o,l=function(u){Xo(e,function(){var p=V(r[u],e),f=!1;p.subscribe(_(n,function(d){i[u]=d,f||(f=!0,a--),a||n.next(t(i.slice()))},function(){--s||n.complete()}))},n)},c=0;c<o;c++)l(c)},n)}}function Xo(r,e,t){r?X(t,r,e):e()}function Qo(r,e,t,n,o,i,s,a){var l=[],c=0,u=0,p=!1,f=function(){p&&!l.length&&!c&&e.complete()},d=function(h){return c<n?g(h):l.push(h)},g=function(h){i&&e.next(h),c++;var m=!1;j(t(h,u++)).subscribe(_(e,function(w){o?.(w),i?d(w):e.next(w)},function(){m=!0},void 0,function(){if(m)try{c--;for(var w=function(){var Z=l.shift();s?X(e,s,function(){return g(Z)}):g(Z)};l.length&&c<n;)w();f()}catch(Z){e.error(Z)}}))};return r.subscribe(_(e,d,function(){p=!0,f()})),function(){a?.()}}function te(r,e,t){return t===void 0&&(t=1/0),b(e)?te(function(n,o){return P(function(i,s){return e(n,i,o,s)})(j(r(n,o)))},t):(typeof e=="number"&&(t=e),y(function(n,o){return Qo(n,o,r,t)}))}function Tr(r){return r===void 0&&(r=1/0),te(ee,r)}function ei(){return Tr(1)}function Ee(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return ei()(V(r,me(r)))}function Ce(r){return new $(function(e){j(r()).subscribe(e)})}function Ir(r,e,t){r===void 0&&(r=0),t===void 0&&(t=Do);var n=-1;return e!=null&&(mr(e)?t=e:n=e),new $(function(o){var i=Yo(r)?+r-t.now():r;i<0&&(i=0);var s=0;return t.schedule(function(){o.closed||(o.next(s++),0<=n?this.schedule(void 0,n):o.complete())},i)})}function ke(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r),n=No(r,1/0),o=r;return o.length?o.length===1?j(o[0]):Tr(n)(V(o,t)):ie}var In=new $(ue);function ge(r,e){return y(function(t,n){var o=0;t.subscribe(_(n,function(i){return r.call(e,i,o++)&&n.next(i)}))})}function G(r){return y(function(e,t){var n=null,o=!1,i;n=e.subscribe(_(t,void 0,void 0,function(s){i=j(r(s,G(r)(e))),n?(n.unsubscribe(),n=null,i.subscribe(t)):o=!0})),o&&(n.unsubscribe(),n=null,i.subscribe(t))})}function Or(r,e,t,n,o){return function(i,s){var a=t,l=e,c=0;i.subscribe(_(s,function(u){var p=c++;l=a?r(l,u,p):(a=!0,u),n&&s.next(l)},o&&(function(){a&&s.next(l),s.complete()})))}}function ti(r,e){return y(Or(r,e,arguments.length>=2,!1,!0))}var Wa=function(r,e){return r.push(e),r};function On(){return y(function(r,e){ti(Wa,[])(r).subscribe(e)})}function qe(r,e){return b(e)?te(r,e,1):te(r,1)}function He(r){return r<=0?function(){return ie}:y(function(e,t){var n=0;e.subscribe(_(t,function(o){++n<=r&&(t.next(o),r<=n&&t.complete())}))})}function ze(){return y(function(r,e){r.subscribe(_(e,ue))})}function Pn(r,e){return e===void 0&&(e=ee),r=r??Ka,y(function(t,n){var o,i=!0;t.subscribe(_(n,function(s){var a=e(s);(i||!r(o,a))&&(i=!1,o=a,n.next(s))}))})}function Ka(r,e){return r===e}function jn(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return function(t){return Ee(t,O.apply(void 0,z([],H(r))))}}function Pr(r,e){return e?function(t){return t.pipe(Pr(function(n,o){return j(r(n,o)).pipe(P(function(i,s){return e(n,i,o,s)}))}))}:y(function(t,n){var o=0,i=null,s=!1;t.subscribe(_(n,function(a){i||(i=_(n,void 0,function(){i=null,s&&n.complete()}),j(r(a,o++)).subscribe(i))},function(){s=!0,!i&&n.complete()}))})}function jt(r){return y(function(e,t){try{e.subscribe(t)}finally{t.add(r)}})}function Rn(r,e){return y(Or(r,e,arguments.length>=2,!0))}function Rt(r){r===void 0&&(r={});var e=r.connector,t=e===void 0?function(){return new oe}:e,n=r.resetOnError,o=n===void 0?!0:n,i=r.resetOnComplete,s=i===void 0?!0:i,a=r.resetOnRefCountZero,l=a===void 0?!0:a;return function(c){var u,p,f,d=0,g=!1,h=!1,m=function(){p?.unsubscribe(),p=void 0},w=function(){m(),u=f=void 0,g=h=!1},Z=function(){var le=u;w(),le?.unsubscribe()};return y(function(le,ye){d++,!h&&!g&&m();var Me=f=f??t();ye.add(function(){d--,d===0&&!h&&!g&&(p=Mn(Z,l))}),Me.subscribe(ye),!u&&d>0&&(u=new Ne({next:function(Le){return Me.next(Le)},error:function(Le){h=!0,m(),p=Mn(w,o,Le),Me.error(Le)},complete:function(){g=!0,m(),p=Mn(w,s),Me.complete()}}),j(le).subscribe(u))})(c)}}function Mn(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];if(e===!0){r();return}if(e!==!1){var o=new Ne({next:function(){o.unsubscribe(),r()}});return j(e.apply(void 0,z([],H(t)))).subscribe(o)}}function lt(r,e,t){var n,o,i,s,a=!1;return r&&typeof r=="object"?(n=r.bufferSize,s=n===void 0?1/0:n,o=r.windowTime,e=o===void 0?1/0:o,i=r.refCount,a=i===void 0?!1:i,t=r.scheduler):s=r??1/0,Rt({connector:function(){return new Mo(s,e,t)},resetOnError:!0,resetOnComplete:!1,resetOnRefCountZero:a})}function Ln(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=me(r);return y(function(n,o){(t?Ee(r,n,t):Ee(r,n)).subscribe(o)})}function W(r,e){return y(function(t,n){var o=null,i=0,s=!1,a=function(){return s&&!o&&n.complete()};t.subscribe(_(n,function(l){o?.unsubscribe();var c=0,u=i++;j(r(l,u)).subscribe(o=_(n,function(p){return n.next(e?e(l,p,u,c++):p)},function(){o=null,a()}))},function(){s=!0,a()}))})}function We(r){return y(function(e,t){j(r).subscribe(_(t,function(){return t.complete()},ue)),!t.closed&&e.subscribe(t)})}function Mt(r,e){return e===void 0&&(e=!1),y(function(t,n){var o=0;t.subscribe(_(n,function(i){var s=r(i,o++);(s||e)&&n.next(i),!s&&n.complete()}))})}function $e(r,e,t){var n=b(r)||e||t?{next:r,error:e,complete:t}:r;return n?y(function(o,i){var s;(s=n.subscribe)===null||s===void 0||s.call(n);var a=!0;o.subscribe(_(i,function(l){var c;(c=n.next)===null||c===void 0||c.call(n,l),i.next(l)},function(){var l;a=!1,(l=n.complete)===null||l===void 0||l.call(n),i.complete()},function(l){var c;a=!1,(c=n.error)===null||c===void 0||c.call(n,l),i.error(l)},function(){var l,c;a&&((l=n.unsubscribe)===null||l===void 0||l.call(n)),(c=n.finalize)===null||c===void 0||c.call(n)}))}):ee}function Un(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=gr(r);return y(function(n,o){for(var i=r.length,s=new Array(i),a=r.map(function(){return!1}),l=!1,c=function(p){j(r[p]).subscribe(_(o,function(f){s[p]=f,!l&&!a[p]&&(a[p]=!0,(l=a.every(ee))&&(a=null))},ue))},u=0;u<i;u++)c(u);n.subscribe(_(o,function(p){if(l){var f=z([p],H(s));o.next(t?t.apply(void 0,z([],H(f))):f)}}))})}var Ba=["limit-reached","cap-reached","agent-unavailable","session-expired","credential-expired","aborted","internal","attachments-off","attachments-unsupported","attachment-invalid","attachment-too-large","attachment-limit","attachment-missing","attachment-not-uploaded"],R=class extends Error{constructor(t,n,o){super(t);this.code=n;this.status=o;this.name="LambforgeError"}};function Lt(r,e){let t=r?.[0]??{},n=String(t.message??"Request failed"),o=n.match(/^([a-z-]+):/)?.[1];return o&&Ba.includes(o)?new R(n,o,e):n==="session-expired"?new R(n,"session-expired",e):t.extensions?.code==="UNAUTHENTICATED"||/not authorized|unauthorized|invalid sign-in token/i.test(n)?new R(n,"unauthorized",e):new R(n,"bad-request",e)}var Rr=["image/png","image/jpeg","image/webp","image/gif","application/pdf","text/plain","text/csv","text/markdown","application/json","application/yaml"],jr=1024*1024,ct={imageBytes:5*jr,pdfBytes:10*jr,textBytes:1*jr,perMessage:5,bytesPerMessage:15*jr},Va={png:"image/png",jpg:"image/jpeg",jpeg:"image/jpeg",webp:"image/webp",gif:"image/gif",pdf:"application/pdf",txt:"text/plain",csv:"text/csv",md:"text/markdown",markdown:"text/markdown",json:"application/json",yaml:"application/yaml",yml:"application/yaml"},Mr=r=>Va[String(r??"").split(".").pop()?.toLowerCase()??""];function Fn(r){if(r.length>ct.perMessage)return"attachment-limit";let e=0;for(let t of r){let n=t.type||Mr(t.name);if(!n||!Rr.includes(n))return"attachment-invalid";let o=n.startsWith("image/")?ct.imageBytes:n==="application/pdf"?ct.pdfBytes:ct.textBytes;if(t.size>o)return"attachment-too-large";e+=t.size}return e>ct.bytesPerMessage?"attachment-limit":null}var Ya=r=>typeof Blob<"u"&&r instanceof Blob,Ga=r=>{let e=r.replace(/^data:[^,]*;base64,/,""),t=globalThis.Buffer;if(t)return new Uint8Array(t.from(e,"base64"));let n=atob(e),o=new Uint8Array(n.length);for(let i=0;i<n.length;i++)o[i]=n.charCodeAt(i);return o};function ri(r){if(Ya(r))return{body:r,size:r.size,type:r.type||void 0};if(typeof r=="string"){let e=Ga(r),t=r.match(/^data:([^;,]+)[;,]/)?.[1];return{body:e,size:e.byteLength,type:t}}if(r instanceof ArrayBuffer)return{body:new Uint8Array(r),size:r.byteLength};if(r instanceof Uint8Array)return{body:r,size:r.byteLength};throw new R("Attachment data must be a Blob, File, ArrayBuffer, Uint8Array / Buffer or base64 string","bad-request")}function ni(r,e,t,n){return Ce(()=>{let o=n??globalThis.fetch;if(!o)throw new R("No fetch available","network");return o(r.uploadUrl,{method:r.method||"PUT",headers:{"Content-Type":r.contentType},body:e.body})}).pipe(P(o=>{if(o.status<200||o.status>=300)throw new R(`Uploading ${t} failed (${o.status})`,"network",o.status);return r}))}var Ut=`id name type description instructions tools isActive modelName mcpLambdaId mcpLambdaName createdAt updatedAt
33
+ embed { published identity allowedOrigins welcome suggestions showToolDetails maxMessagesPerConversation maxMessageLength allowAttachments allowFeedback retentionDays publishedAt }`,ai="id name description welcome suggestions allowAttachments allowFeedback",Dn=`token expiresAt agents { ${ai} }`,oi="id agentId title messageCount lastSeq answering lastMessageAt createdAt",Ja="id role text attachments { id name mimeType size } toolCalls { name status } feedback { rating comment } createdAt",ii="conversationId seq type runId data createdAt",Ft="id projectId name title description instructions examples projectDefault knowledge version usedBy updatedAt",si="id name title description builtIn items usedByAgents usedBySkills updatedAt",Za="id collection title text label updatedAt",re={listAgents:`query ($projectId: String!) { listProjectAgents(projectId: $projectId) { ${Ut} } }`,getAgent:`query ($id: String!) { getProjectAgent(id: $id) { ${Ut} } }`,createAgent:`mutation ($projectId: String!, $payload: CreateProjectAgentInput!) { createProjectAgent(projectId: $projectId, payload: $payload) { ${Ut} } }`,updateAgent:`mutation ($id: String!, $payload: UpdateProjectAgentInput!) { updateProjectAgent(id: $id, payload: $payload) { ${Ut} } }`,deleteAgent:"mutation ($id: String!) { deleteProjectAgent(id: $id) }",updateEmbed:`mutation ($agentId: String!, $embed: AgentEmbedInput!) { updateAgentEmbed(agentId: $agentId, embed: $embed) { ${Ut} } }`,createSession:`mutation ($subject: String!, $agents: [String], $claims: JSON, $ttlSeconds: Int, $origin: String) { createAgentSession(subject: $subject, agents: $agents, claims: $claims, ttlSeconds: $ttlSeconds, origin: $origin) { ${Dn} } }`,exchangeSession:`mutation ($projectId: String!, $token: String!, $agents: [String]) { exchangeAgentSession(projectId: $projectId, token: $token, agents: $agents) { ${Dn} } }`,anonymousSession:`mutation ($deviceId: String!, $turnstileToken: String!, $agents: [String]) { createAnonymousAgentSession(deviceId: $deviceId, turnstileToken: $turnstileToken, agents: $agents) { ${Dn} } }`,sessionAgents:`query { sessionAgents { ${ai} } }`,conversations:`query ($agent: String) { agentConversations(agent: $agent) { ${oi} } }`,conversation:`query ($id: String!) { agentConversation(id: $id) { ${oi} messages { ${Ja} } } }`,events:`query ($conversationId: String!, $afterSeq: Int) { agentConversationEvents(conversationId: $conversationId, afterSeq: $afterSeq) { ${ii} } }`,send:"mutation ($agent: String!, $conversationId: String, $text: String!, $credential: String, $attachments: [String!]) { sendAgentMessage(agent: $agent, conversationId: $conversationId, text: $text, credential: $credential, attachments: $attachments) { conversationId runId seq } }",uploadAttachment:"mutation ($agent: String!, $name: String!, $mimeType: String!, $size: Int!) { createAgentAttachmentUpload(agent: $agent, name: $name, mimeType: $mimeType, size: $size) { id uploadUrl method contentType expiresAt maxBytes } }",rate:"mutation ($conversationId: String!, $messageId: String!, $rating: String, $comment: String) { rateAgentMessage(conversationId: $conversationId, messageId: $messageId, rating: $rating, comment: $comment) }",abort:"mutation ($conversationId: String!) { abortAgentRun(conversationId: $conversationId) }",liveEvents:`subscription ($conversationId: String!) { agentEvents(conversationId: $conversationId) { ${ii} } }`,skills:`query ($projectId: String!) { projectSkills(projectId: $projectId) { ${Ft} } }`,skill:`query ($id: String!) { projectSkill(id: $id) { ${Ft} } }`,skillVersions:"query ($id: String!) { projectSkillVersions(id: $id) { id skillId name title description instructions examples projectDefault knowledge version createdAt } }",createSkill:`mutation ($projectId: String!, $skill: SkillInput!) { createProjectSkill(projectId: $projectId, skill: $skill) { ${Ft} } }`,updateSkill:`mutation ($id: String!, $skill: SkillInput!) { updateProjectSkill(id: $id, skill: $skill) { ${Ft} } }`,restoreSkill:`mutation ($id: String!, $version: Int!) { restoreProjectSkillVersion(id: $id, version: $version) { ${Ft} } }`,deleteSkill:"mutation ($id: String!) { deleteProjectSkill(id: $id) }",setAgentSkills:"mutation ($agentId: String!, $skills: [AgentSkillInput!]!, $useProjectSkills: Boolean) { setAgentSkills(agentId: $agentId, skills: $skills, useProjectSkills: $useProjectSkills) }",collections:`query ($projectId: String!) { knowledgeCollections(projectId: $projectId) { ${si} } }`,createCollection:`mutation ($projectId: String!, $collection: KnowledgeCollectionInput!) { createKnowledgeCollection(projectId: $projectId, collection: $collection) { ${si} } }`,updateCollection:"mutation ($projectId: String!, $name: String!, $collection: KnowledgeCollectionInput!) { updateKnowledgeCollection(projectId: $projectId, name: $name, collection: $collection) }",deleteCollection:"mutation ($projectId: String!, $name: String!) { deleteKnowledgeCollection(projectId: $projectId, name: $name) }",items:`query ($projectId: String!, $collection: String!) { knowledgeItems(projectId: $projectId, collection: $collection) { ${Za} } }`,addItems:"mutation ($projectId: String!, $collection: String!, $items: [KnowledgeItemInput!]!) { addKnowledgeItems(projectId: $projectId, collection: $collection, items: $items) }",syncItems:"mutation ($projectId: String!, $collection: String!, $items: [KnowledgeItemInput!]!, $prune: Boolean) { syncKnowledgeItems(projectId: $projectId, collection: $collection, items: $items, prune: $prune) { added updated removed unchanged } }",updateItem:"mutation ($projectId: String!, $id: String!, $item: KnowledgeItemInput!) { updateKnowledgeItem(projectId: $projectId, id: $id, item: $item) }",deleteItem:"mutation ($projectId: String!, $id: String!) { deleteKnowledgeItem(projectId: $projectId, id: $id) }",search:"query ($projectId: String!, $query: String!, $collections: [String!]!, $limit: Int) { searchKnowledge(projectId: $projectId, query: $query, collections: $collections, limit: $limit) { id collection title text score } }",setAgentKnowledge:"mutation ($agentId: String!, $collections: [String!]!) { setAgentKnowledge(agentId: $agentId, collections: $collections) }"};var Lr="https://api.lambforge.com",Xa=r=>`${r.replace(/\/+$/,"")}/graphql`,li=r=>`${r.replace(/\/+$/,"").replace(/^http/,"ws")}/subscriptions`;function Dt(r,e,t,n,o){return new $(i=>{let s=new AbortController,a=r.fetch??globalThis.fetch;if(!a){i.error(new R("No fetch available","network"));return}return a(Xa(r.url),{method:"POST",headers:{"content-type":"application/json",...e?{authorization:e}:{}},body:JSON.stringify({query:t,variables:n}),signal:s.signal}).then(async l=>{let c;try{c=await l.json()}catch{throw new R(`Lambforge answered ${l.status}`,l.status===401?"unauthorized":"network",l.status)}if(c.errors?.length)throw Lt(c.errors,l.status);if(!c.data||!(o in c.data))throw new R(`Lambforge answered ${l.status} without ${o}`,"network",l.status);i.next(c.data[o]),i.complete()}).catch(l=>{s.signal.aborted||i.error(l instanceof R?l:new R(String(l?.message??l),"network"))}),()=>s.abort()})}var ci=["graphql-ws","graphql-transport-ws"];function ui(r){return new $(e=>{let n=!1,o=new r.WebSocket(r.url,ci),i=()=>o.protocol==="graphql-transport-ws",s=l=>{o.readyState===1&&o.send(JSON.stringify(l))},a=l=>{if(!n){n=!0,e.error(l);try{o.close(1e3)}catch{}}};return o.onopen=()=>s({type:"connection_init",payload:r.connectionParams}),o.onmessage=l=>{let c;try{c=JSON.parse(String(l.data))}catch{return}switch(c.type){case"connection_ack":s({id:"1",type:i()?"subscribe":"start",payload:{query:r.query,variables:r.variables}}),r.onStarted?.();return;case"ping":s({type:"pong"});return;case"next":case"data":{let u=c.payload;if(u?.errors?.length){a(Lt(u.errors));return}u?.data&&e.next(u.data[r.field]);return}case"error":a(Lt(Array.isArray(c.payload)?c.payload:[c.payload]));return;case"connection_error":a(new R(String(c.payload?.message??"connection refused"),"unauthorized"));return;case"complete":if(n)return;n=!0,e.complete(),o.close(1e3);return;default:return}},o.onclose=l=>{if(n)return;let c=l?.code===4401||l?.code===4403;a(new R(`connection closed${l?.code?` (${l.code}${l.reason?` ${l.reason}`:""})`:""}`,c?"unauthorized":"network"))},o.onerror=()=>{},()=>{n||(n=!0,s({id:"1",type:i()?"complete":"stop"})),o.onmessage=o.onclose=o.onerror=o.onopen=null;try{o.close(1e3)}catch{}}})}var Ur=r=>Ce(()=>{let e=r();return Pt(e)?e.pipe(He(1)):V(Promise.resolve(e))}),Qa=6e4,pi="lambforge.agents.device",el=15e3,Ke=class{constructor(e){this.options=e;this.current=null;this.pending$=null;if([e.getToken,e.exchange,e.anonymous].filter(Boolean).length!==1)throw new R("AgentClient: give exactly one of getToken, exchange or anonymous","bad-request");if(e.anonymous&&!e.anonymous.publishableKey.startsWith("lfp_"))throw new R("AgentClient: anonymous visitors need a publishable key (lfp_...)","bad-request");this.endpoint={url:e.url??Lr,fetch:e.fetch}}token$(){return this.current&&Date.now()<this.current.renewAt?O(this.current.token):(this.pending$||(this.pending$=this.session$().pipe($e(e=>{let t=e.expiresAt?Date.parse(e.expiresAt):NaN;this.current={token:e.token,renewAt:Number.isFinite(t)?Math.max(Date.now()+3e4,t-Qa):Date.now()+50*6e4}}),P(e=>e.token),jt(()=>this.pending$=null),lt(1))),this.pending$)}invalidate(){this.current=null}credential$(){let e=this.options,t=e.credential===!1?null:e.credential??(e.exchange?e.exchange.idToken:null);return t?Ur(t).pipe(P(n=>n||void 0)):O(void 0)}session$(){let e=this.options;if(e.getToken)return Ur(e.getToken).pipe(P(n=>typeof n=="string"?{token:n}:n));if(e.exchange){let{projectId:n,idToken:o,agents:i}=e.exchange;return Ur(o).pipe(W(s=>Dt(this.endpoint,null,re.exchangeSession,{projectId:n,token:s,agents:i},"exchangeAgentSession")))}let t=e.anonymous;return Ur(t.turnstileToken).pipe(W(n=>Dt(this.endpoint,t.publishableKey,re.anonymousSession,{deviceId:t.deviceId??di(),turnstileToken:n,agents:t.agents},"createAnonymousAgentSession")))}call$(e,t,n){let o=()=>this.token$().pipe(W(i=>Dt(this.endpoint,i,e,t,n)));return o().pipe(G(i=>i?.code!=="session-expired"&&i?.code!=="unauthorized"?at(()=>i):(this.invalidate(),o())))}uploadAttachment(e,t){return Ce(()=>{let n=ri(t.data),o=t.mimeType||n.type||Mr(t.name);if(!o)throw new R(`Attachment ${t.name}: give its mimeType`,"bad-request");return this.call$(re.uploadAttachment,{agent:e,name:t.name,mimeType:o,size:n.size},"createAgentAttachmentUpload").pipe(W(i=>ni(i,n,t.name,this.options.fetch)))})}agents(){return this.call$(re.sessionAgents,{},"sessionAgents")}conversations(e){return this.call$(re.conversations,{agent:e},"agentConversations")}agent(e){return{conversation:t=>new Fr(this,e,t??null),conversations:()=>this.conversations(e)}}events(e,t=0){return new $(n=>{let o=t,i=new Map,s=new Q,a=!1,l=!1,c=()=>{for(;i.has(o+1);){let m=i.get(o+1);i.delete(o+1),o=m.seq,n.next(m)}},u=m=>{if(m){if(m.type==="delta"){n.next(m);return}m.seq<=o||(i.set(m.seq,m),c(),i.size&&p())}},p=()=>{if(a){l=!0;return}a=!0,s.add(this.call$(re.events,{conversationId:e,afterSeq:o},"agentConversationEvents").subscribe({next:m=>{m.forEach(w=>i.set(w.seq,w)),c(),i.size&&!m.length&&(o=Math.min(...i.keys())-1,c())},error:m=>{a=!1,n.error(m)},complete:()=>{a=!1,l&&(l=!1,p())}}))},f=this.webSocket();if(!f)return p(),s.add(Ir(this.options.pollIntervalMs??1500,this.options.pollIntervalMs??1500).subscribe(()=>p())),s;let d=0,g=!1,h=()=>{s.add(this.token$().pipe(W(m=>ui({url:li(this.endpoint.url),WebSocket:f,connectionParams:{agentSession:m},query:re.liveEvents,variables:{conversationId:e},field:"agentEvents",onStarted:()=>{d=0,g=!1,p()}}))).subscribe({next:u,error:m=>{if(m?.code==="unauthorized"&&!g){g=!0,this.invalidate(),h();return}if(m?.code!=="network"){n.error(m);return}let w=Math.min(el,1e3*2**d++);s.add(Ir(w*(.75+Math.random()/2)).subscribe(h))},complete:()=>n.complete()}))};return h(),s})}webSocket(){return this.options.WebSocket===!1?null:this.options.WebSocket??(globalThis.WebSocket||null)}},Fr=class{constructor(e,t,n){this.client=e;this.agent=t;this.id=n}send(e,t={}){let n=t.credential!==void 0?O(t.credential):this.client.credential$();return(t.attachments?.length?V(t.attachments).pipe(qe(i=>this.client.uploadAttachment(this.agent,i)),P(i=>i.id),On()):O([])).pipe(W(i=>n.pipe(P(s=>({credential:s,attachments:[...t.attachmentIds??[],...i]})))),W(({credential:i,attachments:s})=>this.client.call$(re.send,{agent:this.agent,conversationId:this.id,text:e,credential:i,...s.length?{attachments:s}:{}},"sendAgentMessage"))).pipe($e(i=>this.id=i.conversationId),W(i=>this.client.events(i.conversationId,Math.max(0,i.seq-2)).pipe(Mt(s=>!((s.type==="done"||s.type==="error")&&s.runId===i.runId),!0))))}events(e){return this.id?e===void 0?this.history().pipe(W(t=>this.client.events(this.id,t.lastSeq??0))):this.client.events(this.id,e):at(()=>new R("No conversation yet - send a message first","bad-request"))}history(){return this.id?this.client.call$(re.conversation,{id:this.id},"agentConversation"):at(()=>new R("No conversation yet - send a message first","bad-request"))}rate(e,t,n){return this.id?this.client.call$(re.rate,{conversationId:this.id,messageId:e,rating:t,...t==="down"&&n?{comment:n}:{}},"rateAgentMessage"):at(()=>new R("No conversation yet - send a message first","bad-request"))}abort(){return this.id?this.client.call$(re.abort,{conversationId:this.id},"abortAgentRun"):O(!1)}};function di(){let r=globalThis.localStorage;try{let t=r?.getItem(pi);if(t&&/^[A-Za-z0-9_-]{16,128}$/.test(t))return t}catch{}let e=globalThis.crypto.randomUUID().replace(/-/g,"");try{r?.setItem(pi,e)}catch{}return e}var ma=yn(Gs()),v=yn(Xt());var ae=yn(Xt()),bc=/^(https?:|mailto:)/i,po=/^\s*[-*+]\s+/,tn=/^\s*\d+[.)]\s+/,yc=/^```\s*([\w+-]*)\s*$/,Js=/^(#{1,6})\s+(.*)$/;function er(r){let e=[],t=String(r??"").replace(/\r\n?/g,`
34
34
  `).split(`
35
- `),n=0;for(;n<t.length;){let o=t[n],i=o.match(dc);if(i){let l=[];for(n++;n<t.length&&!/^```\s*$/.test(t[n]);)l.push(t[n++]);n++,e.push(se.html`<pre><code data-lang=${i[1]||""}>${l.join(`
36
- `)}</code></pre>`);continue}let s=o.match(Bs);if(s){e.push(se.html`<p><strong class="h">${Ze(s[2])}</strong></p>`),n++;continue}if(ao.test(o)||Xr.test(o)){let l=Xr.test(o),c=l?Xr:ao,u=[];for(;n<t.length&&c.test(t[n]);)u.push(se.html`<li>${Ze(t[n++].replace(c,""))}</li>`);e.push(l?se.html`<ol>${u}</ol>`:se.html`<ul>${u}</ul>`);continue}if(!o.trim()){n++;continue}let a=[];for(;n<t.length&&t[n].trim()&&!/^```/.test(t[n])&&!Bs.test(t[n])&&!ao.test(t[n])&&!Xr.test(t[n]);)a.push(t[n++]);e.push(se.html`<p>${a.map((l,c)=>c?se.html`<br />${Ze(l)}`:Ze(l))}</p>`)}return e}var hc=/(`[^`]+`)|(\*\*[^*]+\*\*)|(__[^_]+__)|(\*[^*\s][^*]*\*)|(\[[^\]]+\]\([^)\s]+\))|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"])/;function Ze(r){let e=[],t=r;for(;t;){let n=t.match(hc);if(!n||n.index===void 0){e.push(t);break}n.index&&e.push(t.slice(0,n.index));let o=n[0];if(n[1])e.push(se.html`<code>${o.slice(1,-1)}</code>`);else if(n[2]||n[3])e.push(se.html`<strong>${Ze(o.slice(2,-2))}</strong>`);else if(n[4])e.push(se.html`<em>${Ze(o.slice(1,-1))}</em>`);else if(n[5]){let[,i,s]=o.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/)??[];e.push(Vs(i,s))}else e.push(Vs(o,o));t=t.slice(n.index+o.length)}return e}function Vs(r,e){return fc.test(e)?se.html`<a href=${e} target="_blank" rel="noopener noreferrer nofollow">${r}</a>`:r}var bt=function(){return bt=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o])}return r},bt.apply(this,arguments)};function K(r,e){if(typeof e=="function")return Zt(r,function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return bt(bt({},e.apply(void 0,n)),{type:r})});var t=e?e._as:"empty";switch(t){case"empty":return Zt(r,function(){return{type:r}});case"fsa":return Zt(r,function(n,o){return n instanceof Error?{error:!0,meta:o,payload:n,type:r}:{error:!1,meta:o,payload:n,type:r}});case"payload":return Zt(r,function(n){return{payload:n,type:r}});case"props":return Zt(r,function(n){return bt(bt({},n),{type:r})});default:throw new Error("Unexpected config.")}}function te(){return{_as:"payload",_p:void 0}}function Zt(r,e){return Object.defineProperty(e,"type",{value:r,writable:!1})}var mc=function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),o=0,e=0;e<t;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n};function Y(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=r.pop(),n=r.reduce(function(o,i){return mc(o,[i.type])},[]);return{reducer:t,types:n}}function Ks(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=new Map,o=0,i=e;o<i.length;o++)for(var s=i[o],a=0,l=s.types;a<l.length;a++){var c=l[a];n.has(c)?console.warn(c+" already specified in an 'on' call."):n.set(c,s.reducer)}return function(u,p){u===void 0&&(u=r);var d=n.get(p.type);return d?d(u,p):u}}var Qr=K("[chat] shown",te()),en=K("[chat] connecting"),xt=K("[chat] failed",te()),Xt=K("[chat] verifying",te()),Qt=K("[chat] agents loaded",te()),Xe=K("[chat] pick agent",te()),tn=K("[chat] history loaded",te()),wt=K("[chat] new conversation"),_t=K("[chat] send",te()),rn=K("[chat] add files",te()),nn=K("[chat] remove file",te()),lo=K("[chat] resume",te()),on=K("[chat] event",te()),sn=K("[chat] run ended"),Qe=K("[chat] stop",te());var er;(function(r){r.switchMap="switchMap",r.mergeMap="mergeMap",r.concatMap="concatMap",r.exhaustMap="exhaustMap"})(er||(er={}));var Ys=r=>r!==null&&typeof r=="object";var Gs=r=>r.reduce((e,t)=>(...n)=>e(t(...n))),et=wn(Z(r=>R(r))),an=r=>r.pipe(et),ln=r=>Ot(r)?r:r instanceof Promise?B(r):R(r);function Js([r,e,t]){function n(o,i){return t.length>0?Gs(t)(e)(o,i):e(o,i)}return kn(n,r)}var Zs={switchMap:H,mergeMap:ne,concatMap:qe,exhaustMap:Or};function Xs(r={},e={},t){var n;let o=r&&r.reducer$&&r.reducer$.pipe(et)||R((m,w)=>m),i=new re,s=m=>Ce(r&&r.actionStream$&&r.actionStream$.pipe(et)||ue,t).pipe(ve(Ys),P(ln),u(an),_e(i),m,P(ln)),a=(r&&r.initialState$&&r.initialState$.pipe(et)||R({})).pipe(Pt()),l=r&&r.middleware$&&r.middleware$.pipe(et)||R([]),c=((n=r?.destroy$)===null||n===void 0?void 0:n.pipe(et))||En,u=Zs[e&&e.actionFlatOp||er.concatMap],p=Zs[e&&e.stateFlatOp||er.switchMap],d=m=>m.pipe(p(an),P(ln),p(an)),f=e&&e.bufferSize||1,v=e&&e.windowTime;return{reducer$:o,actions$:i,actionStream$:s,initialState$:a,middleware$:l,destroy$:c,flattenState$:d,shareReplayConfig:{refCount:!1,bufferSize:f,windowTime:v}}}var co="@@redux-devtools/JUMP_TO_STATE";function Qs(r){if(!r)return;let e=r===!0?{}:r;return e.enabled===!1?void 0:e}function ea(r){return(e,t)=>t?.type===co?t.state:r(e,t)}function ta(r,e={}){var t,n;let o=globalThis.__REDUX_DEVTOOLS_EXTENSION__;if(e.enabled===!1||!o)return()=>{};let i=o.connect(Object.assign({name:(t=e.name)!==null&&t!==void 0?t:"RxDI Store",maxAge:(n=e.maxAge)!==null&&n!==void 0?n:50},e.extensionOptions)),s=new X,a;s.add(r.state$.subscribe(c=>{a=c})),i.init(a),s.add(r.state$.pipe(Rn(r.actions$),ve(([,c])=>c.type!==co)).subscribe(([c,u])=>i.send(u,c)));let l=i.subscribe(c=>{var u;if(c.type!=="DISPATCH")return;let p=(u=c.payload)===null||u===void 0?void 0:u.type;(p==="JUMP_TO_ACTION"||p==="JUMP_TO_STATE")&&c.state?r.dispatch({type:co,state:JSON.parse(c.state)}):p==="COMMIT"&&i.init(a)});return()=>{var c;s.unsubscribe(),typeof l=="function"&&l(),(c=i.unsubscribe)===null||c===void 0||c.call(i)}}var cn=class{constructor(e,t){var n,o,i,s;this.config=e,this.options=t,this._dispatch$=new re,this.dispatch=m=>{this._dispatch$.next(m)};let a=Qs((n=this.config)===null||n===void 0?void 0:n.devTools);a&&(this.config=Object.assign(Object.assign({},this.config),{reducer$:((i=(o=this.config)===null||o===void 0?void 0:o.reducer$)!==null&&i!==void 0?i:R(m=>m)).pipe(P(m=>ea(m)))}));let{reducer$:l,actions$:c,actionStream$:u,middleware$:p,initialState$:d,destroy$:f,flattenState$:v,shareReplayConfig:h}=Xs(this.config,this.options,this._dispatch$);if(this.state$=Sn([d,l,p]).pipe(P(Js),qe(u),In(d),v,He(f),it(h)),this.state$.subscribe(),this.actions$=c.pipe(it(h)),!((s=this.config)===null||s===void 0)&&s.epic$&&this.config.epic$(this.actions$,this.state$).pipe(He(f)).subscribe({next:m=>this.dispatch(m),error:m=>console.error("[Epic] Error:",m)}),a){let m=ta(this,a);f.subscribe(()=>m())}}};function uo(r={},e={}){return new cn(r,e)}function Me(...r){let e=new Set(r.map(t=>t.type));return t=>t.pipe(ve(n=>e.has(n.type)))}function $t(r={dispatch:!0}){return e=>(t,n)=>{let o=e(t,n);return r.dispatch===!1?o.pipe(ot(),Z(i=>(console.error("[Effect] Error:",i),R()))):o.pipe(Z(i=>(console.error("[Effect] Error:",i),R())))}}function ra(...r){return(e,t)=>Ce(...r.map(n=>n(e,t)))}var vc=r=>r?.code||"internal",po=r=>R(xt(vc(r)));function gc(r,e){let t=e.agents.length?r.filter(o=>e.agents.includes(o.id)||e.agents.includes(o.name)):r,n=t.find(o=>o.id===e.agent||o.name===e.agent)??t[0];return{agents:t,agentId:n?.id??null}}var un=class{constructor(e){this.ctx=e;this.connect$=$t()((e,t)=>t.pipe(ve(n=>n.shown),ze(1),H(()=>{let n=this.ctx.client;return n?Se(R(en()),n.agents().pipe(ze(1),P(o=>Qt(gc(o,this.ctx))),Z(po))):R(xt("unauthorized"))})));this.select$=$t()(e=>Ce(e.pipe(Me(Qt),P(({payload:t})=>t.agentId)),e.pipe(Me(Xe),P(({payload:t})=>t))).pipe(ve(t=>!!t),H(t=>{let n=this.ctx.client;return n.conversations(t).pipe(ze(1),H(o=>{let i=o?.[0];return i?n.agent(t).conversation(i.id).history().pipe(ne(s=>B([tn({agentId:t,detail:s}),...s.answering?[lo({agentId:t,conversationId:s.id,afterSeq:s.lastSeq??0})]:[]]))):ue}),Z(po))})));this.run$=$t()(e=>Ce(e.pipe(Me(_t),P(({payload:t})=>{let{agentId:n,conversationId:o,text:i,files:s}=t,a=this.conversation(n,o),l=(s??[]).map(c=>({name:c.name,mimeType:c.type||void 0,data:c}));return{c:a,events:l.length?a.send(i,{attachments:l}):a.send(i)}})),e.pipe(Me(lo),P(({payload:t})=>{let{agentId:n,conversationId:o,afterSeq:i}=t,s=this.conversation(n,o);return{c:s,events:s.events(i)}}))).pipe(H(({c:t,events:n})=>this.follow$(t,n).pipe(He(e.pipe(Me(Qe,Xe,wt))),On(sn())))));this.abort$=$t()(e=>e.pipe(Me(Qe),ne(({payload:t})=>{let{agentId:n,conversationId:o}=t;return!o||!this.ctx.client?ue:this.conversation(n,o).abort().pipe(ot(),Z(()=>ue))})));this.failures$=$t()(e=>e.pipe(Me(xt),_e(({payload:t})=>this.ctx.emit("error",{code:t})),ot()))}conversation(e,t){return this.ctx.client.agent(e).conversation(t??void 0)}follow$(e,t){let n=new Set;return t.pipe(It(o=>o.type!=="done"&&o.type!=="error",!0),_e(o=>{o.type==="message"&&o.data?.role==="assistant"&&!n.has(o.data.id)&&(n.add(o.data.id),this.ctx.emit("answer",{text:o.data.text,agent:e.agent,conversationId:o.conversationId})),o.type==="error"&&this.ctx.emit("error",{code:o.data?.code??"internal"})}),P(o=>on(o)),Z(po))}};var pn={shown:!1,agents:[],agentId:null,conversationId:null,messages:[],answering:!1,live:null,notice:null,files:[]};function fo(r){let e=(r.toolCalls??[]).map(t=>t?.name).filter(t=>!!t);return{id:r.id,role:r.role,text:r.text??"",tools:Array.from(new Set(e)),attachments:(r.attachments??[]).map(t=>t.name)}}var yc=/^local:/,na={conversationId:null,messages:[],answering:!1,live:null,notice:null,files:[]},oa=Ks(pn,Y(Qr,(r,{payload:e})=>r.shown||!e?r:{...r,shown:!0}),Y(en,r=>({...r,notice:{kind:"busy",what:"connecting"}})),Y(xt,(r,{payload:e})=>({...r,answering:!1,live:null,notice:{kind:"error",code:e}})),Y(Xt,(r,{payload:e})=>({...r,notice:e?{kind:"busy",what:"verifying"}:r.notice?.kind==="busy"&&r.notice.what==="verifying"?null:r.notice})),Y(Qt,(r,{payload:e})=>({...r,agents:e.agents,agentId:e.agentId,notice:e.agentId?null:{kind:"error",code:"agent-unavailable"}})),Y(Xe,(r,{payload:e})=>({...r,...na,agentId:e})),Y(tn,(r,{payload:e})=>e.agentId!==r.agentId?r:{...r,conversationId:e.detail.id,messages:(e.detail.messages??[]).map(fo),answering:!!e.detail.answering,live:null,notice:e.detail.answering?{kind:"busy",what:"thinking"}:null}),Y(wt,r=>({...r,...na})),Y(_t,(r,{payload:e})=>({...r,messages:[...r.messages,{id:`local:${r.messages.length}`,role:"user",text:e.text,tools:[],attachments:(e.files??[]).map(t=>t.name)}],files:[],answering:!0,notice:{kind:"busy",what:"thinking"}})),Y(rn,(r,{payload:e})=>{if(!r.agents.find(i=>i.id===r.agentId)?.allowAttachments)return{...r,notice:{kind:"error",code:"attachments-off"}};let n=[...r.files,...e],o=Mn(n);return o?{...r,notice:{kind:"error",code:o}}:{...r,files:n,notice:r.notice?.kind==="error"?null:r.notice}}),Y(nn,(r,{payload:e})=>({...r,files:r.files.filter((t,n)=>n!==e),notice:r.notice?.kind==="error"?null:r.notice})),Y(on,(r,{payload:e})=>bc(r,e)),Y(sn,r=>({...r,answering:!1,live:null,notice:r.notice?.kind==="busy"?null:r.notice})),Y(Qe,r=>({...r,answering:!1,live:null,notice:{kind:"info",what:"stopped"}})));function bc(r,e){let t=r.conversationId??e.conversationId;if(e.conversationId!==t)return r;if(e.type==="error")return{...r,conversationId:t,live:null,notice:{kind:"error",code:e.data?.code??"internal"}};if(e.type==="delta")return xc({...r,conversationId:t},e);if(e.type!=="message"||!e.data?.id)return{...r,conversationId:t};let n=fo(e.data);if(r.messages.some(a=>a.id===n.id))return{...r,conversationId:t};let o=[...r.messages],i=n.role==="user"?o.findIndex(a=>yc.test(a.id)&&a.text===n.text):-1;i>=0?o[i]=n:o.push(n);let s=n.role==="assistant"?null:r.live;return{...r,conversationId:t,messages:o,live:s}}function xc(r,e){if(!r.answering||!e.runId)return r;let t=Number(e.data?.segment)||0,n=typeof e.data?.text=="string"?e.data.text:"",o=r.live?.runId===e.runId?r.live:null;return o&&t<o.segment||o&&t===o.segment&&n.length<o.text.length?r:{...r,live:{runId:e.runId,segment:t,text:n}}}var fn=class{constructor(e,t={}){this.destroy$=new re;let n=new un(e);this.store=uo({reducer$:R(oa),initialState$:R({...pn,...t}),epic$:ra(n.select$,n.run$,n.abort$,n.failures$,n.connect$),destroy$:this.destroy$}),this.state$=this.store.state$.pipe(Tn())}dispatch(e){this.store.dispatch(e)}destroy(){this.destroy$.next(),this.destroy$.complete()}};var ia={title:"Chat",open:"Open chat",close:"Close chat",newChat:"New conversation",placeholder:"Type a message",send:"Send",stop:"Stop",thinking:"Thinking",connecting:"Connecting",pickAgent:"Assistant",usedTools:"Used",verifying:"Checking that you are human",attach:"Attach files",attached:"Attached files",removeFile:"Remove",filesOnly:"Please look at the attached files.",errors:{"limit-reached":"This conversation is full - start a new one.","cap-reached":"The assistant is not available right now - try again later.","agent-unavailable":"This assistant is not available.","session-expired":"Your session ended - reload the page.","credential-expired":"Please sign in again.",aborted:"Stopped.",internal:"Something went wrong - try again.",unauthorized:"This chat is not allowed here.","bad-request":"That did not work - try again.",network:"No connection - try again.","attachments-off":"This assistant does not take files.","attachments-unsupported":"This assistant cannot read that kind of file.","attachment-invalid":"Only images, PDF and text files can be attached.","attachment-too-large":"That file is too large (images 5 MB, PDF 10 MB, text 1 MB).","attachment-limit":"At most 5 files and 15 MB in one message.","attachment-missing":"A file was lost - attach it again.","attachment-not-uploaded":"A file did not finish uploading - attach it again.",default:"Something went wrong - try again."}},wc={title:"\u0427\u0430\u0442",open:"\u041E\u0442\u0432\u043E\u0440\u0438 \u0447\u0430\u0442\u0430",close:"\u0417\u0430\u0442\u0432\u043E\u0440\u0438 \u0447\u0430\u0442\u0430",newChat:"\u041D\u043E\u0432 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440",placeholder:"\u041D\u0430\u043F\u0438\u0448\u0435\u0442\u0435 \u0441\u044A\u043E\u0431\u0449\u0435\u043D\u0438\u0435",send:"\u0418\u0437\u043F\u0440\u0430\u0442\u0438",stop:"\u0421\u043F\u0440\u0438",thinking:"\u041C\u0438\u0441\u043B\u044F",connecting:"\u0421\u0432\u044A\u0440\u0437\u0432\u0430\u043D\u0435",pickAgent:"\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442",usedTools:"\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u043D\u043E",verifying:"\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430, \u0447\u0435 \u0441\u0442\u0435 \u0447\u043E\u0432\u0435\u043A",attach:"\u041F\u0440\u0438\u043A\u0430\u0447\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u0435",attached:"\u041F\u0440\u0438\u043A\u0430\u0447\u0435\u043D\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u0435",removeFile:"\u041F\u0440\u0435\u043C\u0430\u0445\u043D\u0438",filesOnly:"\u041C\u043E\u043B\u044F, \u0440\u0430\u0437\u0433\u043B\u0435\u0434\u0430\u0439\u0442\u0435 \u043F\u0440\u0438\u043A\u0430\u0447\u0435\u043D\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u043E\u0432\u0435.",errors:{"limit-reached":"\u0420\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u044A\u0442 \u0435 \u043F\u044A\u043B\u0435\u043D - \u0437\u0430\u043F\u043E\u0447\u043D\u0435\u0442\u0435 \u043D\u043E\u0432.","cap-reached":"\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442\u044A\u0442 \u043D\u0435 \u0435 \u0434\u043E\u0441\u0442\u044A\u043F\u0435\u043D \u0432 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043F\u043E-\u043A\u044A\u0441\u043D\u043E.","agent-unavailable":"\u0422\u043E\u0437\u0438 \u0430\u0441\u0438\u0441\u0442\u0435\u043D\u0442 \u043D\u0435 \u0435 \u0434\u043E\u0441\u0442\u044A\u043F\u0435\u043D.","session-expired":"\u0421\u0435\u0441\u0438\u044F\u0442\u0430 \u0438\u0437\u0442\u0435\u0447\u0435 - \u043F\u0440\u0435\u0437\u0430\u0440\u0435\u0434\u0435\u0442\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430\u0442\u0430.","credential-expired":"\u041C\u043E\u043B\u044F, \u0432\u043B\u0435\u0437\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",aborted:"\u0421\u043F\u0440\u044F\u043D\u043E.",internal:"\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",unauthorized:"\u0422\u043E\u0437\u0438 \u0447\u0430\u0442 \u043D\u0435 \u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D \u0442\u0443\u043A.","bad-request":"\u041D\u0435 \u0441\u0435 \u043F\u043E\u043B\u0443\u0447\u0438 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",network:"\u041D\u044F\u043C\u0430 \u0432\u0440\u044A\u0437\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.","attachments-off":"\u0422\u043E\u0437\u0438 \u0430\u0441\u0438\u0441\u0442\u0435\u043D\u0442 \u043D\u0435 \u043F\u0440\u0438\u0435\u043C\u0430 \u0444\u0430\u0439\u043B\u043E\u0432\u0435.","attachments-unsupported":"\u0422\u043E\u0437\u0438 \u0430\u0441\u0438\u0441\u0442\u0435\u043D\u0442 \u043D\u0435 \u043C\u043E\u0436\u0435 \u0434\u0430 \u0447\u0435\u0442\u0435 \u0442\u0430\u043A\u044A\u0432 \u0444\u0430\u0439\u043B.","attachment-invalid":"\u041C\u043E\u0436\u0435 \u0434\u0430 \u043F\u0440\u0438\u043A\u0430\u0447\u0438\u0442\u0435 \u0441\u0430\u043C\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, PDF \u0438 \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u0435.","attachment-too-large":"\u0424\u0430\u0439\u043B\u044A\u0442 \u0435 \u0442\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C (\u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F 5 MB, PDF 10 MB, \u0442\u0435\u043A\u0441\u0442 1 MB).","attachment-limit":"\u041D\u0430\u0439-\u043C\u043D\u043E\u0433\u043E 5 \u0444\u0430\u0439\u043B\u0430 \u0438 15 MB \u0432 \u0435\u0434\u043D\u043E \u0441\u044A\u043E\u0431\u0449\u0435\u043D\u0438\u0435.","attachment-missing":"\u0424\u0430\u0439\u043B \u0441\u0435 \u0438\u0437\u0433\u0443\u0431\u0438 - \u043F\u0440\u0438\u043A\u0430\u0447\u0435\u0442\u0435 \u0433\u043E \u043E\u0442\u043D\u043E\u0432\u043E.","attachment-not-uploaded":"\u0424\u0430\u0439\u043B \u043D\u0435 \u0441\u0435 \u043A\u0430\u0447\u0438 \u0434\u043E\u043A\u0440\u0430\u0439 - \u043F\u0440\u0438\u043A\u0430\u0447\u0435\u0442\u0435 \u0433\u043E \u043E\u0442\u043D\u043E\u0432\u043E.",default:"\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E."}},sa={en:ia,bg:wc};function ho(r,e={}){let t=String(r||"en").toLowerCase().split("-")[0],n=sa[t]??ia;return{...n,...e,errors:{...n.errors,...e.errors??{}}}}var aa=`
35
+ `),n=0;for(;n<t.length;){let o=t[n],i=o.match(yc);if(i){let l=[];for(n++;n<t.length&&!/^```\s*$/.test(t[n]);)l.push(t[n++]);n++,e.push(ae.html`<pre><code data-lang=${i[1]||""}>${l.join(`
36
+ `)}</code></pre>`);continue}let s=o.match(Js);if(s){e.push(ae.html`<p><strong class="h">${Xe(s[2])}</strong></p>`),n++;continue}if(po.test(o)||tn.test(o)){let l=tn.test(o),c=l?tn:po,u=[];for(;n<t.length&&c.test(t[n]);)u.push(ae.html`<li>${Xe(t[n++].replace(c,""))}</li>`);e.push(l?ae.html`<ol>${u}</ol>`:ae.html`<ul>${u}</ul>`);continue}if(!o.trim()){n++;continue}let a=[];for(;n<t.length&&t[n].trim()&&!/^```/.test(t[n])&&!Js.test(t[n])&&!po.test(t[n])&&!tn.test(t[n]);)a.push(t[n++]);e.push(ae.html`<p>${a.map((l,c)=>c?ae.html`<br />${Xe(l)}`:Xe(l))}</p>`)}return e}var xc=/(`[^`]+`)|(\*\*[^*]+\*\*)|(__[^_]+__)|(\*[^*\s][^*]*\*)|(\[[^\]]+\]\([^)\s]+\))|(https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"])/;function Xe(r){let e=[],t=r;for(;t;){let n=t.match(xc);if(!n||n.index===void 0){e.push(t);break}n.index&&e.push(t.slice(0,n.index));let o=n[0];if(n[1])e.push(ae.html`<code>${o.slice(1,-1)}</code>`);else if(n[2]||n[3])e.push(ae.html`<strong>${Xe(o.slice(2,-2))}</strong>`);else if(n[4])e.push(ae.html`<em>${Xe(o.slice(1,-1))}</em>`);else if(n[5]){let[,i,s]=o.match(/^\[([^\]]+)\]\(([^)\s]+)\)$/)??[];e.push(Zs(i,s))}else e.push(Zs(o,o));t=t.slice(n.index+o.length)}return e}function Zs(r,e){return bc.test(e)?ae.html`<a href=${e} target="_blank" rel="noopener noreferrer nofollow">${r}</a>`:r}var $t=function(){return $t=Object.assign||function(r){for(var e,t=1,n=arguments.length;t<n;t++){e=arguments[t];for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o])}return r},$t.apply(this,arguments)};function N(r,e){if(typeof e=="function")return tr(r,function(){for(var n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return $t($t({},e.apply(void 0,n)),{type:r})});var t=e?e._as:"empty";switch(t){case"empty":return tr(r,function(){return{type:r}});case"fsa":return tr(r,function(n,o){return n instanceof Error?{error:!0,meta:o,payload:n,type:r}:{error:!1,meta:o,payload:n,type:r}});case"payload":return tr(r,function(n){return{payload:n,type:r}});case"props":return tr(r,function(n){return $t($t({},n),{type:r})});default:throw new Error("Unexpected config.")}}function J(){return{_as:"payload",_p:void 0}}function tr(r,e){return Object.defineProperty(e,"type",{value:r,writable:!1})}var wc=function(){for(var r=0,e=0,t=arguments.length;e<t;e++)r+=arguments[e].length;for(var n=Array(r),o=0,e=0;e<t;e++)for(var i=arguments[e],s=0,a=i.length;s<a;s++,o++)n[o]=i[s];return n};function B(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=r.pop(),n=r.reduce(function(o,i){return wc(o,[i.type])},[]);return{reducer:t,types:n}}function Xs(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var n=new Map,o=0,i=e;o<i.length;o++)for(var s=i[o],a=0,l=s.types;a<l.length;a++){var c=l[a];n.has(c)?console.warn(c+" already specified in an 'on' call."):n.set(c,s.reducer)}return function(u,p){u===void 0&&(u=r);var f=n.get(p.type);return f?f(u,p):u}}var rn=N("[chat] shown",J()),nn=N("[chat] connecting"),_t=N("[chat] failed",J()),rr=N("[chat] verifying",J()),nr=N("[chat] agents loaded",J()),Qe=N("[chat] pick agent",J()),on=N("[chat] history loaded",J()),St=N("[chat] new conversation"),At=N("[chat] send",J()),sn=N("[chat] add files",J()),an=N("[chat] remove file",J()),fo=N("[chat] resume",J()),ln=N("[chat] event",J()),cn=N("[chat] run ended"),et=N("[chat] stop",J()),Et=N("[chat] rate",J()),un=N("[chat] rate failed",J()),Ct=N("[chat] close comment");var or;(function(r){r.switchMap="switchMap",r.mergeMap="mergeMap",r.concatMap="concatMap",r.exhaustMap="exhaustMap"})(or||(or={}));var Qs=r=>r!==null&&typeof r=="object";var ea=r=>r.reduce((e,t)=>(...n)=>e(t(...n))),tt=An(G(r=>O(r))),pn=r=>r.pipe(tt),dn=r=>Pt(r)?r:r instanceof Promise?V(r):O(r);function ta([r,e,t]){function n(o,i){return t.length>0?ea(t)(e)(o,i):e(o,i)}return Rn(n,r)}var ra={switchMap:W,mergeMap:te,concatMap:qe,exhaustMap:Pr};function na(r={},e={},t){var n;let o=r&&r.reducer$&&r.reducer$.pipe(tt)||O((m,w)=>m),i=new oe,s=m=>ke(r&&r.actionStream$&&r.actionStream$.pipe(tt)||ie,t).pipe(ge(Qs),P(dn),u(pn),$e(i),m,P(dn)),a=(r&&r.initialState$&&r.initialState$.pipe(tt)||O({})).pipe(Rt()),l=r&&r.middleware$&&r.middleware$.pipe(tt)||O([]),c=((n=r?.destroy$)===null||n===void 0?void 0:n.pipe(tt))||In,u=ra[e&&e.actionFlatOp||or.concatMap],p=ra[e&&e.stateFlatOp||or.switchMap],f=m=>m.pipe(p(pn),P(dn),p(pn)),d=e&&e.bufferSize||1,g=e&&e.windowTime;return{reducer$:o,actions$:i,actionStream$:s,initialState$:a,middleware$:l,destroy$:c,flattenState$:f,shareReplayConfig:{refCount:!1,bufferSize:d,windowTime:g}}}var ho="@@redux-devtools/JUMP_TO_STATE";function oa(r){if(!r)return;let e=r===!0?{}:r;return e.enabled===!1?void 0:e}function ia(r){return(e,t)=>t?.type===ho?t.state:r(e,t)}function sa(r,e={}){var t,n;let o=globalThis.__REDUX_DEVTOOLS_EXTENSION__;if(e.enabled===!1||!o)return()=>{};let i=o.connect(Object.assign({name:(t=e.name)!==null&&t!==void 0?t:"RxDI Store",maxAge:(n=e.maxAge)!==null&&n!==void 0?n:50},e.extensionOptions)),s=new Q,a;s.add(r.state$.subscribe(c=>{a=c})),i.init(a),s.add(r.state$.pipe(Un(r.actions$),ge(([,c])=>c.type!==ho)).subscribe(([c,u])=>i.send(u,c)));let l=i.subscribe(c=>{var u;if(c.type!=="DISPATCH")return;let p=(u=c.payload)===null||u===void 0?void 0:u.type;(p==="JUMP_TO_ACTION"||p==="JUMP_TO_STATE")&&c.state?r.dispatch({type:ho,state:JSON.parse(c.state)}):p==="COMMIT"&&i.init(a)});return()=>{var c;s.unsubscribe(),typeof l=="function"&&l(),(c=i.unsubscribe)===null||c===void 0||c.call(i)}}var fn=class{constructor(e,t){var n,o,i,s;this.config=e,this.options=t,this._dispatch$=new oe,this.dispatch=m=>{this._dispatch$.next(m)};let a=oa((n=this.config)===null||n===void 0?void 0:n.devTools);a&&(this.config=Object.assign(Object.assign({},this.config),{reducer$:((i=(o=this.config)===null||o===void 0?void 0:o.reducer$)!==null&&i!==void 0?i:O(m=>m)).pipe(P(m=>ia(m)))}));let{reducer$:l,actions$:c,actionStream$:u,middleware$:p,initialState$:f,destroy$:d,flattenState$:g,shareReplayConfig:h}=na(this.config,this.options,this._dispatch$);if(this.state$=Tn([f,l,p]).pipe(P(ta),qe(u),Ln(f),g,We(d),lt(h)),this.state$.subscribe(),this.actions$=c.pipe(lt(h)),!((s=this.config)===null||s===void 0)&&s.epic$&&this.config.epic$(this.actions$,this.state$).pipe(We(d)).subscribe({next:m=>this.dispatch(m),error:m=>console.error("[Epic] Error:",m)}),a){let m=sa(this,a);d.subscribe(()=>m())}}};function mo(r={},e={}){return new fn(r,e)}function Ae(...r){let e=new Set(r.map(t=>t.type));return t=>t.pipe(ge(n=>e.has(n.type)))}function rt(r={dispatch:!0}){return e=>(t,n)=>{let o=e(t,n);return r.dispatch===!1?o.pipe(ze(),G(i=>(console.error("[Effect] Error:",i),O()))):o.pipe(G(i=>(console.error("[Effect] Error:",i),O())))}}function aa(...r){return(e,t)=>ke(...r.map(n=>n(e,t)))}var $c=r=>r?.code||"internal",go=r=>O(_t($c(r)));function _c(r,e){let t=e.agents.length?r.filter(o=>e.agents.includes(o.id)||e.agents.includes(o.name)):r,n=t.find(o=>o.id===e.agent||o.name===e.agent)??t[0];return{agents:t,agentId:n?.id??null}}var hn=class{constructor(e){this.ctx=e;this.connect$=rt()((e,t)=>t.pipe(ge(n=>n.shown),He(1),W(()=>{let n=this.ctx.client;return n?Ee(O(nn()),n.agents().pipe(He(1),P(o=>nr(_c(o,this.ctx))),G(go))):O(_t("unauthorized"))})));this.select$=rt()(e=>ke(e.pipe(Ae(nr),P(({payload:t})=>t.agentId)),e.pipe(Ae(Qe),P(({payload:t})=>t))).pipe(ge(t=>!!t),W(t=>{let n=this.ctx.client;return n.conversations(t).pipe(He(1),W(o=>{let i=o?.[0];return i?n.agent(t).conversation(i.id).history().pipe(te(s=>V([on({agentId:t,detail:s}),...s.answering?[fo({agentId:t,conversationId:s.id,afterSeq:s.lastSeq??0})]:[]]))):ie}),G(go))})));this.run$=rt()(e=>ke(e.pipe(Ae(At),P(({payload:t})=>{let{agentId:n,conversationId:o,text:i,files:s}=t,a=this.conversation(n,o),l=(s??[]).map(c=>({name:c.name,mimeType:c.type||void 0,data:c}));return{c:a,events:l.length?a.send(i,{attachments:l}):a.send(i)}})),e.pipe(Ae(fo),P(({payload:t})=>{let{agentId:n,conversationId:o,afterSeq:i}=t,s=this.conversation(n,o);return{c:s,events:s.events(i)}}))).pipe(W(({c:t,events:n})=>this.follow$(t,n).pipe(We(e.pipe(Ae(et,Qe,St))),jn(cn())))));this.abort$=rt()(e=>e.pipe(Ae(et),te(({payload:t})=>{let{agentId:n,conversationId:o}=t;return!o||!this.ctx.client?ie:this.conversation(n,o).abort().pipe(ze(),G(()=>ie))})));this.rate$=rt()(e=>e.pipe(Ae(Et),te(({payload:t})=>{let{agentId:n,conversationId:o,messageId:i,rating:s,comment:a,previous:l}=t;return this.ctx.client?this.conversation(n,o).rate(i,s,a).pipe(ze(),G(()=>O(un({messageId:i,previous:l})))):ie})));this.failures$=rt()(e=>e.pipe(Ae(_t),$e(({payload:t})=>this.ctx.emit("error",{code:t})),ze()))}conversation(e,t){return this.ctx.client.agent(e).conversation(t??void 0)}follow$(e,t){let n=new Set;return t.pipe(Mt(o=>o.type!=="done"&&o.type!=="error",!0),$e(o=>{o.type==="message"&&o.data?.role==="assistant"&&!n.has(o.data.id)&&(n.add(o.data.id),this.ctx.emit("answer",{text:o.data.text,agent:e.agent,conversationId:o.conversationId})),o.type==="error"&&this.ctx.emit("error",{code:o.data?.code??"internal"})}),P(o=>ln(o)),G(go))}};var mn={shown:!1,agents:[],agentId:null,conversationId:null,messages:[],answering:!1,live:null,notice:null,files:[],commentFor:null};function vo(r){let e=(r.toolCalls??[]).map(t=>t?.name).filter(t=>!!t);return{id:r.id,role:r.role,text:r.text??"",tools:Array.from(new Set(e)),attachments:(r.attachments??[]).map(t=>t.name),feedback:r.feedback?.rating??null}}var Sc=/^local:/,la={conversationId:null,messages:[],answering:!1,live:null,notice:null,files:[],commentFor:null},ca=Xs(mn,B(rn,(r,{payload:e})=>r.shown||!e?r:{...r,shown:!0}),B(nn,r=>({...r,notice:{kind:"busy",what:"connecting"}})),B(_t,(r,{payload:e})=>({...r,answering:!1,live:null,notice:{kind:"error",code:e}})),B(rr,(r,{payload:e})=>({...r,notice:e?{kind:"busy",what:"verifying"}:r.notice?.kind==="busy"&&r.notice.what==="verifying"?null:r.notice})),B(nr,(r,{payload:e})=>({...r,agents:e.agents,agentId:e.agentId,notice:e.agentId?null:{kind:"error",code:"agent-unavailable"}})),B(Qe,(r,{payload:e})=>({...r,...la,agentId:e})),B(on,(r,{payload:e})=>e.agentId!==r.agentId?r:{...r,conversationId:e.detail.id,messages:(e.detail.messages??[]).map(vo),answering:!!e.detail.answering,live:null,notice:e.detail.answering?{kind:"busy",what:"thinking"}:null}),B(St,r=>({...r,...la})),B(At,(r,{payload:e})=>({...r,messages:[...r.messages,{id:`local:${r.messages.length}`,role:"user",text:e.text,tools:[],attachments:(e.files??[]).map(t=>t.name),feedback:null}],files:[],answering:!0,notice:{kind:"busy",what:"thinking"}})),B(sn,(r,{payload:e})=>{if(!r.agents.find(i=>i.id===r.agentId)?.allowAttachments)return{...r,notice:{kind:"error",code:"attachments-off"}};let n=[...r.files,...e],o=Fn(n);return o?{...r,notice:{kind:"error",code:o}}:{...r,files:n,notice:r.notice?.kind==="error"?null:r.notice}}),B(an,(r,{payload:e})=>({...r,files:r.files.filter((t,n)=>n!==e),notice:r.notice?.kind==="error"?null:r.notice})),B(ln,(r,{payload:e})=>Ac(r,e)),B(cn,r=>({...r,answering:!1,live:null,notice:r.notice?.kind==="busy"?null:r.notice})),B(Et,(r,{payload:e})=>({...r,messages:r.messages.map(t=>t.id===e.messageId?{...t,feedback:e.rating}:t),commentFor:e.rating==="down"&&e.comment===void 0&&e.previous!=="down"?e.messageId:null})),B(un,(r,{payload:e})=>({...r,messages:r.messages.map(t=>t.id===e.messageId?{...t,feedback:e.previous}:t),commentFor:r.commentFor===e.messageId?null:r.commentFor})),B(Ct,r=>({...r,commentFor:null})),B(et,r=>({...r,answering:!1,live:null,notice:{kind:"info",what:"stopped"}})));function Ac(r,e){let t=r.conversationId??e.conversationId;if(e.conversationId!==t)return r;if(e.type==="error")return{...r,conversationId:t,live:null,notice:{kind:"error",code:e.data?.code??"internal"}};if(e.type==="delta")return Ec({...r,conversationId:t},e);if(e.type!=="message"||!e.data?.id)return{...r,conversationId:t};let n=vo(e.data);if(r.messages.some(a=>a.id===n.id))return{...r,conversationId:t};let o=[...r.messages],i=n.role==="user"?o.findIndex(a=>Sc.test(a.id)&&a.text===n.text):-1;i>=0?o[i]=n:o.push(n);let s=n.role==="assistant"?null:r.live;return{...r,conversationId:t,messages:o,live:s}}function Ec(r,e){if(!r.answering||!e.runId)return r;let t=Number(e.data?.segment)||0,n=typeof e.data?.text=="string"?e.data.text:"",o=r.live?.runId===e.runId?r.live:null;return o&&t<o.segment||o&&t===o.segment&&n.length<o.text.length?r:{...r,live:{runId:e.runId,segment:t,text:n}}}var gn=class{constructor(e,t={}){this.destroy$=new oe;let n=new hn(e);this.store=mo({reducer$:O(ca),initialState$:O({...mn,...t}),epic$:aa(n.select$,n.run$,n.abort$,n.rate$,n.failures$,n.connect$),destroy$:this.destroy$}),this.state$=this.store.state$.pipe(Pn())}dispatch(e){this.store.dispatch(e)}destroy(){this.destroy$.next(),this.destroy$.complete()}};var ua={title:"Chat",open:"Open chat",close:"Close chat",newChat:"New conversation",placeholder:"Type a message",send:"Send",stop:"Stop",thinking:"Thinking",connecting:"Connecting",pickAgent:"Assistant",usedTools:"Used",verifying:"Checking that you are human",attach:"Attach files",attached:"Attached files",removeFile:"Remove",filesOnly:"Please look at the attached files.",helpful:"Helpful",notHelpful:"Not helpful",whatWentWrong:"What was wrong? (optional)",sendFeedback:"Send",skipFeedback:"Skip",thanks:"Thanks for the feedback",errors:{"limit-reached":"This conversation is full - start a new one.","cap-reached":"The assistant is not available right now - try again later.","agent-unavailable":"This assistant is not available.","session-expired":"Your session ended - reload the page.","credential-expired":"Please sign in again.",aborted:"Stopped.",internal:"Something went wrong - try again.",unauthorized:"This chat is not allowed here.","bad-request":"That did not work - try again.",network:"No connection - try again.","attachments-off":"This assistant does not take files.","attachments-unsupported":"This assistant cannot read that kind of file.","attachment-invalid":"Only images, PDF and text files can be attached.","attachment-too-large":"That file is too large (images 5 MB, PDF 10 MB, text 1 MB).","attachment-limit":"At most 5 files and 15 MB in one message.","attachment-missing":"A file was lost - attach it again.","attachment-not-uploaded":"A file did not finish uploading - attach it again.",default:"Something went wrong - try again."}},Cc={title:"\u0427\u0430\u0442",open:"\u041E\u0442\u0432\u043E\u0440\u0438 \u0447\u0430\u0442\u0430",close:"\u0417\u0430\u0442\u0432\u043E\u0440\u0438 \u0447\u0430\u0442\u0430",newChat:"\u041D\u043E\u0432 \u0440\u0430\u0437\u0433\u043E\u0432\u043E\u0440",placeholder:"\u041D\u0430\u043F\u0438\u0448\u0435\u0442\u0435 \u0441\u044A\u043E\u0431\u0449\u0435\u043D\u0438\u0435",send:"\u0418\u0437\u043F\u0440\u0430\u0442\u0438",stop:"\u0421\u043F\u0440\u0438",thinking:"\u041C\u0438\u0441\u043B\u044F",connecting:"\u0421\u0432\u044A\u0440\u0437\u0432\u0430\u043D\u0435",pickAgent:"\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442",usedTools:"\u0418\u0437\u043F\u043E\u043B\u0437\u0432\u0430\u043D\u043E",verifying:"\u041F\u0440\u043E\u0432\u0435\u0440\u043A\u0430, \u0447\u0435 \u0441\u0442\u0435 \u0447\u043E\u0432\u0435\u043A",attach:"\u041F\u0440\u0438\u043A\u0430\u0447\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u0435",attached:"\u041F\u0440\u0438\u043A\u0430\u0447\u0435\u043D\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u0435",removeFile:"\u041F\u0440\u0435\u043C\u0430\u0445\u043D\u0438",filesOnly:"\u041C\u043E\u043B\u044F, \u0440\u0430\u0437\u0433\u043B\u0435\u0434\u0430\u0439\u0442\u0435 \u043F\u0440\u0438\u043A\u0430\u0447\u0435\u043D\u0438\u0442\u0435 \u0444\u0430\u0439\u043B\u043E\u0432\u0435.",helpful:"\u041F\u043E\u043B\u0435\u0437\u043D\u043E",notHelpful:"\u041D\u0435 \u0435 \u043F\u043E\u043B\u0435\u0437\u043D\u043E",whatWentWrong:"\u041A\u0430\u043A\u0432\u043E \u043D\u0435 \u0431\u0435\u0448\u0435 \u043D\u0430\u0440\u0435\u0434? (\u043F\u043E \u0436\u0435\u043B\u0430\u043D\u0438\u0435)",sendFeedback:"\u0418\u0437\u043F\u0440\u0430\u0442\u0438",skipFeedback:"\u041F\u0440\u043E\u043F\u0443\u0441\u043D\u0438",thanks:"\u0411\u043B\u0430\u0433\u043E\u0434\u0430\u0440\u0438\u043C \u0437\u0430 \u043E\u0442\u0437\u0438\u0432\u0430",errors:{"limit-reached":"\u0420\u0430\u0437\u0433\u043E\u0432\u043E\u0440\u044A\u0442 \u0435 \u043F\u044A\u043B\u0435\u043D - \u0437\u0430\u043F\u043E\u0447\u043D\u0435\u0442\u0435 \u043D\u043E\u0432.","cap-reached":"\u0410\u0441\u0438\u0441\u0442\u0435\u043D\u0442\u044A\u0442 \u043D\u0435 \u0435 \u0434\u043E\u0441\u0442\u044A\u043F\u0435\u043D \u0432 \u043C\u043E\u043C\u0435\u043D\u0442\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043F\u043E-\u043A\u044A\u0441\u043D\u043E.","agent-unavailable":"\u0422\u043E\u0437\u0438 \u0430\u0441\u0438\u0441\u0442\u0435\u043D\u0442 \u043D\u0435 \u0435 \u0434\u043E\u0441\u0442\u044A\u043F\u0435\u043D.","session-expired":"\u0421\u0435\u0441\u0438\u044F\u0442\u0430 \u0438\u0437\u0442\u0435\u0447\u0435 - \u043F\u0440\u0435\u0437\u0430\u0440\u0435\u0434\u0435\u0442\u0435 \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430\u0442\u0430.","credential-expired":"\u041C\u043E\u043B\u044F, \u0432\u043B\u0435\u0437\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",aborted:"\u0421\u043F\u0440\u044F\u043D\u043E.",internal:"\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",unauthorized:"\u0422\u043E\u0437\u0438 \u0447\u0430\u0442 \u043D\u0435 \u0435 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043D \u0442\u0443\u043A.","bad-request":"\u041D\u0435 \u0441\u0435 \u043F\u043E\u043B\u0443\u0447\u0438 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.",network:"\u041D\u044F\u043C\u0430 \u0432\u0440\u044A\u0437\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E.","attachments-off":"\u0422\u043E\u0437\u0438 \u0430\u0441\u0438\u0441\u0442\u0435\u043D\u0442 \u043D\u0435 \u043F\u0440\u0438\u0435\u043C\u0430 \u0444\u0430\u0439\u043B\u043E\u0432\u0435.","attachments-unsupported":"\u0422\u043E\u0437\u0438 \u0430\u0441\u0438\u0441\u0442\u0435\u043D\u0442 \u043D\u0435 \u043C\u043E\u0436\u0435 \u0434\u0430 \u0447\u0435\u0442\u0435 \u0442\u0430\u043A\u044A\u0432 \u0444\u0430\u0439\u043B.","attachment-invalid":"\u041C\u043E\u0436\u0435 \u0434\u0430 \u043F\u0440\u0438\u043A\u0430\u0447\u0438\u0442\u0435 \u0441\u0430\u043C\u043E \u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F, PDF \u0438 \u0442\u0435\u043A\u0441\u0442\u043E\u0432\u0438 \u0444\u0430\u0439\u043B\u043E\u0432\u0435.","attachment-too-large":"\u0424\u0430\u0439\u043B\u044A\u0442 \u0435 \u0442\u0432\u044A\u0440\u0434\u0435 \u0433\u043E\u043B\u044F\u043C (\u0438\u0437\u043E\u0431\u0440\u0430\u0436\u0435\u043D\u0438\u044F 5 MB, PDF 10 MB, \u0442\u0435\u043A\u0441\u0442 1 MB).","attachment-limit":"\u041D\u0430\u0439-\u043C\u043D\u043E\u0433\u043E 5 \u0444\u0430\u0439\u043B\u0430 \u0438 15 MB \u0432 \u0435\u0434\u043D\u043E \u0441\u044A\u043E\u0431\u0449\u0435\u043D\u0438\u0435.","attachment-missing":"\u0424\u0430\u0439\u043B \u0441\u0435 \u0438\u0437\u0433\u0443\u0431\u0438 - \u043F\u0440\u0438\u043A\u0430\u0447\u0435\u0442\u0435 \u0433\u043E \u043E\u0442\u043D\u043E\u0432\u043E.","attachment-not-uploaded":"\u0424\u0430\u0439\u043B \u043D\u0435 \u0441\u0435 \u043A\u0430\u0447\u0438 \u0434\u043E\u043A\u0440\u0430\u0439 - \u043F\u0440\u0438\u043A\u0430\u0447\u0435\u0442\u0435 \u0433\u043E \u043E\u0442\u043D\u043E\u0432\u043E.",default:"\u041D\u0435\u0449\u043E \u0441\u0435 \u043E\u0431\u044A\u0440\u043A\u0430 - \u043E\u043F\u0438\u0442\u0430\u0439\u0442\u0435 \u043E\u0442\u043D\u043E\u0432\u043E."}},pa={en:ua,bg:Cc};function bo(r,e={}){let t=String(r||"en").toLowerCase().split("-")[0],n=pa[t]??ua;return{...n,...e,errors:{...n.errors,...e.errors??{}}}}var da=`
37
37
  :host {
38
38
  --_accent: var(--lf-chat-accent, #4f46e5);
39
39
  --_accent-fg: var(--lf-chat-accent-fg, #ffffff);
@@ -163,6 +163,26 @@ header select {
163
163
  @keyframes lf-caret { 50% { opacity: 0; } }
164
164
  @media (prefers-reduced-motion: reduce) { .msg.live > :last-child::after { animation: none; } }
165
165
  .tools { font-size: 12px; color: var(--_muted); margin-top: 4px; }
166
+ .rate { display: flex; align-items: center; gap: 2px; margin-top: -6px; }
167
+ .thumb {
168
+ border: 0; background: transparent; color: var(--_muted);
169
+ width: 26px; height: 26px; border-radius: 6px; display: grid; place-items: center; cursor: pointer;
170
+ }
171
+ .thumb svg { width: 14px; height: 14px; }
172
+ .thumb:hover, .thumb:focus-visible { background: var(--_bot-bg); color: var(--_fg); }
173
+ .thumb.on { color: var(--_accent); }
174
+ .thanks { font-size: 12px; color: var(--_muted); margin-left: 4px; }
175
+ .comment { display: flex; gap: 6px; align-items: center; max-width: 85%; }
176
+ .comment input {
177
+ flex: 1; min-width: 0; font: inherit; font-size: 13px; color: var(--_fg); background: var(--_bg);
178
+ border: 1px solid var(--_border); border-radius: 8px; padding: 6px 8px;
179
+ }
180
+ .comment button {
181
+ border: 1px solid var(--_border); background: transparent; color: var(--_fg);
182
+ border-radius: 8px; padding: 5px 9px; font-size: 13px; cursor: pointer;
183
+ }
184
+ .comment button[type='submit'] { border-color: var(--_accent); color: var(--_accent); }
185
+ .comment .skip { color: var(--_muted); }
166
186
 
167
187
  .welcome { color: var(--_muted); }
168
188
  .suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
@@ -227,7 +247,7 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
227
247
  .msg-files { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
228
248
  .msg-file { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: rgba(255,255,255,0.2); }
229
249
  .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
230
- `;var la="https://lambforge.com/agent-turnstile.html",_c="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit";var dn=null;function $c(r){let e=r.defaultView;return e?.turnstile?Promise.resolve(e.turnstile):(dn||(dn=new Promise((t,n)=>{let o=r.createElement("script");o.src=_c,o.async=!0,o.onload=()=>e.turnstile?t(e.turnstile):n(new Error("turnstile did not load")),o.onerror=()=>{dn=null,n(new Error("turnstile did not load"))},r.head.append(o)})),dn)}function mo(r){let e=r.host.ownerDocument;if(r.sitekey)return $c(e).then(o=>new Promise((i,s)=>{let a=e.createElement("div");r.host.append(a);let l,c=()=>{try{l&&o.remove(l)}catch{}a.remove()};l=o.render(a,{sitekey:r.sitekey,appearance:"interaction-only",callback:u=>{c(),i(u)},"error-callback":()=>{c(),s(new Error("turnstile failed"))}})}));let t=new URL(r.hostedUrl||la),n=e.defaultView;return t.searchParams.set("origin",n.location.origin),new Promise((o,i)=>{let s=e.createElement("iframe");s.title="Bot check",s.src=t.href;let a=setTimeout(()=>c(new Error("turnstile timed out")),12e4),l=u=>{if(u.origin!==t.origin||u.source!==s.contentWindow)return;let p=u.data;p?.type==="lambforge-turnstile"&&(p.token?c(null,p.token):c(new Error(p.error||"turnstile failed")))},c=(u,p)=>{clearTimeout(a),n.removeEventListener("message",l),s.remove(),u?i(u):o(p)};n.addEventListener("message",l),r.host.append(s)})}var rr="lambforge-agent-chat",Ac=g.svg`<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>`,ca=g.svg`<path d="M18 6 6 18M6 6l12 12"/>`,Sc=g.svg`<path d="M12 5v14M5 12h14"/>`,Ec=g.svg`<path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/>`,Cc=[...Pr,".md",".csv",".yaml",".yml",".json",".txt"].join(","),tr=r=>g.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${r}</svg>`,D=class extends g.LitElement{constructor(){super(...arguments);this.open=!1;this.mode="drawer";this.position="bottom-right";this.theme="light";this.agent="";this.agents="";this.locale="";this.heading="";this.url="";this.publishableKey="";this.tokenUrl="";this.turnstileSitekey="";this.turnstileUrl="";this.strings={};this.lastSize=""}get shown(){return this.mode!=="drawer"||this.open}get t(){return ho(this.locale||this.ownerDocument.documentElement.lang||"en",this.strings)}connect(){return Ee(()=>{let t=new fn({client:this.resolveClient(),agent:this.agent,agents:this.agents.split(",").map(n=>n.trim()).filter(Boolean),emit:(n,o)=>this.emit(n,o)},{shown:this.shown});return this.store=t,t.state$.pipe(kt(()=>{t.destroy(),this.store===t&&(this.store=void 0)}))})}dispatch(t){this.store?.dispatch(t)}OnUpdate(){this.shown&&this.dispatch(Qr(!0))}resolveClient(){if(this.client)return this.client;let t=this.url||void 0;if(this.getToken){let n=this.getToken;this.client=new We({url:t,getToken:()=>n()})}else if(this.tokenUrl){let n=this.tokenUrl;this.client=new We({url:t,getToken:()=>fetch(n,{credentials:"include",headers:{accept:"application/json"}}).then(o=>{if(!o.ok)throw new Error(`token-url answered ${o.status}`);return o.json()})})}else if(this.publishableKey)this.client=new We({url:t,anonymous:{publishableKey:this.publishableKey,turnstileToken:()=>this.verifyHuman()}});else return console.error(`[${rr}] give it a session: token-url, publishable-key, .getToken or .client`),null;return this.client}verifyHuman(){return this.dispatch(Xt(!0)),this.turnstileBox().then(t=>mo({host:t,sitekey:this.turnstileSitekey||null,hostedUrl:this.turnstileUrl||null})).finally(()=>this.dispatch(Xt(!1)))}async turnstileBox(){for(let t=0;t<100;t++){let n=this.shadowRoot?.querySelector(".turnstile");if(n)return n;await new Promise(o=>setTimeout(o,20))}throw new Error("turnstile: the chat is not rendered")}send(t){return([n])=>{let o=n.files,i=String(t??"").trim()||(o.length?this.t.filesOnly:"");!i||n.answering||!n.agentId||this.dispatch(_t({agentId:n.agentId,conversationId:n.conversationId,text:i,...o.length?{files:o}:{}}))}}attach(t){let n=Array.from(t??[]);n.length&&this.dispatch(rn(n))}detach(t){this.dispatch(nn(t))}onPaste(t,n){let o=Array.from(t.clipboardData?.files??[]);!n||!o.length||(t.preventDefault(),this.attach(o))}stopAnswer(){return([t])=>{t.agentId&&this.dispatch(Qe({agentId:t.agentId,conversationId:t.conversationId}))}}pick(t){this.dispatch(Xe(t))}startOver(){this.dispatch(wt()),this.focusInput()}setOpen(t){t!==this.open&&(this.open=t,this.emit("open-change",{open:t}),t?this.focusInput():this.shadowRoot?.querySelector(".launcher")?.focus())}focusInput(){this.updateComplete.then(()=>requestAnimationFrame(()=>this.shadowRoot?.querySelector("textarea")?.focus()))}submit(t,n){if(t.preventDefault(),n.answering)return this.stopAnswer()([n]);let o=this.shadowRoot?.querySelector("textarea");o&&(this.send(o.value)([n]),o.value="",this.autosize(o))}onInputKey(t,n){t.key==="Enter"&&!t.shiftKey&&!t.isComposing&&(t.preventDefault(),n.answering||this.submit(t,n))}autosize(t){t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,140)}px`}onPanelKey(t){if(t.key==="Escape"&&this.mode==="drawer"){t.stopPropagation(),this.setOpen(!1);return}if(t.key!=="Tab"||this.mode==="inline")return;let n=this.shadowRoot?.querySelector(".panel"),o=Array.from(n?.querySelectorAll("button:not([disabled]), select, textarea, a[href]")??[]).filter(l=>!l.closest("[hidden]"));if(!o.length)return;let i=o[0],s=o[o.length-1],a=this.shadowRoot?.activeElement;t.shiftKey&&a===i?(t.preventDefault(),s.focus()):!t.shiftKey&&a===s&&(t.preventDefault(),i.focus())}emit(t,n){this.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0}))}noticeText(t){if(!t)return"";let n=this.t;return t.kind==="busy"?n[t.what]:t.kind==="info"?n.errors.aborted:n.errors[t.code]??n.errors.default}view(t){let n=this.t,o=this.mode==="drawer",i=t.agents.find(p=>p.id===t.agentId)??null,s=this.heading||i?.name||n.title,a=!!i?.allowAttachments,l=t.live?.text?t.live:null,c=l&&t.notice?.kind==="busy"?null:t.notice,u=`${t.messages.length}:${l?.text.length??0}`;if(u!==this.lastSize){let p=u.split(":")[0]!==this.lastSize.split(":")[0];this.lastSize=u,(p||this.atBottom())&&this.updateComplete.then(()=>requestAnimationFrame(()=>this.scrollDown()))}return g.html`
250
+ `;var fa="https://lambforge.com/agent-turnstile.html",kc="https://challenges.cloudflare.com/turnstile/v0/api.js?render=explicit";var vn=null;function Tc(r){let e=r.defaultView;return e?.turnstile?Promise.resolve(e.turnstile):(vn||(vn=new Promise((t,n)=>{let o=r.createElement("script");o.src=kc,o.async=!0,o.onload=()=>e.turnstile?t(e.turnstile):n(new Error("turnstile did not load")),o.onerror=()=>{vn=null,n(new Error("turnstile did not load"))},r.head.append(o)})),vn)}function yo(r){let e=r.host.ownerDocument;if(r.sitekey)return Tc(e).then(o=>new Promise((i,s)=>{let a=e.createElement("div");r.host.append(a);let l,c=()=>{try{l&&o.remove(l)}catch{}a.remove()};l=o.render(a,{sitekey:r.sitekey,appearance:"interaction-only",callback:u=>{c(),i(u)},"error-callback":()=>{c(),s(new Error("turnstile failed"))}})}));let t=new URL(r.hostedUrl||fa),n=e.defaultView;return t.searchParams.set("origin",n.location.origin),new Promise((o,i)=>{let s=e.createElement("iframe");s.title="Bot check",s.src=t.href;let a=setTimeout(()=>c(new Error("turnstile timed out")),12e4),l=u=>{if(u.origin!==t.origin||u.source!==s.contentWindow)return;let p=u.data;p?.type==="lambforge-turnstile"&&(p.token?c(null,p.token):c(new Error(p.error||"turnstile failed")))},c=(u,p)=>{clearTimeout(a),n.removeEventListener("message",l),s.remove(),u?i(u):o(p)};n.addEventListener("message",l),r.host.append(s)})}var ir="lambforge-agent-chat",Ic=v.svg`<path d="M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z"/>`,ha=v.svg`<path d="M18 6 6 18M6 6l12 12"/>`,Oc=v.svg`<path d="M12 5v14M5 12h14"/>`,Pc=v.svg`<path d="M7 10v12M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"/>`,jc=v.svg`<path d="M17 14V2M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"/>`,Rc=v.svg`<path d="m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48"/>`,Mc=[...Rr,".md",".csv",".yaml",".yml",".json",".txt"].join(","),nt=r=>v.html`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${r}</svg>`,F=class extends v.LitElement{constructor(){super(...arguments);this.open=!1;this.mode="drawer";this.position="bottom-right";this.theme="light";this.agent="";this.agents="";this.locale="";this.heading="";this.url="";this.publishableKey="";this.tokenUrl="";this.turnstileSitekey="";this.turnstileUrl="";this.strings={};this.lastSize=""}get shown(){return this.mode!=="drawer"||this.open}get t(){return bo(this.locale||this.ownerDocument.documentElement.lang||"en",this.strings)}connect(){return Ce(()=>{let t=new gn({client:this.resolveClient(),agent:this.agent,agents:this.agents.split(",").map(n=>n.trim()).filter(Boolean),emit:(n,o)=>this.emit(n,o)},{shown:this.shown});return this.store=t,t.state$.pipe(jt(()=>{t.destroy(),this.store===t&&(this.store=void 0)}))})}dispatch(t){this.store?.dispatch(t)}OnUpdate(){this.shown&&this.dispatch(rn(!0))}resolveClient(){if(this.client)return this.client;let t=this.url||void 0;if(this.getToken){let n=this.getToken;this.client=new Ke({url:t,getToken:()=>n()})}else if(this.tokenUrl){let n=this.tokenUrl;this.client=new Ke({url:t,getToken:()=>fetch(n,{credentials:"include",headers:{accept:"application/json"}}).then(o=>{if(!o.ok)throw new Error(`token-url answered ${o.status}`);return o.json()})})}else if(this.publishableKey)this.client=new Ke({url:t,anonymous:{publishableKey:this.publishableKey,turnstileToken:()=>this.verifyHuman()}});else return console.error(`[${ir}] give it a session: token-url, publishable-key, .getToken or .client`),null;return this.client}verifyHuman(){return this.dispatch(rr(!0)),this.turnstileBox().then(t=>yo({host:t,sitekey:this.turnstileSitekey||null,hostedUrl:this.turnstileUrl||null})).finally(()=>this.dispatch(rr(!1)))}async turnstileBox(){for(let t=0;t<100;t++){let n=this.shadowRoot?.querySelector(".turnstile");if(n)return n;await new Promise(o=>setTimeout(o,20))}throw new Error("turnstile: the chat is not rendered")}send(t){return([n])=>{let o=n.files,i=String(t??"").trim()||(o.length?this.t.filesOnly:"");!i||n.answering||!n.agentId||this.dispatch(At({agentId:n.agentId,conversationId:n.conversationId,text:i,...o.length?{files:o}:{}}))}}attach(t){let n=Array.from(t??[]);n.length&&this.dispatch(sn(n))}detach(t){this.dispatch(an(t))}onPaste(t,n){let o=Array.from(t.clipboardData?.files??[]);!n||!o.length||(t.preventDefault(),this.attach(o))}stopAnswer(){return([t])=>{t.agentId&&this.dispatch(et({agentId:t.agentId,conversationId:t.conversationId}))}}pick(t){this.dispatch(Qe(t))}startOver(){this.dispatch(St()),this.focusInput()}setOpen(t){t!==this.open&&(this.open=t,this.emit("open-change",{open:t}),t?this.focusInput():this.shadowRoot?.querySelector(".launcher")?.focus())}focusInput(){this.updateComplete.then(()=>requestAnimationFrame(()=>this.shadowRoot?.querySelector("textarea")?.focus()))}submit(t,n){if(t.preventDefault(),n.answering)return this.stopAnswer()([n]);let o=this.shadowRoot?.querySelector("textarea");o&&(this.send(o.value)([n]),o.value="",this.autosize(o))}onInputKey(t,n){t.key==="Enter"&&!t.shiftKey&&!t.isComposing&&(t.preventDefault(),n.answering||this.submit(t,n))}autosize(t){t.style.height="auto",t.style.height=`${Math.min(t.scrollHeight,140)}px`}onPanelKey(t){if(t.key==="Escape"&&this.mode==="drawer"){t.stopPropagation(),this.setOpen(!1);return}if(t.key!=="Tab"||this.mode==="inline")return;let n=this.shadowRoot?.querySelector(".panel"),o=Array.from(n?.querySelectorAll("button:not([disabled]), select, textarea, a[href]")??[]).filter(l=>!l.closest("[hidden]"));if(!o.length)return;let i=o[0],s=o[o.length-1],a=this.shadowRoot?.activeElement;t.shiftKey&&a===i?(t.preventDefault(),s.focus()):!t.shiftKey&&a===s&&(t.preventDefault(),i.focus())}emit(t,n){this.dispatchEvent(new CustomEvent(t,{detail:n,bubbles:!0,composed:!0}))}noticeText(t){if(!t)return"";let n=this.t;return t.kind==="busy"?n[t.what]:t.kind==="info"?n.errors.aborted:n.errors[t.code]??n.errors.default}view(t){let n=this.t,o=this.mode==="drawer",i=t.agents.find(p=>p.id===t.agentId)??null,s=this.heading||i?.name||n.title,a=!!i?.allowAttachments,l=t.live?.text?t.live:null,c=l&&t.notice?.kind==="busy"?null:t.notice,u=`${t.messages.length}:${l?.text.length??0}`;if(u!==this.lastSize){let p=u.split(":")[0]!==this.lastSize.split(":")[0];this.lastSize=u,(p||this.atBottom())&&this.updateComplete.then(()=>requestAnimationFrame(()=>this.scrollDown()))}return v.html`
231
251
  <button
232
252
  class="launcher"
233
253
  part="launcher"
@@ -238,7 +258,7 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
238
258
  ?hidden=${!o}
239
259
  @click=${()=>this.setOpen(!this.open)}
240
260
  >
241
- <slot name="launcher">${tr(Ac)}</slot>
261
+ <slot name="launcher">${nt(Ic)}</slot>
242
262
  </button>
243
263
  <section
244
264
  class="panel"
@@ -258,13 +278,13 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
258
278
  ?hidden=${t.agents.length<2}
259
279
  @change=${p=>this.pick(p.target.value)}
260
280
  >
261
- ${t.agents.map(p=>g.html`<option value=${p.id} ?selected=${p.id===t.agentId}>${p.name}</option>`)}
281
+ ${t.agents.map(p=>v.html`<option value=${p.id} ?selected=${p.id===t.agentId}>${p.name}</option>`)}
262
282
  </select>
263
283
  <button class="icon new" part="new" type="button" title=${n.newChat} aria-label=${n.newChat} @click=${()=>this.startOver()}>
264
- ${tr(Sc)}
284
+ ${nt(Oc)}
265
285
  </button>
266
286
  <button class="icon close" part="close" type="button" title=${n.close} aria-label=${n.close} @click=${()=>this.setOpen(!1)}>
267
- ${tr(ca)}
287
+ ${nt(ha)}
268
288
  </button>
269
289
  </header>
270
290
  <div
@@ -275,8 +295,8 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
275
295
  aria-relevant="additions"
276
296
  aria-busy=${String(!!l)}
277
297
  >
278
- ${t.messages.length?t.messages.map(p=>this.bubble(p)):this.intro(t)}
279
- ${l?g.html`<div class="msg assistant live" part="message assistant live">${Jt(l.text)}</div>`:""}
298
+ ${t.messages.length?t.messages.map(p=>this.bubble(p,t)):this.intro(t)}
299
+ ${l?v.html`<div class="msg assistant live" part="message assistant live">${er(l.text)}</div>`:""}
280
300
  </div>
281
301
  <div class="turnstile" ?hidden=${c?.kind!=="busy"||c.what!=="verifying"}></div>
282
302
  <div
@@ -284,22 +304,22 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
284
304
  part="status"
285
305
  role="status"
286
306
  >${this.noticeText(c)}</div>
287
- ${a&&t.files.length?g.html`<ul class="files" part="files" aria-label=${n.attached}>
288
- ${t.files.map((p,d)=>g.html`<li class="file" part="file">
307
+ ${a&&t.files.length?v.html`<ul class="files" part="files" aria-label=${n.attached}>
308
+ ${t.files.map((p,f)=>v.html`<li class="file" part="file">
289
309
  <span class="file-name" title=${p.name}>${p.name}</span>
290
- <button type="button" class="file-remove" aria-label=${`${n.removeFile}: ${p.name}`} @click=${()=>this.detach(d)}>
291
- ${tr(ca)}
310
+ <button type="button" class="file-remove" aria-label=${`${n.removeFile}: ${p.name}`} @click=${()=>this.detach(f)}>
311
+ ${nt(ha)}
292
312
  </button>
293
313
  </li>`)}
294
314
  </ul>`:""}
295
315
  <form part="composer" @submit=${p=>this.submit(p,t)}>
296
- ${a?g.html`<input
316
+ ${a?v.html`<input
297
317
  class="file-input"
298
318
  type="file"
299
319
  multiple
300
- accept=${Cc}
320
+ accept=${Mc}
301
321
  hidden
302
- @change=${p=>{let d=p.target;this.attach(d.files),d.value=""}}
322
+ @change=${p=>{let f=p.target;this.attach(f.files),f.value=""}}
303
323
  />
304
324
  <button
305
325
  class="icon attach"
@@ -310,7 +330,7 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
310
330
  ?disabled=${t.answering}
311
331
  @click=${()=>this.shadowRoot?.querySelector(".file-input")?.click()}
312
332
  >
313
- ${tr(Ec)}
333
+ ${nt(Rc)}
314
334
  </button>`:""}
315
335
  <label class="sr-only" for="lf-input">${n.placeholder}</label>
316
336
  <textarea
@@ -327,13 +347,30 @@ textarea:focus-visible { outline: 2px solid var(--_accent); outline-offset: 0; b
327
347
  </button>
328
348
  </form>
329
349
  </section>
330
- `}bubble(t){return t.role==="user"?g.html`<div class="msg user" part="message user">${t.text}${t.attachments?.length?g.html`<div class="msg-files">${t.attachments.map(n=>g.html`<span class="msg-file">${n}</span>`)}</div>`:""}</div>`:g.html`<div class="msg assistant" part="message assistant">
331
- ${Jt(t.text)}
332
- ${t.tools.length?g.html`<div class="tools">${this.t.usedTools}: ${t.tools.join(", ")}</div>`:""}
333
- </div>`}intro(t){let n=t.agents.find(o=>o.id===t.agentId);return!n?.welcome&&!n?.suggestions?.length?"":g.html`
334
- ${n.welcome?g.html`<div class="msg assistant welcome">${Jt(n.welcome)}</div>`:""}
335
- ${n.suggestions?.length?g.html`<div class="suggestions">
336
- ${n.suggestions.map(o=>g.html`<button type="button" part="suggestion" @click=${()=>this.send(o)([t])}>${o}</button>`)}
350
+ `}rateAnswer(t,n,o){return([i])=>{if(!i.agentId||!i.conversationId)return;let s=o===void 0&&t.feedback===n?null:n;this.dispatch(Et({agentId:i.agentId,conversationId:i.conversationId,messageId:t.id,rating:s,...o!==void 0?{comment:o}:{},previous:t.feedback}))}}sendComment(t,n,o){t.preventDefault();let s=t.target.querySelector("input")?.value.trim()??"";if(!s){this.dispatch(Ct());return}this.rateAnswer(n,"down",s)([o])}feedback(t,n){if(n.agents.find(s=>s.id===n.agentId)?.allowFeedback===!1||t.id.startsWith("local:")||!n.conversationId)return"";let i=this.t;return v.html`
351
+ <div class="rate" part="rate">
352
+ <button type="button" class="thumb ${t.feedback==="up"?"on":""}" part="thumb-up"
353
+ title=${i.helpful} aria-label=${i.helpful} aria-pressed=${t.feedback==="up"?"true":"false"}
354
+ @click=${()=>this.rateAnswer(t,"up")([n])}>${nt(Pc)}</button>
355
+ <button type="button" class="thumb ${t.feedback==="down"?"on":""}" part="thumb-down"
356
+ title=${i.notHelpful} aria-label=${i.notHelpful} aria-pressed=${t.feedback==="down"?"true":"false"}
357
+ @click=${()=>this.rateAnswer(t,"down")([n])}>${nt(jc)}</button>
358
+ ${t.feedback&&n.commentFor!==t.id?v.html`<span class="thanks" aria-live="polite">${i.thanks}</span>`:""}
359
+ </div>
360
+ ${n.commentFor===t.id?v.html`<form class="comment" part="feedback-comment" @submit=${s=>this.sendComment(s,t,n)}>
361
+ <input type="text" maxlength="1000" placeholder=${i.whatWentWrong} aria-label=${i.whatWentWrong}
362
+ @keydown=${s=>s.key==="Escape"&&this.dispatch(Ct())} />
363
+ <button type="submit">${i.sendFeedback}</button>
364
+ <button type="button" class="skip" @click=${()=>this.dispatch(Ct())}>${i.skipFeedback}</button>
365
+ </form>`:""}
366
+ `}bubble(t,n){return t.role==="user"?v.html`<div class="msg user" part="message user">${t.text}${t.attachments?.length?v.html`<div class="msg-files">${t.attachments.map(o=>v.html`<span class="msg-file">${o}</span>`)}</div>`:""}</div>`:v.html`<div class="msg assistant" part="message assistant">
367
+ ${er(t.text)}
368
+ ${t.tools.length?v.html`<div class="tools">${this.t.usedTools}: ${t.tools.join(", ")}</div>`:""}
369
+ </div>
370
+ ${this.feedback(t,n)}`}intro(t){let n=t.agents.find(o=>o.id===t.agentId);return!n?.welcome&&!n?.suggestions?.length?"":v.html`
371
+ ${n.welcome?v.html`<div class="msg assistant welcome">${er(n.welcome)}</div>`:""}
372
+ ${n.suggestions?.length?v.html`<div class="suggestions">
373
+ ${n.suggestions.map(o=>v.html`<button type="button" part="suggestion" @click=${()=>this.send(o)([t])}>${o}</button>`)}
337
374
  </div>`:""}
338
- `}atBottom(){let t=this.shadowRoot?.querySelector(".messages");return!t||t.scrollHeight-t.scrollTop-t.clientHeight<80}scrollDown(){let t=this.shadowRoot?.querySelector(".messages");t&&(t.scrollTop=t.scrollHeight)}};F([(0,g.property)({type:Boolean,reflect:!0})],D.prototype,"open",2),F([(0,g.property)({reflect:!0})],D.prototype,"mode",2),F([(0,g.property)({reflect:!0})],D.prototype,"position",2),F([(0,g.property)({reflect:!0})],D.prototype,"theme",2),F([(0,g.property)()],D.prototype,"agent",2),F([(0,g.property)()],D.prototype,"agents",2),F([(0,g.property)()],D.prototype,"locale",2),F([(0,g.property)({attribute:"title"})],D.prototype,"heading",2),F([(0,g.property)()],D.prototype,"url",2),F([(0,g.property)({attribute:"publishable-key"})],D.prototype,"publishableKey",2),F([(0,g.property)({attribute:"token-url"})],D.prototype,"tokenUrl",2),F([(0,g.property)({attribute:"turnstile-sitekey"})],D.prototype,"turnstileSitekey",2),F([(0,g.property)({attribute:"turnstile-url"})],D.prototype,"turnstileUrl",2),F([(0,g.property)({attribute:!1})],D.prototype,"client",2),F([(0,g.property)({attribute:!1})],D.prototype,"getToken",2),F([(0,g.property)({attribute:!1})],D.prototype,"strings",2),D=F([(0,ua.Component)({Settings:{selector:rr,styles:[(0,g.unsafeCSS)(aa)]},Loading:()=>g.html``,Error:()=>g.html``,State(){return this.connect()},Render:()=>function(r){return this.view(r)}})],D);var hn=document.currentScript,Tc={key:"publishable-key",tokenUrl:"token-url",agent:"agent",agents:"agents",url:"url",mode:"mode",position:"position",locale:"locale",title:"title",theme:"theme",open:"open",turnstileSitekey:"turnstile-sitekey",turnstileUrl:"turnstile-url"};if(hn&&(hn.dataset.key||hn.dataset.tokenUrl)){let r=()=>{let e=document.createElement(rr);for(let[t,n]of Object.entries(Tc)){let o=hn.dataset[t];o!==void 0&&e.setAttribute(n,o)}document.body.append(e)};document.body?r():document.addEventListener("DOMContentLoaded",r,{once:!0})}})();
375
+ `}atBottom(){let t=this.shadowRoot?.querySelector(".messages");return!t||t.scrollHeight-t.scrollTop-t.clientHeight<80}scrollDown(){let t=this.shadowRoot?.querySelector(".messages");t&&(t.scrollTop=t.scrollHeight)}};q([(0,v.property)({type:Boolean,reflect:!0})],F.prototype,"open",2),q([(0,v.property)({reflect:!0})],F.prototype,"mode",2),q([(0,v.property)({reflect:!0})],F.prototype,"position",2),q([(0,v.property)({reflect:!0})],F.prototype,"theme",2),q([(0,v.property)()],F.prototype,"agent",2),q([(0,v.property)()],F.prototype,"agents",2),q([(0,v.property)()],F.prototype,"locale",2),q([(0,v.property)({attribute:"title"})],F.prototype,"heading",2),q([(0,v.property)()],F.prototype,"url",2),q([(0,v.property)({attribute:"publishable-key"})],F.prototype,"publishableKey",2),q([(0,v.property)({attribute:"token-url"})],F.prototype,"tokenUrl",2),q([(0,v.property)({attribute:"turnstile-sitekey"})],F.prototype,"turnstileSitekey",2),q([(0,v.property)({attribute:"turnstile-url"})],F.prototype,"turnstileUrl",2),q([(0,v.property)({attribute:!1})],F.prototype,"client",2),q([(0,v.property)({attribute:!1})],F.prototype,"getToken",2),q([(0,v.property)({attribute:!1})],F.prototype,"strings",2),F=q([(0,ma.Component)({Settings:{selector:ir,styles:[(0,v.unsafeCSS)(da)]},Loading:()=>v.html``,Error:()=>v.html``,State(){return this.connect()},Render:()=>function(r){return this.view(r)}})],F);var bn=document.currentScript,Lc={key:"publishable-key",tokenUrl:"token-url",agent:"agent",agents:"agents",url:"url",mode:"mode",position:"position",locale:"locale",title:"title",theme:"theme",open:"open",turnstileSitekey:"turnstile-sitekey",turnstileUrl:"turnstile-url"};if(bn&&(bn.dataset.key||bn.dataset.tokenUrl)){let r=()=>{let e=document.createElement(ir);for(let[t,n]of Object.entries(Lc)){let o=bn.dataset[t];o!==void 0&&e.setAttribute(n,o)}document.body.append(e)};document.body?r():document.addEventListener("DOMContentLoaded",r,{once:!0})}})();
339
376
  //# sourceMappingURL=agent-chat.js.map